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