@react-pdf-kit/viewer 2.8.0-beta.9 → 2.8.0

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 (107) hide show
  1. package/dist/{Button-BNlmxWrV.js → Button-DBu3SaMk.js} +1 -1
  2. package/dist/{Checkbox-Brta-YKG.js → Checkbox-CSIEUyO8.js} +4 -4
  3. package/dist/{Combination-DqNkTtir.js → Combination-11kyhTGt.js} +15 -15
  4. package/dist/{Container-BxNZX82X.js → Container-BuamPhw4.js} +1 -1
  5. package/dist/{DocumentDialog-C9G7lVTh.js → DocumentDialog-cRr9sSSH.js} +4 -4
  6. package/dist/{DropDown-DikL-krI.js → DropDown-CM6xEwZC.js} +2 -2
  7. package/dist/{Input-DjSWOjCI.js → Input-Dpo1Xfxe.js} +1 -1
  8. package/dist/{LoaderIcon-D9YjinGf.js → LoaderIcon-B3ddfd0D.js} +1 -1
  9. package/dist/{LoadingIndicator-B_Jsf8No.js → LoadingIndicator-0E8WHnSN.js} +1 -1
  10. package/dist/{MenuItem-D-GflAAo.js → MenuItem-lItnKNd5.js} +2 -2
  11. package/dist/{MenuSeparator-D1H5l8Ej.js → MenuSeparator-CaFxd8b5.js} +1 -1
  12. package/dist/{PasswordModal-S0leMhEd.js → PasswordModal-CxHFn0pB.js} +1 -1
  13. package/dist/{RPDropFileZone-D1C3ouep.js → RPDropFileZone-Bq1bzWmO.js} +1 -1
  14. package/dist/RPPages-cyO0Tn21.js +690 -0
  15. package/dist/{RPTooltip-COLVx-C_.js → RPTooltip-QWwWh4HW.js} +4 -4
  16. package/dist/{Thumbnail-C6zkvwcs.js → Thumbnail-BXMk0OWF.js} +2 -2
  17. package/dist/{Thumbnails-DKG6I7pb.js → Thumbnails-BIuN8LZ8.js} +1 -1
  18. package/dist/{clsx-B7LyVm5O.js → clsx-DSGuh5YW.js} +1 -1
  19. package/dist/components/RPDropFileZone.js +1 -1
  20. package/dist/components/RPPages.js +1 -1
  21. package/dist/components/icons/LoaderIcon.js +1 -1
  22. package/dist/components/layout/Container.js +1 -1
  23. package/dist/components/layout/LayoutContainer.js +1 -1
  24. package/dist/components/layout/RPDefaultLayout.js +2 -2
  25. package/dist/components/layout/RPLayout.js +2 -2
  26. package/dist/components/layout/sidebar/RPSidebar.js +3 -3
  27. package/dist/components/layout/sidebar/Thumbnail.js +1 -1
  28. package/dist/components/layout/sidebar/Thumbnails.js +1 -1
  29. package/dist/components/layout/toolbar/DarkModeTool.js +2 -2
  30. package/dist/components/layout/toolbar/DocumentDialog.js +1 -1
  31. package/dist/components/layout/toolbar/DocumentProperties.js +3 -3
  32. package/dist/components/layout/toolbar/FileDownloadTool.js +3 -3
  33. package/dist/components/layout/toolbar/FileUploadTool.js +3 -3
  34. package/dist/components/layout/toolbar/FullScreenTool.js +3 -3
  35. package/dist/components/layout/toolbar/MenuItem.js +1 -1
  36. package/dist/components/layout/toolbar/MenuSeparator.js +1 -1
  37. package/dist/components/layout/toolbar/MostPageTool.js +4 -4
  38. package/dist/components/layout/toolbar/OtherTool.js +6 -6
  39. package/dist/components/layout/toolbar/Paginate.js +3 -3
  40. package/dist/components/layout/toolbar/PrintTool.js +3 -3
  41. package/dist/components/layout/toolbar/RPMenuItem.js +3 -3
  42. package/dist/components/layout/toolbar/RPMoreOptions.js +6 -6
  43. package/dist/components/layout/toolbar/RPToolbar.js +1 -1
  44. package/dist/components/layout/toolbar/RotateTool.js +4 -4
  45. package/dist/components/layout/toolbar/ScrollModeTool.js +3 -3
  46. package/dist/components/layout/toolbar/SearchCloseButton.js +2 -2
  47. package/dist/components/layout/toolbar/SearchResultNavigator.js +2 -2
  48. package/dist/components/layout/toolbar/SearchTool.js +6 -6
  49. package/dist/components/layout/toolbar/SelectionModeTool.js +4 -4
  50. package/dist/components/layout/toolbar/ThumbnailTool.js +2 -2
  51. package/dist/components/layout/toolbar/ToolbarCustom.js +2 -2
  52. package/dist/components/layout/toolbar/ToolbarDefault.js +2 -2
  53. package/dist/components/layout/toolbar/ViewModeTool.js +4 -4
  54. package/dist/components/layout/toolbar/ZoomTool.js +7 -7
  55. package/dist/components/layout/toolbar/tools/DocumentPropertiesTool.js +3 -3
  56. package/dist/components/layout/toolbar/tools/DualPageTool.js +2 -2
  57. package/dist/components/layout/toolbar/tools/DualPageWithCoverTool.js +1 -1
  58. package/dist/components/layout/toolbar/tools/FileDownloadTool.js +2 -2
  59. package/dist/components/layout/toolbar/tools/FileUploadTool.js +2 -2
  60. package/dist/components/layout/toolbar/tools/FirstPageTool.js +1 -1
  61. package/dist/components/layout/toolbar/tools/FullScreenTool.js +2 -2
  62. package/dist/components/layout/toolbar/tools/HorizontalScrollingTool.js +2 -2
  63. package/dist/components/layout/toolbar/tools/InputPageTool.js +2 -2
  64. package/dist/components/layout/toolbar/tools/LastPageTool.js +1 -1
  65. package/dist/components/layout/toolbar/tools/NextPageTool.js +2 -2
  66. package/dist/components/layout/toolbar/tools/PageScrollingTool.js +2 -2
  67. package/dist/components/layout/toolbar/tools/PreviousPageTool.js +2 -2
  68. package/dist/components/layout/toolbar/tools/PrintTool.js +2 -2
  69. package/dist/components/layout/toolbar/tools/RotateClockwiseTool.js +2 -2
  70. package/dist/components/layout/toolbar/tools/RotateCounterclockwiseTool.js +2 -2
  71. package/dist/components/layout/toolbar/tools/SelectionModeSwitcherTool.js +2 -2
  72. package/dist/components/layout/toolbar/tools/SinglePageTool.js +2 -2
  73. package/dist/components/layout/toolbar/tools/ThemeSwitcherTool.js +2 -2
  74. package/dist/components/layout/toolbar/tools/ThumbnailTool.js +2 -2
  75. package/dist/components/layout/toolbar/tools/VerticalScrollingTool.js +2 -2
  76. package/dist/components/layout/toolbar/tools/ZoomInTool.js +2 -2
  77. package/dist/components/layout/toolbar/tools/ZoomLevelTool.js +6 -6
  78. package/dist/components/layout/toolbar/tools/ZoomOutTool.js +2 -2
  79. package/dist/components/layout/toolbar/tools/more-options/DocumentProperties.js +2 -2
  80. package/dist/components/layout/toolbar/tools/more-options/FileDownloadTool.js +2 -2
  81. package/dist/components/layout/toolbar/tools/more-options/FileUploadTool.js +2 -2
  82. package/dist/components/layout/toolbar/tools/more-options/FullScreenTool.js +2 -2
  83. package/dist/components/layout/toolbar/tools/more-options/MostPageTool.js +4 -4
  84. package/dist/components/layout/toolbar/tools/more-options/PrintTool.js +2 -2
  85. package/dist/components/layout/toolbar/tools/more-options/RotateTool.js +4 -4
  86. package/dist/components/layout/toolbar/tools/more-options/ScrollModeTool.js +3 -3
  87. package/dist/components/layout/toolbar/tools/more-options/SelectionModeTool.js +4 -4
  88. package/dist/components/layout/toolbar/tools/more-options/ViewModeTool.js +4 -4
  89. package/dist/components/ui/Button.js +1 -1
  90. package/dist/components/ui/Checkbox.js +1 -1
  91. package/dist/components/ui/DropDown.js +1 -1
  92. package/dist/components/ui/Input.js +1 -1
  93. package/dist/components/ui/LoadingIndicator.js +1 -1
  94. package/dist/components/ui/PasswordModal.js +1 -1
  95. package/dist/components/ui/RPTooltip.js +1 -1
  96. package/dist/contexts/LoaderContext.js +1 -1
  97. package/dist/{dist-7FA4Do6I.js → dist-B2hwhF6G.js} +7 -7
  98. package/dist/{dist-BRVqFn7R.js → dist-BfuBBQ14.js} +6 -6
  99. package/dist/{dist-C3WNMuW2.js → dist-CNbFpoT1.js} +2 -2
  100. package/dist/{dist-bK-AHWLF.js → dist-CgoP608h.js} +7 -7
  101. package/dist/{dist-CKteKPPA.js → dist-VbpVNBs6.js} +7 -7
  102. package/dist/icons.js +1 -1
  103. package/dist/{main-7sMXtgRg.js → main-DCzVrq0G.js} +2 -2
  104. package/dist/main.js +4 -4
  105. package/dist/utils/hooks/useLicense.js +1 -1
  106. package/package.json +1 -1
  107. package/dist/RPPages-BQw330_L.js +0 -655
@@ -0,0 +1,690 @@
1
+ import { ErrorType as e, ScrollMode as t, SelectionMode as n } from "./utils/types.js";
2
+ import { useDocumentPasswordContext as r } from "./contexts/DocumentPasswordContext.js";
3
+ import { BROWSER_NOT_SUPPORTED_MESSAGE as i, INVALID_OR_CORRUPTED_PDF_MESSAGE as a, WASM_URL_REQUIRED_MESSAGE as o } from "./utils/const.js";
4
+ import { useDocumentContext as s } from "./contexts/RPDocumentContext.js";
5
+ import { useInitialStateContext as c } from "./contexts/InitialStateContext.js";
6
+ import { useScrollModeContext as l } from "./contexts/ScrollModeContext.js";
7
+ import { useViewModeContext as u } from "./contexts/ViewModeContext.js";
8
+ import { useVirtualScrollContext as d } from "./contexts/VirtualScrollContext.js";
9
+ import "./utils/constants.js";
10
+ import { useLayoutContainer as f } from "./contexts/LayoutContainerContext.js";
11
+ import { useEventCallbackContext as p } from "./contexts/EventCallbackContext.js";
12
+ import { useDebounce as m } from "./utils/hooks/useDebounce.js";
13
+ import { useZoomContext as h } from "./contexts/ZoomContext.js";
14
+ import { usePagesRotateContext as ee } from "./contexts/PagesRotateContext.js";
15
+ import { useDimensionPagesContext as te } from "./contexts/DimensionPagesContext.js";
16
+ import { buildDocumentLayout as ne, getPageContentOffset as g, getPageFromDocumentPoint as re, getPagePlacement as _, getRowsByIndexes as ie, getVisibleRows as ae } from "./utils/documentLayout.js";
17
+ import { a as oe, r as se } from "./PaginationContext-DIzsZhFd.js";
18
+ import { useSelectionModeContext as ce } from "./contexts/SelectionModeContext.js";
19
+ import { useFullScreenContext as le } from "./contexts/FullScreenContext.js";
20
+ import { useRenderQueue as ue } from "./contexts/RenderQueueProvider.js";
21
+ import { t as de } from "./clsx-DSGuh5YW.js";
22
+ import { useLoaderContext as fe } from "./contexts/LoaderContext.js";
23
+ import { LayoutContainer as pe } from "./components/layout/LayoutContainer.js";
24
+ import { LayoutWrapper as v } from "./components/layout/LayoutWrapper.js";
25
+ import { RPPage as me } from "./components/page/RPPage.js";
26
+ import { t as he } from "./PasswordModal-CxHFn0pB.js";
27
+ import { approximateFraction as ge } from "./utils/approximateFragtion.js";
28
+ import { useCopyText as _e } from "./utils/hooks/useCopyText.js";
29
+ import { useGrabScroll as ve } from "./utils/hooks/useGrabScroll.js";
30
+ import { useMousePressed as ye } from "./utils/hooks/useMousePressed.js";
31
+ import { usePinch as be } from "./utils/hooks/usePinch.js";
32
+ import { usePresentPage as xe } from "./utils/hooks/usePresentPage.js";
33
+ import { useTextSelection as Se } from "./utils/hooks/useTextSelection.js";
34
+ import { Component as Ce, createElement as we, useCallback as y, useEffect as b, useLayoutEffect as Te, useMemo as Ee, useRef as x, useState as De } from "react";
35
+ import { OutputScale as Oe } from "pdfjs-dist";
36
+ import { Fragment as ke, jsx as S, jsxs as Ae } from "react/jsx-runtime";
37
+ import './assets/RPPages.css';//#region node_modules/react-virtualized-auto-sizer/dist/react-virtualized-auto-sizer.esm.js
38
+ var C = typeof window < "u" ? window : typeof self < "u" ? self : global, je = null, w = null, T = 20, E = C.clearTimeout, D = C.setTimeout, O = C.cancelAnimationFrame || C.mozCancelAnimationFrame || C.webkitCancelAnimationFrame, k = C.requestAnimationFrame || C.mozRequestAnimationFrame || C.webkitRequestAnimationFrame;
39
+ O == null || k == null ? (je = E, w = function(e) {
40
+ return D(e, T);
41
+ }) : (je = function([e, t]) {
42
+ O(e), E(t);
43
+ }, w = function(e) {
44
+ let t = k(function() {
45
+ E(n), e();
46
+ }), n = D(function() {
47
+ O(t), e();
48
+ }, T);
49
+ return [t, n];
50
+ });
51
+ function A(e) {
52
+ let t, n, r, i, a, o, s, c = typeof document < "u" && document.attachEvent;
53
+ if (!c) {
54
+ o = function(e) {
55
+ let t = e.__resizeTriggers__, n = t.firstElementChild, r = t.lastElementChild, i = n.firstElementChild;
56
+ r.scrollLeft = r.scrollWidth, r.scrollTop = r.scrollHeight, i.style.width = n.offsetWidth + 1 + "px", i.style.height = n.offsetHeight + 1 + "px", n.scrollLeft = n.scrollWidth, n.scrollTop = n.scrollHeight;
57
+ }, a = function(e) {
58
+ return e.offsetWidth !== e.__resizeLast__.width || e.offsetHeight !== e.__resizeLast__.height;
59
+ }, s = function(e) {
60
+ if (e.target.className && typeof e.target.className.indexOf == "function" && e.target.className.indexOf("contract-trigger") < 0 && e.target.className.indexOf("expand-trigger") < 0) return;
61
+ let t = this;
62
+ o(this), this.__resizeRAF__ && je(this.__resizeRAF__), this.__resizeRAF__ = w(function() {
63
+ a(t) && (t.__resizeLast__.width = t.offsetWidth, t.__resizeLast__.height = t.offsetHeight, t.__resizeListeners__.forEach(function(n) {
64
+ n.call(t, e);
65
+ }));
66
+ });
67
+ };
68
+ let e = !1, c = "";
69
+ r = "animationstart";
70
+ let l = "Webkit Moz O ms".split(" "), u = "webkitAnimationStart animationstart oAnimationStart MSAnimationStart".split(" "), d = "";
71
+ {
72
+ let t = document.createElement("fakeelement");
73
+ if (t.style.animationName !== void 0 && (e = !0), e === !1) {
74
+ for (let n = 0; n < l.length; n++) if (t.style[l[n] + "AnimationName"] !== void 0) {
75
+ d = l[n], c = "-" + d.toLowerCase() + "-", r = u[n], e = !0;
76
+ break;
77
+ }
78
+ }
79
+ }
80
+ n = "resizeanim", t = "@" + c + "keyframes " + n + " { from { opacity: 0; } to { opacity: 0; } } ", i = c + "animation: 1ms " + n + "; ";
81
+ }
82
+ let l = function(n) {
83
+ if (!n.getElementById("detectElementResize")) {
84
+ let r = (t || "") + ".resize-triggers { " + (i || "") + "visibility: hidden; opacity: 0; } .resize-triggers, .resize-triggers > div, .contract-trigger:before { content: \" \"; display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; z-index: -1; } .resize-triggers > div { background: #eee; overflow: auto; } .contract-trigger:before { width: 200%; height: 200%; }", a = n.head || n.getElementsByTagName("head")[0], o = n.createElement("style");
85
+ o.id = "detectElementResize", o.type = "text/css", e != null && o.setAttribute("nonce", e), o.styleSheet ? o.styleSheet.cssText = r : o.appendChild(n.createTextNode(r)), a.appendChild(o);
86
+ }
87
+ };
88
+ return {
89
+ addResizeListener: function(e, t) {
90
+ if (c) e.attachEvent("onresize", t);
91
+ else {
92
+ if (!e.__resizeTriggers__) {
93
+ let t = e.ownerDocument, i = C.getComputedStyle(e);
94
+ i && i.position === "static" && (e.style.position = "relative"), l(t), e.__resizeLast__ = {}, e.__resizeListeners__ = [], (e.__resizeTriggers__ = t.createElement("div")).className = "resize-triggers";
95
+ let a = t.createElement("div");
96
+ a.className = "expand-trigger", a.appendChild(t.createElement("div"));
97
+ let c = t.createElement("div");
98
+ c.className = "contract-trigger", e.__resizeTriggers__.appendChild(a), e.__resizeTriggers__.appendChild(c), e.appendChild(e.__resizeTriggers__), o(e), e.addEventListener("scroll", s, !0), r && (e.__resizeTriggers__.__animationListener__ = function(t) {
99
+ t.animationName === n && o(e);
100
+ }, e.__resizeTriggers__.addEventListener(r, e.__resizeTriggers__.__animationListener__));
101
+ }
102
+ e.__resizeListeners__.push(t);
103
+ }
104
+ },
105
+ removeResizeListener: function(e, t) {
106
+ if (c) e.detachEvent("onresize", t);
107
+ else if (e.__resizeListeners__.splice(e.__resizeListeners__.indexOf(t), 1), !e.__resizeListeners__.length) {
108
+ e.removeEventListener("scroll", s, !0), e.__resizeTriggers__.__animationListener__ && (e.__resizeTriggers__.removeEventListener(r, e.__resizeTriggers__.__animationListener__), e.__resizeTriggers__.__animationListener__ = null);
109
+ try {
110
+ e.__resizeTriggers__ = !e.removeChild(e.__resizeTriggers__);
111
+ } catch {}
112
+ }
113
+ }
114
+ };
115
+ }
116
+ var j = class extends Ce {
117
+ constructor(...e) {
118
+ super(...e), this.state = {
119
+ height: this.props.defaultHeight || 0,
120
+ width: this.props.defaultWidth || 0
121
+ }, this._autoSizer = null, this._detectElementResize = null, this._didLogDeprecationWarning = !1, this._parentNode = null, this._resizeObserver = null, this._timeoutId = null, this._onResize = () => {
122
+ this._timeoutId = null;
123
+ let { disableHeight: e, disableWidth: t, onResize: n } = this.props;
124
+ if (this._parentNode) {
125
+ let r = window.getComputedStyle(this._parentNode) || {}, i = parseFloat(r.paddingLeft || "0"), a = parseFloat(r.paddingRight || "0"), o = parseFloat(r.paddingTop || "0"), s = parseFloat(r.paddingBottom || "0"), c = this._parentNode.getBoundingClientRect(), l = c.height - o - s, u = c.width - i - a;
126
+ if (!e && this.state.height !== l || !t && this.state.width !== u) {
127
+ this.setState({
128
+ height: l,
129
+ width: u
130
+ });
131
+ let e = () => {
132
+ this._didLogDeprecationWarning || (this._didLogDeprecationWarning = !0, console.warn("scaledWidth and scaledHeight parameters have been deprecated; use width and height instead"));
133
+ };
134
+ typeof n == "function" && n({
135
+ height: l,
136
+ width: u,
137
+ get scaledHeight() {
138
+ return e(), l;
139
+ },
140
+ get scaledWidth() {
141
+ return e(), u;
142
+ }
143
+ });
144
+ }
145
+ }
146
+ }, this._setRef = (e) => {
147
+ this._autoSizer = e;
148
+ };
149
+ }
150
+ componentDidMount() {
151
+ let { nonce: e } = this.props, t = this._autoSizer ? this._autoSizer.parentNode : null;
152
+ if (t != null && t.ownerDocument && t.ownerDocument.defaultView && t instanceof t.ownerDocument.defaultView.HTMLElement) {
153
+ this._parentNode = t;
154
+ let n = t.ownerDocument.defaultView.ResizeObserver;
155
+ n == null ? (this._detectElementResize = A(e), this._detectElementResize.addResizeListener(t, this._onResize)) : (this._resizeObserver = new n(() => {
156
+ this._timeoutId = setTimeout(this._onResize, 0);
157
+ }), this._resizeObserver.observe(t)), this._onResize();
158
+ }
159
+ }
160
+ componentWillUnmount() {
161
+ this._parentNode && (this._detectElementResize && this._detectElementResize.removeResizeListener(this._parentNode, this._onResize), this._timeoutId !== null && clearTimeout(this._timeoutId), this._resizeObserver && this._resizeObserver.disconnect());
162
+ }
163
+ render() {
164
+ let { children: e, defaultHeight: t, defaultWidth: n, disableHeight: r = !1, disableWidth: i = !1, doNotBailOutOnEmptyChildren: a = !1, nonce: o, onResize: s, style: c = {}, tagName: l = "div", ...u } = this.props, { height: d, width: f } = this.state, p = { overflow: "visible" }, m = {}, h = !1;
165
+ return r || (d === 0 && (h = !0), p.height = 0, m.height = d, m.scaledHeight = d), i || (f === 0 && (h = !0), p.width = 0, m.width = f, m.scaledWidth = f), a && (h = !1), we(l, {
166
+ ref: this._setRef,
167
+ style: {
168
+ ...p,
169
+ ...c
170
+ },
171
+ ...u
172
+ }, !h && e(m));
173
+ }
174
+ }, M = {
175
+ "rp-pages": "_rp-pages_ruuiz_1",
176
+ "rp-page-scrolling-wrapper": "_rp-page-scrolling-wrapper_ruuiz_6",
177
+ "rp-pages-flow": "_rp-pages-flow_ruuiz_6",
178
+ "rp-document-wrapper": "_rp-document-wrapper_ruuiz_17",
179
+ "rp-page-row": "_rp-page-row_ruuiz_22",
180
+ "rp-pages-horizontal-scroll": "_rp-pages-horizontal-scroll_ruuiz_26",
181
+ "rp-not-supported-list": "_rp-not-supported-list_ruuiz_30",
182
+ "rp-pages-container": "_rp-pages-container_ruuiz_38",
183
+ "rp-viewer": "_rp-viewer_ruuiz_80",
184
+ "rp-cursor-grab": "_rp-cursor-grab_ruuiz_85",
185
+ "rp-cursor-grabbing": "_rp-cursor-grabbing_ruuiz_93",
186
+ "rp-loader": "_rp-loader_ruuiz_101",
187
+ "rp-not-supported": "_rp-not-supported_ruuiz_30",
188
+ "rp-not-supported-content": "_rp-not-supported-content_ruuiz_120",
189
+ "rp-load-error": "_rp-load-error_ruuiz_126",
190
+ "rp-load-error-message": "_rp-load-error-message_ruuiz_134"
191
+ }, Me = (e, t, n) => Math.max(t, Math.min(e, n)), N = 2, Ne = 800, Pe = (e) => ({
192
+ width: e.scrollWidth,
193
+ height: e.scrollHeight
194
+ }), Fe = (e, t, n, r, i) => {
195
+ let a = n.scrollTop - t.offsetTop, o = a + i, s = n.scrollLeft - t.offsetLeft, c = s + r, l = /* @__PURE__ */ new Map();
196
+ return e.forEach((e) => {
197
+ e.pages.forEach((e) => {
198
+ let t = e.left + e.width, n = e.top + e.height, r = Math.max(0, s - e.left), i = Math.max(0, a - e.top), u = Math.min(e.width, c - e.left), d = Math.min(e.height, o - e.top);
199
+ if (t <= s || e.left >= c || n <= a || e.top >= o) return;
200
+ let f = Math.max(0, u - r), p = Math.max(0, d - i), m = e.width * e.height || 1, h = Math.floor(f * p * 100 / m);
201
+ f > 0 && p > 0 && l.set(e.pageNumber, {
202
+ minX: r,
203
+ minY: i,
204
+ maxX: u,
205
+ maxY: d,
206
+ percent: h
207
+ });
208
+ });
209
+ }), l;
210
+ }, Ie = ({ row: e }) => /* @__PURE__ */ S("div", {
211
+ className: M["rp-page-row"],
212
+ style: {
213
+ position: "absolute",
214
+ top: e.top,
215
+ left: 0,
216
+ width: e.width,
217
+ height: e.height
218
+ },
219
+ children: e.pages.map((t) => /* @__PURE__ */ S(me, {
220
+ pageNumber: t.pageNumber,
221
+ style: {
222
+ position: "absolute",
223
+ left: t.left,
224
+ top: t.top - e.top,
225
+ width: t.width,
226
+ height: t.height
227
+ }
228
+ }, t.pageNumber))
229
+ }), Le = (t) => {
230
+ if (t === e.WASM_URL_REQUIRED) return o;
231
+ if (t === e.INVALID_OR_CORRUPTED_PDF) return a;
232
+ if (t === e.NOT_SUPPORTED) return i;
233
+ }, Re = ({ width: r, height: i }) => {
234
+ let { initialPage: a = 1, initialScrollMode: o } = c(), { pagesRef: pe } = f(), { scrollToPage: v } = oe(), { getPageScrollElementRef: me, getVirtualScrollableElementRef: he, setTotalInnerDimensions: ge, totalInnerDimensions: _e, virtualScrollableElementRef: Se, pageScrollElementRef: Ce } = d(), we = x(a > 1), [Oe, ke] = De(a > 1), { nextPage: C, prevPage: je, setFocusedPage: w, focusedPage: T, totalPages: E } = se(), { scrollMode: D } = l(), { viewMode: O } = u(), { loading: k, error: A, pages: j } = s(), { pageRotate: Re } = ee(), { LoaderImageComponent: ze } = fe(), { isFullScreen: Be } = le(), { onScroll: Ve } = p(), { widths: He, heights: Ue } = te(), We = ue(), { targetZoom: P, zoomOrigin: Ge, isZooming: F, previousTargetZoom: Ke, zoomGesture: qe } = h(), Je = m(_e, 100), Ye = x(null), I = x(_e), Xe = x({
235
+ viewMode: O,
236
+ scrollMode: D
237
+ }), L = x(null), R = x(null), z = x(null), B = x(null), V = x(!1), H = x(!1), U = x(P), Ze = Le(A), Qe = x(), W = x(), G = x(), K = x([]), $e = x([]), et = x(F), tt = x(), nt = x([]), [rt, it] = De(!1), q = x({
238
+ scrollTop: 0,
239
+ scrollLeft: 0
240
+ }), [J, at] = De(q.current), Y = D === t.PAGE_SCROLLING ? Ce ?? Se : Se ?? Ce, { isPressed: ot } = ye(), { initializeGrabScroll: st, resetGrabState: ct } = ve({ isPressed: ot }), { selectionMode: lt } = ce(), ut = lt === n.HAND, X = Ee(() => ne({
241
+ pageDimensions: {
242
+ widths: He,
243
+ heights: Ue
244
+ },
245
+ viewportWidth: r,
246
+ viewportHeight: i,
247
+ scrollMode: D,
248
+ viewMode: O,
249
+ focusedPage: T
250
+ }), [
251
+ T,
252
+ i,
253
+ Ue,
254
+ D,
255
+ O,
256
+ r,
257
+ He
258
+ ]), Z = Ee(() => ae(X, J.scrollTop, J.scrollLeft, r, i, 2), [
259
+ i,
260
+ X,
261
+ J.scrollLeft,
262
+ J.scrollTop,
263
+ r
264
+ ]), dt = (e, t) => Array.from(new Set([...e, ...t.map((e) => e.index)])).sort((e, t) => e - t), ft = Ee(() => F && K.current.length ? qe === "touch" ? ie(X, K.current, $e.current) : ie(X, dt(K.current, Z)) : rt && nt.current.length ? ie(X, dt(nt.current, Z)) : Z, [
265
+ Z,
266
+ rt,
267
+ F,
268
+ X,
269
+ qe
270
+ ]), pt = Ee(() => Fe(ft, X, J, r, i), [
271
+ i,
272
+ X,
273
+ J,
274
+ ft,
275
+ r
276
+ ]);
277
+ xe(Y, X), b(() => {
278
+ let e = et.current;
279
+ F || (e && K.current.length && (nt.current = K.current, clearTimeout(tt.current), it(!0), tt.current = setTimeout(() => {
280
+ nt.current = [], it(!1);
281
+ }, Ne)), K.current = Z.map((e) => e.index), $e.current = Z.flatMap((e) => e.pages.map((e) => e.pageNumber))), et.current = F;
282
+ }, [Z, F]), b(() => {
283
+ Array.from(pt.entries()).sort(([, e], [, t]) => t.percent - e.percent).forEach(([e], t) => {
284
+ We.changePagePriority(`^page-${e}$`, t);
285
+ });
286
+ }, [pt, We]), b(() => {
287
+ F && We.removeQueues(/^page-/);
288
+ }, [F, We]), b(() => {
289
+ k && ct();
290
+ }, [k, ct]), b(() => {
291
+ if (!Ze) return;
292
+ let e = requestAnimationFrame(() => {
293
+ Ye.current?.focus();
294
+ });
295
+ return () => {
296
+ cancelAnimationFrame(e);
297
+ };
298
+ }, [Ze]);
299
+ let Q = y((e) => {
300
+ let t = j.get(e);
301
+ return Re[e] ?? t?.defaultRotation ?? 0;
302
+ }, [Re, j]), mt = y((e, t = T) => {
303
+ let n = [], a = [];
304
+ for (let t = 1; t <= E; t += 1) {
305
+ let r = j.get(t);
306
+ if (!r) continue;
307
+ let i = Q(t), o = r.page.getViewport({
308
+ scale: 1,
309
+ rotation: i,
310
+ dontFlip: !0
311
+ });
312
+ n[t - 1] = o.width * e + 4, a[t - 1] = o.height * e + 4;
313
+ }
314
+ return ne({
315
+ pageDimensions: {
316
+ widths: n,
317
+ heights: a
318
+ },
319
+ viewportWidth: r,
320
+ viewportHeight: i,
321
+ scrollMode: D,
322
+ viewMode: O,
323
+ focusedPage: t
324
+ });
325
+ }, [
326
+ T,
327
+ Q,
328
+ i,
329
+ j,
330
+ D,
331
+ E,
332
+ O,
333
+ r
334
+ ]), ht = y((e, t, n) => {
335
+ let r = Y ? Math.max(0, n.scrollHeight - Y.clientHeight) : Math.max(0, n.scrollHeight), i = Y ? Math.max(0, n.scrollWidth - Y.clientWidth) : Math.max(0, n.scrollWidth);
336
+ return {
337
+ scrollTop: Math.round(Me(e, 0, r)) || 0,
338
+ scrollLeft: Math.round(Me(t, 0, i)) || 0
339
+ };
340
+ }, [Y]), $ = y((e) => ({
341
+ maxScrollTop: Y ? Math.max(0, e.scrollHeight - Y.clientHeight) : Math.max(0, e.scrollHeight),
342
+ maxScrollLeft: Y ? Math.max(0, e.scrollWidth - Y.clientWidth) : Math.max(0, e.scrollWidth)
343
+ }), [Y]), gt = y(() => Y ? [Y.clientWidth / 2, Y.clientHeight / 2] : null, [Y]), _t = y((e) => {
344
+ if (!Y) return {
345
+ scrollTop: 0,
346
+ scrollLeft: 0
347
+ };
348
+ let { maxScrollTop: t, maxScrollLeft: n } = $(e), r = q.current.scrollTop, i = q.current.scrollLeft, a = t > N && t - r <= N, o = n > N && n - i <= N;
349
+ return a || o || r > t || i > n ? q.current : {
350
+ scrollTop: Y.scrollTop,
351
+ scrollLeft: Y.scrollLeft
352
+ };
353
+ }, [$, Y]), vt = y((e, t, n, r, i) => {
354
+ if (!n || !r || !i || !j.size) return null;
355
+ let a = t + n[0] - i.offsetLeft, o = e + n[1] - i.offsetTop, s = re(i, a, o) ?? _(i, T);
356
+ if (!s) return null;
357
+ let c = j.get(s.pageNumber);
358
+ if (!c) return null;
359
+ let l = Q(s.pageNumber), u = c.page.getViewport({
360
+ scale: r,
361
+ rotation: l
362
+ }), d = g(s.width, s.height, u.width, u.height), f = Me(a - s.left - d.x, 0, u.width), p = Me(o - s.top - d.y, 0, u.height), [m, h] = u.convertToPdfPoint(f, p);
363
+ return {
364
+ pageNumber: s.pageNumber,
365
+ pdfX: m,
366
+ pdfY: h,
367
+ origin: n
368
+ };
369
+ }, [
370
+ T,
371
+ Q,
372
+ j
373
+ ]), yt = y((e, t, n, r, i) => {
374
+ if (!i) return null;
375
+ let a = vt(e, t, n, r, i), { maxScrollTop: o, maxScrollLeft: s } = $(i), c = a?.pageNumber === 1, l = a?.pageNumber === E, u = (o <= N || e <= N) && c ? "start" : o > N && l && o - e <= N ? "end" : null;
376
+ return {
377
+ location: a,
378
+ edgeX: (s <= N || t <= N) && c ? "start" : s > N && l && s - t <= N ? "end" : null,
379
+ edgeY: u,
380
+ previousScale: r
381
+ };
382
+ }, [
383
+ vt,
384
+ $,
385
+ E
386
+ ]), bt = y((e, t, n) => {
387
+ let r = j.get(t.pageNumber), i = _(n, t.pageNumber);
388
+ if (!r || !i || !e) return null;
389
+ let a = Q(t.pageNumber), o = r.page.getViewport({
390
+ scale: e,
391
+ rotation: a
392
+ }), [s, c] = o.convertToViewportPoint(t.pdfX, t.pdfY), l = g(i.width, i.height, o.width, o.height);
393
+ return {
394
+ left: n.offsetLeft + i.left + l.x + s - t.origin[0],
395
+ top: n.offsetTop + i.top + l.y + c - t.origin[1]
396
+ };
397
+ }, [Q, j]), xt = y((e, t, n, r, i, a, o = !0) => {
398
+ let s = e?.location ? bt(t, e.location, n) : null, c = a ? t / a : 1, l = s ?? {
399
+ left: (r.scrollLeft + i[0]) * c - i[0],
400
+ top: (r.scrollTop + i[1]) * c - i[1]
401
+ }, { maxScrollTop: u, maxScrollLeft: d } = $(n), f = o && e && t < e.previousScale ? {
402
+ top: e.edgeY === "start" ? 0 : e.edgeY === "end" ? u : l.top,
403
+ left: e.edgeX === "start" ? 0 : e.edgeX === "end" ? d : l.left
404
+ } : l;
405
+ return ht(f.top, f.left, n);
406
+ }, [
407
+ bt,
408
+ ht,
409
+ $
410
+ ]), St = y((e, t) => {
411
+ (V.current || z.current || B.current) && (H.current = !0), Y?.scrollTo({
412
+ top: e,
413
+ left: t,
414
+ behavior: "auto"
415
+ }), q.current = {
416
+ scrollTop: e,
417
+ scrollLeft: t
418
+ }, at(q.current);
419
+ }, [Y]), Ct = y(({ gesture: e, origin: t, previousScale: n, nextScale: r }) => {
420
+ if (!n || !r) return;
421
+ let i = t ?? gt();
422
+ if (!i) return;
423
+ e === "touch" && (V.current = !0);
424
+ let a = B.current, o = a?.scale || U.current || n, s = a?.layout ?? L.current ?? X, c = a?.scrollTop ?? q.current.scrollTop, l = a?.scrollLeft ?? q.current.scrollLeft, u = mt(r), d = yt(c, l, i, o, s), f = xt(d, r, u, {
425
+ scrollTop: c,
426
+ scrollLeft: l
427
+ }, i, o, e !== "touch");
428
+ z.current = {
429
+ anchor: d,
430
+ nextScale: r,
431
+ targetScrollTop: f.scrollTop,
432
+ targetScrollLeft: f.scrollLeft,
433
+ targetLayout: u
434
+ }, B.current = {
435
+ scale: r,
436
+ layout: u,
437
+ scrollTop: f.scrollTop,
438
+ scrollLeft: f.scrollLeft
439
+ }, R.current = d;
440
+ }, [
441
+ xt,
442
+ yt,
443
+ gt,
444
+ mt,
445
+ X
446
+ ]), wt = y(() => {
447
+ V.current = !1, H.current = !1, z.current || (B.current = null, R.current = null);
448
+ }, []), Tt = y(() => {
449
+ V.current = !1, H.current = !1, z.current = null, B.current = null, R.current = null;
450
+ }, []);
451
+ be(Y || pe, {
452
+ onBeforeZoom: Ct,
453
+ onPinchEnd: wt
454
+ });
455
+ let Et = y((e, t) => {
456
+ if (Xe.current.viewMode !== O || Xe.current.scrollMode !== D) {
457
+ W.current && clearTimeout(W.current), R.current = null, Tt(), v(T, "auto"), W.current = setTimeout(() => {
458
+ requestAnimationFrame(() => {
459
+ Xe.current = {
460
+ viewMode: O,
461
+ scrollMode: D
462
+ }, L.current = X, U.current = P;
463
+ });
464
+ }, 100);
465
+ return;
466
+ }
467
+ let n = e.scrollTop, r = e.scrollLeft;
468
+ if (!t.height || !t.width) return;
469
+ let { height: i, width: o } = t, { height: s, width: c } = I.current, l = L.current, u = Math.abs(U.current - P) > 1e-10, d = Ge ?? gt(), f = u && !!d, p = U.current || Ke || P, m = z.current, h = m?.nextScale ?? P;
470
+ if (s === i && c === o) {
471
+ if (m) {
472
+ St(m.targetScrollTop, m.targetScrollLeft), R.current = null, z.current = null, V.current || (B.current = null, H.current = !1), L.current = m.targetLayout, U.current = m.nextScale, I.current = {
473
+ height: t.height,
474
+ width: t.width
475
+ };
476
+ return;
477
+ }
478
+ if (f && l) {
479
+ R.current = yt(n, r, d, p, l);
480
+ return;
481
+ }
482
+ L.current = X, U.current = P;
483
+ return;
484
+ }
485
+ if (we.current && a > 1) {
486
+ R.current = null, Tt(), I.current = {
487
+ height: t.height,
488
+ width: t.width
489
+ }, L.current = X, U.current = P;
490
+ return;
491
+ }
492
+ if (!s || !c) {
493
+ R.current = null, Tt(), I.current = {
494
+ height: t.height,
495
+ width: t.width
496
+ }, L.current = X, U.current = P;
497
+ return;
498
+ }
499
+ let ee = !!m, te = !!R.current?.location;
500
+ if (n === 0 && r === 0 && !(ee || (u || te) && (d || te))) {
501
+ I.current = {
502
+ height: t.height,
503
+ width: t.width
504
+ }, L.current = X, U.current = P;
505
+ return;
506
+ }
507
+ let ne = n / s * i, g = r / c * o, re = !1;
508
+ if (m) g = m.targetScrollLeft, ne = m.targetScrollTop, re = !0;
509
+ else if ((u || te) && l && d) {
510
+ let e = xt(R.current ?? yt(n, r, d, p, l), P, X, {
511
+ scrollTop: n,
512
+ scrollLeft: r
513
+ }, d, p);
514
+ g = e.scrollLeft, ne = e.scrollTop, re = !0;
515
+ }
516
+ let _ = ht(ne, g, X);
517
+ re ? St(_.scrollTop, _.scrollLeft) : Qe.current = setTimeout(() => {
518
+ requestAnimationFrame(() => {
519
+ St(_.scrollTop, _.scrollLeft);
520
+ });
521
+ }, 0), R.current = null, z.current = null, V.current || (B.current = null, H.current = !1), I.current = {
522
+ height: t.height,
523
+ width: t.width
524
+ }, L.current = X, U.current = h;
525
+ }, [
526
+ xt,
527
+ yt,
528
+ T,
529
+ gt,
530
+ a,
531
+ X,
532
+ Ke,
533
+ Tt,
534
+ D,
535
+ v,
536
+ St,
537
+ P,
538
+ O,
539
+ Ge
540
+ ]);
541
+ Te(() => {
542
+ clearTimeout(Qe.current);
543
+ let e = Pe(X), t = !!z.current, n = t ? q.current : _t(X);
544
+ t || (q.current = n, at(n)), Et(n, e), ge(e);
545
+ }, [
546
+ _t,
547
+ X,
548
+ ge,
549
+ Et
550
+ ]);
551
+ let Dt = y((e) => {
552
+ let t = document.activeElement !== pe;
553
+ !Be && t || (["ArrowUp", "ArrowLeft"].includes(e.key) ? (e.preventDefault(), je()) : ["ArrowDown", "ArrowRight"].includes(e.key) && (e.preventDefault(), C()));
554
+ }, [
555
+ Be,
556
+ C,
557
+ pe,
558
+ je
559
+ ]);
560
+ b(() => (window.addEventListener("keydown", Dt), () => {
561
+ window.removeEventListener("keydown", Dt);
562
+ }), [Dt]), b(() => () => {
563
+ W.current && clearTimeout(W.current), clearTimeout(tt.current), G.current && cancelAnimationFrame(G.current);
564
+ }, []), b(() => {
565
+ Je.height === 0 || !we.current || Y && (v(a, "auto"), requestAnimationFrame(() => {
566
+ w(a), we.current = !1, ke(!1);
567
+ }));
568
+ }, [
569
+ Je.height,
570
+ a,
571
+ o,
572
+ v,
573
+ Y,
574
+ w
575
+ ]);
576
+ let Ot = y((e) => {
577
+ e && (he(e), me(e), ut && st(e));
578
+ }, [
579
+ me,
580
+ he,
581
+ st,
582
+ ut
583
+ ]), kt = y((e) => {
584
+ let t = e.currentTarget, n = {
585
+ scrollTop: t.scrollTop,
586
+ scrollLeft: t.scrollLeft
587
+ };
588
+ if (V.current || z.current || H.current) {
589
+ H.current = !1, Ve?.(e.nativeEvent);
590
+ return;
591
+ }
592
+ q.current = n, G.current && cancelAnimationFrame(G.current), G.current = requestAnimationFrame(() => {
593
+ at(n);
594
+ }), Ve?.(e.nativeEvent);
595
+ }, [Ve]);
596
+ return A === e.INVALID_OR_CORRUPTED_PDF ? /* @__PURE__ */ S("div", {
597
+ ref: Ye,
598
+ className: M["rp-load-error"],
599
+ style: {
600
+ width: r,
601
+ height: i
602
+ },
603
+ tabIndex: -1,
604
+ role: "alert",
605
+ "aria-live": "assertive",
606
+ "aria-atomic": "true",
607
+ children: /* @__PURE__ */ S("div", {
608
+ className: M["rp-load-error-message"],
609
+ children: "Invalid or corrupted PDF file."
610
+ })
611
+ }) : A === e.NOT_SUPPORTED ? /* @__PURE__ */ S("div", {
612
+ className: M["rp-not-supported"],
613
+ style: {
614
+ width: r,
615
+ height: i
616
+ },
617
+ children: /* @__PURE__ */ Ae("div", {
618
+ className: M["rp-not-supported-content"],
619
+ children: ["React PDF Kit is unable to render on this browser. Please use the supported browsers from the list below:", /* @__PURE__ */ S("div", { children: /* @__PURE__ */ Ae("ul", {
620
+ className: M["rp-not-supported-list"],
621
+ children: [
622
+ /* @__PURE__ */ S("li", { children: "Chrome 126+" }),
623
+ /* @__PURE__ */ S("li", { children: "Edge 126+" }),
624
+ /* @__PURE__ */ S("li", { children: "Firefox 126+" }),
625
+ /* @__PURE__ */ S("li", { children: "Safari 18.4+" }),
626
+ /* @__PURE__ */ S("li", { children: "Safari iOS 18.4+" }),
627
+ /* @__PURE__ */ S("li", { children: "Chrome Android 126+" })
628
+ ]
629
+ }) })]
630
+ })
631
+ }) : !X.pages.length && !k && !A ? /* @__PURE__ */ S("div", {
632
+ className: M["rp-loader"],
633
+ style: {
634
+ width: r,
635
+ height: i
636
+ },
637
+ children: ze && /* @__PURE__ */ S(ze, {})
638
+ }) : /* @__PURE__ */ S("div", {
639
+ "data-rp": "pages",
640
+ ref: Ot,
641
+ className: de(M["rp-pages"], M["rp-pages-flow"], D === t.HORIZONTAL_SCROLLING && M["rp-pages-horizontal-scroll"], D === t.PAGE_SCROLLING && M["rp-page-scrolling-wrapper"]),
642
+ onScroll: kt,
643
+ style: {
644
+ width: r,
645
+ height: i,
646
+ ...Oe && { visibility: "hidden" }
647
+ },
648
+ children: /* @__PURE__ */ S("div", {
649
+ className: M["rp-document-wrapper"],
650
+ style: {
651
+ width: X.documentWidth,
652
+ height: X.documentHeight,
653
+ marginLeft: X.offsetLeft,
654
+ marginTop: X.offsetTop,
655
+ "--rp-pages-height": `${X.documentHeight}px`,
656
+ "--rp-pages-width": `${X.documentWidth}px`
657
+ },
658
+ children: ft.map((e) => /* @__PURE__ */ S(Ie, { row: e }, e.index))
659
+ })
660
+ });
661
+ }, ze = () => {
662
+ let e = x(new Oe()), { pagesRef: t, setPagesRef: i, setContentRef: a } = f(), { passwordRequired: o } = r(), { onTextSelect: s } = p(), { selectionMode: c } = ce(), { isPressed: l } = ye(), u = c === n.HAND, d = Ee(() => de(M["rp-pages-container"], {
663
+ [M["rp-cursor-grab"]]: u && !l,
664
+ [M["rp-cursor-grabbing"]]: u && l
665
+ }), [u, l]);
666
+ return _e(t), Se({
667
+ onTextSelect: s,
668
+ pagesRef: t
669
+ }), /* @__PURE__ */ Ae(ke, { children: [/* @__PURE__ */ S(v, {
670
+ ref: a,
671
+ children: /* @__PURE__ */ S(pe, {
672
+ ref: i,
673
+ tabIndex: -1,
674
+ className: d,
675
+ style: {
676
+ "--scale-round-x": `${ge(e.current.sx)[1]}px`,
677
+ "--scale-round-y": `${ge(e.current.sy)[1]}px`
678
+ },
679
+ children: /* @__PURE__ */ S(j, {
680
+ style: { minHeight: "50px" },
681
+ children: ({ width: e, height: t }) => /* @__PURE__ */ S(Re, {
682
+ width: e,
683
+ height: t
684
+ })
685
+ })
686
+ })
687
+ }), o && /* @__PURE__ */ S(he, {})] });
688
+ };
689
+ //#endregion
690
+ export { ze as t };