@react-pdf-kit/viewer 2.0.0-beta.1 → 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 (150) hide show
  1. package/README.md +6 -6
  2. package/dist/Combination-54a77a7a.js +701 -0
  3. package/dist/MostPageTool.module-13578ad6.js +6 -0
  4. package/dist/OtherTool.module-a4be5f1f.js +6 -0
  5. package/dist/Paginate.module-206a7d7d.js +8 -0
  6. package/dist/PaginationContext-9217cab4.js +201 -0
  7. package/dist/{LayoutWrapper-6224491f.js → RPLayout.module-967bf4bc.js} +3 -9
  8. package/dist/RPToolbar.module-27d7fe77.js +10 -0
  9. package/dist/SearchTool.module-99f60dc7.js +16 -0
  10. package/dist/ToolbarLayout.module-1fee0a18.js +11 -0
  11. package/dist/ZoomTool.module-7082af8c.js +12 -0
  12. package/dist/assets/style.css +1 -1
  13. package/dist/assets/style.js +32 -31
  14. package/dist/components/RPConfig.js +10 -1485
  15. package/dist/components/RPController.js +77 -148
  16. package/dist/components/RPPages.js +981 -124
  17. package/dist/components/RPProvider.js +56 -118
  18. package/dist/components/icons/DualPageIcon.js +6 -6
  19. package/dist/components/icons/SinglePageIcon.js +6 -6
  20. package/dist/components/layout/LayoutContainer.js +31 -138
  21. package/dist/components/layout/LayoutWrapper.js +8 -4
  22. package/dist/components/layout/RPDefaultLayout.js +162 -88
  23. package/dist/components/layout/RPLayout.js +119 -107
  24. package/dist/components/layout/sidebar/RPSidebar.js +83 -113
  25. package/dist/components/layout/sidebar/Thumbnail.js +120 -126
  26. package/dist/components/layout/sidebar/Thumbnails.js +56 -121
  27. package/dist/components/layout/toolbar/DarkModeTool.js +6 -4
  28. package/dist/components/layout/toolbar/DocumentDialog.js +304 -132
  29. package/dist/components/layout/toolbar/DocumentProperties.js +12 -9
  30. package/dist/components/layout/toolbar/FileDownloadTool.js +34 -126
  31. package/dist/components/layout/toolbar/FileUploadTool.js +8 -5
  32. package/dist/components/layout/toolbar/FullScreenTool.js +16 -13
  33. package/dist/components/layout/toolbar/MenuItem.js +11 -8
  34. package/dist/components/layout/toolbar/MenuSeparator.js +8 -5
  35. package/dist/components/layout/toolbar/MostPageTool.js +64 -125
  36. package/dist/components/layout/toolbar/OtherTool.js +162 -114
  37. package/dist/components/layout/toolbar/Paginate.js +113 -117
  38. package/dist/components/layout/toolbar/PrintTool.js +55 -125
  39. package/dist/components/layout/toolbar/RPMenuItem.js +14 -11
  40. package/dist/components/layout/toolbar/RPMoreOptions.js +66 -121
  41. package/dist/components/layout/toolbar/RPToolbar.js +89 -81
  42. package/dist/components/layout/toolbar/RPToolbarEnd.js +68 -90
  43. package/dist/components/layout/toolbar/RotateTool.js +12 -9
  44. package/dist/components/layout/toolbar/ScrollModeTool.js +14 -11
  45. package/dist/components/layout/toolbar/SearchCloseButton.js +23 -9
  46. package/dist/components/layout/toolbar/SearchResultNavigator.js +53 -106
  47. package/dist/components/layout/toolbar/SearchTool.js +222 -121
  48. package/dist/components/layout/toolbar/SelectionModeTool.js +8 -5
  49. package/dist/components/layout/toolbar/ThumbnailTool.js +15 -124
  50. package/dist/components/layout/toolbar/ToolbarCustom.js +44 -130
  51. package/dist/components/layout/toolbar/ToolbarDefault.js +122 -120
  52. package/dist/components/layout/toolbar/ToolbarLayout.js +85 -83
  53. package/dist/components/layout/toolbar/ViewModeTool.js +10 -7
  54. package/dist/components/layout/toolbar/ZoomTool.js +128 -120
  55. package/dist/components/layout/toolbar/tools/DocumentPropertiesTool.js +17 -123
  56. package/dist/components/layout/toolbar/tools/DualPageTool.js +26 -0
  57. package/dist/components/layout/toolbar/tools/FileDownloadTool.js +10 -121
  58. package/dist/components/layout/toolbar/tools/FileUploadTool.js +6 -4
  59. package/dist/components/layout/toolbar/tools/FullScreenTool.js +13 -11
  60. package/dist/components/layout/toolbar/tools/InputPageTool.js +19 -112
  61. package/dist/components/layout/toolbar/tools/NextPageTool.js +30 -123
  62. package/dist/components/layout/toolbar/tools/PreviousPageTool.js +16 -109
  63. package/dist/components/layout/toolbar/tools/PrintTool.js +12 -123
  64. package/dist/components/layout/toolbar/tools/RotateClockwiseTool.js +6 -4
  65. package/dist/components/layout/toolbar/tools/RotateCounterclockwiseTool.js +6 -4
  66. package/dist/components/layout/toolbar/tools/SelectionModeSwitcherTool.js +31 -0
  67. package/dist/components/layout/toolbar/tools/SinglePageTool.js +26 -0
  68. package/dist/components/layout/toolbar/tools/ThemeSwitcherTool.js +6 -4
  69. package/dist/components/layout/toolbar/tools/ThumbnailTool.js +17 -128
  70. package/dist/components/layout/toolbar/tools/ZoomInTool.js +6 -4
  71. package/dist/components/layout/toolbar/tools/ZoomLevelDisplay.js +22 -137
  72. package/dist/components/layout/toolbar/tools/ZoomLevelTool.js +26 -123
  73. package/dist/components/layout/toolbar/tools/ZoomOutTool.js +6 -4
  74. package/dist/components/layout/toolbar/tools/defaults/RPHorizontalBar.js +95 -105
  75. package/dist/components/layout/toolbar/tools/defaults/RPVerticalBar.js +16 -125
  76. package/dist/components/layout/toolbar/tools/more-options/DocumentProperties.js +8 -5
  77. package/dist/components/layout/toolbar/tools/more-options/FileDownloadTool.js +10 -117
  78. package/dist/components/layout/toolbar/tools/more-options/FileUploadTool.js +12 -120
  79. package/dist/components/layout/toolbar/tools/more-options/FullScreenTool.js +10 -7
  80. package/dist/components/layout/toolbar/tools/more-options/MostPageTool.js +36 -125
  81. package/dist/components/layout/toolbar/tools/more-options/PrintTool.js +16 -123
  82. package/dist/components/layout/toolbar/tools/more-options/RotateTool.js +14 -11
  83. package/dist/components/layout/toolbar/tools/more-options/ScrollModeTool.js +15 -12
  84. package/dist/components/layout/toolbar/tools/more-options/SelectionModeTool.js +18 -15
  85. package/dist/components/layout/toolbar/tools/more-options/ViewModeTool.js +10 -7
  86. package/dist/components/page/AnnotationLayer.js +122 -126
  87. package/dist/components/page/CanvasLayer.js +54 -125
  88. package/dist/components/page/DualPage.js +68 -111
  89. package/dist/components/page/RPPage.js +126 -125
  90. package/dist/components/page/SinglePage.js +58 -111
  91. package/dist/components/page/TextHighlightLayer.js +184 -128
  92. package/dist/components/page/TextLayer.js +184 -125
  93. package/dist/components/ui/Checkbox.js +25 -24
  94. package/dist/components/ui/DropDown.js +11 -8
  95. package/dist/components/ui/LoadingIndicator.js +34 -129
  96. package/dist/components/ui/RPTooltip.js +412 -196
  97. package/dist/contexts/ElementPageContext.js +1 -1
  98. package/dist/contexts/FullScreenContext.js +17 -10
  99. package/dist/contexts/LocalizationContext.js +24 -29
  100. package/dist/contexts/PaginationContext.js +14 -119
  101. package/dist/contexts/PrintContext.js +67 -133
  102. package/dist/contexts/RPDocumentContext.js +32 -24
  103. package/dist/contexts/RenderQueueProvider.js +47 -119
  104. package/dist/contexts/SearchContext.js +65 -113
  105. package/dist/contexts/ThumbnailsContext.js +32 -133
  106. package/dist/contexts/ZoomContext.js +22 -22
  107. package/dist/floating-ui.react-dom-5ec29bd6.js +1327 -0
  108. package/dist/index-4baea9b5.js +1198 -0
  109. package/dist/index-655864a7.js +27 -0
  110. package/dist/{index-c9a2990a.js → index-c0faa594.js} +64 -87
  111. package/dist/index-e3ee9457.js +150 -0
  112. package/dist/main.js +193 -142
  113. package/dist/types/components/icons/DualPageIcon.d.ts +1 -1
  114. package/dist/types/components/icons/SinglePageIcon.d.ts +1 -1
  115. package/dist/types/components/layout/toolbar/tools/DualPageTool.d.ts +3 -0
  116. package/dist/types/components/layout/toolbar/tools/SelectionModeSwitcherTool.d.ts +3 -0
  117. package/dist/types/components/layout/toolbar/tools/SinglePageTool.d.ts +3 -0
  118. package/dist/types/contexts/RenderQueueProvider.d.ts +2 -2
  119. package/dist/types/main.d.ts +5 -5
  120. package/dist/types/utils/annotations.d.ts +2 -1
  121. package/dist/types/utils/getElementPositionInPage.d.ts +2 -2
  122. package/dist/types/utils/hooks/useCopyText.d.ts +1 -0
  123. package/dist/types/utils/hooks/usePrint.d.ts +3 -2
  124. package/dist/types/utils/hooks/useSearch.d.ts +1 -2
  125. package/dist/types/utils/renderPage.d.ts +2 -2
  126. package/dist/types/utils/types.d.ts +27 -4
  127. package/dist/utils/annotations.js +128 -142
  128. package/dist/utils/getWordPositionInPage.js +5 -5
  129. package/dist/utils/highlight.js +72 -72
  130. package/dist/utils/hooks/useCopyText.js +36 -0
  131. package/dist/utils/hooks/useFileDownload.js +20 -129
  132. package/dist/utils/hooks/useHighlight.js +28 -28
  133. package/dist/utils/hooks/useLicense.js +1 -1
  134. package/dist/utils/hooks/useLoadPdf.js +42 -39
  135. package/dist/utils/hooks/useLoadWorker.js +9 -6
  136. package/dist/utils/hooks/useLocalization.js +13 -13
  137. package/dist/utils/hooks/usePaginate.js +21 -126
  138. package/dist/utils/hooks/usePresentPage.js +75 -127
  139. package/dist/utils/hooks/usePrint.js +173 -130
  140. package/dist/utils/hooks/useScrollToPage.js +15 -120
  141. package/dist/utils/hooks/useSearch.js +132 -126
  142. package/dist/utils/hooks/useThumbnail.js +47 -130
  143. package/dist/utils/hooks/useVirtualReactWindow.js +64 -128
  144. package/dist/utils/injectPrintCSS.js +1 -1
  145. package/dist/utils/renderPage.js +12 -10
  146. package/package.json +23 -20
  147. package/dist/SearchCloseButton-08d57275.js +0 -33
  148. package/dist/ToolbarLayout.module-37619c4b.js +0 -3548
  149. package/dist/index-808ea7bf.js +0 -1685
  150. package/dist/index-a48ec088.js +0 -1672
@@ -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,142 +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";
4
- import "../../contexts/DocumentPasswordContext.js";
5
- import { b as Hr } from "../../ToolbarLayout.module-37619c4b.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 "../../contexts/EventCallbackContext.js";
34
- import "../../components/RPConfig.js";
35
- import "../../components/layout/Container.js";
36
- import "../../contexts/ViewportContext.js";
37
- import "../../contexts/ToolbarComponentContext.js";
38
- import "../../components/layout/sidebar/RPSplitter.js";
39
- import "../../components/layout/WrapperLayout.js";
40
- import "../../LayoutWrapper-6224491f.js";
41
- import "../../contexts/ThemeContext.js";
42
- import "../../components/RPDropFileZone.js";
43
- import "../../components/ui/Button.js";
44
- import "../../SearchCloseButton-08d57275.js";
45
- import "../../components/ui/Input.js";
46
- import "../../components/ui/Checkbox.js";
47
- import "../../components/icons/LoaderIcon.js";
48
- import "../../contexts/IconContext.js";
49
- import "../../components/ui/RPTooltip.js";
50
- import "../../components/ui/DropDown.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-67946714.js";
56
5
  import "./useLoadPdf.js";
57
6
  import "pdfjs-dist";
58
7
  import "../types.js";
59
8
  import "../../th_TH-d627cd51.js";
60
9
  import "../getThumbnailViewport.js";
61
10
  import "../../contexts/ConfigContext.js";
11
+ import "../../contexts/DocumentPasswordContext.js";
62
12
  import "../appConsole.js";
63
13
  import "./usePdfProperties.js";
64
14
  import "../convertPdfDate.js";
65
15
  import "../formatFileSize.js";
66
- import "../../components/icons/ChevronUpIcon.js";
67
- import "../highlight.js";
68
- import "../charators.js";
69
- import "../Queue.js";
70
- import "../renderPage.js";
71
- import "../../components/icons/Thumbnail.js";
72
- import "../../clsx-0c6e471a.js";
73
- import "../withRef.js";
74
- import "./useInfiniteScroll.js";
75
- import "../constants.js";
76
- import "../link_service.js";
77
- import "../annotations.js";
78
- import "../sanitizeExternalUrl.js";
79
- import "../../components/page/searchHighlight.js";
80
- import "../const.js";
81
- import "../../components/page/CustomElement.js";
82
- import "../getZoomLevel.js";
83
- import "./useDebounce.js";
84
- import "./useLicense.js";
85
- import "../getScrollDistance.js";
86
- import "../getElementPositionInPage.js";
87
- import "../calculatePage.js";
88
- import "./useMousePressed.js";
89
- import "./useGrabScroll.js";
90
- import "./usePinch.js";
91
- import "../../components/ui/PasswordModal.js";
92
- import "./useLocalization.js";
93
- import "../approximateFragtion.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/SinglePageIcon.js";
115
- import "../../components/icons/DualPageIcon.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/RPTheme.js";
137
- import "./useLoadWorker.js";
138
- import "../../components/icons/LightPdfIcon.js";
139
- import "../../components/icons/DarkPdfIcon.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
+ };
140
31
  export {
141
- Hr as useFileDownload
32
+ k as useFileDownload
142
33
  };
@@ -1,52 +1,52 @@
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
3
  import "../charators.js";
4
4
  const k = (s) => {
5
- const [n, a] = l(void 0), [u, r] = l([]), m = x(async (t) => {
5
+ const [n, c] = m(void 0), [f, l] = m([]), u = r(async (t) => {
6
6
  if (!t)
7
7
  return {};
8
8
  const i = t.numPages, e = {};
9
9
  for (let o = 1; o <= i; o++) {
10
- const g = await t.getPage(o);
11
- e[o.toString()] = await g.getTextContent();
10
+ const h = await t.getPage(o);
11
+ e[o.toString()] = await h.getTextContent();
12
12
  }
13
13
  return e;
14
- }, []), f = async (t) => {
15
- a(t);
16
- }, c = () => {
17
- r([]), a(void 0);
18
- };
14
+ }, []), p = r(async (t) => {
15
+ c(t);
16
+ }, []), g = r(() => {
17
+ l([]), c(void 0);
18
+ }, []);
19
19
  return C(() => {
20
- s && m(s).then((t) => {
20
+ s && u(s).then((t) => {
21
21
  let i = [];
22
- for (const { keyword: e, highlightColor: o, options: g } of n) {
22
+ for (const { keyword: e, highlightColor: o, options: h } of n) {
23
23
  if (!e)
24
24
  continue;
25
- const p = H(g);
26
- for (const h of Object.keys(t)) {
27
- const y = M(
25
+ const y = H(h);
26
+ for (const a of Object.keys(t)) {
27
+ const b = M(
28
28
  [e],
29
- t[h],
30
- Number(h) - 1,
31
- p
32
- ).map((b, w) => ({
33
- ...b,
34
- page: Number(h),
35
- pageMatchIdx: w,
29
+ t[a],
30
+ Number(a) - 1,
31
+ y
32
+ ).map((w, x) => ({
33
+ ...w,
34
+ page: Number(a),
35
+ pageMatchIdx: x,
36
36
  color: o,
37
37
  keyword: e
38
38
  }));
39
- i = [...i, ...y];
39
+ i = [...i, ...b];
40
40
  }
41
41
  }
42
- r(i);
42
+ l(i);
43
43
  }).catch(() => {
44
- c();
44
+ g();
45
45
  });
46
- }, [n, s]), {
47
- highlight: f,
48
- clear: c,
49
- highlightMatches: u,
46
+ }, [n, s, g, u]), {
47
+ highlight: p,
48
+ clear: g,
49
+ highlightMatches: f,
50
50
  highlightKeywords: n
51
51
  };
52
52
  };
@@ -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-06T03:19:25.099Z"), 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}`,