@viswa-test/test-citation 0.0.153 → 0.0.154
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/README.md +157 -77
- package/dist/assests/svg/PdfViewerIcons.js +1 -1
- package/dist/cjs/assests/svg/PdfViewerIcons.js +1 -1
- package/dist/cjs/features/ChatDrawer/ChatDrawer.js +1 -1
- package/dist/cjs/features/CognitiveCompare/CognitiveCompare.js +1 -1
- package/dist/cjs/features/CognitiveCompare/components/SectionAccordion.js +1 -1
- package/dist/cjs/features/CognitiveCompare/components/SubSectionAccordion.js +1 -1
- package/dist/cjs/features/CognitiveCompare/hooks/useAccordionState.js +1 -1
- package/dist/cjs/features/CognitiveCompare/hooks/useCompareData.js +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/features/ChatDrawer/ChatDrawer.js +1 -1
- package/dist/features/CognitiveCompare/CognitiveCompare.js +1 -1
- package/dist/features/CognitiveCompare/components/SectionAccordion.js +1 -1
- package/dist/features/CognitiveCompare/components/SubSectionAccordion.js +1 -1
- package/dist/features/CognitiveCompare/hooks/useAccordionState.js +1 -1
- package/dist/features/CognitiveCompare/hooks/useCompareData.js +1 -1
- package/dist/index.js +1 -1
- package/dist/types/src/ChatDrawerTest.d.ts +0 -15
- package/dist/types/src/ChatDrawerTest.d.ts.map +1 -1
- package/dist/types/src/CognitiveCompareTest.d.ts.map +1 -1
- package/dist/types/src/CommonConstants/CommonConstants.d.ts +11546 -0
- package/dist/types/src/CommonConstants/CommonConstants.d.ts.map +1 -1
- package/dist/types/src/assests/svg/PdfViewerIcons.d.ts +1 -0
- package/dist/types/src/assests/svg/PdfViewerIcons.d.ts.map +1 -1
- package/dist/types/src/features/ChatDrawer/ChatDrawer.d.ts.map +1 -1
- package/dist/types/src/features/ChatDrawer/types/ChatDrawer.types.d.ts +0 -3
- package/dist/types/src/features/ChatDrawer/types/ChatDrawer.types.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/CognitiveCompare.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/CognitiveCompareTypes.d.ts +0 -7
- package/dist/types/src/features/CognitiveCompare/CognitiveCompareTypes.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/components/SubSectionAccordion.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/hooks/useAccordionState.d.ts +1 -0
- package/dist/types/src/features/CognitiveCompare/hooks/useAccordionState.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/hooks/useCompareData.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/hooks/useStyles.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -0
- package/dist/types/src/index.d.ts.map +1 -1
- package/package.json +7 -2
package/README.md
CHANGED
|
@@ -1,42 +1,41 @@
|
|
|
1
1
|
# 📚 e-llm-studio/citation
|
|
2
2
|
|
|
3
|
-
|
|
4
3
|
## Table of Contents
|
|
5
4
|
|
|
6
5
|
1. [Project Overview](#project-overview)
|
|
7
6
|
2. [Installation](#installation)
|
|
8
7
|
3. [Available Components](#available-citations)
|
|
9
8
|
- [Citation Components](#citation-components)
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
9
|
+
- [BookCitation](#bookcitation) [<img src="https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" width="18" height="18">](https://github.com/Techolution/e-llm-studio-lib/blob/dev/citation/src/features/BookCitation/README.MD)
|
|
10
|
+
- [ChatCitation](#chatcitation) [<img src="https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" width="18" height="18">](https://github.com/Techolution/e-llm-studio-lib/blob/dev/citation/src/features/ChatCitation/ChatCitationReadme.md)
|
|
11
|
+
- [CitationRenderer](#citationrenderer) [<img src="https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" width="18" height="18">](https://github.com/Techolution/e-llm-studio-lib/blob/dev/citation/src/features/CitationRenderer/CitationRendererReadme.md)
|
|
12
|
+
- [EmailCitation](#emailcitation) [<img src="https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" width="18" height="18">](https://github.com/Techolution/e-llm-studio-lib/blob/dev/citation/src/features/EmailCitation/EmailCitation.md)
|
|
13
|
+
- [CognitiveDecisioningCard](#cognitivedecisioningcard) [<img src="https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" width="18" height="18">](https://github.com/Techolution/e-llm-studio-lib/blob/dev/citation/src/features/CognitiveDecisioning/CognitiveDecisioningReadme.md)
|
|
14
|
+
- [CognitiveCompare](#cognitivecompare) [<img src="https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" width="18" height="18">](https://github.com/Techolution/e-llm-studio-lib/blob/new-compare-ui/citation/src/features/CognitiveCompare/README.md)
|
|
15
|
+
- [CognitiveInternalGPTReasoning](#cognitiveinternalgptreasoning) [<img src="https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" width="18" height="18">](https://github.com/Techolution/e-llm-studio-lib/blob/dev/citation/src/features/CognitiveInternalgptReasoning/README.md)
|
|
16
|
+
- [CodeCitation](#codecitation) [<img src="https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" width="18" height="18">](https://github.com/Techolution/e-llm-studio-lib/blob/dev/citation/src/features/CodeCitation/README.md)
|
|
17
|
+
- [ChatDrawer](#chatdrawer) [<img src="https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" width="18" height="18">](https://github.com/Techolution/e-llm-studio-lib/blob/dev/citation/src/features/ChatDrawer/ChatDrawerReadme.md)
|
|
18
|
+
- [CitationsViewer](#citationsviewer) [<img src="https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" width="18" height="18">](https://github.com/Techolution/e-llm-studio-lib/blob/dev/citation/src/features/CitationViewer/CitationViewerReadme.md)
|
|
19
|
+
- [PdfEditorCitation](#pdfeditorcitation) [<img src="https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" width="18" height="18">](https://github.com/Techolution/e-llm-studio-lib/blob/dev/citation/src/features/PdfEditorCitation/README.md)
|
|
20
|
+
- [RequirementAICitation](#requirementaicitation) [<img src="https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" width="18" height="18">](https://github.com/Techolution/e-llm-studio-lib/blob/dev/citation/src/features/RequirementAiCitations/RequirementAiCitationsReadme.md)
|
|
21
|
+
- [VideoCitationContent](#videocitationcontent) [<img src="https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" width="18" height="18">](https://github.com/Techolution/e-llm-studio-lib/blob/dev/citation/src/features/RequirementAiCitations/RequirementAiCitationsReadme.md)
|
|
22
|
+
- [MarkdownWithImageCitation](#markdownwithimagecitation) [<img src="https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" width="18" height="18">](https://github.com/Techolution/e-llm-studio-lib/blob/dev/citation/src/features/MarkdownWithImageCitation/README.md)
|
|
23
|
+
- [ScannedDocCitation](#scanneddoccitation) [<img src="https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" width="18" height="18">](https://github.com/Techolution/e-llm-studio-lib/blob/dev/citation/src/features/ScannedDocCitation/README.md)
|
|
24
24
|
- [Other Components](#other-components)
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
25
|
+
- [Bookemon](#bookemon) [<img src="https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" width="18" height="18">](https://github.com/Techolution/e-llm-studio-lib/blob/dev/citation/src/features/Bookemon/BookemonReadme.md)
|
|
26
|
+
- [DatagestMon](#datagestmon) [<img src="https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" width="18" height="18">](https://github.com/Techolution/e-llm-studio-lib/blob/dev/citation/src/features/DatagestMon/README.md)
|
|
27
|
+
- [DataSelector](#dataselector)[<img src="https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" width="18" height="18">](https://github.com/Techolution/e-llm-studio-lib/blob/dev/citation/src/features/DataSelector/DataSelectorReadme.md)
|
|
28
|
+
- [PaginatedTable](#paginatedtable) [<img src="https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" width="18" height="18">](https://github.com/Techolution/e-llm-studio-lib/blob/dev/citation/src/features/PaginatedTable/PaginatedTableReadme.md)
|
|
29
|
+
- [PdfViewer](#pdfviewer) [<img src="https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" width="18" height="18">](https://github.com/Techolution/e-llm-studio-lib/blob/dev/citation/src/features/PdfViewer/PdfViewerReadme.md)
|
|
30
|
+
- [ProjectAccordion](#projectaccordion) [<img src="https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" width="18" height="18">](https://github.com/Techolution/e-llm-studio-lib/blob/dev/citation/src/features/ProjectAccordion/README.md)
|
|
31
|
+
- [UploadData](#uploaddata) [<img src="https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" width="18" height="18">](https://github.com/Techolution/e-llm-studio-lib/blob/dev/citation/src/features/UploadData/README.md)
|
|
32
|
+
- [ReviewPanel](#reviewpanel) [<img src="https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" width="18" height="18">](https://github.com/Techolution/e-llm-studio-lib/blob/dev/citation/src/features/ReviewPanel/README.md)
|
|
33
|
+
- [TableCitationContent](#tablecitationcontent) [<img src="https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" width="18" height="18">](https://github.com/Techolution/e-llm-studio-lib/blob/dev/citation/src/features/TableCitation/README.md)
|
|
34
|
+
- [SplitterCitationsComponent](#splittercitationscomponent) [<img src="https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" width="18" height="18">](https://github.com/Techolution/e-llm-studio-lib/blob/dev/citation/src/features/SplitterCitations/README.md)
|
|
35
35
|
4. [Common Use Cases](#common-use-cases)
|
|
36
36
|
5. [Development & Contribution](#development--contribution)
|
|
37
37
|
6. [License](#license)
|
|
38
38
|
|
|
39
|
-
|
|
40
39
|
## Project Overview
|
|
41
40
|
|
|
42
41
|
The @e-llm-studio/citation library is a comprehensive React component library designed to render various types of citations and related UI elements within the e-LLM Studio ecosystem. It provides a robust set of reusable, production-ready components that enable developers to display citations, reasoning chains, code snippets, PDFs, and other content types with rich interactive features and highly customizable styling.
|
|
@@ -136,8 +135,8 @@ pnpm add @e-llm-studio/citation
|
|
|
136
135
|
|
|
137
136
|
---
|
|
138
137
|
|
|
139
|
-
|
|
140
138
|
# Citation Components
|
|
139
|
+
|
|
141
140
|
## BookCitation
|
|
142
141
|
|
|
143
142
|
### Overview
|
|
@@ -190,7 +189,136 @@ import BookCitation from '@e-llm-studio/citation/BookCitation'
|
|
|
190
189
|
| `useDropdown` | `boolean` | Optional flag to render the citation as a dropdown (default: `true`) |
|
|
191
190
|
|
|
192
191
|
---
|
|
192
|
+
---
|
|
193
|
+
|
|
194
|
+
### CognitiveCompare (Main Component)
|
|
195
|
+
|
|
196
|
+
A side-by-side document comparison component with cognitive analysis, deviation badges, citation-linked PDF previews, and two layout modes (Standard and Relative Order). For full documentation see the [dedicated README](https://github.com/Techolution/e-llm-studio-lib/blob/new-compare-ui/citation/src/features/CognitiveCompare/README.md).
|
|
197
|
+
|
|
198
|
+
### Props
|
|
199
|
+
|
|
200
|
+
| Prop | Type | Default | Description |
|
|
201
|
+
| --------------------- | ----------------------------------- | ----------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
202
|
+
| `treeData` | `Record<string, any> \| null` | — | **Required.** Backend tree structure powering both columns. |
|
|
203
|
+
| `displayConfig` | [`IDisplayConfig`](#idisplayconfig) | — | **Required.** Controls header/toggle visibility and initial layout mode. |
|
|
204
|
+
| `componentHeaderText` | `string` | `"Contract Comparison"` | Text shown in the top header bar. |
|
|
205
|
+
| `deviationData` | `Record<string, any>` | `{}` | Per-node deviation analysis results keyed by node ID. Populates the Deviation Analysis tab in the cognitive popup and drives inline text highlights within section content. |
|
|
206
|
+
|
|
207
|
+
---
|
|
208
|
+
|
|
209
|
+
#### IDisplayConfig
|
|
210
|
+
|
|
211
|
+
| Property | Type | Default | Description |
|
|
212
|
+
| ----------------------- | --------- | ------- | ---------------------------------------------------------------------- |
|
|
213
|
+
| `isHeaderVisible` | `boolean` | `true` | Show or hide the top header bar. |
|
|
214
|
+
| `isToggleVisible` | `boolean` | `true` | Show or hide the Standard / Relative Order toggle switch. |
|
|
215
|
+
| `maintainRelativeOrder` | `boolean` | `false` | Initial layout mode — `true` for Relative Order, `false` for Standard. |
|
|
216
|
+
|
|
217
|
+
---
|
|
218
|
+
|
|
219
|
+
### treeData Shape
|
|
193
220
|
|
|
221
|
+
`treeData` is the primary data contract. It must be a flat object where every key is a node ID, plus four reserved keys.
|
|
222
|
+
|
|
223
|
+
```ts
|
|
224
|
+
{
|
|
225
|
+
// Top-level metadata keys
|
|
226
|
+
base_root_id: string, // ID of the root node (looked up inside nodes)
|
|
227
|
+
input_index_map: { // Maps side index to document UUID
|
|
228
|
+
"0": string, // left side UUID
|
|
229
|
+
"1": string, // right side UUID
|
|
230
|
+
},
|
|
231
|
+
documents: { // Document metadata keyed by UUID
|
|
232
|
+
[uuid: string]: {
|
|
233
|
+
title: string,
|
|
234
|
+
signed_url: string, // PDF URL used by CitationAnchor / PdfViewer
|
|
235
|
+
}
|
|
236
|
+
},
|
|
237
|
+
|
|
238
|
+
// All node data lives under the `nodes` key
|
|
239
|
+
nodes: {
|
|
240
|
+
// Root node (identified by base_root_id)
|
|
241
|
+
[rootId: string]: {
|
|
242
|
+
display_node?: boolean,
|
|
243
|
+
comparison_inputs: {
|
|
244
|
+
[uuid: string]: { title: string } // column titles
|
|
245
|
+
},
|
|
246
|
+
decision_scope_description?: string,
|
|
247
|
+
next?: Record<string, string>, // child node IDs
|
|
248
|
+
},
|
|
249
|
+
|
|
250
|
+
// Section nodes
|
|
251
|
+
[nodeId: string]: {
|
|
252
|
+
display_node?: boolean, // set false to hide the node
|
|
253
|
+
evaluation_result?: DeviationDataEntry, // deviation result attached directly to node
|
|
254
|
+
comparison_inputs: {
|
|
255
|
+
[uuid: string]: {
|
|
256
|
+
title: string,
|
|
257
|
+
content: string,
|
|
258
|
+
additional_attributes?: {
|
|
259
|
+
display_index?: number, // used in Relative Order mode for sorting
|
|
260
|
+
display_title?: boolean, // set false to suppress rendering the title
|
|
261
|
+
display_content?: boolean, // set false to suppress rendering the content
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
},
|
|
265
|
+
next?: Record<string, string>, // child node IDs (for subsections)
|
|
266
|
+
mapping_rationale?: {
|
|
267
|
+
decision_strength?: string, // numeric string, e.g. "72"
|
|
268
|
+
decisioning_factors?: string[],
|
|
269
|
+
gaps_in_decision?: string[],
|
|
270
|
+
citations?: Record<string, Record<string, CitationEntry>>
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
> All node data (root and section nodes) lives under the `nodes` key. The top-level `base_root_id`, `input_index_map`, and `documents` keys remain directly on `treeData`.
|
|
278
|
+
|
|
279
|
+
#### deviationData Shape
|
|
280
|
+
|
|
281
|
+
```ts
|
|
282
|
+
// deviationData[nodeId]
|
|
283
|
+
{
|
|
284
|
+
evaluation_outputs?: {
|
|
285
|
+
output_value?: string, // badge label text
|
|
286
|
+
metadata?: { label_color?: string } // hex — drives badge/highlight colors
|
|
287
|
+
},
|
|
288
|
+
cognitive_decisioning?: {
|
|
289
|
+
decisioning_factors?: string[],
|
|
290
|
+
gaps_in_decision?: string[],
|
|
291
|
+
citations?: Record<string, any>,
|
|
292
|
+
decision_strength?: string | null,
|
|
293
|
+
},
|
|
294
|
+
deviations?: Record<string, any>, // { devKey: { [docUuid]: highlightText } }
|
|
295
|
+
}
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
#### Usage
|
|
299
|
+
|
|
300
|
+
```tsx
|
|
301
|
+
import CognitiveCompare from "@e-llm-studio/citation/CognitiveCompare";
|
|
302
|
+
|
|
303
|
+
<CognitiveCompare
|
|
304
|
+
treeData={myTreeData}
|
|
305
|
+
displayConfig={{
|
|
306
|
+
isHeaderVisible: true,
|
|
307
|
+
isToggleVisible: true,
|
|
308
|
+
maintainRelativeOrder: false,
|
|
309
|
+
}}
|
|
310
|
+
deviationData={myDeviationData}
|
|
311
|
+
/>;
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
#### Key Behaviours
|
|
315
|
+
|
|
316
|
+
- Badge and highlight colors are generated dynamically from `evaluation_outputs.metadata.label_color` via `generateColorPalette()`. The static `relationStyles` map has been removed.
|
|
317
|
+
- Clicking a badge in **Standard mode** opens `CognitivePopup` directly. In **Relative Order mode** it opens `MoreFunctionsPopup` offering Connect, Side by Side, and Cognitive Decisioning actions.
|
|
318
|
+
- The **Deviation Analysis** tab is shown first in the popup and displays `cognitive_decisioning.decisioning_factors` and `gaps_in_decision` with inline citation anchors that open split PDF viewers.
|
|
319
|
+
- `deviations` entries drive inline `<mark>` highlights inside section content, colored using the same `label_color`-derived palette.
|
|
320
|
+
|
|
321
|
+
---
|
|
194
322
|
|
|
195
323
|
## ChatCitation
|
|
196
324
|
|
|
@@ -287,55 +415,6 @@ const [drawerHeight, setDrawerHeight] = useState(300);
|
|
|
287
415
|
</ChatDrawer>
|
|
288
416
|
```
|
|
289
417
|
|
|
290
|
-
|
|
291
|
-
### With drawer summary
|
|
292
|
-
```tsx
|
|
293
|
-
<ChatDrawer
|
|
294
|
-
uploadListTopContent="Custom Notch"
|
|
295
|
-
isExpanded={isOpen}
|
|
296
|
-
onToggle={() => setIsOpen(v => !v)}
|
|
297
|
-
styles={{
|
|
298
|
-
notch: { backgroundColor: '#6d28d9', border: '1px solid #5b21b6' },
|
|
299
|
-
notchArrowColor: '#fff',
|
|
300
|
-
}}
|
|
301
|
-
drawerSummaryComponent={<RedliningFixesSummaryUI approved={5} rejected={2} pending={3} />}
|
|
302
|
-
>
|
|
303
|
-
<YourComponent />
|
|
304
|
-
</ChatDrawer>
|
|
305
|
-
```
|
|
306
|
-
|
|
307
|
-
### With drawer countBadge
|
|
308
|
-
```tsx
|
|
309
|
-
<ChatDrawer
|
|
310
|
-
uploadListTopContent="Custom Notch"
|
|
311
|
-
isExpanded={isOpen}
|
|
312
|
-
onToggle={() => setIsOpen(v => !v)}
|
|
313
|
-
styles={{
|
|
314
|
-
notch: { backgroundColor: '#6d28d9', border: '1px solid #5b21b6' },
|
|
315
|
-
notchArrowColor: '#fff',
|
|
316
|
-
}}
|
|
317
|
-
totalCountsBadge={<TotalCountsBadge totalDeviations={10} resolvedDeviations={7} />}
|
|
318
|
-
>
|
|
319
|
-
<YourComponent />
|
|
320
|
-
</ChatDrawer>
|
|
321
|
-
```
|
|
322
|
-
|
|
323
|
-
### With drawer header component prop
|
|
324
|
-
```tsx
|
|
325
|
-
<ChatDrawer
|
|
326
|
-
uploadListTopContent="Custom Notch"
|
|
327
|
-
isExpanded={isOpen}
|
|
328
|
-
onToggle={() => setIsOpen(v => !v)}
|
|
329
|
-
styles={{
|
|
330
|
-
notch: { backgroundColor: '#6d28d9', border: '1px solid #5b21b6' },
|
|
331
|
-
notchArrowColor: '#fff',
|
|
332
|
-
}}
|
|
333
|
-
headerComponent={<AutopilotIndicator />}
|
|
334
|
-
>
|
|
335
|
-
<YourComponent />
|
|
336
|
-
</ChatDrawer>
|
|
337
|
-
```
|
|
338
|
-
|
|
339
418
|
**With styles (theme customization):**
|
|
340
419
|
```tsx
|
|
341
420
|
<ChatDrawer
|
|
@@ -975,6 +1054,7 @@ This visual captures a clean product collaboration workspace prepared for planni
|
|
|
975
1054
|
```
|
|
976
1055
|
|
|
977
1056
|
**With CitationRenderer (Expandable Pill):**
|
|
1057
|
+
|
|
978
1058
|
```tsx
|
|
979
1059
|
import { CitationRenderer } from '@e-llm-studio/citation/CitationRenderer'
|
|
980
1060
|
import { MarkdownWithImageCitation } from '@e-llm-studio/citation/MarkdownWithImageCitation'
|
|
@@ -2312,4 +2392,4 @@ npm install @e-llm-studio/citation@latest
|
|
|
2312
2392
|
|
|
2313
2393
|
This library is released under the MIT License. See the LICENSE file for more details.
|
|
2314
2394
|
|
|
2315
|
-
The license information is also available in the `citation/package.json` file under the 'license' field.
|
|
2395
|
+
The license information is also available in the `citation/package.json` file under the 'license' field.
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as e}from"tslib";import{jsx as n,jsxs as i}from"react/jsx-runtime";var t=function(){return n("svg",e({xmlns:"http://www.w3.org/2000/svg",style:{width:"12px",height:"15px"},viewBox:"0 0 14 17",fill:"none"},{children:n("path",{d:"M8.25 0.952148V4.05005C8.25 4.47009 8.25 4.68011 8.33175 4.84055C8.40365 4.98167 8.51839 5.0964 8.65951 5.16831C8.81994 5.25005 9.02996 5.25005 9.45 5.25005H12.5479M9.75 9H3.75M9.75 12H3.75M5.25 6H3.75M8.25 0.75H4.35C3.08988 0.75 2.45982 0.75 1.97852 0.995235C1.55516 1.21095 1.21095 1.55516 0.995235 1.97852C0.75 2.45982 0.75 3.08988 0.75 4.35V12.15C0.75 13.4101 0.75 14.0402 0.995235 14.5215C1.21095 14.9448 1.55516 15.289 1.97852 15.5048C2.45982 15.75 3.08988 15.75 4.35 15.75H9.15C10.4101 15.75 11.0402 15.75 11.5215 15.5048C11.9448 15.289 12.289 14.9448 12.5048 14.5215C12.75 14.0402 12.75 13.4101 12.75 12.15V5.25L8.25 0.75Z",stroke:"#0019FF",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}))},o=function(){return n("svg",e({width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"#475467",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},{children:n("path",{d:"M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3"})}))},r=function(){return i("svg",e({width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"#475467",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},{children:[n("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),n("polyline",{points:"7 10 12 15 17 10"}),n("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]}))},h=function(){return i("svg",e({width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:"#475467",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},{children:[n("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}))};export{h as DefaultCloseIcon,r as DefaultDownloadIcon,o as DefaultFullScreenIcon,t as DefaultPdfIcon};
|
|
1
|
+
import{__assign as e}from"tslib";import{jsx as n,jsxs as i}from"react/jsx-runtime";var t=function(){return n("svg",e({xmlns:"http://www.w3.org/2000/svg",style:{width:"12px",height:"15px"},viewBox:"0 0 14 17",fill:"none"},{children:n("path",{d:"M8.25 0.952148V4.05005C8.25 4.47009 8.25 4.68011 8.33175 4.84055C8.40365 4.98167 8.51839 5.0964 8.65951 5.16831C8.81994 5.25005 9.02996 5.25005 9.45 5.25005H12.5479M9.75 9H3.75M9.75 12H3.75M5.25 6H3.75M8.25 0.75H4.35C3.08988 0.75 2.45982 0.75 1.97852 0.995235C1.55516 1.21095 1.21095 1.55516 0.995235 1.97852C0.75 2.45982 0.75 3.08988 0.75 4.35V12.15C0.75 13.4101 0.75 14.0402 0.995235 14.5215C1.21095 14.9448 1.55516 15.289 1.97852 15.5048C2.45982 15.75 3.08988 15.75 4.35 15.75H9.15C10.4101 15.75 11.0402 15.75 11.5215 15.5048C11.9448 15.289 12.289 14.9448 12.5048 14.5215C12.75 14.0402 12.75 13.4101 12.75 12.15V5.25L8.25 0.75Z",stroke:"#0019FF",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}))},o=function(){return n("svg",e({width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"#475467",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},{children:n("path",{d:"M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3"})}))},r=function(){return i("svg",e({width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"#475467",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},{children:[n("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),n("polyline",{points:"7 10 12 15 17 10"}),n("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]}))},h=function(){return i("svg",e({width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:"#475467",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},{children:[n("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}))},s=function(){return n("svg",e({width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"#475467",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},{children:n("path",{d:"M8 3v3a2 2 0 0 1-2 2H3m18 0h-3a2 2 0 0 1-2-2V3m0 18v-3a2 2 0 0 1 2-2h3M3 16h3a2 2 0 0 1 2 2v3"})}))};export{h as DefaultCloseIcon,r as DefaultDownloadIcon,s as DefaultFullScreenCloseIcon,o as DefaultFullScreenIcon,t as DefaultPdfIcon};
|
|
2
2
|
//# sourceMappingURL=PdfViewerIcons.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime");exports.DefaultCloseIcon=function(){return n.jsxs("svg",e.__assign({width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:"#475467",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},{children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}))},exports.DefaultDownloadIcon=function(){return n.jsxs("svg",e.__assign({width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"#475467",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},{children:[n.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),n.jsx("polyline",{points:"7 10 12 15 17 10"}),n.jsx("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]}))},exports.DefaultFullScreenIcon=function(){return n.jsx("svg",e.__assign({width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"#475467",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},{children:n.jsx("path",{d:"M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3"})}))},exports.DefaultPdfIcon=function(){return n.jsx("svg",e.__assign({xmlns:"http://www.w3.org/2000/svg",style:{width:"12px",height:"15px"},viewBox:"0 0 14 17",fill:"none"},{children:n.jsx("path",{d:"M8.25 0.952148V4.05005C8.25 4.47009 8.25 4.68011 8.33175 4.84055C8.40365 4.98167 8.51839 5.0964 8.65951 5.16831C8.81994 5.25005 9.02996 5.25005 9.45 5.25005H12.5479M9.75 9H3.75M9.75 12H3.75M5.25 6H3.75M8.25 0.75H4.35C3.08988 0.75 2.45982 0.75 1.97852 0.995235C1.55516 1.21095 1.21095 1.55516 0.995235 1.97852C0.75 2.45982 0.75 3.08988 0.75 4.35V12.15C0.75 13.4101 0.75 14.0402 0.995235 14.5215C1.21095 14.9448 1.55516 15.289 1.97852 15.5048C2.45982 15.75 3.08988 15.75 4.35 15.75H9.15C10.4101 15.75 11.0402 15.75 11.5215 15.5048C11.9448 15.289 12.289 14.9448 12.5048 14.5215C12.75 14.0402 12.75 13.4101 12.75 12.15V5.25L8.25 0.75Z",stroke:"#0019FF",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}))};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime");exports.DefaultCloseIcon=function(){return n.jsxs("svg",e.__assign({width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:"#475467",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},{children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}))},exports.DefaultDownloadIcon=function(){return n.jsxs("svg",e.__assign({width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"#475467",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},{children:[n.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),n.jsx("polyline",{points:"7 10 12 15 17 10"}),n.jsx("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]}))},exports.DefaultFullScreenCloseIcon=function(){return n.jsx("svg",e.__assign({width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"#475467",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},{children:n.jsx("path",{d:"M8 3v3a2 2 0 0 1-2 2H3m18 0h-3a2 2 0 0 1-2-2V3m0 18v-3a2 2 0 0 1 2-2h3M3 16h3a2 2 0 0 1 2 2v3"})}))},exports.DefaultFullScreenIcon=function(){return n.jsx("svg",e.__assign({width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"#475467",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},{children:n.jsx("path",{d:"M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3"})}))},exports.DefaultPdfIcon=function(){return n.jsx("svg",e.__assign({xmlns:"http://www.w3.org/2000/svg",style:{width:"12px",height:"15px"},viewBox:"0 0 14 17",fill:"none"},{children:n.jsx("path",{d:"M8.25 0.952148V4.05005C8.25 4.47009 8.25 4.68011 8.33175 4.84055C8.40365 4.98167 8.51839 5.0964 8.65951 5.16831C8.81994 5.25005 9.02996 5.25005 9.45 5.25005H12.5479M9.75 9H3.75M9.75 12H3.75M5.25 6H3.75M8.25 0.75H4.35C3.08988 0.75 2.45982 0.75 1.97852 0.995235C1.55516 1.21095 1.21095 1.55516 0.995235 1.97852C0.75 2.45982 0.75 3.08988 0.75 4.35V12.15C0.75 13.4101 0.75 14.0402 0.995235 14.5215C1.21095 14.9448 1.55516 15.289 1.97852 15.5048C2.45982 15.75 3.08988 15.75 4.35 15.75H9.15C10.4101 15.75 11.0402 15.75 11.5215 15.5048C11.9448 15.289 12.289 14.9448 12.5048 14.5215C12.75 14.0402 12.75 13.4101 12.75 12.15V5.25L8.25 0.75Z",stroke:"#0019FF",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}))};
|
|
2
2
|
//# sourceMappingURL=PdfViewerIcons.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("react/jsx-runtime"),n=require("react"),i=require("lucide-react");exports.default=function(o){var r,s,a=o.children,l=o.uploadListTopContent,d=o.defaultHeight,u=void 0===d?300:d,c=o.minHeight,p=void 0===c?150:c,g=o.maxHeight,f=o.isExpanded,x=void 0!==f&&f,h=o.onToggle,
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("react/jsx-runtime"),n=require("react"),i=require("lucide-react");exports.default=function(o){var r,s,a=o.children,l=o.uploadListTopContent,d=o.defaultHeight,u=void 0===d?300:d,c=o.minHeight,p=void 0===c?150:c,g=o.maxHeight,f=o.isExpanded,x=void 0!==f&&f,h=o.onToggle,v=o.onHeightChange,m=o.styles,_=void 0===m?{}:m,y=n.useState(!1),b=y[0],w=y[1],j=n.useState(u),C=j[0],H=j[1],R=n.useRef(0),S=n.useRef(u),E=n.useRef(null),k=n.useRef(0),D="string"==typeof g?parseFloat(g)/100*window.innerHeight:null!=g?g:.4*window.innerHeight;n.useEffect(function(){!x&&E.current&&(k.current=E.current.getBoundingClientRect().height)},[x]);return n.useEffect(function(){if(b){var e=function(e){e.preventDefault();var t=e.clientY-R.current,n=Math.max(p,Math.min(D,S.current+t));H(n),null==v||v(n)},t=function(){w(!1),document.body.style.userSelect=""};return document.addEventListener("mousemove",e),document.addEventListener("mouseup",t),function(){document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",t)}}},[b]),t.jsxs("div",e.__assign({ref:E,style:{position:"relative",width:"100%",minHeight:x?k.current:"auto"}},{children:[t.jsxs("div",e.__assign({style:e.__assign({position:x?"absolute":"relative",zIndex:x?10:"auto",left:0,right:0,top:0,display:"flex",flexDirection:"column",backgroundColor:"#fff",borderRadius:20,border:"1px solid #BDB4FE",boxShadow:"0 4px 8px -2px rgba(16, 24, 40, 0.05), 0 2px 4px -2px rgba(16, 24, 40, 0.06)",height:x?"".concat(C,"px"):"auto",minHeight:x?"".concat(p,"px"):"auto",maxHeight:x?"".concat(C,"px"):"auto",overflow:"hidden",width:"100%"},_.container)},{children:[t.jsx("div",e.__assign({style:e.__assign({display:"flex",alignItems:"center",width:"100%",marginBottom:12,flexShrink:0,padding:"12px 20px 0 20px"},_.header)},{children:t.jsx("span",e.__assign({style:e.__assign({display:"inline-block",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontSize:16,fontWeight:500,lineHeight:"24px",color:"#101828",fontFamily:"Inter, sans-serif"},_.title)},{children:(null==l?void 0:l.trim())?l:"Data uploaded for your context"}))})),x&&t.jsx("div",e.__assign({style:e.__assign({flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,padding:"0 20px"},_.body)},{children:a})),x&&t.jsx("div",e.__assign({onMouseDown:function(e){e.preventDefault(),w(!0),R.current=e.clientY,S.current=C,document.body.style.userSelect="none"},style:{display:"flex",justifyContent:"center",alignItems:"center",padding:"8px 20px",cursor:"ns-resize",userSelect:"none",flexShrink:0}},{children:t.jsx("div",{style:e.__assign({width:48,height:4,borderRadius:4,background:b?null!==(r=_.dragPillActiveColor)&&void 0!==r?r:"#a78bfa":"#d1d5db"},_.dragPill)})}))]})),t.jsx("div",e.__assign({style:{position:x?"absolute":"relative",top:x?"".concat(C,"px"):"auto",width:"100%",display:"flex",justifyContent:"center",height:18,zIndex:x?10:"auto"}},{children:t.jsx("button",e.__assign({onClick:h,"aria-label":x?"Collapse":"Expand",style:e.__assign({position:"absolute",width:"52px",height:"18px",borderBottomLeftRadius:"10px",borderBottomRightRadius:"10px",border:"1px solid rgb(189, 180, 254)",borderTop:"none",backgroundColor:"#fff",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",padding:0},_.notch)},{children:t.jsx(i.ChevronDown,{size:14,color:null!==(s=_.notchArrowColor)&&void 0!==s?s:"#6d28d9",style:{transform:x?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s ease"}})}))}))]}))};
|
|
2
2
|
//# sourceMappingURL=ChatDrawer.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),i=require("react"),t=require("@mui/material"),o=require("lucide-react"),r=require("../../assests/svg/ButtonCognitiveIcon.js"),l=require("./OverlayComponent.js"),s=require("./CognitiveComparehelpers.js"),u=require("./CognitiveCompareConfig.js"),a=require("./CognitiveCompareConstants.js"),c=require("./CognitivePopup.js"),d=require("./MoreFunctionsPopup.js"),v=require("./LoaderComponent.js"),f=require("./components/ThreeDotsLoader.js"),p=require("./hooks/useCompareData.js"),g=require("./hooks/useComparePopups.js"),h=require("./hooks/useSectionRefs.js"),m=require("./hooks/useAccordionState.js"),S=require("./hooks/useDeviationNavigation.js"),R=require("./components/CompareHeader.js"),x=require("./components/SubSectionAccordion.js"),_=require("./components/LHSSectionRow.js"),y=require("./components/RHSSectionRow.js"),b=require("./components/CognitiveSummaryPopup.js"),C=require("./CompareContext.js"),E=require("./hooks/useStyles.js"),A=require("./hooks/useResizeHandler.js"),B=require("./hooks/useLinesCalculator.js"),T=require("./hooks/useSideBySide.js"),w=require("./components/SvgConnectors.js");exports.SHARED_MARKDOWN_STYLES=u.SHARED_MARKDOWN_STYLES,exports.default=function(I){var D,O,F,j,P,N,k,L,q,M,H,V,z,G,W,K,U,Y,X,$,J,Q,Z,ee,ne,ie,te,oe,re,le,se,ue,ae,ce,de=I.componentHeaderText,ve=void 0===de?a.DEFAULT_COMPONENT_HEADER_TEXT:de,fe=I.treeData,pe=I.comparisonConfig,ge=I.leftColumnTitleText,he=I.rightColumnTitleText,me=I.markdownStyles,Se=I.resetTrigger,Re=I.displayConfig,xe=void 0===Re?{isHeaderVisible:!0,isToggleVisible:!0,maintainRelativeOrder:!1,isLoading:!0,showDeviationBadges:!1,enableDeviationSchemaBackwardCompatibility:!1,displayEmailNotifier:!0,expandAllSections:!1,expandLevels:1}:Re,_e=I.popupConfig,ye=I.deviationData,be=void 0===ye?{}:ye,Ce=I.deviationNodeIdToView,Ee=I.resetDeviationNodeId,Ae=I.isProposingFix,Be=void 0!==Ae&&Ae,Te=I.proposingFixNodeId,we=I.isRedlineFlow,Ie=i.useState(xe.maintainRelativeOrder),De=Ie[0],Oe=Ie[1],Fe=!!(null==xe?void 0:xe.expandAllSections),je=!!De||!!(null==xe?void 0:xe.showDeviationBadges),Pe=i.useState(!1),Ne=Pe[0],ke=Pe[1],Le=i.useState(null),qe=Le[0],Me=Le[1],He=i.useState(null===(O=null!==(D=null==fe?void 0:fe.newEvaluationResult)&&void 0!==D?D:null==xe?void 0:xe.enableDeviationSchemaBackwardCompatibility)||void 0===O||O)[0],Ve=null==xe?void 0:xe.expandLevels,ze=i.useState(new Set),Ge=ze[0],We=ze[1],Ke=i.useState([]),Ue=Ke[0],Ye=Ke[1],Xe=i.useRef(null),$e=i.useRef(null),Je=i.useRef(null),Qe=i.useRef(null),Ze=i.useRef(null),en=i.useRef(!1),nn=i.useRef(null),tn=i.useRef({}),on=i.useRef([]),rn=i.useRef(function(){}),ln=i.useRef(null),sn=i.useRef(function(){}),un=i.useMemo(function(){return(null==fe?void 0:fe.cognitive_decisioning)||{}},[fe]),an=i.useMemo(function(){return e.__assign(e.__assign({},u.SHARED_MARKDOWN_STYLES),me)},[me]),cn=i.useRef(null),dn=i.useRef(null),vn=i.useRef(null),fn=i.useRef(null),pn=i.useRef(null),gn=i.useRef(null),hn=i.useRef(null),mn=i.useRef(null),Sn=i.useRef(null),Rn=i.useRef(null),xn=g.useComparePopups(cn),_n=xn.cognitivePopup,yn=xn.setCognitivePopup,bn=xn.moreFunctions,Cn=xn.setMoreFunctions,En=xn.position,An=xn.setPosition,Bn=xn.activeBadgeId,Tn=xn.summaryPopup,wn=xn.setSummaryPopup,In=xn.closeSummaryPopup,Dn=xn.setActiveBadgeId,On=xn.popupRef,Fn=xn.handleOpenCognitiveCompare,jn=xn.openCognitivePopupFromState,Pn=xn.closeCognitivePopup,Nn=xn.closeMoreFunctionsPopup,kn=i.useMemo(function(){var e,n,i,t,o,r,l;return{fields:null!==(e=null==pe?void 0:pe.fields)&&void 0!==e?e:u.DEFAULT_FIELD_CONFIG,thresholds:{high:null!==(i=null===(n=null==pe?void 0:pe.thresholds)||void 0===n?void 0:n.high)&&void 0!==i?i:u.DEFAULT_COMPARISON_CONFIG.thresholds.high,medium:null!==(o=null===(t=null==pe?void 0:pe.thresholds)||void 0===t?void 0:t.medium)&&void 0!==o?o:u.DEFAULT_COMPARISON_CONFIG.thresholds.medium,exact:null!==(l=null===(r=null==pe?void 0:pe.thresholds)||void 0===r?void 0:r.exact)&&void 0!==l?l:u.DEFAULT_COMPARISON_CONFIG.thresholds.exact}}},[pe]),Ln=i.useState(null),qn=Ln[0];Ln[1];var Mn=null===(P=null===(F=null==fe?void 0:fe.documents)||void 0===F?void 0:F[null===(j=null==fe?void 0:fe.input_index_map)||void 0===j?void 0:j[0]])||void 0===P?void 0:P.title,Hn=null===(L=null===(N=null==fe?void 0:fe.documents)||void 0===N?void 0:N[null===(k=null==fe?void 0:fe.input_index_map)||void 0===k?void 0:k[1]])||void 0===L?void 0:L.title,Vn=s.safeStringify(ge||Mn||"Uploaded Contract"),zn=null===(V=null===(H=null===(q=null==fe?void 0:fe.documents)||void 0===q?void 0:q[null===(M=null==fe?void 0:fe.input_index_map)||void 0===M?void 0:M[0]])||void 0===H?void 0:H.metadata)||void 0===V?void 0:V.file_name,Gn=s.safeStringify(zn),Wn=null===(K=null===(W=null===(z=null==fe?void 0:fe.documents)||void 0===z?void 0:z[null===(G=null==fe?void 0:fe.input_index_map)||void 0===G?void 0:G[1]])||void 0===W?void 0:W.metadata)||void 0===K?void 0:K.file_name,Kn=s.safeStringify(Wn),Un=s.safeStringify(he||Hn||"Reference Template"),Yn=p.useCognitiveTreeData(fe,De,be,kn,He),Xn=Yn.activeProposed,$n=Yn.existingRule,Jn=Yn.proposedSections,Qn=Yn.existingSections,Zn=Yn.visibleFields,ei=Yn.parentDeviationRecord,ni=Yn.deviationNumberRegistry,ii=Yn.parseError;i.useEffect(function(){ii&&Me("Failed to load comparison: ".concat(ii))},[ii]);var ti=Jn.length>0||Qn.length>0,oi=i.useMemo(function(){if(!we)return"off";var e=0,n=0,i=function(t){Array.isArray(t)&&t.forEach(function(t){var o,r=(null==t?void 0:t.content)||"";s.hasMeaningfulRedlineTags(r)&&(e+=1,n+=String(r).length),(null===(o=null==t?void 0:t.subsections)||void 0===o?void 0:o.length)&&i(t.subsections)})};return i(Jn),i(Qn),"".concat(e,":").concat(n)},[we,Jn,Qn]),ri=h.useSectionRefs(Zn.map(function(e){return e.key}),Math.max(Jn.length,Qn.length)),li=ri.leftRefs,si=ri.rightRefs,ui=ri.sectionLeftRefs,ai=ri.sectionRightRefs,ci=ri.lhsBadgeRefs,di=ri.rhsBadgeRefs,vi=ri.sectionRightRowRefs,fi=ri.subSectionLeftRefs,pi=ri.subSectionRightRefs,gi=ri.sectionRowRefs,hi=ri.getSectionRowRef,mi=ri.getSubSectionRef,Si=ri.getBadgeRef,Ri=T.useSideBySide({maintainRelativeOrder:De,proposedSections:Jn,existingSections:Qn,leftContainerRef:mn,rightContainerRef:vn,scrollContainerRef:cn,sectionLeftRefs:ui,sectionRightRefs:ai,subSectionLeftRefs:fi,subSectionRightRefs:pi,lhsBadgeRefs:ci,rhsBadgeRefs:di,sectionRowRefs:gi,sectionRightRowRefs:vi,rhsTopSpacerRef:fn,rhsBottomSpacerRef:pn,lhsTopSpacerRef:gn,lhsBottomSpacerRef:hn,calculateLinesRef:rn,setConnectedSections:We,setConnectedLines:Ye,cachedConnectedPositions:on,closeMoreFunctionsPopup:Nn,setErrorToast:Me,moreFunctions:bn,closeSummaryPopup:In}),xi=Ri.isSideBySide,_i=Ri.isArrowVisible,yi=Ri.setIsArrowVisible,bi=Ri.isResizing,Ci=Ri.setIsResizing,Ei=Ri.isSideBySideLoading,Ai=Ri.activeSideBySideSection,Bi=Ri.scrollLock,Ti=Ri.sideBySideCacheRef,wi=Ri.isSideBySideRef,Ii=Ri.activeSideBySideRightSectionRef,Di=Ri.activeSideBySideSectionRef,Oi=Ri.sideBySideLineRef,Fi=Ri.highlightedClauseRefs,ji=Ri.clearClauseHighlight,Pi=Ri.applyAlignmentPadding,Ni=Ri.resetSideBySide,ki=Ri.activateSideBySide,Li=m.useAccordionState({maintainRelativeOrder:!!De,proposedSections:Jn,existingSections:Qn,activeSideBySideSection:Ai,connectedSections:Ge,resetSideBySide:Ni,setConnectedSections:We,setConnectedLines:Ye,cachedConnectedPositions:on,svgContainerRef:Xe,isAnimatingRef:en,animationTimerRef:nn,calculateLinesRef:rn,sectionLeftRefs:ui,sectionRightRefs:ai,subSectionLeftRefs:fi,subSectionRightRefs:pi}),qi=Li.expandedSections,Mi=Li.setExpandedSections,Hi=Li.expandedSubSections,Vi=Li.setExpandedSubSections,zi=Li.handleSubSectionToggle,Gi=Li.toggleSection;i.useEffect(function(){var e=void 0!==Ve?Ve:Fe?1/0:0;if(0!==e){var n={},i=Math.max(Jn.length,Qn.length);if(e>=1)for(var t=0;t<i;t+=1)De?(t<Jn.length&&(n["left-".concat(t)]=!0),t<Qn.length&&(n["right-".concat(t)]=!0)):n[String(t)]=!0;var o={},r=function(n,i,t){var l;!(null===(l=null==n?void 0:n.subsections)||void 0===l?void 0:l.length)||t>e||n.subsections.forEach(function(e,n){var l="".concat(i,"-").concat(n);o[l]=!0,r(e,l,t+1)})};e>=2&&(Jn.forEach(function(e,n){return r(e,String(n),2)}),Qn.forEach(function(e,n){return r(e,String(n),2)})),Mi(n),Vi(o)}},[Fe,Ve,De,Jn,Qn,Mi,Vi]),i.useEffect(function(){we&&"off"!==oi&&"0:0"!==oi&&(Ti.current=null,on.current=[],requestAnimationFrame(function(){var e;null===(e=rn.current)||void 0===e||e.call(rn)}))},[we,oi]);var Wi=i.useMemo(function(){var e=new Map,n=new Map,i=1;if(De)Jn.forEach(function(n){!n.title&&!n.content||n.id&&e.set(n.id,i++)}),Qn.forEach(function(t){if(t.id){var o=Jn.filter(function(e){var n;return null===(n=e.refIndexes)||void 0===n?void 0:n.includes(t.selfIndex)});if(o.length>0){var r=o.map(function(n){return e.get(n.id)}).filter(Boolean);n.set(t.id,r.join(", "))}else n.set(t.id,String(i++))}});else for(var t=Math.max(Jn.length,Qn.length),o=0;o<t;o++){var r=Jn[o],l=Qn[o];r?(e.set(r.id,i),l&&n.set(l.id,String(i)),i++):l&&n.set(l.id,String(i++))}return{leftNums:e,rightNums:n}},[Jn,Qn,De]),Ki=$n.analysis,Ui=s.safeStringify(null===(Y=null===(U=null==Ki?void 0:Ki.rule_difference_comparison)||void 0===U?void 0:U.summary)||void 0===Y?void 0:Y.overall_summary),Yi=!!Ui.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),Xi=null!==(X=null==fe?void 0:fe.base_root_id)&&void 0!==X?X:"-1";null==fe||fe[Xi];var $i=He?null!==(se=null!==(oe=be&&(null===(te=null==be?void 0:be[Xi])||void 0===te?void 0:te.evaluation_result))&&void 0!==oe?oe:null===(le=null===(re=null==fe?void 0:fe.nodes)||void 0===re?void 0:re[Xi])||void 0===le?void 0:le.evaluation_result)&&void 0!==se?se:null:null!==(ie=null!==(Q=be&&(null===(J=null===($=null==be?void 0:be[Xi])||void 0===$?void 0:$.evaluation_result)||void 0===J?void 0:J[0]))&&void 0!==Q?Q:null===(ne=null===(ee=null===(Z=null==fe?void 0:fe.nodes)||void 0===Z?void 0:Z[Xi])||void 0===ee?void 0:ee.evaluation_result)||void 0===ne?void 0:ne[0])&&void 0!==ie?ie:null,Ji=s.extractDeviationScore($i),Qi=s.generateColorPalette(null!==(ce=null===(ae=null===(ue=null==$i?void 0:$i.evaluation_outputs)||void 0===ue?void 0:ue.metadata)||void 0===ae?void 0:ae.label_color)&&void 0!==ce?ce:a.DEFAULT_DEVIAION_COLOR),Zi=i.useMemo(function(){return(null==xe?void 0:xe.badgeStyleOverride)?xe.badgeStyleOverride(Ji):null},[null==xe?void 0:xe.badgeStyleOverride,Ji]),et=i.useMemo(function(){return Zi?e.__assign(e.__assign({},Qi),{badgeBg:Zi.bg,badgeText:Zi.text,badgeBorder:Zi.border}):Qi},[Qi,Zi]),nt=i.useCallback(function(){ji(),Ni(),We(new Set),Ye([]),on.current=[],ht([]),St(null),wn(a.EMPTY_SUMMARY_POPUP_STATE),Pn(),requestAnimationFrame(function(){var e;null===(e=rn.current)||void 0===e||e.call(rn)})},[]),it=i.useRef(nt);i.useEffect(function(){it.current=nt},[nt]),i.useEffect(function(){Se&&it.current()},[Se]);var tt=i.useCallback(function(n,i,t,o,r,l,u){var a,c,d,v=s.safeStringify(null==i?void 0:i.id)||s.safeStringify(null==t?void 0:t.id)||"",f=(v?un[v]:null)||(null==i?void 0:i.cognitiveData)||(null==t?void 0:t.cognitiveData)||{section_id:v,decisioning:[],gap:[],relevance_score:0},p=null!==(c=null===(a=gi.current[o])||void 0===a?void 0:a.current)&&void 0!==c?c:null;return{isLoading:null!==(d=null==xe?void 0:xe.isLoading)&&void 0!==d&&d,open:!0,sectionTitle:(null==i?void 0:i.title)?null==i?void 0:i.title:"No Counterpart",refSectionTitle:(null==t?void 0:t.title)?null==t?void 0:t.title:"No Counterpart",cognitiveData:f,anchorEl:n,sectionAnchorEl:p,badgeStyle:l||null,sectionIdx:o,docData:{documents:null==fe?void 0:fe.documents,input_index_map:null==fe?void 0:fe.input_index_map},deviationData:function(){var n,r,l=(null==i?void 0:i.evaluationResult)||(null==t?void 0:t.evaluationResult)||null,u=function(n){var i=function(e){if(!e||"object"!=typeof e)return null;var n=null==e?void 0:e.deviation_entries;if(n&&"object"==typeof n){var i=Object.keys(n).sort(function(e,n){return Number(e)-Number(n)})[0];if(i&&n[i])return n[i]}var t=Object.keys(e).filter(function(e){return/^\d+$/.test(e)}).sort(function(e,n){return Number(e)-Number(n)});if(t.length&&e[t[0]])return e[t[0]];var o=null==e?void 0:e.deviations;if(o&&"object"==typeof o){var r=Object.keys(o).sort(function(e,n){return Number(e)-Number(n)})[0];if(r&&o[r])return o[r]}return null}(n);return i?e.__assign(e.__assign({},n),{deviation_summary:(null==n?void 0:n.deviation_summary)||(null==i?void 0:i.deviation_summary),deviation_title:(null==n?void 0:n.deviation_title)||(null==i?void 0:i.deviation_title),deviation_impact:(null==n?void 0:n.deviation_impact)||(null==i?void 0:i.deviation_impact),deviation_explanation:(null==n?void 0:n.deviation_explanation)||(null==i?void 0:i.deviation_explanation),evaluation_outputs:(null==n?void 0:n.evaluation_outputs)||(null==i?void 0:i.evaluation_outputs),cognitive_decisioning:(null==n?void 0:n.cognitive_decisioning)||(null==i?void 0:i.cognitive_decisioning)}):n};if(!("string"==typeof o&&o.includes(s.DEVIATION_BADGE_SEPARATOR)))return u(l);var a=o.split(s.DEVIATION_BADGE_SEPARATOR)[1];if(!a)return l;var c=(null==i?void 0:i.evaluationResult)||(null==t?void 0:t.evaluationResult)||{},d=(null===(n=null==c?void 0:c.deviation_entries)||void 0===n?void 0:n[a])||(null===(r=null==c?void 0:c.deviations)||void 0===r?void 0:r[a])||null;return d?e.__assign(e.__assign(e.__assign({},c),d),{deviation_summary:(null==d?void 0:d.deviation_summary)||(null==c?void 0:c.deviation_summary),deviation_title:(null==d?void 0:d.deviation_title)||(null==c?void 0:c.deviation_title),deviation_impact:(null==d?void 0:d.deviation_impact)||(null==c?void 0:c.deviation_impact),deviation_explanation:(null==d?void 0:d.deviation_explanation)||(null==c?void 0:c.deviation_explanation),evaluation_outputs:(null==d?void 0:d.evaluation_outputs)||(null==c?void 0:c.evaluation_outputs),cognitive_decisioning:(null==d?void 0:d.cognitive_decisioning)||(null==c?void 0:c.cognitive_decisioning)}):u(l)}(),isOrphan:!!r}},[un,fe]),ot=i.useCallback(function(){var e=bn.sectionIdx,n=bn.isOrphan;Nn(),In(),null!==e&&(n?Me("No counterpart exists to connect to."):(ji(),wi.current&&Ni(),Ye([]),on.current=[],We(function(n){return n.has(e)?new Set:new Set([e])}),setTimeout(function(){rn.current&&rn.current()},50)))},[bn.sectionIdx,bn.isOrphan,Nn,In,Ni]),rt=i.useCallback(function(){var e=Ze.current;if(e){Ze.current=null;var n=Jn.findIndex(function(n){return n.id===e}),i=Qn.findIndex(function(n){return n.id===e}),t=-1===n?s.findKeyPathByNodeId(Jn,e):null,o=-1===i?s.findKeyPathByNodeId(Qn,e):null,r=-1!==n?n:t?Number(t.split("-")[0]):-1,l=-1!==i?i:o?Number(o.split("-")[0]):-1,u=function(e,n,i,t){var o,r,l,s;return-1!==e?null!==(r=null===(o=i.current[e])||void 0===o?void 0:o.current)&&void 0!==r?r:null:n&&null!==(s=null===(l=t.current[n])||void 0===l?void 0:l.current)&&void 0!==s?s:null},a=function(e,n,i){void 0===i&&(i=30);var t=0,o=function(){var r=e();r&&0!==r.getBoundingClientRect().height?(Fi.current.add(r),s.scrollAndHighlightClause(r,n)):t++<i&&requestAnimationFrame(o)};requestAnimationFrame(o)};if(De)-1!==r&&mn.current&&a(function(){return u(n,t,ui,fi)},mn.current),-1!==l&&vn.current&&a(function(){return u(i,o,ai,pi)},vn.current);else{var c=cn.current;if(!c)return;a(function(){return-1!==r?u(n,t,ui,fi):u(i,o,ai,pi)},c)}}},[Jn,Qn,De,ui,ai,fi,pi,mn,vn,cn]),lt=i.useCallback(function(n){if(n){ji(),Ni(),We(new Set),Ye([]),on.current=[],In(),Pn();var i=Jn.findIndex(function(e){return e.id===n}),t=Qn.findIndex(function(e){return e.id===n}),o=-1===i?s.findKeyPathByNodeId(Jn,n):null,r=-1===t?s.findKeyPathByNodeId(Qn,n):null;if(-1!==i||o||-1!==t||r){var l=-1!==i?i:o?Number(o.split("-")[0]):-1,u=-1!==t?t:r?Number(r.split("-")[0]):-1;Ze.current=n,Mi(function(n){var i,t=e.__assign({},n),o=!1;-1!==l&&(t[i=De?"left-".concat(l):String(l)]||(t[i]=!0,o=!0));-1!==u&&(t[i=De?"right-".concat(u):String(u)]||(t[i]=!0,o=!0));return o?t:n}),Vi(function(n){var i=e.__assign({},n),t=!1,l=function(e){for(var n=e.split("-"),o=n[0],r=1;r<n.length;r++)o+="-".concat(n[r]),i[o]||(i[o]=!0,t=!0)};return o&&l(o),r&&l(r),t?i:n}),setTimeout(function(){requestAnimationFrame(function(){Ze.current===n&&st.current()})},50)}else console.warn('scrollToAndHighlightClause: nodeId "'.concat(n,'" not found'))}},[Jn,Qn,De,Mi,Vi,Ni,In,Pn]),st=i.useRef(rt);i.useEffect(function(){st.current=rt},[rt]);var ut=i.useRef(null);i.useEffect(function(){if(qn){var e=kn.fields.find(function(e){return e.analysisKey===qn||e.key===qn});if(e){var n=li.current[e.key]||si.current[e.key];(null==n?void 0:n.current)&&setTimeout(function(){return n.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[qn,kn.fields]);var at=i.useCallback(function(e){var n,i,t,o,r,l,s,u,a,c=null===(n=null==Ki?void 0:Ki.rule_difference_comparison)||void 0===n?void 0:n.fields;if(!c||!c[e])return{score:0,relation:"",highlightsA:[],highlightsB:[],hasContent:!1};var d=c[e],v=(null==d?void 0:d.relation)||(null===(t=null===(i=null==d?void 0:d.highlights)||void 0===i?void 0:i.ruleA_spans)||void 0===t?void 0:t.length)||(null===(r=null===(o=null==d?void 0:d.highlights)||void 0===o?void 0:o.ruleB_spans)||void 0===r?void 0:r.length)||(null==d?void 0:d.mappings)&&d.mappings.length>0;if(d.mappings){var f=d.mappings[0]||{};return{score:d.score,relation:f.relation||"",highlightsA:(null===(l=f.highlights)||void 0===l?void 0:l.ruleA_spans)||[],highlightsB:(null===(s=f.highlights)||void 0===s?void 0:s.ruleB_spans)||[],hasContent:!!v}}return{score:d.score,relation:d.relation||"",highlightsA:(null===(u=d.highlights)||void 0===u?void 0:u.ruleA_spans)||[],highlightsB:(null===(a=d.highlights)||void 0===a?void 0:a.ruleB_spans)||[],hasContent:!!v}},[Ki]),ct=E.useStyleHelpers({proposedSections:Jn,existingSections:Qn,maintainRelativeOrder:De,cognitiveMap:un,deviationData:be,treeData:fe,resolvedComparisonConfig:kn}),dt=ct.getSectionCompareStyle,vt=ct.getSubSectionCompareStyle,ft=ct.getDeviationStyleByKey,pt=B.useLinesCalculator({containerRef:$e,leftContainerRef:mn,rightContainerRef:vn,svgContainerRef:Xe,pathRefs:tn,leftHeaderRef:Je,rightHeaderRef:Qe,proposedSections:Jn,existingSections:Qn,visibleFields:Zn,leftRefs:li,rightRefs:si,sectionLeftRefs:ui,sectionRightRefs:ai,subSectionLeftRefs:fi,subSectionRightRefs:pi,lhsBadgeRefs:ci,rhsBadgeRefs:di,sectionRowRefs:gi,expandedSections:qi,expandedSubSections:Hi,connectedSections:Ge,isSideBySide:xi,activeSideBySideSection:Ai,maintainRelativeOrder:De,cognitiveMap:un,getSectionCompareStyle:dt,getSubSectionCompareStyle:vt,getDeviationStyleByKey:ft,isArrowVisible:_i,isAnimatingRef:en,isSideBySideRef:wi,sideBySideCacheRef:Ti,sideBySideLineRef:Oi,activeSideBySideSectionRef:Di,activeSideBySideRightSectionRef:Ii,connectedLines:Ue,setConnectedLines:Ye,cachedConnectedPositions:on,calculateLinesRef:rn,resizeTimerRef:ln,scrollLock:Bi,handleResizeRef:sn,activeProposed:Xn,existingRule:$n,analysisData:Ki,pendingScrollTargetRef:Sn,pendingScrollCallbackRef:Rn,resolvedComparisonConfig:kn,getFieldData:at}),gt=pt.lines,ht=pt.setLines,mt=pt.overallConnector,St=pt.setOverallConnector,Rt=pt.svgDimensions,xt=pt.handleColumnScroll,_t=i.useMemo(function(){return(null==xe?void 0:xe.badgeStyleOverride)?gt.map(function(n){var i=xe.badgeStyleOverride(null!=n.style.label?String(n.style.label):null);return i?e.__assign(e.__assign({},n),{style:e.__assign(e.__assign({},n.style),{badgeBg:i.bg,badgeText:i.text,badgeBorder:i.border})}):n}):gt},[gt,null==xe?void 0:xe.badgeStyleOverride]),yt=i.useCallback(function(){ji(),Mi({}),Vi({}),Ni(),We(new Set),Ye([]),on.current=[],In(),Pn(),Nn(),requestAnimationFrame(function(){rn.current&&rn.current()})},[Mi,Vi,Ni,In,Pn,Nn]),bt=i.useMemo(function(){return Object.values(qi).some(Boolean)||Object.values(Hi).some(Boolean)},[qi,Hi]),Ct=i.useRef(null),Et=i.useRef(0),At=i.useRef(0),Bt=i.useRef(0),Tt=A.useResizeHandler({timerRef:Ct,ruleComponentRef:dn,scrollContainerRef:cn,containerRef:$e,maintainRelativeOrder:De,proposedSections:Jn,existingSections:Qn,isSideBySideRef:wi,activeSideBySideSectionRef:Di,activeSideBySideRightSectionRef:Ii,sectionRowRefs:gi,sectionRightRowRefs:vi,sectionLeftRefs:ui,sectionRightRefs:ai,subSectionLeftRefs:fi,subSectionRightRefs:pi,lhsBadgeRefs:ci,rhsBadgeRefs:di,leftContainerRef:mn,rightContainerRef:vn,calculateLinesRef:rn,handleResizeRef:sn,setIsResizing:Ci,setIsArrowVisible:yi,sideBySideCacheRef:Ti,cachedConnectedPositions:on}).handleResize;i.useEffect(function(){sn.current=Tt},[Tt,sn]),i.useEffect(function(){var e=function(e,n,i,t,o){n.current=e.getBoundingClientRect().width;var r=new ResizeObserver(function(e){null!==i.current&&cancelAnimationFrame(i.current),i.current=requestAnimationFrame(function(){var r,l,s;i.current=null;var u=e[e.length-1];if(u){var a=null!==(s=null===(l=null===(r=u.borderBoxSize)||void 0===r?void 0:r[0])||void 0===l?void 0:l.inlineSize)&&void 0!==s?s:u.contentRect.width;Math.abs(a-n.current)<1?o():(n.current=a,t())}})});return r.observe(e),r},n={current:null},i={current:null},t={current:null},o=[],r=[n,i,t];return dn.current&&o.push(e(dn.current,Et,n,function(){return sn.current()},function(){})),cn.current&&o.push(e(cn.current,At,i,function(){return sn.current()},function(){return rn.current()})),$e.current&&o.push(e($e.current,Bt,t,function(){return sn.current()},function(){return rn.current()})),function(){o.forEach(function(e){return e.disconnect()}),r.forEach(function(e){null!==e.current&&(cancelAnimationFrame(e.current),e.current=null)})}},[]),i.useEffect(function(){wi.current=xi},[xi]),i.useEffect(function(){Di.current=Ai},[Ai]);var wt=i.useCallback(function(){var e,n=bn.sectionIdx,i=bn.isOrphan;if(In(),null!=n){var t="left";bn.anchorEl&&(null===(e=vn.current)||void 0===e?void 0:e.contains(bn.anchorEl))&&(t="right"),ki(n,i,{sourceSide:t})}},[ki,bn.isOrphan,bn.sectionIdx,bn.anchorEl,In]),It=i.useCallback(function(){In(),Ni(),We(new Set),Ye([]),on.current=[]},[In,Ni]),Dt=null!==bn.sectionIdx&&Ge.has(bn.sectionIdx),Ot=S.useDeviationNavigation({proposedSections:Jn,existingSections:Qn,parentDeviationRecord:ei,expandedSections:qi,maintainRelativeOrder:!!De,scrollContainerRef:cn,leftContainerRef:mn,rightContainerRef:vn,lhsBadgeRefs:ci,rhsBadgeRefs:di}),Ft=Ot.showDeviationNavigation,jt=Ot.showOpenNodeRef,Pt=Ot.adjustScrollForPopup,Nt=i.useCallback(function(e,n,i,t,o){var r,l="string"==typeof t?s.safeStringify(t).trim():s.safeStringify(null==t?void 0:t.deviation_summary).trim(),u=e.currentTarget;Pn();var a="left";(null===(r=vn.current)||void 0===r?void 0:r.contains(u))&&(a="right");var c=function(){var e,i,t,o;if("string"==typeof n&&n.includes(s.DEVIATION_BADGE_SEPARATOR)){var r=n.split(s.DEVIATION_BADGE_SEPARATOR),l="".concat(r[0]).concat(s.DEVIATION_BADGE_SEPARATOR).concat(r[1]);return"right"===a?null===(e=di.current[l])||void 0===e?void 0:e.current:null===(i=ci.current[l])||void 0===i?void 0:i.current}return"right"===a?null===(t=di.current[n])||void 0===t?void 0:t.current:null===(o=ci.current[n])||void 0===o?void 0:o.current},d=function(e,t){var o=!!De,r=o?"right"===a?vn.current:mn.current:cn.current,l=o?"right"===a?mn.current:vn.current:null;if(r&&e){var u=function(){var e="string"==typeof n&&n.includes(s.DEVIATION_BADGE_SEPARATOR);i||!e?t():requestAnimationFrame(function(){var e,i,o;Ti.current=null,on.current=[],Pi(!0,n,null),null===(e=rn.current)||void 0===e||e.call(rn),null===(i=mn.current)||void 0===i||i.dispatchEvent(new Event("scroll")),null===(o=vn.current)||void 0===o||o.dispatchEvent(new Event("scroll")),t()})},c=e.getBoundingClientRect(),d=r.getBoundingClientRect(),v=d.bottom-.35*d.height,f=d.top+.35*d.height;if(c.top>v||c.top<f){var p=d.top+d.height/2,g=c.top+c.height/2-p;o&&l&&s.smoothScrollTo(l,l.scrollTop+g,250,function(){}),s.smoothScrollTo(r,r.scrollTop+g,250,u)}else u()}else t()};if(i)return Ni(),We(new Set),Ye([]),on.current=[],void(l&&requestAnimationFrame(function(){var e=c()||u;d(e,function(){wn({open:!0,anchorEl:e,summary:t,displayImpact:o})})}));ki(n,i,l?{toggleIfSame:!1,sourceSide:a,onReady:function(){var e=c()||u;d(e,function(){wn({open:!0,anchorEl:e,summary:t,displayImpact:o})})}}:{toggleIfSame:!1,sourceSide:a})},[ki,Pn,wn,Ni,De]),kt=i.useMemo(function(){var e;if(!Ce)return null;var n=null===(e=null==Ce?void 0:Ce.id)||void 0===e?void 0:e.split(":")[0];for(var i in ei){if((ei[i]||[]).some(function(e){return e.id===n}))return i}return null},[Ce,ei]),Lt=i.useRef({id:null,triggerMs:null}),qt=i.useRef(null);i.useEffect(function(){var n;if(null==Ce?void 0:Ce.id){var i=Number(Ce.trigger),t=Lt.current;if((null==t?void 0:t.triggerMs)!==i){if(!(Ce.id.includes(":")&&/:\d+$/.test(Ce.id)))return Lt.current={id:Ce.id,triggerMs:i},void lt(Ce.id);var o=null===(n=null==Ce?void 0:Ce.id)||void 0===n?void 0:n.split(":"),r=o[0],l=o[1],u=null!=l?l:"0";qt.current!==Ce.id&&(In(),Pn(),Ni(),We(new Set),Ye([]),on.current=[],qt.current=Ce.id);var a=!1,c=0,d=null,v=150,f=function(e,n){for(var i=function(e,t){if(!e)return null;if(e.id===n)return t;if(!Array.isArray(e.subsections))return null;for(var o=0;o<e.subsections.length;o++){var r=i(e.subsections[o],"".concat(t,"-").concat(o));if(r)return r}return null},t=0;t<e.length;t++){var o=i(e[t],String(t));if(o)return o}return null},p=function(){var n,t,o,l;if(!a){var g=function(){Lt.current={id:Ce.id,triggerMs:i}},h=null,m=null;for(var S in ei){var R=ei[S].find(function(e){return e.id===r});if(R){h=S,m=R;break}}if(m&&h){var x=Jn.findIndex(function(e){return e.id===h}),_=Qn.findIndex(function(e){return e.id===h}),y=-1===x&&-1!==_,b=f(Jn,m.id),C=f(Qn,m.id);if(b&&!C&&!y){var E=b.split("-"),A=Number(E[0]);if(De){var B=null===(t=null===(n=Jn[A])||void 0===n?void 0:n.refIndexes)||void 0===t?void 0:t[0],T=Qn.findIndex(function(e){return e.selfIndex===B});-1!==T&&(A=T)}C=e.__spreadArray([A],E.slice(1),!0).join("-")}if(b||C){var w=y||!b&&!!C,I=b?Number(b.split("-")[0]):x,D=C?Number(C.split("-")[0]):_;if(w){if(!(De?!!qi["right-".concat(D)]:!!qi[String(D)])&&D>=0)return Gi(D,"right"),c+=1,void(d=setTimeout(p,450))}else if(!(De?!!qi["left-".concat(I)]:!!qi[String(I)])&&I>=0)return Gi(I,"left"),c+=1,void(d=setTimeout(p,450));var O,F=b||"",j=C||"",P="".concat(m.id).concat(s.DEVIATION_BADGE_SEPARATOR).concat(u).concat(s.DEVIATION_BADGE_SEPARATOR).concat(F).concat(s.DEVIATION_BADGE_SEPARATOR).concat(j),N="".concat(m.id).concat(s.DEVIATION_BADGE_SEPARATOR).concat(u),k=null===(o=ci.current[N])||void 0===o?void 0:o.current,L=null===(l=di.current[N])||void 0===l?void 0:l.current,q=w||!k&&!!L,M=q?L:k;if(O=De?q?vn.current:mn.current:cn.current,M&&O){var H=M.getBoundingClientRect();if(0===H.height)return void((c+=1)<2?d=setTimeout(p,v):g());var V=O.getBoundingClientRect(),z=H.top-V.top+O.scrollTop-V.height/2+H.height/2+200,G=function(){var n,i,t,o,r;if(!a){g();var l=M instanceof Element?window.getComputedStyle(M).color:"";k&&(k.style.transition="box-shadow 300ms ease-in-out",k.style.boxShadow="0 0 10px ".concat(l)),L&&(L.style.transition="box-shadow 300ms ease-in-out",L.style.boxShadow="0 0 10px ".concat(l)),setTimeout(function(){k&&(k.style.boxShadow=""),L&&(L.style.boxShadow="")},2e3);var s=(null===(i=null===(n=m.evaluationResult)||void 0===n?void 0:n.deviations)||void 0===i?void 0:i[u])||m,c=(null===(t=m.evaluationResult)||void 0===t?void 0:t.evaluation_outputs)||m.evaluation_outputs;if(!(!!k&&!!L)){var d=q?(null===(o=di.current[N])||void 0===o?void 0:o.current)||L:(null===(r=ci.current[N])||void 0===r?void 0:r.current)||k;return Pt(d,function(){wn({open:!0,anchorEl:d,displayImpact:Ce.displayImpact,summary:e.__assign(e.__assign({},s),{evaluation_outputs:c})})},{skipScroll:!0}),void(null==Ee||Ee())}ki(P,!1,{toggleIfSame:!1,sourceSide:"left",onReady:function(){var n,i,t=q?(null===(n=di.current[N])||void 0===n?void 0:n.current)||L:(null===(i=ci.current[N])||void 0===i?void 0:i.current)||k;Pt(t,function(){requestAnimationFrame(function(){var n,i,o;Ti.current=null,on.current=[],null===(n=rn.current)||void 0===n||n.call(rn),null===(i=mn.current)||void 0===i||i.dispatchEvent(new Event("scroll")),null===(o=vn.current)||void 0===o||o.dispatchEvent(new Event("scroll")),wn({open:!0,anchorEl:t,displayImpact:null==Ce?void 0:Ce.displayImpact,summary:e.__assign({},s)})})},{skipScroll:!0})}})}};Math.abs(O.scrollTop-z)<=2?G():(Sn.current=z,Rn.current=G,O.scrollTo({top:z,behavior:"smooth"}),d&&clearTimeout(d),d=setTimeout(function(){if(Rn.current){Sn.current=null;var e=Rn.current;Rn.current=null,e()}},800))}else(c+=1)<2?d=setTimeout(p,v):g()}else(c+=1)<2?d=setTimeout(p,v):g()}else(c+=1)<2?d=setTimeout(p,v):g()}};return d=setTimeout(p,v),function(){a=!0,d&&clearTimeout(d)}}}},[Ce,ei,Jn,Qn,De,qi,Gi,ki,wn,lt]);var Mt={maintainRelativeOrder:!!De,showDeviationBadges:je,isProposingFix:Be,proposingFixNodeId:Te,isRedlineFlow:we,isSideBySide:xi,activeSideBySideSection:Ai,connectedSections:Ge,proposedSections:Jn,existingSections:Qn,deviationNumberRegistry:ni,treeData:fe,displayConfig:xe,resolvedMarkdownStyles:an,unifiedNumbering:Wi,expandedSections:qi,expandedSubSections:Hi,setExpandedSubSections:Vi,getSectionCompareStyle:dt,getSubSectionCompareStyle:vt,getBadgeRef:Si,getSectionRowRef:hi,getSubSectionRef:mi,sectionLeftRefs:ui,sectionRightRefs:ai,sectionRowRefs:gi,sectionRightRowRefs:vi,subSectionLeftRefs:fi,subSectionRightRefs:pi,lhsBadgeRefs:ci,rhsBadgeRefs:di,openMoreFunctionsPopup:function(e,n,i,t,o,r){var l;if(e.stopPropagation(),bn.open&&bn.sectionIdx===o)Nn();else{var u=e.currentTarget,a="left";(null===(l=vn.current)||void 0===l?void 0:l.contains(u))&&(a="right");ji(),wi.current&&Ni(),We(new Set),Ye([]),on.current=[],Pn(),Tn.open?It():In(),requestAnimationFrame(function(){var e=function(){var e,n,i,t;if("string"==typeof o&&o.includes(s.DEVIATION_BADGE_SEPARATOR)){var r=o.split(s.DEVIATION_BADGE_SEPARATOR),l="".concat(r[0]).concat(s.DEVIATION_BADGE_SEPARATOR).concat(r[1]);return"right"===a?null===(e=di.current[l])||void 0===e?void 0:e.current:null===(n=ci.current[l])||void 0===n?void 0:n.current}return"right"===a?null===(i=di.current[o])||void 0===i?void 0:i.current:null===(t=ci.current[o])||void 0===t?void 0:t.current}()||u;Cn(tt(e,n,t,o,i,r))})}},handleOpenSummaryPopup:Nt,openSummaryPopup:Nt,handleCloseSummaryPopup:It,toggleSection:Gi,handleSubSectionToggle:zi,renderSubSectionAccordion:function(e){var i=e.section,t=e.keyPath,o=e.depth,r=void 0===o?0:o,l=e.columnKey,s=void 0===l?"left":l,u=e.parentNodeId,a=void 0===u?"":u,c=e.sectionOffset;return n.jsx(x.default,{section:i,keyPath:t,depth:r,columnKey:s,parentNodeId:a,sectionOffset:c})},resetSideBySide:Ni,setConnectedSections:We,setConnectedLines:Ye,cachedConnectedPositions:on,showDeviationNavigation:Ft,showOpenNodeRef:jt,deviationNodeIdToView:null==Ce?void 0:Ce.id,deviationTargetParentId:kt};return n.jsx(C.CompareContextProvider,e.__assign({value:Mt},{children:n.jsxs(t.Box,e.__assign({ref:dn,sx:e.__assign(e.__assign({display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif'},De?{}:{overflow:"visible"}),{position:"relative"})},{children:[Ne&&n.jsx(t.Box,e.__assign({sx:{position:"absolute",inset:0,bgcolor:"rgba(255, 255, 255, 0.6)",backdropFilter:"blur(10px)",zIndex:9999,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"8px"}},{children:n.jsx(v.default,{})})),Tn.open&&n.jsx(b.default,{open:Tn.open,anchorEl:Tn.anchorEl,containerEl:ut.current,clipTopEl:Je.current,scrollContainerEl:cn.current,onClose:It,summary:Tn.summary,displayImpact:Tn.displayImpact}),n.jsx(d.default,{open:bn.open,anchorEl:bn.anchorEl,sectionTitle:bn.sectionTitle,referenceSectionTitle:bn.refSectionTitle,onClose:Nn,onOpenCognitiveCompare:Fn,onOpenSideBySide:wt,onConnect:ot,isConnected:Dt,isOrphan:bn.isOrphan}),_n.open&&n.jsx(c.default,{open:_n.open,popupRef:On,position:En,popupConfig:_e,onClose:function(){An(null),yn(function(n){return e.__assign(e.__assign({},n),{open:!1})}),Dn(null)},markdownStyles:me,sectionTitle:Gn,referenceSectionTitle:Kn,cognitiveData:_n.cognitiveData,anchorEl:_n.anchorEl,sectionAnchorEl:_n.sectionAnchorEl,scrollContainerEl:cn.current,badgeStyle:_n.badgeStyle,docData:_n.docData,deviationData:_n.deviationData,isLoading:_n.isLoading}),n.jsx(t.Snackbar,e.__assign({open:!!qe,autoHideDuration:8e3,onClose:function(){return Me(null)},anchorOrigin:{vertical:"top",horizontal:"center"}},{children:n.jsx(t.Alert,e.__assign({onClose:function(){return Me(null)},severity:"error",sx:{width:"100%",whiteSpace:"pre-line"}},{children:qe}))})),n.jsx(R.default,{componentHeaderText:ve,displayConfig:xe,maintainRelativeOrder:De,onCollapseAll:yt,showCollapseAll:bt,onToggleView:function(e){ke(!0),setTimeout(function(){Oe(!e),Ni(),In(),We(new Set),Ye([]),on.current=[],requestAnimationFrame(function(){requestAnimationFrame(function(){setTimeout(function(){ke(!1)},600)})})},50)}}),n.jsx(t.Box,e.__assign({ref:cn,onScroll:xt,sx:{flex:1,minHeight:0,pt:1.5,pb:1,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",overflowY:De?"hidden":"auto",borderTop:Ui&&Yi?"none":"1.5px solid #EEF0F4"}},{children:n.jsx(t.Box,e.__assign({sx:e.__assign({display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"},De?{flex:1,minHeight:0}:{})},{children:n.jsxs(t.Box,e.__assign({ref:$e,sx:e.__assign({display:"grid",gridTemplateColumns:"minmax(0, 1fr) 180px minmax(0, 1fr)",gap:"60px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0},De?{flex:1,overflow:"visible"}:{})},{children:[n.jsx(w.default,{svgContainerRef:Xe,svgDimensions:Rt,isResizing:bi,overallConnector:mt,rootDeviationStyle:et,lines:_t,isSideBySide:xi,activeSideBySideSection:Ai,isArrowVisible:_i,maintainRelativeOrder:De,proposedSections:Jn,existingSections:Qn,cognitivePopup:_n,activeBadgeId:Bn,closeCognitivePopup:Pn,setActiveBadgeId:Dn,openCognitivePopupFromState:jn,buildSectionPopupState:tt,connectedLines:Ue,pathRefs:tn}),n.jsxs(t.Box,e.__assign({sx:e.__assign({border:"1px solid #E7E7E9",borderRadius:"8px",bgcolor:"#FFFFFF",display:"flex",flexDirection:"column",position:"relative",zIndex:2,filter:"drop-shadow(0px 2px 4px #F2F2F2)"},De?{flex:1,overflow:"visible"}:{})},{children:[n.jsx(t.Box,e.__assign({ref:Je,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E7E7E9",borderRadius:"8px 8px 0 0",display:"flex",alignItems:"center",minHeight:"40px",overflow:"hidden",minWidth:0}},{children:n.jsx(t.Tooltip,e.__assign({title:Vn,placement:"top"},{children:n.jsx(t.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:500,color:"#19213D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0,textAlign:"center",display:"block"}},{children:Vn}))}))})),n.jsxs(t.Box,e.__assign({ref:mn,onScroll:xt,sx:e.__assign({p:"12px",display:"flex",flexDirection:"column"},De?{maxHeight:"calc(100vh - 150px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,mr:"-160px",pr:"172px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[n.jsx("div",{ref:gn,style:{width:"100%",height:"0px",flexShrink:0}}),ti&&Jn.map(function(e,i){return n.jsx(_.default,{section:e,idx:i},"left-row-".concat(i))}),n.jsx("div",{ref:hn,style:{width:"100%",height:"0px",flexShrink:0}})]}))]})),n.jsx(t.Box,e.__assign({ref:ut,sx:{width:"180px",display:"flex",flexDirection:"column",alignItems:"center",pt:"15px",gap:0,zIndex:20,pointerEvents:"none"}},{children:n.jsx(t.Box,e.__assign({sx:{display:"flex",justifyContent:"center",alignItems:"center",mt:0}},{children:n.jsxs(t.Box,e.__assign({onClick:function(n){n.stopPropagation(),_n.open&&Bn===Xi?Pn():(Dn(Xi),jn(tt(n.currentTarget,{title:"",content:"",evaluationResult:$i,cognitiveData:{section_id:"",decisioning:[],gap:[],relevance_score:0,isMissingRationale:!0}},null,Xi,!0,e.__assign(e.__assign({},et),{label:""}))))},sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:"5px",top:"-8px",borderRadius:"20px",bgcolor:et.badgeBg,color:et.badgeText,border:"1px solid ".concat(et.badgeBorder),fontSize:"12px",fontWeight:600,whiteSpace:"nowrap",position:"relative",zIndex:1,pointerEvents:"auto",cursor:"pointer"}},{children:[null!=Ji?Ji:n.jsx(f.default,{}),n.jsx(t.Box,e.__assign({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:n.jsx(r.ButtonCognitiveIcon,{})})),n.jsx(o.ChevronDown,{size:11,style:{transform:_n.open&&Bn===Xi?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))})),n.jsxs(t.Box,e.__assign({sx:e.__assign({border:"1px solid #E3E6EA",borderRadius:"8px",bgcolor:"#FFFFFF",boxShadow:"0px 1px 4px #F7F4FE",position:"relative",zIndex:2,display:"flex",flexDirection:"column",minWidth:0},De?{flex:1,overflow:"visible",minHeight:0}:{})},{children:[Ei&&n.jsx(l.default,{sections:11}),n.jsx(t.Box,e.__assign({ref:Qe,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E3E6EA",borderRadius:"8px 8px 0 0",minHeight:"40px",display:"flex",alignItems:"center",overflowX:"hidden"}},{children:n.jsx(t.Tooltip,e.__assign({title:Un,placement:"top"},{children:n.jsx(t.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:500,color:"#5928ED",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0,textAlign:"center",display:"block"}},{children:Un}))}))})),n.jsxs(t.Box,e.__assign({ref:vn,onScroll:xt,sx:e.__assign({p:"12px",display:"flex",flexDirection:"column"},De?{maxHeight:"calc(100vh - 150px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,ml:"-150px",pl:"165px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[n.jsx("div",{ref:fn,style:{width:"100%",height:"0px",flexShrink:0}}),ti&&Qn.map(function(e,i){return n.jsx(y.default,{section:e,idx:i},"right-row-".concat(i))}),n.jsx("div",{ref:pn,style:{width:"100%",height:"0px",flexShrink:0}})]}))]}))]}))}))}))]}))}))};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),i=require("react"),t=require("@mui/material"),o=require("lucide-react"),r=require("../../assests/svg/ButtonCognitiveIcon.js"),l=require("./OverlayComponent.js"),s=require("./CognitiveComparehelpers.js"),u=require("./CognitiveCompareConfig.js"),a=require("./CognitiveCompareConstants.js"),c=require("./CognitivePopup.js"),d=require("./MoreFunctionsPopup.js"),v=require("./LoaderComponent.js"),f=require("./components/ThreeDotsLoader.js"),p=require("./hooks/useCompareData.js"),g=require("./hooks/useComparePopups.js"),h=require("./hooks/useSectionRefs.js"),m=require("./hooks/useAccordionState.js"),S=require("./hooks/useDeviationNavigation.js"),R=require("./components/CompareHeader.js"),x=require("./components/SubSectionAccordion.js"),_=require("./components/LHSSectionRow.js"),y=require("./components/RHSSectionRow.js"),b=require("./components/CognitiveSummaryPopup.js"),C=require("./CompareContext.js"),E=require("./hooks/useStyles.js"),A=require("./hooks/useResizeHandler.js"),B=require("./hooks/useLinesCalculator.js"),w=require("./hooks/useSideBySide.js"),T=require("./components/SvgConnectors.js");exports.SHARED_MARKDOWN_STYLES=u.SHARED_MARKDOWN_STYLES,exports.default=function(I){var D,F,O,j,P,N,k,L,q,M,H,V,z,G,W,K,U,Y,X,$,J,Q,Z,ee,ne,ie,te,oe,re,le,se,ue,ae,ce,de=I.componentHeaderText,ve=void 0===de?a.DEFAULT_COMPONENT_HEADER_TEXT:de,fe=I.treeData,pe=I.comparisonConfig,ge=I.leftColumnTitleText,he=I.rightColumnTitleText,me=I.markdownStyles,Se=I.resetTrigger,Re=I.displayConfig,xe=void 0===Re?{isHeaderVisible:!0,isToggleVisible:!0,maintainRelativeOrder:!1,isLoading:!0,showDeviationBadges:!1,enableDeviationSchemaBackwardCompatibility:!1,displayEmailNotifier:!0}:Re,_e=I.popupConfig,ye=I.deviationData,be=void 0===ye?{}:ye,Ce=I.deviationNodeIdToView,Ee=I.resetDeviationNodeId,Ae=I.isProposingFix,Be=void 0!==Ae&&Ae,we=I.proposingFixNodeId,Te=I.isRedlineFlow,Ie=i.useState(xe.maintainRelativeOrder),De=Ie[0],Fe=Ie[1],Oe=!!De||!!(null==xe?void 0:xe.showDeviationBadges),je=i.useState(!1),Pe=je[0],Ne=je[1],ke=i.useState(null),Le=ke[0],qe=ke[1],Me=i.useState(null===(F=null!==(D=null==fe?void 0:fe.newEvaluationResult)&&void 0!==D?D:null==xe?void 0:xe.enableDeviationSchemaBackwardCompatibility)||void 0===F||F)[0],He=i.useState(new Set),Ve=He[0],ze=He[1],Ge=i.useState([]),We=Ge[0],Ke=Ge[1],Ue=i.useRef(null),Ye=i.useRef(null),Xe=i.useRef(null),$e=i.useRef(null),Je=i.useRef(null),Qe=i.useRef(!1),Ze=i.useRef(null),en=i.useRef({}),nn=i.useRef([]),tn=i.useRef(function(){}),on=i.useRef(null),rn=i.useRef(function(){}),ln=i.useMemo(function(){return(null==fe?void 0:fe.cognitive_decisioning)||{}},[fe]),sn=i.useMemo(function(){return e.__assign(e.__assign({},u.SHARED_MARKDOWN_STYLES),me)},[me]),un=i.useRef(null),an=i.useRef(null),cn=i.useRef(null),dn=i.useRef(null),vn=i.useRef(null),fn=i.useRef(null),pn=i.useRef(null),gn=i.useRef(null),hn=i.useRef(null),mn=i.useRef(null),Sn=g.useComparePopups(un),Rn=Sn.cognitivePopup,xn=Sn.setCognitivePopup,_n=Sn.moreFunctions,yn=Sn.setMoreFunctions,bn=Sn.position,Cn=Sn.setPosition,En=Sn.activeBadgeId,An=Sn.summaryPopup,Bn=Sn.setSummaryPopup,wn=Sn.closeSummaryPopup,Tn=Sn.setActiveBadgeId,In=Sn.popupRef,Dn=Sn.handleOpenCognitiveCompare,Fn=Sn.openCognitivePopupFromState,On=Sn.closeCognitivePopup,jn=Sn.closeMoreFunctionsPopup,Pn=i.useMemo(function(){var e,n,i,t,o,r,l;return{fields:null!==(e=null==pe?void 0:pe.fields)&&void 0!==e?e:u.DEFAULT_FIELD_CONFIG,thresholds:{high:null!==(i=null===(n=null==pe?void 0:pe.thresholds)||void 0===n?void 0:n.high)&&void 0!==i?i:u.DEFAULT_COMPARISON_CONFIG.thresholds.high,medium:null!==(o=null===(t=null==pe?void 0:pe.thresholds)||void 0===t?void 0:t.medium)&&void 0!==o?o:u.DEFAULT_COMPARISON_CONFIG.thresholds.medium,exact:null!==(l=null===(r=null==pe?void 0:pe.thresholds)||void 0===r?void 0:r.exact)&&void 0!==l?l:u.DEFAULT_COMPARISON_CONFIG.thresholds.exact}}},[pe]),Nn=i.useState(null),kn=Nn[0];Nn[1];var Ln=null===(P=null===(O=null==fe?void 0:fe.documents)||void 0===O?void 0:O[null===(j=null==fe?void 0:fe.input_index_map)||void 0===j?void 0:j[0]])||void 0===P?void 0:P.title,qn=null===(L=null===(N=null==fe?void 0:fe.documents)||void 0===N?void 0:N[null===(k=null==fe?void 0:fe.input_index_map)||void 0===k?void 0:k[1]])||void 0===L?void 0:L.title,Mn=s.safeStringify(ge||Ln||"Uploaded Contract"),Hn=null===(V=null===(H=null===(q=null==fe?void 0:fe.documents)||void 0===q?void 0:q[null===(M=null==fe?void 0:fe.input_index_map)||void 0===M?void 0:M[0]])||void 0===H?void 0:H.metadata)||void 0===V?void 0:V.file_name,Vn=s.safeStringify(Hn),zn=null===(K=null===(W=null===(z=null==fe?void 0:fe.documents)||void 0===z?void 0:z[null===(G=null==fe?void 0:fe.input_index_map)||void 0===G?void 0:G[1]])||void 0===W?void 0:W.metadata)||void 0===K?void 0:K.file_name,Gn=s.safeStringify(zn),Wn=s.safeStringify(he||qn||"Reference Template"),Kn=p.useCognitiveTreeData(fe,De,be,Pn,Me),Un=Kn.activeProposed,Yn=Kn.existingRule,Xn=Kn.proposedSections,$n=Kn.existingSections,Jn=Kn.visibleFields,Qn=Kn.parentDeviationRecord,Zn=Kn.deviationNumberRegistry,ei=Kn.parseError;i.useEffect(function(){ei&&qe("Failed to load comparison: ".concat(ei))},[ei]);var ni=Xn.length>0||$n.length>0,ii=i.useMemo(function(){if(!Te)return"off";var e=0,n=0,i=function(t){Array.isArray(t)&&t.forEach(function(t){var o,r=(null==t?void 0:t.content)||"";s.hasMeaningfulRedlineTags(r)&&(e+=1,n+=String(r).length),(null===(o=null==t?void 0:t.subsections)||void 0===o?void 0:o.length)&&i(t.subsections)})};return i(Xn),i($n),"".concat(e,":").concat(n)},[Te,Xn,$n]),ti=h.useSectionRefs(Jn.map(function(e){return e.key}),Math.max(Xn.length,$n.length)),oi=ti.leftRefs,ri=ti.rightRefs,li=ti.sectionLeftRefs,si=ti.sectionRightRefs,ui=ti.lhsBadgeRefs,ai=ti.rhsBadgeRefs,ci=ti.sectionRightRowRefs,di=ti.subSectionLeftRefs,vi=ti.subSectionRightRefs,fi=ti.sectionRowRefs,pi=ti.getSectionRowRef,gi=ti.getSubSectionRef,hi=ti.getBadgeRef,mi=w.useSideBySide({maintainRelativeOrder:De,proposedSections:Xn,existingSections:$n,leftContainerRef:gn,rightContainerRef:cn,scrollContainerRef:un,sectionLeftRefs:li,sectionRightRefs:si,subSectionLeftRefs:di,subSectionRightRefs:vi,lhsBadgeRefs:ui,rhsBadgeRefs:ai,sectionRowRefs:fi,sectionRightRowRefs:ci,rhsTopSpacerRef:dn,rhsBottomSpacerRef:vn,lhsTopSpacerRef:fn,lhsBottomSpacerRef:pn,calculateLinesRef:tn,setConnectedSections:ze,setConnectedLines:Ke,cachedConnectedPositions:nn,closeMoreFunctionsPopup:jn,setErrorToast:qe,moreFunctions:_n,closeSummaryPopup:wn}),Si=mi.isSideBySide,Ri=mi.isArrowVisible,xi=mi.setIsArrowVisible,_i=mi.isResizing,yi=mi.setIsResizing,bi=mi.isSideBySideLoading,Ci=mi.activeSideBySideSection,Ei=mi.scrollLock,Ai=mi.sideBySideCacheRef,Bi=mi.isSideBySideRef,wi=mi.activeSideBySideRightSectionRef,Ti=mi.activeSideBySideSectionRef,Ii=mi.sideBySideLineRef,Di=mi.highlightedClauseRefs,Fi=mi.clearClauseHighlight,Oi=mi.applyAlignmentPadding,ji=mi.resetSideBySide,Pi=mi.activateSideBySide,Ni=m.useAccordionState({maintainRelativeOrder:!!De,proposedSections:Xn,existingSections:$n,activeSideBySideSection:Ci,connectedSections:Ve,resetSideBySide:ji,setConnectedSections:ze,setConnectedLines:Ke,cachedConnectedPositions:nn,svgContainerRef:Ue,isAnimatingRef:Qe,animationTimerRef:Ze,calculateLinesRef:tn,sectionLeftRefs:li,sectionRightRefs:si,subSectionLeftRefs:di,subSectionRightRefs:vi}),ki=Ni.expandedSections,Li=Ni.setExpandedSections,qi=Ni.expandedSubSections,Mi=Ni.setExpandedSubSections,Hi=Ni.handleSubSectionToggle,Vi=Ni.toggleSection,zi=Ni.forceExpandCrossWiredSections;i.useEffect(function(){Te&&"off"!==ii&&"0:0"!==ii&&(Ai.current=null,nn.current=[],requestAnimationFrame(function(){var e;null===(e=tn.current)||void 0===e||e.call(tn)}))},[Te,ii]);var Gi=i.useMemo(function(){var e=new Map,n=new Map,i=1;if(De)Xn.forEach(function(n){!n.title&&!n.content||n.id&&e.set(n.id,i++)}),$n.forEach(function(t){if(t.id){var o=Xn.filter(function(e){var n;return null===(n=e.refIndexes)||void 0===n?void 0:n.includes(t.selfIndex)});if(o.length>0){var r=o.map(function(n){return e.get(n.id)}).filter(Boolean);n.set(t.id,r.join(", "))}else n.set(t.id,String(i++))}});else for(var t=Math.max(Xn.length,$n.length),o=0;o<t;o++){var r=Xn[o],l=$n[o];r?(e.set(r.id,i),l&&n.set(l.id,String(i)),i++):l&&n.set(l.id,String(i++))}return{leftNums:e,rightNums:n}},[Xn,$n,De]),Wi=Yn.analysis,Ki=s.safeStringify(null===(Y=null===(U=null==Wi?void 0:Wi.rule_difference_comparison)||void 0===U?void 0:U.summary)||void 0===Y?void 0:Y.overall_summary),Ui=!!Ki.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),Yi=null!==(X=null==fe?void 0:fe.base_root_id)&&void 0!==X?X:"-1";null==fe||fe[Yi];var Xi=Me?null!==(se=null!==(oe=be&&(null===(te=null==be?void 0:be[Yi])||void 0===te?void 0:te.evaluation_result))&&void 0!==oe?oe:null===(le=null===(re=null==fe?void 0:fe.nodes)||void 0===re?void 0:re[Yi])||void 0===le?void 0:le.evaluation_result)&&void 0!==se?se:null:null!==(ie=null!==(Q=be&&(null===(J=null===($=null==be?void 0:be[Yi])||void 0===$?void 0:$.evaluation_result)||void 0===J?void 0:J[0]))&&void 0!==Q?Q:null===(ne=null===(ee=null===(Z=null==fe?void 0:fe.nodes)||void 0===Z?void 0:Z[Yi])||void 0===ee?void 0:ee.evaluation_result)||void 0===ne?void 0:ne[0])&&void 0!==ie?ie:null,$i=s.extractDeviationScore(Xi),Ji=s.generateColorPalette(null!==(ce=null===(ae=null===(ue=null==Xi?void 0:Xi.evaluation_outputs)||void 0===ue?void 0:ue.metadata)||void 0===ae?void 0:ae.label_color)&&void 0!==ce?ce:a.DEFAULT_DEVIAION_COLOR),Qi=i.useCallback(function(){Fi(),ji(),ze(new Set),Ke([]),nn.current=[],ft([]),gt(null),Bn(a.EMPTY_SUMMARY_POPUP_STATE),On(),requestAnimationFrame(function(){var e;null===(e=tn.current)||void 0===e||e.call(tn)})},[]),Zi=i.useRef(Qi);i.useEffect(function(){Zi.current=Qi},[Qi]),i.useEffect(function(){Se&&Zi.current()},[Se]);var et=i.useCallback(function(n,i,t,o,r,l,u){var a,c,d,v=s.safeStringify(null==i?void 0:i.id)||s.safeStringify(null==t?void 0:t.id)||"",f=(v?ln[v]:null)||(null==i?void 0:i.cognitiveData)||(null==t?void 0:t.cognitiveData)||{section_id:v,decisioning:[],gap:[],relevance_score:0},p=null!==(c=null===(a=fi.current[o])||void 0===a?void 0:a.current)&&void 0!==c?c:null;return{isLoading:null!==(d=null==xe?void 0:xe.isLoading)&&void 0!==d&&d,open:!0,sectionTitle:(null==i?void 0:i.title)?null==i?void 0:i.title:"No Counterpart",refSectionTitle:(null==t?void 0:t.title)?null==t?void 0:t.title:"No Counterpart",cognitiveData:f,anchorEl:n,sectionAnchorEl:p,badgeStyle:l||null,sectionIdx:o,docData:{documents:null==fe?void 0:fe.documents,input_index_map:null==fe?void 0:fe.input_index_map},deviationData:function(){var n,r,l=(null==i?void 0:i.evaluationResult)||(null==t?void 0:t.evaluationResult)||null,u=function(n){var i=function(e){if(!e||"object"!=typeof e)return null;var n=null==e?void 0:e.deviation_entries;if(n&&"object"==typeof n){var i=Object.keys(n).sort(function(e,n){return Number(e)-Number(n)})[0];if(i&&n[i])return n[i]}var t=Object.keys(e).filter(function(e){return/^\d+$/.test(e)}).sort(function(e,n){return Number(e)-Number(n)});if(t.length&&e[t[0]])return e[t[0]];var o=null==e?void 0:e.deviations;if(o&&"object"==typeof o){var r=Object.keys(o).sort(function(e,n){return Number(e)-Number(n)})[0];if(r&&o[r])return o[r]}return null}(n);return i?e.__assign(e.__assign({},n),{deviation_summary:(null==n?void 0:n.deviation_summary)||(null==i?void 0:i.deviation_summary),deviation_title:(null==n?void 0:n.deviation_title)||(null==i?void 0:i.deviation_title),deviation_impact:(null==n?void 0:n.deviation_impact)||(null==i?void 0:i.deviation_impact),deviation_explanation:(null==n?void 0:n.deviation_explanation)||(null==i?void 0:i.deviation_explanation),evaluation_outputs:(null==n?void 0:n.evaluation_outputs)||(null==i?void 0:i.evaluation_outputs),cognitive_decisioning:(null==n?void 0:n.cognitive_decisioning)||(null==i?void 0:i.cognitive_decisioning)}):n};if(!("string"==typeof o&&o.includes(s.DEVIATION_BADGE_SEPARATOR)))return u(l);var a=o.split(s.DEVIATION_BADGE_SEPARATOR)[1];if(!a)return l;var c=(null==i?void 0:i.evaluationResult)||(null==t?void 0:t.evaluationResult)||{},d=(null===(n=null==c?void 0:c.deviation_entries)||void 0===n?void 0:n[a])||(null===(r=null==c?void 0:c.deviations)||void 0===r?void 0:r[a])||null;return d?e.__assign(e.__assign(e.__assign({},c),d),{deviation_summary:(null==d?void 0:d.deviation_summary)||(null==c?void 0:c.deviation_summary),deviation_title:(null==d?void 0:d.deviation_title)||(null==c?void 0:c.deviation_title),deviation_impact:(null==d?void 0:d.deviation_impact)||(null==c?void 0:c.deviation_impact),deviation_explanation:(null==d?void 0:d.deviation_explanation)||(null==c?void 0:c.deviation_explanation),evaluation_outputs:(null==d?void 0:d.evaluation_outputs)||(null==c?void 0:c.evaluation_outputs),cognitive_decisioning:(null==d?void 0:d.cognitive_decisioning)||(null==c?void 0:c.cognitive_decisioning)}):u(l)}(),isOrphan:!!r}},[ln,fe]),nt=i.useCallback(function(){var e=_n.sectionIdx,n=_n.isOrphan;jn(),wn(),null!==e&&(n?qe("No counterpart exists to connect to."):(zi(e),Fi(),Bi.current&&ji(),Ke([]),nn.current=[],ze(function(n){return n.has(e)?new Set:new Set([e])}),setTimeout(function(){tn.current&&tn.current()},50)))},[_n.sectionIdx,_n.isOrphan,jn,wn,ji]),it=i.useCallback(function(){var e=Je.current;if(e){Je.current=null;var n=Xn.findIndex(function(n){return n.id===e}),i=$n.findIndex(function(n){return n.id===e}),t=-1===n?s.findKeyPathByNodeId(Xn,e):null,o=-1===i?s.findKeyPathByNodeId($n,e):null,r=-1!==n?n:t?Number(t.split("-")[0]):-1,l=-1!==i?i:o?Number(o.split("-")[0]):-1,u=function(e,n,i,t){var o,r,l,s;return-1!==e?null!==(r=null===(o=i.current[e])||void 0===o?void 0:o.current)&&void 0!==r?r:null:n&&null!==(s=null===(l=t.current[n])||void 0===l?void 0:l.current)&&void 0!==s?s:null},a=function(e,n,i){void 0===i&&(i=30);var t=0,o=function(){var r=e();r&&0!==r.getBoundingClientRect().height?(Di.current.add(r),s.scrollAndHighlightClause(r,n)):t++<i&&requestAnimationFrame(o)};requestAnimationFrame(o)};if(De)-1!==r&&gn.current&&a(function(){return u(n,t,li,di)},gn.current),-1!==l&&cn.current&&a(function(){return u(i,o,si,vi)},cn.current);else{var c=un.current;if(!c)return;a(function(){return-1!==r?u(n,t,li,di):u(i,o,si,vi)},c)}}},[Xn,$n,De,li,si,di,vi,gn,cn,un]),tt=i.useCallback(function(n){if(n){Fi(),ji(),ze(new Set),Ke([]),nn.current=[],wn(),On();var i=Xn.findIndex(function(e){return e.id===n}),t=$n.findIndex(function(e){return e.id===n}),o=-1===i?s.findKeyPathByNodeId(Xn,n):null,r=-1===t?s.findKeyPathByNodeId($n,n):null;if(-1!==i||o||-1!==t||r){var l=-1!==i?i:o?Number(o.split("-")[0]):-1,u=-1!==t?t:r?Number(r.split("-")[0]):-1;Je.current=n,Li(function(n){var i,t=e.__assign({},n),o=!1;-1!==l&&(t[i=De?"left-".concat(l):String(l)]||(t[i]=!0,o=!0));-1!==u&&(t[i=De?"right-".concat(u):String(u)]||(t[i]=!0,o=!0));return o?t:n}),Mi(function(n){var i=e.__assign({},n),t=!1,l=function(e){for(var n=e.split("-"),o=n[0],r=1;r<n.length;r++)o+="-".concat(n[r]),i[o]||(i[o]=!0,t=!0)};return o&&l(o),r&&l(r),t?i:n}),setTimeout(function(){requestAnimationFrame(function(){Je.current===n&&ot.current()})},50)}else console.warn('scrollToAndHighlightClause: nodeId "'.concat(n,'" not found'))}},[Xn,$n,De,Li,Mi,ji,wn,On]),ot=i.useRef(it);i.useEffect(function(){ot.current=it},[it]);var rt=i.useRef(null);i.useEffect(function(){if(kn){var e=Pn.fields.find(function(e){return e.analysisKey===kn||e.key===kn});if(e){var n=oi.current[e.key]||ri.current[e.key];(null==n?void 0:n.current)&&setTimeout(function(){return n.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[kn,Pn.fields]);var lt=i.useCallback(function(e){var n,i,t,o,r,l,s,u,a,c=null===(n=null==Wi?void 0:Wi.rule_difference_comparison)||void 0===n?void 0:n.fields;if(!c||!c[e])return{score:0,relation:"",highlightsA:[],highlightsB:[],hasContent:!1};var d=c[e],v=(null==d?void 0:d.relation)||(null===(t=null===(i=null==d?void 0:d.highlights)||void 0===i?void 0:i.ruleA_spans)||void 0===t?void 0:t.length)||(null===(r=null===(o=null==d?void 0:d.highlights)||void 0===o?void 0:o.ruleB_spans)||void 0===r?void 0:r.length)||(null==d?void 0:d.mappings)&&d.mappings.length>0;if(d.mappings){var f=d.mappings[0]||{};return{score:d.score,relation:f.relation||"",highlightsA:(null===(l=f.highlights)||void 0===l?void 0:l.ruleA_spans)||[],highlightsB:(null===(s=f.highlights)||void 0===s?void 0:s.ruleB_spans)||[],hasContent:!!v}}return{score:d.score,relation:d.relation||"",highlightsA:(null===(u=d.highlights)||void 0===u?void 0:u.ruleA_spans)||[],highlightsB:(null===(a=d.highlights)||void 0===a?void 0:a.ruleB_spans)||[],hasContent:!!v}},[Wi]),st=E.useStyleHelpers({proposedSections:Xn,existingSections:$n,maintainRelativeOrder:De,cognitiveMap:ln,deviationData:be,treeData:fe,resolvedComparisonConfig:Pn}),ut=st.getSectionCompareStyle,at=st.getSubSectionCompareStyle,ct=st.getDeviationStyleByKey,dt=B.useLinesCalculator({containerRef:Ye,leftContainerRef:gn,rightContainerRef:cn,svgContainerRef:Ue,pathRefs:en,leftHeaderRef:Xe,rightHeaderRef:$e,proposedSections:Xn,existingSections:$n,visibleFields:Jn,leftRefs:oi,rightRefs:ri,sectionLeftRefs:li,sectionRightRefs:si,subSectionLeftRefs:di,subSectionRightRefs:vi,lhsBadgeRefs:ui,rhsBadgeRefs:ai,sectionRowRefs:fi,expandedSections:ki,expandedSubSections:qi,connectedSections:Ve,isSideBySide:Si,activeSideBySideSection:Ci,maintainRelativeOrder:De,cognitiveMap:ln,getSectionCompareStyle:ut,getSubSectionCompareStyle:at,getDeviationStyleByKey:ct,isArrowVisible:Ri,isAnimatingRef:Qe,isSideBySideRef:Bi,sideBySideCacheRef:Ai,sideBySideLineRef:Ii,activeSideBySideSectionRef:Ti,activeSideBySideRightSectionRef:wi,connectedLines:We,setConnectedLines:Ke,cachedConnectedPositions:nn,calculateLinesRef:tn,resizeTimerRef:on,scrollLock:Ei,handleResizeRef:rn,activeProposed:Un,existingRule:Yn,analysisData:Wi,pendingScrollTargetRef:hn,pendingScrollCallbackRef:mn,resolvedComparisonConfig:Pn,getFieldData:lt}),vt=dt.lines,ft=dt.setLines,pt=dt.overallConnector,gt=dt.setOverallConnector,ht=dt.svgDimensions,mt=dt.handleColumnScroll,St=i.useCallback(function(){Fi(),Li({}),Mi({}),ji(),ze(new Set),Ke([]),nn.current=[],wn(),On(),jn(),requestAnimationFrame(function(){tn.current&&tn.current()})},[Li,Mi,ji,wn,On,jn]),Rt=i.useMemo(function(){return Object.values(ki).some(Boolean)||Object.values(qi).some(Boolean)},[ki,qi]),xt=i.useRef(null),_t=i.useRef(0),yt=i.useRef(0),bt=i.useRef(0),Ct=A.useResizeHandler({timerRef:xt,ruleComponentRef:an,scrollContainerRef:un,containerRef:Ye,maintainRelativeOrder:De,proposedSections:Xn,existingSections:$n,isSideBySideRef:Bi,activeSideBySideSectionRef:Ti,activeSideBySideRightSectionRef:wi,sectionRowRefs:fi,sectionRightRowRefs:ci,sectionLeftRefs:li,sectionRightRefs:si,subSectionLeftRefs:di,subSectionRightRefs:vi,lhsBadgeRefs:ui,rhsBadgeRefs:ai,leftContainerRef:gn,rightContainerRef:cn,calculateLinesRef:tn,handleResizeRef:rn,setIsResizing:yi,setIsArrowVisible:xi,sideBySideCacheRef:Ai,cachedConnectedPositions:nn}).handleResize;i.useEffect(function(){rn.current=Ct},[Ct,rn]),i.useEffect(function(){var e=function(e,n,i,t,o){n.current=e.getBoundingClientRect().width;var r=new ResizeObserver(function(e){null!==i.current&&cancelAnimationFrame(i.current),i.current=requestAnimationFrame(function(){var r,l,s;i.current=null;var u=e[e.length-1];if(u){var a=null!==(s=null===(l=null===(r=u.borderBoxSize)||void 0===r?void 0:r[0])||void 0===l?void 0:l.inlineSize)&&void 0!==s?s:u.contentRect.width;Math.abs(a-n.current)<1?o():(n.current=a,t())}})});return r.observe(e),r},n={current:null},i={current:null},t={current:null},o=[],r=[n,i,t];return an.current&&o.push(e(an.current,_t,n,function(){return rn.current()},function(){})),un.current&&o.push(e(un.current,yt,i,function(){return rn.current()},function(){return tn.current()})),Ye.current&&o.push(e(Ye.current,bt,t,function(){return rn.current()},function(){return tn.current()})),function(){o.forEach(function(e){return e.disconnect()}),r.forEach(function(e){null!==e.current&&(cancelAnimationFrame(e.current),e.current=null)})}},[]),i.useEffect(function(){Bi.current=Si},[Si]),i.useEffect(function(){Ti.current=Ci},[Ci]);var Et=i.useCallback(function(){var e,n=_n.sectionIdx,i=_n.isOrphan;if(wn(),null!=n){var t="left";_n.anchorEl&&(null===(e=cn.current)||void 0===e?void 0:e.contains(_n.anchorEl))&&(t="right"),zi(n),Pi(n,i,{sourceSide:t})}},[Pi,_n.isOrphan,_n.sectionIdx,_n.anchorEl,wn]),At=i.useCallback(function(){wn(),ji(),ze(new Set),Ke([]),nn.current=[]},[wn,ji]),Bt=null!==_n.sectionIdx&&Ve.has(_n.sectionIdx),wt=S.useDeviationNavigation({proposedSections:Xn,existingSections:$n,parentDeviationRecord:Qn,expandedSections:ki,maintainRelativeOrder:!!De,scrollContainerRef:un,leftContainerRef:gn,rightContainerRef:cn,lhsBadgeRefs:ui,rhsBadgeRefs:ai}),Tt=wt.showDeviationNavigation,It=wt.showOpenNodeRef,Dt=wt.adjustScrollForPopup,Ft=i.useCallback(function(e,n,i,t,o){var r,l="string"==typeof t?s.safeStringify(t).trim():s.safeStringify(null==t?void 0:t.deviation_summary).trim(),u=e.currentTarget;On();var a="left";(null===(r=cn.current)||void 0===r?void 0:r.contains(u))&&(a="right");var c=function(){var e,i,t,o;if("string"==typeof n&&n.includes(s.DEVIATION_BADGE_SEPARATOR)){var r=n.split(s.DEVIATION_BADGE_SEPARATOR),l="".concat(r[0]).concat(s.DEVIATION_BADGE_SEPARATOR).concat(r[1]);return"right"===a?null===(e=ai.current[l])||void 0===e?void 0:e.current:null===(i=ui.current[l])||void 0===i?void 0:i.current}return"right"===a?null===(t=ai.current[n])||void 0===t?void 0:t.current:null===(o=ui.current[n])||void 0===o?void 0:o.current},d=function(e,t){var o=!!De,r=o?"right"===a?cn.current:gn.current:un.current,l=o?"right"===a?gn.current:cn.current:null;if(r&&e){var u=function(){var e="string"==typeof n&&n.includes(s.DEVIATION_BADGE_SEPARATOR);i||!e?t():requestAnimationFrame(function(){var e,i,o;Ai.current=null,nn.current=[],Oi(!0,n,null),null===(e=tn.current)||void 0===e||e.call(tn),null===(i=gn.current)||void 0===i||i.dispatchEvent(new Event("scroll")),null===(o=cn.current)||void 0===o||o.dispatchEvent(new Event("scroll")),t()})},c=e.getBoundingClientRect(),d=r.getBoundingClientRect(),v=d.bottom-.35*d.height,f=d.top+.35*d.height;if(c.top>v||c.top<f){var p=d.top+d.height/2,g=c.top+c.height/2-p;o&&l&&s.smoothScrollTo(l,l.scrollTop+g,250,function(){}),s.smoothScrollTo(r,r.scrollTop+g,250,u)}else u()}else t()};return i?(ji(),ze(new Set),Ke([]),nn.current=[],void(l&&(zi(n),requestAnimationFrame(function(){var e=c()||u;d(e,function(){Bn({open:!0,anchorEl:e,summary:t,displayImpact:o})})})))):(zi(n),l?void Pi(n,i,{toggleIfSame:!1,sourceSide:a,onReady:function(){var e=c()||u;d(e,function(){Bn({open:!0,anchorEl:e,summary:t,displayImpact:o})})}}):(zi(n),void requestAnimationFrame(function(){requestAnimationFrame(function(){Pi(n,i,{toggleIfSame:!1,sourceSide:a})})})))},[Pi,On,Bn,ji,De]),Ot=i.useMemo(function(){var e;if(!Ce)return null;var n=null===(e=null==Ce?void 0:Ce.id)||void 0===e?void 0:e.split(":")[0];for(var i in Qn){if((Qn[i]||[]).some(function(e){return e.id===n}))return i}return null},[Ce,Qn]),jt=i.useRef({id:null,triggerMs:null}),Pt=i.useRef(null);i.useEffect(function(){var n;if(null==Ce?void 0:Ce.id){var i=Number(Ce.trigger),t=jt.current;if((null==t?void 0:t.triggerMs)!==i){if(!(Ce.id.includes(":")&&/:\d+$/.test(Ce.id)))return jt.current={id:Ce.id,triggerMs:i},void tt(Ce.id);var o=null===(n=null==Ce?void 0:Ce.id)||void 0===n?void 0:n.split(":"),r=o[0],l=o[1],u=null!=l?l:"0";Pt.current!==Ce.id&&(wn(),On(),ji(),ze(new Set),Ke([]),nn.current=[],Pt.current=Ce.id);var a=!1,c=0,d=null,v=150,f=function(e,n){for(var i=function(e,t){if(!e)return null;if(e.id===n)return t;if(!Array.isArray(e.subsections))return null;for(var o=0;o<e.subsections.length;o++){var r=i(e.subsections[o],"".concat(t,"-").concat(o));if(r)return r}return null},t=0;t<e.length;t++){var o=i(e[t],String(t));if(o)return o}return null},p=function(){var n,t,o,l;if(!a){var g=function(){jt.current={id:Ce.id,triggerMs:i}},h=null,m=null;for(var S in Qn){var R=Qn[S].find(function(e){return e.id===r});if(R){h=S,m=R;break}}if(m&&h){var x=Xn.findIndex(function(e){return e.id===h}),_=$n.findIndex(function(e){return e.id===h}),y=-1===x&&-1!==_,b=f(Xn,m.id),C=f($n,m.id);if(b&&!C&&!y){var E=b.split("-"),A=Number(E[0]);if(De){var B=null===(t=null===(n=Xn[A])||void 0===n?void 0:n.refIndexes)||void 0===t?void 0:t[0],w=$n.findIndex(function(e){return e.selfIndex===B});-1!==w&&(A=w)}C=e.__spreadArray([A],E.slice(1),!0).join("-")}if(b||C){var T=b?Number(b.split("-")[0]):x,I=C?Number(C.split("-")[0]):_,D=Xn[T],F=$n[I],O=D&&!D.title&&!D.content,j=F&&!F.title&&!F.content,P=y||(!b&&!!C||O&&!j);if(P){if(!(De?!!ki["right-".concat(I)]:!!ki[String(I)])&&I>=0)return Vi(I,"right"),c+=1,void(d=setTimeout(p,450))}else if(!(De?!!ki["left-".concat(T)]:!!ki[String(T)])&&T>=0)return Vi(T,"left"),c+=1,void(d=setTimeout(p,450));var N,k=b||"",L=C||"",q="".concat(m.id).concat(s.DEVIATION_BADGE_SEPARATOR).concat(u).concat(s.DEVIATION_BADGE_SEPARATOR).concat(k).concat(s.DEVIATION_BADGE_SEPARATOR).concat(L),M="".concat(m.id).concat(s.DEVIATION_BADGE_SEPARATOR).concat(u),H=null===(o=ui.current[M])||void 0===o?void 0:o.current,V=null===(l=ai.current[M])||void 0===l?void 0:l.current,z=P||!H&&!!V,G=z?V:H;if(N=De?z?cn.current:gn.current:un.current,G&&N){var W=G.getBoundingClientRect();if(0===W.height)return void((c+=1)<2?d=setTimeout(p,v):g());var K=N.getBoundingClientRect(),U=W.top-K.top+N.scrollTop-K.height/2+W.height/2,Y=b&&b.includes("-")||C&&C.includes("-"),X=function(){var n,i,t,o,r;if(!a){g();var l=G instanceof Element?window.getComputedStyle(G).color:"";H&&(H.style.transition="box-shadow 300ms ease-in-out",H.style.boxShadow="0 0 10px ".concat(l)),V&&(V.style.transition="box-shadow 300ms ease-in-out",V.style.boxShadow="0 0 10px ".concat(l)),setTimeout(function(){H&&(H.style.boxShadow=""),V&&(V.style.boxShadow="")},2e3);var s=(null===(i=null===(n=m.evaluationResult)||void 0===n?void 0:n.deviations)||void 0===i?void 0:i[u])||m,c=(null===(t=m.evaluationResult)||void 0===t?void 0:t.evaluation_outputs)||m.evaluation_outputs;if(!(!!H&&!!V)){var d=z?(null===(o=ai.current[Y?M:I])||void 0===o?void 0:o.current)||V:(null===(r=ui.current[Y?M:T])||void 0===r?void 0:r.current)||H;return Dt(d,function(){Bn({open:!0,anchorEl:d,displayImpact:Ce.displayImpact,summary:e.__assign(e.__assign({},s),{evaluation_outputs:c})})},{skipScroll:!0}),void(null==Ee||Ee())}Pi(q,!1,{toggleIfSame:!1,sourceSide:z?"right":"left",onReady:function(){var n,i,t=z?(null===(n=ai.current[M])||void 0===n?void 0:n.current)||V:(null===(i=ui.current[M])||void 0===i?void 0:i.current)||H;Dt(t,function(){requestAnimationFrame(function(){var n,i,o;Ai.current=null,nn.current=[],null===(n=tn.current)||void 0===n||n.call(tn),null===(i=gn.current)||void 0===i||i.dispatchEvent(new Event("scroll")),null===(o=cn.current)||void 0===o||o.dispatchEvent(new Event("scroll")),Bn({open:!0,anchorEl:t,displayImpact:null==Ce?void 0:Ce.displayImpact,summary:e.__assign({},s)})})},{skipScroll:!0})}})}};Math.abs(N.scrollTop-U)<=2?X():(hn.current=U,mn.current=X,N.scrollTo({top:U,behavior:"smooth"}),d&&clearTimeout(d),d=setTimeout(function(){if(mn.current){hn.current=null;var e=mn.current;mn.current=null,e()}},800))}else(c+=1)<2?d=setTimeout(p,v):g()}else(c+=1)<2?d=setTimeout(p,v):g()}else(c+=1)<2?d=setTimeout(p,v):g()}};return d=setTimeout(p,v),function(){a=!0,d&&clearTimeout(d)}}}},[Ce,Qn,Xn,$n,De,ki,Vi,Pi,Bn,tt]);var Nt={maintainRelativeOrder:!!De,showDeviationBadges:Oe,isProposingFix:Be,proposingFixNodeId:we,isRedlineFlow:Te,isSideBySide:Si,activeSideBySideSection:Ci,connectedSections:Ve,proposedSections:Xn,existingSections:$n,deviationNumberRegistry:Zn,treeData:fe,displayConfig:xe,resolvedMarkdownStyles:sn,unifiedNumbering:Gi,expandedSections:ki,expandedSubSections:qi,setExpandedSubSections:Mi,getSectionCompareStyle:ut,getSubSectionCompareStyle:at,getBadgeRef:hi,getSectionRowRef:pi,getSubSectionRef:gi,sectionLeftRefs:li,sectionRightRefs:si,sectionRowRefs:fi,sectionRightRowRefs:ci,subSectionLeftRefs:di,subSectionRightRefs:vi,lhsBadgeRefs:ui,rhsBadgeRefs:ai,openMoreFunctionsPopup:function(e,n,i,t,o,r){var l;if(e.stopPropagation(),_n.open&&_n.sectionIdx===o)jn();else{var u=e.currentTarget,a="left";(null===(l=cn.current)||void 0===l?void 0:l.contains(u))&&(a="right");Fi(),Bi.current&&ji(),ze(new Set),Ke([]),nn.current=[],On(),An.open?At():wn(),requestAnimationFrame(function(){var e=function(){var e,n,i,t;if("string"==typeof o&&o.includes(s.DEVIATION_BADGE_SEPARATOR)){var r=o.split(s.DEVIATION_BADGE_SEPARATOR),l="".concat(r[0]).concat(s.DEVIATION_BADGE_SEPARATOR).concat(r[1]);return"right"===a?null===(e=ai.current[l])||void 0===e?void 0:e.current:null===(n=ui.current[l])||void 0===n?void 0:n.current}return"right"===a?null===(i=ai.current[o])||void 0===i?void 0:i.current:null===(t=ui.current[o])||void 0===t?void 0:t.current}()||u;yn(et(e,n,t,o,i,r))})}},handleOpenSummaryPopup:Ft,openSummaryPopup:Ft,handleCloseSummaryPopup:At,toggleSection:Vi,handleSubSectionToggle:Hi,renderSubSectionAccordion:function(e){var i=e.section,t=e.keyPath,o=e.depth,r=void 0===o?0:o,l=e.columnKey,s=void 0===l?"left":l,u=e.parentNodeId,a=void 0===u?"":u,c=e.sectionOffset;return n.jsx(x.default,{section:i,keyPath:t,depth:r,columnKey:s,parentNodeId:a,sectionOffset:c})},resetSideBySide:ji,setConnectedSections:ze,setConnectedLines:Ke,cachedConnectedPositions:nn,showDeviationNavigation:Tt,showOpenNodeRef:It,deviationNodeIdToView:null==Ce?void 0:Ce.id,deviationTargetParentId:Ot};return n.jsx(C.CompareContextProvider,e.__assign({value:Nt},{children:n.jsxs(t.Box,e.__assign({ref:an,sx:e.__assign(e.__assign({display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif'},De?{}:{overflow:"visible"}),{position:"relative"})},{children:[Pe&&n.jsx(t.Box,e.__assign({sx:{position:"absolute",inset:0,bgcolor:"rgba(255, 255, 255, 0.6)",backdropFilter:"blur(10px)",zIndex:9999,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"8px"}},{children:n.jsx(v.default,{})})),An.open&&n.jsx(b.default,{open:An.open,anchorEl:An.anchorEl,containerEl:rt.current,clipTopEl:Xe.current,scrollContainerEl:un.current,onClose:At,summary:An.summary,displayImpact:An.displayImpact}),n.jsx(d.default,{open:_n.open,anchorEl:_n.anchorEl,sectionTitle:_n.sectionTitle,referenceSectionTitle:_n.refSectionTitle,onClose:jn,onOpenCognitiveCompare:Dn,onOpenSideBySide:Et,onConnect:nt,isConnected:Bt,isOrphan:_n.isOrphan}),Rn.open&&n.jsx(c.default,{open:Rn.open,popupRef:In,position:bn,popupConfig:_e,onClose:function(){Cn(null),xn(function(n){return e.__assign(e.__assign({},n),{open:!1})}),Tn(null)},markdownStyles:me,sectionTitle:Vn,referenceSectionTitle:Gn,cognitiveData:Rn.cognitiveData,anchorEl:Rn.anchorEl,sectionAnchorEl:Rn.sectionAnchorEl,scrollContainerEl:un.current,badgeStyle:Rn.badgeStyle,docData:Rn.docData,deviationData:Rn.deviationData,isLoading:Rn.isLoading}),n.jsx(t.Snackbar,e.__assign({open:!!Le,autoHideDuration:8e3,onClose:function(){return qe(null)},anchorOrigin:{vertical:"top",horizontal:"center"}},{children:n.jsx(t.Alert,e.__assign({onClose:function(){return qe(null)},severity:"error",sx:{width:"100%",whiteSpace:"pre-line"}},{children:Le}))})),n.jsx(R.default,{componentHeaderText:ve,displayConfig:xe,maintainRelativeOrder:De,onCollapseAll:St,showCollapseAll:Rt,onToggleView:function(e){Ne(!0),setTimeout(function(){Fe(!e),ji(),wn(),ze(new Set),Ke([]),nn.current=[],requestAnimationFrame(function(){requestAnimationFrame(function(){setTimeout(function(){Ne(!1)},600)})})},50)}}),n.jsx(t.Box,e.__assign({ref:un,onScroll:mt,sx:{flex:1,minHeight:0,pt:1.5,pb:1,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",overflowY:De?"hidden":"auto",borderTop:Ki&&Ui?"none":"1.5px solid #EEF0F4"}},{children:n.jsx(t.Box,e.__assign({sx:e.__assign({display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"},De?{flex:1,minHeight:0}:{})},{children:n.jsxs(t.Box,e.__assign({ref:Ye,sx:e.__assign({display:"grid",gridTemplateColumns:"minmax(0, 1fr) 180px minmax(0, 1fr)",gap:"60px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0},De?{flex:1,overflow:"visible"}:{})},{children:[n.jsx(T.default,{svgContainerRef:Ue,svgDimensions:ht,isResizing:_i,overallConnector:pt,rootDeviationStyle:Ji,lines:vt,isSideBySide:Si,activeSideBySideSection:Ci,isArrowVisible:Ri,maintainRelativeOrder:De,proposedSections:Xn,existingSections:$n,cognitivePopup:Rn,activeBadgeId:En,closeCognitivePopup:On,setActiveBadgeId:Tn,openCognitivePopupFromState:Fn,buildSectionPopupState:et,connectedLines:We,pathRefs:en}),n.jsxs(t.Box,e.__assign({sx:e.__assign({border:"1px solid #E7E7E9",borderRadius:"8px",bgcolor:"#FFFFFF",display:"flex",flexDirection:"column",position:"relative",zIndex:2,filter:"drop-shadow(0px 2px 4px #F2F2F2)"},De?{flex:1,overflow:"visible"}:{})},{children:[n.jsx(t.Box,e.__assign({ref:Xe,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E7E7E9",borderRadius:"8px 8px 0 0",display:"flex",alignItems:"center",minHeight:"40px",overflow:"hidden",minWidth:0}},{children:n.jsx(t.Tooltip,e.__assign({title:Mn,placement:"top"},{children:n.jsx(t.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:500,color:"#19213D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0,textAlign:"center",display:"block"}},{children:Mn}))}))})),n.jsxs(t.Box,e.__assign({ref:gn,onScroll:mt,sx:e.__assign({p:"12px",display:"flex",flexDirection:"column"},De?{maxHeight:"calc(100vh - 150px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,mr:"-160px",pr:"172px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[n.jsx("div",{ref:fn,style:{width:"100%",height:"0px",flexShrink:0}}),ni&&Xn.map(function(e,i){return n.jsx(_.default,{section:e,idx:i},"left-row-".concat(i))}),n.jsx("div",{ref:pn,style:{width:"100%",height:"0px",flexShrink:0}})]}))]})),n.jsx(t.Box,e.__assign({ref:rt,sx:{width:"180px",display:"flex",flexDirection:"column",alignItems:"center",pt:"15px",gap:0,zIndex:20,pointerEvents:"none"}},{children:n.jsx(t.Box,e.__assign({sx:{display:"flex",justifyContent:"center",alignItems:"center",mt:0}},{children:n.jsxs(t.Box,e.__assign({onClick:function(n){n.stopPropagation(),Rn.open&&En===Yi?On():(Tn(Yi),Fn(et(n.currentTarget,{title:"",content:"",evaluationResult:Xi,cognitiveData:{section_id:"",decisioning:[],gap:[],relevance_score:0,isMissingRationale:!0}},null,Yi,!0,e.__assign(e.__assign({},Ji),{label:""}))))},sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:"5px",top:"-8px",borderRadius:"20px",bgcolor:Ji.badgeBg,color:Ji.badgeText,border:"1px solid ".concat(Ji.badgeBorder),fontSize:"12px",fontWeight:600,whiteSpace:"nowrap",position:"relative",zIndex:1,pointerEvents:"auto",cursor:"pointer"}},{children:[null!=$i?$i:n.jsx(f.default,{}),n.jsx(t.Box,e.__assign({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:n.jsx(r.ButtonCognitiveIcon,{})})),n.jsx(o.ChevronDown,{size:11,style:{transform:Rn.open&&En===Yi?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))})),n.jsxs(t.Box,e.__assign({sx:e.__assign({border:"1px solid #E3E6EA",borderRadius:"8px",bgcolor:"#FFFFFF",boxShadow:"0px 1px 4px #F7F4FE",position:"relative",zIndex:2,display:"flex",flexDirection:"column",minWidth:0},De?{flex:1,overflow:"visible",minHeight:0}:{})},{children:[bi&&n.jsx(l.default,{sections:11}),n.jsx(t.Box,e.__assign({ref:$e,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E3E6EA",borderRadius:"8px 8px 0 0",minHeight:"40px",display:"flex",alignItems:"center",overflowX:"hidden"}},{children:n.jsx(t.Tooltip,e.__assign({title:Wn,placement:"top"},{children:n.jsx(t.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:500,color:"#5928ED",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0,textAlign:"center",display:"block"}},{children:Wn}))}))})),n.jsxs(t.Box,e.__assign({ref:cn,onScroll:mt,sx:e.__assign({p:"12px",display:"flex",flexDirection:"column"},De?{maxHeight:"calc(100vh - 150px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,ml:"-150px",pl:"165px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[n.jsx("div",{ref:dn,style:{width:"100%",height:"0px",flexShrink:0}}),ni&&$n.map(function(e,i){return n.jsx(y.default,{section:e,idx:i},"right-row-".concat(i))}),n.jsx("div",{ref:vn,style:{width:"100%",height:"0px",flexShrink:0}})]}))]}))]}))}))}))]}))}))};
|
|
2
2
|
//# sourceMappingURL=CognitiveCompare.js.map
|