@epam/ai-dial-quotations 1.3.0-dev.35 → 1.3.0-dev.353
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/CitationDropdown/CitationDropdown.d.ts +1 -1
- package/components/CitationDropdown/CitationDropdown.d.ts.map +1 -1
- package/components/CitationMarker/CitationMarker.d.ts +3 -3
- package/components/CitationMarker/CitationMarker.d.ts.map +1 -1
- package/hooks/citation-rendering.d.ts +8 -0
- package/hooks/citation-rendering.d.ts.map +1 -0
- package/hooks/useCitationMarkdownComponents/useCitationMarkdownComponents.d.ts +4 -0
- package/hooks/useCitationMarkdownComponents/useCitationMarkdownComponents.d.ts.map +1 -1
- package/hooks/useCitationTagRenderer/useCitationTagRenderer.d.ts +15 -0
- package/hooks/useCitationTagRenderer/useCitationTagRenderer.d.ts.map +1 -0
- package/index.css +3 -2
- package/index.d.ts +4 -2
- package/index.d.ts.map +1 -1
- package/index.js +291 -246
- package/package.json +5 -5
- package/utils/annotation.d.ts +3 -0
- package/utils/annotation.d.ts.map +1 -1
- package/utils/citation-injection.d.ts +11 -4
- package/utils/citation-injection.d.ts.map +1 -1
- package/utils/useHtmlTagAnnotationGroups.d.ts +4 -0
- package/utils/useHtmlTagAnnotationGroups.d.ts.map +1 -0
|
@@ -18,7 +18,7 @@ export interface CitationDropdownProps {
|
|
|
18
18
|
onOpenInBrowser: (annotation: Annotation) => void;
|
|
19
19
|
/** Whether the card shows the "Download" button for a previewable file. Defaults to `true`. */
|
|
20
20
|
isDownloadEnabled?: boolean;
|
|
21
|
-
/** Whether the host's preview panel is open; a marker click then previews
|
|
21
|
+
/** Whether the host's preview panel is open; a marker click then previews a single-citation group's annotation directly instead of showing the card, while multi-citation groups keep the card. Defaults to `false`. */
|
|
22
22
|
isPreviewOpen?: boolean;
|
|
23
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
24
|
previewFilesOnMarkerClick?: boolean;
|
|
@@ -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;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,
|
|
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,wNAAwN;IACxN,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,CAiItD,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FC, ReactNode } from 'react';
|
|
1
|
+
import { FC, HTMLAttributes, ReactNode } from 'react';
|
|
2
2
|
/** User-visible strings for `CitationMarker`. */
|
|
3
3
|
export interface CitationMarkerLabels {
|
|
4
4
|
/** Accessible label for the marker button. */
|
|
@@ -8,8 +8,8 @@ export interface CitationMarkerLabels {
|
|
|
8
8
|
/** Button text when `annotationCount > 1`. */
|
|
9
9
|
labelWithOverflow: string;
|
|
10
10
|
}
|
|
11
|
-
/** Props for the `CitationMarker` component. */
|
|
12
|
-
export interface CitationMarkerProps {
|
|
11
|
+
/** Props for the `CitationMarker` component; the popup ARIA attributes are forwarded to the button. */
|
|
12
|
+
export interface CitationMarkerProps extends Pick<HTMLAttributes<HTMLButtonElement>, 'aria-haspopup' | 'aria-expanded' | 'aria-controls'> {
|
|
13
13
|
/** Human-readable source name derived from the attachment URL. */
|
|
14
14
|
sourceName: string;
|
|
15
15
|
/** Total number of annotations in this citation group. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CitationMarker.d.ts","sourceRoot":"","sources":["../../../src/components/CitationMarker/CitationMarker.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"CitationMarker.d.ts","sourceRoot":"","sources":["../../../src/components/CitationMarker/CitationMarker.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,EAAE,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGtD,iDAAiD;AACjD,MAAM,WAAW,oBAAoB;IACnC,8CAA8C;IAC9C,SAAS,EAAE,MAAM,CAAC;IAClB,gDAAgD;IAChD,KAAK,EAAE,MAAM,CAAC;IACd,8CAA8C;IAC9C,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AAED,uGAAuG;AACvG,MAAM,WAAW,mBAAoB,SAAQ,IAAI,CAC/C,cAAc,CAAC,iBAAiB,CAAC,EACjC,eAAe,GAAG,eAAe,GAAG,eAAe,CACpD;IACC,kEAAkE;IAClE,UAAU,EAAE,MAAM,CAAC;IACnB,0DAA0D;IAC1D,eAAe,EAAE,MAAM,CAAC;IACxB,yEAAyE;IACzE,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,mEAAmE;IACnE,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,4BAA4B;IAC5B,MAAM,EAAE,oBAAoB,CAAC;IAC7B,8FAA8F;IAC9F,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,sEAAsE;AACtE,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC,mBAAmB,CAiClD,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { AnnotationGroup } from '../utils/group-annotations-by-source';
|
|
3
|
+
import { UseCitationMarkdownComponentsCallbacks } from './useCitationMarkdownComponents/useCitationMarkdownComponents';
|
|
4
|
+
/** Renders a `<cit>` element as the literal markup it was written as. */
|
|
5
|
+
export declare const renderCitTagAsText: (dataId: string | undefined, children: ReactNode) => import('react').JSX.Element;
|
|
6
|
+
/** Returns a function that renders a group's `CitationDropdown` with the host's callbacks and labels. */
|
|
7
|
+
export declare const createCitationGroupRenderer: ({ onPreview, isPreviewable, onOpenInBrowser, isDownloadEnabled, isPreviewOpen, previewFilesOnMarkerClick, buildLabels, }: UseCitationMarkdownComponentsCallbacks) => (group: AnnotationGroup) => import('react').JSX.Element;
|
|
8
|
+
//# sourceMappingURL=citation-rendering.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"citation-rendering.d.ts","sourceRoot":"","sources":["../../src/hooks/citation-rendering.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAC5E,OAAO,KAAK,EAAE,sCAAsC,EAAE,MAAM,+DAA+D,CAAC;AAE5H,yEAAyE;AACzE,eAAO,MAAM,kBAAkB,GAC7B,QAAQ,MAAM,GAAG,SAAS,EAC1B,UAAU,SAAS,gCAOpB,CAAC;AAEF,yGAAyG;AACzG,eAAO,MAAM,2BAA2B,GAAI,0HAQzC,sCAAsC,aACX,eAAe,gCAmB5C,CAAC"}
|
|
@@ -17,6 +17,10 @@ export interface UseCitationMarkdownComponentsCallbacks {
|
|
|
17
17
|
isPreviewOpen?: boolean;
|
|
18
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
19
|
previewFilesOnMarkerClick?: boolean;
|
|
20
|
+
/** Typography class of a cited paragraph. Defaults to `'dial-body-paragraph-text'`. */
|
|
21
|
+
paragraphClassName?: string;
|
|
22
|
+
/** Typography class of a cited paragraph while `isCompactTypography` is set. Defaults to `'dial-small-paragraph-text'`. */
|
|
23
|
+
compactParagraphClassName?: string;
|
|
20
24
|
/** Builds the translated label bundles used by a given citation group's card and marker. */
|
|
21
25
|
buildLabels(group: AnnotationGroup): {
|
|
22
26
|
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;
|
|
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;AACrF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gDAAgD,CAAC;AAQ3F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAM/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,uFAAuF;IACvF,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,2HAA2H;IAC3H,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC,4FAA4F;IAC5F,WAAW,CAAC,KAAK,EAAE,eAAe,GAAG;QACnC,UAAU,EAAE,kBAAkB,CAAC;QAC/B,YAAY,EAAE,oBAAoB,CAAC;KACpC,CAAC;CACH;AAeD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;CAsG5D,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { AnnotationGroup } from '../../utils/group-annotations-by-source';
|
|
3
|
+
import { UseCitationMarkdownComponentsCallbacks } from '../useCitationMarkdownComponents/useCitationMarkdownComponents';
|
|
4
|
+
/**
|
|
5
|
+
* Returns a renderer for `<cit data-id="…">` elements only — the citation
|
|
6
|
+
* dropdown for a claimed id, the literal markup otherwise.
|
|
7
|
+
*
|
|
8
|
+
* Exists for markdown surfaces other than the message body (e.g. stage
|
|
9
|
+
* content): unlike `useCitationMarkdownComponents` it returns no `p`/`li`
|
|
10
|
+
* overrides, so the surface keeps its own typography, and it never resolves
|
|
11
|
+
* offset-based groups, whose offsets point into the message text. `groups`
|
|
12
|
+
* win over `fallbackGroups` on a colliding id.
|
|
13
|
+
*/
|
|
14
|
+
export declare const useCitationTagRenderer: (groups: AnnotationGroup[], callbacks: UseCitationMarkdownComponentsCallbacks, fallbackGroups?: AnnotationGroup[]) => ((dataId: string | undefined, children: ReactNode) => ReactNode);
|
|
15
|
+
//# sourceMappingURL=useCitationTagRenderer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCitationTagRenderer.d.ts","sourceRoot":"","sources":["../../../src/hooks/useCitationTagRenderer/useCitationTagRenderer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAW,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAEhD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAK/E,OAAO,KAAK,EAAE,sCAAsC,EAAE,MAAM,gEAAgE,CAAC;AAS7H;;;;;;;;;GASG;AACH,eAAO,MAAM,sBAAsB,GACjC,QAAQ,eAAe,EAAE,EACzB,WAAW,sCAAsC,EACjD,iBAAgB,eAAe,EAA0B,KACxD,CAAC,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,EAAE,QAAQ,EAAE,SAAS,KAAK,SAAS,CAsCjE,CAAC"}
|
package/index.css
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
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))}.
|
|
2
|
-
/*$vite$: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))}._trigger_119c8_7{max-width:calc(100% - .25rem)}._trigger_119c8_7>*{min-width:0;max-width:100%}td ._trigger_119c8_7,th ._trigger_119c8_7{width:100%;max-width:100%;margin-inline-start:0}td ._trigger_119c8_7>*,th ._trigger_119c8_7>*{max-width:100%}
|
|
2
|
+
/*$vite$:1*//*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */
|
|
3
|
+
@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1}}}.collapse{visibility:collapse}.visible{visibility:visible}.fixed{position:fixed}.ms-1{margin-inline-start:.25rem}.mb-1\.5{margin-bottom:.375rem}.mb-3{margin-bottom:.75rem}.line-clamp-6{-webkit-line-clamp:6;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.block{display:block}.flex{display:flex}.hidden{display:none}.inline{display:inline}.inline-flex{display:inline-flex}.table{display:table}.table-cell{display:table-cell}.table-row{display:table-row}.max-h-\[min\(20rem\,50vh\)\]{max-height:min(20rem,50vh)}.w-\[400px\]{width:400px}.w-full{width:100%}.max-w-\[240px\]{max-width:240px}.max-w-full{max-width:100%}.min-w-0{min-width:0}.shrink{flex-shrink:1}.shrink-0{flex-shrink:0}.resize{resize:both}.flex-col{flex-direction:column}.items-center{align-items:center}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-start{justify-content:flex-start}.gap-1{gap:.25rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-y-auto{overflow-y:auto}.rounded-lg{border-radius:.5rem}.rounded-none\!{border-radius:0!important}.bg-transparent\!{background-color:#0000!important}.p-0\!{padding:0!important}.p-4{padding:1rem}.ps-\[1\.5em\]{padding-inline-start:1.5em}.align-middle{vertical-align:middle}.text-pretty{text-wrap:pretty}.wrap-anywhere{overflow-wrap:anywhere}.wrap-break-word{overflow-wrap:break-word}.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-lg{--tw-shadow:1px 10px 25px 12px var(--tw-shadow-color,var(--shadow-lg,#2764d914));box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-none\!{--tw-shadow:0 0 #0000!important;box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)!important}.last\:mb-0:last-child{margin-bottom:0}.rtl\:scale-x-\[-1\]:where(:dir(rtl),[dir=rtl],[dir=rtl] *){--tw-scale-x:-1;scale:var(--tw-scale-x) var(--tw-scale-y)}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-scale-x{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-y{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-z{syntax:"*";inherits:false;initial-value:1}
|
package/index.d.ts
CHANGED
|
@@ -10,12 +10,14 @@ export { useAnnotations } from './utils/useAnnotations';
|
|
|
10
10
|
export { useCitationCard } from './utils/useCitationCard';
|
|
11
11
|
export { useCitationMarkdownComponents } from './hooks/useCitationMarkdownComponents/useCitationMarkdownComponents';
|
|
12
12
|
export type { UseCitationMarkdownComponentsCallbacks } from './hooks/useCitationMarkdownComponents/useCitationMarkdownComponents';
|
|
13
|
+
export { useCitationTagRenderer } from './hooks/useCitationTagRenderer/useCitationTagRenderer';
|
|
13
14
|
export { gatherSameSourceAnnotations, groupAnnotations, groupAnnotationsByCitId, groupAnnotationsBySource, } from './utils/group-annotations-by-source';
|
|
14
15
|
export type { AnnotationGroup } from './utils/group-annotations-by-source';
|
|
15
|
-
export { annotationHighlightId, annotationHighlightIds, annotationsToPdfHighlights, annotationToOfficeHighlightLocations, getAnnotationPdfPage, isDocxRangeSelector, isExcelRcRangeSelector, isPptxRangeSelector, resolveMessageAnnotations, } from './utils/annotation';
|
|
16
|
+
export { annotationHighlightId, annotationHighlightIds, annotationsToPdfHighlights, annotationToOfficeHighlightLocations, getAnnotationPdfPage, getCitationGroupPage, isDocxRangeSelector, isExcelRcRangeSelector, isPptxRangeSelector, resolveMessageAnnotations, } from './utils/annotation';
|
|
16
17
|
export type { DocxOfficeHighlightLocation, DocxTableRowOfficeHighlightLocation, ExcelOfficeHighlightLocation, OfficeHighlightLocation, PptxOfficeHighlightLocation, PptxTableRowOfficeHighlightLocation, } from './models/office-highlight';
|
|
17
|
-
export { injectCitationSentinels, replaceCitTagsWithSourceNames, replaceSentinelsInChildren, stripCitTagsWhileStreaming, } from './utils/citation-injection';
|
|
18
|
+
export { injectCitationSentinels, prepareCitationContent, replaceCitTagsWithSourceNames, replaceSentinelsInChildren, stripCitTagsWhileStreaming, } from './utils/citation-injection';
|
|
18
19
|
export { isReferenceOnlyAttachment, parsePdfPageReference, getReferenceAttachmentGroups, } from './utils/reference-attachment';
|
|
19
20
|
export type { PdfPageReference } from './utils/reference-attachment';
|
|
20
21
|
export { QUOTATIONS_CLASS } from './constants/public-class-names';
|
|
22
|
+
export * from './utils/useHtmlTagAnnotationGroups';
|
|
21
23
|
//# sourceMappingURL=index.d.ts.map
|
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,EAAE,MAAM,wCAAwC,CAAC;AACtE,YAAY,EACV,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,wCAAwC,CAAC;AAEhD,OAAO,EAAE,cAAc,EAAE,MAAM,4CAA4C,CAAC;AAC5E,YAAY,EACV,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,4CAA4C,CAAC;AAEpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gDAAgD,CAAC;AAClF,YAAY,EAAE,qBAAqB,EAAE,MAAM,gDAAgD,CAAC;AAG5F,OAAO,EACL,oBAAoB,EACpB,sBAAsB,GACvB,MAAM,+BAA+B,CAAC;AACvC,YAAY,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAGtE,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,6BAA6B,EAAE,MAAM,qEAAqE,CAAC;AACpH,YAAY,EAAE,sCAAsC,EAAE,MAAM,qEAAqE,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AACtE,YAAY,EACV,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,wCAAwC,CAAC;AAEhD,OAAO,EAAE,cAAc,EAAE,MAAM,4CAA4C,CAAC;AAC5E,YAAY,EACV,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,4CAA4C,CAAC;AAEpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gDAAgD,CAAC;AAClF,YAAY,EAAE,qBAAqB,EAAE,MAAM,gDAAgD,CAAC;AAG5F,OAAO,EACL,oBAAoB,EACpB,sBAAsB,GACvB,MAAM,+BAA+B,CAAC;AACvC,YAAY,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAGtE,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,6BAA6B,EAAE,MAAM,qEAAqE,CAAC;AACpH,YAAY,EAAE,sCAAsC,EAAE,MAAM,qEAAqE,CAAC;AAClI,OAAO,EAAE,sBAAsB,EAAE,MAAM,uDAAuD,CAAC;AAG/F,OAAO,EACL,2BAA2B,EAC3B,gBAAgB,EAChB,uBAAuB,EACvB,wBAAwB,GACzB,MAAM,qCAAqC,CAAC;AAC7C,YAAY,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAE3E,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,0BAA0B,EAC1B,oCAAoC,EACpC,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EACnB,sBAAsB,EACtB,mBAAmB,EACnB,yBAAyB,GAC1B,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EACV,2BAA2B,EAC3B,mCAAmC,EACnC,4BAA4B,EAC5B,uBAAuB,EACvB,2BAA2B,EAC3B,mCAAmC,GACpC,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EACL,uBAAuB,EACvB,sBAAsB,EACtB,6BAA6B,EAC7B,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;AAElE,cAAc,oCAAoC,CAAC"}
|
package/index.js
CHANGED
|
@@ -1,58 +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
|
-
import { DIAL_KIT_ICON_STROKE as s, DialItemType as c, Dropdown as l,
|
|
3
|
-
import { IconChevronLeft as
|
|
4
|
-
import { createContext as y, useCallback as b, useContext as x, useEffect as
|
|
5
|
-
import { Fragment as
|
|
2
|
+
import { DIAL_KIT_ICON_STROKE as s, DialItemType as c, Dropdown as l, DropdownOverlayRole as u, ElementSize as d, EllipsisTooltip as f, FileIcon as p, GhostIconButton as m, LinkButton as h, NeutralButton as g, PrimaryButton as _ } from "@epam/ai-dial-ui-kit";
|
|
3
|
+
import { IconChevronLeft as ee, IconChevronRight as v } from "@tabler/icons-react";
|
|
4
|
+
import { createContext as y, useCallback as b, useContext as x, useEffect as te, useId as ne, useLayoutEffect as S, useMemo as C, useRef as re, useState as w } from "react";
|
|
5
|
+
import { Fragment as T, jsx as E, jsxs as D } from "react/jsx-runtime";
|
|
6
6
|
//#region src/constants/public-class-names.ts
|
|
7
|
-
var
|
|
7
|
+
var O = {
|
|
8
8
|
citationCard: "dial-quotations-citation-card",
|
|
9
9
|
citationDropdown: "dial-quotations-citation-dropdown",
|
|
10
10
|
citationMarker: "dial-quotations-citation-marker"
|
|
11
|
-
},
|
|
11
|
+
}, ie = (t) => {
|
|
12
12
|
let n = t.body?.source?.attachment?.type;
|
|
13
13
|
return n === e.HTML || n === e.XHTML;
|
|
14
|
-
},
|
|
14
|
+
}, k = (e) => {
|
|
15
15
|
try {
|
|
16
16
|
return decodeURIComponent(e);
|
|
17
17
|
} catch {
|
|
18
18
|
return e;
|
|
19
19
|
}
|
|
20
|
-
},
|
|
20
|
+
}, A = (e) => {
|
|
21
21
|
try {
|
|
22
22
|
let t = new URL(e);
|
|
23
|
-
return t.pathname.split("/").map((e) =>
|
|
23
|
+
return t.pathname.split("/").map((e) => k(e)).filter(Boolean).at(-1) ?? t.hostname;
|
|
24
24
|
} catch {
|
|
25
|
-
return e.split("/").map((e) =>
|
|
25
|
+
return e.split("/").map((e) => k(e)).filter(Boolean).at(-1) ?? e;
|
|
26
26
|
}
|
|
27
|
-
},
|
|
28
|
-
let t = e == null ? null :
|
|
27
|
+
}, j = /\.([a-z0-9]{1,10})$/i, M = (e) => {
|
|
28
|
+
let t = e == null ? null : j.exec(e.trim());
|
|
29
29
|
return t == null ? void 0 : `.${t[1].toLowerCase()}`;
|
|
30
|
-
},
|
|
30
|
+
}, ae = (e) => {
|
|
31
31
|
let t = e.body?.source?.attachment, n = t?.url;
|
|
32
|
-
return (n == null ? void 0 :
|
|
33
|
-
},
|
|
32
|
+
return (n == null ? void 0 : M(A(n))) ?? M(t?.title);
|
|
33
|
+
}, N = (e, t) => e.body?.source?.attachment?.title ?? A(t), P = (e) => {
|
|
34
34
|
let t = e.target?.selector;
|
|
35
35
|
return t?.type === "html_tag" ? t : void 0;
|
|
36
|
-
},
|
|
36
|
+
}, oe = (e) => P(e) != null, F = (e) => {
|
|
37
37
|
let t = /* @__PURE__ */ new Map();
|
|
38
38
|
for (let n of e) {
|
|
39
|
-
if (
|
|
39
|
+
if (oe(n)) continue;
|
|
40
40
|
let e = n.body?.source?.attachment?.url;
|
|
41
41
|
if (e == null) continue;
|
|
42
42
|
let r = t.get(e);
|
|
43
43
|
r ? r.annotations.push(n) : t.set(e, {
|
|
44
44
|
groupKey: e,
|
|
45
45
|
sourceUrl: e,
|
|
46
|
-
sourceName:
|
|
46
|
+
sourceName: N(n, e),
|
|
47
47
|
annotations: [n],
|
|
48
48
|
primaryAnnotation: n
|
|
49
49
|
});
|
|
50
50
|
}
|
|
51
51
|
return Array.from(t.values());
|
|
52
|
-
},
|
|
52
|
+
}, I = (e) => {
|
|
53
53
|
let t = /* @__PURE__ */ new Map();
|
|
54
54
|
for (let n of e) {
|
|
55
|
-
let e =
|
|
55
|
+
let e = P(n)?.id;
|
|
56
56
|
if (e == null) continue;
|
|
57
57
|
let r = n.body?.source?.attachment?.url;
|
|
58
58
|
if (r == null) continue;
|
|
@@ -60,219 +60,217 @@ var A = {
|
|
|
60
60
|
i ? i.annotations.push(n) : t.set(e, {
|
|
61
61
|
groupKey: `cit:${e}`,
|
|
62
62
|
sourceUrl: r,
|
|
63
|
-
sourceName:
|
|
63
|
+
sourceName: N(n, r),
|
|
64
64
|
annotations: [n],
|
|
65
65
|
primaryAnnotation: n
|
|
66
66
|
});
|
|
67
67
|
}
|
|
68
68
|
return Array.from(t.values());
|
|
69
|
-
},
|
|
69
|
+
}, L = (e) => [...I(e), ...F(e)], se = (e, t) => {
|
|
70
70
|
let n = e.body?.source?.attachment?.url;
|
|
71
71
|
return n == null || !t.includes(e) ? [e] : t.filter((e) => e.body?.source?.attachment?.url === n);
|
|
72
|
-
},
|
|
72
|
+
}, R = {
|
|
73
73
|
card: "_card_1kph1_1",
|
|
74
74
|
quote: "_quote_1kph1_5",
|
|
75
75
|
title: "_title_1kph1_9",
|
|
76
76
|
switcher: "_switcher_1kph1_13",
|
|
77
77
|
sourceName: "_sourceName_1kph1_17"
|
|
78
|
-
},
|
|
79
|
-
let
|
|
78
|
+
}, z = ({ group: e, activeIndex: r, onIndexChange: a, onPreview: o, onOpenInBrowser: l, isDownloadEnabled: u = !0, headerIcon: g, labels: y, typography: b, colors: x }) => {
|
|
79
|
+
let C = e.annotations.length, T = e.annotations[r] ?? e.primaryAnnotation, k = C > 1, A = o == null || ie(T), j = A ? void 0 : ae(T), M = j ?? e.sourceName, N = g ?? (j == null ? void 0 : /* @__PURE__ */ E(p, {
|
|
80
80
|
type: c.File,
|
|
81
|
-
name:
|
|
82
|
-
fileExtension:
|
|
81
|
+
name: j,
|
|
82
|
+
fileExtension: j,
|
|
83
83
|
size: 16,
|
|
84
84
|
decorative: !0,
|
|
85
85
|
className: "shrink-0"
|
|
86
|
-
})),
|
|
87
|
-
"--cc-card-bg":
|
|
88
|
-
"--cc-quote-text":
|
|
89
|
-
"--cc-title-text":
|
|
90
|
-
"--cc-switcher-text":
|
|
91
|
-
"--cc-source-name-text":
|
|
92
|
-
}),
|
|
93
|
-
return
|
|
94
|
-
|
|
95
|
-
}, [r,
|
|
96
|
-
let e =
|
|
97
|
-
if (!e ||
|
|
98
|
-
let t = () =>
|
|
86
|
+
})), P = b?.sourceNameClassName ?? "dial-tiny-text", oe = b?.titleClassName ?? "dial-body-semi-text", F = b?.quoteClassName ?? "dial-small-text", I = b?.quoteStrongClassName ?? "dial-small-semi-text", L = b?.switcherClassName ?? "dial-tiny-text", se = n({
|
|
87
|
+
"--cc-card-bg": x?.cardBackground,
|
|
88
|
+
"--cc-quote-text": x?.quoteText,
|
|
89
|
+
"--cc-title-text": x?.titleText,
|
|
90
|
+
"--cc-switcher-text": x?.switcherText,
|
|
91
|
+
"--cc-source-name-text": x?.sourceNameText
|
|
92
|
+
}), z = T.body?.quote, B = ne(), V = re(null), [H, U] = w(!1), [W, G] = w(!1);
|
|
93
|
+
return te(() => {
|
|
94
|
+
U(!1);
|
|
95
|
+
}, [r, z]), S(() => {
|
|
96
|
+
let e = V.current;
|
|
97
|
+
if (!e || H) return;
|
|
98
|
+
let t = () => G(e.scrollHeight > e.clientHeight + 1);
|
|
99
99
|
t();
|
|
100
100
|
let n = new ResizeObserver(t);
|
|
101
101
|
return n.observe(e), () => n.disconnect();
|
|
102
|
-
}, [
|
|
102
|
+
}, [z, H]), /* @__PURE__ */ D("div", {
|
|
103
103
|
role: "dialog",
|
|
104
104
|
"aria-modal": "true",
|
|
105
|
-
"aria-label":
|
|
106
|
-
style:
|
|
107
|
-
className: i("flex w-[400px] max-w-full flex-col gap-3 rounded-lg p-4 shadow-lg",
|
|
105
|
+
"aria-label": y.ariaLabel,
|
|
106
|
+
style: se,
|
|
107
|
+
className: i("flex w-[400px] max-w-full flex-col gap-3 rounded-lg p-4 shadow-lg", R.card, O.citationCard),
|
|
108
108
|
children: [
|
|
109
|
-
/* @__PURE__ */
|
|
109
|
+
/* @__PURE__ */ D("div", {
|
|
110
110
|
className: "flex items-center justify-between gap-2",
|
|
111
|
-
children: [/* @__PURE__ */
|
|
111
|
+
children: [/* @__PURE__ */ D("div", {
|
|
112
112
|
className: "flex min-w-0 items-center gap-1",
|
|
113
|
-
children: [
|
|
114
|
-
text:
|
|
115
|
-
className: i(
|
|
113
|
+
children: [N, /* @__PURE__ */ E(f, {
|
|
114
|
+
text: M,
|
|
115
|
+
className: i(P, "min-w-0", R.sourceName)
|
|
116
116
|
})]
|
|
117
|
-
}),
|
|
117
|
+
}), k && /* @__PURE__ */ D("div", {
|
|
118
118
|
className: "flex shrink-0 items-center gap-1",
|
|
119
119
|
children: [
|
|
120
|
-
/* @__PURE__ */
|
|
121
|
-
icon: /* @__PURE__ */
|
|
120
|
+
/* @__PURE__ */ E(m, {
|
|
121
|
+
icon: /* @__PURE__ */ E(ee, {
|
|
122
122
|
size: 14,
|
|
123
123
|
className: "rtl:scale-x-[-1]",
|
|
124
124
|
stroke: s
|
|
125
125
|
}),
|
|
126
|
-
size:
|
|
127
|
-
"aria-label":
|
|
128
|
-
onClick: () => a((r - 1 +
|
|
126
|
+
size: d.Small,
|
|
127
|
+
"aria-label": y.previousCitation,
|
|
128
|
+
onClick: () => a((r - 1 + C) % C)
|
|
129
129
|
}),
|
|
130
|
-
/* @__PURE__ */
|
|
131
|
-
className: i(
|
|
132
|
-
children:
|
|
130
|
+
/* @__PURE__ */ E("span", {
|
|
131
|
+
className: i(L, R.switcher),
|
|
132
|
+
children: y.formatSwitcherText(r + 1, C)
|
|
133
133
|
}),
|
|
134
|
-
/* @__PURE__ */
|
|
135
|
-
icon: /* @__PURE__ */
|
|
134
|
+
/* @__PURE__ */ E(m, {
|
|
135
|
+
icon: /* @__PURE__ */ E(v, {
|
|
136
136
|
size: 14,
|
|
137
137
|
className: "rtl:scale-x-[-1]",
|
|
138
138
|
stroke: s
|
|
139
139
|
}),
|
|
140
|
-
size:
|
|
141
|
-
"aria-label":
|
|
142
|
-
onClick: () => a((r + 1) %
|
|
140
|
+
size: d.Small,
|
|
141
|
+
"aria-label": y.nextCitation,
|
|
142
|
+
onClick: () => a((r + 1) % C)
|
|
143
143
|
})
|
|
144
144
|
]
|
|
145
145
|
})]
|
|
146
146
|
}),
|
|
147
|
-
(
|
|
147
|
+
(T.body?.title || T.body?.quote || k) && /* @__PURE__ */ D("div", {
|
|
148
148
|
className: "flex flex-col gap-3",
|
|
149
|
-
children: [
|
|
150
|
-
className: i(
|
|
151
|
-
children:
|
|
152
|
-
}), (
|
|
149
|
+
children: [T.body?.title && /* @__PURE__ */ E("p", {
|
|
150
|
+
className: i(oe, R.title, "wrap-break-word"),
|
|
151
|
+
children: T.body.title
|
|
152
|
+
}), (z || k) && /* @__PURE__ */ D("div", {
|
|
153
153
|
className: "flex flex-col items-start gap-1",
|
|
154
|
-
children: [/* @__PURE__ */
|
|
155
|
-
ref:
|
|
156
|
-
id:
|
|
157
|
-
tabIndex:
|
|
158
|
-
className: i(
|
|
159
|
-
children:
|
|
160
|
-
content:
|
|
154
|
+
children: [/* @__PURE__ */ E("div", {
|
|
155
|
+
ref: V,
|
|
156
|
+
id: B,
|
|
157
|
+
tabIndex: H ? 0 : void 0,
|
|
158
|
+
className: i(F, R.quote, "w-full wrap-break-word", H ? "max-h-[min(20rem,50vh)] overflow-y-auto" : "line-clamp-6"),
|
|
159
|
+
children: z && /* @__PURE__ */ E(t, {
|
|
160
|
+
content: z,
|
|
161
161
|
classNames: {
|
|
162
|
-
p: i(
|
|
163
|
-
ul: i(
|
|
164
|
-
ol:
|
|
165
|
-
strong:
|
|
162
|
+
p: i(F, R.quote),
|
|
163
|
+
ul: i(F, "ps-[1.5em]"),
|
|
164
|
+
ol: F,
|
|
165
|
+
strong: I
|
|
166
166
|
},
|
|
167
|
-
codeBlockCopyLabel:
|
|
168
|
-
codeBlockCopiedLabel:
|
|
169
|
-
codeBlockDownloadLabel:
|
|
170
|
-
tableScrollRegionAriaLabel:
|
|
171
|
-
mathScrollRegionAriaLabel:
|
|
167
|
+
codeBlockCopyLabel: y.codeBlockCopyLabel,
|
|
168
|
+
codeBlockCopiedLabel: y.codeBlockCopiedLabel,
|
|
169
|
+
codeBlockDownloadLabel: y.codeBlockDownloadLabel,
|
|
170
|
+
tableScrollRegionAriaLabel: y.tableScrollRegionAriaLabel,
|
|
171
|
+
mathScrollRegionAriaLabel: y.mathScrollRegionAriaLabel
|
|
172
172
|
})
|
|
173
|
-
}),
|
|
174
|
-
label:
|
|
175
|
-
size:
|
|
176
|
-
"aria-expanded":
|
|
177
|
-
"aria-controls":
|
|
178
|
-
onClick: () =>
|
|
173
|
+
}), W && /* @__PURE__ */ E(h, {
|
|
174
|
+
label: H ? y.showLess : y.showMore,
|
|
175
|
+
size: d.Small,
|
|
176
|
+
"aria-expanded": H,
|
|
177
|
+
"aria-controls": B,
|
|
178
|
+
onClick: () => U((e) => !e)
|
|
179
179
|
})]
|
|
180
180
|
})]
|
|
181
181
|
}),
|
|
182
|
-
/* @__PURE__ */
|
|
182
|
+
/* @__PURE__ */ D("div", {
|
|
183
183
|
className: "flex justify-start gap-2",
|
|
184
|
-
children: [o && /* @__PURE__ */
|
|
185
|
-
label:
|
|
186
|
-
size:
|
|
187
|
-
onClick: () => o(
|
|
188
|
-
}), (
|
|
189
|
-
label:
|
|
190
|
-
size:
|
|
191
|
-
onClick: () => l(
|
|
184
|
+
children: [o && /* @__PURE__ */ E(_, {
|
|
185
|
+
label: y.preview,
|
|
186
|
+
size: d.Small,
|
|
187
|
+
onClick: () => o(T)
|
|
188
|
+
}), (A || u) && /* @__PURE__ */ E(_, {
|
|
189
|
+
label: A ? y.openInBrowser : y.download,
|
|
190
|
+
size: d.Small,
|
|
191
|
+
onClick: () => l(T)
|
|
192
192
|
})]
|
|
193
193
|
})
|
|
194
194
|
]
|
|
195
195
|
});
|
|
196
|
-
},
|
|
197
|
-
size:
|
|
198
|
-
className: i("max-w-[240px]",
|
|
196
|
+
}, B = ({ annotationCount: e, onOpen: t, icon: n, labels: r, labelClassName: a = "dial-caption-text", ...o }) => /* @__PURE__ */ E(g, {
|
|
197
|
+
size: d.Small,
|
|
198
|
+
className: i("max-w-[240px]", O.citationMarker),
|
|
199
199
|
textClassName: "min-w-0 truncate",
|
|
200
200
|
iconBefore: n,
|
|
201
|
-
label: /* @__PURE__ */
|
|
201
|
+
label: /* @__PURE__ */ E("span", {
|
|
202
202
|
className: a,
|
|
203
203
|
children: e > 1 ? r.labelWithOverflow : r.label
|
|
204
204
|
}),
|
|
205
205
|
"aria-label": r.ariaLabel,
|
|
206
|
+
...o,
|
|
206
207
|
onClick: t
|
|
207
|
-
}),
|
|
208
|
-
let e = x(
|
|
208
|
+
}), V = y(null), H = V.Provider, U = () => {
|
|
209
|
+
let e = x(V);
|
|
209
210
|
if (e == null) throw Error("useCitationCardContext must be used within a CitationCardProvider");
|
|
210
211
|
return e;
|
|
211
|
-
},
|
|
212
|
-
let
|
|
213
|
-
e ||
|
|
214
|
-
}, [
|
|
215
|
-
t(e),
|
|
212
|
+
}, W = { trigger: "_trigger_119c8_7" }, G = ({ group: e, onPreview: t, isPreviewable: n, onOpenInBrowser: r, isDownloadEnabled: a = !0, isPreviewOpen: o = !1, previewFilesOnMarkerClick: s = !1, icon: c, headerIcon: d, cardLabels: f, markerLabels: p, cardTypography: m, markerLabelClassName: h }) => {
|
|
213
|
+
let g = U(), _ = ne(), ee = g.isOpen(_), v = g.getActiveIndex(e.groupKey), y = e.annotations[v] ?? e.primaryAnnotation, x = n?.(y) ?? !0, te = b((e) => {
|
|
214
|
+
e || g.closePopup(_);
|
|
215
|
+
}, [g, _]), S = C(() => t && x ? (e) => {
|
|
216
|
+
t(e), g.closePopup(_);
|
|
216
217
|
} : void 0, [
|
|
217
218
|
t,
|
|
218
219
|
x,
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
]),
|
|
222
|
-
let t = e.annotations.length === 1 && !
|
|
223
|
-
|
|
224
|
-
C(y);
|
|
225
|
-
return;
|
|
226
|
-
}
|
|
227
|
-
h.openPopup(g);
|
|
220
|
+
g,
|
|
221
|
+
_
|
|
222
|
+
]), re = b(() => {
|
|
223
|
+
let t = e.annotations.length === 1, n = t && !ie(y);
|
|
224
|
+
(o && t || s && n) && S ? S(y) : g.openPopup(_);
|
|
228
225
|
}, [
|
|
229
226
|
o,
|
|
230
227
|
s,
|
|
231
228
|
e.annotations.length,
|
|
232
|
-
|
|
229
|
+
S,
|
|
233
230
|
y,
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
]),
|
|
231
|
+
g,
|
|
232
|
+
_
|
|
233
|
+
]), w = b(() => /* @__PURE__ */ E(z, {
|
|
237
234
|
group: e,
|
|
238
235
|
activeIndex: v,
|
|
239
|
-
onIndexChange: (t) =>
|
|
240
|
-
onPreview:
|
|
236
|
+
onIndexChange: (t) => g.setActiveIndex(e.groupKey, t),
|
|
237
|
+
onPreview: S,
|
|
241
238
|
onOpenInBrowser: r,
|
|
242
239
|
isDownloadEnabled: a,
|
|
243
|
-
headerIcon:
|
|
244
|
-
labels:
|
|
245
|
-
typography:
|
|
240
|
+
headerIcon: d,
|
|
241
|
+
labels: f,
|
|
242
|
+
typography: m
|
|
246
243
|
}), [
|
|
247
244
|
e,
|
|
248
245
|
v,
|
|
249
|
-
|
|
250
|
-
|
|
246
|
+
g,
|
|
247
|
+
S,
|
|
251
248
|
r,
|
|
252
249
|
a,
|
|
253
|
-
u,
|
|
254
250
|
d,
|
|
255
|
-
|
|
251
|
+
f,
|
|
252
|
+
m
|
|
256
253
|
]);
|
|
257
|
-
return /* @__PURE__ */
|
|
258
|
-
open:
|
|
259
|
-
onOpenChange:
|
|
254
|
+
return /* @__PURE__ */ E(l, {
|
|
255
|
+
open: ee,
|
|
256
|
+
onOpenChange: te,
|
|
260
257
|
trigger: [],
|
|
258
|
+
overlayRole: u.None,
|
|
261
259
|
placement: "bottom-end",
|
|
262
260
|
matchReferenceWidth: !1,
|
|
263
|
-
className: i("ms-1 inline-flex align-middle",
|
|
264
|
-
listClassName: i("
|
|
265
|
-
renderOverlay:
|
|
266
|
-
children: /* @__PURE__ */
|
|
261
|
+
className: i("ms-1 inline-flex align-middle", W.trigger),
|
|
262
|
+
listClassName: i("p-0! bg-transparent! shadow-none! rounded-none!", O.citationDropdown),
|
|
263
|
+
renderOverlay: w,
|
|
264
|
+
children: /* @__PURE__ */ E(B, {
|
|
267
265
|
sourceName: e.sourceName,
|
|
268
266
|
annotationCount: e.annotations.length,
|
|
269
|
-
onOpen:
|
|
267
|
+
onOpen: re,
|
|
270
268
|
icon: c,
|
|
271
|
-
labels:
|
|
272
|
-
labelClassName:
|
|
269
|
+
labels: p,
|
|
270
|
+
labelClassName: h
|
|
273
271
|
})
|
|
274
272
|
});
|
|
275
|
-
},
|
|
273
|
+
}, ce = (e) => {
|
|
276
274
|
let t = e.trim();
|
|
277
275
|
if (!t.startsWith("|") || !t.endsWith("|") || /[\r\n]/.test(t)) return;
|
|
278
276
|
let n = [], r = "";
|
|
@@ -281,11 +279,11 @@ var A = {
|
|
|
281
279
|
i === "\\" && a != null && /[!-/:-@[-`{-~]/.test(a) ? (r += a, e += 1) : i === "|" ? (n.push(r.trim()), r = "") : r += i;
|
|
282
280
|
}
|
|
283
281
|
if (!(r !== "" || n.length < 2 || n.every((e) => e === "" || /^:?-{3,}:?$/.test(e)))) return n;
|
|
284
|
-
},
|
|
282
|
+
}, le = (e) => {
|
|
285
283
|
if (e.type !== "docx_text_anchor" && e.type !== "pptx_text_anchor") return;
|
|
286
284
|
let { text: t, occurrence: n, slide: r } = e;
|
|
287
285
|
if (typeof t != "string" || typeof n != "number" || !Number.isSafeInteger(n) || n < 1) return;
|
|
288
|
-
let i =
|
|
286
|
+
let i = ce(t);
|
|
289
287
|
if (i != null) {
|
|
290
288
|
if (e.type === "docx_text_anchor") return {
|
|
291
289
|
type: "docx_text_anchor",
|
|
@@ -299,13 +297,32 @@ var A = {
|
|
|
299
297
|
slide: r
|
|
300
298
|
};
|
|
301
299
|
}
|
|
302
|
-
},
|
|
300
|
+
}, K = (e) => e.url == null && e.reference_url != null, ue = /^(.*\.pdf)(?:#page=(\d+))?$/i, q = (e) => {
|
|
301
|
+
let t = ue.exec(e);
|
|
302
|
+
return t ? {
|
|
303
|
+
baseUrl: t[1],
|
|
304
|
+
page: t[2] == null ? null : Number(t[2])
|
|
305
|
+
} : null;
|
|
306
|
+
}, de = (t) => F((t ?? []).filter(K).map((t) => {
|
|
307
|
+
let n = t.reference_url, r = q(n) != null;
|
|
308
|
+
return { body: {
|
|
309
|
+
quote: t.data,
|
|
310
|
+
source: {
|
|
311
|
+
type: "attachment",
|
|
312
|
+
attachment: {
|
|
313
|
+
type: r ? e.PDF : t.reference_type ?? t.type ?? "",
|
|
314
|
+
url: n,
|
|
315
|
+
title: t.title
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
} };
|
|
319
|
+
})), fe = {
|
|
303
320
|
backgroundColor: "transparent",
|
|
304
321
|
borderColor: "var(--stroke-accent, #1D4ED8)",
|
|
305
322
|
borderWidth: "2px",
|
|
306
323
|
opacity: .5,
|
|
307
324
|
hoverOpacity: .5
|
|
308
|
-
},
|
|
325
|
+
}, pe = (e) => {
|
|
309
326
|
if (typeof e != "object" || !e) return;
|
|
310
327
|
let t = e, { lt: n, wh: r } = t;
|
|
311
328
|
if (Array.isArray(n) && Array.isArray(r) && n.length >= 2 && r.length >= 2) {
|
|
@@ -324,7 +341,7 @@ var A = {
|
|
|
324
341
|
x2: i + o,
|
|
325
342
|
y2: a + s
|
|
326
343
|
};
|
|
327
|
-
},
|
|
344
|
+
}, J = (e) => {
|
|
328
345
|
if (!r(e)) return;
|
|
329
346
|
let t = e, n;
|
|
330
347
|
if (t.type === "pdf_bbox") {
|
|
@@ -335,7 +352,7 @@ var A = {
|
|
|
335
352
|
x2: i,
|
|
336
353
|
y2: a
|
|
337
354
|
});
|
|
338
|
-
} else t.type === "pdf_region" && (n =
|
|
355
|
+
} else t.type === "pdf_region" && (n = pe(t.bbox));
|
|
339
356
|
if (n == null) return;
|
|
340
357
|
let i = t.page;
|
|
341
358
|
if (!(typeof i != "number" || !Number.isInteger(i) || i < 1) && [
|
|
@@ -350,45 +367,45 @@ var A = {
|
|
|
350
367
|
x2: n.x2,
|
|
351
368
|
y2: n.y2
|
|
352
369
|
};
|
|
353
|
-
},
|
|
370
|
+
}, me = (e) => {
|
|
354
371
|
if (!r(e)) return;
|
|
355
372
|
let t = e;
|
|
356
373
|
if (t.type !== "pdf_bbox" && t.type !== "pdf_region") return;
|
|
357
374
|
let n = t.page;
|
|
358
375
|
return typeof n == "number" && Number.isInteger(n) && n >= 1 ? n : void 0;
|
|
359
|
-
},
|
|
376
|
+
}, Y = (e) => typeof e != "object" || !e ? String(e) : Array.isArray(e) ? `[${e.map(Y).join(",")}]` : `{${Object.entries(e).filter(([, e]) => e !== void 0).sort(([e], [t]) => e < t ? -1 : +(e > t)).map(([e, t]) => `${e}=${Y(t)}`).join(",")}}`, he = (e) => {
|
|
360
377
|
let t = 5381;
|
|
361
378
|
for (let n = 0; n < e.length; n += 1) t = t * 33 + e.charCodeAt(n) | 0;
|
|
362
379
|
return (t >>> 0).toString(36);
|
|
363
|
-
},
|
|
380
|
+
}, ge = (e) => {
|
|
364
381
|
let t = e.body?.selector;
|
|
365
382
|
if (t == null) return;
|
|
366
383
|
let n = (Array.isArray(t) ? t : [t]).flatMap((e) => {
|
|
367
|
-
let t =
|
|
384
|
+
let t = J(e);
|
|
368
385
|
return t == null ? [] : [t];
|
|
369
|
-
}), r =
|
|
370
|
-
if (
|
|
371
|
-
},
|
|
372
|
-
let t = e.target?.selector, n = t?.type === "html_tag" ? t.id : void 0, r = typeof n == "string" ? n : void 0, i =
|
|
373
|
-
if (
|
|
374
|
-
},
|
|
375
|
-
let t =
|
|
386
|
+
}), r = Me(e);
|
|
387
|
+
if (n.length !== 0 || r.length !== 0) return Y([n, r]);
|
|
388
|
+
}, _e = (e) => {
|
|
389
|
+
let t = e.target?.selector, n = t?.type === "html_tag" ? t.id : void 0, r = typeof n == "string" ? n : void 0, i = ge(e);
|
|
390
|
+
if (r != null || i != null) return he(`${r ?? ""}|${i ?? ""}`);
|
|
391
|
+
}, ve = (e) => {
|
|
392
|
+
let t = be(e);
|
|
376
393
|
return e.flatMap((e, n) => {
|
|
377
394
|
let i = e.body?.selector;
|
|
378
395
|
if (i == null) return [];
|
|
379
396
|
let a = (Array.isArray(i) ? i : [i]).flatMap((e) => {
|
|
380
397
|
if (!r(e)) return [];
|
|
381
|
-
let t =
|
|
398
|
+
let t = J(e);
|
|
382
399
|
return t == null ? [] : [t];
|
|
383
400
|
});
|
|
384
401
|
return a.length === 0 ? [] : [{
|
|
385
402
|
id: t[n],
|
|
386
403
|
bboxes: a,
|
|
387
|
-
style:
|
|
404
|
+
style: fe
|
|
388
405
|
}];
|
|
389
406
|
});
|
|
390
|
-
},
|
|
391
|
-
let t = e.map((e, t) =>
|
|
407
|
+
}, ye = (e, t) => e.index == null ? _e(e) ?? String(t) : String(e.index), be = (e) => {
|
|
408
|
+
let t = e.map((e, t) => ye(e, t)), n = new Set(t), r = /* @__PURE__ */ new Set();
|
|
392
409
|
return t.map((e) => {
|
|
393
410
|
if (!r.has(e)) return r.add(e), e;
|
|
394
411
|
let t = 1;
|
|
@@ -396,39 +413,41 @@ var A = {
|
|
|
396
413
|
let i = `${e}-${t}`;
|
|
397
414
|
return n.add(i), r.add(i), i;
|
|
398
415
|
});
|
|
399
|
-
},
|
|
416
|
+
}, xe = (e) => {
|
|
400
417
|
let t = e.body?.selector;
|
|
401
418
|
if (t == null) return;
|
|
402
419
|
let n = Array.isArray(t) ? t : [t];
|
|
403
420
|
for (let e of n) {
|
|
404
421
|
if (!r(e)) continue;
|
|
405
|
-
let t =
|
|
422
|
+
let t = J(e);
|
|
406
423
|
if (t != null) return t.page;
|
|
407
424
|
}
|
|
408
425
|
for (let e of n) {
|
|
409
|
-
let t =
|
|
426
|
+
let t = me(e);
|
|
410
427
|
if (t != null) return t;
|
|
411
428
|
}
|
|
412
|
-
},
|
|
429
|
+
}, Se = /(?:^|[^\p{L}\p{N}])(?:pages?|pg|pp|p)\s*[.:]?\s*\d+(?![\p{L}\p{N}])|#page=\d/iu, Ce = (e) => {
|
|
430
|
+
if (!Se.test(e.sourceName)) return xe(e.primaryAnnotation) ?? q(e.sourceUrl)?.page ?? void 0;
|
|
431
|
+
}, we = (e) => {
|
|
413
432
|
let t = e.custom_content?.annotations;
|
|
414
433
|
if (t?.length) return t.filter((e) => e != null && e.body?.source?.attachment?.url != null).map(a);
|
|
415
434
|
let n = e.custom_fields;
|
|
416
435
|
if (typeof n != "object" || !n) return [];
|
|
417
436
|
let r = n.annotations;
|
|
418
437
|
return !Array.isArray(r) || r.length === 0 ? [] : o(r, e.custom_content?.attachments ?? []).map(a);
|
|
419
|
-
},
|
|
438
|
+
}, Te = (e) => {
|
|
420
439
|
if (e.type !== "docx_text_range") return !1;
|
|
421
440
|
let t = e;
|
|
422
441
|
return typeof t.story == "string" && Array.isArray(t.path) && t.path.every((e) => typeof e == "number") && typeof t.start == "number" && typeof t.end == "number" && typeof t.text == "string";
|
|
423
|
-
},
|
|
442
|
+
}, Ee = (e) => {
|
|
424
443
|
if (e.type !== "pptx_text_range") return !1;
|
|
425
444
|
let t = e;
|
|
426
445
|
return typeof t.slide == "number" && typeof t.shape_id == "string" && typeof t.start == "number" && typeof t.end == "number" && typeof t.text == "string";
|
|
427
|
-
},
|
|
446
|
+
}, De = (e) => typeof e == "object" && !!e && typeof e.row == "number" && typeof e.col == "number", Oe = (e) => {
|
|
428
447
|
if (e.type !== "excel_rc_range") return !1;
|
|
429
448
|
let t = e;
|
|
430
|
-
return typeof t.sheet == "string" &&
|
|
431
|
-
},
|
|
449
|
+
return typeof t.sheet == "string" && De(t.start) && (t.end === void 0 || t.end === null || De(t.end));
|
|
450
|
+
}, ke = (e) => {
|
|
432
451
|
let { story: t, path: n, start: r, end: i, text: a } = e;
|
|
433
452
|
if (!(!n.every((e) => Number.isInteger(e)) || !Number.isInteger(r) || !Number.isInteger(i) || r < 0 || i < r)) return {
|
|
434
453
|
type: "docx_text_range",
|
|
@@ -438,7 +457,7 @@ var A = {
|
|
|
438
457
|
endExclusive: i,
|
|
439
458
|
text: a
|
|
440
459
|
};
|
|
441
|
-
},
|
|
460
|
+
}, Ae = (e) => {
|
|
442
461
|
let { slide: t, shape_id: n, start: r, end: i, text: a } = e;
|
|
443
462
|
if (!(!Number.isInteger(t) || t < 1 || !Number.isInteger(r) || !Number.isInteger(i) || r < 0 || i < r)) return {
|
|
444
463
|
type: "pptx_text_range",
|
|
@@ -448,7 +467,7 @@ var A = {
|
|
|
448
467
|
endExclusive: i,
|
|
449
468
|
text: a
|
|
450
469
|
};
|
|
451
|
-
},
|
|
470
|
+
}, je = (e) => {
|
|
452
471
|
let { sheet: t, start: n, end: r } = e;
|
|
453
472
|
if (!(t.length === 0 || !Number.isInteger(n.row) || !Number.isInteger(n.col) || n.row < 1 || n.col < 1)) {
|
|
454
473
|
if (r == null) return {
|
|
@@ -463,30 +482,30 @@ var A = {
|
|
|
463
482
|
end: r
|
|
464
483
|
};
|
|
465
484
|
}
|
|
466
|
-
},
|
|
485
|
+
}, Me = (e) => {
|
|
467
486
|
let t = e.body?.selector;
|
|
468
487
|
return t == null ? [] : (Array.isArray(t) ? t : [t]).flatMap((e) => {
|
|
469
488
|
if (!r(e)) return [];
|
|
470
|
-
if (
|
|
471
|
-
let t =
|
|
489
|
+
if (Te(e)) {
|
|
490
|
+
let t = ke(e);
|
|
472
491
|
return t ? [t] : [];
|
|
473
492
|
}
|
|
474
|
-
if (
|
|
475
|
-
let t =
|
|
493
|
+
if (Ee(e)) {
|
|
494
|
+
let t = Ae(e);
|
|
476
495
|
return t ? [t] : [];
|
|
477
496
|
}
|
|
478
|
-
if (
|
|
479
|
-
let t =
|
|
497
|
+
if (Oe(e)) {
|
|
498
|
+
let t = je(e);
|
|
480
499
|
return t ? [t] : [];
|
|
481
500
|
}
|
|
482
|
-
let t =
|
|
501
|
+
let t = le(e);
|
|
483
502
|
return t ? [t] : [];
|
|
484
503
|
});
|
|
485
|
-
},
|
|
504
|
+
}, Ne = (e, t) => C(() => t ? [] : we(e), [t, e]), Pe = {
|
|
486
505
|
openOwnerKey: null,
|
|
487
506
|
activeIndexByGroup: {}
|
|
488
|
-
},
|
|
489
|
-
let [e, t] =
|
|
507
|
+
}, Fe = () => {
|
|
508
|
+
let [e, t] = w(Pe), n = b((e) => {
|
|
490
509
|
t((t) => ({
|
|
491
510
|
...t,
|
|
492
511
|
openOwnerKey: e
|
|
@@ -505,7 +524,7 @@ var A = {
|
|
|
505
524
|
}
|
|
506
525
|
}));
|
|
507
526
|
}, []);
|
|
508
|
-
return
|
|
527
|
+
return C(() => ({
|
|
509
528
|
openPopup: n,
|
|
510
529
|
closePopup: r,
|
|
511
530
|
setActiveIndex: i,
|
|
@@ -517,7 +536,7 @@ var A = {
|
|
|
517
536
|
i,
|
|
518
537
|
e
|
|
519
538
|
]);
|
|
520
|
-
},
|
|
539
|
+
}, Ie = /⟦C(\d+)⟧/g, Le = (e, t) => {
|
|
521
540
|
let n = t.map((e, t) => ({
|
|
522
541
|
g: e,
|
|
523
542
|
idx: t
|
|
@@ -530,26 +549,26 @@ var A = {
|
|
|
530
549
|
}).sort((e, t) => t.pos - e.pos), r = e;
|
|
531
550
|
for (let { idx: e, pos: t } of n) r = `${r.slice(0, t)}⟦C${e}⟧${r.slice(t)}`;
|
|
532
551
|
return r;
|
|
533
|
-
},
|
|
552
|
+
}, Re = /<cit\s+data-id=(?:"[^"]+"|'[^']+')\s*>\s*<\/cit>/g, ze = /^<cit\s+data-id=(?:"[^"]+"|'[^']+')\s*>\s*<\/cit>$/, Be = /<cit\s+data-id=(?:"[^"]+"|'[^']+')\s*>\s*<\/cit>|<\/?cit\b[^>]*>|<\/?cit\b[^>]*$/gi, Ve = (e) => e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"), X = (e) => e.replace(Be, (e) => ze.test(e) ? e : Ve(e)), Z = (e) => X(e).replace(Re, ""), He = (e, t) => e.includes("<cit") ? t ? Z(e) : X(e) : e, Ue = (e) => {
|
|
534
553
|
let t = e.primaryAnnotation.target?.selector;
|
|
535
554
|
return t?.type === "html_tag" ? t.id : void 0;
|
|
536
|
-
},
|
|
555
|
+
}, Q = (e, t = []) => {
|
|
537
556
|
let n = /* @__PURE__ */ new Map();
|
|
538
557
|
for (let r of [...t, ...e]) {
|
|
539
|
-
let e =
|
|
558
|
+
let e = Ue(r);
|
|
540
559
|
e != null && n.set(e, r);
|
|
541
560
|
}
|
|
542
561
|
return n;
|
|
543
|
-
},
|
|
562
|
+
}, We = /<cit\s+data-id=(?:"([^"]+)"|'([^']+)')\s*>\s*<\/cit>/g, Ge = (e) => e.replace(/[\\`*_[\]<>|]/g, "\\$&"), Ke = (e, t, n = [], r = (e) => e.sourceName) => {
|
|
544
563
|
if (!e.includes("<cit")) return e;
|
|
545
|
-
let
|
|
546
|
-
return
|
|
547
|
-
let
|
|
548
|
-
return
|
|
564
|
+
let i = Q(t, n);
|
|
565
|
+
return i.size === 0 ? e : e.replace(We, (e, t, n) => {
|
|
566
|
+
let a = i.get(t ?? n ?? "");
|
|
567
|
+
return a ? Ge(r(a)) : e;
|
|
549
568
|
});
|
|
550
569
|
}, $ = (e, t) => {
|
|
551
570
|
if (typeof e == "string") {
|
|
552
|
-
let n = e.split(
|
|
571
|
+
let n = e.split(Ie);
|
|
553
572
|
if (n.length === 1) return e;
|
|
554
573
|
let r = [];
|
|
555
574
|
return n.forEach((e, n) => {
|
|
@@ -560,47 +579,55 @@ var A = {
|
|
|
560
579
|
let n = $(e, t);
|
|
561
580
|
return Array.isArray(n) ? n : [n];
|
|
562
581
|
}) : e;
|
|
563
|
-
},
|
|
582
|
+
}, qe = (e, t) => /* @__PURE__ */ D(T, { children: [
|
|
564
583
|
e == null ? "<cit>" : `<cit data-id="${e}">`,
|
|
565
584
|
t,
|
|
566
585
|
"</cit>"
|
|
567
|
-
] }),
|
|
568
|
-
let {
|
|
586
|
+
] }), Je = ({ onPreview: e, isPreviewable: t, onOpenInBrowser: n, isDownloadEnabled: r = !0, isPreviewOpen: i = !1, previewFilesOnMarkerClick: a = !1, buildLabels: o }) => (s) => {
|
|
587
|
+
let { cardLabels: c, markerLabels: l } = o(s);
|
|
588
|
+
return /* @__PURE__ */ E(G, {
|
|
589
|
+
group: s,
|
|
590
|
+
onPreview: (t) => e(t, s),
|
|
591
|
+
isPreviewable: t,
|
|
592
|
+
onOpenInBrowser: n,
|
|
593
|
+
isDownloadEnabled: r,
|
|
594
|
+
isPreviewOpen: i,
|
|
595
|
+
previewFilesOnMarkerClick: a,
|
|
596
|
+
cardLabels: c,
|
|
597
|
+
markerLabels: l
|
|
598
|
+
}, `citation-${s.groupKey}`);
|
|
599
|
+
}, Ye = {}, Xe = [], Ze = (e, t, n, r = !1, a = !1, o = Xe) => {
|
|
600
|
+
let { onPreview: s, isPreviewable: c, onOpenInBrowser: l, isDownloadEnabled: u = !0, isPreviewOpen: d = !1, previewFilesOnMarkerClick: f = !1, paragraphClassName: p = "dial-body-paragraph-text", compactParagraphClassName: m = "dial-small-paragraph-text", buildLabels: h } = n, g = C(() => r ? Z(e) : X(t.length > 0 ? Le(e, t) : e), [
|
|
569
601
|
e,
|
|
570
602
|
t,
|
|
571
603
|
r
|
|
572
|
-
]),
|
|
604
|
+
]), _ = g.includes("<cit");
|
|
573
605
|
return {
|
|
574
|
-
processedContent:
|
|
575
|
-
markdownComponents:
|
|
576
|
-
let e =
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
previewFilesOnMarkerClick: f,
|
|
586
|
-
cardLabels: t,
|
|
587
|
-
markerLabels: n
|
|
588
|
-
}, `citation-${e.groupKey}`);
|
|
589
|
-
}, r = (e) => {
|
|
606
|
+
processedContent: g,
|
|
607
|
+
markdownComponents: C(() => {
|
|
608
|
+
let e = Q(t, o), n = Je({
|
|
609
|
+
onPreview: s,
|
|
610
|
+
isPreviewable: c,
|
|
611
|
+
onOpenInBrowser: l,
|
|
612
|
+
isDownloadEnabled: u,
|
|
613
|
+
isPreviewOpen: d,
|
|
614
|
+
previewFilesOnMarkerClick: f,
|
|
615
|
+
buildLabels: h
|
|
616
|
+
}), r = (e) => {
|
|
590
617
|
let r = t[e];
|
|
591
618
|
return r ? n(r) : null;
|
|
592
|
-
},
|
|
619
|
+
}, g = { cit: (t) => {
|
|
593
620
|
let r = t["data-id"] == null ? void 0 : e.get(t["data-id"]);
|
|
594
|
-
return r ? n(r) :
|
|
621
|
+
return r ? n(r) : qe(t["data-id"], t.children);
|
|
595
622
|
} };
|
|
596
|
-
return t.length === 0 && o.length === 0 ?
|
|
597
|
-
...
|
|
598
|
-
p: ({ children: e, ...t }) => /* @__PURE__ */
|
|
623
|
+
return t.length === 0 && o.length === 0 ? _ ? g : Ye : {
|
|
624
|
+
...g,
|
|
625
|
+
p: ({ children: e, ...t }) => /* @__PURE__ */ E("p", {
|
|
599
626
|
...t,
|
|
600
|
-
className: i(a ?
|
|
627
|
+
className: i(a ? m : p, "mb-3 text-pretty wrap-anywhere last:mb-0"),
|
|
601
628
|
children: $(e, r)
|
|
602
629
|
}),
|
|
603
|
-
li: ({ children: e, ...t }) => /* @__PURE__ */
|
|
630
|
+
li: ({ children: e, ...t }) => /* @__PURE__ */ E("li", {
|
|
604
631
|
...t,
|
|
605
632
|
className: "mb-1.5 last:mb-0",
|
|
606
633
|
children: $(e, r)
|
|
@@ -615,30 +642,48 @@ var A = {
|
|
|
615
642
|
u,
|
|
616
643
|
d,
|
|
617
644
|
f,
|
|
645
|
+
h,
|
|
618
646
|
p,
|
|
647
|
+
m,
|
|
619
648
|
a,
|
|
620
|
-
|
|
649
|
+
_
|
|
621
650
|
])
|
|
622
651
|
};
|
|
623
|
-
},
|
|
624
|
-
let
|
|
625
|
-
return
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
652
|
+
}, Qe = [], $e = (e, t, n = Qe) => {
|
|
653
|
+
let { onPreview: r, isPreviewable: i, onOpenInBrowser: a, isDownloadEnabled: o, isPreviewOpen: s, previewFilesOnMarkerClick: c, buildLabels: l } = t;
|
|
654
|
+
return C(() => {
|
|
655
|
+
let t = Q(e, n), u = Je({
|
|
656
|
+
onPreview: r,
|
|
657
|
+
isPreviewable: i,
|
|
658
|
+
onOpenInBrowser: a,
|
|
659
|
+
isDownloadEnabled: o,
|
|
660
|
+
isPreviewOpen: s,
|
|
661
|
+
previewFilesOnMarkerClick: c,
|
|
662
|
+
buildLabels: l
|
|
663
|
+
});
|
|
664
|
+
return (e, n) => {
|
|
665
|
+
let r = e == null ? void 0 : t.get(e);
|
|
666
|
+
return r ? u(r) : qe(e, n);
|
|
667
|
+
};
|
|
668
|
+
}, [
|
|
669
|
+
e,
|
|
670
|
+
n,
|
|
671
|
+
r,
|
|
672
|
+
i,
|
|
673
|
+
a,
|
|
674
|
+
o,
|
|
675
|
+
s,
|
|
676
|
+
c,
|
|
677
|
+
l
|
|
678
|
+
]);
|
|
679
|
+
}, et = [], tt = (e) => {
|
|
680
|
+
if (typeof e != "object" || !e) return !1;
|
|
681
|
+
let t = e.target?.selector, n = e.body?.source?.attachment;
|
|
682
|
+
return t?.type === "html_tag" && typeof t.id == "string" && typeof n?.url == "string" && (n.title == null || typeof n.title == "string");
|
|
683
|
+
}, nt = (e) => C(() => {
|
|
684
|
+
if (!Array.isArray(e)) return et;
|
|
685
|
+
let t = I(e.filter(tt));
|
|
686
|
+
return t.length ? t : et;
|
|
687
|
+
}, [e]);
|
|
643
688
|
//#endregion
|
|
644
|
-
export {
|
|
689
|
+
export { z as CitationCard, H as CitationCardProvider, G as CitationDropdown, B as CitationMarker, O as QUOTATIONS_CLASS, ye as annotationHighlightId, be as annotationHighlightIds, Me as annotationToOfficeHighlightLocations, ve as annotationsToPdfHighlights, se as gatherSameSourceAnnotations, xe as getAnnotationPdfPage, Ce as getCitationGroupPage, de as getReferenceAttachmentGroups, L as groupAnnotations, I as groupAnnotationsByCitId, F as groupAnnotationsBySource, Le as injectCitationSentinels, Te as isDocxRangeSelector, Oe as isExcelRcRangeSelector, Ee as isPptxRangeSelector, K as isReferenceOnlyAttachment, q as parsePdfPageReference, He as prepareCitationContent, Ke as replaceCitTagsWithSourceNames, $ as replaceSentinelsInChildren, we as resolveMessageAnnotations, Z as stripCitTagsWhileStreaming, Ne as useAnnotations, Fe as useCitationCard, U as useCitationCardContext, Ze as useCitationMarkdownComponents, $e as useCitationTagRenderer, nt as useHtmlTagAnnotationGroups };
|
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.353",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./index.js",
|
|
@@ -17,14 +17,14 @@
|
|
|
17
17
|
}
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@tabler/icons-react": "^3.
|
|
20
|
+
"@tabler/icons-react": "^3.50.0",
|
|
21
21
|
"react-markdown": "^10.1.0",
|
|
22
|
-
"@epam/pdf-highlighter-kit": "^0.0.
|
|
22
|
+
"@epam/pdf-highlighter-kit": "^0.0.21"
|
|
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.
|
|
26
|
+
"@epam/ai-dial-chat-shared": "1.3.0-dev.353",
|
|
27
|
+
"@epam/ai-dial-ui-kit": "^0.16.0"
|
|
28
28
|
},
|
|
29
29
|
"repository": {
|
|
30
30
|
"type": "git",
|
package/utils/annotation.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Annotation, AnnotationSelector, DocxRangeSelector, ExcelRcRangeSelector, Message, PptxRangeSelector } from '@epam/ai-dial-chat-shared';
|
|
2
2
|
import { InputHighlightData } from '@epam/pdf-highlighter-kit';
|
|
3
3
|
import { OfficeHighlightLocation } from '../models/office-highlight';
|
|
4
|
+
import { AnnotationGroup } from './group-annotations-by-source';
|
|
4
5
|
/**
|
|
5
6
|
* Maps a list of annotations to `InputHighlightData` entries for the PDF viewer.
|
|
6
7
|
* Recognizes `pdf_bbox` selectors and both `pdf_region` coordinate forms
|
|
@@ -52,6 +53,8 @@ export declare const annotationHighlightIds: (annotations: Annotation[]) => stri
|
|
|
52
53
|
* navigates without a highlight.
|
|
53
54
|
*/
|
|
54
55
|
export declare const getAnnotationPdfPage: (annotation: Annotation) => number | undefined;
|
|
56
|
+
/** Returns the 1-based PDF page a citation group's marker refers to, or `undefined` when none is known or `sourceName` already mentions a page. */
|
|
57
|
+
export declare const getCitationGroupPage: (group: AnnotationGroup) => number | undefined;
|
|
55
58
|
/**
|
|
56
59
|
* Resolves the annotation list for a message regardless of how it was loaded.
|
|
57
60
|
*
|
|
@@ -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;
|
|
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;AAC1E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAoMrE;;;;;;;GAOG;AACH,eAAO,MAAM,0BAA0B,GACrC,aAAa,UAAU,EAAE,KACxB,kBAAkB,EAsBpB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,qBAAqB,GAChC,YAAY,UAAU,EACtB,eAAe,MAAM,KACpB,MAG+D,CAAC;AAEnE;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,GAAI,aAAa,UAAU,EAAE,KAAG,MAAM,EAqBxE,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,oBAAoB,GAC/B,YAAY,UAAU,KACrB,MAAM,GAAG,SAeX,CAAC;AAUF,mJAAmJ;AACnJ,eAAO,MAAM,oBAAoB,GAC/B,OAAO,eAAe,KACrB,MAAM,GAAG,SAQX,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,yBAAyB,GAAI,SAAS,OAAO,KAAG,UAAU,EAoBtE,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,GAC9B,UAAU,kBAAkB,KAC3B,QAAQ,IAAI,iBAWd,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,mBAAmB,GAC9B,UAAU,kBAAkB,KAC3B,QAAQ,IAAI,iBAUd,CAAC;AAUF;;;GAGG;AACH,eAAO,MAAM,sBAAsB,GACjC,UAAU,kBAAkB,KAC3B,QAAQ,IAAI,oBAQd,CAAC;AA8FF;;;;GAIG;AACH,eAAO,MAAM,oCAAoC,GAC/C,YAAY,UAAU,KACrB,uBAAuB,EAuBzB,CAAC"}
|
|
@@ -22,15 +22,22 @@ export declare const escapeUnsupportedCitTags: (content: string) => string;
|
|
|
22
22
|
* preventing an incomplete opening tag from swallowing the streamed suffix.
|
|
23
23
|
*/
|
|
24
24
|
export declare const stripCitTagsWhileStreaming: (content: string) => string;
|
|
25
|
+
/**
|
|
26
|
+
* Prepares markdown for a surface that renders `<cit>` elements but no
|
|
27
|
+
* offset-based markers (e.g. stage content): hides supported elements while
|
|
28
|
+
* streaming, otherwise escapes every unsupported `cit` shape. Unlike the
|
|
29
|
+
* message body's preparation, it never injects sentinels.
|
|
30
|
+
*/
|
|
31
|
+
export declare const prepareCitationContent: (content: string, isStreaming: boolean) => string;
|
|
25
32
|
/** Returns `html_tag` groups keyed by the `data-id` of the `<cit>` element they resolve; a message's own `groups` win over `fallbackGroups` on a colliding id. */
|
|
26
33
|
export declare const buildCitGroupsByTagId: (groups: AnnotationGroup[], fallbackGroups?: AnnotationGroup[]) => Map<string, AnnotationGroup>;
|
|
27
34
|
/**
|
|
28
35
|
* Returns `content` with every supported `<cit data-id="…"></cit>` element
|
|
29
|
-
* that resolves to a group replaced by
|
|
30
|
-
*
|
|
31
|
-
*
|
|
36
|
+
* that resolves to a group replaced by `formatLabel(group)` — by default the
|
|
37
|
+
* group's `sourceName` — as plain Markdown text. Unresolved tags are left
|
|
38
|
+
* untouched.
|
|
32
39
|
*/
|
|
33
|
-
export declare const replaceCitTagsWithSourceNames: (content: string, groups: AnnotationGroup[], fallbackGroups?: AnnotationGroup[]) => string;
|
|
40
|
+
export declare const replaceCitTagsWithSourceNames: (content: string, groups: AnnotationGroup[], fallbackGroups?: AnnotationGroup[], formatLabel?: (group: AnnotationGroup) => string) => string;
|
|
34
41
|
/**
|
|
35
42
|
* Recursively walks a React child tree and replaces sentinel strings with
|
|
36
43
|
* the result of `renderMarker(idx)`. Handles string children, arrays, and
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"citation-injection.d.ts","sourceRoot":"","sources":["../../src/utils/citation-injection.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAUrE;;;;;;;;GAQG;AACH,eAAO,MAAM,uBAAuB,GAClC,SAAS,MAAM,EACf,QAAQ,eAAe,EAAE,KACxB,MAwBF,CAAC;AAmBF;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,GAAI,SAAS,MAAM,KAAG,MAGxD,CAAC;AAEJ;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,GAAI,SAAS,MAAM,KAAG,MAE5D,CAAC;AAeF,kKAAkK;AAClK,eAAO,MAAM,qBAAqB,GAChC,QAAQ,eAAe,EAAE,EACzB,iBAAgB,eAAe,EAAO,KACrC,GAAG,CAAC,MAAM,EAAE,eAAe,CAQ7B,CAAC;AAUF;;;;;GAKG;AACH,eAAO,MAAM,6BAA6B,GACxC,SAAS,MAAM,EACf,QAAQ,eAAe,EAAE,EACzB,iBAAgB,eAAe,EAAO,
|
|
1
|
+
{"version":3,"file":"citation-injection.d.ts","sourceRoot":"","sources":["../../src/utils/citation-injection.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAUrE;;;;;;;;GAQG;AACH,eAAO,MAAM,uBAAuB,GAClC,SAAS,MAAM,EACf,QAAQ,eAAe,EAAE,KACxB,MAwBF,CAAC;AAmBF;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,GAAI,SAAS,MAAM,KAAG,MAGxD,CAAC;AAEJ;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,GAAI,SAAS,MAAM,KAAG,MAE5D,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,GACjC,SAAS,MAAM,EACf,aAAa,OAAO,KACnB,MAKF,CAAC;AAeF,kKAAkK;AAClK,eAAO,MAAM,qBAAqB,GAChC,QAAQ,eAAe,EAAE,EACzB,iBAAgB,eAAe,EAAO,KACrC,GAAG,CAAC,MAAM,EAAE,eAAe,CAQ7B,CAAC;AAUF;;;;;GAKG;AACH,eAAO,MAAM,6BAA6B,GACxC,SAAS,MAAM,EACf,QAAQ,eAAe,EAAE,EACzB,iBAAgB,eAAe,EAAO,EACtC,cAAa,CAAC,KAAK,EAAE,eAAe,KAAK,MAAoC,KAC5E,MAqBF,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,GACrC,UAAU,SAAS,EACnB,cAAc,CAAC,GAAG,EAAE,MAAM,KAAK,SAAS,KACvC,SA0BF,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { AnnotationGroup } from './group-annotations-by-source';
|
|
2
|
+
/** Groups valid html-tag annotations without knowing the host persistence schema. */
|
|
3
|
+
export declare const useHtmlTagAnnotationGroups: (rawAnnotations: unknown) => AnnotationGroup[];
|
|
4
|
+
//# sourceMappingURL=useHtmlTagAnnotationGroups.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useHtmlTagAnnotationGroups.d.ts","sourceRoot":"","sources":["../../src/utils/useHtmlTagAnnotationGroups.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,eAAe,EACrB,MAAM,+BAA+B,CAAC;AAsBvC,qFAAqF;AACrF,eAAO,MAAM,0BAA0B,GACrC,gBAAgB,OAAO,KACtB,eAAe,EAOI,CAAC"}
|