@verdocs/web-sdk 5.0.32 → 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} +145 -14
  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 +8 -13
  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-449f2b47.js → p-4c5164d0.js} +9 -14
  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} +146 -16
  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-449f2b47.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-0666fb5d.system.entry.js +0 -8
  99. package/dist/verdocs-web-sdk/p-0666fb5d.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-b9fee1a7.entry.js +0 -2
  102. package/dist/verdocs-web-sdk/p-b9fee1a7.entry.js.map +0 -1
  103. package/dist/verdocs-web-sdk/p-cabfdb9d.system.entry.js.map +0 -1
  104. package/dist/verdocs-web-sdk/p-e3efeb57.system.entry.js +0 -2
  105. package/dist/verdocs-web-sdk/p-e3efeb57.system.entry.js.map +0 -1
  106. package/dist/verdocs-web-sdk/p-f81f766c.entry.js +0 -8
  107. package/dist/verdocs-web-sdk/p-f81f766c.entry.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"names":["verdocsBuildCss","VerdocsBuildStyle0","VerdocsBuild","this","templateListenerId","VerdocsEndpoint","getDefault","onTemplateIdChanged","newTemplateId","oldTemplateId","step","loadTemplate","catch","e","console","log","onStepChanged","templateId","componentWillLoad","endpoint","loadSession","session","_a","sdkError","emit","SDKError","message","_b","response","status","_c","data","_d","_e","_f","Store","subscribe","getTemplate","template","loading","disconnectedCallback","unlistenToTemplate","store","delListener","handleCancel","handleTemplateCreated","stepChanged","handleRolesUpdated","templateUpdated","detail","handleTemplateUpdated","handleAttachmentsNext","handleRolesNext","handleStepChanged","render","h","Host","class","onSdkError","onExit","onNext","onTemplateUpdated","onRolesUpdated","style","flexDirection","gap","display","maxWidth","margin","backgroundColor","padding","onSend","send","width","flex"],"sources":["src/components/embeds/verdocs-build/verdocs-build.scss?tag=verdocs-build","src/components/embeds/verdocs-build/verdocs-build.tsx"],"sourcesContent":["@import '../../../theme.scss';\n\nverdocs-build {\n display: flex;\n flex-direction: column;\n font-family: $verdocs-primary-font;\n\n .content {\n flex: 1;\n gap: 20px;\n display: flex;\n align-items: center;\n flex-direction: column;\n //box-shadow: 0 0 7px -3px #000000cc;\n }\n\n verdocs-template-attachments,\n verdocs-template-roles {\n margin: 20px;\n }\n\n verdocs-template-fields {\n border-top: 1px solid #777777;\n }\n\n verdocs-template-attachments {\n padding: 20px;\n background: #ffffff;\n }\n\n verdocs-template-fields {\n width: 100%;\n }\n\n verdocs-preview {\n flex: 1;\n }\n\n .preview-container {\n flex-direction: row;\n display: flex;\n width: 100%;\n background-color: #eeeeee;\n max-height: 100%;\n\n @media all and (max-width: 450px) {\n flex-direction: column;\n }\n }\n\n .preview-send-wrapper {\n display: flex;\n flex: 0 0 300px;\n background-color: #ffffff;\n box-shadow: 1px 1px 6px -2px #0000007f;\n\n @media all and (max-width: 450px) {\n flex: 0;\n }\n }\n\n .preview-preview-wrapper {\n display: flex;\n flex: 1;\n justify-content: center;\n overflow-y: scroll;\n }\n}\n","import {getTemplate, ICreateEnvelopeRecipient, IRole, ITemplate, VerdocsEndpoint} from '@verdocs/js-sdk';\nimport {Component, Prop, h, Element, Event, EventEmitter, Host, Watch, State} from '@stencil/core';\nimport {SDKError} from '../../../utils/errors';\nimport {Store} from '../../../utils/Datastore';\n\nexport type TVerdocsBuildStep = 'attachments' | 'roles' | 'settings' | 'fields' | 'preview';\n\n/**\n * Display a template building experience. Several event callbacks provide status updates to the\n * parent application to support interface updates.\n *\n * ```ts\n * <verdocs-build templateId={templateId} step=\"preview\" onSend={(detail) => {\n * console.log('Sent envelope from template', detail);\n * }} />\n * ```\n */\n@Component({\n tag: 'verdocs-build',\n styleUrl: 'verdocs-build.scss',\n shadow: false,\n})\nexport class VerdocsBuild {\n private templateListenerId = null;\n\n @Element() el!: any;\n\n /**\n * The endpoint to use to communicate with Verdocs. If not set, the default endpoint will be used.\n */\n @Prop() endpoint: VerdocsEndpoint = VerdocsEndpoint.getDefault();\n\n /**\n * The ID of the template to create the document from. Unlike most other components, this is an optional parameter here.\n * If the template ID is known, `step` may also be specified to force displaying a specific step in the creation process.\n * If it is not specified, `step` will be ignored and the create step will be shown.\n */\n @Prop({reflect: true, mutable: true}) templateId: string | null = null;\n\n /**\n * The step in the creation process to display.\n */\n @Prop({reflect: true, mutable: true}) step: TVerdocsBuildStep = 'preview';\n\n /**\n * Event fired if an error occurs. The event details will contain information about the error. Most errors will\n * terminate the process, and the calling application should correct the condition and re-render the component.\n */\n @Event({composed: true}) sdkError: EventEmitter<SDKError>;\n\n /**\n * Event fired when the user selects a different step.\n */\n @Event({composed: true}) stepChanged: EventEmitter<TVerdocsBuildStep>;\n\n /**\n * The user completed the Send form and clicked send.\n */\n @Event({composed: true}) send: EventEmitter<{recipients: ICreateEnvelopeRecipient[]; name: string; template_id: string}>;\n\n /**\n * Event fired when the template is updated in any way. May be used for tasks such as cache invalidation or reporting to other systems.\n */\n @Event({composed: true}) templateUpdated: EventEmitter<{endpoint: VerdocsEndpoint; template: ITemplate; event: string}>;\n\n /**\n * Event fired when the template is created by the upload step.\n */\n @Event({composed: true}) templateCreated: EventEmitter<{endpoint: VerdocsEndpoint; template: ITemplate; event: string}>;\n\n /**\n * Event fired when roles are updated in the roles step.\n */\n @Event({composed: true}) rolesUpdated: EventEmitter<{endpoint: VerdocsEndpoint; templateId: string; event: 'added' | 'deleted' | 'updated'; roles: IRole[]}>;\n\n @State() loading = true;\n @State() template: ITemplate | null = null;\n\n @Watch('templateId')\n onTemplateIdChanged(newTemplateId: string, oldTemplateId: string) {\n if (!oldTemplateId && newTemplateId && this.step === 'attachments') {\n this.step = 'preview';\n }\n\n this.loadTemplate(newTemplateId).catch((e: any) => console.log('Unknown Error', e));\n }\n\n @Watch('step')\n onStepChanged() {\n // We reload the template here even if only the step changed in case\n // we were out of sync before\n this.loadTemplate(this.templateId).catch((e: any) => console.log('Unknown Error', e));\n }\n\n async componentWillLoad() {\n try {\n this.endpoint.loadSession();\n if (!this.endpoint.session) {\n console.log('[BUILD] Unable to start builder session, must be authenticated');\n return;\n }\n\n if (!this.templateId) {\n console.log(`[BUILD] No template ID, activating upload mode`);\n this.step = 'attachments';\n return;\n }\n\n try {\n this.loadTemplate(this.templateId).catch(e => console.log('[BUILD] Unable to load template', e));\n } catch (e) {\n console.log('[BUILD] Error loading template', e);\n this.sdkError?.emit(new SDKError(e.message, e.response?.status, e.response?.data));\n }\n } catch (e) {\n console.log('[BUILD] Error with builder session', e);\n this.sdkError?.emit(new SDKError(e.message, e.response?.status, e.response?.data));\n }\n }\n\n async loadTemplate(templateId: string) {\n if (templateId) {\n Store.subscribe(\n 'templates',\n this.templateId,\n () => getTemplate(this.endpoint, this.templateId),\n false,\n (template: ITemplate) => {\n this.template = template;\n this.loading = false;\n },\n );\n }\n }\n\n disconnectedCallback() {\n console.log('[BUILD] Disconnected');\n this.unlistenToTemplate();\n }\n\n unlistenToTemplate() {\n if (this.templateListenerId) {\n Store.store.delListener(this.templateListenerId);\n this.templateListenerId = null;\n }\n }\n\n handleCancel() {\n this.step = 'preview';\n }\n\n async handleTemplateCreated(templateId: string) {\n await this.loadTemplate(templateId);\n this.templateId = templateId;\n this.step = 'roles';\n this.stepChanged?.emit('roles');\n }\n\n async handleRolesUpdated(e: any) {\n this.templateUpdated?.emit(e.detail);\n }\n\n async handleTemplateUpdated(e: any) {\n this.templateUpdated?.emit(e.detail);\n }\n\n handleAttachmentsNext() {\n this.step = 'roles';\n this.stepChanged?.emit('roles');\n }\n\n handleRolesNext() {\n this.step = 'fields';\n this.stepChanged?.emit('fields');\n }\n\n handleStepChanged(step: TVerdocsBuildStep) {\n this.step = step;\n this.stepChanged?.emit(step);\n }\n\n render() {\n if (this.loading) {\n return (\n <Host class=\"loading\">\n <verdocs-loader />\n </Host>\n );\n }\n\n if (!this.endpoint.session) {\n return (\n <Host>\n <verdocs-component-error message=\"You must be authenticated to use this module.\" />\n </Host>\n );\n }\n\n return (\n <Host>\n <div class=\"content\">\n <verdocs-template-build-tabs\n endpoint={this.endpoint}\n templateId={this.templateId}\n step={this.step}\n onSdkError={e => this.sdkError?.emit(e.detail)}\n onStepChanged={e => this.handleStepChanged(e.detail)}\n />\n\n {this.step === 'attachments' && (\n <verdocs-template-attachments\n templateId={this.templateId}\n endpoint={this.endpoint}\n onExit={() => this.handleCancel()}\n onNext={() => this.handleAttachmentsNext()}\n onTemplateUpdated={e => this.handleTemplateUpdated(e)}\n />\n )}\n\n {this.step === 'roles' && (\n <verdocs-template-roles\n templateId={this.templateId}\n endpoint={this.endpoint}\n onExit={() => this.handleCancel()}\n onNext={() => this.handleRolesNext()}\n onRolesUpdated={e => this.handleRolesUpdated(e)}\n />\n )}\n\n {this.step === 'settings' && (\n <div style={{flexDirection: 'column', gap: '20px', display: 'flex', maxWidth: '400px', margin: '20px'}}>\n <verdocs-template-name\n templateId={this.templateId}\n endpoint={this.endpoint}\n style={{backgroundColor: '#ffffff', padding: '20px'}}\n onTemplateUpdated={e => this.handleTemplateUpdated(e)}\n />\n <verdocs-template-reminders\n templateId={this.templateId}\n endpoint={this.endpoint}\n style={{backgroundColor: '#ffffff', padding: '20px'}}\n onTemplateUpdated={e => this.handleTemplateUpdated(e)}\n />\n <verdocs-template-visibility\n templateId={this.templateId}\n endpoint={this.endpoint}\n style={{backgroundColor: '#ffffff', padding: '20px'}}\n onTemplateUpdated={e => this.handleTemplateUpdated(e)}\n />\n </div>\n )}\n\n {this.step === 'fields' && <verdocs-template-fields templateId={this.templateId} endpoint={this.endpoint} onTemplateUpdated={e => this.handleTemplateUpdated(e)} />}\n\n {this.step === 'preview' && (\n <div class=\"preview-container\">\n <div class=\"preview-send-wrapper\">\n <verdocs-send templateId={this.templateId} endpoint={this.endpoint} onSend={e => this.send?.emit(e.detail)} style={{width: '100%'}} />\n </div>\n <div class=\"preview-preview-wrapper\">\n <verdocs-preview templateId={this.templateId} endpoint={this.endpoint} style={{display: 'flex', flex: '1', maxWidth: '1000px'}} />\n </div>\n </div>\n )}\n </div>\n </Host>\n );\n }\n}\n"],"mappings":"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","ignoreList":[]}
@@ -1,2 +0,0 @@
1
- import{r as e,c as i,h as t,H as r}from"./p-b9654a5e.js";import{VerdocsEndpoint as o,getEnvelope as s,getInPersonLink as n,formatFullName as l}from"@verdocs/js-sdk";import{V as c}from"./p-04c07b7b.js";import{S as a}from"./p-fd97809c.js";import{S as d}from"./p-d4be87ef.js";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-envelope-recipient-link{top:0;left:0;right:0;bottom:0;display:-ms-flexbox;display:flex;z-index:100000;position:fixed;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;font-family:"Inter", "Barlow", sans-serif;background-color:rgba(0, 0, 0, 0.4980392157)}verdocs-envelope-recipient-link .summary-content{width:600px;display:-ms-flexbox;display:flex;max-width:90%;font-size:18px;-ms-flex:0 0 600px;flex:0 0 600px;border-radius:6px;background:#ffffff;-ms-flex-direction:column;flex-direction:column;padding:30px 20px 20px}verdocs-envelope-recipient-link .summary-content .summary-title{font-size:20px;font-weight:700;margin:0 0 10px 0;color:#33364b}verdocs-envelope-recipient-link .summary-recipient{display:-ms-flexbox;display:flex;color:#33364b;margin:8px 0 24px 0;-ms-flex-direction:column;flex-direction:column}verdocs-envelope-recipient-link .summary-recipient .role-name{-ms-flex:1;flex:1;display:-ms-flexbox;display:flex;font-size:14px;font-weight:600;margin:0 0 8px 0;color:#092c4c}verdocs-envelope-recipient-link .summary-recipient .role-info{gap:5px;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:end;align-items:flex-end}verdocs-envelope-recipient-link .summary-recipient .role-full-name{-ms-flex:1;flex:1;height:34px;display:-ms-flexbox;display:flex;font-size:16px;padding:0 12px;border-radius:4px;-ms-flex-align:center;align-items:center;border:1px solid #cccccc;background:rgb(249, 250, 251)}verdocs-envelope-recipient-link .summary-recipient .recipient-link{width:120px;padding:0 16px;font-weight:500;margin:0 0 0 8px;text-align:center;font-size:0.875rem;border-radius:100%;color:rgb(55, 65, 81);line-height:1.25rem;background-color:#d8d8d8;border:2px solid rgb(156, 163, 175)}verdocs-envelope-recipient-link .summary-recipient .link-wrapper{gap:5px;display:-ms-flexbox;display:flex;margin:4px 0 0 0;-ms-flex-direction:row;flex-direction:row}verdocs-envelope-recipient-link .summary-recipient .link-wrapper .link{-ms-flex:1;flex:1;height:34px;display:-ms-flexbox;display:flex;font-size:16px;padding:0 12px;overflow:hidden;margin:0 6px 0 0;border-radius:4px;white-space:nowrap;-ms-flex-align:center;align-items:center;text-overflow:ellipsis;border:1px solid #cccccc;background:rgb(249, 250, 251)}verdocs-envelope-recipient-link .buttons{display:-ms-flexbox;display:flex;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;margin:10px 0 0 0;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}verdocs-envelope-recipient-link .buttons verdocs-button{-ms-flex:0 0 120px;flex:0 0 120px;margin-left:10px;white-space:nowrap}verdocs-envelope-recipient-link .buttons verdocs-button button{width:100%}';const h=p;const b=class{constructor(t){e(this,t);this.next=i(this,"next",7);this.sdkError=i(this,"sdkError",7);this.envelopeListenerId=null;this.endpoint=o.getDefault();this.envelopeId="";this.roleName="";this.isOpen=undefined;this.gettingLink=true;this.link="";this.loading=true;this.envelope=null;this.recipient=null}async componentWillLoad(){var e,i,t;try{this.endpoint.loadSession();if(!this.envelopeId){console.log(`[RECIPIENT_LINK] Missing required envelope ID ${this.envelopeId}`);return}if(!this.endpoint.session){console.log("[RECIPIENT_LINK] Unable to start session, must be authenticated");return}this.listenToEnvelope()}catch(r){console.log("[RECIPIENT_LINK] Error loading envelope",r);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new a(r.message,(i=r.response)===null||i===void 0?void 0:i.status,(t=r.response)===null||t===void 0?void 0:t.data))}}disconnectedCallback(){this.unlistenToEnvelope()}async listenToEnvelope(){console.log("[SIDEBAR] Loading envelope",this.envelopeId);this.unlistenToEnvelope();d.subscribe("envelopes",this.envelopeId,(()=>s(this.endpoint,this.envelopeId)),false,(e=>{var i;this.envelope=e;this.loading=false;this.recipient=(((i=this.envelope)===null||i===void 0?void 0:i.recipients)||[]).find((e=>e.role_name===this.roleName));this.getLink(this.recipient)}))}unlistenToEnvelope(){if(this.envelopeListenerId){d.store.delListener(this.envelopeListenerId);this.envelopeListenerId=null}}handleDone(e){var i;e.preventDefault();(i=this.next)===null||i===void 0?void 0:i.emit({envelope:this.envelope})}copyLink(e){navigator.clipboard.writeText(e).then((()=>c("Link copied to clipboard!",{style:"success",duration:3e3}))).catch((e=>{console.warn("[RECIPIENT_LINK] Error copying to clipboard",e);c(`Unable to copy to clipboard: ${e.message}`,{style:"error"})}))}getLink(e){this.gettingLink=true;n(this.endpoint,e.envelope_id,e.role_name).then((e=>{this.gettingLink=false;this.link=e.link})).catch((e=>{this.gettingLink=false;console.log("[RECIPIENT_LINK] Error getting link",e);c("Unable to get link: "+e.message,{style:"error"})}))}render(){if(this.loading||!this.recipient){return t(r,null)}const e=l(this.recipient);return t(r,null,t("div",{class:"summary-content"},t("h1",{class:"summary-title"},"In-Person Signing Link"),t("div",{class:"summary-rows"},t("div",{class:"summary-recipient"},t("div",{class:"role-name"},this.recipient.role_name),t("div",{class:"role-details"},t("div",{class:"role-info"},t("div",{class:"role-full-name"},e," (",this.recipient.email||this.recipient.phone,")"),!this.link&&t("verdocs-button",{size:"small",variant:"outline",label:this.gettingLink?"Loading...":"Get Link",disabled:this.gettingLink,onClick:()=>this.getLink(this.recipient)})),this.link&&t("div",{class:"link-wrapper"},t("div",{class:"link"},this.link),t("verdocs-button",{size:"small",variant:"outline",label:"Copy",onClick:()=>this.copyLink(this.link)}))))),t("div",{class:"buttons"},t("verdocs-button",{size:"small",label:"Done",onClick:e=>this.handleDone(e)}))))}};b.style=h;const f='@-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-switch{font-family:"Inter", "Barlow", sans-serif}verdocs-switch .switch{display:-ms-inline-flexbox;display:inline-flex;height:24px;width:44px;-ms-flex-negative:0;flex-shrink:0;-ms-flex-align:center;align-items:center;cursor:pointer;border-radius:12px;border:transparent;-webkit-transition-property:color, background-color, border-color, fill, stroke, -webkit-text-decoration-color;transition-property:color, background-color, border-color, fill, stroke, -webkit-text-decoration-color;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, -webkit-text-decoration-color;-webkit-transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);-webkit-transition-duration:150ms;transition-duration:150ms}verdocs-switch .switch.primary[data-state=checked]{background:#55bc81}verdocs-switch .switch.primary[data-state=unchecked]{background:#e3e3e3}verdocs-switch .switch.secondary[data-state=checked]{background:#4c56cb}verdocs-switch .switch.secondary[data-state=unchecked]{background:#e3e3e3}verdocs-switch .slider{display:block;width:20px;height:20px;border-radius:20px;background:#ffffff;-webkit-box-shadow:0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);box-shadow:0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);-webkit-transition-property:-webkit-transform;transition-property:-webkit-transform;transition-property:transform;transition-property:transform, -webkit-transform;-webkit-transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);-webkit-transition-duration:150ms;transition-duration:150ms}verdocs-switch .slider[data-state=checked]{-webkit-transform:translateX(22px);transform:translateX(22px)}verdocs-switch .slider[data-state=unchecked]{-webkit-transform:translateX(2px);transform:translateX(2px)}verdocs-switch .switch.disabled.primary,verdocs-switch .switch.disabled.secondary{cursor:not-allowed;background:#666666}';const x=f;const m=class{constructor(t){e(this,t);this.checkedChange=i(this,"checkedChange",7);this.checked=false;this.theme="primary";this.disabled=false}render(){return t("button",{key:"e9153549bcee6b924ce7a7d620d1096fa91782d2",value:"on",type:"button",role:"switch",class:`switch ${this.theme} ${this.disabled?"disabled":""}`,"data-state":this.checked?"checked":"unchecked","aria-checked":this.checked?"checked":"unchecked",onClick:()=>{var e;if(!this.disabled){this.checked=!this.checked;(e=this.checkedChange)===null||e===void 0?void 0:e.emit(this.checked)}}},t("span",{key:"61d97d7571b7f52f186ce44daaf0ef7132c6d5f6","data-state":this.checked?"checked":"unchecked",class:"slider"}))}};m.style=x;export{b as verdocs_envelope_recipient_link,m as verdocs_switch};
2
- //# sourceMappingURL=p-b9fee1a7.entry.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["verdocsEnvelopeRecipientLinkCss","VerdocsEnvelopeRecipientLinkStyle0","VerdocsEnvelopeRecipientLink","this","envelopeListenerId","VerdocsEndpoint","getDefault","componentWillLoad","endpoint","loadSession","envelopeId","console","log","session","listenToEnvelope","e","_a","sdkError","emit","SDKError","message","_b","response","status","_c","data","disconnectedCallback","unlistenToEnvelope","Store","subscribe","getEnvelope","envelope","loading","recipient","recipients","find","r","role_name","roleName","getLink","store","delListener","handleDone","preventDefault","next","copyLink","link","navigator","clipboard","writeText","then","VerdocsToast","style","duration","catch","warn","gettingLink","getInPersonLink","envelope_id","render","h","Host","fullName","formatFullName","class","email","phone","size","variant","label","disabled","onClick","verdocsSwitchCss","VerdocsSwitchStyle0","VerdocsSwitch","key","value","type","role","theme","checked","checkedChange"],"sources":["src/components/envelopes/verdocs-envelope-recipient-link/verdocs-envelope-recipient-link.scss?tag=verdocs-envelope-recipient-link","src/components/envelopes/verdocs-envelope-recipient-link/verdocs-envelope-recipient-link.tsx","src/components/controls/verdocs-switch/verdocs-switch.scss?tag=verdocs-switch","src/components/controls/verdocs-switch/verdocs-switch.tsx"],"sourcesContent":["@import '../../../theme.scss';\n\nverdocs-envelope-recipient-link {\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n display: flex;\n z-index: 100000;\n position: fixed;\n align-items: center;\n justify-content: center;\n font-family: $primary-font;\n background-color: #0000007f;\n\n .summary-content {\n width: 600px;\n display: flex;\n max-width: 90%;\n font-size: 18px;\n flex: 0 0 600px;\n border-radius: 6px;\n background: #ffffff;\n flex-direction: column;\n padding: 30px 20px 20px;\n\n .summary-title {\n font-size: 20px;\n font-weight: 700;\n margin: 0 0 10px 0;\n color: $verdocs-dark-blue;\n }\n }\n\n .summary-recipient {\n display: flex;\n color: $verdocs-grey-1;\n margin: 8px 0 24px 0;\n flex-direction: column;\n\n .role-name {\n flex: 1;\n display: flex;\n font-size: 14px;\n font-weight: 600;\n margin: 0 0 8px 0;\n color: $verdocs-grey-0;\n }\n\n .role-details {\n }\n\n .role-info {\n gap: 5px;\n display: flex;\n flex-direction: row;\n align-items: flex-end;\n }\n\n .role-full-name {\n flex: 1;\n height: 34px;\n display: flex;\n font-size: 16px;\n padding: 0 12px;\n border-radius: 4px;\n align-items: center;\n border: 1px solid #cccccc;\n background: rgb(249, 250, 251);\n }\n\n .recipient-link {\n width: 120px;\n padding: 0 16px;\n font-weight: 500;\n margin: 0 0 0 8px;\n text-align: center;\n font-size: 0.875rem;\n border-radius: 100%;\n color: rgb(55, 65, 81);\n line-height: 1.25rem;\n background-color: #d8d8d8;\n border: 2px solid rgb(156, 163, 175);\n }\n\n .link-wrapper {\n gap: 5px;\n display: flex;\n margin: 4px 0 0 0;\n flex-direction: row;\n\n .link {\n flex: 1;\n height: 34px;\n display: flex;\n font-size: 16px;\n padding: 0 12px;\n overflow: hidden;\n margin: 0 6px 0 0;\n border-radius: 4px;\n white-space: nowrap;\n align-items: center;\n text-overflow: ellipsis;\n border: 1px solid #cccccc;\n background: rgb(249, 250, 251);\n }\n }\n }\n\n .buttons {\n display: flex;\n column-gap: 15px;\n margin: 10px 0 0 0;\n flex-direction: row;\n align-items: center;\n justify-content: center;\n\n verdocs-button {\n flex: 0 0 120px;\n margin-left: 10px;\n white-space: nowrap;\n\n button {\n width: 100%;\n }\n }\n }\n}\n","import {Component, Prop, Host, h, State, Event, EventEmitter} from '@stencil/core';\nimport {formatFullName, getEnvelope, getInPersonLink, IEnvelope, IRecipient, VerdocsEndpoint} from '@verdocs/js-sdk';\nimport {VerdocsToast} from '../../../utils/Toast';\nimport {SDKError} from '../../../utils/errors';\nimport {Store} from '../../../utils/Datastore';\n\n/**\n * Displays a single recipient from an envelope, with the opportunity to copy an in-person\n * signing link for that recipient to use.\n */\n@Component({\n tag: 'verdocs-envelope-recipient-link',\n styleUrl: 'verdocs-envelope-recipient-link.scss',\n})\nexport class VerdocsEnvelopeRecipientLink {\n private envelopeListenerId = null;\n\n /**\n * The endpoint to use to communicate with Verdocs. If not set, the default endpoint will be used.\n */\n @Prop() endpoint: VerdocsEndpoint = VerdocsEndpoint.getDefault();\n\n /**\n * The envelope ID to edit.\n */\n @Prop() envelopeId: string = '';\n\n /**\n * The role to load.\n */\n @Prop() roleName: string = '';\n\n /**\n * Event fired when the user clicks Done to proceed. It is up to the host application\n * to redirect the user to the appropriate next workflow step.\n */\n @Event({composed: true}) next: EventEmitter<{envelope: IEnvelope}>;\n\n /**\n * Event fired if an error occurs. The event details will contain information about the error. Most errors will\n * terminate the process, and the calling application should correct the condition and re-render the component.\n */\n @Event({composed: true}) sdkError: EventEmitter<SDKError>;\n\n @State() isOpen: boolean;\n @State() gettingLink = true;\n @State() link = '';\n\n @State() loading = true;\n @State() envelope: IEnvelope | null = null;\n @State() recipient: IRecipient | null = null;\n\n async componentWillLoad() {\n try {\n this.endpoint.loadSession();\n\n if (!this.envelopeId) {\n console.log(`[RECIPIENT_LINK] Missing required envelope ID ${this.envelopeId}`);\n return;\n }\n\n if (!this.endpoint.session) {\n console.log('[RECIPIENT_LINK] Unable to start session, must be authenticated');\n return;\n }\n\n this.listenToEnvelope();\n } catch (e) {\n console.log('[RECIPIENT_LINK] Error loading envelope', e);\n this.sdkError?.emit(new SDKError(e.message, e.response?.status, e.response?.data));\n }\n }\n\n disconnectedCallback() {\n this.unlistenToEnvelope();\n }\n\n async listenToEnvelope() {\n console.log('[SIDEBAR] Loading envelope', this.envelopeId);\n this.unlistenToEnvelope();\n Store.subscribe(\n 'envelopes',\n this.envelopeId,\n () => getEnvelope(this.endpoint, this.envelopeId),\n false,\n (envelope: IEnvelope) => {\n this.envelope = envelope;\n this.loading = false;\n\n this.recipient = (this.envelope?.recipients || []).find(r => r.role_name === this.roleName);\n this.getLink(this.recipient);\n },\n );\n }\n\n unlistenToEnvelope() {\n if (this.envelopeListenerId) {\n Store.store.delListener(this.envelopeListenerId);\n this.envelopeListenerId = null;\n }\n }\n\n handleDone(e: any) {\n e.preventDefault();\n this.next?.emit({envelope: this.envelope});\n }\n\n copyLink(link: string) {\n navigator.clipboard\n .writeText(link)\n .then(() => VerdocsToast('Link copied to clipboard!', {style: 'success', duration: 3000}))\n .catch(e => {\n console.warn('[RECIPIENT_LINK] Error copying to clipboard', e);\n VerdocsToast(`Unable to copy to clipboard: ${e.message}`, {style: 'error'});\n });\n }\n\n getLink(recipient: IRecipient) {\n this.gettingLink = true;\n getInPersonLink(this.endpoint, recipient.envelope_id, recipient.role_name)\n .then(response => {\n this.gettingLink = false;\n this.link = response.link;\n // NOTE: Left here for documentation purposes. We don't auto-copy the link because many browsers now\n // error on that because we aren't the focus/gesture-initiator since we're a new component just being\n // drawn in the DOM. So we let the user click to trigger that.\n // this.copyLink(response.link);\n })\n .catch(e => {\n this.gettingLink = false;\n console.log('[RECIPIENT_LINK] Error getting link', e);\n VerdocsToast('Unable to get link: ' + e.message, {style: 'error'});\n });\n }\n\n render() {\n if (this.loading || !this.recipient) {\n return <Host />;\n }\n\n // const recipientsWithActions = getRecipientsWithActions(this.store.state); const showLinkButton = recipientCanAct(recipient, recipientsWithActions); const link =\n // this.links[recipient.role_name]; const gettingLink = this.gettingLinks[recipient.role_name]; return (\n\n const fullName = formatFullName(this.recipient);\n return (\n <Host>\n <div class=\"summary-content\">\n <h1 class=\"summary-title\">In-Person Signing Link</h1>\n <div class=\"summary-rows\">\n <div class=\"summary-recipient\">\n <div class=\"role-name\">{this.recipient.role_name}</div>\n <div class=\"role-details\">\n <div class=\"role-info\">\n <div class=\"role-full-name\">\n {fullName} ({this.recipient.email || this.recipient.phone})\n </div>\n {!this.link && (\n <verdocs-button\n size=\"small\"\n variant=\"outline\"\n label={this.gettingLink ? 'Loading...' : 'Get Link'}\n disabled={this.gettingLink}\n onClick={() => this.getLink(this.recipient)}\n />\n )}\n </div>\n\n {this.link && (\n <div class=\"link-wrapper\">\n <div class=\"link\">{this.link}</div>\n <verdocs-button size=\"small\" variant=\"outline\" label=\"Copy\" onClick={() => this.copyLink(this.link)} />\n </div>\n )}\n </div>\n </div>\n </div>\n\n <div class=\"buttons\">\n <verdocs-button size=\"small\" label=\"Done\" onClick={e => this.handleDone(e)} />\n </div>\n </div>\n </Host>\n );\n }\n}\n","@import '../../../theme.scss';\n\nverdocs-switch {\n font-family: $primary-font;\n\n .switch {\n display: inline-flex;\n height: 24px;\n width: 44px;\n flex-shrink: 0;\n align-items: center;\n cursor: pointer;\n border-radius: 12px;\n border: transparent;\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n }\n\n .switch.primary[data-state='checked'] {\n background: $primary-color;\n }\n\n .switch.primary[data-state='unchecked'] {\n background: $extra-light-border-color;\n }\n\n .switch.secondary[data-state='checked'] {\n background: $secondary-color;\n }\n\n .switch.secondary[data-state='unchecked'] {\n background: $extra-light-border-color;\n }\n\n .slider {\n display: block;\n width: 20px;\n height: 20px;\n border-radius: 20px;\n background: #ffffff;\n box-shadow:\n 0 10px 15px -3px rgb(0 0 0 / 0.1),\n 0 4px 6px -4px rgb(0 0 0 / 0.1);\n transition-property: transform;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n }\n\n .slider[data-state='checked'] {\n transform: translateX(22px);\n }\n\n .slider[data-state='unchecked'] {\n transform: translateX(2px);\n }\n\n .switch.disabled.primary,\n .switch.disabled.secondary {\n cursor: not-allowed;\n background: $dark-disabled-color;\n }\n}\n","import {Component, Prop, h, EventEmitter, Event} from '@stencil/core';\n\n/**\n * Displays a toggle switch.\n *\n * ```ts\n * <verdocs-switch checked={sendReminders} onCheckedChange={setSendReminders} />\n * ```\n */\n@Component({\n tag: 'verdocs-switch',\n styleUrl: 'verdocs-switch.scss',\n})\nexport class VerdocsSwitch {\n @Prop({mutable: true}) checked: boolean = false;\n\n /**\n * Select purple or green treatments.\n */\n @Prop() theme: 'primary' | 'secondary' = 'primary';\n\n /**\n * Should the field be disabled?\n */\n @Prop() disabled: boolean = false;\n\n @Event({composed: true}) checkedChange: EventEmitter<boolean>;\n\n render() {\n return (\n <button\n value=\"on\"\n type=\"button\"\n role=\"switch\"\n class={`switch ${this.theme} ${this.disabled ? 'disabled' : ''}`}\n data-state={this.checked ? 'checked' : 'unchecked'}\n aria-checked={this.checked ? 'checked' : 'unchecked'}\n onClick={() => {\n if (!this.disabled) {\n this.checked = !this.checked;\n this.checkedChange?.emit(this.checked);\n }\n }}\n >\n <span data-state={this.checked ? 'checked' : 'unchecked'} class=\"slider\"></span>\n </button>\n );\n }\n}\n"],"mappings":"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","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"names":["verdocsBuildCss","VerdocsBuildStyle0","VerdocsBuild","exports","this","templateListenerId","VerdocsEndpoint","getDefault","class_1","prototype","onTemplateIdChanged","newTemplateId","oldTemplateId","step","loadTemplate","catch","e","console","log","onStepChanged","templateId","componentWillLoad","endpoint","loadSession","session","_a","sdkError","emit","SDKError","message","_b","response","status","_c","data","_d","_e","_f","Store","subscribe","getTemplate","_this","template","loading","disconnectedCallback","unlistenToTemplate","store","delListener","handleCancel","handleTemplateCreated","_g","sent","stepChanged","handleRolesUpdated","templateUpdated","detail","handleTemplateUpdated","handleAttachmentsNext","handleRolesNext","handleStepChanged","render","h","Host","class","onSdkError","onExit","onNext","onTemplateUpdated","onRolesUpdated","style","flexDirection","gap","display","maxWidth","margin","backgroundColor","padding","onSend","send","width","flex"],"sources":["src/components/embeds/verdocs-build/verdocs-build.scss?tag=verdocs-build","src/components/embeds/verdocs-build/verdocs-build.tsx"],"sourcesContent":["@import '../../../theme.scss';\n\nverdocs-build {\n display: flex;\n flex-direction: column;\n font-family: $verdocs-primary-font;\n\n .content {\n flex: 1;\n gap: 20px;\n display: flex;\n align-items: center;\n flex-direction: column;\n //box-shadow: 0 0 7px -3px #000000cc;\n }\n\n verdocs-template-attachments,\n verdocs-template-roles {\n margin: 20px;\n }\n\n verdocs-template-fields {\n border-top: 1px solid #777777;\n }\n\n verdocs-template-attachments {\n padding: 20px;\n background: #ffffff;\n }\n\n verdocs-template-fields {\n width: 100%;\n }\n\n verdocs-preview {\n flex: 1;\n }\n\n .preview-container {\n flex-direction: row;\n display: flex;\n width: 100%;\n background-color: #eeeeee;\n max-height: 100%;\n\n @media all and (max-width: 450px) {\n flex-direction: column;\n }\n }\n\n .preview-send-wrapper {\n display: flex;\n flex: 0 0 300px;\n background-color: #ffffff;\n box-shadow: 1px 1px 6px -2px #0000007f;\n\n @media all and (max-width: 450px) {\n flex: 0;\n }\n }\n\n .preview-preview-wrapper {\n display: flex;\n flex: 1;\n justify-content: center;\n overflow-y: scroll;\n }\n}\n","import {getTemplate, ICreateEnvelopeRecipient, IRole, ITemplate, VerdocsEndpoint} from '@verdocs/js-sdk';\nimport {Component, Prop, h, Element, Event, EventEmitter, Host, Watch, State} from '@stencil/core';\nimport {SDKError} from '../../../utils/errors';\nimport {Store} from '../../../utils/Datastore';\n\nexport type TVerdocsBuildStep = 'attachments' | 'roles' | 'settings' | 'fields' | 'preview';\n\n/**\n * Display a template building experience. Several event callbacks provide status updates to the\n * parent application to support interface updates.\n *\n * ```ts\n * <verdocs-build templateId={templateId} step=\"preview\" onSend={(detail) => {\n * console.log('Sent envelope from template', detail);\n * }} />\n * ```\n */\n@Component({\n tag: 'verdocs-build',\n styleUrl: 'verdocs-build.scss',\n shadow: false,\n})\nexport class VerdocsBuild {\n private templateListenerId = null;\n\n @Element() el!: any;\n\n /**\n * The endpoint to use to communicate with Verdocs. If not set, the default endpoint will be used.\n */\n @Prop() endpoint: VerdocsEndpoint = VerdocsEndpoint.getDefault();\n\n /**\n * The ID of the template to create the document from. Unlike most other components, this is an optional parameter here.\n * If the template ID is known, `step` may also be specified to force displaying a specific step in the creation process.\n * If it is not specified, `step` will be ignored and the create step will be shown.\n */\n @Prop({reflect: true, mutable: true}) templateId: string | null = null;\n\n /**\n * The step in the creation process to display.\n */\n @Prop({reflect: true, mutable: true}) step: TVerdocsBuildStep = 'preview';\n\n /**\n * Event fired if an error occurs. The event details will contain information about the error. Most errors will\n * terminate the process, and the calling application should correct the condition and re-render the component.\n */\n @Event({composed: true}) sdkError: EventEmitter<SDKError>;\n\n /**\n * Event fired when the user selects a different step.\n */\n @Event({composed: true}) stepChanged: EventEmitter<TVerdocsBuildStep>;\n\n /**\n * The user completed the Send form and clicked send.\n */\n @Event({composed: true}) send: EventEmitter<{recipients: ICreateEnvelopeRecipient[]; name: string; template_id: string}>;\n\n /**\n * Event fired when the template is updated in any way. May be used for tasks such as cache invalidation or reporting to other systems.\n */\n @Event({composed: true}) templateUpdated: EventEmitter<{endpoint: VerdocsEndpoint; template: ITemplate; event: string}>;\n\n /**\n * Event fired when the template is created by the upload step.\n */\n @Event({composed: true}) templateCreated: EventEmitter<{endpoint: VerdocsEndpoint; template: ITemplate; event: string}>;\n\n /**\n * Event fired when roles are updated in the roles step.\n */\n @Event({composed: true}) rolesUpdated: EventEmitter<{endpoint: VerdocsEndpoint; templateId: string; event: 'added' | 'deleted' | 'updated'; roles: IRole[]}>;\n\n @State() loading = true;\n @State() template: ITemplate | null = null;\n\n @Watch('templateId')\n onTemplateIdChanged(newTemplateId: string, oldTemplateId: string) {\n if (!oldTemplateId && newTemplateId && this.step === 'attachments') {\n this.step = 'preview';\n }\n\n this.loadTemplate(newTemplateId).catch((e: any) => console.log('Unknown Error', e));\n }\n\n @Watch('step')\n onStepChanged() {\n // We reload the template here even if only the step changed in case\n // we were out of sync before\n this.loadTemplate(this.templateId).catch((e: any) => console.log('Unknown Error', e));\n }\n\n async componentWillLoad() {\n try {\n this.endpoint.loadSession();\n if (!this.endpoint.session) {\n console.log('[BUILD] Unable to start builder session, must be authenticated');\n return;\n }\n\n if (!this.templateId) {\n console.log(`[BUILD] No template ID, activating upload mode`);\n this.step = 'attachments';\n return;\n }\n\n try {\n this.loadTemplate(this.templateId).catch(e => console.log('[BUILD] Unable to load template', e));\n } catch (e) {\n console.log('[BUILD] Error loading template', e);\n this.sdkError?.emit(new SDKError(e.message, e.response?.status, e.response?.data));\n }\n } catch (e) {\n console.log('[BUILD] Error with builder session', e);\n this.sdkError?.emit(new SDKError(e.message, e.response?.status, e.response?.data));\n }\n }\n\n async loadTemplate(templateId: string) {\n if (templateId) {\n Store.subscribe(\n 'templates',\n this.templateId,\n () => getTemplate(this.endpoint, this.templateId),\n false,\n (template: ITemplate) => {\n this.template = template;\n this.loading = false;\n },\n );\n }\n }\n\n disconnectedCallback() {\n console.log('[BUILD] Disconnected');\n this.unlistenToTemplate();\n }\n\n unlistenToTemplate() {\n if (this.templateListenerId) {\n Store.store.delListener(this.templateListenerId);\n this.templateListenerId = null;\n }\n }\n\n handleCancel() {\n this.step = 'preview';\n }\n\n async handleTemplateCreated(templateId: string) {\n await this.loadTemplate(templateId);\n this.templateId = templateId;\n this.step = 'roles';\n this.stepChanged?.emit('roles');\n }\n\n async handleRolesUpdated(e: any) {\n this.templateUpdated?.emit(e.detail);\n }\n\n async handleTemplateUpdated(e: any) {\n this.templateUpdated?.emit(e.detail);\n }\n\n handleAttachmentsNext() {\n this.step = 'roles';\n this.stepChanged?.emit('roles');\n }\n\n handleRolesNext() {\n this.step = 'fields';\n this.stepChanged?.emit('fields');\n }\n\n handleStepChanged(step: TVerdocsBuildStep) {\n this.step = step;\n this.stepChanged?.emit(step);\n }\n\n render() {\n if (this.loading) {\n return (\n <Host class=\"loading\">\n <verdocs-loader />\n </Host>\n );\n }\n\n if (!this.endpoint.session) {\n return (\n <Host>\n <verdocs-component-error message=\"You must be authenticated to use this module.\" />\n </Host>\n );\n }\n\n return (\n <Host>\n <div class=\"content\">\n <verdocs-template-build-tabs\n endpoint={this.endpoint}\n templateId={this.templateId}\n step={this.step}\n onSdkError={e => this.sdkError?.emit(e.detail)}\n onStepChanged={e => this.handleStepChanged(e.detail)}\n />\n\n {this.step === 'attachments' && (\n <verdocs-template-attachments\n templateId={this.templateId}\n endpoint={this.endpoint}\n onExit={() => this.handleCancel()}\n onNext={() => this.handleAttachmentsNext()}\n onTemplateUpdated={e => this.handleTemplateUpdated(e)}\n />\n )}\n\n {this.step === 'roles' && (\n <verdocs-template-roles\n templateId={this.templateId}\n endpoint={this.endpoint}\n onExit={() => this.handleCancel()}\n onNext={() => this.handleRolesNext()}\n onRolesUpdated={e => this.handleRolesUpdated(e)}\n />\n )}\n\n {this.step === 'settings' && (\n <div style={{flexDirection: 'column', gap: '20px', display: 'flex', maxWidth: '400px', margin: '20px'}}>\n <verdocs-template-name\n templateId={this.templateId}\n endpoint={this.endpoint}\n style={{backgroundColor: '#ffffff', padding: '20px'}}\n onTemplateUpdated={e => this.handleTemplateUpdated(e)}\n />\n <verdocs-template-reminders\n templateId={this.templateId}\n endpoint={this.endpoint}\n style={{backgroundColor: '#ffffff', padding: '20px'}}\n onTemplateUpdated={e => this.handleTemplateUpdated(e)}\n />\n <verdocs-template-visibility\n templateId={this.templateId}\n endpoint={this.endpoint}\n style={{backgroundColor: '#ffffff', padding: '20px'}}\n onTemplateUpdated={e => this.handleTemplateUpdated(e)}\n />\n </div>\n )}\n\n {this.step === 'fields' && <verdocs-template-fields templateId={this.templateId} endpoint={this.endpoint} onTemplateUpdated={e => this.handleTemplateUpdated(e)} />}\n\n {this.step === 'preview' && (\n <div class=\"preview-container\">\n <div class=\"preview-send-wrapper\">\n <verdocs-send templateId={this.templateId} endpoint={this.endpoint} onSend={e => this.send?.emit(e.detail)} style={{width: '100%'}} />\n </div>\n <div class=\"preview-preview-wrapper\">\n <verdocs-preview templateId={this.templateId} endpoint={this.endpoint} style={{display: 'flex', flex: '1', maxWidth: '1000px'}} />\n </div>\n </div>\n )}\n </div>\n </Host>\n );\n }\n}\n"],"mappings":"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","ignoreList":[]}
@@ -1,2 +0,0 @@
1
- var __awaiter=this&&this.__awaiter||function(e,i,t,r){function n(e){return e instanceof t?e:new t((function(i){i(e)}))}return new(t||(t=Promise))((function(t,o){function s(e){try{a(r.next(e))}catch(e){o(e)}}function c(e){try{a(r["throw"](e))}catch(e){o(e)}}function a(e){e.done?t(e.value):n(e.value).then(s,c)}a((r=r.apply(e,i||[])).next())}))};var __generator=this&&this.__generator||function(e,i){var t={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,n,o,s;return s={next:c(0),throw:c(1),return:c(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function c(e){return function(i){return a([e,i])}}function a(c){if(r)throw new TypeError("Generator is already executing.");while(s&&(s=0,c[0]&&(t=0)),t)try{if(r=1,n&&(o=c[0]&2?n["return"]:c[0]?n["throw"]||((o=n["return"])&&o.call(n),0):n.next)&&!(o=o.call(n,c[1])).done)return o;if(n=0,o)c=[c[0]&2,o.value];switch(c[0]){case 0:case 1:o=c;break;case 4:t.label++;return{value:c[1],done:false};case 5:t.label++;n=c[1];c=[0];continue;case 7:c=t.ops.pop();t.trys.pop();continue;default:if(!(o=t.trys,o=o.length>0&&o[o.length-1])&&(c[0]===6||c[0]===2)){t=0;continue}if(c[0]===3&&(!o||c[1]>o[0]&&c[1]<o[3])){t.label=c[1];break}if(c[0]===6&&t.label<o[1]){t.label=o[1];o=c;break}if(o&&t.label<o[2]){t.label=o[2];t.ops.push(c);break}if(o[2])t.ops.pop();t.trys.pop();continue}c=i.call(e,t)}catch(e){c=[6,e];n=0}finally{r=o=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:true}}};System.register(["./p-9186f42e.system.js","@verdocs/js-sdk","./p-9b26e4e0.system.js","./p-c8a15cb7.system.js","./p-52c3e8b0.system.js"],(function(e){"use strict";var i,t,r,n,o,s,c,a,l,d,u;return{setters:[function(e){i=e.r;t=e.c;r=e.h;n=e.H},function(e){o=e.VerdocsEndpoint;s=e.getEnvelope;c=e.getInPersonLink;a=e.formatFullName},function(e){l=e.V},function(e){d=e.S},function(e){u=e.S}],execute:function(){var f='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-envelope-recipient-link{top:0;left:0;right:0;bottom:0;display:-ms-flexbox;display:flex;z-index:100000;position:fixed;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;font-family:"Inter", "Barlow", sans-serif;background-color:rgba(0, 0, 0, 0.4980392157)}verdocs-envelope-recipient-link .summary-content{width:600px;display:-ms-flexbox;display:flex;max-width:90%;font-size:18px;-ms-flex:0 0 600px;flex:0 0 600px;border-radius:6px;background:#ffffff;-ms-flex-direction:column;flex-direction:column;padding:30px 20px 20px}verdocs-envelope-recipient-link .summary-content .summary-title{font-size:20px;font-weight:700;margin:0 0 10px 0;color:#33364b}verdocs-envelope-recipient-link .summary-recipient{display:-ms-flexbox;display:flex;color:#33364b;margin:8px 0 24px 0;-ms-flex-direction:column;flex-direction:column}verdocs-envelope-recipient-link .summary-recipient .role-name{-ms-flex:1;flex:1;display:-ms-flexbox;display:flex;font-size:14px;font-weight:600;margin:0 0 8px 0;color:#092c4c}verdocs-envelope-recipient-link .summary-recipient .role-info{gap:5px;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:end;align-items:flex-end}verdocs-envelope-recipient-link .summary-recipient .role-full-name{-ms-flex:1;flex:1;height:34px;display:-ms-flexbox;display:flex;font-size:16px;padding:0 12px;border-radius:4px;-ms-flex-align:center;align-items:center;border:1px solid #cccccc;background:rgb(249, 250, 251)}verdocs-envelope-recipient-link .summary-recipient .recipient-link{width:120px;padding:0 16px;font-weight:500;margin:0 0 0 8px;text-align:center;font-size:0.875rem;border-radius:100%;color:rgb(55, 65, 81);line-height:1.25rem;background-color:#d8d8d8;border:2px solid rgb(156, 163, 175)}verdocs-envelope-recipient-link .summary-recipient .link-wrapper{gap:5px;display:-ms-flexbox;display:flex;margin:4px 0 0 0;-ms-flex-direction:row;flex-direction:row}verdocs-envelope-recipient-link .summary-recipient .link-wrapper .link{-ms-flex:1;flex:1;height:34px;display:-ms-flexbox;display:flex;font-size:16px;padding:0 12px;overflow:hidden;margin:0 6px 0 0;border-radius:4px;white-space:nowrap;-ms-flex-align:center;align-items:center;text-overflow:ellipsis;border:1px solid #cccccc;background:rgb(249, 250, 251)}verdocs-envelope-recipient-link .buttons{display:-ms-flexbox;display:flex;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;margin:10px 0 0 0;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}verdocs-envelope-recipient-link .buttons verdocs-button{-ms-flex:0 0 120px;flex:0 0 120px;margin-left:10px;white-space:nowrap}verdocs-envelope-recipient-link .buttons verdocs-button button{width:100%}';var p=f;var b=e("verdocs_envelope_recipient_link",function(){function e(e){i(this,e);this.next=t(this,"next",7);this.sdkError=t(this,"sdkError",7);this.envelopeListenerId=null;this.endpoint=o.getDefault();this.envelopeId="";this.roleName="";this.isOpen=undefined;this.gettingLink=true;this.link="";this.loading=true;this.envelope=null;this.recipient=null}e.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,i,t;return __generator(this,(function(r){try{this.endpoint.loadSession();if(!this.envelopeId){console.log("[RECIPIENT_LINK] Missing required envelope ID ".concat(this.envelopeId));return[2]}if(!this.endpoint.session){console.log("[RECIPIENT_LINK] Unable to start session, must be authenticated");return[2]}this.listenToEnvelope()}catch(r){console.log("[RECIPIENT_LINK] Error loading envelope",r);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new d(r.message,(i=r.response)===null||i===void 0?void 0:i.status,(t=r.response)===null||t===void 0?void 0:t.data))}return[2]}))}))};e.prototype.disconnectedCallback=function(){this.unlistenToEnvelope()};e.prototype.listenToEnvelope=function(){return __awaiter(this,void 0,void 0,(function(){var e=this;return __generator(this,(function(i){console.log("[SIDEBAR] Loading envelope",this.envelopeId);this.unlistenToEnvelope();u.subscribe("envelopes",this.envelopeId,(function(){return s(e.endpoint,e.envelopeId)}),false,(function(i){var t;e.envelope=i;e.loading=false;e.recipient=(((t=e.envelope)===null||t===void 0?void 0:t.recipients)||[]).find((function(i){return i.role_name===e.roleName}));e.getLink(e.recipient)}));return[2]}))}))};e.prototype.unlistenToEnvelope=function(){if(this.envelopeListenerId){u.store.delListener(this.envelopeListenerId);this.envelopeListenerId=null}};e.prototype.handleDone=function(e){var i;e.preventDefault();(i=this.next)===null||i===void 0?void 0:i.emit({envelope:this.envelope})};e.prototype.copyLink=function(e){navigator.clipboard.writeText(e).then((function(){return l("Link copied to clipboard!",{style:"success",duration:3e3})})).catch((function(e){console.warn("[RECIPIENT_LINK] Error copying to clipboard",e);l("Unable to copy to clipboard: ".concat(e.message),{style:"error"})}))};e.prototype.getLink=function(e){var i=this;this.gettingLink=true;c(this.endpoint,e.envelope_id,e.role_name).then((function(e){i.gettingLink=false;i.link=e.link})).catch((function(e){i.gettingLink=false;console.log("[RECIPIENT_LINK] Error getting link",e);l("Unable to get link: "+e.message,{style:"error"})}))};e.prototype.render=function(){var e=this;if(this.loading||!this.recipient){return r(n,null)}var i=a(this.recipient);return r(n,null,r("div",{class:"summary-content"},r("h1",{class:"summary-title"},"In-Person Signing Link"),r("div",{class:"summary-rows"},r("div",{class:"summary-recipient"},r("div",{class:"role-name"},this.recipient.role_name),r("div",{class:"role-details"},r("div",{class:"role-info"},r("div",{class:"role-full-name"},i," (",this.recipient.email||this.recipient.phone,")"),!this.link&&r("verdocs-button",{size:"small",variant:"outline",label:this.gettingLink?"Loading...":"Get Link",disabled:this.gettingLink,onClick:function(){return e.getLink(e.recipient)}})),this.link&&r("div",{class:"link-wrapper"},r("div",{class:"link"},this.link),r("verdocs-button",{size:"small",variant:"outline",label:"Copy",onClick:function(){return e.copyLink(e.link)}}))))),r("div",{class:"buttons"},r("verdocs-button",{size:"small",label:"Done",onClick:function(i){return e.handleDone(i)}}))))};return e}());b.style=p;var h='@-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-switch{font-family:"Inter", "Barlow", sans-serif}verdocs-switch .switch{display:-ms-inline-flexbox;display:inline-flex;height:24px;width:44px;-ms-flex-negative:0;flex-shrink:0;-ms-flex-align:center;align-items:center;cursor:pointer;border-radius:12px;border:transparent;-webkit-transition-property:color, background-color, border-color, fill, stroke, -webkit-text-decoration-color;transition-property:color, background-color, border-color, fill, stroke, -webkit-text-decoration-color;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, -webkit-text-decoration-color;-webkit-transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);-webkit-transition-duration:150ms;transition-duration:150ms}verdocs-switch .switch.primary[data-state=checked]{background:#55bc81}verdocs-switch .switch.primary[data-state=unchecked]{background:#e3e3e3}verdocs-switch .switch.secondary[data-state=checked]{background:#4c56cb}verdocs-switch .switch.secondary[data-state=unchecked]{background:#e3e3e3}verdocs-switch .slider{display:block;width:20px;height:20px;border-radius:20px;background:#ffffff;-webkit-box-shadow:0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);box-shadow:0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);-webkit-transition-property:-webkit-transform;transition-property:-webkit-transform;transition-property:transform;transition-property:transform, -webkit-transform;-webkit-transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);-webkit-transition-duration:150ms;transition-duration:150ms}verdocs-switch .slider[data-state=checked]{-webkit-transform:translateX(22px);transform:translateX(22px)}verdocs-switch .slider[data-state=unchecked]{-webkit-transform:translateX(2px);transform:translateX(2px)}verdocs-switch .switch.disabled.primary,verdocs-switch .switch.disabled.secondary{cursor:not-allowed;background:#666666}';var x=h;var m=e("verdocs_switch",function(){function e(e){i(this,e);this.checkedChange=t(this,"checkedChange",7);this.checked=false;this.theme="primary";this.disabled=false}e.prototype.render=function(){var e=this;return r("button",{key:"e9153549bcee6b924ce7a7d620d1096fa91782d2",value:"on",type:"button",role:"switch",class:"switch ".concat(this.theme," ").concat(this.disabled?"disabled":""),"data-state":this.checked?"checked":"unchecked","aria-checked":this.checked?"checked":"unchecked",onClick:function(){var i;if(!e.disabled){e.checked=!e.checked;(i=e.checkedChange)===null||i===void 0?void 0:i.emit(e.checked)}}},r("span",{key:"61d97d7571b7f52f186ce44daaf0ef7132c6d5f6","data-state":this.checked?"checked":"unchecked",class:"slider"}))};return e}());m.style=x}}}));
2
- //# sourceMappingURL=p-e3efeb57.system.entry.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["verdocsEnvelopeRecipientLinkCss","VerdocsEnvelopeRecipientLinkStyle0","VerdocsEnvelopeRecipientLink","exports","this","envelopeListenerId","VerdocsEndpoint","getDefault","class_1","prototype","componentWillLoad","endpoint","loadSession","envelopeId","console","log","concat","session","listenToEnvelope","e","_a","sdkError","emit","SDKError","message","_b","response","status","_c","data","disconnectedCallback","unlistenToEnvelope","Store","subscribe","getEnvelope","_this","envelope","loading","recipient","recipients","find","r","role_name","roleName","getLink","store","delListener","handleDone","preventDefault","next","copyLink","link","navigator","clipboard","writeText","then","VerdocsToast","style","duration","catch","warn","gettingLink","getInPersonLink","envelope_id","render","h","Host","fullName","formatFullName","class","email","phone","size","variant","label","disabled","onClick","verdocsSwitchCss","VerdocsSwitchStyle0","VerdocsSwitch","class_2","key","value","type","role","theme","checked","checkedChange"],"sources":["src/components/envelopes/verdocs-envelope-recipient-link/verdocs-envelope-recipient-link.scss?tag=verdocs-envelope-recipient-link","src/components/envelopes/verdocs-envelope-recipient-link/verdocs-envelope-recipient-link.tsx","src/components/controls/verdocs-switch/verdocs-switch.scss?tag=verdocs-switch","src/components/controls/verdocs-switch/verdocs-switch.tsx"],"sourcesContent":["@import '../../../theme.scss';\n\nverdocs-envelope-recipient-link {\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n display: flex;\n z-index: 100000;\n position: fixed;\n align-items: center;\n justify-content: center;\n font-family: $primary-font;\n background-color: #0000007f;\n\n .summary-content {\n width: 600px;\n display: flex;\n max-width: 90%;\n font-size: 18px;\n flex: 0 0 600px;\n border-radius: 6px;\n background: #ffffff;\n flex-direction: column;\n padding: 30px 20px 20px;\n\n .summary-title {\n font-size: 20px;\n font-weight: 700;\n margin: 0 0 10px 0;\n color: $verdocs-dark-blue;\n }\n }\n\n .summary-recipient {\n display: flex;\n color: $verdocs-grey-1;\n margin: 8px 0 24px 0;\n flex-direction: column;\n\n .role-name {\n flex: 1;\n display: flex;\n font-size: 14px;\n font-weight: 600;\n margin: 0 0 8px 0;\n color: $verdocs-grey-0;\n }\n\n .role-details {\n }\n\n .role-info {\n gap: 5px;\n display: flex;\n flex-direction: row;\n align-items: flex-end;\n }\n\n .role-full-name {\n flex: 1;\n height: 34px;\n display: flex;\n font-size: 16px;\n padding: 0 12px;\n border-radius: 4px;\n align-items: center;\n border: 1px solid #cccccc;\n background: rgb(249, 250, 251);\n }\n\n .recipient-link {\n width: 120px;\n padding: 0 16px;\n font-weight: 500;\n margin: 0 0 0 8px;\n text-align: center;\n font-size: 0.875rem;\n border-radius: 100%;\n color: rgb(55, 65, 81);\n line-height: 1.25rem;\n background-color: #d8d8d8;\n border: 2px solid rgb(156, 163, 175);\n }\n\n .link-wrapper {\n gap: 5px;\n display: flex;\n margin: 4px 0 0 0;\n flex-direction: row;\n\n .link {\n flex: 1;\n height: 34px;\n display: flex;\n font-size: 16px;\n padding: 0 12px;\n overflow: hidden;\n margin: 0 6px 0 0;\n border-radius: 4px;\n white-space: nowrap;\n align-items: center;\n text-overflow: ellipsis;\n border: 1px solid #cccccc;\n background: rgb(249, 250, 251);\n }\n }\n }\n\n .buttons {\n display: flex;\n column-gap: 15px;\n margin: 10px 0 0 0;\n flex-direction: row;\n align-items: center;\n justify-content: center;\n\n verdocs-button {\n flex: 0 0 120px;\n margin-left: 10px;\n white-space: nowrap;\n\n button {\n width: 100%;\n }\n }\n }\n}\n","import {Component, Prop, Host, h, State, Event, EventEmitter} from '@stencil/core';\nimport {formatFullName, getEnvelope, getInPersonLink, IEnvelope, IRecipient, VerdocsEndpoint} from '@verdocs/js-sdk';\nimport {VerdocsToast} from '../../../utils/Toast';\nimport {SDKError} from '../../../utils/errors';\nimport {Store} from '../../../utils/Datastore';\n\n/**\n * Displays a single recipient from an envelope, with the opportunity to copy an in-person\n * signing link for that recipient to use.\n */\n@Component({\n tag: 'verdocs-envelope-recipient-link',\n styleUrl: 'verdocs-envelope-recipient-link.scss',\n})\nexport class VerdocsEnvelopeRecipientLink {\n private envelopeListenerId = null;\n\n /**\n * The endpoint to use to communicate with Verdocs. If not set, the default endpoint will be used.\n */\n @Prop() endpoint: VerdocsEndpoint = VerdocsEndpoint.getDefault();\n\n /**\n * The envelope ID to edit.\n */\n @Prop() envelopeId: string = '';\n\n /**\n * The role to load.\n */\n @Prop() roleName: string = '';\n\n /**\n * Event fired when the user clicks Done to proceed. It is up to the host application\n * to redirect the user to the appropriate next workflow step.\n */\n @Event({composed: true}) next: EventEmitter<{envelope: IEnvelope}>;\n\n /**\n * Event fired if an error occurs. The event details will contain information about the error. Most errors will\n * terminate the process, and the calling application should correct the condition and re-render the component.\n */\n @Event({composed: true}) sdkError: EventEmitter<SDKError>;\n\n @State() isOpen: boolean;\n @State() gettingLink = true;\n @State() link = '';\n\n @State() loading = true;\n @State() envelope: IEnvelope | null = null;\n @State() recipient: IRecipient | null = null;\n\n async componentWillLoad() {\n try {\n this.endpoint.loadSession();\n\n if (!this.envelopeId) {\n console.log(`[RECIPIENT_LINK] Missing required envelope ID ${this.envelopeId}`);\n return;\n }\n\n if (!this.endpoint.session) {\n console.log('[RECIPIENT_LINK] Unable to start session, must be authenticated');\n return;\n }\n\n this.listenToEnvelope();\n } catch (e) {\n console.log('[RECIPIENT_LINK] Error loading envelope', e);\n this.sdkError?.emit(new SDKError(e.message, e.response?.status, e.response?.data));\n }\n }\n\n disconnectedCallback() {\n this.unlistenToEnvelope();\n }\n\n async listenToEnvelope() {\n console.log('[SIDEBAR] Loading envelope', this.envelopeId);\n this.unlistenToEnvelope();\n Store.subscribe(\n 'envelopes',\n this.envelopeId,\n () => getEnvelope(this.endpoint, this.envelopeId),\n false,\n (envelope: IEnvelope) => {\n this.envelope = envelope;\n this.loading = false;\n\n this.recipient = (this.envelope?.recipients || []).find(r => r.role_name === this.roleName);\n this.getLink(this.recipient);\n },\n );\n }\n\n unlistenToEnvelope() {\n if (this.envelopeListenerId) {\n Store.store.delListener(this.envelopeListenerId);\n this.envelopeListenerId = null;\n }\n }\n\n handleDone(e: any) {\n e.preventDefault();\n this.next?.emit({envelope: this.envelope});\n }\n\n copyLink(link: string) {\n navigator.clipboard\n .writeText(link)\n .then(() => VerdocsToast('Link copied to clipboard!', {style: 'success', duration: 3000}))\n .catch(e => {\n console.warn('[RECIPIENT_LINK] Error copying to clipboard', e);\n VerdocsToast(`Unable to copy to clipboard: ${e.message}`, {style: 'error'});\n });\n }\n\n getLink(recipient: IRecipient) {\n this.gettingLink = true;\n getInPersonLink(this.endpoint, recipient.envelope_id, recipient.role_name)\n .then(response => {\n this.gettingLink = false;\n this.link = response.link;\n // NOTE: Left here for documentation purposes. We don't auto-copy the link because many browsers now\n // error on that because we aren't the focus/gesture-initiator since we're a new component just being\n // drawn in the DOM. So we let the user click to trigger that.\n // this.copyLink(response.link);\n })\n .catch(e => {\n this.gettingLink = false;\n console.log('[RECIPIENT_LINK] Error getting link', e);\n VerdocsToast('Unable to get link: ' + e.message, {style: 'error'});\n });\n }\n\n render() {\n if (this.loading || !this.recipient) {\n return <Host />;\n }\n\n // const recipientsWithActions = getRecipientsWithActions(this.store.state); const showLinkButton = recipientCanAct(recipient, recipientsWithActions); const link =\n // this.links[recipient.role_name]; const gettingLink = this.gettingLinks[recipient.role_name]; return (\n\n const fullName = formatFullName(this.recipient);\n return (\n <Host>\n <div class=\"summary-content\">\n <h1 class=\"summary-title\">In-Person Signing Link</h1>\n <div class=\"summary-rows\">\n <div class=\"summary-recipient\">\n <div class=\"role-name\">{this.recipient.role_name}</div>\n <div class=\"role-details\">\n <div class=\"role-info\">\n <div class=\"role-full-name\">\n {fullName} ({this.recipient.email || this.recipient.phone})\n </div>\n {!this.link && (\n <verdocs-button\n size=\"small\"\n variant=\"outline\"\n label={this.gettingLink ? 'Loading...' : 'Get Link'}\n disabled={this.gettingLink}\n onClick={() => this.getLink(this.recipient)}\n />\n )}\n </div>\n\n {this.link && (\n <div class=\"link-wrapper\">\n <div class=\"link\">{this.link}</div>\n <verdocs-button size=\"small\" variant=\"outline\" label=\"Copy\" onClick={() => this.copyLink(this.link)} />\n </div>\n )}\n </div>\n </div>\n </div>\n\n <div class=\"buttons\">\n <verdocs-button size=\"small\" label=\"Done\" onClick={e => this.handleDone(e)} />\n </div>\n </div>\n </Host>\n );\n }\n}\n","@import '../../../theme.scss';\n\nverdocs-switch {\n font-family: $primary-font;\n\n .switch {\n display: inline-flex;\n height: 24px;\n width: 44px;\n flex-shrink: 0;\n align-items: center;\n cursor: pointer;\n border-radius: 12px;\n border: transparent;\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n }\n\n .switch.primary[data-state='checked'] {\n background: $primary-color;\n }\n\n .switch.primary[data-state='unchecked'] {\n background: $extra-light-border-color;\n }\n\n .switch.secondary[data-state='checked'] {\n background: $secondary-color;\n }\n\n .switch.secondary[data-state='unchecked'] {\n background: $extra-light-border-color;\n }\n\n .slider {\n display: block;\n width: 20px;\n height: 20px;\n border-radius: 20px;\n background: #ffffff;\n box-shadow:\n 0 10px 15px -3px rgb(0 0 0 / 0.1),\n 0 4px 6px -4px rgb(0 0 0 / 0.1);\n transition-property: transform;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n }\n\n .slider[data-state='checked'] {\n transform: translateX(22px);\n }\n\n .slider[data-state='unchecked'] {\n transform: translateX(2px);\n }\n\n .switch.disabled.primary,\n .switch.disabled.secondary {\n cursor: not-allowed;\n background: $dark-disabled-color;\n }\n}\n","import {Component, Prop, h, EventEmitter, Event} from '@stencil/core';\n\n/**\n * Displays a toggle switch.\n *\n * ```ts\n * <verdocs-switch checked={sendReminders} onCheckedChange={setSendReminders} />\n * ```\n */\n@Component({\n tag: 'verdocs-switch',\n styleUrl: 'verdocs-switch.scss',\n})\nexport class VerdocsSwitch {\n @Prop({mutable: true}) checked: boolean = false;\n\n /**\n * Select purple or green treatments.\n */\n @Prop() theme: 'primary' | 'secondary' = 'primary';\n\n /**\n * Should the field be disabled?\n */\n @Prop() disabled: boolean = false;\n\n @Event({composed: true}) checkedChange: EventEmitter<boolean>;\n\n render() {\n return (\n <button\n value=\"on\"\n type=\"button\"\n role=\"switch\"\n class={`switch ${this.theme} ${this.disabled ? 'disabled' : ''}`}\n data-state={this.checked ? 'checked' : 'unchecked'}\n aria-checked={this.checked ? 'checked' : 'unchecked'}\n onClick={() => {\n if (!this.disabled) {\n this.checked = !this.checked;\n this.checkedChange?.emit(this.checked);\n }\n }}\n >\n <span data-state={this.checked ? 'checked' : 'unchecked'} class=\"slider\"></span>\n </button>\n );\n }\n}\n"],"mappings":"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","ignoreList":[]}
@@ -1,8 +0,0 @@
1
- import{r as e,c as t,h as i,H as o,F as s,g as n}from"./p-b9654a5e.js";import{VerdocsEndpoint as l,getTemplate as r,integerSequence as a,getOrganizationContacts as d,isValidEmail as c,createEnvelope as h,formatFullName as u,getRGBA as f,createTemplateDocument as p,deleteTemplateDocument as v,updateField as m,createField as g,updateTemplateRole as b,createTemplateRole as x}from"@verdocs/js-sdk";import{S as w}from"./p-fd97809c.js";import{S as y}from"./p-d4be87ef.js";import{V as E}from"./p-04c07b7b.js";import{D as k,P as S,J as q,a as C,F as M,b as T,T as I}from"./p-b0766439.js";import{f as L}from"./p-12bab948.js";import{i as D}from"./p-a901dff2.js";import{b as H,c as Z,d as z,g as O,e as N,f as _}from"./p-0c45b79c.js";import"./p-85aa8e05.js";import"./p-c7ee88c7.js";const V='@-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 R=V;const A=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();y.subscribe("templates",this.templateId,(()=>r(this.endpoint,this.templateId)),false,(e=>{this.template=e;this.loading=false}))}unlistenToTemplate(){if(this.templateListenerId){y.store.delListener(this.templateListenerId);this.templateListenerId=null}}onTemplateIdChanged(e){console.log("[PREVIEW] Template ID changed",e);this.listenToTemplate()}async componentWillLoad(){var e,t,i;try{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(o){console.log("[PREVIEW] Error with preview session",o);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new w(o.message,(t=o.response)===null||t===void 0?void 0:t.status,(i=o.response)===null||i===void 0?void 0:i.data))}}handlePageRendered(e){}render(){var e;if(this.loading){return i(o,null,i("verdocs-loader",null))}return i(o,null,(((e=this.template)===null||e===void 0?void 0:e.documents)||[]).map((e=>{const t=a(1,e.pages);return i(s,null,t.map((t=>{var o;const s=((o=e.page_sizes)===null||o===void 0?void 0:o[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:s.width,virtualHeight:s.height,onPageRendered:e=>this.handlePageRendered(e),layers:[{name:"page",type:"canvas"},{name:"controls",type:"div"}]})})))})))}static get watchers(){return{templateId:["onTemplateIdChanged"]}}};A.style=R;const j=e=>((e===null||e===void 0?void 0:e.roles)||[]).map((e=>e.name));const U=(e,t)=>Math.max(j(e).findIndex((e=>e===t)),0);const B='@-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=B;const $='<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 F='<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 W='<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 Y=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();y.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){y.store.delListener(this.templateListenerId);this.templateListenerId=null}}async reset(){this.rolesCompleted={}}onTemplateIdChanged(e){console.log("[SEND] Template ID changed",e);this.listenToTemplate()}async componentWillLoad(){var e,t,i;try{this.endpoint.onSessionChanged(((e,t,i)=>{if(!i){return}const o={id:i.id,first_name:i.first_name,last_name:i.last_name,email:i.email,phone:i.phone};if(i){this.sessionContacts=[o];d(this.endpoint).then((e=>{console.log("[SEND] Got contacts",e);this.sessionContacts=[...e,o]})).catch((e=>{console.log("[SEND] Error getting contacts",e)}))}}));this.endpoint.loadSession();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(o){console.log("[SEND] Error with send session",o);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new w(o.message,(t=o.response)===null||t===void 0?void 0:t.status,(i=o.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 o=`r-${i}-${t[i].length}`;t[i].push({...e,id:o,role_name:e.name,first_name:e.first_name,last_name:e.last_name});if(e.first_name&&c(e.email)){this.rolesCompleted[o]={...e,id:o,role_name:e.name,first_name:e.first_name,last_name:e.last_name}}}))}getLevels(){var e;const t={};(((e=this.template)===null||e===void 0?void 0:e.roles)||[]).forEach((e=>{t[e.sequence]=true}));console.log("[SEND] Sequences",t);return Object.keys(t).map((e=>+e-1)).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-1===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){const t=this.getLevels();if(e<0){return i("div",{class:"level-icon",innerHTML:Q})}else if(e>=t.length){return i("div",{class:"level-icon",innerHTML:W})}else{return i("div",{class:"level-icon",innerHTML:F})}}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 o=this.beforeSend.emit({...i,name:i.name});if(o.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,o;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;(o=this.sdkError)===null||o===void 0?void 0:o.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(o,null,i("verdocs-loader",null))}if(!this.endpoint.session){return i(o,{style:{display:"flex"}},i("verdocs-component-error",{message:"You must be authenticated to use this module."}))}const t=this.getLevels();console.log("[SEND] Rendering levels",t);const s=Object.values(this.rolesCompleted).filter((e=>c(e.email)&&e.first_name&&e.last_name));const n=s.length>=j(this.template).length;return i(o,{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(-1),i("div",{class:"complete"},"Send Envelope")),t.map((e=>i("div",{class:`level level-${e}`},this.getLevelIcon(e),(()=>{console.log("Rendering level",e,this.getRolesAtLevel(e));return""}),this.getRolesAtLevel(e).map((e=>{var t,o,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=U(this.template,e.role_name);const c=f(d);const h=s.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:$}),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:(o=this.rolesCompleted[e.id])!==null&&o!==void 0?o: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:$}),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(t.length),i("div",{class:"complete"},"Signing Complete"))),i("div",{class:"buttons"},i("verdocs-button",{label:"Cancel",size:"small",variant:"outline",onClick:e=>this.handleCancel(e),disabled:this.sending}),i("verdocs-button",{label:"Send",size:"small",disabled:!n||this.sending,onClick:e=>this.handleSend(e)}),this.sending&&i("verdocs-spinner",null)))}static get watchers(){return{templateId:["onTemplateIdChanged"]}}};Y.style=P;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 G=J;const X=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(o){console.log("[TEMPLATE ATTACHMENTS] Error loading template",o);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new w(o.message,(t=o.response)===null||t===void 0?void 0:t.status,(i=o.response)===null||i===void 0?void 0:i.data))}}disconnectedCallback(){this.unlistenToTemplate()}async listenToTemplate(){this.unlistenToTemplate();y.subscribe("templates",this.templateId,(()=>r(this.endpoint,this.templateId)),false,(e=>{this.template=e;this.loading=false}))}unlistenToTemplate(){if(this.templateListenerId){y.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,o,s;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 y.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 w(e.message,(o=e.response)===null||o===void 0?void 0:o.status,(s=e.response)===null||s===void 0?void 0:s.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 y.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 C;case"image/jpeg":return q;case"image/png":return S;case"application/msword":case"application/vnd.openxmlformats-officedocument.wordprocessingml.document":return k}return M}render(){var e,t;if(!this.endpoint.session){return i(o,null,i("verdocs-component-error",{message:"You must be authenticated to use this module."}))}if(this.loading){return i(o,{class:"loading"},i("verdocs-loader",null))}if(!this.endpoint.session||!this.template){return i(o,{class:"empty"})}return i(o,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:T})),i("div",{class:"trash-icon",innerHTML:I,onClick:()=>this.handleDelete(e)}))))),i("h5",null,"Attach a New Document"),this.uploading?i("div",{class:"loader-wrapper"},i("verdocs-loader",null),this.progressLabel&&i("div",{class:"progress-wrapper"},i("verdocs-progress-bar",{showPercent: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}}))}};X.style=G;const K='@-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 ee=K;const te='<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 ie=`<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 se=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();y.subscribe("templates",this.templateId,(()=>r(this.endpoint,this.templateId)),false,(e=>{this.template=e;this.loading=false}))}unlistenToTemplate(){if(this.templateListenerId){y.store.delListener(this.templateListenerId);this.templateListenerId=null}}onTemplateIdChanged(e){console.log("[BUILD_TABS] Template ID changed",e);this.listenToTemplate()}onStepChanged(e){console.log("[BUILD_TABS] Step changed",e)}async componentWillLoad(){var e,t,i;try{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(o){console.log("[BUILD_TABS] Error loading template",o);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new w(o.message,(t=o.response)===null||t===void 0?void 0:t.status,(i=o.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,s,n,l,r,a,d,c;if(this.loading){return i(o,null,i("verdocs-loader",null))}if(!this.endpoint.session){return i(o,null,i("verdocs-component-error",{message:"You must be authenticated to use this module."}))}const h=(((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&&(((s=this.template)===null||s===void 0?void 0:s.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(o,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:te},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:ie,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)?L(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"]}}};se.style=ee;const ne="@-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 le=ne;const re='<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 ae='<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 de='<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 ce='<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 he='<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 ue='<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 fe='<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 pe='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24" stroke-width="1.5" stroke="currentColor"><path stroke="#ffffff" stroke-linecap="round" stroke-linejoin="round" d="M3 4.5h14.25M3 9h9.75M3 13.5h9.75m4.5-4.5v12m0 0l-3.75-3.75M17.25 21L21 17.25" /></svg>';const ve='<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 me='<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 ge=[{id:"signature",tooltip:"Signature",icon:he,class:"signature"},{id:"initial",tooltip:"Initials",icon:ue,class:"initial"},{id:"sep1",tooltip:"",icon:me,class:"separator"},{id:"textbox",tooltip:"Text Box",icon:re,class:"textbox"},{id:"checkbox",tooltip:"Check Box",icon:ae,class:"checkbox"},{id:"radio",tooltip:"Radio Button",icon:de,class:"radio"},{id:"dropdown",tooltip:"Dropdown",icon:pe,class:"dropdown"},{id:"sep2",tooltip:"",icon:me,class:"separator"},{id:"date",tooltip:"Date",icon:ce,class:"date"},{id:"timestamp",tooltip:"Timestamp",icon:fe,class:"timestamp"},{id:"attachment",tooltip:"Attachment",icon:ve,class:"attachment"}];const be=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(o){console.log("[FIELDS] Error with fields session",o);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new w(o.message,(t=o.response)===null||t===void 0?void 0:t.status,(i=o.response)===null||i===void 0?void 0:i.data))}}componentDidRender(){D.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();y.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){y.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){D(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 o=+(e.target.getAttribute("xScale")||1);const s=+(e.target.getAttribute("yScale")||1);const n=e.dx/o+t;const l=e.dy/s+i;e.target.setAttribute("posX",n);e.target.setAttribute("posy",l);H(e.target,"translate",`${n}px, ${l}px`)}async handleMoveEnd(e){var t,i,o,s,n,l,r,a;const d=e.target.getAttribute("fieldname");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||N(c.type);const k=c.height||_(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,((s=(o=((i=this.template)===null||i===void 0?void 0:i.documents)||[])===null||o===void 0?void 0:o[0])===null||s===void 0?void 0:s.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:M,y:T}=this.viewCoordinatesToPageCoordinates(S,q,h,u-x,f-k);try{const t={x:M,y:T,page:C};const i=await m(this.endpoint,this.templateId,d,t);console.log("[FIELDS] Updated",i);const o=JSON.parse(JSON.stringify(this.template));const s=o.fields.findIndex((e=>e.name===d));if(s>-1){o.fields[s]=i}y.updateTemplate(this.templateId,o);e.target.removeAttribute("posX");e.target.removeAttribute("posY");Z(e.target);const{xScale:l=1,yScale:r=1}=this.cachedPageInfo[h];z(e.target,i,l,r);(n=this.templateUpdated)===null||n===void 0?void 0:n.emit({endpoint:this.endpoint,template:o,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 w(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 o=1;let s;do{s=`${e}P${t}-${o}`;o++}while((((i=this.template)===null||i===void 0?void 0:i.fields)||[]).some((e=>e&&e.name===s)));return s}viewCoordinatesToPageCoordinates(e,t,i,o,s){const{xScale:n=1,yScale:l=1,renderedHeight:r=792}=this.cachedPageInfo[i];const a=Math.floor(Math.min(e/n,o));const d=Math.floor(Math.min(Math.max(r-t,0)/l,s));return{x:a,y:d}}async handleClickPage(e,t){var i;if(this.placing){const o=e.offsetX;const s=e.offsetY;const n=N(this.placing);const l=_(this.placing);const r=this.cachedPageInfo[t];const{naturalWidth:a=612,naturalHeight:d=792}=r;const c=this.viewCoordinatesToPageCoordinates(o,s,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);y.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,s;if(this.loading){return i(o,null,i("verdocs-loader",null))}if(!this.endpoint.session){return i(o,null,i("verdocs-component-error",{message:"You must be authenticated to use this module."}))}const n=(((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(o,{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}),ge.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 o=e.page_sizes[t];return i("verdocs-template-document-page",{templateId:this.templateId,documentId:e.id,pageNumber:t,virtualWidth:(o===null||o===void 0?void 0:o.width)||612,virtualHeight:(o===null||o===void 0?void 0:o.height)||792,disabled:true,editable:true,done:false,onClick: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:(((s=this.template)===null||s===void 0?void 0:s.roles)||[]).length>0?"Please select a role before adding fields.":"Please add at least one role before adding fields.",onNext:()=>this.showMustSelectRole=false}))}static get watchers(){return{templateId:["onTemplateIdChanged"]}}};be.style=le;
2
- /**!
3
- * Sortable 1.15.6
4
- * @author RubaXa <trash@rubaxa.org>
5
- * @author owenm <owen23355@gmail.com>
6
- * @license MIT
7
- */function xe(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);if(t){o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))}i.push.apply(i,o)}return i}function we(e){for(var t=1;t<arguments.length;t++){var i=arguments[t]!=null?arguments[t]:{};if(t%2){xe(Object(i),true).forEach((function(t){Ee(e,t,i[t])}))}else if(Object.getOwnPropertyDescriptors){Object.defineProperties(e,Object.getOwnPropertyDescriptors(i))}else{xe(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}}return e}function ye(e){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){ye=function(e){return typeof e}}else{ye=function(e){return e&&typeof Symbol==="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e}}return ye(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 ke(){ke=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var o in i){if(Object.prototype.hasOwnProperty.call(i,o)){e[o]=i[o]}}}return e};return ke.apply(this,arguments)}function Se(e,t){if(e==null)return{};var i={};var o=Object.keys(e);var s,n;for(n=0;n<o.length;n++){s=o[n];if(t.indexOf(s)>=0)continue;i[s]=e[s]}return i}function qe(e,t){if(e==null)return{};var i=Se(e,t);var o,s;if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(s=0;s<n.length;s++){o=n[s];if(t.indexOf(o)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(e,o))continue;i[o]=e[o]}}return i}var Ce="1.15.6";function Me(e){if(typeof window!=="undefined"&&window.navigator){return!!navigator.userAgent.match(e)}}var Te=Me(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i);var Ie=Me(/Edge/i);var Le=Me(/firefox/i);var De=Me(/safari/i)&&!Me(/chrome/i)&&!Me(/android/i);var He=Me(/iP(ad|od|hone)/i);var Ze=Me(/chrome/i)&&Me(/android/i);var ze={capture:false,passive:false};function Oe(e,t,i){e.addEventListener(t,i,!Te&&ze)}function Ne(e,t,i){e.removeEventListener(t,i,!Te&&ze)}function _e(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 Ve(e){return e.host&&e!==document&&e.host.nodeType?e.host:e.parentNode}function Re(e,t,i,o){if(e){i=i||document;do{if(t!=null&&(t[0]===">"?e.parentNode===i&&_e(e,t):_e(e,t))||o&&e===i){return e}if(e===i)break}while(e=Ve(e))}return null}var Ae=/\s+/g;function je(e,t,i){if(e&&t){if(e.classList){e.classList[i?"add":"remove"](t)}else{var o=(" "+e.className+" ").replace(Ae," ").replace(" "+t+" "," ");e.className=(o+(i?" "+t:"")).replace(Ae," ")}}}function Ue(e,t,i){var o=e&&e.style;if(o){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 o)&&t.indexOf("webkit")===-1){t="-webkit-"+t}o[t]=i+(typeof i==="string"?"":"px")}}}function Be(e,t){var i="";if(typeof e==="string"){i=e}else{do{var o=Ue(e,"transform");if(o&&o!=="none"){i=o+" "+i}}while(!t&&(e=e.parentNode))}var s=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return s&&new s(i)}function Pe(e,t,i){if(e){var o=e.getElementsByTagName(t),s=0,n=o.length;if(i){for(;s<n;s++){i(o[s],s)}}return o}return[]}function $e(){var e=document.scrollingElement;if(e){return e}else{return document.documentElement}}function Qe(e,t,i,o,s){if(!e.getBoundingClientRect&&e!==window)return;var n,l,r,a,d,c,h;if(e!==window&&e.parentNode&&e!==$e()){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){s=s||e.parentNode;if(!Te){do{if(s&&s.getBoundingClientRect&&(Ue(s,"transform")!=="none"||i&&Ue(s,"position")!=="static")){var u=s.getBoundingClientRect();l-=u.top+parseInt(Ue(s,"border-top-width"));r-=u.left+parseInt(Ue(s,"border-left-width"));a=l+n.height;d=r+n.width;break}}while(s=s.parentNode)}}if(o&&e!==window){var f=Be(s||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 Fe(e,t,i){var o=Ke(e,true),s=Qe(e)[t];while(o){var n=Qe(o)[i],l=void 0;if(i==="top"||i==="left"){l=s>=n}else{l=s<=n}if(!l)return o;if(o===$e())break;o=Ke(o,false)}return false}function We(e,t,i,o){var s=0,n=0,l=e.children;while(n<l.length){if(l[n].style.display!=="none"&&l[n]!==hi.ghost&&(o||l[n]!==hi.dragged)&&Re(l[n],i.draggable,e,false)){if(s===t){return l[n]}s++}n++}return null}function Ye(e,t){var i=e.lastElementChild;while(i&&(i===hi.ghost||Ue(i,"display")==="none"||t&&!_e(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!==hi.clone&&(!t||_e(e,t))){i++}}return i}function Ge(e){var t=0,i=0,o=$e();if(e){do{var s=Be(e),n=s.a,l=s.d;t+=e.scrollLeft*n;i+=e.scrollTop*l}while(e!==o&&(e=e.parentNode))}return[t,i]}function Xe(e,t){for(var i in e){if(!e.hasOwnProperty(i))continue;for(var o in t){if(t.hasOwnProperty(o)&&t[o]===e[i][o])return Number(i)}}return-1}function Ke(e,t){if(!e||!e.getBoundingClientRect)return $e();var i=e;var o=false;do{if(i.clientWidth<i.scrollWidth||i.clientHeight<i.scrollHeight){var s=Ue(i);if(i.clientWidth<i.scrollWidth&&(s.overflowX=="auto"||s.overflowX=="scroll")||i.clientHeight<i.scrollHeight&&(s.overflowY=="auto"||s.overflowY=="scroll")){if(!i.getBoundingClientRect||i===document.body)return $e();if(o||t)return i;o=true}}}while(i=i.parentNode);return $e()}function et(e,t){if(e&&t){for(var i in t){if(t.hasOwnProperty(i)){e[i]=t[i]}}}return e}function tt(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 it;function ot(e,t){return function(){if(!it){var i=arguments,o=this;if(i.length===1){e.call(o,i[0])}else{e.apply(o,i)}it=setTimeout((function(){it=void 0}),t)}}}function st(){clearTimeout(it);it=void 0}function nt(e,t,i){e.scrollLeft+=t;e.scrollTop+=i}function lt(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 rt(e,t,i){var o={};Array.from(e.children).forEach((function(s){var n,l,r,a;if(!Re(s,t.draggable,e,false)||s.animated||s===i)return;var d=Qe(s);o.left=Math.min((n=o.left)!==null&&n!==void 0?n:Infinity,d.left);o.top=Math.min((l=o.top)!==null&&l!==void 0?l:Infinity,d.top);o.right=Math.max((r=o.right)!==null&&r!==void 0?r:-Infinity,d.right);o.bottom=Math.max((a=o.bottom)!==null&&a!==void 0?a:-Infinity,d.bottom)}));o.width=o.right-o.left;o.height=o.bottom-o.top;o.x=o.left;o.y=o.top;return o}var at="Sortable"+(new Date).getTime();function dt(){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(Ue(t,"display")==="none"||t===hi.ghost)return;e.push({target:t,rect:Qe(t)});var i=we({},e[e.length-1].rect);if(t.thisAnimationDuration){var o=Be(t,true);if(o){i.top-=o.f;i.left-=o.e}}t.fromRect=i}))},addAnimationState:function t(i){e.push(i)},removeAnimationState:function t(i){e.splice(Xe(e,{target:i}),1)},animateAll:function i(o){var s=this;if(!this.options.animation){clearTimeout(t);if(typeof o==="function")o();return}var n=false,l=0;e.forEach((function(e){var t=0,i=e.target,o=i.fromRect,r=Qe(i),a=i.prevFromRect,d=i.prevToRect,c=e.rect,h=Be(i,true);if(h){r.top-=h.f;r.left-=h.e}i.toRect=r;if(i.thisAnimationDuration){if(tt(a,r)&&!tt(o,r)&&(c.top-r.top)/(c.left-r.left)===(o.top-r.top)/(o.left-r.left)){t=ht(c,a,d,s.options)}}if(!tt(r,o)){i.prevFromRect=o;i.prevToRect=r;if(!t){t=s.options.animation}s.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 o==="function")o()}else{t=setTimeout((function(){if(typeof o==="function")o()}),l)}e=[]},animate:function e(t,i,o,s){if(s){Ue(t,"transition","");Ue(t,"transform","");var n=Be(this.el),l=n&&n.a,r=n&&n.d,a=(i.left-o.left)/(l||1),d=(i.top-o.top)/(r||1);t.animatingX=!!a;t.animatingY=!!d;Ue(t,"transform","translate3d("+a+"px,"+d+"px,0)");this.forRepaintDummy=ct(t);Ue(t,"transition","transform "+s+"ms"+(this.options.easing?" "+this.options.easing:""));Ue(t,"transform","translate3d(0,0,0)");typeof t.animated==="number"&&clearTimeout(t.animated);t.animated=setTimeout((function(){Ue(t,"transition","");Ue(t,"transform","");t.animated=false;t.animatingX=false;t.animatingY=false}),s)}}}}function ct(e){return e.offsetWidth}function ht(e,t,i,o){return Math.sqrt(Math.pow(t.top-e.top,2)+Math.pow(t.left-e.left,2))/Math.sqrt(Math.pow(t.top-i.top,2)+Math.pow(t.left-i.left,2))*o.animation}var ut=[];var ft={initializeByDefault:true};var pt={mount:function e(t){for(var i in ft){if(ft.hasOwnProperty(i)&&!(i in t)){t[i]=ft[i]}}ut.forEach((function(e){if(e.pluginName===t.pluginName){throw"Sortable: Cannot mount plugin ".concat(t.pluginName," more than once")}}));ut.push(t)},pluginEvent:function e(t,i,o){var s=this;this.eventCanceled=false;o.cancel=function(){s.eventCanceled=true};var n=t+"Global";ut.forEach((function(e){if(!i[e.pluginName])return;if(i[e.pluginName][n]){i[e.pluginName][n](we({sortable:i},o))}if(i.options[e.pluginName]&&i[e.pluginName][t]){i[e.pluginName][t](we({sortable:i},o))}}))},initializePlugins:function e(t,i,o,s){ut.forEach((function(e){var s=e.pluginName;if(!t.options[s]&&!e.initializeByDefault)return;var n=new e(t,i,t.options);n.sortable=t;n.options=t.options;t[s]=n;ke(o,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 o={};ut.forEach((function(e){if(typeof e.eventProperties!=="function")return;ke(o,e.eventProperties.call(i[e.pluginName],t))}));return o},modifyOption:function e(t,i,o){var s;ut.forEach((function(e){if(!t[e.pluginName])return;if(e.optionListeners&&typeof e.optionListeners[i]==="function"){s=e.optionListeners[i].call(t[e.pluginName],o)}}));return s}};function vt(e){var t=e.sortable,i=e.rootEl,o=e.name,s=e.targetEl,n=e.cloneEl,l=e.toEl,r=e.fromEl,a=e.oldIndex,d=e.newIndex,c=e.oldDraggableIndex,h=e.newDraggableIndex,u=e.originalEvent,f=e.putSortable,p=e.extraEventProperties;t=t||i&&i[at];if(!t)return;var v,m=t.options,g="on"+o.charAt(0).toUpperCase()+o.substr(1);if(window.CustomEvent&&!Te&&!Ie){v=new CustomEvent(o,{bubbles:true,cancelable:true})}else{v=document.createEvent("Event");v.initEvent(o,true,true)}v.to=l||i;v.from=r||i;v.item=s||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=we(we({},p),pt.getEventProperties(o,t));for(var x in b){v[x]=b[x]}if(i){i.dispatchEvent(v)}if(m[g]){m[g].call(t,v)}}var mt=["evt"];var gt=function e(t,i){var o=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{},s=o.evt,n=qe(o,mt);pt.pluginEvent.bind(hi)(t,i,we({dragEl:xt,parentEl:wt,ghostEl:yt,rootEl:Et,nextEl:kt,lastDownEl:St,cloneEl:qt,cloneHidden:Ct,dragStarted:Ut,putSortable:Ht,activeSortable:hi.active,originalEvent:s,oldIndex:Mt,oldDraggableIndex:It,newIndex:Tt,newDraggableIndex:Lt,hideGhostForTarget:ri,unhideGhostForTarget:ai,cloneNowHidden:function e(){Ct=true},cloneNowShown:function e(){Ct=false},dispatchSortableEvent:function e(t){bt({sortable:i,name:t,originalEvent:s})}},n))};function bt(e){vt(we({putSortable:Ht,cloneEl:qt,targetEl:xt,rootEl:Et,oldIndex:Mt,oldDraggableIndex:It,newIndex:Tt,newDraggableIndex:Lt},e))}var xt,wt,yt,Et,kt,St,qt,Ct,Mt,Tt,It,Lt,Dt,Ht,Zt=false,zt=false,Ot=[],Nt,_t,Vt,Rt,At,jt,Ut,Bt,Pt,$t=false,Qt=false,Ft,Wt,Yt=[],Jt=false,Gt=[];var Xt=typeof document!=="undefined",Kt=He,ei=Ie||Te?"cssFloat":"float",ti=Xt&&!Ze&&!He&&"draggable"in document.createElement("div"),ii=function(){if(!Xt)return;if(Te){return false}var e=document.createElement("x");e.style.cssText="pointer-events:auto";return e.style.pointerEvents==="auto"}(),oi=function e(t,i){var o=Ue(t),s=parseInt(o.width)-parseInt(o.paddingLeft)-parseInt(o.paddingRight)-parseInt(o.borderLeftWidth)-parseInt(o.borderRightWidth),n=We(t,0,i),l=We(t,1,i),r=n&&Ue(n),a=l&&Ue(l),d=r&&parseInt(r.marginLeft)+parseInt(r.marginRight)+Qe(n).width,c=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+Qe(l).width;if(o.display==="flex"){return o.flexDirection==="column"||o.flexDirection==="column-reverse"?"vertical":"horizontal"}if(o.display==="grid"){return o.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>=s&&o[ei]==="none"||l&&o[ei]==="none"&&d+c>s)?"vertical":"horizontal"},si=function e(t,i,o){var s=o?t.left:t.top,n=o?t.right:t.bottom,l=o?t.width:t.height,r=o?i.left:i.top,a=o?i.right:i.bottom,d=o?i.width:i.height;return s===r||n===a||s+l/2===r+d/2},ni=function e(t,i){var o;Ot.some((function(e){var s=e[at].options.emptyInsertThreshold;if(!s||Ye(e))return;var n=Qe(e),l=t>=n.left-s&&t<=n.right+s,r=i>=n.top-s&&i<=n.bottom+s;if(l&&r){return o=e}}));return o},li=function e(t){function i(e,t){return function(o,s,n,l){var r=o.options.group.name&&s.options.group.name&&o.options.group.name===s.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(o,s,n,l),t)(o,s,n,l)}else{var a=(t?o:s).options.group.name;return e===true||typeof e==="string"&&e===a||e.join&&e.indexOf(a)>-1}}}var o={};var s=t.group;if(!s||ye(s)!="object"){s={name:s}}o.name=s.name;o.checkPull=i(s.pull,true);o.checkPut=i(s.put);o.revertClone=s.revertClone;t.group=o},ri=function e(){if(!ii&&yt){Ue(yt,"display","none")}},ai=function e(){if(!ii&&yt){Ue(yt,"display","")}};if(Xt&&!Ze){document.addEventListener("click",(function(e){if(zt){e.preventDefault();e.stopPropagation&&e.stopPropagation();e.stopImmediatePropagation&&e.stopImmediatePropagation();zt=false;return false}}),true)}var di=function e(t){if(xt){t=t.touches?t.touches[0]:t;var i=ni(t.clientX,t.clientY);if(i){var o={};for(var s in t){if(t.hasOwnProperty(s)){o[s]=t[s]}}o.target=o.rootEl=i;o.preventDefault=void 0;o.stopPropagation=void 0;i[at]._onDragOver(o)}}};var ci=function e(t){if(xt){xt.parentNode[at]._isOutsideThisEl(t.target)}};function hi(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=ke({},t);e[at]=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:hi.supportPointer!==false&&"PointerEvent"in window&&(!De||He),emptyInsertThreshold:5};pt.initializePlugins(this,e,i);for(var o in i){!(o in t)&&(t[o]=i[o])}li(t);for(var s in this){if(s.charAt(0)==="_"&&typeof this[s]==="function"){this[s]=this[s].bind(this)}}this.nativeDraggable=t.forceFallback?false:ti;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)||[]);ke(this,dt())}hi.prototype={constructor:hi,_isOutsideThisEl:function e(t){if(!this.el.contains(t)&&t!==this.el){Bt=null}},_getDirection:function e(t,i){return typeof this.options.direction==="function"?this.options.direction.call(this,t,i,xt):this.options.direction},_onTapStart:function e(t){if(!t.cancelable)return;var i=this,o=this.el,s=this.options,n=s.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=s.filter;yi(o);if(xt){return}if(/mousedown|pointerdown/.test(l)&&t.button!==0||s.disabled){return}if(d.isContentEditable){return}if(!this.nativeDraggable&&De&&a&&a.tagName.toUpperCase()==="SELECT"){return}a=Re(a,s.draggable,o,false);if(a&&a.animated){return}if(St===a){return}Mt=Je(a);It=Je(a,s.draggable);if(typeof c==="function"){if(c.call(this,t,a,this)){bt({sortable:i,rootEl:d,name:"filter",targetEl:a,toEl:o,fromEl:o});gt("filter",i,{evt:t});n&&t.preventDefault();return}}else if(c){c=c.split(",").some((function(e){e=Re(d,e.trim(),o,false);if(e){bt({sortable:i,rootEl:e,name:"filter",targetEl:a,fromEl:o,toEl:o});gt("filter",i,{evt:t});return true}}));if(c){n&&t.preventDefault();return}}if(s.handle&&!Re(d,s.handle,o,false)){return}this._prepareDragStart(t,r,a)},_prepareDragStart:function e(t,i,o){var s=this,n=s.el,l=s.options,r=n.ownerDocument,a;if(o&&!xt&&o.parentNode===n){var d=Qe(o);Et=n;xt=o;wt=xt.parentNode;kt=xt.nextSibling;St=o;Dt=l.group;hi.dragged=xt;Nt={target:xt,clientX:(i||t).clientX,clientY:(i||t).clientY};At=Nt.clientX-d.left;jt=Nt.clientY-d.top;this._lastX=(i||t).clientX;this._lastY=(i||t).clientY;xt.style["will-change"]="all";a=function e(){gt("delayEnded",s,{evt:t});if(hi.eventCanceled){s._onDrop();return}s._disableDelayedDragEvents();if(!Le&&s.nativeDraggable){xt.draggable=true}s._triggerDragStart(t,i);bt({sortable:s,name:"choose",originalEvent:t});je(xt,l.chosenClass,true)};l.ignore.split(",").forEach((function(e){Pe(xt,e.trim(),pi)}));Oe(r,"dragover",di);Oe(r,"mousemove",di);Oe(r,"touchmove",di);if(l.supportPointer){Oe(r,"pointerup",s._onDrop);!this.nativeDraggable&&Oe(r,"pointercancel",s._onDrop)}else{Oe(r,"mouseup",s._onDrop);Oe(r,"touchend",s._onDrop);Oe(r,"touchcancel",s._onDrop)}if(Le&&this.nativeDraggable){this.options.touchStartThreshold=4;xt.draggable=true}gt("delayStart",this,{evt:t});if(l.delay&&(!l.delayOnTouchOnly||i)&&(!this.nativeDraggable||!(Ie||Te))){if(hi.eventCanceled){this._onDrop();return}if(l.supportPointer){Oe(r,"pointerup",s._disableDelayedDrag);Oe(r,"pointercancel",s._disableDelayedDrag)}else{Oe(r,"mouseup",s._disableDelayedDrag);Oe(r,"touchend",s._disableDelayedDrag);Oe(r,"touchcancel",s._disableDelayedDrag)}Oe(r,"mousemove",s._delayedDragTouchMoveHandler);Oe(r,"touchmove",s._delayedDragTouchMoveHandler);l.supportPointer&&Oe(r,"pointermove",s._delayedDragTouchMoveHandler);s._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(){xt&&pi(xt);clearTimeout(this._dragStartTimer);this._disableDelayedDragEvents()},_disableDelayedDragEvents:function e(){var t=this.el.ownerDocument;Ne(t,"mouseup",this._disableDelayedDrag);Ne(t,"touchend",this._disableDelayedDrag);Ne(t,"touchcancel",this._disableDelayedDrag);Ne(t,"pointerup",this._disableDelayedDrag);Ne(t,"pointercancel",this._disableDelayedDrag);Ne(t,"mousemove",this._delayedDragTouchMoveHandler);Ne(t,"touchmove",this._delayedDragTouchMoveHandler);Ne(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(xt,"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&&xt){gt("dragStarted",this,{evt:i});if(this.nativeDraggable){Oe(document,"dragover",ci)}var o=this.options;!t&&je(xt,o.dragClass,false);je(xt,o.ghostClass,true);hi.active=this;t&&this._appendGhost();bt({sortable:this,name:"start",originalEvent:i})}else{this._nulling()}},_emulateDragOver:function e(){if(_t){this._lastX=_t.clientX;this._lastY=_t.clientY;ri();var t=document.elementFromPoint(_t.clientX,_t.clientY);var i=t;while(t&&t.shadowRoot){t=t.shadowRoot.elementFromPoint(_t.clientX,_t.clientY);if(t===i)break;i=t}xt.parentNode[at]._isOutsideThisEl(t);if(i){do{if(i[at]){var o=void 0;o=i[at]._onDragOver({clientX:_t.clientX,clientY:_t.clientY,target:t,rootEl:i});if(o&&!this.options.dragoverBubble){break}}t=i}while(i=Ve(i))}ai()}},_onTouchMove:function e(t){if(Nt){var i=this.options,o=i.fallbackTolerance,s=i.fallbackOffset,n=t.touches?t.touches[0]:t,l=yt&&Be(yt,true),r=yt&&l&&l.a,a=yt&&l&&l.d,d=Kt&&Wt&&Ge(Wt),c=(n.clientX-Nt.clientX+s.x)/(r||1)+(d?d[0]-Yt[0]:0)/(r||1),h=(n.clientY-Nt.clientY+s.y)/(a||1)+(d?d[1]-Yt[1]:0)/(a||1);if(!hi.active&&!Zt){if(o&&Math.max(Math.abs(n.clientX-this._lastX),Math.abs(n.clientY-this._lastY))<o){return}this._onDragStart(t,true)}if(yt){if(l){l.e+=c-(Vt||0);l.f+=h-(Rt||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,")");Ue(yt,"webkitTransform",u);Ue(yt,"mozTransform",u);Ue(yt,"msTransform",u);Ue(yt,"transform",u);Vt=c;Rt=h;_t=n}t.cancelable&&t.preventDefault()}},_appendGhost:function e(){if(!yt){var t=this.options.fallbackOnBody?document.body:Et,i=Qe(xt,true,Kt,true,t),o=this.options;if(Kt){Wt=t;while(Ue(Wt,"position")==="static"&&Ue(Wt,"transform")==="none"&&Wt!==document){Wt=Wt.parentNode}if(Wt!==document.body&&Wt!==document.documentElement){if(Wt===document)Wt=$e();i.top+=Wt.scrollTop;i.left+=Wt.scrollLeft}else{Wt=$e()}Yt=Ge(Wt)}yt=xt.cloneNode(true);je(yt,o.ghostClass,false);je(yt,o.fallbackClass,true);je(yt,o.dragClass,true);Ue(yt,"transition","");Ue(yt,"transform","");Ue(yt,"box-sizing","border-box");Ue(yt,"margin",0);Ue(yt,"top",i.top);Ue(yt,"left",i.left);Ue(yt,"width",i.width);Ue(yt,"height",i.height);Ue(yt,"opacity","0.8");Ue(yt,"position",Kt?"absolute":"fixed");Ue(yt,"zIndex","100000");Ue(yt,"pointerEvents","none");hi.ghost=yt;t.appendChild(yt);Ue(yt,"transform-origin",At/parseInt(yt.style.width)*100+"% "+jt/parseInt(yt.style.height)*100+"%")}},_onDragStart:function e(t,i){var o=this;var s=t.dataTransfer;var n=o.options;gt("dragStart",this,{evt:t});if(hi.eventCanceled){this._onDrop();return}gt("setupClone",this);if(!hi.eventCanceled){qt=lt(xt);qt.removeAttribute("id");qt.draggable=false;qt.style["will-change"]="";this._hideClone();je(qt,this.options.chosenClass,false);hi.clone=qt}o.cloneId=Ei((function(){gt("clone",o);if(hi.eventCanceled)return;if(!o.options.removeCloneOnHide){Et.insertBefore(qt,xt)}o._hideClone();bt({sortable:o,name:"clone"})}));!i&&je(xt,n.dragClass,true);if(i){zt=true;o._loopId=setInterval(o._emulateDragOver,50)}else{Ne(document,"mouseup",o._onDrop);Ne(document,"touchend",o._onDrop);Ne(document,"touchcancel",o._onDrop);if(s){s.effectAllowed="move";n.setData&&n.setData.call(o,s,xt)}Oe(document,"drop",o);Ue(xt,"transform","translateZ(0)")}Zt=true;o._dragStartId=Ei(o._dragStarted.bind(o,i,t));Oe(document,"selectstart",o);Ut=true;window.getSelection().removeAllRanges();if(De){Ue(document.body,"user-select","none")}},_onDragOver:function e(t){var i=this.el,o=t.target,s,n,l,r=this.options,a=r.group,d=hi.active,c=Dt===a,h=r.sort,u=Ht||d,f,p=this,v=false;if(Jt)return;function m(e,r){gt(e,p,we({evt:t,isOwner:c,axis:f?"vertical":"horizontal",revert:l,dragRect:s,targetRect:n,canSort:h,fromSortable:u,target:o,completed:b,onMove:function e(o,n){return fi(Et,i,xt,s,o,Qe(o),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(xt,Ht?Ht.options.ghostClass:d.options.ghostClass,false);je(xt,r.ghostClass,true)}if(Ht!==p&&p!==hi.active){Ht=p}else if(p===hi.active&&Ht){Ht=null}if(u===p){p._ignoreWhileAnimating=o}p.animateAll((function(){m("dragOverAnimationComplete");p._ignoreWhileAnimating=null}));if(p!==u){u.animateAll();u._ignoreWhileAnimating=null}}if(o===xt&&!xt.animated||o===i&&!o.animated){Bt=null}if(!r.dragoverBubble&&!t.rootEl&&o!==document){xt.parentNode[at]._isOutsideThisEl(t.target);!e&&di(t)}!r.dragoverBubble&&t.stopPropagation&&t.stopPropagation();return v=true}function x(){Tt=Je(xt);Lt=Je(xt,r.draggable);bt({sortable:p,name:"change",toEl:i,newIndex:Tt,newDraggableIndex:Lt,originalEvent:t})}if(t.preventDefault!==void 0){t.cancelable&&t.preventDefault()}o=Re(o,r.draggable,i,true);m("dragOver");if(hi.eventCanceled)return v;if(xt.contains(t.target)||o.animated&&o.animatingX&&o.animatingY||p._ignoreWhileAnimating===o){return b(false)}zt=false;if(d&&!r.disabled&&(c?h||(l=wt!==Et):Ht===this||(this.lastPutMode=Dt.checkPull(this,d,xt,t))&&a.checkPut(this,d,xt,t))){f=this._getDirection(t,o)==="vertical";s=Qe(xt);m("dragOverValid");if(hi.eventCanceled)return v;if(l){wt=Et;g();this._hideClone();m("revert");if(!hi.eventCanceled){if(kt){Et.insertBefore(xt,kt)}else{Et.appendChild(xt)}}return b(true)}var w=Ye(i,r.draggable);if(!w||gi(t,f,this)&&!w.animated){if(w===xt){return b(false)}if(w&&i===t.target){o=w}if(o){n=Qe(o)}if(fi(Et,i,xt,s,o,n,t,!!o)!==false){g();if(w&&w.nextSibling){i.insertBefore(xt,w.nextSibling)}else{i.appendChild(xt)}wt=i;x();return b(true)}}else if(w&&mi(t,f,this)){var y=We(i,0,r,true);if(y===xt){return b(false)}o=y;n=Qe(o);if(fi(Et,i,xt,s,o,n,t,false)!==false){g();i.insertBefore(xt,y);wt=i;x();return b(true)}}else if(o.parentNode===i){n=Qe(o);var E=0,k,S=xt.parentNode!==i,q=!si(xt.animated&&xt.toRect||s,o.animated&&o.toRect||n,f),C=f?"top":"left",M=Fe(o,"top","top")||Fe(xt,"top","top"),T=M?M.scrollTop:void 0;if(Bt!==o){k=n[C];$t=false;Qt=!q&&r.invertSwap||S}E=bi(t,o,n,f,q?1:r.swapThreshold,r.invertedSwapThreshold==null?r.swapThreshold:r.invertedSwapThreshold,Qt,Bt===o);var I;if(E!==0){var L=Je(xt);do{L-=E;I=wt.children[L]}while(I&&(Ue(I,"display")==="none"||I===yt))}if(E===0||I===o){return b(false)}Bt=o;Pt=E;var D=o.nextElementSibling,H=false;H=E===1;var Z=fi(Et,i,xt,s,o,n,t,H);if(Z!==false){if(Z===1||Z===-1){H=Z===1}Jt=true;setTimeout(vi,30);g();if(H&&!D){i.appendChild(xt)}else{o.parentNode.insertBefore(xt,H?D:o)}if(M){nt(M,0,T-M.scrollTop)}wt=xt.parentNode;if(k!==undefined&&!Qt){Ft=Math.abs(k-Qe(o)[C])}x();return b(true)}}if(i.contains(xt)){return b(false)}}return false},_ignoreWhileAnimating:null,_offMoveEvents:function e(){Ne(document,"mousemove",this._onTouchMove);Ne(document,"touchmove",this._onTouchMove);Ne(document,"pointermove",this._onTouchMove);Ne(document,"dragover",di);Ne(document,"mousemove",di);Ne(document,"touchmove",di)},_offUpEvents:function e(){var t=this.el.ownerDocument;Ne(t,"mouseup",this._onDrop);Ne(t,"touchend",this._onDrop);Ne(t,"pointerup",this._onDrop);Ne(t,"pointercancel",this._onDrop);Ne(t,"touchcancel",this._onDrop);Ne(document,"selectstart",this)},_onDrop:function e(t){var i=this.el,o=this.options;Tt=Je(xt);Lt=Je(xt,o.draggable);gt("drop",this,{evt:t});wt=xt&&xt.parentNode;Tt=Je(xt);Lt=Je(xt,o.draggable);if(hi.eventCanceled){this._nulling();return}Zt=false;Qt=false;$t=false;clearInterval(this._loopId);clearTimeout(this._dragStartTimer);ki(this.cloneId);ki(this._dragStartId);if(this.nativeDraggable){Ne(document,"drop",this);Ne(i,"dragstart",this._onDragStart)}this._offMoveEvents();this._offUpEvents();if(De){Ue(document.body,"user-select","")}Ue(xt,"transform","");if(t){if(Ut){t.cancelable&&t.preventDefault();!o.dropBubble&&t.stopPropagation()}yt&&yt.parentNode&&yt.parentNode.removeChild(yt);if(Et===wt||Ht&&Ht.lastPutMode!=="clone"){qt&&qt.parentNode&&qt.parentNode.removeChild(qt)}if(xt){if(this.nativeDraggable){Ne(xt,"dragend",this)}pi(xt);xt.style["will-change"]="";if(Ut&&!Zt){je(xt,Ht?Ht.options.ghostClass:this.options.ghostClass,false)}je(xt,this.options.chosenClass,false);bt({sortable:this,name:"unchoose",toEl:wt,newIndex:null,newDraggableIndex:null,originalEvent:t});if(Et!==wt){if(Tt>=0){bt({rootEl:wt,name:"add",toEl:wt,fromEl:Et,originalEvent:t});bt({sortable:this,name:"remove",toEl:wt,originalEvent:t});bt({rootEl:wt,name:"sort",toEl:wt,fromEl:Et,originalEvent:t});bt({sortable:this,name:"sort",toEl:wt,originalEvent:t})}Ht&&Ht.save()}else{if(Tt!==Mt){if(Tt>=0){bt({sortable:this,name:"update",toEl:wt,originalEvent:t});bt({sortable:this,name:"sort",toEl:wt,originalEvent:t})}}}if(hi.active){if(Tt==null||Tt===-1){Tt=Mt;Lt=It}bt({sortable:this,name:"end",toEl:wt,originalEvent:t});this.save()}}}this._nulling()},_nulling:function e(){gt("nulling",this);Et=xt=wt=yt=kt=qt=St=Ct=Nt=_t=Ut=Tt=Lt=Mt=It=Bt=Pt=Ht=Dt=hi.dragged=hi.ghost=hi.clone=hi.active=null;Gt.forEach((function(e){e.checked=true}));Gt.length=Vt=Rt=0},handleEvent:function e(t){switch(t.type){case"drop":case"dragend":this._onDrop(t);break;case"dragenter":case"dragover":if(xt){this._onDragOver(t);ui(t)}break;case"selectstart":t.preventDefault();break}},toArray:function e(){var t=[],i,o=this.el.children,s=0,n=o.length,l=this.options;for(;s<n;s++){i=o[s];if(Re(i,l.draggable,this.el,false)){t.push(i.getAttribute(l.dataIdAttr)||wi(i))}}return t},sort:function e(t,i){var o={},s=this.el;this.toArray().forEach((function(e,t){var i=s.children[t];if(Re(i,this.options.draggable,s,false)){o[e]=i}}),this);i&&this.captureAnimationState();t.forEach((function(e){if(o[e]){s.removeChild(o[e]);s.appendChild(o[e])}}));i&&this.animateAll()},save:function e(){var t=this.options.store;t&&t.set&&t.set(this)},closest:function e(t,i){return Re(t,i||this.options.draggable,this.el,false)},option:function e(t,i){var o=this.options;if(i===void 0){return o[t]}else{var s=pt.modifyOption(this,t,i);if(typeof s!=="undefined"){o[t]=s}else{o[t]=i}if(t==="group"){li(o)}}},destroy:function e(){gt("destroy",this);var t=this.el;t[at]=null;Ne(t,"mousedown",this._onTapStart);Ne(t,"touchstart",this._onTapStart);Ne(t,"pointerdown",this._onTapStart);if(this.nativeDraggable){Ne(t,"dragover",this);Ne(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(!Ct){gt("hideClone",this);if(hi.eventCanceled)return;Ue(qt,"display","none");if(this.options.removeCloneOnHide&&qt.parentNode){qt.parentNode.removeChild(qt)}Ct=true}},_showClone:function e(t){if(t.lastPutMode!=="clone"){this._hideClone();return}if(Ct){gt("showClone",this);if(hi.eventCanceled)return;if(xt.parentNode==Et&&!this.options.group.revertClone){Et.insertBefore(qt,xt)}else if(kt){Et.insertBefore(qt,kt)}else{Et.appendChild(qt)}if(this.options.group.revertClone){this.animate(xt,qt)}Ue(qt,"display","");Ct=false}}};function ui(e){if(e.dataTransfer){e.dataTransfer.dropEffect="move"}e.cancelable&&e.preventDefault()}function fi(e,t,i,o,s,n,l,r){var a,d=e[at],c=d.options.onMove,h;if(window.CustomEvent&&!Te&&!Ie){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=o;a.related=s||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 pi(e){e.draggable=false}function vi(){Jt=false}function mi(e,t,i){var o=Qe(We(i.el,0,i.options,true));var s=rt(i.el,i.options,yt);var n=10;return t?e.clientX<s.left-n||e.clientY<o.top&&e.clientX<o.right:e.clientY<s.top-n||e.clientY<o.bottom&&e.clientX<o.left}function gi(e,t,i){var o=Qe(Ye(i.el,i.options.draggable));var s=rt(i.el,i.options,yt);var n=10;return t?e.clientX>s.right+n||e.clientY>o.bottom&&e.clientX>o.left:e.clientY>s.bottom+n||e.clientX>o.right&&e.clientY>o.top}function bi(e,t,i,o,s,n,l,r){var a=o?e.clientY:e.clientX,d=o?i.height:i.width,c=o?i.top:i.left,h=o?i.bottom:i.right,u=false;if(!l){if(r&&Ft<d*s){if(!$t&&(Pt===1?a>c+d*n/2:a<h-d*n/2)){$t=true}if(!$t){if(Pt===1?a<c+Ft:a>h-Ft){return-Pt}}else{u=true}}else{if(a>c+d*(1-s)/2&&a<h-d*(1-s)/2){return xi(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 xi(e){if(Je(xt)<Je(e)){return 1}else{return-1}}function wi(e){var t=e.tagName+e.className+e.src+e.href+e.textContent,i=t.length,o=0;while(i--){o+=t.charCodeAt(i)}return o.toString(36)}function yi(e){Gt.length=0;var t=e.getElementsByTagName("input");var i=t.length;while(i--){var o=t[i];o.checked&&Gt.push(o)}}function Ei(e){return setTimeout(e,0)}function ki(e){return clearTimeout(e)}if(Xt){Oe(document,"touchmove",(function(e){if((hi.active||Zt)&&e.cancelable){e.preventDefault()}}))}hi.utils={on:Oe,off:Ne,css:Ue,find:Pe,is:function e(t,i){return!!Re(t,i,t,false)},extend:et,throttle:ot,closest:Re,toggleClass:je,clone:lt,index:Je,nextTick:Ei,cancelNextTick:ki,detectDirection:oi,getChild:We,expando:at};hi.get=function(e){return e[at]};hi.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)hi.utils=we(we({},hi.utils),e.utils);pt.mount(e)}))};hi.create=function(e,t){return new hi(e,t)};hi.version=Ce;var Si=[],qi,Ci,Mi=false,Ti,Ii,Li,Di;function Hi(){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){Ne(document,"dragover",this._handleAutoScroll)}else{Ne(document,"pointermove",this._handleFallbackAutoScroll);Ne(document,"touchmove",this._handleFallbackAutoScroll);Ne(document,"mousemove",this._handleFallbackAutoScroll)}zi();Zi();st()},nulling:function e(){Li=Ci=qi=Mi=Di=Ti=Ii=null;Si.length=0},_handleFallbackAutoScroll:function e(t){this._handleAutoScroll(t,true)},_handleAutoScroll:function e(t,i){var o=this;var s=(t.touches?t.touches[0]:t).clientX,n=(t.touches?t.touches[0]:t).clientY,l=document.elementFromPoint(s,n);Li=t;if(i||this.options.forceAutoScrollFallback||Ie||Te||De){Oi(t,this.options,l,i);var r=Ke(l,true);if(Mi&&(!Di||s!==Ti||n!==Ii)){Di&&zi();Di=setInterval((function(){var e=Ke(document.elementFromPoint(s,n),true);if(e!==r){r=e;Zi()}Oi(t,o.options,e,i)}),10);Ti=s;Ii=n}}else{if(!this.options.bubbleScroll||Ke(l,true)===$e()){Zi();return}Oi(t,this.options,Ke(l,false),false)}}};return ke(e,{pluginName:"scroll",initializeByDefault:true})}function Zi(){Si.forEach((function(e){clearInterval(e.pid)}));Si=[]}function zi(){clearInterval(Di)}var Oi=ot((function(e,t,i,o){if(!t.scroll)return;var s=(e.touches?e.touches[0]:e).clientX,n=(e.touches?e.touches[0]:e).clientY,l=t.scrollSensitivity,r=t.scrollSpeed,a=$e();var d=false,c;if(Ci!==i){Ci=i;Zi();qi=t.scroll;c=t.scrollFn;if(qi===true){qi=Ke(i,true)}}var h=0;var u=qi;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,E=void 0,k=f.scrollWidth,S=f.scrollHeight,q=Ue(f),C=f.scrollLeft,M=f.scrollTop;if(f===a){y=x<k&&(q.overflowX==="auto"||q.overflowX==="scroll"||q.overflowX==="visible");E=w<S&&(q.overflowY==="auto"||q.overflowY==="scroll"||q.overflowY==="visible")}else{y=x<k&&(q.overflowX==="auto"||q.overflowX==="scroll");E=w<S&&(q.overflowY==="auto"||q.overflowY==="scroll")}var T=y&&(Math.abs(b-s)<=l&&C+x<k)-(Math.abs(g-s)<=l&&!!C);var I=E&&(Math.abs(m-n)<=l&&M+w<S)-(Math.abs(v-n)<=l&&!!M);if(!Si[h]){for(var L=0;L<=h;L++){if(!Si[L]){Si[L]={}}}}if(Si[h].vx!=T||Si[h].vy!=I||Si[h].el!==f){Si[h].el=f;Si[h].vx=T;Si[h].vy=I;clearInterval(Si[h].pid);if(T!=0||I!=0){d=true;Si[h].pid=setInterval(function(){if(o&&this.layer===0){hi.active._onTouchMove(Li)}var t=Si[this.layer].vy?Si[this.layer].vy*r:0;var i=Si[this.layer].vx?Si[this.layer].vx*r:0;if(typeof c==="function"){if(c.call(hi.dragged.parentNode[at],i,t,e,Li,Si[this.layer].el)!=="continue"){return}}nt(Si[this.layer].el,i,t)}.bind({layer:h}),24)}}h++}while(t.bubbleScroll&&u!==a&&(u=Ke(u,false)));Mi=d}),30);var Ni=function e(t){var i=t.originalEvent,o=t.putSortable,s=t.dragEl,n=t.activeSortable,l=t.dispatchSortableEvent,r=t.hideGhostForTarget,a=t.unhideGhostForTarget;if(!i)return;var d=o||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:s,putSortable:o})}};function _i(){}_i.prototype={startIndex:null,dragStart:function e(t){var i=t.oldDraggableIndex;this.startIndex=i},onSpill:function e(t){var i=t.dragEl,o=t.putSortable;this.sortable.captureAnimationState();if(o){o.captureAnimationState()}var s=We(this.sortable.el,this.startIndex,this.options);if(s){this.sortable.el.insertBefore(i,s)}else{this.sortable.el.appendChild(i)}this.sortable.animateAll();if(o){o.animateAll()}},drop:Ni};ke(_i,{pluginName:"revertOnSpill"});function Vi(){}Vi.prototype={onSpill:function e(t){var i=t.dragEl,o=t.putSortable;var s=o||this.sortable;s.captureAnimationState();i.parentNode&&i.parentNode.removeChild(i);s.animateAll()},drop:Ni};ke(Vi,{pluginName:"removeOnSpill"});hi.mount(new Hi);hi.mount(Vi,_i);const Ri='@-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 Ai=Ri;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 Ui=`<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 Bi='<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 Pi=`<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 $i=`<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();y.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){y.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(o){console.log("[ROLES] Error with preview session",o);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new w(o.message,(t=o.response)===null||t===void 0?void 0:t.status,(i=o.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 hi(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 hi(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 o=+e.oldIndex+1;const s=+e.newIndex+1;console.log(`Move from ${t}:${o} to ${i}:${s}`,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(o-1,1)[0];n[i]||(n[i]=[]);n[i].splice(s-1,0,r);const a=[];Object.entries(n).forEach((([e,t])=>{t.forEach(((t,i)=>{if(!t){return}const o=+i+1;if(t.sequence!==+e||t.order!==o){t.sequence=+e;t.order=o;a.push(b(this.endpoint,this.templateId,t.name,{sequence:+e,order:o}).then((e=>console.log("[ROLES] Updated role",t.name,e))).catch((e=>console.log("[ROLES] Error updating role",e))))}}))}));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 o=this.getSequenceNumbers();(o||[]).forEach((e=>{(t[e]||[]).forEach(((t,o)=>{const s=+o+1;if(t.sequence!==+e||t.order!==s){console.log("[ROLES] Updating role",t.name,"from",t.sequence,t.order,"to",e,s);t.sequence=+e;t.order=s;i.push(b(this.endpoint,this.templateId,t.name,{sequence:+e,order:s}).then((e=>console.log("[ROLES] Updated role",t.name,e))).catch((e=>console.log("[ROLES] Error updating role",e))))}}))}));console.log(`[ROLES] Awaiting ${i.length} renumber requests`);await Promise.all(i).then((async()=>{const e=JSON.parse(JSON.stringify(this.template));e.roles=Object.keys(t).reduce(((e,i)=>e.concat(t[i])),[]);console.log("[ROLES] Done renumbering",e.roles.map((e=>({name:e.name,sequence:e.sequence,order:e.order}))));y.updateTemplate(this.templateId,e)}));(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 o=(((e=this.template)===null||e===void 0?void 0:e.roles)||[]).length;do{o++;i=`Recipient ${o}`}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 y.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 o=this.getNextRoleName();this.callCreateRole(o,t,i)}handleAddStep(e,t){e.stopPropagation();const i=1;const o=this.getNextRoleName();this.callCreateRole(o,t,i)}render(){if(!this.endpoint.session){return i(o,null,i("verdocs-component-error",{message:"You must be authenticated to use this module."}))}if(this.loading||!this.template){return i(o,{class:"loading"},i("verdocs-loader",null))}const e=this.getRoleNames();const t=this.getSequenceNumbers();const s=t&&t.length>0?(t[t.length-1]||0)+1:1;console.log("[ROLES] Rendering",{roleNames:e,sequences:t,nextSequence:s});return i(o,{class:{dragging:this.dragging}},i("form",{onSubmit:e=>e.preventDefault(),onClick:e=>e.stopPropagation(),autocomplete:"off"},i("h5",null,"Roles and Workflow"),i("div",{class:"roles"},t.map(((e,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 o=!t.email||!t.first_name||!t.last_name;return o?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"?Bi:t.type==="cc"?$i:Pi}))):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"?Bi:t.type==="cc"?$i:Pi})))}))),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":s}),i("button",{class:"add-role no-drag",onClick:e=>this.handleAddRole(e,s)},"+ 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:Ui})," 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=Ai;export{A as verdocs_preview,Y as verdocs_send,X as verdocs_template_attachments,se as verdocs_template_build_tabs,be as verdocs_template_fields,Qi as verdocs_template_roles};
8
- //# sourceMappingURL=p-f81f766c.entry.js.map