@verdocs/web-sdk 1.4.7 → 1.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. package/dist/cjs/VerdocsEndpoint-5e6dd8ef.js +4780 -0
  2. package/dist/cjs/loader.cjs.js +1 -1
  3. package/dist/cjs/verdocs-auth.cjs.entry.js +32 -19
  4. package/dist/cjs/verdocs-dropdown_12.cjs.entry.js +15 -11
  5. package/dist/cjs/verdocs-kba-dialog.cjs.entry.js +1 -1
  6. package/dist/cjs/verdocs-ok-dialog.cjs.entry.js +1 -1
  7. package/dist/cjs/verdocs-quick-functions.cjs.entry.js +5 -0
  8. package/dist/cjs/verdocs-search-activity_2.cjs.entry.js +40 -35
  9. package/dist/cjs/verdocs-search.cjs.entry.js +6 -1
  10. package/dist/cjs/verdocs-sign.cjs.entry.js +26 -161
  11. package/dist/cjs/verdocs-web-sdk.cjs.js +1 -1
  12. package/dist/collection/components/dialogs/verdocs-kba-dialog/verdocs-kba-dialog.css +1 -1
  13. package/dist/collection/components/dialogs/verdocs-ok-dialog/verdocs-ok-dialog.css +1 -1
  14. package/dist/collection/components/elements/verdocs-quick-functions/verdocs-quick-functions.js +31 -1
  15. package/dist/collection/components/elements/verdocs-search-activity/verdocs-search-activity.js +30 -6
  16. package/dist/collection/components/elements/verdocs-search-box/verdocs-search-box.js +26 -0
  17. package/dist/collection/components/embeds/verdocs-auth/verdocs-auth.css +1 -4
  18. package/dist/collection/components/embeds/verdocs-auth/verdocs-auth.js +35 -17
  19. package/dist/collection/components/embeds/verdocs-search/verdocs-search.js +36 -6
  20. package/dist/collection/components/embeds/verdocs-sign/verdocs-sign.css +27 -26
  21. package/dist/collection/components/embeds/verdocs-sign/verdocs-sign.js +40 -23
  22. package/dist/collection/components/embeds/verdocs-sign/verdocs-sign.stories.js +2 -2
  23. package/dist/collection/components/embeds/verdocs-view/verdocs-view.js +26 -0
  24. package/dist/components/VerdocsEndpoint.js +4766 -0
  25. package/dist/components/verdocs-auth.js +33 -18
  26. package/dist/components/verdocs-kba-dialog.js +1 -1
  27. package/dist/components/verdocs-ok-dialog2.js +1 -1
  28. package/dist/components/verdocs-quick-functions.js +8 -1
  29. package/dist/components/verdocs-search-activity2.js +37 -34
  30. package/dist/components/verdocs-search-box2.js +6 -0
  31. package/dist/components/verdocs-search.js +9 -2
  32. package/dist/components/verdocs-sign.js +27 -162
  33. package/dist/components/verdocs-view2.js +6 -1
  34. package/dist/custom-elements.json +830 -0
  35. package/dist/docs.json +117 -3
  36. package/dist/esm/VerdocsEndpoint-30e1b6ec.js +4766 -0
  37. package/dist/esm/loader.js +1 -1
  38. package/dist/esm/verdocs-auth.entry.js +32 -19
  39. package/dist/esm/verdocs-dropdown_12.entry.js +5 -1
  40. package/dist/esm/verdocs-kba-dialog.entry.js +1 -1
  41. package/dist/esm/verdocs-ok-dialog.entry.js +1 -1
  42. package/dist/esm/verdocs-quick-functions.entry.js +5 -0
  43. package/dist/esm/verdocs-search-activity_2.entry.js +40 -35
  44. package/dist/esm/verdocs-search.entry.js +6 -1
  45. package/dist/esm/verdocs-sign.entry.js +26 -161
  46. package/dist/esm/verdocs-web-sdk.js +1 -1
  47. package/dist/esm-es5/VerdocsEndpoint-30e1b6ec.js +7 -0
  48. package/dist/esm-es5/loader.js +1 -1
  49. package/dist/esm-es5/verdocs-auth.entry.js +1 -1
  50. package/dist/esm-es5/verdocs-dropdown_12.entry.js +2 -2
  51. package/dist/esm-es5/verdocs-kba-dialog.entry.js +1 -1
  52. package/dist/esm-es5/verdocs-ok-dialog.entry.js +1 -1
  53. package/dist/esm-es5/verdocs-quick-functions.entry.js +1 -1
  54. package/dist/esm-es5/verdocs-search-activity_2.entry.js +1 -1
  55. package/dist/esm-es5/verdocs-search.entry.js +1 -1
  56. package/dist/esm-es5/verdocs-sign.entry.js +1 -1
  57. package/dist/esm-es5/verdocs-web-sdk.js +1 -1
  58. package/dist/types/components/elements/verdocs-quick-functions/verdocs-quick-functions.d.ts +5 -0
  59. package/dist/types/components/elements/verdocs-search-activity/verdocs-search-activity.d.ts +5 -0
  60. package/dist/types/components/elements/verdocs-search-box/verdocs-search-box.d.ts +5 -0
  61. package/dist/types/components/embeds/verdocs-auth/verdocs-auth.d.ts +7 -4
  62. package/dist/types/components/embeds/verdocs-search/verdocs-search.d.ts +5 -0
  63. package/dist/types/components/embeds/verdocs-sign/verdocs-sign.d.ts +6 -3
  64. package/dist/types/components/embeds/verdocs-view/verdocs-view.d.ts +5 -0
  65. package/dist/types/components.d.ts +57 -0
  66. package/dist/verdocs-web-sdk/{p-ed5baeb4.entry.js → p-064453c3.entry.js} +1 -1
  67. package/dist/verdocs-web-sdk/p-06f38046.js +1 -0
  68. package/dist/verdocs-web-sdk/p-16d62a51.system.entry.js +1 -0
  69. package/dist/verdocs-web-sdk/p-1b4e04b7.system.entry.js +1 -0
  70. package/dist/verdocs-web-sdk/p-1ea3b9d3.entry.js +1 -0
  71. package/dist/verdocs-web-sdk/p-30cc8818.entry.js +1 -0
  72. package/dist/verdocs-web-sdk/{p-0353c423.entry.js → p-32ad1014.entry.js} +1 -1
  73. package/dist/verdocs-web-sdk/p-4d80d044.system.js +7 -0
  74. package/dist/verdocs-web-sdk/{p-432c3151.system.entry.js → p-81fc0196.system.entry.js} +1 -1
  75. package/dist/verdocs-web-sdk/p-8276345a.entry.js +1 -0
  76. package/dist/verdocs-web-sdk/p-88a300c5.system.js +1 -1
  77. package/dist/verdocs-web-sdk/p-9139a76d.system.entry.js +1 -0
  78. package/dist/verdocs-web-sdk/p-a87069d5.system.entry.js +1 -0
  79. package/dist/verdocs-web-sdk/p-aa9fc574.entry.js +1 -0
  80. package/dist/verdocs-web-sdk/p-c29c2cf8.entry.js +1 -0
  81. package/dist/verdocs-web-sdk/{p-4368df79.system.entry.js → p-c4d03ff9.system.entry.js} +2 -2
  82. package/dist/verdocs-web-sdk/{p-a1143ddb.entry.js → p-d522de7d.entry.js} +2 -2
  83. package/dist/verdocs-web-sdk/{p-e2e643c5.system.entry.js → p-e4ba14dc.system.entry.js} +1 -1
  84. package/dist/verdocs-web-sdk/p-f6a53928.system.entry.js +1 -0
  85. package/dist/verdocs-web-sdk/verdocs-web-sdk.esm.js +1 -1
  86. package/package.json +2 -2
  87. package/dist/cjs/Auth-4ec35ac7.js +0 -97
  88. package/dist/cjs/Token-ac80819a.js +0 -2331
  89. package/dist/cjs/buffer-es6-bc8199b1.js +0 -2018
  90. package/dist/components/Auth.js +0 -92
  91. package/dist/components/Token.js +0 -2325
  92. package/dist/components/buffer-es6.js +0 -2010
  93. package/dist/esm/Auth-15cd42a8.js +0 -92
  94. package/dist/esm/Token-ce37bd9d.js +0 -2325
  95. package/dist/esm/buffer-es6-136673c8.js +0 -2010
  96. package/dist/esm-es5/Auth-15cd42a8.js +0 -1
  97. package/dist/esm-es5/Token-ce37bd9d.js +0 -1
  98. package/dist/esm-es5/buffer-es6-136673c8.js +0 -7
  99. package/dist/verdocs-web-sdk/p-0c0b4a10.system.entry.js +0 -1
  100. package/dist/verdocs-web-sdk/p-2b57857d.system.entry.js +0 -1
  101. package/dist/verdocs-web-sdk/p-2c161242.system.entry.js +0 -1
  102. package/dist/verdocs-web-sdk/p-39633a02.entry.js +0 -1
  103. package/dist/verdocs-web-sdk/p-5dfd73f9.system.js +0 -7
  104. package/dist/verdocs-web-sdk/p-69ef22bd.entry.js +0 -1
  105. package/dist/verdocs-web-sdk/p-737b2e99.js +0 -1
  106. package/dist/verdocs-web-sdk/p-8730dc92.system.js +0 -1
  107. package/dist/verdocs-web-sdk/p-a7cfe6fc.entry.js +0 -1
  108. package/dist/verdocs-web-sdk/p-b9164c4b.system.entry.js +0 -1
  109. package/dist/verdocs-web-sdk/p-cec13589.system.js +0 -1
  110. package/dist/verdocs-web-sdk/p-e6e2894e.js +0 -1
  111. package/dist/verdocs-web-sdk/p-ea6d6dc7.entry.js +0 -1
  112. package/dist/verdocs-web-sdk/p-ef932a87.js +0 -1
  113. package/dist/verdocs-web-sdk/p-f0e6fde0.entry.js +0 -1
  114. package/dist/verdocs-web-sdk/p-fd853e54.system.entry.js +0 -1
@@ -1,6 +1,14 @@
1
1
  import { r as registerInstance, h, H as Host } from './index-859bc689.js';
2
- import { a as getEndpoint, d as decodeAccessTokenBody, V as VerdocsEndpoint, s as setActiveEndpoint } from './Token-ce37bd9d.js';
3
- import { B as Buffer } from './buffer-es6-136673c8.js';
2
+ import { V as VerdocsEndpoint, g as getSigningSession, a as getDocument, u as updateRecipientStatus, b as getDocumentFile, c as updateDocumentField } from './VerdocsEndpoint-30e1b6ec.js';
3
+
4
+ var e164Regex = new RegExp(/\+[1-9]\d{6,14}/g);
5
+ function simpleE164Validator(code) {
6
+ return (code !== null && code.length < 16 && code.length > 6 && e164Regex.test(code)) || code === '' || code === null;
7
+ }
8
+
9
+ var EmailRegEx = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
10
+ var isValidEmail = function (value) { return EmailRegEx.test(value); };
11
+ var isValidPhone = function (value) { return simpleE164Validator(value); };
4
12
 
5
13
  /**
6
14
  * Given a `rgba(r,g,b,a)` string value, returns the hex equivalent, dropping the alpha channel.
@@ -39,153 +47,15 @@ function rescale(r, n) {
39
47
  return r * n;
40
48
  }
41
49
 
42
- var __assign = (undefined && undefined.__assign) || function () {
43
- __assign = Object.assign || function(t) {
44
- for (var s, i = 1, n = arguments.length; i < n; i++) {
45
- s = arguments[i];
46
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
47
- t[p] = s[p];
48
- }
49
- return t;
50
- };
51
- return __assign.apply(this, arguments);
52
- };
53
- var __awaiter$1 = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
54
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
55
- return new (P || (P = Promise))(function (resolve, reject) {
56
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
57
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
58
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
59
- step((generator = generator.apply(thisArg, _arguments || [])).next());
60
- });
61
- };
62
- var __generator$1 = (undefined && undefined.__generator) || function (thisArg, body) {
63
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
64
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
65
- function verb(n) { return function (v) { return step([n, v]); }; }
66
- function step(op) {
67
- if (f) throw new TypeError("Generator is already executing.");
68
- while (_) try {
69
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
70
- if (y = 0, t) op = [op[0] & 2, t.value];
71
- switch (op[0]) {
72
- case 0: case 1: t = op; break;
73
- case 4: _.label++; return { value: op[1], done: false };
74
- case 5: _.label++; y = op[1]; op = [0]; continue;
75
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
76
- default:
77
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
78
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
79
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
80
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
81
- if (t[2]) _.ops.pop();
82
- _.trys.pop(); continue;
83
- }
84
- op = body.call(thisArg, _);
85
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
86
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
87
- }
88
- };
89
- var updateRecipientStatus = function (documentId, roleName, action, params) { return __awaiter$1(void 0, void 0, void 0, function () {
90
- return __generator$1(this, function (_a) {
91
- return [2 /*return*/, getEndpoint()
92
- .api.put("/documents/".concat(documentId, "/recipients/").concat(roleName), __assign({ role_name: roleName, action: action }, (params || {})))
93
- .then(function (r) { return r.data; })];
94
- });
95
- }); };
50
+ const verdocsSignCss = "verdocs-sign{font-family:\"Inter\", -apple-system, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", sans-serif;position:relative;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;min-height:600px;-webkit-box-sizing:border-box;box-sizing:border-box;overflow:hidden}verdocs-sign.storybook{max-height:600px}verdocs-sign div{-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-sign .header{-ms-flex:0 0 115px;flex:0 0 115px;z-index:1000;background-color:#33354c;-webkit-box-shadow:0 4px 4px 0 rgba(0, 0, 0, 0.24), 0 0 4px 0 rgba(0, 0, 0, 0.12);box-shadow:0 4px 4px 0 rgba(0, 0, 0, 0.24), 0 0 4px 0 rgba(0, 0, 0, 0.12);-webkit-transition:all 0.25s;transition:all 0.25s}verdocs-sign .intro{background-color:#ffffff;width:100%;margin:0 auto;padding:20px;max-width:1028px;color:rgba(0, 0, 0, 0.87)}verdocs-sign .toolbar{width:100%;margin:0 auto;padding:0 14px;max-width:1028px;position:relative}verdocs-sign .tools{width:100%;color:#fff;height:56px;padding:4px;display:-ms-flexbox;display:flex;font-size:12px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;background-color:#33354c}verdocs-sign .cover{top:0;left:0;right:0;bottom:0;z-index:999;position:absolute;background:rgba(0, 0, 0, 0.5)}verdocs-sign .document{-ms-flex:1;flex:1;height:100%;position:relative;overflow-y:scroll}verdocs-sign .agree{-ms-flex:1;flex:1;-ms-flex-direction:row;flex-direction:row;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;margin-right:10px}verdocs-sign .agree .intro{display:none}verdocs-sign .agree .header{-ms-flex:0 0 56px;flex:0 0 56px}verdocs-sign .agree .agree-checkbox{background:#ccc;-ms-flex:0 0 20px;flex:0 0 20px;display:-ms-flexbox;display:flex;width:20px;height:20px;border-radius:3px;position:relative;margin:0 10px 0 14px}verdocs-sign .agree .agree-checkbox input[type=checkbox]:checked+label:after{filter:alpha(opacity=100);opacity:1}verdocs-sign .agree .agree-checkbox label{left:2px;top:2px;width:16px;height:16px;cursor:pointer;position:absolute;background:#33354c;-webkit-box-shadow:inset 0 -1px 1px rgba(255, 255, 255, 0.8);box-shadow:inset 0 -1px 1px rgba(255, 255, 255, 0.8)}verdocs-sign .agree .agree-checkbox label .agree-checkbox label:hover::after{filter:alpha(opacity=30);opacity:0.3}verdocs-sign .agree .agree-checkbox label:after{top:2px;left:3px;width:8px;opacity:0;height:5px;content:\"\";position:absolute;background:transparent;filter:alpha(opacity=0);-webkit-transform:rotate(-45deg);transform:rotate(-45deg);border:2px solid #fcfff4;border-top:none;border-right:none}verdocs-sign .page-controls{position:absolute;left:50%;-webkit-transform:translateX(-50%);transform:translateX(-50%);z-index:500}";
96
51
 
97
- var e164Regex = new RegExp(/\+[1-9]\d{6,14}/g);
98
- function simpleE164Validator(code) {
99
- return (code !== null && code.length < 16 && code.length > 6 && e164Regex.test(code)) || code === '' || code === null;
100
- }
101
-
102
- var EmailRegEx = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
103
- var isValidEmail = function (value) { return EmailRegEx.test(value); };
104
- var isValidPhone = function (value) { return simpleE164Validator(value); };
105
-
106
- var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
107
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
108
- return new (P || (P = Promise))(function (resolve, reject) {
109
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
110
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
111
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
112
- step((generator = generator.apply(thisArg, _arguments || [])).next());
113
- });
114
- };
115
- var __generator = (undefined && undefined.__generator) || function (thisArg, body) {
116
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
117
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
118
- function verb(n) { return function (v) { return step([n, v]); }; }
119
- function step(op) {
120
- if (f) throw new TypeError("Generator is already executing.");
121
- while (_) try {
122
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
123
- if (y = 0, t) op = [op[0] & 2, t.value];
124
- switch (op[0]) {
125
- case 0: case 1: t = op; break;
126
- case 4: _.label++; return { value: op[1], done: false };
127
- case 5: _.label++; y = op[1]; op = [0]; continue;
128
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
129
- default:
130
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
131
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
132
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
133
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
134
- if (t[2]) _.ops.pop();
135
- _.trys.pop(); continue;
136
- }
137
- op = body.call(thisArg, _);
138
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
139
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
140
- }
141
- };
142
- /**
143
- * Get a signing session for a document.
144
- */
145
- var getSigningSession = function (params) { return __awaiter(void 0, void 0, void 0, function () {
146
- return __generator(this, function (_a) {
147
- return [2 /*return*/, getEndpoint()
148
- .api.get("/documents/".concat(params.documentId, "/recipients/").concat(encodeURIComponent(params.roleId), "/invitation/").concat(params.inviteCode))
149
- .then(function (r) {
150
- var _a, _b;
151
- // Avoiding a jsonwebtoken dependency here - we don't actually need the whole library
152
- var signerToken = ((_a = r.headers) === null || _a === void 0 ? void 0 : _a.signer_token) || '';
153
- var session = decodeAccessTokenBody(signerToken);
154
- getEndpoint().setAuthorization((_b = r.headers) === null || _b === void 0 ? void 0 : _b.signer_token);
155
- return { recipient: r.data, session: session, signerToken: signerToken };
156
- })];
157
- });
158
- }); };
159
- var getDocument = function (documentId) { return __awaiter(void 0, void 0, void 0, function () {
160
- return __generator(this, function (_a) {
161
- return [2 /*return*/, getEndpoint()
162
- .api.get("/documents/".concat(documentId))
163
- .then(function (r) { return r.data; })];
164
- });
165
- }); };
166
- var getDocumentFile = function (documentId, envelopeDocumentId) { return __awaiter(void 0, void 0, void 0, function () {
167
- return __generator(this, function (_a) {
168
- return [2 /*return*/, getEndpoint()
169
- .api.get("/documents/".concat(documentId, "/envelope_documents/").concat(envelopeDocumentId, "?file=true"), {
170
- responseType: 'arraybuffer',
171
- })
172
- .then(function (r) { return Buffer.from(r.data, 'binary').toString('base64'); })];
173
- });
174
- }); };
175
- var updateDocumentField = function (documentId, fieldName, value) { return __awaiter(void 0, void 0, void 0, function () {
176
- return __generator(this, function (_a) {
177
- return [2 /*return*/, getEndpoint()
178
- .api.put("/documents/".concat(documentId, "/fields/").concat(fieldName), value)
179
- .then(function (r) { return r.data; })];
180
- });
181
- }); };
182
-
183
- const verdocsSignCss = "verdocs-sign{font-family:\"Inter\", -apple-system, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", sans-serif;position:relative;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;min-height:600px;-webkit-box-sizing:border-box;box-sizing:border-box;overflow:hidden}verdocs-sign.storybook{max-height:600px}verdocs-sign div{-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-sign .header{-ms-flex:0 0 115px;flex:0 0 115px;z-index:1000;background-color:#33354c;-webkit-box-shadow:0 4px 4px 0 rgba(0, 0, 0, 0.24), 0 0 4px 0 rgba(0, 0, 0, 0.12);box-shadow:0 4px 4px 0 rgba(0, 0, 0, 0.24), 0 0 4px 0 rgba(0, 0, 0, 0.12);-webkit-transition:all 0.25s;transition:all 0.25s}verdocs-sign .intro{background-color:#ffffff;width:100%;margin:0 auto;padding:20px;max-width:1028px;color:rgba(0, 0, 0, 0.87)}verdocs-sign .toolbar{width:100%;margin:0 auto;padding:0 20px;max-width:1028px;position:relative}verdocs-sign .tools{width:100%;color:#fff;height:56px;padding:4px;display:-ms-flexbox;display:flex;font-size:12px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;background-color:#33354c}verdocs-sign .cover{top:0;left:0;right:0;bottom:0;z-index:999;position:absolute;background:rgba(0, 0, 0, 0.5)}verdocs-sign .document{-ms-flex:1;flex:1;height:100%;position:relative;overflow-y:scroll}verdocs-sign .agree-checkbox{-ms-flex:0 0 20px;flex:0 0 20px;display:-ms-flexbox;display:flex;width:20px;height:20px;border-radius:3px;background:#ffffff;position:relative;margin:0 10px 0 30px}verdocs-sign .agree-checkbox label{left:2px;top:2px;width:16px;height:16px;cursor:pointer;position:absolute;background:#33354c;-webkit-box-shadow:inset 0 -1px 1px rgba(255, 255, 255, 0.8);box-shadow:inset 0 -1px 1px rgba(255, 255, 255, 0.8)}verdocs-sign .agree-checkbox label:after{top:2px;left:3px;width:8px;opacity:0;height:5px;content:\"\";position:absolute;background:transparent;filter:alpha(opacity=0);-webkit-transform:rotate(-45deg);transform:rotate(-45deg);border:2px solid #fcfff4;border-top:none;border-right:none}verdocs-sign .agree-checkbox label:hover::after{filter:alpha(opacity=30);opacity:0.3}verdocs-sign .agree-checkbox input[type=checkbox]:checked+label:after{filter:alpha(opacity=100);opacity:1}verdocs-sign.agreed .intro{display:none}verdocs-sign.agreed .header{-ms-flex:0 0 56px;flex:0 0 56px}verdocs-sign.agreed .agree-checkbox{background:#ccc}verdocs-sign.agreed .agree-checkbox label{cursor:default}verdocs-sign .page-controls{position:absolute;left:50%;-webkit-transform:translateX(-50%);transform:translateX(-50%);z-index:500}";
184
-
185
- const BASE_URL = 'https://stage-api.verdocs.com';
186
52
  const VerdocsSign = class {
187
53
  constructor(hostRef) {
188
54
  registerInstance(this, hostRef);
55
+ /**
56
+ * The endpoint to use to communicate with Verdocs. If not set, the default endpoint will be used.
57
+ */
58
+ this.endpoint = VerdocsEndpoint.getDefault();
189
59
  /**
190
60
  * If `source` is set to `verdocs-sign`, this should be set to a valid invitation code to activate a
191
61
  * signing session.
@@ -201,7 +71,6 @@ const VerdocsSign = class {
201
71
  * signing session.
202
72
  */
203
73
  this.invitecode = null;
204
- this.endpoint = null;
205
74
  this.recipient = null;
206
75
  this.signerToken = null;
207
76
  this.pdfUrl = null;
@@ -212,14 +81,10 @@ const VerdocsSign = class {
212
81
  this.nextButtonLabel = 'Start';
213
82
  this.focusedField = '';
214
83
  }
215
- componentWillLoad() {
216
- const endpoint = new VerdocsEndpoint().setBaseURL(BASE_URL);
217
- setActiveEndpoint(endpoint);
218
- }
219
84
  async componentDidLoad() {
220
85
  try {
221
86
  console.log('[SIGN] Processing invite code', this.documentid, this.roleid, this.invitecode);
222
- const { session, recipient, signerToken } = await getSigningSession({
87
+ const { session, recipient, signerToken } = await getSigningSession(this.endpoint, {
223
88
  documentId: this.documentid,
224
89
  roleId: this.roleid,
225
90
  inviteCode: this.invitecode,
@@ -228,14 +93,14 @@ const VerdocsSign = class {
228
93
  console.log('[SIGN] Recipient', recipient);
229
94
  this.recipient = recipient;
230
95
  this.signerToken = signerToken;
231
- getEndpoint().setSigningAuthorization(signerToken);
96
+ this.endpoint.setToken(signerToken);
232
97
  if (this.recipient.agreed) {
233
98
  this.nextButtonLabel = 'Next';
234
99
  }
235
- const document = await getDocument(this.documentid);
100
+ const document = await getDocument(this.endpoint, this.documentid);
236
101
  this.document = document;
237
102
  console.log('[SIGN] Document', document);
238
- this.pdfUrl = `${BASE_URL}/documents/${this.documentid}/envelope_documents/${document.envelope_document_id}?file=true`;
103
+ this.pdfUrl = `${this.endpoint.getBaseURL()}/documents/${this.documentid}/envelope_documents/${document.envelope_document_id}?file=true`;
239
104
  this.recipientIndex = this.document.recipients.findIndex(recipient => recipient.role_name == this.roleid);
240
105
  if (this.recipientIndex > -1) {
241
106
  console.log('Found recipient', this.document.recipients[this.recipientIndex]);
@@ -252,7 +117,7 @@ const VerdocsSign = class {
252
117
  }
253
118
  handleClickAgree() {
254
119
  console.log('agree clicked');
255
- updateRecipientStatus(this.documentid, this.roleid, 'update', { agreed: true })
120
+ updateRecipientStatus(this.endpoint, this.documentid, this.roleid, 'update', { agreed: true })
256
121
  .then(r => {
257
122
  console.log('update result', r);
258
123
  this.nextButtonLabel = 'Next';
@@ -264,7 +129,7 @@ const VerdocsSign = class {
264
129
  }
265
130
  async savePDF() {
266
131
  const fileName = `${this.document.name} - ${this.document.updated_at.split('T')[0]}.pdf`;
267
- const data = await getDocumentFile(this.documentid, this.document.envelope_document_id);
132
+ const data = await getDocumentFile(this.endpoint, this.documentid, this.document.envelope_document_id);
268
133
  // This is better in React than doing window.href= or similar to trigger a download. For a description of the technique
269
134
  // see https://stackoverflow.com/questions/8126623/downloading-canvas-element-to-an-image
270
135
  let xhr = new XMLHttpRequest();
@@ -306,23 +171,23 @@ const VerdocsSign = class {
306
171
  console.log('fieldChange', field, e.detail);
307
172
  switch (field.type) {
308
173
  case 'textbox':
309
- updateDocumentField(this.documentid, field.name, { prepared: false, value: e.detail })
174
+ updateDocumentField(this.endpoint, this.documentid, field.name, { prepared: false, value: e.detail })
310
175
  .then(r => console.log('Update result', r))
311
176
  .catch(e => console.log('Error updating', e));
312
177
  break;
313
178
  case 'checkbox_group':
314
- updateDocumentField(this.documentid, field.name, { prepared: false, value: { options: [{ id: optionId, checked: e.detail }] } })
179
+ updateDocumentField(this.endpoint, this.documentid, field.name, { prepared: false, value: { options: [{ id: optionId, checked: e.detail }] } })
315
180
  .then(r => console.log('Update result', r))
316
181
  .catch(e => console.log('Error updating', e));
317
182
  break;
318
183
  case 'radio_button_group':
319
184
  const options = field.settings.options.map(option => ({ id: option.id, selected: optionId === option.id }));
320
- updateDocumentField(this.documentid, field.name, { prepared: false, value: { options } })
185
+ updateDocumentField(this.endpoint, this.documentid, field.name, { prepared: false, value: { options } })
321
186
  .then(r => console.log('Update result', r))
322
187
  .catch(e => console.log('Error updating', e));
323
188
  break;
324
189
  case 'dropdown':
325
- updateDocumentField(this.documentid, field.name, { prepared: false, value: e.detail })
190
+ updateDocumentField(this.endpoint, this.documentid, field.name, { prepared: false, value: e.detail })
326
191
  .then(r => console.log('Update result', r))
327
192
  .catch(e => console.log('Error updating', e));
328
193
  break;
@@ -476,7 +341,7 @@ const VerdocsSign = class {
476
341
  { id: 'print', label: 'Print Without Signing' },
477
342
  { id: 'download', label: 'Download' },
478
343
  ];
479
- return (h(Host, { class: { storybook: !!(window === null || window === void 0 ? void 0 : window['STORYBOOK_ENV']), agreed: (_a = this.recipient) === null || _a === void 0 ? void 0 : _a.agreed } }, h("div", { class: "header" }, h("div", { class: "intro" }, "Please review and act on these documents."), h("div", { class: "toolbar" }, h("div", { class: "tools" }, h("verdocs-dropdown", { options: menuOptions, onOptionSelected: e => this.handleOptionSelected(e) }), !((_b = this.recipient) === null || _b === void 0 ? void 0 : _b.agreed) ? (h("div", { style: { flex: '1', flexDirection: 'row', display: 'flex', alignItems: 'center' } }, h("div", { class: "agree-checkbox" }, h("input", { type: "checkbox", value: "None", id: "agree-checkbox-element", name: "agree", onChange: () => this.handleClickAgree() }), h("label", { htmlFor: "agree-checkbox-element" })), "I agree to use electronic records and signatures.")) : (h("div", { style: { flex: '1' } })), h("verdocs-button", { label: this.nextButtonLabel, disabled: !((_c = this.recipient) === null || _c === void 0 ? void 0 : _c.agreed), onClick: () => this.handleNext() })))), !((_d = this.recipient) === null || _d === void 0 ? void 0 : _d.agreed) ? h("div", { class: "cover" }) : h("div", { style: { display: 'none' } }), h("div", { class: "document" }, this.pdfUrl ? h("verdocs-view", { source: this.pdfUrl, token: this.signerToken, onDocumentRendered: e => this.handleDocumentRendered(e) }) : h("verdocs-loader", null), (((_e = this.pdfPageInfo) === null || _e === void 0 ? void 0 : _e.pages) || []).map(page => {
344
+ return (h(Host, { class: { storybook: !!(window === null || window === void 0 ? void 0 : window['STORYBOOK_ENV']), agreed: (_a = this.recipient) === null || _a === void 0 ? void 0 : _a.agreed } }, h("div", { class: "header" }, h("div", { class: "intro" }, "Please review and act on these documents."), h("div", { class: "toolbar" }, h("div", { class: "tools" }, h("verdocs-dropdown", { options: menuOptions, onOptionSelected: e => this.handleOptionSelected(e) }), !((_b = this.recipient) === null || _b === void 0 ? void 0 : _b.agreed) ? (h("div", { class: "agree" }, h("div", { class: "agree-checkbox" }, h("input", { type: "checkbox", value: "None", id: "agree-checkbox-element", name: "agree", onChange: () => this.handleClickAgree() }), h("label", { htmlFor: "agree-checkbox-element" })), h("span", null, "I agree to use electronic records and signatures."))) : (h("div", { style: { flex: '1' } })), h("verdocs-button", { size: "small", label: this.nextButtonLabel, disabled: !((_c = this.recipient) === null || _c === void 0 ? void 0 : _c.agreed), onClick: () => this.handleNext() })))), !((_d = this.recipient) === null || _d === void 0 ? void 0 : _d.agreed) ? h("div", { class: "cover" }) : h("div", { style: { display: 'none' } }), h("div", { class: "document" }, this.pdfUrl ? h("verdocs-view", { source: this.pdfUrl, token: this.signerToken, onDocumentRendered: e => this.handleDocumentRendered(e) }) : h("verdocs-loader", null), (((_e = this.pdfPageInfo) === null || _e === void 0 ? void 0 : _e.pages) || []).map(page => {
480
345
  var _a;
481
346
  return (h("div", { class: "page-controls", style: { height: `${page.height}px`, width: `${page.width}px`, top: `${page.canvasTop}px`, margin: '0 auto' } }, ((_a = this.pdfPageInfo) === null || _a === void 0 ? void 0 : _a.numRendered) > 0 ? (this.fields.filter(field => field.page === page.pageNumber).map((field, index) => this.renderField(field, index))) : (h("div", { style: { display: 'none' } }, "Waiting for PDF to render..."))));
482
347
  }))));
@@ -13,5 +13,5 @@ const patchBrowser = () => {
13
13
  };
14
14
 
15
15
  patchBrowser().then(options => {
16
- return bootstrapLazy([["verdocs-sign",[[0,"verdocs-sign",{"documentid":[1],"roleid":[1],"invitecode":[1],"endpoint":[32],"recipient":[32],"signerToken":[32],"pdfUrl":[32],"recipientIndex":[32],"document":[32],"fields":[32],"pdfPageInfo":[32],"hasSignature":[32],"nextButtonLabel":[32],"focusedField":[32]}]]],["verdocs-auth",[[0,"verdocs-auth",{"visible":[4],"logo":[1],"debug":[4],"isAuthenticated":[32],"displayMode":[32],"username":[32],"password":[32],"loggingIn":[32],"activeSession":[32],"loginError":[32]}]]],["verdocs-search",[[0,"verdocs-search"]]],["verdocs-kba-dialog",[[0,"verdocs-kba-dialog",{"step":[2],"steps":[2],"helptitle":[1],"helptext":[1],"mode":[1],"label":[1],"placeholder":[1],"choices":[16],"open":[4],"response":[32]}]]],["verdocs-organization-card",[[0,"verdocs-organization-card",{"organization":[16]}]]],["verdocs-quick-functions",[[0,"verdocs-quick-functions"]]],["verdocs-search-tabs",[[0,"verdocs-search-tabs",{"selected":[32]}]]],["verdocs-status-indicator",[[0,"verdocs-status-indicator",{"size":[1],"theme":[1],"status":[1],"document":[16],"isOpen":[32],"recipientStatusIcons":[32]}]]],["verdocs-template-card",[[0,"verdocs-template-card",{"template":[16]}]]],["verdocs-template-tags",[[0,"verdocs-template-tags",{"tags":[16]}]]],["verdocs-toggle",[[0,"verdocs-toggle",{"options":[16],"theme":[1]},[[6,"click","handleClick"]]]]],["verdocs-button_2",[[0,"verdocs-text-input",{"value":[1],"label":[1],"placeholder":[1],"autocomplete":[1],"type":[1],"disabled":[4],"_value":[32]}],[0,"verdocs-button",{"label":[1],"startIcon":[1,"start-icon"],"endIcon":[1,"end-icon"],"size":[1],"type":[1],"variant":[1],"disabled":[4]}]]],["verdocs-ok-dialog",[[0,"verdocs-ok-dialog",{"heading":[1],"message":[1],"open":[4],"cancel":[4]}]]],["verdocs-initial-dialog",[[0,"verdocs-initial-dialog",{"fullname":[1],"open":[4],"fontLoaded":[32],"enteredInitials":[32],"mode":[32]}]]],["verdocs-signature-dialog",[[0,"verdocs-signature-dialog",{"fullname":[1],"open":[4],"fontLoaded":[32],"enteredName":[32],"mode":[32]}]]],["verdocs-upload-dialog",[[0,"verdocs-upload-dialog",{"open":[4],"draggingOver":[32],"decodedFiles":[32]}]]],["verdocs-search-activity_2",[[0,"verdocs-search-activity",{"type":[1],"options":[8],"emptyMessage":[32],"authFailure":[32],"title":[32],"recent":[32],"saved":[32],"starred":[32]}],[0,"verdocs-search-box",{"placeholder":[1],"type":[1],"query":[1]}]]],["verdocs-loader",[[0,"verdocs-loader"]]],["verdocs-dropdown_12",[[0,"verdocs-field-initial",{"required":[4],"fullName":[1,"full-name"],"value":[1],"focusField":[64]}],[0,"verdocs-field-signature",{"required":[4],"fullName":[1,"full-name"],"value":[1],"focusField":[64]}],[0,"verdocs-field-attachment",{"order":[2],"value":[1],"required":[4],"disabled":[4],"focusField":[64]}],[0,"verdocs-view",{"rotation":[2],"source":[1],"token":[1],"loadProgress":[32]}],[0,"verdocs-dropdown",{"options":[16],"open":[4],"isOpen":[32]}],[0,"verdocs-field-checkbox",{"order":[2],"value":[4],"required":[4],"disabled":[4]}],[0,"verdocs-field-date",{"placeholder":[1],"order":[2],"value":[1],"required":[4],"disabled":[4],"focused":[32],"focusField":[64]}],[0,"verdocs-field-dropdown",{"options":[16],"required":[4],"order":[2],"disabled":[4],"value":[1],"focused":[32],"focusField":[64]}],[0,"verdocs-field-payment",{"field":[16],"fields":[16],"pageNum":[2,"page-num"],"roleName":[1,"role-name"],"fieldId":[1,"field-id"],"recipients":[8],"selectedRoleName":[1,"selected-role-name"],"pdfPages":[16],"currentSignature":[1,"current-signature"],"currentSignatureId":[1,"current-signature-id"],"currentInitial":[1,"current-initial"],"currentInitialId":[1,"current-initial-id"],"focused":[4],"signed":[4],"preparedMessage":[32],"signatureUrl":[32]}],[0,"verdocs-field-radio-button",{"order":[2],"checked":[4],"value":[1],"name":[1],"required":[4],"disabled":[4]}],[0,"verdocs-field-textarea",{"placeholder":[1],"order":[2],"value":[1],"required":[4],"disabled":[4],"focused":[32],"focusField":[64]}],[0,"verdocs-field-textbox",{"placeholder":[1],"order":[2],"value":[1],"required":[4],"disabled":[4],"focused":[32],"focusField":[64]}]]]], options);
16
+ return bootstrapLazy([["verdocs-sign",[[0,"verdocs-sign",{"endpoint":[16],"documentid":[1],"roleid":[1],"invitecode":[1],"recipient":[32],"signerToken":[32],"pdfUrl":[32],"recipientIndex":[32],"document":[32],"fields":[32],"pdfPageInfo":[32],"hasSignature":[32],"nextButtonLabel":[32],"focusedField":[32]}]]],["verdocs-auth",[[0,"verdocs-auth",{"endpoint":[16],"visible":[4],"logo":[1],"debug":[4],"isAuthenticated":[32],"displayMode":[32],"username":[32],"password":[32],"loggingIn":[32],"activeSession":[32],"loginError":[32]}]]],["verdocs-search",[[0,"verdocs-search",{"endpoint":[16]}]]],["verdocs-kba-dialog",[[0,"verdocs-kba-dialog",{"step":[2],"steps":[2],"helptitle":[1],"helptext":[1],"mode":[1],"label":[1],"placeholder":[1],"choices":[16],"open":[4],"response":[32]}]]],["verdocs-organization-card",[[0,"verdocs-organization-card",{"organization":[16]}]]],["verdocs-quick-functions",[[0,"verdocs-quick-functions",{"endpoint":[16]}]]],["verdocs-search-tabs",[[0,"verdocs-search-tabs",{"selected":[32]}]]],["verdocs-status-indicator",[[0,"verdocs-status-indicator",{"size":[1],"theme":[1],"status":[1],"document":[16],"isOpen":[32],"recipientStatusIcons":[32]}]]],["verdocs-template-card",[[0,"verdocs-template-card",{"template":[16]}]]],["verdocs-template-tags",[[0,"verdocs-template-tags",{"tags":[16]}]]],["verdocs-toggle",[[0,"verdocs-toggle",{"options":[16],"theme":[1]},[[6,"click","handleClick"]]]]],["verdocs-button_2",[[0,"verdocs-text-input",{"value":[1],"label":[1],"placeholder":[1],"autocomplete":[1],"type":[1],"disabled":[4],"_value":[32]}],[0,"verdocs-button",{"label":[1],"startIcon":[1,"start-icon"],"endIcon":[1,"end-icon"],"size":[1],"type":[1],"variant":[1],"disabled":[4]}]]],["verdocs-ok-dialog",[[0,"verdocs-ok-dialog",{"heading":[1],"message":[1],"open":[4],"cancel":[4]}]]],["verdocs-initial-dialog",[[0,"verdocs-initial-dialog",{"fullname":[1],"open":[4],"fontLoaded":[32],"enteredInitials":[32],"mode":[32]}]]],["verdocs-signature-dialog",[[0,"verdocs-signature-dialog",{"fullname":[1],"open":[4],"fontLoaded":[32],"enteredName":[32],"mode":[32]}]]],["verdocs-upload-dialog",[[0,"verdocs-upload-dialog",{"open":[4],"draggingOver":[32],"decodedFiles":[32]}]]],["verdocs-search-activity_2",[[0,"verdocs-search-activity",{"endpoint":[16],"type":[1],"options":[8],"emptyMessage":[32],"authFailure":[32],"title":[32],"recent":[32],"saved":[32],"starred":[32]}],[0,"verdocs-search-box",{"endpoint":[16],"placeholder":[1],"type":[1],"query":[1]}]]],["verdocs-loader",[[0,"verdocs-loader"]]],["verdocs-dropdown_12",[[0,"verdocs-field-initial",{"required":[4],"fullName":[1,"full-name"],"value":[1],"focusField":[64]}],[0,"verdocs-field-signature",{"required":[4],"fullName":[1,"full-name"],"value":[1],"focusField":[64]}],[0,"verdocs-field-attachment",{"order":[2],"value":[1],"required":[4],"disabled":[4],"focusField":[64]}],[0,"verdocs-view",{"endpoint":[16],"rotation":[2],"source":[1],"token":[1],"loadProgress":[32]}],[0,"verdocs-dropdown",{"options":[16],"open":[4],"isOpen":[32]}],[0,"verdocs-field-checkbox",{"order":[2],"value":[4],"required":[4],"disabled":[4]}],[0,"verdocs-field-date",{"placeholder":[1],"order":[2],"value":[1],"required":[4],"disabled":[4],"focused":[32],"focusField":[64]}],[0,"verdocs-field-dropdown",{"options":[16],"required":[4],"order":[2],"disabled":[4],"value":[1],"focused":[32],"focusField":[64]}],[0,"verdocs-field-payment",{"field":[16],"fields":[16],"pageNum":[2,"page-num"],"roleName":[1,"role-name"],"fieldId":[1,"field-id"],"recipients":[8],"selectedRoleName":[1,"selected-role-name"],"pdfPages":[16],"currentSignature":[1,"current-signature"],"currentSignatureId":[1,"current-signature-id"],"currentInitial":[1,"current-initial"],"currentInitialId":[1,"current-initial-id"],"focused":[4],"signed":[4],"preparedMessage":[32],"signatureUrl":[32]}],[0,"verdocs-field-radio-button",{"order":[2],"checked":[4],"value":[1],"name":[1],"required":[4],"disabled":[4]}],[0,"verdocs-field-textarea",{"placeholder":[1],"order":[2],"value":[1],"required":[4],"disabled":[4],"focused":[32],"focusField":[64]}],[0,"verdocs-field-textbox",{"placeholder":[1],"order":[2],"value":[1],"required":[4],"disabled":[4],"focused":[32],"focusField":[64]}]]]], options);
17
17
  });
@@ -0,0 +1,7 @@
1
+ var global$1=typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{};var lookup=[];var revLookup=[];var Arr=typeof Uint8Array!=="undefined"?Uint8Array:Array;var inited=false;function init(){inited=true;var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var t=0,r=e.length;t<r;++t){lookup[t]=e[t];revLookup[e.charCodeAt(t)]=t}revLookup["-".charCodeAt(0)]=62;revLookup["_".charCodeAt(0)]=63}function toByteArray(e){if(!inited){init()}var t,r,n,i,o,s;var a=e.length;if(a%4>0){throw new Error("Invalid string. Length must be a multiple of 4")}o=e[a-2]==="="?2:e[a-1]==="="?1:0;s=new Arr(a*3/4-o);n=o>0?a-4:a;var f=0;for(t=0,r=0;t<n;t+=4,r+=3){i=revLookup[e.charCodeAt(t)]<<18|revLookup[e.charCodeAt(t+1)]<<12|revLookup[e.charCodeAt(t+2)]<<6|revLookup[e.charCodeAt(t+3)];s[f++]=i>>16&255;s[f++]=i>>8&255;s[f++]=i&255}if(o===2){i=revLookup[e.charCodeAt(t)]<<2|revLookup[e.charCodeAt(t+1)]>>4;s[f++]=i&255}else if(o===1){i=revLookup[e.charCodeAt(t)]<<10|revLookup[e.charCodeAt(t+1)]<<4|revLookup[e.charCodeAt(t+2)]>>2;s[f++]=i>>8&255;s[f++]=i&255}return s}function tripletToBase64(e){return lookup[e>>18&63]+lookup[e>>12&63]+lookup[e>>6&63]+lookup[e&63]}function encodeChunk(e,t,r){var n;var i=[];for(var o=t;o<r;o+=3){n=(e[o]<<16)+(e[o+1]<<8)+e[o+2];i.push(tripletToBase64(n))}return i.join("")}function fromByteArray(e){if(!inited){init()}var t;var r=e.length;var n=r%3;var i="";var o=[];var s=16383;for(var a=0,f=r-n;a<f;a+=s){o.push(encodeChunk(e,a,a+s>f?f:a+s))}if(n===1){t=e[r-1];i+=lookup[t>>2];i+=lookup[t<<4&63];i+="=="}else if(n===2){t=(e[r-2]<<8)+e[r-1];i+=lookup[t>>10];i+=lookup[t>>4&63];i+=lookup[t<<2&63];i+="="}o.push(i);return o.join("")}function read(e,t,r,n,i){var o,s;var a=i*8-n-1;var f=(1<<a)-1;var u=f>>1;var c=-7;var l=r?i-1:0;var h=r?-1:1;var p=e[t+l];l+=h;o=p&(1<<-c)-1;p>>=-c;c+=a;for(;c>0;o=o*256+e[t+l],l+=h,c-=8){}s=o&(1<<-c)-1;o>>=-c;c+=n;for(;c>0;s=s*256+e[t+l],l+=h,c-=8){}if(o===0){o=1-u}else if(o===f){return s?NaN:(p?-1:1)*Infinity}else{s=s+Math.pow(2,n);o=o-u}return(p?-1:1)*s*Math.pow(2,o-n)}function write(e,t,r,n,i,o){var s,a,f;var u=o*8-i-1;var c=(1<<u)-1;var l=c>>1;var h=i===23?Math.pow(2,-24)-Math.pow(2,-77):0;var p=n?0:o-1;var d=n?1:-1;var g=t<0||t===0&&1/t<0?1:0;t=Math.abs(t);if(isNaN(t)||t===Infinity){a=isNaN(t)?1:0;s=c}else{s=Math.floor(Math.log(t)/Math.LN2);if(t*(f=Math.pow(2,-s))<1){s--;f*=2}if(s+l>=1){t+=h/f}else{t+=h*Math.pow(2,1-l)}if(t*f>=2){s++;f/=2}if(s+l>=c){a=0;s=c}else if(s+l>=1){a=(t*f-1)*Math.pow(2,i);s=s+l}else{a=t*Math.pow(2,l-1)*Math.pow(2,i);s=0}}for(;i>=8;e[r+p]=a&255,p+=d,a/=256,i-=8){}s=s<<i|a;u+=i;for(;u>0;e[r+p]=s&255,p+=d,s/=256,u-=8){}e[r+p-d]|=g*128}var toString$1={}.toString;var isArray$1=Array.isArray||function(e){return toString$1.call(e)=="[object Array]"};
2
+ /*!
3
+ * The buffer module from node.js, for the browser.
4
+ *
5
+ * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
6
+ * @license MIT
7
+ */var INSPECT_MAX_BYTES=50;Buffer.TYPED_ARRAY_SUPPORT=global$1.TYPED_ARRAY_SUPPORT!==undefined?global$1.TYPED_ARRAY_SUPPORT:true;function kMaxLength(){return Buffer.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function createBuffer(e,t){if(kMaxLength()<t){throw new RangeError("Invalid typed array length")}if(Buffer.TYPED_ARRAY_SUPPORT){e=new Uint8Array(t);e.__proto__=Buffer.prototype}else{if(e===null){e=new Buffer(t)}e.length=t}return e}function Buffer(e,t,r){if(!Buffer.TYPED_ARRAY_SUPPORT&&!(this instanceof Buffer)){return new Buffer(e,t,r)}if(typeof e==="number"){if(typeof t==="string"){throw new Error("If encoding is specified then the first argument must be a string")}return allocUnsafe(this,e)}return from(this,e,t,r)}Buffer.poolSize=8192;Buffer._augment=function(e){e.__proto__=Buffer.prototype;return e};function from(e,t,r,n){if(typeof t==="number"){throw new TypeError('"value" argument must not be a number')}if(typeof ArrayBuffer!=="undefined"&&t instanceof ArrayBuffer){return fromArrayBuffer(e,t,r,n)}if(typeof t==="string"){return fromString(e,t,r)}return fromObject(e,t)}Buffer.from=function(e,t,r){return from(null,e,t,r)};if(Buffer.TYPED_ARRAY_SUPPORT){Buffer.prototype.__proto__=Uint8Array.prototype;Buffer.__proto__=Uint8Array}function assertSize(e){if(typeof e!=="number"){throw new TypeError('"size" argument must be a number')}else if(e<0){throw new RangeError('"size" argument must not be negative')}}function alloc(e,t,r,n){assertSize(t);if(t<=0){return createBuffer(e,t)}if(r!==undefined){return typeof n==="string"?createBuffer(e,t).fill(r,n):createBuffer(e,t).fill(r)}return createBuffer(e,t)}Buffer.alloc=function(e,t,r){return alloc(null,e,t,r)};function allocUnsafe(e,t){assertSize(t);e=createBuffer(e,t<0?0:checked(t)|0);if(!Buffer.TYPED_ARRAY_SUPPORT){for(var r=0;r<t;++r){e[r]=0}}return e}Buffer.allocUnsafe=function(e){return allocUnsafe(null,e)};Buffer.allocUnsafeSlow=function(e){return allocUnsafe(null,e)};function fromString(e,t,r){if(typeof r!=="string"||r===""){r="utf8"}if(!Buffer.isEncoding(r)){throw new TypeError('"encoding" must be a valid string encoding')}var n=byteLength(t,r)|0;e=createBuffer(e,n);var i=e.write(t,r);if(i!==n){e=e.slice(0,i)}return e}function fromArrayLike(e,t){var r=t.length<0?0:checked(t.length)|0;e=createBuffer(e,r);for(var n=0;n<r;n+=1){e[n]=t[n]&255}return e}function fromArrayBuffer(e,t,r,n){if(r<0||t.byteLength<r){throw new RangeError("'offset' is out of bounds")}if(t.byteLength<r+(n||0)){throw new RangeError("'length' is out of bounds")}if(r===undefined&&n===undefined){t=new Uint8Array(t)}else if(n===undefined){t=new Uint8Array(t,r)}else{t=new Uint8Array(t,r,n)}if(Buffer.TYPED_ARRAY_SUPPORT){e=t;e.__proto__=Buffer.prototype}else{e=fromArrayLike(e,t)}return e}function fromObject(e,t){if(internalIsBuffer(t)){var r=checked(t.length)|0;e=createBuffer(e,r);if(e.length===0){return e}t.copy(e,0,0,r);return e}if(t){if(typeof ArrayBuffer!=="undefined"&&t.buffer instanceof ArrayBuffer||"length"in t){if(typeof t.length!=="number"||isnan(t.length)){return createBuffer(e,0)}return fromArrayLike(e,t)}if(t.type==="Buffer"&&isArray$1(t.data)){return fromArrayLike(e,t.data)}}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function checked(e){if(e>=kMaxLength()){throw new RangeError("Attempt to allocate Buffer larger than maximum "+"size: 0x"+kMaxLength().toString(16)+" bytes")}return e|0}Buffer.isBuffer=isBuffer$1;function internalIsBuffer(e){return!!(e!=null&&e._isBuffer)}Buffer.compare=function e(t,r){if(!internalIsBuffer(t)||!internalIsBuffer(r)){throw new TypeError("Arguments must be Buffers")}if(t===r)return 0;var n=t.length;var i=r.length;for(var o=0,s=Math.min(n,i);o<s;++o){if(t[o]!==r[o]){n=t[o];i=r[o];break}}if(n<i)return-1;if(i<n)return 1;return 0};Buffer.isEncoding=function e(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return true;default:return false}};Buffer.concat=function e(t,r){if(!isArray$1(t)){throw new TypeError('"list" argument must be an Array of Buffers')}if(t.length===0){return Buffer.alloc(0)}var n;if(r===undefined){r=0;for(n=0;n<t.length;++n){r+=t[n].length}}var i=Buffer.allocUnsafe(r);var o=0;for(n=0;n<t.length;++n){var s=t[n];if(!internalIsBuffer(s)){throw new TypeError('"list" argument must be an Array of Buffers')}s.copy(i,o);o+=s.length}return i};function byteLength(e,t){if(internalIsBuffer(e)){return e.length}if(typeof ArrayBuffer!=="undefined"&&typeof ArrayBuffer.isView==="function"&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer)){return e.byteLength}if(typeof e!=="string"){e=""+e}var r=e.length;if(r===0)return 0;var n=false;for(;;){switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case undefined:return utf8ToBytes(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return base64ToBytes(e).length;default:if(n)return utf8ToBytes(e).length;t=(""+t).toLowerCase();n=true}}}Buffer.byteLength=byteLength;function slowToString(e,t,r){var n=false;if(t===undefined||t<0){t=0}if(t>this.length){return""}if(r===undefined||r>this.length){r=this.length}if(r<=0){return""}r>>>=0;t>>>=0;if(r<=t){return""}if(!e)e="utf8";while(true){switch(e){case"hex":return hexSlice(this,t,r);case"utf8":case"utf-8":return utf8Slice(this,t,r);case"ascii":return asciiSlice(this,t,r);case"latin1":case"binary":return latin1Slice(this,t,r);case"base64":return base64Slice(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return utf16leSlice(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase();n=true}}}Buffer.prototype._isBuffer=true;function swap(e,t,r){var n=e[t];e[t]=e[r];e[r]=n}Buffer.prototype.swap16=function e(){var t=this.length;if(t%2!==0){throw new RangeError("Buffer size must be a multiple of 16-bits")}for(var r=0;r<t;r+=2){swap(this,r,r+1)}return this};Buffer.prototype.swap32=function e(){var t=this.length;if(t%4!==0){throw new RangeError("Buffer size must be a multiple of 32-bits")}for(var r=0;r<t;r+=4){swap(this,r,r+3);swap(this,r+1,r+2)}return this};Buffer.prototype.swap64=function e(){var t=this.length;if(t%8!==0){throw new RangeError("Buffer size must be a multiple of 64-bits")}for(var r=0;r<t;r+=8){swap(this,r,r+7);swap(this,r+1,r+6);swap(this,r+2,r+5);swap(this,r+3,r+4)}return this};Buffer.prototype.toString=function e(){var t=this.length|0;if(t===0)return"";if(arguments.length===0)return utf8Slice(this,0,t);return slowToString.apply(this,arguments)};Buffer.prototype.equals=function e(t){if(!internalIsBuffer(t))throw new TypeError("Argument must be a Buffer");if(this===t)return true;return Buffer.compare(this,t)===0};Buffer.prototype.inspect=function e(){var t="";var r=INSPECT_MAX_BYTES;if(this.length>0){t=this.toString("hex",0,r).match(/.{2}/g).join(" ");if(this.length>r)t+=" ... "}return"<Buffer "+t+">"};Buffer.prototype.compare=function e(t,r,n,i,o){if(!internalIsBuffer(t)){throw new TypeError("Argument must be a Buffer")}if(r===undefined){r=0}if(n===undefined){n=t?t.length:0}if(i===undefined){i=0}if(o===undefined){o=this.length}if(r<0||n>t.length||i<0||o>this.length){throw new RangeError("out of range index")}if(i>=o&&r>=n){return 0}if(i>=o){return-1}if(r>=n){return 1}r>>>=0;n>>>=0;i>>>=0;o>>>=0;if(this===t)return 0;var s=o-i;var a=n-r;var f=Math.min(s,a);var u=this.slice(i,o);var c=t.slice(r,n);for(var l=0;l<f;++l){if(u[l]!==c[l]){s=u[l];a=c[l];break}}if(s<a)return-1;if(a<s)return 1;return 0};function bidirectionalIndexOf(e,t,r,n,i){if(e.length===0)return-1;if(typeof r==="string"){n=r;r=0}else if(r>2147483647){r=2147483647}else if(r<-2147483648){r=-2147483648}r=+r;if(isNaN(r)){r=i?0:e.length-1}if(r<0)r=e.length+r;if(r>=e.length){if(i)return-1;else r=e.length-1}else if(r<0){if(i)r=0;else return-1}if(typeof t==="string"){t=Buffer.from(t,n)}if(internalIsBuffer(t)){if(t.length===0){return-1}return arrayIndexOf(e,t,r,n,i)}else if(typeof t==="number"){t=t&255;if(Buffer.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf==="function"){if(i){return Uint8Array.prototype.indexOf.call(e,t,r)}else{return Uint8Array.prototype.lastIndexOf.call(e,t,r)}}return arrayIndexOf(e,[t],r,n,i)}throw new TypeError("val must be string, number or Buffer")}function arrayIndexOf(e,t,r,n,i){var o=1;var s=e.length;var a=t.length;if(n!==undefined){n=String(n).toLowerCase();if(n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le"){if(e.length<2||t.length<2){return-1}o=2;s/=2;a/=2;r/=2}}function f(e,t){if(o===1){return e[t]}else{return e.readUInt16BE(t*o)}}var u;if(i){var c=-1;for(u=r;u<s;u++){if(f(e,u)===f(t,c===-1?0:u-c)){if(c===-1)c=u;if(u-c+1===a)return c*o}else{if(c!==-1)u-=u-c;c=-1}}}else{if(r+a>s)r=s-a;for(u=r;u>=0;u--){var l=true;for(var h=0;h<a;h++){if(f(e,u+h)!==f(t,h)){l=false;break}}if(l)return u}}return-1}Buffer.prototype.includes=function e(t,r,n){return this.indexOf(t,r,n)!==-1};Buffer.prototype.indexOf=function e(t,r,n){return bidirectionalIndexOf(this,t,r,n,true)};Buffer.prototype.lastIndexOf=function e(t,r,n){return bidirectionalIndexOf(this,t,r,n,false)};function hexWrite(e,t,r,n){r=Number(r)||0;var i=e.length-r;if(!n){n=i}else{n=Number(n);if(n>i){n=i}}var o=t.length;if(o%2!==0)throw new TypeError("Invalid hex string");if(n>o/2){n=o/2}for(var s=0;s<n;++s){var a=parseInt(t.substr(s*2,2),16);if(isNaN(a))return s;e[r+s]=a}return s}function utf8Write(e,t,r,n){return blitBuffer(utf8ToBytes(t,e.length-r),e,r,n)}function asciiWrite(e,t,r,n){return blitBuffer(asciiToBytes(t),e,r,n)}function latin1Write(e,t,r,n){return asciiWrite(e,t,r,n)}function base64Write(e,t,r,n){return blitBuffer(base64ToBytes(t),e,r,n)}function ucs2Write(e,t,r,n){return blitBuffer(utf16leToBytes(t,e.length-r),e,r,n)}Buffer.prototype.write=function e(t,r,n,i){if(r===undefined){i="utf8";n=this.length;r=0}else if(n===undefined&&typeof r==="string"){i=r;n=this.length;r=0}else if(isFinite(r)){r=r|0;if(isFinite(n)){n=n|0;if(i===undefined)i="utf8"}else{i=n;n=undefined}}else{throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported")}var o=this.length-r;if(n===undefined||n>o)n=o;if(t.length>0&&(n<0||r<0)||r>this.length){throw new RangeError("Attempt to write outside buffer bounds")}if(!i)i="utf8";var s=false;for(;;){switch(i){case"hex":return hexWrite(this,t,r,n);case"utf8":case"utf-8":return utf8Write(this,t,r,n);case"ascii":return asciiWrite(this,t,r,n);case"latin1":case"binary":return latin1Write(this,t,r,n);case"base64":return base64Write(this,t,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ucs2Write(this,t,r,n);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase();s=true}}};Buffer.prototype.toJSON=function e(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function base64Slice(e,t,r){if(t===0&&r===e.length){return fromByteArray(e)}else{return fromByteArray(e.slice(t,r))}}function utf8Slice(e,t,r){r=Math.min(e.length,r);var n=[];var i=t;while(i<r){var o=e[i];var s=null;var a=o>239?4:o>223?3:o>191?2:1;if(i+a<=r){var f,u,c,l;switch(a){case 1:if(o<128){s=o}break;case 2:f=e[i+1];if((f&192)===128){l=(o&31)<<6|f&63;if(l>127){s=l}}break;case 3:f=e[i+1];u=e[i+2];if((f&192)===128&&(u&192)===128){l=(o&15)<<12|(f&63)<<6|u&63;if(l>2047&&(l<55296||l>57343)){s=l}}break;case 4:f=e[i+1];u=e[i+2];c=e[i+3];if((f&192)===128&&(u&192)===128&&(c&192)===128){l=(o&15)<<18|(f&63)<<12|(u&63)<<6|c&63;if(l>65535&&l<1114112){s=l}}}}if(s===null){s=65533;a=1}else if(s>65535){s-=65536;n.push(s>>>10&1023|55296);s=56320|s&1023}n.push(s);i+=a}return decodeCodePointsArray(n)}var MAX_ARGUMENTS_LENGTH=4096;function decodeCodePointsArray(e){var t=e.length;if(t<=MAX_ARGUMENTS_LENGTH){return String.fromCharCode.apply(String,e)}var r="";var n=0;while(n<t){r+=String.fromCharCode.apply(String,e.slice(n,n+=MAX_ARGUMENTS_LENGTH))}return r}function asciiSlice(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i){n+=String.fromCharCode(e[i]&127)}return n}function latin1Slice(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i){n+=String.fromCharCode(e[i])}return n}function hexSlice(e,t,r){var n=e.length;if(!t||t<0)t=0;if(!r||r<0||r>n)r=n;var i="";for(var o=t;o<r;++o){i+=toHex(e[o])}return i}function utf16leSlice(e,t,r){var n=e.slice(t,r);var i="";for(var o=0;o<n.length;o+=2){i+=String.fromCharCode(n[o]+n[o+1]*256)}return i}Buffer.prototype.slice=function e(t,r){var n=this.length;t=~~t;r=r===undefined?n:~~r;if(t<0){t+=n;if(t<0)t=0}else if(t>n){t=n}if(r<0){r+=n;if(r<0)r=0}else if(r>n){r=n}if(r<t)r=t;var i;if(Buffer.TYPED_ARRAY_SUPPORT){i=this.subarray(t,r);i.__proto__=Buffer.prototype}else{var o=r-t;i=new Buffer(o,undefined);for(var s=0;s<o;++s){i[s]=this[s+t]}}return i};function checkOffset(e,t,r){if(e%1!==0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}Buffer.prototype.readUIntLE=function e(t,r,n){t=t|0;r=r|0;if(!n)checkOffset(t,r,this.length);var i=this[t];var o=1;var s=0;while(++s<r&&(o*=256)){i+=this[t+s]*o}return i};Buffer.prototype.readUIntBE=function e(t,r,n){t=t|0;r=r|0;if(!n){checkOffset(t,r,this.length)}var i=this[t+--r];var o=1;while(r>0&&(o*=256)){i+=this[t+--r]*o}return i};Buffer.prototype.readUInt8=function e(t,r){if(!r)checkOffset(t,1,this.length);return this[t]};Buffer.prototype.readUInt16LE=function e(t,r){if(!r)checkOffset(t,2,this.length);return this[t]|this[t+1]<<8};Buffer.prototype.readUInt16BE=function e(t,r){if(!r)checkOffset(t,2,this.length);return this[t]<<8|this[t+1]};Buffer.prototype.readUInt32LE=function e(t,r){if(!r)checkOffset(t,4,this.length);return(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216};Buffer.prototype.readUInt32BE=function e(t,r){if(!r)checkOffset(t,4,this.length);return this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])};Buffer.prototype.readIntLE=function e(t,r,n){t=t|0;r=r|0;if(!n)checkOffset(t,r,this.length);var i=this[t];var o=1;var s=0;while(++s<r&&(o*=256)){i+=this[t+s]*o}o*=128;if(i>=o)i-=Math.pow(2,8*r);return i};Buffer.prototype.readIntBE=function e(t,r,n){t=t|0;r=r|0;if(!n)checkOffset(t,r,this.length);var i=r;var o=1;var s=this[t+--i];while(i>0&&(o*=256)){s+=this[t+--i]*o}o*=128;if(s>=o)s-=Math.pow(2,8*r);return s};Buffer.prototype.readInt8=function e(t,r){if(!r)checkOffset(t,1,this.length);if(!(this[t]&128))return this[t];return(255-this[t]+1)*-1};Buffer.prototype.readInt16LE=function e(t,r){if(!r)checkOffset(t,2,this.length);var n=this[t]|this[t+1]<<8;return n&32768?n|4294901760:n};Buffer.prototype.readInt16BE=function e(t,r){if(!r)checkOffset(t,2,this.length);var n=this[t+1]|this[t]<<8;return n&32768?n|4294901760:n};Buffer.prototype.readInt32LE=function e(t,r){if(!r)checkOffset(t,4,this.length);return this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24};Buffer.prototype.readInt32BE=function e(t,r){if(!r)checkOffset(t,4,this.length);return this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]};Buffer.prototype.readFloatLE=function e(t,r){if(!r)checkOffset(t,4,this.length);return read(this,t,true,23,4)};Buffer.prototype.readFloatBE=function e(t,r){if(!r)checkOffset(t,4,this.length);return read(this,t,false,23,4)};Buffer.prototype.readDoubleLE=function e(t,r){if(!r)checkOffset(t,8,this.length);return read(this,t,true,52,8)};Buffer.prototype.readDoubleBE=function e(t,r){if(!r)checkOffset(t,8,this.length);return read(this,t,false,52,8)};function checkInt(e,t,r,n,i,o){if(!internalIsBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}Buffer.prototype.writeUIntLE=function e(t,r,n,i){t=+t;r=r|0;n=n|0;if(!i){var o=Math.pow(2,8*n)-1;checkInt(this,t,r,n,o,0)}var s=1;var a=0;this[r]=t&255;while(++a<n&&(s*=256)){this[r+a]=t/s&255}return r+n};Buffer.prototype.writeUIntBE=function e(t,r,n,i){t=+t;r=r|0;n=n|0;if(!i){var o=Math.pow(2,8*n)-1;checkInt(this,t,r,n,o,0)}var s=n-1;var a=1;this[r+s]=t&255;while(--s>=0&&(a*=256)){this[r+s]=t/a&255}return r+n};Buffer.prototype.writeUInt8=function e(t,r,n){t=+t;r=r|0;if(!n)checkInt(this,t,r,1,255,0);if(!Buffer.TYPED_ARRAY_SUPPORT)t=Math.floor(t);this[r]=t&255;return r+1};function objectWriteUInt16(e,t,r,n){if(t<0)t=65535+t+1;for(var i=0,o=Math.min(e.length-r,2);i<o;++i){e[r+i]=(t&255<<8*(n?i:1-i))>>>(n?i:1-i)*8}}Buffer.prototype.writeUInt16LE=function e(t,r,n){t=+t;r=r|0;if(!n)checkInt(this,t,r,2,65535,0);if(Buffer.TYPED_ARRAY_SUPPORT){this[r]=t&255;this[r+1]=t>>>8}else{objectWriteUInt16(this,t,r,true)}return r+2};Buffer.prototype.writeUInt16BE=function e(t,r,n){t=+t;r=r|0;if(!n)checkInt(this,t,r,2,65535,0);if(Buffer.TYPED_ARRAY_SUPPORT){this[r]=t>>>8;this[r+1]=t&255}else{objectWriteUInt16(this,t,r,false)}return r+2};function objectWriteUInt32(e,t,r,n){if(t<0)t=4294967295+t+1;for(var i=0,o=Math.min(e.length-r,4);i<o;++i){e[r+i]=t>>>(n?i:3-i)*8&255}}Buffer.prototype.writeUInt32LE=function e(t,r,n){t=+t;r=r|0;if(!n)checkInt(this,t,r,4,4294967295,0);if(Buffer.TYPED_ARRAY_SUPPORT){this[r+3]=t>>>24;this[r+2]=t>>>16;this[r+1]=t>>>8;this[r]=t&255}else{objectWriteUInt32(this,t,r,true)}return r+4};Buffer.prototype.writeUInt32BE=function e(t,r,n){t=+t;r=r|0;if(!n)checkInt(this,t,r,4,4294967295,0);if(Buffer.TYPED_ARRAY_SUPPORT){this[r]=t>>>24;this[r+1]=t>>>16;this[r+2]=t>>>8;this[r+3]=t&255}else{objectWriteUInt32(this,t,r,false)}return r+4};Buffer.prototype.writeIntLE=function e(t,r,n,i){t=+t;r=r|0;if(!i){var o=Math.pow(2,8*n-1);checkInt(this,t,r,n,o-1,-o)}var s=0;var a=1;var f=0;this[r]=t&255;while(++s<n&&(a*=256)){if(t<0&&f===0&&this[r+s-1]!==0){f=1}this[r+s]=(t/a>>0)-f&255}return r+n};Buffer.prototype.writeIntBE=function e(t,r,n,i){t=+t;r=r|0;if(!i){var o=Math.pow(2,8*n-1);checkInt(this,t,r,n,o-1,-o)}var s=n-1;var a=1;var f=0;this[r+s]=t&255;while(--s>=0&&(a*=256)){if(t<0&&f===0&&this[r+s+1]!==0){f=1}this[r+s]=(t/a>>0)-f&255}return r+n};Buffer.prototype.writeInt8=function e(t,r,n){t=+t;r=r|0;if(!n)checkInt(this,t,r,1,127,-128);if(!Buffer.TYPED_ARRAY_SUPPORT)t=Math.floor(t);if(t<0)t=255+t+1;this[r]=t&255;return r+1};Buffer.prototype.writeInt16LE=function e(t,r,n){t=+t;r=r|0;if(!n)checkInt(this,t,r,2,32767,-32768);if(Buffer.TYPED_ARRAY_SUPPORT){this[r]=t&255;this[r+1]=t>>>8}else{objectWriteUInt16(this,t,r,true)}return r+2};Buffer.prototype.writeInt16BE=function e(t,r,n){t=+t;r=r|0;if(!n)checkInt(this,t,r,2,32767,-32768);if(Buffer.TYPED_ARRAY_SUPPORT){this[r]=t>>>8;this[r+1]=t&255}else{objectWriteUInt16(this,t,r,false)}return r+2};Buffer.prototype.writeInt32LE=function e(t,r,n){t=+t;r=r|0;if(!n)checkInt(this,t,r,4,2147483647,-2147483648);if(Buffer.TYPED_ARRAY_SUPPORT){this[r]=t&255;this[r+1]=t>>>8;this[r+2]=t>>>16;this[r+3]=t>>>24}else{objectWriteUInt32(this,t,r,true)}return r+4};Buffer.prototype.writeInt32BE=function e(t,r,n){t=+t;r=r|0;if(!n)checkInt(this,t,r,4,2147483647,-2147483648);if(t<0)t=4294967295+t+1;if(Buffer.TYPED_ARRAY_SUPPORT){this[r]=t>>>24;this[r+1]=t>>>16;this[r+2]=t>>>8;this[r+3]=t&255}else{objectWriteUInt32(this,t,r,false)}return r+4};function checkIEEE754(e,t,r,n,i,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function writeFloat(e,t,r,n,i){if(!i){checkIEEE754(e,t,r,4)}write(e,t,r,n,23,4);return r+4}Buffer.prototype.writeFloatLE=function e(t,r,n){return writeFloat(this,t,r,true,n)};Buffer.prototype.writeFloatBE=function e(t,r,n){return writeFloat(this,t,r,false,n)};function writeDouble(e,t,r,n,i){if(!i){checkIEEE754(e,t,r,8)}write(e,t,r,n,52,8);return r+8}Buffer.prototype.writeDoubleLE=function e(t,r,n){return writeDouble(this,t,r,true,n)};Buffer.prototype.writeDoubleBE=function e(t,r,n){return writeDouble(this,t,r,false,n)};Buffer.prototype.copy=function e(t,r,n,i){if(!n)n=0;if(!i&&i!==0)i=this.length;if(r>=t.length)r=t.length;if(!r)r=0;if(i>0&&i<n)i=n;if(i===n)return 0;if(t.length===0||this.length===0)return 0;if(r<0){throw new RangeError("targetStart out of bounds")}if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");if(i>this.length)i=this.length;if(t.length-r<i-n){i=t.length-r+n}var o=i-n;var s;if(this===t&&n<r&&r<i){for(s=o-1;s>=0;--s){t[s+r]=this[s+n]}}else if(o<1e3||!Buffer.TYPED_ARRAY_SUPPORT){for(s=0;s<o;++s){t[s+r]=this[s+n]}}else{Uint8Array.prototype.set.call(t,this.subarray(n,n+o),r)}return o};Buffer.prototype.fill=function e(t,r,n,i){if(typeof t==="string"){if(typeof r==="string"){i=r;r=0;n=this.length}else if(typeof n==="string"){i=n;n=this.length}if(t.length===1){var o=t.charCodeAt(0);if(o<256){t=o}}if(i!==undefined&&typeof i!=="string"){throw new TypeError("encoding must be a string")}if(typeof i==="string"&&!Buffer.isEncoding(i)){throw new TypeError("Unknown encoding: "+i)}}else if(typeof t==="number"){t=t&255}if(r<0||this.length<r||this.length<n){throw new RangeError("Out of range index")}if(n<=r){return this}r=r>>>0;n=n===undefined?this.length:n>>>0;if(!t)t=0;var s;if(typeof t==="number"){for(s=r;s<n;++s){this[s]=t}}else{var a=internalIsBuffer(t)?t:utf8ToBytes(new Buffer(t,i).toString());var f=a.length;for(s=0;s<n-r;++s){this[s+r]=a[s%f]}}return this};var INVALID_BASE64_RE=/[^+\/0-9A-Za-z-_]/g;function base64clean(e){e=stringtrim(e).replace(INVALID_BASE64_RE,"");if(e.length<2)return"";while(e.length%4!==0){e=e+"="}return e}function stringtrim(e){if(e.trim)return e.trim();return e.replace(/^\s+|\s+$/g,"")}function toHex(e){if(e<16)return"0"+e.toString(16);return e.toString(16)}function utf8ToBytes(e,t){t=t||Infinity;var r;var n=e.length;var i=null;var o=[];for(var s=0;s<n;++s){r=e.charCodeAt(s);if(r>55295&&r<57344){if(!i){if(r>56319){if((t-=3)>-1)o.push(239,191,189);continue}else if(s+1===n){if((t-=3)>-1)o.push(239,191,189);continue}i=r;continue}if(r<56320){if((t-=3)>-1)o.push(239,191,189);i=r;continue}r=(i-55296<<10|r-56320)+65536}else if(i){if((t-=3)>-1)o.push(239,191,189)}i=null;if(r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,r&63|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else{throw new Error("Invalid code point")}}return o}function asciiToBytes(e){var t=[];for(var r=0;r<e.length;++r){t.push(e.charCodeAt(r)&255)}return t}function utf16leToBytes(e,t){var r,n,i;var o=[];for(var s=0;s<e.length;++s){if((t-=2)<0)break;r=e.charCodeAt(s);n=r>>8;i=r%256;o.push(i);o.push(n)}return o}function base64ToBytes(e){return toByteArray(base64clean(e))}function blitBuffer(e,t,r,n){for(var i=0;i<n;++i){if(i+r>=t.length||i>=e.length)break;t[i+r]=e[i]}return i}function isnan(e){return e!==e}function isBuffer$1(e){return e!=null&&(!!e._isBuffer||isFastBuffer(e)||isSlowBuffer(e))}function isFastBuffer(e){return!!e.constructor&&typeof e.constructor.isBuffer==="function"&&e.constructor.isBuffer(e)}function isSlowBuffer(e){return typeof e.readFloatLE==="function"&&typeof e.slice==="function"&&isFastBuffer(e.slice(0,0))}var b64="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";var b64re=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/;var AtoB=function(e){e=String(e).replace(/[\t\n\f\r ]+/g,"");if(!b64re.test(e))throw new TypeError("Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.");e+="==".slice(2-(e.length&3));var t;var r="";var n;var i;var o=0;for(;o<e.length;){t=b64.indexOf(e.charAt(o++))<<18|b64.indexOf(e.charAt(o++))<<12|(n=b64.indexOf(e.charAt(o++)))<<6|(i=b64.indexOf(e.charAt(o++)));r+=n===64?String.fromCharCode(t>>16&255):i===64?String.fromCharCode(t>>16&255,t>>8&255):String.fromCharCode(t>>16&255,t>>8&255,t&255)}return r};var decodeJWTBody=function(e){return JSON.parse(AtoB((e||"").split(".")[1]||""))};var decodeAccessTokenBody=function(e){var t;try{t=decodeJWTBody(e);if(t===null){return null}}catch(e){return null}Object.keys(t).forEach((function(e){if(typeof e==="string"&&e.startsWith("https://verdocs.com/")){t[e.replace("https://verdocs.com/","")]=t[e];delete t[e]}}));return t};var __awaiter$1=undefined&&undefined.__awaiter||function(e,t,r,n){function i(e){return e instanceof r?e:new r((function(t){t(e)}))}return new(r||(r=Promise))((function(r,o){function s(e){try{f(n.next(e))}catch(e){o(e)}}function a(e){try{f(n["throw"](e))}catch(e){o(e)}}function f(e){e.done?r(e.value):i(e.value).then(s,a)}f((n=n.apply(e,t||[])).next())}))};var __generator$1=undefined&&undefined.__generator||function(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(e){return function(t){return f([e,t])}}function f(s){if(n)throw new TypeError("Generator is already executing.");while(r)try{if(n=1,i&&(o=s[0]&2?i["return"]:s[0]?i["throw"]||((o=i["return"])&&o.call(i),0):i.next)&&!(o=o.call(i,s[1])).done)return o;if(i=0,o)s=[s[0]&2,o.value];switch(s[0]){case 0:case 1:o=s;break;case 4:r.label++;return{value:s[1],done:false};case 5:r.label++;i=s[1];s=[0];continue;case 7:s=r.ops.pop();r.trys.pop();continue;default:if(!(o=r.trys,o=o.length>0&&o[o.length-1])&&(s[0]===6||s[0]===2)){r=0;continue}if(s[0]===3&&(!o||s[1]>o[0]&&s[1]<o[3])){r.label=s[1];break}if(s[0]===6&&r.label<o[1]){r.label=o[1];o=s;break}if(o&&r.label<o[2]){r.label=o[2];r.ops.push(s);break}if(o[2])r.ops.pop();r.trys.pop();continue}s=t.call(e,r)}catch(e){s=[6,e];i=0}finally{n=o=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};var getSummary=function(e,t){return __awaiter$1(void 0,void 0,void 0,(function(){return __generator$1(this,(function(r){return[2,e.api.post("/documents/summary",{page:t}).then((function(e){return e.data}))]}))}))};var searchDocuments=function(e,t){return __awaiter$1(void 0,void 0,void 0,(function(){return __generator$1(this,(function(r){return[2,e.api.post("/documents/search",t).then((function(e){return e.data}))]}))}))};var getSigningSession=function(e,t){return __awaiter$1(void 0,void 0,void 0,(function(){return __generator$1(this,(function(r){return[2,e.api.get("/documents/".concat(t.documentId,"/recipients/").concat(encodeURIComponent(t.roleId),"/invitation/").concat(t.inviteCode)).then((function(t){var r,n;var i=((r=t.headers)===null||r===void 0?void 0:r.signer_token)||"";var o=decodeAccessTokenBody(i);e.setToken((n=t.headers)===null||n===void 0?void 0:n.signer_token);return{recipient:t.data,session:o,signerToken:i}}))]}))}))};var getDocumentRecipients=function(e,t){return __awaiter$1(void 0,void 0,void 0,(function(){return __generator$1(this,(function(r){return[2,e.api.get("/documents/".concat(t,"/recipients")).then((function(e){return e.data}))]}))}))};var getDocument=function(e,t){return __awaiter$1(void 0,void 0,void 0,(function(){return __generator$1(this,(function(r){return[2,e.api.get("/documents/".concat(t)).then((function(e){return e.data}))]}))}))};var getDocumentFile=function(e,t,r){return __awaiter$1(void 0,void 0,void 0,(function(){return __generator$1(this,(function(n){return[2,e.api.get("/documents/".concat(t,"/envelope_documents/").concat(r,"?file=true"),{responseType:"arraybuffer"}).then((function(e){return Buffer.from(e.data,"binary").toString("base64")}))]}))}))};var updateDocumentField=function(e,t,r,n){return __awaiter$1(void 0,void 0,void 0,(function(){return __generator$1(this,(function(i){return[2,e.api.put("/documents/".concat(t,"/fields/").concat(r),n).then((function(e){return e.data}))]}))}))};var updateDocumentFieldSignature=function(e,t,r,n){return __awaiter$1(void 0,void 0,void 0,(function(){return __generator$1(this,(function(i){return[2,e.api.put("/documents/".concat(t,"/fields/").concat(r,"/signature/").concat(n)).then((function(e){return e.data}))]}))}))};var Documents$1=Object.freeze({__proto__:null,getSummary:getSummary,searchDocuments:searchDocuments,getSigningSession:getSigningSession,getDocumentRecipients:getDocumentRecipients,getDocument:getDocument,getDocumentFile:getDocumentFile,updateDocumentField:updateDocumentField,updateDocumentFieldSignature:updateDocumentFieldSignature});var __assign=undefined&&undefined.__assign||function(){__assign=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i))e[i]=t[i]}return e};return __assign.apply(this,arguments)};var __awaiter=undefined&&undefined.__awaiter||function(e,t,r,n){function i(e){return e instanceof r?e:new r((function(t){t(e)}))}return new(r||(r=Promise))((function(r,o){function s(e){try{f(n.next(e))}catch(e){o(e)}}function a(e){try{f(n["throw"](e))}catch(e){o(e)}}function f(e){e.done?r(e.value):i(e.value).then(s,a)}f((n=n.apply(e,t||[])).next())}))};var __generator=undefined&&undefined.__generator||function(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(e){return function(t){return f([e,t])}}function f(s){if(n)throw new TypeError("Generator is already executing.");while(r)try{if(n=1,i&&(o=s[0]&2?i["return"]:s[0]?i["throw"]||((o=i["return"])&&o.call(i),0):i.next)&&!(o=o.call(i,s[1])).done)return o;if(i=0,o)s=[s[0]&2,o.value];switch(s[0]){case 0:case 1:o=s;break;case 4:r.label++;return{value:s[1],done:false};case 5:r.label++;i=s[1];s=[0];continue;case 7:s=r.ops.pop();r.trys.pop();continue;default:if(!(o=r.trys,o=o.length>0&&o[o.length-1])&&(s[0]===6||s[0]===2)){r=0;continue}if(s[0]===3&&(!o||s[1]>o[0]&&s[1]<o[3])){r.label=s[1];break}if(s[0]===6&&r.label<o[1]){r.label=o[1];o=s;break}if(o&&r.label<o[2]){r.label=o[2];r.ops.push(s);break}if(o[2])r.ops.pop();r.trys.pop();continue}s=t.call(e,r)}catch(e){s=[6,e];i=0}finally{n=o=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};var updateRecipientStatus=function(e,t,r,n,i){return __awaiter(void 0,void 0,void 0,(function(){return __generator(this,(function(o){return[2,e.api.put("/documents/".concat(t,"/recipients/").concat(r),__assign({role_name:r,action:n},i||{})).then((function(e){return e.data}))]}))}))};var Recipients=Object.freeze({__proto__:null,updateRecipientStatus:updateRecipientStatus});var createSignature=function(e,t,r){var n=new FormData;n.append("signature",r,t);return e.api.post("/signatures",n).then((function(e){return e.data}))};var getSignatures=function(e){return e.api.get("/signatures").then((function(e){return e.data}))};var getSignature=function(e,t){return e.api.get("/signatures/".concat(t)).then((function(e){return e.data}))};var deleteSignature=function(e,t){return e.api.delete("/signatures/".concat(t)).then((function(e){return e.data}))};var Signatures=Object.freeze({__proto__:null,createSignature:createSignature,getSignatures:getSignatures,getSignature:getSignature,deleteSignature:deleteSignature});var createInitials=function(e,t,r){var n=new FormData;n.append("initial",r,t);return e.api.post("/initials",n).then((function(e){return e.data}))};var Initials=Object.freeze({__proto__:null,createInitials:createInitials});var Types=Object.freeze({__proto__:null});var Documents=Object.freeze({__proto__:null,Documents:Documents$1,Recipients:Recipients,Signatures:Signatures,Initials:Initials,Types:Types});var TemplatePermissions;(function(e){e["TEMPLATE_CREATOR_CREATE_PUBLIC"]="template:creator:create:public";e["TEMPLATE_CREATOR_CREATE_ORG"]="template:creator:create:org";e["TEMPLATE_CREATOR_CREATE_PERSONAL"]="template:creator:create:personal";e["TEMPLATE_CREATOR_DELETE"]="template:creator:delete";e["TEMPLATE_CREATOR_VISIBILITY"]="template:creator:visibility";e["TEMPLATE_MEMBER_READ"]="template:member:read";e["TEMPLATE_MEMBER_WRITE"]="template:member:write";e["TEMPLATE_MEMBER_DELETE"]="template:member:delete";e["TEMPLATE_MEMBER_VISIBILITY"]="template:member:visibility"})(TemplatePermissions||(TemplatePermissions={}));var TemplateSenderTypes;(function(e){e["CREATOR"]="creator";e["ORGANIZATION_MEMBER"]="organization_member";e["ORGANIZATION_MEMBER_AS_CREATOR"]="organization_member_as_creator";e["EVERYONE"]="everyone";e["EVERYONE_AS_CREATOR"]="everyone_as_creator"})(TemplateSenderTypes||(TemplateSenderTypes={}));var TemplateActions;(function(e){e["CREATE_PERSONAL"]="create_personal";e["CREATE_ORG"]="create_org";e["CREATE_PUBLIC"]="create_public";e["READ"]="read";e["WRITE"]="write";e["DELETE"]="delete";e["CHANGE_VISIBILITY_PERSONAL"]="change_visibility_personal";e["CHANGE_VISIBILITY_ORG"]="change_visibility_org";e["CHANGE_VISIBILITY_PUBLIC"]="change_visibility_public"})(TemplateActions||(TemplateActions={}));var SortOptions;(function(e){e["CREATED_AT"]="created_at";e["UPDATED_AT"]="updated_at";e["NAME"]="name";e["LAST_USED_AT"]="last_used_at";e["COUNTER"]="counter";e["STAR_COUNTER"]="star_counter"})(SortOptions||(SortOptions={}));var bind=function e(t,r){return function e(){var n=new Array(arguments.length);for(var i=0;i<n.length;i++){n[i]=arguments[i]}return t.apply(r,n)}};var toString=Object.prototype.toString;var kindOf=function(e){return function(t){var r=toString.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())}}(Object.create(null));function kindOfTest(e){e=e.toLowerCase();return function t(r){return kindOf(r)===e}}function isArray(e){return Array.isArray(e)}function isUndefined(e){return typeof e==="undefined"}function isBuffer(e){return e!==null&&!isUndefined(e)&&e.constructor!==null&&!isUndefined(e.constructor)&&typeof e.constructor.isBuffer==="function"&&e.constructor.isBuffer(e)}var isArrayBuffer=kindOfTest("ArrayBuffer");function isArrayBufferView(e){var t;if(typeof ArrayBuffer!=="undefined"&&ArrayBuffer.isView){t=ArrayBuffer.isView(e)}else{t=e&&e.buffer&&isArrayBuffer(e.buffer)}return t}function isString(e){return typeof e==="string"}function isNumber(e){return typeof e==="number"}function isObject(e){return e!==null&&typeof e==="object"}function isPlainObject(e){if(kindOf(e)!=="object"){return false}var t=Object.getPrototypeOf(e);return t===null||t===Object.prototype}var isDate=kindOfTest("Date");var isFile=kindOfTest("File");var isBlob=kindOfTest("Blob");var isFileList=kindOfTest("FileList");function isFunction(e){return toString.call(e)==="[object Function]"}function isStream(e){return isObject(e)&&isFunction(e.pipe)}function isFormData(e){var t="[object FormData]";return e&&(typeof FormData==="function"&&e instanceof FormData||toString.call(e)===t||isFunction(e.toString)&&e.toString()===t)}var isURLSearchParams=kindOfTest("URLSearchParams");function trim(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function isStandardBrowserEnv(){if(typeof navigator!=="undefined"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")){return false}return typeof window!=="undefined"&&typeof document!=="undefined"}function forEach(e,t){if(e===null||typeof e==="undefined"){return}if(typeof e!=="object"){e=[e]}if(isArray(e)){for(var r=0,n=e.length;r<n;r++){t.call(null,e[r],r,e)}}else{for(var i in e){if(Object.prototype.hasOwnProperty.call(e,i)){t.call(null,e[i],i,e)}}}}function merge(){var e={};function t(t,r){if(isPlainObject(e[r])&&isPlainObject(t)){e[r]=merge(e[r],t)}else if(isPlainObject(t)){e[r]=merge({},t)}else if(isArray(t)){e[r]=t.slice()}else{e[r]=t}}for(var r=0,n=arguments.length;r<n;r++){forEach(arguments[r],t)}return e}function extend(e,t,r){forEach(t,(function t(n,i){if(r&&typeof n==="function"){e[i]=bind(n,r)}else{e[i]=n}}));return e}function stripBOM(e){if(e.charCodeAt(0)===65279){e=e.slice(1)}return e}function inherits(e,t,r,n){e.prototype=Object.create(t.prototype,n);e.prototype.constructor=e;r&&Object.assign(e.prototype,r)}function toFlatObject(e,t,r){var n;var i;var o;var s={};t=t||{};do{n=Object.getOwnPropertyNames(e);i=n.length;while(i-- >0){o=n[i];if(!s[o]){t[o]=e[o];s[o]=true}}e=Object.getPrototypeOf(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t}function endsWith(e,t,r){e=String(e);if(r===undefined||r>e.length){r=e.length}r-=t.length;var n=e.indexOf(t,r);return n!==-1&&n===r}function toArray(e){if(!e)return null;var t=e.length;if(isUndefined(t))return null;var r=new Array(t);while(t-- >0){r[t]=e[t]}return r}var isTypedArray=function(e){return function(t){return e&&t instanceof e}}(typeof Uint8Array!=="undefined"&&Object.getPrototypeOf(Uint8Array));var utils={isArray:isArray,isArrayBuffer:isArrayBuffer,isBuffer:isBuffer,isFormData:isFormData,isArrayBufferView:isArrayBufferView,isString:isString,isNumber:isNumber,isObject:isObject,isPlainObject:isPlainObject,isUndefined:isUndefined,isDate:isDate,isFile:isFile,isBlob:isBlob,isFunction:isFunction,isStream:isStream,isURLSearchParams:isURLSearchParams,isStandardBrowserEnv:isStandardBrowserEnv,forEach:forEach,merge:merge,extend:extend,trim:trim,stripBOM:stripBOM,inherits:inherits,toFlatObject:toFlatObject,kindOf:kindOf,kindOfTest:kindOfTest,endsWith:endsWith,toArray:toArray,isTypedArray:isTypedArray,isFileList:isFileList};function encode(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var buildURL=function e(t,r,n){if(!r){return t}var i;if(n){i=n(r)}else if(utils.isURLSearchParams(r)){i=r.toString()}else{var o=[];utils.forEach(r,(function e(t,r){if(t===null||typeof t==="undefined"){return}if(utils.isArray(t)){r=r+"[]"}else{t=[t]}utils.forEach(t,(function e(t){if(utils.isDate(t)){t=t.toISOString()}else if(utils.isObject(t)){t=JSON.stringify(t)}o.push(encode(r)+"="+encode(t))}))}));i=o.join("&")}if(i){var s=t.indexOf("#");if(s!==-1){t=t.slice(0,s)}t+=(t.indexOf("?")===-1?"?":"&")+i}return t};function InterceptorManager(){this.handlers=[]}InterceptorManager.prototype.use=function e(t,r,n){this.handlers.push({fulfilled:t,rejected:r,synchronous:n?n.synchronous:false,runWhen:n?n.runWhen:null});return this.handlers.length-1};InterceptorManager.prototype.eject=function e(t){if(this.handlers[t]){this.handlers[t]=null}};InterceptorManager.prototype.forEach=function e(t){utils.forEach(this.handlers,(function e(r){if(r!==null){t(r)}}))};var InterceptorManager_1=InterceptorManager;var commonjsGlobal=typeof globalThis!=="undefined"?globalThis:typeof window!=="undefined"?window:typeof global!=="undefined"?global:typeof self!=="undefined"?self:{};function getDefaultExportFromCjs(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e["default"]:e}function createCommonjsModule(e,t,r){return r={path:t,exports:{},require:function(e,t){return commonjsRequire()}},e(r,r.exports),r.exports}function getAugmentedNamespace(e){if(e.__esModule)return e;var t=Object.defineProperty({},"__esModule",{value:true});Object.keys(e).forEach((function(r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:true,get:function(){return e[r]}})}));return t}function commonjsRequire(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}var process_1=commonjsGlobal.process;var normalizeHeaderName=function e(t,r){utils.forEach(t,(function e(n,i){if(i!==r&&i.toUpperCase()===r.toUpperCase()){t[r]=n;delete t[i]}}))};function AxiosError(e,t,r,n,i){Error.call(this);this.message=e;this.name="AxiosError";t&&(this.code=t);r&&(this.config=r);n&&(this.request=n);i&&(this.response=i)}utils.inherits(AxiosError,Error,{toJSON:function e(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}}});var prototype=AxiosError.prototype;var descriptors={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED"].forEach((function(e){descriptors[e]={value:e}}));Object.defineProperties(AxiosError,descriptors);Object.defineProperty(prototype,"isAxiosError",{value:true});AxiosError.from=function(e,t,r,n,i,o){var s=Object.create(prototype);utils.toFlatObject(e,s,(function e(t){return t!==Error.prototype}));AxiosError.call(s,e.message,t,r,n,i);s.name=e.name;o&&Object.assign(s,o);return s};var AxiosError_1=AxiosError;var transitional={silentJSONParsing:true,forcedJSONParsing:true,clarifyTimeoutError:false};function toFormData(e,t){t=t||new FormData;var r=[];function n(e){if(e===null)return"";if(utils.isDate(e)){return e.toISOString()}if(utils.isArrayBuffer(e)||utils.isTypedArray(e)){return typeof Blob==="function"?new Blob([e]):Buffer.from(e)}return e}function i(e,o){if(utils.isPlainObject(e)||utils.isArray(e)){if(r.indexOf(e)!==-1){throw Error("Circular reference detected in "+o)}r.push(e);utils.forEach(e,(function e(r,s){if(utils.isUndefined(r))return;var a=o?o+"."+s:s;var f;if(r&&!o&&typeof r==="object"){if(utils.endsWith(s,"{}")){r=JSON.stringify(r)}else if(utils.endsWith(s,"[]")&&(f=utils.toArray(r))){f.forEach((function(e){!utils.isUndefined(e)&&t.append(a,n(e))}));return}}i(r,a)}));r.pop()}else{t.append(o,n(e))}}i(e);return t}var toFormData_1=toFormData;var settle=function e(t,r,n){var i=n.config.validateStatus;if(!n.status||!i||i(n.status)){t(n)}else{r(new AxiosError_1("Request failed with status code "+n.status,[AxiosError_1.ERR_BAD_REQUEST,AxiosError_1.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}};var cookies=utils.isStandardBrowserEnv()?function e(){return{write:function e(t,r,n,i,o,s){var a=[];a.push(t+"="+encodeURIComponent(r));if(utils.isNumber(n)){a.push("expires="+new Date(n).toGMTString())}if(utils.isString(i)){a.push("path="+i)}if(utils.isString(o)){a.push("domain="+o)}if(s===true){a.push("secure")}document.cookie=a.join("; ")},read:function e(t){var r=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return r?decodeURIComponent(r[3]):null},remove:function e(t){this.write(t,"",Date.now()-864e5)}}}():function e(){return{write:function e(){},read:function e(){return null},remove:function e(){}}}();var isAbsoluteURL=function e(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)};var combineURLs=function e(t,r){return r?t.replace(/\/+$/,"")+"/"+r.replace(/^\/+/,""):t};var buildFullPath=function e(t,r){if(t&&!isAbsoluteURL(r)){return combineURLs(t,r)}return r};var ignoreDuplicateOf=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];var parseHeaders=function e(t){var r={};var n;var i;var o;if(!t){return r}utils.forEach(t.split("\n"),(function e(t){o=t.indexOf(":");n=utils.trim(t.substr(0,o)).toLowerCase();i=utils.trim(t.substr(o+1));if(n){if(r[n]&&ignoreDuplicateOf.indexOf(n)>=0){return}if(n==="set-cookie"){r[n]=(r[n]?r[n]:[]).concat([i])}else{r[n]=r[n]?r[n]+", "+i:i}}}));return r};var isURLSameOrigin=utils.isStandardBrowserEnv()?function e(){var t=/(msie|trident)/i.test(navigator.userAgent);var r=document.createElement("a");var n;function i(e){var n=e;if(t){r.setAttribute("href",n);n=r.href}r.setAttribute("href",n);return{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:r.pathname.charAt(0)==="/"?r.pathname:"/"+r.pathname}}n=i(window.location.href);return function e(t){var r=utils.isString(t)?i(t):t;return r.protocol===n.protocol&&r.host===n.host}}():function e(){return function e(){return true}}();function CanceledError(e){AxiosError_1.call(this,e==null?"canceled":e,AxiosError_1.ERR_CANCELED);this.name="CanceledError"}utils.inherits(CanceledError,AxiosError_1,{__CANCEL__:true});var CanceledError_1=CanceledError;var parseProtocol=function e(t){var r=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return r&&r[1]||""};var xhr=function e(t){return new Promise((function e(r,n){var i=t.data;var o=t.headers;var s=t.responseType;var a;function f(){if(t.cancelToken){t.cancelToken.unsubscribe(a)}if(t.signal){t.signal.removeEventListener("abort",a)}}if(utils.isFormData(i)&&utils.isStandardBrowserEnv()){delete o["Content-Type"]}var u=new XMLHttpRequest;if(t.auth){var c=t.auth.username||"";var l=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";o.Authorization="Basic "+btoa(c+":"+l)}var h=buildFullPath(t.baseURL,t.url);u.open(t.method.toUpperCase(),buildURL(h,t.params,t.paramsSerializer),true);u.timeout=t.timeout;function p(){if(!u){return}var e="getAllResponseHeaders"in u?parseHeaders(u.getAllResponseHeaders()):null;var i=!s||s==="text"||s==="json"?u.responseText:u.response;var o={data:i,status:u.status,statusText:u.statusText,headers:e,config:t,request:u};settle((function e(t){r(t);f()}),(function e(t){n(t);f()}),o);u=null}if("onloadend"in u){u.onloadend=p}else{u.onreadystatechange=function e(){if(!u||u.readyState!==4){return}if(u.status===0&&!(u.responseURL&&u.responseURL.indexOf("file:")===0)){return}setTimeout(p)}}u.onabort=function e(){if(!u){return}n(new AxiosError_1("Request aborted",AxiosError_1.ECONNABORTED,t,u));u=null};u.onerror=function e(){n(new AxiosError_1("Network Error",AxiosError_1.ERR_NETWORK,t,u,u));u=null};u.ontimeout=function e(){var r=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded";var i=t.transitional||transitional;if(t.timeoutErrorMessage){r=t.timeoutErrorMessage}n(new AxiosError_1(r,i.clarifyTimeoutError?AxiosError_1.ETIMEDOUT:AxiosError_1.ECONNABORTED,t,u));u=null};if(utils.isStandardBrowserEnv()){var d=(t.withCredentials||isURLSameOrigin(h))&&t.xsrfCookieName?cookies.read(t.xsrfCookieName):undefined;if(d){o[t.xsrfHeaderName]=d}}if("setRequestHeader"in u){utils.forEach(o,(function e(t,r){if(typeof i==="undefined"&&r.toLowerCase()==="content-type"){delete o[r]}else{u.setRequestHeader(r,t)}}))}if(!utils.isUndefined(t.withCredentials)){u.withCredentials=!!t.withCredentials}if(s&&s!=="json"){u.responseType=t.responseType}if(typeof t.onDownloadProgress==="function"){u.addEventListener("progress",t.onDownloadProgress)}if(typeof t.onUploadProgress==="function"&&u.upload){u.upload.addEventListener("progress",t.onUploadProgress)}if(t.cancelToken||t.signal){a=function(e){if(!u){return}n(!e||e&&e.type?new CanceledError_1:e);u.abort();u=null};t.cancelToken&&t.cancelToken.subscribe(a);if(t.signal){t.signal.aborted?a():t.signal.addEventListener("abort",a)}}if(!i){i=null}var g=parseProtocol(h);if(g&&["http","https","file"].indexOf(g)===-1){n(new AxiosError_1("Unsupported protocol "+g+":",AxiosError_1.ERR_BAD_REQUEST,t));return}u.send(i)}))};var _null=null;var DEFAULT_CONTENT_TYPE={"Content-Type":"application/x-www-form-urlencoded"};function setContentTypeIfUnset(e,t){if(!utils.isUndefined(e)&&utils.isUndefined(e["Content-Type"])){e["Content-Type"]=t}}function getDefaultAdapter(){var e;if(typeof XMLHttpRequest!=="undefined"){e=xhr}else if(typeof process_1!=="undefined"&&Object.prototype.toString.call(process_1)==="[object process]"){e=xhr}return e}function stringifySafely(e,t,r){if(utils.isString(e)){try{(t||JSON.parse)(e);return utils.trim(e)}catch(e){if(e.name!=="SyntaxError"){throw e}}}return(r||JSON.stringify)(e)}var defaults={transitional:transitional,adapter:getDefaultAdapter(),transformRequest:[function e(t,r){normalizeHeaderName(r,"Accept");normalizeHeaderName(r,"Content-Type");if(utils.isFormData(t)||utils.isArrayBuffer(t)||utils.isBuffer(t)||utils.isStream(t)||utils.isFile(t)||utils.isBlob(t)){return t}if(utils.isArrayBufferView(t)){return t.buffer}if(utils.isURLSearchParams(t)){setContentTypeIfUnset(r,"application/x-www-form-urlencoded;charset=utf-8");return t.toString()}var n=utils.isObject(t);var i=r&&r["Content-Type"];var o;if((o=utils.isFileList(t))||n&&i==="multipart/form-data"){var s=this.env&&this.env.FormData;return toFormData_1(o?{"files[]":t}:t,s&&new s)}else if(n||i==="application/json"){setContentTypeIfUnset(r,"application/json");return stringifySafely(t)}return t}],transformResponse:[function e(t){var r=this.transitional||defaults.transitional;var n=r&&r.silentJSONParsing;var i=r&&r.forcedJSONParsing;var o=!n&&this.responseType==="json";if(o||i&&utils.isString(t)&&t.length){try{return JSON.parse(t)}catch(e){if(o){if(e.name==="SyntaxError"){throw AxiosError_1.from(e,AxiosError_1.ERR_BAD_RESPONSE,this,null,this.response)}throw e}}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:_null},validateStatus:function e(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};utils.forEach(["delete","get","head"],(function e(t){defaults.headers[t]={}}));utils.forEach(["post","put","patch"],(function e(t){defaults.headers[t]=utils.merge(DEFAULT_CONTENT_TYPE)}));var defaults_1=defaults;var transformData=function e(t,r,n){var i=this||defaults_1;utils.forEach(n,(function e(n){t=n.call(i,t,r)}));return t};var isCancel=function e(t){return!!(t&&t.__CANCEL__)};function throwIfCancellationRequested(e){if(e.cancelToken){e.cancelToken.throwIfRequested()}if(e.signal&&e.signal.aborted){throw new CanceledError_1}}var dispatchRequest=function e(t){throwIfCancellationRequested(t);t.headers=t.headers||{};t.data=transformData.call(t,t.data,t.headers,t.transformRequest);t.headers=utils.merge(t.headers.common||{},t.headers[t.method]||{},t.headers);utils.forEach(["delete","get","head","post","put","patch","common"],(function e(r){delete t.headers[r]}));var r=t.adapter||defaults_1.adapter;return r(t).then((function e(r){throwIfCancellationRequested(t);r.data=transformData.call(t,r.data,r.headers,t.transformResponse);return r}),(function e(r){if(!isCancel(r)){throwIfCancellationRequested(t);if(r&&r.response){r.response.data=transformData.call(t,r.response.data,r.response.headers,t.transformResponse)}}return Promise.reject(r)}))};var mergeConfig=function e(t,r){r=r||{};var n={};function i(e,t){if(utils.isPlainObject(e)&&utils.isPlainObject(t)){return utils.merge(e,t)}else if(utils.isPlainObject(t)){return utils.merge({},t)}else if(utils.isArray(t)){return t.slice()}return t}function o(e){if(!utils.isUndefined(r[e])){return i(t[e],r[e])}else if(!utils.isUndefined(t[e])){return i(undefined,t[e])}}function s(e){if(!utils.isUndefined(r[e])){return i(undefined,r[e])}}function a(e){if(!utils.isUndefined(r[e])){return i(undefined,r[e])}else if(!utils.isUndefined(t[e])){return i(undefined,t[e])}}function f(e){if(e in r){return i(t[e],r[e])}else if(e in t){return i(undefined,t[e])}}var u={url:s,method:s,data:s,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:f};utils.forEach(Object.keys(t).concat(Object.keys(r)),(function e(t){var r=u[t]||o;var i=r(t);utils.isUndefined(i)&&r!==f||(n[t]=i)}));return n};var data={version:"0.27.2"};var VERSION=data.version;var validators$1={};["object","boolean","number","function","string","symbol"].forEach((function(e,t){validators$1[e]=function r(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}}));var deprecatedWarnings={};validators$1.transitional=function e(t,r,n){function i(e,t){return"[Axios v"+VERSION+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return function(e,n,o){if(t===false){throw new AxiosError_1(i(n," has been removed"+(r?" in "+r:"")),AxiosError_1.ERR_DEPRECATED)}if(r&&!deprecatedWarnings[n]){deprecatedWarnings[n]=true;console.warn(i(n," has been deprecated since v"+r+" and will be removed in the near future"))}return t?t(e,n,o):true}};function assertOptions(e,t,r){if(typeof e!=="object"){throw new AxiosError_1("options must be an object",AxiosError_1.ERR_BAD_OPTION_VALUE)}var n=Object.keys(e);var i=n.length;while(i-- >0){var o=n[i];var s=t[o];if(s){var a=e[o];var f=a===undefined||s(a,o,e);if(f!==true){throw new AxiosError_1("option "+o+" must be "+f,AxiosError_1.ERR_BAD_OPTION_VALUE)}continue}if(r!==true){throw new AxiosError_1("Unknown option "+o,AxiosError_1.ERR_BAD_OPTION)}}}var validator={assertOptions:assertOptions,validators:validators$1};var validators=validator.validators;function Axios(e){this.defaults=e;this.interceptors={request:new InterceptorManager_1,response:new InterceptorManager_1}}Axios.prototype.request=function e(t,r){if(typeof t==="string"){r=r||{};r.url=t}else{r=t||{}}r=mergeConfig(this.defaults,r);if(r.method){r.method=r.method.toLowerCase()}else if(this.defaults.method){r.method=this.defaults.method.toLowerCase()}else{r.method="get"}var n=r.transitional;if(n!==undefined){validator.assertOptions(n,{silentJSONParsing:validators.transitional(validators.boolean),forcedJSONParsing:validators.transitional(validators.boolean),clarifyTimeoutError:validators.transitional(validators.boolean)},false)}var i=[];var o=true;this.interceptors.request.forEach((function e(t){if(typeof t.runWhen==="function"&&t.runWhen(r)===false){return}o=o&&t.synchronous;i.unshift(t.fulfilled,t.rejected)}));var s=[];this.interceptors.response.forEach((function e(t){s.push(t.fulfilled,t.rejected)}));var a;if(!o){var f=[dispatchRequest,undefined];Array.prototype.unshift.apply(f,i);f=f.concat(s);a=Promise.resolve(r);while(f.length){a=a.then(f.shift(),f.shift())}return a}var u=r;while(i.length){var c=i.shift();var l=i.shift();try{u=c(u)}catch(e){l(e);break}}try{a=dispatchRequest(u)}catch(e){return Promise.reject(e)}while(s.length){a=a.then(s.shift(),s.shift())}return a};Axios.prototype.getUri=function e(t){t=mergeConfig(this.defaults,t);var r=buildFullPath(t.baseURL,t.url);return buildURL(r,t.params,t.paramsSerializer)};utils.forEach(["delete","get","head","options"],(function e(t){Axios.prototype[t]=function(e,r){return this.request(mergeConfig(r||{},{method:t,url:e,data:(r||{}).data}))}}));utils.forEach(["post","put","patch"],(function e(t){function r(e){return function r(n,i,o){return this.request(mergeConfig(o||{},{method:t,headers:e?{"Content-Type":"multipart/form-data"}:{},url:n,data:i}))}}Axios.prototype[t]=r();Axios.prototype[t+"Form"]=r(true)}));var Axios_1=Axios;function CancelToken(e){if(typeof e!=="function"){throw new TypeError("executor must be a function.")}var t;this.promise=new Promise((function e(r){t=r}));var r=this;this.promise.then((function(e){if(!r._listeners)return;var t;var n=r._listeners.length;for(t=0;t<n;t++){r._listeners[t](e)}r._listeners=null}));this.promise.then=function(e){var t;var n=new Promise((function(e){r.subscribe(e);t=e})).then(e);n.cancel=function e(){r.unsubscribe(t)};return n};e((function e(n){if(r.reason){return}r.reason=new CanceledError_1(n);t(r.reason)}))}CancelToken.prototype.throwIfRequested=function e(){if(this.reason){throw this.reason}};CancelToken.prototype.subscribe=function e(t){if(this.reason){t(this.reason);return}if(this._listeners){this._listeners.push(t)}else{this._listeners=[t]}};CancelToken.prototype.unsubscribe=function e(t){if(!this._listeners){return}var r=this._listeners.indexOf(t);if(r!==-1){this._listeners.splice(r,1)}};CancelToken.source=function e(){var t;var r=new CancelToken((function e(r){t=r}));return{token:r,cancel:t}};var CancelToken_1=CancelToken;var spread=function e(t){return function e(r){return t.apply(null,r)}};var isAxiosError=function e(t){return utils.isObject(t)&&t.isAxiosError===true};function createInstance(e){var t=new Axios_1(e);var r=bind(Axios_1.prototype.request,t);utils.extend(r,Axios_1.prototype,t);utils.extend(r,t);r.create=function t(r){return createInstance(mergeConfig(e,r))};return r}var axios$1=createInstance(defaults_1);axios$1.Axios=Axios_1;axios$1.CanceledError=CanceledError_1;axios$1.CancelToken=CancelToken_1;axios$1.isCancel=isCancel;axios$1.VERSION=data.version;axios$1.toFormData=toFormData_1;axios$1.AxiosError=AxiosError_1;axios$1.Cancel=axios$1.CanceledError;axios$1.all=function e(t){return Promise.all(t)};axios$1.spread=spread;axios$1.isAxiosError=isAxiosError;var axios_1=axios$1;var _default=axios$1;axios_1.default=_default;var axios=axios_1;var naiveFallback=function(){if(typeof self==="object"&&self)return self;if(typeof window==="object"&&window)return window;throw new Error("Unable to resolve global `this`")};var globalThis_1=function(){if(this)return this;if(typeof globalThis==="object"&&globalThis)return globalThis;try{Object.defineProperty(Object.prototype,"__global__",{get:function(){return this},configurable:true})}catch(e){return naiveFallback()}try{if(!__global__)return naiveFallback();return __global__}finally{delete Object.prototype.__global__}}();var requestLogger=function(e){console.debug("[JS-SDK] ".concat(e.method.toUpperCase()," ").concat(e.baseURL).concat(e.url),e.data?JSON.stringify(e.data):"");return e};var VerdocsEndpoint=function(){function e(e){this.environment="verdocs";this.sessionType="user";this.baseURL="https://api.verdocs.com";this.clientID="not-set";this.timeout=3e3;this.token=null;this.nextListenerId=0;this.sessionListeners=new Map;this.requestLoggerId=null;this.session=null;this.Documents=Documents;this.baseURL=(e===null||e===void 0?void 0:e.baseURL)||"https://api.verdocs.com";this.timeout=(e===null||e===void 0?void 0:e.timeout)||3e3;this.environment=(e===null||e===void 0?void 0:e.environment)||"verdocs";this.sessionType=(e===null||e===void 0?void 0:e.sessionType)||"user";this.clientID=(e===null||e===void 0?void 0:e.clientID)||"not-set";this.api=axios.create({baseURL:this.baseURL,timeout:this.timeout})}e.prototype.setDefault=function(){globalThis_1[ENDPOINT_KEY]=this};e.getDefault=function(){return globalThis_1[ENDPOINT_KEY]};e.prototype.getEnvironment=function(){return this.environment};e.prototype.getSessionType=function(){return this.sessionType};e.prototype.getBaseURL=function(){return this.baseURL};e.prototype.getClientID=function(){return this.clientID};e.prototype.getTimeout=function(){return this.timeout};e.prototype.getSession=function(){return this.session};e.prototype.setEnvironment=function(e){this.environment=e;return this};e.prototype.setSessionType=function(e){this.sessionType=e;return this};e.prototype.setBaseURL=function(e){this.api.defaults.baseURL=e;return this};e.prototype.setClientID=function(e){this.clientID=e;this.api.defaults.headers.common["X-Client-ID"]=e;return this};e.prototype.setTimeout=function(e){this.timeout=e;this.api.defaults.timeout=e;return this};e.prototype.logRequests=function(e){if(e&&this.requestLoggerId===null){this.requestLoggerId=this.api.interceptors.request.use(requestLogger)}else if(!e&&this.requestLoggerId!==null){this.api.interceptors.request.eject(this.requestLoggerId)}return this};e.prototype.setToken=function(e){if(!e){return this.clearSession()}var t=decodeAccessTokenBody(e);if(t===null||t.exp&&t.exp*1e3<(new Date).getTime()){return this.clearSession()}this.token=e;this.session=t;this.api.defaults.headers.common.Authorization="Bearer ".concat(e);localStorage.setItem(this.sessionStorageKey(),e);this.notifySessionListeners();return this};e.prototype.sessionStorageKey=function(){return"verdocs-session-".concat(this.getSessionType(),"-").concat(this.getEnvironment())};e.prototype.clearSession=function(){localStorage.removeItem(this.sessionStorageKey());delete this.api.defaults.headers.common.Authorization;this.session=null;this.token=null;this.notifySessionListeners();return this};e.prototype.notifySessionListeners=function(){var e=this;this.sessionListeners.forEach((function(t){try{t(e,e.session)}catch(e){}}))};e.prototype.onSessionChanged=function(e){var t=this;this.nextListenerId++;var r=Symbol.for(""+this.nextListenerId);this.sessionListeners.set(r,e);return function(){t.sessionListeners.delete(r)}};e.prototype.loadSession=function(){var e=localStorage.getItem(this.sessionStorageKey());if(!e){return this.clearSession()}return this.setToken(e)};return e}();var ENDPOINT_KEY=Symbol.for("verdocs-default-endpoint");if(!globalThis_1[ENDPOINT_KEY]){globalThis_1[ENDPOINT_KEY]=new VerdocsEndpoint}export{Buffer as B,VerdocsEndpoint as V,getDocument as a,getDocumentFile as b,updateDocumentField as c,getAugmentedNamespace as d,createCommonjsModule as e,getDefaultExportFromCjs as f,getSigningSession as g,commonjsGlobal as h,commonjsRequire as i,process_1 as p,updateRecipientStatus as u};
@@ -1 +1 @@
1
- import{p as promiseResolve,b as bootstrapLazy}from"./index-859bc689.js";var patchEsm=function(){return promiseResolve()};var defineCustomElements=function(e,d){if(typeof window==="undefined")return Promise.resolve();return patchEsm().then((function(){return bootstrapLazy([["verdocs-sign",[[0,"verdocs-sign",{documentid:[1],roleid:[1],invitecode:[1],endpoint:[32],recipient:[32],signerToken:[32],pdfUrl:[32],recipientIndex:[32],document:[32],fields:[32],pdfPageInfo:[32],hasSignature:[32],nextButtonLabel:[32],focusedField:[32]}]]],["verdocs-auth",[[0,"verdocs-auth",{visible:[4],logo:[1],debug:[4],isAuthenticated:[32],displayMode:[32],username:[32],password:[32],loggingIn:[32],activeSession:[32],loginError:[32]}]]],["verdocs-search",[[0,"verdocs-search"]]],["verdocs-kba-dialog",[[0,"verdocs-kba-dialog",{step:[2],steps:[2],helptitle:[1],helptext:[1],mode:[1],label:[1],placeholder:[1],choices:[16],open:[4],response:[32]}]]],["verdocs-organization-card",[[0,"verdocs-organization-card",{organization:[16]}]]],["verdocs-quick-functions",[[0,"verdocs-quick-functions"]]],["verdocs-search-tabs",[[0,"verdocs-search-tabs",{selected:[32]}]]],["verdocs-status-indicator",[[0,"verdocs-status-indicator",{size:[1],theme:[1],status:[1],document:[16],isOpen:[32],recipientStatusIcons:[32]}]]],["verdocs-template-card",[[0,"verdocs-template-card",{template:[16]}]]],["verdocs-template-tags",[[0,"verdocs-template-tags",{tags:[16]}]]],["verdocs-toggle",[[0,"verdocs-toggle",{options:[16],theme:[1]},[[6,"click","handleClick"]]]]],["verdocs-button_2",[[0,"verdocs-text-input",{value:[1],label:[1],placeholder:[1],autocomplete:[1],type:[1],disabled:[4],_value:[32]}],[0,"verdocs-button",{label:[1],startIcon:[1,"start-icon"],endIcon:[1,"end-icon"],size:[1],type:[1],variant:[1],disabled:[4]}]]],["verdocs-ok-dialog",[[0,"verdocs-ok-dialog",{heading:[1],message:[1],open:[4],cancel:[4]}]]],["verdocs-initial-dialog",[[0,"verdocs-initial-dialog",{fullname:[1],open:[4],fontLoaded:[32],enteredInitials:[32],mode:[32]}]]],["verdocs-signature-dialog",[[0,"verdocs-signature-dialog",{fullname:[1],open:[4],fontLoaded:[32],enteredName:[32],mode:[32]}]]],["verdocs-upload-dialog",[[0,"verdocs-upload-dialog",{open:[4],draggingOver:[32],decodedFiles:[32]}]]],["verdocs-search-activity_2",[[0,"verdocs-search-activity",{type:[1],options:[8],emptyMessage:[32],authFailure:[32],title:[32],recent:[32],saved:[32],starred:[32]}],[0,"verdocs-search-box",{placeholder:[1],type:[1],query:[1]}]]],["verdocs-loader",[[0,"verdocs-loader"]]],["verdocs-dropdown_12",[[0,"verdocs-field-initial",{required:[4],fullName:[1,"full-name"],value:[1],focusField:[64]}],[0,"verdocs-field-signature",{required:[4],fullName:[1,"full-name"],value:[1],focusField:[64]}],[0,"verdocs-field-attachment",{order:[2],value:[1],required:[4],disabled:[4],focusField:[64]}],[0,"verdocs-view",{rotation:[2],source:[1],token:[1],loadProgress:[32]}],[0,"verdocs-dropdown",{options:[16],open:[4],isOpen:[32]}],[0,"verdocs-field-checkbox",{order:[2],value:[4],required:[4],disabled:[4]}],[0,"verdocs-field-date",{placeholder:[1],order:[2],value:[1],required:[4],disabled:[4],focused:[32],focusField:[64]}],[0,"verdocs-field-dropdown",{options:[16],required:[4],order:[2],disabled:[4],value:[1],focused:[32],focusField:[64]}],[0,"verdocs-field-payment",{field:[16],fields:[16],pageNum:[2,"page-num"],roleName:[1,"role-name"],fieldId:[1,"field-id"],recipients:[8],selectedRoleName:[1,"selected-role-name"],pdfPages:[16],currentSignature:[1,"current-signature"],currentSignatureId:[1,"current-signature-id"],currentInitial:[1,"current-initial"],currentInitialId:[1,"current-initial-id"],focused:[4],signed:[4],preparedMessage:[32],signatureUrl:[32]}],[0,"verdocs-field-radio-button",{order:[2],checked:[4],value:[1],name:[1],required:[4],disabled:[4]}],[0,"verdocs-field-textarea",{placeholder:[1],order:[2],value:[1],required:[4],disabled:[4],focused:[32],focusField:[64]}],[0,"verdocs-field-textbox",{placeholder:[1],order:[2],value:[1],required:[4],disabled:[4],focused:[32],focusField:[64]}]]]],d)}))};export{defineCustomElements};
1
+ import{p as promiseResolve,b as bootstrapLazy}from"./index-859bc689.js";var patchEsm=function(){return promiseResolve()};var defineCustomElements=function(e,d){if(typeof window==="undefined")return Promise.resolve();return patchEsm().then((function(){return bootstrapLazy([["verdocs-sign",[[0,"verdocs-sign",{endpoint:[16],documentid:[1],roleid:[1],invitecode:[1],recipient:[32],signerToken:[32],pdfUrl:[32],recipientIndex:[32],document:[32],fields:[32],pdfPageInfo:[32],hasSignature:[32],nextButtonLabel:[32],focusedField:[32]}]]],["verdocs-auth",[[0,"verdocs-auth",{endpoint:[16],visible:[4],logo:[1],debug:[4],isAuthenticated:[32],displayMode:[32],username:[32],password:[32],loggingIn:[32],activeSession:[32],loginError:[32]}]]],["verdocs-search",[[0,"verdocs-search",{endpoint:[16]}]]],["verdocs-kba-dialog",[[0,"verdocs-kba-dialog",{step:[2],steps:[2],helptitle:[1],helptext:[1],mode:[1],label:[1],placeholder:[1],choices:[16],open:[4],response:[32]}]]],["verdocs-organization-card",[[0,"verdocs-organization-card",{organization:[16]}]]],["verdocs-quick-functions",[[0,"verdocs-quick-functions",{endpoint:[16]}]]],["verdocs-search-tabs",[[0,"verdocs-search-tabs",{selected:[32]}]]],["verdocs-status-indicator",[[0,"verdocs-status-indicator",{size:[1],theme:[1],status:[1],document:[16],isOpen:[32],recipientStatusIcons:[32]}]]],["verdocs-template-card",[[0,"verdocs-template-card",{template:[16]}]]],["verdocs-template-tags",[[0,"verdocs-template-tags",{tags:[16]}]]],["verdocs-toggle",[[0,"verdocs-toggle",{options:[16],theme:[1]},[[6,"click","handleClick"]]]]],["verdocs-button_2",[[0,"verdocs-text-input",{value:[1],label:[1],placeholder:[1],autocomplete:[1],type:[1],disabled:[4],_value:[32]}],[0,"verdocs-button",{label:[1],startIcon:[1,"start-icon"],endIcon:[1,"end-icon"],size:[1],type:[1],variant:[1],disabled:[4]}]]],["verdocs-ok-dialog",[[0,"verdocs-ok-dialog",{heading:[1],message:[1],open:[4],cancel:[4]}]]],["verdocs-initial-dialog",[[0,"verdocs-initial-dialog",{fullname:[1],open:[4],fontLoaded:[32],enteredInitials:[32],mode:[32]}]]],["verdocs-signature-dialog",[[0,"verdocs-signature-dialog",{fullname:[1],open:[4],fontLoaded:[32],enteredName:[32],mode:[32]}]]],["verdocs-upload-dialog",[[0,"verdocs-upload-dialog",{open:[4],draggingOver:[32],decodedFiles:[32]}]]],["verdocs-search-activity_2",[[0,"verdocs-search-activity",{endpoint:[16],type:[1],options:[8],emptyMessage:[32],authFailure:[32],title:[32],recent:[32],saved:[32],starred:[32]}],[0,"verdocs-search-box",{endpoint:[16],placeholder:[1],type:[1],query:[1]}]]],["verdocs-loader",[[0,"verdocs-loader"]]],["verdocs-dropdown_12",[[0,"verdocs-field-initial",{required:[4],fullName:[1,"full-name"],value:[1],focusField:[64]}],[0,"verdocs-field-signature",{required:[4],fullName:[1,"full-name"],value:[1],focusField:[64]}],[0,"verdocs-field-attachment",{order:[2],value:[1],required:[4],disabled:[4],focusField:[64]}],[0,"verdocs-view",{endpoint:[16],rotation:[2],source:[1],token:[1],loadProgress:[32]}],[0,"verdocs-dropdown",{options:[16],open:[4],isOpen:[32]}],[0,"verdocs-field-checkbox",{order:[2],value:[4],required:[4],disabled:[4]}],[0,"verdocs-field-date",{placeholder:[1],order:[2],value:[1],required:[4],disabled:[4],focused:[32],focusField:[64]}],[0,"verdocs-field-dropdown",{options:[16],required:[4],order:[2],disabled:[4],value:[1],focused:[32],focusField:[64]}],[0,"verdocs-field-payment",{field:[16],fields:[16],pageNum:[2,"page-num"],roleName:[1,"role-name"],fieldId:[1,"field-id"],recipients:[8],selectedRoleName:[1,"selected-role-name"],pdfPages:[16],currentSignature:[1,"current-signature"],currentSignatureId:[1,"current-signature-id"],currentInitial:[1,"current-initial"],currentInitialId:[1,"current-initial-id"],focused:[4],signed:[4],preparedMessage:[32],signatureUrl:[32]}],[0,"verdocs-field-radio-button",{order:[2],checked:[4],value:[1],name:[1],required:[4],disabled:[4]}],[0,"verdocs-field-textarea",{placeholder:[1],order:[2],value:[1],required:[4],disabled:[4],focused:[32],focusField:[64]}],[0,"verdocs-field-textbox",{placeholder:[1],order:[2],value:[1],required:[4],disabled:[4],focused:[32],focusField:[64]}]]]],d)}))};export{defineCustomElements};
@@ -1 +1 @@
1
- import{r as registerInstance,c as createEvent,h}from"./index-859bc689.js";import{l as loadSession,a as authenticateUser,s as setSession,e as endSession}from"./Auth-15cd42a8.js";import{V as VerdocsEndpoint,s as setActiveEndpoint}from"./Token-ce37bd9d.js";import"./buffer-es6-136673c8.js";var verdocsAuthCss='verdocs-auth{font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif;background-color:#4c56cb;padding:40px;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}verdocs-auth .login-form,verdocs-auth .signup-form{background:#f5f5fa;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;border-radius:8px;-ms-flex-direction:column;flex-direction:column;display:-ms-flexbox;display:flex;padding:20px;width:300px;max-width:100%}verdocs-auth .logo{margin:20px 0 30px;width:128px;max-width:100%}verdocs-auth h3{text-align:center;font-weight:400;font-size:16px;line-height:1.75;margin:0}verdocs-auth h4{text-align:center;font-weight:400;font-size:14px;line-height:1.43;margin:0}verdocs-auth .status-result{display:none}verdocs-auth .status-result.debug{white-space:pre-wrap;font-size:14px;background:#fff;padding:10px;display:block;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:center;justify-content:center}verdocs-auth form{width:100%}verdocs-auth verdocs-text-input{margin-bottom:10px}';var BASE_URL="https://stage-api.verdocs.com/";var SOURCE="verdocs-stage";var VerdocsAuth=function(){function e(e){registerInstance(this,e);this.authenticated=createEvent(this,"authenticated",7);this.visible=true;this.logo="https://verdocs.com/assets/blue-logo.svg";this.debug=false;this.isAuthenticated=false;this.displayMode="login";this.username="";this.password="";this.loggingIn=false;this.activeSession=null;this.loginError=null}e.prototype.componentWillLoad=function(){var e=(new VerdocsEndpoint).setBaseURL(BASE_URL);setActiveEndpoint(e)};e.prototype.componentDidLoad=function(){var e=loadSession(SOURCE);if(e!==null){this.isAuthenticated=true;this.activeSession=e;this.authenticated.emit({authenticated:true,session:e})}else{this.authenticated.emit({authenticated:false,session:null})}};e.prototype.handleLogin=function(){var e=this;this.loggingIn=true;authenticateUser({username:this.username,password:this.password}).then((function(t){e.loggingIn=false;var n=setSession(SOURCE,t.accessToken,true);e.activeSession=n;e.isAuthenticated=true;e.authenticated.emit({authenticated:true,session:n})})).catch((function(t){var n;console.log("[VERDOCS] Login error",t.response,JSON.stringify(t));e.loggingIn=false;e.activeSession=null;e.authenticated.emit({authenticated:false,session:null});if(((n=t===null||t===void 0?void 0:t.response)===null||n===void 0?void 0:n.status)===403){e.loginError="Please check your username and password and try again."}}))};e.prototype.handleLogout=function(){endSession(SOURCE);this.isAuthenticated=false;this.authenticated.emit({authenticated:false,session:null})};e.prototype.handleClearError=function(){this.loginError=null};e.prototype.render=function(){var e=this;if(!this.visible){return h("div",{style:{display:"none"}},"Verdocs Auth Placeholder")}if(this.isAuthenticated){if(this.debug){return h("div",{class:"status-result debug"},h("verdocs-button",{label:"Logout",disabled:this.loggingIn,onPress:function(){return e.handleLogout()}}))}return h("div",{class:"status-result"},"Authenticated")}if(this.displayMode==="signup"){return h("div",{class:"signup-form"},h("img",{src:this.logo,alt:"Verdocs Logo",class:"logo"}),h("h3",null,"Sign up for an account"),h("h4",null,"Already have an account?",h("verdocs-button",{label:"Log In",variant:"text",onClick:function(){return e.displayMode="login"},disabled:this.loggingIn})),h("form",{onSubmit:function(){return e.handleLogin()}},h("verdocs-text-input",{label:"Email",autocomplete:"username",value:this.username,onFieldInput:function(t){return e.username=t.detail},disabled:this.loggingIn}),h("verdocs-text-input",{label:"Password",type:"password",autocomplete:"current-password",value:this.password,onFieldInput:function(t){return e.password=t.detail},disabled:this.loggingIn}),h("verdocs-button",{label:"Signup",disabled:this.loggingIn,onPress:function(){return e.handleLogin()},style:{display:"flex",justifyContent:"center",margin:"30px auto 0"}})))}return h("div",{class:"login-form"},h("img",{src:this.logo,alt:"Verdocs Logo",class:"logo"}),h("h3",null,"Log in to your account"),h("h4",null,"Don't have an account?",h("verdocs-button",{label:"Sign Up",variant:"text",onClick:function(){return e.displayMode="signup"},disabled:this.loggingIn})),h("form",{onSubmit:function(){return e.handleLogin()}},h("verdocs-text-input",{label:"Email",autocomplete:"username",value:this.username,onFieldInput:function(t){return e.username=t.detail},disabled:this.loggingIn}),h("verdocs-text-input",{label:"Password",type:"password",autocomplete:"current-password",value:this.password,onFieldInput:function(t){return e.password=t.detail},disabled:this.loggingIn}),h("verdocs-button",{label:"Forgot Your Password?",variant:"text",onClick:function(){return e.displayMode="signup"},disabled:this.loggingIn,style:{display:"flex",justifyContent:"center",margin:"10px auto 20px"}}),h("verdocs-button",{label:"Login",disabled:this.loggingIn,onPress:function(){return e.handleLogin()},style:{display:"flex",justifyContent:"center",margin:"10px auto 0"}})),this.loginError?h("verdocs-ok-dialog",{open:true,heading:"Login Error",message:this.loginError,onClosed:function(){return e.handleClearError()}}):h("div",null))};return e}();VerdocsAuth.style=verdocsAuthCss;export{VerdocsAuth as verdocs_auth};
1
+ import{r as registerInstance,c as createEvent,h}from"./index-859bc689.js";import{V as VerdocsEndpoint}from"./VerdocsEndpoint-30e1b6ec.js";var authenticateUser=function(t,e){return t.api.post("/authentication/login",e).then((function(t){return t.data}))};var verdocsAuthCss='verdocs-auth{font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}verdocs-auth .login-form,verdocs-auth .signup-form{background:#ffffff;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;-ms-flex-direction:column;flex-direction:column;display:-ms-flexbox;display:flex;padding:20px;width:300px;max-width:100%}verdocs-auth .logo{margin:20px 0 30px;width:128px;max-width:100%}verdocs-auth h3{text-align:center;font-weight:400;font-size:16px;line-height:1.75;margin:0}verdocs-auth h4{text-align:center;font-weight:400;font-size:14px;line-height:1.43;margin:0}verdocs-auth .status-result{display:none}verdocs-auth .status-result.debug{white-space:pre-wrap;font-size:14px;background:#fff;padding:10px;display:block;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:center;justify-content:center}verdocs-auth form{width:100%}verdocs-auth verdocs-text-input{margin-bottom:10px}';var VerdocsAuth=function(){function t(t){registerInstance(this,t);this.authenticated=createEvent(this,"authenticated",7);this.endpoint=VerdocsEndpoint.getDefault();this.visible=true;this.logo="https://verdocs.com/assets/blue-logo.svg";this.debug=false;this.isAuthenticated=false;this.displayMode="login";this.username="";this.password="";this.loggingIn=false;this.activeSession=null;this.loginError=null}t.prototype.componentDidLoad=function(){this.endpoint.loadSession();if(this.endpoint.session!==null){this.isAuthenticated=true;this.activeSession=this.endpoint.session;this.authenticated.emit({authenticated:true,session:this.endpoint.session})}else{this.authenticated.emit({authenticated:false,session:null})}};t.prototype.handleLogin=function(){var t=this;this.loggingIn=true;authenticateUser(this.endpoint,{username:this.username,password:this.password}).then((function(e){t.loggingIn=false;t.endpoint.setToken(e.accessToken);t.activeSession=t.endpoint.session;t.isAuthenticated=true;t.authenticated.emit({authenticated:true,session:t.endpoint.session})})).catch((function(e){var n;console.log("[VERDOCS] Login error",e.response,JSON.stringify(e));t.loggingIn=false;t.activeSession=null;t.authenticated.emit({authenticated:false,session:null});if(((n=e===null||e===void 0?void 0:e.response)===null||n===void 0?void 0:n.status)===403){t.loginError="Please check your username and password and try again."}}))};t.prototype.handleLogout=function(){this.endpoint.clearSession();this.isAuthenticated=false;this.authenticated.emit({authenticated:false,session:null})};t.prototype.handleClearError=function(){this.loginError=null};t.prototype.render=function(){var t=this;if(!this.visible){return h("div",{style:{display:"none"}},"Verdocs Auth Placeholder")}if(this.isAuthenticated){if(this.debug){return h("div",{class:"status-result debug"},h("verdocs-button",{label:"Logout",disabled:this.loggingIn,onPress:function(){return t.handleLogout()}}))}return h("div",{class:"status-result"},"Authenticated")}if(this.displayMode==="signup"){return h("div",{class:"signup-form"},h("img",{src:this.logo,alt:"Verdocs Logo",class:"logo"}),h("h3",null,"Sign up for an account"),h("h4",null,"Already have an account?",h("verdocs-button",{label:"Log In",variant:"text",onClick:function(){return t.displayMode="login"},disabled:this.loggingIn})),h("form",{onSubmit:function(){return t.handleLogin()}},h("verdocs-text-input",{label:"Email",autocomplete:"username",value:this.username,onFieldInput:function(e){return t.username=e.detail},disabled:this.loggingIn}),h("verdocs-text-input",{label:"Password",type:"password",autocomplete:"current-password",value:this.password,onFieldInput:function(e){return t.password=e.detail},disabled:this.loggingIn}),h("verdocs-button",{label:"Signup",disabled:this.loggingIn,onPress:function(){return t.handleLogin()},style:{display:"flex",justifyContent:"center",margin:"30px auto 0"}})))}return h("div",{class:"login-form"},h("img",{src:this.logo,alt:"Verdocs Logo",class:"logo"}),h("h3",null,"Log in to your account"),h("h4",null,"Don't have an account?",h("verdocs-button",{label:"Sign Up",variant:"text",onClick:function(){return t.displayMode="signup"},disabled:this.loggingIn})),h("form",{onSubmit:function(){return t.handleLogin()}},h("verdocs-text-input",{label:"Email",autocomplete:"username",value:this.username,onFieldInput:function(e){return t.username=e.detail},disabled:this.loggingIn}),h("verdocs-text-input",{label:"Password",type:"password",autocomplete:"current-password",value:this.password,onFieldInput:function(e){return t.password=e.detail},disabled:this.loggingIn}),h("verdocs-button",{label:"Forgot Your Password?",variant:"text",onClick:function(){return t.displayMode="signup"},disabled:this.loggingIn,style:{display:"flex",justifyContent:"center",margin:"10px auto 20px"}}),h("verdocs-button",{label:"Login",disabled:this.loggingIn,onPress:function(){return t.handleLogin()},style:{display:"flex",justifyContent:"center",margin:"10px auto 0"}})),this.loginError?h("verdocs-ok-dialog",{open:true,heading:"Login Error",message:this.loginError,onClosed:function(){return t.handleClearError()}}):h("div",null))};return t}();VerdocsAuth.style=verdocsAuthCss;export{VerdocsAuth as verdocs_auth};