@factorialco/f0-react 8.10.0 → 8.11.0
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/{ChatPdfThumbnail-DozngSN5.js → ChatPdfThumbnail-TLaZnZvC.js} +1 -1
- package/dist/{ChatPostComposerDialog-C7wAPqjc.js → ChatPostComposerDialog-CcJrEKKe.js} +3 -3
- package/dist/DocumentToolbar-CXRJ8OXq.js +113 -0
- package/dist/DocxViewer-BVpuMNRK.js +72 -0
- package/dist/{F0AiProcessingOverlay-DfZDuEp8.js → F0AiProcessingOverlay-BikXmclE.js} +1 -1
- package/dist/{F0CanvasPanel-CTqnQRE3.js → F0CanvasPanel-rSEKuj9G.js} +865 -863
- package/dist/{F0Map-BAQLATIl.js → F0Map-CYcg0jX0.js} +4 -4
- package/dist/{F0VideoPlayer-Df1wGL5l.js → F0VideoPlayer-CU_V9ZLL.js} +2 -2
- package/dist/{MapProvider-DgFqoQIm.js → MapProvider-C-6QmLYm.js} +3 -2
- package/dist/SheetViewer-CPfuzHpV.js +111 -0
- package/dist/{TextViewer-D1DLjt7A.js → TextViewer-B3Ywj3cq.js} +37 -32
- package/dist/ai.d.ts +6 -6
- package/dist/ai.js +2 -2
- package/dist/component-status.d.ts +6 -6
- package/dist/component-status.js +1 -1
- package/dist/{experimental-CyWlwE_p.js → experimental-CWojgT_y.js} +8 -8
- package/dist/experimental.d.ts +6 -6
- package/dist/experimental.js +4 -4
- package/dist/f0.d.ts +81 -57
- package/dist/f0.js +49 -48
- package/dist/i18n-provider-defaults.d.ts +6 -6
- package/dist/{index-p8b48vGA.js → index-CDQnrJIg.js} +3 -3
- package/dist/{index-_XpVViOx.js → index-ClSjtDCN.js} +2 -2
- package/dist/{index-4Y21ajv9.js → index-D-9j-pbd.js} +1 -1
- package/dist/index-Dje-uQ_s.js +589 -0
- package/dist/index-rMIHcwIi.js +4 -0
- package/dist/index2.css +1 -1
- package/dist/{pdfWorker-CKRkJFJS.js → pdfWorker-fGMmJvrx.js} +2 -2
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/dist/DocumentToolbar-DUGzj-eX.js +0 -93
- package/dist/DocxViewer-DwUWtdNa.js +0 -67
- package/dist/SheetViewer-CdYNMDKZ.js +0 -108
- package/dist/index-DStIDJS6.js +0 -556
- package/dist/index-aPKSzZ3T.js +0 -4
|
@@ -0,0 +1,589 @@
|
|
|
1
|
+
import { S as V, y as _e, u as Q, z as Ce, w as Fe, i as Le, j as De, k as Ve, A as Te, l as He, B as Ee, E as Ue, G as We } from "./F0CanvasPanel-rSEKuj9G.js";
|
|
2
|
+
import { jsx as n, jsxs as P } from "react/jsx-runtime";
|
|
3
|
+
import { lazy as X, forwardRef as se, Suspense as je, useState as H, useRef as J, useCallback as w, useMemo as re, useEffect as E } from "react";
|
|
4
|
+
import { e as Oe, D as $e, P as Be, c as Me } from "./pdfWorker-fGMmJvrx.js";
|
|
5
|
+
import { F as ze } from "./Printer-BD-FEi_2.js";
|
|
6
|
+
import { d as I } from "./tooltip-CrXp1Uaz.js";
|
|
7
|
+
import './index2.css';const Ie = ({
|
|
8
|
+
label: e,
|
|
9
|
+
width: t,
|
|
10
|
+
height: o
|
|
11
|
+
}) => /* @__PURE__ */ n(
|
|
12
|
+
"div",
|
|
13
|
+
{
|
|
14
|
+
role: "status",
|
|
15
|
+
"aria-label": e,
|
|
16
|
+
"aria-live": "polite",
|
|
17
|
+
"aria-busy": !0,
|
|
18
|
+
className: "F0DocumentViewer__page mx-auto w-fit px-4 pt-4 last:pb-4",
|
|
19
|
+
children: /* @__PURE__ */ n(
|
|
20
|
+
V,
|
|
21
|
+
{
|
|
22
|
+
style: { width: t, height: o },
|
|
23
|
+
className: "rounded-lg border border-solid border-f1-border-secondary shadow-md"
|
|
24
|
+
}
|
|
25
|
+
)
|
|
26
|
+
}
|
|
27
|
+
), N = ({
|
|
28
|
+
label: e,
|
|
29
|
+
icon: t,
|
|
30
|
+
onClick: o,
|
|
31
|
+
size: i = "md"
|
|
32
|
+
}) => /* @__PURE__ */ n(
|
|
33
|
+
_e,
|
|
34
|
+
{
|
|
35
|
+
label: e,
|
|
36
|
+
icon: t,
|
|
37
|
+
onClick: o,
|
|
38
|
+
hideLabel: !0,
|
|
39
|
+
variant: "outline",
|
|
40
|
+
size: i
|
|
41
|
+
}
|
|
42
|
+
), Ae = (e) => I(
|
|
43
|
+
"z-10 flex flex-row items-center gap-2",
|
|
44
|
+
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"
|
|
45
|
+
), Ge = (e, t) => I(
|
|
46
|
+
"flex flex-row items-center gap-2",
|
|
47
|
+
e === "floating" && "dark",
|
|
48
|
+
t
|
|
49
|
+
), ie = ({
|
|
50
|
+
toolbarRef: e,
|
|
51
|
+
currentPage: t,
|
|
52
|
+
totalPages: o,
|
|
53
|
+
hasDocument: i,
|
|
54
|
+
selectedScale: l,
|
|
55
|
+
scaleOptions: s,
|
|
56
|
+
onPreviousPage: c,
|
|
57
|
+
onNextPage: h,
|
|
58
|
+
onZoomIn: u,
|
|
59
|
+
onZoomOut: b,
|
|
60
|
+
onScaleChange: _,
|
|
61
|
+
rotatable: v,
|
|
62
|
+
onRotate: x,
|
|
63
|
+
onPrint: U,
|
|
64
|
+
onDownload: m,
|
|
65
|
+
actions: C,
|
|
66
|
+
placement: y
|
|
67
|
+
}) => {
|
|
68
|
+
const { pdfViewer: p } = Q(), g = Ge(y);
|
|
69
|
+
return /* @__PURE__ */ P(
|
|
70
|
+
"div",
|
|
71
|
+
{
|
|
72
|
+
ref: e,
|
|
73
|
+
role: "toolbar",
|
|
74
|
+
"aria-label": p.toolbar,
|
|
75
|
+
"data-placement": y,
|
|
76
|
+
className: Ae(y),
|
|
77
|
+
children: [
|
|
78
|
+
i ? /* @__PURE__ */ P(
|
|
79
|
+
"span",
|
|
80
|
+
{
|
|
81
|
+
"aria-live": "polite",
|
|
82
|
+
className: I(
|
|
83
|
+
"whitespace-nowrap text-sm font-medium",
|
|
84
|
+
y === "top" ? "text-f1-foreground-secondary" : "pl-2 text-f1-foreground-inverse"
|
|
85
|
+
),
|
|
86
|
+
children: [
|
|
87
|
+
t,
|
|
88
|
+
" / ",
|
|
89
|
+
o
|
|
90
|
+
]
|
|
91
|
+
}
|
|
92
|
+
) : null,
|
|
93
|
+
/* @__PURE__ */ P("div", { className: g, children: [
|
|
94
|
+
/* @__PURE__ */ n(
|
|
95
|
+
N,
|
|
96
|
+
{
|
|
97
|
+
label: p.previousPage,
|
|
98
|
+
onClick: c,
|
|
99
|
+
icon: Ce,
|
|
100
|
+
size: "sm"
|
|
101
|
+
}
|
|
102
|
+
),
|
|
103
|
+
/* @__PURE__ */ n(
|
|
104
|
+
N,
|
|
105
|
+
{
|
|
106
|
+
label: p.nextPage,
|
|
107
|
+
onClick: h,
|
|
108
|
+
icon: Fe,
|
|
109
|
+
size: "sm"
|
|
110
|
+
}
|
|
111
|
+
)
|
|
112
|
+
] }),
|
|
113
|
+
/* @__PURE__ */ P("div", { className: g, children: [
|
|
114
|
+
/* @__PURE__ */ n(
|
|
115
|
+
N,
|
|
116
|
+
{
|
|
117
|
+
label: p.zoomOut,
|
|
118
|
+
onClick: b,
|
|
119
|
+
icon: Le
|
|
120
|
+
}
|
|
121
|
+
),
|
|
122
|
+
/* @__PURE__ */ n(
|
|
123
|
+
N,
|
|
124
|
+
{
|
|
125
|
+
label: p.zoomIn,
|
|
126
|
+
onClick: u,
|
|
127
|
+
icon: De
|
|
128
|
+
}
|
|
129
|
+
),
|
|
130
|
+
/* @__PURE__ */ n(
|
|
131
|
+
Ve,
|
|
132
|
+
{
|
|
133
|
+
hideLabel: !0,
|
|
134
|
+
label: p.scaleSelector,
|
|
135
|
+
options: s,
|
|
136
|
+
value: l,
|
|
137
|
+
onChange: (R) => _(R)
|
|
138
|
+
}
|
|
139
|
+
)
|
|
140
|
+
] }),
|
|
141
|
+
/* @__PURE__ */ P("div", { className: g, children: [
|
|
142
|
+
v ? /* @__PURE__ */ n(
|
|
143
|
+
N,
|
|
144
|
+
{
|
|
145
|
+
label: p.rotate,
|
|
146
|
+
onClick: x,
|
|
147
|
+
icon: Te
|
|
148
|
+
}
|
|
149
|
+
) : null,
|
|
150
|
+
/* @__PURE__ */ n(
|
|
151
|
+
N,
|
|
152
|
+
{
|
|
153
|
+
label: p.print,
|
|
154
|
+
onClick: U,
|
|
155
|
+
icon: ze
|
|
156
|
+
}
|
|
157
|
+
),
|
|
158
|
+
/* @__PURE__ */ n(
|
|
159
|
+
N,
|
|
160
|
+
{
|
|
161
|
+
label: p.download,
|
|
162
|
+
onClick: m,
|
|
163
|
+
icon: He
|
|
164
|
+
}
|
|
165
|
+
),
|
|
166
|
+
C?.map((R, S) => /* @__PURE__ */ n(
|
|
167
|
+
N,
|
|
168
|
+
{
|
|
169
|
+
label: R.label,
|
|
170
|
+
onClick: R.onClick,
|
|
171
|
+
icon: R.icon
|
|
172
|
+
},
|
|
173
|
+
`${R.label}-${S}`
|
|
174
|
+
))
|
|
175
|
+
] })
|
|
176
|
+
]
|
|
177
|
+
}
|
|
178
|
+
);
|
|
179
|
+
}, qe = (e, t) => t ? (Math.round(t * e) + 1e-3) / t : e, Ze = (e, t = window.devicePixelRatio || 1) => {
|
|
180
|
+
!e || e.width === 0 || e.height === 0 || (e.style.width = `${e.width / t}px`, e.style.height = `${e.height / t}px`);
|
|
181
|
+
}, ce = async (e) => {
|
|
182
|
+
const t = await e.saveDocument();
|
|
183
|
+
return new Blob([new Uint8Array(t)], { type: "application/pdf" });
|
|
184
|
+
}, Je = async (e) => {
|
|
185
|
+
if (!e)
|
|
186
|
+
return;
|
|
187
|
+
const t = URL.createObjectURL(await ce(e)), o = document.createElement("iframe");
|
|
188
|
+
o.style.display = "none", o.src = t, o.onload = () => {
|
|
189
|
+
o.focus(), o.contentWindow?.print();
|
|
190
|
+
const i = () => {
|
|
191
|
+
URL.revokeObjectURL(t), o.remove();
|
|
192
|
+
};
|
|
193
|
+
o.contentWindow?.addEventListener("afterprint", i), setTimeout(i, 6e4);
|
|
194
|
+
}, document.body.appendChild(o);
|
|
195
|
+
}, Ke = async (e, t) => {
|
|
196
|
+
if (!e)
|
|
197
|
+
return;
|
|
198
|
+
const o = URL.createObjectURL(await ce(e)), i = document.createElement("a");
|
|
199
|
+
i.href = o, i.download = t.length > 0 ? t : "document.pdf", document.body.appendChild(i), i.click(), i.remove(), URL.revokeObjectURL(o);
|
|
200
|
+
}, ut = async (e, t, o = !0) => {
|
|
201
|
+
let i = e, l;
|
|
202
|
+
try {
|
|
203
|
+
const c = await fetch(e, {
|
|
204
|
+
credentials: o ? "include" : "same-origin"
|
|
205
|
+
});
|
|
206
|
+
if (!c.ok)
|
|
207
|
+
throw new Error(`${c.status}`);
|
|
208
|
+
l = URL.createObjectURL(await c.blob()), i = l;
|
|
209
|
+
} catch {
|
|
210
|
+
}
|
|
211
|
+
const s = document.createElement("a");
|
|
212
|
+
s.href = i, s.download = t ?? "", s.rel = "noreferrer", l || (s.target = "_blank"), document.body.appendChild(s), s.click(), s.remove(), l && URL.revokeObjectURL(l);
|
|
213
|
+
}, K = [
|
|
214
|
+
"0.5",
|
|
215
|
+
"0.75",
|
|
216
|
+
"1",
|
|
217
|
+
"1.25",
|
|
218
|
+
"1.5",
|
|
219
|
+
"2",
|
|
220
|
+
"3",
|
|
221
|
+
"4"
|
|
222
|
+
], de = K.map(Number), Qe = (e) => de.find((t) => t > e), Xe = (e) => [...de].reverse().find((t) => t < e), Ye = (e, t, o) => {
|
|
223
|
+
let i = null, l = 0;
|
|
224
|
+
return t.forEach((s, c) => {
|
|
225
|
+
if (!s)
|
|
226
|
+
return;
|
|
227
|
+
const h = s.offsetHeight, u = s.offsetTop, b = u + h, _ = e.offsetHeight - o, v = e.scrollTop + o, x = v + _;
|
|
228
|
+
if (!(v < b && x > u))
|
|
229
|
+
return;
|
|
230
|
+
let m;
|
|
231
|
+
if (v <= u)
|
|
232
|
+
m = x > b ? h : x - u;
|
|
233
|
+
else {
|
|
234
|
+
let C = v - u;
|
|
235
|
+
x < b && (C += b - x), m = h - C;
|
|
236
|
+
}
|
|
237
|
+
m > l && (l = m, i = c + 1);
|
|
238
|
+
}), i;
|
|
239
|
+
};
|
|
240
|
+
Oe();
|
|
241
|
+
const et = X(() => import("./SheetViewer-CPfuzHpV.js")), tt = X(() => import("./DocxViewer-BVpuMNRK.js")), ot = X(() => import("./TextViewer-B3Ywj3cq.js")), le = 48, fe = se((e, t) => {
|
|
242
|
+
const { kind: o = "pdf", mimeType: i, toolbar: l = "top", ...s } = e;
|
|
243
|
+
if (o === "pdf")
|
|
244
|
+
return /* @__PURE__ */ n(ue, { ref: t, toolbar: l, ...s });
|
|
245
|
+
const {
|
|
246
|
+
url: c,
|
|
247
|
+
filename: h,
|
|
248
|
+
actions: u,
|
|
249
|
+
withCredentials: b = !0,
|
|
250
|
+
page: _,
|
|
251
|
+
pagesToDisplay: v,
|
|
252
|
+
initialScale: x,
|
|
253
|
+
rotatable: U,
|
|
254
|
+
initialRotation: m,
|
|
255
|
+
onRotationChange: C,
|
|
256
|
+
onPdfLoaded: y,
|
|
257
|
+
onPageChange: p,
|
|
258
|
+
...g
|
|
259
|
+
} = s;
|
|
260
|
+
return /* @__PURE__ */ n(
|
|
261
|
+
"div",
|
|
262
|
+
{
|
|
263
|
+
ref: t,
|
|
264
|
+
...g,
|
|
265
|
+
className: "F0DocumentViewer__surface relative flex h-full w-full flex-col overflow-hidden border border-solid border-f1-border-secondary",
|
|
266
|
+
children: /* @__PURE__ */ P(je, { fallback: /* @__PURE__ */ n(V, { className: "h-full w-full rounded-none" }), children: [
|
|
267
|
+
o === "sheet" ? /* @__PURE__ */ n(
|
|
268
|
+
et,
|
|
269
|
+
{
|
|
270
|
+
url: c,
|
|
271
|
+
filename: h,
|
|
272
|
+
withCredentials: b,
|
|
273
|
+
actions: u,
|
|
274
|
+
toolbar: l
|
|
275
|
+
}
|
|
276
|
+
) : null,
|
|
277
|
+
o === "docx" ? /* @__PURE__ */ n(
|
|
278
|
+
tt,
|
|
279
|
+
{
|
|
280
|
+
url: c,
|
|
281
|
+
filename: h,
|
|
282
|
+
withCredentials: b,
|
|
283
|
+
actions: u,
|
|
284
|
+
toolbar: l
|
|
285
|
+
}
|
|
286
|
+
) : null,
|
|
287
|
+
o === "text" ? /* @__PURE__ */ n(
|
|
288
|
+
ot,
|
|
289
|
+
{
|
|
290
|
+
url: c,
|
|
291
|
+
name: h ?? "",
|
|
292
|
+
mimeType: i,
|
|
293
|
+
withCredentials: b,
|
|
294
|
+
actions: u,
|
|
295
|
+
toolbar: l
|
|
296
|
+
}
|
|
297
|
+
) : null
|
|
298
|
+
] })
|
|
299
|
+
}
|
|
300
|
+
);
|
|
301
|
+
});
|
|
302
|
+
fe.displayName = "F0DocumentViewer";
|
|
303
|
+
const ue = se((e, t) => {
|
|
304
|
+
const {
|
|
305
|
+
url: o,
|
|
306
|
+
filename: i = "document.pdf",
|
|
307
|
+
page: l = 0,
|
|
308
|
+
pagesToDisplay: s = [],
|
|
309
|
+
initialScale: c = "page-width",
|
|
310
|
+
withCredentials: h = !0,
|
|
311
|
+
rotatable: u = !1,
|
|
312
|
+
initialRotation: b = 0,
|
|
313
|
+
onRotationChange: _,
|
|
314
|
+
onPdfLoaded: v,
|
|
315
|
+
onPageChange: x,
|
|
316
|
+
actions: U,
|
|
317
|
+
toolbar: m = "top",
|
|
318
|
+
...C
|
|
319
|
+
} = e, { pdfViewer: y } = Q(), p = Math.max(
|
|
320
|
+
2,
|
|
321
|
+
typeof window > "u" ? 1 : window.devicePixelRatio || 1
|
|
322
|
+
), [g, R] = H(null), [S, Y] = H([]), [F, A] = H(1), [k, ee] = H(0), [j, G] = H(c), [L, pe] = H(b), q = J(null), Z = J(null), W = J([]), O = s.length > 0 ? s.length : g?.numPages, $ = w(
|
|
323
|
+
() => m === "top" ? Z.current?.offsetHeight ?? 0 : 0,
|
|
324
|
+
[m]
|
|
325
|
+
), te = S.find(Boolean), oe = (te?.originalWidth ?? 595) * F, ne = (te?.originalHeight ?? 842) * F, ge = re(
|
|
326
|
+
() => [
|
|
327
|
+
{ value: "page-width", label: y.pageWidth },
|
|
328
|
+
{ value: "page-fit", label: y.pageFit },
|
|
329
|
+
...K.map((a) => ({
|
|
330
|
+
value: a,
|
|
331
|
+
label: `${Number(a) * 100}%`
|
|
332
|
+
}))
|
|
333
|
+
],
|
|
334
|
+
[y.pageWidth, y.pageFit]
|
|
335
|
+
), he = re(() => ({ url: o, withCredentials: h }), [o, h]), T = w(
|
|
336
|
+
(a) => {
|
|
337
|
+
const r = (O ?? 1) - 1, d = Math.min(Math.max(a, 0), r), f = W.current[d], D = f?.offsetParent;
|
|
338
|
+
f && D instanceof HTMLElement && (D.scrollTop = f.offsetTop - $() - 10);
|
|
339
|
+
},
|
|
340
|
+
[O, $]
|
|
341
|
+
), B = w(
|
|
342
|
+
(a) => {
|
|
343
|
+
const r = S[k - 1], d = q.current;
|
|
344
|
+
if (!r || !d)
|
|
345
|
+
return;
|
|
346
|
+
const f = Z.current?.offsetHeight ?? 0, D = L === 90 || L === 270, z = D ? r.originalHeight : r.originalWidth, ke = D ? r.originalWidth : r.originalHeight, Ne = a === "page-width" ? (d.clientWidth - le) / z : (d.clientHeight - f - le) / ke;
|
|
347
|
+
A(Ne), G(a);
|
|
348
|
+
},
|
|
349
|
+
[S, k, L]
|
|
350
|
+
), be = w(
|
|
351
|
+
(a) => {
|
|
352
|
+
if (a === "page-width" || a === "page-fit") {
|
|
353
|
+
B(a);
|
|
354
|
+
return;
|
|
355
|
+
}
|
|
356
|
+
A(Number(a)), G(a);
|
|
357
|
+
},
|
|
358
|
+
[B]
|
|
359
|
+
), M = w((a) => {
|
|
360
|
+
if (a === void 0)
|
|
361
|
+
return;
|
|
362
|
+
A(a);
|
|
363
|
+
const r = K.find((d) => Number(d) === a);
|
|
364
|
+
r && G(r);
|
|
365
|
+
}, []), we = w(
|
|
366
|
+
() => M(Qe(F)),
|
|
367
|
+
[F, M]
|
|
368
|
+
), xe = w(
|
|
369
|
+
() => M(Xe(F)),
|
|
370
|
+
[F, M]
|
|
371
|
+
), ye = w(() => {
|
|
372
|
+
pe((a) => {
|
|
373
|
+
const r = (a + 90) % 360;
|
|
374
|
+
return _?.(r), r;
|
|
375
|
+
});
|
|
376
|
+
}, [_]), ve = w(
|
|
377
|
+
(a) => {
|
|
378
|
+
R(a), v?.(a), setTimeout(() => {
|
|
379
|
+
ee(l + 1), T(l);
|
|
380
|
+
}, 0);
|
|
381
|
+
},
|
|
382
|
+
[v, l, T]
|
|
383
|
+
), Pe = w(
|
|
384
|
+
(a) => {
|
|
385
|
+
const r = a.target;
|
|
386
|
+
if (!(r instanceof HTMLElement))
|
|
387
|
+
return;
|
|
388
|
+
const d = Ye(
|
|
389
|
+
r,
|
|
390
|
+
W.current,
|
|
391
|
+
$()
|
|
392
|
+
);
|
|
393
|
+
d && ee(d);
|
|
394
|
+
},
|
|
395
|
+
[$]
|
|
396
|
+
), Re = w(() => {
|
|
397
|
+
Je(g);
|
|
398
|
+
}, [g]), Se = w(() => {
|
|
399
|
+
Ke(g, i);
|
|
400
|
+
}, [g, i]);
|
|
401
|
+
E(() => {
|
|
402
|
+
R(null), Y([]), W.current = [];
|
|
403
|
+
}, [o]), E(() => {
|
|
404
|
+
T(l);
|
|
405
|
+
}, [l, T]), E(() => {
|
|
406
|
+
k > 0 && x?.(k);
|
|
407
|
+
}, [k, x]), E(() => {
|
|
408
|
+
S.length > 0 && (c === "page-width" || c === "page-fit") && B(c);
|
|
409
|
+
}, [S.length, c]), E(() => {
|
|
410
|
+
(j === "page-width" || j === "page-fit") && B(j);
|
|
411
|
+
}, [L]), E(() => {
|
|
412
|
+
const a = q.current;
|
|
413
|
+
if (!a)
|
|
414
|
+
return;
|
|
415
|
+
const r = (d) => {
|
|
416
|
+
const f = d.target;
|
|
417
|
+
f instanceof HTMLAnchorElement && (f.target = "_blank", f.rel = "noopener noreferrer");
|
|
418
|
+
};
|
|
419
|
+
return a.addEventListener("click", r, !0), () => a.removeEventListener("click", r, !0);
|
|
420
|
+
}, []);
|
|
421
|
+
const ae = {
|
|
422
|
+
toolbarRef: Z,
|
|
423
|
+
placement: m,
|
|
424
|
+
currentPage: k,
|
|
425
|
+
totalPages: O,
|
|
426
|
+
hasDocument: !!g?.numPages,
|
|
427
|
+
selectedScale: j,
|
|
428
|
+
scaleOptions: ge,
|
|
429
|
+
onPreviousPage: () => T(k - 2),
|
|
430
|
+
onNextPage: () => T(k),
|
|
431
|
+
onZoomIn: we,
|
|
432
|
+
onZoomOut: xe,
|
|
433
|
+
onScaleChange: be,
|
|
434
|
+
rotatable: u,
|
|
435
|
+
onRotate: ye,
|
|
436
|
+
onPrint: Re,
|
|
437
|
+
onDownload: Se,
|
|
438
|
+
actions: U
|
|
439
|
+
};
|
|
440
|
+
return /* @__PURE__ */ P(
|
|
441
|
+
"div",
|
|
442
|
+
{
|
|
443
|
+
ref: t,
|
|
444
|
+
...C,
|
|
445
|
+
className: "F0DocumentViewer__surface relative flex h-full w-full flex-col overflow-hidden border border-solid border-f1-border-secondary",
|
|
446
|
+
children: [
|
|
447
|
+
/* @__PURE__ */ P(
|
|
448
|
+
"div",
|
|
449
|
+
{
|
|
450
|
+
ref: q,
|
|
451
|
+
onScroll: Pe,
|
|
452
|
+
className: "F0DocumentViewer__surface relative flex h-full flex-col overflow-auto [scrollbar-gutter:stable_both-edges]",
|
|
453
|
+
children: [
|
|
454
|
+
m === "top" ? /* @__PURE__ */ n(ie, { ...ae }) : null,
|
|
455
|
+
o ? /* @__PURE__ */ n(
|
|
456
|
+
$e,
|
|
457
|
+
{
|
|
458
|
+
file: he,
|
|
459
|
+
onLoadSuccess: ve,
|
|
460
|
+
loading: /* @__PURE__ */ n(
|
|
461
|
+
Ie,
|
|
462
|
+
{
|
|
463
|
+
label: y.loading,
|
|
464
|
+
width: oe,
|
|
465
|
+
height: ne
|
|
466
|
+
}
|
|
467
|
+
),
|
|
468
|
+
children: g ? Array.from({ length: O ?? 0 }).map((a, r) => {
|
|
469
|
+
const d = (s.length > 0 ? s[r] : r) + 1;
|
|
470
|
+
return /* @__PURE__ */ n(
|
|
471
|
+
"div",
|
|
472
|
+
{
|
|
473
|
+
className: "F0DocumentViewer__page mx-auto w-fit px-4 pt-4 last:pb-4",
|
|
474
|
+
children: /* @__PURE__ */ n(
|
|
475
|
+
Be,
|
|
476
|
+
{
|
|
477
|
+
className: "overflow-hidden rounded-lg border border-solid border-f1-border-secondary shadow-md",
|
|
478
|
+
pageNumber: d,
|
|
479
|
+
scale: qe(
|
|
480
|
+
F,
|
|
481
|
+
L === 90 || L === 270 ? S[r]?.originalHeight : S[r]?.originalWidth
|
|
482
|
+
),
|
|
483
|
+
rotate: L,
|
|
484
|
+
devicePixelRatio: p,
|
|
485
|
+
loading: /* @__PURE__ */ n(
|
|
486
|
+
V,
|
|
487
|
+
{
|
|
488
|
+
style: {
|
|
489
|
+
width: oe,
|
|
490
|
+
height: ne
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
),
|
|
494
|
+
renderForms: !0,
|
|
495
|
+
renderTextLayer: !0,
|
|
496
|
+
inputRef: (f) => {
|
|
497
|
+
W.current[r] = f;
|
|
498
|
+
},
|
|
499
|
+
onRenderSuccess: () => Ze(
|
|
500
|
+
W.current[r]?.querySelector(
|
|
501
|
+
"canvas"
|
|
502
|
+
),
|
|
503
|
+
p
|
|
504
|
+
),
|
|
505
|
+
onLoadSuccess: (f) => {
|
|
506
|
+
Y((D) => {
|
|
507
|
+
const z = [...D];
|
|
508
|
+
return z[r] = {
|
|
509
|
+
originalWidth: f.originalWidth,
|
|
510
|
+
originalHeight: f.originalHeight
|
|
511
|
+
}, z;
|
|
512
|
+
});
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
)
|
|
516
|
+
},
|
|
517
|
+
r
|
|
518
|
+
);
|
|
519
|
+
}) : null
|
|
520
|
+
}
|
|
521
|
+
) : null
|
|
522
|
+
]
|
|
523
|
+
}
|
|
524
|
+
),
|
|
525
|
+
m === "floating" ? /* @__PURE__ */ n(ie, { ...ae }) : null
|
|
526
|
+
]
|
|
527
|
+
}
|
|
528
|
+
);
|
|
529
|
+
});
|
|
530
|
+
ue.displayName = "PdfViewerBase";
|
|
531
|
+
const nt = () => {
|
|
532
|
+
const { pdfViewer: e } = Q();
|
|
533
|
+
return /* @__PURE__ */ P(
|
|
534
|
+
"div",
|
|
535
|
+
{
|
|
536
|
+
role: "status",
|
|
537
|
+
"aria-busy": "true",
|
|
538
|
+
"aria-live": "polite",
|
|
539
|
+
"aria-label": e.loading,
|
|
540
|
+
className: I(
|
|
541
|
+
"F0DocumentViewer__surface flex h-full w-full flex-col overflow-hidden",
|
|
542
|
+
"border border-solid border-f1-border-secondary"
|
|
543
|
+
),
|
|
544
|
+
children: [
|
|
545
|
+
/* @__PURE__ */ P("div", { className: "flex flex-row items-center justify-between gap-2 px-6 py-4", children: [
|
|
546
|
+
/* @__PURE__ */ n(V, { className: "h-8 w-24 rounded-md" }),
|
|
547
|
+
/* @__PURE__ */ n(V, { className: "h-8 w-40 rounded-md" }),
|
|
548
|
+
/* @__PURE__ */ n(V, { className: "h-8 w-20 rounded-md" })
|
|
549
|
+
] }),
|
|
550
|
+
/* @__PURE__ */ n("div", { className: "flex flex-1 justify-center p-4", children: /* @__PURE__ */ n(V, { className: "h-full w-full max-w-[600px] rounded-md" }) })
|
|
551
|
+
]
|
|
552
|
+
}
|
|
553
|
+
);
|
|
554
|
+
}, at = [
|
|
555
|
+
"page-width",
|
|
556
|
+
"page-fit",
|
|
557
|
+
"0.5",
|
|
558
|
+
"0.75",
|
|
559
|
+
"1",
|
|
560
|
+
"1.25",
|
|
561
|
+
"1.5",
|
|
562
|
+
"2",
|
|
563
|
+
"3",
|
|
564
|
+
"4"
|
|
565
|
+
], me = Ee(
|
|
566
|
+
Ue(
|
|
567
|
+
"F0DocumentViewer",
|
|
568
|
+
We(fe, nt)
|
|
569
|
+
)
|
|
570
|
+
), rt = me, mt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
571
|
+
__proto__: null,
|
|
572
|
+
F0DocumentViewer: me,
|
|
573
|
+
F0PdfViewer: rt,
|
|
574
|
+
configurePdfWorker: Me,
|
|
575
|
+
pdfScales: at
|
|
576
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
577
|
+
export {
|
|
578
|
+
me as F,
|
|
579
|
+
N as T,
|
|
580
|
+
Xe as a,
|
|
581
|
+
Ge as b,
|
|
582
|
+
rt as c,
|
|
583
|
+
ut as d,
|
|
584
|
+
K as f,
|
|
585
|
+
mt as i,
|
|
586
|
+
Qe as n,
|
|
587
|
+
at as p,
|
|
588
|
+
Ae as t
|
|
589
|
+
};
|
package/dist/index2.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
.F0DocumentViewer__surface{background-color:hsl(var(--neutral-0));background-image:linear-gradient(hsl(var(--neutral-5)),hsl(var(--neutral-5)))}.F0DocumentViewer__page .react-pdf__Page__canvas{display:block;position:relative;z-index:0}.F0DocumentViewer__page .react-pdf__Page__textContent{z-index:1;pointer-events:auto;-webkit-user-select:text;-moz-user-select:text;user-select:text}.F0DocumentViewer__page .textLayer ::-moz-selection{color:transparent;background-color:hsl(var(--selected-50) / .3)}.F0DocumentViewer__page .textLayer ::selection{color:transparent;background-color:hsl(var(--selected-50) / .3)}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { createContext, useReducer, forwardRef, useRef, useImperativeHandle, useEffect, useCallback, useMemo, useContext, useLayoutEffect } from "react";
|
|
3
3
|
import { e as clsx } from "./tooltip-CrXp1Uaz.js";
|
|
4
|
-
import { aj as invariant } from "./F0CanvasPanel-
|
|
5
|
-
import { f as dequal } from "./MapProvider-
|
|
4
|
+
import { aj as invariant } from "./F0CanvasPanel-rSEKuj9G.js";
|
|
5
|
+
import { f as dequal } from "./MapProvider-C-6QmLYm.js";
|
|
6
6
|
import { a as getAugmentedNamespace, g as getDefaultExportFromCjs } from "./_commonjsHelpers-ByX85dGu.js";
|
|
7
7
|
import { c as commonjsRequire } from "./_commonjs-dynamic-modules-BpilXLfW.js";
|
|
8
8
|
import './pdfWorker.css';var pdf$1 = { exports: {} };
|