@pdf-viewer/react 1.15.0-beta.4 → 1.15.0-rc.1

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 (102) hide show
  1. package/dist/{ToolbarLayout.module-533a6d5a.js → ToolbarLayout.module-e3f86395.js} +990 -1034
  2. package/dist/components/RPController.js +7 -6
  3. package/dist/components/RPPages.js +6 -5
  4. package/dist/components/RPProvider.js +7 -6
  5. package/dist/components/layout/LayoutContainer.js +6 -5
  6. package/dist/components/layout/RPDefaultLayout.js +6 -5
  7. package/dist/components/layout/RPLayout.js +7 -6
  8. package/dist/components/layout/sidebar/RPSidebar.js +6 -5
  9. package/dist/components/layout/sidebar/Thumbnail.js +6 -5
  10. package/dist/components/layout/sidebar/Thumbnails.js +6 -5
  11. package/dist/components/layout/toolbar/DarkModeTool.js +2 -2
  12. package/dist/components/layout/toolbar/DocumentDialog.js +6 -5
  13. package/dist/components/layout/toolbar/DocumentProperties.js +3 -3
  14. package/dist/components/layout/toolbar/FileDownloadTool.js +6 -5
  15. package/dist/components/layout/toolbar/FileUploadTool.js +3 -3
  16. package/dist/components/layout/toolbar/FullScreenTool.js +3 -3
  17. package/dist/components/layout/toolbar/MenuItem.js +3 -3
  18. package/dist/components/layout/toolbar/MenuSeparator.js +3 -3
  19. package/dist/components/layout/toolbar/MostPageTool.js +6 -5
  20. package/dist/components/layout/toolbar/OtherTool.js +6 -5
  21. package/dist/components/layout/toolbar/Paginate.js +6 -5
  22. package/dist/components/layout/toolbar/PrintTool.js +6 -5
  23. package/dist/components/layout/toolbar/RPMenuItem.js +3 -3
  24. package/dist/components/layout/toolbar/RPMoreOptions.js +7 -6
  25. package/dist/components/layout/toolbar/RPToolbar.js +6 -5
  26. package/dist/components/layout/toolbar/RPToolbarEnd.js +6 -5
  27. package/dist/components/layout/toolbar/RotateTool.js +3 -3
  28. package/dist/components/layout/toolbar/ScrollModeTool.js +3 -3
  29. package/dist/components/layout/toolbar/SearchCloseButton.js +2 -2
  30. package/dist/components/layout/toolbar/SearchResultNavigator.js +6 -5
  31. package/dist/components/layout/toolbar/SearchTool.js +6 -5
  32. package/dist/components/layout/toolbar/SelectionModeTool.js +3 -3
  33. package/dist/components/layout/toolbar/ThumbnailTool.js +7 -6
  34. package/dist/components/layout/toolbar/ToolbarCustom.js +7 -6
  35. package/dist/components/layout/toolbar/ToolbarDefault.js +7 -6
  36. package/dist/components/layout/toolbar/ToolbarLayout.js +7 -6
  37. package/dist/components/layout/toolbar/ViewModeTool.js +3 -3
  38. package/dist/components/layout/toolbar/ZoomTool.js +6 -5
  39. package/dist/components/layout/toolbar/tools/DocumentPropertiesTool.js +7 -6
  40. package/dist/components/layout/toolbar/tools/FileDownloadTool.js +7 -6
  41. package/dist/components/layout/toolbar/tools/FileUploadTool.js +2 -2
  42. package/dist/components/layout/toolbar/tools/FullScreenTool.js +2 -2
  43. package/dist/components/layout/toolbar/tools/InputPageTool.js +7 -6
  44. package/dist/components/layout/toolbar/tools/NextPageTool.js +7 -6
  45. package/dist/components/layout/toolbar/tools/PreviousPageTool.js +7 -6
  46. package/dist/components/layout/toolbar/tools/PrintTool.js +7 -6
  47. package/dist/components/layout/toolbar/tools/RotateClockwiseTool.js +2 -2
  48. package/dist/components/layout/toolbar/tools/RotateCounterclockwiseTool.js +2 -2
  49. package/dist/components/layout/toolbar/tools/SelectionModeSwitcherTool.js +2 -2
  50. package/dist/components/layout/toolbar/tools/ThemeSwitcherTool.js +2 -2
  51. package/dist/components/layout/toolbar/tools/ThumbnailTool.js +7 -6
  52. package/dist/components/layout/toolbar/tools/ZoomInTool.js +2 -2
  53. package/dist/components/layout/toolbar/tools/ZoomLevelDisplay.js +6 -5
  54. package/dist/components/layout/toolbar/tools/ZoomLevelTool.js +7 -6
  55. package/dist/components/layout/toolbar/tools/ZoomOutTool.js +2 -2
  56. package/dist/components/layout/toolbar/tools/defaults/RPHorizontalBar.js +7 -6
  57. package/dist/components/layout/toolbar/tools/defaults/RPVerticalBar.js +7 -6
  58. package/dist/components/layout/toolbar/tools/more-options/DocumentProperties.js +3 -3
  59. package/dist/components/layout/toolbar/tools/more-options/FileDownloadTool.js +7 -6
  60. package/dist/components/layout/toolbar/tools/more-options/FileUploadTool.js +7 -6
  61. package/dist/components/layout/toolbar/tools/more-options/FullScreenTool.js +3 -3
  62. package/dist/components/layout/toolbar/tools/more-options/MostPageTool.js +7 -6
  63. package/dist/components/layout/toolbar/tools/more-options/PrintTool.js +7 -6
  64. package/dist/components/layout/toolbar/tools/more-options/RotateTool.js +3 -3
  65. package/dist/components/layout/toolbar/tools/more-options/ScrollModeTool.js +3 -3
  66. package/dist/components/layout/toolbar/tools/more-options/SelectionModeTool.js +3 -3
  67. package/dist/components/layout/toolbar/tools/more-options/ViewModeTool.js +3 -3
  68. package/dist/components/page/AnnotationLayer.js +6 -5
  69. package/dist/components/page/CanvasLayer.js +6 -5
  70. package/dist/components/page/DualPage.js +6 -5
  71. package/dist/components/page/RPPage.js +6 -5
  72. package/dist/components/page/SinglePage.js +6 -5
  73. package/dist/components/page/TextHighlightLayer.js +6 -5
  74. package/dist/components/page/TextLayer.js +6 -5
  75. package/dist/components/ui/Checkbox.js +1 -1
  76. package/dist/components/ui/DropDown.js +3 -3
  77. package/dist/components/ui/LoadingIndicator.js +6 -5
  78. package/dist/components/ui/RPTooltip.js +415 -201
  79. package/dist/contexts/PaginationContext.js +8 -7
  80. package/dist/contexts/PrintContext.js +8 -7
  81. package/dist/contexts/RenderQueueProvider.js +8 -7
  82. package/dist/contexts/SearchContext.js +8 -7
  83. package/dist/contexts/ThumbnailsContext.js +8 -7
  84. package/dist/floating-ui.react-dom-6b2fe0df.js +1474 -0
  85. package/dist/{index-c9a2990a.js → index-35c7f4a2.js} +3 -3
  86. package/dist/index-f563c6f0.js +1889 -0
  87. package/dist/main.js +91 -90
  88. package/dist/types/utils/hooks/useCopyText.d.ts +1 -0
  89. package/dist/utils/annotations.js +108 -116
  90. package/dist/utils/hooks/useCopyText.js +36 -0
  91. package/dist/utils/hooks/useFileDownload.js +6 -5
  92. package/dist/utils/hooks/useLicense.js +1 -1
  93. package/dist/utils/hooks/usePaginate.js +6 -5
  94. package/dist/utils/hooks/usePresentPage.js +6 -5
  95. package/dist/utils/hooks/usePrint.js +6 -5
  96. package/dist/utils/hooks/useScrollToPage.js +6 -5
  97. package/dist/utils/hooks/useSearch.js +6 -5
  98. package/dist/utils/hooks/useThumbnail.js +6 -5
  99. package/dist/utils/hooks/useVirtualReactWindow.js +6 -5
  100. package/package.json +1 -1
  101. package/dist/index-808ea7bf.js +0 -1685
  102. package/dist/index-a48ec088.js +0 -1672
package/dist/main.js CHANGED
@@ -1,41 +1,41 @@
1
- import { RPProvider as Mr } from "./components/RPProvider.js";
2
- import { a as vr, R as Vr, S as br, b as kr, u as yr, c as Br, d as Hr } from "./ToolbarLayout.module-533a6d5a.js";
3
- import { RPConfig as Or } from "./components/RPConfig.js";
4
- import { RPLayout as Er } from "./components/layout/RPLayout.js";
5
- import { RPController as Ur } from "./components/RPController.js";
6
- import { RPTheme as qr } from "./components/RPTheme.js";
7
- import { RPDropFileZone as Gr } from "./components/RPDropFileZone.js";
8
- import { useDarkModeContext as Kr } from "./contexts/DarkModeContext.js";
9
- import { useDocumentContext as Wr } from "./contexts/RPDocumentContext.js";
10
- import { useRotationContext as Yr } from "./contexts/RotationContext.js";
11
- import { useViewModeContext as $r } from "./contexts/ViewModeContext.js";
12
- import { useDropFileZoneContext as rt } from "./contexts/DropFileZoneContext.js";
13
- import { useOpenFileContext as mt } from "./contexts/FileInputContext.js";
14
- import { useZoomContext as it } from "./contexts/ZoomContext.js";
15
- import { useHighlightContext as xt } from "./contexts/HighlightContext.js";
16
- import { usePdfProperties as ft } from "./utils/hooks/usePdfProperties.js";
17
- import { useFullScreenContext as at } from "./contexts/FullScreenContext.js";
18
- import { usePageRotateContext as ut } from "./utils/hooks/usePageRotateContext.js";
19
- import { useElementPageContext as Tt } from "./contexts/ElementPageContext.js";
20
- import { ThemeSwitcherTool as ct } from "./components/layout/toolbar/tools/ThemeSwitcherTool.js";
21
- import { ThumbnailTool as dt } from "./components/layout/toolbar/tools/ThumbnailTool.js";
22
- import { FileUploadTool as ht } from "./components/layout/toolbar/tools/FileUploadTool.js";
23
- import { FileDownloadTool as wt } from "./components/layout/toolbar/tools/FileDownloadTool.js";
24
- import { PrintTool as Ft } from "./components/layout/toolbar/tools/PrintTool.js";
25
- import { FullScreenTool as Mt } from "./components/layout/toolbar/tools/FullScreenTool.js";
26
- import { PreviousPageTool as vt } from "./components/layout/toolbar/tools/PreviousPageTool.js";
27
- import { NextPageTool as bt } from "./components/layout/toolbar/tools/NextPageTool.js";
28
- import { InputPageTool as yt } from "./components/layout/toolbar/tools/InputPageTool.js";
29
- import { ZoomInTool as Ht } from "./components/layout/toolbar/tools/ZoomInTool.js";
30
- import { ZoomOutTool as Ot } from "./components/layout/toolbar/tools/ZoomOutTool.js";
31
- import { ZoomLevelTool as Et } from "./components/layout/toolbar/tools/ZoomLevelTool.js";
32
- import { DocumentPropertiesTool as Ut } from "./components/layout/toolbar/tools/DocumentPropertiesTool.js";
33
- import { RotateClockwiseTool as qt } from "./components/layout/toolbar/tools/RotateClockwiseTool.js";
34
- import { RotateCounterclockwiseTool as Gt } from "./components/layout/toolbar/tools/RotateCounterclockwiseTool.js";
35
- import { RPHorizontalBar as Kt } from "./components/layout/toolbar/tools/defaults/RPHorizontalBar.js";
36
- import { RPVerticalBar as Wt } from "./components/layout/toolbar/tools/defaults/RPVerticalBar.js";
37
- import { SelectionModeSwitcherTool as Yt } from "./components/layout/toolbar/tools/SelectionModeSwitcherTool.js";
38
- import { Locales as $t, ScrollMode as om, SelectionMode as rm, ThemeVariables as tm, ViewMode as mm, ZoomLevel as pm } from "./utils/types.js";
1
+ import { RPProvider as Lr } from "./components/RPProvider.js";
2
+ import { a as Vr, R as br, S as kr, b as yr, u as Br, c as Hr, d as Ir } from "./ToolbarLayout.module-e3f86395.js";
3
+ import { RPConfig as zr } from "./components/RPConfig.js";
4
+ import { RPLayout as Nr } from "./components/layout/RPLayout.js";
5
+ import { RPController as jr } from "./components/RPController.js";
6
+ import { RPTheme as Ar } from "./components/RPTheme.js";
7
+ import { RPDropFileZone as Jr } from "./components/RPDropFileZone.js";
8
+ import { useDarkModeContext as Qr } from "./contexts/DarkModeContext.js";
9
+ import { useDocumentContext as Xr } from "./contexts/RPDocumentContext.js";
10
+ import { useRotationContext as _r } from "./contexts/RotationContext.js";
11
+ import { useViewModeContext as ot } from "./contexts/ViewModeContext.js";
12
+ import { useDropFileZoneContext as tt } from "./contexts/DropFileZoneContext.js";
13
+ import { useOpenFileContext as pt } from "./contexts/FileInputContext.js";
14
+ import { useZoomContext as et } from "./contexts/ZoomContext.js";
15
+ import { useHighlightContext as lt } from "./contexts/HighlightContext.js";
16
+ import { usePdfProperties as nt } from "./utils/hooks/usePdfProperties.js";
17
+ import { useFullScreenContext as st } from "./contexts/FullScreenContext.js";
18
+ import { usePageRotateContext as Pt } from "./utils/hooks/usePageRotateContext.js";
19
+ import { useElementPageContext as Ct } from "./contexts/ElementPageContext.js";
20
+ import { ThemeSwitcherTool as Rt } from "./components/layout/toolbar/tools/ThemeSwitcherTool.js";
21
+ import { ThumbnailTool as gt } from "./components/layout/toolbar/tools/ThumbnailTool.js";
22
+ import { FileUploadTool as St } from "./components/layout/toolbar/tools/FileUploadTool.js";
23
+ import { FileDownloadTool as Dt } from "./components/layout/toolbar/tools/FileDownloadTool.js";
24
+ import { PrintTool as Zt } from "./components/layout/toolbar/tools/PrintTool.js";
25
+ import { FullScreenTool as Lt } from "./components/layout/toolbar/tools/FullScreenTool.js";
26
+ import { PreviousPageTool as Vt } from "./components/layout/toolbar/tools/PreviousPageTool.js";
27
+ import { NextPageTool as kt } from "./components/layout/toolbar/tools/NextPageTool.js";
28
+ import { InputPageTool as Bt } from "./components/layout/toolbar/tools/InputPageTool.js";
29
+ import { ZoomInTool as It } from "./components/layout/toolbar/tools/ZoomInTool.js";
30
+ import { ZoomOutTool as zt } from "./components/layout/toolbar/tools/ZoomOutTool.js";
31
+ import { ZoomLevelTool as Nt } from "./components/layout/toolbar/tools/ZoomLevelTool.js";
32
+ import { DocumentPropertiesTool as jt } from "./components/layout/toolbar/tools/DocumentPropertiesTool.js";
33
+ import { RotateClockwiseTool as At } from "./components/layout/toolbar/tools/RotateClockwiseTool.js";
34
+ import { RotateCounterclockwiseTool as Jt } from "./components/layout/toolbar/tools/RotateCounterclockwiseTool.js";
35
+ import { RPHorizontalBar as Qt } from "./components/layout/toolbar/tools/defaults/RPHorizontalBar.js";
36
+ import { RPVerticalBar as Xt } from "./components/layout/toolbar/tools/defaults/RPVerticalBar.js";
37
+ import { SelectionModeSwitcherTool as _t } from "./components/layout/toolbar/tools/SelectionModeSwitcherTool.js";
38
+ import { Locales as om, ScrollMode as rm, SelectionMode as tm, ThemeVariables as mm, ViewMode as pm, ZoomLevel as im } from "./utils/types.js";
39
39
  import "react/jsx-runtime";
40
40
  import "react";
41
41
  import "./contexts/DocumentPasswordContext.js";
@@ -89,15 +89,15 @@ import "./components/layout/WrapperLayout.js";
89
89
  import "./LayoutWrapper-6224491f.js";
90
90
  import "./SearchCloseButton-08d57275.js";
91
91
  import "./components/ui/RPTooltip.js";
92
- import "./index-c9a2990a.js";
92
+ import "./index-35c7f4a2.js";
93
93
  import "react-dom";
94
- import "./index-808ea7bf.js";
94
+ import "./floating-ui.react-dom-6b2fe0df.js";
95
95
  import "./components/icons/CloseIcon.js";
96
96
  import "./components/ui/Checkbox.js";
97
97
  import "./components/icons/CheckIcon.js";
98
98
  import "./contexts/IconContext.js";
99
99
  import "./components/ui/DropDown.js";
100
- import "./index-a48ec088.js";
100
+ import "./index-f563c6f0.js";
101
101
  import "./components/layout/toolbar/MenuItem.js";
102
102
  import "./components/layout/toolbar/MenuSeparator.js";
103
103
  import "./utils/dateFormatter.js";
@@ -116,6 +116,7 @@ import "./utils/hooks/useGrabScroll.js";
116
116
  import "./utils/hooks/usePinch.js";
117
117
  import "./utils/hooks/useDebounce.js";
118
118
  import "./components/ui/PasswordModal.js";
119
+ import "./utils/hooks/useCopyText.js";
119
120
  import "./utils/getScrollDistance.js";
120
121
  import "./utils/getWordPositionInPage.js";
121
122
  import "./utils/getThumbnailViewport.js";
@@ -169,53 +170,53 @@ import "./utils/getElementPositionInPage.js";
169
170
  import "./components/icons/ChevronDownIcon.js";
170
171
  import "./components/layout/toolbar/ThumbnailTool.js";
171
172
  export {
172
- Ut as DocumentPropertiesTool,
173
- wt as FileDownloadTool,
174
- ht as FileUploadTool,
175
- Mt as FullScreenTool,
176
- yt as InputPageTool,
177
- $t as Locales,
178
- bt as NextPageTool,
179
- vt as PreviousPageTool,
180
- Ft as PrintTool,
181
- Or as RPConfig,
182
- Ur as RPController,
183
- vr as RPDefaultLayout,
184
- Gr as RPDropFileZone,
185
- Kt as RPHorizontalBar,
186
- Er as RPLayout,
187
- Vr as RPPages,
188
- Mr as RPProvider,
189
- qr as RPTheme,
190
- Wt as RPVerticalBar,
191
- qt as RotateClockwiseTool,
192
- Gt as RotateCounterclockwiseTool,
193
- om as ScrollMode,
194
- br as SearchTool,
195
- rm as SelectionMode,
196
- Yt as SelectionModeSwitcherTool,
197
- ct as ThemeSwitcherTool,
198
- tm as ThemeVariables,
199
- dt as ThumbnailTool,
200
- mm as ViewMode,
201
- Ht as ZoomInTool,
202
- pm as ZoomLevel,
203
- Et as ZoomLevelTool,
204
- Ot as ZoomOutTool,
205
- Kr as useDarkModeContext,
206
- Wr as useDocumentContext,
207
- rt as useDropFileZoneContext,
208
- Tt as useElementPageContext,
209
- kr as useFileDownload,
210
- at as useFullScreenContext,
211
- xt as useHighlightContext,
212
- mt as useOpenFileContext,
213
- ut as usePageRotateContext,
214
- yr as usePaginationContext,
215
- ft as usePdfProperties,
216
- Br as usePrintContext,
217
- Yr as useRotationContext,
218
- Hr as useSearchContext,
219
- $r as useViewModeContext,
220
- it as useZoomContext
173
+ jt as DocumentPropertiesTool,
174
+ Dt as FileDownloadTool,
175
+ St as FileUploadTool,
176
+ Lt as FullScreenTool,
177
+ Bt as InputPageTool,
178
+ om as Locales,
179
+ kt as NextPageTool,
180
+ Vt as PreviousPageTool,
181
+ Zt as PrintTool,
182
+ zr as RPConfig,
183
+ jr as RPController,
184
+ Vr as RPDefaultLayout,
185
+ Jr as RPDropFileZone,
186
+ Qt as RPHorizontalBar,
187
+ Nr as RPLayout,
188
+ br as RPPages,
189
+ Lr as RPProvider,
190
+ Ar as RPTheme,
191
+ Xt as RPVerticalBar,
192
+ At as RotateClockwiseTool,
193
+ Jt as RotateCounterclockwiseTool,
194
+ rm as ScrollMode,
195
+ kr as SearchTool,
196
+ tm as SelectionMode,
197
+ _t as SelectionModeSwitcherTool,
198
+ Rt as ThemeSwitcherTool,
199
+ mm as ThemeVariables,
200
+ gt as ThumbnailTool,
201
+ pm as ViewMode,
202
+ It as ZoomInTool,
203
+ im as ZoomLevel,
204
+ Nt as ZoomLevelTool,
205
+ zt as ZoomOutTool,
206
+ Qr as useDarkModeContext,
207
+ Xr as useDocumentContext,
208
+ tt as useDropFileZoneContext,
209
+ Ct as useElementPageContext,
210
+ yr as useFileDownload,
211
+ st as useFullScreenContext,
212
+ lt as useHighlightContext,
213
+ pt as useOpenFileContext,
214
+ Pt as usePageRotateContext,
215
+ Br as usePaginationContext,
216
+ nt as usePdfProperties,
217
+ Hr as usePrintContext,
218
+ _r as useRotationContext,
219
+ Ir as useSearchContext,
220
+ ot as useViewModeContext,
221
+ et as useZoomContext
221
222
  };
@@ -0,0 +1 @@
1
+ export declare const useCopyText: (container: HTMLElement | null) => void;
@@ -1,20 +1,20 @@
1
- import { sanitizeExternalUrl as _ } from "./sanitizeExternalUrl.js";
2
- import { AnnotationSubType as E, AnnotationType as u } from "./types.js";
1
+ import { sanitizeExternalUrl as L } from "./sanitizeExternalUrl.js";
2
+ import { AnnotationSubType as _, AnnotationType as l } from "./types.js";
3
3
  import { dateFormatter as I } from "./dateFormatter.js";
4
4
  import "../th_TH-d627cd51.js";
5
- const v = ["click", "dblclick", "input", "change"], b = /* @__PURE__ */ new Map(), L = (e, t) => `${e.loadingTask.docId}___${t.num}R${t.gen === 0 ? "" : t.gen}`;
5
+ const v = ["click", "dblclick", "input", "change"], g = /* @__PURE__ */ new Map(), E = (e, t) => `${e.loadingTask.docId}___${t.num}R${t.gen === 0 ? "" : t.gen}`;
6
6
  function x(e, t) {
7
- const n = L(e, t);
8
- return b.has(n) ? b.get(n) ?? null : null;
7
+ const n = E(e, t);
8
+ return g.has(n) ? g.get(n) ?? null : null;
9
9
  }
10
10
  const B = (e, t, n) => {
11
- b.set(L(e, t), n);
11
+ g.set(E(e, t), n);
12
12
  }, O = (e, t) => {
13
13
  switch (t[1].name) {
14
14
  case "XYZ":
15
15
  return {
16
- bottomOffset: (n, s) => t[3] === null ? s : t[3],
17
- leftOffset: (n, s) => t[2] === null ? 0 : t[2],
16
+ bottomOffset: (n, a) => t[3] === null ? a : t[3],
17
+ leftOffset: (n, a) => t[2] === null ? 0 : t[2],
18
18
  pageIndex: e,
19
19
  scaleTo: t[4]
20
20
  };
@@ -43,15 +43,15 @@ const B = (e, t, n) => {
43
43
  };
44
44
  }
45
45
  };
46
- async function h(e, t) {
46
+ async function b(e, t) {
47
47
  let n;
48
48
  if (typeof t == "string" ? n = await e.getDestination(t) : n = t, n && typeof n[0] == "object" && n[0] !== null) {
49
- const s = n[0], a = x(e, s);
50
- if (a === null) {
51
- const r = await e.getPageIndex(s);
52
- return B(e, s, r), await h(e, n);
49
+ const a = n[0], s = x(e, a);
50
+ if (s === null) {
51
+ const r = await e.getPageIndex(a);
52
+ return B(e, a, r), await b(e, n);
53
53
  } else
54
- return O(a, n);
54
+ return O(s, n);
55
55
  } else
56
56
  return O(n[0], n);
57
57
  }
@@ -59,40 +59,40 @@ const M = (e) => {
59
59
  const n = e.target.parentNode;
60
60
  if (!n)
61
61
  return;
62
- const s = new MutationObserver((a) => {
63
- a.forEach(() => {
62
+ const a = new MutationObserver((s) => {
63
+ s.forEach(() => {
64
64
  n.querySelectorAll(
65
65
  '[data-l10n-id="pdfjs-annotation-date-time-string"]'
66
66
  ).forEach((o) => {
67
- const i = o.getAttribute("data-l10n-args");
68
- if (i) {
67
+ const c = o.getAttribute("data-l10n-args");
68
+ if (c) {
69
69
  try {
70
- const { dateObj: c } = JSON.parse(i);
71
- c && (o.textContent = I(c));
70
+ const { dateObj: i } = JSON.parse(c);
71
+ i && (o.textContent = I(i));
72
72
  } catch {
73
73
  }
74
- s.disconnect();
74
+ a.disconnect();
75
75
  }
76
76
  });
77
77
  });
78
78
  });
79
- return s.observe(n, {
79
+ return a.observe(n, {
80
80
  childList: !0,
81
81
  // Watch for changes to child elements
82
82
  subtree: !0,
83
83
  // Watch all descendants, not just direct children
84
84
  attributes: !0
85
85
  // Watch for changes to attributes
86
- }), () => s.disconnect();
87
- }, P = (e, t, n, s) => {
86
+ }), () => a.disconnect();
87
+ }, P = (e, t, n, a) => {
88
88
  if (e.type !== "click")
89
89
  return;
90
- const a = e.target, r = a.getAttribute("data-element-id"), o = a.getAttribute("href");
90
+ const s = e.target, r = s.getAttribute("data-element-id"), o = s.getAttribute("href");
91
91
  if (o && o !== "#")
92
92
  return;
93
- const i = t.find((c) => c.id === r);
94
- !i || i.annotationType !== E.Link || i.dest && h(n, i.dest).then((c) => {
95
- s(c);
93
+ const c = t.find((i) => i.id === r);
94
+ !c || c.annotationType !== _.Link || c.dest && b(n, c.dest).then((i) => {
95
+ a(i);
96
96
  });
97
97
  };
98
98
  function U(e, t) {
@@ -104,44 +104,36 @@ function V(e, t) {
104
104
  e.removeEventListener(n, t);
105
105
  }
106
106
  function $(e) {
107
- const { id: t, url: n, unsafeUrl: s, dest: a } = e;
108
- new MutationObserver((o, i) => {
107
+ const { id: t, url: n, unsafeUrl: a } = e;
108
+ new MutationObserver((r, o) => {
109
109
  const c = document.querySelector(`[data-annotation-id="${t}"]`);
110
110
  if (c) {
111
- const l = c.querySelector("a");
112
- if (l)
113
- if (a && !n && !s)
114
- l == null || l.setAttribute("href", "#");
115
- else if (n || s) {
116
- const g = _((n || s) ?? "", "");
117
- l == null || l.setAttribute("target", "_blank"), l == null || l.setAttribute("href", g), l == null || l.setAttribute("rel", "noopener noreferrer");
118
- } else
119
- l == null || l.setAttribute("href", "");
120
- i.disconnect();
111
+ const i = c.querySelector("a"), p = L((n || a) ?? "", "");
112
+ i && (i == null || i.setAttribute("target", "_blank"), i == null || i.setAttribute("href", p), i == null || i.setAttribute("rel", "noopener noreferrer")), o.disconnect();
121
113
  }
122
114
  }).observe(document.body, { childList: !0, subtree: !0 });
123
115
  }
124
116
  function D(e, t, n) {
125
- const { rotation: s, scale: a } = t, r = s % 180 === 0;
117
+ const { rotation: a, scale: s } = t, r = a % 180 === 0;
126
118
  if (e.fieldType === "Btn" && e.pushButton) {
127
- const o = e.rect[2] - e.rect[0], i = e.rect[3] - e.rect[1], c = document.createElement("canvas");
128
- c.setAttribute("width", ((r ? o : i) * a).toString()), c.setAttribute("height", ((r ? i : o) * a).toString()), n.set(e.id, c);
119
+ const o = e.rect[2] - e.rect[0], c = e.rect[3] - e.rect[1], i = document.createElement("canvas");
120
+ i.setAttribute("width", ((r ? o : c) * s).toString()), i.setAttribute("height", ((r ? c : o) * s).toString()), n.set(e.id, i);
129
121
  }
130
122
  }
131
- function S(e) {
123
+ function k(e) {
132
124
  var r;
133
125
  let t = e;
134
126
  for (; t.tagName !== "SECTION"; )
135
127
  t = t.parentElement;
136
- const n = t.getAttribute("aria-haspopup") === "dialog", s = t.classList.contains("popupAnnotation");
137
- if (!n && !s)
128
+ const n = t.getAttribute("aria-haspopup") === "dialog", a = t.classList.contains("popupAnnotation");
129
+ if (!n && !a)
138
130
  return;
139
- let a = t.id || t.getAttribute("aria-controls");
140
- if (a || (a = (r = t.firstChild) == null ? void 0 : r.id), a && t.parentElement) {
141
- const o = t.parentElement.querySelector(`[aria-controls="${a}"]`);
142
- o && new MutationObserver((c, l) => {
143
- const g = document.querySelectorAll(".popupDate");
144
- g.length > 0 && (g.forEach((m) => {
131
+ let s = t.id || t.getAttribute("aria-controls");
132
+ if (s || (s = (r = t.firstChild) == null ? void 0 : r.id), s && t.parentElement) {
133
+ const o = t.parentElement.querySelector(`[aria-controls="${s}"]`);
134
+ o && new MutationObserver((i, p) => {
135
+ const h = document.querySelectorAll(".popupDate");
136
+ h.length > 0 && (h.forEach((m) => {
145
137
  if (m.innerHTML)
146
138
  return !1;
147
139
  const N = m.getAttribute("data-l10n-args");
@@ -149,31 +141,31 @@ function S(e) {
149
141
  const { date: y, time: A } = JSON.parse(N);
150
142
  y && A && (m.textContent = `${y}, ${A}`);
151
143
  }
152
- }), l.disconnect());
144
+ }), p.disconnect());
153
145
  }).observe(o, { childList: !0, subtree: !0 });
154
146
  }
155
147
  }
156
- function p(e, t, n) {
157
- const s = [];
148
+ function d(e, t, n) {
149
+ const a = [];
158
150
  if (n)
159
- for (const a of n)
160
- a[e] === t && s.push(a);
161
- return s;
151
+ for (const s of n)
152
+ s[e] === t && a.push(s);
153
+ return a;
162
154
  }
163
- function f(e, t) {
155
+ function u(e, t) {
164
156
  return { type: e, data: t };
165
157
  }
166
- async function w(e, t) {
158
+ async function S(e, t) {
167
159
  if (e.dest)
168
160
  if (typeof e.dest == "string") {
169
- const n = await h(t, e.dest);
170
- return f(u.INTERNAL_LINK, {
161
+ const n = await b(t, e.dest);
162
+ return u(l.INTERNAL_LINK, {
171
163
  referencedPage: n.pageIndex,
172
164
  offset: null
173
165
  });
174
166
  } else {
175
167
  const n = await t.getPageIndex(e.dest[0]);
176
- return f(u.INTERNAL_LINK, {
168
+ return u(l.INTERNAL_LINK, {
177
169
  referencedPage: n,
178
170
  offset: {
179
171
  left: e.dest[2],
@@ -182,7 +174,7 @@ async function w(e, t) {
182
174
  });
183
175
  }
184
176
  else if (e.url)
185
- return f(u.LINK, {
177
+ return u(l.LINK, {
186
178
  url: e.url,
187
179
  unsafeUrl: e.unsafeUrl
188
180
  });
@@ -190,113 +182,113 @@ async function w(e, t) {
190
182
  function T(e) {
191
183
  for (const t of e.getElementsByTagName("span")) {
192
184
  let n = t.textContent;
193
- const s = JSON.parse(t.dataset.l10nArgs ?? "{}");
185
+ const a = JSON.parse(t.dataset.l10nArgs ?? "{}");
194
186
  if (n)
195
- for (const a in s)
196
- n = n.replace(`{{${a}}}`, s[a]);
187
+ for (const s in a)
188
+ n = n.replace(`{{${s}}}`, a[s]);
197
189
  t.textContent = n;
198
190
  }
199
191
  }
200
- function C(e) {
201
- return f(u.FILE_ATTACHMENT, e.file);
192
+ function w(e) {
193
+ return u(l.FILE_ATTACHMENT, e.file);
202
194
  }
203
- function d(e, t) {
195
+ function f(e, t) {
204
196
  switch (e.type) {
205
197
  case "textarea":
206
198
  case "text":
207
- return f(u.FORM_TEXT, {
199
+ return u(l.FORM_TEXT, {
208
200
  fieldName: e.name,
209
201
  value: e.value
210
202
  });
211
203
  case "select-one":
212
204
  case "select-multiple":
213
205
  const n = [];
214
- for (const a of e.options)
206
+ for (const s of e.options)
215
207
  n.push({
216
- value: a.value,
217
- label: a.label
208
+ value: s.value,
209
+ label: s.label
218
210
  });
219
- const s = [];
220
- for (const a of e.selectedOptions)
221
- s.push({
222
- value: a.value,
223
- label: a.label
211
+ const a = [];
212
+ for (const s of e.selectedOptions)
213
+ a.push({
214
+ value: s.value,
215
+ label: s.label
224
216
  });
225
- return f(u.FORM_SELECT, {
217
+ return u(l.FORM_SELECT, {
226
218
  fieldName: e.name,
227
- value: s,
219
+ value: a,
228
220
  options: n
229
221
  });
230
222
  case "checkbox":
231
- return f(u.FORM_CHECKBOX, {
223
+ return u(l.FORM_CHECKBOX, {
232
224
  fieldName: e.name,
233
225
  checked: e.checked
234
226
  });
235
227
  case "radio":
236
- return f(u.FORM_RADIO, {
228
+ return u(l.FORM_RADIO, {
237
229
  fieldName: e.name,
238
230
  ...t
239
231
  });
240
232
  case "button":
241
- return f(u.FORM_BUTTON, {
233
+ return u(l.FORM_BUTTON, {
242
234
  fieldName: e.name,
243
235
  ...t
244
236
  });
245
237
  }
246
238
  }
247
239
  async function W(e, t, n) {
248
- var a;
249
- let s = e.target.parentNode;
250
- if (s.tagName === "DIV" && (s = s.firstChild), S(s), typeof s.className != "object")
251
- if (s.className === "linkAnnotation" && e.type === "click") {
252
- const r = (a = s.dataset) == null ? void 0 : a.annotationId;
240
+ var s;
241
+ let a = e.target.parentNode;
242
+ if (a.tagName === "DIV" && (a = a.firstChild), k(a), typeof a.className != "object")
243
+ if (a.className === "linkAnnotation" && e.type === "click") {
244
+ const r = (s = a.dataset) == null ? void 0 : s.annotationId;
253
245
  if (r) {
254
- const o = p("id", r, n);
246
+ const o = d("id", r, n);
255
247
  if (o.length)
256
- return await w(o[0], t);
248
+ return await S(o[0], t);
257
249
  }
258
250
  } else if (
259
251
  /* annotation.className.includes('popupAnnotation') || */
260
- s.className.includes("textAnnotation")
252
+ a.className.includes("textAnnotation")
261
253
  )
262
- T(s);
263
- else if (s.className.includes("fileAttachmentAnnotation")) {
264
- T(s);
265
- const r = s.dataset.annotationId;
254
+ T(a);
255
+ else if (a.className.includes("fileAttachmentAnnotation")) {
256
+ T(a);
257
+ const r = a.dataset.annotationId;
266
258
  if (r && e.type === "dblclick")
267
- return C(p("id", r, n)[0]);
268
- } else if (s.className.includes("textWidgetAnnotation") && e.type === "input") {
269
- let r = s.getElementsByTagName("input")[0];
270
- return r || (r = s.getElementsByTagName("textarea")[0]), d(r);
259
+ return w(d("id", r, n)[0]);
260
+ } else if (a.className.includes("textWidgetAnnotation") && e.type === "input") {
261
+ let r = a.getElementsByTagName("input")[0];
262
+ return r || (r = a.getElementsByTagName("textarea")[0]), f(r);
271
263
  } else {
272
- if (s.className.includes("choiceWidgetAnnotation") && e.type === "input")
273
- return d(s.getElementsByTagName("select")[0]);
274
- if (s.className.includes("buttonWidgetAnnotation checkBox") && e.type === "change")
275
- return d(s.getElementsByTagName("input")[0]);
276
- if (s.className.includes("buttonWidgetAnnotation radioButton") && e.type === "change") {
277
- const r = s.dataset.annotationId;
264
+ if (a.className.includes("choiceWidgetAnnotation") && e.type === "input")
265
+ return f(a.getElementsByTagName("select")[0]);
266
+ if (a.className.includes("buttonWidgetAnnotation checkBox") && e.type === "change")
267
+ return f(a.getElementsByTagName("input")[0]);
268
+ if (a.className.includes("buttonWidgetAnnotation radioButton") && e.type === "change") {
269
+ const r = a.dataset.annotationId;
278
270
  if (r) {
279
- const o = p("id", r, n)[0], i = [];
280
- for (const c of p(
271
+ const o = d("id", r, n)[0], c = [];
272
+ for (const i of d(
281
273
  "fieldName",
282
274
  o.fieldName,
283
275
  n
284
276
  ))
285
- c.buttonValue && i.push(c.buttonValue);
286
- return d(s.getElementsByTagName("input")[0], {
277
+ i.buttonValue && c.push(i.buttonValue);
278
+ return f(a.getElementsByTagName("input")[0], {
287
279
  value: o.buttonValue,
288
280
  defaultValue: o.fieldValue,
289
- options: i
281
+ options: c
290
282
  });
291
283
  }
292
- } else if (s.className.includes("buttonWidgetAnnotation pushButton") && e.type === "click") {
293
- const r = s.dataset.annotationId;
284
+ } else if (a.className.includes("buttonWidgetAnnotation pushButton") && e.type === "click") {
285
+ const r = a.dataset.annotationId;
294
286
  if (r) {
295
- const o = p("id", r, n)[0], { action: i } = o;
296
- return i && ["Print", "SaveAs"].includes(i) ? { type: u.BUTTON, data: o } : o.resetForm ? d(
287
+ const o = d("id", r, n)[0], { action: c } = o;
288
+ return c && ["Print", "SaveAs"].includes(c) ? { type: l.BUTTON, data: o } : o.resetForm ? f(
297
289
  { name: o.fieldName, type: "button" },
298
290
  { actions: o.actions, reset: !0 }
299
- ) : d(
291
+ ) : f(
300
292
  { name: o.fieldName, type: "button" },
301
293
  { actions: o.actions, reset: !1 }
302
294
  );
@@ -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
+ };