@arbidocs/react 0.5.120 → 0.5.122
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/PdfViewerImpl-ZVJZ4KNW.cjs +22 -0
- package/dist/PdfViewerImpl-ZVJZ4KNW.cjs.map +1 -0
- package/dist/{PdfViewerImpl.d-B28hLEuj.d.ts → PdfViewerImpl.d-CqnEzQO7.d.ts} +9 -1
- package/dist/ai/MessageArtifactCard.js +9 -1
- package/dist/ai/MessageArtifactCard.js.map +2 -2
- package/dist/annotations/freeze/index.d.ts +1 -1
- package/dist/artifacts/artifact-kind.js +1 -0
- package/dist/artifacts/artifact-kind.js.map +2 -2
- package/dist/artifacts/index.cjs +3 -2
- package/dist/artifacts/index.cjs.map +1 -1
- package/dist/artifacts/index.d.ts +3 -2
- package/dist/calls/livekit/index.cjs +51 -51
- package/dist/chat/chat-artifacts.js +0 -1
- package/dist/chat/chat-artifacts.js.map +2 -2
- package/dist/chat/open-document.js +3 -1
- package/dist/chat/open-document.js.map +2 -2
- package/dist/chat/turn-flush.js +16 -0
- package/dist/chat/turn-flush.js.map +7 -0
- package/dist/chat/useConversationActions.js +3 -0
- package/dist/chat/useConversationActions.js.map +2 -2
- package/dist/{chunk-QP3WQSAA.cjs → chunk-4B2GW3AY.cjs} +3 -3
- package/dist/{chunk-QP3WQSAA.cjs.map → chunk-4B2GW3AY.cjs.map} +1 -1
- package/dist/{chunk-YMB6XUR2.cjs → chunk-7L7QRIQ2.cjs} +11 -7
- package/dist/chunk-7L7QRIQ2.cjs.map +1 -0
- package/dist/{chunk-KDYYAZXP.cjs → chunk-DLEHM4IA.cjs} +227 -155
- package/dist/chunk-DLEHM4IA.cjs.map +1 -0
- package/dist/{chunk-5TRUFWKT.cjs → chunk-FAJLJDWS.cjs} +12 -12
- package/dist/{chunk-5TRUFWKT.cjs.map → chunk-FAJLJDWS.cjs.map} +1 -1
- package/dist/{PdfViewerImpl-QUSDLNNM.cjs → chunk-ICBT2XGF.cjs} +5 -2
- package/dist/chunk-ICBT2XGF.cjs.map +1 -0
- package/dist/{chunk-RLSBRZ6Z.cjs → chunk-IX4HOS5Z.cjs} +2 -3
- package/dist/chunk-IX4HOS5Z.cjs.map +1 -0
- package/dist/{chunk-AJRYZ3IC.cjs → chunk-K6ELFSG6.cjs} +3 -3
- package/dist/{chunk-AJRYZ3IC.cjs.map → chunk-K6ELFSG6.cjs.map} +1 -1
- package/dist/chunk-MAOGK7IC.cjs +61 -0
- package/dist/chunk-MAOGK7IC.cjs.map +1 -0
- package/dist/{chunk-C72FSQUE.cjs → chunk-WUYSVTKE.cjs} +14 -12
- package/dist/chunk-WUYSVTKE.cjs.map +1 -0
- package/dist/datasets/sources/documents.js +1 -1
- package/dist/datasets/sources/documents.js.map +2 -2
- package/dist/document-tools/core.cjs +80 -80
- package/dist/document-tools/images-to-pdf.js +43 -0
- package/dist/document-tools/images-to-pdf.js.map +7 -0
- package/dist/document-tools/index.cjs +184 -80
- package/dist/document-tools/index.cjs.map +1 -1
- package/dist/document-tools/index.d.ts +41 -1
- package/dist/document-tools/index.js +6 -1
- package/dist/document-tools/index.js.map +2 -2
- package/dist/document-tools/pdf-attachments.js +63 -0
- package/dist/document-tools/pdf-attachments.js.map +7 -0
- package/dist/entities/DocumentEntity.js +7 -2
- package/dist/entities/DocumentEntity.js.map +2 -2
- package/dist/entities/file-type.js +14 -2
- package/dist/entities/file-type.js.map +2 -2
- package/dist/entities/index.js +9 -1
- package/dist/entities/index.js.map +2 -2
- package/dist/icons/PresIcon.js +53 -0
- package/dist/icons/PresIcon.js.map +7 -0
- package/dist/icons/colors.js +2 -0
- package/dist/icons/colors.js.map +2 -2
- package/dist/icons/file-type.js +3 -0
- package/dist/icons/file-type.js.map +2 -2
- package/dist/icons/index.js +2 -0
- package/dist/icons/index.js.map +2 -2
- package/dist/index.cjs +964 -919
- package/dist/index.cjs.map +1 -1
- package/dist/{index.d-DYlUprG9.d.ts → index.d-D2puqWeN.d.ts} +17 -3
- package/dist/{index.d-oR5FKZpJ.d.ts → index.d-KbsNPTEN.d.ts} +7 -5
- package/dist/index.d.ts +46 -12
- package/dist/index.js +1 -0
- package/dist/index.js.map +2 -2
- package/dist/pdf-region-impl-ZG5G2OX2.cjs +98 -0
- package/dist/pdf-region-impl-ZG5G2OX2.cjs.map +1 -0
- package/dist/session/documents.js +9 -5
- package/dist/session/documents.js.map +2 -2
- package/dist/shell/index.cjs +54 -50
- package/dist/shell/index.d.ts +1 -1
- package/dist/ui/index.cjs +182 -170
- package/dist/ui/index.d.ts +1 -1
- package/dist/ui/slider.js +7 -1
- package/dist/ui/slider.js.map +2 -2
- package/dist/viewers/PdfViewer.cjs +3 -3
- package/dist/viewers/PdfViewer.d.ts +2 -2
- package/dist/viewers/PdfViewerImpl.js +4 -1
- package/dist/viewers/PdfViewerImpl.js.map +2 -2
- package/dist/viewers/index.cjs +28 -3
- package/dist/viewers/index.cjs.map +1 -1
- package/dist/viewers/index.d.ts +68 -2
- package/dist/viewers/index.js +14 -0
- package/dist/viewers/index.js.map +2 -2
- package/dist/viewers/pdf-region-impl.js +96 -0
- package/dist/viewers/pdf-region-impl.js.map +7 -0
- package/dist/viewers/pdf-region.js +57 -0
- package/dist/viewers/pdf-region.js.map +7 -0
- package/package.json +3 -3
- package/dist/PdfViewerImpl-QUSDLNNM.cjs.map +0 -1
- package/dist/chunk-C72FSQUE.cjs.map +0 -1
- package/dist/chunk-KDYYAZXP.cjs.map +0 -1
- package/dist/chunk-RLSBRZ6Z.cjs.map +0 -1
- package/dist/chunk-YMB6XUR2.cjs.map +0 -1
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkMAOGK7IC_cjs = require('./chunk-MAOGK7IC.cjs');
|
|
4
|
+
var chunkICBT2XGF_cjs = require('./chunk-ICBT2XGF.cjs');
|
|
5
|
+
require('./chunk-PWGSIM3F.cjs');
|
|
6
|
+
require('./chunk-IU2CJNTB.cjs');
|
|
7
|
+
require('./chunk-T5FZICXN.cjs');
|
|
8
|
+
var reactPdf = require('react-pdf');
|
|
9
|
+
|
|
10
|
+
var RENDER_SLOTS = 2;
|
|
11
|
+
var documents = /* @__PURE__ */ new WeakMap();
|
|
12
|
+
function documentFor(request) {
|
|
13
|
+
const cached = documents.get(request.file);
|
|
14
|
+
if (cached) return cached;
|
|
15
|
+
const assets = { ...chunkICBT2XGF_cjs.DEFAULT_ASSETS, ...request.assets };
|
|
16
|
+
chunkICBT2XGF_cjs.ensurePdfWorker(assets.workerSrc);
|
|
17
|
+
const loading = request.file.arrayBuffer().then(
|
|
18
|
+
(buffer) => reactPdf.pdfjs.getDocument({
|
|
19
|
+
data: new Uint8Array(buffer),
|
|
20
|
+
cMapUrl: assets.cMapUrl,
|
|
21
|
+
cMapPacked: true,
|
|
22
|
+
standardFontDataUrl: assets.standardFontDataUrl,
|
|
23
|
+
wasmUrl: assets.wasmUrl
|
|
24
|
+
}).promise
|
|
25
|
+
);
|
|
26
|
+
loading.catch(() => documents.delete(request.file));
|
|
27
|
+
documents.set(request.file, loading);
|
|
28
|
+
return loading;
|
|
29
|
+
}
|
|
30
|
+
function releaseSource(file) {
|
|
31
|
+
const loading = documents.get(file);
|
|
32
|
+
if (!loading) return;
|
|
33
|
+
documents.delete(file);
|
|
34
|
+
void loading.then((doc) => doc.loadingTask.destroy()).catch(() => void 0);
|
|
35
|
+
}
|
|
36
|
+
var running = 0;
|
|
37
|
+
var waiting = [];
|
|
38
|
+
async function slot() {
|
|
39
|
+
if (running >= RENDER_SLOTS) await new Promise((resolve) => waiting.push(resolve));
|
|
40
|
+
running++;
|
|
41
|
+
return () => {
|
|
42
|
+
running--;
|
|
43
|
+
waiting.shift()?.();
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
var aborted = () => new DOMException("The clip render was superseded", "AbortError");
|
|
47
|
+
async function renderRegion(request) {
|
|
48
|
+
const { signal } = request;
|
|
49
|
+
const release = await slot();
|
|
50
|
+
try {
|
|
51
|
+
if (signal?.aborted) throw aborted();
|
|
52
|
+
const doc = await documentFor(request);
|
|
53
|
+
const page = await doc.getPage(request.page);
|
|
54
|
+
const base = page.getViewport({ scale: 1 });
|
|
55
|
+
const geometry = chunkMAOGK7IC_cjs.regionGeometry(
|
|
56
|
+
base,
|
|
57
|
+
request.rect,
|
|
58
|
+
request.width,
|
|
59
|
+
request.maxPixels ?? chunkMAOGK7IC_cjs.PDF_REGION_MAX_PIXELS
|
|
60
|
+
);
|
|
61
|
+
if (!geometry.width) throw new RangeError("The clip is empty");
|
|
62
|
+
const viewport = page.getViewport({
|
|
63
|
+
scale: geometry.scale,
|
|
64
|
+
offsetX: geometry.offsetX,
|
|
65
|
+
offsetY: geometry.offsetY
|
|
66
|
+
});
|
|
67
|
+
const canvas = document.createElement("canvas");
|
|
68
|
+
canvas.width = geometry.width;
|
|
69
|
+
canvas.height = geometry.height;
|
|
70
|
+
const task = page.render({ canvas, viewport });
|
|
71
|
+
const cancel = () => task.cancel();
|
|
72
|
+
signal?.addEventListener("abort", cancel);
|
|
73
|
+
try {
|
|
74
|
+
await task.promise;
|
|
75
|
+
} finally {
|
|
76
|
+
signal?.removeEventListener("abort", cancel);
|
|
77
|
+
}
|
|
78
|
+
if (signal?.aborted) throw aborted();
|
|
79
|
+
const masks = chunkMAOGK7IC_cjs.regionMasks(request.rect, request.masks ?? [], geometry);
|
|
80
|
+
if (masks.length) {
|
|
81
|
+
const context = canvas.getContext("2d");
|
|
82
|
+
if (!context) throw new Error("Could not draw the redactions");
|
|
83
|
+
context.fillStyle = "#000";
|
|
84
|
+
for (const m of masks) context.fillRect(m.x, m.y, m.width, m.height);
|
|
85
|
+
}
|
|
86
|
+
if (typeof createImageBitmap !== "function") return canvas;
|
|
87
|
+
const bitmap = await createImageBitmap(canvas);
|
|
88
|
+
canvas.width = canvas.height = 0;
|
|
89
|
+
return bitmap;
|
|
90
|
+
} finally {
|
|
91
|
+
release();
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
exports.releaseSource = releaseSource;
|
|
96
|
+
exports.renderRegion = renderRegion;
|
|
97
|
+
//# sourceMappingURL=pdf-region-impl-ZG5G2OX2.cjs.map
|
|
98
|
+
//# sourceMappingURL=pdf-region-impl-ZG5G2OX2.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/viewers/pdf-region-impl.ts"],"names":["DEFAULT_ASSETS","ensurePdfWorker","pdfjs","regionGeometry","PDF_REGION_MAX_PIXELS","regionMasks"],"mappings":";;;;;;;;;AAqBA,IAAM,YAAA,GAAe,CAAA;AAErB,IAAM,SAAA,uBAAgB,OAAA,EAAoC;AAE1D,SAAS,YAAY,OAAA,EAAiD;AACpE,EAAA,MAAM,MAAA,GAAS,SAAA,CAAU,GAAA,CAAI,OAAA,CAAQ,IAAI,CAAA;AACzC,EAAA,IAAI,QAAQ,OAAO,MAAA;AACnB,EAAA,MAAM,SAAS,EAAE,GAAGA,gCAAA,EAAgB,GAAG,QAAQ,MAAA,EAAO;AACtD,EAAAC,iCAAA,CAAgB,OAAO,SAAS,CAAA;AAChC,EAAA,MAAM,OAAA,GAAU,OAAA,CAAQ,IAAA,CAAK,WAAA,EAAY,CAAE,IAAA;AAAA,IACzC,CAAC,MAAA,KACCC,cAAA,CAAM,WAAA,CAAY;AAAA,MAChB,IAAA,EAAM,IAAI,UAAA,CAAW,MAAM,CAAA;AAAA,MAC3B,SAAS,MAAA,CAAO,OAAA;AAAA,MAChB,UAAA,EAAY,IAAA;AAAA,MACZ,qBAAqB,MAAA,CAAO,mBAAA;AAAA,MAC5B,SAAS,MAAA,CAAO;AAAA,KACjB,CAAA,CAAE;AAAA,GACP;AAEA,EAAA,OAAA,CAAQ,MAAM,MAAM,SAAA,CAAU,MAAA,CAAO,OAAA,CAAQ,IAAI,CAAC,CAAA;AAClD,EAAA,SAAA,CAAU,GAAA,CAAI,OAAA,CAAQ,IAAA,EAAM,OAAO,CAAA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AAA,GAAY,MAAA;AACpB,MAAA,KAAA,MAAW,CAAA,IAAK,KAAA,EAAO,OAAA,CAAQ,QAAA,CAAS,CAAA,CAAE,CAAA,EAAG,CAAA,CAAE,CAAA,EAAG,CAAA,CAAE,KAAA,EAAO,CAAA,CAAE,MAAM,CAAA;AAAA,IACrE;AAEA,IAAA,IAAI,OAAO,iBAAA,KAAsB,UAAA,EAAY,OAAO,MAAA;AACpD,IAAA,MAAM,MAAA,GAAS,MAAM,iBAAA,CAAkB,MAAM,CAAA;AAC7C,IAAA,MAAA,CAAO,KAAA,GAAQ,OAAO,MAAA,GAAS,CAAA;AAC/B,IAAA,OAAO,MAAA;AAAA,EACT,CAAA,SAAE;AACA,IAAA,OAAA,EAAQ;AAAA,EACV;AACF","file":"pdf-region-impl-ZG5G2OX2.cjs","sourcesContent":["/**\n * The pdf.js side of `renderPdfRegion`: one loaded document per file, shared by every clip from it;\n * a page region drawn into a canvas of exactly the output size and handed back as a bitmap (no\n * image encoding). At most RENDER_SLOTS regions render at once, and a request whose signal aborts\n * is dropped before it starts or cancelled while it renders, so resizing or scrolling a clip never\n * queues up stale work.\n */\n\nimport { pdfjs } from 'react-pdf'\nimport { DEFAULT_ASSETS, ensurePdfWorker } from './PdfViewerImpl'\nimport {\n regionGeometry,\n regionMasks,\n PDF_REGION_MAX_PIXELS,\n type PdfRegionImage,\n type PdfRegionRequest,\n} from './pdf-region'\n\ntype PdfDocument = Awaited<ReturnType<typeof pdfjs.getDocument>['promise']>\n\n/** Regions rendering at once: enough to fill a slide quickly, few enough to keep the page smooth. */\nconst RENDER_SLOTS = 2\n\nconst documents = new WeakMap<Blob, Promise<PdfDocument>>()\n\nfunction documentFor(request: PdfRegionRequest): Promise<PdfDocument> {\n const cached = documents.get(request.file)\n if (cached) return cached\n const assets = { ...DEFAULT_ASSETS, ...request.assets }\n ensurePdfWorker(assets.workerSrc)\n const loading = request.file.arrayBuffer().then(\n (buffer) =>\n pdfjs.getDocument({\n data: new Uint8Array(buffer),\n cMapUrl: assets.cMapUrl,\n cMapPacked: true,\n standardFontDataUrl: assets.standardFontDataUrl,\n wasmUrl: assets.wasmUrl,\n }).promise\n )\n // A failed load is not kept: the next render tries again.\n loading.catch(() => documents.delete(request.file))\n documents.set(request.file, loading)\n return loading\n}\n\nexport function releaseSource(file: Blob): void {\n const loading = documents.get(file)\n if (!loading) return\n documents.delete(file)\n void loading.then((doc) => doc.loadingTask.destroy()).catch(() => undefined)\n}\n\nlet running = 0\nconst waiting: (() => void)[] = []\n\n/** Wait for a render slot; the returned function gives it back. */\nasync function slot(): Promise<() => void> {\n if (running >= RENDER_SLOTS) await new Promise<void>((resolve) => waiting.push(resolve))\n running++\n return () => {\n running--\n waiting.shift()?.()\n }\n}\n\nconst aborted = () => new DOMException('The clip render was superseded', 'AbortError')\n\nexport async function renderRegion(request: PdfRegionRequest): Promise<PdfRegionImage> {\n const { signal } = request\n const release = await slot()\n try {\n if (signal?.aborted) throw aborted()\n const doc = await documentFor(request)\n const page = await doc.getPage(request.page)\n const base = page.getViewport({ scale: 1 })\n const geometry = regionGeometry(\n base,\n request.rect,\n request.width,\n request.maxPixels ?? PDF_REGION_MAX_PIXELS\n )\n if (!geometry.width) throw new RangeError('The clip is empty')\n const viewport = page.getViewport({\n scale: geometry.scale,\n offsetX: geometry.offsetX,\n offsetY: geometry.offsetY,\n })\n const canvas = document.createElement('canvas')\n canvas.width = geometry.width\n canvas.height = geometry.height\n const task = page.render({ canvas, viewport })\n const cancel = () => task.cancel()\n signal?.addEventListener('abort', cancel)\n try {\n await task.promise\n } finally {\n signal?.removeEventListener('abort', cancel)\n }\n if (signal?.aborted) throw aborted()\n const masks = regionMasks(request.rect, request.masks ?? [], geometry)\n if (masks.length) {\n const context = canvas.getContext('2d')\n if (!context) throw new Error('Could not draw the redactions')\n context.fillStyle = '#000'\n for (const m of masks) context.fillRect(m.x, m.y, m.width, m.height)\n }\n // A bitmap draws fast in any window; without the API, the canvas itself is drawable.\n if (typeof createImageBitmap !== 'function') return canvas\n const bitmap = await createImageBitmap(canvas)\n canvas.width = canvas.height = 0\n return bitmap\n } finally {\n release()\n }\n}\n"]}
|
|
@@ -5,7 +5,8 @@ const VIEWER_TABS = [
|
|
|
5
5
|
"docx",
|
|
6
6
|
"xlsx",
|
|
7
7
|
"versions",
|
|
8
|
-
"preview"
|
|
8
|
+
"preview",
|
|
9
|
+
"slides"
|
|
9
10
|
];
|
|
10
11
|
const DEFAULT_DOCUMENT_VIEWER_STATE = {
|
|
11
12
|
tab: "pdf",
|
|
@@ -15,7 +16,8 @@ const DEFAULT_DOCUMENT_VIEWER_STATE = {
|
|
|
15
16
|
phonePdfChosen: false,
|
|
16
17
|
commentTarget: null,
|
|
17
18
|
unsavedChanges: false,
|
|
18
|
-
detached: false
|
|
19
|
+
detached: false,
|
|
20
|
+
presenting: false
|
|
19
21
|
};
|
|
20
22
|
const NO_PASSAGE_CITATION = {
|
|
21
23
|
active: null,
|
|
@@ -37,7 +39,8 @@ const DRAFT_TITLES = {
|
|
|
37
39
|
text: "New Doc",
|
|
38
40
|
audio: "New Audio",
|
|
39
41
|
photo: "New Photo",
|
|
40
|
-
video: "New Video"
|
|
42
|
+
video: "New Video",
|
|
43
|
+
presentation: "New Presentation"
|
|
41
44
|
};
|
|
42
45
|
function nextViewingDocument(current, input) {
|
|
43
46
|
if (!input) return null;
|
|
@@ -140,7 +143,7 @@ function createArbiDocumentSessionStore({
|
|
|
140
143
|
draftDocuments: { ...state.draftDocuments, [id]: draft },
|
|
141
144
|
viewingDocument: { id, page: null, passageId: null },
|
|
142
145
|
// A text draft is written in the editor; a capture's recorder replaces the tabs.
|
|
143
|
-
documentViewer: kind === "text" ? { ...state.documentViewer, tab: "edit" } : state.documentViewer
|
|
146
|
+
documentViewer: kind === "text" ? { ...state.documentViewer, tab: "edit" } : kind === "presentation" ? { ...state.documentViewer, tab: "slides" } : state.documentViewer
|
|
144
147
|
});
|
|
145
148
|
showViewer?.();
|
|
146
149
|
return id;
|
|
@@ -171,7 +174,8 @@ function createArbiDocumentSessionStore({
|
|
|
171
174
|
tabRequest: null,
|
|
172
175
|
commentTarget: null,
|
|
173
176
|
unsavedChanges: false,
|
|
174
|
-
detached: false
|
|
177
|
+
detached: false,
|
|
178
|
+
presenting: false
|
|
175
179
|
}
|
|
176
180
|
}),
|
|
177
181
|
reset: () => update({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/session/documents.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * The documents part of the session: the document being viewed and the viewer's own state, the\n * documents selected in lists, the document pinned to the chat, the drafts the user started on the\n * client (no backend record until saved), the citation picking passages in the viewer, and the\n * documents related to each one (near duplicates).\n *\n * {@link createArbiDocumentSessionStore} keeps it in memory; given a `persist`, the place in the\n * documents (the viewed document and its page, the pinned one, the viewer's tab and text size) is\n * read back synchronously when the store is made, so a reload shows the document at once.\n */\n\nimport type { RelatedDocsMap } from '../documents/related-documents'\n\n/** The document being viewed. */\nexport interface ArbiViewingDocument {\n /** The document (`doc-\u2026`), or a version reference (`doc-\u2026@v2`) while an earlier version shows. */\n id: string\n /** The page being read, when known. */\n page: number | null\n /** The passage being read, when one is. */\n passageId: string | null\n}\n\n/** What to view: page and passage are left unchanged when omitted. */\nexport interface ArbiViewingDocumentInput {\n id: string\n page?: number | null\n passageId?: string | null\n}\n\n/** A tab of the document viewer. */\nexport type ArbiViewerTab = 'pdf' | 'edit' | 'html' | 'docx' | 'xlsx' | 'versions' | 'preview'\n\nconst VIEWER_TABS: readonly ArbiViewerTab[] = [\n 'pdf',\n 'edit',\n 'html',\n 'docx',\n 'xlsx',\n 'versions',\n 'preview',\n]\n\n/** A comment of a Word document to open when it shows (a notification, a link). */\nexport interface ArbiDocumentCommentTarget {\n documentId: string\n commentId: string\n}\n\n/**\n * The document viewer's own state, shared with whatever opens documents (a citation opens the text\n * view, Compare from a documents list opens the redline): the open tab, the document compared with\n * the one viewed, and a tab asked for when a document was opened (applied once it has loaded).\n */\nexport interface ArbiDocumentViewerState {\n tab: ArbiViewerTab\n /** The document (or version reference) compared with the viewed one, or null. */\n compareId: string | null\n /** A tab to show once `documentId` has loaded (a signature request opens on the PDF). */\n tabRequest: { documentId: string; tab: ArbiViewerTab } | null\n /** The text view's size, a multiplier of the normal size: a reading preference. */\n textScale: number\n /** A phone user picked the PDF by hand: documents stop opening on the text view. */\n phonePdfChosen: boolean\n /** The Word comment to open in the viewed document, or null. */\n commentTarget: ArbiDocumentCommentTarget | null\n /** The open document has edits not saved yet: closing the viewer asks first. */\n unsavedChanges: boolean\n /** The viewer shows in a window of its own (popped out). */\n detached: boolean\n}\n\n/** What a draft is: a text document, or a capture (a voice note, a photo, a video). */\nexport type ArbiDraftKind = 'text' | 'audio' | 'photo' | 'video'\n\n/**\n * A document the user started on the client (a blank document, a capture), with no backend record\n * until it is saved. Its id is minted here (`draft-\u2026`), never sent to the server.\n */\nexport interface ArbiDraftDocument {\n id: string\n title: string\n kind: ArbiDraftKind\n /** A text draft's Markdown. Empty for captures. */\n content: string\n /** A capture's recording or picture, once taken; null before (and after a kind switch). */\n mediaBlob: Blob | null\n createdAt: string\n}\n\n/** A passage picked for a citation: its chunk and, when known, its page. */\nexport interface ArbiPickedPassage {\n chunk_id: string\n page?: number\n}\n\n/**\n * A citation picking passages in the viewer (a fact's sources, a field's), handed between the\n * viewer and the page that edits the citation.\n */\nexport interface ArbiPassageCitationState {\n /** The citation picking now: the document it picks in and its key (null while unsaved). */\n active: { documentId: string; key: string | null } | null\n /** Passages to light (a fact's cited passages while its sources are open). */\n highlighted: readonly string[]\n /** Passages picked in the viewer, not yet taken by the citation. */\n picked: readonly ArbiPickedPassage[]\n /** Passages unpicked in the viewer, not yet taken off the citation. */\n unpicked: readonly string[]\n}\n\n/** The documents being viewed and selected. */\nexport interface ArbiDocumentSessionState {\n viewingDocument: ArbiViewingDocument | null\n documentViewer: ArbiDocumentViewerState\n /** The documents selected in document lists. */\n selectedDocumentIds: readonly string[]\n /** Documents to select in the documents list once they are listed (a thread's sources). */\n documentsToSelect: readonly string[] | null\n /** The document read in full with each turn (one at a time). */\n pinnedDocumentId: string | null\n /** The documents related to each listed one (near duplicates), from the documents list. */\n relatedDocuments: RelatedDocsMap\n /** The drafts started on the client, by id. */\n draftDocuments: Readonly<Record<string, ArbiDraftDocument>>\n passageCitation: ArbiPassageCitationState\n}\n\n/** The documents' changes (the session store has them). */\nexport interface ArbiDocumentSessionActions {\n /**\n * View a document, or none. Viewing another document resets the page; `page` and `passageId`\n * set them when given.\n */\n setViewingDocument(document: ArbiViewingDocumentInput | null): void\n /** Change the document viewer's state; fields not given stay. */\n setDocumentViewer(change: Partial<ArbiDocumentViewerState>): void\n setSelectedDocumentIds(ids: string[]): void\n /** Ask the documents list to select these once they are listed (null: done). */\n setDocumentsToSelect(ids: string[] | null): void\n setPinnedDocumentId(id: string | null): void\n setRelatedDocuments(related: RelatedDocsMap): void\n /** Change the passage citation; fields not given stay. */\n setPassageCitation(change: Partial<ArbiPassageCitationState>): void\n /** Show a document the session just got (a chat writing one), on `tab`, in the viewer. */\n showNewDocument(documentId: string, tab?: ArbiViewerTab): void\n /** Start a draft of `kind`, view it and show the viewer. Returns its id. */\n startDraftDocument(kind: ArbiDraftKind): string\n /** Change a draft's content, capture or title. */\n updateDraftDocument(\n id: string,\n change: Partial<Pick<ArbiDraftDocument, 'content' | 'mediaBlob' | 'title'>>\n ): void\n /**\n * Switch a draft's kind. The capture is dropped (it belonged to the other kind), and a default\n * title follows the kind; a title the user typed stays.\n */\n setDraftDocumentKind(id: string, kind: ArbiDraftKind): void\n /** Forget a draft (saved or discarded). */\n clearDraftDocument(id: string): void\n}\n\n/** The documents part of a session store. */\nexport interface ArbiDocumentSessionStore extends ArbiDocumentSessionActions {\n /** The current state. The same object until something in it changes. */\n getState(): ArbiDocumentSessionState\n subscribe(listener: () => void): () => void\n /** The workspace is being left: nothing is viewed, selected, pinned or picked. */\n leave(): void\n /** Start over (sign-in, sign-out): only the reading preference (the text size) stays. */\n reset(): void\n}\n\n/** What the documents part keeps across reloads. */\nexport interface ArbiSavedDocuments {\n version: 1\n viewingDocument: { id: string; page: number | null } | null\n pinnedDocumentId: string | null\n tab: ArbiViewerTab\n textScale: number\n}\n\n/**\n * Where the documents part keeps what it saves. `load` is synchronous (localStorage), so the store\n * starts from it and nothing waits; `save` may write later (the latest value wins).\n */\nexport interface ArbiDocumentsPersist {\n /** What was saved (any shape: it is checked), or null. Never throws. */\n load(): unknown\n save(saved: ArbiSavedDocuments): void\n}\n\nexport interface ArbiDocumentSessionStoreOptions {\n initial?: Partial<ArbiDocumentSessionState>\n /** Keep the place in the documents across reloads. */\n persist?: ArbiDocumentsPersist\n /** Show the viewer for a document the session just got (a new draft, a chat's document). */\n showViewer?: () => void\n}\n\nexport const DEFAULT_DOCUMENT_VIEWER_STATE: ArbiDocumentViewerState = {\n tab: 'pdf',\n compareId: null,\n tabRequest: null,\n textScale: 1,\n phonePdfChosen: false,\n commentTarget: null,\n unsavedChanges: false,\n detached: false,\n}\n\nconst NO_PASSAGE_CITATION: ArbiPassageCitationState = {\n active: null,\n highlighted: [],\n picked: [],\n unpicked: [],\n}\n\nexport const EMPTY_DOCUMENT_STATE: ArbiDocumentSessionState = {\n viewingDocument: null,\n documentViewer: DEFAULT_DOCUMENT_VIEWER_STATE,\n selectedDocumentIds: [],\n documentsToSelect: null,\n pinnedDocumentId: null,\n relatedDocuments: new Map(),\n draftDocuments: {},\n passageCitation: NO_PASSAGE_CITATION,\n}\n\n/** A draft's default title, by kind; a title still at one of these follows a kind switch. */\nconst DRAFT_TITLES: Record<ArbiDraftKind, string> = {\n text: 'New Doc',\n audio: 'New Audio',\n photo: 'New Photo',\n video: 'New Video',\n}\n\n/** The next viewing document, given the current one (shared by every store implementation). */\nexport function nextViewingDocument(\n current: ArbiViewingDocument | null,\n input: ArbiViewingDocumentInput | null\n): ArbiViewingDocument | null {\n if (!input) return null\n const same = current?.id === input.id\n return {\n id: input.id,\n page: input.page !== undefined ? input.page : same ? (current?.page ?? null) : null,\n passageId: input.passageId !== undefined ? input.passageId : (current?.passageId ?? null),\n }\n}\n\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n typeof value === 'object' && value !== null && !Array.isArray(value)\nconst isPage = (value: unknown): value is number =>\n typeof value === 'number' && Number.isInteger(value) && value >= 1\n\n/**\n * Read a saved place in the documents. Each field is checked on its own: an unreadable one keeps\n * its default. Null when there is nothing readable at all.\n */\nexport function parseSavedDocuments(saved: unknown): ArbiSavedDocuments | null {\n if (!isRecord(saved) || saved.version !== 1) return null\n const viewing = isRecord(saved.viewingDocument) ? saved.viewingDocument : null\n return {\n version: 1,\n viewingDocument:\n viewing && typeof viewing.id === 'string' && viewing.id\n ? { id: viewing.id, page: isPage(viewing.page) ? viewing.page : null }\n : null,\n pinnedDocumentId: typeof saved.pinnedDocumentId === 'string' ? saved.pinnedDocumentId : null,\n tab: VIEWER_TABS.includes(saved.tab as ArbiViewerTab)\n ? (saved.tab as ArbiViewerTab)\n : DEFAULT_DOCUMENT_VIEWER_STATE.tab,\n textScale:\n typeof saved.textScale === 'number' && Number.isFinite(saved.textScale) && saved.textScale > 0\n ? saved.textScale\n : DEFAULT_DOCUMENT_VIEWER_STATE.textScale,\n }\n}\n\n/** What of `state` is kept across reloads. */\nexport function savedDocumentsOf(state: ArbiDocumentSessionState): ArbiSavedDocuments {\n return {\n version: 1,\n viewingDocument: state.viewingDocument\n ? { id: state.viewingDocument.id, page: state.viewingDocument.page }\n : null,\n pinnedDocumentId: state.pinnedDocumentId,\n tab: state.documentViewer.tab,\n textScale: state.documentViewer.textScale,\n }\n}\n\n/** The state a saved place puts back (over `base`). */\nexport function restoreSavedDocuments(\n base: ArbiDocumentSessionState,\n saved: ArbiSavedDocuments\n): ArbiDocumentSessionState {\n return {\n ...base,\n viewingDocument: saved.viewingDocument\n ? { id: saved.viewingDocument.id, page: saved.viewingDocument.page, passageId: null }\n : null,\n pinnedDocumentId: saved.pinnedDocumentId,\n documentViewer: { ...base.documentViewer, tab: saved.tab, textScale: saved.textScale },\n }\n}\n\n/** The documents part, in memory (and, given a `persist`, kept across reloads). */\nexport function createArbiDocumentSessionStore({\n initial = {},\n persist,\n showViewer,\n}: ArbiDocumentSessionStoreOptions = {}): ArbiDocumentSessionStore {\n let state: ArbiDocumentSessionState = { ...EMPTY_DOCUMENT_STATE, ...initial }\n if (persist) {\n const saved = parseSavedDocuments(persist.load())\n if (saved) state = restoreSavedDocuments(state, saved)\n }\n const listeners = new Set<() => void>()\n const update = (patch: Partial<ArbiDocumentSessionState>) => {\n const previous = state\n state = { ...state, ...patch }\n if (\n persist &&\n (state.viewingDocument !== previous.viewingDocument ||\n state.pinnedDocumentId !== previous.pinnedDocumentId ||\n state.documentViewer.tab !== previous.documentViewer.tab ||\n state.documentViewer.textScale !== previous.documentViewer.textScale)\n )\n persist.save(savedDocumentsOf(state))\n listeners.forEach((listener) => listener())\n }\n const setDocumentViewer = (change: Partial<ArbiDocumentViewerState>) => {\n const next = { ...state.documentViewer, ...change }\n const keys = Object.keys(change) as (keyof ArbiDocumentViewerState)[]\n if (keys.some((key) => next[key] !== state.documentViewer[key]))\n update({ documentViewer: next })\n }\n const updateDraft = (id: string, change: (draft: ArbiDraftDocument) => ArbiDraftDocument) => {\n const draft = state.draftDocuments[id]\n if (draft) update({ draftDocuments: { ...state.draftDocuments, [id]: change(draft) } })\n }\n return {\n getState: () => state,\n subscribe: (listener) => {\n listeners.add(listener)\n return () => listeners.delete(listener)\n },\n setViewingDocument: (input) =>\n update({ viewingDocument: nextViewingDocument(state.viewingDocument, input) }),\n setDocumentViewer,\n setSelectedDocumentIds: (ids) => update({ selectedDocumentIds: ids }),\n setDocumentsToSelect: (ids) => update({ documentsToSelect: ids }),\n setPinnedDocumentId: (pinnedDocumentId) => update({ pinnedDocumentId }),\n setRelatedDocuments: (relatedDocuments) => update({ relatedDocuments }),\n setPassageCitation: (change) =>\n update({ passageCitation: { ...state.passageCitation, ...change } }),\n showNewDocument: (documentId, tab) => {\n update({\n viewingDocument: { id: documentId, page: null, passageId: null },\n documentViewer: tab ? { ...state.documentViewer, tab } : state.documentViewer,\n })\n showViewer?.()\n },\n startDraftDocument: (kind) => {\n const id = `draft-${crypto.randomUUID()}`\n const draft: ArbiDraftDocument = {\n id,\n title: DRAFT_TITLES[kind],\n kind,\n content: '',\n mediaBlob: null,\n createdAt: new Date().toISOString(),\n }\n update({\n draftDocuments: { ...state.draftDocuments, [id]: draft },\n viewingDocument: { id, page: null, passageId: null },\n // A text draft is written in the editor; a capture's recorder replaces the tabs.\n documentViewer:\n kind === 'text' ? { ...state.documentViewer, tab: 'edit' } : state.documentViewer,\n })\n showViewer?.()\n return id\n },\n updateDraftDocument: (id, change) => updateDraft(id, (draft) => ({ ...draft, ...change })),\n setDraftDocumentKind: (id, kind) =>\n updateDraft(id, (draft) => ({\n ...draft,\n kind,\n mediaBlob: null,\n title: Object.values(DRAFT_TITLES).includes(draft.title) ? DRAFT_TITLES[kind] : draft.title,\n })),\n clearDraftDocument: (id) => {\n if (!(id in state.draftDocuments)) return\n const rest = { ...state.draftDocuments }\n delete rest[id]\n update({ draftDocuments: rest })\n },\n leave: () =>\n update({\n viewingDocument: null,\n selectedDocumentIds: [],\n documentsToSelect: null,\n pinnedDocumentId: null,\n relatedDocuments: new Map(),\n passageCitation: NO_PASSAGE_CITATION,\n documentViewer: {\n ...state.documentViewer,\n compareId: null,\n tabRequest: null,\n commentTarget: null,\n unsavedChanges: false,\n detached: false,\n },\n }),\n reset: () =>\n update({\n ...EMPTY_DOCUMENT_STATE,\n relatedDocuments: new Map(),\n documentViewer: {\n ...DEFAULT_DOCUMENT_VIEWER_STATE,\n textScale: state.documentViewer.textScale,\n },\n }),\n }\n}\n"],
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["/**\n * The documents part of the session: the document being viewed and the viewer's own state, the\n * documents selected in lists, the document pinned to the chat, the drafts the user started on the\n * client (no backend record until saved), the citation picking passages in the viewer, and the\n * documents related to each one (near duplicates).\n *\n * {@link createArbiDocumentSessionStore} keeps it in memory; given a `persist`, the place in the\n * documents (the viewed document and its page, the pinned one, the viewer's tab and text size) is\n * read back synchronously when the store is made, so a reload shows the document at once.\n */\n\nimport type { RelatedDocsMap } from '../documents/related-documents'\n\n/** The document being viewed. */\nexport interface ArbiViewingDocument {\n /** The document (`doc-\u2026`), or a version reference (`doc-\u2026@v2`) while an earlier version shows. */\n id: string\n /** The page being read, when known. */\n page: number | null\n /** The passage being read, when one is. */\n passageId: string | null\n}\n\n/** What to view: page and passage are left unchanged when omitted. */\nexport interface ArbiViewingDocumentInput {\n id: string\n page?: number | null\n passageId?: string | null\n}\n\n/** A tab of the document viewer. */\nexport type ArbiViewerTab =\n | 'pdf'\n | 'edit'\n | 'html'\n | 'docx'\n | 'xlsx'\n | 'versions'\n | 'preview'\n /** A presentation's slides, edited. */\n | 'slides'\n\nconst VIEWER_TABS: readonly ArbiViewerTab[] = [\n 'pdf',\n 'edit',\n 'html',\n 'docx',\n 'xlsx',\n 'versions',\n 'preview',\n 'slides',\n]\n\n/** A comment of a Word document to open when it shows (a notification, a link). */\nexport interface ArbiDocumentCommentTarget {\n documentId: string\n commentId: string\n}\n\n/**\n * The document viewer's own state, shared with whatever opens documents (a citation opens the text\n * view, Compare from a documents list opens the redline): the open tab, the document compared with\n * the one viewed, and a tab asked for when a document was opened (applied once it has loaded).\n */\nexport interface ArbiDocumentViewerState {\n tab: ArbiViewerTab\n /** The document (or version reference) compared with the viewed one, or null. */\n compareId: string | null\n /** A tab to show once `documentId` has loaded (a signature request opens on the PDF). */\n tabRequest: { documentId: string; tab: ArbiViewerTab } | null\n /** The text view's size, a multiplier of the normal size: a reading preference. */\n textScale: number\n /** A phone user picked the PDF by hand: documents stop opening on the text view. */\n phonePdfChosen: boolean\n /** The Word comment to open in the viewed document, or null. */\n commentTarget: ArbiDocumentCommentTarget | null\n /** The open document has edits not saved yet: closing the viewer asks first. */\n unsavedChanges: boolean\n /** The viewer shows in a window of its own (popped out). */\n detached: boolean\n /**\n * Popped out, the viewer shows only the document (no header, bars or controls): a clean view to\n * share in a call or put full screen. Applies while `detached`.\n */\n presenting: boolean\n}\n\n/** What a draft is: a text document, a capture (a voice note, a photo, a video), or a presentation. */\nexport type ArbiDraftKind = 'text' | 'audio' | 'photo' | 'video' | 'presentation'\n\n/**\n * A document the user started on the client (a blank document, a capture), with no backend record\n * until it is saved. Its id is minted here (`draft-\u2026`), never sent to the server.\n */\nexport interface ArbiDraftDocument {\n id: string\n title: string\n kind: ArbiDraftKind\n /** A text draft's Markdown. Empty for captures. */\n content: string\n /** A capture's recording or picture, once taken; null before (and after a kind switch). */\n mediaBlob: Blob | null\n createdAt: string\n}\n\n/** A passage picked for a citation: its chunk and, when known, its page. */\nexport interface ArbiPickedPassage {\n chunk_id: string\n page?: number\n}\n\n/**\n * A citation picking passages in the viewer (a fact's sources, a field's), handed between the\n * viewer and the page that edits the citation.\n */\nexport interface ArbiPassageCitationState {\n /** The citation picking now: the document it picks in and its key (null while unsaved). */\n active: { documentId: string; key: string | null } | null\n /** Passages to light (a fact's cited passages while its sources are open). */\n highlighted: readonly string[]\n /** Passages picked in the viewer, not yet taken by the citation. */\n picked: readonly ArbiPickedPassage[]\n /** Passages unpicked in the viewer, not yet taken off the citation. */\n unpicked: readonly string[]\n}\n\n/** The documents being viewed and selected. */\nexport interface ArbiDocumentSessionState {\n viewingDocument: ArbiViewingDocument | null\n documentViewer: ArbiDocumentViewerState\n /** The documents selected in document lists. */\n selectedDocumentIds: readonly string[]\n /** Documents to select in the documents list once they are listed (a thread's sources). */\n documentsToSelect: readonly string[] | null\n /** The document read in full with each turn (one at a time). */\n pinnedDocumentId: string | null\n /** The documents related to each listed one (near duplicates), from the documents list. */\n relatedDocuments: RelatedDocsMap\n /** The drafts started on the client, by id. */\n draftDocuments: Readonly<Record<string, ArbiDraftDocument>>\n passageCitation: ArbiPassageCitationState\n}\n\n/** The documents' changes (the session store has them). */\nexport interface ArbiDocumentSessionActions {\n /**\n * View a document, or none. Viewing another document resets the page; `page` and `passageId`\n * set them when given.\n */\n setViewingDocument(document: ArbiViewingDocumentInput | null): void\n /** Change the document viewer's state; fields not given stay. */\n setDocumentViewer(change: Partial<ArbiDocumentViewerState>): void\n setSelectedDocumentIds(ids: string[]): void\n /** Ask the documents list to select these once they are listed (null: done). */\n setDocumentsToSelect(ids: string[] | null): void\n setPinnedDocumentId(id: string | null): void\n setRelatedDocuments(related: RelatedDocsMap): void\n /** Change the passage citation; fields not given stay. */\n setPassageCitation(change: Partial<ArbiPassageCitationState>): void\n /** Show a document the session just got (a chat writing one), on `tab`, in the viewer. */\n showNewDocument(documentId: string, tab?: ArbiViewerTab): void\n /** Start a draft of `kind`, view it and show the viewer. Returns its id. */\n startDraftDocument(kind: ArbiDraftKind): string\n /** Change a draft's content, capture or title. */\n updateDraftDocument(\n id: string,\n change: Partial<Pick<ArbiDraftDocument, 'content' | 'mediaBlob' | 'title'>>\n ): void\n /**\n * Switch a draft's kind. The capture is dropped (it belonged to the other kind), and a default\n * title follows the kind; a title the user typed stays.\n */\n setDraftDocumentKind(id: string, kind: ArbiDraftKind): void\n /** Forget a draft (saved or discarded). */\n clearDraftDocument(id: string): void\n}\n\n/** The documents part of a session store. */\nexport interface ArbiDocumentSessionStore extends ArbiDocumentSessionActions {\n /** The current state. The same object until something in it changes. */\n getState(): ArbiDocumentSessionState\n subscribe(listener: () => void): () => void\n /** The workspace is being left: nothing is viewed, selected, pinned or picked. */\n leave(): void\n /** Start over (sign-in, sign-out): only the reading preference (the text size) stays. */\n reset(): void\n}\n\n/** What the documents part keeps across reloads. */\nexport interface ArbiSavedDocuments {\n version: 1\n viewingDocument: { id: string; page: number | null } | null\n pinnedDocumentId: string | null\n tab: ArbiViewerTab\n textScale: number\n}\n\n/**\n * Where the documents part keeps what it saves. `load` is synchronous (localStorage), so the store\n * starts from it and nothing waits; `save` may write later (the latest value wins).\n */\nexport interface ArbiDocumentsPersist {\n /** What was saved (any shape: it is checked), or null. Never throws. */\n load(): unknown\n save(saved: ArbiSavedDocuments): void\n}\n\nexport interface ArbiDocumentSessionStoreOptions {\n initial?: Partial<ArbiDocumentSessionState>\n /** Keep the place in the documents across reloads. */\n persist?: ArbiDocumentsPersist\n /** Show the viewer for a document the session just got (a new draft, a chat's document). */\n showViewer?: () => void\n}\n\nexport const DEFAULT_DOCUMENT_VIEWER_STATE: ArbiDocumentViewerState = {\n tab: 'pdf',\n compareId: null,\n tabRequest: null,\n textScale: 1,\n phonePdfChosen: false,\n commentTarget: null,\n unsavedChanges: false,\n detached: false,\n presenting: false,\n}\n\nconst NO_PASSAGE_CITATION: ArbiPassageCitationState = {\n active: null,\n highlighted: [],\n picked: [],\n unpicked: [],\n}\n\nexport const EMPTY_DOCUMENT_STATE: ArbiDocumentSessionState = {\n viewingDocument: null,\n documentViewer: DEFAULT_DOCUMENT_VIEWER_STATE,\n selectedDocumentIds: [],\n documentsToSelect: null,\n pinnedDocumentId: null,\n relatedDocuments: new Map(),\n draftDocuments: {},\n passageCitation: NO_PASSAGE_CITATION,\n}\n\n/** A draft's default title, by kind; a title still at one of these follows a kind switch. */\nconst DRAFT_TITLES: Record<ArbiDraftKind, string> = {\n text: 'New Doc',\n audio: 'New Audio',\n photo: 'New Photo',\n video: 'New Video',\n presentation: 'New Presentation',\n}\n\n/** The next viewing document, given the current one (shared by every store implementation). */\nexport function nextViewingDocument(\n current: ArbiViewingDocument | null,\n input: ArbiViewingDocumentInput | null\n): ArbiViewingDocument | null {\n if (!input) return null\n const same = current?.id === input.id\n return {\n id: input.id,\n page: input.page !== undefined ? input.page : same ? (current?.page ?? null) : null,\n passageId: input.passageId !== undefined ? input.passageId : (current?.passageId ?? null),\n }\n}\n\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n typeof value === 'object' && value !== null && !Array.isArray(value)\nconst isPage = (value: unknown): value is number =>\n typeof value === 'number' && Number.isInteger(value) && value >= 1\n\n/**\n * Read a saved place in the documents. Each field is checked on its own: an unreadable one keeps\n * its default. Null when there is nothing readable at all.\n */\nexport function parseSavedDocuments(saved: unknown): ArbiSavedDocuments | null {\n if (!isRecord(saved) || saved.version !== 1) return null\n const viewing = isRecord(saved.viewingDocument) ? saved.viewingDocument : null\n return {\n version: 1,\n viewingDocument:\n viewing && typeof viewing.id === 'string' && viewing.id\n ? { id: viewing.id, page: isPage(viewing.page) ? viewing.page : null }\n : null,\n pinnedDocumentId: typeof saved.pinnedDocumentId === 'string' ? saved.pinnedDocumentId : null,\n tab: VIEWER_TABS.includes(saved.tab as ArbiViewerTab)\n ? (saved.tab as ArbiViewerTab)\n : DEFAULT_DOCUMENT_VIEWER_STATE.tab,\n textScale:\n typeof saved.textScale === 'number' && Number.isFinite(saved.textScale) && saved.textScale > 0\n ? saved.textScale\n : DEFAULT_DOCUMENT_VIEWER_STATE.textScale,\n }\n}\n\n/** What of `state` is kept across reloads. */\nexport function savedDocumentsOf(state: ArbiDocumentSessionState): ArbiSavedDocuments {\n return {\n version: 1,\n viewingDocument: state.viewingDocument\n ? { id: state.viewingDocument.id, page: state.viewingDocument.page }\n : null,\n pinnedDocumentId: state.pinnedDocumentId,\n tab: state.documentViewer.tab,\n textScale: state.documentViewer.textScale,\n }\n}\n\n/** The state a saved place puts back (over `base`). */\nexport function restoreSavedDocuments(\n base: ArbiDocumentSessionState,\n saved: ArbiSavedDocuments\n): ArbiDocumentSessionState {\n return {\n ...base,\n viewingDocument: saved.viewingDocument\n ? { id: saved.viewingDocument.id, page: saved.viewingDocument.page, passageId: null }\n : null,\n pinnedDocumentId: saved.pinnedDocumentId,\n documentViewer: { ...base.documentViewer, tab: saved.tab, textScale: saved.textScale },\n }\n}\n\n/** The documents part, in memory (and, given a `persist`, kept across reloads). */\nexport function createArbiDocumentSessionStore({\n initial = {},\n persist,\n showViewer,\n}: ArbiDocumentSessionStoreOptions = {}): ArbiDocumentSessionStore {\n let state: ArbiDocumentSessionState = { ...EMPTY_DOCUMENT_STATE, ...initial }\n if (persist) {\n const saved = parseSavedDocuments(persist.load())\n if (saved) state = restoreSavedDocuments(state, saved)\n }\n const listeners = new Set<() => void>()\n const update = (patch: Partial<ArbiDocumentSessionState>) => {\n const previous = state\n state = { ...state, ...patch }\n if (\n persist &&\n (state.viewingDocument !== previous.viewingDocument ||\n state.pinnedDocumentId !== previous.pinnedDocumentId ||\n state.documentViewer.tab !== previous.documentViewer.tab ||\n state.documentViewer.textScale !== previous.documentViewer.textScale)\n )\n persist.save(savedDocumentsOf(state))\n listeners.forEach((listener) => listener())\n }\n const setDocumentViewer = (change: Partial<ArbiDocumentViewerState>) => {\n const next = { ...state.documentViewer, ...change }\n const keys = Object.keys(change) as (keyof ArbiDocumentViewerState)[]\n if (keys.some((key) => next[key] !== state.documentViewer[key]))\n update({ documentViewer: next })\n }\n const updateDraft = (id: string, change: (draft: ArbiDraftDocument) => ArbiDraftDocument) => {\n const draft = state.draftDocuments[id]\n if (draft) update({ draftDocuments: { ...state.draftDocuments, [id]: change(draft) } })\n }\n return {\n getState: () => state,\n subscribe: (listener) => {\n listeners.add(listener)\n return () => listeners.delete(listener)\n },\n setViewingDocument: (input) =>\n update({ viewingDocument: nextViewingDocument(state.viewingDocument, input) }),\n setDocumentViewer,\n setSelectedDocumentIds: (ids) => update({ selectedDocumentIds: ids }),\n setDocumentsToSelect: (ids) => update({ documentsToSelect: ids }),\n setPinnedDocumentId: (pinnedDocumentId) => update({ pinnedDocumentId }),\n setRelatedDocuments: (relatedDocuments) => update({ relatedDocuments }),\n setPassageCitation: (change) =>\n update({ passageCitation: { ...state.passageCitation, ...change } }),\n showNewDocument: (documentId, tab) => {\n update({\n viewingDocument: { id: documentId, page: null, passageId: null },\n documentViewer: tab ? { ...state.documentViewer, tab } : state.documentViewer,\n })\n showViewer?.()\n },\n startDraftDocument: (kind) => {\n const id = `draft-${crypto.randomUUID()}`\n const draft: ArbiDraftDocument = {\n id,\n title: DRAFT_TITLES[kind],\n kind,\n content: '',\n mediaBlob: null,\n createdAt: new Date().toISOString(),\n }\n update({\n draftDocuments: { ...state.draftDocuments, [id]: draft },\n viewingDocument: { id, page: null, passageId: null },\n // A text draft is written in the editor; a capture's recorder replaces the tabs.\n documentViewer:\n kind === 'text'\n ? { ...state.documentViewer, tab: 'edit' }\n : kind === 'presentation'\n ? { ...state.documentViewer, tab: 'slides' }\n : state.documentViewer,\n })\n showViewer?.()\n return id\n },\n updateDraftDocument: (id, change) => updateDraft(id, (draft) => ({ ...draft, ...change })),\n setDraftDocumentKind: (id, kind) =>\n updateDraft(id, (draft) => ({\n ...draft,\n kind,\n mediaBlob: null,\n title: Object.values(DRAFT_TITLES).includes(draft.title) ? DRAFT_TITLES[kind] : draft.title,\n })),\n clearDraftDocument: (id) => {\n if (!(id in state.draftDocuments)) return\n const rest = { ...state.draftDocuments }\n delete rest[id]\n update({ draftDocuments: rest })\n },\n leave: () =>\n update({\n viewingDocument: null,\n selectedDocumentIds: [],\n documentsToSelect: null,\n pinnedDocumentId: null,\n relatedDocuments: new Map(),\n passageCitation: NO_PASSAGE_CITATION,\n documentViewer: {\n ...state.documentViewer,\n compareId: null,\n tabRequest: null,\n commentTarget: null,\n unsavedChanges: false,\n detached: false,\n presenting: false,\n },\n }),\n reset: () =>\n update({\n ...EMPTY_DOCUMENT_STATE,\n relatedDocuments: new Map(),\n documentViewer: {\n ...DEFAULT_DOCUMENT_VIEWER_STATE,\n textScale: state.documentViewer.textScale,\n },\n }),\n }\n}\n"],
|
|
5
|
+
"mappings": "AA0CA,MAAM,cAAwC;AAAA,EAC5C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAoKO,MAAM,gCAAyD;AAAA,EACpE,KAAK;AAAA,EACL,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,gBAAgB;AAAA,EAChB,eAAe;AAAA,EACf,gBAAgB;AAAA,EAChB,UAAU;AAAA,EACV,YAA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,MAAM,eAAe;AACvC,aAAO,KAAK,EAAE;AACd,aAAO,EAAE,gBAAgB,KAAK,CAAC;AAAA,IACjC;AAAA,IACA,OAAO,MACL,OAAO;AAAA,MACL,iBAAiB;AAAA,MACjB,qBAAqB,CAAC;AAAA,MACtB,mBAAmB;AAAA,MACnB,kBAAkB;AAAA,MAClB,kBAAkB,oBAAI,IAAI;AAAA,MAC1B,iBAAiB;AAAA,MACjB,gBAAgB;AAAA,QACd,GAAG,MAAM;AAAA,QACT,WAAW;AAAA,QACX,YAAY;AAAA,QACZ,eAAe;AAAA,QACf,gBAAgB;AAAA,QAChB,UAAU;AAAA,QACV,YAAY;AAAA,MACd;AAAA,IACF,CAAC;AAAA,IACH,OAAO,MACL,OAAO;AAAA,MACL,GAAG;AAAA,MACH,kBAAkB,oBAAI,IAAI;AAAA,MAC1B,gBAAgB;AAAA,QACd,GAAG;AAAA,QACH,WAAW,MAAM,eAAe;AAAA,MAClC;AAAA,IACF,CAAC;AAAA,EACL;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/shell/index.cjs
CHANGED
|
@@ -1,204 +1,208 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkWUYSVTKE_cjs = require('../chunk-WUYSVTKE.cjs');
|
|
4
|
+
var chunkIX4HOS5Z_cjs = require('../chunk-IX4HOS5Z.cjs');
|
|
5
5
|
require('../chunk-N73IMVFF.cjs');
|
|
6
6
|
require('../chunk-NDIKMOBJ.cjs');
|
|
7
7
|
require('../chunk-VOFNX4P6.cjs');
|
|
8
8
|
require('../chunk-KC474WVG.cjs');
|
|
9
|
-
var chunk5NOZDH3F_cjs = require('../chunk-5NOZDH3F.cjs');
|
|
10
9
|
require('../chunk-HJDR5HEO.cjs');
|
|
10
|
+
var chunk5NOZDH3F_cjs = require('../chunk-5NOZDH3F.cjs');
|
|
11
11
|
require('../chunk-S6A6FSG7.cjs');
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
Object.defineProperty(exports, "ArbiHost", {
|
|
16
16
|
enumerable: true,
|
|
17
|
-
get: function () { return
|
|
17
|
+
get: function () { return chunkWUYSVTKE_cjs.ArbiHost; }
|
|
18
18
|
});
|
|
19
19
|
Object.defineProperty(exports, "DEFAULT_ASSISTANT_NAME", {
|
|
20
20
|
enumerable: true,
|
|
21
|
-
get: function () { return
|
|
21
|
+
get: function () { return chunkWUYSVTKE_cjs.DEFAULT_ASSISTANT_NAME; }
|
|
22
22
|
});
|
|
23
23
|
Object.defineProperty(exports, "LEGACY_THREAD_DOCUMENTS_KEY", {
|
|
24
24
|
enumerable: true,
|
|
25
|
-
get: function () { return
|
|
25
|
+
get: function () { return chunkWUYSVTKE_cjs.LEGACY_THREAD_DOCUMENTS_KEY; }
|
|
26
26
|
});
|
|
27
27
|
Object.defineProperty(exports, "MENTION_HREF_PREFIX", {
|
|
28
28
|
enumerable: true,
|
|
29
|
-
get: function () { return
|
|
29
|
+
get: function () { return chunkWUYSVTKE_cjs.MENTION_HREF_PREFIX; }
|
|
30
30
|
});
|
|
31
31
|
Object.defineProperty(exports, "NotificationBell", {
|
|
32
32
|
enumerable: true,
|
|
33
|
-
get: function () { return
|
|
33
|
+
get: function () { return chunkWUYSVTKE_cjs.NotificationBell; }
|
|
34
34
|
});
|
|
35
35
|
Object.defineProperty(exports, "Toaster", {
|
|
36
36
|
enumerable: true,
|
|
37
|
-
get: function () { return
|
|
37
|
+
get: function () { return chunkWUYSVTKE_cjs.Toaster; }
|
|
38
38
|
});
|
|
39
39
|
Object.defineProperty(exports, "UNBOUND", {
|
|
40
40
|
enumerable: true,
|
|
41
|
-
get: function () { return
|
|
41
|
+
get: function () { return chunkWUYSVTKE_cjs.UNBOUND; }
|
|
42
42
|
});
|
|
43
43
|
Object.defineProperty(exports, "assistantCopy", {
|
|
44
44
|
enumerable: true,
|
|
45
|
-
get: function () { return
|
|
45
|
+
get: function () { return chunkWUYSVTKE_cjs.assistantCopy; }
|
|
46
46
|
});
|
|
47
47
|
Object.defineProperty(exports, "bindingOfRow", {
|
|
48
48
|
enumerable: true,
|
|
49
|
-
get: function () { return
|
|
49
|
+
get: function () { return chunkWUYSVTKE_cjs.bindingOfRow; }
|
|
50
50
|
});
|
|
51
51
|
Object.defineProperty(exports, "clearSearchSession", {
|
|
52
52
|
enumerable: true,
|
|
53
|
-
get: function () { return
|
|
53
|
+
get: function () { return chunkWUYSVTKE_cjs.clearSearchSession; }
|
|
54
54
|
});
|
|
55
55
|
Object.defineProperty(exports, "createSearchSession", {
|
|
56
56
|
enumerable: true,
|
|
57
|
-
get: function () { return
|
|
57
|
+
get: function () { return chunkWUYSVTKE_cjs.createSearchSession; }
|
|
58
58
|
});
|
|
59
59
|
Object.defineProperty(exports, "extractMentions", {
|
|
60
60
|
enumerable: true,
|
|
61
|
-
get: function () { return
|
|
61
|
+
get: function () { return chunkWUYSVTKE_cjs.extractMentions; }
|
|
62
62
|
});
|
|
63
63
|
Object.defineProperty(exports, "filterMentionCandidates", {
|
|
64
64
|
enumerable: true,
|
|
65
|
-
get: function () { return
|
|
65
|
+
get: function () { return chunkWUYSVTKE_cjs.filterMentionCandidates; }
|
|
66
66
|
});
|
|
67
67
|
Object.defineProperty(exports, "findMentionQuery", {
|
|
68
68
|
enumerable: true,
|
|
69
|
-
get: function () { return
|
|
69
|
+
get: function () { return chunkWUYSVTKE_cjs.findMentionQuery; }
|
|
70
70
|
});
|
|
71
71
|
Object.defineProperty(exports, "forgetLegacyThreadDocuments", {
|
|
72
72
|
enumerable: true,
|
|
73
|
-
get: function () { return
|
|
73
|
+
get: function () { return chunkWUYSVTKE_cjs.forgetLegacyThreadDocuments; }
|
|
74
74
|
});
|
|
75
75
|
Object.defineProperty(exports, "hasMessageBody", {
|
|
76
76
|
enumerable: true,
|
|
77
|
-
get: function () { return
|
|
77
|
+
get: function () { return chunkWUYSVTKE_cjs.hasMessageBody; }
|
|
78
78
|
});
|
|
79
79
|
Object.defineProperty(exports, "insertMention", {
|
|
80
80
|
enumerable: true,
|
|
81
|
-
get: function () { return
|
|
81
|
+
get: function () { return chunkWUYSVTKE_cjs.insertMention; }
|
|
82
|
+
});
|
|
83
|
+
Object.defineProperty(exports, "isSlideDeck", {
|
|
84
|
+
enumerable: true,
|
|
85
|
+
get: function () { return chunkWUYSVTKE_cjs.isSlideDeck; }
|
|
82
86
|
});
|
|
83
87
|
Object.defineProperty(exports, "latestThreadOfDocument", {
|
|
84
88
|
enumerable: true,
|
|
85
|
-
get: function () { return
|
|
89
|
+
get: function () { return chunkWUYSVTKE_cjs.latestThreadOfDocument; }
|
|
86
90
|
});
|
|
87
91
|
Object.defineProperty(exports, "linkMentions", {
|
|
88
92
|
enumerable: true,
|
|
89
|
-
get: function () { return
|
|
93
|
+
get: function () { return chunkWUYSVTKE_cjs.linkMentions; }
|
|
90
94
|
});
|
|
91
95
|
Object.defineProperty(exports, "mentionFromHref", {
|
|
92
96
|
enumerable: true,
|
|
93
|
-
get: function () { return
|
|
97
|
+
get: function () { return chunkWUYSVTKE_cjs.mentionFromHref; }
|
|
94
98
|
});
|
|
95
99
|
Object.defineProperty(exports, "openDocumentId", {
|
|
96
100
|
enumerable: true,
|
|
97
|
-
get: function () { return
|
|
101
|
+
get: function () { return chunkWUYSVTKE_cjs.openDocumentId; }
|
|
98
102
|
});
|
|
99
103
|
Object.defineProperty(exports, "opensInWord", {
|
|
100
104
|
enumerable: true,
|
|
101
|
-
get: function () { return
|
|
105
|
+
get: function () { return chunkWUYSVTKE_cjs.opensInWord; }
|
|
102
106
|
});
|
|
103
107
|
Object.defineProperty(exports, "persistSearchSession", {
|
|
104
108
|
enumerable: true,
|
|
105
|
-
get: function () { return
|
|
109
|
+
get: function () { return chunkWUYSVTKE_cjs.persistSearchSession; }
|
|
106
110
|
});
|
|
107
111
|
Object.defineProperty(exports, "readLegacyThreadDocuments", {
|
|
108
112
|
enumerable: true,
|
|
109
|
-
get: function () { return
|
|
113
|
+
get: function () { return chunkWUYSVTKE_cjs.readLegacyThreadDocuments; }
|
|
110
114
|
});
|
|
111
115
|
Object.defineProperty(exports, "requestSearch", {
|
|
112
116
|
enumerable: true,
|
|
113
|
-
get: function () { return
|
|
117
|
+
get: function () { return chunkWUYSVTKE_cjs.requestSearch; }
|
|
114
118
|
});
|
|
115
119
|
Object.defineProperty(exports, "savedDocumentIdFor", {
|
|
116
120
|
enumerable: true,
|
|
117
|
-
get: function () { return
|
|
121
|
+
get: function () { return chunkWUYSVTKE_cjs.savedDocumentIdFor; }
|
|
118
122
|
});
|
|
119
123
|
Object.defineProperty(exports, "sharedSearchSession", {
|
|
120
124
|
enumerable: true,
|
|
121
|
-
get: function () { return
|
|
125
|
+
get: function () { return chunkWUYSVTKE_cjs.sharedSearchSession; }
|
|
122
126
|
});
|
|
123
127
|
Object.defineProperty(exports, "takeDocumentForTurn", {
|
|
124
128
|
enumerable: true,
|
|
125
|
-
get: function () { return
|
|
129
|
+
get: function () { return chunkWUYSVTKE_cjs.takeDocumentForTurn; }
|
|
126
130
|
});
|
|
127
131
|
Object.defineProperty(exports, "takePendingSearch", {
|
|
128
132
|
enumerable: true,
|
|
129
|
-
get: function () { return
|
|
133
|
+
get: function () { return chunkWUYSVTKE_cjs.takePendingSearch; }
|
|
130
134
|
});
|
|
131
135
|
Object.defineProperty(exports, "toMessageMentions", {
|
|
132
136
|
enumerable: true,
|
|
133
|
-
get: function () { return
|
|
137
|
+
get: function () { return chunkWUYSVTKE_cjs.toMessageMentions; }
|
|
134
138
|
});
|
|
135
139
|
Object.defineProperty(exports, "useAssistantCopy", {
|
|
136
140
|
enumerable: true,
|
|
137
|
-
get: function () { return
|
|
141
|
+
get: function () { return chunkWUYSVTKE_cjs.useAssistantCopy; }
|
|
138
142
|
});
|
|
139
143
|
Object.defineProperty(exports, "useAssistantName", {
|
|
140
144
|
enumerable: true,
|
|
141
|
-
get: function () { return
|
|
145
|
+
get: function () { return chunkWUYSVTKE_cjs.useAssistantName; }
|
|
142
146
|
});
|
|
143
147
|
Object.defineProperty(exports, "useOpenDocumentId", {
|
|
144
148
|
enumerable: true,
|
|
145
|
-
get: function () { return
|
|
149
|
+
get: function () { return chunkWUYSVTKE_cjs.useOpenDocumentId; }
|
|
146
150
|
});
|
|
147
151
|
Object.defineProperty(exports, "useRegisterOpenDocument", {
|
|
148
152
|
enumerable: true,
|
|
149
|
-
get: function () { return
|
|
153
|
+
get: function () { return chunkWUYSVTKE_cjs.useRegisterOpenDocument; }
|
|
150
154
|
});
|
|
151
155
|
Object.defineProperty(exports, "useTurnDocumentId", {
|
|
152
156
|
enumerable: true,
|
|
153
|
-
get: function () { return
|
|
157
|
+
get: function () { return chunkWUYSVTKE_cjs.useTurnDocumentId; }
|
|
154
158
|
});
|
|
155
159
|
Object.defineProperty(exports, "clearChatArtifacts", {
|
|
156
160
|
enumerable: true,
|
|
157
|
-
get: function () { return
|
|
161
|
+
get: function () { return chunkIX4HOS5Z_cjs.clearChatArtifacts; }
|
|
158
162
|
});
|
|
159
163
|
Object.defineProperty(exports, "configureNotify", {
|
|
160
164
|
enumerable: true,
|
|
161
|
-
get: function () { return
|
|
165
|
+
get: function () { return chunkIX4HOS5Z_cjs.configureNotify; }
|
|
162
166
|
});
|
|
163
167
|
Object.defineProperty(exports, "getChatArtifact", {
|
|
164
168
|
enumerable: true,
|
|
165
|
-
get: function () { return
|
|
169
|
+
get: function () { return chunkIX4HOS5Z_cjs.getChatArtifact; }
|
|
166
170
|
});
|
|
167
171
|
Object.defineProperty(exports, "getChatArtifacts", {
|
|
168
172
|
enumerable: true,
|
|
169
|
-
get: function () { return
|
|
173
|
+
get: function () { return chunkIX4HOS5Z_cjs.getChatArtifacts; }
|
|
170
174
|
});
|
|
171
175
|
Object.defineProperty(exports, "notify", {
|
|
172
176
|
enumerable: true,
|
|
173
|
-
get: function () { return
|
|
177
|
+
get: function () { return chunkIX4HOS5Z_cjs.notify; }
|
|
174
178
|
});
|
|
175
179
|
Object.defineProperty(exports, "persistNotifyHistory", {
|
|
176
180
|
enumerable: true,
|
|
177
|
-
get: function () { return
|
|
181
|
+
get: function () { return chunkIX4HOS5Z_cjs.persistNotifyHistory; }
|
|
178
182
|
});
|
|
179
183
|
Object.defineProperty(exports, "recordChatArtifact", {
|
|
180
184
|
enumerable: true,
|
|
181
|
-
get: function () { return
|
|
185
|
+
get: function () { return chunkIX4HOS5Z_cjs.recordChatArtifact; }
|
|
182
186
|
});
|
|
183
187
|
Object.defineProperty(exports, "selectUnread", {
|
|
184
188
|
enumerable: true,
|
|
185
|
-
get: function () { return
|
|
189
|
+
get: function () { return chunkIX4HOS5Z_cjs.selectUnread; }
|
|
186
190
|
});
|
|
187
191
|
Object.defineProperty(exports, "toast", {
|
|
188
192
|
enumerable: true,
|
|
189
|
-
get: function () { return
|
|
193
|
+
get: function () { return chunkIX4HOS5Z_cjs.toast; }
|
|
190
194
|
});
|
|
191
195
|
Object.defineProperty(exports, "useChatArtifact", {
|
|
192
196
|
enumerable: true,
|
|
193
|
-
get: function () { return
|
|
197
|
+
get: function () { return chunkIX4HOS5Z_cjs.useChatArtifact; }
|
|
194
198
|
});
|
|
195
199
|
Object.defineProperty(exports, "useMessageChatArtifact", {
|
|
196
200
|
enumerable: true,
|
|
197
|
-
get: function () { return
|
|
201
|
+
get: function () { return chunkIX4HOS5Z_cjs.useMessageChatArtifact; }
|
|
198
202
|
});
|
|
199
203
|
Object.defineProperty(exports, "useNotify", {
|
|
200
204
|
enumerable: true,
|
|
201
|
-
get: function () { return
|
|
205
|
+
get: function () { return chunkIX4HOS5Z_cjs.useNotify; }
|
|
202
206
|
});
|
|
203
207
|
Object.defineProperty(exports, "useHostConfigRecord", {
|
|
204
208
|
enumerable: true,
|
package/dist/shell/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as AppNotification, a as ArbiHost, b as ArbiHostConnection, c as ArbiHostProps, d as AssistantCopy, C as ChatArtifact, D as DEFAULT_ASSISTANT_NAME, H as HostConfigRecord, L as LEGACY_THREAD_DOCUMENTS_KEY, f as MENTION_HREF_PREFIX, g as MentionCandidate, h as MentionKind, i as MessageMentionRef, N as NotificationBell, j as NotificationBellProps, l as NotifyConfig, m as NotifyOptions, n as NotifyVariant, O as OpenDocumentRegistration, S as SavedDocumentInput, o as SearchSession, p as SearchSessionState, q as SearchStatus, T as ThreadBinding, r as ThreadBindingRow, s as Toaster, t as TurnDocumentInput, U as UNBOUND, W as WordDocumentKind, u as assistantCopy, v as bindingOfRow, w as clearChatArtifacts, x as clearSearchSession, y as configureNotify, z as createSearchSession, B as extractMentions, E as filterMentionCandidates, F as findMentionQuery, G as forgetLegacyThreadDocuments, I as getChatArtifact, J as getChatArtifacts, K as hasMessageBody, P as insertMention, Q as
|
|
1
|
+
export { A as AppNotification, a as ArbiHost, b as ArbiHostConnection, c as ArbiHostProps, d as AssistantCopy, C as ChatArtifact, D as DEFAULT_ASSISTANT_NAME, H as HostConfigRecord, L as LEGACY_THREAD_DOCUMENTS_KEY, f as MENTION_HREF_PREFIX, g as MentionCandidate, h as MentionKind, i as MessageMentionRef, N as NotificationBell, j as NotificationBellProps, l as NotifyConfig, m as NotifyOptions, n as NotifyVariant, O as OpenDocumentRegistration, S as SavedDocumentInput, o as SearchSession, p as SearchSessionState, q as SearchStatus, T as ThreadBinding, r as ThreadBindingRow, s as Toaster, t as TurnDocumentInput, U as UNBOUND, W as WordDocumentKind, u as assistantCopy, v as bindingOfRow, w as clearChatArtifacts, x as clearSearchSession, y as configureNotify, z as createSearchSession, B as extractMentions, E as filterMentionCandidates, F as findMentionQuery, G as forgetLegacyThreadDocuments, I as getChatArtifact, J as getChatArtifacts, K as hasMessageBody, P as insertMention, Q as isSlideDeck, R as latestThreadOfDocument, V as linkMentions, X as mentionFromHref, Y as notify, Z as openDocumentId, _ as opensInWord, $ as persistNotifyHistory, a0 as persistSearchSession, a1 as readLegacyThreadDocuments, a2 as recordChatArtifact, a3 as requestSearch, a4 as savedDocumentIdFor, a6 as selectUnread, a7 as sharedSearchSession, a8 as takeDocumentForTurn, a9 as takePendingSearch, aa as toMessageMentions, ab as useAssistantCopy, ac as useAssistantName, ad as useChatArtifact, ae as useHostConfigRecord, af as useMessageChatArtifact, ag as useNotify, ah as useOpenDocumentId, ai as useRegisterOpenDocument, aj as useTurnDocumentId } from '../index.d-KbsNPTEN.js';
|
|
2
2
|
export { ToasterProps, toast } from 'sonner';
|
|
3
3
|
import 'zustand';
|
|
4
4
|
import 'react';
|