laif-ds 0.2.32 → 0.2.34

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 (39) hide show
  1. package/dist/_virtual/index4.js +5 -5
  2. package/dist/_virtual/index5.js +5 -5
  3. package/dist/components/ui/button.js +27 -26
  4. package/dist/components/ui/checkbox.js +15 -11
  5. package/dist/components/ui/secure-pdf-viewer.js +64 -57
  6. package/dist/index.d.ts +8 -2
  7. package/dist/laif-ds.css +1 -1
  8. package/dist/node_modules/hast-util-to-jsx-runtime/lib/index.js +1 -1
  9. package/dist/node_modules/react-hook-form/dist/index.esm.js +1 -1
  10. package/dist/node_modules/unified/lib/index.js +1 -1
  11. package/dist/styles.v3.css +1 -1
  12. package/package.json +6 -4
  13. package/dist/_virtual/warning.js +0 -8
  14. package/dist/node_modules/dequal/dist/index.js +0 -56
  15. package/dist/node_modules/make-cancellable-promise/dist/index.js +0 -15
  16. package/dist/node_modules/make-event-props/dist/index.js +0 -114
  17. package/dist/node_modules/merge-refs/dist/index.js +0 -19
  18. package/dist/node_modules/react-pdf/dist/Document.js +0 -180
  19. package/dist/node_modules/react-pdf/dist/DocumentContext.js +0 -6
  20. package/dist/node_modules/react-pdf/dist/LinkService.js +0 -94
  21. package/dist/node_modules/react-pdf/dist/Message.js +0 -8
  22. package/dist/node_modules/react-pdf/dist/Page/AnnotationLayer.js +0 -97
  23. package/dist/node_modules/react-pdf/dist/Page/Canvas.js +0 -55
  24. package/dist/node_modules/react-pdf/dist/Page/TextLayer.js +0 -111
  25. package/dist/node_modules/react-pdf/dist/Page.js +0 -180
  26. package/dist/node_modules/react-pdf/dist/PageContext.js +0 -6
  27. package/dist/node_modules/react-pdf/dist/PasswordResponses.js +0 -8
  28. package/dist/node_modules/react-pdf/dist/StructTree.js +0 -44
  29. package/dist/node_modules/react-pdf/dist/StructTreeItem.js +0 -14
  30. package/dist/node_modules/react-pdf/dist/index.js +0 -9
  31. package/dist/node_modules/react-pdf/dist/shared/constants.js +0 -62
  32. package/dist/node_modules/react-pdf/dist/shared/hooks/useDocumentContext.js +0 -9
  33. package/dist/node_modules/react-pdf/dist/shared/hooks/usePageContext.js +0 -9
  34. package/dist/node_modules/react-pdf/dist/shared/hooks/useResolver.js +0 -20
  35. package/dist/node_modules/react-pdf/dist/shared/structTreeUtils.js +0 -55
  36. package/dist/node_modules/react-pdf/dist/shared/utils.js +0 -110
  37. package/dist/node_modules/react-pdf/node_modules/pdfjs-dist/build/pdf.js +0 -15282
  38. package/dist/node_modules/tiny-invariant/dist/esm/tiny-invariant.js +0 -13
  39. package/dist/node_modules/warning/warning.js +0 -39
@@ -1,111 +0,0 @@
1
- "use client";
2
- import { jsx as H } from "react/jsx-runtime";
3
- import { useRef as q, useEffect as m, useCallback as k, useMemo as J, useLayoutEffect as $ } from "react";
4
- import { clsx as z } from "../../../clsx/dist/clsx.js";
5
- import B from "../../../make-cancellable-promise/dist/index.js";
6
- import { TextLayer as F } from "../../node_modules/pdfjs-dist/build/pdf.js";
7
- import P from "../../../tiny-invariant/dist/esm/tiny-invariant.js";
8
- import x from "../../../../_virtual/warning.js";
9
- import K from "../shared/hooks/usePageContext.js";
10
- import Q from "../shared/hooks/useResolver.js";
11
- import { cancelRunningTask as N } from "../shared/utils.js";
12
- function W(s) {
13
- return "str" in s;
14
- }
15
- function ce() {
16
- const s = K();
17
- P(s, "Unable to find Page context.");
18
- const { customTextRenderer: u, onGetTextError: y, onGetTextSuccess: g, onRenderTextLayerError: f, onRenderTextLayerSuccess: l, page: t, pageIndex: T, pageNumber: C, rotate: E, scale: L } = s;
19
- P(t, "Attempted to load page text content, but no page was specified.");
20
- const [_, o] = Q(), { value: n, error: p } = _, c = q(null);
21
- x(Number.parseInt(window.getComputedStyle(document.body).getPropertyValue("--react-pdf-text-layer"), 10) === 1, "TextLayer styles not found. Read more: https://github.com/wojtekmaj/react-pdf#support-for-text-layer");
22
- function j() {
23
- n && g && g(n);
24
- }
25
- function D() {
26
- p && (x(!1, p.toString()), y && y(p));
27
- }
28
- m(function() {
29
- o({ type: "RESET" });
30
- }, [t, o]), m(function() {
31
- if (!t)
32
- return;
33
- const r = B(t.getTextContent()), d = r;
34
- return r.promise.then((a) => {
35
- o({ type: "RESOLVE", value: a });
36
- }).catch((a) => {
37
- o({ type: "REJECT", error: a });
38
- }), () => N(d);
39
- }, [t, o]), m(() => {
40
- if (n !== void 0) {
41
- if (n === !1) {
42
- D();
43
- return;
44
- }
45
- j();
46
- }
47
- }, [n]);
48
- const R = k(() => {
49
- l && l();
50
- }, [l]), S = k((e) => {
51
- x(!1, e.toString()), f && f(e);
52
- }, [f]);
53
- function I() {
54
- const e = c.current;
55
- e && e.classList.add("selecting");
56
- }
57
- function O() {
58
- const e = c.current;
59
- e && e.classList.remove("selecting");
60
- }
61
- const h = J(() => t.getViewport({ scale: L, rotation: E }), [t, E, L]);
62
- return $(function() {
63
- if (!t || !n)
64
- return;
65
- const { current: r } = c;
66
- if (!r)
67
- return;
68
- r.innerHTML = "";
69
- const d = t.streamTextContent({ includeMarkedContent: !0 }), a = {
70
- container: r,
71
- textContentSource: d,
72
- viewport: h
73
- }, b = new F(a), U = b;
74
- return b.render().then(() => {
75
- const w = document.createElement("div");
76
- w.className = "endOfContent", r.append(w);
77
- const V = r.querySelectorAll('[role="presentation"]');
78
- if (u) {
79
- let v = 0;
80
- n.items.forEach((i, A) => {
81
- if (!W(i))
82
- return;
83
- const M = V[v];
84
- if (!M)
85
- return;
86
- const G = u({
87
- pageIndex: T,
88
- pageNumber: C,
89
- itemIndex: A,
90
- ...i
91
- });
92
- M.innerHTML = G, v += i.str && i.hasEOL ? 2 : 1;
93
- });
94
- }
95
- R();
96
- }).catch(S), () => N(U);
97
- }, [
98
- u,
99
- S,
100
- R,
101
- t,
102
- T,
103
- C,
104
- n,
105
- h
106
- ]), // biome-ignore lint/a11y/noStaticElementInteractions: False positive caused by non interactive wrapper listening for bubbling events
107
- H("div", { className: z("react-pdf__Page__textContent", "textLayer"), onMouseUp: O, onMouseDown: I, ref: c });
108
- }
109
- export {
110
- ce as default
111
- };
@@ -1,180 +0,0 @@
1
- "use client";
2
- import { jsx as c, jsxs as Se } from "react/jsx-runtime";
3
- import { useRef as Ee, useMemo as $, useEffect as y } from "react";
4
- import { clsx as Le } from "../../clsx/dist/clsx.js";
5
- import ve from "../../make-cancellable-promise/dist/index.js";
6
- import Te from "../../make-event-props/dist/index.js";
7
- import he from "../../merge-refs/dist/index.js";
8
- import re from "../../tiny-invariant/dist/esm/tiny-invariant.js";
9
- import Ge from "../../../_virtual/warning.js";
10
- import N from "./Message.js";
11
- import Ae from "./Page/AnnotationLayer.js";
12
- import Ce from "./Page/Canvas.js";
13
- import we from "./Page/TextLayer.js";
14
- import be from "./PageContext.js";
15
- import ke from "./shared/hooks/useDocumentContext.js";
16
- import _e from "./shared/hooks/useResolver.js";
17
- import { isProvided as i, cancelRunningTask as $e, makePageCallback as ne } from "./shared/utils.js";
18
- const oe = 1;
19
- function Xe(te) {
20
- const ae = { ...ke(), ...te }, { _className: R = "react-pdf__Page", _enableRegisterUnregisterPage: S = !0, canvasBackground: E, canvasRef: se, children: L, className: ce, customRenderer: D, customTextRenderer: M, devicePixelRatio: F, error: v = "Failed to load the page.", height: m, inputRef: ie, loading: T = "Loading page…", noData: h = "No page specified.", onGetAnnotationsError: I, onGetAnnotationsSuccess: W, onGetStructTreeError: j, onGetStructTreeSuccess: B, onGetTextError: V, onGetTextSuccess: H, onLoadError: J, onLoadSuccess: K, onRenderAnnotationLayerError: O, onRenderAnnotationLayerSuccess: U, onRenderError: q, onRenderSuccess: z, onRenderTextLayerError: Q, onRenderTextLayerSuccess: X, pageIndex: l, pageNumber: p, pdf: o, registerPage: Y, renderAnnotationLayer: ue = !0, renderForms: Z = !1, renderMode: de = "canvas", renderTextLayer: G = !0, rotate: A, scale: g = oe, unregisterPage: C, width: P, ...ee } = ae, [le, f] = _e(), { value: e, error: w } = le, b = Ee(null);
21
- re(o, "Attempted to load a page, but no document was specified. Wrap <Page /> in a <Document /> or pass explicit `pdf` prop.");
22
- const n = i(p) ? p - 1 : l ?? null, t = p ?? (i(l) ? l + 1 : null), u = A ?? (e ? e.rotate : null), r = $(() => {
23
- if (!e)
24
- return null;
25
- let a = 1;
26
- const d = g ?? oe;
27
- if (P || m) {
28
- const s = e.getViewport({ scale: 1, rotation: u });
29
- P ? a = P / s.width : m && (a = m / s.height);
30
- }
31
- return d * a;
32
- }, [m, e, u, g, P]);
33
- y(function() {
34
- return () => {
35
- i(n) && S && C && C(n);
36
- };
37
- }, [S, o, n, C]);
38
- function pe() {
39
- if (K) {
40
- if (!e || !r)
41
- return;
42
- K(ne(e, r));
43
- }
44
- if (S && Y) {
45
- if (!i(n) || !b.current)
46
- return;
47
- Y(n, b.current);
48
- }
49
- }
50
- function fe() {
51
- w && (Ge(!1, w.toString()), J && J(w));
52
- }
53
- y(function() {
54
- f({ type: "RESET" });
55
- }, [f, o, n]), y(function() {
56
- if (!o || !t)
57
- return;
58
- const d = ve(o.getPage(t)), s = d;
59
- return d.promise.then((_) => {
60
- f({ type: "RESOLVE", value: _ });
61
- }).catch((_) => {
62
- f({ type: "REJECT", error: _ });
63
- }), () => $e(s);
64
- }, [f, o, t]), y(() => {
65
- if (e !== void 0) {
66
- if (e === !1) {
67
- fe();
68
- return;
69
- }
70
- pe();
71
- }
72
- }, [e, r]);
73
- const k = $(() => (
74
- // Technically there cannot be page without pageIndex, pageNumber, rotate and scale, but TypeScript doesn't know that
75
- i(n) && t && i(u) && i(r) ? {
76
- _className: R,
77
- canvasBackground: E,
78
- customTextRenderer: M,
79
- devicePixelRatio: F,
80
- onGetAnnotationsError: I,
81
- onGetAnnotationsSuccess: W,
82
- onGetStructTreeError: j,
83
- onGetStructTreeSuccess: B,
84
- onGetTextError: V,
85
- onGetTextSuccess: H,
86
- onRenderAnnotationLayerError: O,
87
- onRenderAnnotationLayerSuccess: U,
88
- onRenderError: q,
89
- onRenderSuccess: z,
90
- onRenderTextLayerError: Q,
91
- onRenderTextLayerSuccess: X,
92
- page: e,
93
- pageIndex: n,
94
- pageNumber: t,
95
- renderForms: Z,
96
- renderTextLayer: G,
97
- rotate: u,
98
- scale: r
99
- } : null
100
- ), [
101
- R,
102
- E,
103
- M,
104
- F,
105
- I,
106
- W,
107
- j,
108
- B,
109
- V,
110
- H,
111
- O,
112
- U,
113
- q,
114
- z,
115
- Q,
116
- X,
117
- e,
118
- n,
119
- t,
120
- Z,
121
- G,
122
- u,
123
- r
124
- ]), me = $(
125
- () => Te(ee, () => e && (r ? ne(e, r) : void 0)),
126
- // biome-ignore lint/correctness/useExhaustiveDependencies: FIXME
127
- [ee, e, r]
128
- ), x = `${n}@${r}/${u}`;
129
- function ge() {
130
- switch (de) {
131
- case "custom":
132
- return re(D, 'renderMode was set to "custom", but no customRenderer was passed.'), c(D, {}, `${x}_custom`);
133
- case "none":
134
- return null;
135
- case "canvas":
136
- default:
137
- return c(Ce, { canvasRef: se }, `${x}_canvas`);
138
- }
139
- }
140
- function Pe() {
141
- return G ? c(we, {}, `${x}_text`) : null;
142
- }
143
- function xe() {
144
- return ue ? c(Ae, {}, `${x}_annotations`) : null;
145
- }
146
- function ye() {
147
- function a(s) {
148
- return !!s?.page;
149
- }
150
- if (!a(k))
151
- throw new Error("page is undefined");
152
- const d = typeof L == "function" ? L(k) : L;
153
- return Se(be.Provider, { value: k, children: [ge(), Pe(), xe(), d] });
154
- }
155
- function Re() {
156
- return t ? o === null || e === void 0 || e === null ? c(N, { type: "loading", children: typeof T == "function" ? T() : T }) : o === !1 || e === !1 ? c(N, { type: "error", children: typeof v == "function" ? v() : v }) : ye() : c(N, { type: "no-data", children: typeof h == "function" ? h() : h });
157
- }
158
- return c("div", {
159
- className: Le(R, ce),
160
- "data-page-number": t,
161
- // Assertion is needed for React 18 compatibility
162
- ref: he(ie, b),
163
- style: {
164
- "--scale-round-x": "1px",
165
- "--scale-round-y": "1px",
166
- "--scale-factor": "1",
167
- "--user-unit": `${r}`,
168
- "--total-scale-factor": "calc(var(--scale-factor) * var(--user-unit))",
169
- backgroundColor: E || "white",
170
- position: "relative",
171
- minWidth: "min-content",
172
- minHeight: "min-content"
173
- },
174
- ...me,
175
- children: Re()
176
- });
177
- }
178
- export {
179
- Xe as default
180
- };
@@ -1,6 +0,0 @@
1
- "use client";
2
- import { createContext as t } from "react";
3
- const o = t(null);
4
- export {
5
- o as default
6
- };
@@ -1,8 +0,0 @@
1
- "use client";
2
- const s = {
3
- NEED_PASSWORD: 1,
4
- INCORRECT_PASSWORD: 2
5
- };
6
- export {
7
- s as default
8
- };
@@ -1,44 +0,0 @@
1
- "use client";
2
- import { jsx as E } from "react/jsx-runtime";
3
- import { useEffect as u } from "react";
4
- import d from "../../make-cancellable-promise/dist/index.js";
5
- import g from "../../tiny-invariant/dist/esm/tiny-invariant.js";
6
- import x from "../../../_virtual/warning.js";
7
- import P from "./StructTreeItem.js";
8
- import R from "./shared/hooks/usePageContext.js";
9
- import v from "./shared/hooks/useResolver.js";
10
- import { cancelRunningTask as C } from "./shared/utils.js";
11
- function D() {
12
- const n = R();
13
- g(n, "Unable to find Page context.");
14
- const { onGetStructTreeError: s, onGetStructTreeSuccess: i } = n, [m, r] = v(), { value: e, error: o } = m, { customTextRenderer: a, page: t } = n;
15
- function p() {
16
- e && i && i(e);
17
- }
18
- function T() {
19
- o && (x(!1, o.toString()), s && s(o));
20
- }
21
- return u(function() {
22
- r({ type: "RESET" });
23
- }, [r, t]), u(function() {
24
- if (a || !t)
25
- return;
26
- const f = d(t.getStructTree()), S = f;
27
- return f.promise.then((c) => {
28
- r({ type: "RESOLVE", value: c });
29
- }).catch((c) => {
30
- r({ type: "REJECT", error: c });
31
- }), () => C(S);
32
- }, [a, t, r]), u(() => {
33
- if (e !== void 0) {
34
- if (e === !1) {
35
- T();
36
- return;
37
- }
38
- p();
39
- }
40
- }, [e]), e ? E(P, { className: "react-pdf__Page__structTree structTree", node: e }) : null;
41
- }
42
- export {
43
- D as default
44
- };
@@ -1,14 +0,0 @@
1
- "use client";
2
- import { jsx as r } from "react/jsx-runtime";
3
- import { useMemo as e } from "react";
4
- import { getAttributes as c, isStructTreeNode as m, isStructTreeNodeWithOnlyContentChild as o } from "./shared/structTreeUtils.js";
5
- function a({ className: i, node: t }) {
6
- const u = e(() => c(t), [t]), n = e(() => !m(t) || o(t) ? null : t.children.map((s, l) => (
7
- // biome-ignore lint/suspicious/noArrayIndexKey: index is stable here
8
- r(a, { node: s }, l)
9
- )), [t]);
10
- return r("span", { className: i, ...u, children: n });
11
- }
12
- export {
13
- a as default
14
- };
@@ -1,9 +0,0 @@
1
- "use client";
2
- import { GlobalWorkerOptions as r } from "../node_modules/pdfjs-dist/build/pdf.js";
3
- import * as e from "../node_modules/pdfjs-dist/build/pdf.js";
4
- import { displayWorkerWarning as o } from "./shared/utils.js";
5
- o();
6
- r.workerSrc = "pdf.worker.mjs";
7
- export {
8
- e as pdfjs
9
- };
@@ -1,62 +0,0 @@
1
- "use client";
2
- const l = {
3
- // Document level structure types
4
- Document: null,
5
- // There's a "document" role, but it doesn't make sense here.
6
- DocumentFragment: null,
7
- // Grouping level structure types
8
- Part: "group",
9
- Sect: "group",
10
- // XXX: There's a "section" role, but it's abstract.
11
- Div: "group",
12
- Aside: "note",
13
- NonStruct: "none",
14
- // Block level structure types
15
- P: null,
16
- // H<n>,
17
- H: "heading",
18
- Title: null,
19
- FENote: "note",
20
- // Sub-block level structure type
21
- Sub: "group",
22
- // General inline level structure types
23
- Lbl: null,
24
- Span: null,
25
- Em: null,
26
- Strong: null,
27
- Link: "link",
28
- Annot: "note",
29
- Form: "form",
30
- // Ruby and Warichu structure types
31
- Ruby: null,
32
- RB: null,
33
- RT: null,
34
- RP: null,
35
- Warichu: null,
36
- WT: null,
37
- WP: null,
38
- // List standard structure types
39
- L: "list",
40
- LI: "listitem",
41
- LBody: null,
42
- // Table standard structure types
43
- Table: "table",
44
- TR: "row",
45
- TH: "columnheader",
46
- TD: "cell",
47
- THead: "columnheader",
48
- TBody: null,
49
- TFoot: null,
50
- // Standard structure type Caption
51
- Caption: null,
52
- // Standard structure type Figure
53
- Figure: "figure",
54
- // Standard structure type Formula
55
- Formula: null,
56
- // standard structure type Artifact
57
- Artifact: null
58
- }, n = /^H(\d+)$/;
59
- export {
60
- n as HEADING_PATTERN,
61
- l as PDF_ROLE_TO_HTML_ROLE
62
- };
@@ -1,9 +0,0 @@
1
- "use client";
2
- import { useContext as t } from "react";
3
- import e from "../../DocumentContext.js";
4
- function u() {
5
- return t(e);
6
- }
7
- export {
8
- u as default
9
- };
@@ -1,9 +0,0 @@
1
- "use client";
2
- import { useContext as t } from "react";
3
- import e from "../../PageContext.js";
4
- function r() {
5
- return t(e);
6
- }
7
- export {
8
- r as default
9
- };
@@ -1,20 +0,0 @@
1
- "use client";
2
- import { useReducer as u } from "react";
3
- function n(r, e) {
4
- switch (e.type) {
5
- case "RESOLVE":
6
- return { value: e.value, error: void 0 };
7
- case "REJECT":
8
- return { value: !1, error: e.error };
9
- case "RESET":
10
- return { value: void 0, error: void 0 };
11
- default:
12
- return r;
13
- }
14
- }
15
- function t() {
16
- return u(n, { value: void 0, error: void 0 });
17
- }
18
- export {
19
- t as default
20
- };
@@ -1,55 +0,0 @@
1
- "use client";
2
- import { HEADING_PATTERN as f, PDF_ROLE_TO_HTML_ROLE as u } from "./constants.js";
3
- function s(t) {
4
- return t in u;
5
- }
6
- function n(t) {
7
- return "children" in t;
8
- }
9
- function a(t) {
10
- return n(t) ? t.children.length === 1 && 0 in t.children && "id" in t.children[0] : !1;
11
- }
12
- function h(t) {
13
- const i = {};
14
- if (n(t)) {
15
- const { role: r } = t, e = r.match(f);
16
- if (e)
17
- i.role = "heading", i["aria-level"] = Number(e[1]);
18
- else if (s(r)) {
19
- const l = u[r];
20
- l && (i.role = l);
21
- }
22
- }
23
- return i;
24
- }
25
- function c(t) {
26
- const i = {};
27
- if (n(t)) {
28
- if (t.alt !== void 0 && (i["aria-label"] = t.alt), t.lang !== void 0 && (i.lang = t.lang), a(t)) {
29
- const [r] = t.children;
30
- if (r) {
31
- const e = c(r);
32
- return {
33
- ...i,
34
- ...e
35
- };
36
- }
37
- }
38
- } else
39
- "id" in t && (i["aria-owns"] = t.id);
40
- return i;
41
- }
42
- function b(t) {
43
- return t ? {
44
- ...h(t),
45
- ...c(t)
46
- } : null;
47
- }
48
- export {
49
- b as getAttributes,
50
- c as getBaseAttributes,
51
- h as getRoleAttributes,
52
- s as isPdfRole,
53
- n as isStructTreeNode,
54
- a as isStructTreeNodeWithOnlyContentChild
55
- };
@@ -1,110 +0,0 @@
1
- "use client";
2
- import l from "../../../tiny-invariant/dist/esm/tiny-invariant.js";
3
- import s from "../../../../_virtual/warning.js";
4
- const t = typeof window < "u", u = t && window.location.protocol === "file:";
5
- function c(r) {
6
- return typeof r < "u";
7
- }
8
- function E(r) {
9
- return c(r) && r !== null;
10
- }
11
- function d(r) {
12
- return typeof r == "string";
13
- }
14
- function b(r) {
15
- return r instanceof ArrayBuffer;
16
- }
17
- function p(r) {
18
- return l(t, "isBlob can only be used in a browser environment"), r instanceof Blob;
19
- }
20
- function w(r) {
21
- return d(r) && /^data:/.test(r);
22
- }
23
- function y(r) {
24
- l(w(r), "Invalid data URI.");
25
- const [n = "", e = ""] = r.split(",");
26
- return n.split(";").indexOf("base64") !== -1 ? atob(e) : unescape(e);
27
- }
28
- function R() {
29
- return t && window.devicePixelRatio || 1;
30
- }
31
- const f = "On Chromium based browsers, you can use --allow-file-access-from-files flag for debugging purposes.";
32
- function m() {
33
- s(!u, `Loading PDF as base64 strings/URLs may not work on protocols other than HTTP/HTTPS. ${f}`);
34
- }
35
- function P() {
36
- s(!u, `Loading PDF.js worker may not work on protocols other than HTTP/HTTPS. ${f}`);
37
- }
38
- function F(r) {
39
- r?.cancel && r.cancel();
40
- }
41
- function O(r, n) {
42
- return Object.defineProperty(r, "width", {
43
- get() {
44
- return this.view[2] * n;
45
- },
46
- configurable: !0
47
- }), Object.defineProperty(r, "height", {
48
- get() {
49
- return this.view[3] * n;
50
- },
51
- configurable: !0
52
- }), Object.defineProperty(r, "originalWidth", {
53
- get() {
54
- return this.view[2];
55
- },
56
- configurable: !0
57
- }), Object.defineProperty(r, "originalHeight", {
58
- get() {
59
- return this.view[3];
60
- },
61
- configurable: !0
62
- }), r;
63
- }
64
- function S(r) {
65
- return r.name === "RenderingCancelledException";
66
- }
67
- function T(r) {
68
- return new Promise((n, e) => {
69
- const i = new FileReader();
70
- i.onload = () => {
71
- if (!i.result)
72
- return e(new Error("Error while reading a file."));
73
- n(i.result);
74
- }, i.onerror = (a) => {
75
- if (!a.target)
76
- return e(new Error("Error while reading a file."));
77
- const { error: o } = a.target;
78
- if (!o)
79
- return e(new Error("Error while reading a file."));
80
- switch (o.code) {
81
- case o.NOT_FOUND_ERR:
82
- return e(new Error("Error while reading a file: File not found."));
83
- case o.SECURITY_ERR:
84
- return e(new Error("Error while reading a file: Security error."));
85
- case o.ABORT_ERR:
86
- return e(new Error("Error while reading a file: Aborted."));
87
- default:
88
- return e(new Error("Error while reading a file."));
89
- }
90
- }, i.readAsArrayBuffer(r);
91
- });
92
- }
93
- export {
94
- F as cancelRunningTask,
95
- y as dataURItoByteString,
96
- m as displayCORSWarning,
97
- P as displayWorkerWarning,
98
- R as getDevicePixelRatio,
99
- b as isArrayBuffer,
100
- p as isBlob,
101
- t as isBrowser,
102
- S as isCancelException,
103
- w as isDataURI,
104
- c as isDefined,
105
- u as isLocalFileSystem,
106
- E as isProvided,
107
- d as isString,
108
- T as loadFromFile,
109
- O as makePageCallback
110
- };