@verdocs/web-sdk 5.0.2 → 5.0.4

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