@verdocs/web-sdk 5.0.3 → 5.0.5

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 (309) hide show
  1. package/dist/cjs/{Datastore-b1742da2.js → Datastore-5b860927.js} +2 -2
  2. package/dist/cjs/index-ccac8641.js +4 -4
  3. package/dist/cjs/loader.cjs.js +1 -1
  4. package/dist/cjs/verdocs-build.cjs.entry.js +1 -1
  5. package/dist/cjs/verdocs-button_2.cjs.entry.js +2 -2
  6. package/dist/cjs/verdocs-checkbox_6.cjs.entry.js +8 -8
  7. package/dist/cjs/verdocs-contact-picker_2.cjs.entry.js +1 -1
  8. package/dist/cjs/verdocs-dialog.cjs.entry.js +1 -1
  9. package/dist/cjs/verdocs-envelope-document-page.cjs.entry.js +1 -1
  10. package/dist/cjs/verdocs-envelope-recipient-link_2.cjs.entry.js +3 -3
  11. package/dist/cjs/verdocs-envelope-recipient-summary.cjs.entry.js +1 -1
  12. package/dist/cjs/verdocs-envelope-sidebar.cjs.entry.js +1 -1
  13. package/dist/cjs/verdocs-envelopes-list.cjs.entry.js +6 -6
  14. package/dist/cjs/verdocs-field-attachment_13.cjs.entry.js +4 -4
  15. package/dist/cjs/verdocs-field-payment.cjs.entry.js +1 -1
  16. package/dist/cjs/verdocs-file-chooser_2.cjs.entry.js +1 -1
  17. package/dist/cjs/verdocs-kba-dialog_2.cjs.entry.js +1 -1
  18. package/dist/cjs/verdocs-menu-panel_2.cjs.entry.js +241 -0
  19. package/dist/cjs/verdocs-ok-dialog.cjs.entry.js +1 -1
  20. package/dist/cjs/verdocs-organization-card_2.cjs.entry.js +2 -2
  21. package/dist/cjs/verdocs-pagination_2.cjs.entry.js +1 -1
  22. package/dist/cjs/verdocs-preview_6.cjs.entry.js +2836 -156
  23. package/dist/cjs/verdocs-quick-functions.cjs.entry.js +1 -1
  24. package/dist/cjs/verdocs-radio-button.cjs.entry.js +1 -1
  25. package/dist/cjs/verdocs-search-tabs.cjs.entry.js +1 -1
  26. package/dist/cjs/verdocs-spinner.cjs.entry.js +1 -1
  27. package/dist/cjs/verdocs-status-indicator.cjs.entry.js +2 -2
  28. package/dist/cjs/verdocs-template-card.cjs.entry.js +1 -1
  29. package/dist/cjs/verdocs-template-document-page_2.cjs.entry.js +2 -2
  30. package/dist/cjs/verdocs-template-star.cjs.entry.js +1 -1
  31. package/dist/cjs/verdocs-template-tags.cjs.entry.js +1 -1
  32. package/dist/cjs/verdocs-web-sdk.cjs.js +1 -1
  33. package/dist/collection/collection-manifest.json +1 -0
  34. package/dist/collection/components/controls/verdocs-help-icon/verdocs-help-icon.css +1 -1
  35. package/dist/collection/components/controls/verdocs-help-icon/verdocs-help-icon.js +1 -1
  36. package/dist/collection/components/controls/verdocs-menu-panel/verdocs-menu-panel.css +42 -0
  37. package/dist/collection/components/controls/verdocs-menu-panel/verdocs-menu-panel.js +159 -0
  38. package/dist/collection/components/controls/verdocs-organization-card/verdocs-organization-card.js +1 -1
  39. package/dist/collection/components/controls/verdocs-pagination/verdocs-pagination.js +1 -1
  40. package/dist/collection/components/controls/verdocs-portal/verdocs-portal.js +1 -1
  41. package/dist/collection/components/controls/verdocs-progress-bar/verdocs-progress-bar.js +1 -1
  42. package/dist/collection/components/controls/verdocs-radio-button/verdocs-radio-button.js +1 -1
  43. package/dist/collection/components/controls/verdocs-select-input/verdocs-select-input.css +2 -2
  44. package/dist/collection/components/controls/verdocs-select-input/verdocs-select-input.js +1 -1
  45. package/dist/collection/components/controls/verdocs-spinner/verdocs-spinner.js +1 -1
  46. package/dist/collection/components/controls/verdocs-switch/verdocs-switch.js +2 -2
  47. package/dist/collection/components/controls/verdocs-text-input/verdocs-text-input.css +2 -2
  48. package/dist/collection/components/controls/verdocs-text-input/verdocs-text-input.js +4 -4
  49. package/dist/collection/components/controls/verdocs-toggle-button/verdocs-toggle-button.js +1 -1
  50. package/dist/collection/components/controls/verdocs-toolbar-icon/verdocs-toolbar-icon.js +1 -1
  51. package/dist/collection/components/dialogs/verdocs-dialog/verdocs-dialog.js +1 -1
  52. package/dist/collection/components/dialogs/verdocs-initial-dialog/verdocs-initial-dialog.js +1 -1
  53. package/dist/collection/components/dialogs/verdocs-ok-dialog/verdocs-ok-dialog.js +1 -1
  54. package/dist/collection/components/dialogs/verdocs-signature-dialog/verdocs-signature-dialog.js +1 -1
  55. package/dist/collection/components/dialogs/verdocs-upload-dialog/verdocs-upload-dialog.js +1 -1
  56. package/dist/collection/components/elements/verdocs-quick-functions/verdocs-quick-functions.js +1 -1
  57. package/dist/collection/components/elements/verdocs-search-tabs/verdocs-search-tabs.js +1 -1
  58. package/dist/collection/components/envelopes/verdocs-envelope-document-page/verdocs-envelope-document-page.js +1 -1
  59. package/dist/collection/components/envelopes/verdocs-envelopes-list/verdocs-envelopes-list.js +6 -6
  60. package/dist/collection/components/envelopes/verdocs-status-indicator/verdocs-status-indicator.js +2 -2
  61. package/dist/collection/components/templates/verdocs-template-card/verdocs-template-card.js +1 -1
  62. package/dist/collection/components/templates/verdocs-template-role-properties/verdocs-template-role-properties.css +27 -42
  63. package/dist/collection/components/templates/verdocs-template-role-properties/verdocs-template-role-properties.js +12 -14
  64. package/dist/collection/components/templates/verdocs-template-roles/verdocs-template-roles.css +74 -120
  65. package/dist/collection/components/templates/verdocs-template-roles/verdocs-template-roles.js +118 -101
  66. package/dist/collection/components/templates/verdocs-template-star/verdocs-template-star.js +1 -1
  67. package/dist/collection/components/templates/verdocs-template-tags/verdocs-template-tags.js +1 -1
  68. package/dist/collection/utils/Datastore.js +2 -2
  69. package/dist/components/index.js +2 -0
  70. package/dist/components/{p-ed88b8d2.js → p-005c3387.js} +3 -3
  71. package/dist/components/{p-0d063bf9.js → p-052fcdac.js} +4 -4
  72. package/dist/components/{p-0a69031f.js → p-053a0408.js} +6 -6
  73. package/dist/components/{p-1c2cf1be.js → p-15b1e7a0.js} +10 -8
  74. package/dist/components/{p-293ea62f.js → p-1a77c51b.js} +5 -5
  75. package/dist/components/{p-f990140a.js → p-2ef2d490.js} +2 -2
  76. package/dist/components/{p-c8fedb4e.js → p-325b3828.js} +6 -6
  77. package/dist/components/{p-6315b90f.js → p-332a97b3.js} +1 -1
  78. package/dist/components/{p-b0c02eb8.js → p-3a621e5d.js} +7 -7
  79. package/dist/components/{p-18999830.js → p-41a75ad6.js} +1 -1
  80. package/dist/components/{p-5eb45a4f.js → p-44ae3c75.js} +1 -1
  81. package/dist/components/{p-1e2e8b1c.js → p-4d3b9ee9.js} +1 -1
  82. package/dist/components/{p-1e67ebdf.js → p-53585e13.js} +18 -26
  83. package/dist/components/{p-c7b00ce6.js → p-5654568d.js} +1 -1
  84. package/dist/components/{p-ecc818bb.js → p-5df09a0d.js} +6 -6
  85. package/dist/components/{p-315d6592.js → p-62743fd3.js} +2 -2
  86. package/dist/components/{p-dd701894.js → p-6506ddb4.js} +6 -6
  87. package/dist/components/{p-5d4bbcd0.js → p-6719b0d7.js} +1 -1
  88. package/dist/components/{p-d9704a51.js → p-6c18617e.js} +6 -6
  89. package/dist/components/p-6e8464b6.js +3028 -0
  90. package/dist/components/{p-fd96322b.js → p-7246d2ee.js} +6 -6
  91. package/dist/components/{p-0ca7012b.js → p-7f32e087.js} +2 -2
  92. package/dist/components/{p-9b3c58d9.js → p-987a8392.js} +22 -22
  93. package/dist/components/{p-b9034018.js → p-9c0b30f8.js} +3 -3
  94. package/dist/components/{p-b16c202a.js → p-9cfd8022.js} +1 -1
  95. package/dist/components/{p-a3e12c74.js → p-9fb98ea2.js} +1 -1
  96. package/dist/components/{p-f72b9c45.js → p-a2f6d2c6.js} +1 -1
  97. package/dist/components/{p-1ca705bc.js → p-b36c979b.js} +6 -6
  98. package/dist/{esm/Datastore-52fcbac6.js → components/p-b712e729.js} +2 -2
  99. package/dist/components/{p-cf6ea837.js → p-b7d080eb.js} +1 -1
  100. package/dist/components/p-be261487.js +79 -0
  101. package/dist/components/{p-9bb47a5a.js → p-c00770e6.js} +1 -1
  102. package/dist/components/{p-4afcdc84.js → p-c9a4ef35.js} +6 -6
  103. package/dist/components/{p-9c3fd545.js → p-ca8e3721.js} +8 -8
  104. package/dist/components/{p-5a9cea40.js → p-cce871bf.js} +3 -3
  105. package/dist/components/{p-df3afaa8.js → p-cef9df4b.js} +20 -20
  106. package/dist/components/{p-74452a2b.js → p-d9074622.js} +3 -3
  107. package/dist/components/{p-d25cdbff.js → p-f0f1ed82.js} +21 -21
  108. package/dist/components/{p-58c2bd5d.js → p-f0f6e862.js} +2 -2
  109. package/dist/components/{p-49153610.js → p-f21ef4fb.js} +7 -7
  110. package/dist/components/{p-fcad60f5.js → p-f4e068a9.js} +2 -2
  111. package/dist/components/{p-2548f3f0.js → p-f7462b26.js} +1 -1
  112. package/dist/components/verdocs-auth.js +2 -2
  113. package/dist/components/verdocs-build.js +64 -58
  114. package/dist/components/verdocs-contact-picker.js +1 -1
  115. package/dist/components/verdocs-dialog.js +1 -1
  116. package/dist/components/verdocs-dropdown.js +1 -1
  117. package/dist/components/verdocs-envelope-document-page.js +1 -1
  118. package/dist/components/verdocs-envelope-recipient-link.js +1 -1
  119. package/dist/components/verdocs-envelope-recipient-summary.js +1 -1
  120. package/dist/components/verdocs-envelope-sidebar.js +8 -8
  121. package/dist/components/verdocs-envelopes-list.js +13 -13
  122. package/dist/components/verdocs-field-attachment.js +1 -1
  123. package/dist/components/verdocs-field-checkbox.js +1 -1
  124. package/dist/components/verdocs-field-date.js +1 -1
  125. package/dist/components/verdocs-field-dropdown.js +1 -1
  126. package/dist/components/verdocs-field-initial.js +1 -1
  127. package/dist/components/verdocs-field-payment.js +6 -6
  128. package/dist/components/verdocs-field-radio.js +1 -1
  129. package/dist/components/verdocs-field-signature.js +1 -1
  130. package/dist/components/verdocs-field-textarea.js +1 -1
  131. package/dist/components/verdocs-field-textbox.js +1 -1
  132. package/dist/components/verdocs-field-timestamp.js +1 -1
  133. package/dist/components/verdocs-help-icon.js +1 -1
  134. package/dist/components/verdocs-initial-dialog.js +1 -1
  135. package/dist/components/verdocs-menu-panel.d.ts +11 -0
  136. package/dist/components/verdocs-menu-panel.js +6 -0
  137. package/dist/components/verdocs-ok-dialog.js +1 -1
  138. package/dist/components/verdocs-organization-card.js +2 -2
  139. package/dist/components/verdocs-pagination.js +1 -1
  140. package/dist/components/verdocs-portal.js +1 -1
  141. package/dist/components/verdocs-preview.js +1 -1
  142. package/dist/components/verdocs-progress-bar.js +1 -1
  143. package/dist/components/verdocs-quick-functions.js +1 -1
  144. package/dist/components/verdocs-radio-button.js +1 -1
  145. package/dist/components/verdocs-search-tabs.js +1 -1
  146. package/dist/components/verdocs-select-input.js +1 -1
  147. package/dist/components/verdocs-send.js +1 -1
  148. package/dist/components/verdocs-sign.js +6 -6
  149. package/dist/components/verdocs-signature-dialog.js +1 -1
  150. package/dist/components/verdocs-spinner.js +1 -1
  151. package/dist/components/verdocs-status-indicator.js +1 -1
  152. package/dist/components/verdocs-switch.js +1 -1
  153. package/dist/components/verdocs-template-attachments.js +1 -1
  154. package/dist/components/verdocs-template-build-tabs.js +1 -1
  155. package/dist/components/verdocs-template-card.js +1 -1
  156. package/dist/components/verdocs-template-create.js +1 -1
  157. package/dist/components/verdocs-template-document-page.js +1 -1
  158. package/dist/components/verdocs-template-field-properties.js +1 -1
  159. package/dist/components/verdocs-template-fields.js +1 -1
  160. package/dist/components/verdocs-template-role-properties.js +1 -1
  161. package/dist/components/verdocs-template-roles.js +1 -1
  162. package/dist/components/verdocs-template-star.js +1 -1
  163. package/dist/components/verdocs-template-tags.js +1 -1
  164. package/dist/components/verdocs-templates-list.js +8 -8
  165. package/dist/components/verdocs-text-input.js +1 -1
  166. package/dist/components/verdocs-toggle-button.js +1 -1
  167. package/dist/components/verdocs-toolbar-icon.js +1 -1
  168. package/dist/components/verdocs-upload-dialog.js +1 -1
  169. package/dist/components/verdocs-view.js +1 -1
  170. package/dist/{components/p-da4d4eed.js → esm/Datastore-d29d4aeb.js} +2 -2
  171. package/dist/esm/index-272d51a4.js +4 -4
  172. package/dist/esm/loader.js +1 -1
  173. package/dist/esm/verdocs-build.entry.js +1 -1
  174. package/dist/esm/verdocs-button_2.entry.js +2 -2
  175. package/dist/esm/verdocs-checkbox_6.entry.js +8 -8
  176. package/dist/esm/verdocs-contact-picker_2.entry.js +1 -1
  177. package/dist/esm/verdocs-dialog.entry.js +1 -1
  178. package/dist/esm/verdocs-envelope-document-page.entry.js +1 -1
  179. package/dist/esm/verdocs-envelope-recipient-link_2.entry.js +3 -3
  180. package/dist/esm/verdocs-envelope-recipient-summary.entry.js +1 -1
  181. package/dist/esm/verdocs-envelope-sidebar.entry.js +1 -1
  182. package/dist/esm/verdocs-envelopes-list.entry.js +6 -6
  183. package/dist/esm/verdocs-field-attachment_13.entry.js +4 -4
  184. package/dist/esm/verdocs-field-payment.entry.js +1 -1
  185. package/dist/esm/verdocs-file-chooser_2.entry.js +1 -1
  186. package/dist/esm/verdocs-kba-dialog_2.entry.js +1 -1
  187. package/dist/esm/verdocs-menu-panel_2.entry.js +236 -0
  188. package/dist/esm/verdocs-ok-dialog.entry.js +1 -1
  189. package/dist/esm/verdocs-organization-card_2.entry.js +2 -2
  190. package/dist/esm/verdocs-pagination_2.entry.js +1 -1
  191. package/dist/esm/verdocs-preview_6.entry.js +2784 -104
  192. package/dist/esm/verdocs-quick-functions.entry.js +1 -1
  193. package/dist/esm/verdocs-radio-button.entry.js +1 -1
  194. package/dist/esm/verdocs-search-tabs.entry.js +1 -1
  195. package/dist/esm/verdocs-spinner.entry.js +1 -1
  196. package/dist/esm/verdocs-status-indicator.entry.js +2 -2
  197. package/dist/esm/verdocs-template-card.entry.js +1 -1
  198. package/dist/esm/verdocs-template-document-page_2.entry.js +2 -2
  199. package/dist/esm/verdocs-template-star.entry.js +1 -1
  200. package/dist/esm/verdocs-template-tags.entry.js +1 -1
  201. package/dist/esm/verdocs-web-sdk.js +1 -1
  202. package/dist/esm-es5/{Datastore-52fcbac6.js → Datastore-d29d4aeb.js} +1 -1
  203. package/dist/esm-es5/index-272d51a4.js +1 -1
  204. package/dist/esm-es5/loader.js +1 -1
  205. package/dist/esm-es5/verdocs-build.entry.js +1 -1
  206. package/dist/esm-es5/verdocs-button_2.entry.js +1 -1
  207. package/dist/esm-es5/verdocs-checkbox_6.entry.js +1 -1
  208. package/dist/esm-es5/verdocs-contact-picker_2.entry.js +1 -1
  209. package/dist/esm-es5/verdocs-dialog.entry.js +1 -1
  210. package/dist/esm-es5/verdocs-envelope-document-page.entry.js +1 -1
  211. package/dist/esm-es5/verdocs-envelope-recipient-link_2.entry.js +1 -1
  212. package/dist/esm-es5/verdocs-envelope-recipient-summary.entry.js +1 -1
  213. package/dist/esm-es5/verdocs-envelope-sidebar.entry.js +1 -1
  214. package/dist/esm-es5/verdocs-envelopes-list.entry.js +1 -1
  215. package/dist/esm-es5/verdocs-field-attachment_13.entry.js +1 -1
  216. package/dist/esm-es5/verdocs-field-payment.entry.js +1 -1
  217. package/dist/esm-es5/verdocs-file-chooser_2.entry.js +1 -1
  218. package/dist/esm-es5/verdocs-kba-dialog_2.entry.js +1 -1
  219. package/dist/esm-es5/verdocs-menu-panel_2.entry.js +1 -0
  220. package/dist/esm-es5/verdocs-ok-dialog.entry.js +1 -1
  221. package/dist/esm-es5/verdocs-organization-card_2.entry.js +1 -1
  222. package/dist/esm-es5/verdocs-pagination_2.entry.js +1 -1
  223. package/dist/esm-es5/verdocs-preview_6.entry.js +7 -1
  224. package/dist/esm-es5/verdocs-quick-functions.entry.js +1 -1
  225. package/dist/esm-es5/verdocs-radio-button.entry.js +1 -1
  226. package/dist/esm-es5/verdocs-search-tabs.entry.js +1 -1
  227. package/dist/esm-es5/verdocs-spinner.entry.js +1 -1
  228. package/dist/esm-es5/verdocs-status-indicator.entry.js +1 -1
  229. package/dist/esm-es5/verdocs-template-card.entry.js +1 -1
  230. package/dist/esm-es5/verdocs-template-document-page_2.entry.js +1 -1
  231. package/dist/esm-es5/verdocs-template-star.entry.js +1 -1
  232. package/dist/esm-es5/verdocs-template-tags.entry.js +1 -1
  233. package/dist/esm-es5/verdocs-web-sdk.js +1 -1
  234. package/dist/types/components/controls/verdocs-menu-panel/verdocs-menu-panel.d.ts +38 -0
  235. package/dist/types/components/templates/verdocs-template-role-properties/verdocs-template-role-properties.d.ts +1 -1
  236. package/dist/types/components/templates/verdocs-template-roles/verdocs-template-roles.d.ts +5 -3
  237. package/dist/types/components.d.ts +101 -8
  238. package/dist/verdocs-web-sdk/{p-65c5398e.entry.js → p-152b9acd.entry.js} +1 -1
  239. package/dist/verdocs-web-sdk/{p-c9f40726.system.entry.js → p-1d5b9103.system.entry.js} +1 -1
  240. package/dist/verdocs-web-sdk/{p-3364cc13.system.entry.js → p-1e191c20.system.entry.js} +1 -1
  241. package/dist/verdocs-web-sdk/{p-7464b84f.entry.js → p-1e495c60.entry.js} +1 -1
  242. package/dist/verdocs-web-sdk/{p-192403ff.entry.js → p-2224ca6d.entry.js} +1 -1
  243. package/dist/verdocs-web-sdk/{p-5b541da2.entry.js → p-27da4a2b.entry.js} +1 -1
  244. package/dist/verdocs-web-sdk/{p-914e131c.system.entry.js → p-2eae32d9.system.entry.js} +1 -1
  245. package/dist/verdocs-web-sdk/p-306bde40.system.entry.js +1 -0
  246. package/dist/verdocs-web-sdk/{p-0e9de098.entry.js → p-30c3f624.entry.js} +1 -1
  247. package/dist/verdocs-web-sdk/{p-8d401072.system.entry.js → p-3268dad0.system.entry.js} +1 -1
  248. package/dist/verdocs-web-sdk/p-365ed258.entry.js +1 -0
  249. package/dist/verdocs-web-sdk/{p-ddb17b3e.entry.js → p-39b72c10.entry.js} +1 -1
  250. package/dist/verdocs-web-sdk/{p-f5d01982.system.entry.js → p-417f71da.system.entry.js} +1 -1
  251. package/dist/verdocs-web-sdk/{p-b8737f7b.entry.js → p-42b157d2.entry.js} +1 -1
  252. package/dist/verdocs-web-sdk/{p-771c2f92.entry.js → p-47f32221.entry.js} +1 -1
  253. package/dist/verdocs-web-sdk/p-48ff3cce.system.entry.js +1 -0
  254. package/dist/verdocs-web-sdk/{p-b0b958a0.entry.js → p-51c97029.entry.js} +1 -1
  255. package/dist/verdocs-web-sdk/{p-c18c718f.system.js → p-55de8cd1.system.js} +1 -1
  256. package/dist/verdocs-web-sdk/{p-7c8938e7.system.entry.js → p-5824962b.system.entry.js} +1 -1
  257. package/dist/verdocs-web-sdk/{p-aebb0cd9.system.entry.js → p-5aa76635.system.entry.js} +1 -1
  258. package/dist/verdocs-web-sdk/{p-89cdecac.system.entry.js → p-5b0cd815.system.entry.js} +1 -1
  259. package/dist/verdocs-web-sdk/{p-0950534e.system.entry.js → p-5ce491ac.system.entry.js} +1 -1
  260. package/dist/verdocs-web-sdk/{p-c6fd3e53.system.entry.js → p-6237ce51.system.entry.js} +1 -1
  261. package/dist/verdocs-web-sdk/{p-c7cd6843.entry.js → p-660bda06.entry.js} +1 -1
  262. package/dist/verdocs-web-sdk/{p-97b00cae.system.entry.js → p-7e73805f.system.entry.js} +1 -1
  263. package/dist/verdocs-web-sdk/{p-8c03fc69.entry.js → p-8025cac7.entry.js} +1 -1
  264. package/dist/verdocs-web-sdk/{p-3dd29b19.entry.js → p-87ac8456.entry.js} +1 -1
  265. package/dist/verdocs-web-sdk/{p-475ea471.system.entry.js → p-899617aa.system.entry.js} +1 -1
  266. package/dist/verdocs-web-sdk/{p-2a1287ec.entry.js → p-899fa588.entry.js} +1 -1
  267. package/dist/verdocs-web-sdk/{p-511a4ecc.system.entry.js → p-90bc3ad0.system.entry.js} +1 -1
  268. package/dist/verdocs-web-sdk/{p-a242aa80.system.entry.js → p-917aab58.system.entry.js} +1 -1
  269. package/dist/verdocs-web-sdk/{p-524f37a0.entry.js → p-92364765.entry.js} +1 -1
  270. package/dist/verdocs-web-sdk/{p-f9b37af2.system.entry.js → p-94fe5817.system.entry.js} +1 -1
  271. package/dist/verdocs-web-sdk/{p-41cbf650.entry.js → p-99b819ad.entry.js} +1 -1
  272. package/dist/verdocs-web-sdk/{p-df04f0ca.entry.js → p-a8809e33.entry.js} +1 -1
  273. package/dist/verdocs-web-sdk/{p-a9635106.system.entry.js → p-ac6ecfad.system.entry.js} +1 -1
  274. package/dist/verdocs-web-sdk/{p-62f15675.system.entry.js → p-ad3d07a6.system.entry.js} +1 -1
  275. package/dist/verdocs-web-sdk/p-aeae75a3.system.entry.js +7 -0
  276. package/dist/verdocs-web-sdk/{p-df392ef9.entry.js → p-af1802b6.entry.js} +1 -1
  277. package/dist/verdocs-web-sdk/p-b712e729.js +1 -0
  278. package/dist/verdocs-web-sdk/{p-a165607e.entry.js → p-be4ec401.entry.js} +1 -1
  279. package/dist/verdocs-web-sdk/{p-bcc23811.entry.js → p-bea73364.entry.js} +1 -1
  280. package/dist/verdocs-web-sdk/{p-92153daa.system.entry.js → p-c253ae24.system.entry.js} +1 -1
  281. package/dist/verdocs-web-sdk/{p-92ffc207.entry.js → p-c2766b5a.entry.js} +1 -1
  282. package/dist/verdocs-web-sdk/{p-6ced37ed.entry.js → p-c3593d47.entry.js} +1 -1
  283. package/dist/verdocs-web-sdk/p-c555a700.entry.js +8 -0
  284. package/dist/verdocs-web-sdk/{p-3e7915e9.system.entry.js → p-c60743ac.system.entry.js} +1 -1
  285. package/dist/verdocs-web-sdk/{p-b9b6b3b4.system.entry.js → p-c94b0dc5.system.entry.js} +1 -1
  286. package/dist/verdocs-web-sdk/{p-78191329.system.entry.js → p-cb7aa6b8.system.entry.js} +1 -1
  287. package/dist/verdocs-web-sdk/{p-54f085d1.entry.js → p-db4c36aa.entry.js} +1 -1
  288. package/dist/verdocs-web-sdk/{p-d475fff3.entry.js → p-dc558be5.entry.js} +1 -1
  289. package/dist/verdocs-web-sdk/p-e2b70dfb.system.js +1 -1
  290. package/dist/verdocs-web-sdk/{p-80ce3711.system.entry.js → p-e6d711e0.system.entry.js} +1 -1
  291. package/dist/verdocs-web-sdk/{p-ba8f5177.system.entry.js → p-f3b5052f.system.entry.js} +1 -1
  292. package/dist/verdocs-web-sdk/{p-9fb22181.entry.js → p-f40fe8d7.entry.js} +1 -1
  293. package/dist/verdocs-web-sdk/{p-e83cd333.entry.js → p-f6b77cd1.entry.js} +1 -1
  294. package/dist/verdocs-web-sdk/{p-d98cbd0f.system.entry.js → p-f84932fd.system.entry.js} +1 -1
  295. package/dist/verdocs-web-sdk/{p-6330dbef.entry.js → p-fc90cc87.entry.js} +1 -1
  296. package/dist/verdocs-web-sdk/{p-386d789c.system.entry.js → p-ff8143df.system.entry.js} +1 -1
  297. package/dist/verdocs-web-sdk/verdocs-web-sdk.esm.js +1 -1
  298. package/package.json +5 -4
  299. package/dist/cjs/verdocs-template-role-properties.cjs.entry.js +0 -184
  300. package/dist/components/p-8fbc64e9.js +0 -349
  301. package/dist/components/p-ea5954bd.js +0 -4
  302. package/dist/esm/verdocs-template-role-properties.entry.js +0 -180
  303. package/dist/esm-es5/verdocs-template-role-properties.entry.js +0 -1
  304. package/dist/verdocs-web-sdk/p-03244cd1.system.entry.js +0 -1
  305. package/dist/verdocs-web-sdk/p-9567cb7d.system.entry.js +0 -1
  306. package/dist/verdocs-web-sdk/p-982f1b36.system.entry.js +0 -1
  307. package/dist/verdocs-web-sdk/p-bb0effe1.entry.js +0 -1
  308. package/dist/verdocs-web-sdk/p-c33ae58a.entry.js +0 -1
  309. package/dist/verdocs-web-sdk/p-da4d4eed.js +0 -1
@@ -2,10 +2,10 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-ccac8641.js');
5
+ const index$1 = require('./index-ccac8641.js');
6
6
  const jsSdk = require('@verdocs/js-sdk');
7
7
  const errors = require('./errors-017fb835.js');
8
- const Datastore = require('./Datastore-b1742da2.js');
8
+ const Datastore = require('./Datastore-5b860927.js');
9
9
  const Toast = require('./Toast-d84d7bd3.js');
10
10
  const Icons = require('./Icons-9a6f2f7c.js');
11
11
  const format = require('./format-dc0f3757.js');
@@ -19,8 +19,8 @@ const VerdocsPreviewStyle0 = verdocsPreviewCss;
19
19
 
20
20
  const VerdocsPreview = class {
21
21
  constructor(hostRef) {
22
- index.registerInstance(this, hostRef);
23
- this.sdkError = index.createEvent(this, "sdkError", 7);
22
+ index$1.registerInstance(this, hostRef);
23
+ this.sdkError = index$1.createEvent(this, "sdkError", 7);
24
24
  this.templateListenerId = null;
25
25
  this.endpoint = jsSdk.VerdocsEndpoint.getDefault();
26
26
  this.templateId = null;
@@ -75,14 +75,14 @@ const VerdocsPreview = class {
75
75
  render() {
76
76
  var _a;
77
77
  if (this.loading) {
78
- return (index.h(index.Host, null, index.h("verdocs-loader", null)));
78
+ return (index$1.h(index$1.Host, null, index$1.h("verdocs-loader", null)));
79
79
  }
80
- return (index.h(index.Host, null, (((_a = this.template) === null || _a === void 0 ? void 0 : _a.documents) || []).map(document => {
80
+ return (index$1.h(index$1.Host, null, (((_a = this.template) === null || _a === void 0 ? void 0 : _a.documents) || []).map(document => {
81
81
  const pageNumbers = jsSdk.integerSequence(1, document.pages);
82
- return (index.h(index.Fragment, null, pageNumbers.map(pageNumber => {
82
+ return (index$1.h(index$1.Fragment, null, pageNumbers.map(pageNumber => {
83
83
  var _a;
84
84
  const pageSize = ((_a = document.page_sizes) === null || _a === void 0 ? void 0 : _a[pageNumber]) || { width: 612, height: 792 };
85
- return (index.h("verdocs-template-document-page", { templateId: document.template_id, documentId: document.id, pageNumber: pageNumber, disabled: true, editable: false, done: false, virtualWidth: pageSize.width, virtualHeight: pageSize.height, onPageRendered: e => this.handlePageRendered(e), layers: [
85
+ return (index$1.h("verdocs-template-document-page", { templateId: document.template_id, documentId: document.id, pageNumber: pageNumber, disabled: true, editable: false, done: false, virtualWidth: pageSize.width, virtualHeight: pageSize.height, onPageRendered: e => this.handlePageRendered(e), layers: [
86
86
  { name: 'page', type: 'canvas' },
87
87
  { name: 'controls', type: 'div' },
88
88
  ] }));
@@ -102,17 +102,17 @@ const verdocsSendCss = "@-webkit-keyframes verdocs-field-pulse{0%{background-col
102
102
  const VerdocsSendStyle0 = verdocsSendCss;
103
103
 
104
104
  const editIcon = '<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" tabindex="-1"><path d="M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34a.9959.9959 0 0 0-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z"></path></svg>';
105
- const startIcon$1 = '<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" tabindex="-1"><path d="M2 12C2 6.48 6.48 2 12 2s10 4.48 10 10-4.48 10-10 10S2 17.52 2 12zm10 6c3.31 0 6-2.69 6-6s-2.69-6-6-6-6 2.69-6 6 2.69 6 6 6z"></path></svg>';
106
- const stepIcon$1 = '<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" tabindex="-1"><path d="M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z"></path></svg>';
107
- const doneIcon$1 = '<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" tabindex="-1"><path d="m18 7-1.41-1.41-6.34 6.34 1.41 1.41L18 7zm4.24-1.41L11.66 16.17 7.48 12l-1.41 1.41L11.66 19l12-12-1.42-1.41zM.41 13.41 6 19l1.41-1.41L1.83 12 .41 13.41z"></path></svg>';
105
+ const startIcon = '<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" tabindex="-1"><path d="M2 12C2 6.48 6.48 2 12 2s10 4.48 10 10-4.48 10-10 10S2 17.52 2 12zm10 6c3.31 0 6-2.69 6-6s-2.69-6-6-6-6 2.69-6 6 2.69 6 6 6z"></path></svg>';
106
+ const stepIcon = '<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" tabindex="-1"><path d="M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z"></path></svg>';
107
+ const doneIcon = '<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" tabindex="-1"><path d="m18 7-1.41-1.41-6.34 6.34 1.41 1.41L18 7zm4.24-1.41L11.66 16.17 7.48 12l-1.41 1.41L11.66 19l12-12-1.42-1.41zM.41 13.41 6 19l1.41-1.41L1.83 12 .41 13.41z"></path></svg>';
108
108
  const VerdocsSend = class {
109
109
  constructor(hostRef) {
110
- index.registerInstance(this, hostRef);
111
- this.sendingEnvelope = index.createEvent(this, "sendingEnvelope", 7);
112
- this.send = index.createEvent(this, "send", 7);
113
- this.exit = index.createEvent(this, "exit", 7);
114
- this.sdkError = index.createEvent(this, "sdkError", 7);
115
- this.searchContacts = index.createEvent(this, "searchContacts", 7);
110
+ index$1.registerInstance(this, hostRef);
111
+ this.sendingEnvelope = index$1.createEvent(this, "sendingEnvelope", 7);
112
+ this.send = index$1.createEvent(this, "send", 7);
113
+ this.exit = index$1.createEvent(this, "exit", 7);
114
+ this.sdkError = index$1.createEvent(this, "sdkError", 7);
115
+ this.searchContacts = index$1.createEvent(this, "searchContacts", 7);
116
116
  this.templateListenerId = null;
117
117
  this.endpoint = jsSdk.VerdocsEndpoint.getDefault();
118
118
  this.templateId = null;
@@ -230,13 +230,13 @@ const VerdocsSend = class {
230
230
  getLevelIcon(level) {
231
231
  const levels = this.getLevels();
232
232
  if (level < 0) {
233
- return index.h("div", { class: "level-icon", innerHTML: startIcon$1 });
233
+ return index$1.h("div", { class: "level-icon", innerHTML: startIcon });
234
234
  }
235
235
  else if (level >= levels.length) {
236
- return index.h("div", { class: "level-icon", innerHTML: doneIcon$1 });
236
+ return index$1.h("div", { class: "level-icon", innerHTML: doneIcon });
237
237
  }
238
238
  else {
239
- return index.h("div", { class: "level-icon", innerHTML: stepIcon$1 });
239
+ return index$1.h("div", { class: "level-icon", innerHTML: stepIcon });
240
240
  }
241
241
  }
242
242
  handleSelectContact(e, role) {
@@ -295,24 +295,24 @@ const VerdocsSend = class {
295
295
  render() {
296
296
  var _a;
297
297
  if (this.loading) {
298
- return (index.h(index.Host, null, index.h("verdocs-loader", null)));
298
+ return (index$1.h(index$1.Host, null, index$1.h("verdocs-loader", null)));
299
299
  }
300
300
  if (!this.endpoint.session) {
301
- return (index.h(index.Host, { style: { display: 'flex' } }, index.h("verdocs-component-error", { message: "You must be authenticated to use this module." })));
301
+ return (index$1.h(index$1.Host, { style: { display: 'flex' } }, index$1.h("verdocs-component-error", { message: "You must be authenticated to use this module." })));
302
302
  }
303
303
  const levels = this.getLevels();
304
304
  const rolesAssigned = Object.values(this.rolesCompleted).filter(recipient => jsSdk.isValidEmail(recipient.email));
305
305
  // TODO: Reactivate once SMS is re-enabled
306
306
  // const rolesAssigned = Object.values(this.rolesCompleted).filter(recipient => isValidEmail(recipient.email) || isValidPhone(recipient.phone));
307
307
  const allRolesAssigned = rolesAssigned.length >= getRoleNames(this.template).length;
308
- return (index.h(index.Host, { class: { sendable: (_a = this.template) === null || _a === void 0 ? void 0 : _a.is_sendable } }, index.h("div", { class: "recipients" }, index.h("div", { class: "left-line" }), index.h("div", { class: `level level-start` }, this.getLevelIcon(-1), index.h("div", { class: "complete" }, "Send Envelope")), levels.map(level => (index.h("div", { class: `level level-${level}` }, this.getLevelIcon(level), this.getRolesAtLevel(level).map(role => {
308
+ return (index$1.h(index$1.Host, { class: { sendable: (_a = this.template) === null || _a === void 0 ? void 0 : _a.is_sendable } }, index$1.h("div", { class: "recipients" }, index$1.h("div", { class: "left-line" }), index$1.h("div", { class: `level level-start` }, this.getLevelIcon(-1), index$1.h("div", { class: "complete" }, "Send Envelope")), levels.map(level => (index$1.h("div", { class: `level level-${level}` }, this.getLevelIcon(level), this.getRolesAtLevel(level).map(role => {
309
309
  var _a, _b, _c, _d;
310
310
  const unknown = !role.email;
311
311
  const elId = `verdocs-send-recipient-${role.role_name}`;
312
312
  const roleIndex = getRoleIndex(this.template, role.role_name);
313
313
  const rgba = jsSdk.getRGBA(roleIndex);
314
- return unknown ? (index.h("div", { class: "recipient", "data-ri": roleIndex, "data-rn": role.role_name, style: { backgroundColor: rgba }, onClick: e => this.handleClickRole(e, role), id: elId }, ((_a = this.rolesCompleted[role.id]) === null || _a === void 0 ? void 0 : _a.first_name) ? jsSdk.formatFullName(this.rolesCompleted[role.id]) : role.role_name, index.h("div", { class: "icon", innerHTML: editIcon }), this.showPickerForId === role.id && (index.h("verdocs-portal", { anchor: elId, onClickAway: () => (this.showPickerForId = '') }, index.h("verdocs-contact-picker", { onExit: () => (this.showPickerForId = ''), onNext: e => this.handleSelectContact(e, role), contactSuggestions: this.sessionContacts, templateRole: (_b = this.rolesCompleted[role.id]) !== null && _b !== void 0 ? _b : role, onSearchContacts: e => { var _a; return (_a = this.searchContacts) === null || _a === void 0 ? void 0 : _a.emit(e.detail); } }))))) : (index.h("div", { class: "recipient", style: { borderColor: rgba }, onClick: e => this.handleClickRole(e, role), id: elId }, ((_c = this.rolesCompleted[role.id]) === null || _c === void 0 ? void 0 : _c.first_name) ? jsSdk.formatFullName(this.rolesCompleted[role.id]) : role.role_name, index.h("div", { class: "icon", innerHTML: editIcon }), this.showPickerForId === role.id && (index.h("verdocs-portal", { anchor: elId, onClickAway: () => (this.showPickerForId = '') }, index.h("verdocs-contact-picker", { onExit: () => (this.showPickerForId = ''), onNext: e => this.handleSelectContact(e, role), contactSuggestions: this.sessionContacts, templateRole: ((_d = this.rolesCompleted[role.id]) !== null && _d !== void 0 ? _d : role), onSearchContacts: e => { var _a; return (_a = this.searchContacts) === null || _a === void 0 ? void 0 : _a.emit(e.detail); } })))));
315
- })))), index.h("div", { class: `level level-done` }, this.getLevelIcon(levels.length), index.h("div", { class: "complete" }, "Signing Complete"))), index.h("div", { class: "buttons" }, index.h("verdocs-button", { label: "Cancel", size: "small", variant: "outline", onClick: e => this.handleCancel(e), disabled: this.sending }), index.h("verdocs-button", { label: "Send", size: "small", disabled: !allRolesAssigned || this.sending, onClick: e => this.handleSend(e) }), this.sending && index.h("verdocs-spinner", null))));
314
+ return unknown ? (index$1.h("div", { class: "recipient", "data-ri": roleIndex, "data-rn": role.role_name, style: { backgroundColor: rgba }, onClick: e => this.handleClickRole(e, role), id: elId }, ((_a = this.rolesCompleted[role.id]) === null || _a === void 0 ? void 0 : _a.first_name) ? jsSdk.formatFullName(this.rolesCompleted[role.id]) : role.role_name, index$1.h("div", { class: "icon", innerHTML: editIcon }), this.showPickerForId === role.id && (index$1.h("verdocs-portal", { anchor: elId, onClickAway: () => (this.showPickerForId = '') }, index$1.h("verdocs-contact-picker", { onExit: () => (this.showPickerForId = ''), onNext: e => this.handleSelectContact(e, role), contactSuggestions: this.sessionContacts, templateRole: (_b = this.rolesCompleted[role.id]) !== null && _b !== void 0 ? _b : role, onSearchContacts: e => { var _a; return (_a = this.searchContacts) === null || _a === void 0 ? void 0 : _a.emit(e.detail); } }))))) : (index$1.h("div", { class: "recipient", style: { borderColor: rgba }, onClick: e => this.handleClickRole(e, role), id: elId }, ((_c = this.rolesCompleted[role.id]) === null || _c === void 0 ? void 0 : _c.first_name) ? jsSdk.formatFullName(this.rolesCompleted[role.id]) : role.role_name, index$1.h("div", { class: "icon", innerHTML: editIcon }), this.showPickerForId === role.id && (index$1.h("verdocs-portal", { anchor: elId, onClickAway: () => (this.showPickerForId = '') }, index$1.h("verdocs-contact-picker", { onExit: () => (this.showPickerForId = ''), onNext: e => this.handleSelectContact(e, role), contactSuggestions: this.sessionContacts, templateRole: ((_d = this.rolesCompleted[role.id]) !== null && _d !== void 0 ? _d : role), onSearchContacts: e => { var _a; return (_a = this.searchContacts) === null || _a === void 0 ? void 0 : _a.emit(e.detail); } })))));
315
+ })))), index$1.h("div", { class: `level level-done` }, this.getLevelIcon(levels.length), index$1.h("div", { class: "complete" }, "Signing Complete"))), index$1.h("div", { class: "buttons" }, index$1.h("verdocs-button", { label: "Cancel", size: "small", variant: "outline", onClick: e => this.handleCancel(e), disabled: this.sending }), index$1.h("verdocs-button", { label: "Send", size: "small", disabled: !allRolesAssigned || this.sending, onClick: e => this.handleSend(e) }), this.sending && index$1.h("verdocs-spinner", null))));
316
316
  }
317
317
  static get watchers() { return {
318
318
  "templateId": ["onTemplateIdChanged"]
@@ -325,11 +325,11 @@ const VerdocsTemplateAttachmentsStyle0 = verdocsTemplateAttachmentsCss;
325
325
 
326
326
  const VerdocsTemplateAttachments = class {
327
327
  constructor(hostRef) {
328
- index.registerInstance(this, hostRef);
329
- this.exit = index.createEvent(this, "exit", 7);
330
- this.next = index.createEvent(this, "next", 7);
331
- this.templateUpdated = index.createEvent(this, "templateUpdated", 7);
332
- this.sdkError = index.createEvent(this, "sdkError", 7);
328
+ index$1.registerInstance(this, hostRef);
329
+ this.exit = index$1.createEvent(this, "exit", 7);
330
+ this.next = index$1.createEvent(this, "next", 7);
331
+ this.templateUpdated = index$1.createEvent(this, "templateUpdated", 7);
332
+ this.sdkError = index$1.createEvent(this, "sdkError", 7);
333
333
  this.templateListenerId = null;
334
334
  this.endpoint = jsSdk.VerdocsEndpoint.getDefault();
335
335
  this.templateId = '';
@@ -457,16 +457,16 @@ const VerdocsTemplateAttachments = class {
457
457
  render() {
458
458
  var _a, _b;
459
459
  if (!this.endpoint.session) {
460
- return (index.h(index.Host, null, index.h("verdocs-component-error", { message: "You must be authenticated to use this module." })));
460
+ return (index$1.h(index$1.Host, null, index$1.h("verdocs-component-error", { message: "You must be authenticated to use this module." })));
461
461
  }
462
462
  if (this.loading) {
463
- return (index.h(index.Host, { class: "loading" }, index.h("verdocs-loader", null)));
463
+ return (index$1.h(index$1.Host, { class: "loading" }, index$1.h("verdocs-loader", null)));
464
464
  }
465
465
  // This is meant to be a companion for larger visual experiences so we just go blank on errors for now.
466
466
  if (!this.endpoint.session || !this.template) {
467
- return index.h(index.Host, { class: "empty" });
467
+ return index$1.h(index$1.Host, { class: "empty" });
468
468
  }
469
- return (index.h(index.Host, null, index.h("h5", null, "Existing Attachments"), index.h("div", { class: "attachments" }, (((_a = this.template) === null || _a === void 0 ? void 0 : _a.documents) || []).map(document => (index.h("div", { class: "attachment" }, index.h("div", { class: "file-icon", innerHTML: this.getFileIcon(document) }), index.h("div", { class: "filename", title: document.name }, document.name), index.h("div", { class: "pages" }, index.h("div", { class: "count" }, document.pages), index.h("div", { class: "pages-icon", innerHTML: Icons.PageCountIcon })), index.h("div", { class: "trash-icon", innerHTML: Icons.TrashIcon, onClick: () => this.handleDelete(document) }))))), index.h("h5", null, "Attach a New Document"), this.uploading ? (index.h("div", { class: "loader-wrapper" }, index.h("verdocs-loader", null), this.progressLabel && (index.h("div", { class: "progress-wrapper" }, index.h("verdocs-progress-bar", { showPercent: true, percent: this.progressPercent, label: this.progressLabel }))))) : (index.h("verdocs-file-chooser", { onFileSelected: e => this.handleUpload(e) })), index.h("div", { class: "buttons" }, index.h("verdocs-button", { variant: "outline", label: "Cancel", size: "small", onClick: e => this.handleCancel(e), disabled: this.uploading }), index.h("verdocs-button", { label: "Next", size: "small", onClick: e => this.handleNext(e), disabled: !(((_b = this.template) === null || _b === void 0 ? void 0 : _b.documents) || []).length || this.uploading })), this.showDeleteError && (index.h("verdocs-ok-dialog", { heading: "Unable to Delete Attachment", message: "Templates must contain at least one attachment.", onNext: () => (this.showDeleteError = false) })), this.confirmDeleteDocument && (index.h("verdocs-ok-dialog", { heading: "Delete this Attachment?", message: "This operation cannot be undone. All fields placed<br />on the deleted attachment will also be removed.", onNext: () => this.confirmDelete(), showCancel: true, onExit: () => {
469
+ return (index$1.h(index$1.Host, null, index$1.h("h5", null, "Existing Attachments"), index$1.h("div", { class: "attachments" }, (((_a = this.template) === null || _a === void 0 ? void 0 : _a.documents) || []).map(document => (index$1.h("div", { class: "attachment" }, index$1.h("div", { class: "file-icon", innerHTML: this.getFileIcon(document) }), index$1.h("div", { class: "filename", title: document.name }, document.name), index$1.h("div", { class: "pages" }, index$1.h("div", { class: "count" }, document.pages), index$1.h("div", { class: "pages-icon", innerHTML: Icons.PageCountIcon })), index$1.h("div", { class: "trash-icon", innerHTML: Icons.TrashIcon, onClick: () => this.handleDelete(document) }))))), index$1.h("h5", null, "Attach a New Document"), this.uploading ? (index$1.h("div", { class: "loader-wrapper" }, index$1.h("verdocs-loader", null), this.progressLabel && (index$1.h("div", { class: "progress-wrapper" }, index$1.h("verdocs-progress-bar", { showPercent: true, percent: this.progressPercent, label: this.progressLabel }))))) : (index$1.h("verdocs-file-chooser", { onFileSelected: e => this.handleUpload(e) })), index$1.h("div", { class: "buttons" }, index$1.h("verdocs-button", { variant: "outline", label: "Cancel", size: "small", onClick: e => this.handleCancel(e), disabled: this.uploading }), index$1.h("verdocs-button", { label: "Next", size: "small", onClick: e => this.handleNext(e), disabled: !(((_b = this.template) === null || _b === void 0 ? void 0 : _b.documents) || []).length || this.uploading })), this.showDeleteError && (index$1.h("verdocs-ok-dialog", { heading: "Unable to Delete Attachment", message: "Templates must contain at least one attachment.", onNext: () => (this.showDeleteError = false) })), this.confirmDeleteDocument && (index$1.h("verdocs-ok-dialog", { heading: "Delete this Attachment?", message: "This operation cannot be undone. All fields placed<br />on the deleted attachment will also be removed.", onNext: () => this.confirmDelete(), showCancel: true, onExit: () => {
470
470
  this.confirmDeleteDocument = null;
471
471
  } }))));
472
472
  }
@@ -481,9 +481,9 @@ const CopyIcon = `<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0
481
481
  const STEPS = ['attachments', 'roles', 'settings', 'fields', 'preview'];
482
482
  const VerdocsTemplateBuildTabs = class {
483
483
  constructor(hostRef) {
484
- index.registerInstance(this, hostRef);
485
- this.sdkError = index.createEvent(this, "sdkError", 7);
486
- this.stepChanged = index.createEvent(this, "stepChanged", 7);
484
+ index$1.registerInstance(this, hostRef);
485
+ this.sdkError = index$1.createEvent(this, "sdkError", 7);
486
+ this.stepChanged = index$1.createEvent(this, "stepChanged", 7);
487
487
  this.templateListenerId = null;
488
488
  this.endpoint = jsSdk.VerdocsEndpoint.getDefault();
489
489
  this.templateId = null;
@@ -557,10 +557,10 @@ const VerdocsTemplateBuildTabs = class {
557
557
  render() {
558
558
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
559
559
  if (this.loading) {
560
- return (index.h(index.Host, null, index.h("verdocs-loader", null)));
560
+ return (index$1.h(index$1.Host, null, index$1.h("verdocs-loader", null)));
561
561
  }
562
562
  if (!this.endpoint.session) {
563
- return (index.h(index.Host, null, index.h("verdocs-component-error", { message: "You must be authenticated to use this module." })));
563
+ return (index$1.h(index$1.Host, null, index$1.h("verdocs-component-error", { message: "You must be authenticated to use this module." })));
564
564
  }
565
565
  const canEditRoles = (((_a = this.template) === null || _a === void 0 ? void 0 : _a.documents) || []).length > 0;
566
566
  let canEditFields = canEditRoles && (((_b = this.template) === null || _b === void 0 ? void 0 : _b.roles) || []).length > 0;
@@ -575,13 +575,13 @@ const VerdocsTemplateBuildTabs = class {
575
575
  if (!canEditRoles && selectedStepIndex >= 1) {
576
576
  selectedStepIndex = 0;
577
577
  }
578
- return (index.h(index.Host, null, index.h("verdocs-tabs", { onSelectTab: e => this.setStep(e), selectedTab: selectedStepIndex, tabs: [
578
+ return (index$1.h(index$1.Host, null, index$1.h("verdocs-tabs", { onSelectTab: e => this.setStep(e), selectedTab: selectedStepIndex, tabs: [
579
579
  { id: 'attachments', disabled: false, label: 'Attachment(s)' },
580
580
  { id: 'roles', disabled: !canEditRoles, label: 'Roles' },
581
581
  { id: 'settings', disabled: !canEditFields, label: 'Settings' },
582
582
  { id: 'fields', disabled: !canEditFields, label: 'Fields' },
583
583
  { id: 'preview', disabled: !canPreview, label: 'Preview/Send' },
584
- ] }), this.templateId && (index.h("div", { class: "info" }, index.h("verdocs-button-panel", { icon: HelpIcon }, index.h("div", { class: "template-details-panel" }, index.h("h6", null, "Template Details"), index.h("div", { class: "row" }, index.h("label", null, "ID:"), index.h("div", { class: "value" }, this.templateId), index.h("div", { class: "icon-button", innerHTML: CopyIcon, onClick: () => this.copyTemplateId() })), index.h("div", { class: "row" }, index.h("label", null, "Name:"), index.h("div", { class: "value" }, (_d = this.template) === null || _d === void 0 ? void 0 : _d.name)), index.h("div", { class: "row" }, index.h("label", null, "Visibility:"), index.h("div", { class: "value" }, ((_e = this.template) === null || _e === void 0 ? void 0 : _e.is_public) ? 'Public' : ((_f = this.template) === null || _f === void 0 ? void 0 : _f.is_personal) ? 'Private' : 'Shared')), index.h("div", { class: "row" }, index.h("label", null, "Created:"), index.h("div", { class: "value" }, ((_g = this.template) === null || _g === void 0 ? void 0 : _g.counter) ? format.format(new Date((_h = this.template) === null || _h === void 0 ? void 0 : _h.created_at), 'P p') : '')), index.h("div", { class: "row" }, index.h("label", null, "Used:"), index.h("div", { class: "value" }, (_j = this.template) === null || _j === void 0 ? void 0 :
584
+ ] }), this.templateId && (index$1.h("div", { class: "info" }, index$1.h("verdocs-button-panel", { icon: HelpIcon }, index$1.h("div", { class: "template-details-panel" }, index$1.h("h6", null, "Template Details"), index$1.h("div", { class: "row" }, index$1.h("label", null, "ID:"), index$1.h("div", { class: "value" }, this.templateId), index$1.h("div", { class: "icon-button", innerHTML: CopyIcon, onClick: () => this.copyTemplateId() })), index$1.h("div", { class: "row" }, index$1.h("label", null, "Name:"), index$1.h("div", { class: "value" }, (_d = this.template) === null || _d === void 0 ? void 0 : _d.name)), index$1.h("div", { class: "row" }, index$1.h("label", null, "Visibility:"), index$1.h("div", { class: "value" }, ((_e = this.template) === null || _e === void 0 ? void 0 : _e.is_public) ? 'Public' : ((_f = this.template) === null || _f === void 0 ? void 0 : _f.is_personal) ? 'Private' : 'Shared')), index$1.h("div", { class: "row" }, index$1.h("label", null, "Created:"), index$1.h("div", { class: "value" }, ((_g = this.template) === null || _g === void 0 ? void 0 : _g.counter) ? format.format(new Date((_h = this.template) === null || _h === void 0 ? void 0 : _h.created_at), 'P p') : '')), index$1.h("div", { class: "row" }, index$1.h("label", null, "Used:"), index$1.h("div", { class: "value" }, (_j = this.template) === null || _j === void 0 ? void 0 :
585
585
  _j.counter, " time(s)"))))))));
586
586
  }
587
587
  static get watchers() { return {
@@ -621,10 +621,10 @@ const menuOptions = [
621
621
  ];
622
622
  const VerdocsTemplateFields = class {
623
623
  constructor(hostRef) {
624
- index.registerInstance(this, hostRef);
625
- this.sdkError = index.createEvent(this, "sdkError", 7);
626
- this.templateUpdated = index.createEvent(this, "templateUpdated", 7);
627
- this.fieldsUpdated = index.createEvent(this, "fieldsUpdated", 7);
624
+ index$1.registerInstance(this, hostRef);
625
+ this.sdkError = index$1.createEvent(this, "sdkError", 7);
626
+ this.templateUpdated = index$1.createEvent(this, "templateUpdated", 7);
627
+ this.fieldsUpdated = index$1.createEvent(this, "fieldsUpdated", 7);
628
628
  this.templateListenerId = null;
629
629
  this.pageHeights = {};
630
630
  this.cachedPageInfo = {};
@@ -879,13 +879,13 @@ const VerdocsTemplateFields = class {
879
879
  render() {
880
880
  var _a, _b, _c;
881
881
  if (this.loading) {
882
- return (index.h(index.Host, null, index.h("verdocs-loader", null)));
882
+ return (index$1.h(index$1.Host, null, index$1.h("verdocs-loader", null)));
883
883
  }
884
884
  if (!this.endpoint.session) {
885
- return (index.h(index.Host, null, index.h("verdocs-component-error", { message: "You must be authenticated to use this module." })));
885
+ return (index$1.h(index$1.Host, null, index$1.h("verdocs-component-error", { message: "You must be authenticated to use this module." })));
886
886
  }
887
887
  const selectableRoles = (((_a = this.template) === null || _a === void 0 ? void 0 : _a.roles) || []).map(role => ({ value: role.name, label: role.full_name ? `${role.name}: ${role.full_name}` : role.name }));
888
- return (index.h(index.Host, { class: this.placing ? { [`placing-${this.placing}`]: true } : {}, onSubmit: () => { } }, index.h("div", { id: "verdocs-template-fields-toolbar" }, index.h("div", { class: "add-for" }, "Add field:"), index.h("verdocs-select-input", { value: this.selectedRoleName, options: selectableRoles, onInput: (e) => (this.selectedRoleName = e.target.value) }), menuOptions.map(option => (index.h("verdocs-toolbar-icon", { text: option.tooltip, icon: option.icon, class: option.class, onClick: () => {
888
+ return (index$1.h(index$1.Host, { class: this.placing ? { [`placing-${this.placing}`]: true } : {}, onSubmit: () => { } }, index$1.h("div", { id: "verdocs-template-fields-toolbar" }, index$1.h("div", { class: "add-for" }, "Add field:"), index$1.h("verdocs-select-input", { value: this.selectedRoleName, options: selectableRoles, onInput: (e) => (this.selectedRoleName = e.target.value) }), menuOptions.map(option => (index$1.h("verdocs-toolbar-icon", { text: option.tooltip, icon: option.icon, class: option.class, onClick: () => {
889
889
  // We ignore empty-tooltip entries because they're separators
890
890
  if (option.tooltip) {
891
891
  // We require a role to be selected first
@@ -896,16 +896,16 @@ const VerdocsTemplateFields = class {
896
896
  this.showMustSelectRole = true;
897
897
  }
898
898
  }
899
- } })))), index.h("div", { class: "pages" }, (((_b = this.template) === null || _b === void 0 ? void 0 : _b.documents) || []).map(document => {
899
+ } })))), index$1.h("div", { class: "pages" }, (((_b = this.template) === null || _b === void 0 ? void 0 : _b.documents) || []).map(document => {
900
900
  const pageNumbers = jsSdk.integerSequence(1, document.pages);
901
901
  return pageNumbers.map(page => {
902
902
  const pageSize = document.page_sizes[page];
903
- return (index.h("verdocs-template-document-page", { templateId: this.templateId, documentId: document.id, pageNumber: page, virtualWidth: (pageSize === null || pageSize === void 0 ? void 0 : pageSize.width) || 612, virtualHeight: (pageSize === null || pageSize === void 0 ? void 0 : pageSize.height) || 792, disabled: true, editable: true, done: false, onClick: (e) => this.handleClickPage(e, page), onPageRendered: e => this.handlePageRendered(e), layers: [
903
+ return (index$1.h("verdocs-template-document-page", { templateId: this.templateId, documentId: document.id, pageNumber: page, virtualWidth: (pageSize === null || pageSize === void 0 ? void 0 : pageSize.width) || 612, virtualHeight: (pageSize === null || pageSize === void 0 ? void 0 : pageSize.height) || 792, disabled: true, editable: true, done: false, onClick: (e) => this.handleClickPage(e, page), onPageRendered: e => this.handlePageRendered(e), layers: [
904
904
  { name: 'page', type: 'canvas' },
905
905
  { name: 'controls', type: 'div' },
906
906
  ] }));
907
907
  });
908
- })), this.showMustSelectRole && (index.h("verdocs-ok-dialog", { heading: "Unable to add field", message: (((_c = this.template) === null || _c === void 0 ? void 0 : _c.roles) || []).length > 0 ? 'Please select a role before adding fields.' : 'Please add at least one role before adding fields.', onNext: () => (this.showMustSelectRole = false) }))));
908
+ })), this.showMustSelectRole && (index$1.h("verdocs-ok-dialog", { heading: "Unable to add field", message: (((_c = this.template) === null || _c === void 0 ? void 0 : _c.roles) || []).length > 0 ? 'Please select a role before adding fields.' : 'Please add at least one role before adding fields.', onNext: () => (this.showMustSelectRole = false) }))));
909
909
  }
910
910
  static get watchers() { return {
911
911
  "templateId": ["onTemplateIdChanged"]
@@ -913,33 +913,2692 @@ const VerdocsTemplateFields = class {
913
913
  };
914
914
  VerdocsTemplateFields.style = VerdocsTemplateFieldsStyle0;
915
915
 
916
- const verdocsTemplateRolesCss = "@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-template-roles{display:block;min-width:400px;font-family:\"Inter\", -apple-system, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", sans-serif}verdocs-template-roles>form{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;background-color:#ffffff;padding:12px}verdocs-template-roles>form h5{font-size:16px;font-weight:bold;color:#46497d;margin:0 0 10px 0}verdocs-template-roles>form .participants{position:relative}verdocs-template-roles>form .left-line{top:32px;left:11px;z-index:1;width:12px;bottom:30px;position:absolute;background:#ffffff;border-left:3px dotted #9b9b9b}verdocs-template-roles>form .row{display:-ms-flexbox;display:flex;-webkit-column-gap:0;-moz-column-gap:0;column-gap:0;min-height:35px;margin-top:0;margin-left:40px;position:relative;-ms-flex-direction:row;flex-direction:row;padding:6px 0 4px 0}verdocs-template-roles>form .row .row-roles{-ms-flex:1;flex:1;gap:10px;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;-ms-flex-direction:row;flex-direction:row}verdocs-template-roles>form .row .icon{top:14px;z-index:2;left:-40px;width:24px;height:24px;position:absolute;background:#ffffff}verdocs-template-roles>form .row .sender{height:30px;display:-ms-flexbox;display:flex;font-size:14px;line-height:30px;-ms-flex-align:center;align-items:center;border-radius:30px;-ms-flex-direction:row;flex-direction:row;padding:0 15px 0 15px;border:1px solid #c6c9cc;background-color:#f5f5fa}verdocs-template-roles>form .row .complete{height:30px;display:-ms-flexbox;display:flex;font-size:14px;padding:0 15px;line-height:30px;-ms-flex-direction:row;flex-direction:row;border-radius:30px;background-color:#f5f5fa;border:1px solid #aeb4bf}verdocs-template-roles>form .row .label{font-weight:bold;margin-right:6px;color:#33364b}verdocs-template-roles>form .row .settings-button{display:-ms-flexbox;display:flex;cursor:pointer;margin:0 0 0 9px}verdocs-template-roles>form .row .recipient{height:30px;display:-ms-flexbox;display:flex;font-size:14px;border-radius:30px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;padding:0 5px 0 6px;white-space:nowrap;border:2px solid #aeb4bf}verdocs-template-roles>form .row .recipient .type-icon{width:24px;height:24px;-webkit-transform:scale(0.8);transform:scale(0.8);opacity:0.6;margin:0 12px 0 0}verdocs-template-roles>form .row .recipient.dragging{position:absolute}verdocs-template-roles>form .row .recipient.dragging+.dropzone{display:none !important}verdocs-template-roles>form .row .dropzone{width:14px;height:30px;display:none}verdocs-template-roles>form .row .dropzone svg{fill:#cccccc}verdocs-template-roles>form .row .dropzone.visible{margin:0 7px;display:-ms-flexbox;display:flex;-ms-flex:0 0 14px;flex:0 0 14px}verdocs-template-roles>form .row .dropzone.active{-ms-flex:0 0 120px;flex:0 0 120px;border-radius:30px;background:rgba(101, 77, 203, 0.4980392157);border:1px dashed #654dcb}verdocs-template-roles>form label{display:block;font-size:14px;font-weight:500;margin:0 0 4px 0;color:#5c6575}verdocs-template-roles>form input{border:none;font-size:18px;padding:3px 6px 3px 0;background:transparent;border-bottom:1px solid #33364b}verdocs-template-roles>form input:focus{outline:none}verdocs-template-roles .row.add-sequence{display:none}verdocs-template-roles .add-role{margin:0;padding:0;border:none;opacity:0.5;cursor:pointer;background:none}verdocs-template-roles .add-role:hover{opacity:1}verdocs-template-roles .add-role svg{width:32px;height:32px}verdocs-template-roles .add-step{margin:0;padding:0;border:none;opacity:0.5;cursor:pointer;background:none}verdocs-template-roles .add-step:hover{opacity:1}verdocs-template-roles .add-step svg{width:32px;height:32px}verdocs-template-roles.dragging .add-role{display:none}verdocs-template-roles.dragging form .row .recipient+.dropzone{display:-ms-flexbox;display:flex}verdocs-template-roles.dragging .row.add-sequence{display:-ms-flexbox;display:flex}verdocs-template-roles.dragging .row.add-sequence .dropzone{opacity:0.5;-ms-flex:0 0 120px;flex:0 0 120px;border-radius:30px;-ms-flex-align:center;align-items:center;background:rgba(101, 77, 203, 0.4980392157);-ms-flex-pack:center;justify-content:center;border:1px dashed #654dcb}verdocs-template-roles.dragging .row.add-sequence .dropzone.active{opacity:1}verdocs-template-roles .buttons{display:-ms-flexbox;display:flex;-webkit-column-gap:8px;-moz-column-gap:8px;column-gap:8px;margin-top:16px;-ms-flex-direction:row;flex-direction:row}verdocs-template-roles .empty{font-size:13px;margin-top:15px;margin-bottom:5px}verdocs-template-roles .empty svg{width:16px;height:16px;stroke:#666666;margin-bottom:2px;display:inline-block}verdocs-template-roles ::-webkit-input-placeholder{color:#aaaaaa}verdocs-template-roles ::-moz-placeholder{color:#aaaaaa}verdocs-template-roles :-ms-input-placeholder{color:#aaaaaa}verdocs-template-roles ::-ms-input-placeholder{color:#aaaaaa}verdocs-template-roles ::placeholder{color:#aaaaaa}";
916
+ /**!
917
+ * Sortable 1.15.6
918
+ * @author RubaXa <trash@rubaxa.org>
919
+ * @author owenm <owen23355@gmail.com>
920
+ * @license MIT
921
+ */
922
+ function ownKeys(object, enumerableOnly) {
923
+ var keys = Object.keys(object);
924
+ if (Object.getOwnPropertySymbols) {
925
+ var symbols = Object.getOwnPropertySymbols(object);
926
+ if (enumerableOnly) {
927
+ symbols = symbols.filter(function (sym) {
928
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
929
+ });
930
+ }
931
+ keys.push.apply(keys, symbols);
932
+ }
933
+ return keys;
934
+ }
935
+ function _objectSpread2(target) {
936
+ for (var i = 1; i < arguments.length; i++) {
937
+ var source = arguments[i] != null ? arguments[i] : {};
938
+ if (i % 2) {
939
+ ownKeys(Object(source), true).forEach(function (key) {
940
+ _defineProperty(target, key, source[key]);
941
+ });
942
+ } else if (Object.getOwnPropertyDescriptors) {
943
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
944
+ } else {
945
+ ownKeys(Object(source)).forEach(function (key) {
946
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
947
+ });
948
+ }
949
+ }
950
+ return target;
951
+ }
952
+ function _typeof(obj) {
953
+ "@babel/helpers - typeof";
954
+
955
+ if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
956
+ _typeof = function (obj) {
957
+ return typeof obj;
958
+ };
959
+ } else {
960
+ _typeof = function (obj) {
961
+ return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
962
+ };
963
+ }
964
+ return _typeof(obj);
965
+ }
966
+ function _defineProperty(obj, key, value) {
967
+ if (key in obj) {
968
+ Object.defineProperty(obj, key, {
969
+ value: value,
970
+ enumerable: true,
971
+ configurable: true,
972
+ writable: true
973
+ });
974
+ } else {
975
+ obj[key] = value;
976
+ }
977
+ return obj;
978
+ }
979
+ function _extends() {
980
+ _extends = Object.assign || function (target) {
981
+ for (var i = 1; i < arguments.length; i++) {
982
+ var source = arguments[i];
983
+ for (var key in source) {
984
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
985
+ target[key] = source[key];
986
+ }
987
+ }
988
+ }
989
+ return target;
990
+ };
991
+ return _extends.apply(this, arguments);
992
+ }
993
+ function _objectWithoutPropertiesLoose(source, excluded) {
994
+ if (source == null) return {};
995
+ var target = {};
996
+ var sourceKeys = Object.keys(source);
997
+ var key, i;
998
+ for (i = 0; i < sourceKeys.length; i++) {
999
+ key = sourceKeys[i];
1000
+ if (excluded.indexOf(key) >= 0) continue;
1001
+ target[key] = source[key];
1002
+ }
1003
+ return target;
1004
+ }
1005
+ function _objectWithoutProperties(source, excluded) {
1006
+ if (source == null) return {};
1007
+ var target = _objectWithoutPropertiesLoose(source, excluded);
1008
+ var key, i;
1009
+ if (Object.getOwnPropertySymbols) {
1010
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
1011
+ for (i = 0; i < sourceSymbolKeys.length; i++) {
1012
+ key = sourceSymbolKeys[i];
1013
+ if (excluded.indexOf(key) >= 0) continue;
1014
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
1015
+ target[key] = source[key];
1016
+ }
1017
+ }
1018
+ return target;
1019
+ }
1020
+
1021
+ var version = "1.15.6";
1022
+
1023
+ function userAgent(pattern) {
1024
+ if (typeof window !== 'undefined' && window.navigator) {
1025
+ return !! /*@__PURE__*/navigator.userAgent.match(pattern);
1026
+ }
1027
+ }
1028
+ var IE11OrLess = userAgent(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i);
1029
+ var Edge = userAgent(/Edge/i);
1030
+ var FireFox = userAgent(/firefox/i);
1031
+ var Safari = userAgent(/safari/i) && !userAgent(/chrome/i) && !userAgent(/android/i);
1032
+ var IOS = userAgent(/iP(ad|od|hone)/i);
1033
+ var ChromeForAndroid = userAgent(/chrome/i) && userAgent(/android/i);
1034
+
1035
+ var captureMode = {
1036
+ capture: false,
1037
+ passive: false
1038
+ };
1039
+ function on(el, event, fn) {
1040
+ el.addEventListener(event, fn, !IE11OrLess && captureMode);
1041
+ }
1042
+ function off(el, event, fn) {
1043
+ el.removeEventListener(event, fn, !IE11OrLess && captureMode);
1044
+ }
1045
+ function matches( /**HTMLElement*/el, /**String*/selector) {
1046
+ if (!selector) return;
1047
+ selector[0] === '>' && (selector = selector.substring(1));
1048
+ if (el) {
1049
+ try {
1050
+ if (el.matches) {
1051
+ return el.matches(selector);
1052
+ } else if (el.msMatchesSelector) {
1053
+ return el.msMatchesSelector(selector);
1054
+ } else if (el.webkitMatchesSelector) {
1055
+ return el.webkitMatchesSelector(selector);
1056
+ }
1057
+ } catch (_) {
1058
+ return false;
1059
+ }
1060
+ }
1061
+ return false;
1062
+ }
1063
+ function getParentOrHost(el) {
1064
+ return el.host && el !== document && el.host.nodeType ? el.host : el.parentNode;
1065
+ }
1066
+ function closest( /**HTMLElement*/el, /**String*/selector, /**HTMLElement*/ctx, includeCTX) {
1067
+ if (el) {
1068
+ ctx = ctx || document;
1069
+ do {
1070
+ if (selector != null && (selector[0] === '>' ? el.parentNode === ctx && matches(el, selector) : matches(el, selector)) || includeCTX && el === ctx) {
1071
+ return el;
1072
+ }
1073
+ if (el === ctx) break;
1074
+ /* jshint boss:true */
1075
+ } while (el = getParentOrHost(el));
1076
+ }
1077
+ return null;
1078
+ }
1079
+ var R_SPACE = /\s+/g;
1080
+ function toggleClass(el, name, state) {
1081
+ if (el && name) {
1082
+ if (el.classList) {
1083
+ el.classList[state ? 'add' : 'remove'](name);
1084
+ } else {
1085
+ var className = (' ' + el.className + ' ').replace(R_SPACE, ' ').replace(' ' + name + ' ', ' ');
1086
+ el.className = (className + (state ? ' ' + name : '')).replace(R_SPACE, ' ');
1087
+ }
1088
+ }
1089
+ }
1090
+ function css(el, prop, val) {
1091
+ var style = el && el.style;
1092
+ if (style) {
1093
+ if (val === void 0) {
1094
+ if (document.defaultView && document.defaultView.getComputedStyle) {
1095
+ val = document.defaultView.getComputedStyle(el, '');
1096
+ } else if (el.currentStyle) {
1097
+ val = el.currentStyle;
1098
+ }
1099
+ return prop === void 0 ? val : val[prop];
1100
+ } else {
1101
+ if (!(prop in style) && prop.indexOf('webkit') === -1) {
1102
+ prop = '-webkit-' + prop;
1103
+ }
1104
+ style[prop] = val + (typeof val === 'string' ? '' : 'px');
1105
+ }
1106
+ }
1107
+ }
1108
+ function matrix(el, selfOnly) {
1109
+ var appliedTransforms = '';
1110
+ if (typeof el === 'string') {
1111
+ appliedTransforms = el;
1112
+ } else {
1113
+ do {
1114
+ var transform = css(el, 'transform');
1115
+ if (transform && transform !== 'none') {
1116
+ appliedTransforms = transform + ' ' + appliedTransforms;
1117
+ }
1118
+ /* jshint boss:true */
1119
+ } while (!selfOnly && (el = el.parentNode));
1120
+ }
1121
+ var matrixFn = window.DOMMatrix || window.WebKitCSSMatrix || window.CSSMatrix || window.MSCSSMatrix;
1122
+ /*jshint -W056 */
1123
+ return matrixFn && new matrixFn(appliedTransforms);
1124
+ }
1125
+ function find(ctx, tagName, iterator) {
1126
+ if (ctx) {
1127
+ var list = ctx.getElementsByTagName(tagName),
1128
+ i = 0,
1129
+ n = list.length;
1130
+ if (iterator) {
1131
+ for (; i < n; i++) {
1132
+ iterator(list[i], i);
1133
+ }
1134
+ }
1135
+ return list;
1136
+ }
1137
+ return [];
1138
+ }
1139
+ function getWindowScrollingElement() {
1140
+ var scrollingElement = document.scrollingElement;
1141
+ if (scrollingElement) {
1142
+ return scrollingElement;
1143
+ } else {
1144
+ return document.documentElement;
1145
+ }
1146
+ }
1147
+
1148
+ /**
1149
+ * Returns the "bounding client rect" of given element
1150
+ * @param {HTMLElement} el The element whose boundingClientRect is wanted
1151
+ * @param {[Boolean]} relativeToContainingBlock Whether the rect should be relative to the containing block of (including) the container
1152
+ * @param {[Boolean]} relativeToNonStaticParent Whether the rect should be relative to the relative parent of (including) the contaienr
1153
+ * @param {[Boolean]} undoScale Whether the container's scale() should be undone
1154
+ * @param {[HTMLElement]} container The parent the element will be placed in
1155
+ * @return {Object} The boundingClientRect of el, with specified adjustments
1156
+ */
1157
+ function getRect(el, relativeToContainingBlock, relativeToNonStaticParent, undoScale, container) {
1158
+ if (!el.getBoundingClientRect && el !== window) return;
1159
+ var elRect, top, left, bottom, right, height, width;
1160
+ if (el !== window && el.parentNode && el !== getWindowScrollingElement()) {
1161
+ elRect = el.getBoundingClientRect();
1162
+ top = elRect.top;
1163
+ left = elRect.left;
1164
+ bottom = elRect.bottom;
1165
+ right = elRect.right;
1166
+ height = elRect.height;
1167
+ width = elRect.width;
1168
+ } else {
1169
+ top = 0;
1170
+ left = 0;
1171
+ bottom = window.innerHeight;
1172
+ right = window.innerWidth;
1173
+ height = window.innerHeight;
1174
+ width = window.innerWidth;
1175
+ }
1176
+ if ((relativeToContainingBlock || relativeToNonStaticParent) && el !== window) {
1177
+ // Adjust for translate()
1178
+ container = container || el.parentNode;
1179
+
1180
+ // solves #1123 (see: https://stackoverflow.com/a/37953806/6088312)
1181
+ // Not needed on <= IE11
1182
+ if (!IE11OrLess) {
1183
+ do {
1184
+ if (container && container.getBoundingClientRect && (css(container, 'transform') !== 'none' || relativeToNonStaticParent && css(container, 'position') !== 'static')) {
1185
+ var containerRect = container.getBoundingClientRect();
1186
+
1187
+ // Set relative to edges of padding box of container
1188
+ top -= containerRect.top + parseInt(css(container, 'border-top-width'));
1189
+ left -= containerRect.left + parseInt(css(container, 'border-left-width'));
1190
+ bottom = top + elRect.height;
1191
+ right = left + elRect.width;
1192
+ break;
1193
+ }
1194
+ /* jshint boss:true */
1195
+ } while (container = container.parentNode);
1196
+ }
1197
+ }
1198
+ if (undoScale && el !== window) {
1199
+ // Adjust for scale()
1200
+ var elMatrix = matrix(container || el),
1201
+ scaleX = elMatrix && elMatrix.a,
1202
+ scaleY = elMatrix && elMatrix.d;
1203
+ if (elMatrix) {
1204
+ top /= scaleY;
1205
+ left /= scaleX;
1206
+ width /= scaleX;
1207
+ height /= scaleY;
1208
+ bottom = top + height;
1209
+ right = left + width;
1210
+ }
1211
+ }
1212
+ return {
1213
+ top: top,
1214
+ left: left,
1215
+ bottom: bottom,
1216
+ right: right,
1217
+ width: width,
1218
+ height: height
1219
+ };
1220
+ }
1221
+
1222
+ /**
1223
+ * Checks if a side of an element is scrolled past a side of its parents
1224
+ * @param {HTMLElement} el The element who's side being scrolled out of view is in question
1225
+ * @param {String} elSide Side of the element in question ('top', 'left', 'right', 'bottom')
1226
+ * @param {String} parentSide Side of the parent in question ('top', 'left', 'right', 'bottom')
1227
+ * @return {HTMLElement} The parent scroll element that the el's side is scrolled past, or null if there is no such element
1228
+ */
1229
+ function isScrolledPast(el, elSide, parentSide) {
1230
+ var parent = getParentAutoScrollElement(el, true),
1231
+ elSideVal = getRect(el)[elSide];
1232
+
1233
+ /* jshint boss:true */
1234
+ while (parent) {
1235
+ var parentSideVal = getRect(parent)[parentSide],
1236
+ visible = void 0;
1237
+ if (parentSide === 'top' || parentSide === 'left') {
1238
+ visible = elSideVal >= parentSideVal;
1239
+ } else {
1240
+ visible = elSideVal <= parentSideVal;
1241
+ }
1242
+ if (!visible) return parent;
1243
+ if (parent === getWindowScrollingElement()) break;
1244
+ parent = getParentAutoScrollElement(parent, false);
1245
+ }
1246
+ return false;
1247
+ }
1248
+
1249
+ /**
1250
+ * Gets nth child of el, ignoring hidden children, sortable's elements (does not ignore clone if it's visible)
1251
+ * and non-draggable elements
1252
+ * @param {HTMLElement} el The parent element
1253
+ * @param {Number} childNum The index of the child
1254
+ * @param {Object} options Parent Sortable's options
1255
+ * @return {HTMLElement} The child at index childNum, or null if not found
1256
+ */
1257
+ function getChild(el, childNum, options, includeDragEl) {
1258
+ var currentChild = 0,
1259
+ i = 0,
1260
+ children = el.children;
1261
+ while (i < children.length) {
1262
+ if (children[i].style.display !== 'none' && children[i] !== Sortable.ghost && (includeDragEl || children[i] !== Sortable.dragged) && closest(children[i], options.draggable, el, false)) {
1263
+ if (currentChild === childNum) {
1264
+ return children[i];
1265
+ }
1266
+ currentChild++;
1267
+ }
1268
+ i++;
1269
+ }
1270
+ return null;
1271
+ }
1272
+
1273
+ /**
1274
+ * Gets the last child in the el, ignoring ghostEl or invisible elements (clones)
1275
+ * @param {HTMLElement} el Parent element
1276
+ * @param {selector} selector Any other elements that should be ignored
1277
+ * @return {HTMLElement} The last child, ignoring ghostEl
1278
+ */
1279
+ function lastChild(el, selector) {
1280
+ var last = el.lastElementChild;
1281
+ while (last && (last === Sortable.ghost || css(last, 'display') === 'none' || selector && !matches(last, selector))) {
1282
+ last = last.previousElementSibling;
1283
+ }
1284
+ return last || null;
1285
+ }
1286
+
1287
+ /**
1288
+ * Returns the index of an element within its parent for a selected set of
1289
+ * elements
1290
+ * @param {HTMLElement} el
1291
+ * @param {selector} selector
1292
+ * @return {number}
1293
+ */
1294
+ function index(el, selector) {
1295
+ var index = 0;
1296
+ if (!el || !el.parentNode) {
1297
+ return -1;
1298
+ }
1299
+
1300
+ /* jshint boss:true */
1301
+ while (el = el.previousElementSibling) {
1302
+ if (el.nodeName.toUpperCase() !== 'TEMPLATE' && el !== Sortable.clone && (!selector || matches(el, selector))) {
1303
+ index++;
1304
+ }
1305
+ }
1306
+ return index;
1307
+ }
1308
+
1309
+ /**
1310
+ * Returns the scroll offset of the given element, added with all the scroll offsets of parent elements.
1311
+ * The value is returned in real pixels.
1312
+ * @param {HTMLElement} el
1313
+ * @return {Array} Offsets in the format of [left, top]
1314
+ */
1315
+ function getRelativeScrollOffset(el) {
1316
+ var offsetLeft = 0,
1317
+ offsetTop = 0,
1318
+ winScroller = getWindowScrollingElement();
1319
+ if (el) {
1320
+ do {
1321
+ var elMatrix = matrix(el),
1322
+ scaleX = elMatrix.a,
1323
+ scaleY = elMatrix.d;
1324
+ offsetLeft += el.scrollLeft * scaleX;
1325
+ offsetTop += el.scrollTop * scaleY;
1326
+ } while (el !== winScroller && (el = el.parentNode));
1327
+ }
1328
+ return [offsetLeft, offsetTop];
1329
+ }
1330
+
1331
+ /**
1332
+ * Returns the index of the object within the given array
1333
+ * @param {Array} arr Array that may or may not hold the object
1334
+ * @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
1335
+ * @return {Number} The index of the object in the array, or -1
1336
+ */
1337
+ function indexOfObject(arr, obj) {
1338
+ for (var i in arr) {
1339
+ if (!arr.hasOwnProperty(i)) continue;
1340
+ for (var key in obj) {
1341
+ if (obj.hasOwnProperty(key) && obj[key] === arr[i][key]) return Number(i);
1342
+ }
1343
+ }
1344
+ return -1;
1345
+ }
1346
+ function getParentAutoScrollElement(el, includeSelf) {
1347
+ // skip to window
1348
+ if (!el || !el.getBoundingClientRect) return getWindowScrollingElement();
1349
+ var elem = el;
1350
+ var gotSelf = false;
1351
+ do {
1352
+ // we don't need to get elem css if it isn't even overflowing in the first place (performance)
1353
+ if (elem.clientWidth < elem.scrollWidth || elem.clientHeight < elem.scrollHeight) {
1354
+ var elemCSS = css(elem);
1355
+ if (elem.clientWidth < elem.scrollWidth && (elemCSS.overflowX == 'auto' || elemCSS.overflowX == 'scroll') || elem.clientHeight < elem.scrollHeight && (elemCSS.overflowY == 'auto' || elemCSS.overflowY == 'scroll')) {
1356
+ if (!elem.getBoundingClientRect || elem === document.body) return getWindowScrollingElement();
1357
+ if (gotSelf || includeSelf) return elem;
1358
+ gotSelf = true;
1359
+ }
1360
+ }
1361
+ /* jshint boss:true */
1362
+ } while (elem = elem.parentNode);
1363
+ return getWindowScrollingElement();
1364
+ }
1365
+ function extend(dst, src) {
1366
+ if (dst && src) {
1367
+ for (var key in src) {
1368
+ if (src.hasOwnProperty(key)) {
1369
+ dst[key] = src[key];
1370
+ }
1371
+ }
1372
+ }
1373
+ return dst;
1374
+ }
1375
+ function isRectEqual(rect1, rect2) {
1376
+ 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);
1377
+ }
1378
+ var _throttleTimeout;
1379
+ function throttle(callback, ms) {
1380
+ return function () {
1381
+ if (!_throttleTimeout) {
1382
+ var args = arguments,
1383
+ _this = this;
1384
+ if (args.length === 1) {
1385
+ callback.call(_this, args[0]);
1386
+ } else {
1387
+ callback.apply(_this, args);
1388
+ }
1389
+ _throttleTimeout = setTimeout(function () {
1390
+ _throttleTimeout = void 0;
1391
+ }, ms);
1392
+ }
1393
+ };
1394
+ }
1395
+ function cancelThrottle() {
1396
+ clearTimeout(_throttleTimeout);
1397
+ _throttleTimeout = void 0;
1398
+ }
1399
+ function scrollBy(el, x, y) {
1400
+ el.scrollLeft += x;
1401
+ el.scrollTop += y;
1402
+ }
1403
+ function clone(el) {
1404
+ var Polymer = window.Polymer;
1405
+ var $ = window.jQuery || window.Zepto;
1406
+ if (Polymer && Polymer.dom) {
1407
+ return Polymer.dom(el).cloneNode(true);
1408
+ } else if ($) {
1409
+ return $(el).clone(true)[0];
1410
+ } else {
1411
+ return el.cloneNode(true);
1412
+ }
1413
+ }
1414
+ function getChildContainingRectFromElement(container, options, ghostEl) {
1415
+ var rect = {};
1416
+ Array.from(container.children).forEach(function (child) {
1417
+ var _rect$left, _rect$top, _rect$right, _rect$bottom;
1418
+ if (!closest(child, options.draggable, container, false) || child.animated || child === ghostEl) return;
1419
+ var childRect = getRect(child);
1420
+ rect.left = Math.min((_rect$left = rect.left) !== null && _rect$left !== void 0 ? _rect$left : Infinity, childRect.left);
1421
+ rect.top = Math.min((_rect$top = rect.top) !== null && _rect$top !== void 0 ? _rect$top : Infinity, childRect.top);
1422
+ rect.right = Math.max((_rect$right = rect.right) !== null && _rect$right !== void 0 ? _rect$right : -Infinity, childRect.right);
1423
+ rect.bottom = Math.max((_rect$bottom = rect.bottom) !== null && _rect$bottom !== void 0 ? _rect$bottom : -Infinity, childRect.bottom);
1424
+ });
1425
+ rect.width = rect.right - rect.left;
1426
+ rect.height = rect.bottom - rect.top;
1427
+ rect.x = rect.left;
1428
+ rect.y = rect.top;
1429
+ return rect;
1430
+ }
1431
+ var expando = 'Sortable' + new Date().getTime();
1432
+
1433
+ function AnimationStateManager() {
1434
+ var animationStates = [],
1435
+ animationCallbackId;
1436
+ return {
1437
+ captureAnimationState: function captureAnimationState() {
1438
+ animationStates = [];
1439
+ if (!this.options.animation) return;
1440
+ var children = [].slice.call(this.el.children);
1441
+ children.forEach(function (child) {
1442
+ if (css(child, 'display') === 'none' || child === Sortable.ghost) return;
1443
+ animationStates.push({
1444
+ target: child,
1445
+ rect: getRect(child)
1446
+ });
1447
+ var fromRect = _objectSpread2({}, animationStates[animationStates.length - 1].rect);
1448
+
1449
+ // If animating: compensate for current animation
1450
+ if (child.thisAnimationDuration) {
1451
+ var childMatrix = matrix(child, true);
1452
+ if (childMatrix) {
1453
+ fromRect.top -= childMatrix.f;
1454
+ fromRect.left -= childMatrix.e;
1455
+ }
1456
+ }
1457
+ child.fromRect = fromRect;
1458
+ });
1459
+ },
1460
+ addAnimationState: function addAnimationState(state) {
1461
+ animationStates.push(state);
1462
+ },
1463
+ removeAnimationState: function removeAnimationState(target) {
1464
+ animationStates.splice(indexOfObject(animationStates, {
1465
+ target: target
1466
+ }), 1);
1467
+ },
1468
+ animateAll: function animateAll(callback) {
1469
+ var _this = this;
1470
+ if (!this.options.animation) {
1471
+ clearTimeout(animationCallbackId);
1472
+ if (typeof callback === 'function') callback();
1473
+ return;
1474
+ }
1475
+ var animating = false,
1476
+ animationTime = 0;
1477
+ animationStates.forEach(function (state) {
1478
+ var time = 0,
1479
+ target = state.target,
1480
+ fromRect = target.fromRect,
1481
+ toRect = getRect(target),
1482
+ prevFromRect = target.prevFromRect,
1483
+ prevToRect = target.prevToRect,
1484
+ animatingRect = state.rect,
1485
+ targetMatrix = matrix(target, true);
1486
+ if (targetMatrix) {
1487
+ // Compensate for current animation
1488
+ toRect.top -= targetMatrix.f;
1489
+ toRect.left -= targetMatrix.e;
1490
+ }
1491
+ target.toRect = toRect;
1492
+ if (target.thisAnimationDuration) {
1493
+ // Could also check if animatingRect is between fromRect and toRect
1494
+ if (isRectEqual(prevFromRect, toRect) && !isRectEqual(fromRect, toRect) &&
1495
+ // Make sure animatingRect is on line between toRect & fromRect
1496
+ (animatingRect.top - toRect.top) / (animatingRect.left - toRect.left) === (fromRect.top - toRect.top) / (fromRect.left - toRect.left)) {
1497
+ // If returning to same place as started from animation and on same axis
1498
+ time = calculateRealTime(animatingRect, prevFromRect, prevToRect, _this.options);
1499
+ }
1500
+ }
1501
+
1502
+ // if fromRect != toRect: animate
1503
+ if (!isRectEqual(toRect, fromRect)) {
1504
+ target.prevFromRect = fromRect;
1505
+ target.prevToRect = toRect;
1506
+ if (!time) {
1507
+ time = _this.options.animation;
1508
+ }
1509
+ _this.animate(target, animatingRect, toRect, time);
1510
+ }
1511
+ if (time) {
1512
+ animating = true;
1513
+ animationTime = Math.max(animationTime, time);
1514
+ clearTimeout(target.animationResetTimer);
1515
+ target.animationResetTimer = setTimeout(function () {
1516
+ target.animationTime = 0;
1517
+ target.prevFromRect = null;
1518
+ target.fromRect = null;
1519
+ target.prevToRect = null;
1520
+ target.thisAnimationDuration = null;
1521
+ }, time);
1522
+ target.thisAnimationDuration = time;
1523
+ }
1524
+ });
1525
+ clearTimeout(animationCallbackId);
1526
+ if (!animating) {
1527
+ if (typeof callback === 'function') callback();
1528
+ } else {
1529
+ animationCallbackId = setTimeout(function () {
1530
+ if (typeof callback === 'function') callback();
1531
+ }, animationTime);
1532
+ }
1533
+ animationStates = [];
1534
+ },
1535
+ animate: function animate(target, currentRect, toRect, duration) {
1536
+ if (duration) {
1537
+ css(target, 'transition', '');
1538
+ css(target, 'transform', '');
1539
+ var elMatrix = matrix(this.el),
1540
+ scaleX = elMatrix && elMatrix.a,
1541
+ scaleY = elMatrix && elMatrix.d,
1542
+ translateX = (currentRect.left - toRect.left) / (scaleX || 1),
1543
+ translateY = (currentRect.top - toRect.top) / (scaleY || 1);
1544
+ target.animatingX = !!translateX;
1545
+ target.animatingY = !!translateY;
1546
+ css(target, 'transform', 'translate3d(' + translateX + 'px,' + translateY + 'px,0)');
1547
+ this.forRepaintDummy = repaint(target); // repaint
1548
+
1549
+ css(target, 'transition', 'transform ' + duration + 'ms' + (this.options.easing ? ' ' + this.options.easing : ''));
1550
+ css(target, 'transform', 'translate3d(0,0,0)');
1551
+ typeof target.animated === 'number' && clearTimeout(target.animated);
1552
+ target.animated = setTimeout(function () {
1553
+ css(target, 'transition', '');
1554
+ css(target, 'transform', '');
1555
+ target.animated = false;
1556
+ target.animatingX = false;
1557
+ target.animatingY = false;
1558
+ }, duration);
1559
+ }
1560
+ }
1561
+ };
1562
+ }
1563
+ function repaint(target) {
1564
+ return target.offsetWidth;
1565
+ }
1566
+ function calculateRealTime(animatingRect, fromRect, toRect, options) {
1567
+ 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;
1568
+ }
1569
+
1570
+ var plugins = [];
1571
+ var defaults = {
1572
+ initializeByDefault: true
1573
+ };
1574
+ var PluginManager = {
1575
+ mount: function mount(plugin) {
1576
+ // Set default static properties
1577
+ for (var option in defaults) {
1578
+ if (defaults.hasOwnProperty(option) && !(option in plugin)) {
1579
+ plugin[option] = defaults[option];
1580
+ }
1581
+ }
1582
+ plugins.forEach(function (p) {
1583
+ if (p.pluginName === plugin.pluginName) {
1584
+ throw "Sortable: Cannot mount plugin ".concat(plugin.pluginName, " more than once");
1585
+ }
1586
+ });
1587
+ plugins.push(plugin);
1588
+ },
1589
+ pluginEvent: function pluginEvent(eventName, sortable, evt) {
1590
+ var _this = this;
1591
+ this.eventCanceled = false;
1592
+ evt.cancel = function () {
1593
+ _this.eventCanceled = true;
1594
+ };
1595
+ var eventNameGlobal = eventName + 'Global';
1596
+ plugins.forEach(function (plugin) {
1597
+ if (!sortable[plugin.pluginName]) return;
1598
+ // Fire global events if it exists in this sortable
1599
+ if (sortable[plugin.pluginName][eventNameGlobal]) {
1600
+ sortable[plugin.pluginName][eventNameGlobal](_objectSpread2({
1601
+ sortable: sortable
1602
+ }, evt));
1603
+ }
1604
+
1605
+ // Only fire plugin event if plugin is enabled in this sortable,
1606
+ // and plugin has event defined
1607
+ if (sortable.options[plugin.pluginName] && sortable[plugin.pluginName][eventName]) {
1608
+ sortable[plugin.pluginName][eventName](_objectSpread2({
1609
+ sortable: sortable
1610
+ }, evt));
1611
+ }
1612
+ });
1613
+ },
1614
+ initializePlugins: function initializePlugins(sortable, el, defaults, options) {
1615
+ plugins.forEach(function (plugin) {
1616
+ var pluginName = plugin.pluginName;
1617
+ if (!sortable.options[pluginName] && !plugin.initializeByDefault) return;
1618
+ var initialized = new plugin(sortable, el, sortable.options);
1619
+ initialized.sortable = sortable;
1620
+ initialized.options = sortable.options;
1621
+ sortable[pluginName] = initialized;
1622
+
1623
+ // Add default options from plugin
1624
+ _extends(defaults, initialized.defaults);
1625
+ });
1626
+ for (var option in sortable.options) {
1627
+ if (!sortable.options.hasOwnProperty(option)) continue;
1628
+ var modified = this.modifyOption(sortable, option, sortable.options[option]);
1629
+ if (typeof modified !== 'undefined') {
1630
+ sortable.options[option] = modified;
1631
+ }
1632
+ }
1633
+ },
1634
+ getEventProperties: function getEventProperties(name, sortable) {
1635
+ var eventProperties = {};
1636
+ plugins.forEach(function (plugin) {
1637
+ if (typeof plugin.eventProperties !== 'function') return;
1638
+ _extends(eventProperties, plugin.eventProperties.call(sortable[plugin.pluginName], name));
1639
+ });
1640
+ return eventProperties;
1641
+ },
1642
+ modifyOption: function modifyOption(sortable, name, value) {
1643
+ var modifiedValue;
1644
+ plugins.forEach(function (plugin) {
1645
+ // Plugin must exist on the Sortable
1646
+ if (!sortable[plugin.pluginName]) return;
1647
+
1648
+ // If static option listener exists for this option, call in the context of the Sortable's instance of this plugin
1649
+ if (plugin.optionListeners && typeof plugin.optionListeners[name] === 'function') {
1650
+ modifiedValue = plugin.optionListeners[name].call(sortable[plugin.pluginName], value);
1651
+ }
1652
+ });
1653
+ return modifiedValue;
1654
+ }
1655
+ };
1656
+
1657
+ function dispatchEvent(_ref) {
1658
+ var sortable = _ref.sortable,
1659
+ rootEl = _ref.rootEl,
1660
+ name = _ref.name,
1661
+ targetEl = _ref.targetEl,
1662
+ cloneEl = _ref.cloneEl,
1663
+ toEl = _ref.toEl,
1664
+ fromEl = _ref.fromEl,
1665
+ oldIndex = _ref.oldIndex,
1666
+ newIndex = _ref.newIndex,
1667
+ oldDraggableIndex = _ref.oldDraggableIndex,
1668
+ newDraggableIndex = _ref.newDraggableIndex,
1669
+ originalEvent = _ref.originalEvent,
1670
+ putSortable = _ref.putSortable,
1671
+ extraEventProperties = _ref.extraEventProperties;
1672
+ sortable = sortable || rootEl && rootEl[expando];
1673
+ if (!sortable) return;
1674
+ var evt,
1675
+ options = sortable.options,
1676
+ onName = 'on' + name.charAt(0).toUpperCase() + name.substr(1);
1677
+ // Support for new CustomEvent feature
1678
+ if (window.CustomEvent && !IE11OrLess && !Edge) {
1679
+ evt = new CustomEvent(name, {
1680
+ bubbles: true,
1681
+ cancelable: true
1682
+ });
1683
+ } else {
1684
+ evt = document.createEvent('Event');
1685
+ evt.initEvent(name, true, true);
1686
+ }
1687
+ evt.to = toEl || rootEl;
1688
+ evt.from = fromEl || rootEl;
1689
+ evt.item = targetEl || rootEl;
1690
+ evt.clone = cloneEl;
1691
+ evt.oldIndex = oldIndex;
1692
+ evt.newIndex = newIndex;
1693
+ evt.oldDraggableIndex = oldDraggableIndex;
1694
+ evt.newDraggableIndex = newDraggableIndex;
1695
+ evt.originalEvent = originalEvent;
1696
+ evt.pullMode = putSortable ? putSortable.lastPutMode : undefined;
1697
+ var allEventProperties = _objectSpread2(_objectSpread2({}, extraEventProperties), PluginManager.getEventProperties(name, sortable));
1698
+ for (var option in allEventProperties) {
1699
+ evt[option] = allEventProperties[option];
1700
+ }
1701
+ if (rootEl) {
1702
+ rootEl.dispatchEvent(evt);
1703
+ }
1704
+ if (options[onName]) {
1705
+ options[onName].call(sortable, evt);
1706
+ }
1707
+ }
1708
+
1709
+ var _excluded = ["evt"];
1710
+ var pluginEvent = function pluginEvent(eventName, sortable) {
1711
+ var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
1712
+ originalEvent = _ref.evt,
1713
+ data = _objectWithoutProperties(_ref, _excluded);
1714
+ PluginManager.pluginEvent.bind(Sortable)(eventName, sortable, _objectSpread2({
1715
+ dragEl: dragEl,
1716
+ parentEl: parentEl,
1717
+ ghostEl: ghostEl,
1718
+ rootEl: rootEl,
1719
+ nextEl: nextEl,
1720
+ lastDownEl: lastDownEl,
1721
+ cloneEl: cloneEl,
1722
+ cloneHidden: cloneHidden,
1723
+ dragStarted: moved,
1724
+ putSortable: putSortable,
1725
+ activeSortable: Sortable.active,
1726
+ originalEvent: originalEvent,
1727
+ oldIndex: oldIndex,
1728
+ oldDraggableIndex: oldDraggableIndex,
1729
+ newIndex: newIndex,
1730
+ newDraggableIndex: newDraggableIndex,
1731
+ hideGhostForTarget: _hideGhostForTarget,
1732
+ unhideGhostForTarget: _unhideGhostForTarget,
1733
+ cloneNowHidden: function cloneNowHidden() {
1734
+ cloneHidden = true;
1735
+ },
1736
+ cloneNowShown: function cloneNowShown() {
1737
+ cloneHidden = false;
1738
+ },
1739
+ dispatchSortableEvent: function dispatchSortableEvent(name) {
1740
+ _dispatchEvent({
1741
+ sortable: sortable,
1742
+ name: name,
1743
+ originalEvent: originalEvent
1744
+ });
1745
+ }
1746
+ }, data));
1747
+ };
1748
+ function _dispatchEvent(info) {
1749
+ dispatchEvent(_objectSpread2({
1750
+ putSortable: putSortable,
1751
+ cloneEl: cloneEl,
1752
+ targetEl: dragEl,
1753
+ rootEl: rootEl,
1754
+ oldIndex: oldIndex,
1755
+ oldDraggableIndex: oldDraggableIndex,
1756
+ newIndex: newIndex,
1757
+ newDraggableIndex: newDraggableIndex
1758
+ }, info));
1759
+ }
1760
+ var dragEl,
1761
+ parentEl,
1762
+ ghostEl,
1763
+ rootEl,
1764
+ nextEl,
1765
+ lastDownEl,
1766
+ cloneEl,
1767
+ cloneHidden,
1768
+ oldIndex,
1769
+ newIndex,
1770
+ oldDraggableIndex,
1771
+ newDraggableIndex,
1772
+ activeGroup,
1773
+ putSortable,
1774
+ awaitingDragStarted = false,
1775
+ ignoreNextClick = false,
1776
+ sortables = [],
1777
+ tapEvt,
1778
+ touchEvt,
1779
+ lastDx,
1780
+ lastDy,
1781
+ tapDistanceLeft,
1782
+ tapDistanceTop,
1783
+ moved,
1784
+ lastTarget,
1785
+ lastDirection,
1786
+ pastFirstInvertThresh = false,
1787
+ isCircumstantialInvert = false,
1788
+ targetMoveDistance,
1789
+ // For positioning ghost absolutely
1790
+ ghostRelativeParent,
1791
+ ghostRelativeParentInitialScroll = [],
1792
+ // (left, top)
1793
+
1794
+ _silent = false,
1795
+ savedInputChecked = [];
1796
+
1797
+ /** @const */
1798
+ var documentExists = typeof document !== 'undefined',
1799
+ PositionGhostAbsolutely = IOS,
1800
+ CSSFloatProperty = Edge || IE11OrLess ? 'cssFloat' : 'float',
1801
+ // This will not pass for IE9, because IE9 DnD only works on anchors
1802
+ supportDraggable = documentExists && !ChromeForAndroid && !IOS && 'draggable' in document.createElement('div'),
1803
+ supportCssPointerEvents = function () {
1804
+ if (!documentExists) return;
1805
+ // false when <= IE11
1806
+ if (IE11OrLess) {
1807
+ return false;
1808
+ }
1809
+ var el = document.createElement('x');
1810
+ el.style.cssText = 'pointer-events:auto';
1811
+ return el.style.pointerEvents === 'auto';
1812
+ }(),
1813
+ _detectDirection = function _detectDirection(el, options) {
1814
+ var elCSS = css(el),
1815
+ elWidth = parseInt(elCSS.width) - parseInt(elCSS.paddingLeft) - parseInt(elCSS.paddingRight) - parseInt(elCSS.borderLeftWidth) - parseInt(elCSS.borderRightWidth),
1816
+ child1 = getChild(el, 0, options),
1817
+ child2 = getChild(el, 1, options),
1818
+ firstChildCSS = child1 && css(child1),
1819
+ secondChildCSS = child2 && css(child2),
1820
+ firstChildWidth = firstChildCSS && parseInt(firstChildCSS.marginLeft) + parseInt(firstChildCSS.marginRight) + getRect(child1).width,
1821
+ secondChildWidth = secondChildCSS && parseInt(secondChildCSS.marginLeft) + parseInt(secondChildCSS.marginRight) + getRect(child2).width;
1822
+ if (elCSS.display === 'flex') {
1823
+ return elCSS.flexDirection === 'column' || elCSS.flexDirection === 'column-reverse' ? 'vertical' : 'horizontal';
1824
+ }
1825
+ if (elCSS.display === 'grid') {
1826
+ return elCSS.gridTemplateColumns.split(' ').length <= 1 ? 'vertical' : 'horizontal';
1827
+ }
1828
+ if (child1 && firstChildCSS["float"] && firstChildCSS["float"] !== 'none') {
1829
+ var touchingSideChild2 = firstChildCSS["float"] === 'left' ? 'left' : 'right';
1830
+ return child2 && (secondChildCSS.clear === 'both' || secondChildCSS.clear === touchingSideChild2) ? 'vertical' : 'horizontal';
1831
+ }
1832
+ 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';
1833
+ },
1834
+ _dragElInRowColumn = function _dragElInRowColumn(dragRect, targetRect, vertical) {
1835
+ var dragElS1Opp = vertical ? dragRect.left : dragRect.top,
1836
+ dragElS2Opp = vertical ? dragRect.right : dragRect.bottom,
1837
+ dragElOppLength = vertical ? dragRect.width : dragRect.height,
1838
+ targetS1Opp = vertical ? targetRect.left : targetRect.top,
1839
+ targetS2Opp = vertical ? targetRect.right : targetRect.bottom,
1840
+ targetOppLength = vertical ? targetRect.width : targetRect.height;
1841
+ return dragElS1Opp === targetS1Opp || dragElS2Opp === targetS2Opp || dragElS1Opp + dragElOppLength / 2 === targetS1Opp + targetOppLength / 2;
1842
+ },
1843
+ /**
1844
+ * Detects first nearest empty sortable to X and Y position using emptyInsertThreshold.
1845
+ * @param {Number} x X position
1846
+ * @param {Number} y Y position
1847
+ * @return {HTMLElement} Element of the first found nearest Sortable
1848
+ */
1849
+ _detectNearestEmptySortable = function _detectNearestEmptySortable(x, y) {
1850
+ var ret;
1851
+ sortables.some(function (sortable) {
1852
+ var threshold = sortable[expando].options.emptyInsertThreshold;
1853
+ if (!threshold || lastChild(sortable)) return;
1854
+ var rect = getRect(sortable),
1855
+ insideHorizontally = x >= rect.left - threshold && x <= rect.right + threshold,
1856
+ insideVertically = y >= rect.top - threshold && y <= rect.bottom + threshold;
1857
+ if (insideHorizontally && insideVertically) {
1858
+ return ret = sortable;
1859
+ }
1860
+ });
1861
+ return ret;
1862
+ },
1863
+ _prepareGroup = function _prepareGroup(options) {
1864
+ function toFn(value, pull) {
1865
+ return function (to, from, dragEl, evt) {
1866
+ var sameGroup = to.options.group.name && from.options.group.name && to.options.group.name === from.options.group.name;
1867
+ if (value == null && (pull || sameGroup)) {
1868
+ // Default pull value
1869
+ // Default pull and put value if same group
1870
+ return true;
1871
+ } else if (value == null || value === false) {
1872
+ return false;
1873
+ } else if (pull && value === 'clone') {
1874
+ return value;
1875
+ } else if (typeof value === 'function') {
1876
+ return toFn(value(to, from, dragEl, evt), pull)(to, from, dragEl, evt);
1877
+ } else {
1878
+ var otherGroup = (pull ? to : from).options.group.name;
1879
+ return value === true || typeof value === 'string' && value === otherGroup || value.join && value.indexOf(otherGroup) > -1;
1880
+ }
1881
+ };
1882
+ }
1883
+ var group = {};
1884
+ var originalGroup = options.group;
1885
+ if (!originalGroup || _typeof(originalGroup) != 'object') {
1886
+ originalGroup = {
1887
+ name: originalGroup
1888
+ };
1889
+ }
1890
+ group.name = originalGroup.name;
1891
+ group.checkPull = toFn(originalGroup.pull, true);
1892
+ group.checkPut = toFn(originalGroup.put);
1893
+ group.revertClone = originalGroup.revertClone;
1894
+ options.group = group;
1895
+ },
1896
+ _hideGhostForTarget = function _hideGhostForTarget() {
1897
+ if (!supportCssPointerEvents && ghostEl) {
1898
+ css(ghostEl, 'display', 'none');
1899
+ }
1900
+ },
1901
+ _unhideGhostForTarget = function _unhideGhostForTarget() {
1902
+ if (!supportCssPointerEvents && ghostEl) {
1903
+ css(ghostEl, 'display', '');
1904
+ }
1905
+ };
1906
+
1907
+ // #1184 fix - Prevent click event on fallback if dragged but item not changed position
1908
+ if (documentExists && !ChromeForAndroid) {
1909
+ document.addEventListener('click', function (evt) {
1910
+ if (ignoreNextClick) {
1911
+ evt.preventDefault();
1912
+ evt.stopPropagation && evt.stopPropagation();
1913
+ evt.stopImmediatePropagation && evt.stopImmediatePropagation();
1914
+ ignoreNextClick = false;
1915
+ return false;
1916
+ }
1917
+ }, true);
1918
+ }
1919
+ var nearestEmptyInsertDetectEvent = function nearestEmptyInsertDetectEvent(evt) {
1920
+ if (dragEl) {
1921
+ evt = evt.touches ? evt.touches[0] : evt;
1922
+ var nearest = _detectNearestEmptySortable(evt.clientX, evt.clientY);
1923
+ if (nearest) {
1924
+ // Create imitation event
1925
+ var event = {};
1926
+ for (var i in evt) {
1927
+ if (evt.hasOwnProperty(i)) {
1928
+ event[i] = evt[i];
1929
+ }
1930
+ }
1931
+ event.target = event.rootEl = nearest;
1932
+ event.preventDefault = void 0;
1933
+ event.stopPropagation = void 0;
1934
+ nearest[expando]._onDragOver(event);
1935
+ }
1936
+ }
1937
+ };
1938
+ var _checkOutsideTargetEl = function _checkOutsideTargetEl(evt) {
1939
+ if (dragEl) {
1940
+ dragEl.parentNode[expando]._isOutsideThisEl(evt.target);
1941
+ }
1942
+ };
1943
+
1944
+ /**
1945
+ * @class Sortable
1946
+ * @param {HTMLElement} el
1947
+ * @param {Object} [options]
1948
+ */
1949
+ function Sortable(el, options) {
1950
+ if (!(el && el.nodeType && el.nodeType === 1)) {
1951
+ throw "Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(el));
1952
+ }
1953
+ this.el = el; // root element
1954
+ this.options = options = _extends({}, options);
1955
+
1956
+ // Export instance
1957
+ el[expando] = this;
1958
+ var defaults = {
1959
+ group: null,
1960
+ sort: true,
1961
+ disabled: false,
1962
+ store: null,
1963
+ handle: null,
1964
+ draggable: /^[uo]l$/i.test(el.nodeName) ? '>li' : '>*',
1965
+ swapThreshold: 1,
1966
+ // percentage; 0 <= x <= 1
1967
+ invertSwap: false,
1968
+ // invert always
1969
+ invertedSwapThreshold: null,
1970
+ // will be set to same as swapThreshold if default
1971
+ removeCloneOnHide: true,
1972
+ direction: function direction() {
1973
+ return _detectDirection(el, this.options);
1974
+ },
1975
+ ghostClass: 'sortable-ghost',
1976
+ chosenClass: 'sortable-chosen',
1977
+ dragClass: 'sortable-drag',
1978
+ ignore: 'a, img',
1979
+ filter: null,
1980
+ preventOnFilter: true,
1981
+ animation: 0,
1982
+ easing: null,
1983
+ setData: function setData(dataTransfer, dragEl) {
1984
+ dataTransfer.setData('Text', dragEl.textContent);
1985
+ },
1986
+ dropBubble: false,
1987
+ dragoverBubble: false,
1988
+ dataIdAttr: 'data-id',
1989
+ delay: 0,
1990
+ delayOnTouchOnly: false,
1991
+ touchStartThreshold: (Number.parseInt ? Number : window).parseInt(window.devicePixelRatio, 10) || 1,
1992
+ forceFallback: false,
1993
+ fallbackClass: 'sortable-fallback',
1994
+ fallbackOnBody: false,
1995
+ fallbackTolerance: 0,
1996
+ fallbackOffset: {
1997
+ x: 0,
1998
+ y: 0
1999
+ },
2000
+ // Disabled on Safari: #1571; Enabled on Safari IOS: #2244
2001
+ supportPointer: Sortable.supportPointer !== false && 'PointerEvent' in window && (!Safari || IOS),
2002
+ emptyInsertThreshold: 5
2003
+ };
2004
+ PluginManager.initializePlugins(this, el, defaults);
2005
+
2006
+ // Set default options
2007
+ for (var name in defaults) {
2008
+ !(name in options) && (options[name] = defaults[name]);
2009
+ }
2010
+ _prepareGroup(options);
2011
+
2012
+ // Bind all private methods
2013
+ for (var fn in this) {
2014
+ if (fn.charAt(0) === '_' && typeof this[fn] === 'function') {
2015
+ this[fn] = this[fn].bind(this);
2016
+ }
2017
+ }
2018
+
2019
+ // Setup drag mode
2020
+ this.nativeDraggable = options.forceFallback ? false : supportDraggable;
2021
+ if (this.nativeDraggable) {
2022
+ // Touch start threshold cannot be greater than the native dragstart threshold
2023
+ this.options.touchStartThreshold = 1;
2024
+ }
2025
+
2026
+ // Bind events
2027
+ if (options.supportPointer) {
2028
+ on(el, 'pointerdown', this._onTapStart);
2029
+ } else {
2030
+ on(el, 'mousedown', this._onTapStart);
2031
+ on(el, 'touchstart', this._onTapStart);
2032
+ }
2033
+ if (this.nativeDraggable) {
2034
+ on(el, 'dragover', this);
2035
+ on(el, 'dragenter', this);
2036
+ }
2037
+ sortables.push(this.el);
2038
+
2039
+ // Restore sorting
2040
+ options.store && options.store.get && this.sort(options.store.get(this) || []);
2041
+
2042
+ // Add animation state manager
2043
+ _extends(this, AnimationStateManager());
2044
+ }
2045
+ Sortable.prototype = /** @lends Sortable.prototype */{
2046
+ constructor: Sortable,
2047
+ _isOutsideThisEl: function _isOutsideThisEl(target) {
2048
+ if (!this.el.contains(target) && target !== this.el) {
2049
+ lastTarget = null;
2050
+ }
2051
+ },
2052
+ _getDirection: function _getDirection(evt, target) {
2053
+ return typeof this.options.direction === 'function' ? this.options.direction.call(this, evt, target, dragEl) : this.options.direction;
2054
+ },
2055
+ _onTapStart: function _onTapStart( /** Event|TouchEvent */evt) {
2056
+ if (!evt.cancelable) return;
2057
+ var _this = this,
2058
+ el = this.el,
2059
+ options = this.options,
2060
+ preventOnFilter = options.preventOnFilter,
2061
+ type = evt.type,
2062
+ touch = evt.touches && evt.touches[0] || evt.pointerType && evt.pointerType === 'touch' && evt,
2063
+ target = (touch || evt).target,
2064
+ originalTarget = evt.target.shadowRoot && (evt.path && evt.path[0] || evt.composedPath && evt.composedPath()[0]) || target,
2065
+ filter = options.filter;
2066
+ _saveInputCheckedState(el);
2067
+
2068
+ // Don't trigger start event when an element is been dragged, otherwise the evt.oldindex always wrong when set option.group.
2069
+ if (dragEl) {
2070
+ return;
2071
+ }
2072
+ if (/mousedown|pointerdown/.test(type) && evt.button !== 0 || options.disabled) {
2073
+ return; // only left button and enabled
2074
+ }
2075
+
2076
+ // cancel dnd if original target is content editable
2077
+ if (originalTarget.isContentEditable) {
2078
+ return;
2079
+ }
2080
+
2081
+ // Safari ignores further event handling after mousedown
2082
+ if (!this.nativeDraggable && Safari && target && target.tagName.toUpperCase() === 'SELECT') {
2083
+ return;
2084
+ }
2085
+ target = closest(target, options.draggable, el, false);
2086
+ if (target && target.animated) {
2087
+ return;
2088
+ }
2089
+ if (lastDownEl === target) {
2090
+ // Ignoring duplicate `down`
2091
+ return;
2092
+ }
2093
+
2094
+ // Get the index of the dragged element within its parent
2095
+ oldIndex = index(target);
2096
+ oldDraggableIndex = index(target, options.draggable);
2097
+
2098
+ // Check filter
2099
+ if (typeof filter === 'function') {
2100
+ if (filter.call(this, evt, target, this)) {
2101
+ _dispatchEvent({
2102
+ sortable: _this,
2103
+ rootEl: originalTarget,
2104
+ name: 'filter',
2105
+ targetEl: target,
2106
+ toEl: el,
2107
+ fromEl: el
2108
+ });
2109
+ pluginEvent('filter', _this, {
2110
+ evt: evt
2111
+ });
2112
+ preventOnFilter && evt.preventDefault();
2113
+ return; // cancel dnd
2114
+ }
2115
+ } else if (filter) {
2116
+ filter = filter.split(',').some(function (criteria) {
2117
+ criteria = closest(originalTarget, criteria.trim(), el, false);
2118
+ if (criteria) {
2119
+ _dispatchEvent({
2120
+ sortable: _this,
2121
+ rootEl: criteria,
2122
+ name: 'filter',
2123
+ targetEl: target,
2124
+ fromEl: el,
2125
+ toEl: el
2126
+ });
2127
+ pluginEvent('filter', _this, {
2128
+ evt: evt
2129
+ });
2130
+ return true;
2131
+ }
2132
+ });
2133
+ if (filter) {
2134
+ preventOnFilter && evt.preventDefault();
2135
+ return; // cancel dnd
2136
+ }
2137
+ }
2138
+ if (options.handle && !closest(originalTarget, options.handle, el, false)) {
2139
+ return;
2140
+ }
2141
+
2142
+ // Prepare `dragstart`
2143
+ this._prepareDragStart(evt, touch, target);
2144
+ },
2145
+ _prepareDragStart: function _prepareDragStart( /** Event */evt, /** Touch */touch, /** HTMLElement */target) {
2146
+ var _this = this,
2147
+ el = _this.el,
2148
+ options = _this.options,
2149
+ ownerDocument = el.ownerDocument,
2150
+ dragStartFn;
2151
+ if (target && !dragEl && target.parentNode === el) {
2152
+ var dragRect = getRect(target);
2153
+ rootEl = el;
2154
+ dragEl = target;
2155
+ parentEl = dragEl.parentNode;
2156
+ nextEl = dragEl.nextSibling;
2157
+ lastDownEl = target;
2158
+ activeGroup = options.group;
2159
+ Sortable.dragged = dragEl;
2160
+ tapEvt = {
2161
+ target: dragEl,
2162
+ clientX: (touch || evt).clientX,
2163
+ clientY: (touch || evt).clientY
2164
+ };
2165
+ tapDistanceLeft = tapEvt.clientX - dragRect.left;
2166
+ tapDistanceTop = tapEvt.clientY - dragRect.top;
2167
+ this._lastX = (touch || evt).clientX;
2168
+ this._lastY = (touch || evt).clientY;
2169
+ dragEl.style['will-change'] = 'all';
2170
+ dragStartFn = function dragStartFn() {
2171
+ pluginEvent('delayEnded', _this, {
2172
+ evt: evt
2173
+ });
2174
+ if (Sortable.eventCanceled) {
2175
+ _this._onDrop();
2176
+ return;
2177
+ }
2178
+ // Delayed drag has been triggered
2179
+ // we can re-enable the events: touchmove/mousemove
2180
+ _this._disableDelayedDragEvents();
2181
+ if (!FireFox && _this.nativeDraggable) {
2182
+ dragEl.draggable = true;
2183
+ }
2184
+
2185
+ // Bind the events: dragstart/dragend
2186
+ _this._triggerDragStart(evt, touch);
2187
+
2188
+ // Drag start event
2189
+ _dispatchEvent({
2190
+ sortable: _this,
2191
+ name: 'choose',
2192
+ originalEvent: evt
2193
+ });
2194
+
2195
+ // Chosen item
2196
+ toggleClass(dragEl, options.chosenClass, true);
2197
+ };
2198
+
2199
+ // Disable "draggable"
2200
+ options.ignore.split(',').forEach(function (criteria) {
2201
+ find(dragEl, criteria.trim(), _disableDraggable);
2202
+ });
2203
+ on(ownerDocument, 'dragover', nearestEmptyInsertDetectEvent);
2204
+ on(ownerDocument, 'mousemove', nearestEmptyInsertDetectEvent);
2205
+ on(ownerDocument, 'touchmove', nearestEmptyInsertDetectEvent);
2206
+ if (options.supportPointer) {
2207
+ on(ownerDocument, 'pointerup', _this._onDrop);
2208
+ // Native D&D triggers pointercancel
2209
+ !this.nativeDraggable && on(ownerDocument, 'pointercancel', _this._onDrop);
2210
+ } else {
2211
+ on(ownerDocument, 'mouseup', _this._onDrop);
2212
+ on(ownerDocument, 'touchend', _this._onDrop);
2213
+ on(ownerDocument, 'touchcancel', _this._onDrop);
2214
+ }
2215
+
2216
+ // Make dragEl draggable (must be before delay for FireFox)
2217
+ if (FireFox && this.nativeDraggable) {
2218
+ this.options.touchStartThreshold = 4;
2219
+ dragEl.draggable = true;
2220
+ }
2221
+ pluginEvent('delayStart', this, {
2222
+ evt: evt
2223
+ });
2224
+
2225
+ // Delay is impossible for native DnD in Edge or IE
2226
+ if (options.delay && (!options.delayOnTouchOnly || touch) && (!this.nativeDraggable || !(Edge || IE11OrLess))) {
2227
+ if (Sortable.eventCanceled) {
2228
+ this._onDrop();
2229
+ return;
2230
+ }
2231
+ // If the user moves the pointer or let go the click or touch
2232
+ // before the delay has been reached:
2233
+ // disable the delayed drag
2234
+ if (options.supportPointer) {
2235
+ on(ownerDocument, 'pointerup', _this._disableDelayedDrag);
2236
+ on(ownerDocument, 'pointercancel', _this._disableDelayedDrag);
2237
+ } else {
2238
+ on(ownerDocument, 'mouseup', _this._disableDelayedDrag);
2239
+ on(ownerDocument, 'touchend', _this._disableDelayedDrag);
2240
+ on(ownerDocument, 'touchcancel', _this._disableDelayedDrag);
2241
+ }
2242
+ on(ownerDocument, 'mousemove', _this._delayedDragTouchMoveHandler);
2243
+ on(ownerDocument, 'touchmove', _this._delayedDragTouchMoveHandler);
2244
+ options.supportPointer && on(ownerDocument, 'pointermove', _this._delayedDragTouchMoveHandler);
2245
+ _this._dragStartTimer = setTimeout(dragStartFn, options.delay);
2246
+ } else {
2247
+ dragStartFn();
2248
+ }
2249
+ }
2250
+ },
2251
+ _delayedDragTouchMoveHandler: function _delayedDragTouchMoveHandler( /** TouchEvent|PointerEvent **/e) {
2252
+ var touch = e.touches ? e.touches[0] : e;
2253
+ 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))) {
2254
+ this._disableDelayedDrag();
2255
+ }
2256
+ },
2257
+ _disableDelayedDrag: function _disableDelayedDrag() {
2258
+ dragEl && _disableDraggable(dragEl);
2259
+ clearTimeout(this._dragStartTimer);
2260
+ this._disableDelayedDragEvents();
2261
+ },
2262
+ _disableDelayedDragEvents: function _disableDelayedDragEvents() {
2263
+ var ownerDocument = this.el.ownerDocument;
2264
+ off(ownerDocument, 'mouseup', this._disableDelayedDrag);
2265
+ off(ownerDocument, 'touchend', this._disableDelayedDrag);
2266
+ off(ownerDocument, 'touchcancel', this._disableDelayedDrag);
2267
+ off(ownerDocument, 'pointerup', this._disableDelayedDrag);
2268
+ off(ownerDocument, 'pointercancel', this._disableDelayedDrag);
2269
+ off(ownerDocument, 'mousemove', this._delayedDragTouchMoveHandler);
2270
+ off(ownerDocument, 'touchmove', this._delayedDragTouchMoveHandler);
2271
+ off(ownerDocument, 'pointermove', this._delayedDragTouchMoveHandler);
2272
+ },
2273
+ _triggerDragStart: function _triggerDragStart( /** Event */evt, /** Touch */touch) {
2274
+ touch = touch || evt.pointerType == 'touch' && evt;
2275
+ if (!this.nativeDraggable || touch) {
2276
+ if (this.options.supportPointer) {
2277
+ on(document, 'pointermove', this._onTouchMove);
2278
+ } else if (touch) {
2279
+ on(document, 'touchmove', this._onTouchMove);
2280
+ } else {
2281
+ on(document, 'mousemove', this._onTouchMove);
2282
+ }
2283
+ } else {
2284
+ on(dragEl, 'dragend', this);
2285
+ on(rootEl, 'dragstart', this._onDragStart);
2286
+ }
2287
+ try {
2288
+ if (document.selection) {
2289
+ _nextTick(function () {
2290
+ document.selection.empty();
2291
+ });
2292
+ } else {
2293
+ window.getSelection().removeAllRanges();
2294
+ }
2295
+ } catch (err) {}
2296
+ },
2297
+ _dragStarted: function _dragStarted(fallback, evt) {
2298
+ awaitingDragStarted = false;
2299
+ if (rootEl && dragEl) {
2300
+ pluginEvent('dragStarted', this, {
2301
+ evt: evt
2302
+ });
2303
+ if (this.nativeDraggable) {
2304
+ on(document, 'dragover', _checkOutsideTargetEl);
2305
+ }
2306
+ var options = this.options;
2307
+
2308
+ // Apply effect
2309
+ !fallback && toggleClass(dragEl, options.dragClass, false);
2310
+ toggleClass(dragEl, options.ghostClass, true);
2311
+ Sortable.active = this;
2312
+ fallback && this._appendGhost();
2313
+
2314
+ // Drag start event
2315
+ _dispatchEvent({
2316
+ sortable: this,
2317
+ name: 'start',
2318
+ originalEvent: evt
2319
+ });
2320
+ } else {
2321
+ this._nulling();
2322
+ }
2323
+ },
2324
+ _emulateDragOver: function _emulateDragOver() {
2325
+ if (touchEvt) {
2326
+ this._lastX = touchEvt.clientX;
2327
+ this._lastY = touchEvt.clientY;
2328
+ _hideGhostForTarget();
2329
+ var target = document.elementFromPoint(touchEvt.clientX, touchEvt.clientY);
2330
+ var parent = target;
2331
+ while (target && target.shadowRoot) {
2332
+ target = target.shadowRoot.elementFromPoint(touchEvt.clientX, touchEvt.clientY);
2333
+ if (target === parent) break;
2334
+ parent = target;
2335
+ }
2336
+ dragEl.parentNode[expando]._isOutsideThisEl(target);
2337
+ if (parent) {
2338
+ do {
2339
+ if (parent[expando]) {
2340
+ var inserted = void 0;
2341
+ inserted = parent[expando]._onDragOver({
2342
+ clientX: touchEvt.clientX,
2343
+ clientY: touchEvt.clientY,
2344
+ target: target,
2345
+ rootEl: parent
2346
+ });
2347
+ if (inserted && !this.options.dragoverBubble) {
2348
+ break;
2349
+ }
2350
+ }
2351
+ target = parent; // store last element
2352
+ }
2353
+ /* jshint boss:true */ while (parent = getParentOrHost(parent));
2354
+ }
2355
+ _unhideGhostForTarget();
2356
+ }
2357
+ },
2358
+ _onTouchMove: function _onTouchMove( /**TouchEvent*/evt) {
2359
+ if (tapEvt) {
2360
+ var options = this.options,
2361
+ fallbackTolerance = options.fallbackTolerance,
2362
+ fallbackOffset = options.fallbackOffset,
2363
+ touch = evt.touches ? evt.touches[0] : evt,
2364
+ ghostMatrix = ghostEl && matrix(ghostEl, true),
2365
+ scaleX = ghostEl && ghostMatrix && ghostMatrix.a,
2366
+ scaleY = ghostEl && ghostMatrix && ghostMatrix.d,
2367
+ relativeScrollOffset = PositionGhostAbsolutely && ghostRelativeParent && getRelativeScrollOffset(ghostRelativeParent),
2368
+ dx = (touch.clientX - tapEvt.clientX + fallbackOffset.x) / (scaleX || 1) + (relativeScrollOffset ? relativeScrollOffset[0] - ghostRelativeParentInitialScroll[0] : 0) / (scaleX || 1),
2369
+ dy = (touch.clientY - tapEvt.clientY + fallbackOffset.y) / (scaleY || 1) + (relativeScrollOffset ? relativeScrollOffset[1] - ghostRelativeParentInitialScroll[1] : 0) / (scaleY || 1);
2370
+
2371
+ // only set the status to dragging, when we are actually dragging
2372
+ if (!Sortable.active && !awaitingDragStarted) {
2373
+ if (fallbackTolerance && Math.max(Math.abs(touch.clientX - this._lastX), Math.abs(touch.clientY - this._lastY)) < fallbackTolerance) {
2374
+ return;
2375
+ }
2376
+ this._onDragStart(evt, true);
2377
+ }
2378
+ if (ghostEl) {
2379
+ if (ghostMatrix) {
2380
+ ghostMatrix.e += dx - (lastDx || 0);
2381
+ ghostMatrix.f += dy - (lastDy || 0);
2382
+ } else {
2383
+ ghostMatrix = {
2384
+ a: 1,
2385
+ b: 0,
2386
+ c: 0,
2387
+ d: 1,
2388
+ e: dx,
2389
+ f: dy
2390
+ };
2391
+ }
2392
+ var cssMatrix = "matrix(".concat(ghostMatrix.a, ",").concat(ghostMatrix.b, ",").concat(ghostMatrix.c, ",").concat(ghostMatrix.d, ",").concat(ghostMatrix.e, ",").concat(ghostMatrix.f, ")");
2393
+ css(ghostEl, 'webkitTransform', cssMatrix);
2394
+ css(ghostEl, 'mozTransform', cssMatrix);
2395
+ css(ghostEl, 'msTransform', cssMatrix);
2396
+ css(ghostEl, 'transform', cssMatrix);
2397
+ lastDx = dx;
2398
+ lastDy = dy;
2399
+ touchEvt = touch;
2400
+ }
2401
+ evt.cancelable && evt.preventDefault();
2402
+ }
2403
+ },
2404
+ _appendGhost: function _appendGhost() {
2405
+ // Bug if using scale(): https://stackoverflow.com/questions/2637058
2406
+ // Not being adjusted for
2407
+ if (!ghostEl) {
2408
+ var container = this.options.fallbackOnBody ? document.body : rootEl,
2409
+ rect = getRect(dragEl, true, PositionGhostAbsolutely, true, container),
2410
+ options = this.options;
2411
+
2412
+ // Position absolutely
2413
+ if (PositionGhostAbsolutely) {
2414
+ // Get relatively positioned parent
2415
+ ghostRelativeParent = container;
2416
+ while (css(ghostRelativeParent, 'position') === 'static' && css(ghostRelativeParent, 'transform') === 'none' && ghostRelativeParent !== document) {
2417
+ ghostRelativeParent = ghostRelativeParent.parentNode;
2418
+ }
2419
+ if (ghostRelativeParent !== document.body && ghostRelativeParent !== document.documentElement) {
2420
+ if (ghostRelativeParent === document) ghostRelativeParent = getWindowScrollingElement();
2421
+ rect.top += ghostRelativeParent.scrollTop;
2422
+ rect.left += ghostRelativeParent.scrollLeft;
2423
+ } else {
2424
+ ghostRelativeParent = getWindowScrollingElement();
2425
+ }
2426
+ ghostRelativeParentInitialScroll = getRelativeScrollOffset(ghostRelativeParent);
2427
+ }
2428
+ ghostEl = dragEl.cloneNode(true);
2429
+ toggleClass(ghostEl, options.ghostClass, false);
2430
+ toggleClass(ghostEl, options.fallbackClass, true);
2431
+ toggleClass(ghostEl, options.dragClass, true);
2432
+ css(ghostEl, 'transition', '');
2433
+ css(ghostEl, 'transform', '');
2434
+ css(ghostEl, 'box-sizing', 'border-box');
2435
+ css(ghostEl, 'margin', 0);
2436
+ css(ghostEl, 'top', rect.top);
2437
+ css(ghostEl, 'left', rect.left);
2438
+ css(ghostEl, 'width', rect.width);
2439
+ css(ghostEl, 'height', rect.height);
2440
+ css(ghostEl, 'opacity', '0.8');
2441
+ css(ghostEl, 'position', PositionGhostAbsolutely ? 'absolute' : 'fixed');
2442
+ css(ghostEl, 'zIndex', '100000');
2443
+ css(ghostEl, 'pointerEvents', 'none');
2444
+ Sortable.ghost = ghostEl;
2445
+ container.appendChild(ghostEl);
2446
+
2447
+ // Set transform-origin
2448
+ css(ghostEl, 'transform-origin', tapDistanceLeft / parseInt(ghostEl.style.width) * 100 + '% ' + tapDistanceTop / parseInt(ghostEl.style.height) * 100 + '%');
2449
+ }
2450
+ },
2451
+ _onDragStart: function _onDragStart( /**Event*/evt, /**boolean*/fallback) {
2452
+ var _this = this;
2453
+ var dataTransfer = evt.dataTransfer;
2454
+ var options = _this.options;
2455
+ pluginEvent('dragStart', this, {
2456
+ evt: evt
2457
+ });
2458
+ if (Sortable.eventCanceled) {
2459
+ this._onDrop();
2460
+ return;
2461
+ }
2462
+ pluginEvent('setupClone', this);
2463
+ if (!Sortable.eventCanceled) {
2464
+ cloneEl = clone(dragEl);
2465
+ cloneEl.removeAttribute("id");
2466
+ cloneEl.draggable = false;
2467
+ cloneEl.style['will-change'] = '';
2468
+ this._hideClone();
2469
+ toggleClass(cloneEl, this.options.chosenClass, false);
2470
+ Sortable.clone = cloneEl;
2471
+ }
2472
+
2473
+ // #1143: IFrame support workaround
2474
+ _this.cloneId = _nextTick(function () {
2475
+ pluginEvent('clone', _this);
2476
+ if (Sortable.eventCanceled) return;
2477
+ if (!_this.options.removeCloneOnHide) {
2478
+ rootEl.insertBefore(cloneEl, dragEl);
2479
+ }
2480
+ _this._hideClone();
2481
+ _dispatchEvent({
2482
+ sortable: _this,
2483
+ name: 'clone'
2484
+ });
2485
+ });
2486
+ !fallback && toggleClass(dragEl, options.dragClass, true);
2487
+
2488
+ // Set proper drop events
2489
+ if (fallback) {
2490
+ ignoreNextClick = true;
2491
+ _this._loopId = setInterval(_this._emulateDragOver, 50);
2492
+ } else {
2493
+ // Undo what was set in _prepareDragStart before drag started
2494
+ off(document, 'mouseup', _this._onDrop);
2495
+ off(document, 'touchend', _this._onDrop);
2496
+ off(document, 'touchcancel', _this._onDrop);
2497
+ if (dataTransfer) {
2498
+ dataTransfer.effectAllowed = 'move';
2499
+ options.setData && options.setData.call(_this, dataTransfer, dragEl);
2500
+ }
2501
+ on(document, 'drop', _this);
2502
+
2503
+ // #1276 fix:
2504
+ css(dragEl, 'transform', 'translateZ(0)');
2505
+ }
2506
+ awaitingDragStarted = true;
2507
+ _this._dragStartId = _nextTick(_this._dragStarted.bind(_this, fallback, evt));
2508
+ on(document, 'selectstart', _this);
2509
+ moved = true;
2510
+ window.getSelection().removeAllRanges();
2511
+ if (Safari) {
2512
+ css(document.body, 'user-select', 'none');
2513
+ }
2514
+ },
2515
+ // Returns true - if no further action is needed (either inserted or another condition)
2516
+ _onDragOver: function _onDragOver( /**Event*/evt) {
2517
+ var el = this.el,
2518
+ target = evt.target,
2519
+ dragRect,
2520
+ targetRect,
2521
+ revert,
2522
+ options = this.options,
2523
+ group = options.group,
2524
+ activeSortable = Sortable.active,
2525
+ isOwner = activeGroup === group,
2526
+ canSort = options.sort,
2527
+ fromSortable = putSortable || activeSortable,
2528
+ vertical,
2529
+ _this = this,
2530
+ completedFired = false;
2531
+ if (_silent) return;
2532
+ function dragOverEvent(name, extra) {
2533
+ pluginEvent(name, _this, _objectSpread2({
2534
+ evt: evt,
2535
+ isOwner: isOwner,
2536
+ axis: vertical ? 'vertical' : 'horizontal',
2537
+ revert: revert,
2538
+ dragRect: dragRect,
2539
+ targetRect: targetRect,
2540
+ canSort: canSort,
2541
+ fromSortable: fromSortable,
2542
+ target: target,
2543
+ completed: completed,
2544
+ onMove: function onMove(target, after) {
2545
+ return _onMove(rootEl, el, dragEl, dragRect, target, getRect(target), evt, after);
2546
+ },
2547
+ changed: changed
2548
+ }, extra));
2549
+ }
2550
+
2551
+ // Capture animation state
2552
+ function capture() {
2553
+ dragOverEvent('dragOverAnimationCapture');
2554
+ _this.captureAnimationState();
2555
+ if (_this !== fromSortable) {
2556
+ fromSortable.captureAnimationState();
2557
+ }
2558
+ }
2559
+
2560
+ // Return invocation when dragEl is inserted (or completed)
2561
+ function completed(insertion) {
2562
+ dragOverEvent('dragOverCompleted', {
2563
+ insertion: insertion
2564
+ });
2565
+ if (insertion) {
2566
+ // Clones must be hidden before folding animation to capture dragRectAbsolute properly
2567
+ if (isOwner) {
2568
+ activeSortable._hideClone();
2569
+ } else {
2570
+ activeSortable._showClone(_this);
2571
+ }
2572
+ if (_this !== fromSortable) {
2573
+ // Set ghost class to new sortable's ghost class
2574
+ toggleClass(dragEl, putSortable ? putSortable.options.ghostClass : activeSortable.options.ghostClass, false);
2575
+ toggleClass(dragEl, options.ghostClass, true);
2576
+ }
2577
+ if (putSortable !== _this && _this !== Sortable.active) {
2578
+ putSortable = _this;
2579
+ } else if (_this === Sortable.active && putSortable) {
2580
+ putSortable = null;
2581
+ }
2582
+
2583
+ // Animation
2584
+ if (fromSortable === _this) {
2585
+ _this._ignoreWhileAnimating = target;
2586
+ }
2587
+ _this.animateAll(function () {
2588
+ dragOverEvent('dragOverAnimationComplete');
2589
+ _this._ignoreWhileAnimating = null;
2590
+ });
2591
+ if (_this !== fromSortable) {
2592
+ fromSortable.animateAll();
2593
+ fromSortable._ignoreWhileAnimating = null;
2594
+ }
2595
+ }
2596
+
2597
+ // Null lastTarget if it is not inside a previously swapped element
2598
+ if (target === dragEl && !dragEl.animated || target === el && !target.animated) {
2599
+ lastTarget = null;
2600
+ }
2601
+
2602
+ // no bubbling and not fallback
2603
+ if (!options.dragoverBubble && !evt.rootEl && target !== document) {
2604
+ dragEl.parentNode[expando]._isOutsideThisEl(evt.target);
2605
+
2606
+ // Do not detect for empty insert if already inserted
2607
+ !insertion && nearestEmptyInsertDetectEvent(evt);
2608
+ }
2609
+ !options.dragoverBubble && evt.stopPropagation && evt.stopPropagation();
2610
+ return completedFired = true;
2611
+ }
2612
+
2613
+ // Call when dragEl has been inserted
2614
+ function changed() {
2615
+ newIndex = index(dragEl);
2616
+ newDraggableIndex = index(dragEl, options.draggable);
2617
+ _dispatchEvent({
2618
+ sortable: _this,
2619
+ name: 'change',
2620
+ toEl: el,
2621
+ newIndex: newIndex,
2622
+ newDraggableIndex: newDraggableIndex,
2623
+ originalEvent: evt
2624
+ });
2625
+ }
2626
+ if (evt.preventDefault !== void 0) {
2627
+ evt.cancelable && evt.preventDefault();
2628
+ }
2629
+ target = closest(target, options.draggable, el, true);
2630
+ dragOverEvent('dragOver');
2631
+ if (Sortable.eventCanceled) return completedFired;
2632
+ if (dragEl.contains(evt.target) || target.animated && target.animatingX && target.animatingY || _this._ignoreWhileAnimating === target) {
2633
+ return completed(false);
2634
+ }
2635
+ ignoreNextClick = false;
2636
+ if (activeSortable && !options.disabled && (isOwner ? canSort || (revert = parentEl !== rootEl) // Reverting item into the original list
2637
+ : putSortable === this || (this.lastPutMode = activeGroup.checkPull(this, activeSortable, dragEl, evt)) && group.checkPut(this, activeSortable, dragEl, evt))) {
2638
+ vertical = this._getDirection(evt, target) === 'vertical';
2639
+ dragRect = getRect(dragEl);
2640
+ dragOverEvent('dragOverValid');
2641
+ if (Sortable.eventCanceled) return completedFired;
2642
+ if (revert) {
2643
+ parentEl = rootEl; // actualization
2644
+ capture();
2645
+ this._hideClone();
2646
+ dragOverEvent('revert');
2647
+ if (!Sortable.eventCanceled) {
2648
+ if (nextEl) {
2649
+ rootEl.insertBefore(dragEl, nextEl);
2650
+ } else {
2651
+ rootEl.appendChild(dragEl);
2652
+ }
2653
+ }
2654
+ return completed(true);
2655
+ }
2656
+ var elLastChild = lastChild(el, options.draggable);
2657
+ if (!elLastChild || _ghostIsLast(evt, vertical, this) && !elLastChild.animated) {
2658
+ // Insert to end of list
2659
+
2660
+ // If already at end of list: Do not insert
2661
+ if (elLastChild === dragEl) {
2662
+ return completed(false);
2663
+ }
2664
+
2665
+ // if there is a last element, it is the target
2666
+ if (elLastChild && el === evt.target) {
2667
+ target = elLastChild;
2668
+ }
2669
+ if (target) {
2670
+ targetRect = getRect(target);
2671
+ }
2672
+ if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, !!target) !== false) {
2673
+ capture();
2674
+ if (elLastChild && elLastChild.nextSibling) {
2675
+ // the last draggable element is not the last node
2676
+ el.insertBefore(dragEl, elLastChild.nextSibling);
2677
+ } else {
2678
+ el.appendChild(dragEl);
2679
+ }
2680
+ parentEl = el; // actualization
2681
+
2682
+ changed();
2683
+ return completed(true);
2684
+ }
2685
+ } else if (elLastChild && _ghostIsFirst(evt, vertical, this)) {
2686
+ // Insert to start of list
2687
+ var firstChild = getChild(el, 0, options, true);
2688
+ if (firstChild === dragEl) {
2689
+ return completed(false);
2690
+ }
2691
+ target = firstChild;
2692
+ targetRect = getRect(target);
2693
+ if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, false) !== false) {
2694
+ capture();
2695
+ el.insertBefore(dragEl, firstChild);
2696
+ parentEl = el; // actualization
2697
+
2698
+ changed();
2699
+ return completed(true);
2700
+ }
2701
+ } else if (target.parentNode === el) {
2702
+ targetRect = getRect(target);
2703
+ var direction = 0,
2704
+ targetBeforeFirstSwap,
2705
+ differentLevel = dragEl.parentNode !== el,
2706
+ differentRowCol = !_dragElInRowColumn(dragEl.animated && dragEl.toRect || dragRect, target.animated && target.toRect || targetRect, vertical),
2707
+ side1 = vertical ? 'top' : 'left',
2708
+ scrolledPastTop = isScrolledPast(target, 'top', 'top') || isScrolledPast(dragEl, 'top', 'top'),
2709
+ scrollBefore = scrolledPastTop ? scrolledPastTop.scrollTop : void 0;
2710
+ if (lastTarget !== target) {
2711
+ targetBeforeFirstSwap = targetRect[side1];
2712
+ pastFirstInvertThresh = false;
2713
+ isCircumstantialInvert = !differentRowCol && options.invertSwap || differentLevel;
2714
+ }
2715
+ direction = _getSwapDirection(evt, target, targetRect, vertical, differentRowCol ? 1 : options.swapThreshold, options.invertedSwapThreshold == null ? options.swapThreshold : options.invertedSwapThreshold, isCircumstantialInvert, lastTarget === target);
2716
+ var sibling;
2717
+ if (direction !== 0) {
2718
+ // Check if target is beside dragEl in respective direction (ignoring hidden elements)
2719
+ var dragIndex = index(dragEl);
2720
+ do {
2721
+ dragIndex -= direction;
2722
+ sibling = parentEl.children[dragIndex];
2723
+ } while (sibling && (css(sibling, 'display') === 'none' || sibling === ghostEl));
2724
+ }
2725
+ // If dragEl is already beside target: Do not insert
2726
+ if (direction === 0 || sibling === target) {
2727
+ return completed(false);
2728
+ }
2729
+ lastTarget = target;
2730
+ lastDirection = direction;
2731
+ var nextSibling = target.nextElementSibling,
2732
+ after = false;
2733
+ after = direction === 1;
2734
+ var moveVector = _onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, after);
2735
+ if (moveVector !== false) {
2736
+ if (moveVector === 1 || moveVector === -1) {
2737
+ after = moveVector === 1;
2738
+ }
2739
+ _silent = true;
2740
+ setTimeout(_unsilent, 30);
2741
+ capture();
2742
+ if (after && !nextSibling) {
2743
+ el.appendChild(dragEl);
2744
+ } else {
2745
+ target.parentNode.insertBefore(dragEl, after ? nextSibling : target);
2746
+ }
2747
+
2748
+ // Undo chrome's scroll adjustment (has no effect on other browsers)
2749
+ if (scrolledPastTop) {
2750
+ scrollBy(scrolledPastTop, 0, scrollBefore - scrolledPastTop.scrollTop);
2751
+ }
2752
+ parentEl = dragEl.parentNode; // actualization
2753
+
2754
+ // must be done before animation
2755
+ if (targetBeforeFirstSwap !== undefined && !isCircumstantialInvert) {
2756
+ targetMoveDistance = Math.abs(targetBeforeFirstSwap - getRect(target)[side1]);
2757
+ }
2758
+ changed();
2759
+ return completed(true);
2760
+ }
2761
+ }
2762
+ if (el.contains(dragEl)) {
2763
+ return completed(false);
2764
+ }
2765
+ }
2766
+ return false;
2767
+ },
2768
+ _ignoreWhileAnimating: null,
2769
+ _offMoveEvents: function _offMoveEvents() {
2770
+ off(document, 'mousemove', this._onTouchMove);
2771
+ off(document, 'touchmove', this._onTouchMove);
2772
+ off(document, 'pointermove', this._onTouchMove);
2773
+ off(document, 'dragover', nearestEmptyInsertDetectEvent);
2774
+ off(document, 'mousemove', nearestEmptyInsertDetectEvent);
2775
+ off(document, 'touchmove', nearestEmptyInsertDetectEvent);
2776
+ },
2777
+ _offUpEvents: function _offUpEvents() {
2778
+ var ownerDocument = this.el.ownerDocument;
2779
+ off(ownerDocument, 'mouseup', this._onDrop);
2780
+ off(ownerDocument, 'touchend', this._onDrop);
2781
+ off(ownerDocument, 'pointerup', this._onDrop);
2782
+ off(ownerDocument, 'pointercancel', this._onDrop);
2783
+ off(ownerDocument, 'touchcancel', this._onDrop);
2784
+ off(document, 'selectstart', this);
2785
+ },
2786
+ _onDrop: function _onDrop( /**Event*/evt) {
2787
+ var el = this.el,
2788
+ options = this.options;
2789
+
2790
+ // Get the index of the dragged element within its parent
2791
+ newIndex = index(dragEl);
2792
+ newDraggableIndex = index(dragEl, options.draggable);
2793
+ pluginEvent('drop', this, {
2794
+ evt: evt
2795
+ });
2796
+ parentEl = dragEl && dragEl.parentNode;
2797
+
2798
+ // Get again after plugin event
2799
+ newIndex = index(dragEl);
2800
+ newDraggableIndex = index(dragEl, options.draggable);
2801
+ if (Sortable.eventCanceled) {
2802
+ this._nulling();
2803
+ return;
2804
+ }
2805
+ awaitingDragStarted = false;
2806
+ isCircumstantialInvert = false;
2807
+ pastFirstInvertThresh = false;
2808
+ clearInterval(this._loopId);
2809
+ clearTimeout(this._dragStartTimer);
2810
+ _cancelNextTick(this.cloneId);
2811
+ _cancelNextTick(this._dragStartId);
2812
+
2813
+ // Unbind events
2814
+ if (this.nativeDraggable) {
2815
+ off(document, 'drop', this);
2816
+ off(el, 'dragstart', this._onDragStart);
2817
+ }
2818
+ this._offMoveEvents();
2819
+ this._offUpEvents();
2820
+ if (Safari) {
2821
+ css(document.body, 'user-select', '');
2822
+ }
2823
+ css(dragEl, 'transform', '');
2824
+ if (evt) {
2825
+ if (moved) {
2826
+ evt.cancelable && evt.preventDefault();
2827
+ !options.dropBubble && evt.stopPropagation();
2828
+ }
2829
+ ghostEl && ghostEl.parentNode && ghostEl.parentNode.removeChild(ghostEl);
2830
+ if (rootEl === parentEl || putSortable && putSortable.lastPutMode !== 'clone') {
2831
+ // Remove clone(s)
2832
+ cloneEl && cloneEl.parentNode && cloneEl.parentNode.removeChild(cloneEl);
2833
+ }
2834
+ if (dragEl) {
2835
+ if (this.nativeDraggable) {
2836
+ off(dragEl, 'dragend', this);
2837
+ }
2838
+ _disableDraggable(dragEl);
2839
+ dragEl.style['will-change'] = '';
2840
+
2841
+ // Remove classes
2842
+ // ghostClass is added in dragStarted
2843
+ if (moved && !awaitingDragStarted) {
2844
+ toggleClass(dragEl, putSortable ? putSortable.options.ghostClass : this.options.ghostClass, false);
2845
+ }
2846
+ toggleClass(dragEl, this.options.chosenClass, false);
2847
+
2848
+ // Drag stop event
2849
+ _dispatchEvent({
2850
+ sortable: this,
2851
+ name: 'unchoose',
2852
+ toEl: parentEl,
2853
+ newIndex: null,
2854
+ newDraggableIndex: null,
2855
+ originalEvent: evt
2856
+ });
2857
+ if (rootEl !== parentEl) {
2858
+ if (newIndex >= 0) {
2859
+ // Add event
2860
+ _dispatchEvent({
2861
+ rootEl: parentEl,
2862
+ name: 'add',
2863
+ toEl: parentEl,
2864
+ fromEl: rootEl,
2865
+ originalEvent: evt
2866
+ });
2867
+
2868
+ // Remove event
2869
+ _dispatchEvent({
2870
+ sortable: this,
2871
+ name: 'remove',
2872
+ toEl: parentEl,
2873
+ originalEvent: evt
2874
+ });
2875
+
2876
+ // drag from one list and drop into another
2877
+ _dispatchEvent({
2878
+ rootEl: parentEl,
2879
+ name: 'sort',
2880
+ toEl: parentEl,
2881
+ fromEl: rootEl,
2882
+ originalEvent: evt
2883
+ });
2884
+ _dispatchEvent({
2885
+ sortable: this,
2886
+ name: 'sort',
2887
+ toEl: parentEl,
2888
+ originalEvent: evt
2889
+ });
2890
+ }
2891
+ putSortable && putSortable.save();
2892
+ } else {
2893
+ if (newIndex !== oldIndex) {
2894
+ if (newIndex >= 0) {
2895
+ // drag & drop within the same list
2896
+ _dispatchEvent({
2897
+ sortable: this,
2898
+ name: 'update',
2899
+ toEl: parentEl,
2900
+ originalEvent: evt
2901
+ });
2902
+ _dispatchEvent({
2903
+ sortable: this,
2904
+ name: 'sort',
2905
+ toEl: parentEl,
2906
+ originalEvent: evt
2907
+ });
2908
+ }
2909
+ }
2910
+ }
2911
+ if (Sortable.active) {
2912
+ /* jshint eqnull:true */
2913
+ if (newIndex == null || newIndex === -1) {
2914
+ newIndex = oldIndex;
2915
+ newDraggableIndex = oldDraggableIndex;
2916
+ }
2917
+ _dispatchEvent({
2918
+ sortable: this,
2919
+ name: 'end',
2920
+ toEl: parentEl,
2921
+ originalEvent: evt
2922
+ });
2923
+
2924
+ // Save sorting
2925
+ this.save();
2926
+ }
2927
+ }
2928
+ }
2929
+ this._nulling();
2930
+ },
2931
+ _nulling: function _nulling() {
2932
+ pluginEvent('nulling', this);
2933
+ 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;
2934
+ savedInputChecked.forEach(function (el) {
2935
+ el.checked = true;
2936
+ });
2937
+ savedInputChecked.length = lastDx = lastDy = 0;
2938
+ },
2939
+ handleEvent: function handleEvent( /**Event*/evt) {
2940
+ switch (evt.type) {
2941
+ case 'drop':
2942
+ case 'dragend':
2943
+ this._onDrop(evt);
2944
+ break;
2945
+ case 'dragenter':
2946
+ case 'dragover':
2947
+ if (dragEl) {
2948
+ this._onDragOver(evt);
2949
+ _globalDragOver(evt);
2950
+ }
2951
+ break;
2952
+ case 'selectstart':
2953
+ evt.preventDefault();
2954
+ break;
2955
+ }
2956
+ },
2957
+ /**
2958
+ * Serializes the item into an array of string.
2959
+ * @returns {String[]}
2960
+ */
2961
+ toArray: function toArray() {
2962
+ var order = [],
2963
+ el,
2964
+ children = this.el.children,
2965
+ i = 0,
2966
+ n = children.length,
2967
+ options = this.options;
2968
+ for (; i < n; i++) {
2969
+ el = children[i];
2970
+ if (closest(el, options.draggable, this.el, false)) {
2971
+ order.push(el.getAttribute(options.dataIdAttr) || _generateId(el));
2972
+ }
2973
+ }
2974
+ return order;
2975
+ },
2976
+ /**
2977
+ * Sorts the elements according to the array.
2978
+ * @param {String[]} order order of the items
2979
+ */
2980
+ sort: function sort(order, useAnimation) {
2981
+ var items = {},
2982
+ rootEl = this.el;
2983
+ this.toArray().forEach(function (id, i) {
2984
+ var el = rootEl.children[i];
2985
+ if (closest(el, this.options.draggable, rootEl, false)) {
2986
+ items[id] = el;
2987
+ }
2988
+ }, this);
2989
+ useAnimation && this.captureAnimationState();
2990
+ order.forEach(function (id) {
2991
+ if (items[id]) {
2992
+ rootEl.removeChild(items[id]);
2993
+ rootEl.appendChild(items[id]);
2994
+ }
2995
+ });
2996
+ useAnimation && this.animateAll();
2997
+ },
2998
+ /**
2999
+ * Save the current sorting
3000
+ */
3001
+ save: function save() {
3002
+ var store = this.options.store;
3003
+ store && store.set && store.set(this);
3004
+ },
3005
+ /**
3006
+ * 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.
3007
+ * @param {HTMLElement} el
3008
+ * @param {String} [selector] default: `options.draggable`
3009
+ * @returns {HTMLElement|null}
3010
+ */
3011
+ closest: function closest$1(el, selector) {
3012
+ return closest(el, selector || this.options.draggable, this.el, false);
3013
+ },
3014
+ /**
3015
+ * Set/get option
3016
+ * @param {string} name
3017
+ * @param {*} [value]
3018
+ * @returns {*}
3019
+ */
3020
+ option: function option(name, value) {
3021
+ var options = this.options;
3022
+ if (value === void 0) {
3023
+ return options[name];
3024
+ } else {
3025
+ var modifiedValue = PluginManager.modifyOption(this, name, value);
3026
+ if (typeof modifiedValue !== 'undefined') {
3027
+ options[name] = modifiedValue;
3028
+ } else {
3029
+ options[name] = value;
3030
+ }
3031
+ if (name === 'group') {
3032
+ _prepareGroup(options);
3033
+ }
3034
+ }
3035
+ },
3036
+ /**
3037
+ * Destroy
3038
+ */
3039
+ destroy: function destroy() {
3040
+ pluginEvent('destroy', this);
3041
+ var el = this.el;
3042
+ el[expando] = null;
3043
+ off(el, 'mousedown', this._onTapStart);
3044
+ off(el, 'touchstart', this._onTapStart);
3045
+ off(el, 'pointerdown', this._onTapStart);
3046
+ if (this.nativeDraggable) {
3047
+ off(el, 'dragover', this);
3048
+ off(el, 'dragenter', this);
3049
+ }
3050
+ // Remove draggable attributes
3051
+ Array.prototype.forEach.call(el.querySelectorAll('[draggable]'), function (el) {
3052
+ el.removeAttribute('draggable');
3053
+ });
3054
+ this._onDrop();
3055
+ this._disableDelayedDragEvents();
3056
+ sortables.splice(sortables.indexOf(this.el), 1);
3057
+ this.el = el = null;
3058
+ },
3059
+ _hideClone: function _hideClone() {
3060
+ if (!cloneHidden) {
3061
+ pluginEvent('hideClone', this);
3062
+ if (Sortable.eventCanceled) return;
3063
+ css(cloneEl, 'display', 'none');
3064
+ if (this.options.removeCloneOnHide && cloneEl.parentNode) {
3065
+ cloneEl.parentNode.removeChild(cloneEl);
3066
+ }
3067
+ cloneHidden = true;
3068
+ }
3069
+ },
3070
+ _showClone: function _showClone(putSortable) {
3071
+ if (putSortable.lastPutMode !== 'clone') {
3072
+ this._hideClone();
3073
+ return;
3074
+ }
3075
+ if (cloneHidden) {
3076
+ pluginEvent('showClone', this);
3077
+ if (Sortable.eventCanceled) return;
3078
+
3079
+ // show clone at dragEl or original position
3080
+ if (dragEl.parentNode == rootEl && !this.options.group.revertClone) {
3081
+ rootEl.insertBefore(cloneEl, dragEl);
3082
+ } else if (nextEl) {
3083
+ rootEl.insertBefore(cloneEl, nextEl);
3084
+ } else {
3085
+ rootEl.appendChild(cloneEl);
3086
+ }
3087
+ if (this.options.group.revertClone) {
3088
+ this.animate(dragEl, cloneEl);
3089
+ }
3090
+ css(cloneEl, 'display', '');
3091
+ cloneHidden = false;
3092
+ }
3093
+ }
3094
+ };
3095
+ function _globalDragOver( /**Event*/evt) {
3096
+ if (evt.dataTransfer) {
3097
+ evt.dataTransfer.dropEffect = 'move';
3098
+ }
3099
+ evt.cancelable && evt.preventDefault();
3100
+ }
3101
+ function _onMove(fromEl, toEl, dragEl, dragRect, targetEl, targetRect, originalEvent, willInsertAfter) {
3102
+ var evt,
3103
+ sortable = fromEl[expando],
3104
+ onMoveFn = sortable.options.onMove,
3105
+ retVal;
3106
+ // Support for new CustomEvent feature
3107
+ if (window.CustomEvent && !IE11OrLess && !Edge) {
3108
+ evt = new CustomEvent('move', {
3109
+ bubbles: true,
3110
+ cancelable: true
3111
+ });
3112
+ } else {
3113
+ evt = document.createEvent('Event');
3114
+ evt.initEvent('move', true, true);
3115
+ }
3116
+ evt.to = toEl;
3117
+ evt.from = fromEl;
3118
+ evt.dragged = dragEl;
3119
+ evt.draggedRect = dragRect;
3120
+ evt.related = targetEl || toEl;
3121
+ evt.relatedRect = targetRect || getRect(toEl);
3122
+ evt.willInsertAfter = willInsertAfter;
3123
+ evt.originalEvent = originalEvent;
3124
+ fromEl.dispatchEvent(evt);
3125
+ if (onMoveFn) {
3126
+ retVal = onMoveFn.call(sortable, evt, originalEvent);
3127
+ }
3128
+ return retVal;
3129
+ }
3130
+ function _disableDraggable(el) {
3131
+ el.draggable = false;
3132
+ }
3133
+ function _unsilent() {
3134
+ _silent = false;
3135
+ }
3136
+ function _ghostIsFirst(evt, vertical, sortable) {
3137
+ var firstElRect = getRect(getChild(sortable.el, 0, sortable.options, true));
3138
+ var childContainingRect = getChildContainingRectFromElement(sortable.el, sortable.options, ghostEl);
3139
+ var spacer = 10;
3140
+ return vertical ? evt.clientX < childContainingRect.left - spacer || evt.clientY < firstElRect.top && evt.clientX < firstElRect.right : evt.clientY < childContainingRect.top - spacer || evt.clientY < firstElRect.bottom && evt.clientX < firstElRect.left;
3141
+ }
3142
+ function _ghostIsLast(evt, vertical, sortable) {
3143
+ var lastElRect = getRect(lastChild(sortable.el, sortable.options.draggable));
3144
+ var childContainingRect = getChildContainingRectFromElement(sortable.el, sortable.options, ghostEl);
3145
+ var spacer = 10;
3146
+ return vertical ? evt.clientX > childContainingRect.right + spacer || evt.clientY > lastElRect.bottom && evt.clientX > lastElRect.left : evt.clientY > childContainingRect.bottom + spacer || evt.clientX > lastElRect.right && evt.clientY > lastElRect.top;
3147
+ }
3148
+ function _getSwapDirection(evt, target, targetRect, vertical, swapThreshold, invertedSwapThreshold, invertSwap, isLastTarget) {
3149
+ var mouseOnAxis = vertical ? evt.clientY : evt.clientX,
3150
+ targetLength = vertical ? targetRect.height : targetRect.width,
3151
+ targetS1 = vertical ? targetRect.top : targetRect.left,
3152
+ targetS2 = vertical ? targetRect.bottom : targetRect.right,
3153
+ invert = false;
3154
+ if (!invertSwap) {
3155
+ // Never invert or create dragEl shadow when target movemenet causes mouse to move past the end of regular swapThreshold
3156
+ if (isLastTarget && targetMoveDistance < targetLength * swapThreshold) {
3157
+ // multiplied only by swapThreshold because mouse will already be inside target by (1 - threshold) * targetLength / 2
3158
+ // check if past first invert threshold on side opposite of lastDirection
3159
+ if (!pastFirstInvertThresh && (lastDirection === 1 ? mouseOnAxis > targetS1 + targetLength * invertedSwapThreshold / 2 : mouseOnAxis < targetS2 - targetLength * invertedSwapThreshold / 2)) {
3160
+ // past first invert threshold, do not restrict inverted threshold to dragEl shadow
3161
+ pastFirstInvertThresh = true;
3162
+ }
3163
+ if (!pastFirstInvertThresh) {
3164
+ // dragEl shadow (target move distance shadow)
3165
+ if (lastDirection === 1 ? mouseOnAxis < targetS1 + targetMoveDistance // over dragEl shadow
3166
+ : mouseOnAxis > targetS2 - targetMoveDistance) {
3167
+ return -lastDirection;
3168
+ }
3169
+ } else {
3170
+ invert = true;
3171
+ }
3172
+ } else {
3173
+ // Regular
3174
+ if (mouseOnAxis > targetS1 + targetLength * (1 - swapThreshold) / 2 && mouseOnAxis < targetS2 - targetLength * (1 - swapThreshold) / 2) {
3175
+ return _getInsertDirection(target);
3176
+ }
3177
+ }
3178
+ }
3179
+ invert = invert || invertSwap;
3180
+ if (invert) {
3181
+ // Invert of regular
3182
+ if (mouseOnAxis < targetS1 + targetLength * invertedSwapThreshold / 2 || mouseOnAxis > targetS2 - targetLength * invertedSwapThreshold / 2) {
3183
+ return mouseOnAxis > targetS1 + targetLength / 2 ? 1 : -1;
3184
+ }
3185
+ }
3186
+ return 0;
3187
+ }
3188
+
3189
+ /**
3190
+ * Gets the direction dragEl must be swapped relative to target in order to make it
3191
+ * seem that dragEl has been "inserted" into that element's position
3192
+ * @param {HTMLElement} target The target whose position dragEl is being inserted at
3193
+ * @return {Number} Direction dragEl must be swapped
3194
+ */
3195
+ function _getInsertDirection(target) {
3196
+ if (index(dragEl) < index(target)) {
3197
+ return 1;
3198
+ } else {
3199
+ return -1;
3200
+ }
3201
+ }
3202
+
3203
+ /**
3204
+ * Generate id
3205
+ * @param {HTMLElement} el
3206
+ * @returns {String}
3207
+ * @private
3208
+ */
3209
+ function _generateId(el) {
3210
+ var str = el.tagName + el.className + el.src + el.href + el.textContent,
3211
+ i = str.length,
3212
+ sum = 0;
3213
+ while (i--) {
3214
+ sum += str.charCodeAt(i);
3215
+ }
3216
+ return sum.toString(36);
3217
+ }
3218
+ function _saveInputCheckedState(root) {
3219
+ savedInputChecked.length = 0;
3220
+ var inputs = root.getElementsByTagName('input');
3221
+ var idx = inputs.length;
3222
+ while (idx--) {
3223
+ var el = inputs[idx];
3224
+ el.checked && savedInputChecked.push(el);
3225
+ }
3226
+ }
3227
+ function _nextTick(fn) {
3228
+ return setTimeout(fn, 0);
3229
+ }
3230
+ function _cancelNextTick(id) {
3231
+ return clearTimeout(id);
3232
+ }
3233
+
3234
+ // Fixed #973:
3235
+ if (documentExists) {
3236
+ on(document, 'touchmove', function (evt) {
3237
+ if ((Sortable.active || awaitingDragStarted) && evt.cancelable) {
3238
+ evt.preventDefault();
3239
+ }
3240
+ });
3241
+ }
3242
+
3243
+ // Export utils
3244
+ Sortable.utils = {
3245
+ on: on,
3246
+ off: off,
3247
+ css: css,
3248
+ find: find,
3249
+ is: function is(el, selector) {
3250
+ return !!closest(el, selector, el, false);
3251
+ },
3252
+ extend: extend,
3253
+ throttle: throttle,
3254
+ closest: closest,
3255
+ toggleClass: toggleClass,
3256
+ clone: clone,
3257
+ index: index,
3258
+ nextTick: _nextTick,
3259
+ cancelNextTick: _cancelNextTick,
3260
+ detectDirection: _detectDirection,
3261
+ getChild: getChild,
3262
+ expando: expando
3263
+ };
3264
+
3265
+ /**
3266
+ * Get the Sortable instance of an element
3267
+ * @param {HTMLElement} element The element
3268
+ * @return {Sortable|undefined} The instance of Sortable
3269
+ */
3270
+ Sortable.get = function (element) {
3271
+ return element[expando];
3272
+ };
3273
+
3274
+ /**
3275
+ * Mount a plugin to Sortable
3276
+ * @param {...SortablePlugin|SortablePlugin[]} plugins Plugins being mounted
3277
+ */
3278
+ Sortable.mount = function () {
3279
+ for (var _len = arguments.length, plugins = new Array(_len), _key = 0; _key < _len; _key++) {
3280
+ plugins[_key] = arguments[_key];
3281
+ }
3282
+ if (plugins[0].constructor === Array) plugins = plugins[0];
3283
+ plugins.forEach(function (plugin) {
3284
+ if (!plugin.prototype || !plugin.prototype.constructor) {
3285
+ throw "Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(plugin));
3286
+ }
3287
+ if (plugin.utils) Sortable.utils = _objectSpread2(_objectSpread2({}, Sortable.utils), plugin.utils);
3288
+ PluginManager.mount(plugin);
3289
+ });
3290
+ };
3291
+
3292
+ /**
3293
+ * Create sortable instance
3294
+ * @param {HTMLElement} el
3295
+ * @param {Object} [options]
3296
+ */
3297
+ Sortable.create = function (el, options) {
3298
+ return new Sortable(el, options);
3299
+ };
3300
+
3301
+ // Export
3302
+ Sortable.version = version;
3303
+
3304
+ var autoScrolls = [],
3305
+ scrollEl,
3306
+ scrollRootEl,
3307
+ scrolling = false,
3308
+ lastAutoScrollX,
3309
+ lastAutoScrollY,
3310
+ touchEvt$1,
3311
+ pointerElemChangedInterval;
3312
+ function AutoScrollPlugin() {
3313
+ function AutoScroll() {
3314
+ this.defaults = {
3315
+ scroll: true,
3316
+ forceAutoScrollFallback: false,
3317
+ scrollSensitivity: 30,
3318
+ scrollSpeed: 10,
3319
+ bubbleScroll: true
3320
+ };
3321
+
3322
+ // Bind all private methods
3323
+ for (var fn in this) {
3324
+ if (fn.charAt(0) === '_' && typeof this[fn] === 'function') {
3325
+ this[fn] = this[fn].bind(this);
3326
+ }
3327
+ }
3328
+ }
3329
+ AutoScroll.prototype = {
3330
+ dragStarted: function dragStarted(_ref) {
3331
+ var originalEvent = _ref.originalEvent;
3332
+ if (this.sortable.nativeDraggable) {
3333
+ on(document, 'dragover', this._handleAutoScroll);
3334
+ } else {
3335
+ if (this.options.supportPointer) {
3336
+ on(document, 'pointermove', this._handleFallbackAutoScroll);
3337
+ } else if (originalEvent.touches) {
3338
+ on(document, 'touchmove', this._handleFallbackAutoScroll);
3339
+ } else {
3340
+ on(document, 'mousemove', this._handleFallbackAutoScroll);
3341
+ }
3342
+ }
3343
+ },
3344
+ dragOverCompleted: function dragOverCompleted(_ref2) {
3345
+ var originalEvent = _ref2.originalEvent;
3346
+ // For when bubbling is canceled and using fallback (fallback 'touchmove' always reached)
3347
+ if (!this.options.dragOverBubble && !originalEvent.rootEl) {
3348
+ this._handleAutoScroll(originalEvent);
3349
+ }
3350
+ },
3351
+ drop: function drop() {
3352
+ if (this.sortable.nativeDraggable) {
3353
+ off(document, 'dragover', this._handleAutoScroll);
3354
+ } else {
3355
+ off(document, 'pointermove', this._handleFallbackAutoScroll);
3356
+ off(document, 'touchmove', this._handleFallbackAutoScroll);
3357
+ off(document, 'mousemove', this._handleFallbackAutoScroll);
3358
+ }
3359
+ clearPointerElemChangedInterval();
3360
+ clearAutoScrolls();
3361
+ cancelThrottle();
3362
+ },
3363
+ nulling: function nulling() {
3364
+ touchEvt$1 = scrollRootEl = scrollEl = scrolling = pointerElemChangedInterval = lastAutoScrollX = lastAutoScrollY = null;
3365
+ autoScrolls.length = 0;
3366
+ },
3367
+ _handleFallbackAutoScroll: function _handleFallbackAutoScroll(evt) {
3368
+ this._handleAutoScroll(evt, true);
3369
+ },
3370
+ _handleAutoScroll: function _handleAutoScroll(evt, fallback) {
3371
+ var _this = this;
3372
+ var x = (evt.touches ? evt.touches[0] : evt).clientX,
3373
+ y = (evt.touches ? evt.touches[0] : evt).clientY,
3374
+ elem = document.elementFromPoint(x, y);
3375
+ touchEvt$1 = evt;
3376
+
3377
+ // IE does not seem to have native autoscroll,
3378
+ // Edge's autoscroll seems too conditional,
3379
+ // MACOS Safari does not have autoscroll,
3380
+ // Firefox and Chrome are good
3381
+ if (fallback || this.options.forceAutoScrollFallback || Edge || IE11OrLess || Safari) {
3382
+ autoScroll(evt, this.options, elem, fallback);
3383
+
3384
+ // Listener for pointer element change
3385
+ var ogElemScroller = getParentAutoScrollElement(elem, true);
3386
+ if (scrolling && (!pointerElemChangedInterval || x !== lastAutoScrollX || y !== lastAutoScrollY)) {
3387
+ pointerElemChangedInterval && clearPointerElemChangedInterval();
3388
+ // Detect for pointer elem change, emulating native DnD behaviour
3389
+ pointerElemChangedInterval = setInterval(function () {
3390
+ var newElem = getParentAutoScrollElement(document.elementFromPoint(x, y), true);
3391
+ if (newElem !== ogElemScroller) {
3392
+ ogElemScroller = newElem;
3393
+ clearAutoScrolls();
3394
+ }
3395
+ autoScroll(evt, _this.options, newElem, fallback);
3396
+ }, 10);
3397
+ lastAutoScrollX = x;
3398
+ lastAutoScrollY = y;
3399
+ }
3400
+ } else {
3401
+ // if DnD is enabled (and browser has good autoscrolling), first autoscroll will already scroll, so get parent autoscroll of first autoscroll
3402
+ if (!this.options.bubbleScroll || getParentAutoScrollElement(elem, true) === getWindowScrollingElement()) {
3403
+ clearAutoScrolls();
3404
+ return;
3405
+ }
3406
+ autoScroll(evt, this.options, getParentAutoScrollElement(elem, false), false);
3407
+ }
3408
+ }
3409
+ };
3410
+ return _extends(AutoScroll, {
3411
+ pluginName: 'scroll',
3412
+ initializeByDefault: true
3413
+ });
3414
+ }
3415
+ function clearAutoScrolls() {
3416
+ autoScrolls.forEach(function (autoScroll) {
3417
+ clearInterval(autoScroll.pid);
3418
+ });
3419
+ autoScrolls = [];
3420
+ }
3421
+ function clearPointerElemChangedInterval() {
3422
+ clearInterval(pointerElemChangedInterval);
3423
+ }
3424
+ var autoScroll = throttle(function (evt, options, rootEl, isFallback) {
3425
+ // Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=505521
3426
+ if (!options.scroll) return;
3427
+ var x = (evt.touches ? evt.touches[0] : evt).clientX,
3428
+ y = (evt.touches ? evt.touches[0] : evt).clientY,
3429
+ sens = options.scrollSensitivity,
3430
+ speed = options.scrollSpeed,
3431
+ winScroller = getWindowScrollingElement();
3432
+ var scrollThisInstance = false,
3433
+ scrollCustomFn;
3434
+
3435
+ // New scroll root, set scrollEl
3436
+ if (scrollRootEl !== rootEl) {
3437
+ scrollRootEl = rootEl;
3438
+ clearAutoScrolls();
3439
+ scrollEl = options.scroll;
3440
+ scrollCustomFn = options.scrollFn;
3441
+ if (scrollEl === true) {
3442
+ scrollEl = getParentAutoScrollElement(rootEl, true);
3443
+ }
3444
+ }
3445
+ var layersOut = 0;
3446
+ var currentParent = scrollEl;
3447
+ do {
3448
+ var el = currentParent,
3449
+ rect = getRect(el),
3450
+ top = rect.top,
3451
+ bottom = rect.bottom,
3452
+ left = rect.left,
3453
+ right = rect.right,
3454
+ width = rect.width,
3455
+ height = rect.height,
3456
+ canScrollX = void 0,
3457
+ canScrollY = void 0,
3458
+ scrollWidth = el.scrollWidth,
3459
+ scrollHeight = el.scrollHeight,
3460
+ elCSS = css(el),
3461
+ scrollPosX = el.scrollLeft,
3462
+ scrollPosY = el.scrollTop;
3463
+ if (el === winScroller) {
3464
+ canScrollX = width < scrollWidth && (elCSS.overflowX === 'auto' || elCSS.overflowX === 'scroll' || elCSS.overflowX === 'visible');
3465
+ canScrollY = height < scrollHeight && (elCSS.overflowY === 'auto' || elCSS.overflowY === 'scroll' || elCSS.overflowY === 'visible');
3466
+ } else {
3467
+ canScrollX = width < scrollWidth && (elCSS.overflowX === 'auto' || elCSS.overflowX === 'scroll');
3468
+ canScrollY = height < scrollHeight && (elCSS.overflowY === 'auto' || elCSS.overflowY === 'scroll');
3469
+ }
3470
+ var vx = canScrollX && (Math.abs(right - x) <= sens && scrollPosX + width < scrollWidth) - (Math.abs(left - x) <= sens && !!scrollPosX);
3471
+ var vy = canScrollY && (Math.abs(bottom - y) <= sens && scrollPosY + height < scrollHeight) - (Math.abs(top - y) <= sens && !!scrollPosY);
3472
+ if (!autoScrolls[layersOut]) {
3473
+ for (var i = 0; i <= layersOut; i++) {
3474
+ if (!autoScrolls[i]) {
3475
+ autoScrolls[i] = {};
3476
+ }
3477
+ }
3478
+ }
3479
+ if (autoScrolls[layersOut].vx != vx || autoScrolls[layersOut].vy != vy || autoScrolls[layersOut].el !== el) {
3480
+ autoScrolls[layersOut].el = el;
3481
+ autoScrolls[layersOut].vx = vx;
3482
+ autoScrolls[layersOut].vy = vy;
3483
+ clearInterval(autoScrolls[layersOut].pid);
3484
+ if (vx != 0 || vy != 0) {
3485
+ scrollThisInstance = true;
3486
+ /* jshint loopfunc:true */
3487
+ autoScrolls[layersOut].pid = setInterval(function () {
3488
+ // emulate drag over during autoscroll (fallback), emulating native DnD behaviour
3489
+ if (isFallback && this.layer === 0) {
3490
+ Sortable.active._onTouchMove(touchEvt$1); // To move ghost if it is positioned absolutely
3491
+ }
3492
+ var scrollOffsetY = autoScrolls[this.layer].vy ? autoScrolls[this.layer].vy * speed : 0;
3493
+ var scrollOffsetX = autoScrolls[this.layer].vx ? autoScrolls[this.layer].vx * speed : 0;
3494
+ if (typeof scrollCustomFn === 'function') {
3495
+ if (scrollCustomFn.call(Sortable.dragged.parentNode[expando], scrollOffsetX, scrollOffsetY, evt, touchEvt$1, autoScrolls[this.layer].el) !== 'continue') {
3496
+ return;
3497
+ }
3498
+ }
3499
+ scrollBy(autoScrolls[this.layer].el, scrollOffsetX, scrollOffsetY);
3500
+ }.bind({
3501
+ layer: layersOut
3502
+ }), 24);
3503
+ }
3504
+ }
3505
+ layersOut++;
3506
+ } while (options.bubbleScroll && currentParent !== winScroller && (currentParent = getParentAutoScrollElement(currentParent, false)));
3507
+ scrolling = scrollThisInstance; // in case another function catches scrolling as false in between when it is not
3508
+ }, 30);
3509
+
3510
+ var drop = function drop(_ref) {
3511
+ var originalEvent = _ref.originalEvent,
3512
+ putSortable = _ref.putSortable,
3513
+ dragEl = _ref.dragEl,
3514
+ activeSortable = _ref.activeSortable,
3515
+ dispatchSortableEvent = _ref.dispatchSortableEvent,
3516
+ hideGhostForTarget = _ref.hideGhostForTarget,
3517
+ unhideGhostForTarget = _ref.unhideGhostForTarget;
3518
+ if (!originalEvent) return;
3519
+ var toSortable = putSortable || activeSortable;
3520
+ hideGhostForTarget();
3521
+ var touch = originalEvent.changedTouches && originalEvent.changedTouches.length ? originalEvent.changedTouches[0] : originalEvent;
3522
+ var target = document.elementFromPoint(touch.clientX, touch.clientY);
3523
+ unhideGhostForTarget();
3524
+ if (toSortable && !toSortable.el.contains(target)) {
3525
+ dispatchSortableEvent('spill');
3526
+ this.onSpill({
3527
+ dragEl: dragEl,
3528
+ putSortable: putSortable
3529
+ });
3530
+ }
3531
+ };
3532
+ function Revert() {}
3533
+ Revert.prototype = {
3534
+ startIndex: null,
3535
+ dragStart: function dragStart(_ref2) {
3536
+ var oldDraggableIndex = _ref2.oldDraggableIndex;
3537
+ this.startIndex = oldDraggableIndex;
3538
+ },
3539
+ onSpill: function onSpill(_ref3) {
3540
+ var dragEl = _ref3.dragEl,
3541
+ putSortable = _ref3.putSortable;
3542
+ this.sortable.captureAnimationState();
3543
+ if (putSortable) {
3544
+ putSortable.captureAnimationState();
3545
+ }
3546
+ var nextSibling = getChild(this.sortable.el, this.startIndex, this.options);
3547
+ if (nextSibling) {
3548
+ this.sortable.el.insertBefore(dragEl, nextSibling);
3549
+ } else {
3550
+ this.sortable.el.appendChild(dragEl);
3551
+ }
3552
+ this.sortable.animateAll();
3553
+ if (putSortable) {
3554
+ putSortable.animateAll();
3555
+ }
3556
+ },
3557
+ drop: drop
3558
+ };
3559
+ _extends(Revert, {
3560
+ pluginName: 'revertOnSpill'
3561
+ });
3562
+ function Remove() {}
3563
+ Remove.prototype = {
3564
+ onSpill: function onSpill(_ref4) {
3565
+ var dragEl = _ref4.dragEl,
3566
+ putSortable = _ref4.putSortable;
3567
+ var parentSortable = putSortable || this.sortable;
3568
+ parentSortable.captureAnimationState();
3569
+ dragEl.parentNode && dragEl.parentNode.removeChild(dragEl);
3570
+ parentSortable.animateAll();
3571
+ },
3572
+ drop: drop
3573
+ };
3574
+ _extends(Remove, {
3575
+ pluginName: 'removeOnSpill'
3576
+ });
3577
+
3578
+ Sortable.mount(new AutoScrollPlugin());
3579
+ Sortable.mount(Remove, Revert);
3580
+
3581
+ const verdocsTemplateRolesCss = "@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-template-roles{display:block;max-width:600px;font-family:\"Inter\", -apple-system, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", sans-serif}verdocs-template-roles .roles{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:10px;margin-top:10px}verdocs-template-roles .roles .sequence{gap:10px;height:34px;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;font-weight:500;padding:0 0 8px 0;-ms-flex-direction:row;flex-direction:row;border-bottom:1px dotted #e3e3e3}verdocs-template-roles .roles .sequence.add-sequence{color:#777777;line-height:34px}verdocs-template-roles .roles .sequence-label{font-size:18px;line-height:32px}verdocs-template-roles .roles .sequence-roles{gap:10px;display:-ms-flexbox;display:flex;position:relative;-ms-flex-wrap:wrap;flex-wrap:wrap;font-weight:500;-ms-flex-direction:row;flex-direction:row}verdocs-template-roles .roles .role{height:32px;cursor:move;display:-ms-flexbox;display:flex;max-width:200px;position:relative;border-radius:32px;background-color:#eff7fb;-webkit-box-sizing:border-box;box-sizing:border-box;padding:0 14px 0 34px;border:1px solid #ccc;-ms-flex-direction:column;flex-direction:column}verdocs-template-roles .roles .role .role-name{font-size:14px;overflow:hidden;font-weight:400;line-height:30px;white-space:nowrap;text-overflow:ellipsis}verdocs-template-roles .roles .role .icons{position:absolute;left:1px;top:-3px;cursor:pointer;padding:5px;z-index:10}verdocs-template-roles .roles .role .icons .gear-button{display:none;-webkit-transform:scale(1.1);transform:scale(1.1);margin:4px 0 0 1px}verdocs-template-roles .roles .role .icons .type-icon{opacity:0.6;display:block;-webkit-transform:scale(0.8);transform:scale(0.8)}verdocs-template-roles .roles .role .icons:hover .gear-button{display:block}verdocs-template-roles .roles .role .icons:hover .type-icon{display:none}verdocs-template-roles>form{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;background-color:#ffffff;padding:12px}verdocs-template-roles>form h5{font-size:16px;font-weight:bold;color:#46497d;margin:0 0 10px 0}verdocs-template-roles>form label{display:block;font-size:14px;font-weight:500;margin:0 0 4px 0;color:#5c6575}verdocs-template-roles>form input{border:none;font-size:18px;padding:3px 6px 3px 0;background:transparent;border-bottom:1px solid #33364b}verdocs-template-roles>form input:focus{outline:none}verdocs-template-roles .row.add-sequence{display:none}verdocs-template-roles .add-role{margin:0;padding:0;border:none;opacity:0.3;cursor:pointer;background:none;-webkit-transform:scale(0.75);transform:scale(0.75)}verdocs-template-roles .add-role:hover{opacity:1}verdocs-template-roles .add-role svg{width:32px;height:32px}verdocs-template-roles .add-step{margin:0;padding:0;border:none;opacity:0.5;cursor:pointer;background:none}verdocs-template-roles .add-step:hover{opacity:1}verdocs-template-roles .add-step svg{width:32px;height:32px}verdocs-template-roles.dragging .row.add-sequence{display:-ms-flexbox;display:flex}verdocs-template-roles .buttons{display:-ms-flexbox;display:flex;-webkit-column-gap:8px;-moz-column-gap:8px;column-gap:8px;margin-top:16px;-ms-flex-direction:row;flex-direction:row}verdocs-template-roles .empty{font-size:13px;margin-top:15px;margin-bottom:5px}verdocs-template-roles .empty svg{width:16px;height:16px;stroke:#666666;margin-bottom:2px;display:inline-block}verdocs-template-roles.dragging .roles .sequence.add-sequence .add-role,verdocs-template-roles.dragging .roles .sequence.add-sequence .add-step-label{display:none}verdocs-template-roles.dragging .roles .sequence.add-sequence .sequence-roles{display:-ms-flexbox;display:flex;min-width:150px;background:#e0e0e0}verdocs-template-roles ::-webkit-input-placeholder{color:#aaaaaa}verdocs-template-roles ::-moz-placeholder{color:#aaaaaa}verdocs-template-roles :-ms-input-placeholder{color:#aaaaaa}verdocs-template-roles ::-ms-input-placeholder{color:#aaaaaa}verdocs-template-roles ::placeholder{color:#aaaaaa}";
917
3582
  const VerdocsTemplateRolesStyle0 = verdocsTemplateRolesCss;
918
3583
 
919
- // const senderLabels: Record<TTemplateSender, string> = {
920
- // template_owner: 'Template Owner',
921
- // envelope_creator: 'Envelope Creator',
922
- // };
923
3584
  const settingsIcon = '<svg xmlns="http://www.w3.org/2000/svg" height="20" width="20" fill="#00000089"><path d="m8.021 17.917-.313-2.5q-.27-.125-.625-.334-.354-.208-.625-.395l-2.312.979-1.979-3.438 1.979-1.5q-.021-.167-.031-.364-.011-.198-.011-.365 0-.146.011-.344.01-.198.031-.385l-1.979-1.5 1.979-3.417 2.312.958q.271-.187.615-.385t.635-.344l.313-2.5h3.958l.313 2.5q.312.167.625.344.312.177.604.385l2.333-.958 1.979 3.417-1.979 1.521q.021.187.021.364V10q0 .146-.01.333-.011.188-.011.396l1.958 1.5-1.979 3.438-2.312-.979q-.292.208-.615.395-.323.188-.614.334l-.313 2.5Zm1.937-5.355q1.063 0 1.813-.75t.75-1.812q0-1.062-.75-1.812t-1.813-.75q-1.041 0-1.802.75-.76.75-.76 1.812t.76 1.812q.761.75 1.802.75Zm0-1.333q-.5 0-.864-.364-.365-.365-.365-.865t.365-.865q.364-.364.864-.364t.865.364q.365.365.365.865t-.365.865q-.365.364-.865.364ZM10.021 10Zm-.854 6.583h1.666l.25-2.187q.605-.167 1.136-.49.531-.323 1.031-.802l2.021.875.854-1.375-1.792-1.354q.105-.333.136-.635.031-.303.031-.615 0-.292-.031-.573-.031-.281-.115-.635l1.792-1.396-.834-1.375-2.062.875q-.438-.438-1.021-.781-.583-.344-1.125-.49l-.271-2.208H9.167l-.271 2.208q-.584.146-1.125.458-.542.313-1.042.792l-2.021-.854-.833 1.375 1.75 1.354q-.083.333-.125.646-.042.312-.042.604t.042.594q.042.302.125.635l-1.75 1.375.833 1.375 2.021-.854q.479.458 1.021.771.542.312 1.146.479Z"/></svg>';
924
- const startIcon = '<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" fill="#00000089"><path d="M2 12C2 6.48 6.48 2 12 2s10 4.48 10 10-4.48 10-10 10S2 17.52 2 12zm10 6c3.31 0 6-2.69 6-6s-2.69-6-6-6-6 2.69-6 6 2.69 6 6 6z"></path></svg>';
925
- const stepIcon = '<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" fill="#00000089"><path d="M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z"></path></svg>';
926
- const doneIcon = '<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" fill="#00000089"><path d="m18 7-1.41-1.41-6.34 6.34 1.41 1.41L18 7zm4.24-1.41L11.66 16.17 7.48 12l-1.41 1.41L11.66 19l12-12-1.42-1.41zM.41 13.41 6 19l1.41-1.41L1.83 12 .41 13.41z"></path></svg>';
927
3585
  const plusIcon = `<svg xmlns="http://www.w3.org/2000/svg" fill="#ffffff" viewBox="0 0 24 24" strokeWidth={1.5} stroke="currentColor"><path strokeLinecap="round" strokeLinejoin="round" d="M12 9v6m3-3H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z" /></svg>`;
928
3586
  const iconSigner = '<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path d="m9.225 21.225 4.65-4.65h8.45v4.65Zm-5.35-2.2H5.05l8.5-8.5-1.175-1.175-8.5 8.5Zm14.25-9.95L13.8 4.8l1.325-1.325q.625-.65 1.525-.663.9-.012 1.6.663l1.225 1.175q.675.675.663 1.562-.013.888-.663 1.513ZM16.7 10.55 6 21.225H1.675V16.9L12.35 6.225Zm-3.725-.625-.6-.575 1.175 1.175Z"/></svg>';
929
- const iconApprover = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path fill-rule="evenodd" d="M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12zm13.36-1.814a.75.75 0 10-1.22-.872l-3.236 4.53L9.53 12.22a.75.75 0 00-1.06 1.06l2.25 2.25a.75.75 0 001.14-.094l3.75-5.25z" clip-rule="evenodd" /></svg>`;
930
- const iconCC = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M1.5 8.67v8.58a3 3 0 003 3h15a3 3 0 003-3V8.67l-8.928 5.493a3 3 0 01-3.144 0L1.5 8.67z" /><path d="M22.5 6.908V6.75a3 3 0 00-3-3h-15a3 3 0 00-3 3v.158l9.714 5.978a1.5 1.5 0 001.572 0L22.5 6.908z" /></svg>`;
3587
+ const iconApprover = `<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill-rule="evenodd" d="M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12zm13.36-1.814a.75.75 0 10-1.22-.872l-3.236 4.53L9.53 12.22a.75.75 0 00-1.06 1.06l2.25 2.25a.75.75 0 001.14-.094l3.75-5.25z" clip-rule="evenodd" /></svg>`;
3588
+ const iconCC = `<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path d="M1.5 8.67v8.58a3 3 0 003 3h15a3 3 0 003-3V8.67l-8.928 5.493a3 3 0 01-3.144 0L1.5 8.67z" /><path d="M22.5 6.908V6.75a3 3 0 00-3-3h-15a3 3 0 00-3 3v.158l9.714 5.978a1.5 1.5 0 001.572 0L22.5 6.908z" /></svg>`;
931
3589
  const VerdocsTemplateRoles = class {
932
3590
  constructor(hostRef) {
933
- index.registerInstance(this, hostRef);
934
- this.next = index.createEvent(this, "next", 7);
935
- this.exit = index.createEvent(this, "exit", 7);
936
- this.sdkError = index.createEvent(this, "sdkError", 7);
937
- this.rolesUpdated = index.createEvent(this, "rolesUpdated", 7);
3591
+ index$1.registerInstance(this, hostRef);
3592
+ this.next = index$1.createEvent(this, "next", 7);
3593
+ this.exit = index$1.createEvent(this, "exit", 7);
3594
+ this.sdkError = index$1.createEvent(this, "sdkError", 7);
3595
+ this.rolesUpdated = index$1.createEvent(this, "rolesUpdated", 7);
938
3596
  this.templateListenerId = null;
939
3597
  this.endpoint = jsSdk.VerdocsEndpoint.getDefault();
940
3598
  this.templateId = '';
941
3599
  this.showingRoleDialog = null;
942
3600
  this.sender = null;
3601
+ this.dragging = false;
943
3602
  this.loading = true;
944
3603
  this.template = null;
945
3604
  }
@@ -950,7 +3609,7 @@ const VerdocsTemplateRoles = class {
950
3609
  console.log('[ROLES] Loading template', this.templateId);
951
3610
  this.unlistenToTemplate();
952
3611
  Datastore.Store.subscribe('templates', this.templateId, () => jsSdk.getTemplate(this.endpoint, this.templateId), false, (template) => {
953
- console.log('[BUILD] Template Updated', template);
3612
+ console.log('[ROLES] Template Updated', template);
954
3613
  this.template = template;
955
3614
  this.loading = false;
956
3615
  });
@@ -981,60 +3640,73 @@ const VerdocsTemplateRoles = class {
981
3640
  }
982
3641
  }
983
3642
  componentDidRender() {
984
- interact_min.interact.dynamicDrop(true);
985
- interact_min.interact('.recipient').draggable({
986
- listeners: {
987
- start: function handleStart(e) {
988
- e.target.classList.add('dragging');
989
- this.el.classList.add('dragging');
990
- }.bind(this),
991
- move: function handleMove(e) {
992
- const oldX = +(e.target.getAttribute('dX') || 0);
993
- const oldY = +(e.target.getAttribute('dY') || 0);
994
- const sequence = +(e.target.dataset['sequence'] || 0);
995
- const order = +(e.target.dataset['order'] || 0);
996
- const newX = e.dx + oldX;
997
- const newY = e.dy + oldY;
998
- e.target.setAttribute('dX', newX);
999
- e.target.setAttribute('dY', newY);
1000
- const rect = e.target.getBoundingClientRect();
1001
- // Note: I never did figure out exactly why this is, but if we don't offset the transform
1002
- // the dragged item is offset from the mouse cursor quite a bit.
1003
- console.log('w', rect.width);
1004
- e.target.style.transform = `translate(${newX + rect.width - (order + 1)}px, ${newY - rect.height * sequence}px)`;
1005
- }.bind(this),
1006
- end: function handleEnd(e) {
1007
- e.target.classList.remove('dragging');
1008
- this.el.classList.remove('dragging');
1009
- // console.log('end', event);
1010
- e.target.removeAttribute('dX');
1011
- e.target.removeAttribute('dY');
1012
- e.target.style.transform = null;
1013
- }.bind(this),
1014
- },
3643
+ // Existing sequence numbers
3644
+ const sequenceNumbers = this.getSequenceNumbers();
3645
+ (sequenceNumbers || []).forEach(sequence => {
3646
+ const el = document.getElementById(`verdocs-roles-sequence-${sequence}`);
3647
+ if (el) {
3648
+ new Sortable(el, {
3649
+ group: 'roles',
3650
+ animation: 150,
3651
+ dragoverBubble: true,
3652
+ filter: '.no-drag',
3653
+ onEnd: this.handleMoveEnd.bind(this),
3654
+ onChoose: () => (this.dragging = true),
3655
+ onUnchoose: () => (this.dragging = false),
3656
+ });
3657
+ }
1015
3658
  });
1016
- interact_min.interact('.dropzone').dropzone({
1017
- overlap: 0.05,
1018
- ondrop: async function onDrop(event) {
1019
- var _a;
1020
- event.target.classList.remove('active');
1021
- // This will re-sort the roles and renumbers them via server calls if necessary
1022
- await this.renumberTemplateRoles();
1023
- console.log('[ROLES] Updated roles', this.getSortedRoles());
1024
- (_a = this.rolesUpdated) === null || _a === void 0 ? void 0 : _a.emit({ event: 'updated', endpoint: this.endpoint, templateId: this.templateId, roles: this.getSortedRoles() });
1025
- }.bind(this),
1026
- ondropactivate: e => {
1027
- e.target.classList.add('visible');
1028
- },
1029
- ondropdeactivate: e => {
1030
- e.target.classList.remove('visible');
1031
- },
1032
- ondragenter: e => {
1033
- e.target.classList.add('active');
1034
- },
1035
- ondragleave: e => {
1036
- e.target.classList.remove('active');
1037
- },
3659
+ const el = document.getElementById(`verdocs-roles-sequence-${sequenceNumbers.length + 1}`);
3660
+ if (el) {
3661
+ new Sortable(el, {
3662
+ group: 'roles',
3663
+ animation: 150,
3664
+ dragoverBubble: true,
3665
+ filter: '.no-drag',
3666
+ onEnd: this.handleMoveEnd.bind(this),
3667
+ onChoose: () => (this.dragging = true),
3668
+ onUnchoose: () => (this.dragging = false),
3669
+ });
3670
+ }
3671
+ }
3672
+ handleMoveEnd(evt) {
3673
+ const fromSeq = +evt.from.id.split('-').pop();
3674
+ const toSeq = +evt.to.id.split('-').pop();
3675
+ const fromIndex = +evt.oldIndex + 1;
3676
+ const toIndex = +evt.newIndex + 1;
3677
+ // console.log(`Move from ${fromSeq}:${fromIndex} to ${toSeq}:${toIndex}`, evt.item);
3678
+ const sortableRoles = {};
3679
+ const sequenceNumbers = this.getSequenceNumbers();
3680
+ sequenceNumbers.forEach(sequence => {
3681
+ sortableRoles[sequence] = JSON.parse(JSON.stringify(this.getRolesAtSequence(sequence)));
3682
+ });
3683
+ // We might be adding a new sequence number now. Make sure we have an array to drop
3684
+ // the record into.
3685
+ sortableRoles[sequenceNumbers.length + 1] = [];
3686
+ const role = sortableRoles[fromSeq].splice(fromIndex - 1, 1)[0];
3687
+ sortableRoles[toSeq].splice(toIndex - 1, 0, role);
3688
+ const renumberRequests = [];
3689
+ Object.entries(sortableRoles).forEach(([targetSeq, roles]) => {
3690
+ roles.forEach((role, index) => {
3691
+ console.log('Evaluating role', role.name, role.sequence, role.order);
3692
+ const targetOrder = +index + 1;
3693
+ if (role.sequence !== +targetSeq || role.order !== targetOrder) {
3694
+ role.sequence = +targetSeq;
3695
+ role.order = targetOrder;
3696
+ renumberRequests.push(jsSdk.updateTemplateRole(this.endpoint, this.templateId, role.name, { sequence: +targetSeq, order: targetOrder })
3697
+ .then(r => console.log('[ROLES] Updated role', role.name, r))
3698
+ .catch(e => console.log('[ROLES] Error updating role', e)));
3699
+ }
3700
+ });
3701
+ });
3702
+ // When renumbering, we don't try to update the store for every individual item
3703
+ // changing. We just do it once at the end.
3704
+ console.log(`[ROLES] Awaiting ${renumberRequests.length} renumber requests`, renumberRequests);
3705
+ return Promise.all(renumberRequests).then(async () => {
3706
+ const newTemplate = JSON.parse(JSON.stringify(this.template));
3707
+ newTemplate.roles = Object.keys(sortableRoles).reduce((acc, seq) => acc.concat(sortableRoles[seq]), []);
3708
+ await Datastore.Store.getTemplate(this.endpoint, this.templateId, true);
3709
+ // Store.updateTemplate(this.templateId, newTemplate);
1038
3710
  });
1039
3711
  }
1040
3712
  handleCancel() {
@@ -1054,13 +3726,11 @@ const VerdocsTemplateRoles = class {
1054
3726
  });
1055
3727
  }
1056
3728
  getSequenceNumbers() {
1057
- const sequences = [];
1058
- this.getSortedRoles().forEach(role => {
1059
- if (!sequences.includes(role.sequence)) {
1060
- sequences.push(role.sequence);
1061
- }
1062
- });
1063
- return sequences.sort((a, b) => a - b);
3729
+ var _a;
3730
+ const sequenceNumbers = (((_a = this.template) === null || _a === void 0 ? void 0 : _a.roles) || []).map(role => role.sequence);
3731
+ const deduped = [...new Set(sequenceNumbers)];
3732
+ deduped.sort((a, b) => a - b);
3733
+ return deduped;
1064
3734
  }
1065
3735
  getRoleNames() {
1066
3736
  const roles = this.getSortedRoles();
@@ -1076,32 +3746,37 @@ const VerdocsTemplateRoles = class {
1076
3746
  // e.g. 1.5 to place it between items 1 and 2, 0.5 to place it at the beginning, or last+0.5 to place it at the end.
1077
3747
  // Then we re-sort the list of roles and renumber them.
1078
3748
  async renumberTemplateRoles() {
1079
- // console.log('Renumbering roles', this.getSequenceNumbers(), JSON.stringify(this.roleStore.state));
1080
- // Avoid dupe renumber attempts
1081
- const renumbered = [];
1082
- // If the user dragged an entry from below a row to above it, we end up here like [1,0]. Make sure it's [0,1] for the next operation.
3749
+ var _a;
3750
+ const sortableRoles = {};
1083
3751
  const renumberRequests = [];
1084
- this.getSequenceNumbers().forEach((originalSequence, newSequenceIndex) => {
1085
- this.getRolesAtSequence(originalSequence).forEach((role, newOrderIndex) => {
1086
- if (!renumbered.includes(role.name)) {
1087
- if (role.sequence !== newSequenceIndex + 1 || role.order !== newOrderIndex + 1) {
1088
- role.sequence = newSequenceIndex + 1;
1089
- role.order = newOrderIndex + 1;
1090
- renumbered.push(role.name);
1091
- renumberRequests.push(jsSdk.updateTemplateRole(this.endpoint, this.templateId, role.name, { sequence: role.sequence, order: role.order }));
1092
- }
3752
+ const sequenceNumbers = this.getSequenceNumbers();
3753
+ console.log('Sorting sequences', sequenceNumbers);
3754
+ (sequenceNumbers || []).forEach(targetSeq => {
3755
+ (sortableRoles[targetSeq] || []).forEach((role, targetOrderMinusOne) => {
3756
+ const targetOrder = +targetOrderMinusOne + 1;
3757
+ if (role.sequence !== +targetSeq || role.order !== targetOrder) {
3758
+ console.log('[ROLES] Updating role', role.name, 'from', role.sequence, role.order, 'to', targetSeq, targetOrder);
3759
+ role.sequence = +targetSeq;
3760
+ role.order = targetOrder;
3761
+ renumberRequests.push(jsSdk.updateTemplateRole(this.endpoint, this.templateId, role.name, { sequence: +targetSeq, order: targetOrder })
3762
+ .then(r => console.log('[ROLES] Updated role', role.name, r))
3763
+ .catch(e => console.log('[ROLES] Error updating role', e)));
1093
3764
  }
1094
3765
  });
1095
3766
  });
1096
- if (renumberRequests.length > 0) {
1097
- console.log(`[ROLES] Submitting ${renumberRequests.length} renumber requests`);
1098
- return Promise.all(renumberRequests).then(async () => {
1099
- // When renumbering, we don't try to update the store for every individual item
1100
- // changing. We just do it once at the end.
1101
- this.template = await Datastore.Store.getTemplate(this.endpoint, this.templateId, true);
1102
- });
1103
- }
1104
- return true;
3767
+ console.log('Sortable Roles', sortableRoles);
3768
+ console.log(`[ROLES] Awaiting ${renumberRequests.length} renumber requests`);
3769
+ await Promise.all(renumberRequests).then(async () => {
3770
+ // When renumbering, we don't try to update the store for every individual item
3771
+ // changing. We just do it once at the end.
3772
+ const newTemplate = JSON.parse(JSON.stringify(this.template));
3773
+ newTemplate.roles = Object.keys(sortableRoles).reduce((acc, seq) => acc.concat(sortableRoles[seq]), []);
3774
+ console.log('[ROLES] Done renumbering', newTemplate.roles.map(r => ({ name: r.name, sequence: r.sequence, order: r.order })));
3775
+ Datastore.Store.updateTemplate(this.templateId, newTemplate);
3776
+ // TODO: Explore race condition in reordering roles
3777
+ // this.template = await Store.getTemplate(this.endpoint, this.templateId, true);
3778
+ });
3779
+ (_a = this.rolesUpdated) === null || _a === void 0 ? void 0 : _a.emit({ event: 'updated', endpoint: this.endpoint, templateId: this.templateId, roles: this.getSortedRoles() });
1105
3780
  }
1106
3781
  // Look for name conflicts, because they're UGC and can be anything, regardless of order.
1107
3782
  getNextRoleName() {
@@ -1161,17 +3836,22 @@ const VerdocsTemplateRoles = class {
1161
3836
  }
1162
3837
  render() {
1163
3838
  if (!this.endpoint.session) {
1164
- return (index.h(index.Host, null, index.h("verdocs-component-error", { message: "You must be authenticated to use this module." })));
3839
+ return (index$1.h(index$1.Host, null, index$1.h("verdocs-component-error", { message: "You must be authenticated to use this module." })));
1165
3840
  }
1166
3841
  if (this.loading || !this.template) {
1167
- return (index.h(index.Host, { class: "loading" }, index.h("verdocs-loader", null)));
3842
+ return (index$1.h(index$1.Host, { class: "loading" }, index$1.h("verdocs-loader", null)));
1168
3843
  }
3844
+ console.log('[ROLES] Rendering', this.template.roles.map(r => ({ name: r.name, sequence: r.sequence, order: r.order })));
1169
3845
  const roleNames = this.getRoleNames();
1170
3846
  const sequences = this.getSequenceNumbers();
1171
- return (index.h(index.Host, null, index.h("form", { onSubmit: e => e.preventDefault(), onClick: e => e.stopPropagation(), autocomplete: "off" }, index.h("h5", null, "Roles and Workflow"), index.h("div", { class: "participants" }, index.h("div", { class: "left-line" }), index.h("div", { class: "row" }, index.h("div", { class: "icon", innerHTML: startIcon }), index.h("div", { class: "row-roles" }, index.h("div", { class: "sender" }, index.h("span", { class: "label" }, "Send Envelope")))), index.h("div", { class: "row add-sequence", "data-sequence": 0 }, index.h("div", { class: "icon", innerHTML: plusIcon }), index.h("div", { class: "row-roles" }, index.h("div", { class: "dropzone", "data-sequence": 0, "data-order": 1 }, "Add Step"))), sequences.map(sequence => (index.h(index.Fragment, null, index.h("div", { class: "row" }, index.h("div", { class: "icon", innerHTML: stepIcon }), index.h("div", { class: "row-roles" }, index.h("div", { class: "dropzone", "data-order": 0.5, "data-sequence": sequence }), this.getRolesAtSequence(sequence).map(role => {
3847
+ console.log('Rendering sequences', sequences, roleNames);
3848
+ // style={{backgroundColor: getRGBA(getRoleIndex(this.template, role.name))}}
3849
+ return (index$1.h(index$1.Host, { class: { dragging: this.dragging } }, index$1.h("form", { onSubmit: e => e.preventDefault(), onClick: e => e.stopPropagation(), autocomplete: "off" }, index$1.h("h5", null, "Roles and Workflow"), index$1.h("div", { class: "roles" }, sequences.map(sequence => (index$1.h("div", { class: "sequence" }, index$1.h("div", { class: "sequence-label no-drag" }, sequence, "."), index$1.h("div", { class: "sequence-roles", id: `verdocs-roles-sequence-${sequence}`, "data-sequence": sequence }, this.getRolesAtSequence(sequence).map(role => {
1172
3850
  const unknown = !role.email;
1173
- return unknown ? (index.h(index.Fragment, null, index.h("div", { class: "recipient", style: { backgroundColor: jsSdk.getRGBA(getRoleIndex(this.template, role.name)) }, "data-rolename": role.name, "data-sequence": sequence, "data-order": role.order }, index.h("span", { class: "type-icon", innerHTML: role.type === 'signer' ? iconSigner : role.type === 'cc' ? iconCC : iconApprover }), role.name, " ", index.h("div", { class: "settings-button", innerHTML: settingsIcon, onClick: () => (this.showingRoleDialog = role.name), "aria-role": "button" })), index.h("div", { class: "dropzone", "data-order": role.order + 0.5, "data-sequence": sequence }))) : (index.h(index.Fragment, null, index.h("div", { class: "recipient", style: { borderColor: jsSdk.getRGBA(getRoleIndex(this.template, role.name)) }, "data-rolename": role.name, "data-sequence": sequence, "data-order": role.order }, index.h("span", { class: "type-icon", innerHTML: role.type === 'signer' ? iconSigner : role.type === 'cc' ? iconCC : iconApprover }), jsSdk.formatFullName(role), " ", index.h("div", { class: "settings-button", innerHTML: settingsIcon, onClick: () => (this.showingRoleDialog = role.name), "aria-role": "button" })), index.h("div", { class: "dropzone", "data-order": role.order + 0.5, "data-sequence": sequence })));
1174
- }), index.h("button", { class: "add-role", innerHTML: plusIcon, onClick: e => this.handleAddRole(e, sequence) }))), sequences.length > 0 && (index.h("div", { class: "row add-sequence", "data-sequence": sequence }, index.h("div", { class: "row-roles" }, index.h("div", { class: "icon", innerHTML: plusIcon }), index.h("div", { class: "dropzone", "data-sequence": sequence + 1, "data-order": 1 }, "Add Step"))))))), index.h("div", { class: "row", "data-sequence": sequences.length + 1 }, index.h("div", { class: "row-roles" }, index.h("div", { class: "icon", innerHTML: plusIcon }), index.h("button", { class: "add-step", innerHTML: plusIcon, onClick: e => this.handleAddStep(e, sequences.length + 1) }))), index.h("div", { class: "row" }, index.h("div", { class: "icon", innerHTML: doneIcon }), index.h("div", { class: "row-roles" }, index.h("div", { class: "complete" }, "Document Complete")))), roleNames.length < 1 && (index.h("div", { class: "empty" }, "You must add at least one Role before proceeding.", index.h("br", null), " Click the ", index.h("span", { innerHTML: plusIcon }), " Add button above to get started.")), index.h("div", { class: "buttons" }, index.h("div", { class: "flex-fill" }), index.h("verdocs-button", { variant: "outline", label: "Cancel", size: "small", onClick: () => this.handleCancel() }), index.h("verdocs-button", { label: "OK", size: "small", onClick: () => this.handleSubmit(), disabled: roleNames.length < 1 }))), this.showingRoleDialog && (index.h("verdocs-template-role-properties", { endpoint: this.endpoint, templateId: this.templateId, roleName: this.showingRoleDialog, onClose: () => {
3851
+ return unknown ? (index$1.h("div", { class: "role", "data-rolename": role.name, "data-sequence": sequence, "data-order": role.order }, index$1.h("div", { class: "role-name" }, role.name), index$1.h("div", { class: "icons" }, index$1.h("div", { class: "gear-button", innerHTML: settingsIcon, onClick: () => (this.showingRoleDialog = role.name), "aria-role": "button" }), index$1.h("span", { class: "type-icon", innerHTML: role.type === 'signer' ? iconSigner : role.type === 'cc' ? iconCC : iconApprover })))) : (index$1.h("div", { class: "role", "data-rolename": role.name, "data-sequence": sequence, "data-order": role.order }, index$1.h("div", { class: "role-name" }, jsSdk.formatFullName(role)), index$1.h("div", { class: "icons" }, index$1.h("div", { class: "gear-button", innerHTML: settingsIcon, onClick: () => (this.showingRoleDialog = role.name), "aria-role": "button" }), index$1.h("span", { class: "type-icon", innerHTML: role.type === 'signer' ? iconSigner : role.type === 'cc' ? iconCC : iconApprover }))));
3852
+ })), index$1.h("button", { class: "add-role no-drag", innerHTML: plusIcon, onClick: e => this.handleAddRole(e, sequence) })))), index$1.h("div", { class: "sequence add-sequence" }, index$1.h("div", { class: "sequence-label no-drag" }, sequences.length + 1, "."), index$1.h("div", { class: "sequence-roles", id: `verdocs-roles-sequence-${sequences.length + 1}`, "data-sequence": sequences.length + 1 }, index$1.h("div", { class: "role-name add-step-label" }, "Add Step.")), index$1.h("button", { class: "add-role no-drag", innerHTML: plusIcon, onClick: e => this.handleAddRole(e, sequences.length + 1) }))), roleNames.length < 1 && (index$1.h("div", { class: "empty" }, "You must add at least one Role before proceeding.", index$1.h("br", null), " Click the ", index$1.h("span", { innerHTML: plusIcon }), " Add button above to get started.")), index$1.h("div", { class: "buttons" }, index$1.h("div", { class: "flex-fill" }), index$1.h("verdocs-button", { variant: "outline", label: "Cancel", size: "small", onClick: () => this.handleCancel() }), index$1.h("verdocs-button", { label: "OK", size: "small", onClick: () => this.handleSubmit(), disabled: roleNames.length < 1 }))), this.showingRoleDialog && (index$1.h("verdocs-menu-panel", { onClose: () => (this.showingRoleDialog = null) }, index$1.h("verdocs-template-role-properties", { endpoint: this.endpoint, templateId: this.templateId, roleName: this.showingRoleDialog, onClose: () => {
3853
+ var _a;
3854
+ (_a = document.getElementById('verdocs-menu-panel-overlay')) === null || _a === void 0 ? void 0 : _a.remove();
1175
3855
  this.showingRoleDialog = null;
1176
3856
  }, onDelete: async () => {
1177
3857
  var _a;
@@ -1179,9 +3859,9 @@ const VerdocsTemplateRoles = class {
1179
3859
  // This will re-sort the roles and renumbers them via server calls if necessary
1180
3860
  await this.renumberTemplateRoles();
1181
3861
  (_a = this.rolesUpdated) === null || _a === void 0 ? void 0 : _a.emit({ event: 'deleted', endpoint: this.endpoint, templateId: this.templateId, roles: this.getSortedRoles() });
1182
- } }))));
3862
+ } })))));
1183
3863
  }
1184
- get el() { return index.getElement(this); }
3864
+ get el() { return index$1.getElement(this); }
1185
3865
  };
1186
3866
  VerdocsTemplateRoles.style = VerdocsTemplateRolesStyle0;
1187
3867