@epam/ai-dial-quotations 1.2.0-dev.287 → 1.2.0-dev.288
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/index.css +1 -1
- package/index.d.ts +1 -1
- package/index.d.ts.map +1 -1
- package/index.js +162 -150
- package/package.json +2 -2
- package/utils/annotation.d.ts +16 -8
- package/utils/annotation.d.ts.map +1 -1
package/index.css
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
._card_1kph1_1{background:var(--cc-card-bg,var(--bg-layer-raised,#fcfcfc))}._quote_1kph1_5{color:var(--cc-quote-text,var(--text-secondary,#57647a))}._title_1kph1_9{color:var(--cc-title-text,var(--text-primary,#161b2d))}._switcher_1kph1_13{color:var(--cc-switcher-text,var(--text-secondary,#57647a))}._sourceName_1kph1_17{color:var(--cc-source-name-text,var(--text-primary,#161b2d))}td ._trigger_1ud83_1,th ._trigger_1ud83_1{max-width:100%;margin-inline-start:0}td ._trigger_1ud83_1>*,th ._trigger_1ud83_1>*{min-width:0;max-width:100%}
|
|
2
|
-
/*$vite$:1*/.visible{visibility:visible}.collapse{visibility:collapse}.fixed{position:fixed}.absolute{position:absolute}.mb-1\.5{margin-bottom:.375rem}.mb-3{margin-bottom:.75rem}.ms-1{margin-inline-start:.25rem}.line-clamp-6{display:-webkit-box;overflow:hidden;-webkit-box-orient:vertical;-webkit-line-clamp:6}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table-cell{display:table-cell}.table-row{display:table-row}.hidden{display:none}.max-h-\[min\(20rem\2c 50vh\)\]{max-height:min(20rem,50vh)}.w-\[400px\]{width:400px}.w-full{width:100%}.min-w-0{min-width:0}.max-w-\[240px\]{max-width:240px}.max-w-full{max-width:100%}.shrink{flex-shrink:1}.shrink-0{flex-shrink:0}.resize{resize:both}.flex-col{flex-direction:column}.items-start{align-items:flex-start}.items-center{align-items:center}.justify-start{justify-content:flex-start}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.overflow-y-auto{overflow-y:auto}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.break-words{overflow-wrap:break-word}.\!rounded-none{border-radius:0!important}.rounded-lg{border-radius:.5rem}.\!bg-transparent{background-color:transparent!important}.\!p-0{padding:0!important}.p-4{padding:1rem}.ps-\[1\.5em\]{padding-inline-start:1.5em}.align-middle{vertical-align:middle}.\!shadow-none{--tw-shadow:0 0 #0000!important;--tw-shadow-colored:0 0 #0000!important;box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)!important}.shadow-lg{--tw-shadow:0 8px 44px 0 var(--shadow-lg,#2764d914);--tw-shadow-colored:0 8px 44px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.\[overflow-wrap\:anywhere\]{overflow-wrap:anywhere}.\[text-wrap\:pretty\]{text-wrap:pretty}.last\:mb-0:last-child{margin-bottom:0}.rtl\:scale-x-\[-1\]:where([dir=rtl],[dir=rtl] *){--tw-scale-x:-1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}
|
|
2
|
+
/*$vite$:1*/.visible{visibility:visible}.collapse{visibility:collapse}.fixed{position:fixed}.absolute{position:absolute}.mb-1\.5{margin-bottom:.375rem}.mb-3{margin-bottom:.75rem}.ms-1{margin-inline-start:.25rem}.line-clamp-6{display:-webkit-box;overflow:hidden;-webkit-box-orient:vertical;-webkit-line-clamp:6}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table-cell{display:table-cell}.table-row{display:table-row}.hidden{display:none}.max-h-\[min\(20rem\2c 50vh\)\]{max-height:min(20rem,50vh)}.w-\[400px\]{width:400px}.w-full{width:100%}.min-w-0{min-width:0}.max-w-\[240px\]{max-width:240px}.max-w-full{max-width:100%}.shrink{flex-shrink:1}.shrink-0{flex-shrink:0}.resize{resize:both}.flex-col{flex-direction:column}.items-start{align-items:flex-start}.items-center{align-items:center}.justify-start{justify-content:flex-start}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.overflow-y-auto{overflow-y:auto}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.break-words{overflow-wrap:break-word}.\!rounded-none{border-radius:0!important}.rounded-lg{border-radius:.5rem}.\!bg-transparent{background-color:transparent!important}.\!p-0{padding:0!important}.p-4{padding:1rem}.ps-\[1\.5em\]{padding-inline-start:1.5em}.align-middle{vertical-align:middle}.ordinal{--tw-ordinal:ordinal;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.\!shadow-none{--tw-shadow:0 0 #0000!important;--tw-shadow-colored:0 0 #0000!important;box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)!important}.shadow-lg{--tw-shadow:0 8px 44px 0 var(--shadow-lg,#2764d914);--tw-shadow-colored:0 8px 44px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.\[overflow-wrap\:anywhere\]{overflow-wrap:anywhere}.\[text-wrap\:pretty\]{text-wrap:pretty}.last\:mb-0:last-child{margin-bottom:0}.rtl\:scale-x-\[-1\]:where([dir=rtl],[dir=rtl] *){--tw-scale-x:-1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}
|
package/index.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export { useCitationMarkdownComponents } from './hooks/useCitationMarkdownCompon
|
|
|
12
12
|
export type { UseCitationMarkdownComponentsCallbacks } from './hooks/useCitationMarkdownComponents/useCitationMarkdownComponents';
|
|
13
13
|
export { gatherSameSourceAnnotations, groupAnnotations, groupAnnotationsByCitId, groupAnnotationsBySource, } from './utils/group-annotations-by-source';
|
|
14
14
|
export type { AnnotationGroup } from './utils/group-annotations-by-source';
|
|
15
|
-
export { annotationHighlightId, annotationsToPdfHighlights, annotationToOfficeHighlightLocations, getAnnotationPdfPage, isDocxRangeSelector, isExcelRcRangeSelector, isPptxRangeSelector, resolveMessageAnnotations, } from './utils/annotation';
|
|
15
|
+
export { annotationHighlightId, annotationHighlightIds, annotationsToPdfHighlights, annotationToOfficeHighlightLocations, getAnnotationPdfPage, isDocxRangeSelector, isExcelRcRangeSelector, isPptxRangeSelector, resolveMessageAnnotations, } from './utils/annotation';
|
|
16
16
|
export type { DocxOfficeHighlightLocation, DocxTableRowOfficeHighlightLocation, ExcelOfficeHighlightLocation, OfficeHighlightLocation, PptxOfficeHighlightLocation, PptxTableRowOfficeHighlightLocation, } from './models/office-highlight';
|
|
17
17
|
export { injectCitationSentinels, replaceSentinelsInChildren, stripCitTagsWhileStreaming, } from './utils/citation-injection';
|
|
18
18
|
export { isReferenceOnlyAttachment, parsePdfPageReference, getReferenceAttachmentGroups, } from './utils/reference-attachment';
|
package/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAA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AAoB,CAAC;AAC5B,YAAY,EACV,2BAA2B,EAC3B,mCAAmC,EACnC,4BAA4B,EAC5B,uBAAuB,EACvB,2BAA2B,EAC3B,mCAAmC,GACpC,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EACL,uBAAuB,EACvB,0BAA0B,EAC1B,0BAA0B,GAC3B,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EACL,yBAAyB,EACzB,qBAAqB,EACrB,4BAA4B,GAC7B,MAAM,8BAA8B,CAAC;AACtC,YAAY,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC"}
|
package/index.js
CHANGED
|
@@ -1,55 +1,55 @@
|
|
|
1
1
|
import { MIMEType as e, MarkdownRenderer as t, buildCssVars as n, isAnnotationSelector as r, mergeClasses as i, normalizePersistedHtmlTagAttachmentType as a, normalizeRawAnnotations as o } from "@epam/ai-dial-chat-shared";
|
|
2
2
|
import { DIAL_KIT_ICON_STROKE as s, DialItemType as c, Dropdown as l, ElementSize as u, EllipsisTooltip as d, FileIcon as f, GhostIconButton as p, LinkButton as m, NeutralButton as h, PrimaryButton as g } from "@epam/ai-dial-ui-kit";
|
|
3
3
|
import { IconChevronLeft as _, IconChevronRight as v } from "@tabler/icons-react";
|
|
4
|
-
import { createContext as y, useCallback as b, useContext as x, useEffect as S, useId as ee, useLayoutEffect as
|
|
5
|
-
import { Fragment as
|
|
4
|
+
import { createContext as y, useCallback as b, useContext as x, useEffect as S, useId as ee, useLayoutEffect as C, useMemo as w, useRef as T, useState as E } from "react";
|
|
5
|
+
import { Fragment as D, jsx as O, jsxs as k } from "react/jsx-runtime";
|
|
6
6
|
//#region src/constants/public-class-names.ts
|
|
7
|
-
var
|
|
7
|
+
var A = {
|
|
8
8
|
citationCard: "dial-quotations-citation-card",
|
|
9
9
|
citationDropdown: "dial-quotations-citation-dropdown",
|
|
10
10
|
citationMarker: "dial-quotations-citation-marker"
|
|
11
|
-
},
|
|
11
|
+
}, j = (e) => {
|
|
12
12
|
try {
|
|
13
13
|
return decodeURIComponent(e);
|
|
14
14
|
} catch {
|
|
15
15
|
return e;
|
|
16
16
|
}
|
|
17
|
-
},
|
|
17
|
+
}, M = (e) => {
|
|
18
18
|
try {
|
|
19
19
|
let t = new URL(e);
|
|
20
|
-
return t.pathname.split("/").map((e) =>
|
|
20
|
+
return t.pathname.split("/").map((e) => j(e)).filter(Boolean).at(-1) ?? t.hostname;
|
|
21
21
|
} catch {
|
|
22
|
-
return e.split("/").map((e) =>
|
|
22
|
+
return e.split("/").map((e) => j(e)).filter(Boolean).at(-1) ?? e;
|
|
23
23
|
}
|
|
24
|
-
},
|
|
25
|
-
let t = e == null ? null :
|
|
24
|
+
}, N = /\.([a-z0-9]{1,10})$/i, P = (e) => {
|
|
25
|
+
let t = e == null ? null : N.exec(e.trim());
|
|
26
26
|
return t == null ? void 0 : `.${t[1].toLowerCase()}`;
|
|
27
|
-
},
|
|
27
|
+
}, te = (e) => {
|
|
28
28
|
let t = e.body?.source?.attachment, n = t?.url;
|
|
29
|
-
return (n == null ? void 0 :
|
|
30
|
-
},
|
|
29
|
+
return (n == null ? void 0 : P(M(n))) ?? P(t?.title);
|
|
30
|
+
}, F = (e, t) => e.body?.source?.attachment?.title ?? M(t), I = (e) => {
|
|
31
31
|
let t = e.target?.selector;
|
|
32
32
|
return t?.type === "html_tag" ? t : void 0;
|
|
33
|
-
},
|
|
33
|
+
}, L = (e) => I(e) != null, R = (e) => {
|
|
34
34
|
let t = /* @__PURE__ */ new Map();
|
|
35
35
|
for (let n of e) {
|
|
36
|
-
if (
|
|
36
|
+
if (L(n)) continue;
|
|
37
37
|
let e = n.body?.source?.attachment?.url;
|
|
38
38
|
if (e == null) continue;
|
|
39
39
|
let r = t.get(e);
|
|
40
40
|
r ? r.annotations.push(n) : t.set(e, {
|
|
41
41
|
groupKey: e,
|
|
42
42
|
sourceUrl: e,
|
|
43
|
-
sourceName:
|
|
43
|
+
sourceName: F(n, e),
|
|
44
44
|
annotations: [n],
|
|
45
45
|
primaryAnnotation: n
|
|
46
46
|
});
|
|
47
47
|
}
|
|
48
48
|
return Array.from(t.values());
|
|
49
|
-
},
|
|
49
|
+
}, z = (e) => {
|
|
50
50
|
let t = /* @__PURE__ */ new Map();
|
|
51
51
|
for (let n of e) {
|
|
52
|
-
let e =
|
|
52
|
+
let e = I(n)?.id;
|
|
53
53
|
if (e == null) continue;
|
|
54
54
|
let r = n.body?.source?.attachment?.url;
|
|
55
55
|
if (r == null) continue;
|
|
@@ -57,160 +57,160 @@ var k = {
|
|
|
57
57
|
i ? i.annotations.push(n) : t.set(e, {
|
|
58
58
|
groupKey: `cit:${e}`,
|
|
59
59
|
sourceUrl: r,
|
|
60
|
-
sourceName:
|
|
60
|
+
sourceName: F(n, r),
|
|
61
61
|
annotations: [n],
|
|
62
62
|
primaryAnnotation: n
|
|
63
63
|
});
|
|
64
64
|
}
|
|
65
65
|
return Array.from(t.values());
|
|
66
|
-
},
|
|
66
|
+
}, B = (e) => [...z(e), ...R(e)], V = (e, t) => {
|
|
67
67
|
let n = e.body?.source?.attachment?.url;
|
|
68
68
|
return n == null || !t.includes(e) ? [e] : t.filter((e) => e.body?.source?.attachment?.url === n);
|
|
69
|
-
},
|
|
69
|
+
}, H = {
|
|
70
70
|
card: "_card_1kph1_1",
|
|
71
71
|
quote: "_quote_1kph1_5",
|
|
72
72
|
title: "_title_1kph1_9",
|
|
73
73
|
switcher: "_switcher_1kph1_13",
|
|
74
74
|
sourceName: "_sourceName_1kph1_17"
|
|
75
|
-
},
|
|
76
|
-
let
|
|
75
|
+
}, U = ({ group: r, activeIndex: a, onIndexChange: o, onPreview: l, onOpenInBrowser: h, isDownloadEnabled: y = !0, headerIcon: b, labels: x, typography: w, colors: D }) => {
|
|
76
|
+
let j = r.annotations.length, M = r.annotations[a] ?? r.primaryAnnotation, N = j > 1, P = M.body?.source?.attachment?.type, F = l == null || P === e.HTML || P === e.XHTML, I = F ? void 0 : te(M), L = I ?? r.sourceName, R = b ?? (I == null ? void 0 : /* @__PURE__ */ O(f, {
|
|
77
77
|
type: c.File,
|
|
78
|
-
name:
|
|
79
|
-
fileExtension:
|
|
78
|
+
name: I,
|
|
79
|
+
fileExtension: I,
|
|
80
80
|
size: 16,
|
|
81
81
|
decorative: !0,
|
|
82
82
|
className: "shrink-0"
|
|
83
|
-
})),
|
|
84
|
-
"--cc-card-bg":
|
|
85
|
-
"--cc-quote-text":
|
|
86
|
-
"--cc-title-text":
|
|
87
|
-
"--cc-switcher-text":
|
|
88
|
-
"--cc-source-name-text":
|
|
89
|
-
}),
|
|
83
|
+
})), z = w?.sourceNameClassName ?? "dial-tiny-text", B = w?.titleClassName ?? "dial-body-semi-text", V = w?.quoteClassName ?? "dial-small-text", U = w?.quoteStrongClassName ?? "dial-small-semi-text", W = w?.switcherClassName ?? "dial-tiny-text", G = n({
|
|
84
|
+
"--cc-card-bg": D?.cardBackground,
|
|
85
|
+
"--cc-quote-text": D?.quoteText,
|
|
86
|
+
"--cc-title-text": D?.titleText,
|
|
87
|
+
"--cc-switcher-text": D?.switcherText,
|
|
88
|
+
"--cc-source-name-text": D?.sourceNameText
|
|
89
|
+
}), K = M.body?.quote, q = ee(), J = T(null), [Y, X] = E(!1), [ne, re] = E(!1);
|
|
90
90
|
return S(() => {
|
|
91
|
-
|
|
92
|
-
}, [a,
|
|
93
|
-
let e =
|
|
94
|
-
if (!e ||
|
|
95
|
-
let t = () =>
|
|
91
|
+
X(!1);
|
|
92
|
+
}, [a, K]), C(() => {
|
|
93
|
+
let e = J.current;
|
|
94
|
+
if (!e || Y) return;
|
|
95
|
+
let t = () => re(e.scrollHeight > e.clientHeight + 1);
|
|
96
96
|
t();
|
|
97
97
|
let n = new ResizeObserver(t);
|
|
98
98
|
return n.observe(e), () => n.disconnect();
|
|
99
|
-
}, [
|
|
99
|
+
}, [K, Y]), /* @__PURE__ */ k("div", {
|
|
100
100
|
role: "dialog",
|
|
101
101
|
"aria-modal": "true",
|
|
102
102
|
"aria-label": x.ariaLabel,
|
|
103
|
-
style:
|
|
104
|
-
className: i("flex w-[400px] max-w-full flex-col gap-3 rounded-lg p-4 shadow-lg",
|
|
103
|
+
style: G,
|
|
104
|
+
className: i("flex w-[400px] max-w-full flex-col gap-3 rounded-lg p-4 shadow-lg", H.card, A.citationCard),
|
|
105
105
|
children: [
|
|
106
|
-
/* @__PURE__ */
|
|
106
|
+
/* @__PURE__ */ k("div", {
|
|
107
107
|
className: "flex items-center justify-between gap-2",
|
|
108
|
-
children: [/* @__PURE__ */
|
|
108
|
+
children: [/* @__PURE__ */ k("div", {
|
|
109
109
|
className: "flex min-w-0 items-center gap-1",
|
|
110
|
-
children: [
|
|
111
|
-
text:
|
|
112
|
-
className: i(
|
|
110
|
+
children: [R, /* @__PURE__ */ O(d, {
|
|
111
|
+
text: L,
|
|
112
|
+
className: i(z, "min-w-0", H.sourceName)
|
|
113
113
|
})]
|
|
114
|
-
}),
|
|
114
|
+
}), N && /* @__PURE__ */ k("div", {
|
|
115
115
|
className: "flex shrink-0 items-center gap-1",
|
|
116
116
|
children: [
|
|
117
|
-
/* @__PURE__ */
|
|
118
|
-
icon: /* @__PURE__ */
|
|
117
|
+
/* @__PURE__ */ O(p, {
|
|
118
|
+
icon: /* @__PURE__ */ O(_, {
|
|
119
119
|
size: 14,
|
|
120
120
|
className: "rtl:scale-x-[-1]",
|
|
121
121
|
stroke: s
|
|
122
122
|
}),
|
|
123
123
|
size: u.Small,
|
|
124
124
|
"aria-label": x.previousCitation,
|
|
125
|
-
onClick: () => o((a - 1 +
|
|
125
|
+
onClick: () => o((a - 1 + j) % j)
|
|
126
126
|
}),
|
|
127
|
-
/* @__PURE__ */
|
|
128
|
-
className: i(
|
|
129
|
-
children: x.formatSwitcherText(a + 1,
|
|
127
|
+
/* @__PURE__ */ O("span", {
|
|
128
|
+
className: i(W, H.switcher),
|
|
129
|
+
children: x.formatSwitcherText(a + 1, j)
|
|
130
130
|
}),
|
|
131
|
-
/* @__PURE__ */
|
|
132
|
-
icon: /* @__PURE__ */
|
|
131
|
+
/* @__PURE__ */ O(p, {
|
|
132
|
+
icon: /* @__PURE__ */ O(v, {
|
|
133
133
|
size: 14,
|
|
134
134
|
className: "rtl:scale-x-[-1]",
|
|
135
135
|
stroke: s
|
|
136
136
|
}),
|
|
137
137
|
size: u.Small,
|
|
138
138
|
"aria-label": x.nextCitation,
|
|
139
|
-
onClick: () => o((a + 1) %
|
|
139
|
+
onClick: () => o((a + 1) % j)
|
|
140
140
|
})
|
|
141
141
|
]
|
|
142
142
|
})]
|
|
143
143
|
}),
|
|
144
|
-
(
|
|
144
|
+
(M.body?.title || M.body?.quote || N) && /* @__PURE__ */ k("div", {
|
|
145
145
|
className: "flex flex-col gap-3",
|
|
146
|
-
children: [
|
|
147
|
-
className: i(
|
|
148
|
-
children:
|
|
149
|
-
}), (
|
|
146
|
+
children: [M.body?.title && /* @__PURE__ */ O("p", {
|
|
147
|
+
className: i(B, H.title, "break-words"),
|
|
148
|
+
children: M.body.title
|
|
149
|
+
}), (K || N) && /* @__PURE__ */ k("div", {
|
|
150
150
|
className: "flex flex-col items-start gap-1",
|
|
151
|
-
children: [/* @__PURE__ */
|
|
152
|
-
ref:
|
|
153
|
-
id:
|
|
154
|
-
tabIndex:
|
|
155
|
-
className: i(
|
|
156
|
-
children:
|
|
157
|
-
content:
|
|
151
|
+
children: [/* @__PURE__ */ O("div", {
|
|
152
|
+
ref: J,
|
|
153
|
+
id: q,
|
|
154
|
+
tabIndex: Y ? 0 : void 0,
|
|
155
|
+
className: i(V, H.quote, "w-full break-words", Y ? "max-h-[min(20rem,50vh)] overflow-y-auto" : "line-clamp-6"),
|
|
156
|
+
children: K && /* @__PURE__ */ O(t, {
|
|
157
|
+
content: K,
|
|
158
158
|
classNames: {
|
|
159
|
-
p: i(
|
|
160
|
-
ul: i(
|
|
161
|
-
ol:
|
|
162
|
-
strong:
|
|
159
|
+
p: i(V, H.quote),
|
|
160
|
+
ul: i(V, "ps-[1.5em]"),
|
|
161
|
+
ol: V,
|
|
162
|
+
strong: U
|
|
163
163
|
}
|
|
164
164
|
})
|
|
165
|
-
}),
|
|
166
|
-
label:
|
|
165
|
+
}), ne && /* @__PURE__ */ O(m, {
|
|
166
|
+
label: Y ? x.showLess : x.showMore,
|
|
167
167
|
size: u.Small,
|
|
168
|
-
"aria-expanded":
|
|
169
|
-
"aria-controls":
|
|
170
|
-
onClick: () =>
|
|
168
|
+
"aria-expanded": Y,
|
|
169
|
+
"aria-controls": q,
|
|
170
|
+
onClick: () => X((e) => !e)
|
|
171
171
|
})]
|
|
172
172
|
})]
|
|
173
173
|
}),
|
|
174
|
-
/* @__PURE__ */
|
|
174
|
+
/* @__PURE__ */ k("div", {
|
|
175
175
|
className: "flex justify-start gap-2",
|
|
176
|
-
children: [l && /* @__PURE__ */
|
|
176
|
+
children: [l && /* @__PURE__ */ O(g, {
|
|
177
177
|
label: x.preview,
|
|
178
178
|
size: u.Small,
|
|
179
|
-
onClick: () => l(
|
|
180
|
-
}), (
|
|
181
|
-
label:
|
|
179
|
+
onClick: () => l(M)
|
|
180
|
+
}), (F || y) && /* @__PURE__ */ O(g, {
|
|
181
|
+
label: F ? x.openInBrowser : x.download,
|
|
182
182
|
size: u.Small,
|
|
183
|
-
onClick: () => h(
|
|
183
|
+
onClick: () => h(M)
|
|
184
184
|
})]
|
|
185
185
|
})
|
|
186
186
|
]
|
|
187
187
|
});
|
|
188
|
-
},
|
|
188
|
+
}, W = ({ annotationCount: e, onOpen: t, icon: n, labels: r, labelClassName: a = "dial-caption-text" }) => /* @__PURE__ */ O(h, {
|
|
189
189
|
size: u.Small,
|
|
190
|
-
className: i("max-w-[240px]",
|
|
190
|
+
className: i("max-w-[240px]", A.citationMarker),
|
|
191
191
|
textClassName: "min-w-0 truncate",
|
|
192
192
|
iconBefore: n,
|
|
193
|
-
label: /* @__PURE__ */
|
|
193
|
+
label: /* @__PURE__ */ O("span", {
|
|
194
194
|
className: a,
|
|
195
195
|
children: e > 1 ? r.labelWithOverflow : r.label
|
|
196
196
|
}),
|
|
197
197
|
"aria-label": r.ariaLabel,
|
|
198
198
|
onClick: t
|
|
199
|
-
}),
|
|
200
|
-
let e = x(
|
|
199
|
+
}), G = y(null), K = G.Provider, q = () => {
|
|
200
|
+
let e = x(G);
|
|
201
201
|
if (e == null) throw Error("useCitationCardContext must be used within a CitationCardProvider");
|
|
202
202
|
return e;
|
|
203
|
-
},
|
|
204
|
-
let m =
|
|
203
|
+
}, J = { trigger: "_trigger_1ud83_1" }, Y = ({ group: e, onPreview: t, isPreviewable: n, onOpenInBrowser: r, isDownloadEnabled: a = !0, isPreviewOpen: o = !1, icon: s, headerIcon: c, cardLabels: u, markerLabels: d, cardTypography: f, markerLabelClassName: p }) => {
|
|
204
|
+
let m = q(), h = ee(), g = m.isOpen(h), _ = m.getActiveIndex(e.groupKey), v = e.annotations[_] ?? e.primaryAnnotation, y = n?.(v) ?? !0, x = b((e) => {
|
|
205
205
|
e || m.closePopup(h);
|
|
206
|
-
}, [m, h]), S =
|
|
206
|
+
}, [m, h]), S = w(() => t && y ? (e) => {
|
|
207
207
|
t(e), m.closePopup(h);
|
|
208
208
|
} : void 0, [
|
|
209
209
|
t,
|
|
210
210
|
y,
|
|
211
211
|
m,
|
|
212
212
|
h
|
|
213
|
-
]),
|
|
213
|
+
]), C = b(() => {
|
|
214
214
|
if (o && S) {
|
|
215
215
|
S(v);
|
|
216
216
|
return;
|
|
@@ -222,7 +222,7 @@ var k = {
|
|
|
222
222
|
v,
|
|
223
223
|
m,
|
|
224
224
|
h
|
|
225
|
-
]),
|
|
225
|
+
]), T = b(() => /* @__PURE__ */ O(U, {
|
|
226
226
|
group: e,
|
|
227
227
|
activeIndex: _,
|
|
228
228
|
onIndexChange: (t) => m.setActiveIndex(e.groupKey, t),
|
|
@@ -243,25 +243,25 @@ var k = {
|
|
|
243
243
|
u,
|
|
244
244
|
f
|
|
245
245
|
]);
|
|
246
|
-
return /* @__PURE__ */
|
|
246
|
+
return /* @__PURE__ */ O(l, {
|
|
247
247
|
open: g,
|
|
248
248
|
onOpenChange: x,
|
|
249
249
|
trigger: [],
|
|
250
250
|
placement: "bottom-end",
|
|
251
251
|
matchReferenceWidth: !1,
|
|
252
|
-
className: i("ms-1 inline-flex align-middle",
|
|
253
|
-
listClassName: i("!p-0 !bg-transparent !shadow-none !rounded-none",
|
|
254
|
-
renderOverlay:
|
|
255
|
-
children: /* @__PURE__ */
|
|
252
|
+
className: i("ms-1 inline-flex align-middle", J.trigger),
|
|
253
|
+
listClassName: i("!p-0 !bg-transparent !shadow-none !rounded-none", A.citationDropdown),
|
|
254
|
+
renderOverlay: T,
|
|
255
|
+
children: /* @__PURE__ */ O(W, {
|
|
256
256
|
sourceName: e.sourceName,
|
|
257
257
|
annotationCount: e.annotations.length,
|
|
258
|
-
onOpen:
|
|
258
|
+
onOpen: C,
|
|
259
259
|
icon: s,
|
|
260
260
|
labels: d,
|
|
261
261
|
labelClassName: p
|
|
262
262
|
})
|
|
263
263
|
});
|
|
264
|
-
},
|
|
264
|
+
}, X = (e) => {
|
|
265
265
|
let t = e.trim();
|
|
266
266
|
if (!t.startsWith("|") || !t.endsWith("|") || /[\r\n]/.test(t)) return;
|
|
267
267
|
let n = [], r = "";
|
|
@@ -270,11 +270,11 @@ var k = {
|
|
|
270
270
|
i === "\\" && a != null && /[!-/:-@[-`{-~]/.test(a) ? (r += a, e += 1) : i === "|" ? (n.push(r.trim()), r = "") : r += i;
|
|
271
271
|
}
|
|
272
272
|
if (!(r !== "" || n.length < 2 || n.every((e) => e === "" || /^:?-{3,}:?$/.test(e)))) return n;
|
|
273
|
-
},
|
|
273
|
+
}, ne = (e) => {
|
|
274
274
|
if (e.type !== "docx_text_anchor" && e.type !== "pptx_text_anchor") return;
|
|
275
275
|
let { text: t, occurrence: n, slide: r } = e;
|
|
276
276
|
if (typeof t != "string" || typeof n != "number" || !Number.isSafeInteger(n) || n < 1) return;
|
|
277
|
-
let i =
|
|
277
|
+
let i = X(t);
|
|
278
278
|
if (i != null) {
|
|
279
279
|
if (e.type === "docx_text_anchor") return {
|
|
280
280
|
type: "docx_text_anchor",
|
|
@@ -288,13 +288,13 @@ var k = {
|
|
|
288
288
|
slide: r
|
|
289
289
|
};
|
|
290
290
|
}
|
|
291
|
-
},
|
|
291
|
+
}, re = {
|
|
292
292
|
backgroundColor: "transparent",
|
|
293
293
|
borderColor: "var(--stroke-accent, #1D4ED8)",
|
|
294
294
|
borderWidth: "2px",
|
|
295
295
|
opacity: .5,
|
|
296
296
|
hoverOpacity: .5
|
|
297
|
-
},
|
|
297
|
+
}, ie = (e) => {
|
|
298
298
|
if (typeof e != "object" || !e) return;
|
|
299
299
|
let t = e, { lt: n, wh: r } = t;
|
|
300
300
|
if (Array.isArray(n) && Array.isArray(r) && n.length >= 2 && r.length >= 2) {
|
|
@@ -313,7 +313,7 @@ var k = {
|
|
|
313
313
|
x2: i + o,
|
|
314
314
|
y2: a + s
|
|
315
315
|
};
|
|
316
|
-
},
|
|
316
|
+
}, Z = (e) => {
|
|
317
317
|
if (!r(e)) return;
|
|
318
318
|
let t = e, n;
|
|
319
319
|
if (t.type === "pdf_bbox") {
|
|
@@ -324,7 +324,7 @@ var k = {
|
|
|
324
324
|
x2: i,
|
|
325
325
|
y2: a
|
|
326
326
|
});
|
|
327
|
-
} else t.type === "pdf_region" && (n =
|
|
327
|
+
} else t.type === "pdf_region" && (n = ie(t.bbox));
|
|
328
328
|
if (n == null) return;
|
|
329
329
|
let i = t.page;
|
|
330
330
|
if (!(typeof i != "number" || !Number.isInteger(i) || i < 1) && [
|
|
@@ -339,51 +339,63 @@ var k = {
|
|
|
339
339
|
x2: n.x2,
|
|
340
340
|
y2: n.y2
|
|
341
341
|
};
|
|
342
|
-
},
|
|
342
|
+
}, ae = (e) => {
|
|
343
343
|
if (!r(e)) return;
|
|
344
344
|
let t = e;
|
|
345
345
|
if (t.type !== "pdf_bbox" && t.type !== "pdf_region") return;
|
|
346
346
|
let n = t.page;
|
|
347
347
|
return typeof n == "number" && Number.isInteger(n) && n >= 1 ? n : void 0;
|
|
348
|
-
},
|
|
348
|
+
}, Q = (e) => typeof e != "object" || !e ? String(e) : Array.isArray(e) ? `[${e.map(Q).join(",")}]` : `{${Object.entries(e).filter(([, e]) => e !== void 0).sort(([e], [t]) => e < t ? -1 : +(e > t)).map(([e, t]) => `${e}=${Q(t)}`).join(",")}}`, oe = (e) => {
|
|
349
349
|
let t = 5381;
|
|
350
350
|
for (let n = 0; n < e.length; n += 1) t = t * 33 + e.charCodeAt(n) | 0;
|
|
351
351
|
return (t >>> 0).toString(36);
|
|
352
|
-
},
|
|
352
|
+
}, se = (e) => {
|
|
353
353
|
let t = e.body?.selector;
|
|
354
354
|
if (t == null) return;
|
|
355
355
|
let n = (Array.isArray(t) ? t : [t]).flatMap((e) => {
|
|
356
|
-
let t =
|
|
356
|
+
let t = Z(e);
|
|
357
357
|
return t == null ? [] : [t];
|
|
358
358
|
}), r = xe(e);
|
|
359
|
-
if (!(n.length === 0 && r.length === 0)) return
|
|
359
|
+
if (!(n.length === 0 && r.length === 0)) return Q([n, r]);
|
|
360
|
+
}, ce = (e) => {
|
|
361
|
+
let t = e.target?.selector, n = t?.type === "html_tag" ? t.id : void 0, r = typeof n == "string" ? n : void 0, i = se(e);
|
|
362
|
+
if (!(r == null && i == null)) return oe(`${r ?? ""}|${i ?? ""}`);
|
|
360
363
|
}, le = (e) => {
|
|
361
|
-
let t =
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
364
|
+
let t = de(e);
|
|
365
|
+
return e.flatMap((e, n) => {
|
|
366
|
+
let i = e.body?.selector;
|
|
367
|
+
if (i == null) return [];
|
|
368
|
+
let a = (Array.isArray(i) ? i : [i]).flatMap((e) => {
|
|
369
|
+
if (!r(e)) return [];
|
|
370
|
+
let t = Z(e);
|
|
371
|
+
return t == null ? [] : [t];
|
|
372
|
+
});
|
|
373
|
+
return a.length === 0 ? [] : [{
|
|
374
|
+
id: t[n],
|
|
375
|
+
bboxes: a,
|
|
376
|
+
style: re
|
|
377
|
+
}];
|
|
378
|
+
});
|
|
379
|
+
}, ue = (e, t) => e.index == null ? ce(e) ?? String(t) : String(e.index), de = (e) => {
|
|
380
|
+
let t = e.map((e, t) => ue(e, t)), n = new Set(t), r = /* @__PURE__ */ new Set();
|
|
381
|
+
return t.map((e) => {
|
|
382
|
+
if (!r.has(e)) return r.add(e), e;
|
|
383
|
+
let t = 1;
|
|
384
|
+
for (; n.has(`${e}-${t}`);) t += 1;
|
|
385
|
+
let i = `${e}-${t}`;
|
|
386
|
+
return n.add(i), r.add(i), i;
|
|
370
387
|
});
|
|
371
|
-
|
|
372
|
-
id: de(e, t),
|
|
373
|
-
bboxes: i,
|
|
374
|
-
style: Y
|
|
375
|
-
}];
|
|
376
|
-
}), de = (e, t) => e.index == null ? le(e) ?? String(t) : String(e.index), fe = (e) => {
|
|
388
|
+
}, fe = (e) => {
|
|
377
389
|
let t = e.body?.selector;
|
|
378
390
|
if (t == null) return;
|
|
379
391
|
let n = Array.isArray(t) ? t : [t];
|
|
380
392
|
for (let e of n) {
|
|
381
393
|
if (!r(e)) continue;
|
|
382
|
-
let t =
|
|
394
|
+
let t = Z(e);
|
|
383
395
|
if (t != null) return t.page;
|
|
384
396
|
}
|
|
385
397
|
for (let e of n) {
|
|
386
|
-
let t =
|
|
398
|
+
let t = ae(e);
|
|
387
399
|
if (t != null) return t;
|
|
388
400
|
}
|
|
389
401
|
}, pe = (e) => {
|
|
@@ -456,14 +468,14 @@ var k = {
|
|
|
456
468
|
let t = be(e);
|
|
457
469
|
return t ? [t] : [];
|
|
458
470
|
}
|
|
459
|
-
let t =
|
|
471
|
+
let t = ne(e);
|
|
460
472
|
return t ? [t] : [];
|
|
461
473
|
});
|
|
462
|
-
}, Se = (e, t) =>
|
|
474
|
+
}, Se = (e, t) => w(() => t ? [] : pe(e), [t, e]), Ce = {
|
|
463
475
|
openOwnerKey: null,
|
|
464
476
|
activeIndexByGroup: {}
|
|
465
477
|
}, we = () => {
|
|
466
|
-
let [e, t] =
|
|
478
|
+
let [e, t] = E(Ce), n = b((e) => {
|
|
467
479
|
t((t) => ({
|
|
468
480
|
...t,
|
|
469
481
|
openOwnerKey: e
|
|
@@ -482,7 +494,7 @@ var k = {
|
|
|
482
494
|
}
|
|
483
495
|
}));
|
|
484
496
|
}, []);
|
|
485
|
-
return
|
|
497
|
+
return w(() => ({
|
|
486
498
|
openPopup: n,
|
|
487
499
|
closePopup: r,
|
|
488
500
|
setActiveIndex: i,
|
|
@@ -507,7 +519,7 @@ var k = {
|
|
|
507
519
|
}).sort((e, t) => t.pos - e.pos), r = e;
|
|
508
520
|
for (let { idx: e, pos: t } of n) r = `${r.slice(0, t)}⟦C${e}⟧${r.slice(t)}`;
|
|
509
521
|
return r;
|
|
510
|
-
}, De = /<cit\s+data-id=(?:"[^"]+"|'[^']+')\s*>\s*<\/cit>/g, Oe = /^<cit\s+data-id=(?:"[^"]+"|'[^']+')\s*>\s*<\/cit>$/, ke = /<cit\s+data-id=(?:"[^"]+"|'[^']+')\s*>\s*<\/cit>|<\/?cit\b[^>]*>|<\/?cit\b[^>]*$/gi, Ae = (e) => e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"), je = (e) => e.replace(ke, (e) => Oe.test(e) ? e : Ae(e)), Me = (e) => je(e).replace(De, ""),
|
|
522
|
+
}, De = /<cit\s+data-id=(?:"[^"]+"|'[^']+')\s*>\s*<\/cit>/g, Oe = /^<cit\s+data-id=(?:"[^"]+"|'[^']+')\s*>\s*<\/cit>$/, ke = /<cit\s+data-id=(?:"[^"]+"|'[^']+')\s*>\s*<\/cit>|<\/?cit\b[^>]*>|<\/?cit\b[^>]*$/gi, Ae = (e) => e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"), je = (e) => e.replace(ke, (e) => Oe.test(e) ? e : Ae(e)), Me = (e) => je(e).replace(De, ""), $ = (e, t) => {
|
|
511
523
|
if (typeof e == "string") {
|
|
512
524
|
let n = e.split(Te);
|
|
513
525
|
if (n.length === 1) return e;
|
|
@@ -517,37 +529,37 @@ var k = {
|
|
|
517
529
|
}), r;
|
|
518
530
|
}
|
|
519
531
|
return Array.isArray(e) ? e.flatMap((e) => {
|
|
520
|
-
let n =
|
|
532
|
+
let n = $(e, t);
|
|
521
533
|
return Array.isArray(n) ? n : [n];
|
|
522
534
|
}) : e;
|
|
523
|
-
}, Ne = {}, Pe = [],
|
|
535
|
+
}, Ne = {}, Pe = [], Fe = (e) => {
|
|
524
536
|
let t = e.primaryAnnotation.target?.selector;
|
|
525
537
|
return t?.type === "html_tag" ? t.id : void 0;
|
|
526
|
-
},
|
|
538
|
+
}, Ie = (e, t) => /* @__PURE__ */ k(D, { children: [
|
|
527
539
|
e == null ? "<cit>" : `<cit data-id="${e}">`,
|
|
528
540
|
t,
|
|
529
541
|
"</cit>"
|
|
530
|
-
] }),
|
|
531
|
-
let { onPreview: s, isPreviewable: c, onOpenInBrowser: l, isDownloadEnabled: u = !0, isPreviewOpen: d = !1, buildLabels: f } = n, p =
|
|
542
|
+
] }), Le = (e, t, n, r = !1, a = !1, o = Pe) => {
|
|
543
|
+
let { onPreview: s, isPreviewable: c, onOpenInBrowser: l, isDownloadEnabled: u = !0, isPreviewOpen: d = !1, buildLabels: f } = n, p = w(() => r ? Me(e) : je(t.length > 0 ? Ee(e, t) : e), [
|
|
532
544
|
e,
|
|
533
545
|
t,
|
|
534
546
|
r
|
|
535
547
|
]), m = p.includes("<cit");
|
|
536
548
|
return {
|
|
537
549
|
processedContent: p,
|
|
538
|
-
markdownComponents:
|
|
550
|
+
markdownComponents: w(() => {
|
|
539
551
|
let e = /* @__PURE__ */ new Map();
|
|
540
552
|
for (let t of o) {
|
|
541
|
-
let n =
|
|
553
|
+
let n = Fe(t);
|
|
542
554
|
n != null && e.set(n, t);
|
|
543
555
|
}
|
|
544
556
|
for (let n of t) {
|
|
545
|
-
let t =
|
|
557
|
+
let t = Fe(n);
|
|
546
558
|
t != null && e.set(t, n);
|
|
547
559
|
}
|
|
548
560
|
let n = (e) => {
|
|
549
561
|
let { cardLabels: t, markerLabels: n } = f(e);
|
|
550
|
-
return /* @__PURE__ */
|
|
562
|
+
return /* @__PURE__ */ O(Y, {
|
|
551
563
|
group: e,
|
|
552
564
|
onPreview: (t) => s(t, e),
|
|
553
565
|
isPreviewable: c,
|
|
@@ -562,19 +574,19 @@ var k = {
|
|
|
562
574
|
return r ? n(r) : null;
|
|
563
575
|
}, p = { cit: (t) => {
|
|
564
576
|
let r = t["data-id"] == null ? void 0 : e.get(t["data-id"]);
|
|
565
|
-
return r ? n(r) :
|
|
577
|
+
return r ? n(r) : Ie(t["data-id"], t.children);
|
|
566
578
|
} };
|
|
567
579
|
return t.length === 0 && o.length === 0 ? m ? p : Ne : {
|
|
568
580
|
...p,
|
|
569
|
-
p: ({ children: e, ...t }) => /* @__PURE__ */
|
|
581
|
+
p: ({ children: e, ...t }) => /* @__PURE__ */ O("p", {
|
|
570
582
|
...t,
|
|
571
583
|
className: i(a ? "dial-small-paragraph-text" : "dial-body-paragraph-text", "mb-3 [overflow-wrap:anywhere] [text-wrap:pretty] last:mb-0"),
|
|
572
|
-
children:
|
|
584
|
+
children: $(e, r)
|
|
573
585
|
}),
|
|
574
|
-
li: ({ children: e, ...t }) => /* @__PURE__ */
|
|
586
|
+
li: ({ children: e, ...t }) => /* @__PURE__ */ O("li", {
|
|
575
587
|
...t,
|
|
576
588
|
className: "mb-1.5 last:mb-0",
|
|
577
|
-
children:
|
|
589
|
+
children: $(e, r)
|
|
578
590
|
})
|
|
579
591
|
};
|
|
580
592
|
}, [
|
|
@@ -590,14 +602,14 @@ var k = {
|
|
|
590
602
|
m
|
|
591
603
|
])
|
|
592
604
|
};
|
|
593
|
-
},
|
|
594
|
-
let t =
|
|
605
|
+
}, Re = (e) => e.url == null && e.reference_url != null, ze = /^(.*\.pdf)(?:#page=(\d+))?$/i, Be = (e) => {
|
|
606
|
+
let t = ze.exec(e);
|
|
595
607
|
return t ? {
|
|
596
608
|
baseUrl: t[1],
|
|
597
609
|
page: t[2] == null ? null : Number(t[2])
|
|
598
610
|
} : null;
|
|
599
|
-
},
|
|
600
|
-
let n = t.reference_url, r =
|
|
611
|
+
}, Ve = (t) => R((t ?? []).filter(Re).map((t) => {
|
|
612
|
+
let n = t.reference_url, r = Be(n) != null;
|
|
601
613
|
return { body: {
|
|
602
614
|
quote: t.data,
|
|
603
615
|
source: {
|
|
@@ -611,4 +623,4 @@ var k = {
|
|
|
611
623
|
} };
|
|
612
624
|
}));
|
|
613
625
|
//#endregion
|
|
614
|
-
export {
|
|
626
|
+
export { U as CitationCard, K as CitationCardProvider, Y as CitationDropdown, W as CitationMarker, A as QUOTATIONS_CLASS, ue as annotationHighlightId, de as annotationHighlightIds, xe as annotationToOfficeHighlightLocations, le as annotationsToPdfHighlights, V as gatherSameSourceAnnotations, fe as getAnnotationPdfPage, Ve as getReferenceAttachmentGroups, B as groupAnnotations, z as groupAnnotationsByCitId, R as groupAnnotationsBySource, Ee as injectCitationSentinels, me as isDocxRangeSelector, _e as isExcelRcRangeSelector, he as isPptxRangeSelector, Re as isReferenceOnlyAttachment, Be as parsePdfPageReference, $ as replaceSentinelsInChildren, pe as resolveMessageAnnotations, Me as stripCitTagsWhileStreaming, Se as useAnnotations, we as useCitationCard, q as useCitationCardContext, Le as useCitationMarkdownComponents };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@epam/ai-dial-quotations",
|
|
3
3
|
"description": "Citation and annotation components, hooks, and utilities for AI DIAL conversations",
|
|
4
|
-
"version": "1.2.0-dev.
|
|
4
|
+
"version": "1.2.0-dev.288",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./index.js",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"react": "^19.2.8",
|
|
26
|
-
"@epam/ai-dial-chat-shared": "1.2.0-dev.
|
|
26
|
+
"@epam/ai-dial-chat-shared": "1.2.0-dev.288",
|
|
27
27
|
"@epam/ai-dial-ui-kit": "^0.15.0-dev.36"
|
|
28
28
|
},
|
|
29
29
|
"repository": {
|
package/utils/annotation.d.ts
CHANGED
|
@@ -5,19 +5,21 @@ import { OfficeHighlightLocation } from '../models/office-highlight';
|
|
|
5
5
|
* Maps a list of annotations to `InputHighlightData` entries for the PDF viewer.
|
|
6
6
|
* Recognizes `pdf_bbox` selectors and both `pdf_region` coordinate forms
|
|
7
7
|
* (`lt`/`wh` and legacy `left`/`top`/`width`/`height`); annotations whose
|
|
8
|
-
* `body.selector` contains none of these are skipped.
|
|
9
|
-
* from `
|
|
10
|
-
*
|
|
8
|
+
* `body.selector` contains none of these are skipped. Each highlight `id` is
|
|
9
|
+
* the entry's id from `annotationHighlightIds(annotations)`, unique within
|
|
10
|
+
* this input list.
|
|
11
11
|
*/
|
|
12
12
|
export declare const annotationsToPdfHighlights: (annotations: Annotation[]) => InputHighlightData[];
|
|
13
13
|
/**
|
|
14
|
-
* Returns a stable string ID for a given annotation
|
|
15
|
-
* `
|
|
16
|
-
*
|
|
14
|
+
* Returns a stable string ID for a given annotation — the id
|
|
15
|
+
* `annotationHighlightIds` (and so `annotationsToPdfHighlights` and the Office
|
|
16
|
+
* highlight path) assigns it whenever no earlier entry of the same list
|
|
17
|
+
* already holds that id.
|
|
17
18
|
*
|
|
18
19
|
* Resolved in order:
|
|
19
|
-
* 1. `annotation.index` when the wire supplied one —
|
|
20
|
-
*
|
|
20
|
+
* 1. `annotation.index` when the wire supplied one — short, but not guaranteed
|
|
21
|
+
* unique: a payload may repeat an `index`, which `annotationHighlightIds`
|
|
22
|
+
* disambiguates.
|
|
21
23
|
* 2. Otherwise an id derived from the annotation's own identity: its `cit` tag
|
|
22
24
|
* id plus a digest of its selectors. Two annotations differing in either
|
|
23
25
|
* part get different ids; two agreeing in both describe the same cited
|
|
@@ -34,6 +36,12 @@ export declare const annotationsToPdfHighlights: (annotations: Annotation[]) =>
|
|
|
34
36
|
* never sent over the wire.
|
|
35
37
|
*/
|
|
36
38
|
export declare const annotationHighlightId: (annotation: Annotation, fallbackIndex: number) => string;
|
|
39
|
+
/**
|
|
40
|
+
* Returns one highlight id per entry of `annotations`, unique within the list:
|
|
41
|
+
* the entry's `annotationHighlightId` when no earlier entry holds it, otherwise
|
|
42
|
+
* that id with a `-<n>` suffix no other entry's id uses.
|
|
43
|
+
*/
|
|
44
|
+
export declare const annotationHighlightIds: (annotations: Annotation[]) => string[];
|
|
37
45
|
/**
|
|
38
46
|
* Returns the PDF page to open for the annotation, or `undefined` when none
|
|
39
47
|
* exists. Recognizes `pdf_bbox` selectors and both `pdf_region` coordinate
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"annotation.d.ts","sourceRoot":"","sources":["../../src/utils/annotation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,kBAAkB,EAClB,iBAAiB,EACjB,oBAAoB,EACpB,OAAO,EACP,iBAAiB,EAClB,MAAM,2BAA2B,CAAC;AAMnC,OAAO,KAAK,EAGV,kBAAkB,EACnB,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAmM1E;;;;;;;GAOG;AACH,eAAO,MAAM,0BAA0B,GACrC,aAAa,UAAU,EAAE,KACxB,kBAAkB,
|
|
1
|
+
{"version":3,"file":"annotation.d.ts","sourceRoot":"","sources":["../../src/utils/annotation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,kBAAkB,EAClB,iBAAiB,EACjB,oBAAoB,EACpB,OAAO,EACP,iBAAiB,EAClB,MAAM,2BAA2B,CAAC;AAMnC,OAAO,KAAK,EAGV,kBAAkB,EACnB,MAAM,2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