@pi-outpost/embed 0.23.1 → 0.24.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/{PdfViewer-D5anbvST.js → PdfViewer-CDo7oG-p.js} +23 -22
- package/dist/PdfViewer-DJJoRd17.cjs +1 -0
- package/dist/docxExport-Ct9-zCCP.cjs +283 -0
- package/dist/{docxExport-BO9Dyd6M.js → docxExport-_j7ragkM.js} +3208 -3035
- package/dist/findInPage-0EBwjKZe.cjs +1 -0
- package/dist/findInPage-xFP831JH.js +67 -0
- package/dist/pi-outpost-embed.cjs +59 -59
- package/dist/pi-outpost-embed.js +45 -39
- package/dist/workspacePath-CfDl0V4n.js +24 -0
- package/dist/workspacePath-EgAFT36l.cjs +1 -0
- package/package.json +1 -1
- package/dist/PdfViewer-Cqn4OIhw.cjs +0 -1
- package/dist/docxExport-B5U9ZQcd.cjs +0 -283
- package/dist/findInPage-BtPAvay_.js +0 -89
- package/dist/findInPage-CTLp-wZT.cjs +0 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as e } from "./workspacePath-CfDl0V4n.js";
|
|
2
|
+
import { n as t, t as n } from "./findInPage-xFP831JH.js";
|
|
2
3
|
import { forwardRef as r, useCallback as i, useEffect as a, useImperativeHandle as o, useRef as s, useState as c } from "react";
|
|
3
4
|
import { Fragment as l, jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
4
5
|
//#region ../ui/src/util/pdfFindIndex.ts
|
|
@@ -64,8 +65,8 @@ function _(e) {
|
|
|
64
65
|
case "unreadable": return "This file could not be read as a PDF.";
|
|
65
66
|
}
|
|
66
67
|
}
|
|
67
|
-
async function v(
|
|
68
|
-
let a = await fetch(t
|
|
68
|
+
async function v(t, n, r, i) {
|
|
69
|
+
let a = await fetch(e(t, n, null, i), { headers: r ? { Authorization: `Bearer ${r}` } : {} });
|
|
69
70
|
if (!a.ok) {
|
|
70
71
|
if (a.status === 413) {
|
|
71
72
|
let e = await a.json().catch(() => ({}));
|
|
@@ -192,7 +193,7 @@ function ne({ doc: e, pageNumber: t, scale: n, baseSize: r, active: i, registerS
|
|
|
192
193
|
})] }) : null
|
|
193
194
|
});
|
|
194
195
|
}
|
|
195
|
-
var w = r(function({ path:
|
|
196
|
+
var w = r(function({ path: e, serverUrl: n = "", token: r = null, revision: l = 0, onLoaded: f, findQuery: g = "", onFindStateChange: y }, b) {
|
|
196
197
|
let [x, S] = c(null), [w, T] = c(null), [E, D] = c(1), [O, k] = c(2), [A, j] = c(null), M = s(null), N = s(/* @__PURE__ */ new Map()), [P, F] = c(/* @__PURE__ */ new Map()), [I, L] = c(!1), [R, z] = c([]), [B, V] = c(-1), H = s(null), U = s(!1), W = s(g), G = s(/* @__PURE__ */ new Map()), K = s(null), q = s([]), J = s(-1), Y = s(g);
|
|
197
198
|
a(() => {
|
|
198
199
|
q.current = R;
|
|
@@ -203,14 +204,14 @@ var w = r(function({ path: t, serverUrl: n = "", token: r = null, revision: l =
|
|
|
203
204
|
}, [g]);
|
|
204
205
|
let X = i(() => {
|
|
205
206
|
K.current?.result.clear(), K.current = null;
|
|
206
|
-
}, []), Z = i((
|
|
207
|
+
}, []), Z = i((e, n) => {
|
|
207
208
|
X();
|
|
208
|
-
let r =
|
|
209
|
+
let r = t(n, Y.current);
|
|
209
210
|
K.current = {
|
|
210
|
-
page:
|
|
211
|
+
page: e.page,
|
|
211
212
|
result: r
|
|
212
213
|
};
|
|
213
|
-
let i = r.matches[
|
|
214
|
+
let i = r.matches[e.ordinalOnPage]?.marks ?? [];
|
|
214
215
|
for (let e of i) e.classList.add("find-match-current");
|
|
215
216
|
i[0]?.scrollIntoView({ block: "center" });
|
|
216
217
|
}, [X]), re = i((e, t) => {
|
|
@@ -223,36 +224,36 @@ var w = r(function({ path: t, serverUrl: n = "", token: r = null, revision: l =
|
|
|
223
224
|
n !== void 0 && n.page === e && Z(n, t);
|
|
224
225
|
}, [Z]);
|
|
225
226
|
a(() => {
|
|
226
|
-
let
|
|
227
|
+
let t = !1, i = null;
|
|
227
228
|
return S(null), T(null), D(1), j(null), H.current?.cancel(), H.current = null, U.current = !1, F(/* @__PURE__ */ new Map()), L(!1), z([]), V(-1), X(), G.current.clear(), (async () => {
|
|
228
229
|
try {
|
|
229
|
-
let { doc: a, task: o } = await ee(await v(n,
|
|
230
|
-
if (i = o,
|
|
230
|
+
let { doc: a, task: o } = await ee(await v(n, e, r, l));
|
|
231
|
+
if (i = o, t) {
|
|
231
232
|
await o.destroy().catch(() => {});
|
|
232
233
|
return;
|
|
233
234
|
}
|
|
234
235
|
try {
|
|
235
|
-
let
|
|
236
|
-
|
|
237
|
-
width:
|
|
238
|
-
height:
|
|
236
|
+
let e = (await a.getPage(1)).getViewport({ scale: 1 });
|
|
237
|
+
t || j({
|
|
238
|
+
width: e.width,
|
|
239
|
+
height: e.height
|
|
239
240
|
});
|
|
240
241
|
} catch {
|
|
241
|
-
|
|
242
|
+
t || j({
|
|
242
243
|
width: 612,
|
|
243
244
|
height: 792
|
|
244
245
|
});
|
|
245
246
|
}
|
|
246
|
-
if (
|
|
247
|
-
S(a), f?.(
|
|
248
|
-
} catch (
|
|
249
|
-
|
|
247
|
+
if (t) return;
|
|
248
|
+
S(a), f?.(e);
|
|
249
|
+
} catch (e) {
|
|
250
|
+
t || T(te(e) ? e : { kind: "unreadable" });
|
|
250
251
|
}
|
|
251
252
|
})(), () => {
|
|
252
|
-
|
|
253
|
+
t = !0, i?.destroy().catch(() => {});
|
|
253
254
|
};
|
|
254
255
|
}, [
|
|
255
|
-
|
|
256
|
+
e,
|
|
256
257
|
n,
|
|
257
258
|
r,
|
|
258
259
|
l
|