@verdocs/web-sdk 6.8.10 → 6.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (155) hide show
  1. package/dist/cjs/loader.cjs.js +1 -1
  2. package/dist/cjs/{utils-kkGeJs-8.js → utils-DsDnct9q.js} +2 -4
  3. package/dist/cjs/utils-DsDnct9q.js.map +1 -0
  4. package/dist/cjs/verdocs-auth.cjs.entry.js +11 -6
  5. package/dist/cjs/verdocs-auth.entry.cjs.js.map +1 -1
  6. package/dist/cjs/verdocs-contact-picker.cjs.entry.js +1102 -808
  7. package/dist/cjs/verdocs-contact-picker.entry.cjs.js.map +1 -1
  8. package/dist/cjs/verdocs-download-dialog_4.cjs.entry.js +1 -1
  9. package/dist/cjs/verdocs-envelopes-list.cjs.entry.js +1 -1
  10. package/dist/cjs/verdocs-pagination_2.cjs.entry.js +1 -1
  11. package/dist/cjs/verdocs-preview_6.cjs.entry.js +1 -1
  12. package/dist/cjs/verdocs-sign.cjs.entry.js +1 -1
  13. package/dist/cjs/verdocs-signing-progress.cjs.entry.js +1 -1
  14. package/dist/cjs/verdocs-template-document-page_2.cjs.entry.js +1 -1
  15. package/dist/cjs/verdocs-web-sdk.cjs.js +1 -1
  16. package/dist/collection/components/controls/verdocs-organization-card/verdocs-organization-card.js +1 -1
  17. package/dist/collection/components/embeds/verdocs-auth/verdocs-auth.js +14 -7
  18. package/dist/collection/components/embeds/verdocs-auth/verdocs-auth.js.map +1 -1
  19. package/dist/collection/utils/utils.js +0 -2
  20. package/dist/collection/utils/utils.js.map +1 -1
  21. package/dist/components/{p-Cj8PYi4t.js → p-B1XBGdC7.js} +4 -4
  22. package/dist/components/{p-Cj8PYi4t.js.map → p-B1XBGdC7.js.map} +1 -1
  23. package/dist/components/{p-RdlD8c2P.js → p-B6tZPSE-.js} +3 -3
  24. package/dist/components/{p-RdlD8c2P.js.map → p-B6tZPSE-.js.map} +1 -1
  25. package/dist/components/{p-zAW1BOj6.js → p-BCwx8bsK.js} +3 -3
  26. package/dist/components/{p-zAW1BOj6.js.map → p-BCwx8bsK.js.map} +1 -1
  27. package/dist/components/{p-aH_YLUuP.js → p-CaoZmlp7.js} +3 -3
  28. package/dist/components/{p-aH_YLUuP.js.map → p-CaoZmlp7.js.map} +1 -1
  29. package/dist/components/{p-Cx0Mif05.js → p-CndV_5Je.js} +2 -4
  30. package/dist/components/{p-Cx0Mif05.js.map → p-CndV_5Je.js.map} +1 -1
  31. package/dist/components/{p-BrtyCjOf.js → p-DPfgYCMd.js} +3 -3
  32. package/dist/components/{p-BrtyCjOf.js.map → p-DPfgYCMd.js.map} +1 -1
  33. package/dist/components/{p-DNYvorxL.js → p-DqlhK3CE.js} +4 -4
  34. package/dist/components/{p-DNYvorxL.js.map → p-DqlhK3CE.js.map} +1 -1
  35. package/dist/components/{p-Bzs-6uU0.js → p-EQhWyfg9.js} +1104 -810
  36. package/dist/components/p-EQhWyfg9.js.map +1 -0
  37. package/dist/components/{p---tnXjlx.js → p-uNqpODUQ.js} +3 -3
  38. package/dist/components/{p---tnXjlx.js.map → p-uNqpODUQ.js.map} +1 -1
  39. package/dist/components/verdocs-auth.js +13 -7
  40. package/dist/components/verdocs-auth.js.map +1 -1
  41. package/dist/components/verdocs-build.js +5 -5
  42. package/dist/components/verdocs-contact-picker.js +1 -1
  43. package/dist/components/verdocs-envelope-document-page.js +1 -1
  44. package/dist/components/verdocs-envelopes-list.js +2 -2
  45. package/dist/components/verdocs-preview.js +1 -1
  46. package/dist/components/verdocs-quick-filter.js +1 -1
  47. package/dist/components/verdocs-send.js +1 -1
  48. package/dist/components/verdocs-sign.js +3 -3
  49. package/dist/components/verdocs-signing-progress.js +1 -1
  50. package/dist/components/verdocs-template-document-page.js +1 -1
  51. package/dist/components/verdocs-template-fields.js +1 -1
  52. package/dist/components/verdocs-templates-list.js +1 -1
  53. package/dist/components/verdocs-view.js +1 -1
  54. package/dist/esm/loader.js +1 -1
  55. package/dist/esm/{utils-CPSY5rft.js → utils-Bty_rQI7.js} +2 -4
  56. package/dist/esm/utils-Bty_rQI7.js.map +1 -0
  57. package/dist/esm/verdocs-auth.entry.js +12 -7
  58. package/dist/esm/verdocs-auth.entry.js.map +1 -1
  59. package/dist/esm/verdocs-contact-picker.entry.js +1102 -808
  60. package/dist/esm/verdocs-contact-picker.entry.js.map +1 -1
  61. package/dist/esm/verdocs-download-dialog_4.entry.js +1 -1
  62. package/dist/esm/verdocs-envelopes-list.entry.js +1 -1
  63. package/dist/esm/verdocs-pagination_2.entry.js +1 -1
  64. package/dist/esm/verdocs-preview_6.entry.js +1 -1
  65. package/dist/esm/verdocs-sign.entry.js +1 -1
  66. package/dist/esm/verdocs-signing-progress.entry.js +1 -1
  67. package/dist/esm/verdocs-template-document-page_2.entry.js +1 -1
  68. package/dist/esm/verdocs-web-sdk.js +1 -1
  69. package/dist/esm-es5/loader.js +1 -1
  70. package/dist/esm-es5/{utils-CPSY5rft.js → utils-Bty_rQI7.js} +1 -1
  71. package/dist/esm-es5/utils-Bty_rQI7.js.map +1 -0
  72. package/dist/esm-es5/verdocs-auth.entry.js +1 -1
  73. package/dist/esm-es5/verdocs-auth.entry.js.map +1 -1
  74. package/dist/esm-es5/verdocs-contact-picker.entry.js +2 -2
  75. package/dist/esm-es5/verdocs-contact-picker.entry.js.map +1 -1
  76. package/dist/esm-es5/verdocs-download-dialog_4.entry.js +1 -1
  77. package/dist/esm-es5/verdocs-envelopes-list.entry.js +1 -1
  78. package/dist/esm-es5/verdocs-pagination_2.entry.js +1 -1
  79. package/dist/esm-es5/verdocs-preview_6.entry.js +1 -1
  80. package/dist/esm-es5/verdocs-sign.entry.js +1 -1
  81. package/dist/esm-es5/verdocs-signing-progress.entry.js +1 -1
  82. package/dist/esm-es5/verdocs-template-document-page_2.entry.js +1 -1
  83. package/dist/esm-es5/verdocs-web-sdk.js +1 -1
  84. package/dist/types/components/embeds/verdocs-auth/verdocs-auth.d.ts +3 -1
  85. package/dist/verdocs-web-sdk/{p-b7d907b4.system.entry.js → p-0f6aa428.system.entry.js} +2 -2
  86. package/dist/verdocs-web-sdk/{p-92b4f218.entry.js → p-30ce93f4.entry.js} +2 -2
  87. package/dist/verdocs-web-sdk/p-4a24c445.system.entry.js +4 -0
  88. package/dist/verdocs-web-sdk/p-4a24c445.system.entry.js.map +1 -0
  89. package/dist/verdocs-web-sdk/p-5b00dbf2.entry.js +3 -0
  90. package/dist/verdocs-web-sdk/p-5b00dbf2.entry.js.map +1 -0
  91. package/dist/verdocs-web-sdk/{p-3be22031.entry.js → p-64a68e39.entry.js} +2 -2
  92. package/dist/verdocs-web-sdk/{p-0b59a4a5.entry.js → p-76770d9c.entry.js} +2 -2
  93. package/dist/verdocs-web-sdk/{p-2ba8c771.system.entry.js → p-7fa0abc5.system.entry.js} +2 -2
  94. package/dist/verdocs-web-sdk/{p-60cfa50a.system.entry.js → p-83f10fb7.system.entry.js} +2 -2
  95. package/dist/verdocs-web-sdk/{p-641dbbfa.system.entry.js → p-8b80fe24.system.entry.js} +2 -2
  96. package/dist/verdocs-web-sdk/{p-fc308ef0.entry.js → p-90005b19.entry.js} +3 -3
  97. package/dist/verdocs-web-sdk/p-945b6e74.system.entry.js +2 -0
  98. package/dist/verdocs-web-sdk/p-945b6e74.system.entry.js.map +1 -0
  99. package/dist/verdocs-web-sdk/p-95037fa9.entry.js +2 -0
  100. package/dist/verdocs-web-sdk/p-95037fa9.entry.js.map +1 -0
  101. package/dist/verdocs-web-sdk/p-B8zpaHu-.system.js +1 -1
  102. package/dist/verdocs-web-sdk/p-Bg14ZSNR.system.js.map +1 -0
  103. package/dist/verdocs-web-sdk/{p-a51WVEiq.system.js.map → p-BkSli2zt.system.js.map} +1 -1
  104. package/dist/verdocs-web-sdk/{p-DmQa-gqf.system.js.map → p-CLSDwNJu.system.js.map} +1 -1
  105. package/dist/verdocs-web-sdk/p-CMBZT5Qy.system.js.map +1 -0
  106. package/dist/verdocs-web-sdk/{p-BFC8G6sY.system.js.map → p-CkFoHSeo.system.js.map} +1 -1
  107. package/dist/verdocs-web-sdk/{p-DGti20Vc.system.js → p-CnF3etgg.system.js} +1 -1
  108. package/dist/verdocs-web-sdk/p-CnF3etgg.system.js.map +1 -0
  109. package/dist/verdocs-web-sdk/{p-N4-IQ3Cb.system.js.map → p-CotMN3Ey.system.js.map} +1 -1
  110. package/dist/verdocs-web-sdk/{p-CVmJ8lYI.system.js.map → p-CyHGFYot.system.js.map} +1 -1
  111. package/dist/verdocs-web-sdk/{p-BJ0cUjeu.system.js.map → p-Fo42OGz9.system.js.map} +1 -1
  112. package/dist/verdocs-web-sdk/{p-H1Y4Zb4E.system.js.map → p-HR08HTpW.system.js.map} +1 -1
  113. package/dist/verdocs-web-sdk/{p-C9JdpYtM.js → p-NAwq_U8G.js} +1 -1
  114. package/dist/verdocs-web-sdk/p-NAwq_U8G.js.map +1 -0
  115. package/dist/verdocs-web-sdk/{p-6c8883ff.entry.js → p-b99e606b.entry.js} +2 -2
  116. package/dist/verdocs-web-sdk/{p-6c8883ff.entry.js.map → p-b99e606b.entry.js.map} +1 -1
  117. package/dist/verdocs-web-sdk/{p-066eaea8.system.entry.js → p-e33fd901.system.entry.js} +2 -2
  118. package/dist/verdocs-web-sdk/{p-d4e3efdb.system.entry.js → p-e97ce39e.system.entry.js} +3 -3
  119. package/dist/verdocs-web-sdk/{p-4f820bee.entry.js → p-f02af327.entry.js} +2 -2
  120. package/dist/verdocs-web-sdk/{p-04981f9f.entry.js → p-f79ebbc1.entry.js} +2 -2
  121. package/dist/verdocs-web-sdk/{p-4424623c.system.entry.js → p-ffbf5761.system.entry.js} +2 -2
  122. package/dist/verdocs-web-sdk/verdocs-auth.entry.esm.js.map +1 -1
  123. package/dist/verdocs-web-sdk/verdocs-contact-picker.entry.esm.js.map +1 -1
  124. package/dist/verdocs-web-sdk/verdocs-web-sdk.esm.js +1 -1
  125. package/package.json +3 -3
  126. package/dist/cjs/utils-kkGeJs-8.js.map +0 -1
  127. package/dist/components/p-Bzs-6uU0.js.map +0 -1
  128. package/dist/custom-elements.json +0 -2501
  129. package/dist/esm/utils-CPSY5rft.js.map +0 -1
  130. package/dist/esm-es5/utils-CPSY5rft.js.map +0 -1
  131. package/dist/verdocs-web-sdk/p-BC0LsUzY.system.js.map +0 -1
  132. package/dist/verdocs-web-sdk/p-BuHYXI2L.system.js.map +0 -1
  133. package/dist/verdocs-web-sdk/p-C9JdpYtM.js.map +0 -1
  134. package/dist/verdocs-web-sdk/p-DGti20Vc.system.js.map +0 -1
  135. package/dist/verdocs-web-sdk/p-ae1318c0.entry.js +0 -2
  136. package/dist/verdocs-web-sdk/p-ae1318c0.entry.js.map +0 -1
  137. package/dist/verdocs-web-sdk/p-bcf3f5ed.system.entry.js +0 -2
  138. package/dist/verdocs-web-sdk/p-bcf3f5ed.system.entry.js.map +0 -1
  139. package/dist/verdocs-web-sdk/p-bcffad7a.system.entry.js +0 -4
  140. package/dist/verdocs-web-sdk/p-bcffad7a.system.entry.js.map +0 -1
  141. package/dist/verdocs-web-sdk/p-f7f33a99.entry.js +0 -3
  142. package/dist/verdocs-web-sdk/p-f7f33a99.entry.js.map +0 -1
  143. /package/dist/verdocs-web-sdk/{p-b7d907b4.system.entry.js.map → p-0f6aa428.system.entry.js.map} +0 -0
  144. /package/dist/verdocs-web-sdk/{p-92b4f218.entry.js.map → p-30ce93f4.entry.js.map} +0 -0
  145. /package/dist/verdocs-web-sdk/{p-3be22031.entry.js.map → p-64a68e39.entry.js.map} +0 -0
  146. /package/dist/verdocs-web-sdk/{p-0b59a4a5.entry.js.map → p-76770d9c.entry.js.map} +0 -0
  147. /package/dist/verdocs-web-sdk/{p-2ba8c771.system.entry.js.map → p-7fa0abc5.system.entry.js.map} +0 -0
  148. /package/dist/verdocs-web-sdk/{p-60cfa50a.system.entry.js.map → p-83f10fb7.system.entry.js.map} +0 -0
  149. /package/dist/verdocs-web-sdk/{p-641dbbfa.system.entry.js.map → p-8b80fe24.system.entry.js.map} +0 -0
  150. /package/dist/verdocs-web-sdk/{p-fc308ef0.entry.js.map → p-90005b19.entry.js.map} +0 -0
  151. /package/dist/verdocs-web-sdk/{p-066eaea8.system.entry.js.map → p-e33fd901.system.entry.js.map} +0 -0
  152. /package/dist/verdocs-web-sdk/{p-d4e3efdb.system.entry.js.map → p-e97ce39e.system.entry.js.map} +0 -0
  153. /package/dist/verdocs-web-sdk/{p-4f820bee.entry.js.map → p-f02af327.entry.js.map} +0 -0
  154. /package/dist/verdocs-web-sdk/{p-04981f9f.entry.js.map → p-f79ebbc1.entry.js.map} +0 -0
  155. /package/dist/verdocs-web-sdk/{p-4424623c.system.entry.js.map → p-ffbf5761.system.entry.js.map} +0 -0
@@ -1,2 +1,2 @@
1
- var __awaiter=this&&this.__awaiter||function(e,n,o,t){function i(e){return e instanceof o?e:new o((function(n){n(e)}))}return new(o||(o=Promise))((function(o,s){function r(e){try{d(t.next(e))}catch(e){s(e)}}function a(e){try{d(t["throw"](e))}catch(e){s(e)}}function d(e){e.done?o(e.value):i(e.value).then(r,a)}d((t=t.apply(e,n||[])).next())}))};var __generator=this&&this.__generator||function(e,n){var o={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},t,i,s,r=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return r.next=a(0),r["throw"]=a(1),r["return"]=a(2),typeof Symbol==="function"&&(r[Symbol.iterator]=function(){return this}),r;function a(e){return function(n){return d([e,n])}}function d(a){if(t)throw new TypeError("Generator is already executing.");while(r&&(r=0,a[0]&&(o=0)),o)try{if(t=1,i&&(s=a[0]&2?i["return"]:a[0]?i["throw"]||((s=i["return"])&&s.call(i),0):i.next)&&!(s=s.call(i,a[1])).done)return s;if(i=0,s)a=[a[0]&2,s.value];switch(a[0]){case 0:case 1:s=a;break;case 4:o.label++;return{value:a[1],done:false};case 5:o.label++;i=a[1];a=[0];continue;case 7:a=o.ops.pop();o.trys.pop();continue;default:if(!(s=o.trys,s=s.length>0&&s[s.length-1])&&(a[0]===6||a[0]===2)){o=0;continue}if(a[0]===3&&(!s||a[1]>s[0]&&a[1]<s[3])){o.label=a[1];break}if(a[0]===6&&o.label<s[1]){o.label=s[1];s=a;break}if(s&&o.label<s[2]){o.label=s[2];o.ops.push(a);break}if(s[2])o.ops.pop();o.trys.pop();continue}a=n.call(e,o)}catch(e){a=[6,e];i=0}finally{t=s=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};import{r as registerInstance,c as createEvent,h,H as Host,g as getElement}from"./index-BIRwgFLv.js";import{VerdocsEndpoint,getEnvelopeDocumentPageDisplayUri,getEnvelope}from"@verdocs/js-sdk";import{t as throttle}from"./utils-CPSY5rft.js";import{S as SDKError}from"./errors-C1sRVZWv.js";import{S as Store}from"./Datastore-C7hFgM52.js";import"./index-dzBXqXlK.js";import"./Types-BqoC0yeA.js";var verdocsDownloadDialogCss='verdocs-download-dialog{-webkit-box-sizing:border-box;box-sizing:border-box;font-family:"Inter", "Barlow", sans-serif}verdocs-download-dialog .heading-container{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:center;align-items:center}verdocs-download-dialog .content{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:15px;padding:0 24px 20px 24px}verdocs-download-dialog .download-option{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;padding:12px 15px;border:1px solid #e5e7eb;border-radius:6px;cursor:pointer;-webkit-transition:all 0.2s ease;transition:all 0.2s ease;gap:15px;background:white}verdocs-download-dialog .download-option.disabled{opacity:0.5;cursor:not-allowed}verdocs-download-dialog .download-option.disabled:hover{background-color:white;border-color:#e5e7eb}verdocs-download-dialog .download-option:hover{border-color:#654dcb;background-color:#f9fafb}verdocs-download-dialog .icon-container{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;width:36px;height:36px;background-color:#f3f4f6;border-radius:50%;color:#4b5563;-ms-flex-negative:0;flex-shrink:0}verdocs-download-dialog .icon-container svg{width:18px;height:18px}verdocs-download-dialog .text-container{-ms-flex:1;flex:1}verdocs-download-dialog .text-container .label{font-weight:500;color:#111827;margin-bottom:2px}verdocs-download-dialog .text-container .description{font-size:13px;color:#6b7280}verdocs-download-dialog .status-indicator{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-align:center;align-items:center;gap:2px;font-size:11px;color:#9ca3af;min-width:50px}verdocs-download-dialog .status-indicator .signed{color:#10b981}verdocs-download-dialog .status-indicator .spinner-inline{display:-ms-flexbox;display:flex;color:#9ca3af;-webkit-animation:rotate 2s linear infinite;animation:rotate 2s linear infinite}verdocs-download-dialog .status-indicator svg{width:16px;height:16px}verdocs-download-dialog .info-message{font-size:13px;color:#6b7280;font-style:italic;padding:0 4px}@-webkit-keyframes rotate{from{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes rotate{from{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}';var DocumentIcon='<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M13 2H6C5.46957 2 4.96086 2.21071 4.58579 2.58579C4.21071 2.96086 4 3.46957 4 4V20C4 20.5304 4.21071 21.0391 4.58579 21.4142C4.96086 21.7893 5.46957 22 6 22H18C18.5304 22 19.0391 21.7893 19.4142 21.4142C19.7893 21.0391 20 20.5304 20 20V9L13 2Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M13 2V9H20" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>';var CertificateIcon='<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M12 15C15.866 15 19 11.866 19 8C19 4.13401 15.866 1 12 1C8.13401 1 5 4.13401 5 8C5 11.866 8.13401 15 12 15Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M8.21 13.89L7 23L12 20L17 23L15.79 13.88" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>';var ZipIcon='<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M10 16V22H14V16" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M6 16H18" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M20 22H4" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M12 10L12 16" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M8 12L12 16L16 12" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M4 16V4H20V16" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>';var CheckIcon='<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M20 6L9 17L4 12" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>';var RefreshIcon='<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M23 4V10H17" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M20.49 15A9 9 0 1 1 21.23 8" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>';var VerdocsDownloadDialog=function(){function e(e){registerInstance(this,e);this.download=createEvent(this,"download");this.exit=createEvent(this,"exit");this.signed=false;this.polling=false;this.documents=[];this.hasCertificate=false}e.prototype.handleOptionClick=function(e,n){var o=this.documents.some((function(e){return e.type==="certificate"}))||this.hasCertificate;var t=this.signed&&o;if(e==="certificate"&&!t){return}if(e==="zip"&&(this.polling||!t)){return}this.download.emit({action:e,documentId:n})};e.prototype.render=function(){var e=this;var n=this.documents.filter((function(e){return e.type==="attachment"})).sort((function(e,n){return e.order!==n.order?e.order-n.order:e.created_at.localeCompare(n.created_at)}));var o=this.documents.some((function(e){return e.type==="certificate"}))||this.hasCertificate;var t=this.signed&&o;var i=!this.polling&&t;var s=!this.signed;return h("verdocs-dialog",{key:"bbeaf815bfa639d92aba937fb2932171fb6a969d",onExit:function(){return e.exit.emit()}},h("div",{key:"3baaed7a0448b0b4487baf09996b0c0eed8dcc32",slot:"heading",class:"heading-container"},h("h3",{key:"055f9b0b3a1cbc4bf1dde3f66d33afe3cd69c59a",style:{margin:"0",fontSize:"1.25rem",fontWeight:"600",padding:"16px 24px"}},"Download")),h("div",{key:"d02a5cadb9e6ccc26f42d11a04d11c8796553137",slot:"content",class:"content"},n.length<=2&&n.map((function(n){return h("div",{class:"download-option",onClick:function(){return e.handleOptionClick("document",n.id)}},h("div",{class:"icon-container",innerHTML:DocumentIcon}),h("div",{class:"text-container"},h("div",{class:"label"},n.name),h("div",{class:"description"},"Download the document")),s?h("div",{class:"status-indicator"},h("div",{class:"spinner-inline",innerHTML:RefreshIcon})):h("div",{class:"status-indicator"},h("div",{class:"signed",innerHTML:CheckIcon}),h("span",null,"Signed")))})),n.length>2&&h("div",{key:"445d03fccd38d54dfce8b32528dd4ff869729b71",class:"info-message"},"Multiple documents attached. Please use the ZIP option below to download all files."),h("div",{key:"82d95c21a9a16ab3536f85054e43333e44af83d0",class:{"download-option":true,disabled:!t},onClick:function(){return e.handleOptionClick("certificate")},title:!t?"Certificate not yet available":""},h("div",{key:"adc703860b88d7fa5cd945ed8a6436eaac4e0186",class:"icon-container",innerHTML:CertificateIcon}),h("div",{key:"36f00a3cf54559157cd472700d0d6c8ad6fea55e",class:"text-container"},h("div",{key:"f2329e85febf992f0ea1a601a7c355063f196942",class:"label"},"Certificate"),h("div",{key:"9a9d90b9f55884fbfca9d289a753121737b07c0c",class:"description"},"Download the certificate")),t?h("div",{class:"status-indicator"},h("div",{class:"signed",innerHTML:CheckIcon}),h("span",null,"Ready")):h("div",{class:"status-indicator"},h("div",{class:"spinner-inline",innerHTML:RefreshIcon}))),h("div",{key:"05381515775fefc45fb04e935ece500a14fff159",class:{"download-option":true,disabled:!i},onClick:function(){return e.handleOptionClick("zip")},title:!i?"Waiting for all documents to be ready":""},h("div",{key:"e260f34177dde5d0994f593662c98f223f890da2",class:"icon-container",innerHTML:ZipIcon}),h("div",{key:"44a9a16e8c3a02449d331b9d74603ea8cfcd570b",class:"text-container"},h("div",{key:"54d968ac458d60d1aac7c39c3206069317bf67a3",class:"label"},"All Files"),h("div",{key:"b5f7246c36b12d83fdb63d7e38e90957fec3dd32",class:"description"},"Download everything as a ZIP file")),i?h("div",{class:"status-indicator"},h("div",{class:"signed",innerHTML:CheckIcon}),h("span",null,"Ready")):h("div",{class:"status-indicator"},h("div",{class:"spinner-inline",innerHTML:RefreshIcon})))),h("div",{key:"e8f9a266b2b1302bc4a4170803737ce6c3cece6c",slot:"footer",style:{display:"none"}}))};return e}();VerdocsDownloadDialog.style=verdocsDownloadDialogCss;var verdocsEnvelopeDocumentPageCss="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%}";var VerdocsEnvelopeDocumentPage=function(){function e(e){registerInstance(this,e);this.pageRendered=createEvent(this,"pageRendered");this.endpoint=VerdocsEndpoint.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-".concat(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=true;this.pageDisplayUri="https://verdocs-public-assets.s3.amazonaws.com/page-loading-placeholder.png"}e.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e;return __generator(this,(function(n){switch(n.label){case 0:e=this;return[4,getEnvelopeDocumentPageDisplayUri(this.endpoint,this.documentId,this.pageNumber,this.type)];case 1:e.pageDisplayUri=n.sent();return[2]}}))}))};e.prototype.componentDidLoad=function(){var e=this;this.resizeObserver=new ResizeObserver(throttle((function(n){for(var o=0,t=n;o<t.length;o++){var i=t[o];var s=i.contentRect.width;e.renderedWidth=s;e.renderedHeight=e.virtualHeight*(s/e.virtualWidth)}e.notifyRenderedSize()}),100));this.resizeObserver.observe(this.container)};e.prototype.disconnectedCallback=function(){var e;(e=this.resizeObserver)===null||e===void 0?void 0:e.disconnect()};e.prototype.notifyRenderedSize=function(){if(this.skipFirstNotification){this.skipFirstNotification=false;return}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})};e.prototype.render=function(){var e=this;var n="".concat(this.renderedHeight,"px");return h(Host,{key:"633b71e22df815319ad854618b74b035a6e43603",id:"".concat(this.containerId),style:{height:n,flex:"0 0 ".concat(n)}},this.layers.map((function(o){return o.type==="div"?h("div",{class:"verdocs-envelope-document-page-layer",id:"".concat(e.containerId,"-").concat(o.name),style:{height:n}}):e.pageDisplayUri?h("img",{class:"verdocs-envelope-document-page-layer img",id:"".concat(e.containerId,"-").concat(o.name),src:e.pageDisplayUri,alt:"Page ".concat(e.pageNumber),"aria-hidden":true,loading:"lazy",onLoad:function(n){e.naturalWidth=n.target.naturalWidth;e.naturalHeight=n.target.naturalHeight;e.aspectRatio=e.naturalWidth/e.naturalHeight;e.virtualHeight=e.virtualWidth/e.aspectRatio;e.renderedHeight=n.target.offsetWidth/e.aspectRatio}}):h("div",null)})))};Object.defineProperty(e.prototype,"container",{get:function(){return getElement(this)},enumerable:false,configurable:true});return e}();VerdocsEnvelopeDocumentPage.style=verdocsEnvelopeDocumentPageCss;var verdocsQuestionDialogCss='verdocs-question-dialog{top:0;left:0;right:0;bottom:0;position:fixed;-webkit-box-sizing:border-box;box-sizing:border-box;font-family:"Inter", "Barlow", sans-serif}verdocs-question-dialog.closed{display:none}verdocs-question-dialog textarea{-webkit-box-sizing:border-box;box-sizing:border-box;border:1px solid #707ae5;border-radius:4px;background:#ffffff;color:#000;width:100%;font-size:14px;padding:9px;outline:none}verdocs-question-dialog .heading .title{font-size:18px}verdocs-question-dialog .buttons{gap:20px;display:-ms-flexbox;display:flex;margin-top:24px;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:center;justify-content:center}verdocs-question-dialog .buttons button{-ms-flex:1;flex:1;border:0;height:38px;display:-ms-flexbox;display:flex;color:#ffffff;font-size:14px;cursor:pointer;border-radius:6px;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}verdocs-question-dialog .buttons button.cancel{background-color:#654dcb}verdocs-question-dialog .buttons button.ok{background-color:#55bc81}verdocs-question-dialog .buttons button.ok.single{max-width:150px}verdocs-question-dialog .buttons button:disabled{background-color:#6c727f}';var QuestionIcon$1='<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M10.4809 13.8423H15.4C16.2962 13.8423 17 13.1288 17 12.2764V5.56582C17 4.71348 16.2962 4 15.4 4H4.6C3.70383 4 3 4.71348 3 5.56582V12.2764C3 13.1288 3.70383 13.8423 4.6 13.8423H6.19908L6.2 17L6.20346 16.9997L6.20502 16.9988L10.4809 13.8423ZM6.79895 17.8034C6.35668 18.1298 5.73 18.0406 5.39921 17.6042C5.26989 17.4335 5.2 17.2262 5.2 17.0133L5.19937 14.8423H4.6C3.16406 14.8423 2 13.6935 2 12.2764V5.56582C2 4.14876 3.16406 3 4.6 3H15.4C16.8359 3 18 4.14876 18 5.56582V12.2764C18 13.6935 16.8359 14.8423 15.4 14.8423H10.81L6.79895 17.8034Z" fill="#ffffff"/></svg>';var VerdocsQuestionDialog=function(){function e(e){registerInstance(this,e);this.next=createEvent(this,"next");this.exit=createEvent(this,"exit");this.question="";this.closed=false}e.prototype.handleOk=function(){this.next.emit({question:this.question})};e.prototype.handleCancel=function(){this.exit.emit()};e.prototype.handleDismiss=function(e){this.closed=true;if(e.target.className==="background-overlay"){e.preventDefault();this.exit.emit()}};e.prototype.render=function(){var e=this;return h("verdocs-dialog",{key:"d0e85744fa9901d1be794cd59f4c9b87922e6e91",onExit:function(n){return e.handleDismiss(n)}},h("div",{key:"6d7ead703cdf217588ac98d2ac93a35644838b78",slot:"heading",class:"heading"},h("div",{key:"d07c6155fc98f51204a51add33d82afec7592c4b",class:"icon",innerHTML:QuestionIcon$1}),h("div",{key:"e9698d0aa4b24db343afd149adee95d9c3c0a52a",class:"title"},"Ask the Sender a Question")),h("div",{key:"cdef7a2b00c4c66e1748733e3c614e39ad456192",slot:"content",class:"content"},h("textarea",{key:"81c88e1d61be54e7ba80c9101fb71bf903df8d1c",name:"question",rows:6,placeholder:"Enter your question...",onInput:function(n){return e.question=n.target.value}},this.question)),h("div",{key:"a7d5a31362337e6c80c0ac5b2c6471efbacb9a23",class:"footer",slot:"footer"},h("div",{key:"71ae8344f053cfd94dc6befed76933fe67f490d1",class:"buttons"},h("button",{key:"04aec379b7b4f21885f72ed2016b10ac26730476",class:"cancel",onClick:function(){return e.handleCancel()}},"Cancel"),h("button",{key:"6e6e8bb27367c9a1167a49519da299d9ce9ee983",class:"ok",onClick:function(){return e.handleOk()}},"OK"))))};return e}();VerdocsQuestionDialog.style=verdocsQuestionDialogCss;var verdocsSignFooterCss='verdocs-sign-footer {\n left: 0;\n right: 0;\n bottom: 0;\n height: 48px;\n display: -ms-flexbox;\n display: flex;\n color: #616161;\n position: fixed;\n font-size: 12px;\n padding: 0 24px;\n -ms-flex-align: center;\n align-items: center;\n -ms-flex-direction: row;\n flex-direction: row;\n background: #ffffff;\n container-type: inline-size;\n border-top: 1px solid #e0e0e0;\n -ms-flex-pack: justify;\n justify-content: space-between;\n font-family: var(--verdocs-primary-font, "Inter", "Barlow", sans-serif);\n -webkit-transition: 0.5s cubic-bezier(0.35, 0, 0.25, 1);\n transition: 0.5s cubic-bezier(0.35, 0, 0.25, 1);\n}\nverdocs-sign-footer a {\n color: #616161;\n cursor: pointer;\n text-decoration: none;\n border-bottom: 1px dotted #616161;\n}\nverdocs-sign-footer.loading {\n display: none;\n}\nverdocs-sign-footer .powered-by {\n white-space: nowrap;\n}\nverdocs-sign-footer .buttons {\n -ms-flex: 0;\n flex: 0;\n gap: 16px;\n display: -ms-flexbox;\n display: flex;\n -ms-flex-direction: row;\n flex-direction: row;\n white-space: nowrap;\n -ms-flex-align: center;\n align-items: center;\n}\nverdocs-sign-footer .buttons button {\n gap: 4px;\n border: none;\n display: -ms-flexbox;\n display: flex;\n outline: none;\n cursor: pointer;\n -ms-flex-direction: row;\n flex-direction: row;\n -ms-flex-align: center;\n align-items: center;\n background: transparent;\n}\nverdocs-sign-footer .buttons div {\n gap: 4px;\n display: -ms-flexbox;\n display: flex;\n -ms-flex-direction: row;\n flex-direction: row;\n -ms-flex-align: center;\n align-items: center;\n}\nverdocs-sign-footer .links {\n -ms-flex: 0;\n flex: 0;\n gap: 8px;\n display: -ms-flexbox;\n display: flex;\n -ms-flex-direction: row;\n flex-direction: row;\n white-space: nowrap;\n}\nverdocs-sign-footer.just-buttons .buttons {\n -ms-flex: 1;\n flex: 1;\n -ms-flex-pack: center;\n justify-content: center;\n}\n@container (max-width: 720px) {\n verdocs-sign-footer.has-buttons .powered-by {\n display: none;\n }\n}\n@container (max-width: 540px) {\n verdocs-sign-footer.no-buttons .powered-by {\n display: none;\n }\n verdocs-sign-footer.has-buttons .links {\n display: none;\n }\n verdocs-sign-footer .buttons {\n -ms-flex: 1;\n flex: 1;\n -ms-flex-pack: center;\n justify-content: center;\n }\n}';var QuestionIcon='<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M10.4809 13.8423H15.4C16.2962 13.8423 17 13.1288 17 12.2764V5.56582C17 4.71348 16.2962 4 15.4 4H4.6C3.70383 4 3 4.71348 3 5.56582V12.2764C3 13.1288 3.70383 13.8423 4.6 13.8423H6.19908L6.2 17L6.20346 16.9997L6.20502 16.9988L10.4809 13.8423ZM6.79895 17.8034C6.35668 18.1298 5.73 18.0406 5.39921 17.6042C5.26989 17.4335 5.2 17.2262 5.2 17.0133L5.19937 14.8423H4.6C3.16406 14.8423 2 13.6935 2 12.2764V5.56582C2 4.14876 3.16406 3 4.6 3H15.4C16.8359 3 18 4.14876 18 5.56582V12.2764C18 13.6935 16.8359 14.8423 15.4 14.8423H10.81L6.79895 17.8034Z" fill="#424242"/></svg>';var DeclineIcon='<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M7.14645 7.14645C7.34171 6.95118 7.65829 6.95118 7.85355 7.14645L10 9.29289L12.1464 7.14645C12.3417 6.95118 12.6583 6.95118 12.8536 7.14645C13.0488 7.34171 13.0488 7.65829 12.8536 7.85355L10.7071 10L12.8536 12.1464C13.0488 12.3417 13.0488 12.6583 12.8536 12.8536C12.6583 13.0488 12.3417 13.0488 12.1464 12.8536L10 10.7071L7.85355 12.8536C7.65829 13.0488 7.34171 13.0488 7.14645 12.8536C6.95118 12.6583 6.95118 12.3417 7.14645 12.1464L9.29289 10L7.14645 7.85355C6.95118 7.65829 6.95118 7.34171 7.14645 7.14645ZM3 6C3 4.34315 4.34315 3 6 3H14C15.6569 3 17 4.34315 17 6V14C17 15.6569 15.6569 17 14 17H6C4.34315 17 3 15.6569 3 14V6ZM6 4C4.89543 4 4 4.89543 4 6V14C4 15.1046 4.89543 16 6 16H14C15.1046 16 16 15.1046 16 14V6C16 4.89543 15.1046 4 14 4H6Z" fill="#424242"/></svg>';var SaveIcon='<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M3 5C3 3.89543 3.89543 3 5 3H13.3787C13.9091 3 14.4178 3.21071 14.7929 3.58579L16.4142 5.20711C16.7893 5.58218 17 6.09089 17 6.62132V15C17 16.1046 16.1046 17 15 17H5C3.89543 17 3 16.1046 3 15V5ZM5 4C4.44772 4 4 4.44772 4 5V15C4 15.5523 4.44772 16 5 16L5 11.5C5 10.6716 5.67157 10 6.5 10H13.5C14.3284 10 15 10.6716 15 11.5V16C15.5523 16 16 15.5523 16 15V6.62132C16 6.3561 15.8946 6.10175 15.7071 5.91421L14.0858 4.29289C13.8983 4.10536 13.6439 4 13.3787 4L13 4V6.5C13 7.32843 12.3284 8 11.5 8L7.5 8C6.67157 8 6 7.32843 6 6.5L6 4H5ZM7 4L7 6.5C7 6.77614 7.22386 7 7.5 7L11.5 7C11.7761 7 12 6.77614 12 6.5V4L7 4ZM14 16V11.5C14 11.2239 13.7761 11 13.5 11H6.5C6.22386 11 6 11.2239 6 11.5V16H14Z" fill="#424242"/></svg>';var VerdocsSignFooter=function(){function e(e){registerInstance(this,e);this.askQuestion=createEvent(this,"askQuestion");this.decline=createEvent(this,"decline");this.finishLater=createEvent(this,"finishLater");this.sdkError=createEvent(this,"sdkError");this.envelopeListenerId=null;this.endpoint=VerdocsEndpoint.getDefault();this.envelopeId="";this.isDone=false;this.askingQuestion=false;this.declinine=false;this.envelope=null}e.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,n,o;return __generator(this,(function(t){try{if(!this.envelopeId){console.log("[FOOTER] Missing required envelope ID ".concat(this.envelopeId));return[2]}this.listenToEnvelope()}catch(t){console.log("[FOOTER] Error loading envelope",t);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new SDKError(t.message,(n=t.response)===null||n===void 0?void 0:n.status,(o=t.response)===null||o===void 0?void 0:o.data))}return[2]}))}))};e.prototype.disconnectedCallback=function(){this.unlistenToEnvelope()};e.prototype.listenToEnvelope=function(){return __awaiter(this,void 0,void 0,(function(){var e=this;return __generator(this,(function(n){console.log("[FOOTER] Loading envelope",this.envelopeId);this.unlistenToEnvelope();Store.subscribe("envelopes",this.envelopeId,(function(){return getEnvelope(e.endpoint,e.envelopeId)}),false,(function(n){e.envelope=n}));return[2]}))}))};e.prototype.unlistenToEnvelope=function(){if(this.envelopeListenerId){Store.store.delListener(this.envelopeListenerId);this.envelopeListenerId=null}};e.prototype.render=function(){var e=this;var n,o,t,i,s,r,a,d,c,l,f,u,v,p,g,b,x,w,k,m,y,C,L,H;var V=!!((o=(n=this.envelope)===null||n===void 0?void 0:n.organization)===null||o===void 0?void 0:o.powered_by_label);var M=!!((i=(t=this.envelope)===null||t===void 0?void 0:t.organization)===null||i===void 0?void 0:i.terms_use_url)||!!((r=(s=this.envelope)===null||s===void 0?void 0:s.organization)===null||r===void 0?void 0:r.privacy_policy_url);var I=!this.isDone;return h(Host,{key:"1fc747454660d14e69a4a65cbf71cd81f010d9c3",class:{"has-buttons":I,"no-buttons":!I,"has-powered-by":V,"has-links":M,"just-buttons":!V&&!M}},((d=(a=this.envelope)===null||a===void 0?void 0:a.organization)===null||d===void 0?void 0:d.powered_by_label)&&h("div",{key:"f8cae910df0d2c759af9ee2200aef58b80bb3f37",class:"powered-by"},((l=(c=this.envelope)===null||c===void 0?void 0:c.organization)===null||l===void 0?void 0:l.powered_by_url)?h("a",{href:(u=(f=this.envelope)===null||f===void 0?void 0:f.organization)===null||u===void 0?void 0:u.powered_by_url,target:"_blank",rel:"noopener noreferrer"},h("span",null,(p=(v=this.envelope)===null||v===void 0?void 0:v.organization)===null||p===void 0?void 0:p.powered_by_label)):h("span",null,(b=(g=this.envelope)===null||g===void 0?void 0:g.organization)===null||b===void 0?void 0:b.powered_by_label)),!this.isDone&&h("div",{key:"06bd0f346de34e567cfa2e2e5ae8bf06a8b6a1d9",class:"buttons"},h("button",{key:"bee3e5c2aad8cc60c9b291b14bba2e5eb1ee9c32",onClick:function(){return e.askingQuestion=true}},h("span",{key:"f42932689a3330a72b61e853d389eac39b2362a3",innerHTML:QuestionIcon}),"Ask Sender a Question"),h("button",{key:"7012513a564bfc6d5a416467843d1056ad5427c8",onClick:function(){var n;return(n=e.decline)===null||n===void 0?void 0:n.emit()}},h("span",{key:"7e0506798239ec5935d2c98e577e482744e3aa1f",innerHTML:DeclineIcon}),"Decline Signing"),h("button",{key:"3b3765e04da3d7f0749f2cbc24d84f2a3b6edb47",onClick:function(){var n;return(n=e.finishLater)===null||n===void 0?void 0:n.emit()}},h("span",{key:"0511b44dc272d16fdd2d2d6098f603f651c9bc50",innerHTML:SaveIcon}),"Finish Later")),h("div",{key:"cbea53ab6d84e268e1750bb0fec9f846040bd4ad",class:"links"},((w=(x=this.envelope)===null||x===void 0?void 0:x.organization)===null||w===void 0?void 0:w.terms_use_url)&&h("a",{key:"45628f09eaf2105226ab8b906e20e787de1e28ff",href:(m=(k=this.envelope)===null||k===void 0?void 0:k.organization)===null||m===void 0?void 0:m.terms_use_url,target:"_blank",rel:"noopener noreferrer"},h("span",{key:"08dc74860f84fb34c64a21c5409571998e5ce217"},"Terms of Use")),((C=(y=this.envelope)===null||y===void 0?void 0:y.organization)===null||C===void 0?void 0:C.privacy_policy_url)&&h("a",{key:"c3cc1fb07f7de02108762611c5b69206218e4b59",href:(H=(L=this.envelope)===null||L===void 0?void 0:L.organization)===null||H===void 0?void 0:H.privacy_policy_url,target:"_blank",rel:"noopener noreferrer"},h("span",{key:"c4bc436c7f7213bc0af61859ef27d8c41e331884"},"Privacy Policy"))),this.askingQuestion&&h("verdocs-question-dialog",{key:"93380ca89c21673f72c53e4d4f941b7d35c0079e",onNext:function(n){var o;(o=e.askQuestion)===null||o===void 0?void 0:o.emit({question:n.detail.question});e.askingQuestion=false},onExit:function(){return e.askingQuestion=false}}))};return e}();VerdocsSignFooter.style=verdocsSignFooterCss;export{VerdocsDownloadDialog as verdocs_download_dialog,VerdocsEnvelopeDocumentPage as verdocs_envelope_document_page,VerdocsQuestionDialog as verdocs_question_dialog,VerdocsSignFooter as verdocs_sign_footer};
1
+ var __awaiter=this&&this.__awaiter||function(e,n,o,t){function i(e){return e instanceof o?e:new o((function(n){n(e)}))}return new(o||(o=Promise))((function(o,s){function r(e){try{d(t.next(e))}catch(e){s(e)}}function a(e){try{d(t["throw"](e))}catch(e){s(e)}}function d(e){e.done?o(e.value):i(e.value).then(r,a)}d((t=t.apply(e,n||[])).next())}))};var __generator=this&&this.__generator||function(e,n){var o={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},t,i,s,r=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return r.next=a(0),r["throw"]=a(1),r["return"]=a(2),typeof Symbol==="function"&&(r[Symbol.iterator]=function(){return this}),r;function a(e){return function(n){return d([e,n])}}function d(a){if(t)throw new TypeError("Generator is already executing.");while(r&&(r=0,a[0]&&(o=0)),o)try{if(t=1,i&&(s=a[0]&2?i["return"]:a[0]?i["throw"]||((s=i["return"])&&s.call(i),0):i.next)&&!(s=s.call(i,a[1])).done)return s;if(i=0,s)a=[a[0]&2,s.value];switch(a[0]){case 0:case 1:s=a;break;case 4:o.label++;return{value:a[1],done:false};case 5:o.label++;i=a[1];a=[0];continue;case 7:a=o.ops.pop();o.trys.pop();continue;default:if(!(s=o.trys,s=s.length>0&&s[s.length-1])&&(a[0]===6||a[0]===2)){o=0;continue}if(a[0]===3&&(!s||a[1]>s[0]&&a[1]<s[3])){o.label=a[1];break}if(a[0]===6&&o.label<s[1]){o.label=s[1];s=a;break}if(s&&o.label<s[2]){o.label=s[2];o.ops.push(a);break}if(s[2])o.ops.pop();o.trys.pop();continue}a=n.call(e,o)}catch(e){a=[6,e];i=0}finally{t=s=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};import{r as registerInstance,c as createEvent,h,H as Host,g as getElement}from"./index-BIRwgFLv.js";import{VerdocsEndpoint,getEnvelopeDocumentPageDisplayUri,getEnvelope}from"@verdocs/js-sdk";import{t as throttle}from"./utils-Bty_rQI7.js";import{S as SDKError}from"./errors-C1sRVZWv.js";import{S as Store}from"./Datastore-C7hFgM52.js";import"./index-dzBXqXlK.js";import"./Types-BqoC0yeA.js";var verdocsDownloadDialogCss='verdocs-download-dialog{-webkit-box-sizing:border-box;box-sizing:border-box;font-family:"Inter", "Barlow", sans-serif}verdocs-download-dialog .heading-container{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:center;align-items:center}verdocs-download-dialog .content{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:15px;padding:0 24px 20px 24px}verdocs-download-dialog .download-option{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;padding:12px 15px;border:1px solid #e5e7eb;border-radius:6px;cursor:pointer;-webkit-transition:all 0.2s ease;transition:all 0.2s ease;gap:15px;background:white}verdocs-download-dialog .download-option.disabled{opacity:0.5;cursor:not-allowed}verdocs-download-dialog .download-option.disabled:hover{background-color:white;border-color:#e5e7eb}verdocs-download-dialog .download-option:hover{border-color:#654dcb;background-color:#f9fafb}verdocs-download-dialog .icon-container{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;width:36px;height:36px;background-color:#f3f4f6;border-radius:50%;color:#4b5563;-ms-flex-negative:0;flex-shrink:0}verdocs-download-dialog .icon-container svg{width:18px;height:18px}verdocs-download-dialog .text-container{-ms-flex:1;flex:1}verdocs-download-dialog .text-container .label{font-weight:500;color:#111827;margin-bottom:2px}verdocs-download-dialog .text-container .description{font-size:13px;color:#6b7280}verdocs-download-dialog .status-indicator{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-align:center;align-items:center;gap:2px;font-size:11px;color:#9ca3af;min-width:50px}verdocs-download-dialog .status-indicator .signed{color:#10b981}verdocs-download-dialog .status-indicator .spinner-inline{display:-ms-flexbox;display:flex;color:#9ca3af;-webkit-animation:rotate 2s linear infinite;animation:rotate 2s linear infinite}verdocs-download-dialog .status-indicator svg{width:16px;height:16px}verdocs-download-dialog .info-message{font-size:13px;color:#6b7280;font-style:italic;padding:0 4px}@-webkit-keyframes rotate{from{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes rotate{from{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}';var DocumentIcon='<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M13 2H6C5.46957 2 4.96086 2.21071 4.58579 2.58579C4.21071 2.96086 4 3.46957 4 4V20C4 20.5304 4.21071 21.0391 4.58579 21.4142C4.96086 21.7893 5.46957 22 6 22H18C18.5304 22 19.0391 21.7893 19.4142 21.4142C19.7893 21.0391 20 20.5304 20 20V9L13 2Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M13 2V9H20" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>';var CertificateIcon='<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M12 15C15.866 15 19 11.866 19 8C19 4.13401 15.866 1 12 1C8.13401 1 5 4.13401 5 8C5 11.866 8.13401 15 12 15Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M8.21 13.89L7 23L12 20L17 23L15.79 13.88" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>';var ZipIcon='<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M10 16V22H14V16" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M6 16H18" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M20 22H4" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M12 10L12 16" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M8 12L12 16L16 12" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M4 16V4H20V16" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>';var CheckIcon='<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M20 6L9 17L4 12" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>';var RefreshIcon='<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M23 4V10H17" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M20.49 15A9 9 0 1 1 21.23 8" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>';var VerdocsDownloadDialog=function(){function e(e){registerInstance(this,e);this.download=createEvent(this,"download");this.exit=createEvent(this,"exit");this.signed=false;this.polling=false;this.documents=[];this.hasCertificate=false}e.prototype.handleOptionClick=function(e,n){var o=this.documents.some((function(e){return e.type==="certificate"}))||this.hasCertificate;var t=this.signed&&o;if(e==="certificate"&&!t){return}if(e==="zip"&&(this.polling||!t)){return}this.download.emit({action:e,documentId:n})};e.prototype.render=function(){var e=this;var n=this.documents.filter((function(e){return e.type==="attachment"})).sort((function(e,n){return e.order!==n.order?e.order-n.order:e.created_at.localeCompare(n.created_at)}));var o=this.documents.some((function(e){return e.type==="certificate"}))||this.hasCertificate;var t=this.signed&&o;var i=!this.polling&&t;var s=!this.signed;return h("verdocs-dialog",{key:"bbeaf815bfa639d92aba937fb2932171fb6a969d",onExit:function(){return e.exit.emit()}},h("div",{key:"3baaed7a0448b0b4487baf09996b0c0eed8dcc32",slot:"heading",class:"heading-container"},h("h3",{key:"055f9b0b3a1cbc4bf1dde3f66d33afe3cd69c59a",style:{margin:"0",fontSize:"1.25rem",fontWeight:"600",padding:"16px 24px"}},"Download")),h("div",{key:"d02a5cadb9e6ccc26f42d11a04d11c8796553137",slot:"content",class:"content"},n.length<=2&&n.map((function(n){return h("div",{class:"download-option",onClick:function(){return e.handleOptionClick("document",n.id)}},h("div",{class:"icon-container",innerHTML:DocumentIcon}),h("div",{class:"text-container"},h("div",{class:"label"},n.name),h("div",{class:"description"},"Download the document")),s?h("div",{class:"status-indicator"},h("div",{class:"spinner-inline",innerHTML:RefreshIcon})):h("div",{class:"status-indicator"},h("div",{class:"signed",innerHTML:CheckIcon}),h("span",null,"Signed")))})),n.length>2&&h("div",{key:"445d03fccd38d54dfce8b32528dd4ff869729b71",class:"info-message"},"Multiple documents attached. Please use the ZIP option below to download all files."),h("div",{key:"82d95c21a9a16ab3536f85054e43333e44af83d0",class:{"download-option":true,disabled:!t},onClick:function(){return e.handleOptionClick("certificate")},title:!t?"Certificate not yet available":""},h("div",{key:"adc703860b88d7fa5cd945ed8a6436eaac4e0186",class:"icon-container",innerHTML:CertificateIcon}),h("div",{key:"36f00a3cf54559157cd472700d0d6c8ad6fea55e",class:"text-container"},h("div",{key:"f2329e85febf992f0ea1a601a7c355063f196942",class:"label"},"Certificate"),h("div",{key:"9a9d90b9f55884fbfca9d289a753121737b07c0c",class:"description"},"Download the certificate")),t?h("div",{class:"status-indicator"},h("div",{class:"signed",innerHTML:CheckIcon}),h("span",null,"Ready")):h("div",{class:"status-indicator"},h("div",{class:"spinner-inline",innerHTML:RefreshIcon}))),h("div",{key:"05381515775fefc45fb04e935ece500a14fff159",class:{"download-option":true,disabled:!i},onClick:function(){return e.handleOptionClick("zip")},title:!i?"Waiting for all documents to be ready":""},h("div",{key:"e260f34177dde5d0994f593662c98f223f890da2",class:"icon-container",innerHTML:ZipIcon}),h("div",{key:"44a9a16e8c3a02449d331b9d74603ea8cfcd570b",class:"text-container"},h("div",{key:"54d968ac458d60d1aac7c39c3206069317bf67a3",class:"label"},"All Files"),h("div",{key:"b5f7246c36b12d83fdb63d7e38e90957fec3dd32",class:"description"},"Download everything as a ZIP file")),i?h("div",{class:"status-indicator"},h("div",{class:"signed",innerHTML:CheckIcon}),h("span",null,"Ready")):h("div",{class:"status-indicator"},h("div",{class:"spinner-inline",innerHTML:RefreshIcon})))),h("div",{key:"e8f9a266b2b1302bc4a4170803737ce6c3cece6c",slot:"footer",style:{display:"none"}}))};return e}();VerdocsDownloadDialog.style=verdocsDownloadDialogCss;var verdocsEnvelopeDocumentPageCss="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%}";var VerdocsEnvelopeDocumentPage=function(){function e(e){registerInstance(this,e);this.pageRendered=createEvent(this,"pageRendered");this.endpoint=VerdocsEndpoint.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-".concat(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=true;this.pageDisplayUri="https://verdocs-public-assets.s3.amazonaws.com/page-loading-placeholder.png"}e.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e;return __generator(this,(function(n){switch(n.label){case 0:e=this;return[4,getEnvelopeDocumentPageDisplayUri(this.endpoint,this.documentId,this.pageNumber,this.type)];case 1:e.pageDisplayUri=n.sent();return[2]}}))}))};e.prototype.componentDidLoad=function(){var e=this;this.resizeObserver=new ResizeObserver(throttle((function(n){for(var o=0,t=n;o<t.length;o++){var i=t[o];var s=i.contentRect.width;e.renderedWidth=s;e.renderedHeight=e.virtualHeight*(s/e.virtualWidth)}e.notifyRenderedSize()}),100));this.resizeObserver.observe(this.container)};e.prototype.disconnectedCallback=function(){var e;(e=this.resizeObserver)===null||e===void 0?void 0:e.disconnect()};e.prototype.notifyRenderedSize=function(){if(this.skipFirstNotification){this.skipFirstNotification=false;return}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})};e.prototype.render=function(){var e=this;var n="".concat(this.renderedHeight,"px");return h(Host,{key:"633b71e22df815319ad854618b74b035a6e43603",id:"".concat(this.containerId),style:{height:n,flex:"0 0 ".concat(n)}},this.layers.map((function(o){return o.type==="div"?h("div",{class:"verdocs-envelope-document-page-layer",id:"".concat(e.containerId,"-").concat(o.name),style:{height:n}}):e.pageDisplayUri?h("img",{class:"verdocs-envelope-document-page-layer img",id:"".concat(e.containerId,"-").concat(o.name),src:e.pageDisplayUri,alt:"Page ".concat(e.pageNumber),"aria-hidden":true,loading:"lazy",onLoad:function(n){e.naturalWidth=n.target.naturalWidth;e.naturalHeight=n.target.naturalHeight;e.aspectRatio=e.naturalWidth/e.naturalHeight;e.virtualHeight=e.virtualWidth/e.aspectRatio;e.renderedHeight=n.target.offsetWidth/e.aspectRatio}}):h("div",null)})))};Object.defineProperty(e.prototype,"container",{get:function(){return getElement(this)},enumerable:false,configurable:true});return e}();VerdocsEnvelopeDocumentPage.style=verdocsEnvelopeDocumentPageCss;var verdocsQuestionDialogCss='verdocs-question-dialog{top:0;left:0;right:0;bottom:0;position:fixed;-webkit-box-sizing:border-box;box-sizing:border-box;font-family:"Inter", "Barlow", sans-serif}verdocs-question-dialog.closed{display:none}verdocs-question-dialog textarea{-webkit-box-sizing:border-box;box-sizing:border-box;border:1px solid #707ae5;border-radius:4px;background:#ffffff;color:#000;width:100%;font-size:14px;padding:9px;outline:none}verdocs-question-dialog .heading .title{font-size:18px}verdocs-question-dialog .buttons{gap:20px;display:-ms-flexbox;display:flex;margin-top:24px;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:center;justify-content:center}verdocs-question-dialog .buttons button{-ms-flex:1;flex:1;border:0;height:38px;display:-ms-flexbox;display:flex;color:#ffffff;font-size:14px;cursor:pointer;border-radius:6px;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}verdocs-question-dialog .buttons button.cancel{background-color:#654dcb}verdocs-question-dialog .buttons button.ok{background-color:#55bc81}verdocs-question-dialog .buttons button.ok.single{max-width:150px}verdocs-question-dialog .buttons button:disabled{background-color:#6c727f}';var QuestionIcon$1='<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M10.4809 13.8423H15.4C16.2962 13.8423 17 13.1288 17 12.2764V5.56582C17 4.71348 16.2962 4 15.4 4H4.6C3.70383 4 3 4.71348 3 5.56582V12.2764C3 13.1288 3.70383 13.8423 4.6 13.8423H6.19908L6.2 17L6.20346 16.9997L6.20502 16.9988L10.4809 13.8423ZM6.79895 17.8034C6.35668 18.1298 5.73 18.0406 5.39921 17.6042C5.26989 17.4335 5.2 17.2262 5.2 17.0133L5.19937 14.8423H4.6C3.16406 14.8423 2 13.6935 2 12.2764V5.56582C2 4.14876 3.16406 3 4.6 3H15.4C16.8359 3 18 4.14876 18 5.56582V12.2764C18 13.6935 16.8359 14.8423 15.4 14.8423H10.81L6.79895 17.8034Z" fill="#ffffff"/></svg>';var VerdocsQuestionDialog=function(){function e(e){registerInstance(this,e);this.next=createEvent(this,"next");this.exit=createEvent(this,"exit");this.question="";this.closed=false}e.prototype.handleOk=function(){this.next.emit({question:this.question})};e.prototype.handleCancel=function(){this.exit.emit()};e.prototype.handleDismiss=function(e){this.closed=true;if(e.target.className==="background-overlay"){e.preventDefault();this.exit.emit()}};e.prototype.render=function(){var e=this;return h("verdocs-dialog",{key:"d0e85744fa9901d1be794cd59f4c9b87922e6e91",onExit:function(n){return e.handleDismiss(n)}},h("div",{key:"6d7ead703cdf217588ac98d2ac93a35644838b78",slot:"heading",class:"heading"},h("div",{key:"d07c6155fc98f51204a51add33d82afec7592c4b",class:"icon",innerHTML:QuestionIcon$1}),h("div",{key:"e9698d0aa4b24db343afd149adee95d9c3c0a52a",class:"title"},"Ask the Sender a Question")),h("div",{key:"cdef7a2b00c4c66e1748733e3c614e39ad456192",slot:"content",class:"content"},h("textarea",{key:"81c88e1d61be54e7ba80c9101fb71bf903df8d1c",name:"question",rows:6,placeholder:"Enter your question...",onInput:function(n){return e.question=n.target.value}},this.question)),h("div",{key:"a7d5a31362337e6c80c0ac5b2c6471efbacb9a23",class:"footer",slot:"footer"},h("div",{key:"71ae8344f053cfd94dc6befed76933fe67f490d1",class:"buttons"},h("button",{key:"04aec379b7b4f21885f72ed2016b10ac26730476",class:"cancel",onClick:function(){return e.handleCancel()}},"Cancel"),h("button",{key:"6e6e8bb27367c9a1167a49519da299d9ce9ee983",class:"ok",onClick:function(){return e.handleOk()}},"OK"))))};return e}();VerdocsQuestionDialog.style=verdocsQuestionDialogCss;var verdocsSignFooterCss='verdocs-sign-footer {\n left: 0;\n right: 0;\n bottom: 0;\n height: 48px;\n display: -ms-flexbox;\n display: flex;\n color: #616161;\n position: fixed;\n font-size: 12px;\n padding: 0 24px;\n -ms-flex-align: center;\n align-items: center;\n -ms-flex-direction: row;\n flex-direction: row;\n background: #ffffff;\n container-type: inline-size;\n border-top: 1px solid #e0e0e0;\n -ms-flex-pack: justify;\n justify-content: space-between;\n font-family: var(--verdocs-primary-font, "Inter", "Barlow", sans-serif);\n -webkit-transition: 0.5s cubic-bezier(0.35, 0, 0.25, 1);\n transition: 0.5s cubic-bezier(0.35, 0, 0.25, 1);\n}\nverdocs-sign-footer a {\n color: #616161;\n cursor: pointer;\n text-decoration: none;\n border-bottom: 1px dotted #616161;\n}\nverdocs-sign-footer.loading {\n display: none;\n}\nverdocs-sign-footer .powered-by {\n white-space: nowrap;\n}\nverdocs-sign-footer .buttons {\n -ms-flex: 0;\n flex: 0;\n gap: 16px;\n display: -ms-flexbox;\n display: flex;\n -ms-flex-direction: row;\n flex-direction: row;\n white-space: nowrap;\n -ms-flex-align: center;\n align-items: center;\n}\nverdocs-sign-footer .buttons button {\n gap: 4px;\n border: none;\n display: -ms-flexbox;\n display: flex;\n outline: none;\n cursor: pointer;\n -ms-flex-direction: row;\n flex-direction: row;\n -ms-flex-align: center;\n align-items: center;\n background: transparent;\n}\nverdocs-sign-footer .buttons div {\n gap: 4px;\n display: -ms-flexbox;\n display: flex;\n -ms-flex-direction: row;\n flex-direction: row;\n -ms-flex-align: center;\n align-items: center;\n}\nverdocs-sign-footer .links {\n -ms-flex: 0;\n flex: 0;\n gap: 8px;\n display: -ms-flexbox;\n display: flex;\n -ms-flex-direction: row;\n flex-direction: row;\n white-space: nowrap;\n}\nverdocs-sign-footer.just-buttons .buttons {\n -ms-flex: 1;\n flex: 1;\n -ms-flex-pack: center;\n justify-content: center;\n}\n@container (max-width: 720px) {\n verdocs-sign-footer.has-buttons .powered-by {\n display: none;\n }\n}\n@container (max-width: 540px) {\n verdocs-sign-footer.no-buttons .powered-by {\n display: none;\n }\n verdocs-sign-footer.has-buttons .links {\n display: none;\n }\n verdocs-sign-footer .buttons {\n -ms-flex: 1;\n flex: 1;\n -ms-flex-pack: center;\n justify-content: center;\n }\n}';var QuestionIcon='<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M10.4809 13.8423H15.4C16.2962 13.8423 17 13.1288 17 12.2764V5.56582C17 4.71348 16.2962 4 15.4 4H4.6C3.70383 4 3 4.71348 3 5.56582V12.2764C3 13.1288 3.70383 13.8423 4.6 13.8423H6.19908L6.2 17L6.20346 16.9997L6.20502 16.9988L10.4809 13.8423ZM6.79895 17.8034C6.35668 18.1298 5.73 18.0406 5.39921 17.6042C5.26989 17.4335 5.2 17.2262 5.2 17.0133L5.19937 14.8423H4.6C3.16406 14.8423 2 13.6935 2 12.2764V5.56582C2 4.14876 3.16406 3 4.6 3H15.4C16.8359 3 18 4.14876 18 5.56582V12.2764C18 13.6935 16.8359 14.8423 15.4 14.8423H10.81L6.79895 17.8034Z" fill="#424242"/></svg>';var DeclineIcon='<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M7.14645 7.14645C7.34171 6.95118 7.65829 6.95118 7.85355 7.14645L10 9.29289L12.1464 7.14645C12.3417 6.95118 12.6583 6.95118 12.8536 7.14645C13.0488 7.34171 13.0488 7.65829 12.8536 7.85355L10.7071 10L12.8536 12.1464C13.0488 12.3417 13.0488 12.6583 12.8536 12.8536C12.6583 13.0488 12.3417 13.0488 12.1464 12.8536L10 10.7071L7.85355 12.8536C7.65829 13.0488 7.34171 13.0488 7.14645 12.8536C6.95118 12.6583 6.95118 12.3417 7.14645 12.1464L9.29289 10L7.14645 7.85355C6.95118 7.65829 6.95118 7.34171 7.14645 7.14645ZM3 6C3 4.34315 4.34315 3 6 3H14C15.6569 3 17 4.34315 17 6V14C17 15.6569 15.6569 17 14 17H6C4.34315 17 3 15.6569 3 14V6ZM6 4C4.89543 4 4 4.89543 4 6V14C4 15.1046 4.89543 16 6 16H14C15.1046 16 16 15.1046 16 14V6C16 4.89543 15.1046 4 14 4H6Z" fill="#424242"/></svg>';var SaveIcon='<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M3 5C3 3.89543 3.89543 3 5 3H13.3787C13.9091 3 14.4178 3.21071 14.7929 3.58579L16.4142 5.20711C16.7893 5.58218 17 6.09089 17 6.62132V15C17 16.1046 16.1046 17 15 17H5C3.89543 17 3 16.1046 3 15V5ZM5 4C4.44772 4 4 4.44772 4 5V15C4 15.5523 4.44772 16 5 16L5 11.5C5 10.6716 5.67157 10 6.5 10H13.5C14.3284 10 15 10.6716 15 11.5V16C15.5523 16 16 15.5523 16 15V6.62132C16 6.3561 15.8946 6.10175 15.7071 5.91421L14.0858 4.29289C13.8983 4.10536 13.6439 4 13.3787 4L13 4V6.5C13 7.32843 12.3284 8 11.5 8L7.5 8C6.67157 8 6 7.32843 6 6.5L6 4H5ZM7 4L7 6.5C7 6.77614 7.22386 7 7.5 7L11.5 7C11.7761 7 12 6.77614 12 6.5V4L7 4ZM14 16V11.5C14 11.2239 13.7761 11 13.5 11H6.5C6.22386 11 6 11.2239 6 11.5V16H14Z" fill="#424242"/></svg>';var VerdocsSignFooter=function(){function e(e){registerInstance(this,e);this.askQuestion=createEvent(this,"askQuestion");this.decline=createEvent(this,"decline");this.finishLater=createEvent(this,"finishLater");this.sdkError=createEvent(this,"sdkError");this.envelopeListenerId=null;this.endpoint=VerdocsEndpoint.getDefault();this.envelopeId="";this.isDone=false;this.askingQuestion=false;this.declinine=false;this.envelope=null}e.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,n,o;return __generator(this,(function(t){try{if(!this.envelopeId){console.log("[FOOTER] Missing required envelope ID ".concat(this.envelopeId));return[2]}this.listenToEnvelope()}catch(t){console.log("[FOOTER] Error loading envelope",t);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new SDKError(t.message,(n=t.response)===null||n===void 0?void 0:n.status,(o=t.response)===null||o===void 0?void 0:o.data))}return[2]}))}))};e.prototype.disconnectedCallback=function(){this.unlistenToEnvelope()};e.prototype.listenToEnvelope=function(){return __awaiter(this,void 0,void 0,(function(){var e=this;return __generator(this,(function(n){console.log("[FOOTER] Loading envelope",this.envelopeId);this.unlistenToEnvelope();Store.subscribe("envelopes",this.envelopeId,(function(){return getEnvelope(e.endpoint,e.envelopeId)}),false,(function(n){e.envelope=n}));return[2]}))}))};e.prototype.unlistenToEnvelope=function(){if(this.envelopeListenerId){Store.store.delListener(this.envelopeListenerId);this.envelopeListenerId=null}};e.prototype.render=function(){var e=this;var n,o,t,i,s,r,a,d,c,l,f,u,v,p,g,b,x,w,k,m,y,C,L,H;var V=!!((o=(n=this.envelope)===null||n===void 0?void 0:n.organization)===null||o===void 0?void 0:o.powered_by_label);var I=!!((i=(t=this.envelope)===null||t===void 0?void 0:t.organization)===null||i===void 0?void 0:i.terms_use_url)||!!((r=(s=this.envelope)===null||s===void 0?void 0:s.organization)===null||r===void 0?void 0:r.privacy_policy_url);var M=!this.isDone;return h(Host,{key:"1fc747454660d14e69a4a65cbf71cd81f010d9c3",class:{"has-buttons":M,"no-buttons":!M,"has-powered-by":V,"has-links":I,"just-buttons":!V&&!I}},((d=(a=this.envelope)===null||a===void 0?void 0:a.organization)===null||d===void 0?void 0:d.powered_by_label)&&h("div",{key:"f8cae910df0d2c759af9ee2200aef58b80bb3f37",class:"powered-by"},((l=(c=this.envelope)===null||c===void 0?void 0:c.organization)===null||l===void 0?void 0:l.powered_by_url)?h("a",{href:(u=(f=this.envelope)===null||f===void 0?void 0:f.organization)===null||u===void 0?void 0:u.powered_by_url,target:"_blank",rel:"noopener noreferrer"},h("span",null,(p=(v=this.envelope)===null||v===void 0?void 0:v.organization)===null||p===void 0?void 0:p.powered_by_label)):h("span",null,(b=(g=this.envelope)===null||g===void 0?void 0:g.organization)===null||b===void 0?void 0:b.powered_by_label)),!this.isDone&&h("div",{key:"06bd0f346de34e567cfa2e2e5ae8bf06a8b6a1d9",class:"buttons"},h("button",{key:"bee3e5c2aad8cc60c9b291b14bba2e5eb1ee9c32",onClick:function(){return e.askingQuestion=true}},h("span",{key:"f42932689a3330a72b61e853d389eac39b2362a3",innerHTML:QuestionIcon}),"Ask Sender a Question"),h("button",{key:"7012513a564bfc6d5a416467843d1056ad5427c8",onClick:function(){var n;return(n=e.decline)===null||n===void 0?void 0:n.emit()}},h("span",{key:"7e0506798239ec5935d2c98e577e482744e3aa1f",innerHTML:DeclineIcon}),"Decline Signing"),h("button",{key:"3b3765e04da3d7f0749f2cbc24d84f2a3b6edb47",onClick:function(){var n;return(n=e.finishLater)===null||n===void 0?void 0:n.emit()}},h("span",{key:"0511b44dc272d16fdd2d2d6098f603f651c9bc50",innerHTML:SaveIcon}),"Finish Later")),h("div",{key:"cbea53ab6d84e268e1750bb0fec9f846040bd4ad",class:"links"},((w=(x=this.envelope)===null||x===void 0?void 0:x.organization)===null||w===void 0?void 0:w.terms_use_url)&&h("a",{key:"45628f09eaf2105226ab8b906e20e787de1e28ff",href:(m=(k=this.envelope)===null||k===void 0?void 0:k.organization)===null||m===void 0?void 0:m.terms_use_url,target:"_blank",rel:"noopener noreferrer"},h("span",{key:"08dc74860f84fb34c64a21c5409571998e5ce217"},"Terms of Use")),((C=(y=this.envelope)===null||y===void 0?void 0:y.organization)===null||C===void 0?void 0:C.privacy_policy_url)&&h("a",{key:"c3cc1fb07f7de02108762611c5b69206218e4b59",href:(H=(L=this.envelope)===null||L===void 0?void 0:L.organization)===null||H===void 0?void 0:H.privacy_policy_url,target:"_blank",rel:"noopener noreferrer"},h("span",{key:"c4bc436c7f7213bc0af61859ef27d8c41e331884"},"Privacy Policy"))),this.askingQuestion&&h("verdocs-question-dialog",{key:"93380ca89c21673f72c53e4d4f941b7d35c0079e",onNext:function(n){var o;(o=e.askQuestion)===null||o===void 0?void 0:o.emit({question:n.detail.question});e.askingQuestion=false},onExit:function(){return e.askingQuestion=false}}))};return e}();VerdocsSignFooter.style=verdocsSignFooterCss;export{VerdocsDownloadDialog as verdocs_download_dialog,VerdocsEnvelopeDocumentPage as verdocs_envelope_document_page,VerdocsQuestionDialog as verdocs_question_dialog,VerdocsSignFooter as verdocs_sign_footer};
2
2
  //# sourceMappingURL=verdocs-download-dialog_4.entry.js.map
@@ -1,2 +1,2 @@
1
- var __assign=this&&this.__assign||function(){__assign=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++){t=arguments[n];for(var s in t)if(Object.prototype.hasOwnProperty.call(t,s))e[s]=t[s]}return e};return __assign.apply(this,arguments)};var __awaiter=this&&this.__awaiter||function(e,t,n,i){function s(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,r){function o(e){try{l(i.next(e))}catch(e){r(e)}}function a(e){try{l(i["throw"](e))}catch(e){r(e)}}function l(e){e.done?n(e.value):s(e.value).then(o,a)}l((i=i.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var n={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},i,s,r,o=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return o.next=a(0),o["throw"]=a(1),o["return"]=a(2),typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(e){return function(t){return l([e,t])}}function l(a){if(i)throw new TypeError("Generator is already executing.");while(o&&(o=0,a[0]&&(n=0)),n)try{if(i=1,s&&(r=a[0]&2?s["return"]:a[0]?s["throw"]||((r=s["return"])&&r.call(s),0):s.next)&&!(r=r.call(s,a[1])).done)return r;if(s=0,r)a=[a[0]&2,r.value];switch(a[0]){case 0:case 1:r=a;break;case 4:n.label++;return{value:a[1],done:false};case 5:n.label++;s=a[1];a=[0];continue;case 7:a=n.ops.pop();n.trys.pop();continue;default:if(!(r=n.trys,r=r.length>0&&r[r.length-1])&&(a[0]===6||a[0]===2)){n=0;continue}if(a[0]===3&&(!r||a[1]>r[0]&&a[1]<r[3])){n.label=a[1];break}if(a[0]===6&&n.label<r[1]){n.label=r[1];r=a;break}if(r&&n.label<r[2]){n.label=r[2];n.ops.push(a);break}if(r[2])n.ops.pop();n.trys.pop();continue}a=t.call(e,n)}catch(e){a=[6,e];s=0}finally{i=r=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(e,t,n){if(n||arguments.length===2)for(var i=0,s=t.length,r;i<s;i++){if(r||!(i in t)){if(!r)r=Array.prototype.slice.call(t,0,i);r[i]=t[i]}}return e.concat(r||Array.prototype.slice.call(t))};import{r as registerInstance,c as createEvent,h,H as Host}from"./index-BIRwgFLv.js";import{VerdocsEndpoint,getEnvelopes,integerSequence,getRecipientsWithActions,userCanCancelEnvelope,userCanAct,formatFullName,cancelEnvelope}from"@verdocs/js-sdk";import{s as saveEnvelopesAsZip}from"./utils-CPSY5rft.js";import{V as VerdocsToast}from"./Toast-D97GxsI-.js";import{S as SDKError}from"./errors-C1sRVZWv.js";import"./index-dzBXqXlK.js";import"./Types-BqoC0yeA.js";var verdocsEnvelopesListCss='verdocs-envelopes-list{display:-ms-flexbox;display:flex;padding:10px;font-size:18px;-ms-flex-wrap:nowrap;flex-wrap:nowrap;border-radius:6px;color:#33364b;-ms-flex-direction:column;flex-direction:column;font-family:"Inter", "Barlow", sans-serif}@media screen and (max-width: 800px){verdocs-envelopes-list{font-size:14px}}verdocs-envelopes-list .envelope-placeholder{height:48px;-ms-flex:0 0 48px;flex:0 0 48px;margin:5px 0;border-radius:5px;background:#f5f5fa}verdocs-envelopes-list .header{width:100%;row-gap:4px;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;-webkit-column-gap:12px;-moz-column-gap:12px;column-gap:12px;margin:0 0 10px 0;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row}verdocs-envelopes-list .header .filter{width:300px}verdocs-envelopes-list .header verdocs-text-input{margin:0}verdocs-envelopes-list .header verdocs-text-input input{height:32px}verdocs-envelopes-list .filter{-ms-flex-align:center;align-items:center}verdocs-envelopes-list .envelope{width:100%;margin:3px 0;background:#ffffff}verdocs-envelopes-list .envelope:hover{cursor:pointer;background:#f5f5fa}verdocs-envelopes-list .envelope .inner{gap:12px;display:-ms-flexbox;display:flex;padding:8px 14px;border-radius:5px;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center;container-type:inline-size}verdocs-envelopes-list .envelope .inner svg{width:24px;height:24px}verdocs-envelopes-list .vert-spacer{height:50px;display:-ms-flexbox;display:flex;-ms-flex:0 0 1px;flex:0 0 1px;border-right:1px solid #dad8dd}@media screen and (max-width: 800px){verdocs-envelopes-list .vert-spacer{display:none}}@media screen and (max-width: 800px){verdocs-envelopes-list .envelope-icon{display:none}}@media screen and (max-width: 800px){verdocs-envelopes-list verdocs-checkbox{display:none}}verdocs-envelopes-list .last-modified{color:#444;display:-ms-flexbox;display:flex;-ms-flex:0 0 180px;flex:0 0 180px;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center;white-space:nowrap}@media screen and (max-width: 800px){verdocs-envelopes-list .last-modified{display:none}}verdocs-envelopes-list .envelope-name{-ms-flex:1;flex:1;display:-ms-flexbox;display:flex;color:#000000;line-height:28px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}verdocs-envelopes-list .envelope-recipients{color:#4b5563;font-weight:700;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}verdocs-envelopes-list .empty-text{text-align:center;margin:16px 0 0 0;padding:80px 80px;border:2px solid #ccc}verdocs-envelopes-list .containing{gap:12px;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row}@media screen and (max-width: 800px){verdocs-envelopes-list verdocs-status-indicator{font-size:14px}}';var DocumentIcon='<svg xmlns="http://www.w3.org/2000/svg" fill="none" stroke="#000000" viewBox="0 0 24 24" stroke-width="1.5"><path stroke-linecap="round" stroke-linejoin="round" d="M9 12h3.75M9 15h3.75M9 18h3.75m3 .75H18a2.25 2.25 0 002.25-2.25V6.108c0-1.135-.845-2.098-1.976-2.192a48.424 48.424 0 00-1.123-.08m-5.801 0c-.065.21-.1.433-.1.664 0 .414.336.75.75.75h4.5a.75.75 0 00.75-.75 2.25 2.25 0 00-.1-.664m-5.8 0A2.251 2.251 0 0113.5 2.25H15c1.012 0 1.867.668 2.15 1.586m-5.8 0c-.376.023-.75.05-1.124.08C9.095 4.01 8.25 4.973 8.25 6.108V8.25m0 0H4.875c-.621 0-1.125.504-1.125 1.125v11.25c0 .621.504 1.125 1.125 1.125h9.75c.621 0 1.125-.504 1.125-1.125V9.375c0-.621-.504-1.125-1.125-1.125H8.25zM6.75 12h.008v.008H6.75V12zm0 3h.008v.008H6.75V15zm0 3h.008v.008H6.75V18z" /></svg>';var ViewFilters=[{value:"all",label:"All"},{value:"inbox",label:"Inbox"},{value:"sent",label:"Sent"},{value:"completed",label:"Completed"},{value:"action",label:"Action Required"},{value:"waiting",label:"Waiting on Others"}];var StatusFilters=[{value:"all",label:"All"},{value:"pending",label:"Pending"},{value:"in progress",label:"In Progress"},{value:"complete",label:"Completed"},{value:"declined",label:"Declined"},{value:"canceled",label:"Canceled"}];var SortFilters=[{value:"created_at",label:"Created"},{value:"updated_at",label:"Updated"},{value:"canceled_at",label:"Canceled"},{value:"envelope_name",label:"Name"},{value:"envelope_status",label:"Status"}];var VerdocsEnvelopesList=function(){function e(e){registerInstance(this,e);this.changeView=createEvent(this,"changeView");this.changeStatus=createEvent(this,"changeStatus");this.changeSort=createEvent(this,"changeSort");this.changeMatch=createEvent(this,"changeMatch");this.sdkError=createEvent(this,"sdkError");this.viewEnvelope=createEvent(this,"viewEnvelope");this.finishEnvelope=createEvent(this,"finishEnvelope");this.endpoint=VerdocsEndpoint.getDefault();this.view=undefined;this.status="all";this.sort="created_at";this.match="";this.showPagination=true;this.rowsPerPage=10;this.selectedPage=0;this.count=0;this.initiallyLoaded=false;this.loading=true;this.selectedEnvelopes=[];this.envelopes=[]}e.prototype.handleViewUpdated=function(){return this.queryEnvelopes()};e.prototype.handleStatusUpdated=function(){return this.queryEnvelopes()};e.prototype.handleSortUpdated=function(){return this.queryEnvelopes()};e.prototype.handleMatchUpdated=function(){return this.queryEnvelopes()};e.prototype.handlePageUpdated=function(){return this.queryEnvelopes()};e.prototype.componentWillLoad=function(){this.endpoint.onSessionChanged((function(e,t,n){console.log("[ENVELOPES_LIST] onSessionChanged",t,n)}));this.endpoint.loadSession()};e.prototype.componentDidLoad=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:return[4,this.queryEnvelopes()];case 1:e.sent();this.initiallyLoaded=true;return[2]}}))}))};e.prototype.queryEnvelopes=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,n,i,s,r;return __generator(this,(function(o){switch(o.label){case 0:o.trys.push([0,2,,3]);this.loading=true;i={page:this.selectedPage,rows:this.rowsPerPage};switch(this.view){case"all":i=__assign(__assign({},i),{status:this.status==="all"?["pending","in progress","complete","declined","canceled"]:[this.status]});break;case"inbox":i=__assign({},i);break;case"sent":i=__assign({},i);break;case"action":i=__assign(__assign({},i),{status:["pending","in progress"]});break;case"waiting":i=__assign(__assign({},i),{status:["pending","in progress"]});break;case"completed":i=__assign(__assign({},i),{status:["complete"]});break;default:i=__assign(__assign({},i),{status:this.status==="all"?["pending","in progress","complete","declined","canceled"]:[this.status]})}if(this.view==="all"){if(this.status!=="all"){i.status=[this.status]}}if(this.match.trim());return[4,getEnvelopes(this.endpoint,i)];case 1:s=o.sent();this.envelopes=s.envelopes;this.count=s.count;this.loading=false;return[3,3];case 2:r=o.sent();this.loading=false;console.log("[ENVELOPES] Error listing envelopes",r);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new SDKError(r.message,(t=r.response)===null||t===void 0?void 0:t.status,(n=r.response)===null||n===void 0?void 0:n.data));return[3,3];case 3:return[2]}}))}))};e.prototype.handleDownload=function(){var e=this;saveEnvelopesAsZip(this.endpoint,this.selectedEnvelopes).then((function(){e.selectedEnvelopes=[]})).catch((function(e){console.log("[ENVELOPES] Download error",e);VerdocsToast("Download error: "+e.message,{style:"error"})}))};e.prototype.downloadEnvelope=function(e){saveEnvelopesAsZip(this.endpoint,[e]).catch((function(e){console.log("[ENVELOPES] Download error",e);VerdocsToast("Download error: "+e.message,{style:"error"})}))};e.prototype.render=function(){var e=this;return h(Host,{key:"611433a9feffcaca1874a94fce731f4d2898401f"},h("div",{key:"eb108133035825176f5b6013737ad80d54d7c8f3",class:"header"},h("div",{key:"49162b67701c65cb8fadd468110b9feacc92f9d8",class:"filter"},h("verdocs-text-input",{key:"2e24ffdd068714d876f4df52db13c79ecf94bc91",id:"verdocs-filter-name",value:this.match,clearable:true,autocomplete:"off",placeholder:"Filter by Name, Recipient, or Field...",onFocusout:function(t){var n;e.match=t.target.value.trim();(n=e.changeMatch)===null||n===void 0?void 0:n.emit(e.match)}})),h("verdocs-quick-filter",{key:"901a8fa8232ae5b916ab89ae3e6858282e8ecb66",label:"View",value:this.view,options:ViewFilters,onOptionSelected:function(t){e.view=t.detail.value}}),this.view==="all"&&h("verdocs-quick-filter",{key:"a096a0f1cb7e5e670d222e37beaa2c7f88c75bea",label:"Status",value:this.status,options:StatusFilters,onOptionSelected:function(t){e.status=t.detail.value}}),this.view==="all"&&h("verdocs-quick-filter",{key:"0d9ea48f80aa50db5e0cf01dbafcd8165a69aed6",label:"Sort By",value:this.sort,options:SortFilters,onOptionSelected:function(t){e.sort=t.detail.value}}),this.loading&&h("verdocs-spinner",{key:"d1ae1ff162a87e65203b34b58aef048d4b4dedd3",mode:"dark",size:24}),h("div",{key:"f5130409e9986a6f9b064712be38f710e9ce20ec",style:{display:"flex",flex:"1"}}),this.selectedEnvelopes.length>0&&h("verdocs-button",{key:"f6be39ddf8ce0cfdb2f545df8c099b25068c1218",label:"Download (".concat(this.selectedEnvelopes.length,")"),onClick:function(){return e.handleDownload()}})),this.envelopes.map((function(t){var n;var i=getRecipientsWithActions(t);var s=userCanCancelEnvelope(e.endpoint.profile,t);var r=i.find((function(t){var n;return t.email===((n=e.endpoint.session)===null||n===void 0?void 0:n.email)||""}));var o=r&&s&&userCanAct(((n=e.endpoint.session)===null||n===void 0?void 0:n.email)||"",i);var a=[{label:"View Envelope",id:"view"},{label:"Finish Envelope",id:"finish",disabled:!o},{label:"Download",id:"download"},{label:"Cancel",id:"cancel",disabled:!s}];return h("div",{class:"envelope",key:t.id,onClick:function(){var n;return(n=e.viewEnvelope)===null||n===void 0?void 0:n.emit({endpoint:e.endpoint,envelope:t})}},h("div",{class:"inner"},h("verdocs-checkbox",{checked:e.selectedEnvelopes.findIndex((function(e){return e.id===t.id}))!==-1,onClick:function(e){return e.stopPropagation()},onInput:function(n){if(n.target.checked){e.selectedEnvelopes=__spreadArray(__spreadArray([],e.selectedEnvelopes,true),[t],false)}else{e.selectedEnvelopes=e.selectedEnvelopes.filter((function(e){return e.id!==t.id}))}}}),h("div",{class:"vert-spacer"}),h("span",{innerHTML:DocumentIcon,class:"envelope-icon"}),h("div",{class:"envelope-name"},t.name,":  ",h("div",{class:"envelope-recipients"},t.recipients.map((function(e){return formatFullName(e)})))),h("div",{class:"vert-spacer"}),h("verdocs-status-indicator",{envelope:t,style:{width:"125px"}}),h("div",{class:"vert-spacer"}),h("div",{class:"last-modified"},new Date(t.updated_at).toLocaleString()),h("div",{class:"vert-spacer"}),h("verdocs-dropdown",{options:a,onOptionSelected:function(n){var i,s;switch(n.detail.id){case"view":(i=e.viewEnvelope)===null||i===void 0?void 0:i.emit({endpoint:e.endpoint,envelope:t});break;case"finish":(s=e.finishEnvelope)===null||s===void 0?void 0:s.emit({endpoint:e.endpoint,envelope:t});break;case"download":e.downloadEnvelope(t);break;case"cancel":if(window.confirm("Are you sure you want to cancel this envelope?")){cancelEnvelope(e.endpoint,t.id).then((function(){return VerdocsToast("Envelope canceled")})).catch((function(e){return VerdocsToast("Unable to cancel envelope: "+e.messabge,{style:"error"})}));e.queryEnvelopes().catch((function(){}))}break}}})))})),!this.initiallyLoaded&&h("div",{key:"7a33fbdb5c41a07c341cda66c2b4a4468814f8b6",style:{width:"100%"}},integerSequence(0,this.rowsPerPage).map((function(){return h("div",{class:"envelope-placeholder"})}))),this.initiallyLoaded&&!this.envelopes.length&&h("div",{key:"4413485f67724c33e109b625cb24e8d820a2926c",class:"empty-text"},"No matching envelopes found. Please adjust your filters and try again."),this.initiallyLoaded&&this.envelopes.length&&this.showPagination?h("div",{style:{marginTop:"20px"}},h("verdocs-pagination",{selectedPage:this.selectedPage,perPage:this.rowsPerPage,itemCount:this.count,onSelectPage:function(t){e.selectedPage=t.detail.selectedPage}})):h("div",null))};Object.defineProperty(e,"watchers",{get:function(){return{view:["handleViewUpdated"],status:["handleStatusUpdated"],sort:["handleSortUpdated"],match:["handleMatchUpdated"],selectedPage:["handlePageUpdated"]}},enumerable:false,configurable:true});return e}();VerdocsEnvelopesList.style=verdocsEnvelopesListCss;export{VerdocsEnvelopesList as verdocs_envelopes_list};
1
+ var __assign=this&&this.__assign||function(){__assign=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++){t=arguments[n];for(var s in t)if(Object.prototype.hasOwnProperty.call(t,s))e[s]=t[s]}return e};return __assign.apply(this,arguments)};var __awaiter=this&&this.__awaiter||function(e,t,n,i){function s(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,r){function o(e){try{l(i.next(e))}catch(e){r(e)}}function a(e){try{l(i["throw"](e))}catch(e){r(e)}}function l(e){e.done?n(e.value):s(e.value).then(o,a)}l((i=i.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var n={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},i,s,r,o=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return o.next=a(0),o["throw"]=a(1),o["return"]=a(2),typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(e){return function(t){return l([e,t])}}function l(a){if(i)throw new TypeError("Generator is already executing.");while(o&&(o=0,a[0]&&(n=0)),n)try{if(i=1,s&&(r=a[0]&2?s["return"]:a[0]?s["throw"]||((r=s["return"])&&r.call(s),0):s.next)&&!(r=r.call(s,a[1])).done)return r;if(s=0,r)a=[a[0]&2,r.value];switch(a[0]){case 0:case 1:r=a;break;case 4:n.label++;return{value:a[1],done:false};case 5:n.label++;s=a[1];a=[0];continue;case 7:a=n.ops.pop();n.trys.pop();continue;default:if(!(r=n.trys,r=r.length>0&&r[r.length-1])&&(a[0]===6||a[0]===2)){n=0;continue}if(a[0]===3&&(!r||a[1]>r[0]&&a[1]<r[3])){n.label=a[1];break}if(a[0]===6&&n.label<r[1]){n.label=r[1];r=a;break}if(r&&n.label<r[2]){n.label=r[2];n.ops.push(a);break}if(r[2])n.ops.pop();n.trys.pop();continue}a=t.call(e,n)}catch(e){a=[6,e];s=0}finally{i=r=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(e,t,n){if(n||arguments.length===2)for(var i=0,s=t.length,r;i<s;i++){if(r||!(i in t)){if(!r)r=Array.prototype.slice.call(t,0,i);r[i]=t[i]}}return e.concat(r||Array.prototype.slice.call(t))};import{r as registerInstance,c as createEvent,h,H as Host}from"./index-BIRwgFLv.js";import{VerdocsEndpoint,getEnvelopes,integerSequence,getRecipientsWithActions,userCanCancelEnvelope,userCanAct,formatFullName,cancelEnvelope}from"@verdocs/js-sdk";import{s as saveEnvelopesAsZip}from"./utils-Bty_rQI7.js";import{V as VerdocsToast}from"./Toast-D97GxsI-.js";import{S as SDKError}from"./errors-C1sRVZWv.js";import"./index-dzBXqXlK.js";import"./Types-BqoC0yeA.js";var verdocsEnvelopesListCss='verdocs-envelopes-list{display:-ms-flexbox;display:flex;padding:10px;font-size:18px;-ms-flex-wrap:nowrap;flex-wrap:nowrap;border-radius:6px;color:#33364b;-ms-flex-direction:column;flex-direction:column;font-family:"Inter", "Barlow", sans-serif}@media screen and (max-width: 800px){verdocs-envelopes-list{font-size:14px}}verdocs-envelopes-list .envelope-placeholder{height:48px;-ms-flex:0 0 48px;flex:0 0 48px;margin:5px 0;border-radius:5px;background:#f5f5fa}verdocs-envelopes-list .header{width:100%;row-gap:4px;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;-webkit-column-gap:12px;-moz-column-gap:12px;column-gap:12px;margin:0 0 10px 0;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row}verdocs-envelopes-list .header .filter{width:300px}verdocs-envelopes-list .header verdocs-text-input{margin:0}verdocs-envelopes-list .header verdocs-text-input input{height:32px}verdocs-envelopes-list .filter{-ms-flex-align:center;align-items:center}verdocs-envelopes-list .envelope{width:100%;margin:3px 0;background:#ffffff}verdocs-envelopes-list .envelope:hover{cursor:pointer;background:#f5f5fa}verdocs-envelopes-list .envelope .inner{gap:12px;display:-ms-flexbox;display:flex;padding:8px 14px;border-radius:5px;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center;container-type:inline-size}verdocs-envelopes-list .envelope .inner svg{width:24px;height:24px}verdocs-envelopes-list .vert-spacer{height:50px;display:-ms-flexbox;display:flex;-ms-flex:0 0 1px;flex:0 0 1px;border-right:1px solid #dad8dd}@media screen and (max-width: 800px){verdocs-envelopes-list .vert-spacer{display:none}}@media screen and (max-width: 800px){verdocs-envelopes-list .envelope-icon{display:none}}@media screen and (max-width: 800px){verdocs-envelopes-list verdocs-checkbox{display:none}}verdocs-envelopes-list .last-modified{color:#444;display:-ms-flexbox;display:flex;-ms-flex:0 0 180px;flex:0 0 180px;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center;white-space:nowrap}@media screen and (max-width: 800px){verdocs-envelopes-list .last-modified{display:none}}verdocs-envelopes-list .envelope-name{-ms-flex:1;flex:1;display:-ms-flexbox;display:flex;color:#000000;line-height:28px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}verdocs-envelopes-list .envelope-recipients{color:#4b5563;font-weight:700;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}verdocs-envelopes-list .empty-text{text-align:center;margin:16px 0 0 0;padding:80px 80px;border:2px solid #ccc}verdocs-envelopes-list .containing{gap:12px;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row}@media screen and (max-width: 800px){verdocs-envelopes-list verdocs-status-indicator{font-size:14px}}';var DocumentIcon='<svg xmlns="http://www.w3.org/2000/svg" fill="none" stroke="#000000" viewBox="0 0 24 24" stroke-width="1.5"><path stroke-linecap="round" stroke-linejoin="round" d="M9 12h3.75M9 15h3.75M9 18h3.75m3 .75H18a2.25 2.25 0 002.25-2.25V6.108c0-1.135-.845-2.098-1.976-2.192a48.424 48.424 0 00-1.123-.08m-5.801 0c-.065.21-.1.433-.1.664 0 .414.336.75.75.75h4.5a.75.75 0 00.75-.75 2.25 2.25 0 00-.1-.664m-5.8 0A2.251 2.251 0 0113.5 2.25H15c1.012 0 1.867.668 2.15 1.586m-5.8 0c-.376.023-.75.05-1.124.08C9.095 4.01 8.25 4.973 8.25 6.108V8.25m0 0H4.875c-.621 0-1.125.504-1.125 1.125v11.25c0 .621.504 1.125 1.125 1.125h9.75c.621 0 1.125-.504 1.125-1.125V9.375c0-.621-.504-1.125-1.125-1.125H8.25zM6.75 12h.008v.008H6.75V12zm0 3h.008v.008H6.75V15zm0 3h.008v.008H6.75V18z" /></svg>';var ViewFilters=[{value:"all",label:"All"},{value:"inbox",label:"Inbox"},{value:"sent",label:"Sent"},{value:"completed",label:"Completed"},{value:"action",label:"Action Required"},{value:"waiting",label:"Waiting on Others"}];var StatusFilters=[{value:"all",label:"All"},{value:"pending",label:"Pending"},{value:"in progress",label:"In Progress"},{value:"complete",label:"Completed"},{value:"declined",label:"Declined"},{value:"canceled",label:"Canceled"}];var SortFilters=[{value:"created_at",label:"Created"},{value:"updated_at",label:"Updated"},{value:"canceled_at",label:"Canceled"},{value:"envelope_name",label:"Name"},{value:"envelope_status",label:"Status"}];var VerdocsEnvelopesList=function(){function e(e){registerInstance(this,e);this.changeView=createEvent(this,"changeView");this.changeStatus=createEvent(this,"changeStatus");this.changeSort=createEvent(this,"changeSort");this.changeMatch=createEvent(this,"changeMatch");this.sdkError=createEvent(this,"sdkError");this.viewEnvelope=createEvent(this,"viewEnvelope");this.finishEnvelope=createEvent(this,"finishEnvelope");this.endpoint=VerdocsEndpoint.getDefault();this.view=undefined;this.status="all";this.sort="created_at";this.match="";this.showPagination=true;this.rowsPerPage=10;this.selectedPage=0;this.count=0;this.initiallyLoaded=false;this.loading=true;this.selectedEnvelopes=[];this.envelopes=[]}e.prototype.handleViewUpdated=function(){return this.queryEnvelopes()};e.prototype.handleStatusUpdated=function(){return this.queryEnvelopes()};e.prototype.handleSortUpdated=function(){return this.queryEnvelopes()};e.prototype.handleMatchUpdated=function(){return this.queryEnvelopes()};e.prototype.handlePageUpdated=function(){return this.queryEnvelopes()};e.prototype.componentWillLoad=function(){this.endpoint.onSessionChanged((function(e,t,n){console.log("[ENVELOPES_LIST] onSessionChanged",t,n)}));this.endpoint.loadSession()};e.prototype.componentDidLoad=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:return[4,this.queryEnvelopes()];case 1:e.sent();this.initiallyLoaded=true;return[2]}}))}))};e.prototype.queryEnvelopes=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,n,i,s,r;return __generator(this,(function(o){switch(o.label){case 0:o.trys.push([0,2,,3]);this.loading=true;i={page:this.selectedPage,rows:this.rowsPerPage};switch(this.view){case"all":i=__assign(__assign({},i),{status:this.status==="all"?["pending","in progress","complete","declined","canceled"]:[this.status]});break;case"inbox":i=__assign({},i);break;case"sent":i=__assign({},i);break;case"action":i=__assign(__assign({},i),{status:["pending","in progress"]});break;case"waiting":i=__assign(__assign({},i),{status:["pending","in progress"]});break;case"completed":i=__assign(__assign({},i),{status:["complete"]});break;default:i=__assign(__assign({},i),{status:this.status==="all"?["pending","in progress","complete","declined","canceled"]:[this.status]})}if(this.view==="all"){if(this.status!=="all"){i.status=[this.status]}}if(this.match.trim());return[4,getEnvelopes(this.endpoint,i)];case 1:s=o.sent();this.envelopes=s.envelopes;this.count=s.count;this.loading=false;return[3,3];case 2:r=o.sent();this.loading=false;console.log("[ENVELOPES] Error listing envelopes",r);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new SDKError(r.message,(t=r.response)===null||t===void 0?void 0:t.status,(n=r.response)===null||n===void 0?void 0:n.data));return[3,3];case 3:return[2]}}))}))};e.prototype.handleDownload=function(){var e=this;saveEnvelopesAsZip(this.endpoint,this.selectedEnvelopes).then((function(){e.selectedEnvelopes=[]})).catch((function(e){console.log("[ENVELOPES] Download error",e);VerdocsToast("Download error: "+e.message,{style:"error"})}))};e.prototype.downloadEnvelope=function(e){saveEnvelopesAsZip(this.endpoint,[e]).catch((function(e){console.log("[ENVELOPES] Download error",e);VerdocsToast("Download error: "+e.message,{style:"error"})}))};e.prototype.render=function(){var e=this;return h(Host,{key:"611433a9feffcaca1874a94fce731f4d2898401f"},h("div",{key:"eb108133035825176f5b6013737ad80d54d7c8f3",class:"header"},h("div",{key:"49162b67701c65cb8fadd468110b9feacc92f9d8",class:"filter"},h("verdocs-text-input",{key:"2e24ffdd068714d876f4df52db13c79ecf94bc91",id:"verdocs-filter-name",value:this.match,clearable:true,autocomplete:"off",placeholder:"Filter by Name, Recipient, or Field...",onFocusout:function(t){var n;e.match=t.target.value.trim();(n=e.changeMatch)===null||n===void 0?void 0:n.emit(e.match)}})),h("verdocs-quick-filter",{key:"901a8fa8232ae5b916ab89ae3e6858282e8ecb66",label:"View",value:this.view,options:ViewFilters,onOptionSelected:function(t){e.view=t.detail.value}}),this.view==="all"&&h("verdocs-quick-filter",{key:"a096a0f1cb7e5e670d222e37beaa2c7f88c75bea",label:"Status",value:this.status,options:StatusFilters,onOptionSelected:function(t){e.status=t.detail.value}}),this.view==="all"&&h("verdocs-quick-filter",{key:"0d9ea48f80aa50db5e0cf01dbafcd8165a69aed6",label:"Sort By",value:this.sort,options:SortFilters,onOptionSelected:function(t){e.sort=t.detail.value}}),this.loading&&h("verdocs-spinner",{key:"d1ae1ff162a87e65203b34b58aef048d4b4dedd3",mode:"dark",size:24}),h("div",{key:"f5130409e9986a6f9b064712be38f710e9ce20ec",style:{display:"flex",flex:"1"}}),this.selectedEnvelopes.length>0&&h("verdocs-button",{key:"f6be39ddf8ce0cfdb2f545df8c099b25068c1218",label:"Download (".concat(this.selectedEnvelopes.length,")"),onClick:function(){return e.handleDownload()}})),this.envelopes.map((function(t){var n;var i=getRecipientsWithActions(t);var s=userCanCancelEnvelope(e.endpoint.profile,t);var r=i.find((function(t){var n;return t.email===((n=e.endpoint.session)===null||n===void 0?void 0:n.email)||""}));var o=r&&s&&userCanAct(((n=e.endpoint.session)===null||n===void 0?void 0:n.email)||"",i);var a=[{label:"View Envelope",id:"view"},{label:"Finish Envelope",id:"finish",disabled:!o},{label:"Download",id:"download"},{label:"Cancel",id:"cancel",disabled:!s}];return h("div",{class:"envelope",key:t.id,onClick:function(){var n;return(n=e.viewEnvelope)===null||n===void 0?void 0:n.emit({endpoint:e.endpoint,envelope:t})}},h("div",{class:"inner"},h("verdocs-checkbox",{checked:e.selectedEnvelopes.findIndex((function(e){return e.id===t.id}))!==-1,onClick:function(e){return e.stopPropagation()},onInput:function(n){if(n.target.checked){e.selectedEnvelopes=__spreadArray(__spreadArray([],e.selectedEnvelopes,true),[t],false)}else{e.selectedEnvelopes=e.selectedEnvelopes.filter((function(e){return e.id!==t.id}))}}}),h("div",{class:"vert-spacer"}),h("span",{innerHTML:DocumentIcon,class:"envelope-icon"}),h("div",{class:"envelope-name"},t.name,":  ",h("div",{class:"envelope-recipients"},t.recipients.map((function(e){return formatFullName(e)})))),h("div",{class:"vert-spacer"}),h("verdocs-status-indicator",{envelope:t,style:{width:"125px"}}),h("div",{class:"vert-spacer"}),h("div",{class:"last-modified"},new Date(t.updated_at).toLocaleString()),h("div",{class:"vert-spacer"}),h("verdocs-dropdown",{options:a,onOptionSelected:function(n){var i,s;switch(n.detail.id){case"view":(i=e.viewEnvelope)===null||i===void 0?void 0:i.emit({endpoint:e.endpoint,envelope:t});break;case"finish":(s=e.finishEnvelope)===null||s===void 0?void 0:s.emit({endpoint:e.endpoint,envelope:t});break;case"download":e.downloadEnvelope(t);break;case"cancel":if(window.confirm("Are you sure you want to cancel this envelope?")){cancelEnvelope(e.endpoint,t.id).then((function(){return VerdocsToast("Envelope canceled")})).catch((function(e){return VerdocsToast("Unable to cancel envelope: "+e.messabge,{style:"error"})}));e.queryEnvelopes().catch((function(){}))}break}}})))})),!this.initiallyLoaded&&h("div",{key:"7a33fbdb5c41a07c341cda66c2b4a4468814f8b6",style:{width:"100%"}},integerSequence(0,this.rowsPerPage).map((function(){return h("div",{class:"envelope-placeholder"})}))),this.initiallyLoaded&&!this.envelopes.length&&h("div",{key:"4413485f67724c33e109b625cb24e8d820a2926c",class:"empty-text"},"No matching envelopes found. Please adjust your filters and try again."),this.initiallyLoaded&&this.envelopes.length&&this.showPagination?h("div",{style:{marginTop:"20px"}},h("verdocs-pagination",{selectedPage:this.selectedPage,perPage:this.rowsPerPage,itemCount:this.count,onSelectPage:function(t){e.selectedPage=t.detail.selectedPage}})):h("div",null))};Object.defineProperty(e,"watchers",{get:function(){return{view:["handleViewUpdated"],status:["handleStatusUpdated"],sort:["handleSortUpdated"],match:["handleMatchUpdated"],selectedPage:["handlePageUpdated"]}},enumerable:false,configurable:true});return e}();VerdocsEnvelopesList.style=verdocsEnvelopesListCss;export{VerdocsEnvelopesList as verdocs_envelopes_list};
2
2
  //# sourceMappingURL=verdocs-envelopes-list.entry.js.map
@@ -1,2 +1,2 @@
1
- var __assign=this&&this.__assign||function(){__assign=Object.assign||function(e){for(var i,t=1,r=arguments.length;t<r;t++){i=arguments[t];for(var s in i)if(Object.prototype.hasOwnProperty.call(i,s))e[s]=i[s]}return e};return __assign.apply(this,arguments)};var __spreadArray=this&&this.__spreadArray||function(e,i,t){if(t||arguments.length===2)for(var r=0,s=i.length,o;r<s;r++){if(o||!(r in i)){if(!o)o=Array.prototype.slice.call(i,0,r);o[r]=i[r]}}return e.concat(o||Array.prototype.slice.call(i))};import{r as registerInstance,c as createEvent,h,H as Host,g as getElement}from"./index-BIRwgFLv.js";import{integerSequence}from"@verdocs/js-sdk";import{c as renderedTextWidth}from"./utils-CPSY5rft.js";import{c as createPopper}from"./popper-BfP9ezJQ.js";import"./index-dzBXqXlK.js";import"./Types-BqoC0yeA.js";var verdocsPaginationCss='verdocs-pagination{gap:8px;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;font-family:"Inter", "Barlow", sans-serif}verdocs-pagination .page-button{height:38px;display:-ms-flexbox;display:flex;-ms-flex:0 0 38px;flex:0 0 38px;cursor:pointer;font-size:16px;font-weight:600;border-radius:4px;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;color:#33364b;border:1px solid #654dcb}verdocs-pagination .page-button svg{width:18px;height:18px}verdocs-pagination .page-button.selected{cursor:default;color:#ffffff;background:#654dcb}verdocs-pagination .ellipsis{width:38px;height:38px;display:-ms-flexbox;display:flex;-ms-flex:0 0 38px;flex:0 0 38px;line-height:32px;-ms-flex-pack:center;justify-content:center;color:#33364b}';var ChevronDoubleLeft='<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M18.75 19.5l-7.5-7.5 7.5-7.5m-6 15L5.25 12l7.5-7.5" /></svg>';var ChevronDoubleRight='<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M11.25 4.5l7.5 7.5-7.5 7.5m-6-15l7.5 7.5-7.5 7.5" /></svg>';var VISIBLE_PAGES=5;var PageButton=function(e){var i=e.page,t=e.selected,r=e.onClick;var s;if(i==="first"){s=ChevronDoubleLeft}else if(i==="last"){s=ChevronDoubleRight}else{s=String(i+1)}return h("div",{class:"page-button ".concat(i===t?"selected":""),onClick:function(){return r(i)},innerHTML:s})};var VerdocsQuickFilter$1=function(){function e(e){registerInstance(this,e);this.selectPage=createEvent(this,"selectPage");this.selectedPage=0;this.itemCount=1;this.perPage=10}e.prototype.handleSelectPage=function(e){var i;this.selectedPage=e;(i=this.selectPage)===null||i===void 0?void 0:i.emit({selectedPage:e})};e.prototype.render=function(){var e=this;var i=Math.max(0,this.selectedPage-2);var t=this.itemCount>0?Math.ceil(this.itemCount/this.perPage):0;var r=integerSequence(0,Math.ceil(this.itemCount/this.perPage)).slice(i,i+VISIBLE_PAGES);return h(Host,{key:"2ce45159b092a0283f247e7098931fcd34eebb99"},this.selectedPage>0&&h(PageButton,{key:"0bec38eb497b2feef1c98fd73b682f997d68ac5b",page:"first",selected:this.selectedPage,onClick:function(){return e.handleSelectPage(0)}}),i>0&&h("div",{key:"706e4de3571b6b3883df226d300cfb9ae358c8b3",class:"ellipsis"},"..."),r.map((function(i){return h(PageButton,{page:i,selected:e.selectedPage,onClick:function(i){return e.handleSelectPage(+i)}})})),this.selectedPage<t-1&&h("div",{key:"9249824a3700ec561f6707e2a8fc4ebbf2362633",class:"ellipsis"},"..."),this.selectedPage<t-1&&h(PageButton,{key:"d1051af6279d1e864ea39cfd087c7295739e2619",page:"last",selected:this.selectedPage,onClick:function(){return e.handleSelectPage(t-1)}}))};Object.defineProperty(e.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});return e}();VerdocsQuickFilter$1.style=verdocsPaginationCss;var verdocsQuickFilterCss='verdocs-quick-filter{position:relative;font-family:"Inter", "Barlow", sans-serif}verdocs-quick-filter .control{outline:0;height:34px;display:-ms-flexbox;display:flex;cursor:pointer;border-radius:4px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;-webkit-box-sizing:border-box;box-sizing:border-box;background:#ffffff;-webkit-transition:all 100ms ease 0s;transition:all 100ms ease 0s;border:1px solid #cccccc}verdocs-quick-filter .title{padding:0 8px;font-size:14px;max-width:100%;overflow:hidden;color:#33364b;white-space:nowrap;-webkit-box-sizing:border-box;box-sizing:border-box;text-overflow:ellipsis}verdocs-quick-filter .title .prefix{display:inline;font-weight:700;margin:0 7px 0 0;color:#4c56cb}verdocs-quick-filter .arrow{width:32px;height:32px;border:none;outline:none;cursor:pointer;-ms-flex-align:center;align-items:center;display:-ms-inline-flexbox;display:inline-flex;-ms-flex-pack:center;justify-content:center;background:#ffffff;-webkit-transition:color 150ms ease 0s;transition:color 150ms ease 0s}verdocs-quick-filter .arrow svg{-webkit-transition:0.3s;transition:0.3s;fill:#cccccc}verdocs-quick-filter .separator{width:1px;display:block;margin-top:8px;margin-bottom:8px;-ms-flex-item-align:stretch;align-self:stretch;-webkit-box-sizing:border-box;box-sizing:border-box;background-color:#cccccc}verdocs-quick-filter .items{display:none;z-index:10000;position:absolute;border-radius:4px;background:#ffffff;-webkit-box-shadow:rgba(0, 0, 0, 0.1) 0 0 0 1px, rgba(0, 0, 0, 0.1) 0 4px 11px;box-shadow:rgba(0, 0, 0, 0.1) 0 0 0 1px, rgba(0, 0, 0, 0.1) 0 4px 11px}verdocs-quick-filter .items[data-show]{display:block}verdocs-quick-filter .option{width:100%;border:none;display:block;font-size:14px;text-align:left;background:none;padding:10px 20px;color:#1e2031}verdocs-quick-filter .option:hover{cursor:pointer;background:rgba(76, 86, 203, 0.2470588235)}verdocs-quick-filter .option[disabled]{color:#aaaaaa}verdocs-quick-filter .option[disabled]:hover{cursor:inherit;background:transparent;color:#aaaaaa}verdocs-quick-filter.open .items{display:block}verdocs-quick-filter.open .arrow svg{-webkit-transform:scaleY(-1);transform:scaleY(-1)}';var DropdownArrow='<svg height="20" width="20" viewBox="0 0 20 20" aria-hidden="true" focusable="false" class="css-8mmkcg"><path d="M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"></path></svg>';var VerdocsQuickFilter=function(){function e(e){registerInstance(this,e);this.optionSelected=createEvent(this,"optionSelected");this.options=[];this.label="Filter";this.value="";this.placeholder="Select...";this.clickListenerSymbol=new AbortController}e.prototype.componentDidLoad=function(){this.popper=createPopper(this.dropdownButton,this.dropdownMenu,{placement:"bottom-start",modifiers:[{name:"offset",options:{offset:[-1,14]}}]});window.addEventListener("click",this.clickListener.bind(this),{signal:this.clickListenerSymbol.signal})};e.prototype.disconnectedCallback=function(){this.clickListenerSymbol.abort()};e.prototype.clickListener=function(e){var i=!(e.target==this.el||this.el.contains(e.target));if(i){this.hide()}};e.prototype.handleSelectOption=function(e,i){e.stopPropagation();this.optionSelected.emit(i);this.value=i.value;this.hide()};e.prototype.showDropdown=function(){var e,i;this.open=true;this.dropdownMenu.setAttribute("data-show","");this.dropdownMenu.removeAttribute("aria-hidden");(e=this.popper)===null||e===void 0?void 0:e.setOptions((function(e){return __assign(__assign({},e),{modifiers:__spreadArray(__spreadArray([],e.modifiers,true),[{name:"eventListeners",enabled:true}],false)})})).catch((function(){}));(i=this.popper)===null||i===void 0?void 0:i.update().catch((function(){}))};e.prototype.handleHideDropdown=function(e){var i,t;if(((i=e===null||e===void 0?void 0:e.target)===null||i===void 0?void 0:i.localName)==="button"&&((t=e===null||e===void 0?void 0:e.target)===null||t===void 0?void 0:t.className)==="arrow"){return}this.hide()};e.prototype.toggleDropdown=function(e){e.stopPropagation();if(this.open){this.hide()}else{this.showDropdown()}};e.prototype.hide=function(){var e;this.open=false;this.dropdownMenu.removeAttribute("data-show");this.dropdownMenu.setAttribute("aria-hidden","true");(e=this.popper)===null||e===void 0?void 0:e.setOptions((function(e){return __assign(__assign({},e),{modifiers:__spreadArray(__spreadArray([],e.modifiers,true),[{name:"eventListeners",enabled:false}],false)})})).catch((function(){}))};e.prototype.render=function(){var e=this;var i,t,r;var s=(i=this.options)===null||i===void 0?void 0:i.find((function(i){return i.value===e.value}));var o=(t=this.options)===null||t===void 0?void 0:t.reduce((function(e,i){return e.label.length>i.label.length?e:i}));var n=renderedTextWidth((o===null||o===void 0?void 0:o.label)||"FILLER","14px Inter, Barlow, sans-serif");var a=renderedTextWidth(this.label,"14px Inter, Barlow, sans-serif");var c="".concat(n+a+40,"px");return h(Host,{key:"1c36fa8fc641b1ea151674355b821055a3b4cc30",class:{open:!!this.open},style:{minWidth:c,display:"inline-block"}},h("div",{key:"ed2bf8915fdd7edb695d52e53db76797a12bc33f",class:"control",onClick:function(i){return e.toggleDropdown(i)},onBlur:function(i){return e.handleHideDropdown(i)}},h("div",{key:"0dd12d9a579fe290bd4e4becd3c0ed64c4484283",class:"title",ref:function(i){return e.dropdownButton=i}},h("span",{key:"cf826e7133f800846d17e50200777f3d5fb1e61e",class:"prefix"},this.label,":"),s?s.label:this.placeholder),h("div",{key:"333f6a9b3d788f280e03b53a87256b37c5428642",style:{flex:"1"}}),h("div",{key:"901cf0e9924f257d8e2499e9233f209a3665206c",class:"separator"}),h("div",{key:"0bab9931c19151fd63452e18c0f4ddb9ec76863a",class:"arrow",innerHTML:DropdownArrow,"aria-label":"Open Menu"})),h("div",{key:"ee83f08945fa61bf413ab231f55c0e34a0ae75c8",class:"items","aria-hidden":!this.open,ref:function(i){return e.dropdownMenu=i},style:{minWidth:c}},(r=this.options)===null||r===void 0?void 0:r.map((function(i){return i.label?h("button",{onClick:function(t){return e.handleSelectOption(t,i)},class:"option ".concat(i.value===e.value?"selected":""),disabled:i.disabled},i.label):h("div",{class:"separator"})}))))};Object.defineProperty(e.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});return e}();VerdocsQuickFilter.style=verdocsQuickFilterCss;export{VerdocsQuickFilter$1 as verdocs_pagination,VerdocsQuickFilter as verdocs_quick_filter};
1
+ var __assign=this&&this.__assign||function(){__assign=Object.assign||function(e){for(var i,t=1,r=arguments.length;t<r;t++){i=arguments[t];for(var s in i)if(Object.prototype.hasOwnProperty.call(i,s))e[s]=i[s]}return e};return __assign.apply(this,arguments)};var __spreadArray=this&&this.__spreadArray||function(e,i,t){if(t||arguments.length===2)for(var r=0,s=i.length,o;r<s;r++){if(o||!(r in i)){if(!o)o=Array.prototype.slice.call(i,0,r);o[r]=i[r]}}return e.concat(o||Array.prototype.slice.call(i))};import{r as registerInstance,c as createEvent,h,H as Host,g as getElement}from"./index-BIRwgFLv.js";import{integerSequence}from"@verdocs/js-sdk";import{c as renderedTextWidth}from"./utils-Bty_rQI7.js";import{c as createPopper}from"./popper-BfP9ezJQ.js";import"./index-dzBXqXlK.js";import"./Types-BqoC0yeA.js";var verdocsPaginationCss='verdocs-pagination{gap:8px;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;font-family:"Inter", "Barlow", sans-serif}verdocs-pagination .page-button{height:38px;display:-ms-flexbox;display:flex;-ms-flex:0 0 38px;flex:0 0 38px;cursor:pointer;font-size:16px;font-weight:600;border-radius:4px;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;color:#33364b;border:1px solid #654dcb}verdocs-pagination .page-button svg{width:18px;height:18px}verdocs-pagination .page-button.selected{cursor:default;color:#ffffff;background:#654dcb}verdocs-pagination .ellipsis{width:38px;height:38px;display:-ms-flexbox;display:flex;-ms-flex:0 0 38px;flex:0 0 38px;line-height:32px;-ms-flex-pack:center;justify-content:center;color:#33364b}';var ChevronDoubleLeft='<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M18.75 19.5l-7.5-7.5 7.5-7.5m-6 15L5.25 12l7.5-7.5" /></svg>';var ChevronDoubleRight='<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M11.25 4.5l7.5 7.5-7.5 7.5m-6-15l7.5 7.5-7.5 7.5" /></svg>';var VISIBLE_PAGES=5;var PageButton=function(e){var i=e.page,t=e.selected,r=e.onClick;var s;if(i==="first"){s=ChevronDoubleLeft}else if(i==="last"){s=ChevronDoubleRight}else{s=String(i+1)}return h("div",{class:"page-button ".concat(i===t?"selected":""),onClick:function(){return r(i)},innerHTML:s})};var VerdocsQuickFilter$1=function(){function e(e){registerInstance(this,e);this.selectPage=createEvent(this,"selectPage");this.selectedPage=0;this.itemCount=1;this.perPage=10}e.prototype.handleSelectPage=function(e){var i;this.selectedPage=e;(i=this.selectPage)===null||i===void 0?void 0:i.emit({selectedPage:e})};e.prototype.render=function(){var e=this;var i=Math.max(0,this.selectedPage-2);var t=this.itemCount>0?Math.ceil(this.itemCount/this.perPage):0;var r=integerSequence(0,Math.ceil(this.itemCount/this.perPage)).slice(i,i+VISIBLE_PAGES);return h(Host,{key:"2ce45159b092a0283f247e7098931fcd34eebb99"},this.selectedPage>0&&h(PageButton,{key:"0bec38eb497b2feef1c98fd73b682f997d68ac5b",page:"first",selected:this.selectedPage,onClick:function(){return e.handleSelectPage(0)}}),i>0&&h("div",{key:"706e4de3571b6b3883df226d300cfb9ae358c8b3",class:"ellipsis"},"..."),r.map((function(i){return h(PageButton,{page:i,selected:e.selectedPage,onClick:function(i){return e.handleSelectPage(+i)}})})),this.selectedPage<t-1&&h("div",{key:"9249824a3700ec561f6707e2a8fc4ebbf2362633",class:"ellipsis"},"..."),this.selectedPage<t-1&&h(PageButton,{key:"d1051af6279d1e864ea39cfd087c7295739e2619",page:"last",selected:this.selectedPage,onClick:function(){return e.handleSelectPage(t-1)}}))};Object.defineProperty(e.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});return e}();VerdocsQuickFilter$1.style=verdocsPaginationCss;var verdocsQuickFilterCss='verdocs-quick-filter{position:relative;font-family:"Inter", "Barlow", sans-serif}verdocs-quick-filter .control{outline:0;height:34px;display:-ms-flexbox;display:flex;cursor:pointer;border-radius:4px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;-webkit-box-sizing:border-box;box-sizing:border-box;background:#ffffff;-webkit-transition:all 100ms ease 0s;transition:all 100ms ease 0s;border:1px solid #cccccc}verdocs-quick-filter .title{padding:0 8px;font-size:14px;max-width:100%;overflow:hidden;color:#33364b;white-space:nowrap;-webkit-box-sizing:border-box;box-sizing:border-box;text-overflow:ellipsis}verdocs-quick-filter .title .prefix{display:inline;font-weight:700;margin:0 7px 0 0;color:#4c56cb}verdocs-quick-filter .arrow{width:32px;height:32px;border:none;outline:none;cursor:pointer;-ms-flex-align:center;align-items:center;display:-ms-inline-flexbox;display:inline-flex;-ms-flex-pack:center;justify-content:center;background:#ffffff;-webkit-transition:color 150ms ease 0s;transition:color 150ms ease 0s}verdocs-quick-filter .arrow svg{-webkit-transition:0.3s;transition:0.3s;fill:#cccccc}verdocs-quick-filter .separator{width:1px;display:block;margin-top:8px;margin-bottom:8px;-ms-flex-item-align:stretch;align-self:stretch;-webkit-box-sizing:border-box;box-sizing:border-box;background-color:#cccccc}verdocs-quick-filter .items{display:none;z-index:10000;position:absolute;border-radius:4px;background:#ffffff;-webkit-box-shadow:rgba(0, 0, 0, 0.1) 0 0 0 1px, rgba(0, 0, 0, 0.1) 0 4px 11px;box-shadow:rgba(0, 0, 0, 0.1) 0 0 0 1px, rgba(0, 0, 0, 0.1) 0 4px 11px}verdocs-quick-filter .items[data-show]{display:block}verdocs-quick-filter .option{width:100%;border:none;display:block;font-size:14px;text-align:left;background:none;padding:10px 20px;color:#1e2031}verdocs-quick-filter .option:hover{cursor:pointer;background:rgba(76, 86, 203, 0.2470588235)}verdocs-quick-filter .option[disabled]{color:#aaaaaa}verdocs-quick-filter .option[disabled]:hover{cursor:inherit;background:transparent;color:#aaaaaa}verdocs-quick-filter.open .items{display:block}verdocs-quick-filter.open .arrow svg{-webkit-transform:scaleY(-1);transform:scaleY(-1)}';var DropdownArrow='<svg height="20" width="20" viewBox="0 0 20 20" aria-hidden="true" focusable="false" class="css-8mmkcg"><path d="M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"></path></svg>';var VerdocsQuickFilter=function(){function e(e){registerInstance(this,e);this.optionSelected=createEvent(this,"optionSelected");this.options=[];this.label="Filter";this.value="";this.placeholder="Select...";this.clickListenerSymbol=new AbortController}e.prototype.componentDidLoad=function(){this.popper=createPopper(this.dropdownButton,this.dropdownMenu,{placement:"bottom-start",modifiers:[{name:"offset",options:{offset:[-1,14]}}]});window.addEventListener("click",this.clickListener.bind(this),{signal:this.clickListenerSymbol.signal})};e.prototype.disconnectedCallback=function(){this.clickListenerSymbol.abort()};e.prototype.clickListener=function(e){var i=!(e.target==this.el||this.el.contains(e.target));if(i){this.hide()}};e.prototype.handleSelectOption=function(e,i){e.stopPropagation();this.optionSelected.emit(i);this.value=i.value;this.hide()};e.prototype.showDropdown=function(){var e,i;this.open=true;this.dropdownMenu.setAttribute("data-show","");this.dropdownMenu.removeAttribute("aria-hidden");(e=this.popper)===null||e===void 0?void 0:e.setOptions((function(e){return __assign(__assign({},e),{modifiers:__spreadArray(__spreadArray([],e.modifiers,true),[{name:"eventListeners",enabled:true}],false)})})).catch((function(){}));(i=this.popper)===null||i===void 0?void 0:i.update().catch((function(){}))};e.prototype.handleHideDropdown=function(e){var i,t;if(((i=e===null||e===void 0?void 0:e.target)===null||i===void 0?void 0:i.localName)==="button"&&((t=e===null||e===void 0?void 0:e.target)===null||t===void 0?void 0:t.className)==="arrow"){return}this.hide()};e.prototype.toggleDropdown=function(e){e.stopPropagation();if(this.open){this.hide()}else{this.showDropdown()}};e.prototype.hide=function(){var e;this.open=false;this.dropdownMenu.removeAttribute("data-show");this.dropdownMenu.setAttribute("aria-hidden","true");(e=this.popper)===null||e===void 0?void 0:e.setOptions((function(e){return __assign(__assign({},e),{modifiers:__spreadArray(__spreadArray([],e.modifiers,true),[{name:"eventListeners",enabled:false}],false)})})).catch((function(){}))};e.prototype.render=function(){var e=this;var i,t,r;var s=(i=this.options)===null||i===void 0?void 0:i.find((function(i){return i.value===e.value}));var o=(t=this.options)===null||t===void 0?void 0:t.reduce((function(e,i){return e.label.length>i.label.length?e:i}));var n=renderedTextWidth((o===null||o===void 0?void 0:o.label)||"FILLER","14px Inter, Barlow, sans-serif");var a=renderedTextWidth(this.label,"14px Inter, Barlow, sans-serif");var c="".concat(n+a+40,"px");return h(Host,{key:"1c36fa8fc641b1ea151674355b821055a3b4cc30",class:{open:!!this.open},style:{minWidth:c,display:"inline-block"}},h("div",{key:"ed2bf8915fdd7edb695d52e53db76797a12bc33f",class:"control",onClick:function(i){return e.toggleDropdown(i)},onBlur:function(i){return e.handleHideDropdown(i)}},h("div",{key:"0dd12d9a579fe290bd4e4becd3c0ed64c4484283",class:"title",ref:function(i){return e.dropdownButton=i}},h("span",{key:"cf826e7133f800846d17e50200777f3d5fb1e61e",class:"prefix"},this.label,":"),s?s.label:this.placeholder),h("div",{key:"333f6a9b3d788f280e03b53a87256b37c5428642",style:{flex:"1"}}),h("div",{key:"901cf0e9924f257d8e2499e9233f209a3665206c",class:"separator"}),h("div",{key:"0bab9931c19151fd63452e18c0f4ddb9ec76863a",class:"arrow",innerHTML:DropdownArrow,"aria-label":"Open Menu"})),h("div",{key:"ee83f08945fa61bf413ab231f55c0e34a0ae75c8",class:"items","aria-hidden":!this.open,ref:function(i){return e.dropdownMenu=i},style:{minWidth:c}},(r=this.options)===null||r===void 0?void 0:r.map((function(i){return i.label?h("button",{onClick:function(t){return e.handleSelectOption(t,i)},class:"option ".concat(i.value===e.value?"selected":""),disabled:i.disabled},i.label):h("div",{class:"separator"})}))))};Object.defineProperty(e.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});return e}();VerdocsQuickFilter.style=verdocsQuickFilterCss;export{VerdocsQuickFilter$1 as verdocs_pagination,VerdocsQuickFilter as verdocs_quick_filter};
2
2
  //# sourceMappingURL=verdocs-pagination_2.entry.js.map
@@ -1,4 +1,4 @@
1
- var __assign=this&&this.__assign||function(){__assign=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var o in t)if(Object.prototype.hasOwnProperty.call(t,o))e[o]=t[o]}return e};return __assign.apply(this,arguments)};var __awaiter=this&&this.__awaiter||function(e,t,n,r){function o(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,i){function s(e){try{l(r.next(e))}catch(e){i(e)}}function a(e){try{l(r["throw"](e))}catch(e){i(e)}}function l(e){e.done?n(e.value):o(e.value).then(s,a)}l((r=r.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,o,i,s=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return s.next=a(0),s["throw"]=a(1),s["return"]=a(2),typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(e){return function(t){return l([e,t])}}function l(a){if(r)throw new TypeError("Generator is already executing.");while(s&&(s=0,a[0]&&(n=0)),n)try{if(r=1,o&&(i=a[0]&2?o["return"]:a[0]?o["throw"]||((i=o["return"])&&i.call(o),0):o.next)&&!(i=i.call(o,a[1])).done)return i;if(o=0,i)a=[a[0]&2,i.value];switch(a[0]){case 0:case 1:i=a;break;case 4:n.label++;return{value:a[1],done:false};case 5:n.label++;o=a[1];a=[0];continue;case 7:a=n.ops.pop();n.trys.pop();continue;default:if(!(i=n.trys,i=i.length>0&&i[i.length-1])&&(a[0]===6||a[0]===2)){n=0;continue}if(a[0]===3&&(!i||a[1]>i[0]&&a[1]<i[3])){n.label=a[1];break}if(a[0]===6&&n.label<i[1]){n.label=i[1];i=a;break}if(i&&n.label<i[2]){n.label=i[2];n.ops.push(a);break}if(i[2])n.ops.pop();n.trys.pop();continue}a=t.call(e,n)}catch(e){a=[6,e];o=0}finally{r=i=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,i;r<o;r++){if(i||!(r in t)){if(!i)i=Array.prototype.slice.call(t,0,r);i[r]=t[r]}}return e.concat(i||Array.prototype.slice.call(t))};import{r as registerInstance,c as createEvent,h,H as Host,F as Fragment,g as getElement}from"./index-BIRwgFLv.js";import{i as interact}from"./interact.min-BepJAdBZ.js";import{VerdocsEndpoint,getTemplate,integerSequence,getOrganizationContacts,isValidEmail,createEnvelope,formatFullName,getRGBA,createTemplateDocument,deleteTemplateDocument,updateField,createField,updateTemplateRole,createTemplateRole}from"@verdocs/js-sdk";import{a as renderDocumentField,g as getFieldId,h as updateCssTransform,i as removeCssTransform,j as setControlStyles,d as defaultHeight,k as defaultWidth}from"./utils-CPSY5rft.js";import{S as SDKError}from"./errors-C1sRVZWv.js";import{S as Store}from"./Datastore-C7hFgM52.js";import{D as DefaultEndpoint}from"./Environment-C_Xku1v2.js";import{V as VerdocsToast}from"./Toast-D97GxsI-.js";import{a as DocIcon,P as PngIcon,J as JpgIcon,b as PdfIcon,F as FileIcon,c as PageCountIcon,T as TrashIcon,D as DocumentPageIcon}from"./Icons-BU5rnXp2.js";import"./_commonjsHelpers-BFTU3MAI.js";import"./index-dzBXqXlK.js";import"./Types-BqoC0yeA.js";var verdocsPreviewCss='verdocs-preview{font-family:var(--verdocs-primary-font, "Inter", "Barlow", sans-serif);display:-ms-flexbox;display:flex;padding:15px;row-gap:15px;min-height:200px;position:relative;-ms-flex-align:center;align-items:center;-webkit-box-sizing:border-box;box-sizing:border-box;-ms-flex-direction:column;flex-direction:column}verdocs-preview div,verdocs-preview canvas{-webkit-box-sizing:border-box;box-sizing:border-box}';var VerdocsPreview=function(){function e(e){registerInstance(this,e);this.sdkError=createEvent(this,"sdkError");this.templateListenerId=null;this.renderedPages={};this.endpoint=VerdocsEndpoint.getDefault();this.templateId=null;this.loading=true;this.template=null}e.prototype.disconnectedCallback=function(){this.unlistenToTemplate()};e.prototype.listenToTemplate=function(){return __awaiter(this,void 0,void 0,(function(){var e=this;return __generator(this,(function(t){this.unlistenToTemplate();Store.subscribe("templates",this.templateId,(function(){return getTemplate(e.endpoint,e.templateId)}),false,(function(t){e.template=t;e.loading=false}));return[2]}))}))};e.prototype.unlistenToTemplate=function(){if(this.templateListenerId){Store.store.delListener(this.templateListenerId);this.templateListenerId=null}};e.prototype.onTemplateIdChanged=function(e){console.log("[PREVIEW] Template ID changed",e);this.listenToTemplate()};e.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,n;return __generator(this,(function(r){try{this.endpoint.loadSession();if(!this.endpoint.session){console.log("[PREVIEW] Unable to start builder session, must be authenticated");return[2]}if(!this.templateId){console.log("[PREVIEW] Missing required template ID ".concat(this.templateId));return[2]}this.listenToTemplate()}catch(r){console.log("[PREVIEW] Error with preview session",r);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new SDKError(r.message,(t=r.response)===null||t===void 0?void 0:t.status,(n=r.response)===null||n===void 0?void 0:n.data))}return[2]}))}))};e.prototype.componentDidRender=function(){var e;(e=this.hostEl)===null||e===void 0?void 0:e.querySelectorAll(".verdocs-field").forEach((function(e){interact(e).unset()}))};e.prototype.handlePageRendered=function(e){var t;var n=e.detail;this.renderedPages["".concat(n.documentId,":").concat(n.pageNumber)]=n;var r=(((t=this.template)===null||t===void 0?void 0:t.fields)||[]).filter((function(e){if(e["document_id"]){return e["document_id"]===n.documentId&&e.page===n.pageNumber}return e.page===n.pageNumber}));r.forEach((function(e){return renderDocumentField("template",e,n,{disabled:true,editable:false,draggable:false})}))};e.prototype.render=function(){var e=this;var t;if(this.loading){return h(Host,null,h("verdocs-loader",null))}return h(Host,null,(((t=this.template)===null||t===void 0?void 0:t.documents)||[]).map((function(t){var n=integerSequence(1,t.pages);return h(Fragment,null,n.map((function(n){var r;var o=((r=t.page_sizes)===null||r===void 0?void 0:r[n])||{width:612,height:792};return h("verdocs-template-document-page",{templateId:t.template_id,documentId:t.id,pageNumber:n,disabled:true,editable:false,done:false,virtualWidth:o.width,virtualHeight:o.height,onPageRendered:function(t){return e.handlePageRendered(t)},layers:[{name:"page",type:"canvas"},{name:"controls",type:"div"}]})})))})))};Object.defineProperty(e.prototype,"hostEl",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{templateId:["onTemplateIdChanged"]}},enumerable:false,configurable:true});return e}();VerdocsPreview.style=verdocsPreviewCss;var getRoleNames=function(e){return((e===null||e===void 0?void 0:e.roles)||[]).map((function(e){return e.name}))};var getRoleIndex=function(e,t){return Math.max(getRoleNames(e).findIndex((function(e){return e===t})),0)};var verdocsSendCss='verdocs-send{padding:10px;position:relative;background:#ffffff;-ms-flex-direction:column;flex-direction:column;font-family:var(--verdocs-primary-font, "Inter", "Barlow", sans-serif)}verdocs-send.sendable{display:-ms-flexbox;display:flex}verdocs-send .recipients{position:relative}verdocs-send .left-line{top:32px;left:20px;z-index:1;width:12px;bottom:30px;position:absolute;background:#ffffff;border-left:3px dotted #9b9b9b}verdocs-send .level{display:-ms-flexbox;display:flex;-webkit-column-gap:10px;-moz-column-gap:10px;column-gap:10px;margin-left:50px;position:relative;-ms-flex-direction:row;flex-direction:row;padding:8px 0 4px 0;border-bottom:1px solid rgba(151, 151, 151, 0.2666666667)}verdocs-send .level .level-icon{top:14px;z-index:2;left:-40px;width:24px;height:24px;position:absolute;background:#ffffff}verdocs-send .level .level-icon svg{fill:rgba(0, 0, 0, 0.537254902)}verdocs-send .level .recipient{height:30px;display:-ms-flexbox;display:flex;-ms-flex:0 0 30px;flex:0 0 30px;color:#000000;cursor:pointer;font-size:14px;-ms-flex-align:center;align-items:center;border-radius:30px;-ms-flex-direction:row;flex-direction:row;background:#dddddd;white-space:nowrap;border:2px solid #dddddd;padding:2px 10px 2px 14px}verdocs-send .level .recipient .icon{width:22px;height:22px;-ms-flex:0 0 22px;flex:0 0 22px;margin:0 0 0 10px}verdocs-send .level .recipient .icon svg{width:22px;height:22px;fill:#333333;outline:none}verdocs-send .level .complete{-ms-flex:1;flex:1;height:30px;display:-ms-flexbox;display:flex;color:#000000;font-size:14px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;padding:3px 10px 3px 2px}verdocs-send .buttons{display:-ms-flexbox;display:flex;margin-top:10px;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;-ms-flex-wrap:wrap;flex-wrap:wrap;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center}verdocs-send .buttons .error-message{width:100%;color:#cc0000;font-size:13px;margin-bottom:10px}verdocs-send verdocs-contact-picker{left:0;top:41px;z-index:10;position:absolute;border:1px solid #dddddd;-webkit-box-shadow:0 0 6px 3px rgba(0, 0, 0, 0.1);box-shadow:0 0 6px 3px rgba(0, 0, 0, 0.1)}';var editIcon='<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" tabindex="-1"><path d="M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34a.9959.9959 0 0 0-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z"></path></svg>';var startIcon='<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" tabindex="-1"><path d="M2 12C2 6.48 6.48 2 12 2s10 4.48 10 10-4.48 10-10 10S2 17.52 2 12zm10 6c3.31 0 6-2.69 6-6s-2.69-6-6-6-6 2.69-6 6 2.69 6 6 6z"></path></svg>';var stepIcon='<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" tabindex="-1"><path d="M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z"></path></svg>';var doneIcon='<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" tabindex="-1"><path d="m18 7-1.41-1.41-6.34 6.34 1.41 1.41L18 7zm4.24-1.41L11.66 16.17 7.48 12l-1.41 1.41L11.66 19l12-12-1.42-1.41zM.41 13.41 6 19l1.41-1.41L1.83 12 .41 13.41z"></path></svg>';var VerdocsSend=function(){function e(e){registerInstance(this,e);this.beforeSend=createEvent(this,"beforeSend");this.send=createEvent(this,"send");this.exit=createEvent(this,"exit");this.sdkError=createEvent(this,"sdkError");this.searchContacts=createEvent(this,"searchContacts");this.templateListenerId=null;this.endpoint=DefaultEndpoint;this.templateId=null;this.environment="";this.showCancel=true;this.containerId="verdocs-send-".concat(Math.random().toString(36).substring(2,11));this.showPickerForId="";this.sessionContacts=[];this.sending=false;this.rolesCompleted={};this.loading=true;this.template=null}e.prototype.disconnectedCallback=function(){this.unlistenToTemplate()};e.prototype.listenToTemplate=function(){return __awaiter(this,void 0,void 0,(function(){var e=this;return __generator(this,(function(t){console.log("[SEND] Loading template",this.templateId);this.unlistenToTemplate();Store.subscribe("templates",this.templateId,(function(){return getTemplate(e.endpoint,e.templateId)}),true,(function(t){console.log("[SEND] Got new template",t);e.template=t;e.loading=false;e.rolesCompleted={};e.recomputeRolesCompleted()}));return[2]}))}))};e.prototype.unlistenToTemplate=function(){if(this.templateListenerId){Store.store.delListener(this.templateListenerId);this.templateListenerId=null}};e.prototype.reset=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){this.rolesCompleted={};return[2]}))}))};e.prototype.onTemplateIdChanged=function(e){console.log("[SEND] Template ID changed",e);this.listenToTemplate()};e.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,n;var r=this;return __generator(this,(function(o){try{this.endpoint.onSessionChanged((function(e,t,n){if(!n){return}var o={id:n.id,first_name:n.first_name,last_name:n.last_name,email:n.email,phone:n.phone};if(n){r.sessionContacts=[o];getOrganizationContacts(r.endpoint).then((function(e){console.log("[SEND] Got contacts",e);r.sessionContacts=__spreadArray(__spreadArray([],e,true),[o],false)})).catch((function(e){console.log("[SEND] Error getting contacts",e)}))}}));this.endpoint.loadSession();if(!this.endpoint.session){console.log("[SEND] Unable to start Send operation, must be authenticated");return[2]}if(!this.templateId){console.log("[SEND] Missing required template ID ".concat(this.templateId));return[2]}this.listenToTemplate()}catch(r){console.log("[SEND] Error with send session",r);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new SDKError(r.message,(t=r.response)===null||t===void 0?void 0:t.status,(n=r.response)===null||n===void 0?void 0:n.data))}return[2]}))}))};e.prototype.recomputeRolesCompleted=function(){var e=this;var t;this.rolesCompleted={};var n={};(((t=this.template)===null||t===void 0?void 0:t.roles)||[]).forEach((function(t){var r=t.sequence;n[r]||(n[r]=[]);var o="r-".concat(r,"-").concat(n[r].length);n[r].push(__assign(__assign({},t),{id:o,role_name:t.name,first_name:t.first_name,last_name:t.last_name}));if(t.first_name&&isValidEmail(t.email)){e.rolesCompleted[o]=__assign(__assign({},t),{id:o,role_name:t.name,first_name:t.first_name,last_name:t.last_name})}}))};e.prototype.getSequenceNumbers=function(){var e;var t={};(((e=this.template)===null||e===void 0?void 0:e.roles)||[]).forEach((function(e){t[e.sequence]=true}));return Object.keys(t).map((function(e){return+e})).sort((function(e,t){return e-t}))};e.prototype.getRolesAtLevel=function(e){var t;var n=(((t=this.template)===null||t===void 0?void 0:t.roles)||[]).filter((function(t){return t.sequence===e})).map((function(t,n){return __assign(__assign({},t),{id:"r-".concat(e,"-").concat(n),role_name:t.name,first_name:t.first_name,last_name:t.last_name})}));return n};e.prototype.getLevelIcon=function(e){if(e==="start"){return h("div",{class:"level-icon",innerHTML:startIcon})}else if(e==="end"){return h("div",{class:"level-icon",innerHTML:doneIcon})}else{return h("div",{class:"level-icon",innerHTML:stepIcon})}};e.prototype.handleSelectContact=function(e,t){e.preventDefault();this.rolesCompleted[t.id]=__assign(__assign({},t),e.detail);this.showPickerForId=""};e.prototype.handleClickRole=function(e,t){e.stopPropagation();this.showPickerForId=t.id};e.prototype.handleSend=function(e){var t=this;var n;if(this.sending){console.log("[SEND] Skipping duplicate send",e);return}console.log("[SEND] Sending",e);e.preventDefault();e.stopPropagation();this.sending=true;var r={template_id:this.templateId,name:((n=this.template)===null||n===void 0?void 0:n.name)||"New Envelope",environment:this.environment,initial_reminder:0,followup_reminders:0,recipients:Object.values(this.rolesCompleted)};var o=this.beforeSend.emit(__assign(__assign({},r),{name:r.name,template:this.template}));if(o.defaultPrevented){console.log("[SEND] Send cancelled by parent",r);this.sending=false;return}console.log("[SEND] Creating envelope",r);createEnvelope(this.endpoint,r).then((function(e){var n;console.log("[SEND] Send envelope",e);t.reset().catch((function(e){return console.log("Unknown Error",e)}));t.sending=false;(n=t.send)===null||n===void 0?void 0:n.emit(__assign(__assign({},r),{name:r.name,envelope_id:e.id,envelope:e}))})).catch((function(e){var n,r,o;console.log("[SEND] Send error",e);VerdocsToast(((r=(n=e.response)===null||n===void 0?void 0:n.data)===null||r===void 0?void 0:r.error)||"Error creating envelope, please try again later.");t.sending=false;(o=t.sdkError)===null||o===void 0?void 0:o.emit(e)}))};e.prototype.handleCancel=function(e){var t;e.stopPropagation();(t=this.exit)===null||t===void 0?void 0:t.emit()};e.prototype.render=function(){var e=this;var t;if(this.loading){return h(Host,null,h("verdocs-loader",null))}if(!this.endpoint.session){return h(Host,{style:{display:"flex"}},h("verdocs-component-error",{message:"You must be authenticated to use this module."}))}var n=this.getSequenceNumbers();var r=Object.values(this.rolesCompleted).filter((function(e){return isValidEmail(e.email)&&e.first_name&&e.last_name}));var o=r.length>=getRoleNames(this.template).length;var i=r.map((function(e){return e.email.toLowerCase()}));var s=new Set(i).size<i.length;return h(Host,{class:{sendable:(t=this.template)===null||t===void 0?void 0:t.is_sendable}},h("div",{class:"recipients"},h("div",{class:"left-line"}),h("div",{class:"level level-start"},this.getLevelIcon("start"),h("div",{class:"complete"},"Send Envelope")),n.map((function(t){return h("div",{class:"level level-".concat(t)},e.getLevelIcon("sequence"),e.getRolesAtLevel(t).map((function(t){var n,o,i;var s=!t.email||!t.first_name||!t.last_name;var a=((n=e.rolesCompleted[t.id])===null||n===void 0?void 0:n.first_name)?formatFullName(e.rolesCompleted[t.id]):s?t.role_name:formatFullName(t);var l="verdocs-send-recipient-".concat(t.role_name);var c=getRoleIndex(e.template,t.role_name);var d=getRGBA(c);var u=r.findIndex((function(e){return e.role_name===t.role_name}))>-1;var f={backgroundColor:d,border:u?"2px solid #55bc81":"2px solid #dddddd"};return s?h("div",{class:"recipient","data-ri":c,"data-rn":t.role_name,style:f,onClick:function(n){return e.handleClickRole(n,t)},id:l},a,h("div",{class:"icon",innerHTML:editIcon}),e.showPickerForId===t.id&&h("verdocs-portal",{anchor:l,onClickAway:function(){return e.showPickerForId=""}},h("verdocs-contact-picker",{onExit:function(){return e.showPickerForId=""},onNext:function(n){return e.handleSelectContact(n,t)},contactSuggestions:e.sessionContacts,templateRole:(o=e.rolesCompleted[t.id])!==null&&o!==void 0?o:t,onSearchContacts:function(t){var n;return(n=e.searchContacts)===null||n===void 0?void 0:n.emit(t.detail)}}))):h("div",{class:"recipient","data-ri":c,"data-rn":t.role_name,style:f,onClick:function(n){return e.handleClickRole(n,t)},id:l},a,h("div",{class:"icon",innerHTML:editIcon}),e.showPickerForId===t.id&&h("verdocs-portal",{anchor:l,onClickAway:function(){return e.showPickerForId=""}},h("verdocs-contact-picker",{onExit:function(){return e.showPickerForId=""},onNext:function(n){return e.handleSelectContact(n,t)},contactSuggestions:e.sessionContacts,templateRole:(i=e.rolesCompleted[t.id])!==null&&i!==void 0?i:t,onSearchContacts:function(t){var n;return(n=e.searchContacts)===null||n===void 0?void 0:n.emit(t.detail)}})))})))})),h("div",{class:"level level-done"},this.getLevelIcon("end"),h("div",{class:"complete"},"Signing Complete"))),h("div",{class:"buttons"},s&&h("div",{class:"error-message"},"Recipients cannot share the same email."),this.showCancel&&h("verdocs-button",{label:"Cancel",size:"small",variant:"outline",onClick:function(t){return e.handleCancel(t)},disabled:this.sending}),h("verdocs-button",{label:"Send",size:"small",disabled:!o||this.sending||s,onClick:function(t){return e.handleSend(t)}}),this.sending&&h("verdocs-spinner",null)))};Object.defineProperty(e,"watchers",{get:function(){return{templateId:["onTemplateIdChanged"]}},enumerable:false,configurable:true});return e}();VerdocsSend.style=verdocsSendCss;var verdocsTemplateAttachmentsCss='verdocs-template-attachments{font-family:var(--verdocs-primary-font, "Inter", "Barlow", sans-serif)}verdocs-template-attachments h5{font-size:16px;font-weight:bold;margin:0 0 10px 0;color:#46497d}verdocs-template-attachments .attachments{margin:0 0 40px 0}verdocs-template-attachments .attachment{display:-ms-flexbox;display:flex;padding:5px 0;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;color:#33364b}verdocs-template-attachments .attachment:hover .trash-icon{display:-ms-flexbox;display:flex}verdocs-template-attachments .attachment:hover .pages{display:none}verdocs-template-attachments svg{width:28px;height:28px;fill:#5c6575;margin:2px 0 0 0}verdocs-template-attachments .file-icon{-ms-flex:0;flex:0}verdocs-template-attachments .pages{width:24px;height:24px;-ms-flex:0 0 24px;flex:0 0 24px;padding-left:4px;position:relative;margin:-10px 0 0 0}verdocs-template-attachments .pages .pages-icon{top:0;left:0;width:24px;height:24px;position:absolute}verdocs-template-attachments .pages .count{top:11px;left:7px;z-index:1;width:18px;font-size:12px;font-weight:500;position:absolute;text-align:center;letter-spacing:-2px}verdocs-template-attachments .filename{-ms-flex:1;flex:1;display:block;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;border-bottom:1px dotted #cccccc}verdocs-template-attachments .trash-icon{-ms-flex:0;flex:0;display:none}verdocs-template-attachments .trash-icon:hover{cursor:pointer}verdocs-template-attachments verdocs-file-chooser{margin:10px 0;border:2px dashed #979797}verdocs-template-attachments .loader-wrapper{background-color:#ffffff;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-webkit-box-sizing:border-box;box-sizing:border-box;position:relative;width:320px;height:320px;text-align:center;border:2px dashed #979797;-ms-flex-pack:end;justify-content:flex-end}verdocs-template-attachments .progress-wrapper{padding:20px}verdocs-template-attachments .buttons{display:-ms-flexbox;display:flex;-webkit-column-gap:8px;-moz-column-gap:8px;column-gap:8px;margin-top:16px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:end;justify-content:flex-end}verdocs-template-attachments .buttons .flex-fill{-ms-flex:1;flex:1}verdocs-template-attachments ::-webkit-input-placeholder{color:#aaaaaa}verdocs-template-attachments ::-moz-placeholder{color:#aaaaaa}verdocs-template-attachments :-ms-input-placeholder{color:#aaaaaa}verdocs-template-attachments ::-ms-input-placeholder{color:#aaaaaa}verdocs-template-attachments ::placeholder{color:#aaaaaa}';var VerdocsTemplateAttachments=function(){function e(e){registerInstance(this,e);this.exit=createEvent(this,"exit");this.next=createEvent(this,"next");this.templateUpdated=createEvent(this,"templateUpdated");this.sdkError=createEvent(this,"sdkError");this.templateListenerId=null;this.endpoint=VerdocsEndpoint.getDefault();this.templateId="";this.uploading=false;this.progressLabel="Uploading...";this.progressPercent=0;this.showDeleteError=false;this.confirmDeleteDocument=null;this.loading=true;this.template=null}e.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,n;return __generator(this,(function(r){try{this.endpoint.loadSession();if(!this.templateId){console.log("[ROLES] Missing required template ID ".concat(this.templateId));return[2]}if(!this.endpoint.session){console.log("[ROLES] Unable to start builder session, must be authenticated");return[2]}this.listenToTemplate()}catch(r){console.log("[TEMPLATE ATTACHMENTS] Error loading template",r);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new SDKError(r.message,(t=r.response)===null||t===void 0?void 0:t.status,(n=r.response)===null||n===void 0?void 0:n.data))}return[2]}))}))};e.prototype.disconnectedCallback=function(){this.unlistenToTemplate()};e.prototype.listenToTemplate=function(){return __awaiter(this,void 0,void 0,(function(){var e=this;return __generator(this,(function(t){this.unlistenToTemplate();Store.subscribe("templates",this.templateId,(function(){return getTemplate(e.endpoint,e.templateId)}),false,(function(t){e.template=t;e.loading=false}));return[2]}))}))};e.prototype.unlistenToTemplate=function(){if(this.templateListenerId){Store.store.delListener(this.templateListenerId);this.templateListenerId=null}};e.prototype.handleCancel=function(e){e.stopPropagation();this.exit.emit()};e.prototype.handleUploadProgress=function(e){if(e>=99){this.progressPercent=100;this.progressLabel="Processing..."}else{this.progressPercent=e}};e.prototype.handleUpload=function(e){return __awaiter(this,void 0,void 0,(function(){var t,n,r,o,i,s,a,l;return __generator(this,(function(c){switch(c.label){case 0:e.stopPropagation();i=e.detail.file;if(!i){return[2]}console.log("[ATTACHMENTS] Uploading...",i);this.uploading=true;this.progressLabel="Uploading...";c.label=1;case 1:c.trys.push([1,4,,5]);return[4,createTemplateDocument(this.endpoint,this.templateId,i,this.handleUploadProgress.bind(this))];case 2:s=c.sent();console.log("[ATTACHMENTS] Created attachment",s);a=this;return[4,Store.getTemplate(this.endpoint,this.templateId,true)];case 3:a.template=c.sent();console.log("[ATTACHMENTS] Updated template",this.template);(t=this.templateUpdated)===null||t===void 0?void 0:t.emit({endpoint:this.endpoint,template:this.template,event:"attachments"});this.uploading=false;this.progressLabel="";this.progressPercent=0;return[3,5];case 4:l=c.sent();console.log("[ATTACHMENTS] Error creating template",l);(n=this.sdkError)===null||n===void 0?void 0:n.emit(new SDKError(l.message,(r=l.response)===null||r===void 0?void 0:r.status,(o=l.response)===null||o===void 0?void 0:o.data));this.uploading=false;return[3,5];case 5:return[2]}}))}))};e.prototype.handleNext=function(e){var t;e.stopPropagation();this.uploading=false;this.progressLabel="";this.progressPercent=0;(t=this.next)===null||t===void 0?void 0:t.emit({template:this.template})};e.prototype.confirmDelete=function(){return __awaiter(this,void 0,void 0,(function(){var e;return __generator(this,(function(t){switch(t.label){case 0:return[4,deleteTemplateDocument(this.endpoint,this.confirmDeleteDocument.id)];case 1:t.sent();e=this;return[4,Store.getTemplate(this.endpoint,this.templateId,true)];case 2:e.template=t.sent();console.log("[ATTACHMENTS] New template",this.template);this.confirmDeleteDocument=null;return[2]}}))}))};e.prototype.handleDelete=function(e){return __awaiter(this,void 0,void 0,(function(){var t;return __generator(this,(function(n){if((((t=this.template)===null||t===void 0?void 0:t.documents)||[]).length>1){this.confirmDeleteDocument=e}else{this.showDeleteError=true}return[2]}))}))};e.prototype.getFileIcon=function(e){switch(e.mime){case"application/pdf":return PdfIcon;case"image/jpeg":return JpgIcon;case"image/png":return PngIcon;case"application/msword":case"application/vnd.openxmlformats-officedocument.wordprocessingml.document":return DocIcon}return FileIcon};e.prototype.render=function(){var e=this;var t,n;if(!this.endpoint.session){return h(Host,null,h("verdocs-component-error",{message:"You must be authenticated to use this module."}))}if(this.loading){return h(Host,{class:"loading"},h("verdocs-loader",null))}if(!this.endpoint.session||!this.template){return h(Host,{class:"empty"})}return h(Host,null,h("h5",null,"Existing Attachments"),h("div",{class:"attachments"},(((t=this.template)===null||t===void 0?void 0:t.documents)||[]).map((function(t){return h("div",{class:"attachment"},h("div",{class:"file-icon",innerHTML:e.getFileIcon(t)}),h("div",{class:"filename",title:t.name},t.name),h("div",{class:"pages"},h("div",{class:"count"},t.pages),h("div",{class:"pages-icon",innerHTML:PageCountIcon})),h("div",{class:"trash-icon",innerHTML:TrashIcon,onClick:function(){return e.handleDelete(t)}}))}))),h("h5",null,"Attach a New Document"),this.uploading?h("div",{class:"loader-wrapper"},h("verdocs-loader",null),this.progressLabel&&h("div",{class:"progress-wrapper"},h("verdocs-progress-bar",{showPercent:true,percent:this.progressPercent,label:this.progressLabel}))):h("verdocs-file-chooser",{onFileSelected:function(t){return e.handleUpload(t)}}),h("div",{class:"buttons"},h("verdocs-button",{variant:"outline",label:"Cancel",size:"small",onClick:function(t){return e.handleCancel(t)},disabled:this.uploading}),h("verdocs-button",{label:"Next",size:"small",onClick:function(t){return e.handleNext(t)},disabled:!(((n=this.template)===null||n===void 0?void 0:n.documents)||[]).length||this.uploading})),this.showDeleteError&&h("verdocs-ok-dialog",{heading:"Unable to Delete Attachment",message:"Templates must contain at least one attachment.",onNext:function(){return e.showDeleteError=false}}),this.confirmDeleteDocument&&h("verdocs-ok-dialog",{heading:"Delete this Attachment?",message:"This operation cannot be undone. All fields placed<br />on the deleted attachment will also be removed.",onNext:function(){return e.confirmDelete()},showCancel:true,onExit:function(){e.confirmDeleteDocument=null}}))};return e}();VerdocsTemplateAttachments.style=verdocsTemplateAttachmentsCss;var verdocsTemplateBuildTabsCss='verdocs-template-build-tabs{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:end;align-items:flex-end;-ms-flex:0 0 50px;flex:0 0 50px;width:100%;background:#ffffff;color:#72757d;border-bottom:1px solid #dddddd;-webkit-filter:drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));filter:drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));font-family:var(--verdocs-primary-font, "Inter", "Barlow", sans-serif)}verdocs-template-build-tabs .tab{position:relative;display:-ms-flexbox;display:flex;-ms-flex:1;flex:1;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;height:50px;padding:0 4px;background:#e7e7e7;font-weight:700;font-size:12px;cursor:pointer}@media (min-width: 768px){verdocs-template-build-tabs .tab{padding:0 8px 0 24px;font-size:14px}}verdocs-template-build-tabs .tab svg{position:absolute;top:0;right:-19px;z-index:10;pointer-events:none;display:none}@media (min-width: 768px){verdocs-template-build-tabs .tab svg{display:block}}verdocs-template-build-tabs .tab.active{background:#ffffff;color:#707ae5}verdocs-template-build-tabs .tab.disabled{cursor:default;color:#d1d5db}';var VerdocsTemplateBuildTabs=function(){function e(e){registerInstance(this,e);this.sdkError=createEvent(this,"sdkError");this.stepChanged=createEvent(this,"stepChanged");this.templateListenerId=null;this.endpoint=VerdocsEndpoint.getDefault();this.templateId=null;this.step="preview";this.loading=true;this.template=null}e.prototype.disconnectedCallback=function(){this.unlistenToTemplate()};e.prototype.listenToTemplate=function(){return __awaiter(this,void 0,void 0,(function(){var e=this;return __generator(this,(function(t){this.unlistenToTemplate();Store.subscribe("templates",this.templateId,(function(){return getTemplate(e.endpoint,e.templateId)}),false,(function(t){e.template=t;e.loading=false}));return[2]}))}))};e.prototype.unlistenToTemplate=function(){if(this.templateListenerId){Store.store.delListener(this.templateListenerId);this.templateListenerId=null}};e.prototype.onTemplateIdChanged=function(e){console.log("[BUILD_TABS] Template ID changed",e);this.listenToTemplate()};e.prototype.onStepChanged=function(e){console.log("[BUILD_TABS] Step changed",e)};e.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,n;return __generator(this,(function(r){try{this.endpoint.loadSession();if(!this.endpoint.session){console.log("[BUILD_TABS] Unable to start builder session, must be authenticated");return[2]}if(!this.templateId){this.step="attachments";console.log("[BUILD_TABS] Missing required template ID, forcing view to attachments");return[2]}this.listenToTemplate()}catch(r){console.log("[BUILD_TABS] Error loading template",r);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new SDKError(r.message,(t=r.response)===null||t===void 0?void 0:t.status,(n=r.response)===null||n===void 0?void 0:n.data))}return[2]}))}))};e.prototype.handleSelect=function(e){var t;if(e.disabled||e.id===this.step){return}this.step=e.id;(t=this.stepChanged)===null||t===void 0?void 0:t.emit(e.id)};e.prototype.render=function(){var e=this;var t,n,r;if(this.loading){return h(Host,null,h("verdocs-loader",null))}if(!this.endpoint.session){return h(Host,null,h("verdocs-component-error",{message:"You must be authenticated to use this module."}))}var o=(((t=this.template)===null||t===void 0?void 0:t.documents)||[]).length>0;var i=o&&(((n=this.template)===null||n===void 0?void 0:n.roles)||[]).length>0;var s=i&&(((r=this.template)===null||r===void 0?void 0:r.fields)||[]).length>0;var a=[{id:"attachments",label:"Attachments",disabled:false},{id:"roles",label:"Workflow",disabled:!o},{id:"fields",label:"Fields",disabled:!i},{id:"preview",label:"Preview & Send",disabled:!s}];return h(Host,null,a.map((function(t){var n=t.id===e.step;var r=["tab"];if(n)r.push("active");if(t.disabled)r.push("disabled");return h("div",{class:r.join(" "),onClick:function(){return e.handleSelect(t)}},h("span",null,t.label),h("svg",{"aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",width:"19",height:"50",viewBox:"0 0 19 50"},h("polygon",{points:"0,0 19,25 0,50",fill:n?"#ffffff":"#e7e7e7"})))})))};Object.defineProperty(e,"watchers",{get:function(){return{templateId:["onTemplateIdChanged"],step:["onStepChanged"]}},enumerable:false,configurable:true});return e}();VerdocsTemplateBuildTabs.style=verdocsTemplateBuildTabsCss;var verdocsTemplateFieldsCss="verdocs-template-fields{font-family:var(--verdocs-primary-font, \"Inter\", \"Barlow\", sans-serif);position:relative;display:block;min-height:600px}verdocs-template-fields .page-0{padding:65px 15px 0 15px;-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-template-fields .page-0 .user-placed-fields{height:100px;position:relative;background:#ffffff;-webkit-box-shadow:0 0 10px 5px rgba(0, 0, 0, 0.0588235294);box-shadow:0 0 10px 5px rgba(0, 0, 0, 0.0588235294)}verdocs-template-fields .page-0 .user-placed-fields .title{top:0;left:0;color:#ffffff;font-size:12px;padding:3px 6px;font-weight:bold;position:absolute;background:#46497d}verdocs-template-fields .pages{display:-ms-flexbox;display:flex;padding:15px;row-gap:15px;min-height:200px;position:relative;-ms-flex-align:center;align-items:center;-webkit-box-sizing:border-box;box-sizing:border-box;-ms-flex-direction:column;flex-direction:column}verdocs-template-fields .pages div,verdocs-template-fields .pages canvas{-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-template-fields .pages .document-separator{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;gap:10px;padding:12px 20px;width:100%;-webkit-box-sizing:border-box;box-sizing:border-box;background-color:#33364b;color:white;border-radius:6px;font-size:16px;font-weight:500;margin-top:20px;-webkit-box-shadow:0 2px 4px rgba(0, 0, 0, 0.1);box-shadow:0 2px 4px rgba(0, 0, 0, 0.1)}verdocs-template-fields .pages .document-separator svg{-ms-flex-negative:0;flex-shrink:0}verdocs-template-fields .pages .document-separator:first-child{margin-top:0}verdocs-template-fields #verdocs-template-fields-toolbar{width:100%;height:50px;display:-ms-flexbox;display:flex;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;font-weight:700;padding:0 20px 0 0;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;color:#f5f5fa;-ms-flex-pack:center;justify-content:center;background:#46497d}verdocs-template-fields #verdocs-template-fields-toolbar>verdocs-select-input{margin:0}verdocs-template-fields #verdocs-template-fields-toolbar svg{width:24px;height:24px}verdocs-template-fields #verdocs-template-fields-toolbar .add-for{margin:0;font-weight:500;color:#f5f5fa}verdocs-template-fields #verdocs-template-fields-toolbar verdocs-select-input{margin:0 20px 0 0}@media all and (max-width: 1000px){verdocs-template-fields #verdocs-template-fields-toolbar{-webkit-column-gap:8px;-moz-column-gap:8px;column-gap:8px;padding:0 10px 0 0}verdocs-template-fields #verdocs-template-fields-toolbar svg{-webkit-transform:scale(0.8);transform:scale(0.8)}verdocs-template-fields #verdocs-template-fields-toolbar .add-for,verdocs-template-fields #verdocs-template-fields-toolbar verdocs-select-input{display:none}}@media all and (max-width: 600px){verdocs-template-fields #verdocs-template-fields-toolbar{-webkit-column-gap:6px;-moz-column-gap:6px;column-gap:6px}verdocs-template-fields #verdocs-template-fields-toolbar svg{-webkit-transform:scale(0.6);transform:scale(0.6)}verdocs-template-fields #verdocs-template-fields-toolbar .separator,verdocs-template-fields #verdocs-template-fields-toolbar .add-for,verdocs-template-fields #verdocs-template-fields-toolbar verdocs-select-input{display:none}}verdocs-template-fields.placing-attachment{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='m10.55 16.55 7.275-7.275L16.05 7.5l-5.5 5.45-2.675-2.65L6.1 12.075Zm-5.375 4.925q-1.125 0-1.887-.763-.763-.762-.763-1.887V5.175q0-1.125.763-1.888.762-.762 1.887-.762h13.65q1.125 0 1.888.762.762.763.762 1.888v13.65q0 1.125-.762 1.887-.763.763-1.888.763Zm0-2.65h13.65V5.175H5.175v13.65Zm0-13.65v13.65-13.65Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-checkbox{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='m10.55 16.55 7.275-7.275L16.05 7.5l-5.5 5.45-2.675-2.65L6.1 12.075Zm-5.375 4.925q-1.125 0-1.887-.763-.763-.762-.763-1.887V5.175q0-1.125.763-1.888.762-.762 1.887-.762h13.65q1.125 0 1.888.762.762.763.762 1.888v13.65q0 1.125-.762 1.887-.763.763-1.888.763Zm0-2.65h13.65V5.175H5.175v13.65Zm0-13.65v13.65-13.65Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-date{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath fill='%23000000' d='M7.6 13.925q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375Zm4.4 0q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375Zm4.4 0q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375ZM5.3 22.85q-1.325 0-2.238-.912-.912-.913-.912-2.238V6.3q0-1.325.912-2.238.913-.912 2.238-.912H6v-2h2.575v2h6.85v-2H18v2h.7q1.325 0 2.238.912.912.913.912 2.238v13.4q0 1.325-.912 2.238-.913.912-2.238.912Zm0-3.15h13.4V10H5.3v9.7ZM5.3 8h13.4V6.3H5.3Zm0 0V6.3 8Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-dropdown{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24' stroke-width='1.5' stroke='currentColor'%3E%3Cpath stroke='%23000000' stroke-linecap='round' stroke-linejoin='round' d='M3 4.5h14.25M3 9h9.75M3 13.5h9.75m4.5-4.5v12m0 0l-3.75-3.75M17.25 21L21 17.25' /%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-initial{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='M6.225 20.775V7h-5V3.225H15V7h-5v13.775Zm9.775 0v-8h-3V9h9.775v3.775h-3v8Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-payment{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='m10.55 16.55 7.275-7.275L16.05 7.5l-5.5 5.45-2.675-2.65L6.1 12.075Zm-5.375 4.925q-1.125 0-1.887-.763-.763-.762-.763-1.887V5.175q0-1.125.763-1.888.762-.762 1.887-.762h13.65q1.125 0 1.888.762.762.763.762 1.888v13.65q0 1.125-.762 1.887-.763.763-1.888.763Zm0-2.65h13.65V5.175H5.175v13.65Zm0-13.65v13.65-13.65Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-radio{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='M12 17q2.075 0 3.538-1.463Q17 14.075 17 12t-1.462-3.538Q14.075 7 12 7 9.925 7 8.463 8.462 7 9.925 7 12q0 2.075 1.463 3.537Q9.925 17 12 17Zm0 5.85q-2.275 0-4.25-.85t-3.438-2.312Q2.85 18.225 2 16.25q-.85-1.975-.85-4.25T2 7.75q.85-1.975 2.312-3.438Q5.775 2.85 7.75 2q1.975-.85 4.25-.85t4.25.85q1.975.85 3.438 2.312Q21.15 5.775 22 7.75q.85 1.975.85 4.25T22 16.25q-.85 1.975-2.312 3.438Q18.225 21.15 16.25 22q-1.975.85-4.25.85Zm0-3.15q3.25 0 5.475-2.225Q19.7 15.25 19.7 12q0-3.25-2.225-5.475Q15.25 4.3 12 4.3q-3.25 0-5.475 2.225Q4.3 8.75 4.3 12q0 3.25 2.225 5.475Q8.75 19.7 12 19.7Zm0-7.7Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-signature{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='m9.225 21.225 4.65-4.65h8.45v4.65Zm-5.35-2.2H5.05l8.5-8.5-1.175-1.175-8.5 8.5Zm14.25-9.95L13.8 4.8l1.325-1.325q.625-.65 1.525-.663.9-.012 1.6.663l1.225 1.175q.675.675.663 1.562-.013.888-.663 1.513ZM16.7 10.55 6 21.225H1.675V16.9L12.35 6.225Zm-3.725-.625-.6-.575 1.175 1.175Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-textarea{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='M3.225 20.725v-3.15h11.55v3.15Zm0-4.775V12.8h17.55v3.15Zm0-4.75V8.05h17.55v3.15Zm0-4.775v-3.15h17.55v3.15Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-textbox{cursor:url(\"data:image/svg+xml,%3Csvg width='32' height='15' viewBox='0 0 32 15' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cmask id='path-1-inside-1_1401_24' fill='white'%3E%3Cpath d='M0 0H32V15H0V0Z'/%3E%3C/mask%3E%3Cpath d='M0 0H32V15H0V0Z' fill='%234C56CB' fill-opacity='0.1'/%3E%3Cpath d='M0 0V-1H-1V0H0ZM0 15H-1V16H0V15ZM0 1H32V-1H0V1ZM32 14H0V16H32V14ZM1 15V0H-1V15H1Z' fill='%234C56CB' mask='url(%23path-1-inside-1_1401_24)'/%3E%3Cpath d='M3 11.8V8.65H14.15V11.8H3ZM3 6.65V3.5H20.15V6.65H3Z' fill='%234C56CB'/%3E%3Cline x1='31.5' y1='1' x2='31.5' y2='14' stroke='%234C56CB' stroke-opacity='0.32' stroke-dasharray='1 1'/%3E%3C/svg%3E%0A\") 0 14, pointer}verdocs-template-fields.placing-timestamp{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath fill='%23000000' d='M9 1h6v2H9zm10.03 6.39 1.42-1.42c-.43-.51-.9-.99-1.41-1.41l-1.42 1.42C16.07 4.74 14.12 4 12 4c-4.97 0-9 4.03-9 9s4.02 9 9 9 9-4.03 9-9c0-2.12-.74-4.07-1.97-5.61zM13 14h-2V8h2v6z'%3E%3C/path%3E%3C/svg%3E\") 16 16, pointer}";var iconTextbox='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="M3.425 16.15V13h11.15v3.15Zm0-5.15V7.85h17.15V11Z"/></svg>';var iconCheck='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="m10.55 16.55 7.275-7.275L16.05 7.5l-5.5 5.45-2.675-2.65L6.1 12.075Zm-5.375 4.925q-1.125 0-1.887-.763-.763-.762-.763-1.887V5.175q0-1.125.763-1.888.762-.762 1.887-.762h13.65q1.125 0 1.888.762.762.763.762 1.888v13.65q0 1.125-.762 1.887-.763.763-1.888.763Zm0-2.65h13.65V5.175H5.175v13.65Zm0-13.65v13.65-13.65Z"/></svg>';var iconRadio='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="M12 17q2.075 0 3.538-1.463Q17 14.075 17 12t-1.462-3.538Q14.075 7 12 7 9.925 7 8.463 8.462 7 9.925 7 12q0 2.075 1.463 3.537Q9.925 17 12 17Zm0 5.85q-2.275 0-4.25-.85t-3.438-2.312Q2.85 18.225 2 16.25q-.85-1.975-.85-4.25T2 7.75q.85-1.975 2.312-3.438Q5.775 2.85 7.75 2q1.975-.85 4.25-.85t4.25.85q1.975.85 3.438 2.312Q21.15 5.775 22 7.75q.85 1.975.85 4.25T22 16.25q-.85 1.975-2.312 3.438Q18.225 21.15 16.25 22q-1.975.85-4.25.85Zm0-3.15q3.25 0 5.475-2.225Q19.7 15.25 19.7 12q0-3.25-2.225-5.475Q15.25 4.3 12 4.3q-3.25 0-5.475 2.225Q4.3 8.75 4.3 12q0 3.25 2.225 5.475Q8.75 19.7 12 19.7Zm0-7.7Z"/></svg>';var iconDatepicker='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="M7.6 13.925q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375Zm4.4 0q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375Zm4.4 0q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375ZM5.3 22.85q-1.325 0-2.238-.912-.912-.913-.912-2.238V6.3q0-1.325.912-2.238.913-.912 2.238-.912H6v-2h2.575v2h6.85v-2H18v2h.7q1.325 0 2.238.912.912.913.912 2.238v13.4q0 1.325-.912 2.238-.913.912-2.238.912Zm0-3.15h13.4V10H5.3v9.7ZM5.3 8h13.4V6.3H5.3Zm0 0V6.3 8Z"/></svg>';var iconSignature='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="m9.225 21.225 4.65-4.65h8.45v4.65Zm-5.35-2.2H5.05l8.5-8.5-1.175-1.175-8.5 8.5Zm14.25-9.95L13.8 4.8l1.325-1.325q.625-.65 1.525-.663.9-.012 1.6.663l1.225 1.175q.675.675.663 1.562-.013.888-.663 1.513ZM16.7 10.55 6 21.225H1.675V16.9L12.35 6.225Zm-3.725-.625-.6-.575 1.175 1.175Z"/></svg>';var iconInitial='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="M6.225 20.775V7h-5V3.225H15V7h-5v13.775Zm9.775 0v-8h-3V9h9.775v3.775h-3v8Z"/></svg>';var iconDropdown='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24" stroke-width="1.5" stroke="currentColor"><path stroke="#ffffff" stroke-linecap="round" stroke-linejoin="round" d="M3 4.5h14.25M3 9h9.75M3 13.5h9.75m4.5-4.5v12m0 0l-3.75-3.75M17.25 21L21 17.25" /></svg>';var iconAttachment='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-6"><path stroke-linecap="round" stroke-linejoin="round" d="m18.375 12.739-7.693 7.693a4.5 4.5 0 0 1-6.364-6.364l10.94-10.94A3 3 0 1 1 19.5 7.372L8.552 18.32m.009-.01-.01.01m5.699-9.941-7.81 7.81a1.5 1.5 0 0 0 2.112 2.13" /></svg>';var separator='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14.707 14.707"><g><rect x="6.275" y="0" fill="#ffffff7f" width="1" height="15"/></g></svg>';var menuOptions=[{id:"signature",tooltip:"Signature",icon:iconSignature,class:"signature"},{id:"initial",tooltip:"Initials",icon:iconInitial,class:"initial"},{id:"sep1",tooltip:"",icon:separator,class:"separator"},{id:"textbox",tooltip:"Text Box",icon:iconTextbox,class:"textbox"},{id:"checkbox",tooltip:"Check Box",icon:iconCheck,class:"checkbox"},{id:"radio",tooltip:"Radio Button",icon:iconRadio,class:"radio"},{id:"dropdown",tooltip:"Dropdown",icon:iconDropdown,class:"dropdown"},{id:"sep2",tooltip:"",icon:separator,class:"separator"},{id:"date",tooltip:"Date",icon:iconDatepicker,class:"date"},{id:"attachment",tooltip:"Attachment",icon:iconAttachment,class:"attachment"}];var VerdocsTemplateFields=function(){function e(e){registerInstance(this,e);this.sdkError=createEvent(this,"sdkError");this.templateUpdated=createEvent(this,"templateUpdated");this.templateListenerId=null;this.endpoint=VerdocsEndpoint.getDefault();this.templateId=null;this.toolbarTargetId=null;this.placing=null;this.showMustSelectRole=false;this.selectedRoleName="";this.loading=true;this.template=null;this.pageHeights={};this.cachedPageInfo={}}e.prototype.onTemplateIdChanged=function(){this.listenToTemplate()};e.prototype.handleKeyDown=function(e){if(e.key==="Escape"){this.placing=null}};e.prototype.handleFieldSettingsChanged=function(){var e;(e=this.templateUpdated)===null||e===void 0?void 0:e.emit({endpoint:this.endpoint,template:this.template,event:"updated-field"})};e.prototype.handleFieldDeleted=function(){var e;(e=this.templateUpdated)===null||e===void 0?void 0:e.emit({endpoint:this.endpoint,template:this.template,event:"deleted-field"})};e.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,n;return __generator(this,(function(r){try{this.endpoint.loadSession();if(!this.templateId){console.log("[FIELDS] Missing required template ID ".concat(this.templateId));return[2]}if(!this.endpoint.session){console.log("[FIELDS] Unable to start builder session, must be authenticated");return[2]}this.listenToTemplate()}catch(r){console.log("[FIELDS] Error with fields session",r);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new SDKError(r.message,(t=r.response)===null||t===void 0?void 0:t.status,(n=r.response)===null||n===void 0?void 0:n.data))}return[2]}))}))};e.prototype.componentDidRender=function(){var e=this;interact.dynamicDrop(true);document.querySelectorAll(".verdocs-field").forEach((function(t){e.makeDraggable(t)}));var t=this.toolbarTargetId?document.getElementById(this.toolbarTargetId):null;var n=document.getElementById("verdocs-template-fields-toolbar");if(t&&n){n.remove();t.append(n)}};e.prototype.componentWillUpdate=function(){var e=this;var t,n;var r=__spreadArray([],((t=this.template)===null||t===void 0?void 0:t.roles)||[],true).sort((function(e,t){var n,r;return((n=e.sequence)!==null&&n!==void 0?n:0)-((r=t.sequence)!==null&&r!==void 0?r:0)}));if(!this.selectedRoleName||!r.find((function(t){return t&&t.name===e.selectedRoleName}))){this.selectedRoleName=((n=r[0])===null||n===void 0?void 0:n.name)||"";console.log("[FIELDS] Selected new role",this.selectedRoleName)}};e.prototype.disconnectedCallback=function(){this.unlistenToTemplate()};e.prototype.listenToTemplate=function(){return __awaiter(this,void 0,void 0,(function(){var e=this;return __generator(this,(function(t){this.unlistenToTemplate();Store.subscribe("templates",this.templateId,(function(){return getTemplate(e.endpoint,e.templateId)}),false,(function(t){var n;console.log("Template updated");e.template=t;e.loading=false;if(!e.selectedRoleName){var r=__spreadArray([],t.roles||[],true).sort((function(e,t){var n,r;return((n=e.sequence)!==null&&n!==void 0?n:0)-((r=t.sequence)!==null&&r!==void 0?r:0)}));e.selectedRoleName=((n=r[0])===null||n===void 0?void 0:n.name)||""}}));return[2]}))}))};e.prototype.unlistenToTemplate=function(){if(this.templateListenerId){Store.store.delListener(this.templateListenerId);this.templateListenerId=null}};e.prototype.handlePageRendered=function(e){var t=this;var n,r;var o,i;var s=e.detail;console.log("[FIELDS] Page rendered",s.documentId,s.pageNumber,s.xScale,s.yScale);(n=(o=this.cachedPageInfo)[i=s.documentId])!==null&&n!==void 0?n:o[i]={};this.cachedPageInfo[s.documentId][s.pageNumber]=s;this.pageHeights[s.pageNumber]=s.naturalHeight;(((r=this.template)===null||r===void 0?void 0:r.fields)||[]).filter((function(e){return e&&e.page===s.pageNumber})).forEach((function(e){var n=getFieldId(e);var r=document.getElementById(n);if(r){r.setAttribute("templateid",t.templateId);r.setAttribute("fieldname",e.name);r.setAttribute("documentid",String(e.document_id));r.setAttribute("pagenumber",String(e.page));r.setAttribute("xScale",String(s.xScale));r.setAttribute("yScale",String(s.yScale));t.makeDraggable(r)}}))};e.prototype.makeDraggable=function(e){interact(e).draggable({listeners:{move:this.handleMoveField.bind(this),end:this.handleMoveEnd.bind(this)}})};e.prototype.handleMoveField=function(e){return __awaiter(this,void 0,void 0,(function(){var t,n,r,o,i,s;return __generator(this,(function(a){t=+(e.target.getAttribute("posX")||0);n=+(e.target.getAttribute("posY")||0);r=+(e.target.getAttribute("xScale")||1);o=+(e.target.getAttribute("yScale")||1);i=e.dx/r+t;s=e.dy/o+n;e.target.setAttribute("posX",i);e.target.setAttribute("posy",s);updateCssTransform(e.target,"translate","".concat(i,"px, ").concat(s,"px"));return[2]}))}))};e.prototype.handleMoveEnd=function(e){return __awaiter(this,void 0,void 0,(function(){var t,n,r,o,i,s,a,l,c,d,u,f,h,v,p,g,m,x,b,E,w,S,_,y,I,C,T,k,D,q,M,R,A,O,P,H,L,V,z,Z;return __generator(this,(function(j){switch(j.label){case 0:c=e.target.getAttribute("fieldname");d=(((t=this.template)===null||t===void 0?void 0:t.fields)||[]).find((function(e){return e.name===c}));if(!d){console.log("[FIELDS] Unable to find field",c,e.target);return[2]}u=e.target.getAttribute("pagenumber");f=e.target.getAttribute("documentid");h=this.cachedPageInfo[f][u],v=h.naturalWidth,p=v===void 0?612:v,g=h.naturalHeight,m=g===void 0?792:g,x=h.renderedHeight,b=x===void 0?792:x;E=e.target.getBoundingClientRect();w=e.target.parentElement;S=w.getBoundingClientRect();_=d.width||defaultWidth(d.type);y=d.height||defaultHeight(d.type);I=Math.max(E.left-S.left,0);C=Math.max(b-(S.bottom-E.bottom),0);T=parseInt(u);if(C>b){T=Math.min(T+1,((o=(r=((n=this.template)===null||n===void 0?void 0:n.documents)||[])===null||r===void 0?void 0:r[0])===null||o===void 0?void 0:o.pages)||1);C-=b;b=this.cachedPageInfo[f][T].renderedHeight;console.log("Next page",{newPageNumber:T,newY:C,renderedHeight:b})}else if(C<0){T=Math.max(T-1,1);b=this.cachedPageInfo[f][T].renderedHeight;C+=b;console.log("[FIELDS] Next page",{newPageNumber:T,newY:C,renderedHeight:b})}k=this.viewCoordinatesToPageCoordinates(I,C,f,u,p-_,m-y),D=k.x,q=k.y;j.label=1;case 1:j.trys.push([1,3,,4]);M={x:D,y:q,page:T};return[4,updateField(this.endpoint,this.templateId,c,M)];case 2:R=j.sent();console.log("[FIELDS] Updated",R);A=JSON.parse(JSON.stringify(this.template));O=A.fields.findIndex((function(e){return e.name===c}));if(O>-1){A.fields[O]=R}Store.updateTemplate(this.templateId,A);e.target.removeAttribute("posX");e.target.removeAttribute("posY");removeCssTransform(e.target);P=this.cachedPageInfo[f][u],H=P.xScale,L=H===void 0?1:H,V=P.yScale,z=V===void 0?1:V;setControlStyles(e.target,R,L,z);(i=this.templateUpdated)===null||i===void 0?void 0:i.emit({endpoint:this.endpoint,template:A,event:"updated-field"});return[3,4];case 3:Z=j.sent();VerdocsToast("Error updating field, please try again later",{style:"error"});console.log("[FIELDS] Error updating field",Z);(s=this.sdkError)===null||s===void 0?void 0:s.emit(new SDKError(Z.message,(a=Z.response)===null||a===void 0?void 0:a.status,(l=Z.response)===null||l===void 0?void 0:l.data));e.target.removeAttribute("posX");e.target.removeAttribute("posY");removeCssTransform(e.target);return[3,4];case 4:return[2]}}))}))};e.prototype.generateFieldName=function(e,t){var n;var r=1;var o;do{o="".concat(e,"P").concat(t,"-").concat(r);r++}while((((n=this.template)===null||n===void 0?void 0:n.fields)||[]).some((function(e){return e&&e.name===o})));return o};e.prototype.viewCoordinatesToPageCoordinates=function(e,t,n,r,o,i){var s=this.cachedPageInfo[n][r],a=s.xScale,l=a===void 0?1:a,c=s.yScale,d=c===void 0?1:c,u=s.renderedHeight,f=u===void 0?792:u;var h=Math.floor(Math.min(e/l,o));var v=Math.floor(Math.min(Math.max(f-t,0)/d,i));return{x:h,y:v}};e.prototype.handleClickPage=function(e,t,n){return __awaiter(this,void 0,void 0,(function(){var r,o,i,s,a,l,c,d,u,f,h,v,p,g,m,x;return __generator(this,(function(b){switch(b.label){case 0:if(!this.placing)return[3,2];o=e.offsetX;i=e.offsetY;s=defaultWidth(this.placing);a=defaultHeight(this.placing);l=this.cachedPageInfo[t][n];c=l.naturalWidth,d=c===void 0?612:c,u=l.naturalHeight,f=u===void 0?792:u;h=this.viewCoordinatesToPageCoordinates(o,i,t,n,d-s,f-a);v=Math.floor(h.x);p=Math.floor(h.y);g={name:this.generateFieldName(this.placing,n),role_name:this.selectedRoleName,template_id:this.templateId,document_id:l.documentId,type:this.placing,required:this.placing!=="radio"&&this.placing!=="attachment"&&this.placing!=="checkbox",page:n,validator:null,label:null,default:null,placeholder:null,group:null,settings:{},x:v,y:p,width:s,height:a,multiline:false,readonly:false,options:this.placing==="radio"?[{id:"option-1",label:"Option 1"}]:[]};return[4,createField(this.endpoint,this.templateId,g)];case 1:m=b.sent();console.log("[FIELDS] Created field",m);x=JSON.parse(JSON.stringify(this.template));x.fields.push(m);Store.updateTemplate(this.templateId,x);(r=this.templateUpdated)===null||r===void 0?void 0:r.emit({endpoint:this.endpoint,template:x,event:"added-field"});this.placing=null;b.label=2;case 2:return[2]}}))}))};e.prototype.render=function(){var e;var t=this;var n,r,o;console.log("Rendering");if(this.loading){return h(Host,null,h("verdocs-loader",null))}if(!this.endpoint.session){return h(Host,null,h("verdocs-component-error",{message:"You must be authenticated to use this module."}))}var i=__spreadArray([],((n=this.template)===null||n===void 0?void 0:n.roles)||[],true).sort((function(e,t){var n,r;return((n=e.sequence)!==null&&n!==void 0?n:0)-((r=t.sequence)!==null&&r!==void 0?r:0)}));var s=i.map((function(e){return{value:e.name,label:e.full_name?"".concat(e.name,": ").concat(e.full_name):e.name}}));return h(Host,{class:this.placing?(e={},e["placing-".concat(this.placing)]=true,e):{},onSubmit:function(){}},h("div",{id:"verdocs-template-fields-toolbar"},h("div",{class:"add-for"},"Add field:"),h("verdocs-select-input",{value:this.selectedRoleName,options:s,onInput:function(e){return t.selectedRoleName=e.target.value}}),menuOptions.map((function(e){return h("verdocs-toolbar-icon",{text:e.tooltip,icon:e.icon,class:e.class,onClick:function(){if(e.tooltip){if(t.selectedRoleName){t.placing=e.id}else{t.showMustSelectRole=true}}}})}))),h("div",{class:"pages"},(((r=this.template)===null||r===void 0?void 0:r.documents)||[]).map((function(e){var n=integerSequence(1,e.pages);return n.map((function(n){var r;var o=e.page_sizes[n];return h(Fragment,null,((r=t.template)===null||r===void 0?void 0:r.documents.length)>1&&h("div",{class:"document-separator"},h("div",{innerHTML:DocumentPageIcon}),h("span",null,e.name)),h("verdocs-template-document-page",{templateId:t.templateId,documentId:e.id,pageNumber:n,virtualWidth:(o===null||o===void 0?void 0:o.width)||612,virtualHeight:(o===null||o===void 0?void 0:o.height)||792,disabled:true,editable:true,done:false,onClick:function(r){return t.handleClickPage(r,e.id,n)},onPageRendered:function(e){return t.handlePageRendered(e)},layers:[{name:"page",type:"canvas"},{name:"controls",type:"div"}]}))}))}))),this.showMustSelectRole&&h("verdocs-ok-dialog",{heading:"Unable to add field",message:(((o=this.template)===null||o===void 0?void 0:o.roles)||[]).length>0?"Please select a role before adding fields.":"Please add at least one role before adding fields.",onNext:function(){return t.showMustSelectRole=false}}))};Object.defineProperty(e,"watchers",{get:function(){return{templateId:["onTemplateIdChanged"]}},enumerable:false,configurable:true});return e}();VerdocsTemplateFields.style=verdocsTemplateFieldsCss;
1
+ var __assign=this&&this.__assign||function(){__assign=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var o in t)if(Object.prototype.hasOwnProperty.call(t,o))e[o]=t[o]}return e};return __assign.apply(this,arguments)};var __awaiter=this&&this.__awaiter||function(e,t,n,r){function o(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,i){function s(e){try{l(r.next(e))}catch(e){i(e)}}function a(e){try{l(r["throw"](e))}catch(e){i(e)}}function l(e){e.done?n(e.value):o(e.value).then(s,a)}l((r=r.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,o,i,s=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return s.next=a(0),s["throw"]=a(1),s["return"]=a(2),typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(e){return function(t){return l([e,t])}}function l(a){if(r)throw new TypeError("Generator is already executing.");while(s&&(s=0,a[0]&&(n=0)),n)try{if(r=1,o&&(i=a[0]&2?o["return"]:a[0]?o["throw"]||((i=o["return"])&&i.call(o),0):o.next)&&!(i=i.call(o,a[1])).done)return i;if(o=0,i)a=[a[0]&2,i.value];switch(a[0]){case 0:case 1:i=a;break;case 4:n.label++;return{value:a[1],done:false};case 5:n.label++;o=a[1];a=[0];continue;case 7:a=n.ops.pop();n.trys.pop();continue;default:if(!(i=n.trys,i=i.length>0&&i[i.length-1])&&(a[0]===6||a[0]===2)){n=0;continue}if(a[0]===3&&(!i||a[1]>i[0]&&a[1]<i[3])){n.label=a[1];break}if(a[0]===6&&n.label<i[1]){n.label=i[1];i=a;break}if(i&&n.label<i[2]){n.label=i[2];n.ops.push(a);break}if(i[2])n.ops.pop();n.trys.pop();continue}a=t.call(e,n)}catch(e){a=[6,e];o=0}finally{r=i=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,i;r<o;r++){if(i||!(r in t)){if(!i)i=Array.prototype.slice.call(t,0,r);i[r]=t[r]}}return e.concat(i||Array.prototype.slice.call(t))};import{r as registerInstance,c as createEvent,h,H as Host,F as Fragment,g as getElement}from"./index-BIRwgFLv.js";import{i as interact}from"./interact.min-BepJAdBZ.js";import{VerdocsEndpoint,getTemplate,integerSequence,getOrganizationContacts,isValidEmail,createEnvelope,formatFullName,getRGBA,createTemplateDocument,deleteTemplateDocument,updateField,createField,updateTemplateRole,createTemplateRole}from"@verdocs/js-sdk";import{a as renderDocumentField,g as getFieldId,h as updateCssTransform,i as removeCssTransform,j as setControlStyles,d as defaultHeight,k as defaultWidth}from"./utils-Bty_rQI7.js";import{S as SDKError}from"./errors-C1sRVZWv.js";import{S as Store}from"./Datastore-C7hFgM52.js";import{D as DefaultEndpoint}from"./Environment-C_Xku1v2.js";import{V as VerdocsToast}from"./Toast-D97GxsI-.js";import{a as DocIcon,P as PngIcon,J as JpgIcon,b as PdfIcon,F as FileIcon,c as PageCountIcon,T as TrashIcon,D as DocumentPageIcon}from"./Icons-BU5rnXp2.js";import"./_commonjsHelpers-BFTU3MAI.js";import"./index-dzBXqXlK.js";import"./Types-BqoC0yeA.js";var verdocsPreviewCss='verdocs-preview{font-family:var(--verdocs-primary-font, "Inter", "Barlow", sans-serif);display:-ms-flexbox;display:flex;padding:15px;row-gap:15px;min-height:200px;position:relative;-ms-flex-align:center;align-items:center;-webkit-box-sizing:border-box;box-sizing:border-box;-ms-flex-direction:column;flex-direction:column}verdocs-preview div,verdocs-preview canvas{-webkit-box-sizing:border-box;box-sizing:border-box}';var VerdocsPreview=function(){function e(e){registerInstance(this,e);this.sdkError=createEvent(this,"sdkError");this.templateListenerId=null;this.renderedPages={};this.endpoint=VerdocsEndpoint.getDefault();this.templateId=null;this.loading=true;this.template=null}e.prototype.disconnectedCallback=function(){this.unlistenToTemplate()};e.prototype.listenToTemplate=function(){return __awaiter(this,void 0,void 0,(function(){var e=this;return __generator(this,(function(t){this.unlistenToTemplate();Store.subscribe("templates",this.templateId,(function(){return getTemplate(e.endpoint,e.templateId)}),false,(function(t){e.template=t;e.loading=false}));return[2]}))}))};e.prototype.unlistenToTemplate=function(){if(this.templateListenerId){Store.store.delListener(this.templateListenerId);this.templateListenerId=null}};e.prototype.onTemplateIdChanged=function(e){console.log("[PREVIEW] Template ID changed",e);this.listenToTemplate()};e.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,n;return __generator(this,(function(r){try{this.endpoint.loadSession();if(!this.endpoint.session){console.log("[PREVIEW] Unable to start builder session, must be authenticated");return[2]}if(!this.templateId){console.log("[PREVIEW] Missing required template ID ".concat(this.templateId));return[2]}this.listenToTemplate()}catch(r){console.log("[PREVIEW] Error with preview session",r);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new SDKError(r.message,(t=r.response)===null||t===void 0?void 0:t.status,(n=r.response)===null||n===void 0?void 0:n.data))}return[2]}))}))};e.prototype.componentDidRender=function(){var e;(e=this.hostEl)===null||e===void 0?void 0:e.querySelectorAll(".verdocs-field").forEach((function(e){interact(e).unset()}))};e.prototype.handlePageRendered=function(e){var t;var n=e.detail;this.renderedPages["".concat(n.documentId,":").concat(n.pageNumber)]=n;var r=(((t=this.template)===null||t===void 0?void 0:t.fields)||[]).filter((function(e){if(e["document_id"]){return e["document_id"]===n.documentId&&e.page===n.pageNumber}return e.page===n.pageNumber}));r.forEach((function(e){return renderDocumentField("template",e,n,{disabled:true,editable:false,draggable:false})}))};e.prototype.render=function(){var e=this;var t;if(this.loading){return h(Host,null,h("verdocs-loader",null))}return h(Host,null,(((t=this.template)===null||t===void 0?void 0:t.documents)||[]).map((function(t){var n=integerSequence(1,t.pages);return h(Fragment,null,n.map((function(n){var r;var o=((r=t.page_sizes)===null||r===void 0?void 0:r[n])||{width:612,height:792};return h("verdocs-template-document-page",{templateId:t.template_id,documentId:t.id,pageNumber:n,disabled:true,editable:false,done:false,virtualWidth:o.width,virtualHeight:o.height,onPageRendered:function(t){return e.handlePageRendered(t)},layers:[{name:"page",type:"canvas"},{name:"controls",type:"div"}]})})))})))};Object.defineProperty(e.prototype,"hostEl",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{templateId:["onTemplateIdChanged"]}},enumerable:false,configurable:true});return e}();VerdocsPreview.style=verdocsPreviewCss;var getRoleNames=function(e){return((e===null||e===void 0?void 0:e.roles)||[]).map((function(e){return e.name}))};var getRoleIndex=function(e,t){return Math.max(getRoleNames(e).findIndex((function(e){return e===t})),0)};var verdocsSendCss='verdocs-send{padding:10px;position:relative;background:#ffffff;-ms-flex-direction:column;flex-direction:column;font-family:var(--verdocs-primary-font, "Inter", "Barlow", sans-serif)}verdocs-send.sendable{display:-ms-flexbox;display:flex}verdocs-send .recipients{position:relative}verdocs-send .left-line{top:32px;left:20px;z-index:1;width:12px;bottom:30px;position:absolute;background:#ffffff;border-left:3px dotted #9b9b9b}verdocs-send .level{display:-ms-flexbox;display:flex;-webkit-column-gap:10px;-moz-column-gap:10px;column-gap:10px;margin-left:50px;position:relative;-ms-flex-direction:row;flex-direction:row;padding:8px 0 4px 0;border-bottom:1px solid rgba(151, 151, 151, 0.2666666667)}verdocs-send .level .level-icon{top:14px;z-index:2;left:-40px;width:24px;height:24px;position:absolute;background:#ffffff}verdocs-send .level .level-icon svg{fill:rgba(0, 0, 0, 0.537254902)}verdocs-send .level .recipient{height:30px;display:-ms-flexbox;display:flex;-ms-flex:0 0 30px;flex:0 0 30px;color:#000000;cursor:pointer;font-size:14px;-ms-flex-align:center;align-items:center;border-radius:30px;-ms-flex-direction:row;flex-direction:row;background:#dddddd;white-space:nowrap;border:2px solid #dddddd;padding:2px 10px 2px 14px}verdocs-send .level .recipient .icon{width:22px;height:22px;-ms-flex:0 0 22px;flex:0 0 22px;margin:0 0 0 10px}verdocs-send .level .recipient .icon svg{width:22px;height:22px;fill:#333333;outline:none}verdocs-send .level .complete{-ms-flex:1;flex:1;height:30px;display:-ms-flexbox;display:flex;color:#000000;font-size:14px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;padding:3px 10px 3px 2px}verdocs-send .buttons{display:-ms-flexbox;display:flex;margin-top:10px;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;-ms-flex-wrap:wrap;flex-wrap:wrap;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center}verdocs-send .buttons .error-message{width:100%;color:#cc0000;font-size:13px;margin-bottom:10px}verdocs-send verdocs-contact-picker{left:0;top:41px;z-index:10;position:absolute;border:1px solid #dddddd;-webkit-box-shadow:0 0 6px 3px rgba(0, 0, 0, 0.1);box-shadow:0 0 6px 3px rgba(0, 0, 0, 0.1)}';var editIcon='<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" tabindex="-1"><path d="M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34a.9959.9959 0 0 0-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z"></path></svg>';var startIcon='<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" tabindex="-1"><path d="M2 12C2 6.48 6.48 2 12 2s10 4.48 10 10-4.48 10-10 10S2 17.52 2 12zm10 6c3.31 0 6-2.69 6-6s-2.69-6-6-6-6 2.69-6 6 2.69 6 6 6z"></path></svg>';var stepIcon='<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" tabindex="-1"><path d="M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z"></path></svg>';var doneIcon='<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" tabindex="-1"><path d="m18 7-1.41-1.41-6.34 6.34 1.41 1.41L18 7zm4.24-1.41L11.66 16.17 7.48 12l-1.41 1.41L11.66 19l12-12-1.42-1.41zM.41 13.41 6 19l1.41-1.41L1.83 12 .41 13.41z"></path></svg>';var VerdocsSend=function(){function e(e){registerInstance(this,e);this.beforeSend=createEvent(this,"beforeSend");this.send=createEvent(this,"send");this.exit=createEvent(this,"exit");this.sdkError=createEvent(this,"sdkError");this.searchContacts=createEvent(this,"searchContacts");this.templateListenerId=null;this.endpoint=DefaultEndpoint;this.templateId=null;this.environment="";this.showCancel=true;this.containerId="verdocs-send-".concat(Math.random().toString(36).substring(2,11));this.showPickerForId="";this.sessionContacts=[];this.sending=false;this.rolesCompleted={};this.loading=true;this.template=null}e.prototype.disconnectedCallback=function(){this.unlistenToTemplate()};e.prototype.listenToTemplate=function(){return __awaiter(this,void 0,void 0,(function(){var e=this;return __generator(this,(function(t){console.log("[SEND] Loading template",this.templateId);this.unlistenToTemplate();Store.subscribe("templates",this.templateId,(function(){return getTemplate(e.endpoint,e.templateId)}),true,(function(t){console.log("[SEND] Got new template",t);e.template=t;e.loading=false;e.rolesCompleted={};e.recomputeRolesCompleted()}));return[2]}))}))};e.prototype.unlistenToTemplate=function(){if(this.templateListenerId){Store.store.delListener(this.templateListenerId);this.templateListenerId=null}};e.prototype.reset=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){this.rolesCompleted={};return[2]}))}))};e.prototype.onTemplateIdChanged=function(e){console.log("[SEND] Template ID changed",e);this.listenToTemplate()};e.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,n;var r=this;return __generator(this,(function(o){try{this.endpoint.onSessionChanged((function(e,t,n){if(!n){return}var o={id:n.id,first_name:n.first_name,last_name:n.last_name,email:n.email,phone:n.phone};if(n){r.sessionContacts=[o];getOrganizationContacts(r.endpoint).then((function(e){console.log("[SEND] Got contacts",e);r.sessionContacts=__spreadArray(__spreadArray([],e,true),[o],false)})).catch((function(e){console.log("[SEND] Error getting contacts",e)}))}}));this.endpoint.loadSession();if(!this.endpoint.session){console.log("[SEND] Unable to start Send operation, must be authenticated");return[2]}if(!this.templateId){console.log("[SEND] Missing required template ID ".concat(this.templateId));return[2]}this.listenToTemplate()}catch(r){console.log("[SEND] Error with send session",r);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new SDKError(r.message,(t=r.response)===null||t===void 0?void 0:t.status,(n=r.response)===null||n===void 0?void 0:n.data))}return[2]}))}))};e.prototype.recomputeRolesCompleted=function(){var e=this;var t;this.rolesCompleted={};var n={};(((t=this.template)===null||t===void 0?void 0:t.roles)||[]).forEach((function(t){var r=t.sequence;n[r]||(n[r]=[]);var o="r-".concat(r,"-").concat(n[r].length);n[r].push(__assign(__assign({},t),{id:o,role_name:t.name,first_name:t.first_name,last_name:t.last_name}));if(t.first_name&&isValidEmail(t.email)){e.rolesCompleted[o]=__assign(__assign({},t),{id:o,role_name:t.name,first_name:t.first_name,last_name:t.last_name})}}))};e.prototype.getSequenceNumbers=function(){var e;var t={};(((e=this.template)===null||e===void 0?void 0:e.roles)||[]).forEach((function(e){t[e.sequence]=true}));return Object.keys(t).map((function(e){return+e})).sort((function(e,t){return e-t}))};e.prototype.getRolesAtLevel=function(e){var t;var n=(((t=this.template)===null||t===void 0?void 0:t.roles)||[]).filter((function(t){return t.sequence===e})).map((function(t,n){return __assign(__assign({},t),{id:"r-".concat(e,"-").concat(n),role_name:t.name,first_name:t.first_name,last_name:t.last_name})}));return n};e.prototype.getLevelIcon=function(e){if(e==="start"){return h("div",{class:"level-icon",innerHTML:startIcon})}else if(e==="end"){return h("div",{class:"level-icon",innerHTML:doneIcon})}else{return h("div",{class:"level-icon",innerHTML:stepIcon})}};e.prototype.handleSelectContact=function(e,t){e.preventDefault();this.rolesCompleted[t.id]=__assign(__assign({},t),e.detail);this.showPickerForId=""};e.prototype.handleClickRole=function(e,t){e.stopPropagation();this.showPickerForId=t.id};e.prototype.handleSend=function(e){var t=this;var n;if(this.sending){console.log("[SEND] Skipping duplicate send",e);return}console.log("[SEND] Sending",e);e.preventDefault();e.stopPropagation();this.sending=true;var r={template_id:this.templateId,name:((n=this.template)===null||n===void 0?void 0:n.name)||"New Envelope",environment:this.environment,initial_reminder:0,followup_reminders:0,recipients:Object.values(this.rolesCompleted)};var o=this.beforeSend.emit(__assign(__assign({},r),{name:r.name,template:this.template}));if(o.defaultPrevented){console.log("[SEND] Send cancelled by parent",r);this.sending=false;return}console.log("[SEND] Creating envelope",r);createEnvelope(this.endpoint,r).then((function(e){var n;console.log("[SEND] Send envelope",e);t.reset().catch((function(e){return console.log("Unknown Error",e)}));t.sending=false;(n=t.send)===null||n===void 0?void 0:n.emit(__assign(__assign({},r),{name:r.name,envelope_id:e.id,envelope:e}))})).catch((function(e){var n,r,o;console.log("[SEND] Send error",e);VerdocsToast(((r=(n=e.response)===null||n===void 0?void 0:n.data)===null||r===void 0?void 0:r.error)||"Error creating envelope, please try again later.");t.sending=false;(o=t.sdkError)===null||o===void 0?void 0:o.emit(e)}))};e.prototype.handleCancel=function(e){var t;e.stopPropagation();(t=this.exit)===null||t===void 0?void 0:t.emit()};e.prototype.render=function(){var e=this;var t;if(this.loading){return h(Host,null,h("verdocs-loader",null))}if(!this.endpoint.session){return h(Host,{style:{display:"flex"}},h("verdocs-component-error",{message:"You must be authenticated to use this module."}))}var n=this.getSequenceNumbers();var r=Object.values(this.rolesCompleted).filter((function(e){return isValidEmail(e.email)&&e.first_name&&e.last_name}));var o=r.length>=getRoleNames(this.template).length;var i=r.map((function(e){return e.email.toLowerCase()}));var s=new Set(i).size<i.length;return h(Host,{class:{sendable:(t=this.template)===null||t===void 0?void 0:t.is_sendable}},h("div",{class:"recipients"},h("div",{class:"left-line"}),h("div",{class:"level level-start"},this.getLevelIcon("start"),h("div",{class:"complete"},"Send Envelope")),n.map((function(t){return h("div",{class:"level level-".concat(t)},e.getLevelIcon("sequence"),e.getRolesAtLevel(t).map((function(t){var n,o,i;var s=!t.email||!t.first_name||!t.last_name;var a=((n=e.rolesCompleted[t.id])===null||n===void 0?void 0:n.first_name)?formatFullName(e.rolesCompleted[t.id]):s?t.role_name:formatFullName(t);var l="verdocs-send-recipient-".concat(t.role_name);var c=getRoleIndex(e.template,t.role_name);var d=getRGBA(c);var u=r.findIndex((function(e){return e.role_name===t.role_name}))>-1;var f={backgroundColor:d,border:u?"2px solid #55bc81":"2px solid #dddddd"};return s?h("div",{class:"recipient","data-ri":c,"data-rn":t.role_name,style:f,onClick:function(n){return e.handleClickRole(n,t)},id:l},a,h("div",{class:"icon",innerHTML:editIcon}),e.showPickerForId===t.id&&h("verdocs-portal",{anchor:l,onClickAway:function(){return e.showPickerForId=""}},h("verdocs-contact-picker",{onExit:function(){return e.showPickerForId=""},onNext:function(n){return e.handleSelectContact(n,t)},contactSuggestions:e.sessionContacts,templateRole:(o=e.rolesCompleted[t.id])!==null&&o!==void 0?o:t,onSearchContacts:function(t){var n;return(n=e.searchContacts)===null||n===void 0?void 0:n.emit(t.detail)}}))):h("div",{class:"recipient","data-ri":c,"data-rn":t.role_name,style:f,onClick:function(n){return e.handleClickRole(n,t)},id:l},a,h("div",{class:"icon",innerHTML:editIcon}),e.showPickerForId===t.id&&h("verdocs-portal",{anchor:l,onClickAway:function(){return e.showPickerForId=""}},h("verdocs-contact-picker",{onExit:function(){return e.showPickerForId=""},onNext:function(n){return e.handleSelectContact(n,t)},contactSuggestions:e.sessionContacts,templateRole:(i=e.rolesCompleted[t.id])!==null&&i!==void 0?i:t,onSearchContacts:function(t){var n;return(n=e.searchContacts)===null||n===void 0?void 0:n.emit(t.detail)}})))})))})),h("div",{class:"level level-done"},this.getLevelIcon("end"),h("div",{class:"complete"},"Signing Complete"))),h("div",{class:"buttons"},s&&h("div",{class:"error-message"},"Recipients cannot share the same email."),this.showCancel&&h("verdocs-button",{label:"Cancel",size:"small",variant:"outline",onClick:function(t){return e.handleCancel(t)},disabled:this.sending}),h("verdocs-button",{label:"Send",size:"small",disabled:!o||this.sending||s,onClick:function(t){return e.handleSend(t)}}),this.sending&&h("verdocs-spinner",null)))};Object.defineProperty(e,"watchers",{get:function(){return{templateId:["onTemplateIdChanged"]}},enumerable:false,configurable:true});return e}();VerdocsSend.style=verdocsSendCss;var verdocsTemplateAttachmentsCss='verdocs-template-attachments{font-family:var(--verdocs-primary-font, "Inter", "Barlow", sans-serif)}verdocs-template-attachments h5{font-size:16px;font-weight:bold;margin:0 0 10px 0;color:#46497d}verdocs-template-attachments .attachments{margin:0 0 40px 0}verdocs-template-attachments .attachment{display:-ms-flexbox;display:flex;padding:5px 0;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;color:#33364b}verdocs-template-attachments .attachment:hover .trash-icon{display:-ms-flexbox;display:flex}verdocs-template-attachments .attachment:hover .pages{display:none}verdocs-template-attachments svg{width:28px;height:28px;fill:#5c6575;margin:2px 0 0 0}verdocs-template-attachments .file-icon{-ms-flex:0;flex:0}verdocs-template-attachments .pages{width:24px;height:24px;-ms-flex:0 0 24px;flex:0 0 24px;padding-left:4px;position:relative;margin:-10px 0 0 0}verdocs-template-attachments .pages .pages-icon{top:0;left:0;width:24px;height:24px;position:absolute}verdocs-template-attachments .pages .count{top:11px;left:7px;z-index:1;width:18px;font-size:12px;font-weight:500;position:absolute;text-align:center;letter-spacing:-2px}verdocs-template-attachments .filename{-ms-flex:1;flex:1;display:block;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;border-bottom:1px dotted #cccccc}verdocs-template-attachments .trash-icon{-ms-flex:0;flex:0;display:none}verdocs-template-attachments .trash-icon:hover{cursor:pointer}verdocs-template-attachments verdocs-file-chooser{margin:10px 0;border:2px dashed #979797}verdocs-template-attachments .loader-wrapper{background-color:#ffffff;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-webkit-box-sizing:border-box;box-sizing:border-box;position:relative;width:320px;height:320px;text-align:center;border:2px dashed #979797;-ms-flex-pack:end;justify-content:flex-end}verdocs-template-attachments .progress-wrapper{padding:20px}verdocs-template-attachments .buttons{display:-ms-flexbox;display:flex;-webkit-column-gap:8px;-moz-column-gap:8px;column-gap:8px;margin-top:16px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:end;justify-content:flex-end}verdocs-template-attachments .buttons .flex-fill{-ms-flex:1;flex:1}verdocs-template-attachments ::-webkit-input-placeholder{color:#aaaaaa}verdocs-template-attachments ::-moz-placeholder{color:#aaaaaa}verdocs-template-attachments :-ms-input-placeholder{color:#aaaaaa}verdocs-template-attachments ::-ms-input-placeholder{color:#aaaaaa}verdocs-template-attachments ::placeholder{color:#aaaaaa}';var VerdocsTemplateAttachments=function(){function e(e){registerInstance(this,e);this.exit=createEvent(this,"exit");this.next=createEvent(this,"next");this.templateUpdated=createEvent(this,"templateUpdated");this.sdkError=createEvent(this,"sdkError");this.templateListenerId=null;this.endpoint=VerdocsEndpoint.getDefault();this.templateId="";this.uploading=false;this.progressLabel="Uploading...";this.progressPercent=0;this.showDeleteError=false;this.confirmDeleteDocument=null;this.loading=true;this.template=null}e.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,n;return __generator(this,(function(r){try{this.endpoint.loadSession();if(!this.templateId){console.log("[ROLES] Missing required template ID ".concat(this.templateId));return[2]}if(!this.endpoint.session){console.log("[ROLES] Unable to start builder session, must be authenticated");return[2]}this.listenToTemplate()}catch(r){console.log("[TEMPLATE ATTACHMENTS] Error loading template",r);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new SDKError(r.message,(t=r.response)===null||t===void 0?void 0:t.status,(n=r.response)===null||n===void 0?void 0:n.data))}return[2]}))}))};e.prototype.disconnectedCallback=function(){this.unlistenToTemplate()};e.prototype.listenToTemplate=function(){return __awaiter(this,void 0,void 0,(function(){var e=this;return __generator(this,(function(t){this.unlistenToTemplate();Store.subscribe("templates",this.templateId,(function(){return getTemplate(e.endpoint,e.templateId)}),false,(function(t){e.template=t;e.loading=false}));return[2]}))}))};e.prototype.unlistenToTemplate=function(){if(this.templateListenerId){Store.store.delListener(this.templateListenerId);this.templateListenerId=null}};e.prototype.handleCancel=function(e){e.stopPropagation();this.exit.emit()};e.prototype.handleUploadProgress=function(e){if(e>=99){this.progressPercent=100;this.progressLabel="Processing..."}else{this.progressPercent=e}};e.prototype.handleUpload=function(e){return __awaiter(this,void 0,void 0,(function(){var t,n,r,o,i,s,a,l;return __generator(this,(function(c){switch(c.label){case 0:e.stopPropagation();i=e.detail.file;if(!i){return[2]}console.log("[ATTACHMENTS] Uploading...",i);this.uploading=true;this.progressLabel="Uploading...";c.label=1;case 1:c.trys.push([1,4,,5]);return[4,createTemplateDocument(this.endpoint,this.templateId,i,this.handleUploadProgress.bind(this))];case 2:s=c.sent();console.log("[ATTACHMENTS] Created attachment",s);a=this;return[4,Store.getTemplate(this.endpoint,this.templateId,true)];case 3:a.template=c.sent();console.log("[ATTACHMENTS] Updated template",this.template);(t=this.templateUpdated)===null||t===void 0?void 0:t.emit({endpoint:this.endpoint,template:this.template,event:"attachments"});this.uploading=false;this.progressLabel="";this.progressPercent=0;return[3,5];case 4:l=c.sent();console.log("[ATTACHMENTS] Error creating template",l);(n=this.sdkError)===null||n===void 0?void 0:n.emit(new SDKError(l.message,(r=l.response)===null||r===void 0?void 0:r.status,(o=l.response)===null||o===void 0?void 0:o.data));this.uploading=false;return[3,5];case 5:return[2]}}))}))};e.prototype.handleNext=function(e){var t;e.stopPropagation();this.uploading=false;this.progressLabel="";this.progressPercent=0;(t=this.next)===null||t===void 0?void 0:t.emit({template:this.template})};e.prototype.confirmDelete=function(){return __awaiter(this,void 0,void 0,(function(){var e;return __generator(this,(function(t){switch(t.label){case 0:return[4,deleteTemplateDocument(this.endpoint,this.confirmDeleteDocument.id)];case 1:t.sent();e=this;return[4,Store.getTemplate(this.endpoint,this.templateId,true)];case 2:e.template=t.sent();console.log("[ATTACHMENTS] New template",this.template);this.confirmDeleteDocument=null;return[2]}}))}))};e.prototype.handleDelete=function(e){return __awaiter(this,void 0,void 0,(function(){var t;return __generator(this,(function(n){if((((t=this.template)===null||t===void 0?void 0:t.documents)||[]).length>1){this.confirmDeleteDocument=e}else{this.showDeleteError=true}return[2]}))}))};e.prototype.getFileIcon=function(e){switch(e.mime){case"application/pdf":return PdfIcon;case"image/jpeg":return JpgIcon;case"image/png":return PngIcon;case"application/msword":case"application/vnd.openxmlformats-officedocument.wordprocessingml.document":return DocIcon}return FileIcon};e.prototype.render=function(){var e=this;var t,n;if(!this.endpoint.session){return h(Host,null,h("verdocs-component-error",{message:"You must be authenticated to use this module."}))}if(this.loading){return h(Host,{class:"loading"},h("verdocs-loader",null))}if(!this.endpoint.session||!this.template){return h(Host,{class:"empty"})}return h(Host,null,h("h5",null,"Existing Attachments"),h("div",{class:"attachments"},(((t=this.template)===null||t===void 0?void 0:t.documents)||[]).map((function(t){return h("div",{class:"attachment"},h("div",{class:"file-icon",innerHTML:e.getFileIcon(t)}),h("div",{class:"filename",title:t.name},t.name),h("div",{class:"pages"},h("div",{class:"count"},t.pages),h("div",{class:"pages-icon",innerHTML:PageCountIcon})),h("div",{class:"trash-icon",innerHTML:TrashIcon,onClick:function(){return e.handleDelete(t)}}))}))),h("h5",null,"Attach a New Document"),this.uploading?h("div",{class:"loader-wrapper"},h("verdocs-loader",null),this.progressLabel&&h("div",{class:"progress-wrapper"},h("verdocs-progress-bar",{showPercent:true,percent:this.progressPercent,label:this.progressLabel}))):h("verdocs-file-chooser",{onFileSelected:function(t){return e.handleUpload(t)}}),h("div",{class:"buttons"},h("verdocs-button",{variant:"outline",label:"Cancel",size:"small",onClick:function(t){return e.handleCancel(t)},disabled:this.uploading}),h("verdocs-button",{label:"Next",size:"small",onClick:function(t){return e.handleNext(t)},disabled:!(((n=this.template)===null||n===void 0?void 0:n.documents)||[]).length||this.uploading})),this.showDeleteError&&h("verdocs-ok-dialog",{heading:"Unable to Delete Attachment",message:"Templates must contain at least one attachment.",onNext:function(){return e.showDeleteError=false}}),this.confirmDeleteDocument&&h("verdocs-ok-dialog",{heading:"Delete this Attachment?",message:"This operation cannot be undone. All fields placed<br />on the deleted attachment will also be removed.",onNext:function(){return e.confirmDelete()},showCancel:true,onExit:function(){e.confirmDeleteDocument=null}}))};return e}();VerdocsTemplateAttachments.style=verdocsTemplateAttachmentsCss;var verdocsTemplateBuildTabsCss='verdocs-template-build-tabs{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:end;align-items:flex-end;-ms-flex:0 0 50px;flex:0 0 50px;width:100%;background:#ffffff;color:#72757d;border-bottom:1px solid #dddddd;-webkit-filter:drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));filter:drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));font-family:var(--verdocs-primary-font, "Inter", "Barlow", sans-serif)}verdocs-template-build-tabs .tab{position:relative;display:-ms-flexbox;display:flex;-ms-flex:1;flex:1;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;height:50px;padding:0 4px;background:#e7e7e7;font-weight:700;font-size:12px;cursor:pointer}@media (min-width: 768px){verdocs-template-build-tabs .tab{padding:0 8px 0 24px;font-size:14px}}verdocs-template-build-tabs .tab svg{position:absolute;top:0;right:-19px;z-index:10;pointer-events:none;display:none}@media (min-width: 768px){verdocs-template-build-tabs .tab svg{display:block}}verdocs-template-build-tabs .tab.active{background:#ffffff;color:#707ae5}verdocs-template-build-tabs .tab.disabled{cursor:default;color:#d1d5db}';var VerdocsTemplateBuildTabs=function(){function e(e){registerInstance(this,e);this.sdkError=createEvent(this,"sdkError");this.stepChanged=createEvent(this,"stepChanged");this.templateListenerId=null;this.endpoint=VerdocsEndpoint.getDefault();this.templateId=null;this.step="preview";this.loading=true;this.template=null}e.prototype.disconnectedCallback=function(){this.unlistenToTemplate()};e.prototype.listenToTemplate=function(){return __awaiter(this,void 0,void 0,(function(){var e=this;return __generator(this,(function(t){this.unlistenToTemplate();Store.subscribe("templates",this.templateId,(function(){return getTemplate(e.endpoint,e.templateId)}),false,(function(t){e.template=t;e.loading=false}));return[2]}))}))};e.prototype.unlistenToTemplate=function(){if(this.templateListenerId){Store.store.delListener(this.templateListenerId);this.templateListenerId=null}};e.prototype.onTemplateIdChanged=function(e){console.log("[BUILD_TABS] Template ID changed",e);this.listenToTemplate()};e.prototype.onStepChanged=function(e){console.log("[BUILD_TABS] Step changed",e)};e.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,n;return __generator(this,(function(r){try{this.endpoint.loadSession();if(!this.endpoint.session){console.log("[BUILD_TABS] Unable to start builder session, must be authenticated");return[2]}if(!this.templateId){this.step="attachments";console.log("[BUILD_TABS] Missing required template ID, forcing view to attachments");return[2]}this.listenToTemplate()}catch(r){console.log("[BUILD_TABS] Error loading template",r);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new SDKError(r.message,(t=r.response)===null||t===void 0?void 0:t.status,(n=r.response)===null||n===void 0?void 0:n.data))}return[2]}))}))};e.prototype.handleSelect=function(e){var t;if(e.disabled||e.id===this.step){return}this.step=e.id;(t=this.stepChanged)===null||t===void 0?void 0:t.emit(e.id)};e.prototype.render=function(){var e=this;var t,n,r;if(this.loading){return h(Host,null,h("verdocs-loader",null))}if(!this.endpoint.session){return h(Host,null,h("verdocs-component-error",{message:"You must be authenticated to use this module."}))}var o=(((t=this.template)===null||t===void 0?void 0:t.documents)||[]).length>0;var i=o&&(((n=this.template)===null||n===void 0?void 0:n.roles)||[]).length>0;var s=i&&(((r=this.template)===null||r===void 0?void 0:r.fields)||[]).length>0;var a=[{id:"attachments",label:"Attachments",disabled:false},{id:"roles",label:"Workflow",disabled:!o},{id:"fields",label:"Fields",disabled:!i},{id:"preview",label:"Preview & Send",disabled:!s}];return h(Host,null,a.map((function(t){var n=t.id===e.step;var r=["tab"];if(n)r.push("active");if(t.disabled)r.push("disabled");return h("div",{class:r.join(" "),onClick:function(){return e.handleSelect(t)}},h("span",null,t.label),h("svg",{"aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",width:"19",height:"50",viewBox:"0 0 19 50"},h("polygon",{points:"0,0 19,25 0,50",fill:n?"#ffffff":"#e7e7e7"})))})))};Object.defineProperty(e,"watchers",{get:function(){return{templateId:["onTemplateIdChanged"],step:["onStepChanged"]}},enumerable:false,configurable:true});return e}();VerdocsTemplateBuildTabs.style=verdocsTemplateBuildTabsCss;var verdocsTemplateFieldsCss="verdocs-template-fields{font-family:var(--verdocs-primary-font, \"Inter\", \"Barlow\", sans-serif);position:relative;display:block;min-height:600px}verdocs-template-fields .page-0{padding:65px 15px 0 15px;-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-template-fields .page-0 .user-placed-fields{height:100px;position:relative;background:#ffffff;-webkit-box-shadow:0 0 10px 5px rgba(0, 0, 0, 0.0588235294);box-shadow:0 0 10px 5px rgba(0, 0, 0, 0.0588235294)}verdocs-template-fields .page-0 .user-placed-fields .title{top:0;left:0;color:#ffffff;font-size:12px;padding:3px 6px;font-weight:bold;position:absolute;background:#46497d}verdocs-template-fields .pages{display:-ms-flexbox;display:flex;padding:15px;row-gap:15px;min-height:200px;position:relative;-ms-flex-align:center;align-items:center;-webkit-box-sizing:border-box;box-sizing:border-box;-ms-flex-direction:column;flex-direction:column}verdocs-template-fields .pages div,verdocs-template-fields .pages canvas{-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-template-fields .pages .document-separator{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;gap:10px;padding:12px 20px;width:100%;-webkit-box-sizing:border-box;box-sizing:border-box;background-color:#33364b;color:white;border-radius:6px;font-size:16px;font-weight:500;margin-top:20px;-webkit-box-shadow:0 2px 4px rgba(0, 0, 0, 0.1);box-shadow:0 2px 4px rgba(0, 0, 0, 0.1)}verdocs-template-fields .pages .document-separator svg{-ms-flex-negative:0;flex-shrink:0}verdocs-template-fields .pages .document-separator:first-child{margin-top:0}verdocs-template-fields #verdocs-template-fields-toolbar{width:100%;height:50px;display:-ms-flexbox;display:flex;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;font-weight:700;padding:0 20px 0 0;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;color:#f5f5fa;-ms-flex-pack:center;justify-content:center;background:#46497d}verdocs-template-fields #verdocs-template-fields-toolbar>verdocs-select-input{margin:0}verdocs-template-fields #verdocs-template-fields-toolbar svg{width:24px;height:24px}verdocs-template-fields #verdocs-template-fields-toolbar .add-for{margin:0;font-weight:500;color:#f5f5fa}verdocs-template-fields #verdocs-template-fields-toolbar verdocs-select-input{margin:0 20px 0 0}@media all and (max-width: 1000px){verdocs-template-fields #verdocs-template-fields-toolbar{-webkit-column-gap:8px;-moz-column-gap:8px;column-gap:8px;padding:0 10px 0 0}verdocs-template-fields #verdocs-template-fields-toolbar svg{-webkit-transform:scale(0.8);transform:scale(0.8)}verdocs-template-fields #verdocs-template-fields-toolbar .add-for,verdocs-template-fields #verdocs-template-fields-toolbar verdocs-select-input{display:none}}@media all and (max-width: 600px){verdocs-template-fields #verdocs-template-fields-toolbar{-webkit-column-gap:6px;-moz-column-gap:6px;column-gap:6px}verdocs-template-fields #verdocs-template-fields-toolbar svg{-webkit-transform:scale(0.6);transform:scale(0.6)}verdocs-template-fields #verdocs-template-fields-toolbar .separator,verdocs-template-fields #verdocs-template-fields-toolbar .add-for,verdocs-template-fields #verdocs-template-fields-toolbar verdocs-select-input{display:none}}verdocs-template-fields.placing-attachment{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='m10.55 16.55 7.275-7.275L16.05 7.5l-5.5 5.45-2.675-2.65L6.1 12.075Zm-5.375 4.925q-1.125 0-1.887-.763-.763-.762-.763-1.887V5.175q0-1.125.763-1.888.762-.762 1.887-.762h13.65q1.125 0 1.888.762.762.763.762 1.888v13.65q0 1.125-.762 1.887-.763.763-1.888.763Zm0-2.65h13.65V5.175H5.175v13.65Zm0-13.65v13.65-13.65Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-checkbox{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='m10.55 16.55 7.275-7.275L16.05 7.5l-5.5 5.45-2.675-2.65L6.1 12.075Zm-5.375 4.925q-1.125 0-1.887-.763-.763-.762-.763-1.887V5.175q0-1.125.763-1.888.762-.762 1.887-.762h13.65q1.125 0 1.888.762.762.763.762 1.888v13.65q0 1.125-.762 1.887-.763.763-1.888.763Zm0-2.65h13.65V5.175H5.175v13.65Zm0-13.65v13.65-13.65Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-date{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath fill='%23000000' d='M7.6 13.925q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375Zm4.4 0q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375Zm4.4 0q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375ZM5.3 22.85q-1.325 0-2.238-.912-.912-.913-.912-2.238V6.3q0-1.325.912-2.238.913-.912 2.238-.912H6v-2h2.575v2h6.85v-2H18v2h.7q1.325 0 2.238.912.912.913.912 2.238v13.4q0 1.325-.912 2.238-.913.912-2.238.912Zm0-3.15h13.4V10H5.3v9.7ZM5.3 8h13.4V6.3H5.3Zm0 0V6.3 8Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-dropdown{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24' stroke-width='1.5' stroke='currentColor'%3E%3Cpath stroke='%23000000' stroke-linecap='round' stroke-linejoin='round' d='M3 4.5h14.25M3 9h9.75M3 13.5h9.75m4.5-4.5v12m0 0l-3.75-3.75M17.25 21L21 17.25' /%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-initial{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='M6.225 20.775V7h-5V3.225H15V7h-5v13.775Zm9.775 0v-8h-3V9h9.775v3.775h-3v8Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-payment{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='m10.55 16.55 7.275-7.275L16.05 7.5l-5.5 5.45-2.675-2.65L6.1 12.075Zm-5.375 4.925q-1.125 0-1.887-.763-.763-.762-.763-1.887V5.175q0-1.125.763-1.888.762-.762 1.887-.762h13.65q1.125 0 1.888.762.762.763.762 1.888v13.65q0 1.125-.762 1.887-.763.763-1.888.763Zm0-2.65h13.65V5.175H5.175v13.65Zm0-13.65v13.65-13.65Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-radio{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='M12 17q2.075 0 3.538-1.463Q17 14.075 17 12t-1.462-3.538Q14.075 7 12 7 9.925 7 8.463 8.462 7 9.925 7 12q0 2.075 1.463 3.537Q9.925 17 12 17Zm0 5.85q-2.275 0-4.25-.85t-3.438-2.312Q2.85 18.225 2 16.25q-.85-1.975-.85-4.25T2 7.75q.85-1.975 2.312-3.438Q5.775 2.85 7.75 2q1.975-.85 4.25-.85t4.25.85q1.975.85 3.438 2.312Q21.15 5.775 22 7.75q.85 1.975.85 4.25T22 16.25q-.85 1.975-2.312 3.438Q18.225 21.15 16.25 22q-1.975.85-4.25.85Zm0-3.15q3.25 0 5.475-2.225Q19.7 15.25 19.7 12q0-3.25-2.225-5.475Q15.25 4.3 12 4.3q-3.25 0-5.475 2.225Q4.3 8.75 4.3 12q0 3.25 2.225 5.475Q8.75 19.7 12 19.7Zm0-7.7Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-signature{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='m9.225 21.225 4.65-4.65h8.45v4.65Zm-5.35-2.2H5.05l8.5-8.5-1.175-1.175-8.5 8.5Zm14.25-9.95L13.8 4.8l1.325-1.325q.625-.65 1.525-.663.9-.012 1.6.663l1.225 1.175q.675.675.663 1.562-.013.888-.663 1.513ZM16.7 10.55 6 21.225H1.675V16.9L12.35 6.225Zm-3.725-.625-.6-.575 1.175 1.175Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-textarea{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='M3.225 20.725v-3.15h11.55v3.15Zm0-4.775V12.8h17.55v3.15Zm0-4.75V8.05h17.55v3.15Zm0-4.775v-3.15h17.55v3.15Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-textbox{cursor:url(\"data:image/svg+xml,%3Csvg width='32' height='15' viewBox='0 0 32 15' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cmask id='path-1-inside-1_1401_24' fill='white'%3E%3Cpath d='M0 0H32V15H0V0Z'/%3E%3C/mask%3E%3Cpath d='M0 0H32V15H0V0Z' fill='%234C56CB' fill-opacity='0.1'/%3E%3Cpath d='M0 0V-1H-1V0H0ZM0 15H-1V16H0V15ZM0 1H32V-1H0V1ZM32 14H0V16H32V14ZM1 15V0H-1V15H1Z' fill='%234C56CB' mask='url(%23path-1-inside-1_1401_24)'/%3E%3Cpath d='M3 11.8V8.65H14.15V11.8H3ZM3 6.65V3.5H20.15V6.65H3Z' fill='%234C56CB'/%3E%3Cline x1='31.5' y1='1' x2='31.5' y2='14' stroke='%234C56CB' stroke-opacity='0.32' stroke-dasharray='1 1'/%3E%3C/svg%3E%0A\") 0 14, pointer}verdocs-template-fields.placing-timestamp{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath fill='%23000000' d='M9 1h6v2H9zm10.03 6.39 1.42-1.42c-.43-.51-.9-.99-1.41-1.41l-1.42 1.42C16.07 4.74 14.12 4 12 4c-4.97 0-9 4.03-9 9s4.02 9 9 9 9-4.03 9-9c0-2.12-.74-4.07-1.97-5.61zM13 14h-2V8h2v6z'%3E%3C/path%3E%3C/svg%3E\") 16 16, pointer}";var iconTextbox='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="M3.425 16.15V13h11.15v3.15Zm0-5.15V7.85h17.15V11Z"/></svg>';var iconCheck='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="m10.55 16.55 7.275-7.275L16.05 7.5l-5.5 5.45-2.675-2.65L6.1 12.075Zm-5.375 4.925q-1.125 0-1.887-.763-.763-.762-.763-1.887V5.175q0-1.125.763-1.888.762-.762 1.887-.762h13.65q1.125 0 1.888.762.762.763.762 1.888v13.65q0 1.125-.762 1.887-.763.763-1.888.763Zm0-2.65h13.65V5.175H5.175v13.65Zm0-13.65v13.65-13.65Z"/></svg>';var iconRadio='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="M12 17q2.075 0 3.538-1.463Q17 14.075 17 12t-1.462-3.538Q14.075 7 12 7 9.925 7 8.463 8.462 7 9.925 7 12q0 2.075 1.463 3.537Q9.925 17 12 17Zm0 5.85q-2.275 0-4.25-.85t-3.438-2.312Q2.85 18.225 2 16.25q-.85-1.975-.85-4.25T2 7.75q.85-1.975 2.312-3.438Q5.775 2.85 7.75 2q1.975-.85 4.25-.85t4.25.85q1.975.85 3.438 2.312Q21.15 5.775 22 7.75q.85 1.975.85 4.25T22 16.25q-.85 1.975-2.312 3.438Q18.225 21.15 16.25 22q-1.975.85-4.25.85Zm0-3.15q3.25 0 5.475-2.225Q19.7 15.25 19.7 12q0-3.25-2.225-5.475Q15.25 4.3 12 4.3q-3.25 0-5.475 2.225Q4.3 8.75 4.3 12q0 3.25 2.225 5.475Q8.75 19.7 12 19.7Zm0-7.7Z"/></svg>';var iconDatepicker='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="M7.6 13.925q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375Zm4.4 0q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375Zm4.4 0q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375ZM5.3 22.85q-1.325 0-2.238-.912-.912-.913-.912-2.238V6.3q0-1.325.912-2.238.913-.912 2.238-.912H6v-2h2.575v2h6.85v-2H18v2h.7q1.325 0 2.238.912.912.913.912 2.238v13.4q0 1.325-.912 2.238-.913.912-2.238.912Zm0-3.15h13.4V10H5.3v9.7ZM5.3 8h13.4V6.3H5.3Zm0 0V6.3 8Z"/></svg>';var iconSignature='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="m9.225 21.225 4.65-4.65h8.45v4.65Zm-5.35-2.2H5.05l8.5-8.5-1.175-1.175-8.5 8.5Zm14.25-9.95L13.8 4.8l1.325-1.325q.625-.65 1.525-.663.9-.012 1.6.663l1.225 1.175q.675.675.663 1.562-.013.888-.663 1.513ZM16.7 10.55 6 21.225H1.675V16.9L12.35 6.225Zm-3.725-.625-.6-.575 1.175 1.175Z"/></svg>';var iconInitial='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="M6.225 20.775V7h-5V3.225H15V7h-5v13.775Zm9.775 0v-8h-3V9h9.775v3.775h-3v8Z"/></svg>';var iconDropdown='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24" stroke-width="1.5" stroke="currentColor"><path stroke="#ffffff" stroke-linecap="round" stroke-linejoin="round" d="M3 4.5h14.25M3 9h9.75M3 13.5h9.75m4.5-4.5v12m0 0l-3.75-3.75M17.25 21L21 17.25" /></svg>';var iconAttachment='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-6"><path stroke-linecap="round" stroke-linejoin="round" d="m18.375 12.739-7.693 7.693a4.5 4.5 0 0 1-6.364-6.364l10.94-10.94A3 3 0 1 1 19.5 7.372L8.552 18.32m.009-.01-.01.01m5.699-9.941-7.81 7.81a1.5 1.5 0 0 0 2.112 2.13" /></svg>';var separator='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14.707 14.707"><g><rect x="6.275" y="0" fill="#ffffff7f" width="1" height="15"/></g></svg>';var menuOptions=[{id:"signature",tooltip:"Signature",icon:iconSignature,class:"signature"},{id:"initial",tooltip:"Initials",icon:iconInitial,class:"initial"},{id:"sep1",tooltip:"",icon:separator,class:"separator"},{id:"textbox",tooltip:"Text Box",icon:iconTextbox,class:"textbox"},{id:"checkbox",tooltip:"Check Box",icon:iconCheck,class:"checkbox"},{id:"radio",tooltip:"Radio Button",icon:iconRadio,class:"radio"},{id:"dropdown",tooltip:"Dropdown",icon:iconDropdown,class:"dropdown"},{id:"sep2",tooltip:"",icon:separator,class:"separator"},{id:"date",tooltip:"Date",icon:iconDatepicker,class:"date"},{id:"attachment",tooltip:"Attachment",icon:iconAttachment,class:"attachment"}];var VerdocsTemplateFields=function(){function e(e){registerInstance(this,e);this.sdkError=createEvent(this,"sdkError");this.templateUpdated=createEvent(this,"templateUpdated");this.templateListenerId=null;this.endpoint=VerdocsEndpoint.getDefault();this.templateId=null;this.toolbarTargetId=null;this.placing=null;this.showMustSelectRole=false;this.selectedRoleName="";this.loading=true;this.template=null;this.pageHeights={};this.cachedPageInfo={}}e.prototype.onTemplateIdChanged=function(){this.listenToTemplate()};e.prototype.handleKeyDown=function(e){if(e.key==="Escape"){this.placing=null}};e.prototype.handleFieldSettingsChanged=function(){var e;(e=this.templateUpdated)===null||e===void 0?void 0:e.emit({endpoint:this.endpoint,template:this.template,event:"updated-field"})};e.prototype.handleFieldDeleted=function(){var e;(e=this.templateUpdated)===null||e===void 0?void 0:e.emit({endpoint:this.endpoint,template:this.template,event:"deleted-field"})};e.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,n;return __generator(this,(function(r){try{this.endpoint.loadSession();if(!this.templateId){console.log("[FIELDS] Missing required template ID ".concat(this.templateId));return[2]}if(!this.endpoint.session){console.log("[FIELDS] Unable to start builder session, must be authenticated");return[2]}this.listenToTemplate()}catch(r){console.log("[FIELDS] Error with fields session",r);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new SDKError(r.message,(t=r.response)===null||t===void 0?void 0:t.status,(n=r.response)===null||n===void 0?void 0:n.data))}return[2]}))}))};e.prototype.componentDidRender=function(){var e=this;interact.dynamicDrop(true);document.querySelectorAll(".verdocs-field").forEach((function(t){e.makeDraggable(t)}));var t=this.toolbarTargetId?document.getElementById(this.toolbarTargetId):null;var n=document.getElementById("verdocs-template-fields-toolbar");if(t&&n){n.remove();t.append(n)}};e.prototype.componentWillUpdate=function(){var e=this;var t,n;var r=__spreadArray([],((t=this.template)===null||t===void 0?void 0:t.roles)||[],true).sort((function(e,t){var n,r;return((n=e.sequence)!==null&&n!==void 0?n:0)-((r=t.sequence)!==null&&r!==void 0?r:0)}));if(!this.selectedRoleName||!r.find((function(t){return t&&t.name===e.selectedRoleName}))){this.selectedRoleName=((n=r[0])===null||n===void 0?void 0:n.name)||"";console.log("[FIELDS] Selected new role",this.selectedRoleName)}};e.prototype.disconnectedCallback=function(){this.unlistenToTemplate()};e.prototype.listenToTemplate=function(){return __awaiter(this,void 0,void 0,(function(){var e=this;return __generator(this,(function(t){this.unlistenToTemplate();Store.subscribe("templates",this.templateId,(function(){return getTemplate(e.endpoint,e.templateId)}),false,(function(t){var n;console.log("Template updated");e.template=t;e.loading=false;if(!e.selectedRoleName){var r=__spreadArray([],t.roles||[],true).sort((function(e,t){var n,r;return((n=e.sequence)!==null&&n!==void 0?n:0)-((r=t.sequence)!==null&&r!==void 0?r:0)}));e.selectedRoleName=((n=r[0])===null||n===void 0?void 0:n.name)||""}}));return[2]}))}))};e.prototype.unlistenToTemplate=function(){if(this.templateListenerId){Store.store.delListener(this.templateListenerId);this.templateListenerId=null}};e.prototype.handlePageRendered=function(e){var t=this;var n,r;var o,i;var s=e.detail;console.log("[FIELDS] Page rendered",s.documentId,s.pageNumber,s.xScale,s.yScale);(n=(o=this.cachedPageInfo)[i=s.documentId])!==null&&n!==void 0?n:o[i]={};this.cachedPageInfo[s.documentId][s.pageNumber]=s;this.pageHeights[s.pageNumber]=s.naturalHeight;(((r=this.template)===null||r===void 0?void 0:r.fields)||[]).filter((function(e){return e&&e.page===s.pageNumber})).forEach((function(e){var n=getFieldId(e);var r=document.getElementById(n);if(r){r.setAttribute("templateid",t.templateId);r.setAttribute("fieldname",e.name);r.setAttribute("documentid",String(e.document_id));r.setAttribute("pagenumber",String(e.page));r.setAttribute("xScale",String(s.xScale));r.setAttribute("yScale",String(s.yScale));t.makeDraggable(r)}}))};e.prototype.makeDraggable=function(e){interact(e).draggable({listeners:{move:this.handleMoveField.bind(this),end:this.handleMoveEnd.bind(this)}})};e.prototype.handleMoveField=function(e){return __awaiter(this,void 0,void 0,(function(){var t,n,r,o,i,s;return __generator(this,(function(a){t=+(e.target.getAttribute("posX")||0);n=+(e.target.getAttribute("posY")||0);r=+(e.target.getAttribute("xScale")||1);o=+(e.target.getAttribute("yScale")||1);i=e.dx/r+t;s=e.dy/o+n;e.target.setAttribute("posX",i);e.target.setAttribute("posy",s);updateCssTransform(e.target,"translate","".concat(i,"px, ").concat(s,"px"));return[2]}))}))};e.prototype.handleMoveEnd=function(e){return __awaiter(this,void 0,void 0,(function(){var t,n,r,o,i,s,a,l,c,d,u,f,h,v,p,g,m,x,b,E,w,S,_,y,I,C,T,k,D,q,M,R,A,O,P,H,L,V,z,Z;return __generator(this,(function(j){switch(j.label){case 0:c=e.target.getAttribute("fieldname");d=(((t=this.template)===null||t===void 0?void 0:t.fields)||[]).find((function(e){return e.name===c}));if(!d){console.log("[FIELDS] Unable to find field",c,e.target);return[2]}u=e.target.getAttribute("pagenumber");f=e.target.getAttribute("documentid");h=this.cachedPageInfo[f][u],v=h.naturalWidth,p=v===void 0?612:v,g=h.naturalHeight,m=g===void 0?792:g,x=h.renderedHeight,b=x===void 0?792:x;E=e.target.getBoundingClientRect();w=e.target.parentElement;S=w.getBoundingClientRect();_=d.width||defaultWidth(d.type);y=d.height||defaultHeight(d.type);I=Math.max(E.left-S.left,0);C=Math.max(b-(S.bottom-E.bottom),0);T=parseInt(u);if(C>b){T=Math.min(T+1,((o=(r=((n=this.template)===null||n===void 0?void 0:n.documents)||[])===null||r===void 0?void 0:r[0])===null||o===void 0?void 0:o.pages)||1);C-=b;b=this.cachedPageInfo[f][T].renderedHeight;console.log("Next page",{newPageNumber:T,newY:C,renderedHeight:b})}else if(C<0){T=Math.max(T-1,1);b=this.cachedPageInfo[f][T].renderedHeight;C+=b;console.log("[FIELDS] Next page",{newPageNumber:T,newY:C,renderedHeight:b})}k=this.viewCoordinatesToPageCoordinates(I,C,f,u,p-_,m-y),D=k.x,q=k.y;j.label=1;case 1:j.trys.push([1,3,,4]);M={x:D,y:q,page:T};return[4,updateField(this.endpoint,this.templateId,c,M)];case 2:R=j.sent();console.log("[FIELDS] Updated",R);A=JSON.parse(JSON.stringify(this.template));O=A.fields.findIndex((function(e){return e.name===c}));if(O>-1){A.fields[O]=R}Store.updateTemplate(this.templateId,A);e.target.removeAttribute("posX");e.target.removeAttribute("posY");removeCssTransform(e.target);P=this.cachedPageInfo[f][u],H=P.xScale,L=H===void 0?1:H,V=P.yScale,z=V===void 0?1:V;setControlStyles(e.target,R,L,z);(i=this.templateUpdated)===null||i===void 0?void 0:i.emit({endpoint:this.endpoint,template:A,event:"updated-field"});return[3,4];case 3:Z=j.sent();VerdocsToast("Error updating field, please try again later",{style:"error"});console.log("[FIELDS] Error updating field",Z);(s=this.sdkError)===null||s===void 0?void 0:s.emit(new SDKError(Z.message,(a=Z.response)===null||a===void 0?void 0:a.status,(l=Z.response)===null||l===void 0?void 0:l.data));e.target.removeAttribute("posX");e.target.removeAttribute("posY");removeCssTransform(e.target);return[3,4];case 4:return[2]}}))}))};e.prototype.generateFieldName=function(e,t){var n;var r=1;var o;do{o="".concat(e,"P").concat(t,"-").concat(r);r++}while((((n=this.template)===null||n===void 0?void 0:n.fields)||[]).some((function(e){return e&&e.name===o})));return o};e.prototype.viewCoordinatesToPageCoordinates=function(e,t,n,r,o,i){var s=this.cachedPageInfo[n][r],a=s.xScale,l=a===void 0?1:a,c=s.yScale,d=c===void 0?1:c,u=s.renderedHeight,f=u===void 0?792:u;var h=Math.floor(Math.min(e/l,o));var v=Math.floor(Math.min(Math.max(f-t,0)/d,i));return{x:h,y:v}};e.prototype.handleClickPage=function(e,t,n){return __awaiter(this,void 0,void 0,(function(){var r,o,i,s,a,l,c,d,u,f,h,v,p,g,m,x;return __generator(this,(function(b){switch(b.label){case 0:if(!this.placing)return[3,2];o=e.offsetX;i=e.offsetY;s=defaultWidth(this.placing);a=defaultHeight(this.placing);l=this.cachedPageInfo[t][n];c=l.naturalWidth,d=c===void 0?612:c,u=l.naturalHeight,f=u===void 0?792:u;h=this.viewCoordinatesToPageCoordinates(o,i,t,n,d-s,f-a);v=Math.floor(h.x);p=Math.floor(h.y);g={name:this.generateFieldName(this.placing,n),role_name:this.selectedRoleName,template_id:this.templateId,document_id:l.documentId,type:this.placing,required:this.placing!=="radio"&&this.placing!=="attachment"&&this.placing!=="checkbox",page:n,validator:null,label:null,default:null,placeholder:null,group:null,settings:{},x:v,y:p,width:s,height:a,multiline:false,readonly:false,options:this.placing==="radio"?[{id:"option-1",label:"Option 1"}]:[]};return[4,createField(this.endpoint,this.templateId,g)];case 1:m=b.sent();console.log("[FIELDS] Created field",m);x=JSON.parse(JSON.stringify(this.template));x.fields.push(m);Store.updateTemplate(this.templateId,x);(r=this.templateUpdated)===null||r===void 0?void 0:r.emit({endpoint:this.endpoint,template:x,event:"added-field"});this.placing=null;b.label=2;case 2:return[2]}}))}))};e.prototype.render=function(){var e;var t=this;var n,r,o;console.log("Rendering");if(this.loading){return h(Host,null,h("verdocs-loader",null))}if(!this.endpoint.session){return h(Host,null,h("verdocs-component-error",{message:"You must be authenticated to use this module."}))}var i=__spreadArray([],((n=this.template)===null||n===void 0?void 0:n.roles)||[],true).sort((function(e,t){var n,r;return((n=e.sequence)!==null&&n!==void 0?n:0)-((r=t.sequence)!==null&&r!==void 0?r:0)}));var s=i.map((function(e){return{value:e.name,label:e.full_name?"".concat(e.name,": ").concat(e.full_name):e.name}}));return h(Host,{class:this.placing?(e={},e["placing-".concat(this.placing)]=true,e):{},onSubmit:function(){}},h("div",{id:"verdocs-template-fields-toolbar"},h("div",{class:"add-for"},"Add field:"),h("verdocs-select-input",{value:this.selectedRoleName,options:s,onInput:function(e){return t.selectedRoleName=e.target.value}}),menuOptions.map((function(e){return h("verdocs-toolbar-icon",{text:e.tooltip,icon:e.icon,class:e.class,onClick:function(){if(e.tooltip){if(t.selectedRoleName){t.placing=e.id}else{t.showMustSelectRole=true}}}})}))),h("div",{class:"pages"},(((r=this.template)===null||r===void 0?void 0:r.documents)||[]).map((function(e){var n=integerSequence(1,e.pages);return n.map((function(n){var r;var o=e.page_sizes[n];return h(Fragment,null,((r=t.template)===null||r===void 0?void 0:r.documents.length)>1&&h("div",{class:"document-separator"},h("div",{innerHTML:DocumentPageIcon}),h("span",null,e.name)),h("verdocs-template-document-page",{templateId:t.templateId,documentId:e.id,pageNumber:n,virtualWidth:(o===null||o===void 0?void 0:o.width)||612,virtualHeight:(o===null||o===void 0?void 0:o.height)||792,disabled:true,editable:true,done:false,onClick:function(r){return t.handleClickPage(r,e.id,n)},onPageRendered:function(e){return t.handlePageRendered(e)},layers:[{name:"page",type:"canvas"},{name:"controls",type:"div"}]}))}))}))),this.showMustSelectRole&&h("verdocs-ok-dialog",{heading:"Unable to add field",message:(((o=this.template)===null||o===void 0?void 0:o.roles)||[]).length>0?"Please select a role before adding fields.":"Please add at least one role before adding fields.",onNext:function(){return t.showMustSelectRole=false}}))};Object.defineProperty(e,"watchers",{get:function(){return{templateId:["onTemplateIdChanged"]}},enumerable:false,configurable:true});return e}();VerdocsTemplateFields.style=verdocsTemplateFieldsCss;
2
2
  /**!
3
3
  * Sortable 1.15.7
4
4
  * @author RubaXa <trash@rubaxa.org>