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

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 (212) hide show
  1. package/dist/Combination-54a77a7a.js +701 -0
  2. package/dist/MostPageTool.module-13578ad6.js +6 -0
  3. package/dist/OtherTool.module-a4be5f1f.js +6 -0
  4. package/dist/Paginate.module-206a7d7d.js +8 -0
  5. package/dist/PaginationContext-9217cab4.js +201 -0
  6. package/dist/{LayoutWrapper-a871c161.js → RPLayout.module-967bf4bc.js} +3 -9
  7. package/dist/RPToolbar.module-27d7fe77.js +10 -0
  8. package/dist/{RotateTool.module-03987eba.js → RotateTool.module-67946714.js} +1 -1
  9. package/dist/SearchTool.module-99f60dc7.js +16 -0
  10. package/dist/ToolbarLayout.module-1fee0a18.js +11 -0
  11. package/dist/{ZoomTool.module-6c5eabbb.js → ZoomTool.module-7082af8c.js} +1 -1
  12. package/dist/assets/style.css +1 -0
  13. package/dist/assets/style.js +75 -0
  14. package/dist/components/RPConfig.js +14 -1489
  15. package/dist/components/RPController.js +109 -66
  16. package/dist/components/RPDropFileZone.js +26 -12
  17. package/dist/components/RPPages.js +991 -58
  18. package/dist/components/RPProvider.js +107 -19
  19. package/dist/components/RPTheme.js +6 -5
  20. package/dist/components/icons/DualPageIcon.js +6 -6
  21. package/dist/components/icons/LoaderIcon.js +1 -1
  22. package/dist/components/icons/SinglePageIcon.js +6 -6
  23. package/dist/components/layout/Container.js +1 -1
  24. package/dist/components/layout/LayoutContainer.js +32 -57
  25. package/dist/components/layout/LayoutWrapper.js +9 -4
  26. package/dist/components/layout/RPDefaultLayout.js +214 -14
  27. package/dist/components/layout/RPLayout.js +143 -41
  28. package/dist/components/layout/WrapperLayout.js +22 -9
  29. package/dist/components/layout/sidebar/RPSidebar.js +110 -13
  30. package/dist/components/layout/sidebar/RPSplitter.js +1 -1
  31. package/dist/components/layout/sidebar/Thumbnail.js +129 -52
  32. package/dist/components/layout/sidebar/Thumbnails.js +75 -6
  33. package/dist/components/layout/toolbar/DarkModeTool.js +24 -13
  34. package/dist/components/layout/toolbar/DocumentDialog.js +311 -56
  35. package/dist/components/layout/toolbar/DocumentProperties.js +21 -8
  36. package/dist/components/layout/toolbar/FileDownloadTool.js +48 -13
  37. package/dist/components/layout/toolbar/FileUploadTool.js +34 -10
  38. package/dist/components/layout/toolbar/FullScreenTool.js +43 -28
  39. package/dist/components/layout/toolbar/MenuItem.js +15 -8
  40. package/dist/components/layout/toolbar/MenuSeparator.js +11 -4
  41. package/dist/components/layout/toolbar/MostPageTool.js +72 -51
  42. package/dist/components/layout/toolbar/OtherTool.js +188 -22
  43. package/dist/components/layout/toolbar/Paginate.js +136 -17
  44. package/dist/components/layout/toolbar/PrintTool.js +70 -13
  45. package/dist/components/layout/toolbar/PropertyItem.js +1 -1
  46. package/dist/components/layout/toolbar/RPMenuItem.js +23 -13
  47. package/dist/components/layout/toolbar/RPMoreOptions.js +119 -47
  48. package/dist/components/layout/toolbar/RPToolbar.js +148 -8
  49. package/dist/components/layout/toolbar/RPToolbarEnd.js +118 -7
  50. package/dist/components/layout/toolbar/RotateTool.js +42 -18
  51. package/dist/components/layout/toolbar/ScrollModeTool.js +33 -21
  52. package/dist/components/layout/toolbar/SearchCloseButton.js +30 -7
  53. package/dist/components/layout/toolbar/SearchResultNavigator.js +87 -8
  54. package/dist/components/layout/toolbar/SearchTool.js +236 -54
  55. package/dist/components/layout/toolbar/SelectionModeTool.js +22 -10
  56. package/dist/components/layout/toolbar/ThumbnailTool.js +32 -10
  57. package/dist/components/layout/toolbar/ToolbarCustom.js +52 -55
  58. package/dist/components/layout/toolbar/ToolbarDefault.js +144 -58
  59. package/dist/components/layout/toolbar/ToolbarLayout.js +149 -6
  60. package/dist/components/layout/toolbar/ViewModeTool.js +31 -19
  61. package/dist/components/layout/toolbar/ZoomTool.js +104 -84
  62. package/dist/components/layout/toolbar/tools/DocumentPropertiesTool.js +38 -12
  63. package/dist/components/layout/toolbar/tools/DualPageTool.js +26 -0
  64. package/dist/components/layout/toolbar/tools/FileDownloadTool.js +31 -9
  65. package/dist/components/layout/toolbar/tools/FileUploadTool.js +29 -8
  66. package/dist/components/layout/toolbar/tools/FullScreenTool.js +25 -13
  67. package/dist/components/layout/toolbar/tools/InputPageTool.js +66 -26
  68. package/dist/components/layout/toolbar/tools/NextPageTool.js +36 -47
  69. package/dist/components/layout/toolbar/tools/PreviousPageTool.js +51 -11
  70. package/dist/components/layout/toolbar/tools/PrintTool.js +29 -7
  71. package/dist/components/layout/toolbar/tools/RotateClockwiseTool.js +31 -8
  72. package/dist/components/layout/toolbar/tools/RotateCounterclockwiseTool.js +34 -11
  73. package/dist/components/layout/toolbar/tools/SelectionModeSwitcherTool.js +31 -0
  74. package/dist/components/layout/toolbar/tools/SinglePageTool.js +26 -0
  75. package/dist/components/layout/toolbar/tools/ThemeSwitcherTool.js +17 -6
  76. package/dist/components/layout/toolbar/tools/ThumbnailTool.js +35 -13
  77. package/dist/components/layout/toolbar/tools/ZoomInTool.js +49 -20
  78. package/dist/components/layout/toolbar/tools/ZoomLevelDisplay.js +27 -0
  79. package/dist/components/layout/toolbar/tools/ZoomLevelTool.js +57 -23
  80. package/dist/components/layout/toolbar/tools/ZoomOutTool.js +47 -18
  81. package/dist/components/layout/toolbar/tools/defaults/RPHorizontalBar.js +122 -45
  82. package/dist/components/layout/toolbar/tools/defaults/RPVerticalBar.js +37 -11
  83. package/dist/components/layout/toolbar/tools/more-options/DocumentProperties.js +18 -5
  84. package/dist/components/layout/toolbar/tools/more-options/FileDownloadTool.js +36 -11
  85. package/dist/components/layout/toolbar/tools/more-options/FileUploadTool.js +25 -50
  86. package/dist/components/layout/toolbar/tools/more-options/FullScreenTool.js +24 -9
  87. package/dist/components/layout/toolbar/tools/more-options/MostPageTool.js +47 -54
  88. package/dist/components/layout/toolbar/tools/more-options/PrintTool.js +32 -7
  89. package/dist/components/layout/toolbar/tools/more-options/RotateTool.js +36 -12
  90. package/dist/components/layout/toolbar/tools/more-options/ScrollModeTool.js +26 -14
  91. package/dist/components/layout/toolbar/tools/more-options/SelectionModeTool.js +27 -15
  92. package/dist/components/layout/toolbar/tools/more-options/ViewModeTool.js +30 -18
  93. package/dist/components/page/AnnotationLayer.js +130 -54
  94. package/dist/components/page/CanvasLayer.js +62 -49
  95. package/dist/components/page/CustomElement.js +49 -18
  96. package/dist/components/page/DualPage.js +97 -4
  97. package/dist/components/page/RPPage.js +134 -51
  98. package/dist/components/page/SinglePage.js +87 -4
  99. package/dist/components/page/TextHighlightLayer.js +195 -57
  100. package/dist/components/page/TextLayer.js +193 -52
  101. package/dist/components/ui/Button.js +9 -8
  102. package/dist/components/ui/Checkbox.js +27 -25
  103. package/dist/components/ui/DropDown.js +21 -14
  104. package/dist/components/ui/Input.js +10 -9
  105. package/dist/components/ui/LoadingIndicator.js +45 -5
  106. package/dist/components/ui/PasswordModal.js +18 -15
  107. package/dist/components/ui/RPTooltip.js +98 -95
  108. package/dist/contexts/DimensionPagesContext.js +35 -17
  109. package/dist/contexts/DropFileZoneContext.js +32 -22
  110. package/dist/contexts/ElementPageContext.js +114 -51
  111. package/dist/contexts/EventCallbackContext.js +30 -0
  112. package/dist/contexts/FileInputContext.js +32 -22
  113. package/dist/contexts/FullScreenContext.js +17 -10
  114. package/dist/contexts/GlobalCurrentPage.js +13 -10
  115. package/dist/contexts/HighlightContext.js +24 -11
  116. package/dist/contexts/LicenseContext.js +1 -0
  117. package/dist/contexts/LoaderContext.js +10 -9
  118. package/dist/contexts/LocalizationContext.js +25 -29
  119. package/dist/contexts/PagesRotateContext.js +36 -18
  120. package/dist/contexts/PaginationContext.js +32 -4
  121. package/dist/contexts/PrintContext.js +76 -6
  122. package/dist/contexts/RPDocumentContext.js +48 -30
  123. package/dist/contexts/RenderQueueProvider.js +70 -8
  124. package/dist/contexts/RotationContext.js +25 -15
  125. package/dist/contexts/ScrollModeContext.js +7 -6
  126. package/dist/contexts/SearchContext.js +94 -6
  127. package/dist/contexts/SelectionModeContext.js +5 -4
  128. package/dist/contexts/ThumbnailsContext.js +41 -6
  129. package/dist/contexts/ViewModeContext.js +10 -9
  130. package/dist/contexts/ZoomContext.js +48 -38
  131. package/dist/floating-ui.react-dom-5ec29bd6.js +1327 -0
  132. package/dist/index-4baea9b5.js +1198 -0
  133. package/dist/index-655864a7.js +27 -0
  134. package/dist/{index-35c7f4a2.js → index-c0faa594.js} +63 -86
  135. package/dist/index-e3ee9457.js +150 -0
  136. package/dist/libInjectCss.js +9 -0
  137. package/dist/main.js +269 -84
  138. package/dist/types/assets/style.d.ts +1 -0
  139. package/dist/types/components/icons/DualPageIcon.d.ts +1 -1
  140. package/dist/types/components/icons/SinglePageIcon.d.ts +1 -1
  141. package/dist/types/components/layout/toolbar/tools/DualPageTool.d.ts +3 -0
  142. package/dist/types/components/layout/toolbar/tools/SelectionModeSwitcherTool.d.ts +3 -0
  143. package/dist/types/components/layout/toolbar/tools/SinglePageTool.d.ts +3 -0
  144. package/dist/types/components/layout/toolbar/tools/ZoomLevelDisplay.d.ts +7 -0
  145. package/dist/types/contexts/EventCallbackContext.d.ts +5 -0
  146. package/dist/types/contexts/RenderQueueProvider.d.ts +2 -2
  147. package/dist/types/libInjectCss.d.ts +1 -0
  148. package/dist/types/main.d.ts +6 -6
  149. package/dist/types/utils/annotations.d.ts +3 -3
  150. package/dist/types/utils/approximateFragtion.d.ts +9 -0
  151. package/dist/types/utils/getElementPositionInPage.d.ts +5 -0
  152. package/dist/types/utils/hooks/useCopyText.d.ts +1 -0
  153. package/dist/types/utils/hooks/usePrint.d.ts +3 -2
  154. package/dist/types/utils/hooks/useSearch.d.ts +1 -2
  155. package/dist/types/utils/injectPrintCSS.d.ts +1 -0
  156. package/dist/types/utils/link_service.d.ts +11 -1
  157. package/dist/types/utils/renderPage.d.ts +2 -2
  158. package/dist/types/utils/types.d.ts +38 -5
  159. package/dist/types/utils/zoom.d.ts +2 -0
  160. package/dist/utils/annotations.js +125 -149
  161. package/dist/utils/approximateFragtion.js +22 -0
  162. package/dist/utils/getElementPositionInPage.js +84 -0
  163. package/dist/utils/getWordPositionInPage.js +5 -5
  164. package/dist/utils/getZoomLevel.js +9 -8
  165. package/dist/utils/highlight.js +72 -72
  166. package/dist/utils/hooks/useCopyText.js +36 -0
  167. package/dist/utils/hooks/useDarkModeProps.js +3 -2
  168. package/dist/utils/hooks/useFileDownload.js +29 -54
  169. package/dist/utils/hooks/useHighlight.js +34 -33
  170. package/dist/utils/hooks/useLicense.js +1 -1
  171. package/dist/utils/hooks/useLoadPdf.js +44 -36
  172. package/dist/utils/hooks/useLoadWorker.js +11 -8
  173. package/dist/utils/hooks/useLocalization.js +13 -13
  174. package/dist/utils/hooks/usePageRotateContext.js +33 -17
  175. package/dist/utils/hooks/usePaginate.js +26 -49
  176. package/dist/utils/hooks/usePinch.js +62 -41
  177. package/dist/utils/hooks/usePresentPage.js +80 -50
  178. package/dist/utils/hooks/usePrint.js +181 -55
  179. package/dist/utils/hooks/useRotate.js +21 -7
  180. package/dist/utils/hooks/useScrollToPage.js +26 -51
  181. package/dist/utils/hooks/useSearch.js +141 -55
  182. package/dist/utils/hooks/useThumbnail.js +55 -55
  183. package/dist/utils/hooks/useVirtualReactWindow.js +70 -52
  184. package/dist/utils/hooks/useWatermark.js +18 -15
  185. package/dist/utils/injectPrintCSS.js +22 -0
  186. package/dist/utils/link_service.js +49 -9
  187. package/dist/utils/renderPage.js +13 -10
  188. package/dist/utils/zoom.js +6 -0
  189. package/package.json +6 -8
  190. package/dist/SearchCloseButton-cbf182aa.js +0 -33
  191. package/dist/ToolbarLayout.module-c588d36b.js +0 -3411
  192. package/dist/assets/Button.css +0 -1
  193. package/dist/assets/Checkbox.css +0 -1
  194. package/dist/assets/Container.css +0 -1
  195. package/dist/assets/DropDown.css +0 -1
  196. package/dist/assets/Input.css +0 -1
  197. package/dist/assets/LayoutWrapper.css +0 -1
  198. package/dist/assets/LoaderIcon.css +0 -1
  199. package/dist/assets/MenuItem.css +0 -1
  200. package/dist/assets/MenuSeparator.css +0 -1
  201. package/dist/assets/PasswordModal.css +0 -1
  202. package/dist/assets/PropertyItem.css +0 -1
  203. package/dist/assets/RPDropFileZone.css +0 -1
  204. package/dist/assets/RPSplitter.css +0 -1
  205. package/dist/assets/RPTooltip.css +0 -1
  206. package/dist/assets/RotateTool.css +0 -1
  207. package/dist/assets/SearchCloseButton.css +0 -1
  208. package/dist/assets/ToolbarLayout.css +0 -1
  209. package/dist/assets/WrapperLayout.css +0 -1
  210. package/dist/assets/ZoomTool.css +0 -1
  211. package/dist/floating-ui.react-dom-6b2fe0df.js +0 -1474
  212. 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
  };
@@ -1,58 +1,33 @@
1
+ import { useDocumentContext as c } from "../../contexts/RPDocumentContext.js";
2
+ import { useCallback as a } from "react";
3
+ import { useDownloadContext as s } from "../../contexts/DownloadContext.js";
1
4
  import "react/jsx-runtime";
2
- import "react";
3
- import "../../contexts/RPDocumentContext.js";
5
+ import "./useLoadPdf.js";
6
+ import "pdfjs-dist";
7
+ import "../types.js";
8
+ import "../../th_TH-d627cd51.js";
9
+ import "../getThumbnailViewport.js";
10
+ import "../../contexts/ConfigContext.js";
4
11
  import "../../contexts/DocumentPasswordContext.js";
5
- import { b as io } from "../../ToolbarLayout.module-c588d36b.js";
6
- import "../../contexts/DarkModeContext.js";
7
- import "../../contexts/RotationContext.js";
8
- import "../../contexts/LayerContext.js";
9
- import "../../contexts/ZoomContext.js";
10
- import "../../contexts/ViewModeContext.js";
11
- import "../../contexts/ScrollModeContext.js";
12
- import "../../contexts/VirtualScrollContext.js";
13
- import "../../contexts/VirtualGridContext.js";
14
- import "../../contexts/SelectionModeContext.js";
15
- import "../../contexts/InitialStateContext.js";
16
- import "../../contexts/FullScreenContext.js";
17
- import "../../contexts/FileInputContext.js";
18
- import "../../contexts/DropFileZoneContext.js";
19
- import "../../contexts/LayoutContainerContext.js";
20
- import "../../contexts/DimensionPagesContext.js";
21
- import "../../contexts/LocalizationContext.js";
22
- import "../../contexts/HighlightContext.js";
23
- import "../../contexts/LicenseContext.js";
24
- import "../../contexts/DownloadContext.js";
25
- import "../../contexts/SmoothScrollContext.js";
26
- import "../../contexts/ElementPageContext.js";
27
- import "../../contexts/PagesRotateContext.js";
28
- import "../../contexts/GlobalCurrentPage.js";
29
- import "../../contexts/LoaderContext.js";
30
- import "../../contexts/ToolComponentContext.js";
31
- import "../../contexts/IconToolContext.js";
32
- import "../../contexts/OtherToolContext.js";
33
- import "../../components/RPConfig.js";
34
- import "../../components/layout/Container.js";
35
- import "../../contexts/ViewportContext.js";
36
- import "../../contexts/ToolbarComponentContext.js";
37
- import "../../components/layout/sidebar/RPSplitter.js";
38
- import "../../components/layout/WrapperLayout.js";
39
- import "../../LayoutWrapper-a871c161.js";
40
- import "../../contexts/ThemeContext.js";
41
- import "../../components/RPDropFileZone.js";
42
- import "../../components/ui/Button.js";
43
- import "../../SearchCloseButton-cbf182aa.js";
44
- import "../../components/ui/Input.js";
45
- import "../../components/ui/Checkbox.js";
46
- import "../../components/icons/LoaderIcon.js";
47
- import "../../contexts/IconContext.js";
48
- import "../../components/ui/RPTooltip.js";
49
- import "../../components/ui/DropDown.js";
50
- import "../../ZoomTool.module-6c5eabbb.js";
51
- import "../../components/layout/toolbar/MenuItem.js";
52
- import "../../components/layout/toolbar/MenuSeparator.js";
53
- import "../dateFormatter.js";
54
- import "../../components/layout/toolbar/PropertyItem.js";
55
- import "../../RotateTool.module-03987eba.js";
12
+ import "../appConsole.js";
13
+ import "./usePdfProperties.js";
14
+ import "../convertPdfDate.js";
15
+ import "../formatFileSize.js";
16
+ const i = ".pdf", d = (o) => URL.createObjectURL(o), l = async (o) => {
17
+ const r = await (await fetch(o)).blob();
18
+ return d(r);
19
+ }, k = () => {
20
+ const { filename: o, pdfSrc: e } = c(), { downloadFilename: r } = s(), m = (t) => {
21
+ const n = r || t;
22
+ return n.endsWith(i) ? n : `${n}${i}`;
23
+ };
24
+ return { download: a(async () => {
25
+ if (!o || !e)
26
+ throw new Error("There is no PDF source to download");
27
+ const t = document.createElement("a");
28
+ t.href = await l(e), t.download = m(o), document.body.appendChild(t), t.click(), document.body.removeChild(t);
29
+ }, [o, e]) };
30
+ };
56
31
  export {
57
- io as useFileDownload
32
+ k as useFileDownload
58
33
  };
@@ -1,54 +1,55 @@
1
- import { useState as l, useCallback as x, useEffect as C } from "react";
1
+ import { useState as m, useCallback as r, 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, c] = m(void 0), [f, l] = m([]), u = r(async (t) => {
5
6
  if (!t)
6
7
  return {};
7
- const s = t.numPages, e = {};
8
- for (let o = 1; o <= s; o++) {
9
- const g = await t.getPage(o);
10
- e[o.toString()] = await g.getTextContent();
8
+ const i = t.numPages, e = {};
9
+ for (let o = 1; o <= i; o++) {
10
+ const h = await t.getPage(o);
11
+ e[o.toString()] = await h.getTextContent();
11
12
  }
12
13
  return e;
13
- }, []), m = async (t) => {
14
- a(t);
15
- }, c = () => {
16
- r([]), a(void 0);
17
- };
14
+ }, []), p = r(async (t) => {
15
+ c(t);
16
+ }, []), g = r(() => {
17
+ l([]), c(void 0);
18
+ }, []);
18
19
  return C(() => {
19
- i && f(i).then((t) => {
20
- let s = [];
21
- for (const { keyword: e, highlightColor: o, options: g } of n) {
20
+ s && u(s).then((t) => {
21
+ let i = [];
22
+ for (const { keyword: e, highlightColor: o, options: h } of n) {
22
23
  if (!e)
23
24
  continue;
24
- const p = H(g);
25
- for (const h of Object.keys(t)) {
26
- const y = M(
25
+ const y = H(h);
26
+ for (const a of Object.keys(t)) {
27
+ const b = M(
27
28
  [e],
28
- t[h],
29
- Number(h) - 1,
30
- p
31
- ).map((b, w) => ({
32
- ...b,
33
- page: Number(h),
34
- pageMatchIdx: w,
29
+ t[a],
30
+ Number(a) - 1,
31
+ y
32
+ ).map((w, x) => ({
33
+ ...w,
34
+ page: Number(a),
35
+ pageMatchIdx: x,
35
36
  color: o,
36
37
  keyword: e
37
38
  }));
38
- s = [...s, ...y];
39
+ i = [...i, ...b];
39
40
  }
40
41
  }
41
- r(s);
42
+ l(i);
42
43
  }).catch(() => {
43
- c();
44
+ g();
44
45
  });
45
- }, [n, i]), {
46
- highlight: m,
47
- clear: c,
48
- highlightMatches: u,
46
+ }, [n, s, g, u]), {
47
+ highlight: p,
48
+ clear: g,
49
+ highlightMatches: f,
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-02-11T04:45:54.847Z"), 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
  };