@epam/ai-dial-quotations 1.2.0-dev.48 → 1.2.0-dev.58

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.
@@ -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;AAe5D,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAG/E,+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;CAClB;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;IAC7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,2EAA2E;IAC3E,eAAe,EAAE,CAAC,UAAU,EAAE,UAAU,KAAK,IAAI,CAAC;IAClD,wEAAwE;IACxE,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,CAsJ9C,CAAC"}
@@ -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;AAEnE,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,uEAAuE;IACvE,eAAe,EAAE,CAAC,UAAU,EAAE,UAAU,KAAK,IAAI,CAAC;IAClD,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,8HAA8H;AAC9H,eAAO,MAAM,gBAAgB,EAAE,EAAE,CAAC,qBAAqB,CAyEtD,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;AAGnE,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,uEAAuE;IACvE,eAAe,EAAE,CAAC,UAAU,EAAE,UAAU,KAAK,IAAI,CAAC;IAClD,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,8HAA8H;AAC9H,eAAO,MAAM,gBAAgB,EAAE,EAAE,CAAC,qBAAqB,CA0EtD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"CitationMarker.d.ts","sourceRoot":"","sources":["../../../src/components/CitationMarker/CitationMarker.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEtC,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,gDAAgD;AAChD,MAAM,WAAW,mBAAmB;IAClC,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,CAwBlD,CAAC"}
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;AAGtC,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,gDAAgD;AAChD,MAAM,WAAW,mBAAmB;IAClC,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,CA6BlD,CAAC"}
@@ -0,0 +1,14 @@
1
+ export declare const QUOTATIONS_CLASS: {
2
+ /** The citation card's `role="dialog"` root, which carries the themed CSS variables. */
3
+ readonly citationCard: "dial-quotations-citation-card";
4
+ /** The floating panel a `CitationDropdown` reveals, which holds the card. */
5
+ readonly citationDropdown: "dial-quotations-citation-dropdown";
6
+ /**
7
+ * The marker pill that opens a citation, additive to the
8
+ * `dial-kit-base-button` that `@epam/ai-dial-ui-kit` draws. The pill caps its
9
+ * own width and ellipsises a long source name, so a host widening it should
10
+ * override `max-inline-size` here rather than unset the truncation.
11
+ */
12
+ readonly citationMarker: "dial-quotations-citation-marker";
13
+ };
14
+ //# sourceMappingURL=public-class-names.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"public-class-names.d.ts","sourceRoot":"","sources":["../../src/constants/public-class-names.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,gBAAgB;IAC3B,wFAAwF;;IAExF,6EAA6E;;IAE7E;;;;;OAKG;;CAEK,CAAC"}
package/index.css CHANGED
@@ -1,2 +1,2 @@
1
1
  ._card_1kph1_1{background:var(--cc-card-bg,var(--bg-layer-raised,#fcfcfc))}._quote_1kph1_5{color:var(--cc-quote-text,var(--text-secondary,#57647a))}._title_1kph1_9{color:var(--cc-title-text,var(--text-primary,#161b2d))}._switcher_1kph1_13{color:var(--cc-switcher-text,var(--text-secondary,#57647a))}._sourceName_1kph1_17{color:var(--cc-source-name-text,var(--text-primary,#161b2d))}._content_xzs0h_1>svg{fill:var(--cc-card-bg,var(--bg-layer-raised,#fcfcfc));stroke:#0000}
2
- /*$vite$:1*/.visible{visibility:visible}.collapse{visibility:collapse}.absolute{position:absolute}.mb-1{margin-bottom:.25rem}.mb-1\.5{margin-bottom:.375rem}.mb-3{margin-bottom:.75rem}.ms-1{margin-inline-start:.25rem}.line-clamp-6{display:-webkit-box;overflow:hidden;-webkit-box-orient:vertical;-webkit-line-clamp:6}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table-cell{display:table-cell}.table-row{display:table-row}.hidden{display:none}.min-h-\[3lh\]{min-height:3lh}.w-\[400px\]{width:400px}.min-w-0{min-width:0}.\!max-w-none{max-width:none!important}.shrink-0{flex-shrink:0}.flex-col{flex-direction:column}.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}.break-words{overflow-wrap:break-word}.\!rounded-none{border-radius:0!important}.rounded-lg{border-radius:.5rem}.\!border-0{border-width:0!important}.\!bg-transparent{background-color:transparent!important}.\!p-0{padding:0!important}.p-4{padding:1rem}.ps-3{padding-inline-start:.75rem}.align-middle{vertical-align:middle}.\!shadow-none{--tw-shadow:0 0 #0000!important;--tw-shadow-colored:0 0 #0000!important;box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)!important}.shadow-lg{--tw-shadow:0 8px 44px 0 var(--shadow-lg,#2764d914);--tw-shadow-colored:0 8px 44px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.\[overflow-wrap\:anywhere\]{overflow-wrap:anywhere}.\[text-wrap\:pretty\]{text-wrap:pretty}.last\:mb-0:last-child{margin-bottom:0}.rtl\:scale-x-\[-1\]:where([dir=rtl],[dir=rtl] *){--tw-scale-x:-1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}
2
+ /*$vite$:1*/.visible{visibility:visible}.collapse{visibility:collapse}.fixed{position:fixed}.absolute{position:absolute}.mb-1{margin-bottom:.25rem}.mb-1\.5{margin-bottom:.375rem}.mb-3{margin-bottom:.75rem}.ms-1{margin-inline-start:.25rem}.line-clamp-6{display:-webkit-box;overflow:hidden;-webkit-box-orient:vertical;-webkit-line-clamp:6}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table-cell{display:table-cell}.table-row{display:table-row}.hidden{display:none}.min-h-\[3lh\]{min-height:3lh}.w-\[400px\]{width:400px}.min-w-0{min-width:0}.\!max-w-none{max-width:none!important}.max-w-\[240px\]{max-width:240px}.shrink{flex-shrink:1}.shrink-0{flex-shrink:0}.flex-col{flex-direction:column}.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}.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}.\!border-0{border-width:0!important}.\!bg-transparent{background-color:transparent!important}.\!p-0{padding:0!important}.p-4{padding:1rem}.ps-3{padding-inline-start:.75rem}.align-middle{vertical-align:middle}.\!shadow-none{--tw-shadow:0 0 #0000!important;--tw-shadow-colored:0 0 #0000!important;box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)!important}.shadow-lg{--tw-shadow:0 8px 44px 0 var(--shadow-lg,#2764d914);--tw-shadow-colored:0 8px 44px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.\[overflow-wrap\:anywhere\]{overflow-wrap:anywhere}.\[text-wrap\:pretty\]{text-wrap:pretty}.last\:mb-0:last-child{margin-bottom:0}.rtl\:scale-x-\[-1\]:where([dir=rtl],[dir=rtl] *){--tw-scale-x:-1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}
package/index.d.ts CHANGED
@@ -17,4 +17,5 @@ export type { DocxOfficeHighlightLocation, DocxTableRowOfficeHighlightLocation,
17
17
  export { injectCitationSentinels, replaceSentinelsInChildren, stripCitTagsWhileStreaming, } from './utils/citation-injection';
18
18
  export { isReferenceOnlyAttachment, parsePdfPageReference, getReferenceAttachmentGroups, } from './utils/reference-attachment';
19
19
  export type { PdfPageReference } from './utils/reference-attachment';
20
+ export { QUOTATIONS_CLASS } from './constants/public-class-names';
20
21
  //# 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,YA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AAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC"}
package/index.js CHANGED
@@ -3,14 +3,19 @@ import { DIAL_KIT_ICON_STROKE as s, ElementSize as c, EllipsisTooltip as l, Ghos
3
3
  import { IconChevronLeft as m, IconChevronRight as h } from "@tabler/icons-react";
4
4
  import { Fragment as g, jsx as _, jsxs as v } from "react/jsx-runtime";
5
5
  import { createContext as y, useCallback as b, useContext as x, useId as S, useMemo as C, useState as w } from "react";
6
+ //#region src/constants/public-class-names.ts
6
7
  var T = {
8
+ citationCard: "dial-quotations-citation-card",
9
+ citationDropdown: "dial-quotations-citation-dropdown",
10
+ citationMarker: "dial-quotations-citation-marker"
11
+ }, E = {
7
12
  card: "_card_1kph1_1",
8
13
  quote: "_quote_1kph1_5",
9
14
  title: "_title_1kph1_9",
10
15
  switcher: "_switcher_1kph1_13",
11
16
  sourceName: "_sourceName_1kph1_17"
12
- }, E = ({ group: r, activeIndex: a, onIndexChange: o, onPreview: d, onOpenInBrowser: p, headerIcon: g, labels: y, typography: b, colors: x }) => {
13
- let S = r.annotations.length, C = r.annotations[a] ?? r.primaryAnnotation, w = S > 1, E = r.primaryAnnotation.body?.source?.attachment?.type, D = d == null || E === e.HTML || E === e.XHTML, O = b?.sourceNameClassName ?? "dial-tiny-text", k = b?.titleClassName ?? "dial-body-semi-text", A = b?.quoteClassName ?? "dial-small-text", j = b?.quoteStrongClassName ?? "dial-small-semi-text", M = b?.switcherClassName ?? "dial-tiny-text", N = n({
17
+ }, D = ({ group: r, activeIndex: a, onIndexChange: o, onPreview: d, onOpenInBrowser: p, headerIcon: g, labels: y, typography: b, colors: x }) => {
18
+ let S = r.annotations.length, C = r.annotations[a] ?? r.primaryAnnotation, w = S > 1, D = r.primaryAnnotation.body?.source?.attachment?.type, O = d == null || D === e.HTML || D === e.XHTML, k = b?.sourceNameClassName ?? "dial-tiny-text", A = b?.titleClassName ?? "dial-body-semi-text", j = b?.quoteClassName ?? "dial-small-text", M = b?.quoteStrongClassName ?? "dial-small-semi-text", N = b?.switcherClassName ?? "dial-tiny-text", ee = n({
14
19
  "--cc-card-bg": x?.cardBackground,
15
20
  "--cc-quote-text": x?.quoteText,
16
21
  "--cc-title-text": x?.titleText,
@@ -21,8 +26,8 @@ var T = {
21
26
  role: "dialog",
22
27
  "aria-modal": "true",
23
28
  "aria-label": y.ariaLabel,
24
- style: N,
25
- className: i("flex w-[400px] flex-col gap-3 rounded-lg p-4 shadow-lg", T.card),
29
+ style: ee,
30
+ className: i("flex w-[400px] flex-col gap-3 rounded-lg p-4 shadow-lg", E.card, T.citationCard),
26
31
  children: [
27
32
  /* @__PURE__ */ v("div", {
28
33
  className: "flex items-center justify-between gap-2",
@@ -30,7 +35,7 @@ var T = {
30
35
  className: "flex min-w-0 items-center gap-1",
31
36
  children: [g, /* @__PURE__ */ _(l, {
32
37
  text: r.sourceName,
33
- className: i(O, "min-w-0", T.sourceName)
38
+ className: i(k, "min-w-0", E.sourceName)
34
39
  })]
35
40
  }), w && /* @__PURE__ */ v("div", {
36
41
  className: "flex shrink-0 items-center gap-1",
@@ -46,7 +51,7 @@ var T = {
46
51
  onClick: () => o((a - 1 + S) % S)
47
52
  }),
48
53
  /* @__PURE__ */ _("span", {
49
- className: i(M, T.switcher),
54
+ className: i(N, E.switcher),
50
55
  children: y.formatSwitcherText(a + 1, S)
51
56
  }),
52
57
  /* @__PURE__ */ _(u, {
@@ -65,17 +70,17 @@ var T = {
65
70
  (C.body?.title || C.body?.quote || w) && /* @__PURE__ */ v("div", {
66
71
  className: "flex flex-col gap-3",
67
72
  children: [C.body?.title && /* @__PURE__ */ _("p", {
68
- className: i(k, T.title, "break-words"),
73
+ className: i(A, E.title, "break-words"),
69
74
  children: C.body.title
70
75
  }), (C.body?.quote || w) && /* @__PURE__ */ _("div", {
71
- className: i(A, T.quote, "line-clamp-6 break-words", w && "min-h-[3lh]"),
76
+ className: i(j, E.quote, "line-clamp-6 break-words", w && "min-h-[3lh]"),
72
77
  children: C.body?.quote && /* @__PURE__ */ _(t, {
73
78
  content: C.body.quote,
74
79
  classNames: {
75
- p: i(A, T.quote),
76
- ul: i(A, "ps-3"),
77
- ol: i(A, "ps-3"),
78
- strong: j
80
+ p: i(j, E.quote),
81
+ ul: i(j, "ps-3"),
82
+ ol: i(j, "ps-3"),
83
+ strong: M
79
84
  }
80
85
  })
81
86
  })]
@@ -87,33 +92,30 @@ var T = {
87
92
  size: c.Small,
88
93
  onClick: () => d(C)
89
94
  }), /* @__PURE__ */ _(f, {
90
- label: D ? y.openInBrowser : y.download,
95
+ label: O ? y.openInBrowser : y.download,
91
96
  size: c.Small,
92
97
  onClick: () => p(C)
93
98
  })]
94
99
  })
95
100
  ]
96
101
  });
97
- }, D = ({ annotationCount: e, onOpen: t, icon: n, labels: r, labelClassName: i = "dial-caption-text" }) => {
98
- let a = /* @__PURE__ */ v("span", {
99
- className: "flex items-center gap-1",
100
- children: [n, /* @__PURE__ */ _("span", {
101
- className: i,
102
- children: e > 1 ? r.labelWithOverflow : r.label
103
- })]
104
- });
105
- return /* @__PURE__ */ _(d, {
106
- size: c.Small,
107
- label: a,
108
- "aria-label": r.ariaLabel,
109
- onClick: t
110
- });
111
- }, O = y(null), k = O.Provider, A = () => {
112
- let e = x(O);
102
+ }, O = ({ annotationCount: e, onOpen: t, icon: n, labels: r, labelClassName: a = "dial-caption-text" }) => /* @__PURE__ */ _(d, {
103
+ size: c.Small,
104
+ className: i("max-w-[240px]", T.citationMarker),
105
+ textClassName: "min-w-0 truncate",
106
+ iconBefore: n,
107
+ label: /* @__PURE__ */ _("span", {
108
+ className: a,
109
+ children: e > 1 ? r.labelWithOverflow : r.label
110
+ }),
111
+ "aria-label": r.ariaLabel,
112
+ onClick: t
113
+ }), k = y(null), A = k.Provider, j = () => {
114
+ let e = x(k);
113
115
  if (e == null) throw Error("useCitationCardContext must be used within a CitationCardProvider");
114
116
  return e;
115
- }, j = { content: "_content_xzs0h_1" }, M = ({ group: e, onPreview: t, onOpenInBrowser: n, icon: r, headerIcon: a, cardLabels: o, markerLabels: s, cardTypography: c, markerLabelClassName: l }) => {
116
- let u = A(), d = S(), f = u.isOpen(d), m = u.getActiveIndex(e.groupKey), h = b((e) => {
117
+ }, M = { content: "_content_xzs0h_1" }, N = ({ group: e, onPreview: t, onOpenInBrowser: n, icon: r, headerIcon: a, cardLabels: o, markerLabels: s, cardTypography: c, markerLabelClassName: l }) => {
118
+ let u = j(), d = S(), f = u.isOpen(d), m = u.getActiveIndex(e.groupKey), h = b((e) => {
117
119
  e || u.closePopup(d);
118
120
  }, [u, d]), g = C(() => t ? (e) => {
119
121
  t(e), u.closePopup(d);
@@ -126,8 +128,8 @@ var T = {
126
128
  open: f,
127
129
  onOpenChange: h,
128
130
  triggerClassName: "ms-1 inline-flex align-middle",
129
- contentClassName: i("!p-0 !bg-transparent !border-0 !shadow-none !max-w-none !rounded-none", j.content),
130
- tooltip: /* @__PURE__ */ _(E, {
131
+ contentClassName: i("!p-0 !bg-transparent !border-0 !shadow-none !max-w-none !rounded-none", M.content, T.citationDropdown),
132
+ tooltip: /* @__PURE__ */ _(D, {
131
133
  group: e,
132
134
  activeIndex: m,
133
135
  onIndexChange: (t) => u.setActiveIndex(e.groupKey, t),
@@ -137,7 +139,7 @@ var T = {
137
139
  labels: o,
138
140
  typography: c
139
141
  }),
140
- children: /* @__PURE__ */ _(D, {
142
+ children: /* @__PURE__ */ _(O, {
141
143
  sourceName: e.sourceName,
142
144
  annotationCount: e.annotations.length,
143
145
  onOpen: () => u.openPopup(d),
@@ -146,7 +148,7 @@ var T = {
146
148
  labelClassName: l
147
149
  })
148
150
  });
149
- }, N = (e) => {
151
+ }, ee = (e) => {
150
152
  let t = e.trim();
151
153
  if (!t.startsWith("|") || !t.endsWith("|") || /[\r\n]/.test(t)) return;
152
154
  let n = [], r = "";
@@ -155,11 +157,11 @@ var T = {
155
157
  i === "\\" && a != null && /[!-/:-@[-`{-~]/.test(a) ? (r += a, e += 1) : i === "|" ? (n.push(r.trim()), r = "") : r += i;
156
158
  }
157
159
  if (!(r !== "" || n.length < 2 || n.every((e) => e === "" || /^:?-{3,}:?$/.test(e)))) return n;
158
- }, ee = (e) => {
160
+ }, te = (e) => {
159
161
  if (e.type !== "docx_text_anchor" && e.type !== "pptx_text_anchor") return;
160
162
  let { text: t, occurrence: n, slide: r } = e;
161
163
  if (typeof t != "string" || typeof n != "number" || !Number.isSafeInteger(n) || n < 1) return;
162
- let i = N(t);
164
+ let i = ee(t);
163
165
  if (i != null) {
164
166
  if (e.type === "docx_text_anchor") return {
165
167
  type: "docx_text_anchor",
@@ -173,13 +175,13 @@ var T = {
173
175
  slide: r
174
176
  };
175
177
  }
176
- }, te = {
178
+ }, ne = {
177
179
  backgroundColor: "transparent",
178
180
  borderColor: "var(--stroke-accent, #1D4ED8)",
179
181
  borderWidth: "2px",
180
182
  opacity: .5,
181
183
  hoverOpacity: .5
182
- }, ne = (e) => {
184
+ }, re = (e) => {
183
185
  if (typeof e != "object" || !e) return;
184
186
  let t = e, { lt: n, wh: r } = t;
185
187
  if (Array.isArray(n) && Array.isArray(r) && n.length >= 2 && r.length >= 2) {
@@ -209,7 +211,7 @@ var T = {
209
211
  x2: i,
210
212
  y2: a
211
213
  });
212
- } else t.type === "pdf_region" && (n = ne(t.bbox));
214
+ } else t.type === "pdf_region" && (n = re(t.bbox));
213
215
  if (n == null) return;
214
216
  let i = t.page;
215
217
  if (!(typeof i != "number" || !Number.isInteger(i) || i < 1) && [
@@ -224,7 +226,22 @@ var T = {
224
226
  x2: n.x2,
225
227
  y2: n.y2
226
228
  };
227
- }, re = (e) => e.flatMap((e, t) => {
229
+ }, F = (e) => typeof e != "object" || !e ? String(e) : Array.isArray(e) ? `[${e.map(F).join(",")}]` : `{${Object.entries(e).filter(([, e]) => e !== void 0).sort(([e], [t]) => e < t ? -1 : +(e > t)).map(([e, t]) => `${e}=${F(t)}`).join(",")}}`, ie = (e) => {
230
+ let t = 5381;
231
+ for (let n = 0; n < e.length; n += 1) t = t * 33 + e.charCodeAt(n) | 0;
232
+ return (t >>> 0).toString(36);
233
+ }, ae = (e) => {
234
+ let t = e.body?.selector;
235
+ if (t == null) return;
236
+ let n = (Array.isArray(t) ? t : [t]).flatMap((e) => {
237
+ let t = P(e);
238
+ return t == null ? [] : [t];
239
+ }), r = H(e);
240
+ if (!(n.length === 0 && r.length === 0)) return F([n, r]);
241
+ }, oe = (e) => {
242
+ let t = e.target?.selector, n = t?.type === "html_tag" ? t.id : void 0, r = typeof n == "string" ? n : void 0, i = ae(e);
243
+ if (!(r == null && i == null)) return ie(`${r ?? ""}|${i ?? ""}`);
244
+ }, se = (e) => e.flatMap((e, t) => {
228
245
  let n = e.body?.selector;
229
246
  if (n == null) return [];
230
247
  let i = (Array.isArray(n) ? n : [n]).flatMap((e) => {
@@ -233,11 +250,11 @@ var T = {
233
250
  return t == null ? [] : [t];
234
251
  });
235
252
  return i.length === 0 ? [] : [{
236
- id: String(e.index ?? t),
253
+ id: I(e, t),
237
254
  bboxes: i,
238
- style: te
255
+ style: ne
239
256
  }];
240
- }), ie = (e, t) => String(e.index ?? t), ae = (e) => {
257
+ }), I = (e, t) => e.index == null ? oe(e) ?? String(t) : String(e.index), ce = (e) => {
241
258
  let t = e.body?.selector;
242
259
  if (t == null) return;
243
260
  let n = Array.isArray(t) ? t : [t];
@@ -246,26 +263,26 @@ var T = {
246
263
  let t = P(e);
247
264
  if (t != null) return t.page;
248
265
  }
249
- }, F = (e) => {
266
+ }, L = (e) => {
250
267
  let t = e.custom_content?.annotations;
251
268
  if (t?.length) return t.filter((e) => e != null && e.body?.source?.attachment?.url != null).map(a);
252
269
  let n = e.custom_fields;
253
270
  if (typeof n != "object" || !n) return [];
254
271
  let r = n.annotations;
255
272
  return !Array.isArray(r) || r.length === 0 ? [] : o(r, e.custom_content?.attachments ?? []).map(a);
256
- }, I = (e) => {
273
+ }, R = (e) => {
257
274
  if (e.type !== "docx_text_range") return !1;
258
275
  let t = e;
259
276
  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";
260
- }, L = (e) => {
277
+ }, z = (e) => {
261
278
  if (e.type !== "pptx_text_range") return !1;
262
279
  let t = e;
263
280
  return typeof t.slide == "number" && typeof t.shape_id == "string" && typeof t.start == "number" && typeof t.end == "number" && typeof t.text == "string";
264
- }, R = (e) => typeof e == "object" && !!e && typeof e.row == "number" && typeof e.col == "number", z = (e) => {
281
+ }, B = (e) => typeof e == "object" && !!e && typeof e.row == "number" && typeof e.col == "number", V = (e) => {
265
282
  if (e.type !== "excel_rc_range") return !1;
266
283
  let t = e;
267
- return typeof t.sheet == "string" && R(t.start) && (t.end === void 0 || t.end === null || R(t.end));
268
- }, oe = (e) => {
284
+ return typeof t.sheet == "string" && B(t.start) && (t.end === void 0 || t.end === null || B(t.end));
285
+ }, le = (e) => {
269
286
  let { story: t, path: n, start: r, end: i, text: a } = e;
270
287
  if (!(!n.every((e) => Number.isInteger(e)) || !Number.isInteger(r) || !Number.isInteger(i) || r < 0 || i < r)) return {
271
288
  type: "docx_text_range",
@@ -275,7 +292,7 @@ var T = {
275
292
  endExclusive: i,
276
293
  text: a
277
294
  };
278
- }, se = (e) => {
295
+ }, ue = (e) => {
279
296
  let { slide: t, shape_id: n, start: r, end: i, text: a } = e;
280
297
  if (!(!Number.isInteger(t) || t < 1 || !Number.isInteger(r) || !Number.isInteger(i) || r < 0 || i < r)) return {
281
298
  type: "pptx_text_range",
@@ -285,7 +302,7 @@ var T = {
285
302
  endExclusive: i,
286
303
  text: a
287
304
  };
288
- }, ce = (e) => {
305
+ }, de = (e) => {
289
306
  let { sheet: t, start: n, end: r } = e;
290
307
  if (!(t.length === 0 || !Number.isInteger(n.row) || !Number.isInteger(n.col) || n.row < 1 || n.col < 1)) {
291
308
  if (r == null) return {
@@ -300,30 +317,30 @@ var T = {
300
317
  end: r
301
318
  };
302
319
  }
303
- }, le = (e) => {
320
+ }, H = (e) => {
304
321
  let t = e.body?.selector;
305
322
  return t == null ? [] : (Array.isArray(t) ? t : [t]).flatMap((e) => {
306
323
  if (!r(e)) return [];
307
- if (I(e)) {
308
- let t = oe(e);
324
+ if (R(e)) {
325
+ let t = le(e);
309
326
  return t ? [t] : [];
310
327
  }
311
- if (L(e)) {
312
- let t = se(e);
328
+ if (z(e)) {
329
+ let t = ue(e);
313
330
  return t ? [t] : [];
314
331
  }
315
- if (z(e)) {
316
- let t = ce(e);
332
+ if (V(e)) {
333
+ let t = de(e);
317
334
  return t ? [t] : [];
318
335
  }
319
- let t = ee(e);
336
+ let t = te(e);
320
337
  return t ? [t] : [];
321
338
  });
322
- }, ue = (e, t) => C(() => t ? [] : F(e), [t, e]), de = {
339
+ }, fe = (e, t) => C(() => t ? [] : L(e), [t, e]), pe = {
323
340
  openOwnerKey: null,
324
341
  activeIndexByGroup: {}
325
- }, B = () => {
326
- let [e, t] = w(de), n = b((e) => {
342
+ }, me = () => {
343
+ let [e, t] = w(pe), n = b((e) => {
327
344
  t((t) => ({
328
345
  ...t,
329
346
  openOwnerKey: e
@@ -354,7 +371,7 @@ var T = {
354
371
  i,
355
372
  e
356
373
  ]);
357
- }, V = /⟦C(\d+)⟧/g, H = (e, t) => {
374
+ }, he = /⟦C(\d+)⟧/g, U = (e, t) => {
358
375
  let n = t.map((e, t) => ({
359
376
  g: e,
360
377
  idx: t
@@ -367,9 +384,9 @@ var T = {
367
384
  }).sort((e, t) => t.pos - e.pos), r = e;
368
385
  for (let { idx: e, pos: t } of n) r = `${r.slice(0, t)}⟦C${e}⟧${r.slice(t)}`;
369
386
  return r;
370
- }, fe = /<cit\s+data-id=(?:"[^"]+"|'[^']+')\s*>\s*<\/cit>/g, pe = /^<cit\s+data-id=(?:"[^"]+"|'[^']+')\s*>\s*<\/cit>$/, me = /<cit\s+data-id=(?:"[^"]+"|'[^']+')\s*>\s*<\/cit>|<\/?cit\b[^>]*>|<\/?cit\b[^>]*$/gi, he = (e) => e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;"), U = (e) => e.replace(me, (e) => pe.test(e) ? e : he(e)), W = (e) => U(e).replace(fe, ""), G = (e, t) => {
387
+ }, ge = /<cit\s+data-id=(?:"[^"]+"|'[^']+')\s*>\s*<\/cit>/g, _e = /^<cit\s+data-id=(?:"[^"]+"|'[^']+')\s*>\s*<\/cit>$/, ve = /<cit\s+data-id=(?:"[^"]+"|'[^']+')\s*>\s*<\/cit>|<\/?cit\b[^>]*>|<\/?cit\b[^>]*$/gi, ye = (e) => e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;"), W = (e) => e.replace(ve, (e) => _e.test(e) ? e : ye(e)), G = (e) => W(e).replace(ge, ""), K = (e, t) => {
371
388
  if (typeof e == "string") {
372
- let n = e.split(V);
389
+ let n = e.split(he);
373
390
  if (n.length === 1) return e;
374
391
  let r = [];
375
392
  return n.forEach((e, n) => {
@@ -377,18 +394,18 @@ var T = {
377
394
  }), r;
378
395
  }
379
396
  return Array.isArray(e) ? e.flatMap((e) => {
380
- let n = G(e, t);
397
+ let n = K(e, t);
381
398
  return Array.isArray(n) ? n : [n];
382
399
  }) : e;
383
- }, ge = (e) => {
400
+ }, be = (e) => {
384
401
  let t = e.primaryAnnotation.target?.selector;
385
402
  return t?.type === "html_tag" ? t.id : void 0;
386
- }, _e = (e, t) => /* @__PURE__ */ v(g, { children: [
403
+ }, xe = (e, t) => /* @__PURE__ */ v(g, { children: [
387
404
  e == null ? "<cit>" : `<cit data-id="${e}">`,
388
405
  t,
389
406
  "</cit>"
390
- ] }), ve = (e, t, n, r = !1, a = !1) => {
391
- let { onPreview: o, onOpenInBrowser: s, buildLabels: c } = n, l = C(() => r ? W(e) : U(t.length > 0 ? H(e, t) : e), [
407
+ ] }), Se = (e, t, n, r = !1, a = !1) => {
408
+ let { onPreview: o, onOpenInBrowser: s, buildLabels: c } = n, l = C(() => r ? G(e) : W(t.length > 0 ? U(e, t) : e), [
392
409
  e,
393
410
  t,
394
411
  r
@@ -398,12 +415,12 @@ var T = {
398
415
  markdownComponents: C(() => {
399
416
  let e = /* @__PURE__ */ new Map();
400
417
  for (let n of t) {
401
- let t = ge(n);
418
+ let t = be(n);
402
419
  t != null && e.set(t, n);
403
420
  }
404
421
  let n = (e) => {
405
422
  let { cardLabels: t, markerLabels: n } = c(e);
406
- return /* @__PURE__ */ _(M, {
423
+ return /* @__PURE__ */ _(N, {
407
424
  group: e,
408
425
  onPreview: (t) => o(t, e),
409
426
  onOpenInBrowser: s,
@@ -415,19 +432,19 @@ var T = {
415
432
  return r ? n(r) : null;
416
433
  }, l = { cit: (t) => {
417
434
  let r = t["data-id"] == null ? void 0 : e.get(t["data-id"]);
418
- return r ? n(r) : _e(t["data-id"], t.children);
435
+ return r ? n(r) : xe(t["data-id"], t.children);
419
436
  } };
420
437
  return t.length === 0 ? u ? l : {} : {
421
438
  ...l,
422
439
  p: ({ children: e, ...t }) => /* @__PURE__ */ _("p", {
423
440
  ...t,
424
441
  className: i(a ? "dial-small-paragraph-text" : "dial-body-paragraph-text", "mb-3 [overflow-wrap:anywhere] [text-wrap:pretty] last:mb-0"),
425
- children: G(e, r)
442
+ children: K(e, r)
426
443
  }),
427
444
  li: ({ children: e, ...t }) => /* @__PURE__ */ _("li", {
428
445
  ...t,
429
446
  className: "mb-1.5 last:mb-0",
430
- children: G(e, r)
447
+ children: K(e, r)
431
448
  })
432
449
  };
433
450
  }, [
@@ -439,26 +456,26 @@ var T = {
439
456
  u
440
457
  ])
441
458
  };
442
- }, K = (e) => {
459
+ }, q = (e) => {
443
460
  try {
444
461
  return decodeURIComponent(e);
445
462
  } catch {
446
463
  return e;
447
464
  }
448
- }, q = (e) => {
465
+ }, Ce = (e) => {
449
466
  try {
450
467
  let t = new URL(e);
451
- return t.pathname.split("/").map((e) => K(e)).filter(Boolean).at(-1) ?? t.hostname;
468
+ return t.pathname.split("/").map((e) => q(e)).filter(Boolean).at(-1) ?? t.hostname;
452
469
  } catch {
453
- return e.split("/").map((e) => K(e)).filter(Boolean).at(-1) ?? e;
470
+ return e.split("/").map((e) => q(e)).filter(Boolean).at(-1) ?? e;
454
471
  }
455
- }, J = (e, t) => e.body?.source?.attachment?.title ?? q(t), Y = (e) => {
472
+ }, J = (e, t) => e.body?.source?.attachment?.title ?? Ce(t), Y = (e) => {
456
473
  let t = e.target?.selector;
457
474
  return t?.type === "html_tag" ? t : void 0;
458
- }, ye = (e) => Y(e) != null, X = (e) => {
475
+ }, we = (e) => Y(e) != null, X = (e) => {
459
476
  let t = /* @__PURE__ */ new Map();
460
477
  for (let n of e) {
461
- if (ye(n)) continue;
478
+ if (we(n)) continue;
462
479
  let e = n.body?.source?.attachment?.url;
463
480
  if (e == null) continue;
464
481
  let r = t.get(e);
@@ -488,16 +505,16 @@ var T = {
488
505
  });
489
506
  }
490
507
  return Array.from(t.values());
491
- }, be = (e) => [...Z(e), ...X(e)], xe = (e, t) => {
508
+ }, Te = (e) => [...Z(e), ...X(e)], Ee = (e, t) => {
492
509
  let n = e.body?.source?.attachment?.url;
493
510
  return n == null || !t.includes(e) ? [e] : t.filter((e) => e.body?.source?.attachment?.url === n);
494
- }, Q = (e) => e.url == null && e.reference_url != null, Se = /^(.*\.pdf)(?:#page=(\d+))?$/i, $ = (e) => {
495
- let t = Se.exec(e);
511
+ }, Q = (e) => e.url == null && e.reference_url != null, De = /^(.*\.pdf)(?:#page=(\d+))?$/i, $ = (e) => {
512
+ let t = De.exec(e);
496
513
  return t ? {
497
514
  baseUrl: t[1],
498
515
  page: t[2] == null ? null : Number(t[2])
499
516
  } : null;
500
- }, Ce = (t) => X((t ?? []).filter(Q).map((t) => {
517
+ }, Oe = (t) => X((t ?? []).filter(Q).map((t) => {
501
518
  let n = t.reference_url, r = $(n) != null;
502
519
  return { body: {
503
520
  quote: t.data,
@@ -512,4 +529,4 @@ var T = {
512
529
  } };
513
530
  }));
514
531
  //#endregion
515
- export { E as CitationCard, k as CitationCardProvider, M as CitationDropdown, D as CitationMarker, ie as annotationHighlightId, le as annotationToOfficeHighlightLocations, re as annotationsToPdfHighlights, xe as gatherSameSourceAnnotations, ae as getAnnotationPdfPage, Ce as getReferenceAttachmentGroups, be as groupAnnotations, Z as groupAnnotationsByCitId, X as groupAnnotationsBySource, H as injectCitationSentinels, I as isDocxRangeSelector, z as isExcelRcRangeSelector, L as isPptxRangeSelector, Q as isReferenceOnlyAttachment, $ as parsePdfPageReference, G as replaceSentinelsInChildren, F as resolveMessageAnnotations, W as stripCitTagsWhileStreaming, ue as useAnnotations, B as useCitationCard, A as useCitationCardContext, ve as useCitationMarkdownComponents };
532
+ export { D as CitationCard, A as CitationCardProvider, N as CitationDropdown, O as CitationMarker, T as QUOTATIONS_CLASS, I as annotationHighlightId, H as annotationToOfficeHighlightLocations, se as annotationsToPdfHighlights, Ee as gatherSameSourceAnnotations, ce as getAnnotationPdfPage, Oe as getReferenceAttachmentGroups, Te as groupAnnotations, Z as groupAnnotationsByCitId, X as groupAnnotationsBySource, U as injectCitationSentinels, R as isDocxRangeSelector, V as isExcelRcRangeSelector, z as isPptxRangeSelector, Q as isReferenceOnlyAttachment, $ as parsePdfPageReference, K as replaceSentinelsInChildren, L as resolveMessageAnnotations, G as stripCitTagsWhileStreaming, fe as useAnnotations, me as useCitationCard, j as useCitationCardContext, Se as useCitationMarkdownComponents };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@epam/ai-dial-quotations",
3
3
  "description": "Citation and annotation components, hooks, and utilities for AI DIAL conversations",
4
- "version": "1.2.0-dev.48",
4
+ "version": "1.2.0-dev.58",
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.2.0-dev.48",
27
- "@epam/ai-dial-ui-kit": "^0.15.0-dev.7"
26
+ "@epam/ai-dial-chat-shared": "1.2.0-dev.58",
27
+ "@epam/ai-dial-ui-kit": "^0.15.0-dev.9"
28
28
  },
29
29
  "repository": {
30
30
  "type": "git",
@@ -5,11 +5,34 @@ import { OfficeHighlightLocation } from '../models/office-highlight';
5
5
  * Maps a list of annotations to `InputHighlightData` entries for the PDF viewer.
6
6
  * Recognizes `pdf_bbox` selectors and both `pdf_region` coordinate forms
7
7
  * (`lt`/`wh` and legacy `left`/`top`/`width`/`height`); annotations whose
8
- * `body.selector` contains none of these are skipped. The highlight `id` is
9
- * `annotation.index` when present, otherwise the position in the input array.
8
+ * `body.selector` contains none of these are skipped. The highlight `id` comes
9
+ * from `annotationHighlightId`, so it identifies the annotation itself rather
10
+ * than its position in this particular input list.
10
11
  */
11
12
  export declare const annotationsToPdfHighlights: (annotations: Annotation[]) => InputHighlightData[];
12
- /** Returns a stable string ID for a given annotation, matching the IDs produced by `annotationsToPdfHighlights`. */
13
+ /**
14
+ * Returns a stable string ID for a given annotation, matching the IDs
15
+ * `annotationsToPdfHighlights` produces (it calls this function) and the ones
16
+ * the Office highlight path assigns.
17
+ *
18
+ * Resolved in order:
19
+ * 1. `annotation.index` when the wire supplied one — already unique within the
20
+ * message, and short.
21
+ * 2. Otherwise an id derived from the annotation's own identity: its `cit` tag
22
+ * id plus a digest of its selectors. Two annotations differing in either
23
+ * part get different ids; two agreeing in both describe the same cited
24
+ * region and may share one.
25
+ * 3. Otherwise `fallbackIndex` — the annotation's position in the caller's
26
+ * list, for an annotation carrying neither an index, a `cit` id, nor a
27
+ * recognised selector.
28
+ *
29
+ * The id is opaque: compare it, never parse it. A position-derived id is not
30
+ * unique beyond the list it came from, which is why it is the last resort — a
31
+ * caller gathering one citation group at a time would otherwise give every
32
+ * single-annotation group the same id, and the canvas could not tell two
33
+ * citations of one document apart (issue #8907). Ids are never persisted and
34
+ * never sent over the wire.
35
+ */
13
36
  export declare const annotationHighlightId: (annotation: Annotation, fallbackIndex: number) => string;
14
37
  /**
15
38
  * Returns the first positive integer PDF page in the annotation's body selectors,
@@ -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;AAsG1E;;;;;;GAMG;AACH,eAAO,MAAM,0BAA0B,GACrC,aAAa,UAAU,EAAE,KACxB,kBAAkB,EAoBjB,CAAC;AAEL,oHAAoH;AACpH,eAAO,MAAM,qBAAqB,GAChC,YAAY,UAAU,EACtB,eAAe,MAAM,KACpB,MAAmD,CAAC;AAEvD;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,GAC/B,YAAY,UAAU,KACrB,MAAM,GAAG,SAWX,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"}
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,iB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