@pdf-viewer/react 0.0.0-experimental.7 → 0.0.0-experimental.8

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 (227) hide show
  1. package/dist/{LayoutWrapper-e310e12f.js → LayoutWrapper-6224491f.js} +2 -10
  2. package/dist/{SearchCloseButton-52d8ac31.js → SearchCloseButton-08d57275.js} +8 -16
  3. package/dist/ToolbarLayout.module-49d71551.js +3556 -0
  4. package/dist/assets/style.css +1 -1
  5. package/dist/assets/style.js +11 -11
  6. package/dist/components/RPConfig.js +4 -28
  7. package/dist/components/RPController.js +57 -104
  8. package/dist/components/RPDropFileZone.js +20 -43
  9. package/dist/components/RPPages.js +9 -21
  10. package/dist/components/RPProvider.js +16 -43
  11. package/dist/components/RPTheme.js +10 -17
  12. package/dist/components/icons/CheckIcon.js +18 -12
  13. package/dist/components/icons/ChevronDownIcon.js +19 -15
  14. package/dist/components/icons/ChevronUpIcon.js +18 -12
  15. package/dist/components/icons/ClearIcon.js +21 -24
  16. package/dist/components/icons/ClockwiseIcon.js +18 -12
  17. package/dist/components/icons/CloseIcon.js +18 -12
  18. package/dist/components/icons/DarkPdfIcon.js +8 -5
  19. package/dist/components/icons/DualPageIcon.js +18 -12
  20. package/dist/components/icons/FileDownloadDefaultIcon.js +19 -16
  21. package/dist/components/icons/FileUploadDefaultIcon.js +19 -16
  22. package/dist/components/icons/FullScreenIcon.js +18 -12
  23. package/dist/components/icons/GoToDownIcon.js +18 -12
  24. package/dist/components/icons/HandModeDefaultIcon.js +18 -12
  25. package/dist/components/icons/HorizontalScrollingIcon.js +20 -14
  26. package/dist/components/icons/InfoIcon.js +18 -12
  27. package/dist/components/icons/LightPdfIcon.js +8 -5
  28. package/dist/components/icons/LoaderIcon.js +9 -9
  29. package/dist/components/icons/MoonIcon.js +18 -12
  30. package/dist/components/icons/PageScrollingIcon.js +20 -14
  31. package/dist/components/icons/PrintDefaultIcon.js +19 -16
  32. package/dist/components/icons/SearchIcon.js +18 -12
  33. package/dist/components/icons/SinglePageIcon.js +18 -12
  34. package/dist/components/icons/SunIcon.js +21 -24
  35. package/dist/components/icons/TextSelectionDefaultIcon.js +19 -16
  36. package/dist/components/icons/ThreeDotIcon.js +18 -12
  37. package/dist/components/icons/Thumbnail.js +50 -30
  38. package/dist/components/icons/VerticalScrollingIcon.js +20 -14
  39. package/dist/components/icons/WrappedScrollingIcon.js +20 -14
  40. package/dist/components/icons/ZoomInIcon.js +18 -12
  41. package/dist/components/icons/ZoomOutIcon.js +18 -12
  42. package/dist/components/layout/Container.js +12 -14
  43. package/dist/components/layout/LayoutContainer.js +9 -21
  44. package/dist/components/layout/LayoutWrapper.js +1 -1
  45. package/dist/components/layout/RPDefaultLayout.js +8 -20
  46. package/dist/components/layout/RPLayout.js +36 -58
  47. package/dist/components/layout/WrapperLayout.js +7 -32
  48. package/dist/components/layout/sidebar/RPSidebar.js +8 -20
  49. package/dist/components/layout/sidebar/RPSplitter.js +22 -23
  50. package/dist/components/layout/sidebar/Thumbnail.js +9 -21
  51. package/dist/components/layout/sidebar/Thumbnails.js +8 -20
  52. package/dist/components/layout/toolbar/DarkModeTool.js +6 -42
  53. package/dist/components/layout/toolbar/DocumentDialog.js +9 -21
  54. package/dist/components/layout/toolbar/DocumentProperties.js +15 -43
  55. package/dist/components/layout/toolbar/FileDownloadTool.js +8 -20
  56. package/dist/components/layout/toolbar/FileUploadTool.js +11 -80
  57. package/dist/components/layout/toolbar/FullScreenTool.js +35 -73
  58. package/dist/components/layout/toolbar/MenuItem.js +10 -28
  59. package/dist/components/layout/toolbar/MenuSeparator.js +5 -16
  60. package/dist/components/layout/toolbar/MostPageTool.js +8 -20
  61. package/dist/components/layout/toolbar/OtherTool.js +8 -20
  62. package/dist/components/layout/toolbar/Paginate.js +8 -20
  63. package/dist/components/layout/toolbar/PrintTool.js +8 -20
  64. package/dist/components/layout/toolbar/PropertyItem.js +4 -13
  65. package/dist/components/layout/toolbar/RPMenuItem.js +16 -30
  66. package/dist/components/layout/toolbar/RPMoreOptions.js +114 -111
  67. package/dist/components/layout/toolbar/RPToolbar.js +8 -20
  68. package/dist/components/layout/toolbar/RPToolbarEnd.js +8 -20
  69. package/dist/components/layout/toolbar/RotateTool.js +26 -69
  70. package/dist/components/layout/toolbar/ScrollModeTool.js +33 -83
  71. package/dist/components/layout/toolbar/SearchCloseButton.js +3 -3
  72. package/dist/components/layout/toolbar/SearchResultNavigator.js +8 -20
  73. package/dist/components/layout/toolbar/SearchTool.js +8 -20
  74. package/dist/components/layout/toolbar/SelectionModeTool.js +21 -63
  75. package/dist/components/layout/toolbar/ThumbnailTool.js +11 -48
  76. package/dist/components/layout/toolbar/ToolbarCustom.js +44 -81
  77. package/dist/components/layout/toolbar/ToolbarDefault.js +44 -80
  78. package/dist/components/layout/toolbar/ToolbarLayout.js +11 -31
  79. package/dist/components/layout/toolbar/ViewModeTool.js +26 -72
  80. package/dist/components/layout/toolbar/ZoomTool.js +8 -20
  81. package/dist/components/layout/toolbar/tools/DocumentPropertiesTool.js +18 -39
  82. package/dist/components/layout/toolbar/tools/DualPageTool.js +11 -44
  83. package/dist/components/layout/toolbar/tools/FileDownloadTool.js +11 -44
  84. package/dist/components/layout/toolbar/tools/FileUploadTool.js +6 -36
  85. package/dist/components/layout/toolbar/tools/FullScreenTool.js +9 -25
  86. package/dist/components/layout/toolbar/tools/InputPageTool.js +27 -41
  87. package/dist/components/layout/toolbar/tools/NextPageTool.js +20 -50
  88. package/dist/components/layout/toolbar/tools/PreviousPageTool.js +19 -40
  89. package/dist/components/layout/toolbar/tools/PrintTool.js +11 -44
  90. package/dist/components/layout/toolbar/tools/RotateClockwiseTool.js +6 -31
  91. package/dist/components/layout/toolbar/tools/RotateCounterclockwiseTool.js +11 -31
  92. package/dist/components/layout/toolbar/tools/SelectionModeSwitcherTool.js +8 -22
  93. package/dist/components/layout/toolbar/tools/SinglePageTool.js +11 -44
  94. package/dist/components/layout/toolbar/tools/ThemeSwitcherTool.js +5 -19
  95. package/dist/components/layout/toolbar/tools/ThumbnailTool.js +19 -40
  96. package/dist/components/layout/toolbar/tools/ZoomInTool.js +14 -31
  97. package/dist/components/layout/toolbar/tools/ZoomLevelDisplay.js +9 -21
  98. package/dist/components/layout/toolbar/tools/ZoomLevelTool.js +56 -82
  99. package/dist/components/layout/toolbar/tools/ZoomOutTool.js +14 -31
  100. package/dist/components/layout/toolbar/tools/defaults/RPHorizontalBar.js +20 -64
  101. package/dist/components/layout/toolbar/tools/defaults/RPVerticalBar.js +13 -40
  102. package/dist/components/layout/toolbar/tools/more-options/DocumentProperties.js +11 -36
  103. package/dist/components/layout/toolbar/tools/more-options/FileDownloadTool.js +14 -42
  104. package/dist/components/layout/toolbar/tools/more-options/FileUploadTool.js +14 -42
  105. package/dist/components/layout/toolbar/tools/more-options/FullScreenTool.js +11 -38
  106. package/dist/components/layout/toolbar/tools/more-options/MostPageTool.js +21 -73
  107. package/dist/components/layout/toolbar/tools/more-options/PrintTool.js +14 -42
  108. package/dist/components/layout/toolbar/tools/more-options/RotateTool.js +20 -57
  109. package/dist/components/layout/toolbar/tools/more-options/ScrollModeTool.js +29 -70
  110. package/dist/components/layout/toolbar/tools/more-options/SelectionModeTool.js +22 -58
  111. package/dist/components/layout/toolbar/tools/more-options/ViewModeTool.js +21 -61
  112. package/dist/components/page/AnnotationLayer.js +9 -21
  113. package/dist/components/page/CanvasLayer.js +9 -21
  114. package/dist/components/page/CustomElement.js +8 -38
  115. package/dist/components/page/DualPage.js +8 -20
  116. package/dist/components/page/RPPage.js +9 -21
  117. package/dist/components/page/SinglePage.js +8 -20
  118. package/dist/components/page/TextHighlightLayer.js +18 -30
  119. package/dist/components/page/TextLayer.js +15 -27
  120. package/dist/components/ui/Button.js +11 -13
  121. package/dist/components/ui/Checkbox.js +15 -23
  122. package/dist/components/ui/DropDown.js +18 -40
  123. package/dist/components/ui/Input.js +14 -18
  124. package/dist/components/ui/LoadingIndicator.js +8 -20
  125. package/dist/components/ui/PasswordModal.js +24 -33
  126. package/dist/components/ui/RPTooltip.js +11 -29
  127. package/dist/contexts/ConfigContext.js +2 -8
  128. package/dist/contexts/DarkModeContext.js +2 -11
  129. package/dist/contexts/DimensionPagesContext.js +28 -89
  130. package/dist/contexts/DocumentPasswordContext.js +1 -4
  131. package/dist/contexts/DownloadContext.js +9 -9
  132. package/dist/contexts/DropFileZoneContext.js +34 -45
  133. package/dist/contexts/ElementPageContext.js +80 -111
  134. package/dist/contexts/EventCallbackContext.js +11 -8
  135. package/dist/contexts/FileInputContext.js +22 -39
  136. package/dist/contexts/FullScreenContext.js +3 -18
  137. package/dist/contexts/GlobalCurrentPage.js +3 -15
  138. package/dist/contexts/HighlightContext.js +7 -32
  139. package/dist/contexts/IconContext.js +1 -4
  140. package/dist/contexts/IconToolContext.js +2 -12
  141. package/dist/contexts/InitialStateContext.js +1 -4
  142. package/dist/contexts/LayerContext.js +1 -11
  143. package/dist/contexts/LicenseContext.js +8 -17
  144. package/dist/contexts/LoaderContext.js +10 -10
  145. package/dist/contexts/LocalizationContext.js +9 -6
  146. package/dist/contexts/OtherToolContext.js +2 -7
  147. package/dist/contexts/PageViewportContext.js +1 -6
  148. package/dist/contexts/PagesRotateContext.js +13 -45
  149. package/dist/contexts/PaginationContext.js +10 -22
  150. package/dist/contexts/PrintContext.js +10 -22
  151. package/dist/contexts/RPDocumentContext.js +17 -34
  152. package/dist/contexts/RenderQueueProvider.js +10 -22
  153. package/dist/contexts/RenderedPagesCache.js +8 -23
  154. package/dist/contexts/RotationContext.js +16 -33
  155. package/dist/contexts/ScrollModeContext.js +3 -13
  156. package/dist/contexts/SearchContext.js +10 -22
  157. package/dist/contexts/SelectionModeContext.js +1 -7
  158. package/dist/contexts/SmoothScrollContext.js +3 -12
  159. package/dist/contexts/ThumbnailsContext.js +10 -22
  160. package/dist/contexts/ToolComponentContext.js +2 -10
  161. package/dist/contexts/ToolbarComponentContext.js +2 -8
  162. package/dist/contexts/ViewModeContext.js +3 -15
  163. package/dist/contexts/ViewportContext.js +2 -7
  164. package/dist/contexts/VirtualGridContext.js +2 -10
  165. package/dist/contexts/VirtualScrollContext.js +19 -18
  166. package/dist/contexts/ZoomContext.js +84 -196
  167. package/dist/{index-1d695410.js → index-808ea7bf.js} +1 -1
  168. package/dist/index-a48ec088.js +1672 -0
  169. package/dist/{index-7ca3764b.js → index-c9a2990a.js} +3 -3
  170. package/dist/main.js +91 -103
  171. package/dist/types/utils/approximateFragtion.d.ts +9 -0
  172. package/dist/types/utils/link_service.d.ts +8 -0
  173. package/dist/utils/Queue.js +18 -60
  174. package/dist/utils/annotations.js +75 -109
  175. package/dist/utils/approximateFragtion.js +22 -0
  176. package/dist/utils/calculatePage.js +11 -23
  177. package/dist/utils/convertPdfDate.js +3 -1
  178. package/dist/utils/elementPagePosition.js +1 -8
  179. package/dist/utils/getElementPositionInPage.js +44 -16
  180. package/dist/utils/getScrollDistance.js +2 -5
  181. package/dist/utils/getThumbnailViewport.js +2 -10
  182. package/dist/utils/getZoomLevel.js +4 -1
  183. package/dist/utils/highlight.js +153 -225
  184. package/dist/utils/hooks/useCopyText.js +19 -20
  185. package/dist/utils/hooks/useDarkModeProps.js +1 -4
  186. package/dist/utils/hooks/useElementSize.js +10 -25
  187. package/dist/utils/hooks/useFileDownload.js +9 -21
  188. package/dist/utils/hooks/useFullScreen.js +1 -6
  189. package/dist/utils/hooks/useGrabScroll.js +16 -17
  190. package/dist/utils/hooks/useHighlight.js +22 -25
  191. package/dist/utils/hooks/useInfiniteScroll.js +8 -8
  192. package/dist/utils/hooks/useLicense.js +55 -1174
  193. package/dist/utils/hooks/useLoadPdf.js +42 -81
  194. package/dist/utils/hooks/useLoadWorker.js +8 -8
  195. package/dist/utils/hooks/useMousePressed.js +2 -8
  196. package/dist/utils/hooks/usePageRotateContext.js +18 -33
  197. package/dist/utils/hooks/usePaginate.js +9 -21
  198. package/dist/utils/hooks/usePinch.js +39 -49
  199. package/dist/utils/hooks/usePresentPage.js +18 -30
  200. package/dist/utils/hooks/usePrint.js +9 -21
  201. package/dist/utils/hooks/useRequestAnimationFrame.js +9 -9
  202. package/dist/utils/hooks/useRotate.js +4 -17
  203. package/dist/utils/hooks/useScrollToPage.js +9 -21
  204. package/dist/utils/hooks/useSearch.js +9 -21
  205. package/dist/utils/hooks/useThumbnail.js +9 -21
  206. package/dist/utils/hooks/useVirtualReactWindow.js +9 -21
  207. package/dist/utils/hooks/useWatermark.js +42 -55
  208. package/dist/utils/link_service.js +36 -20
  209. package/dist/utils/renderPage.js +5 -12
  210. package/dist/utils/smoothScrollTo.js +1 -4
  211. package/dist/utils/withRef.js +1 -4
  212. package/package.json +5 -9
  213. package/dist/ToolbarLayout.module-d74981d1.js +0 -4270
  214. package/dist/classof-56f81803.js +0 -76
  215. package/dist/es.iterator.constructor-05468e3d.js +0 -126
  216. package/dist/es.iterator.filter-1ddb1471.js +0 -37
  217. package/dist/es.iterator.for-each-ed4cb4aa.js +0 -34
  218. package/dist/es.iterator.map-635f6e20.js +0 -157
  219. package/dist/es.iterator.reduce-969434f1.js +0 -31
  220. package/dist/esnext.json.parse-3bf99e2e.js +0 -152
  221. package/dist/esnext.map.delete-all-fa83df07.js +0 -401
  222. package/dist/function-uncurry-this-accessor-efc140e6.js +0 -17
  223. package/dist/index-922e8d58.js +0 -2545
  224. package/dist/is-pure-db2321f6.js +0 -886
  225. package/dist/iterate-1672c441.js +0 -110
  226. package/dist/iterator-helper-without-closing-on-early-error-a6637535.js +0 -69
  227. package/dist/web.url-search-params.delete-c65de04d.js +0 -51
@@ -1,22 +1,14 @@
1
- import "../is-pure-db2321f6.js";
2
- import "../es.iterator.constructor-05468e3d.js";
3
- import "../es.iterator.for-each-ed4cb4aa.js";
4
- import "../esnext.json.parse-3bf99e2e.js";
5
- import "../esnext.map.delete-all-fa83df07.js";
6
1
  import { sanitizeExternalUrl as _ } from "./sanitizeExternalUrl.js";
7
2
  import { AnnotationType as l } from "./types.js";
8
3
  import { dateFormatter as L } from "./dateFormatter.js";
9
- import "../iterate-1672c441.js";
10
- import "../classof-56f81803.js";
11
- import "../iterator-helper-without-closing-on-early-error-a6637535.js";
12
4
  import "../th_TH-d627cd51.js";
13
- const T = ["click", "dblclick", "input", "change"], g = /* @__PURE__ */ new Map(), v = (e, t) => `${e.loadingTask.docId}___${t.num}R${t.gen === 0 ? "" : t.gen}`;
5
+ const T = ["click", "dblclick", "input", "change"], m = /* @__PURE__ */ new Map(), v = (e, t) => `${e.loadingTask.docId}___${t.num}R${t.gen === 0 ? "" : t.gen}`;
14
6
  function I(e, t) {
15
7
  const n = v(e, t);
16
- return g.has(n) ? g.get(n) ?? null : null;
8
+ return m.has(n) ? m.get(n) ?? null : null;
17
9
  }
18
10
  const x = (e, t, n) => {
19
- g.set(v(e, t), n);
11
+ m.set(v(e, t), n);
20
12
  }, A = (e, t) => {
21
13
  switch (t[1].name) {
22
14
  case "XYZ":
@@ -54,29 +46,29 @@ const x = (e, t, n) => {
54
46
  async function E(e, t) {
55
47
  let n;
56
48
  if (typeof t == "string" ? n = await e.getDestination(t) : n = t, n && typeof n[0] == "object" && n[0] !== null) {
57
- const a = n[0], o = I(e, a);
58
- if (o === null) {
49
+ const a = n[0], s = I(e, a);
50
+ if (s === null) {
59
51
  const r = await e.getPageIndex(a);
60
52
  return x(e, a, r), await E(e, n);
61
53
  } else
62
- return A(o, n);
54
+ return A(s, n);
63
55
  } else
64
56
  return A(n[0], n);
65
57
  }
66
- const K = (e) => {
58
+ const M = (e) => {
67
59
  const n = e.target.parentNode;
68
60
  if (!n)
69
61
  return;
70
- const a = new MutationObserver((o) => {
71
- o.forEach(() => {
72
- n.querySelectorAll('[data-l10n-id="pdfjs-annotation-date-time-string"]').forEach((s) => {
73
- const c = s.getAttribute("data-l10n-args");
62
+ const a = new MutationObserver((s) => {
63
+ s.forEach(() => {
64
+ n.querySelectorAll(
65
+ '[data-l10n-id="pdfjs-annotation-date-time-string"]'
66
+ ).forEach((o) => {
67
+ const c = o.getAttribute("data-l10n-args");
74
68
  if (c) {
75
69
  try {
76
- const {
77
- dateObj: i
78
- } = JSON.parse(c);
79
- i && (s.textContent = L(i));
70
+ const { dateObj: i } = JSON.parse(c);
71
+ i && (o.textContent = L(i));
80
72
  } catch {
81
73
  }
82
74
  a.disconnect();
@@ -93,39 +85,29 @@ const K = (e) => {
93
85
  // Watch for changes to attributes
94
86
  }), () => a.disconnect();
95
87
  };
96
- function j(e, t) {
88
+ function H(e, t) {
97
89
  for (const n of T)
98
90
  e.addEventListener(n, t);
99
91
  }
100
- function q(e, t) {
92
+ function P(e, t) {
101
93
  for (const n of T)
102
94
  e.removeEventListener(n, t);
103
95
  }
104
- function J(e) {
105
- const {
106
- id: t,
107
- url: n,
108
- unsafeUrl: a
109
- } = e;
110
- new MutationObserver((r, s) => {
96
+ function U(e) {
97
+ const { id: t, url: n, unsafeUrl: a } = e;
98
+ new MutationObserver((r, o) => {
111
99
  const c = document.querySelector(`[data-annotation-id="${t}"]`);
112
100
  if (c) {
113
101
  const i = c.querySelector("a"), p = _((n || a) ?? "", "");
114
- i && (i == null || i.setAttribute("target", "_blank"), i == null || i.setAttribute("href", p), i == null || i.setAttribute("rel", "noopener noreferrer")), s.disconnect();
102
+ i && (i == null || i.setAttribute("target", "_blank"), i == null || i.setAttribute("href", p), i == null || i.setAttribute("rel", "noopener noreferrer")), o.disconnect();
115
103
  }
116
- }).observe(document.body, {
117
- childList: !0,
118
- subtree: !0
119
- });
104
+ }).observe(document.body, { childList: !0, subtree: !0 });
120
105
  }
121
- function X(e, t, n) {
122
- const {
123
- rotation: a,
124
- scale: o
125
- } = t, r = a % 180 === 0;
106
+ function V(e, t, n) {
107
+ const { rotation: a, scale: s } = t, r = a % 180 === 0;
126
108
  if (e.fieldType === "Btn" && e.pushButton) {
127
- const s = e.rect[2] - e.rect[0], c = e.rect[3] - e.rect[1], i = document.createElement("canvas");
128
- i.setAttribute("width", ((r ? s : c) * o).toString()), i.setAttribute("height", ((r ? c : s) * o).toString()), n.set(e.id, i);
109
+ const o = e.rect[2] - e.rect[0], c = e.rect[3] - e.rect[1], i = document.createElement("canvas");
110
+ i.setAttribute("width", ((r ? o : c) * s).toString()), i.setAttribute("height", ((r ? c : o) * s).toString()), n.set(e.id, i);
129
111
  }
130
112
  }
131
113
  function B(e) {
@@ -136,41 +118,32 @@ function B(e) {
136
118
  const n = t.getAttribute("aria-haspopup") === "dialog", a = t.classList.contains("popupAnnotation");
137
119
  if (!n && !a)
138
120
  return;
139
- let o = t.id || t.getAttribute("aria-controls");
140
- if (o || (o = (r = t.firstChild) == null ? void 0 : r.id), o && t.parentElement) {
141
- const s = t.parentElement.querySelector(`[aria-controls="${o}"]`);
142
- s && new MutationObserver((i, p) => {
121
+ let s = t.id || t.getAttribute("aria-controls");
122
+ if (s || (s = (r = t.firstChild) == null ? void 0 : r.id), s && t.parentElement) {
123
+ const o = t.parentElement.querySelector(`[aria-controls="${s}"]`);
124
+ o && new MutationObserver((i, p) => {
143
125
  const b = document.querySelectorAll(".popupDate");
144
- b.length > 0 && (b.forEach((m) => {
145
- if (m.innerHTML)
126
+ b.length > 0 && (b.forEach((g) => {
127
+ if (g.innerHTML)
146
128
  return !1;
147
- const N = m.getAttribute("data-l10n-args");
129
+ const N = g.getAttribute("data-l10n-args");
148
130
  if (N) {
149
- const {
150
- date: h,
151
- time: y
152
- } = JSON.parse(N);
153
- h && y && (m.textContent = `${h}, ${y}`);
131
+ const { date: h, time: y } = JSON.parse(N);
132
+ h && y && (g.textContent = `${h}, ${y}`);
154
133
  }
155
134
  }), p.disconnect());
156
- }).observe(s, {
157
- childList: !0,
158
- subtree: !0
159
- });
135
+ }).observe(o, { childList: !0, subtree: !0 });
160
136
  }
161
137
  }
162
138
  function d(e, t, n) {
163
139
  const a = [];
164
140
  if (n)
165
- for (const o of n)
166
- o[e] === t && a.push(o);
141
+ for (const s of n)
142
+ s[e] === t && a.push(s);
167
143
  return a;
168
144
  }
169
145
  function u(e, t) {
170
- return {
171
- type: e,
172
- data: t
173
- };
146
+ return { type: e, data: t };
174
147
  }
175
148
  async function w(e, t) {
176
149
  if (e.dest)
@@ -201,8 +174,8 @@ function O(e) {
201
174
  let n = t.textContent;
202
175
  const a = JSON.parse(t.dataset.l10nArgs ?? "{}");
203
176
  if (n)
204
- for (const o in a)
205
- n = n.replace(`{{${o}}}`, a[o]);
177
+ for (const s in a)
178
+ n = n.replace(`{{${s}}}`, a[s]);
206
179
  t.textContent = n;
207
180
  }
208
181
  }
@@ -220,16 +193,16 @@ function f(e, t) {
220
193
  case "select-one":
221
194
  case "select-multiple":
222
195
  const n = [];
223
- for (const o of e.options)
196
+ for (const s of e.options)
224
197
  n.push({
225
- value: o.value,
226
- label: o.label
198
+ value: s.value,
199
+ label: s.label
227
200
  });
228
201
  const a = [];
229
- for (const o of e.selectedOptions)
202
+ for (const s of e.selectedOptions)
230
203
  a.push({
231
- value: o.value,
232
- label: o.label
204
+ value: s.value,
205
+ label: s.label
233
206
  });
234
207
  return u(l.FORM_SELECT, {
235
208
  fieldName: e.name,
@@ -253,16 +226,16 @@ function f(e, t) {
253
226
  });
254
227
  }
255
228
  }
256
- async function z(e, t, n) {
257
- var o;
229
+ async function $(e, t, n) {
230
+ var s;
258
231
  let a = e.target.parentNode;
259
232
  if (a.tagName === "DIV" && (a = a.firstChild), B(a), typeof a.className != "object")
260
233
  if (a.className === "linkAnnotation" && e.type === "click") {
261
- const r = (o = a.dataset) == null ? void 0 : o.annotationId;
234
+ const r = (s = a.dataset) == null ? void 0 : s.annotationId;
262
235
  if (r) {
263
- const s = d("id", r, n);
264
- if (s.length)
265
- return await w(s[0], t);
236
+ const o = d("id", r, n);
237
+ if (o.length)
238
+ return await w(o[0], t);
266
239
  }
267
240
  } else if (
268
241
  /* annotation.className.includes('popupAnnotation') || */
@@ -285,46 +258,39 @@ async function z(e, t, n) {
285
258
  if (a.className.includes("buttonWidgetAnnotation radioButton") && e.type === "change") {
286
259
  const r = a.dataset.annotationId;
287
260
  if (r) {
288
- const s = d("id", r, n)[0], c = [];
289
- for (const i of d("fieldName", s.fieldName, n))
261
+ const o = d("id", r, n)[0], c = [];
262
+ for (const i of d(
263
+ "fieldName",
264
+ o.fieldName,
265
+ n
266
+ ))
290
267
  i.buttonValue && c.push(i.buttonValue);
291
268
  return f(a.getElementsByTagName("input")[0], {
292
- value: s.buttonValue,
293
- defaultValue: s.fieldValue,
269
+ value: o.buttonValue,
270
+ defaultValue: o.fieldValue,
294
271
  options: c
295
272
  });
296
273
  }
297
274
  } else if (a.className.includes("buttonWidgetAnnotation pushButton") && e.type === "click") {
298
275
  const r = a.dataset.annotationId;
299
276
  if (r) {
300
- const s = d("id", r, n)[0], {
301
- action: c
302
- } = s;
303
- return c && ["Print", "SaveAs"].includes(c) ? {
304
- type: l.BUTTON,
305
- data: s
306
- } : s.resetForm ? f({
307
- name: s.fieldName,
308
- type: "button"
309
- }, {
310
- actions: s.actions,
311
- reset: !0
312
- }) : f({
313
- name: s.fieldName,
314
- type: "button"
315
- }, {
316
- actions: s.actions,
317
- reset: !1
318
- });
277
+ const o = d("id", r, n)[0], { action: c } = o;
278
+ return c && ["Print", "SaveAs"].includes(c) ? { type: l.BUTTON, data: o } : o.resetForm ? f(
279
+ { name: o.fieldName, type: "button" },
280
+ { actions: o.actions, reset: !0 }
281
+ ) : f(
282
+ { name: o.fieldName, type: "button" },
283
+ { actions: o.actions, reset: !1 }
284
+ );
319
285
  }
320
286
  }
321
287
  }
322
288
  }
323
289
  export {
324
- z as annotationEventsHandler,
325
- K as annotationsEvents,
326
- j as bindLayerEvents,
327
- J as handleAnnotationLink,
328
- X as handleAnnotationWidget,
329
- q as unbindLayerEvents
290
+ $ as annotationEventsHandler,
291
+ M as annotationsEvents,
292
+ H as bindLayerEvents,
293
+ U as handleAnnotationLink,
294
+ V as handleAnnotationWidget,
295
+ P as unbindLayerEvents
330
296
  };
@@ -0,0 +1,22 @@
1
+ function u(t) {
2
+ if (Math.floor(t) === t)
3
+ return [t, 1];
4
+ const e = 1 / t, s = 8;
5
+ if (e > s)
6
+ return [1, s];
7
+ if (Math.floor(e) === e)
8
+ return [1, e];
9
+ const r = t > 1 ? e : t;
10
+ let i = 0, n = 1, o = 1, l = 1;
11
+ for (; ; ) {
12
+ const c = i + o, f = n + l;
13
+ if (f > s)
14
+ break;
15
+ r <= c / f ? (o = c, l = f) : (i = c, n = f);
16
+ }
17
+ let a;
18
+ return r - i / n < o / l - r ? a = r === t ? [i, n] : [n, i] : a = r === t ? [o, l] : [l, o], a;
19
+ }
20
+ export {
21
+ u as approximateFraction
22
+ };
@@ -1,27 +1,15 @@
1
- import "../es.iterator.constructor-05468e3d.js";
2
- import "../es.iterator.for-each-ed4cb4aa.js";
3
- import "../is-pure-db2321f6.js";
4
- import "../iterate-1672c441.js";
5
- import "../classof-56f81803.js";
6
- import "../iterator-helper-without-closing-on-early-error-a6637535.js";
7
- const w = (r, t, o) => r * o + t + 1, m = (r, t) => {
8
- const o = r - 1, n = Math.floor(o / t), s = (o - n * t) % t;
9
- return {
10
- rowIndex: n,
11
- columnIndex: s
12
- };
13
- }, I = (r, t) => {
1
+ const d = (e, t, o) => e * o + t + 1, a = (e, t) => {
2
+ const o = e - 1, n = Math.floor(o / t), s = (o - n * t) % t;
3
+ return { rowIndex: n, columnIndex: s };
4
+ }, h = (e, t) => {
14
5
  const o = [], n = [];
15
- return r.heights.forEach((s, i) => {
16
- const e = m(i + 1, t), c = r.widths[i];
17
- o[e.rowIndex] = Math.max(o[e.rowIndex] || 0, s), n[e.columnIndex] = Math.max(n[e.columnIndex] || 0, c);
18
- }), {
19
- rowsHeight: o,
20
- columnsWidth: n
21
- };
6
+ return e.heights.forEach((s, c) => {
7
+ const r = a(c + 1, t), i = e.widths[c];
8
+ o[r.rowIndex] = Math.max(o[r.rowIndex] || 0, s), n[r.columnIndex] = Math.max(n[r.columnIndex] || 0, i);
9
+ }), { rowsHeight: o, columnsWidth: n };
22
10
  };
23
11
  export {
24
- I as getGridDimension,
25
- w as getPageFromPosition,
26
- m as getPositionFromPage
12
+ h as getGridDimension,
13
+ d as getPageFromPosition,
14
+ a as getPositionFromPage
27
15
  };
@@ -1,4 +1,6 @@
1
- const p = new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"), t = (s, e, o, c) => {
1
+ const p = new RegExp(
2
+ "^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"
3
+ ), t = (s, e, o, c) => {
2
4
  const n = parseInt(s, 10);
3
5
  return n >= e && n <= o ? n : c;
4
6
  }, f = (s) => {
@@ -1,11 +1,4 @@
1
- const o = ({
2
- width: a,
3
- height: c,
4
- top: t,
5
- left: r,
6
- bottom: e,
7
- right: l
8
- }) => ({
1
+ const o = ({ width: a, height: c, top: t, left: r, bottom: e, right: l }) => ({
9
2
  left: `calc(${r} * var(--scale-factor))`,
10
3
  top: `calc(${t} * var(--scale-factor))`,
11
4
  width: `calc(${a} * var(--scale-factor))`,
@@ -1,19 +1,47 @@
1
- import "../es.iterator.constructor-05468e3d.js";
2
- import "../es.iterator.for-each-ed4cb4aa.js";
3
- import "../is-pure-db2321f6.js";
4
- import "../iterate-1672c441.js";
5
- import "../classof-56f81803.js";
6
- import "../iterator-helper-without-closing-on-early-error-a6637535.js";
7
1
  function g(e, o) {
8
2
  !e || typeof e != "object" || Object.entries(e).forEach(([d, i]) => {
9
3
  if (i == null)
10
4
  return;
11
- const s = d.replace(/([A-Z])/g, "-$1").toLowerCase(), n = ["width", "height", "top", "right", "bottom", "left", "margin", "margin-top", "margin-right", "margin-bottom", "margin-left", "padding", "padding-top", "padding-right", "padding-bottom", "padding-left", "border-width", "border-top-width", "border-right-width", "border-bottom-width", "border-left-width", "font-size", "line-height", "letter-spacing", "word-spacing", "min-width", "min-height", "max-width", "max-height", "flex-basis", "grid-gap", "grid-row-gap", "grid-column-gap"];
5
+ const s = d.replace(/([A-Z])/g, "-$1").toLowerCase(), n = [
6
+ "width",
7
+ "height",
8
+ "top",
9
+ "right",
10
+ "bottom",
11
+ "left",
12
+ "margin",
13
+ "margin-top",
14
+ "margin-right",
15
+ "margin-bottom",
16
+ "margin-left",
17
+ "padding",
18
+ "padding-top",
19
+ "padding-right",
20
+ "padding-bottom",
21
+ "padding-left",
22
+ "border-width",
23
+ "border-top-width",
24
+ "border-right-width",
25
+ "border-bottom-width",
26
+ "border-left-width",
27
+ "font-size",
28
+ "line-height",
29
+ "letter-spacing",
30
+ "word-spacing",
31
+ "min-width",
32
+ "min-height",
33
+ "max-width",
34
+ "max-height",
35
+ "flex-basis",
36
+ "grid-gap",
37
+ "grid-row-gap",
38
+ "grid-column-gap"
39
+ ];
12
40
  let t;
13
41
  typeof i == "number" && i !== 0 ? t = n.includes(s) ? `${i}px` : String(i) : t = String(i), o.style.setProperty(s, t);
14
42
  });
15
43
  }
16
- const E = (e, o, d, i, s) => {
44
+ const f = (e, o, d, i, s) => {
17
45
  let n = "center";
18
46
  switch (i) {
19
47
  case 90:
@@ -34,23 +62,23 @@ const E = (e, o, d, i, s) => {
34
62
  if (d instanceof HTMLElement)
35
63
  r = d.cloneNode(!0), l.appendChild(r);
36
64
  else {
37
- const h = d.props;
38
- r = document.createElement("div"), h.style && g(h.style, r), h.className && (r.className = h.className), l.appendChild(r);
65
+ const p = d.props;
66
+ r = document.createElement("div"), p.style && g(p.style, r), p.className && (r.className = p.className), l.appendChild(r);
39
67
  }
40
68
  o.appendChild(t);
41
- const c = t.getBoundingClientRect(), p = r.getBoundingClientRect();
69
+ const c = t.getBoundingClientRect(), h = r.getBoundingClientRect();
42
70
  o.removeChild(t);
43
71
  const a = {
44
72
  top: o.clientHeight / 2,
45
73
  left: o.clientWidth / 2
46
74
  };
47
75
  return {
48
- left: p.left - c.left - a.left,
49
- top: p.top - c.top - a.top,
50
- width: p.width,
51
- height: p.height
76
+ left: h.left - c.left - a.left,
77
+ top: h.top - c.top - a.top,
78
+ width: h.width,
79
+ height: h.height
52
80
  };
53
81
  };
54
82
  export {
55
- E as getElementPagePosition
83
+ f as getElementPagePosition
56
84
  };
@@ -1,7 +1,4 @@
1
- import "../es.iterator.constructor-05468e3d.js";
2
- import "../es.iterator.reduce-969434f1.js";
3
- import "../is-pure-db2321f6.js";
4
- const p = (r, t) => r.slice(0, t).reduce((e, o) => e + o, 0);
1
+ const n = (e, r) => e.slice(0, r).reduce((t, c) => t + c, 0);
5
2
  export {
6
- p as getScrollDistance
3
+ n as getScrollDistance
7
4
  };
@@ -1,14 +1,6 @@
1
1
  const n = (t, o = 0) => {
2
- const e = 100 / t.getViewport({
3
- scale: 1
4
- }).width, i = t.getViewport({
5
- scale: e,
6
- rotation: o
7
- });
8
- return {
9
- scale: e,
10
- thumbnailViewport: i
11
- };
2
+ const e = 100 / t.getViewport({ scale: 1 }).width, i = t.getViewport({ scale: e, rotation: o });
3
+ return { scale: e, thumbnailViewport: i };
12
4
  };
13
5
  export {
14
6
  n as getThumbnailViewport
@@ -7,7 +7,10 @@ const D = (o, t, a, e, A, c) => {
7
7
  const m = c === i.DUAL_PAGE ? 2 * e : e;
8
8
  switch (o) {
9
9
  case r.PAGE_FIT:
10
- const s = Math.min((t - n) / m, (a - f) / A);
10
+ const s = Math.min(
11
+ (t - n) / m,
12
+ (a - f) / A
13
+ );
11
14
  return Math.floor(s * 100);
12
15
  case r.PAGE_WIDTH:
13
16
  return Math.floor((t - n) / m * 100);