@react-pdf-kit/viewer 2.0.0-beta.0 → 2.0.0-beta.2

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 (201) hide show
  1. package/dist/{LayoutWrapper-a871c161.js → LayoutWrapper-6224491f.js} +1 -1
  2. package/dist/{RotateTool.module-03987eba.js → RotateTool.module-67946714.js} +1 -1
  3. package/dist/{SearchCloseButton-cbf182aa.js → SearchCloseButton-08d57275.js} +1 -1
  4. package/dist/ToolbarLayout.module-3a77cc37.js +3556 -0
  5. package/dist/assets/style.css +1 -0
  6. package/dist/assets/style.js +74 -0
  7. package/dist/components/RPConfig.js +14 -1489
  8. package/dist/components/RPController.js +175 -61
  9. package/dist/components/RPDropFileZone.js +26 -12
  10. package/dist/components/RPPages.js +82 -8
  11. package/dist/components/RPProvider.js +173 -19
  12. package/dist/components/RPTheme.js +6 -5
  13. package/dist/components/icons/DualPageIcon.js +6 -6
  14. package/dist/components/icons/LoaderIcon.js +1 -1
  15. package/dist/components/icons/SinglePageIcon.js +6 -6
  16. package/dist/components/layout/Container.js +1 -1
  17. package/dist/components/layout/LayoutContainer.js +87 -7
  18. package/dist/components/layout/LayoutWrapper.js +2 -1
  19. package/dist/components/layout/RPDefaultLayout.js +127 -3
  20. package/dist/components/layout/RPLayout.js +108 -20
  21. package/dist/components/layout/WrapperLayout.js +22 -9
  22. package/dist/components/layout/sidebar/RPSidebar.js +127 -2
  23. package/dist/components/layout/sidebar/RPSplitter.js +1 -1
  24. package/dist/components/layout/sidebar/Thumbnail.js +89 -8
  25. package/dist/components/layout/sidebar/Thumbnails.js +134 -2
  26. package/dist/components/layout/toolbar/DarkModeTool.js +22 -13
  27. package/dist/components/layout/toolbar/DocumentDialog.js +89 -8
  28. package/dist/components/layout/toolbar/DocumentProperties.js +18 -8
  29. package/dist/components/layout/toolbar/FileDownloadTool.js +127 -2
  30. package/dist/components/layout/toolbar/FileUploadTool.js +31 -10
  31. package/dist/components/layout/toolbar/FullScreenTool.js +39 -27
  32. package/dist/components/layout/toolbar/MenuItem.js +12 -8
  33. package/dist/components/layout/toolbar/MenuSeparator.js +8 -4
  34. package/dist/components/layout/toolbar/MostPageTool.js +89 -9
  35. package/dist/components/layout/toolbar/OtherTool.js +119 -3
  36. package/dist/components/layout/toolbar/Paginate.js +123 -2
  37. package/dist/components/layout/toolbar/PrintTool.js +127 -2
  38. package/dist/components/layout/toolbar/PropertyItem.js +1 -1
  39. package/dist/components/layout/toolbar/RPMenuItem.js +20 -13
  40. package/dist/components/layout/toolbar/RPMoreOptions.js +169 -44
  41. package/dist/components/layout/toolbar/RPToolbar.js +133 -3
  42. package/dist/components/layout/toolbar/RPToolbarEnd.js +133 -2
  43. package/dist/components/layout/toolbar/RotateTool.js +39 -18
  44. package/dist/components/layout/toolbar/ScrollModeTool.js +27 -18
  45. package/dist/components/layout/toolbar/SearchCloseButton.js +11 -2
  46. package/dist/components/layout/toolbar/SearchResultNavigator.js +133 -3
  47. package/dist/components/layout/toolbar/SearchTool.js +87 -8
  48. package/dist/components/layout/toolbar/SelectionModeTool.js +19 -10
  49. package/dist/components/layout/toolbar/ThumbnailTool.js +139 -10
  50. package/dist/components/layout/toolbar/ToolbarCustom.js +104 -23
  51. package/dist/components/layout/toolbar/ToolbarDefault.js +113 -31
  52. package/dist/components/layout/toolbar/ToolbarLayout.js +145 -6
  53. package/dist/components/layout/toolbar/ViewModeTool.js +28 -19
  54. package/dist/components/layout/toolbar/ZoomTool.js +138 -128
  55. package/dist/components/layout/toolbar/tools/DocumentPropertiesTool.js +137 -7
  56. package/dist/components/layout/toolbar/tools/DualPageTool.js +144 -0
  57. package/dist/components/layout/toolbar/tools/FileDownloadTool.js +140 -9
  58. package/dist/components/layout/toolbar/tools/FileUploadTool.js +27 -8
  59. package/dist/components/layout/toolbar/tools/FullScreenTool.js +23 -13
  60. package/dist/components/layout/toolbar/tools/InputPageTool.js +157 -26
  61. package/dist/components/layout/toolbar/tools/NextPageTool.js +89 -9
  62. package/dist/components/layout/toolbar/tools/PreviousPageTool.js +142 -11
  63. package/dist/components/layout/toolbar/tools/PrintTool.js +138 -7
  64. package/dist/components/layout/toolbar/tools/RotateClockwiseTool.js +29 -8
  65. package/dist/components/layout/toolbar/tools/RotateCounterclockwiseTool.js +32 -11
  66. package/dist/components/layout/toolbar/tools/SelectionModeSwitcherTool.js +29 -0
  67. package/dist/components/layout/toolbar/tools/SinglePageTool.js +144 -0
  68. package/dist/components/layout/toolbar/tools/ThemeSwitcherTool.js +15 -6
  69. package/dist/components/layout/toolbar/tools/ThumbnailTool.js +142 -11
  70. package/dist/components/layout/toolbar/tools/ZoomInTool.js +47 -20
  71. package/dist/components/layout/toolbar/tools/ZoomLevelDisplay.js +140 -0
  72. package/dist/components/layout/toolbar/tools/ZoomLevelTool.js +158 -29
  73. package/dist/components/layout/toolbar/tools/ZoomOutTool.js +45 -18
  74. package/dist/components/layout/toolbar/tools/defaults/RPHorizontalBar.js +104 -19
  75. package/dist/components/layout/toolbar/tools/defaults/RPVerticalBar.js +144 -11
  76. package/dist/components/layout/toolbar/tools/more-options/DocumentProperties.js +15 -5
  77. package/dist/components/layout/toolbar/tools/more-options/FileDownloadTool.js +141 -11
  78. package/dist/components/layout/toolbar/tools/more-options/FileUploadTool.js +90 -9
  79. package/dist/components/layout/toolbar/tools/more-options/FullScreenTool.js +21 -9
  80. package/dist/components/layout/toolbar/tools/more-options/MostPageTool.js +90 -10
  81. package/dist/components/layout/toolbar/tools/more-options/PrintTool.js +137 -7
  82. package/dist/components/layout/toolbar/tools/more-options/RotateTool.js +33 -12
  83. package/dist/components/layout/toolbar/tools/more-options/ScrollModeTool.js +23 -14
  84. package/dist/components/layout/toolbar/tools/more-options/SelectionModeTool.js +22 -13
  85. package/dist/components/layout/toolbar/tools/more-options/ViewModeTool.js +27 -18
  86. package/dist/components/page/AnnotationLayer.js +87 -9
  87. package/dist/components/page/CanvasLayer.js +90 -8
  88. package/dist/components/page/CustomElement.js +49 -18
  89. package/dist/components/page/DualPage.js +136 -2
  90. package/dist/components/page/RPPage.js +88 -8
  91. package/dist/components/page/SinglePage.js +136 -2
  92. package/dist/components/page/TextHighlightLayer.js +88 -8
  93. package/dist/components/page/TextLayer.js +89 -9
  94. package/dist/components/ui/Button.js +9 -8
  95. package/dist/components/ui/Checkbox.js +6 -5
  96. package/dist/components/ui/DropDown.js +18 -14
  97. package/dist/components/ui/Input.js +10 -9
  98. package/dist/components/ui/LoadingIndicator.js +135 -2
  99. package/dist/components/ui/PasswordModal.js +18 -15
  100. package/dist/components/ui/RPTooltip.js +202 -415
  101. package/dist/contexts/DimensionPagesContext.js +35 -17
  102. package/dist/contexts/DropFileZoneContext.js +32 -22
  103. package/dist/contexts/ElementPageContext.js +114 -51
  104. package/dist/contexts/EventCallbackContext.js +30 -0
  105. package/dist/contexts/FileInputContext.js +32 -22
  106. package/dist/contexts/GlobalCurrentPage.js +13 -10
  107. package/dist/contexts/HighlightContext.js +24 -11
  108. package/dist/contexts/LicenseContext.js +1 -0
  109. package/dist/contexts/LoaderContext.js +10 -9
  110. package/dist/contexts/LocalizationContext.js +11 -10
  111. package/dist/contexts/PagesRotateContext.js +36 -18
  112. package/dist/contexts/PaginationContext.js +135 -4
  113. package/dist/contexts/PrintContext.js +138 -4
  114. package/dist/contexts/RPDocumentContext.js +46 -28
  115. package/dist/contexts/RenderQueueProvider.js +136 -4
  116. package/dist/contexts/RotationContext.js +25 -15
  117. package/dist/contexts/ScrollModeContext.js +7 -6
  118. package/dist/contexts/SearchContext.js +138 -4
  119. package/dist/contexts/SelectionModeContext.js +5 -4
  120. package/dist/contexts/ThumbnailsContext.js +138 -4
  121. package/dist/contexts/ViewModeContext.js +10 -9
  122. package/dist/contexts/ZoomContext.js +34 -24
  123. package/dist/index-808ea7bf.js +1685 -0
  124. package/dist/index-a48ec088.js +1672 -0
  125. package/dist/{index-35c7f4a2.js → index-c9a2990a.js} +3 -3
  126. package/dist/libInjectCss.js +9 -0
  127. package/dist/main.js +222 -84
  128. package/dist/types/assets/style.d.ts +1 -0
  129. package/dist/types/components/icons/DualPageIcon.d.ts +1 -1
  130. package/dist/types/components/icons/SinglePageIcon.d.ts +1 -1
  131. package/dist/types/components/layout/toolbar/tools/DualPageTool.d.ts +3 -0
  132. package/dist/types/components/layout/toolbar/tools/SelectionModeSwitcherTool.d.ts +3 -0
  133. package/dist/types/components/layout/toolbar/tools/SinglePageTool.d.ts +3 -0
  134. package/dist/types/components/layout/toolbar/tools/ZoomLevelDisplay.d.ts +7 -0
  135. package/dist/types/contexts/EventCallbackContext.d.ts +5 -0
  136. package/dist/types/contexts/RenderQueueProvider.d.ts +2 -2
  137. package/dist/types/libInjectCss.d.ts +1 -0
  138. package/dist/types/main.d.ts +5 -5
  139. package/dist/types/utils/annotations.d.ts +1 -2
  140. package/dist/types/utils/approximateFragtion.d.ts +9 -0
  141. package/dist/types/utils/getElementPositionInPage.d.ts +5 -0
  142. package/dist/types/utils/hooks/useCopyText.d.ts +1 -0
  143. package/dist/types/utils/hooks/usePrint.d.ts +3 -2
  144. package/dist/types/utils/hooks/useSearch.d.ts +1 -2
  145. package/dist/types/utils/injectPrintCSS.d.ts +1 -0
  146. package/dist/types/utils/link_service.d.ts +11 -1
  147. package/dist/types/utils/renderPage.d.ts +2 -2
  148. package/dist/types/utils/types.d.ts +38 -5
  149. package/dist/types/utils/zoom.d.ts +2 -0
  150. package/dist/utils/annotations.js +48 -58
  151. package/dist/utils/approximateFragtion.js +22 -0
  152. package/dist/utils/getElementPositionInPage.js +84 -0
  153. package/dist/utils/getWordPositionInPage.js +5 -5
  154. package/dist/utils/getZoomLevel.js +9 -8
  155. package/dist/utils/highlight.js +72 -72
  156. package/dist/utils/hooks/useCopyText.js +36 -0
  157. package/dist/utils/hooks/useDarkModeProps.js +3 -2
  158. package/dist/utils/hooks/useFileDownload.js +90 -8
  159. package/dist/utils/hooks/useHighlight.js +13 -12
  160. package/dist/utils/hooks/useLicense.js +1 -1
  161. package/dist/utils/hooks/useLoadPdf.js +44 -36
  162. package/dist/utils/hooks/useLoadWorker.js +8 -8
  163. package/dist/utils/hooks/usePageRotateContext.js +33 -17
  164. package/dist/utils/hooks/usePaginate.js +88 -8
  165. package/dist/utils/hooks/usePinch.js +62 -41
  166. package/dist/utils/hooks/usePresentPage.js +88 -8
  167. package/dist/utils/hooks/usePrint.js +90 -9
  168. package/dist/utils/hooks/useRotate.js +21 -7
  169. package/dist/utils/hooks/useScrollToPage.js +86 -8
  170. package/dist/utils/hooks/useSearch.js +86 -8
  171. package/dist/utils/hooks/useThumbnail.js +89 -8
  172. package/dist/utils/hooks/useVirtualReactWindow.js +88 -8
  173. package/dist/utils/hooks/useWatermark.js +18 -15
  174. package/dist/utils/injectPrintCSS.js +22 -0
  175. package/dist/utils/link_service.js +49 -9
  176. package/dist/utils/renderPage.js +13 -10
  177. package/dist/utils/zoom.js +6 -0
  178. package/package.json +5 -6
  179. package/dist/ToolbarLayout.module-c588d36b.js +0 -3411
  180. package/dist/ZoomTool.module-6c5eabbb.js +0 -12
  181. package/dist/assets/Button.css +0 -1
  182. package/dist/assets/Checkbox.css +0 -1
  183. package/dist/assets/Container.css +0 -1
  184. package/dist/assets/DropDown.css +0 -1
  185. package/dist/assets/Input.css +0 -1
  186. package/dist/assets/LayoutWrapper.css +0 -1
  187. package/dist/assets/LoaderIcon.css +0 -1
  188. package/dist/assets/MenuItem.css +0 -1
  189. package/dist/assets/MenuSeparator.css +0 -1
  190. package/dist/assets/PasswordModal.css +0 -1
  191. package/dist/assets/PropertyItem.css +0 -1
  192. package/dist/assets/RPDropFileZone.css +0 -1
  193. package/dist/assets/RPSplitter.css +0 -1
  194. package/dist/assets/RPTooltip.css +0 -1
  195. package/dist/assets/RotateTool.css +0 -1
  196. package/dist/assets/SearchCloseButton.css +0 -1
  197. package/dist/assets/ToolbarLayout.css +0 -1
  198. package/dist/assets/WrapperLayout.css +0 -1
  199. package/dist/assets/ZoomTool.css +0 -1
  200. package/dist/floating-ui.react-dom-6b2fe0df.js +0 -1474
  201. package/dist/index-f563c6f0.js +0 -1889
@@ -1,19 +1,19 @@
1
- import { getCharacterType as X } from "./charators.js";
2
- function V(r, c, a, i) {
1
+ import { getCharacterType as D } from "./charators.js";
2
+ function V(r, c, u, i) {
3
3
  const o = [];
4
4
  for (const n of r) {
5
5
  const s = y(c, n, i);
6
- o.push(...I(s, c, a));
6
+ o.push(...I(s, c, u));
7
7
  }
8
8
  return o;
9
9
  }
10
- const D = (r, c) => {
11
- const a = ["g"];
12
- c.matchCase || a.push("i");
10
+ const X = (r, c) => {
11
+ const u = ["g"];
12
+ c.matchCase || u.push("i");
13
13
  let o = r.replace(/[.^$*+?()[{|\\]/g, (n) => `\\${n}`).trim();
14
- return new RegExp(o, a.join(""));
14
+ return new RegExp(o, u.join(""));
15
15
  };
16
- function y(r, c, a) {
16
+ function y(r, c, u) {
17
17
  const i = [];
18
18
  for (const t of r.items)
19
19
  if (t.hasEOL)
@@ -27,14 +27,14 @@ function y(r, c, a) {
27
27
  i.push(t.str);
28
28
  const o = i.join("").replace(/\n/g, " ");
29
29
  let n;
30
- c instanceof RegExp ? n = c.flags.indexOf("g") === -1 ? new RegExp(c, `${c.flags}g`) : c : n = D(c, a);
30
+ c instanceof RegExp ? n = c.flags.indexOf("g") === -1 ? new RegExp(c, `${c.flags}g`) : c : n = X(c, u);
31
31
  const s = [];
32
32
  let e;
33
33
  for (; (e = n.exec(o)) !== null; )
34
- a.wholeWords && !L(o, e.index, e[0].length) || s.push([e.index, e[0].length, e[0]]);
34
+ u.wholeWords && !L(o, e.index, e[0].length) || s.push([e.index, e[0].length, e[0]]);
35
35
  return s;
36
36
  }
37
- function I(r, c, a) {
37
+ function I(r, c, u) {
38
38
  function i(l) {
39
39
  return l.hasEOL ? l.str.endsWith("-") ? -1 : 1 : 0;
40
40
  }
@@ -46,7 +46,7 @@ function I(r, c, a) {
46
46
  const f = s[o];
47
47
  n += f.str.length + i(f), o++;
48
48
  }
49
- const p = {
49
+ const h = {
50
50
  idx: o,
51
51
  offset: d - n
52
52
  };
@@ -59,81 +59,81 @@ function I(r, c, a) {
59
59
  offset: d - n
60
60
  };
61
61
  t.push({
62
- start: p,
62
+ start: h,
63
63
  end: m,
64
64
  str: r[l][2],
65
65
  oIndex: r[l][0],
66
- pageIndex: a,
66
+ pageIndex: u,
67
67
  rect: {
68
68
  left: 0,
69
- top: 0,
69
+ bottom: 0,
70
70
  width: 0,
71
71
  height: 0
72
72
  }
73
73
  });
74
74
  }
75
75
  for (const l of t) {
76
- const d = s[l.start.idx], p = s[l.end.idx], m = d.transform[4], f = d.transform[5], E = m + d.width * l.start.offset / d.str.length, h = f, b = m + p.width * l.end.offset / p.str.length, N = f, u = {
77
- left: Math.min(E, b),
78
- top: Math.min(h, N),
79
- width: Math.abs(b - E),
80
- height: Math.max(d.height, p.height)
76
+ const d = s[l.start.idx], h = s[l.end.idx], m = d.transform[4] + l.start.offset * (d.width / d.str.length), f = d.transform[5], E = h.transform[4] + l.end.offset * (h.width / h.str.length), a = h.transform[5], M = {
77
+ left: Math.min(m, E),
78
+ bottom: Math.min(f, a),
79
+ width: Math.abs(E - m),
80
+ height: Math.max(d.height, h.height)
81
81
  };
82
- l.rect = u;
82
+ l.rect = M;
83
83
  }
84
84
  return t;
85
85
  }
86
- function L(r, c, a) {
86
+ function L(r, c, u) {
87
87
  let i = r.slice(0, c).match(/([^\p{M}])\p{M}*$/u);
88
88
  if (i) {
89
89
  const o = r.charCodeAt(c), n = i[1].charCodeAt(0);
90
- if (X(o) === X(n))
90
+ if (D(o) === D(n))
91
91
  return !1;
92
92
  }
93
- if (i = r.slice(c + a).match(/^\p{M}*([^\p{M}])/u), i) {
94
- const o = r.charCodeAt(c + a - 1), n = i[1].charCodeAt(0);
95
- if (X(o) === X(n))
93
+ if (i = r.slice(c + u).match(/^\p{M}*([^\p{M}])/u), i) {
94
+ const o = r.charCodeAt(c + u - 1), n = i[1].charCodeAt(0);
95
+ if (D(o) === D(n))
96
96
  return !1;
97
97
  }
98
98
  return !0;
99
99
  }
100
- function H(r, c, a) {
100
+ function H(r, c, u) {
101
101
  const i = [];
102
102
  function o(n, s, e = -1, t = -1, l = "") {
103
- const d = c.items[n], p = [];
104
- let m = "", f = "", E = "", h = a[n];
105
- if (!h)
103
+ const d = c.items[n], h = [];
104
+ let m = "", f = "", E = "", a = u[n];
105
+ if (!a)
106
106
  return;
107
- if (h.nodeType === Node.TEXT_NODE) {
108
- const u = document.createElement("span");
109
- h.before(u), u.append(h), a[n] = u, h = u;
107
+ if (a.nodeType === Node.TEXT_NODE) {
108
+ const p = document.createElement("span");
109
+ a.before(p), p.append(a), u[n] = p, a = p;
110
110
  }
111
111
  e >= 0 && t >= 0 ? m = d.str.substring(e, t) : e < 0 && t < 0 ? m = d.str : e >= 0 ? m = d.str.substring(e) : t >= 0 && (m = d.str.substring(0, t));
112
- const b = document.createTextNode(m), N = document.createElement("span");
113
- if (N.className = "highlight appended " + l, N.setAttribute("data-match-index", `${s}`), N.append(b), p.push(N), i.push({ element: N, index: s }), e > 0)
114
- if (h.childNodes.length === 1 && h.childNodes[0].nodeType === Node.TEXT_NODE) {
112
+ const M = document.createTextNode(m), N = document.createElement("span");
113
+ if (N.className = "highlight appended " + l, N.setAttribute("data-match-index", `${s}`), N.append(M), h.push(N), i.push({ element: N, index: s }), e > 0)
114
+ if (a.childNodes.length === 1 && a.childNodes[0].nodeType === Node.TEXT_NODE) {
115
115
  f = d.str.substring(0, e);
116
- const u = document.createTextNode(f);
117
- p.unshift(u);
116
+ const p = document.createTextNode(f);
117
+ h.unshift(p);
118
118
  } else {
119
- let u = 0;
120
- const C = [];
121
- for (const g of h.childNodes) {
119
+ let p = 0;
120
+ const b = [];
121
+ for (const g of a.childNodes) {
122
122
  const x = g.nodeType === Node.TEXT_NODE ? g.nodeValue : g.firstChild.nodeValue;
123
- u += x.length, u <= e ? C.push(g) : e >= u - x.length && t <= u && C.push(
123
+ p += x.length, p <= e ? b.push(g) : e >= p - x.length && t <= p && b.push(
124
124
  document.createTextNode(
125
- x.substring(0, e - (u - x.length))
125
+ x.substring(0, e - (p - x.length))
126
126
  )
127
127
  );
128
128
  }
129
- p.unshift(...C);
129
+ h.unshift(...b);
130
130
  }
131
131
  if (t > 0) {
132
132
  E = d.str.substring(t);
133
- const u = document.createTextNode(E);
134
- p.push(u);
133
+ const p = document.createTextNode(E);
134
+ h.push(p);
135
135
  }
136
- h.replaceChildren(...p);
136
+ a.replaceChildren(...h);
137
137
  }
138
138
  for (const [n, s] of r.entries())
139
139
  if (s.start.idx === s.end.idx)
@@ -144,11 +144,11 @@ function H(r, c, a) {
144
144
  return i;
145
145
  }
146
146
  function R(r, c) {
147
- const a = r.items.map((i) => i.str);
147
+ const u = r.items.map((i) => i.str);
148
148
  for (let i = 0; i < c.length; i++) {
149
149
  const o = c[i];
150
150
  if (o && o.nodeType !== Node.TEXT_NODE) {
151
- const n = document.createTextNode(a[i]);
151
+ const n = document.createTextNode(u[i]);
152
152
  o.replaceChildren(n);
153
153
  }
154
154
  }
@@ -156,54 +156,54 @@ function R(r, c) {
156
156
  function W(r = {}) {
157
157
  return { matchCase: !1, wholeWords: !1, ...r };
158
158
  }
159
- function A(r, c, a) {
159
+ function A(r, c, u) {
160
160
  const i = [];
161
161
  function o(n, s, e = -1, t = -1, l) {
162
- var u, C;
163
- const d = c.items[n], p = [];
164
- let m = "", f = "", E = "", h = a[n];
165
- if (!h)
162
+ var p, b;
163
+ const d = c.items[n], h = [];
164
+ let m = "", f = "", E = "", a = u[n];
165
+ if (!a)
166
166
  return;
167
167
  e >= 0 && t >= 0 ? m = d.str.substring(e, t) : e < 0 && t < 0 ? m = d.str : e >= 0 ? m = d.str.substring(e) : t >= 0 && (m = d.str.substring(0, t));
168
- const b = document.createTextNode(m), N = document.createElement("span");
169
- if (N.style.background = l, N.append(b), p.push(N), e > 0)
170
- if (h.childNodes.length === 1 && h.childNodes[0].nodeType === Node.TEXT_NODE) {
168
+ const M = document.createTextNode(m), N = document.createElement("span");
169
+ if (N.style.background = l, N.append(M), h.push(N), e > 0)
170
+ if (a.childNodes.length === 1 && a.childNodes[0].nodeType === Node.TEXT_NODE) {
171
171
  f = d.str.substring(0, e);
172
172
  const g = document.createTextNode(f);
173
- p.unshift(g);
173
+ h.unshift(g);
174
174
  } else {
175
175
  let g = 0;
176
176
  const x = [];
177
- for (const T of h.childNodes) {
178
- const v = T.nodeType === Node.TEXT_NODE ? T.nodeValue || "" : ((u = T.firstChild) == null ? void 0 : u.nodeValue) || "", M = v.length;
179
- if (g += M, g <= e)
177
+ for (const T of a.childNodes) {
178
+ const v = T.nodeType === Node.TEXT_NODE ? T.nodeValue || "" : ((p = T.firstChild) == null ? void 0 : p.nodeValue) || "", C = v.length;
179
+ if (g += C, g <= e)
180
180
  x.push(T);
181
- else if (e >= g - M && t <= g) {
182
- const w = v.substring(0, e - (g - M));
181
+ else if (e >= g - C && t <= g) {
182
+ const w = v.substring(0, e - (g - C));
183
183
  x.push(document.createTextNode(w));
184
184
  }
185
185
  }
186
- p.unshift(...x);
186
+ h.unshift(...x);
187
187
  }
188
188
  if (t > 0)
189
- if (h.childNodes.length === 1 && h.childNodes[0].nodeType === Node.TEXT_NODE) {
189
+ if (a.childNodes.length === 1 && a.childNodes[0].nodeType === Node.TEXT_NODE) {
190
190
  E = d.str.substring(t);
191
191
  const g = document.createTextNode(E);
192
- p.push(g);
192
+ h.push(g);
193
193
  } else {
194
194
  let g = 0;
195
195
  const x = [];
196
- for (const T of h.childNodes) {
196
+ for (const T of a.childNodes) {
197
197
  g >= t && x.push(T);
198
- const v = T.nodeType === Node.TEXT_NODE ? T.nodeValue || "" : ((C = T.firstChild) == null ? void 0 : C.nodeValue) || "", M = v.length;
199
- if (g += M, g > t) {
200
- const w = v.substring(t - (g - M));
198
+ const v = T.nodeType === Node.TEXT_NODE ? T.nodeValue || "" : ((b = T.firstChild) == null ? void 0 : b.nodeValue) || "", C = v.length;
199
+ if (g += C, g > t) {
200
+ const w = v.substring(t - (g - C));
201
201
  w && x.push(document.createTextNode(w));
202
202
  }
203
203
  }
204
- x.length > 0 && p.push(...x);
204
+ x.length > 0 && h.push(...x);
205
205
  }
206
- h.replaceChildren(...p), i.push({ element: N, index: s });
206
+ a.replaceChildren(...h), i.push({ element: N, index: s });
207
207
  }
208
208
  for (const [n, s] of r.entries()) {
209
209
  const { start: e, end: t, color: l } = s;
@@ -0,0 +1,36 @@
1
+ import { useRef as o, useEffect as i } from "react";
2
+ const s = /[\x00-\x1F]/g;
3
+ let c = null, r = null;
4
+ function d(e) {
5
+ return c || (c = /([\u00a0\u00b5\u037e\u0eb3\u2000-\u200a\u202f\u2126\ufb00-\ufb04\ufb06\ufb20-\ufb36\ufb38-\ufb3c\ufb3e\ufb40-\ufb41\ufb43-\ufb44\ufb46-\ufba1\ufba4-\ufba9\ufbae-\ufbb1\ufbd3-\ufbdc\ufbde-\ufbe7\ufbea-\ufbf8\ufbfc-\ufbfd\ufc00-\ufc5d\ufc64-\ufcf1\ufcf5-\ufd3d\ufd88\ufdf4\ufdfa-\ufdfb\ufe71\ufe77\ufe79\ufe7b\ufe7d]+)|(\ufb05+)/gu, r = /* @__PURE__ */ new Map([["ſt", "ſt"]])), e.replace(
6
+ c,
7
+ (f, u, t) => u ? u.normalize("NFKC") : (r == null ? void 0 : r.get(t)) || ""
8
+ );
9
+ }
10
+ function p(e, f = !1) {
11
+ return s.test(e) ? f ? e.replace(s, (u) => u === "\0" ? "" : " ") : e.replace(/\x00/g, "") : e;
12
+ }
13
+ const x = (e) => {
14
+ const f = o(!1), u = o(null);
15
+ i(() => {
16
+ if (!e || f.current)
17
+ return;
18
+ const t = (n) => {
19
+ var l;
20
+ const b = document.getSelection();
21
+ if (!b)
22
+ return;
23
+ const a = b.toString();
24
+ a && ((l = n.clipboardData) == null || l.setData(
25
+ "text/plain",
26
+ p(d(a))
27
+ ), n.preventDefault(), n.stopPropagation());
28
+ };
29
+ return e.addEventListener("copy", t), u.current = e, f.current = !0, () => {
30
+ u.current && (u.current.removeEventListener("copy", t), f.current = !1);
31
+ };
32
+ }, [e]);
33
+ };
34
+ export {
35
+ x as useCopyText
36
+ };
@@ -1,5 +1,6 @@
1
1
  import { useDarkMode as e } from "./useDarkMode.js";
2
- const t = () => {
2
+ import "react";
3
+ const d = () => {
3
4
  const { darkMode: o, setDarkMode: r } = e();
4
5
  return {
5
6
  darkMode: o,
@@ -7,5 +8,5 @@ const t = () => {
7
8
  };
8
9
  };
9
10
  export {
10
- t as useDarkModeProps
11
+ d as useDarkModeProps
11
12
  };
@@ -2,7 +2,7 @@ import "react/jsx-runtime";
2
2
  import "react";
3
3
  import "../../contexts/RPDocumentContext.js";
4
4
  import "../../contexts/DocumentPasswordContext.js";
5
- import { b as io } from "../../ToolbarLayout.module-c588d36b.js";
5
+ import { b as Er } from "../../ToolbarLayout.module-3a77cc37.js";
6
6
  import "../../contexts/DarkModeContext.js";
7
7
  import "../../contexts/RotationContext.js";
8
8
  import "../../contexts/LayerContext.js";
@@ -30,29 +30,111 @@ import "../../contexts/LoaderContext.js";
30
30
  import "../../contexts/ToolComponentContext.js";
31
31
  import "../../contexts/IconToolContext.js";
32
32
  import "../../contexts/OtherToolContext.js";
33
- import "../../components/RPConfig.js";
33
+ import "../../contexts/EventCallbackContext.js";
34
+ import "../../contexts/ThemeContext.js";
35
+ import "../../contexts/ConfigContext.js";
36
+ import "pdfjs-dist";
34
37
  import "../../components/layout/Container.js";
35
38
  import "../../contexts/ViewportContext.js";
36
39
  import "../../contexts/ToolbarComponentContext.js";
37
40
  import "../../components/layout/sidebar/RPSplitter.js";
38
41
  import "../../components/layout/WrapperLayout.js";
39
- import "../../LayoutWrapper-a871c161.js";
40
- import "../../contexts/ThemeContext.js";
41
42
  import "../../components/RPDropFileZone.js";
43
+ import "../../LayoutWrapper-6224491f.js";
42
44
  import "../../components/ui/Button.js";
43
- import "../../SearchCloseButton-cbf182aa.js";
45
+ import "../../SearchCloseButton-08d57275.js";
44
46
  import "../../components/ui/Input.js";
45
47
  import "../../components/ui/Checkbox.js";
46
48
  import "../../components/icons/LoaderIcon.js";
47
49
  import "../../contexts/IconContext.js";
48
50
  import "../../components/ui/RPTooltip.js";
49
51
  import "../../components/ui/DropDown.js";
50
- import "../../ZoomTool.module-6c5eabbb.js";
51
52
  import "../../components/layout/toolbar/MenuItem.js";
52
53
  import "../../components/layout/toolbar/MenuSeparator.js";
53
54
  import "../dateFormatter.js";
54
55
  import "../../components/layout/toolbar/PropertyItem.js";
55
- import "../../RotateTool.module-03987eba.js";
56
+ import "../../RotateTool.module-67946714.js";
57
+ import "./useLoadPdf.js";
58
+ import "../types.js";
59
+ import "../../th_TH-d627cd51.js";
60
+ import "../getThumbnailViewport.js";
61
+ import "../appConsole.js";
62
+ import "./usePdfProperties.js";
63
+ import "../convertPdfDate.js";
64
+ import "../formatFileSize.js";
65
+ import "../../components/icons/ChevronUpIcon.js";
66
+ import "../highlight.js";
67
+ import "../charators.js";
68
+ import "../Queue.js";
69
+ import "../renderPage.js";
70
+ import "../../components/icons/Thumbnail.js";
71
+ import "../../clsx-0c6e471a.js";
72
+ import "../withRef.js";
73
+ import "./useInfiniteScroll.js";
74
+ import "../constants.js";
75
+ import "../link_service.js";
76
+ import "../annotations.js";
77
+ import "../sanitizeExternalUrl.js";
78
+ import "../../components/page/searchHighlight.js";
79
+ import "../const.js";
80
+ import "../../components/page/CustomElement.js";
81
+ import "../getZoomLevel.js";
82
+ import "./useDebounce.js";
83
+ import "./useLicense.js";
84
+ import "../getScrollDistance.js";
85
+ import "../getElementPositionInPage.js";
86
+ import "../calculatePage.js";
87
+ import "./useMousePressed.js";
88
+ import "./useGrabScroll.js";
89
+ import "./usePinch.js";
90
+ import "../../components/ui/PasswordModal.js";
91
+ import "./useLocalization.js";
92
+ import "../approximateFragtion.js";
93
+ import "./useCopyText.js";
94
+ import "../getWordPositionInPage.js";
95
+ import "../smoothScrollTo.js";
96
+ import "../../components/layout/toolbar/FileUploadTool.js";
97
+ import "../../components/icons/FileUploadDefaultIcon.js";
98
+ import "../../index-a48ec088.js";
99
+ import "../../index-c9a2990a.js";
100
+ import "react-dom";
101
+ import "../../index-808ea7bf.js";
102
+ import "../../components/layout/toolbar/DarkModeTool.js";
103
+ import "../../components/icons/MoonIcon.js";
104
+ import "../../components/icons/SunIcon.js";
105
+ import "./useDarkMode.js";
106
+ import "../../components/icons/ThreeDotIcon.js";
107
+ import "../../components/icons/CloseIcon.js";
108
+ import "../../components/layout/toolbar/DocumentProperties.js";
109
+ import "../../components/icons/InfoIcon.js";
110
+ import "../../components/layout/toolbar/RotateTool.js";
111
+ import "../../components/icons/ClockwiseIcon.js";
112
+ import "./useRotate.js";
113
+ import "../../components/layout/toolbar/ViewModeTool.js";
114
+ import "../../components/icons/DualPageIcon.js";
115
+ import "../../components/icons/SinglePageIcon.js";
116
+ import "../../components/icons/CheckIcon.js";
117
+ import "../../components/layout/toolbar/ScrollModeTool.js";
118
+ import "../../components/icons/PageScrollingIcon.js";
119
+ import "../../components/icons/VerticalScrollingIcon.js";
120
+ import "../../components/icons/HorizontalScrollingIcon.js";
121
+ import "../../components/icons/FileDownloadDefaultIcon.js";
122
+ import "../../components/icons/PrintDefaultIcon.js";
123
+ import "../../components/layout/toolbar/FullScreenTool.js";
124
+ import "../../components/icons/FullScreenIcon.js";
125
+ import "./useFullScreen.js";
126
+ import "../../components/icons/GoToDownIcon.js";
127
+ import "../../components/layout/toolbar/SelectionModeTool.js";
128
+ import "../../components/icons/TextSelectionDefaultIcon.js";
129
+ import "../../components/icons/HandModeDefaultIcon.js";
130
+ import "../../components/icons/ZoomInIcon.js";
131
+ import "../../components/icons/ZoomOutIcon.js";
132
+ import "../zoom.js";
133
+ import "../../components/icons/SearchIcon.js";
134
+ import "../../components/icons/ClearIcon.js";
135
+ import "./useHighlight.js";
136
+ import "../../components/icons/LightPdfIcon.js";
137
+ import "../../components/icons/DarkPdfIcon.js";
56
138
  export {
57
- io as useFileDownload
139
+ Er as useFileDownload
58
140
  };
@@ -1,23 +1,24 @@
1
1
  import { useState as l, useCallback as x, useEffect as C } from "react";
2
2
  import { getHighlightOptionsWithDefaults as H, findMatches as M } from "../highlight.js";
3
- const d = (i) => {
4
- const [n, a] = l(void 0), [u, r] = l([]), f = x(async (t) => {
3
+ import "../charators.js";
4
+ const k = (s) => {
5
+ const [n, a] = l(void 0), [u, r] = l([]), m = x(async (t) => {
5
6
  if (!t)
6
7
  return {};
7
- const s = t.numPages, e = {};
8
- for (let o = 1; o <= s; o++) {
8
+ const i = t.numPages, e = {};
9
+ for (let o = 1; o <= i; o++) {
9
10
  const g = await t.getPage(o);
10
11
  e[o.toString()] = await g.getTextContent();
11
12
  }
12
13
  return e;
13
- }, []), m = async (t) => {
14
+ }, []), f = async (t) => {
14
15
  a(t);
15
16
  }, c = () => {
16
17
  r([]), a(void 0);
17
18
  };
18
19
  return C(() => {
19
- i && f(i).then((t) => {
20
- let s = [];
20
+ s && m(s).then((t) => {
21
+ let i = [];
21
22
  for (const { keyword: e, highlightColor: o, options: g } of n) {
22
23
  if (!e)
23
24
  continue;
@@ -35,20 +36,20 @@ const d = (i) => {
35
36
  color: o,
36
37
  keyword: e
37
38
  }));
38
- s = [...s, ...y];
39
+ i = [...i, ...y];
39
40
  }
40
41
  }
41
- r(s);
42
+ r(i);
42
43
  }).catch(() => {
43
44
  c();
44
45
  });
45
- }, [n, i]), {
46
- highlight: m,
46
+ }, [n, s]), {
47
+ highlight: f,
47
48
  clear: c,
48
49
  highlightMatches: u,
49
50
  highlightKeywords: n
50
51
  };
51
52
  };
52
53
  export {
53
- d as useHighlight
54
+ k as useHighlight
54
55
  };
@@ -1,6 +1,6 @@
1
1
  import { useState as E, useCallback as h, useEffect as A } from "react";
2
2
  import { appConsole as l } from "../appConsole.js";
3
- const b = /* @__PURE__ */ new Date("2026-01-05T03:59:23.044Z"), d = "Please visit https://www.react-pdf.dev/manage-license/ to generate a new license key.", s = {
3
+ const b = /* @__PURE__ */ new Date("2026-01-09T02:44:21.102Z"), d = "Please visit https://www.react-pdf.dev/manage-license/ to generate a new license key.", s = {
4
4
  invalidLicense: `You are currently using without a valid license. ${d}`,
5
5
  mismatchedDomain: `Your license key is not valid for the current domain / IP. ${d}`,
6
6
  expired: `Your license key has expired. ${d}`,
@@ -1,32 +1,40 @@
1
- import { useState as a, useRef as N, useEffect as k } from "react";
2
- import * as x from "pdfjs-dist";
3
- import { ErrorType as O } from "../types.js";
4
- import { getThumbnailViewport as U } from "../getThumbnailViewport.js";
5
- import { useConfigContext as h } from "../../contexts/ConfigContext.js";
6
- import { useDocumentPasswordContext as j } from "../../contexts/DocumentPasswordContext.js";
7
- const G = (f, s, V = {}) => {
8
- const [n, C] = a(), { workerUrlAdded: y } = h(), [I, L] = a(/* @__PURE__ */ new Map()), d = N(), [S, m] = a(0), [P, T] = a(!1), [q, v] = a(), { password: u, passwordError: D, setPasswordError: c, passwordRequired: g, setPasswordRequired: p } = j(), { onLoadError: i, onLoaded: w } = V;
1
+ import { useState as d, useRef as A, useEffect as k } from "react";
2
+ import * as I from "pdfjs-dist";
3
+ import { ErrorType as F } from "../types.js";
4
+ import { getThumbnailViewport as j } from "../getThumbnailViewport.js";
5
+ import { useConfigContext as z } from "../../contexts/ConfigContext.js";
6
+ import { useDocumentPasswordContext as _ } from "../../contexts/DocumentPasswordContext.js";
7
+ import "../../th_TH-d627cd51.js";
8
+ import "react/jsx-runtime";
9
+ import "../appConsole.js";
10
+ const Y = (m, s, h = {}) => {
11
+ const [n, q] = d(), { workerUrlAdded: v } = z(), [D, S] = d(/* @__PURE__ */ new Map()), a = A(), [f, g] = d(0), [P, T] = d(!1), [N, O] = d(), { password: u, passwordError: U, setPasswordError: c, passwordRequired: p, setPasswordRequired: w } = _(), { onLoadError: i, onLoaded: E, onLoadProgress: b, disableAutoFetch: x, disableStream: C, rangeChunkSize: V } = h;
9
12
  return k(() => {
10
- if (!y || !f)
13
+ b && b(f);
14
+ }, [f, b]), k(() => {
15
+ if (!v || !m)
11
16
  return;
12
- m(0), d.current = Date.now();
13
- const r = d.current, E = {
14
- url: f,
17
+ g(0), a.current = Date.now();
18
+ const r = a.current, R = {
19
+ url: m,
15
20
  cMapPacked: (s == null ? void 0 : s.isCompressed) ?? !0,
16
21
  ...(s == null ? void 0 : s.url) && { cMapUrl: s.url },
17
22
  ...u && { password: u },
18
- verbosity: x.VerbosityLevel.ERRORS
23
+ ...x !== void 0 && { disableAutoFetch: x },
24
+ ...C !== void 0 && { disableStream: C },
25
+ ...V !== void 0 && { rangeChunkSize: V },
26
+ verbosity: I.VerbosityLevel.ERRORS
19
27
  };
20
28
  try {
21
- const e = x.getDocument(E);
29
+ const e = I.getDocument(R);
22
30
  e.onProgress = (o) => {
23
- if (r === d.current) {
24
- const { loaded: R, total: l } = o, b = l ? Math.min(100, Math.round(R / l * 100)) : 0;
25
- m(b);
31
+ if (r === a.current) {
32
+ const { loaded: y, total: l } = o, L = l ? Math.min(100, Math.round(y / l * 100)) : 0;
33
+ g(L);
26
34
  }
27
35
  }, T(!0);
28
- const t = e.promise.then((o) => (r === d.current && (C(o), m(100)), w && w(o), p(!1), c(""), o)).catch((o) => {
29
- o instanceof Error && o.name === "PasswordException" ? (p(!0), c(o.message || "Password required")) : o instanceof Error && o.name === "InvalidPDFException" && u ? (p(!0), c("Incorrect password")) : i && i(o);
36
+ const t = e.promise.then((o) => (r === a.current && (q(o), g(100)), E && E(o), w(!1), c(""), o)).catch((o) => {
37
+ o instanceof Error && o.name === "PasswordException" ? (w(!0), c(o.message || "Password required")) : o instanceof Error && o.name === "InvalidPDFException" && u ? (w(!0), c("Incorrect password")) : i && i(o);
30
38
  }).finally(() => {
31
39
  T(!1);
32
40
  });
@@ -36,42 +44,42 @@ const G = (f, s, V = {}) => {
36
44
  });
37
45
  };
38
46
  } catch (e) {
39
- v(O.NOT_SUPPORTED), i && i(e);
47
+ O(F.NOT_SUPPORTED), i && i(e);
40
48
  }
41
- }, [f, y, u, i, w]), k(() => {
42
- if (g)
49
+ }, [m, v, u, i, E]), k(() => {
50
+ if (p)
43
51
  return;
44
52
  const r = /* @__PURE__ */ new Map();
45
53
  if (!n || P) {
46
- L(r);
54
+ S(r);
47
55
  return;
48
56
  }
49
- const E = n.numPages, e = [];
50
- for (let t = 1; t <= E; t++) {
57
+ const R = n.numPages, e = [];
58
+ for (let t = 1; t <= R; t++) {
51
59
  const o = n.getPage(t);
52
60
  e.push(o);
53
61
  }
54
62
  Promise.all(e).then((t) => {
55
63
  t.map((o) => {
56
- const { thumbnailViewport: R, scale: l } = U(o), b = o.getViewport();
64
+ const { thumbnailViewport: y, scale: l } = j(o), L = o.getViewport();
57
65
  r.set(o.pageNumber, {
58
66
  page: o,
59
- thumbnailViewport: R,
67
+ thumbnailViewport: y,
60
68
  thumbnailScale: l,
61
- defaultRotation: b.rotation
69
+ defaultRotation: L.rotation
62
70
  });
63
- }), L(r);
71
+ }), S(r);
64
72
  });
65
- }, [n, P, g]), {
73
+ }, [n, P, p]), {
66
74
  pdf: n,
67
- pages: I,
75
+ pages: D,
68
76
  loading: P,
69
- error: q,
70
- loadingProgress: S,
71
- passwordRequired: g,
72
- passwordError: D
77
+ error: N,
78
+ loadingProgress: f,
79
+ passwordRequired: p,
80
+ passwordError: U
73
81
  };
74
82
  };
75
83
  export {
76
- G as useLoadPdf
84
+ Y as useLoadPdf
77
85
  };