@verdocs/web-sdk 6.9.10 → 6.9.13

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 (272) hide show
  1. package/dist/cjs/verdocs-adopt-signature-dialog_7.cjs.entry.js +3 -3
  2. package/dist/cjs/verdocs-adopt-signature-dialog_7.cjs.entry.js.map +1 -1
  3. package/dist/cjs/verdocs-auth.cjs.entry.js +4 -0
  4. package/dist/cjs/verdocs-auth.cjs.entry.js.map +1 -1
  5. package/dist/cjs/verdocs-contact-picker.cjs.entry.js +121 -15
  6. package/dist/cjs/verdocs-contact-picker.cjs.entry.js.map +1 -1
  7. package/dist/cjs/verdocs-download-dialog_4.cjs.entry.js +9 -8
  8. package/dist/cjs/verdocs-download-dialog_4.cjs.entry.js.map +1 -1
  9. package/dist/cjs/verdocs-envelopes-list.cjs.entry.js +6 -6
  10. package/dist/cjs/verdocs-field-attachment_11.cjs.entry.js +1 -1
  11. package/dist/cjs/verdocs-initial-dialog.cjs.entry.js +1 -1
  12. package/dist/cjs/verdocs-menu-panel_2.cjs.entry.js +7 -7
  13. package/dist/cjs/verdocs-ok-dialog.cjs.entry.js +1 -1
  14. package/dist/cjs/verdocs-preview_6.cjs.entry.js +4 -0
  15. package/dist/cjs/verdocs-preview_6.cjs.entry.js.map +1 -1
  16. package/dist/cjs/verdocs-quick-functions.cjs.entry.js +1 -1
  17. package/dist/cjs/verdocs-search-tabs.cjs.entry.js +1 -1
  18. package/dist/cjs/verdocs-sign.cjs.entry.js +7 -3
  19. package/dist/cjs/verdocs-sign.cjs.entry.js.map +1 -1
  20. package/dist/cjs/verdocs-signature-dialog.cjs.entry.js +1 -1
  21. package/dist/cjs/verdocs-status-indicator.cjs.entry.js +2 -2
  22. package/dist/cjs/verdocs-template-card.cjs.entry.js +1 -1
  23. package/dist/cjs/verdocs-template-star.cjs.entry.js +1 -1
  24. package/dist/cjs/verdocs-template-tags.cjs.entry.js +1 -1
  25. package/dist/collection/components/dialogs/verdocs-download-dialog/verdocs-download-dialog.js +6 -5
  26. package/dist/collection/components/dialogs/verdocs-download-dialog/verdocs-download-dialog.js.map +1 -1
  27. package/dist/collection/components/dialogs/verdocs-initial-dialog/verdocs-initial-dialog.js +1 -1
  28. package/dist/collection/components/dialogs/verdocs-ok-dialog/verdocs-ok-dialog.js +1 -1
  29. package/dist/collection/components/dialogs/verdocs-otp-dialog/verdocs-otp-dialog.js +1 -1
  30. package/dist/collection/components/dialogs/verdocs-passcode-dialog/verdocs-passcode-dialog.js +1 -1
  31. package/dist/collection/components/dialogs/verdocs-question-dialog/verdocs-question-dialog.js +1 -1
  32. package/dist/collection/components/dialogs/verdocs-signature-dialog/verdocs-signature-dialog.js +1 -1
  33. package/dist/collection/components/dialogs/verdocs-upload-dialog/verdocs-upload-dialog.js +1 -1
  34. package/dist/collection/components/elements/verdocs-quick-functions/verdocs-quick-functions.js +1 -1
  35. package/dist/collection/components/elements/verdocs-search-tabs/verdocs-search-tabs.js +1 -1
  36. package/dist/collection/components/embeds/verdocs-auth/verdocs-auth.js +4 -0
  37. package/dist/collection/components/embeds/verdocs-auth/verdocs-auth.js.map +1 -1
  38. package/dist/collection/components/embeds/verdocs-send/verdocs-send.js +4 -0
  39. package/dist/collection/components/embeds/verdocs-send/verdocs-send.js.map +1 -1
  40. package/dist/collection/components/embeds/verdocs-sign/verdocs-sign.js +7 -3
  41. package/dist/collection/components/embeds/verdocs-sign/verdocs-sign.js.map +1 -1
  42. package/dist/collection/components/embeds/verdocs-view/verdocs-view.js +1 -1
  43. package/dist/collection/components/embeds/verdocs-view/verdocs-view.js.map +1 -1
  44. package/dist/collection/components/envelopes/verdocs-envelope-document-page/verdocs-envelope-document-page.js +1 -1
  45. package/dist/collection/components/envelopes/verdocs-envelopes-list/verdocs-envelopes-list.js +6 -6
  46. package/dist/collection/components/envelopes/verdocs-sign-footer/verdocs-sign-footer.js +1 -1
  47. package/dist/collection/components/envelopes/verdocs-status-indicator/verdocs-status-indicator.js +2 -2
  48. package/dist/collection/components/templates/verdocs-template-card/verdocs-template-card.js +1 -1
  49. package/dist/collection/components/templates/verdocs-template-role-properties/verdocs-template-role-properties.js +7 -7
  50. package/dist/collection/components/templates/verdocs-template-star/verdocs-template-star.js +1 -1
  51. package/dist/collection/components/templates/verdocs-template-tags/verdocs-template-tags.js +1 -1
  52. package/dist/components/{p-BxOEoXie.js → p-BIc5CIpg.js} +2 -2
  53. package/dist/components/{p-DjOTs59Z.js → p-BcQsqsDy.js} +2 -2
  54. package/dist/components/{p-Dtndevf4.js → p-BfKv6ivN.js} +2 -2
  55. package/dist/components/{p-Ce29XBfJ.js → p-Bkae9I4G.js} +2 -2
  56. package/dist/components/{p-Ce29XBfJ.js.map → p-Bkae9I4G.js.map} +1 -1
  57. package/dist/components/{p-D3qUITiS.js → p-BwUTiBud.js} +2 -2
  58. package/dist/components/{p-BVhOFpVZ.js → p-C8r3qDBh.js} +2 -2
  59. package/dist/components/p-C8r3qDBh.js.map +1 -0
  60. package/dist/components/{p-DsEO0-XR.js → p-CGWVITS0.js} +2 -2
  61. package/dist/components/{p-BvtSJusb.js → p-CGt7KiUu.js} +2 -2
  62. package/dist/components/{p-u16vefxk.js → p-CQUV5gMT.js} +2 -2
  63. package/dist/components/{p-Dmw-lE3L.js → p-CSIVZcVx.js} +2 -2
  64. package/dist/components/{p-C-V6jrel.js → p-DClinO5r.js} +2 -2
  65. package/dist/components/{p-D_8TNtkM.js → p-DGws2Zgt.js} +2 -2
  66. package/dist/components/p-DGws2Zgt.js.map +1 -0
  67. package/dist/components/{p-DVGumEtx.js → p-DRgoGiAA.js} +2 -2
  68. package/dist/components/{p-BT8wzCXz.js → p-DSK9z7EN.js} +2 -2
  69. package/dist/components/{p-tub_01MP.js → p-DXbBz25U.js} +2 -2
  70. package/dist/components/p-DeQsR41s.js +3 -0
  71. package/dist/components/p-DeQsR41s.js.map +1 -0
  72. package/dist/components/{p-DIOVejyL.js → p-DyhyfLyV.js} +2 -2
  73. package/dist/components/{p-Yxa93LOl.js → p-db6IAGB0.js} +2 -2
  74. package/dist/components/{p-CDMCVJys.js → p-qDQgyl7L.js} +2 -2
  75. package/dist/components/{p-CFEw4Xbi.js → p-sPseFic3.js} +2 -2
  76. package/dist/components/verdocs-auth.js +1 -1
  77. package/dist/components/verdocs-auth.js.map +1 -1
  78. package/dist/components/verdocs-build.js +1 -1
  79. package/dist/components/verdocs-contact-picker.js +1 -1
  80. package/dist/components/verdocs-download-dialog.js +1 -1
  81. package/dist/components/verdocs-envelope-document-page.js +1 -1
  82. package/dist/components/verdocs-envelope-sidebar.js +1 -1
  83. package/dist/components/verdocs-envelopes-list.js +1 -1
  84. package/dist/components/verdocs-field-attachment.js +1 -1
  85. package/dist/components/verdocs-initial-dialog.js +1 -1
  86. package/dist/components/verdocs-ok-dialog.js +1 -1
  87. package/dist/components/verdocs-otp-dialog.js +1 -1
  88. package/dist/components/verdocs-passcode-dialog.js +1 -1
  89. package/dist/components/verdocs-preview.js +1 -1
  90. package/dist/components/verdocs-question-dialog.js +1 -1
  91. package/dist/components/verdocs-quick-functions.js +1 -1
  92. package/dist/components/verdocs-search-tabs.js +1 -1
  93. package/dist/components/verdocs-send.js +1 -1
  94. package/dist/components/verdocs-sign-footer.js +1 -1
  95. package/dist/components/verdocs-sign.js +1 -1
  96. package/dist/components/verdocs-sign.js.map +1 -1
  97. package/dist/components/verdocs-signature-dialog.js +1 -1
  98. package/dist/components/verdocs-status-indicator.js +1 -1
  99. package/dist/components/verdocs-template-attachments.js +1 -1
  100. package/dist/components/verdocs-template-card.js +1 -1
  101. package/dist/components/verdocs-template-document-page.js +1 -1
  102. package/dist/components/verdocs-template-fields.js +1 -1
  103. package/dist/components/verdocs-template-role-properties.js +1 -1
  104. package/dist/components/verdocs-template-roles.js +1 -1
  105. package/dist/components/verdocs-template-star.js +1 -1
  106. package/dist/components/verdocs-template-tags.js +1 -1
  107. package/dist/components/verdocs-templates-list.js +1 -1
  108. package/dist/components/verdocs-upload-dialog.js +1 -1
  109. package/dist/components/verdocs-view.js +1 -1
  110. package/dist/esm/verdocs-adopt-signature-dialog_7.entry.js +3 -3
  111. package/dist/esm/verdocs-adopt-signature-dialog_7.entry.js.map +1 -1
  112. package/dist/esm/verdocs-auth.entry.js +4 -0
  113. package/dist/esm/verdocs-auth.entry.js.map +1 -1
  114. package/dist/esm/verdocs-contact-picker.entry.js +121 -15
  115. package/dist/esm/verdocs-contact-picker.entry.js.map +1 -1
  116. package/dist/esm/verdocs-download-dialog_4.entry.js +9 -8
  117. package/dist/esm/verdocs-download-dialog_4.entry.js.map +1 -1
  118. package/dist/esm/verdocs-envelopes-list.entry.js +6 -6
  119. package/dist/esm/verdocs-field-attachment_11.entry.js +1 -1
  120. package/dist/esm/verdocs-initial-dialog.entry.js +1 -1
  121. package/dist/esm/verdocs-menu-panel_2.entry.js +7 -7
  122. package/dist/esm/verdocs-ok-dialog.entry.js +1 -1
  123. package/dist/esm/verdocs-preview_6.entry.js +4 -0
  124. package/dist/esm/verdocs-preview_6.entry.js.map +1 -1
  125. package/dist/esm/verdocs-quick-functions.entry.js +1 -1
  126. package/dist/esm/verdocs-search-tabs.entry.js +1 -1
  127. package/dist/esm/verdocs-sign.entry.js +7 -3
  128. package/dist/esm/verdocs-sign.entry.js.map +1 -1
  129. package/dist/esm/verdocs-signature-dialog.entry.js +1 -1
  130. package/dist/esm/verdocs-status-indicator.entry.js +2 -2
  131. package/dist/esm/verdocs-template-card.entry.js +1 -1
  132. package/dist/esm/verdocs-template-star.entry.js +1 -1
  133. package/dist/esm/verdocs-template-tags.entry.js +1 -1
  134. package/dist/esm-es5/verdocs-adopt-signature-dialog_7.entry.js +1 -1
  135. package/dist/esm-es5/verdocs-adopt-signature-dialog_7.entry.js.map +1 -1
  136. package/dist/esm-es5/verdocs-auth.entry.js +1 -1
  137. package/dist/esm-es5/verdocs-auth.entry.js.map +1 -1
  138. package/dist/esm-es5/verdocs-contact-picker.entry.js +2 -2
  139. package/dist/esm-es5/verdocs-contact-picker.entry.js.map +1 -1
  140. package/dist/esm-es5/verdocs-download-dialog_4.entry.js +1 -1
  141. package/dist/esm-es5/verdocs-download-dialog_4.entry.js.map +1 -1
  142. package/dist/esm-es5/verdocs-envelopes-list.entry.js +1 -1
  143. package/dist/esm-es5/verdocs-field-attachment_11.entry.js +1 -1
  144. package/dist/esm-es5/verdocs-initial-dialog.entry.js +1 -1
  145. package/dist/esm-es5/verdocs-menu-panel_2.entry.js +1 -1
  146. package/dist/esm-es5/verdocs-ok-dialog.entry.js +1 -1
  147. package/dist/esm-es5/verdocs-preview_6.entry.js +1 -1
  148. package/dist/esm-es5/verdocs-preview_6.entry.js.map +1 -1
  149. package/dist/esm-es5/verdocs-quick-functions.entry.js +1 -1
  150. package/dist/esm-es5/verdocs-search-tabs.entry.js +1 -1
  151. package/dist/esm-es5/verdocs-sign.entry.js +1 -1
  152. package/dist/esm-es5/verdocs-sign.entry.js.map +1 -1
  153. package/dist/esm-es5/verdocs-signature-dialog.entry.js +1 -1
  154. package/dist/esm-es5/verdocs-status-indicator.entry.js +1 -1
  155. package/dist/esm-es5/verdocs-template-card.entry.js +1 -1
  156. package/dist/esm-es5/verdocs-template-star.entry.js +1 -1
  157. package/dist/esm-es5/verdocs-template-tags.entry.js +1 -1
  158. package/dist/verdocs-web-sdk/{p-2f96e7c9.system.entry.js → p-0625e073.system.entry.js} +2 -2
  159. package/dist/verdocs-web-sdk/{p-40f5ecf3.system.entry.js → p-07a07c6b.system.entry.js} +2 -2
  160. package/dist/verdocs-web-sdk/p-15a1b8b5.system.entry.js +2 -0
  161. package/dist/verdocs-web-sdk/p-15a1b8b5.system.entry.js.map +1 -0
  162. package/dist/verdocs-web-sdk/{p-6abf8f8f.entry.js → p-1f898c53.entry.js} +2 -2
  163. package/dist/verdocs-web-sdk/{p-6abf8f8f.entry.js.map → p-1f898c53.entry.js.map} +1 -1
  164. package/dist/verdocs-web-sdk/p-2fa4010a.system.entry.js +2 -0
  165. package/dist/verdocs-web-sdk/p-2fa4010a.system.entry.js.map +1 -0
  166. package/dist/verdocs-web-sdk/{p-4798c2a5.system.entry.js → p-36aa8081.system.entry.js} +2 -2
  167. package/dist/verdocs-web-sdk/p-3a542ed0.system.entry.js +4 -0
  168. package/dist/verdocs-web-sdk/p-3a542ed0.system.entry.js.map +1 -0
  169. package/dist/verdocs-web-sdk/{p-c5b70927.system.entry.js → p-3c9a2290.system.entry.js} +2 -2
  170. package/dist/verdocs-web-sdk/p-48e2baa9.entry.js +2 -0
  171. package/dist/verdocs-web-sdk/p-48e2baa9.entry.js.map +1 -0
  172. package/dist/verdocs-web-sdk/{p-d09a4bb9.entry.js → p-4934f908.entry.js} +2 -2
  173. package/dist/verdocs-web-sdk/{p-6754dfcf.system.entry.js → p-4d8bf603.system.entry.js} +2 -2
  174. package/dist/verdocs-web-sdk/p-4fe507ee.entry.js +2 -0
  175. package/dist/verdocs-web-sdk/{p-810e09ca.entry.js → p-5678acd8.entry.js} +2 -2
  176. package/dist/verdocs-web-sdk/{p-cfb275c5.entry.js → p-609527c7.entry.js} +2 -2
  177. package/dist/verdocs-web-sdk/{p-1f1fc6d7.entry.js → p-82d0e009.entry.js} +2 -2
  178. package/dist/verdocs-web-sdk/p-90400330.entry.js +2 -0
  179. package/dist/verdocs-web-sdk/{p-d4f72da9.entry.js → p-98adcb3a.entry.js} +2 -2
  180. package/dist/verdocs-web-sdk/{p-ed953cca.entry.js → p-996cc1f6.entry.js} +2 -2
  181. package/dist/verdocs-web-sdk/p-BdZ5Ghsa.system.js +1 -1
  182. package/dist/verdocs-web-sdk/p-ae4290c6.entry.js +3 -0
  183. package/dist/verdocs-web-sdk/p-ae4290c6.entry.js.map +1 -0
  184. package/dist/verdocs-web-sdk/{p-9756028f.entry.js → p-ae92881f.entry.js} +2 -2
  185. package/dist/verdocs-web-sdk/p-ae92881f.entry.js.map +1 -0
  186. package/dist/verdocs-web-sdk/{p-04d2fa80.system.entry.js → p-b1146326.system.entry.js} +2 -2
  187. package/dist/verdocs-web-sdk/{p-1929a794.system.entry.js → p-b2aa0637.system.entry.js} +2 -2
  188. package/dist/verdocs-web-sdk/{p-64034b55.system.entry.js → p-b35a1ea8.system.entry.js} +2 -2
  189. package/dist/verdocs-web-sdk/{p-64034b55.system.entry.js.map → p-b35a1ea8.system.entry.js.map} +1 -1
  190. package/dist/verdocs-web-sdk/{p-1827477d.system.entry.js → p-b6390a11.system.entry.js} +2 -2
  191. package/dist/verdocs-web-sdk/p-b81c87ee.system.entry.js +2 -0
  192. package/dist/verdocs-web-sdk/p-b81c87ee.system.entry.js.map +1 -0
  193. package/dist/verdocs-web-sdk/{p-d3d177d0.system.entry.js → p-ba39a8ce.system.entry.js} +2 -2
  194. package/dist/verdocs-web-sdk/{p-495ed75e.system.entry.js → p-bd17bff7.system.entry.js} +2 -2
  195. package/dist/verdocs-web-sdk/{p-e632e92c.entry.js → p-c2b70cb9.entry.js} +2 -2
  196. package/dist/verdocs-web-sdk/{p-ca03555a.system.entry.js → p-c3660cce.system.entry.js} +2 -2
  197. package/dist/verdocs-web-sdk/{p-421c231a.entry.js → p-cbfc895c.entry.js} +2 -2
  198. package/dist/verdocs-web-sdk/{p-f85f8560.system.entry.js → p-d5cfbdac.system.entry.js} +2 -2
  199. package/dist/verdocs-web-sdk/p-d5cfbdac.system.entry.js.map +1 -0
  200. package/dist/verdocs-web-sdk/{p-842c345c.entry.js → p-e207c469.entry.js} +2 -2
  201. package/dist/verdocs-web-sdk/p-e679a32a.entry.js +2 -0
  202. package/dist/verdocs-web-sdk/p-e679a32a.entry.js.map +1 -0
  203. package/dist/verdocs-web-sdk/{p-d3b798ae.system.entry.js → p-e991121e.system.entry.js} +2 -2
  204. package/dist/verdocs-web-sdk/p-ed5c3f2d.entry.js +2 -0
  205. package/dist/verdocs-web-sdk/p-ed5c3f2d.entry.js.map +1 -0
  206. package/dist/verdocs-web-sdk/{p-f97ca49e.entry.js → p-fff5d042.entry.js} +2 -2
  207. package/dist/verdocs-web-sdk/verdocs-web-sdk.esm.js +1 -1
  208. package/package.json +2 -2
  209. package/dist/components/p-BVhOFpVZ.js.map +0 -1
  210. package/dist/components/p-CT0DHyPw.js +0 -3
  211. package/dist/components/p-CT0DHyPw.js.map +0 -1
  212. package/dist/components/p-D_8TNtkM.js.map +0 -1
  213. package/dist/verdocs-web-sdk/p-0240a6e1.system.entry.js +0 -2
  214. package/dist/verdocs-web-sdk/p-0240a6e1.system.entry.js.map +0 -1
  215. package/dist/verdocs-web-sdk/p-12676649.entry.js +0 -2
  216. package/dist/verdocs-web-sdk/p-12676649.entry.js.map +0 -1
  217. package/dist/verdocs-web-sdk/p-1a6869c9.system.entry.js +0 -2
  218. package/dist/verdocs-web-sdk/p-1a6869c9.system.entry.js.map +0 -1
  219. package/dist/verdocs-web-sdk/p-1e8f1ce4.system.entry.js +0 -4
  220. package/dist/verdocs-web-sdk/p-1e8f1ce4.system.entry.js.map +0 -1
  221. package/dist/verdocs-web-sdk/p-3f5ad836.system.entry.js +0 -2
  222. package/dist/verdocs-web-sdk/p-3f5ad836.system.entry.js.map +0 -1
  223. package/dist/verdocs-web-sdk/p-62b6402f.entry.js +0 -2
  224. package/dist/verdocs-web-sdk/p-682c5a5c.entry.js +0 -2
  225. package/dist/verdocs-web-sdk/p-9756028f.entry.js.map +0 -1
  226. package/dist/verdocs-web-sdk/p-9c6cca6e.entry.js +0 -2
  227. package/dist/verdocs-web-sdk/p-9c6cca6e.entry.js.map +0 -1
  228. package/dist/verdocs-web-sdk/p-b464b598.entry.js +0 -3
  229. package/dist/verdocs-web-sdk/p-b464b598.entry.js.map +0 -1
  230. package/dist/verdocs-web-sdk/p-c89d74b2.entry.js +0 -2
  231. package/dist/verdocs-web-sdk/p-c89d74b2.entry.js.map +0 -1
  232. package/dist/verdocs-web-sdk/p-f85f8560.system.entry.js.map +0 -1
  233. /package/dist/components/{p-BxOEoXie.js.map → p-BIc5CIpg.js.map} +0 -0
  234. /package/dist/components/{p-DjOTs59Z.js.map → p-BcQsqsDy.js.map} +0 -0
  235. /package/dist/components/{p-Dtndevf4.js.map → p-BfKv6ivN.js.map} +0 -0
  236. /package/dist/components/{p-D3qUITiS.js.map → p-BwUTiBud.js.map} +0 -0
  237. /package/dist/components/{p-DsEO0-XR.js.map → p-CGWVITS0.js.map} +0 -0
  238. /package/dist/components/{p-BvtSJusb.js.map → p-CGt7KiUu.js.map} +0 -0
  239. /package/dist/components/{p-u16vefxk.js.map → p-CQUV5gMT.js.map} +0 -0
  240. /package/dist/components/{p-Dmw-lE3L.js.map → p-CSIVZcVx.js.map} +0 -0
  241. /package/dist/components/{p-C-V6jrel.js.map → p-DClinO5r.js.map} +0 -0
  242. /package/dist/components/{p-DVGumEtx.js.map → p-DRgoGiAA.js.map} +0 -0
  243. /package/dist/components/{p-BT8wzCXz.js.map → p-DSK9z7EN.js.map} +0 -0
  244. /package/dist/components/{p-tub_01MP.js.map → p-DXbBz25U.js.map} +0 -0
  245. /package/dist/components/{p-DIOVejyL.js.map → p-DyhyfLyV.js.map} +0 -0
  246. /package/dist/components/{p-Yxa93LOl.js.map → p-db6IAGB0.js.map} +0 -0
  247. /package/dist/components/{p-CDMCVJys.js.map → p-qDQgyl7L.js.map} +0 -0
  248. /package/dist/components/{p-CFEw4Xbi.js.map → p-sPseFic3.js.map} +0 -0
  249. /package/dist/verdocs-web-sdk/{p-2f96e7c9.system.entry.js.map → p-0625e073.system.entry.js.map} +0 -0
  250. /package/dist/verdocs-web-sdk/{p-40f5ecf3.system.entry.js.map → p-07a07c6b.system.entry.js.map} +0 -0
  251. /package/dist/verdocs-web-sdk/{p-4798c2a5.system.entry.js.map → p-36aa8081.system.entry.js.map} +0 -0
  252. /package/dist/verdocs-web-sdk/{p-c5b70927.system.entry.js.map → p-3c9a2290.system.entry.js.map} +0 -0
  253. /package/dist/verdocs-web-sdk/{p-d09a4bb9.entry.js.map → p-4934f908.entry.js.map} +0 -0
  254. /package/dist/verdocs-web-sdk/{p-6754dfcf.system.entry.js.map → p-4d8bf603.system.entry.js.map} +0 -0
  255. /package/dist/verdocs-web-sdk/{p-62b6402f.entry.js.map → p-4fe507ee.entry.js.map} +0 -0
  256. /package/dist/verdocs-web-sdk/{p-810e09ca.entry.js.map → p-5678acd8.entry.js.map} +0 -0
  257. /package/dist/verdocs-web-sdk/{p-cfb275c5.entry.js.map → p-609527c7.entry.js.map} +0 -0
  258. /package/dist/verdocs-web-sdk/{p-1f1fc6d7.entry.js.map → p-82d0e009.entry.js.map} +0 -0
  259. /package/dist/verdocs-web-sdk/{p-682c5a5c.entry.js.map → p-90400330.entry.js.map} +0 -0
  260. /package/dist/verdocs-web-sdk/{p-d4f72da9.entry.js.map → p-98adcb3a.entry.js.map} +0 -0
  261. /package/dist/verdocs-web-sdk/{p-ed953cca.entry.js.map → p-996cc1f6.entry.js.map} +0 -0
  262. /package/dist/verdocs-web-sdk/{p-04d2fa80.system.entry.js.map → p-b1146326.system.entry.js.map} +0 -0
  263. /package/dist/verdocs-web-sdk/{p-1929a794.system.entry.js.map → p-b2aa0637.system.entry.js.map} +0 -0
  264. /package/dist/verdocs-web-sdk/{p-1827477d.system.entry.js.map → p-b6390a11.system.entry.js.map} +0 -0
  265. /package/dist/verdocs-web-sdk/{p-d3d177d0.system.entry.js.map → p-ba39a8ce.system.entry.js.map} +0 -0
  266. /package/dist/verdocs-web-sdk/{p-495ed75e.system.entry.js.map → p-bd17bff7.system.entry.js.map} +0 -0
  267. /package/dist/verdocs-web-sdk/{p-e632e92c.entry.js.map → p-c2b70cb9.entry.js.map} +0 -0
  268. /package/dist/verdocs-web-sdk/{p-ca03555a.system.entry.js.map → p-c3660cce.system.entry.js.map} +0 -0
  269. /package/dist/verdocs-web-sdk/{p-421c231a.entry.js.map → p-cbfc895c.entry.js.map} +0 -0
  270. /package/dist/verdocs-web-sdk/{p-842c345c.entry.js.map → p-e207c469.entry.js.map} +0 -0
  271. /package/dist/verdocs-web-sdk/{p-d3b798ae.system.entry.js.map → p-e991121e.system.entry.js.map} +0 -0
  272. /package/dist/verdocs-web-sdk/{p-f97ca49e.entry.js.map → p-fff5d042.entry.js.map} +0 -0
@@ -1,2 +1,2 @@
1
- var __awaiter=this&&this.__awaiter||function(e,t,i,o){function r(e){return e instanceof i?e:new i((function(t){t(e)}))}return new(i||(i=Promise))((function(i,s){function n(e){try{l(o.next(e))}catch(e){s(e)}}function a(e){try{l(o["throw"](e))}catch(e){s(e)}}function l(e){e.done?i(e.value):r(e.value).then(n,a)}l((o=o.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var i={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},o,r,s,n=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return n.next=a(0),n["throw"]=a(1),n["return"]=a(2),typeof Symbol==="function"&&(n[Symbol.iterator]=function(){return this}),n;function a(e){return function(t){return l([e,t])}}function l(a){if(o)throw new TypeError("Generator is already executing.");while(n&&(n=0,a[0]&&(i=0)),i)try{if(o=1,r&&(s=a[0]&2?r["return"]:a[0]?r["throw"]||((s=r["return"])&&s.call(r),0):r.next)&&!(s=s.call(r,a[1])).done)return s;if(r=0,s)a=[a[0]&2,s.value];switch(a[0]){case 0:case 1:s=a;break;case 4:i.label++;return{value:a[1],done:false};case 5:i.label++;r=a[1];a=[0];continue;case 7:a=i.ops.pop();i.trys.pop();continue;default:if(!(s=i.trys,s=s.length>0&&s[s.length-1])&&(a[0]===6||a[0]===2)){i=0;continue}if(a[0]===3&&(!s||a[1]>s[0]&&a[1]<s[3])){i.label=a[1];break}if(a[0]===6&&i.label<s[1]){i.label=s[1];s=a;break}if(s&&i.label<s[2]){i.label=s[2];i.ops.push(a);break}if(s[2])i.ops.pop();i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e];r=0}finally{o=s=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};import{r as registerInstance,c as createEvent,h,H as Host}from"./index-CjTHbolG.js";import{VerdocsEndpoint,getTemplate,updateTemplateRole,deleteTemplateRole,isValidEmail}from"@verdocs/js-sdk";import{S as SDKError}from"./errors-C1sRVZWv.js";import{S as Store}from"./Datastore-C7hFgM52.js";var verdocsMenuPanelCss=function(){return'#verdocs-menu-panel-overlay{top:0;left:0;width:100%;height:100%;z-index:10000;position:fixed;background-color:rgba(0, 0, 0, 0.4980392157)}#verdocs-menu-panel{opacity:0;z-index:10001;position:fixed;overflow-y:scroll;background-color:#ffffff;font-family:var(--verdocs-primary-font, "Inter", "Barlow", sans-serif);-webkit-animation:showVerdocsMenuPanel 0.35s;-webkit-animation-fill-mode:forwards}@-webkit-keyframes showVerdocsMenuPanel{0%{opacity:0;right:-300px}100%{right:0;opacity:1}}'};var VerdocsMenuPanel=function(){function e(e){registerInstance(this,e);this.close=createEvent(this,"close");this.moved=false;this.overlayId="verdocs-menu-panel-overlay";this.panelId="verdocs-menu-panel";this.side="right";this.overlay=true;this.width=300}e.prototype.handleClick=function(e){var t;if(!this.element.contains(e.target)){this.hide();(t=this.close)===null||t===void 0?void 0:t.emit()}};e.prototype.componentWillLoad=function(){this.hide();if(this.overlay){this.portal=document.createElement("div");this.portal.setAttribute("id",this.overlayId);document.body.append(this.portal)}this.portal=document.createElement("div");this.portal.setAttribute("id",this.panelId);this.portal.style.top="0px";this.portal.style.bottom="0px";this.portal.style.width="".concat(this.width,"px");if(this.side==="left"){this.portal.style.left="0px"}else{this.portal.style.right="0px"}document.body.append(this.portal)};e.prototype.componentDidLoad=function(){this.portal.appendChild(this.element)};e.prototype.disconnectedCallback=function(){this.moved?this.portal.remove():this.moved=true};e.prototype.hide=function(){var e,t;(e=document.getElementById(this.overlayId))===null||e===void 0?void 0:e.remove();(t=document.getElementById(this.panelId))===null||t===void 0?void 0:t.remove()};e.prototype.render=function(){var e=this;return h(Host,{key:"1fa35d0ed0bedab19924d8a0f1ee11c36ea518e3",ref:function(t){return e.element=t}},h("slot",{key:"280b09045cb04c9c2e595ab8a71536a18c746418"}))};return e}();VerdocsMenuPanel.style=verdocsMenuPanelCss();var verdocsTemplateRolePropertiesCss=function(){return'verdocs-template-role-properties{-webkit-box-sizing:border-box;box-sizing:border-box;font-family:"Inter", "Barlow", sans-serif}verdocs-template-role-properties div{-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-template-role-properties .heading{display:-ms-flexbox;display:flex;font-size:20px;font-weight:500;-ms-flex-direction:row;flex-direction:row}verdocs-template-role-properties .buttons{display:-ms-flexbox;display:flex;margin-top:10px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:justify;justify-content:space-between}verdocs-template-role-properties .buttons verdocs-button{margin-left:16px}verdocs-template-role-properties form{gap:15px;padding:20px;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}verdocs-template-role-properties form .instructions{margin:7px 0 0 0;font-size:12px;font-style:italic}verdocs-template-role-properties form .input-label{display:block;font-size:14px;-ms-flex:0 0 100px;flex:0 0 100px;font-weight:700;margin:0 0 4px 0;color:#555570}verdocs-template-role-properties form .first-last{gap:15px;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row}verdocs-template-role-properties form verdocs-help-icon{-webkit-transform:scale(0.8);transform:scale(0.8)}verdocs-template-role-properties verdocs-select-input label{display:block}verdocs-template-role-properties verdocs-text-input{margin:0}verdocs-template-role-properties verdocs-text-input label{display:block}verdocs-template-role-properties verdocs-text-input .input-label{-ms-flex:0 0 100px;flex:0 0 100px}verdocs-template-role-properties verdocs-text-input input{-ms-flex:1;flex:1;display:-ms-flexbox;display:flex}verdocs-template-role-properties verdocs-text-input verdocs-text-input{margin:0}verdocs-template-role-properties .checkbox-wrapper{-ms-flex:1;flex:1;display:-ms-flexbox;display:flex}verdocs-template-role-properties .delete-button{height:34px;display:-ms-flexbox;display:flex;padding:0 6px;cursor:pointer;background:none;border-radius:4px;-ms-flex-align:center;align-items:center;border:1px solid #999;-ms-flex-pack:center;justify-content:center}verdocs-template-role-properties .delete-button svg{width:24px;height:24px}verdocs-template-role-properties .delete-button:active{background:#f3f3f3}'};var TrashIcon='<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="#a50021"><path stroke-linecap="round" stroke-linejoin="round" d="M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 00-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 00-7.5 0" /></svg>';var VerdocsTemplateRoleProperties=function(){function e(e){registerInstance(this,e);this.close=createEvent(this,"close");this.delete=createEvent(this,"delete");this.sdkError=createEvent(this,"sdkError");this.templateListenerId=null;this.endpoint=VerdocsEndpoint.getDefault();this.templateId="";this.roleName="";this.dirty=false;this.saving=false;this.name="";this.type="signer";this.first_name="";this.last_name="";this.email="";this.phone="";this.delegator=false;this.loading=true;this.template=null}e.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,i;return __generator(this,(function(o){try{this.endpoint.loadSession();if(!this.templateId){console.log("[ROLES] Missing required template ID ".concat(this.templateId));return[2]}if(!this.endpoint.session){console.log("[ROLES] Unable to start builder session, must be authenticated");return[2]}this.listenToTemplate()}catch(o){console.log("[ROLES Error with preview session",o);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new SDKError(o.message,(t=o.response)===null||t===void 0?void 0:t.status,(i=o.response)===null||i===void 0?void 0:i.data))}return[2]}))}))};e.prototype.disconnectedCallback=function(){this.unlistenToTemplate()};e.prototype.listenToTemplate=function(){return __awaiter(this,void 0,void 0,(function(){var e=this;return __generator(this,(function(t){console.log("[ROLES] Loading tempate",this.templateId);this.unlistenToTemplate();Store.subscribe("templates",this.templateId,(function(){return getTemplate(e.endpoint,e.templateId)}),false,(function(t){var i;console.log("[BUILD] Template Updated",t);e.template=t;e.loading=false;var o=(i=e.template)===null||i===void 0?void 0:i.roles.find((function(t){return t.name===e.roleName}));if(o){e.name=o.name;e.type=o.type;e.first_name=o.first_name;e.last_name=o.last_name;e.email=o.email;e.phone=o.phone;e.delegator=o.delegator;console.log("[ROLES] Editing role",o)}}));return[2]}))}))};e.prototype.unlistenToTemplate=function(){if(this.templateListenerId){Store.store.delListener(this.templateListenerId);this.templateListenerId=null}};e.prototype.handleCancel=function(e){var t=this;var i,o;e.stopPropagation();var r=(i=this.template)===null||i===void 0?void 0:i.roles.find((function(e){return e.name===t.roleName}));if(r){this.name=r.name;this.type=r.type;this.first_name=r.first_name;this.last_name=r.last_name;this.email=r.email;this.phone=r.phone;this.delegator=r.delegator}this.dirty=false;(o=this.close)===null||o===void 0?void 0:o.emit()};e.prototype.handleSave=function(e){return __awaiter(this,void 0,void 0,(function(){var t=this;return __generator(this,(function(i){e.stopPropagation();this.saving=true;updateTemplateRole(this.endpoint,this.templateId,this.roleName,{name:this.name,type:this.type,first_name:this.first_name,last_name:this.last_name,email:this.email,phone:this.phone,delegator:this.delegator}).then((function(e){return __awaiter(t,void 0,void 0,(function(){var t,i,o;var r=this;return __generator(this,(function(s){console.log("[ROLES] Update result",e);this.saving=false;this.dirty=false;i=JSON.parse(JSON.stringify(this.template));o=i.roles.findIndex((function(e){return e.name===r.roleName}));if(o>-1){i.roles[o]=e}Store.updateTemplate(this.templateId,i);(t=this.close)===null||t===void 0?void 0:t.emit();return[2]}))}))})).catch((function(e){console.log("[ROLES Update error",e);t.saving=false}));return[2]}))}))};e.prototype.handleDelete=function(e){return __awaiter(this,void 0,void 0,(function(){var t=this;return __generator(this,(function(i){e.stopPropagation();if(window.confirm("Are you sure you wish to remove this role? All associated fields will be removed as well. This action cannot be undone.")){deleteTemplateRole(this.endpoint,this.templateId,this.roleName).then((function(){var e,i;var o=JSON.parse(JSON.stringify(t.template));o.roles=o.roles.filter((function(e){return e.name!==t.roleName}));Store.getTemplate(t.endpoint,t.templateId,true);(e=t.delete)===null||e===void 0?void 0:e.emit({templateId:t.templateId,roleName:t.roleName});(i=t.close)===null||i===void 0?void 0:i.emit()})).catch((function(e){console.log("[ROLES Deletion error",e)}))}return[2]}))}))};e.prototype.render=function(){var e=this;var t;var i=(((t=this.template)===null||t===void 0?void 0:t.fields)||[]).some((function(t){return t.role_name===e.roleName}));var o=!this.email&&!this.first_name&&!this.last_name||isValidEmail(this.email)&&!!this.first_name&&!!this.last_name;return h(Host,{key:"ffbdcf7c23ed14bf001bf85dd969fee3e4018abf"},h("form",{key:"10ee145cbd8b2d1035cbafe86a88c5e4e93b211f",onSubmit:function(e){return e.preventDefault()},onClick:function(e){return e.stopPropagation()},autocomplete:"off"},h("div",{key:"476268ed74137b49dc4a22159e7df0991e9644a8"},h("verdocs-text-input",{key:"dfacfb292a4bc93422f1d28166a8853d30736a71",id:"verdocs-role-name",label:"Role Name (Must be unique)",value:this.name,autocomplete:"off",disabled:i,placeholder:"Role Name...",onInput:function(t){e.name=t.target.value;e.dirty=true}}),i&&h("div",{key:"bcc8c63bb93ce9b81dd9b8282db9b8cd28f764b6",class:"instructions"},"This role has fields assigned and can no longer be renamed.")),h("div",{key:"edd762e1f0b0c50bb9752da44195a8fd37ad46b8"},h("div",{key:"f7cbb564016a693ed8d59da0e3b06d3f2e3013a3",class:"input-label"},"Type:"),h("verdocs-select-input",{key:"eca486e7960b077234e5a8867f972511c4a429b6",value:this.type,options:[{label:"Signer",value:"signer"},{label:"CC",value:"cc"},{label:"Approver",value:"approver"}],onInput:function(t){e.type=t.target.value;e.dirty=true}})),h("div",{key:"d45d4354a061453e85e993be8e6b57da104c0ad5"},h("div",{key:"7b1afb527741ca786eb546bec5071078d1504433",class:"input-label"},"Default Contact Info:"),h("div",{key:"6de4c8b89c7b11ea5f8ae89ff69212472375e4ac",class:"first-last"},h("verdocs-text-input",{key:"8a591cc37cf7d9c2e5a211640a36a876a794590f",id:"verdocs-recipient-first",value:this.first_name,autocomplete:"off",placeholder:"First...",onInput:function(t){e.first_name=t.target.value;e.dirty=true}}),h("verdocs-text-input",{key:"de8ee6a8802ff5443f93d1a017609bbabb745f13",id:"verdocs-recipient-first",value:this.last_name,autocomplete:"off",placeholder:"Last...",onInput:function(t){e.last_name=t.target.value;e.dirty=true}}))),h("div",{key:"1a7ac3d8fab0e28d031d4bafe892fadc1ab76ac4"},h("verdocs-text-input",{key:"e11e543134ad024362e4f39f026c132e90c4ad9a",id:"verdocs-recipient-email",value:this.email,autocomplete:"off",placeholder:"Email Address...",onInput:function(t){e.email=t.target.value;e.dirty=true}}),h("div",{key:"04a394d1e1f9d377da12ea565119a0d5cd68a627",style:{height:"15px"}}),h("div",{key:"1ff2ead2361795d3ec3e6361715d30e779fae4b8"},h("verdocs-text-input",{key:"3c0d4de18bb9fd6da3ba02d70a66dfcd2306af7f",id:"verdocs-recipient-phone",value:this.phone,autocomplete:"off",placeholder:"Phone Number...",onInput:function(t){e.phone=t.target.value;e.dirty=true}}))),h("div",{key:"a6c73356acbe10339d53f24a956205b914f386aa",class:"buttons"},h("button",{key:"034614017ee9e5b0acdafa1a2950c3cd44328517",class:"delete-button",disabled:this.dirty,onClick:function(t){return e.handleDelete(t)},innerHTML:TrashIcon}),h("div",{key:"5febc5c4fbbe44afbe1f6a1fe23586efdd5bf3df",style:{flex:"1"}}),h("verdocs-button",{key:"895635dd85f706e87bc14dde3224894f11af9029",size:"small",label:"Save",disabled:!this.dirty||!o,onClick:function(t){return e.handleSave(t)}}))))};return e}();VerdocsTemplateRoleProperties.style=verdocsTemplateRolePropertiesCss();export{VerdocsMenuPanel as verdocs_menu_panel,VerdocsTemplateRoleProperties as verdocs_template_role_properties};
1
+ var __awaiter=this&&this.__awaiter||function(e,t,i,o){function r(e){return e instanceof i?e:new i((function(t){t(e)}))}return new(i||(i=Promise))((function(i,s){function n(e){try{l(o.next(e))}catch(e){s(e)}}function a(e){try{l(o["throw"](e))}catch(e){s(e)}}function l(e){e.done?i(e.value):r(e.value).then(n,a)}l((o=o.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var i={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},o,r,s,n=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return n.next=a(0),n["throw"]=a(1),n["return"]=a(2),typeof Symbol==="function"&&(n[Symbol.iterator]=function(){return this}),n;function a(e){return function(t){return l([e,t])}}function l(a){if(o)throw new TypeError("Generator is already executing.");while(n&&(n=0,a[0]&&(i=0)),i)try{if(o=1,r&&(s=a[0]&2?r["return"]:a[0]?r["throw"]||((s=r["return"])&&s.call(r),0):r.next)&&!(s=s.call(r,a[1])).done)return s;if(r=0,s)a=[a[0]&2,s.value];switch(a[0]){case 0:case 1:s=a;break;case 4:i.label++;return{value:a[1],done:false};case 5:i.label++;r=a[1];a=[0];continue;case 7:a=i.ops.pop();i.trys.pop();continue;default:if(!(s=i.trys,s=s.length>0&&s[s.length-1])&&(a[0]===6||a[0]===2)){i=0;continue}if(a[0]===3&&(!s||a[1]>s[0]&&a[1]<s[3])){i.label=a[1];break}if(a[0]===6&&i.label<s[1]){i.label=s[1];s=a;break}if(s&&i.label<s[2]){i.label=s[2];i.ops.push(a);break}if(s[2])i.ops.pop();i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e];r=0}finally{o=s=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};import{r as registerInstance,c as createEvent,h,H as Host}from"./index-CjTHbolG.js";import{VerdocsEndpoint,getTemplate,updateTemplateRole,deleteTemplateRole,isValidEmail}from"@verdocs/js-sdk";import{S as SDKError}from"./errors-C1sRVZWv.js";import{S as Store}from"./Datastore-C7hFgM52.js";var verdocsMenuPanelCss=function(){return'#verdocs-menu-panel-overlay{top:0;left:0;width:100%;height:100%;z-index:10000;position:fixed;background-color:rgba(0, 0, 0, 0.4980392157)}#verdocs-menu-panel{opacity:0;z-index:10001;position:fixed;overflow-y:scroll;background-color:#ffffff;font-family:var(--verdocs-primary-font, "Inter", "Barlow", sans-serif);-webkit-animation:showVerdocsMenuPanel 0.35s;-webkit-animation-fill-mode:forwards}@-webkit-keyframes showVerdocsMenuPanel{0%{opacity:0;right:-300px}100%{right:0;opacity:1}}'};var VerdocsMenuPanel=function(){function e(e){registerInstance(this,e);this.close=createEvent(this,"close");this.moved=false;this.overlayId="verdocs-menu-panel-overlay";this.panelId="verdocs-menu-panel";this.side="right";this.overlay=true;this.width=300}e.prototype.handleClick=function(e){var t;if(!this.element.contains(e.target)){this.hide();(t=this.close)===null||t===void 0?void 0:t.emit()}};e.prototype.componentWillLoad=function(){this.hide();if(this.overlay){this.portal=document.createElement("div");this.portal.setAttribute("id",this.overlayId);document.body.append(this.portal)}this.portal=document.createElement("div");this.portal.setAttribute("id",this.panelId);this.portal.style.top="0px";this.portal.style.bottom="0px";this.portal.style.width="".concat(this.width,"px");if(this.side==="left"){this.portal.style.left="0px"}else{this.portal.style.right="0px"}document.body.append(this.portal)};e.prototype.componentDidLoad=function(){this.portal.appendChild(this.element)};e.prototype.disconnectedCallback=function(){this.moved?this.portal.remove():this.moved=true};e.prototype.hide=function(){var e,t;(e=document.getElementById(this.overlayId))===null||e===void 0?void 0:e.remove();(t=document.getElementById(this.panelId))===null||t===void 0?void 0:t.remove()};e.prototype.render=function(){var e=this;return h(Host,{key:"1fa35d0ed0bedab19924d8a0f1ee11c36ea518e3",ref:function(t){return e.element=t}},h("slot",{key:"280b09045cb04c9c2e595ab8a71536a18c746418"}))};return e}();VerdocsMenuPanel.style=verdocsMenuPanelCss();var verdocsTemplateRolePropertiesCss=function(){return'verdocs-template-role-properties{-webkit-box-sizing:border-box;box-sizing:border-box;font-family:"Inter", "Barlow", sans-serif}verdocs-template-role-properties div{-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-template-role-properties .heading{display:-ms-flexbox;display:flex;font-size:20px;font-weight:500;-ms-flex-direction:row;flex-direction:row}verdocs-template-role-properties .buttons{display:-ms-flexbox;display:flex;margin-top:10px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:justify;justify-content:space-between}verdocs-template-role-properties .buttons verdocs-button{margin-left:16px}verdocs-template-role-properties form{gap:15px;padding:20px;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}verdocs-template-role-properties form .instructions{margin:7px 0 0 0;font-size:12px;font-style:italic}verdocs-template-role-properties form .input-label{display:block;font-size:14px;-ms-flex:0 0 100px;flex:0 0 100px;font-weight:700;margin:0 0 4px 0;color:#555570}verdocs-template-role-properties form .first-last{gap:15px;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row}verdocs-template-role-properties form verdocs-help-icon{-webkit-transform:scale(0.8);transform:scale(0.8)}verdocs-template-role-properties verdocs-select-input label{display:block}verdocs-template-role-properties verdocs-text-input{margin:0}verdocs-template-role-properties verdocs-text-input label{display:block}verdocs-template-role-properties verdocs-text-input .input-label{-ms-flex:0 0 100px;flex:0 0 100px}verdocs-template-role-properties verdocs-text-input input{-ms-flex:1;flex:1;display:-ms-flexbox;display:flex}verdocs-template-role-properties verdocs-text-input verdocs-text-input{margin:0}verdocs-template-role-properties .checkbox-wrapper{-ms-flex:1;flex:1;display:-ms-flexbox;display:flex}verdocs-template-role-properties .delete-button{height:34px;display:-ms-flexbox;display:flex;padding:0 6px;cursor:pointer;background:none;border-radius:4px;-ms-flex-align:center;align-items:center;border:1px solid #999;-ms-flex-pack:center;justify-content:center}verdocs-template-role-properties .delete-button svg{width:24px;height:24px}verdocs-template-role-properties .delete-button:active{background:#f3f3f3}'};var TrashIcon='<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="#a50021"><path stroke-linecap="round" stroke-linejoin="round" d="M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 00-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 00-7.5 0" /></svg>';var VerdocsTemplateRoleProperties=function(){function e(e){registerInstance(this,e);this.close=createEvent(this,"close");this.delete=createEvent(this,"delete");this.sdkError=createEvent(this,"sdkError");this.templateListenerId=null;this.endpoint=VerdocsEndpoint.getDefault();this.templateId="";this.roleName="";this.dirty=false;this.saving=false;this.name="";this.type="signer";this.first_name="";this.last_name="";this.email="";this.phone="";this.delegator=false;this.loading=true;this.template=null}e.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,i;return __generator(this,(function(o){try{this.endpoint.loadSession();if(!this.templateId){console.log("[ROLES] Missing required template ID ".concat(this.templateId));return[2]}if(!this.endpoint.session){console.log("[ROLES] Unable to start builder session, must be authenticated");return[2]}this.listenToTemplate()}catch(o){console.log("[ROLES Error with preview session",o);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new SDKError(o.message,(t=o.response)===null||t===void 0?void 0:t.status,(i=o.response)===null||i===void 0?void 0:i.data))}return[2]}))}))};e.prototype.disconnectedCallback=function(){this.unlistenToTemplate()};e.prototype.listenToTemplate=function(){return __awaiter(this,void 0,void 0,(function(){var e=this;return __generator(this,(function(t){console.log("[ROLES] Loading tempate",this.templateId);this.unlistenToTemplate();Store.subscribe("templates",this.templateId,(function(){return getTemplate(e.endpoint,e.templateId)}),false,(function(t){var i;console.log("[BUILD] Template Updated",t);e.template=t;e.loading=false;var o=(i=e.template)===null||i===void 0?void 0:i.roles.find((function(t){return t.name===e.roleName}));if(o){e.name=o.name;e.type=o.type;e.first_name=o.first_name;e.last_name=o.last_name;e.email=o.email;e.phone=o.phone;e.delegator=o.delegator;console.log("[ROLES] Editing role",o)}}));return[2]}))}))};e.prototype.unlistenToTemplate=function(){if(this.templateListenerId){Store.store.delListener(this.templateListenerId);this.templateListenerId=null}};e.prototype.handleCancel=function(e){var t=this;var i,o;e.stopPropagation();var r=(i=this.template)===null||i===void 0?void 0:i.roles.find((function(e){return e.name===t.roleName}));if(r){this.name=r.name;this.type=r.type;this.first_name=r.first_name;this.last_name=r.last_name;this.email=r.email;this.phone=r.phone;this.delegator=r.delegator}this.dirty=false;(o=this.close)===null||o===void 0?void 0:o.emit()};e.prototype.handleSave=function(e){return __awaiter(this,void 0,void 0,(function(){var t=this;return __generator(this,(function(i){e.stopPropagation();this.saving=true;updateTemplateRole(this.endpoint,this.templateId,this.roleName,{name:this.name,type:this.type,first_name:this.first_name,last_name:this.last_name,email:this.email,phone:this.phone,delegator:this.delegator}).then((function(e){return __awaiter(t,void 0,void 0,(function(){var t,i,o;var r=this;return __generator(this,(function(s){console.log("[ROLES] Update result",e);this.saving=false;this.dirty=false;i=JSON.parse(JSON.stringify(this.template));o=i.roles.findIndex((function(e){return e.name===r.roleName}));if(o>-1){i.roles[o]=e}Store.updateTemplate(this.templateId,i);(t=this.close)===null||t===void 0?void 0:t.emit();return[2]}))}))})).catch((function(e){console.log("[ROLES Update error",e);t.saving=false}));return[2]}))}))};e.prototype.handleDelete=function(e){return __awaiter(this,void 0,void 0,(function(){var t=this;return __generator(this,(function(i){e.stopPropagation();if(window.confirm("Are you sure you wish to remove this role? All associated fields will be removed as well. This action cannot be undone.")){deleteTemplateRole(this.endpoint,this.templateId,this.roleName).then((function(){var e,i;var o=JSON.parse(JSON.stringify(t.template));o.roles=o.roles.filter((function(e){return e.name!==t.roleName}));Store.getTemplate(t.endpoint,t.templateId,true);(e=t.delete)===null||e===void 0?void 0:e.emit({templateId:t.templateId,roleName:t.roleName});(i=t.close)===null||i===void 0?void 0:i.emit()})).catch((function(e){console.log("[ROLES Deletion error",e)}))}return[2]}))}))};e.prototype.render=function(){var e=this;var t;var i=(((t=this.template)===null||t===void 0?void 0:t.fields)||[]).some((function(t){return t.role_name===e.roleName}));var o=!this.email&&!this.first_name&&!this.last_name||isValidEmail(this.email)&&!!this.first_name&&!!this.last_name;return h(Host,{key:"14d2d9bb4253201a9cb659c6637960194dc7d134"},h("form",{key:"09d0a10f48c8f4ca3f6b679d09c3c71ea0c0cdb9",onSubmit:function(e){return e.preventDefault()},onClick:function(e){return e.stopPropagation()},autocomplete:"off"},h("div",{key:"b65e74e82bb7689d706ba0e56521d04fe01ae057"},h("verdocs-text-input",{key:"c7e3da4d57b096f71a4c5e49948ee0a4e0594e0c",id:"verdocs-role-name",label:"Role Name (Must be unique)",value:this.name,autocomplete:"off",disabled:i,placeholder:"Role Name...",onInput:function(t){e.name=t.target.value;e.dirty=true}}),i&&h("div",{key:"9a80102f0a04118069c2865c9295e5da3914b381",class:"instructions"},"This role has fields assigned and can no longer be renamed.")),h("div",{key:"93ca24cfbc2b1f8e729c30a0726b14091695ba92"},h("div",{key:"0b5eeeab4aad7e1659581eb8c17e14012d79b5e6",class:"input-label"},"Type:"),h("verdocs-select-input",{key:"883b1456bad033a17023559a210f61efc17cb1ab",value:this.type,options:[{label:"Signer",value:"signer"},{label:"CC",value:"cc"},{label:"Approver",value:"approver"}],onInput:function(t){e.type=t.target.value;e.dirty=true}})),h("div",{key:"fec29a6add9ab2a60e4deb29ee77c851973e0517"},h("div",{key:"a18a7d1edfb673e382d76d04d833f3daf28ca26f",class:"input-label"},"Default Contact Info:"),h("div",{key:"1206cab495d52ab12428dbc346126df3a2aa9c1a",class:"first-last"},h("verdocs-text-input",{key:"aa4433e84dee223043c49235c8e9feb7569707e9",id:"verdocs-recipient-first",value:this.first_name,autocomplete:"off",placeholder:"First...",onInput:function(t){e.first_name=t.target.value;e.dirty=true}}),h("verdocs-text-input",{key:"b8c1069666a4674faff0c1b72bc988cf3ed3ca9b",id:"verdocs-recipient-first",value:this.last_name,autocomplete:"off",placeholder:"Last...",onInput:function(t){e.last_name=t.target.value;e.dirty=true}}))),h("div",{key:"5ea9ada6f0dac2a52b78946275603e2c99887666"},h("verdocs-text-input",{key:"767135ec9d13ae00e6c1d259a6d53fbf85caeedd",id:"verdocs-recipient-email",value:this.email,autocomplete:"off",placeholder:"Email Address...",onInput:function(t){e.email=t.target.value;e.dirty=true}}),h("div",{key:"0c4ffc5553a054ae331bcbf48a7b702d0fd5a81e",style:{height:"15px"}}),h("div",{key:"17815735c29adc551f65a7f29d1a791c9260edfc"},h("verdocs-text-input",{key:"0d41ae8e9cda72d881791df7d63f89f25d08da5e",id:"verdocs-recipient-phone",value:this.phone,autocomplete:"off",placeholder:"Phone Number...",onInput:function(t){e.phone=t.target.value;e.dirty=true}}))),h("div",{key:"be29c3c856e62cab357391146485230461e6c5c9",class:"buttons"},h("button",{key:"a714765b9f8f524a0c6573653b6ba6a59661b4d2",class:"delete-button",disabled:this.dirty,onClick:function(t){return e.handleDelete(t)},innerHTML:TrashIcon}),h("div",{key:"aae4bf7f4fa5fc685ace057a2312461a7cf993f3",style:{flex:"1"}}),h("verdocs-button",{key:"027aa0723fc32b4713e7a9cb33e6a1b7d4b5ab18",size:"small",label:"Save",disabled:!this.dirty||!o,onClick:function(t){return e.handleSave(t)}}))))};return e}();VerdocsTemplateRoleProperties.style=verdocsTemplateRolePropertiesCss();export{VerdocsMenuPanel as verdocs_menu_panel,VerdocsTemplateRoleProperties as verdocs_template_role_properties};
2
2
  //# sourceMappingURL=verdocs-menu-panel_2.entry.js.map
@@ -1,2 +1,2 @@
1
- import{r as registerInstance,c as createEvent,h}from"./index-CjTHbolG.js";var verdocsOkDialogCss=function(){return'verdocs-ok-dialog{-webkit-box-sizing:border-box;box-sizing:border-box;font-family:"Inter", "Barlow", sans-serif}verdocs-ok-dialog.closed{display:none}verdocs-ok-dialog .buttons{gap:12px;display:-ms-flexbox;display:flex;margin-top:0;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:end;justify-content:flex-end}verdocs-ok-dialog .buttons button{padding:8px 16px;height:40px;display:-ms-flexbox;display:flex;font-size:14px;font-weight:400;cursor:pointer;-ms-flex-align:center;align-items:center;border-radius:var(--verdocs-button-radius, 4px);-ms-flex-pack:center;justify-content:center;-webkit-transition:all 0.2s ease;transition:all 0.2s ease}verdocs-ok-dialog .buttons button.cancel{background-color:transparent;border:var(--verdocs-button-secondary-border, 1px solid #d1d5db);color:var(--verdocs-button-secondary-color, #374151)}verdocs-ok-dialog .buttons button.ok{background-color:var(--verdocs-primary-color, #55bc81);border:1px solid transparent;color:#ffffff}verdocs-ok-dialog .buttons button.ok:hover{background-color:var(--verdocs-primary-color-hover, #2b995b)}verdocs-ok-dialog .buttons button:disabled{background-color:var(--verdocs-button-disabled-bg, #e5e7eb);color:var(--verdocs-button-disabled-color, #9ca3af);cursor:not-allowed}'};var VerdocsOkDialog=function(){function e(e){registerInstance(this,e);this.next=createEvent(this,"next");this.exit=createEvent(this,"exit");this.heading="";this.message="";this.buttonLabel="OK";this.showCancel=false;this.closed=false}e.prototype.handleOk=function(){this.next.emit()};e.prototype.handleCancel=function(){this.exit.emit()};e.prototype.handleDismiss=function(e){this.closed=true;if(e.target.className==="background-overlay"){e.preventDefault();this.exit.emit()}};e.prototype.render=function(){var e=this;return h("verdocs-dialog",{key:"52d54a8b4aab2a5aea4d8d23d120c56e321f6a6a",onExit:function(o){return e.handleDismiss(o)}},h("div",{key:"d8f199c5b67778bb75c443b9ac479a874ef441a8",slot:"heading",class:"heading"},h("div",{key:"0c1d47e80319595dab3be44df92d35c187205a93",class:"icon"},h("svg",{key:"0a09d7fd4758db5083b4b08139f80ceffde3ea7e",width:"22",height:"19",viewBox:"0 0 22 19",fill:"none",xmlns:"http://www.w3.org/2000/svg"},h("g",{key:"edba4957787067d3776d8eeb563e9e30b231fddb","clip-path":"url(#clip0_34208_4881)"},h("path",{key:"5afcfa6fe4b39a553c210931b3cbea6a3d0d0cee",d:"M3.125 0.75C1.88398 0.75 0.875 1.75898 0.875 3V16.5C0.875 17.741 1.88398 18.75 3.125 18.75H12.125C13.366 18.75 14.375 17.741 14.375 16.5V15.8215C14.2801 15.8602 14.1852 15.8918 14.0867 15.9164L11.9738 16.4437C11.8684 16.4684 11.7629 16.4859 11.6574 16.493C11.6258 16.4965 11.5941 16.5 11.5625 16.5H9.3125C9.09805 16.5 8.90469 16.3805 8.80977 16.1906L8.50039 15.5684C8.44062 15.4488 8.32109 15.375 8.19102 15.375C8.06094 15.375 7.93789 15.4488 7.88164 15.5684L7.57227 16.1906C7.47031 16.398 7.24883 16.5211 7.02031 16.5C6.7918 16.4789 6.59492 16.3207 6.53164 16.1027L5.9375 14.1445L5.59297 15.2977C5.37852 16.0113 4.72109 16.5 3.97578 16.5H3.6875C3.37812 16.5 3.125 16.2469 3.125 15.9375C3.125 15.6281 3.37812 15.375 3.6875 15.375H3.97578C4.22539 15.375 4.44336 15.2133 4.51367 14.9742L5.0375 13.234C5.15703 12.8367 5.52266 12.5625 5.9375 12.5625C6.35234 12.5625 6.71797 12.8367 6.8375 13.234L7.24531 14.591C7.50547 14.373 7.83594 14.25 8.1875 14.25C8.74648 14.25 9.25625 14.5664 9.50586 15.0656L9.66055 15.375H9.97344C9.86445 15.0656 9.84336 14.7281 9.92422 14.3977L10.4516 12.2848C10.55 11.8875 10.7539 11.5289 11.0422 11.2406L14.375 7.90781V6.375H9.875C9.25273 6.375 8.75 5.87227 8.75 5.25V0.75H3.125ZM9.875 0.75V5.25H14.375L9.875 0.75ZM20.2039 5.66133C19.6555 5.11289 18.766 5.11289 18.2141 5.66133L17.1805 6.69492L19.6766 9.19102L20.7102 8.15742C21.2586 7.60898 21.2586 6.71953 20.7102 6.16758L20.2039 5.66133ZM11.8402 12.0352C11.6961 12.1793 11.5941 12.3586 11.5449 12.559L11.0176 14.6719C10.9684 14.8652 11.0246 15.0656 11.1652 15.2063C11.3059 15.3469 11.5062 15.4031 11.6996 15.3539L13.8125 14.8266C14.0094 14.7773 14.1922 14.6754 14.3363 14.5312L18.8785 9.98555L16.3824 7.48945L11.8402 12.0352Z",fill:"white"})),h("defs",{key:"c29cda7d2f7a162a77e30fa522e26475124044d8"},h("clipPath",{key:"b9ac256bf4e3066c8eeeb7978244ee402cf57bf9",id:"clip0_34208_4881"},h("path",{key:"8667df36852d878425aa718daad47314be8b7879",d:"M0.875 0.75H21.125V18.75H0.875V0.75Z",fill:"white"}))))),h("div",{key:"452081aa3d26f586ca33837ff2091cc75798b003",class:"title"}," ",this.heading)),h("div",{key:"d0e86791df8ef3f60896956c18308136890092f9",slot:"content",class:"content",innerHTML:this.message}),h("div",{key:"4de420a8d24123545b136725da294612bb2291bb",class:"footer",slot:"footer"},h("div",{key:"10667da2ea1b8660be353b50ff5cb131f73abaa4",class:"buttons"},this.showCancel&&h("button",{key:"b1404f986abc21aadf3214188741b08578cbf47c",class:"cancel",onClick:function(){return e.handleCancel()}},"Cancel"),h("button",{key:"bd9426471a8729eb4d1a8580badfed86850fbf0e",class:!this.showCancel?"ok single":"ok",onClick:function(){return e.handleOk()}},"OK"))))};return e}();VerdocsOkDialog.style=verdocsOkDialogCss();export{VerdocsOkDialog as verdocs_ok_dialog};
1
+ import{r as registerInstance,c as createEvent,h}from"./index-CjTHbolG.js";var verdocsOkDialogCss=function(){return'verdocs-ok-dialog{-webkit-box-sizing:border-box;box-sizing:border-box;font-family:"Inter", "Barlow", sans-serif}verdocs-ok-dialog.closed{display:none}verdocs-ok-dialog .buttons{gap:12px;display:-ms-flexbox;display:flex;margin-top:0;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:end;justify-content:flex-end}verdocs-ok-dialog .buttons button{padding:8px 16px;height:40px;display:-ms-flexbox;display:flex;font-size:14px;font-weight:400;cursor:pointer;-ms-flex-align:center;align-items:center;border-radius:var(--verdocs-button-radius, 4px);-ms-flex-pack:center;justify-content:center;-webkit-transition:all 0.2s ease;transition:all 0.2s ease}verdocs-ok-dialog .buttons button.cancel{background-color:transparent;border:var(--verdocs-button-secondary-border, 1px solid #d1d5db);color:var(--verdocs-button-secondary-color, #374151)}verdocs-ok-dialog .buttons button.ok{background-color:var(--verdocs-primary-color, #55bc81);border:1px solid transparent;color:#ffffff}verdocs-ok-dialog .buttons button.ok:hover{background-color:var(--verdocs-primary-color-hover, #2b995b)}verdocs-ok-dialog .buttons button:disabled{background-color:var(--verdocs-button-disabled-bg, #e5e7eb);color:var(--verdocs-button-disabled-color, #9ca3af);cursor:not-allowed}'};var VerdocsOkDialog=function(){function e(e){registerInstance(this,e);this.next=createEvent(this,"next");this.exit=createEvent(this,"exit");this.heading="";this.message="";this.buttonLabel="OK";this.showCancel=false;this.closed=false}e.prototype.handleOk=function(){this.next.emit()};e.prototype.handleCancel=function(){this.exit.emit()};e.prototype.handleDismiss=function(e){this.closed=true;if(e.target.className==="background-overlay"){e.preventDefault();this.exit.emit()}};e.prototype.render=function(){var e=this;return h("verdocs-dialog",{key:"71f5ccb53d253e815c7071919eb667adcba7cbf6",onExit:function(o){return e.handleDismiss(o)}},h("div",{key:"8a9818924124a1355b2fb9b5fa0c3db2d2e85f24",slot:"heading",class:"heading"},h("div",{key:"5fc6b98d0c1cd975c106616708721115bd54ee12",class:"icon"},h("svg",{key:"836f0a6c196c173f5de0839f69b073afb0ab1bae",width:"22",height:"19",viewBox:"0 0 22 19",fill:"none",xmlns:"http://www.w3.org/2000/svg"},h("g",{key:"8943629b994d18a59b077a785dcbe0958005f395","clip-path":"url(#clip0_34208_4881)"},h("path",{key:"657bc1542a8ed6a02830f63e51ad5a9e04a721a6",d:"M3.125 0.75C1.88398 0.75 0.875 1.75898 0.875 3V16.5C0.875 17.741 1.88398 18.75 3.125 18.75H12.125C13.366 18.75 14.375 17.741 14.375 16.5V15.8215C14.2801 15.8602 14.1852 15.8918 14.0867 15.9164L11.9738 16.4437C11.8684 16.4684 11.7629 16.4859 11.6574 16.493C11.6258 16.4965 11.5941 16.5 11.5625 16.5H9.3125C9.09805 16.5 8.90469 16.3805 8.80977 16.1906L8.50039 15.5684C8.44062 15.4488 8.32109 15.375 8.19102 15.375C8.06094 15.375 7.93789 15.4488 7.88164 15.5684L7.57227 16.1906C7.47031 16.398 7.24883 16.5211 7.02031 16.5C6.7918 16.4789 6.59492 16.3207 6.53164 16.1027L5.9375 14.1445L5.59297 15.2977C5.37852 16.0113 4.72109 16.5 3.97578 16.5H3.6875C3.37812 16.5 3.125 16.2469 3.125 15.9375C3.125 15.6281 3.37812 15.375 3.6875 15.375H3.97578C4.22539 15.375 4.44336 15.2133 4.51367 14.9742L5.0375 13.234C5.15703 12.8367 5.52266 12.5625 5.9375 12.5625C6.35234 12.5625 6.71797 12.8367 6.8375 13.234L7.24531 14.591C7.50547 14.373 7.83594 14.25 8.1875 14.25C8.74648 14.25 9.25625 14.5664 9.50586 15.0656L9.66055 15.375H9.97344C9.86445 15.0656 9.84336 14.7281 9.92422 14.3977L10.4516 12.2848C10.55 11.8875 10.7539 11.5289 11.0422 11.2406L14.375 7.90781V6.375H9.875C9.25273 6.375 8.75 5.87227 8.75 5.25V0.75H3.125ZM9.875 0.75V5.25H14.375L9.875 0.75ZM20.2039 5.66133C19.6555 5.11289 18.766 5.11289 18.2141 5.66133L17.1805 6.69492L19.6766 9.19102L20.7102 8.15742C21.2586 7.60898 21.2586 6.71953 20.7102 6.16758L20.2039 5.66133ZM11.8402 12.0352C11.6961 12.1793 11.5941 12.3586 11.5449 12.559L11.0176 14.6719C10.9684 14.8652 11.0246 15.0656 11.1652 15.2063C11.3059 15.3469 11.5062 15.4031 11.6996 15.3539L13.8125 14.8266C14.0094 14.7773 14.1922 14.6754 14.3363 14.5312L18.8785 9.98555L16.3824 7.48945L11.8402 12.0352Z",fill:"white"})),h("defs",{key:"8c89805faaf706a352a09cdb9e4366d3b2c697b3"},h("clipPath",{key:"e76eabac419a70b4fc8be4973f70509712b2ba12",id:"clip0_34208_4881"},h("path",{key:"7820f18f95934053693bc282d451e40bbdbac518",d:"M0.875 0.75H21.125V18.75H0.875V0.75Z",fill:"white"}))))),h("div",{key:"79e11a044511904b7c07c655ef67deebe299915c",class:"title"}," ",this.heading)),h("div",{key:"84ad2b3657ac06ef807557d68b24156964adef00",slot:"content",class:"content",innerHTML:this.message}),h("div",{key:"b18ad4282201a68caa040f5400fbdd0103eac20a",class:"footer",slot:"footer"},h("div",{key:"4add506ce666b657c3a23a0ed960ea305fc3904b",class:"buttons"},this.showCancel&&h("button",{key:"1d2fc583027ed4994a90babdec18e3828d403fd7",class:"cancel",onClick:function(){return e.handleCancel()}},"Cancel"),h("button",{key:"d1331922dc64b8af4b19aef0dd0684406d17c58a",class:!this.showCancel?"ok single":"ok",onClick:function(){return e.handleOk()}},"OK"))))};return e}();VerdocsOkDialog.style=verdocsOkDialogCss();export{VerdocsOkDialog as verdocs_ok_dialog};
2
2
  //# sourceMappingURL=verdocs-ok-dialog.entry.js.map
@@ -1,4 +1,4 @@
1
- var __assign=this&&this.__assign||function(){__assign=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var o in t)if(Object.prototype.hasOwnProperty.call(t,o))e[o]=t[o]}return e};return __assign.apply(this,arguments)};var __awaiter=this&&this.__awaiter||function(e,t,n,r){function o(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,i){function s(e){try{l(r.next(e))}catch(e){i(e)}}function a(e){try{l(r["throw"](e))}catch(e){i(e)}}function l(e){e.done?n(e.value):o(e.value).then(s,a)}l((r=r.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,o,i,s=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return s.next=a(0),s["throw"]=a(1),s["return"]=a(2),typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(e){return function(t){return l([e,t])}}function l(a){if(r)throw new TypeError("Generator is already executing.");while(s&&(s=0,a[0]&&(n=0)),n)try{if(r=1,o&&(i=a[0]&2?o["return"]:a[0]?o["throw"]||((i=o["return"])&&i.call(o),0):o.next)&&!(i=i.call(o,a[1])).done)return i;if(o=0,i)a=[a[0]&2,i.value];switch(a[0]){case 0:case 1:i=a;break;case 4:n.label++;return{value:a[1],done:false};case 5:n.label++;o=a[1];a=[0];continue;case 7:a=n.ops.pop();n.trys.pop();continue;default:if(!(i=n.trys,i=i.length>0&&i[i.length-1])&&(a[0]===6||a[0]===2)){n=0;continue}if(a[0]===3&&(!i||a[1]>i[0]&&a[1]<i[3])){n.label=a[1];break}if(a[0]===6&&n.label<i[1]){n.label=i[1];i=a;break}if(i&&n.label<i[2]){n.label=i[2];n.ops.push(a);break}if(i[2])n.ops.pop();n.trys.pop();continue}a=t.call(e,n)}catch(e){a=[6,e];o=0}finally{r=i=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,i;r<o;r++){if(i||!(r in t)){if(!i)i=Array.prototype.slice.call(t,0,r);i[r]=t[r]}}return e.concat(i||Array.prototype.slice.call(t))};import{r as registerInstance,c as createEvent,h,H as Host,F as Fragment,g as getElement}from"./index-CjTHbolG.js";import{i as interact}from"./interact.min-BepJAdBZ.js";import{VerdocsEndpoint,getTemplate,integerSequence,getOrganizationContacts,isValidEmail,createEnvelope,formatFullName,getRGBA,createTemplateDocument,deleteTemplateDocument,updateField,createField,updateTemplateRole,createTemplateRole}from"@verdocs/js-sdk";import{a as renderDocumentField,g as getFieldId,h as updateCssTransform,i as removeCssTransform,j as setControlStyles,d as defaultHeight,k as defaultWidth}from"./utils-D9l-GFdv.js";import{S as SDKError}from"./errors-C1sRVZWv.js";import{S as Store}from"./Datastore-C7hFgM52.js";import{D as DefaultEndpoint}from"./Environment-C_Xku1v2.js";import{V as VerdocsToast}from"./Toast-D97GxsI-.js";import{a as DocIcon,P as PngIcon,J as JpgIcon,b as PdfIcon,F as FileIcon,c as PageCountIcon,T as TrashIcon,D as DocumentPageIcon}from"./Icons-BU5rnXp2.js";import"./_commonjsHelpers-BFTU3MAI.js";import"./index-BglCURB-.js";import"./Types-CIxfEdV7.js";var verdocsPreviewCss=function(){return'verdocs-preview{font-family:var(--verdocs-primary-font, "Inter", "Barlow", sans-serif);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-preview div,verdocs-preview canvas{-webkit-box-sizing:border-box;box-sizing:border-box}'};var VerdocsPreview=function(){function e(e){registerInstance(this,e);this.sdkError=createEvent(this,"sdkError");this.templateListenerId=null;this.renderedPages={};this.endpoint=VerdocsEndpoint.getDefault();this.templateId=null;this.loading=true;this.template=null}e.prototype.disconnectedCallback=function(){this.unlistenToTemplate()};e.prototype.listenToTemplate=function(){return __awaiter(this,void 0,void 0,(function(){var e=this;return __generator(this,(function(t){this.unlistenToTemplate();Store.subscribe("templates",this.templateId,(function(){return getTemplate(e.endpoint,e.templateId)}),false,(function(t){e.template=t;e.loading=false}));return[2]}))}))};e.prototype.unlistenToTemplate=function(){if(this.templateListenerId){Store.store.delListener(this.templateListenerId);this.templateListenerId=null}};e.prototype.onTemplateIdChanged=function(e){console.log("[PREVIEW] Template ID changed",e);this.listenToTemplate()};e.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,n;return __generator(this,(function(r){try{this.endpoint.loadSession();if(!this.endpoint.session){console.log("[PREVIEW] Unable to start builder session, must be authenticated");return[2]}if(!this.templateId){console.log("[PREVIEW] Missing required template ID ".concat(this.templateId));return[2]}this.listenToTemplate()}catch(r){console.log("[PREVIEW] Error with preview session",r);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new SDKError(r.message,(t=r.response)===null||t===void 0?void 0:t.status,(n=r.response)===null||n===void 0?void 0:n.data))}return[2]}))}))};e.prototype.componentDidRender=function(){var e;(e=this.hostEl)===null||e===void 0?void 0:e.querySelectorAll(".verdocs-field").forEach((function(e){interact(e).unset()}))};e.prototype.handlePageRendered=function(e){var t;var n=e.detail;this.renderedPages["".concat(n.documentId,":").concat(n.pageNumber)]=n;var r=(((t=this.template)===null||t===void 0?void 0:t.fields)||[]).filter((function(e){if(e["document_id"]){return e["document_id"]===n.documentId&&e.page===n.pageNumber}return e.page===n.pageNumber}));r.forEach((function(e){return renderDocumentField("template",e,n,{disabled:true,editable:false,draggable:false})}))};e.prototype.render=function(){var e=this;var t;if(this.loading){return h(Host,null,h("verdocs-loader",null))}return h(Host,null,(((t=this.template)===null||t===void 0?void 0:t.documents)||[]).map((function(t){var n=integerSequence(1,t.pages);return h(Fragment,null,n.map((function(n){var r;var o=((r=t.page_sizes)===null||r===void 0?void 0:r[n])||{width:612,height:792};return h("verdocs-template-document-page",{templateId:t.template_id,documentId:t.id,pageNumber:n,disabled:true,editable:false,done:false,virtualWidth:o.width,virtualHeight:o.height,onPageRendered:function(t){return e.handlePageRendered(t)},layers:[{name:"page",type:"canvas"},{name:"controls",type:"div"}]})})))})))};Object.defineProperty(e.prototype,"hostEl",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{templateId:[{onTemplateIdChanged:0}]}},enumerable:false,configurable:true});return e}();VerdocsPreview.style=verdocsPreviewCss();var getRoleNames=function(e){return((e===null||e===void 0?void 0:e.roles)||[]).map((function(e){return e.name}))};var getRoleIndex=function(e,t){return Math.max(getRoleNames(e).findIndex((function(e){return e===t})),0)};var verdocsSendCss=function(){return'verdocs-send{padding:10px;position:relative;background:#ffffff;-ms-flex-direction:column;flex-direction:column;font-family:var(--verdocs-primary-font, "Inter", "Barlow", sans-serif)}verdocs-send.sendable{display:-ms-flexbox;display:flex}verdocs-send .recipients{position:relative}verdocs-send .left-line{top:32px;left:20px;z-index:1;width:12px;bottom:30px;position:absolute;background:#ffffff;border-left:3px dotted #9b9b9b}verdocs-send .level{display:-ms-flexbox;display:flex;-webkit-column-gap:10px;-moz-column-gap:10px;column-gap:10px;margin-left:50px;position:relative;-ms-flex-direction:row;flex-direction:row;padding:8px 0 4px 0;border-bottom:1px solid rgba(151, 151, 151, 0.2666666667)}verdocs-send .level .level-icon{top:14px;z-index:2;left:-40px;width:24px;height:24px;position:absolute;background:#ffffff}verdocs-send .level .level-icon svg{fill:rgba(0, 0, 0, 0.537254902)}verdocs-send .level .recipient{height:30px;display:-ms-flexbox;display:flex;-ms-flex:0 0 30px;flex:0 0 30px;color:#000000;cursor:pointer;font-size:14px;-ms-flex-align:center;align-items:center;border-radius:30px;-ms-flex-direction:row;flex-direction:row;background:#dddddd;white-space:nowrap;border:2px solid #dddddd;padding:2px 10px 2px 14px}verdocs-send .level .recipient .icon{width:22px;height:22px;-ms-flex:0 0 22px;flex:0 0 22px;margin:0 0 0 10px}verdocs-send .level .recipient .icon svg{width:22px;height:22px;fill:#333333;outline:none}verdocs-send .level .complete{-ms-flex:1;flex:1;height:30px;display:-ms-flexbox;display:flex;color:#000000;font-size:14px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;padding:3px 10px 3px 2px}verdocs-send .buttons{display:-ms-flexbox;display:flex;margin-top:10px;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;-ms-flex-wrap:wrap;flex-wrap:wrap;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center}verdocs-send .buttons .error-message{width:100%;color:#cc0000;font-size:13px;margin-bottom:10px}verdocs-send verdocs-contact-picker{left:0;top:41px;z-index:10;position:absolute;border:1px solid #dddddd;-webkit-box-shadow:0 0 6px 3px rgba(0, 0, 0, 0.1);box-shadow:0 0 6px 3px rgba(0, 0, 0, 0.1)}'};var 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>';var 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>';var 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>';var 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>';var VerdocsSend=function(){function e(e){registerInstance(this,e);this.beforeSend=createEvent(this,"beforeSend");this.send=createEvent(this,"send");this.exit=createEvent(this,"exit");this.sdkError=createEvent(this,"sdkError");this.searchContacts=createEvent(this,"searchContacts");this.templateListenerId=null;this.endpoint=DefaultEndpoint;this.templateId=null;this.environment="";this.showCancel=true;this.containerId="verdocs-send-".concat(Math.random().toString(36).substring(2,11));this.showPickerForId="";this.sessionContacts=[];this.sending=false;this.rolesCompleted={};this.loading=true;this.template=null}e.prototype.disconnectedCallback=function(){this.unlistenToTemplate()};e.prototype.listenToTemplate=function(){return __awaiter(this,void 0,void 0,(function(){var e=this;return __generator(this,(function(t){console.log("[SEND] Loading template",this.templateId);this.unlistenToTemplate();Store.subscribe("templates",this.templateId,(function(){return getTemplate(e.endpoint,e.templateId)}),true,(function(t){console.log("[SEND] Got new template",t);e.template=t;e.loading=false;e.rolesCompleted={};e.recomputeRolesCompleted()}));return[2]}))}))};e.prototype.unlistenToTemplate=function(){if(this.templateListenerId){Store.store.delListener(this.templateListenerId);this.templateListenerId=null}};e.prototype.reset=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){this.rolesCompleted={};return[2]}))}))};e.prototype.onTemplateIdChanged=function(e){console.log("[SEND] Template ID changed",e);this.listenToTemplate()};e.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,n;var r=this;return __generator(this,(function(o){try{this.endpoint.onSessionChanged((function(e,t,n){if(!n){return}var o={id:n.id,first_name:n.first_name,last_name:n.last_name,email:n.email,phone:n.phone};if(n){r.sessionContacts=[o];getOrganizationContacts(r.endpoint).then((function(e){console.log("[SEND] Got contacts",e);r.sessionContacts=__spreadArray(__spreadArray([],e,true),[o],false)})).catch((function(e){console.log("[SEND] Error getting contacts",e)}))}}));this.endpoint.loadSession();if(!this.endpoint.session){console.log("[SEND] Unable to start Send operation, must be authenticated");return[2]}if(!this.templateId){console.log("[SEND] Missing required template ID ".concat(this.templateId));return[2]}this.listenToTemplate()}catch(r){console.log("[SEND] Error with send session",r);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new SDKError(r.message,(t=r.response)===null||t===void 0?void 0:t.status,(n=r.response)===null||n===void 0?void 0:n.data))}return[2]}))}))};e.prototype.recomputeRolesCompleted=function(){var e=this;var t;this.rolesCompleted={};var n={};(((t=this.template)===null||t===void 0?void 0:t.roles)||[]).forEach((function(t){var r=t.sequence;n[r]||(n[r]=[]);var o="r-".concat(r,"-").concat(n[r].length);n[r].push(__assign(__assign({},t),{id:o,role_name:t.name,first_name:t.first_name,last_name:t.last_name}));if(t.first_name&&isValidEmail(t.email)){e.rolesCompleted[o]=__assign(__assign({},t),{id:o,role_name:t.name,first_name:t.first_name,last_name:t.last_name})}}))};e.prototype.getSequenceNumbers=function(){var e;var t={};(((e=this.template)===null||e===void 0?void 0:e.roles)||[]).forEach((function(e){t[e.sequence]=true}));return Object.keys(t).map((function(e){return+e})).sort((function(e,t){return e-t}))};e.prototype.getRolesAtLevel=function(e){var t;var n=(((t=this.template)===null||t===void 0?void 0:t.roles)||[]).filter((function(t){return t.sequence===e})).map((function(t,n){return __assign(__assign({},t),{id:"r-".concat(e,"-").concat(n),role_name:t.name,first_name:t.first_name,last_name:t.last_name})}));return n};e.prototype.getLevelIcon=function(e){if(e==="start"){return h("div",{class:"level-icon",innerHTML:startIcon})}else if(e==="end"){return h("div",{class:"level-icon",innerHTML:doneIcon})}else{return h("div",{class:"level-icon",innerHTML:stepIcon})}};e.prototype.handleSelectContact=function(e,t){e.preventDefault();this.rolesCompleted[t.id]=__assign(__assign({},t),e.detail);this.showPickerForId=""};e.prototype.handleClickRole=function(e,t){e.stopPropagation();this.showPickerForId=t.id};e.prototype.handleSend=function(e){var t=this;var n;if(this.sending){console.log("[SEND] Skipping duplicate send",e);return}console.log("[SEND] Sending",e);e.preventDefault();e.stopPropagation();this.sending=true;var r={template_id:this.templateId,name:((n=this.template)===null||n===void 0?void 0:n.name)||"New Envelope",environment:this.environment,initial_reminder:0,followup_reminders:0,recipients:Object.values(this.rolesCompleted)};var o=this.beforeSend.emit(__assign(__assign({},r),{name:r.name,template:this.template}));if(o.defaultPrevented){console.log("[SEND] Send cancelled by parent",r);this.sending=false;return}console.log("[SEND] Creating envelope",r);createEnvelope(this.endpoint,r).then((function(e){var n;console.log("[SEND] Send envelope",e);t.reset().catch((function(e){return console.log("Unknown Error",e)}));t.sending=false;(n=t.send)===null||n===void 0?void 0:n.emit(__assign(__assign({},r),{name:r.name,envelope_id:e.id,envelope:e}))})).catch((function(e){var n,r,o;console.log("[SEND] Send error",e);VerdocsToast(((r=(n=e.response)===null||n===void 0?void 0:n.data)===null||r===void 0?void 0:r.error)||"Error creating envelope, please try again later.");t.sending=false;(o=t.sdkError)===null||o===void 0?void 0:o.emit(e)}))};e.prototype.handleCancel=function(e){var t;e.stopPropagation();(t=this.exit)===null||t===void 0?void 0:t.emit()};e.prototype.render=function(){var e=this;var t;if(this.loading){return h(Host,null,h("verdocs-loader",null))}if(!this.endpoint.session){return h(Host,{style:{display:"flex"}},h("verdocs-component-error",{message:"You must be authenticated to use this module."}))}var n=this.getSequenceNumbers();var r=Object.values(this.rolesCompleted).filter((function(e){return isValidEmail(e.email)&&e.first_name&&e.last_name}));var o=r.length>=getRoleNames(this.template).length;var i=r.map((function(e){return e.email.toLowerCase()}));var s=new Set(i).size<i.length;return h(Host,{class:{sendable:(t=this.template)===null||t===void 0?void 0:t.is_sendable}},h("div",{class:"recipients"},h("div",{class:"left-line"}),h("div",{class:"level level-start"},this.getLevelIcon("start"),h("div",{class:"complete"},"Send Envelope")),n.map((function(t){return h("div",{class:"level level-".concat(t)},e.getLevelIcon("sequence"),e.getRolesAtLevel(t).map((function(t){var n,o,i;var s=!t.email||!t.first_name||!t.last_name;var a=((n=e.rolesCompleted[t.id])===null||n===void 0?void 0:n.first_name)?formatFullName(e.rolesCompleted[t.id]):s?t.role_name:formatFullName(t);var l="verdocs-send-recipient-".concat(t.role_name);var c=getRoleIndex(e.template,t.role_name);var d=getRGBA(c);var u=r.findIndex((function(e){return e.role_name===t.role_name}))>-1;var f={backgroundColor:d,border:u?"2px solid #55bc81":"2px solid #dddddd"};return s?h("div",{class:"recipient","data-ri":c,"data-rn":t.role_name,style:f,onClick:function(n){return e.handleClickRole(n,t)},id:l},a,h("div",{class:"icon",innerHTML:editIcon}),e.showPickerForId===t.id&&h("verdocs-portal",{anchor:l,onClickAway:function(){return e.showPickerForId=""}},h("verdocs-contact-picker",{onExit:function(){return e.showPickerForId=""},onNext:function(n){return e.handleSelectContact(n,t)},contactSuggestions:e.sessionContacts,templateRole:(o=e.rolesCompleted[t.id])!==null&&o!==void 0?o:t,onSearchContacts:function(t){var n;return(n=e.searchContacts)===null||n===void 0?void 0:n.emit(t.detail)}}))):h("div",{class:"recipient","data-ri":c,"data-rn":t.role_name,style:f,onClick:function(n){return e.handleClickRole(n,t)},id:l},a,h("div",{class:"icon",innerHTML:editIcon}),e.showPickerForId===t.id&&h("verdocs-portal",{anchor:l,onClickAway:function(){return e.showPickerForId=""}},h("verdocs-contact-picker",{onExit:function(){return e.showPickerForId=""},onNext:function(n){return e.handleSelectContact(n,t)},contactSuggestions:e.sessionContacts,templateRole:(i=e.rolesCompleted[t.id])!==null&&i!==void 0?i:t,onSearchContacts:function(t){var n;return(n=e.searchContacts)===null||n===void 0?void 0:n.emit(t.detail)}})))})))})),h("div",{class:"level level-done"},this.getLevelIcon("end"),h("div",{class:"complete"},"Signing Complete"))),h("div",{class:"buttons"},s&&h("div",{class:"error-message"},"Recipients cannot share the same email."),this.showCancel&&h("verdocs-button",{label:"Cancel",size:"small",variant:"outline",onClick:function(t){return e.handleCancel(t)},disabled:this.sending}),h("verdocs-button",{label:"Send",size:"small",disabled:!o||this.sending||s,onClick:function(t){return e.handleSend(t)}}),this.sending&&h("verdocs-spinner",null)))};Object.defineProperty(e,"watchers",{get:function(){return{templateId:[{onTemplateIdChanged:0}]}},enumerable:false,configurable:true});return e}();VerdocsSend.style=verdocsSendCss();var verdocsTemplateAttachmentsCss=function(){return'verdocs-template-attachments{font-family:var(--verdocs-primary-font, "Inter", "Barlow", sans-serif)}verdocs-template-attachments h5{font-size:16px;font-weight:bold;margin:0 0 10px 0;color:#46497d}verdocs-template-attachments .attachments{margin:0 0 40px 0}verdocs-template-attachments .attachment{display:-ms-flexbox;display:flex;padding:5px 0;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;color:#33364b}verdocs-template-attachments .attachment:hover .trash-icon{display:-ms-flexbox;display:flex}verdocs-template-attachments .attachment:hover .pages{display:none}verdocs-template-attachments svg{width:28px;height:28px;fill:#5c6575;margin:2px 0 0 0}verdocs-template-attachments .file-icon{-ms-flex:0;flex:0}verdocs-template-attachments .pages{width:24px;height:24px;-ms-flex:0 0 24px;flex:0 0 24px;padding-left:4px;position:relative;margin:-10px 0 0 0}verdocs-template-attachments .pages .pages-icon{top:0;left:0;width:24px;height:24px;position:absolute}verdocs-template-attachments .pages .count{top:11px;left:7px;z-index:1;width:18px;font-size:12px;font-weight:500;position:absolute;text-align:center;letter-spacing:-2px}verdocs-template-attachments .filename{-ms-flex:1;flex:1;display:block;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;border-bottom:1px dotted #cccccc}verdocs-template-attachments .trash-icon{-ms-flex:0;flex:0;display:none}verdocs-template-attachments .trash-icon:hover{cursor:pointer}verdocs-template-attachments verdocs-file-chooser{margin:10px 0;border:2px dashed #979797}verdocs-template-attachments .loader-wrapper{background-color:#ffffff;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-webkit-box-sizing:border-box;box-sizing:border-box;position:relative;width:320px;height:320px;text-align:center;border:2px dashed #979797;-ms-flex-pack:end;justify-content:flex-end}verdocs-template-attachments .progress-wrapper{padding:20px}verdocs-template-attachments .buttons{display:-ms-flexbox;display:flex;-webkit-column-gap:8px;-moz-column-gap:8px;column-gap:8px;margin-top:16px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:end;justify-content:flex-end}verdocs-template-attachments .buttons .flex-fill{-ms-flex:1;flex:1}verdocs-template-attachments ::-webkit-input-placeholder{color:#aaaaaa}verdocs-template-attachments ::-moz-placeholder{color:#aaaaaa}verdocs-template-attachments :-ms-input-placeholder{color:#aaaaaa}verdocs-template-attachments ::-ms-input-placeholder{color:#aaaaaa}verdocs-template-attachments ::placeholder{color:#aaaaaa}'};var VerdocsTemplateAttachments=function(){function e(e){registerInstance(this,e);this.exit=createEvent(this,"exit");this.next=createEvent(this,"next");this.templateUpdated=createEvent(this,"templateUpdated");this.sdkError=createEvent(this,"sdkError");this.templateListenerId=null;this.endpoint=VerdocsEndpoint.getDefault();this.templateId="";this.uploading=false;this.progressLabel="Uploading...";this.progressPercent=0;this.showDeleteError=false;this.confirmDeleteDocument=null;this.loading=true;this.template=null}e.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,n;return __generator(this,(function(r){try{this.endpoint.loadSession();if(!this.templateId){console.log("[ROLES] Missing required template ID ".concat(this.templateId));return[2]}if(!this.endpoint.session){console.log("[ROLES] Unable to start builder session, must be authenticated");return[2]}this.listenToTemplate()}catch(r){console.log("[TEMPLATE ATTACHMENTS] Error loading template",r);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new SDKError(r.message,(t=r.response)===null||t===void 0?void 0:t.status,(n=r.response)===null||n===void 0?void 0:n.data))}return[2]}))}))};e.prototype.disconnectedCallback=function(){this.unlistenToTemplate()};e.prototype.listenToTemplate=function(){return __awaiter(this,void 0,void 0,(function(){var e=this;return __generator(this,(function(t){this.unlistenToTemplate();Store.subscribe("templates",this.templateId,(function(){return getTemplate(e.endpoint,e.templateId)}),false,(function(t){e.template=t;e.loading=false}));return[2]}))}))};e.prototype.unlistenToTemplate=function(){if(this.templateListenerId){Store.store.delListener(this.templateListenerId);this.templateListenerId=null}};e.prototype.handleCancel=function(e){e.stopPropagation();this.exit.emit()};e.prototype.handleUploadProgress=function(e){if(e>=99){this.progressPercent=100;this.progressLabel="Processing..."}else{this.progressPercent=e}};e.prototype.handleUpload=function(e){return __awaiter(this,void 0,void 0,(function(){var t,n,r,o,i,s,a,l;return __generator(this,(function(c){switch(c.label){case 0:e.stopPropagation();i=e.detail.file;if(!i){return[2]}console.log("[ATTACHMENTS] Uploading...",i);this.uploading=true;this.progressLabel="Uploading...";c.label=1;case 1:c.trys.push([1,4,,5]);return[4,createTemplateDocument(this.endpoint,this.templateId,i,this.handleUploadProgress.bind(this))];case 2:s=c.sent();console.log("[ATTACHMENTS] Created attachment",s);a=this;return[4,Store.getTemplate(this.endpoint,this.templateId,true)];case 3:a.template=c.sent();console.log("[ATTACHMENTS] Updated template",this.template);(t=this.templateUpdated)===null||t===void 0?void 0:t.emit({endpoint:this.endpoint,template:this.template,event:"attachments"});this.uploading=false;this.progressLabel="";this.progressPercent=0;return[3,5];case 4:l=c.sent();console.log("[ATTACHMENTS] Error creating template",l);(n=this.sdkError)===null||n===void 0?void 0:n.emit(new SDKError(l.message,(r=l.response)===null||r===void 0?void 0:r.status,(o=l.response)===null||o===void 0?void 0:o.data));this.uploading=false;return[3,5];case 5:return[2]}}))}))};e.prototype.handleNext=function(e){var t;e.stopPropagation();this.uploading=false;this.progressLabel="";this.progressPercent=0;(t=this.next)===null||t===void 0?void 0:t.emit({template:this.template})};e.prototype.confirmDelete=function(){return __awaiter(this,void 0,void 0,(function(){var e;return __generator(this,(function(t){switch(t.label){case 0:return[4,deleteTemplateDocument(this.endpoint,this.confirmDeleteDocument.id)];case 1:t.sent();e=this;return[4,Store.getTemplate(this.endpoint,this.templateId,true)];case 2:e.template=t.sent();console.log("[ATTACHMENTS] New template",this.template);this.confirmDeleteDocument=null;return[2]}}))}))};e.prototype.handleDelete=function(e){return __awaiter(this,void 0,void 0,(function(){var t;return __generator(this,(function(n){if((((t=this.template)===null||t===void 0?void 0:t.documents)||[]).length>1){this.confirmDeleteDocument=e}else{this.showDeleteError=true}return[2]}))}))};e.prototype.getFileIcon=function(e){switch(e.mime){case"application/pdf":return PdfIcon;case"image/jpeg":return JpgIcon;case"image/png":return PngIcon;case"application/msword":case"application/vnd.openxmlformats-officedocument.wordprocessingml.document":return DocIcon}return FileIcon};e.prototype.render=function(){var e=this;var t,n;if(!this.endpoint.session){return h(Host,null,h("verdocs-component-error",{message:"You must be authenticated to use this module."}))}if(this.loading){return h(Host,{class:"loading"},h("verdocs-loader",null))}if(!this.endpoint.session||!this.template){return h(Host,{class:"empty"})}return h(Host,null,h("h5",null,"Existing Attachments"),h("div",{class:"attachments"},(((t=this.template)===null||t===void 0?void 0:t.documents)||[]).map((function(t){return h("div",{class:"attachment"},h("div",{class:"file-icon",innerHTML:e.getFileIcon(t)}),h("div",{class:"filename",title:t.name},t.name),h("div",{class:"pages"},h("div",{class:"count"},t.pages),h("div",{class:"pages-icon",innerHTML:PageCountIcon})),h("div",{class:"trash-icon",innerHTML:TrashIcon,onClick:function(){return e.handleDelete(t)}}))}))),h("h5",null,"Attach a New Document"),this.uploading?h("div",{class:"loader-wrapper"},h("verdocs-loader",null),this.progressLabel&&h("div",{class:"progress-wrapper"},h("verdocs-progress-bar",{showPercent:true,percent:this.progressPercent,label:this.progressLabel}))):h("verdocs-file-chooser",{onFileSelected:function(t){return e.handleUpload(t)}}),h("div",{class:"buttons"},h("verdocs-button",{variant:"outline",label:"Cancel",size:"small",onClick:function(t){return e.handleCancel(t)},disabled:this.uploading}),h("verdocs-button",{label:"Next",size:"small",onClick:function(t){return e.handleNext(t)},disabled:!(((n=this.template)===null||n===void 0?void 0:n.documents)||[]).length||this.uploading})),this.showDeleteError&&h("verdocs-ok-dialog",{heading:"Unable to Delete Attachment",message:"Templates must contain at least one attachment.",onNext:function(){return e.showDeleteError=false}}),this.confirmDeleteDocument&&h("verdocs-ok-dialog",{heading:"Delete this Attachment?",message:"This operation cannot be undone. All fields placed<br />on the deleted attachment will also be removed.",onNext:function(){return e.confirmDelete()},showCancel:true,onExit:function(){e.confirmDeleteDocument=null}}))};return e}();VerdocsTemplateAttachments.style=verdocsTemplateAttachmentsCss();var verdocsTemplateBuildTabsCss=function(){return'verdocs-template-build-tabs{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:end;align-items:flex-end;-ms-flex:0 0 50px;flex:0 0 50px;width:100%;background:#ffffff;color:#72757d;border-bottom:1px solid #dddddd;-webkit-filter:drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));filter:drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));font-family:var(--verdocs-primary-font, "Inter", "Barlow", sans-serif)}verdocs-template-build-tabs .tab{position:relative;display:-ms-flexbox;display:flex;-ms-flex:1;flex:1;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;height:50px;padding:0 4px;background:#e7e7e7;font-weight:700;font-size:12px;cursor:pointer}@media (min-width: 768px){verdocs-template-build-tabs .tab{padding:0 8px 0 24px;font-size:14px}}verdocs-template-build-tabs .tab svg{position:absolute;top:0;right:-19px;z-index:10;pointer-events:none;display:none}@media (min-width: 768px){verdocs-template-build-tabs .tab svg{display:block}}verdocs-template-build-tabs .tab.active{background:#ffffff;color:#707ae5}verdocs-template-build-tabs .tab.disabled{cursor:default;color:#d1d5db}'};var VerdocsTemplateBuildTabs=function(){function e(e){registerInstance(this,e);this.sdkError=createEvent(this,"sdkError");this.stepChanged=createEvent(this,"stepChanged");this.templateListenerId=null;this.endpoint=VerdocsEndpoint.getDefault();this.templateId=null;this.step="preview";this.loading=true;this.template=null}e.prototype.disconnectedCallback=function(){this.unlistenToTemplate()};e.prototype.listenToTemplate=function(){return __awaiter(this,void 0,void 0,(function(){var e=this;return __generator(this,(function(t){this.unlistenToTemplate();Store.subscribe("templates",this.templateId,(function(){return getTemplate(e.endpoint,e.templateId)}),false,(function(t){e.template=t;e.loading=false}));return[2]}))}))};e.prototype.unlistenToTemplate=function(){if(this.templateListenerId){Store.store.delListener(this.templateListenerId);this.templateListenerId=null}};e.prototype.onTemplateIdChanged=function(e){console.log("[BUILD_TABS] Template ID changed",e);this.listenToTemplate()};e.prototype.onStepChanged=function(e){console.log("[BUILD_TABS] Step changed",e)};e.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,n;return __generator(this,(function(r){try{this.endpoint.loadSession();if(!this.endpoint.session){console.log("[BUILD_TABS] Unable to start builder session, must be authenticated");return[2]}if(!this.templateId){this.step="attachments";console.log("[BUILD_TABS] Missing required template ID, forcing view to attachments");return[2]}this.listenToTemplate()}catch(r){console.log("[BUILD_TABS] Error loading template",r);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new SDKError(r.message,(t=r.response)===null||t===void 0?void 0:t.status,(n=r.response)===null||n===void 0?void 0:n.data))}return[2]}))}))};e.prototype.handleSelect=function(e){var t;if(e.disabled||e.id===this.step){return}this.step=e.id;(t=this.stepChanged)===null||t===void 0?void 0:t.emit(e.id)};e.prototype.render=function(){var e=this;var t,n,r;if(this.loading){return h(Host,null,h("verdocs-loader",null))}if(!this.endpoint.session){return h(Host,null,h("verdocs-component-error",{message:"You must be authenticated to use this module."}))}var o=(((t=this.template)===null||t===void 0?void 0:t.documents)||[]).length>0;var i=o&&(((n=this.template)===null||n===void 0?void 0:n.roles)||[]).length>0;var s=i&&(((r=this.template)===null||r===void 0?void 0:r.fields)||[]).length>0;var a=[{id:"attachments",label:"Attachments",disabled:false},{id:"roles",label:"Workflow",disabled:!o},{id:"fields",label:"Fields",disabled:!i},{id:"preview",label:"Preview & Send",disabled:!s}];return h(Host,null,a.map((function(t){var n=t.id===e.step;var r=["tab"];if(n)r.push("active");if(t.disabled)r.push("disabled");return h("div",{class:r.join(" "),onClick:function(){return e.handleSelect(t)}},h("span",null,t.label),h("svg",{"aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",width:"19",height:"50",viewBox:"0 0 19 50"},h("polygon",{points:"0,0 19,25 0,50",fill:n?"#ffffff":"#e7e7e7"})))})))};Object.defineProperty(e,"watchers",{get:function(){return{templateId:[{onTemplateIdChanged:0}],step:[{onStepChanged:0}]}},enumerable:false,configurable:true});return e}();VerdocsTemplateBuildTabs.style=verdocsTemplateBuildTabsCss();var verdocsTemplateFieldsCss=function(){return"verdocs-template-fields{font-family:var(--verdocs-primary-font, \"Inter\", \"Barlow\", 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 .pages .document-separator{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;gap:10px;padding:12px 20px;width:100%;-webkit-box-sizing:border-box;box-sizing:border-box;background-color:#33364b;color:white;border-radius:6px;font-size:16px;font-weight:500;margin-top:20px;-webkit-box-shadow:0 2px 4px rgba(0, 0, 0, 0.1);box-shadow:0 2px 4px rgba(0, 0, 0, 0.1)}verdocs-template-fields .pages .document-separator svg{-ms-flex-negative:0;flex-shrink:0}verdocs-template-fields .pages .document-separator:first-child{margin-top:0}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}"};var 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>';var iconCheck='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" 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"/></svg>';var iconRadio='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" 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"/></svg>';var iconDatepicker='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" 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"/></svg>';var iconSignature='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" 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>';var iconInitial='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="M6.225 20.775V7h-5V3.225H15V7h-5v13.775Zm9.775 0v-8h-3V9h9.775v3.775h-3v8Z"/></svg>';var iconDropdown='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24" stroke-width="1.5" stroke="currentColor"><path stroke="#ffffff" 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" /></svg>';var iconAttachment='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-6"><path stroke-linecap="round" stroke-linejoin="round" d="m18.375 12.739-7.693 7.693a4.5 4.5 0 0 1-6.364-6.364l10.94-10.94A3 3 0 1 1 19.5 7.372L8.552 18.32m.009-.01-.01.01m5.699-9.941-7.81 7.81a1.5 1.5 0 0 0 2.112 2.13" /></svg>';var separator='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14.707 14.707"><g><rect x="6.275" y="0" fill="#ffffff7f" width="1" height="15"/></g></svg>';var menuOptions=[{id:"signature",tooltip:"Signature",icon:iconSignature,class:"signature"},{id:"initial",tooltip:"Initials",icon:iconInitial,class:"initial"},{id:"sep1",tooltip:"",icon:separator,class:"separator"},{id:"textbox",tooltip:"Text Box",icon:iconTextbox,class:"textbox"},{id:"checkbox",tooltip:"Check Box",icon:iconCheck,class:"checkbox"},{id:"radio",tooltip:"Radio Button",icon:iconRadio,class:"radio"},{id:"dropdown",tooltip:"Dropdown",icon:iconDropdown,class:"dropdown"},{id:"sep2",tooltip:"",icon:separator,class:"separator"},{id:"date",tooltip:"Date",icon:iconDatepicker,class:"date"},{id:"attachment",tooltip:"Attachment",icon:iconAttachment,class:"attachment"}];var VerdocsTemplateFields=function(){function e(e){registerInstance(this,e);this.sdkError=createEvent(this,"sdkError");this.templateUpdated=createEvent(this,"templateUpdated");this.templateListenerId=null;this.endpoint=VerdocsEndpoint.getDefault();this.templateId=null;this.toolbarTargetId=null;this.placing=null;this.showMustSelectRole=false;this.selectedRoleName="";this.loading=true;this.template=null;this.pageHeights={};this.cachedPageInfo={}}e.prototype.onTemplateIdChanged=function(){this.listenToTemplate()};e.prototype.handleKeyDown=function(e){if(e.key==="Escape"){this.placing=null}};e.prototype.handleFieldSettingsChanged=function(){var e;(e=this.templateUpdated)===null||e===void 0?void 0:e.emit({endpoint:this.endpoint,template:this.template,event:"updated-field"})};e.prototype.handleFieldDeleted=function(){var e;(e=this.templateUpdated)===null||e===void 0?void 0:e.emit({endpoint:this.endpoint,template:this.template,event:"deleted-field"})};e.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,n;return __generator(this,(function(r){try{this.endpoint.loadSession();if(!this.templateId){console.log("[FIELDS] Missing required template ID ".concat(this.templateId));return[2]}if(!this.endpoint.session){console.log("[FIELDS] Unable to start builder session, must be authenticated");return[2]}this.listenToTemplate()}catch(r){console.log("[FIELDS] Error with fields session",r);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new SDKError(r.message,(t=r.response)===null||t===void 0?void 0:t.status,(n=r.response)===null||n===void 0?void 0:n.data))}return[2]}))}))};e.prototype.componentDidRender=function(){var e=this;interact.dynamicDrop(true);document.querySelectorAll(".verdocs-field").forEach((function(t){e.makeDraggable(t)}));var t=this.toolbarTargetId?document.getElementById(this.toolbarTargetId):null;var n=document.getElementById("verdocs-template-fields-toolbar");if(t&&n){n.remove();t.append(n)}};e.prototype.componentWillUpdate=function(){var e=this;var t,n;var r=__spreadArray([],((t=this.template)===null||t===void 0?void 0:t.roles)||[],true).sort((function(e,t){var n,r;return((n=e.sequence)!==null&&n!==void 0?n:0)-((r=t.sequence)!==null&&r!==void 0?r:0)}));if(!this.selectedRoleName||!r.find((function(t){return t&&t.name===e.selectedRoleName}))){this.selectedRoleName=((n=r[0])===null||n===void 0?void 0:n.name)||"";console.log("[FIELDS] Selected new role",this.selectedRoleName)}};e.prototype.disconnectedCallback=function(){this.unlistenToTemplate()};e.prototype.listenToTemplate=function(){return __awaiter(this,void 0,void 0,(function(){var e=this;return __generator(this,(function(t){this.unlistenToTemplate();Store.subscribe("templates",this.templateId,(function(){return getTemplate(e.endpoint,e.templateId)}),false,(function(t){var n;console.log("Template updated");e.template=t;e.loading=false;if(!e.selectedRoleName){var r=__spreadArray([],t.roles||[],true).sort((function(e,t){var n,r;return((n=e.sequence)!==null&&n!==void 0?n:0)-((r=t.sequence)!==null&&r!==void 0?r:0)}));e.selectedRoleName=((n=r[0])===null||n===void 0?void 0:n.name)||""}}));return[2]}))}))};e.prototype.unlistenToTemplate=function(){if(this.templateListenerId){Store.store.delListener(this.templateListenerId);this.templateListenerId=null}};e.prototype.handlePageRendered=function(e){var t=this;var n,r;var o,i;var s=e.detail;console.log("[FIELDS] Page rendered",s.documentId,s.pageNumber,s.xScale,s.yScale);(n=(o=this.cachedPageInfo)[i=s.documentId])!==null&&n!==void 0?n:o[i]={};this.cachedPageInfo[s.documentId][s.pageNumber]=s;this.pageHeights[s.pageNumber]=s.naturalHeight;(((r=this.template)===null||r===void 0?void 0:r.fields)||[]).filter((function(e){return e&&e.page===s.pageNumber})).forEach((function(e){var n=getFieldId(e);var r=document.getElementById(n);if(r){r.setAttribute("templateid",t.templateId);r.setAttribute("fieldname",e.name);r.setAttribute("documentid",String(e.document_id));r.setAttribute("pagenumber",String(e.page));r.setAttribute("xScale",String(s.xScale));r.setAttribute("yScale",String(s.yScale));t.makeDraggable(r)}}))};e.prototype.makeDraggable=function(e){interact(e).draggable({listeners:{move:this.handleMoveField.bind(this),end:this.handleMoveEnd.bind(this)}})};e.prototype.handleMoveField=function(e){return __awaiter(this,void 0,void 0,(function(){var t,n,r,o,i,s;return __generator(this,(function(a){t=+(e.target.getAttribute("posX")||0);n=+(e.target.getAttribute("posY")||0);r=+(e.target.getAttribute("xScale")||1);o=+(e.target.getAttribute("yScale")||1);i=e.dx/r+t;s=e.dy/o+n;e.target.setAttribute("posX",i);e.target.setAttribute("posy",s);updateCssTransform(e.target,"translate","".concat(i,"px, ").concat(s,"px"));return[2]}))}))};e.prototype.handleMoveEnd=function(e){return __awaiter(this,void 0,void 0,(function(){var t,n,r,o,i,s,a,l,c,d,u,f,h,v,p,g,m,x,b,E,w,S,_,y,I,C,T,k,D,q,M,R,A,O,P,H,L,V,z,Z;return __generator(this,(function(j){switch(j.label){case 0:c=e.target.getAttribute("fieldname");d=(((t=this.template)===null||t===void 0?void 0:t.fields)||[]).find((function(e){return e.name===c}));if(!d){console.log("[FIELDS] Unable to find field",c,e.target);return[2]}u=e.target.getAttribute("pagenumber");f=e.target.getAttribute("documentid");h=this.cachedPageInfo[f][u],v=h.naturalWidth,p=v===void 0?612:v,g=h.naturalHeight,m=g===void 0?792:g,x=h.renderedHeight,b=x===void 0?792:x;E=e.target.getBoundingClientRect();w=e.target.parentElement;S=w.getBoundingClientRect();_=d.width||defaultWidth(d.type);y=d.height||defaultHeight(d.type);I=Math.max(E.left-S.left,0);C=Math.max(b-(S.bottom-E.bottom),0);T=parseInt(u);if(C>b){T=Math.min(T+1,((o=(r=((n=this.template)===null||n===void 0?void 0:n.documents)||[])===null||r===void 0?void 0:r[0])===null||o===void 0?void 0:o.pages)||1);C-=b;b=this.cachedPageInfo[f][T].renderedHeight;console.log("Next page",{newPageNumber:T,newY:C,renderedHeight:b})}else if(C<0){T=Math.max(T-1,1);b=this.cachedPageInfo[f][T].renderedHeight;C+=b;console.log("[FIELDS] Next page",{newPageNumber:T,newY:C,renderedHeight:b})}k=this.viewCoordinatesToPageCoordinates(I,C,f,u,p-_,m-y),D=k.x,q=k.y;j.label=1;case 1:j.trys.push([1,3,,4]);M={x:D,y:q,page:T};return[4,updateField(this.endpoint,this.templateId,c,M)];case 2:R=j.sent();console.log("[FIELDS] Updated",R);A=JSON.parse(JSON.stringify(this.template));O=A.fields.findIndex((function(e){return e.name===c}));if(O>-1){A.fields[O]=R}Store.updateTemplate(this.templateId,A);e.target.removeAttribute("posX");e.target.removeAttribute("posY");removeCssTransform(e.target);P=this.cachedPageInfo[f][u],H=P.xScale,L=H===void 0?1:H,V=P.yScale,z=V===void 0?1:V;setControlStyles(e.target,R,L,z);(i=this.templateUpdated)===null||i===void 0?void 0:i.emit({endpoint:this.endpoint,template:A,event:"updated-field"});return[3,4];case 3:Z=j.sent();VerdocsToast("Error updating field, please try again later",{style:"error"});console.log("[FIELDS] Error updating field",Z);(s=this.sdkError)===null||s===void 0?void 0:s.emit(new SDKError(Z.message,(a=Z.response)===null||a===void 0?void 0:a.status,(l=Z.response)===null||l===void 0?void 0:l.data));e.target.removeAttribute("posX");e.target.removeAttribute("posY");removeCssTransform(e.target);return[3,4];case 4:return[2]}}))}))};e.prototype.generateFieldName=function(e,t){var n;var r=1;var o;do{o="".concat(e,"P").concat(t,"-").concat(r);r++}while((((n=this.template)===null||n===void 0?void 0:n.fields)||[]).some((function(e){return e&&e.name===o})));return o};e.prototype.viewCoordinatesToPageCoordinates=function(e,t,n,r,o,i){var s=this.cachedPageInfo[n][r],a=s.xScale,l=a===void 0?1:a,c=s.yScale,d=c===void 0?1:c,u=s.renderedHeight,f=u===void 0?792:u;var h=Math.floor(Math.min(e/l,o));var v=Math.floor(Math.min(Math.max(f-t,0)/d,i));return{x:h,y:v}};e.prototype.handleClickPage=function(e,t,n){return __awaiter(this,void 0,void 0,(function(){var r,o,i,s,a,l,c,d,u,f,h,v,p,g,m,x;return __generator(this,(function(b){switch(b.label){case 0:if(!this.placing)return[3,2];o=e.offsetX;i=e.offsetY;s=defaultWidth(this.placing);a=defaultHeight(this.placing);l=this.cachedPageInfo[t][n];c=l.naturalWidth,d=c===void 0?612:c,u=l.naturalHeight,f=u===void 0?792:u;h=this.viewCoordinatesToPageCoordinates(o,i,t,n,d-s,f-a);v=Math.floor(h.x);p=Math.floor(h.y);g={name:this.generateFieldName(this.placing,n),role_name:this.selectedRoleName,template_id:this.templateId,document_id:l.documentId,type:this.placing,required:this.placing!=="radio"&&this.placing!=="attachment"&&this.placing!=="checkbox",page:n,validator:null,label:null,default:null,placeholder:null,group:null,settings:{},x:v,y:p,width:s,height:a,multiline:false,readonly:false,options:this.placing==="radio"?[{id:"option-1",label:"Option 1"}]:[]};return[4,createField(this.endpoint,this.templateId,g)];case 1:m=b.sent();console.log("[FIELDS] Created field",m);x=JSON.parse(JSON.stringify(this.template));x.fields.push(m);Store.updateTemplate(this.templateId,x);(r=this.templateUpdated)===null||r===void 0?void 0:r.emit({endpoint:this.endpoint,template:x,event:"added-field"});this.placing=null;b.label=2;case 2:return[2]}}))}))};e.prototype.render=function(){var e;var t=this;var n,r,o;console.log("Rendering");if(this.loading){return h(Host,null,h("verdocs-loader",null))}if(!this.endpoint.session){return h(Host,null,h("verdocs-component-error",{message:"You must be authenticated to use this module."}))}var i=__spreadArray([],((n=this.template)===null||n===void 0?void 0:n.roles)||[],true).sort((function(e,t){var n,r;return((n=e.sequence)!==null&&n!==void 0?n:0)-((r=t.sequence)!==null&&r!==void 0?r:0)}));var s=i.map((function(e){return{value:e.name,label:e.full_name?"".concat(e.name,": ").concat(e.full_name):e.name}}));return h(Host,{class:this.placing?(e={},e["placing-".concat(this.placing)]=true,e):{},onSubmit:function(){}},h("div",{id:"verdocs-template-fields-toolbar"},h("div",{class:"add-for"},"Add field:"),h("verdocs-select-input",{value:this.selectedRoleName,options:s,onInput:function(e){return t.selectedRoleName=e.target.value}}),menuOptions.map((function(e){return h("verdocs-toolbar-icon",{text:e.tooltip,icon:e.icon,class:e.class,onClick:function(){if(e.tooltip){if(t.selectedRoleName){t.placing=e.id}else{t.showMustSelectRole=true}}}})}))),h("div",{class:"pages"},(((r=this.template)===null||r===void 0?void 0:r.documents)||[]).map((function(e){var n=integerSequence(1,e.pages);return n.map((function(n){var r;var o=e.page_sizes[n];return h(Fragment,null,((r=t.template)===null||r===void 0?void 0:r.documents.length)>1&&h("div",{class:"document-separator"},h("div",{innerHTML:DocumentPageIcon}),h("span",null,e.name)),h("verdocs-template-document-page",{templateId:t.templateId,documentId:e.id,pageNumber:n,virtualWidth:(o===null||o===void 0?void 0:o.width)||612,virtualHeight:(o===null||o===void 0?void 0:o.height)||792,disabled:true,editable:true,done:false,onClick:function(r){return t.handleClickPage(r,e.id,n)},onPageRendered:function(e){return t.handlePageRendered(e)},layers:[{name:"page",type:"canvas"},{name:"controls",type:"div"}]}))}))}))),this.showMustSelectRole&&h("verdocs-ok-dialog",{heading:"Unable to add field",message:(((o=this.template)===null||o===void 0?void 0:o.roles)||[]).length>0?"Please select a role before adding fields.":"Please add at least one role before adding fields.",onNext:function(){return t.showMustSelectRole=false}}))};Object.defineProperty(e,"watchers",{get:function(){return{templateId:[{onTemplateIdChanged:0}]}},enumerable:false,configurable:true});return e}();VerdocsTemplateFields.style=verdocsTemplateFieldsCss();
1
+ var __assign=this&&this.__assign||function(){__assign=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var o in t)if(Object.prototype.hasOwnProperty.call(t,o))e[o]=t[o]}return e};return __assign.apply(this,arguments)};var __awaiter=this&&this.__awaiter||function(e,t,n,r){function o(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,i){function s(e){try{l(r.next(e))}catch(e){i(e)}}function a(e){try{l(r["throw"](e))}catch(e){i(e)}}function l(e){e.done?n(e.value):o(e.value).then(s,a)}l((r=r.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,o,i,s=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return s.next=a(0),s["throw"]=a(1),s["return"]=a(2),typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(e){return function(t){return l([e,t])}}function l(a){if(r)throw new TypeError("Generator is already executing.");while(s&&(s=0,a[0]&&(n=0)),n)try{if(r=1,o&&(i=a[0]&2?o["return"]:a[0]?o["throw"]||((i=o["return"])&&i.call(o),0):o.next)&&!(i=i.call(o,a[1])).done)return i;if(o=0,i)a=[a[0]&2,i.value];switch(a[0]){case 0:case 1:i=a;break;case 4:n.label++;return{value:a[1],done:false};case 5:n.label++;o=a[1];a=[0];continue;case 7:a=n.ops.pop();n.trys.pop();continue;default:if(!(i=n.trys,i=i.length>0&&i[i.length-1])&&(a[0]===6||a[0]===2)){n=0;continue}if(a[0]===3&&(!i||a[1]>i[0]&&a[1]<i[3])){n.label=a[1];break}if(a[0]===6&&n.label<i[1]){n.label=i[1];i=a;break}if(i&&n.label<i[2]){n.label=i[2];n.ops.push(a);break}if(i[2])n.ops.pop();n.trys.pop();continue}a=t.call(e,n)}catch(e){a=[6,e];o=0}finally{r=i=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,i;r<o;r++){if(i||!(r in t)){if(!i)i=Array.prototype.slice.call(t,0,r);i[r]=t[r]}}return e.concat(i||Array.prototype.slice.call(t))};import{r as registerInstance,c as createEvent,h,H as Host,F as Fragment,g as getElement}from"./index-CjTHbolG.js";import{i as interact}from"./interact.min-BepJAdBZ.js";import{VerdocsEndpoint,getTemplate,integerSequence,getOrganizationContacts,isValidEmail,createEnvelope,formatFullName,getRGBA,createTemplateDocument,deleteTemplateDocument,updateField,createField,updateTemplateRole,createTemplateRole}from"@verdocs/js-sdk";import{a as renderDocumentField,g as getFieldId,h as updateCssTransform,i as removeCssTransform,j as setControlStyles,d as defaultHeight,k as defaultWidth}from"./utils-D9l-GFdv.js";import{S as SDKError}from"./errors-C1sRVZWv.js";import{S as Store}from"./Datastore-C7hFgM52.js";import{D as DefaultEndpoint}from"./Environment-C_Xku1v2.js";import{V as VerdocsToast}from"./Toast-D97GxsI-.js";import{a as DocIcon,P as PngIcon,J as JpgIcon,b as PdfIcon,F as FileIcon,c as PageCountIcon,T as TrashIcon,D as DocumentPageIcon}from"./Icons-BU5rnXp2.js";import"./_commonjsHelpers-BFTU3MAI.js";import"./index-BglCURB-.js";import"./Types-CIxfEdV7.js";var verdocsPreviewCss=function(){return'verdocs-preview{font-family:var(--verdocs-primary-font, "Inter", "Barlow", sans-serif);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-preview div,verdocs-preview canvas{-webkit-box-sizing:border-box;box-sizing:border-box}'};var VerdocsPreview=function(){function e(e){registerInstance(this,e);this.sdkError=createEvent(this,"sdkError");this.templateListenerId=null;this.renderedPages={};this.endpoint=VerdocsEndpoint.getDefault();this.templateId=null;this.loading=true;this.template=null}e.prototype.disconnectedCallback=function(){this.unlistenToTemplate()};e.prototype.listenToTemplate=function(){return __awaiter(this,void 0,void 0,(function(){var e=this;return __generator(this,(function(t){this.unlistenToTemplate();Store.subscribe("templates",this.templateId,(function(){return getTemplate(e.endpoint,e.templateId)}),false,(function(t){e.template=t;e.loading=false}));return[2]}))}))};e.prototype.unlistenToTemplate=function(){if(this.templateListenerId){Store.store.delListener(this.templateListenerId);this.templateListenerId=null}};e.prototype.onTemplateIdChanged=function(e){console.log("[PREVIEW] Template ID changed",e);this.listenToTemplate()};e.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,n;return __generator(this,(function(r){try{this.endpoint.loadSession();if(!this.endpoint.session){console.log("[PREVIEW] Unable to start builder session, must be authenticated");return[2]}if(!this.templateId){console.log("[PREVIEW] Missing required template ID ".concat(this.templateId));return[2]}this.listenToTemplate()}catch(r){console.log("[PREVIEW] Error with preview session",r);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new SDKError(r.message,(t=r.response)===null||t===void 0?void 0:t.status,(n=r.response)===null||n===void 0?void 0:n.data))}return[2]}))}))};e.prototype.componentDidRender=function(){var e;(e=this.hostEl)===null||e===void 0?void 0:e.querySelectorAll(".verdocs-field").forEach((function(e){interact(e).unset()}))};e.prototype.handlePageRendered=function(e){var t;var n=e.detail;this.renderedPages["".concat(n.documentId,":").concat(n.pageNumber)]=n;var r=(((t=this.template)===null||t===void 0?void 0:t.fields)||[]).filter((function(e){if(e["document_id"]){return e["document_id"]===n.documentId&&e.page===n.pageNumber}return e.page===n.pageNumber}));r.forEach((function(e){return renderDocumentField("template",e,n,{disabled:true,editable:false,draggable:false})}))};e.prototype.render=function(){var e=this;var t;if(this.loading){return h(Host,null,h("verdocs-loader",null))}return h(Host,null,(((t=this.template)===null||t===void 0?void 0:t.documents)||[]).map((function(t){var n=integerSequence(1,t.pages);return h(Fragment,null,n.map((function(n){var r;var o=((r=t.page_sizes)===null||r===void 0?void 0:r[n])||{width:612,height:792};return h("verdocs-template-document-page",{templateId:t.template_id,documentId:t.id,pageNumber:n,disabled:true,editable:false,done:false,virtualWidth:o.width,virtualHeight:o.height,onPageRendered:function(t){return e.handlePageRendered(t)},layers:[{name:"page",type:"canvas"},{name:"controls",type:"div"}]})})))})))};Object.defineProperty(e.prototype,"hostEl",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{templateId:[{onTemplateIdChanged:0}]}},enumerable:false,configurable:true});return e}();VerdocsPreview.style=verdocsPreviewCss();var getRoleNames=function(e){return((e===null||e===void 0?void 0:e.roles)||[]).map((function(e){return e.name}))};var getRoleIndex=function(e,t){return Math.max(getRoleNames(e).findIndex((function(e){return e===t})),0)};var verdocsSendCss=function(){return'verdocs-send{padding:10px;position:relative;background:#ffffff;-ms-flex-direction:column;flex-direction:column;font-family:var(--verdocs-primary-font, "Inter", "Barlow", sans-serif)}verdocs-send.sendable{display:-ms-flexbox;display:flex}verdocs-send .recipients{position:relative}verdocs-send .left-line{top:32px;left:20px;z-index:1;width:12px;bottom:30px;position:absolute;background:#ffffff;border-left:3px dotted #9b9b9b}verdocs-send .level{display:-ms-flexbox;display:flex;-webkit-column-gap:10px;-moz-column-gap:10px;column-gap:10px;margin-left:50px;position:relative;-ms-flex-direction:row;flex-direction:row;padding:8px 0 4px 0;border-bottom:1px solid rgba(151, 151, 151, 0.2666666667)}verdocs-send .level .level-icon{top:14px;z-index:2;left:-40px;width:24px;height:24px;position:absolute;background:#ffffff}verdocs-send .level .level-icon svg{fill:rgba(0, 0, 0, 0.537254902)}verdocs-send .level .recipient{height:30px;display:-ms-flexbox;display:flex;-ms-flex:0 0 30px;flex:0 0 30px;color:#000000;cursor:pointer;font-size:14px;-ms-flex-align:center;align-items:center;border-radius:30px;-ms-flex-direction:row;flex-direction:row;background:#dddddd;white-space:nowrap;border:2px solid #dddddd;padding:2px 10px 2px 14px}verdocs-send .level .recipient .icon{width:22px;height:22px;-ms-flex:0 0 22px;flex:0 0 22px;margin:0 0 0 10px}verdocs-send .level .recipient .icon svg{width:22px;height:22px;fill:#333333;outline:none}verdocs-send .level .complete{-ms-flex:1;flex:1;height:30px;display:-ms-flexbox;display:flex;color:#000000;font-size:14px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;padding:3px 10px 3px 2px}verdocs-send .buttons{display:-ms-flexbox;display:flex;margin-top:10px;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;-ms-flex-wrap:wrap;flex-wrap:wrap;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center}verdocs-send .buttons .error-message{width:100%;color:#cc0000;font-size:13px;margin-bottom:10px}verdocs-send verdocs-contact-picker{left:0;top:41px;z-index:10;position:absolute;border:1px solid #dddddd;-webkit-box-shadow:0 0 6px 3px rgba(0, 0, 0, 0.1);box-shadow:0 0 6px 3px rgba(0, 0, 0, 0.1)}'};var 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>';var 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>';var 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>';var 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>';var VerdocsSend=function(){function e(e){registerInstance(this,e);this.beforeSend=createEvent(this,"beforeSend");this.send=createEvent(this,"send");this.exit=createEvent(this,"exit");this.sdkError=createEvent(this,"sdkError");this.searchContacts=createEvent(this,"searchContacts");this.templateListenerId=null;this.endpoint=DefaultEndpoint;this.templateId=null;this.environment="";this.showCancel=true;this.containerId="verdocs-send-".concat(Math.random().toString(36).substring(2,11));this.showPickerForId="";this.sessionContacts=[];this.sending=false;this.rolesCompleted={};this.loading=true;this.template=null}e.prototype.disconnectedCallback=function(){this.unlistenToTemplate()};e.prototype.listenToTemplate=function(){return __awaiter(this,void 0,void 0,(function(){var e=this;return __generator(this,(function(t){console.log("[SEND] Loading template",this.templateId);this.unlistenToTemplate();Store.subscribe("templates",this.templateId,(function(){return getTemplate(e.endpoint,e.templateId)}),true,(function(t){console.log("[SEND] Got new template",t);e.template=t;e.loading=false;e.rolesCompleted={};e.recomputeRolesCompleted()}));return[2]}))}))};e.prototype.unlistenToTemplate=function(){if(this.templateListenerId){Store.store.delListener(this.templateListenerId);this.templateListenerId=null}};e.prototype.reset=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){this.rolesCompleted={};return[2]}))}))};e.prototype.onTemplateIdChanged=function(e){console.log("[SEND] Template ID changed",e);this.listenToTemplate()};e.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,n;var r=this;return __generator(this,(function(o){try{this.endpoint.onSessionChanged((function(e,t,n){if(!n){return}var o={id:n.id,first_name:n.first_name,last_name:n.last_name,email:n.email,phone:n.phone};if(n){r.sessionContacts=[o];getOrganizationContacts(r.endpoint).then((function(e){console.log("[SEND] Got contacts",e);r.sessionContacts=__spreadArray(__spreadArray([],e,true),[o],false)})).catch((function(e){console.log("[SEND] Error getting contacts",e)}))}}));this.endpoint.loadSession();if(!this.endpoint.session){console.log("[SEND] Unable to start Send operation, must be authenticated");return[2]}if(!this.templateId){console.log("[SEND] Missing required template ID ".concat(this.templateId));return[2]}this.listenToTemplate()}catch(r){console.log("[SEND] Error with send session",r);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new SDKError(r.message,(t=r.response)===null||t===void 0?void 0:t.status,(n=r.response)===null||n===void 0?void 0:n.data))}return[2]}))}))};e.prototype.recomputeRolesCompleted=function(){var e=this;var t;this.rolesCompleted={};var n={};(((t=this.template)===null||t===void 0?void 0:t.roles)||[]).forEach((function(t){var r=t.sequence;n[r]||(n[r]=[]);var o="r-".concat(r,"-").concat(n[r].length);n[r].push(__assign(__assign({},t),{id:o,role_name:t.name,first_name:t.first_name,last_name:t.last_name}));if(t.first_name&&isValidEmail(t.email)){e.rolesCompleted[o]=__assign(__assign({},t),{id:o,role_name:t.name,first_name:t.first_name,last_name:t.last_name})}}))};e.prototype.getSequenceNumbers=function(){var e;var t={};(((e=this.template)===null||e===void 0?void 0:e.roles)||[]).forEach((function(e){t[e.sequence]=true}));return Object.keys(t).map((function(e){return+e})).sort((function(e,t){return e-t}))};e.prototype.getRolesAtLevel=function(e){var t;var n=(((t=this.template)===null||t===void 0?void 0:t.roles)||[]).filter((function(t){return t.sequence===e})).map((function(t,n){return __assign(__assign({},t),{id:"r-".concat(e,"-").concat(n),role_name:t.name,first_name:t.first_name,last_name:t.last_name})}));return n};e.prototype.getLevelIcon=function(e){if(e==="start"){return h("div",{class:"level-icon",innerHTML:startIcon})}else if(e==="end"){return h("div",{class:"level-icon",innerHTML:doneIcon})}else{return h("div",{class:"level-icon",innerHTML:stepIcon})}};e.prototype.handleSelectContact=function(e,t){e.preventDefault();this.rolesCompleted[t.id]=__assign(__assign({},t),e.detail);this.showPickerForId=""};e.prototype.handleClickRole=function(e,t){e.stopPropagation();this.showPickerForId=t.id};e.prototype.handleSend=function(e){var t=this;var n;if(this.sending){console.log("[SEND] Skipping duplicate send",e);return}console.log("[SEND] Sending",e);e.preventDefault();e.stopPropagation();this.sending=true;var r=Intl.DateTimeFormat().resolvedOptions();var o={template_id:this.templateId,name:((n=this.template)===null||n===void 0?void 0:n.name)||"New Envelope",environment:this.environment,initial_reminder:0,followup_reminders:0,recipients:Object.values(this.rolesCompleted),timezone:r.timeZone,locale:r.locale};var i=this.beforeSend.emit(__assign(__assign({},o),{name:o.name,template:this.template}));if(i.defaultPrevented){console.log("[SEND] Send cancelled by parent",o);this.sending=false;return}console.log("[SEND] Creating envelope",o);createEnvelope(this.endpoint,o).then((function(e){var n;console.log("[SEND] Send envelope",e);t.reset().catch((function(e){return console.log("Unknown Error",e)}));t.sending=false;(n=t.send)===null||n===void 0?void 0:n.emit(__assign(__assign({},o),{name:o.name,envelope_id:e.id,envelope:e}))})).catch((function(e){var n,r,o;console.log("[SEND] Send error",e);VerdocsToast(((r=(n=e.response)===null||n===void 0?void 0:n.data)===null||r===void 0?void 0:r.error)||"Error creating envelope, please try again later.");t.sending=false;(o=t.sdkError)===null||o===void 0?void 0:o.emit(e)}))};e.prototype.handleCancel=function(e){var t;e.stopPropagation();(t=this.exit)===null||t===void 0?void 0:t.emit()};e.prototype.render=function(){var e=this;var t;if(this.loading){return h(Host,null,h("verdocs-loader",null))}if(!this.endpoint.session){return h(Host,{style:{display:"flex"}},h("verdocs-component-error",{message:"You must be authenticated to use this module."}))}var n=this.getSequenceNumbers();var r=Object.values(this.rolesCompleted).filter((function(e){return isValidEmail(e.email)&&e.first_name&&e.last_name}));var o=r.length>=getRoleNames(this.template).length;var i=r.map((function(e){return e.email.toLowerCase()}));var s=new Set(i).size<i.length;return h(Host,{class:{sendable:(t=this.template)===null||t===void 0?void 0:t.is_sendable}},h("div",{class:"recipients"},h("div",{class:"left-line"}),h("div",{class:"level level-start"},this.getLevelIcon("start"),h("div",{class:"complete"},"Send Envelope")),n.map((function(t){return h("div",{class:"level level-".concat(t)},e.getLevelIcon("sequence"),e.getRolesAtLevel(t).map((function(t){var n,o,i;var s=!t.email||!t.first_name||!t.last_name;var a=((n=e.rolesCompleted[t.id])===null||n===void 0?void 0:n.first_name)?formatFullName(e.rolesCompleted[t.id]):s?t.role_name:formatFullName(t);var l="verdocs-send-recipient-".concat(t.role_name);var c=getRoleIndex(e.template,t.role_name);var d=getRGBA(c);var u=r.findIndex((function(e){return e.role_name===t.role_name}))>-1;var f={backgroundColor:d,border:u?"2px solid #55bc81":"2px solid #dddddd"};return s?h("div",{class:"recipient","data-ri":c,"data-rn":t.role_name,style:f,onClick:function(n){return e.handleClickRole(n,t)},id:l},a,h("div",{class:"icon",innerHTML:editIcon}),e.showPickerForId===t.id&&h("verdocs-portal",{anchor:l,onClickAway:function(){return e.showPickerForId=""}},h("verdocs-contact-picker",{onExit:function(){return e.showPickerForId=""},onNext:function(n){return e.handleSelectContact(n,t)},contactSuggestions:e.sessionContacts,templateRole:(o=e.rolesCompleted[t.id])!==null&&o!==void 0?o:t,onSearchContacts:function(t){var n;return(n=e.searchContacts)===null||n===void 0?void 0:n.emit(t.detail)}}))):h("div",{class:"recipient","data-ri":c,"data-rn":t.role_name,style:f,onClick:function(n){return e.handleClickRole(n,t)},id:l},a,h("div",{class:"icon",innerHTML:editIcon}),e.showPickerForId===t.id&&h("verdocs-portal",{anchor:l,onClickAway:function(){return e.showPickerForId=""}},h("verdocs-contact-picker",{onExit:function(){return e.showPickerForId=""},onNext:function(n){return e.handleSelectContact(n,t)},contactSuggestions:e.sessionContacts,templateRole:(i=e.rolesCompleted[t.id])!==null&&i!==void 0?i:t,onSearchContacts:function(t){var n;return(n=e.searchContacts)===null||n===void 0?void 0:n.emit(t.detail)}})))})))})),h("div",{class:"level level-done"},this.getLevelIcon("end"),h("div",{class:"complete"},"Signing Complete"))),h("div",{class:"buttons"},s&&h("div",{class:"error-message"},"Recipients cannot share the same email."),this.showCancel&&h("verdocs-button",{label:"Cancel",size:"small",variant:"outline",onClick:function(t){return e.handleCancel(t)},disabled:this.sending}),h("verdocs-button",{label:"Send",size:"small",disabled:!o||this.sending||s,onClick:function(t){return e.handleSend(t)}}),this.sending&&h("verdocs-spinner",null)))};Object.defineProperty(e,"watchers",{get:function(){return{templateId:[{onTemplateIdChanged:0}]}},enumerable:false,configurable:true});return e}();VerdocsSend.style=verdocsSendCss();var verdocsTemplateAttachmentsCss=function(){return'verdocs-template-attachments{font-family:var(--verdocs-primary-font, "Inter", "Barlow", sans-serif)}verdocs-template-attachments h5{font-size:16px;font-weight:bold;margin:0 0 10px 0;color:#46497d}verdocs-template-attachments .attachments{margin:0 0 40px 0}verdocs-template-attachments .attachment{display:-ms-flexbox;display:flex;padding:5px 0;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;color:#33364b}verdocs-template-attachments .attachment:hover .trash-icon{display:-ms-flexbox;display:flex}verdocs-template-attachments .attachment:hover .pages{display:none}verdocs-template-attachments svg{width:28px;height:28px;fill:#5c6575;margin:2px 0 0 0}verdocs-template-attachments .file-icon{-ms-flex:0;flex:0}verdocs-template-attachments .pages{width:24px;height:24px;-ms-flex:0 0 24px;flex:0 0 24px;padding-left:4px;position:relative;margin:-10px 0 0 0}verdocs-template-attachments .pages .pages-icon{top:0;left:0;width:24px;height:24px;position:absolute}verdocs-template-attachments .pages .count{top:11px;left:7px;z-index:1;width:18px;font-size:12px;font-weight:500;position:absolute;text-align:center;letter-spacing:-2px}verdocs-template-attachments .filename{-ms-flex:1;flex:1;display:block;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;border-bottom:1px dotted #cccccc}verdocs-template-attachments .trash-icon{-ms-flex:0;flex:0;display:none}verdocs-template-attachments .trash-icon:hover{cursor:pointer}verdocs-template-attachments verdocs-file-chooser{margin:10px 0;border:2px dashed #979797}verdocs-template-attachments .loader-wrapper{background-color:#ffffff;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-webkit-box-sizing:border-box;box-sizing:border-box;position:relative;width:320px;height:320px;text-align:center;border:2px dashed #979797;-ms-flex-pack:end;justify-content:flex-end}verdocs-template-attachments .progress-wrapper{padding:20px}verdocs-template-attachments .buttons{display:-ms-flexbox;display:flex;-webkit-column-gap:8px;-moz-column-gap:8px;column-gap:8px;margin-top:16px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:end;justify-content:flex-end}verdocs-template-attachments .buttons .flex-fill{-ms-flex:1;flex:1}verdocs-template-attachments ::-webkit-input-placeholder{color:#aaaaaa}verdocs-template-attachments ::-moz-placeholder{color:#aaaaaa}verdocs-template-attachments :-ms-input-placeholder{color:#aaaaaa}verdocs-template-attachments ::-ms-input-placeholder{color:#aaaaaa}verdocs-template-attachments ::placeholder{color:#aaaaaa}'};var VerdocsTemplateAttachments=function(){function e(e){registerInstance(this,e);this.exit=createEvent(this,"exit");this.next=createEvent(this,"next");this.templateUpdated=createEvent(this,"templateUpdated");this.sdkError=createEvent(this,"sdkError");this.templateListenerId=null;this.endpoint=VerdocsEndpoint.getDefault();this.templateId="";this.uploading=false;this.progressLabel="Uploading...";this.progressPercent=0;this.showDeleteError=false;this.confirmDeleteDocument=null;this.loading=true;this.template=null}e.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,n;return __generator(this,(function(r){try{this.endpoint.loadSession();if(!this.templateId){console.log("[ROLES] Missing required template ID ".concat(this.templateId));return[2]}if(!this.endpoint.session){console.log("[ROLES] Unable to start builder session, must be authenticated");return[2]}this.listenToTemplate()}catch(r){console.log("[TEMPLATE ATTACHMENTS] Error loading template",r);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new SDKError(r.message,(t=r.response)===null||t===void 0?void 0:t.status,(n=r.response)===null||n===void 0?void 0:n.data))}return[2]}))}))};e.prototype.disconnectedCallback=function(){this.unlistenToTemplate()};e.prototype.listenToTemplate=function(){return __awaiter(this,void 0,void 0,(function(){var e=this;return __generator(this,(function(t){this.unlistenToTemplate();Store.subscribe("templates",this.templateId,(function(){return getTemplate(e.endpoint,e.templateId)}),false,(function(t){e.template=t;e.loading=false}));return[2]}))}))};e.prototype.unlistenToTemplate=function(){if(this.templateListenerId){Store.store.delListener(this.templateListenerId);this.templateListenerId=null}};e.prototype.handleCancel=function(e){e.stopPropagation();this.exit.emit()};e.prototype.handleUploadProgress=function(e){if(e>=99){this.progressPercent=100;this.progressLabel="Processing..."}else{this.progressPercent=e}};e.prototype.handleUpload=function(e){return __awaiter(this,void 0,void 0,(function(){var t,n,r,o,i,s,a,l;return __generator(this,(function(c){switch(c.label){case 0:e.stopPropagation();i=e.detail.file;if(!i){return[2]}console.log("[ATTACHMENTS] Uploading...",i);this.uploading=true;this.progressLabel="Uploading...";c.label=1;case 1:c.trys.push([1,4,,5]);return[4,createTemplateDocument(this.endpoint,this.templateId,i,this.handleUploadProgress.bind(this))];case 2:s=c.sent();console.log("[ATTACHMENTS] Created attachment",s);a=this;return[4,Store.getTemplate(this.endpoint,this.templateId,true)];case 3:a.template=c.sent();console.log("[ATTACHMENTS] Updated template",this.template);(t=this.templateUpdated)===null||t===void 0?void 0:t.emit({endpoint:this.endpoint,template:this.template,event:"attachments"});this.uploading=false;this.progressLabel="";this.progressPercent=0;return[3,5];case 4:l=c.sent();console.log("[ATTACHMENTS] Error creating template",l);(n=this.sdkError)===null||n===void 0?void 0:n.emit(new SDKError(l.message,(r=l.response)===null||r===void 0?void 0:r.status,(o=l.response)===null||o===void 0?void 0:o.data));this.uploading=false;return[3,5];case 5:return[2]}}))}))};e.prototype.handleNext=function(e){var t;e.stopPropagation();this.uploading=false;this.progressLabel="";this.progressPercent=0;(t=this.next)===null||t===void 0?void 0:t.emit({template:this.template})};e.prototype.confirmDelete=function(){return __awaiter(this,void 0,void 0,(function(){var e;return __generator(this,(function(t){switch(t.label){case 0:return[4,deleteTemplateDocument(this.endpoint,this.confirmDeleteDocument.id)];case 1:t.sent();e=this;return[4,Store.getTemplate(this.endpoint,this.templateId,true)];case 2:e.template=t.sent();console.log("[ATTACHMENTS] New template",this.template);this.confirmDeleteDocument=null;return[2]}}))}))};e.prototype.handleDelete=function(e){return __awaiter(this,void 0,void 0,(function(){var t;return __generator(this,(function(n){if((((t=this.template)===null||t===void 0?void 0:t.documents)||[]).length>1){this.confirmDeleteDocument=e}else{this.showDeleteError=true}return[2]}))}))};e.prototype.getFileIcon=function(e){switch(e.mime){case"application/pdf":return PdfIcon;case"image/jpeg":return JpgIcon;case"image/png":return PngIcon;case"application/msword":case"application/vnd.openxmlformats-officedocument.wordprocessingml.document":return DocIcon}return FileIcon};e.prototype.render=function(){var e=this;var t,n;if(!this.endpoint.session){return h(Host,null,h("verdocs-component-error",{message:"You must be authenticated to use this module."}))}if(this.loading){return h(Host,{class:"loading"},h("verdocs-loader",null))}if(!this.endpoint.session||!this.template){return h(Host,{class:"empty"})}return h(Host,null,h("h5",null,"Existing Attachments"),h("div",{class:"attachments"},(((t=this.template)===null||t===void 0?void 0:t.documents)||[]).map((function(t){return h("div",{class:"attachment"},h("div",{class:"file-icon",innerHTML:e.getFileIcon(t)}),h("div",{class:"filename",title:t.name},t.name),h("div",{class:"pages"},h("div",{class:"count"},t.pages),h("div",{class:"pages-icon",innerHTML:PageCountIcon})),h("div",{class:"trash-icon",innerHTML:TrashIcon,onClick:function(){return e.handleDelete(t)}}))}))),h("h5",null,"Attach a New Document"),this.uploading?h("div",{class:"loader-wrapper"},h("verdocs-loader",null),this.progressLabel&&h("div",{class:"progress-wrapper"},h("verdocs-progress-bar",{showPercent:true,percent:this.progressPercent,label:this.progressLabel}))):h("verdocs-file-chooser",{onFileSelected:function(t){return e.handleUpload(t)}}),h("div",{class:"buttons"},h("verdocs-button",{variant:"outline",label:"Cancel",size:"small",onClick:function(t){return e.handleCancel(t)},disabled:this.uploading}),h("verdocs-button",{label:"Next",size:"small",onClick:function(t){return e.handleNext(t)},disabled:!(((n=this.template)===null||n===void 0?void 0:n.documents)||[]).length||this.uploading})),this.showDeleteError&&h("verdocs-ok-dialog",{heading:"Unable to Delete Attachment",message:"Templates must contain at least one attachment.",onNext:function(){return e.showDeleteError=false}}),this.confirmDeleteDocument&&h("verdocs-ok-dialog",{heading:"Delete this Attachment?",message:"This operation cannot be undone. All fields placed<br />on the deleted attachment will also be removed.",onNext:function(){return e.confirmDelete()},showCancel:true,onExit:function(){e.confirmDeleteDocument=null}}))};return e}();VerdocsTemplateAttachments.style=verdocsTemplateAttachmentsCss();var verdocsTemplateBuildTabsCss=function(){return'verdocs-template-build-tabs{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:end;align-items:flex-end;-ms-flex:0 0 50px;flex:0 0 50px;width:100%;background:#ffffff;color:#72757d;border-bottom:1px solid #dddddd;-webkit-filter:drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));filter:drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));font-family:var(--verdocs-primary-font, "Inter", "Barlow", sans-serif)}verdocs-template-build-tabs .tab{position:relative;display:-ms-flexbox;display:flex;-ms-flex:1;flex:1;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;height:50px;padding:0 4px;background:#e7e7e7;font-weight:700;font-size:12px;cursor:pointer}@media (min-width: 768px){verdocs-template-build-tabs .tab{padding:0 8px 0 24px;font-size:14px}}verdocs-template-build-tabs .tab svg{position:absolute;top:0;right:-19px;z-index:10;pointer-events:none;display:none}@media (min-width: 768px){verdocs-template-build-tabs .tab svg{display:block}}verdocs-template-build-tabs .tab.active{background:#ffffff;color:#707ae5}verdocs-template-build-tabs .tab.disabled{cursor:default;color:#d1d5db}'};var VerdocsTemplateBuildTabs=function(){function e(e){registerInstance(this,e);this.sdkError=createEvent(this,"sdkError");this.stepChanged=createEvent(this,"stepChanged");this.templateListenerId=null;this.endpoint=VerdocsEndpoint.getDefault();this.templateId=null;this.step="preview";this.loading=true;this.template=null}e.prototype.disconnectedCallback=function(){this.unlistenToTemplate()};e.prototype.listenToTemplate=function(){return __awaiter(this,void 0,void 0,(function(){var e=this;return __generator(this,(function(t){this.unlistenToTemplate();Store.subscribe("templates",this.templateId,(function(){return getTemplate(e.endpoint,e.templateId)}),false,(function(t){e.template=t;e.loading=false}));return[2]}))}))};e.prototype.unlistenToTemplate=function(){if(this.templateListenerId){Store.store.delListener(this.templateListenerId);this.templateListenerId=null}};e.prototype.onTemplateIdChanged=function(e){console.log("[BUILD_TABS] Template ID changed",e);this.listenToTemplate()};e.prototype.onStepChanged=function(e){console.log("[BUILD_TABS] Step changed",e)};e.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,n;return __generator(this,(function(r){try{this.endpoint.loadSession();if(!this.endpoint.session){console.log("[BUILD_TABS] Unable to start builder session, must be authenticated");return[2]}if(!this.templateId){this.step="attachments";console.log("[BUILD_TABS] Missing required template ID, forcing view to attachments");return[2]}this.listenToTemplate()}catch(r){console.log("[BUILD_TABS] Error loading template",r);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new SDKError(r.message,(t=r.response)===null||t===void 0?void 0:t.status,(n=r.response)===null||n===void 0?void 0:n.data))}return[2]}))}))};e.prototype.handleSelect=function(e){var t;if(e.disabled||e.id===this.step){return}this.step=e.id;(t=this.stepChanged)===null||t===void 0?void 0:t.emit(e.id)};e.prototype.render=function(){var e=this;var t,n,r;if(this.loading){return h(Host,null,h("verdocs-loader",null))}if(!this.endpoint.session){return h(Host,null,h("verdocs-component-error",{message:"You must be authenticated to use this module."}))}var o=(((t=this.template)===null||t===void 0?void 0:t.documents)||[]).length>0;var i=o&&(((n=this.template)===null||n===void 0?void 0:n.roles)||[]).length>0;var s=i&&(((r=this.template)===null||r===void 0?void 0:r.fields)||[]).length>0;var a=[{id:"attachments",label:"Attachments",disabled:false},{id:"roles",label:"Workflow",disabled:!o},{id:"fields",label:"Fields",disabled:!i},{id:"preview",label:"Preview & Send",disabled:!s}];return h(Host,null,a.map((function(t){var n=t.id===e.step;var r=["tab"];if(n)r.push("active");if(t.disabled)r.push("disabled");return h("div",{class:r.join(" "),onClick:function(){return e.handleSelect(t)}},h("span",null,t.label),h("svg",{"aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",width:"19",height:"50",viewBox:"0 0 19 50"},h("polygon",{points:"0,0 19,25 0,50",fill:n?"#ffffff":"#e7e7e7"})))})))};Object.defineProperty(e,"watchers",{get:function(){return{templateId:[{onTemplateIdChanged:0}],step:[{onStepChanged:0}]}},enumerable:false,configurable:true});return e}();VerdocsTemplateBuildTabs.style=verdocsTemplateBuildTabsCss();var verdocsTemplateFieldsCss=function(){return"verdocs-template-fields{font-family:var(--verdocs-primary-font, \"Inter\", \"Barlow\", 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 .pages .document-separator{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;gap:10px;padding:12px 20px;width:100%;-webkit-box-sizing:border-box;box-sizing:border-box;background-color:#33364b;color:white;border-radius:6px;font-size:16px;font-weight:500;margin-top:20px;-webkit-box-shadow:0 2px 4px rgba(0, 0, 0, 0.1);box-shadow:0 2px 4px rgba(0, 0, 0, 0.1)}verdocs-template-fields .pages .document-separator svg{-ms-flex-negative:0;flex-shrink:0}verdocs-template-fields .pages .document-separator:first-child{margin-top:0}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}"};var 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>';var iconCheck='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" 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"/></svg>';var iconRadio='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" 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"/></svg>';var iconDatepicker='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" 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"/></svg>';var iconSignature='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" 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>';var iconInitial='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="M6.225 20.775V7h-5V3.225H15V7h-5v13.775Zm9.775 0v-8h-3V9h9.775v3.775h-3v8Z"/></svg>';var iconDropdown='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24" stroke-width="1.5" stroke="currentColor"><path stroke="#ffffff" 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" /></svg>';var iconAttachment='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-6"><path stroke-linecap="round" stroke-linejoin="round" d="m18.375 12.739-7.693 7.693a4.5 4.5 0 0 1-6.364-6.364l10.94-10.94A3 3 0 1 1 19.5 7.372L8.552 18.32m.009-.01-.01.01m5.699-9.941-7.81 7.81a1.5 1.5 0 0 0 2.112 2.13" /></svg>';var separator='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14.707 14.707"><g><rect x="6.275" y="0" fill="#ffffff7f" width="1" height="15"/></g></svg>';var menuOptions=[{id:"signature",tooltip:"Signature",icon:iconSignature,class:"signature"},{id:"initial",tooltip:"Initials",icon:iconInitial,class:"initial"},{id:"sep1",tooltip:"",icon:separator,class:"separator"},{id:"textbox",tooltip:"Text Box",icon:iconTextbox,class:"textbox"},{id:"checkbox",tooltip:"Check Box",icon:iconCheck,class:"checkbox"},{id:"radio",tooltip:"Radio Button",icon:iconRadio,class:"radio"},{id:"dropdown",tooltip:"Dropdown",icon:iconDropdown,class:"dropdown"},{id:"sep2",tooltip:"",icon:separator,class:"separator"},{id:"date",tooltip:"Date",icon:iconDatepicker,class:"date"},{id:"attachment",tooltip:"Attachment",icon:iconAttachment,class:"attachment"}];var VerdocsTemplateFields=function(){function e(e){registerInstance(this,e);this.sdkError=createEvent(this,"sdkError");this.templateUpdated=createEvent(this,"templateUpdated");this.templateListenerId=null;this.endpoint=VerdocsEndpoint.getDefault();this.templateId=null;this.toolbarTargetId=null;this.placing=null;this.showMustSelectRole=false;this.selectedRoleName="";this.loading=true;this.template=null;this.pageHeights={};this.cachedPageInfo={}}e.prototype.onTemplateIdChanged=function(){this.listenToTemplate()};e.prototype.handleKeyDown=function(e){if(e.key==="Escape"){this.placing=null}};e.prototype.handleFieldSettingsChanged=function(){var e;(e=this.templateUpdated)===null||e===void 0?void 0:e.emit({endpoint:this.endpoint,template:this.template,event:"updated-field"})};e.prototype.handleFieldDeleted=function(){var e;(e=this.templateUpdated)===null||e===void 0?void 0:e.emit({endpoint:this.endpoint,template:this.template,event:"deleted-field"})};e.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,n;return __generator(this,(function(r){try{this.endpoint.loadSession();if(!this.templateId){console.log("[FIELDS] Missing required template ID ".concat(this.templateId));return[2]}if(!this.endpoint.session){console.log("[FIELDS] Unable to start builder session, must be authenticated");return[2]}this.listenToTemplate()}catch(r){console.log("[FIELDS] Error with fields session",r);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new SDKError(r.message,(t=r.response)===null||t===void 0?void 0:t.status,(n=r.response)===null||n===void 0?void 0:n.data))}return[2]}))}))};e.prototype.componentDidRender=function(){var e=this;interact.dynamicDrop(true);document.querySelectorAll(".verdocs-field").forEach((function(t){e.makeDraggable(t)}));var t=this.toolbarTargetId?document.getElementById(this.toolbarTargetId):null;var n=document.getElementById("verdocs-template-fields-toolbar");if(t&&n){n.remove();t.append(n)}};e.prototype.componentWillUpdate=function(){var e=this;var t,n;var r=__spreadArray([],((t=this.template)===null||t===void 0?void 0:t.roles)||[],true).sort((function(e,t){var n,r;return((n=e.sequence)!==null&&n!==void 0?n:0)-((r=t.sequence)!==null&&r!==void 0?r:0)}));if(!this.selectedRoleName||!r.find((function(t){return t&&t.name===e.selectedRoleName}))){this.selectedRoleName=((n=r[0])===null||n===void 0?void 0:n.name)||"";console.log("[FIELDS] Selected new role",this.selectedRoleName)}};e.prototype.disconnectedCallback=function(){this.unlistenToTemplate()};e.prototype.listenToTemplate=function(){return __awaiter(this,void 0,void 0,(function(){var e=this;return __generator(this,(function(t){this.unlistenToTemplate();Store.subscribe("templates",this.templateId,(function(){return getTemplate(e.endpoint,e.templateId)}),false,(function(t){var n;console.log("Template updated");e.template=t;e.loading=false;if(!e.selectedRoleName){var r=__spreadArray([],t.roles||[],true).sort((function(e,t){var n,r;return((n=e.sequence)!==null&&n!==void 0?n:0)-((r=t.sequence)!==null&&r!==void 0?r:0)}));e.selectedRoleName=((n=r[0])===null||n===void 0?void 0:n.name)||""}}));return[2]}))}))};e.prototype.unlistenToTemplate=function(){if(this.templateListenerId){Store.store.delListener(this.templateListenerId);this.templateListenerId=null}};e.prototype.handlePageRendered=function(e){var t=this;var n,r;var o,i;var s=e.detail;console.log("[FIELDS] Page rendered",s.documentId,s.pageNumber,s.xScale,s.yScale);(n=(o=this.cachedPageInfo)[i=s.documentId])!==null&&n!==void 0?n:o[i]={};this.cachedPageInfo[s.documentId][s.pageNumber]=s;this.pageHeights[s.pageNumber]=s.naturalHeight;(((r=this.template)===null||r===void 0?void 0:r.fields)||[]).filter((function(e){return e&&e.page===s.pageNumber})).forEach((function(e){var n=getFieldId(e);var r=document.getElementById(n);if(r){r.setAttribute("templateid",t.templateId);r.setAttribute("fieldname",e.name);r.setAttribute("documentid",String(e.document_id));r.setAttribute("pagenumber",String(e.page));r.setAttribute("xScale",String(s.xScale));r.setAttribute("yScale",String(s.yScale));t.makeDraggable(r)}}))};e.prototype.makeDraggable=function(e){interact(e).draggable({listeners:{move:this.handleMoveField.bind(this),end:this.handleMoveEnd.bind(this)}})};e.prototype.handleMoveField=function(e){return __awaiter(this,void 0,void 0,(function(){var t,n,r,o,i,s;return __generator(this,(function(a){t=+(e.target.getAttribute("posX")||0);n=+(e.target.getAttribute("posY")||0);r=+(e.target.getAttribute("xScale")||1);o=+(e.target.getAttribute("yScale")||1);i=e.dx/r+t;s=e.dy/o+n;e.target.setAttribute("posX",i);e.target.setAttribute("posy",s);updateCssTransform(e.target,"translate","".concat(i,"px, ").concat(s,"px"));return[2]}))}))};e.prototype.handleMoveEnd=function(e){return __awaiter(this,void 0,void 0,(function(){var t,n,r,o,i,s,a,l,c,d,u,f,h,v,p,g,m,x,b,E,w,S,_,y,I,C,T,k,D,q,M,R,A,O,P,H,L,V,z,Z;return __generator(this,(function(j){switch(j.label){case 0:c=e.target.getAttribute("fieldname");d=(((t=this.template)===null||t===void 0?void 0:t.fields)||[]).find((function(e){return e.name===c}));if(!d){console.log("[FIELDS] Unable to find field",c,e.target);return[2]}u=e.target.getAttribute("pagenumber");f=e.target.getAttribute("documentid");h=this.cachedPageInfo[f][u],v=h.naturalWidth,p=v===void 0?612:v,g=h.naturalHeight,m=g===void 0?792:g,x=h.renderedHeight,b=x===void 0?792:x;E=e.target.getBoundingClientRect();w=e.target.parentElement;S=w.getBoundingClientRect();_=d.width||defaultWidth(d.type);y=d.height||defaultHeight(d.type);I=Math.max(E.left-S.left,0);C=Math.max(b-(S.bottom-E.bottom),0);T=parseInt(u);if(C>b){T=Math.min(T+1,((o=(r=((n=this.template)===null||n===void 0?void 0:n.documents)||[])===null||r===void 0?void 0:r[0])===null||o===void 0?void 0:o.pages)||1);C-=b;b=this.cachedPageInfo[f][T].renderedHeight;console.log("Next page",{newPageNumber:T,newY:C,renderedHeight:b})}else if(C<0){T=Math.max(T-1,1);b=this.cachedPageInfo[f][T].renderedHeight;C+=b;console.log("[FIELDS] Next page",{newPageNumber:T,newY:C,renderedHeight:b})}k=this.viewCoordinatesToPageCoordinates(I,C,f,u,p-_,m-y),D=k.x,q=k.y;j.label=1;case 1:j.trys.push([1,3,,4]);M={x:D,y:q,page:T};return[4,updateField(this.endpoint,this.templateId,c,M)];case 2:R=j.sent();console.log("[FIELDS] Updated",R);A=JSON.parse(JSON.stringify(this.template));O=A.fields.findIndex((function(e){return e.name===c}));if(O>-1){A.fields[O]=R}Store.updateTemplate(this.templateId,A);e.target.removeAttribute("posX");e.target.removeAttribute("posY");removeCssTransform(e.target);P=this.cachedPageInfo[f][u],H=P.xScale,L=H===void 0?1:H,V=P.yScale,z=V===void 0?1:V;setControlStyles(e.target,R,L,z);(i=this.templateUpdated)===null||i===void 0?void 0:i.emit({endpoint:this.endpoint,template:A,event:"updated-field"});return[3,4];case 3:Z=j.sent();VerdocsToast("Error updating field, please try again later",{style:"error"});console.log("[FIELDS] Error updating field",Z);(s=this.sdkError)===null||s===void 0?void 0:s.emit(new SDKError(Z.message,(a=Z.response)===null||a===void 0?void 0:a.status,(l=Z.response)===null||l===void 0?void 0:l.data));e.target.removeAttribute("posX");e.target.removeAttribute("posY");removeCssTransform(e.target);return[3,4];case 4:return[2]}}))}))};e.prototype.generateFieldName=function(e,t){var n;var r=1;var o;do{o="".concat(e,"P").concat(t,"-").concat(r);r++}while((((n=this.template)===null||n===void 0?void 0:n.fields)||[]).some((function(e){return e&&e.name===o})));return o};e.prototype.viewCoordinatesToPageCoordinates=function(e,t,n,r,o,i){var s=this.cachedPageInfo[n][r],a=s.xScale,l=a===void 0?1:a,c=s.yScale,d=c===void 0?1:c,u=s.renderedHeight,f=u===void 0?792:u;var h=Math.floor(Math.min(e/l,o));var v=Math.floor(Math.min(Math.max(f-t,0)/d,i));return{x:h,y:v}};e.prototype.handleClickPage=function(e,t,n){return __awaiter(this,void 0,void 0,(function(){var r,o,i,s,a,l,c,d,u,f,h,v,p,g,m,x;return __generator(this,(function(b){switch(b.label){case 0:if(!this.placing)return[3,2];o=e.offsetX;i=e.offsetY;s=defaultWidth(this.placing);a=defaultHeight(this.placing);l=this.cachedPageInfo[t][n];c=l.naturalWidth,d=c===void 0?612:c,u=l.naturalHeight,f=u===void 0?792:u;h=this.viewCoordinatesToPageCoordinates(o,i,t,n,d-s,f-a);v=Math.floor(h.x);p=Math.floor(h.y);g={name:this.generateFieldName(this.placing,n),role_name:this.selectedRoleName,template_id:this.templateId,document_id:l.documentId,type:this.placing,required:this.placing!=="radio"&&this.placing!=="attachment"&&this.placing!=="checkbox",page:n,validator:null,label:null,default:null,placeholder:null,group:null,settings:{},x:v,y:p,width:s,height:a,multiline:false,readonly:false,options:this.placing==="radio"?[{id:"option-1",label:"Option 1"}]:[]};return[4,createField(this.endpoint,this.templateId,g)];case 1:m=b.sent();console.log("[FIELDS] Created field",m);x=JSON.parse(JSON.stringify(this.template));x.fields.push(m);Store.updateTemplate(this.templateId,x);(r=this.templateUpdated)===null||r===void 0?void 0:r.emit({endpoint:this.endpoint,template:x,event:"added-field"});this.placing=null;b.label=2;case 2:return[2]}}))}))};e.prototype.render=function(){var e;var t=this;var n,r,o;console.log("Rendering");if(this.loading){return h(Host,null,h("verdocs-loader",null))}if(!this.endpoint.session){return h(Host,null,h("verdocs-component-error",{message:"You must be authenticated to use this module."}))}var i=__spreadArray([],((n=this.template)===null||n===void 0?void 0:n.roles)||[],true).sort((function(e,t){var n,r;return((n=e.sequence)!==null&&n!==void 0?n:0)-((r=t.sequence)!==null&&r!==void 0?r:0)}));var s=i.map((function(e){return{value:e.name,label:e.full_name?"".concat(e.name,": ").concat(e.full_name):e.name}}));return h(Host,{class:this.placing?(e={},e["placing-".concat(this.placing)]=true,e):{},onSubmit:function(){}},h("div",{id:"verdocs-template-fields-toolbar"},h("div",{class:"add-for"},"Add field:"),h("verdocs-select-input",{value:this.selectedRoleName,options:s,onInput:function(e){return t.selectedRoleName=e.target.value}}),menuOptions.map((function(e){return h("verdocs-toolbar-icon",{text:e.tooltip,icon:e.icon,class:e.class,onClick:function(){if(e.tooltip){if(t.selectedRoleName){t.placing=e.id}else{t.showMustSelectRole=true}}}})}))),h("div",{class:"pages"},(((r=this.template)===null||r===void 0?void 0:r.documents)||[]).map((function(e){var n=integerSequence(1,e.pages);return n.map((function(n){var r;var o=e.page_sizes[n];return h(Fragment,null,((r=t.template)===null||r===void 0?void 0:r.documents.length)>1&&h("div",{class:"document-separator"},h("div",{innerHTML:DocumentPageIcon}),h("span",null,e.name)),h("verdocs-template-document-page",{templateId:t.templateId,documentId:e.id,pageNumber:n,virtualWidth:(o===null||o===void 0?void 0:o.width)||612,virtualHeight:(o===null||o===void 0?void 0:o.height)||792,disabled:true,editable:true,done:false,onClick:function(r){return t.handleClickPage(r,e.id,n)},onPageRendered:function(e){return t.handlePageRendered(e)},layers:[{name:"page",type:"canvas"},{name:"controls",type:"div"}]}))}))}))),this.showMustSelectRole&&h("verdocs-ok-dialog",{heading:"Unable to add field",message:(((o=this.template)===null||o===void 0?void 0:o.roles)||[]).length>0?"Please select a role before adding fields.":"Please add at least one role before adding fields.",onNext:function(){return t.showMustSelectRole=false}}))};Object.defineProperty(e,"watchers",{get:function(){return{templateId:[{onTemplateIdChanged:0}]}},enumerable:false,configurable:true});return e}();VerdocsTemplateFields.style=verdocsTemplateFieldsCss();
2
2
  /**!
3
3
  * Sortable 1.15.7
4
4
  * @author RubaXa <trash@rubaxa.org>