@pdf-viewer/react
Version:
The PDF Viewer component for React and Next.js
84 lines (83 loc) • 4.01 kB
JavaScript
import { jsx as r } from "react/jsx-runtime";
import { useState as i, useId as V, useMemo as T } from "react";
import { P as w, S as D, T as k, a as x } from "../RPDefaultLayout-83caa88c.js";
import { DarkModeProvider as E } from "../contexts/DarkModeContext.js";
import { ViewMode as F, ScrollMode as G, SelectionMode as b } from "../utils/types.js";
import { RotateProvider as y } from "../contexts/RotationContext.js";
import { LayerProvider as _ } from "../contexts/LayerContext.js";
import { ZoomProvider as z } from "../contexts/ZoomContext.js";
import { ViewModeProvider as A } from "../contexts/ViewModeContext.js";
import { ScrollModeProvider as N } from "../contexts/ScrollModeContext.js";
import { VirtualScrollProvider as Z } from "../contexts/VirtualScrollContext.js";
import { VirtualGridProvider as j } from "../contexts/VirtualGridContext.js";
import { SelectionModeProvider as H } from "../contexts/SelectionModeContext.js";
import { InitialStateProvider as O } from "../contexts/InitialStateContext.js";
import { FullScreenProvider as U } from "../contexts/FullScreenContext.js";
import { FileInputProvider as W } from "../contexts/FileInputContext.js";
import { DropFileZoneProvider as X } from "../contexts/DropFileZoneContext.js";
import { LayoutContainerContext as $ } from "../contexts/LayoutContainerContext.js";
import { DimensionPagesProvider as q } from "../contexts/DimensionPagesContext.js";
import { LocalizationProvider as B } from "../contexts/LocalizationContext.js";
import { HighlightProvider as J } from "../contexts/HighlightContext.js";
import { useWatermark as K } from "../utils/hooks/useWatermark.js";
import { DownloadProvider as Q } from "../contexts/DownloadContext.js";
import { SmoothScrollProvider as Y } from "../contexts/SmoothScrollContext.js";
const Ir = (n) => {
const {
children: l,
darkMode: d = !1,
onDarkModeChange: a,
initialRotation: m = 0,
textLayer: c = !0,
initialPage: f = 1,
initialViewMode: h = F.SINGLE_PAGE,
initialThumbnailsVisible: P = !1,
initialSearch: p,
initialScale: s,
initialScrollMode: v = G.VERTICAL_SCROLLING,
locale: S = "en_US",
localization: u,
downloadFilename: M
} = n, [R, g] = i(null), [o, C] = i(null), [L, I] = i(null), e = V(), t = T(() => `rp-instance-${e.replace(/:/g, "-")}`, [e]);
return K(t), /* @__PURE__ */ r(
O,
{
instanceId: t,
initialScale: s,
initialPage: f,
initialScrollMode: v,
initialRotation: m,
initialViewMode: h,
children: /* @__PURE__ */ r(Y, { children: /* @__PURE__ */ r(B, { locale: S, localization: u, children: /* @__PURE__ */ r(j, { children: /* @__PURE__ */ r(Z, { children: /* @__PURE__ */ r(A, { children: /* @__PURE__ */ r(N, { children: /* @__PURE__ */ r(H, { initialSelectionMode: b.TEXT, children: /* @__PURE__ */ r(y, { children: /* @__PURE__ */ r(_, { textLayer: c, children: /* @__PURE__ */ r(
$.Provider,
{
value: {
container: R,
contentRef: o,
pagesRef: L,
setContainer: g,
setContentRef: C,
setPagesRef: I
},
children: /* @__PURE__ */ r(z, { children: /* @__PURE__ */ r(q, { children: /* @__PURE__ */ r(w, { children: /* @__PURE__ */ r(
E,
{
darkMode: d,
onDarkModeChange: a,
children: /* @__PURE__ */ r(D, { initialSearch: p, children: /* @__PURE__ */ r(J, { children: /* @__PURE__ */ r(
k,
{
initialThumbnailsVisible: P,
children: /* @__PURE__ */ r(X, { children: /* @__PURE__ */ r(U, { elementRef: o, children: /* @__PURE__ */ r(x, { children: /* @__PURE__ */ r(Q, { downloadFilename: M, children: /* @__PURE__ */ r(W, { children: l }) }) }) }) })
}
) }) })
}
) }) }) })
}
) }) }) }) }) }) }) }) }) })
}
);
};
export {
Ir as RPController
};