@rhc-office/sdk 6.6.259 → 6.6.266

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 (48) hide show
  1. package/README.md +44 -5
  2. package/dist/api/callbacks.d.ts +0 -1
  3. package/dist/api/callbacks.d.ts.map +1 -1
  4. package/dist/api/crypto-tool.d.ts +12 -1
  5. package/dist/api/crypto-tool.d.ts.map +1 -1
  6. package/dist/api/document-sdk.d.ts +0 -10
  7. package/dist/api/document-sdk.d.ts.map +1 -1
  8. package/dist/api/sign-tool.d.ts +43 -1
  9. package/dist/api/sign-tool.d.ts.map +1 -1
  10. package/dist/browser/document-viewer.js +2 -0
  11. package/dist/browser/document-viewer.js.map +1 -0
  12. package/dist/browser.d.ts +33 -0
  13. package/dist/browser.d.ts.map +1 -0
  14. package/dist/index.d.ts +0 -3
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +119 -148
  17. package/dist/index.js.map +1 -1
  18. package/dist/index.umd.cjs +1 -1
  19. package/dist/index.umd.cjs.map +1 -1
  20. package/dist/viewer/DocumentSDK.d.ts +0 -7
  21. package/dist/viewer/DocumentSDK.d.ts.map +1 -1
  22. package/dist/viewer/ReaderConfiguration.d.ts +1 -1
  23. package/dist/viewer/ReaderConfiguration.d.ts.map +1 -1
  24. package/dist/viewer/ReaderStateStore.d.ts +0 -1
  25. package/dist/viewer/ReaderStateStore.d.ts.map +1 -1
  26. package/dist/viewer/SdkCallbackRegistry.d.ts +1 -2
  27. package/dist/viewer/SdkCallbackRegistry.d.ts.map +1 -1
  28. package/package.json +12 -2
  29. package/src/api/callbacks.ts +4 -17
  30. package/src/api/crypto-tool.ts +13 -1
  31. package/src/api/document-sdk.ts +0 -13
  32. package/src/api/sign-tool.ts +62 -1
  33. package/src/browser.ts +85 -0
  34. package/src/index.ts +0 -3
  35. package/src/viewer/DocumentSDK.ts +2 -45
  36. package/src/viewer/ReaderBridgeClient.ts +1 -1
  37. package/src/viewer/ReaderConfiguration.ts +2 -2
  38. package/src/viewer/ReaderStateStore.ts +0 -2
  39. package/src/viewer/SdkCallbackRegistry.ts +0 -9
  40. package/dist/api/ekey-tool.d.ts +0 -8
  41. package/dist/api/ekey-tool.d.ts.map +0 -1
  42. package/dist/api/extension-tool.d.ts +0 -5
  43. package/dist/api/extension-tool.d.ts.map +0 -1
  44. package/dist/api/review-tool.d.ts +0 -71
  45. package/dist/api/review-tool.d.ts.map +0 -1
  46. package/src/api/ekey-tool.ts +0 -11
  47. package/src/api/extension-tool.ts +0 -5
  48. package/src/api/review-tool.ts +0 -105
package/dist/index.js CHANGED
@@ -74,10 +74,10 @@ const w = "RIGHT_CENTER", _ = "REGULAR_ESM", F = "auto", b = "__RHC_OFFICE_DIGIT
74
74
  checkCertificateBinding: n.usbKey.checkCertificateBinding,
75
75
  usbKeyType: n.usbKey.usbKeyType
76
76
  }
77
- }), m = (n) => ({
77
+ }), h = (n) => ({
78
78
  defaults: O(n.defaults),
79
79
  signServer: L(n.signServer)
80
- }), N = (n) => ({
80
+ }), U = (n) => ({
81
81
  defaults: n.defaults ? {
82
82
  ...n.defaults,
83
83
  bjca: n.defaults.bjca ? { ...n.defaults.bjca } : void 0,
@@ -125,7 +125,7 @@ const w = "RIGHT_CENTER", _ = "REGULAR_ESM", F = "auto", b = "__RHC_OFFICE_DIGIT
125
125
  checkCertificateBinding: t.usbKey?.checkCertificateBinding ?? n.usbKey.checkCertificateBinding,
126
126
  usbKeyType: t.usbKey?.usbKeyType ?? n.usbKey.usbKeyType
127
127
  }
128
- } : L(n), U = (n, t) => ({
128
+ } : L(n), N = (n, t) => ({
129
129
  defaults: G(n.defaults, t.defaults),
130
130
  signServer: H(n.signServer, t.signServer)
131
131
  }), q = (n, t) => ({
@@ -160,22 +160,22 @@ const w = "RIGHT_CENTER", _ = "REGULAR_ESM", F = "auto", b = "__RHC_OFFICE_DIGIT
160
160
  }), Q = () => globalThis, k = () => {
161
161
  const n = Q();
162
162
  return n[b] || (n[b] = {
163
- current: m(y),
164
- defaults: m(y),
163
+ current: h(y),
164
+ defaults: h(y),
165
165
  overrides: {}
166
166
  }), n[b];
167
- }, Ue = () => k().current, xe = (n) => {
167
+ }, Ne = () => k().current, Ve = (n) => {
168
168
  const t = k();
169
- return t.defaults = m(n), t.current = U(t.defaults, t.overrides), t.current;
170
- }, Ve = (n) => {
171
- const t = k();
172
- return t.current = m(n), t.overrides = N(n), t.current;
169
+ return t.defaults = h(n), t.current = N(t.defaults, t.overrides), t.current;
173
170
  }, Be = (n) => {
174
171
  const t = k();
175
- return t.overrides = q(t.overrides, N(n)), t.current = U(t.current, n), t.current;
172
+ return t.current = h(n), t.overrides = U(n), t.current;
173
+ }, xe = (n) => {
174
+ const t = k();
175
+ return t.overrides = q(t.overrides, U(n)), t.current = N(t.current, n), t.current;
176
176
  }, Ke = (n) => {
177
177
  const t = k();
178
- return n && (t.defaults = m(n)), t.overrides = {}, t.current = m(t.defaults), t.current;
178
+ return n && (t.defaults = h(n)), t.overrides = {}, t.current = h(t.defaults), t.current;
179
179
  }, Ge = {
180
180
  EDGE_POSITION: w,
181
181
  RSA_MODE: F,
@@ -191,40 +191,40 @@ const w = "RIGHT_CENTER", _ = "REGULAR_ESM", F = "auto", b = "__RHC_OFFICE_DIGIT
191
191
  return;
192
192
  if (typeof r == "symbol")
193
193
  return r === Symbol.toStringTag ? n : void 0;
194
- const o = t[r];
195
- return o ? (...a) => {
196
- if (o.kind === "callbackRegister") {
197
- o.callback?.(e.callbacks, a);
194
+ const a = t[r];
195
+ return a ? (...o) => {
196
+ if (a.kind === "callbackRegister") {
197
+ a.callback?.(e.callbacks, o);
198
198
  return;
199
199
  }
200
- if (o.kind === "stateGetter")
201
- return o.state?.(e.state.snapshot(), a);
202
- const s = o.adapterMethod ?? r;
203
- if (o.kind === "query")
204
- return e.bridge.request(n, s, T(a));
205
- if (o.kind === "callbackQuery") {
206
- const l = a.find((d) => typeof d == "function"), p = a.filter((d) => typeof d != "function");
207
- e.bridge.request(n, s, T(p)).then((d) => {
208
- const f = o.mapCallbackResult?.(d) ?? [d];
200
+ if (a.kind === "stateGetter")
201
+ return a.state?.(e.state.snapshot(), o);
202
+ const s = a.adapterMethod ?? r;
203
+ if (a.kind === "query")
204
+ return e.bridge.request(n, s, T(o));
205
+ if (a.kind === "callbackQuery") {
206
+ const l = o.find((d) => typeof d == "function"), m = o.filter((d) => typeof d != "function");
207
+ e.bridge.request(n, s, T(m)).then((d) => {
208
+ const f = a.mapCallbackResult?.(d) ?? [d];
209
209
  l?.(...f);
210
210
  }).catch(e.onAsyncError);
211
211
  return;
212
212
  }
213
- e.bridge.request(n, s, T(a)).catch(e.onAsyncError);
214
- } : (...a) => {
213
+ e.bridge.request(n, s, T(o)).catch(e.onAsyncError);
214
+ } : (...o) => {
215
215
  const s = new Error(`${n}.${r} is not implemented by the SDK adapter.`);
216
216
  e.onAsyncError(s);
217
217
  };
218
218
  }
219
219
  }
220
- ), u = (n, t) => new Proxy(
220
+ ), p = (n, t) => new Proxy(
221
221
  {},
222
222
  {
223
223
  get: (e, i) => {
224
224
  if (i !== "then" && typeof i != "symbol")
225
225
  return (...r) => {
226
- const o = `${n}.${i} is not implemented by the SDK adapter.`;
227
- t.onAsyncError(new Error(o));
226
+ const a = `${n}.${i} is not implemented by the SDK adapter.`;
227
+ t.onAsyncError(new Error(a));
228
228
  };
229
229
  }
230
230
  }
@@ -365,7 +365,7 @@ const J = (n) => ({
365
365
  });
366
366
  class Z {
367
367
  constructor(t) {
368
- this.addPageChangeCallback = (e) => this.adapter.addPageChangeCallback(e), this.addPageModeChangeCallback = (e) => this.adapter.addPageModeChangeCallback(e), this.getPageCount = (e) => this.adapter.getPageCount(e), this.getPageIndex = (e) => this.adapter.getPageIndex(e), this.setSinglePageViewMode = () => this.adapter.setSinglePageViewMode(), this.setTwoPagesViewMode = () => this.adapter.setTwoPagesViewMode(), this.setPageScrollVertical = () => this.adapter.setPageScrollVertical(), this.setPageScrollHorizontal = () => this.adapter.setPageScrollHorizontal(), this.setPageCursorPanDrag = () => this.adapter.setPageCursorPanDrag(), this.setPageCursorTextSelect = () => this.adapter.setPageCursorTextSelect(), this.rotateCW = () => this.adapter.rotateCW(), this.rotateCCW = () => this.adapter.rotateCCW(), this.autoFitPage = () => this.adapter.autoFitPage(), this.fitPageSize = () => this.adapter.fitPageSize(), this.fitPageWidth = () => this.adapter.fitPageWidth(), this.fitPageHeight = () => this.adapter.fitPageHeight(), this.increasePageScale = () => this.adapter.increasePageScale(), this.decreasePageScale = () => this.adapter.decreasePageScale(), this.setPageScale = (e) => this.adapter.setPageScale(e), this.setPageBlendColor = (e, i, r, o) => this.adapter.setPageBlendColor(e, i, r, o), this.gotoPage = (e, i, r) => this.adapter.gotoPage(e, i, r), this.gotoNextPage = () => this.adapter.gotoNextPage(), this.gotoPreviousPage = () => this.adapter.gotoPreviousPage(), this.rotatePage = (e) => this.adapter.rotatePage(e), this.adapter = c(
368
+ this.addPageChangeCallback = (e) => this.adapter.addPageChangeCallback(e), this.addPageModeChangeCallback = (e) => this.adapter.addPageModeChangeCallback(e), this.getPageCount = (e) => this.adapter.getPageCount(e), this.getPageIndex = (e) => this.adapter.getPageIndex(e), this.setSinglePageViewMode = () => this.adapter.setSinglePageViewMode(), this.setTwoPagesViewMode = () => this.adapter.setTwoPagesViewMode(), this.setPageScrollVertical = () => this.adapter.setPageScrollVertical(), this.setPageScrollHorizontal = () => this.adapter.setPageScrollHorizontal(), this.setPageCursorPanDrag = () => this.adapter.setPageCursorPanDrag(), this.setPageCursorTextSelect = () => this.adapter.setPageCursorTextSelect(), this.rotateCW = () => this.adapter.rotateCW(), this.rotateCCW = () => this.adapter.rotateCCW(), this.autoFitPage = () => this.adapter.autoFitPage(), this.fitPageSize = () => this.adapter.fitPageSize(), this.fitPageWidth = () => this.adapter.fitPageWidth(), this.fitPageHeight = () => this.adapter.fitPageHeight(), this.increasePageScale = () => this.adapter.increasePageScale(), this.decreasePageScale = () => this.adapter.decreasePageScale(), this.setPageScale = (e) => this.adapter.setPageScale(e), this.setPageBlendColor = (e, i, r, a) => this.adapter.setPageBlendColor(e, i, r, a), this.gotoPage = (e, i, r) => this.adapter.gotoPage(e, i, r), this.gotoNextPage = () => this.adapter.gotoNextPage(), this.gotoPreviousPage = () => this.adapter.gotoPreviousPage(), this.rotatePage = (e) => this.adapter.rotatePage(e), this.adapter = c(
369
369
  "page",
370
370
  J(t),
371
371
  t
@@ -408,9 +408,9 @@ const ne = /\s*,\s*/, ie = /\s*-\s*/, E = (n) => {
408
408
  return r ? [r] : [];
409
409
  }
410
410
  const e = E(t[0] ?? ""), i = E(t[1] ?? "");
411
- return !e || !i || i < e ? [] : Array.from({ length: i - e + 1 }, (r, o) => e + o);
412
- }, oe = (n) => n ? n.split(ne).flatMap((e) => re(e)).filter((e, i, r) => r.indexOf(e) === i) : [];
413
- class ae {
411
+ return !e || !i || i < e ? [] : Array.from({ length: i - e + 1 }, (r, a) => e + a);
412
+ }, ae = (n) => n ? n.split(ne).flatMap((e) => re(e)).filter((e, i, r) => r.indexOf(e) === i) : [];
413
+ class oe {
414
414
  constructor(t, e, i) {
415
415
  this.setFieldName = (r) => {
416
416
  this.key = r;
@@ -431,7 +431,7 @@ class se {
431
431
  this.sealPosition = t;
432
432
  }, this.setPageRange = (t) => {
433
433
  this.pageRange = t;
434
- }, this.getPageRange = () => this.pageRange, this.getPageRanges = () => oe(this.pageRange), this.setSignUserData = (t) => {
434
+ }, this.getPageRange = () => this.pageRange, this.getPageRanges = () => ae(this.pageRange), this.setSignUserData = (t) => {
435
435
  this.signUserData = t;
436
436
  }, this.setPrintMargin = (t) => {
437
437
  this.printMargin = t;
@@ -489,18 +489,18 @@ const ue = (n) => {
489
489
  return "auto";
490
490
  if (t === "light" || t === "dark" || t === "high-contrast" || t === "auto")
491
491
  return t;
492
- }, x = (n) => {
492
+ }, V = (n) => {
493
493
  const t = new URL(n, globalThis.location?.href ?? "http://localhost/");
494
494
  return t.hash = "", t.pathname.endsWith("/") || (t.pathname = `${t.pathname}/`), t.toString();
495
495
  }, he = (n) => new URL("editors.bootstrap.js", n).toString(), me = (n, t) => {
496
- const e = x(n);
496
+ const e = V(n);
497
497
  return {
498
498
  ...t,
499
- officeServer: e,
499
+ appUrl: e,
500
500
  scrollIntoView: t.scrollIntoView ?? !0,
501
501
  theme: ue(t.theme)
502
502
  };
503
- }, h = "rhc-office-editor", R = "__RHC_OFFICE_SDK_READER_LOADER__", V = () => {
503
+ }, u = "rhc-office-editor", R = "__RHC_OFFICE_SDK_READER_LOADER__", B = () => {
504
504
  const n = globalThis;
505
505
  return n[R] || (n[R] = {
506
506
  activeAppUrl: null,
@@ -515,38 +515,38 @@ class S extends Error {
515
515
  class ge extends Error {
516
516
  constructor(t, e) {
517
517
  super(
518
- `Reader Web Component "${h}" is already bound to ${t} and cannot be reloaded from ${e}.`
518
+ `Reader Web Component "${u}" is already bound to ${t} and cannot be reloaded from ${e}.`
519
519
  ), this.name = "ReaderSourceConflictError";
520
520
  }
521
521
  }
522
- const B = (n) => {
523
- const t = V();
522
+ const x = (n) => {
523
+ const t = B();
524
524
  if (t.activeAppUrl && t.activeAppUrl !== n)
525
525
  throw new ge(t.activeAppUrl, n);
526
526
  }, ke = (n) => {
527
- const t = V();
528
- B(n);
527
+ const t = B();
528
+ x(n);
529
529
  const e = t.loadPromises.get(n);
530
530
  if (e)
531
531
  return e;
532
- if (globalThis.customElements?.get(h)) {
532
+ if (globalThis.customElements?.get(u)) {
533
533
  t.activeAppUrl = n;
534
- const a = Promise.resolve();
535
- return t.loadPromises.set(n, a), a;
534
+ const o = Promise.resolve();
535
+ return t.loadPromises.set(n, o), o;
536
536
  }
537
537
  const i = he(n), r = pe(i);
538
538
  t.activeAppUrl = n;
539
- const o = new Promise((a, s) => {
539
+ const a = new Promise((o, s) => {
540
540
  const l = (f) => {
541
541
  f?.remove(), s(new S(i));
542
- }, p = () => {
543
- globalThis.customElements.whenDefined(h).then(() => {
544
- a();
542
+ }, m = () => {
543
+ globalThis.customElements.whenDefined(u).then(() => {
544
+ o();
545
545
  }).catch(s);
546
546
  };
547
547
  if (r) {
548
- if (globalThis.customElements?.get(h)) {
549
- a();
548
+ if (globalThis.customElements?.get(u)) {
549
+ o();
550
550
  return;
551
551
  }
552
552
  r.addEventListener(
@@ -555,16 +555,16 @@ const B = (n) => {
555
555
  {
556
556
  once: !0
557
557
  }
558
- ), p();
558
+ ), m();
559
559
  return;
560
560
  }
561
561
  const d = document.createElement("script");
562
- d.src = i, d.async = !0, d.dataset.rhcOfficeSdkReader = n, d.addEventListener("load", p, { once: !0 }), d.addEventListener("error", () => l(d), { once: !0 }), document.head.appendChild(d);
563
- }).catch((a) => {
564
- throw t.loadPromises.delete(n), !globalThis.customElements?.get(h) && t.activeAppUrl === n && (t.activeAppUrl = null), a;
562
+ d.src = i, d.async = !0, d.dataset.rhcOfficeSdkReader = n, d.addEventListener("load", m, { once: !0 }), d.addEventListener("error", () => l(d), { once: !0 }), document.head.appendChild(d);
563
+ }).catch((o) => {
564
+ throw t.loadPromises.delete(n), !globalThis.customElements?.get(u) && t.activeAppUrl === n && (t.activeAppUrl = null), o;
565
565
  });
566
- return t.loadPromises.set(n, o), o;
567
- }, fe = "rhc-office.editor-adapter", be = 1, Te = "__RHC_OFFICE_EDITOR_ADAPTER__", C = "rhcOfficeAdapterReady", P = "rhcOfficeAdapterEvent", Ee = "data-rhc-office-reader-id", Re = 5e3, ve = 5e3, ye = () => {
566
+ return t.loadPromises.set(n, a), a;
567
+ }, fe = "rhc-office.editor-adapter", be = 1, Te = "__RHC_OFFICE_EDITOR_ADAPTER__", P = "rhcOfficeAdapterReady", C = "rhcOfficeAdapterEvent", Ee = "data-rhc-office-reader-id", Re = 5e3, ve = 5e3, ye = () => {
568
568
  const n = globalThis.crypto;
569
569
  return typeof n?.randomUUID == "function" ? n.randomUUID() : `adapter-${Date.now()}-${Math.random().toString(36).slice(2)}`;
570
570
  }, g = () => globalThis[Te];
@@ -573,7 +573,7 @@ class Se extends Error {
573
573
  super(e), this.name = "ReaderBridgeError", this.code = t, this.details = i;
574
574
  }
575
575
  }
576
- class Ce {
576
+ class Pe {
577
577
  constructor(t) {
578
578
  this.readerId = null, this.readyTimeoutMs = t?.readyTimeoutMs ?? ve, this.requestTimeoutMs = t?.requestTimeoutMs ?? Re;
579
579
  }
@@ -587,13 +587,13 @@ class Ce {
587
587
  return this.readerId;
588
588
  }
589
589
  async request(t, e, i, r) {
590
- const o = await this.requestRaw(t, e, i, r);
591
- if (o.ok)
592
- return o.result;
590
+ const a = await this.requestRaw(t, e, i, r);
591
+ if (a.ok)
592
+ return a.result;
593
593
  throw new Se(
594
- o.error.code,
595
- o.error.message,
596
- o.error.details
594
+ a.error.code,
595
+ a.error.message,
596
+ a.error.details
597
597
  );
598
598
  }
599
599
  async requestRaw(t, e, i, r) {
@@ -606,8 +606,8 @@ class Ce {
606
606
  message: "Reader is not mounted."
607
607
  }
608
608
  };
609
- const o = await this.waitForAdapter(this.readerId, r?.timeoutMs);
610
- if (!o)
609
+ const a = await this.waitForAdapter(this.readerId, r?.timeoutMs);
610
+ if (!a)
611
611
  return {
612
612
  ok: !1,
613
613
  requestId: "",
@@ -616,7 +616,7 @@ class Ce {
616
616
  message: "Editor adapter is not available."
617
617
  }
618
618
  };
619
- const a = {
619
+ const o = {
620
620
  protocol: fe,
621
621
  version: be,
622
622
  requestId: ye(),
@@ -626,8 +626,8 @@ class Ce {
626
626
  params: i
627
627
  };
628
628
  return this.withTimeout(
629
- o.request(a),
630
- a.requestId,
629
+ a.request(o),
630
+ o.requestId,
631
631
  r?.timeoutMs ?? this.requestTimeoutMs
632
632
  );
633
633
  }
@@ -637,23 +637,23 @@ class Ce {
637
637
  async waitForAdapter(t, e = this.readyTimeoutMs) {
638
638
  const i = g();
639
639
  return i?.getCapabilities(t) ? i : new Promise((r) => {
640
- let o;
641
- const a = () => {
642
- o && clearTimeout(o), globalThis.removeEventListener(C, s);
640
+ let a;
641
+ const o = () => {
642
+ a && clearTimeout(a), globalThis.removeEventListener(P, s);
643
643
  }, s = (l) => {
644
644
  if ((l instanceof CustomEvent ? l.detail : void 0)?.readerId !== t)
645
645
  return;
646
646
  const d = g();
647
- a(), r(d ?? null);
647
+ o(), r(d ?? null);
648
648
  };
649
- globalThis.addEventListener(C, s), o = setTimeout(() => {
650
- a(), r(g()?.getCapabilities(t) ? g() : null);
649
+ globalThis.addEventListener(P, s), a = setTimeout(() => {
650
+ o(), r(g()?.getCapabilities(t) ? g() : null);
651
651
  }, e);
652
652
  });
653
653
  }
654
654
  async withTimeout(t, e, i) {
655
655
  return new Promise((r) => {
656
- const o = setTimeout(() => {
656
+ const a = setTimeout(() => {
657
657
  r({
658
658
  ok: !1,
659
659
  requestId: e,
@@ -663,17 +663,17 @@ class Ce {
663
663
  }
664
664
  });
665
665
  }, i);
666
- t.then((a) => r(a)).catch((a) => {
666
+ t.then((o) => r(o)).catch((o) => {
667
667
  r({
668
668
  ok: !1,
669
669
  requestId: e,
670
670
  error: {
671
671
  code: "EXECUTION_FAILED",
672
- message: a instanceof Error ? a.message : String(a)
672
+ message: o instanceof Error ? o.message : String(o)
673
673
  }
674
674
  });
675
675
  }).finally(() => {
676
- clearTimeout(o);
676
+ clearTimeout(a);
677
677
  });
678
678
  });
679
679
  }
@@ -682,13 +682,12 @@ const A = {
682
682
  annotationEnabled: !1,
683
683
  documentModified: !1,
684
684
  documentOpened: !1,
685
- extensionState: "disconnected",
686
685
  pageCount: 0,
687
686
  pageIndex: 1,
688
687
  pageMode: 0,
689
688
  zoomLevel: 100
690
689
  };
691
- class Pe {
690
+ class Ce {
692
691
  constructor() {
693
692
  this.state = { ...A };
694
693
  }
@@ -713,7 +712,7 @@ class Pe {
713
712
  }
714
713
  class Ae {
715
714
  constructor() {
716
- this.annotationEvents = [], this.annotationPersist = [], this.annotationRetrieve = [], this.digitalAnnotationRetrieve = [], this.digitalSignatureParse = [], this.digitalSignatureRetrieve = [], this.documentClosed = [], this.documentOpened = [], this.documentSaved = [], this.extensionStateChanged = [], this.pageChange = [], this.pageModeChange = [];
715
+ this.annotationEvents = [], this.annotationPersist = [], this.annotationRetrieve = [], this.digitalAnnotationRetrieve = [], this.digitalSignatureParse = [], this.digitalSignatureRetrieve = [], this.documentClosed = [], this.documentOpened = [], this.documentSaved = [], this.pageChange = [], this.pageModeChange = [];
717
716
  }
718
717
  emit(t, e) {
719
718
  switch (t) {
@@ -767,13 +766,6 @@ class Ae {
767
766
  (i) => i(Array.isArray(e) ? e : [])
768
767
  );
769
768
  return;
770
- case "extensionStateChanged": {
771
- const i = e;
772
- this.extensionStateChanged.forEach(
773
- (r) => r(i.state ?? "disconnected")
774
- );
775
- return;
776
- }
777
769
  default:
778
770
  return;
779
771
  }
@@ -784,7 +776,7 @@ const De = [
784
776
  "documentStateChange",
785
777
  "documentError"
786
778
  ], Me = "readerReady", Ie = "readerUnload", v = "readerError", we = () => typeof globalThis.crypto?.randomUUID == "function" ? globalThis.crypto.randomUUID() : `rhc-reader-${Date.now()}-${Math.random().toString(36).slice(2)}`, D = (n, t) => ({
787
- appUrl: t?.officeServer ?? null,
779
+ appUrl: t?.appUrl ?? null,
788
780
  configuration: t,
789
781
  element: n
790
782
  }), _e = (n) => {
@@ -829,40 +821,34 @@ const De = [
829
821
  };
830
822
  if (i(), typeof globalThis.matchMedia != "function")
831
823
  return null;
832
- const r = globalThis.matchMedia("(prefers-color-scheme: dark)"), o = globalThis.matchMedia("(prefers-contrast: more)"), a = () => {
824
+ const r = globalThis.matchMedia("(prefers-color-scheme: dark)"), a = globalThis.matchMedia("(prefers-contrast: more)"), o = () => {
833
825
  i();
834
826
  };
835
- return M(r, a), M(o, a), () => {
836
- I(r, a), I(o, a);
827
+ return M(r, o), M(a, o), () => {
828
+ I(r, o), I(a, o);
837
829
  };
838
830
  };
839
- class Ne {
831
+ class Ue {
840
832
  constructor(t) {
841
- this.bridge = new Ce(), this.callbacks = new Ae(), this.readerState = new Pe(), this.bridgeToolContext = {
833
+ this.bridge = new Pe(), this.callbacks = new Ae(), this.readerState = new Ce(), this.bridgeToolContext = {
842
834
  bridge: this.bridge,
843
835
  callbacks: this.callbacks,
844
836
  debug: () => this.debugEnabled,
845
837
  onAsyncError: (e) => this.reportAdapterError(e),
846
838
  state: this.readerState
847
- }, this.documentTool = new W(this.bridgeToolContext), this.uiTool = new ce(this.bridgeToolContext), this.pageTool = new Z(this.bridgeToolContext), this.findTool = new j(this.bridgeToolContext), this.signServerTool = u(
839
+ }, this.documentTool = new W(this.bridgeToolContext), this.uiTool = new ce(this.bridgeToolContext), this.pageTool = new Z(this.bridgeToolContext), this.findTool = new j(this.bridgeToolContext), this.signServerTool = p(
848
840
  "signServer",
849
841
  this.bridgeToolContext
850
- ), this.digitalSignTool = u(
842
+ ), this.digitalSignTool = p(
851
843
  "digitalSign",
852
844
  this.bridgeToolContext
853
- ), this.reviewTool = u(
854
- "review",
855
- this.bridgeToolContext
856
- ), this.ekeyTool = u(
857
- "ekey",
858
- this.bridgeToolContext
859
- ), this.symbologyTool = u(
845
+ ), this.symbologyTool = p(
860
846
  "symbology",
861
847
  this.bridgeToolContext
862
- ), this.annotationTool = this.createAnnotationTool(), this.templateSignTool = u(
848
+ ), this.annotationTool = this.createAnnotationTool(), this.templateSignTool = p(
863
849
  "templateSign",
864
850
  this.bridgeToolContext
865
- ), this.pdfFormFiller = new te(this.bridgeToolContext), this.extensionTool = this.createExtensionTool(), this.networkingTool = new X(this.bridgeToolContext), this.cryptoTool = u(
851
+ ), this.pdfFormFiller = new te(this.bridgeToolContext), this.networkingTool = new X(this.bridgeToolContext), this.cryptoTool = p(
866
852
  "crypto",
867
853
  this.bridgeToolContext
868
854
  ), this.readyCallbacks = [], this.unloadCallbacks = [], this.debugEnabled = !1, this.isReady = !1, this.removed = !1, this.mountToken = 0, this.hostContainer = null, this.readerElement = null, this.readerId = null, this.normalizedConfiguration = null, this.nativeEventCleanupCallbacks = [], this.themeCleanup = null, this.enableDebug = (e) => {
@@ -893,49 +879,49 @@ class Ne {
893
879
  }, this.setReaderEventListener = (e) => {
894
880
  this.readerEventListener = e;
895
881
  }, this.embedReader = (e, i, r) => {
896
- const o = _e(e), a = x(i);
897
- B(a);
898
- const s = me(a, r), l = this.mountToken + 1;
899
- this.removeReader(), this.mountToken = l, this.removed = !1, this.hostContainer = o, this.normalizedConfiguration = s, this.mountReader(o, s, l);
882
+ const a = _e(e), o = V(i);
883
+ x(o);
884
+ const s = me(o, r), l = this.mountToken + 1;
885
+ this.removeReader(), this.mountToken = l, this.removed = !1, this.hostContainer = a, this.normalizedConfiguration = s, this.mountReader(a, s, l);
900
886
  }, this.removeReader = () => {
901
887
  const e = !!(this.readerElement || this.hostContainer);
902
888
  if (this.mountToken += 1, this.cleanupNativeEventForwarders(), this.cleanupThemeBinding(), this.readerElement?.parentNode && this.readerElement.parentNode.removeChild(this.readerElement), this.readerElement = null, this.readerId = null, this.bridge.setReaderId(null), this.readerState.reset(), this.hostContainer = null, this.normalizedConfiguration = null, this.isReady = !1, this.removed = !0, !e)
903
889
  return;
904
890
  const i = D(null, null);
905
891
  this.emitReaderEvent(Ie, i), this.unloadCallbacks.forEach((r) => r());
906
- }, this.getDocumentTool = () => this.documentTool, this.getUITool = () => this.uiTool, this.getPageTool = () => this.pageTool, this.getFindTool = () => this.findTool, this.getSignServerTool = () => this.signServerTool, this.getDigitalSignTool = () => this.digitalSignTool, this.getReviewTool = () => this.reviewTool, this.getEkeyTool = () => this.ekeyTool, this.getSymbologyTool = () => this.symbologyTool, this.getAnnotationTool = () => this.annotationTool, this.getTemplateSignTool = () => this.templateSignTool, this.getPdfFormFiller = () => this.pdfFormFiller, this.getExtensionTool = () => this.extensionTool, this.getNetworkingTool = () => this.networkingTool, this.getCryptoTool = () => this.cryptoTool, this.createDigitalSignOptions = () => new se(), this.createKVField = (e, i, r) => new ae(e, i, r), this.mountReader = async (e, i, r) => {
892
+ }, this.getDocumentTool = () => this.documentTool, this.getUITool = () => this.uiTool, this.getPageTool = () => this.pageTool, this.getFindTool = () => this.findTool, this.getSignServerTool = () => this.signServerTool, this.getDigitalSignTool = () => this.digitalSignTool, this.getSymbologyTool = () => this.symbologyTool, this.getAnnotationTool = () => this.annotationTool, this.getTemplateSignTool = () => this.templateSignTool, this.getPdfFormFiller = () => this.pdfFormFiller, this.getNetworkingTool = () => this.networkingTool, this.getCryptoTool = () => this.cryptoTool, this.createDigitalSignOptions = () => new se(), this.createKVField = (e, i, r) => new oe(e, i, r), this.mountReader = async (e, i, r) => {
907
893
  try {
908
- if (await ke(i.officeServer), this.mountToken !== r)
894
+ if (await ke(i.appUrl), this.mountToken !== r)
909
895
  return;
910
- const o = document.createElement(h), a = we();
911
- if (o.setAttribute(Ee, a), this.readerId = a, this.bridge.setReaderId(a), Oe(o, i), this.themeCleanup = Le(o, i), this.bindNativeReaderEvents(o), e.replaceChildren(o), this.readerElement = o, await Promise.resolve(), this.mountToken !== r)
896
+ const a = document.createElement(u), o = we();
897
+ if (a.setAttribute(Ee, o), this.readerId = o, this.bridge.setReaderId(o), Oe(a, i), this.themeCleanup = Le(a, i), this.bindNativeReaderEvents(a), e.replaceChildren(a), this.readerElement = a, await Promise.resolve(), this.mountToken !== r)
912
898
  return;
913
899
  i.scrollIntoView && typeof e.scrollIntoView == "function" && e.scrollIntoView({ behavior: "smooth", block: "nearest" }), this.isReady = !0;
914
- const s = D(o, i);
900
+ const s = D(a, i);
915
901
  this.emitReaderEvent(Me, s), this.readyCallbacks.forEach((l) => l());
916
- } catch (o) {
902
+ } catch (a) {
917
903
  if (this.mountToken !== r)
918
904
  return;
919
- this.reportReaderError(o);
905
+ this.reportReaderError(a);
920
906
  }
921
907
  }, this.bindNativeReaderEvents = (e) => {
922
908
  this.cleanupNativeEventForwarders();
923
909
  const i = (r) => {
924
- const o = r instanceof CustomEvent ? r.detail : null;
925
- !o || o.readerId !== this.readerId || (this.readerState.update(o.statePatch), this.callbacks.emit(o.event, o.payload), this.emitReaderEvent(o.event, o.payload));
910
+ const a = r instanceof CustomEvent ? r.detail : null;
911
+ !a || a.readerId !== this.readerId || (this.readerState.update(a.statePatch), this.callbacks.emit(a.event, a.payload), this.emitReaderEvent(a.event, a.payload));
926
912
  };
927
- e.addEventListener(P, i), this.nativeEventCleanupCallbacks.push(() => {
913
+ e.addEventListener(C, i), this.nativeEventCleanupCallbacks.push(() => {
928
914
  e.removeEventListener(
929
- P,
915
+ C,
930
916
  i
931
917
  );
932
918
  }), De.forEach((r) => {
933
- const o = (a) => {
934
- const s = a instanceof CustomEvent ? a.detail : a;
919
+ const a = (o) => {
920
+ const s = o instanceof CustomEvent ? o.detail : o;
935
921
  r === "documentLoaded" && this.readerState.setDocumentOpened(!0), this.emitReaderEvent(r, s), r === "documentError" && this.emitReaderEvent(v, s);
936
922
  };
937
- e.addEventListener(r, o), this.nativeEventCleanupCallbacks.push(() => {
938
- e.removeEventListener(r, o);
923
+ e.addEventListener(r, a), this.nativeEventCleanupCallbacks.push(() => {
924
+ e.removeEventListener(r, a);
939
925
  });
940
926
  });
941
927
  }, this.cleanupNativeEventForwarders = () => {
@@ -1030,32 +1016,17 @@ class Ne {
1030
1016
  this.bridgeToolContext
1031
1017
  );
1032
1018
  }
1033
- createExtensionTool() {
1034
- return c(
1035
- "extension",
1036
- {
1037
- addExtensionStateChangedCallback: {
1038
- kind: "callbackRegister",
1039
- callback: (t, e) => {
1040
- const i = e[0];
1041
- typeof i == "function" && t.extensionStateChanged.push(i);
1042
- }
1043
- }
1044
- },
1045
- this.bridgeToolContext
1046
- );
1047
- }
1048
1019
  }
1049
- const He = (n) => new Ne(n);
1020
+ const He = (n) => new Ue(n);
1050
1021
  export {
1051
1022
  Ge as DIGITAL_SIGN_DEFAULTS,
1052
- Ne as DocumentSDK,
1023
+ Ue as DocumentSDK,
1053
1024
  K as WatermarkDisplay,
1054
1025
  He as createNewDocumentSdk,
1055
- Ue as getDigitalSignEnvironment,
1056
- xe as initializeDigitalSignEnvironment,
1057
- Be as patchDigitalSignEnvironment,
1026
+ Ne as getDigitalSignEnvironment,
1027
+ Ve as initializeDigitalSignEnvironment,
1028
+ xe as patchDigitalSignEnvironment,
1058
1029
  Ke as resetDigitalSignEnvironment,
1059
- Ve as setDigitalSignEnvironment
1030
+ Be as setDigitalSignEnvironment
1060
1031
  };
1061
1032
  //# sourceMappingURL=index.js.map