@verdocs/web-sdk 5.0.31 → 5.0.33

Sign up to get free protection for your applications and to get access to all the features.
Files changed (107) hide show
  1. package/dist/cjs/index-ccac8641.js +8 -4
  2. package/dist/cjs/loader.cjs.js +1 -1
  3. package/dist/cjs/verdocs-build.cjs.entry.js +1 -1
  4. package/dist/cjs/verdocs-build.cjs.entry.js.map +1 -1
  5. package/dist/cjs/{verdocs-envelope-recipient-link_2.cjs.entry.js → verdocs-envelope-recipient-link.cjs.entry.js} +1 -25
  6. package/dist/cjs/verdocs-envelope-recipient-link.cjs.entry.js.map +1 -0
  7. package/dist/cjs/{verdocs-preview_6.cjs.entry.js → verdocs-preview_7.cjs.entry.js} +147 -15
  8. package/dist/cjs/verdocs-preview_7.cjs.entry.js.map +1 -0
  9. package/dist/cjs/verdocs-switch.cjs.entry.js +32 -0
  10. package/dist/cjs/verdocs-switch.cjs.entry.js.map +1 -0
  11. package/dist/cjs/verdocs-web-sdk.cjs.js +1 -1
  12. package/dist/collection/collection-manifest.json +1 -0
  13. package/dist/collection/components/controls/verdocs-switch/verdocs-switch.css +2 -2
  14. package/dist/collection/components/controls/verdocs-switch/verdocs-switch.js +3 -3
  15. package/dist/collection/components/controls/verdocs-switch/verdocs-switch.js.map +1 -1
  16. package/dist/collection/components/embeds/verdocs-build/verdocs-build.js +1 -1
  17. package/dist/collection/components/embeds/verdocs-build/verdocs-build.js.map +1 -1
  18. package/dist/collection/components/embeds/verdocs-send/verdocs-send.js +10 -14
  19. package/dist/collection/components/embeds/verdocs-send/verdocs-send.js.map +1 -1
  20. package/dist/collection/components/templates/verdocs-template-settings/verdocs-template-settings.css +57 -0
  21. package/dist/collection/components/templates/verdocs-template-settings/verdocs-template-settings.js +282 -0
  22. package/dist/collection/components/templates/verdocs-template-settings/verdocs-template-settings.js.map +1 -0
  23. package/dist/components/index.js +2 -0
  24. package/dist/components/index.js.map +1 -1
  25. package/dist/components/{p-f4e068a9.js → p-38e1fed8.js} +4 -4
  26. package/dist/components/{p-f4e068a9.js.map → p-38e1fed8.js.map} +1 -1
  27. package/dist/components/{p-87d3651e.js → p-4c5164d0.js} +11 -15
  28. package/dist/components/p-4c5164d0.js.map +1 -0
  29. package/dist/components/p-7ad22da6.js +212 -0
  30. package/dist/components/p-7ad22da6.js.map +1 -0
  31. package/dist/components/verdocs-build.js +85 -73
  32. package/dist/components/verdocs-build.js.map +1 -1
  33. package/dist/components/verdocs-envelope-sidebar.js +1 -1
  34. package/dist/components/verdocs-send.js +1 -1
  35. package/dist/components/verdocs-switch.js +1 -1
  36. package/dist/components/verdocs-template-settings.d.ts +11 -0
  37. package/dist/components/verdocs-template-settings.js +8 -0
  38. package/dist/components/verdocs-template-settings.js.map +1 -0
  39. package/dist/custom-elements.json +14 -1
  40. package/dist/esm/index-272d51a4.js +8 -4
  41. package/dist/esm/loader.js +1 -1
  42. package/dist/esm/verdocs-build.entry.js +1 -1
  43. package/dist/esm/verdocs-build.entry.js.map +1 -1
  44. package/dist/esm/{verdocs-envelope-recipient-link_2.entry.js → verdocs-envelope-recipient-link.entry.js} +2 -25
  45. package/dist/esm/verdocs-envelope-recipient-link.entry.js.map +1 -0
  46. package/dist/esm/{verdocs-preview_6.entry.js → verdocs-preview_7.entry.js} +148 -17
  47. package/dist/esm/verdocs-preview_7.entry.js.map +1 -0
  48. package/dist/esm/verdocs-switch.entry.js +28 -0
  49. package/dist/esm/verdocs-switch.entry.js.map +1 -0
  50. package/dist/esm/verdocs-web-sdk.js +1 -1
  51. package/dist/esm-es5/index-272d51a4.js +1 -1
  52. package/dist/esm-es5/index-272d51a4.js.map +1 -1
  53. package/dist/esm-es5/loader.js +1 -1
  54. package/dist/esm-es5/loader.js.map +1 -1
  55. package/dist/esm-es5/verdocs-build.entry.js +1 -1
  56. package/dist/esm-es5/verdocs-build.entry.js.map +1 -1
  57. package/dist/esm-es5/{verdocs-envelope-recipient-link_2.entry.js → verdocs-envelope-recipient-link.entry.js} +2 -2
  58. package/dist/esm-es5/verdocs-envelope-recipient-link.entry.js.map +1 -0
  59. package/dist/esm-es5/verdocs-preview_7.entry.js +8 -0
  60. package/dist/esm-es5/verdocs-preview_7.entry.js.map +1 -0
  61. package/dist/esm-es5/verdocs-switch.entry.js +2 -0
  62. package/dist/esm-es5/verdocs-switch.entry.js.map +1 -0
  63. package/dist/esm-es5/verdocs-web-sdk.js +1 -1
  64. package/dist/esm-es5/verdocs-web-sdk.js.map +1 -1
  65. package/dist/types/components/controls/verdocs-switch/verdocs-switch.d.ts +1 -1
  66. package/dist/types/components/embeds/verdocs-send/verdocs-send.d.ts +2 -2
  67. package/dist/types/components/templates/verdocs-template-settings/verdocs-template-settings.d.ts +55 -0
  68. package/dist/types/components.d.ts +79 -4
  69. package/dist/verdocs-web-sdk/p-060dbde7.entry.js +8 -0
  70. package/dist/verdocs-web-sdk/p-060dbde7.entry.js.map +1 -0
  71. package/dist/verdocs-web-sdk/p-17457a7a.entry.js +2 -0
  72. package/dist/verdocs-web-sdk/p-17457a7a.entry.js.map +1 -0
  73. package/dist/verdocs-web-sdk/p-21e9abff.system.entry.js +2 -0
  74. package/dist/verdocs-web-sdk/p-21e9abff.system.entry.js.map +1 -0
  75. package/dist/verdocs-web-sdk/p-27ddc017.system.entry.js +2 -0
  76. package/dist/verdocs-web-sdk/p-27ddc017.system.entry.js.map +1 -0
  77. package/dist/verdocs-web-sdk/{p-6f1e2f2f.entry.js → p-8e699235.entry.js} +2 -2
  78. package/dist/verdocs-web-sdk/p-8e699235.entry.js.map +1 -0
  79. package/dist/verdocs-web-sdk/{p-cabfdb9d.system.entry.js → p-a63b359e.system.entry.js} +2 -2
  80. package/dist/verdocs-web-sdk/p-a63b359e.system.entry.js.map +1 -0
  81. package/dist/verdocs-web-sdk/p-aca6553d.system.entry.js +8 -0
  82. package/dist/verdocs-web-sdk/p-aca6553d.system.entry.js.map +1 -0
  83. package/dist/verdocs-web-sdk/p-dddd328d.entry.js +2 -0
  84. package/dist/verdocs-web-sdk/p-dddd328d.entry.js.map +1 -0
  85. package/dist/verdocs-web-sdk/p-e2b70dfb.system.js +1 -1
  86. package/dist/verdocs-web-sdk/p-e2b70dfb.system.js.map +1 -1
  87. package/dist/verdocs-web-sdk/verdocs-web-sdk.esm.js +1 -1
  88. package/dist/verdocs-web-sdk/verdocs-web-sdk.esm.js.map +1 -1
  89. package/package.json +1 -1
  90. package/dist/cjs/verdocs-envelope-recipient-link_2.cjs.entry.js.map +0 -1
  91. package/dist/cjs/verdocs-preview_6.cjs.entry.js.map +0 -1
  92. package/dist/components/p-87d3651e.js.map +0 -1
  93. package/dist/esm/verdocs-envelope-recipient-link_2.entry.js.map +0 -1
  94. package/dist/esm/verdocs-preview_6.entry.js.map +0 -1
  95. package/dist/esm-es5/verdocs-envelope-recipient-link_2.entry.js.map +0 -1
  96. package/dist/esm-es5/verdocs-preview_6.entry.js +0 -8
  97. package/dist/esm-es5/verdocs-preview_6.entry.js.map +0 -1
  98. package/dist/verdocs-web-sdk/p-33064db4.system.entry.js +0 -8
  99. package/dist/verdocs-web-sdk/p-33064db4.system.entry.js.map +0 -1
  100. package/dist/verdocs-web-sdk/p-6f1e2f2f.entry.js.map +0 -1
  101. package/dist/verdocs-web-sdk/p-9e04b9f0.entry.js +0 -8
  102. package/dist/verdocs-web-sdk/p-9e04b9f0.entry.js.map +0 -1
  103. package/dist/verdocs-web-sdk/p-b9fee1a7.entry.js +0 -2
  104. package/dist/verdocs-web-sdk/p-b9fee1a7.entry.js.map +0 -1
  105. package/dist/verdocs-web-sdk/p-cabfdb9d.system.entry.js.map +0 -1
  106. package/dist/verdocs-web-sdk/p-e3efeb57.system.entry.js +0 -2
  107. package/dist/verdocs-web-sdk/p-e3efeb57.system.entry.js.map +0 -1
@@ -0,0 +1,8 @@
1
+ import{r as e,c as t,h as i,H as s,F as o,g as n}from"./p-b9654a5e.js";import{VerdocsEndpoint as l,getTemplate as r,integerSequence as a,getOrganizationContacts as d,isValidEmail as c,createEnvelope as h,formatFullName as u,getRGBA as f,createTemplateDocument as p,deleteTemplateDocument as v,updateField as m,createField as g,updateTemplateRole as b,createTemplateRole as x,updateTemplate as w}from"@verdocs/js-sdk";import{S as y}from"./p-fd97809c.js";import{S as k}from"./p-d4be87ef.js";import{V as E}from"./p-04c07b7b.js";import{D as S,P as q,J as C,a as T,F as M,b as I,T as L}from"./p-b0766439.js";import{f as D}from"./p-12bab948.js";import{i as H}from"./p-a901dff2.js";import{b as z,c as Z,d as N,g as O,e as _,f as V}from"./p-0c45b79c.js";import"./p-85aa8e05.js";import"./p-c7ee88c7.js";const R='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-preview{font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif;display:-ms-flexbox;display:flex;padding:15px;row-gap:15px;min-height:200px;position:relative;-ms-flex-align:center;align-items:center;-webkit-box-sizing:border-box;box-sizing:border-box;-ms-flex-direction:column;flex-direction:column}verdocs-preview div,verdocs-preview canvas{-webkit-box-sizing:border-box;box-sizing:border-box}';const A=R;const U=class{constructor(i){e(this,i);this.sdkError=t(this,"sdkError",7);this.templateListenerId=null;this.endpoint=l.getDefault();this.templateId=null;this.loading=true;this.template=null}disconnectedCallback(){this.unlistenToTemplate()}async listenToTemplate(){this.unlistenToTemplate();k.subscribe("templates",this.templateId,(()=>r(this.endpoint,this.templateId)),false,(e=>{this.template=e;this.loading=false}))}unlistenToTemplate(){if(this.templateListenerId){k.store.delListener(this.templateListenerId);this.templateListenerId=null}}onTemplateIdChanged(e){console.log("[PREVIEW] Template ID changed",e);this.listenToTemplate()}async componentWillLoad(){var e,t,i;try{this.endpoint.loadSession();if(!this.endpoint.session){console.log("[PREVIEW] Unable to start builder session, must be authenticated");return}if(!this.templateId){console.log(`[PREVIEW] Missing required template ID ${this.templateId}`);return}this.listenToTemplate()}catch(s){console.log("[PREVIEW] Error with preview session",s);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new y(s.message,(t=s.response)===null||t===void 0?void 0:t.status,(i=s.response)===null||i===void 0?void 0:i.data))}}handlePageRendered(e){}render(){var e;if(this.loading){return i(s,null,i("verdocs-loader",null))}return i(s,null,(((e=this.template)===null||e===void 0?void 0:e.documents)||[]).map((e=>{const t=a(1,e.pages);return i(o,null,t.map((t=>{var s;const o=((s=e.page_sizes)===null||s===void 0?void 0:s[t])||{width:612,height:792};return i("verdocs-template-document-page",{templateId:e.template_id,documentId:e.id,pageNumber:t,disabled:true,editable:false,done:false,virtualWidth:o.width,virtualHeight:o.height,onPageRendered:e=>this.handlePageRendered(e),layers:[{name:"page",type:"canvas"},{name:"controls",type:"div"}]})})))})))}static get watchers(){return{templateId:["onTemplateIdChanged"]}}};U.style=A;const j=e=>((e===null||e===void 0?void 0:e.roles)||[]).map((e=>e.name));const B=(e,t)=>Math.max(j(e).findIndex((e=>e===t)),0);const P='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-send{padding:10px;position:relative;background:#ffffff;-ms-flex-direction:column;flex-direction:column;font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-send.sendable{display:-ms-flexbox;display:flex}verdocs-send .recipients{position:relative}verdocs-send .left-line{top:32px;left:20px;z-index:1;width:12px;bottom:30px;position:absolute;background:#ffffff;border-left:3px dotted #9b9b9b}verdocs-send .level{display:-ms-flexbox;display:flex;-webkit-column-gap:10px;-moz-column-gap:10px;column-gap:10px;margin-left:50px;position:relative;-ms-flex-direction:row;flex-direction:row;padding:8px 0 4px 0;border-bottom:1px solid rgba(151, 151, 151, 0.2666666667)}verdocs-send .level .level-icon{top:14px;z-index:2;left:-40px;width:24px;height:24px;position:absolute;background:#ffffff}verdocs-send .level .level-icon svg{fill:rgba(0, 0, 0, 0.537254902)}verdocs-send .level .recipient{height:30px;display:-ms-flexbox;display:flex;-ms-flex:0 0 30px;flex:0 0 30px;color:#000000;cursor:pointer;font-size:14px;-ms-flex-align:center;align-items:center;border-radius:30px;-ms-flex-direction:row;flex-direction:row;background:#dddddd;white-space:nowrap;border:2px solid #dddddd;padding:2px 10px 2px 14px}verdocs-send .level .recipient .icon{width:22px;height:22px;-ms-flex:0 0 22px;flex:0 0 22px;margin:0 0 0 10px}verdocs-send .level .recipient .icon svg{width:22px;height:22px;fill:#333333;outline:none}verdocs-send .level .complete{-ms-flex:1;flex:1;height:30px;display:-ms-flexbox;display:flex;color:#000000;font-size:14px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;padding:3px 10px 3px 2px}verdocs-send .buttons{display:-ms-flexbox;display:flex;margin-top:10px;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;-ms-flex-direction:row;flex-direction:row}verdocs-send verdocs-contact-picker{left:0;top:41px;z-index:10;position:absolute;border:1px solid #dddddd;-webkit-box-shadow:0 0 6px 3px rgba(0, 0, 0, 0.1);box-shadow:0 0 6px 3px rgba(0, 0, 0, 0.1)}';const $=P;const F='<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" tabindex="-1"><path d="M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34a.9959.9959 0 0 0-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z"></path></svg>';const Q='<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>';const W='<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" tabindex="-1"><path d="M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z"></path></svg>';const Y='<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>';const G=class{constructor(i){e(this,i);this.beforeSend=t(this,"beforeSend",7);this.send=t(this,"send",7);this.exit=t(this,"exit",7);this.sdkError=t(this,"sdkError",7);this.searchContacts=t(this,"searchContacts",7);this.templateListenerId=null;this.endpoint=l.getDefault();this.templateId=null;this.environment="";this.containerId=`verdocs-send-${Math.random().toString(36).substring(2,11)}`;this.showPickerForId="";this.sessionContacts=[];this.sending=false;this.rolesCompleted={};this.loading=true;this.template=null}disconnectedCallback(){this.unlistenToTemplate()}async listenToTemplate(){console.log("[SEND] Loading template",this.templateId);this.unlistenToTemplate();k.subscribe("templates",this.templateId,(()=>r(this.endpoint,this.templateId)),true,(e=>{console.log("[SEND] Got new template",e);this.template=e;this.loading=false;this.rolesCompleted={};this.recomputeRolesCompleted()}))}unlistenToTemplate(){if(this.templateListenerId){k.store.delListener(this.templateListenerId);this.templateListenerId=null}}async reset(){this.rolesCompleted={}}onTemplateIdChanged(e){console.log("[SEND] Template ID changed",e);this.listenToTemplate()}async componentWillLoad(){var e,t,i;try{this.endpoint.onSessionChanged(((e,t,i)=>{if(!i){return}const s={id:i.id,first_name:i.first_name,last_name:i.last_name,email:i.email,phone:i.phone};if(i){this.sessionContacts=[s];d(this.endpoint).then((e=>{console.log("[SEND] Got contacts",e);this.sessionContacts=[...e,s]})).catch((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}if(!this.templateId){console.log(`[SEND] Missing required template ID ${this.templateId}`);return}this.listenToTemplate()}catch(s){console.log("[SEND] Error with send session",s);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new y(s.message,(t=s.response)===null||t===void 0?void 0:t.status,(i=s.response)===null||i===void 0?void 0:i.data))}}recomputeRolesCompleted(){var e;this.rolesCompleted={};const t={};(((e=this.template)===null||e===void 0?void 0:e.roles)||[]).forEach((e=>{const i=e.sequence-1;t[i]||(t[i]=[]);const s=`r-${i}-${t[i].length}`;t[i].push({...e,id:s,role_name:e.name,first_name:e.first_name,last_name:e.last_name});if(e.first_name&&c(e.email)){this.rolesCompleted[s]={...e,id:s,role_name:e.name,first_name:e.first_name,last_name:e.last_name}}}))}getSequenceNumbers(){var e;const t={};(((e=this.template)===null||e===void 0?void 0:e.roles)||[]).forEach((e=>{t[e.sequence]=true}));return Object.keys(t).map((e=>+e)).sort(((e,t)=>e-t))}getRolesAtLevel(e){var t;const i=(((t=this.template)===null||t===void 0?void 0:t.roles)||[]).filter((t=>t.sequence===e)).map(((t,i)=>({...t,id:`r-${e}-${i}`,role_name:t.name,first_name:t.first_name,last_name:t.last_name})));return i}getLevelIcon(e){if(e==="start"){return i("div",{class:"level-icon",innerHTML:Q})}else if(e==="end"){return i("div",{class:"level-icon",innerHTML:Y})}else{return i("div",{class:"level-icon",innerHTML:W})}}handleSelectContact(e,t){e.preventDefault();this.rolesCompleted[t.id]={...t,...e.detail};this.showPickerForId=""}handleClickRole(e,t){e.stopPropagation();this.showPickerForId=t.id}handleSend(e){var t;if(this.sending){console.log("[SEND] Skipping duplicate send",e);return}console.log("[SEND] Sending",e);e.preventDefault();e.stopPropagation();this.sending=true;const i={template_id:this.templateId,name:((t=this.template)===null||t===void 0?void 0:t.name)||"New Envelope",environment:this.environment,initial_reminder:0,followup_reminders:0,recipients:Object.values(this.rolesCompleted),fields:[]};const s=this.beforeSend.emit({...i,name:i.name});if(s.defaultPrevented){console.log("[SEND] Send cancelled by parent",i);this.sending=false;return}console.log("[SEND] Creating envelope",i);h(this.endpoint,i).then((e=>{var t;console.log("[SEND] Send envelope",e);this.reset().catch((e=>console.log("Unknown Error",e)));this.sending=false;(t=this.send)===null||t===void 0?void 0:t.emit({...i,name:i.name,envelope_id:e.id,envelope:e})})).catch((e=>{var t,i,s;console.log("[SEND] Send error",e);E(((i=(t=e.response)===null||t===void 0?void 0:t.data)===null||i===void 0?void 0:i.error)||"Error creating envelope, please try again later.");this.sending=false;(s=this.sdkError)===null||s===void 0?void 0:s.emit(e)}))}handleCancel(e){var t;e.stopPropagation();(t=this.exit)===null||t===void 0?void 0:t.emit()}render(){var e;if(this.loading){return i(s,null,i("verdocs-loader",null))}if(!this.endpoint.session){return i(s,{style:{display:"flex"}},i("verdocs-component-error",{message:"You must be authenticated to use this module."}))}const t=this.getSequenceNumbers();console.log("[SEND] Rendering levels",t);const o=Object.values(this.rolesCompleted).filter((e=>c(e.email)&&e.first_name&&e.last_name));const n=o.length>=j(this.template).length;return i(s,{class:{sendable:(e=this.template)===null||e===void 0?void 0:e.is_sendable}},i("div",{class:"recipients"},i("div",{class:"left-line"}),i("div",{class:`level level-start`},this.getLevelIcon("start"),i("div",{class:"complete"},"Send Envelope")),t.map((e=>i("div",{class:`level level-${e}`},this.getLevelIcon("sequence"),this.getRolesAtLevel(e).map((e=>{var t,s,n;const l=!e.email||!e.first_name||!e.last_name;const r=((t=this.rolesCompleted[e.id])===null||t===void 0?void 0:t.first_name)?u(this.rolesCompleted[e.id]):l?e.role_name:u(e);const a=`verdocs-send-recipient-${e.role_name}`;const d=B(this.template,e.role_name);const c=f(d);const h=o.findIndex((t=>t.role_name===e.role_name))>-1;const p={backgroundColor:c,border:h?"2px solid #55bc81":"2px solid #dddddd"};return l?i("div",{class:"recipient","data-ri":d,"data-rn":e.role_name,style:p,onClick:t=>this.handleClickRole(t,e),id:a},r,i("div",{class:"icon",innerHTML:F}),this.showPickerForId===e.id&&i("verdocs-portal",{anchor:a,onClickAway:()=>this.showPickerForId=""},i("verdocs-contact-picker",{onExit:()=>this.showPickerForId="",onNext:t=>this.handleSelectContact(t,e),contactSuggestions:this.sessionContacts,templateRole:(s=this.rolesCompleted[e.id])!==null&&s!==void 0?s:e,onSearchContacts:e=>{var t;return(t=this.searchContacts)===null||t===void 0?void 0:t.emit(e.detail)}}))):i("div",{class:"recipient","data-ri":d,"data-rn":e.role_name,style:p,onClick:t=>this.handleClickRole(t,e),id:a},r,i("div",{class:"icon",innerHTML:F}),this.showPickerForId===e.id&&i("verdocs-portal",{anchor:a,onClickAway:()=>this.showPickerForId=""},i("verdocs-contact-picker",{onExit:()=>this.showPickerForId="",onNext:t=>this.handleSelectContact(t,e),contactSuggestions:this.sessionContacts,templateRole:(n=this.rolesCompleted[e.id])!==null&&n!==void 0?n:e,onSearchContacts:e=>{var t;return(t=this.searchContacts)===null||t===void 0?void 0:t.emit(e.detail)}})))}))))),i("div",{class:`level level-done`},this.getLevelIcon("end"),i("div",{class:"complete"},"Signing Complete"))),i("div",{class:"buttons"},i("verdocs-button",{label:"Cancel",size:"small",variant:"outline",onClick:e=>this.handleCancel(e),disabled:this.sending}),i("verdocs-button",{label:"Send",size:"small",disabled:!n||this.sending,onClick:e=>this.handleSend(e)}),this.sending&&i("verdocs-spinner",null)))}static get watchers(){return{templateId:["onTemplateIdChanged"]}}};G.style=$;const J='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-template-attachments{font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-template-attachments h5{font-size:16px;font-weight:bold;margin:0 0 10px 0;color:#46497d}verdocs-template-attachments .attachments{margin:0 0 40px 0}verdocs-template-attachments .attachment{display:-ms-flexbox;display:flex;padding:5px 0;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;color:#33364b}verdocs-template-attachments .attachment:hover .trash-icon{display:-ms-flexbox;display:flex}verdocs-template-attachments .attachment:hover .pages{display:none}verdocs-template-attachments svg{width:28px;height:28px;fill:#5c6575;margin:2px 0 0 0}verdocs-template-attachments .file-icon{-ms-flex:0;flex:0}verdocs-template-attachments .pages{width:24px;height:24px;-ms-flex:0 0 24px;flex:0 0 24px;padding-left:4px;position:relative;margin:-10px 0 0 0}verdocs-template-attachments .pages .pages-icon{top:0;left:0;width:24px;height:24px;position:absolute}verdocs-template-attachments .pages .count{top:11px;left:7px;z-index:1;width:18px;font-size:12px;font-weight:500;position:absolute;text-align:center;letter-spacing:-2px}verdocs-template-attachments .filename{-ms-flex:1;flex:1;display:block;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;border-bottom:1px dotted #cccccc}verdocs-template-attachments .trash-icon{-ms-flex:0;flex:0;display:none}verdocs-template-attachments .trash-icon:hover{cursor:pointer}verdocs-template-attachments verdocs-file-chooser{margin:10px 0;border:2px dashed #979797}verdocs-template-attachments .loader-wrapper{background-color:#ffffff;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-webkit-box-sizing:border-box;box-sizing:border-box;position:relative;width:320px;height:320px;text-align:center;border:2px dashed #979797;-ms-flex-pack:end;justify-content:flex-end}verdocs-template-attachments .progress-wrapper{padding:20px}verdocs-template-attachments .buttons{display:-ms-flexbox;display:flex;-webkit-column-gap:8px;-moz-column-gap:8px;column-gap:8px;margin-top:16px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:end;justify-content:flex-end}verdocs-template-attachments .buttons .flex-fill{-ms-flex:1;flex:1}verdocs-template-attachments ::-webkit-input-placeholder{color:#aaaaaa}verdocs-template-attachments ::-moz-placeholder{color:#aaaaaa}verdocs-template-attachments :-ms-input-placeholder{color:#aaaaaa}verdocs-template-attachments ::-ms-input-placeholder{color:#aaaaaa}verdocs-template-attachments ::placeholder{color:#aaaaaa}';const X=J;const K=class{constructor(i){e(this,i);this.exit=t(this,"exit",7);this.next=t(this,"next",7);this.templateUpdated=t(this,"templateUpdated",7);this.sdkError=t(this,"sdkError",7);this.templateListenerId=null;this.endpoint=l.getDefault();this.templateId="";this.uploading=false;this.progressLabel="Uploading...";this.progressPercent=0;this.showDeleteError=false;this.confirmDeleteDocument=null;this.loading=true;this.template=null}async componentWillLoad(){var e,t,i;try{this.endpoint.loadSession();if(!this.templateId){console.log(`[ROLES] Missing required template ID ${this.templateId}`);return}if(!this.endpoint.session){console.log("[ROLES] Unable to start builder session, must be authenticated");return}this.listenToTemplate()}catch(s){console.log("[TEMPLATE ATTACHMENTS] Error loading template",s);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new y(s.message,(t=s.response)===null||t===void 0?void 0:t.status,(i=s.response)===null||i===void 0?void 0:i.data))}}disconnectedCallback(){this.unlistenToTemplate()}async listenToTemplate(){this.unlistenToTemplate();k.subscribe("templates",this.templateId,(()=>r(this.endpoint,this.templateId)),false,(e=>{this.template=e;this.loading=false}))}unlistenToTemplate(){if(this.templateListenerId){k.store.delListener(this.templateListenerId);this.templateListenerId=null}}handleCancel(e){e.stopPropagation();this.exit.emit()}handleUploadProgress(e){if(e>=99){this.progressPercent=100;this.progressLabel="Processing..."}else{this.progressPercent=e}}async handleUpload(e){var t,i,s,o;e.stopPropagation();const n=e.detail.file;if(!n){return}console.log("[ATTACHMENTS] Uploading...",n);this.uploading=true;this.progressLabel="Uploading...";try{const e=await p(this.endpoint,this.templateId,n,this.handleUploadProgress.bind(this));console.log("[ATTACHMENTS] Created attachment",e);this.template=await k.getTemplate(this.endpoint,this.templateId,true);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}catch(e){console.log("[ATTACHMENTS] Error creating template",e);(i=this.sdkError)===null||i===void 0?void 0:i.emit(new y(e.message,(s=e.response)===null||s===void 0?void 0:s.status,(o=e.response)===null||o===void 0?void 0:o.data));this.uploading=false}}handleNext(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})}async confirmDelete(){await v(this.endpoint,this.templateId,this.confirmDeleteDocument.id);this.template=await k.getTemplate(this.endpoint,this.templateId,true);console.log("[ATTACHMENTS] New template",this.template);this.confirmDeleteDocument=null}async handleDelete(e){var t;if((((t=this.template)===null||t===void 0?void 0:t.documents)||[]).length>1){this.confirmDeleteDocument=e}else{this.showDeleteError=true}}getFileIcon(e){switch(e.mime){case"application/pdf":return T;case"image/jpeg":return C;case"image/png":return q;case"application/msword":case"application/vnd.openxmlformats-officedocument.wordprocessingml.document":return S}return M}render(){var e,t;if(!this.endpoint.session){return i(s,null,i("verdocs-component-error",{message:"You must be authenticated to use this module."}))}if(this.loading){return i(s,{class:"loading"},i("verdocs-loader",null))}if(!this.endpoint.session||!this.template){return i(s,{class:"empty"})}return i(s,null,i("h5",null,"Existing Attachments"),i("div",{class:"attachments"},(((e=this.template)===null||e===void 0?void 0:e.documents)||[]).map((e=>i("div",{class:"attachment"},i("div",{class:"file-icon",innerHTML:this.getFileIcon(e)}),i("div",{class:"filename",title:e.name},e.name),i("div",{class:"pages"},i("div",{class:"count"},e.pages),i("div",{class:"pages-icon",innerHTML:I})),i("div",{class:"trash-icon",innerHTML:L,onClick:()=>this.handleDelete(e)}))))),i("h5",null,"Attach a New Document"),this.uploading?i("div",{class:"loader-wrapper"},i("verdocs-loader",null),this.progressLabel&&i("div",{class:"progress-wrapper"},i("verdocs-progress-bar",{showPercent:true,percent:this.progressPercent,label:this.progressLabel}))):i("verdocs-file-chooser",{onFileSelected:e=>this.handleUpload(e)}),i("div",{class:"buttons"},i("verdocs-button",{variant:"outline",label:"Cancel",size:"small",onClick:e=>this.handleCancel(e),disabled:this.uploading}),i("verdocs-button",{label:"Next",size:"small",onClick:e=>this.handleNext(e),disabled:!(((t=this.template)===null||t===void 0?void 0:t.documents)||[]).length||this.uploading})),this.showDeleteError&&i("verdocs-ok-dialog",{heading:"Unable to Delete Attachment",message:"Templates must contain at least one attachment.",onNext:()=>this.showDeleteError=false}),this.confirmDeleteDocument&&i("verdocs-ok-dialog",{heading:"Delete this Attachment?",message:"This operation cannot be undone. All fields placed<br />on the deleted attachment will also be removed.",onNext:()=>this.confirmDelete(),showCancel:true,onExit:()=>{this.confirmDeleteDocument=null}}))}};K.style=X;const ee='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-template-build-tabs{-ms-flex:1;flex:1;gap:15px;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-template-build-tabs verdocs-button-panel svg{-webkit-transform:scale(0.8);transform:scale(0.8)}verdocs-template-build-tabs verdocs-template-attachments,verdocs-template-build-tabs verdocs-template-roles{margin:20px}verdocs-template-build-tabs verdocs-template-fields{border-top:1px solid #777777}verdocs-template-build-tabs verdocs-template-attachments{padding:20px;background:#ffffff}verdocs-template-build-tabs verdocs-template-fields{width:100%}verdocs-template-build-tabs verdocs-preview{-ms-flex:1;flex:1}.template-details-panel .row{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;gap:8px;margin:10px 0}.template-details-panel label{-ms-flex:0 0 70px;flex:0 0 70px}.template-details-panel .value{-ms-flex:1;flex:1;font-weight:300;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.template-details-panel .icon-button{cursor:pointer;opacity:0.8;-ms-flex:0;flex:0;width:18px;height:18px}.template-details-panel .icon-button svg{stroke:#000000;width:18px;height:18px}.template-details-panel .icon-button:hover{opacity:1}';const te=ee;const ie='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24" fill="#5c6575"><path d="M11.925 18q.55 0 .938-.387.387-.388.387-.938 0-.55-.387-.925-.388-.375-.938-.375-.55 0-.925.375t-.375.925q0 .55.375.938.375.387.925.387Zm-.95-3.85h1.95q0-.8.2-1.287.2-.488 1.025-1.288.65-.625 1.025-1.213.375-.587.375-1.437 0-1.425-1.025-2.175Q13.5 6 12.1 6q-1.425 0-2.35.775t-1.275 1.85l1.775.7q.125-.45.55-.975.425-.525 1.275-.525.725 0 1.1.412.375.413.375.888 0 .475-.287.9-.288.425-.713.775-1.075.95-1.325 1.475-.25.525-.25 1.875ZM12 22.2q-2.125 0-3.988-.8-1.862-.8-3.237-2.175Q3.4 17.85 2.6 15.988 1.8 14.125 1.8 12t.8-3.988q.8-1.862 2.175-3.237Q6.15 3.4 8.012 2.6 9.875 1.8 12 1.8t3.988.8q1.862.8 3.237 2.175Q20.6 6.15 21.4 8.012q.8 1.863.8 3.988t-.8 3.988q-.8 1.862-2.175 3.237Q17.85 20.6 15.988 21.4q-1.863.8-3.988.8Zm0-2.275q3.325 0 5.625-2.3t2.3-5.625q0-3.325-2.3-5.625T12 4.075q-3.325 0-5.625 2.3T4.075 12q0 3.325 2.3 5.625t5.625 2.3ZM12 12Z"/></svg>';const se=`<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5"><path stroke-linecap="round" stroke-linejoin="round" d="M15.75 17.25v3.375c0 .621-.504 1.125-1.125 1.125h-9.75a1.125 1.125 0 0 1-1.125-1.125V7.875c0-.621.504-1.125 1.125-1.125H6.75a9.06 9.06 0 0 1 1.5.124m7.5 10.376h3.375c.621 0 1.125-.504 1.125-1.125V11.25c0-4.46-3.243-8.161-7.5-8.876a9.06 9.06 0 0 0-1.5-.124H9.375c-.621 0-1.125.504-1.125 1.125v3.5m7.5 10.375H9.375a1.125 1.125 0 0 1-1.125-1.125v-9.25m12 6.625v-1.875a3.375 3.375 0 0 0-3.375-3.375h-1.5a1.125 1.125 0 0 1-1.125-1.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H9.75" /></svg>`;const oe=["attachments","roles","settings","fields","preview"];const ne=class{constructor(i){e(this,i);this.sdkError=t(this,"sdkError",7);this.stepChanged=t(this,"stepChanged",7);this.templateListenerId=null;this.endpoint=l.getDefault();this.templateId=null;this.step="preview";this.loading=true;this.template=null}disconnectedCallback(){this.unlistenToTemplate()}async listenToTemplate(){this.unlistenToTemplate();k.subscribe("templates",this.templateId,(()=>r(this.endpoint,this.templateId)),false,(e=>{this.template=e;this.loading=false}))}unlistenToTemplate(){if(this.templateListenerId){k.store.delListener(this.templateListenerId);this.templateListenerId=null}}onTemplateIdChanged(e){console.log("[BUILD_TABS] Template ID changed",e);this.listenToTemplate()}onStepChanged(e){console.log("[BUILD_TABS] Step changed",e)}async componentWillLoad(){var e,t,i;try{this.endpoint.loadSession();if(!this.endpoint.session){console.log("[BUILD_TABS] Unable to start builder session, must be authenticated");return}if(!this.templateId){this.step="attachments";console.log("[BUILD_TABS] Missing required template ID, forcing view to attachments");return}this.listenToTemplate()}catch(s){console.log("[BUILD_TABS] Error loading template",s);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new y(s.message,(t=s.response)===null||t===void 0?void 0:t.status,(i=s.response)===null||i===void 0?void 0:i.data))}}setStep(e){var t;console.log("[BUILD_TABS] Selected step",e.detail.tab.id);e.stopPropagation();e.preventDefault();this.step=e.detail.tab.id;(t=this.stepChanged)===null||t===void 0?void 0:t.emit(e.detail.tab.id)}copyTemplateId(){navigator.clipboard.writeText(this.templateId).then((()=>{E("Template ID copied",{style:"success",duration:3e3})})).catch((e=>{var t;console.warn("[BUILD_TABS] Error copying to clipboard",e);(t=this.sdkError)===null||t===void 0?void 0:t.emit(e)}))}render(){var e,t,o,n,l,r,a,d,c;if(this.loading){return i(s,null,i("verdocs-loader",null))}if(!this.endpoint.session){return i(s,null,i("verdocs-component-error",{message:"You must be authenticated to use this module."}))}const h=(((e=this.template)===null||e===void 0?void 0:e.documents)||[]).length>0;let u=h&&(((t=this.template)===null||t===void 0?void 0:t.roles)||[]).length>0;const f=u&&(((o=this.template)===null||o===void 0?void 0:o.fields)||[]).length>0;let p=Math.max(oe.indexOf(this.step),0);if(!f&&p>=4){p=3}if(!u&&p>=3){p=1}if(!h&&p>=1){p=0}return i(s,null,i("verdocs-tabs",{onSelectTab:e=>this.setStep(e),selectedTab:p,tabs:[{id:"attachments",disabled:false,label:"Attachment(s)"},{id:"roles",disabled:!h,label:"Roles"},{id:"settings",disabled:!u,label:"Settings"},{id:"fields",disabled:!u,label:"Fields"},{id:"preview",disabled:!f,label:"Preview/Send"}]}),this.templateId&&i("div",{class:"info"},i("verdocs-button-panel",{icon:ie},i("div",{class:"template-details-panel"},i("h6",null,"Template Details"),i("div",{class:"row"},i("label",null,"ID:"),i("div",{class:"value"},this.templateId),i("div",{class:"icon-button",innerHTML:se,onClick:()=>this.copyTemplateId()})),i("div",{class:"row"},i("label",null,"Name:"),i("div",{class:"value"},(n=this.template)===null||n===void 0?void 0:n.name)),i("div",{class:"row"},i("label",null,"Visibility:"),i("div",{class:"value"},((l=this.template)===null||l===void 0?void 0:l.is_public)?"Public":((r=this.template)===null||r===void 0?void 0:r.is_personal)?"Private":"Shared")),i("div",{class:"row"},i("label",null,"Created:"),i("div",{class:"value"},((a=this.template)===null||a===void 0?void 0:a.counter)?D(new Date((d=this.template)===null||d===void 0?void 0:d.created_at),"P p"):"")),i("div",{class:"row"},i("label",null,"Used:"),i("div",{class:"value"},(c=this.template)===null||c===void 0?void 0:c.counter," time(s)"))))))}static get watchers(){return{templateId:["onTemplateIdChanged"],step:["onStepChanged"]}}};ne.style=te;const le="@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-template-fields{font-family:\"Inter\", -apple-system, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", sans-serif;position:relative;display:block;min-height:600px}verdocs-template-fields .page-0{padding:65px 15px 0 15px;-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-template-fields .page-0 .user-placed-fields{height:100px;position:relative;background:#ffffff;-webkit-box-shadow:0 0 10px 5px rgba(0, 0, 0, 0.0588235294);box-shadow:0 0 10px 5px rgba(0, 0, 0, 0.0588235294)}verdocs-template-fields .page-0 .user-placed-fields .title{top:0;left:0;color:#ffffff;font-size:12px;padding:3px 6px;font-weight:bold;position:absolute;background:#46497d}verdocs-template-fields .pages{display:-ms-flexbox;display:flex;padding:15px;row-gap:15px;min-height:200px;position:relative;-ms-flex-align:center;align-items:center;-webkit-box-sizing:border-box;box-sizing:border-box;-ms-flex-direction:column;flex-direction:column}verdocs-template-fields .pages div,verdocs-template-fields .pages canvas{-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-template-fields #verdocs-template-fields-toolbar{width:100%;height:50px;display:-ms-flexbox;display:flex;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;font-weight:700;padding:0 20px 0 0;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;color:#f5f5fa;-ms-flex-pack:center;justify-content:center;background:#46497d}verdocs-template-fields #verdocs-template-fields-toolbar>verdocs-select-input{margin:0}verdocs-template-fields #verdocs-template-fields-toolbar svg{width:24px;height:24px}verdocs-template-fields #verdocs-template-fields-toolbar .add-for{margin:0;font-weight:500;color:#f5f5fa}verdocs-template-fields #verdocs-template-fields-toolbar verdocs-select-input{margin:0 20px 0 0}@media all and (max-width: 1000px){verdocs-template-fields #verdocs-template-fields-toolbar{-webkit-column-gap:8px;-moz-column-gap:8px;column-gap:8px;padding:0 10px 0 0}verdocs-template-fields #verdocs-template-fields-toolbar svg{-webkit-transform:scale(0.8);transform:scale(0.8)}verdocs-template-fields #verdocs-template-fields-toolbar .add-for,verdocs-template-fields #verdocs-template-fields-toolbar verdocs-select-input{display:none}}@media all and (max-width: 600px){verdocs-template-fields #verdocs-template-fields-toolbar{-webkit-column-gap:6px;-moz-column-gap:6px;column-gap:6px}verdocs-template-fields #verdocs-template-fields-toolbar svg{-webkit-transform:scale(0.6);transform:scale(0.6)}verdocs-template-fields #verdocs-template-fields-toolbar .separator,verdocs-template-fields #verdocs-template-fields-toolbar .add-for,verdocs-template-fields #verdocs-template-fields-toolbar verdocs-select-input{display:none}}verdocs-template-fields.placing-attachment{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='m10.55 16.55 7.275-7.275L16.05 7.5l-5.5 5.45-2.675-2.65L6.1 12.075Zm-5.375 4.925q-1.125 0-1.887-.763-.763-.762-.763-1.887V5.175q0-1.125.763-1.888.762-.762 1.887-.762h13.65q1.125 0 1.888.762.762.763.762 1.888v13.65q0 1.125-.762 1.887-.763.763-1.888.763Zm0-2.65h13.65V5.175H5.175v13.65Zm0-13.65v13.65-13.65Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-checkbox{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='m10.55 16.55 7.275-7.275L16.05 7.5l-5.5 5.45-2.675-2.65L6.1 12.075Zm-5.375 4.925q-1.125 0-1.887-.763-.763-.762-.763-1.887V5.175q0-1.125.763-1.888.762-.762 1.887-.762h13.65q1.125 0 1.888.762.762.763.762 1.888v13.65q0 1.125-.762 1.887-.763.763-1.888.763Zm0-2.65h13.65V5.175H5.175v13.65Zm0-13.65v13.65-13.65Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-date{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath fill='%23000000' d='M7.6 13.925q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375Zm4.4 0q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375Zm4.4 0q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375ZM5.3 22.85q-1.325 0-2.238-.912-.912-.913-.912-2.238V6.3q0-1.325.912-2.238.913-.912 2.238-.912H6v-2h2.575v2h6.85v-2H18v2h.7q1.325 0 2.238.912.912.913.912 2.238v13.4q0 1.325-.912 2.238-.913.912-2.238.912Zm0-3.15h13.4V10H5.3v9.7ZM5.3 8h13.4V6.3H5.3Zm0 0V6.3 8Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-dropdown{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24' stroke-width='1.5' stroke='currentColor'%3E%3Cpath stroke='%23000000' stroke-linecap='round' stroke-linejoin='round' d='M3 4.5h14.25M3 9h9.75M3 13.5h9.75m4.5-4.5v12m0 0l-3.75-3.75M17.25 21L21 17.25' /%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-initial{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='M6.225 20.775V7h-5V3.225H15V7h-5v13.775Zm9.775 0v-8h-3V9h9.775v3.775h-3v8Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-payment{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='m10.55 16.55 7.275-7.275L16.05 7.5l-5.5 5.45-2.675-2.65L6.1 12.075Zm-5.375 4.925q-1.125 0-1.887-.763-.763-.762-.763-1.887V5.175q0-1.125.763-1.888.762-.762 1.887-.762h13.65q1.125 0 1.888.762.762.763.762 1.888v13.65q0 1.125-.762 1.887-.763.763-1.888.763Zm0-2.65h13.65V5.175H5.175v13.65Zm0-13.65v13.65-13.65Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-radio{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='M12 17q2.075 0 3.538-1.463Q17 14.075 17 12t-1.462-3.538Q14.075 7 12 7 9.925 7 8.463 8.462 7 9.925 7 12q0 2.075 1.463 3.537Q9.925 17 12 17Zm0 5.85q-2.275 0-4.25-.85t-3.438-2.312Q2.85 18.225 2 16.25q-.85-1.975-.85-4.25T2 7.75q.85-1.975 2.312-3.438Q5.775 2.85 7.75 2q1.975-.85 4.25-.85t4.25.85q1.975.85 3.438 2.312Q21.15 5.775 22 7.75q.85 1.975.85 4.25T22 16.25q-.85 1.975-2.312 3.438Q18.225 21.15 16.25 22q-1.975.85-4.25.85Zm0-3.15q3.25 0 5.475-2.225Q19.7 15.25 19.7 12q0-3.25-2.225-5.475Q15.25 4.3 12 4.3q-3.25 0-5.475 2.225Q4.3 8.75 4.3 12q0 3.25 2.225 5.475Q8.75 19.7 12 19.7Zm0-7.7Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-signature{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='m9.225 21.225 4.65-4.65h8.45v4.65Zm-5.35-2.2H5.05l8.5-8.5-1.175-1.175-8.5 8.5Zm14.25-9.95L13.8 4.8l1.325-1.325q.625-.65 1.525-.663.9-.012 1.6.663l1.225 1.175q.675.675.663 1.562-.013.888-.663 1.513ZM16.7 10.55 6 21.225H1.675V16.9L12.35 6.225Zm-3.725-.625-.6-.575 1.175 1.175Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-textarea{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='M3.225 20.725v-3.15h11.55v3.15Zm0-4.775V12.8h17.55v3.15Zm0-4.75V8.05h17.55v3.15Zm0-4.775v-3.15h17.55v3.15Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-textbox{cursor:url(\"data:image/svg+xml,%3Csvg width='32' height='15' viewBox='0 0 32 15' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cmask id='path-1-inside-1_1401_24' fill='white'%3E%3Cpath d='M0 0H32V15H0V0Z'/%3E%3C/mask%3E%3Cpath d='M0 0H32V15H0V0Z' fill='%234C56CB' fill-opacity='0.1'/%3E%3Cpath d='M0 0V-1H-1V0H0ZM0 15H-1V16H0V15ZM0 1H32V-1H0V1ZM32 14H0V16H32V14ZM1 15V0H-1V15H1Z' fill='%234C56CB' mask='url(%23path-1-inside-1_1401_24)'/%3E%3Cpath d='M3 11.8V8.65H14.15V11.8H3ZM3 6.65V3.5H20.15V6.65H3Z' fill='%234C56CB'/%3E%3Cline x1='31.5' y1='1' x2='31.5' y2='14' stroke='%234C56CB' stroke-opacity='0.32' stroke-dasharray='1 1'/%3E%3C/svg%3E%0A\") 0 14, pointer}verdocs-template-fields.placing-timestamp{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath fill='%23000000' d='M9 1h6v2H9zm10.03 6.39 1.42-1.42c-.43-.51-.9-.99-1.41-1.41l-1.42 1.42C16.07 4.74 14.12 4 12 4c-4.97 0-9 4.03-9 9s4.02 9 9 9 9-4.03 9-9c0-2.12-.74-4.07-1.97-5.61zM13 14h-2V8h2v6z'%3E%3C/path%3E%3C/svg%3E\") 16 16, pointer}";const re=le;const ae='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="M3.425 16.15V13h11.15v3.15Zm0-5.15V7.85h17.15V11Z"/></svg>';const de='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="m10.55 16.55 7.275-7.275L16.05 7.5l-5.5 5.45-2.675-2.65L6.1 12.075Zm-5.375 4.925q-1.125 0-1.887-.763-.763-.762-.763-1.887V5.175q0-1.125.763-1.888.762-.762 1.887-.762h13.65q1.125 0 1.888.762.762.763.762 1.888v13.65q0 1.125-.762 1.887-.763.763-1.888.763Zm0-2.65h13.65V5.175H5.175v13.65Zm0-13.65v13.65-13.65Z"/></svg>';const ce='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="M12 17q2.075 0 3.538-1.463Q17 14.075 17 12t-1.462-3.538Q14.075 7 12 7 9.925 7 8.463 8.462 7 9.925 7 12q0 2.075 1.463 3.537Q9.925 17 12 17Zm0 5.85q-2.275 0-4.25-.85t-3.438-2.312Q2.85 18.225 2 16.25q-.85-1.975-.85-4.25T2 7.75q.85-1.975 2.312-3.438Q5.775 2.85 7.75 2q1.975-.85 4.25-.85t4.25.85q1.975.85 3.438 2.312Q21.15 5.775 22 7.75q.85 1.975.85 4.25T22 16.25q-.85 1.975-2.312 3.438Q18.225 21.15 16.25 22q-1.975.85-4.25.85Zm0-3.15q3.25 0 5.475-2.225Q19.7 15.25 19.7 12q0-3.25-2.225-5.475Q15.25 4.3 12 4.3q-3.25 0-5.475 2.225Q4.3 8.75 4.3 12q0 3.25 2.225 5.475Q8.75 19.7 12 19.7Zm0-7.7Z"/></svg>';const he='<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>';const ue='<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>';const fe='<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>';const pe='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="M9 1h6v2H9zm10.03 6.39 1.42-1.42c-.43-.51-.9-.99-1.41-1.41l-1.42 1.42C16.07 4.74 14.12 4 12 4c-4.97 0-9 4.03-9 9s4.02 9 9 9 9-4.03 9-9c0-2.12-.74-4.07-1.97-5.61zM13 14h-2V8h2v6z"></path></svg>';const ve='<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>';const me='<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-6"><path stroke-linecap="round" stroke-linejoin="round" d="m18.375 12.739-7.693 7.693a4.5 4.5 0 0 1-6.364-6.364l10.94-10.94A3 3 0 1 1 19.5 7.372L8.552 18.32m.009-.01-.01.01m5.699-9.941-7.81 7.81a1.5 1.5 0 0 0 2.112 2.13" /></svg>';const ge='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14.707 14.707"><g><rect x="6.275" y="0" fill="#ffffff7f" width="1" height="15"/></g></svg>';const be=[{id:"signature",tooltip:"Signature",icon:ue,class:"signature"},{id:"initial",tooltip:"Initials",icon:fe,class:"initial"},{id:"sep1",tooltip:"",icon:ge,class:"separator"},{id:"textbox",tooltip:"Text Box",icon:ae,class:"textbox"},{id:"checkbox",tooltip:"Check Box",icon:de,class:"checkbox"},{id:"radio",tooltip:"Radio Button",icon:ce,class:"radio"},{id:"dropdown",tooltip:"Dropdown",icon:ve,class:"dropdown"},{id:"sep2",tooltip:"",icon:ge,class:"separator"},{id:"date",tooltip:"Date",icon:he,class:"date"},{id:"timestamp",tooltip:"Timestamp",icon:pe,class:"timestamp"},{id:"attachment",tooltip:"Attachment",icon:me,class:"attachment"}];const xe=class{constructor(i){e(this,i);this.sdkError=t(this,"sdkError",7);this.templateUpdated=t(this,"templateUpdated",7);this.fieldsUpdated=t(this,"fieldsUpdated",7);this.templateListenerId=null;this.pageHeights={};this.cachedPageInfo={};this.endpoint=l.getDefault();this.templateId=null;this.toolbarTargetId=null;this.placing=null;this.showMustSelectRole=false;this.selectedRoleName="";this.loading=true;this.template=null}onTemplateIdChanged(){this.listenToTemplate()}handleKeyDown(e){if(e.key==="Escape"){this.placing=null}}async componentWillLoad(){var e,t,i;try{this.endpoint.loadSession();if(!this.templateId){console.log(`[FIELDS] Missing required template ID ${this.templateId}`);return}if(!this.endpoint.session){console.log("[FIELDS] Unable to start builder session, must be authenticated");return}this.listenToTemplate()}catch(s){console.log("[FIELDS] Error with fields session",s);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new y(s.message,(t=s.response)===null||t===void 0?void 0:t.status,(i=s.response)===null||i===void 0?void 0:i.data))}}componentDidRender(){H.dynamicDrop(true);const e=this.toolbarTargetId?document.getElementById(this.toolbarTargetId):null;const t=document.getElementById("verdocs-template-fields-toolbar");if(e&&t){console.log("[FIELDS] Moving toolbar");t.remove();e.append(t)}}componentWillUpdate(){var e,t;const i=((e=this.template)===null||e===void 0?void 0:e.roles)||[];if(!this.selectedRoleName||!i.find((e=>e&&e.name===this.selectedRoleName))){this.selectedRoleName=((t=i[0])===null||t===void 0?void 0:t.name)||"";console.log("[FIELDS] Selected new role",this.selectedRoleName)}}disconnectedCallback(){this.unlistenToTemplate()}async listenToTemplate(){this.unlistenToTemplate();k.subscribe("templates",this.templateId,(()=>r(this.endpoint,this.templateId)),false,(e=>{var t,i;this.template=e;this.loading=false;if(!this.selectedRoleName){this.selectedRoleName=((i=(t=e.roles)===null||t===void 0?void 0:t[0])===null||i===void 0?void 0:i.name)||""}}))}unlistenToTemplate(){if(this.templateListenerId){k.store.delListener(this.templateListenerId);this.templateListenerId=null}}attachFieldAttributes(e,t,i){i.addEventListener("settingsChanged",(()=>{var e;(e=this.templateUpdated)===null||e===void 0?void 0:e.emit({endpoint:this.endpoint,template:this.template,event:"added-field"})}));i.addEventListener("deleted",(()=>{var e;i.remove();(e=this.templateUpdated)===null||e===void 0?void 0:e.emit({endpoint:this.endpoint,template:this.template,event:"updated-field"})}));i.setAttribute("templateid",this.templateId);i.setAttribute("fieldname",t.name);i.setAttribute("pageNumber",String(e.pageNumber));i.setAttribute("xScale",String(e.xScale));i.setAttribute("yScale",String(e.yScale));i.setAttribute("name",t.name)}handlePageRendered(e){var t;const i=e.detail;this.cachedPageInfo[i.pageNumber]=i;this.pageHeights[i.pageNumber]=i.naturalHeight;(((t=this.template)===null||t===void 0?void 0:t.fields)||[]).filter((e=>e&&e.page===i.pageNumber)).forEach((e=>{const t=O(e);const i=document.getElementById(t);if(i){i.setAttribute("fieldname",e.name);i.setAttribute("pagenumber",String(e.page));this.makeDraggable(i)}}))}makeDraggable(e){H(e).draggable({listeners:{move:this.handleMoveField.bind(this),end:this.handleMoveEnd.bind(this)}})}async handleMoveField(e){const t=+(e.target.getAttribute("posX")||0);const i=+(e.target.getAttribute("posY")||0);const s=+(e.target.getAttribute("xScale")||1);const o=+(e.target.getAttribute("yScale")||1);const n=e.dx/s+t;const l=e.dy/o+i;e.target.setAttribute("posX",n);e.target.setAttribute("posy",l);z(e.target,"translate",`${n}px, ${l}px`)}async handleMoveEnd(e){var t,i,s,o,n,l,r,a;const d=e.target.getAttribute("fieldname");const c=(((t=this.template)===null||t===void 0?void 0:t.fields)||[]).find((e=>e.name===d));if(!c){console.log("[FIELDS] Unable to find field",d,e.target);return}const h=e.target.getAttribute("pagenumber");let{naturalWidth:u=612,naturalHeight:f=792,renderedHeight:p=792}=this.cachedPageInfo[h];const v=e.target.getBoundingClientRect();const g=e.target.parentElement;const b=g.getBoundingClientRect();const x=c.width||_(c.type);const w=c.height||V(c.type);const S=Math.max(v.left-b.left,0);let q=Math.max(p-(b.bottom-v.bottom),0);let C=parseInt(h);if(q>p){C=Math.min(C+1,((o=(s=((i=this.template)===null||i===void 0?void 0:i.documents)||[])===null||s===void 0?void 0:s[0])===null||o===void 0?void 0:o.pages)||1);q-=p;p=this.cachedPageInfo[C].renderedHeight;console.log("Next page",{newPageNumber:C,newY:q,renderedHeight:p})}else if(q<0){C=Math.max(C-1,1);p=this.cachedPageInfo[C].renderedHeight;q+=p;console.log("[FIELDS] Next page",{newPageNumber:C,newY:q,renderedHeight:p})}const{x:T,y:M}=this.viewCoordinatesToPageCoordinates(S,q,h,u-x,f-w);try{const t={x:T,y:M,page:C};const i=await m(this.endpoint,this.templateId,d,t);console.log("[FIELDS] Updated",i);const s=JSON.parse(JSON.stringify(this.template));const o=s.fields.findIndex((e=>e.name===d));if(o>-1){s.fields[o]=i}k.updateTemplate(this.templateId,s);e.target.removeAttribute("posX");e.target.removeAttribute("posY");Z(e.target);const{xScale:l=1,yScale:r=1}=this.cachedPageInfo[h];N(e.target,i,l,r);(n=this.templateUpdated)===null||n===void 0?void 0:n.emit({endpoint:this.endpoint,template:s,event:"updated-field"})}catch(t){E("Error updating field, please try again later",{style:"error"});console.log("[FIELDS] Error updating field",t);(l=this.sdkError)===null||l===void 0?void 0:l.emit(new y(t.message,(r=t.response)===null||r===void 0?void 0:r.status,(a=t.response)===null||a===void 0?void 0:a.data));e.target.removeAttribute("posX");e.target.removeAttribute("posY");Z(e.target)}}generateFieldName(e,t){var i;let s=1;let o;do{o=`${e}P${t}-${s}`;s++}while((((i=this.template)===null||i===void 0?void 0:i.fields)||[]).some((e=>e&&e.name===o)));return o}viewCoordinatesToPageCoordinates(e,t,i,s,o){const{xScale:n=1,yScale:l=1,renderedHeight:r=792}=this.cachedPageInfo[i];const a=Math.floor(Math.min(e/n,s));const d=Math.floor(Math.min(Math.max(r-t,0)/l,o));return{x:a,y:d}}async handleClickPage(e,t){var i;if(this.placing){const s=e.offsetX;const o=e.offsetY;const n=_(this.placing);const l=V(this.placing);const r=this.cachedPageInfo[t];const{naturalWidth:a=612,naturalHeight:d=792}=r;const c=this.viewCoordinatesToPageCoordinates(s,o,t,a-n,d-l);const h=Math.floor(c.x);const u=Math.floor(c.y);const f={name:this.generateFieldName(this.placing,t),role_name:this.selectedRoleName,template_id:this.templateId,document_id:r.documentId,type:this.placing,required:this.placing!=="radio",page:t,validator:null,label:null,default:null,placeholder:null,group:null,settings:{},x:h,y:u,width:n,height:l,multiline:false,readonly:false,options:this.placing==="radio"?[{id:"option-1",label:"Option 1"}]:[]};console.log("[FIELDS] Will save new field",f);const p=await g(this.endpoint,this.templateId,f);console.log("[FIELDS] Saved field",p);const v=JSON.parse(JSON.stringify(this.template));v.fields.push(p);k.updateTemplate(this.templateId,v);(i=this.templateUpdated)===null||i===void 0?void 0:i.emit({endpoint:this.endpoint,template:v,event:"added-field"});this.placing=null}}render(){var e,t,o;if(this.loading){return i(s,null,i("verdocs-loader",null))}if(!this.endpoint.session){return i(s,null,i("verdocs-component-error",{message:"You must be authenticated to use this module."}))}const n=(((e=this.template)===null||e===void 0?void 0:e.roles)||[]).map((e=>({value:e.name,label:e.full_name?`${e.name}: ${e.full_name}`:e.name})));return i(s,{class:this.placing?{[`placing-${this.placing}`]:true}:{},onSubmit:()=>{}},i("div",{id:"verdocs-template-fields-toolbar"},i("div",{class:"add-for"},"Add field:"),i("verdocs-select-input",{value:this.selectedRoleName,options:n,onInput:e=>this.selectedRoleName=e.target.value}),be.map((e=>i("verdocs-toolbar-icon",{text:e.tooltip,icon:e.icon,class:e.class,onClick:()=>{if(e.tooltip){if(this.selectedRoleName){this.placing=e.id}else{this.showMustSelectRole=true}}}})))),i("div",{class:"pages"},(((t=this.template)===null||t===void 0?void 0:t.documents)||[]).map((e=>{const t=a(1,e.pages);return t.map((t=>{const s=e.page_sizes[t];return i("verdocs-template-document-page",{templateId:this.templateId,documentId:e.id,pageNumber:t,virtualWidth:(s===null||s===void 0?void 0:s.width)||612,virtualHeight:(s===null||s===void 0?void 0:s.height)||792,disabled:true,editable:true,done:false,onClick:e=>this.handleClickPage(e,t),onPageRendered:e=>this.handlePageRendered(e),layers:[{name:"page",type:"canvas"},{name:"controls",type:"div"}]})}))}))),this.showMustSelectRole&&i("verdocs-ok-dialog",{heading:"Unable to add field",message:(((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:()=>this.showMustSelectRole=false}))}static get watchers(){return{templateId:["onTemplateIdChanged"]}}};xe.style=re;
2
+ /**!
3
+ * Sortable 1.15.6
4
+ * @author RubaXa <trash@rubaxa.org>
5
+ * @author owenm <owen23355@gmail.com>
6
+ * @license MIT
7
+ */function we(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);if(t){s=s.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))}i.push.apply(i,s)}return i}function ye(e){for(var t=1;t<arguments.length;t++){var i=arguments[t]!=null?arguments[t]:{};if(t%2){we(Object(i),true).forEach((function(t){Ee(e,t,i[t])}))}else if(Object.getOwnPropertyDescriptors){Object.defineProperties(e,Object.getOwnPropertyDescriptors(i))}else{we(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}}return e}function ke(e){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){ke=function(e){return typeof e}}else{ke=function(e){return e&&typeof Symbol==="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e}}return ke(e)}function Ee(e,t,i){if(t in e){Object.defineProperty(e,t,{value:i,enumerable:true,configurable:true,writable:true})}else{e[t]=i}return e}function Se(){Se=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var s in i){if(Object.prototype.hasOwnProperty.call(i,s)){e[s]=i[s]}}}return e};return Se.apply(this,arguments)}function qe(e,t){if(e==null)return{};var i={};var s=Object.keys(e);var o,n;for(n=0;n<s.length;n++){o=s[n];if(t.indexOf(o)>=0)continue;i[o]=e[o]}return i}function Ce(e,t){if(e==null)return{};var i=qe(e,t);var s,o;if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(o=0;o<n.length;o++){s=n[o];if(t.indexOf(s)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(e,s))continue;i[s]=e[s]}}return i}var Te="1.15.6";function Me(e){if(typeof window!=="undefined"&&window.navigator){return!!navigator.userAgent.match(e)}}var Ie=Me(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i);var Le=Me(/Edge/i);var De=Me(/firefox/i);var He=Me(/safari/i)&&!Me(/chrome/i)&&!Me(/android/i);var ze=Me(/iP(ad|od|hone)/i);var Ze=Me(/chrome/i)&&Me(/android/i);var Ne={capture:false,passive:false};function Oe(e,t,i){e.addEventListener(t,i,!Ie&&Ne)}function _e(e,t,i){e.removeEventListener(t,i,!Ie&&Ne)}function Ve(e,t){if(!t)return;t[0]===">"&&(t=t.substring(1));if(e){try{if(e.matches){return e.matches(t)}else if(e.msMatchesSelector){return e.msMatchesSelector(t)}else if(e.webkitMatchesSelector){return e.webkitMatchesSelector(t)}}catch(e){return false}}return false}function Re(e){return e.host&&e!==document&&e.host.nodeType?e.host:e.parentNode}function Ae(e,t,i,s){if(e){i=i||document;do{if(t!=null&&(t[0]===">"?e.parentNode===i&&Ve(e,t):Ve(e,t))||s&&e===i){return e}if(e===i)break}while(e=Re(e))}return null}var Ue=/\s+/g;function je(e,t,i){if(e&&t){if(e.classList){e.classList[i?"add":"remove"](t)}else{var s=(" "+e.className+" ").replace(Ue," ").replace(" "+t+" "," ");e.className=(s+(i?" "+t:"")).replace(Ue," ")}}}function Be(e,t,i){var s=e&&e.style;if(s){if(i===void 0){if(document.defaultView&&document.defaultView.getComputedStyle){i=document.defaultView.getComputedStyle(e,"")}else if(e.currentStyle){i=e.currentStyle}return t===void 0?i:i[t]}else{if(!(t in s)&&t.indexOf("webkit")===-1){t="-webkit-"+t}s[t]=i+(typeof i==="string"?"":"px")}}}function Pe(e,t){var i="";if(typeof e==="string"){i=e}else{do{var s=Be(e,"transform");if(s&&s!=="none"){i=s+" "+i}}while(!t&&(e=e.parentNode))}var o=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return o&&new o(i)}function $e(e,t,i){if(e){var s=e.getElementsByTagName(t),o=0,n=s.length;if(i){for(;o<n;o++){i(s[o],o)}}return s}return[]}function Fe(){var e=document.scrollingElement;if(e){return e}else{return document.documentElement}}function Qe(e,t,i,s,o){if(!e.getBoundingClientRect&&e!==window)return;var n,l,r,a,d,c,h;if(e!==window&&e.parentNode&&e!==Fe()){n=e.getBoundingClientRect();l=n.top;r=n.left;a=n.bottom;d=n.right;c=n.height;h=n.width}else{l=0;r=0;a=window.innerHeight;d=window.innerWidth;c=window.innerHeight;h=window.innerWidth}if((t||i)&&e!==window){o=o||e.parentNode;if(!Ie){do{if(o&&o.getBoundingClientRect&&(Be(o,"transform")!=="none"||i&&Be(o,"position")!=="static")){var u=o.getBoundingClientRect();l-=u.top+parseInt(Be(o,"border-top-width"));r-=u.left+parseInt(Be(o,"border-left-width"));a=l+n.height;d=r+n.width;break}}while(o=o.parentNode)}}if(s&&e!==window){var f=Pe(o||e),p=f&&f.a,v=f&&f.d;if(f){l/=v;r/=p;h/=p;c/=v;a=l+c;d=r+h}}return{top:l,left:r,bottom:a,right:d,width:h,height:c}}function We(e,t,i){var s=et(e,true),o=Qe(e)[t];while(s){var n=Qe(s)[i],l=void 0;if(i==="top"||i==="left"){l=o>=n}else{l=o<=n}if(!l)return s;if(s===Fe())break;s=et(s,false)}return false}function Ye(e,t,i,s){var o=0,n=0,l=e.children;while(n<l.length){if(l[n].style.display!=="none"&&l[n]!==ui.ghost&&(s||l[n]!==ui.dragged)&&Ae(l[n],i.draggable,e,false)){if(o===t){return l[n]}o++}n++}return null}function Ge(e,t){var i=e.lastElementChild;while(i&&(i===ui.ghost||Be(i,"display")==="none"||t&&!Ve(i,t))){i=i.previousElementSibling}return i||null}function Je(e,t){var i=0;if(!e||!e.parentNode){return-1}while(e=e.previousElementSibling){if(e.nodeName.toUpperCase()!=="TEMPLATE"&&e!==ui.clone&&(!t||Ve(e,t))){i++}}return i}function Xe(e){var t=0,i=0,s=Fe();if(e){do{var o=Pe(e),n=o.a,l=o.d;t+=e.scrollLeft*n;i+=e.scrollTop*l}while(e!==s&&(e=e.parentNode))}return[t,i]}function Ke(e,t){for(var i in e){if(!e.hasOwnProperty(i))continue;for(var s in t){if(t.hasOwnProperty(s)&&t[s]===e[i][s])return Number(i)}}return-1}function et(e,t){if(!e||!e.getBoundingClientRect)return Fe();var i=e;var s=false;do{if(i.clientWidth<i.scrollWidth||i.clientHeight<i.scrollHeight){var o=Be(i);if(i.clientWidth<i.scrollWidth&&(o.overflowX=="auto"||o.overflowX=="scroll")||i.clientHeight<i.scrollHeight&&(o.overflowY=="auto"||o.overflowY=="scroll")){if(!i.getBoundingClientRect||i===document.body)return Fe();if(s||t)return i;s=true}}}while(i=i.parentNode);return Fe()}function tt(e,t){if(e&&t){for(var i in t){if(t.hasOwnProperty(i)){e[i]=t[i]}}}return e}function it(e,t){return Math.round(e.top)===Math.round(t.top)&&Math.round(e.left)===Math.round(t.left)&&Math.round(e.height)===Math.round(t.height)&&Math.round(e.width)===Math.round(t.width)}var st;function ot(e,t){return function(){if(!st){var i=arguments,s=this;if(i.length===1){e.call(s,i[0])}else{e.apply(s,i)}st=setTimeout((function(){st=void 0}),t)}}}function nt(){clearTimeout(st);st=void 0}function lt(e,t,i){e.scrollLeft+=t;e.scrollTop+=i}function rt(e){var t=window.Polymer;var i=window.jQuery||window.Zepto;if(t&&t.dom){return t.dom(e).cloneNode(true)}else if(i){return i(e).clone(true)[0]}else{return e.cloneNode(true)}}function at(e,t,i){var s={};Array.from(e.children).forEach((function(o){var n,l,r,a;if(!Ae(o,t.draggable,e,false)||o.animated||o===i)return;var d=Qe(o);s.left=Math.min((n=s.left)!==null&&n!==void 0?n:Infinity,d.left);s.top=Math.min((l=s.top)!==null&&l!==void 0?l:Infinity,d.top);s.right=Math.max((r=s.right)!==null&&r!==void 0?r:-Infinity,d.right);s.bottom=Math.max((a=s.bottom)!==null&&a!==void 0?a:-Infinity,d.bottom)}));s.width=s.right-s.left;s.height=s.bottom-s.top;s.x=s.left;s.y=s.top;return s}var dt="Sortable"+(new Date).getTime();function ct(){var e=[],t;return{captureAnimationState:function t(){e=[];if(!this.options.animation)return;var i=[].slice.call(this.el.children);i.forEach((function(t){if(Be(t,"display")==="none"||t===ui.ghost)return;e.push({target:t,rect:Qe(t)});var i=ye({},e[e.length-1].rect);if(t.thisAnimationDuration){var s=Pe(t,true);if(s){i.top-=s.f;i.left-=s.e}}t.fromRect=i}))},addAnimationState:function t(i){e.push(i)},removeAnimationState:function t(i){e.splice(Ke(e,{target:i}),1)},animateAll:function i(s){var o=this;if(!this.options.animation){clearTimeout(t);if(typeof s==="function")s();return}var n=false,l=0;e.forEach((function(e){var t=0,i=e.target,s=i.fromRect,r=Qe(i),a=i.prevFromRect,d=i.prevToRect,c=e.rect,h=Pe(i,true);if(h){r.top-=h.f;r.left-=h.e}i.toRect=r;if(i.thisAnimationDuration){if(it(a,r)&&!it(s,r)&&(c.top-r.top)/(c.left-r.left)===(s.top-r.top)/(s.left-r.left)){t=ut(c,a,d,o.options)}}if(!it(r,s)){i.prevFromRect=s;i.prevToRect=r;if(!t){t=o.options.animation}o.animate(i,c,r,t)}if(t){n=true;l=Math.max(l,t);clearTimeout(i.animationResetTimer);i.animationResetTimer=setTimeout((function(){i.animationTime=0;i.prevFromRect=null;i.fromRect=null;i.prevToRect=null;i.thisAnimationDuration=null}),t);i.thisAnimationDuration=t}}));clearTimeout(t);if(!n){if(typeof s==="function")s()}else{t=setTimeout((function(){if(typeof s==="function")s()}),l)}e=[]},animate:function e(t,i,s,o){if(o){Be(t,"transition","");Be(t,"transform","");var n=Pe(this.el),l=n&&n.a,r=n&&n.d,a=(i.left-s.left)/(l||1),d=(i.top-s.top)/(r||1);t.animatingX=!!a;t.animatingY=!!d;Be(t,"transform","translate3d("+a+"px,"+d+"px,0)");this.forRepaintDummy=ht(t);Be(t,"transition","transform "+o+"ms"+(this.options.easing?" "+this.options.easing:""));Be(t,"transform","translate3d(0,0,0)");typeof t.animated==="number"&&clearTimeout(t.animated);t.animated=setTimeout((function(){Be(t,"transition","");Be(t,"transform","");t.animated=false;t.animatingX=false;t.animatingY=false}),o)}}}}function ht(e){return e.offsetWidth}function ut(e,t,i,s){return Math.sqrt(Math.pow(t.top-e.top,2)+Math.pow(t.left-e.left,2))/Math.sqrt(Math.pow(t.top-i.top,2)+Math.pow(t.left-i.left,2))*s.animation}var ft=[];var pt={initializeByDefault:true};var vt={mount:function e(t){for(var i in pt){if(pt.hasOwnProperty(i)&&!(i in t)){t[i]=pt[i]}}ft.forEach((function(e){if(e.pluginName===t.pluginName){throw"Sortable: Cannot mount plugin ".concat(t.pluginName," more than once")}}));ft.push(t)},pluginEvent:function e(t,i,s){var o=this;this.eventCanceled=false;s.cancel=function(){o.eventCanceled=true};var n=t+"Global";ft.forEach((function(e){if(!i[e.pluginName])return;if(i[e.pluginName][n]){i[e.pluginName][n](ye({sortable:i},s))}if(i.options[e.pluginName]&&i[e.pluginName][t]){i[e.pluginName][t](ye({sortable:i},s))}}))},initializePlugins:function e(t,i,s,o){ft.forEach((function(e){var o=e.pluginName;if(!t.options[o]&&!e.initializeByDefault)return;var n=new e(t,i,t.options);n.sortable=t;n.options=t.options;t[o]=n;Se(s,n.defaults)}));for(var n in t.options){if(!t.options.hasOwnProperty(n))continue;var l=this.modifyOption(t,n,t.options[n]);if(typeof l!=="undefined"){t.options[n]=l}}},getEventProperties:function e(t,i){var s={};ft.forEach((function(e){if(typeof e.eventProperties!=="function")return;Se(s,e.eventProperties.call(i[e.pluginName],t))}));return s},modifyOption:function e(t,i,s){var o;ft.forEach((function(e){if(!t[e.pluginName])return;if(e.optionListeners&&typeof e.optionListeners[i]==="function"){o=e.optionListeners[i].call(t[e.pluginName],s)}}));return o}};function mt(e){var t=e.sortable,i=e.rootEl,s=e.name,o=e.targetEl,n=e.cloneEl,l=e.toEl,r=e.fromEl,a=e.oldIndex,d=e.newIndex,c=e.oldDraggableIndex,h=e.newDraggableIndex,u=e.originalEvent,f=e.putSortable,p=e.extraEventProperties;t=t||i&&i[dt];if(!t)return;var v,m=t.options,g="on"+s.charAt(0).toUpperCase()+s.substr(1);if(window.CustomEvent&&!Ie&&!Le){v=new CustomEvent(s,{bubbles:true,cancelable:true})}else{v=document.createEvent("Event");v.initEvent(s,true,true)}v.to=l||i;v.from=r||i;v.item=o||i;v.clone=n;v.oldIndex=a;v.newIndex=d;v.oldDraggableIndex=c;v.newDraggableIndex=h;v.originalEvent=u;v.pullMode=f?f.lastPutMode:undefined;var b=ye(ye({},p),vt.getEventProperties(s,t));for(var x in b){v[x]=b[x]}if(i){i.dispatchEvent(v)}if(m[g]){m[g].call(t,v)}}var gt=["evt"];var bt=function e(t,i){var s=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{},o=s.evt,n=Ce(s,gt);vt.pluginEvent.bind(ui)(t,i,ye({dragEl:wt,parentEl:yt,ghostEl:kt,rootEl:Et,nextEl:St,lastDownEl:qt,cloneEl:Ct,cloneHidden:Tt,dragStarted:Bt,putSortable:zt,activeSortable:ui.active,originalEvent:o,oldIndex:Mt,oldDraggableIndex:Lt,newIndex:It,newDraggableIndex:Dt,hideGhostForTarget:ai,unhideGhostForTarget:di,cloneNowHidden:function e(){Tt=true},cloneNowShown:function e(){Tt=false},dispatchSortableEvent:function e(t){xt({sortable:i,name:t,originalEvent:o})}},n))};function xt(e){mt(ye({putSortable:zt,cloneEl:Ct,targetEl:wt,rootEl:Et,oldIndex:Mt,oldDraggableIndex:Lt,newIndex:It,newDraggableIndex:Dt},e))}var wt,yt,kt,Et,St,qt,Ct,Tt,Mt,It,Lt,Dt,Ht,zt,Zt=false,Nt=false,Ot=[],_t,Vt,Rt,At,Ut,jt,Bt,Pt,$t,Ft=false,Qt=false,Wt,Yt,Gt=[],Jt=false,Xt=[];var Kt=typeof document!=="undefined",ei=ze,ti=Le||Ie?"cssFloat":"float",ii=Kt&&!Ze&&!ze&&"draggable"in document.createElement("div"),si=function(){if(!Kt)return;if(Ie){return false}var e=document.createElement("x");e.style.cssText="pointer-events:auto";return e.style.pointerEvents==="auto"}(),oi=function e(t,i){var s=Be(t),o=parseInt(s.width)-parseInt(s.paddingLeft)-parseInt(s.paddingRight)-parseInt(s.borderLeftWidth)-parseInt(s.borderRightWidth),n=Ye(t,0,i),l=Ye(t,1,i),r=n&&Be(n),a=l&&Be(l),d=r&&parseInt(r.marginLeft)+parseInt(r.marginRight)+Qe(n).width,c=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+Qe(l).width;if(s.display==="flex"){return s.flexDirection==="column"||s.flexDirection==="column-reverse"?"vertical":"horizontal"}if(s.display==="grid"){return s.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal"}if(n&&r["float"]&&r["float"]!=="none"){var h=r["float"]==="left"?"left":"right";return l&&(a.clear==="both"||a.clear===h)?"vertical":"horizontal"}return n&&(r.display==="block"||r.display==="flex"||r.display==="table"||r.display==="grid"||d>=o&&s[ti]==="none"||l&&s[ti]==="none"&&d+c>o)?"vertical":"horizontal"},ni=function e(t,i,s){var o=s?t.left:t.top,n=s?t.right:t.bottom,l=s?t.width:t.height,r=s?i.left:i.top,a=s?i.right:i.bottom,d=s?i.width:i.height;return o===r||n===a||o+l/2===r+d/2},li=function e(t,i){var s;Ot.some((function(e){var o=e[dt].options.emptyInsertThreshold;if(!o||Ge(e))return;var n=Qe(e),l=t>=n.left-o&&t<=n.right+o,r=i>=n.top-o&&i<=n.bottom+o;if(l&&r){return s=e}}));return s},ri=function e(t){function i(e,t){return function(s,o,n,l){var r=s.options.group.name&&o.options.group.name&&s.options.group.name===o.options.group.name;if(e==null&&(t||r)){return true}else if(e==null||e===false){return false}else if(t&&e==="clone"){return e}else if(typeof e==="function"){return i(e(s,o,n,l),t)(s,o,n,l)}else{var a=(t?s:o).options.group.name;return e===true||typeof e==="string"&&e===a||e.join&&e.indexOf(a)>-1}}}var s={};var o=t.group;if(!o||ke(o)!="object"){o={name:o}}s.name=o.name;s.checkPull=i(o.pull,true);s.checkPut=i(o.put);s.revertClone=o.revertClone;t.group=s},ai=function e(){if(!si&&kt){Be(kt,"display","none")}},di=function e(){if(!si&&kt){Be(kt,"display","")}};if(Kt&&!Ze){document.addEventListener("click",(function(e){if(Nt){e.preventDefault();e.stopPropagation&&e.stopPropagation();e.stopImmediatePropagation&&e.stopImmediatePropagation();Nt=false;return false}}),true)}var ci=function e(t){if(wt){t=t.touches?t.touches[0]:t;var i=li(t.clientX,t.clientY);if(i){var s={};for(var o in t){if(t.hasOwnProperty(o)){s[o]=t[o]}}s.target=s.rootEl=i;s.preventDefault=void 0;s.stopPropagation=void 0;i[dt]._onDragOver(s)}}};var hi=function e(t){if(wt){wt.parentNode[dt]._isOutsideThisEl(t.target)}};function ui(e,t){if(!(e&&e.nodeType&&e.nodeType===1)){throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(e))}this.el=e;this.options=t=Se({},t);e[dt]=this;var i={group:null,sort:true,disabled:false,store:null,handle:null,draggable:/^[uo]l$/i.test(e.nodeName)?">li":">*",swapThreshold:1,invertSwap:false,invertedSwapThreshold:null,removeCloneOnHide:true,direction:function t(){return oi(e,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:true,animation:0,easing:null,setData:function e(t,i){t.setData("Text",i.textContent)},dropBubble:false,dragoverBubble:false,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:false,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:false,fallbackClass:"sortable-fallback",fallbackOnBody:false,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:ui.supportPointer!==false&&"PointerEvent"in window&&(!He||ze),emptyInsertThreshold:5};vt.initializePlugins(this,e,i);for(var s in i){!(s in t)&&(t[s]=i[s])}ri(t);for(var o in this){if(o.charAt(0)==="_"&&typeof this[o]==="function"){this[o]=this[o].bind(this)}}this.nativeDraggable=t.forceFallback?false:ii;if(this.nativeDraggable){this.options.touchStartThreshold=1}if(t.supportPointer){Oe(e,"pointerdown",this._onTapStart)}else{Oe(e,"mousedown",this._onTapStart);Oe(e,"touchstart",this._onTapStart)}if(this.nativeDraggable){Oe(e,"dragover",this);Oe(e,"dragenter",this)}Ot.push(this.el);t.store&&t.store.get&&this.sort(t.store.get(this)||[]);Se(this,ct())}ui.prototype={constructor:ui,_isOutsideThisEl:function e(t){if(!this.el.contains(t)&&t!==this.el){Pt=null}},_getDirection:function e(t,i){return typeof this.options.direction==="function"?this.options.direction.call(this,t,i,wt):this.options.direction},_onTapStart:function e(t){if(!t.cancelable)return;var i=this,s=this.el,o=this.options,n=o.preventOnFilter,l=t.type,r=t.touches&&t.touches[0]||t.pointerType&&t.pointerType==="touch"&&t,a=(r||t).target,d=t.target.shadowRoot&&(t.path&&t.path[0]||t.composedPath&&t.composedPath()[0])||a,c=o.filter;ki(s);if(wt){return}if(/mousedown|pointerdown/.test(l)&&t.button!==0||o.disabled){return}if(d.isContentEditable){return}if(!this.nativeDraggable&&He&&a&&a.tagName.toUpperCase()==="SELECT"){return}a=Ae(a,o.draggable,s,false);if(a&&a.animated){return}if(qt===a){return}Mt=Je(a);Lt=Je(a,o.draggable);if(typeof c==="function"){if(c.call(this,t,a,this)){xt({sortable:i,rootEl:d,name:"filter",targetEl:a,toEl:s,fromEl:s});bt("filter",i,{evt:t});n&&t.preventDefault();return}}else if(c){c=c.split(",").some((function(e){e=Ae(d,e.trim(),s,false);if(e){xt({sortable:i,rootEl:e,name:"filter",targetEl:a,fromEl:s,toEl:s});bt("filter",i,{evt:t});return true}}));if(c){n&&t.preventDefault();return}}if(o.handle&&!Ae(d,o.handle,s,false)){return}this._prepareDragStart(t,r,a)},_prepareDragStart:function e(t,i,s){var o=this,n=o.el,l=o.options,r=n.ownerDocument,a;if(s&&!wt&&s.parentNode===n){var d=Qe(s);Et=n;wt=s;yt=wt.parentNode;St=wt.nextSibling;qt=s;Ht=l.group;ui.dragged=wt;_t={target:wt,clientX:(i||t).clientX,clientY:(i||t).clientY};Ut=_t.clientX-d.left;jt=_t.clientY-d.top;this._lastX=(i||t).clientX;this._lastY=(i||t).clientY;wt.style["will-change"]="all";a=function e(){bt("delayEnded",o,{evt:t});if(ui.eventCanceled){o._onDrop();return}o._disableDelayedDragEvents();if(!De&&o.nativeDraggable){wt.draggable=true}o._triggerDragStart(t,i);xt({sortable:o,name:"choose",originalEvent:t});je(wt,l.chosenClass,true)};l.ignore.split(",").forEach((function(e){$e(wt,e.trim(),vi)}));Oe(r,"dragover",ci);Oe(r,"mousemove",ci);Oe(r,"touchmove",ci);if(l.supportPointer){Oe(r,"pointerup",o._onDrop);!this.nativeDraggable&&Oe(r,"pointercancel",o._onDrop)}else{Oe(r,"mouseup",o._onDrop);Oe(r,"touchend",o._onDrop);Oe(r,"touchcancel",o._onDrop)}if(De&&this.nativeDraggable){this.options.touchStartThreshold=4;wt.draggable=true}bt("delayStart",this,{evt:t});if(l.delay&&(!l.delayOnTouchOnly||i)&&(!this.nativeDraggable||!(Le||Ie))){if(ui.eventCanceled){this._onDrop();return}if(l.supportPointer){Oe(r,"pointerup",o._disableDelayedDrag);Oe(r,"pointercancel",o._disableDelayedDrag)}else{Oe(r,"mouseup",o._disableDelayedDrag);Oe(r,"touchend",o._disableDelayedDrag);Oe(r,"touchcancel",o._disableDelayedDrag)}Oe(r,"mousemove",o._delayedDragTouchMoveHandler);Oe(r,"touchmove",o._delayedDragTouchMoveHandler);l.supportPointer&&Oe(r,"pointermove",o._delayedDragTouchMoveHandler);o._dragStartTimer=setTimeout(a,l.delay)}else{a()}}},_delayedDragTouchMoveHandler:function e(t){var i=t.touches?t.touches[0]:t;if(Math.max(Math.abs(i.clientX-this._lastX),Math.abs(i.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))){this._disableDelayedDrag()}},_disableDelayedDrag:function e(){wt&&vi(wt);clearTimeout(this._dragStartTimer);this._disableDelayedDragEvents()},_disableDelayedDragEvents:function e(){var t=this.el.ownerDocument;_e(t,"mouseup",this._disableDelayedDrag);_e(t,"touchend",this._disableDelayedDrag);_e(t,"touchcancel",this._disableDelayedDrag);_e(t,"pointerup",this._disableDelayedDrag);_e(t,"pointercancel",this._disableDelayedDrag);_e(t,"mousemove",this._delayedDragTouchMoveHandler);_e(t,"touchmove",this._delayedDragTouchMoveHandler);_e(t,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function e(t,i){i=i||t.pointerType=="touch"&&t;if(!this.nativeDraggable||i){if(this.options.supportPointer){Oe(document,"pointermove",this._onTouchMove)}else if(i){Oe(document,"touchmove",this._onTouchMove)}else{Oe(document,"mousemove",this._onTouchMove)}}else{Oe(wt,"dragend",this);Oe(Et,"dragstart",this._onDragStart)}try{if(document.selection){Ei((function(){document.selection.empty()}))}else{window.getSelection().removeAllRanges()}}catch(e){}},_dragStarted:function e(t,i){Zt=false;if(Et&&wt){bt("dragStarted",this,{evt:i});if(this.nativeDraggable){Oe(document,"dragover",hi)}var s=this.options;!t&&je(wt,s.dragClass,false);je(wt,s.ghostClass,true);ui.active=this;t&&this._appendGhost();xt({sortable:this,name:"start",originalEvent:i})}else{this._nulling()}},_emulateDragOver:function e(){if(Vt){this._lastX=Vt.clientX;this._lastY=Vt.clientY;ai();var t=document.elementFromPoint(Vt.clientX,Vt.clientY);var i=t;while(t&&t.shadowRoot){t=t.shadowRoot.elementFromPoint(Vt.clientX,Vt.clientY);if(t===i)break;i=t}wt.parentNode[dt]._isOutsideThisEl(t);if(i){do{if(i[dt]){var s=void 0;s=i[dt]._onDragOver({clientX:Vt.clientX,clientY:Vt.clientY,target:t,rootEl:i});if(s&&!this.options.dragoverBubble){break}}t=i}while(i=Re(i))}di()}},_onTouchMove:function e(t){if(_t){var i=this.options,s=i.fallbackTolerance,o=i.fallbackOffset,n=t.touches?t.touches[0]:t,l=kt&&Pe(kt,true),r=kt&&l&&l.a,a=kt&&l&&l.d,d=ei&&Yt&&Xe(Yt),c=(n.clientX-_t.clientX+o.x)/(r||1)+(d?d[0]-Gt[0]:0)/(r||1),h=(n.clientY-_t.clientY+o.y)/(a||1)+(d?d[1]-Gt[1]:0)/(a||1);if(!ui.active&&!Zt){if(s&&Math.max(Math.abs(n.clientX-this._lastX),Math.abs(n.clientY-this._lastY))<s){return}this._onDragStart(t,true)}if(kt){if(l){l.e+=c-(Rt||0);l.f+=h-(At||0)}else{l={a:1,b:0,c:0,d:1,e:c,f:h}}var u="matrix(".concat(l.a,",").concat(l.b,",").concat(l.c,",").concat(l.d,",").concat(l.e,",").concat(l.f,")");Be(kt,"webkitTransform",u);Be(kt,"mozTransform",u);Be(kt,"msTransform",u);Be(kt,"transform",u);Rt=c;At=h;Vt=n}t.cancelable&&t.preventDefault()}},_appendGhost:function e(){if(!kt){var t=this.options.fallbackOnBody?document.body:Et,i=Qe(wt,true,ei,true,t),s=this.options;if(ei){Yt=t;while(Be(Yt,"position")==="static"&&Be(Yt,"transform")==="none"&&Yt!==document){Yt=Yt.parentNode}if(Yt!==document.body&&Yt!==document.documentElement){if(Yt===document)Yt=Fe();i.top+=Yt.scrollTop;i.left+=Yt.scrollLeft}else{Yt=Fe()}Gt=Xe(Yt)}kt=wt.cloneNode(true);je(kt,s.ghostClass,false);je(kt,s.fallbackClass,true);je(kt,s.dragClass,true);Be(kt,"transition","");Be(kt,"transform","");Be(kt,"box-sizing","border-box");Be(kt,"margin",0);Be(kt,"top",i.top);Be(kt,"left",i.left);Be(kt,"width",i.width);Be(kt,"height",i.height);Be(kt,"opacity","0.8");Be(kt,"position",ei?"absolute":"fixed");Be(kt,"zIndex","100000");Be(kt,"pointerEvents","none");ui.ghost=kt;t.appendChild(kt);Be(kt,"transform-origin",Ut/parseInt(kt.style.width)*100+"% "+jt/parseInt(kt.style.height)*100+"%")}},_onDragStart:function e(t,i){var s=this;var o=t.dataTransfer;var n=s.options;bt("dragStart",this,{evt:t});if(ui.eventCanceled){this._onDrop();return}bt("setupClone",this);if(!ui.eventCanceled){Ct=rt(wt);Ct.removeAttribute("id");Ct.draggable=false;Ct.style["will-change"]="";this._hideClone();je(Ct,this.options.chosenClass,false);ui.clone=Ct}s.cloneId=Ei((function(){bt("clone",s);if(ui.eventCanceled)return;if(!s.options.removeCloneOnHide){Et.insertBefore(Ct,wt)}s._hideClone();xt({sortable:s,name:"clone"})}));!i&&je(wt,n.dragClass,true);if(i){Nt=true;s._loopId=setInterval(s._emulateDragOver,50)}else{_e(document,"mouseup",s._onDrop);_e(document,"touchend",s._onDrop);_e(document,"touchcancel",s._onDrop);if(o){o.effectAllowed="move";n.setData&&n.setData.call(s,o,wt)}Oe(document,"drop",s);Be(wt,"transform","translateZ(0)")}Zt=true;s._dragStartId=Ei(s._dragStarted.bind(s,i,t));Oe(document,"selectstart",s);Bt=true;window.getSelection().removeAllRanges();if(He){Be(document.body,"user-select","none")}},_onDragOver:function e(t){var i=this.el,s=t.target,o,n,l,r=this.options,a=r.group,d=ui.active,c=Ht===a,h=r.sort,u=zt||d,f,p=this,v=false;if(Jt)return;function m(e,r){bt(e,p,ye({evt:t,isOwner:c,axis:f?"vertical":"horizontal",revert:l,dragRect:o,targetRect:n,canSort:h,fromSortable:u,target:s,completed:b,onMove:function e(s,n){return pi(Et,i,wt,o,s,Qe(s),t,n)},changed:x},r))}function g(){m("dragOverAnimationCapture");p.captureAnimationState();if(p!==u){u.captureAnimationState()}}function b(e){m("dragOverCompleted",{insertion:e});if(e){if(c){d._hideClone()}else{d._showClone(p)}if(p!==u){je(wt,zt?zt.options.ghostClass:d.options.ghostClass,false);je(wt,r.ghostClass,true)}if(zt!==p&&p!==ui.active){zt=p}else if(p===ui.active&&zt){zt=null}if(u===p){p._ignoreWhileAnimating=s}p.animateAll((function(){m("dragOverAnimationComplete");p._ignoreWhileAnimating=null}));if(p!==u){u.animateAll();u._ignoreWhileAnimating=null}}if(s===wt&&!wt.animated||s===i&&!s.animated){Pt=null}if(!r.dragoverBubble&&!t.rootEl&&s!==document){wt.parentNode[dt]._isOutsideThisEl(t.target);!e&&ci(t)}!r.dragoverBubble&&t.stopPropagation&&t.stopPropagation();return v=true}function x(){It=Je(wt);Dt=Je(wt,r.draggable);xt({sortable:p,name:"change",toEl:i,newIndex:It,newDraggableIndex:Dt,originalEvent:t})}if(t.preventDefault!==void 0){t.cancelable&&t.preventDefault()}s=Ae(s,r.draggable,i,true);m("dragOver");if(ui.eventCanceled)return v;if(wt.contains(t.target)||s.animated&&s.animatingX&&s.animatingY||p._ignoreWhileAnimating===s){return b(false)}Nt=false;if(d&&!r.disabled&&(c?h||(l=yt!==Et):zt===this||(this.lastPutMode=Ht.checkPull(this,d,wt,t))&&a.checkPut(this,d,wt,t))){f=this._getDirection(t,s)==="vertical";o=Qe(wt);m("dragOverValid");if(ui.eventCanceled)return v;if(l){yt=Et;g();this._hideClone();m("revert");if(!ui.eventCanceled){if(St){Et.insertBefore(wt,St)}else{Et.appendChild(wt)}}return b(true)}var w=Ge(i,r.draggable);if(!w||bi(t,f,this)&&!w.animated){if(w===wt){return b(false)}if(w&&i===t.target){s=w}if(s){n=Qe(s)}if(pi(Et,i,wt,o,s,n,t,!!s)!==false){g();if(w&&w.nextSibling){i.insertBefore(wt,w.nextSibling)}else{i.appendChild(wt)}yt=i;x();return b(true)}}else if(w&&gi(t,f,this)){var y=Ye(i,0,r,true);if(y===wt){return b(false)}s=y;n=Qe(s);if(pi(Et,i,wt,o,s,n,t,false)!==false){g();i.insertBefore(wt,y);yt=i;x();return b(true)}}else if(s.parentNode===i){n=Qe(s);var k=0,E,S=wt.parentNode!==i,q=!ni(wt.animated&&wt.toRect||o,s.animated&&s.toRect||n,f),C=f?"top":"left",T=We(s,"top","top")||We(wt,"top","top"),M=T?T.scrollTop:void 0;if(Pt!==s){E=n[C];Ft=false;Qt=!q&&r.invertSwap||S}k=xi(t,s,n,f,q?1:r.swapThreshold,r.invertedSwapThreshold==null?r.swapThreshold:r.invertedSwapThreshold,Qt,Pt===s);var I;if(k!==0){var L=Je(wt);do{L-=k;I=yt.children[L]}while(I&&(Be(I,"display")==="none"||I===kt))}if(k===0||I===s){return b(false)}Pt=s;$t=k;var D=s.nextElementSibling,H=false;H=k===1;var z=pi(Et,i,wt,o,s,n,t,H);if(z!==false){if(z===1||z===-1){H=z===1}Jt=true;setTimeout(mi,30);g();if(H&&!D){i.appendChild(wt)}else{s.parentNode.insertBefore(wt,H?D:s)}if(T){lt(T,0,M-T.scrollTop)}yt=wt.parentNode;if(E!==undefined&&!Qt){Wt=Math.abs(E-Qe(s)[C])}x();return b(true)}}if(i.contains(wt)){return b(false)}}return false},_ignoreWhileAnimating:null,_offMoveEvents:function e(){_e(document,"mousemove",this._onTouchMove);_e(document,"touchmove",this._onTouchMove);_e(document,"pointermove",this._onTouchMove);_e(document,"dragover",ci);_e(document,"mousemove",ci);_e(document,"touchmove",ci)},_offUpEvents:function e(){var t=this.el.ownerDocument;_e(t,"mouseup",this._onDrop);_e(t,"touchend",this._onDrop);_e(t,"pointerup",this._onDrop);_e(t,"pointercancel",this._onDrop);_e(t,"touchcancel",this._onDrop);_e(document,"selectstart",this)},_onDrop:function e(t){var i=this.el,s=this.options;It=Je(wt);Dt=Je(wt,s.draggable);bt("drop",this,{evt:t});yt=wt&&wt.parentNode;It=Je(wt);Dt=Je(wt,s.draggable);if(ui.eventCanceled){this._nulling();return}Zt=false;Qt=false;Ft=false;clearInterval(this._loopId);clearTimeout(this._dragStartTimer);Si(this.cloneId);Si(this._dragStartId);if(this.nativeDraggable){_e(document,"drop",this);_e(i,"dragstart",this._onDragStart)}this._offMoveEvents();this._offUpEvents();if(He){Be(document.body,"user-select","")}Be(wt,"transform","");if(t){if(Bt){t.cancelable&&t.preventDefault();!s.dropBubble&&t.stopPropagation()}kt&&kt.parentNode&&kt.parentNode.removeChild(kt);if(Et===yt||zt&&zt.lastPutMode!=="clone"){Ct&&Ct.parentNode&&Ct.parentNode.removeChild(Ct)}if(wt){if(this.nativeDraggable){_e(wt,"dragend",this)}vi(wt);wt.style["will-change"]="";if(Bt&&!Zt){je(wt,zt?zt.options.ghostClass:this.options.ghostClass,false)}je(wt,this.options.chosenClass,false);xt({sortable:this,name:"unchoose",toEl:yt,newIndex:null,newDraggableIndex:null,originalEvent:t});if(Et!==yt){if(It>=0){xt({rootEl:yt,name:"add",toEl:yt,fromEl:Et,originalEvent:t});xt({sortable:this,name:"remove",toEl:yt,originalEvent:t});xt({rootEl:yt,name:"sort",toEl:yt,fromEl:Et,originalEvent:t});xt({sortable:this,name:"sort",toEl:yt,originalEvent:t})}zt&&zt.save()}else{if(It!==Mt){if(It>=0){xt({sortable:this,name:"update",toEl:yt,originalEvent:t});xt({sortable:this,name:"sort",toEl:yt,originalEvent:t})}}}if(ui.active){if(It==null||It===-1){It=Mt;Dt=Lt}xt({sortable:this,name:"end",toEl:yt,originalEvent:t});this.save()}}}this._nulling()},_nulling:function e(){bt("nulling",this);Et=wt=yt=kt=St=Ct=qt=Tt=_t=Vt=Bt=It=Dt=Mt=Lt=Pt=$t=zt=Ht=ui.dragged=ui.ghost=ui.clone=ui.active=null;Xt.forEach((function(e){e.checked=true}));Xt.length=Rt=At=0},handleEvent:function e(t){switch(t.type){case"drop":case"dragend":this._onDrop(t);break;case"dragenter":case"dragover":if(wt){this._onDragOver(t);fi(t)}break;case"selectstart":t.preventDefault();break}},toArray:function e(){var t=[],i,s=this.el.children,o=0,n=s.length,l=this.options;for(;o<n;o++){i=s[o];if(Ae(i,l.draggable,this.el,false)){t.push(i.getAttribute(l.dataIdAttr)||yi(i))}}return t},sort:function e(t,i){var s={},o=this.el;this.toArray().forEach((function(e,t){var i=o.children[t];if(Ae(i,this.options.draggable,o,false)){s[e]=i}}),this);i&&this.captureAnimationState();t.forEach((function(e){if(s[e]){o.removeChild(s[e]);o.appendChild(s[e])}}));i&&this.animateAll()},save:function e(){var t=this.options.store;t&&t.set&&t.set(this)},closest:function e(t,i){return Ae(t,i||this.options.draggable,this.el,false)},option:function e(t,i){var s=this.options;if(i===void 0){return s[t]}else{var o=vt.modifyOption(this,t,i);if(typeof o!=="undefined"){s[t]=o}else{s[t]=i}if(t==="group"){ri(s)}}},destroy:function e(){bt("destroy",this);var t=this.el;t[dt]=null;_e(t,"mousedown",this._onTapStart);_e(t,"touchstart",this._onTapStart);_e(t,"pointerdown",this._onTapStart);if(this.nativeDraggable){_e(t,"dragover",this);_e(t,"dragenter",this)}Array.prototype.forEach.call(t.querySelectorAll("[draggable]"),(function(e){e.removeAttribute("draggable")}));this._onDrop();this._disableDelayedDragEvents();Ot.splice(Ot.indexOf(this.el),1);this.el=t=null},_hideClone:function e(){if(!Tt){bt("hideClone",this);if(ui.eventCanceled)return;Be(Ct,"display","none");if(this.options.removeCloneOnHide&&Ct.parentNode){Ct.parentNode.removeChild(Ct)}Tt=true}},_showClone:function e(t){if(t.lastPutMode!=="clone"){this._hideClone();return}if(Tt){bt("showClone",this);if(ui.eventCanceled)return;if(wt.parentNode==Et&&!this.options.group.revertClone){Et.insertBefore(Ct,wt)}else if(St){Et.insertBefore(Ct,St)}else{Et.appendChild(Ct)}if(this.options.group.revertClone){this.animate(wt,Ct)}Be(Ct,"display","");Tt=false}}};function fi(e){if(e.dataTransfer){e.dataTransfer.dropEffect="move"}e.cancelable&&e.preventDefault()}function pi(e,t,i,s,o,n,l,r){var a,d=e[dt],c=d.options.onMove,h;if(window.CustomEvent&&!Ie&&!Le){a=new CustomEvent("move",{bubbles:true,cancelable:true})}else{a=document.createEvent("Event");a.initEvent("move",true,true)}a.to=t;a.from=e;a.dragged=i;a.draggedRect=s;a.related=o||t;a.relatedRect=n||Qe(t);a.willInsertAfter=r;a.originalEvent=l;e.dispatchEvent(a);if(c){h=c.call(d,a,l)}return h}function vi(e){e.draggable=false}function mi(){Jt=false}function gi(e,t,i){var s=Qe(Ye(i.el,0,i.options,true));var o=at(i.el,i.options,kt);var n=10;return t?e.clientX<o.left-n||e.clientY<s.top&&e.clientX<s.right:e.clientY<o.top-n||e.clientY<s.bottom&&e.clientX<s.left}function bi(e,t,i){var s=Qe(Ge(i.el,i.options.draggable));var o=at(i.el,i.options,kt);var n=10;return t?e.clientX>o.right+n||e.clientY>s.bottom&&e.clientX>s.left:e.clientY>o.bottom+n||e.clientX>s.right&&e.clientY>s.top}function xi(e,t,i,s,o,n,l,r){var a=s?e.clientY:e.clientX,d=s?i.height:i.width,c=s?i.top:i.left,h=s?i.bottom:i.right,u=false;if(!l){if(r&&Wt<d*o){if(!Ft&&($t===1?a>c+d*n/2:a<h-d*n/2)){Ft=true}if(!Ft){if($t===1?a<c+Wt:a>h-Wt){return-$t}}else{u=true}}else{if(a>c+d*(1-o)/2&&a<h-d*(1-o)/2){return wi(t)}}}u=u||l;if(u){if(a<c+d*n/2||a>h-d*n/2){return a>c+d/2?1:-1}}return 0}function wi(e){if(Je(wt)<Je(e)){return 1}else{return-1}}function yi(e){var t=e.tagName+e.className+e.src+e.href+e.textContent,i=t.length,s=0;while(i--){s+=t.charCodeAt(i)}return s.toString(36)}function ki(e){Xt.length=0;var t=e.getElementsByTagName("input");var i=t.length;while(i--){var s=t[i];s.checked&&Xt.push(s)}}function Ei(e){return setTimeout(e,0)}function Si(e){return clearTimeout(e)}if(Kt){Oe(document,"touchmove",(function(e){if((ui.active||Zt)&&e.cancelable){e.preventDefault()}}))}ui.utils={on:Oe,off:_e,css:Be,find:$e,is:function e(t,i){return!!Ae(t,i,t,false)},extend:tt,throttle:ot,closest:Ae,toggleClass:je,clone:rt,index:Je,nextTick:Ei,cancelNextTick:Si,detectDirection:oi,getChild:Ye,expando:dt};ui.get=function(e){return e[dt]};ui.mount=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++){t[i]=arguments[i]}if(t[0].constructor===Array)t=t[0];t.forEach((function(e){if(!e.prototype||!e.prototype.constructor){throw"Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(e))}if(e.utils)ui.utils=ye(ye({},ui.utils),e.utils);vt.mount(e)}))};ui.create=function(e,t){return new ui(e,t)};ui.version=Te;var qi=[],Ci,Ti,Mi=false,Ii,Li,Di,Hi;function zi(){function e(){this.defaults={scroll:true,forceAutoScrollFallback:false,scrollSensitivity:30,scrollSpeed:10,bubbleScroll:true};for(var e in this){if(e.charAt(0)==="_"&&typeof this[e]==="function"){this[e]=this[e].bind(this)}}}e.prototype={dragStarted:function e(t){var i=t.originalEvent;if(this.sortable.nativeDraggable){Oe(document,"dragover",this._handleAutoScroll)}else{if(this.options.supportPointer){Oe(document,"pointermove",this._handleFallbackAutoScroll)}else if(i.touches){Oe(document,"touchmove",this._handleFallbackAutoScroll)}else{Oe(document,"mousemove",this._handleFallbackAutoScroll)}}},dragOverCompleted:function e(t){var i=t.originalEvent;if(!this.options.dragOverBubble&&!i.rootEl){this._handleAutoScroll(i)}},drop:function e(){if(this.sortable.nativeDraggable){_e(document,"dragover",this._handleAutoScroll)}else{_e(document,"pointermove",this._handleFallbackAutoScroll);_e(document,"touchmove",this._handleFallbackAutoScroll);_e(document,"mousemove",this._handleFallbackAutoScroll)}Ni();Zi();nt()},nulling:function e(){Di=Ti=Ci=Mi=Hi=Ii=Li=null;qi.length=0},_handleFallbackAutoScroll:function e(t){this._handleAutoScroll(t,true)},_handleAutoScroll:function e(t,i){var s=this;var o=(t.touches?t.touches[0]:t).clientX,n=(t.touches?t.touches[0]:t).clientY,l=document.elementFromPoint(o,n);Di=t;if(i||this.options.forceAutoScrollFallback||Le||Ie||He){Oi(t,this.options,l,i);var r=et(l,true);if(Mi&&(!Hi||o!==Ii||n!==Li)){Hi&&Ni();Hi=setInterval((function(){var e=et(document.elementFromPoint(o,n),true);if(e!==r){r=e;Zi()}Oi(t,s.options,e,i)}),10);Ii=o;Li=n}}else{if(!this.options.bubbleScroll||et(l,true)===Fe()){Zi();return}Oi(t,this.options,et(l,false),false)}}};return Se(e,{pluginName:"scroll",initializeByDefault:true})}function Zi(){qi.forEach((function(e){clearInterval(e.pid)}));qi=[]}function Ni(){clearInterval(Hi)}var Oi=ot((function(e,t,i,s){if(!t.scroll)return;var o=(e.touches?e.touches[0]:e).clientX,n=(e.touches?e.touches[0]:e).clientY,l=t.scrollSensitivity,r=t.scrollSpeed,a=Fe();var d=false,c;if(Ti!==i){Ti=i;Zi();Ci=t.scroll;c=t.scrollFn;if(Ci===true){Ci=et(i,true)}}var h=0;var u=Ci;do{var f=u,p=Qe(f),v=p.top,m=p.bottom,g=p.left,b=p.right,x=p.width,w=p.height,y=void 0,k=void 0,E=f.scrollWidth,S=f.scrollHeight,q=Be(f),C=f.scrollLeft,T=f.scrollTop;if(f===a){y=x<E&&(q.overflowX==="auto"||q.overflowX==="scroll"||q.overflowX==="visible");k=w<S&&(q.overflowY==="auto"||q.overflowY==="scroll"||q.overflowY==="visible")}else{y=x<E&&(q.overflowX==="auto"||q.overflowX==="scroll");k=w<S&&(q.overflowY==="auto"||q.overflowY==="scroll")}var M=y&&(Math.abs(b-o)<=l&&C+x<E)-(Math.abs(g-o)<=l&&!!C);var I=k&&(Math.abs(m-n)<=l&&T+w<S)-(Math.abs(v-n)<=l&&!!T);if(!qi[h]){for(var L=0;L<=h;L++){if(!qi[L]){qi[L]={}}}}if(qi[h].vx!=M||qi[h].vy!=I||qi[h].el!==f){qi[h].el=f;qi[h].vx=M;qi[h].vy=I;clearInterval(qi[h].pid);if(M!=0||I!=0){d=true;qi[h].pid=setInterval(function(){if(s&&this.layer===0){ui.active._onTouchMove(Di)}var t=qi[this.layer].vy?qi[this.layer].vy*r:0;var i=qi[this.layer].vx?qi[this.layer].vx*r:0;if(typeof c==="function"){if(c.call(ui.dragged.parentNode[dt],i,t,e,Di,qi[this.layer].el)!=="continue"){return}}lt(qi[this.layer].el,i,t)}.bind({layer:h}),24)}}h++}while(t.bubbleScroll&&u!==a&&(u=et(u,false)));Mi=d}),30);var _i=function e(t){var i=t.originalEvent,s=t.putSortable,o=t.dragEl,n=t.activeSortable,l=t.dispatchSortableEvent,r=t.hideGhostForTarget,a=t.unhideGhostForTarget;if(!i)return;var d=s||n;r();var c=i.changedTouches&&i.changedTouches.length?i.changedTouches[0]:i;var h=document.elementFromPoint(c.clientX,c.clientY);a();if(d&&!d.el.contains(h)){l("spill");this.onSpill({dragEl:o,putSortable:s})}};function Vi(){}Vi.prototype={startIndex:null,dragStart:function e(t){var i=t.oldDraggableIndex;this.startIndex=i},onSpill:function e(t){var i=t.dragEl,s=t.putSortable;this.sortable.captureAnimationState();if(s){s.captureAnimationState()}var o=Ye(this.sortable.el,this.startIndex,this.options);if(o){this.sortable.el.insertBefore(i,o)}else{this.sortable.el.appendChild(i)}this.sortable.animateAll();if(s){s.animateAll()}},drop:_i};Se(Vi,{pluginName:"revertOnSpill"});function Ri(){}Ri.prototype={onSpill:function e(t){var i=t.dragEl,s=t.putSortable;var o=s||this.sortable;o.captureAnimationState();i.parentNode&&i.parentNode.removeChild(i);o.animateAll()},drop:_i};Se(Ri,{pluginName:"removeOnSpill"});ui.mount(new zi);ui.mount(Ri,Vi);const Ai='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-template-roles{display:block;max-width:600px;font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-template-roles .roles{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:10px;margin-top:10px}verdocs-template-roles .roles .sequence{gap:10px;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;font-weight:500;padding:0 0 8px 0;-ms-flex-direction:row;flex-direction:row;border-bottom:1px dotted #e3e3e3}verdocs-template-roles .roles .sequence.add-sequence{color:#777777;line-height:34px}verdocs-template-roles .roles .sequence-label{font-size:18px;line-height:32px}verdocs-template-roles .roles .sequence-roles{gap:10px;display:-ms-flexbox;display:flex;position:relative;-ms-flex-wrap:wrap;flex-wrap:wrap;-ms-flex-direction:row;flex-direction:row}verdocs-template-roles .roles .role{height:32px;cursor:move;display:-ms-flexbox;display:flex;max-width:200px;position:relative;border-radius:32px;background-color:#eff7fb;-webkit-box-sizing:border-box;box-sizing:border-box;padding:0 14px 0 34px;border:1px solid #ccc;-ms-flex-direction:column;flex-direction:column}verdocs-template-roles .roles .role .role-name{font-size:14px;overflow:hidden;font-weight:400;line-height:30px;white-space:nowrap;text-overflow:ellipsis}verdocs-template-roles .roles .role .icons{position:absolute;left:1px;top:-3px;cursor:pointer;padding:5px;z-index:10}verdocs-template-roles .roles .role .icons .gear-button{display:none;-webkit-transform:scale(1.1);transform:scale(1.1);margin:4px 0 0 1px}verdocs-template-roles .roles .role .icons .type-icon{opacity:0.6;display:block;-webkit-transform:scale(0.8);transform:scale(0.8)}verdocs-template-roles .roles .role .icons:hover .gear-button{display:block}verdocs-template-roles .roles .role .icons:hover .type-icon{display:none}verdocs-template-roles>form{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;background-color:#ffffff;padding:12px}verdocs-template-roles>form h5{font-size:16px;font-weight:bold;color:#46497d;margin:0 0 10px 0}verdocs-template-roles>form label{display:block;font-size:14px;font-weight:500;margin:0 0 4px 0;color:#5c6575}verdocs-template-roles>form input{border:none;font-size:18px;padding:3px 6px 3px 0;background:transparent;border-bottom:1px solid #33364b}verdocs-template-roles>form input:focus{outline:none}verdocs-template-roles .row.add-sequence{display:none}verdocs-template-roles .add-role{opacity:0.3;padding:0 10px;cursor:pointer;background:none;height:32px;border:1px solid #cccccc;border-radius:32px}verdocs-template-roles .add-role:hover{opacity:1}verdocs-template-roles .add-step{margin:0;padding:0;border:none;opacity:0.5;cursor:pointer;background:none}verdocs-template-roles .add-step:hover{opacity:1}verdocs-template-roles .add-step svg{width:32px;height:32px}verdocs-template-roles.dragging .row.add-sequence{display:-ms-flexbox;display:flex}verdocs-template-roles .buttons{display:-ms-flexbox;display:flex;-webkit-column-gap:8px;-moz-column-gap:8px;column-gap:8px;margin-top:16px;-ms-flex-direction:row;flex-direction:row}verdocs-template-roles .empty{font-size:13px;margin-top:15px;margin-bottom:5px}verdocs-template-roles .empty svg{width:16px;height:16px;stroke:#666666;margin-bottom:2px;display:inline-block}verdocs-template-roles .sequence-roles{display:-ms-flexbox;display:flex;max-width:400px}verdocs-template-roles ::-webkit-input-placeholder{color:#aaaaaa}verdocs-template-roles ::-moz-placeholder{color:#aaaaaa}verdocs-template-roles :-ms-input-placeholder{color:#aaaaaa}verdocs-template-roles ::-ms-input-placeholder{color:#aaaaaa}verdocs-template-roles ::placeholder{color:#aaaaaa}';const Ui=Ai;const ji='<svg xmlns="http://www.w3.org/2000/svg" height="20" width="20" fill="#00000089"><path d="m8.021 17.917-.313-2.5q-.27-.125-.625-.334-.354-.208-.625-.395l-2.312.979-1.979-3.438 1.979-1.5q-.021-.167-.031-.364-.011-.198-.011-.365 0-.146.011-.344.01-.198.031-.385l-1.979-1.5 1.979-3.417 2.312.958q.271-.187.615-.385t.635-.344l.313-2.5h3.958l.313 2.5q.312.167.625.344.312.177.604.385l2.333-.958 1.979 3.417-1.979 1.521q.021.187.021.364V10q0 .146-.01.333-.011.188-.011.396l1.958 1.5-1.979 3.438-2.312-.979q-.292.208-.615.395-.323.188-.614.334l-.313 2.5Zm1.937-5.355q1.063 0 1.813-.75t.75-1.812q0-1.062-.75-1.812t-1.813-.75q-1.041 0-1.802.75-.76.75-.76 1.812t.76 1.812q.761.75 1.802.75Zm0-1.333q-.5 0-.864-.364-.365-.365-.365-.865t.365-.865q.364-.364.864-.364t.865.364q.365.365.365.865t-.365.865q-.365.364-.865.364ZM10.021 10Zm-.854 6.583h1.666l.25-2.187q.605-.167 1.136-.49.531-.323 1.031-.802l2.021.875.854-1.375-1.792-1.354q.105-.333.136-.635.031-.303.031-.615 0-.292-.031-.573-.031-.281-.115-.635l1.792-1.396-.834-1.375-2.062.875q-.438-.438-1.021-.781-.583-.344-1.125-.49l-.271-2.208H9.167l-.271 2.208q-.584.146-1.125.458-.542.313-1.042.792l-2.021-.854-.833 1.375 1.75 1.354q-.083.333-.125.646-.042.312-.042.604t.042.594q.042.302.125.635l-1.75 1.375.833 1.375 2.021-.854q.479.458 1.021.771.542.312 1.146.479Z"/></svg>';const Bi=`<svg xmlns="http://www.w3.org/2000/svg" fill="#ffffff" viewBox="0 0 24 24" strokeWidth={1.5} stroke="currentColor"><path strokeLinecap="round" strokeLinejoin="round" d="M12 9v6m3-3H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z" /></svg>`;const Pi='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path d="m9.225 21.225 4.65-4.65h8.45v4.65Zm-5.35-2.2H5.05l8.5-8.5-1.175-1.175-8.5 8.5Zm14.25-9.95L13.8 4.8l1.325-1.325q.625-.65 1.525-.663.9-.012 1.6.663l1.225 1.175q.675.675.663 1.562-.013.888-.663 1.513ZM16.7 10.55 6 21.225H1.675V16.9L12.35 6.225Zm-3.725-.625-.6-.575 1.175 1.175Z"/></svg>';const $i=`<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill-rule="evenodd" d="M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12zm13.36-1.814a.75.75 0 10-1.22-.872l-3.236 4.53L9.53 12.22a.75.75 0 00-1.06 1.06l2.25 2.25a.75.75 0 001.14-.094l3.75-5.25z" clip-rule="evenodd" /></svg>`;const Fi=`<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path d="M1.5 8.67v8.58a3 3 0 003 3h15a3 3 0 003-3V8.67l-8.928 5.493a3 3 0 01-3.144 0L1.5 8.67z" /><path d="M22.5 6.908V6.75a3 3 0 00-3-3h-15a3 3 0 00-3 3v.158l9.714 5.978a1.5 1.5 0 001.572 0L22.5 6.908z" /></svg>`;const Qi=class{constructor(i){e(this,i);this.next=t(this,"next",7);this.exit=t(this,"exit",7);this.sdkError=t(this,"sdkError",7);this.rolesUpdated=t(this,"rolesUpdated",7);this.templateListenerId=null;this.sortableRefs=[];this.endpoint=l.getDefault();this.templateId="";this.showingRoleDialog=null;this.sender=null;this.dragging=false;this.loading=true;this.template=null}disconnectedCallback(){this.unlistenToTemplate();this.cleanupSortables()}async listenToTemplate(){console.log("[ROLES] Loading template",this.templateId);this.unlistenToTemplate();k.subscribe("templates",this.templateId,(()=>r(this.endpoint,this.templateId)),false,(e=>{console.log("[ROLES] Template Updated",e);this.template=e;this.loading=false}))}unlistenToTemplate(){if(this.templateListenerId){k.store.delListener(this.templateListenerId);this.templateListenerId=null}}async componentWillLoad(){var e,t,i;try{this.endpoint.loadSession();if(!this.templateId){console.log(`[ROLES] Missing required template ID ${this.templateId}`);return}if(!this.endpoint.session){console.log("[ROLES] Unable to start builder session, must be authenticated");return}this.listenToTemplate()}catch(s){console.log("[ROLES] Error with preview session",s);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new y(s.message,(t=s.response)===null||t===void 0?void 0:t.status,(i=s.response)===null||i===void 0?void 0:i.data))}}cleanupSortables(){this.sortableRefs.forEach((e=>e.destroy()));this.sortableRefs.length=0}componentDidRender(){this.cleanupSortables();const e=this.getSequenceNumbers();(e||[]).forEach((e=>{const t=document.getElementById(`verdocs-roles-sequence-${e}`);if(t){const e=new ui(t,{group:"roles",animation:150,dragoverBubble:true,filter:".no-drag",onEnd:this.handleMoveEnd.bind(this),onChoose:()=>this.dragging=true,onUnchoose:()=>this.dragging=false});this.sortableRefs.push(e)}}));const t=document.getElementById(`verdocs-roles-sequence-add-target`);if(t){console.log("[ROLES] Applying sortable to add-sequence slot");const e=new ui(t,{group:"roles",animation:150,dragoverBubble:true,filter:".no-drag",onEnd:this.handleMoveEnd.bind(this),onChoose:()=>this.dragging=true,onUnchoose:()=>this.dragging=false});this.sortableRefs.push(e)}}handleMoveEnd(e){const t=+e.from.dataset.sequence;const i=+e.to.dataset.sequence;const s=+e.oldIndex+1;const o=+e.newIndex+1;console.log(`Move from ${t}:${s} to ${i}:${o}`,e.item);const n={};const l=this.getSequenceNumbers();l.forEach((e=>{const t=this.getRolesAtSequence(e);n[String(e)]=JSON.parse(JSON.stringify(t))}));n[l[l.length-1]+1]=[];const r=n[t].splice(s-1,1)[0];n[i]||(n[i]=[]);n[i].splice(o-1,0,r);const a=[];Object.entries(n).forEach((([e,t])=>{t.forEach(((t,i)=>{if(!t){return}const s=+i+1;if(t.sequence!==+e||t.order!==s){t.sequence=+e;t.order=s;a.push(b(this.endpoint,this.templateId,t.name,{sequence:+e,order:s}).then((e=>console.log("[ROLES] Updated role",t.name,e))).catch((e=>console.log("[ROLES] Error updating role",e))))}}))}));return Promise.all(a).then((async()=>console.log("[ROLES] Done renumbering"))).catch((e=>console.log("[ROLES] Error updating roles",e)))}handleCancel(){var e;(e=this.exit)===null||e===void 0?void 0:e.emit()}handleSubmit(){var e;(e=this.next)===null||e===void 0?void 0:e.emit()}getSortedRoles(){var e;return(((e=this.template)===null||e===void 0?void 0:e.roles)||[]).sort(((e,t)=>e.sequence===t.sequence?e.order-t.order:e.sequence-t.sequence))}getSequenceNumbers(){const e={};this.getSortedRoles().forEach((t=>{e[t.sequence]=true}));console.log("[ROLES] Sequences",e);return Object.keys(e).map((e=>+e)).sort(((e,t)=>e-t))}getRoleNames(){const e=this.getSortedRoles();return e.map((e=>e.name))}getRolesAtSequence(e){var t;return(((t=this.template)===null||t===void 0?void 0:t.roles)||[]).filter((t=>t&&t.sequence===e))}async renumberTemplateRoles(){var e;const t={};const i=[];const s=this.getSequenceNumbers();(s||[]).forEach((e=>{(t[e]||[]).forEach(((t,s)=>{const o=+s+1;if(t.sequence!==+e||t.order!==o){console.log("[ROLES] Updating role",t.name,"from",t.sequence,t.order,"to",e,o);t.sequence=+e;t.order=o;i.push(b(this.endpoint,this.templateId,t.name,{sequence:+e,order:o}).then((e=>console.log("[ROLES] Updated role",t.name,e))).catch((e=>console.log("[ROLES] Error updating role",e))))}}))}));console.log(`[ROLES] Awaiting ${i.length} renumber requests`);await Promise.all(i).then((async()=>{const e=JSON.parse(JSON.stringify(this.template));e.roles=Object.keys(t).reduce(((e,i)=>e.concat(t[i])),[]);console.log("[ROLES] Done renumbering",e.roles.map((e=>({name:e.name,sequence:e.sequence,order:e.order}))));k.updateTemplate(this.templateId,e)}));(e=this.rolesUpdated)===null||e===void 0?void 0:e.emit({event:"updated",endpoint:this.endpoint,templateId:this.templateId,roles:this.getSortedRoles()})}getNextRoleName(){var e,t;let i="";let s=(((e=this.template)===null||e===void 0?void 0:e.roles)||[]).length;do{s++;i=`Recipient ${s}`}while(!i||(((t=this.template)===null||t===void 0?void 0:t.roles)||[]).some((e=>e&&e.name===i)));return i}callCreateRole(e,t,i){console.log("[ROLES] Will create role",{name:e,sequence:t,order:i});x(this.endpoint,this.templateId,{template_id:this.templateId,name:e,sequence:t,message:"",order:i,full_name:null,first_name:"",last_name:"",email:"",phone:"",type:"signer",delegator:false,kba_method:null}).then((async e=>{var t;console.log("[ROLES] Created role",e);console.log("Updating template in data store");await k.getTemplate(this.endpoint,this.templateId,true);(t=this.rolesUpdated)===null||t===void 0?void 0:t.emit({event:"added",endpoint:this.endpoint,templateId:this.templateId,roles:this.getSortedRoles()})})).catch((e=>{console.log("[ROLES] Error creating role",e)}))}handleAddRole(e,t){e.stopPropagation();const i=this.getRolesAtSequence(t).length+1;const s=this.getNextRoleName();this.callCreateRole(s,t,i)}handleAddStep(e,t){e.stopPropagation();const i=1;const s=this.getNextRoleName();this.callCreateRole(s,t,i)}render(){if(!this.endpoint.session){return i(s,null,i("verdocs-component-error",{message:"You must be authenticated to use this module."}))}if(this.loading||!this.template){return i(s,{class:"loading"},i("verdocs-loader",null))}const e=this.getRoleNames();const t=this.getSequenceNumbers();const o=t&&t.length>0?(t[t.length-1]||0)+1:1;console.log("[ROLES] Rendering",{roleNames:e,sequences:t,nextSequence:o});return i(s,{class:{dragging:this.dragging}},i("form",{onSubmit:e=>e.preventDefault(),onClick:e=>e.stopPropagation(),autocomplete:"off"},i("h5",null,"Roles and Workflow"),i("div",{class:"roles"},t.map(((e,t)=>i("div",{class:"sequence"},i("div",{class:"sequence-label no-drag"},t+1,"."),i("div",{class:"sequence-roles",id:`verdocs-roles-sequence-${e}`,"data-sequence":e},this.getRolesAtSequence(e).map((t=>{const s=!t.email||!t.first_name||!t.last_name;return s?i("div",{class:"role","data-rolename":t.name,"data-sequence":e,"data-order":t.order},i("div",{class:"role-name"},t.name),i("div",{class:"icons"},i("div",{class:"gear-button",innerHTML:ji,onClick:()=>this.showingRoleDialog=t.name,"aria-role":"button"}),i("span",{class:"type-icon",innerHTML:t.type==="signer"?Pi:t.type==="cc"?Fi:$i}))):i("div",{class:"role","data-rolename":t.name,"data-sequence":e,"data-order":t.order},i("div",{class:"role-name"},u(t)),i("div",{class:"icons"},i("div",{class:"gear-button",innerHTML:ji,onClick:()=>this.showingRoleDialog=t.name,"aria-role":"button"}),i("span",{class:"type-icon",innerHTML:t.type==="signer"?Pi:t.type==="cc"?Fi:$i})))}))),i("button",{class:"add-role no-drag",onClick:t=>this.handleAddRole(t,e)},"+ Add Role")))),i("div",{class:"sequence add-sequence"},i("div",{class:"sequence-label no-drag"},t.length+1,"."),i("div",{class:"sequence-roles",id:`verdocs-roles-sequence-add-target`,"data-sequence":o}),i("button",{class:"add-role no-drag",onClick:e=>this.handleAddRole(e,o)},"+ Add Role"))),e.length<1&&i("div",{class:"empty"},"You must add at least one Role before proceeding.",i("br",null)," Click the ",i("span",{innerHTML:Bi})," Add button above to get started."),i("div",{class:"buttons"},i("div",{class:"flex-fill"}),i("verdocs-button",{variant:"outline",label:"Cancel",size:"small",onClick:()=>this.handleCancel()}),i("verdocs-button",{label:"OK",size:"small",onClick:()=>this.handleSubmit(),disabled:e.length<1}))),this.showingRoleDialog&&i("verdocs-menu-panel",{onClose:()=>this.showingRoleDialog=null},i("verdocs-template-role-properties",{endpoint:this.endpoint,templateId:this.templateId,roleName:this.showingRoleDialog,onClose:()=>{var e;(e=document.getElementById("verdocs-menu-panel-overlay"))===null||e===void 0?void 0:e.remove();this.showingRoleDialog=null},onDelete:async()=>{var e;this.showingRoleDialog=null;await this.renumberTemplateRoles();(e=this.rolesUpdated)===null||e===void 0?void 0:e.emit({event:"deleted",endpoint:this.endpoint,templateId:this.templateId,roles:this.getSortedRoles()})}})))}get el(){return n(this)}};Qi.style=Ui;const Wi='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-template-settings{display:block;max-width:600px;font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-template-settings>form{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;background-color:#ffffff;padding:12px}verdocs-template-settings>form h5{font-size:16px;font-weight:bold;color:#46497d;margin:0 0 10px 0}verdocs-template-settings>form label{display:block;font-size:14px;font-weight:500;margin:0 0 4px 0;color:#5c6575}verdocs-template-settings>form input{border:none;font-size:18px;padding:3px 6px 3px 0;background:transparent;border-bottom:1px solid #33364b}verdocs-template-settings>form input:focus{outline:none}verdocs-template-settings>form .row{margin:20px 0 0 0}verdocs-template-settings .buttons{display:-ms-flexbox;display:flex;-webkit-column-gap:8px;-moz-column-gap:8px;column-gap:8px;margin-top:16px;-ms-flex-direction:row;flex-direction:row}verdocs-template-settings ::-webkit-input-placeholder{color:#aaaaaa}verdocs-template-settings ::-moz-placeholder{color:#aaaaaa}verdocs-template-settings :-ms-input-placeholder{color:#aaaaaa}verdocs-template-settings ::-ms-input-placeholder{color:#aaaaaa}verdocs-template-settings ::placeholder{color:#aaaaaa}';const Yi=Wi;const Gi=24*60*60*1e3;const Ji=class{constructor(i){e(this,i);this.next=t(this,"next",7);this.exit=t(this,"exit",7);this.sdkError=t(this,"sdkError",7);this.templateUpdated=t(this,"templateUpdated",7);this.templateListenerId=null;this.endpoint=l.getDefault();this.templateId="";this.name=null;this.visibility="private";this.sender="envelope_creator";this.sendReminders=false;this.initialReminder=0;this.followupReminders=0;this.dirty=false;this.loading=true;this.template=null}disconnectedCallback(){this.unlistenToTemplate()}async listenToTemplate(){console.log("[SETTINGS] Loading template",this.templateId);this.unlistenToTemplate();k.subscribe("templates",this.templateId,(()=>r(this.endpoint,this.templateId)),false,(e=>{console.log("[SETTINGS] Template Updated",e);this.template=e;this.name=e.name;this.visibility=e.visibility;this.sender=e.sender;this.sendReminders=e.initial_reminder!==null;this.initialReminder=e.initial_reminder?Math.floor(e.initial_reminder/Gi):null;this.followupReminders=e.followup_reminders?Math.floor(e.followup_reminders/Gi):null;this.dirty=false;this.loading=false}))}unlistenToTemplate(){if(this.templateListenerId){k.store.delListener(this.templateListenerId);this.templateListenerId=null}}async componentWillLoad(){var e,t,i;try{this.endpoint.loadSession();if(!this.templateId){console.log(`[SETTINGS] Missing required template ID ${this.templateId}`);return}if(!this.endpoint.session){console.log("[SETTINGS] Unable to start builder session, must be authenticated");return}this.listenToTemplate()}catch(s){console.log("[SETTINGS] Error with preview session",s);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new y(s.message,(t=s.response)===null||t===void 0?void 0:t.status,(i=s.response)===null||i===void 0?void 0:i.data))}}handleCancel(){var e;(e=this.exit)===null||e===void 0?void 0:e.emit()}handleSubmit(){w(this.endpoint,this.templateId,{name:this.name,visibility:this.visibility,sender:this.sender,initial_reminder:this.sendReminders?this.initialReminder*Gi:null,followup_reminders:this.sendReminders?this.followupReminders*Gi:null}).then((e=>{var t,i;console.log("[SETTINGS] Template Updated",e);this.dirty=false;this.name=e.name;this.visibility=e.visibility;this.sender=e.sender;this.sendReminders=e.initial_reminder!==null;this.initialReminder=e.initial_reminder?Math.floor(e.initial_reminder/Gi):null;this.followupReminders=e.followup_reminders?Math.floor(e.followup_reminders/Gi):null;(t=this.templateUpdated)===null||t===void 0?void 0:t.emit({endpoint:this.endpoint,template:e,event:"update"});(i=this.next)===null||i===void 0?void 0:i.emit()})).catch((e=>{var t,i,s,o,n;console.log("[SETTINGS] Error updating template",e);(t=this.sdkError)===null||t===void 0?void 0:t.emit(new y(e.message,(i=e.response)===null||i===void 0?void 0:i.status,(s=e.response)===null||s===void 0?void 0:s.data));E(((n=(o=e.response)===null||o===void 0?void 0:o.data)===null||n===void 0?void 0:n.error)||"Error updating template, please try again later.")}))}render(){if(!this.endpoint.session){return i(s,null,i("verdocs-component-error",{message:"You must be authenticated to use this module."}))}if(this.loading||!this.template){return i(s,{class:"loading"},i("verdocs-loader",null))}return i(s,null,i("form",{onSubmit:e=>e.preventDefault(),onClick:e=>e.stopPropagation(),autocomplete:"off"},i("h5",null,"Settings"),i("div",{class:"row"},i("verdocs-text-input",{id:"verdocs-field-name",label:"Template Name",value:this.name,autocomplete:"off",placeholder:"Template Name...",onInput:e=>{this.name=e.target.value;this.dirty=true}})),i("div",{class:"row"},i("verdocs-select-input",{label:"Visibility",value:this.visibility,onInput:e=>{this.visibility=e.target.value;this.dirty=true},options:[{value:"private",label:"Private"},{value:"shared",label:"Shared"},{value:"public",label:"Public"}]})),i("div",{class:"row"},i("verdocs-select-input",{label:"Owner for envelopes created from this template",value:this.sender,onInput:e=>{this.sender=e.target.value;this.dirty=true},options:[{value:"envelope_creator",label:"Envelope Creator"},{value:"template_owner",label:"Template Owner"}]})),i("div",{class:"row"},i("label",null,"Send Reminders"),i("verdocs-switch",{checked:this.sendReminders,onCheckedChange:e=>this.sendReminders=e.detail})),this.sendReminders&&i("div",{class:"row"},i("verdocs-text-input",{id:"verdocs-field-name",label:"First Reminder (days)",value:String(this.initialReminder||0),autocomplete:"off",placeholder:"Delay in days...",onInput:e=>{this.initialReminder=+e.target.value;this.dirty=true}})),this.sendReminders&&i("div",{class:"row"},i("verdocs-text-input",{id:"verdocs-field-name",label:"Follow-up Reminders (days)",value:String(this.followupReminders||0),autocomplete:"off",placeholder:"Delay in days...",onInput:e=>{this.followupReminders=+e.target.value;this.dirty=true}})),i("div",{class:"buttons"},i("verdocs-button",{variant:"outline",label:"Cancel",size:"small",onClick:()=>this.handleCancel()}),i("verdocs-button",{label:"Save",size:"small",onClick:()=>this.handleSubmit(),disabled:!this.dirty}))))}get el(){return n(this)}};Ji.style=Yi;export{U as verdocs_preview,G as verdocs_send,K as verdocs_template_attachments,ne as verdocs_template_build_tabs,xe as verdocs_template_fields,Qi as verdocs_template_roles,Ji as verdocs_template_settings};
8
+ //# sourceMappingURL=p-060dbde7.entry.js.map