@factorialco/f0-react 10.1.0 → 10.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ChatDocxThumbnail-CX5HYrKS.js → ChatDocxThumbnail-DdI_ITWn.js} +1 -1
- package/dist/{ChatPdfThumbnail-ISkJYLY9.js → ChatPdfThumbnail-DftUFjlF.js} +1 -1
- package/dist/{ChatPostComposerDialog-DxbHdZxW.js → ChatPostComposerDialog-Gj1gd5ED.js} +3 -3
- package/dist/{ChatSheetThumbnail-B2lUZoSi.js → ChatSheetThumbnail-BKCy7BGq.js} +1 -1
- package/dist/{CoachmarkProvider-DqWyppW-.js → CoachmarkProvider-CsqkzlOs.js} +66867 -19860
- package/dist/{DocumentToolbar-BcDACwRP.js → DocumentToolbar-DeE70FQ2.js} +5 -5
- package/dist/{DocxViewer-D-5449ha.js → DocxViewer-bEu4jZnY.js} +3 -3
- package/dist/F0AiProcessingOverlay-IdMxPTPz.js +5999 -0
- package/dist/{F0Box-DrW7A9gg.js → F0Box-D0fWIRgc.js} +20 -20
- package/dist/{F0CanvasPanel-DCKaKwkK.js → F0CanvasPanel-mMDAtCgu.js} +12993 -9719
- package/dist/F0DocumentViewer-CyCOZ_XC.js +391 -0
- package/dist/F0DocumentViewer-DZSiAv1A.js +3 -0
- package/dist/{F0Map-o0Ni4sbn.js → F0Map-DyOzE_rQ.js} +170 -170
- package/dist/{F0Select-CwkVLiZO.js → F0Select-BrvzcAQQ.js} +2270 -2269
- package/dist/F0VideoPlayer-2XgTkMzT.js +1 -0
- package/dist/{F0VideoPlayer-Iw-SFQqN.js → F0VideoPlayer-CEjGJ_6y.js} +396 -397
- package/dist/{LocationMap-CYwkLWH5.js → LocationMap-Ds0SgBMO.js} +2 -2
- package/dist/{Map-DM9wfTpz.js → Map-DVMFiMrr.js} +55 -55
- package/dist/{SheetViewer-BbDeLWkN.js → SheetViewer-DOPvERv8.js} +5 -5
- package/dist/{TextViewer-CnI7Nabs.js → TextViewer-WRl8atLN.js} +2 -2
- package/dist/ai.d.ts +2 -2
- package/dist/ai.js +3 -3
- package/dist/{axe-Z5T0keK7.js → axe-CpDXsSXe.js} +1 -1
- package/dist/component-status.js +54 -9
- package/dist/{dist-DjxhsV9m.js → dist-7YY6sRd4.js} +1 -1
- package/dist/experimental.d.ts +1702 -66
- package/dist/experimental.js +8944 -8185
- package/dist/{exports-CcIlylmm.d.ts → exports-BDFKcDjH.d.ts} +1 -1
- package/dist/f0.d.ts +3 -3
- package/dist/f0.js +3994 -51002
- package/dist/{index-B_My10oo.d.ts → index-C_3CYY4r.d.ts} +1 -1
- package/dist/{index-CAJfRljV.d.ts → index-NaWQyQZT.d.ts} +7 -1
- package/dist/{maplibre-BD2IQLbD.js → maplibre-DYBwcFt1.js} +3 -3
- package/dist/{maplibre-gl-DT2EWG65.js → maplibre-gl-DVldSYfz.js} +1 -1
- package/dist/{papaparse.min-CJow4fNM.js → papaparse.min-BwPbUAd9.js} +1 -1
- package/dist/{pdfWorker-DYQKoZEy.js → pdfWorker-C_6XT3yW.js} +4 -3
- package/dist/{popover-BTxkQ2PV.js → popover-B2hEEubt.js} +2821 -2780
- package/dist/{renderDocx-gCyLwCY2.js → renderDocx-_UmnE-yc.js} +1 -1
- package/dist/rolldown-runtime-BItFwnF5.js +30 -0
- package/dist/{sheetPreview-CcQwSTIl.js → sheetPreview-Ca0kCtSa.js} +2 -2
- package/dist/styles.css +1 -1
- package/dist/{tooltip-DVXqL5Ri.js → tooltip-TOvfXq9F.js} +1481 -1509
- package/dist/{useData-CiWwYG4W.js → useData-DjJsB0qa.js} +4744 -4743
- package/package.json +1 -1
- package/dist/F0AiProcessingOverlay-CmqXWu0j.js +0 -9183
- package/dist/F0DocumentViewer-CEhoiH_i.js +0 -3
- package/dist/F0DocumentViewer-DpuzMqKE.js +0 -392
- package/dist/F0VideoPlayer-CnrSP5Em.js +0 -1
- package/dist/Printer-snTHysV7.js +0 -34
- package/dist/VolumeMuted-Db9P5djr.js +0 -65
|
@@ -0,0 +1,391 @@
|
|
|
1
|
+
import { ar as e, b as t, ln as n, rn as r, rr as i, zt as a } from "./popover-B2hEEubt.js";
|
|
2
|
+
import { I as o } from "./tooltip-TOvfXq9F.js";
|
|
3
|
+
import { Ao as s, Mi as c, Ta as l, va as u } from "./F0CanvasPanel-mMDAtCgu.js";
|
|
4
|
+
import { W as d, q as f } from "./useData-DjJsB0qa.js";
|
|
5
|
+
import { Er as p, dr as m, t as h } from "./F0Select-BrvzcAQQ.js";
|
|
6
|
+
import { i as g, n as _, r as v } from "./pdfWorker-C_6XT3yW.js";
|
|
7
|
+
import { Suspense as y, forwardRef as b, lazy as x, useCallback as S, useEffect as C, useMemo as w, useRef as T, useState as E } from "react";
|
|
8
|
+
import { jsx as D, jsxs as O } from "react/jsx-runtime";
|
|
9
|
+
import './F0DocumentViewer.css';//#region src/addons/documents/F0DocumentViewer/components/PdfLoadingState.tsx
|
|
10
|
+
var k = ({ label: e, width: t, height: r }) => /* @__PURE__ */ D("div", {
|
|
11
|
+
role: "status",
|
|
12
|
+
"aria-label": e,
|
|
13
|
+
"aria-live": "polite",
|
|
14
|
+
"aria-busy": !0,
|
|
15
|
+
className: "F0DocumentViewer__page mx-auto w-fit px-4 pt-4 last:pb-4",
|
|
16
|
+
children: /* @__PURE__ */ D(n, {
|
|
17
|
+
style: {
|
|
18
|
+
width: t,
|
|
19
|
+
height: r
|
|
20
|
+
},
|
|
21
|
+
className: "rounded-lg border border-solid border-f1-border-secondary shadow-md"
|
|
22
|
+
})
|
|
23
|
+
}), A = ({ label: e, icon: n, onClick: r, size: i = "md" }) => /* @__PURE__ */ D(t, {
|
|
24
|
+
label: e,
|
|
25
|
+
icon: n,
|
|
26
|
+
onClick: r,
|
|
27
|
+
hideLabel: !0,
|
|
28
|
+
variant: "outline",
|
|
29
|
+
size: i
|
|
30
|
+
}), j = (e) => o("z-10 flex flex-row items-center gap-2", e === "top" ? "F0DocumentViewer__surface sticky top-0 justify-between px-6 py-4" : "absolute bottom-4 left-1/2 w-max max-w-[calc(100%-2rem)] -translate-x-1/2 gap-4 rounded-xl bg-f1-background-inverse p-2 text-f1-foreground-inverse shadow-lg backdrop-blur-sm"), M = (e, t) => o("flex flex-row items-center gap-2", e === "floating" && "dark", t), N = ({ toolbarRef: e, currentPage: t, totalPages: n, hasDocument: i, selectedScale: a, scaleOptions: c, onPreviousPage: g, onNextPage: _, onZoomIn: v, onZoomOut: y, onScaleChange: b, rotatable: x, onRotate: S, onPrint: C, onDownload: w, actions: T, placement: E }) => {
|
|
31
|
+
let { pdfViewer: k } = r(), N = M(E);
|
|
32
|
+
return /* @__PURE__ */ O("div", {
|
|
33
|
+
ref: e,
|
|
34
|
+
role: "toolbar",
|
|
35
|
+
"aria-label": k.toolbar,
|
|
36
|
+
"data-placement": E,
|
|
37
|
+
className: j(E),
|
|
38
|
+
children: [
|
|
39
|
+
i ? /* @__PURE__ */ O("span", {
|
|
40
|
+
"aria-live": "polite",
|
|
41
|
+
className: o("whitespace-nowrap text-sm font-medium", E === "top" ? "text-f1-foreground-secondary" : "pl-2 text-f1-foreground-inverse"),
|
|
42
|
+
children: [
|
|
43
|
+
t,
|
|
44
|
+
" / ",
|
|
45
|
+
n
|
|
46
|
+
]
|
|
47
|
+
}) : null,
|
|
48
|
+
/* @__PURE__ */ O("div", {
|
|
49
|
+
className: N,
|
|
50
|
+
children: [/* @__PURE__ */ D(A, {
|
|
51
|
+
label: k.previousPage,
|
|
52
|
+
onClick: g,
|
|
53
|
+
icon: p,
|
|
54
|
+
size: "sm"
|
|
55
|
+
}), /* @__PURE__ */ D(A, {
|
|
56
|
+
label: k.nextPage,
|
|
57
|
+
onClick: _,
|
|
58
|
+
icon: f,
|
|
59
|
+
size: "sm"
|
|
60
|
+
})]
|
|
61
|
+
}),
|
|
62
|
+
/* @__PURE__ */ O("div", {
|
|
63
|
+
className: N,
|
|
64
|
+
children: [
|
|
65
|
+
/* @__PURE__ */ D(A, {
|
|
66
|
+
label: k.zoomOut,
|
|
67
|
+
onClick: y,
|
|
68
|
+
icon: d
|
|
69
|
+
}),
|
|
70
|
+
/* @__PURE__ */ D(A, {
|
|
71
|
+
label: k.zoomIn,
|
|
72
|
+
onClick: v,
|
|
73
|
+
icon: m
|
|
74
|
+
}),
|
|
75
|
+
/* @__PURE__ */ D(h, {
|
|
76
|
+
hideLabel: !0,
|
|
77
|
+
label: k.scaleSelector,
|
|
78
|
+
options: c,
|
|
79
|
+
value: a,
|
|
80
|
+
onChange: (e) => b(e)
|
|
81
|
+
})
|
|
82
|
+
]
|
|
83
|
+
}),
|
|
84
|
+
/* @__PURE__ */ O("div", {
|
|
85
|
+
className: N,
|
|
86
|
+
children: [
|
|
87
|
+
x ? /* @__PURE__ */ D(A, {
|
|
88
|
+
label: k.rotate,
|
|
89
|
+
onClick: S,
|
|
90
|
+
icon: u
|
|
91
|
+
}) : null,
|
|
92
|
+
/* @__PURE__ */ D(A, {
|
|
93
|
+
label: k.print,
|
|
94
|
+
onClick: C,
|
|
95
|
+
icon: l
|
|
96
|
+
}),
|
|
97
|
+
/* @__PURE__ */ D(A, {
|
|
98
|
+
label: k.download,
|
|
99
|
+
onClick: w,
|
|
100
|
+
icon: s
|
|
101
|
+
}),
|
|
102
|
+
T?.map((e, t) => /* @__PURE__ */ D(A, {
|
|
103
|
+
label: e.label,
|
|
104
|
+
onClick: e.onClick,
|
|
105
|
+
icon: e.icon
|
|
106
|
+
}, `${e.label}-${t}`))
|
|
107
|
+
]
|
|
108
|
+
})
|
|
109
|
+
]
|
|
110
|
+
});
|
|
111
|
+
}, ee = (e, t) => t ? (Math.round(t * e) + .001) / t : e, te = (e, t = window.devicePixelRatio || 1) => {
|
|
112
|
+
e && e.width !== 0 && e.height !== 0 && (e.style.width = `${e.width / t}px`, e.style.height = `${e.height / t}px`);
|
|
113
|
+
}, P = () => {
|
|
114
|
+
let { pdfViewer: e } = r();
|
|
115
|
+
return /* @__PURE__ */ O("div", {
|
|
116
|
+
role: "status",
|
|
117
|
+
"aria-busy": "true",
|
|
118
|
+
"aria-live": "polite",
|
|
119
|
+
"aria-label": e.loading,
|
|
120
|
+
className: o("F0DocumentViewer__surface flex h-full w-full flex-col overflow-hidden", "border border-solid border-f1-border-secondary"),
|
|
121
|
+
children: [/* @__PURE__ */ O("div", {
|
|
122
|
+
className: "flex flex-row items-center justify-between gap-2 px-6 py-4",
|
|
123
|
+
children: [
|
|
124
|
+
/* @__PURE__ */ D(n, { className: "h-8 w-24 rounded-md" }),
|
|
125
|
+
/* @__PURE__ */ D(n, { className: "h-8 w-40 rounded-md" }),
|
|
126
|
+
/* @__PURE__ */ D(n, { className: "h-8 w-20 rounded-md" })
|
|
127
|
+
]
|
|
128
|
+
}), /* @__PURE__ */ D("div", {
|
|
129
|
+
className: "flex flex-1 justify-center p-4",
|
|
130
|
+
children: /* @__PURE__ */ D(n, { className: "h-full w-full max-w-[600px] rounded-md" })
|
|
131
|
+
})]
|
|
132
|
+
});
|
|
133
|
+
}, F = async (e) => {
|
|
134
|
+
let t = await e.saveDocument();
|
|
135
|
+
return new Blob([new Uint8Array(t)], { type: "application/pdf" });
|
|
136
|
+
}, ne = async (e) => {
|
|
137
|
+
if (!e) return;
|
|
138
|
+
let t = URL.createObjectURL(await F(e)), n = document.createElement("iframe");
|
|
139
|
+
n.style.display = "none", n.src = t, n.onload = () => {
|
|
140
|
+
n.focus(), n.contentWindow?.print();
|
|
141
|
+
let e = () => {
|
|
142
|
+
URL.revokeObjectURL(t), n.remove();
|
|
143
|
+
};
|
|
144
|
+
n.contentWindow?.addEventListener("afterprint", e), setTimeout(e, 6e4);
|
|
145
|
+
}, document.body.appendChild(n);
|
|
146
|
+
}, re = async (e, t) => {
|
|
147
|
+
if (!e) return;
|
|
148
|
+
let n = URL.createObjectURL(await F(e)), r = document.createElement("a");
|
|
149
|
+
r.href = n, r.download = t.length > 0 ? t : "document.pdf", document.body.appendChild(r), r.click(), r.remove(), URL.revokeObjectURL(n);
|
|
150
|
+
}, I = async (e, t, n = !0) => {
|
|
151
|
+
let r = e, i;
|
|
152
|
+
try {
|
|
153
|
+
let t = await fetch(e, { credentials: n ? "include" : "same-origin" });
|
|
154
|
+
if (!t.ok) throw Error(`${t.status}`);
|
|
155
|
+
i = URL.createObjectURL(await t.blob()), r = i;
|
|
156
|
+
} catch {}
|
|
157
|
+
let a = document.createElement("a");
|
|
158
|
+
a.href = r, a.download = t ?? "", a.rel = "noreferrer", i || (a.target = "_blank"), document.body.appendChild(a), a.click(), a.remove(), i && URL.revokeObjectURL(i);
|
|
159
|
+
}, L = [
|
|
160
|
+
"0.5",
|
|
161
|
+
"0.75",
|
|
162
|
+
"1",
|
|
163
|
+
"1.25",
|
|
164
|
+
"1.5",
|
|
165
|
+
"2",
|
|
166
|
+
"3",
|
|
167
|
+
"4"
|
|
168
|
+
], R = L.map(Number), ie = (e) => R.find((t) => t > e), ae = (e) => [...R].reverse().find((t) => t < e), oe = (e, t, n) => {
|
|
169
|
+
let r = null, i = 0;
|
|
170
|
+
return t.forEach((t, a) => {
|
|
171
|
+
if (!t) return;
|
|
172
|
+
let o = t.offsetHeight, s = t.offsetTop, c = s + o, l = e.offsetHeight - n, u = e.scrollTop + n, d = u + l;
|
|
173
|
+
if (!(u < c && d > s)) return;
|
|
174
|
+
let f;
|
|
175
|
+
if (u <= s) f = d > c ? o : d - s;
|
|
176
|
+
else {
|
|
177
|
+
let e = u - s;
|
|
178
|
+
d < c && (e += c - d), f = o - e;
|
|
179
|
+
}
|
|
180
|
+
f > i && (i = f, r = a + 1);
|
|
181
|
+
}), r;
|
|
182
|
+
};
|
|
183
|
+
//#endregion
|
|
184
|
+
//#region src/addons/documents/F0DocumentViewer/F0DocumentViewer.tsx
|
|
185
|
+
_();
|
|
186
|
+
var z = x(() => import("./SheetViewer-DOPvERv8.js")), B = x(() => import("./DocxViewer-bEu4jZnY.js")), V = x(() => import("./TextViewer-WRl8atLN.js")), se = 48, ce = 150, H = b((e, t) => {
|
|
187
|
+
let { kind: r = "pdf", mimeType: i, toolbar: a = "top", ...o } = e;
|
|
188
|
+
if (r === "pdf") return /* @__PURE__ */ D(U, {
|
|
189
|
+
ref: t,
|
|
190
|
+
toolbar: a,
|
|
191
|
+
...o
|
|
192
|
+
});
|
|
193
|
+
let { url: s, filename: c, actions: l, withCredentials: u = !0, page: d, pagesToDisplay: f, initialScale: p, rotatable: m, initialRotation: h, onRotationChange: g, onPdfLoaded: _, onPageChange: v, ...b } = o;
|
|
194
|
+
return /* @__PURE__ */ D("div", {
|
|
195
|
+
ref: t,
|
|
196
|
+
...b,
|
|
197
|
+
className: "F0DocumentViewer__surface relative flex h-full w-full flex-col overflow-hidden border border-solid border-f1-border-secondary",
|
|
198
|
+
children: /* @__PURE__ */ O(y, {
|
|
199
|
+
fallback: /* @__PURE__ */ D(n, { className: "h-full w-full rounded-none" }),
|
|
200
|
+
children: [
|
|
201
|
+
r === "sheet" ? /* @__PURE__ */ D(z, {
|
|
202
|
+
url: s,
|
|
203
|
+
filename: c,
|
|
204
|
+
withCredentials: u,
|
|
205
|
+
actions: l,
|
|
206
|
+
toolbar: a
|
|
207
|
+
}) : null,
|
|
208
|
+
r === "docx" ? /* @__PURE__ */ D(B, {
|
|
209
|
+
url: s,
|
|
210
|
+
filename: c,
|
|
211
|
+
withCredentials: u,
|
|
212
|
+
actions: l,
|
|
213
|
+
toolbar: a
|
|
214
|
+
}) : null,
|
|
215
|
+
r === "text" ? /* @__PURE__ */ D(V, {
|
|
216
|
+
url: s,
|
|
217
|
+
name: c ?? "",
|
|
218
|
+
mimeType: i,
|
|
219
|
+
withCredentials: u,
|
|
220
|
+
actions: l,
|
|
221
|
+
toolbar: a
|
|
222
|
+
}) : null
|
|
223
|
+
]
|
|
224
|
+
})
|
|
225
|
+
});
|
|
226
|
+
});
|
|
227
|
+
H.displayName = "F0DocumentViewer";
|
|
228
|
+
var U = b((e, t) => {
|
|
229
|
+
let { url: i, filename: o = "document.pdf", page: s = 0, pagesToDisplay: c = [], initialScale: l = "page-width", withCredentials: u = !0, rotatable: d = !1, initialRotation: f = 0, onRotationChange: p, onPdfLoaded: m, onPageChange: h, actions: _, toolbar: y = "top", ...b } = e, { pdfViewer: x } = r(), A = Math.max(2, typeof window > "u" ? 1 : window.devicePixelRatio || 1), [j, M] = E(null), [P, F] = E([]), [I, R] = E(1), [z, B] = E(0), [V, H] = E(l), [U, W] = E(f), G = T(null), K = T(null), q = T([]), J = c.length > 0 ? c.length : j?.numPages, Y = S(() => y === "top" ? K.current?.offsetHeight ?? 0 : 0, [y]), le = P.find(Boolean), ue = (le?.originalWidth ?? 595) * I, de = (le?.originalHeight ?? 842) * I, fe = w(() => [
|
|
230
|
+
{
|
|
231
|
+
value: "page-width",
|
|
232
|
+
label: x.pageWidth
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
value: "page-fit",
|
|
236
|
+
label: x.pageFit
|
|
237
|
+
},
|
|
238
|
+
...L.map((e) => ({
|
|
239
|
+
value: e,
|
|
240
|
+
label: `${Number(e) * 100}%`
|
|
241
|
+
}))
|
|
242
|
+
], [x.pageWidth, x.pageFit]), pe = w(() => ({
|
|
243
|
+
url: i,
|
|
244
|
+
withCredentials: u
|
|
245
|
+
}), [i, u]), X = S((e) => {
|
|
246
|
+
let t = (J ?? 1) - 1, n = Math.min(Math.max(e, 0), t), r = q.current[n], i = r?.offsetParent;
|
|
247
|
+
r && i instanceof HTMLElement && (i.scrollTop = r.offsetTop - Y() - 10);
|
|
248
|
+
}, [J, Y]), Z = S((e) => {
|
|
249
|
+
let t = P[z - 1], n = G.current;
|
|
250
|
+
if (!t || !n) return;
|
|
251
|
+
let r = K.current?.offsetHeight ?? 0, i = U === 90 || U === 270, a = i ? t.originalHeight : t.originalWidth, o = i ? t.originalWidth : t.originalHeight, s = e === "page-width" ? (n.clientWidth - se) / a : (n.clientHeight - r - se) / o;
|
|
252
|
+
R(s), H(e);
|
|
253
|
+
}, [
|
|
254
|
+
P,
|
|
255
|
+
z,
|
|
256
|
+
U
|
|
257
|
+
]), me = S((e) => {
|
|
258
|
+
e === "page-width" || e === "page-fit" ? Z(e) : (R(Number(e)), H(e));
|
|
259
|
+
}, [Z]), Q = S((e) => {
|
|
260
|
+
if (e === void 0) return;
|
|
261
|
+
R(e);
|
|
262
|
+
let t = L.find((t) => Number(t) === e);
|
|
263
|
+
t && H(t);
|
|
264
|
+
}, []), he = S(() => Q(ie(I)), [I, Q]), ge = S(() => Q(ae(I)), [I, Q]), _e = S(() => {
|
|
265
|
+
W((e) => {
|
|
266
|
+
let t = (e + 90) % 360;
|
|
267
|
+
return p?.(t), t;
|
|
268
|
+
});
|
|
269
|
+
}, [p]), ve = S((e) => {
|
|
270
|
+
M(e), m?.(e), setTimeout(() => {
|
|
271
|
+
B(s + 1), X(s);
|
|
272
|
+
}, 0);
|
|
273
|
+
}, [
|
|
274
|
+
m,
|
|
275
|
+
s,
|
|
276
|
+
X
|
|
277
|
+
]), ye = S((e) => {
|
|
278
|
+
let t = e.target;
|
|
279
|
+
if (!(t instanceof HTMLElement)) return;
|
|
280
|
+
let n = oe(t, q.current, Y());
|
|
281
|
+
n && B(n);
|
|
282
|
+
}, [Y]), be = S(() => {
|
|
283
|
+
ne(j);
|
|
284
|
+
}, [j]), xe = S(() => {
|
|
285
|
+
re(j, o);
|
|
286
|
+
}, [j, o]);
|
|
287
|
+
C(() => {
|
|
288
|
+
M(null), F([]), q.current = [];
|
|
289
|
+
}, [i]), C(() => {
|
|
290
|
+
X(s);
|
|
291
|
+
}, [s, X]), C(() => {
|
|
292
|
+
z > 0 && h?.(z);
|
|
293
|
+
}, [z, h]), C(() => {
|
|
294
|
+
P.length > 0 && (l === "page-width" || l === "page-fit") && Z(l);
|
|
295
|
+
}, [P.length, l]), C(() => {
|
|
296
|
+
(V === "page-width" || V === "page-fit") && Z(V);
|
|
297
|
+
}, [U]);
|
|
298
|
+
let $ = T();
|
|
299
|
+
a({
|
|
300
|
+
ref: G,
|
|
301
|
+
onResize: () => {
|
|
302
|
+
clearTimeout($.current), $.current = setTimeout(() => {
|
|
303
|
+
(V === "page-width" || V === "page-fit") && Z(V);
|
|
304
|
+
}, ce);
|
|
305
|
+
}
|
|
306
|
+
}), C(function() {
|
|
307
|
+
return () => clearTimeout($.current);
|
|
308
|
+
}, []), C(() => {
|
|
309
|
+
let e = G.current;
|
|
310
|
+
if (!e) return;
|
|
311
|
+
let t = (e) => {
|
|
312
|
+
let t = e.target;
|
|
313
|
+
t instanceof HTMLAnchorElement && (t.target = "_blank", t.rel = "noopener noreferrer");
|
|
314
|
+
};
|
|
315
|
+
return e.addEventListener("click", t, !0), () => e.removeEventListener("click", t, !0);
|
|
316
|
+
}, []);
|
|
317
|
+
let Se = {
|
|
318
|
+
toolbarRef: K,
|
|
319
|
+
placement: y,
|
|
320
|
+
currentPage: z,
|
|
321
|
+
totalPages: J,
|
|
322
|
+
hasDocument: !!j?.numPages,
|
|
323
|
+
selectedScale: V,
|
|
324
|
+
scaleOptions: fe,
|
|
325
|
+
onPreviousPage: () => X(z - 2),
|
|
326
|
+
onNextPage: () => X(z),
|
|
327
|
+
onZoomIn: he,
|
|
328
|
+
onZoomOut: ge,
|
|
329
|
+
onScaleChange: me,
|
|
330
|
+
rotatable: d,
|
|
331
|
+
onRotate: _e,
|
|
332
|
+
onPrint: be,
|
|
333
|
+
onDownload: xe,
|
|
334
|
+
actions: _
|
|
335
|
+
};
|
|
336
|
+
return /* @__PURE__ */ O("div", {
|
|
337
|
+
ref: t,
|
|
338
|
+
...b,
|
|
339
|
+
className: "F0DocumentViewer__surface relative flex h-full w-full flex-col overflow-hidden border border-solid border-f1-border-secondary",
|
|
340
|
+
children: [/* @__PURE__ */ O("div", {
|
|
341
|
+
ref: G,
|
|
342
|
+
onScroll: ye,
|
|
343
|
+
className: "F0DocumentViewer__surface relative flex h-full flex-col overflow-auto [scrollbar-gutter:stable_both-edges]",
|
|
344
|
+
children: [y === "top" ? /* @__PURE__ */ D(N, { ...Se }) : null, i ? /* @__PURE__ */ D(g, {
|
|
345
|
+
file: pe,
|
|
346
|
+
onLoadSuccess: ve,
|
|
347
|
+
loading: /* @__PURE__ */ D(k, {
|
|
348
|
+
label: x.loading,
|
|
349
|
+
width: ue,
|
|
350
|
+
height: de
|
|
351
|
+
}),
|
|
352
|
+
children: j ? Array.from({ length: J ?? 0 }).map((e, t) => {
|
|
353
|
+
let r = (c.length > 0 ? c[t] : t) + 1;
|
|
354
|
+
return /* @__PURE__ */ D("div", {
|
|
355
|
+
className: "F0DocumentViewer__page mx-auto w-fit px-4 pt-4 last:pb-4",
|
|
356
|
+
children: /* @__PURE__ */ D(v, {
|
|
357
|
+
className: "overflow-hidden rounded-lg border border-solid border-f1-border-secondary shadow-md",
|
|
358
|
+
pageNumber: r,
|
|
359
|
+
scale: ee(I, U === 90 || U === 270 ? P[t]?.originalHeight : P[t]?.originalWidth),
|
|
360
|
+
rotate: U,
|
|
361
|
+
devicePixelRatio: A,
|
|
362
|
+
loading: /* @__PURE__ */ D(n, { style: {
|
|
363
|
+
width: ue,
|
|
364
|
+
height: de
|
|
365
|
+
} }),
|
|
366
|
+
renderForms: !0,
|
|
367
|
+
renderTextLayer: !0,
|
|
368
|
+
inputRef: (e) => {
|
|
369
|
+
q.current[t] = e;
|
|
370
|
+
},
|
|
371
|
+
onRenderSuccess: () => te(q.current[t]?.querySelector("canvas"), A),
|
|
372
|
+
onLoadSuccess: (e) => {
|
|
373
|
+
F((n) => {
|
|
374
|
+
let r = [...n];
|
|
375
|
+
return r[t] = {
|
|
376
|
+
originalWidth: e.originalWidth,
|
|
377
|
+
originalHeight: e.originalHeight
|
|
378
|
+
}, r;
|
|
379
|
+
});
|
|
380
|
+
}
|
|
381
|
+
})
|
|
382
|
+
}, t);
|
|
383
|
+
}) : null
|
|
384
|
+
}) : null]
|
|
385
|
+
}), y === "floating" ? /* @__PURE__ */ D(N, { ...Se }) : null]
|
|
386
|
+
});
|
|
387
|
+
});
|
|
388
|
+
U.displayName = "PdfViewerBase";
|
|
389
|
+
var W = e(i("F0DocumentViewer", c(H, P))), G = W;
|
|
390
|
+
//#endregion
|
|
391
|
+
export { ie as a, M as c, ae as i, A as l, G as n, I as o, L as r, j as s, W as t };
|