@verdocs/web-sdk 5.0.10 → 5.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{Datastore-5b860927.js → Datastore-4448f6ef.js} +3 -3
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{utils-30de2530.js → utils-746daf30.js} +1 -0
- package/dist/cjs/verdocs-build.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-checkbox_6.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-contact-picker_2.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-envelope-document-page.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-envelope-recipient-link_2.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-envelope-recipient-summary.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-envelope-sidebar.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-envelopes-list.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-field-attachment_13.cjs.entry.js +23 -13
- package/dist/cjs/verdocs-field-payment.cjs.entry.js +3 -2
- package/dist/cjs/verdocs-kba-dialog_2.cjs.entry.js +2 -2
- package/dist/cjs/verdocs-menu-panel_2.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-pagination_2.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-preview_6.cjs.entry.js +2 -2
- package/dist/cjs/verdocs-sign.cjs.entry.js +4 -4
- package/dist/cjs/verdocs-template-document-page_2.cjs.entry.js +2 -2
- package/dist/cjs/verdocs-web-sdk.cjs.js +1 -1
- package/dist/collection/components/embeds/verdocs-sign/verdocs-sign.js +2 -2
- package/dist/collection/components/fields/verdocs-field-attachment/verdocs-field-attachment.js +24 -1
- package/dist/collection/components/fields/verdocs-field-checkbox/verdocs-field-checkbox.js +24 -1
- package/dist/collection/components/fields/verdocs-field-date/verdocs-field-date.js +1 -1
- package/dist/collection/components/fields/verdocs-field-dropdown/verdocs-field-dropdown.js +24 -1
- package/dist/collection/components/fields/verdocs-field-initial/verdocs-field-initial.js +24 -1
- package/dist/collection/components/fields/verdocs-field-payment/verdocs-field-payment.js +24 -1
- package/dist/collection/components/fields/verdocs-field-radio/verdocs-field-radio.js +24 -1
- package/dist/collection/components/fields/verdocs-field-signature/verdocs-field-signature.js +24 -1
- package/dist/collection/components/fields/verdocs-field-textarea/verdocs-field-textarea.js +27 -3
- package/dist/collection/components/fields/verdocs-field-textbox/verdocs-field-textbox.js +24 -1
- package/dist/collection/components/fields/verdocs-field-timestamp/verdocs-field-timestamp.js +24 -1
- package/dist/collection/utils/Datastore.js +3 -3
- package/dist/collection/utils/utils.js +1 -0
- package/dist/components/{p-15b1e7a0.js → p-0689fc47.js} +2 -2
- package/dist/components/{p-55e539cb.js → p-0ed0ac8b.js} +13 -13
- package/dist/components/{p-c9a4ef35.js → p-14c80ae8.js} +5 -3
- package/dist/components/{p-7246d2ee.js → p-176a07b2.js} +3 -3
- package/dist/components/{p-f21ef4fb.js → p-211fa3e2.js} +5 -3
- package/dist/components/{p-5df09a0d.js → p-261521bc.js} +5 -3
- package/dist/components/{p-d9074622.js → p-27548ebd.js} +1 -1
- package/dist/components/{p-ca8e3721.js → p-2ddf4d5b.js} +5 -3
- package/dist/components/{p-9c37d4b3.js → p-314d698d.js} +1 -1
- package/dist/components/{p-6506ddb4.js → p-5182136e.js} +5 -3
- package/dist/components/{p-b712e729.js → p-58d027d1.js} +3 -3
- package/dist/components/{p-e36c8c69.js → p-5e378f0e.js} +5 -3
- package/dist/components/{p-f7462b26.js → p-6c4fe42c.js} +1 -1
- package/dist/components/{p-052fcdac.js → p-7cd6c0ce.js} +1 -1
- package/dist/components/{p-005c3387.js → p-9bcf9620.js} +1 -1
- package/dist/components/{p-a96c617c.js → p-a55f08ad.js} +14 -14
- package/dist/components/{p-eefda339.js → p-a60453aa.js} +2 -2
- package/dist/components/{p-ed4f91be.js → p-adf1586f.js} +1 -1
- package/dist/components/{p-093d51c8.js → p-af5ecc92.js} +1 -0
- package/dist/components/{p-332a97b3.js → p-b99b485b.js} +1 -1
- package/dist/components/{p-85ebe71d.js → p-c1159428.js} +5 -3
- package/dist/components/{p-1a77c51b.js → p-c662e5f4.js} +3 -3
- package/dist/components/{p-e9a7d860.js → p-c76fab71.js} +13 -13
- package/dist/components/{p-053a0408.js → p-d8340641.js} +5 -3
- package/dist/components/{p-b36c979b.js → p-d9a2e920.js} +8 -5
- package/dist/components/{p-5654568d.js → p-efa3b8ac.js} +1 -1
- package/dist/components/verdocs-build.js +21 -21
- package/dist/components/verdocs-contact-picker.js +1 -1
- package/dist/components/verdocs-envelope-document-page.js +1 -1
- package/dist/components/verdocs-envelope-recipient-link.js +1 -1
- package/dist/components/verdocs-envelope-recipient-summary.js +1 -1
- package/dist/components/verdocs-envelope-sidebar.js +2 -2
- package/dist/components/verdocs-envelopes-list.js +2 -2
- package/dist/components/verdocs-field-attachment.js +1 -1
- package/dist/components/verdocs-field-checkbox.js +1 -1
- package/dist/components/verdocs-field-date.js +1 -1
- package/dist/components/verdocs-field-dropdown.js +1 -1
- package/dist/components/verdocs-field-initial.js +1 -1
- package/dist/components/verdocs-field-payment.js +5 -3
- package/dist/components/verdocs-field-radio.js +1 -1
- package/dist/components/verdocs-field-signature.js +1 -1
- package/dist/components/verdocs-field-textarea.js +1 -1
- package/dist/components/verdocs-field-textbox.js +1 -1
- package/dist/components/verdocs-field-timestamp.js +1 -1
- package/dist/components/verdocs-preview.js +1 -1
- package/dist/components/verdocs-quick-filter.js +1 -1
- package/dist/components/verdocs-send.js +1 -1
- package/dist/components/verdocs-sign.js +6 -6
- package/dist/components/verdocs-template-attachments.js +1 -1
- package/dist/components/verdocs-template-build-tabs.js +1 -1
- package/dist/components/verdocs-template-document-page.js +1 -1
- package/dist/components/verdocs-template-field-properties.js +1 -1
- package/dist/components/verdocs-template-fields.js +1 -1
- package/dist/components/verdocs-template-role-properties.js +1 -1
- package/dist/components/verdocs-template-roles.js +1 -1
- package/dist/components/verdocs-templates-list.js +1 -1
- package/dist/components/verdocs-view.js +1 -1
- package/dist/esm/{Datastore-d29d4aeb.js → Datastore-b55570ff.js} +3 -3
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{utils-a5f5c427.js → utils-bd656c37.js} +1 -0
- package/dist/esm/verdocs-build.entry.js +1 -1
- package/dist/esm/verdocs-checkbox_6.entry.js +1 -1
- package/dist/esm/verdocs-contact-picker_2.entry.js +1 -1
- package/dist/esm/verdocs-envelope-document-page.entry.js +1 -1
- package/dist/esm/verdocs-envelope-recipient-link_2.entry.js +1 -1
- package/dist/esm/verdocs-envelope-recipient-summary.entry.js +1 -1
- package/dist/esm/verdocs-envelope-sidebar.entry.js +1 -1
- package/dist/esm/verdocs-envelopes-list.entry.js +1 -1
- package/dist/esm/verdocs-field-attachment_13.entry.js +23 -13
- package/dist/esm/verdocs-field-payment.entry.js +3 -2
- package/dist/esm/verdocs-kba-dialog_2.entry.js +2 -2
- package/dist/esm/verdocs-menu-panel_2.entry.js +1 -1
- package/dist/esm/verdocs-pagination_2.entry.js +1 -1
- package/dist/esm/verdocs-preview_6.entry.js +2 -2
- package/dist/esm/verdocs-sign.entry.js +4 -4
- package/dist/esm/verdocs-template-document-page_2.entry.js +2 -2
- package/dist/esm/verdocs-web-sdk.js +1 -1
- package/dist/esm-es5/{Datastore-d29d4aeb.js → Datastore-b55570ff.js} +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/{utils-a5f5c427.js → utils-bd656c37.js} +1 -1
- package/dist/esm-es5/verdocs-build.entry.js +1 -1
- package/dist/esm-es5/verdocs-checkbox_6.entry.js +1 -1
- package/dist/esm-es5/verdocs-contact-picker_2.entry.js +1 -1
- package/dist/esm-es5/verdocs-envelope-document-page.entry.js +1 -1
- package/dist/esm-es5/verdocs-envelope-recipient-link_2.entry.js +1 -1
- package/dist/esm-es5/verdocs-envelope-recipient-summary.entry.js +1 -1
- package/dist/esm-es5/verdocs-envelope-sidebar.entry.js +1 -1
- package/dist/esm-es5/verdocs-envelopes-list.entry.js +1 -1
- package/dist/esm-es5/verdocs-field-attachment_13.entry.js +1 -1
- package/dist/esm-es5/verdocs-field-payment.entry.js +1 -1
- package/dist/esm-es5/verdocs-kba-dialog_2.entry.js +1 -1
- package/dist/esm-es5/verdocs-menu-panel_2.entry.js +1 -1
- package/dist/esm-es5/verdocs-pagination_2.entry.js +1 -1
- package/dist/esm-es5/verdocs-preview_6.entry.js +1 -1
- package/dist/esm-es5/verdocs-sign.entry.js +1 -1
- package/dist/esm-es5/verdocs-template-document-page_2.entry.js +1 -1
- package/dist/esm-es5/verdocs-web-sdk.js +1 -1
- package/dist/types/components/fields/verdocs-field-attachment/verdocs-field-attachment.d.ts +6 -1
- package/dist/types/components/fields/verdocs-field-checkbox/verdocs-field-checkbox.d.ts +6 -1
- package/dist/types/components/fields/verdocs-field-dropdown/verdocs-field-dropdown.d.ts +6 -1
- package/dist/types/components/fields/verdocs-field-initial/verdocs-field-initial.d.ts +6 -1
- package/dist/types/components/fields/verdocs-field-payment/verdocs-field-payment.d.ts +6 -1
- package/dist/types/components/fields/verdocs-field-radio/verdocs-field-radio.d.ts +6 -1
- package/dist/types/components/fields/verdocs-field-signature/verdocs-field-signature.d.ts +8 -3
- package/dist/types/components/fields/verdocs-field-textarea/verdocs-field-textarea.d.ts +7 -2
- package/dist/types/components/fields/verdocs-field-textbox/verdocs-field-textbox.d.ts +6 -1
- package/dist/types/components/fields/verdocs-field-timestamp/verdocs-field-timestamp.d.ts +6 -1
- package/dist/types/components.d.ts +82 -2
- package/dist/types/utils/Datastore.d.ts +3 -6
- package/dist/verdocs-web-sdk/{p-917aab58.system.entry.js → p-00ed440b.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-cfed8cc1.js → p-0c45b79c.js} +1 -1
- package/dist/verdocs-web-sdk/{p-5b0cd815.system.entry.js → p-19462841.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-42b157d2.entry.js → p-1eb501c3.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-66bf3ba8.system.entry.js → p-2b7edf3a.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-2224ca6d.entry.js → p-2d7d0805.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-fe48c408.entry.js → p-35903760.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-55de8cd1.system.js → p-35dcb386.system.js} +1 -1
- package/dist/verdocs-web-sdk/{p-7e73805f.system.entry.js → p-3cc50f0b.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/p-41f22b0a.system.entry.js +1 -0
- package/dist/verdocs-web-sdk/{p-51c97029.entry.js → p-4a960ba5.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-660bda06.entry.js → p-553a341c.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-b712e729.js → p-58d027d1.js} +1 -1
- package/dist/verdocs-web-sdk/{p-c94b0dc5.system.entry.js → p-6b4de004.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-27da4a2b.entry.js → p-6da00869.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-a8809e33.entry.js → p-7688bc89.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-c2766b5a.entry.js → p-786bacad.entry.js} +1 -1
- package/dist/verdocs-web-sdk/p-7abbdb69.entry.js +1 -0
- package/dist/verdocs-web-sdk/{p-c253ae24.system.entry.js → p-7b1e00e5.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/p-8bdd951b.system.entry.js +1 -0
- package/dist/verdocs-web-sdk/{p-5ce491ac.system.entry.js → p-8d7d61ee.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-5aa76635.system.entry.js → p-9021fc7b.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-f40fe8d7.entry.js → p-91977069.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-6546599d.entry.js → p-94ffe928.entry.js} +1 -1
- package/dist/verdocs-web-sdk/p-98ab739b.entry.js +1 -0
- package/dist/verdocs-web-sdk/{p-87ac8456.entry.js → p-a4b05f08.entry.js} +1 -1
- package/dist/verdocs-web-sdk/p-b0436bc7.entry.js +1 -0
- package/dist/verdocs-web-sdk/{p-899617aa.system.entry.js → p-b0fbfc24.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-c60743ac.system.entry.js → p-bbf30adc.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/p-e2b70dfb.system.js +1 -1
- package/dist/verdocs-web-sdk/{p-f3b5052f.system.entry.js → p-e3077c5e.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-b029989a.system.entry.js → p-ea078594.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-bea73364.entry.js → p-ea75f159.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-cb7aa6b8.system.entry.js → p-eb3ceb39.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-fc90cc87.entry.js → p-ef7813ed.entry.js} +1 -1
- package/dist/verdocs-web-sdk/{p-736a2c41.system.js → p-f29eb00a.system.js} +1 -1
- package/dist/verdocs-web-sdk/{p-ff8143df.system.entry.js → p-fda9c437.system.entry.js} +1 -1
- package/dist/verdocs-web-sdk/verdocs-web-sdk.esm.js +1 -1
- package/package.json +1 -1
- package/dist/custom-elements.json +0 -2156
- package/dist/verdocs-web-sdk/p-0ade6f7a.system.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-30c3f624.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-42e608e3.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-62217123.system.entry.js +0 -1
- package/dist/verdocs-web-sdk/p-95ba9c43.entry.js +0 -1
@@ -1 +1 @@
|
|
1
|
-
import{r as e,c as t,h as s,H as i,g as l}from"./p-b9654a5e.js";import{VerdocsEndpoint as o,getTemplate as d}from"@verdocs/js-sdk";import{S as a}from"./p-fd97809c.js";import{S as r}from"./p-
|
1
|
+
import{r as e,c as t,h as s,H as i,g as l}from"./p-b9654a5e.js";import{VerdocsEndpoint as o,getTemplate as d}from"@verdocs/js-sdk";import{S as a}from"./p-fd97809c.js";import{S as r}from"./p-58d027d1.js";const n=class{constructor(s){e(this,s),this.sdkError=t(this,"sdkError",7),this.stepChanged=t(this,"stepChanged",7),this.send=t(this,"send",7),this.templateUpdated=t(this,"templateUpdated",7),this.templateCreated=t(this,"templateCreated",7),this.rolesUpdated=t(this,"rolesUpdated",7),this.templateListenerId=null,this.endpoint=o.getDefault(),this.templateId=null,this.step="preview",this.loading=!0,this.template=null}onTemplateIdChanged(e,t){!t&&e&&"attachments"===this.step&&(this.step="preview"),this.loadTemplate(e).catch((e=>console.log("Unknown Error",e)))}onStepChanged(){this.loadTemplate(this.templateId).catch((e=>console.log("Unknown Error",e)))}async componentWillLoad(){var e,t,s,i,l,o;try{if(this.endpoint.loadSession(),!this.endpoint.session)return void console.log("[BUILD] Unable to start builder session, must be authenticated");if(!this.templateId)return console.log("[BUILD] No template ID, activating upload mode"),void(this.step="attachments");try{this.loadTemplate(this.templateId).catch((e=>console.log("[BUILD] Unable to load template",e)))}catch(i){console.log("[BUILD] Error loading template",i),null===(e=this.sdkError)||void 0===e||e.emit(new a(i.message,null===(t=i.response)||void 0===t?void 0:t.status,null===(s=i.response)||void 0===s?void 0:s.data))}}catch(e){console.log("[BUILD] Error with builder session",e),null===(i=this.sdkError)||void 0===i||i.emit(new a(e.message,null===(l=e.response)||void 0===l?void 0:l.status,null===(o=e.response)||void 0===o?void 0:o.data))}}async loadTemplate(e){e&&r.subscribe("templates",this.templateId,(()=>d(this.endpoint,this.templateId)),!1,(e=>{this.template=e,this.loading=!1}))}disconnectedCallback(){console.log("[BUILD] Disconnected"),this.unlistenToTemplate()}unlistenToTemplate(){this.templateListenerId&&(r.store.delListener(this.templateListenerId),this.templateListenerId=null)}handleCancel(){this.step="preview"}async handleTemplateCreated(e){var t;await this.loadTemplate(e),this.templateId=e,this.step="roles",null===(t=this.stepChanged)||void 0===t||t.emit("roles")}async handleRolesUpdated(e){var t;null===(t=this.templateUpdated)||void 0===t||t.emit(e.detail)}async handleTemplateUpdated(e){var t;null===(t=this.templateUpdated)||void 0===t||t.emit(e.detail)}handleAttachmentsNext(){var e;this.step="roles",null===(e=this.stepChanged)||void 0===e||e.emit("roles")}handleRolesNext(){var e;this.step="fields",null===(e=this.stepChanged)||void 0===e||e.emit("fields")}handleStepChanged(e){var t;this.step=e,null===(t=this.stepChanged)||void 0===t||t.emit(e)}render(){return this.loading?s(i,{class:"loading"},s("verdocs-loader",null)):s(i,null,this.endpoint.session?s("div",{class:"content"},s("verdocs-template-build-tabs",{endpoint:this.endpoint,templateId:this.templateId,step:this.step,onSdkError:e=>{var t;return null===(t=this.sdkError)||void 0===t?void 0:t.emit(e.detail)},onStepChanged:e=>this.handleStepChanged(e.detail)}),"attachments"===this.step&&s("verdocs-template-attachments",{templateId:this.templateId,endpoint:this.endpoint,onExit:()=>this.handleCancel(),onNext:()=>this.handleAttachmentsNext(),onTemplateUpdated:e=>this.handleTemplateUpdated(e)}),"roles"===this.step&&s("verdocs-template-roles",{templateId:this.templateId,endpoint:this.endpoint,onExit:()=>this.handleCancel(),onNext:()=>this.handleRolesNext(),onRolesUpdated:e=>this.handleRolesUpdated(e)}),"settings"===this.step&&s("div",{style:{flexDirection:"column",gap:"20px",display:"flex",maxWidth:"400px",margin:"20px"}},s("verdocs-template-name",{templateId:this.templateId,endpoint:this.endpoint,style:{backgroundColor:"#ffffff",padding:"20px"},onTemplateUpdated:e=>this.handleTemplateUpdated(e)}),s("verdocs-template-reminders",{templateId:this.templateId,endpoint:this.endpoint,style:{backgroundColor:"#ffffff",padding:"20px"},onTemplateUpdated:e=>this.handleTemplateUpdated(e)}),s("verdocs-template-visibility",{templateId:this.templateId,endpoint:this.endpoint,style:{backgroundColor:"#ffffff",padding:"20px"},onTemplateUpdated:e=>this.handleTemplateUpdated(e)})),"fields"===this.step&&s("verdocs-template-fields",{templateId:this.templateId,endpoint:this.endpoint,onTemplateUpdated:e=>this.handleTemplateUpdated(e)}),"preview"===this.step&&s("div",{class:"preview-container"},s("div",{class:"preview-send-wrapper"},s("verdocs-send",{templateId:this.templateId,endpoint:this.endpoint,onSend:e=>{var t;return null===(t=this.send)||void 0===t?void 0:t.emit(e.detail)},style:{width:"100%"}})),s("div",{class:"preview-preview-wrapper"},s("verdocs-preview",{templateId:this.templateId,endpoint:this.endpoint,style:{display:"flex",flex:"1",maxWidth:"1000px"}})))):s("verdocs-component-error",{message:"You must be authenticated to use this module."}))}get el(){return l(this)}static get watchers(){return{templateId:["onTemplateIdChanged"],step:["onStepChanged"]}}};n.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-build{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-build .content{-ms-flex:1;flex:1;gap:20px;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-direction:column;flex-direction:column}verdocs-build verdocs-template-attachments,verdocs-build verdocs-template-roles{margin:20px}verdocs-build verdocs-template-fields{border-top:1px solid #777777}verdocs-build verdocs-template-attachments{padding:20px;background:#ffffff}verdocs-build verdocs-template-fields{width:100%}verdocs-build verdocs-preview{-ms-flex:1;flex:1}verdocs-build .preview-container{-ms-flex-direction:row;flex-direction:row;display:-ms-flexbox;display:flex;width:100%;background-color:#eeeeee;max-height:100%}@media all and (max-width: 450px){verdocs-build .preview-container{-ms-flex-direction:column;flex-direction:column}}verdocs-build .preview-send-wrapper{display:-ms-flexbox;display:flex;-ms-flex:0 0 300px;flex:0 0 300px;background-color:#ffffff;-webkit-box-shadow:1px 1px 6px -2px rgba(0, 0, 0, 0.4980392157);box-shadow:1px 1px 6px -2px rgba(0, 0, 0, 0.4980392157)}@media all and (max-width: 450px){verdocs-build .preview-send-wrapper{-ms-flex:0;flex:0}}verdocs-build .preview-preview-wrapper{display:-ms-flexbox;display:flex;-ms-flex:1;flex:1;-ms-flex-pack:center;justify-content:center;overflow-y:scroll}';export{n as verdocs_build}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
var __assign=this&&this.__assign||function(){__assign=Object.assign||function(e){for(var t,i=1,n=arguments.length;i<n;i++){t=arguments[i];for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r))e[r]=t[r]}return e};return __assign.apply(this,arguments)};var __awaiter=this&&this.__awaiter||function(e,t,i,n){function r(e){return e instanceof i?e:new i((function(t){t(e)}))}return new(i||(i=Promise))((function(i,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function a(e){try{l(n["throw"](e))}catch(e){o(e)}}function l(e){e.done?i(e.value):r(e.value).then(s,a)}l((n=n.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var i={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,r,o,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(e){return function(t){return l([e,t])}}function l(a){if(n)throw new TypeError("Generator is already executing.");while(s&&(s=0,a[0]&&(i=0)),i)try{if(n=1,r&&(o=a[0]&2?r["return"]:a[0]?r["throw"]||((o=r["return"])&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;if(r=0,o)a=[a[0]&2,o.value];switch(a[0]){case 0:case 1:o=a;break;case 4:i.label++;return{value:a[1],done:false};case 5:i.label++;r=a[1];a=[0];continue;case 7:a=i.ops.pop();i.trys.pop();continue;default:if(!(o=i.trys,o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){i=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(a[0]===6&&i.label<o[1]){i.label=o[1];o=a;break}if(o&&i.label<o[2]){i.label=o[2];i.ops.push(a);break}if(o[2])i.ops.pop();i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e];r=0}finally{n=o=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,r=t.length,o;n<r;n++){if(o||!(n in t)){if(!o)o=Array.prototype.slice.call(t,0,n);o[n]=t[n]}}return e.concat(o||Array.prototype.slice.call(t))};System.register(["./p-9186f42e.system.js","@verdocs/js-sdk","./p-c8a15cb7.system.js","./p-55de8cd1.system.js","./p-9b26e4e0.system.js","./p-cd546dbe.system.js","./p-2c5350ec.system.js","./p-70751089.system.js","./p-736a2c41.system.js","./p-21b1acec.system.js","./p-d738b5db.system.js"],(function(e){"use strict";var t,i,n,r,o,s,a,l,c,u,d,f,h,v,p,m,g,b,x,w,y,_,k,E,q,S,M,C,I,T,L,H,Z,O,z,D,V,N;return{setters:[function(e){t=e.r;i=e.c;n=e.h;r=e.H;o=e.F;s=e.g},function(e){a=e.VerdocsEndpoint;l=e.getTemplate;c=e.integerSequence;u=e.getOrganizationContacts;d=e.isValidEmail;f=e.createEnvelope;h=e.getRGBA;v=e.formatFullName;p=e.createTemplateDocument;m=e.deleteTemplateDocument;g=e.updateField;b=e.createField;x=e.updateTemplateRole;w=e.createTemplateRole},function(e){y=e.S},function(e){_=e.S},function(e){k=e.V},function(e){E=e.D;q=e.P;S=e.J;M=e.a;C=e.F;I=e.b;T=e.T},function(e){L=e.f},function(e){H=e.i},function(e){Z=e.b;O=e.c;z=e.d;D=e.g;V=e.e;N=e.f},function(){},function(){}],execute:function(){var A='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-preview{font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif;display:-ms-flexbox;display:flex;padding:15px;row-gap:15px;min-height:200px;position:relative;-ms-flex-align:center;align-items:center;-webkit-box-sizing:border-box;box-sizing:border-box;-ms-flex-direction:column;flex-direction:column}verdocs-preview div,verdocs-preview canvas{-webkit-box-sizing:border-box;box-sizing:border-box}';var j=A;var R=e("verdocs_preview",function(){function e(e){t(this,e);this.sdkError=i(this,"sdkError",7);this.templateListenerId=null;this.endpoint=a.getDefault();this.templateId=null;this.loading=true;this.template=null}e.prototype.disconnectedCallback=function(){this.unlistenToTemplate()};e.prototype.listenToTemplate=function(){return __awaiter(this,void 0,void 0,(function(){var e=this;return __generator(this,(function(t){this.unlistenToTemplate();_.subscribe("templates",this.templateId,(function(){return l(e.endpoint,e.templateId)}),false,(function(t){e.template=t;e.loading=false}));return[2]}))}))};e.prototype.unlistenToTemplate=function(){if(this.templateListenerId){_.store.delListener(this.templateListenerId);this.templateListenerId=null}};e.prototype.onTemplateIdChanged=function(e){console.log("[PREVIEW] Template ID changed",e);this.listenToTemplate()};e.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,i;return __generator(this,(function(n){try{this.endpoint.loadSession();if(!this.endpoint.session){console.log("[PREVIEW] Unable to start builder session, must be authenticated");return[2]}if(!this.templateId){console.log("[PREVIEW] Missing required template ID ".concat(this.templateId));return[2]}this.listenToTemplate()}catch(n){console.log("[PREVIEW] Error with preview session",n);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new y(n.message,(t=n.response)===null||t===void 0?void 0:t.status,(i=n.response)===null||i===void 0?void 0:i.data))}return[2]}))}))};e.prototype.handlePageRendered=function(e){};e.prototype.render=function(){var e=this;var t;if(this.loading){return n(r,null,n("verdocs-loader",null))}return n(r,null,(((t=this.template)===null||t===void 0?void 0:t.documents)||[]).map((function(t){var i=c(1,t.pages);return n(o,null,i.map((function(i){var r;var o=((r=t.page_sizes)===null||r===void 0?void 0:r[i])||{width:612,height:792};return n("verdocs-template-document-page",{templateId:t.template_id,documentId:t.id,pageNumber:i,disabled:true,editable:false,done:false,virtualWidth:o.width,virtualHeight:o.height,onPageRendered:function(t){return e.handlePageRendered(t)},layers:[{name:"page",type:"canvas"},{name:"controls",type:"div"}]})})))})))};Object.defineProperty(e,"watchers",{get:function(){return{templateId:["onTemplateIdChanged"]}},enumerable:false,configurable:true});return e}());R.style=j;var U=function(e){return((e===null||e===void 0?void 0:e.roles)||[]).map((function(e){return e.name}))};var B=function(e,t){return Math.max(U(e).findIndex((function(e){return e===t})),0)};var P='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-send{padding:10px;position:relative;background:#ffffff;-ms-flex-direction:column;flex-direction:column;font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-send.sendable{display:-ms-flexbox;display:flex}verdocs-send .recipients{position:relative}verdocs-send .left-line{top:32px;left:20px;z-index:1;width:12px;bottom:30px;position:absolute;background:#ffffff;border-left:3px dotted #9b9b9b}verdocs-send .level{display:-ms-flexbox;display:flex;-webkit-column-gap:10px;-moz-column-gap:10px;column-gap:10px;margin-left:50px;position:relative;-ms-flex-direction:row;flex-direction:row;padding:8px 0 4px 0;border-bottom:1px solid rgba(151, 151, 151, 0.2666666667)}verdocs-send .level .level-icon{top:14px;z-index:2;left:-40px;width:24px;height:24px;position:absolute;background:#ffffff}verdocs-send .level .level-icon svg{fill:rgba(0, 0, 0, 0.537254902)}verdocs-send .level .recipient{height:30px;display:-ms-flexbox;display:flex;-ms-flex:0 0 30px;flex:0 0 30px;color:#000000;cursor:pointer;font-size:14px;-ms-flex-align:center;align-items:center;border-radius:30px;-ms-flex-direction:row;flex-direction:row;background:#dddddd;white-space:nowrap;border:2px solid #dddddd;padding:2px 10px 2px 14px}verdocs-send .level .recipient .icon{width:22px;height:22px;-ms-flex:0 0 22px;flex:0 0 22px;margin:0 0 0 10px}verdocs-send .level .recipient .icon svg{width:22px;height:22px;fill:#333333;outline:none}verdocs-send .level .complete{-ms-flex:1;flex:1;height:30px;display:-ms-flexbox;display:flex;color:#000000;font-size:14px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;padding:3px 10px 3px 2px}verdocs-send .buttons{display:-ms-flexbox;display:flex;margin-top:10px;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;-ms-flex-direction:row;flex-direction:row}verdocs-send verdocs-contact-picker{left:0;top:41px;z-index:10;position:absolute;border:1px solid #dddddd;-webkit-box-shadow:0 0 6px 3px rgba(0, 0, 0, 0.1);box-shadow:0 0 6px 3px rgba(0, 0, 0, 0.1)}';var Q=P;var F='<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" tabindex="-1"><path d="M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34a.9959.9959 0 0 0-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z"></path></svg>';var Y='<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" tabindex="-1"><path d="M2 12C2 6.48 6.48 2 12 2s10 4.48 10 10-4.48 10-10 10S2 17.52 2 12zm10 6c3.31 0 6-2.69 6-6s-2.69-6-6-6-6 2.69-6 6 2.69 6 6 6z"></path></svg>';var W='<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" tabindex="-1"><path d="M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z"></path></svg>';var J='<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" tabindex="-1"><path d="m18 7-1.41-1.41-6.34 6.34 1.41 1.41L18 7zm4.24-1.41L11.66 16.17 7.48 12l-1.41 1.41L11.66 19l12-12-1.42-1.41zM.41 13.41 6 19l1.41-1.41L1.83 12 .41 13.41z"></path></svg>';var G=e("verdocs_send",function(){function e(e){t(this,e);this.sendingEnvelope=i(this,"sendingEnvelope",7);this.send=i(this,"send",7);this.exit=i(this,"exit",7);this.sdkError=i(this,"sdkError",7);this.searchContacts=i(this,"searchContacts",7);this.templateListenerId=null;this.endpoint=a.getDefault();this.templateId=null;this.environment="";this.containerId="verdocs-send-".concat(Math.random().toString(36).substring(2,11));this.showPickerForId="";this.sessionContacts=[];this.sending=false;this.rolesCompleted={};this.loading=true;this.template=null}e.prototype.disconnectedCallback=function(){this.unlistenToTemplate()};e.prototype.listenToTemplate=function(){return __awaiter(this,void 0,void 0,(function(){var e=this;return __generator(this,(function(t){console.log("[SEND] Loading template",this.templateId);this.unlistenToTemplate();_.subscribe("templates",this.templateId,(function(){return l(e.endpoint,e.templateId)}),false,(function(t){e.template=t;e.loading=false;e.rolesCompleted={}}));return[2]}))}))};e.prototype.unlistenToTemplate=function(){if(this.templateListenerId){_.store.delListener(this.templateListenerId);this.templateListenerId=null}};e.prototype.reset=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){this.rolesCompleted={};return[2]}))}))};e.prototype.onTemplateIdChanged=function(e){console.log("[SEND] Template ID changed",e);this.listenToTemplate()};e.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,i;var n=this;return __generator(this,(function(r){try{this.endpoint.onSessionChanged((function(e,t,i){if(!i){return}var r={id:i.id,first_name:i.first_name,last_name:i.last_name,email:i.email,phone:i.phone};if(i){n.sessionContacts=[r];u(n.endpoint).then((function(e){console.log("[SEND] Got contacts",e);n.sessionContacts=__spreadArray(__spreadArray([],e,true),[r],false)})).catch((function(e){console.log("[SEND] Error getting contacts",e)}))}}));this.endpoint.loadSession();if(!this.endpoint.session){console.log("[SEND] Unable to start Send operation, must be authenticated");return[2]}if(!this.templateId){console.log("[SEND] Missing required template ID ".concat(this.templateId));return[2]}this.listenToTemplate()}catch(n){console.log("[SEND] Error with send session",n);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new y(n.message,(t=n.response)===null||t===void 0?void 0:t.status,(i=n.response)===null||i===void 0?void 0:i.data))}return[2]}))}))};e.prototype.recomputeRolesCompleted=function(){var e=this;var t;this.rolesCompleted={};var i={};(((t=this.template)===null||t===void 0?void 0:t.roles)||[]).forEach((function(t){var n=t.sequence-1;i[n]||(i[n]=[]);var r="r-".concat(n,"-").concat(i[n].length);i[n].push(__assign(__assign({},t),{id:r,role_name:t.name,first_name:t.first_name,last_name:t.last_name}));if(t.first_name&&d(t.email)){e.rolesCompleted[r]=__assign(__assign({},t),{id:r,role_name:t.name,first_name:t.first_name,last_name:t.last_name})}}))};e.prototype.getLevels=function(){var e;var t=__spreadArray([],new Set((((e=this.template)===null||e===void 0?void 0:e.roles)||[]).map((function(e){return e.sequence-1}))),true);t.sort((function(e,t){return e-t}));return t};e.prototype.getRolesAtLevel=function(e){var t;var i=(((t=this.template)===null||t===void 0?void 0:t.roles)||[]).filter((function(t){return t.sequence-1===e})).map((function(t,i){return __assign(__assign({},t),{id:"r-".concat(e,"-").concat(i),role_name:t.name,first_name:"",last_name:""})}));return i};e.prototype.getLevelIcon=function(e){var t=this.getLevels();if(e<0){return n("div",{class:"level-icon",innerHTML:Y})}else if(e>=t.length){return n("div",{class:"level-icon",innerHTML:J})}else{return n("div",{class:"level-icon",innerHTML:W})}};e.prototype.handleSelectContact=function(e,t){e.preventDefault();this.rolesCompleted[t.id]=__assign(__assign({},t),e.detail);this.showPickerForId=""};e.prototype.handleClickRole=function(e,t){e.stopPropagation();this.showPickerForId=t.id};e.prototype.handleSend=function(e){var t=this;var i,n;if(this.sending){console.log("[SEND] Skipping duplicate send",e);return}console.log("[SEND] Sending",e);e.preventDefault();e.stopPropagation();this.sending=true;(i=this.sendingEnvelope)===null||i===void 0?void 0:i.emit({sending:true});var r={template_id:this.templateId,name:((n=this.template)===null||n===void 0?void 0:n.name)||"New Envelope",environment:this.environment,initial_reminder:0,followup_reminders:0,recipients:Object.values(this.rolesCompleted),fields:[]};console.log("[SEND] Creating envelope",r);f(this.endpoint,r).then((function(e){var i,n;console.log("[SEND] Send envelope",e);t.reset().catch((function(e){return console.log("Unknown Error",e)}));t.sending=false;(i=t.sendingEnvelope)===null||i===void 0?void 0:i.emit({sending:false});(n=t.send)===null||n===void 0?void 0:n.emit(__assign(__assign({},r),{name:r.name,envelope_id:e.id,envelope:e}))})).catch((function(e){var i,n,r;console.log("Send error",e);k(((n=(i=e.response)===null||i===void 0?void 0:i.data)===null||n===void 0?void 0:n.error)||"Error creating envelope, please try again later.");t.sending=false;(r=t.sendingEnvelope)===null||r===void 0?void 0:r.emit({sending:false})}))};e.prototype.handleCancel=function(e){var t;e.stopPropagation();(t=this.exit)===null||t===void 0?void 0:t.emit()};e.prototype.render=function(){var e=this;var t;if(this.loading){return n(r,null,n("verdocs-loader",null))}if(!this.endpoint.session){return n(r,{style:{display:"flex"}},n("verdocs-component-error",{message:"You must be authenticated to use this module."}))}var i=this.getLevels();var o=Object.values(this.rolesCompleted).filter((function(e){return d(e.email)}));var s=o.length>=U(this.template).length;return n(r,{class:{sendable:(t=this.template)===null||t===void 0?void 0:t.is_sendable}},n("div",{class:"recipients"},n("div",{class:"left-line"}),n("div",{class:"level level-start"},this.getLevelIcon(-1),n("div",{class:"complete"},"Send Envelope")),i.map((function(t){return n("div",{class:"level level-".concat(t)},e.getLevelIcon(t),e.getRolesAtLevel(t).map((function(t){var i,r,o,s;var a=!t.email;var l="verdocs-send-recipient-".concat(t.role_name);var c=B(e.template,t.role_name);var u=h(c);return a?n("div",{class:"recipient","data-ri":c,"data-rn":t.role_name,style:{backgroundColor:u},onClick:function(i){return e.handleClickRole(i,t)},id:l},((i=e.rolesCompleted[t.id])===null||i===void 0?void 0:i.first_name)?v(e.rolesCompleted[t.id]):t.role_name,n("div",{class:"icon",innerHTML:F}),e.showPickerForId===t.id&&n("verdocs-portal",{anchor:l,onClickAway:function(){return e.showPickerForId=""}},n("verdocs-contact-picker",{onExit:function(){return e.showPickerForId=""},onNext:function(i){return e.handleSelectContact(i,t)},contactSuggestions:e.sessionContacts,templateRole:(r=e.rolesCompleted[t.id])!==null&&r!==void 0?r:t,onSearchContacts:function(t){var i;return(i=e.searchContacts)===null||i===void 0?void 0:i.emit(t.detail)}}))):n("div",{class:"recipient",style:{borderColor:u},onClick:function(i){return e.handleClickRole(i,t)},id:l},((o=e.rolesCompleted[t.id])===null||o===void 0?void 0:o.first_name)?v(e.rolesCompleted[t.id]):t.role_name,n("div",{class:"icon",innerHTML:F}),e.showPickerForId===t.id&&n("verdocs-portal",{anchor:l,onClickAway:function(){return e.showPickerForId=""}},n("verdocs-contact-picker",{onExit:function(){return e.showPickerForId=""},onNext:function(i){return e.handleSelectContact(i,t)},contactSuggestions:e.sessionContacts,templateRole:(s=e.rolesCompleted[t.id])!==null&&s!==void 0?s:t,onSearchContacts:function(t){var i;return(i=e.searchContacts)===null||i===void 0?void 0:i.emit(t.detail)}})))})))})),n("div",{class:"level level-done"},this.getLevelIcon(i.length),n("div",{class:"complete"},"Signing Complete"))),n("div",{class:"buttons"},n("verdocs-button",{label:"Cancel",size:"small",variant:"outline",onClick:function(t){return e.handleCancel(t)},disabled:this.sending}),n("verdocs-button",{label:"Send",size:"small",disabled:!s||this.sending,onClick:function(t){return e.handleSend(t)}}),this.sending&&n("verdocs-spinner",null)))};Object.defineProperty(e,"watchers",{get:function(){return{templateId:["onTemplateIdChanged"]}},enumerable:false,configurable:true});return e}());G.style=Q;var X='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-template-attachments{font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-template-attachments h5{font-size:16px;font-weight:bold;margin:0 0 10px 0;color:#46497d}verdocs-template-attachments .attachments{margin:0 0 40px 0}verdocs-template-attachments .attachment{display:-ms-flexbox;display:flex;padding:5px 0;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;color:#33364b}verdocs-template-attachments .attachment:hover .trash-icon{display:-ms-flexbox;display:flex}verdocs-template-attachments .attachment:hover .pages{display:none}verdocs-template-attachments svg{width:28px;height:28px;fill:#5c6575;margin:2px 0 0 0}verdocs-template-attachments .file-icon{-ms-flex:0;flex:0}verdocs-template-attachments .pages{width:24px;height:24px;-ms-flex:0 0 24px;flex:0 0 24px;padding-left:4px;position:relative;margin:-10px 0 0 0}verdocs-template-attachments .pages .pages-icon{top:0;left:0;width:24px;height:24px;position:absolute}verdocs-template-attachments .pages .count{top:11px;left:7px;z-index:1;width:18px;font-size:12px;font-weight:500;position:absolute;text-align:center;letter-spacing:-2px}verdocs-template-attachments .filename{-ms-flex:1;flex:1;display:block;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;border-bottom:1px dotted #cccccc}verdocs-template-attachments .trash-icon{-ms-flex:0;flex:0;display:none}verdocs-template-attachments .trash-icon:hover{cursor:pointer}verdocs-template-attachments verdocs-file-chooser{margin:10px 0;border:2px dashed #979797}verdocs-template-attachments .loader-wrapper{background-color:#ffffff;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-webkit-box-sizing:border-box;box-sizing:border-box;position:relative;width:320px;height:320px;text-align:center;border:2px dashed #979797;-ms-flex-pack:end;justify-content:flex-end}verdocs-template-attachments .progress-wrapper{padding:20px}verdocs-template-attachments .buttons{display:-ms-flexbox;display:flex;-webkit-column-gap:8px;-moz-column-gap:8px;column-gap:8px;margin-top:16px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:end;justify-content:flex-end}verdocs-template-attachments .buttons .flex-fill{-ms-flex:1;flex:1}verdocs-template-attachments ::-webkit-input-placeholder{color:#aaaaaa}verdocs-template-attachments ::-moz-placeholder{color:#aaaaaa}verdocs-template-attachments :-ms-input-placeholder{color:#aaaaaa}verdocs-template-attachments ::-ms-input-placeholder{color:#aaaaaa}verdocs-template-attachments ::placeholder{color:#aaaaaa}';var K=X;var $=e("verdocs_template_attachments",function(){function e(e){t(this,e);this.exit=i(this,"exit",7);this.next=i(this,"next",7);this.templateUpdated=i(this,"templateUpdated",7);this.sdkError=i(this,"sdkError",7);this.templateListenerId=null;this.endpoint=a.getDefault();this.templateId="";this.uploading=false;this.progressLabel="Uploading...";this.progressPercent=0;this.showDeleteError=false;this.confirmDeleteDocument=null;this.loading=true;this.template=null}e.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,i;return __generator(this,(function(n){try{this.endpoint.loadSession();if(!this.templateId){console.log("[ROLES] Missing required template ID ".concat(this.templateId));return[2]}if(!this.endpoint.session){console.log("[ROLES] Unable to start builder session, must be authenticated");return[2]}this.listenToTemplate()}catch(n){console.log("[TEMPLATE ATTACHMENTS] Error loading template",n);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new y(n.message,(t=n.response)===null||t===void 0?void 0:t.status,(i=n.response)===null||i===void 0?void 0:i.data))}return[2]}))}))};e.prototype.disconnectedCallback=function(){this.unlistenToTemplate()};e.prototype.listenToTemplate=function(){return __awaiter(this,void 0,void 0,(function(){var e=this;return __generator(this,(function(t){this.unlistenToTemplate();_.subscribe("templates",this.templateId,(function(){return l(e.endpoint,e.templateId)}),false,(function(t){e.template=t;e.loading=false}));return[2]}))}))};e.prototype.unlistenToTemplate=function(){if(this.templateListenerId){_.store.delListener(this.templateListenerId);this.templateListenerId=null}};e.prototype.handleCancel=function(e){e.stopPropagation();this.exit.emit()};e.prototype.handleUploadProgress=function(e){if(e>=99){this.progressPercent=100;this.progressLabel="Processing..."}else{this.progressPercent=e}};e.prototype.handleUpload=function(e){return __awaiter(this,void 0,void 0,(function(){var t,i,n,r,o,s,a,l;return __generator(this,(function(c){switch(c.label){case 0:e.stopPropagation();o=e.detail.file;if(!o){return[2]}console.log("[ATTACHMENTS] Uploading...",o);this.uploading=true;this.progressLabel="Uploading...";c.label=1;case 1:c.trys.push([1,4,,5]);return[4,p(this.endpoint,this.templateId,o,this.handleUploadProgress.bind(this))];case 2:s=c.sent();console.log("[ATTACHMENTS] Created attachment",s);a=this;return[4,_.getTemplate(this.endpoint,this.templateId,true)];case 3:a.template=c.sent();console.log("[ATTACHMENTS] Updated template",this.template);(t=this.templateUpdated)===null||t===void 0?void 0:t.emit({endpoint:this.endpoint,template:this.template,event:"attachments"});this.uploading=false;this.progressLabel="";this.progressPercent=0;return[3,5];case 4:l=c.sent();console.log("[ATTACHMENTS] Error creating template",l);(i=this.sdkError)===null||i===void 0?void 0:i.emit(new y(l.message,(n=l.response)===null||n===void 0?void 0:n.status,(r=l.response)===null||r===void 0?void 0:r.data));this.uploading=false;return[3,5];case 5:return[2]}}))}))};e.prototype.handleNext=function(e){var t;e.stopPropagation();this.uploading=false;this.progressLabel="";this.progressPercent=0;(t=this.next)===null||t===void 0?void 0:t.emit({template:this.template})};e.prototype.confirmDelete=function(){return __awaiter(this,void 0,void 0,(function(){var e;return __generator(this,(function(t){switch(t.label){case 0:return[4,m(this.endpoint,this.templateId,this.confirmDeleteDocument.id)];case 1:t.sent();e=this;return[4,_.getTemplate(this.endpoint,this.templateId,true)];case 2:e.template=t.sent();console.log("[ATTACHMENTS] New template",this.template);this.confirmDeleteDocument=null;return[2]}}))}))};e.prototype.handleDelete=function(e){return __awaiter(this,void 0,void 0,(function(){var t;return __generator(this,(function(i){if((((t=this.template)===null||t===void 0?void 0:t.documents)||[]).length>1){this.confirmDeleteDocument=e}else{this.showDeleteError=true}return[2]}))}))};e.prototype.getFileIcon=function(e){switch(e.mime){case"application/pdf":return M;case"image/jpeg":return S;case"image/png":return q;case"application/msword":case"application/vnd.openxmlformats-officedocument.wordprocessingml.document":return E}return C};e.prototype.render=function(){var e=this;var t,i;if(!this.endpoint.session){return n(r,null,n("verdocs-component-error",{message:"You must be authenticated to use this module."}))}if(this.loading){return n(r,{class:"loading"},n("verdocs-loader",null))}if(!this.endpoint.session||!this.template){return n(r,{class:"empty"})}return n(r,null,n("h5",null,"Existing Attachments"),n("div",{class:"attachments"},(((t=this.template)===null||t===void 0?void 0:t.documents)||[]).map((function(t){return n("div",{class:"attachment"},n("div",{class:"file-icon",innerHTML:e.getFileIcon(t)}),n("div",{class:"filename",title:t.name},t.name),n("div",{class:"pages"},n("div",{class:"count"},t.pages),n("div",{class:"pages-icon",innerHTML:I})),n("div",{class:"trash-icon",innerHTML:T,onClick:function(){return e.handleDelete(t)}}))}))),n("h5",null,"Attach a New Document"),this.uploading?n("div",{class:"loader-wrapper"},n("verdocs-loader",null),this.progressLabel&&n("div",{class:"progress-wrapper"},n("verdocs-progress-bar",{showPercent:true,percent:this.progressPercent,label:this.progressLabel}))):n("verdocs-file-chooser",{onFileSelected:function(t){return e.handleUpload(t)}}),n("div",{class:"buttons"},n("verdocs-button",{variant:"outline",label:"Cancel",size:"small",onClick:function(t){return e.handleCancel(t)},disabled:this.uploading}),n("verdocs-button",{label:"Next",size:"small",onClick:function(t){return e.handleNext(t)},disabled:!(((i=this.template)===null||i===void 0?void 0:i.documents)||[]).length||this.uploading})),this.showDeleteError&&n("verdocs-ok-dialog",{heading:"Unable to Delete Attachment",message:"Templates must contain at least one attachment.",onNext:function(){return e.showDeleteError=false}}),this.confirmDeleteDocument&&n("verdocs-ok-dialog",{heading:"Delete this Attachment?",message:"This operation cannot be undone. All fields placed<br />on the deleted attachment will also be removed.",onNext:function(){return e.confirmDelete()},showCancel:true,onExit:function(){e.confirmDeleteDocument=null}}))};return e}());$.style=K;var ee='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-template-build-tabs{-ms-flex:1;flex:1;gap:15px;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-template-build-tabs verdocs-button-panel svg{-webkit-transform:scale(0.8);transform:scale(0.8)}verdocs-template-build-tabs verdocs-template-attachments,verdocs-template-build-tabs verdocs-template-roles{margin:20px}verdocs-template-build-tabs verdocs-template-fields{border-top:1px solid #777777}verdocs-template-build-tabs verdocs-template-attachments{padding:20px;background:#ffffff}verdocs-template-build-tabs verdocs-template-fields{width:100%}verdocs-template-build-tabs verdocs-preview{-ms-flex:1;flex:1}.template-details-panel .row{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;gap:8px;margin:10px 0}.template-details-panel label{-ms-flex:0 0 70px;flex:0 0 70px}.template-details-panel .value{-ms-flex:1;flex:1;font-weight:300;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.template-details-panel .icon-button{cursor:pointer;opacity:0.8;-ms-flex:0;flex:0;width:18px;height:18px}.template-details-panel .icon-button svg{stroke:#000000;width:18px;height:18px}.template-details-panel .icon-button:hover{opacity:1}';var te=ee;var ie='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24" fill="#5c6575"><path d="M11.925 18q.55 0 .938-.387.387-.388.387-.938 0-.55-.387-.925-.388-.375-.938-.375-.55 0-.925.375t-.375.925q0 .55.375.938.375.387.925.387Zm-.95-3.85h1.95q0-.8.2-1.287.2-.488 1.025-1.288.65-.625 1.025-1.213.375-.587.375-1.437 0-1.425-1.025-2.175Q13.5 6 12.1 6q-1.425 0-2.35.775t-1.275 1.85l1.775.7q.125-.45.55-.975.425-.525 1.275-.525.725 0 1.1.412.375.413.375.888 0 .475-.287.9-.288.425-.713.775-1.075.95-1.325 1.475-.25.525-.25 1.875ZM12 22.2q-2.125 0-3.988-.8-1.862-.8-3.237-2.175Q3.4 17.85 2.6 15.988 1.8 14.125 1.8 12t.8-3.988q.8-1.862 2.175-3.237Q6.15 3.4 8.012 2.6 9.875 1.8 12 1.8t3.988.8q1.862.8 3.237 2.175Q20.6 6.15 21.4 8.012q.8 1.863.8 3.988t-.8 3.988q-.8 1.862-2.175 3.237Q17.85 20.6 15.988 21.4q-1.863.8-3.988.8Zm0-2.275q3.325 0 5.625-2.3t2.3-5.625q0-3.325-2.3-5.625T12 4.075q-3.325 0-5.625 2.3T4.075 12q0 3.325 2.3 5.625t5.625 2.3ZM12 12Z"/></svg>';var ne='<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5"><path stroke-linecap="round" stroke-linejoin="round" d="M15.75 17.25v3.375c0 .621-.504 1.125-1.125 1.125h-9.75a1.125 1.125 0 0 1-1.125-1.125V7.875c0-.621.504-1.125 1.125-1.125H6.75a9.06 9.06 0 0 1 1.5.124m7.5 10.376h3.375c.621 0 1.125-.504 1.125-1.125V11.25c0-4.46-3.243-8.161-7.5-8.876a9.06 9.06 0 0 0-1.5-.124H9.375c-.621 0-1.125.504-1.125 1.125v3.5m7.5 10.375H9.375a1.125 1.125 0 0 1-1.125-1.125v-9.25m12 6.625v-1.875a3.375 3.375 0 0 0-3.375-3.375h-1.5a1.125 1.125 0 0 1-1.125-1.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H9.75" /></svg>';var re=["attachments","roles","settings","fields","preview"];var oe=e("verdocs_template_build_tabs",function(){function e(e){t(this,e);this.sdkError=i(this,"sdkError",7);this.stepChanged=i(this,"stepChanged",7);this.templateListenerId=null;this.endpoint=a.getDefault();this.templateId=null;this.step="preview";this.loading=true;this.template=null}e.prototype.disconnectedCallback=function(){this.unlistenToTemplate()};e.prototype.listenToTemplate=function(){return __awaiter(this,void 0,void 0,(function(){var e=this;return __generator(this,(function(t){this.unlistenToTemplate();_.subscribe("templates",this.templateId,(function(){return l(e.endpoint,e.templateId)}),false,(function(t){e.template=t;e.loading=false}));return[2]}))}))};e.prototype.unlistenToTemplate=function(){if(this.templateListenerId){_.store.delListener(this.templateListenerId);this.templateListenerId=null}};e.prototype.onTemplateIdChanged=function(e){console.log("[BUILD_TABS] Template ID changed",e);this.listenToTemplate()};e.prototype.onStepChanged=function(e){console.log("[BUILD_TABS] Step changed",e)};e.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,i;return __generator(this,(function(n){try{this.endpoint.loadSession();if(!this.endpoint.session){console.log("[BUILD_TABS] Unable to start builder session, must be authenticated");return[2]}if(!this.templateId){this.step="attachments";console.log("[BUILD_TABS] Missing required template ID, forcing view to attachments");return[2]}this.listenToTemplate()}catch(n){console.log("[BUILD_TABS] Error loading template",n);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new y(n.message,(t=n.response)===null||t===void 0?void 0:t.status,(i=n.response)===null||i===void 0?void 0:i.data))}return[2]}))}))};e.prototype.setStep=function(e){var t;console.log("[BUILD_TABS] Selected step",e.detail.tab.id);e.stopPropagation();e.preventDefault();this.step=e.detail.tab.id;(t=this.stepChanged)===null||t===void 0?void 0:t.emit(e.detail.tab.id)};e.prototype.copyTemplateId=function(){var e=this;navigator.clipboard.writeText(this.templateId).then((function(){k("Template ID copied",{style:"success",duration:3e3})})).catch((function(t){var i;console.warn("[BUILD_TABS] Error copying to clipboard",t);(i=e.sdkError)===null||i===void 0?void 0:i.emit(t)}))};e.prototype.render=function(){var e=this;var t,i,o,s,a,l,c,u,d;if(this.loading){return n(r,null,n("verdocs-loader",null))}if(!this.endpoint.session){return n(r,null,n("verdocs-component-error",{message:"You must be authenticated to use this module."}))}var f=(((t=this.template)===null||t===void 0?void 0:t.documents)||[]).length>0;var h=f&&(((i=this.template)===null||i===void 0?void 0:i.roles)||[]).length>0;var v=h&&(((o=this.template)===null||o===void 0?void 0:o.fields)||[]).length>0;var p=Math.max(re.indexOf(this.step),0);if(!v&&p>=4){p=3}if(!h&&p>=3){p=1}if(!f&&p>=1){p=0}return n(r,null,n("verdocs-tabs",{onSelectTab:function(t){return e.setStep(t)},selectedTab:p,tabs:[{id:"attachments",disabled:false,label:"Attachment(s)"},{id:"roles",disabled:!f,label:"Roles"},{id:"settings",disabled:!h,label:"Settings"},{id:"fields",disabled:!h,label:"Fields"},{id:"preview",disabled:!v,label:"Preview/Send"}]}),this.templateId&&n("div",{class:"info"},n("verdocs-button-panel",{icon:ie},n("div",{class:"template-details-panel"},n("h6",null,"Template Details"),n("div",{class:"row"},n("label",null,"ID:"),n("div",{class:"value"},this.templateId),n("div",{class:"icon-button",innerHTML:ne,onClick:function(){return e.copyTemplateId()}})),n("div",{class:"row"},n("label",null,"Name:"),n("div",{class:"value"},(s=this.template)===null||s===void 0?void 0:s.name)),n("div",{class:"row"},n("label",null,"Visibility:"),n("div",{class:"value"},((a=this.template)===null||a===void 0?void 0:a.is_public)?"Public":((l=this.template)===null||l===void 0?void 0:l.is_personal)?"Private":"Shared")),n("div",{class:"row"},n("label",null,"Created:"),n("div",{class:"value"},((c=this.template)===null||c===void 0?void 0:c.counter)?L(new Date((u=this.template)===null||u===void 0?void 0:u.created_at),"P p"):"")),n("div",{class:"row"},n("label",null,"Used:"),n("div",{class:"value"},(d=this.template)===null||d===void 0?void 0:d.counter," time(s)"))))))};Object.defineProperty(e,"watchers",{get:function(){return{templateId:["onTemplateIdChanged"],step:["onStepChanged"]}},enumerable:false,configurable:true});return e}());oe.style=te;var se="@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-template-fields{font-family:\"Inter\", -apple-system, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", sans-serif;position:relative;display:block;min-height:600px}verdocs-template-fields .page-0{padding:65px 15px 0 15px;-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-template-fields .page-0 .user-placed-fields{height:100px;position:relative;background:#ffffff;-webkit-box-shadow:0 0 10px 5px rgba(0, 0, 0, 0.0588235294);box-shadow:0 0 10px 5px rgba(0, 0, 0, 0.0588235294)}verdocs-template-fields .page-0 .user-placed-fields .title{top:0;left:0;color:#ffffff;font-size:12px;padding:3px 6px;font-weight:bold;position:absolute;background:#46497d}verdocs-template-fields .pages{display:-ms-flexbox;display:flex;padding:15px;row-gap:15px;min-height:200px;position:relative;-ms-flex-align:center;align-items:center;-webkit-box-sizing:border-box;box-sizing:border-box;-ms-flex-direction:column;flex-direction:column}verdocs-template-fields .pages div,verdocs-template-fields .pages canvas{-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-template-fields #verdocs-template-fields-toolbar{width:100%;height:50px;display:-ms-flexbox;display:flex;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;font-weight:700;padding:0 20px 0 0;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;color:#f5f5fa;-ms-flex-pack:center;justify-content:center;background:#46497d}verdocs-template-fields #verdocs-template-fields-toolbar>verdocs-select-input{margin:0}verdocs-template-fields #verdocs-template-fields-toolbar svg{width:24px;height:24px}verdocs-template-fields #verdocs-template-fields-toolbar .add-for{margin:0;font-weight:500;color:#f5f5fa}verdocs-template-fields #verdocs-template-fields-toolbar verdocs-select-input{margin:0 20px 0 0}@media all and (max-width: 1000px){verdocs-template-fields #verdocs-template-fields-toolbar{-webkit-column-gap:8px;-moz-column-gap:8px;column-gap:8px;padding:0 10px 0 0}verdocs-template-fields #verdocs-template-fields-toolbar svg{-webkit-transform:scale(0.8);transform:scale(0.8)}verdocs-template-fields #verdocs-template-fields-toolbar .add-for,verdocs-template-fields #verdocs-template-fields-toolbar verdocs-select-input{display:none}}@media all and (max-width: 600px){verdocs-template-fields #verdocs-template-fields-toolbar{-webkit-column-gap:6px;-moz-column-gap:6px;column-gap:6px}verdocs-template-fields #verdocs-template-fields-toolbar svg{-webkit-transform:scale(0.6);transform:scale(0.6)}verdocs-template-fields #verdocs-template-fields-toolbar .separator,verdocs-template-fields #verdocs-template-fields-toolbar .add-for,verdocs-template-fields #verdocs-template-fields-toolbar verdocs-select-input{display:none}}verdocs-template-fields.placing-attachment{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='m10.55 16.55 7.275-7.275L16.05 7.5l-5.5 5.45-2.675-2.65L6.1 12.075Zm-5.375 4.925q-1.125 0-1.887-.763-.763-.762-.763-1.887V5.175q0-1.125.763-1.888.762-.762 1.887-.762h13.65q1.125 0 1.888.762.762.763.762 1.888v13.65q0 1.125-.762 1.887-.763.763-1.888.763Zm0-2.65h13.65V5.175H5.175v13.65Zm0-13.65v13.65-13.65Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-checkbox{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='m10.55 16.55 7.275-7.275L16.05 7.5l-5.5 5.45-2.675-2.65L6.1 12.075Zm-5.375 4.925q-1.125 0-1.887-.763-.763-.762-.763-1.887V5.175q0-1.125.763-1.888.762-.762 1.887-.762h13.65q1.125 0 1.888.762.762.763.762 1.888v13.65q0 1.125-.762 1.887-.763.763-1.888.763Zm0-2.65h13.65V5.175H5.175v13.65Zm0-13.65v13.65-13.65Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-date{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath fill='%23000000' d='M7.6 13.925q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375Zm4.4 0q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375Zm4.4 0q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375ZM5.3 22.85q-1.325 0-2.238-.912-.912-.913-.912-2.238V6.3q0-1.325.912-2.238.913-.912 2.238-.912H6v-2h2.575v2h6.85v-2H18v2h.7q1.325 0 2.238.912.912.913.912 2.238v13.4q0 1.325-.912 2.238-.913.912-2.238.912Zm0-3.15h13.4V10H5.3v9.7ZM5.3 8h13.4V6.3H5.3Zm0 0V6.3 8Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-dropdown{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24' stroke-width='1.5' stroke='currentColor'%3E%3Cpath stroke='%23000000' stroke-linecap='round' stroke-linejoin='round' d='M3 4.5h14.25M3 9h9.75M3 13.5h9.75m4.5-4.5v12m0 0l-3.75-3.75M17.25 21L21 17.25' /%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-initial{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='M6.225 20.775V7h-5V3.225H15V7h-5v13.775Zm9.775 0v-8h-3V9h9.775v3.775h-3v8Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-payment{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='m10.55 16.55 7.275-7.275L16.05 7.5l-5.5 5.45-2.675-2.65L6.1 12.075Zm-5.375 4.925q-1.125 0-1.887-.763-.763-.762-.763-1.887V5.175q0-1.125.763-1.888.762-.762 1.887-.762h13.65q1.125 0 1.888.762.762.763.762 1.888v13.65q0 1.125-.762 1.887-.763.763-1.888.763Zm0-2.65h13.65V5.175H5.175v13.65Zm0-13.65v13.65-13.65Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-radio{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='M12 17q2.075 0 3.538-1.463Q17 14.075 17 12t-1.462-3.538Q14.075 7 12 7 9.925 7 8.463 8.462 7 9.925 7 12q0 2.075 1.463 3.537Q9.925 17 12 17Zm0 5.85q-2.275 0-4.25-.85t-3.438-2.312Q2.85 18.225 2 16.25q-.85-1.975-.85-4.25T2 7.75q.85-1.975 2.312-3.438Q5.775 2.85 7.75 2q1.975-.85 4.25-.85t4.25.85q1.975.85 3.438 2.312Q21.15 5.775 22 7.75q.85 1.975.85 4.25T22 16.25q-.85 1.975-2.312 3.438Q18.225 21.15 16.25 22q-1.975.85-4.25.85Zm0-3.15q3.25 0 5.475-2.225Q19.7 15.25 19.7 12q0-3.25-2.225-5.475Q15.25 4.3 12 4.3q-3.25 0-5.475 2.225Q4.3 8.75 4.3 12q0 3.25 2.225 5.475Q8.75 19.7 12 19.7Zm0-7.7Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-signature{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='m9.225 21.225 4.65-4.65h8.45v4.65Zm-5.35-2.2H5.05l8.5-8.5-1.175-1.175-8.5 8.5Zm14.25-9.95L13.8 4.8l1.325-1.325q.625-.65 1.525-.663.9-.012 1.6.663l1.225 1.175q.675.675.663 1.562-.013.888-.663 1.513ZM16.7 10.55 6 21.225H1.675V16.9L12.35 6.225Zm-3.725-.625-.6-.575 1.175 1.175Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-textarea{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='M3.225 20.725v-3.15h11.55v3.15Zm0-4.775V12.8h17.55v3.15Zm0-4.75V8.05h17.55v3.15Zm0-4.775v-3.15h17.55v3.15Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-textbox{cursor:url(\"data:image/svg+xml,%3Csvg width='32' height='15' viewBox='0 0 32 15' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cmask id='path-1-inside-1_1401_24' fill='white'%3E%3Cpath d='M0 0H32V15H0V0Z'/%3E%3C/mask%3E%3Cpath d='M0 0H32V15H0V0Z' fill='%234C56CB' fill-opacity='0.1'/%3E%3Cpath d='M0 0V-1H-1V0H0ZM0 15H-1V16H0V15ZM0 1H32V-1H0V1ZM32 14H0V16H32V14ZM1 15V0H-1V15H1Z' fill='%234C56CB' mask='url(%23path-1-inside-1_1401_24)'/%3E%3Cpath d='M3 11.8V8.65H14.15V11.8H3ZM3 6.65V3.5H20.15V6.65H3Z' fill='%234C56CB'/%3E%3Cline x1='31.5' y1='1' x2='31.5' y2='14' stroke='%234C56CB' stroke-opacity='0.32' stroke-dasharray='1 1'/%3E%3C/svg%3E%0A\") 0 14, pointer}verdocs-template-fields.placing-timestamp{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath fill='%23000000' d='M9 1h6v2H9zm10.03 6.39 1.42-1.42c-.43-.51-.9-.99-1.41-1.41l-1.42 1.42C16.07 4.74 14.12 4 12 4c-4.97 0-9 4.03-9 9s4.02 9 9 9 9-4.03 9-9c0-2.12-.74-4.07-1.97-5.61zM13 14h-2V8h2v6z'%3E%3C/path%3E%3C/svg%3E\") 16 16, pointer}";var ae=se;var le='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="M3.425 16.15V13h11.15v3.15Zm0-5.15V7.85h17.15V11Z"/></svg>';var ce='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="m10.55 16.55 7.275-7.275L16.05 7.5l-5.5 5.45-2.675-2.65L6.1 12.075Zm-5.375 4.925q-1.125 0-1.887-.763-.763-.762-.763-1.887V5.175q0-1.125.763-1.888.762-.762 1.887-.762h13.65q1.125 0 1.888.762.762.763.762 1.888v13.65q0 1.125-.762 1.887-.763.763-1.888.763Zm0-2.65h13.65V5.175H5.175v13.65Zm0-13.65v13.65-13.65Z"/></svg>';var ue='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="M12 17q2.075 0 3.538-1.463Q17 14.075 17 12t-1.462-3.538Q14.075 7 12 7 9.925 7 8.463 8.462 7 9.925 7 12q0 2.075 1.463 3.537Q9.925 17 12 17Zm0 5.85q-2.275 0-4.25-.85t-3.438-2.312Q2.85 18.225 2 16.25q-.85-1.975-.85-4.25T2 7.75q.85-1.975 2.312-3.438Q5.775 2.85 7.75 2q1.975-.85 4.25-.85t4.25.85q1.975.85 3.438 2.312Q21.15 5.775 22 7.75q.85 1.975.85 4.25T22 16.25q-.85 1.975-2.312 3.438Q18.225 21.15 16.25 22q-1.975.85-4.25.85Zm0-3.15q3.25 0 5.475-2.225Q19.7 15.25 19.7 12q0-3.25-2.225-5.475Q15.25 4.3 12 4.3q-3.25 0-5.475 2.225Q4.3 8.75 4.3 12q0 3.25 2.225 5.475Q8.75 19.7 12 19.7Zm0-7.7Z"/></svg>';var de='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="M7.6 13.925q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375Zm4.4 0q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375Zm4.4 0q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375ZM5.3 22.85q-1.325 0-2.238-.912-.912-.913-.912-2.238V6.3q0-1.325.912-2.238.913-.912 2.238-.912H6v-2h2.575v2h6.85v-2H18v2h.7q1.325 0 2.238.912.912.913.912 2.238v13.4q0 1.325-.912 2.238-.913.912-2.238.912Zm0-3.15h13.4V10H5.3v9.7ZM5.3 8h13.4V6.3H5.3Zm0 0V6.3 8Z"/></svg>';var fe='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="m9.225 21.225 4.65-4.65h8.45v4.65Zm-5.35-2.2H5.05l8.5-8.5-1.175-1.175-8.5 8.5Zm14.25-9.95L13.8 4.8l1.325-1.325q.625-.65 1.525-.663.9-.012 1.6.663l1.225 1.175q.675.675.663 1.562-.013.888-.663 1.513ZM16.7 10.55 6 21.225H1.675V16.9L12.35 6.225Zm-3.725-.625-.6-.575 1.175 1.175Z"/></svg>';var he='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="M6.225 20.775V7h-5V3.225H15V7h-5v13.775Zm9.775 0v-8h-3V9h9.775v3.775h-3v8Z"/></svg>';var ve='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="M9 1h6v2H9zm10.03 6.39 1.42-1.42c-.43-.51-.9-.99-1.41-1.41l-1.42 1.42C16.07 4.74 14.12 4 12 4c-4.97 0-9 4.03-9 9s4.02 9 9 9 9-4.03 9-9c0-2.12-.74-4.07-1.97-5.61zM13 14h-2V8h2v6z"></path></svg>';var pe='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24" stroke-width="1.5" stroke="currentColor"><path stroke="#ffffff" stroke-linecap="round" stroke-linejoin="round" d="M3 4.5h14.25M3 9h9.75M3 13.5h9.75m4.5-4.5v12m0 0l-3.75-3.75M17.25 21L21 17.25" /></svg>';var me='<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-6"><path stroke-linecap="round" stroke-linejoin="round" d="m18.375 12.739-7.693 7.693a4.5 4.5 0 0 1-6.364-6.364l10.94-10.94A3 3 0 1 1 19.5 7.372L8.552 18.32m.009-.01-.01.01m5.699-9.941-7.81 7.81a1.5 1.5 0 0 0 2.112 2.13" /></svg>';var ge='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14.707 14.707"><g><rect x="6.275" y="0" fill="#ffffff7f" width="1" height="15"/></g></svg>';var be=[{id:"signature",tooltip:"Signature",icon:fe,class:"signature"},{id:"initial",tooltip:"Initials",icon:he,class:"initial"},{id:"sep1",tooltip:"",icon:ge,class:"separator"},{id:"textbox",tooltip:"Text Box",icon:le,class:"textbox"},{id:"checkbox",tooltip:"Check Box",icon:ce,class:"checkbox"},{id:"radio",tooltip:"Radio Button",icon:ue,class:"radio"},{id:"dropdown",tooltip:"Dropdown",icon:pe,class:"dropdown"},{id:"sep2",tooltip:"",icon:ge,class:"separator"},{id:"date",tooltip:"Date",icon:de,class:"date"},{id:"timestamp",tooltip:"Timestamp",icon:ve,class:"timestamp"},{id:"attachment",tooltip:"Attachment",icon:me,class:"attachment"}];var xe=e("verdocs_template_fields",function(){function e(e){t(this,e);this.sdkError=i(this,"sdkError",7);this.templateUpdated=i(this,"templateUpdated",7);this.fieldsUpdated=i(this,"fieldsUpdated",7);this.templateListenerId=null;this.pageHeights={};this.cachedPageInfo={};this.endpoint=a.getDefault();this.templateId=null;this.toolbarTargetId=null;this.placing=null;this.showMustSelectRole=false;this.selectedRoleName="";this.loading=true;this.template=null}e.prototype.onTemplateIdChanged=function(){this.listenToTemplate()};e.prototype.handleKeyDown=function(e){if(e.key==="Escape"){this.placing=null}};e.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,i;return __generator(this,(function(n){try{this.endpoint.loadSession();if(!this.templateId){console.log("[FIELDS] Missing required template ID ".concat(this.templateId));return[2]}if(!this.endpoint.session){console.log("[FIELDS] Unable to start builder session, must be authenticated");return[2]}this.listenToTemplate()}catch(n){console.log("[FIELDS] Error with fields session",n);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new y(n.message,(t=n.response)===null||t===void 0?void 0:t.status,(i=n.response)===null||i===void 0?void 0:i.data))}return[2]}))}))};e.prototype.componentDidRender=function(){H.dynamicDrop(true);var e=this.toolbarTargetId?document.getElementById(this.toolbarTargetId):null;var t=document.getElementById("verdocs-template-fields-toolbar");if(e&&t){console.log("[FIELDS] Moving toolbar");t.remove();e.append(t)}};e.prototype.componentWillUpdate=function(){var e=this;var t,i;var n=((t=this.template)===null||t===void 0?void 0:t.roles)||[];if(!this.selectedRoleName||!n.find((function(t){return t&&t.name===e.selectedRoleName}))){this.selectedRoleName=((i=n[0])===null||i===void 0?void 0:i.name)||"";console.log("[FIELDS] Selected new role",this.selectedRoleName)}};e.prototype.disconnectedCallback=function(){this.unlistenToTemplate()};e.prototype.listenToTemplate=function(){return __awaiter(this,void 0,void 0,(function(){var e=this;return __generator(this,(function(t){this.unlistenToTemplate();_.subscribe("templates",this.templateId,(function(){return l(e.endpoint,e.templateId)}),false,(function(t){var i,n;e.template=t;e.loading=false;e.selectedRoleName=((n=(i=t.roles)===null||i===void 0?void 0:i[0])===null||n===void 0?void 0:n.name)||""}));return[2]}))}))};e.prototype.unlistenToTemplate=function(){if(this.templateListenerId){_.store.delListener(this.templateListenerId);this.templateListenerId=null}};e.prototype.attachFieldAttributes=function(e,t,i){var n=this;i.addEventListener("settingsChanged",(function(){var e;(e=n.templateUpdated)===null||e===void 0?void 0:e.emit({endpoint:n.endpoint,template:n.template,event:"added-field"})}));i.addEventListener("deleted",(function(){var e;i.remove();(e=n.templateUpdated)===null||e===void 0?void 0:e.emit({endpoint:n.endpoint,template:n.template,event:"updated-field"})}));i.setAttribute("templateid",this.templateId);i.setAttribute("fieldname",t.name);i.setAttribute("pageNumber",String(e.pageNumber));i.setAttribute("xScale",String(e.xScale));i.setAttribute("yScale",String(e.yScale));i.setAttribute("name",t.name)};e.prototype.handlePageRendered=function(e){var t=this;var i;var n=e.detail;this.cachedPageInfo[n.pageNumber]=n;this.pageHeights[n.pageNumber]=n.naturalHeight;(((i=this.template)===null||i===void 0?void 0:i.fields)||[]).filter((function(e){return e&&e.page===n.pageNumber})).forEach((function(e){var i=D(e);var n=document.getElementById(i);if(n){n.setAttribute("fieldname",e.name);n.setAttribute("pagenumber",String(e.page));t.makeDraggable(n)}}))};e.prototype.makeDraggable=function(e){H(e).draggable({listeners:{move:this.handleMoveField.bind(this),end:this.handleMoveEnd.bind(this)}})};e.prototype.handleMoveField=function(e){return __awaiter(this,void 0,void 0,(function(){var t,i,n,r,o,s;return __generator(this,(function(a){t=+(e.target.getAttribute("posX")||0);i=+(e.target.getAttribute("posY")||0);n=+(e.target.getAttribute("xScale")||1);r=+(e.target.getAttribute("yScale")||1);o=e.dx/n+t;s=e.dy/r+i;e.target.setAttribute("posX",o);e.target.setAttribute("posy",s);Z(e.target,"translate","".concat(o,"px, ").concat(s,"px"));return[2]}))}))};e.prototype.handleMoveEnd=function(e){return __awaiter(this,void 0,void 0,(function(){var t,i,n,r,o,s,a,l,c,u,d,f,h,v,p,m,b,x,w,E,q,S,M,C,I,T,L,H,Z,D,A,j,R,U,B,P,Q,F,Y;return __generator(this,(function(W){switch(W.label){case 0:c=e.target.getAttribute("fieldname");u=(((t=this.template)===null||t===void 0?void 0:t.fields)||[]).find((function(e){return e.name===c}));if(!u){console.log("[FIELDS] Unable to find field",c,e.target);return[2]}d=e.target.getAttribute("pagenumber");f=this.cachedPageInfo[d],h=f.naturalWidth,v=h===void 0?612:h,p=f.naturalHeight,m=p===void 0?792:p,b=f.renderedHeight,x=b===void 0?792:b;w=e.target.getBoundingClientRect();E=e.target.parentElement;q=E.getBoundingClientRect();S=u.width||V(u.type);M=u.height||N(u.type);C=Math.max(w.left-q.left,0);I=Math.max(x-(q.bottom-w.bottom),0);T=parseInt(d);if(I>x){T=Math.min(T+1,((r=(n=((i=this.template)===null||i===void 0?void 0:i.documents)||[])===null||n===void 0?void 0:n[0])===null||r===void 0?void 0:r.pages)||1);I-=x;x=this.cachedPageInfo[T].renderedHeight;console.log("Next page",{newPageNumber:T,newY:I,renderedHeight:x})}else if(I<0){T=Math.max(T-1,1);x=this.cachedPageInfo[T].renderedHeight;I+=x;console.log("[FIELDS] Next page",{newPageNumber:T,newY:I,renderedHeight:x})}L=this.viewCoordinatesToPageCoordinates(C,I,d,v-S,m-M),H=L.x,Z=L.y;W.label=1;case 1:W.trys.push([1,3,,4]);D={x:H,y:Z,page:T};return[4,g(this.endpoint,this.templateId,c,D)];case 2:A=W.sent();console.log("[FIELDS] Updated",A);j=JSON.parse(JSON.stringify(this.template));R=j.fields.findIndex((function(e){return e.name===c}));if(R>-1){j.fields[R]=A}_.updateTemplate(this.templateId,j);e.target.removeAttribute("posX");e.target.removeAttribute("posY");O(e.target);U=this.cachedPageInfo[d],B=U.xScale,P=B===void 0?1:B,Q=U.yScale,F=Q===void 0?1:Q;z(e.target,A,P,F);(o=this.templateUpdated)===null||o===void 0?void 0:o.emit({endpoint:this.endpoint,template:j,event:"updated-field"});return[3,4];case 3:Y=W.sent();k("Error updating field, please try again later",{style:"error"});console.log("[FIELDS] Error updating field",Y);(s=this.sdkError)===null||s===void 0?void 0:s.emit(new y(Y.message,(a=Y.response)===null||a===void 0?void 0:a.status,(l=Y.response)===null||l===void 0?void 0:l.data));e.target.removeAttribute("posX");e.target.removeAttribute("posY");O(e.target);return[3,4];case 4:return[2]}}))}))};e.prototype.generateFieldName=function(e,t){var i;var n=1;var r;do{r="".concat(e,"P").concat(t,"-").concat(n);n++}while((((i=this.template)===null||i===void 0?void 0:i.fields)||[]).some((function(e){return e&&e.name===r})));return r};e.prototype.viewCoordinatesToPageCoordinates=function(e,t,i,n,r){var o=this.cachedPageInfo[i],s=o.xScale,a=s===void 0?1:s,l=o.yScale,c=l===void 0?1:l,u=o.renderedHeight,d=u===void 0?792:u;var f=Math.floor(Math.min(e/a,n));var h=Math.floor(Math.min(Math.max(d-t,0)/c,r));return{x:f,y:h}};e.prototype.handleClickPage=function(e,t){return __awaiter(this,void 0,void 0,(function(){var i,n,r,o,s,a,l,c,u,d,f,h,v,p,m,g;return __generator(this,(function(x){switch(x.label){case 0:if(!this.placing)return[3,2];n=e.offsetX;r=e.offsetY;o=V(this.placing);s=N(this.placing);a=this.cachedPageInfo[t];l=a.naturalWidth,c=l===void 0?612:l,u=a.naturalHeight,d=u===void 0?792:u;f=this.viewCoordinatesToPageCoordinates(n,r,t,c-o,d-s);h=Math.floor(f.x);v=Math.floor(f.y);p={name:this.generateFieldName(this.placing,t),role_name:this.selectedRoleName,template_id:this.templateId,document_id:a.documentId,type:this.placing,required:this.placing!=="radio",page:t,validator:null,label:null,default:null,placeholder:null,group:null,settings:{},x:h,y:v,width:o,height:s,multiline:false,options:this.placing==="radio"?[{id:"option-1",label:"Option 1"}]:[]};console.log("[FIELDS] Will save new field",p);return[4,b(this.endpoint,this.templateId,p)];case 1:m=x.sent();console.log("[FIELDS] Saved field",m);g=JSON.parse(JSON.stringify(this.template));g.fields.push(m);_.updateTemplate(this.templateId,g);(i=this.templateUpdated)===null||i===void 0?void 0:i.emit({endpoint:this.endpoint,template:g,event:"added-field"});this.placing=null;x.label=2;case 2:return[2]}}))}))};e.prototype.render=function(){var e;var t=this;var i,o,s;if(this.loading){return n(r,null,n("verdocs-loader",null))}if(!this.endpoint.session){return n(r,null,n("verdocs-component-error",{message:"You must be authenticated to use this module."}))}var a=(((i=this.template)===null||i===void 0?void 0:i.roles)||[]).map((function(e){return{value:e.name,label:e.full_name?"".concat(e.name,": ").concat(e.full_name):e.name}}));return n(r,{class:this.placing?(e={},e["placing-".concat(this.placing)]=true,e):{},onSubmit:function(){}},n("div",{id:"verdocs-template-fields-toolbar"},n("div",{class:"add-for"},"Add field:"),n("verdocs-select-input",{value:this.selectedRoleName,options:a,onInput:function(e){return t.selectedRoleName=e.target.value}}),be.map((function(e){return n("verdocs-toolbar-icon",{text:e.tooltip,icon:e.icon,class:e.class,onClick:function(){if(e.tooltip){if(t.selectedRoleName){t.placing=e.id}else{t.showMustSelectRole=true}}}})}))),n("div",{class:"pages"},(((o=this.template)===null||o===void 0?void 0:o.documents)||[]).map((function(e){var i=c(1,e.pages);return i.map((function(i){var r=e.page_sizes[i];return n("verdocs-template-document-page",{templateId:t.templateId,documentId:e.id,pageNumber:i,virtualWidth:(r===null||r===void 0?void 0:r.width)||612,virtualHeight:(r===null||r===void 0?void 0:r.height)||792,disabled:true,editable:true,done:false,onClick:function(e){return t.handleClickPage(e,i)},onPageRendered:function(e){return t.handlePageRendered(e)},layers:[{name:"page",type:"canvas"},{name:"controls",type:"div"}]})}))}))),this.showMustSelectRole&&n("verdocs-ok-dialog",{heading:"Unable to add field",message:(((s=this.template)===null||s===void 0?void 0:s.roles)||[]).length>0?"Please select a role before adding fields.":"Please add at least one role before adding fields.",onNext:function(){return t.showMustSelectRole=false}}))};Object.defineProperty(e,"watchers",{get:function(){return{templateId:["onTemplateIdChanged"]}},enumerable:false,configurable:true});return e}());xe.style=ae;
|
1
|
+
var __assign=this&&this.__assign||function(){__assign=Object.assign||function(e){for(var t,i=1,n=arguments.length;i<n;i++){t=arguments[i];for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r))e[r]=t[r]}return e};return __assign.apply(this,arguments)};var __awaiter=this&&this.__awaiter||function(e,t,i,n){function r(e){return e instanceof i?e:new i((function(t){t(e)}))}return new(i||(i=Promise))((function(i,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function a(e){try{l(n["throw"](e))}catch(e){o(e)}}function l(e){e.done?i(e.value):r(e.value).then(s,a)}l((n=n.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var i={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,r,o,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(e){return function(t){return l([e,t])}}function l(a){if(n)throw new TypeError("Generator is already executing.");while(s&&(s=0,a[0]&&(i=0)),i)try{if(n=1,r&&(o=a[0]&2?r["return"]:a[0]?r["throw"]||((o=r["return"])&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;if(r=0,o)a=[a[0]&2,o.value];switch(a[0]){case 0:case 1:o=a;break;case 4:i.label++;return{value:a[1],done:false};case 5:i.label++;r=a[1];a=[0];continue;case 7:a=i.ops.pop();i.trys.pop();continue;default:if(!(o=i.trys,o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){i=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(a[0]===6&&i.label<o[1]){i.label=o[1];o=a;break}if(o&&i.label<o[2]){i.label=o[2];i.ops.push(a);break}if(o[2])i.ops.pop();i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e];r=0}finally{n=o=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,r=t.length,o;n<r;n++){if(o||!(n in t)){if(!o)o=Array.prototype.slice.call(t,0,n);o[n]=t[n]}}return e.concat(o||Array.prototype.slice.call(t))};System.register(["./p-9186f42e.system.js","@verdocs/js-sdk","./p-c8a15cb7.system.js","./p-35dcb386.system.js","./p-9b26e4e0.system.js","./p-cd546dbe.system.js","./p-2c5350ec.system.js","./p-70751089.system.js","./p-f29eb00a.system.js","./p-21b1acec.system.js","./p-d738b5db.system.js"],(function(e){"use strict";var t,i,n,r,o,s,a,l,c,u,d,f,h,v,p,m,g,b,x,w,y,_,k,E,q,S,M,C,I,T,L,H,Z,O,z,D,V,N;return{setters:[function(e){t=e.r;i=e.c;n=e.h;r=e.H;o=e.F;s=e.g},function(e){a=e.VerdocsEndpoint;l=e.getTemplate;c=e.integerSequence;u=e.getOrganizationContacts;d=e.isValidEmail;f=e.createEnvelope;h=e.getRGBA;v=e.formatFullName;p=e.createTemplateDocument;m=e.deleteTemplateDocument;g=e.updateField;b=e.createField;x=e.updateTemplateRole;w=e.createTemplateRole},function(e){y=e.S},function(e){_=e.S},function(e){k=e.V},function(e){E=e.D;q=e.P;S=e.J;M=e.a;C=e.F;I=e.b;T=e.T},function(e){L=e.f},function(e){H=e.i},function(e){Z=e.b;O=e.c;z=e.d;D=e.g;V=e.e;N=e.f},function(){},function(){}],execute:function(){var A='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-preview{font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif;display:-ms-flexbox;display:flex;padding:15px;row-gap:15px;min-height:200px;position:relative;-ms-flex-align:center;align-items:center;-webkit-box-sizing:border-box;box-sizing:border-box;-ms-flex-direction:column;flex-direction:column}verdocs-preview div,verdocs-preview canvas{-webkit-box-sizing:border-box;box-sizing:border-box}';var j=A;var R=e("verdocs_preview",function(){function e(e){t(this,e);this.sdkError=i(this,"sdkError",7);this.templateListenerId=null;this.endpoint=a.getDefault();this.templateId=null;this.loading=true;this.template=null}e.prototype.disconnectedCallback=function(){this.unlistenToTemplate()};e.prototype.listenToTemplate=function(){return __awaiter(this,void 0,void 0,(function(){var e=this;return __generator(this,(function(t){this.unlistenToTemplate();_.subscribe("templates",this.templateId,(function(){return l(e.endpoint,e.templateId)}),false,(function(t){e.template=t;e.loading=false}));return[2]}))}))};e.prototype.unlistenToTemplate=function(){if(this.templateListenerId){_.store.delListener(this.templateListenerId);this.templateListenerId=null}};e.prototype.onTemplateIdChanged=function(e){console.log("[PREVIEW] Template ID changed",e);this.listenToTemplate()};e.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,i;return __generator(this,(function(n){try{this.endpoint.loadSession();if(!this.endpoint.session){console.log("[PREVIEW] Unable to start builder session, must be authenticated");return[2]}if(!this.templateId){console.log("[PREVIEW] Missing required template ID ".concat(this.templateId));return[2]}this.listenToTemplate()}catch(n){console.log("[PREVIEW] Error with preview session",n);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new y(n.message,(t=n.response)===null||t===void 0?void 0:t.status,(i=n.response)===null||i===void 0?void 0:i.data))}return[2]}))}))};e.prototype.handlePageRendered=function(e){};e.prototype.render=function(){var e=this;var t;if(this.loading){return n(r,null,n("verdocs-loader",null))}return n(r,null,(((t=this.template)===null||t===void 0?void 0:t.documents)||[]).map((function(t){var i=c(1,t.pages);return n(o,null,i.map((function(i){var r;var o=((r=t.page_sizes)===null||r===void 0?void 0:r[i])||{width:612,height:792};return n("verdocs-template-document-page",{templateId:t.template_id,documentId:t.id,pageNumber:i,disabled:true,editable:false,done:false,virtualWidth:o.width,virtualHeight:o.height,onPageRendered:function(t){return e.handlePageRendered(t)},layers:[{name:"page",type:"canvas"},{name:"controls",type:"div"}]})})))})))};Object.defineProperty(e,"watchers",{get:function(){return{templateId:["onTemplateIdChanged"]}},enumerable:false,configurable:true});return e}());R.style=j;var U=function(e){return((e===null||e===void 0?void 0:e.roles)||[]).map((function(e){return e.name}))};var B=function(e,t){return Math.max(U(e).findIndex((function(e){return e===t})),0)};var P='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-send{padding:10px;position:relative;background:#ffffff;-ms-flex-direction:column;flex-direction:column;font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-send.sendable{display:-ms-flexbox;display:flex}verdocs-send .recipients{position:relative}verdocs-send .left-line{top:32px;left:20px;z-index:1;width:12px;bottom:30px;position:absolute;background:#ffffff;border-left:3px dotted #9b9b9b}verdocs-send .level{display:-ms-flexbox;display:flex;-webkit-column-gap:10px;-moz-column-gap:10px;column-gap:10px;margin-left:50px;position:relative;-ms-flex-direction:row;flex-direction:row;padding:8px 0 4px 0;border-bottom:1px solid rgba(151, 151, 151, 0.2666666667)}verdocs-send .level .level-icon{top:14px;z-index:2;left:-40px;width:24px;height:24px;position:absolute;background:#ffffff}verdocs-send .level .level-icon svg{fill:rgba(0, 0, 0, 0.537254902)}verdocs-send .level .recipient{height:30px;display:-ms-flexbox;display:flex;-ms-flex:0 0 30px;flex:0 0 30px;color:#000000;cursor:pointer;font-size:14px;-ms-flex-align:center;align-items:center;border-radius:30px;-ms-flex-direction:row;flex-direction:row;background:#dddddd;white-space:nowrap;border:2px solid #dddddd;padding:2px 10px 2px 14px}verdocs-send .level .recipient .icon{width:22px;height:22px;-ms-flex:0 0 22px;flex:0 0 22px;margin:0 0 0 10px}verdocs-send .level .recipient .icon svg{width:22px;height:22px;fill:#333333;outline:none}verdocs-send .level .complete{-ms-flex:1;flex:1;height:30px;display:-ms-flexbox;display:flex;color:#000000;font-size:14px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;padding:3px 10px 3px 2px}verdocs-send .buttons{display:-ms-flexbox;display:flex;margin-top:10px;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;-ms-flex-direction:row;flex-direction:row}verdocs-send verdocs-contact-picker{left:0;top:41px;z-index:10;position:absolute;border:1px solid #dddddd;-webkit-box-shadow:0 0 6px 3px rgba(0, 0, 0, 0.1);box-shadow:0 0 6px 3px rgba(0, 0, 0, 0.1)}';var Q=P;var F='<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" tabindex="-1"><path d="M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34a.9959.9959 0 0 0-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z"></path></svg>';var Y='<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" tabindex="-1"><path d="M2 12C2 6.48 6.48 2 12 2s10 4.48 10 10-4.48 10-10 10S2 17.52 2 12zm10 6c3.31 0 6-2.69 6-6s-2.69-6-6-6-6 2.69-6 6 2.69 6 6 6z"></path></svg>';var W='<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" tabindex="-1"><path d="M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z"></path></svg>';var J='<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" tabindex="-1"><path d="m18 7-1.41-1.41-6.34 6.34 1.41 1.41L18 7zm4.24-1.41L11.66 16.17 7.48 12l-1.41 1.41L11.66 19l12-12-1.42-1.41zM.41 13.41 6 19l1.41-1.41L1.83 12 .41 13.41z"></path></svg>';var G=e("verdocs_send",function(){function e(e){t(this,e);this.sendingEnvelope=i(this,"sendingEnvelope",7);this.send=i(this,"send",7);this.exit=i(this,"exit",7);this.sdkError=i(this,"sdkError",7);this.searchContacts=i(this,"searchContacts",7);this.templateListenerId=null;this.endpoint=a.getDefault();this.templateId=null;this.environment="";this.containerId="verdocs-send-".concat(Math.random().toString(36).substring(2,11));this.showPickerForId="";this.sessionContacts=[];this.sending=false;this.rolesCompleted={};this.loading=true;this.template=null}e.prototype.disconnectedCallback=function(){this.unlistenToTemplate()};e.prototype.listenToTemplate=function(){return __awaiter(this,void 0,void 0,(function(){var e=this;return __generator(this,(function(t){console.log("[SEND] Loading template",this.templateId);this.unlistenToTemplate();_.subscribe("templates",this.templateId,(function(){return l(e.endpoint,e.templateId)}),false,(function(t){e.template=t;e.loading=false;e.rolesCompleted={}}));return[2]}))}))};e.prototype.unlistenToTemplate=function(){if(this.templateListenerId){_.store.delListener(this.templateListenerId);this.templateListenerId=null}};e.prototype.reset=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){this.rolesCompleted={};return[2]}))}))};e.prototype.onTemplateIdChanged=function(e){console.log("[SEND] Template ID changed",e);this.listenToTemplate()};e.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,i;var n=this;return __generator(this,(function(r){try{this.endpoint.onSessionChanged((function(e,t,i){if(!i){return}var r={id:i.id,first_name:i.first_name,last_name:i.last_name,email:i.email,phone:i.phone};if(i){n.sessionContacts=[r];u(n.endpoint).then((function(e){console.log("[SEND] Got contacts",e);n.sessionContacts=__spreadArray(__spreadArray([],e,true),[r],false)})).catch((function(e){console.log("[SEND] Error getting contacts",e)}))}}));this.endpoint.loadSession();if(!this.endpoint.session){console.log("[SEND] Unable to start Send operation, must be authenticated");return[2]}if(!this.templateId){console.log("[SEND] Missing required template ID ".concat(this.templateId));return[2]}this.listenToTemplate()}catch(n){console.log("[SEND] Error with send session",n);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new y(n.message,(t=n.response)===null||t===void 0?void 0:t.status,(i=n.response)===null||i===void 0?void 0:i.data))}return[2]}))}))};e.prototype.recomputeRolesCompleted=function(){var e=this;var t;this.rolesCompleted={};var i={};(((t=this.template)===null||t===void 0?void 0:t.roles)||[]).forEach((function(t){var n=t.sequence-1;i[n]||(i[n]=[]);var r="r-".concat(n,"-").concat(i[n].length);i[n].push(__assign(__assign({},t),{id:r,role_name:t.name,first_name:t.first_name,last_name:t.last_name}));if(t.first_name&&d(t.email)){e.rolesCompleted[r]=__assign(__assign({},t),{id:r,role_name:t.name,first_name:t.first_name,last_name:t.last_name})}}))};e.prototype.getLevels=function(){var e;var t=__spreadArray([],new Set((((e=this.template)===null||e===void 0?void 0:e.roles)||[]).map((function(e){return e.sequence-1}))),true);t.sort((function(e,t){return e-t}));return t};e.prototype.getRolesAtLevel=function(e){var t;var i=(((t=this.template)===null||t===void 0?void 0:t.roles)||[]).filter((function(t){return t.sequence-1===e})).map((function(t,i){return __assign(__assign({},t),{id:"r-".concat(e,"-").concat(i),role_name:t.name,first_name:"",last_name:""})}));return i};e.prototype.getLevelIcon=function(e){var t=this.getLevels();if(e<0){return n("div",{class:"level-icon",innerHTML:Y})}else if(e>=t.length){return n("div",{class:"level-icon",innerHTML:J})}else{return n("div",{class:"level-icon",innerHTML:W})}};e.prototype.handleSelectContact=function(e,t){e.preventDefault();this.rolesCompleted[t.id]=__assign(__assign({},t),e.detail);this.showPickerForId=""};e.prototype.handleClickRole=function(e,t){e.stopPropagation();this.showPickerForId=t.id};e.prototype.handleSend=function(e){var t=this;var i,n;if(this.sending){console.log("[SEND] Skipping duplicate send",e);return}console.log("[SEND] Sending",e);e.preventDefault();e.stopPropagation();this.sending=true;(i=this.sendingEnvelope)===null||i===void 0?void 0:i.emit({sending:true});var r={template_id:this.templateId,name:((n=this.template)===null||n===void 0?void 0:n.name)||"New Envelope",environment:this.environment,initial_reminder:0,followup_reminders:0,recipients:Object.values(this.rolesCompleted),fields:[]};console.log("[SEND] Creating envelope",r);f(this.endpoint,r).then((function(e){var i,n;console.log("[SEND] Send envelope",e);t.reset().catch((function(e){return console.log("Unknown Error",e)}));t.sending=false;(i=t.sendingEnvelope)===null||i===void 0?void 0:i.emit({sending:false});(n=t.send)===null||n===void 0?void 0:n.emit(__assign(__assign({},r),{name:r.name,envelope_id:e.id,envelope:e}))})).catch((function(e){var i,n,r;console.log("Send error",e);k(((n=(i=e.response)===null||i===void 0?void 0:i.data)===null||n===void 0?void 0:n.error)||"Error creating envelope, please try again later.");t.sending=false;(r=t.sendingEnvelope)===null||r===void 0?void 0:r.emit({sending:false})}))};e.prototype.handleCancel=function(e){var t;e.stopPropagation();(t=this.exit)===null||t===void 0?void 0:t.emit()};e.prototype.render=function(){var e=this;var t;if(this.loading){return n(r,null,n("verdocs-loader",null))}if(!this.endpoint.session){return n(r,{style:{display:"flex"}},n("verdocs-component-error",{message:"You must be authenticated to use this module."}))}var i=this.getLevels();var o=Object.values(this.rolesCompleted).filter((function(e){return d(e.email)}));var s=o.length>=U(this.template).length;return n(r,{class:{sendable:(t=this.template)===null||t===void 0?void 0:t.is_sendable}},n("div",{class:"recipients"},n("div",{class:"left-line"}),n("div",{class:"level level-start"},this.getLevelIcon(-1),n("div",{class:"complete"},"Send Envelope")),i.map((function(t){return n("div",{class:"level level-".concat(t)},e.getLevelIcon(t),e.getRolesAtLevel(t).map((function(t){var i,r,o,s;var a=!t.email;var l="verdocs-send-recipient-".concat(t.role_name);var c=B(e.template,t.role_name);var u=h(c);return a?n("div",{class:"recipient","data-ri":c,"data-rn":t.role_name,style:{backgroundColor:u},onClick:function(i){return e.handleClickRole(i,t)},id:l},((i=e.rolesCompleted[t.id])===null||i===void 0?void 0:i.first_name)?v(e.rolesCompleted[t.id]):t.role_name,n("div",{class:"icon",innerHTML:F}),e.showPickerForId===t.id&&n("verdocs-portal",{anchor:l,onClickAway:function(){return e.showPickerForId=""}},n("verdocs-contact-picker",{onExit:function(){return e.showPickerForId=""},onNext:function(i){return e.handleSelectContact(i,t)},contactSuggestions:e.sessionContacts,templateRole:(r=e.rolesCompleted[t.id])!==null&&r!==void 0?r:t,onSearchContacts:function(t){var i;return(i=e.searchContacts)===null||i===void 0?void 0:i.emit(t.detail)}}))):n("div",{class:"recipient",style:{borderColor:u},onClick:function(i){return e.handleClickRole(i,t)},id:l},((o=e.rolesCompleted[t.id])===null||o===void 0?void 0:o.first_name)?v(e.rolesCompleted[t.id]):t.role_name,n("div",{class:"icon",innerHTML:F}),e.showPickerForId===t.id&&n("verdocs-portal",{anchor:l,onClickAway:function(){return e.showPickerForId=""}},n("verdocs-contact-picker",{onExit:function(){return e.showPickerForId=""},onNext:function(i){return e.handleSelectContact(i,t)},contactSuggestions:e.sessionContacts,templateRole:(s=e.rolesCompleted[t.id])!==null&&s!==void 0?s:t,onSearchContacts:function(t){var i;return(i=e.searchContacts)===null||i===void 0?void 0:i.emit(t.detail)}})))})))})),n("div",{class:"level level-done"},this.getLevelIcon(i.length),n("div",{class:"complete"},"Signing Complete"))),n("div",{class:"buttons"},n("verdocs-button",{label:"Cancel",size:"small",variant:"outline",onClick:function(t){return e.handleCancel(t)},disabled:this.sending}),n("verdocs-button",{label:"Send",size:"small",disabled:!s||this.sending,onClick:function(t){return e.handleSend(t)}}),this.sending&&n("verdocs-spinner",null)))};Object.defineProperty(e,"watchers",{get:function(){return{templateId:["onTemplateIdChanged"]}},enumerable:false,configurable:true});return e}());G.style=Q;var X='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-template-attachments{font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-template-attachments h5{font-size:16px;font-weight:bold;margin:0 0 10px 0;color:#46497d}verdocs-template-attachments .attachments{margin:0 0 40px 0}verdocs-template-attachments .attachment{display:-ms-flexbox;display:flex;padding:5px 0;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;color:#33364b}verdocs-template-attachments .attachment:hover .trash-icon{display:-ms-flexbox;display:flex}verdocs-template-attachments .attachment:hover .pages{display:none}verdocs-template-attachments svg{width:28px;height:28px;fill:#5c6575;margin:2px 0 0 0}verdocs-template-attachments .file-icon{-ms-flex:0;flex:0}verdocs-template-attachments .pages{width:24px;height:24px;-ms-flex:0 0 24px;flex:0 0 24px;padding-left:4px;position:relative;margin:-10px 0 0 0}verdocs-template-attachments .pages .pages-icon{top:0;left:0;width:24px;height:24px;position:absolute}verdocs-template-attachments .pages .count{top:11px;left:7px;z-index:1;width:18px;font-size:12px;font-weight:500;position:absolute;text-align:center;letter-spacing:-2px}verdocs-template-attachments .filename{-ms-flex:1;flex:1;display:block;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;border-bottom:1px dotted #cccccc}verdocs-template-attachments .trash-icon{-ms-flex:0;flex:0;display:none}verdocs-template-attachments .trash-icon:hover{cursor:pointer}verdocs-template-attachments verdocs-file-chooser{margin:10px 0;border:2px dashed #979797}verdocs-template-attachments .loader-wrapper{background-color:#ffffff;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-webkit-box-sizing:border-box;box-sizing:border-box;position:relative;width:320px;height:320px;text-align:center;border:2px dashed #979797;-ms-flex-pack:end;justify-content:flex-end}verdocs-template-attachments .progress-wrapper{padding:20px}verdocs-template-attachments .buttons{display:-ms-flexbox;display:flex;-webkit-column-gap:8px;-moz-column-gap:8px;column-gap:8px;margin-top:16px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:end;justify-content:flex-end}verdocs-template-attachments .buttons .flex-fill{-ms-flex:1;flex:1}verdocs-template-attachments ::-webkit-input-placeholder{color:#aaaaaa}verdocs-template-attachments ::-moz-placeholder{color:#aaaaaa}verdocs-template-attachments :-ms-input-placeholder{color:#aaaaaa}verdocs-template-attachments ::-ms-input-placeholder{color:#aaaaaa}verdocs-template-attachments ::placeholder{color:#aaaaaa}';var K=X;var $=e("verdocs_template_attachments",function(){function e(e){t(this,e);this.exit=i(this,"exit",7);this.next=i(this,"next",7);this.templateUpdated=i(this,"templateUpdated",7);this.sdkError=i(this,"sdkError",7);this.templateListenerId=null;this.endpoint=a.getDefault();this.templateId="";this.uploading=false;this.progressLabel="Uploading...";this.progressPercent=0;this.showDeleteError=false;this.confirmDeleteDocument=null;this.loading=true;this.template=null}e.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,i;return __generator(this,(function(n){try{this.endpoint.loadSession();if(!this.templateId){console.log("[ROLES] Missing required template ID ".concat(this.templateId));return[2]}if(!this.endpoint.session){console.log("[ROLES] Unable to start builder session, must be authenticated");return[2]}this.listenToTemplate()}catch(n){console.log("[TEMPLATE ATTACHMENTS] Error loading template",n);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new y(n.message,(t=n.response)===null||t===void 0?void 0:t.status,(i=n.response)===null||i===void 0?void 0:i.data))}return[2]}))}))};e.prototype.disconnectedCallback=function(){this.unlistenToTemplate()};e.prototype.listenToTemplate=function(){return __awaiter(this,void 0,void 0,(function(){var e=this;return __generator(this,(function(t){this.unlistenToTemplate();_.subscribe("templates",this.templateId,(function(){return l(e.endpoint,e.templateId)}),false,(function(t){e.template=t;e.loading=false}));return[2]}))}))};e.prototype.unlistenToTemplate=function(){if(this.templateListenerId){_.store.delListener(this.templateListenerId);this.templateListenerId=null}};e.prototype.handleCancel=function(e){e.stopPropagation();this.exit.emit()};e.prototype.handleUploadProgress=function(e){if(e>=99){this.progressPercent=100;this.progressLabel="Processing..."}else{this.progressPercent=e}};e.prototype.handleUpload=function(e){return __awaiter(this,void 0,void 0,(function(){var t,i,n,r,o,s,a,l;return __generator(this,(function(c){switch(c.label){case 0:e.stopPropagation();o=e.detail.file;if(!o){return[2]}console.log("[ATTACHMENTS] Uploading...",o);this.uploading=true;this.progressLabel="Uploading...";c.label=1;case 1:c.trys.push([1,4,,5]);return[4,p(this.endpoint,this.templateId,o,this.handleUploadProgress.bind(this))];case 2:s=c.sent();console.log("[ATTACHMENTS] Created attachment",s);a=this;return[4,_.getTemplate(this.endpoint,this.templateId,true)];case 3:a.template=c.sent();console.log("[ATTACHMENTS] Updated template",this.template);(t=this.templateUpdated)===null||t===void 0?void 0:t.emit({endpoint:this.endpoint,template:this.template,event:"attachments"});this.uploading=false;this.progressLabel="";this.progressPercent=0;return[3,5];case 4:l=c.sent();console.log("[ATTACHMENTS] Error creating template",l);(i=this.sdkError)===null||i===void 0?void 0:i.emit(new y(l.message,(n=l.response)===null||n===void 0?void 0:n.status,(r=l.response)===null||r===void 0?void 0:r.data));this.uploading=false;return[3,5];case 5:return[2]}}))}))};e.prototype.handleNext=function(e){var t;e.stopPropagation();this.uploading=false;this.progressLabel="";this.progressPercent=0;(t=this.next)===null||t===void 0?void 0:t.emit({template:this.template})};e.prototype.confirmDelete=function(){return __awaiter(this,void 0,void 0,(function(){var e;return __generator(this,(function(t){switch(t.label){case 0:return[4,m(this.endpoint,this.templateId,this.confirmDeleteDocument.id)];case 1:t.sent();e=this;return[4,_.getTemplate(this.endpoint,this.templateId,true)];case 2:e.template=t.sent();console.log("[ATTACHMENTS] New template",this.template);this.confirmDeleteDocument=null;return[2]}}))}))};e.prototype.handleDelete=function(e){return __awaiter(this,void 0,void 0,(function(){var t;return __generator(this,(function(i){if((((t=this.template)===null||t===void 0?void 0:t.documents)||[]).length>1){this.confirmDeleteDocument=e}else{this.showDeleteError=true}return[2]}))}))};e.prototype.getFileIcon=function(e){switch(e.mime){case"application/pdf":return M;case"image/jpeg":return S;case"image/png":return q;case"application/msword":case"application/vnd.openxmlformats-officedocument.wordprocessingml.document":return E}return C};e.prototype.render=function(){var e=this;var t,i;if(!this.endpoint.session){return n(r,null,n("verdocs-component-error",{message:"You must be authenticated to use this module."}))}if(this.loading){return n(r,{class:"loading"},n("verdocs-loader",null))}if(!this.endpoint.session||!this.template){return n(r,{class:"empty"})}return n(r,null,n("h5",null,"Existing Attachments"),n("div",{class:"attachments"},(((t=this.template)===null||t===void 0?void 0:t.documents)||[]).map((function(t){return n("div",{class:"attachment"},n("div",{class:"file-icon",innerHTML:e.getFileIcon(t)}),n("div",{class:"filename",title:t.name},t.name),n("div",{class:"pages"},n("div",{class:"count"},t.pages),n("div",{class:"pages-icon",innerHTML:I})),n("div",{class:"trash-icon",innerHTML:T,onClick:function(){return e.handleDelete(t)}}))}))),n("h5",null,"Attach a New Document"),this.uploading?n("div",{class:"loader-wrapper"},n("verdocs-loader",null),this.progressLabel&&n("div",{class:"progress-wrapper"},n("verdocs-progress-bar",{showPercent:true,percent:this.progressPercent,label:this.progressLabel}))):n("verdocs-file-chooser",{onFileSelected:function(t){return e.handleUpload(t)}}),n("div",{class:"buttons"},n("verdocs-button",{variant:"outline",label:"Cancel",size:"small",onClick:function(t){return e.handleCancel(t)},disabled:this.uploading}),n("verdocs-button",{label:"Next",size:"small",onClick:function(t){return e.handleNext(t)},disabled:!(((i=this.template)===null||i===void 0?void 0:i.documents)||[]).length||this.uploading})),this.showDeleteError&&n("verdocs-ok-dialog",{heading:"Unable to Delete Attachment",message:"Templates must contain at least one attachment.",onNext:function(){return e.showDeleteError=false}}),this.confirmDeleteDocument&&n("verdocs-ok-dialog",{heading:"Delete this Attachment?",message:"This operation cannot be undone. All fields placed<br />on the deleted attachment will also be removed.",onNext:function(){return e.confirmDelete()},showCancel:true,onExit:function(){e.confirmDeleteDocument=null}}))};return e}());$.style=K;var ee='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-template-build-tabs{-ms-flex:1;flex:1;gap:15px;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-template-build-tabs verdocs-button-panel svg{-webkit-transform:scale(0.8);transform:scale(0.8)}verdocs-template-build-tabs verdocs-template-attachments,verdocs-template-build-tabs verdocs-template-roles{margin:20px}verdocs-template-build-tabs verdocs-template-fields{border-top:1px solid #777777}verdocs-template-build-tabs verdocs-template-attachments{padding:20px;background:#ffffff}verdocs-template-build-tabs verdocs-template-fields{width:100%}verdocs-template-build-tabs verdocs-preview{-ms-flex:1;flex:1}.template-details-panel .row{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;gap:8px;margin:10px 0}.template-details-panel label{-ms-flex:0 0 70px;flex:0 0 70px}.template-details-panel .value{-ms-flex:1;flex:1;font-weight:300;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.template-details-panel .icon-button{cursor:pointer;opacity:0.8;-ms-flex:0;flex:0;width:18px;height:18px}.template-details-panel .icon-button svg{stroke:#000000;width:18px;height:18px}.template-details-panel .icon-button:hover{opacity:1}';var te=ee;var ie='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24" fill="#5c6575"><path d="M11.925 18q.55 0 .938-.387.387-.388.387-.938 0-.55-.387-.925-.388-.375-.938-.375-.55 0-.925.375t-.375.925q0 .55.375.938.375.387.925.387Zm-.95-3.85h1.95q0-.8.2-1.287.2-.488 1.025-1.288.65-.625 1.025-1.213.375-.587.375-1.437 0-1.425-1.025-2.175Q13.5 6 12.1 6q-1.425 0-2.35.775t-1.275 1.85l1.775.7q.125-.45.55-.975.425-.525 1.275-.525.725 0 1.1.412.375.413.375.888 0 .475-.287.9-.288.425-.713.775-1.075.95-1.325 1.475-.25.525-.25 1.875ZM12 22.2q-2.125 0-3.988-.8-1.862-.8-3.237-2.175Q3.4 17.85 2.6 15.988 1.8 14.125 1.8 12t.8-3.988q.8-1.862 2.175-3.237Q6.15 3.4 8.012 2.6 9.875 1.8 12 1.8t3.988.8q1.862.8 3.237 2.175Q20.6 6.15 21.4 8.012q.8 1.863.8 3.988t-.8 3.988q-.8 1.862-2.175 3.237Q17.85 20.6 15.988 21.4q-1.863.8-3.988.8Zm0-2.275q3.325 0 5.625-2.3t2.3-5.625q0-3.325-2.3-5.625T12 4.075q-3.325 0-5.625 2.3T4.075 12q0 3.325 2.3 5.625t5.625 2.3ZM12 12Z"/></svg>';var ne='<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5"><path stroke-linecap="round" stroke-linejoin="round" d="M15.75 17.25v3.375c0 .621-.504 1.125-1.125 1.125h-9.75a1.125 1.125 0 0 1-1.125-1.125V7.875c0-.621.504-1.125 1.125-1.125H6.75a9.06 9.06 0 0 1 1.5.124m7.5 10.376h3.375c.621 0 1.125-.504 1.125-1.125V11.25c0-4.46-3.243-8.161-7.5-8.876a9.06 9.06 0 0 0-1.5-.124H9.375c-.621 0-1.125.504-1.125 1.125v3.5m7.5 10.375H9.375a1.125 1.125 0 0 1-1.125-1.125v-9.25m12 6.625v-1.875a3.375 3.375 0 0 0-3.375-3.375h-1.5a1.125 1.125 0 0 1-1.125-1.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H9.75" /></svg>';var re=["attachments","roles","settings","fields","preview"];var oe=e("verdocs_template_build_tabs",function(){function e(e){t(this,e);this.sdkError=i(this,"sdkError",7);this.stepChanged=i(this,"stepChanged",7);this.templateListenerId=null;this.endpoint=a.getDefault();this.templateId=null;this.step="preview";this.loading=true;this.template=null}e.prototype.disconnectedCallback=function(){this.unlistenToTemplate()};e.prototype.listenToTemplate=function(){return __awaiter(this,void 0,void 0,(function(){var e=this;return __generator(this,(function(t){this.unlistenToTemplate();_.subscribe("templates",this.templateId,(function(){return l(e.endpoint,e.templateId)}),false,(function(t){e.template=t;e.loading=false}));return[2]}))}))};e.prototype.unlistenToTemplate=function(){if(this.templateListenerId){_.store.delListener(this.templateListenerId);this.templateListenerId=null}};e.prototype.onTemplateIdChanged=function(e){console.log("[BUILD_TABS] Template ID changed",e);this.listenToTemplate()};e.prototype.onStepChanged=function(e){console.log("[BUILD_TABS] Step changed",e)};e.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,i;return __generator(this,(function(n){try{this.endpoint.loadSession();if(!this.endpoint.session){console.log("[BUILD_TABS] Unable to start builder session, must be authenticated");return[2]}if(!this.templateId){this.step="attachments";console.log("[BUILD_TABS] Missing required template ID, forcing view to attachments");return[2]}this.listenToTemplate()}catch(n){console.log("[BUILD_TABS] Error loading template",n);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new y(n.message,(t=n.response)===null||t===void 0?void 0:t.status,(i=n.response)===null||i===void 0?void 0:i.data))}return[2]}))}))};e.prototype.setStep=function(e){var t;console.log("[BUILD_TABS] Selected step",e.detail.tab.id);e.stopPropagation();e.preventDefault();this.step=e.detail.tab.id;(t=this.stepChanged)===null||t===void 0?void 0:t.emit(e.detail.tab.id)};e.prototype.copyTemplateId=function(){var e=this;navigator.clipboard.writeText(this.templateId).then((function(){k("Template ID copied",{style:"success",duration:3e3})})).catch((function(t){var i;console.warn("[BUILD_TABS] Error copying to clipboard",t);(i=e.sdkError)===null||i===void 0?void 0:i.emit(t)}))};e.prototype.render=function(){var e=this;var t,i,o,s,a,l,c,u,d;if(this.loading){return n(r,null,n("verdocs-loader",null))}if(!this.endpoint.session){return n(r,null,n("verdocs-component-error",{message:"You must be authenticated to use this module."}))}var f=(((t=this.template)===null||t===void 0?void 0:t.documents)||[]).length>0;var h=f&&(((i=this.template)===null||i===void 0?void 0:i.roles)||[]).length>0;var v=h&&(((o=this.template)===null||o===void 0?void 0:o.fields)||[]).length>0;var p=Math.max(re.indexOf(this.step),0);if(!v&&p>=4){p=3}if(!h&&p>=3){p=1}if(!f&&p>=1){p=0}return n(r,null,n("verdocs-tabs",{onSelectTab:function(t){return e.setStep(t)},selectedTab:p,tabs:[{id:"attachments",disabled:false,label:"Attachment(s)"},{id:"roles",disabled:!f,label:"Roles"},{id:"settings",disabled:!h,label:"Settings"},{id:"fields",disabled:!h,label:"Fields"},{id:"preview",disabled:!v,label:"Preview/Send"}]}),this.templateId&&n("div",{class:"info"},n("verdocs-button-panel",{icon:ie},n("div",{class:"template-details-panel"},n("h6",null,"Template Details"),n("div",{class:"row"},n("label",null,"ID:"),n("div",{class:"value"},this.templateId),n("div",{class:"icon-button",innerHTML:ne,onClick:function(){return e.copyTemplateId()}})),n("div",{class:"row"},n("label",null,"Name:"),n("div",{class:"value"},(s=this.template)===null||s===void 0?void 0:s.name)),n("div",{class:"row"},n("label",null,"Visibility:"),n("div",{class:"value"},((a=this.template)===null||a===void 0?void 0:a.is_public)?"Public":((l=this.template)===null||l===void 0?void 0:l.is_personal)?"Private":"Shared")),n("div",{class:"row"},n("label",null,"Created:"),n("div",{class:"value"},((c=this.template)===null||c===void 0?void 0:c.counter)?L(new Date((u=this.template)===null||u===void 0?void 0:u.created_at),"P p"):"")),n("div",{class:"row"},n("label",null,"Used:"),n("div",{class:"value"},(d=this.template)===null||d===void 0?void 0:d.counter," time(s)"))))))};Object.defineProperty(e,"watchers",{get:function(){return{templateId:["onTemplateIdChanged"],step:["onStepChanged"]}},enumerable:false,configurable:true});return e}());oe.style=te;var se="@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-template-fields{font-family:\"Inter\", -apple-system, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", sans-serif;position:relative;display:block;min-height:600px}verdocs-template-fields .page-0{padding:65px 15px 0 15px;-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-template-fields .page-0 .user-placed-fields{height:100px;position:relative;background:#ffffff;-webkit-box-shadow:0 0 10px 5px rgba(0, 0, 0, 0.0588235294);box-shadow:0 0 10px 5px rgba(0, 0, 0, 0.0588235294)}verdocs-template-fields .page-0 .user-placed-fields .title{top:0;left:0;color:#ffffff;font-size:12px;padding:3px 6px;font-weight:bold;position:absolute;background:#46497d}verdocs-template-fields .pages{display:-ms-flexbox;display:flex;padding:15px;row-gap:15px;min-height:200px;position:relative;-ms-flex-align:center;align-items:center;-webkit-box-sizing:border-box;box-sizing:border-box;-ms-flex-direction:column;flex-direction:column}verdocs-template-fields .pages div,verdocs-template-fields .pages canvas{-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-template-fields #verdocs-template-fields-toolbar{width:100%;height:50px;display:-ms-flexbox;display:flex;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;font-weight:700;padding:0 20px 0 0;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;color:#f5f5fa;-ms-flex-pack:center;justify-content:center;background:#46497d}verdocs-template-fields #verdocs-template-fields-toolbar>verdocs-select-input{margin:0}verdocs-template-fields #verdocs-template-fields-toolbar svg{width:24px;height:24px}verdocs-template-fields #verdocs-template-fields-toolbar .add-for{margin:0;font-weight:500;color:#f5f5fa}verdocs-template-fields #verdocs-template-fields-toolbar verdocs-select-input{margin:0 20px 0 0}@media all and (max-width: 1000px){verdocs-template-fields #verdocs-template-fields-toolbar{-webkit-column-gap:8px;-moz-column-gap:8px;column-gap:8px;padding:0 10px 0 0}verdocs-template-fields #verdocs-template-fields-toolbar svg{-webkit-transform:scale(0.8);transform:scale(0.8)}verdocs-template-fields #verdocs-template-fields-toolbar .add-for,verdocs-template-fields #verdocs-template-fields-toolbar verdocs-select-input{display:none}}@media all and (max-width: 600px){verdocs-template-fields #verdocs-template-fields-toolbar{-webkit-column-gap:6px;-moz-column-gap:6px;column-gap:6px}verdocs-template-fields #verdocs-template-fields-toolbar svg{-webkit-transform:scale(0.6);transform:scale(0.6)}verdocs-template-fields #verdocs-template-fields-toolbar .separator,verdocs-template-fields #verdocs-template-fields-toolbar .add-for,verdocs-template-fields #verdocs-template-fields-toolbar verdocs-select-input{display:none}}verdocs-template-fields.placing-attachment{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='m10.55 16.55 7.275-7.275L16.05 7.5l-5.5 5.45-2.675-2.65L6.1 12.075Zm-5.375 4.925q-1.125 0-1.887-.763-.763-.762-.763-1.887V5.175q0-1.125.763-1.888.762-.762 1.887-.762h13.65q1.125 0 1.888.762.762.763.762 1.888v13.65q0 1.125-.762 1.887-.763.763-1.888.763Zm0-2.65h13.65V5.175H5.175v13.65Zm0-13.65v13.65-13.65Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-checkbox{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='m10.55 16.55 7.275-7.275L16.05 7.5l-5.5 5.45-2.675-2.65L6.1 12.075Zm-5.375 4.925q-1.125 0-1.887-.763-.763-.762-.763-1.887V5.175q0-1.125.763-1.888.762-.762 1.887-.762h13.65q1.125 0 1.888.762.762.763.762 1.888v13.65q0 1.125-.762 1.887-.763.763-1.888.763Zm0-2.65h13.65V5.175H5.175v13.65Zm0-13.65v13.65-13.65Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-date{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath fill='%23000000' d='M7.6 13.925q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375Zm4.4 0q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375Zm4.4 0q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375ZM5.3 22.85q-1.325 0-2.238-.912-.912-.913-.912-2.238V6.3q0-1.325.912-2.238.913-.912 2.238-.912H6v-2h2.575v2h6.85v-2H18v2h.7q1.325 0 2.238.912.912.913.912 2.238v13.4q0 1.325-.912 2.238-.913.912-2.238.912Zm0-3.15h13.4V10H5.3v9.7ZM5.3 8h13.4V6.3H5.3Zm0 0V6.3 8Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-dropdown{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24' stroke-width='1.5' stroke='currentColor'%3E%3Cpath stroke='%23000000' stroke-linecap='round' stroke-linejoin='round' d='M3 4.5h14.25M3 9h9.75M3 13.5h9.75m4.5-4.5v12m0 0l-3.75-3.75M17.25 21L21 17.25' /%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-initial{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='M6.225 20.775V7h-5V3.225H15V7h-5v13.775Zm9.775 0v-8h-3V9h9.775v3.775h-3v8Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-payment{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='m10.55 16.55 7.275-7.275L16.05 7.5l-5.5 5.45-2.675-2.65L6.1 12.075Zm-5.375 4.925q-1.125 0-1.887-.763-.763-.762-.763-1.887V5.175q0-1.125.763-1.888.762-.762 1.887-.762h13.65q1.125 0 1.888.762.762.763.762 1.888v13.65q0 1.125-.762 1.887-.763.763-1.888.763Zm0-2.65h13.65V5.175H5.175v13.65Zm0-13.65v13.65-13.65Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-radio{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='M12 17q2.075 0 3.538-1.463Q17 14.075 17 12t-1.462-3.538Q14.075 7 12 7 9.925 7 8.463 8.462 7 9.925 7 12q0 2.075 1.463 3.537Q9.925 17 12 17Zm0 5.85q-2.275 0-4.25-.85t-3.438-2.312Q2.85 18.225 2 16.25q-.85-1.975-.85-4.25T2 7.75q.85-1.975 2.312-3.438Q5.775 2.85 7.75 2q1.975-.85 4.25-.85t4.25.85q1.975.85 3.438 2.312Q21.15 5.775 22 7.75q.85 1.975.85 4.25T22 16.25q-.85 1.975-2.312 3.438Q18.225 21.15 16.25 22q-1.975.85-4.25.85Zm0-3.15q3.25 0 5.475-2.225Q19.7 15.25 19.7 12q0-3.25-2.225-5.475Q15.25 4.3 12 4.3q-3.25 0-5.475 2.225Q4.3 8.75 4.3 12q0 3.25 2.225 5.475Q8.75 19.7 12 19.7Zm0-7.7Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-signature{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='m9.225 21.225 4.65-4.65h8.45v4.65Zm-5.35-2.2H5.05l8.5-8.5-1.175-1.175-8.5 8.5Zm14.25-9.95L13.8 4.8l1.325-1.325q.625-.65 1.525-.663.9-.012 1.6.663l1.225 1.175q.675.675.663 1.562-.013.888-.663 1.513ZM16.7 10.55 6 21.225H1.675V16.9L12.35 6.225Zm-3.725-.625-.6-.575 1.175 1.175Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-textarea{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='M3.225 20.725v-3.15h11.55v3.15Zm0-4.775V12.8h17.55v3.15Zm0-4.75V8.05h17.55v3.15Zm0-4.775v-3.15h17.55v3.15Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-textbox{cursor:url(\"data:image/svg+xml,%3Csvg width='32' height='15' viewBox='0 0 32 15' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cmask id='path-1-inside-1_1401_24' fill='white'%3E%3Cpath d='M0 0H32V15H0V0Z'/%3E%3C/mask%3E%3Cpath d='M0 0H32V15H0V0Z' fill='%234C56CB' fill-opacity='0.1'/%3E%3Cpath d='M0 0V-1H-1V0H0ZM0 15H-1V16H0V15ZM0 1H32V-1H0V1ZM32 14H0V16H32V14ZM1 15V0H-1V15H1Z' fill='%234C56CB' mask='url(%23path-1-inside-1_1401_24)'/%3E%3Cpath d='M3 11.8V8.65H14.15V11.8H3ZM3 6.65V3.5H20.15V6.65H3Z' fill='%234C56CB'/%3E%3Cline x1='31.5' y1='1' x2='31.5' y2='14' stroke='%234C56CB' stroke-opacity='0.32' stroke-dasharray='1 1'/%3E%3C/svg%3E%0A\") 0 14, pointer}verdocs-template-fields.placing-timestamp{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath fill='%23000000' d='M9 1h6v2H9zm10.03 6.39 1.42-1.42c-.43-.51-.9-.99-1.41-1.41l-1.42 1.42C16.07 4.74 14.12 4 12 4c-4.97 0-9 4.03-9 9s4.02 9 9 9 9-4.03 9-9c0-2.12-.74-4.07-1.97-5.61zM13 14h-2V8h2v6z'%3E%3C/path%3E%3C/svg%3E\") 16 16, pointer}";var ae=se;var le='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="M3.425 16.15V13h11.15v3.15Zm0-5.15V7.85h17.15V11Z"/></svg>';var ce='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="m10.55 16.55 7.275-7.275L16.05 7.5l-5.5 5.45-2.675-2.65L6.1 12.075Zm-5.375 4.925q-1.125 0-1.887-.763-.763-.762-.763-1.887V5.175q0-1.125.763-1.888.762-.762 1.887-.762h13.65q1.125 0 1.888.762.762.763.762 1.888v13.65q0 1.125-.762 1.887-.763.763-1.888.763Zm0-2.65h13.65V5.175H5.175v13.65Zm0-13.65v13.65-13.65Z"/></svg>';var ue='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="M12 17q2.075 0 3.538-1.463Q17 14.075 17 12t-1.462-3.538Q14.075 7 12 7 9.925 7 8.463 8.462 7 9.925 7 12q0 2.075 1.463 3.537Q9.925 17 12 17Zm0 5.85q-2.275 0-4.25-.85t-3.438-2.312Q2.85 18.225 2 16.25q-.85-1.975-.85-4.25T2 7.75q.85-1.975 2.312-3.438Q5.775 2.85 7.75 2q1.975-.85 4.25-.85t4.25.85q1.975.85 3.438 2.312Q21.15 5.775 22 7.75q.85 1.975.85 4.25T22 16.25q-.85 1.975-2.312 3.438Q18.225 21.15 16.25 22q-1.975.85-4.25.85Zm0-3.15q3.25 0 5.475-2.225Q19.7 15.25 19.7 12q0-3.25-2.225-5.475Q15.25 4.3 12 4.3q-3.25 0-5.475 2.225Q4.3 8.75 4.3 12q0 3.25 2.225 5.475Q8.75 19.7 12 19.7Zm0-7.7Z"/></svg>';var de='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="M7.6 13.925q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375Zm4.4 0q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375Zm4.4 0q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375ZM5.3 22.85q-1.325 0-2.238-.912-.912-.913-.912-2.238V6.3q0-1.325.912-2.238.913-.912 2.238-.912H6v-2h2.575v2h6.85v-2H18v2h.7q1.325 0 2.238.912.912.913.912 2.238v13.4q0 1.325-.912 2.238-.913.912-2.238.912Zm0-3.15h13.4V10H5.3v9.7ZM5.3 8h13.4V6.3H5.3Zm0 0V6.3 8Z"/></svg>';var fe='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="m9.225 21.225 4.65-4.65h8.45v4.65Zm-5.35-2.2H5.05l8.5-8.5-1.175-1.175-8.5 8.5Zm14.25-9.95L13.8 4.8l1.325-1.325q.625-.65 1.525-.663.9-.012 1.6.663l1.225 1.175q.675.675.663 1.562-.013.888-.663 1.513ZM16.7 10.55 6 21.225H1.675V16.9L12.35 6.225Zm-3.725-.625-.6-.575 1.175 1.175Z"/></svg>';var he='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="M6.225 20.775V7h-5V3.225H15V7h-5v13.775Zm9.775 0v-8h-3V9h9.775v3.775h-3v8Z"/></svg>';var ve='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="M9 1h6v2H9zm10.03 6.39 1.42-1.42c-.43-.51-.9-.99-1.41-1.41l-1.42 1.42C16.07 4.74 14.12 4 12 4c-4.97 0-9 4.03-9 9s4.02 9 9 9 9-4.03 9-9c0-2.12-.74-4.07-1.97-5.61zM13 14h-2V8h2v6z"></path></svg>';var pe='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24" stroke-width="1.5" stroke="currentColor"><path stroke="#ffffff" stroke-linecap="round" stroke-linejoin="round" d="M3 4.5h14.25M3 9h9.75M3 13.5h9.75m4.5-4.5v12m0 0l-3.75-3.75M17.25 21L21 17.25" /></svg>';var me='<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-6"><path stroke-linecap="round" stroke-linejoin="round" d="m18.375 12.739-7.693 7.693a4.5 4.5 0 0 1-6.364-6.364l10.94-10.94A3 3 0 1 1 19.5 7.372L8.552 18.32m.009-.01-.01.01m5.699-9.941-7.81 7.81a1.5 1.5 0 0 0 2.112 2.13" /></svg>';var ge='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14.707 14.707"><g><rect x="6.275" y="0" fill="#ffffff7f" width="1" height="15"/></g></svg>';var be=[{id:"signature",tooltip:"Signature",icon:fe,class:"signature"},{id:"initial",tooltip:"Initials",icon:he,class:"initial"},{id:"sep1",tooltip:"",icon:ge,class:"separator"},{id:"textbox",tooltip:"Text Box",icon:le,class:"textbox"},{id:"checkbox",tooltip:"Check Box",icon:ce,class:"checkbox"},{id:"radio",tooltip:"Radio Button",icon:ue,class:"radio"},{id:"dropdown",tooltip:"Dropdown",icon:pe,class:"dropdown"},{id:"sep2",tooltip:"",icon:ge,class:"separator"},{id:"date",tooltip:"Date",icon:de,class:"date"},{id:"timestamp",tooltip:"Timestamp",icon:ve,class:"timestamp"},{id:"attachment",tooltip:"Attachment",icon:me,class:"attachment"}];var xe=e("verdocs_template_fields",function(){function e(e){t(this,e);this.sdkError=i(this,"sdkError",7);this.templateUpdated=i(this,"templateUpdated",7);this.fieldsUpdated=i(this,"fieldsUpdated",7);this.templateListenerId=null;this.pageHeights={};this.cachedPageInfo={};this.endpoint=a.getDefault();this.templateId=null;this.toolbarTargetId=null;this.placing=null;this.showMustSelectRole=false;this.selectedRoleName="";this.loading=true;this.template=null}e.prototype.onTemplateIdChanged=function(){this.listenToTemplate()};e.prototype.handleKeyDown=function(e){if(e.key==="Escape"){this.placing=null}};e.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,i;return __generator(this,(function(n){try{this.endpoint.loadSession();if(!this.templateId){console.log("[FIELDS] Missing required template ID ".concat(this.templateId));return[2]}if(!this.endpoint.session){console.log("[FIELDS] Unable to start builder session, must be authenticated");return[2]}this.listenToTemplate()}catch(n){console.log("[FIELDS] Error with fields session",n);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new y(n.message,(t=n.response)===null||t===void 0?void 0:t.status,(i=n.response)===null||i===void 0?void 0:i.data))}return[2]}))}))};e.prototype.componentDidRender=function(){H.dynamicDrop(true);var e=this.toolbarTargetId?document.getElementById(this.toolbarTargetId):null;var t=document.getElementById("verdocs-template-fields-toolbar");if(e&&t){console.log("[FIELDS] Moving toolbar");t.remove();e.append(t)}};e.prototype.componentWillUpdate=function(){var e=this;var t,i;var n=((t=this.template)===null||t===void 0?void 0:t.roles)||[];if(!this.selectedRoleName||!n.find((function(t){return t&&t.name===e.selectedRoleName}))){this.selectedRoleName=((i=n[0])===null||i===void 0?void 0:i.name)||"";console.log("[FIELDS] Selected new role",this.selectedRoleName)}};e.prototype.disconnectedCallback=function(){this.unlistenToTemplate()};e.prototype.listenToTemplate=function(){return __awaiter(this,void 0,void 0,(function(){var e=this;return __generator(this,(function(t){this.unlistenToTemplate();_.subscribe("templates",this.templateId,(function(){return l(e.endpoint,e.templateId)}),false,(function(t){var i,n;e.template=t;e.loading=false;e.selectedRoleName=((n=(i=t.roles)===null||i===void 0?void 0:i[0])===null||n===void 0?void 0:n.name)||""}));return[2]}))}))};e.prototype.unlistenToTemplate=function(){if(this.templateListenerId){_.store.delListener(this.templateListenerId);this.templateListenerId=null}};e.prototype.attachFieldAttributes=function(e,t,i){var n=this;i.addEventListener("settingsChanged",(function(){var e;(e=n.templateUpdated)===null||e===void 0?void 0:e.emit({endpoint:n.endpoint,template:n.template,event:"added-field"})}));i.addEventListener("deleted",(function(){var e;i.remove();(e=n.templateUpdated)===null||e===void 0?void 0:e.emit({endpoint:n.endpoint,template:n.template,event:"updated-field"})}));i.setAttribute("templateid",this.templateId);i.setAttribute("fieldname",t.name);i.setAttribute("pageNumber",String(e.pageNumber));i.setAttribute("xScale",String(e.xScale));i.setAttribute("yScale",String(e.yScale));i.setAttribute("name",t.name)};e.prototype.handlePageRendered=function(e){var t=this;var i;var n=e.detail;this.cachedPageInfo[n.pageNumber]=n;this.pageHeights[n.pageNumber]=n.naturalHeight;(((i=this.template)===null||i===void 0?void 0:i.fields)||[]).filter((function(e){return e&&e.page===n.pageNumber})).forEach((function(e){var i=D(e);var n=document.getElementById(i);if(n){n.setAttribute("fieldname",e.name);n.setAttribute("pagenumber",String(e.page));t.makeDraggable(n)}}))};e.prototype.makeDraggable=function(e){H(e).draggable({listeners:{move:this.handleMoveField.bind(this),end:this.handleMoveEnd.bind(this)}})};e.prototype.handleMoveField=function(e){return __awaiter(this,void 0,void 0,(function(){var t,i,n,r,o,s;return __generator(this,(function(a){t=+(e.target.getAttribute("posX")||0);i=+(e.target.getAttribute("posY")||0);n=+(e.target.getAttribute("xScale")||1);r=+(e.target.getAttribute("yScale")||1);o=e.dx/n+t;s=e.dy/r+i;e.target.setAttribute("posX",o);e.target.setAttribute("posy",s);Z(e.target,"translate","".concat(o,"px, ").concat(s,"px"));return[2]}))}))};e.prototype.handleMoveEnd=function(e){return __awaiter(this,void 0,void 0,(function(){var t,i,n,r,o,s,a,l,c,u,d,f,h,v,p,m,b,x,w,E,q,S,M,C,I,T,L,H,Z,D,A,j,R,U,B,P,Q,F,Y;return __generator(this,(function(W){switch(W.label){case 0:c=e.target.getAttribute("fieldname");u=(((t=this.template)===null||t===void 0?void 0:t.fields)||[]).find((function(e){return e.name===c}));if(!u){console.log("[FIELDS] Unable to find field",c,e.target);return[2]}d=e.target.getAttribute("pagenumber");f=this.cachedPageInfo[d],h=f.naturalWidth,v=h===void 0?612:h,p=f.naturalHeight,m=p===void 0?792:p,b=f.renderedHeight,x=b===void 0?792:b;w=e.target.getBoundingClientRect();E=e.target.parentElement;q=E.getBoundingClientRect();S=u.width||V(u.type);M=u.height||N(u.type);C=Math.max(w.left-q.left,0);I=Math.max(x-(q.bottom-w.bottom),0);T=parseInt(d);if(I>x){T=Math.min(T+1,((r=(n=((i=this.template)===null||i===void 0?void 0:i.documents)||[])===null||n===void 0?void 0:n[0])===null||r===void 0?void 0:r.pages)||1);I-=x;x=this.cachedPageInfo[T].renderedHeight;console.log("Next page",{newPageNumber:T,newY:I,renderedHeight:x})}else if(I<0){T=Math.max(T-1,1);x=this.cachedPageInfo[T].renderedHeight;I+=x;console.log("[FIELDS] Next page",{newPageNumber:T,newY:I,renderedHeight:x})}L=this.viewCoordinatesToPageCoordinates(C,I,d,v-S,m-M),H=L.x,Z=L.y;W.label=1;case 1:W.trys.push([1,3,,4]);D={x:H,y:Z,page:T};return[4,g(this.endpoint,this.templateId,c,D)];case 2:A=W.sent();console.log("[FIELDS] Updated",A);j=JSON.parse(JSON.stringify(this.template));R=j.fields.findIndex((function(e){return e.name===c}));if(R>-1){j.fields[R]=A}_.updateTemplate(this.templateId,j);e.target.removeAttribute("posX");e.target.removeAttribute("posY");O(e.target);U=this.cachedPageInfo[d],B=U.xScale,P=B===void 0?1:B,Q=U.yScale,F=Q===void 0?1:Q;z(e.target,A,P,F);(o=this.templateUpdated)===null||o===void 0?void 0:o.emit({endpoint:this.endpoint,template:j,event:"updated-field"});return[3,4];case 3:Y=W.sent();k("Error updating field, please try again later",{style:"error"});console.log("[FIELDS] Error updating field",Y);(s=this.sdkError)===null||s===void 0?void 0:s.emit(new y(Y.message,(a=Y.response)===null||a===void 0?void 0:a.status,(l=Y.response)===null||l===void 0?void 0:l.data));e.target.removeAttribute("posX");e.target.removeAttribute("posY");O(e.target);return[3,4];case 4:return[2]}}))}))};e.prototype.generateFieldName=function(e,t){var i;var n=1;var r;do{r="".concat(e,"P").concat(t,"-").concat(n);n++}while((((i=this.template)===null||i===void 0?void 0:i.fields)||[]).some((function(e){return e&&e.name===r})));return r};e.prototype.viewCoordinatesToPageCoordinates=function(e,t,i,n,r){var o=this.cachedPageInfo[i],s=o.xScale,a=s===void 0?1:s,l=o.yScale,c=l===void 0?1:l,u=o.renderedHeight,d=u===void 0?792:u;var f=Math.floor(Math.min(e/a,n));var h=Math.floor(Math.min(Math.max(d-t,0)/c,r));return{x:f,y:h}};e.prototype.handleClickPage=function(e,t){return __awaiter(this,void 0,void 0,(function(){var i,n,r,o,s,a,l,c,u,d,f,h,v,p,m,g;return __generator(this,(function(x){switch(x.label){case 0:if(!this.placing)return[3,2];n=e.offsetX;r=e.offsetY;o=V(this.placing);s=N(this.placing);a=this.cachedPageInfo[t];l=a.naturalWidth,c=l===void 0?612:l,u=a.naturalHeight,d=u===void 0?792:u;f=this.viewCoordinatesToPageCoordinates(n,r,t,c-o,d-s);h=Math.floor(f.x);v=Math.floor(f.y);p={name:this.generateFieldName(this.placing,t),role_name:this.selectedRoleName,template_id:this.templateId,document_id:a.documentId,type:this.placing,required:this.placing!=="radio",page:t,validator:null,label:null,default:null,placeholder:null,group:null,settings:{},x:h,y:v,width:o,height:s,multiline:false,options:this.placing==="radio"?[{id:"option-1",label:"Option 1"}]:[]};console.log("[FIELDS] Will save new field",p);return[4,b(this.endpoint,this.templateId,p)];case 1:m=x.sent();console.log("[FIELDS] Saved field",m);g=JSON.parse(JSON.stringify(this.template));g.fields.push(m);_.updateTemplate(this.templateId,g);(i=this.templateUpdated)===null||i===void 0?void 0:i.emit({endpoint:this.endpoint,template:g,event:"added-field"});this.placing=null;x.label=2;case 2:return[2]}}))}))};e.prototype.render=function(){var e;var t=this;var i,o,s;if(this.loading){return n(r,null,n("verdocs-loader",null))}if(!this.endpoint.session){return n(r,null,n("verdocs-component-error",{message:"You must be authenticated to use this module."}))}var a=(((i=this.template)===null||i===void 0?void 0:i.roles)||[]).map((function(e){return{value:e.name,label:e.full_name?"".concat(e.name,": ").concat(e.full_name):e.name}}));return n(r,{class:this.placing?(e={},e["placing-".concat(this.placing)]=true,e):{},onSubmit:function(){}},n("div",{id:"verdocs-template-fields-toolbar"},n("div",{class:"add-for"},"Add field:"),n("verdocs-select-input",{value:this.selectedRoleName,options:a,onInput:function(e){return t.selectedRoleName=e.target.value}}),be.map((function(e){return n("verdocs-toolbar-icon",{text:e.tooltip,icon:e.icon,class:e.class,onClick:function(){if(e.tooltip){if(t.selectedRoleName){t.placing=e.id}else{t.showMustSelectRole=true}}}})}))),n("div",{class:"pages"},(((o=this.template)===null||o===void 0?void 0:o.documents)||[]).map((function(e){var i=c(1,e.pages);return i.map((function(i){var r=e.page_sizes[i];return n("verdocs-template-document-page",{templateId:t.templateId,documentId:e.id,pageNumber:i,virtualWidth:(r===null||r===void 0?void 0:r.width)||612,virtualHeight:(r===null||r===void 0?void 0:r.height)||792,disabled:true,editable:true,done:false,onClick:function(e){return t.handleClickPage(e,i)},onPageRendered:function(e){return t.handlePageRendered(e)},layers:[{name:"page",type:"canvas"},{name:"controls",type:"div"}]})}))}))),this.showMustSelectRole&&n("verdocs-ok-dialog",{heading:"Unable to add field",message:(((s=this.template)===null||s===void 0?void 0:s.roles)||[]).length>0?"Please select a role before adding fields.":"Please add at least one role before adding fields.",onNext:function(){return t.showMustSelectRole=false}}))};Object.defineProperty(e,"watchers",{get:function(){return{templateId:["onTemplateIdChanged"]}},enumerable:false,configurable:true});return e}());xe.style=ae;
|
2
2
|
/**!
|
3
3
|
* Sortable 1.15.6
|
4
4
|
* @author RubaXa <trash@rubaxa.org>
|
@@ -1 +1 @@
|
|
1
|
-
import{r as t,c as e,h as s,H as i,g as o}from"./p-b9654a5e.js";import{VerdocsEndpoint as h,getEnvelopeDocumentPageDisplayUri as a}from"@verdocs/js-sdk";import{t as r}from"./p-
|
1
|
+
import{r as t,c as e,h as s,H as i,g as o}from"./p-b9654a5e.js";import{VerdocsEndpoint as h,getEnvelopeDocumentPageDisplayUri as a}from"@verdocs/js-sdk";import{t as r}from"./p-0c45b79c.js";import"./p-85aa8e05.js";import"./p-c7ee88c7.js";import"./p-12bab948.js";const d=class{constructor(s){t(this,s),this.pageRendered=e(this,"pageRendered",7),this.endpoint=h.getDefault(),this.envelopeId="",this.documentId="",this.pageNumber=1,this.virtualWidth=612,this.virtualHeight=792,this.layers=[{name:"page",type:"canvas"}],this.type="original",this.containerId=`verdocs-envelope-document-page-${Math.random().toString(36).substring(2,11)}`,this.renderedWidth=this.virtualWidth,this.renderedHeight=this.virtualHeight,this.naturalWidth=this.virtualWidth,this.naturalHeight=this.virtualHeight,this.aspectRatio=this.virtualWidth/this.virtualHeight,this.skipFirstNotification=!0,this.pageDisplayUri="https://verdocs-public-assets.s3.amazonaws.com/page-loading-placeholder.png"}async componentWillLoad(){this.pageDisplayUri=await a(this.endpoint,this.documentId,this.pageNumber,this.type)}componentDidLoad(){this.resizeObserver=new ResizeObserver(r((t=>{for(const e of t){const t=e.contentRect.width;this.renderedWidth=t,this.renderedHeight=this.virtualHeight*(t/this.virtualWidth)}this.notifyRenderedSize()}),100)),this.resizeObserver.observe(this.container)}disconnectedCallback(){var t;null===(t=this.resizeObserver)||void 0===t||t.disconnect()}notifyRenderedSize(){this.skipFirstNotification?this.skipFirstNotification=!1:this.pageRendered.emit({containerId:this.containerId,documentId:this.documentId,pageNumber:this.pageNumber,virtualWidth:this.virtualWidth,virtualHeight:this.virtualHeight,renderedWidth:this.renderedWidth,renderedHeight:this.renderedHeight,naturalWidth:this.naturalWidth,naturalHeight:this.naturalHeight,aspectRatio:this.aspectRatio,xScale:this.renderedWidth/this.virtualWidth,yScale:this.renderedHeight/this.virtualHeight})}render(){const t=`${this.renderedHeight}px`;return s(i,{key:"d461f16d93680ee69b93258d9985e7e24599acbd",id:`${this.containerId}`,style:{height:t,flex:`0 0 ${t}`}},this.layers.map((e=>"div"===e.type?s("div",{class:"verdocs-envelope-document-page-layer",id:`${this.containerId}-${e.name}`,style:{height:t}}):this.pageDisplayUri?s("img",{class:"verdocs-envelope-document-page-layer img",id:`${this.containerId}-${e.name}`,src:this.pageDisplayUri,alt:`Page ${this.pageNumber}`,"aria-hidden":!0,loading:"lazy",onLoad:t=>{this.naturalWidth=t.target.naturalWidth,this.naturalHeight=t.target.naturalHeight,this.aspectRatio=this.naturalWidth/this.naturalHeight,this.virtualHeight=this.virtualWidth/this.aspectRatio,this.renderedHeight=t.target.offsetWidth/this.aspectRatio}}):s("div",null))))}get container(){return o(this)}};d.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-envelope-document-page{width:100%;position:relative}verdocs-envelope-document-page .verdocs-envelope-document-page-layer{position:absolute;top:0;left:0;right:0;bottom:0;-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-envelope-document-page .verdocs-envelope-document-page-layer.img{width:100%}";export{d as verdocs_envelope_document_page}
|
@@ -1 +1 @@
|
|
1
|
-
import{r as e,c as t,h as s,H as i}from"./p-b9654a5e.js";import{VerdocsEndpoint as o,getTemplate as r,updateTemplateRole as l,deleteTemplateRole as a,isValidEmail as d}from"@verdocs/js-sdk";import{S as c}from"./p-fd97809c.js";import{S as n}from"./p-b712e729.js";const p=class{constructor(s){e(this,s),this.close=t(this,"close",7),this.moved=!1,this.overlayId="verdocs-menu-panel-overlay",this.panelId="verdocs-menu-panel",this.side="right",this.overlay=!0,this.width=300}handleClick(e){var t;this.element.contains(e.target)||(this.hide(),null===(t=this.close)||void 0===t||t.emit())}componentWillLoad(){this.hide(),this.overlay&&(this.portal=document.createElement("div"),this.portal.setAttribute("id",this.overlayId),document.body.append(this.portal)),this.portal=document.createElement("div"),this.portal.setAttribute("id",this.panelId),this.portal.style.top="0px",this.portal.style.bottom="0px",this.portal.style.width=`${this.width}px`,"left"===this.side?this.portal.style.left="0px":this.portal.style.right="0px",document.body.append(this.portal)}componentDidLoad(){this.portal.appendChild(this.element)}disconnectedCallback(){this.moved?this.portal.remove():this.moved=!0}hide(){var e,t;null===(e=document.getElementById(this.overlayId))||void 0===e||e.remove(),null===(t=document.getElementById(this.panelId))||void 0===t||t.remove()}render(){return s(i,{key:"1d8fd8a0d6035917184972712ab812f5c6141a1f",ref:e=>this.element=e},s("slot",{key:"696879936056ff36c4054e4a235455f9308605af"}))}};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-menu-panel-overlay{top:0;left:0;width:100%;height:100%;z-index:10000;position:fixed;background-color:rgba(0, 0, 0, 0.4980392157)}#verdocs-menu-panel{opacity:0;z-index:10001;position:fixed;overflow-y:scroll;background-color:#ffffff;font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif;-webkit-animation:showVerdocsMenuPanel 0.35s;-webkit-animation-fill-mode:forwards}@-webkit-keyframes showVerdocsMenuPanel{0%{opacity:0;right:-300px}100%{right:0;opacity:1}}';const h=class{constructor(s){e(this,s),this.close=t(this,"close",7),this.delete=t(this,"delete",7),this.sdkError=t(this,"sdkError",7),this.templateListenerId=null,this.endpoint=o.getDefault(),this.templateId="",this.roleName="",this.dirty=!1,this.saving=!1,this.name="",this.type="signer",this.first_name="",this.last_name="",this.email="",this.phone="",this.delegator=!1,this.loading=!0,this.template=null}async componentWillLoad(){var e,t,s;try{if(this.endpoint.loadSession(),!this.templateId)return void console.log(`[ROLES] Missing required template ID ${this.templateId}`);if(!this.endpoint.session)return void console.log("[ROLES] Unable to start builder session, must be authenticated");this.listenToTemplate()}catch(i){console.log("[ROLES Error with preview session",i),null===(e=this.sdkError)||void 0===e||e.emit(new c(i.message,null===(t=i.response)||void 0===t?void 0:t.status,null===(s=i.response)||void 0===s?void 0:s.data))}}disconnectedCallback(){this.unlistenToTemplate()}async listenToTemplate(){console.log("[ROLES] Loading tempate",this.templateId),this.unlistenToTemplate(),n.subscribe("templates",this.templateId,(()=>r(this.endpoint,this.templateId)),!1,(e=>{var t;console.log("[BUILD] Template Updated",e),this.template=e,this.loading=!1;const s=null===(t=this.template)||void 0===t?void 0:t.roles.find((e=>e.name===this.roleName));s&&(this.name=s.name,this.type=s.type,this.first_name=s.first_name,this.last_name=s.last_name,this.email=s.email,this.phone=s.phone,this.delegator=s.delegator,console.log("[ROLES] Editing role",s))}))}unlistenToTemplate(){this.templateListenerId&&(n.store.delListener(this.templateListenerId),this.templateListenerId=null)}handleCancel(e){var t,s;e.stopPropagation();const i=null===(t=this.template)||void 0===t?void 0:t.roles.find((e=>e.name===this.roleName));i&&(this.name=i.name,this.type=i.type,this.first_name=i.first_name,this.last_name=i.last_name,this.email=i.email,this.phone=i.phone,this.delegator=i.delegator),this.dirty=!1,null===(s=this.close)||void 0===s||s.emit()}async handleSave(e){e.stopPropagation(),this.saving=!0,l(this.endpoint,this.templateId,this.roleName,{name:this.name,type:this.type,first_name:this.first_name,last_name:this.last_name,email:this.email,phone:this.phone,delegator:this.delegator}).then((async e=>{var t;console.log("[ROLES] Update result",e),this.saving=!1,this.dirty=!1;const s=JSON.parse(JSON.stringify(this.template)),i=s.roles.findIndex((e=>e.name===this.roleName));i>-1&&(s.roles[i]=e),n.updateTemplate(this.templateId,s),null===(t=this.close)||void 0===t||t.emit()})).catch((e=>{console.log("[ROLES Update error",e),this.saving=!1}))}async handleDelete(e){e.stopPropagation(),window.confirm("Are you sure you wish to remove this role? All associated fields will be removed as well. This action cannot be undone.")&&a(this.endpoint,this.templateId,this.roleName).then((()=>{var e,t;const s=JSON.parse(JSON.stringify(this.template));s.roles=s.roles.filter((e=>e.name!==this.roleName)),n.getTemplate(this.endpoint,this.templateId,!0),null===(e=this.delete)||void 0===e||e.emit({templateId:this.templateId,roleName:this.roleName}),null===(t=this.close)||void 0===t||t.emit()})).catch((e=>{console.log("[ROLES Deletion error",e)}))}render(){var e;const t=((null===(e=this.template)||void 0===e?void 0:e.fields)||[]).some((e=>e.role_name===this.roleName)),o=!this.email&&!this.first_name&&!this.last_name||d(this.email)&&!!this.first_name&&!!this.last_name;return s(i,{key:"a1895798db1e9b9f63c42e79556bdb76029217c2"},s("form",{key:"8be859da1a954e4d086d630e0d5aeaa991f88640",onSubmit:e=>e.preventDefault(),onClick:e=>e.stopPropagation(),autocomplete:"off"},s("div",{key:"a37025fa1b286d43493bd142f77f8310b02ee701"},s("verdocs-text-input",{key:"eea1b7844b0a60c30a6ee50a123399b7fe6fac4a",id:"verdocs-role-name",label:"Role Name (Must be unique)",value:this.name,autocomplete:"off",disabled:t,placeholder:"Role Name...",onInput:e=>{this.name=e.target.value,this.dirty=!0}}),t&&s("div",{key:"5945d4e7a64f9b4a513bbd975fb821f662e452a4",class:"instructions"},"This role has fields assigned and can no longer be renamed.")),s("div",{key:"14cfb01f29a5889f1fcb2c90366ba4f215341a2c"},s("div",{key:"9095e3b2f1f378c9d3937898ca68d6742d89be54",class:"input-label"},"Type:"),s("verdocs-select-input",{key:"b07e4afc086e7d1563f58bb3c43aa0d909d8a65e",value:this.type,options:[{label:"Signer",value:"signer"},{label:"CC",value:"cc"},{label:"Approver",value:"approver"}],onInput:e=>{this.type=e.target.value,this.dirty=!0}})),s("div",{key:"5e1ed5226be0707cc5430c1e7bd38ad6e4df5dd5"},s("div",{key:"fc4a467cb0da25a80c421134c8226480369d2a83",class:"input-label"},"Default Contact Info:"),s("div",{key:"f6cb36cde86b8067c374e4bf0cffa6549851888d",class:"first-last"},s("verdocs-text-input",{key:"a52d5426c87419f45482ef6004ef11597400ea87",id:"verdocs-recipient-first",value:this.first_name,autocomplete:"off",placeholder:"First...",onInput:e=>{this.first_name=e.target.value,this.dirty=!0}}),s("verdocs-text-input",{key:"b9035b299231319dce05f19c15c4d427ad6cd2f3",id:"verdocs-recipient-first",value:this.last_name,autocomplete:"off",placeholder:"Last...",onInput:e=>{this.last_name=e.target.value,this.dirty=!0}}))),s("div",{key:"d42c1ce5ae61db11a0ac32b3fa7bc3816e3068c6"},s("verdocs-text-input",{key:"63436a7be6b3f35c2341dc88d137bd2f6b061978",id:"verdocs-recipient-email",value:this.email,autocomplete:"off",placeholder:"Email Address...",onInput:e=>{this.email=e.target.value,this.dirty=!0}}),s("div",{key:"5a7ed36cfa657fb9ee11cf62998abbab2cc641e9",style:{height:"15px"}}),s("div",{key:"c974f4e78235706788dfa54f69f6f5ec7d37d00e"},s("verdocs-text-input",{key:"2be4c29396c6e6bc4f687819646ea219fce97e82",id:"verdocs-recipient-phone",value:this.phone,autocomplete:"off",placeholder:"Phone Number...",onInput:e=>{this.phone=e.target.value,this.dirty=!0}}))),s("div",{key:"a0eba03681cab8b491e5bd833c9d718d85979d92",class:"buttons"},s("button",{key:"145ae41f583a843a6e64743b9f18a0f3c23c370c",class:"delete-button",disabled:this.dirty,onClick:e=>this.handleDelete(e),innerHTML:'<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="#a50021"><path stroke-linecap="round" stroke-linejoin="round" d="M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 00-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 00-7.5 0" /></svg>'}),s("div",{key:"e81da0df0eceae434bb1fbaa5b642edacc978a4a",style:{flex:"1"}}),s("verdocs-button",{key:"bb0cd0eae3b51a84b2729531508d888cb03dad10",size:"small",label:"Save",disabled:!this.dirty||!o,onClick:e=>this.handleSave(e)}))))}};h.style='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-template-role-properties{-webkit-box-sizing:border-box;box-sizing:border-box;font-family:"Inter", "Barlow", sans-serif}verdocs-template-role-properties div{-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-template-role-properties .heading{display:-ms-flexbox;display:flex;font-size:20px;font-weight:500;-ms-flex-direction:row;flex-direction:row}verdocs-template-role-properties .buttons{display:-ms-flexbox;display:flex;margin-top:10px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:justify;justify-content:space-between}verdocs-template-role-properties .buttons verdocs-button{margin-left:16px}verdocs-template-role-properties form{gap:15px;padding:20px;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}verdocs-template-role-properties form .instructions{margin:7px 0 0 0;font-size:12px;font-style:italic}verdocs-template-role-properties form .input-label{display:block;font-size:14px;-ms-flex:0 0 100px;flex:0 0 100px;font-weight:700;margin:0 0 4px 0;color:#555570}verdocs-template-role-properties form .first-last{gap:15px;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row}verdocs-template-role-properties form verdocs-help-icon{-webkit-transform:scale(0.8);transform:scale(0.8)}verdocs-template-role-properties verdocs-select-input label{display:block}verdocs-template-role-properties verdocs-text-input{margin:0}verdocs-template-role-properties verdocs-text-input label{display:block}verdocs-template-role-properties verdocs-text-input .input-label{-ms-flex:0 0 100px;flex:0 0 100px}verdocs-template-role-properties verdocs-text-input input{-ms-flex:1;flex:1;display:-ms-flexbox;display:flex}verdocs-template-role-properties verdocs-text-input verdocs-text-input{margin:0}verdocs-template-role-properties .checkbox-wrapper{-ms-flex:1;flex:1;display:-ms-flexbox;display:flex}verdocs-template-role-properties .delete-button{height:34px;display:-ms-flexbox;display:flex;padding:0 6px;cursor:pointer;background:none;border-radius:4px;-ms-flex-align:center;align-items:center;border:1px solid #999;-ms-flex-pack:center;justify-content:center}verdocs-template-role-properties .delete-button svg{width:24px;height:24px}verdocs-template-role-properties .delete-button:active{background:#f3f3f3}';export{p as verdocs_menu_panel,h as verdocs_template_role_properties}
|
1
|
+
import{r as e,c as t,h as s,H as i}from"./p-b9654a5e.js";import{VerdocsEndpoint as o,getTemplate as r,updateTemplateRole as l,deleteTemplateRole as a,isValidEmail as d}from"@verdocs/js-sdk";import{S as c}from"./p-fd97809c.js";import{S as n}from"./p-58d027d1.js";const p=class{constructor(s){e(this,s),this.close=t(this,"close",7),this.moved=!1,this.overlayId="verdocs-menu-panel-overlay",this.panelId="verdocs-menu-panel",this.side="right",this.overlay=!0,this.width=300}handleClick(e){var t;this.element.contains(e.target)||(this.hide(),null===(t=this.close)||void 0===t||t.emit())}componentWillLoad(){this.hide(),this.overlay&&(this.portal=document.createElement("div"),this.portal.setAttribute("id",this.overlayId),document.body.append(this.portal)),this.portal=document.createElement("div"),this.portal.setAttribute("id",this.panelId),this.portal.style.top="0px",this.portal.style.bottom="0px",this.portal.style.width=`${this.width}px`,"left"===this.side?this.portal.style.left="0px":this.portal.style.right="0px",document.body.append(this.portal)}componentDidLoad(){this.portal.appendChild(this.element)}disconnectedCallback(){this.moved?this.portal.remove():this.moved=!0}hide(){var e,t;null===(e=document.getElementById(this.overlayId))||void 0===e||e.remove(),null===(t=document.getElementById(this.panelId))||void 0===t||t.remove()}render(){return s(i,{key:"1d8fd8a0d6035917184972712ab812f5c6141a1f",ref:e=>this.element=e},s("slot",{key:"696879936056ff36c4054e4a235455f9308605af"}))}};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-menu-panel-overlay{top:0;left:0;width:100%;height:100%;z-index:10000;position:fixed;background-color:rgba(0, 0, 0, 0.4980392157)}#verdocs-menu-panel{opacity:0;z-index:10001;position:fixed;overflow-y:scroll;background-color:#ffffff;font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif;-webkit-animation:showVerdocsMenuPanel 0.35s;-webkit-animation-fill-mode:forwards}@-webkit-keyframes showVerdocsMenuPanel{0%{opacity:0;right:-300px}100%{right:0;opacity:1}}';const h=class{constructor(s){e(this,s),this.close=t(this,"close",7),this.delete=t(this,"delete",7),this.sdkError=t(this,"sdkError",7),this.templateListenerId=null,this.endpoint=o.getDefault(),this.templateId="",this.roleName="",this.dirty=!1,this.saving=!1,this.name="",this.type="signer",this.first_name="",this.last_name="",this.email="",this.phone="",this.delegator=!1,this.loading=!0,this.template=null}async componentWillLoad(){var e,t,s;try{if(this.endpoint.loadSession(),!this.templateId)return void console.log(`[ROLES] Missing required template ID ${this.templateId}`);if(!this.endpoint.session)return void console.log("[ROLES] Unable to start builder session, must be authenticated");this.listenToTemplate()}catch(i){console.log("[ROLES Error with preview session",i),null===(e=this.sdkError)||void 0===e||e.emit(new c(i.message,null===(t=i.response)||void 0===t?void 0:t.status,null===(s=i.response)||void 0===s?void 0:s.data))}}disconnectedCallback(){this.unlistenToTemplate()}async listenToTemplate(){console.log("[ROLES] Loading tempate",this.templateId),this.unlistenToTemplate(),n.subscribe("templates",this.templateId,(()=>r(this.endpoint,this.templateId)),!1,(e=>{var t;console.log("[BUILD] Template Updated",e),this.template=e,this.loading=!1;const s=null===(t=this.template)||void 0===t?void 0:t.roles.find((e=>e.name===this.roleName));s&&(this.name=s.name,this.type=s.type,this.first_name=s.first_name,this.last_name=s.last_name,this.email=s.email,this.phone=s.phone,this.delegator=s.delegator,console.log("[ROLES] Editing role",s))}))}unlistenToTemplate(){this.templateListenerId&&(n.store.delListener(this.templateListenerId),this.templateListenerId=null)}handleCancel(e){var t,s;e.stopPropagation();const i=null===(t=this.template)||void 0===t?void 0:t.roles.find((e=>e.name===this.roleName));i&&(this.name=i.name,this.type=i.type,this.first_name=i.first_name,this.last_name=i.last_name,this.email=i.email,this.phone=i.phone,this.delegator=i.delegator),this.dirty=!1,null===(s=this.close)||void 0===s||s.emit()}async handleSave(e){e.stopPropagation(),this.saving=!0,l(this.endpoint,this.templateId,this.roleName,{name:this.name,type:this.type,first_name:this.first_name,last_name:this.last_name,email:this.email,phone:this.phone,delegator:this.delegator}).then((async e=>{var t;console.log("[ROLES] Update result",e),this.saving=!1,this.dirty=!1;const s=JSON.parse(JSON.stringify(this.template)),i=s.roles.findIndex((e=>e.name===this.roleName));i>-1&&(s.roles[i]=e),n.updateTemplate(this.templateId,s),null===(t=this.close)||void 0===t||t.emit()})).catch((e=>{console.log("[ROLES Update error",e),this.saving=!1}))}async handleDelete(e){e.stopPropagation(),window.confirm("Are you sure you wish to remove this role? All associated fields will be removed as well. This action cannot be undone.")&&a(this.endpoint,this.templateId,this.roleName).then((()=>{var e,t;const s=JSON.parse(JSON.stringify(this.template));s.roles=s.roles.filter((e=>e.name!==this.roleName)),n.getTemplate(this.endpoint,this.templateId,!0),null===(e=this.delete)||void 0===e||e.emit({templateId:this.templateId,roleName:this.roleName}),null===(t=this.close)||void 0===t||t.emit()})).catch((e=>{console.log("[ROLES Deletion error",e)}))}render(){var e;const t=((null===(e=this.template)||void 0===e?void 0:e.fields)||[]).some((e=>e.role_name===this.roleName)),o=!this.email&&!this.first_name&&!this.last_name||d(this.email)&&!!this.first_name&&!!this.last_name;return s(i,{key:"a1895798db1e9b9f63c42e79556bdb76029217c2"},s("form",{key:"8be859da1a954e4d086d630e0d5aeaa991f88640",onSubmit:e=>e.preventDefault(),onClick:e=>e.stopPropagation(),autocomplete:"off"},s("div",{key:"a37025fa1b286d43493bd142f77f8310b02ee701"},s("verdocs-text-input",{key:"eea1b7844b0a60c30a6ee50a123399b7fe6fac4a",id:"verdocs-role-name",label:"Role Name (Must be unique)",value:this.name,autocomplete:"off",disabled:t,placeholder:"Role Name...",onInput:e=>{this.name=e.target.value,this.dirty=!0}}),t&&s("div",{key:"5945d4e7a64f9b4a513bbd975fb821f662e452a4",class:"instructions"},"This role has fields assigned and can no longer be renamed.")),s("div",{key:"14cfb01f29a5889f1fcb2c90366ba4f215341a2c"},s("div",{key:"9095e3b2f1f378c9d3937898ca68d6742d89be54",class:"input-label"},"Type:"),s("verdocs-select-input",{key:"b07e4afc086e7d1563f58bb3c43aa0d909d8a65e",value:this.type,options:[{label:"Signer",value:"signer"},{label:"CC",value:"cc"},{label:"Approver",value:"approver"}],onInput:e=>{this.type=e.target.value,this.dirty=!0}})),s("div",{key:"5e1ed5226be0707cc5430c1e7bd38ad6e4df5dd5"},s("div",{key:"fc4a467cb0da25a80c421134c8226480369d2a83",class:"input-label"},"Default Contact Info:"),s("div",{key:"f6cb36cde86b8067c374e4bf0cffa6549851888d",class:"first-last"},s("verdocs-text-input",{key:"a52d5426c87419f45482ef6004ef11597400ea87",id:"verdocs-recipient-first",value:this.first_name,autocomplete:"off",placeholder:"First...",onInput:e=>{this.first_name=e.target.value,this.dirty=!0}}),s("verdocs-text-input",{key:"b9035b299231319dce05f19c15c4d427ad6cd2f3",id:"verdocs-recipient-first",value:this.last_name,autocomplete:"off",placeholder:"Last...",onInput:e=>{this.last_name=e.target.value,this.dirty=!0}}))),s("div",{key:"d42c1ce5ae61db11a0ac32b3fa7bc3816e3068c6"},s("verdocs-text-input",{key:"63436a7be6b3f35c2341dc88d137bd2f6b061978",id:"verdocs-recipient-email",value:this.email,autocomplete:"off",placeholder:"Email Address...",onInput:e=>{this.email=e.target.value,this.dirty=!0}}),s("div",{key:"5a7ed36cfa657fb9ee11cf62998abbab2cc641e9",style:{height:"15px"}}),s("div",{key:"c974f4e78235706788dfa54f69f6f5ec7d37d00e"},s("verdocs-text-input",{key:"2be4c29396c6e6bc4f687819646ea219fce97e82",id:"verdocs-recipient-phone",value:this.phone,autocomplete:"off",placeholder:"Phone Number...",onInput:e=>{this.phone=e.target.value,this.dirty=!0}}))),s("div",{key:"a0eba03681cab8b491e5bd833c9d718d85979d92",class:"buttons"},s("button",{key:"145ae41f583a843a6e64743b9f18a0f3c23c370c",class:"delete-button",disabled:this.dirty,onClick:e=>this.handleDelete(e),innerHTML:'<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="#a50021"><path stroke-linecap="round" stroke-linejoin="round" d="M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 00-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 00-7.5 0" /></svg>'}),s("div",{key:"e81da0df0eceae434bb1fbaa5b642edacc978a4a",style:{flex:"1"}}),s("verdocs-button",{key:"bb0cd0eae3b51a84b2729531508d888cb03dad10",size:"small",label:"Save",disabled:!this.dirty||!o,onClick:e=>this.handleSave(e)}))))}};h.style='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-template-role-properties{-webkit-box-sizing:border-box;box-sizing:border-box;font-family:"Inter", "Barlow", sans-serif}verdocs-template-role-properties div{-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-template-role-properties .heading{display:-ms-flexbox;display:flex;font-size:20px;font-weight:500;-ms-flex-direction:row;flex-direction:row}verdocs-template-role-properties .buttons{display:-ms-flexbox;display:flex;margin-top:10px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:justify;justify-content:space-between}verdocs-template-role-properties .buttons verdocs-button{margin-left:16px}verdocs-template-role-properties form{gap:15px;padding:20px;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}verdocs-template-role-properties form .instructions{margin:7px 0 0 0;font-size:12px;font-style:italic}verdocs-template-role-properties form .input-label{display:block;font-size:14px;-ms-flex:0 0 100px;flex:0 0 100px;font-weight:700;margin:0 0 4px 0;color:#555570}verdocs-template-role-properties form .first-last{gap:15px;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row}verdocs-template-role-properties form verdocs-help-icon{-webkit-transform:scale(0.8);transform:scale(0.8)}verdocs-template-role-properties verdocs-select-input label{display:block}verdocs-template-role-properties verdocs-text-input{margin:0}verdocs-template-role-properties verdocs-text-input label{display:block}verdocs-template-role-properties verdocs-text-input .input-label{-ms-flex:0 0 100px;flex:0 0 100px}verdocs-template-role-properties verdocs-text-input input{-ms-flex:1;flex:1;display:-ms-flexbox;display:flex}verdocs-template-role-properties verdocs-text-input verdocs-text-input{margin:0}verdocs-template-role-properties .checkbox-wrapper{-ms-flex:1;flex:1;display:-ms-flexbox;display:flex}verdocs-template-role-properties .delete-button{height:34px;display:-ms-flexbox;display:flex;padding:0 6px;cursor:pointer;background:none;border-radius:4px;-ms-flex-align:center;align-items:center;border:1px solid #999;-ms-flex-pack:center;justify-content:center}verdocs-template-role-properties .delete-button svg{width:24px;height:24px}verdocs-template-role-properties .delete-button:active{background:#f3f3f3}';export{p as verdocs_menu_panel,h as verdocs_template_role_properties}
|
@@ -1 +1 @@
|
|
1
|
-
var __awaiter=this&&this.__awaiter||function(n,r,t,u){function e(n){return n instanceof t?n:new t((function(r){r(n)}))}return new(t||(t=Promise))((function(t,i){function a(n){try{f(u.next(n))}catch(n){i(n)}}function o(n){try{f(u["throw"](n))}catch(n){i(n)}}function f(n){n.done?t(n.value):e(n.value).then(a,o)}f((u=u.apply(n,r||[])).next())}))};var __generator=this&&this.__generator||function(n,r){var t={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},u,e,i,a;return a={next:o(0),throw:o(1),return:o(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function o(n){return function(r){return f([n,r])}}function f(o){if(u)throw new TypeError("Generator is already executing.");while(a&&(a=0,o[0]&&(t=0)),t)try{if(u=1,e&&(i=o[0]&2?e["return"]:o[0]?e["throw"]||((i=e["return"])&&i.call(e),0):e.next)&&!(i=i.call(e,o[1])).done)return i;if(e=0,i)o=[o[0]&2,i.value];switch(o[0]){case 0:case 1:i=o;break;case 4:t.label++;return{value:o[1],done:false};case 5:t.label++;e=o[1];o=[0];continue;case 7:o=t.ops.pop();t.trys.pop();continue;default:if(!(i=t.trys,i=i.length>0&&i[i.length-1])&&(o[0]===6||o[0]===2)){t=0;continue}if(o[0]===3&&(!i||o[1]>i[0]&&o[1]<i[3])){t.label=o[1];break}if(o[0]===6&&t.label<i[1]){t.label=i[1];i=o;break}if(i&&t.label<i[2]){t.label=i[2];t.ops.push(o);break}if(i[2])t.ops.pop();t.trys.pop();continue}o=r.call(n,t)}catch(n){o=[6,n];e=0}finally{u=i=0}if(o[0]&5)throw o[1];return{value:o[0]?o[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(n,r,t){if(t||arguments.length===2)for(var u=0,e=r.length,i;u<e;u++){if(i||!(u in r)){if(!i)i=Array.prototype.slice.call(r,0,u);i[u]=r[u]}}return n.concat(i||Array.prototype.slice.call(r))};System.register(["@verdocs/js-sdk"],(function(n){"use strict";var r;return{setters:[function(n){r=n.getTemplate}],execute:function(){var t=function(n){return typeof n};var u="";var e=t(u);var i=t(true);var a=t(0);var o=t(t);var f="type";var v="default";var c="Listener";var l="add";var s="Has";var d="Ids";var _="Table";var h=_+"s";var p=_+d;var y="Row";var b=y+"Count";var g=y+d;var w="Cell";var T=w+d;var S="Value";var m=S+"s";var A=S+d;var C=function(n){return u+n};var V=isFinite;var R=function(n,r){return n instanceof r};var I=function(n){return n==void 0};var J=function(n,r,t){return I(n)?t===null||t===void 0?void 0:t():r(n)};var E=function(n){return n==e||n==i};var L=function(n){return t(n)==o};var O=function(n){return Array.isArray(n)};var j=function(n,r,t){return n.slice(r,t)};var k=function(n){return n.length};var x=function(n,r){return n.test(r)};var N=function(n,r){return n.includes(r)};var F=function(n,r){return n.every(r)};var M=function(n,r){return k(n)===k(r)&&F(n,(function(n,t){return r[t]===n}))};var P=function(n,r){return n.sort(r)};var D=function(n,r){return n.forEach(r)};var z=function(n,r){return n.map(r)};var G=function(n,r,t){return n.reduce(r,t)};var H=function(n){var r=[];for(var t=1;t<arguments.length;t++){r[t-1]=arguments[t]}return n.push.apply(n,r)};var W=function(n){return n.shift()};var $=Object;var q=function(n){return $.getPrototypeOf(n)};var B=$.entries;var K=$.isFrozen;var Q=function(n){return!I(n)&&J(q(n),(function(n){return n==$.prototype||I(q(n))}),(function(){return true}))};var U=$.keys;var X=$.freeze;var Y=function(n,r){return r in n};var Z=function(n,r){delete n[r];return n};var nn=function(n,r){return z(B(n),(function(n){var t=n[0],u=n[1];return r(u,t)}))};var rn=function(n){return k(U(n))};var tn=function(n){return Q(n)&&rn(n)==0};var un=function(n,r,t,u){if(u===void 0){u=0}if(I(n)||!Q(n)||!u&&tn(n)||K(n)){t===null||t===void 0?void 0:t();return false}nn(n,(function(t,u){if(!r(t,u)){Z(n,u)}}));return u?true:!tn(n)};var en=function(n){return function(r){return G(sn(r),(function(r,t){return r+n(t)}),0)}};var an=function(n){var r;return(r=n===null||n===void 0?void 0:n.size)!==null&&r!==void 0?r:0};var on=en(an);var fn=en(on);var vn=en(fn);var cn=function(n,r){var t;return(t=n===null||n===void 0?void 0:n.has(r))!==null&&t!==void 0?t:false};var ln=function(n){return I(n)||an(n)==0};var sn=function(n){var r;return __spreadArray([],(r=n===null||n===void 0?void 0:n.values())!==null&&r!==void 0?r:[],true)};var dn=function(n){return n.clear()};var _n=function(n,r){return n===null||n===void 0?void 0:n.forEach(r)};var hn=function(n,r){return n===null||n===void 0?void 0:n.delete(r)};var pn=function(n){return new Map(n)};var yn=function(n){var r;return __spreadArray([],(r=n===null||n===void 0?void 0:n.keys())!==null&&r!==void 0?r:[],true)};var bn=function(n,r){return n===null||n===void 0?void 0:n.get(r)};var gn=function(n,r){return _n(n,(function(n,t){return r(t,n)}))};var wn=function(n,r){var t;return z(__spreadArray([],(t=n===null||n===void 0?void 0:n.entries())!==null&&t!==void 0?t:[],true),(function(n){var t=n[0],u=n[1];return r(u,t)}))};var Tn=function(n,r,t){return I(t)?(hn(n,r),n):n===null||n===void 0?void 0:n.set(r,t)};var Sn=function(n,r,t,u){if(!cn(n,r)){Tn(n,r,t())}else{u===null||u===void 0?void 0:u(bn(n,r))}return bn(n,r)};var mn=function(n,r,t,u){if(u===void 0){u=Tn}nn(r,(function(r,u){return t(n,u,r)}));gn(n,(function(t){return Y(r,t)?0:u(n,t)}));return n};var An=function(n,r,t,u){var e={};_n(n,(function(n,i){if(!(t===null||t===void 0?void 0:t(n,i))){var a=r?r(n,i):n;if(!(u===null||u===void 0?void 0:u(a))){e[i]=a}}}));return e};var Cn=function(n,r,t){return An(n,(function(n){return An(n,r,t)}),ln,tn)};var Vn=function(n,r,t){return An(n,(function(n){return Cn(n,r,t)}),ln,tn)};var Rn=function(n,r){var t=pn();_n(n,(function(n,u){var e;return t.set(u,(e=r===null||r===void 0?void 0:r(n))!==null&&e!==void 0?e:n)}));return t};var In=function(n){return Rn(n,Rn)};var Jn=function(n){return Rn(n,In)};var En=function(n,r,t,u,e){if(e===void 0){e=0}return J((t?Sn:bn)(n,r[e],e>k(r)-2?t:pn),(function(i){if(e>k(r)-2){if(u===null||u===void 0?void 0:u(i)){Tn(n,r[e])}return i}var a=En(i,r,t,u,e+1);if(ln(i)){Tn(n,r[e])}return a}))};var Ln=function(n){var r=t(n);return E(r)||r==a&&V(n)?r:void 0};var On=function(n,r,t,u,e){return I(e)?n.delCell(r,t,u,true):n.setCell(r,t,u,e)};var jn=function(n,r,t){return I(t)?n.delValue(r):n.setValue(r,t)};var kn=function(n){return new Set(O(n)||I(n)?n:[n])};var xn=function(n,r){return n===null||n===void 0?void 0:n.add(r)};var Nn=/^\d+$/;var Fn=function(){var n=[];var r=0;return[function(t){var e;return(e=t?W(n):null)!==null&&e!==void 0?e:u+r++},function(r){if(x(Nn,r)&&k(n)<1e3){H(n,r)}}]};var Mn=function(n,r){if(r===void 0){r=[u]}var t=[];var e=function(n,u){return u==k(r)?H(t,n):r[u]===null?_n(n,(function(n){return e(n,u+1)})):D([r[u],null],(function(r){return e(bn(n,r),u+1)}))};e(n,0);return t};var Pn=function(n){var r;var t=Fn(),e=t[0],i=t[1];var a=pn();var o=function(t,i,o,f,v){if(f===void 0){f=[]}if(v===void 0){v=function(){return[]}}r!==null&&r!==void 0?r:r=n();var c=e(1);Tn(a,c,[t,i,o,f,v]);xn(En(i,o!==null&&o!==void 0?o:[u],kn),c);return c};var f=function(n,t){var u=[];for(var e=2;e<arguments.length;e++){u[e-2]=arguments[e]}return D(Mn(n,t),(function(n){return _n(n,(function(n){var e;return(e=bn(a,n))[0].apply(e,__spreadArray(__spreadArray([r],t!==null&&t!==void 0?t:[],false),u,false))}))}))};var v=function(n){return J(bn(a,n),(function(r){var t=r[1],e=r[2];En(t,e!==null&&e!==void 0?e:[u],void 0,(function(r){hn(r,n);return ln(r)?1:0}));Tn(a,n);i(n);return e}))};var c=function(n){return J(bn(a,n),(function(n){var t=n[0],u=n[2],e=u===void 0?[]:u,i=n[3],a=n[4];var o=function(){var n,u;var f=[];for(var v=0;v<arguments.length;v++){f[v]=arguments[v]}var c=k(f);if(c==k(e)){t.apply(void 0,__spreadArray(__spreadArray([r],f,false),a(f),false))}else if(I(e[c])){D((u=(n=i[c])===null||n===void 0?void 0:n.call.apply(n,__spreadArray([i],f,false)))!==null&&u!==void 0?u:[],(function(n){return o.apply(void 0,__spreadArray(__spreadArray([],f,false),[n],false))}))}else{o.apply(void 0,__spreadArray(__spreadArray([],f,false),[e[c]],false))}};o()}))};return[o,f,v,c]};var Dn=function(n,r){return(n!==null&&n!==void 0?n:0)<(r!==null&&r!==void 0?r:0)?-1:1};var zn=function(n){return[n,n]};var Gn=function(n,r){if(r===void 0){r=on}return r(n[0])+r(n[1])};var Hn=function(){return[pn(),pn()]};var Wn=function(n){return __spreadArray([],n,true)};var $n=function(n){var r=n[0],t=n[1];return r===t};var qn=JSON.stringify;var Bn=JSON.parse;var Kn=function(n){return qn(n,(function(n,r){return R(r,Map)?$.fromEntries(__spreadArray([],r,true)):r}))};var Qn=function(n,r,t){return Tn(n,r,bn(n,r)==-t?void 0:t)};var Un=function(){var n;var r;var t;var u=false;var e=false;var i=0;var o=[];var d=pn();var V=pn();var R=pn();var k=pn();var x=pn();var F=pn();var G=pn();var W=pn();var $=pn();var q=pn();var B=pn();var K=pn();var Q=pn();var U=pn();var rn=kn();var en=pn();var sn=pn();var En=pn();var Nn=pn();var Mn=Hn();var qn=Hn();var Xn=Hn();var Yn=Hn();var Zn=Hn();var nr=Hn();var rr=Hn();var tr=Hn();var ur=Hn();var er=Hn();var ir=Hn();var ar=Hn();var or=Hn();var fr=Hn();var vr=Hn();var cr=Hn();var lr=Hn();var sr=Hn();var dr=Hn();var _r=Hn();var hr=Hn();var pr=Hn();var yr=pn();var br=Hn();var gr=Pn((function(){return ju})),wr=gr[0],Tr=gr[1],Sr=gr[2],mr=gr[3];var Ar=function(n){return un(n,(function(n){return un(n,Vr)}))};var Cr=function(n){return un(n,Vr)};var Vr=function(n){if(!un(n,(function(n,r){return N([f,v],r)}))){return false}var r=n[f];if(!E(r)&&r!=a){return false}if(Ln(n[v])!=r){Z(n,v)}return true};var Rr=O;var Ir=function(n){return un(n,Jr,at)};var Jr=function(n,t){return(!r||cn(B,t)||at(t))&&un(n,(function(n,r){return Er(t,r,n)}),(function(){return at(t)}))};var Er=function(n,r,t,u){return un(u?t:kr(t,n,r),(function(u,e){return J(Lr(n,r,e,u),(function(n){t[e]=n;return true}),(function(){return false}))}),(function(){return at(n,r)}))};var Lr=function(n,t,u,e){return r?J(bn(bn(B,n),u),(function(r){return Ln(e)!=r[f]?at(n,t,u,e,r[v]):e}),(function(){return at(n,t,u,e)})):I(Ln(e))?at(n,t,u,e):e};var Or=function(n,r){return un(r?n:xr(n),(function(r,t){return J(jr(t,r),(function(r){n[t]=r;return true}),(function(){return false}))}),(function(){return ot()}))};var jr=function(n,r){return t?J(bn(Q,n),(function(t){return Ln(r)!=t[f]?ot(n,r,t[v]):r}),(function(){return ot(n,r)})):I(Ln(r))?ot(n,r):r};var kr=function(n,r,t){J(bn(K,r),(function(u){var e=u[0],i=u[1];_n(e,(function(r,t){if(!Y(n,t)){n[t]=r}}));_n(i,(function(u){if(!Y(n,u)){at(r,t,u)}}))}));return n};var xr=function(n){if(t){_n(U,(function(r,t){if(!Y(n,t)){n[t]=r}}));_n(rn,(function(r){if(!Y(n,r)){ot(r)}}))}return n};var Nr=function(n){return mn(B,n,(function(n,r,t){var u=pn();var e=kn();mn(Sn(B,r,pn),t,(function(n,r,t){Tn(n,r,t);J(t[v],(function(n){return Tn(u,r,n)}),(function(){return xn(e,r)}))}));Tn(K,r,[u,e])}),(function(n,r){Tn(B,r);Tn(K,r)}))};var Fr=function(n){return mn(Q,n,(function(n,r,t){Tn(Q,r,t);J(t[v],(function(n){return Tn(U,r,n)}),(function(){return xn(rn,r)}))}),(function(n,r){Tn(Q,r);Tn(U,r);hn(rn,r)}))};var Mr=function(n){return tn(n)?au():Wt(n)};var Pr=function(n){var r=n[0],t=n[1];(tn(r)?au:Wt)(r);(tn(t)?cu:Ut)(t)};var Dr=function(n){return mn(En,n,(function(n,r,t){return zr(r,t)}),(function(n,r){return Ur(r)}))};var zr=function(n,r){return mn(Sn(En,n,(function(){nt(n,1);Tn(en,n,Fn());Tn(sn,n,pn());return pn()})),r,(function(r,t,u){return Gr(n,r,t,u)}),(function(r,t){return Xr(n,r,t)}))};var Gr=function(n,r,t,u,e){return mn(Sn(r,t,(function(){rt(n,t,1);return pn()})),u,(function(r,u,e){return Hr(n,t,r,u,e)}),(function(u,i){return Yr(n,r,t,u,i,e)}))};var Hr=function(n,r,t,u,e){if(!cn(t,u)){tt(n,r,u,1)}var i=bn(t,u);if(e!==i){ut(n,r,u,i,e);Tn(t,u,e)}};var Wr=function(n,r,t,u,e){return J(bn(r,t),(function(r){return Hr(n,t,r,u,e)}),(function(){var i;return Gr(n,r,t,kr((i={},i[u]=e,i),n,t))}))};var $r=function(n){return tn(n)?cu():Ut(n)};var qr=function(n){return mn(Nn,n,(function(n,r,t){return Br(r,t)}),(function(n,r){return Zr(r)}))};var Br=function(n,r){if(!cn(Nn,n)){et(n,1)}var t=bn(Nn,n);if(r!==t){it(n,t,r);Tn(Nn,n,r)}};var Kr=function(n,r){var t=bn(en,n)[0];var u;do{u=t(r)}while(cn(bn(En,n),u));return u};var Qr=function(n){var r;return(r=bn(En,n))!==null&&r!==void 0?r:zr(n,{})};var Ur=function(n){return zr(n,{})};var Xr=function(n,r,t){var u=bn(en,n),e=u[1];e(t);Gr(n,r,t,{},true)};var Yr=function(n,r,t,u,e,i){var a;var o=bn((a=bn(K,n))===null||a===void 0?void 0:a[0],e);if(!I(o)&&!i){return Hr(n,t,u,e,o)}var f=function(r){ut(n,t,r,bn(u,r));tt(n,t,r,-1);Tn(u,r)};if(I(o)){f(e)}else{gn(u,f)}if(ln(u)){rt(n,t,-1);if(ln(Tn(r,t))){nt(n,-1);Tn(En,n);Tn(en,n);Tn(sn,n)}}};var Zr=function(n){var r=bn(U,n);if(!I(r)){return Br(n,r)}it(n,bn(Nn,n));et(n,-1);Tn(Nn,n)};var nt=function(n,r){return Qn(d,n,r)};var rt=function(n,r,t){return Qn(Sn(k,n,pn),r,t)&&Tn(R,n,Sn(R,n,(function(){return 0}))+t)};var tt=function(n,r,t,u){var e;var i=bn(sn,n);var a=(e=bn(i,t))!==null&&e!==void 0?e:0;if(a==0&&u==1||a==1&&u==-1){Qn(Sn(V,n,pn),t,u)}Tn(i,t,a!=-u?a+u:null);Qn(Sn(Sn(x,n,pn),r,pn),t,u)};var ut=function(n,r,t,u,e){var i;Sn(Sn(Sn(F,n,pn),r,pn),t,(function(){return[u,0]}))[1]=e;(i=o[3])===null||i===void 0?void 0:i.call(o,n,r,t,e)};var et=function(n,r){return Qn(G,n,r)};var it=function(n,r,t){var u;Sn(W,n,(function(){return[r,0]}))[1]=t;(u=o[4])===null||u===void 0?void 0:u.call(o,n,t)};var at=function(n,r,t,u,e){H(Sn(Sn(Sn($,n,pn),r,pn),t,(function(){return[]})),u);return e};var ot=function(n,r,t){H(Sn(q,n,(function(){return[]})),r);return t};var ft=function(n,r,t){return J(bn(bn(bn(F,n),r),t),(function(n){var r=n[0],t=n[1];return[true,r,t]}),(function(){return __spreadArray([false],zn(Vt(n,r,t)),true)}))};var vt=function(n){return J(bn(W,n),(function(n){var r=n[0],t=n[1];return[true,r,t]}),(function(){return __spreadArray([false],zn(Jt(n)),true)}))};var ct=function(n){return!ln($)&&!ln(cr[n])?_n(n?Jn($):$,(function(r,t){return _n(r,(function(r,u){return _n(r,(function(r,e){return Tr(cr[n],[t,u,e],r)}))}))})):0};var lt=function(n){return!ln(q)&&!ln(lr[n])?_n(n?Rn(q):q,(function(r,t){return Tr(lr[n],[t],r)})):0};var st=function(n,r,t,u){if(!ln(n)){Tr(r,u,(function(){return An(n)}));gn(n,(function(n,r){return Tr(t,__spreadArray(__spreadArray([],u!==null&&u!==void 0?u:[],true),[n],false),r==1)}));return 1}};var dt=function(n){var r=Et();if(r!=u){Tr(Mn[n],void 0,r)}var t=ln(er[n]);var e=ln(or[n])&&ln(fr[n])&&ln(ur[n])&&ln(ir[n])&&ln(nr[n])&&ln(rr[n])&&ln(tr[n])&&t&&ln(Xn[n])&&ln(Yn[n]);var i=ln(vr[n])&&ln(ar[n])&&ln(Zn[n])&&ln(qn[n]);if(!e||!i){var a=n?[Rn(d),In(V),Rn(R),In(k),Jn(x),Jn(F)]:[d,V,R,k,x,F];if(!e){st(a[0],Xn[n],Yn[n]);_n(a[1],(function(r,t){return st(r,nr[n],rr[n],[t])}));_n(a[2],(function(r,t){if(r!=0){Tr(tr[n],[t],Tt(t))}}));var o=kn();_n(a[3],(function(r,u){if(st(r,ur[n],ir[n],[u])&&!t){Tr(er[n],[u,null]);xn(o,u)}}));if(!t){_n(a[5],(function(r,t){if(!cn(o,t)){var u=kn();_n(r,(function(n){return _n(n,(function(r,t){var e=r[0],i=r[1];return i!==e?xn(u,t):hn(n,t)}))}));_n(u,(function(r){return Tr(er[n],[t,r])}))}}))}_n(a[4],(function(r,t){return _n(r,(function(r,u){return st(r,or[n],fr[n],[t,u])}))}))}if(!i){var f;_n(a[5],(function(r,t){var u;_n(r,(function(r,e){var i;_n(r,(function(r,a){var o=r[0],v=r[1];if(v!==o){Tr(vr[n],[t,e,a],v,o,ft);f=u=i=1}}));if(i){Tr(ar[n],[t,e],ft)}}));if(u){Tr(Zn[n],[t],ft)}}));if(f){Tr(qn[n],void 0,ft)}}}};var _t=function(n){var r=xt();if(r!=e){Tr(sr[n],void 0,r)}var t=ln(_r[n])&&ln(hr[n]);var u=ln(pr[n])&&ln(dr[n]);if(!t||!u){var i=n?[Rn(G),Rn(W)]:[G,W];if(!t){st(i[0],_r[n],hr[n])}if(!u){var a;_n(i[1],(function(r,t){var u=r[0],e=r[1];if(e!==u){Tr(pr[n],[t],e,u,vt);a=1}}));if(a){Tr(dr[n],void 0,vt)}}}};var ht=function(n){var r=[];for(var t=1;t<arguments.length;t++){r[t-1]=arguments[t]}hu((function(){return n.apply(void 0,z(r,C))}));return ju};var pt=function(){return[yt(),Rt()]};var yt=function(){return Vn(En)};var bt=function(){return yn(En)};var gt=function(n){return Cn(bn(En,C(n)))};var wt=function(n){return yn(bn(sn,C(n)))};var Tt=function(n){return an(bn(En,C(n)))};var St=function(n){return yn(bn(En,C(n)))};var mt=function(n,r,t,u,e){if(u===void 0){u=0}return z(j(P(wn(bn(En,C(n)),(function(n,t){return[I(r)?t:bn(n,C(r)),t]})),(function(n,r){var u=n[0];var e=r[0];return Dn(u,e)*(t?-1:1)})),u,I(e)?e:u+e),(function(n){var r=n[1];return r}))};var At=function(n,r){return An(bn(bn(En,C(n)),C(r)))};var Ct=function(n,r){return yn(bn(bn(En,C(n)),C(r)))};var Vt=function(n,r,t){return bn(bn(bn(En,C(n)),C(r)),C(t))};var Rt=function(){return An(Nn)};var It=function(){return yn(Nn)};var Jt=function(n){return bn(Nn,C(n))};var Et=function(){return!ln(En)};var Lt=function(n){return cn(En,C(n))};var Ot=function(n,r){return cn(bn(sn,C(n)),C(r))};var jt=function(n,r){return cn(bn(En,C(n)),C(r))};var kt=function(n,r,t){return cn(bn(bn(En,C(n)),C(r)),C(t))};var xt=function(){return!ln(Nn)};var Nt=function(n){return cn(Nn,C(n))};var Ft=function(){return Kn(En)};var Mt=function(){return Kn(Nn)};var Pt=function(){return Kn([En,Nn])};var Dt=function(){return Kn(B)};var zt=function(){return Kn(Q)};var Gt=function(){return Kn([B,Q])};var Ht=function(n){return ht((function(){return Rr(n)?Pr(n):0}))};var Wt=function(n){return ht((function(){return Ir(n)?Dr(n):0}))};var $t=function(n,r){return ht((function(n){return Jr(r,n)?zr(n,r):0}),n)};var qt=function(n,r,t){return ht((function(n,r){return Er(n,r,t)?Gr(n,Qr(n),r,t):0}),n,r)};var Bt=function(n,r,t){if(t===void 0){t=true}return hu((function(){var u=void 0;if(Er(n,u,r)){n=C(n);Gr(n,Qr(n),u=Kr(n,t?1:0),r)}return u}))};var Kt=function(n,r,t){return ht((function(n,r){if(Er(n,r,t,1)){var u=Qr(n);nn(t,(function(t,e){return Wr(n,u,r,e,t)}))}}),n,r)};var Qt=function(n,r,t,u){return ht((function(n,r,t){return J(Lr(n,r,t,L(u)?u(Vt(n,r,t)):u),(function(u){return Wr(n,Qr(n),r,t,u)}))}),n,r,t)};var Ut=function(n){return ht((function(){return Or(n)?qr(n):0}))};var Xt=function(n){return ht((function(){return Or(n,1)?nn(n,(function(n,r){return Br(r,n)})):0}))};var Yt=function(n,r){return ht((function(n){return J(jr(n,L(r)?r(Jt(n)):r),(function(r){return Br(n,r)}))}),n)};var Zt=function(n){return ht((function(){nn(n[0],(function(n,r){return I(n)?ou(r):nn(n,(function(n,t){return I(n)?fu(r,t):nn(n,(function(n,u){return On(ju,r,t,u,n)}))}))}));nn(n[1],(function(n,r){return jn(ju,r,n)}))}))};var nu=function(n){try{Mr(Bn(n))}catch(n){}return ju};var ru=function(n){try{$r(Bn(n))}catch(n){}return ju};var tu=function(n){return ht((function(){try{var r=Bn(n),t=r[0],u=r[1];Mr(t);$r(u)}catch(r){nu(n)}}))};var uu=function(n){return ht((function(){if(r=Ar(n)){Nr(n);if(!ln(En)){var t=yt();au();Wt(t)}}}))};var eu=function(n){return ht((function(){if(t=Cr(n)){var r=Rt();du();cu();t=true;Fr(n);Ut(r)}}))};var iu=function(n,r){return ht((function(){uu(n);eu(r)}))};var au=function(){return ht((function(){return Dr({})}))};var ou=function(n){return ht((function(n){return cn(En,n)?Ur(n):0}),n)};var fu=function(n,r){return ht((function(n,r){return J(bn(En,n),(function(t){return cn(t,r)?Xr(n,t,r):0}))}),n,r)};var vu=function(n,r,t,u){return ht((function(n,r,t){return J(bn(En,n),(function(e){return J(bn(e,r),(function(i){return cn(i,t)?Yr(n,e,r,i,t,u):0}))}))}),n,r,t)};var cu=function(){return ht((function(){return qr({})}))};var lu=function(n){return ht((function(n){return cn(Nn,n)?Zr(n):0}),n)};var su=function(){return ht((function(){Nr({});r=false}))};var du=function(){return ht((function(){Fr({});t=false}))};var _u=function(){return ht((function(){su();du()}))};var hu=function(n,r){if(i!=-1){pu();var t=n();gu(r);return t}};var pu=function(){var n;if(i!=-1){i++}if(i==1){(n=o[0])===null||n===void 0?void 0:n.call(o);Tr(yr)}return ju};var yu=function(){return[An(F,(function(n,r){return bn(d,r)===-1?void 0:An(n,(function(n,t){return bn(bn(k,r),t)===-1?void 0:An(n,(function(n){var r=n[1];return r}),(function(n){return $n(n)}))}),ln,tn)}),ln,tn),An(W,(function(n){var r=n[1];return r}),(function(n){return $n(n)})),1]};var bu=function(){return[!ln(F),!ln(W),Vn(F,Wn,$n),Vn($),An(W,Wn,$n),An(q),An(d),Cn(k),Vn(x),An(G)]};var gu=function(n){var r,t;if(i>0){i--;if(i==0){i=1;ct(1);if(!ln(F)){dt(1)}lt(1);if(!ln(W)){_t(1)}if(n===null||n===void 0?void 0:n(ju)){_n(F,(function(n,r){return _n(n,(function(n,t){return _n(n,(function(n,u){var e=n[0];return On(ju,r,t,u,e)}))}))}));dn(F);_n(W,(function(n,r){var t=n[0];return jn(ju,r,t)}));dn(W)}Tr(br[0],void 0);i=-1;ct(0);if(!ln(F)){dt(0)}lt(0);if(!ln(W)){_t(0)}(r=o[1])===null||r===void 0?void 0:r.call(o);Tr(br[1],void 0);(t=o[2])===null||t===void 0?void 0:t.call(o);i=0;u=Et();e=xt();D([d,V,R,k,x,F,$,G,W,q],dn)}}return ju};var wu=function(n){return _n(En,(function(r,t){return n(t,(function(n){return _n(r,(function(r,t){return n(t,(function(n){return gn(r,n)}))}))}))}))};var Tu=function(n,r){return gn(bn(sn,C(n)),r)};var Su=function(n,r){return _n(bn(En,C(n)),(function(n,t){return r(t,(function(r){return gn(n,r)}))}))};var mu=function(n,r,t){return gn(bn(bn(En,C(n)),C(r)),t)};var Au=function(n){return gn(Nn,n)};var Cu=function(n,r,t,u,e,i,a){var o=mt(n,r,t,u,e);return wr((function(){var a=mt(n,r,t,u,e);if(!M(a,o)){o=a;i(ju,n,r,t,u,e,o)}}),er[a?1:0],[n,r],[bt])};var Vu=function(n){return wr(n,yr)};var Ru=function(n){return wr(n,br[0])};var Iu=function(n){return wr(n,br[1])};var Ju=function(n){mr(n);return ju};var Eu=function(n){Sr(n);return ju};var Lu=function(){return{hasTables:Gn(Mn),tables:Gn(qn),tableIds:Gn(Xn),hasTable:Gn(Yn),table:Gn(Zn),tableCellIds:Gn(nr),hasTableCell:Gn(rr,fn),rowCount:Gn(tr),rowIds:Gn(ur),sortedRowIds:Gn(er),hasRow:Gn(ir,fn),row:Gn(ar,fn),cellIds:Gn(or,fn),hasCell:Gn(fr,vn),cell:Gn(vr,vn),invalidCell:Gn(cr,vn),hasValues:Gn(sr),values:Gn(dr),valueIds:Gn(_r),hasValue:Gn(hr),value:Gn(pr),invalidValue:Gn(lr),transaction:on(yr)+Gn(br)}};var Ou=function(n,r,t,u,e){return o=[n,r,t,u,e]};var ju={getContent:pt,getTables:yt,getTableIds:bt,getTable:gt,getTableCellIds:wt,getRowCount:Tt,getRowIds:St,getSortedRowIds:mt,getRow:At,getCellIds:Ct,getCell:Vt,getValues:Rt,getValueIds:It,getValue:Jt,hasTables:Et,hasTable:Lt,hasTableCell:Ot,hasRow:jt,hasCell:kt,hasValues:xt,hasValue:Nt,getTablesJson:Ft,getValuesJson:Mt,getJson:Pt,getTablesSchemaJson:Dt,getValuesSchemaJson:zt,getSchemaJson:Gt,hasTablesSchema:function(){return r},hasValuesSchema:function(){return t},setContent:Ht,setTables:Wt,setTable:$t,setRow:qt,addRow:Bt,setPartialRow:Kt,setCell:Qt,setValues:Ut,setPartialValues:Xt,setValue:Yt,applyChanges:Zt,setTablesJson:nu,setValuesJson:ru,setJson:tu,setTablesSchema:uu,setValuesSchema:eu,setSchema:iu,delTables:au,delTable:ou,delRow:fu,delCell:vu,delValues:cu,delValue:lu,delTablesSchema:su,delValuesSchema:du,delSchema:_u,transaction:hu,startTransaction:pu,getTransactionChanges:yu,getTransactionLog:bu,finishTransaction:gu,forEachTable:wu,forEachTableCell:Tu,forEachRow:Su,forEachCell:mu,forEachValue:Au,addSortedRowIdsListener:Cu,addStartTransactionListener:Vu,addWillFinishTransactionListener:Ru,addDidFinishTransactionListener:Iu,callListener:Ju,delListener:Eu,getListenerStats:Lu,isMergeable:function(){return false},createStore:Un,addListener:wr,callListeners:Tr,setInternalListeners:Ou};nn((n={},n[s+h]=[0,Mn,[],function(){return[Et()]}],n[h]=[0,qn],n[p]=[0,Xn],n[s+_]=[1,Yn,[bt],function(n){return[Lt.apply(void 0,n)]}],n[_]=[1,Zn,[bt]],n[_+T]=[1,nr,[bt]],n[s+_+w]=[2,rr,[bt,wt],function(n){return[Ot.apply(void 0,n)]}],n[b]=[1,tr,[bt]],n[g]=[1,ur,[bt]],n[s+y]=[2,ir,[bt,St],function(n){return[jt.apply(void 0,n)]}],n[y]=[2,ar,[bt,St]],n[T]=[2,or,[bt,St]],n[s+w]=[3,fr,[bt,St,Ct],function(n){return[kt.apply(void 0,n)]}],n[w]=[3,vr,[bt,St,Ct],function(n){return zn(Vt.apply(void 0,n))}],n.InvalidCell=[3,cr],n[s+m]=[0,sr,[],function(){return[xt()]}],n[m]=[0,dr],n[A]=[0,_r],n[s+S]=[1,hr,[It],function(n){return[Nt.apply(void 0,n)]}],n[S]=[1,pr,[It],function(n){return zn(Jt(n[0]))}],n.InvalidValue=[1,lr],n),(function(n,r){var t=n[0],u=n[1],e=n[2],i=n[3];ju[l+r+c]=function(){var n=[];for(var r=0;r<arguments.length;r++){n[r]=arguments[r]}return wr(n[t],u[n[t+1]?1:0],t>0?j(n,0,t):void 0,e,i)}}));return X(ju)};var Xn=Un();Xn.delTables();Xn.delValues();console.log("[STORE] Data store initialized.");var Yn=function(n,r){try{return JSON.parse(n)}catch(n){return r||null}};var Zn=function(n){var r={};for(var t in n){if(typeof n[t]==="string"||typeof n[t]==="number"||typeof n[t]==="boolean"){r[t]=n[t]}else if(n[t]===null){r["__null__".concat(t)]=""}else if(Array.isArray(n[t])){r["__array__".concat(t)]=JSON.stringify(n[t])}else if(typeof n[t]==="object"){r["__object__".concat(t)]=JSON.stringify(n[t])}}return r};var nr=function(n){var r={};for(var t in n){if(t.startsWith("__null__")){r[t.replace("__null__","")]=null}else if(typeof n[t]==="string"&&t.startsWith("__array__")){r[t.replace("__array__","")]=Yn(n[t])}else if(typeof n[t]==="string"&&t.startsWith("__object__")){r[t.replace("__object__","")]=Yn(n[t])}else{r[t]=n[t]}}return r};var rr=n("S",{store:Xn,subscribe:function(n,r,t,u,e){if(Xn.hasRow(n,r)){e(nr(Xn.getRow(n,r)))}var i=Xn.addRowListener(n,r,(function(){var t=Xn.getRow(n,r);e(nr(t))}));if(!Xn.hasRow(n,r)||u){console.log("[STORE] Loading/reloading",{tableId:n,rowId:r});t().then((function(t){Xn.setRow(n,r,Zn(t))})).catch((function(t){console.error("[STORE] Error getting row",{tableId:n,rowId:r,forceReload:u},t)}))}return i},unsubscribe:function(n){Xn.delListener(n)},getTemplate:function(n,t){return __awaiter(this,arguments,void 0,(function(n,t,u){var e,i;if(u===void 0){u=false}return __generator(this,(function(a){switch(a.label){case 0:if(!u){if(!Xn.hasRow("templates",t)){return[2,null]}e=Xn.getRow("templates",t);return[2,nr(e)]}return[4,r(n,t)];case 1:i=a.sent();console.log("[STORE] Reloading template",i);Xn.setRow("templates",t,Zn(i));return[2,i]}}))}))},updateTemplate:function(n,r){Xn.setRow("templates",n,Zn(r));return r},getEnvelope:function(n,t){return __awaiter(this,arguments,void 0,(function(n,t,u){var e,i;if(u===void 0){u=false}return __generator(this,(function(a){switch(a.label){case 0:if(!u){if(!Xn.hasRow("envelopes",t)){return[2,null]}e=Xn.getRow("envelopes",t);return[2,nr(e)]}return[4,r(n,t)];case 1:i=a.sent();Xn.setRow("envelopes",t,Zn(i));return[2,i]}}))}))},updateEnvelope:function(n,r){Xn.setRow("envelopes",n,Zn(r));return r},getField:function(n,r,t){if(n==="template"){var u=Xn.getRow("templates",r);var e=nr(u);var i=(e.fields||[]).find((function(n){return n.name===t}));var a=(e.roles||[]).map((function(n){return n.name}));var o=a.findIndex((function(n){return n===i.role_name}));return{index:Math.max(o,0),field:i}}else{var u=Xn.getRow("envelopes",r);var f=nr(u);var v=(f.fields||[]).find((function(n){return n.name===t}));var a=(f.recipients||[]).map((function(n){return n.role_name}));var o=a.findIndex((function(n){return n===v.role_name}));return{index:o,field:v}}}})}}}));
|
1
|
+
var __awaiter=this&&this.__awaiter||function(n,r,t,u){function e(n){return n instanceof t?n:new t((function(r){r(n)}))}return new(t||(t=Promise))((function(t,i){function a(n){try{f(u.next(n))}catch(n){i(n)}}function o(n){try{f(u["throw"](n))}catch(n){i(n)}}function f(n){n.done?t(n.value):e(n.value).then(a,o)}f((u=u.apply(n,r||[])).next())}))};var __generator=this&&this.__generator||function(n,r){var t={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},u,e,i,a;return a={next:o(0),throw:o(1),return:o(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function o(n){return function(r){return f([n,r])}}function f(o){if(u)throw new TypeError("Generator is already executing.");while(a&&(a=0,o[0]&&(t=0)),t)try{if(u=1,e&&(i=o[0]&2?e["return"]:o[0]?e["throw"]||((i=e["return"])&&i.call(e),0):e.next)&&!(i=i.call(e,o[1])).done)return i;if(e=0,i)o=[o[0]&2,i.value];switch(o[0]){case 0:case 1:i=o;break;case 4:t.label++;return{value:o[1],done:false};case 5:t.label++;e=o[1];o=[0];continue;case 7:o=t.ops.pop();t.trys.pop();continue;default:if(!(i=t.trys,i=i.length>0&&i[i.length-1])&&(o[0]===6||o[0]===2)){t=0;continue}if(o[0]===3&&(!i||o[1]>i[0]&&o[1]<i[3])){t.label=o[1];break}if(o[0]===6&&t.label<i[1]){t.label=i[1];i=o;break}if(i&&t.label<i[2]){t.label=i[2];t.ops.push(o);break}if(i[2])t.ops.pop();t.trys.pop();continue}o=r.call(n,t)}catch(n){o=[6,n];e=0}finally{u=i=0}if(o[0]&5)throw o[1];return{value:o[0]?o[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(n,r,t){if(t||arguments.length===2)for(var u=0,e=r.length,i;u<e;u++){if(i||!(u in r)){if(!i)i=Array.prototype.slice.call(r,0,u);i[u]=r[u]}}return n.concat(i||Array.prototype.slice.call(r))};System.register(["@verdocs/js-sdk"],(function(n){"use strict";var r;return{setters:[function(n){r=n.getTemplate}],execute:function(){var t=function(n){return typeof n};var u="";var e=t(u);var i=t(true);var a=t(0);var o=t(t);var f="type";var v="default";var c="Listener";var l="add";var s="Has";var d="Ids";var _="Table";var h=_+"s";var p=_+d;var y="Row";var b=y+"Count";var g=y+d;var w="Cell";var T=w+d;var S="Value";var m=S+"s";var A=S+d;var C=function(n){return u+n};var V=isFinite;var R=function(n,r){return n instanceof r};var I=function(n){return n==void 0};var J=function(n,r,t){return I(n)?t===null||t===void 0?void 0:t():r(n)};var E=function(n){return n==e||n==i};var L=function(n){return t(n)==o};var O=function(n){return Array.isArray(n)};var j=function(n,r,t){return n.slice(r,t)};var k=function(n){return n.length};var x=function(n,r){return n.test(r)};var N=function(n,r){return n.includes(r)};var F=function(n,r){return n.every(r)};var M=function(n,r){return k(n)===k(r)&&F(n,(function(n,t){return r[t]===n}))};var P=function(n,r){return n.sort(r)};var D=function(n,r){return n.forEach(r)};var z=function(n,r){return n.map(r)};var G=function(n,r,t){return n.reduce(r,t)};var H=function(n){var r=[];for(var t=1;t<arguments.length;t++){r[t-1]=arguments[t]}return n.push.apply(n,r)};var W=function(n){return n.shift()};var $=Object;var q=function(n){return $.getPrototypeOf(n)};var B=$.entries;var K=$.isFrozen;var Q=function(n){return!I(n)&&J(q(n),(function(n){return n==$.prototype||I(q(n))}),(function(){return true}))};var U=$.keys;var X=$.freeze;var Y=function(n,r){return r in n};var Z=function(n,r){delete n[r];return n};var nn=function(n,r){return z(B(n),(function(n){var t=n[0],u=n[1];return r(u,t)}))};var rn=function(n){return k(U(n))};var tn=function(n){return Q(n)&&rn(n)==0};var un=function(n,r,t,u){if(u===void 0){u=0}if(I(n)||!Q(n)||!u&&tn(n)||K(n)){t===null||t===void 0?void 0:t();return false}nn(n,(function(t,u){if(!r(t,u)){Z(n,u)}}));return u?true:!tn(n)};var en=function(n){return function(r){return G(sn(r),(function(r,t){return r+n(t)}),0)}};var an=function(n){var r;return(r=n===null||n===void 0?void 0:n.size)!==null&&r!==void 0?r:0};var on=en(an);var fn=en(on);var vn=en(fn);var cn=function(n,r){var t;return(t=n===null||n===void 0?void 0:n.has(r))!==null&&t!==void 0?t:false};var ln=function(n){return I(n)||an(n)==0};var sn=function(n){var r;return __spreadArray([],(r=n===null||n===void 0?void 0:n.values())!==null&&r!==void 0?r:[],true)};var dn=function(n){return n.clear()};var _n=function(n,r){return n===null||n===void 0?void 0:n.forEach(r)};var hn=function(n,r){return n===null||n===void 0?void 0:n.delete(r)};var pn=function(n){return new Map(n)};var yn=function(n){var r;return __spreadArray([],(r=n===null||n===void 0?void 0:n.keys())!==null&&r!==void 0?r:[],true)};var bn=function(n,r){return n===null||n===void 0?void 0:n.get(r)};var gn=function(n,r){return _n(n,(function(n,t){return r(t,n)}))};var wn=function(n,r){var t;return z(__spreadArray([],(t=n===null||n===void 0?void 0:n.entries())!==null&&t!==void 0?t:[],true),(function(n){var t=n[0],u=n[1];return r(u,t)}))};var Tn=function(n,r,t){return I(t)?(hn(n,r),n):n===null||n===void 0?void 0:n.set(r,t)};var Sn=function(n,r,t,u){if(!cn(n,r)){Tn(n,r,t())}else{u===null||u===void 0?void 0:u(bn(n,r))}return bn(n,r)};var mn=function(n,r,t,u){if(u===void 0){u=Tn}nn(r,(function(r,u){return t(n,u,r)}));gn(n,(function(t){return Y(r,t)?0:u(n,t)}));return n};var An=function(n,r,t,u){var e={};_n(n,(function(n,i){if(!(t===null||t===void 0?void 0:t(n,i))){var a=r?r(n,i):n;if(!(u===null||u===void 0?void 0:u(a))){e[i]=a}}}));return e};var Cn=function(n,r,t){return An(n,(function(n){return An(n,r,t)}),ln,tn)};var Vn=function(n,r,t){return An(n,(function(n){return Cn(n,r,t)}),ln,tn)};var Rn=function(n,r){var t=pn();_n(n,(function(n,u){var e;return t.set(u,(e=r===null||r===void 0?void 0:r(n))!==null&&e!==void 0?e:n)}));return t};var In=function(n){return Rn(n,Rn)};var Jn=function(n){return Rn(n,In)};var En=function(n,r,t,u,e){if(e===void 0){e=0}return J((t?Sn:bn)(n,r[e],e>k(r)-2?t:pn),(function(i){if(e>k(r)-2){if(u===null||u===void 0?void 0:u(i)){Tn(n,r[e])}return i}var a=En(i,r,t,u,e+1);if(ln(i)){Tn(n,r[e])}return a}))};var Ln=function(n){var r=t(n);return E(r)||r==a&&V(n)?r:void 0};var On=function(n,r,t,u,e){return I(e)?n.delCell(r,t,u,true):n.setCell(r,t,u,e)};var jn=function(n,r,t){return I(t)?n.delValue(r):n.setValue(r,t)};var kn=function(n){return new Set(O(n)||I(n)?n:[n])};var xn=function(n,r){return n===null||n===void 0?void 0:n.add(r)};var Nn=/^\d+$/;var Fn=function(){var n=[];var r=0;return[function(t){var e;return(e=t?W(n):null)!==null&&e!==void 0?e:u+r++},function(r){if(x(Nn,r)&&k(n)<1e3){H(n,r)}}]};var Mn=function(n,r){if(r===void 0){r=[u]}var t=[];var e=function(n,u){return u==k(r)?H(t,n):r[u]===null?_n(n,(function(n){return e(n,u+1)})):D([r[u],null],(function(r){return e(bn(n,r),u+1)}))};e(n,0);return t};var Pn=function(n){var r;var t=Fn(),e=t[0],i=t[1];var a=pn();var o=function(t,i,o,f,v){if(f===void 0){f=[]}if(v===void 0){v=function(){return[]}}r!==null&&r!==void 0?r:r=n();var c=e(1);Tn(a,c,[t,i,o,f,v]);xn(En(i,o!==null&&o!==void 0?o:[u],kn),c);return c};var f=function(n,t){var u=[];for(var e=2;e<arguments.length;e++){u[e-2]=arguments[e]}return D(Mn(n,t),(function(n){return _n(n,(function(n){var e;return(e=bn(a,n))[0].apply(e,__spreadArray(__spreadArray([r],t!==null&&t!==void 0?t:[],false),u,false))}))}))};var v=function(n){return J(bn(a,n),(function(r){var t=r[1],e=r[2];En(t,e!==null&&e!==void 0?e:[u],void 0,(function(r){hn(r,n);return ln(r)?1:0}));Tn(a,n);i(n);return e}))};var c=function(n){return J(bn(a,n),(function(n){var t=n[0],u=n[2],e=u===void 0?[]:u,i=n[3],a=n[4];var o=function(){var n,u;var f=[];for(var v=0;v<arguments.length;v++){f[v]=arguments[v]}var c=k(f);if(c==k(e)){t.apply(void 0,__spreadArray(__spreadArray([r],f,false),a(f),false))}else if(I(e[c])){D((u=(n=i[c])===null||n===void 0?void 0:n.call.apply(n,__spreadArray([i],f,false)))!==null&&u!==void 0?u:[],(function(n){return o.apply(void 0,__spreadArray(__spreadArray([],f,false),[n],false))}))}else{o.apply(void 0,__spreadArray(__spreadArray([],f,false),[e[c]],false))}};o()}))};return[o,f,v,c]};var Dn=function(n,r){return(n!==null&&n!==void 0?n:0)<(r!==null&&r!==void 0?r:0)?-1:1};var zn=function(n){return[n,n]};var Gn=function(n,r){if(r===void 0){r=on}return r(n[0])+r(n[1])};var Hn=function(){return[pn(),pn()]};var Wn=function(n){return __spreadArray([],n,true)};var $n=function(n){var r=n[0],t=n[1];return r===t};var qn=JSON.stringify;var Bn=JSON.parse;var Kn=function(n){return qn(n,(function(n,r){return R(r,Map)?$.fromEntries(__spreadArray([],r,true)):r}))};var Qn=function(n,r,t){return Tn(n,r,bn(n,r)==-t?void 0:t)};var Un=function(){var n;var r;var t;var u=false;var e=false;var i=0;var o=[];var d=pn();var V=pn();var R=pn();var k=pn();var x=pn();var F=pn();var G=pn();var W=pn();var $=pn();var q=pn();var B=pn();var K=pn();var Q=pn();var U=pn();var rn=kn();var en=pn();var sn=pn();var En=pn();var Nn=pn();var Mn=Hn();var qn=Hn();var Xn=Hn();var Yn=Hn();var Zn=Hn();var nr=Hn();var rr=Hn();var tr=Hn();var ur=Hn();var er=Hn();var ir=Hn();var ar=Hn();var or=Hn();var fr=Hn();var vr=Hn();var cr=Hn();var lr=Hn();var sr=Hn();var dr=Hn();var _r=Hn();var hr=Hn();var pr=Hn();var yr=pn();var br=Hn();var gr=Pn((function(){return ju})),wr=gr[0],Tr=gr[1],Sr=gr[2],mr=gr[3];var Ar=function(n){return un(n,(function(n){return un(n,Vr)}))};var Cr=function(n){return un(n,Vr)};var Vr=function(n){if(!un(n,(function(n,r){return N([f,v],r)}))){return false}var r=n[f];if(!E(r)&&r!=a){return false}if(Ln(n[v])!=r){Z(n,v)}return true};var Rr=O;var Ir=function(n){return un(n,Jr,at)};var Jr=function(n,t){return(!r||cn(B,t)||at(t))&&un(n,(function(n,r){return Er(t,r,n)}),(function(){return at(t)}))};var Er=function(n,r,t,u){return un(u?t:kr(t,n,r),(function(u,e){return J(Lr(n,r,e,u),(function(n){t[e]=n;return true}),(function(){return false}))}),(function(){return at(n,r)}))};var Lr=function(n,t,u,e){return r?J(bn(bn(B,n),u),(function(r){return Ln(e)!=r[f]?at(n,t,u,e,r[v]):e}),(function(){return at(n,t,u,e)})):I(Ln(e))?at(n,t,u,e):e};var Or=function(n,r){return un(r?n:xr(n),(function(r,t){return J(jr(t,r),(function(r){n[t]=r;return true}),(function(){return false}))}),(function(){return ot()}))};var jr=function(n,r){return t?J(bn(Q,n),(function(t){return Ln(r)!=t[f]?ot(n,r,t[v]):r}),(function(){return ot(n,r)})):I(Ln(r))?ot(n,r):r};var kr=function(n,r,t){J(bn(K,r),(function(u){var e=u[0],i=u[1];_n(e,(function(r,t){if(!Y(n,t)){n[t]=r}}));_n(i,(function(u){if(!Y(n,u)){at(r,t,u)}}))}));return n};var xr=function(n){if(t){_n(U,(function(r,t){if(!Y(n,t)){n[t]=r}}));_n(rn,(function(r){if(!Y(n,r)){ot(r)}}))}return n};var Nr=function(n){return mn(B,n,(function(n,r,t){var u=pn();var e=kn();mn(Sn(B,r,pn),t,(function(n,r,t){Tn(n,r,t);J(t[v],(function(n){return Tn(u,r,n)}),(function(){return xn(e,r)}))}));Tn(K,r,[u,e])}),(function(n,r){Tn(B,r);Tn(K,r)}))};var Fr=function(n){return mn(Q,n,(function(n,r,t){Tn(Q,r,t);J(t[v],(function(n){return Tn(U,r,n)}),(function(){return xn(rn,r)}))}),(function(n,r){Tn(Q,r);Tn(U,r);hn(rn,r)}))};var Mr=function(n){return tn(n)?au():Wt(n)};var Pr=function(n){var r=n[0],t=n[1];(tn(r)?au:Wt)(r);(tn(t)?cu:Ut)(t)};var Dr=function(n){return mn(En,n,(function(n,r,t){return zr(r,t)}),(function(n,r){return Ur(r)}))};var zr=function(n,r){return mn(Sn(En,n,(function(){nt(n,1);Tn(en,n,Fn());Tn(sn,n,pn());return pn()})),r,(function(r,t,u){return Gr(n,r,t,u)}),(function(r,t){return Xr(n,r,t)}))};var Gr=function(n,r,t,u,e){return mn(Sn(r,t,(function(){rt(n,t,1);return pn()})),u,(function(r,u,e){return Hr(n,t,r,u,e)}),(function(u,i){return Yr(n,r,t,u,i,e)}))};var Hr=function(n,r,t,u,e){if(!cn(t,u)){tt(n,r,u,1)}var i=bn(t,u);if(e!==i){ut(n,r,u,i,e);Tn(t,u,e)}};var Wr=function(n,r,t,u,e){return J(bn(r,t),(function(r){return Hr(n,t,r,u,e)}),(function(){var i;return Gr(n,r,t,kr((i={},i[u]=e,i),n,t))}))};var $r=function(n){return tn(n)?cu():Ut(n)};var qr=function(n){return mn(Nn,n,(function(n,r,t){return Br(r,t)}),(function(n,r){return Zr(r)}))};var Br=function(n,r){if(!cn(Nn,n)){et(n,1)}var t=bn(Nn,n);if(r!==t){it(n,t,r);Tn(Nn,n,r)}};var Kr=function(n,r){var t=bn(en,n)[0];var u;do{u=t(r)}while(cn(bn(En,n),u));return u};var Qr=function(n){var r;return(r=bn(En,n))!==null&&r!==void 0?r:zr(n,{})};var Ur=function(n){return zr(n,{})};var Xr=function(n,r,t){var u=bn(en,n),e=u[1];e(t);Gr(n,r,t,{},true)};var Yr=function(n,r,t,u,e,i){var a;var o=bn((a=bn(K,n))===null||a===void 0?void 0:a[0],e);if(!I(o)&&!i){return Hr(n,t,u,e,o)}var f=function(r){ut(n,t,r,bn(u,r));tt(n,t,r,-1);Tn(u,r)};if(I(o)){f(e)}else{gn(u,f)}if(ln(u)){rt(n,t,-1);if(ln(Tn(r,t))){nt(n,-1);Tn(En,n);Tn(en,n);Tn(sn,n)}}};var Zr=function(n){var r=bn(U,n);if(!I(r)){return Br(n,r)}it(n,bn(Nn,n));et(n,-1);Tn(Nn,n)};var nt=function(n,r){return Qn(d,n,r)};var rt=function(n,r,t){return Qn(Sn(k,n,pn),r,t)&&Tn(R,n,Sn(R,n,(function(){return 0}))+t)};var tt=function(n,r,t,u){var e;var i=bn(sn,n);var a=(e=bn(i,t))!==null&&e!==void 0?e:0;if(a==0&&u==1||a==1&&u==-1){Qn(Sn(V,n,pn),t,u)}Tn(i,t,a!=-u?a+u:null);Qn(Sn(Sn(x,n,pn),r,pn),t,u)};var ut=function(n,r,t,u,e){var i;Sn(Sn(Sn(F,n,pn),r,pn),t,(function(){return[u,0]}))[1]=e;(i=o[3])===null||i===void 0?void 0:i.call(o,n,r,t,e)};var et=function(n,r){return Qn(G,n,r)};var it=function(n,r,t){var u;Sn(W,n,(function(){return[r,0]}))[1]=t;(u=o[4])===null||u===void 0?void 0:u.call(o,n,t)};var at=function(n,r,t,u,e){H(Sn(Sn(Sn($,n,pn),r,pn),t,(function(){return[]})),u);return e};var ot=function(n,r,t){H(Sn(q,n,(function(){return[]})),r);return t};var ft=function(n,r,t){return J(bn(bn(bn(F,n),r),t),(function(n){var r=n[0],t=n[1];return[true,r,t]}),(function(){return __spreadArray([false],zn(Vt(n,r,t)),true)}))};var vt=function(n){return J(bn(W,n),(function(n){var r=n[0],t=n[1];return[true,r,t]}),(function(){return __spreadArray([false],zn(Jt(n)),true)}))};var ct=function(n){return!ln($)&&!ln(cr[n])?_n(n?Jn($):$,(function(r,t){return _n(r,(function(r,u){return _n(r,(function(r,e){return Tr(cr[n],[t,u,e],r)}))}))})):0};var lt=function(n){return!ln(q)&&!ln(lr[n])?_n(n?Rn(q):q,(function(r,t){return Tr(lr[n],[t],r)})):0};var st=function(n,r,t,u){if(!ln(n)){Tr(r,u,(function(){return An(n)}));gn(n,(function(n,r){return Tr(t,__spreadArray(__spreadArray([],u!==null&&u!==void 0?u:[],true),[n],false),r==1)}));return 1}};var dt=function(n){var r=Et();if(r!=u){Tr(Mn[n],void 0,r)}var t=ln(er[n]);var e=ln(or[n])&&ln(fr[n])&&ln(ur[n])&&ln(ir[n])&&ln(nr[n])&&ln(rr[n])&&ln(tr[n])&&t&&ln(Xn[n])&&ln(Yn[n]);var i=ln(vr[n])&&ln(ar[n])&&ln(Zn[n])&&ln(qn[n]);if(!e||!i){var a=n?[Rn(d),In(V),Rn(R),In(k),Jn(x),Jn(F)]:[d,V,R,k,x,F];if(!e){st(a[0],Xn[n],Yn[n]);_n(a[1],(function(r,t){return st(r,nr[n],rr[n],[t])}));_n(a[2],(function(r,t){if(r!=0){Tr(tr[n],[t],Tt(t))}}));var o=kn();_n(a[3],(function(r,u){if(st(r,ur[n],ir[n],[u])&&!t){Tr(er[n],[u,null]);xn(o,u)}}));if(!t){_n(a[5],(function(r,t){if(!cn(o,t)){var u=kn();_n(r,(function(n){return _n(n,(function(r,t){var e=r[0],i=r[1];return i!==e?xn(u,t):hn(n,t)}))}));_n(u,(function(r){return Tr(er[n],[t,r])}))}}))}_n(a[4],(function(r,t){return _n(r,(function(r,u){return st(r,or[n],fr[n],[t,u])}))}))}if(!i){var f;_n(a[5],(function(r,t){var u;_n(r,(function(r,e){var i;_n(r,(function(r,a){var o=r[0],v=r[1];if(v!==o){Tr(vr[n],[t,e,a],v,o,ft);f=u=i=1}}));if(i){Tr(ar[n],[t,e],ft)}}));if(u){Tr(Zn[n],[t],ft)}}));if(f){Tr(qn[n],void 0,ft)}}}};var _t=function(n){var r=xt();if(r!=e){Tr(sr[n],void 0,r)}var t=ln(_r[n])&&ln(hr[n]);var u=ln(pr[n])&&ln(dr[n]);if(!t||!u){var i=n?[Rn(G),Rn(W)]:[G,W];if(!t){st(i[0],_r[n],hr[n])}if(!u){var a;_n(i[1],(function(r,t){var u=r[0],e=r[1];if(e!==u){Tr(pr[n],[t],e,u,vt);a=1}}));if(a){Tr(dr[n],void 0,vt)}}}};var ht=function(n){var r=[];for(var t=1;t<arguments.length;t++){r[t-1]=arguments[t]}hu((function(){return n.apply(void 0,z(r,C))}));return ju};var pt=function(){return[yt(),Rt()]};var yt=function(){return Vn(En)};var bt=function(){return yn(En)};var gt=function(n){return Cn(bn(En,C(n)))};var wt=function(n){return yn(bn(sn,C(n)))};var Tt=function(n){return an(bn(En,C(n)))};var St=function(n){return yn(bn(En,C(n)))};var mt=function(n,r,t,u,e){if(u===void 0){u=0}return z(j(P(wn(bn(En,C(n)),(function(n,t){return[I(r)?t:bn(n,C(r)),t]})),(function(n,r){var u=n[0];var e=r[0];return Dn(u,e)*(t?-1:1)})),u,I(e)?e:u+e),(function(n){var r=n[1];return r}))};var At=function(n,r){return An(bn(bn(En,C(n)),C(r)))};var Ct=function(n,r){return yn(bn(bn(En,C(n)),C(r)))};var Vt=function(n,r,t){return bn(bn(bn(En,C(n)),C(r)),C(t))};var Rt=function(){return An(Nn)};var It=function(){return yn(Nn)};var Jt=function(n){return bn(Nn,C(n))};var Et=function(){return!ln(En)};var Lt=function(n){return cn(En,C(n))};var Ot=function(n,r){return cn(bn(sn,C(n)),C(r))};var jt=function(n,r){return cn(bn(En,C(n)),C(r))};var kt=function(n,r,t){return cn(bn(bn(En,C(n)),C(r)),C(t))};var xt=function(){return!ln(Nn)};var Nt=function(n){return cn(Nn,C(n))};var Ft=function(){return Kn(En)};var Mt=function(){return Kn(Nn)};var Pt=function(){return Kn([En,Nn])};var Dt=function(){return Kn(B)};var zt=function(){return Kn(Q)};var Gt=function(){return Kn([B,Q])};var Ht=function(n){return ht((function(){return Rr(n)?Pr(n):0}))};var Wt=function(n){return ht((function(){return Ir(n)?Dr(n):0}))};var $t=function(n,r){return ht((function(n){return Jr(r,n)?zr(n,r):0}),n)};var qt=function(n,r,t){return ht((function(n,r){return Er(n,r,t)?Gr(n,Qr(n),r,t):0}),n,r)};var Bt=function(n,r,t){if(t===void 0){t=true}return hu((function(){var u=void 0;if(Er(n,u,r)){n=C(n);Gr(n,Qr(n),u=Kr(n,t?1:0),r)}return u}))};var Kt=function(n,r,t){return ht((function(n,r){if(Er(n,r,t,1)){var u=Qr(n);nn(t,(function(t,e){return Wr(n,u,r,e,t)}))}}),n,r)};var Qt=function(n,r,t,u){return ht((function(n,r,t){return J(Lr(n,r,t,L(u)?u(Vt(n,r,t)):u),(function(u){return Wr(n,Qr(n),r,t,u)}))}),n,r,t)};var Ut=function(n){return ht((function(){return Or(n)?qr(n):0}))};var Xt=function(n){return ht((function(){return Or(n,1)?nn(n,(function(n,r){return Br(r,n)})):0}))};var Yt=function(n,r){return ht((function(n){return J(jr(n,L(r)?r(Jt(n)):r),(function(r){return Br(n,r)}))}),n)};var Zt=function(n){return ht((function(){nn(n[0],(function(n,r){return I(n)?ou(r):nn(n,(function(n,t){return I(n)?fu(r,t):nn(n,(function(n,u){return On(ju,r,t,u,n)}))}))}));nn(n[1],(function(n,r){return jn(ju,r,n)}))}))};var nu=function(n){try{Mr(Bn(n))}catch(n){}return ju};var ru=function(n){try{$r(Bn(n))}catch(n){}return ju};var tu=function(n){return ht((function(){try{var r=Bn(n),t=r[0],u=r[1];Mr(t);$r(u)}catch(r){nu(n)}}))};var uu=function(n){return ht((function(){if(r=Ar(n)){Nr(n);if(!ln(En)){var t=yt();au();Wt(t)}}}))};var eu=function(n){return ht((function(){if(t=Cr(n)){var r=Rt();du();cu();t=true;Fr(n);Ut(r)}}))};var iu=function(n,r){return ht((function(){uu(n);eu(r)}))};var au=function(){return ht((function(){return Dr({})}))};var ou=function(n){return ht((function(n){return cn(En,n)?Ur(n):0}),n)};var fu=function(n,r){return ht((function(n,r){return J(bn(En,n),(function(t){return cn(t,r)?Xr(n,t,r):0}))}),n,r)};var vu=function(n,r,t,u){return ht((function(n,r,t){return J(bn(En,n),(function(e){return J(bn(e,r),(function(i){return cn(i,t)?Yr(n,e,r,i,t,u):0}))}))}),n,r,t)};var cu=function(){return ht((function(){return qr({})}))};var lu=function(n){return ht((function(n){return cn(Nn,n)?Zr(n):0}),n)};var su=function(){return ht((function(){Nr({});r=false}))};var du=function(){return ht((function(){Fr({});t=false}))};var _u=function(){return ht((function(){su();du()}))};var hu=function(n,r){if(i!=-1){pu();var t=n();gu(r);return t}};var pu=function(){var n;if(i!=-1){i++}if(i==1){(n=o[0])===null||n===void 0?void 0:n.call(o);Tr(yr)}return ju};var yu=function(){return[An(F,(function(n,r){return bn(d,r)===-1?void 0:An(n,(function(n,t){return bn(bn(k,r),t)===-1?void 0:An(n,(function(n){var r=n[1];return r}),(function(n){return $n(n)}))}),ln,tn)}),ln,tn),An(W,(function(n){var r=n[1];return r}),(function(n){return $n(n)})),1]};var bu=function(){return[!ln(F),!ln(W),Vn(F,Wn,$n),Vn($),An(W,Wn,$n),An(q),An(d),Cn(k),Vn(x),An(G)]};var gu=function(n){var r,t;if(i>0){i--;if(i==0){i=1;ct(1);if(!ln(F)){dt(1)}lt(1);if(!ln(W)){_t(1)}if(n===null||n===void 0?void 0:n(ju)){_n(F,(function(n,r){return _n(n,(function(n,t){return _n(n,(function(n,u){var e=n[0];return On(ju,r,t,u,e)}))}))}));dn(F);_n(W,(function(n,r){var t=n[0];return jn(ju,r,t)}));dn(W)}Tr(br[0],void 0);i=-1;ct(0);if(!ln(F)){dt(0)}lt(0);if(!ln(W)){_t(0)}(r=o[1])===null||r===void 0?void 0:r.call(o);Tr(br[1],void 0);(t=o[2])===null||t===void 0?void 0:t.call(o);i=0;u=Et();e=xt();D([d,V,R,k,x,F,$,G,W,q],dn)}}return ju};var wu=function(n){return _n(En,(function(r,t){return n(t,(function(n){return _n(r,(function(r,t){return n(t,(function(n){return gn(r,n)}))}))}))}))};var Tu=function(n,r){return gn(bn(sn,C(n)),r)};var Su=function(n,r){return _n(bn(En,C(n)),(function(n,t){return r(t,(function(r){return gn(n,r)}))}))};var mu=function(n,r,t){return gn(bn(bn(En,C(n)),C(r)),t)};var Au=function(n){return gn(Nn,n)};var Cu=function(n,r,t,u,e,i,a){var o=mt(n,r,t,u,e);return wr((function(){var a=mt(n,r,t,u,e);if(!M(a,o)){o=a;i(ju,n,r,t,u,e,o)}}),er[a?1:0],[n,r],[bt])};var Vu=function(n){return wr(n,yr)};var Ru=function(n){return wr(n,br[0])};var Iu=function(n){return wr(n,br[1])};var Ju=function(n){mr(n);return ju};var Eu=function(n){Sr(n);return ju};var Lu=function(){return{hasTables:Gn(Mn),tables:Gn(qn),tableIds:Gn(Xn),hasTable:Gn(Yn),table:Gn(Zn),tableCellIds:Gn(nr),hasTableCell:Gn(rr,fn),rowCount:Gn(tr),rowIds:Gn(ur),sortedRowIds:Gn(er),hasRow:Gn(ir,fn),row:Gn(ar,fn),cellIds:Gn(or,fn),hasCell:Gn(fr,vn),cell:Gn(vr,vn),invalidCell:Gn(cr,vn),hasValues:Gn(sr),values:Gn(dr),valueIds:Gn(_r),hasValue:Gn(hr),value:Gn(pr),invalidValue:Gn(lr),transaction:on(yr)+Gn(br)}};var Ou=function(n,r,t,u,e){return o=[n,r,t,u,e]};var ju={getContent:pt,getTables:yt,getTableIds:bt,getTable:gt,getTableCellIds:wt,getRowCount:Tt,getRowIds:St,getSortedRowIds:mt,getRow:At,getCellIds:Ct,getCell:Vt,getValues:Rt,getValueIds:It,getValue:Jt,hasTables:Et,hasTable:Lt,hasTableCell:Ot,hasRow:jt,hasCell:kt,hasValues:xt,hasValue:Nt,getTablesJson:Ft,getValuesJson:Mt,getJson:Pt,getTablesSchemaJson:Dt,getValuesSchemaJson:zt,getSchemaJson:Gt,hasTablesSchema:function(){return r},hasValuesSchema:function(){return t},setContent:Ht,setTables:Wt,setTable:$t,setRow:qt,addRow:Bt,setPartialRow:Kt,setCell:Qt,setValues:Ut,setPartialValues:Xt,setValue:Yt,applyChanges:Zt,setTablesJson:nu,setValuesJson:ru,setJson:tu,setTablesSchema:uu,setValuesSchema:eu,setSchema:iu,delTables:au,delTable:ou,delRow:fu,delCell:vu,delValues:cu,delValue:lu,delTablesSchema:su,delValuesSchema:du,delSchema:_u,transaction:hu,startTransaction:pu,getTransactionChanges:yu,getTransactionLog:bu,finishTransaction:gu,forEachTable:wu,forEachTableCell:Tu,forEachRow:Su,forEachCell:mu,forEachValue:Au,addSortedRowIdsListener:Cu,addStartTransactionListener:Vu,addWillFinishTransactionListener:Ru,addDidFinishTransactionListener:Iu,callListener:Ju,delListener:Eu,getListenerStats:Lu,isMergeable:function(){return false},createStore:Un,addListener:wr,callListeners:Tr,setInternalListeners:Ou};nn((n={},n[s+h]=[0,Mn,[],function(){return[Et()]}],n[h]=[0,qn],n[p]=[0,Xn],n[s+_]=[1,Yn,[bt],function(n){return[Lt.apply(void 0,n)]}],n[_]=[1,Zn,[bt]],n[_+T]=[1,nr,[bt]],n[s+_+w]=[2,rr,[bt,wt],function(n){return[Ot.apply(void 0,n)]}],n[b]=[1,tr,[bt]],n[g]=[1,ur,[bt]],n[s+y]=[2,ir,[bt,St],function(n){return[jt.apply(void 0,n)]}],n[y]=[2,ar,[bt,St]],n[T]=[2,or,[bt,St]],n[s+w]=[3,fr,[bt,St,Ct],function(n){return[kt.apply(void 0,n)]}],n[w]=[3,vr,[bt,St,Ct],function(n){return zn(Vt.apply(void 0,n))}],n.InvalidCell=[3,cr],n[s+m]=[0,sr,[],function(){return[xt()]}],n[m]=[0,dr],n[A]=[0,_r],n[s+S]=[1,hr,[It],function(n){return[Nt.apply(void 0,n)]}],n[S]=[1,pr,[It],function(n){return zn(Jt(n[0]))}],n.InvalidValue=[1,lr],n),(function(n,r){var t=n[0],u=n[1],e=n[2],i=n[3];ju[l+r+c]=function(){var n=[];for(var r=0;r<arguments.length;r++){n[r]=arguments[r]}return wr(n[t],u[n[t+1]?1:0],t>0?j(n,0,t):void 0,e,i)}}));return X(ju)};var Xn=Un();Xn.delTables();Xn.delValues();console.log("[STORE] Data store initialized.");var Yn=function(n,r){try{return JSON.parse(n)}catch(n){return r||null}};var Zn=function(n){var r={};for(var t in n){if(typeof n[t]==="string"||typeof n[t]==="number"||typeof n[t]==="boolean"){r[t]=n[t]}else if(n[t]===null){r["__null__".concat(t)]=""}else if(Array.isArray(n[t])){r["__array__".concat(t)]=JSON.stringify(n[t])}else if(typeof n[t]==="object"){r["__object__".concat(t)]=JSON.stringify(n[t])}}return r};var nr=function(n){var r={};for(var t in n){if(t.startsWith("__null__")){r[t.replace("__null__","")]=null}else if(typeof n[t]==="string"&&t.startsWith("__array__")){r[t.replace("__array__","")]=Yn(n[t])}else if(typeof n[t]==="string"&&t.startsWith("__object__")){r[t.replace("__object__","")]=Yn(n[t])}else{r[t]=n[t]}}return r};var rr=n("S",{store:Xn,subscribe:function(n,r,t,u,e){if(Xn.hasRow(n,r)){e(nr(Xn.getRow(n,r)))}var i=Xn.addRowListener(n,r,(function(){var t=Xn.getRow(n,r);e(nr(t))}));if(!Xn.hasRow(n,r)||u){console.log("[STORE] Loading/reloading",{tableId:n,rowId:r});t().then((function(t){Xn.setRow(n,r,Zn(t))})).catch((function(t){console.error("[STORE] Error getting row",{tableId:n,rowId:r,forceReload:u},t)}))}return i},unsubscribe:function(n){Xn.delListener(n)},getTemplate:function(n,t){return __awaiter(this,arguments,void 0,(function(n,t,u){var e,i;if(u===void 0){u=false}return __generator(this,(function(a){switch(a.label){case 0:if(!u){if(!Xn.hasRow("templates",t)){return[2,null]}e=Xn.getRow("templates",t);return[2,nr(e)]}return[4,r(n,t)];case 1:i=a.sent();console.log("[STORE] Reloading template",i);Xn.setRow("templates",t,Zn(i));return[2,i]}}))}))},updateTemplate:function(n,r){Xn.setRow("templates",n,Zn(r));return r},getEnvelope:function(n,t){return __awaiter(this,arguments,void 0,(function(n,t,u){var e,i;if(u===void 0){u=false}return __generator(this,(function(a){switch(a.label){case 0:if(!u){if(!Xn.hasRow("envelopes",t)){return[2,null]}e=Xn.getRow("envelopes",t);return[2,nr(e)]}return[4,r(n,t)];case 1:i=a.sent();Xn.setRow("envelopes",t,Zn(i));return[2,i]}}))}))},updateEnvelope:function(n,r){Xn.setRow("envelopes",n,Zn(r));return r},getField:function(n,r,t,u){if(n==="template"){var e=Xn.getRow("templates",r);var i=nr(e);var a=(i.fields||[]).find((function(n){return n.name===t}));var o=(i.roles||[]).map((function(n){return n.name}));var f=o.findIndex((function(n){return n===a.role_name}));return{index:Math.max(f,0),field:u||a}}else{var e=Xn.getRow("envelopes",r);var v=nr(e);var c=(v.fields||[]).find((function(n){return n.name===t}));var o=(v.recipients||[]).map((function(n){return n.role_name}));var f=o.findIndex((function(n){return n===c.role_name}));return{index:f,field:u||c}}}})}}}));
|