@arbidocs/blocks 0.4.129 → 0.4.131
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/agents/index.cjs +303 -303
- package/dist/agents/index.js +11 -11
- package/dist/calendar/CalendarPrint.d.ts +25 -0
- package/dist/calendar/booking-slots.d.ts +21 -0
- package/dist/calendar/index.cjs +381 -97
- package/dist/calendar/index.cjs.map +1 -1
- package/dist/calendar/index.d.ts +4 -0
- package/dist/calendar/index.js +277 -3
- package/dist/calendar/index.js.map +1 -1
- package/dist/calendar/print-layout.d.ts +16 -0
- package/dist/calendar/printCalendar.d.ts +6 -0
- package/dist/calls/composite-canvas.d.ts +52 -0
- package/dist/calls/index.cjs +374 -1
- package/dist/calls/index.cjs.map +1 -1
- package/dist/calls/index.d.ts +3 -0
- package/dist/calls/index.js +359 -4
- package/dist/calls/index.js.map +1 -1
- package/dist/calls/ringtone.d.ts +16 -0
- package/dist/calls/voice-levels.d.ts +32 -0
- package/dist/chat/ThreadVisualizer.d.ts +28 -0
- package/dist/chat/index.cjs +151 -135
- package/dist/chat/index.d.ts +2 -0
- package/dist/chat/index.js +4 -4
- package/dist/chat/thread-diagram.d.ts +26 -0
- package/dist/{chunk-H2KQ6OSU.js → chunk-26E6PHD2.js} +231 -6
- package/dist/chunk-26E6PHD2.js.map +1 -0
- package/dist/{chunk-2PNNCEPH.js → chunk-54ANPPMV.js} +4 -4
- package/dist/{chunk-2PNNCEPH.js.map → chunk-54ANPPMV.js.map} +1 -1
- package/dist/{chunk-IBZJYCYM.js → chunk-66TA5IBN.js} +17 -25
- package/dist/chunk-66TA5IBN.js.map +1 -0
- package/dist/{chunk-OYMWV45N.js → chunk-7D4W3SAH.js} +51 -4
- package/dist/chunk-7D4W3SAH.js.map +1 -0
- package/dist/{chunk-2DFDFOM7.js → chunk-7HAM7Y5U.js} +3 -3
- package/dist/{chunk-2DFDFOM7.js.map → chunk-7HAM7Y5U.js.map} +1 -1
- package/dist/{chunk-7423V6RM.cjs → chunk-7KH4M3KY.cjs} +8 -8
- package/dist/{chunk-7423V6RM.cjs.map → chunk-7KH4M3KY.cjs.map} +1 -1
- package/dist/{chunk-TGWTLNXW.cjs → chunk-BIXHB4LV.cjs} +3 -2
- package/dist/{chunk-TGWTLNXW.cjs.map → chunk-BIXHB4LV.cjs.map} +1 -1
- package/dist/{chunk-DZYAAL4H.cjs → chunk-BZF55UCE.cjs} +234 -5
- package/dist/chunk-BZF55UCE.cjs.map +1 -0
- package/dist/{chunk-3BJLNKOB.cjs → chunk-CDZVC32G.cjs} +5 -5
- package/dist/{chunk-3BJLNKOB.cjs.map → chunk-CDZVC32G.cjs.map} +1 -1
- package/dist/{chunk-PUCY3UXN.js → chunk-CXLVI3SB.js} +3 -3
- package/dist/{chunk-PUCY3UXN.js.map → chunk-CXLVI3SB.js.map} +1 -1
- package/dist/{chunk-KYDRUFWT.cjs → chunk-D4YR56FV.cjs} +5 -5
- package/dist/{chunk-KYDRUFWT.cjs.map → chunk-D4YR56FV.cjs.map} +1 -1
- package/dist/{chunk-6BTCDKCK.js → chunk-DI35D756.js} +4 -4
- package/dist/{chunk-6BTCDKCK.js.map → chunk-DI35D756.js.map} +1 -1
- package/dist/{chunk-TGJNPKST.js → chunk-GTCC2VAR.js} +3 -3
- package/dist/{chunk-TGJNPKST.js.map → chunk-GTCC2VAR.js.map} +1 -1
- package/dist/{chunk-6AALMYPS.cjs → chunk-HM23LXUP.cjs} +3 -3
- package/dist/{chunk-6AALMYPS.cjs.map → chunk-HM23LXUP.cjs.map} +1 -1
- package/dist/{chunk-HSFLEVZY.js → chunk-KLOSOT26.js} +10 -10
- package/dist/{chunk-HSFLEVZY.js.map → chunk-KLOSOT26.js.map} +1 -1
- package/dist/{chunk-SARREDFP.cjs → chunk-LC2KJSUS.cjs} +46 -46
- package/dist/{chunk-SARREDFP.cjs.map → chunk-LC2KJSUS.cjs.map} +1 -1
- package/dist/{chunk-MUMH3Z6K.cjs → chunk-LRD7BHAT.cjs} +50 -3
- package/dist/chunk-LRD7BHAT.cjs.map +1 -0
- package/dist/{chunk-CJBN5HIS.js → chunk-P5HOXWYL.js} +3 -3
- package/dist/{chunk-CJBN5HIS.js.map → chunk-P5HOXWYL.js.map} +1 -1
- package/dist/{chunk-5Y7JRY7Y.js → chunk-P5ST47VY.js} +3 -3
- package/dist/{chunk-5Y7JRY7Y.js.map → chunk-P5ST47VY.js.map} +1 -1
- package/dist/{chunk-A7NCSZAP.cjs → chunk-QZTNTP75.cjs} +17 -25
- package/dist/chunk-QZTNTP75.cjs.map +1 -0
- package/dist/{chunk-ENDP7JER.js → chunk-VW2C2AZL.js} +3 -3
- package/dist/{chunk-ENDP7JER.js.map → chunk-VW2C2AZL.js.map} +1 -1
- package/dist/{chunk-JLTXVW25.cjs → chunk-W27VK32R.cjs} +78 -78
- package/dist/{chunk-JLTXVW25.cjs.map → chunk-W27VK32R.cjs.map} +1 -1
- package/dist/{chunk-PJJY6CYL.cjs → chunk-WV4IDVDQ.cjs} +11 -11
- package/dist/{chunk-PJJY6CYL.cjs.map → chunk-WV4IDVDQ.cjs.map} +1 -1
- package/dist/{chunk-NYHGG2IA.cjs → chunk-ZV3BKLFY.cjs} +3 -3
- package/dist/{chunk-NYHGG2IA.cjs.map → chunk-ZV3BKLFY.cjs.map} +1 -1
- package/dist/collaboration/index.cjs +9 -9
- package/dist/collaboration/index.js +1 -1
- package/dist/connect/docx.cjs +4 -4
- package/dist/connect/docx.js +3 -3
- package/dist/connect/index.cjs +183 -146
- package/dist/connect/index.cjs.map +1 -1
- package/dist/connect/index.d.ts +1 -1
- package/dist/connect/index.js +134 -98
- package/dist/connect/index.js.map +1 -1
- package/dist/connection/ConnectedSettings.d.ts +42 -7
- package/dist/document-tools/index.cjs +1 -1
- package/dist/document-tools/index.js +1 -1
- package/dist/facts/fact-citations.d.ts +56 -0
- package/dist/facts/fact-table-column-resize.d.ts +18 -0
- package/dist/facts/index.cjs +194 -8
- package/dist/facts/index.cjs.map +1 -1
- package/dist/facts/index.d.ts +2 -0
- package/dist/facts/index.js +180 -5
- package/dist/facts/index.js.map +1 -1
- package/dist/files/index.cjs +1 -1
- package/dist/files/index.js +1 -1
- package/dist/home/index.cjs +17 -17
- package/dist/home/index.js +3 -3
- package/dist/index.cjs +517 -501
- package/dist/index.js +18 -18
- package/dist/settings/MoreInfo.d.ts +25 -0
- package/dist/settings/PlanCard.d.ts +1 -1
- package/dist/settings/index.cjs +79 -225
- package/dist/settings/index.cjs.map +1 -1
- package/dist/settings/index.d.ts +1 -1
- package/dist/settings/index.js +70 -215
- package/dist/settings/index.js.map +1 -1
- package/dist/shell/index.cjs +1 -1
- package/dist/shell/index.js +1 -1
- package/dist/site/index.cjs +5 -5
- package/dist/site/index.js +1 -1
- package/dist/studio/index.cjs +8 -8
- package/dist/studio/index.js +6 -6
- package/dist/workflow-canvas/index.cjs +64 -64
- package/dist/workflow-canvas/index.js +12 -12
- package/node_modules/@arbidocs/coedit/package.json +1 -1
- package/package.json +9 -4
- package/dist/chunk-A7NCSZAP.cjs.map +0 -1
- package/dist/chunk-DZYAAL4H.cjs.map +0 -1
- package/dist/chunk-H2KQ6OSU.js.map +0 -1
- package/dist/chunk-IBZJYCYM.js.map +0 -1
- package/dist/chunk-MUMH3Z6K.cjs.map +0 -1
- package/dist/chunk-OYMWV45N.js.map +0 -1
- package/dist/settings/FirmPool.d.ts +0 -82
|
@@ -6,8 +6,13 @@
|
|
|
6
6
|
* Every section takes an optional `notify` for toasts and renders the default test ids of its
|
|
7
7
|
* part. Anything the hooks cannot know (the recovery-key download, the billing link of a blocked
|
|
8
8
|
* deletion, the password policy) is a prop.
|
|
9
|
+
*
|
|
10
|
+
* The hooks talk to the account client in scope (`useAccountClient` from `@arbidocs/react`):
|
|
11
|
+
* `ConnectionProvider` provides one over the SDK; a host with its own session and API client
|
|
12
|
+
* mounts its own `AccountClientProvider` (as ARBI-frontend does), and these sections work alike.
|
|
9
13
|
*/
|
|
10
14
|
import { type ReactNode } from 'react';
|
|
15
|
+
import { type IdentityStatus } from '@arbidocs/react/ui';
|
|
11
16
|
import { type IdentityVerificationLabels } from '../settings/IdentityVerification';
|
|
12
17
|
import { type EmailNotificationCategoryDef } from '../settings/account-views';
|
|
13
18
|
export type SettingsNotify = (message: string, kind: 'success' | 'error') => void;
|
|
@@ -15,15 +20,23 @@ export interface ConnectedProfileCardProps {
|
|
|
15
20
|
notify?: SettingsNotify;
|
|
16
21
|
/** Section heading; default `Profile`. */
|
|
17
22
|
title?: ReactNode;
|
|
23
|
+
/** Classes of the initials avatar shown without a picture (e.g. the host's per-user colour). */
|
|
24
|
+
avatarClassName?: string;
|
|
25
|
+
/** More of the section under the card (e.g. `ConnectedIdentityVerification`). */
|
|
26
|
+
children?: ReactNode;
|
|
18
27
|
}
|
|
19
28
|
/** Avatar, editable name and email change of the signed-in user (`ProfileCard`). */
|
|
20
|
-
export declare function ConnectedProfileCard({ notify, title }: ConnectedProfileCardProps): import("react").JSX.Element;
|
|
29
|
+
export declare function ConnectedProfileCard({ notify, title, avatarClassName, children, }: ConnectedProfileCardProps): import("react").JSX.Element;
|
|
21
30
|
export interface ConnectedIdentityVerificationProps {
|
|
22
31
|
notify?: SettingsNotify;
|
|
23
32
|
labels?: Partial<IdentityVerificationLabels>;
|
|
33
|
+
/** Open the host's billing (card, plan) when the fee cannot be charged. */
|
|
34
|
+
onManageBilling?: () => void;
|
|
35
|
+
/** The host's price format; default `formatIdentityPrice`. */
|
|
36
|
+
formatPrice?: (status: IdentityStatus) => string;
|
|
24
37
|
}
|
|
25
|
-
/** The ID check card and its dialog, bound to the
|
|
26
|
-
export declare function ConnectedIdentityVerification({ notify, labels, }: ConnectedIdentityVerificationProps): import("react").JSX.Element;
|
|
38
|
+
/** The ID check card and its dialog, bound to the account. Renders nothing when not offered. */
|
|
39
|
+
export declare function ConnectedIdentityVerification({ notify, labels, onManageBilling, formatPrice, }: ConnectedIdentityVerificationProps): import("react").JSX.Element;
|
|
27
40
|
export interface ConnectedRequireVerifiedProps {
|
|
28
41
|
children?: ReactNode;
|
|
29
42
|
labels?: Partial<IdentityVerificationLabels>;
|
|
@@ -32,6 +45,19 @@ export interface ConnectedRequireVerifiedProps {
|
|
|
32
45
|
export declare function ConnectedRequireVerified({ children, labels }: ConnectedRequireVerifiedProps): import("react").JSX.Element;
|
|
33
46
|
/** The default password policy: 8 characters, an uppercase letter or symbol, a digit. */
|
|
34
47
|
export declare function defaultUnmetPasswordRequirement(password: string): string | null;
|
|
48
|
+
export interface ConnectedPasswordChangeDialogProps {
|
|
49
|
+
open: boolean;
|
|
50
|
+
onClose: () => void;
|
|
51
|
+
notify?: SettingsNotify;
|
|
52
|
+
/** The host's password policy; default is {@link defaultUnmetPasswordRequirement}. */
|
|
53
|
+
getUnmetRequirement?: (password: string) => string | null;
|
|
54
|
+
/** After signing in with a recovery key: set a new password, no current one asked for. */
|
|
55
|
+
recoveryMode?: boolean;
|
|
56
|
+
/** Recovery finished: continue into the app (recovery closes itself, with no success screen). */
|
|
57
|
+
onRecoveryComplete?: () => void;
|
|
58
|
+
}
|
|
59
|
+
/** Change (or, in recovery mode, set) the master password (`PasswordChangeDialog`). */
|
|
60
|
+
export declare function ConnectedPasswordChangeDialog({ open, onClose, notify, getUnmetRequirement, recoveryMode, onRecoveryComplete, }: ConnectedPasswordChangeDialogProps): import("react").JSX.Element;
|
|
35
61
|
export interface ConnectedSecuritySectionProps {
|
|
36
62
|
notify?: SettingsNotify;
|
|
37
63
|
/** The host's password policy; default is {@link defaultUnmetPasswordRequirement}. */
|
|
@@ -39,7 +65,7 @@ export interface ConnectedSecuritySectionProps {
|
|
|
39
65
|
/** Extra rows under "Change password" (e.g. "Save recovery key"). */
|
|
40
66
|
children?: ReactNode;
|
|
41
67
|
}
|
|
42
|
-
/** The Security card: "Change password" and the dialog behind it
|
|
68
|
+
/** The Security card: "Change password" and the dialog behind it. */
|
|
43
69
|
export declare function ConnectedSecuritySection({ notify, getUnmetRequirement, children, }: ConnectedSecuritySectionProps): import("react").JSX.Element;
|
|
44
70
|
export interface ConnectedNotificationPreferencesProps {
|
|
45
71
|
/** Categories to offer; default {@link EMAIL_NOTIFICATION_CATEGORIES}. */
|
|
@@ -60,11 +86,20 @@ export declare function ConnectedSessionsRow({ notify, confirm, renderSessionIco
|
|
|
60
86
|
export interface ConnectedLogoutDialogProps {
|
|
61
87
|
open: boolean;
|
|
62
88
|
onClose: () => void;
|
|
63
|
-
|
|
89
|
+
/** Offer "All sessions"; default true (e.g. false for agent accounts). */
|
|
90
|
+
canLogoutAll?: boolean;
|
|
91
|
+
/**
|
|
92
|
+
* Ask before signing out (e.g. unsent work kept only on this device); resolve `false` to stay
|
|
93
|
+
* signed in. Default: sign out at once.
|
|
94
|
+
*/
|
|
95
|
+
confirmSignOut?: () => Promise<boolean> | boolean;
|
|
64
96
|
renderSessionIcon?: (status: string) => ReactNode;
|
|
65
97
|
}
|
|
66
|
-
/**
|
|
67
|
-
|
|
98
|
+
/**
|
|
99
|
+
* Sign out of this device or all devices (`LogoutDialog`), listing the active sessions. "All
|
|
100
|
+
* sessions" must reach the server, so it is disabled offline; "This session" always works.
|
|
101
|
+
*/
|
|
102
|
+
export declare function ConnectedLogoutDialog({ open, onClose, canLogoutAll, confirmSignOut, renderSessionIcon, }: ConnectedLogoutDialogProps): import("react").JSX.Element;
|
|
68
103
|
export interface ConnectedDangerZoneProps {
|
|
69
104
|
notify?: SettingsNotify;
|
|
70
105
|
/** Link to the billing page for a deletion blocked by an active subscription. */
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
var chunk6MG62I5B_cjs = require('../chunk-6MG62I5B.cjs');
|
|
5
|
-
var chunkUWIILWDI_cjs = require('../chunk-UWIILWDI.cjs');
|
|
6
5
|
var chunkJH6JTI76_cjs = require('../chunk-JH6JTI76.cjs');
|
|
6
|
+
var chunkUWIILWDI_cjs = require('../chunk-UWIILWDI.cjs');
|
|
7
7
|
require('../chunk-ULWRNGGE.cjs');
|
|
8
8
|
require('../chunk-DES3K4SD.cjs');
|
|
9
9
|
var lucideReact = require('lucide-react');
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
export { AdoptSignatureDialog, TYPED_SIGNATURE_STYLE } from '../chunk-EQB3WELX.js';
|
|
3
|
-
import { ViewerStatusNote } from '../chunk-6HKLTYNN.js';
|
|
4
3
|
export { SignDocumentDialog } from '../chunk-2YOVK524.js';
|
|
4
|
+
import { ViewerStatusNote } from '../chunk-6HKLTYNN.js';
|
|
5
5
|
import '../chunk-TX2ZICS7.js';
|
|
6
6
|
import '../chunk-VUNV25KB.js';
|
|
7
7
|
import { PencilLine, FileText, PenLine, Users, Send, FilePenLine, Download } from 'lucide-react';
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/** One cited passage — mirrors the backend `CitedChunk`. */
|
|
2
|
+
export interface FactCitedChunk {
|
|
3
|
+
chunk_id: string;
|
|
4
|
+
page?: number | null;
|
|
5
|
+
}
|
|
6
|
+
/** One cited document — mirrors the backend `CitedDocument`. */
|
|
7
|
+
export interface FactCitedDoc {
|
|
8
|
+
doc_ext_id: string;
|
|
9
|
+
/** The document version quoted; missing = its current version (the backend pins it on save). */
|
|
10
|
+
version?: number | null;
|
|
11
|
+
chunks: FactCitedChunk[];
|
|
12
|
+
}
|
|
13
|
+
export type FactCitations = FactCitedDoc[];
|
|
14
|
+
type MaybeCitations = FactCitations | null | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* Adopt a server citation list as a local one. The generated `CitedDocument`
|
|
17
|
+
* leaves `chunks` optional (a whole-document source may omit it); everything in
|
|
18
|
+
* the UI wants it present, so it is filled in ONCE, here, where server facts
|
|
19
|
+
* enter the composer — rather than casting at every call site.
|
|
20
|
+
*/
|
|
21
|
+
export declare function toFactCitations(citations: {
|
|
22
|
+
doc_ext_id: string;
|
|
23
|
+
version?: number | null;
|
|
24
|
+
chunks?: FactCitedChunk[] | null;
|
|
25
|
+
}[] | null | undefined): FactCitations | null;
|
|
26
|
+
/** A whole-document source: the picker ticked it without choosing passages. */
|
|
27
|
+
export declare function isWholeDoc(doc: FactCitedDoc): boolean;
|
|
28
|
+
export declare function docIdsOf(citations: MaybeCitations): string[];
|
|
29
|
+
export declare function chunkIdsOf(citations: MaybeCitations): string[];
|
|
30
|
+
export declare function hasChunk(citations: MaybeCitations, chunkId: string): boolean;
|
|
31
|
+
/** Cite a whole document. No-op when it is already a source. */
|
|
32
|
+
export declare function withDoc(citations: MaybeCitations, docExtId: string): FactCitations;
|
|
33
|
+
/** Drop a document and every passage cited from it. Null once nothing remains. */
|
|
34
|
+
export declare function withoutDoc(citations: MaybeCitations, docExtId: string): FactCitations | null;
|
|
35
|
+
/** Cite a passage; creates the document entry if needed. No-op on a duplicate. */
|
|
36
|
+
export declare function withChunk(citations: MaybeCitations, docExtId: string, chunk: FactCitedChunk): FactCitations;
|
|
37
|
+
/**
|
|
38
|
+
* Un-cite a passage. By default the document STAYS a source (as a whole-doc
|
|
39
|
+
* reference) when it loses its last passage — removing the source itself is a
|
|
40
|
+
* separate act (`withoutDoc`). Pass `keepDoc: false` to drop it too.
|
|
41
|
+
*/
|
|
42
|
+
export declare function withoutChunk(citations: MaybeCitations, chunkId: string, opts?: {
|
|
43
|
+
keepDoc?: boolean;
|
|
44
|
+
}): FactCitations | null;
|
|
45
|
+
/**
|
|
46
|
+
* Build a fact's clean text + citations from an assistant answer.
|
|
47
|
+
*
|
|
48
|
+
* @param content Answer markdown, WITH `[text](#cite-N)` markers.
|
|
49
|
+
* @param activeCitations `model_citations`: citation number → chunk_ids.
|
|
50
|
+
* @param citationData Retrieval chunks, keyed by file (holds the metadata).
|
|
51
|
+
*/
|
|
52
|
+
export declare function buildFactCitations(content: string, activeCitations: Record<string, string[]> | null, citationData: Record<string, unknown>): {
|
|
53
|
+
text: string;
|
|
54
|
+
citations: FactCitations | null;
|
|
55
|
+
};
|
|
56
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Drag-to-resize columns for the tables rendered inside the fact editor's
|
|
3
|
+
* MDXEditor.
|
|
4
|
+
*
|
|
5
|
+
* MDXEditor's table has no built-in column resizing, but it renders a
|
|
6
|
+
* `<colgroup>` of `<col>` elements — one per column plus the leading/trailing
|
|
7
|
+
* tool columns. Column widths are honoured by setting a width on those `<col>`
|
|
8
|
+
* elements and switching the table to `table-layout: fixed`. MDXEditor only
|
|
9
|
+
* manages each `<col>`'s `className` (alignment), so an inline `style.width`
|
|
10
|
+
* survives typing edits; it only resets when the column count changes (a new
|
|
11
|
+
* `<colgroup>` is rendered) — acceptable for an editing-time affordance, since
|
|
12
|
+
* markdown tables can't store widths anyway.
|
|
13
|
+
*
|
|
14
|
+
* Wiring: attach once to the editor container. Listeners are delegated, so
|
|
15
|
+
* they work for tables that appear/disappear as the user edits. Returns a
|
|
16
|
+
* cleanup that removes every listener and any lingering drag state.
|
|
17
|
+
*/
|
|
18
|
+
export declare function enableFactTableColumnResize(container: HTMLElement): () => void;
|
package/dist/facts/index.cjs
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var chunk2WLXQGWC_cjs = require('../chunk-2WLXQGWC.cjs');
|
|
5
4
|
var chunk5FYU7ZIU_cjs = require('../chunk-5FYU7ZIU.cjs');
|
|
5
|
+
var chunk2WLXQGWC_cjs = require('../chunk-2WLXQGWC.cjs');
|
|
6
6
|
var chunkOUW6G4O2_cjs = require('../chunk-OUW6G4O2.cjs');
|
|
7
7
|
var chunkVPPX5XUF_cjs = require('../chunk-VPPX5XUF.cjs');
|
|
8
8
|
var chunkRC25WMVB_cjs = require('../chunk-RC25WMVB.cjs');
|
|
9
9
|
var chunkV4ISCZJ7_cjs = require('../chunk-V4ISCZJ7.cjs');
|
|
10
10
|
var chunk2EI7NCUA_cjs = require('../chunk-2EI7NCUA.cjs');
|
|
11
11
|
var chunkC2CWWEHO_cjs = require('../chunk-C2CWWEHO.cjs');
|
|
12
|
-
var
|
|
12
|
+
var chunkBIXHB4LV_cjs = require('../chunk-BIXHB4LV.cjs');
|
|
13
13
|
var chunk7RGLTF76_cjs = require('../chunk-7RGLTF76.cjs');
|
|
14
14
|
require('../chunk-FX3K6LNZ.cjs');
|
|
15
15
|
var chunkPPCATBOY_cjs = require('../chunk-PPCATBOY.cjs');
|
|
@@ -21,6 +21,7 @@ var lucideReact = require('lucide-react');
|
|
|
21
21
|
var ui = require('@arbidocs/react/ui');
|
|
22
22
|
var jsxRuntime = require('react/jsx-runtime');
|
|
23
23
|
var react = require('react');
|
|
24
|
+
var artifacts = require('@arbidocs/react/artifacts');
|
|
24
25
|
|
|
25
26
|
var DEFAULT_FACT_COLUMN_LABELS = {
|
|
26
27
|
inChatHeaderTooltip: "Facts added to this chat are always in context for this chat",
|
|
@@ -804,7 +805,7 @@ function factDateSpanToFields(dateStart, dateEnd, timezone) {
|
|
|
804
805
|
}
|
|
805
806
|
function factDateFieldsToSpan(fields) {
|
|
806
807
|
if (!fields.date) return { date: null, date_end: null, timezone: null };
|
|
807
|
-
const tz = fields.timezone ||
|
|
808
|
+
const tz = fields.timezone || chunkBIXHB4LV_cjs.detectTimeZone();
|
|
808
809
|
const startIso = fields.time ? zonedPartsToIso(fields.date, fields.time, tz) : `${fields.date}T00:00:00.000Z`;
|
|
809
810
|
let endIso;
|
|
810
811
|
if (fields.endDate) {
|
|
@@ -989,7 +990,7 @@ function MonthCalendar({
|
|
|
989
990
|
function FactDateInput({ value, onChange, idPrefix, labels, testIds }) {
|
|
990
991
|
const l = { ...DEFAULT_FACT_DATE_INPUT_LABELS, ...labels };
|
|
991
992
|
const [open, setOpen] = react.useState(false);
|
|
992
|
-
const timezones = react.useMemo(() =>
|
|
993
|
+
const timezones = react.useMemo(() => chunkBIXHB4LV_cjs.listTimeZones(), []);
|
|
993
994
|
const timezoneListId = `${idPrefix}-timezone-options`;
|
|
994
995
|
const span = factDateFieldsToSpan(value);
|
|
995
996
|
const summary = value.time || value.endTime ? summarizeWithTimes(value) : chunkVPPX5XUF_cjs.formatSpan(span.date, span.date_end, span.timezone);
|
|
@@ -997,7 +998,7 @@ function FactDateInput({ value, onChange, idPrefix, labels, testIds }) {
|
|
|
997
998
|
const setStartTime = (time) => onChange({
|
|
998
999
|
...value,
|
|
999
1000
|
time,
|
|
1000
|
-
timezone: time ? value.timezone ||
|
|
1001
|
+
timezone: time ? value.timezone || chunkBIXHB4LV_cjs.detectTimeZone() : "",
|
|
1001
1002
|
endTime: time ? value.endTime : ""
|
|
1002
1003
|
});
|
|
1003
1004
|
const setEndTime = (endTime) => onChange({
|
|
@@ -1062,7 +1063,7 @@ function FactDateInput({ value, onChange, idPrefix, labels, testIds }) {
|
|
|
1062
1063
|
list: timezoneListId,
|
|
1063
1064
|
value: value.timezone,
|
|
1064
1065
|
onChange: (e) => onChange({ ...value, timezone: e.target.value }),
|
|
1065
|
-
placeholder:
|
|
1066
|
+
placeholder: chunkBIXHB4LV_cjs.detectTimeZone(),
|
|
1066
1067
|
className: "h-8 text-xs",
|
|
1067
1068
|
"data-testid": `${idPrefix}-timezone`
|
|
1068
1069
|
}
|
|
@@ -1109,7 +1110,7 @@ var DEFAULT_FACT_SOURCE_GROUP_LABELS = {
|
|
|
1109
1110
|
};
|
|
1110
1111
|
function FactSourceGroup({
|
|
1111
1112
|
docId,
|
|
1112
|
-
document,
|
|
1113
|
+
document: document2,
|
|
1113
1114
|
isViewing,
|
|
1114
1115
|
onRemove,
|
|
1115
1116
|
children,
|
|
@@ -1127,7 +1128,7 @@ function FactSourceGroup({
|
|
|
1127
1128
|
"data-slot": "fact-source-group",
|
|
1128
1129
|
children: [
|
|
1129
1130
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1.5 px-1 text-sm", children: [
|
|
1130
|
-
|
|
1131
|
+
document2,
|
|
1131
1132
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1" }),
|
|
1132
1133
|
onRemove && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1133
1134
|
"button",
|
|
@@ -2113,6 +2114,180 @@ function FactSearchResult({
|
|
|
2113
2114
|
)
|
|
2114
2115
|
] });
|
|
2115
2116
|
}
|
|
2117
|
+
function toFactCitations(citations) {
|
|
2118
|
+
if (!citations) return null;
|
|
2119
|
+
return citations.map((d) => ({
|
|
2120
|
+
doc_ext_id: d.doc_ext_id,
|
|
2121
|
+
...d.version ? { version: d.version } : {},
|
|
2122
|
+
chunks: d.chunks ?? []
|
|
2123
|
+
}));
|
|
2124
|
+
}
|
|
2125
|
+
function isWholeDoc(doc) {
|
|
2126
|
+
return doc.chunks.length === 0;
|
|
2127
|
+
}
|
|
2128
|
+
function docIdsOf(citations) {
|
|
2129
|
+
return (citations ?? []).map((d) => d.doc_ext_id);
|
|
2130
|
+
}
|
|
2131
|
+
function chunkIdsOf(citations) {
|
|
2132
|
+
return (citations ?? []).flatMap((d) => d.chunks.map((c) => c.chunk_id));
|
|
2133
|
+
}
|
|
2134
|
+
function hasChunk(citations, chunkId) {
|
|
2135
|
+
return (citations ?? []).some((d) => d.chunks.some((c) => c.chunk_id === chunkId));
|
|
2136
|
+
}
|
|
2137
|
+
function withDoc(citations, docExtId) {
|
|
2138
|
+
const list = citations ?? [];
|
|
2139
|
+
if (list.some((d) => d.doc_ext_id === docExtId)) return list;
|
|
2140
|
+
return [...list, { doc_ext_id: docExtId, chunks: [] }];
|
|
2141
|
+
}
|
|
2142
|
+
function withoutDoc(citations, docExtId) {
|
|
2143
|
+
const remaining = (citations ?? []).filter((d) => d.doc_ext_id !== docExtId);
|
|
2144
|
+
return remaining.length ? remaining : null;
|
|
2145
|
+
}
|
|
2146
|
+
function withChunk(citations, docExtId, chunk) {
|
|
2147
|
+
const list = citations ?? [];
|
|
2148
|
+
const idx = list.findIndex((d) => d.doc_ext_id === docExtId);
|
|
2149
|
+
if (idx === -1) return [...list, { doc_ext_id: docExtId, chunks: [chunk] }];
|
|
2150
|
+
const doc = list[idx];
|
|
2151
|
+
if (doc.chunks.some((c) => c.chunk_id === chunk.chunk_id)) return list;
|
|
2152
|
+
const next = [...list];
|
|
2153
|
+
next[idx] = { ...doc, chunks: [...doc.chunks, chunk] };
|
|
2154
|
+
return next;
|
|
2155
|
+
}
|
|
2156
|
+
function withoutChunk(citations, chunkId, opts = {}) {
|
|
2157
|
+
const keepDoc = opts.keepDoc ?? true;
|
|
2158
|
+
const list = citations ?? [];
|
|
2159
|
+
if (!hasChunk(list, chunkId)) return citations ?? null;
|
|
2160
|
+
const next = [];
|
|
2161
|
+
for (const doc of list) {
|
|
2162
|
+
if (!doc.chunks.some((c) => c.chunk_id === chunkId)) {
|
|
2163
|
+
next.push(doc);
|
|
2164
|
+
continue;
|
|
2165
|
+
}
|
|
2166
|
+
const chunks = doc.chunks.filter((c) => c.chunk_id !== chunkId);
|
|
2167
|
+
if (chunks.length || keepDoc) next.push({ ...doc, chunks });
|
|
2168
|
+
}
|
|
2169
|
+
return next.length ? next : null;
|
|
2170
|
+
}
|
|
2171
|
+
function repairBoldFlanking(md) {
|
|
2172
|
+
return md.replace(/([.,;:!?"'’”)\]])(\*\*|__)(?=[A-Za-z0-9])/g, "$1$2 ");
|
|
2173
|
+
}
|
|
2174
|
+
var CHAT_LEAD_IN = /^(?:here(?:'s| is| are)|below (?:is|are)|sure|certainly)\b[^\n]*:[ \t]*(?:\n+|$)/i;
|
|
2175
|
+
function dropChatLeadIn(md) {
|
|
2176
|
+
const body = md.replace(CHAT_LEAD_IN, "");
|
|
2177
|
+
return body.trim() ? body : md;
|
|
2178
|
+
}
|
|
2179
|
+
function buildFactCitations(content, activeCitations, citationData) {
|
|
2180
|
+
const text = dropChatLeadIn(repairBoldFlanking(artifacts.unwrapCitationLinks(content)).trim()).trim();
|
|
2181
|
+
if (!activeCitations) return { text, citations: null };
|
|
2182
|
+
const chunkMeta = /* @__PURE__ */ new Map();
|
|
2183
|
+
for (const chunks of Object.values(citationData)) {
|
|
2184
|
+
if (!Array.isArray(chunks)) continue;
|
|
2185
|
+
for (const chunk of chunks) {
|
|
2186
|
+
const meta = {
|
|
2187
|
+
doc_ext_id: chunk.metadata?.doc_ext_id ?? null,
|
|
2188
|
+
page: chunk.metadata?.page_number ?? null
|
|
2189
|
+
};
|
|
2190
|
+
for (const key of [chunk.metadata?.chunk_ext_id, chunk.chunk_id]) {
|
|
2191
|
+
if (key && !chunkMeta.has(key)) chunkMeta.set(key, meta);
|
|
2192
|
+
}
|
|
2193
|
+
}
|
|
2194
|
+
}
|
|
2195
|
+
let citations = null;
|
|
2196
|
+
for (const chunkIds of Object.values(activeCitations)) {
|
|
2197
|
+
for (const chunkId of chunkIds) {
|
|
2198
|
+
const meta = chunkMeta.get(chunkId);
|
|
2199
|
+
if (!meta?.doc_ext_id) continue;
|
|
2200
|
+
citations = withChunk(citations, meta.doc_ext_id, { chunk_id: chunkId, page: meta.page });
|
|
2201
|
+
}
|
|
2202
|
+
}
|
|
2203
|
+
return { text, citations };
|
|
2204
|
+
}
|
|
2205
|
+
|
|
2206
|
+
// src/facts/fact-table-column-resize.ts
|
|
2207
|
+
var EDGE = 6;
|
|
2208
|
+
var MIN_WIDTH = 48;
|
|
2209
|
+
function enableFactTableColumnResize(container) {
|
|
2210
|
+
let drag = null;
|
|
2211
|
+
const cellFromEvent = (e) => {
|
|
2212
|
+
const el = e.target;
|
|
2213
|
+
const cell = el?.closest?.("td, th");
|
|
2214
|
+
if (!cell || cell.hasAttribute("data-tool-cell")) return null;
|
|
2215
|
+
if (!container.contains(cell)) return null;
|
|
2216
|
+
return cell;
|
|
2217
|
+
};
|
|
2218
|
+
const nearRightEdge = (cell, clientX) => {
|
|
2219
|
+
const rect = cell.getBoundingClientRect();
|
|
2220
|
+
return clientX >= rect.right - EDGE && clientX <= rect.right + 2;
|
|
2221
|
+
};
|
|
2222
|
+
const colForCell = (cell) => {
|
|
2223
|
+
const row = cell.parentElement;
|
|
2224
|
+
const table = cell.closest("table");
|
|
2225
|
+
const colgroup = table?.querySelector("colgroup");
|
|
2226
|
+
if (!row || !table || !colgroup) return null;
|
|
2227
|
+
const index = Array.prototype.indexOf.call(row.children, cell);
|
|
2228
|
+
return colgroup.children[index] ?? null;
|
|
2229
|
+
};
|
|
2230
|
+
const freezeWidths = (table) => {
|
|
2231
|
+
const colgroup = table.querySelector("colgroup");
|
|
2232
|
+
if (!colgroup) return;
|
|
2233
|
+
const ruler = table.querySelector("thead tr") ?? table.querySelector("tbody tr");
|
|
2234
|
+
const cells = ruler ? Array.from(ruler.children) : [];
|
|
2235
|
+
Array.from(colgroup.children).forEach((node, i) => {
|
|
2236
|
+
const col = node;
|
|
2237
|
+
const cell = cells[i];
|
|
2238
|
+
if (!col.style.width && cell) col.style.width = `${cell.getBoundingClientRect().width}px`;
|
|
2239
|
+
});
|
|
2240
|
+
table.style.tableLayout = "fixed";
|
|
2241
|
+
};
|
|
2242
|
+
const onPointerMove = (e) => {
|
|
2243
|
+
if (drag) {
|
|
2244
|
+
const next = Math.max(MIN_WIDTH, drag.startWidth + (e.clientX - drag.startX));
|
|
2245
|
+
drag.col.style.width = `${next}px`;
|
|
2246
|
+
e.preventDefault();
|
|
2247
|
+
return;
|
|
2248
|
+
}
|
|
2249
|
+
const cell = cellFromEvent(e);
|
|
2250
|
+
if (cell && nearRightEdge(cell, e.clientX)) {
|
|
2251
|
+
cell.style.cursor = "col-resize";
|
|
2252
|
+
} else if (cell) {
|
|
2253
|
+
cell.style.cursor = "";
|
|
2254
|
+
}
|
|
2255
|
+
};
|
|
2256
|
+
const endDrag = () => {
|
|
2257
|
+
if (!drag) return;
|
|
2258
|
+
drag = null;
|
|
2259
|
+
document.documentElement.classList.remove("fact-col-resizing");
|
|
2260
|
+
document.removeEventListener("pointermove", onPointerMove, true);
|
|
2261
|
+
document.removeEventListener("pointerup", endDrag, true);
|
|
2262
|
+
};
|
|
2263
|
+
const onPointerDown = (e) => {
|
|
2264
|
+
if (e.button !== 0) return;
|
|
2265
|
+
const cell = cellFromEvent(e);
|
|
2266
|
+
if (!cell || !nearRightEdge(cell, e.clientX)) return;
|
|
2267
|
+
const table = cell.closest("table");
|
|
2268
|
+
if (!table) return;
|
|
2269
|
+
freezeWidths(table);
|
|
2270
|
+
const col = colForCell(cell);
|
|
2271
|
+
if (!col) return;
|
|
2272
|
+
drag = {
|
|
2273
|
+
col,
|
|
2274
|
+
table,
|
|
2275
|
+
startX: e.clientX,
|
|
2276
|
+
startWidth: parseFloat(col.style.width) || cell.getBoundingClientRect().width
|
|
2277
|
+
};
|
|
2278
|
+
e.preventDefault();
|
|
2279
|
+
document.documentElement.classList.add("fact-col-resizing");
|
|
2280
|
+
document.addEventListener("pointermove", onPointerMove, true);
|
|
2281
|
+
document.addEventListener("pointerup", endDrag, true);
|
|
2282
|
+
};
|
|
2283
|
+
container.addEventListener("pointerdown", onPointerDown);
|
|
2284
|
+
container.addEventListener("pointermove", onPointerMove);
|
|
2285
|
+
return () => {
|
|
2286
|
+
endDrag();
|
|
2287
|
+
container.removeEventListener("pointerdown", onPointerDown);
|
|
2288
|
+
container.removeEventListener("pointermove", onPointerMove);
|
|
2289
|
+
};
|
|
2290
|
+
}
|
|
2116
2291
|
|
|
2117
2292
|
Object.defineProperty(exports, "DEFAULT_FACT_PASSAGES_LABELS", {
|
|
2118
2293
|
enumerable: true,
|
|
@@ -2190,11 +2365,22 @@ exports.FactsTable = FactsTable;
|
|
|
2190
2365
|
exports.FactsToolbar = FactsToolbar;
|
|
2191
2366
|
exports.FactsViewToggle = FactsViewToggle;
|
|
2192
2367
|
exports.ISO_DATE_FILTER_PARAMS = ISO_DATE_FILTER_PARAMS;
|
|
2368
|
+
exports.buildFactCitations = buildFactCitations;
|
|
2369
|
+
exports.chunkIdsOf = chunkIdsOf;
|
|
2193
2370
|
exports.createFactColumns = createFactColumns;
|
|
2371
|
+
exports.docIdsOf = docIdsOf;
|
|
2372
|
+
exports.enableFactTableColumnResize = enableFactTableColumnResize;
|
|
2194
2373
|
exports.factDateFieldsToSpan = factDateFieldsToSpan;
|
|
2195
2374
|
exports.factDateSpanToFields = factDateSpanToFields;
|
|
2375
|
+
exports.hasChunk = hasChunk;
|
|
2376
|
+
exports.isWholeDoc = isWholeDoc;
|
|
2196
2377
|
exports.sourceDocCount = sourceDocCount;
|
|
2378
|
+
exports.toFactCitations = toFactCitations;
|
|
2197
2379
|
exports.toFactRow = toFactRow;
|
|
2198
2380
|
exports.toFactRows = toFactRows;
|
|
2381
|
+
exports.withChunk = withChunk;
|
|
2382
|
+
exports.withDoc = withDoc;
|
|
2383
|
+
exports.withoutChunk = withoutChunk;
|
|
2384
|
+
exports.withoutDoc = withoutDoc;
|
|
2199
2385
|
//# sourceMappingURL=index.cjs.map
|
|
2200
2386
|
//# sourceMappingURL=index.cjs.map
|