@verdocs/web-sdk 5.0.3 → 5.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{Datastore-b1742da2.js → Datastore-5b860927.js} +2 -2
- package/dist/cjs/index-ccac8641.js +4 -4
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/verdocs-build.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-button_2.cjs.entry.js +2 -2
- package/dist/cjs/verdocs-checkbox_6.cjs.entry.js +8 -8
- package/dist/cjs/verdocs-contact-picker_2.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-dialog.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-envelope-document-page.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-envelope-recipient-link_2.cjs.entry.js +3 -3
- package/dist/cjs/verdocs-envelope-recipient-summary.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-envelope-sidebar.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-envelopes-list.cjs.entry.js +6 -6
- package/dist/cjs/verdocs-field-attachment_13.cjs.entry.js +4 -4
- package/dist/cjs/verdocs-field-payment.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-file-chooser_2.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-kba-dialog_2.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-menu-panel_2.cjs.entry.js +241 -0
- package/dist/cjs/verdocs-ok-dialog.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-organization-card_2.cjs.entry.js +2 -2
- package/dist/cjs/verdocs-pagination_2.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-preview_6.cjs.entry.js +2836 -156
- package/dist/cjs/verdocs-quick-functions.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-radio-button.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-search-tabs.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-spinner.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-status-indicator.cjs.entry.js +2 -2
- package/dist/cjs/verdocs-template-card.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-template-document-page_2.cjs.entry.js +2 -2
- package/dist/cjs/verdocs-template-star.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-template-tags.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-web-sdk.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/controls/verdocs-help-icon/verdocs-help-icon.css +1 -1
- package/dist/collection/components/controls/verdocs-help-icon/verdocs-help-icon.js +1 -1
- package/dist/collection/components/controls/verdocs-menu-panel/verdocs-menu-panel.css +42 -0
- package/dist/collection/components/controls/verdocs-menu-panel/verdocs-menu-panel.js +159 -0
- package/dist/collection/components/controls/verdocs-organization-card/verdocs-organization-card.js +1 -1
- package/dist/collection/components/controls/verdocs-pagination/verdocs-pagination.js +1 -1
- package/dist/collection/components/controls/verdocs-portal/verdocs-portal.js +1 -1
- package/dist/collection/components/controls/verdocs-progress-bar/verdocs-progress-bar.js +1 -1
- package/dist/collection/components/controls/verdocs-radio-button/verdocs-radio-button.js +1 -1
- package/dist/collection/components/controls/verdocs-select-input/verdocs-select-input.css +2 -2
- package/dist/collection/components/controls/verdocs-select-input/verdocs-select-input.js +1 -1
- package/dist/collection/components/controls/verdocs-spinner/verdocs-spinner.js +1 -1
- package/dist/collection/components/controls/verdocs-switch/verdocs-switch.js +2 -2
- package/dist/collection/components/controls/verdocs-text-input/verdocs-text-input.css +2 -2
- package/dist/collection/components/controls/verdocs-text-input/verdocs-text-input.js +4 -4
- package/dist/collection/components/controls/verdocs-toggle-button/verdocs-toggle-button.js +1 -1
- package/dist/collection/components/controls/verdocs-toolbar-icon/verdocs-toolbar-icon.js +1 -1
- package/dist/collection/components/dialogs/verdocs-dialog/verdocs-dialog.js +1 -1
- package/dist/collection/components/dialogs/verdocs-initial-dialog/verdocs-initial-dialog.js +1 -1
- package/dist/collection/components/dialogs/verdocs-ok-dialog/verdocs-ok-dialog.js +1 -1
- package/dist/collection/components/dialogs/verdocs-signature-dialog/verdocs-signature-dialog.js +1 -1
- package/dist/collection/components/dialogs/verdocs-upload-dialog/verdocs-upload-dialog.js +1 -1
- package/dist/collection/components/elements/verdocs-quick-functions/verdocs-quick-functions.js +1 -1
- package/dist/collection/components/elements/verdocs-search-tabs/verdocs-search-tabs.js +1 -1
- package/dist/collection/components/envelopes/verdocs-envelope-document-page/verdocs-envelope-document-page.js +1 -1
- package/dist/collection/components/envelopes/verdocs-envelopes-list/verdocs-envelopes-list.js +6 -6
- package/dist/collection/components/envelopes/verdocs-status-indicator/verdocs-status-indicator.js +2 -2
- package/dist/collection/components/templates/verdocs-template-card/verdocs-template-card.js +1 -1
- package/dist/collection/components/templates/verdocs-template-role-properties/verdocs-template-role-properties.css +27 -42
- package/dist/collection/components/templates/verdocs-template-role-properties/verdocs-template-role-properties.js +12 -14
- package/dist/collection/components/templates/verdocs-template-roles/verdocs-template-roles.css +74 -120
- package/dist/collection/components/templates/verdocs-template-roles/verdocs-template-roles.js +118 -101
- package/dist/collection/components/templates/verdocs-template-star/verdocs-template-star.js +1 -1
- package/dist/collection/components/templates/verdocs-template-tags/verdocs-template-tags.js +1 -1
- package/dist/collection/utils/Datastore.js +2 -2
- package/dist/components/index.js +2 -0
- package/dist/components/{p-ed88b8d2.js → p-005c3387.js} +3 -3
- package/dist/components/{p-0d063bf9.js → p-052fcdac.js} +4 -4
- package/dist/components/{p-0a69031f.js → p-053a0408.js} +6 -6
- package/dist/components/{p-1c2cf1be.js → p-15b1e7a0.js} +10 -8
- package/dist/components/{p-293ea62f.js → p-1a77c51b.js} +5 -5
- package/dist/components/{p-f990140a.js → p-2ef2d490.js} +2 -2
- package/dist/components/{p-c8fedb4e.js → p-325b3828.js} +6 -6
- package/dist/components/{p-6315b90f.js → p-332a97b3.js} +1 -1
- package/dist/components/{p-b0c02eb8.js → p-3a621e5d.js} +7 -7
- package/dist/components/{p-18999830.js → p-41a75ad6.js} +1 -1
- package/dist/components/{p-5eb45a4f.js → p-44ae3c75.js} +1 -1
- package/dist/components/{p-1e2e8b1c.js → p-4d3b9ee9.js} +1 -1
- package/dist/components/{p-1e67ebdf.js → p-53585e13.js} +18 -26
- package/dist/components/{p-c7b00ce6.js → p-5654568d.js} +1 -1
- package/dist/components/{p-ecc818bb.js → p-5df09a0d.js} +6 -6
- package/dist/components/{p-315d6592.js → p-62743fd3.js} +2 -2
- package/dist/components/{p-dd701894.js → p-6506ddb4.js} +6 -6
- package/dist/components/{p-5d4bbcd0.js → p-6719b0d7.js} +1 -1
- package/dist/components/{p-d9704a51.js → p-6c18617e.js} +6 -6
- package/dist/components/p-6e8464b6.js +3028 -0
- package/dist/components/{p-fd96322b.js → p-7246d2ee.js} +6 -6
- package/dist/components/{p-0ca7012b.js → p-7f32e087.js} +2 -2
- package/dist/components/{p-9b3c58d9.js → p-987a8392.js} +22 -22
- package/dist/components/{p-b9034018.js → p-9c0b30f8.js} +3 -3
- package/dist/components/{p-b16c202a.js → p-9cfd8022.js} +1 -1
- package/dist/components/{p-a3e12c74.js → p-9fb98ea2.js} +1 -1
- package/dist/components/{p-f72b9c45.js → p-a2f6d2c6.js} +1 -1
- package/dist/components/{p-1ca705bc.js → p-b36c979b.js} +6 -6
- package/dist/{esm/Datastore-52fcbac6.js → components/p-b712e729.js} +2 -2
- package/dist/components/{p-cf6ea837.js → p-b7d080eb.js} +1 -1
- package/dist/components/p-be261487.js +79 -0
- package/dist/components/{p-9bb47a5a.js → p-c00770e6.js} +1 -1
- package/dist/components/{p-4afcdc84.js → p-c9a4ef35.js} +6 -6
- package/dist/components/{p-9c3fd545.js → p-ca8e3721.js} +8 -8
- package/dist/components/{p-5a9cea40.js → p-cce871bf.js} +3 -3
- package/dist/components/{p-df3afaa8.js → p-cef9df4b.js} +20 -20
- package/dist/components/{p-74452a2b.js → p-d9074622.js} +3 -3
- package/dist/components/{p-d25cdbff.js → p-f0f1ed82.js} +21 -21
- package/dist/components/{p-58c2bd5d.js → p-f0f6e862.js} +2 -2
- package/dist/components/{p-49153610.js → p-f21ef4fb.js} +7 -7
- package/dist/components/{p-fcad60f5.js → p-f4e068a9.js} +2 -2
- package/dist/components/{p-2548f3f0.js → p-f7462b26.js} +1 -1
- package/dist/components/verdocs-auth.js +2 -2
- package/dist/components/verdocs-build.js +64 -58
- package/dist/components/verdocs-contact-picker.js +1 -1
- package/dist/components/verdocs-dialog.js +1 -1
- package/dist/components/verdocs-dropdown.js +1 -1
- package/dist/components/verdocs-envelope-document-page.js +1 -1
- package/dist/components/verdocs-envelope-recipient-link.js +1 -1
- package/dist/components/verdocs-envelope-recipient-summary.js +1 -1
- package/dist/components/verdocs-envelope-sidebar.js +8 -8
- package/dist/components/verdocs-envelopes-list.js +13 -13
- package/dist/components/verdocs-field-attachment.js +1 -1
- package/dist/components/verdocs-field-checkbox.js +1 -1
- package/dist/components/verdocs-field-date.js +1 -1
- package/dist/components/verdocs-field-dropdown.js +1 -1
- package/dist/components/verdocs-field-initial.js +1 -1
- package/dist/components/verdocs-field-payment.js +6 -6
- package/dist/components/verdocs-field-radio.js +1 -1
- package/dist/components/verdocs-field-signature.js +1 -1
- package/dist/components/verdocs-field-textarea.js +1 -1
- package/dist/components/verdocs-field-textbox.js +1 -1
- package/dist/components/verdocs-field-timestamp.js +1 -1
- package/dist/components/verdocs-help-icon.js +1 -1
- package/dist/components/verdocs-initial-dialog.js +1 -1
- package/dist/components/verdocs-menu-panel.d.ts +11 -0
- package/dist/components/verdocs-menu-panel.js +6 -0
- package/dist/components/verdocs-ok-dialog.js +1 -1
- package/dist/components/verdocs-organization-card.js +2 -2
- package/dist/components/verdocs-pagination.js +1 -1
- package/dist/components/verdocs-portal.js +1 -1
- package/dist/components/verdocs-preview.js +1 -1
- package/dist/components/verdocs-progress-bar.js +1 -1
- package/dist/components/verdocs-quick-functions.js +1 -1
- package/dist/components/verdocs-radio-button.js +1 -1
- package/dist/components/verdocs-search-tabs.js +1 -1
- package/dist/components/verdocs-select-input.js +1 -1
- package/dist/components/verdocs-send.js +1 -1
- package/dist/components/verdocs-sign.js +6 -6
- package/dist/components/verdocs-signature-dialog.js +1 -1
- package/dist/components/verdocs-spinner.js +1 -1
- package/dist/components/verdocs-status-indicator.js +1 -1
- package/dist/components/verdocs-switch.js +1 -1
- package/dist/components/verdocs-template-attachments.js +1 -1
- package/dist/components/verdocs-template-build-tabs.js +1 -1
- package/dist/components/verdocs-template-card.js +1 -1
- package/dist/components/verdocs-template-create.js +1 -1
- package/dist/components/verdocs-template-document-page.js +1 -1
- package/dist/components/verdocs-template-field-properties.js +1 -1
- package/dist/components/verdocs-template-fields.js +1 -1
- package/dist/components/verdocs-template-role-properties.js +1 -1
- package/dist/components/verdocs-template-roles.js +1 -1
- package/dist/components/verdocs-template-star.js +1 -1
- package/dist/components/verdocs-template-tags.js +1 -1
- package/dist/components/verdocs-templates-list.js +8 -8
- package/dist/components/verdocs-text-input.js +1 -1
- package/dist/components/verdocs-toggle-button.js +1 -1
- package/dist/components/verdocs-toolbar-icon.js +1 -1
- package/dist/components/verdocs-upload-dialog.js +1 -1
- package/dist/components/verdocs-view.js +1 -1
- package/dist/{components/p-da4d4eed.js → esm/Datastore-d29d4aeb.js} +2 -2
- package/dist/esm/index-272d51a4.js +4 -4
- package/dist/esm/loader.js +1 -1
- package/dist/esm/verdocs-build.entry.js +1 -1
- package/dist/esm/verdocs-button_2.entry.js +2 -2
- package/dist/esm/verdocs-checkbox_6.entry.js +8 -8
- package/dist/esm/verdocs-contact-picker_2.entry.js +1 -1
- package/dist/esm/verdocs-dialog.entry.js +1 -1
- package/dist/esm/verdocs-envelope-document-page.entry.js +1 -1
- package/dist/esm/verdocs-envelope-recipient-link_2.entry.js +3 -3
- package/dist/esm/verdocs-envelope-recipient-summary.entry.js +1 -1
- package/dist/esm/verdocs-envelope-sidebar.entry.js +1 -1
- package/dist/esm/verdocs-envelopes-list.entry.js +6 -6
- package/dist/esm/verdocs-field-attachment_13.entry.js +4 -4
- package/dist/esm/verdocs-field-payment.entry.js +1 -1
- package/dist/esm/verdocs-file-chooser_2.entry.js +1 -1
- package/dist/esm/verdocs-kba-dialog_2.entry.js +1 -1
- package/dist/esm/verdocs-menu-panel_2.entry.js +236 -0
- package/dist/esm/verdocs-ok-dialog.entry.js +1 -1
- package/dist/esm/verdocs-organization-card_2.entry.js +2 -2
- package/dist/esm/verdocs-pagination_2.entry.js +1 -1
- package/dist/esm/verdocs-preview_6.entry.js +2784 -104
- package/dist/esm/verdocs-quick-functions.entry.js +1 -1
- package/dist/esm/verdocs-radio-button.entry.js +1 -1
- package/dist/esm/verdocs-search-tabs.entry.js +1 -1
- package/dist/esm/verdocs-spinner.entry.js +1 -1
- package/dist/esm/verdocs-status-indicator.entry.js +2 -2
- package/dist/esm/verdocs-template-card.entry.js +1 -1
- package/dist/esm/verdocs-template-document-page_2.entry.js +2 -2
- package/dist/esm/verdocs-template-star.entry.js +1 -1
- package/dist/esm/verdocs-template-tags.entry.js +1 -1
- package/dist/esm/verdocs-web-sdk.js +1 -1
- package/dist/esm-es5/{Datastore-52fcbac6.js → Datastore-d29d4aeb.js} +1 -1
- package/dist/esm-es5/index-272d51a4.js +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/verdocs-build.entry.js +1 -1
- package/dist/esm-es5/verdocs-button_2.entry.js +1 -1
- package/dist/esm-es5/verdocs-checkbox_6.entry.js +1 -1
- package/dist/esm-es5/verdocs-contact-picker_2.entry.js +1 -1
- package/dist/esm-es5/verdocs-dialog.entry.js +1 -1
- package/dist/esm-es5/verdocs-envelope-document-page.entry.js +1 -1
- package/dist/esm-es5/verdocs-envelope-recipient-link_2.entry.js +1 -1
- package/dist/esm-es5/verdocs-envelope-recipient-summary.entry.js +1 -1
- package/dist/esm-es5/verdocs-envelope-sidebar.entry.js +1 -1
- package/dist/esm-es5/verdocs-envelopes-list.entry.js +1 -1
- package/dist/esm-es5/verdocs-field-attachment_13.entry.js +1 -1
- package/dist/esm-es5/verdocs-field-payment.entry.js +1 -1
- package/dist/esm-es5/verdocs-file-chooser_2.entry.js +1 -1
- package/dist/esm-es5/verdocs-kba-dialog_2.entry.js +1 -1
- package/dist/esm-es5/verdocs-menu-panel_2.entry.js +1 -0
- package/dist/esm-es5/verdocs-ok-dialog.entry.js +1 -1
- package/dist/esm-es5/verdocs-organization-card_2.entry.js +1 -1
- package/dist/esm-es5/verdocs-pagination_2.entry.js +1 -1
- package/dist/esm-es5/verdocs-preview_6.entry.js +7 -1
- package/dist/esm-es5/verdocs-quick-functions.entry.js +1 -1
- package/dist/esm-es5/verdocs-radio-button.entry.js +1 -1
- package/dist/esm-es5/verdocs-search-tabs.entry.js +1 -1
- package/dist/esm-es5/verdocs-spinner.entry.js +1 -1
- package/dist/esm-es5/verdocs-status-indicator.entry.js +1 -1
- package/dist/esm-es5/verdocs-template-card.entry.js +1 -1
- package/dist/esm-es5/verdocs-template-document-page_2.entry.js +1 -1
- package/dist/esm-es5/verdocs-template-star.entry.js +1 -1
- package/dist/esm-es5/verdocs-template-tags.entry.js +1 -1
- package/dist/esm-es5/verdocs-web-sdk.js +1 -1
- package/dist/types/components/controls/verdocs-menu-panel/verdocs-menu-panel.d.ts +38 -0
- package/dist/types/components/templates/verdocs-template-role-properties/verdocs-template-role-properties.d.ts +1 -1
- package/dist/types/components/templates/verdocs-template-roles/verdocs-template-roles.d.ts +5 -3
- package/dist/types/components.d.ts +101 -8
- package/dist/verdocs-web-sdk/{p-65c5398e.entry.js → p-152b9acd.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-c9f40726.system.entry.js → p-1d5b9103.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-3364cc13.system.entry.js → p-1e191c20.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-7464b84f.entry.js → p-1e495c60.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-192403ff.entry.js → p-2224ca6d.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-5b541da2.entry.js → p-27da4a2b.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-914e131c.system.entry.js → p-2eae32d9.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/p-306bde40.system.entry.js +1 -0
- package/dist/verdocs-web-sdk/{p-0e9de098.entry.js → p-30c3f624.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-8d401072.system.entry.js → p-3268dad0.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/p-365ed258.entry.js +1 -0
- package/dist/verdocs-web-sdk/{p-ddb17b3e.entry.js → p-39b72c10.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-f5d01982.system.entry.js → p-417f71da.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-b8737f7b.entry.js → p-42b157d2.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-771c2f92.entry.js → p-47f32221.entry.js} +1 -1
- package/dist/verdocs-web-sdk/p-48ff3cce.system.entry.js +1 -0
- package/dist/verdocs-web-sdk/{p-b0b958a0.entry.js → p-51c97029.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-c18c718f.system.js → p-55de8cd1.system.js} +1 -1
- package/dist/verdocs-web-sdk/{p-7c8938e7.system.entry.js → p-5824962b.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-aebb0cd9.system.entry.js → p-5aa76635.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-89cdecac.system.entry.js → p-5b0cd815.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-0950534e.system.entry.js → p-5ce491ac.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-c6fd3e53.system.entry.js → p-6237ce51.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-c7cd6843.entry.js → p-660bda06.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-97b00cae.system.entry.js → p-7e73805f.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-8c03fc69.entry.js → p-8025cac7.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-3dd29b19.entry.js → p-87ac8456.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-475ea471.system.entry.js → p-899617aa.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-2a1287ec.entry.js → p-899fa588.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-511a4ecc.system.entry.js → p-90bc3ad0.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-a242aa80.system.entry.js → p-917aab58.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-524f37a0.entry.js → p-92364765.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-f9b37af2.system.entry.js → p-94fe5817.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-41cbf650.entry.js → p-99b819ad.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-df04f0ca.entry.js → p-a8809e33.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-a9635106.system.entry.js → p-ac6ecfad.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-62f15675.system.entry.js → p-ad3d07a6.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/p-aeae75a3.system.entry.js +7 -0
- package/dist/verdocs-web-sdk/{p-df392ef9.entry.js → p-af1802b6.entry.js} +1 -1
- package/dist/verdocs-web-sdk/p-b712e729.js +1 -0
- package/dist/verdocs-web-sdk/{p-a165607e.entry.js → p-be4ec401.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-bcc23811.entry.js → p-bea73364.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-92153daa.system.entry.js → p-c253ae24.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-92ffc207.entry.js → p-c2766b5a.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-6ced37ed.entry.js → p-c3593d47.entry.js} +1 -1
- package/dist/verdocs-web-sdk/p-c555a700.entry.js +8 -0
- package/dist/verdocs-web-sdk/{p-3e7915e9.system.entry.js → p-c60743ac.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-b9b6b3b4.system.entry.js → p-c94b0dc5.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-78191329.system.entry.js → p-cb7aa6b8.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-54f085d1.entry.js → p-db4c36aa.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-d475fff3.entry.js → p-dc558be5.entry.js} +1 -1
- package/dist/verdocs-web-sdk/p-e2b70dfb.system.js +1 -1
- package/dist/verdocs-web-sdk/{p-80ce3711.system.entry.js → p-e6d711e0.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-ba8f5177.system.entry.js → p-f3b5052f.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-9fb22181.entry.js → p-f40fe8d7.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-e83cd333.entry.js → p-f6b77cd1.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-d98cbd0f.system.entry.js → p-f84932fd.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-6330dbef.entry.js → p-fc90cc87.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-386d789c.system.entry.js → p-ff8143df.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/verdocs-web-sdk.esm.js +1 -1
- package/package.json +5 -4
- package/dist/cjs/verdocs-template-role-properties.cjs.entry.js +0 -184
- package/dist/components/p-8fbc64e9.js +0 -349
- package/dist/components/p-ea5954bd.js +0 -4
- package/dist/esm/verdocs-template-role-properties.entry.js +0 -180
- package/dist/esm-es5/verdocs-template-role-properties.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-03244cd1.system.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-9567cb7d.system.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-982f1b36.system.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-bb0effe1.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-c33ae58a.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-da4d4eed.js +0 -1
@@ -1 +0,0 @@
|
|
1
|
-
var __assign=this&&this.__assign||function(){__assign=Object.assign||function(e){for(var t,i=1,o=arguments.length;i<o;i++){t=arguments[i];for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n))e[n]=t[n]}return e};return __assign.apply(this,arguments)};var __awaiter=this&&this.__awaiter||function(e,t,i,o){function n(e){return e instanceof i?e:new i((function(t){t(e)}))}return new(i||(i=Promise))((function(i,r){function s(e){try{a(o.next(e))}catch(e){r(e)}}function l(e){try{a(o["throw"](e))}catch(e){r(e)}}function a(e){e.done?i(e.value):n(e.value).then(s,l)}a((o=o.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var i={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},o,n,r,s;return s={next:l(0),throw:l(1),return:l(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function l(e){return function(t){return a([e,t])}}function a(l){if(o)throw new TypeError("Generator is already executing.");while(s&&(s=0,l[0]&&(i=0)),i)try{if(o=1,n&&(r=l[0]&2?n["return"]:l[0]?n["throw"]||((r=n["return"])&&r.call(n),0):n.next)&&!(r=r.call(n,l[1])).done)return r;if(n=0,r)l=[l[0]&2,r.value];switch(l[0]){case 0:case 1:r=l;break;case 4:i.label++;return{value:l[1],done:false};case 5:i.label++;n=l[1];l=[0];continue;case 7:l=i.ops.pop();i.trys.pop();continue;default:if(!(r=i.trys,r=r.length>0&&r[r.length-1])&&(l[0]===6||l[0]===2)){i=0;continue}if(l[0]===3&&(!r||l[1]>r[0]&&l[1]<r[3])){i.label=l[1];break}if(l[0]===6&&i.label<r[1]){i.label=r[1];r=l;break}if(r&&i.label<r[2]){i.label=r[2];i.ops.push(l);break}if(r[2])i.ops.pop();i.trys.pop();continue}l=t.call(e,i)}catch(e){l=[6,e];n=0}finally{o=r=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(e,t,i){if(i||arguments.length===2)for(var o=0,n=t.length,r;o<n;o++){if(r||!(o in t)){if(!r)r=Array.prototype.slice.call(t,0,o);r[o]=t[o]}}return e.concat(r||Array.prototype.slice.call(t))};System.register(["./p-9186f42e.system.js","@verdocs/js-sdk","./p-c8a15cb7.system.js","./p-c18c718f.system.js","./p-9b26e4e0.system.js","./p-cd546dbe.system.js","./p-2c5350ec.system.js","./p-70751089.system.js","./p-736a2c41.system.js","./p-21b1acec.system.js","./p-d738b5db.system.js"],(function(e){"use strict";var t,i,o,n,r,s,l,a,d,c,u,p,v,h,f,m,g,x,b,w,k,_,y,q,E,C,M,S,z,L,H,Z,T,I,V,D,N,A;return{setters:[function(e){t=e.r;i=e.c;o=e.h;n=e.H;r=e.F;s=e.g},function(e){l=e.VerdocsEndpoint;a=e.getTemplate;d=e.integerSequence;c=e.getOrganizationContacts;u=e.isValidEmail;p=e.createEnvelope;v=e.getRGBA;h=e.formatFullName;f=e.createTemplateDocument;m=e.deleteTemplateDocument;g=e.updateField;x=e.createField;b=e.updateTemplateRole;w=e.createTemplateRole},function(e){k=e.S},function(e){_=e.S},function(e){y=e.V},function(e){q=e.D;E=e.P;C=e.J;M=e.a;S=e.F;z=e.b;L=e.T},function(e){H=e.f},function(e){Z=e.i},function(e){T=e.b;I=e.c;V=e.d;D=e.g;N=e.e;A=e.f},function(){},function(){}],execute:function(){var U='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-preview{font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", 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 B=U;var j=e("verdocs_preview",function(){function e(e){t(this,e);this.sdkError=i(this,"sdkError",7);this.templateListenerId=null;this.endpoint=l.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();_.subscribe("templates",this.templateId,(function(){return a(e.endpoint,e.templateId)}),false,(function(t){e.template=t;e.loading=false}));return[2]}))}))};e.prototype.unlistenToTemplate=function(){if(this.templateListenerId){_.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,i;return __generator(this,(function(o){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(o){console.log("[PREVIEW] Error with preview session",o);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new k(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.handlePageRendered=function(e){};e.prototype.render=function(){var e=this;var t;if(this.loading){return o(n,null,o("verdocs-loader",null))}return o(n,null,(((t=this.template)===null||t===void 0?void 0:t.documents)||[]).map((function(t){var i=d(1,t.pages);return o(r,null,i.map((function(i){var n;var r=((n=t.page_sizes)===null||n===void 0?void 0:n[i])||{width:612,height:792};return o("verdocs-template-document-page",{templateId:t.template_id,documentId:t.id,pageNumber:i,disabled:true,editable:false,done:false,virtualWidth:r.width,virtualHeight:r.height,onPageRendered:function(t){return e.handlePageRendered(t)},layers:[{name:"page",type:"canvas"},{name:"controls",type:"div"}]})})))})))};Object.defineProperty(e,"watchers",{get:function(){return{templateId:["onTemplateIdChanged"]}},enumerable:false,configurable:true});return e}());j.style=B;var R=function(e){return((e===null||e===void 0?void 0:e.roles)||[]).map((function(e){return e.name}))};var O=function(e,t){return Math.max(R(e).findIndex((function(e){return e===t})),0)};var Q='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-send{padding:10px;position:relative;background:#ffffff;-ms-flex-direction:column;flex-direction:column;font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", 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-direction:row;flex-direction:row}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 P=Q;var F='<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 Y='<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 W='<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 X='<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 J=e("verdocs_send",function(){function e(e){t(this,e);this.sendingEnvelope=i(this,"sendingEnvelope",7);this.send=i(this,"send",7);this.exit=i(this,"exit",7);this.sdkError=i(this,"sdkError",7);this.searchContacts=i(this,"searchContacts",7);this.templateListenerId=null;this.endpoint=l.getDefault();this.templateId=null;this.environment="";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();_.subscribe("templates",this.templateId,(function(){return a(e.endpoint,e.templateId)}),false,(function(t){e.template=t;e.loading=false;e.rolesCompleted={}}));return[2]}))}))};e.prototype.unlistenToTemplate=function(){if(this.templateListenerId){_.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,i;var o=this;return __generator(this,(function(n){try{this.endpoint.onSessionChanged((function(e,t,i){if(!i){return}var n={id:i.id,first_name:i.first_name,last_name:i.last_name,email:i.email,phone:i.phone};if(i){o.sessionContacts=[n];c(o.endpoint).then((function(e){console.log("[SEND] Got contacts",e);o.sessionContacts=__spreadArray(__spreadArray([],e,true),[n],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(o){console.log("[SEND] Error with send session",o);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new k(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.recomputeRolesCompleted=function(){var e=this;var t;this.rolesCompleted={};var i={};(((t=this.template)===null||t===void 0?void 0:t.roles)||[]).forEach((function(t){var o=t.sequence-1;i[o]||(i[o]=[]);var n="r-".concat(o,"-").concat(i[o].length);i[o].push(__assign(__assign({},t),{id:n,role_name:t.name,first_name:t.first_name,last_name:t.last_name}));if(t.first_name&&u(t.email)){e.rolesCompleted[n]=__assign(__assign({},t),{id:n,role_name:t.name,first_name:t.first_name,last_name:t.last_name})}}))};e.prototype.getLevels=function(){var e;var t=__spreadArray([],new Set((((e=this.template)===null||e===void 0?void 0:e.roles)||[]).map((function(e){return e.sequence-1}))),true);t.sort((function(e,t){return e-t}));return t};e.prototype.getRolesAtLevel=function(e){var t;var i=(((t=this.template)===null||t===void 0?void 0:t.roles)||[]).filter((function(t){return t.sequence-1===e})).map((function(t,i){return __assign(__assign({},t),{id:"r-".concat(e,"-").concat(i),role_name:t.name,first_name:"",last_name:""})}));return i};e.prototype.getLevelIcon=function(e){var t=this.getLevels();if(e<0){return o("div",{class:"level-icon",innerHTML:Y})}else if(e>=t.length){return o("div",{class:"level-icon",innerHTML:X})}else{return o("div",{class:"level-icon",innerHTML:W})}};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 i,o;if(this.sending){console.log("[SEND] Skipping duplicate send",e);return}console.log("[SEND] Sending",e);e.preventDefault();e.stopPropagation();this.sending=true;(i=this.sendingEnvelope)===null||i===void 0?void 0:i.emit({sending:true});var n={template_id:this.templateId,name:((o=this.template)===null||o===void 0?void 0:o.name)||"New Envelope",environment:this.environment,initial_reminder:0,followup_reminders:0,recipients:Object.values(this.rolesCompleted),fields:[]};console.log("[SEND] Creating envelope",n);p(this.endpoint,n).then((function(e){var i,o;console.log("[SEND] Send envelope",e);t.reset().catch((function(e){return console.log("Unknown Error",e)}));t.sending=false;(i=t.sendingEnvelope)===null||i===void 0?void 0:i.emit({sending:false});(o=t.send)===null||o===void 0?void 0:o.emit(__assign(__assign({},n),{name:n.name,envelope_id:e.id,envelope:e}))})).catch((function(e){var i,o,n;console.log("Send error",e);y(((o=(i=e.response)===null||i===void 0?void 0:i.data)===null||o===void 0?void 0:o.error)||"Error creating envelope, please try again later.");t.sending=false;(n=t.sendingEnvelope)===null||n===void 0?void 0:n.emit({sending:false})}))};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 o(n,null,o("verdocs-loader",null))}if(!this.endpoint.session){return o(n,{style:{display:"flex"}},o("verdocs-component-error",{message:"You must be authenticated to use this module."}))}var i=this.getLevels();var r=Object.values(this.rolesCompleted).filter((function(e){return u(e.email)}));var s=r.length>=R(this.template).length;return o(n,{class:{sendable:(t=this.template)===null||t===void 0?void 0:t.is_sendable}},o("div",{class:"recipients"},o("div",{class:"left-line"}),o("div",{class:"level level-start"},this.getLevelIcon(-1),o("div",{class:"complete"},"Send Envelope")),i.map((function(t){return o("div",{class:"level level-".concat(t)},e.getLevelIcon(t),e.getRolesAtLevel(t).map((function(t){var i,n,r,s;var l=!t.email;var a="verdocs-send-recipient-".concat(t.role_name);var d=O(e.template,t.role_name);var c=v(d);return l?o("div",{class:"recipient","data-ri":d,"data-rn":t.role_name,style:{backgroundColor:c},onClick:function(i){return e.handleClickRole(i,t)},id:a},((i=e.rolesCompleted[t.id])===null||i===void 0?void 0:i.first_name)?h(e.rolesCompleted[t.id]):t.role_name,o("div",{class:"icon",innerHTML:F}),e.showPickerForId===t.id&&o("verdocs-portal",{anchor:a,onClickAway:function(){return e.showPickerForId=""}},o("verdocs-contact-picker",{onExit:function(){return e.showPickerForId=""},onNext:function(i){return e.handleSelectContact(i,t)},contactSuggestions:e.sessionContacts,templateRole:(n=e.rolesCompleted[t.id])!==null&&n!==void 0?n:t,onSearchContacts:function(t){var i;return(i=e.searchContacts)===null||i===void 0?void 0:i.emit(t.detail)}}))):o("div",{class:"recipient",style:{borderColor:c},onClick:function(i){return e.handleClickRole(i,t)},id:a},((r=e.rolesCompleted[t.id])===null||r===void 0?void 0:r.first_name)?h(e.rolesCompleted[t.id]):t.role_name,o("div",{class:"icon",innerHTML:F}),e.showPickerForId===t.id&&o("verdocs-portal",{anchor:a,onClickAway:function(){return e.showPickerForId=""}},o("verdocs-contact-picker",{onExit:function(){return e.showPickerForId=""},onNext:function(i){return e.handleSelectContact(i,t)},contactSuggestions:e.sessionContacts,templateRole:(s=e.rolesCompleted[t.id])!==null&&s!==void 0?s:t,onSearchContacts:function(t){var i;return(i=e.searchContacts)===null||i===void 0?void 0:i.emit(t.detail)}})))})))})),o("div",{class:"level level-done"},this.getLevelIcon(i.length),o("div",{class:"complete"},"Signing Complete"))),o("div",{class:"buttons"},o("verdocs-button",{label:"Cancel",size:"small",variant:"outline",onClick:function(t){return e.handleCancel(t)},disabled:this.sending}),o("verdocs-button",{label:"Send",size:"small",disabled:!s||this.sending,onClick:function(t){return e.handleSend(t)}}),this.sending&&o("verdocs-spinner",null)))};Object.defineProperty(e,"watchers",{get:function(){return{templateId:["onTemplateIdChanged"]}},enumerable:false,configurable:true});return e}());J.style=P;var G='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-template-attachments{font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", 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 K=G;var $=e("verdocs_template_attachments",function(){function e(e){t(this,e);this.exit=i(this,"exit",7);this.next=i(this,"next",7);this.templateUpdated=i(this,"templateUpdated",7);this.sdkError=i(this,"sdkError",7);this.templateListenerId=null;this.endpoint=l.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,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("[TEMPLATE ATTACHMENTS] Error loading template",o);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new k(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){this.unlistenToTemplate();_.subscribe("templates",this.templateId,(function(){return a(e.endpoint,e.templateId)}),false,(function(t){e.template=t;e.loading=false}));return[2]}))}))};e.prototype.unlistenToTemplate=function(){if(this.templateListenerId){_.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,i,o,n,r,s,l,a;return __generator(this,(function(d){switch(d.label){case 0:e.stopPropagation();r=e.detail.file;if(!r){return[2]}console.log("[ATTACHMENTS] Uploading...",r);this.uploading=true;this.progressLabel="Uploading...";d.label=1;case 1:d.trys.push([1,4,,5]);return[4,f(this.endpoint,this.templateId,r,this.handleUploadProgress.bind(this))];case 2:s=d.sent();console.log("[ATTACHMENTS] Created attachment",s);l=this;return[4,_.getTemplate(this.endpoint,this.templateId,true)];case 3:l.template=d.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:a=d.sent();console.log("[ATTACHMENTS] Error creating template",a);(i=this.sdkError)===null||i===void 0?void 0:i.emit(new k(a.message,(o=a.response)===null||o===void 0?void 0:o.status,(n=a.response)===null||n===void 0?void 0:n.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,m(this.endpoint,this.templateId,this.confirmDeleteDocument.id)];case 1:t.sent();e=this;return[4,_.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(i){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 M;case"image/jpeg":return C;case"image/png":return E;case"application/msword":case"application/vnd.openxmlformats-officedocument.wordprocessingml.document":return q}return S};e.prototype.render=function(){var e=this;var t,i;if(!this.endpoint.session){return o(n,null,o("verdocs-component-error",{message:"You must be authenticated to use this module."}))}if(this.loading){return o(n,{class:"loading"},o("verdocs-loader",null))}if(!this.endpoint.session||!this.template){return o(n,{class:"empty"})}return o(n,null,o("h5",null,"Existing Attachments"),o("div",{class:"attachments"},(((t=this.template)===null||t===void 0?void 0:t.documents)||[]).map((function(t){return o("div",{class:"attachment"},o("div",{class:"file-icon",innerHTML:e.getFileIcon(t)}),o("div",{class:"filename",title:t.name},t.name),o("div",{class:"pages"},o("div",{class:"count"},t.pages),o("div",{class:"pages-icon",innerHTML:z})),o("div",{class:"trash-icon",innerHTML:L,onClick:function(){return e.handleDelete(t)}}))}))),o("h5",null,"Attach a New Document"),this.uploading?o("div",{class:"loader-wrapper"},o("verdocs-loader",null),this.progressLabel&&o("div",{class:"progress-wrapper"},o("verdocs-progress-bar",{showPercent:true,percent:this.progressPercent,label:this.progressLabel}))):o("verdocs-file-chooser",{onFileSelected:function(t){return e.handleUpload(t)}}),o("div",{class:"buttons"},o("verdocs-button",{variant:"outline",label:"Cancel",size:"small",onClick:function(t){return e.handleCancel(t)},disabled:this.uploading}),o("verdocs-button",{label:"Next",size:"small",onClick:function(t){return e.handleNext(t)},disabled:!(((i=this.template)===null||i===void 0?void 0:i.documents)||[]).length||this.uploading})),this.showDeleteError&&o("verdocs-ok-dialog",{heading:"Unable to Delete Attachment",message:"Templates must contain at least one attachment.",onNext:function(){return e.showDeleteError=false}}),this.confirmDeleteDocument&&o("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}());$.style=K;var ee='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-template-build-tabs{-ms-flex:1;flex:1;gap:15px;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-template-build-tabs verdocs-button-panel svg{-webkit-transform:scale(0.8);transform:scale(0.8)}verdocs-template-build-tabs verdocs-template-attachments,verdocs-template-build-tabs verdocs-template-roles{margin:20px}verdocs-template-build-tabs verdocs-template-fields{border-top:1px solid #777777}verdocs-template-build-tabs verdocs-template-attachments{padding:20px;background:#ffffff}verdocs-template-build-tabs verdocs-template-fields{width:100%}verdocs-template-build-tabs verdocs-preview{-ms-flex:1;flex:1}.template-details-panel .row{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;gap:8px;margin:10px 0}.template-details-panel label{-ms-flex:0 0 70px;flex:0 0 70px}.template-details-panel .value{-ms-flex:1;flex:1;font-weight:300;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.template-details-panel .icon-button{cursor:pointer;opacity:0.8;-ms-flex:0;flex:0;width:18px;height:18px}.template-details-panel .icon-button svg{stroke:#000000;width:18px;height:18px}.template-details-panel .icon-button:hover{opacity:1}';var te=ee;var ie='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24" fill="#5c6575"><path d="M11.925 18q.55 0 .938-.387.387-.388.387-.938 0-.55-.387-.925-.388-.375-.938-.375-.55 0-.925.375t-.375.925q0 .55.375.938.375.387.925.387Zm-.95-3.85h1.95q0-.8.2-1.287.2-.488 1.025-1.288.65-.625 1.025-1.213.375-.587.375-1.437 0-1.425-1.025-2.175Q13.5 6 12.1 6q-1.425 0-2.35.775t-1.275 1.85l1.775.7q.125-.45.55-.975.425-.525 1.275-.525.725 0 1.1.412.375.413.375.888 0 .475-.287.9-.288.425-.713.775-1.075.95-1.325 1.475-.25.525-.25 1.875ZM12 22.2q-2.125 0-3.988-.8-1.862-.8-3.237-2.175Q3.4 17.85 2.6 15.988 1.8 14.125 1.8 12t.8-3.988q.8-1.862 2.175-3.237Q6.15 3.4 8.012 2.6 9.875 1.8 12 1.8t3.988.8q1.862.8 3.237 2.175Q20.6 6.15 21.4 8.012q.8 1.863.8 3.988t-.8 3.988q-.8 1.862-2.175 3.237Q17.85 20.6 15.988 21.4q-1.863.8-3.988.8Zm0-2.275q3.325 0 5.625-2.3t2.3-5.625q0-3.325-2.3-5.625T12 4.075q-3.325 0-5.625 2.3T4.075 12q0 3.325 2.3 5.625t5.625 2.3ZM12 12Z"/></svg>';var oe='<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5"><path stroke-linecap="round" stroke-linejoin="round" d="M15.75 17.25v3.375c0 .621-.504 1.125-1.125 1.125h-9.75a1.125 1.125 0 0 1-1.125-1.125V7.875c0-.621.504-1.125 1.125-1.125H6.75a9.06 9.06 0 0 1 1.5.124m7.5 10.376h3.375c.621 0 1.125-.504 1.125-1.125V11.25c0-4.46-3.243-8.161-7.5-8.876a9.06 9.06 0 0 0-1.5-.124H9.375c-.621 0-1.125.504-1.125 1.125v3.5m7.5 10.375H9.375a1.125 1.125 0 0 1-1.125-1.125v-9.25m12 6.625v-1.875a3.375 3.375 0 0 0-3.375-3.375h-1.5a1.125 1.125 0 0 1-1.125-1.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H9.75" /></svg>';var ne=["attachments","roles","settings","fields","preview"];var re=e("verdocs_template_build_tabs",function(){function e(e){t(this,e);this.sdkError=i(this,"sdkError",7);this.stepChanged=i(this,"stepChanged",7);this.templateListenerId=null;this.endpoint=l.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();_.subscribe("templates",this.templateId,(function(){return a(e.endpoint,e.templateId)}),false,(function(t){e.template=t;e.loading=false}));return[2]}))}))};e.prototype.unlistenToTemplate=function(){if(this.templateListenerId){_.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,i;return __generator(this,(function(o){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(o){console.log("[BUILD_TABS] Error loading template",o);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new k(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.setStep=function(e){var t;console.log("[BUILD_TABS] Selected step",e.detail.tab.id);e.stopPropagation();e.preventDefault();this.step=e.detail.tab.id;(t=this.stepChanged)===null||t===void 0?void 0:t.emit(e.detail.tab.id)};e.prototype.copyTemplateId=function(){var e=this;navigator.clipboard.writeText(this.templateId).then((function(){y("Template ID copied",{style:"success",duration:3e3})})).catch((function(t){var i;console.warn("[BUILD_TABS] Error copying to clipboard",t);(i=e.sdkError)===null||i===void 0?void 0:i.emit(t)}))};e.prototype.render=function(){var e=this;var t,i,r,s,l,a,d,c,u;if(this.loading){return o(n,null,o("verdocs-loader",null))}if(!this.endpoint.session){return o(n,null,o("verdocs-component-error",{message:"You must be authenticated to use this module."}))}var p=(((t=this.template)===null||t===void 0?void 0:t.documents)||[]).length>0;var v=p&&(((i=this.template)===null||i===void 0?void 0:i.roles)||[]).length>0;var h=v&&(((r=this.template)===null||r===void 0?void 0:r.fields)||[]).length>0;var f=Math.max(ne.indexOf(this.step),0);if(!h&&f>=4){f=3}if(!v&&f>=3){f=1}if(!p&&f>=1){f=0}return o(n,null,o("verdocs-tabs",{onSelectTab:function(t){return e.setStep(t)},selectedTab:f,tabs:[{id:"attachments",disabled:false,label:"Attachment(s)"},{id:"roles",disabled:!p,label:"Roles"},{id:"settings",disabled:!v,label:"Settings"},{id:"fields",disabled:!v,label:"Fields"},{id:"preview",disabled:!h,label:"Preview/Send"}]}),this.templateId&&o("div",{class:"info"},o("verdocs-button-panel",{icon:ie},o("div",{class:"template-details-panel"},o("h6",null,"Template Details"),o("div",{class:"row"},o("label",null,"ID:"),o("div",{class:"value"},this.templateId),o("div",{class:"icon-button",innerHTML:oe,onClick:function(){return e.copyTemplateId()}})),o("div",{class:"row"},o("label",null,"Name:"),o("div",{class:"value"},(s=this.template)===null||s===void 0?void 0:s.name)),o("div",{class:"row"},o("label",null,"Visibility:"),o("div",{class:"value"},((l=this.template)===null||l===void 0?void 0:l.is_public)?"Public":((a=this.template)===null||a===void 0?void 0:a.is_personal)?"Private":"Shared")),o("div",{class:"row"},o("label",null,"Created:"),o("div",{class:"value"},((d=this.template)===null||d===void 0?void 0:d.counter)?H(new Date((c=this.template)===null||c===void 0?void 0:c.created_at),"P p"):"")),o("div",{class:"row"},o("label",null,"Used:"),o("div",{class:"value"},(u=this.template)===null||u===void 0?void 0:u.counter," time(s)"))))))};Object.defineProperty(e,"watchers",{get:function(){return{templateId:["onTemplateIdChanged"],step:["onStepChanged"]}},enumerable:false,configurable:true});return e}());re.style=te;var se="@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-template-fields{font-family:\"Inter\", -apple-system, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", sans-serif;position:relative;display:block;min-height:600px}verdocs-template-fields .page-0{padding:65px 15px 0 15px;-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-template-fields .page-0 .user-placed-fields{height:100px;position:relative;background:#ffffff;-webkit-box-shadow:0 0 10px 5px rgba(0, 0, 0, 0.0588235294);box-shadow:0 0 10px 5px rgba(0, 0, 0, 0.0588235294)}verdocs-template-fields .page-0 .user-placed-fields .title{top:0;left:0;color:#ffffff;font-size:12px;padding:3px 6px;font-weight:bold;position:absolute;background:#46497d}verdocs-template-fields .pages{display:-ms-flexbox;display:flex;padding:15px;row-gap:15px;min-height:200px;position:relative;-ms-flex-align:center;align-items:center;-webkit-box-sizing:border-box;box-sizing:border-box;-ms-flex-direction:column;flex-direction:column}verdocs-template-fields .pages div,verdocs-template-fields .pages canvas{-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-template-fields #verdocs-template-fields-toolbar{width:100%;height:50px;display:-ms-flexbox;display:flex;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;font-weight:700;padding:0 20px 0 0;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;color:#f5f5fa;-ms-flex-pack:center;justify-content:center;background:#46497d}verdocs-template-fields #verdocs-template-fields-toolbar>verdocs-select-input{margin:0}verdocs-template-fields #verdocs-template-fields-toolbar svg{width:24px;height:24px}verdocs-template-fields #verdocs-template-fields-toolbar .add-for{margin:0;font-weight:500;color:#f5f5fa}verdocs-template-fields #verdocs-template-fields-toolbar verdocs-select-input{margin:0 20px 0 0}@media all and (max-width: 1000px){verdocs-template-fields #verdocs-template-fields-toolbar{-webkit-column-gap:8px;-moz-column-gap:8px;column-gap:8px;padding:0 10px 0 0}verdocs-template-fields #verdocs-template-fields-toolbar svg{-webkit-transform:scale(0.8);transform:scale(0.8)}verdocs-template-fields #verdocs-template-fields-toolbar .add-for,verdocs-template-fields #verdocs-template-fields-toolbar verdocs-select-input{display:none}}@media all and (max-width: 600px){verdocs-template-fields #verdocs-template-fields-toolbar{-webkit-column-gap:6px;-moz-column-gap:6px;column-gap:6px}verdocs-template-fields #verdocs-template-fields-toolbar svg{-webkit-transform:scale(0.6);transform:scale(0.6)}verdocs-template-fields #verdocs-template-fields-toolbar .separator,verdocs-template-fields #verdocs-template-fields-toolbar .add-for,verdocs-template-fields #verdocs-template-fields-toolbar verdocs-select-input{display:none}}verdocs-template-fields.placing-attachment{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='m10.55 16.55 7.275-7.275L16.05 7.5l-5.5 5.45-2.675-2.65L6.1 12.075Zm-5.375 4.925q-1.125 0-1.887-.763-.763-.762-.763-1.887V5.175q0-1.125.763-1.888.762-.762 1.887-.762h13.65q1.125 0 1.888.762.762.763.762 1.888v13.65q0 1.125-.762 1.887-.763.763-1.888.763Zm0-2.65h13.65V5.175H5.175v13.65Zm0-13.65v13.65-13.65Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-checkbox{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='m10.55 16.55 7.275-7.275L16.05 7.5l-5.5 5.45-2.675-2.65L6.1 12.075Zm-5.375 4.925q-1.125 0-1.887-.763-.763-.762-.763-1.887V5.175q0-1.125.763-1.888.762-.762 1.887-.762h13.65q1.125 0 1.888.762.762.763.762 1.888v13.65q0 1.125-.762 1.887-.763.763-1.888.763Zm0-2.65h13.65V5.175H5.175v13.65Zm0-13.65v13.65-13.65Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-date{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath fill='%23000000' d='M7.6 13.925q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375Zm4.4 0q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375Zm4.4 0q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375ZM5.3 22.85q-1.325 0-2.238-.912-.912-.913-.912-2.238V6.3q0-1.325.912-2.238.913-.912 2.238-.912H6v-2h2.575v2h6.85v-2H18v2h.7q1.325 0 2.238.912.912.913.912 2.238v13.4q0 1.325-.912 2.238-.913.912-2.238.912Zm0-3.15h13.4V10H5.3v9.7ZM5.3 8h13.4V6.3H5.3Zm0 0V6.3 8Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-dropdown{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24' stroke-width='1.5' stroke='currentColor'%3E%3Cpath stroke='%23000000' stroke-linecap='round' stroke-linejoin='round' d='M3 4.5h14.25M3 9h9.75M3 13.5h9.75m4.5-4.5v12m0 0l-3.75-3.75M17.25 21L21 17.25' /%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-initial{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='M6.225 20.775V7h-5V3.225H15V7h-5v13.775Zm9.775 0v-8h-3V9h9.775v3.775h-3v8Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-payment{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='m10.55 16.55 7.275-7.275L16.05 7.5l-5.5 5.45-2.675-2.65L6.1 12.075Zm-5.375 4.925q-1.125 0-1.887-.763-.763-.762-.763-1.887V5.175q0-1.125.763-1.888.762-.762 1.887-.762h13.65q1.125 0 1.888.762.762.763.762 1.888v13.65q0 1.125-.762 1.887-.763.763-1.888.763Zm0-2.65h13.65V5.175H5.175v13.65Zm0-13.65v13.65-13.65Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-radio{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='M12 17q2.075 0 3.538-1.463Q17 14.075 17 12t-1.462-3.538Q14.075 7 12 7 9.925 7 8.463 8.462 7 9.925 7 12q0 2.075 1.463 3.537Q9.925 17 12 17Zm0 5.85q-2.275 0-4.25-.85t-3.438-2.312Q2.85 18.225 2 16.25q-.85-1.975-.85-4.25T2 7.75q.85-1.975 2.312-3.438Q5.775 2.85 7.75 2q1.975-.85 4.25-.85t4.25.85q1.975.85 3.438 2.312Q21.15 5.775 22 7.75q.85 1.975.85 4.25T22 16.25q-.85 1.975-2.312 3.438Q18.225 21.15 16.25 22q-1.975.85-4.25.85Zm0-3.15q3.25 0 5.475-2.225Q19.7 15.25 19.7 12q0-3.25-2.225-5.475Q15.25 4.3 12 4.3q-3.25 0-5.475 2.225Q4.3 8.75 4.3 12q0 3.25 2.225 5.475Q8.75 19.7 12 19.7Zm0-7.7Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-signature{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='m9.225 21.225 4.65-4.65h8.45v4.65Zm-5.35-2.2H5.05l8.5-8.5-1.175-1.175-8.5 8.5Zm14.25-9.95L13.8 4.8l1.325-1.325q.625-.65 1.525-.663.9-.012 1.6.663l1.225 1.175q.675.675.663 1.562-.013.888-.663 1.513ZM16.7 10.55 6 21.225H1.675V16.9L12.35 6.225Zm-3.725-.625-.6-.575 1.175 1.175Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-textarea{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='M3.225 20.725v-3.15h11.55v3.15Zm0-4.775V12.8h17.55v3.15Zm0-4.75V8.05h17.55v3.15Zm0-4.775v-3.15h17.55v3.15Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-textbox{cursor:url(\"data:image/svg+xml,%3Csvg width='32' height='15' viewBox='0 0 32 15' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cmask id='path-1-inside-1_1401_24' fill='white'%3E%3Cpath d='M0 0H32V15H0V0Z'/%3E%3C/mask%3E%3Cpath d='M0 0H32V15H0V0Z' fill='%234C56CB' fill-opacity='0.1'/%3E%3Cpath d='M0 0V-1H-1V0H0ZM0 15H-1V16H0V15ZM0 1H32V-1H0V1ZM32 14H0V16H32V14ZM1 15V0H-1V15H1Z' fill='%234C56CB' mask='url(%23path-1-inside-1_1401_24)'/%3E%3Cpath d='M3 11.8V8.65H14.15V11.8H3ZM3 6.65V3.5H20.15V6.65H3Z' fill='%234C56CB'/%3E%3Cline x1='31.5' y1='1' x2='31.5' y2='14' stroke='%234C56CB' stroke-opacity='0.32' stroke-dasharray='1 1'/%3E%3C/svg%3E%0A\") 0 14, pointer}verdocs-template-fields.placing-timestamp{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath fill='%23000000' d='M9 1h6v2H9zm10.03 6.39 1.42-1.42c-.43-.51-.9-.99-1.41-1.41l-1.42 1.42C16.07 4.74 14.12 4 12 4c-4.97 0-9 4.03-9 9s4.02 9 9 9 9-4.03 9-9c0-2.12-.74-4.07-1.97-5.61zM13 14h-2V8h2v6z'%3E%3C/path%3E%3C/svg%3E\") 16 16, pointer}";var le=se;var ae='<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 de='<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 ce='<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 ue='<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 pe='<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 ve='<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 he='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" 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"></path></svg>';var fe='<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 me='<svg xmlns="http://www.w3.org/2000/svg" fill="none" 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 ge='<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 xe=[{id:"signature",tooltip:"Signature",icon:pe,class:"signature"},{id:"initial",tooltip:"Initials",icon:ve,class:"initial"},{id:"sep1",tooltip:"",icon:ge,class:"separator"},{id:"textbox",tooltip:"Text Box",icon:ae,class:"textbox"},{id:"checkbox",tooltip:"Check Box",icon:de,class:"checkbox"},{id:"radio",tooltip:"Radio Button",icon:ce,class:"radio"},{id:"dropdown",tooltip:"Dropdown",icon:fe,class:"dropdown"},{id:"sep2",tooltip:"",icon:ge,class:"separator"},{id:"date",tooltip:"Date",icon:ue,class:"date"},{id:"timestamp",tooltip:"Timestamp",icon:he,class:"timestamp"},{id:"attachment",tooltip:"Attachment",icon:me,class:"attachment"}];var be=e("verdocs_template_fields",function(){function e(e){t(this,e);this.sdkError=i(this,"sdkError",7);this.templateUpdated=i(this,"templateUpdated",7);this.fieldsUpdated=i(this,"fieldsUpdated",7);this.templateListenerId=null;this.pageHeights={};this.cachedPageInfo={};this.endpoint=l.getDefault();this.templateId=null;this.toolbarTargetId=null;this.placing=null;this.showMustSelectRole=false;this.selectedRoleName="";this.loading=true;this.template=null}e.prototype.onTemplateIdChanged=function(){this.listenToTemplate()};e.prototype.handleKeyDown=function(e){if(e.key==="Escape"){this.placing=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("[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(o){console.log("[FIELDS] Error with fields session",o);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new k(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.componentDidRender=function(){Z.dynamicDrop(true);var e=this.toolbarTargetId?document.getElementById(this.toolbarTargetId):null;var t=document.getElementById("verdocs-template-fields-toolbar");if(e&&t){console.log("[FIELDS] Moving toolbar");t.remove();e.append(t)}};e.prototype.componentWillUpdate=function(){var e=this;var t,i;var o=((t=this.template)===null||t===void 0?void 0:t.roles)||[];if(!this.selectedRoleName||!o.find((function(t){return t&&t.name===e.selectedRoleName}))){this.selectedRoleName=((i=o[0])===null||i===void 0?void 0:i.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();_.subscribe("templates",this.templateId,(function(){return a(e.endpoint,e.templateId)}),false,(function(t){var i,o;e.template=t;e.loading=false;e.selectedRoleName=((o=(i=t.roles)===null||i===void 0?void 0:i[0])===null||o===void 0?void 0:o.name)||""}));return[2]}))}))};e.prototype.unlistenToTemplate=function(){if(this.templateListenerId){_.store.delListener(this.templateListenerId);this.templateListenerId=null}};e.prototype.attachFieldAttributes=function(e,t,i){var o=this;i.addEventListener("settingsChanged",(function(){var e;(e=o.templateUpdated)===null||e===void 0?void 0:e.emit({endpoint:o.endpoint,template:o.template,event:"added-field"})}));i.addEventListener("deleted",(function(){var e;i.remove();(e=o.templateUpdated)===null||e===void 0?void 0:e.emit({endpoint:o.endpoint,template:o.template,event:"updated-field"})}));i.setAttribute("templateid",this.templateId);i.setAttribute("fieldname",t.name);i.setAttribute("pageNumber",String(e.pageNumber));i.setAttribute("xScale",String(e.xScale));i.setAttribute("yScale",String(e.yScale));i.setAttribute("name",t.name)};e.prototype.handlePageRendered=function(e){var t=this;var i;var o=e.detail;this.cachedPageInfo[o.pageNumber]=o;this.pageHeights[o.pageNumber]=o.naturalHeight;(((i=this.template)===null||i===void 0?void 0:i.fields)||[]).filter((function(e){return e&&e.page===o.pageNumber})).forEach((function(e){var i=D(e);var o=document.getElementById(i);if(o){o.setAttribute("fieldname",e.name);o.setAttribute("pagenumber",String(e.page));t.makeDraggable(o)}}))};e.prototype.makeDraggable=function(e){Z(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,i,o,n,r,s;return __generator(this,(function(l){t=+(e.target.getAttribute("posX")||0);i=+(e.target.getAttribute("posY")||0);o=+(e.target.getAttribute("xScale")||1);n=+(e.target.getAttribute("yScale")||1);r=e.dx/o+t;s=e.dy/n+i;e.target.setAttribute("posX",r);e.target.setAttribute("posy",s);T(e.target,"translate","".concat(r,"px, ").concat(s,"px"));return[2]}))}))};e.prototype.handleMoveEnd=function(e){return __awaiter(this,void 0,void 0,(function(){var t,i,o,n,r,s,l,a,d,c,u,p,v,h,f,m,x,b,w,q,E,C,M,S,z,L,H,Z,T,D,U,B,j,R,O,Q,P,F,Y;return __generator(this,(function(W){switch(W.label){case 0:d=e.target.getAttribute("fieldname");c=(((t=this.template)===null||t===void 0?void 0:t.fields)||[]).find((function(e){return e.name===d}));if(!c){console.log("[FIELDS] Unable to find field",d,e.target);return[2]}u=e.target.getAttribute("pagenumber");p=this.cachedPageInfo[u],v=p.naturalWidth,h=v===void 0?612:v,f=p.naturalHeight,m=f===void 0?792:f,x=p.renderedHeight,b=x===void 0?792:x;w=e.target.getBoundingClientRect();q=e.target.parentElement;E=q.getBoundingClientRect();C=c.width||N(c.type);M=c.height||A(c.type);S=Math.max(w.left-E.left,0);z=Math.max(b-(E.bottom-w.bottom),0);L=parseInt(u);if(z>b){L=Math.min(L+1,((n=(o=((i=this.template)===null||i===void 0?void 0:i.documents)||[])===null||o===void 0?void 0:o[0])===null||n===void 0?void 0:n.pages)||1);z-=b;b=this.cachedPageInfo[L].renderedHeight;console.log("Next page",{newPageNumber:L,newY:z,renderedHeight:b})}else if(z<0){L=Math.max(L-1,1);b=this.cachedPageInfo[L].renderedHeight;z+=b;console.log("[FIELDS] Next page",{newPageNumber:L,newY:z,renderedHeight:b})}H=this.viewCoordinatesToPageCoordinates(S,z,u,h-C,m-M),Z=H.x,T=H.y;W.label=1;case 1:W.trys.push([1,3,,4]);D={x:Z,y:T,page:L};return[4,g(this.endpoint,this.templateId,d,D)];case 2:U=W.sent();console.log("[FIELDS] Updated",U);B=JSON.parse(JSON.stringify(this.template));j=B.fields.findIndex((function(e){return e.name===d}));if(j>-1){B.fields[j]=U}_.updateTemplate(this.templateId,B);e.target.removeAttribute("posX");e.target.removeAttribute("posY");I(e.target);R=this.cachedPageInfo[u],O=R.xScale,Q=O===void 0?1:O,P=R.yScale,F=P===void 0?1:P;V(e.target,U,Q,F);(r=this.templateUpdated)===null||r===void 0?void 0:r.emit({endpoint:this.endpoint,template:B,event:"updated-field"});return[3,4];case 3:Y=W.sent();y("Error updating field, please try again later",{style:"error"});console.log("[FIELDS] Error updating field",Y);(s=this.sdkError)===null||s===void 0?void 0:s.emit(new k(Y.message,(l=Y.response)===null||l===void 0?void 0:l.status,(a=Y.response)===null||a===void 0?void 0:a.data));e.target.removeAttribute("posX");e.target.removeAttribute("posY");I(e.target);return[3,4];case 4:return[2]}}))}))};e.prototype.generateFieldName=function(e,t){var i;var o=1;var n;do{n="".concat(e,"P").concat(t,"-").concat(o);o++}while((((i=this.template)===null||i===void 0?void 0:i.fields)||[]).some((function(e){return e&&e.name===n})));return n};e.prototype.viewCoordinatesToPageCoordinates=function(e,t,i,o,n){var r=this.cachedPageInfo[i],s=r.xScale,l=s===void 0?1:s,a=r.yScale,d=a===void 0?1:a,c=r.renderedHeight,u=c===void 0?792:c;var p=Math.floor(Math.min(e/l,o));var v=Math.floor(Math.min(Math.max(u-t,0)/d,n));return{x:p,y:v}};e.prototype.handleClickPage=function(e,t){return __awaiter(this,void 0,void 0,(function(){var i,o,n,r,s,l,a,d,c,u,p,v,h,f,m,g;return __generator(this,(function(b){switch(b.label){case 0:if(!this.placing)return[3,2];o=e.offsetX;n=e.offsetY;r=N(this.placing);s=A(this.placing);l=this.cachedPageInfo[t];a=l.naturalWidth,d=a===void 0?612:a,c=l.naturalHeight,u=c===void 0?792:c;p=this.viewCoordinatesToPageCoordinates(o,n,t,d-r,u-s);v=Math.floor(p.x);h=Math.floor(p.y);f={name:this.generateFieldName(this.placing,t),role_name:this.selectedRoleName,template_id:this.templateId,document_id:l.documentId,type:this.placing,required:this.placing!=="radio",page:t,validator:null,label:null,default:null,placeholder:null,group:null,settings:{},x:v,y:h,width:r,height:s,multiline:false,options:this.placing==="radio"?[{id:"option-1",label:"Option 1"}]:[]};console.log("[FIELDS] Will save new field",f);return[4,x(this.endpoint,this.templateId,f)];case 1:m=b.sent();console.log("[FIELDS] Saved field",m);g=JSON.parse(JSON.stringify(this.template));g.fields.push(m);_.updateTemplate(this.templateId,g);(i=this.templateUpdated)===null||i===void 0?void 0:i.emit({endpoint:this.endpoint,template:g,event:"added-field"});this.placing=null;b.label=2;case 2:return[2]}}))}))};e.prototype.render=function(){var e;var t=this;var i,r,s;if(this.loading){return o(n,null,o("verdocs-loader",null))}if(!this.endpoint.session){return o(n,null,o("verdocs-component-error",{message:"You must be authenticated to use this module."}))}var l=(((i=this.template)===null||i===void 0?void 0:i.roles)||[]).map((function(e){return{value:e.name,label:e.full_name?"".concat(e.name,": ").concat(e.full_name):e.name}}));return o(n,{class:this.placing?(e={},e["placing-".concat(this.placing)]=true,e):{},onSubmit:function(){}},o("div",{id:"verdocs-template-fields-toolbar"},o("div",{class:"add-for"},"Add field:"),o("verdocs-select-input",{value:this.selectedRoleName,options:l,onInput:function(e){return t.selectedRoleName=e.target.value}}),xe.map((function(e){return o("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}}}})}))),o("div",{class:"pages"},(((r=this.template)===null||r===void 0?void 0:r.documents)||[]).map((function(e){var i=d(1,e.pages);return i.map((function(i){var n=e.page_sizes[i];return o("verdocs-template-document-page",{templateId:t.templateId,documentId:e.id,pageNumber:i,virtualWidth:(n===null||n===void 0?void 0:n.width)||612,virtualHeight:(n===null||n===void 0?void 0:n.height)||792,disabled:true,editable:true,done:false,onClick:function(e){return t.handleClickPage(e,i)},onPageRendered:function(e){return t.handlePageRendered(e)},layers:[{name:"page",type:"canvas"},{name:"controls",type:"div"}]})}))}))),this.showMustSelectRole&&o("verdocs-ok-dialog",{heading:"Unable to add field",message:(((s=this.template)===null||s===void 0?void 0:s.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"]}},enumerable:false,configurable:true});return e}());be.style=le;var we='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-template-roles{display:block;min-width:400px;font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-template-roles>form{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;background-color:#ffffff;padding:12px}verdocs-template-roles>form h5{font-size:16px;font-weight:bold;color:#46497d;margin:0 0 10px 0}verdocs-template-roles>form .participants{position:relative}verdocs-template-roles>form .left-line{top:32px;left:11px;z-index:1;width:12px;bottom:30px;position:absolute;background:#ffffff;border-left:3px dotted #9b9b9b}verdocs-template-roles>form .row{display:-ms-flexbox;display:flex;-webkit-column-gap:0;-moz-column-gap:0;column-gap:0;min-height:35px;margin-top:0;margin-left:40px;position:relative;-ms-flex-direction:row;flex-direction:row;padding:6px 0 4px 0}verdocs-template-roles>form .row .row-roles{-ms-flex:1;flex:1;gap:10px;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;-ms-flex-direction:row;flex-direction:row}verdocs-template-roles>form .row .icon{top:14px;z-index:2;left:-40px;width:24px;height:24px;position:absolute;background:#ffffff}verdocs-template-roles>form .row .sender{height:30px;display:-ms-flexbox;display:flex;font-size:14px;line-height:30px;-ms-flex-align:center;align-items:center;border-radius:30px;-ms-flex-direction:row;flex-direction:row;padding:0 15px 0 15px;border:1px solid #c6c9cc;background-color:#f5f5fa}verdocs-template-roles>form .row .complete{height:30px;display:-ms-flexbox;display:flex;font-size:14px;padding:0 15px;line-height:30px;-ms-flex-direction:row;flex-direction:row;border-radius:30px;background-color:#f5f5fa;border:1px solid #aeb4bf}verdocs-template-roles>form .row .label{font-weight:bold;margin-right:6px;color:#33364b}verdocs-template-roles>form .row .settings-button{display:-ms-flexbox;display:flex;cursor:pointer;margin:0 0 0 9px}verdocs-template-roles>form .row .recipient{height:30px;display:-ms-flexbox;display:flex;font-size:14px;border-radius:30px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;padding:0 5px 0 6px;white-space:nowrap;border:2px solid #aeb4bf}verdocs-template-roles>form .row .recipient .type-icon{width:24px;height:24px;-webkit-transform:scale(0.8);transform:scale(0.8);opacity:0.6;margin:0 12px 0 0}verdocs-template-roles>form .row .recipient.dragging{position:absolute}verdocs-template-roles>form .row .recipient.dragging+.dropzone{display:none !important}verdocs-template-roles>form .row .dropzone{width:14px;height:30px;display:none}verdocs-template-roles>form .row .dropzone svg{fill:#cccccc}verdocs-template-roles>form .row .dropzone.visible{margin:0 7px;display:-ms-flexbox;display:flex;-ms-flex:0 0 14px;flex:0 0 14px}verdocs-template-roles>form .row .dropzone.active{-ms-flex:0 0 120px;flex:0 0 120px;border-radius:30px;background:rgba(101, 77, 203, 0.4980392157);border:1px dashed #654dcb}verdocs-template-roles>form label{display:block;font-size:14px;font-weight:500;margin:0 0 4px 0;color:#5c6575}verdocs-template-roles>form input{border:none;font-size:18px;padding:3px 6px 3px 0;background:transparent;border-bottom:1px solid #33364b}verdocs-template-roles>form input:focus{outline:none}verdocs-template-roles .row.add-sequence{display:none}verdocs-template-roles .add-role{margin:0;padding:0;border:none;opacity:0.5;cursor:pointer;background:none}verdocs-template-roles .add-role:hover{opacity:1}verdocs-template-roles .add-role svg{width:32px;height:32px}verdocs-template-roles .add-step{margin:0;padding:0;border:none;opacity:0.5;cursor:pointer;background:none}verdocs-template-roles .add-step:hover{opacity:1}verdocs-template-roles .add-step svg{width:32px;height:32px}verdocs-template-roles.dragging .add-role{display:none}verdocs-template-roles.dragging form .row .recipient+.dropzone{display:-ms-flexbox;display:flex}verdocs-template-roles.dragging .row.add-sequence{display:-ms-flexbox;display:flex}verdocs-template-roles.dragging .row.add-sequence .dropzone{opacity:0.5;-ms-flex:0 0 120px;flex:0 0 120px;border-radius:30px;-ms-flex-align:center;align-items:center;background:rgba(101, 77, 203, 0.4980392157);-ms-flex-pack:center;justify-content:center;border:1px dashed #654dcb}verdocs-template-roles.dragging .row.add-sequence .dropzone.active{opacity:1}verdocs-template-roles .buttons{display:-ms-flexbox;display:flex;-webkit-column-gap:8px;-moz-column-gap:8px;column-gap:8px;margin-top:16px;-ms-flex-direction:row;flex-direction:row}verdocs-template-roles .empty{font-size:13px;margin-top:15px;margin-bottom:5px}verdocs-template-roles .empty svg{width:16px;height:16px;stroke:#666666;margin-bottom:2px;display:inline-block}verdocs-template-roles ::-webkit-input-placeholder{color:#aaaaaa}verdocs-template-roles ::-moz-placeholder{color:#aaaaaa}verdocs-template-roles :-ms-input-placeholder{color:#aaaaaa}verdocs-template-roles ::-ms-input-placeholder{color:#aaaaaa}verdocs-template-roles ::placeholder{color:#aaaaaa}';var ke=we;var _e='<svg xmlns="http://www.w3.org/2000/svg" height="20" width="20" fill="#00000089"><path d="m8.021 17.917-.313-2.5q-.27-.125-.625-.334-.354-.208-.625-.395l-2.312.979-1.979-3.438 1.979-1.5q-.021-.167-.031-.364-.011-.198-.011-.365 0-.146.011-.344.01-.198.031-.385l-1.979-1.5 1.979-3.417 2.312.958q.271-.187.615-.385t.635-.344l.313-2.5h3.958l.313 2.5q.312.167.625.344.312.177.604.385l2.333-.958 1.979 3.417-1.979 1.521q.021.187.021.364V10q0 .146-.01.333-.011.188-.011.396l1.958 1.5-1.979 3.438-2.312-.979q-.292.208-.615.395-.323.188-.614.334l-.313 2.5Zm1.937-5.355q1.063 0 1.813-.75t.75-1.812q0-1.062-.75-1.812t-1.813-.75q-1.041 0-1.802.75-.76.75-.76 1.812t.76 1.812q.761.75 1.802.75Zm0-1.333q-.5 0-.864-.364-.365-.365-.365-.865t.365-.865q.364-.364.864-.364t.865.364q.365.365.365.865t-.365.865q-.365.364-.865.364ZM10.021 10Zm-.854 6.583h1.666l.25-2.187q.605-.167 1.136-.49.531-.323 1.031-.802l2.021.875.854-1.375-1.792-1.354q.105-.333.136-.635.031-.303.031-.615 0-.292-.031-.573-.031-.281-.115-.635l1.792-1.396-.834-1.375-2.062.875q-.438-.438-1.021-.781-.583-.344-1.125-.49l-.271-2.208H9.167l-.271 2.208q-.584.146-1.125.458-.542.313-1.042.792l-2.021-.854-.833 1.375 1.75 1.354q-.083.333-.125.646-.042.312-.042.604t.042.594q.042.302.125.635l-1.75 1.375.833 1.375 2.021-.854q.479.458 1.021.771.542.312 1.146.479Z"/></svg>';var ye='<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" fill="#00000089"><path d="M2 12C2 6.48 6.48 2 12 2s10 4.48 10 10-4.48 10-10 10S2 17.52 2 12zm10 6c3.31 0 6-2.69 6-6s-2.69-6-6-6-6 2.69-6 6 2.69 6 6 6z"></path></svg>';var qe='<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" fill="#00000089"><path d="M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z"></path></svg>';var Ee='<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" fill="#00000089"><path d="m18 7-1.41-1.41-6.34 6.34 1.41 1.41L18 7zm4.24-1.41L11.66 16.17 7.48 12l-1.41 1.41L11.66 19l12-12-1.42-1.41zM.41 13.41 6 19l1.41-1.41L1.83 12 .41 13.41z"></path></svg>';var Ce='<svg xmlns="http://www.w3.org/2000/svg" fill="#ffffff" viewBox="0 0 24 24" strokeWidth={1.5} stroke="currentColor"><path strokeLinecap="round" strokeLinejoin="round" d="M12 9v6m3-3H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z" /></svg>';var Me='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path d="m9.225 21.225 4.65-4.65h8.45v4.65Zm-5.35-2.2H5.05l8.5-8.5-1.175-1.175-8.5 8.5Zm14.25-9.95L13.8 4.8l1.325-1.325q.625-.65 1.525-.663.9-.012 1.6.663l1.225 1.175q.675.675.663 1.562-.013.888-.663 1.513ZM16.7 10.55 6 21.225H1.675V16.9L12.35 6.225Zm-3.725-.625-.6-.575 1.175 1.175Z"/></svg>';var Se='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path fill-rule="evenodd" d="M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12zm13.36-1.814a.75.75 0 10-1.22-.872l-3.236 4.53L9.53 12.22a.75.75 0 00-1.06 1.06l2.25 2.25a.75.75 0 001.14-.094l3.75-5.25z" clip-rule="evenodd" /></svg>';var ze='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M1.5 8.67v8.58a3 3 0 003 3h15a3 3 0 003-3V8.67l-8.928 5.493a3 3 0 01-3.144 0L1.5 8.67z" /><path d="M22.5 6.908V6.75a3 3 0 00-3-3h-15a3 3 0 00-3 3v.158l9.714 5.978a1.5 1.5 0 001.572 0L22.5 6.908z" /></svg>';var Le=e("verdocs_template_roles",function(){function e(e){t(this,e);this.next=i(this,"next",7);this.exit=i(this,"exit",7);this.sdkError=i(this,"sdkError",7);this.rolesUpdated=i(this,"rolesUpdated",7);this.templateListenerId=null;this.endpoint=l.getDefault();this.templateId="";this.showingRoleDialog=null;this.sender=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){console.log("[ROLES] Loading template",this.templateId);this.unlistenToTemplate();_.subscribe("templates",this.templateId,(function(){return a(e.endpoint,e.templateId)}),false,(function(t){console.log("[BUILD] Template Updated",t);e.template=t;e.loading=false}));return[2]}))}))};e.prototype.unlistenToTemplate=function(){if(this.templateListenerId){_.store.delListener(this.templateListenerId);this.templateListenerId=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("[FIELDS] Error with preview session",o);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new k(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.componentDidRender=function(){Z.dynamicDrop(true);Z(".recipient").draggable({listeners:{start:function e(t){t.target.classList.add("dragging");this.el.classList.add("dragging")}.bind(this),move:function e(t){var i=+(t.target.getAttribute("dX")||0);var o=+(t.target.getAttribute("dY")||0);var n=+(t.target.dataset["sequence"]||0);var r=+(t.target.dataset["order"]||0);var s=t.dx+i;var l=t.dy+o;t.target.setAttribute("dX",s);t.target.setAttribute("dY",l);var a=t.target.getBoundingClientRect();console.log("w",a.width);t.target.style.transform="translate(".concat(s+a.width-(r+1),"px, ").concat(l-a.height*n,"px)")}.bind(this),end:function e(t){t.target.classList.remove("dragging");this.el.classList.remove("dragging");t.target.removeAttribute("dX");t.target.removeAttribute("dY");t.target.style.transform=null}.bind(this)}});Z(".dropzone").dropzone({overlap:.05,ondrop:function e(t){return __awaiter(this,void 0,void 0,(function(){var e;return __generator(this,(function(i){switch(i.label){case 0:t.target.classList.remove("active");return[4,this.renumberTemplateRoles()];case 1:i.sent();console.log("[ROLES] Updated roles",this.getSortedRoles());(e=this.rolesUpdated)===null||e===void 0?void 0:e.emit({event:"updated",endpoint:this.endpoint,templateId:this.templateId,roles:this.getSortedRoles()});return[2]}}))}))}.bind(this),ondropactivate:function(e){e.target.classList.add("visible")},ondropdeactivate:function(e){e.target.classList.remove("visible")},ondragenter:function(e){e.target.classList.add("active")},ondragleave:function(e){e.target.classList.remove("active")}})};e.prototype.handleCancel=function(){var e;(e=this.exit)===null||e===void 0?void 0:e.emit()};e.prototype.handleSubmit=function(){var e;(e=this.next)===null||e===void 0?void 0:e.emit()};e.prototype.getSortedRoles=function(){var e;return(((e=this.template)===null||e===void 0?void 0:e.roles)||[]).sort((function(e,t){return e.sequence===t.sequence?e.order-t.order:e.sequence-t.sequence}))};e.prototype.getSequenceNumbers=function(){var e=[];this.getSortedRoles().forEach((function(t){if(!e.includes(t.sequence)){e.push(t.sequence)}}));return e.sort((function(e,t){return e-t}))};e.prototype.getRoleNames=function(){var e=this.getSortedRoles();return e.map((function(e){return e.name}))};e.prototype.getRolesAtSequence=function(e){var t;return(((t=this.template)===null||t===void 0?void 0:t.roles)||[]).filter((function(t){return t&&t.sequence===e}))};e.prototype.renumberTemplateRoles=function(){return __awaiter(this,void 0,void 0,(function(){var e,t;var i=this;return __generator(this,(function(o){e=[];t=[];this.getSequenceNumbers().forEach((function(o,n){i.getRolesAtSequence(o).forEach((function(o,r){if(!e.includes(o.name)){if(o.sequence!==n+1||o.order!==r+1){o.sequence=n+1;o.order=r+1;e.push(o.name);t.push(b(i.endpoint,i.templateId,o.name,{sequence:o.sequence,order:o.order}))}}}))}));if(t.length>0){console.log("[ROLES] Submitting ".concat(t.length," renumber requests"));return[2,Promise.all(t).then((function(){return __awaiter(i,void 0,void 0,(function(){var e;return __generator(this,(function(t){switch(t.label){case 0:e=this;return[4,_.getTemplate(this.endpoint,this.templateId,true)];case 1:e.template=t.sent();return[2]}}))}))}))]}return[2,true]}))}))};e.prototype.getNextRoleName=function(){var e,t;var i="";var o=(((e=this.template)===null||e===void 0?void 0:e.roles)||[]).length;do{o++;i="Recipient ".concat(o)}while(!i||(((t=this.template)===null||t===void 0?void 0:t.roles)||[]).some((function(e){return e&&e.name===i})));return i};e.prototype.callCreateRole=function(e,t,i){var o=this;console.log("[ROLES] Will create role",{name:e,sequence:t,order:i});w(this.endpoint,this.templateId,{template_id:this.templateId,name:e,sequence:t,message:"",order:i,full_name:null,first_name:"",last_name:"",email:"",phone:"",type:"signer",delegator:false,kba_method:null}).then((function(e){return __awaiter(o,void 0,void 0,(function(){var t,i;return __generator(this,(function(o){switch(o.label){case 0:console.log("[ROLES] Created role",e);i=JSON.parse(JSON.stringify(this.template));i.roles.push(e);console.log("Updating template in data store");_.updateTemplate(this.templateId,i);return[4,this.renumberTemplateRoles()];case 1:o.sent();(t=this.rolesUpdated)===null||t===void 0?void 0:t.emit({event:"added",endpoint:this.endpoint,templateId:this.templateId,roles:this.getSortedRoles()});return[2]}}))}))})).catch((function(e){console.log("[ROLES] Error creating role",e)}))};e.prototype.handleAddRole=function(e,t){e.stopPropagation();var i=this.getRolesAtSequence(t).length+1;var o=this.getNextRoleName();this.callCreateRole(o,t,i)};e.prototype.handleAddStep=function(e,t){e.stopPropagation();var i=1;var o=this.getNextRoleName();this.callCreateRole(o,t,i)};e.prototype.render=function(){var e=this;if(!this.endpoint.session){return o(n,null,o("verdocs-component-error",{message:"You must be authenticated to use this module."}))}if(this.loading||!this.template){return o(n,{class:"loading"},o("verdocs-loader",null))}var t=this.getRoleNames();var i=this.getSequenceNumbers();return o(n,null,o("form",{onSubmit:function(e){return e.preventDefault()},onClick:function(e){return e.stopPropagation()},autocomplete:"off"},o("h5",null,"Roles and Workflow"),o("div",{class:"participants"},o("div",{class:"left-line"}),o("div",{class:"row"},o("div",{class:"icon",innerHTML:ye}),o("div",{class:"row-roles"},o("div",{class:"sender"},o("span",{class:"label"},"Send Envelope")))),o("div",{class:"row add-sequence","data-sequence":0},o("div",{class:"icon",innerHTML:Ce}),o("div",{class:"row-roles"},o("div",{class:"dropzone","data-sequence":0,"data-order":1},"Add Step"))),i.map((function(t){return o(r,null,o("div",{class:"row"},o("div",{class:"icon",innerHTML:qe}),o("div",{class:"row-roles"},o("div",{class:"dropzone","data-order":.5,"data-sequence":t}),e.getRolesAtSequence(t).map((function(i){var n=!i.email;return n?o(r,null,o("div",{class:"recipient",style:{backgroundColor:v(O(e.template,i.name))},"data-rolename":i.name,"data-sequence":t,"data-order":i.order},o("span",{class:"type-icon",innerHTML:i.type==="signer"?Me:i.type==="cc"?ze:Se}),i.name," ",o("div",{class:"settings-button",innerHTML:_e,onClick:function(){return e.showingRoleDialog=i.name},"aria-role":"button"})),o("div",{class:"dropzone","data-order":i.order+.5,"data-sequence":t})):o(r,null,o("div",{class:"recipient",style:{borderColor:v(O(e.template,i.name))},"data-rolename":i.name,"data-sequence":t,"data-order":i.order},o("span",{class:"type-icon",innerHTML:i.type==="signer"?Me:i.type==="cc"?ze:Se}),h(i)," ",o("div",{class:"settings-button",innerHTML:_e,onClick:function(){return e.showingRoleDialog=i.name},"aria-role":"button"})),o("div",{class:"dropzone","data-order":i.order+.5,"data-sequence":t}))})),o("button",{class:"add-role",innerHTML:Ce,onClick:function(i){return e.handleAddRole(i,t)}}))),i.length>0&&o("div",{class:"row add-sequence","data-sequence":t},o("div",{class:"row-roles"},o("div",{class:"icon",innerHTML:Ce}),o("div",{class:"dropzone","data-sequence":t+1,"data-order":1},"Add Step"))))})),o("div",{class:"row","data-sequence":i.length+1},o("div",{class:"row-roles"},o("div",{class:"icon",innerHTML:Ce}),o("button",{class:"add-step",innerHTML:Ce,onClick:function(t){return e.handleAddStep(t,i.length+1)}}))),o("div",{class:"row"},o("div",{class:"icon",innerHTML:Ee}),o("div",{class:"row-roles"},o("div",{class:"complete"},"Document Complete")))),t.length<1&&o("div",{class:"empty"},"You must add at least one Role before proceeding.",o("br",null)," Click the ",o("span",{innerHTML:Ce})," Add button above to get started."),o("div",{class:"buttons"},o("div",{class:"flex-fill"}),o("verdocs-button",{variant:"outline",label:"Cancel",size:"small",onClick:function(){return e.handleCancel()}}),o("verdocs-button",{label:"OK",size:"small",onClick:function(){return e.handleSubmit()},disabled:t.length<1}))),this.showingRoleDialog&&o("verdocs-template-role-properties",{endpoint:this.endpoint,templateId:this.templateId,roleName:this.showingRoleDialog,onClose:function(){e.showingRoleDialog=null},onDelete:function(){return __awaiter(e,void 0,void 0,(function(){var e;return __generator(this,(function(t){switch(t.label){case 0:this.showingRoleDialog=null;return[4,this.renumberTemplateRoles()];case 1:t.sent();(e=this.rolesUpdated)===null||e===void 0?void 0:e.emit({event:"deleted",endpoint:this.endpoint,templateId:this.templateId,roles:this.getSortedRoles()});return[2]}}))}))}}))};Object.defineProperty(e.prototype,"el",{get:function(){return s(this)},enumerable:false,configurable:true});return e}());Le.style=ke}}}));
|
@@ -1 +0,0 @@
|
|
1
|
-
var __awaiter=this&&this.__awaiter||function(e,t,i,r){function o(e){return e instanceof i?e:new i((function(t){t(e)}))}return new(i||(i=Promise))((function(i,n){function s(e){try{l(r.next(e))}catch(e){n(e)}}function a(e){try{l(r["throw"](e))}catch(e){n(e)}}function l(e){e.done?i(e.value):o(e.value).then(s,a)}l((r=r.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var i={label:0,sent:function(){if(n[0]&1)throw n[1];return n[1]},trys:[],ops:[]},r,o,n,s;return s={next:a(0),throw:a(1),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]&&(i=0)),i)try{if(r=1,o&&(n=a[0]&2?o["return"]:a[0]?o["throw"]||((n=o["return"])&&n.call(o),0):o.next)&&!(n=n.call(o,a[1])).done)return n;if(o=0,n)a=[a[0]&2,n.value];switch(a[0]){case 0:case 1:n=a;break;case 4:i.label++;return{value:a[1],done:false};case 5:i.label++;o=a[1];a=[0];continue;case 7:a=i.ops.pop();i.trys.pop();continue;default:if(!(n=i.trys,n=n.length>0&&n[n.length-1])&&(a[0]===6||a[0]===2)){i=0;continue}if(a[0]===3&&(!n||a[1]>n[0]&&a[1]<n[3])){i.label=a[1];break}if(a[0]===6&&i.label<n[1]){i.label=n[1];n=a;break}if(n&&i.label<n[2]){i.label=n[2];i.ops.push(a);break}if(n[2])i.ops.pop();i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e];o=0}finally{r=n=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};System.register(["./p-9186f42e.system.js","@verdocs/js-sdk","./p-c8a15cb7.system.js","./p-c18c718f.system.js"],(function(e){"use strict";var t,i,r,o,n,s,a,l,c,d,f;return{setters:[function(e){t=e.r;i=e.c;r=e.h;o=e.H},function(e){n=e.VerdocsEndpoint;s=e.getTemplate;a=e.updateTemplateRole;l=e.deleteTemplateRole;c=e.isValidEmail},function(e){d=e.S},function(e){f=e.S}],execute:function(){var u='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-template-role-properties{font-family:"Inter", "Barlow", sans-serif;-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-template-role-properties div{-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-template-role-properties .background-overlay{position:fixed;z-index:10000;top:0;left:0;right:0;bottom:0;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;background:rgba(0, 0, 0, 0.4980392157)}verdocs-template-role-properties .dialog{width:340px;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;border-radius:4px;overflow:hidden;background:#ffffff;padding:16px;-webkit-box-shadow:3px 3px 5px 1px rgba(40, 40, 40, 0.4);box-shadow:3px 3px 5px 1px rgba(40, 40, 40, 0.4)}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:end;justify-content:flex-end}verdocs-template-role-properties .buttons verdocs-button{margin-left:16px}verdocs-template-role-properties form .row{display:-ms-flexbox;display:flex;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;margin:0 0 10px 0;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row}verdocs-template-role-properties form .row .input-label{display:block;color:#555570;font-weight:700;font-size:14px;margin:0 0 4px 0;-ms-flex:0 0 100px;flex:0 0 100px}verdocs-template-role-properties verdocs-select-input{-ms-flex:1;flex:1;margin:0}verdocs-template-role-properties verdocs-text-input{margin:0 0 10px 0}verdocs-template-role-properties verdocs-text-input label{margin:0;display:-ms-flexbox;display:flex;-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}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 p=u;var h='<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 b=e("verdocs_template_role_properties",function(){function e(e){t(this,e);this.close=i(this,"close",7);this.delete=i(this,"delete",7);this.sdkError=i(this,"sdkError",7);this.templateListenerId=null;this.endpoint=n.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(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("[ROLES Error with preview session",r);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new d(r.message,(t=r.response)===null||t===void 0?void 0:t.status,(i=r.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();f.subscribe("templates",this.templateId,(function(){return s(e.endpoint,e.templateId)}),false,(function(t){var i;console.log("[BUILD] Template Updated",t);e.template=t;e.loading=false;var r=(i=e.template)===null||i===void 0?void 0:i.roles.find((function(t){return t.name===e.roleName}));if(r){e.name=r.name;e.type=r.type;e.first_name=r.first_name;e.last_name=r.last_name;e.email=r.email;e.phone=r.phone;e.delegator=r.delegator;console.log("[ROLES] Editing role",r)}}));return[2]}))}))};e.prototype.unlistenToTemplate=function(){if(this.templateListenerId){f.store.delListener(this.templateListenerId);this.templateListenerId=null}};e.prototype.handleCancel=function(e){var t=this;var i,r;e.stopPropagation();var o=(i=this.template)===null||i===void 0?void 0:i.roles.find((function(e){return e.name===t.roleName}));if(o){this.name=o.name;this.type=o.type;this.first_name=o.first_name;this.last_name=o.last_name;this.email=o.email;this.phone=o.phone;this.delegator=o.delegator}this.dirty=false;(r=this.close)===null||r===void 0?void 0:r.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;a(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,r;var o=this;return __generator(this,(function(n){console.log("[ROLES] Update result",e);this.saving=false;this.dirty=false;i=JSON.parse(JSON.stringify(this.template));r=i.roles.findIndex((function(e){return e.name===o.roleName}));if(r>-1){i.roles[r]=e}f.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.")){l(this.endpoint,this.templateId,this.roleName).then((function(){var e;var i=JSON.parse(JSON.stringify(t.template));i.roles=i.roles.filter((function(e){return e.name!==t.roleName}));f.updateTemplate(t.templateId,i);(e=t.delete)===null||e===void 0?void 0:e.emit({templateId:t.templateId,roleName:t.roleName})})).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 n=!this.email&&!this.first_name&&!this.last_name||c(this.email)&&!!this.first_name&&!!this.last_name;return r(o,{key:"102da3ce6fe126e5d96bfdad33ce2332c002ec2e"},r("div",{key:"affa176073f3f154c75afbf4ef7e311160ebdca5",class:"background-overlay",onClick:function(t){return e.handleCancel(t)}},r("div",{key:"e7e1f7f3de70de90f2d7460dd4c6fe51afa8f2d4",class:"dialog"},r("form",{key:"a341963c15f5f246afc5b1ed90ec47e3bde50569",onSubmit:function(e){return e.preventDefault()},onClick:function(e){return e.stopPropagation()},autocomplete:"off"},r("verdocs-text-input",{key:"ca96ff8a9a1b64cb6b7e7eef45483ef296892d6f",id:"verdocs-role-name",label:"Role Name",value:this.name,autocomplete:"off",disabled:i,helpText:i?"This role has fields assigned and can no longer be renamed.":"A unique name to identify the role in the workflow. Submitted data will also be tagged with this value.",placeholder:"Role Name...",onInput:function(t){e.name=t.target.value;e.dirty=true}}),r("div",{key:"b76f4c923debceaa4344dae57e339c51034aacad",class:"row"},r("div",{key:"20de0838df0f1da364db39ee7d4dc42e693591f5",class:"input-label"},"Type:"),r("verdocs-select-input",{key:"f9422ad0a0fbd035257b42d5dfa016ce25568245",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}}),r("verdocs-help-icon",{key:"062ccda44d2bdd3597ad0490d6cedd53fb68f552",text:"Most participants are Signers. CC roles are notified when documents are signed, but have no other actions. Approvers get notified when signing is completed to perform a final review."})),r("verdocs-text-input",{key:"40d92aae3e847ad709516f63beb77880ab5d2e79",id:"verdocs-recipient-first",label:"First Name",value:this.first_name,autocomplete:"off",helpText:"The recipient's first name, if it will always stay the same. Leave blank to supply this value later, when each new envelope is created from the template.",placeholder:"First Name...",onInput:function(t){e.first_name=t.target.value;e.dirty=true}}),r("verdocs-text-input",{key:"651332b8be0006dfd9b4204ecede52fc7c457085",id:"verdocs-recipient-first",label:"Last Name",value:this.last_name,autocomplete:"off",helpText:"The recipient's last name, if it will always stay the same. Leave blank to supply this value later, when each new envelope is created from the template.",placeholder:"Last Name...",onInput:function(t){e.last_name=t.target.value;e.dirty=true}}),r("verdocs-text-input",{key:"de23199658c23f656fdf4094d31ed9286b9c905d",id:"verdocs-recipient-email",label:"Email",value:this.email,autocomplete:"off",helpText:"The recipient's email address, if it will always stay the same. Leave blank to supply this value later, when each new envelope is created from the template.",placeholder:"Email Address...",onInput:function(t){e.email=t.target.value;e.dirty=true}}),r("verdocs-text-input",{key:"91c002d783b626789061263bd2ab18f7d025e6cf",id:"verdocs-recipient-phone",label:"Phone",value:this.phone,autocomplete:"off",helpText:"The recipient's phone number, if it will always stay the same. Leave blank to supply this value later, when each new envelope is created from the template.",placeholder:"Phone Number...",onInput:function(t){e.phone=t.target.value;e.dirty=true}}),r("div",{key:"1da980c9a76708b5beafd01d07f992f8e4b209ba",class:"row"},r("div",{key:"e6528032c5564b1b88cc61cdd1f76cf86f66de77",class:"input-label"},"May Delegate:"),r("div",{key:"576b21970df51edf1bc402151102a6a6ce46c1d1",class:"checkbox-wrapper"},r("verdocs-checkbox",{key:"bf90ad2eef24df1e8c3ee9f0bc0357fa5a212b8d",checked:this.delegator,onInput:function(t){e.delegator=t.target.checked;e.dirty=true}})),r("verdocs-help-icon",{key:"8fd89809fdf15cc2945bd5f2706b9ea5650be967",text:"If enabled, this recipient may delegate their actions to another individual."})),r("div",{key:"20a749cf6c01a756c62e0dab9b66260a474beadd",class:"buttons"},r("button",{key:"2d756a1fe49c0feb5bfabde2dd5eb926c8d5f5f0",class:"delete-button",disabled:this.dirty,onClick:function(t){return e.handleDelete(t)},innerHTML:h}),r("div",{key:"2f5d400fa6d311717242579b6c18dd0798e1eeb1",style:{flex:"1"}}),r("verdocs-button",{key:"1f24710e162558f9201f4f94730053c12278d4cb",size:"small",variant:"outline",label:"Cancel",disabled:!this.dirty,onClick:function(t){return e.handleCancel(t)}}),r("verdocs-button",{key:"64f60a9cc4a4154b895880310dc40c037359f3bb",size:"small",label:"Save",disabled:!this.dirty||!n,onClick:function(t){return e.handleSave(t)}}))))))};return e}());b.style=p}}}));
|
@@ -1 +0,0 @@
|
|
1
|
-
System.register(["./p-9186f42e.system.js","./p-2c5350ec.system.js"],(function(o){"use strict";var e,r,i,a,c;return{setters:[function(o){e=o.r;r=o.h;i=o.H;a=o.c},function(o){c=o.f}],execute:function(){var d='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-organization-card{font-family:"Inter", "Barlow", sans-serif;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center;border:1px solid #cccccc;background:#ffffff;border-radius:8px;padding:7px 15px}verdocs-organization-card .icon{-ms-flex:0;flex:0;height:24px;width:24px;margin:0 14px 0 0}verdocs-organization-card .icon svg{fill:#aeb4bf;height:24px;width:24px}verdocs-organization-card .content{margin-top:2px}.verdocs-org-card-popup{font-family:"Inter", "Barlow", sans-serif;background:#ffffff;border-radius:10px;width:326px;padding:20px 40px 0 40px;-ms-flex-direction:column;flex-direction:column;-ms-flex-wrap:nowrap;flex-wrap:nowrap;border:1px solid #cccccc}.verdocs-org-card-popup .popup-header-with-logo{display:-ms-flexbox;display:flex;-ms-flex:0;flex:0;gap:20px;-ms-flex-direction:column;flex-direction:column;margin:0 0 20px 0;font-size:21px;line-height:16px;color:#4c56cb}.verdocs-org-card-popup .popup-header-with-logo img{max-width:300px;max-height:50px}.verdocs-org-card-popup .popup-header{display:-ms-flexbox;display:flex;-ms-flex:0;flex:0;gap:20px;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:end;align-items:flex-end;margin:0 0 20px 0;font-size:21px;line-height:16px;color:#4c56cb}.verdocs-org-card-popup .popup-body{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;font-size:14px;text-transform:uppercase}.verdocs-org-card-popup .status{-webkit-transform:scale(1.5);transform:scale(1.5);width:24px;height:24px}.verdocs-org-card-popup .field{margin:0 0 20px 0}.verdocs-org-card-popup .field strong{color:#7b7b9a;display:block;margin:0 0 5px 0}.verdocs-org-card-popup .field a{color:#654dcb;text-transform:uppercase}';var s=d;var t='<svg xmlns="http://www.w3.org/2000/svg" focusable="false" aria-hidden="true" height="24px" viewBox="0 0 24 24" width="24px"><path d="M12 7V3H2v18h20V7H12zM6 19H4v-2h2v2zm0-4H4v-2h2v2zm0-4H4V9h2v2zm0-4H4V5h2v2zm4 12H8v-2h2v2zm0-4H8v-2h2v2zm0-4H8V9h2v2zm0-4H8V5h2v2zm10 12h-8v-2h2v-2h-2v-2h2v-2h-2V9h8v10zm-2-8h-2v2h2v-2zm0 4h-2v2h2v-2z"></path></svg>';var n=o("verdocs_organization_card",function(){function o(o){e(this,o);this.organization=undefined;this.hovered=false}o.prototype.onMouseOver=function(){this.hovered=true};o.prototype.onMouseOut=function(){this.hovered=false};o.prototype.render=function(){var o,e,a,d,s,n;console.log("Rendering org card",this.organization.thumbnail_url,this.organization);var l=t;var f="verdocs-org-card-".concat(this.organization.id);return r(i,{key:"d7b475ffa8a508828c58362f1d132313910db262",id:f},this.organization.thumbnail_url?r("img",{class:"icon",src:this.organization.thumbnail_url,alt:"Logo"}):r("span",{class:"icon",innerHTML:l}),r("span",{key:"41371ad0ece9b5b13c455313658b3983facf5db5",class:"content"},(o=this.organization)===null||o===void 0?void 0:o.name),r("verdocs-portal",{key:"37b667310a2124dc68a88a8b5732ecd4a87f9da1",anchor:f},r("div",{key:"7f72d2f2c25314cdfa81721c6b6653989c7be72b",class:"verdocs-org-card-popup",style:{display:this.hovered?"block":"none"}},this.organization.full_logo_url?r("div",{class:"popup-header-with-logo"},r("img",{src:this.organization.full_logo_url,alt:"Logo"}),r("div",{class:"title"},(e=this.organization)===null||e===void 0?void 0:e.name)):r("div",{class:"popup-header"},r("span",{class:"status"},r("span",{class:"icon",innerHTML:l})),r("span",{class:"title"},(a=this.organization)===null||a===void 0?void 0:a.name)),r("div",{key:"478657fefd75b3adda14550ce7dd8117ee3f519f",class:"popup-body"},r("div",{key:"213022879f5f5d2cab6cf415692e418911e1ee05",class:"field"},r("strong",{key:"3e36b9b9ef2dd6b39dc313c77772b750d7bdb242"},"Joined"),c(new Date(((d=this.organization)===null||d===void 0?void 0:d.created_at)||undefined),"LLL d, Y")),this.organization.url&&r("div",{key:"b28cb49fe0214c3f0851fe4609433ada584bf0be",class:"field"},r("strong",{key:"9cdfd0da0dcb3d51149b1e0bc2f612e0f0edab6d"},"Website"),r("a",{key:"74be8e66995435c5e6a071098ec1d4a6a7ca6f5f",href:(s=this.organization)===null||s===void 0?void 0:s.url,target:"_blank",rel:"nofollow"},(n=this.organization)===null||n===void 0?void 0:n.url))))))};return o}());n.style=s;var l="@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}";var f=l;var p="10001";var u=o("verdocs_portal",function(){function o(o){e(this,o);this.clickAway=a(this,"clickAway",7);this.moved=false;this.anchor=undefined;this.voffset=0}o.prototype.handleScroll=function(){this.calculatePosition()};o.prototype.handleResize=function(){this.calculatePosition()};o.prototype.handleClick=function(o){var e;if(!this.element.contains(o.target)){(e=this.clickAway)===null||e===void 0?void 0:e.emit()}};o.prototype.calculateLeft=function(){var o;var e=document.getElementById(this.anchor);if(!e)return 0;var r=e.getBoundingClientRect();var i=document.documentElement.clientWidth+document.documentElement.scrollLeft;var a=Math.max(r.left,0);var c=((o=this.element)===null||o===void 0?void 0:o.offsetWidth)||400;var d=a+c>i;return d?i-c-20:a};o.prototype.calculateTop=function(){var o;var e=document.getElementById(this.anchor);if(!e)return 0;var r=e.getBoundingClientRect();var i=document.documentElement.clientHeight+document.documentElement.scrollTop;var a=r.bottom+this.voffset+document.documentElement.scrollTop;var c=((o=this.element)===null||o===void 0?void 0:o.offsetHeight)||300;var d=a+c>i;return d?a-c-r.height:a};o.prototype.calculatePosition=function(){this.portal.style.top="".concat(this.calculateTop(),"px");this.portal.style.left="".concat(this.calculateLeft(),"px")};o.prototype.componentWillLoad=function(){var o;var e="".concat(this.anchor,"-portal");(o=document.getElementById(e))===null||o===void 0?void 0:o.remove();this.portal=document.createElement("div");this.portal.setAttribute("id",e);this.portal.style.zIndex=p;this.portal.style.position="absolute";document.body.append(this.portal)};o.prototype.componentDidLoad=function(){this.portal.appendChild(this.element);this.calculatePosition()};o.prototype.disconnectedCallback=function(){this.moved?this.portal.remove():this.moved=true};o.prototype.render=function(){var o=this;return r(i,{key:"7379bf2578c769bf6112486912c7aa30b429fae1",ref:function(e){return o.element=e}},r("slot",{key:"3b141548481e6dd23f47ed4e0db78e3931a5bdaa"}))};return o}());u.style=f}}}));
|
@@ -1 +0,0 @@
|
|
1
|
-
import{r as e,c as t,h as i,H as s}from"./p-b9654a5e.js";import{VerdocsEndpoint as o,getTemplate as l,updateTemplateRole as a,deleteTemplateRole as r,isValidEmail as d}from"@verdocs/js-sdk";import{S as n}from"./p-fd97809c.js";import{S as c}from"./p-da4d4eed.js";const p=class{constructor(i){e(this,i),this.close=t(this,"close",7),this.delete=t(this,"delete",7),this.sdkError=t(this,"sdkError",7),this.templateListenerId=null,this.endpoint=o.getDefault(),this.templateId="",this.roleName="",this.dirty=!1,this.saving=!1,this.name="",this.type="signer",this.first_name="",this.last_name="",this.email="",this.phone="",this.delegator=!1,this.loading=!0,this.template=null}async componentWillLoad(){var e,t,i;try{if(this.endpoint.loadSession(),!this.templateId)return void console.log(`[ROLES] Missing required template ID ${this.templateId}`);if(!this.endpoint.session)return void console.log("[ROLES] Unable to start builder session, must be authenticated");this.listenToTemplate()}catch(s){console.log("[ROLES Error with preview session",s),null===(e=this.sdkError)||void 0===e||e.emit(new n(s.message,null===(t=s.response)||void 0===t?void 0:t.status,null===(i=s.response)||void 0===i?void 0:i.data))}}disconnectedCallback(){this.unlistenToTemplate()}async listenToTemplate(){console.log("[ROLES] Loading tempate",this.templateId),this.unlistenToTemplate(),c.subscribe("templates",this.templateId,(()=>l(this.endpoint,this.templateId)),!1,(e=>{var t;console.log("[BUILD] Template Updated",e),this.template=e,this.loading=!1;const i=null===(t=this.template)||void 0===t?void 0:t.roles.find((e=>e.name===this.roleName));i&&(this.name=i.name,this.type=i.type,this.first_name=i.first_name,this.last_name=i.last_name,this.email=i.email,this.phone=i.phone,this.delegator=i.delegator,console.log("[ROLES] Editing role",i))}))}unlistenToTemplate(){this.templateListenerId&&(c.store.delListener(this.templateListenerId),this.templateListenerId=null)}handleCancel(e){var t,i;e.stopPropagation();const s=null===(t=this.template)||void 0===t?void 0:t.roles.find((e=>e.name===this.roleName));s&&(this.name=s.name,this.type=s.type,this.first_name=s.first_name,this.last_name=s.last_name,this.email=s.email,this.phone=s.phone,this.delegator=s.delegator),this.dirty=!1,null===(i=this.close)||void 0===i||i.emit()}async handleSave(e){e.stopPropagation(),this.saving=!0,a(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((async e=>{var t;console.log("[ROLES] Update result",e),this.saving=!1,this.dirty=!1;const i=JSON.parse(JSON.stringify(this.template)),s=i.roles.findIndex((e=>e.name===this.roleName));s>-1&&(i.roles[s]=e),c.updateTemplate(this.templateId,i),null===(t=this.close)||void 0===t||t.emit()})).catch((e=>{console.log("[ROLES Update error",e),this.saving=!1}))}async handleDelete(e){e.stopPropagation(),window.confirm("Are you sure you wish to remove this role? All associated fields will be removed as well. This action cannot be undone.")&&r(this.endpoint,this.templateId,this.roleName).then((()=>{var e;const t=JSON.parse(JSON.stringify(this.template));t.roles=t.roles.filter((e=>e.name!==this.roleName)),c.updateTemplate(this.templateId,t),null===(e=this.delete)||void 0===e||e.emit({templateId:this.templateId,roleName:this.roleName})})).catch((e=>{console.log("[ROLES Deletion error",e)}))}render(){var e;const t=((null===(e=this.template)||void 0===e?void 0:e.fields)||[]).some((e=>e.role_name===this.roleName)),o=!this.email&&!this.first_name&&!this.last_name||d(this.email)&&!!this.first_name&&!!this.last_name;return i(s,{key:"102da3ce6fe126e5d96bfdad33ce2332c002ec2e"},i("div",{key:"affa176073f3f154c75afbf4ef7e311160ebdca5",class:"background-overlay",onClick:e=>this.handleCancel(e)},i("div",{key:"e7e1f7f3de70de90f2d7460dd4c6fe51afa8f2d4",class:"dialog"},i("form",{key:"a341963c15f5f246afc5b1ed90ec47e3bde50569",onSubmit:e=>e.preventDefault(),onClick:e=>e.stopPropagation(),autocomplete:"off"},i("verdocs-text-input",{key:"ca96ff8a9a1b64cb6b7e7eef45483ef296892d6f",id:"verdocs-role-name",label:"Role Name",value:this.name,autocomplete:"off",disabled:t,helpText:t?"This role has fields assigned and can no longer be renamed.":"A unique name to identify the role in the workflow. Submitted data will also be tagged with this value.",placeholder:"Role Name...",onInput:e=>{this.name=e.target.value,this.dirty=!0}}),i("div",{key:"b76f4c923debceaa4344dae57e339c51034aacad",class:"row"},i("div",{key:"20de0838df0f1da364db39ee7d4dc42e693591f5",class:"input-label"},"Type:"),i("verdocs-select-input",{key:"f9422ad0a0fbd035257b42d5dfa016ce25568245",value:this.type,options:[{label:"Signer",value:"signer"},{label:"CC",value:"cc"},{label:"Approver",value:"approver"}],onInput:e=>{this.type=e.target.value,this.dirty=!0}}),i("verdocs-help-icon",{key:"062ccda44d2bdd3597ad0490d6cedd53fb68f552",text:"Most participants are Signers. CC roles are notified when documents are signed, but have no other actions. Approvers get notified when signing is completed to perform a final review."})),i("verdocs-text-input",{key:"40d92aae3e847ad709516f63beb77880ab5d2e79",id:"verdocs-recipient-first",label:"First Name",value:this.first_name,autocomplete:"off",helpText:"The recipient's first name, if it will always stay the same. Leave blank to supply this value later, when each new envelope is created from the template.",placeholder:"First Name...",onInput:e=>{this.first_name=e.target.value,this.dirty=!0}}),i("verdocs-text-input",{key:"651332b8be0006dfd9b4204ecede52fc7c457085",id:"verdocs-recipient-first",label:"Last Name",value:this.last_name,autocomplete:"off",helpText:"The recipient's last name, if it will always stay the same. Leave blank to supply this value later, when each new envelope is created from the template.",placeholder:"Last Name...",onInput:e=>{this.last_name=e.target.value,this.dirty=!0}}),i("verdocs-text-input",{key:"de23199658c23f656fdf4094d31ed9286b9c905d",id:"verdocs-recipient-email",label:"Email",value:this.email,autocomplete:"off",helpText:"The recipient's email address, if it will always stay the same. Leave blank to supply this value later, when each new envelope is created from the template.",placeholder:"Email Address...",onInput:e=>{this.email=e.target.value,this.dirty=!0}}),i("verdocs-text-input",{key:"91c002d783b626789061263bd2ab18f7d025e6cf",id:"verdocs-recipient-phone",label:"Phone",value:this.phone,autocomplete:"off",helpText:"The recipient's phone number, if it will always stay the same. Leave blank to supply this value later, when each new envelope is created from the template.",placeholder:"Phone Number...",onInput:e=>{this.phone=e.target.value,this.dirty=!0}}),i("div",{key:"1da980c9a76708b5beafd01d07f992f8e4b209ba",class:"row"},i("div",{key:"e6528032c5564b1b88cc61cdd1f76cf86f66de77",class:"input-label"},"May Delegate:"),i("div",{key:"576b21970df51edf1bc402151102a6a6ce46c1d1",class:"checkbox-wrapper"},i("verdocs-checkbox",{key:"bf90ad2eef24df1e8c3ee9f0bc0357fa5a212b8d",checked:this.delegator,onInput:e=>{this.delegator=e.target.checked,this.dirty=!0}})),i("verdocs-help-icon",{key:"8fd89809fdf15cc2945bd5f2706b9ea5650be967",text:"If enabled, this recipient may delegate their actions to another individual."})),i("div",{key:"20a749cf6c01a756c62e0dab9b66260a474beadd",class:"buttons"},i("button",{key:"2d756a1fe49c0feb5bfabde2dd5eb926c8d5f5f0",class:"delete-button",disabled:this.dirty,onClick:e=>this.handleDelete(e),innerHTML:'<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>'}),i("div",{key:"2f5d400fa6d311717242579b6c18dd0798e1eeb1",style:{flex:"1"}}),i("verdocs-button",{key:"1f24710e162558f9201f4f94730053c12278d4cb",size:"small",variant:"outline",label:"Cancel",disabled:!this.dirty,onClick:e=>this.handleCancel(e)}),i("verdocs-button",{key:"64f60a9cc4a4154b895880310dc40c037359f3bb",size:"small",label:"Save",disabled:!this.dirty||!o,onClick:e=>this.handleSave(e)}))))))}};p.style='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-template-role-properties{font-family:"Inter", "Barlow", sans-serif;-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-template-role-properties div{-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-template-role-properties .background-overlay{position:fixed;z-index:10000;top:0;left:0;right:0;bottom:0;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;background:rgba(0, 0, 0, 0.4980392157)}verdocs-template-role-properties .dialog{width:340px;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;border-radius:4px;overflow:hidden;background:#ffffff;padding:16px;-webkit-box-shadow:3px 3px 5px 1px rgba(40, 40, 40, 0.4);box-shadow:3px 3px 5px 1px rgba(40, 40, 40, 0.4)}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:end;justify-content:flex-end}verdocs-template-role-properties .buttons verdocs-button{margin-left:16px}verdocs-template-role-properties form .row{display:-ms-flexbox;display:flex;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;margin:0 0 10px 0;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row}verdocs-template-role-properties form .row .input-label{display:block;color:#555570;font-weight:700;font-size:14px;margin:0 0 4px 0;-ms-flex:0 0 100px;flex:0 0 100px}verdocs-template-role-properties verdocs-select-input{-ms-flex:1;flex:1;margin:0}verdocs-template-role-properties verdocs-text-input{margin:0 0 10px 0}verdocs-template-role-properties verdocs-text-input label{margin:0;display:-ms-flexbox;display:flex;-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}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}';export{p as verdocs_template_role_properties}
|
@@ -1 +0,0 @@
|
|
1
|
-
import{r as e,c as t,h as s,H as i,F as o,g as l}from"./p-b9654a5e.js";import{VerdocsEndpoint as a,getTemplate as n,integerSequence as r,getOrganizationContacts as d,isValidEmail as c,createEnvelope as p,getRGBA as h,formatFullName as m,createTemplateDocument as v,deleteTemplateDocument as g,updateField as u,createField as f,updateTemplateRole as x,createTemplateRole as b}from"@verdocs/js-sdk";import{S as w}from"./p-fd97809c.js";import{S as k}from"./p-da4d4eed.js";import{V as y}from"./p-04c07b7b.js";import{D as q,P as C,J as E,a as S,F as M,b as T,T as L}from"./p-b0766439.js";import{f as H}from"./p-12bab948.js";import{i as z}from"./p-a901dff2.js";import{b as Z,c as I,d as V,g as D,e as N,f as _}from"./p-cfed8cc1.js";import"./p-85aa8e05.js";import"./p-c7ee88c7.js";const R=class{constructor(s){e(this,s),this.sdkError=t(this,"sdkError",7),this.templateListenerId=null,this.endpoint=a.getDefault(),this.templateId=null,this.loading=!0,this.template=null}disconnectedCallback(){this.unlistenToTemplate()}async listenToTemplate(){this.unlistenToTemplate(),k.subscribe("templates",this.templateId,(()=>n(this.endpoint,this.templateId)),!1,(e=>{this.template=e,this.loading=!1}))}unlistenToTemplate(){this.templateListenerId&&(k.store.delListener(this.templateListenerId),this.templateListenerId=null)}onTemplateIdChanged(e){console.log("[PREVIEW] Template ID changed",e),this.listenToTemplate()}async componentWillLoad(){var e,t,s;try{if(this.endpoint.loadSession(),!this.endpoint.session)return void console.log("[PREVIEW] Unable to start builder session, must be authenticated");if(!this.templateId)return void console.log(`[PREVIEW] Missing required template ID ${this.templateId}`);this.listenToTemplate()}catch(i){console.log("[PREVIEW] Error with preview session",i),null===(e=this.sdkError)||void 0===e||e.emit(new w(i.message,null===(t=i.response)||void 0===t?void 0:t.status,null===(s=i.response)||void 0===s?void 0:s.data))}}handlePageRendered(e){}render(){var e;return s(i,null,this.loading?s("verdocs-loader",null):((null===(e=this.template)||void 0===e?void 0:e.documents)||[]).map((e=>{const t=r(1,e.pages);return s(o,null,t.map((t=>{var i;const o=(null===(i=e.page_sizes)||void 0===i?void 0:i[t])||{width:612,height:792};return s("verdocs-template-document-page",{templateId:e.template_id,documentId:e.id,pageNumber:t,disabled:!0,editable:!1,done:!1,virtualWidth:o.width,virtualHeight:o.height,onPageRendered:e=>this.handlePageRendered(e),layers:[{name:"page",type:"canvas"},{name:"controls",type:"div"}]})})))})))}static get watchers(){return{templateId:["onTemplateIdChanged"]}}};R.style='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-preview{font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", 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}';const A=e=>((null==e?void 0:e.roles)||[]).map((e=>e.name)),U=(e,t)=>Math.max(A(e).findIndex((e=>e===t)),0),B='<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>',Q=class{constructor(s){e(this,s),this.sendingEnvelope=t(this,"sendingEnvelope",7),this.send=t(this,"send",7),this.exit=t(this,"exit",7),this.sdkError=t(this,"sdkError",7),this.searchContacts=t(this,"searchContacts",7),this.templateListenerId=null,this.endpoint=a.getDefault(),this.templateId=null,this.environment="",this.containerId=`verdocs-send-${Math.random().toString(36).substring(2,11)}`,this.showPickerForId="",this.sessionContacts=[],this.sending=!1,this.rolesCompleted={},this.loading=!0,this.template=null}disconnectedCallback(){this.unlistenToTemplate()}async listenToTemplate(){console.log("[SEND] Loading template",this.templateId),this.unlistenToTemplate(),k.subscribe("templates",this.templateId,(()=>n(this.endpoint,this.templateId)),!1,(e=>{this.template=e,this.loading=!1,this.rolesCompleted={}}))}unlistenToTemplate(){this.templateListenerId&&(k.store.delListener(this.templateListenerId),this.templateListenerId=null)}async reset(){this.rolesCompleted={}}onTemplateIdChanged(e){console.log("[SEND] Template ID changed",e),this.listenToTemplate()}async componentWillLoad(){var e,t,s;try{if(this.endpoint.onSessionChanged(((e,t,s)=>{if(!s)return;const i={id:s.id,first_name:s.first_name,last_name:s.last_name,email:s.email,phone:s.phone};s&&(this.sessionContacts=[i],d(this.endpoint).then((e=>{console.log("[SEND] Got contacts",e),this.sessionContacts=[...e,i]})).catch((e=>{console.log("[SEND] Error getting contacts",e)})))})),this.endpoint.loadSession(),!this.endpoint.session)return void console.log("[SEND] Unable to start Send operation, must be authenticated");if(!this.templateId)return void console.log(`[SEND] Missing required template ID ${this.templateId}`);this.listenToTemplate()}catch(i){console.log("[SEND] Error with send session",i),null===(e=this.sdkError)||void 0===e||e.emit(new w(i.message,null===(t=i.response)||void 0===t?void 0:t.status,null===(s=i.response)||void 0===s?void 0:s.data))}}recomputeRolesCompleted(){var e;this.rolesCompleted={};const t={};((null===(e=this.template)||void 0===e?void 0:e.roles)||[]).forEach((e=>{const s=e.sequence-1;t[s]||(t[s]=[]);const i=`r-${s}-${t[s].length}`;t[s].push({...e,id:i,role_name:e.name,first_name:e.first_name,last_name:e.last_name}),e.first_name&&c(e.email)&&(this.rolesCompleted[i]={...e,id:i,role_name:e.name,first_name:e.first_name,last_name:e.last_name})}))}getLevels(){var e;const t=[...new Set(((null===(e=this.template)||void 0===e?void 0:e.roles)||[]).map((e=>e.sequence-1)))];return t.sort(((e,t)=>e-t)),t}getRolesAtLevel(e){var t;return((null===(t=this.template)||void 0===t?void 0:t.roles)||[]).filter((t=>t.sequence-1===e)).map(((t,s)=>({...t,id:`r-${e}-${s}`,role_name:t.name,first_name:"",last_name:""})))}getLevelIcon(e){const t=this.getLevels();return s("div",e<0?{class:"level-icon",innerHTML:'<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>'}:e>=t.length?{class:"level-icon",innerHTML:'<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>'}:{class:"level-icon",innerHTML:'<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>'})}handleSelectContact(e,t){e.preventDefault(),this.rolesCompleted[t.id]={...t,...e.detail},this.showPickerForId=""}handleClickRole(e,t){e.stopPropagation(),this.showPickerForId=t.id}handleSend(e){var t,s;if(this.sending)return void console.log("[SEND] Skipping duplicate send",e);console.log("[SEND] Sending",e),e.preventDefault(),e.stopPropagation(),this.sending=!0,null===(t=this.sendingEnvelope)||void 0===t||t.emit({sending:!0});const i={template_id:this.templateId,name:(null===(s=this.template)||void 0===s?void 0:s.name)||"New Envelope",environment:this.environment,initial_reminder:0,followup_reminders:0,recipients:Object.values(this.rolesCompleted),fields:[]};console.log("[SEND] Creating envelope",i),p(this.endpoint,i).then((e=>{var t,s;console.log("[SEND] Send envelope",e),this.reset().catch((e=>console.log("Unknown Error",e))),this.sending=!1,null===(t=this.sendingEnvelope)||void 0===t||t.emit({sending:!1}),null===(s=this.send)||void 0===s||s.emit({...i,name:i.name,envelope_id:e.id,envelope:e})})).catch((e=>{var t,s,i;console.log("Send error",e),y((null===(s=null===(t=e.response)||void 0===t?void 0:t.data)||void 0===s?void 0:s.error)||"Error creating envelope, please try again later."),this.sending=!1,null===(i=this.sendingEnvelope)||void 0===i||i.emit({sending:!1})}))}handleCancel(e){var t;e.stopPropagation(),null===(t=this.exit)||void 0===t||t.emit()}render(){var e;if(this.loading)return s(i,null,s("verdocs-loader",null));if(!this.endpoint.session)return s(i,{style:{display:"flex"}},s("verdocs-component-error",{message:"You must be authenticated to use this module."}));const t=this.getLevels(),o=Object.values(this.rolesCompleted).filter((e=>c(e.email))).length>=A(this.template).length;return s(i,{class:{sendable:null===(e=this.template)||void 0===e?void 0:e.is_sendable}},s("div",{class:"recipients"},s("div",{class:"left-line"}),s("div",{class:"level level-start"},this.getLevelIcon(-1),s("div",{class:"complete"},"Send Envelope")),t.map((e=>s("div",{class:`level level-${e}`},this.getLevelIcon(e),this.getRolesAtLevel(e).map((e=>{var t,i,o,l;const a=!e.email,n=`verdocs-send-recipient-${e.role_name}`,r=U(this.template,e.role_name),d=h(r);return a?s("div",{class:"recipient","data-ri":r,"data-rn":e.role_name,style:{backgroundColor:d},onClick:t=>this.handleClickRole(t,e),id:n},(null===(t=this.rolesCompleted[e.id])||void 0===t?void 0:t.first_name)?m(this.rolesCompleted[e.id]):e.role_name,s("div",{class:"icon",innerHTML:B}),this.showPickerForId===e.id&&s("verdocs-portal",{anchor:n,onClickAway:()=>this.showPickerForId=""},s("verdocs-contact-picker",{onExit:()=>this.showPickerForId="",onNext:t=>this.handleSelectContact(t,e),contactSuggestions:this.sessionContacts,templateRole:null!==(i=this.rolesCompleted[e.id])&&void 0!==i?i:e,onSearchContacts:e=>{var t;return null===(t=this.searchContacts)||void 0===t?void 0:t.emit(e.detail)}}))):s("div",{class:"recipient",style:{borderColor:d},onClick:t=>this.handleClickRole(t,e),id:n},(null===(o=this.rolesCompleted[e.id])||void 0===o?void 0:o.first_name)?m(this.rolesCompleted[e.id]):e.role_name,s("div",{class:"icon",innerHTML:B}),this.showPickerForId===e.id&&s("verdocs-portal",{anchor:n,onClickAway:()=>this.showPickerForId=""},s("verdocs-contact-picker",{onExit:()=>this.showPickerForId="",onNext:t=>this.handleSelectContact(t,e),contactSuggestions:this.sessionContacts,templateRole:null!==(l=this.rolesCompleted[e.id])&&void 0!==l?l:e,onSearchContacts:e=>{var t;return null===(t=this.searchContacts)||void 0===t?void 0:t.emit(e.detail)}})))}))))),s("div",{class:"level level-done"},this.getLevelIcon(t.length),s("div",{class:"complete"},"Signing Complete"))),s("div",{class:"buttons"},s("verdocs-button",{label:"Cancel",size:"small",variant:"outline",onClick:e=>this.handleCancel(e),disabled:this.sending}),s("verdocs-button",{label:"Send",size:"small",disabled:!o||this.sending,onClick:e=>this.handleSend(e)}),this.sending&&s("verdocs-spinner",null)))}static get watchers(){return{templateId:["onTemplateIdChanged"]}}};Q.style='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-send{padding:10px;position:relative;background:#ffffff;-ms-flex-direction:column;flex-direction:column;font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", 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-direction:row;flex-direction:row}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)}';const P=class{constructor(s){e(this,s),this.exit=t(this,"exit",7),this.next=t(this,"next",7),this.templateUpdated=t(this,"templateUpdated",7),this.sdkError=t(this,"sdkError",7),this.templateListenerId=null,this.endpoint=a.getDefault(),this.templateId="",this.uploading=!1,this.progressLabel="Uploading...",this.progressPercent=0,this.showDeleteError=!1,this.confirmDeleteDocument=null,this.loading=!0,this.template=null}async componentWillLoad(){var e,t,s;try{if(this.endpoint.loadSession(),!this.templateId)return void console.log(`[ROLES] Missing required template ID ${this.templateId}`);if(!this.endpoint.session)return void console.log("[ROLES] Unable to start builder session, must be authenticated");this.listenToTemplate()}catch(i){console.log("[TEMPLATE ATTACHMENTS] Error loading template",i),null===(e=this.sdkError)||void 0===e||e.emit(new w(i.message,null===(t=i.response)||void 0===t?void 0:t.status,null===(s=i.response)||void 0===s?void 0:s.data))}}disconnectedCallback(){this.unlistenToTemplate()}async listenToTemplate(){this.unlistenToTemplate(),k.subscribe("templates",this.templateId,(()=>n(this.endpoint,this.templateId)),!1,(e=>{this.template=e,this.loading=!1}))}unlistenToTemplate(){this.templateListenerId&&(k.store.delListener(this.templateListenerId),this.templateListenerId=null)}handleCancel(e){e.stopPropagation(),this.exit.emit()}handleUploadProgress(e){e>=99?(this.progressPercent=100,this.progressLabel="Processing..."):this.progressPercent=e}async handleUpload(e){var t,s,i,o;e.stopPropagation();const l=e.detail.file;if(l){console.log("[ATTACHMENTS] Uploading...",l),this.uploading=!0,this.progressLabel="Uploading...";try{const e=await v(this.endpoint,this.templateId,l,this.handleUploadProgress.bind(this));console.log("[ATTACHMENTS] Created attachment",e),this.template=await k.getTemplate(this.endpoint,this.templateId,!0),console.log("[ATTACHMENTS] Updated template",this.template),null===(t=this.templateUpdated)||void 0===t||t.emit({endpoint:this.endpoint,template:this.template,event:"attachments"}),this.uploading=!1,this.progressLabel="",this.progressPercent=0}catch(e){console.log("[ATTACHMENTS] Error creating template",e),null===(s=this.sdkError)||void 0===s||s.emit(new w(e.message,null===(i=e.response)||void 0===i?void 0:i.status,null===(o=e.response)||void 0===o?void 0:o.data)),this.uploading=!1}}}handleNext(e){var t;e.stopPropagation(),this.uploading=!1,this.progressLabel="",this.progressPercent=0,null===(t=this.next)||void 0===t||t.emit({template:this.template})}async confirmDelete(){await g(this.endpoint,this.templateId,this.confirmDeleteDocument.id),this.template=await k.getTemplate(this.endpoint,this.templateId,!0),console.log("[ATTACHMENTS] New template",this.template),this.confirmDeleteDocument=null}async handleDelete(e){var t;((null===(t=this.template)||void 0===t?void 0:t.documents)||[]).length>1?this.confirmDeleteDocument=e:this.showDeleteError=!0}getFileIcon(e){switch(e.mime){case"application/pdf":return S;case"image/jpeg":return E;case"image/png":return C;case"application/msword":case"application/vnd.openxmlformats-officedocument.wordprocessingml.document":return q}return M}render(){var e,t;return this.endpoint.session?this.loading?s(i,{class:"loading"},s("verdocs-loader",null)):this.endpoint.session&&this.template?s(i,null,s("h5",null,"Existing Attachments"),s("div",{class:"attachments"},((null===(e=this.template)||void 0===e?void 0:e.documents)||[]).map((e=>s("div",{class:"attachment"},s("div",{class:"file-icon",innerHTML:this.getFileIcon(e)}),s("div",{class:"filename",title:e.name},e.name),s("div",{class:"pages"},s("div",{class:"count"},e.pages),s("div",{class:"pages-icon",innerHTML:T})),s("div",{class:"trash-icon",innerHTML:L,onClick:()=>this.handleDelete(e)}))))),s("h5",null,"Attach a New Document"),this.uploading?s("div",{class:"loader-wrapper"},s("verdocs-loader",null),this.progressLabel&&s("div",{class:"progress-wrapper"},s("verdocs-progress-bar",{showPercent:!0,percent:this.progressPercent,label:this.progressLabel}))):s("verdocs-file-chooser",{onFileSelected:e=>this.handleUpload(e)}),s("div",{class:"buttons"},s("verdocs-button",{variant:"outline",label:"Cancel",size:"small",onClick:e=>this.handleCancel(e),disabled:this.uploading}),s("verdocs-button",{label:"Next",size:"small",onClick:e=>this.handleNext(e),disabled:!((null===(t=this.template)||void 0===t?void 0:t.documents)||[]).length||this.uploading})),this.showDeleteError&&s("verdocs-ok-dialog",{heading:"Unable to Delete Attachment",message:"Templates must contain at least one attachment.",onNext:()=>this.showDeleteError=!1}),this.confirmDeleteDocument&&s("verdocs-ok-dialog",{heading:"Delete this Attachment?",message:"This operation cannot be undone. All fields placed<br />on the deleted attachment will also be removed.",onNext:()=>this.confirmDelete(),showCancel:!0,onExit:()=>{this.confirmDeleteDocument=null}})):s(i,{class:"empty"}):s(i,null,s("verdocs-component-error",{message:"You must be authenticated to use this module."}))}};P.style='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-template-attachments{font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", 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}';const $=["attachments","roles","settings","fields","preview"],j=class{constructor(s){e(this,s),this.sdkError=t(this,"sdkError",7),this.stepChanged=t(this,"stepChanged",7),this.templateListenerId=null,this.endpoint=a.getDefault(),this.templateId=null,this.step="preview",this.loading=!0,this.template=null}disconnectedCallback(){this.unlistenToTemplate()}async listenToTemplate(){this.unlistenToTemplate(),k.subscribe("templates",this.templateId,(()=>n(this.endpoint,this.templateId)),!1,(e=>{this.template=e,this.loading=!1}))}unlistenToTemplate(){this.templateListenerId&&(k.store.delListener(this.templateListenerId),this.templateListenerId=null)}onTemplateIdChanged(e){console.log("[BUILD_TABS] Template ID changed",e),this.listenToTemplate()}onStepChanged(e){console.log("[BUILD_TABS] Step changed",e)}async componentWillLoad(){var e,t,s;try{if(this.endpoint.loadSession(),!this.endpoint.session)return void console.log("[BUILD_TABS] Unable to start builder session, must be authenticated");if(!this.templateId)return this.step="attachments",void console.log("[BUILD_TABS] Missing required template ID, forcing view to attachments");this.listenToTemplate()}catch(i){console.log("[BUILD_TABS] Error loading template",i),null===(e=this.sdkError)||void 0===e||e.emit(new w(i.message,null===(t=i.response)||void 0===t?void 0:t.status,null===(s=i.response)||void 0===s?void 0:s.data))}}setStep(e){var t;console.log("[BUILD_TABS] Selected step",e.detail.tab.id),e.stopPropagation(),e.preventDefault(),this.step=e.detail.tab.id,null===(t=this.stepChanged)||void 0===t||t.emit(e.detail.tab.id)}copyTemplateId(){navigator.clipboard.writeText(this.templateId).then((()=>{y("Template ID copied",{style:"success",duration:3e3})})).catch((e=>{var t;console.warn("[BUILD_TABS] Error copying to clipboard",e),null===(t=this.sdkError)||void 0===t||t.emit(e)}))}render(){var e,t,o,l,a,n,r,d,c;if(this.loading)return s(i,null,s("verdocs-loader",null));if(!this.endpoint.session)return s(i,null,s("verdocs-component-error",{message:"You must be authenticated to use this module."}));const p=((null===(e=this.template)||void 0===e?void 0:e.documents)||[]).length>0;let h=p&&((null===(t=this.template)||void 0===t?void 0:t.roles)||[]).length>0;const m=h&&((null===(o=this.template)||void 0===o?void 0:o.fields)||[]).length>0;let v=Math.max($.indexOf(this.step),0);return!m&&v>=4&&(v=3),!h&&v>=3&&(v=1),!p&&v>=1&&(v=0),s(i,null,s("verdocs-tabs",{onSelectTab:e=>this.setStep(e),selectedTab:v,tabs:[{id:"attachments",disabled:!1,label:"Attachment(s)"},{id:"roles",disabled:!p,label:"Roles"},{id:"settings",disabled:!h,label:"Settings"},{id:"fields",disabled:!h,label:"Fields"},{id:"preview",disabled:!m,label:"Preview/Send"}]}),this.templateId&&s("div",{class:"info"},s("verdocs-button-panel",{icon:'<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24" fill="#5c6575"><path d="M11.925 18q.55 0 .938-.387.387-.388.387-.938 0-.55-.387-.925-.388-.375-.938-.375-.55 0-.925.375t-.375.925q0 .55.375.938.375.387.925.387Zm-.95-3.85h1.95q0-.8.2-1.287.2-.488 1.025-1.288.65-.625 1.025-1.213.375-.587.375-1.437 0-1.425-1.025-2.175Q13.5 6 12.1 6q-1.425 0-2.35.775t-1.275 1.85l1.775.7q.125-.45.55-.975.425-.525 1.275-.525.725 0 1.1.412.375.413.375.888 0 .475-.287.9-.288.425-.713.775-1.075.95-1.325 1.475-.25.525-.25 1.875ZM12 22.2q-2.125 0-3.988-.8-1.862-.8-3.237-2.175Q3.4 17.85 2.6 15.988 1.8 14.125 1.8 12t.8-3.988q.8-1.862 2.175-3.237Q6.15 3.4 8.012 2.6 9.875 1.8 12 1.8t3.988.8q1.862.8 3.237 2.175Q20.6 6.15 21.4 8.012q.8 1.863.8 3.988t-.8 3.988q-.8 1.862-2.175 3.237Q17.85 20.6 15.988 21.4q-1.863.8-3.988.8Zm0-2.275q3.325 0 5.625-2.3t2.3-5.625q0-3.325-2.3-5.625T12 4.075q-3.325 0-5.625 2.3T4.075 12q0 3.325 2.3 5.625t5.625 2.3ZM12 12Z"/></svg>'},s("div",{class:"template-details-panel"},s("h6",null,"Template Details"),s("div",{class:"row"},s("label",null,"ID:"),s("div",{class:"value"},this.templateId),s("div",{class:"icon-button",innerHTML:'<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5"><path stroke-linecap="round" stroke-linejoin="round" d="M15.75 17.25v3.375c0 .621-.504 1.125-1.125 1.125h-9.75a1.125 1.125 0 0 1-1.125-1.125V7.875c0-.621.504-1.125 1.125-1.125H6.75a9.06 9.06 0 0 1 1.5.124m7.5 10.376h3.375c.621 0 1.125-.504 1.125-1.125V11.25c0-4.46-3.243-8.161-7.5-8.876a9.06 9.06 0 0 0-1.5-.124H9.375c-.621 0-1.125.504-1.125 1.125v3.5m7.5 10.375H9.375a1.125 1.125 0 0 1-1.125-1.125v-9.25m12 6.625v-1.875a3.375 3.375 0 0 0-3.375-3.375h-1.5a1.125 1.125 0 0 1-1.125-1.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H9.75" /></svg>',onClick:()=>this.copyTemplateId()})),s("div",{class:"row"},s("label",null,"Name:"),s("div",{class:"value"},null===(l=this.template)||void 0===l?void 0:l.name)),s("div",{class:"row"},s("label",null,"Visibility:"),s("div",{class:"value"},(null===(a=this.template)||void 0===a?void 0:a.is_public)?"Public":(null===(n=this.template)||void 0===n?void 0:n.is_personal)?"Private":"Shared")),s("div",{class:"row"},s("label",null,"Created:"),s("div",{class:"value"},(null===(r=this.template)||void 0===r?void 0:r.counter)?H(new Date(null===(d=this.template)||void 0===d?void 0:d.created_at),"P p"):"")),s("div",{class:"row"},s("label",null,"Used:"),s("div",{class:"value"},null===(c=this.template)||void 0===c?void 0:c.counter," time(s)"))))))}static get watchers(){return{templateId:["onTemplateIdChanged"],step:["onStepChanged"]}}};j.style='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-template-build-tabs{-ms-flex:1;flex:1;gap:15px;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-template-build-tabs verdocs-button-panel svg{-webkit-transform:scale(0.8);transform:scale(0.8)}verdocs-template-build-tabs verdocs-template-attachments,verdocs-template-build-tabs verdocs-template-roles{margin:20px}verdocs-template-build-tabs verdocs-template-fields{border-top:1px solid #777777}verdocs-template-build-tabs verdocs-template-attachments{padding:20px;background:#ffffff}verdocs-template-build-tabs verdocs-template-fields{width:100%}verdocs-template-build-tabs verdocs-preview{-ms-flex:1;flex:1}.template-details-panel .row{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;gap:8px;margin:10px 0}.template-details-panel label{-ms-flex:0 0 70px;flex:0 0 70px}.template-details-panel .value{-ms-flex:1;flex:1;font-weight:300;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.template-details-panel .icon-button{cursor:pointer;opacity:0.8;-ms-flex:0;flex:0;width:18px;height:18px}.template-details-panel .icon-button svg{stroke:#000000;width:18px;height:18px}.template-details-panel .icon-button:hover{opacity:1}';const F='<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>',O=[{id:"signature",tooltip:"Signature",icon:'<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>',class:"signature"},{id:"initial",tooltip:"Initials",icon:'<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>',class:"initial"},{id:"sep1",tooltip:"",icon:F,class:"separator"},{id:"textbox",tooltip:"Text Box",icon:'<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>',class:"textbox"},{id:"checkbox",tooltip:"Check Box",icon:'<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>',class:"checkbox"},{id:"radio",tooltip:"Radio Button",icon:'<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>',class:"radio"},{id:"dropdown",tooltip:"Dropdown",icon:'<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>',class:"dropdown"},{id:"sep2",tooltip:"",icon:F,class:"separator"},{id:"date",tooltip:"Date",icon:'<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>',class:"date"},{id:"timestamp",tooltip:"Timestamp",icon:'<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" 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"></path></svg>',class:"timestamp"},{id:"attachment",tooltip:"Attachment",icon:'<svg xmlns="http://www.w3.org/2000/svg" fill="none" 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>',class:"attachment"}],W=class{constructor(s){e(this,s),this.sdkError=t(this,"sdkError",7),this.templateUpdated=t(this,"templateUpdated",7),this.fieldsUpdated=t(this,"fieldsUpdated",7),this.templateListenerId=null,this.pageHeights={},this.cachedPageInfo={},this.endpoint=a.getDefault(),this.templateId=null,this.toolbarTargetId=null,this.placing=null,this.showMustSelectRole=!1,this.selectedRoleName="",this.loading=!0,this.template=null}onTemplateIdChanged(){this.listenToTemplate()}handleKeyDown(e){"Escape"===e.key&&(this.placing=null)}async componentWillLoad(){var e,t,s;try{if(this.endpoint.loadSession(),!this.templateId)return void console.log(`[FIELDS] Missing required template ID ${this.templateId}`);if(!this.endpoint.session)return void console.log("[FIELDS] Unable to start builder session, must be authenticated");this.listenToTemplate()}catch(i){console.log("[FIELDS] Error with fields session",i),null===(e=this.sdkError)||void 0===e||e.emit(new w(i.message,null===(t=i.response)||void 0===t?void 0:t.status,null===(s=i.response)||void 0===s?void 0:s.data))}}componentDidRender(){z.dynamicDrop(!0);const e=this.toolbarTargetId?document.getElementById(this.toolbarTargetId):null,t=document.getElementById("verdocs-template-fields-toolbar");e&&t&&(console.log("[FIELDS] Moving toolbar"),t.remove(),e.append(t))}componentWillUpdate(){var e,t;const s=(null===(e=this.template)||void 0===e?void 0:e.roles)||[];this.selectedRoleName&&s.find((e=>e&&e.name===this.selectedRoleName))||(this.selectedRoleName=(null===(t=s[0])||void 0===t?void 0:t.name)||"",console.log("[FIELDS] Selected new role",this.selectedRoleName))}disconnectedCallback(){this.unlistenToTemplate()}async listenToTemplate(){this.unlistenToTemplate(),k.subscribe("templates",this.templateId,(()=>n(this.endpoint,this.templateId)),!1,(e=>{var t,s;this.template=e,this.loading=!1,this.selectedRoleName=(null===(s=null===(t=e.roles)||void 0===t?void 0:t[0])||void 0===s?void 0:s.name)||""}))}unlistenToTemplate(){this.templateListenerId&&(k.store.delListener(this.templateListenerId),this.templateListenerId=null)}attachFieldAttributes(e,t,s){s.addEventListener("settingsChanged",(()=>{var e;null===(e=this.templateUpdated)||void 0===e||e.emit({endpoint:this.endpoint,template:this.template,event:"added-field"})})),s.addEventListener("deleted",(()=>{var e;s.remove(),null===(e=this.templateUpdated)||void 0===e||e.emit({endpoint:this.endpoint,template:this.template,event:"updated-field"})})),s.setAttribute("templateid",this.templateId),s.setAttribute("fieldname",t.name),s.setAttribute("pageNumber",String(e.pageNumber)),s.setAttribute("xScale",String(e.xScale)),s.setAttribute("yScale",String(e.yScale)),s.setAttribute("name",t.name)}handlePageRendered(e){var t;const s=e.detail;this.cachedPageInfo[s.pageNumber]=s,this.pageHeights[s.pageNumber]=s.naturalHeight,((null===(t=this.template)||void 0===t?void 0:t.fields)||[]).filter((e=>e&&e.page===s.pageNumber)).forEach((e=>{const t=D(e),s=document.getElementById(t);s&&(s.setAttribute("fieldname",e.name),s.setAttribute("pagenumber",String(e.page)),this.makeDraggable(s))}))}makeDraggable(e){z(e).draggable({listeners:{move:this.handleMoveField.bind(this),end:this.handleMoveEnd.bind(this)}})}async handleMoveField(e){const t=+(e.target.getAttribute("posX")||0),s=+(e.target.getAttribute("posY")||0),i=+(e.target.getAttribute("xScale")||1),o=+(e.target.getAttribute("yScale")||1),l=e.dx/i+t,a=e.dy/o+s;e.target.setAttribute("posX",l),e.target.setAttribute("posy",a),Z(e.target,"translate",`${l}px, ${a}px`)}async handleMoveEnd(e){var t,s,i,o,l,a,n,r;const d=e.target.getAttribute("fieldname"),c=((null===(t=this.template)||void 0===t?void 0:t.fields)||[]).find((e=>e.name===d));if(!c)return void console.log("[FIELDS] Unable to find field",d,e.target);const p=e.target.getAttribute("pagenumber");let{naturalWidth:h=612,naturalHeight:m=792,renderedHeight:v=792}=this.cachedPageInfo[p];const g=e.target.getBoundingClientRect(),f=e.target.parentElement.getBoundingClientRect(),x=c.width||N(c.type),b=c.height||_(c.type),q=Math.max(g.left-f.left,0);let C=Math.max(v-(f.bottom-g.bottom),0),E=parseInt(p);C>v?(E=Math.min(E+1,(null===(o=null===(i=(null===(s=this.template)||void 0===s?void 0:s.documents)||[])||void 0===i?void 0:i[0])||void 0===o?void 0:o.pages)||1),C-=v,v=this.cachedPageInfo[E].renderedHeight,console.log("Next page",{newPageNumber:E,newY:C,renderedHeight:v})):C<0&&(E=Math.max(E-1,1),v=this.cachedPageInfo[E].renderedHeight,C+=v,console.log("[FIELDS] Next page",{newPageNumber:E,newY:C,renderedHeight:v}));const{x:S,y:M}=this.viewCoordinatesToPageCoordinates(q,C,p,h-x,m-b);try{const t={x:S,y:M,page:E},s=await u(this.endpoint,this.templateId,d,t);console.log("[FIELDS] Updated",s);const i=JSON.parse(JSON.stringify(this.template)),o=i.fields.findIndex((e=>e.name===d));o>-1&&(i.fields[o]=s),k.updateTemplate(this.templateId,i),e.target.removeAttribute("posX"),e.target.removeAttribute("posY"),I(e.target);const{xScale:a=1,yScale:n=1}=this.cachedPageInfo[p];V(e.target,s,a,n),null===(l=this.templateUpdated)||void 0===l||l.emit({endpoint:this.endpoint,template:i,event:"updated-field"})}catch(t){y("Error updating field, please try again later",{style:"error"}),console.log("[FIELDS] Error updating field",t),null===(a=this.sdkError)||void 0===a||a.emit(new w(t.message,null===(n=t.response)||void 0===n?void 0:n.status,null===(r=t.response)||void 0===r?void 0:r.data)),e.target.removeAttribute("posX"),e.target.removeAttribute("posY"),I(e.target)}}generateFieldName(e,t){var s;let i,o=1;do{i=`${e}P${t}-${o}`,o++}while(((null===(s=this.template)||void 0===s?void 0:s.fields)||[]).some((e=>e&&e.name===i)));return i}viewCoordinatesToPageCoordinates(e,t,s,i,o){const{xScale:l=1,yScale:a=1,renderedHeight:n=792}=this.cachedPageInfo[s];return{x:Math.floor(Math.min(e/l,i)),y:Math.floor(Math.min(Math.max(n-t,0)/a,o))}}async handleClickPage(e,t){var s;if(this.placing){const i=e.offsetX,o=e.offsetY,l=N(this.placing),a=_(this.placing),n=this.cachedPageInfo[t],{naturalWidth:r=612,naturalHeight:d=792}=n,c=this.viewCoordinatesToPageCoordinates(i,o,t,r-l,d-a),p=Math.floor(c.x),h=Math.floor(c.y),m={name:this.generateFieldName(this.placing,t),role_name:this.selectedRoleName,template_id:this.templateId,document_id:n.documentId,type:this.placing,required:"radio"!==this.placing,page:t,validator:null,label:null,default:null,placeholder:null,group:null,settings:{},x:p,y:h,width:l,height:a,multiline:!1,options:"radio"===this.placing?[{id:"option-1",label:"Option 1"}]:[]};console.log("[FIELDS] Will save new field",m);const v=await f(this.endpoint,this.templateId,m);console.log("[FIELDS] Saved field",v);const g=JSON.parse(JSON.stringify(this.template));g.fields.push(v),k.updateTemplate(this.templateId,g),null===(s=this.templateUpdated)||void 0===s||s.emit({endpoint:this.endpoint,template:g,event:"added-field"}),this.placing=null}}render(){var e,t,o;if(this.loading)return s(i,null,s("verdocs-loader",null));if(!this.endpoint.session)return s(i,null,s("verdocs-component-error",{message:"You must be authenticated to use this module."}));const l=((null===(e=this.template)||void 0===e?void 0:e.roles)||[]).map((e=>({value:e.name,label:e.full_name?`${e.name}: ${e.full_name}`:e.name})));return s(i,{class:this.placing?{[`placing-${this.placing}`]:!0}:{},onSubmit:()=>{}},s("div",{id:"verdocs-template-fields-toolbar"},s("div",{class:"add-for"},"Add field:"),s("verdocs-select-input",{value:this.selectedRoleName,options:l,onInput:e=>this.selectedRoleName=e.target.value}),O.map((e=>s("verdocs-toolbar-icon",{text:e.tooltip,icon:e.icon,class:e.class,onClick:()=>{e.tooltip&&(this.selectedRoleName?this.placing=e.id:this.showMustSelectRole=!0)}})))),s("div",{class:"pages"},((null===(t=this.template)||void 0===t?void 0:t.documents)||[]).map((e=>r(1,e.pages).map((t=>{const i=e.page_sizes[t];return s("verdocs-template-document-page",{templateId:this.templateId,documentId:e.id,pageNumber:t,virtualWidth:(null==i?void 0:i.width)||612,virtualHeight:(null==i?void 0:i.height)||792,disabled:!0,editable:!0,done:!1,onClick:e=>this.handleClickPage(e,t),onPageRendered:e=>this.handlePageRendered(e),layers:[{name:"page",type:"canvas"},{name:"controls",type:"div"}]})}))))),this.showMustSelectRole&&s("verdocs-ok-dialog",{heading:"Unable to add field",message:((null===(o=this.template)||void 0===o?void 0:o.roles)||[]).length>0?"Please select a role before adding fields.":"Please add at least one role before adding fields.",onNext:()=>this.showMustSelectRole=!1}))}static get watchers(){return{templateId:["onTemplateIdChanged"]}}};W.style="@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-template-fields{font-family:\"Inter\", -apple-system, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", sans-serif;position:relative;display:block;min-height:600px}verdocs-template-fields .page-0{padding:65px 15px 0 15px;-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-template-fields .page-0 .user-placed-fields{height:100px;position:relative;background:#ffffff;-webkit-box-shadow:0 0 10px 5px rgba(0, 0, 0, 0.0588235294);box-shadow:0 0 10px 5px rgba(0, 0, 0, 0.0588235294)}verdocs-template-fields .page-0 .user-placed-fields .title{top:0;left:0;color:#ffffff;font-size:12px;padding:3px 6px;font-weight:bold;position:absolute;background:#46497d}verdocs-template-fields .pages{display:-ms-flexbox;display:flex;padding:15px;row-gap:15px;min-height:200px;position:relative;-ms-flex-align:center;align-items:center;-webkit-box-sizing:border-box;box-sizing:border-box;-ms-flex-direction:column;flex-direction:column}verdocs-template-fields .pages div,verdocs-template-fields .pages canvas{-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-template-fields #verdocs-template-fields-toolbar{width:100%;height:50px;display:-ms-flexbox;display:flex;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;font-weight:700;padding:0 20px 0 0;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;color:#f5f5fa;-ms-flex-pack:center;justify-content:center;background:#46497d}verdocs-template-fields #verdocs-template-fields-toolbar>verdocs-select-input{margin:0}verdocs-template-fields #verdocs-template-fields-toolbar svg{width:24px;height:24px}verdocs-template-fields #verdocs-template-fields-toolbar .add-for{margin:0;font-weight:500;color:#f5f5fa}verdocs-template-fields #verdocs-template-fields-toolbar verdocs-select-input{margin:0 20px 0 0}@media all and (max-width: 1000px){verdocs-template-fields #verdocs-template-fields-toolbar{-webkit-column-gap:8px;-moz-column-gap:8px;column-gap:8px;padding:0 10px 0 0}verdocs-template-fields #verdocs-template-fields-toolbar svg{-webkit-transform:scale(0.8);transform:scale(0.8)}verdocs-template-fields #verdocs-template-fields-toolbar .add-for,verdocs-template-fields #verdocs-template-fields-toolbar verdocs-select-input{display:none}}@media all and (max-width: 600px){verdocs-template-fields #verdocs-template-fields-toolbar{-webkit-column-gap:6px;-moz-column-gap:6px;column-gap:6px}verdocs-template-fields #verdocs-template-fields-toolbar svg{-webkit-transform:scale(0.6);transform:scale(0.6)}verdocs-template-fields #verdocs-template-fields-toolbar .separator,verdocs-template-fields #verdocs-template-fields-toolbar .add-for,verdocs-template-fields #verdocs-template-fields-toolbar verdocs-select-input{display:none}}verdocs-template-fields.placing-attachment{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='m10.55 16.55 7.275-7.275L16.05 7.5l-5.5 5.45-2.675-2.65L6.1 12.075Zm-5.375 4.925q-1.125 0-1.887-.763-.763-.762-.763-1.887V5.175q0-1.125.763-1.888.762-.762 1.887-.762h13.65q1.125 0 1.888.762.762.763.762 1.888v13.65q0 1.125-.762 1.887-.763.763-1.888.763Zm0-2.65h13.65V5.175H5.175v13.65Zm0-13.65v13.65-13.65Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-checkbox{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='m10.55 16.55 7.275-7.275L16.05 7.5l-5.5 5.45-2.675-2.65L6.1 12.075Zm-5.375 4.925q-1.125 0-1.887-.763-.763-.762-.763-1.887V5.175q0-1.125.763-1.888.762-.762 1.887-.762h13.65q1.125 0 1.888.762.762.763.762 1.888v13.65q0 1.125-.762 1.887-.763.763-1.888.763Zm0-2.65h13.65V5.175H5.175v13.65Zm0-13.65v13.65-13.65Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-date{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath fill='%23000000' d='M7.6 13.925q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375Zm4.4 0q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375Zm4.4 0q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375ZM5.3 22.85q-1.325 0-2.238-.912-.912-.913-.912-2.238V6.3q0-1.325.912-2.238.913-.912 2.238-.912H6v-2h2.575v2h6.85v-2H18v2h.7q1.325 0 2.238.912.912.913.912 2.238v13.4q0 1.325-.912 2.238-.913.912-2.238.912Zm0-3.15h13.4V10H5.3v9.7ZM5.3 8h13.4V6.3H5.3Zm0 0V6.3 8Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-dropdown{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24' stroke-width='1.5' stroke='currentColor'%3E%3Cpath stroke='%23000000' stroke-linecap='round' stroke-linejoin='round' d='M3 4.5h14.25M3 9h9.75M3 13.5h9.75m4.5-4.5v12m0 0l-3.75-3.75M17.25 21L21 17.25' /%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-initial{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='M6.225 20.775V7h-5V3.225H15V7h-5v13.775Zm9.775 0v-8h-3V9h9.775v3.775h-3v8Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-payment{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='m10.55 16.55 7.275-7.275L16.05 7.5l-5.5 5.45-2.675-2.65L6.1 12.075Zm-5.375 4.925q-1.125 0-1.887-.763-.763-.762-.763-1.887V5.175q0-1.125.763-1.888.762-.762 1.887-.762h13.65q1.125 0 1.888.762.762.763.762 1.888v13.65q0 1.125-.762 1.887-.763.763-1.888.763Zm0-2.65h13.65V5.175H5.175v13.65Zm0-13.65v13.65-13.65Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-radio{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='M12 17q2.075 0 3.538-1.463Q17 14.075 17 12t-1.462-3.538Q14.075 7 12 7 9.925 7 8.463 8.462 7 9.925 7 12q0 2.075 1.463 3.537Q9.925 17 12 17Zm0 5.85q-2.275 0-4.25-.85t-3.438-2.312Q2.85 18.225 2 16.25q-.85-1.975-.85-4.25T2 7.75q.85-1.975 2.312-3.438Q5.775 2.85 7.75 2q1.975-.85 4.25-.85t4.25.85q1.975.85 3.438 2.312Q21.15 5.775 22 7.75q.85 1.975.85 4.25T22 16.25q-.85 1.975-2.312 3.438Q18.225 21.15 16.25 22q-1.975.85-4.25.85Zm0-3.15q3.25 0 5.475-2.225Q19.7 15.25 19.7 12q0-3.25-2.225-5.475Q15.25 4.3 12 4.3q-3.25 0-5.475 2.225Q4.3 8.75 4.3 12q0 3.25 2.225 5.475Q8.75 19.7 12 19.7Zm0-7.7Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-signature{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='m9.225 21.225 4.65-4.65h8.45v4.65Zm-5.35-2.2H5.05l8.5-8.5-1.175-1.175-8.5 8.5Zm14.25-9.95L13.8 4.8l1.325-1.325q.625-.65 1.525-.663.9-.012 1.6.663l1.225 1.175q.675.675.663 1.562-.013.888-.663 1.513ZM16.7 10.55 6 21.225H1.675V16.9L12.35 6.225Zm-3.725-.625-.6-.575 1.175 1.175Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-textarea{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='M3.225 20.725v-3.15h11.55v3.15Zm0-4.775V12.8h17.55v3.15Zm0-4.75V8.05h17.55v3.15Zm0-4.775v-3.15h17.55v3.15Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-textbox{cursor:url(\"data:image/svg+xml,%3Csvg width='32' height='15' viewBox='0 0 32 15' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cmask id='path-1-inside-1_1401_24' fill='white'%3E%3Cpath d='M0 0H32V15H0V0Z'/%3E%3C/mask%3E%3Cpath d='M0 0H32V15H0V0Z' fill='%234C56CB' fill-opacity='0.1'/%3E%3Cpath d='M0 0V-1H-1V0H0ZM0 15H-1V16H0V15ZM0 1H32V-1H0V1ZM32 14H0V16H32V14ZM1 15V0H-1V15H1Z' fill='%234C56CB' mask='url(%23path-1-inside-1_1401_24)'/%3E%3Cpath d='M3 11.8V8.65H14.15V11.8H3ZM3 6.65V3.5H20.15V6.65H3Z' fill='%234C56CB'/%3E%3Cline x1='31.5' y1='1' x2='31.5' y2='14' stroke='%234C56CB' stroke-opacity='0.32' stroke-dasharray='1 1'/%3E%3C/svg%3E%0A\") 0 14, pointer}verdocs-template-fields.placing-timestamp{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath fill='%23000000' d='M9 1h6v2H9zm10.03 6.39 1.42-1.42c-.43-.51-.9-.99-1.41-1.41l-1.42 1.42C16.07 4.74 14.12 4 12 4c-4.97 0-9 4.03-9 9s4.02 9 9 9 9-4.03 9-9c0-2.12-.74-4.07-1.97-5.61zM13 14h-2V8h2v6z'%3E%3C/path%3E%3C/svg%3E\") 16 16, pointer}";const Y='<svg xmlns="http://www.w3.org/2000/svg" height="20" width="20" fill="#00000089"><path d="m8.021 17.917-.313-2.5q-.27-.125-.625-.334-.354-.208-.625-.395l-2.312.979-1.979-3.438 1.979-1.5q-.021-.167-.031-.364-.011-.198-.011-.365 0-.146.011-.344.01-.198.031-.385l-1.979-1.5 1.979-3.417 2.312.958q.271-.187.615-.385t.635-.344l.313-2.5h3.958l.313 2.5q.312.167.625.344.312.177.604.385l2.333-.958 1.979 3.417-1.979 1.521q.021.187.021.364V10q0 .146-.01.333-.011.188-.011.396l1.958 1.5-1.979 3.438-2.312-.979q-.292.208-.615.395-.323.188-.614.334l-.313 2.5Zm1.937-5.355q1.063 0 1.813-.75t.75-1.812q0-1.062-.75-1.812t-1.813-.75q-1.041 0-1.802.75-.76.75-.76 1.812t.76 1.812q.761.75 1.802.75Zm0-1.333q-.5 0-.864-.364-.365-.365-.365-.865t.365-.865q.364-.364.864-.364t.865.364q.365.365.365.865t-.365.865q-.365.364-.865.364ZM10.021 10Zm-.854 6.583h1.666l.25-2.187q.605-.167 1.136-.49.531-.323 1.031-.802l2.021.875.854-1.375-1.792-1.354q.105-.333.136-.635.031-.303.031-.615 0-.292-.031-.573-.031-.281-.115-.635l1.792-1.396-.834-1.375-2.062.875q-.438-.438-1.021-.781-.583-.344-1.125-.49l-.271-2.208H9.167l-.271 2.208q-.584.146-1.125.458-.542.313-1.042.792l-2.021-.854-.833 1.375 1.75 1.354q-.083.333-.125.646-.042.312-.042.604t.042.594q.042.302.125.635l-1.75 1.375.833 1.375 2.021-.854q.479.458 1.021.771.542.312 1.146.479Z"/></svg>',J='<svg xmlns="http://www.w3.org/2000/svg" fill="#ffffff" viewBox="0 0 24 24" strokeWidth={1.5} stroke="currentColor"><path strokeLinecap="round" strokeLinejoin="round" d="M12 9v6m3-3H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z" /></svg>',X='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path d="m9.225 21.225 4.65-4.65h8.45v4.65Zm-5.35-2.2H5.05l8.5-8.5-1.175-1.175-8.5 8.5Zm14.25-9.95L13.8 4.8l1.325-1.325q.625-.65 1.525-.663.9-.012 1.6.663l1.225 1.175q.675.675.663 1.562-.013.888-.663 1.513ZM16.7 10.55 6 21.225H1.675V16.9L12.35 6.225Zm-3.725-.625-.6-.575 1.175 1.175Z"/></svg>',K='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path fill-rule="evenodd" d="M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12zm13.36-1.814a.75.75 0 10-1.22-.872l-3.236 4.53L9.53 12.22a.75.75 0 00-1.06 1.06l2.25 2.25a.75.75 0 001.14-.094l3.75-5.25z" clip-rule="evenodd" /></svg>',G='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M1.5 8.67v8.58a3 3 0 003 3h15a3 3 0 003-3V8.67l-8.928 5.493a3 3 0 01-3.144 0L1.5 8.67z" /><path d="M22.5 6.908V6.75a3 3 0 00-3-3h-15a3 3 0 00-3 3v.158l9.714 5.978a1.5 1.5 0 001.572 0L22.5 6.908z" /></svg>',ee=class{constructor(s){e(this,s),this.next=t(this,"next",7),this.exit=t(this,"exit",7),this.sdkError=t(this,"sdkError",7),this.rolesUpdated=t(this,"rolesUpdated",7),this.templateListenerId=null,this.endpoint=a.getDefault(),this.templateId="",this.showingRoleDialog=null,this.sender=null,this.loading=!0,this.template=null}disconnectedCallback(){this.unlistenToTemplate()}async listenToTemplate(){console.log("[ROLES] Loading template",this.templateId),this.unlistenToTemplate(),k.subscribe("templates",this.templateId,(()=>n(this.endpoint,this.templateId)),!1,(e=>{console.log("[BUILD] Template Updated",e),this.template=e,this.loading=!1}))}unlistenToTemplate(){this.templateListenerId&&(k.store.delListener(this.templateListenerId),this.templateListenerId=null)}async componentWillLoad(){var e,t,s;try{if(this.endpoint.loadSession(),!this.templateId)return void console.log(`[ROLES] Missing required template ID ${this.templateId}`);if(!this.endpoint.session)return void console.log("[ROLES] Unable to start builder session, must be authenticated");this.listenToTemplate()}catch(i){console.log("[FIELDS] Error with preview session",i),null===(e=this.sdkError)||void 0===e||e.emit(new w(i.message,null===(t=i.response)||void 0===t?void 0:t.status,null===(s=i.response)||void 0===s?void 0:s.data))}}componentDidRender(){z.dynamicDrop(!0),z(".recipient").draggable({listeners:{start:function(e){e.target.classList.add("dragging"),this.el.classList.add("dragging")}.bind(this),move:function(e){const t=+(e.target.getAttribute("dX")||0),s=+(e.target.getAttribute("dY")||0),i=+(e.target.dataset.sequence||0),o=+(e.target.dataset.order||0),l=e.dx+t,a=e.dy+s;e.target.setAttribute("dX",l),e.target.setAttribute("dY",a);const n=e.target.getBoundingClientRect();console.log("w",n.width),e.target.style.transform=`translate(${l+n.width-(o+1)}px, ${a-n.height*i}px)`}.bind(this),end:function(e){e.target.classList.remove("dragging"),this.el.classList.remove("dragging"),e.target.removeAttribute("dX"),e.target.removeAttribute("dY"),e.target.style.transform=null}.bind(this)}}),z(".dropzone").dropzone({overlap:.05,ondrop:async function(e){var t;e.target.classList.remove("active"),await this.renumberTemplateRoles(),console.log("[ROLES] Updated roles",this.getSortedRoles()),null===(t=this.rolesUpdated)||void 0===t||t.emit({event:"updated",endpoint:this.endpoint,templateId:this.templateId,roles:this.getSortedRoles()})}.bind(this),ondropactivate:e=>{e.target.classList.add("visible")},ondropdeactivate:e=>{e.target.classList.remove("visible")},ondragenter:e=>{e.target.classList.add("active")},ondragleave:e=>{e.target.classList.remove("active")}})}handleCancel(){var e;null===(e=this.exit)||void 0===e||e.emit()}handleSubmit(){var e;null===(e=this.next)||void 0===e||e.emit()}getSortedRoles(){var e;return((null===(e=this.template)||void 0===e?void 0:e.roles)||[]).sort(((e,t)=>e.sequence===t.sequence?e.order-t.order:e.sequence-t.sequence))}getSequenceNumbers(){const e=[];return this.getSortedRoles().forEach((t=>{e.includes(t.sequence)||e.push(t.sequence)})),e.sort(((e,t)=>e-t))}getRoleNames(){return this.getSortedRoles().map((e=>e.name))}getRolesAtSequence(e){var t;return((null===(t=this.template)||void 0===t?void 0:t.roles)||[]).filter((t=>t&&t.sequence===e))}async renumberTemplateRoles(){const e=[],t=[];return this.getSequenceNumbers().forEach(((s,i)=>{this.getRolesAtSequence(s).forEach(((s,o)=>{e.includes(s.name)||s.sequence===i+1&&s.order===o+1||(s.sequence=i+1,s.order=o+1,e.push(s.name),t.push(x(this.endpoint,this.templateId,s.name,{sequence:s.sequence,order:s.order})))}))})),!(t.length>0)||(console.log(`[ROLES] Submitting ${t.length} renumber requests`),Promise.all(t).then((async()=>{this.template=await k.getTemplate(this.endpoint,this.templateId,!0)})))}getNextRoleName(){var e,t;let s="",i=((null===(e=this.template)||void 0===e?void 0:e.roles)||[]).length;do{i++,s=`Recipient ${i}`}while(!s||((null===(t=this.template)||void 0===t?void 0:t.roles)||[]).some((e=>e&&e.name===s)));return s}callCreateRole(e,t,s){console.log("[ROLES] Will create role",{name:e,sequence:t,order:s}),b(this.endpoint,this.templateId,{template_id:this.templateId,name:e,sequence:t,message:"",order:s,full_name:null,first_name:"",last_name:"",email:"",phone:"",type:"signer",delegator:!1,kba_method:null}).then((async e=>{var t;console.log("[ROLES] Created role",e);const s=JSON.parse(JSON.stringify(this.template));s.roles.push(e),console.log("Updating template in data store"),k.updateTemplate(this.templateId,s),await this.renumberTemplateRoles(),null===(t=this.rolesUpdated)||void 0===t||t.emit({event:"added",endpoint:this.endpoint,templateId:this.templateId,roles:this.getSortedRoles()})})).catch((e=>{console.log("[ROLES] Error creating role",e)}))}handleAddRole(e,t){e.stopPropagation();const s=this.getRolesAtSequence(t).length+1,i=this.getNextRoleName();this.callCreateRole(i,t,s)}handleAddStep(e,t){e.stopPropagation();const s=this.getNextRoleName();this.callCreateRole(s,t,1)}render(){if(!this.endpoint.session)return s(i,null,s("verdocs-component-error",{message:"You must be authenticated to use this module."}));if(this.loading||!this.template)return s(i,{class:"loading"},s("verdocs-loader",null));const e=this.getRoleNames(),t=this.getSequenceNumbers();return s(i,null,s("form",{onSubmit:e=>e.preventDefault(),onClick:e=>e.stopPropagation(),autocomplete:"off"},s("h5",null,"Roles and Workflow"),s("div",{class:"participants"},s("div",{class:"left-line"}),s("div",{class:"row"},s("div",{class:"icon",innerHTML:'<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" fill="#00000089"><path d="M2 12C2 6.48 6.48 2 12 2s10 4.48 10 10-4.48 10-10 10S2 17.52 2 12zm10 6c3.31 0 6-2.69 6-6s-2.69-6-6-6-6 2.69-6 6 2.69 6 6 6z"></path></svg>'}),s("div",{class:"row-roles"},s("div",{class:"sender"},s("span",{class:"label"},"Send Envelope")))),s("div",{class:"row add-sequence","data-sequence":0},s("div",{class:"icon",innerHTML:J}),s("div",{class:"row-roles"},s("div",{class:"dropzone","data-sequence":0,"data-order":1},"Add Step"))),t.map((e=>s(o,null,s("div",{class:"row"},s("div",{class:"icon",innerHTML:'<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" fill="#00000089"><path d="M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z"></path></svg>'}),s("div",{class:"row-roles"},s("div",{class:"dropzone","data-order":.5,"data-sequence":e}),this.getRolesAtSequence(e).map((t=>s(o,null,t.email?s("div",{class:"recipient",style:{borderColor:h(U(this.template,t.name))},"data-rolename":t.name,"data-sequence":e,"data-order":t.order},s("span",{class:"type-icon",innerHTML:"signer"===t.type?X:"cc"===t.type?G:K}),m(t)," ",s("div",{class:"settings-button",innerHTML:Y,onClick:()=>this.showingRoleDialog=t.name,"aria-role":"button"})):s("div",{class:"recipient",style:{backgroundColor:h(U(this.template,t.name))},"data-rolename":t.name,"data-sequence":e,"data-order":t.order},s("span",{class:"type-icon",innerHTML:"signer"===t.type?X:"cc"===t.type?G:K}),t.name," ",s("div",{class:"settings-button",innerHTML:Y,onClick:()=>this.showingRoleDialog=t.name,"aria-role":"button"})),s("div",{class:"dropzone","data-order":t.order+.5,"data-sequence":e})))),s("button",{class:"add-role",innerHTML:J,onClick:t=>this.handleAddRole(t,e)}))),t.length>0&&s("div",{class:"row add-sequence","data-sequence":e},s("div",{class:"row-roles"},s("div",{class:"icon",innerHTML:J}),s("div",{class:"dropzone","data-sequence":e+1,"data-order":1},"Add Step")))))),s("div",{class:"row","data-sequence":t.length+1},s("div",{class:"row-roles"},s("div",{class:"icon",innerHTML:J}),s("button",{class:"add-step",innerHTML:J,onClick:e=>this.handleAddStep(e,t.length+1)}))),s("div",{class:"row"},s("div",{class:"icon",innerHTML:'<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" fill="#00000089"><path d="m18 7-1.41-1.41-6.34 6.34 1.41 1.41L18 7zm4.24-1.41L11.66 16.17 7.48 12l-1.41 1.41L11.66 19l12-12-1.42-1.41zM.41 13.41 6 19l1.41-1.41L1.83 12 .41 13.41z"></path></svg>'}),s("div",{class:"row-roles"},s("div",{class:"complete"},"Document Complete")))),e.length<1&&s("div",{class:"empty"},"You must add at least one Role before proceeding.",s("br",null)," Click the ",s("span",{innerHTML:J})," Add button above to get started."),s("div",{class:"buttons"},s("div",{class:"flex-fill"}),s("verdocs-button",{variant:"outline",label:"Cancel",size:"small",onClick:()=>this.handleCancel()}),s("verdocs-button",{label:"OK",size:"small",onClick:()=>this.handleSubmit(),disabled:e.length<1}))),this.showingRoleDialog&&s("verdocs-template-role-properties",{endpoint:this.endpoint,templateId:this.templateId,roleName:this.showingRoleDialog,onClose:()=>{this.showingRoleDialog=null},onDelete:async()=>{var e;this.showingRoleDialog=null,await this.renumberTemplateRoles(),null===(e=this.rolesUpdated)||void 0===e||e.emit({event:"deleted",endpoint:this.endpoint,templateId:this.templateId,roles:this.getSortedRoles()})}}))}get el(){return l(this)}};ee.style='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-template-roles{display:block;min-width:400px;font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-template-roles>form{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;background-color:#ffffff;padding:12px}verdocs-template-roles>form h5{font-size:16px;font-weight:bold;color:#46497d;margin:0 0 10px 0}verdocs-template-roles>form .participants{position:relative}verdocs-template-roles>form .left-line{top:32px;left:11px;z-index:1;width:12px;bottom:30px;position:absolute;background:#ffffff;border-left:3px dotted #9b9b9b}verdocs-template-roles>form .row{display:-ms-flexbox;display:flex;-webkit-column-gap:0;-moz-column-gap:0;column-gap:0;min-height:35px;margin-top:0;margin-left:40px;position:relative;-ms-flex-direction:row;flex-direction:row;padding:6px 0 4px 0}verdocs-template-roles>form .row .row-roles{-ms-flex:1;flex:1;gap:10px;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;-ms-flex-direction:row;flex-direction:row}verdocs-template-roles>form .row .icon{top:14px;z-index:2;left:-40px;width:24px;height:24px;position:absolute;background:#ffffff}verdocs-template-roles>form .row .sender{height:30px;display:-ms-flexbox;display:flex;font-size:14px;line-height:30px;-ms-flex-align:center;align-items:center;border-radius:30px;-ms-flex-direction:row;flex-direction:row;padding:0 15px 0 15px;border:1px solid #c6c9cc;background-color:#f5f5fa}verdocs-template-roles>form .row .complete{height:30px;display:-ms-flexbox;display:flex;font-size:14px;padding:0 15px;line-height:30px;-ms-flex-direction:row;flex-direction:row;border-radius:30px;background-color:#f5f5fa;border:1px solid #aeb4bf}verdocs-template-roles>form .row .label{font-weight:bold;margin-right:6px;color:#33364b}verdocs-template-roles>form .row .settings-button{display:-ms-flexbox;display:flex;cursor:pointer;margin:0 0 0 9px}verdocs-template-roles>form .row .recipient{height:30px;display:-ms-flexbox;display:flex;font-size:14px;border-radius:30px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;padding:0 5px 0 6px;white-space:nowrap;border:2px solid #aeb4bf}verdocs-template-roles>form .row .recipient .type-icon{width:24px;height:24px;-webkit-transform:scale(0.8);transform:scale(0.8);opacity:0.6;margin:0 12px 0 0}verdocs-template-roles>form .row .recipient.dragging{position:absolute}verdocs-template-roles>form .row .recipient.dragging+.dropzone{display:none !important}verdocs-template-roles>form .row .dropzone{width:14px;height:30px;display:none}verdocs-template-roles>form .row .dropzone svg{fill:#cccccc}verdocs-template-roles>form .row .dropzone.visible{margin:0 7px;display:-ms-flexbox;display:flex;-ms-flex:0 0 14px;flex:0 0 14px}verdocs-template-roles>form .row .dropzone.active{-ms-flex:0 0 120px;flex:0 0 120px;border-radius:30px;background:rgba(101, 77, 203, 0.4980392157);border:1px dashed #654dcb}verdocs-template-roles>form label{display:block;font-size:14px;font-weight:500;margin:0 0 4px 0;color:#5c6575}verdocs-template-roles>form input{border:none;font-size:18px;padding:3px 6px 3px 0;background:transparent;border-bottom:1px solid #33364b}verdocs-template-roles>form input:focus{outline:none}verdocs-template-roles .row.add-sequence{display:none}verdocs-template-roles .add-role{margin:0;padding:0;border:none;opacity:0.5;cursor:pointer;background:none}verdocs-template-roles .add-role:hover{opacity:1}verdocs-template-roles .add-role svg{width:32px;height:32px}verdocs-template-roles .add-step{margin:0;padding:0;border:none;opacity:0.5;cursor:pointer;background:none}verdocs-template-roles .add-step:hover{opacity:1}verdocs-template-roles .add-step svg{width:32px;height:32px}verdocs-template-roles.dragging .add-role{display:none}verdocs-template-roles.dragging form .row .recipient+.dropzone{display:-ms-flexbox;display:flex}verdocs-template-roles.dragging .row.add-sequence{display:-ms-flexbox;display:flex}verdocs-template-roles.dragging .row.add-sequence .dropzone{opacity:0.5;-ms-flex:0 0 120px;flex:0 0 120px;border-radius:30px;-ms-flex-align:center;align-items:center;background:rgba(101, 77, 203, 0.4980392157);-ms-flex-pack:center;justify-content:center;border:1px dashed #654dcb}verdocs-template-roles.dragging .row.add-sequence .dropzone.active{opacity:1}verdocs-template-roles .buttons{display:-ms-flexbox;display:flex;-webkit-column-gap:8px;-moz-column-gap:8px;column-gap:8px;margin-top:16px;-ms-flex-direction:row;flex-direction:row}verdocs-template-roles .empty{font-size:13px;margin-top:15px;margin-bottom:5px}verdocs-template-roles .empty svg{width:16px;height:16px;stroke:#666666;margin-bottom:2px;display:inline-block}verdocs-template-roles ::-webkit-input-placeholder{color:#aaaaaa}verdocs-template-roles ::-moz-placeholder{color:#aaaaaa}verdocs-template-roles :-ms-input-placeholder{color:#aaaaaa}verdocs-template-roles ::-ms-input-placeholder{color:#aaaaaa}verdocs-template-roles ::placeholder{color:#aaaaaa}';export{R as verdocs_preview,Q as verdocs_send,P as verdocs_template_attachments,j as verdocs_template_build_tabs,W as verdocs_template_fields,ee as verdocs_template_roles}
|
@@ -1 +0,0 @@
|
|
1
|
-
import{getTemplate as e}from"@verdocs/js-sdk";const t=e=>typeof e,s="",n=t(s),l=t(!0),a=t(0),o=t(t),r="type",c="default",i="Has",u="Ids",d="Table",f=d+"s",h=d+u,b="Row",g=b+"Count",T=b+u,_="Cell",p=_+u,v="Value",w=v+"s",S=v+u,I=e=>s+e,m=isFinite,C=e=>null==e,V=(e,t,s)=>C(e)?s?.():t(e),R=e=>e==n||e==l,y=e=>t(e)==o,J=e=>Array.isArray(e),L=(e,t,s)=>e.slice(t,s),E=e=>e.length,O=(e,t)=>e.forEach(t),j=(e,t)=>e.map(t),N=(e,...t)=>e.push(...t),F=Object,M=e=>F.getPrototypeOf(e),$=F.entries,x=F.isFrozen,A=e=>!C(e)&&V(M(e),(e=>e==F.prototype||C(M(e))),(()=>!0)),D=F.keys,P=F.freeze,k=(e,t)=>t in e,z=(e,t)=>(delete e[t],e),H=(e,t)=>j($(e),(([e,s])=>t(s,e))),W=e=>A(e)&&0==(e=>E(D(e)))(e),q=(e,t,s,n=0)=>C(e)||!A(e)||!n&&W(e)||x(e)?(s?.(),!1):(H(e,((s,n)=>{t(s,n)||z(e,n)})),!!n||!W(e)),B=e=>t=>Z(t).reduce(((t,s)=>t+e(s)),0),G=e=>e?.size??0,K=B(G),Q=B(K),U=B(Q),X=(e,t)=>e?.has(t)??!1,Y=e=>C(e)||0==G(e),Z=e=>[...e?.values()??[]],ee=e=>e.clear(),te=(e,t)=>e?.forEach(t),se=(e,t)=>e?.delete(t),ne=e=>new Map(e),le=e=>[...e?.keys()??[]],ae=(e,t)=>e?.get(t),oe=(e,t)=>te(e,((e,s)=>t(s,e))),re=(e,t,s)=>C(s)?(se(e,t),e):e?.set(t,s),ce=(e,t,s,n)=>(X(e,t)?n?.(ae(e,t)):re(e,t,s()),ae(e,t)),ie=(e,t,s,n=re)=>(H(t,((t,n)=>s(e,n,t))),oe(e,(s=>k(t,s)?0:n(e,s))),e),ue=(e,t,s,n)=>{const l={};return te(e,((e,a)=>{if(!s?.(e,a)){const s=t?t(e,a):e;n?.(s)||(l[a]=s)}})),l},de=(e,t,s)=>ue(e,(e=>ue(e,t,s)),Y,W),fe=(e,t,s)=>ue(e,(e=>de(e,t,s)),Y,W),he=(e,t)=>{const s=ne();return te(e,((e,n)=>s.set(n,t?.(e)??e))),s},be=e=>he(e,he),ge=e=>he(e,be),Te=(e,t,s,n,l=0)=>V((s?ce:ae)(e,t[l],l>E(t)-2?s:ne),(a=>{if(l>E(t)-2)return n?.(a)&&re(e,t[l]),a;const o=Te(a,t,s,n,l+1);return Y(a)&&re(e,t[l]),o})),_e=e=>{const s=t(e);return R(s)||s==a&&m(e)?s:void 0},pe=(e,t,s,n,l)=>C(l)?e.delCell(t,s,n,!0):e.setCell(t,s,n,l),ve=(e,t,s)=>C(s)?e.delValue(t):e.setValue(t,s),we=e=>new Set(J(e)||C(e)?e:[e]),Se=(e,t)=>e?.add(t),Ie=/^\d+$/,me=()=>{const e=[];let t=0;return[n=>(n?e.shift():null)??s+t++,t=>{Ie.test(t)&&E(e)<1e3&&N(e,t)}]},Ce=e=>[e,e],Ve=(e,t=K)=>t(e[0])+t(e[1]),Re=()=>[ne(),ne()],ye=e=>[...e],Je=([e,t])=>e===t,Le=JSON.stringify,Ee=JSON.parse,Oe=e=>Le(e,((e,t)=>t instanceof Map?F.fromEntries([...t]):t)),je=(e,t,s)=>re(e,t,ae(e,t)==-s?void 0:s),Ne=()=>{let e,t,n=!1,l=!1,o=0,u=[];const m=ne(),F=ne(),M=ne(),$=ne(),x=ne(),A=ne(),D=ne(),B=ne(),Z=ne(),Ie=ne(),Le=ne(),Fe=ne(),Me=ne(),$e=ne(),xe=we(),Ae=ne(),De=ne(),Pe=ne(),ke=ne(),ze=Re(),He=Re(),We=Re(),qe=Re(),Be=Re(),Ge=Re(),Ke=Re(),Qe=Re(),Ue=Re(),Xe=Re(),Ye=Re(),Ze=Re(),et=Re(),tt=Re(),st=Re(),nt=Re(),lt=Re(),at=Re(),ot=Re(),rt=Re(),ct=Re(),it=Re(),ut=ne(),dt=Re(),[ft,ht,bt,gt]=(e=>{let t;const[n,l]=me(),a=ne();return[(l,o,r,c=[],i=(()=>[]))=>{t??=e();const u=n(1);return re(a,u,[l,o,r,c,i]),Se(Te(o,r??[s],we),u),u},(e,n,...l)=>O(((e,t=[s])=>{const n=[],l=(e,s)=>s==E(t)?N(n,e):null===t[s]?te(e,(e=>l(e,s+1))):O([t[s],null],(t=>l(ae(e,t),s+1)));return l(e,0),n})(e,n),(e=>te(e,(e=>ae(a,e)[0](t,...n??[],...l))))),e=>V(ae(a,e),(([,t,n])=>(Te(t,n??[s],void 0,(t=>(se(t,e),Y(t)?1:0))),re(a,e),l(e),n))),e=>V(ae(a,e),(([e,,s=[],n,l])=>{const a=(...o)=>{const r=E(o);r==E(s)?e(t,...o,...l(o)):C(s[r])?O(n[r]?.(...o)??[],(e=>a(...o,e))):a(...o,s[r])};a()}))]})((()=>Ms)),Tt=e=>{if(!q(e,((e,t)=>[r,c].includes(t))))return!1;const t=e[r];return!(!R(t)&&t!=a||(_e(e[c])!=t&&z(e,c),0))},_t=J,pt=(t,s)=>(!e||X(Le,s)||Gt(s))&&q(t,((e,t)=>vt(s,t,e)),(()=>Gt(s))),vt=(e,t,s,n)=>q(n?s:mt(s,e,t),((n,l)=>V(wt(e,t,l,n),(e=>(s[l]=e,!0)),(()=>!1))),(()=>Gt(e,t))),wt=(t,s,n,l)=>e?V(ae(ae(Le,t),n),(e=>_e(l)!=e[r]?Gt(t,s,n,l,e[c]):l),(()=>Gt(t,s,n,l))):C(_e(l))?Gt(t,s,n,l):l,St=(e,t)=>q(t?e:Ct(e),((t,s)=>V(It(s,t),(t=>(e[s]=t,!0)),(()=>!1))),(()=>Kt())),It=(e,s)=>t?V(ae(Me,e),(t=>_e(s)!=t[r]?Kt(e,s,t[c]):s),(()=>Kt(e,s))):C(_e(s))?Kt(e,s):s,mt=(e,t,s)=>(V(ae(Fe,t),(([n,l])=>{te(n,((t,s)=>{k(e,s)||(e[s]=t)})),te(l,(n=>{k(e,n)||Gt(t,s,n)}))})),e),Ct=e=>(t&&(te($e,((t,s)=>{k(e,s)||(e[s]=t)})),te(xe,(t=>{k(e,t)||Kt(t)}))),e),Vt=e=>ie(Le,e,((e,t,s)=>{const n=ne(),l=we();ie(ce(Le,t,ne),s,((e,t,s)=>{re(e,t,s),V(s[c],(e=>re(n,t,e)),(()=>Se(l,t)))})),re(Fe,t,[n,l])}),((e,t)=>{re(Le,t),re(Fe,t)})),Rt=e=>ie(Me,e,((e,t,s)=>{re(Me,t,s),V(s[c],(e=>re($e,t,e)),(()=>Se(xe,t)))}),((e,t)=>{re(Me,t),re($e,t),se(xe,t)})),yt=e=>W(e)?Rs():Ss(e),Jt=e=>ie(Pe,e,((e,t,s)=>Lt(t,s)),((e,t)=>xt(t))),Lt=(e,t)=>ie(ce(Pe,e,(()=>(kt(e,1),re(Ae,e,me()),re(De,e,ne()),ne()))),t,((t,s,n)=>Et(e,t,s,n)),((t,s)=>At(e,t,s))),Et=(e,t,s,n,l)=>ie(ce(t,s,(()=>(zt(e,s,1),ne()))),n,((t,n,l)=>Ot(e,s,t,n,l)),((n,a)=>Dt(e,t,s,n,a,l))),Ot=(e,t,s,n,l)=>{X(s,n)||Ht(e,t,n,1);const a=ae(s,n);l!==a&&(Wt(e,t,n,a,l),re(s,n,l))},jt=(e,t,s,n,l)=>V(ae(t,s),(t=>Ot(e,s,t,n,l)),(()=>Et(e,t,s,mt({[n]:l},e,s)))),Nt=e=>W(e)?Ls():Is(e),Ft=e=>ie(ke,e,((e,t,s)=>Mt(t,s)),((e,t)=>Pt(t))),Mt=(e,t)=>{X(ke,e)||qt(e,1);const s=ae(ke,e);t!==s&&(Bt(e,s,t),re(ke,e,t))},$t=e=>ae(Pe,e)??Lt(e,{}),xt=e=>Lt(e,{}),At=(e,t,s)=>{const[,n]=ae(Ae,e);n(s),Et(e,t,s,{},!0)},Dt=(e,t,s,n,l,a)=>{const o=ae(ae(Fe,e)?.[0],l);if(!C(o)&&!a)return Ot(e,s,n,l,o);const r=t=>{Wt(e,s,t,ae(n,t)),Ht(e,s,t,-1),re(n,t)};C(o)?r(l):oe(n,r),Y(n)&&(zt(e,s,-1),Y(re(t,s))&&(kt(e,-1),re(Pe,e),re(Ae,e),re(De,e)))},Pt=e=>{const t=ae($e,e);if(!C(t))return Mt(e,t);Bt(e,ae(ke,e)),qt(e,-1),re(ke,e)},kt=(e,t)=>je(m,e,t),zt=(e,t,s)=>je(ce($,e,ne),t,s)&&re(M,e,ce(M,e,(()=>0))+s),Ht=(e,t,s,n)=>{const l=ae(De,e),a=ae(l,s)??0;(0==a&&1==n||1==a&&-1==n)&&je(ce(F,e,ne),s,n),re(l,s,a!=-n?a+n:null),je(ce(ce(x,e,ne),t,ne),s,n)},Wt=(e,t,s,n,l)=>{ce(ce(ce(A,e,ne),t,ne),s,(()=>[n,0]))[1]=l,u[3]?.(e,t,s,l)},qt=(e,t)=>je(D,e,t),Bt=(e,t,s)=>{ce(B,e,(()=>[t,0]))[1]=s,u[4]?.(e,s)},Gt=(e,t,s,n,l)=>(N(ce(ce(ce(Z,e,ne),t,ne),s,(()=>[])),n),l),Kt=(e,t,s)=>(N(ce(Ie,e,(()=>[])),t),s),Qt=(e,t,s)=>V(ae(ae(ae(A,e),t),s),(([e,t])=>[!0,e,t]),(()=>[!1,...Ce(us(e,t,s))])),Ut=e=>V(ae(B,e),(([e,t])=>[!0,e,t]),(()=>[!1,...Ce(hs(e))])),Xt=e=>Y(Z)||Y(nt[e])?0:te(e?ge(Z):Z,((t,s)=>te(t,((t,n)=>te(t,((t,l)=>ht(nt[e],[s,n,l],t))))))),Yt=e=>Y(Ie)||Y(lt[e])?0:te(e?he(Ie):Ie,((t,s)=>ht(lt[e],[s],t))),Zt=(e,t,s,n)=>{if(!Y(e))return ht(t,n,(()=>ue(e))),oe(e,((e,t)=>ht(s,[...n??[],e],1==t))),1},es=e=>{const t=bs();t!=n&&ht(ze[e],void 0,t);const s=Y(Xe[e]),l=Y(et[e])&&Y(tt[e])&&Y(Ue[e])&&Y(Ye[e])&&Y(Ge[e])&&Y(Ke[e])&&Y(Qe[e])&&s&&Y(We[e])&&Y(qe[e]),a=Y(st[e])&&Y(Ze[e])&&Y(Be[e])&&Y(He[e]);if(!l||!a){const t=e?[he(m),be(F),he(M),be($),ge(x),ge(A)]:[m,F,M,$,x,A];if(!l){Zt(t[0],We[e],qe[e]),te(t[1],((t,s)=>Zt(t,Ge[e],Ke[e],[s]))),te(t[2],((t,s)=>{0!=t&&ht(Qe[e],[s],os(s))}));const n=we();te(t[3],((t,l)=>{Zt(t,Ue[e],Ye[e],[l])&&!s&&(ht(Xe[e],[l,null]),Se(n,l))})),s||te(t[5],((t,s)=>{if(!X(n,s)){const n=we();te(t,(e=>te(e,(([t,s],l)=>s!==t?Se(n,l):se(e,l))))),te(n,(t=>ht(Xe[e],[s,t])))}})),te(t[4],((t,s)=>te(t,((t,n)=>Zt(t,et[e],tt[e],[s,n])))))}if(!a){let s;te(t[5],((t,n)=>{let l;te(t,((t,a)=>{let o;te(t,(([t,r],c)=>{r!==t&&(ht(st[e],[n,a,c],r,t,Qt),s=l=o=1)})),o&&ht(Ze[e],[n,a],Qt)})),l&&ht(Be[e],[n],Qt)})),s&&ht(He[e],void 0,Qt)}}},ts=e=>{const t=vs();t!=l&&ht(at[e],void 0,t);const s=Y(rt[e])&&Y(ct[e]),n=Y(it[e])&&Y(ot[e]);if(!s||!n){const t=e?[he(D),he(B)]:[D,B];if(s||Zt(t[0],rt[e],ct[e]),!n){let s;te(t[1],(([t,n],l)=>{n!==t&&(ht(it[e],[l],n,t,Ut),s=1)})),s&&ht(ot[e],void 0,Ut)}}},ss=(e,...t)=>(js((()=>e(...j(t,I)))),Ms),ns=()=>fe(Pe),ls=()=>le(Pe),as=e=>le(ae(De,I(e))),os=e=>G(ae(Pe,I(e))),rs=e=>le(ae(Pe,I(e))),cs=(e,t,s,n=0,l)=>{return j(L((a=ae(Pe,I(e)),o=(e,s)=>[C(t)?s:ae(e,I(t)),s],j([...a?.entries()??[]],(([e,t])=>o(t,e))).sort((([e],[t])=>((e??0)<(t??0)?-1:1)*(s?-1:1)))),n,C(l)?l:n+l),(([,e])=>e));var a,o},is=(e,t)=>le(ae(ae(Pe,I(e)),I(t))),us=(e,t,s)=>ae(ae(ae(Pe,I(e)),I(t)),I(s)),ds=()=>ue(ke),fs=()=>le(ke),hs=e=>ae(ke,I(e)),bs=()=>!Y(Pe),gs=e=>X(Pe,I(e)),Ts=(e,t)=>X(ae(De,I(e)),I(t)),_s=(e,t)=>X(ae(Pe,I(e)),I(t)),ps=(e,t,s)=>X(ae(ae(Pe,I(e)),I(t)),I(s)),vs=()=>!Y(ke),ws=e=>X(ke,I(e)),Ss=e=>ss((()=>(e=>q(e,pt,Gt))(e)?Jt(e):0)),Is=e=>ss((()=>St(e)?Ft(e):0)),ms=e=>{try{yt(Ee(e))}catch{}return Ms},Cs=t=>ss((()=>{if((e=q(t,(e=>q(e,Tt))))&&(Vt(t),!Y(Pe))){const e=ns();Rs(),Ss(e)}})),Vs=e=>ss((()=>{if(t=(e=>q(e,Tt))(e)){const s=ds();Os(),Ls(),t=!0,Rt(e),Is(s)}})),Rs=()=>ss((()=>Jt({}))),ys=e=>ss((e=>X(Pe,e)?xt(e):0),e),Js=(e,t)=>ss(((e,t)=>V(ae(Pe,e),(s=>X(s,t)?At(e,s,t):0))),e,t),Ls=()=>ss((()=>Ft({}))),Es=()=>ss((()=>{Vt({}),e=!1})),Os=()=>ss((()=>{Rt({}),t=!1})),js=(e,t)=>{if(-1!=o){Ns();const s=e();return Fs(t),s}},Ns=()=>(-1!=o&&o++,1==o&&(u[0]?.(),ht(ut)),Ms),Fs=e=>(o>0&&(o--,0==o&&(o=1,Xt(1),Y(A)||es(1),Yt(1),Y(B)||ts(1),e?.(Ms)&&(te(A,((e,t)=>te(e,((e,s)=>te(e,(([e],n)=>pe(Ms,t,s,n,e))))))),ee(A),te(B,(([e],t)=>ve(Ms,t,e))),ee(B)),ht(dt[0],void 0),o=-1,Xt(0),Y(A)||es(0),Yt(0),Y(B)||ts(0),u[1]?.(),ht(dt[1],void 0),u[2]?.(),o=0,n=bs(),l=vs(),O([m,F,M,$,x,A,Z,D,B,Ie],ee))),Ms),Ms={getContent:()=>[ns(),ds()],getTables:ns,getTableIds:ls,getTable:e=>de(ae(Pe,I(e))),getTableCellIds:as,getRowCount:os,getRowIds:rs,getSortedRowIds:cs,getRow:(e,t)=>ue(ae(ae(Pe,I(e)),I(t))),getCellIds:is,getCell:us,getValues:ds,getValueIds:fs,getValue:hs,hasTables:bs,hasTable:gs,hasTableCell:Ts,hasRow:_s,hasCell:ps,hasValues:vs,hasValue:ws,getTablesJson:()=>Oe(Pe),getValuesJson:()=>Oe(ke),getJson:()=>Oe([Pe,ke]),getTablesSchemaJson:()=>Oe(Le),getValuesSchemaJson:()=>Oe(Me),getSchemaJson:()=>Oe([Le,Me]),hasTablesSchema:()=>e,hasValuesSchema:()=>t,setContent:e=>ss((()=>_t(e)?(([e,t])=>{(W(e)?Rs:Ss)(e),(W(t)?Ls:Is)(t)})(e):0)),setTables:Ss,setTable:(e,t)=>ss((e=>pt(t,e)?Lt(e,t):0),e),setRow:(e,t,s)=>ss(((e,t)=>vt(e,t,s)?Et(e,$t(e),t,s):0),e,t),addRow:(e,t,s=!0)=>js((()=>{let n;return vt(e,n,t)&&(e=I(e),Et(e,$t(e),n=((e,t)=>{const[s]=ae(Ae,e);let n;do{n=s(t)}while(X(ae(Pe,e),n));return n})(e,s?1:0),t)),n})),setPartialRow:(e,t,s)=>ss(((e,t)=>{if(vt(e,t,s,1)){const n=$t(e);H(s,((s,l)=>jt(e,n,t,l,s)))}}),e,t),setCell:(e,t,s,n)=>ss(((e,t,s)=>V(wt(e,t,s,y(n)?n(us(e,t,s)):n),(n=>jt(e,$t(e),t,s,n)))),e,t,s),setValues:Is,setPartialValues:e=>ss((()=>St(e,1)?H(e,((e,t)=>Mt(t,e))):0)),setValue:(e,t)=>ss((e=>V(It(e,y(t)?t(hs(e)):t),(t=>Mt(e,t)))),e),applyChanges:e=>ss((()=>{H(e[0],((e,t)=>C(e)?ys(t):H(e,((e,s)=>C(e)?Js(t,s):H(e,((e,n)=>pe(Ms,t,s,n,e))))))),H(e[1],((e,t)=>ve(Ms,t,e)))})),setTablesJson:ms,setValuesJson:e=>{try{Nt(Ee(e))}catch{}return Ms},setJson:e=>ss((()=>{try{const[t,s]=Ee(e);yt(t),Nt(s)}catch{ms(e)}})),setTablesSchema:Cs,setValuesSchema:Vs,setSchema:(e,t)=>ss((()=>{Cs(e),Vs(t)})),delTables:Rs,delTable:ys,delRow:Js,delCell:(e,t,s,n)=>ss(((e,t,s)=>V(ae(Pe,e),(l=>V(ae(l,t),(a=>X(a,s)?Dt(e,l,t,a,s,n):0))))),e,t,s),delValues:Ls,delValue:e=>ss((e=>X(ke,e)?Pt(e):0),e),delTablesSchema:Es,delValuesSchema:Os,delSchema:()=>ss((()=>{Es(),Os()})),transaction:js,startTransaction:Ns,getTransactionChanges:()=>[ue(A,((e,t)=>-1===ae(m,t)?void 0:ue(e,((e,s)=>-1===ae(ae($,t),s)?void 0:ue(e,(([,e])=>e),(e=>Je(e)))),Y,W)),Y,W),ue(B,(([,e])=>e),(e=>Je(e))),1],getTransactionLog:()=>[!Y(A),!Y(B),fe(A,ye,Je),fe(Z),ue(B,ye,Je),ue(Ie),ue(m),de($),fe(x),ue(D)],finishTransaction:Fs,forEachTable:e=>te(Pe,((t,s)=>e(s,(e=>te(t,((t,s)=>e(s,(e=>oe(t,e))))))))),forEachTableCell:(e,t)=>oe(ae(De,I(e)),t),forEachRow:(e,t)=>te(ae(Pe,I(e)),((e,s)=>t(s,(t=>oe(e,t))))),forEachCell:(e,t,s)=>oe(ae(ae(Pe,I(e)),I(t)),s),forEachValue:e=>oe(ke,e),addSortedRowIdsListener:(e,t,s,n,l,a,o)=>{let r=cs(e,t,s,n,l);return ft((()=>{const o=cs(e,t,s,n,l);var c,i;i=r,E(c=o)===E(i)&&c.every(((e,t)=>i[t]===e))||(r=o,a(Ms,e,t,s,n,l,r))}),Xe[o?1:0],[e,t],[ls])},addStartTransactionListener:e=>ft(e,ut),addWillFinishTransactionListener:e=>ft(e,dt[0]),addDidFinishTransactionListener:e=>ft(e,dt[1]),callListener:e=>(gt(e),Ms),delListener:e=>(bt(e),Ms),getListenerStats:()=>({hasTables:Ve(ze),tables:Ve(He),tableIds:Ve(We),hasTable:Ve(qe),table:Ve(Be),tableCellIds:Ve(Ge),hasTableCell:Ve(Ke,Q),rowCount:Ve(Qe),rowIds:Ve(Ue),sortedRowIds:Ve(Xe),hasRow:Ve(Ye,Q),row:Ve(Ze,Q),cellIds:Ve(et,Q),hasCell:Ve(tt,U),cell:Ve(st,U),invalidCell:Ve(nt,U),hasValues:Ve(at),values:Ve(ot),valueIds:Ve(rt),hasValue:Ve(ct),value:Ve(it),invalidValue:Ve(lt),transaction:K(ut)+Ve(dt)}),isMergeable:()=>!1,createStore:Ne,addListener:ft,callListeners:ht,setInternalListeners:(e,t,s,n,l)=>u=[e,t,s,n,l]};return H({[i+f]:[0,ze,[],()=>[bs()]],[f]:[0,He],[h]:[0,We],[i+d]:[1,qe,[ls],e=>[gs(...e)]],[d]:[1,Be,[ls]],[d+p]:[1,Ge,[ls]],[i+d+_]:[2,Ke,[ls,as],e=>[Ts(...e)]],[g]:[1,Qe,[ls]],[T]:[1,Ue,[ls]],[i+b]:[2,Ye,[ls,rs],e=>[_s(...e)]],[b]:[2,Ze,[ls,rs]],[p]:[2,et,[ls,rs]],[i+_]:[3,tt,[ls,rs,is],e=>[ps(...e)]],[_]:[3,st,[ls,rs,is],e=>Ce(us(...e))],InvalidCell:[3,nt],[i+w]:[0,at,[],()=>[vs()]],[w]:[0,ot],[S]:[0,rt],[i+v]:[1,ct,[fs],e=>[ws(...e)]],[v]:[1,it,[fs],e=>Ce(hs(e[0]))],InvalidValue:[1,lt]},(([e,t,s,n],l)=>{Ms["add"+l+"Listener"]=(...l)=>ft(l[e],t[l[e+1]?1:0],e>0?L(l,0,e):void 0,s,n)})),P(Ms)},Fe=Ne();Fe.delTables(),Fe.delValues(),console.log("[STORE] Data store initialized.");const Me=(e,t)=>{try{return JSON.parse(e)}catch(e){return t||null}},$e=e=>{const t={};for(let s in e)"string"==typeof e[s]||"number"==typeof e[s]||"boolean"==typeof e[s]?t[s]=e[s]:null===e[s]?t[`__null__${s}`]="":Array.isArray(e[s])?t[`__array__${s}`]=JSON.stringify(e[s]):"object"==typeof e[s]&&(t[`__object__${s}`]=JSON.stringify(e[s]));return t},xe=e=>{const t={};for(let s in e)s.startsWith("__null__")?t[s.replace("__null__","")]=null:"string"==typeof e[s]&&s.startsWith("__array__")?t[s.replace("__array__","")]=Me(e[s]):"string"==typeof e[s]&&s.startsWith("__object__")?t[s.replace("__object__","")]=Me(e[s]):t[s]=e[s];return t},Ae={store:Fe,subscribe(e,t,s,n,l){Fe.hasRow(e,t)&&l(xe(Fe.getRow(e,t)));const a=Fe.addRowListener(e,t,(()=>{const s=Fe.getRow(e,t);l(xe(s))}));return Fe.hasRow(e,t)&&!n||(console.log("[STORE] Reloading",{tableId:e,rowId:t}),s().then((s=>{console.log("[STORE] Loaded row",{tableId:e,rowId:t,forceReload:n},s),Fe.setRow(e,t,$e(s))})).catch((s=>{console.error("[STORE] Error getting row",{tableId:e,rowId:t,forceReload:n},s)}))),a},unsubscribe(e){Fe.delListener(e)},async getTemplate(t,s,n=!1){if(!n){if(!Fe.hasRow("templates",s))return null;const e=Fe.getRow("templates",s);return xe(e)}const l=await e(t,s);return Fe.setRow("templates",s,$e(l)),l},updateTemplate:(e,t)=>(Fe.setRow("templates",e,$e(t)),t),async getEnvelope(t,s,n=!1){if(!n){if(!Fe.hasRow("envelopes",s))return null;const e=Fe.getRow("envelopes",s);return xe(e)}const l=await e(t,s);return Fe.setRow("envelopes",s,$e(l)),l},updateEnvelope:(e,t)=>(Fe.setRow("envelopes",e,$e(t)),t),getField(e,t,s){if("template"===e){const e=Fe.getRow("templates",t),n=xe(e),l=(n.fields||[]).find((e=>e.name===s)),a=(n.roles||[]).map((e=>e.name)).findIndex((e=>e===l.role_name));return{index:Math.max(a,0),field:l}}{const e=Fe.getRow("envelopes",t),n=xe(e),l=(n.fields||[]).find((e=>e.name===s));return{index:(n.recipients||[]).map((e=>e.role_name)).findIndex((e=>e===l.role_name)),field:l}}}};export{Ae as S}
|