@epam/ai-dial-quotations 1.3.0-dev.5 → 1.3.0-dev.51
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/components/CitationCard/CitationCard.d.ts.map +1 -1
- package/components/CitationDropdown/CitationDropdown.d.ts +2 -0
- package/components/CitationDropdown/CitationDropdown.d.ts.map +1 -1
- package/hooks/useCitationMarkdownComponents/useCitationMarkdownComponents.d.ts +2 -0
- package/hooks/useCitationMarkdownComponents/useCitationMarkdownComponents.d.ts.map +1 -1
- package/index.css +1 -1
- package/index.js +195 -187
- package/package.json +3 -3
- package/utils/citation-source-kind.d.ts +9 -0
- package/utils/citation-source-kind.d.ts.map +1 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CitationCard.d.ts","sourceRoot":"","sources":["../../../src/components/CitationCard/CitationCard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"CitationCard.d.ts","sourceRoot":"","sources":["../../../src/components/CitationCard/CitationCard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAiB5D,OAAO,EACL,EAAE,EACF,SAAS,EAMV,MAAM,OAAO,CAAC;AAGf,OAAO,EAEL,KAAK,eAAe,EACrB,MAAM,yCAAyC,CAAC;AAGjD,+CAA+C;AAC/C,MAAM,WAAW,kBAAkB;IACjC,4DAA4D;IAC5D,SAAS,EAAE,MAAM,CAAC;IAClB,2DAA2D;IAC3D,gBAAgB,EAAE,MAAM,CAAC;IACzB,uDAAuD;IACvD,YAAY,EAAE,MAAM,CAAC;IACrB,2GAA2G;IAC3G,kBAAkB,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IAC/D,sCAAsC;IACtC,OAAO,EAAE,MAAM,CAAC;IAChB,8CAA8C;IAC9C,aAAa,EAAE,MAAM,CAAC;IACtB,uCAAuC;IACvC,QAAQ,EAAE,MAAM,CAAC;IACjB,iFAAiF;IACjF,QAAQ,EAAE,MAAM,CAAC;IACjB,6DAA6D;IAC7D,QAAQ,EAAE,MAAM,CAAC;IACjB,+GAA+G;IAC/G,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,4GAA4G;IAC5G,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,uHAAuH;IACvH,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,wHAAwH;IACxH,0BAA0B,CAAC,EAAE,MAAM,CAAC;IACpC,kIAAkI;IAClI,yBAAyB,CAAC,EAAE,MAAM,CAAC;CACpC;AAED,qGAAqG;AACrG,MAAM,WAAW,kBAAkB;IACjC,4DAA4D;IAC5D,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,+DAA+D;IAC/D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,+DAA+D;IAC/D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,oEAAoE;IACpE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,0DAA0D;IAC1D,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,oEAAoE;AACpE,MAAM,WAAW,sBAAsB;IACrC,qFAAqF;IACrF,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,sFAAsF;IACtF,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,gFAAgF;IAChF,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,iKAAiK;IACjK,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,yFAAyF;IACzF,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,8CAA8C;AAC9C,MAAM,WAAW,iBAAiB;IAChC,wEAAwE;IACxE,KAAK,EAAE,eAAe,CAAC;IACvB,kFAAkF;IAClF,WAAW,EAAE,MAAM,CAAC;IACpB,iFAAiF;IACjF,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC;;;;OAIG;IACH,SAAS,CAAC,EAAE,CAAC,UAAU,EAAE,UAAU,KAAK,IAAI,CAAC;IAC7C,2EAA2E;IAC3E,eAAe,EAAE,CAAC,UAAU,EAAE,UAAU,KAAK,IAAI,CAAC;IAClD,+HAA+H;IAC/H,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B;;;;OAIG;IACH,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,4BAA4B;IAC5B,MAAM,EAAE,kBAAkB,CAAC;IAC3B,2CAA2C;IAC3C,UAAU,CAAC,EAAE,sBAAsB,CAAC;IACpC,gCAAgC;IAChC,MAAM,CAAC,EAAE,kBAAkB,CAAC;CAC7B;AAED,yFAAyF;AACzF,eAAO,MAAM,YAAY,EAAE,EAAE,CAAC,iBAAiB,CAwN9C,CAAC"}
|
|
@@ -20,6 +20,8 @@ export interface CitationDropdownProps {
|
|
|
20
20
|
isDownloadEnabled?: boolean;
|
|
21
21
|
/** Whether the host's preview panel is open; a marker click then previews the active annotation directly instead of showing the card. Defaults to `false`. */
|
|
22
22
|
isPreviewOpen?: boolean;
|
|
23
|
+
/** Whether a marker click previews a single-citation file source directly instead of showing the card; web-link (HTML/XHTML) sources and multi-citation groups keep the card. Defaults to `false`. */
|
|
24
|
+
previewFilesOnMarkerClick?: boolean;
|
|
23
25
|
/** Optional icon rendered before the marker's label. */
|
|
24
26
|
icon?: ReactNode;
|
|
25
27
|
/** Optional icon rendered in the card header. When absent, no header icon is shown. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CitationDropdown.d.ts","sourceRoot":"","sources":["../../../src/components/CitationDropdown/CitationDropdown.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAG5D,OAAO,EAAE,EAAE,EAAE,SAAS,EAA+B,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"CitationDropdown.d.ts","sourceRoot":"","sources":["../../../src/components/CitationDropdown/CitationDropdown.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAG5D,OAAO,EAAE,EAAE,EAAE,SAAS,EAA+B,MAAM,OAAO,CAAC;AAInE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAC/E,OAAO,EAEL,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,EAC5B,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAEL,KAAK,oBAAoB,EAC1B,MAAM,kCAAkC,CAAC;AAG1C,kDAAkD;AAClD,MAAM,WAAW,qBAAqB;IACpC,kEAAkE;IAClE,KAAK,EAAE,eAAe,CAAC;IACvB;;;OAGG;IACH,SAAS,CAAC,EAAE,CAAC,UAAU,EAAE,UAAU,KAAK,IAAI,CAAC;IAC7C,qHAAqH;IACrH,aAAa,CAAC,EAAE,CAAC,UAAU,EAAE,UAAU,KAAK,OAAO,CAAC;IACpD,uEAAuE;IACvE,eAAe,EAAE,CAAC,UAAU,EAAE,UAAU,KAAK,IAAI,CAAC;IAClD,+FAA+F;IAC/F,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,8JAA8J;IAC9J,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,sMAAsM;IACtM,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC,wDAAwD;IACxD,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,uFAAuF;IACvF,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,+CAA+C;IAC/C,UAAU,EAAE,kBAAkB,CAAC;IAC/B,yDAAyD;IACzD,YAAY,EAAE,oBAAoB,CAAC;IACnC,2DAA2D;IAC3D,cAAc,CAAC,EAAE,sBAAsB,CAAC;IACxC,gGAAgG;IAChG,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED,4HAA4H;AAC5H,eAAO,MAAM,gBAAgB,EAAE,EAAE,CAAC,qBAAqB,CA2HtD,CAAC"}
|
|
@@ -15,6 +15,8 @@ export interface UseCitationMarkdownComponentsCallbacks {
|
|
|
15
15
|
isDownloadEnabled?: boolean;
|
|
16
16
|
/** Whether the host's preview panel is open; a marker click then previews directly instead of showing the card. Defaults to `false`. */
|
|
17
17
|
isPreviewOpen?: boolean;
|
|
18
|
+
/** Whether a marker click previews a single-citation file source directly instead of showing the card; web-link (HTML/XHTML) sources and multi-citation groups keep the card. Defaults to `false`. */
|
|
19
|
+
previewFilesOnMarkerClick?: boolean;
|
|
18
20
|
/** Builds the translated label bundles used by a given citation group's card and marker. */
|
|
19
21
|
buildLabels(group: AnnotationGroup): {
|
|
20
22
|
cardLabels: CitationCardLabels;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCitationMarkdownComponents.d.ts","sourceRoot":"","sources":["../../../src/hooks/useCitationMarkdownComponents/useCitationMarkdownComponents.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAE1E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4CAA4C,CAAC;AAErF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gDAAgD,CAAC;AAQ3F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAE/E,6FAA6F;AAC7F,MAAM,WAAW,sCAAsC;IACrD,4GAA4G;IAC5G,SAAS,CAAC,UAAU,EAAE,UAAU,EAAE,KAAK,EAAE,eAAe,GAAG,IAAI,CAAC;IAChE,gFAAgF;IAChF,aAAa,CAAC,CAAC,UAAU,EAAE,UAAU,GAAG,OAAO,CAAC;IAChD,yEAAyE;IACzE,eAAe,CAAC,UAAU,EAAE,UAAU,GAAG,IAAI,CAAC;IAC9C,oGAAoG;IACpG,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,wIAAwI;IACxI,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,4FAA4F;IAC5F,WAAW,CAAC,KAAK,EAAE,eAAe,GAAG;QACnC,UAAU,EAAE,kBAAkB,CAAC;QAC/B,YAAY,EAAE,oBAAoB,CAAC;KACpC,CAAC;CACH;AA0BD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,eAAO,MAAM,6BAA6B,GACxC,SAAS,MAAM,EACf,QAAQ,eAAe,EAAE,EACzB,WAAW,sCAAsC,EACjD,qBAAmB,EACnB,6BAA2B,EAC3B,iBAAgB,eAAe,EAA0B,KACxD;IAAE,gBAAgB,EAAE,MAAM,CAAC;IAAC,kBAAkB,EAAE,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"useCitationMarkdownComponents.d.ts","sourceRoot":"","sources":["../../../src/hooks/useCitationMarkdownComponents/useCitationMarkdownComponents.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAE1E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4CAA4C,CAAC;AAErF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gDAAgD,CAAC;AAQ3F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAE/E,6FAA6F;AAC7F,MAAM,WAAW,sCAAsC;IACrD,4GAA4G;IAC5G,SAAS,CAAC,UAAU,EAAE,UAAU,EAAE,KAAK,EAAE,eAAe,GAAG,IAAI,CAAC;IAChE,gFAAgF;IAChF,aAAa,CAAC,CAAC,UAAU,EAAE,UAAU,GAAG,OAAO,CAAC;IAChD,yEAAyE;IACzE,eAAe,CAAC,UAAU,EAAE,UAAU,GAAG,IAAI,CAAC;IAC9C,oGAAoG;IACpG,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,wIAAwI;IACxI,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,sMAAsM;IACtM,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC,4FAA4F;IAC5F,WAAW,CAAC,KAAK,EAAE,eAAe,GAAG;QACnC,UAAU,EAAE,kBAAkB,CAAC;QAC/B,YAAY,EAAE,oBAAoB,CAAC;KACpC,CAAC;CACH;AA0BD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,eAAO,MAAM,6BAA6B,GACxC,SAAS,MAAM,EACf,QAAQ,eAAe,EAAE,EACzB,WAAW,sCAAsC,EACjD,qBAAmB,EACnB,6BAA2B,EAC3B,iBAAgB,eAAe,EAA0B,KACxD;IAAE,gBAAgB,EAAE,MAAM,CAAC;IAAC,kBAAkB,EAAE,UAAU,CAAA;CA2G5D,CAAC"}
|
package/index.css
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
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))}
|
|
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))}._trigger_1dwia_7{max-width:calc(100% - .25rem)}._trigger_1dwia_7>*{min-width:0;max-width:100%}td ._trigger_1dwia_7,th ._trigger_1dwia_7{max-width:100%;margin-inline-start:0}
|
|
2
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}.block{display:block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.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.js
CHANGED
|
@@ -1,55 +1,58 @@
|
|
|
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
|
+
}, te = (t) => {
|
|
12
|
+
let n = t.body?.source?.attachment?.type;
|
|
13
|
+
return n === e.HTML || n === e.XHTML;
|
|
14
|
+
}, j = (e) => {
|
|
12
15
|
try {
|
|
13
16
|
return decodeURIComponent(e);
|
|
14
17
|
} catch {
|
|
15
18
|
return e;
|
|
16
19
|
}
|
|
17
|
-
},
|
|
20
|
+
}, M = (e) => {
|
|
18
21
|
try {
|
|
19
22
|
let t = new URL(e);
|
|
20
|
-
return t.pathname.split("/").map((e) =>
|
|
23
|
+
return t.pathname.split("/").map((e) => j(e)).filter(Boolean).at(-1) ?? t.hostname;
|
|
21
24
|
} catch {
|
|
22
|
-
return e.split("/").map((e) =>
|
|
25
|
+
return e.split("/").map((e) => j(e)).filter(Boolean).at(-1) ?? e;
|
|
23
26
|
}
|
|
24
|
-
},
|
|
25
|
-
let t = e == null ? null :
|
|
27
|
+
}, N = /\.([a-z0-9]{1,10})$/i, P = (e) => {
|
|
28
|
+
let t = e == null ? null : N.exec(e.trim());
|
|
26
29
|
return t == null ? void 0 : `.${t[1].toLowerCase()}`;
|
|
27
|
-
},
|
|
30
|
+
}, ne = (e) => {
|
|
28
31
|
let t = e.body?.source?.attachment, n = t?.url;
|
|
29
|
-
return (n == null ? void 0 : M(
|
|
30
|
-
},
|
|
32
|
+
return (n == null ? void 0 : P(M(n))) ?? P(t?.title);
|
|
33
|
+
}, F = (e, t) => e.body?.source?.attachment?.title ?? M(t), I = (e) => {
|
|
31
34
|
let t = e.target?.selector;
|
|
32
35
|
return t?.type === "html_tag" ? t : void 0;
|
|
33
|
-
},
|
|
36
|
+
}, L = (e) => I(e) != null, R = (e) => {
|
|
34
37
|
let t = /* @__PURE__ */ new Map();
|
|
35
38
|
for (let n of e) {
|
|
36
|
-
if (
|
|
39
|
+
if (L(n)) continue;
|
|
37
40
|
let e = n.body?.source?.attachment?.url;
|
|
38
41
|
if (e == null) continue;
|
|
39
42
|
let r = t.get(e);
|
|
40
43
|
r ? r.annotations.push(n) : t.set(e, {
|
|
41
44
|
groupKey: e,
|
|
42
45
|
sourceUrl: e,
|
|
43
|
-
sourceName:
|
|
46
|
+
sourceName: F(n, e),
|
|
44
47
|
annotations: [n],
|
|
45
48
|
primaryAnnotation: n
|
|
46
49
|
});
|
|
47
50
|
}
|
|
48
51
|
return Array.from(t.values());
|
|
49
|
-
},
|
|
52
|
+
}, z = (e) => {
|
|
50
53
|
let t = /* @__PURE__ */ new Map();
|
|
51
54
|
for (let n of e) {
|
|
52
|
-
let e =
|
|
55
|
+
let e = I(n)?.id;
|
|
53
56
|
if (e == null) continue;
|
|
54
57
|
let r = n.body?.source?.attachment?.url;
|
|
55
58
|
if (r == null) continue;
|
|
@@ -57,216 +60,219 @@ var O = {
|
|
|
57
60
|
i ? i.annotations.push(n) : t.set(e, {
|
|
58
61
|
groupKey: `cit:${e}`,
|
|
59
62
|
sourceUrl: r,
|
|
60
|
-
sourceName:
|
|
63
|
+
sourceName: F(n, r),
|
|
61
64
|
annotations: [n],
|
|
62
65
|
primaryAnnotation: n
|
|
63
66
|
});
|
|
64
67
|
}
|
|
65
68
|
return Array.from(t.values());
|
|
66
|
-
},
|
|
69
|
+
}, B = (e) => [...z(e), ...R(e)], V = (e, t) => {
|
|
67
70
|
let n = e.body?.source?.attachment?.url;
|
|
68
71
|
return n == null || !t.includes(e) ? [e] : t.filter((e) => e.body?.source?.attachment?.url === n);
|
|
69
|
-
},
|
|
72
|
+
}, H = {
|
|
70
73
|
card: "_card_1kph1_1",
|
|
71
74
|
quote: "_quote_1kph1_5",
|
|
72
75
|
title: "_title_1kph1_9",
|
|
73
76
|
switcher: "_switcher_1kph1_13",
|
|
74
77
|
sourceName: "_sourceName_1kph1_17"
|
|
75
|
-
},
|
|
76
|
-
let
|
|
78
|
+
}, U = ({ group: e, activeIndex: r, onIndexChange: a, onPreview: o, onOpenInBrowser: l, isDownloadEnabled: h = !0, headerIcon: y, labels: b, typography: x, colors: w }) => {
|
|
79
|
+
let D = e.annotations.length, j = e.annotations[r] ?? e.primaryAnnotation, M = D > 1, N = o == null || te(j), P = N ? void 0 : ne(j), F = P ?? e.sourceName, I = y ?? (P == null ? void 0 : /* @__PURE__ */ O(f, {
|
|
77
80
|
type: c.File,
|
|
78
81
|
name: P,
|
|
79
82
|
fileExtension: P,
|
|
80
83
|
size: 16,
|
|
81
84
|
decorative: !0,
|
|
82
85
|
className: "shrink-0"
|
|
83
|
-
})), L =
|
|
84
|
-
"--cc-card-bg":
|
|
85
|
-
"--cc-quote-text":
|
|
86
|
-
"--cc-title-text":
|
|
87
|
-
"--cc-switcher-text":
|
|
88
|
-
"--cc-source-name-text":
|
|
89
|
-
}),
|
|
86
|
+
})), L = x?.sourceNameClassName ?? "dial-tiny-text", R = x?.titleClassName ?? "dial-body-semi-text", z = x?.quoteClassName ?? "dial-small-text", B = x?.quoteStrongClassName ?? "dial-small-semi-text", V = x?.switcherClassName ?? "dial-tiny-text", U = n({
|
|
87
|
+
"--cc-card-bg": w?.cardBackground,
|
|
88
|
+
"--cc-quote-text": w?.quoteText,
|
|
89
|
+
"--cc-title-text": w?.titleText,
|
|
90
|
+
"--cc-switcher-text": w?.switcherText,
|
|
91
|
+
"--cc-source-name-text": w?.sourceNameText
|
|
92
|
+
}), W = j.body?.quote, G = ee(), K = T(null), [q, J] = E(!1), [Y, X] = E(!1);
|
|
90
93
|
return S(() => {
|
|
91
|
-
|
|
92
|
-
}, [
|
|
93
|
-
let e =
|
|
94
|
-
if (!e ||
|
|
95
|
-
let t = () =>
|
|
94
|
+
J(!1);
|
|
95
|
+
}, [r, W]), C(() => {
|
|
96
|
+
let e = K.current;
|
|
97
|
+
if (!e || q) return;
|
|
98
|
+
let t = () => X(e.scrollHeight > e.clientHeight + 1);
|
|
96
99
|
t();
|
|
97
100
|
let n = new ResizeObserver(t);
|
|
98
101
|
return n.observe(e), () => n.disconnect();
|
|
99
|
-
}, [
|
|
102
|
+
}, [W, q]), /* @__PURE__ */ k("div", {
|
|
100
103
|
role: "dialog",
|
|
101
104
|
"aria-modal": "true",
|
|
102
|
-
"aria-label":
|
|
103
|
-
style:
|
|
104
|
-
className: i("flex w-[400px] max-w-full flex-col gap-3 rounded-lg p-4 shadow-lg",
|
|
105
|
+
"aria-label": b.ariaLabel,
|
|
106
|
+
style: U,
|
|
107
|
+
className: i("flex w-[400px] max-w-full flex-col gap-3 rounded-lg p-4 shadow-lg", H.card, A.citationCard),
|
|
105
108
|
children: [
|
|
106
|
-
/* @__PURE__ */
|
|
109
|
+
/* @__PURE__ */ k("div", {
|
|
107
110
|
className: "flex items-center justify-between gap-2",
|
|
108
|
-
children: [/* @__PURE__ */
|
|
111
|
+
children: [/* @__PURE__ */ k("div", {
|
|
109
112
|
className: "flex min-w-0 items-center gap-1",
|
|
110
|
-
children: [I, /* @__PURE__ */
|
|
113
|
+
children: [I, /* @__PURE__ */ O(d, {
|
|
111
114
|
text: F,
|
|
112
|
-
className: i(L, "min-w-0",
|
|
115
|
+
className: i(L, "min-w-0", H.sourceName)
|
|
113
116
|
})]
|
|
114
|
-
}),
|
|
117
|
+
}), M && /* @__PURE__ */ k("div", {
|
|
115
118
|
className: "flex shrink-0 items-center gap-1",
|
|
116
119
|
children: [
|
|
117
|
-
/* @__PURE__ */
|
|
118
|
-
icon: /* @__PURE__ */
|
|
120
|
+
/* @__PURE__ */ O(p, {
|
|
121
|
+
icon: /* @__PURE__ */ O(_, {
|
|
119
122
|
size: 14,
|
|
120
123
|
className: "rtl:scale-x-[-1]",
|
|
121
124
|
stroke: s
|
|
122
125
|
}),
|
|
123
126
|
size: u.Small,
|
|
124
|
-
"aria-label":
|
|
125
|
-
onClick: () =>
|
|
127
|
+
"aria-label": b.previousCitation,
|
|
128
|
+
onClick: () => a((r - 1 + D) % D)
|
|
126
129
|
}),
|
|
127
|
-
/* @__PURE__ */
|
|
128
|
-
className: i(V,
|
|
129
|
-
children:
|
|
130
|
+
/* @__PURE__ */ O("span", {
|
|
131
|
+
className: i(V, H.switcher),
|
|
132
|
+
children: b.formatSwitcherText(r + 1, D)
|
|
130
133
|
}),
|
|
131
|
-
/* @__PURE__ */
|
|
132
|
-
icon: /* @__PURE__ */
|
|
134
|
+
/* @__PURE__ */ O(p, {
|
|
135
|
+
icon: /* @__PURE__ */ O(v, {
|
|
133
136
|
size: 14,
|
|
134
137
|
className: "rtl:scale-x-[-1]",
|
|
135
138
|
stroke: s
|
|
136
139
|
}),
|
|
137
140
|
size: u.Small,
|
|
138
|
-
"aria-label":
|
|
139
|
-
onClick: () =>
|
|
141
|
+
"aria-label": b.nextCitation,
|
|
142
|
+
onClick: () => a((r + 1) % D)
|
|
140
143
|
})
|
|
141
144
|
]
|
|
142
145
|
})]
|
|
143
146
|
}),
|
|
144
|
-
(
|
|
147
|
+
(j.body?.title || j.body?.quote || M) && /* @__PURE__ */ k("div", {
|
|
145
148
|
className: "flex flex-col gap-3",
|
|
146
|
-
children: [
|
|
147
|
-
className: i(
|
|
148
|
-
children:
|
|
149
|
-
}), (
|
|
149
|
+
children: [j.body?.title && /* @__PURE__ */ O("p", {
|
|
150
|
+
className: i(R, H.title, "break-words"),
|
|
151
|
+
children: j.body.title
|
|
152
|
+
}), (W || M) && /* @__PURE__ */ k("div", {
|
|
150
153
|
className: "flex flex-col items-start gap-1",
|
|
151
|
-
children: [/* @__PURE__ */
|
|
152
|
-
ref:
|
|
153
|
-
id:
|
|
154
|
-
tabIndex:
|
|
155
|
-
className: i(
|
|
156
|
-
children:
|
|
157
|
-
content:
|
|
154
|
+
children: [/* @__PURE__ */ O("div", {
|
|
155
|
+
ref: K,
|
|
156
|
+
id: G,
|
|
157
|
+
tabIndex: q ? 0 : void 0,
|
|
158
|
+
className: i(z, H.quote, "w-full break-words", q ? "max-h-[min(20rem,50vh)] overflow-y-auto" : "line-clamp-6"),
|
|
159
|
+
children: W && /* @__PURE__ */ O(t, {
|
|
160
|
+
content: W,
|
|
158
161
|
classNames: {
|
|
159
|
-
p: i(
|
|
160
|
-
ul: i(
|
|
161
|
-
ol:
|
|
162
|
+
p: i(z, H.quote),
|
|
163
|
+
ul: i(z, "ps-[1.5em]"),
|
|
164
|
+
ol: z,
|
|
162
165
|
strong: B
|
|
163
166
|
},
|
|
164
|
-
codeBlockCopyLabel:
|
|
165
|
-
codeBlockCopiedLabel:
|
|
166
|
-
codeBlockDownloadLabel:
|
|
167
|
-
tableScrollRegionAriaLabel:
|
|
168
|
-
mathScrollRegionAriaLabel:
|
|
167
|
+
codeBlockCopyLabel: b.codeBlockCopyLabel,
|
|
168
|
+
codeBlockCopiedLabel: b.codeBlockCopiedLabel,
|
|
169
|
+
codeBlockDownloadLabel: b.codeBlockDownloadLabel,
|
|
170
|
+
tableScrollRegionAriaLabel: b.tableScrollRegionAriaLabel,
|
|
171
|
+
mathScrollRegionAriaLabel: b.mathScrollRegionAriaLabel
|
|
169
172
|
})
|
|
170
|
-
}),
|
|
171
|
-
label:
|
|
173
|
+
}), Y && /* @__PURE__ */ O(m, {
|
|
174
|
+
label: q ? b.showLess : b.showMore,
|
|
172
175
|
size: u.Small,
|
|
173
|
-
"aria-expanded":
|
|
174
|
-
"aria-controls":
|
|
175
|
-
onClick: () =>
|
|
176
|
+
"aria-expanded": q,
|
|
177
|
+
"aria-controls": G,
|
|
178
|
+
onClick: () => J((e) => !e)
|
|
176
179
|
})]
|
|
177
180
|
})]
|
|
178
181
|
}),
|
|
179
|
-
/* @__PURE__ */
|
|
182
|
+
/* @__PURE__ */ k("div", {
|
|
180
183
|
className: "flex justify-start gap-2",
|
|
181
|
-
children: [
|
|
182
|
-
label:
|
|
184
|
+
children: [o && /* @__PURE__ */ O(g, {
|
|
185
|
+
label: b.preview,
|
|
183
186
|
size: u.Small,
|
|
184
|
-
onClick: () =>
|
|
185
|
-
}), (N ||
|
|
186
|
-
label: N ?
|
|
187
|
+
onClick: () => o(j)
|
|
188
|
+
}), (N || h) && /* @__PURE__ */ O(g, {
|
|
189
|
+
label: N ? b.openInBrowser : b.download,
|
|
187
190
|
size: u.Small,
|
|
188
|
-
onClick: () =>
|
|
191
|
+
onClick: () => l(j)
|
|
189
192
|
})]
|
|
190
193
|
})
|
|
191
194
|
]
|
|
192
195
|
});
|
|
193
|
-
},
|
|
196
|
+
}, W = ({ annotationCount: e, onOpen: t, icon: n, labels: r, labelClassName: a = "dial-caption-text" }) => /* @__PURE__ */ O(h, {
|
|
194
197
|
size: u.Small,
|
|
195
|
-
className: i("max-w-[240px]",
|
|
198
|
+
className: i("max-w-[240px]", A.citationMarker),
|
|
196
199
|
textClassName: "min-w-0 truncate",
|
|
197
200
|
iconBefore: n,
|
|
198
|
-
label: /* @__PURE__ */
|
|
201
|
+
label: /* @__PURE__ */ O("span", {
|
|
199
202
|
className: a,
|
|
200
203
|
children: e > 1 ? r.labelWithOverflow : r.label
|
|
201
204
|
}),
|
|
202
205
|
"aria-label": r.ariaLabel,
|
|
203
206
|
onClick: t
|
|
204
|
-
}),
|
|
205
|
-
let e = x(
|
|
207
|
+
}), G = y(null), K = G.Provider, q = () => {
|
|
208
|
+
let e = x(G);
|
|
206
209
|
if (e == null) throw Error("useCitationCardContext must be used within a CitationCardProvider");
|
|
207
210
|
return e;
|
|
208
|
-
},
|
|
209
|
-
let
|
|
210
|
-
e ||
|
|
211
|
-
}, [
|
|
212
|
-
t(e),
|
|
211
|
+
}, J = { trigger: "_trigger_1dwia_7" }, Y = ({ group: e, onPreview: t, isPreviewable: n, onOpenInBrowser: r, isDownloadEnabled: a = !0, isPreviewOpen: o = !1, previewFilesOnMarkerClick: s = !1, icon: c, headerIcon: u, cardLabels: d, markerLabels: f, cardTypography: p, markerLabelClassName: m }) => {
|
|
212
|
+
let h = q(), g = ee(), _ = h.isOpen(g), v = h.getActiveIndex(e.groupKey), y = e.annotations[v] ?? e.primaryAnnotation, x = n?.(y) ?? !0, S = b((e) => {
|
|
213
|
+
e || h.closePopup(g);
|
|
214
|
+
}, [h, g]), C = w(() => t && x ? (e) => {
|
|
215
|
+
t(e), h.closePopup(g);
|
|
213
216
|
} : void 0, [
|
|
214
217
|
t,
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
]),
|
|
219
|
-
|
|
220
|
-
|
|
218
|
+
x,
|
|
219
|
+
h,
|
|
220
|
+
g
|
|
221
|
+
]), T = b(() => {
|
|
222
|
+
let t = e.annotations.length === 1 && !te(y);
|
|
223
|
+
if ((o || s && t) && C) {
|
|
224
|
+
C(y);
|
|
221
225
|
return;
|
|
222
226
|
}
|
|
223
|
-
|
|
227
|
+
h.openPopup(g);
|
|
224
228
|
}, [
|
|
225
229
|
o,
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
230
|
+
s,
|
|
231
|
+
e.annotations.length,
|
|
232
|
+
C,
|
|
233
|
+
y,
|
|
234
|
+
h,
|
|
235
|
+
g
|
|
236
|
+
]), E = b(() => /* @__PURE__ */ O(U, {
|
|
231
237
|
group: e,
|
|
232
|
-
activeIndex:
|
|
233
|
-
onIndexChange: (t) =>
|
|
234
|
-
onPreview:
|
|
238
|
+
activeIndex: v,
|
|
239
|
+
onIndexChange: (t) => h.setActiveIndex(e.groupKey, t),
|
|
240
|
+
onPreview: C,
|
|
235
241
|
onOpenInBrowser: r,
|
|
236
242
|
isDownloadEnabled: a,
|
|
237
|
-
headerIcon:
|
|
238
|
-
labels:
|
|
239
|
-
typography:
|
|
243
|
+
headerIcon: u,
|
|
244
|
+
labels: d,
|
|
245
|
+
typography: p
|
|
240
246
|
}), [
|
|
241
247
|
e,
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
248
|
+
v,
|
|
249
|
+
h,
|
|
250
|
+
C,
|
|
245
251
|
r,
|
|
246
252
|
a,
|
|
247
|
-
c,
|
|
248
253
|
u,
|
|
249
|
-
|
|
254
|
+
d,
|
|
255
|
+
p
|
|
250
256
|
]);
|
|
251
|
-
return /* @__PURE__ */
|
|
252
|
-
open:
|
|
253
|
-
onOpenChange:
|
|
257
|
+
return /* @__PURE__ */ O(l, {
|
|
258
|
+
open: _,
|
|
259
|
+
onOpenChange: S,
|
|
254
260
|
trigger: [],
|
|
255
261
|
placement: "bottom-end",
|
|
256
262
|
matchReferenceWidth: !1,
|
|
257
|
-
className: i("ms-1 inline-flex align-middle",
|
|
258
|
-
listClassName: i("!p-0 !bg-transparent !shadow-none !rounded-none",
|
|
259
|
-
renderOverlay:
|
|
260
|
-
children: /* @__PURE__ */
|
|
263
|
+
className: i("ms-1 inline-flex align-middle", J.trigger),
|
|
264
|
+
listClassName: i("!p-0 !bg-transparent !shadow-none !rounded-none", A.citationDropdown),
|
|
265
|
+
renderOverlay: E,
|
|
266
|
+
children: /* @__PURE__ */ O(W, {
|
|
261
267
|
sourceName: e.sourceName,
|
|
262
268
|
annotationCount: e.annotations.length,
|
|
263
|
-
onOpen:
|
|
264
|
-
icon:
|
|
265
|
-
labels:
|
|
266
|
-
labelClassName:
|
|
269
|
+
onOpen: T,
|
|
270
|
+
icon: c,
|
|
271
|
+
labels: f,
|
|
272
|
+
labelClassName: m
|
|
267
273
|
})
|
|
268
274
|
});
|
|
269
|
-
},
|
|
275
|
+
}, X = (e) => {
|
|
270
276
|
let t = e.trim();
|
|
271
277
|
if (!t.startsWith("|") || !t.endsWith("|") || /[\r\n]/.test(t)) return;
|
|
272
278
|
let n = [], r = "";
|
|
@@ -275,11 +281,11 @@ var O = {
|
|
|
275
281
|
i === "\\" && a != null && /[!-/:-@[-`{-~]/.test(a) ? (r += a, e += 1) : i === "|" ? (n.push(r.trim()), r = "") : r += i;
|
|
276
282
|
}
|
|
277
283
|
if (!(r !== "" || n.length < 2 || n.every((e) => e === "" || /^:?-{3,}:?$/.test(e)))) return n;
|
|
278
|
-
},
|
|
284
|
+
}, re = (e) => {
|
|
279
285
|
if (e.type !== "docx_text_anchor" && e.type !== "pptx_text_anchor") return;
|
|
280
286
|
let { text: t, occurrence: n, slide: r } = e;
|
|
281
287
|
if (typeof t != "string" || typeof n != "number" || !Number.isSafeInteger(n) || n < 1) return;
|
|
282
|
-
let i =
|
|
288
|
+
let i = X(t);
|
|
283
289
|
if (i != null) {
|
|
284
290
|
if (e.type === "docx_text_anchor") return {
|
|
285
291
|
type: "docx_text_anchor",
|
|
@@ -293,7 +299,7 @@ var O = {
|
|
|
293
299
|
slide: r
|
|
294
300
|
};
|
|
295
301
|
}
|
|
296
|
-
},
|
|
302
|
+
}, ie = {
|
|
297
303
|
backgroundColor: "transparent",
|
|
298
304
|
borderColor: "var(--stroke-accent, #1D4ED8)",
|
|
299
305
|
borderWidth: "2px",
|
|
@@ -318,7 +324,7 @@ var O = {
|
|
|
318
324
|
x2: i + o,
|
|
319
325
|
y2: a + s
|
|
320
326
|
};
|
|
321
|
-
},
|
|
327
|
+
}, Z = (e) => {
|
|
322
328
|
if (!r(e)) return;
|
|
323
329
|
let t = e, n;
|
|
324
330
|
if (t.type === "pdf_bbox") {
|
|
@@ -350,7 +356,7 @@ var O = {
|
|
|
350
356
|
if (t.type !== "pdf_bbox" && t.type !== "pdf_region") return;
|
|
351
357
|
let n = t.page;
|
|
352
358
|
return typeof n == "number" && Number.isInteger(n) && n >= 1 ? n : void 0;
|
|
353
|
-
},
|
|
359
|
+
}, 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(",")}}`, se = (e) => {
|
|
354
360
|
let t = 5381;
|
|
355
361
|
for (let n = 0; n < e.length; n += 1) t = t * 33 + e.charCodeAt(n) | 0;
|
|
356
362
|
return (t >>> 0).toString(36);
|
|
@@ -358,10 +364,10 @@ var O = {
|
|
|
358
364
|
let t = e.body?.selector;
|
|
359
365
|
if (t == null) return;
|
|
360
366
|
let n = (Array.isArray(t) ? t : [t]).flatMap((e) => {
|
|
361
|
-
let t =
|
|
367
|
+
let t = Z(e);
|
|
362
368
|
return t == null ? [] : [t];
|
|
363
|
-
}), r =
|
|
364
|
-
if (!(n.length === 0 && r.length === 0)) return
|
|
369
|
+
}), r = Se(e);
|
|
370
|
+
if (!(n.length === 0 && r.length === 0)) return Q([n, r]);
|
|
365
371
|
}, le = (e) => {
|
|
366
372
|
let t = e.target?.selector, n = t?.type === "html_tag" ? t.id : void 0, r = typeof n == "string" ? n : void 0, i = ce(e);
|
|
367
373
|
if (!(r == null && i == null)) return se(`${r ?? ""}|${i ?? ""}`);
|
|
@@ -372,13 +378,13 @@ var O = {
|
|
|
372
378
|
if (i == null) return [];
|
|
373
379
|
let a = (Array.isArray(i) ? i : [i]).flatMap((e) => {
|
|
374
380
|
if (!r(e)) return [];
|
|
375
|
-
let t =
|
|
381
|
+
let t = Z(e);
|
|
376
382
|
return t == null ? [] : [t];
|
|
377
383
|
});
|
|
378
384
|
return a.length === 0 ? [] : [{
|
|
379
385
|
id: t[n],
|
|
380
386
|
bboxes: a,
|
|
381
|
-
style:
|
|
387
|
+
style: ie
|
|
382
388
|
}];
|
|
383
389
|
});
|
|
384
390
|
}, de = (e, t) => e.index == null ? le(e) ?? String(t) : String(e.index), fe = (e) => {
|
|
@@ -396,7 +402,7 @@ var O = {
|
|
|
396
402
|
let n = Array.isArray(t) ? t : [t];
|
|
397
403
|
for (let e of n) {
|
|
398
404
|
if (!r(e)) continue;
|
|
399
|
-
let t =
|
|
405
|
+
let t = Z(e);
|
|
400
406
|
if (t != null) return t.page;
|
|
401
407
|
}
|
|
402
408
|
for (let e of n) {
|
|
@@ -418,11 +424,11 @@ var O = {
|
|
|
418
424
|
if (e.type !== "pptx_text_range") return !1;
|
|
419
425
|
let t = e;
|
|
420
426
|
return typeof t.slide == "number" && typeof t.shape_id == "string" && typeof t.start == "number" && typeof t.end == "number" && typeof t.text == "string";
|
|
421
|
-
},
|
|
427
|
+
}, _e = (e) => typeof e == "object" && !!e && typeof e.row == "number" && typeof e.col == "number", ve = (e) => {
|
|
422
428
|
if (e.type !== "excel_rc_range") return !1;
|
|
423
429
|
let t = e;
|
|
424
|
-
return typeof t.sheet == "string" &&
|
|
425
|
-
},
|
|
430
|
+
return typeof t.sheet == "string" && _e(t.start) && (t.end === void 0 || t.end === null || _e(t.end));
|
|
431
|
+
}, ye = (e) => {
|
|
426
432
|
let { story: t, path: n, start: r, end: i, text: a } = e;
|
|
427
433
|
if (!(!n.every((e) => Number.isInteger(e)) || !Number.isInteger(r) || !Number.isInteger(i) || r < 0 || i < r)) return {
|
|
428
434
|
type: "docx_text_range",
|
|
@@ -432,7 +438,7 @@ var O = {
|
|
|
432
438
|
endExclusive: i,
|
|
433
439
|
text: a
|
|
434
440
|
};
|
|
435
|
-
},
|
|
441
|
+
}, be = (e) => {
|
|
436
442
|
let { slide: t, shape_id: n, start: r, end: i, text: a } = e;
|
|
437
443
|
if (!(!Number.isInteger(t) || t < 1 || !Number.isInteger(r) || !Number.isInteger(i) || r < 0 || i < r)) return {
|
|
438
444
|
type: "pptx_text_range",
|
|
@@ -442,7 +448,7 @@ var O = {
|
|
|
442
448
|
endExclusive: i,
|
|
443
449
|
text: a
|
|
444
450
|
};
|
|
445
|
-
},
|
|
451
|
+
}, xe = (e) => {
|
|
446
452
|
let { sheet: t, start: n, end: r } = e;
|
|
447
453
|
if (!(t.length === 0 || !Number.isInteger(n.row) || !Number.isInteger(n.col) || n.row < 1 || n.col < 1)) {
|
|
448
454
|
if (r == null) return {
|
|
@@ -457,30 +463,30 @@ var O = {
|
|
|
457
463
|
end: r
|
|
458
464
|
};
|
|
459
465
|
}
|
|
460
|
-
},
|
|
466
|
+
}, Se = (e) => {
|
|
461
467
|
let t = e.body?.selector;
|
|
462
468
|
return t == null ? [] : (Array.isArray(t) ? t : [t]).flatMap((e) => {
|
|
463
469
|
if (!r(e)) return [];
|
|
464
470
|
if (he(e)) {
|
|
465
|
-
let t =
|
|
471
|
+
let t = ye(e);
|
|
466
472
|
return t ? [t] : [];
|
|
467
473
|
}
|
|
468
474
|
if (ge(e)) {
|
|
469
|
-
let t =
|
|
475
|
+
let t = be(e);
|
|
470
476
|
return t ? [t] : [];
|
|
471
477
|
}
|
|
472
|
-
if (
|
|
473
|
-
let t =
|
|
478
|
+
if (ve(e)) {
|
|
479
|
+
let t = xe(e);
|
|
474
480
|
return t ? [t] : [];
|
|
475
481
|
}
|
|
476
|
-
let t =
|
|
482
|
+
let t = re(e);
|
|
477
483
|
return t ? [t] : [];
|
|
478
484
|
});
|
|
479
|
-
},
|
|
485
|
+
}, Ce = (e, t) => w(() => t ? [] : me(e), [t, e]), we = {
|
|
480
486
|
openOwnerKey: null,
|
|
481
487
|
activeIndexByGroup: {}
|
|
482
|
-
},
|
|
483
|
-
let [e, t] =
|
|
488
|
+
}, Te = () => {
|
|
489
|
+
let [e, t] = E(we), n = b((e) => {
|
|
484
490
|
t((t) => ({
|
|
485
491
|
...t,
|
|
486
492
|
openOwnerKey: e
|
|
@@ -499,7 +505,7 @@ var O = {
|
|
|
499
505
|
}
|
|
500
506
|
}));
|
|
501
507
|
}, []);
|
|
502
|
-
return
|
|
508
|
+
return w(() => ({
|
|
503
509
|
openPopup: n,
|
|
504
510
|
closePopup: r,
|
|
505
511
|
setActiveIndex: i,
|
|
@@ -511,7 +517,7 @@ var O = {
|
|
|
511
517
|
i,
|
|
512
518
|
e
|
|
513
519
|
]);
|
|
514
|
-
},
|
|
520
|
+
}, Ee = /⟦C(\d+)⟧/g, De = (e, t) => {
|
|
515
521
|
let n = t.map((e, t) => ({
|
|
516
522
|
g: e,
|
|
517
523
|
idx: t
|
|
@@ -524,26 +530,26 @@ var O = {
|
|
|
524
530
|
}).sort((e, t) => t.pos - e.pos), r = e;
|
|
525
531
|
for (let { idx: e, pos: t } of n) r = `${r.slice(0, t)}⟦C${e}⟧${r.slice(t)}`;
|
|
526
532
|
return r;
|
|
527
|
-
},
|
|
533
|
+
}, Oe = /<cit\s+data-id=(?:"[^"]+"|'[^']+')\s*>\s*<\/cit>/g, ke = /^<cit\s+data-id=(?:"[^"]+"|'[^']+')\s*>\s*<\/cit>$/, Ae = /<cit\s+data-id=(?:"[^"]+"|'[^']+')\s*>\s*<\/cit>|<\/?cit\b[^>]*>|<\/?cit\b[^>]*$/gi, je = (e) => e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"), Me = (e) => e.replace(Ae, (e) => ke.test(e) ? e : je(e)), Ne = (e) => Me(e).replace(Oe, ""), Pe = (e) => {
|
|
528
534
|
let t = e.primaryAnnotation.target?.selector;
|
|
529
535
|
return t?.type === "html_tag" ? t.id : void 0;
|
|
530
|
-
},
|
|
536
|
+
}, Fe = (e, t = []) => {
|
|
531
537
|
let n = /* @__PURE__ */ new Map();
|
|
532
538
|
for (let r of [...t, ...e]) {
|
|
533
|
-
let e =
|
|
539
|
+
let e = Pe(r);
|
|
534
540
|
e != null && n.set(e, r);
|
|
535
541
|
}
|
|
536
542
|
return n;
|
|
537
|
-
},
|
|
543
|
+
}, Ie = /<cit\s+data-id=(?:"([^"]+)"|'([^']+)')\s*>\s*<\/cit>/g, Le = (e) => e.replace(/[\\`*_[\]<>|]/g, "\\$&"), Re = (e, t, n = []) => {
|
|
538
544
|
if (!e.includes("<cit")) return e;
|
|
539
|
-
let r =
|
|
540
|
-
return r.size === 0 ? e : e.replace(
|
|
545
|
+
let r = Fe(t, n);
|
|
546
|
+
return r.size === 0 ? e : e.replace(Ie, (e, t, n) => {
|
|
541
547
|
let i = r.get(t ?? n ?? "");
|
|
542
|
-
return i ?
|
|
548
|
+
return i ? Le(i.sourceName) : e;
|
|
543
549
|
});
|
|
544
550
|
}, $ = (e, t) => {
|
|
545
551
|
if (typeof e == "string") {
|
|
546
|
-
let n = e.split(
|
|
552
|
+
let n = e.split(Ee);
|
|
547
553
|
if (n.length === 1) return e;
|
|
548
554
|
let r = [];
|
|
549
555
|
return n.forEach((e, n) => {
|
|
@@ -554,46 +560,47 @@ var O = {
|
|
|
554
560
|
let n = $(e, t);
|
|
555
561
|
return Array.isArray(n) ? n : [n];
|
|
556
562
|
}) : e;
|
|
557
|
-
},
|
|
563
|
+
}, ze = {}, Be = [], Ve = (e, t) => /* @__PURE__ */ k(D, { children: [
|
|
558
564
|
e == null ? "<cit>" : `<cit data-id="${e}">`,
|
|
559
565
|
t,
|
|
560
566
|
"</cit>"
|
|
561
|
-
] }),
|
|
562
|
-
let { onPreview: s, isPreviewable: c, onOpenInBrowser: l, isDownloadEnabled: u = !0, isPreviewOpen: d = !1,
|
|
567
|
+
] }), He = (e, t, n, r = !1, a = !1, o = Be) => {
|
|
568
|
+
let { onPreview: s, isPreviewable: c, onOpenInBrowser: l, isDownloadEnabled: u = !0, isPreviewOpen: d = !1, previewFilesOnMarkerClick: f = !1, buildLabels: p } = n, m = w(() => r ? Ne(e) : Me(t.length > 0 ? De(e, t) : e), [
|
|
563
569
|
e,
|
|
564
570
|
t,
|
|
565
571
|
r
|
|
566
|
-
]),
|
|
572
|
+
]), h = m.includes("<cit");
|
|
567
573
|
return {
|
|
568
|
-
processedContent:
|
|
569
|
-
markdownComponents:
|
|
570
|
-
let e =
|
|
571
|
-
let { cardLabels: t, markerLabels: n } =
|
|
572
|
-
return /* @__PURE__ */
|
|
574
|
+
processedContent: m,
|
|
575
|
+
markdownComponents: w(() => {
|
|
576
|
+
let e = Fe(t, o), n = (e) => {
|
|
577
|
+
let { cardLabels: t, markerLabels: n } = p(e);
|
|
578
|
+
return /* @__PURE__ */ O(Y, {
|
|
573
579
|
group: e,
|
|
574
580
|
onPreview: (t) => s(t, e),
|
|
575
581
|
isPreviewable: c,
|
|
576
582
|
onOpenInBrowser: l,
|
|
577
583
|
isDownloadEnabled: u,
|
|
578
584
|
isPreviewOpen: d,
|
|
585
|
+
previewFilesOnMarkerClick: f,
|
|
579
586
|
cardLabels: t,
|
|
580
587
|
markerLabels: n
|
|
581
588
|
}, `citation-${e.groupKey}`);
|
|
582
589
|
}, r = (e) => {
|
|
583
590
|
let r = t[e];
|
|
584
591
|
return r ? n(r) : null;
|
|
585
|
-
},
|
|
592
|
+
}, m = { cit: (t) => {
|
|
586
593
|
let r = t["data-id"] == null ? void 0 : e.get(t["data-id"]);
|
|
587
|
-
return r ? n(r) :
|
|
594
|
+
return r ? n(r) : Ve(t["data-id"], t.children);
|
|
588
595
|
} };
|
|
589
|
-
return t.length === 0 && o.length === 0 ?
|
|
590
|
-
...
|
|
591
|
-
p: ({ children: e, ...t }) => /* @__PURE__ */
|
|
596
|
+
return t.length === 0 && o.length === 0 ? h ? m : ze : {
|
|
597
|
+
...m,
|
|
598
|
+
p: ({ children: e, ...t }) => /* @__PURE__ */ O("p", {
|
|
592
599
|
...t,
|
|
593
600
|
className: i(a ? "dial-small-paragraph-text" : "dial-body-paragraph-text", "mb-3 [overflow-wrap:anywhere] [text-wrap:pretty] last:mb-0"),
|
|
594
601
|
children: $(e, r)
|
|
595
602
|
}),
|
|
596
|
-
li: ({ children: e, ...t }) => /* @__PURE__ */
|
|
603
|
+
li: ({ children: e, ...t }) => /* @__PURE__ */ O("li", {
|
|
597
604
|
...t,
|
|
598
605
|
className: "mb-1.5 last:mb-0",
|
|
599
606
|
children: $(e, r)
|
|
@@ -608,18 +615,19 @@ var O = {
|
|
|
608
615
|
u,
|
|
609
616
|
d,
|
|
610
617
|
f,
|
|
618
|
+
p,
|
|
611
619
|
a,
|
|
612
|
-
|
|
620
|
+
h
|
|
613
621
|
])
|
|
614
622
|
};
|
|
615
|
-
},
|
|
616
|
-
let t =
|
|
623
|
+
}, Ue = (e) => e.url == null && e.reference_url != null, We = /^(.*\.pdf)(?:#page=(\d+))?$/i, Ge = (e) => {
|
|
624
|
+
let t = We.exec(e);
|
|
617
625
|
return t ? {
|
|
618
626
|
baseUrl: t[1],
|
|
619
627
|
page: t[2] == null ? null : Number(t[2])
|
|
620
628
|
} : null;
|
|
621
|
-
},
|
|
622
|
-
let n = t.reference_url, r =
|
|
629
|
+
}, Ke = (t) => R((t ?? []).filter(Ue).map((t) => {
|
|
630
|
+
let n = t.reference_url, r = Ge(n) != null;
|
|
623
631
|
return { body: {
|
|
624
632
|
quote: t.data,
|
|
625
633
|
source: {
|
|
@@ -633,4 +641,4 @@ var O = {
|
|
|
633
641
|
} };
|
|
634
642
|
}));
|
|
635
643
|
//#endregion
|
|
636
|
-
export {
|
|
644
|
+
export { U as CitationCard, K as CitationCardProvider, Y as CitationDropdown, W as CitationMarker, A as QUOTATIONS_CLASS, de as annotationHighlightId, fe as annotationHighlightIds, Se as annotationToOfficeHighlightLocations, ue as annotationsToPdfHighlights, V as gatherSameSourceAnnotations, pe as getAnnotationPdfPage, Ke as getReferenceAttachmentGroups, B as groupAnnotations, z as groupAnnotationsByCitId, R as groupAnnotationsBySource, De as injectCitationSentinels, he as isDocxRangeSelector, ve as isExcelRcRangeSelector, ge as isPptxRangeSelector, Ue as isReferenceOnlyAttachment, Ge as parsePdfPageReference, Re as replaceCitTagsWithSourceNames, $ as replaceSentinelsInChildren, me as resolveMessageAnnotations, Ne as stripCitTagsWhileStreaming, Ce as useAnnotations, Te as useCitationCard, q as useCitationCardContext, He 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.3.0-dev.
|
|
4
|
+
"version": "1.3.0-dev.51",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./index.js",
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"react": "^19.2.8",
|
|
26
|
-
"@epam/ai-dial-chat-shared": "1.3.0-dev.
|
|
27
|
-
"@epam/ai-dial-ui-kit": "^0.15.
|
|
26
|
+
"@epam/ai-dial-chat-shared": "1.3.0-dev.51",
|
|
27
|
+
"@epam/ai-dial-ui-kit": "^0.15.4"
|
|
28
28
|
},
|
|
29
29
|
"repository": {
|
|
30
30
|
"type": "git",
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Annotation } from '@epam/ai-dial-chat-shared';
|
|
2
|
+
/**
|
|
3
|
+
* Whether an annotation's source is a web page rather than a file. A web
|
|
4
|
+
* page keeps the citation card (quote + "Open in browser"), while a file can
|
|
5
|
+
* be previewed straight from its marker; the card's "Open in browser" vs
|
|
6
|
+
* "Download" label uses the same rule so the two never disagree.
|
|
7
|
+
*/
|
|
8
|
+
export declare const isWebLinkAnnotation: (annotation: Annotation) => boolean;
|
|
9
|
+
//# sourceMappingURL=citation-source-kind.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"citation-source-kind.d.ts","sourceRoot":"","sources":["../../src/utils/citation-source-kind.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAG5D;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,GAAI,YAAY,UAAU,KAAG,OAG5D,CAAC"}
|