@verdocs/web-sdk 5.0.11 → 5.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. package/dist/cjs/verdocs-preview_6.cjs.entry.js +14 -7
  2. package/dist/cjs/verdocs-sign.cjs.entry.js +2 -2
  3. package/dist/collection/components/embeds/verdocs-send/verdocs-send.js +13 -6
  4. package/dist/collection/components/embeds/verdocs-sign/verdocs-sign.js +2 -2
  5. package/dist/collection/components/templates/verdocs-template-roles/verdocs-template-roles.js +1 -3
  6. package/dist/components/{p-0689fc47.js → p-022b87d3.js} +14 -7
  7. package/dist/components/{p-a60453aa.js → p-56e4effa.js} +1 -1
  8. package/dist/components/verdocs-build.js +2 -2
  9. package/dist/components/verdocs-send.js +1 -1
  10. package/dist/components/verdocs-sign.js +2 -2
  11. package/dist/components/verdocs-template-roles.js +1 -1
  12. package/dist/esm/verdocs-preview_6.entry.js +15 -8
  13. package/dist/esm/verdocs-sign.entry.js +2 -2
  14. package/dist/esm-es5/verdocs-preview_6.entry.js +2 -2
  15. package/dist/esm-es5/verdocs-sign.entry.js +1 -1
  16. package/dist/types/components/fields/verdocs-field-signature/verdocs-field-signature.d.ts +2 -2
  17. package/dist/verdocs-web-sdk/p-41f22b0a.system.entry.js +1 -0
  18. package/dist/verdocs-web-sdk/p-98ab739b.entry.js +1 -0
  19. package/dist/verdocs-web-sdk/p-bf0b5dbc.entry.js +8 -0
  20. package/dist/verdocs-web-sdk/p-e2b70dfb.system.js +1 -1
  21. package/dist/verdocs-web-sdk/{p-2b7edf3a.system.entry.js → p-e77c1fcc.system.entry.js} +2 -2
  22. package/dist/verdocs-web-sdk/verdocs-web-sdk.esm.js +1 -1
  23. package/package.json +1 -1
  24. package/dist/verdocs-web-sdk/p-9233595a.entry.js +0 -1
  25. package/dist/verdocs-web-sdk/p-94ffe928.entry.js +0 -8
  26. package/dist/verdocs-web-sdk/p-ba92b80b.system.entry.js +0 -1
@@ -1 +1 @@
1
- import{p as e,b as a}from"./p-b9654a5e.js";export{s as setNonce}from"./p-b9654a5e.js";import{g as t}from"./p-e1255160.js";(()=>{const a=import.meta.url,t={};return""!==a&&(t.resourcesUrl=new URL(".",a).href),e(t)})().then((async e=>(await t(),a(JSON.parse('[["p-1eb501c3",[[0,"verdocs-build",{"endpoint":[16],"templateId":[1537,"template-id"],"step":[1537],"loading":[32],"template":[32]},null,{"templateId":["onTemplateIdChanged"],"step":["onStepChanged"]}]]],["p-6da00869",[[0,"verdocs-envelopes-list",{"endpoint":[16],"view":[1537],"status":[1537],"sort":[1537],"match":[1537],"showPagination":[4,"show-pagination"],"rowsPerPage":[2,"rows-per-page"],"selectedPage":[2,"selected-page"],"count":[32],"initiallyLoaded":[32],"loading":[32],"selectedEnvelopes":[32],"envelopes":[32]},null,{"view":["handleViewUpdated"],"status":["handleStatusUpdated"],"sort":["handleSortUpdated"],"match":["handleMatchUpdated"],"selectedPage":["handlePageUpdated"]}]]],["p-9233595a",[[0,"verdocs-sign",{"endpoint":[1040],"envelopeId":[513,"envelope-id"],"roleId":[513,"role-id"],"inviteCode":[513,"invite-code"],"headerTargetId":[1,"header-target-id"],"roleNames":[32],"sortedRecipients":[32],"recipient":[32],"hasSignature":[32],"nextButtonLabel":[32],"nextSubmits":[32],"fatalErrorHeader":[32],"fatalErrorMessage":[32],"focusedField":[32],"submitting":[32],"submitted":[32],"isDone":[32],"showDone":[32],"showLoadError":[32],"finishLater":[32],"showFinishLater":[32],"agreed":[32],"documentsSingularPlural":[32],"kbaStep":[32],"kbaQuestions":[32],"showSpinner":[32],"kbaChoices":[32],"loading":[32],"envelope":[32]}]]],["p-4b36ca30",[[0,"verdocs-templates-list",{"endpoint":[16],"visibility":[1537],"starred":[1537],"sort":[1537],"name":[1537],"allowedActions":[1040],"showPagination":[4,"show-pagination"],"rowsPerPage":[2,"rows-per-page"],"selectedPage":[2,"selected-page"],"count":[32],"initiallyLoaded":[32],"loading":[32],"confirmDelete":[32],"templates":[32],"localNameFilter":[32]},null,{"sharing":["handleSharingUpdated"],"starred":["handleStarredUpdated"],"sort":["handleSortUpdated"],"name":["handleNameUpdated"],"selectedPage":["handlePageUpdated"]}]]],["p-b0436bc7",[[0,"verdocs-field-payment",{"source":[513],"sourceid":[513],"fieldname":[513],"field":[16],"disabled":[516],"done":[516],"editable":[516],"moveable":[516],"xscale":[514],"yscale":[514],"pagenumber":[514],"fields":[16],"pageNum":[2,"page-num"],"roleName":[1,"role-name"],"fieldId":[1,"field-id"],"recipients":[8],"selectedRoleName":[1,"selected-role-name"],"pdfPages":[16],"currentSignature":[1,"current-signature"],"currentSignatureId":[1,"current-signature-id"],"currentInitial":[1,"current-initial"],"currentInitialId":[1,"current-initial-id"],"signed":[4],"roleindex":[2],"showingProperties":[32],"focused":[32],"preparedMessage":[32],"signatureUrl":[32],"focusField":[64],"showSettingsPanel":[64],"hideSettingsPanel":[64]}]]],["p-ea75f159",[[0,"verdocs-envelope-sidebar",{"endpoint":[16],"envelopeId":[1,"envelope-id"],"activeTab":[32],"panelOpen":[32],"showRecipientDialog":[32],"showCancelDialog":[32],"remindersEnabled":[32],"updatingReminders":[32],"initialReminder":[32],"followupReminders":[32],"loading":[32],"envelope":[32]}]]],["p-92ce6180",[[0,"verdocs-template-create",{"endpoint":[16],"maxSize":[1026,"max-size"],"file":[32],"creating":[32],"progressLabel":[32],"progressPercent":[32],"errorMessage":[32]}]]],["p-e6dbb0f7",[[0,"verdocs-auth",{"endpoint":[16],"visible":[4],"logo":[1],"displayMode":[1025,"display-mode"],"org_name":[32],"first_name":[32],"last_name":[32],"email":[32],"verificationCode":[32],"newPassword":[32],"password":[32],"confirmpass":[32],"submitting":[32],"resendDisabled":[32],"session":[32],"profile":[32]}]]],["p-7688bc89",[[0,"verdocs-envelope-recipient-summary",{"endpoint":[16],"envelopeId":[1,"envelope-id"],"canSendAnother":[4,"can-send-another"],"canView":[4,"can-view"],"canDone":[4,"can-done"],"isOpen":[32],"recipientStatusIcons":[32],"containerId":[32],"gettingLinks":[32],"links":[32],"loading":[32],"envelope":[32]}]]],["p-92364765",[[4,"verdocs-dialog"]]],["p-39b72c10",[[0,"verdocs-quick-functions",{"endpoint":[16]}]]],["p-47f32221",[[0,"verdocs-radio-button",{"checked":[4],"name":[1],"value":[1],"disabled":[4]}]]],["p-5f1a000c",[[0,"verdocs-search-box",{"endpoint":[16],"placeholder":[1],"type":[1],"query":[1],"grabsFocus":[4,"grabs-focus"],"focusField":[64]}]]],["p-899fa588",[[0,"verdocs-search-tabs",{"selected":[32]}]]],["p-76cc40fe",[[0,"verdocs-table",{"columns":[16],"data":[16]}]]],["p-1e495c60",[[0,"verdocs-template-card",{"template":[16]}]]],["p-152b9acd",[[0,"verdocs-template-tags",{"tags":[16]}]]],["p-c1728f5c",[[0,"verdocs-toggle",{"options":[16],"theme":[1],"selectedOption":[32]}]]],["p-dc558be5",[[0,"verdocs-status-indicator",{"size":[1],"theme":[1],"status":[1],"envelope":[16],"isOpen":[32],"containerId":[32]}]]],["p-f6b77cd1",[[0,"verdocs-template-star",{"endpoint":[16],"template":[1040],"updating":[32]}]]],["p-2d7d0805",[[0,"verdocs-envelope-document-page",{"endpoint":[16],"envelopeId":[1,"envelope-id"],"documentId":[1,"document-id"],"pageNumber":[2,"page-number"],"virtualWidth":[2,"virtual-width"],"virtualHeight":[1026,"virtual-height"],"layers":[16],"type":[1],"containerId":[32],"renderedWidth":[32],"renderedHeight":[32],"naturalWidth":[32],"naturalHeight":[32],"aspectRatio":[32],"skipFirstNotification":[32],"pageDisplayUri":[32]}]]],["p-db4c36aa",[[0,"verdocs-help-icon",{"text":[1],"icon":[1],"containerId":[32]}],[0,"verdocs-button",{"label":[1],"startIcon":[1,"start-icon"],"endIcon":[1,"end-icon"],"size":[1],"type":[1],"variant":[1],"disabled":[4]}]]],["p-ef7813ed",[[0,"verdocs-view",{"endpoint":[16],"envelopeId":[1,"envelope-id"],"headerTargetId":[1,"header-target-id"],"canceling":[32],"showCancelDone":[32],"showLoadError":[32],"loading":[32],"envelope":[32]}],[0,"verdocs-kba-dialog",{"step":[2],"steps":[2],"helptitle":[1],"helptext":[1],"mode":[1],"label":[1],"placeholder":[1],"recipient":[16],"choices":[16],"response":[32],"updatedRecipient":[32]}]]],["p-4a960ba5",[[0,"verdocs-envelope-recipient-link",{"endpoint":[16],"envelopeId":[1,"envelope-id"],"roleName":[1,"role-name"],"isOpen":[32],"gettingLink":[32],"link":[32],"loading":[32],"envelope":[32],"recipient":[32]}],[0,"verdocs-switch",{"checked":[1028],"theme":[1],"disabled":[4]}]]],["p-35903760",[[0,"verdocs-template-role-properties",{"endpoint":[16],"templateId":[1,"template-id"],"roleName":[1,"role-name"],"dirty":[32],"saving":[32],"name":[32],"type":[32],"first_name":[32],"last_name":[32],"email":[32],"phone":[32],"delegator":[32],"loading":[32],"template":[32]}],[4,"verdocs-menu-panel",{"side":[1],"overlay":[4],"width":[2]},[[4,"click","handleClick"]]]]],["p-2f73c9de",[[4,"verdocs-button-panel",{"icon":[1],"showPanel":[64],"hidePanel":[64],"toggle":[64]}],[4,"verdocs-tabs",{"tabs":[16],"selectedTab":[2,"selected-tab"]}]]],["p-786bacad",[[0,"verdocs-pagination",{"selectedPage":[1538,"selected-page"],"itemCount":[2,"item-count"],"perPage":[2,"per-page"]}],[0,"verdocs-quick-filter",{"options":[16],"label":[1],"value":[1537],"placeholder":[1],"open":[32]}]]],["p-99b819ad",[[0,"verdocs-ok-dialog",{"heading":[1],"message":[1],"buttonLabel":[1,"button-label"],"showCancel":[4,"show-cancel"],"closed":[32]}]]],["p-91977069",[[0,"verdocs-toolbar-icon",{"text":[1],"icon":[1],"placement":[1],"containerId":[32]}],[0,"verdocs-template-document-page",{"endpoint":[16],"editable":[4],"disabled":[4],"done":[4],"templateId":[1,"template-id"],"documentId":[1,"document-id"],"pageNumber":[2,"page-number"],"virtualWidth":[2,"virtual-width"],"virtualHeight":[1026,"virtual-height"],"layers":[16],"containerId":[32],"renderedWidth":[32],"renderedHeight":[32],"naturalWidth":[32],"naturalHeight":[32],"aspectRatio":[32],"skipFirstNotification":[32],"pageDisplayUri":[32],"xScale":[32],"yScale":[32],"loading":[32],"template":[32]}]]],["p-a4b05f08",[[0,"verdocs-contact-picker",{"endpoint":[16],"templateRole":[16],"contactSuggestions":[16],"first_name":[32],"last_name":[32],"email":[32],"phone":[32],"zip":[32],"address":[32],"message":[32],"showSuggestions":[32],"showMessage":[32],"delegator":[32],"showKba":[32],"kba_method":[32],"kba_pin":[32],"nameFieldId":[32],"firstNameFieldId":[32],"lastNameFieldId":[32],"emailFieldId":[32],"phoneFieldId":[32]}],[0,"verdocs-toggle-button",{"active":[4],"icon":[1],"label":[1],"size":[1],"_active":[32]}]]],["p-af1802b6",[[0,"verdocs-file-chooser",{"endpoint":[16],"file":[32]}],[0,"verdocs-progress-bar",{"label":[1],"showPercent":[4,"show-percent"],"percent":[2]}]]],["p-be4ec401",[[0,"verdocs-spinner",{"size":[2],"mode":[1]}]]],["p-c3593d47",[[0,"verdocs-organization-card",{"organization":[16],"hovered":[32]},[[1,"mouseover","onMouseOver"],[1,"mouseout","onMouseOut"]]],[4,"verdocs-portal",{"anchor":[1],"voffset":[2]},[[11,"scroll","handleScroll"],[9,"resize","handleResize"],[4,"click","handleClick"]]]]],["p-bdd7b3d3",[[0,"verdocs-dropdown",{"options":[16],"containerId":[32],"showPicker":[32]}]]],["p-553a341c",[[0,"verdocs-template-field-properties",{"endpoint":[16],"templateId":[1,"template-id"],"fieldName":[1025,"field-name"],"helpText":[1,"help-text"],"dirty":[32],"label":[32],"type":[32],"name":[32],"required":[32],"roleName":[32],"group":[32],"fieldType":[32],"options":[32],"placeholder":[32],"defaultValue":[32],"showingHelp":[32],"loading":[32],"template":[32]}],[0,"verdocs-checkbox",{"checked":[4],"name":[1],"label":[1],"value":[1],"theme":[1],"disabled":[4]}],[0,"verdocs-select-input",{"value":[1],"label":[1],"options":[16],"disabled":[4]}],[0,"verdocs-component-error",{"message":[1]}],[0,"verdocs-loader"],[0,"verdocs-text-input",{"value":[1537],"label":[1],"placeholder":[1],"autocomplete":[1],"helpText":[1,"help-text"],"clearable":[4],"copyable":[4],"type":[1],"disabled":[4],"required":[4],"showingPw":[32]}]]],["p-7abbdb69",[[0,"verdocs-field-attachment",{"endpoint":[16],"source":[513],"sourceid":[513],"fieldname":[513],"field":[16],"disabled":[516],"editable":[516],"moveable":[516],"done":[516],"xscale":[514],"yscale":[514],"pagenumber":[514],"showingProperties":[32],"dialogOpen":[32],"selectedFile":[32],"focused":[32],"focusField":[64],"showSettingsPanel":[64],"hideSettingsPanel":[64]}],[0,"verdocs-field-initial",{"source":[513],"sourceid":[513],"fieldname":[513],"field":[16],"disabled":[516],"initials":[513],"editable":[516],"moveable":[516],"done":[516],"xscale":[514],"yscale":[514],"pagenumber":[514],"showingProperties":[32],"focused":[32],"tempInitials":[32],"focusField":[64],"showSettingsPanel":[64],"hideSettingsPanel":[64]}],[0,"verdocs-field-signature",{"source":[513],"sourceid":[513],"fieldname":[513],"field":[16],"name":[513],"disabled":[516],"editable":[516],"moveable":[516],"done":[516],"xscale":[514],"yscale":[514],"pagenumber":[514],"showingProperties":[32],"focused":[32],"tempSignature":[32],"focusField":[64],"showSettingsPanel":[64],"hideSettingsPanel":[64]}],[0,"verdocs-field-checkbox",{"source":[513],"sourceid":[513],"fieldname":[513],"field":[16],"disabled":[516],"done":[516],"editable":[516],"moveable":[516],"xscale":[514],"yscale":[514],"pagenumber":[514],"showingProperties":[32],"focused":[32],"focusField":[64],"showSettingsPanel":[64],"hideSettingsPanel":[64]}],[0,"verdocs-field-date",{"source":[513],"sourceid":[513],"fieldname":[513],"disabled":[516],"editable":[516],"moveable":[516],"done":[516],"xscale":[514],"yscale":[514],"pagenumber":[514],"field":[16],"containerId":[32],"showingProperties":[32],"focused":[32],"focusField":[64],"showSettingsPanel":[64],"hideSettingsPanel":[64]}],[0,"verdocs-field-dropdown",{"source":[513],"sourceid":[513],"fieldname":[513],"field":[16],"disabled":[516],"editable":[516],"moveable":[516],"done":[516],"xscale":[514],"yscale":[514],"pagenumber":[514],"showingProperties":[32],"focused":[32],"focusField":[64],"showSettingsPanel":[64],"hideSettingsPanel":[64]}],[0,"verdocs-field-radio",{"source":[513],"sourceid":[513],"fieldname":[513],"field":[16],"disabled":[516],"required":[516],"done":[516],"editable":[516],"moveable":[516],"xscale":[514],"yscale":[514],"pagenumber":[514],"showingProperties":[32],"focused":[32],"focusField":[64],"showSettingsPanel":[64],"hideSettingsPanel":[64]}],[0,"verdocs-field-textarea",{"endpoint":[16],"source":[513],"sourceid":[513],"fieldname":[513],"field":[16],"disabled":[516],"editable":[516],"moveable":[516],"done":[516],"xscale":[514],"yscale":[514],"pagenumber":[514],"showingProperties":[32],"focused":[32],"focusField":[64],"showSettingsPanel":[64],"hideSettingsPanel":[64]}],[0,"verdocs-field-textbox",{"source":[513],"sourceid":[513],"fieldname":[513],"field":[16],"disabled":[516],"multiline":[516],"editable":[516],"moveable":[516],"done":[516],"xscale":[514],"yscale":[514],"pagenumber":[514],"showingProperties":[32],"focused":[32],"focusField":[64],"showSettingsPanel":[64],"hideSettingsPanel":[64]}],[0,"verdocs-field-timestamp",{"source":[513],"sourceid":[513],"fieldname":[513],"field":[16],"disabled":[516],"editable":[516],"moveable":[516],"done":[516],"xscale":[514],"yscale":[514],"pagenumber":[2],"showingProperties":[32],"focusField":[64],"showSettingsPanel":[64],"hideSettingsPanel":[64]}],[0,"verdocs-initial-dialog",{"initials":[1],"fontLoaded":[32],"enteredInitials":[32],"mode":[32]}],[0,"verdocs-signature-dialog",{"name":[1],"fontLoaded":[32],"enteredName":[32],"mode":[32]}],[0,"verdocs-upload-dialog",{"maxSize":[1026,"max-size"],"existingFile":[1032,"existing-file"],"draggingOver":[32],"confirmDelete":[32],"selectedFiles":[32],"errorMessage":[32]}]]],["p-94ffe928",[[0,"verdocs-template-fields",{"endpoint":[16],"templateId":[1537,"template-id"],"toolbarTargetId":[1,"toolbar-target-id"],"placing":[32],"showMustSelectRole":[32],"selectedRoleName":[32],"loading":[32],"template":[32]},[[4,"keydown","handleKeyDown"]],{"templateId":["onTemplateIdChanged"]}],[0,"verdocs-preview",{"endpoint":[16],"templateId":[1,"template-id"],"loading":[32],"template":[32]},null,{"templateId":["onTemplateIdChanged"]}],[0,"verdocs-send",{"endpoint":[16],"templateId":[513,"template-id"],"environment":[1],"containerId":[32],"showPickerForId":[32],"sessionContacts":[32],"sending":[32],"rolesCompleted":[32],"loading":[32],"template":[32],"reset":[64]},null,{"templateId":["onTemplateIdChanged"]}],[0,"verdocs-template-roles",{"endpoint":[16],"templateId":[1,"template-id"],"showingRoleDialog":[32],"sender":[32],"dragging":[32],"loading":[32],"template":[32]}],[0,"verdocs-template-attachments",{"endpoint":[16],"templateId":[1,"template-id"],"uploading":[32],"progressLabel":[32],"progressPercent":[32],"showDeleteError":[32],"confirmDeleteDocument":[32],"loading":[32],"template":[32]}],[0,"verdocs-template-build-tabs",{"endpoint":[16],"templateId":[1537,"template-id"],"step":[1537],"loading":[32],"template":[32]},null,{"templateId":["onTemplateIdChanged"],"step":["onStepChanged"]}]]]]'),e))));
1
+ import{p as e,b as a}from"./p-b9654a5e.js";export{s as setNonce}from"./p-b9654a5e.js";import{g as t}from"./p-e1255160.js";(()=>{const a=import.meta.url,t={};return""!==a&&(t.resourcesUrl=new URL(".",a).href),e(t)})().then((async e=>(await t(),a(JSON.parse('[["p-1eb501c3",[[0,"verdocs-build",{"endpoint":[16],"templateId":[1537,"template-id"],"step":[1537],"loading":[32],"template":[32]},null,{"templateId":["onTemplateIdChanged"],"step":["onStepChanged"]}]]],["p-6da00869",[[0,"verdocs-envelopes-list",{"endpoint":[16],"view":[1537],"status":[1537],"sort":[1537],"match":[1537],"showPagination":[4,"show-pagination"],"rowsPerPage":[2,"rows-per-page"],"selectedPage":[2,"selected-page"],"count":[32],"initiallyLoaded":[32],"loading":[32],"selectedEnvelopes":[32],"envelopes":[32]},null,{"view":["handleViewUpdated"],"status":["handleStatusUpdated"],"sort":["handleSortUpdated"],"match":["handleMatchUpdated"],"selectedPage":["handlePageUpdated"]}]]],["p-98ab739b",[[0,"verdocs-sign",{"endpoint":[1040],"envelopeId":[513,"envelope-id"],"roleId":[513,"role-id"],"inviteCode":[513,"invite-code"],"headerTargetId":[1,"header-target-id"],"roleNames":[32],"sortedRecipients":[32],"recipient":[32],"hasSignature":[32],"nextButtonLabel":[32],"nextSubmits":[32],"fatalErrorHeader":[32],"fatalErrorMessage":[32],"focusedField":[32],"submitting":[32],"submitted":[32],"isDone":[32],"showDone":[32],"showLoadError":[32],"finishLater":[32],"showFinishLater":[32],"agreed":[32],"documentsSingularPlural":[32],"kbaStep":[32],"kbaQuestions":[32],"showSpinner":[32],"kbaChoices":[32],"loading":[32],"envelope":[32]}]]],["p-4b36ca30",[[0,"verdocs-templates-list",{"endpoint":[16],"visibility":[1537],"starred":[1537],"sort":[1537],"name":[1537],"allowedActions":[1040],"showPagination":[4,"show-pagination"],"rowsPerPage":[2,"rows-per-page"],"selectedPage":[2,"selected-page"],"count":[32],"initiallyLoaded":[32],"loading":[32],"confirmDelete":[32],"templates":[32],"localNameFilter":[32]},null,{"sharing":["handleSharingUpdated"],"starred":["handleStarredUpdated"],"sort":["handleSortUpdated"],"name":["handleNameUpdated"],"selectedPage":["handlePageUpdated"]}]]],["p-b0436bc7",[[0,"verdocs-field-payment",{"source":[513],"sourceid":[513],"fieldname":[513],"field":[16],"disabled":[516],"done":[516],"editable":[516],"moveable":[516],"xscale":[514],"yscale":[514],"pagenumber":[514],"fields":[16],"pageNum":[2,"page-num"],"roleName":[1,"role-name"],"fieldId":[1,"field-id"],"recipients":[8],"selectedRoleName":[1,"selected-role-name"],"pdfPages":[16],"currentSignature":[1,"current-signature"],"currentSignatureId":[1,"current-signature-id"],"currentInitial":[1,"current-initial"],"currentInitialId":[1,"current-initial-id"],"signed":[4],"roleindex":[2],"showingProperties":[32],"focused":[32],"preparedMessage":[32],"signatureUrl":[32],"focusField":[64],"showSettingsPanel":[64],"hideSettingsPanel":[64]}]]],["p-ea75f159",[[0,"verdocs-envelope-sidebar",{"endpoint":[16],"envelopeId":[1,"envelope-id"],"activeTab":[32],"panelOpen":[32],"showRecipientDialog":[32],"showCancelDialog":[32],"remindersEnabled":[32],"updatingReminders":[32],"initialReminder":[32],"followupReminders":[32],"loading":[32],"envelope":[32]}]]],["p-92ce6180",[[0,"verdocs-template-create",{"endpoint":[16],"maxSize":[1026,"max-size"],"file":[32],"creating":[32],"progressLabel":[32],"progressPercent":[32],"errorMessage":[32]}]]],["p-e6dbb0f7",[[0,"verdocs-auth",{"endpoint":[16],"visible":[4],"logo":[1],"displayMode":[1025,"display-mode"],"org_name":[32],"first_name":[32],"last_name":[32],"email":[32],"verificationCode":[32],"newPassword":[32],"password":[32],"confirmpass":[32],"submitting":[32],"resendDisabled":[32],"session":[32],"profile":[32]}]]],["p-7688bc89",[[0,"verdocs-envelope-recipient-summary",{"endpoint":[16],"envelopeId":[1,"envelope-id"],"canSendAnother":[4,"can-send-another"],"canView":[4,"can-view"],"canDone":[4,"can-done"],"isOpen":[32],"recipientStatusIcons":[32],"containerId":[32],"gettingLinks":[32],"links":[32],"loading":[32],"envelope":[32]}]]],["p-92364765",[[4,"verdocs-dialog"]]],["p-39b72c10",[[0,"verdocs-quick-functions",{"endpoint":[16]}]]],["p-47f32221",[[0,"verdocs-radio-button",{"checked":[4],"name":[1],"value":[1],"disabled":[4]}]]],["p-5f1a000c",[[0,"verdocs-search-box",{"endpoint":[16],"placeholder":[1],"type":[1],"query":[1],"grabsFocus":[4,"grabs-focus"],"focusField":[64]}]]],["p-899fa588",[[0,"verdocs-search-tabs",{"selected":[32]}]]],["p-76cc40fe",[[0,"verdocs-table",{"columns":[16],"data":[16]}]]],["p-1e495c60",[[0,"verdocs-template-card",{"template":[16]}]]],["p-152b9acd",[[0,"verdocs-template-tags",{"tags":[16]}]]],["p-c1728f5c",[[0,"verdocs-toggle",{"options":[16],"theme":[1],"selectedOption":[32]}]]],["p-dc558be5",[[0,"verdocs-status-indicator",{"size":[1],"theme":[1],"status":[1],"envelope":[16],"isOpen":[32],"containerId":[32]}]]],["p-f6b77cd1",[[0,"verdocs-template-star",{"endpoint":[16],"template":[1040],"updating":[32]}]]],["p-2d7d0805",[[0,"verdocs-envelope-document-page",{"endpoint":[16],"envelopeId":[1,"envelope-id"],"documentId":[1,"document-id"],"pageNumber":[2,"page-number"],"virtualWidth":[2,"virtual-width"],"virtualHeight":[1026,"virtual-height"],"layers":[16],"type":[1],"containerId":[32],"renderedWidth":[32],"renderedHeight":[32],"naturalWidth":[32],"naturalHeight":[32],"aspectRatio":[32],"skipFirstNotification":[32],"pageDisplayUri":[32]}]]],["p-db4c36aa",[[0,"verdocs-help-icon",{"text":[1],"icon":[1],"containerId":[32]}],[0,"verdocs-button",{"label":[1],"startIcon":[1,"start-icon"],"endIcon":[1,"end-icon"],"size":[1],"type":[1],"variant":[1],"disabled":[4]}]]],["p-ef7813ed",[[0,"verdocs-view",{"endpoint":[16],"envelopeId":[1,"envelope-id"],"headerTargetId":[1,"header-target-id"],"canceling":[32],"showCancelDone":[32],"showLoadError":[32],"loading":[32],"envelope":[32]}],[0,"verdocs-kba-dialog",{"step":[2],"steps":[2],"helptitle":[1],"helptext":[1],"mode":[1],"label":[1],"placeholder":[1],"recipient":[16],"choices":[16],"response":[32],"updatedRecipient":[32]}]]],["p-4a960ba5",[[0,"verdocs-envelope-recipient-link",{"endpoint":[16],"envelopeId":[1,"envelope-id"],"roleName":[1,"role-name"],"isOpen":[32],"gettingLink":[32],"link":[32],"loading":[32],"envelope":[32],"recipient":[32]}],[0,"verdocs-switch",{"checked":[1028],"theme":[1],"disabled":[4]}]]],["p-35903760",[[0,"verdocs-template-role-properties",{"endpoint":[16],"templateId":[1,"template-id"],"roleName":[1,"role-name"],"dirty":[32],"saving":[32],"name":[32],"type":[32],"first_name":[32],"last_name":[32],"email":[32],"phone":[32],"delegator":[32],"loading":[32],"template":[32]}],[4,"verdocs-menu-panel",{"side":[1],"overlay":[4],"width":[2]},[[4,"click","handleClick"]]]]],["p-2f73c9de",[[4,"verdocs-button-panel",{"icon":[1],"showPanel":[64],"hidePanel":[64],"toggle":[64]}],[4,"verdocs-tabs",{"tabs":[16],"selectedTab":[2,"selected-tab"]}]]],["p-786bacad",[[0,"verdocs-pagination",{"selectedPage":[1538,"selected-page"],"itemCount":[2,"item-count"],"perPage":[2,"per-page"]}],[0,"verdocs-quick-filter",{"options":[16],"label":[1],"value":[1537],"placeholder":[1],"open":[32]}]]],["p-99b819ad",[[0,"verdocs-ok-dialog",{"heading":[1],"message":[1],"buttonLabel":[1,"button-label"],"showCancel":[4,"show-cancel"],"closed":[32]}]]],["p-91977069",[[0,"verdocs-toolbar-icon",{"text":[1],"icon":[1],"placement":[1],"containerId":[32]}],[0,"verdocs-template-document-page",{"endpoint":[16],"editable":[4],"disabled":[4],"done":[4],"templateId":[1,"template-id"],"documentId":[1,"document-id"],"pageNumber":[2,"page-number"],"virtualWidth":[2,"virtual-width"],"virtualHeight":[1026,"virtual-height"],"layers":[16],"containerId":[32],"renderedWidth":[32],"renderedHeight":[32],"naturalWidth":[32],"naturalHeight":[32],"aspectRatio":[32],"skipFirstNotification":[32],"pageDisplayUri":[32],"xScale":[32],"yScale":[32],"loading":[32],"template":[32]}]]],["p-a4b05f08",[[0,"verdocs-contact-picker",{"endpoint":[16],"templateRole":[16],"contactSuggestions":[16],"first_name":[32],"last_name":[32],"email":[32],"phone":[32],"zip":[32],"address":[32],"message":[32],"showSuggestions":[32],"showMessage":[32],"delegator":[32],"showKba":[32],"kba_method":[32],"kba_pin":[32],"nameFieldId":[32],"firstNameFieldId":[32],"lastNameFieldId":[32],"emailFieldId":[32],"phoneFieldId":[32]}],[0,"verdocs-toggle-button",{"active":[4],"icon":[1],"label":[1],"size":[1],"_active":[32]}]]],["p-af1802b6",[[0,"verdocs-file-chooser",{"endpoint":[16],"file":[32]}],[0,"verdocs-progress-bar",{"label":[1],"showPercent":[4,"show-percent"],"percent":[2]}]]],["p-be4ec401",[[0,"verdocs-spinner",{"size":[2],"mode":[1]}]]],["p-c3593d47",[[0,"verdocs-organization-card",{"organization":[16],"hovered":[32]},[[1,"mouseover","onMouseOver"],[1,"mouseout","onMouseOut"]]],[4,"verdocs-portal",{"anchor":[1],"voffset":[2]},[[11,"scroll","handleScroll"],[9,"resize","handleResize"],[4,"click","handleClick"]]]]],["p-bdd7b3d3",[[0,"verdocs-dropdown",{"options":[16],"containerId":[32],"showPicker":[32]}]]],["p-553a341c",[[0,"verdocs-template-field-properties",{"endpoint":[16],"templateId":[1,"template-id"],"fieldName":[1025,"field-name"],"helpText":[1,"help-text"],"dirty":[32],"label":[32],"type":[32],"name":[32],"required":[32],"roleName":[32],"group":[32],"fieldType":[32],"options":[32],"placeholder":[32],"defaultValue":[32],"showingHelp":[32],"loading":[32],"template":[32]}],[0,"verdocs-checkbox",{"checked":[4],"name":[1],"label":[1],"value":[1],"theme":[1],"disabled":[4]}],[0,"verdocs-select-input",{"value":[1],"label":[1],"options":[16],"disabled":[4]}],[0,"verdocs-component-error",{"message":[1]}],[0,"verdocs-loader"],[0,"verdocs-text-input",{"value":[1537],"label":[1],"placeholder":[1],"autocomplete":[1],"helpText":[1,"help-text"],"clearable":[4],"copyable":[4],"type":[1],"disabled":[4],"required":[4],"showingPw":[32]}]]],["p-7abbdb69",[[0,"verdocs-field-attachment",{"endpoint":[16],"source":[513],"sourceid":[513],"fieldname":[513],"field":[16],"disabled":[516],"editable":[516],"moveable":[516],"done":[516],"xscale":[514],"yscale":[514],"pagenumber":[514],"showingProperties":[32],"dialogOpen":[32],"selectedFile":[32],"focused":[32],"focusField":[64],"showSettingsPanel":[64],"hideSettingsPanel":[64]}],[0,"verdocs-field-initial",{"source":[513],"sourceid":[513],"fieldname":[513],"field":[16],"disabled":[516],"initials":[513],"editable":[516],"moveable":[516],"done":[516],"xscale":[514],"yscale":[514],"pagenumber":[514],"showingProperties":[32],"focused":[32],"tempInitials":[32],"focusField":[64],"showSettingsPanel":[64],"hideSettingsPanel":[64]}],[0,"verdocs-field-signature",{"source":[513],"sourceid":[513],"fieldname":[513],"field":[16],"name":[513],"disabled":[516],"editable":[516],"moveable":[516],"done":[516],"xscale":[514],"yscale":[514],"pagenumber":[514],"showingProperties":[32],"focused":[32],"tempSignature":[32],"focusField":[64],"showSettingsPanel":[64],"hideSettingsPanel":[64]}],[0,"verdocs-field-checkbox",{"source":[513],"sourceid":[513],"fieldname":[513],"field":[16],"disabled":[516],"done":[516],"editable":[516],"moveable":[516],"xscale":[514],"yscale":[514],"pagenumber":[514],"showingProperties":[32],"focused":[32],"focusField":[64],"showSettingsPanel":[64],"hideSettingsPanel":[64]}],[0,"verdocs-field-date",{"source":[513],"sourceid":[513],"fieldname":[513],"disabled":[516],"editable":[516],"moveable":[516],"done":[516],"xscale":[514],"yscale":[514],"pagenumber":[514],"field":[16],"containerId":[32],"showingProperties":[32],"focused":[32],"focusField":[64],"showSettingsPanel":[64],"hideSettingsPanel":[64]}],[0,"verdocs-field-dropdown",{"source":[513],"sourceid":[513],"fieldname":[513],"field":[16],"disabled":[516],"editable":[516],"moveable":[516],"done":[516],"xscale":[514],"yscale":[514],"pagenumber":[514],"showingProperties":[32],"focused":[32],"focusField":[64],"showSettingsPanel":[64],"hideSettingsPanel":[64]}],[0,"verdocs-field-radio",{"source":[513],"sourceid":[513],"fieldname":[513],"field":[16],"disabled":[516],"required":[516],"done":[516],"editable":[516],"moveable":[516],"xscale":[514],"yscale":[514],"pagenumber":[514],"showingProperties":[32],"focused":[32],"focusField":[64],"showSettingsPanel":[64],"hideSettingsPanel":[64]}],[0,"verdocs-field-textarea",{"endpoint":[16],"source":[513],"sourceid":[513],"fieldname":[513],"field":[16],"disabled":[516],"editable":[516],"moveable":[516],"done":[516],"xscale":[514],"yscale":[514],"pagenumber":[514],"showingProperties":[32],"focused":[32],"focusField":[64],"showSettingsPanel":[64],"hideSettingsPanel":[64]}],[0,"verdocs-field-textbox",{"source":[513],"sourceid":[513],"fieldname":[513],"field":[16],"disabled":[516],"multiline":[516],"editable":[516],"moveable":[516],"done":[516],"xscale":[514],"yscale":[514],"pagenumber":[514],"showingProperties":[32],"focused":[32],"focusField":[64],"showSettingsPanel":[64],"hideSettingsPanel":[64]}],[0,"verdocs-field-timestamp",{"source":[513],"sourceid":[513],"fieldname":[513],"field":[16],"disabled":[516],"editable":[516],"moveable":[516],"done":[516],"xscale":[514],"yscale":[514],"pagenumber":[2],"showingProperties":[32],"focusField":[64],"showSettingsPanel":[64],"hideSettingsPanel":[64]}],[0,"verdocs-initial-dialog",{"initials":[1],"fontLoaded":[32],"enteredInitials":[32],"mode":[32]}],[0,"verdocs-signature-dialog",{"name":[1],"fontLoaded":[32],"enteredName":[32],"mode":[32]}],[0,"verdocs-upload-dialog",{"maxSize":[1026,"max-size"],"existingFile":[1032,"existing-file"],"draggingOver":[32],"confirmDelete":[32],"selectedFiles":[32],"errorMessage":[32]}]]],["p-bf0b5dbc",[[0,"verdocs-template-fields",{"endpoint":[16],"templateId":[1537,"template-id"],"toolbarTargetId":[1,"toolbar-target-id"],"placing":[32],"showMustSelectRole":[32],"selectedRoleName":[32],"loading":[32],"template":[32]},[[4,"keydown","handleKeyDown"]],{"templateId":["onTemplateIdChanged"]}],[0,"verdocs-preview",{"endpoint":[16],"templateId":[1,"template-id"],"loading":[32],"template":[32]},null,{"templateId":["onTemplateIdChanged"]}],[0,"verdocs-send",{"endpoint":[16],"templateId":[513,"template-id"],"environment":[1],"containerId":[32],"showPickerForId":[32],"sessionContacts":[32],"sending":[32],"rolesCompleted":[32],"loading":[32],"template":[32],"reset":[64]},null,{"templateId":["onTemplateIdChanged"]}],[0,"verdocs-template-roles",{"endpoint":[16],"templateId":[1,"template-id"],"showingRoleDialog":[32],"sender":[32],"dragging":[32],"loading":[32],"template":[32]}],[0,"verdocs-template-attachments",{"endpoint":[16],"templateId":[1,"template-id"],"uploading":[32],"progressLabel":[32],"progressPercent":[32],"showDeleteError":[32],"confirmDeleteDocument":[32],"loading":[32],"template":[32]}],[0,"verdocs-template-build-tabs",{"endpoint":[16],"templateId":[1537,"template-id"],"step":[1537],"loading":[32],"template":[32]},null,{"templateId":["onTemplateIdChanged"],"step":["onStepChanged"]}]]]]'),e))));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@verdocs/web-sdk",
3
- "version": "5.0.11",
3
+ "version": "5.0.13",
4
4
  "private": false,
5
5
  "description": "Verdocs Web SDK",
6
6
  "license": "MIT",
@@ -1 +0,0 @@
1
- import{r as e,c as i,h as t,H as s,F as o}from"./p-b9654a5e.js";import{VerdocsEndpoint as n,startSigningSession as a,getKbaStep as l,envelopeRecipientAgree as r,envelopeRecipientDecline as d,updateEnvelopeField as c,createSignature as h,updateEnvelopeFieldSignature as p,createInitials as g,updateEnvelopeFieldInitials as u,isValidPhone as v,isValidEmail as m,sortFields as x,envelopeRecipientSubmit as b,getEnvelope as f,uploadEnvelopeFieldAttachment as y,deleteEnvelopeFieldAttachment as w,formatFullName as k,fullNameToInitials as S,submitKbaPin as N,submitKbaIdentity as I,submitKbaChallengeResponse as G,integerSequence as P}from"@verdocs/js-sdk";import{a as z,u as F,r as E,g as A}from"./p-0c45b79c.js";import{V as D}from"./p-04c07b7b.js";import{S as U}from"./p-fd97809c.js";import{S as V}from"./p-58d027d1.js";import"./p-85aa8e05.js";import"./p-c7ee88c7.js";import"./p-12bab948.js";const L=[{id:"later",label:"Finish Later"},{id:"decline",label:"Decline to Sign"},{id:"print",label:"Print Without Signing"},{id:"download",label:"Download"}],T=[{id:"print",label:"Print"},{id:"download",label:"Download"}],j=class{constructor(t){e(this,t),this.sdkError=i(this,"sdkError",7),this.envelopeLoaded=i(this,"envelopeLoaded",7),this.envelopeUpdated=i(this,"envelopeUpdated",7),this.recipientIndex=-1,this.endpoint=null,this.envelopeId=null,this.roleId=null,this.inviteCode=null,this.headerTargetId=null,this.roleNames=[],this.sortedRecipients=[],this.recipient=null,this.hasSignature=!1,this.nextButtonLabel="Start",this.nextSubmits=!1,this.fatalErrorHeader="",this.fatalErrorMessage="",this.focusedField="",this.submitting=!1,this.submitted=!1,this.isDone=!1,this.showDone=!1,this.showLoadError=!1,this.finishLater=!1,this.showFinishLater=!1,this.agreed=!1,this.documentsSingularPlural="document",this.kbaStep="",this.kbaQuestions=[],this.showSpinner=!1,this.kbaChoices=[],this.loading=!0,this.envelope=null}componentWillLoad(){this.endpoint||(console.log("[SIGN] Creating signing endpoint"),this.endpoint=new n({sessionType:"signing"}))}async componentDidLoad(){var e,i,t,s,o,n,r;if(this.envelopeId)if(this.roleId)if(this.inviteCode)try{console.log(`[SIGN] Processing invite code for ${this.envelopeId} / ${this.roleId}`);const{envelope:e,recipient:i}=await a(this.endpoint,this.envelopeId,this.roleId,this.inviteCode);console.log("[SIGN] Loaded signing session",e,i),this.recipient=i,this.envelope=e,V.updateEnvelope(this.envelopeId,e),this.sortedRecipients=[...this.envelope.recipients],this.sortedRecipients.sort(((e,i)=>e.sequence===i.sequence?e.order-i.order:e.sequence-i.sequence)),this.roleNames=this.sortedRecipients.map((e=>e.role_name)),this.envelope.documents.length>0&&(this.documentsSingularPlural="document(s)"),this.recipientIndex=this.roleNames.findIndex((e=>e==this.roleId)),this.recipientIndex>-1?(this.recipient=this.sortedRecipients[this.recipientIndex],this.agreed=this.recipient.agreed):console.warn("[SIGN] Could not find our recipient record",this.roleId,this.sortedRecipients),this.submitted="submitted"===this.recipient.status,this.isDone=this.submitted,this.showDone=this.submitted,"canceled"===this.envelope.status?(this.fatalErrorHeader="Unable to Start Signing Session",this.fatalErrorMessage="This envelope has been canceled. Please contact its sender for more information."):"declined"===this.recipient.status?(this.fatalErrorHeader="Unable to Start Signing Session",this.fatalErrorMessage="You have declined to sign this envelope."):this.agreed&&(this.nextButtonLabel="Next"),this.checkRecipientFields(),null===(s=this.envelopeLoaded)||void 0===s||s.emit({endpoint:this.endpoint,envelope:this.envelope}),this.isDone||l(this.endpoint,this.envelopeId,this.roleId).then((e=>{var i;console.log("[SIGN] KBA Step",e),this.kbaStep=e.kba_step,"failed"===this.kbaStep?(this.fatalErrorHeader="Identity Verification Failed",this.fatalErrorMessage="We were unable to verify your identity. Please contact the document's sender.",this.isDone=!0):(this.kbaQuestions=(null===(i=e.questions)||void 0===i?void 0:i.question)||[],this.kbaChoices=[])})).catch((e=>console.log("Error getting KBA step",e)))}catch(e){console.log("[SIGN] Error with signing session",e),null===(o=this.sdkError)||void 0===o||o.emit(new U(e.message,null===(n=e.response)||void 0===n?void 0:n.status,null===(r=e.response)||void 0===r?void 0:r.data)),this.showLoadError=!0}else null===(t=this.sdkError)||void 0===t||t.emit(new U("[SIGN] Missing required inviteCode",500,""));else null===(i=this.sdkError)||void 0===i||i.emit(new U("[SIGN] Missing required roleId",500,""));else null===(e=this.sdkError)||void 0===e||e.emit(new U("[SIGN] Missing required envelopId",500,""))}componentDidRender(){const e=this.headerTargetId?document.getElementById(this.headerTargetId):null,i=document.getElementById("verdocs-sign-header");e&&i&&(console.log("[SIGN] Moving header"),i.remove(),e.append(i))}handleClickAgree(){this.submitting=!0,r(this.endpoint,this.envelopeId,this.roleId,!0).then((()=>{var e;this.nextButtonLabel="Next",this.recipient.agreed=!0,this.submitting=!1,this.agreed=!0,null===(e=this.envelopeUpdated)||void 0===e||e.emit({endpoint:this.endpoint,envelope:this.envelope,event:"agreed"})})).catch((e=>{var i,t,s;console.log("[SIGN] Update failure",e),this.submitting=!1,null===(i=this.sdkError)||void 0===i||i.emit(new U(e.message,null===(t=e.response)||void 0===t?void 0:t.status,null===(s=e.response)||void 0===s?void 0:s.data))}))}async handleOptionSelected(e){var i,t,s,o,n;switch(e.detail.id){case"later":this.finishLater=!0,this.showFinishLater=!0,null===(i=this.envelopeUpdated)||void 0===i||i.emit({endpoint:this.endpoint,envelope:this.envelope,event:"later"});break;case"claim":D("This feature will be available in an upcoming release."),null===(t=this.envelopeUpdated)||void 0===t||t.emit({endpoint:this.endpoint,envelope:this.envelope,event:"claimed"});break;case"decline":{this.submitting=!0;const e=await d(this.endpoint,this.envelopeId,this.roleId);console.log("[SIGN] Decline result",e),null===(s=this.envelopeUpdated)||void 0===s||s.emit({endpoint:this.endpoint,envelope:this.envelope,event:"declined"}),this.submitting=!1,this.fatalErrorHeader="Unable to Start Signing Session",this.fatalErrorMessage="You have declined to sign this envelope."}break;case"print":window.print(),null===(o=this.envelopeUpdated)||void 0===o||o.emit({endpoint:this.endpoint,envelope:this.envelope,event:"printed"});break;case"download":{const e=this.envelope.documents.find((e=>"attachment"===e.type));e&&(z(this.endpoint,this.envelope,e.id).catch((e=>{console.log("[SIGN] Error downloading PDF",e)})),null===(n=this.envelopeUpdated)||void 0===n||n.emit({endpoint:this.endpoint,envelope:this.envelope,event:"downloaded"}))}}}updateRecipientFieldValue(e,i){console.log("[SIGN] updateRecipientFieldValue",e),this.getRecipientFields().forEach((t=>{t.name===e&&(t.value=i.value,t.settings=i.settings,F(t),this.checkRecipientFields())}))}saveFieldChange(e,i){console.log("[SIGN] updateRecipientFieldValue",e),c(this.endpoint,this.envelopeId,e,i).then((i=>this.updateRecipientFieldValue(e,i))).catch((e=>{var i,t,s,o,n,a;401===(null===(i=e.response)||void 0===i?void 0:i.status)&&"jwt expired"===(null===(s=null===(t=e.response)||void 0===t?void 0:t.data)||void 0===s?void 0:s.error)?(console.log("[SIGN] Signing session expired"),this.fatalErrorHeader="Signing Session Expired",this.fatalErrorMessage="Please reload your browser to continue."):console.log("[SIGN] Server error",e),null===(o=this.sdkError)||void 0===o||o.emit(new U(e.message,null===(n=e.response)||void 0===n?void 0:n.status,null===(a=e.response)||void 0===a?void 0:a.data))}))}async handleFieldChange(e,i){const{value:t,checked:s}=i.target;switch(e.type){case"textarea":case"textbox":return this.saveFieldChange(e.name,{prepared:!1,value:t});case"checkbox":case"radio":return this.saveFieldChange(e.name,{prepared:!1,value:String(i.target.checked)});case"dropdown":return console.log("Saving dropdown",e.name,i.detail),this.saveFieldChange(e.name,{prepared:!1,value:i.detail});case"initial":if(!i.detail)return;this.showSpinner=!0;const o=await(await fetch(i.detail)).blob();return g(this.endpoint,"initial",o).then((async i=>{const t=await u(this.endpoint,this.envelopeId,e.name,i.id);this.updateRecipientFieldValue(e.name,t),this.showSpinner=!1})).catch((e=>{console.log("Error updating initials",e),this.showSpinner=!1}));case"signature":if(!i.detail)return;this.showSpinner=!0;const n=await(await fetch(i.detail)).blob();return h(this.endpoint,"signature",n).then((async i=>{console.log("Signature update result",i);const t=await p(this.endpoint,this.envelopeId,e.name,i.id);this.updateRecipientFieldValue(e.name,t),this.showSpinner=!1})).catch((e=>{console.warn("[SIGN] Error updating signature",e),this.showSpinner=!1}));case"date":const{formattedDate:a}=i.detail;if(a)return this.saveFieldChange(e.name,{prepared:!1,value:a});break;case"timestamp":console.log("[SIGN] Updating timestamp",{value:t,ts:i.target.getAttribute("timestamp")});break;default:console.log("[SIGN] Unhandled field update",{value:t,checked:s},e)}}isFieldFilled(e){const{value:i=""}=e;switch(e.type){case"textarea":case"textbox":switch(e.validator||""){case"email":return m(i);case"phone":return v(i);default:return""!==(i||"").trim()}case"signature":return"signed"===i;case"initial":return"initialed"===i;case"timestamp":return!0;case"date":return!!i;case"attachment":return"attached"===i;case"dropdown":return""!==i;case"checkbox":return"true"===i;case"radio":return e.group?this.getRecipientFields().filter((i=>i.group===e.group)).some((e=>"true"===e.value)):"true"===e.value;default:return!1}}isFieldValid(e){return!e.required||this.isFieldFilled(e)}getSortedFillableFields(){const e=this.getRecipientFields().filter((e=>"timestamp"!==e.type));return x(e),e}async handleNext(){var e;if(this.nextSubmits){try{null===(e=document.getElementById("air-datepicker-global-container"))||void 0===e||e.remove(),this.submitting=!0;const i=await b(this.endpoint,this.envelopeId,this.roleId);console.log("[SIGN] Submitted successfully",i),this.recipient.status="submitted",this.showDone=!0,console.log("[SIGN] Reloading envelope"),f(this.endpoint,this.envelopeId).then((e=>{this.envelope=e,this.submitting=!1})).catch((e=>{console.log("[SIGN] Error reloading envelope",e),this.submitting=!1}))}catch(e){console.log("[SIGN] Error submitting",e)}return}const i=this.getSortedFillableFields().filter((e=>e.required&&!this.isFieldFilled(e)));x(i);let t=i.findIndex((e=>e.name===this.focusedField))+1;t>=i.length&&(t=0);let s=i[t],o=0;if(o<i.length&&["signature","initial"].includes(s.type)&&["initialed","signed"].includes(s.value)&&(o++,t++,t>=i.length&&(t=0),s=i[t]),o>=i.length&&(s=null),s){const e=A(s),i=document.getElementById(e);null==i||i.scrollIntoView({behavior:"smooth"}),null==i||i.focusField(),this.focusedField=s.name}}getRecipientFields(){return this.envelope.fields.filter((e=>e.role_name===this.recipient.role_name))}checkRecipientFields(){const e=this.getRecipientFields().filter((e=>!this.isFieldValid(e)));e.length<1?(this.nextButtonLabel="Finish",this.nextSubmits||(this.nextSubmits=!0)):(console.log("[SIGN] Invalid fields remaining",e.map((e=>e.name))),this.nextButtonLabel="Next",this.nextSubmits=!1)}attachFieldAttributes(e,i,t){if("1"===t.getAttribute("attached"))return;t.setAttribute("attached","1"),t.addEventListener("input",(e=>{"radio"===e.target.type||"checkbox"===e.target.type?this.handleFieldChange(i,e).finally((()=>this.checkRecipientFields())):this.checkRecipientFields()})),t.addEventListener("attached",(async t=>{console.log("[SIGN] onAttached",t.detail,t.target.value),this.showSpinner=!0;try{const s=await y(this.endpoint,this.envelopeId,i.name,t.detail);this.updateRecipientFieldValue(i.name,s),this.checkRecipientFields();const o=E("envelope",i,e,{disabled:!1,editable:!1,draggable:!1,done:this.isDone});this.attachFieldAttributes(e,i,o),this.showSpinner=!1}catch(t){console.log("Error uploading attachment",t),D("Unable to upload attachment, please try again later",{style:"error"}),this.showSpinner=!1}})),t.addEventListener("deleted",(async t=>{console.log("[SIGN] onDeleted",t.detail,t.target.value),this.showSpinner=!0;try{const t=await w(this.endpoint,this.envelopeId,i.name);console.log("[SIGN] Deleted attachment",t),this.updateRecipientFieldValue(i.name,t),this.checkRecipientFields();const s=E("envelope",i,e,{disabled:!1,editable:!1,draggable:!1,done:this.isDone});this.attachFieldAttributes(e,i,s),this.showSpinner=!1}catch(t){console.log("Error uploading attachment",t),D("Unable to upload attachment, please try again later",{style:"error"}),this.showSpinner=!1}})),t.addEventListener("focusout",(e=>{"dropdown"!==i.type&&"attachment"!==i.type&&this.handleFieldChange(i,e).finally((()=>this.checkRecipientFields()))})),t.addEventListener("fieldChange",(e=>{this.handleFieldChange(i,e).finally((()=>this.checkRecipientFields()))})),t.setAttribute("templateid",this.envelope.template_id),t.setAttribute("fieldname",i.name),t.setAttribute("page",e.pageNumber),t.setAttribute("xScale",e.xScale),t.setAttribute("yScale",e.yScale);const s=k(this.recipient);t.setAttribute("initials",S(s)),t.setAttribute("name",s)}handlePageRendered(e){const i=e.detail,t=this.getSortedFillableFields();console.log("[SIGN] Rendering fields for page",i.pageNumber,t),t.forEach(((e,t)=>{if(e.page!==i.pageNumber)return;const s=E("envelope",e,i,{disabled:!1,editable:!1,draggable:!1,done:this.isDone},t);s&&(Array.isArray(s)?s.map((t=>this.attachFieldAttributes(i,e,t))):this.attachFieldAttributes(i,e,s))})),this.sortedRecipients.filter((e=>e.role_name!==this.recipient.role_name&&("invited"===e.status||"opened"===e.status||"pending"===e.status))).forEach((()=>{this.getRecipientFields().filter((e=>e.page===i.pageNumber)).forEach((e=>{const t=E("envelope",e,i,{disabled:!0,editable:!1,draggable:!1,done:this.isDone});t&&(Array.isArray(t)?t.map((t=>this.attachFieldAttributes(i,e,t))):this.attachFieldAttributes(i,e,t))}))})),this.checkRecipientFields()}render(){if(this.showLoadError)return t(s,null,t("verdocs-ok-dialog",{heading:"Unable to Start Signing",message:"Sorry, your invite code is invalid or has expired. Please check your email for an updated invitation, or contact the sender.",buttonLabel:"OK",onNext:()=>{window.location.reload()}}));if(!this.envelope)return t(s,null,t("verdocs-loader",null));if(this.fatalErrorMessage)return t(s,{class:{agreed:this.agreed}},t("div",{class:"fatal-error"},t("img",{src:"https://public-assets.verdocs.com/loading-placeholder.png",class:"placeholder",alt:"Placeholder page"}),t("div",{class:"message"},t("div",{class:"header"},this.fatalErrorHeader),t("p",null,this.fatalErrorMessage))));if(this.isDone)return t(s,{class:{agreed:this.agreed}},t("verdocs-view",{endpoint:this.endpoint,envelopeId:this.envelopeId,onSdkError:e=>{var i;return null===(i=this.sdkError)||void 0===i?void 0:i.emit(e.detail)}}),this.showDone&&t("verdocs-ok-dialog",{heading:"You're Done!",message:`You can access the ${this.documentsSingularPlural} at any time by clicking on the link from the invitation email.<br /><br />After all recipients have completed their actions, you will receive an email with the document and envelope certificate attached.`,onNext:e=>{e.preventDefault(),e.stopPropagation(),this.showDone=!1,this.isDone=!0}}),this.submitting&&t("div",{class:"loading-indicator"},t("verdocs-loader",null)));if(!this.agreed)return t(s,{class:"agreed"},t("div",{id:"verdocs-sign-header"},t("div",{class:"inner"},t("img",{src:"https://verdocs.com/assets/white-logo.svg",alt:"Verdocs Logo",class:"logo"}),t("div",{class:"title"},this.envelope.name))),t("div",{class:"document",style:{paddingTop:"15px"}},t("img",{src:"https://public-assets.verdocs.com/loading-placeholder.png",style:{width:"612px",height:"792px",boxShadow:"0 0 10px 5px #0000000f",marginTop:"15px"},alt:"Placeholder page"})),t("div",{class:"cover"},t("div",{class:"agree"},t("verdocs-checkbox",{name:"agree",label:"By checking this box, you:",onInput:()=>this.handleClickAgree()}),t("ul",null,t("li",null,"Agree to use electronic records and signatures, and confirm you have read the"," ",t("a",{href:"https://verdocs.com/en/electronic-record-signature-disclosure/",target:"_blank"},"Electronic Record and Signatures Disclosure"),"."),t("li",null,"Agree to Verdocs'"," ",t("a",{href:"https://verdocs.com/en/eula",target:"_blank"},"End User License Agreement")," ","and confirm you have read Verdocs'"," ",t("a",{href:"https://verdocs.com/en/privacy-policy/",target:"_blank"},"Privacy Policy"),".")))));if("pin"===this.kbaStep)return t(s,{class:"kba"},t("div",{id:"verdocs-sign-header"},t("div",{class:"inner"},t("img",{src:"https://verdocs.com/assets/white-logo.svg",alt:"Verdocs Logo",class:"logo"}),t("div",{class:"title"},this.envelope.name))),t("div",{class:"document",style:{paddingTop:"15px"}},t("img",{src:"https://public-assets.verdocs.com/loading-placeholder.png",style:{width:"612px",height:"792px",boxShadow:"0 0 10px 5px #0000000f",marginTop:"15px"},alt:"Placeholder page"})),t("div",{class:"cover"},t("div",{class:"kba"},t("verdocs-kba-dialog",{mode:"text",step:1,steps:1,helptitle:"Document is protected by a PIN code",helptext:"Please enter your PIN code to proceed. If you do not have one, please contact the sender.",label:"PIN Code",onNext:async e=>{N(this.endpoint,this.envelopeId,this.roleId,e.detail).then((e=>{console.log("[SIGN] PIN code submission result",e),"complete"===e.kba_step&&(this.kbaStep="")})).catch((e=>{var i,t;console.log("[SIGN] Error submitting PIN",e),D((null===(t=null===(i=e.response)||void 0===i?void 0:i.data)||void 0===t?void 0:t.error)||"Unable to verify PIN code. Please try again.",{style:"error"})}))}}))));if("identity"===this.kbaStep)return t(s,{class:"kba"},t("div",{id:"verdocs-sign-header"},t("div",{class:"inner"},t("img",{src:"https://verdocs.com/assets/white-logo.svg",alt:"Verdocs Logo",class:"logo"}),t("div",{class:"title"},this.envelope.name))),t("div",{class:"document",style:{paddingTop:"15px"}},t("img",{src:"https://public-assets.verdocs.com/loading-placeholder.png",style:{width:"612px",height:"792px",boxShadow:"0 0 10px 5px #0000000f",marginTop:"15px"},alt:"Placeholder page"})),t("div",{class:"cover"},t("div",{class:"kba"},t("verdocs-kba-dialog",{mode:"identity",helptitle:"Document requires identity verification",helptext:"Please complete your contact details to proceed.",recipient:this.recipient,onNext:async e=>{const i=e.detail;I(this.endpoint,this.envelopeId,this.roleId,{firstName:i.first_name,lastName:i.last_name,address:i.address,city:i.city,state:i.state,zip:i.zip,ssnLast4:i.ssn_last_4}).then((e=>{console.log("[SIGN] Identity submission result",e),this.kbaStep=e.kba_step})).catch((e=>{var i,t;console.log("[SIGN] Error submitting identity",e),D((null===(t=null===(i=e.response)||void 0===i?void 0:i.data)||void 0===t?void 0:t.error)||"Unable to verify identity.",{style:"error"})}))}}))));if("challenge"===this.kbaStep){const e=this.kbaChoices.length,i=this.kbaQuestions[e];return console.log("Showing KBA question",{questionNumber:e,kbaQuestion:i},this.kbaChoices),t(s,{class:"kba"},t("div",{id:"verdocs-sign-header"},t("div",{class:"inner"},t("img",{src:"https://verdocs.com/assets/white-logo.svg",alt:"Verdocs Logo",class:"logo"}),t("div",{class:"title"},this.envelope.name))),t("div",{class:"document",style:{paddingTop:"15px"}},t("img",{src:"https://public-assets.verdocs.com/loading-placeholder.png",style:{width:"612px",height:"792px",boxShadow:"0 0 10px 5px #0000000f",marginTop:"15px"},alt:"Placeholder page"})),t("div",{class:"cover"},t("div",{class:"kba"},this.kbaChoices.length>=this.kbaQuestions.length?t("verdocs-spinner",null):t("verdocs-kba-dialog",{mode:"choice",helptitle:"Your identity requires additional verification",helptext:(null==i?void 0:i.prompt)||"Please select one of the options below.",choices:(null==i?void 0:i.answer)||["Skip Question"],step:e+1,steps:this.kbaQuestions.length,onNext:async e=>{var i,t,s;if(this.kbaChoices=[...this.kbaChoices,e.detail],this.kbaChoices.length>=this.kbaQuestions.length){const o=this.kbaQuestions.map(((e,i)=>({type:e.type,answer:this.kbaChoices[i]})));console.log("Submitting KBA responses",this.kbaChoices,o);try{const e=await G(this.endpoint,this.envelopeId,this.roleId,o);console.log("KBA challenge response",e),this.kbaStep=e.kba_step,"failed"===this.kbaStep?(this.fatalErrorHeader="Identity Verification Failed",this.fatalErrorMessage="We were unable to verify your identity. Please contact the document's sender.",this.isDone=!0):(this.kbaQuestions=(null===(i=e.questions)||void 0===i?void 0:i.question)||[],this.kbaChoices=[])}catch(e){console.log("Error submitting KBA challenge",e),this.kbaStep="",this.fatalErrorHeader="Unable to Verify Identity",this.fatalErrorMessage=(null===(s=null===(t=e.response)||void 0===t?void 0:t.data)||void 0===s?void 0:s.error)||"Please try again later.",this.isDone=!0}}}}))))}return t(s,null,t("div",{id:"verdocs-sign-header"},t("div",{class:"inner"},t("img",{src:"https://verdocs.com/assets/white-logo.svg",alt:"Verdocs Logo",class:"logo"}),t("div",{class:"title"},this.envelope.name),t("div",{style:{flex:"1"}}),!this.finishLater&&t("verdocs-button",{size:"xsmall",label:this.nextButtonLabel,disabled:!this.agreed,onClick:()=>this.handleNext()}),t("div",{style:{marginLeft:"10px"}}),t("verdocs-dropdown",{options:this.isDone||this.finishLater?T:L,onOptionSelected:e=>this.handleOptionSelected(e)}))),t("div",{class:"document",style:{paddingTop:"15px"}},(this.envelope.documents||[]).map((e=>{const i=P(1,e.pages);return t(o,null,i.map((i=>{var s;const o=(null===(s=e.page_sizes)||void 0===s?void 0:s[i])||{width:612,height:792};return t("verdocs-envelope-document-page",{envelopeId:this.envelopeId,documentId:e.id,endpoint:this.endpoint,virtualWidth:o.width,virtualHeight:o.height,pageNumber:i,onPageRendered:e=>this.handlePageRendered(e),type:"filled",layers:[{name:"page",type:"canvas"},{name:"controls",type:"div"}]})})))}))),this.showFinishLater&&t("verdocs-ok-dialog",{heading:"You've saved your document to finish later.",message:`To complete the ${this.documentsSingularPlural}, use the link in the original email notification inviting you to review and finish the document.`,onNext:()=>this.showFinishLater=!1}),this.showDone&&t("verdocs-ok-dialog",{heading:"You're Done!",message:`You can access the ${this.documentsSingularPlural} at any time by clicking on the link from the invitation email.<br /><br />After all recipients have completed their actions, you will receive an email with the document and envelope certificate attached.`,onNext:()=>{this.showDone=!1,this.isDone=!0}}),this.submitting||this.showSpinner&&t("verdocs-portal",null,t("div",{class:"spinner-overlay"},t("verdocs-spinner",null))))}};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-sign{display:-ms-flexbox;display:flex;overflow:hidden;position:relative;min-height:600px;-ms-flex-direction:column;flex-direction:column;-webkit-box-sizing:border-box;box-sizing:border-box;font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-sign div{display:block;-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-sign input{vertical-align:top}verdocs-sign>.document{-ms-flex:1;flex:1;width:100%;height:100%;-ms-flex-item-align:center;align-self:center;display:-ms-flexbox;display:flex;padding:15px;row-gap:15px;max-width:1200px;min-height:200px;position:relative;overflow-y:scroll;-ms-flex-align:center;align-items:center;-webkit-box-sizing:border-box;box-sizing:border-box;-ms-flex-direction:column;flex-direction:column}verdocs-sign>.document .inner{width:100%;max-width:1028px}verdocs-sign .cover{top:0;left:0;right:0;bottom:0;display:-ms-flexbox;display:flex;z-index:5000;position:absolute;padding-top:100px;-ms-flex-align:center;align-items:center;-ms-flex-direction:column;flex-direction:column;background:rgba(0, 0, 0, 0.5)}verdocs-sign .agree{-ms-flex:0;flex:0;width:600px;display:-ms-flexbox;display:flex;max-width:90%;padding:30px 15px;-ms-flex-direction:column;flex-direction:column;background-color:#ffffff}verdocs-sign .agree .header{-ms-flex:0 0 56px;flex:0 0 56px}verdocs-sign .agree li{margin:0.5em 0}verdocs-sign verdocs-ok-dialog .background-overlay{-ms-flex-align:start;align-items:flex-start;padding-top:100px}verdocs-sign .loading-indicator{top:0;left:0;right:0;bottom:0;display:-ms-flexbox;display:flex;z-index:10000;position:fixed;background-color:rgba(0, 0, 0, 0.7)}verdocs-sign .fatal-error{position:absolute;z-index:100;top:0;left:0;right:0;bottom:0;background-color:#4a4a4a;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}verdocs-sign .fatal-error .placeholder{position:absolute;opacity:0.1;z-index:-1;top:0;left:0;right:0;bottom:0;width:612px;height:792px;-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);margin-top:15px}verdocs-sign .fatal-error .message{width:50%;font-size:16px;background:white;border-radius:5px;-webkit-box-shadow:3px 3px 9px -1px rgba(0, 0, 0, 0.2470588235);box-shadow:3px 3px 9px -1px rgba(0, 0, 0, 0.2470588235)}verdocs-sign .fatal-error .header{color:white;font-size:18px;font-weight:500;padding:5px 10px;margin:0 0 10px 0;background:#654dcb}verdocs-sign .fatal-error p{margin:1rem;font-size:14px;font-weight:400}@media print{verdocs-sign .header{display:none}}#verdocs-sign-header{color:#fff;width:100%;display:-ms-flexbox;display:flex;z-index:1000;-ms-flex:0 0 46px;flex:0 0 46px;font-size:12px;-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;-webkit-transition:all 0.25s;transition:all 0.25s;background-color:#33354c;-webkit-box-shadow:0 4px 4px 0 rgba(0, 0, 0, 0.24), 0 0 4px 0 rgba(0, 0, 0, 0.12);box-shadow:0 4px 4px 0 rgba(0, 0, 0, 0.24), 0 0 4px 0 rgba(0, 0, 0, 0.12)}#verdocs-sign-header .inner{width:100%;display:-ms-flexbox;display:flex;margin:0 auto;padding:0 12px;max-width:1200px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row}#verdocs-sign-header .logo{width:80px;display:none;margin:-6px 0 0 0}#verdocs-sign-header .title{font-size:18px;font-weight:500;overflow:hidden;white-space:nowrap;padding:0 10px 0 0;text-overflow:ellipsis}.spinner-overlay{position:fixed;top:0;left:0;right:0;bottom:0;z-index:1000;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;background:rgba(0, 0, 0, 0.4980392157);-ms-flex-pack:center;justify-content:center}';export{j as verdocs_sign}
@@ -1,8 +0,0 @@
1
- import{r as e,c as t,h as i,H as o,F as s,g as n}from"./p-b9654a5e.js";import{VerdocsEndpoint as l,getTemplate as r,integerSequence as a,getOrganizationContacts as d,isValidEmail as c,createEnvelope as h,getRGBA as u,formatFullName as p,createTemplateDocument as v,deleteTemplateDocument as m,updateField as f,createField as g,updateTemplateRole as b,createTemplateRole as x}from"@verdocs/js-sdk";import{S as w}from"./p-fd97809c.js";import{S as y}from"./p-58d027d1.js";import{V as k}from"./p-04c07b7b.js";import{D as E,P as S,J as q,a as C,F as M,b as T,T as I}from"./p-b0766439.js";import{f as L}from"./p-12bab948.js";import{i as H}from"./p-a901dff2.js";import{b as Z,c as D,d as z,g as O,e as _,f as N}from"./p-0c45b79c.js";import"./p-85aa8e05.js";import"./p-c7ee88c7.js";const V=class{constructor(i){e(this,i),this.sdkError=t(this,"sdkError",7),this.templateListenerId=null,this.endpoint=l.getDefault(),this.templateId=null,this.loading=!0,this.template=null}disconnectedCallback(){this.unlistenToTemplate()}async listenToTemplate(){this.unlistenToTemplate(),y.subscribe("templates",this.templateId,(()=>r(this.endpoint,this.templateId)),!1,(e=>{this.template=e,this.loading=!1}))}unlistenToTemplate(){this.templateListenerId&&(y.store.delListener(this.templateListenerId),this.templateListenerId=null)}onTemplateIdChanged(e){console.log("[PREVIEW] Template ID changed",e),this.listenToTemplate()}async componentWillLoad(){var e,t,i;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(o){console.log("[PREVIEW] Error with preview session",o),null===(e=this.sdkError)||void 0===e||e.emit(new w(o.message,null===(t=o.response)||void 0===t?void 0:t.status,null===(i=o.response)||void 0===i?void 0:i.data))}}handlePageRendered(e){}render(){var e;return i(o,null,this.loading?i("verdocs-loader",null):((null===(e=this.template)||void 0===e?void 0:e.documents)||[]).map((e=>{const t=a(1,e.pages);return i(s,null,t.map((t=>{var o;const s=(null===(o=e.page_sizes)||void 0===o?void 0:o[t])||{width:612,height:792};return i("verdocs-template-document-page",{templateId:e.template_id,documentId:e.id,pageNumber:t,disabled:!0,editable:!1,done:!1,virtualWidth:s.width,virtualHeight:s.height,onPageRendered:e=>this.handlePageRendered(e),layers:[{name:"page",type:"canvas"},{name:"controls",type:"div"}]})})))})))}static get watchers(){return{templateId:["onTemplateIdChanged"]}}};V.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)),R='<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>',j=class{constructor(i){e(this,i),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=l.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(),y.subscribe("templates",this.templateId,(()=>r(this.endpoint,this.templateId)),!1,(e=>{this.template=e,this.loading=!1,this.rolesCompleted={}}))}unlistenToTemplate(){this.templateListenerId&&(y.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,i;try{if(this.endpoint.onSessionChanged(((e,t,i)=>{if(!i)return;const o={id:i.id,first_name:i.first_name,last_name:i.last_name,email:i.email,phone:i.phone};i&&(this.sessionContacts=[o],d(this.endpoint).then((e=>{console.log("[SEND] Got contacts",e),this.sessionContacts=[...e,o]})).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(o){console.log("[SEND] Error with send session",o),null===(e=this.sdkError)||void 0===e||e.emit(new w(o.message,null===(t=o.response)||void 0===t?void 0:t.status,null===(i=o.response)||void 0===i?void 0:i.data))}}recomputeRolesCompleted(){var e;this.rolesCompleted={};const t={};((null===(e=this.template)||void 0===e?void 0:e.roles)||[]).forEach((e=>{const i=e.sequence-1;t[i]||(t[i]=[]);const o=`r-${i}-${t[i].length}`;t[i].push({...e,id:o,role_name:e.name,first_name:e.first_name,last_name:e.last_name}),e.first_name&&c(e.email)&&(this.rolesCompleted[o]={...e,id:o,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;const i=((null===(t=this.template)||void 0===t?void 0:t.roles)||[]).filter((t=>t.sequence-1===e)).map(((t,i)=>({...t,id:`r-${e}-${i}`,role_name:t.name,first_name:"",last_name:""})));return i}getLevelIcon(e){const t=this.getLevels();return i("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,i;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 o={template_id:this.templateId,name:(null===(i=this.template)||void 0===i?void 0:i.name)||"New Envelope",environment:this.environment,initial_reminder:0,followup_reminders:0,recipients:Object.values(this.rolesCompleted),fields:[]};console.log("[SEND] Creating envelope",o),h(this.endpoint,o).then((e=>{var t,i;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===(i=this.send)||void 0===i||i.emit({...o,name:o.name,envelope_id:e.id,envelope:e})})).catch((e=>{var t,i,o;console.log("Send error",e),k((null===(i=null===(t=e.response)||void 0===t?void 0:t.data)||void 0===i?void 0:i.error)||"Error creating envelope, please try again later."),this.sending=!1,null===(o=this.sendingEnvelope)||void 0===o||o.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 i(o,null,i("verdocs-loader",null));if(!this.endpoint.session)return i(o,{style:{display:"flex"}},i("verdocs-component-error",{message:"You must be authenticated to use this module."}));const t=this.getLevels(),s=Object.values(this.rolesCompleted).filter((e=>c(e.email))).length>=A(this.template).length;return i(o,{class:{sendable:null===(e=this.template)||void 0===e?void 0:e.is_sendable}},i("div",{class:"recipients"},i("div",{class:"left-line"}),i("div",{class:"level level-start"},this.getLevelIcon(-1),i("div",{class:"complete"},"Send Envelope")),t.map((e=>i("div",{class:`level level-${e}`},this.getLevelIcon(e),this.getRolesAtLevel(e).map((e=>{var t,o,s,n;const l=!e.email,r=`verdocs-send-recipient-${e.role_name}`,a=(d=e.role_name,Math.max(A(this.template).findIndex((e=>e===d)),0));var d;const c=u(a);return l?i("div",{class:"recipient","data-ri":a,"data-rn":e.role_name,style:{backgroundColor:c},onClick:t=>this.handleClickRole(t,e),id:r},(null===(t=this.rolesCompleted[e.id])||void 0===t?void 0:t.first_name)?p(this.rolesCompleted[e.id]):e.role_name,i("div",{class:"icon",innerHTML:R}),this.showPickerForId===e.id&&i("verdocs-portal",{anchor:r,onClickAway:()=>this.showPickerForId=""},i("verdocs-contact-picker",{onExit:()=>this.showPickerForId="",onNext:t=>this.handleSelectContact(t,e),contactSuggestions:this.sessionContacts,templateRole:null!==(o=this.rolesCompleted[e.id])&&void 0!==o?o:e,onSearchContacts:e=>{var t;return null===(t=this.searchContacts)||void 0===t?void 0:t.emit(e.detail)}}))):i("div",{class:"recipient",style:{borderColor:c},onClick:t=>this.handleClickRole(t,e),id:r},(null===(s=this.rolesCompleted[e.id])||void 0===s?void 0:s.first_name)?p(this.rolesCompleted[e.id]):e.role_name,i("div",{class:"icon",innerHTML:R}),this.showPickerForId===e.id&&i("verdocs-portal",{anchor:r,onClickAway:()=>this.showPickerForId=""},i("verdocs-contact-picker",{onExit:()=>this.showPickerForId="",onNext:t=>this.handleSelectContact(t,e),contactSuggestions:this.sessionContacts,templateRole:null!==(n=this.rolesCompleted[e.id])&&void 0!==n?n:e,onSearchContacts:e=>{var t;return null===(t=this.searchContacts)||void 0===t?void 0:t.emit(e.detail)}})))}))))),i("div",{class:"level level-done"},this.getLevelIcon(t.length),i("div",{class:"complete"},"Signing Complete"))),i("div",{class:"buttons"},i("verdocs-button",{label:"Cancel",size:"small",variant:"outline",onClick:e=>this.handleCancel(e),disabled:this.sending}),i("verdocs-button",{label:"Send",size:"small",disabled:!s||this.sending,onClick:e=>this.handleSend(e)}),this.sending&&i("verdocs-spinner",null)))}static get watchers(){return{templateId:["onTemplateIdChanged"]}}};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-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 U=class{constructor(i){e(this,i),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=l.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,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(o){console.log("[TEMPLATE ATTACHMENTS] Error loading template",o),null===(e=this.sdkError)||void 0===e||e.emit(new w(o.message,null===(t=o.response)||void 0===t?void 0:t.status,null===(i=o.response)||void 0===i?void 0:i.data))}}disconnectedCallback(){this.unlistenToTemplate()}async listenToTemplate(){this.unlistenToTemplate(),y.subscribe("templates",this.templateId,(()=>r(this.endpoint,this.templateId)),!1,(e=>{this.template=e,this.loading=!1}))}unlistenToTemplate(){this.templateListenerId&&(y.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,i,o,s;e.stopPropagation();const n=e.detail.file;if(n){console.log("[ATTACHMENTS] Uploading...",n),this.uploading=!0,this.progressLabel="Uploading...";try{const e=await v(this.endpoint,this.templateId,n,this.handleUploadProgress.bind(this));console.log("[ATTACHMENTS] Created attachment",e),this.template=await y.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===(i=this.sdkError)||void 0===i||i.emit(new w(e.message,null===(o=e.response)||void 0===o?void 0:o.status,null===(s=e.response)||void 0===s?void 0:s.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 m(this.endpoint,this.templateId,this.confirmDeleteDocument.id),this.template=await y.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 C;case"image/jpeg":return q;case"image/png":return S;case"application/msword":case"application/vnd.openxmlformats-officedocument.wordprocessingml.document":return E}return M}render(){var e,t;return this.endpoint.session?this.loading?i(o,{class:"loading"},i("verdocs-loader",null)):this.endpoint.session&&this.template?i(o,null,i("h5",null,"Existing Attachments"),i("div",{class:"attachments"},((null===(e=this.template)||void 0===e?void 0:e.documents)||[]).map((e=>i("div",{class:"attachment"},i("div",{class:"file-icon",innerHTML:this.getFileIcon(e)}),i("div",{class:"filename",title:e.name},e.name),i("div",{class:"pages"},i("div",{class:"count"},e.pages),i("div",{class:"pages-icon",innerHTML:T})),i("div",{class:"trash-icon",innerHTML:I,onClick:()=>this.handleDelete(e)}))))),i("h5",null,"Attach a New Document"),this.uploading?i("div",{class:"loader-wrapper"},i("verdocs-loader",null),this.progressLabel&&i("div",{class:"progress-wrapper"},i("verdocs-progress-bar",{showPercent:!0,percent:this.progressPercent,label:this.progressLabel}))):i("verdocs-file-chooser",{onFileSelected:e=>this.handleUpload(e)}),i("div",{class:"buttons"},i("verdocs-button",{variant:"outline",label:"Cancel",size:"small",onClick:e=>this.handleCancel(e),disabled:this.uploading}),i("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&&i("verdocs-ok-dialog",{heading:"Unable to Delete Attachment",message:"Templates must contain at least one attachment.",onNext:()=>this.showDeleteError=!1}),this.confirmDeleteDocument&&i("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}})):i(o,{class:"empty"}):i(o,null,i("verdocs-component-error",{message:"You must be authenticated to use this module."}))}};U.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 B=["attachments","roles","settings","fields","preview"],P=class{constructor(i){e(this,i),this.sdkError=t(this,"sdkError",7),this.stepChanged=t(this,"stepChanged",7),this.templateListenerId=null,this.endpoint=l.getDefault(),this.templateId=null,this.step="preview",this.loading=!0,this.template=null}disconnectedCallback(){this.unlistenToTemplate()}async listenToTemplate(){this.unlistenToTemplate(),y.subscribe("templates",this.templateId,(()=>r(this.endpoint,this.templateId)),!1,(e=>{this.template=e,this.loading=!1}))}unlistenToTemplate(){this.templateListenerId&&(y.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,i;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(o){console.log("[BUILD_TABS] Error loading template",o),null===(e=this.sdkError)||void 0===e||e.emit(new w(o.message,null===(t=o.response)||void 0===t?void 0:t.status,null===(i=o.response)||void 0===i?void 0:i.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((()=>{k("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,s,n,l,r,a,d,c;if(this.loading)return i(o,null,i("verdocs-loader",null));if(!this.endpoint.session)return i(o,null,i("verdocs-component-error",{message:"You must be authenticated to use this module."}));const h=((null===(e=this.template)||void 0===e?void 0:e.documents)||[]).length>0;let u=h&&((null===(t=this.template)||void 0===t?void 0:t.roles)||[]).length>0;const p=u&&((null===(s=this.template)||void 0===s?void 0:s.fields)||[]).length>0;let v=Math.max(B.indexOf(this.step),0);return!p&&v>=4&&(v=3),!u&&v>=3&&(v=1),!h&&v>=1&&(v=0),i(o,null,i("verdocs-tabs",{onSelectTab:e=>this.setStep(e),selectedTab:v,tabs:[{id:"attachments",disabled:!1,label:"Attachment(s)"},{id:"roles",disabled:!h,label:"Roles"},{id:"settings",disabled:!u,label:"Settings"},{id:"fields",disabled:!u,label:"Fields"},{id:"preview",disabled:!p,label:"Preview/Send"}]}),this.templateId&&i("div",{class:"info"},i("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>'},i("div",{class:"template-details-panel"},i("h6",null,"Template Details"),i("div",{class:"row"},i("label",null,"ID:"),i("div",{class:"value"},this.templateId),i("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()})),i("div",{class:"row"},i("label",null,"Name:"),i("div",{class:"value"},null===(n=this.template)||void 0===n?void 0:n.name)),i("div",{class:"row"},i("label",null,"Visibility:"),i("div",{class:"value"},(null===(l=this.template)||void 0===l?void 0:l.is_public)?"Public":(null===(r=this.template)||void 0===r?void 0:r.is_personal)?"Private":"Shared")),i("div",{class:"row"},i("label",null,"Created:"),i("div",{class:"value"},(null===(a=this.template)||void 0===a?void 0:a.counter)?L(new Date(null===(d=this.template)||void 0===d?void 0:d.created_at),"P p"):"")),i("div",{class:"row"},i("label",null,"Used:"),i("div",{class:"value"},null===(c=this.template)||void 0===c?void 0:c.counter," time(s)"))))))}static get watchers(){return{templateId:["onTemplateIdChanged"],step:["onStepChanged"]}}};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-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 $='<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>',F=[{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:$,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:$,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"}],Q=class{constructor(i){e(this,i),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=l.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,i;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(o){console.log("[FIELDS] Error with fields session",o),null===(e=this.sdkError)||void 0===e||e.emit(new w(o.message,null===(t=o.response)||void 0===t?void 0:t.status,null===(i=o.response)||void 0===i?void 0:i.data))}}componentDidRender(){H.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 i=(null===(e=this.template)||void 0===e?void 0:e.roles)||[];this.selectedRoleName&&i.find((e=>e&&e.name===this.selectedRoleName))||(this.selectedRoleName=(null===(t=i[0])||void 0===t?void 0:t.name)||"",console.log("[FIELDS] Selected new role",this.selectedRoleName))}disconnectedCallback(){this.unlistenToTemplate()}async listenToTemplate(){this.unlistenToTemplate(),y.subscribe("templates",this.templateId,(()=>r(this.endpoint,this.templateId)),!1,(e=>{var t,i;this.template=e,this.loading=!1,this.selectedRoleName=(null===(i=null===(t=e.roles)||void 0===t?void 0:t[0])||void 0===i?void 0:i.name)||""}))}unlistenToTemplate(){this.templateListenerId&&(y.store.delListener(this.templateListenerId),this.templateListenerId=null)}attachFieldAttributes(e,t,i){i.addEventListener("settingsChanged",(()=>{var e;null===(e=this.templateUpdated)||void 0===e||e.emit({endpoint:this.endpoint,template:this.template,event:"added-field"})})),i.addEventListener("deleted",(()=>{var e;i.remove(),null===(e=this.templateUpdated)||void 0===e||e.emit({endpoint:this.endpoint,template:this.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)}handlePageRendered(e){var t;const i=e.detail;this.cachedPageInfo[i.pageNumber]=i,this.pageHeights[i.pageNumber]=i.naturalHeight,((null===(t=this.template)||void 0===t?void 0:t.fields)||[]).filter((e=>e&&e.page===i.pageNumber)).forEach((e=>{const t=O(e),i=document.getElementById(t);i&&(i.setAttribute("fieldname",e.name),i.setAttribute("pagenumber",String(e.page)),this.makeDraggable(i))}))}makeDraggable(e){H(e).draggable({listeners:{move:this.handleMoveField.bind(this),end:this.handleMoveEnd.bind(this)}})}async handleMoveField(e){const t=+(e.target.getAttribute("posX")||0),i=+(e.target.getAttribute("posY")||0),o=+(e.target.getAttribute("xScale")||1),s=+(e.target.getAttribute("yScale")||1),n=e.dx/o+t,l=e.dy/s+i;e.target.setAttribute("posX",n),e.target.setAttribute("posy",l),Z(e.target,"translate",`${n}px, ${l}px`)}async handleMoveEnd(e){var t,i,o,s,n,l,r,a;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 h=e.target.getAttribute("pagenumber");let{naturalWidth:u=612,naturalHeight:p=792,renderedHeight:v=792}=this.cachedPageInfo[h];const m=e.target.getBoundingClientRect(),g=e.target.parentElement.getBoundingClientRect(),b=c.width||_(c.type),x=c.height||N(c.type),E=Math.max(m.left-g.left,0);let S=Math.max(v-(g.bottom-m.bottom),0),q=parseInt(h);S>v?(q=Math.min(q+1,(null===(s=null===(o=(null===(i=this.template)||void 0===i?void 0:i.documents)||[])||void 0===o?void 0:o[0])||void 0===s?void 0:s.pages)||1),S-=v,v=this.cachedPageInfo[q].renderedHeight,console.log("Next page",{newPageNumber:q,newY:S,renderedHeight:v})):S<0&&(q=Math.max(q-1,1),v=this.cachedPageInfo[q].renderedHeight,S+=v,console.log("[FIELDS] Next page",{newPageNumber:q,newY:S,renderedHeight:v}));const{x:C,y:M}=this.viewCoordinatesToPageCoordinates(E,S,h,u-b,p-x);try{const t={x:C,y:M,page:q},i=await f(this.endpoint,this.templateId,d,t);console.log("[FIELDS] Updated",i);const o=JSON.parse(JSON.stringify(this.template)),s=o.fields.findIndex((e=>e.name===d));s>-1&&(o.fields[s]=i),y.updateTemplate(this.templateId,o),e.target.removeAttribute("posX"),e.target.removeAttribute("posY"),D(e.target);const{xScale:l=1,yScale:r=1}=this.cachedPageInfo[h];z(e.target,i,l,r),null===(n=this.templateUpdated)||void 0===n||n.emit({endpoint:this.endpoint,template:o,event:"updated-field"})}catch(t){k("Error updating field, please try again later",{style:"error"}),console.log("[FIELDS] Error updating field",t),null===(l=this.sdkError)||void 0===l||l.emit(new w(t.message,null===(r=t.response)||void 0===r?void 0:r.status,null===(a=t.response)||void 0===a?void 0:a.data)),e.target.removeAttribute("posX"),e.target.removeAttribute("posY"),D(e.target)}}generateFieldName(e,t){var i;let o,s=1;do{o=`${e}P${t}-${s}`,s++}while(((null===(i=this.template)||void 0===i?void 0:i.fields)||[]).some((e=>e&&e.name===o)));return o}viewCoordinatesToPageCoordinates(e,t,i,o,s){const{xScale:n=1,yScale:l=1,renderedHeight:r=792}=this.cachedPageInfo[i];return{x:Math.floor(Math.min(e/n,o)),y:Math.floor(Math.min(Math.max(r-t,0)/l,s))}}async handleClickPage(e,t){var i;if(this.placing){const o=e.offsetX,s=e.offsetY,n=_(this.placing),l=N(this.placing),r=this.cachedPageInfo[t],{naturalWidth:a=612,naturalHeight:d=792}=r,c=this.viewCoordinatesToPageCoordinates(o,s,t,a-n,d-l),h=Math.floor(c.x),u=Math.floor(c.y),p={name:this.generateFieldName(this.placing,t),role_name:this.selectedRoleName,template_id:this.templateId,document_id:r.documentId,type:this.placing,required:"radio"!==this.placing,page:t,validator:null,label:null,default:null,placeholder:null,group:null,settings:{},x:h,y:u,width:n,height:l,multiline:!1,options:"radio"===this.placing?[{id:"option-1",label:"Option 1"}]:[]};console.log("[FIELDS] Will save new field",p);const v=await g(this.endpoint,this.templateId,p);console.log("[FIELDS] Saved field",v);const m=JSON.parse(JSON.stringify(this.template));m.fields.push(v),y.updateTemplate(this.templateId,m),null===(i=this.templateUpdated)||void 0===i||i.emit({endpoint:this.endpoint,template:m,event:"added-field"}),this.placing=null}}render(){var e,t,s;if(this.loading)return i(o,null,i("verdocs-loader",null));if(!this.endpoint.session)return i(o,null,i("verdocs-component-error",{message:"You must be authenticated to use this module."}));const n=((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 i(o,{class:this.placing?{[`placing-${this.placing}`]:!0}:{},onSubmit:()=>{}},i("div",{id:"verdocs-template-fields-toolbar"},i("div",{class:"add-for"},"Add field:"),i("verdocs-select-input",{value:this.selectedRoleName,options:n,onInput:e=>this.selectedRoleName=e.target.value}),F.map((e=>i("verdocs-toolbar-icon",{text:e.tooltip,icon:e.icon,class:e.class,onClick:()=>{e.tooltip&&(this.selectedRoleName?this.placing=e.id:this.showMustSelectRole=!0)}})))),i("div",{class:"pages"},((null===(t=this.template)||void 0===t?void 0:t.documents)||[]).map((e=>a(1,e.pages).map((t=>{const o=e.page_sizes[t];return i("verdocs-template-document-page",{templateId:this.templateId,documentId:e.id,pageNumber:t,virtualWidth:(null==o?void 0:o.width)||612,virtualHeight:(null==o?void 0:o.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&&i("verdocs-ok-dialog",{heading:"Unable to add field",message:((null===(s=this.template)||void 0===s?void 0:s.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"]}}};
2
- /**!
3
- * Sortable 1.15.6
4
- * @author RubaXa <trash@rubaxa.org>
5
- * @author owenm <owen23355@gmail.com>
6
- * @license MIT
7
- */
8
- function W(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,o)}return i}function Y(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?W(Object(i),!0).forEach((function(t){X(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):W(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}function J(e){return J="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},J(e)}function X(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function G(){return G=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(e[o]=i[o])}return e},G.apply(this,arguments)}function K(e){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(e)}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-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 ee=K(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),te=K(/Edge/i),ie=K(/firefox/i),oe=K(/safari/i)&&!K(/chrome/i)&&!K(/android/i),se=K(/iP(ad|od|hone)/i),ne=K(/chrome/i)&&K(/android/i),le={capture:!1,passive:!1};function re(e,t,i){e.addEventListener(t,i,!ee&&le)}function ae(e,t,i){e.removeEventListener(t,i,!ee&&le)}function de(e,t){if(t){if(">"===t[0]&&(t=t.substring(1)),e)try{if(e.matches)return e.matches(t);if(e.msMatchesSelector)return e.msMatchesSelector(t);if(e.webkitMatchesSelector)return e.webkitMatchesSelector(t)}catch(e){return!1}return!1}}function ce(e){return e.host&&e!==document&&e.host.nodeType?e.host:e.parentNode}function he(e,t,i,o){if(e){i=i||document;do{if(null!=t&&(">"===t[0]?e.parentNode===i&&de(e,t):de(e,t))||o&&e===i)return e;if(e===i)break}while(e=ce(e))}return null}var ue,pe=/\s+/g;function ve(e,t,i){if(e&&t)if(e.classList)e.classList[i?"add":"remove"](t);else{var o=(" "+e.className+" ").replace(pe," ").replace(" "+t+" "," ");e.className=(o+(i?" "+t:"")).replace(pe," ")}}function me(e,t,i){var o=e&&e.style;if(o){if(void 0===i)return document.defaultView&&document.defaultView.getComputedStyle?i=document.defaultView.getComputedStyle(e,""):e.currentStyle&&(i=e.currentStyle),void 0===t?i:i[t];t in o||-1!==t.indexOf("webkit")||(t="-webkit-"+t),o[t]=i+("string"==typeof i?"":"px")}}function fe(e,t){var i="";if("string"==typeof e)i=e;else do{var o=me(e,"transform");o&&"none"!==o&&(i=o+" "+i)}while(!t&&(e=e.parentNode));var s=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return s&&new s(i)}function ge(e,t,i){if(e){var o=e.getElementsByTagName(t),s=0,n=o.length;if(i)for(;s<n;s++)i(o[s],s);return o}return[]}function be(){return document.scrollingElement||document.documentElement}function xe(e,t,i,o,s){if(e.getBoundingClientRect||e===window){var n,l,r,a,d,c,h;if(e!==window&&e.parentNode&&e!==be()?(l=(n=e.getBoundingClientRect()).top,r=n.left,a=n.bottom,d=n.right,c=n.height,h=n.width):(l=0,r=0,a=window.innerHeight,d=window.innerWidth,c=window.innerHeight,h=window.innerWidth),(t||i)&&e!==window&&(s=s||e.parentNode,!ee))do{if(s&&s.getBoundingClientRect&&("none"!==me(s,"transform")||i&&"static"!==me(s,"position"))){var u=s.getBoundingClientRect();l-=u.top+parseInt(me(s,"border-top-width")),r-=u.left+parseInt(me(s,"border-left-width")),a=l+n.height,d=r+n.width;break}}while(s=s.parentNode);if(o&&e!==window){var p=fe(s||e),v=p&&p.a,m=p&&p.d;p&&(a=(l/=m)+(c/=m),d=(r/=v)+(h/=v))}return{top:l,left:r,bottom:a,right:d,width:h,height:c}}}function we(e,t,i){for(var o=qe(e,!0),s=xe(e)[t];o;){var n=xe(o)[i];if(!("top"===i||"left"===i?s>=n:s<=n))return o;if(o===be())break;o=qe(o,!1)}return!1}function ye(e,t,i,o){for(var s=0,n=0,l=e.children;n<l.length;){if("none"!==l[n].style.display&&l[n]!==Tt.ghost&&(o||l[n]!==Tt.dragged)&&he(l[n],i.draggable,e,!1)){if(s===t)return l[n];s++}n++}return null}function ke(e,t){for(var i=e.lastElementChild;i&&(i===Tt.ghost||"none"===me(i,"display")||t&&!de(i,t));)i=i.previousElementSibling;return i||null}function Ee(e,t){var i=0;if(!e||!e.parentNode)return-1;for(;e=e.previousElementSibling;)"TEMPLATE"===e.nodeName.toUpperCase()||e===Tt.clone||t&&!de(e,t)||i++;return i}function Se(e){var t=0,i=0,o=be();if(e)do{var s=fe(e);t+=e.scrollLeft*s.a,i+=e.scrollTop*s.d}while(e!==o&&(e=e.parentNode));return[t,i]}function qe(e,t){if(!e||!e.getBoundingClientRect)return be();var i=e,o=!1;do{if(i.clientWidth<i.scrollWidth||i.clientHeight<i.scrollHeight){var s=me(i);if(i.clientWidth<i.scrollWidth&&("auto"==s.overflowX||"scroll"==s.overflowX)||i.clientHeight<i.scrollHeight&&("auto"==s.overflowY||"scroll"==s.overflowY)){if(!i.getBoundingClientRect||i===document.body)return be();if(o||t)return i;o=!0}}}while(i=i.parentNode);return be()}function Ce(e,t){return Math.round(e.top)===Math.round(t.top)&&Math.round(e.left)===Math.round(t.left)&&Math.round(e.height)===Math.round(t.height)&&Math.round(e.width)===Math.round(t.width)}function Me(e,t){return function(){if(!ue){var i=arguments;1===i.length?e.call(this,i[0]):e.apply(this,i),ue=setTimeout((function(){ue=void 0}),t)}}}function Te(e,t,i){e.scrollLeft+=t,e.scrollTop+=i}function Ie(e){var t=window.Polymer,i=window.jQuery||window.Zepto;return t&&t.dom?t.dom(e).cloneNode(!0):i?i(e).clone(!0)[0]:e.cloneNode(!0)}function Le(e,t,i){var o={};return Array.from(e.children).forEach((function(s){var n,l,r,a;if(he(s,t.draggable,e,!1)&&!s.animated&&s!==i){var d=xe(s);o.left=Math.min(null!==(n=o.left)&&void 0!==n?n:1/0,d.left),o.top=Math.min(null!==(l=o.top)&&void 0!==l?l:1/0,d.top),o.right=Math.max(null!==(r=o.right)&&void 0!==r?r:-1/0,d.right),o.bottom=Math.max(null!==(a=o.bottom)&&void 0!==a?a:-1/0,d.bottom)}})),o.width=o.right-o.left,o.height=o.bottom-o.top,o.x=o.left,o.y=o.top,o}var He="Sortable"+(new Date).getTime();var Ze=[],De={initializeByDefault:!0},ze={mount:function(e){for(var t in De)De.hasOwnProperty(t)&&!(t in e)&&(e[t]=De[t]);Ze.forEach((function(t){if(t.pluginName===e.pluginName)throw"Sortable: Cannot mount plugin ".concat(e.pluginName," more than once")})),Ze.push(e)},pluginEvent:function(e,t,i){var o=this;this.eventCanceled=!1,i.cancel=function(){o.eventCanceled=!0};var s=e+"Global";Ze.forEach((function(o){t[o.pluginName]&&(t[o.pluginName][s]&&t[o.pluginName][s](Y({sortable:t},i)),t.options[o.pluginName]&&t[o.pluginName][e]&&t[o.pluginName][e](Y({sortable:t},i)))}))},initializePlugins:function(e,t,i){for(var o in Ze.forEach((function(o){var s=o.pluginName;if(e.options[s]||o.initializeByDefault){var n=new o(e,t,e.options);n.sortable=e,n.options=e.options,e[s]=n,G(i,n.defaults)}})),e.options)if(e.options.hasOwnProperty(o)){var s=this.modifyOption(e,o,e.options[o]);void 0!==s&&(e.options[o]=s)}},getEventProperties:function(e,t){var i={};return Ze.forEach((function(o){"function"==typeof o.eventProperties&&G(i,o.eventProperties.call(t[o.pluginName],e))})),i},modifyOption:function(e,t,i){var o;return Ze.forEach((function(s){e[s.pluginName]&&s.optionListeners&&"function"==typeof s.optionListeners[t]&&(o=s.optionListeners[t].call(e[s.pluginName],i))})),o}},Oe=["evt"],_e=function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=i.evt,s=function(e,t){if(null==e)return{};var i,o,s=function(e,t){if(null==e)return{};var i,o,s={},n=Object.keys(e);for(o=0;o<n.length;o++)t.indexOf(i=n[o])>=0||(s[i]=e[i]);return s}(e,t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(o=0;o<n.length;o++)t.indexOf(i=n[o])>=0||Object.prototype.propertyIsEnumerable.call(e,i)&&(s[i]=e[i])}return s}(i,Oe);ze.pluginEvent.bind(Tt)(e,t,Y({dragEl:Ve,parentEl:Ae,ghostEl:Re,rootEl:je,nextEl:Ue,lastDownEl:Be,cloneEl:Pe,cloneHidden:$e,dragStarted:st,putSortable:Xe,activeSortable:Tt.active,originalEvent:o,oldIndex:Fe,oldDraggableIndex:We,newIndex:Qe,newDraggableIndex:Ye,hideGhostForTarget:St,unhideGhostForTarget:qt,cloneNowHidden:function(){$e=!0},cloneNowShown:function(){$e=!1},dispatchSortableEvent:function(e){Ne({sortable:t,name:e,originalEvent:o})}},s))};function Ne(e){!function(e){var t=e.sortable,i=e.rootEl,o=e.name,s=e.targetEl,n=e.cloneEl,l=e.toEl,r=e.fromEl,a=e.oldIndex,d=e.newIndex,c=e.oldDraggableIndex,h=e.newDraggableIndex,u=e.originalEvent,p=e.putSortable,v=e.extraEventProperties;if(t=t||i&&i[He]){var m,f=t.options,g="on"+o.charAt(0).toUpperCase()+o.substr(1);!window.CustomEvent||ee||te?(m=document.createEvent("Event")).initEvent(o,!0,!0):m=new CustomEvent(o,{bubbles:!0,cancelable:!0}),m.to=l||i,m.from=r||i,m.item=s||i,m.clone=n,m.oldIndex=a,m.newIndex=d,m.oldDraggableIndex=c,m.newDraggableIndex=h,m.originalEvent=u,m.pullMode=p?p.lastPutMode:void 0;var b=Y(Y({},v),ze.getEventProperties(o,t));for(var x in b)m[x]=b[x];i&&i.dispatchEvent(m),f[g]&&f[g].call(t,m)}}(Y({putSortable:Xe,cloneEl:Pe,targetEl:Ve,rootEl:je,oldIndex:Fe,oldDraggableIndex:We,newIndex:Qe,newDraggableIndex:Ye},e))}var Ve,Ae,Re,je,Ue,Be,Pe,$e,Fe,Qe,We,Ye,Je,Xe,Ge,Ke,et,tt,it,ot,st,nt,lt,rt,at,dt=!1,ct=!1,ht=[],ut=!1,pt=!1,vt=[],mt=!1,ft=[],gt="undefined"!=typeof document,bt=se,xt=te||ee?"cssFloat":"float",wt=gt&&!ne&&!se&&"draggable"in document.createElement("div"),yt=function(){if(gt){if(ee)return!1;var e=document.createElement("x");return e.style.cssText="pointer-events:auto","auto"===e.style.pointerEvents}}(),kt=function(e,t){var i=me(e),o=parseInt(i.width)-parseInt(i.paddingLeft)-parseInt(i.paddingRight)-parseInt(i.borderLeftWidth)-parseInt(i.borderRightWidth),s=ye(e,0,t),n=ye(e,1,t),l=s&&me(s),r=n&&me(n),a=l&&parseInt(l.marginLeft)+parseInt(l.marginRight)+xe(s).width,d=r&&parseInt(r.marginLeft)+parseInt(r.marginRight)+xe(n).width;return"flex"===i.display?"column"===i.flexDirection||"column-reverse"===i.flexDirection?"vertical":"horizontal":"grid"===i.display?i.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal":s&&l.float&&"none"!==l.float?!n||"both"!==r.clear&&r.clear!==("left"===l.float?"left":"right")?"horizontal":"vertical":s&&("block"===l.display||"flex"===l.display||"table"===l.display||"grid"===l.display||a>=o&&"none"===i[xt]||n&&"none"===i[xt]&&a+d>o)?"vertical":"horizontal"},Et=function(e){function t(e,i){return function(o,s,n,l){if(null==e&&(i||o.options.group.name&&s.options.group.name&&o.options.group.name===s.options.group.name))return!0;if(null==e||!1===e)return!1;if(i&&"clone"===e)return e;if("function"==typeof e)return t(e(o,s,n,l),i)(o,s,n,l);var r=(i?o:s).options.group.name;return!0===e||"string"==typeof e&&e===r||e.join&&e.indexOf(r)>-1}}var i={},o=e.group;o&&"object"==J(o)||(o={name:o}),i.name=o.name,i.checkPull=t(o.pull,!0),i.checkPut=t(o.put),i.revertClone=o.revertClone,e.group=i},St=function(){!yt&&Re&&me(Re,"display","none")},qt=function(){!yt&&Re&&me(Re,"display","")};gt&&!ne&&document.addEventListener("click",(function(e){if(ct)return e.preventDefault(),e.stopPropagation&&e.stopPropagation(),e.stopImmediatePropagation&&e.stopImmediatePropagation(),ct=!1,!1}),!0);var Ct=function(e){if(Ve){var t=(s=(e=e.touches?e.touches[0]:e).clientX,n=e.clientY,ht.some((function(e){var t=e[He].options.emptyInsertThreshold;if(t&&!ke(e)){var i=xe(e);return s>=i.left-t&&s<=i.right+t&&n>=i.top-t&&n<=i.bottom+t?l=e:void 0}})),l);if(t){var i={};for(var o in e)e.hasOwnProperty(o)&&(i[o]=e[o]);i.target=i.rootEl=t,i.preventDefault=void 0,i.stopPropagation=void 0,t[He]._onDragOver(i)}}var s,n,l},Mt=function(e){Ve&&Ve.parentNode[He]._isOutsideThisEl(e.target)};function Tt(e,t){if(!e||!e.nodeType||1!==e.nodeType)throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(e));this.el=e,this.options=t=G({},t),e[He]=this;var i,o,s={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(e.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return kt(e,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(e,t){e.setData("Text",t.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:!1!==Tt.supportPointer&&"PointerEvent"in window&&(!oe||se),emptyInsertThreshold:5};for(var n in ze.initializePlugins(this,e,s),s)!(n in t)&&(t[n]=s[n]);for(var l in Et(t),this)"_"===l.charAt(0)&&"function"==typeof this[l]&&(this[l]=this[l].bind(this));this.nativeDraggable=!t.forceFallback&&wt,this.nativeDraggable&&(this.options.touchStartThreshold=1),t.supportPointer?re(e,"pointerdown",this._onTapStart):(re(e,"mousedown",this._onTapStart),re(e,"touchstart",this._onTapStart)),this.nativeDraggable&&(re(e,"dragover",this),re(e,"dragenter",this)),ht.push(this.el),t.store&&t.store.get&&this.sort(t.store.get(this)||[]),G(this,(o=[],{captureAnimationState:function(){o=[],this.options.animation&&[].slice.call(this.el.children).forEach((function(e){if("none"!==me(e,"display")&&e!==Tt.ghost){o.push({target:e,rect:xe(e)});var t=Y({},o[o.length-1].rect);if(e.thisAnimationDuration){var i=fe(e,!0);i&&(t.top-=i.f,t.left-=i.e)}e.fromRect=t}}))},addAnimationState:function(e){o.push(e)},removeAnimationState:function(e){o.splice(function(e,t){for(var i in e)if(e.hasOwnProperty(i))for(var o in t)if(t.hasOwnProperty(o)&&t[o]===e[i][o])return Number(i);return-1}(o,{target:e}),1)},animateAll:function(e){var t=this;if(!this.options.animation)return clearTimeout(i),void("function"==typeof e&&e());var s=!1,n=0;o.forEach((function(e){var i=0,o=e.target,l=o.fromRect,r=xe(o),a=o.prevFromRect,d=o.prevToRect,c=e.rect,h=fe(o,!0);h&&(r.top-=h.f,r.left-=h.e),o.toRect=r,o.thisAnimationDuration&&Ce(a,r)&&!Ce(l,r)&&(c.top-r.top)/(c.left-r.left)==(l.top-r.top)/(l.left-r.left)&&(i=function(e,t,i,o){return Math.sqrt(Math.pow(t.top-e.top,2)+Math.pow(t.left-e.left,2))/Math.sqrt(Math.pow(t.top-i.top,2)+Math.pow(t.left-i.left,2))*o.animation}(c,a,d,t.options)),Ce(r,l)||(o.prevFromRect=l,o.prevToRect=r,i||(i=t.options.animation),t.animate(o,c,r,i)),i&&(s=!0,n=Math.max(n,i),clearTimeout(o.animationResetTimer),o.animationResetTimer=setTimeout((function(){o.animationTime=0,o.prevFromRect=null,o.fromRect=null,o.prevToRect=null,o.thisAnimationDuration=null}),i),o.thisAnimationDuration=i)})),clearTimeout(i),s?i=setTimeout((function(){"function"==typeof e&&e()}),n):"function"==typeof e&&e(),o=[]},animate:function(e,t,i,o){if(o){me(e,"transition",""),me(e,"transform","");var s=fe(this.el),n=(t.left-i.left)/(s&&s.a||1),l=(t.top-i.top)/(s&&s.d||1);e.animatingX=!!n,e.animatingY=!!l,me(e,"transform","translate3d("+n+"px,"+l+"px,0)"),this.forRepaintDummy=function(e){return e.offsetWidth}(e),me(e,"transition","transform "+o+"ms"+(this.options.easing?" "+this.options.easing:"")),me(e,"transform","translate3d(0,0,0)"),"number"==typeof e.animated&&clearTimeout(e.animated),e.animated=setTimeout((function(){me(e,"transition",""),me(e,"transform",""),e.animated=!1,e.animatingX=!1,e.animatingY=!1}),o)}}}))}function It(e,t,i,o,s,n,l,r){var a,d,c=e[He],h=c.options.onMove;return!window.CustomEvent||ee||te?(a=document.createEvent("Event")).initEvent("move",!0,!0):a=new CustomEvent("move",{bubbles:!0,cancelable:!0}),a.to=t,a.from=e,a.dragged=i,a.draggedRect=o,a.related=s||t,a.relatedRect=n||xe(t),a.willInsertAfter=r,a.originalEvent=l,e.dispatchEvent(a),h&&(d=h.call(c,a,l)),d}function Lt(e){e.draggable=!1}function Ht(){mt=!1}function Zt(e){for(var t=e.tagName+e.className+e.src+e.href+e.textContent,i=t.length,o=0;i--;)o+=t.charCodeAt(i);return o.toString(36)}function Dt(e){return setTimeout(e,0)}function zt(e){return clearTimeout(e)}Tt.prototype={constructor:Tt,_isOutsideThisEl:function(e){this.el.contains(e)||e===this.el||(nt=null)},_getDirection:function(e,t){return"function"==typeof this.options.direction?this.options.direction.call(this,e,t,Ve):this.options.direction},_onTapStart:function(e){if(e.cancelable){var t=this,i=this.el,o=this.options,s=o.preventOnFilter,n=e.type,l=e.touches&&e.touches[0]||e.pointerType&&"touch"===e.pointerType&&e,r=(l||e).target,a=e.target.shadowRoot&&(e.path&&e.path[0]||e.composedPath&&e.composedPath()[0])||r,d=o.filter;if(function(e){ft.length=0;for(var t=e.getElementsByTagName("input"),i=t.length;i--;){var o=t[i];o.checked&&ft.push(o)}}(i),!Ve&&!(/mousedown|pointerdown/.test(n)&&0!==e.button||o.disabled)&&!a.isContentEditable&&(this.nativeDraggable||!oe||!r||"SELECT"!==r.tagName.toUpperCase())&&!((r=he(r,o.draggable,i,!1))&&r.animated||Be===r)){if(Fe=Ee(r),We=Ee(r,o.draggable),"function"==typeof d){if(d.call(this,e,r,this))return Ne({sortable:t,rootEl:a,name:"filter",targetEl:r,toEl:i,fromEl:i}),_e("filter",t,{evt:e}),void(s&&e.preventDefault())}else if(d&&(d=d.split(",").some((function(o){if(o=he(a,o.trim(),i,!1))return Ne({sortable:t,rootEl:o,name:"filter",targetEl:r,fromEl:i,toEl:i}),_e("filter",t,{evt:e}),!0}))))return void(s&&e.preventDefault());o.handle&&!he(a,o.handle,i,!1)||this._prepareDragStart(e,l,r)}}},_prepareDragStart:function(e,t,i){var o,s=this,n=s.el,l=s.options,r=n.ownerDocument;if(i&&!Ve&&i.parentNode===n){var a=xe(i);if(je=n,Ae=(Ve=i).parentNode,Ue=Ve.nextSibling,Be=i,Je=l.group,Tt.dragged=Ve,it=(Ge={target:Ve,clientX:(t||e).clientX,clientY:(t||e).clientY}).clientX-a.left,ot=Ge.clientY-a.top,this._lastX=(t||e).clientX,this._lastY=(t||e).clientY,Ve.style["will-change"]="all",o=function(){_e("delayEnded",s,{evt:e}),Tt.eventCanceled?s._onDrop():(s._disableDelayedDragEvents(),!ie&&s.nativeDraggable&&(Ve.draggable=!0),s._triggerDragStart(e,t),Ne({sortable:s,name:"choose",originalEvent:e}),ve(Ve,l.chosenClass,!0))},l.ignore.split(",").forEach((function(e){ge(Ve,e.trim(),Lt)})),re(r,"dragover",Ct),re(r,"mousemove",Ct),re(r,"touchmove",Ct),l.supportPointer?(re(r,"pointerup",s._onDrop),!this.nativeDraggable&&re(r,"pointercancel",s._onDrop)):(re(r,"mouseup",s._onDrop),re(r,"touchend",s._onDrop),re(r,"touchcancel",s._onDrop)),ie&&this.nativeDraggable&&(this.options.touchStartThreshold=4,Ve.draggable=!0),_e("delayStart",this,{evt:e}),!l.delay||l.delayOnTouchOnly&&!t||this.nativeDraggable&&(te||ee))o();else{if(Tt.eventCanceled)return void this._onDrop();l.supportPointer?(re(r,"pointerup",s._disableDelayedDrag),re(r,"pointercancel",s._disableDelayedDrag)):(re(r,"mouseup",s._disableDelayedDrag),re(r,"touchend",s._disableDelayedDrag),re(r,"touchcancel",s._disableDelayedDrag)),re(r,"mousemove",s._delayedDragTouchMoveHandler),re(r,"touchmove",s._delayedDragTouchMoveHandler),l.supportPointer&&re(r,"pointermove",s._delayedDragTouchMoveHandler),s._dragStartTimer=setTimeout(o,l.delay)}}},_delayedDragTouchMoveHandler:function(e){var t=e.touches?e.touches[0]:e;Math.max(Math.abs(t.clientX-this._lastX),Math.abs(t.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){Ve&&Lt(Ve),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var e=this.el.ownerDocument;ae(e,"mouseup",this._disableDelayedDrag),ae(e,"touchend",this._disableDelayedDrag),ae(e,"touchcancel",this._disableDelayedDrag),ae(e,"pointerup",this._disableDelayedDrag),ae(e,"pointercancel",this._disableDelayedDrag),ae(e,"mousemove",this._delayedDragTouchMoveHandler),ae(e,"touchmove",this._delayedDragTouchMoveHandler),ae(e,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(e,t){t=t||"touch"==e.pointerType&&e,!this.nativeDraggable||t?re(document,this.options.supportPointer?"pointermove":t?"touchmove":"mousemove",this._onTouchMove):(re(Ve,"dragend",this),re(je,"dragstart",this._onDragStart));try{document.selection?Dt((function(){document.selection.empty()})):window.getSelection().removeAllRanges()}catch(e){}},_dragStarted:function(e,t){if(dt=!1,je&&Ve){_e("dragStarted",this,{evt:t}),this.nativeDraggable&&re(document,"dragover",Mt);var i=this.options;!e&&ve(Ve,i.dragClass,!1),ve(Ve,i.ghostClass,!0),Tt.active=this,e&&this._appendGhost(),Ne({sortable:this,name:"start",originalEvent:t})}else this._nulling()},_emulateDragOver:function(){if(Ke){this._lastX=Ke.clientX,this._lastY=Ke.clientY,St();for(var e=document.elementFromPoint(Ke.clientX,Ke.clientY),t=e;e&&e.shadowRoot&&(e=e.shadowRoot.elementFromPoint(Ke.clientX,Ke.clientY))!==t;)t=e;if(Ve.parentNode[He]._isOutsideThisEl(e),t)do{if(t[He]&&t[He]._onDragOver({clientX:Ke.clientX,clientY:Ke.clientY,target:e,rootEl:t})&&!this.options.dragoverBubble)break;e=t}while(t=ce(t));qt()}},_onTouchMove:function(e){if(Ge){var t=this.options,i=t.fallbackTolerance,o=t.fallbackOffset,s=e.touches?e.touches[0]:e,n=Re&&fe(Re,!0),l=Re&&n&&n.a,r=Re&&n&&n.d,a=bt&&at&&Se(at),d=(s.clientX-Ge.clientX+o.x)/(l||1)+(a?a[0]-vt[0]:0)/(l||1),c=(s.clientY-Ge.clientY+o.y)/(r||1)+(a?a[1]-vt[1]:0)/(r||1);if(!Tt.active&&!dt){if(i&&Math.max(Math.abs(s.clientX-this._lastX),Math.abs(s.clientY-this._lastY))<i)return;this._onDragStart(e,!0)}if(Re){n?(n.e+=d-(et||0),n.f+=c-(tt||0)):n={a:1,b:0,c:0,d:1,e:d,f:c};var h="matrix(".concat(n.a,",").concat(n.b,",").concat(n.c,",").concat(n.d,",").concat(n.e,",").concat(n.f,")");me(Re,"webkitTransform",h),me(Re,"mozTransform",h),me(Re,"msTransform",h),me(Re,"transform",h),et=d,tt=c,Ke=s}e.cancelable&&e.preventDefault()}},_appendGhost:function(){if(!Re){var e=this.options.fallbackOnBody?document.body:je,t=xe(Ve,!0,bt,!0,e),i=this.options;if(bt){for(at=e;"static"===me(at,"position")&&"none"===me(at,"transform")&&at!==document;)at=at.parentNode;at!==document.body&&at!==document.documentElement?(at===document&&(at=be()),t.top+=at.scrollTop,t.left+=at.scrollLeft):at=be(),vt=Se(at)}ve(Re=Ve.cloneNode(!0),i.ghostClass,!1),ve(Re,i.fallbackClass,!0),ve(Re,i.dragClass,!0),me(Re,"transition",""),me(Re,"transform",""),me(Re,"box-sizing","border-box"),me(Re,"margin",0),me(Re,"top",t.top),me(Re,"left",t.left),me(Re,"width",t.width),me(Re,"height",t.height),me(Re,"opacity","0.8"),me(Re,"position",bt?"absolute":"fixed"),me(Re,"zIndex","100000"),me(Re,"pointerEvents","none"),Tt.ghost=Re,e.appendChild(Re),me(Re,"transform-origin",it/parseInt(Re.style.width)*100+"% "+ot/parseInt(Re.style.height)*100+"%")}},_onDragStart:function(e,t){var i=this,o=e.dataTransfer,s=i.options;_e("dragStart",this,{evt:e}),Tt.eventCanceled?this._onDrop():(_e("setupClone",this),Tt.eventCanceled||((Pe=Ie(Ve)).removeAttribute("id"),Pe.draggable=!1,Pe.style["will-change"]="",this._hideClone(),ve(Pe,this.options.chosenClass,!1),Tt.clone=Pe),i.cloneId=Dt((function(){_e("clone",i),Tt.eventCanceled||(i.options.removeCloneOnHide||je.insertBefore(Pe,Ve),i._hideClone(),Ne({sortable:i,name:"clone"}))})),!t&&ve(Ve,s.dragClass,!0),t?(ct=!0,i._loopId=setInterval(i._emulateDragOver,50)):(ae(document,"mouseup",i._onDrop),ae(document,"touchend",i._onDrop),ae(document,"touchcancel",i._onDrop),o&&(o.effectAllowed="move",s.setData&&s.setData.call(i,o,Ve)),re(document,"drop",i),me(Ve,"transform","translateZ(0)")),dt=!0,i._dragStartId=Dt(i._dragStarted.bind(i,t,e)),re(document,"selectstart",i),st=!0,window.getSelection().removeAllRanges(),oe&&me(document.body,"user-select","none"))},_onDragOver:function(e){var t,i,o,s,n=this.el,l=e.target,r=this.options,a=r.group,d=Tt.active,c=Je===a,h=r.sort,u=Xe||d,p=this,v=!1;if(!mt){if(void 0!==e.preventDefault&&e.cancelable&&e.preventDefault(),l=he(l,r.draggable,n,!0),I("dragOver"),Tt.eventCanceled)return v;if(Ve.contains(e.target)||l.animated&&l.animatingX&&l.animatingY||p._ignoreWhileAnimating===l)return H(!1);if(ct=!1,d&&!r.disabled&&(c?h||(o=Ae!==je):Xe===this||(this.lastPutMode=Je.checkPull(this,d,Ve,e))&&a.checkPut(this,d,Ve,e))){if(s="vertical"===this._getDirection(e,l),t=xe(Ve),I("dragOverValid"),Tt.eventCanceled)return v;if(o)return Ae=je,L(),this._hideClone(),I("revert"),Tt.eventCanceled||(Ue?je.insertBefore(Ve,Ue):je.appendChild(Ve)),H(!0);var m=ke(n,r.draggable);if(!m||function(e,t,i){var o=xe(ke(i.el,i.options.draggable)),s=Le(i.el,i.options,Re);return t?e.clientX>s.right+10||e.clientY>o.bottom&&e.clientX>o.left:e.clientY>s.bottom+10||e.clientX>o.right&&e.clientY>o.top}(e,s,this)&&!m.animated){if(m===Ve)return H(!1);if(m&&n===e.target&&(l=m),l&&(i=xe(l)),!1!==It(je,n,Ve,t,l,i,e,!!l))return L(),m&&m.nextSibling?n.insertBefore(Ve,m.nextSibling):n.appendChild(Ve),Ae=n,Z(),H(!0)}else if(m&&function(e,t,i){var o=xe(ye(i.el,0,i.options,!0)),s=Le(i.el,i.options,Re);return t?e.clientX<s.left-10||e.clientY<o.top&&e.clientX<o.right:e.clientY<s.top-10||e.clientY<o.bottom&&e.clientX<o.left}(e,s,this)){var f=ye(n,0,r,!0);if(f===Ve)return H(!1);if(i=xe(l=f),!1!==It(je,n,Ve,t,l,i,e,!1))return L(),n.insertBefore(Ve,f),Ae=n,Z(),H(!0)}else if(l.parentNode===n){i=xe(l);var g,b,x,w=Ve.parentNode!==n,y=!function(e,t,i){var o=i?e.left:e.top,s=i?t.left:t.top;return o===s||(i?e.right:e.bottom)===(i?t.right:t.bottom)||o+(i?e.width:e.height)/2===s+(i?t.width:t.height)/2}(Ve.animated&&Ve.toRect||t,l.animated&&l.toRect||i,s),k=s?"top":"left",E=we(l,"top","top")||we(Ve,"top","top"),S=E?E.scrollTop:void 0;if(nt!==l&&(b=i[k],ut=!1,pt=!y&&r.invertSwap||w),g=function(e,t,i,o,s,n,l,r){var a=o?e.clientY:e.clientX,d=o?i.height:i.width,c=o?i.top:i.left,h=o?i.bottom:i.right,u=!1;if(!l)if(r&&rt<d*s){if(!ut&&(1===lt?a>c+d*n/2:a<h-d*n/2)&&(ut=!0),ut)u=!0;else if(1===lt?a<c+rt:a>h-rt)return-lt}else if(a>c+d*(1-s)/2&&a<h-d*(1-s)/2)return function(e){return Ee(Ve)<Ee(e)?1:-1}(t);return(u=u||l)&&(a<c+d*n/2||a>h-d*n/2)?a>c+d/2?1:-1:0}(e,l,i,s,y?1:r.swapThreshold,null==r.invertedSwapThreshold?r.swapThreshold:r.invertedSwapThreshold,pt,nt===l),0!==g){var q=Ee(Ve);do{x=Ae.children[q-=g]}while(x&&("none"===me(x,"display")||x===Re))}if(0===g||x===l)return H(!1);nt=l,lt=g;var C=l.nextElementSibling,M=!1,T=It(je,n,Ve,t,l,i,e,M=1===g);if(!1!==T)return 1!==T&&-1!==T||(M=1===T),mt=!0,setTimeout(Ht,30),L(),M&&!C?n.appendChild(Ve):l.parentNode.insertBefore(Ve,M?C:l),E&&Te(E,0,S-E.scrollTop),Ae=Ve.parentNode,void 0===b||pt||(rt=Math.abs(b-xe(l)[k])),Z(),H(!0)}if(n.contains(Ve))return H(!1)}return!1}function I(r,a){_e(r,p,Y({evt:e,isOwner:c,axis:s?"vertical":"horizontal",revert:o,dragRect:t,targetRect:i,canSort:h,fromSortable:u,target:l,completed:H,onMove:function(i,o){return It(je,n,Ve,t,i,xe(i),e,o)},changed:Z},a))}function L(){I("dragOverAnimationCapture"),p.captureAnimationState(),p!==u&&u.captureAnimationState()}function H(t){return I("dragOverCompleted",{insertion:t}),t&&(c?d._hideClone():d._showClone(p),p!==u&&(ve(Ve,Xe?Xe.options.ghostClass:d.options.ghostClass,!1),ve(Ve,r.ghostClass,!0)),Xe!==p&&p!==Tt.active?Xe=p:p===Tt.active&&Xe&&(Xe=null),u===p&&(p._ignoreWhileAnimating=l),p.animateAll((function(){I("dragOverAnimationComplete"),p._ignoreWhileAnimating=null})),p!==u&&(u.animateAll(),u._ignoreWhileAnimating=null)),(l===Ve&&!Ve.animated||l===n&&!l.animated)&&(nt=null),r.dragoverBubble||e.rootEl||l===document||(Ve.parentNode[He]._isOutsideThisEl(e.target),!t&&Ct(e)),!r.dragoverBubble&&e.stopPropagation&&e.stopPropagation(),v=!0}function Z(){Qe=Ee(Ve),Ye=Ee(Ve,r.draggable),Ne({sortable:p,name:"change",toEl:n,newIndex:Qe,newDraggableIndex:Ye,originalEvent:e})}},_ignoreWhileAnimating:null,_offMoveEvents:function(){ae(document,"mousemove",this._onTouchMove),ae(document,"touchmove",this._onTouchMove),ae(document,"pointermove",this._onTouchMove),ae(document,"dragover",Ct),ae(document,"mousemove",Ct),ae(document,"touchmove",Ct)},_offUpEvents:function(){var e=this.el.ownerDocument;ae(e,"mouseup",this._onDrop),ae(e,"touchend",this._onDrop),ae(e,"pointerup",this._onDrop),ae(e,"pointercancel",this._onDrop),ae(e,"touchcancel",this._onDrop),ae(document,"selectstart",this)},_onDrop:function(e){var t=this.el,i=this.options;Qe=Ee(Ve),Ye=Ee(Ve,i.draggable),_e("drop",this,{evt:e}),Ae=Ve&&Ve.parentNode,Qe=Ee(Ve),Ye=Ee(Ve,i.draggable),Tt.eventCanceled||(dt=!1,pt=!1,ut=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),zt(this.cloneId),zt(this._dragStartId),this.nativeDraggable&&(ae(document,"drop",this),ae(t,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),oe&&me(document.body,"user-select",""),me(Ve,"transform",""),e&&(st&&(e.cancelable&&e.preventDefault(),!i.dropBubble&&e.stopPropagation()),Re&&Re.parentNode&&Re.parentNode.removeChild(Re),(je===Ae||Xe&&"clone"!==Xe.lastPutMode)&&Pe&&Pe.parentNode&&Pe.parentNode.removeChild(Pe),Ve&&(this.nativeDraggable&&ae(Ve,"dragend",this),Lt(Ve),Ve.style["will-change"]="",st&&!dt&&ve(Ve,Xe?Xe.options.ghostClass:this.options.ghostClass,!1),ve(Ve,this.options.chosenClass,!1),Ne({sortable:this,name:"unchoose",toEl:Ae,newIndex:null,newDraggableIndex:null,originalEvent:e}),je!==Ae?(Qe>=0&&(Ne({rootEl:Ae,name:"add",toEl:Ae,fromEl:je,originalEvent:e}),Ne({sortable:this,name:"remove",toEl:Ae,originalEvent:e}),Ne({rootEl:Ae,name:"sort",toEl:Ae,fromEl:je,originalEvent:e}),Ne({sortable:this,name:"sort",toEl:Ae,originalEvent:e})),Xe&&Xe.save()):Qe!==Fe&&Qe>=0&&(Ne({sortable:this,name:"update",toEl:Ae,originalEvent:e}),Ne({sortable:this,name:"sort",toEl:Ae,originalEvent:e})),Tt.active&&(null!=Qe&&-1!==Qe||(Qe=Fe,Ye=We),Ne({sortable:this,name:"end",toEl:Ae,originalEvent:e}),this.save())))),this._nulling()},_nulling:function(){_e("nulling",this),je=Ve=Ae=Re=Ue=Pe=Be=$e=Ge=Ke=st=Qe=Ye=Fe=We=nt=lt=Xe=Je=Tt.dragged=Tt.ghost=Tt.clone=Tt.active=null,ft.forEach((function(e){e.checked=!0})),ft.length=et=tt=0},handleEvent:function(e){switch(e.type){case"drop":case"dragend":this._onDrop(e);break;case"dragenter":case"dragover":Ve&&(this._onDragOver(e),function(e){e.dataTransfer&&(e.dataTransfer.dropEffect="move"),e.cancelable&&e.preventDefault()}(e));break;case"selectstart":e.preventDefault()}},toArray:function(){for(var e,t=[],i=this.el.children,o=0,s=i.length,n=this.options;o<s;o++)he(e=i[o],n.draggable,this.el,!1)&&t.push(e.getAttribute(n.dataIdAttr)||Zt(e));return t},sort:function(e,t){var i={},o=this.el;this.toArray().forEach((function(e,t){var s=o.children[t];he(s,this.options.draggable,o,!1)&&(i[e]=s)}),this),t&&this.captureAnimationState(),e.forEach((function(e){i[e]&&(o.removeChild(i[e]),o.appendChild(i[e]))})),t&&this.animateAll()},save:function(){var e=this.options.store;e&&e.set&&e.set(this)},closest:function(e,t){return he(e,t||this.options.draggable,this.el,!1)},option:function(e,t){var i=this.options;if(void 0===t)return i[e];var o=ze.modifyOption(this,e,t);i[e]=void 0!==o?o:t,"group"===e&&Et(i)},destroy:function(){_e("destroy",this);var e=this.el;e[He]=null,ae(e,"mousedown",this._onTapStart),ae(e,"touchstart",this._onTapStart),ae(e,"pointerdown",this._onTapStart),this.nativeDraggable&&(ae(e,"dragover",this),ae(e,"dragenter",this)),Array.prototype.forEach.call(e.querySelectorAll("[draggable]"),(function(e){e.removeAttribute("draggable")})),this._onDrop(),this._disableDelayedDragEvents(),ht.splice(ht.indexOf(this.el),1),this.el=e=null},_hideClone:function(){if(!$e){if(_e("hideClone",this),Tt.eventCanceled)return;me(Pe,"display","none"),this.options.removeCloneOnHide&&Pe.parentNode&&Pe.parentNode.removeChild(Pe),$e=!0}},_showClone:function(e){if("clone"===e.lastPutMode){if($e){if(_e("showClone",this),Tt.eventCanceled)return;Ve.parentNode!=je||this.options.group.revertClone?Ue?je.insertBefore(Pe,Ue):je.appendChild(Pe):je.insertBefore(Pe,Ve),this.options.group.revertClone&&this.animate(Ve,Pe),me(Pe,"display",""),$e=!1}}else this._hideClone()}},gt&&re(document,"touchmove",(function(e){(Tt.active||dt)&&e.cancelable&&e.preventDefault()})),Tt.utils={on:re,off:ae,css:me,find:ge,is:function(e,t){return!!he(e,t,e,!1)},extend:function(e,t){if(e&&t)for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i]);return e},throttle:Me,closest:he,toggleClass:ve,clone:Ie,index:Ee,nextTick:Dt,cancelNextTick:zt,detectDirection:kt,getChild:ye,expando:He},Tt.get=function(e){return e[He]},Tt.mount=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];t[0].constructor===Array&&(t=t[0]),t.forEach((function(e){if(!e.prototype||!e.prototype.constructor)throw"Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(e));e.utils&&(Tt.utils=Y(Y({},Tt.utils),e.utils)),ze.mount(e)}))},Tt.create=function(e,t){return new Tt(e,t)},Tt.version="1.15.6";var Ot,_t,Nt,Vt,At,Rt,jt=[],Ut=!1;function Bt(){jt.forEach((function(e){clearInterval(e.pid)})),jt=[]}function Pt(){clearInterval(Rt)}var $t=Me((function(e,t,i,o){if(t.scroll){var s,n=(e.touches?e.touches[0]:e).clientX,l=(e.touches?e.touches[0]:e).clientY,r=t.scrollSensitivity,a=t.scrollSpeed,d=be(),c=!1;_t!==i&&(_t=i,Bt(),s=t.scrollFn,!0===(Ot=t.scroll)&&(Ot=qe(i,!0)));var h=0,u=Ot;do{var p=u,v=xe(p),m=v.top,f=v.bottom,g=v.left,b=v.right,x=v.width,w=v.height,y=void 0,k=void 0,E=p.scrollWidth,S=p.scrollHeight,q=me(p),C=p.scrollLeft,M=p.scrollTop;p===d?(y=x<E&&("auto"===q.overflowX||"scroll"===q.overflowX||"visible"===q.overflowX),k=w<S&&("auto"===q.overflowY||"scroll"===q.overflowY||"visible"===q.overflowY)):(y=x<E&&("auto"===q.overflowX||"scroll"===q.overflowX),k=w<S&&("auto"===q.overflowY||"scroll"===q.overflowY));var T=y&&(Math.abs(b-n)<=r&&C+x<E)-(Math.abs(g-n)<=r&&!!C),I=k&&(Math.abs(f-l)<=r&&M+w<S)-(Math.abs(m-l)<=r&&!!M);if(!jt[h])for(var L=0;L<=h;L++)jt[L]||(jt[L]={});jt[h].vx==T&&jt[h].vy==I&&jt[h].el===p||(jt[h].el=p,jt[h].vx=T,jt[h].vy=I,clearInterval(jt[h].pid),0==T&&0==I||(c=!0,jt[h].pid=setInterval(function(){o&&0===this.layer&&Tt.active._onTouchMove(At);var t=jt[this.layer].vy?jt[this.layer].vy*a:0,i=jt[this.layer].vx?jt[this.layer].vx*a:0;"function"==typeof s&&"continue"!==s.call(Tt.dragged.parentNode[He],i,t,e,At,jt[this.layer].el)||Te(jt[this.layer].el,i,t)}.bind({layer:h}),24))),h++}while(t.bubbleScroll&&u!==d&&(u=qe(u,!1)));Ut=c}}),30),Ft=function(e){var t=e.originalEvent,i=e.putSortable,o=e.dragEl,s=e.dispatchSortableEvent,n=e.unhideGhostForTarget;if(t){var l=i||e.activeSortable;(0,e.hideGhostForTarget)();var r=t.changedTouches&&t.changedTouches.length?t.changedTouches[0]:t,a=document.elementFromPoint(r.clientX,r.clientY);n(),l&&!l.el.contains(a)&&(s("spill"),this.onSpill({dragEl:o,putSortable:i}))}};function Qt(){}function Wt(){}Qt.prototype={startIndex:null,dragStart:function(e){this.startIndex=e.oldDraggableIndex},onSpill:function(e){var t=e.dragEl,i=e.putSortable;this.sortable.captureAnimationState(),i&&i.captureAnimationState();var o=ye(this.sortable.el,this.startIndex,this.options);o?this.sortable.el.insertBefore(t,o):this.sortable.el.appendChild(t),this.sortable.animateAll(),i&&i.animateAll()},drop:Ft},G(Qt,{pluginName:"revertOnSpill"}),Wt.prototype={onSpill:function(e){var t=e.dragEl,i=e.putSortable||this.sortable;i.captureAnimationState(),t.parentNode&&t.parentNode.removeChild(t),i.animateAll()},drop:Ft},G(Wt,{pluginName:"removeOnSpill"}),Tt.mount(new function(){function e(){for(var e in this.defaults={scroll:!0,forceAutoScrollFallback:!1,scrollSensitivity:30,scrollSpeed:10,bubbleScroll:!0},this)"_"===e.charAt(0)&&"function"==typeof this[e]&&(this[e]=this[e].bind(this))}return e.prototype={dragStarted:function(e){var t=e.originalEvent;this.sortable.nativeDraggable?re(document,"dragover",this._handleAutoScroll):re(document,this.options.supportPointer?"pointermove":t.touches?"touchmove":"mousemove",this._handleFallbackAutoScroll)},dragOverCompleted:function(e){var t=e.originalEvent;this.options.dragOverBubble||t.rootEl||this._handleAutoScroll(t)},drop:function(){this.sortable.nativeDraggable?ae(document,"dragover",this._handleAutoScroll):(ae(document,"pointermove",this._handleFallbackAutoScroll),ae(document,"touchmove",this._handleFallbackAutoScroll),ae(document,"mousemove",this._handleFallbackAutoScroll)),Pt(),Bt(),clearTimeout(ue),ue=void 0},nulling:function(){At=_t=Ot=Ut=Rt=Nt=Vt=null,jt.length=0},_handleFallbackAutoScroll:function(e){this._handleAutoScroll(e,!0)},_handleAutoScroll:function(e,t){var i=this,o=(e.touches?e.touches[0]:e).clientX,s=(e.touches?e.touches[0]:e).clientY,n=document.elementFromPoint(o,s);if(At=e,t||this.options.forceAutoScrollFallback||te||ee||oe){$t(e,this.options,n,t);var l=qe(n,!0);!Ut||Rt&&o===Nt&&s===Vt||(Rt&&Pt(),Rt=setInterval((function(){var n=qe(document.elementFromPoint(o,s),!0);n!==l&&(l=n,Bt()),$t(e,i.options,n,t)}),10),Nt=o,Vt=s)}else{if(!this.options.bubbleScroll||qe(n,!0)===be())return void Bt();$t(e,this.options,qe(n,!1),!1)}}},G(e,{pluginName:"scroll",initializeByDefault:!0})}),Tt.mount(Wt,Qt);const Yt='<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>',Jt=class{constructor(i){e(this,i),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=l.getDefault(),this.templateId="",this.showingRoleDialog=null,this.sender=null,this.dragging=!1,this.loading=!0,this.template=null}disconnectedCallback(){this.unlistenToTemplate()}async listenToTemplate(){console.log("[ROLES] Loading template",this.templateId),this.unlistenToTemplate(),y.subscribe("templates",this.templateId,(()=>r(this.endpoint,this.templateId)),!1,(e=>{console.log("[ROLES] Template Updated",e),this.template=e,this.loading=!1}))}unlistenToTemplate(){this.templateListenerId&&(y.store.delListener(this.templateListenerId),this.templateListenerId=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(o){console.log("[FIELDS] Error with preview session",o),null===(e=this.sdkError)||void 0===e||e.emit(new w(o.message,null===(t=o.response)||void 0===t?void 0:t.status,null===(i=o.response)||void 0===i?void 0:i.data))}}componentDidRender(){const e=this.getSequenceNumbers();(e||[]).forEach((e=>{const t=document.getElementById(`verdocs-roles-sequence-${e}`);t&&new Tt(t,{group:"roles",animation:150,dragoverBubble:!0,filter:".no-drag",onEnd:this.handleMoveEnd.bind(this),onChoose:()=>this.dragging=!0,onUnchoose:()=>this.dragging=!1})}));const t=document.getElementById(`verdocs-roles-sequence-${e.length+1}`);t&&new Tt(t,{group:"roles",animation:150,dragoverBubble:!0,filter:".no-drag",onEnd:this.handleMoveEnd.bind(this),onChoose:()=>this.dragging=!0,onUnchoose:()=>this.dragging=!1})}handleMoveEnd(e){const t=+e.from.id.split("-").pop(),i=+e.to.id.split("-").pop(),o=+e.oldIndex+1,s=+e.newIndex+1,n={},l=this.getSequenceNumbers();l.forEach((e=>{n[e]=JSON.parse(JSON.stringify(this.getRolesAtSequence(e)))})),n[l.length+1]=[];const r=n[t].splice(o-1,1)[0];n[i].splice(s-1,0,r);const a=[];return Object.entries(n).forEach((([e,t])=>{t.forEach(((t,i)=>{console.log("Evaluating role",t.name,t.sequence,t.order);const o=+i+1;t.sequence===+e&&t.order===o||(t.sequence=+e,t.order=o,a.push(b(this.endpoint,this.templateId,t.name,{sequence:+e,order:o}).then((e=>console.log("[ROLES] Updated role",t.name,e))).catch((e=>console.log("[ROLES] Error updating role",e)))))}))})),console.log(`[ROLES] Awaiting ${a.length} renumber requests`,a),Promise.all(a).then((async()=>{JSON.parse(JSON.stringify(this.template)).roles=Object.keys(n).reduce(((e,t)=>e.concat(n[t])),[]),await y.getTemplate(this.endpoint,this.templateId,!0)}))}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(){var e;const t=((null===(e=this.template)||void 0===e?void 0:e.roles)||[]).map((e=>e.sequence)),i=[...new Set(t)];return i.sort(((e,t)=>e-t)),i}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(){var e;const t={},i=[],o=this.getSequenceNumbers();console.log("Sorting sequences",o),(o||[]).forEach((e=>{(t[e]||[]).forEach(((t,o)=>{const s=+o+1;t.sequence===+e&&t.order===s||(console.log("[ROLES] Updating role",t.name,"from",t.sequence,t.order,"to",e,s),t.sequence=+e,t.order=s,i.push(b(this.endpoint,this.templateId,t.name,{sequence:+e,order:s}).then((e=>console.log("[ROLES] Updated role",t.name,e))).catch((e=>console.log("[ROLES] Error updating role",e)))))}))})),console.log("Sortable Roles",t),console.log(`[ROLES] Awaiting ${i.length} renumber requests`),await Promise.all(i).then((async()=>{const e=JSON.parse(JSON.stringify(this.template));e.roles=Object.keys(t).reduce(((e,i)=>e.concat(t[i])),[]),console.log("[ROLES] Done renumbering",e.roles.map((e=>({name:e.name,sequence:e.sequence,order:e.order})))),y.updateTemplate(this.templateId,e)})),null===(e=this.rolesUpdated)||void 0===e||e.emit({event:"updated",endpoint:this.endpoint,templateId:this.templateId,roles:this.getSortedRoles()})}getNextRoleName(){var e,t;let i="",o=((null===(e=this.template)||void 0===e?void 0:e.roles)||[]).length;do{o++,i=`Recipient ${o}`}while(!i||((null===(t=this.template)||void 0===t?void 0:t.roles)||[]).some((e=>e&&e.name===i)));return i}callCreateRole(e,t,i){console.log("[ROLES] Will create role",{name:e,sequence:t,order:i}),x(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:!1,kba_method:null}).then((async e=>{var t;console.log("[ROLES] Created role",e),console.log("Updating template in data store"),await y.getTemplate(this.endpoint,this.templateId,!0),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 i=this.getRolesAtSequence(t).length+1,o=this.getNextRoleName();this.callCreateRole(o,t,i)}handleAddStep(e,t){e.stopPropagation();const i=this.getNextRoleName();this.callCreateRole(i,t,1)}render(){if(!this.endpoint.session)return i(o,null,i("verdocs-component-error",{message:"You must be authenticated to use this module."}));if(this.loading||!this.template)return i(o,{class:"loading"},i("verdocs-loader",null));console.log("[ROLES] Rendering",this.template.roles.map((e=>({name:e.name,sequence:e.sequence,order:e.order}))));const e=this.getRoleNames(),t=this.getSequenceNumbers();return console.log("Rendering sequences",t,e),i(o,{class:{dragging:this.dragging}},i("form",{onSubmit:e=>e.preventDefault(),onClick:e=>e.stopPropagation(),autocomplete:"off"},i("h5",null,"Roles and Workflow"),i("div",{class:"roles"},t.map((e=>i("div",{class:"sequence"},i("div",{class:"sequence-label no-drag"},e,"."),i("div",{class:"sequence-roles",id:`verdocs-roles-sequence-${e}`,"data-sequence":e},this.getRolesAtSequence(e).map((t=>i("div",{class:"role","data-rolename":t.name,"data-sequence":e,"data-order":t.order},i("div",{class:"role-name"},t.email?p(t):t.name),i("div",{class:"icons"},i("div",{class:"gear-button",innerHTML:'<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>',onClick:()=>this.showingRoleDialog=t.name,"aria-role":"button"}),i("span",{class:"type-icon",innerHTML:"signer"===t.type?'<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>':"cc"===t.type?'<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path d="M1.5 8.67v8.58a3 3 0 003 3h15a3 3 0 003-3V8.67l-8.928 5.493a3 3 0 01-3.144 0L1.5 8.67z" /><path d="M22.5 6.908V6.75a3 3 0 00-3-3h-15a3 3 0 00-3 3v.158l9.714 5.978a1.5 1.5 0 001.572 0L22.5 6.908z" /></svg>':'<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill-rule="evenodd" d="M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12zm13.36-1.814a.75.75 0 10-1.22-.872l-3.236 4.53L9.53 12.22a.75.75 0 00-1.06 1.06l2.25 2.25a.75.75 0 001.14-.094l3.75-5.25z" clip-rule="evenodd" /></svg>'})))))),i("button",{class:"add-role no-drag",innerHTML:Yt,onClick:t=>this.handleAddRole(t,e)})))),i("div",{class:"sequence add-sequence"},i("div",{class:"sequence-label no-drag"},t.length+1,"."),i("div",{class:"sequence-roles",id:`verdocs-roles-sequence-${t.length+1}`,"data-sequence":t.length+1}),i("button",{class:"add-role no-drag",innerHTML:Yt,onClick:e=>this.handleAddRole(e,t.length+1)}))),e.length<1&&i("div",{class:"empty"},"You must add at least one Role before proceeding.",i("br",null)," Click the ",i("span",{innerHTML:Yt})," Add button above to get started."),i("div",{class:"buttons"},i("div",{class:"flex-fill"}),i("verdocs-button",{variant:"outline",label:"Cancel",size:"small",onClick:()=>this.handleCancel()}),i("verdocs-button",{label:"OK",size:"small",onClick:()=>this.handleSubmit(),disabled:e.length<1}))),this.showingRoleDialog&&i("verdocs-menu-panel",{onClose:()=>this.showingRoleDialog=null},i("verdocs-template-role-properties",{endpoint:this.endpoint,templateId:this.templateId,roleName:this.showingRoleDialog,onClose:()=>{var e;null===(e=document.getElementById("verdocs-menu-panel-overlay"))||void 0===e||e.remove(),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 n(this)}};Jt.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;max-width:600px;font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-template-roles .roles{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:10px;margin-top:10px}verdocs-template-roles .roles .sequence{gap:10px;height:34px;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;font-weight:500;padding:0 0 8px 0;-ms-flex-direction:row;flex-direction:row;border-bottom:1px dotted #e3e3e3}verdocs-template-roles .roles .sequence.add-sequence{color:#777777;line-height:34px}verdocs-template-roles .roles .sequence-label{font-size:18px;line-height:32px}verdocs-template-roles .roles .sequence-roles{gap:10px;display:-ms-flexbox;display:flex;position:relative;-ms-flex-wrap:wrap;flex-wrap:wrap;font-weight:500;-ms-flex-direction:row;flex-direction:row}verdocs-template-roles .roles .role{height:32px;cursor:move;display:-ms-flexbox;display:flex;max-width:200px;position:relative;border-radius:32px;background-color:#eff7fb;-webkit-box-sizing:border-box;box-sizing:border-box;padding:0 14px 0 34px;border:1px solid #ccc;-ms-flex-direction:column;flex-direction:column}verdocs-template-roles .roles .role .role-name{font-size:14px;overflow:hidden;font-weight:400;line-height:30px;white-space:nowrap;text-overflow:ellipsis}verdocs-template-roles .roles .role .icons{position:absolute;left:1px;top:-3px;cursor:pointer;padding:5px;z-index:10}verdocs-template-roles .roles .role .icons .gear-button{display:none;-webkit-transform:scale(1.1);transform:scale(1.1);margin:4px 0 0 1px}verdocs-template-roles .roles .role .icons .type-icon{opacity:0.6;display:block;-webkit-transform:scale(0.8);transform:scale(0.8)}verdocs-template-roles .roles .role .icons:hover .gear-button{display:block}verdocs-template-roles .roles .role .icons:hover .type-icon{display:none}verdocs-template-roles>form{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;background-color:#ffffff;padding:12px}verdocs-template-roles>form h5{font-size:16px;font-weight:bold;color:#46497d;margin:0 0 10px 0}verdocs-template-roles>form label{display:block;font-size:14px;font-weight:500;margin:0 0 4px 0;color:#5c6575}verdocs-template-roles>form input{border:none;font-size:18px;padding:3px 6px 3px 0;background:transparent;border-bottom:1px solid #33364b}verdocs-template-roles>form input:focus{outline:none}verdocs-template-roles .row.add-sequence{display:none}verdocs-template-roles .add-role{margin:0;padding:0;border:none;opacity:0.3;cursor:pointer;background:none;-webkit-transform:scale(0.75);transform:scale(0.75)}verdocs-template-roles .add-role:hover{opacity:1}verdocs-template-roles .add-role svg{width:32px;height:32px}verdocs-template-roles .add-step{margin:0;padding:0;border:none;opacity:0.5;cursor:pointer;background:none}verdocs-template-roles .add-step:hover{opacity:1}verdocs-template-roles .add-step svg{width:32px;height:32px}verdocs-template-roles.dragging .row.add-sequence{display:-ms-flexbox;display:flex}verdocs-template-roles .buttons{display:-ms-flexbox;display:flex;-webkit-column-gap:8px;-moz-column-gap:8px;column-gap:8px;margin-top:16px;-ms-flex-direction:row;flex-direction:row}verdocs-template-roles .empty{font-size:13px;margin-top:15px;margin-bottom:5px}verdocs-template-roles .empty svg{width:16px;height:16px;stroke:#666666;margin-bottom:2px;display:inline-block}verdocs-template-roles.dragging .roles .sequence.add-sequence .add-role,verdocs-template-roles.dragging .roles .sequence.add-sequence .add-step-label{display:none}verdocs-template-roles.dragging .roles .sequence.add-sequence .sequence-roles{display:-ms-flexbox;display:flex;min-width:150px;background:#e0e0e0}verdocs-template-roles ::-webkit-input-placeholder{color:#aaaaaa}verdocs-template-roles ::-moz-placeholder{color:#aaaaaa}verdocs-template-roles :-ms-input-placeholder{color:#aaaaaa}verdocs-template-roles ::-ms-input-placeholder{color:#aaaaaa}verdocs-template-roles ::placeholder{color:#aaaaaa}';export{V as verdocs_preview,j as verdocs_send,U as verdocs_template_attachments,P as verdocs_template_build_tabs,Q as verdocs_template_fields,Jt as verdocs_template_roles}
@@ -1 +0,0 @@
1
- var __awaiter=this&&this.__awaiter||function(e,t,i,n){function s(e){return e instanceof i?e:new i((function(t){t(e)}))}return new(i||(i=Promise))((function(i,r){function o(e){try{l(n.next(e))}catch(e){r(e)}}function a(e){try{l(n["throw"](e))}catch(e){r(e)}}function l(e){e.done?i(e.value):s(e.value).then(o,a)}l((n=n.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:[]},n,s,r,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(e){return function(t){return l([e,t])}}function l(a){if(n)throw new TypeError("Generator is already executing.");while(o&&(o=0,a[0]&&(i=0)),i)try{if(n=1,s&&(r=a[0]&2?s["return"]:a[0]?s["throw"]||((r=s["return"])&&r.call(s),0):s.next)&&!(r=r.call(s,a[1])).done)return r;if(s=0,r)a=[a[0]&2,r.value];switch(a[0]){case 0:case 1:r=a;break;case 4:i.label++;return{value:a[1],done:false};case 5:i.label++;s=a[1];a=[0];continue;case 7:a=i.ops.pop();i.trys.pop();continue;default:if(!(r=i.trys,r=r.length>0&&r[r.length-1])&&(a[0]===6||a[0]===2)){i=0;continue}if(a[0]===3&&(!r||a[1]>r[0]&&a[1]<r[3])){i.label=a[1];break}if(a[0]===6&&i.label<r[1]){i.label=r[1];r=a;break}if(r&&i.label<r[2]){i.label=r[2];i.ops.push(a);break}if(r[2])i.ops.pop();i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e];s=0}finally{n=r=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(e,t,i){if(i||arguments.length===2)for(var n=0,s=t.length,r;n<s;n++){if(r||!(n in t)){if(!r)r=Array.prototype.slice.call(t,0,n);r[n]=t[n]}}return e.concat(r||Array.prototype.slice.call(t))};System.register(["./p-9186f42e.system.js","@verdocs/js-sdk","./p-f29eb00a.system.js","./p-9b26e4e0.system.js","./p-c8a15cb7.system.js","./p-35dcb386.system.js","./p-21b1acec.system.js","./p-d738b5db.system.js","./p-2c5350ec.system.js"],(function(e){"use strict";var t,i,n,s,r,o,a,l,c,d,u,h,f,v,p,g,m,x,b,y,w,S,k,_,N,I,G,P,z,A,E,U,T,j,D;return{setters:[function(e){t=e.r;i=e.c;n=e.h;s=e.H;r=e.F},function(e){o=e.VerdocsEndpoint;a=e.startSigningSession;l=e.getKbaStep;c=e.envelopeRecipientAgree;d=e.envelopeRecipientDecline;u=e.updateEnvelopeField;h=e.createSignature;f=e.updateEnvelopeFieldSignature;v=e.createInitials;p=e.updateEnvelopeFieldInitials;g=e.isValidPhone;m=e.isValidEmail;x=e.sortFields;b=e.envelopeRecipientSubmit;y=e.getEnvelope;w=e.uploadEnvelopeFieldAttachment;S=e.deleteEnvelopeFieldAttachment;k=e.formatFullName;_=e.fullNameToInitials;N=e.submitKbaPin;I=e.submitKbaIdentity;G=e.submitKbaChallengeResponse;P=e.integerSequence},function(e){z=e.a;A=e.u;E=e.r;U=e.g},function(e){T=e.V},function(e){j=e.S},function(e){D=e.S},function(){},function(){},function(){}],execute:function(){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)}}verdocs-sign{display:-ms-flexbox;display:flex;overflow:hidden;position:relative;min-height:600px;-ms-flex-direction:column;flex-direction:column;-webkit-box-sizing:border-box;box-sizing:border-box;font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-sign div{display:block;-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-sign input{vertical-align:top}verdocs-sign>.document{-ms-flex:1;flex:1;width:100%;height:100%;-ms-flex-item-align:center;align-self:center;display:-ms-flexbox;display:flex;padding:15px;row-gap:15px;max-width:1200px;min-height:200px;position:relative;overflow-y:scroll;-ms-flex-align:center;align-items:center;-webkit-box-sizing:border-box;box-sizing:border-box;-ms-flex-direction:column;flex-direction:column}verdocs-sign>.document .inner{width:100%;max-width:1028px}verdocs-sign .cover{top:0;left:0;right:0;bottom:0;display:-ms-flexbox;display:flex;z-index:5000;position:absolute;padding-top:100px;-ms-flex-align:center;align-items:center;-ms-flex-direction:column;flex-direction:column;background:rgba(0, 0, 0, 0.5)}verdocs-sign .agree{-ms-flex:0;flex:0;width:600px;display:-ms-flexbox;display:flex;max-width:90%;padding:30px 15px;-ms-flex-direction:column;flex-direction:column;background-color:#ffffff}verdocs-sign .agree .header{-ms-flex:0 0 56px;flex:0 0 56px}verdocs-sign .agree li{margin:0.5em 0}verdocs-sign verdocs-ok-dialog .background-overlay{-ms-flex-align:start;align-items:flex-start;padding-top:100px}verdocs-sign .loading-indicator{top:0;left:0;right:0;bottom:0;display:-ms-flexbox;display:flex;z-index:10000;position:fixed;background-color:rgba(0, 0, 0, 0.7)}verdocs-sign .fatal-error{position:absolute;z-index:100;top:0;left:0;right:0;bottom:0;background-color:#4a4a4a;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}verdocs-sign .fatal-error .placeholder{position:absolute;opacity:0.1;z-index:-1;top:0;left:0;right:0;bottom:0;width:612px;height:792px;-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);margin-top:15px}verdocs-sign .fatal-error .message{width:50%;font-size:16px;background:white;border-radius:5px;-webkit-box-shadow:3px 3px 9px -1px rgba(0, 0, 0, 0.2470588235);box-shadow:3px 3px 9px -1px rgba(0, 0, 0, 0.2470588235)}verdocs-sign .fatal-error .header{color:white;font-size:18px;font-weight:500;padding:5px 10px;margin:0 0 10px 0;background:#654dcb}verdocs-sign .fatal-error p{margin:1rem;font-size:14px;font-weight:400}@media print{verdocs-sign .header{display:none}}#verdocs-sign-header{color:#fff;width:100%;display:-ms-flexbox;display:flex;z-index:1000;-ms-flex:0 0 46px;flex:0 0 46px;font-size:12px;-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;-webkit-transition:all 0.25s;transition:all 0.25s;background-color:#33354c;-webkit-box-shadow:0 4px 4px 0 rgba(0, 0, 0, 0.24), 0 0 4px 0 rgba(0, 0, 0, 0.12);box-shadow:0 4px 4px 0 rgba(0, 0, 0, 0.24), 0 0 4px 0 rgba(0, 0, 0, 0.12)}#verdocs-sign-header .inner{width:100%;display:-ms-flexbox;display:flex;margin:0 auto;padding:0 12px;max-width:1200px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row}#verdocs-sign-header .logo{width:80px;display:none;margin:-6px 0 0 0}#verdocs-sign-header .title{font-size:18px;font-weight:500;overflow:hidden;white-space:nowrap;padding:0 10px 0 0;text-overflow:ellipsis}.spinner-overlay{position:fixed;top:0;left:0;right:0;bottom:0;z-index:1000;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;background:rgba(0, 0, 0, 0.4980392157);-ms-flex-pack:center;justify-content:center}';var V=L;var Y=[{id:"later",label:"Finish Later"},{id:"decline",label:"Decline to Sign"},{id:"print",label:"Print Without Signing"},{id:"download",label:"Download"}];var q=[{id:"print",label:"Print"},{id:"download",label:"Download"}];var B=e("verdocs_sign",function(){function e(e){t(this,e);this.sdkError=i(this,"sdkError",7);this.envelopeLoaded=i(this,"envelopeLoaded",7);this.envelopeUpdated=i(this,"envelopeUpdated",7);this.recipientIndex=-1;this.endpoint=null;this.envelopeId=null;this.roleId=null;this.inviteCode=null;this.headerTargetId=null;this.roleNames=[];this.sortedRecipients=[];this.recipient=null;this.hasSignature=false;this.nextButtonLabel="Start";this.nextSubmits=false;this.fatalErrorHeader="";this.fatalErrorMessage="";this.focusedField="";this.submitting=false;this.submitted=false;this.isDone=false;this.showDone=false;this.showLoadError=false;this.finishLater=false;this.showFinishLater=false;this.agreed=false;this.documentsSingularPlural="document";this.kbaStep="";this.kbaQuestions=[];this.showSpinner=false;this.kbaChoices=[];this.loading=true;this.envelope=null}e.prototype.componentWillLoad=function(){if(!this.endpoint){console.log("[SIGN] Creating signing endpoint");this.endpoint=new o({sessionType:"signing"})}};e.prototype.componentDidLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,i,n,s,r,o,c,d,u,h;var f=this;return __generator(this,(function(v){switch(v.label){case 0:if(!this.envelopeId){(e=this.sdkError)===null||e===void 0?void 0:e.emit(new j("[SIGN] Missing required envelopId",500,""));return[2]}if(!this.roleId){(t=this.sdkError)===null||t===void 0?void 0:t.emit(new j("[SIGN] Missing required roleId",500,""));return[2]}if(!this.inviteCode){(i=this.sdkError)===null||i===void 0?void 0:i.emit(new j("[SIGN] Missing required inviteCode",500,""));return[2]}v.label=1;case 1:v.trys.push([1,3,,4]);console.log("[SIGN] Processing invite code for ".concat(this.envelopeId," / ").concat(this.roleId));return[4,a(this.endpoint,this.envelopeId,this.roleId,this.inviteCode)];case 2:c=v.sent(),d=c.envelope,u=c.recipient;console.log("[SIGN] Loaded signing session",d,u);this.recipient=u;this.envelope=d;D.updateEnvelope(this.envelopeId,d);this.sortedRecipients=__spreadArray([],this.envelope.recipients,true);this.sortedRecipients.sort((function(e,t){return e.sequence===t.sequence?e.order-t.order:e.sequence-t.sequence}));this.roleNames=this.sortedRecipients.map((function(e){return e.role_name}));if(this.envelope.documents.length>0){this.documentsSingularPlural="document(s)"}this.recipientIndex=this.roleNames.findIndex((function(e){return e==f.roleId}));if(this.recipientIndex>-1){this.recipient=this.sortedRecipients[this.recipientIndex];this.agreed=this.recipient.agreed}else{console.warn("[SIGN] Could not find our recipient record",this.roleId,this.sortedRecipients)}this.submitted=this.recipient.status==="submitted";this.isDone=this.submitted;this.showDone=this.submitted;if(this.envelope.status==="canceled"){this.fatalErrorHeader="Unable to Start Signing Session";this.fatalErrorMessage="This envelope has been canceled. Please contact its sender for more information."}else if(this.recipient.status==="declined"){this.fatalErrorHeader="Unable to Start Signing Session";this.fatalErrorMessage="You have declined to sign this envelope."}else if(this.agreed){this.nextButtonLabel="Next"}this.checkRecipientFields();(n=this.envelopeLoaded)===null||n===void 0?void 0:n.emit({endpoint:this.endpoint,envelope:this.envelope});if(!this.isDone){l(this.endpoint,this.envelopeId,this.roleId).then((function(e){var t;console.log("[SIGN] KBA Step",e);f.kbaStep=e.kba_step;if(f.kbaStep==="failed"){f.fatalErrorHeader="Identity Verification Failed";f.fatalErrorMessage="We were unable to verify your identity. Please contact the document's sender.";f.isDone=true}else{f.kbaQuestions=((t=e.questions)===null||t===void 0?void 0:t.question)||[];f.kbaChoices=[]}})).catch((function(e){return console.log("Error getting KBA step",e)}))}return[3,4];case 3:h=v.sent();console.log("[SIGN] Error with signing session",h);(s=this.sdkError)===null||s===void 0?void 0:s.emit(new j(h.message,(r=h.response)===null||r===void 0?void 0:r.status,(o=h.response)===null||o===void 0?void 0:o.data));this.showLoadError=true;return[3,4];case 4:return[2]}}))}))};e.prototype.componentDidRender=function(){var e=this.headerTargetId?document.getElementById(this.headerTargetId):null;var t=document.getElementById("verdocs-sign-header");if(e&&t){console.log("[SIGN] Moving header");t.remove();e.append(t)}};e.prototype.handleClickAgree=function(){var e=this;this.submitting=true;c(this.endpoint,this.envelopeId,this.roleId,true).then((function(){var t;e.nextButtonLabel="Next";e.recipient.agreed=true;e.submitting=false;e.agreed=true;(t=e.envelopeUpdated)===null||t===void 0?void 0:t.emit({endpoint:e.endpoint,envelope:e.envelope,event:"agreed"})})).catch((function(t){var i,n,s;console.log("[SIGN] Update failure",t);e.submitting=false;(i=e.sdkError)===null||i===void 0?void 0:i.emit(new j(t.message,(n=t.response)===null||n===void 0?void 0:n.status,(s=t.response)===null||s===void 0?void 0:s.data))}))};e.prototype.handleOptionSelected=function(e){return __awaiter(this,void 0,void 0,(function(){var t,i,n,s,r,o,a,l;return __generator(this,(function(c){switch(c.label){case 0:o=e.detail.id;switch(o){case"later":return[3,1];case"claim":return[3,2];case"decline":return[3,3];case"print":return[3,5];case"download":return[3,6]}return[3,7];case 1:this.finishLater=true;this.showFinishLater=true;(t=this.envelopeUpdated)===null||t===void 0?void 0:t.emit({endpoint:this.endpoint,envelope:this.envelope,event:"later"});return[3,7];case 2:T("This feature will be available in an upcoming release.");(i=this.envelopeUpdated)===null||i===void 0?void 0:i.emit({endpoint:this.endpoint,envelope:this.envelope,event:"claimed"});return[3,7];case 3:this.submitting=true;return[4,d(this.endpoint,this.envelopeId,this.roleId)];case 4:a=c.sent();console.log("[SIGN] Decline result",a);(n=this.envelopeUpdated)===null||n===void 0?void 0:n.emit({endpoint:this.endpoint,envelope:this.envelope,event:"declined"});this.submitting=false;this.fatalErrorHeader="Unable to Start Signing Session";this.fatalErrorMessage="You have declined to sign this envelope.";return[3,7];case 5:window.print();(s=this.envelopeUpdated)===null||s===void 0?void 0:s.emit({endpoint:this.endpoint,envelope:this.envelope,event:"printed"});return[3,7];case 6:{l=this.envelope.documents.find((function(e){return e.type==="attachment"}));if(l){z(this.endpoint,this.envelope,l.id).catch((function(e){console.log("[SIGN] Error downloading PDF",e)}));(r=this.envelopeUpdated)===null||r===void 0?void 0:r.emit({endpoint:this.endpoint,envelope:this.envelope,event:"downloaded"})}}return[3,7];case 7:return[2]}}))}))};e.prototype.updateRecipientFieldValue=function(e,t){var i=this;console.log("[SIGN] updateRecipientFieldValue",e);this.getRecipientFields().forEach((function(n){if(n.name===e){n.value=t.value;n.settings=t.settings;A(n);i.checkRecipientFields()}}))};e.prototype.saveFieldChange=function(e,t){var i=this;console.log("[SIGN] updateRecipientFieldValue",e);u(this.endpoint,this.envelopeId,e,t).then((function(t){return i.updateRecipientFieldValue(e,t)})).catch((function(e){var t,n,s,r,o,a;if(((t=e.response)===null||t===void 0?void 0:t.status)===401&&((s=(n=e.response)===null||n===void 0?void 0:n.data)===null||s===void 0?void 0:s.error)==="jwt expired"){console.log("[SIGN] Signing session expired");i.fatalErrorHeader="Signing Session Expired";i.fatalErrorMessage="Please reload your browser to continue."}else{console.log("[SIGN] Server error",e)}(r=i.sdkError)===null||r===void 0?void 0:r.emit(new j(e.message,(o=e.response)===null||o===void 0?void 0:o.status,(a=e.response)===null||a===void 0?void 0:a.data))}))};e.prototype.handleFieldChange=function(e,t){return __awaiter(this,void 0,void 0,(function(){var i,n,s,r,o,a,l;var c=this;return __generator(this,(function(d){switch(d.label){case 0:i=t.target,n=i.value,s=i.checked;r=e.type;switch(r){case"textarea":return[3,1];case"textbox":return[3,1];case"checkbox":return[3,2];case"radio":return[3,3];case"dropdown":return[3,4];case"initial":return[3,5];case"signature":return[3,8];case"date":return[3,11];case"timestamp":return[3,12]}return[3,13];case 1:return[2,this.saveFieldChange(e.name,{prepared:false,value:n})];case 2:{return[2,this.saveFieldChange(e.name,{prepared:false,value:String(t.target.checked)})]}d.label=3;case 3:{return[2,this.saveFieldChange(e.name,{prepared:false,value:String(t.target.checked)})]}d.label=4;case 4:console.log("Saving dropdown",e.name,t.detail);return[2,this.saveFieldChange(e.name,{prepared:false,value:t.detail})];case 5:if(!t.detail){return[2]}this.showSpinner=true;return[4,fetch(t.detail)];case 6:return[4,d.sent().blob()];case 7:o=d.sent();return[2,v(this.endpoint,"initial",o).then((function(t){return __awaiter(c,void 0,void 0,(function(){var i;return __generator(this,(function(n){switch(n.label){case 0:return[4,p(this.endpoint,this.envelopeId,e.name,t.id)];case 1:i=n.sent();this.updateRecipientFieldValue(e.name,i);this.showSpinner=false;return[2]}}))}))})).catch((function(e){console.log("Error updating initials",e);c.showSpinner=false}))];case 8:if(!t.detail){return[2]}this.showSpinner=true;return[4,fetch(t.detail)];case 9:return[4,d.sent().blob()];case 10:a=d.sent();return[2,h(this.endpoint,"signature",a).then((function(t){return __awaiter(c,void 0,void 0,(function(){var i;return __generator(this,(function(n){switch(n.label){case 0:console.log("Signature update result",t);return[4,f(this.endpoint,this.envelopeId,e.name,t.id)];case 1:i=n.sent();this.updateRecipientFieldValue(e.name,i);this.showSpinner=false;return[2]}}))}))})).catch((function(e){console.warn("[SIGN] Error updating signature",e);c.showSpinner=false}))];case 11:l=t.detail.formattedDate;if(l){return[2,this.saveFieldChange(e.name,{prepared:false,value:l})]}return[3,14];case 12:console.log("[SIGN] Updating timestamp",{value:n,ts:t.target.getAttribute("timestamp")});return[3,14];case 13:console.log("[SIGN] Unhandled field update",{value:n,checked:s},e);return[3,14];case 14:return[2]}}))}))};e.prototype.isFieldFilled=function(e){var t=e.value,i=t===void 0?"":t;switch(e.type){case"textarea":case"textbox":switch(e.validator||""){case"email":return m(i);case"phone":return g(i);default:return(i||"").trim()!==""}case"signature":return i==="signed";case"initial":return i==="initialed";case"timestamp":return true;case"date":return!!i;case"attachment":return i==="attached";case"dropdown":return i!=="";case"checkbox":return i==="true";case"radio":if(!!e.group){return this.getRecipientFields().filter((function(t){return t.group===e.group})).some((function(e){return e.value==="true"}))}return e.value==="true";default:return false}};e.prototype.isFieldValid=function(e){return!e.required||this.isFieldFilled(e)};e.prototype.getSortedFillableFields=function(){var e=this.getRecipientFields().filter((function(e){return e.type!=="timestamp"}));x(e);return e};e.prototype.handleNext=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,i,n,s,r,o,a,l,c;var d=this;return __generator(this,(function(u){switch(u.label){case 0:if(!this.nextSubmits)return[3,5];u.label=1;case 1:u.trys.push([1,3,,4]);(e=document.getElementById("air-datepicker-global-container"))===null||e===void 0?void 0:e.remove();this.submitting=true;return[4,b(this.endpoint,this.envelopeId,this.roleId)];case 2:t=u.sent();console.log("[SIGN] Submitted successfully",t);this.recipient.status="submitted";this.showDone=true;console.log("[SIGN] Reloading envelope");y(this.endpoint,this.envelopeId).then((function(e){d.envelope=e;d.submitting=false})).catch((function(e){console.log("[SIGN] Error reloading envelope",e);d.submitting=false}));return[3,4];case 3:i=u.sent();console.log("[SIGN] Error submitting",i);return[3,4];case 4:return[2];case 5:n=this.getSortedFillableFields().filter((function(e){return e.required&&!d.isFieldFilled(e)}));x(n);s=n.findIndex((function(e){return e.name===d.focusedField}));r=s+1;if(r>=n.length){r=0}o=n[r];a=0;if(a<n.length&&["signature","initial"].includes(o.type)&&["initialed","signed"].includes(o.value)){a++;r++;if(r>=n.length){r=0}o=n[r]}if(a>=n.length){o=null}if(o){l=U(o);c=document.getElementById(l);c===null||c===void 0?void 0:c.scrollIntoView({behavior:"smooth"});c===null||c===void 0?void 0:c.focusField();this.focusedField=o.name}return[2]}}))}))};e.prototype.getRecipientFields=function(){var e=this;return this.envelope.fields.filter((function(t){return t.role_name===e.recipient.role_name}))};e.prototype.checkRecipientFields=function(){var e=this;var t=this.getRecipientFields().filter((function(t){return!e.isFieldValid(t)}));if(t.length<1){this.nextButtonLabel="Finish";if(!this.nextSubmits){this.nextSubmits=true}}else{console.log("[SIGN] Invalid fields remaining",t.map((function(e){return e.name})));this.nextButtonLabel="Next";this.nextSubmits=false}};e.prototype.attachFieldAttributes=function(e,t,i){var n=this;if(i.getAttribute("attached")==="1"){return}i.setAttribute("attached","1");i.addEventListener("input",(function(e){if(e.target.type==="radio"||e.target.type==="checkbox"){n.handleFieldChange(t,e).finally((function(){return n.checkRecipientFields()}))}else{n.checkRecipientFields()}}));i.addEventListener("attached",(function(i){return __awaiter(n,void 0,void 0,(function(){var n,s,r;return __generator(this,(function(o){switch(o.label){case 0:console.log("[SIGN] onAttached",i.detail,i.target.value);this.showSpinner=true;o.label=1;case 1:o.trys.push([1,3,,4]);return[4,w(this.endpoint,this.envelopeId,t.name,i.detail)];case 2:n=o.sent();this.updateRecipientFieldValue(t.name,n);this.checkRecipientFields();s=E("envelope",t,e,{disabled:false,editable:false,draggable:false,done:this.isDone});this.attachFieldAttributes(e,t,s);this.showSpinner=false;return[3,4];case 3:r=o.sent();console.log("Error uploading attachment",r);T("Unable to upload attachment, please try again later",{style:"error"});this.showSpinner=false;return[3,4];case 4:return[2]}}))}))}));i.addEventListener("deleted",(function(i){return __awaiter(n,void 0,void 0,(function(){var n,s,r;return __generator(this,(function(o){switch(o.label){case 0:console.log("[SIGN] onDeleted",i.detail,i.target.value);this.showSpinner=true;o.label=1;case 1:o.trys.push([1,3,,4]);return[4,S(this.endpoint,this.envelopeId,t.name)];case 2:n=o.sent();console.log("[SIGN] Deleted attachment",n);this.updateRecipientFieldValue(t.name,n);this.checkRecipientFields();s=E("envelope",t,e,{disabled:false,editable:false,draggable:false,done:this.isDone});this.attachFieldAttributes(e,t,s);this.showSpinner=false;return[3,4];case 3:r=o.sent();console.log("Error uploading attachment",r);T("Unable to upload attachment, please try again later",{style:"error"});this.showSpinner=false;return[3,4];case 4:return[2]}}))}))}));i.addEventListener("focusout",(function(e){if(t.type!=="dropdown"&&t.type!=="attachment"){n.handleFieldChange(t,e).finally((function(){return n.checkRecipientFields()}))}}));i.addEventListener("fieldChange",(function(e){n.handleFieldChange(t,e).finally((function(){return n.checkRecipientFields()}))}));i.setAttribute("templateid",this.envelope.template_id);i.setAttribute("fieldname",t.name);i.setAttribute("page",e.pageNumber);i.setAttribute("xScale",e.xScale);i.setAttribute("yScale",e.yScale);var s=k(this.recipient);i.setAttribute("initials",_(s));i.setAttribute("name",s)};e.prototype.handlePageRendered=function(e){var t=this;var i=e.detail;var n=this.getSortedFillableFields();console.log("[SIGN] Rendering fields for page",i.pageNumber,n);n.forEach((function(e,n){if(e.page!==i.pageNumber){return}var s=E("envelope",e,i,{disabled:false,editable:false,draggable:false,done:t.isDone},n);if(!s){return}if(Array.isArray(s)){s.map((function(n){return t.attachFieldAttributes(i,e,n)}))}else{t.attachFieldAttributes(i,e,s)}}));this.sortedRecipients.filter((function(e){return e.role_name!==t.recipient.role_name&&(e.status==="invited"||e.status==="opened"||e.status==="pending")})).forEach((function(){t.getRecipientFields().filter((function(e){return e.page===i.pageNumber})).forEach((function(e){var n=E("envelope",e,i,{disabled:true,editable:false,draggable:false,done:t.isDone});if(!n){return}if(Array.isArray(n)){n.map((function(n){return t.attachFieldAttributes(i,e,n)}))}else{t.attachFieldAttributes(i,e,n)}}))}));this.checkRecipientFields()};e.prototype.render=function(){var e=this;if(this.showLoadError){return n(s,null,n("verdocs-ok-dialog",{heading:"Unable to Start Signing",message:"Sorry, your invite code is invalid or has expired. Please check your email for an updated invitation, or contact the sender.",buttonLabel:"OK",onNext:function(){window.location.reload()}}))}if(!this.envelope){return n(s,null,n("verdocs-loader",null))}if(this.fatalErrorMessage){return n(s,{class:{agreed:this.agreed}},n("div",{class:"fatal-error"},n("img",{src:"https://public-assets.verdocs.com/loading-placeholder.png",class:"placeholder",alt:"Placeholder page"}),n("div",{class:"message"},n("div",{class:"header"},this.fatalErrorHeader),n("p",null,this.fatalErrorMessage))))}if(this.isDone){return n(s,{class:{agreed:this.agreed}},n("verdocs-view",{endpoint:this.endpoint,envelopeId:this.envelopeId,onSdkError:function(t){var i;return(i=e.sdkError)===null||i===void 0?void 0:i.emit(t.detail)}}),this.showDone&&n("verdocs-ok-dialog",{heading:"You're Done!",message:"You can access the ".concat(this.documentsSingularPlural," at any time by clicking on the link from the invitation email.<br /><br />After all recipients have completed their actions, you will receive an email with the document and envelope certificate attached."),onNext:function(t){t.preventDefault();t.stopPropagation();e.showDone=false;e.isDone=true}}),this.submitting&&n("div",{class:"loading-indicator"},n("verdocs-loader",null)))}if(!this.agreed){return n(s,{class:"agreed"},n("div",{id:"verdocs-sign-header"},n("div",{class:"inner"},n("img",{src:"https://verdocs.com/assets/white-logo.svg",alt:"Verdocs Logo",class:"logo"}),n("div",{class:"title"},this.envelope.name))),n("div",{class:"document",style:{paddingTop:"15px"}},n("img",{src:"https://public-assets.verdocs.com/loading-placeholder.png",style:{width:"612px",height:"792px",boxShadow:"0 0 10px 5px #0000000f",marginTop:"15px"},alt:"Placeholder page"})),n("div",{class:"cover"},n("div",{class:"agree"},n("verdocs-checkbox",{name:"agree",label:"By checking this box, you:",onInput:function(){return e.handleClickAgree()}}),n("ul",null,n("li",null,"Agree to use electronic records and signatures, and confirm you have read the"," ",n("a",{href:"https://verdocs.com/en/electronic-record-signature-disclosure/",target:"_blank"},"Electronic Record and Signatures Disclosure"),"."),n("li",null,"Agree to Verdocs'"," ",n("a",{href:"https://verdocs.com/en/eula",target:"_blank"},"End User License Agreement")," ","and confirm you have read Verdocs'"," ",n("a",{href:"https://verdocs.com/en/privacy-policy/",target:"_blank"},"Privacy Policy"),".")))))}if(this.kbaStep==="pin"){return n(s,{class:"kba"},n("div",{id:"verdocs-sign-header"},n("div",{class:"inner"},n("img",{src:"https://verdocs.com/assets/white-logo.svg",alt:"Verdocs Logo",class:"logo"}),n("div",{class:"title"},this.envelope.name))),n("div",{class:"document",style:{paddingTop:"15px"}},n("img",{src:"https://public-assets.verdocs.com/loading-placeholder.png",style:{width:"612px",height:"792px",boxShadow:"0 0 10px 5px #0000000f",marginTop:"15px"},alt:"Placeholder page"})),n("div",{class:"cover"},n("div",{class:"kba"},n("verdocs-kba-dialog",{mode:"text",step:1,steps:1,helptitle:"Document is protected by a PIN code",helptext:"Please enter your PIN code to proceed. If you do not have one, please contact the sender.",label:"PIN Code",onNext:function(t){return __awaiter(e,void 0,void 0,(function(){var e=this;return __generator(this,(function(i){N(this.endpoint,this.envelopeId,this.roleId,t.detail).then((function(t){console.log("[SIGN] PIN code submission result",t);if(t.kba_step==="complete"){e.kbaStep=""}})).catch((function(e){var t,i;console.log("[SIGN] Error submitting PIN",e);T(((i=(t=e.response)===null||t===void 0?void 0:t.data)===null||i===void 0?void 0:i.error)||"Unable to verify PIN code. Please try again.",{style:"error"})}));return[2]}))}))}}))))}if(this.kbaStep==="identity"){return n(s,{class:"kba"},n("div",{id:"verdocs-sign-header"},n("div",{class:"inner"},n("img",{src:"https://verdocs.com/assets/white-logo.svg",alt:"Verdocs Logo",class:"logo"}),n("div",{class:"title"},this.envelope.name))),n("div",{class:"document",style:{paddingTop:"15px"}},n("img",{src:"https://public-assets.verdocs.com/loading-placeholder.png",style:{width:"612px",height:"792px",boxShadow:"0 0 10px 5px #0000000f",marginTop:"15px"},alt:"Placeholder page"})),n("div",{class:"cover"},n("div",{class:"kba"},n("verdocs-kba-dialog",{mode:"identity",helptitle:"Document requires identity verification",helptext:"Please complete your contact details to proceed.",recipient:this.recipient,onNext:function(t){return __awaiter(e,void 0,void 0,(function(){var e;var i=this;return __generator(this,(function(n){e=t.detail;I(this.endpoint,this.envelopeId,this.roleId,{firstName:e.first_name,lastName:e.last_name,address:e.address,city:e.city,state:e.state,zip:e.zip,ssnLast4:e.ssn_last_4}).then((function(e){console.log("[SIGN] Identity submission result",e);i.kbaStep=e.kba_step})).catch((function(e){var t,i;console.log("[SIGN] Error submitting identity",e);T(((i=(t=e.response)===null||t===void 0?void 0:t.data)===null||i===void 0?void 0:i.error)||"Unable to verify identity.",{style:"error"})}));return[2]}))}))}}))))}if(this.kbaStep==="challenge"){var t=this.kbaChoices.length;var i=this.kbaQuestions[t];console.log("Showing KBA question",{questionNumber:t,kbaQuestion:i},this.kbaChoices);return n(s,{class:"kba"},n("div",{id:"verdocs-sign-header"},n("div",{class:"inner"},n("img",{src:"https://verdocs.com/assets/white-logo.svg",alt:"Verdocs Logo",class:"logo"}),n("div",{class:"title"},this.envelope.name))),n("div",{class:"document",style:{paddingTop:"15px"}},n("img",{src:"https://public-assets.verdocs.com/loading-placeholder.png",style:{width:"612px",height:"792px",boxShadow:"0 0 10px 5px #0000000f",marginTop:"15px"},alt:"Placeholder page"})),n("div",{class:"cover"},n("div",{class:"kba"},this.kbaChoices.length>=this.kbaQuestions.length?n("verdocs-spinner",null):n("verdocs-kba-dialog",{mode:"choice",helptitle:"Your identity requires additional verification",helptext:(i===null||i===void 0?void 0:i.prompt)||"Please select one of the options below.",choices:(i===null||i===void 0?void 0:i.answer)||["Skip Question"],step:t+1,steps:this.kbaQuestions.length,onNext:function(t){return __awaiter(e,void 0,void 0,(function(){var e,i,n,s,r,o,a;var l=this;return __generator(this,(function(c){switch(c.label){case 0:s=t.detail;this.kbaChoices=__spreadArray(__spreadArray([],this.kbaChoices,true),[s],false);if(!(this.kbaChoices.length>=this.kbaQuestions.length))return[3,4];r=this.kbaQuestions.map((function(e,t){return{type:e.type,answer:l.kbaChoices[t]}}));console.log("Submitting KBA responses",this.kbaChoices,r);c.label=1;case 1:c.trys.push([1,3,,4]);return[4,G(this.endpoint,this.envelopeId,this.roleId,r)];case 2:o=c.sent();console.log("KBA challenge response",o);this.kbaStep=o.kba_step;if(this.kbaStep==="failed"){this.fatalErrorHeader="Identity Verification Failed";this.fatalErrorMessage="We were unable to verify your identity. Please contact the document's sender.";this.isDone=true}else{this.kbaQuestions=((e=o.questions)===null||e===void 0?void 0:e.question)||[];this.kbaChoices=[]}return[3,4];case 3:a=c.sent();console.log("Error submitting KBA challenge",a);this.kbaStep="";this.fatalErrorHeader="Unable to Verify Identity";this.fatalErrorMessage=((n=(i=a.response)===null||i===void 0?void 0:i.data)===null||n===void 0?void 0:n.error)||"Please try again later.";this.isDone=true;return[3,4];case 4:return[2]}}))}))}}))))}return n(s,null,n("div",{id:"verdocs-sign-header"},n("div",{class:"inner"},n("img",{src:"https://verdocs.com/assets/white-logo.svg",alt:"Verdocs Logo",class:"logo"}),n("div",{class:"title"},this.envelope.name),n("div",{style:{flex:"1"}}),!this.finishLater&&n("verdocs-button",{size:"xsmall",label:this.nextButtonLabel,disabled:!this.agreed,onClick:function(){return e.handleNext()}}),n("div",{style:{marginLeft:"10px"}}),n("verdocs-dropdown",{options:!this.isDone&&!this.finishLater?Y:q,onOptionSelected:function(t){return e.handleOptionSelected(t)}}))),n("div",{class:"document",style:{paddingTop:"15px"}},(this.envelope.documents||[]).map((function(t){var i=P(1,t.pages);return n(r,null,i.map((function(i){var s;var r=((s=t.page_sizes)===null||s===void 0?void 0:s[i])||{width:612,height:792};return n("verdocs-envelope-document-page",{envelopeId:e.envelopeId,documentId:t.id,endpoint:e.endpoint,virtualWidth:r.width,virtualHeight:r.height,pageNumber:i,onPageRendered:function(t){return e.handlePageRendered(t)},type:"filled",layers:[{name:"page",type:"canvas"},{name:"controls",type:"div"}]})})))}))),this.showFinishLater&&n("verdocs-ok-dialog",{heading:"You've saved your document to finish later.",message:"To complete the ".concat(this.documentsSingularPlural,", use the link in the original email notification inviting you to review and finish the document."),onNext:function(){return e.showFinishLater=false}}),this.showDone&&n("verdocs-ok-dialog",{heading:"You're Done!",message:"You can access the ".concat(this.documentsSingularPlural," at any time by clicking on the link from the invitation email.<br /><br />After all recipients have completed their actions, you will receive an email with the document and envelope certificate attached."),onNext:function(){e.showDone=false;e.isDone=true}}),this.submitting||this.showSpinner&&n("verdocs-portal",null,n("div",{class:"spinner-overlay"},n("verdocs-spinner",null))))};return e}());B.style=V}}}));