@rhc-office/sdk 6.6.264 → 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.
- package/README.md +3 -4
- package/dist/api/callbacks.d.ts +0 -1
- package/dist/api/callbacks.d.ts.map +1 -1
- package/dist/api/crypto-tool.d.ts +12 -1
- package/dist/api/crypto-tool.d.ts.map +1 -1
- package/dist/api/document-sdk.d.ts +0 -6
- package/dist/api/document-sdk.d.ts.map +1 -1
- package/dist/api/sign-tool.d.ts +43 -1
- package/dist/api/sign-tool.d.ts.map +1 -1
- package/dist/browser/document-viewer.js +1 -1
- package/dist/browser/document-viewer.js.map +1 -1
- package/dist/index.d.ts +0 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +117 -146
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +1 -1
- package/dist/index.umd.cjs.map +1 -1
- package/dist/viewer/DocumentSDK.d.ts +0 -7
- package/dist/viewer/DocumentSDK.d.ts.map +1 -1
- package/dist/viewer/ReaderStateStore.d.ts +0 -1
- package/dist/viewer/ReaderStateStore.d.ts.map +1 -1
- package/dist/viewer/SdkCallbackRegistry.d.ts +1 -2
- package/dist/viewer/SdkCallbackRegistry.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/api/callbacks.ts +4 -17
- package/src/api/crypto-tool.ts +13 -1
- package/src/api/document-sdk.ts +0 -9
- package/src/api/sign-tool.ts +62 -1
- package/src/index.ts +0 -3
- package/src/viewer/DocumentSDK.ts +0 -43
- package/src/viewer/ReaderBridgeClient.ts +1 -1
- package/src/viewer/ReaderStateStore.ts +0 -2
- package/src/viewer/SdkCallbackRegistry.ts +0 -9
- package/dist/api/ekey-tool.d.ts +0 -8
- package/dist/api/ekey-tool.d.ts.map +0 -1
- package/dist/api/extension-tool.d.ts +0 -5
- package/dist/api/extension-tool.d.ts.map +0 -1
- package/dist/api/review-tool.d.ts +0 -71
- package/dist/api/review-tool.d.ts.map +0 -1
- package/src/api/ekey-tool.ts +0 -11
- package/src/api/extension-tool.ts +0 -5
- package/src/api/review-tool.ts +0 -105
package/dist/index.d.ts
CHANGED
|
@@ -11,12 +11,9 @@ export * from './api/sign-tool';
|
|
|
11
11
|
export * from './api/sign-server';
|
|
12
12
|
export * from './api/digital-sign-environment';
|
|
13
13
|
export * from './api/networking-tool';
|
|
14
|
-
export * from './api/ekey-tool';
|
|
15
|
-
export * from './api/extension-tool';
|
|
16
14
|
export * from './api/symbology-tool';
|
|
17
15
|
export * from './api/template-sign';
|
|
18
16
|
export * from './api/pdf-formfiller';
|
|
19
|
-
export * from './api/review-tool';
|
|
20
17
|
export * from './api/crypto-tool';
|
|
21
18
|
export * from './api/document-sdk';
|
|
22
19
|
export * from './viewer';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uBAAuB,CAAC;AACtC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,UAAU,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
var K = /* @__PURE__ */ ((n) => (n.DEFAULT = "default", n.COMPACT = "compact", n.HIDE = "none", n))(K || {});
|
|
2
|
-
const w = "RIGHT_CENTER", _ = "REGULAR_ESM", F = "auto",
|
|
2
|
+
const w = "RIGHT_CENTER", _ = "REGULAR_ESM", F = "auto", b = "__RHC_OFFICE_DIGITAL_SIGN_ENVIRONMENT__", y = {
|
|
3
3
|
defaults: {
|
|
4
4
|
bjca: {
|
|
5
5
|
pin: ""
|
|
@@ -74,7 +74,7 @@ const w = "RIGHT_CENTER", _ = "REGULAR_ESM", F = "auto", f = "__RHC_OFFICE_DIGIT
|
|
|
74
74
|
checkCertificateBinding: n.usbKey.checkCertificateBinding,
|
|
75
75
|
usbKeyType: n.usbKey.usbKeyType
|
|
76
76
|
}
|
|
77
|
-
}),
|
|
77
|
+
}), h = (n) => ({
|
|
78
78
|
defaults: O(n.defaults),
|
|
79
79
|
signServer: L(n.signServer)
|
|
80
80
|
}), U = (n) => ({
|
|
@@ -159,23 +159,23 @@ const w = "RIGHT_CENTER", _ = "REGULAR_ESM", F = "auto", f = "__RHC_OFFICE_DIGIT
|
|
|
159
159
|
} : void 0
|
|
160
160
|
}), Q = () => globalThis, k = () => {
|
|
161
161
|
const n = Q();
|
|
162
|
-
return n[
|
|
163
|
-
current:
|
|
164
|
-
defaults:
|
|
162
|
+
return n[b] || (n[b] = {
|
|
163
|
+
current: h(y),
|
|
164
|
+
defaults: h(y),
|
|
165
165
|
overrides: {}
|
|
166
|
-
}), n[
|
|
167
|
-
}, Ne = () => k().current,
|
|
166
|
+
}), n[b];
|
|
167
|
+
}, Ne = () => k().current, Ve = (n) => {
|
|
168
168
|
const t = k();
|
|
169
|
-
return t.defaults =
|
|
170
|
-
}, Ve = (n) => {
|
|
171
|
-
const t = k();
|
|
172
|
-
return t.current = m(n), t.overrides = U(n), t.current;
|
|
169
|
+
return t.defaults = h(n), t.current = N(t.defaults, t.overrides), t.current;
|
|
173
170
|
}, Be = (n) => {
|
|
171
|
+
const t = k();
|
|
172
|
+
return t.current = h(n), t.overrides = U(n), t.current;
|
|
173
|
+
}, xe = (n) => {
|
|
174
174
|
const t = k();
|
|
175
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 =
|
|
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", f = "__RHC_OFFICE_DIGIT
|
|
|
191
191
|
return;
|
|
192
192
|
if (typeof r == "symbol")
|
|
193
193
|
return r === Symbol.toStringTag ? n : void 0;
|
|
194
|
-
const
|
|
195
|
-
return
|
|
196
|
-
if (
|
|
197
|
-
|
|
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 (
|
|
201
|
-
return
|
|
202
|
-
const s =
|
|
203
|
-
if (
|
|
204
|
-
return e.bridge.request(n, s, T(
|
|
205
|
-
if (
|
|
206
|
-
const l =
|
|
207
|
-
e.bridge.request(n, s, T(
|
|
208
|
-
const
|
|
209
|
-
l?.(...
|
|
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
|
+
l?.(...f);
|
|
210
210
|
}).catch(e.onAsyncError);
|
|
211
211
|
return;
|
|
212
212
|
}
|
|
213
|
-
e.bridge.request(n, s, T(
|
|
214
|
-
} : (...
|
|
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
|
-
),
|
|
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
|
|
227
|
-
t.onAsyncError(new Error(
|
|
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,
|
|
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,
|
|
412
|
-
},
|
|
413
|
-
class
|
|
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 = () =>
|
|
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
|
-
},
|
|
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 =
|
|
496
|
+
const e = V(n);
|
|
497
497
|
return {
|
|
498
498
|
...t,
|
|
499
499
|
appUrl: e,
|
|
500
500
|
scrollIntoView: t.scrollIntoView ?? !0,
|
|
501
501
|
theme: ue(t.theme)
|
|
502
502
|
};
|
|
503
|
-
},
|
|
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 "${
|
|
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
|
|
523
|
-
const t =
|
|
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 =
|
|
528
|
-
|
|
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(
|
|
532
|
+
if (globalThis.customElements?.get(u)) {
|
|
533
533
|
t.activeAppUrl = n;
|
|
534
|
-
const
|
|
535
|
-
return t.loadPromises.set(n,
|
|
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
|
|
540
|
-
const l = (
|
|
541
|
-
|
|
542
|
-
},
|
|
543
|
-
globalThis.customElements.whenDefined(
|
|
544
|
-
|
|
539
|
+
const a = new Promise((o, s) => {
|
|
540
|
+
const l = (f) => {
|
|
541
|
+
f?.remove(), s(new S(i));
|
|
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(
|
|
549
|
-
|
|
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
|
-
),
|
|
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",
|
|
563
|
-
}).catch((
|
|
564
|
-
throw t.loadPromises.delete(n), !globalThis.customElements?.get(
|
|
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,
|
|
567
|
-
},
|
|
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
|
|
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
|
|
591
|
-
if (
|
|
592
|
-
return
|
|
590
|
+
const a = await this.requestRaw(t, e, i, r);
|
|
591
|
+
if (a.ok)
|
|
592
|
+
return a.result;
|
|
593
593
|
throw new Se(
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
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
|
|
610
|
-
if (!
|
|
609
|
+
const a = await this.waitForAdapter(this.readerId, r?.timeoutMs);
|
|
610
|
+
if (!a)
|
|
611
611
|
return {
|
|
612
612
|
ok: !1,
|
|
613
613
|
requestId: "",
|
|
@@ -616,9 +616,9 @@ class Ce {
|
|
|
616
616
|
message: "Editor adapter is not available."
|
|
617
617
|
}
|
|
618
618
|
};
|
|
619
|
-
const
|
|
620
|
-
protocol:
|
|
621
|
-
version:
|
|
619
|
+
const o = {
|
|
620
|
+
protocol: fe,
|
|
621
|
+
version: be,
|
|
622
622
|
requestId: ye(),
|
|
623
623
|
readerId: this.readerId,
|
|
624
624
|
tool: t,
|
|
@@ -626,8 +626,8 @@ class Ce {
|
|
|
626
626
|
params: i
|
|
627
627
|
};
|
|
628
628
|
return this.withTimeout(
|
|
629
|
-
|
|
630
|
-
|
|
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
|
|
641
|
-
const
|
|
642
|
-
|
|
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
|
-
|
|
647
|
+
o(), r(d ?? null);
|
|
648
648
|
};
|
|
649
|
-
globalThis.addEventListener(
|
|
650
|
-
|
|
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
|
|
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((
|
|
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:
|
|
672
|
+
message: o instanceof Error ? o.message : String(o)
|
|
673
673
|
}
|
|
674
674
|
});
|
|
675
675
|
}).finally(() => {
|
|
676
|
-
clearTimeout(
|
|
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
|
|
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.
|
|
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
|
}
|
|
@@ -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)"),
|
|
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,
|
|
836
|
-
I(r,
|
|
827
|
+
return M(r, o), M(a, o), () => {
|
|
828
|
+
I(r, o), I(a, o);
|
|
837
829
|
};
|
|
838
830
|
};
|
|
839
831
|
class Ue {
|
|
840
832
|
constructor(t) {
|
|
841
|
-
this.bridge = new
|
|
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 =
|
|
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 =
|
|
842
|
+
), this.digitalSignTool = p(
|
|
851
843
|
"digitalSign",
|
|
852
844
|
this.bridgeToolContext
|
|
853
|
-
), this.
|
|
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 =
|
|
848
|
+
), this.annotationTool = this.createAnnotationTool(), this.templateSignTool = p(
|
|
863
849
|
"templateSign",
|
|
864
850
|
this.bridgeToolContext
|
|
865
|
-
), this.pdfFormFiller = new te(this.bridgeToolContext), this.
|
|
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 Ue {
|
|
|
893
879
|
}, this.setReaderEventListener = (e) => {
|
|
894
880
|
this.readerEventListener = e;
|
|
895
881
|
}, this.embedReader = (e, i, r) => {
|
|
896
|
-
const
|
|
897
|
-
|
|
898
|
-
const s = me(
|
|
899
|
-
this.removeReader(), this.mountToken = l, this.removed = !1, this.hostContainer =
|
|
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.
|
|
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
894
|
if (await ke(i.appUrl), this.mountToken !== r)
|
|
909
895
|
return;
|
|
910
|
-
const
|
|
911
|
-
if (
|
|
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(
|
|
900
|
+
const s = D(a, i);
|
|
915
901
|
this.emitReaderEvent(Me, s), this.readyCallbacks.forEach((l) => l());
|
|
916
|
-
} catch (
|
|
902
|
+
} catch (a) {
|
|
917
903
|
if (this.mountToken !== r)
|
|
918
904
|
return;
|
|
919
|
-
this.reportReaderError(
|
|
905
|
+
this.reportReaderError(a);
|
|
920
906
|
}
|
|
921
907
|
}, this.bindNativeReaderEvents = (e) => {
|
|
922
908
|
this.cleanupNativeEventForwarders();
|
|
923
909
|
const i = (r) => {
|
|
924
|
-
const
|
|
925
|
-
!
|
|
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(
|
|
913
|
+
e.addEventListener(C, i), this.nativeEventCleanupCallbacks.push(() => {
|
|
928
914
|
e.removeEventListener(
|
|
929
|
-
|
|
915
|
+
C,
|
|
930
916
|
i
|
|
931
917
|
);
|
|
932
918
|
}), De.forEach((r) => {
|
|
933
|
-
const
|
|
934
|
-
const s =
|
|
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,
|
|
938
|
-
e.removeEventListener(r,
|
|
923
|
+
e.addEventListener(r, a), this.nativeEventCleanupCallbacks.push(() => {
|
|
924
|
+
e.removeEventListener(r, a);
|
|
939
925
|
});
|
|
940
926
|
});
|
|
941
927
|
}, this.cleanupNativeEventForwarders = () => {
|
|
@@ -1030,21 +1016,6 @@ class Ue {
|
|
|
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
1020
|
const He = (n) => new Ue(n);
|
|
1050
1021
|
export {
|
|
@@ -1053,9 +1024,9 @@ export {
|
|
|
1053
1024
|
K as WatermarkDisplay,
|
|
1054
1025
|
He as createNewDocumentSdk,
|
|
1055
1026
|
Ne as getDigitalSignEnvironment,
|
|
1056
|
-
|
|
1057
|
-
|
|
1027
|
+
Ve as initializeDigitalSignEnvironment,
|
|
1028
|
+
xe as patchDigitalSignEnvironment,
|
|
1058
1029
|
Ke as resetDigitalSignEnvironment,
|
|
1059
|
-
|
|
1030
|
+
Be as setDigitalSignEnvironment
|
|
1060
1031
|
};
|
|
1061
1032
|
//# sourceMappingURL=index.js.map
|