@pi-outpost/embed 0.23.1 → 0.25.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.
@@ -1,4 +1,5 @@
1
- import { n as e, s as t, t as n } from "./findInPage-BtPAvay_.js";
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(e, n, r, i) {
68
- let a = await fetch(t(e, n, null, i), { headers: r ? { Authorization: `Bearer ${r}` } : {} });
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: t, serverUrl: n = "", token: r = null, revision: l = 0, onLoaded: f, findQuery: g = "", onFindStateChange: y }, b) {
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((t, n) => {
207
+ }, []), Z = i((e, n) => {
207
208
  X();
208
- let r = e(n, Y.current);
209
+ let r = t(n, Y.current);
209
210
  K.current = {
210
- page: t.page,
211
+ page: e.page,
211
212
  result: r
212
213
  };
213
- let i = r.matches[t.ordinalOnPage]?.marks ?? [];
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 e = !1, i = null;
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, t, r, l));
230
- if (i = o, e) {
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 t = (await a.getPage(1)).getViewport({ scale: 1 });
236
- e || j({
237
- width: t.width,
238
- height: t.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
- e || j({
242
+ t || j({
242
243
  width: 612,
243
244
  height: 792
244
245
  });
245
246
  }
246
- if (e) return;
247
- S(a), f?.(t);
248
- } catch (t) {
249
- e || T(te(t) ? t : { kind: "unreadable" });
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
- e = !0, i?.destroy().catch(() => {});
253
+ t = !0, i?.destroy().catch(() => {});
253
254
  };
254
255
  }, [
255
- t,
256
+ e,
256
257
  n,
257
258
  r,
258
259
  l