@arbidocs/react 0.5.61 → 0.5.63

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 (103) hide show
  1. package/dist/ProductionDialog.d-CpzslFn0.d.cts +51 -0
  2. package/dist/ProductionDialog.d-CpzslFn0.d.ts +51 -0
  3. package/dist/annotations/freeze/index.cjs +14 -14
  4. package/dist/annotations/freeze/index.js +3 -3
  5. package/dist/annotations/index.d.cts +3 -2
  6. package/dist/annotations/index.d.ts +3 -2
  7. package/dist/artifacts/index.cjs +12 -12
  8. package/dist/artifacts/index.js +5 -5
  9. package/dist/bundle-IC65W2AO.cjs +14 -0
  10. package/dist/{bundle-DCWPYNGD.cjs.map → bundle-IC65W2AO.cjs.map} +1 -1
  11. package/dist/bundle-YNOX7VIL.js +5 -0
  12. package/dist/{bundle-JCKKGEJE.js.map → bundle-YNOX7VIL.js.map} +1 -1
  13. package/dist/calls/livekit/index.cjs +54 -54
  14. package/dist/calls/livekit/index.js +6 -6
  15. package/dist/{chunk-S2W3ZOWG.js → chunk-2LV53J46.js} +85 -16
  16. package/dist/chunk-2LV53J46.js.map +1 -0
  17. package/dist/{chunk-H3HYKAS5.cjs → chunk-3BFSALPC.cjs} +3 -3
  18. package/dist/{chunk-H3HYKAS5.cjs.map → chunk-3BFSALPC.cjs.map} +1 -1
  19. package/dist/{chunk-2NFUEC5O.js → chunk-3NBPMR3X.js} +3 -3
  20. package/dist/{chunk-2NFUEC5O.js.map → chunk-3NBPMR3X.js.map} +1 -1
  21. package/dist/chunk-4DTTEUVY.js +1042 -0
  22. package/dist/chunk-4DTTEUVY.js.map +1 -0
  23. package/dist/{chunk-U64WCQP3.js → chunk-AOEJ744V.js} +25 -14
  24. package/dist/chunk-AOEJ744V.js.map +1 -0
  25. package/dist/{chunk-4E737GNX.cjs → chunk-BLBXADTN.cjs} +86 -73
  26. package/dist/chunk-BLBXADTN.cjs.map +1 -0
  27. package/dist/{chunk-X7JXQT6F.cjs → chunk-DVL7EFZZ.cjs} +42 -46
  28. package/dist/chunk-DVL7EFZZ.cjs.map +1 -0
  29. package/dist/{chunk-VAMPYLQ4.cjs → chunk-DZUBZ45Y.cjs} +78 -2
  30. package/dist/chunk-DZUBZ45Y.cjs.map +1 -0
  31. package/dist/{chunk-OSWKXZTJ.js → chunk-ER4LFZG3.js} +12 -16
  32. package/dist/chunk-ER4LFZG3.js.map +1 -0
  33. package/dist/{chunk-5HDC43MF.js → chunk-G4Z3IP4J.js} +72 -3
  34. package/dist/chunk-G4Z3IP4J.js.map +1 -0
  35. package/dist/chunk-GOJHU7RZ.cjs +1122 -0
  36. package/dist/chunk-GOJHU7RZ.cjs.map +1 -0
  37. package/dist/{chunk-G76ASVVH.cjs → chunk-GQAXAZN7.cjs} +25 -14
  38. package/dist/chunk-GQAXAZN7.cjs.map +1 -0
  39. package/dist/{chunk-TUPSNW3B.cjs → chunk-LMW46NBD.cjs} +11 -11
  40. package/dist/{chunk-TUPSNW3B.cjs.map → chunk-LMW46NBD.cjs.map} +1 -1
  41. package/dist/{chunk-KRH55LXW.js → chunk-NCMSQACC.js} +37 -24
  42. package/dist/chunk-NCMSQACC.js.map +1 -0
  43. package/dist/{chunk-A2XSLTIP.js → chunk-NIKPG4PW.js} +3 -3
  44. package/dist/{chunk-A2XSLTIP.js.map → chunk-NIKPG4PW.js.map} +1 -1
  45. package/dist/{chunk-B6I2HRRF.cjs → chunk-PC4O3JDV.cjs} +3 -3
  46. package/dist/{chunk-B6I2HRRF.cjs.map → chunk-PC4O3JDV.cjs.map} +1 -1
  47. package/dist/{chunk-M2SZQBCO.js → chunk-SI7DJWBT.js} +3 -3
  48. package/dist/{chunk-M2SZQBCO.js.map → chunk-SI7DJWBT.js.map} +1 -1
  49. package/dist/{chunk-3QK4VVPG.cjs → chunk-TGSEQGM3.cjs} +3 -3
  50. package/dist/{chunk-3QK4VVPG.cjs.map → chunk-TGSEQGM3.cjs.map} +1 -1
  51. package/dist/{chunk-LCSUCZVX.cjs → chunk-ZNQPUPX6.cjs} +118 -41
  52. package/dist/chunk-ZNQPUPX6.cjs.map +1 -0
  53. package/dist/{chunk-CMNZI4WQ.js → chunk-ZTPJNKF2.js} +4 -4
  54. package/dist/{chunk-CMNZI4WQ.js.map → chunk-ZTPJNKF2.js.map} +1 -1
  55. package/dist/document-tools/core.cjs +408 -0
  56. package/dist/document-tools/core.cjs.map +1 -0
  57. package/dist/document-tools/core.d.cts +957 -0
  58. package/dist/document-tools/core.d.ts +957 -0
  59. package/dist/document-tools/core.js +15 -0
  60. package/dist/document-tools/core.js.map +1 -0
  61. package/dist/document-tools/index.cjs +347 -1130
  62. package/dist/document-tools/index.cjs.map +1 -1
  63. package/dist/document-tools/index.d.cts +12 -950
  64. package/dist/document-tools/index.d.ts +12 -950
  65. package/dist/document-tools/index.js +13 -1034
  66. package/dist/document-tools/index.js.map +1 -1
  67. package/dist/index.cjs +1510 -1255
  68. package/dist/index.cjs.map +1 -1
  69. package/dist/{index.d-BLw5AN0H.d.cts → index.d-AT7wdTWC.d.cts} +50 -2
  70. package/dist/{index.d-BLw5AN0H.d.ts → index.d-AT7wdTWC.d.ts} +50 -2
  71. package/dist/{index.d-DPVj21h1.d.ts → index.d-B0dosFZc.d.cts} +6 -6
  72. package/dist/{index.d-DPVj21h1.d.cts → index.d-B0dosFZc.d.ts} +6 -6
  73. package/dist/index.d.cts +145 -69
  74. package/dist/index.d.ts +145 -69
  75. package/dist/index.js +346 -121
  76. package/dist/index.js.map +1 -1
  77. package/dist/{query-keys.d-DEEMzkLz.d.cts → query-keys.d-BFKQVevT.d.cts} +21 -12
  78. package/dist/{query-keys.d-DEEMzkLz.d.ts → query-keys.d-BFKQVevT.d.ts} +21 -12
  79. package/dist/shell/index.cjs +68 -40
  80. package/dist/shell/index.d.cts +1 -1
  81. package/dist/shell/index.d.ts +1 -1
  82. package/dist/shell/index.js +3 -3
  83. package/dist/store.d-DkFXbWDk.d.ts +35 -0
  84. package/dist/store.d-GADDvC7w.d.cts +35 -0
  85. package/dist/ui/index.cjs +149 -149
  86. package/dist/ui/index.d.cts +1 -1
  87. package/dist/ui/index.d.ts +1 -1
  88. package/dist/ui/index.js +2 -2
  89. package/package.json +11 -3
  90. package/dist/ProductionDialog.d-BDJwBSzj.d.ts +0 -84
  91. package/dist/ProductionDialog.d-DjRQFmQw.d.cts +0 -84
  92. package/dist/bundle-DCWPYNGD.cjs +0 -14
  93. package/dist/bundle-JCKKGEJE.js +0 -5
  94. package/dist/chunk-4E737GNX.cjs.map +0 -1
  95. package/dist/chunk-5HDC43MF.js.map +0 -1
  96. package/dist/chunk-G76ASVVH.cjs.map +0 -1
  97. package/dist/chunk-KRH55LXW.js.map +0 -1
  98. package/dist/chunk-LCSUCZVX.cjs.map +0 -1
  99. package/dist/chunk-OSWKXZTJ.js.map +0 -1
  100. package/dist/chunk-S2W3ZOWG.js.map +0 -1
  101. package/dist/chunk-U64WCQP3.js.map +0 -1
  102. package/dist/chunk-VAMPYLQ4.cjs.map +0 -1
  103. package/dist/chunk-X7JXQT6F.cjs.map +0 -1
@@ -1,21 +1,18 @@
1
1
  'use strict';
2
2
 
3
- var chunk3QK4VVPG_cjs = require('../chunk-3QK4VVPG.cjs');
4
- var chunkSUZORMAB_cjs = require('../chunk-SUZORMAB.cjs');
5
- var chunk2IJP73ZG_cjs = require('../chunk-2IJP73ZG.cjs');
6
- var chunkG76ASVVH_cjs = require('../chunk-G76ASVVH.cjs');
7
- var chunkZWFMFOGP_cjs = require('../chunk-ZWFMFOGP.cjs');
3
+ var chunkGOJHU7RZ_cjs = require('../chunk-GOJHU7RZ.cjs');
4
+ var chunkTGSEQGM3_cjs = require('../chunk-TGSEQGM3.cjs');
5
+ require('../chunk-SUZORMAB.cjs');
6
+ require('../chunk-2IJP73ZG.cjs');
7
+ var chunkGQAXAZN7_cjs = require('../chunk-GQAXAZN7.cjs');
8
+ require('../chunk-Y7S2SQH3.cjs');
9
+ require('../chunk-ZWFMFOGP.cjs');
8
10
  require('../chunk-VOFNX4P6.cjs');
9
11
  require('../chunk-WYZJLZ67.cjs');
10
12
  require('../chunk-HJDR5HEO.cjs');
11
13
  require('../chunk-Z3LLUO32.cjs');
12
- require('../chunk-S6A6FSG7.cjs');
13
- require('../chunk-Y7S2SQH3.cjs');
14
14
  require('../chunk-RCKA7BEF.cjs');
15
- var react = require('react');
16
- var reactQuery = require('@tanstack/react-query');
17
- var client = require('@arbidocs/client');
18
- var browser = require('@arbidocs/sdk/browser');
15
+ require('../chunk-S6A6FSG7.cjs');
19
16
 
20
17
  // src/document-tools/production.ts
21
18
  var PRODUCTIONS_FOLDER = "Productions";
@@ -42,9 +39,9 @@ async function fetchProductionPdf(client, doc) {
42
39
  const pdf = isPdfDocument(doc);
43
40
  let blob;
44
41
  try {
45
- blob = await (pdf ? chunk3QK4VVPG_cjs.fetchDocumentFile : chunk3QK4VVPG_cjs.fetchDocumentPdf)(client, doc.external_id);
42
+ blob = await (pdf ? chunkTGSEQGM3_cjs.fetchDocumentFile : chunkTGSEQGM3_cjs.fetchDocumentPdf)(client, doc.external_id);
46
43
  } catch (e) {
47
- if (!pdf && e instanceof chunk3QK4VVPG_cjs.DocumentFetchError) return null;
44
+ if (!pdf && e instanceof chunkTGSEQGM3_cjs.DocumentFetchError) return null;
48
45
  throw e;
49
46
  }
50
47
  const bytes = new Uint8Array(await blob.arrayBuffer());
@@ -77,6 +74,8 @@ async function saveProductionFiles(upload, files, folder) {
77
74
  shared: file.sources.every((doc) => doc.shared),
78
75
  folder
79
76
  };
77
+ const workspaces = new Set(file.sources.map((doc) => doc.workspace_ext_id).filter(Boolean));
78
+ if (workspaces.size === 1) query.workspace_ext_id = [...workspaces][0];
80
79
  const response = await upload({
81
80
  file: new File([file.bytes], file.name, { type: "application/pdf" }),
82
81
  query
@@ -107,7 +106,7 @@ async function buildProduction(client, documents, choices, options) {
107
106
  if (items.length === 0) {
108
107
  throw new Error("None of these documents has a PDF version to number yet.");
109
108
  }
110
- const { buildBundle } = await import('../bundle-DCWPYNGD.cjs');
109
+ const { buildBundle } = await import('../bundle-IC65W2AO.cjs');
111
110
  const result = await buildBundle(items, {
112
111
  layout: choices.layout,
113
112
  bates: {
@@ -149,1186 +148,404 @@ async function buildProduction(client, documents, choices, options) {
149
148
  };
150
149
  }
151
150
 
152
- // src/document-tools/markup-store.ts
153
- var MAX_MERGE_ATTEMPTS = 5;
154
- var KEEPALIVE_LIMIT = 6e4;
155
- var MarkupStoreError = class extends Error {
156
- constructor(message, status) {
157
- super(message);
158
- this.status = status;
159
- this.name = "MarkupStoreError";
160
- }
161
- status;
162
- };
163
- var detailOf = (error, fallback) => {
164
- const detail3 = error?.detail;
165
- return typeof detail3 === "string" ? detail3 : fallback;
166
- };
167
- async function call(request) {
168
- try {
169
- return await request();
170
- } catch (e) {
171
- if (e instanceof TypeError || typeof navigator !== "undefined" && !navigator.onLine) {
172
- throw new chunkSUZORMAB_cjs.AnnotationStoreOfflineError();
173
- }
174
- throw e;
175
- }
176
- }
177
- function createMarkupStore({ version, client, onSaved }) {
178
- let revision = 0;
179
- let count = 0;
180
- let canEdit = false;
181
- let base = null;
182
- const seen = /* @__PURE__ */ new Set();
183
- const remember = (layer) => {
184
- for (const a of layer.annotations) seen.add(a.id);
185
- };
186
- const query = version ? { version } : {};
187
- async function read(documentId, ifNoneMatch) {
188
- const { data, error, response } = await call(
189
- () => client.GET("/v1/document/{document_ext_id}/markup", {
190
- params: { path: { document_ext_id: documentId }, query },
191
- headers: ifNoneMatch === void 0 ? void 0 : { "If-None-Match": `"${ifNoneMatch}"` }
192
- })
193
- );
194
- if (response.status === 304) return null;
195
- if (error || !data) {
196
- throw new MarkupStoreError(
197
- detailOf(error, `The markup could not be loaded (${response.status})`),
198
- response.status
199
- );
200
- }
201
- const layer = chunk2IJP73ZG_cjs.parseLayer({
202
- schema: chunk2IJP73ZG_cjs.LAYER_SCHEMA_VERSION,
203
- documentId,
204
- annotations: data.annotations ?? [],
205
- updatedAt: data.updated_at ?? (/* @__PURE__ */ new Date()).toISOString()
206
- });
207
- return { revision: data.revision ?? 0, layer, canEdit: !!data.can_edit };
208
- }
209
- function adopt(server) {
210
- revision = server.revision;
211
- canEdit = server.canEdit;
212
- base = server.layer;
213
- count = server.layer.annotations.length;
214
- remember(server.layer);
215
- }
216
- async function put(layer, from) {
217
- return call(
218
- () => client.PUT("/v1/document/{document_ext_id}/markup", {
219
- params: { path: { document_ext_id: layer.documentId }, query },
220
- headers: { "If-Match": `"${from}"` },
221
- body: { annotations: layer.annotations, base_revision: from },
222
- // A save started as the page closes must outlive it; browsers cap such bodies at 64 KB.
223
- keepalive: JSON.stringify(layer.annotations).length < KEEPALIVE_LIMIT
224
- })
225
- );
226
- }
227
- return {
228
- snapshot: () => ({ revision, count, canEdit }),
229
- canEdit: () => canEdit,
230
- async load(documentId) {
231
- const server = await read(documentId);
232
- if (!server) throw new MarkupStoreError("The markup could not be loaded");
233
- adopt(server);
234
- return server.layer;
235
- },
236
- async save(layer) {
237
- remember(layer);
238
- let mine = layer;
239
- for (let attempt = 0; attempt < MAX_MERGE_ATTEMPTS; attempt++) {
240
- const { data, error, response } = await put(mine, revision);
241
- if (response.ok && data) {
242
- revision = data.revision;
243
- count = data.count;
244
- base = mine;
245
- remember(mine);
246
- onSaved?.({ revision, count, canEdit });
247
- return mine;
248
- }
249
- if (response.status === 409) {
250
- const latest = await read(layer.documentId);
251
- if (!latest) throw new MarkupStoreError("The markup could not be re-read");
252
- const deleted = new Set(
253
- [...seen].filter((id) => !mine.annotations.some((a) => a.id === id))
254
- );
255
- const merged = chunkSUZORMAB_cjs.mergeLayers({ base, mine, theirs: latest.layer, deleted });
256
- revision = latest.revision;
257
- canEdit = latest.canEdit;
258
- base = latest.layer;
259
- remember(latest.layer);
260
- mine = merged;
261
- continue;
262
- }
263
- if (response.status === 403) canEdit = false;
264
- throw new MarkupStoreError(
265
- detailOf(error, `The markup could not be saved (${response.status})`),
266
- response.status
267
- );
268
- }
269
- throw new MarkupStoreError("The markup keeps changing; it will be saved on the next edit");
270
- },
271
- async pull(documentId) {
272
- const server = await read(documentId, revision);
273
- if (!server || server.revision === revision) return null;
274
- adopt(server);
275
- return server.layer;
276
- }
277
- };
278
- }
279
-
280
- // src/document-tools/markup-transfer.ts
281
- var LEGACY_LAYER_PREFIX = "arbi:annotations:";
282
- function storage() {
283
- try {
284
- return typeof localStorage === "undefined" ? void 0 : localStorage;
285
- } catch {
286
- return void 0;
287
- }
288
- }
289
- function readLegacyLayer(documentId) {
290
- try {
291
- const raw = storage()?.getItem(LEGACY_LAYER_PREFIX + documentId);
292
- if (!raw) return null;
293
- return chunk2IJP73ZG_cjs.parseLayer(JSON.parse(raw));
294
- } catch {
295
- return null;
296
- }
297
- }
298
- function forgetLegacyLayer(documentId) {
299
- try {
300
- storage()?.removeItem(LEGACY_LAYER_PREFIX + documentId);
301
- } catch {
302
- }
303
- }
304
- function marksByVersion(layer, versions) {
305
- const sorted = [...versions].sort((a, b) => a.n - b.n);
306
- const out = /* @__PURE__ */ new Map();
307
- for (const mark of layer.annotations) {
308
- const at = Date.parse(mark.createdAt);
309
- let target = sorted[0]?.n ?? 1;
310
- for (const v of sorted) {
311
- const created = v.created_at ? Date.parse(v.created_at) : Number.NaN;
312
- if (!Number.isNaN(created) && !Number.isNaN(at) && created <= at) target = v.n;
313
- }
314
- out.set(target, [...out.get(target) ?? [], mark]);
315
- }
316
- return out;
317
- }
318
- async function addToMarkup(documentId, version, marks, client) {
319
- const store = createMarkupStore({ version, client });
320
- const current = await store.load(documentId);
321
- const incoming = {
322
- ...chunk2IJP73ZG_cjs.emptyLayer(documentId, (/* @__PURE__ */ new Date()).toISOString()),
323
- annotations: marks
324
- };
325
- const merged = chunkSUZORMAB_cjs.mergeLayers({ base: null, mine: current, theirs: incoming });
326
- const added = merged.annotations.length - current.annotations.length;
327
- if (added > 0) await store.save(chunk2IJP73ZG_cjs.parseLayer({ ...merged, schema: chunk2IJP73ZG_cjs.LAYER_SCHEMA_VERSION }));
328
- return added;
329
- }
330
- async function migrateLegacyLayer(documentId, layer, versions, currentVersion, client) {
331
- let added = 0;
332
- for (const [n, marks] of marksByVersion(layer, versions.length ? versions : [{ n: 1 }])) {
333
- added += await addToMarkup(documentId, n === currentVersion ? void 0 : n, marks, client);
334
- }
335
- forgetLegacyLayer(documentId);
336
- return added;
337
- }
338
- async function openThreadsOf(documentId, version, client) {
339
- const layer = await createMarkupStore({ version, client }).load(documentId);
340
- return layer.annotations.filter((a) => a.kind === "comment" && !a.resolved);
341
- }
342
- async function copyOpenThreads(documentId, fromVersion, client) {
343
- const threads = await openThreadsOf(documentId, fromVersion, client);
344
- if (!threads.length) return 0;
345
- return addToMarkup(documentId, void 0, threads, client);
346
- }
347
- function versionsWithMarkup(versions) {
348
- return (versions ?? []).filter((v) => (v.markup_count ?? 0) > 0);
349
- }
350
- var SIGNED_UNCHANGED = "The signed PDF is unchanged: the comments are kept beside it as markup.";
351
- function useDocumentMarkup(documentData, snapshotVersion, currentSigned = false) {
352
- const { client, notify, saveFile, onDocumentsChanged } = chunk3QK4VVPG_cjs.useDocumentTools();
353
- const documentId = documentData?.external_id;
354
- const currentVersion = documentData?.current_version ?? 1;
355
- const shownVersion = snapshotVersion ?? currentVersion;
356
- const versions = react.useMemo(() => documentData?.versions ?? [], [documentData?.versions]);
357
- const [localCounts, setLocalCounts] = react.useState({});
358
- const countOf = react.useCallback(
359
- (n) => localCounts[`${documentId}@${n}`] ?? versions.find((v) => v.n === n)?.markup_count ?? 0,
360
- [localCounts, documentId, versions]
361
- );
362
- const hasMarkup = countOf(shownVersion) > 0;
363
- const [showOriginal, setShowOriginal] = react.useState(false);
364
- react.useEffect(() => setShowOriginal(false), [documentId, snapshotVersion]);
365
- const refresh = react.useCallback(() => {
366
- if (!documentId || !onDocumentsChanged) return;
367
- Promise.resolve(onDocumentsChanged([documentId], "markup")).catch(
368
- (e) => console.warn("Could not refresh the document after a markup change", e)
369
- );
370
- }, [documentId, onDocumentsChanged]);
371
- const onMarkupChange = react.useCallback(
372
- (snapshot) => {
373
- if (!documentId) return;
374
- const key = `${documentId}@${shownVersion}`;
375
- if (countOf(shownVersion) > 0 !== snapshot.count > 0) refresh();
376
- setLocalCounts((counts) => ({ ...counts, [key]: snapshot.count }));
377
- },
378
- [documentId, shownVersion, countOf, refresh]
379
- );
380
- const downloadMarkup = react.useCallback(async () => {
381
- if (!documentId) return;
382
- if (currentSigned) {
383
- notify(chunk3QK4VVPG_cjs.SIGNED_LOCKED_REASON, "info");
384
- return;
385
- }
386
- try {
387
- const { blob, fileName } = await chunk3QK4VVPG_cjs.fetchMarkupPdf(
388
- client,
389
- documentId,
390
- snapshotVersion ? snapshotVersion : void 0
391
- );
392
- saveFile(blob, fileName);
393
- } catch (e) {
394
- notify(e instanceof Error ? e.message : "The markup could not be downloaded", "error");
395
- }
396
- }, [client, documentId, snapshotVersion, saveFile, notify, currentSigned]);
397
- const [legacyCount, setLegacyCount] = react.useState(0);
398
- const [migrating, setMigrating] = react.useState(false);
399
- const shared = documentData?.shared;
400
- const loaded = !!documentData;
401
- const migrate = react.useCallback(async () => {
402
- if (!documentId) return;
403
- const layer = readLegacyLayer(documentId);
404
- if (!layer) return;
405
- setMigrating(true);
406
- try {
407
- const added = await migrateLegacyLayer(documentId, layer, versions, currentVersion, client);
408
- setLegacyCount(0);
409
- setLocalCounts({});
410
- refresh();
411
- if (added > 0) {
412
- notify(
413
- `${added} annotation${added === 1 ? "" : "s"} from this browser saved to the document`,
414
- "success",
415
- {
416
- description: shared ? "They are now part of the shared markup." : "They are saved with the document, visible only to you."
417
- }
418
- );
419
- }
420
- } catch (e) {
421
- notify(
422
- e instanceof Error ? e.message : "The annotations from this browser could not be saved",
423
- "error",
424
- { description: "They are still kept in this browser; open the document again to retry." }
425
- );
426
- } finally {
427
- setMigrating(false);
428
- }
429
- }, [client, documentId, versions, currentVersion, refresh, shared, notify]);
430
- react.useEffect(() => {
431
- if (!documentId || !loaded) return;
432
- const layer = readLegacyLayer(documentId);
433
- if (!layer) {
434
- setLegacyCount(0);
435
- return;
436
- }
437
- if (layer.annotations.length === 0) {
438
- forgetLegacyLayer(documentId);
439
- setLegacyCount(0);
440
- return;
441
- }
442
- if (shared) setLegacyCount(layer.annotations.length);
443
- else void migrate();
444
- }, [documentId, loaded, shared]);
445
- const legacyPrompt = legacyCount > 0 && !snapshotVersion ? {
446
- count: legacyCount,
447
- busy: migrating,
448
- add: () => void migrate(),
449
- discard: () => {
450
- if (documentId) forgetLegacyLayer(documentId);
451
- setLegacyCount(0);
452
- }
453
- } : null;
454
- const [copying, setCopying] = react.useState(false);
455
- const olderWithMarkup = versionsWithMarkup(versions).filter((v) => v.n !== currentVersion).sort((a, b) => b.n - a.n)[0];
456
- const olderNote = !snapshotVersion && !hasMarkup && olderWithMarkup ? {
457
- version: olderWithMarkup.n,
458
- busy: copying,
459
- signed: currentSigned,
460
- copy: () => {
461
- if (!documentId) return;
462
- setCopying(true);
463
- copyOpenThreads(documentId, olderWithMarkup.n, client).then((n) => {
464
- if (n > 0) {
465
- setLocalCounts((c) => ({ ...c, [`${documentId}@${currentVersion}`]: n }));
466
- refresh();
467
- }
468
- notify(
469
- n > 0 ? `${n} open comment thread${n === 1 ? "" : "s"} copied to version ${currentVersion}` : `Version ${olderWithMarkup.n} has no open comments`,
470
- n > 0 ? "success" : "info",
471
- // The markup is stored beside the version, so the sealed bytes do not change.
472
- n > 0 && currentSigned ? { description: SIGNED_UNCHANGED } : void 0
473
- );
474
- }).catch(
475
- (e) => notify(e instanceof Error ? e.message : "The comments could not be copied", "error")
476
- ).finally(() => setCopying(false));
477
- }
478
- } : null;
479
- return {
480
- hasMarkup,
481
- showOriginal,
482
- setShowOriginal,
483
- onMarkupChange,
484
- downloadMarkup,
485
- legacyPrompt,
486
- olderNote
487
- };
488
- }
489
-
490
- // src/document-tools/frozen-copy.ts
491
- var baseName = (fileName) => (fileName || "document").replace(/\.pdf$/i, "");
492
- function frozenCopyName(fileName, redacted) {
493
- return `${baseName(fileName)} (${redacted ? "redacted" : "annotated"}).pdf`;
494
- }
495
- function redactionLogName(fileName) {
496
- return `${baseName(fileName)} (redaction log).csv`;
497
- }
498
- async function uploadFrozenCopy(upload, bytes, source, redacted) {
499
- const file = new File([bytes], frozenCopyName(source.fileName, redacted), {
500
- type: "application/pdf"
501
- });
502
- const query = {
503
- derived_from: [source.documentId],
504
- derived_role: redacted ? "redaction" : "annotated",
505
- shared: source.shared
506
- };
507
- if (source.folder) query.folder = source.folder;
508
- const response = await upload({ file, query });
509
- return response?.doc_ext_ids?.[0];
510
- }
511
-
512
- // src/document-tools/can-annotate.ts
513
- function canAnnotate(s) {
514
- return s.activeTab === "pdf" && s.hasPdf && !s.isImage && !s.isVideo && !s.isAudio && !s.isDownloadOnly && !s.isDraft && !s.isStreaming && !s.isSnapshot && !s.isComparing;
515
- }
516
- function useIsOnline() {
517
- return react.useSyncExternalStore(
518
- (onChange) => reactQuery.onlineManager.subscribe(onChange),
519
- () => reactQuery.onlineManager.isOnline(),
520
- () => true
521
- );
522
- }
523
- function useDocumentBytes(documentRef, options) {
524
- const { client } = chunk3QK4VVPG_cjs.useDocumentTools();
525
- const { version, kind, enabled = true, fallback } = options;
526
- return reactQuery.useQuery({
527
- queryKey: chunkG76ASVVH_cjs.documentBytesKey(documentRef, version ?? null, kind),
528
- queryFn: async ({ signal }) => {
529
- if (fallback && typeof navigator !== "undefined" && navigator.onLine === false) {
530
- const offline = await fallback();
531
- if (offline) return offline;
532
- }
533
- try {
534
- return await (kind === "original" ? chunk3QK4VVPG_cjs.fetchDocumentFile : chunk3QK4VVPG_cjs.fetchDocumentPdf)(
535
- client,
536
- documentRef,
537
- { signal }
538
- );
539
- } catch (error) {
540
- const offline = await fallback?.();
541
- if (offline) return offline;
542
- throw error;
543
- }
544
- },
545
- enabled: enabled && !!documentRef,
546
- // 'always' so it still runs offline: the fallback serves a copy kept on this device.
547
- networkMode: "always",
548
- staleTime: Infinity
549
- });
550
- }
551
- function intentText(signer) {
552
- return `I, ${signer.name.trim()}, sign this document electronically. I intend this electronic signature to have the same effect as my handwritten signature.`;
553
- }
554
- async function sha256Hex(blob) {
555
- const digest = await crypto.subtle.digest("SHA-256", new Uint8Array(await blob.arrayBuffer()));
556
- return Array.from(new Uint8Array(digest), (b) => b.toString(16).padStart(2, "0")).join("");
557
- }
558
- function toAppearance(box) {
559
- return { page: box.page - 1, x: box.rect.x, y: box.rect.y, width: box.rect.w, height: box.rect.h };
560
- }
561
- var MIN_SIGNATURE_BOX = { width: 0.3, height: 0.07 };
562
- function isLegibleSignatureBox(rect) {
563
- return rect.w >= MIN_SIGNATURE_BOX.width && rect.h >= MIN_SIGNATURE_BOX.height;
564
- }
565
- var SIGNATURES_PATH = "/v1/document/{document_ext_id}/signatures";
566
- function errorDetail(error, fallback) {
567
- const detail3 = error?.detail;
568
- return typeof detail3 === "string" ? detail3 : fallback;
569
- }
570
- async function fetchDocumentSignatures(client, documentRef) {
571
- const { docId, version } = chunkZWFMFOGP_cjs.parseVersionRef(documentRef);
572
- const { data, error } = await client.GET(SIGNATURES_PATH, {
573
- params: { path: { document_ext_id: docId }, ...version ? { query: { version } } : {} }
574
- });
575
- if (!data) throw new Error(errorDetail(error, "The signatures could not be read"));
576
- return data;
577
- }
578
- function useDocumentSignatures(documentId, enabled = true) {
579
- const { client } = chunk3QK4VVPG_cjs.useDocumentTools();
580
- const { docId, version } = chunkZWFMFOGP_cjs.parseVersionRef(documentId);
581
- return reactQuery.useQuery({
582
- queryKey: chunkG76ASVVH_cjs.arbiQueryKeys.documentSignatures(docId ?? "", version),
583
- queryFn: () => fetchDocumentSignatures(client, documentId),
584
- enabled: enabled && !!docId,
585
- staleTime: 6e4
586
- });
587
- }
588
- var SigningError = class extends Error {
589
- reason;
590
- constructor(message, reason) {
591
- super(message);
592
- this.name = "SigningError";
593
- this.reason = reason;
594
- }
595
- };
596
- function signingErrorReason(detail3) {
597
- if (/still being prepared/i.test(detail3)) return "preparing";
598
- if (/no longer the current version/i.test(detail3)) return "stale";
599
- return "failed";
600
- }
601
- function signingError(error, fallback) {
602
- const detail3 = errorDetail(error, fallback);
603
- return new SigningError(detail3, signingErrorReason(detail3));
604
- }
605
- var PREPARE_RETRIES = 3;
606
- var PREPARE_RETRY_DELAY_MS = 1500;
607
- var wait = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
608
- async function signDocument(client$1, deploymentDomain, {
609
- documentId,
610
- pdfBlob,
611
- email,
612
- password,
613
- signer,
614
- appearance,
615
- includeDate = false,
616
- version
617
- }) {
618
- const path = { document_ext_id: documentId };
619
- const body = {
620
- signer: { name: signer.name },
621
- ...appearance ? { appearance } : {},
622
- include_date: includeDate,
623
- ...version ? { version } : {}
624
- };
625
- const prepare = () => client$1.POST("/v1/document/{document_ext_id}/sign/prepare", { params: { path }, body });
626
- let prepared = await prepare();
627
- for (let attempt = 0; !prepared.data && attempt < PREPARE_RETRIES; attempt++) {
628
- if (signingError(prepared.error, "").reason !== "preparing") break;
629
- await wait(PREPARE_RETRY_DELAY_MS);
630
- prepared = await prepare();
631
- }
632
- if (!prepared.data) throw signingError(prepared.error, "Could not prepare signing");
633
- const { statement, intent, source_sha256, timestamp } = prepared.data;
634
- if (await sha256Hex(pdfBlob) !== source_sha256) {
635
- throw new Error("The document changed since it was opened. Reopen it and sign again.");
636
- }
637
- if (intent !== intentText(signer)) throw new Error("Signing statement mismatch; not signed.");
638
- const identity = await client.unlockIdentityWithPassword(email, password, deploymentDomain);
639
- const signed = await client$1.POST("/v1/document/{document_ext_id}/sign", {
640
- params: { path },
641
- body: { ...body, timestamp, signature: client.signMessage(statement, identity) }
642
- });
643
- if (!signed.data) throw signingError(signed.error, "Signing failed");
644
- return signed.data;
645
- }
646
- function useSignDocument() {
647
- const env = chunk3QK4VVPG_cjs.useDocumentTools();
648
- const queryClient = reactQuery.useQueryClient();
649
- return reactQuery.useMutation({
650
- mutationFn: (vars) => {
651
- if (!env.deploymentDomain) throw new Error("Signing is not set up: no deployment domain");
652
- return signDocument(env.client, env.deploymentDomain, vars);
653
- },
654
- onSuccess: async (result) => {
655
- await env.onDocumentsChanged?.([result.doc_ext_id], "signed");
656
- await queryClient.invalidateQueries({ queryKey: chunkG76ASVVH_cjs.arbiQueryKeys.documentSignatures() });
657
- }
658
- });
659
- }
660
- var VERIFY_PATH = "/v1/sign/verify/{reference}";
661
- var REFERENCE = /^sig-[0-9a-f]{32}$/;
662
- function isSignatureReference(reference) {
663
- return !!reference && REFERENCE.test(reference);
664
- }
665
- var SignatureVerificationError = class extends Error {
666
- constructor(message, status) {
667
- super(message);
668
- this.status = status;
669
- this.name = "SignatureVerificationError";
670
- }
671
- status;
672
- };
673
- var VERIFY_ERRORS = {
674
- 404: "No signature has this reference.",
675
- 429: "Too many checks, try again in a minute."
676
- };
677
- async function fetchSignatureVerification(client, reference) {
678
- if (!isSignatureReference(reference)) {
679
- throw new SignatureVerificationError("This is not a signature reference.");
680
- }
681
- const { data, response } = await client.GET(VERIFY_PATH, {
682
- params: { path: { reference } }
683
- });
684
- if (!response.ok || !data) {
685
- throw new SignatureVerificationError(
686
- VERIFY_ERRORS[response.status] ?? "The signature could not be checked right now.",
687
- response.status
688
- );
689
- }
690
- return data;
691
- }
692
- function useSignatureVerification(reference) {
693
- const { client } = chunk3QK4VVPG_cjs.useDocumentTools();
694
- return reactQuery.useQuery({
695
- queryKey: chunkG76ASVVH_cjs.arbiQueryKeys.signatureVerification(reference ?? ""),
696
- queryFn: () => fetchSignatureVerification(client, reference),
697
- enabled: !!reference,
698
- retry: false
699
- });
700
- }
701
- async function matchSignedCopy(file, verification) {
702
- const hash = await sha256Hex(file);
703
- if (hash === verification.document_sha256.toLowerCase()) return { kind: "current" };
704
- const signature = verification.signatures.find((s) => s.sha256.toLowerCase() === hash);
705
- return signature ? { kind: "earlier", signature } : { kind: "none" };
706
- }
707
- var SIGNATURE_FIELD_TYPES = [
708
- "signature",
709
- "initials",
710
- "date",
711
- "name"
712
- ];
713
- var FIELD_TYPE_LABELS = {
714
- signature: "Signature",
715
- initials: "Initials",
716
- date: "Date signed",
717
- name: "Name"
718
- };
719
- var DEFAULT_FIELD_SIZE = {
720
- signature: { width: 0.28, height: 0.05 },
721
- initials: { width: 0.1, height: 0.04 },
722
- date: { width: 0.22, height: 0.028 },
723
- name: { width: 0.28, height: 0.028 }
724
- };
725
- var SIGNER_PROGRESS_LABELS = {
726
- invited: "Invited",
727
- registered: "Not opened yet",
728
- viewed: "Viewed",
729
- signed: "Signed",
730
- declined: "Declined"
731
- };
732
- var EMAIL = /^[^@\s<>,;]{1,64}@[^@\s<>,;]{1,255}\.[^@\s<>,;]{1,63}$/;
733
- var isEmailSigner = (signer) => EMAIL.test(signer.trim());
734
- var MARK_FIELD_TYPES = ["signature", "initials"];
735
- function detail(error, fallback) {
736
- const d = error?.detail;
737
- if (typeof d === "string") return d;
738
- if (Array.isArray(d) && d[0] && typeof d[0] === "object" && "msg" in d[0]) {
739
- return String(d[0].msg);
740
- }
741
- return fallback;
742
- }
743
- function newFieldId() {
744
- return `f${Math.random().toString(36).slice(2, 10)}`;
745
- }
746
- function initialsOf(name) {
747
- return name.split(/\s+/).filter(Boolean).map((part) => part[0].toUpperCase()).join("").slice(0, 4);
748
- }
749
- function fieldsInSigningOrder(fields, signer) {
750
- return fields.filter((f) => f.signer === signer).sort((a, b) => a.page - b.page || a.y - b.y || a.x - b.x);
751
- }
752
- function sendBlocker(fields) {
753
- if (fields.length === 0) return "Place at least one field.";
754
- const signers = [...new Set(fields.map((f) => f.signer))];
755
- for (const signer of signers) {
756
- if (!fields.some((f) => f.signer === signer && MARK_FIELD_TYPES.includes(f.type))) {
757
- return "Every signer needs a signature or initials field.";
758
- }
759
- }
760
- return null;
761
- }
762
- function fieldsFromSuggestions(suggestions, assign, members = /* @__PURE__ */ new Map()) {
763
- return suggestions.flatMap((s) => {
764
- const email = s.signer_email?.toLowerCase();
765
- const signer = email ? members.get(email) ?? email : assign[s.group];
766
- if (!signer) return [];
767
- return [
768
- {
769
- id: newFieldId(),
770
- type: s.type,
771
- page: s.page,
772
- x: s.x,
773
- y: s.y,
774
- width: s.width,
775
- height: s.height,
776
- signer,
777
- required: s.required ?? true
778
- }
779
- ];
780
- });
781
- }
782
- function splitSuggestions(suggestions) {
783
- return {
784
- placed: suggestions.filter((s) => s.source === "anchor"),
785
- extras: suggestions.filter((s) => s.source !== "anchor")
786
- };
787
- }
788
- async function fetchDocumentSignatureRequests(client, documentId) {
789
- const { data, error } = await client.GET("/v1/document/{document_ext_id}/signature-requests", {
790
- params: { path: { document_ext_id: documentId } }
791
- });
792
- if (!data) throw new Error(detail(error, "The signature requests could not be read"));
793
- return data;
794
- }
795
- function useDocumentSignatureRequests(documentId, enabled = true) {
796
- const { client } = chunk3QK4VVPG_cjs.useDocumentTools();
797
- return reactQuery.useQuery({
798
- queryKey: chunkG76ASVVH_cjs.arbiQueryKeys.signatureRequestsForDocument(documentId ?? ""),
799
- queryFn: () => fetchDocumentSignatureRequests(client, documentId),
800
- enabled: enabled && !!documentId,
801
- staleTime: 15e3
802
- });
803
- }
804
- function useSignatureRequestsAwaitingMe(enabled = true) {
805
- const { client } = chunk3QK4VVPG_cjs.useDocumentTools();
806
- return reactQuery.useQuery({
807
- queryKey: chunkG76ASVVH_cjs.arbiQueryKeys.signatureRequestsAwaitingMe(),
808
- queryFn: async () => {
809
- const { data, error } = await client.GET("/v1/signature-requests", {
810
- params: { query: { awaiting_me: true } }
811
- });
812
- if (!data) throw new Error(detail(error, "The signature requests could not be read"));
813
- return data;
814
- },
815
- enabled,
816
- staleTime: 15e3
817
- });
818
- }
819
- function useSignatureRequest(requestId) {
820
- const { client } = chunk3QK4VVPG_cjs.useDocumentTools();
821
- return reactQuery.useQuery({
822
- queryKey: chunkG76ASVVH_cjs.arbiQueryKeys.signatureRequest(requestId ?? ""),
823
- queryFn: async () => {
824
- const { data, error } = await client.GET("/v1/signature-requests/{request_ext_id}", {
825
- params: { path: { request_ext_id: requestId } }
826
- });
827
- if (!data) throw new Error(detail(error, "The signature request could not be read"));
828
- return data;
829
- },
830
- enabled: !!requestId
831
- });
832
- }
833
- async function signatureFieldSuggestions(client, documentId, version) {
834
- const { data, error } = await client.GET(
835
- "/v1/document/{document_ext_id}/signature-fields/suggest",
836
- {
837
- params: { path: { document_ext_id: documentId }, ...version ? { query: { version } } : {} }
838
- }
839
- );
840
- if (!data) throw new Error(detail(error, "Signature blocks could not be read"));
841
- return { fields: data.fields, signers: data.signers ?? [] };
842
- }
843
- async function suggestSignatureFields(client, documentId, version) {
844
- return (await signatureFieldSuggestions(client, documentId, version)).fields;
845
- }
846
- async function saveSignatureRequest(client, { documentId, version, fields, message, requestId, send }) {
847
- if (!requestId) {
848
- const { data, error } = await client.POST("/v1/document/{document_ext_id}/signature-requests", {
849
- params: { path: { document_ext_id: documentId } },
850
- body: { fields, message: message || null, send, ...version ? { version } : {} }
851
- });
852
- if (!data) throw new Error(detail(error, "The signature request could not be saved"));
853
- return data;
854
- }
855
- const path = { request_ext_id: requestId };
856
- const updated = await client.PATCH("/v1/signature-requests/{request_ext_id}", {
857
- params: { path },
858
- body: { fields, message: message ?? null }
859
- });
860
- if (!updated.data) throw new Error(detail(updated.error, "The draft could not be saved"));
861
- if (!send) return updated.data;
862
- const sent = await client.POST("/v1/signature-requests/{request_ext_id}/send", {
863
- params: { path }
864
- });
865
- if (!sent.data) throw new Error(detail(sent.error, "The request could not be sent"));
866
- return sent.data;
867
- }
868
- function useInvalidateRequests() {
869
- const queryClient = reactQuery.useQueryClient();
870
- return () => queryClient.invalidateQueries({ queryKey: chunkG76ASVVH_cjs.arbiQueryKeys.signatureRequests() });
871
- }
872
- function useSaveSignatureRequest() {
873
- const { client } = chunk3QK4VVPG_cjs.useDocumentTools();
874
- const invalidate = useInvalidateRequests();
875
- return reactQuery.useMutation({
876
- mutationFn: (vars) => saveSignatureRequest(client, vars),
877
- onSuccess: invalidate
878
- });
879
- }
880
- function useVoidSignatureRequest() {
881
- const { client } = chunk3QK4VVPG_cjs.useDocumentTools();
882
- const invalidate = useInvalidateRequests();
883
- return reactQuery.useMutation({
884
- mutationFn: async (requestId) => {
885
- const { data, error } = await client.POST("/v1/signature-requests/{request_ext_id}/void", {
886
- params: { path: { request_ext_id: requestId } }
887
- });
888
- if (!data) throw new Error(detail(error, "The request could not be voided"));
889
- return data;
890
- },
891
- onSuccess: invalidate
892
- });
893
- }
894
- function useDeclineSignatureRequest() {
895
- const { client } = chunk3QK4VVPG_cjs.useDocumentTools();
896
- const invalidate = useInvalidateRequests();
897
- return reactQuery.useMutation({
898
- mutationFn: async ({ requestId, reason }) => {
899
- const { data, error } = await client.POST("/v1/signature-requests/{request_ext_id}/decline", {
900
- params: { path: { request_ext_id: requestId } },
901
- body: { reason: reason || null }
902
- });
903
- if (!data) throw new Error(detail(error, "Could not decline"));
904
- return data;
905
- },
906
- onSuccess: invalidate
907
- });
908
- }
909
- async function signSignatureRequest(client$1, deploymentDomain, { request, pdfBlob, email, password, adopted, fields }) {
910
- const path = { request_ext_id: request.external_id };
911
- const body = { adopted, fields };
912
- const prepared = await client$1.POST("/v1/signature-requests/{request_ext_id}/sign/prepare", {
913
- params: { path },
914
- body
915
- });
916
- if (!prepared.data) {
917
- throw new SigningError(detail(prepared.error, "Could not prepare signing"), "failed");
918
- }
919
- const { statement, intent, source_sha256, timestamp } = prepared.data;
920
- if (source_sha256 !== request.source_sha256 || await sha256Hex(pdfBlob) !== source_sha256) {
921
- throw new SigningError("The document changed since it was sent. Ask for it again.", "stale");
922
- }
923
- if (intent !== intentText({ name: adopted.name })) {
924
- throw new Error("Signing statement mismatch; not signed.");
925
- }
926
- const identity = await client.unlockIdentityWithPassword(email, password, deploymentDomain);
927
- const signed = await client$1.POST("/v1/signature-requests/{request_ext_id}/sign", {
928
- params: { path },
929
- body: { ...body, timestamp, signature: client.signMessage(statement, identity) }
930
- });
931
- if (!signed.data) throw new SigningError(detail(signed.error, "Signing failed"), "failed");
932
- return signed.data;
933
- }
934
- function useSignSignatureRequest() {
935
- const env = chunk3QK4VVPG_cjs.useDocumentTools();
936
- const invalidate = useInvalidateRequests();
937
- const queryClient = reactQuery.useQueryClient();
938
- return reactQuery.useMutation({
939
- mutationFn: (vars) => {
940
- if (!env.deploymentDomain) throw new Error("Signing is not set up: no deployment domain");
941
- return signSignatureRequest(env.client, env.deploymentDomain, vars);
942
- },
943
- onSuccess: async (result) => {
944
- await invalidate();
945
- if (result.completed && result.request.doc_ext_id) {
946
- await env.onDocumentsChanged?.([result.request.doc_ext_id], "signed");
947
- await queryClient.invalidateQueries({ queryKey: chunkG76ASVVH_cjs.arbiQueryKeys.documentSignatures() });
948
- }
949
- }
950
- });
951
- }
952
- function useSignerCandidates(enabled = true) {
953
- const { client, user } = chunk3QK4VVPG_cjs.useDocumentTools();
954
- return reactQuery.useQuery({
955
- queryKey: chunkG76ASVVH_cjs.arbiQueryKeys.signatureCandidates(),
956
- queryFn: async () => {
957
- const { data, error } = await client.GET("/v1/workspace/users");
958
- if (!data) throw new Error(detail(error, "The workspace members could not be read"));
959
- const people = data.filter((m) => m.user.external_id.startsWith("usr-")).map((m) => ({
960
- externalId: m.user.external_id,
961
- name: [m.user.given_name, m.user.family_name].filter(Boolean).join(" ") || m.user.email,
962
- email: m.user.email,
963
- role: String(m.role)
964
- }));
965
- const me = user?.email?.toLowerCase();
966
- return [...people].sort(
967
- (a, b) => Number(b.email.toLowerCase() === me) - Number(a.email.toLowerCase() === me)
968
- );
969
- },
970
- enabled,
971
- staleTime: 6e4
972
- });
973
- }
974
- async function inviteSigners(client, documentId, emails) {
975
- if (!emails.length) return;
976
- const { error, response } = await client.POST("/v1/workspace/users", {
977
- body: browser.workspaces.addWorkspaceMembersBody({
978
- emails,
979
- role: "guest",
980
- confirm_invite: true,
981
- resource_type: "document",
982
- resource_ext_id: documentId
983
- })
984
- });
985
- if (response.status === 409) {
986
- throw new Error("Share the document with the workspace before asking others to sign it.");
987
- }
988
- if (error && response.status !== 404) {
989
- throw new Error(detail(error, "The signers could not be invited"));
990
- }
991
- }
992
- function useInviteSigners() {
993
- const { client } = chunk3QK4VVPG_cjs.useDocumentTools();
994
- const invalidate = useInvalidateRequests();
995
- const queryClient = reactQuery.useQueryClient();
996
- return reactQuery.useMutation({
997
- mutationFn: ({ documentId, emails }) => inviteSigners(client, documentId, emails),
998
- onSuccess: async () => {
999
- await invalidate();
1000
- await queryClient.invalidateQueries({ queryKey: chunkG76ASVVH_cjs.arbiQueryKeys.signatureCandidates() });
1001
- }
1002
- });
1003
- }
1004
- var INFORMAL_SIGNATURE_NOTE = "Your saved signature or initials are placed as an image on the document.";
1005
- async function keypair(source = client.getUserEncryptionKeypair) {
1006
- await client.initSodium();
1007
- const pair = await source();
1008
- if (!pair) throw new Error("Sign in again to use your saved signature.");
1009
- return pair;
1010
- }
1011
- function detail2(error, fallback) {
1012
- const d = error?.detail;
1013
- return typeof d === "string" ? d : fallback;
1014
- }
1015
- async function fetchSavedSignature(client$1, source) {
1016
- const { data, error } = await client$1.GET("/v1/user/signature");
1017
- if (!data) throw new Error(detail2(error, "Your saved signature could not be read"));
1018
- if (!data.sealed) return null;
1019
- const pair = await keypair(source);
1020
- const json = new TextDecoder().decode(client.sealedBoxDecrypt(data.sealed, pair.secretKey));
1021
- return JSON.parse(json);
1022
- }
1023
- async function storeSavedSignature(client$1, signature, source) {
1024
- const pair = await keypair(source);
1025
- const sealed = client.sealedBoxEncrypt(
1026
- Uint8Array.from(new TextEncoder().encode(JSON.stringify(signature))),
1027
- pair.publicKey
1028
- );
1029
- const { error, response } = await client$1.PUT("/v1/user/signature", { body: { sealed } });
1030
- if (!response.ok) throw new Error(detail2(error, "Your signature could not be saved"));
1031
- }
1032
- async function deleteSavedSignature(client) {
1033
- const { error, response } = await client.DELETE("/v1/user/signature");
1034
- if (!response.ok) throw new Error(detail2(error, "Your saved signature could not be deleted"));
1035
- }
1036
- function useSavedSignature(enabled = true) {
1037
- const { client } = chunk3QK4VVPG_cjs.useDocumentTools();
1038
- return reactQuery.useQuery({
1039
- queryKey: chunkG76ASVVH_cjs.arbiQueryKeys.savedSignature(),
1040
- queryFn: () => fetchSavedSignature(client),
1041
- enabled,
1042
- staleTime: 6e4,
1043
- retry: false
1044
- });
1045
- }
1046
- function useStoreSavedSignature() {
1047
- const { client } = chunk3QK4VVPG_cjs.useDocumentTools();
1048
- const queryClient = reactQuery.useQueryClient();
1049
- return reactQuery.useMutation({
1050
- mutationFn: (signature) => storeSavedSignature(client, signature),
1051
- onSuccess: (_, signature) => queryClient.setQueryData(chunkG76ASVVH_cjs.arbiQueryKeys.savedSignature(), signature)
1052
- });
1053
- }
1054
- function useDeleteSavedSignature() {
1055
- const { client } = chunk3QK4VVPG_cjs.useDocumentTools();
1056
- const queryClient = reactQuery.useQueryClient();
1057
- return reactQuery.useMutation({
1058
- mutationFn: () => deleteSavedSignature(client),
1059
- onSuccess: () => queryClient.setQueryData(chunkG76ASVVH_cjs.arbiQueryKeys.savedSignature(), null)
1060
- });
1061
- }
1062
- function pngBytes(base64) {
1063
- const raw = atob(base64);
1064
- const out = new Uint8Array(raw.length);
1065
- for (let i = 0; i < raw.length; i++) out[i] = raw.charCodeAt(i);
1066
- return out;
1067
- }
1068
- function pngSize(base64) {
1069
- const bytes = pngBytes(base64.slice(0, 64));
1070
- const view = new DataView(bytes.buffer);
1071
- return { width: view.getUint32(16), height: view.getUint32(20) };
1072
- }
1073
- function failure(error) {
1074
- const detail3 = error?.detail;
1075
- return new Error(typeof detail3 === "string" ? detail3 : "The shared file request failed");
1076
- }
1077
- async function createFileShare(client, documentId, body) {
1078
- const result = await client.POST("/v1/document/{document_ext_id}/file-shares", {
1079
- params: { path: { document_ext_id: documentId } },
1080
- body
1081
- });
1082
- if (!result.data) throw failure(result.error);
1083
- return result.data;
1084
- }
1085
- async function getFileShare(client, id) {
1086
- const result = await client.GET("/v1/file-shares/{share_id}", {
1087
- params: { path: { share_id: id } }
1088
- });
1089
- if (!result.data) throw failure(result.error);
1090
- return result.data;
1091
- }
1092
- async function fileShareBytes(client, id, kind) {
1093
- const result = await client.GET("/v1/file-shares/{share_id}/file", {
1094
- params: { path: { share_id: id }, query: { kind } },
1095
- parseAs: "blob"
1096
- });
1097
- if (!result.data) throw failure(result.error);
1098
- return result.data;
1099
- }
1100
- function fileShareSigningRequest(share) {
1101
- return {
1102
- external_id: share.external_id,
1103
- doc_ext_id: share.document_ext_id,
1104
- version: share.version,
1105
- source_sha256: share.source_sha256,
1106
- fields: share.fields,
1107
- message: share.message,
1108
- status: share.status === "signing" ? "sent" : share.status === "completed" ? "completed" : "voided",
1109
- signers: share.recipients.filter((r) => r.permission === "sign").map((r) => ({
1110
- external_id: r.email,
1111
- email: r.email,
1112
- name: r.email,
1113
- status: r.status === "signed" ? "signed" : "pending",
1114
- progress: r.status === "signed" ? "signed" : "registered",
1115
- fields: share.fields.filter((f) => f.signer === r.email).length
1116
- })),
1117
- created_at: (/* @__PURE__ */ new Date(0)).toISOString(),
1118
- stale: false
1119
- };
1120
- }
1121
- async function signFileShare(client$1, domain, vars) {
1122
- const path = { share_id: vars.request.external_id };
1123
- const body = { adopted: vars.adopted, fields: vars.fields };
1124
- const prepared = await client$1.POST("/v1/file-shares/{share_id}/sign/prepare", {
1125
- params: { path },
1126
- body
1127
- });
1128
- if (!prepared.data) throw failure(prepared.error);
1129
- const { statement, timestamp, source_sha256, intent } = prepared.data;
1130
- if (source_sha256 !== vars.request.source_sha256 || await sha256Hex(vars.pdfBlob) !== source_sha256)
1131
- throw new Error("The shared file changed. Ask the sender for a new request.");
1132
- if (intent !== intentText({ name: vars.adopted.name }))
1133
- throw new Error("Signing statement mismatch");
1134
- const identity = await client.unlockIdentityWithPassword(vars.email, vars.password, domain);
1135
- const result = await client$1.POST("/v1/file-shares/{share_id}/sign", {
1136
- params: { path },
1137
- body: { ...body, timestamp, signature: client.signMessage(statement, identity) }
1138
- });
1139
- if (!result.data) throw failure(result.error);
1140
- return {
1141
- request: fileShareSigningRequest(result.data),
1142
- completed: result.data.status === "completed"
1143
- };
1144
- }
1145
- function useFileShare(client, shareId, signing) {
1146
- return reactQuery.useQuery({
1147
- queryKey: chunkG76ASVVH_cjs.arbiQueryKeys.fileShare(shareId),
1148
- queryFn: () => getFileShare(client, shareId),
1149
- refetchInterval: signing ? false : 5e3
1150
- });
1151
- }
1152
- function useFileSharePdf(client, shareId, share) {
1153
- return reactQuery.useQuery({
1154
- queryKey: chunkG76ASVVH_cjs.arbiQueryKeys.fileSharePdf(shareId, share?.status),
1155
- queryFn: () => fileShareBytes(client, shareId, share?.status === "completed" ? "signed" : "view"),
1156
- enabled: !!share?.can_preview,
1157
- staleTime: Infinity
1158
- });
1159
- }
1160
- function useFileShares(client) {
1161
- return reactQuery.useQuery({
1162
- queryKey: chunkG76ASVVH_cjs.arbiQueryKeys.fileShares(),
1163
- queryFn: async () => {
1164
- const result = await client.GET("/v1/file-shares");
1165
- if (!result.data) throw new Error("Could not load shared files");
1166
- return result.data;
1167
- }
1168
- });
1169
- }
1170
-
151
+ Object.defineProperty(exports, "DEFAULT_FIELD_SIZE", {
152
+ enumerable: true,
153
+ get: function () { return chunkGOJHU7RZ_cjs.DEFAULT_FIELD_SIZE; }
154
+ });
155
+ Object.defineProperty(exports, "FIELD_TYPE_LABELS", {
156
+ enumerable: true,
157
+ get: function () { return chunkGOJHU7RZ_cjs.FIELD_TYPE_LABELS; }
158
+ });
159
+ Object.defineProperty(exports, "INFORMAL_SIGNATURE_NOTE", {
160
+ enumerable: true,
161
+ get: function () { return chunkGOJHU7RZ_cjs.INFORMAL_SIGNATURE_NOTE; }
162
+ });
163
+ Object.defineProperty(exports, "LEGACY_LAYER_PREFIX", {
164
+ enumerable: true,
165
+ get: function () { return chunkGOJHU7RZ_cjs.LEGACY_LAYER_PREFIX; }
166
+ });
167
+ Object.defineProperty(exports, "MARK_FIELD_TYPES", {
168
+ enumerable: true,
169
+ get: function () { return chunkGOJHU7RZ_cjs.MARK_FIELD_TYPES; }
170
+ });
171
+ Object.defineProperty(exports, "MAX_MERGE_ATTEMPTS", {
172
+ enumerable: true,
173
+ get: function () { return chunkGOJHU7RZ_cjs.MAX_MERGE_ATTEMPTS; }
174
+ });
175
+ Object.defineProperty(exports, "MarkupStoreError", {
176
+ enumerable: true,
177
+ get: function () { return chunkGOJHU7RZ_cjs.MarkupStoreError; }
178
+ });
179
+ Object.defineProperty(exports, "SIGNATURE_FIELD_TYPES", {
180
+ enumerable: true,
181
+ get: function () { return chunkGOJHU7RZ_cjs.SIGNATURE_FIELD_TYPES; }
182
+ });
183
+ Object.defineProperty(exports, "SIGNED_UNCHANGED", {
184
+ enumerable: true,
185
+ get: function () { return chunkGOJHU7RZ_cjs.SIGNED_UNCHANGED; }
186
+ });
187
+ Object.defineProperty(exports, "SIGNER_PROGRESS_LABELS", {
188
+ enumerable: true,
189
+ get: function () { return chunkGOJHU7RZ_cjs.SIGNER_PROGRESS_LABELS; }
190
+ });
191
+ Object.defineProperty(exports, "SignatureVerificationError", {
192
+ enumerable: true,
193
+ get: function () { return chunkGOJHU7RZ_cjs.SignatureVerificationError; }
194
+ });
195
+ Object.defineProperty(exports, "SigningError", {
196
+ enumerable: true,
197
+ get: function () { return chunkGOJHU7RZ_cjs.SigningError; }
198
+ });
199
+ Object.defineProperty(exports, "VERIFY_PATH", {
200
+ enumerable: true,
201
+ get: function () { return chunkGOJHU7RZ_cjs.VERIFY_PATH; }
202
+ });
203
+ Object.defineProperty(exports, "addToMarkup", {
204
+ enumerable: true,
205
+ get: function () { return chunkGOJHU7RZ_cjs.addToMarkup; }
206
+ });
207
+ Object.defineProperty(exports, "canAnnotate", {
208
+ enumerable: true,
209
+ get: function () { return chunkGOJHU7RZ_cjs.canAnnotate; }
210
+ });
211
+ Object.defineProperty(exports, "copyOpenThreads", {
212
+ enumerable: true,
213
+ get: function () { return chunkGOJHU7RZ_cjs.copyOpenThreads; }
214
+ });
215
+ Object.defineProperty(exports, "createFileShare", {
216
+ enumerable: true,
217
+ get: function () { return chunkGOJHU7RZ_cjs.createFileShare; }
218
+ });
219
+ Object.defineProperty(exports, "createMarkupStore", {
220
+ enumerable: true,
221
+ get: function () { return chunkGOJHU7RZ_cjs.createMarkupStore; }
222
+ });
223
+ Object.defineProperty(exports, "deleteSavedSignature", {
224
+ enumerable: true,
225
+ get: function () { return chunkGOJHU7RZ_cjs.deleteSavedSignature; }
226
+ });
227
+ Object.defineProperty(exports, "fetchDocumentSignatureRequests", {
228
+ enumerable: true,
229
+ get: function () { return chunkGOJHU7RZ_cjs.fetchDocumentSignatureRequests; }
230
+ });
231
+ Object.defineProperty(exports, "fetchDocumentSignatures", {
232
+ enumerable: true,
233
+ get: function () { return chunkGOJHU7RZ_cjs.fetchDocumentSignatures; }
234
+ });
235
+ Object.defineProperty(exports, "fetchSavedSignature", {
236
+ enumerable: true,
237
+ get: function () { return chunkGOJHU7RZ_cjs.fetchSavedSignature; }
238
+ });
239
+ Object.defineProperty(exports, "fetchSignatureVerification", {
240
+ enumerable: true,
241
+ get: function () { return chunkGOJHU7RZ_cjs.fetchSignatureVerification; }
242
+ });
243
+ Object.defineProperty(exports, "fieldsFromSuggestions", {
244
+ enumerable: true,
245
+ get: function () { return chunkGOJHU7RZ_cjs.fieldsFromSuggestions; }
246
+ });
247
+ Object.defineProperty(exports, "fieldsInSigningOrder", {
248
+ enumerable: true,
249
+ get: function () { return chunkGOJHU7RZ_cjs.fieldsInSigningOrder; }
250
+ });
251
+ Object.defineProperty(exports, "fileShareBytes", {
252
+ enumerable: true,
253
+ get: function () { return chunkGOJHU7RZ_cjs.fileShareBytes; }
254
+ });
255
+ Object.defineProperty(exports, "fileShareSigningRequest", {
256
+ enumerable: true,
257
+ get: function () { return chunkGOJHU7RZ_cjs.fileShareSigningRequest; }
258
+ });
259
+ Object.defineProperty(exports, "forgetLegacyLayer", {
260
+ enumerable: true,
261
+ get: function () { return chunkGOJHU7RZ_cjs.forgetLegacyLayer; }
262
+ });
263
+ Object.defineProperty(exports, "frozenCopyName", {
264
+ enumerable: true,
265
+ get: function () { return chunkGOJHU7RZ_cjs.frozenCopyName; }
266
+ });
267
+ Object.defineProperty(exports, "getFileShare", {
268
+ enumerable: true,
269
+ get: function () { return chunkGOJHU7RZ_cjs.getFileShare; }
270
+ });
271
+ Object.defineProperty(exports, "initialsOf", {
272
+ enumerable: true,
273
+ get: function () { return chunkGOJHU7RZ_cjs.initialsOf; }
274
+ });
275
+ Object.defineProperty(exports, "intentText", {
276
+ enumerable: true,
277
+ get: function () { return chunkGOJHU7RZ_cjs.intentText; }
278
+ });
279
+ Object.defineProperty(exports, "inviteSigners", {
280
+ enumerable: true,
281
+ get: function () { return chunkGOJHU7RZ_cjs.inviteSigners; }
282
+ });
283
+ Object.defineProperty(exports, "isEmailSigner", {
284
+ enumerable: true,
285
+ get: function () { return chunkGOJHU7RZ_cjs.isEmailSigner; }
286
+ });
287
+ Object.defineProperty(exports, "isLegibleSignatureBox", {
288
+ enumerable: true,
289
+ get: function () { return chunkGOJHU7RZ_cjs.isLegibleSignatureBox; }
290
+ });
291
+ Object.defineProperty(exports, "isSignatureReference", {
292
+ enumerable: true,
293
+ get: function () { return chunkGOJHU7RZ_cjs.isSignatureReference; }
294
+ });
295
+ Object.defineProperty(exports, "marksByVersion", {
296
+ enumerable: true,
297
+ get: function () { return chunkGOJHU7RZ_cjs.marksByVersion; }
298
+ });
299
+ Object.defineProperty(exports, "matchSignedCopy", {
300
+ enumerable: true,
301
+ get: function () { return chunkGOJHU7RZ_cjs.matchSignedCopy; }
302
+ });
303
+ Object.defineProperty(exports, "migrateLegacyLayer", {
304
+ enumerable: true,
305
+ get: function () { return chunkGOJHU7RZ_cjs.migrateLegacyLayer; }
306
+ });
307
+ Object.defineProperty(exports, "newFieldId", {
308
+ enumerable: true,
309
+ get: function () { return chunkGOJHU7RZ_cjs.newFieldId; }
310
+ });
311
+ Object.defineProperty(exports, "openThreadsOf", {
312
+ enumerable: true,
313
+ get: function () { return chunkGOJHU7RZ_cjs.openThreadsOf; }
314
+ });
315
+ Object.defineProperty(exports, "pngBytes", {
316
+ enumerable: true,
317
+ get: function () { return chunkGOJHU7RZ_cjs.pngBytes; }
318
+ });
319
+ Object.defineProperty(exports, "pngSize", {
320
+ enumerable: true,
321
+ get: function () { return chunkGOJHU7RZ_cjs.pngSize; }
322
+ });
323
+ Object.defineProperty(exports, "readLegacyLayer", {
324
+ enumerable: true,
325
+ get: function () { return chunkGOJHU7RZ_cjs.readLegacyLayer; }
326
+ });
327
+ Object.defineProperty(exports, "redactionLogName", {
328
+ enumerable: true,
329
+ get: function () { return chunkGOJHU7RZ_cjs.redactionLogName; }
330
+ });
331
+ Object.defineProperty(exports, "saveSignatureRequest", {
332
+ enumerable: true,
333
+ get: function () { return chunkGOJHU7RZ_cjs.saveSignatureRequest; }
334
+ });
335
+ Object.defineProperty(exports, "sendBlocker", {
336
+ enumerable: true,
337
+ get: function () { return chunkGOJHU7RZ_cjs.sendBlocker; }
338
+ });
339
+ Object.defineProperty(exports, "sha256Hex", {
340
+ enumerable: true,
341
+ get: function () { return chunkGOJHU7RZ_cjs.sha256Hex; }
342
+ });
343
+ Object.defineProperty(exports, "signDocument", {
344
+ enumerable: true,
345
+ get: function () { return chunkGOJHU7RZ_cjs.signDocument; }
346
+ });
347
+ Object.defineProperty(exports, "signFileShare", {
348
+ enumerable: true,
349
+ get: function () { return chunkGOJHU7RZ_cjs.signFileShare; }
350
+ });
351
+ Object.defineProperty(exports, "signSignatureRequest", {
352
+ enumerable: true,
353
+ get: function () { return chunkGOJHU7RZ_cjs.signSignatureRequest; }
354
+ });
355
+ Object.defineProperty(exports, "signatureFieldSuggestions", {
356
+ enumerable: true,
357
+ get: function () { return chunkGOJHU7RZ_cjs.signatureFieldSuggestions; }
358
+ });
359
+ Object.defineProperty(exports, "splitSuggestions", {
360
+ enumerable: true,
361
+ get: function () { return chunkGOJHU7RZ_cjs.splitSuggestions; }
362
+ });
363
+ Object.defineProperty(exports, "storeSavedSignature", {
364
+ enumerable: true,
365
+ get: function () { return chunkGOJHU7RZ_cjs.storeSavedSignature; }
366
+ });
367
+ Object.defineProperty(exports, "suggestSignatureFields", {
368
+ enumerable: true,
369
+ get: function () { return chunkGOJHU7RZ_cjs.suggestSignatureFields; }
370
+ });
371
+ Object.defineProperty(exports, "toAppearance", {
372
+ enumerable: true,
373
+ get: function () { return chunkGOJHU7RZ_cjs.toAppearance; }
374
+ });
375
+ Object.defineProperty(exports, "uploadFrozenCopy", {
376
+ enumerable: true,
377
+ get: function () { return chunkGOJHU7RZ_cjs.uploadFrozenCopy; }
378
+ });
379
+ Object.defineProperty(exports, "useDeclineSignatureRequest", {
380
+ enumerable: true,
381
+ get: function () { return chunkGOJHU7RZ_cjs.useDeclineSignatureRequest; }
382
+ });
383
+ Object.defineProperty(exports, "useDeleteSavedSignature", {
384
+ enumerable: true,
385
+ get: function () { return chunkGOJHU7RZ_cjs.useDeleteSavedSignature; }
386
+ });
387
+ Object.defineProperty(exports, "useDocumentBytes", {
388
+ enumerable: true,
389
+ get: function () { return chunkGOJHU7RZ_cjs.useDocumentBytes; }
390
+ });
391
+ Object.defineProperty(exports, "useDocumentMarkup", {
392
+ enumerable: true,
393
+ get: function () { return chunkGOJHU7RZ_cjs.useDocumentMarkup; }
394
+ });
395
+ Object.defineProperty(exports, "useDocumentSignatureRequests", {
396
+ enumerable: true,
397
+ get: function () { return chunkGOJHU7RZ_cjs.useDocumentSignatureRequests; }
398
+ });
399
+ Object.defineProperty(exports, "useDocumentSignatures", {
400
+ enumerable: true,
401
+ get: function () { return chunkGOJHU7RZ_cjs.useDocumentSignatures; }
402
+ });
403
+ Object.defineProperty(exports, "useFileShare", {
404
+ enumerable: true,
405
+ get: function () { return chunkGOJHU7RZ_cjs.useFileShare; }
406
+ });
407
+ Object.defineProperty(exports, "useFileSharePdf", {
408
+ enumerable: true,
409
+ get: function () { return chunkGOJHU7RZ_cjs.useFileSharePdf; }
410
+ });
411
+ Object.defineProperty(exports, "useFileShares", {
412
+ enumerable: true,
413
+ get: function () { return chunkGOJHU7RZ_cjs.useFileShares; }
414
+ });
415
+ Object.defineProperty(exports, "useInviteSigners", {
416
+ enumerable: true,
417
+ get: function () { return chunkGOJHU7RZ_cjs.useInviteSigners; }
418
+ });
419
+ Object.defineProperty(exports, "useIsOnline", {
420
+ enumerable: true,
421
+ get: function () { return chunkGOJHU7RZ_cjs.useIsOnline; }
422
+ });
423
+ Object.defineProperty(exports, "useSaveSignatureRequest", {
424
+ enumerable: true,
425
+ get: function () { return chunkGOJHU7RZ_cjs.useSaveSignatureRequest; }
426
+ });
427
+ Object.defineProperty(exports, "useSavedSignature", {
428
+ enumerable: true,
429
+ get: function () { return chunkGOJHU7RZ_cjs.useSavedSignature; }
430
+ });
431
+ Object.defineProperty(exports, "useSignDocument", {
432
+ enumerable: true,
433
+ get: function () { return chunkGOJHU7RZ_cjs.useSignDocument; }
434
+ });
435
+ Object.defineProperty(exports, "useSignSignatureRequest", {
436
+ enumerable: true,
437
+ get: function () { return chunkGOJHU7RZ_cjs.useSignSignatureRequest; }
438
+ });
439
+ Object.defineProperty(exports, "useSignatureRequest", {
440
+ enumerable: true,
441
+ get: function () { return chunkGOJHU7RZ_cjs.useSignatureRequest; }
442
+ });
443
+ Object.defineProperty(exports, "useSignatureRequestsAwaitingMe", {
444
+ enumerable: true,
445
+ get: function () { return chunkGOJHU7RZ_cjs.useSignatureRequestsAwaitingMe; }
446
+ });
447
+ Object.defineProperty(exports, "useSignatureVerification", {
448
+ enumerable: true,
449
+ get: function () { return chunkGOJHU7RZ_cjs.useSignatureVerification; }
450
+ });
451
+ Object.defineProperty(exports, "useSignerCandidates", {
452
+ enumerable: true,
453
+ get: function () { return chunkGOJHU7RZ_cjs.useSignerCandidates; }
454
+ });
455
+ Object.defineProperty(exports, "useStoreSavedSignature", {
456
+ enumerable: true,
457
+ get: function () { return chunkGOJHU7RZ_cjs.useStoreSavedSignature; }
458
+ });
459
+ Object.defineProperty(exports, "useVoidSignatureRequest", {
460
+ enumerable: true,
461
+ get: function () { return chunkGOJHU7RZ_cjs.useVoidSignatureRequest; }
462
+ });
463
+ Object.defineProperty(exports, "versionsWithMarkup", {
464
+ enumerable: true,
465
+ get: function () { return chunkGOJHU7RZ_cjs.versionsWithMarkup; }
466
+ });
1171
467
  Object.defineProperty(exports, "DocumentFetchError", {
1172
468
  enumerable: true,
1173
- get: function () { return chunk3QK4VVPG_cjs.DocumentFetchError; }
469
+ get: function () { return chunkTGSEQGM3_cjs.DocumentFetchError; }
1174
470
  });
1175
471
  Object.defineProperty(exports, "DocumentToolsProvider", {
1176
472
  enumerable: true,
1177
- get: function () { return chunk3QK4VVPG_cjs.DocumentToolsProvider; }
473
+ get: function () { return chunkTGSEQGM3_cjs.DocumentToolsProvider; }
1178
474
  });
1179
475
  Object.defineProperty(exports, "MarkupDownloadError", {
1180
476
  enumerable: true,
1181
- get: function () { return chunk3QK4VVPG_cjs.MarkupDownloadError; }
477
+ get: function () { return chunkTGSEQGM3_cjs.MarkupDownloadError; }
1182
478
  });
1183
479
  Object.defineProperty(exports, "SIGNED_LOCKED_REASON", {
1184
480
  enumerable: true,
1185
- get: function () { return chunk3QK4VVPG_cjs.SIGNED_LOCKED_REASON; }
481
+ get: function () { return chunkTGSEQGM3_cjs.SIGNED_LOCKED_REASON; }
1186
482
  });
1187
483
  Object.defineProperty(exports, "certificateLink", {
1188
484
  enumerable: true,
1189
- get: function () { return chunk3QK4VVPG_cjs.certificateLink; }
485
+ get: function () { return chunkTGSEQGM3_cjs.certificateLink; }
1190
486
  });
1191
487
  Object.defineProperty(exports, "clientUpload", {
1192
488
  enumerable: true,
1193
- get: function () { return chunk3QK4VVPG_cjs.clientUpload; }
489
+ get: function () { return chunkTGSEQGM3_cjs.clientUpload; }
1194
490
  });
1195
491
  Object.defineProperty(exports, "contentDispositionFileName", {
1196
492
  enumerable: true,
1197
- get: function () { return chunk3QK4VVPG_cjs.contentDispositionFileName; }
493
+ get: function () { return chunkTGSEQGM3_cjs.contentDispositionFileName; }
1198
494
  });
1199
495
  Object.defineProperty(exports, "currentHasMarkup", {
1200
496
  enumerable: true,
1201
- get: function () { return chunk3QK4VVPG_cjs.currentHasMarkup; }
497
+ get: function () { return chunkTGSEQGM3_cjs.currentHasMarkup; }
1202
498
  });
1203
499
  Object.defineProperty(exports, "defaultCertificateUrl", {
1204
500
  enumerable: true,
1205
- get: function () { return chunk3QK4VVPG_cjs.defaultCertificateUrl; }
501
+ get: function () { return chunkTGSEQGM3_cjs.defaultCertificateUrl; }
1206
502
  });
1207
503
  Object.defineProperty(exports, "downloadBlob", {
1208
504
  enumerable: true,
1209
- get: function () { return chunk3QK4VVPG_cjs.downloadBlob; }
505
+ get: function () { return chunkTGSEQGM3_cjs.downloadBlob; }
1210
506
  });
1211
507
  Object.defineProperty(exports, "fetchDocumentFile", {
1212
508
  enumerable: true,
1213
- get: function () { return chunk3QK4VVPG_cjs.fetchDocumentFile; }
509
+ get: function () { return chunkTGSEQGM3_cjs.fetchDocumentFile; }
1214
510
  });
1215
511
  Object.defineProperty(exports, "fetchDocumentPdf", {
1216
512
  enumerable: true,
1217
- get: function () { return chunk3QK4VVPG_cjs.fetchDocumentPdf; }
513
+ get: function () { return chunkTGSEQGM3_cjs.fetchDocumentPdf; }
1218
514
  });
1219
515
  Object.defineProperty(exports, "fetchMarkupPdf", {
1220
516
  enumerable: true,
1221
- get: function () { return chunk3QK4VVPG_cjs.fetchMarkupPdf; }
517
+ get: function () { return chunkTGSEQGM3_cjs.fetchMarkupPdf; }
1222
518
  });
1223
519
  Object.defineProperty(exports, "isSignedVersion", {
1224
520
  enumerable: true,
1225
- get: function () { return chunk3QK4VVPG_cjs.isSignedVersion; }
521
+ get: function () { return chunkTGSEQGM3_cjs.isSignedVersion; }
1226
522
  });
1227
523
  Object.defineProperty(exports, "uploadQueryString", {
1228
524
  enumerable: true,
1229
- get: function () { return chunk3QK4VVPG_cjs.uploadQueryString; }
525
+ get: function () { return chunkTGSEQGM3_cjs.uploadQueryString; }
1230
526
  });
1231
527
  Object.defineProperty(exports, "useDocumentTools", {
1232
528
  enumerable: true,
1233
- get: function () { return chunk3QK4VVPG_cjs.useDocumentTools; }
529
+ get: function () { return chunkTGSEQGM3_cjs.useDocumentTools; }
1234
530
  });
1235
531
  Object.defineProperty(exports, "useOptionalDocumentTools", {
1236
532
  enumerable: true,
1237
- get: function () { return chunk3QK4VVPG_cjs.useOptionalDocumentTools; }
533
+ get: function () { return chunkTGSEQGM3_cjs.useOptionalDocumentTools; }
1238
534
  });
1239
535
  Object.defineProperty(exports, "documentBytesKey", {
1240
536
  enumerable: true,
1241
- get: function () { return chunkG76ASVVH_cjs.documentBytesKey; }
537
+ get: function () { return chunkGQAXAZN7_cjs.documentBytesKey; }
1242
538
  });
1243
- exports.DEFAULT_FIELD_SIZE = DEFAULT_FIELD_SIZE;
1244
- exports.FIELD_TYPE_LABELS = FIELD_TYPE_LABELS;
1245
- exports.INFORMAL_SIGNATURE_NOTE = INFORMAL_SIGNATURE_NOTE;
1246
- exports.LEGACY_LAYER_PREFIX = LEGACY_LAYER_PREFIX;
1247
- exports.MARK_FIELD_TYPES = MARK_FIELD_TYPES;
1248
- exports.MAX_MERGE_ATTEMPTS = MAX_MERGE_ATTEMPTS;
1249
- exports.MarkupStoreError = MarkupStoreError;
1250
539
  exports.PRODUCTIONS_FOLDER = PRODUCTIONS_FOLDER;
1251
- exports.SIGNATURE_FIELD_TYPES = SIGNATURE_FIELD_TYPES;
1252
- exports.SIGNED_UNCHANGED = SIGNED_UNCHANGED;
1253
- exports.SIGNER_PROGRESS_LABELS = SIGNER_PROGRESS_LABELS;
1254
- exports.SignatureVerificationError = SignatureVerificationError;
1255
- exports.SigningError = SigningError;
1256
- exports.VERIFY_PATH = VERIFY_PATH;
1257
- exports.addToMarkup = addToMarkup;
1258
540
  exports.buildProduction = buildProduction;
1259
- exports.canAnnotate = canAnnotate;
1260
- exports.copyOpenThreads = copyOpenThreads;
1261
- exports.createFileShare = createFileShare;
1262
- exports.createMarkupStore = createMarkupStore;
1263
- exports.deleteSavedSignature = deleteSavedSignature;
1264
- exports.fetchDocumentSignatureRequests = fetchDocumentSignatureRequests;
1265
- exports.fetchDocumentSignatures = fetchDocumentSignatures;
1266
541
  exports.fetchProductionPdf = fetchProductionPdf;
1267
- exports.fetchSavedSignature = fetchSavedSignature;
1268
- exports.fetchSignatureVerification = fetchSignatureVerification;
1269
- exports.fieldsFromSuggestions = fieldsFromSuggestions;
1270
- exports.fieldsInSigningOrder = fieldsInSigningOrder;
1271
- exports.fileShareBytes = fileShareBytes;
1272
- exports.fileShareSigningRequest = fileShareSigningRequest;
1273
- exports.forgetLegacyLayer = forgetLegacyLayer;
1274
- exports.frozenCopyName = frozenCopyName;
1275
- exports.getFileShare = getFileShare;
1276
542
  exports.hasNoRendition = hasNoRendition;
1277
- exports.initialsOf = initialsOf;
1278
- exports.intentText = intentText;
1279
- exports.inviteSigners = inviteSigners;
1280
- exports.isEmailSigner = isEmailSigner;
1281
- exports.isLegibleSignatureBox = isLegibleSignatureBox;
1282
543
  exports.isPdfDocument = isPdfDocument;
1283
- exports.isSignatureReference = isSignatureReference;
1284
- exports.marksByVersion = marksByVersion;
1285
- exports.matchSignedCopy = matchSignedCopy;
1286
- exports.migrateLegacyLayer = migrateLegacyLayer;
1287
- exports.newFieldId = newFieldId;
1288
- exports.openThreadsOf = openThreadsOf;
1289
- exports.pngBytes = pngBytes;
1290
- exports.pngSize = pngSize;
1291
544
  exports.productionDocumentName = productionDocumentName;
1292
545
  exports.productionFileName = productionFileName;
1293
546
  exports.productionFolder = productionFolder;
1294
547
  exports.productionIndexCsv = productionIndexCsv;
1295
548
  exports.productionTitle = productionTitle;
1296
- exports.readLegacyLayer = readLegacyLayer;
1297
- exports.redactionLogName = redactionLogName;
1298
549
  exports.saveProductionFiles = saveProductionFiles;
1299
- exports.saveSignatureRequest = saveSignatureRequest;
1300
- exports.sendBlocker = sendBlocker;
1301
- exports.sha256Hex = sha256Hex;
1302
- exports.signDocument = signDocument;
1303
- exports.signFileShare = signFileShare;
1304
- exports.signSignatureRequest = signSignatureRequest;
1305
- exports.signatureFieldSuggestions = signatureFieldSuggestions;
1306
- exports.splitSuggestions = splitSuggestions;
1307
- exports.storeSavedSignature = storeSavedSignature;
1308
- exports.suggestSignatureFields = suggestSignatureFields;
1309
- exports.toAppearance = toAppearance;
1310
- exports.uploadFrozenCopy = uploadFrozenCopy;
1311
- exports.useDeclineSignatureRequest = useDeclineSignatureRequest;
1312
- exports.useDeleteSavedSignature = useDeleteSavedSignature;
1313
- exports.useDocumentBytes = useDocumentBytes;
1314
- exports.useDocumentMarkup = useDocumentMarkup;
1315
- exports.useDocumentSignatureRequests = useDocumentSignatureRequests;
1316
- exports.useDocumentSignatures = useDocumentSignatures;
1317
- exports.useFileShare = useFileShare;
1318
- exports.useFileSharePdf = useFileSharePdf;
1319
- exports.useFileShares = useFileShares;
1320
- exports.useInviteSigners = useInviteSigners;
1321
- exports.useIsOnline = useIsOnline;
1322
- exports.useSaveSignatureRequest = useSaveSignatureRequest;
1323
- exports.useSavedSignature = useSavedSignature;
1324
- exports.useSignDocument = useSignDocument;
1325
- exports.useSignSignatureRequest = useSignSignatureRequest;
1326
- exports.useSignatureRequest = useSignatureRequest;
1327
- exports.useSignatureRequestsAwaitingMe = useSignatureRequestsAwaitingMe;
1328
- exports.useSignatureVerification = useSignatureVerification;
1329
- exports.useSignerCandidates = useSignerCandidates;
1330
- exports.useStoreSavedSignature = useStoreSavedSignature;
1331
- exports.useVoidSignatureRequest = useVoidSignatureRequest;
1332
- exports.versionsWithMarkup = versionsWithMarkup;
1333
550
  //# sourceMappingURL=index.cjs.map
1334
551
  //# sourceMappingURL=index.cjs.map