@pi-outpost/embed 0.54.0 → 0.56.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/README.md +1 -1
- package/dist/{CodeEditor-Dei7wUOV.js → CodeEditor-C2mtBAxz.js} +21 -21
- package/dist/{CodeEditor-CIWnYOMo.cjs → CodeEditor-CHKp59kP.cjs} +3 -3
- package/dist/{PdfViewer-HG_qT5b4.js → PdfViewer-DOE0n8FV.js} +94 -73
- package/dist/{PdfViewer-CCav_nmm.cjs → PdfViewer-SiwxJfzA.cjs} +1 -1
- package/dist/{conversationExport-CPhTW6Ko.cjs → conversationExport-CE0UTxEg.cjs} +2 -2
- package/dist/{conversationExport-BlW4R5hL.js → conversationExport-DojQkOLk.js} +45 -45
- package/dist/conversationHistory-DdjP3rjR.cjs +537 -0
- package/dist/{conversationHistory-wmxP-e7h.js → conversationHistory-g6h0_Fjx.js} +21044 -17852
- package/dist/{dist-CUml8Wzk.js → dist-B9wvGgxB.js} +1 -1
- package/dist/{dist-BB8DIy0-.cjs → dist-BMzIUMhf.cjs} +1 -1
- package/dist/{dist-DU0BjKn0.cjs → dist-BawiB8yE.cjs} +1 -1
- package/dist/{dist-BXKM-sMu.cjs → dist-BjxwUutQ.cjs} +1 -1
- package/dist/{dist-CuX47mx0.js → dist-Bk3hLKgL.js} +1 -1
- package/dist/{dist-CqvTKR3J.cjs → dist-Bnsp4Y3i.cjs} +1 -1
- package/dist/{dist-0gxsdPHi.cjs → dist-CM2l_BHt.cjs} +1 -1
- package/dist/{dist-CDuDYc3h.js → dist-CvxwObne.js} +1 -1
- package/dist/{dist-BhRuhsmx.js → dist-DUziszL2.js} +1 -1
- package/dist/{dist-DNzYo4it.cjs → dist-F6qtkv2Q.cjs} +1 -1
- package/dist/{dist-CV2qXUTt.js → dist-LBUs7dVk.js} +1 -1
- package/dist/{dist-Ccs3Mpvk.js → dist-VWDOErn8.js} +1 -1
- package/dist/{dist-BAXGE-5E.cjs → dist-kpPXlS4A.cjs} +1 -1
- package/dist/{dist-Bt2YslBF.js → dist-nQ2aeIgK.js} +2 -2
- package/dist/pi-outpost-embed.cjs +36 -33
- package/dist/pi-outpost-embed.js +3328 -2858
- package/package.json +1 -1
- package/dist/conversationHistory-DVdpMO_m.cjs +0 -424
|
@@ -193,39 +193,41 @@ function ne({ doc: e, pageNumber: t, scale: n, baseSize: r, active: i, registerS
|
|
|
193
193
|
})] }) : null
|
|
194
194
|
});
|
|
195
195
|
}
|
|
196
|
-
var w = r(function({ path: e, serverUrl: n = "", token: r = null, workspace: l, revision: f = 0, onLoaded: g, findQuery: y = "", onFindStateChange: b },
|
|
197
|
-
let [
|
|
196
|
+
var w = r(function({ path: e, serverUrl: n = "", token: r = null, workspace: l, revision: f = 0, onLoaded: g, findQuery: y = "", onFindStateChange: b, startAt: x }, S) {
|
|
197
|
+
let [w, re] = c(null), [ie, ae] = c(null), [T, E] = c(1), [D, O] = c(2), [k, A] = c(null), oe = s(null), j = s(/* @__PURE__ */ new Map()), [M, N] = c(/* @__PURE__ */ new Map()), [P, F] = c(!1), [I, L] = c([]), [R, z] = c(-1), B = s(null), V = s(!1), [H, U] = c(!1), W = s(y), G = s(x?.page ?? null), K = s(x);
|
|
198
|
+
K.current !== x && (K.current = x, G.current = x?.page ?? null);
|
|
199
|
+
let q = s(/* @__PURE__ */ new Map()), J = s(null), Y = s([]), se = s(-1), ce = s(y);
|
|
198
200
|
a(() => {
|
|
199
|
-
|
|
201
|
+
Y.current = I;
|
|
202
|
+
}, [I]), a(() => {
|
|
203
|
+
se.current = R;
|
|
200
204
|
}, [R]), a(() => {
|
|
201
|
-
|
|
202
|
-
}, [B]), a(() => {
|
|
203
|
-
Y.current = y;
|
|
205
|
+
ce.current = y;
|
|
204
206
|
}, [y]);
|
|
205
207
|
let X = i(() => {
|
|
206
|
-
|
|
208
|
+
J.current?.result.clear(), J.current = null;
|
|
207
209
|
}, []), Z = i((e, n) => {
|
|
208
210
|
X();
|
|
209
|
-
let r = t(n,
|
|
210
|
-
|
|
211
|
+
let r = t(n, ce.current);
|
|
212
|
+
J.current = {
|
|
211
213
|
page: e.page,
|
|
212
214
|
result: r
|
|
213
215
|
};
|
|
214
216
|
let i = r.matches[e.ordinalOnPage]?.marks ?? [];
|
|
215
217
|
for (let e of i) e.classList.add("find-match-current");
|
|
216
218
|
i[0]?.scrollIntoView({ block: "center" });
|
|
217
|
-
}, [X]),
|
|
219
|
+
}, [X]), le = i((e, t) => {
|
|
218
220
|
if (t === null) {
|
|
219
|
-
|
|
221
|
+
q.current.delete(e);
|
|
220
222
|
return;
|
|
221
223
|
}
|
|
222
|
-
|
|
223
|
-
let n =
|
|
224
|
+
q.current.set(e, t);
|
|
225
|
+
let n = Y.current[se.current];
|
|
224
226
|
n !== void 0 && n.page === e && Z(n, t);
|
|
225
227
|
}, [Z]);
|
|
226
228
|
a(() => {
|
|
227
229
|
let t = !1, i = null;
|
|
228
|
-
return
|
|
230
|
+
return re(null), ae(null), E(1), A(null), B.current?.cancel(), B.current = null, V.current = !1, U(!1), N(/* @__PURE__ */ new Map()), F(!1), L([]), z(-1), X(), q.current.clear(), (async () => {
|
|
229
231
|
try {
|
|
230
232
|
let { doc: a, task: o } = await ee(await v(n, e, r, f, l));
|
|
231
233
|
if (i = o, t) {
|
|
@@ -234,20 +236,20 @@ var w = r(function({ path: e, serverUrl: n = "", token: r = null, workspace: l,
|
|
|
234
236
|
}
|
|
235
237
|
try {
|
|
236
238
|
let e = (await a.getPage(1)).getViewport({ scale: 1 });
|
|
237
|
-
t ||
|
|
239
|
+
t || A({
|
|
238
240
|
width: e.width,
|
|
239
241
|
height: e.height
|
|
240
242
|
});
|
|
241
243
|
} catch {
|
|
242
|
-
t ||
|
|
244
|
+
t || A({
|
|
243
245
|
width: 612,
|
|
244
246
|
height: 792
|
|
245
247
|
});
|
|
246
248
|
}
|
|
247
249
|
if (t) return;
|
|
248
|
-
|
|
250
|
+
re(a), g?.(e);
|
|
249
251
|
} catch (e) {
|
|
250
|
-
t ||
|
|
252
|
+
t || ae(te(e) ? e : { kind: "unreadable" });
|
|
251
253
|
}
|
|
252
254
|
})(), () => {
|
|
253
255
|
t = !0, i?.destroy().catch(() => {});
|
|
@@ -259,83 +261,102 @@ var w = r(function({ path: e, serverUrl: n = "", token: r = null, workspace: l,
|
|
|
259
261
|
l,
|
|
260
262
|
f
|
|
261
263
|
]);
|
|
262
|
-
let Q =
|
|
263
|
-
t === null ?
|
|
264
|
+
let Q = w?.numPages ?? 0, ue = i((e, t) => {
|
|
265
|
+
t === null ? j.current.delete(e) : j.current.set(e, t);
|
|
264
266
|
}, []);
|
|
265
267
|
a(() => {
|
|
266
|
-
if (
|
|
267
|
-
|
|
268
|
-
let e =
|
|
268
|
+
if (w === null || y === "" || V.current) return;
|
|
269
|
+
V.current = !0, F(!0);
|
|
270
|
+
let e = w, t = {
|
|
269
271
|
numPages: e.numPages,
|
|
270
272
|
getPageText: async (t) => {
|
|
271
273
|
let n = await e.getPage(t);
|
|
272
274
|
return n.getTextContent === void 0 ? "" : (await n.getTextContent()).items.map((e) => typeof e.str == "string" ? e.str : "").join("");
|
|
273
275
|
}
|
|
274
276
|
};
|
|
275
|
-
|
|
277
|
+
B.current = p(t, G.current ?? T, (e, t) => N((n) => {
|
|
276
278
|
let r = new Map(n);
|
|
277
279
|
return r.set(e, t), r;
|
|
278
|
-
}), () =>
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
}, [
|
|
282
|
-
|
|
283
|
-
|
|
280
|
+
}), () => {
|
|
281
|
+
F(!1), U(!0);
|
|
282
|
+
});
|
|
283
|
+
}, [w, y]), a(() => () => {
|
|
284
|
+
B.current?.cancel(), B.current = null;
|
|
285
|
+
}, [w]), a(() => {
|
|
286
|
+
let e = m(M, w?.numPages ?? 0, y), t = y !== W.current;
|
|
287
|
+
W.current = y, L(e);
|
|
288
|
+
let n = G.current;
|
|
289
|
+
if (n !== null && y !== "") {
|
|
290
|
+
H && (G.current = null);
|
|
291
|
+
let t = e.findIndex((e) => e.page === n);
|
|
292
|
+
if (t !== -1) {
|
|
293
|
+
z(t);
|
|
294
|
+
return;
|
|
295
|
+
}
|
|
296
|
+
if (H) {
|
|
297
|
+
let t = e.findIndex((e) => e.page > n);
|
|
298
|
+
z(e.length === 0 ? -1 : t === -1 ? 0 : t);
|
|
299
|
+
return;
|
|
300
|
+
}
|
|
301
|
+
z(-1);
|
|
302
|
+
} else z((n) => e.length === 0 ? -1 : t || n === -1 ? 0 : Math.min(n, e.length - 1));
|
|
284
303
|
}, [
|
|
285
|
-
|
|
304
|
+
M,
|
|
286
305
|
y,
|
|
287
|
-
|
|
306
|
+
w,
|
|
307
|
+
H,
|
|
308
|
+
x
|
|
288
309
|
]), a(() => {
|
|
289
|
-
if (
|
|
310
|
+
if (R === -1 || I.length === 0) {
|
|
290
311
|
X();
|
|
291
312
|
return;
|
|
292
313
|
}
|
|
293
|
-
let e = R
|
|
294
|
-
if (
|
|
314
|
+
let e = I[R];
|
|
315
|
+
if (J.current !== null && J.current.page !== e.page && X(), Math.abs(e.page - T) > C) {
|
|
295
316
|
$(e.page);
|
|
296
317
|
return;
|
|
297
318
|
}
|
|
298
|
-
let t =
|
|
319
|
+
let t = q.current.get(e.page);
|
|
299
320
|
t !== void 0 && Z(e, t);
|
|
300
|
-
}, [
|
|
321
|
+
}, [R, I]), o(S, () => ({
|
|
301
322
|
findNext() {
|
|
302
|
-
|
|
323
|
+
G.current = null, Y.current.length !== 0 && z((e) => (e + 1) % Y.current.length);
|
|
303
324
|
},
|
|
304
325
|
findPrevious() {
|
|
305
|
-
|
|
326
|
+
G.current = null, Y.current.length !== 0 && z((e) => (e - 1 + Y.current.length) % Y.current.length);
|
|
306
327
|
}
|
|
307
328
|
}), []), a(() => {
|
|
308
329
|
b?.({
|
|
309
|
-
matchCount:
|
|
310
|
-
currentIndex:
|
|
311
|
-
searching:
|
|
330
|
+
matchCount: I.length,
|
|
331
|
+
currentIndex: R,
|
|
332
|
+
searching: P
|
|
312
333
|
});
|
|
313
334
|
}, [
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
335
|
+
I.length,
|
|
336
|
+
R,
|
|
337
|
+
P
|
|
317
338
|
]), a(() => {
|
|
318
|
-
if (
|
|
319
|
-
let e =
|
|
339
|
+
if (w === null || typeof IntersectionObserver > "u") return;
|
|
340
|
+
let e = oe.current;
|
|
320
341
|
if (e === null) return;
|
|
321
342
|
let t = new IntersectionObserver((e) => {
|
|
322
343
|
for (let t of e) {
|
|
323
344
|
if (!t.isIntersecting) continue;
|
|
324
345
|
let e = Number(t.target.dataset.page);
|
|
325
|
-
Number.isFinite(e) &&
|
|
346
|
+
Number.isFinite(e) && E(e);
|
|
326
347
|
}
|
|
327
348
|
}, {
|
|
328
349
|
root: e,
|
|
329
350
|
rootMargin: "-45% 0px -45% 0px",
|
|
330
351
|
threshold: 0
|
|
331
352
|
});
|
|
332
|
-
for (let e of
|
|
353
|
+
for (let e of j.current.values()) t.observe(e);
|
|
333
354
|
return () => t.disconnect();
|
|
334
|
-
}, [
|
|
355
|
+
}, [w, Q]);
|
|
335
356
|
let $ = i((e) => {
|
|
336
|
-
e < 1 || e > Q || (
|
|
357
|
+
e < 1 || e > Q || (E(e), j.current.get(e)?.scrollIntoView({ block: "start" }));
|
|
337
358
|
}, [Q]);
|
|
338
|
-
return
|
|
359
|
+
return ie === null ? w === null ? /* @__PURE__ */ u("div", {
|
|
339
360
|
className: "flex h-full items-center justify-center p-6",
|
|
340
361
|
children: /* @__PURE__ */ u("p", {
|
|
341
362
|
className: "text-sm text-zinc-500",
|
|
@@ -344,8 +365,8 @@ var w = r(function({ path: e, serverUrl: n = "", token: r = null, workspace: l,
|
|
|
344
365
|
}) : /* @__PURE__ */ d("div", {
|
|
345
366
|
className: "flex h-full flex-col",
|
|
346
367
|
onKeyDown: (e) => {
|
|
347
|
-
if (e.key === "PageDown" || e.key === "ArrowRight") $(
|
|
348
|
-
else if (e.key === "PageUp" || e.key === "ArrowLeft") $(
|
|
368
|
+
if (e.key === "PageDown" || e.key === "ArrowRight") $(T + 1);
|
|
369
|
+
else if (e.key === "PageUp" || e.key === "ArrowLeft") $(T - 1);
|
|
349
370
|
else return;
|
|
350
371
|
e.preventDefault();
|
|
351
372
|
},
|
|
@@ -354,8 +375,8 @@ var w = r(function({ path: e, serverUrl: n = "", token: r = null, workspace: l,
|
|
|
354
375
|
children: [
|
|
355
376
|
/* @__PURE__ */ u("button", {
|
|
356
377
|
type: "button",
|
|
357
|
-
onClick: () => $(
|
|
358
|
-
disabled:
|
|
378
|
+
onClick: () => $(T - 1),
|
|
379
|
+
disabled: T <= 1,
|
|
359
380
|
"aria-label": "Previous page",
|
|
360
381
|
className: "rounded px-2 py-1 hover:bg-zinc-100 disabled:opacity-40 dark:hover:bg-zinc-800",
|
|
361
382
|
children: "‹"
|
|
@@ -364,15 +385,15 @@ var w = r(function({ path: e, serverUrl: n = "", token: r = null, workspace: l,
|
|
|
364
385
|
className: "tabular-nums text-zinc-600 dark:text-zinc-400",
|
|
365
386
|
children: [
|
|
366
387
|
"Page ",
|
|
367
|
-
|
|
388
|
+
T,
|
|
368
389
|
" / ",
|
|
369
390
|
Q
|
|
370
391
|
]
|
|
371
392
|
}),
|
|
372
393
|
/* @__PURE__ */ u("button", {
|
|
373
394
|
type: "button",
|
|
374
|
-
onClick: () => $(
|
|
375
|
-
disabled:
|
|
395
|
+
onClick: () => $(T + 1),
|
|
396
|
+
disabled: T >= Q,
|
|
376
397
|
"aria-label": "Next page",
|
|
377
398
|
className: "rounded px-2 py-1 hover:bg-zinc-100 disabled:opacity-40 dark:hover:bg-zinc-800",
|
|
378
399
|
children: "›"
|
|
@@ -382,20 +403,20 @@ var w = r(function({ path: e, serverUrl: n = "", token: r = null, workspace: l,
|
|
|
382
403
|
children: [
|
|
383
404
|
/* @__PURE__ */ u("button", {
|
|
384
405
|
type: "button",
|
|
385
|
-
onClick: () =>
|
|
386
|
-
disabled:
|
|
406
|
+
onClick: () => O((e) => Math.max(0, e - 1)),
|
|
407
|
+
disabled: D === 0,
|
|
387
408
|
"aria-label": "Zoom out",
|
|
388
409
|
className: "rounded px-2 py-1 hover:bg-zinc-100 disabled:opacity-40 dark:hover:bg-zinc-800",
|
|
389
410
|
children: "−"
|
|
390
411
|
}),
|
|
391
412
|
/* @__PURE__ */ d("span", {
|
|
392
413
|
className: "tabular-nums text-zinc-500",
|
|
393
|
-
children: [Math.round(h[
|
|
414
|
+
children: [Math.round(h[D] * 100), "%"]
|
|
394
415
|
}),
|
|
395
416
|
/* @__PURE__ */ u("button", {
|
|
396
417
|
type: "button",
|
|
397
|
-
onClick: () =>
|
|
398
|
-
disabled:
|
|
418
|
+
onClick: () => O((e) => Math.min(h.length - 1, e + 1)),
|
|
419
|
+
disabled: D === h.length - 1,
|
|
399
420
|
"aria-label": "Zoom in",
|
|
400
421
|
className: "rounded px-2 py-1 hover:bg-zinc-100 disabled:opacity-40 dark:hover:bg-zinc-800",
|
|
401
422
|
children: "+"
|
|
@@ -404,23 +425,23 @@ var w = r(function({ path: e, serverUrl: n = "", token: r = null, workspace: l,
|
|
|
404
425
|
})
|
|
405
426
|
]
|
|
406
427
|
}), /* @__PURE__ */ u("div", {
|
|
407
|
-
ref:
|
|
428
|
+
ref: oe,
|
|
408
429
|
className: "flex-1 overflow-auto bg-zinc-100 p-4 dark:bg-zinc-950",
|
|
409
|
-
children:
|
|
410
|
-
doc:
|
|
430
|
+
children: k !== null && Array.from({ length: Q }, (e, t) => t + 1).map((e) => /* @__PURE__ */ u(ne, {
|
|
431
|
+
doc: w,
|
|
411
432
|
pageNumber: e,
|
|
412
|
-
scale: h[
|
|
413
|
-
baseSize:
|
|
414
|
-
active: Math.abs(e -
|
|
415
|
-
registerSlot:
|
|
416
|
-
onTextLayerReady:
|
|
433
|
+
scale: h[D],
|
|
434
|
+
baseSize: k,
|
|
435
|
+
active: Math.abs(e - T) <= C,
|
|
436
|
+
registerSlot: ue,
|
|
437
|
+
onTextLayerReady: le
|
|
417
438
|
}, e))
|
|
418
439
|
})]
|
|
419
440
|
}) : /* @__PURE__ */ u("div", {
|
|
420
441
|
className: "flex h-full items-center justify-center p-6",
|
|
421
442
|
children: /* @__PURE__ */ u("p", {
|
|
422
443
|
className: "max-w-md text-center text-sm text-zinc-600 dark:text-zinc-400",
|
|
423
|
-
children: _(
|
|
444
|
+
children: _(ie)
|
|
424
445
|
})
|
|
425
446
|
});
|
|
426
447
|
});
|