@pdf-viewer/react
Version:
A react-pdf-viewer component for React and Next.js. Suitable for react-pdf document.
1,484 lines • 138 kB
JavaScript
import { jsx as i, Fragment as ge, jsxs as k } from "react/jsx-runtime";
import * as X from "react";
import { useRef as M, useEffect as z, useCallback as O, useState as H, useMemo as W, createContext as je, useContext as Ze, useImperativeHandle as mn, createElement as Ye, PureComponent as ho, Component as fo, memo as It, Fragment as mo, forwardRef as go } from "react";
import { ChevronUpIcon as Be } from "./components/icons/ChevronUpIcon.js";
import { UIButton as pe } from "./components/ui/Button.js";
import { UIInput as gn } from "./components/ui/Input.js";
import { ViewMode as ee, ScrollMode as ae, AnnotationSubType as $t, SelectionMode as vo, ErrorType as wo, ZoomLevel as He } from "./utils/types.js";
import { useScrollModeContext as Ae } from "./contexts/ScrollModeContext.js";
import { useDocumentContext as re } from "./contexts/RPDocumentContext.js";
import { useDocumentPasswordContext as _o } from "./contexts/DocumentPasswordContext.js";
import { useDarkModeContext as bo } from "./contexts/DarkModeContext.js";
import "./contexts/RotationContext.js";
import { useLayerContext as Po } from "./contexts/LayerContext.js";
import { useZoomContext as rt } from "./contexts/ZoomContext.js";
import { useViewModeContext as Ge } from "./contexts/ViewModeContext.js";
import { useVirtualScrollContext as it } from "./contexts/VirtualScrollContext.js";
import { useVirtualGridContext as vn } from "./contexts/VirtualGridContext.js";
import { useSelectionModeContext as To } from "./contexts/SelectionModeContext.js";
import { useInitialStateContext as xt } from "./contexts/InitialStateContext.js";
import { useFullScreenContext as Co } from "./contexts/FullScreenContext.js";
import "./contexts/FileInputContext.js";
import "./contexts/DropFileZoneContext.js";
import { findMatches as yo, resetDivs as Io, highlightMatches as xo, isMatchEntireWord as So } from "./utils/highlight.js";
import { useLayoutContainer as Ce } from "./contexts/LayoutContainerContext.js";
import { useDimensionPagesContext as Ke } from "./contexts/DimensionPagesContext.js";
import { useLocalizationContext as fe } from "./contexts/LocalizationContext.js";
import { useHighlightContext as Ro } from "./contexts/HighlightContext.js";
import "./contexts/LicenseContext.js";
import { useDownloadContext as Lo } from "./contexts/DownloadContext.js";
import { useSmoothScrollContext as wn } from "./contexts/SmoothScrollContext.js";
import "./contexts/ElementPageContext.js";
import { usePagesRotateContext as at } from "./contexts/PagesRotateContext.js";
import { Queue as Eo } from "./utils/Queue.js";
import { renderPage as No } from "./utils/renderPage.js";
import { useGlobalCurrentPage as Oo } from "./contexts/GlobalCurrentPage.js";
import { useLoaderContext as St } from "./contexts/LoaderContext.js";
import { useToolComponentContext as Se } from "./contexts/ToolComponentContext.js";
import { useIconToolContext as we } from "./contexts/IconToolContext.js";
import { useOtherToolContext as Do } from "./contexts/OtherToolContext.js";
import { useEventCallbackContext as Ao } from "./contexts/EventCallbackContext.js";
import { useThemeContext as zo } from "./contexts/ThemeContext.js";
import "./contexts/ConfigContext.js";
import * as Wo from "pdfjs-dist";
import { PixelsPerInch as Fo, AnnotationMode as ko, RenderingCancelledException as Mo, AnnotationLayer as Ho } from "pdfjs-dist";
import { ThumbnailIcon as $o } from "./components/icons/Thumbnail.js";
import { c as Qe, R as Go } from "./RPSplitter-f6acf13b.js";
import { c as le } from "./clsx-0c6e471a.js";
import { LoaderIcon as _n } from "./components/icons/LoaderIcon.js";
import { Container as Uo } from "./components/layout/Container.js";
import { useViewportContext as Re, ViewportProvider as Vo } from "./contexts/ViewportContext.js";
import { useToolbarComponentContext as ye, ToolbarComponentProvider as qo } from "./contexts/ToolbarComponentContext.js";
import { WrapperLayout as Bo } from "./components/layout/WrapperLayout.js";
import { RPDropFileZone as jo } from "./components/RPDropFileZone.js";
import { c as Ie, L as Zo } from "./LayoutWrapper-60db8675.js";
import { SkipLink as Gt } from "./components/layout/SkipLink.js";
import K from "./components/ui/RPTooltip.js";
import { c as oe, S as Ut } from "./SearchCloseButton-08d57275.js";
import { UICheckbox as Vt } from "./components/ui/Checkbox.js";
import { useIconContext as _e, IconProvider as Ko } from "./contexts/IconContext.js";
import { UIDropDown as Rt } from "./components/ui/DropDown.js";
import { MenuItem as xe } from "./components/layout/toolbar/MenuItem.js";
import { MenuSeparator as Lt } from "./components/layout/toolbar/MenuSeparator.js";
import { dateFormatter as qt } from "./utils/dateFormatter.js";
import { PropertyItem as Xo } from "./components/layout/toolbar/PropertyItem.js";
import "./RotateTool.module-67946714.js";
import { withRef as st } from "./utils/withRef.js";
import { useInfiniteScroll as Qo } from "./utils/hooks/useInfiniteScroll.js";
import { MAX_ZOOM_SCALE as Bt, THUMBNAIL_MIN_WIDTH as Yo } from "./utils/constants.js";
import { SimpleLinkService as Jo } from "./utils/link_service.js";
import { annotationsEvents as er, annotationEventsHandler as tr, handleAnnotationWidget as nr, handleAnnotationLink as or, bindLayerEvents as rr, fixTabIndexAccessibility as jt, enhanceLinkAccessibility as Zt, unbindLayerEvents as Kt } from "./utils/annotations.js";
import { normalizeSingleKeyword as ir, sortHighlightPosition as ar, unwrap as sr } from "./components/page/searchHighlight.js";
import { CustomElement as cr } from "./components/page/CustomElement.js";
import { getGridDimension as Et, getPositionFromPage as lr, getPageFromPosition as dr } from "./utils/calculatePage.js";
import { useMousePressed as ur } from "./utils/hooks/useMousePressed.js";
import { useGrabScroll as pr } from "./utils/hooks/useGrabScroll.js";
import { usePinch as hr } from "./utils/hooks/usePinch.js";
import { useDebounce as Nt } from "./utils/hooks/useDebounce.js";
import fr from "./components/ui/PasswordModal.js";
import { useCopyText as mr } from "./utils/hooks/useCopyText.js";
import { useTextSelection as gr } from "./utils/hooks/useTextSelection.js";
import { getScrollDistance as Me } from "./utils/getScrollDistance.js";
import { getWordPositionInPage as vr } from "./utils/getWordPositionInPage.js";
import { getThumbnailViewport as wr } from "./utils/getThumbnailViewport.js";
import { smoothScrollTo as ht } from "./utils/smoothScrollTo.js";
import { appConsole as _r } from "./utils/appConsole.js";
import { FileUploadTool as bn } from "./components/layout/toolbar/FileUploadTool.js";
import { DarkModeTool as br } from "./components/layout/toolbar/DarkModeTool.js";
import { ThreeDotIcon as Pr } from "./components/icons/ThreeDotIcon.js";
import { c as Tr, u as Ot, P as Xe, a as qe, b as Dt, k as Cr, e as yr, i as Ir } from "./index-c9a2990a.js";
import { D as xr, d as ft } from "./floating-ui.react-dom-d22a10b4.js";
import { a as Sr, h as Rr, u as Lr, F as Er, b as Nr, G as nt } from "./index-3bf64864.js";
import { CloseIcon as Or } from "./components/icons/CloseIcon.js";
import { DocumentProperties as Dr } from "./components/layout/toolbar/DocumentProperties.js";
import { RotateTool as Ar } from "./components/layout/toolbar/RotateTool.js";
import { ViewModeTool as zr } from "./components/layout/toolbar/ViewModeTool.js";
import { ScrollModeTool as Wr } from "./components/layout/toolbar/ScrollModeTool.js";
import { FileDownloadDefaultIcon as Fr } from "./components/icons/FileDownloadDefaultIcon.js";
import { PrintDefaultTool as kr } from "./components/icons/PrintDefaultIcon.js";
import { FullScreenTool as Pn } from "./components/layout/toolbar/FullScreenTool.js";
import { GoToDownIcon as Tn } from "./components/icons/GoToDownIcon.js";
import { SelectionModeTool as Mr } from "./components/layout/toolbar/SelectionModeTool.js";
import { ZoomInIcon as Hr } from "./components/icons/ZoomInIcon.js";
import { ZoomOutIcon as $r } from "./components/icons/ZoomOutIcon.js";
import { isZoomOutDisabled as Gr, isZoomInDisabled as Ur } from "./utils/zoom.js";
import { SearchIcon as Cn } from "./components/icons/SearchIcon.js";
import { ClearIcon as Vr } from "./components/icons/ClearIcon.js";
import { InfoIcon as Xt } from "./components/icons/InfoIcon.js";
const yn = () => {
const { viewMode: t } = Ge(), { scrollMode: e } = Ae(), { virtualScrollRef: n, virtualScrollableElementRef: r, pageScrollElementRef: o } = it(), { setFocusedPage: a } = de(), c = M(), { columnCount: d } = vn(), { widths: s, heights: f } = Ke(), m = M(e), T = M(t), u = M(d), { targetScrollPage: C } = wn();
z(() => {
n != null && n.scrollToItem && (c.current = n);
}, [n]), z(() => {
m.current = e, T.current = t;
}, [e, t]);
const w = O(
(y, b) => {
if (!o)
return;
const g = Math.ceil(y / 2) * 2 - 1;
if (y === g + 1) {
const p = {
left: s[g],
top: 0
};
return new Promise(
(l) => ht(o, p, l)
);
}
const h = {
left: 0,
top: 0
};
return o == null ? void 0 : o.scrollTo({
...h,
behavior: b
});
},
[o, s, ht]
);
return z(() => {
m.current = e, T.current = t;
}, [e, t]), z(() => {
u.current = d;
}, [d]), { scrollToPage: O(
(y, b = "smooth") => {
a(y);
const g = y - 1;
let h = g, p = 0;
if (T.current === ee.DUAL_PAGE && m.current === ae.PAGE_SCROLLING) {
w(y, b);
return;
}
if (m.current === ae.PAGE_SCROLLING) {
a(y);
return;
}
if (!c.current || !r)
return;
const l = r;
b === "smooth" && (C.current = y);
const { columnsWidth: v, rowsHeight: _ } = Et(
{ widths: s, heights: f },
d
);
if (m.current === ae.HORIZONTAL_SCROLLING) {
p = g;
const S = Me(v, p), R = {
left: Math.floor(S),
top: 0
};
return l.scrollTo({
...R,
behavior: b
});
}
if (T.current === ee.DUAL_PAGE) {
p = g % 2, h = Math.floor(g / 2);
const R = Me(v, p), N = Me(_, h), A = {
left: Math.floor(R),
top: Math.floor(N)
};
return l.scrollTo({
...A,
behavior: b
});
}
const I = Me(_, h), x = {
left: 0,
top: Math.floor(I)
};
return l.scrollTo({
...x,
behavior: b
});
},
[
r,
d,
w,
a,
ht,
f,
s
]
) };
}, qr = (t = 1) => {
const [e, n] = H(t), [r, o] = H(0), { scrollToPage: a } = yn(), c = M(1), { viewMode: d } = Ge(), { scrollMode: s } = Ae(), { widths: f } = Ke(), { pagesRef: m } = Ce(), T = Nt(e, 100), u = O(
(h) => {
if (!/^[0-9]*$/g.test(h.toString()) || !h)
return { success: !1, currentPage: c.current };
const l = +h;
return l < 0 || l > r ? { success: !1, currentPage: c.current } : (n(l), c.current = l, { success: !0, currentPage: +h });
},
[r]
), C = O(u, [u]), w = O(
(h) => {
const p = u(h);
return p.success && a(p.currentPage), p;
},
[u, a]
), P = O((h) => {
const p = h % 2 === 1;
if (!m || p)
return !1;
const l = p ? f[h] : f[h - 1], v = p ? f[h + 1] : f[h];
return d === ee.DUAL_PAGE && l + v < m.clientWidth;
}, [d, f, m, r]), y = O(() => {
let h = e - 1;
P(h) && (h = e - 2), w(h);
}, [w, e, d, s, P]), b = W(() => d === ee.DUAL_PAGE && s === ae.PAGE_SCROLLING ? e === r - 1 : e === r, [e, r, d, s]), g = O(() => {
if (b)
return;
let h = e + 1;
P(h) && (h = e + 2), w(h);
}, [w, e, P, d, s, b]);
return {
focusedPage: T,
totalPages: r,
setFocusedPage: C,
setTotalPages: o,
nextPage: g,
prevPage: y,
goToPage: w
};
}, In = je({
focusedPage: 0,
setFocusedPage: (t) => {
},
goToPage: (t) => ({ success: !!t, currentPage: +t }),
totalPages: 0,
setTotalPages: (t) => {
},
prevPage: () => {
},
nextPage: () => {
}
}), de = () => {
const t = Ze(In);
return typeof (t == null ? void 0 : t.focusedPage) > "u" && _r.error("Please use this hooks inside children component of RPProvider"), t;
}, Tc = ({ children: t }) => {
const { pdf: e } = re(), { setCurrentPage: n } = Oo(), { focusedPage: r, totalPages: o, setFocusedPage: a, setTotalPages: c, goToPage: d, nextPage: s, prevPage: f } = qr();
return z(() => {
e != null && e.numPages && (c(e.numPages), a(1));
}, [e, c, a]), z(() => {
n(r);
}, [r, n]), /* @__PURE__ */ i(
In.Provider,
{
value: {
focusedPage: r,
totalPages: o,
setFocusedPage: a,
setTotalPages: c,
nextPage: s,
prevPage: f,
goToPage: d
},
children: t
}
);
}, Br = () => {
const { pdf: t, pages: e } = re(), [n, r] = H({
loadedPages: 0,
totalPages: 0,
percentage: 0
}), [o, a] = H(!1), [c, d] = H(!1), [s, f] = H(null), [m, T] = H(void 0), u = M(!1);
z(() => {
u.current;
}, [u]);
const C = O(() => {
document.documentElement.classList.remove("rp-print-html-printing"), document.body.classList.remove("rp-print-body-printing");
const l = document.querySelector(".rp-print-zone");
l && l.remove();
}, []), w = O(() => {
u.current = !1, a(!1), d(!1), f(null), T(void 0), r({
loadedPages: 0,
totalPages: 0,
percentage: 0
});
}, []), P = () => {
u.current = !0;
}, y = async ({
scratchCanvas: l,
pdfDocument: v,
pageNumber: _,
viewerPdfPage: I,
printResolution: x,
optionalContentConfigPromise: S,
printAnnotationStoragePromise: R
}) => {
if (u.current) {
w();
return;
}
const N = x / Fo.PDF;
l.width = Math.floor(I.width * N), l.height = Math.floor(I.height * N);
const A = l.getContext("2d");
A.save(), A.fillStyle = "rgb(255, 255, 255)", A.fillRect(0, 0, l.width, l.height), A.restore();
const [F, D] = await Promise.all([
v.getPage(_),
R
]);
if (u.current) {
w();
return;
}
const L = {
canvasContext: A,
transform: [N, 0, 0, N, 0, 0],
viewport: F.getViewport({ scale: 1, rotation: I.rotation }),
intent: "print",
annotationMode: ko.ENABLE_STORAGE,
optionalContentConfigPromise: S,
printAnnotationStorage: D
};
try {
return F.render(L).promise;
} catch (E) {
throw E instanceof Mo || console.error(E), E;
}
}, b = O(() => {
const l = window.print;
return new Promise((v) => {
const _ = (S) => {
setTimeout(() => {
l.call(window), setTimeout(() => S(), 20);
}, 0);
};
if (document.querySelector(".rp-print-zone")) {
_(v);
return;
}
const x = new MutationObserver(() => {
document.querySelector(".rp-print-zone") && (_(v), x.disconnect());
});
x.observe(document.body, { childList: !0, subtree: !0 });
});
}, []), g = async (l) => {
const v = document.createElement("img"), _ = document.createElement("div");
return _.classList.add("rp-print-page"), await new Promise((I, x) => {
l.toBlob((S) => {
S ? (v.src = URL.createObjectURL(S), v.onload = () => {
URL.revokeObjectURL(v.src), I();
}, v.onerror = x) : x(new Error("Failed to create blob"));
});
}).catch(() => {
}), _.appendChild(v), _;
}, h = (l, v) => {
const _ = document.createElement("div");
_.classList.add("rp-print-zone");
const I = document.createElement("style"), x = v.get(1);
if (x) {
const { width: S, height: R } = x == null ? void 0 : x.page.getViewport({ scale: 1 });
I.innerHTML = `@page { size: ${S}px ${R}px }`;
}
return _.appendChild(I), _.append(...l), _;
}, p = O(
async (l) => {
if (!t)
return;
w();
const v = l && "visibleDefaultProgress" in l ? l : void 0;
(v == null ? void 0 : v.visibleDefaultProgress) !== void 0 ? T(v.visibleDefaultProgress) : T(!0);
const _ = document.createElement("canvas"), I = [];
try {
t.isPureXfa && console.warn("[rp] XFA Form is not supported at the moment.");
const S = t.getOptionalContentConfig({ intent: "print" }), R = Promise.resolve(
t.annotationStorage.print ?? void 0
), N = e.size;
for (const [F, D] of e) {
if (u.current) {
w();
return;
}
const L = D.page.getViewport({ scale: 1 });
if (await y({
scratchCanvas: _,
pdfDocument: t,
pageNumber: F,
viewerPdfPage: L,
printResolution: 150,
optionalContentConfigPromise: S,
printAnnotationStoragePromise: R
}), u.current) {
w();
return;
}
const E = await g(_);
I.push(E);
const U = parseFloat((I.length / N * 100).toFixed(2));
r({
loadedPages: F,
totalPages: N,
percentage: U
});
}
if (u.current) {
w();
return;
}
const A = h(I, e);
document.body.appendChild(A), document.documentElement.classList.add("rp-print-html-printing"), document.body.classList.add("rp-print-body-printing"), a(!0), await b();
} catch (x) {
d(!0), x instanceof Error && f(x);
} finally {
_.height = 0, _.width = 0;
}
},
[t, e, u, w, h, b]
);
return z(() => {
const l = () => {
w(), C();
};
return window.addEventListener("afterprint", l, !0), () => {
window.removeEventListener("afterprint", l, !0);
};
}, [C, w]), {
print: p,
cancel: P,
progress: n,
isComplete: o,
isError: c,
error: s,
showDefaultProgress: m
};
}, xn = je({
print: async () => {
},
cancel: () => {
},
setOnProgress: (t) => {
},
progress: {},
setOnComplete: (t) => t(),
setOnError: (t) => {
try {
const e = new Error("Print error occurred");
t(e);
} catch (e) {
console.error("Error in setOnError callback:", e);
}
}
}), Cc = ({ children: t }) => {
const [e, n] = H(null), [r, o] = H(null), { print: a, cancel: c, progress: d, isComplete: s, isError: f, error: m, showDefaultProgress: T } = Br(), u = O((b) => {
b && typeof b == "function" && o(() => b);
}, []), C = (b) => {
m && b(m);
}, w = O(
(b) => {
n(() => b);
},
[d, e]
);
z(() => {
s && r && P();
}, [s, r]), z(() => {
f && C((b) => {
console.error(b);
});
}, [f]), z(() => {
d && e && e(d);
}, [d, e]);
const P = () => {
r && (r(), o(null));
}, y = {
print: a,
cancel: c,
setOnProgress: w,
setOnComplete: u,
setOnError: C,
progress: d,
showDefaultProgress: T
};
return /* @__PURE__ */ i(xn.Provider, { value: y, children: t });
}, ct = () => {
const t = Ze(xn);
if (!t)
throw new Error("usePrintContext must be used within a PrintProvider");
return t;
}, jr = () => {
const [t, e] = H({}), { pages: n } = re(), r = W(() => Object.keys(t).length, [t]), o = O(
(c) => {
if (!n.size)
return;
const d = c > n.size ? n.size : c, f = Array.from(n.values()).slice(0, d).map((m) => {
const { thumbnailViewport: T, scale: u } = wr(m.page, m.defaultRotation);
return {
scale: u,
page: m.page,
loading: !0,
viewport: T,
defaultRotation: m.defaultRotation
};
}).reduce((m, T) => (m[T.page.pageNumber] = T, m), {});
e(f);
},
[n]
);
z(() => {
o(10);
}, [o]);
const a = O(
(c) => {
if (!n)
return;
const d = n.get(c);
d && e((s) => ({
...s,
[c]: {
loading: !0,
page: d.page,
viewport: d.thumbnailViewport,
scale: d.thumbnailScale,
defaultRotation: d.defaultRotation
}
}));
},
[n]
);
return { thumbnailPages: t, addPage: a, addToPage: o, thumbnailLength: r };
}, Sn = je({
thumbnailPages: {},
addPage: (t) => {
},
addToPage: (t) => {
},
thumbnailLength: 0,
setActive: (t) => {
},
active: !1
}), Rn = () => Ze(Sn), yc = ({
children: t,
initialThumbnailsVisible: e
}) => {
const { thumbnailPages: n, addPage: r, addToPage: o, thumbnailLength: a } = jr(), [c, d] = H(e);
return /* @__PURE__ */ i(
Sn.Provider,
{
value: { thumbnailPages: n, addPage: r, addToPage: o, thumbnailLength: a, active: c, setActive: d },
children: t
}
);
}, Zr = (t = {}, e = "") => {
const [n, r] = H(e), [o, a] = H(!1), { pdf: c, pages: d } = re(), { widths: s, heights: f } = Ke(), m = M(!n), { currentZoom: T } = rt(), [u, C] = H([]), { setFocusedPage: w } = de(), { columnCount: P, viewMode: y } = Ge(), { pageRotate: b } = at(), [g, h] = H(0), { pageScrollElementRef: p, virtualScrollableElementRef: l } = it(), { scrollMode: v } = Ae(), { pagesRef: _ } = Ce(), I = M({}), x = M(0), S = W(() => g === 0 ? null : u[g - 1], [g, u]), R = W(() => u.length, [u]), N = O(
(L) => {
if (L === 0)
return;
const E = u[L - 1];
if (!E || !d)
return;
const U = l || p;
if (!U || !_)
return;
const V = d.get(E.page);
if (v === ae.PAGE_SCROLLING && w(E.page), !V)
return;
let $ = 0, q = 0;
if (v === ae.VERTICAL_SCROLLING) {
const Q = E.page - 1, ie = P;
let se, ce;
if (y === ee.DUAL_PAGE_WITH_COVER)
if (E.page === 1)
se = 0, ce = 0;
else {
const ze = E.page - 2;
se = ze % 2, ce = Math.floor(ze / 2) + 1;
}
else
se = Q % ie, ce = Math.floor(Q / ie);
$ = Me(f, ce), q = Me(s, se);
}
v === ae.HORIZONTAL_SCROLLING && (q = s.slice(0, E.page - 1).reduce((Q, ie) => Q + ie, 0));
const j = {
height: f[E.page - 1],
width: s[E.page - 1]
}, te = b[E.page], { leftInPage: G, topInPage: Y } = vr(
j,
_,
E.rect,
T,
te
), J = q + G, me = $ + Y, ne = {
left: Math.max(J, 0),
top: Math.max(me, 0)
};
U.scrollTo({
...ne,
behavior: "smooth"
});
},
[
d,
w,
s,
f,
v,
y,
P,
l,
p,
_,
u,
T,
b
]
);
z(() => {
g && N(g);
}, [g]);
const A = O(() => {
h((L) => {
let E;
return R ? L + 1 > R ? E = 1 : E = L + 1 : E = 0, x.current = E, E;
}), x.current === 1 && N(x.current);
}, [R, N]), F = O(() => {
h((L) => {
let E;
return R ? L - 1 <= 0 ? E = R : E = L - 1 : E = 0, x.current = E, E;
}), x.current === 1 && N(x.current);
}, [R, N]), D = O(async (L) => {
if (!L)
return {};
const E = L.numPages, U = {};
for (let V = 1; V <= E; V++) {
if (m.current)
throw "close pop over";
const $ = await L.getPage(V);
U[V.toString()] = await $.getTextContent();
}
return U;
}, []);
return z(() => {
if (!n) {
m.current = !0, C([]), h(0);
return;
}
m.current = !1, a(!0), C([]), h(0), D(c).then((L) => {
I.current = L;
const U = Object.keys(L).reduce((V, $) => {
const q = yo(
[n],
L[$],
Number($) - 1,
t
).map((j, te) => ({ ...j, page: Number($), pageMatchIdx: te }));
return [...V, ...q];
}, []);
C(U), h(U.length ? 1 : 0);
}).catch(() => {
C([]), h(0);
}).finally(() => a(!1));
}, [n, D, c, t]), {
search: n,
setSearch: r,
loading: o,
matches: u,
totalMatches: R,
currentMatchPosition: g,
currentMatch: S,
nextMatch: A,
prevMatch: F,
setCurrentMatchPosition: h
};
}, Ln = je({
search: "",
setSearch: (t) => {
},
loading: !1,
matches: [],
totalMatches: 0,
currentMatchPosition: 0,
currentMatch: null,
nextMatch: () => {
},
prevMatch: () => {
},
searchOptions: {},
setSearchOptions: (t) => t,
setCurrentMatchPosition: (t) => t
}), Ic = ({
children: t,
initialSearch: e
}) => {
const [n, r] = H({}), {
loading: o,
setSearch: a,
totalMatches: c,
currentMatchPosition: d,
currentMatch: s,
search: f,
matches: m,
nextMatch: T,
prevMatch: u,
setCurrentMatchPosition: C
} = Zr(n, e);
return /* @__PURE__ */ i(
Ln.Provider,
{
value: {
searchOptions: n,
setSearchOptions: r,
loading: o,
setSearch: a,
totalMatches: c,
currentMatchPosition: d,
currentMatch: s,
nextMatch: T,
prevMatch: u,
search: f,
matches: m,
setCurrentMatchPosition: C
},
children: t
}
);
}, At = () => Ze(Ln), En = je(null), xc = ({ children: t }) => {
const e = M(!1), [n, r] = H([]), o = O((s) => {
r((f) => [...f, { id: s.page.pageNumber.toString(), data: s, priority: 0 }]);
}, []), a = W(() => new Eo(o), [o]), { focusedPage: c } = de(), d = O((s) => (e.current = !0, No(
s.data.page,
s.data.canvasElem,
s.data.options
).promise.then(() => {
s.data.canvasElem.hidden = !1;
}).finally(() => {
s.data.onLoaded && s.data.onLoaded();
})), []);
return z(() => {
c && (a.changePagePriority(`^page-${c}`, 0), a.changePagePriority(`^thumbnail-${c}`, 1));
}, [c]), z(() => {
if (a.isEmpty() || e.current)
return;
const s = () => {
const f = a.dequeue();
f ? d(f).finally(() => {
s();
}) : (e.current = !1, r(a.peekAll()));
};
s();
}, [a, d, n]), /* @__PURE__ */ i(En.Provider, { value: a, children: t });
}, Nn = () => {
const t = Ze(En);
if (!t)
throw new Error("RenderQueue not found");
return t;
}, ue = {
"rp-pages": "_rp-pages_u7m2r_1",
"rp-page-scrolling-wrapper": "_rp-page-scrolling-wrapper_u7m2r_6",
"rp-pages-horizontal-scroll": "_rp-pages-horizontal-scroll_u7m2r_11",
"rp-pages-container": "_rp-pages-container_u7m2r_15",
"rp-viewer": "_rp-viewer_u7m2r_57",
"rp-cursor-grab": "_rp-cursor-grab_u7m2r_62",
"rp-cursor-grabbing": "_rp-cursor-grabbing_u7m2r_70",
"rp-loader": "_rp-loader_u7m2r_78",
"rp-not-supported": "_rp-not-supported_u7m2r_86",
"rp-not-supported-content": "_rp-not-supported-content_u7m2r_102"
}, mt = {
"rp-page-wrapper": "_rp-page-wrapper_ii91u_1",
"rp-page": "_rp-page_ii91u_1",
"rp-loader-wrapper": "_rp-loader-wrapper_ii91u_15"
}, Kr = (t) => {
const { pageNumber: e, onLoaded: n, onLoading: r } = t, o = M(null), { pages: a } = re(), { pageRotate: c } = at(), d = M(), { currentZoom: s } = rt(), { interactiveForm: f } = xt(), m = Nn(), T = M(`page-${e}`);
return z(() => {
if (!a || s === 0)
return;
const u = a.get(e);
if (o.current && u) {
const C = o.current;
C.hidden = !0;
const w = d.current;
w && w.cancel(), r && r(), m.enqueue(
T.current,
{
page: u.page,
canvasElem: C,
options: {
scale: s,
rotate: c[e],
renderForms: !0,
interactiveForm: f
},
onLoaded: n
},
3
);
}
return () => {
m.removeQueue(T.current);
};
}, [a, e, c, s, r, n, m, f]), /* @__PURE__ */ i("canvas", { "data-rp": `page-${e}-canvas`, ref: o });
}, Xr = "_selecting_1oep2_10", Qr = "_markedContent_1oep2_33", Pe = {
"rp-text-layer": "_rp-text-layer_1oep2_1",
selecting: Xr,
markedContent: Qr,
"rp-text-layer-text": "_rp-text-layer-text_1oep2_52"
}, Yr = (t) => {
const { pageNumber: e } = t, { pages: n } = re(), r = M(null), { matches: o, currentMatch: a } = At(), [c, d] = H(
[]
), s = M(), f = M(), m = M([]), T = W(() => o.filter((g) => g.pageIndex === e - 1), [o, e]), u = O(
(g, h, p = !1) => {
if (p && Io(g, h), !T.length) {
m.current = [], d([]);
return;
}
const l = xo(T, g, h);
d(l);
},
[T]
), C = M(), w = M(!1), P = O(() => Array.from(document.querySelectorAll('[data-rp$="-textLayer"]')), []);
z(() => ((() => {
if (C.current)
return;
C.current = new AbortController();
const { signal: h } = C.current, p = () => {
P().forEach((v) => {
const _ = v.querySelector(".endOfContent");
_ && (v.appendChild(_), _.style.width = "", _.style.height = "", v.classList.remove(Pe.selecting));
});
};
document.addEventListener(
"pointerdown",
() => {
w.current = !0;
},
{ signal: h }
), document.addEventListener(
"pointerup",
() => {
w.current = !1, p();
},
{ signal: h }
), window.addEventListener(
"blur",
() => {
w.current = !1, p();
},
{ signal: h }
), document.addEventListener(
"keyup",
() => {
w.current || p();
},
{ signal: h }
);
let l = null;
document.addEventListener(
"selectionchange",
() => {
var A, F;
const v = document.getSelection();
if (!v)
return;
if (v.rangeCount === 0) {
p();
return;
}
const _ = /* @__PURE__ */ new Set();
for (let D = 0; D < v.rangeCount; D++) {
const L = v.getRangeAt(D);
P().forEach((E) => {
L.intersectsNode(E) && !_.has(E) && _.add(E);
});
}
P().forEach((D) => {
if (_.has(D))
D.classList.add(Pe.selecting);
else {
const L = D.querySelector(".endOfContent");
L && (D.appendChild(L), L.style.width = "", L.style.height = "", D.classList.remove(Pe.selecting));
}
});
const I = v.getRangeAt(0);
let S = l && (I.compareBoundaryPoints(Range.END_TO_END, l) === 0 || I.compareBoundaryPoints(Range.START_TO_END, l) === 0) ? I.startContainer : I.endContainer;
S.nodeType === Node.TEXT_NODE && (S = S.parentNode);
const R = (A = S.parentElement) == null ? void 0 : A.closest(
Pe["rp-text-layer"]
), N = R == null ? void 0 : R.querySelector(".endOfContent");
N && R && (N.style.width = R.style.width, N.style.height = R.style.height, (F = S.parentElement) == null || F.insertBefore(N, S.nextSibling)), l = I.cloneRange();
},
{ signal: h }
);
})(), () => {
var h;
(h = C.current) == null || h.abort(), C.current = void 0;
}), [P]);
const y = O(() => {
r.current && r.current.classList.add(Pe.selecting);
}, []), b = O(() => {
r.current && r.current.classList.remove(Pe.selecting);
}, []);
return z(() => {
if (m.current.forEach((p) => {
p.classList.remove("selected");
}), !c.length || !a || a.pageIndex !== e - 1)
return;
const g = T.findIndex(
(p) => JSON.stringify(p) === JSON.stringify(a)
);
if (g === -1)
return;
const h = c.filter((p) => p.index === g);
h.length && (m.current = h.map((p) => p.element), h.forEach((p) => {
p.element.classList.add("selected");
}));
}, [a, c, T]), z(() => {
const g = n.get(e);
if (!g || !r.current)
return;
const h = r.current;
return s.current && s.current.cancel(), g.page.getTextContent().then((p) => {
const l = g.page.getViewport({ scale: 1 });
return s.current = new Wo.TextLayer({
viewport: l,
textContentSource: p,
container: h
}), f.current = p, h && (h.innerText = ""), s.current.render();
}).then(() => {
var _, I;
[].slice.call(h.children).forEach((x) => {
x.classList.add(Pe["rp-text-layer-text"]), x.setAttribute("data-rp", "rp-text-layer-text");
});
const l = (_ = s.current) == null ? void 0 : _.textDivs;
l && f.current && u(f.current, l);
const v = document.createElement("div");
v.className = "endOfContent", (I = r.current) == null || I.appendChild(v);
}).catch(() => {
}), () => {
var p;
(p = s.current) == null || p.cancel();
};
}, [n, e]), z(() => {
var p;
[].slice.call(r.current.children).forEach((l) => {
l.classList.add(Pe["rp-text-layer-text"]);
});
const h = (p = s.current) == null ? void 0 : p.textDivs;
h && f.current && u(f.current, h, !0);
}, [u]), /* @__PURE__ */ i(
"div",
{
"data-rp-text-layer": !0,
"data-rp": `page-${e}-textLayer`,
className: Pe["rp-text-layer"],
ref: r,
onMouseDown: y,
onMouseUp: b
}
);
}, Jr = {
"rp-annotation-layer": "_rp-annotation-layer_1udza_1"
};
let ei = "https://unpkg.com/pdfjs-dist@4.4.168/web/images/";
const ti = (t) => {
const { pageNumber: e } = t, n = M(null), { pages: r, pdf: o } = re(), { interactiveForm: a } = xt(), c = M(), [d, s] = H(), { goToPage: f } = de(), { scrollMode: m } = Ae(), { print: T } = ct(), { download: u } = Xn(), C = M(null), w = W(() => r.get(e), [r, e]), P = W(() => w == null ? void 0 : w.page.getViewport(), [w]);
z(() => {
c.current && (c.current.div.replaceChildren(), c.current = void 0);
}, [o]), z(() => {
w && w.page.getAnnotations().then((b) => {
c.current = void 0, s(b), n.current && (n.current.innerText = "");
});
}, [w]);
const y = O(
(b) => {
!d || !o || (er(b), tr(b, o, d).then((g) => {
var h, p;
((h = g == null ? void 0 : g.data) == null ? void 0 : h.action) === "Print" ? T() : ((p = g == null ? void 0 : g.data) == null ? void 0 : p.action) === "SaveAs" && u();
}));
},
[o, d, m, T, u]
);
return z(() => {
if (!w || !d)
return;
const b = w.page.getViewport();
if (c.current) {
c.current.update({
viewport: b.clone({ dontFlip: !0 })
});
return;
}
const g = /* @__PURE__ */ new Map([]);
for (const l of d) {
const { annotationType: v } = l;
switch (v) {
case $t.Link:
or(l);
break;
case $t.Widget:
nr(l, b, g);
break;
}
}
const h = new AbortController();
return (async () => {
var _;
c.current && (c.current.div.replaceChildren(), c.current = void 0), n.current && (n.current.innerText = ""), c.current = new Ho({
div: n.current,
accessibilityManager: void 0,
annotationCanvasMap: void 0,
annotationEditorUIManager: void 0,
structTreeLayer: null,
page: w.page,
viewport: b.clone({ dontFlip: !0 })
}), n.current && Kt(n.current, y);
const l = await (o == null ? void 0 : o.hasJSActions()), v = await (o == null ? void 0 : o.getFieldObjects());
if (h.signal.aborted)
throw "abort";
return (_ = c.current) == null ? void 0 : _.render({
annotations: d,
annotationStorage: o == null ? void 0 : o.annotationStorage,
hasJSActions: l,
fieldObjects: v,
div: n.current,
viewport: b.clone({ dontFlip: !0 }),
page: w.page,
imageResourcesPath: ei,
renderForms: a ?? !0,
linkService: new Jo(o, f),
downloadManager: null,
enableScripting: !1
});
})().then(() => {
n.current && (rr(n.current, y), jt(n.current), Zt(n.current), C.current && C.current.disconnect(), C.current = new MutationObserver(() => {
n.current && (jt(n.current), Zt(n.current));
}), C.current.observe(n.current, {
childList: !0,
subtree: !0,
attributes: !0,
attributeFilter: ["tabindex", "href"]
}));
}).catch((l) => {
if (l !== "abort")
throw l;
}).finally(() => {
c.current = void 0;
}), () => {
h.abort("clear"), n.current && Kt(n.current, y), C.current && (C.current.disconnect(), C.current = null);
};
}, [o, d, y, f]), /* @__PURE__ */ i(
"div",
{
"data-rp": `page-${e}-annotationLayer`,
style: { width: `${P == null ? void 0 : P.width}px`, height: `${P == null ? void 0 : P.height}px` },
className: Jr["rp-annotation-layer"],
ref: n
}
);
}, ni = {
"rp-text-highlight": "_rp-text-highlight_jdkf8_1"
}, oi = ({ pageNumber: t, viewport: e }) => {
const [n, r] = H(), { pages: o } = re(), { highlightKeywords: a } = Ro(), c = !0, d = M(null), [s, f] = H(null), [m, T] = H([]);
z(() => {
d.current && f(d.current.parentElement);
}, [d]), z(() => {
(async () => {
const h = o.get(t);
if (!h || !d.current)
return;
const p = await h.page.getTextContent();
r(p);
})();
}, [o, t]);
const u = W(() => a ? a.map((g) => {
var h, p;
return {
...ir(g.keyword, (h = g.options) == null ? void 0 : h.matchCase, (p = g.options) == null ? void 0 : p.wholeWords),
color: g.highlightColor
};
}) : [], [a]);
function C(g, h) {
if (!g)
return;
const p = `[data-rp="page-${h}-textLayer"]`;
return new Promise((l) => {
const v = g.querySelector(p);
if (v) {
l(v);
return;
}
new MutationObserver((I, x) => {
const S = g.querySelector(p);
S && (l(S), x.disconnect());
}).observe(g, { childList: !0, subtree: !0 });
});
}
function w(g) {
return new Promise((h) => {
const p = g.querySelectorAll(
'[data-rp="rp-text-layer-text"]'
);
if (p.length) {
h(Array.from(p));
return;
}
new MutationObserver((v, _) => {
const I = g.querySelectorAll(
".rp-text-layer-text"
);
I.length && (h(Array.from(I)), _.disconnect());
}).observe(g, { childList: !0, subtree: !0 });
});
}
const P = (g, h, p, l) => {
var $;
const v = document.createRange(), _ = p.firstChild;
if (!_ || _.nodeType !== Node.TEXT_NODE)
return null;
const I = (($ = _.textContent) == null ? void 0 : $.length) ?? 0, x = l[0].charIdxInSpan, S = l.length === 1 ? x : l[l.length - 1].charIdxInSpan;
if (x > I || S + 1 > I)
return null;
v.setStart(_, x), v.setEnd(_, S + 1);
const R = document.createElement("span");
R.style.width = "auto", v.surroundContents(R);
const N = R.getBoundingClientRect(), A = g.getBoundingClientRect(), F = A.height, D = A.width, L = 100 * (N.left - A.left) / D, E = 100 * (N.top - A.top) / F, U = 100 * N.height / F, V = 100 * N.width / D;
return sr(R), {
keywordStr: h,
left: L,
top: E,
height: U,
width: V,
pageHeight: F,
pageWidth: D
};
};
async function y(g, h) {
const p = await C(s, g);
if (!p)
return;
const l = await w(p);
if (l.length) {
const v = l.map((I) => I.tagName === "BR" ? " " : I.textContent).reduce(
(I, x, S) => I.concat(
x.split("").map((R, N) => ({
char: R,
charIdxInSpan: N,
spanIdx: S
}))
),
[
{
char: "",
charIdxInSpan: 0,
spanIdx: 0
}
]
).slice(1), _ = b(p, h, l, v);
T(_);
}
}
const b = (g, h, p, l) => {
const v = h.length;
if (!l.length || !v)
return [];
const _ = [], I = l.map((x) => x.char).join("");
return u.forEach((x) => {
const { keyword: S, regExp: R, wholeWords: N, color: A } = x, F = S;
if (!F.trim())
return;
const D = R.flags.indexOf("g") === -1 ? new RegExp(R, `${R.flags}g`) : R;
let L;
const E = [];
for (; (L = D.exec(I)) !== null; )
N && !So(I, L.index, L[0].length) || E.push({
keyword: D,
startIndex: L.index,
endIndex: D.lastIndex
});
const U = E.map((V) => ({
keyword: V.keyword,
indexes: l.slice(V.startIndex, V.endIndex),
color: A
}));
for (const V of U) {
const $ = V.indexes.reduce(
(q, j) => (q[j.spanIdx] = (q[j.spanIdx] || []).concat([j]), q),
{}
);
for (const q of Object.values($))
if (q.length !== 1 || q[0].char.trim() !== "") {
const j = q, te = p[j[0].spanIdx], G = P(
g,
F,
te,
j
);
if (G) {
const { left: Y, top: J } = G;
if (_.find((ne) => ne.left === Y && ne.top === J))
continue;
_.push({ ...G, highlightColor: V.color });
}
}
}
}), _.sort(ar), _;
};
return z(() => {
(async () => {
if (!a || a.length === 0) {
T([]);
return;
}
try {
await y(t, a);
} catch (h) {
console.error(h);
}
})();
}, [c, a, t, n, e]), /* @__PURE__ */ i(ge, { children: /* @__PURE__ */ i("div", { ref: d, "data-rp": `page-${t}-textHighlightLayer`, children: m.map((g, h) => /* @__PURE__ */ i(
"div",
{
className: ni["rp-text-highlight"],
style: {
top: `${g.top}%`,
left: `${g.left}%`,
width: `${g.width}%`,
height: `${g.height}%`,
backgroundColor: g.highlightColor
}
},
h
)) }) });
}, $e = st((t, e) => {
const { pageNumber: n, style: r, ...o } = t, { pages: a } = re(), { pageRotate: c } = at(), { textLayer: d } = Po(), { currentZoom: s } = rt(), { LoaderImageComponent: f } = St(), m = M(a.get(n)), [T, u] = H(!1), C = M(null), [w, P] = H({
width: 0,
height: 0
});
mn(e, () => C.current);
const y = W(() => m.current ? c[n] : 0, [n, c]);
z(() => {
if (a && (m.current = a.get(n), m.current)) {
const p = m.current.page.getViewport({
scale: s,
rotation: y
});
P(p);
}
}, [a, n, y, s]);
const b = W(() => {
switch (y) {
case 90:
return `${w.width / 2}px ${w.width / 2}px`;
case -90:
case 270:
return `${w.height / 2}px ${w.height / 2}px`;
default:
return "center";
}
}, [y, w]), g = O(() => {
u(!0);
}, []), h = O(() => {
u(!1);
}, []);
return /* @__PURE__ */ i(
"div",
{
ref: C,
id: `page-${n}`,
"data-rp": `page-${n}`,
...o,
style: {
...r,
"--rp-rotate": `${y}deg`,
"--rp-page-rotate-translate": `${b}`,
"--scale-factor": s
},
className: mt["rp-page-wrapper"],
children: /* @__PURE__ */ k(
"div",
{
style: {
width: `${w.width}px`,
height: `${w.height}px`
},
className: mt["rp-page"],
children: [
/* @__PURE__ */ i(Kr, { onLoading: g, onLoaded: h, pageNumber: n }),
T && f && /* @__PURE__ */ i("div", { className: mt["rp-loader-wrapper"], children: /* @__PURE__ */ i(f, {}) }),
/* @__PURE__ */ i(cr, { pageNumber: n }),
d && /* @__PURE__ */ i(Yr, { pageNumber: n }),
/* @__PURE__ */ i(oi, { pageNumber: n, viewport: w }),
/* @__PURE__ */ i(ti, { pageNumber: n })
]
}
)
}
);
});
function Pt() {
return Pt = Object.assign ? Object.assign.bind() : function(t) {
for (var e = 1; e < arguments.length; e++) {
var n = arguments[e];
for (var r in n)
({}).hasOwnProperty.call(n, r) && (t[r] = n[r]);
}
return t;
}, Pt.apply(null, arguments);
}
function Qt(t) {
if (t === void 0)
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return t;
}
function Tt(t, e) {
return Tt = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(n, r) {
return n.__proto__ = r, n;
}, Tt(t, e);
}
function ri(t, e) {
t.prototype = Object.create(e.prototype), t.prototype.constructor = t, Tt(t, e);
}
var Yt = Number.isNaN || function(e) {
return typeof e == "number" && e !== e;
};
function ii(t, e) {
return !!(t === e || Yt(t) && Yt(e));
}
function ai(t, e) {
if (t.length !== e.length)
return !1;
for (var n = 0; n < t.length; n++)
if (!ii(t[n], e[n]))
return !1;
return !0;
}
function gt(t, e) {
e === void 0 && (e = ai);
var n, r = [], o, a = !1;
function c() {
for (var d = [], s = 0; s < arguments.length; s++)
d[s] = arguments[s];
return a && n === this && e(d, r) || (o = t.apply(this, d), a = !0, n = this, r = d), o;
}
return c;
}
function Jt(t, e) {
if (t == null)
return {};
var n = {};
for (var r in t)
if ({}.hasOwnProperty.call(t, r)) {
if (e.indexOf(r) !== -1)
continue;
n[r] = t[r];
}
return n;
}
var si = typeof performance == "object" && typeof performance.now == "function", en = si ? function() {
return performance.now();
} : function() {
return Date.now();
};
function tn(t) {
cancelAnimationFrame(t.id);
}
function ci(t, e) {
var n = en();
function r() {
en() - n >= e ? t.call(null) : o.id = requestAnimationFrame(r);
}
var o = {
id: requestAnimationFrame(r)
};
return o;
}
var vt = -1;
function li(t) {
if (t === void 0 && (t = !1), vt === -1 || t) {
var e = document.createElement("div"), n = e.style;
n.width = "50px", n.height = "50px", n.overflow = "scroll", document.body.appendChild(e), vt = e.offsetWidth - e.clientWidth, document.body.removeChild(e);
}
return vt;
}
var We = null;
function nn(t) {
if (t === void 0 && (t = !1), We === null || t) {
var e = document.createElement("div"), n = e.style;
n.width = "50px", n.height = "50px", n.overflow = "scroll", n.direction = "rtl";
var r = document.createElement("div"), o = r.style;
return o.width = "100px", o.height = "100px", e.appendChild(r), document.body.appendChild(e), e.scrollLeft > 0 ? We = "positive-descending" : (e.scrollLeft = 1, e.scrollLeft === 0 ? We = "negative" : We = "positive-ascending"), document.body.removeChild(e), We;
}
return We;
}
var di = 150, ui = function(e) {
var n = e.columnIndex;
e.data;
var r = e.rowIndex;
return r + ":" + n;
}, Je = null, et = null, tt = null;
process.env.NODE_ENV !== "production" && typeof window < "u" && typeof window.WeakSet < "u" && (Je = /* @__PURE__ */ new WeakSet(), et = /* @__PURE__ */ new WeakSet(), tt = /* @__PURE__ */ new WeakSet());
function pi(t) {
var e, n = t.getColumnOffset, r = t.getColumnStartIndexForOffset, o = t.getColumnStopIndexForStartIndex, a = t.getColumnWidth, c = t.getEstimatedTotalHeight, d = t.getEstimatedTotalWidth, s = t.getOffsetForColumnAndAlignment, f = t.getOffsetForRowAndAlignment, m = t.getRowHeight, T = t.getRowOffset, u = t.getRowStartIndexForOffset, C = t.getRowStopIndexForStartIndex, w = t.initInstanceProps, P = t.shouldResetStyleCacheOnItemSizeChange, y = t.validateProps;
return e = /* @__PURE__ */ function(b) {
ri(g, b);
function g(p) {
var l;
return l = b.call(this, p) || this, l._instanceProps = w(l.props, Qt(l)), l._resetIsScrollingTimeoutId = null, l._outerRef = void 0, l.state = {
instance: Qt(l),
isScrolling: !1,
horizontalScrollDirection: "forward",
scrollLeft: typeof l.props.initialScrollLeft == "number" ? l.props.initialScrollLeft : 0,
scrollTop: typeof l.props.initialScrollTop == "number" ? l.props.initialScrollTop : 0,
scrollUpdateWasRequested: !1,
verticalScrollDirection: "forward"
}, l._callOnItemsRendered = void 0, l._callOnItemsRendered = gt(function(v, _, I, x, S, R, N, A) {
return l.props.onItemsRendered({
overscanColumnStartIndex: v,
overscanColumnStopIndex: _,
overscanRowStartIndex: I,
overscanRowStopIndex: x,
visibleColumnStartIndex: S,
visibleColumnStopIndex: R,
visibleRowStartIndex: N,
visibleRowStopIndex: A
});
}), l._callOnScroll = void 0, l._callOnScroll = gt(function(v, _, I, x, S) {
return l.props.onScroll({
horizontalScrollDirection: I,
scrollLeft: v,
scrollTop: _,
verticalScrollDirection: x,
scrollUpdateWasRequested: S
});
}), l._getItemStyle = void 0, l._getItemStyle = function(v, _) {
var I = l.props, x = I.columnWidth, S = I.direction, R = I.rowHeight, N = l._getItemStyleCache(P && x, P && S, P && R), A = v + ":" + _, F;
if (N.hasOwnProperty(A))
F = N[A];
else {
var D = n(l.props, _, l._instanceProps), L = S === "rtl";
N[A] = F = {
position: "absolute",
left: L ? void 0 : D,
right: L ? D : void 0,
top: T(l.props, v, l._instanceProps),
height: m(l.props, v, l._instanceProps),
width: a(l.props, _, l._instanceProps)
};
}
return F;
}, l._getItemStyleCache = void 0, l._getItemStyleCache = gt(function(v, _, I) {
return {};
}), l._onScroll = function(v) {
var _ = v.currentTarget, I = _.clientHeight, x = _.clientWidth, S = _.scrollLeft, R = _.scrollTop, N = _.scrollHeight, A = _.scrollWidth;
l.setState(function(F) {
if (F.scrollLeft === S && F.scrollTop === R)
return null;
var D = l.props.direction, L = S;
if (D === "rtl")
switch (nn()) {
case "negative":
L = -S;
break;
case "positive-descending":
L = A - x - S;
break;
}
L = Math.max(0, Math.min(L, A - x));
var E = Math.max(0, Math.min(R, N - I));
return {
isScrolling: !0,
horizontalScrollDirection: F.scrollLeft < S ? "forward" : "backward",
scrollLeft: L,
scrollTop: E,
verticalScrollDirection: F.scrollT