@viswa-test/test-citation 0.0.285 → 0.0.287

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.
Files changed (214) hide show
  1. package/README.md +5 -3
  2. package/dist/assests/icons/InfoAlert.js +2 -0
  3. package/dist/assests/icons/InfoAlert.js.map +1 -0
  4. package/dist/cjs/assests/icons/InfoAlert.js +2 -0
  5. package/dist/cjs/assests/icons/InfoAlert.js.map +1 -0
  6. package/dist/cjs/features/CognitiveCompare/CitationAnchor.js +1 -1
  7. package/dist/cjs/features/CognitiveCompare/CognitiveCompare.js +1 -1
  8. package/dist/cjs/features/CognitiveCompare/CognitiveComparehelpers.js +1 -1
  9. package/dist/cjs/features/CognitiveCompare/CognitivePopup.js +1 -1
  10. package/dist/cjs/features/CognitiveCompare/Guidelines/components/GuidelinePanel.js +1 -1
  11. package/dist/cjs/features/CognitiveCompare/Guidelines/utils/processGuidelinesMarkdown.js +1 -1
  12. package/dist/cjs/features/CognitiveCompare/components/LHSSectionRow.js +1 -1
  13. package/dist/cjs/features/CognitiveCompare/components/SectionAccordion.js +1 -1
  14. package/dist/cjs/features/CognitiveCompare/components/SubSectionAccordion.js +1 -1
  15. package/dist/cjs/features/CognitiveCompare/hooks/memoizedMarkdown.js +1 -1
  16. package/dist/cjs/features/CognitiveCompare/hooks/useCompareData.js +1 -1
  17. package/dist/cjs/features/CognitiveCompare/hooks/useLinesCalculator.js +1 -1
  18. package/dist/cjs/features/CognitiveInternalgptReasoning/CognitiveInternalgptCoreComponent.js +1 -1
  19. package/dist/cjs/features/GptWebCitation/GptWebCitation.js +1 -1
  20. package/dist/cjs/features/GptWebCitation/GptWebCitationImageCitation.js +1 -1
  21. package/dist/cjs/features/PdfViewer/PdfContainer.js +1 -1
  22. package/dist/cjs/features/PdfViewer/PdfToolbar.js +1 -1
  23. package/dist/cjs/features/PdfViewer/PdfViewer.js +1 -1
  24. package/dist/cjs/features/PdfViewer/nyc-components/BoundaryCard.js +2 -0
  25. package/dist/cjs/features/PdfViewer/nyc-components/BoundaryCard.js.map +1 -0
  26. package/dist/cjs/features/PdfViewer/nyc-components/CardWrapper.js +2 -0
  27. package/dist/cjs/features/PdfViewer/nyc-components/CardWrapper.js.map +1 -0
  28. package/dist/cjs/features/PdfViewer/nyc-components/CognitiveIcon.js +2 -0
  29. package/dist/cjs/features/PdfViewer/nyc-components/CognitiveIcon.js.map +1 -0
  30. package/dist/cjs/features/PdfViewer/nyc-components/LabelCheck.js +2 -0
  31. package/dist/cjs/features/PdfViewer/nyc-components/LabelCheck.js.map +1 -0
  32. package/dist/cjs/features/PdfViewer/nyc-components/SegmentReviewPdfWrapper.js +2 -0
  33. package/dist/cjs/features/PdfViewer/nyc-components/SegmentReviewPdfWrapper.js.map +1 -0
  34. package/dist/cjs/features/PdfViewer/nyc-components/infoAlert.js +2 -0
  35. package/dist/cjs/features/PdfViewer/nyc-components/infoAlert.js.map +1 -0
  36. package/dist/cjs/features/PdfViewer/nyc-components/reviewStepAdapters.js +2 -0
  37. package/dist/cjs/features/PdfViewer/nyc-components/reviewStepAdapters.js.map +1 -0
  38. package/dist/cjs/features/PromptemonBlockViewer/PromptemonBlockViewer.js +1 -1
  39. package/dist/cjs/features/PromptemonViewer/PromptemonViewer.js +1 -1
  40. package/dist/cjs/features/SPBAnalysisPanel/Cognitivereasoningpanel.js +2 -0
  41. package/dist/cjs/features/SPBAnalysisPanel/Cognitivereasoningpanel.js.map +1 -0
  42. package/dist/cjs/features/SPBAnalysisPanel/DependencyGraph.js +2 -0
  43. package/dist/cjs/features/SPBAnalysisPanel/DependencyGraph.js.map +1 -0
  44. package/dist/cjs/features/SPBAnalysisPanel/Internaleditor.js +2 -0
  45. package/dist/cjs/features/SPBAnalysisPanel/Internaleditor.js.map +1 -0
  46. package/dist/cjs/features/SPBAnalysisPanel/Markdownrenderer.js +2 -0
  47. package/dist/cjs/features/SPBAnalysisPanel/Markdownrenderer.js.map +1 -0
  48. package/dist/cjs/features/SPBAnalysisPanel/Spbanalysispanel.js +2 -0
  49. package/dist/cjs/features/SPBAnalysisPanel/Spbanalysispanel.js.map +1 -0
  50. package/dist/cjs/features/SegmentReviewComponents/BoundaryCard.js +2 -0
  51. package/dist/cjs/features/SegmentReviewComponents/BoundaryCard.js.map +1 -0
  52. package/dist/cjs/features/SegmentReviewComponents/CardWrapper.js +2 -0
  53. package/dist/cjs/features/SegmentReviewComponents/CardWrapper.js.map +1 -0
  54. package/dist/cjs/features/SegmentReviewComponents/CognitiveIcon.js +2 -0
  55. package/dist/cjs/features/SegmentReviewComponents/CognitiveIcon.js.map +1 -0
  56. package/dist/cjs/features/SegmentReviewComponents/LabelCheck.js +2 -0
  57. package/dist/cjs/features/SegmentReviewComponents/LabelCheck.js.map +1 -0
  58. package/dist/cjs/features/SegmentReviewComponents/SegmentReviewPdfWrapper.js +2 -0
  59. package/dist/cjs/features/SegmentReviewComponents/SegmentReviewPdfWrapper.js.map +1 -0
  60. package/dist/cjs/features/SegmentReviewComponents/reviewStepAdapters.js +2 -0
  61. package/dist/cjs/features/SegmentReviewComponents/reviewStepAdapters.js.map +1 -0
  62. package/dist/cjs/hooks/useOnDemandCitationFetch.js +1 -1
  63. package/dist/cjs/index.js +1 -1
  64. package/dist/cjs/service/onDemandApi.js +1 -1
  65. package/dist/features/CognitiveCompare/CitationAnchor.js +1 -1
  66. package/dist/features/CognitiveCompare/CognitiveCompare.js +1 -1
  67. package/dist/features/CognitiveCompare/CognitiveComparehelpers.js +1 -1
  68. package/dist/features/CognitiveCompare/CognitivePopup.js +1 -1
  69. package/dist/features/CognitiveCompare/Guidelines/components/GuidelinePanel.js +1 -1
  70. package/dist/features/CognitiveCompare/Guidelines/utils/processGuidelinesMarkdown.js +1 -1
  71. package/dist/features/CognitiveCompare/components/LHSSectionRow.js +1 -1
  72. package/dist/features/CognitiveCompare/components/SectionAccordion.js +1 -1
  73. package/dist/features/CognitiveCompare/components/SubSectionAccordion.js +1 -1
  74. package/dist/features/CognitiveCompare/hooks/memoizedMarkdown.js +1 -1
  75. package/dist/features/CognitiveCompare/hooks/useCompareData.js +1 -1
  76. package/dist/features/CognitiveCompare/hooks/useLinesCalculator.js +1 -1
  77. package/dist/features/CognitiveInternalgptReasoning/CognitiveInternalgptCoreComponent.js +1 -1
  78. package/dist/features/GptWebCitation/GptWebCitation.js +1 -1
  79. package/dist/features/GptWebCitation/GptWebCitationImageCitation.js +1 -1
  80. package/dist/features/PdfViewer/PdfContainer.js +1 -1
  81. package/dist/features/PdfViewer/PdfToolbar.js +1 -1
  82. package/dist/features/PdfViewer/PdfViewer.js +1 -1
  83. package/dist/features/PdfViewer/nyc-components/BoundaryCard.js +2 -0
  84. package/dist/features/PdfViewer/nyc-components/BoundaryCard.js.map +1 -0
  85. package/dist/features/PdfViewer/nyc-components/CardWrapper.js +2 -0
  86. package/dist/features/PdfViewer/nyc-components/CardWrapper.js.map +1 -0
  87. package/dist/features/PdfViewer/nyc-components/CognitiveIcon.js +2 -0
  88. package/dist/features/PdfViewer/nyc-components/CognitiveIcon.js.map +1 -0
  89. package/dist/features/PdfViewer/nyc-components/LabelCheck.js +2 -0
  90. package/dist/features/PdfViewer/nyc-components/LabelCheck.js.map +1 -0
  91. package/dist/features/PdfViewer/nyc-components/SegmentReviewPdfWrapper.js +2 -0
  92. package/dist/features/PdfViewer/nyc-components/SegmentReviewPdfWrapper.js.map +1 -0
  93. package/dist/features/PdfViewer/nyc-components/infoAlert.js +2 -0
  94. package/dist/features/PdfViewer/nyc-components/infoAlert.js.map +1 -0
  95. package/dist/features/PdfViewer/nyc-components/reviewStepAdapters.js +2 -0
  96. package/dist/features/PdfViewer/nyc-components/reviewStepAdapters.js.map +1 -0
  97. package/dist/features/PromptemonBlockViewer/PromptemonBlockViewer.js +1 -1
  98. package/dist/features/PromptemonViewer/PromptemonViewer.js +1 -1
  99. package/dist/features/SPBAnalysisPanel/Cognitivereasoningpanel.js +2 -0
  100. package/dist/features/SPBAnalysisPanel/Cognitivereasoningpanel.js.map +1 -0
  101. package/dist/features/SPBAnalysisPanel/DependencyGraph.js +2 -0
  102. package/dist/features/SPBAnalysisPanel/DependencyGraph.js.map +1 -0
  103. package/dist/features/SPBAnalysisPanel/Internaleditor.js +2 -0
  104. package/dist/features/SPBAnalysisPanel/Internaleditor.js.map +1 -0
  105. package/dist/features/SPBAnalysisPanel/Markdownrenderer.js +2 -0
  106. package/dist/features/SPBAnalysisPanel/Markdownrenderer.js.map +1 -0
  107. package/dist/features/SPBAnalysisPanel/Spbanalysispanel.js +2 -0
  108. package/dist/features/SPBAnalysisPanel/Spbanalysispanel.js.map +1 -0
  109. package/dist/features/SegmentReviewComponents/BoundaryCard.js +2 -0
  110. package/dist/features/SegmentReviewComponents/BoundaryCard.js.map +1 -0
  111. package/dist/features/SegmentReviewComponents/CardWrapper.js +2 -0
  112. package/dist/features/SegmentReviewComponents/CardWrapper.js.map +1 -0
  113. package/dist/features/SegmentReviewComponents/CognitiveIcon.js +2 -0
  114. package/dist/features/SegmentReviewComponents/CognitiveIcon.js.map +1 -0
  115. package/dist/features/SegmentReviewComponents/LabelCheck.js +2 -0
  116. package/dist/features/SegmentReviewComponents/LabelCheck.js.map +1 -0
  117. package/dist/features/SegmentReviewComponents/SegmentReviewPdfWrapper.js +2 -0
  118. package/dist/features/SegmentReviewComponents/SegmentReviewPdfWrapper.js.map +1 -0
  119. package/dist/features/SegmentReviewComponents/reviewStepAdapters.js +2 -0
  120. package/dist/features/SegmentReviewComponents/reviewStepAdapters.js.map +1 -0
  121. package/dist/hooks/useOnDemandCitationFetch.js +1 -1
  122. package/dist/index.js +1 -1
  123. package/dist/service/onDemandApi.js +1 -1
  124. package/dist/types/src/PdfViewerTest.d.ts.map +1 -1
  125. package/dist/types/src/Spbanalysispaneltest.d.ts.map +1 -1
  126. package/dist/types/src/assests/icons/InfoAlert.d.ts +3 -0
  127. package/dist/types/src/assests/icons/InfoAlert.d.ts.map +1 -0
  128. package/dist/types/src/features/CognitiveCompare/CitationAnchor.d.ts.map +1 -1
  129. package/dist/types/src/features/CognitiveCompare/CognitiveCompare.d.ts +1 -1
  130. package/dist/types/src/features/CognitiveCompare/CognitiveCompare.d.ts.map +1 -1
  131. package/dist/types/src/features/CognitiveCompare/CognitiveCompareConstants.d.ts +0 -1
  132. package/dist/types/src/features/CognitiveCompare/CognitiveCompareConstants.d.ts.map +1 -1
  133. package/dist/types/src/features/CognitiveCompare/CognitiveCompareTypes.d.ts +1 -1
  134. package/dist/types/src/features/CognitiveCompare/CognitiveCompareTypes.d.ts.map +1 -1
  135. package/dist/types/src/features/CognitiveCompare/CognitiveComparehelpers.d.ts +0 -12
  136. package/dist/types/src/features/CognitiveCompare/CognitiveComparehelpers.d.ts.map +1 -1
  137. package/dist/types/src/features/CognitiveCompare/Guidelines/components/GuidelinePanel.d.ts.map +1 -1
  138. package/dist/types/src/features/CognitiveCompare/Guidelines/constants/guidelines.mockData.d.ts +970 -2213
  139. package/dist/types/src/features/CognitiveCompare/Guidelines/constants/guidelines.mockData.d.ts.map +1 -1
  140. package/dist/types/src/features/CognitiveCompare/Guidelines/utils/helper.d.ts +5 -0
  141. package/dist/types/src/features/CognitiveCompare/Guidelines/utils/helper.d.ts.map +1 -1
  142. package/dist/types/src/features/CognitiveCompare/Guidelines/utils/processGuidelinesMarkdown.d.ts +1 -14
  143. package/dist/types/src/features/CognitiveCompare/Guidelines/utils/processGuidelinesMarkdown.d.ts.map +1 -1
  144. package/dist/types/src/features/CognitiveCompare/components/LHSSectionRow.d.ts.map +1 -1
  145. package/dist/types/src/features/CognitiveCompare/components/SectionAccordion.d.ts.map +1 -1
  146. package/dist/types/src/features/CognitiveCompare/components/SubSectionAccordion.d.ts.map +1 -1
  147. package/dist/types/src/features/CognitiveCompare/hooks/memoizedMarkdown.d.ts +0 -11
  148. package/dist/types/src/features/CognitiveCompare/hooks/memoizedMarkdown.d.ts.map +1 -1
  149. package/dist/types/src/features/CognitiveCompare/hooks/useCompareData.d.ts +1 -1
  150. package/dist/types/src/features/CognitiveCompare/hooks/useCompareData.d.ts.map +1 -1
  151. package/dist/types/src/features/CognitiveCompare/hooks/useCompareLayout.d.ts +0 -1
  152. package/dist/types/src/features/CognitiveCompare/hooks/useCompareLayout.d.ts.map +1 -1
  153. package/dist/types/src/features/CognitiveCompare/hooks/useLinesCalculator.d.ts.map +1 -1
  154. package/dist/types/src/features/CognitiveInternalgptReasoning/CognitiveInternalgptCoreComponent.d.ts +0 -1
  155. package/dist/types/src/features/CognitiveInternalgptReasoning/CognitiveInternalgptCoreComponent.d.ts.map +1 -1
  156. package/dist/types/src/features/GptWebCitation/GptWebCitation.d.ts.map +1 -1
  157. package/dist/types/src/features/GptWebCitation/GptWebCitationImageCitation.d.ts +1 -2
  158. package/dist/types/src/features/GptWebCitation/GptWebCitationImageCitation.d.ts.map +1 -1
  159. package/dist/types/src/features/GptWebCitation/types.d.ts +0 -4
  160. package/dist/types/src/features/GptWebCitation/types.d.ts.map +1 -1
  161. package/dist/types/src/features/PdfViewer/PdfContainer.d.ts +5 -3
  162. package/dist/types/src/features/PdfViewer/PdfContainer.d.ts.map +1 -1
  163. package/dist/types/src/features/PdfViewer/PdfToolbar.d.ts +7 -2
  164. package/dist/types/src/features/PdfViewer/PdfToolbar.d.ts.map +1 -1
  165. package/dist/types/src/features/PdfViewer/PdfViewer.d.ts +24 -2
  166. package/dist/types/src/features/PdfViewer/PdfViewer.d.ts.map +1 -1
  167. package/dist/types/src/features/PdfViewer/nyc-components/BoundaryCard.d.ts +59 -0
  168. package/dist/types/src/features/PdfViewer/nyc-components/BoundaryCard.d.ts.map +1 -0
  169. package/dist/types/src/features/PdfViewer/nyc-components/CardWrapper.d.ts +19 -0
  170. package/dist/types/src/features/PdfViewer/nyc-components/CardWrapper.d.ts.map +1 -0
  171. package/dist/types/src/features/PdfViewer/nyc-components/CognitiveIcon.d.ts +3 -0
  172. package/dist/types/src/features/PdfViewer/nyc-components/CognitiveIcon.d.ts.map +1 -0
  173. package/dist/types/src/features/PdfViewer/nyc-components/LabelCheck.d.ts +77 -0
  174. package/dist/types/src/features/PdfViewer/nyc-components/LabelCheck.d.ts.map +1 -0
  175. package/dist/types/src/features/PdfViewer/nyc-components/SegmentReviewPdfWrapper.d.ts +47 -0
  176. package/dist/types/src/features/PdfViewer/nyc-components/SegmentReviewPdfWrapper.d.ts.map +1 -0
  177. package/dist/types/src/features/PdfViewer/nyc-components/index.d.ts +15 -0
  178. package/dist/types/src/features/PdfViewer/nyc-components/index.d.ts.map +1 -0
  179. package/dist/types/src/features/PdfViewer/nyc-components/infoAlert.d.ts +3 -0
  180. package/dist/types/src/features/PdfViewer/nyc-components/infoAlert.d.ts.map +1 -0
  181. package/dist/types/src/features/PdfViewer/nyc-components/reviewStepAdapters.d.ts +36 -0
  182. package/dist/types/src/features/PdfViewer/nyc-components/reviewStepAdapters.d.ts.map +1 -0
  183. package/dist/types/src/features/PromptemonBlockViewer/PromptemonBlockViewer.d.ts +15 -2
  184. package/dist/types/src/features/PromptemonBlockViewer/PromptemonBlockViewer.d.ts.map +1 -1
  185. package/dist/types/src/features/SPBAnalysisPanel/DependencyGraph.d.ts +11 -2
  186. package/dist/types/src/features/SPBAnalysisPanel/DependencyGraph.d.ts.map +1 -1
  187. package/dist/types/src/features/SPBAnalysisPanel/Markdownrenderer.d.ts +5 -1
  188. package/dist/types/src/features/SPBAnalysisPanel/Markdownrenderer.d.ts.map +1 -1
  189. package/dist/types/src/features/SPBAnalysisPanel/Spbanalysispanel.d.ts +80 -1
  190. package/dist/types/src/features/SPBAnalysisPanel/Spbanalysispanel.d.ts.map +1 -1
  191. package/dist/types/src/features/SPBAnalysisPanel/index.d.ts +1 -1
  192. package/dist/types/src/features/SPBAnalysisPanel/index.d.ts.map +1 -1
  193. package/dist/types/src/features/SegmentReviewComponents/BoundaryCard.d.ts +59 -0
  194. package/dist/types/src/features/SegmentReviewComponents/BoundaryCard.d.ts.map +1 -0
  195. package/dist/types/src/features/SegmentReviewComponents/CardWrapper.d.ts +19 -0
  196. package/dist/types/src/features/SegmentReviewComponents/CardWrapper.d.ts.map +1 -0
  197. package/dist/types/src/features/SegmentReviewComponents/CognitiveIcon.d.ts +3 -0
  198. package/dist/types/src/features/SegmentReviewComponents/CognitiveIcon.d.ts.map +1 -0
  199. package/dist/types/src/features/SegmentReviewComponents/LabelCheck.d.ts +77 -0
  200. package/dist/types/src/features/SegmentReviewComponents/LabelCheck.d.ts.map +1 -0
  201. package/dist/types/src/features/SegmentReviewComponents/SegmentReviewPdfWrapper.d.ts +54 -0
  202. package/dist/types/src/features/SegmentReviewComponents/SegmentReviewPdfWrapper.d.ts.map +1 -0
  203. package/dist/types/src/features/SegmentReviewComponents/index.d.ts +14 -0
  204. package/dist/types/src/features/SegmentReviewComponents/index.d.ts.map +1 -0
  205. package/dist/types/src/features/SegmentReviewComponents/reviewStepAdapters.d.ts +37 -0
  206. package/dist/types/src/features/SegmentReviewComponents/reviewStepAdapters.d.ts.map +1 -0
  207. package/dist/types/src/hooks/useOnDemandCitationFetch.d.ts.map +1 -1
  208. package/dist/types/src/index.d.ts +4 -0
  209. package/dist/types/src/index.d.ts.map +1 -1
  210. package/dist/types/src/service/onDemandApi.d.ts +2 -2
  211. package/dist/types/src/service/onDemandApi.d.ts.map +1 -1
  212. package/dist/types/src/types/onDemandApi.types.d.ts +5 -0
  213. package/dist/types/src/types/onDemandApi.types.d.ts.map +1 -1
  214. package/package.json +6 -1
package/README.md CHANGED
@@ -3234,12 +3234,12 @@ A full-featured interface for reviewing the analysis of a System Prompt Block (S
3234
3234
 
3235
3235
  - **Overview summary** — Collapsible high-level + detailed summary
3236
3236
  - **Functionality breakdown** — Nested accordions listing functional areas and their APB references
3237
- - **Jump-to-code navigation** — Clicking an APB reference highlights that section in the persistent right-side editor
3237
+ - **Jump-to-code navigation** — Clicking an APB reference toggles an inline Monaco editor directly beneath it (togglable via `showInlineApbEditor`), scrolled and highlighted to that section. Works independently of `showCodePanel` — if the persistent right-side panel is also shown, both stay in sync
3238
3238
  - **Applicability** — Side-by-side "When to apply" / "When NOT to apply" panels
3239
3239
  - **Specifications** — Strict Rules / Input / Output, with automatic `<code>` block extraction in Output
3240
3240
  - **Dependency Graph** — Interactive, pannable/zoomable graph of APB relationships
3241
3241
  - **Persistent code panel (optional)** — Dark/light toggle and fullscreen expand, togglable via `showCodePanel`
3242
- - **Markdown + cognitive decisioning** — Text fields render through a shared markdown renderer supporting citations and expandable "cognitive reasoning" panels
3242
+ - **Markdown + cognitive decisioning** — Text fields render through a shared markdown renderer supporting citations and expandable "cognitive reasoning" panels, resolved against a single shared `extraMetaData` map passed to the panel
3243
3243
 
3244
3244
  ### Usage
3245
3245
 
@@ -3253,6 +3253,7 @@ import SPBAnalysisPanel from '@e-llm-studio/citation/SPBAnalysisPanel'
3253
3253
  overviewSummary={overviewSummary}
3254
3254
  functionalityOfSPB={functionalityOfSPB}
3255
3255
  spbAdditionalInfo={spbAdditionalInfo}
3256
+ extraMetaData={extraMetaData}
3256
3257
  showCodePanel={true}
3257
3258
  />
3258
3259
  ```
@@ -3267,8 +3268,9 @@ import SPBAnalysisPanel from '@e-llm-studio/citation/SPBAnalysisPanel'
3267
3268
  | `overviewSummary` | `SPBOverviewSummary \| null` | ❌ | — | Overview section content |
3268
3269
  | `functionalityOfSPB` | `SPBFunctionalityItem[]` | ❌ | `[]` | Functional areas and their APB references |
3269
3270
  | `spbAdditionalInfo` | `SPBAdditionalInfo \| null` | ❌ | — | Applicability, Specifications, and Dependency Graph content |
3271
+ | `extraMetaData` | `Record<string, any> \| null` | ❌ | — | Shared citation/reasoning map, keyed by the id referenced in `data-cognitive-reasoning="{id}"` anchors. One map is used across **all** sections (Overview, Functionality, APB references, Applicability, Specifications) since anchor ids are assigned globally, not per section |
3270
3272
  | `showCodePanel` | `boolean` | ❌ | `true` | Show/hide the persistent right-side editor panel |
3271
-
3273
+ | `showInlineApbEditor` | `boolean` | ❌ | `true` | Show/hide the inline Monaco editor that expands beneath a clicked APB reference |
3272
3274
  ## EmailCitation
3273
3275
 
3274
3276
  A composable React UI component for rendering email-style citations with rich formatting, attachments, and highlight/quote handling. Part of the `@e-llm-studio/citation` package, this component is designed to display email content (subject, sender, recipients, body, attachments, timestamps) in an expandable, accessible, and customizable way.
@@ -0,0 +1,2 @@
1
+ import{__assign as r}from"tslib";import{jsx as o}from"react/jsx-runtime";import i from"@mui/material/SvgIcon";function t(t){var e,n;return o(i,r({},t,{viewBox:"0 0 13 13",sx:r({width:null!==(e=t.width)&&void 0!==e?e:14,height:null!==(n=t.height)&&void 0!==n?n:14},t.sx)},{children:o("path",{d:"M6.33333 3.99996V6.33329M6.33333 8.66663H6.33917M12.1667 6.33329C12.1667 3.11163 9.555 0.499959 6.33333 0.499959C3.11167 0.499959 0.5 3.11163 0.5 6.33329C0.5 9.55495 3.11167 12.1666 6.33333 12.1666C9.555 12.1666 12.1667 9.55495 12.1667 6.33329Z",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})}))}export{t as default};
2
+ //# sourceMappingURL=InfoAlert.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InfoAlert.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),r=require("react/jsx-runtime");function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=t(require("@mui/material/SvgIcon"));exports.default=function(t){var n,o;return r.jsx(i.default,e.__assign({},t,{viewBox:"0 0 13 13",sx:e.__assign({width:null!==(n=t.width)&&void 0!==n?n:14,height:null!==(o=t.height)&&void 0!==o?o:14},t.sx)},{children:r.jsx("path",{d:"M6.33333 3.99996V6.33329M6.33333 8.66663H6.33917M12.1667 6.33329C12.1667 3.11163 9.555 0.499959 6.33333 0.499959C3.11167 0.499959 0.5 3.11163 0.5 6.33329C0.5 9.55495 3.11167 12.1666 6.33333 12.1666C9.555 12.1666 12.1667 9.55495 12.1667 6.33329Z",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})}))};
2
+ //# sourceMappingURL=InfoAlert.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InfoAlert.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),i=require("react/jsx-runtime"),n=require("lucide-react"),t=require("react"),o=require("./ResizableSplitPane.js"),l=require("../PdfViewer/PdfViewer.js"),a=require("../../assests/svg/PdfViewerIcons.js"),r=require("react-markdown"),u=require("rehype-raw"),d=require("@mui/material");require("./utils/normalizeRedlineMarkdown.js");var s=require("./CognitiveCompareConfig.js");require("react-dom");var c=require("./CompareContext.js"),v=require("./Guidelines/utils/processGuidelinesMarkdown.js"),p=require("../GptWebCitation/GptWebCitation.js"),g=require("../GptWebCitation/types.js");function h(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("./MoreFunctionsPopup.js"),require("./components/SubSectionAccordion.js"),require("./components/LHSSectionRow.js"),require("./components/RHSSectionRow.js");var m=h(r),x=h(u),f=function(e){var i,n,t;return(null===(t=null===(n=null===(i=(null==e?void 0:e.extraMetaData)||e)||void 0===i?void 0:i.aiReasoningCitation)||void 0===n?void 0:n.gpt_citation)||void 0===t?void 0:t[0])||null},_="https://dev-proposals-ai.techo.camp/utility/ca-workflow-composer-agent/get_citation",b="sai.siddhartha@techolution.com",y="672e32f7a0e8fe2e8e50bcba",C="TNV Sai Siddhartha",w="90vh",j="calc(".concat(w," - 120px)"),F=function(){var e;return"function"==typeof(null===(e=globalThis.crypto)||void 0===e?void 0:e.randomUUID)?globalThis.crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var i=Math.floor(16*Math.random());return("x"===e?i:i%4+8).toString(16)})},D=function(e,i){var n=function(e){var i;return(null==e?void 0:e.payloadCitationId)||(null===(i=null==e?void 0:e.extraMetaData)||void 0===i?void 0:i.payloadCitationId)||""}(e)||i||F();return function(e,i){e&&"object"==typeof e&&(e.payloadCitationId=i,e.extraMetaData&&"object"==typeof e.extraMetaData&&(e.extraMetaData.payloadCitationId=i))}(e,n),n},S=function(o){var l,a=o.metaData,r=o.isFullscreen,u=void 0!==r&&r,d=o.onFullscreenChange,s=c.useCompareContext().gptWebCitationConfig,v=t.useMemo(function(){return function(e){return{endpoint:(null==e?void 0:e.endpoint)||_,userEmail:(null==e?void 0:e.userEmail)||b,userId:(null==e?void 0:e.userId)||y,userName:(null==e?void 0:e.userName)||C,headers:null==e?void 0:e.headers}}(s)},[s]),h=null==a?void 0:a.webGpt,m=t.useRef(null);m.current||(m.current=F());var x=t.useMemo(function(){return function(e,i,n){var t,o,l=f(e),a=(null==l?void 0:l.customMetaData)||{},r=(null==a?void 0:a.value)||{},u=(null==e?void 0:e.webSearchAnswer)||{},d=(null==e?void 0:e.extraMetaData)||e||{};return{userEmail:(null==e?void 0:e.userEmail)||(null==u?void 0:u.userEmail)||(null==i?void 0:i.userEmail)||"",userId:(null==e?void 0:e.userId)||(null==u?void 0:u.userId)||(null==i?void 0:i.userId)||"",userName:(null==e?void 0:e.userName)||(null==u?void 0:u.userName)||(null==i?void 0:i.userName)||"",citationId:D(e,n),citationUrl:(null==r?void 0:r.citationUrl)||(null==u?void 0:u.citationUrl)||"",content:(null==d?void 0:d.Reasoning)||(null==u?void 0:u.enhanced_content)||"",citationType:(null==r?void 0:r.citationType)||"web",citatioNumber:null!==(o=null!==(t=null==a?void 0:a.citation_number)&&void 0!==t?t:null==l?void 0:l.citation_number)&&void 0!==o?o:Number((null==e?void 0:e.reasoningId)||0)}}(h,v,m.current||void 0)},[h,v]),w=t.useMemo(function(){return f(h)},[h]),S=(null===(l=null==w?void 0:w.customMetaData)||void 0===l?void 0:l.value)||{},P=(null==h?void 0:h.extraMetaData)||h||{},T=t.useState(),M=T[0],k=T[1],N=t.useState("pending"),I=N[0],R=N[1],G=t.useState(!0),U=G[0],E=G[1];t.useEffect(function(){var i=!0;return e.__awaiter(void 0,void 0,void 0,function(){var n,t,o,l;return e.__generator(this,function(a){switch(a.label){case 0:if(!v.endpoint||!(null==x?void 0:x.citationUrl)||!(null==x?void 0:x.content))return R("error"),[2];R("pending"),a.label=1;case 1:return a.trys.push([1,4,,5]),[4,fetch(v.endpoint,{method:"POST",headers:e.__assign({"actor-id":x.userEmail,Accept:"application/json, text/plain, */*","Content-Type":"application/json"},v.headers||{}),body:JSON.stringify(x)})];case 2:if(!(n=a.sent()).ok)throw new Error("Failed to fetch GPT web citation (".concat(n.status,")"));return[4,n.json()];case 3:return t=a.sent(),o=(null==t?void 0:t.responseData)||(null==t?void 0:t.result)||(null==t?void 0:t.data)||t,i?(k(o),R("success"),[3,5]):[2];case 4:return l=a.sent(),i?(console.error("Failed to load GPT web citation",l),R("error"),[3,5]):[2];case 5:return[2]}})}),function(){i=!1}},[x,v]);var q=t.useMemo(function(){return{item:{confidence_score:Number((null==P?void 0:P.Confidence_score)||0),text:(null==S?void 0:S.paraphrase)||"Web citation reasoning",dataSource:(null==S?void 0:S.text)||(null==P?void 0:P.Reasoning)||"",paraphrase:(null==S?void 0:S.paraphrase)||""},headerTitle:"GPT Web Citation",index:Number((null==x?void 0:x.citatioNumber)||1)-1,iconsConfig:{ChevronDownIcon:n.ChevronDown,ChevronUpIcon:n.ChevronUp,MaximizeIcon:n.Maximize2,CloseIcon:n.X}}},[S,null==x?void 0:x.citatioNumber,P]),A=t.useMemo(function(){return e.__assign(e.__assign({},q),u?{bodyHeight:j}:{})},[q,u]);return i.jsx("div",e.__assign({style:{overflowY:"auto"}},{children:i.jsx(p.default,{gptCitation:A,defaultCitationUrl:(null==x?void 0:x.citationUrl)||"",citationType:g.CitationType.GPT_WEB,webCitationData:M,webCitationStatus:I,showWebCitation:U,onToggleCitationView:function(){return E(function(e){return!e})},iconsConfig:{MaximizeIcon:n.Maximize2,ExternalLinkIcon:n.ExternalLink},showGptMaximizeButton:!1,isFixedHeight:!0,onFullscreenChange:d})}))},P=function(n){var a,r,u,p,g,h,f,_=n.href,b=n.metaData,y=n.citationTitle,C=n.citationType,w=n.citationReason,j=n.isFullscreen,F=n.onFullscreenChange,D=c.useCompareContext().guidelinesData,P=function(e){try{var i=function(e){var i=e.match(/^(?:pdf_citation|deviation_summary)\$(\d+)/);if(i)try{var n=e.indexOf("?"),t=n>=0?e.slice(n):"";return{citationNumber:i[1],parsedUrl:new URL(t||"./",window.location.origin)}}catch(e){return{citationNumber:i[1],parsedUrl:null}}try{var o=new URL(e,window.location.origin);return{citationNumber:o.searchParams.get("citationNumber")||o.searchParams.get("citation_number"),parsedUrl:o}}catch(e){return{citationNumber:null,parsedUrl:null}}}(e),n=i.citationNumber,t=i.parsedUrl;return{citationNumber:n,phraseToHighlight:(null==t?void 0:t.searchParams.get("phrase_to_highlight"))||null,citationTypeFromHref:(null==t?void 0:t.searchParams.get("citation_type"))||null}}catch(e){return{citationNumber:null,phraseToHighlight:null,citationTypeFromHref:null}}}(_),T=P.citationNumber,M=P.phraseToHighlight,k=P.citationTypeFromHref,N=C||k||void 0,I="il_rulebook_citation"===N?"rulebook_citation":N,R=T&&(null===(a=null==b?void 0:b.citations)||void 0===a?void 0:a[T])||{},G=(null===(r=null==b?void 0:b.docData)||void 0===r?void 0:r.documents)||{},U=(null===(u=null==b?void 0:b.docData)||void 0===u?void 0:u.input_index_map)||{},E=Object.keys((null==b?void 0:b.citations)||{}).length>0||Object.keys((null==b?void 0:b.docData)||{}).length>0,q=null==U?void 0:U[0],A=null==U?void 0:U[1],H=q?G[q]:null,z=A?G[A]:null,W=q?R[q]:null,O=A?R[A]:null,B=t.useMemo(function(){var e,n,t,o;return W&&H?i.jsx(l.default,{defaultScale:"PageWidth",showFullScreenAction:!1,showHighlightsAction:!1,pdfName:null==H?void 0:H.title,pdfUrl:null==H?void 0:H.signed_url,highlightText:[null!==(e=null==W?void 0:W.highlighted_text)&&void 0!==e?e:""],highlightPages:{1:null===(n=null==W?void 0:W.custom_metadata)||void 0===n?void 0:n.pdf_start_page_number},jumpToPageValue:1,highlightCordinatePages:[],useCoordinates:!1,useRange:!0,rangeOfPages:[null===(t=null==W?void 0:W.custom_metadata)||void 0===t?void 0:t.pdf_start_page_number,null===(o=null==W?void 0:W.custom_metadata)||void 0===o?void 0:o.pdf_end_page_number]}):null},[null==H?void 0:H.title,null==H?void 0:H.signed_url,null==W?void 0:W.highlighted_text,null===(p=null==W?void 0:W.custom_metadata)||void 0===p?void 0:p.pdf_start_page_number,null===(g=null==W?void 0:W.custom_metadata)||void 0===g?void 0:g.pdf_end_page_number]),L=t.useMemo(function(){var e,n,t,o;return O&&z?i.jsx(l.default,{defaultScale:"PageWidth",showFullScreenAction:!1,showHighlightsAction:!1,pdfName:null==z?void 0:z.title,pdfUrl:null==z?void 0:z.signed_url,jumpToPageValue:1,highlightText:[null!==(e=null==O?void 0:O.highlighted_text)&&void 0!==e?e:""],highlightPages:{1:null===(n=null==O?void 0:O.custom_metadata)||void 0===n?void 0:n.pdf_start_page_number},highlightCordinatePages:[],useCoordinates:!1,useRange:!0,rangeOfPages:[null===(t=null==O?void 0:O.custom_metadata)||void 0===t?void 0:t.pdf_start_page_number,null===(o=null==O?void 0:O.custom_metadata)||void 0===o?void 0:o.pdf_end_page_number]}):null},[null==z?void 0:z.title,null==z?void 0:z.signed_url,null==O?void 0:O.highlighted_text,null===(h=null==O?void 0:O.custom_metadata)||void 0===h?void 0:h.pdf_start_page_number,null===(f=null==O?void 0:O.custom_metadata)||void 0===f?void 0:f.pdf_end_page_number]),V="dual_citation"===I,Y=V&&!!(null==b?void 0:b.webGpt),J=t.useMemo(function(){var n=Y?i.jsx(S,{metaData:b,isFullscreen:j,onFullscreenChange:F}):"rulebook_citation"===I?i.jsx(i.Fragment,{children:i.jsx(d.Box,e.__assign({sx:e.__assign(e.__assign({padding:"0px 20px",backgroundColor:"#FFFFFF",borderRadius:"8px"},s.SHARED_MARKDOWN_STYLES),{overflow:"auto"})},{children:i.jsx(m.default,e.__assign({rehypePlugins:[x.default]},{children:v.processGuidelinesMarkdown({guidelinesData:D,targetHighlights:[M],labelColor:"#FEF08A"})}))}))}):L;return i.jsx(o.default,{leftComponent:B,rightComponent:n,isFullscreen:j})},[B,L,I,Y,b,j,D,M,F]);return(null==b?void 0:b.webGpt)&&!E?i.jsx(S,{metaData:b,isFullscreen:j,onFullscreenChange:F}):T?"rulebook_citation"===I?W?i.jsx("div",e.__assign({style:{height:"100%",display:"flex",flexDirection:"column"}},{children:J})):i.jsx("div",e.__assign({style:{padding:"12px",fontSize:"13px",color:"#344054",lineHeight:1.5}},{children:w||"Rulebook citation selected."})):V?W||O?i.jsx("div",e.__assign({style:{height:"100%",display:"flex",flexDirection:"column"}},{children:J})):(null==b?void 0:b.webGpt)?i.jsx(S,{metaData:b,isFullscreen:j,onFullscreenChange:F}):i.jsx("div",{children:"Missing PDF Citation. Please try again later"}):["contract","clause"].includes(y)?W||O?i.jsx("div",e.__assign({style:{height:"100%",display:"flex",flexDirection:"column"}},{children:J})):i.jsx("div",{children:"Missing PDF Citation. Please try again later"}):i.jsx("div",{children:"No Citation Found. Please try again later"}):null};exports.default=function(o){var l,r,u,s,c,v,p,g=o.href,h=o.children,m=o.citationType,x=o.citationReason,f=o.metaData,_=o.chevronUpComponent,b=void 0===_?null:_,y=o.chevronDownComponent,C=void 0===y?null:y,j=o.customStyle,F=void 0===j?{}:j,D=o.defaultState,S=void 0!==D&&D,T=o.onFullscreenChange,M=t.useState(S),k=M[0],N=M[1],I=t.useState(!1),R=I[0],G=I[1],U="string"==typeof h&&(null===(l=null==h?void 0:h.split("\n"))||void 0===l?void 0:l.length)>1?h.split("\n").join(" "):h;t.useEffect(function(){if(null==T||T(R),R)return function(){null==T||T(!1)}},[R,T]);var E="string"==typeof h?h:h[0],q=null!=b?b:function(e){var t,o;return i.jsx(n.ChevronUp,{size:null!==(t=null==e?void 0:e.fontSize)&&void 0!==t?t:16,color:null!==(o=null==e?void 0:e.color)&&void 0!==o?o:"rgb(214, 51, 132)"})}(null!==(r=null==F?void 0:F.arrow)&&void 0!==r?r:{}),A=null!=C?C:function(e){var t,o;return i.jsx(n.ChevronDown,{size:null!==(t=null==e?void 0:e.fontSize)&&void 0!==t?t:16,color:null!==(o=null==e?void 0:e.color)&&void 0!==o?o:"rgb(214, 51, 132)"})}(null!==(u=null==F?void 0:F.arrow)&&void 0!==u?u:{}),H=i.jsxs("div",e.__assign({style:{boxSizing:"border-box",border:R?"none":"1px solid #E4E7EC",borderRadius:R?0:"8px",overflow:"hidden",marginTop:R?0:"8px",display:"flex",flexDirection:"column",width:"100%",height:R?"100%":void 0,backgroundColor:"#FAFAFA"}},{children:[i.jsx("div",e.__assign({style:{display:"flex",justifyContent:"flex-end",padding:"6px 10px",borderBottom:"1px solid #E4E7EC",backgroundColor:"#FFFFFF",flexShrink:0}},{children:i.jsx("button",e.__assign({onClick:function(){G(function(e){var i=!e;return null==T||T(i),i})},style:{background:"none",border:"none",cursor:"pointer",padding:"4px",borderRadius:"6px",color:"#475467",marginRight:"9px"}},{children:R?i.jsx(a.DefaultFullScreenCloseIcon,{}):i.jsx(a.DefaultFullScreenIcon,{})}))})),i.jsx("div",e.__assign({style:{flex:1,minHeight:0,height:"100%",overflow:"hidden"}},{children:i.jsx(P,{href:g,children:h,metaData:f,citationTitle:E,citationType:m,citationReason:x,isFullscreen:R,onFullscreenChange:T})}))]}));return i.jsxs("span",e.__assign({style:e.__assign({display:"inline"},F.relativeWrapper||{})},{children:[i.jsx("div",e.__assign({style:e.__assign({display:"inline",marginTop:0},F.citationButtonWrapper||{})},{children:i.jsxs("button",e.__assign({type:"button",onClick:function(){return N(function(e){return!e})},style:e.__assign({display:(null==f?void 0:f.webGpt)?"inline":"inline-flex",alignItems:(null==f?void 0:f.webGpt)?void 0:"center",gap:(null==f?void 0:f.webGpt)?void 0:"3px",fontFamily:'"Inter", sans-serif',backgroundColor:"transparent",padding:0,margin:0,fontSize:"13px",borderRadius:9999,cursor:"pointer",fontWeight:(null==f?void 0:f.webGpt)?600:700,color:(null==f?void 0:f.webGpt)?"#6D28D9":"rgb(214, 51, 132)",border:"none",textDecoration:"none",wordBreak:"break-word",whiteSpace:"normal"},F.citationButton||{})},{children:[(null==f?void 0:f.webGpt)&&i.jsx(n.Globe,{size:null!==(c=null===(s=F.arrow)||void 0===s?void 0:s.fontSize)&&void 0!==c?c:"1em",color:null!==(p=null===(v=F.arrow)||void 0===v?void 0:v.color)&&void 0!==p?p:"#6D28D9",style:{display:"inline-block",width:"1em",height:"1em",marginRight:"3px",verticalAlign:"-0.125em",flexShrink:0}}),i.jsx("span",{children:U}),i.jsx("span",e.__assign({style:{display:"inline-flex",alignItems:"center",marginLeft:(null==f?void 0:f.webGpt)?"3px":void 0,verticalAlign:(null==f?void 0:f.webGpt)?"-0.125em":void 0}},{children:k?q:A}))]}))})),k&&(R?i.jsx(d.Dialog,e.__assign({open:R,onClose:function(){G(!1),null==T||T(!1)},maxWidth:!1,BackdropProps:{sx:{backgroundColor:"rgba(0, 0, 0, 0.6)",backdropFilter:"blur(4px)"}},PaperProps:{sx:{backgroundColor:"#FAFAFA",borderRadius:"16px",height:w,m:0,maxHeight:w,maxWidth:"95vw",overflow:"hidden",width:"95vw"}}},{children:H})):H)]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),i=require("react/jsx-runtime"),n=require("lucide-react"),t=require("react"),o=require("./ResizableSplitPane.js"),l=require("../PdfViewer/PdfViewer.js"),a=require("../../assests/svg/PdfViewerIcons.js"),r=require("react-markdown"),u=require("rehype-raw"),d=require("@mui/material"),s=require("./CognitiveCompareConfig.js");require("react-dom");var c=require("./CompareContext.js"),v=require("./Guidelines/utils/processGuidelinesMarkdown.js"),p=require("../GptWebCitation/GptWebCitation.js"),g=require("../GptWebCitation/types.js");function h(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("./MoreFunctionsPopup.js"),require("./components/SubSectionAccordion.js"),require("./components/LHSSectionRow.js"),require("./components/RHSSectionRow.js");var m=h(r),x=h(u),f=function(e){var i,n,t;return(null===(t=null===(n=null===(i=(null==e?void 0:e.extraMetaData)||e)||void 0===i?void 0:i.aiReasoningCitation)||void 0===n?void 0:n.gpt_citation)||void 0===t?void 0:t[0])||null},_="https://dev-proposals-ai.techo.camp/utility/ca-workflow-composer-agent/get_citation",b="sai.siddhartha@techolution.com",y="672e32f7a0e8fe2e8e50bcba",w="TNV Sai Siddhartha",C="90vh",j="calc(".concat(C," - 120px)"),D=function(){var e;return"function"==typeof(null===(e=globalThis.crypto)||void 0===e?void 0:e.randomUUID)?globalThis.crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var i=Math.floor(16*Math.random());return("x"===e?i:i%4+8).toString(16)})},F=function(e,i){var n=function(e){var i;return(null==e?void 0:e.payloadCitationId)||(null===(i=null==e?void 0:e.extraMetaData)||void 0===i?void 0:i.payloadCitationId)||""}(e)||i||D();return function(e,i){e&&"object"==typeof e&&(e.payloadCitationId=i,e.extraMetaData&&"object"==typeof e.extraMetaData&&(e.extraMetaData.payloadCitationId=i))}(e,n),n},S=function(o){var l,a=o.metaData,r=o.isFullscreen,u=void 0!==r&&r,d=c.useCompareContext().gptWebCitationConfig,s=t.useMemo(function(){return function(e){return{endpoint:(null==e?void 0:e.endpoint)||_,userEmail:(null==e?void 0:e.userEmail)||b,userId:(null==e?void 0:e.userId)||y,userName:(null==e?void 0:e.userName)||w,headers:null==e?void 0:e.headers}}(d)},[d]),v=null==a?void 0:a.webGpt,h=t.useRef(null);h.current||(h.current=D());var m=t.useMemo(function(){return function(e,i,n){var t,o,l=f(e),a=(null==l?void 0:l.customMetaData)||{},r=(null==a?void 0:a.value)||{},u=(null==e?void 0:e.webSearchAnswer)||{},d=(null==e?void 0:e.extraMetaData)||e||{};return{userEmail:(null==e?void 0:e.userEmail)||(null==u?void 0:u.userEmail)||(null==i?void 0:i.userEmail)||"",userId:(null==e?void 0:e.userId)||(null==u?void 0:u.userId)||(null==i?void 0:i.userId)||"",userName:(null==e?void 0:e.userName)||(null==u?void 0:u.userName)||(null==i?void 0:i.userName)||"",citationId:F(e,n),citationUrl:(null==r?void 0:r.citationUrl)||(null==u?void 0:u.citationUrl)||"",content:(null==d?void 0:d.Reasoning)||(null==u?void 0:u.enhanced_content)||"",citationType:(null==r?void 0:r.citationType)||"web",citatioNumber:null!==(o=null!==(t=null==a?void 0:a.citation_number)&&void 0!==t?t:null==l?void 0:l.citation_number)&&void 0!==o?o:Number((null==e?void 0:e.reasoningId)||0)}}(v,s,h.current||void 0)},[v,s]),x=t.useMemo(function(){return f(v)},[v]),C=(null===(l=null==x?void 0:x.customMetaData)||void 0===l?void 0:l.value)||{},S=(null==v?void 0:v.extraMetaData)||v||{},P=t.useState(),T=P[0],k=P[1],M=t.useState("pending"),N=M[0],I=M[1],R=t.useState(!0),G=R[0],U=R[1];t.useEffect(function(){var i=!0;return e.__awaiter(void 0,void 0,void 0,function(){var n,t,o,l;return e.__generator(this,function(a){switch(a.label){case 0:if(!s.endpoint||!(null==m?void 0:m.citationUrl)||!(null==m?void 0:m.content))return I("error"),[2];I("pending"),a.label=1;case 1:return a.trys.push([1,4,,5]),[4,fetch(s.endpoint,{method:"POST",headers:e.__assign({"actor-id":m.userEmail,Accept:"application/json, text/plain, */*","Content-Type":"application/json"},s.headers||{}),body:JSON.stringify(m)})];case 2:if(!(n=a.sent()).ok)throw new Error("Failed to fetch GPT web citation (".concat(n.status,")"));return[4,n.json()];case 3:return t=a.sent(),o=(null==t?void 0:t.responseData)||(null==t?void 0:t.result)||(null==t?void 0:t.data)||t,i?(k(o),I("success"),[3,5]):[2];case 4:return l=a.sent(),i?(console.error("Failed to load GPT web citation",l),I("error"),[3,5]):[2];case 5:return[2]}})}),function(){i=!1}},[m,s]);var E=t.useMemo(function(){return{item:{confidence_score:Number((null==S?void 0:S.Confidence_score)||0),text:(null==C?void 0:C.paraphrase)||"Web citation reasoning",dataSource:(null==C?void 0:C.text)||(null==S?void 0:S.Reasoning)||"",paraphrase:(null==C?void 0:C.paraphrase)||""},headerTitle:"GPT Web Citation",index:Number((null==m?void 0:m.citatioNumber)||1)-1,iconsConfig:{ChevronDownIcon:n.ChevronDown,ChevronUpIcon:n.ChevronUp,MaximizeIcon:n.Maximize2,CloseIcon:n.X}}},[C,null==m?void 0:m.citatioNumber,S]),q=t.useMemo(function(){return e.__assign(e.__assign({},E),u?{bodyHeight:j}:{})},[E,u]);return i.jsx(p.default,{gptCitation:q,defaultCitationUrl:(null==m?void 0:m.citationUrl)||"",citationType:g.CitationType.GPT_WEB,webCitationData:T,webCitationStatus:N,showWebCitation:G,onToggleCitationView:function(){return U(function(e){return!e})},iconsConfig:{MaximizeIcon:n.Maximize2,ExternalLinkIcon:n.ExternalLink},isFixedHeight:!0})},P=function(n){var a,r,u,p,g,h,f,_=n.href,b=n.metaData,y=n.citationTitle,w=n.citationType,C=n.citationReason,j=n.isFullscreen,D=c.useCompareContext().guidelinesData,F=function(e){try{var i=function(e){var i=e.match(/^(?:pdf_citation|deviation_summary)\$(\d+)/);if(i)try{var n=e.indexOf("?"),t=n>=0?e.slice(n):"";return{citationNumber:i[1],parsedUrl:new URL(t||"./",window.location.origin)}}catch(e){return{citationNumber:i[1],parsedUrl:null}}try{var o=new URL(e,window.location.origin);return{citationNumber:o.searchParams.get("citationNumber")||o.searchParams.get("citation_number"),parsedUrl:o}}catch(e){return{citationNumber:null,parsedUrl:null}}}(e),n=i.citationNumber,t=i.parsedUrl;return{citationNumber:n,phraseToHighlight:(null==t?void 0:t.searchParams.get("phrase_to_highlight"))||null,citationTypeFromHref:(null==t?void 0:t.searchParams.get("citation_type"))||null}}catch(e){return{citationNumber:null,phraseToHighlight:null,citationTypeFromHref:null}}}(_),P=F.citationNumber,T=F.phraseToHighlight,k=F.citationTypeFromHref,M=w||k||void 0,N="il_rulebook_citation"===M?"rulebook_citation":M,I=P&&(null===(a=null==b?void 0:b.citations)||void 0===a?void 0:a[P])||{},R=(null===(r=null==b?void 0:b.docData)||void 0===r?void 0:r.documents)||{},G=(null===(u=null==b?void 0:b.docData)||void 0===u?void 0:u.input_index_map)||{},U=Object.keys((null==b?void 0:b.citations)||{}).length>0||Object.keys((null==b?void 0:b.docData)||{}).length>0,E=null==G?void 0:G[0],q=null==G?void 0:G[1],A=E?R[E]:null,H=q?R[q]:null,W=E?I[E]:null,z=q?I[q]:null,O=t.useMemo(function(){var e,n,t,o;return W&&A?i.jsx(l.default,{defaultScale:"PageWidth",showFullScreenAction:!1,showHighlightsAction:!1,pdfName:null==A?void 0:A.title,pdfUrl:null==A?void 0:A.signed_url,highlightText:[null!==(e=null==W?void 0:W.highlighted_text)&&void 0!==e?e:""],highlightPages:{1:null===(n=null==W?void 0:W.custom_metadata)||void 0===n?void 0:n.pdf_start_page_number},jumpToPageValue:1,highlightCordinatePages:[],useCoordinates:!1,useRange:!0,rangeOfPages:[null===(t=null==W?void 0:W.custom_metadata)||void 0===t?void 0:t.pdf_start_page_number,null===(o=null==W?void 0:W.custom_metadata)||void 0===o?void 0:o.pdf_end_page_number]}):null},[null==A?void 0:A.title,null==A?void 0:A.signed_url,null==W?void 0:W.highlighted_text,null===(p=null==W?void 0:W.custom_metadata)||void 0===p?void 0:p.pdf_start_page_number,null===(g=null==W?void 0:W.custom_metadata)||void 0===g?void 0:g.pdf_end_page_number]),B=t.useMemo(function(){var e,n,t,o;return z&&H?i.jsx(l.default,{defaultScale:"PageWidth",showFullScreenAction:!1,showHighlightsAction:!1,pdfName:null==H?void 0:H.title,pdfUrl:null==H?void 0:H.signed_url,jumpToPageValue:1,highlightText:[null!==(e=null==z?void 0:z.highlighted_text)&&void 0!==e?e:""],highlightPages:{1:null===(n=null==z?void 0:z.custom_metadata)||void 0===n?void 0:n.pdf_start_page_number},highlightCordinatePages:[],useCoordinates:!1,useRange:!0,rangeOfPages:[null===(t=null==z?void 0:z.custom_metadata)||void 0===t?void 0:t.pdf_start_page_number,null===(o=null==z?void 0:z.custom_metadata)||void 0===o?void 0:o.pdf_end_page_number]}):null},[null==H?void 0:H.title,null==H?void 0:H.signed_url,null==z?void 0:z.highlighted_text,null===(h=null==z?void 0:z.custom_metadata)||void 0===h?void 0:h.pdf_start_page_number,null===(f=null==z?void 0:z.custom_metadata)||void 0===f?void 0:f.pdf_end_page_number]),L="dual_citation"===N,V=L&&!!(null==b?void 0:b.webGpt),J=t.useMemo(function(){if(!O)return null;var n=V?i.jsx(S,{metaData:b,isFullscreen:j}):"rulebook_citation"===N?i.jsx(i.Fragment,{children:i.jsx(d.Box,e.__assign({sx:e.__assign(e.__assign({padding:"0px 20px",backgroundColor:"#FFFFFF",borderRadius:"8px"},s.SHARED_MARKDOWN_STYLES),{overflow:"auto"})},{children:i.jsx(m.default,e.__assign({rehypePlugins:[x.default]},{children:v.processGuidelinesMarkdown({guidelinesData:D,targetHighlights:[T],labelColor:"#FEF08A"})}))}))}):B;return n?i.jsx(o.default,{leftComponent:O,rightComponent:n,isFullscreen:j}):O},[O,B,N,V,b,j,D,T]);return(null==b?void 0:b.webGpt)&&!U?i.jsx(S,{metaData:b,isFullscreen:j}):P?"rulebook_citation"===N?W?i.jsx("div",e.__assign({style:{height:"100%",display:"flex",flexDirection:"column"}},{children:J})):i.jsx("div",e.__assign({style:{padding:"12px",fontSize:"13px",color:"#344054",lineHeight:1.5}},{children:C||"Rulebook citation selected."})):L?W||z?i.jsx("div",e.__assign({style:{height:"100%",display:"flex",flexDirection:"column"}},{children:J})):(null==b?void 0:b.webGpt)?i.jsx(S,{metaData:b,isFullscreen:j}):i.jsx("div",{children:"Missing PDF Citation. Please try again later"}):["contract","clause"].includes(y)?W||z?i.jsx("div",e.__assign({style:{height:"100%",display:"flex",flexDirection:"column"}},{children:J})):i.jsx("div",{children:"Missing PDF Citation. Please try again later"}):i.jsx("div",{children:"No Citation Found. Please try again later"}):null};exports.default=function(o){var l,r,u,s,c,v,p,g=o.href,h=o.children,m=o.citationType,x=o.citationReason,f=o.metaData,_=o.chevronUpComponent,b=void 0===_?null:_,y=o.chevronDownComponent,w=void 0===y?null:y,j=o.customStyle,D=void 0===j?{}:j,F=o.defaultState,S=void 0!==F&&F,T=o.onFullscreenChange,k=t.useState(S),M=k[0],N=k[1],I=t.useState(!1),R=I[0],G=I[1],U="string"==typeof h&&(null===(l=null==h?void 0:h.split("\n"))||void 0===l?void 0:l.length)>1?h.split("\n").join(" "):h;t.useEffect(function(){if(null==T||T(R),R)return function(){null==T||T(!1)}},[R,T]);var E="string"==typeof h?h:h[0],q=null!=b?b:function(e){var t,o;return i.jsx(n.ChevronUp,{size:null!==(t=null==e?void 0:e.fontSize)&&void 0!==t?t:16,color:null!==(o=null==e?void 0:e.color)&&void 0!==o?o:"rgb(214, 51, 132)"})}(null!==(r=null==D?void 0:D.arrow)&&void 0!==r?r:{}),A=null!=w?w:function(e){var t,o;return i.jsx(n.ChevronDown,{size:null!==(t=null==e?void 0:e.fontSize)&&void 0!==t?t:16,color:null!==(o=null==e?void 0:e.color)&&void 0!==o?o:"rgb(214, 51, 132)"})}(null!==(u=null==D?void 0:D.arrow)&&void 0!==u?u:{}),H=i.jsxs("div",e.__assign({style:{boxSizing:"border-box",border:R?"none":"1px solid #E4E7EC",borderRadius:R?0:"8px",overflow:"hidden",marginTop:R?0:"8px",display:"flex",flexDirection:"column",width:"100%",height:R?"100%":void 0,backgroundColor:"#FAFAFA"}},{children:[i.jsx("div",e.__assign({style:{display:"flex",justifyContent:"flex-end",padding:"6px 10px",borderBottom:"1px solid #E4E7EC",backgroundColor:"#FFFFFF",flexShrink:0}},{children:i.jsx("button",e.__assign({onClick:function(){G(function(e){return!e})},style:{background:"none",border:"none",cursor:"pointer",padding:"4px",borderRadius:"6px",color:"#475467",marginRight:"9px"}},{children:R?i.jsx(a.DefaultFullScreenCloseIcon,{}):i.jsx(a.DefaultFullScreenIcon,{})}))})),i.jsx("div",e.__assign({style:{flex:1,minHeight:0,height:"100%",overflow:"hidden"}},{children:i.jsx(P,{href:g,children:h,metaData:f,citationTitle:E,citationType:m,citationReason:x,isFullscreen:R})}))]}));return i.jsxs("span",e.__assign({style:e.__assign({display:"inline"},D.relativeWrapper||{})},{children:[i.jsx("div",e.__assign({style:e.__assign({display:"inline",marginTop:0},D.citationButtonWrapper||{})},{children:i.jsxs("button",e.__assign({type:"button",onClick:function(){return N(function(e){return!e})},style:e.__assign({display:(null==f?void 0:f.webGpt)?"inline":"inline-flex",alignItems:(null==f?void 0:f.webGpt)?void 0:"center",gap:(null==f?void 0:f.webGpt)?void 0:"3px",fontFamily:'"Inter", sans-serif',backgroundColor:"transparent",padding:0,margin:0,fontSize:"13px",borderRadius:9999,cursor:"pointer",fontWeight:(null==f?void 0:f.webGpt)?600:700,color:(null==f?void 0:f.webGpt)?"#6D28D9":"rgb(214, 51, 132)",border:"none",textDecoration:"none",wordBreak:"break-word",whiteSpace:"normal"},D.citationButton||{})},{children:[(null==f?void 0:f.webGpt)&&i.jsx(n.Globe,{size:null!==(c=null===(s=D.arrow)||void 0===s?void 0:s.fontSize)&&void 0!==c?c:"1em",color:null!==(p=null===(v=D.arrow)||void 0===v?void 0:v.color)&&void 0!==p?p:"#6D28D9",style:{display:"inline-block",width:"1em",height:"1em",marginRight:"3px",verticalAlign:"-0.125em",flexShrink:0}}),i.jsx("span",{children:U}),i.jsx("span",e.__assign({style:{display:"inline-flex",alignItems:"center",marginLeft:(null==f?void 0:f.webGpt)?"3px":void 0,verticalAlign:(null==f?void 0:f.webGpt)?"-0.125em":void 0}},{children:M?q:A}))]}))})),M&&(R?i.jsx(d.Dialog,e.__assign({open:R,onClose:function(){return G(!1)},maxWidth:!1,BackdropProps:{sx:{backgroundColor:"rgba(0, 0, 0, 0.6)",backdropFilter:"blur(4px)"}},PaperProps:{sx:{backgroundColor:"#FAFAFA",borderRadius:"16px",height:C,m:0,maxHeight:C,maxWidth:"95vw",overflow:"hidden",width:"95vw"}}},{children:H})):H)]}))};
2
2
  //# sourceMappingURL=CitationAnchor.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"),u=require("./CognitiveComparehelpers.js"),s=require("./CognitiveCompareConfig.js"),a=require("./CognitiveCompareConstants.js"),c=require("./CognitivePopup.js"),d=require("./MoreFunctionsPopup.js"),f=require("./LoaderComponent.js"),v=require("./components/ThreeDotsLoader.js"),g=require("./hooks/useCompareData.js"),p=require("./hooks/useComparePopups.js"),h=require("./hooks/useSectionRefs.js"),m=require("./hooks/useAccordionState.js"),S=require("./hooks/useDeviationNavigation.js"),x=require("./components/CompareHeader.js"),R=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"),T=require("./hooks/useLinesCalculator.js"),I=require("./hooks/useSideBySide.js"),w=require("./components/SvgConnectors.js"),B=require("./Guidelines/components/GuidelinePanel.js"),D=require("./Guidelines/components/WebGptPanel.js"),O=require("./components/GuidelineSkeletonLoader.js");exports.SHARED_MARKDOWN_STYLES=s.SHARED_MARKDOWN_STYLES,exports.default=function(F){var j,k,P,N,M,L,q,G,H,V,W,z,K,U,Y,J,X,$,Q,Z,ee,ne,ie,te,oe,re,le,ue,se,ae,ce,de,fe,ve,ge,pe=F.componentHeaderText,he=void 0===pe?a.DEFAULT_COMPONENT_HEADER_TEXT:pe,me=F.treeData,Se=F.comparisonConfig,xe=F.leftColumnTitleText,Re=F.rightColumnTitleText,_e=F.markdownStyles,ye=F.resetTrigger,be=F.displayConfig,Ce=void 0===be?{isHeaderVisible:!0,isToggleVisible:!0,maintainRelativeOrder:!1,isLoading:!0,showDeviationBadges:!1,enableDeviationSchemaBackwardCompatibility:!1,displayEmailNotifier:!0,isStreamingEnabled:!1}:be,Ee=F.onMaintainRelativeOrderChange,Ae=F.popupConfig,Te=F.deviationData,Ie=void 0===Te?{}:Te,we=F.deviationNodeIdToView,Be=F.resetDeviationNodeId,De=F.isProposingFix,Oe=void 0!==De&&De,Fe=F.proposingFixNodeId,je=F.isRedlineFlow,ke=F.badgeStyleOverride,Pe=F.guidelinesData,Ne=F.isGuidelineMode,Me=F.gptWebCitationConfig,Le=i.useState(Ce.maintainRelativeOrder),qe=Le[0],Ge=Le[1],He=null!==(j=null==Ce?void 0:Ce.expandLevels)&&void 0!==j?j:0,Ve=!!(null==Ce?void 0:Ce.expandAllSections),We=!!qe||!!(null==Ce?void 0:Ce.showDeviationBadges),ze=i.useState(!1),Ke=ze[0],Ue=ze[1],Ye=i.useState(null),Je=Ye[0],Xe=Ye[1],$e=i.useState(null===(P=null!==(k=null==me?void 0:me.newEvaluationResult)&&void 0!==k?k:null==Ce?void 0:Ce.enableDeviationSchemaBackwardCompatibility)||void 0===P||P)[0],Qe=i.useState(new Set),Ze=Qe[0],en=Qe[1],nn=i.useState([]),tn=nn[0],on=nn[1],rn=i.useState(!1),ln=rn[0],un=rn[1],sn=i.useState(0),an=sn[0],cn=sn[1],dn=i.useRef(null),fn=i.useRef(null),vn=i.useRef(null),gn=i.useRef(null),pn=i.useRef(null),hn=i.useRef(!1),mn=i.useRef(null),Sn=i.useRef({}),xn=i.useRef([]),Rn=i.useRef(function(){}),_n=i.useRef(null),yn=i.useRef(function(){}),bn=i.useMemo(function(){return JSON.stringify(Ie||{})},[JSON.stringify(Ie)]),Cn=i.useMemo(function(){return Ie||{}},[bn]),En=i.useMemo(function(){return(null==me?void 0:me.cognitive_decisioning)||{}},[me]),An=i.useMemo(function(){return e.__assign(e.__assign({},s.SHARED_MARKDOWN_STYLES),_e)},[_e]),Tn=i.useRef(null),In=i.useRef(null),wn=i.useRef(null),Bn=i.useRef(null),Dn=i.useRef(null),On=i.useRef(null),Fn=i.useRef(null),jn=i.useRef(null),kn=i.useRef(null),Pn=i.useRef(null),Nn=p.useComparePopups(Tn),Mn=Nn.cognitivePopup,Ln=Nn.setCognitivePopup,qn=Nn.moreFunctions,Gn=Nn.setMoreFunctions,Hn=Nn.position,Vn=Nn.setPosition,Wn=Nn.activeBadgeId,zn=Nn.summaryPopup,Kn=Nn.setSummaryPopup,Un=Nn.closeSummaryPopup,Yn=Nn.setActiveBadgeId,Jn=Nn.popupRef,Xn=Nn.handleOpenCognitiveCompare,$n=Nn.openCognitivePopupFromState,Qn=Nn.closeCognitivePopup,Zn=Nn.closeMoreFunctionsPopup,ei=i.useMemo(function(){var e,n,i,t,o,r,l;return{fields:null!==(e=null==Se?void 0:Se.fields)&&void 0!==e?e:s.DEFAULT_FIELD_CONFIG,thresholds:{high:null!==(i=null===(n=null==Se?void 0:Se.thresholds)||void 0===n?void 0:n.high)&&void 0!==i?i:s.DEFAULT_COMPARISON_CONFIG.thresholds.high,medium:null!==(o=null===(t=null==Se?void 0:Se.thresholds)||void 0===t?void 0:t.medium)&&void 0!==o?o:s.DEFAULT_COMPARISON_CONFIG.thresholds.medium,exact:null!==(l=null===(r=null==Se?void 0:Se.thresholds)||void 0===r?void 0:r.exact)&&void 0!==l?l:s.DEFAULT_COMPARISON_CONFIG.thresholds.exact}}},[Se]),ni=i.useState(null),ii=ni[0];ni[1];var ti=null===(L=null===(N=null==me?void 0:me.documents)||void 0===N?void 0:N[null===(M=null==me?void 0:me.input_index_map)||void 0===M?void 0:M[0]])||void 0===L?void 0:L.title,oi=null===(H=null===(q=null==me?void 0:me.documents)||void 0===q?void 0:q[null===(G=null==me?void 0:me.input_index_map)||void 0===G?void 0:G[1]])||void 0===H?void 0:H.title,ri=u.safeStringify(xe||ti||"Uploaded Contract"),li=null===(K=null===(z=null===(V=null==me?void 0:me.documents)||void 0===V?void 0:V[null===(W=null==me?void 0:me.input_index_map)||void 0===W?void 0:W[0]])||void 0===z?void 0:z.metadata)||void 0===K?void 0:K.file_name,ui=u.safeStringify(li),si=null===(X=null===(J=null===(U=null==me?void 0:me.documents)||void 0===U?void 0:U[null===(Y=null==me?void 0:me.input_index_map)||void 0===Y?void 0:Y[1]])||void 0===J?void 0:J.metadata)||void 0===X?void 0:X.file_name,ai=u.safeStringify(si),ci=u.safeStringify(Re||oi||"Reference Template"),di=g.useCognitiveTreeData(me,qe,Cn,ei,$e,Pe,Ne),fi=di.isGuidelineMode,vi=di.activeProposed,gi=di.existingRule,pi=di.proposedSections,hi=di.existingSections,mi=di.visibleFields,Si=di.parentDeviationRecord,xi=di.deviationNumberRegistry,Ri=di.deviationParentRegistry,_i=di.parseError;i.useEffect(function(){_i&&Xe("Failed to load comparison: ".concat(_i))},[_i]);var yi=pi.length>0||hi.length>0,bi=i.useMemo(function(){if(!je)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)||"";u.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(pi),i(hi),"".concat(e,":").concat(n)},[je,pi,hi]);i.useEffect(function(){if(pi.length||hi.length)if(Ve){var e={},n={},i=function(i,t){i.forEach(function(i,o){var r,l=qe?"".concat(t,"-").concat(o):String(o);e[l]=!0;var u=function(e,i){null==e||e.forEach(function(e,t){var o,r="".concat(i,"-").concat(t);n[r]=!0,(null===(o=e.subsections)||void 0===o?void 0:o.length)&&u(e.subsections,r)})};(null===(r=i.subsections)||void 0===r?void 0:r.length)&&u(i.subsections,String(o))})};i(pi,"left"),i(hi,"right"),rt(e),ut(n)}else if(He>0){var t={},o={},r=function(e,n,i){e.forEach(function(e,r){var l;if(i>=1){var u=qe?"".concat(n,"-").concat(r):String(r);t[u]=!0}var s=function(e,n,t){t>i||null==e||e.forEach(function(e,i){var r,l="".concat(n,"-").concat(i);o[l]=!0,(null===(r=e.subsections)||void 0===r?void 0:r.length)&&s(e.subsections,l,t+1)})};(null===(l=e.subsections)||void 0===l?void 0:l.length)&&i>=2&&s(e.subsections,String(r),2)})};r(pi,"left",He),r(hi,"right",He),rt(t),ut(o)}},[Ve,He,pi,hi,qe]);var Ci=h.useSectionRefs(mi.map(function(e){return e.key}),Math.max(pi.length,hi.length)),Ei=Ci.leftRefs,Ai=Ci.rightRefs,Ti=Ci.sectionLeftRefs,Ii=Ci.sectionRightRefs,wi=Ci.lhsBadgeRefs,Bi=Ci.rhsBadgeRefs,Di=Ci.sectionRightRowRefs,Oi=Ci.subSectionLeftRefs,Fi=Ci.subSectionRightRefs,ji=Ci.sectionRowRefs,ki=Ci.getSectionRowRef,Pi=Ci.getSubSectionRef,Ni=Ci.getBadgeRef,Mi=I.useSideBySide({isGuidelineMode:fi,maintainRelativeOrder:qe,proposedSections:pi,existingSections:hi,leftContainerRef:jn,rightContainerRef:wn,scrollContainerRef:Tn,sectionLeftRefs:Ti,sectionRightRefs:Ii,subSectionLeftRefs:Oi,subSectionRightRefs:Fi,lhsBadgeRefs:wi,rhsBadgeRefs:Bi,sectionRowRefs:ji,sectionRightRowRefs:Di,rhsTopSpacerRef:Bn,rhsBottomSpacerRef:Dn,lhsTopSpacerRef:On,lhsBottomSpacerRef:Fn,calculateLinesRef:Rn,setConnectedSections:en,setConnectedLines:on,cachedConnectedPositions:xn,closeMoreFunctionsPopup:Zn,setErrorToast:Xe,moreFunctions:qn,closeSummaryPopup:Un}),Li=Mi.isSideBySide,qi=Mi.isArrowVisible,Gi=Mi.setIsArrowVisible,Hi=Mi.isResizing,Vi=Mi.setIsResizing,Wi=Mi.isSideBySideLoading,zi=Mi.activeSideBySideSection,Ki=Mi.scrollLock,Ui=Mi.sideBySideCacheRef,Yi=Mi.isSideBySideRef,Ji=Mi.activeSideBySideRightSectionRef,Xi=Mi.activeSideBySideSectionRef,$i=Mi.sideBySideLineRef,Qi=Mi.highlightedClauseRefs,Zi=Mi.clearClauseHighlight,et=Mi.resetSideBySide,nt=Mi.activateSideBySide,it=i.useRef(nt);i.useEffect(function(){it.current=nt},[nt]);var tt=m.useAccordionState({maintainRelativeOrder:!!qe,proposedSections:pi,existingSections:hi,activeSideBySideSection:zi,connectedSections:Ze,resetSideBySide:et,setConnectedSections:en,setConnectedLines:on,cachedConnectedPositions:xn,svgContainerRef:dn,isAnimatingRef:hn,animationTimerRef:mn,calculateLinesRef:Rn,sectionLeftRefs:Ti,sectionRightRefs:Ii,subSectionLeftRefs:Oi,subSectionRightRefs:Fi}),ot=tt.expandedSections,rt=tt.setExpandedSections,lt=tt.expandedSubSections,ut=tt.setExpandedSubSections,st=tt.handleSubSectionToggle,at=tt.toggleSection,ct=tt.forceExpandCrossWiredSections,dt=function(){var e,n;if(null!=zi){var i=null===(e=Ti.current[zi])||void 0===e?void 0:e.current,t=null===(n=Ii.current[zi])||void 0===n?void 0:n.current,o=wn.current;if(i&&t&&o){var r=i.getBoundingClientRect(),l=t.getBoundingClientRect(),u=o.getBoundingClientRect(),s=r.top-u.top,a=l.top-u.top-s;o.scrollBy({top:a,behavior:"smooth"})}}},ft=i.useCallback(function(e){null==e||e.stopPropagation(),un(function(e){var n=!e;return n&&requestAnimationFrame(function(){dt()}),n})},[dt]);i.useEffect(function(){je&&"off"!==bi&&"0:0"!==bi&&(Ui.current=null,xn.current=[],requestAnimationFrame(function(){var e;null===(e=Rn.current)||void 0===e||e.call(Rn)}))},[je,bi]);var vt=i.useMemo(function(){var e=new Map,n=new Map,i=1;if(qe)pi.forEach(function(n){!n.title&&!n.content||n.id&&e.set(n.id,i++)}),hi.forEach(function(t){if(t.id&&!(!t.title&&!t.content)){var o=pi.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(pi.length,hi.length),o=0;o<t;o++){var r=pi[o],l=hi[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}},[pi,hi,qe]),gt=gi.analysis,pt=u.safeStringify(null===(Q=null===($=null==gt?void 0:gt.rule_difference_comparison)||void 0===$?void 0:$.summary)||void 0===Q?void 0:Q.overall_summary),ht=!!pt.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),mt=null!==(Z=null==me?void 0:me.base_root_id)&&void 0!==Z?Z:"-1";null==me||me[mt];var St=$e?null!==(de=null!==(se=Ie&&(null===(ue=null==Ie?void 0:Ie[mt])||void 0===ue?void 0:ue.evaluation_result))&&void 0!==se?se:null===(ce=null===(ae=null==me?void 0:me.nodes)||void 0===ae?void 0:ae[mt])||void 0===ce?void 0:ce.evaluation_result)&&void 0!==de?de:null:null!==(le=null!==(ie=Ie&&(null===(ne=null===(ee=null==Ie?void 0:Ie[mt])||void 0===ee?void 0:ee.evaluation_result)||void 0===ne?void 0:ne[0]))&&void 0!==ie?ie:null===(re=null===(oe=null===(te=null==me?void 0:me.nodes)||void 0===te?void 0:te[mt])||void 0===oe?void 0:oe.evaluation_result)||void 0===re?void 0:re[0])&&void 0!==le?le:null,xt=u.extractDeviationScore(St),Rt=u.generateColorPalette(null!==(ge=null===(ve=null===(fe=null==St?void 0:St.evaluation_outputs)||void 0===fe?void 0:fe.metadata)||void 0===ve?void 0:ve.label_color)&&void 0!==ge?ge:a.DEFAULT_DEVIAION_COLOR);if(ke){var _t=ke(xt);_t&&(Rt=e.__assign(e.__assign({},Rt),{badgeBg:_t.bg,badgeText:_t.text,badgeBorder:_t.border}))}var yt=i.useRef(et);i.useEffect(function(){yt.current=et},[et]);var bt=i.useRef(Qn);i.useEffect(function(){bt.current=Qn},[Qn]);var Ct=i.useCallback(function(e,n,i,t,o,r){return ko.current(e,n,i,t,o,r)},[]),Et=i.useCallback(function(e,n,i,t,o){return No.current(e,n,i,t,o)},[]),At=i.useCallback(function(){return Mo.current()},[]),Tt=i.useCallback(function(e,n){return Lo.current(e,n)},[]),It=i.useCallback(function(e){return qo.current(e)},[]),wt=i.useCallback(function(e){return Go.current(e)},[]),Bt=i.useCallback(function(){return Ho.current()},[]),Dt=i.useCallback(function(){var e,n;Zi(),null===(e=yt.current)||void 0===e||e.call(yt),un(!1),en(new Set),on([]),xn.current=[],eo([]),io(null),Kn(a.EMPTY_SUMMARY_POPUP_STATE),null===(n=bt.current)||void 0===n||n.call(bt),requestAnimationFrame(function(){var e;null===(e=Rn.current)||void 0===e||e.call(Rn)})},[]),Ot=i.useRef(Dt);i.useEffect(function(){Ot.current=Dt},[Dt]),i.useEffect(function(){ye&&Ot.current()},[ye]);var Ft=i.useMemo(function(){return{documents:null==me?void 0:me.documents,input_index_map:null==me?void 0:me.input_index_map}},[JSON.stringify(null==me?void 0:me.documents),JSON.stringify(null==me?void 0:me.input_index_map)]),jt=i.useState(""),kt=jt[0],Pt=jt[1],Nt=u.safeStringify(oi),Mt=i.useRef(me);i.useEffect(function(){var e,n,i;Mt.current=me;var t=null===(e=null==me?void 0:me.input_index_map)||void 0===e?void 0:e[0],o=null===(i=null===(n=null==me?void 0:me.documents)||void 0===n?void 0:n[t])||void 0===i?void 0:i.title;Pt(o)},[me]);var Lt=i.useRef(En);i.useEffect(function(){Lt.current=En},[En]);var qt=i.useCallback(function(n,i,t,o,r,l,s){var a,c,d,f,v,g,p,h,m,S,x=u.safeStringify(null==i?void 0:i.id)||u.safeStringify(null==t?void 0:t.id)||"",R=(x?null===(a=Lt.current)||void 0===a?void 0:a[x]:null)||(null==i?void 0:i.cognitiveData)||(null==t?void 0:t.cognitiveData)||{section_id:x,decisioning:[],gap:[],relevance_score:0},_=null!==(d=null===(c=ji.current[o])||void 0===c?void 0:c.current)&&void 0!==d?d:null,y=function(){var n,r,l=(null==i?void 0:i.evaluationResult)||(null==t?void 0:t.evaluationResult)||null,s=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(u.DEVIATION_BADGE_SEPARATOR)))return s(l);var a=o.split(u.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)}):s(l)}(),b=(null!==(g=null===(v=null===(f=null==y?void 0:y.cognitive_decisioning)||void 0===f?void 0:f.decisioning_factors)||void 0===v?void 0:v.length)&&void 0!==g?g:0)>0||(null!==(m=null===(h=null===(p=null==y?void 0:y.cognitive_decisioning)||void 0===p?void 0:p.gaps_in_decision)||void 0===h?void 0:h.length)&&void 0!==m?m:0)>0,C=null!==(S=null==Ce?void 0:Ce.isLoading)&&void 0!==S&&S,E=!0;if(fi){var A=null==y?void 0:y.deviation_highlights;if(A&&"object"==typeof A)E=Object.values(A).some(function(e){return Array.isArray(e)&&e.length>0});else E=!1}return{isLoading:C&&!b,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:R,anchorEl:n,sectionAnchorEl:_,badgeStyle:l||null,sectionIdx:o,docData:Ft,deviationData:y,isOrphan:!!r,hasGuidelineMatches:E}},[Ft,null==Ce?void 0:Ce.isLoading,fi]),Gt=i.useCallback(function(e,n,i,t,o,r){var l;if(e.stopPropagation(),qn.open&&qn.sectionIdx===o)Zn();else{var s=e.currentTarget,a="left";(null===(l=wn.current)||void 0===l?void 0:l.contains(s))&&(a="right");Zi(),Yi.current&&et(),en(new Set),on([]),xn.current=[],Qn(),zn.open?ho():Un(),requestAnimationFrame(function(){var e=function(){var e,n,i,t;if("string"==typeof o&&o.includes(u.DEVIATION_BADGE_SEPARATOR)){var r=o.split(u.DEVIATION_BADGE_SEPARATOR),l="".concat(r[0]).concat(u.DEVIATION_BADGE_SEPARATOR).concat(r[1]);return"right"===a?null===(e=Bi.current[l])||void 0===e?void 0:e.current:null===(n=wi.current[l])||void 0===n?void 0:n.current}return"right"===a?null===(i=Bi.current[o])||void 0===i?void 0:i.current:null===(t=wi.current[o])||void 0===t?void 0:t.current}()||s;Gn(qt(e,n,t,o,i,r))})}},[qn.open,qn.sectionIdx,Zn,Un,qt]),Ht=i.useCallback(function(){var e=qn.sectionIdx;qn.isOrphan,Zn(),Un(),null!==e&&(ct(e),Zi(),Yi.current&&et(),on([]),xn.current=[],fi&&null!==e&&cn(vo(e)),en(function(n){return n.has(e)?new Set:new Set([e])}),setTimeout(function(){Rn.current&&Rn.current()},50))},[qn.sectionIdx,qn.isOrphan,Zn,Un,et]),Vt=i.useCallback(function(){var e=pn.current;if(e){pn.current=null;var n=pi.findIndex(function(n){return n.id===e}),i=hi.findIndex(function(n){return n.id===e}),t=-1===n?u.findKeyPathByNodeId(pi,e):null,o=-1===i?u.findKeyPathByNodeId(hi,e):null,r=-1!==n?n:t?Number(t.split("-")[0]):-1,l=-1!==i?i:o?Number(o.split("-")[0]):-1,s=function(e,n,i,t){var o,r,l,u;return-1!==e?null!==(r=null===(o=i.current[e])||void 0===o?void 0:o.current)&&void 0!==r?r:null:n&&null!==(u=null===(l=t.current[n])||void 0===l?void 0:l.current)&&void 0!==u?u:null},a=function(e,n,i){void 0===i&&(i=30);var t=0,o=function(){var r=e();r&&0!==r.getBoundingClientRect().height?(Qi.current.add(r),u.scrollAndHighlightClause(r,n)):t++<i&&requestAnimationFrame(o)};requestAnimationFrame(o)};if(qe)-1!==r&&jn.current&&a(function(){return s(n,t,Ti,Oi)},jn.current),-1!==l&&wn.current&&a(function(){return s(i,o,Ii,Fi)},wn.current);else{var c=Tn.current;if(!c)return;a(function(){return-1!==r?s(n,t,Ti,Oi):s(i,o,Ii,Fi)},c)}}},[pi,hi,qe,Ti,Ii,Oi,Fi,jn,wn,Tn]),Wt=i.useCallback(function(n){if(n){Zi(),et(),en(new Set),on([]),xn.current=[],Un(),Qn();var i=pi.findIndex(function(e){return e.id===n}),t=hi.findIndex(function(e){return e.id===n}),o=-1===i?u.findKeyPathByNodeId(pi,n):null,r=-1===t?u.findKeyPathByNodeId(hi,n):null;if(-1!==i||o||-1!==t||r){var l=-1!==i?i:o?Number(o.split("-")[0]):-1,s=-1!==t?t:r?Number(r.split("-")[0]):-1;pn.current=n,rt(function(n){var i,t=e.__assign({},n),o=!1;-1!==l&&(t[i=qe?"left-".concat(l):String(l)]||(t[i]=!0,o=!0));-1!==s&&(t[i=qe?"right-".concat(s):String(s)]||(t[i]=!0,o=!0));return o?t:n}),ut(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(){pn.current===n&&zt.current()})},50)}else console.warn('scrollToAndHighlightClause: nodeId "'.concat(n,'" not found'))}},[pi,hi,qe,rt,ut,et,Un,Qn]),zt=i.useRef(Vt);i.useEffect(function(){zt.current=Vt},[Vt]);var Kt=i.useRef(null);i.useEffect(function(){if(ii){var e=ei.fields.find(function(e){return e.analysisKey===ii||e.key===ii});if(e){var n=Ei.current[e.key]||Ai.current[e.key];(null==n?void 0:n.current)&&setTimeout(function(){return n.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[ii,ei.fields]);var Ut=i.useCallback(function(e){var n,i,t,o,r,l,u,s,a,c=null===(n=null==gt?void 0:gt.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],f=(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 v=d.mappings[0]||{};return{score:d.score,relation:v.relation||"",highlightsA:(null===(l=v.highlights)||void 0===l?void 0:l.ruleA_spans)||[],highlightsB:(null===(u=v.highlights)||void 0===u?void 0:u.ruleB_spans)||[],hasContent:!!f}}return{score:d.score,relation:d.relation||"",highlightsA:(null===(s=d.highlights)||void 0===s?void 0:s.ruleA_spans)||[],highlightsB:(null===(a=d.highlights)||void 0===a?void 0:a.ruleB_spans)||[],hasContent:!!f}},[gt]),Yt=E.useStyleHelpers({proposedSections:pi,existingSections:hi,maintainRelativeOrder:qe,cognitiveMap:En,deviationData:Cn,treeData:me,resolvedComparisonConfig:ei,badgeStyleOverride:ke}),Jt=Yt.getSectionCompareStyle,Xt=Yt.getSubSectionCompareStyle,$t=Yt.getDeviationStyleByKey,Qt=T.useLinesCalculator({containerRef:fn,leftContainerRef:jn,rightContainerRef:wn,svgContainerRef:dn,pathRefs:Sn,leftHeaderRef:vn,rightHeaderRef:gn,proposedSections:pi,existingSections:hi,visibleFields:mi,leftRefs:Ei,rightRefs:Ai,sectionLeftRefs:Ti,sectionRightRefs:Ii,subSectionLeftRefs:Oi,subSectionRightRefs:Fi,lhsBadgeRefs:wi,rhsBadgeRefs:Bi,sectionRowRefs:ji,expandedSections:ot,expandedSubSections:lt,connectedSections:Ze,isSideBySide:Li,activeSideBySideSection:zi,maintainRelativeOrder:qe,isGuidelineMode:fi,cognitiveMap:En,getSectionCompareStyle:Jt,getSubSectionCompareStyle:Xt,getDeviationStyleByKey:$t,isArrowVisible:qi,isAnimatingRef:hn,isSideBySideRef:Yi,sideBySideCacheRef:Ui,sideBySideLineRef:$i,activeSideBySideSectionRef:Xi,activeSideBySideRightSectionRef:Ji,connectedLines:tn,setConnectedLines:on,cachedConnectedPositions:xn,calculateLinesRef:Rn,resizeTimerRef:_n,scrollLock:Ki,scrollSyncLocked:ln,handleResizeRef:yn,activeProposed:vi,existingRule:gi,analysisData:gt,pendingScrollTargetRef:kn,pendingScrollCallbackRef:Pn,resolvedComparisonConfig:ei,getFieldData:Ut}),Zt=Qt.lines,eo=Qt.setLines,no=Qt.overallConnector,io=Qt.setOverallConnector,to=Qt.svgDimensions,oo=Qt.handleColumnScroll;i.useEffect(function(){zn.anchorEl&&requestAnimationFrame(function(){requestAnimationFrame(function(){var e;null===(e=Rn.current)||void 0===e||e.call(Rn)})})},[zn.anchorEl,ln]);var ro=i.useCallback(function(){Zi(),un(!1),rt({}),ut({}),et(),en(new Set),on([]),xn.current=[],Un(),Qn(),Zn(),requestAnimationFrame(function(){Rn.current&&Rn.current()})},[rt,ut,et,Un,Qn,Zn]);i.useEffect(function(){Li||0!==Ze.size||un(!1)},[Li,Ze]);var lo=i.useMemo(function(){return Object.values(ot).some(Boolean)||Object.values(lt).some(Boolean)},[ot,lt]),uo=i.useRef(null),so=i.useRef(0),ao=i.useRef(0),co=i.useRef(0),fo=A.useResizeHandler({timerRef:uo,ruleComponentRef:In,scrollContainerRef:Tn,containerRef:fn,maintainRelativeOrder:qe,proposedSections:pi,existingSections:hi,isSideBySideRef:Yi,activeSideBySideSectionRef:Xi,activeSideBySideRightSectionRef:Ji,sectionRowRefs:ji,sectionRightRowRefs:Di,sectionLeftRefs:Ti,sectionRightRefs:Ii,subSectionLeftRefs:Oi,subSectionRightRefs:Fi,lhsBadgeRefs:wi,rhsBadgeRefs:Bi,leftContainerRef:jn,rightContainerRef:wn,calculateLinesRef:Rn,handleResizeRef:yn,setIsResizing:Vi,setIsArrowVisible:Gi,sideBySideCacheRef:Ui,cachedConnectedPositions:xn}).handleResize;i.useEffect(function(){yn.current=fo},[fo,yn]),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,u;i.current=null;var s=e[e.length-1];if(s){var a=null!==(u=null===(l=null===(r=s.borderBoxSize)||void 0===r?void 0:r[0])||void 0===l?void 0:l.inlineSize)&&void 0!==u?u:s.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 In.current&&o.push(e(In.current,so,n,function(){return yn.current()},function(){})),Tn.current&&o.push(e(Tn.current,ao,i,function(){return yn.current()},function(){return Rn.current()})),fn.current&&o.push(e(fn.current,co,t,function(){return yn.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(){Yi.current=Li},[Li]),i.useEffect(function(){Xi.current=zi},[zi]);var vo=i.useCallback(function(e){var n,i,t,o,r,l="",s="0";if("number"==typeof e)l=(null===(n=pi[e])||void 0===n?void 0:n.nodeId)||(null===(i=pi[e])||void 0===i?void 0:i.id)||"";else{var a=String(e).split(u.DEVIATION_BADGE_SEPARATOR);l=a[0],s=a[1]||"0"}var c=null===(t=null==Cn?void 0:Cn[l])||void 0===t?void 0:t.evaluation_result,d=Array.isArray(c)?c[parseInt(s,10)]:null==c?void 0:c[s];return!1===(null===(r=null===(o=null==d?void 0:d.evaluation_outputs)||void 0===o?void 0:o.guideline_flag)||void 0===r?void 0:r.rulebook_used)?1:0},[pi,Cn]),go=i.useCallback(function(e){var n,i,t=jn.current,o=wn.current;if(o){var r=o.querySelectorAll('[id^="guideline-target-"], [data-web-gpt-active="true"]'),l=Array.from(r).filter(function(e){var n=e.getBoundingClientRect();return n.width>0&&n.height>0}),s="string"==typeof e&&e.includes(u.DEVIATION_BADGE_SEPARATOR),a=e;if(s){var c=e.split(u.DEVIATION_BADGE_SEPARATOR);c.length>=2&&(a="".concat(c[0]).concat(u.DEVIATION_BADGE_SEPARATOR).concat(c[1]))}var d=(null===(n=wi.current[a])||void 0===n?void 0:n.current)||(null===(i=wi.current[e])||void 0===i?void 0:i.current);if(l.length>0&&d&&t&&o){var f=l[0];On.current&&(On.current.style.height="0px"),Bn.current&&(Bn.current.style.height="0px"),Fn.current&&(Fn.current.style.height="0px"),Dn.current&&(Dn.current.style.height="0px"),requestAnimationFrame(function(){var e=d.getBoundingClientRect(),n=f.getBoundingClientRect(),i=t.getBoundingClientRect(),r=o.getBoundingClientRect(),l=t.scrollTop+(e.top-i.top)+e.height/2,u=o.scrollTop+(n.top-r.top)+n.height/2,s=l-i.height/2,a=Math.max(0,s),c=t.scrollHeight-t.clientHeight,v=a>c?a-c:0,g=i.top+l-a,p=r.top+u-g,h=0;p<0&&(h=Math.abs(p),p=0);var m=o.scrollHeight-o.clientHeight+h,S=p>m?p-m:0;Fn.current&&(Fn.current.style.height="".concat(v,"px")),Bn.current&&(Bn.current.style.height="".concat(h,"px")),Dn.current&&(Dn.current.style.height="".concat(S,"px")),requestAnimationFrame(function(){t.scrollTo({top:a,behavior:"smooth"}),o.scrollTo({top:p,behavior:"smooth"}),Rn.current&&setTimeout(function(){return Rn.current()},50)})})}}},[u.DEVIATION_BADGE_SEPARATOR]),po=i.useCallback(function(){var e,n=qn.sectionIdx,i=qn.isOrphan;if(Un(),null!=n){var t="left";qn.anchorEl&&(null===(e=wn.current)||void 0===e?void 0:e.contains(qn.anchorEl))&&(t="right"),ct(n),fi&&(cn(vo(n)),en(new Set([n]))),nt(n,i,{sourceSide:t,onReady:function(){fi&&setTimeout(function(){return go(String(n))},150)}})}},[nt,qn.isOrphan,qn.sectionIdx,qn.anchorEl,Un,ct,fi,go,vo]),ho=i.useCallback(function(){Un(),et(),en(new Set),on([]),xn.current=[]},[Un,et]),mo=null!==qn.sectionIdx&&Ze.has(qn.sectionIdx),So=S.useDeviationNavigation({proposedSections:pi,existingSections:hi,parentDeviationRecord:Si,expandedSections:ot,maintainRelativeOrder:!!qe,scrollContainerRef:Tn,leftContainerRef:jn,rightContainerRef:wn,lhsBadgeRefs:wi,rhsBadgeRefs:Bi}),xo=So.showDeviationNavigation,Ro=So.showOpenNodeRef,_o=So.adjustScrollForPopup,yo=i.useCallback(function(e,n,i,t,o){var r,l="string"==typeof t?u.safeStringify(t).trim():u.safeStringify(null==t?void 0:t.deviation_summary).trim(),s=e.currentTarget;Qn();var a="left";(null===(r=wn.current)||void 0===r?void 0:r.contains(s))&&(a="right");var c=function(){var e,i,t,o;if("string"==typeof n&&n.includes(u.DEVIATION_BADGE_SEPARATOR)){var r=n.split(u.DEVIATION_BADGE_SEPARATOR),l="".concat(r[0]).concat(u.DEVIATION_BADGE_SEPARATOR).concat(r[1]);return"right"===a?null===(e=Bi.current[l])||void 0===e?void 0:e.current:null===(i=wi.current[l])||void 0===i?void 0:i.current}return"right"===a?null===(t=Bi.current[n])||void 0===t?void 0:t.current:null===(o=wi.current[n])||void 0===o?void 0:o.current};if(i&&!fi)return et(),en(new Set),on([]),xn.current=[],void(l&&(ct(n),requestAnimationFrame(function(){var e=c()||s;e&&(e.getBoundingClientRect().top>.8*window.innerHeight&&e.scrollIntoView({behavior:"smooth",block:"center"}));Kn({open:!0,anchorEl:e,summary:t,displayImpact:o})})));ct(n),fi&&(cn(vo(n)),en(new Set([n]))),l?setTimeout(function(){nt(n,i,{toggleIfSame:!1,sourceSide:a,onReady:function(){var e,i,r,l=c()||s;if(fi)setTimeout(function(){return go(n)},150);else if(l){var u=l.getBoundingClientRect();if(u.top>.8*window.innerHeight||u.top<100){var a=u.top-window.innerHeight/2;qe?(null===(e=jn.current)||void 0===e||e.scrollBy({top:a,behavior:"smooth"}),null===(i=wn.current)||void 0===i||i.scrollBy({top:a,behavior:"smooth"})):null===(r=Tn.current)||void 0===r||r.scrollBy({top:a,behavior:"smooth"})}}Kn({open:!0,anchorEl:l,summary:t,displayImpact:o})}})},350):setTimeout(function(){nt(n,i,{toggleIfSame:!1,sourceSide:a}),fi&&setTimeout(function(){return go(n)},150)},350)},[nt,Qn,Kn,et,ct,fi,qe,go,Cn]),bo=i.useMemo(function(){var e;if(!we)return null;var n=null===(e=null==we?void 0:we.id)||void 0===e?void 0:e.split(":")[0];for(var i in Si){if((Si[i]||[]).some(function(e){return e.id===n}))return i}return null},[we,Si]),Co=i.useRef({id:null,triggerMs:null}),Eo=i.useRef(null);i.useEffect(function(){if(null==we?void 0:we.id){var n=Number(we.trigger),i=Co.current;if((null==i?void 0:i.id)!==we.id||(null==i?void 0:i.triggerMs)!==n){if(we.id.includes(":")&&/:\d+$/.test(we.id)){var t=we.id.split(":"),o=t[0],r=t[1],l=null!=r?r:"0",s="".concat(we.id,":").concat(n);Eo.current!==s&&(Un(),Qn(),et(),en(new Set),on([]),xn.current=[],Eo.current=s);var a=!1,c=0,d=null,f=null,v=!1,g=function(e,n){for(var i=function(e,t){if(!e)return null;if(n.includes(e.id)||n.includes(e.nodeId)||n.includes(e.contentId))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 i,t,r;if(!a){var s=function(){Co.current={id:we.id,triggerMs:n}},h=null,m=null;for(var S in Si){var x=Si[S].find(function(e){var n;return e.id===o||e.nodeId===o||e.contentId===o||(null===(n=e.evaluationResult)||void 0===n?void 0:n.nodeId)===o});if(x){h=S,m=x;break}}if(m&&h){var R=Array.from(new Set([o,m.id,m.nodeId,m.contentId,null===(i=m.evaluationResult)||void 0===i?void 0:i.nodeId].filter(Boolean))),_=pi.findIndex(function(e){return e.id===h}),y=hi.findIndex(function(e){return e.id===h}),b=-1===_&&-1!==y,C=g(pi,R),E=g(hi,R);if(C&&!E&&!b){var A=C.split("-"),T=Number(A[0]);if(qe){var I=null===(r=null===(t=pi[T])||void 0===t?void 0:t.refIndexes)||void 0===r?void 0:r[0],w=hi.findIndex(function(e){return e.selfIndex===I});-1!==w&&(T=w)}E=e.__spreadArray([T],A.slice(1),!0).join("-")}if(C||E){var B=C?Number(C.split("-")[0]):_,D=E?Number(E.split("-")[0]):y,O=D>=0?D:E?Number(E.split("-")[0]):-1,F=pi[B],j=hi[O],k=F&&!F.title&&!F.content,P=j&&!j.title&&!j.content,N=b||(!C&&!!E||k&&!P);if(N){if(!(qe?!!Po.current["right-".concat(D)]:!!Po.current[String(D)])&&D>=0)return at(D,"right"),void(d=setTimeout(p,200))}else if(!(qe?!!Po.current["left-".concat(B)]:!!Po.current[String(B)])&&B>=0)return at(B,"left"),void(d=setTimeout(p,200));var M=C||"",L=E||"",q=R.map(function(e){return"".concat(e).concat(u.DEVIATION_BADGE_SEPARATOR).concat(l)}),G=q[0],H=function(){for(var e,n,i=0,t=q;i<t.length;i++){var o=t[i],r=(null===(e=wi.current[o])||void 0===e?void 0:e.current)||null,l=(null===(n=Bi.current[o])||void 0===n?void 0:n.current)||null;if(r||l)return{refId:o,left:r,right:l}}return{refId:G,left:null,right:null}},V=function(e){return"".concat(e).concat(u.DEVIATION_BADGE_SEPARATOR).concat(M).concat(u.DEVIATION_BADGE_SEPARATOR).concat(L)};if(!v){ct(V(G)),v=!0,c=0;var W=function(){var e=H(),n=e.left,i=e.right;return N||!n&&!!i?i:n};return null==f||f(),void(d=setTimeout(function(){var e,n,i,t,o,r,l,u;a||(e=W,n=function(){a||(f=null,p())},t=0,o=null,r=null,l=performance.now(),u=function(){if(!a)if(performance.now()-l>3e3)n();else{var s=e();if(s&&0!==s.getBoundingClientRect().height){var c=s.getBoundingClientRect(),d=c.top,f=c.height,v=null!==o&&Math.abs(d-o)<.5,g=null!==r&&Math.abs(f-r)<.5;if(v&&g){if(++t>=5)return void n()}else t=0;o=d,r=f,i=requestAnimationFrame(u)}else i=requestAnimationFrame(u)}},i=requestAnimationFrame(u),f=function(){return cancelAnimationFrame(i)})},300))}var z=H(),K=z.refId,U=z.left,Y=z.right,J=V(K);if(U||Y){var X=N||!U&&!!Y,$=X?Y:U,Q=qe?X?wn.current:jn.current:Tn.current;if($&&Q){var Z=$.getBoundingClientRect();if(0!==Z.height){var ee=Q.getBoundingClientRect(),ne=Z.top-ee.top+Q.scrollTop-ee.height/2+Z.height/2,ie=(null==C?void 0:C.includes("-"))||(null==E?void 0:E.includes("-")),te=function(){return e.__awaiter(void 0,void 0,void 0,function(){var n,i,t,o,r,c,d,f,v,g;return e.__generator(this,function(p){switch(p.label){case 0:return a?[2]:(s(),n=$ instanceof Element?window.getComputedStyle($).color:"",[U,Y].forEach(function(e){e&&(e.style.transition="box-shadow 300ms ease-in-out",e.style.boxShadow="0 0 10px ".concat(n))}),setTimeout(function(){[U,Y].forEach(function(e){e&&(e.style.boxShadow="")})},2e3),i=(null===(d=null===(c=m.evaluationResult)||void 0===c?void 0:c.deviations)||void 0===d?void 0:d[l])||m,t=(null===(f=m.evaluationResult)||void 0===f?void 0:f.evaluation_outputs)||m.evaluation_outputs,!!U&&!!Y||fi?(r=function(e,n){return Promise.race([e,new Promise(function(e){return setTimeout(e,n)})])},qe?[4,Promise.all([jn.current?r(u.waitForScrollIdle(jn.current),600):Promise.resolve(),wn.current?r(u.waitForScrollIdle(wn.current),600):Promise.resolve()])]:[3,2]):(o=X?(null===(v=Bi.current[ie?K:D])||void 0===v?void 0:v.current)||Y:(null===(g=wi.current[ie?K:B])||void 0===g?void 0:g.current)||U,_o(o,function(){Kn({open:!0,anchorEl:o,displayImpact:we.displayImpact,summary:e.__assign(e.__assign({},i),{evaluation_outputs:t})})},{skipScroll:!0}),null==Be||Be(),[2]));case 1:p.sent(),p.label=2;case 2:return fi&&(cn(vo(J)),en(new Set([J]))),it.current(J,!1,{toggleIfSame:!1,sourceSide:b?"right":"left",onReady:function(){var n,t,o,r;s();var l=X?(null===(n=Bi.current[K])||void 0===n?void 0:n.current)||Y:(null===(t=wi.current[K])||void 0===t?void 0:t.current)||U;if(fi)setTimeout(function(){return go(J)},150);else{var u=(null===(o=wi.current[K])||void 0===o?void 0:o.current)||U,a=(null===(r=Bi.current[K])||void 0===r?void 0:r.current)||Y;u&&(u.style.scrollMarginTop="150px",u.scrollIntoView({behavior:"smooth",block:"start"})),a&&(a.style.scrollMarginTop="150px",a.scrollIntoView({behavior:"smooth",block:"start"}))}Kn({open:!0,anchorEl:l,displayImpact:we.displayImpact,summary:e.__assign({},i)}),null==Be||Be()}}),[2]}})})};Math.abs(Q.scrollTop-ne)<=2?te():u.scrollAndWait(Q,ne,te)}else++c<30&&(d=setTimeout(p,100))}else++c<30&&(d=setTimeout(p,100))}else++c<30&&(d=setTimeout(p,100))}else++c<30&&(d=setTimeout(p,100))}else++c<30&&(d=setTimeout(p,100))}};return d=setTimeout(p,100),function(){a=!0,d&&clearTimeout(d),null==f||f()}}Co.current={id:we.id,triggerMs:n},Wt(we.id);var h=pi.findIndex(function(e){return e.id===we.id}),m=hi.findIndex(function(e){return e.id===we.id});-1===h&&-1===m||setTimeout(function(){var e=-1!==h?h:m,n=-1===h;fi&&cn(vo(e)),en(new Set([e])),it.current(e,n,{sourceSide:n?"right":"left",onReady:function(){fi&&setTimeout(function(){return go(String(e))},150)}})},400)}}},[null==we?void 0:we.id,null==we?void 0:we.trigger,null==we?void 0:we.displayImpact,Si,pi,hi,qe,Kn,Wt,fi,vo,go]),i.useEffect(function(){var n,i,t;if(zn.open){var o=zn.anchorEl;if(o&&!o.isConnected){var r=function(e){for(var n,i=0,t=Object.entries(e);i<t.length;i++){var r=t[i],l=r[0];if((null===(n=r[1].current)||void 0===n?void 0:n.textContent)===o.textContent)return l}return null},l=(null===(n=o.dataset)||void 0===n?void 0:n.deviationRefId)||r(wi.current)||r(Bi.current);if(l){var u=(null===(i=Bi.current[l])||void 0===i?void 0:i.current)||(null===(t=wi.current[l])||void 0===t?void 0:t.current);u&&u.isConnected&&Kn(function(n){return e.__assign(e.__assign({},n),{anchorEl:u})})}}}},[zn.open,zn.anchorEl,ln,Ze,ot]);var Ao=Mn.open,To=Mn.sectionIdx,Io=Mn.isOrphan,wo=Mn.badgeStyle,Bo=Mn.anchorEl,Do=Mn.sectionAnchorEl;i.useEffect(function(){var n,i;if(Ce.isStreamingEnabled&&Ao&&null!=To&&To!==mt){var t="string"==typeof To?To.split(u.DEVIATION_BADGE_SEPARATOR)[0]:null,o=function(e,n){var i;if(!e||!Array.isArray(e))return null;for(var t=0,r=e;t<r.length;t++){var l=r[t];if(l.id===n)return l;if(null===(i=l.subsections)||void 0===i?void 0:i.length){var u=o(l.subsections,n);if(u)return u}}return null},r=t&&"string"==typeof t?o(pi,t):null,l=t&&"string"==typeof t?o(hi,t):null,s="number"==typeof To?pi[To]||null:r||t&&((null===(n=null==me?void 0:me.nodes)||void 0===n?void 0:n[t])||(null==me?void 0:me[t]))||null,a="number"==typeof To&&qe?null===(i=null==s?void 0:s.refIndexes)||void 0===i?void 0:i[0]:void 0,c="number"==typeof To?(null!=a?hi.find(function(e){return e.selfIndex===a}):hi[To])||null:l,d=qt(Bo,s,c,To,Io,wo);Ln(function(n){return n.open?u.safeStringify(n.cognitiveData)===u.safeStringify(d.cognitiveData)&&u.safeStringify(n.deviationData)===u.safeStringify(d.deviationData)&&n.sectionTitle===d.sectionTitle&&n.refSectionTitle===d.refSectionTitle?n:e.__assign(e.__assign(e.__assign({},n),d),{open:!0,anchorEl:n.anchorEl,sectionAnchorEl:n.sectionAnchorEl}):n})}},[Ao,To,Io,wo,Bo,Do,pi,hi,qe,qt]);var Oo=i.useCallback(function(e){var i=e.section,t=e.keyPath,o=e.depth,r=void 0===o?0:o,l=e.columnKey,u=void 0===l?"left":l,s=e.parentNodeId,a=void 0===s?"":s,c=e.sectionOffset,d=e.rhsOrphanVisualIndexes;return n.jsx(R.default,{section:i,keyPath:t,depth:r,columnKey:u,parentNodeId:a,sectionOffset:c,rhsOrphanVisualIndexes:d})},[]),Fo=i.useMemo(function(){return pi.map(function(e,i){var t,o,r=!(null==e?void 0:e.title)&&!(null==e?void 0:e.content),l=!(null==e?void 0:e.refIndexes)||0===e.refIndexes.length;return r&&l&&qe?null:n.jsx(_.default,{section:e,idx:i},null!==(o=null!==(t=null==e?void 0:e.layoutKey)&&void 0!==t?t:null==e?void 0:e.id)&&void 0!==o?o:"left-row-".concat(i))})},[pi,qe]),jo=i.useMemo(function(){return hi.map(function(e,i){var t,o,r=!(null==e?void 0:e.title)&&!(null==e?void 0:e.content),l=!(null==e?void 0:e.refIndexes)||0===e.refIndexes.length;return r&&l&&qe?null:n.jsx(y.default,{section:e,idx:i},null!==(o=null!==(t=null==e?void 0:e.layoutKey)&&void 0!==t?t:null==e?void 0:e.id)&&void 0!==o?o:"right-row-".concat(i))})},[hi,qe]),ko=i.useRef(Gt);i.useEffect(function(){ko.current=Gt},[Gt]);var Po=i.useRef(ot);i.useEffect(function(){Po.current=ot},[ot]);var No=i.useRef(yo);i.useEffect(function(){No.current=yo},[yo]);var Mo=i.useRef(ho);i.useEffect(function(){Mo.current=ho},[ho]);var Lo=i.useRef(at);i.useEffect(function(){Lo.current=at},[at]);var qo=i.useRef(st);i.useEffect(function(){qo.current=st},[st]);var Go=i.useRef(Oo);i.useEffect(function(){Go.current=Oo},[Oo]);var Ho=i.useRef(et);i.useEffect(function(){Ho.current=et},[et]);var Vo=i.useMemo(function(){return{isGuidelineMode:fi,maintainRelativeOrder:!!qe,showDeviationBadges:We,isProposingFix:Oe,proposingFixNodeId:Fe,isRedlineFlow:je,isSideBySide:Li,activeSideBySideSection:zi,scrollSyncLocked:ln,toggleScrollSyncLocked:ft,summaryPopupAnchorEl:zn.anchorEl,connectedSections:Ze,proposedSections:pi,existingSections:hi,deviationNumberRegistry:xi,deviationParentRegistry:Ri,treeData:me,displayConfig:Ce,resolvedMarkdownStyles:An,unifiedNumbering:vt,expandedSections:ot,expandedSubSections:lt,setExpandedSubSections:ut,getSectionCompareStyle:Jt,getSubSectionCompareStyle:Xt,getBadgeRef:Ni,getSectionRowRef:ki,getSubSectionRef:Pi,sectionLeftRefs:Ti,sectionRightRefs:Ii,sectionRowRefs:ji,sectionRightRowRefs:Di,subSectionLeftRefs:Oi,subSectionRightRefs:Fi,lhsBadgeRefs:wi,rhsBadgeRefs:Bi,openMoreFunctionsPopup:Ct,handleOpenSummaryPopup:Et,openSummaryPopup:Et,handleCloseSummaryPopup:At,toggleSection:Tt,handleSubSectionToggle:It,renderSubSectionAccordion:wt,resetSideBySide:Bt,setConnectedSections:en,setConnectedLines:on,cachedConnectedPositions:xn,showDeviationNavigation:xo,showOpenNodeRef:Ro,deviationNodeIdToView:null==we?void 0:we.id,deviationTargetParentId:bo,guidelinesData:Pe,gptWebCitationConfig:Me}},[fi,qe,We,Oe,Fe,je,Li,zi,ln,ft,zn.anchorEl,Ze,pi,hi,xi,Ce,An,vt,ot,lt,ut,Jt,Xt,Ni,ki,Pi,xo,Ro,we,bo,Pe,Me]),Wo=u.safeStringify(Mn.sectionTitle||ui||ri),zo=u.safeStringify(fi?ai||ci||Mn.refSectionTitle:Mn.refSectionTitle||ai||ci);return n.jsx(C.CompareContextProvider,e.__assign({value:Vo},{children:n.jsxs(t.Box,e.__assign({ref:In,sx:{display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif',overflow:"visible",position:"relative"}},{children:[Ke&&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(f.default,{})})),zn.open&&n.jsx(b.default,{open:zn.open,anchorEl:zn.anchorEl,containerEl:Kt.current,clipTopEl:vn.current,scrollContainerEl:Tn.current,onClose:ho,summary:zn.summary,displayImpact:zn.displayImpact,isScrollLocked:ln}),n.jsx(d.default,{open:qn.open,anchorEl:qn.anchorEl,maintainRelativeOrder:!!qe,sectionTitle:qn.sectionTitle,referenceSectionTitle:qn.refSectionTitle,onClose:Zn,onOpenCognitiveCompare:Xn,onOpenSideBySide:po,onConnect:Ht,isConnected:mo,isOrphan:!fi&&!!qn.isOrphan,isGuidelineMode:fi,hasGuidelineMatches:qn.hasGuidelineMatches}),Mn.open&&n.jsx(c.default,{open:Mn.open,popupRef:Jn,position:Hn,popupConfig:Ae,onClose:function(){Vn(null),Ln(function(n){return e.__assign(e.__assign({},n),{open:!1})}),Yn(null)},markdownStyles:_e,sectionTitle:Wo,referenceSectionTitle:zo,cognitiveData:Mn.cognitiveData,anchorEl:Mn.anchorEl,sectionAnchorEl:Mn.sectionAnchorEl,scrollContainerEl:Tn.current,badgeStyle:Mn.badgeStyle,docData:Mn.docData,deviationData:Mn.deviationData,isLoading:Mn.isLoading}),n.jsx(t.Snackbar,e.__assign({open:!!Je,autoHideDuration:8e3,onClose:function(){return Xe(null)},anchorOrigin:{vertical:"top",horizontal:"center"}},{children:n.jsx(t.Alert,e.__assign({onClose:function(){return Xe(null)},severity:"error",sx:{width:"100%",whiteSpace:"pre-line"}},{children:Je}))})),n.jsx(x.default,{componentHeaderText:he,displayConfig:Ce,maintainRelativeOrder:qe,onCollapseAll:ro,showCollapseAll:lo,onToggleView:function(e){Ue(!0),setTimeout(function(){Ge(!e),null==Ee||Ee(!e),un(!1),et(),Un(),en(new Set),on([]),xn.current=[],requestAnimationFrame(function(){requestAnimationFrame(function(){setTimeout(function(){Ue(!1)},600)})})},50)}}),n.jsx(t.Box,e.__assign({ref:Tn,onScroll:oo,sx:{flex:1,minHeight:0,pt:1.5,pb:1,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",overflowY:qe?"visible":"auto",borderTop:pt&&ht?"none":"1.5px solid #EEF0F4"}},{children:n.jsx(t.Box,e.__assign({sx:e.__assign({display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"},qe?{flex:1}:{})},{children:n.jsxs(t.Box,e.__assign({ref:fn,sx:e.__assign({display:"grid",gridTemplateColumns:"minmax(0, 1fr) 180px minmax(0, 1fr)",gap:"100px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0},qe?{flex:1,overflow:"visible"}:{})},{children:[n.jsx(w.default,{svgContainerRef:dn,svgDimensions:to,isResizing:Hi,overallConnector:no,rootDeviationStyle:Rt,lines:Zt,isSideBySide:Li,activeSideBySideSection:zi,isArrowVisible:qi,maintainRelativeOrder:qe,proposedSections:pi,existingSections:hi,cognitivePopup:Mn,activeBadgeId:Wn,closeCognitivePopup:Qn,setActiveBadgeId:Yn,openCognitivePopupFromState:$n,buildSectionPopupState:qt,connectedLines:tn,isGuidelineMode:fi,pathRefs:Sn}),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)"},qe?{flex:1,overflow:"visible"}:{})},{children:[n.jsx(t.Box,e.__assign({ref:vn,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:ri,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:ri}))}))})),n.jsxs(t.Box,e.__assign({ref:jn,onScroll:oo,sx:e.__assign({p:"12px",display:"flex",flexDirection:"column"},qe?{maxHeight:"calc(100vh - 250px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,mr:"-180px",pr:"192px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[n.jsx("div",{ref:On,style:{width:"100%",height:"0px",flexShrink:0}}),yi&&Fo,n.jsx("div",{ref:Fn,style:{width:"100%",height:"0px",flexShrink:0}})]}))]})),n.jsx(t.Box,e.__assign({ref:Kt,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(),Mn.open&&Wn===mt?Qn():(Yn(mt),$n(qt(n.currentTarget,{title:kt,content:"",evaluationResult:St,cognitiveData:{section_id:"",decisioning:[],gap:[],relevance_score:0,isMissingRationale:!0}},{title:Nt,content:""},mt,!0,e.__assign(e.__assign({},Rt),{label:""}))))},sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:"5px",top:"-8px",borderRadius:"20px",bgcolor:Rt.badgeBg,color:Rt.badgeText,border:"1px solid ".concat(Rt.badgeBorder),fontSize:"12px",fontWeight:600,whiteSpace:"nowrap",position:"relative",zIndex:1,pointerEvents:"auto",cursor:"pointer"}},{children:[null!=xt?xt:n.jsx(v.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:Mn.open&&Wn===mt?"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},qe?{flex:1,overflow:"visible",minHeight:0}:{})},{children:[Wi&&n.jsx(l.default,{sections:11}),n.jsx(t.Box,e.__assign({ref:gn,sx:e.__assign({p:"8px",bgcolor:fi?"#F1F3F5":"#F7F8FA",borderBottom:"1px solid #D7DCE2",borderRadius:"8px 8px 0 0",display:"flex",alignItems:"center"},qe?e.__assign({maxHeight:"calc(100vh - 250px)",overflowY:"auto",overflowX:"hidden",minHeight:0},fi?{"&::-webkit-scrollbar":{width:"6px",display:"block"},"&::-webkit-scrollbar-track":{background:"transparent"},"&::-webkit-scrollbar-thumb":{background:"#CBD5E1",borderRadius:"10px"},"&::-webkit-scrollbar-thumb:hover":{background:"#94A3B8"},scrollbarWidth:"thin",scrollbarColor:"#CBD5E1 transparent"}:{"&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}):{})},{children:fi?n.jsxs(t.Tabs,e.__assign({value:an,onChange:function(e,n){return cn(n)},variant:"fullWidth",TabIndicatorProps:{sx:{display:"none"}},sx:{width:"100%",minHeight:"36px","& .MuiTab-root":{minHeight:"36px",px:1,py:0,borderRadius:"8px",fontSize:"14px",lineHeight:1,fontWeight:500,textTransform:"none",color:"#374151",minWidth:0,transition:"background-color 160ms ease, box-shadow 160ms ease"},"& .Mui-selected":{color:"#374151",bgcolor:"#FFFFFF"}}},{children:[n.jsx(t.Tab,{label:n.jsx(t.Tooltip,e.__assign({title:ci,placement:"top"},{children:n.jsx(t.Box,e.__assign({component:"span",sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"block",width:"100%"}},{children:"Redline Guidelines"}))}))}),n.jsx(t.Tab,{label:n.jsx(t.Tooltip,e.__assign({title:"Web & GPT Sources",placement:"top"},{children:n.jsx(t.Box,e.__assign({component:"span",sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"block",width:"100%"}},{children:"Web & GPT Sources"}))}))})]})):n.jsx(t.Tooltip,e.__assign({title:ci,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:ci}))}))})),n.jsxs(t.Box,e.__assign({ref:wn,onScroll:oo,sx:e.__assign({p:fi?"0px":"12px",display:"flex",flexDirection:"column"},qe?e.__assign(e.__assign({maxHeight:"calc(100vh - 250px)"},!fi&&{flex:1}),{overflowY:"auto",overflowX:"hidden",minHeight:0,ml:"-150px",pl:"165px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}):{})},{children:[n.jsx("div",{ref:Bn,style:{width:"100%",height:"0px",flexShrink:0}}),fi?Pe?0===an?n.jsx(B.default,{guidelinesData:Pe,deviationData:Ie,connectedSections:Ze,proposedSections:pi}):n.jsx(D.default,{deviationData:Ie,connectedSections:Ze,proposedSections:pi}):n.jsx(O.GuidelineSkeleton,{}):yi&&jo,n.jsx("div",{ref:Dn,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"),u=require("./CognitiveComparehelpers.js"),s=require("./CognitiveCompareConfig.js"),a=require("./CognitiveCompareConstants.js"),c=require("./CognitivePopup.js"),d=require("./MoreFunctionsPopup.js"),f=require("./LoaderComponent.js"),v=require("./components/ThreeDotsLoader.js"),g=require("./hooks/useCompareData.js"),p=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"),b=require("./components/RHSSectionRow.js"),y=require("./components/CognitiveSummaryPopup.js"),C=require("./CompareContext.js"),E=require("./hooks/useStyles.js"),A=require("./hooks/useResizeHandler.js"),T=require("./hooks/useLinesCalculator.js"),w=require("./hooks/useSideBySide.js"),I=require("./components/SvgConnectors.js"),B=require("./Guidelines/components/GuidelinePanel.js"),D=require("./Guidelines/components/WebGptPanel.js");exports.SHARED_MARKDOWN_STYLES=s.SHARED_MARKDOWN_STYLES,exports.default=function(O){var F,j,P,k,N,M,L,q,H,G,V,W,z,K,U,Y,J,X,$,Q,Z,ee,ne,ie,te,oe,re,le,ue,se,ae,ce,de,fe,ve,ge=O.componentHeaderText,pe=void 0===ge?a.DEFAULT_COMPONENT_HEADER_TEXT:ge,he=O.treeData,me=O.comparisonConfig,Se=O.leftColumnTitleText,Re=O.rightColumnTitleText,xe=O.markdownStyles,_e=O.resetTrigger,be=O.displayConfig,ye=void 0===be?{isHeaderVisible:!0,isToggleVisible:!0,maintainRelativeOrder:!1,isLoading:!0,showDeviationBadges:!1,enableDeviationSchemaBackwardCompatibility:!1,displayEmailNotifier:!0,isStreamingEnabled:!1}:be,Ce=O.onMaintainRelativeOrderChange,Ee=O.popupConfig,Ae=O.deviationData,Te=void 0===Ae?{}:Ae,we=O.deviationNodeIdToView,Ie=O.resetDeviationNodeId,Be=O.isProposingFix,De=void 0!==Be&&Be,Oe=O.proposingFixNodeId,Fe=O.isRedlineFlow,je=O.badgeStyleOverride,Pe=O.guidelinesData,ke=O.gptWebCitationConfig,Ne=i.useState(ye.maintainRelativeOrder),Me=Ne[0],Le=Ne[1],qe=null!==(F=null==ye?void 0:ye.expandLevels)&&void 0!==F?F:0,He=!!(null==ye?void 0:ye.expandAllSections),Ge=!!Me||!!(null==ye?void 0:ye.showDeviationBadges),Ve=i.useState(!1),We=Ve[0],ze=Ve[1],Ke=i.useState(null),Ue=Ke[0],Ye=Ke[1],Je=i.useState(null===(P=null!==(j=null==he?void 0:he.newEvaluationResult)&&void 0!==j?j:null==ye?void 0:ye.enableDeviationSchemaBackwardCompatibility)||void 0===P||P)[0],Xe=i.useState(new Set),$e=Xe[0],Qe=Xe[1],Ze=i.useState([]),en=Ze[0],nn=Ze[1],tn=i.useState(!1),on=tn[0],rn=tn[1],ln=i.useState(0),un=ln[0],sn=ln[1],an=i.useRef(null),cn=i.useRef(null),dn=i.useRef(null),fn=i.useRef(null),vn=i.useRef(null),gn=i.useRef(!1),pn=i.useRef(null),hn=i.useRef({}),mn=i.useRef([]),Sn=i.useRef(function(){}),Rn=i.useRef(null),xn=i.useRef(function(){}),_n=i.useMemo(function(){return JSON.stringify(Te||{})},[JSON.stringify(Te)]),bn=i.useMemo(function(){return Te||{}},[_n]),yn=i.useMemo(function(){return(null==he?void 0:he.cognitive_decisioning)||{}},[he]),Cn=i.useMemo(function(){return e.__assign(e.__assign({},s.SHARED_MARKDOWN_STYLES),xe)},[xe]),En=i.useRef(null),An=i.useRef(null),Tn=i.useRef(null),wn=i.useRef(null),In=i.useRef(null),Bn=i.useRef(null),Dn=i.useRef(null),On=i.useRef(null),Fn=i.useRef(null),jn=i.useRef(null),Pn=p.useComparePopups(En),kn=Pn.cognitivePopup,Nn=Pn.setCognitivePopup,Mn=Pn.moreFunctions,Ln=Pn.setMoreFunctions,qn=Pn.position,Hn=Pn.setPosition,Gn=Pn.activeBadgeId,Vn=Pn.summaryPopup,Wn=Pn.setSummaryPopup,zn=Pn.closeSummaryPopup,Kn=Pn.setActiveBadgeId,Un=Pn.popupRef,Yn=Pn.handleOpenCognitiveCompare,Jn=Pn.openCognitivePopupFromState,Xn=Pn.closeCognitivePopup,$n=Pn.closeMoreFunctionsPopup,Qn=i.useMemo(function(){var e,n,i,t,o,r,l;return{fields:null!==(e=null==me?void 0:me.fields)&&void 0!==e?e:s.DEFAULT_FIELD_CONFIG,thresholds:{high:null!==(i=null===(n=null==me?void 0:me.thresholds)||void 0===n?void 0:n.high)&&void 0!==i?i:s.DEFAULT_COMPARISON_CONFIG.thresholds.high,medium:null!==(o=null===(t=null==me?void 0:me.thresholds)||void 0===t?void 0:t.medium)&&void 0!==o?o:s.DEFAULT_COMPARISON_CONFIG.thresholds.medium,exact:null!==(l=null===(r=null==me?void 0:me.thresholds)||void 0===r?void 0:r.exact)&&void 0!==l?l:s.DEFAULT_COMPARISON_CONFIG.thresholds.exact}}},[me]),Zn=i.useState(null),ei=Zn[0];Zn[1];var ni=null===(M=null===(k=null==he?void 0:he.documents)||void 0===k?void 0:k[null===(N=null==he?void 0:he.input_index_map)||void 0===N?void 0:N[0]])||void 0===M?void 0:M.title,ii=null===(H=null===(L=null==he?void 0:he.documents)||void 0===L?void 0:L[null===(q=null==he?void 0:he.input_index_map)||void 0===q?void 0:q[1]])||void 0===H?void 0:H.title,ti=u.safeStringify(Se||ni||"Uploaded Contract"),oi=null===(z=null===(W=null===(G=null==he?void 0:he.documents)||void 0===G?void 0:G[null===(V=null==he?void 0:he.input_index_map)||void 0===V?void 0:V[0]])||void 0===W?void 0:W.metadata)||void 0===z?void 0:z.file_name,ri=u.safeStringify(oi),li=null===(J=null===(Y=null===(K=null==he?void 0:he.documents)||void 0===K?void 0:K[null===(U=null==he?void 0:he.input_index_map)||void 0===U?void 0:U[1]])||void 0===Y?void 0:Y.metadata)||void 0===J?void 0:J.file_name,ui=u.safeStringify(li),si=u.safeStringify(Re||ii||"Reference Template"),ai=g.useCognitiveTreeData(he,Me,bn,Qn,Je,Pe),ci=ai.isGuidelineMode,di=ai.activeProposed,fi=ai.existingRule,vi=ai.proposedSections,gi=ai.existingSections,pi=ai.visibleFields,hi=ai.parentDeviationRecord,mi=ai.deviationNumberRegistry,Si=ai.deviationParentRegistry,Ri=ai.parseError;i.useEffect(function(){Ri&&Ye("Failed to load comparison: ".concat(Ri))},[Ri]);var xi=vi.length>0||gi.length>0,_i=i.useMemo(function(){if(!Fe)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)||"";u.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(vi),i(gi),"".concat(e,":").concat(n)},[Fe,vi,gi]);i.useEffect(function(){if(vi.length||gi.length)if(He){var e={},n={},i=function(i,t){i.forEach(function(i,o){var r,l=Me?"".concat(t,"-").concat(o):String(o);e[l]=!0;var u=function(e,i){null==e||e.forEach(function(e,t){var o,r="".concat(i,"-").concat(t);n[r]=!0,(null===(o=e.subsections)||void 0===o?void 0:o.length)&&u(e.subsections,r)})};(null===(r=i.subsections)||void 0===r?void 0:r.length)&&u(i.subsections,String(o))})};i(vi,"left"),i(gi,"right"),tt(e),rt(n)}else if(qe>0){var t={},o={},r=function(e,n,i){e.forEach(function(e,r){var l;if(i>=1){var u=Me?"".concat(n,"-").concat(r):String(r);t[u]=!0}var s=function(e,n,t){t>i||null==e||e.forEach(function(e,i){var r,l="".concat(n,"-").concat(i);o[l]=!0,(null===(r=e.subsections)||void 0===r?void 0:r.length)&&s(e.subsections,l,t+1)})};(null===(l=e.subsections)||void 0===l?void 0:l.length)&&i>=2&&s(e.subsections,String(r),2)})};r(vi,"left",qe),r(gi,"right",qe),tt(t),rt(o)}},[He,qe,vi,gi,Me]);var bi=h.useSectionRefs(pi.map(function(e){return e.key}),Math.max(vi.length,gi.length)),yi=bi.leftRefs,Ci=bi.rightRefs,Ei=bi.sectionLeftRefs,Ai=bi.sectionRightRefs,Ti=bi.lhsBadgeRefs,wi=bi.rhsBadgeRefs,Ii=bi.sectionRightRowRefs,Bi=bi.subSectionLeftRefs,Di=bi.subSectionRightRefs,Oi=bi.sectionRowRefs,Fi=bi.getSectionRowRef,ji=bi.getSubSectionRef,Pi=bi.getBadgeRef,ki=w.useSideBySide({isGuidelineMode:ci,maintainRelativeOrder:Me,proposedSections:vi,existingSections:gi,leftContainerRef:On,rightContainerRef:Tn,scrollContainerRef:En,sectionLeftRefs:Ei,sectionRightRefs:Ai,subSectionLeftRefs:Bi,subSectionRightRefs:Di,lhsBadgeRefs:Ti,rhsBadgeRefs:wi,sectionRowRefs:Oi,sectionRightRowRefs:Ii,rhsTopSpacerRef:wn,rhsBottomSpacerRef:In,lhsTopSpacerRef:Bn,lhsBottomSpacerRef:Dn,calculateLinesRef:Sn,setConnectedSections:Qe,setConnectedLines:nn,cachedConnectedPositions:mn,closeMoreFunctionsPopup:$n,setErrorToast:Ye,moreFunctions:Mn,closeSummaryPopup:zn}),Ni=ki.isSideBySide,Mi=ki.isArrowVisible,Li=ki.setIsArrowVisible,qi=ki.isResizing,Hi=ki.setIsResizing,Gi=ki.isSideBySideLoading,Vi=ki.activeSideBySideSection,Wi=ki.scrollLock,zi=ki.sideBySideCacheRef,Ki=ki.isSideBySideRef,Ui=ki.activeSideBySideRightSectionRef,Yi=ki.activeSideBySideSectionRef,Ji=ki.sideBySideLineRef,Xi=ki.highlightedClauseRefs,$i=ki.clearClauseHighlight,Qi=ki.resetSideBySide,Zi=ki.activateSideBySide,et=i.useRef(Zi);i.useEffect(function(){et.current=Zi},[Zi]);var nt=m.useAccordionState({maintainRelativeOrder:!!Me,proposedSections:vi,existingSections:gi,activeSideBySideSection:Vi,connectedSections:$e,resetSideBySide:Qi,setConnectedSections:Qe,setConnectedLines:nn,cachedConnectedPositions:mn,svgContainerRef:an,isAnimatingRef:gn,animationTimerRef:pn,calculateLinesRef:Sn,sectionLeftRefs:Ei,sectionRightRefs:Ai,subSectionLeftRefs:Bi,subSectionRightRefs:Di}),it=nt.expandedSections,tt=nt.setExpandedSections,ot=nt.expandedSubSections,rt=nt.setExpandedSubSections,lt=nt.handleSubSectionToggle,ut=nt.toggleSection,st=nt.forceExpandCrossWiredSections,at=function(){var e,n;if(null!=Vi){var i=null===(e=Ei.current[Vi])||void 0===e?void 0:e.current,t=null===(n=Ai.current[Vi])||void 0===n?void 0:n.current,o=Tn.current;if(i&&t&&o){var r=i.getBoundingClientRect(),l=t.getBoundingClientRect(),u=o.getBoundingClientRect(),s=r.top-u.top,a=l.top-u.top-s;o.scrollBy({top:a,behavior:"smooth"})}}},ct=i.useCallback(function(e){null==e||e.stopPropagation(),rn(function(e){var n=!e;return n&&requestAnimationFrame(function(){at()}),n})},[at]);i.useEffect(function(){Fe&&"off"!==_i&&"0:0"!==_i&&(zi.current=null,mn.current=[],requestAnimationFrame(function(){var e;null===(e=Sn.current)||void 0===e||e.call(Sn)}))},[Fe,_i]);var dt=i.useMemo(function(){var e=new Map,n=new Map,i=1;if(Me)vi.forEach(function(n){!n.title&&!n.content||n.id&&e.set(n.id,i++)}),gi.forEach(function(t){if(t.id&&!(!t.title&&!t.content)){var o=vi.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(vi.length,gi.length),o=0;o<t;o++){var r=vi[o],l=gi[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}},[vi,gi,Me]),ft=fi.analysis,vt=u.safeStringify(null===($=null===(X=null==ft?void 0:ft.rule_difference_comparison)||void 0===X?void 0:X.summary)||void 0===$?void 0:$.overall_summary),gt=!!vt.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),pt=null!==(Q=null==he?void 0:he.base_root_id)&&void 0!==Q?Q:"-1";null==he||he[pt];var ht=Je?null!==(ce=null!==(ue=Te&&(null===(le=null==Te?void 0:Te[pt])||void 0===le?void 0:le.evaluation_result))&&void 0!==ue?ue:null===(ae=null===(se=null==he?void 0:he.nodes)||void 0===se?void 0:se[pt])||void 0===ae?void 0:ae.evaluation_result)&&void 0!==ce?ce:null:null!==(re=null!==(ne=Te&&(null===(ee=null===(Z=null==Te?void 0:Te[pt])||void 0===Z?void 0:Z.evaluation_result)||void 0===ee?void 0:ee[0]))&&void 0!==ne?ne:null===(oe=null===(te=null===(ie=null==he?void 0:he.nodes)||void 0===ie?void 0:ie[pt])||void 0===te?void 0:te.evaluation_result)||void 0===oe?void 0:oe[0])&&void 0!==re?re:null,mt=u.extractDeviationScore(ht),St=u.generateColorPalette(null!==(ve=null===(fe=null===(de=null==ht?void 0:ht.evaluation_outputs)||void 0===de?void 0:de.metadata)||void 0===fe?void 0:fe.label_color)&&void 0!==ve?ve:a.DEFAULT_DEVIAION_COLOR);if(je){var Rt=je(mt);Rt&&(St=e.__assign(e.__assign({},St),{badgeBg:Rt.bg,badgeText:Rt.text,badgeBorder:Rt.border}))}var xt=i.useRef(Qi);i.useEffect(function(){xt.current=Qi},[Qi]);var _t=i.useRef(Xn);i.useEffect(function(){_t.current=Xn},[Xn]);var bt=i.useCallback(function(e,n,i,t,o,r){return Oo.current(e,n,i,t,o,r)},[]),yt=i.useCallback(function(e,n,i,t,o){return jo.current(e,n,i,t,o)},[]),Ct=i.useCallback(function(){return Po.current()},[]),Et=i.useCallback(function(e,n){return ko.current(e,n)},[]),At=i.useCallback(function(e){return No.current(e)},[]),Tt=i.useCallback(function(e){return Mo.current(e)},[]),wt=i.useCallback(function(){return Lo.current()},[]),It=i.useCallback(function(){var e,n;$i(),null===(e=xt.current)||void 0===e||e.call(xt),rn(!1),Qe(new Set),nn([]),mn.current=[],$t([]),Zt(null),Wn(a.EMPTY_SUMMARY_POPUP_STATE),null===(n=_t.current)||void 0===n||n.call(_t),requestAnimationFrame(function(){var e;null===(e=Sn.current)||void 0===e||e.call(Sn)})},[]),Bt=i.useRef(It);i.useEffect(function(){Bt.current=It},[It]),i.useEffect(function(){_e&&Bt.current()},[_e]);var Dt=i.useMemo(function(){return{documents:null==he?void 0:he.documents,input_index_map:null==he?void 0:he.input_index_map}},[JSON.stringify(null==he?void 0:he.documents),JSON.stringify(null==he?void 0:he.input_index_map)]),Ot=i.useState(""),Ft=Ot[0],jt=Ot[1],Pt=i.useRef(he);i.useEffect(function(){var e,n,i;Pt.current=he;var t=null===(e=null==he?void 0:he.input_index_map)||void 0===e?void 0:e[0],o=null===(i=null===(n=null==he?void 0:he.documents)||void 0===n?void 0:n[t])||void 0===i?void 0:i.title;jt(o)},[he]);var kt=i.useRef(yn);i.useEffect(function(){kt.current=yn},[yn]);var Nt=i.useCallback(function(n,i,t,o,r,l,s){var a,c,d,f,v,g,p,h,m,S,R=u.safeStringify(null==i?void 0:i.id)||u.safeStringify(null==t?void 0:t.id)||"",x=(R?null===(a=kt.current)||void 0===a?void 0:a[R]:null)||(null==i?void 0:i.cognitiveData)||(null==t?void 0:t.cognitiveData)||{section_id:R,decisioning:[],gap:[],relevance_score:0},_=null!==(d=null===(c=Oi.current[o])||void 0===c?void 0:c.current)&&void 0!==d?d:null,b=function(){var n,r,l=(null==i?void 0:i.evaluationResult)||(null==t?void 0:t.evaluationResult)||null,s=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(u.DEVIATION_BADGE_SEPARATOR)))return s(l);var a=o.split(u.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)}):s(l)}(),y=(null!==(g=null===(v=null===(f=null==b?void 0:b.cognitive_decisioning)||void 0===f?void 0:f.decisioning_factors)||void 0===v?void 0:v.length)&&void 0!==g?g:0)>0||(null!==(m=null===(h=null===(p=null==b?void 0:b.cognitive_decisioning)||void 0===p?void 0:p.gaps_in_decision)||void 0===h?void 0:h.length)&&void 0!==m?m:0)>0,C=null!==(S=null==ye?void 0:ye.isLoading)&&void 0!==S&&S,E=!0;if(ci){var A=null==b?void 0:b.deviation_highlights;if(A&&"object"==typeof A)E=Object.values(A).some(function(e){return Array.isArray(e)&&e.length>0});else E=!1}return{isLoading:C&&!y,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:x,anchorEl:n,sectionAnchorEl:_,badgeStyle:l||null,sectionIdx:o,docData:Dt,deviationData:b,isOrphan:!!r,hasGuidelineMatches:E}},[Dt,null==ye?void 0:ye.isLoading,ci]),Mt=i.useCallback(function(e,n,i,t,o,r){var l;if(e.stopPropagation(),Mn.open&&Mn.sectionIdx===o)$n();else{var s=e.currentTarget,a="left";(null===(l=Tn.current)||void 0===l?void 0:l.contains(s))&&(a="right");$i(),Ki.current&&Qi(),Qe(new Set),nn([]),mn.current=[],Xn(),Vn.open?vo():zn(),requestAnimationFrame(function(){var e=function(){var e,n,i,t;if("string"==typeof o&&o.includes(u.DEVIATION_BADGE_SEPARATOR)){var r=o.split(u.DEVIATION_BADGE_SEPARATOR),l="".concat(r[0]).concat(u.DEVIATION_BADGE_SEPARATOR).concat(r[1]);return"right"===a?null===(e=wi.current[l])||void 0===e?void 0:e.current:null===(n=Ti.current[l])||void 0===n?void 0:n.current}return"right"===a?null===(i=wi.current[o])||void 0===i?void 0:i.current:null===(t=Ti.current[o])||void 0===t?void 0:t.current}()||s;Ln(Nt(e,n,t,o,i,r))})}},[Mn.open,Mn.sectionIdx,$n,zn,Nt]),Lt=i.useCallback(function(){var e=Mn.sectionIdx;Mn.isOrphan,$n(),zn(),null!==e&&(st(e),$i(),Ki.current&&Qi(),nn([]),mn.current=[],ci&&null!==e&&sn(ao(e)),Qe(function(n){return n.has(e)?new Set:new Set([e])}),setTimeout(function(){Sn.current&&Sn.current()},50))},[Mn.sectionIdx,Mn.isOrphan,$n,zn,Qi]),qt=i.useCallback(function(){var e=vn.current;if(e){vn.current=null;var n=vi.findIndex(function(n){return n.id===e}),i=gi.findIndex(function(n){return n.id===e}),t=-1===n?u.findKeyPathByNodeId(vi,e):null,o=-1===i?u.findKeyPathByNodeId(gi,e):null,r=-1!==n?n:t?Number(t.split("-")[0]):-1,l=-1!==i?i:o?Number(o.split("-")[0]):-1,s=function(e,n,i,t){var o,r,l,u;return-1!==e?null!==(r=null===(o=i.current[e])||void 0===o?void 0:o.current)&&void 0!==r?r:null:n&&null!==(u=null===(l=t.current[n])||void 0===l?void 0:l.current)&&void 0!==u?u:null},a=function(e,n,i){void 0===i&&(i=30);var t=0,o=function(){var r=e();r&&0!==r.getBoundingClientRect().height?(Xi.current.add(r),u.scrollAndHighlightClause(r,n)):t++<i&&requestAnimationFrame(o)};requestAnimationFrame(o)};if(Me)-1!==r&&On.current&&a(function(){return s(n,t,Ei,Bi)},On.current),-1!==l&&Tn.current&&a(function(){return s(i,o,Ai,Di)},Tn.current);else{var c=En.current;if(!c)return;a(function(){return-1!==r?s(n,t,Ei,Bi):s(i,o,Ai,Di)},c)}}},[vi,gi,Me,Ei,Ai,Bi,Di,On,Tn,En]),Ht=i.useCallback(function(n){if(n){$i(),Qi(),Qe(new Set),nn([]),mn.current=[],zn(),Xn();var i=vi.findIndex(function(e){return e.id===n}),t=gi.findIndex(function(e){return e.id===n}),o=-1===i?u.findKeyPathByNodeId(vi,n):null,r=-1===t?u.findKeyPathByNodeId(gi,n):null;if(-1!==i||o||-1!==t||r){var l=-1!==i?i:o?Number(o.split("-")[0]):-1,s=-1!==t?t:r?Number(r.split("-")[0]):-1;vn.current=n,tt(function(n){var i,t=e.__assign({},n),o=!1;-1!==l&&(t[i=Me?"left-".concat(l):String(l)]||(t[i]=!0,o=!0));-1!==s&&(t[i=Me?"right-".concat(s):String(s)]||(t[i]=!0,o=!0));return o?t:n}),rt(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(){vn.current===n&&Gt.current()})},50)}else console.warn('scrollToAndHighlightClause: nodeId "'.concat(n,'" not found'))}},[vi,gi,Me,tt,rt,Qi,zn,Xn]),Gt=i.useRef(qt);i.useEffect(function(){Gt.current=qt},[qt]);var Vt=i.useRef(null);i.useEffect(function(){if(ei){var e=Qn.fields.find(function(e){return e.analysisKey===ei||e.key===ei});if(e){var n=yi.current[e.key]||Ci.current[e.key];(null==n?void 0:n.current)&&setTimeout(function(){return n.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[ei,Qn.fields]);var Wt=i.useCallback(function(e){var n,i,t,o,r,l,u,s,a,c=null===(n=null==ft?void 0:ft.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],f=(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 v=d.mappings[0]||{};return{score:d.score,relation:v.relation||"",highlightsA:(null===(l=v.highlights)||void 0===l?void 0:l.ruleA_spans)||[],highlightsB:(null===(u=v.highlights)||void 0===u?void 0:u.ruleB_spans)||[],hasContent:!!f}}return{score:d.score,relation:d.relation||"",highlightsA:(null===(s=d.highlights)||void 0===s?void 0:s.ruleA_spans)||[],highlightsB:(null===(a=d.highlights)||void 0===a?void 0:a.ruleB_spans)||[],hasContent:!!f}},[ft]),zt=E.useStyleHelpers({proposedSections:vi,existingSections:gi,maintainRelativeOrder:Me,cognitiveMap:yn,deviationData:bn,treeData:he,resolvedComparisonConfig:Qn,badgeStyleOverride:je}),Kt=zt.getSectionCompareStyle,Ut=zt.getSubSectionCompareStyle,Yt=zt.getDeviationStyleByKey,Jt=T.useLinesCalculator({containerRef:cn,leftContainerRef:On,rightContainerRef:Tn,svgContainerRef:an,pathRefs:hn,leftHeaderRef:dn,rightHeaderRef:fn,proposedSections:vi,existingSections:gi,visibleFields:pi,leftRefs:yi,rightRefs:Ci,sectionLeftRefs:Ei,sectionRightRefs:Ai,subSectionLeftRefs:Bi,subSectionRightRefs:Di,lhsBadgeRefs:Ti,rhsBadgeRefs:wi,sectionRowRefs:Oi,expandedSections:it,expandedSubSections:ot,connectedSections:$e,isSideBySide:Ni,activeSideBySideSection:Vi,maintainRelativeOrder:Me,isGuidelineMode:ci,cognitiveMap:yn,getSectionCompareStyle:Kt,getSubSectionCompareStyle:Ut,getDeviationStyleByKey:Yt,isArrowVisible:Mi,isAnimatingRef:gn,isSideBySideRef:Ki,sideBySideCacheRef:zi,sideBySideLineRef:Ji,activeSideBySideSectionRef:Yi,activeSideBySideRightSectionRef:Ui,connectedLines:en,setConnectedLines:nn,cachedConnectedPositions:mn,calculateLinesRef:Sn,resizeTimerRef:Rn,scrollLock:Wi,scrollSyncLocked:on,handleResizeRef:xn,activeProposed:di,existingRule:fi,analysisData:ft,pendingScrollTargetRef:Fn,pendingScrollCallbackRef:jn,resolvedComparisonConfig:Qn,getFieldData:Wt}),Xt=Jt.lines,$t=Jt.setLines,Qt=Jt.overallConnector,Zt=Jt.setOverallConnector,eo=Jt.svgDimensions,no=Jt.handleColumnScroll;i.useEffect(function(){Vn.anchorEl&&requestAnimationFrame(function(){requestAnimationFrame(function(){var e;null===(e=Sn.current)||void 0===e||e.call(Sn)})})},[Vn.anchorEl,on]);var io=i.useCallback(function(){$i(),rn(!1),tt({}),rt({}),Qi(),Qe(new Set),nn([]),mn.current=[],zn(),Xn(),$n(),requestAnimationFrame(function(){Sn.current&&Sn.current()})},[tt,rt,Qi,zn,Xn,$n]);i.useEffect(function(){Ni||0!==$e.size||rn(!1)},[Ni,$e]);var to=i.useMemo(function(){return Object.values(it).some(Boolean)||Object.values(ot).some(Boolean)},[it,ot]),oo=i.useRef(null),ro=i.useRef(0),lo=i.useRef(0),uo=i.useRef(0),so=A.useResizeHandler({timerRef:oo,ruleComponentRef:An,scrollContainerRef:En,containerRef:cn,maintainRelativeOrder:Me,proposedSections:vi,existingSections:gi,isSideBySideRef:Ki,activeSideBySideSectionRef:Yi,activeSideBySideRightSectionRef:Ui,sectionRowRefs:Oi,sectionRightRowRefs:Ii,sectionLeftRefs:Ei,sectionRightRefs:Ai,subSectionLeftRefs:Bi,subSectionRightRefs:Di,lhsBadgeRefs:Ti,rhsBadgeRefs:wi,leftContainerRef:On,rightContainerRef:Tn,calculateLinesRef:Sn,handleResizeRef:xn,setIsResizing:Hi,setIsArrowVisible:Li,sideBySideCacheRef:zi,cachedConnectedPositions:mn}).handleResize;i.useEffect(function(){xn.current=so},[so,xn]),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,u;i.current=null;var s=e[e.length-1];if(s){var a=null!==(u=null===(l=null===(r=s.borderBoxSize)||void 0===r?void 0:r[0])||void 0===l?void 0:l.inlineSize)&&void 0!==u?u:s.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,ro,n,function(){return xn.current()},function(){})),En.current&&o.push(e(En.current,lo,i,function(){return xn.current()},function(){return Sn.current()})),cn.current&&o.push(e(cn.current,uo,t,function(){return xn.current()},function(){return Sn.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(){Ki.current=Ni},[Ni]),i.useEffect(function(){Yi.current=Vi},[Vi]);var ao=i.useCallback(function(e){var n,i,t,o,r,l="",s="0";if("number"==typeof e)l=(null===(n=vi[e])||void 0===n?void 0:n.nodeId)||(null===(i=vi[e])||void 0===i?void 0:i.id)||"";else{var a=String(e).split(u.DEVIATION_BADGE_SEPARATOR);l=a[0],s=a[1]||"0"}var c=null===(t=null==bn?void 0:bn[l])||void 0===t?void 0:t.evaluation_result,d=Array.isArray(c)?c[parseInt(s,10)]:null==c?void 0:c[s];return!1===(null===(r=null===(o=null==d?void 0:d.evaluation_outputs)||void 0===o?void 0:o.guideline_flag)||void 0===r?void 0:r.rulebook_used)?1:0},[vi,bn]),co=i.useCallback(function(e){var n,i,t=document.querySelectorAll('[id^="guideline-target-"], [data-web-gpt-active="true"]'),o=On.current,r=Tn.current,l="string"==typeof e&&e.includes(u.DEVIATION_BADGE_SEPARATOR),s=e;if(l){var a=e.split(u.DEVIATION_BADGE_SEPARATOR);a.length>=2&&(s="".concat(a[0]).concat(u.DEVIATION_BADGE_SEPARATOR).concat(a[1]))}var c=(null===(n=Ti.current[s])||void 0===n?void 0:n.current)||(null===(i=Ti.current[e])||void 0===i?void 0:i.current);if(t.length>0&&c&&o&&r){var d=t[0];Bn.current&&(Bn.current.style.height="0px"),wn.current&&(wn.current.style.height="0px"),Dn.current&&(Dn.current.style.height="0px"),In.current&&(In.current.style.height="0px"),requestAnimationFrame(function(){var e=c.getBoundingClientRect(),n=d.getBoundingClientRect(),i=o.getBoundingClientRect(),t=r.getBoundingClientRect(),l=o.scrollTop+(e.top-i.top)+e.height/2,u=r.scrollTop+(n.top-t.top)+n.height/2,s=l-i.height/2,a=Math.max(0,s),f=o.scrollHeight-o.clientHeight,v=a>f?a-f:0,g=i.top+l-a,p=t.top+u-g,h=0;p<0&&(h=Math.abs(p),p=0);var m=r.scrollHeight-r.clientHeight+h,S=p>m?p-m:0;Dn.current&&(Dn.current.style.height="".concat(v,"px")),wn.current&&(wn.current.style.height="".concat(h,"px")),In.current&&(In.current.style.height="".concat(S,"px")),requestAnimationFrame(function(){o.scrollTo({top:a,behavior:"smooth"}),r.scrollTo({top:p,behavior:"smooth"}),Sn.current&&setTimeout(function(){return Sn.current()},50)})})}},[u.DEVIATION_BADGE_SEPARATOR]),fo=i.useCallback(function(){var e,n=Mn.sectionIdx,i=Mn.isOrphan;if(zn(),null!=n){var t="left";Mn.anchorEl&&(null===(e=Tn.current)||void 0===e?void 0:e.contains(Mn.anchorEl))&&(t="right"),st(n),ci&&(sn(ao(n)),Qe(new Set([n]))),Zi(n,i,{sourceSide:t,onReady:function(){ci&&setTimeout(function(){return co(String(n))},150)}})}},[Zi,Mn.isOrphan,Mn.sectionIdx,Mn.anchorEl,zn,st,ci,co,ao]),vo=i.useCallback(function(){zn(),Qi(),Qe(new Set),nn([]),mn.current=[]},[zn,Qi]),go=null!==Mn.sectionIdx&&$e.has(Mn.sectionIdx),po=S.useDeviationNavigation({proposedSections:vi,existingSections:gi,parentDeviationRecord:hi,expandedSections:it,maintainRelativeOrder:!!Me,scrollContainerRef:En,leftContainerRef:On,rightContainerRef:Tn,lhsBadgeRefs:Ti,rhsBadgeRefs:wi}),ho=po.showDeviationNavigation,mo=po.showOpenNodeRef,So=po.adjustScrollForPopup,Ro=i.useCallback(function(e,n,i,t,o){var r,l="string"==typeof t?u.safeStringify(t).trim():u.safeStringify(null==t?void 0:t.deviation_summary).trim(),s=e.currentTarget;Xn();var a="left";(null===(r=Tn.current)||void 0===r?void 0:r.contains(s))&&(a="right");var c=function(){var e,i,t,o;if("string"==typeof n&&n.includes(u.DEVIATION_BADGE_SEPARATOR)){var r=n.split(u.DEVIATION_BADGE_SEPARATOR),l="".concat(r[0]).concat(u.DEVIATION_BADGE_SEPARATOR).concat(r[1]);return"right"===a?null===(e=wi.current[l])||void 0===e?void 0:e.current:null===(i=Ti.current[l])||void 0===i?void 0:i.current}return"right"===a?null===(t=wi.current[n])||void 0===t?void 0:t.current:null===(o=Ti.current[n])||void 0===o?void 0:o.current};if(i&&!ci)return Qi(),Qe(new Set),nn([]),mn.current=[],void(l&&(st(n),requestAnimationFrame(function(){var e=c()||s;e&&(e.getBoundingClientRect().top>.8*window.innerHeight&&e.scrollIntoView({behavior:"smooth",block:"center"}));Wn({open:!0,anchorEl:e,summary:t,displayImpact:o})})));st(n),ci&&(sn(ao(n)),Qe(new Set([n]))),l?setTimeout(function(){Zi(n,i,{toggleIfSame:!1,sourceSide:a,onReady:function(){var e,i,r,l=c()||s;if(ci)setTimeout(function(){return co(n)},150);else if(l){var u=l.getBoundingClientRect();if(u.top>.8*window.innerHeight||u.top<100){var a=u.top-window.innerHeight/2;Me?(null===(e=On.current)||void 0===e||e.scrollBy({top:a,behavior:"smooth"}),null===(i=Tn.current)||void 0===i||i.scrollBy({top:a,behavior:"smooth"})):null===(r=En.current)||void 0===r||r.scrollBy({top:a,behavior:"smooth"})}}Wn({open:!0,anchorEl:l,summary:t,displayImpact:o})}})},350):setTimeout(function(){Zi(n,i,{toggleIfSame:!1,sourceSide:a}),ci&&setTimeout(function(){return co(n)},150)},350)},[Zi,Xn,Wn,Qi,st,ci,Me,co,bn]),xo=i.useMemo(function(){var e;if(!we)return null;var n=null===(e=null==we?void 0:we.id)||void 0===e?void 0:e.split(":")[0];for(var i in hi){if((hi[i]||[]).some(function(e){return e.id===n}))return i}return null},[we,hi]),_o=i.useRef({id:null,triggerMs:null}),bo=i.useRef(null);i.useEffect(function(){if(null==we?void 0:we.id){var n=Number(we.trigger),i=_o.current;if((null==i?void 0:i.id)!==we.id||(null==i?void 0:i.triggerMs)!==n){if(we.id.includes(":")&&/:\d+$/.test(we.id)){var t=we.id.split(":"),o=t[0],r=t[1],l=null!=r?r:"0",s="".concat(we.id,":").concat(n);bo.current!==s&&(zn(),Xn(),Qi(),Qe(new Set),nn([]),mn.current=[],bo.current=s);var a=!1,c=0,d=null,f=null,v=!1,g=function(e,n){for(var i=function(e,t){if(!e)return null;if(n.includes(e.id)||n.includes(e.nodeId)||n.includes(e.contentId))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 i,t,r;if(!a){var s=function(){_o.current={id:we.id,triggerMs:n}},h=null,m=null;for(var S in hi){var R=hi[S].find(function(e){var n;return e.id===o||e.nodeId===o||e.contentId===o||(null===(n=e.evaluationResult)||void 0===n?void 0:n.nodeId)===o});if(R){h=S,m=R;break}}if(m&&h){var x=Array.from(new Set([o,m.id,m.nodeId,m.contentId,null===(i=m.evaluationResult)||void 0===i?void 0:i.nodeId].filter(Boolean))),_=vi.findIndex(function(e){return e.id===h}),b=gi.findIndex(function(e){return e.id===h}),y=-1===_&&-1!==b,C=g(vi,x),E=g(gi,x);if(C&&!E&&!y){var A=C.split("-"),T=Number(A[0]);if(Me){var w=null===(r=null===(t=vi[T])||void 0===t?void 0:t.refIndexes)||void 0===r?void 0:r[0],I=gi.findIndex(function(e){return e.selfIndex===w});-1!==I&&(T=I)}E=e.__spreadArray([T],A.slice(1),!0).join("-")}if(C||E){var B=C?Number(C.split("-")[0]):_,D=E?Number(E.split("-")[0]):b,O=D>=0?D:E?Number(E.split("-")[0]):-1,F=vi[B],j=gi[O],P=F&&!F.title&&!F.content,k=j&&!j.title&&!j.content,N=y||(!C&&!!E||P&&!k);if(N){if(!(Me?!!Fo.current["right-".concat(D)]:!!Fo.current[String(D)])&&D>=0)return ut(D,"right"),void(d=setTimeout(p,200))}else if(!(Me?!!Fo.current["left-".concat(B)]:!!Fo.current[String(B)])&&B>=0)return ut(B,"left"),void(d=setTimeout(p,200));var M=C||"",L=E||"",q=x.map(function(e){return"".concat(e).concat(u.DEVIATION_BADGE_SEPARATOR).concat(l)}),H=q[0],G=function(){for(var e,n,i=0,t=q;i<t.length;i++){var o=t[i],r=(null===(e=Ti.current[o])||void 0===e?void 0:e.current)||null,l=(null===(n=wi.current[o])||void 0===n?void 0:n.current)||null;if(r||l)return{refId:o,left:r,right:l}}return{refId:H,left:null,right:null}},V=function(e){return"".concat(e).concat(u.DEVIATION_BADGE_SEPARATOR).concat(M).concat(u.DEVIATION_BADGE_SEPARATOR).concat(L)};if(!v){st(V(H)),v=!0,c=0;var W=function(){var e=G(),n=e.left,i=e.right;return N||!n&&!!i?i:n};return null==f||f(),void(d=setTimeout(function(){var e,n,i,t,o,r,l,u;a||(e=W,n=function(){a||(f=null,p())},t=0,o=null,r=null,l=performance.now(),u=function(){if(!a)if(performance.now()-l>3e3)n();else{var s=e();if(s&&0!==s.getBoundingClientRect().height){var c=s.getBoundingClientRect(),d=c.top,f=c.height,v=null!==o&&Math.abs(d-o)<.5,g=null!==r&&Math.abs(f-r)<.5;if(v&&g){if(++t>=5)return void n()}else t=0;o=d,r=f,i=requestAnimationFrame(u)}else i=requestAnimationFrame(u)}},i=requestAnimationFrame(u),f=function(){return cancelAnimationFrame(i)})},300))}var z=G(),K=z.refId,U=z.left,Y=z.right,J=V(K);if(U||Y){var X=N||!U&&!!Y,$=X?Y:U,Q=Me?X?Tn.current:On.current:En.current;if($&&Q){var Z=$.getBoundingClientRect();if(0!==Z.height){var ee=Q.getBoundingClientRect(),ne=Z.top-ee.top+Q.scrollTop-ee.height/2+Z.height/2,ie=(null==C?void 0:C.includes("-"))||(null==E?void 0:E.includes("-")),te=function(){return e.__awaiter(void 0,void 0,void 0,function(){var n,i,t,o,r,c,d,f,v,g;return e.__generator(this,function(p){switch(p.label){case 0:return a?[2]:(s(),n=$ instanceof Element?window.getComputedStyle($).color:"",[U,Y].forEach(function(e){e&&(e.style.transition="box-shadow 300ms ease-in-out",e.style.boxShadow="0 0 10px ".concat(n))}),setTimeout(function(){[U,Y].forEach(function(e){e&&(e.style.boxShadow="")})},2e3),i=(null===(d=null===(c=m.evaluationResult)||void 0===c?void 0:c.deviations)||void 0===d?void 0:d[l])||m,t=(null===(f=m.evaluationResult)||void 0===f?void 0:f.evaluation_outputs)||m.evaluation_outputs,!!U&&!!Y||ci?(r=function(e,n){return Promise.race([e,new Promise(function(e){return setTimeout(e,n)})])},Me?[4,Promise.all([On.current?r(u.waitForScrollIdle(On.current),600):Promise.resolve(),Tn.current?r(u.waitForScrollIdle(Tn.current),600):Promise.resolve()])]:[3,2]):(o=X?(null===(v=wi.current[ie?K:D])||void 0===v?void 0:v.current)||Y:(null===(g=Ti.current[ie?K:B])||void 0===g?void 0:g.current)||U,So(o,function(){Wn({open:!0,anchorEl:o,displayImpact:we.displayImpact,summary:e.__assign(e.__assign({},i),{evaluation_outputs:t})})},{skipScroll:!0}),null==Ie||Ie(),[2]));case 1:p.sent(),p.label=2;case 2:return ci&&(sn(ao(J)),Qe(new Set([J]))),et.current(J,!1,{toggleIfSame:!1,sourceSide:y?"right":"left",onReady:function(){var n,t,o,r;s();var l=X?(null===(n=wi.current[K])||void 0===n?void 0:n.current)||Y:(null===(t=Ti.current[K])||void 0===t?void 0:t.current)||U;if(ci)setTimeout(function(){return co(J)},150);else{var u=(null===(o=Ti.current[K])||void 0===o?void 0:o.current)||U,a=(null===(r=wi.current[K])||void 0===r?void 0:r.current)||Y;u&&(u.style.scrollMarginTop="150px",u.scrollIntoView({behavior:"smooth",block:"start"})),a&&(a.style.scrollMarginTop="150px",a.scrollIntoView({behavior:"smooth",block:"start"}))}Wn({open:!0,anchorEl:l,displayImpact:we.displayImpact,summary:e.__assign({},i)}),null==Ie||Ie()}}),[2]}})})};Math.abs(Q.scrollTop-ne)<=2?te():u.scrollAndWait(Q,ne,te)}else++c<30&&(d=setTimeout(p,100))}else++c<30&&(d=setTimeout(p,100))}else++c<30&&(d=setTimeout(p,100))}else++c<30&&(d=setTimeout(p,100))}else++c<30&&(d=setTimeout(p,100))}};return d=setTimeout(p,100),function(){a=!0,d&&clearTimeout(d),null==f||f()}}_o.current={id:we.id,triggerMs:n},Ht(we.id);var h=vi.findIndex(function(e){return e.id===we.id}),m=gi.findIndex(function(e){return e.id===we.id});-1===h&&-1===m||setTimeout(function(){var e=-1!==h?h:m,n=-1===h;ci&&sn(ao(e)),Qe(new Set([e])),et.current(e,n,{sourceSide:n?"right":"left",onReady:function(){ci&&setTimeout(function(){return co(String(e))},150)}})},400)}}},[null==we?void 0:we.id,null==we?void 0:we.trigger,null==we?void 0:we.displayImpact,hi,vi,gi,Me,Wn,Ht,ci,ao,co]),i.useEffect(function(){var n,i,t;if(Vn.open){var o=Vn.anchorEl;if(o&&!o.isConnected){var r=function(e){for(var n,i=0,t=Object.entries(e);i<t.length;i++){var r=t[i],l=r[0];if((null===(n=r[1].current)||void 0===n?void 0:n.textContent)===o.textContent)return l}return null},l=(null===(n=o.dataset)||void 0===n?void 0:n.deviationRefId)||r(Ti.current)||r(wi.current);if(l){var u=(null===(i=wi.current[l])||void 0===i?void 0:i.current)||(null===(t=Ti.current[l])||void 0===t?void 0:t.current);u&&u.isConnected&&Wn(function(n){return e.__assign(e.__assign({},n),{anchorEl:u})})}}}},[Vn.open,Vn.anchorEl,on,$e,it]);var yo=kn.open,Co=kn.sectionIdx,Eo=kn.isOrphan,Ao=kn.badgeStyle,To=kn.anchorEl,wo=kn.sectionAnchorEl;i.useEffect(function(){var n;if(ye.isStreamingEnabled&&yo&&null!=Co&&Co!==pt){var i="string"==typeof Co?Co.split(u.DEVIATION_BADGE_SEPARATOR)[0]:null,t=function(e,n){var i;if(!e||!Array.isArray(e))return null;for(var o=0,r=e;o<r.length;o++){var l=r[o];if(l.id===n)return l;if(null===(i=l.subsections)||void 0===i?void 0:i.length){var u=t(l.subsections,n);if(u)return u}}return null},o=i&&"string"==typeof i?t(vi,i):null,r=i&&"string"==typeof i?t(gi,i):null,l="number"==typeof Co?vi[Co]||null:o||i&&((null===(n=null==he?void 0:he.nodes)||void 0===n?void 0:n[i])||(null==he?void 0:he[i]))||null,s="number"==typeof Co?gi[Co]||null:r,a=Nt(To,l,s,Co,Eo,Ao);Nn(function(n){return n.open?u.safeStringify(n.cognitiveData)===u.safeStringify(a.cognitiveData)&&u.safeStringify(n.deviationData)===u.safeStringify(a.deviationData)&&n.sectionTitle===a.sectionTitle&&n.refSectionTitle===a.refSectionTitle?n:e.__assign(e.__assign(e.__assign({},n),a),{open:!0,anchorEl:n.anchorEl,sectionAnchorEl:n.sectionAnchorEl}):n})}},[yo,Co,Eo,Ao,To,wo,vi,gi,Nt]);var Io=i.useCallback(function(e){var i=e.section,t=e.keyPath,o=e.depth,r=void 0===o?0:o,l=e.columnKey,u=void 0===l?"left":l,s=e.parentNodeId,a=void 0===s?"":s,c=e.sectionOffset,d=e.rhsOrphanVisualIndexes;return n.jsx(x.default,{section:i,keyPath:t,depth:r,columnKey:u,parentNodeId:a,sectionOffset:c,rhsOrphanVisualIndexes:d})},[]),Bo=i.useMemo(function(){return vi.map(function(e,i){var t,o,r=!(null==e?void 0:e.title)&&!(null==e?void 0:e.content),l=!(null==e?void 0:e.refIndexes)||0===e.refIndexes.length;return r&&l&&Me?null:n.jsx(_.default,{section:e,idx:i},null!==(o=null!==(t=null==e?void 0:e.layoutKey)&&void 0!==t?t:null==e?void 0:e.id)&&void 0!==o?o:"left-row-".concat(i))})},[vi,Me]),Do=i.useMemo(function(){return gi.map(function(e,i){var t,o,r=!(null==e?void 0:e.title)&&!(null==e?void 0:e.content),l=!(null==e?void 0:e.refIndexes)||0===e.refIndexes.length;return r&&l&&Me?null:n.jsx(b.default,{section:e,idx:i},null!==(o=null!==(t=null==e?void 0:e.layoutKey)&&void 0!==t?t:null==e?void 0:e.id)&&void 0!==o?o:"right-row-".concat(i))})},[gi,Me]),Oo=i.useRef(Mt);i.useEffect(function(){Oo.current=Mt},[Mt]);var Fo=i.useRef(it);i.useEffect(function(){Fo.current=it},[it]);var jo=i.useRef(Ro);i.useEffect(function(){jo.current=Ro},[Ro]);var Po=i.useRef(vo);i.useEffect(function(){Po.current=vo},[vo]);var ko=i.useRef(ut);i.useEffect(function(){ko.current=ut},[ut]);var No=i.useRef(lt);i.useEffect(function(){No.current=lt},[lt]);var Mo=i.useRef(Io);i.useEffect(function(){Mo.current=Io},[Io]);var Lo=i.useRef(Qi);i.useEffect(function(){Lo.current=Qi},[Qi]);var qo=i.useMemo(function(){return{isGuidelineMode:ci,maintainRelativeOrder:!!Me,showDeviationBadges:Ge,isProposingFix:De,proposingFixNodeId:Oe,isRedlineFlow:Fe,isSideBySide:Ni,activeSideBySideSection:Vi,scrollSyncLocked:on,toggleScrollSyncLocked:ct,summaryPopupAnchorEl:Vn.anchorEl,connectedSections:$e,proposedSections:vi,existingSections:gi,deviationNumberRegistry:mi,deviationParentRegistry:Si,treeData:he,displayConfig:ye,resolvedMarkdownStyles:Cn,unifiedNumbering:dt,expandedSections:it,expandedSubSections:ot,setExpandedSubSections:rt,getSectionCompareStyle:Kt,getSubSectionCompareStyle:Ut,getBadgeRef:Pi,getSectionRowRef:Fi,getSubSectionRef:ji,sectionLeftRefs:Ei,sectionRightRefs:Ai,sectionRowRefs:Oi,sectionRightRowRefs:Ii,subSectionLeftRefs:Bi,subSectionRightRefs:Di,lhsBadgeRefs:Ti,rhsBadgeRefs:wi,openMoreFunctionsPopup:bt,handleOpenSummaryPopup:yt,openSummaryPopup:yt,handleCloseSummaryPopup:Ct,toggleSection:Et,handleSubSectionToggle:At,renderSubSectionAccordion:Tt,resetSideBySide:wt,setConnectedSections:Qe,setConnectedLines:nn,cachedConnectedPositions:mn,showDeviationNavigation:ho,showOpenNodeRef:mo,deviationNodeIdToView:null==we?void 0:we.id,deviationTargetParentId:xo,guidelinesData:Pe,gptWebCitationConfig:ke}},[ci,Me,Ge,De,Oe,Fe,Ni,Vi,on,ct,Vn.anchorEl,$e,vi,gi,mi,ye,Cn,dt,it,ot,rt,Kt,Ut,Pi,Fi,ji,ho,mo,we,xo,Pe,ke]),Ho=u.safeStringify(kn.sectionTitle||ri||ti),Go=u.safeStringify(ci?ui||si||kn.refSectionTitle:kn.refSectionTitle||ui||si);return n.jsx(C.CompareContextProvider,e.__assign({value:qo},{children:n.jsxs(t.Box,e.__assign({ref:An,sx:{display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif',overflow:"visible",position:"relative"}},{children:[We&&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(f.default,{})})),Vn.open&&n.jsx(y.default,{open:Vn.open,anchorEl:Vn.anchorEl,containerEl:Vt.current,clipTopEl:dn.current,scrollContainerEl:En.current,onClose:vo,summary:Vn.summary,displayImpact:Vn.displayImpact,isScrollLocked:on}),n.jsx(d.default,{open:Mn.open,anchorEl:Mn.anchorEl,maintainRelativeOrder:!!Me,sectionTitle:Mn.sectionTitle,referenceSectionTitle:Mn.refSectionTitle,onClose:$n,onOpenCognitiveCompare:Yn,onOpenSideBySide:fo,onConnect:Lt,isConnected:go,isOrphan:!ci&&!!Mn.isOrphan,isGuidelineMode:ci,hasGuidelineMatches:Mn.hasGuidelineMatches}),kn.open&&n.jsx(c.default,{open:kn.open,popupRef:Un,position:qn,popupConfig:Ee,onClose:function(){Hn(null),Nn(function(n){return e.__assign(e.__assign({},n),{open:!1})}),Kn(null)},markdownStyles:xe,sectionTitle:Ho,referenceSectionTitle:Go,cognitiveData:kn.cognitiveData,anchorEl:kn.anchorEl,sectionAnchorEl:kn.sectionAnchorEl,scrollContainerEl:En.current,badgeStyle:kn.badgeStyle,docData:kn.docData,deviationData:kn.deviationData,isLoading:kn.isLoading}),n.jsx(t.Snackbar,e.__assign({open:!!Ue,autoHideDuration:8e3,onClose:function(){return Ye(null)},anchorOrigin:{vertical:"top",horizontal:"center"}},{children:n.jsx(t.Alert,e.__assign({onClose:function(){return Ye(null)},severity:"error",sx:{width:"100%",whiteSpace:"pre-line"}},{children:Ue}))})),n.jsx(R.default,{componentHeaderText:pe,displayConfig:ye,maintainRelativeOrder:Me,onCollapseAll:io,showCollapseAll:to,onToggleView:function(e){ze(!0),setTimeout(function(){Le(!e),null==Ce||Ce(!e),rn(!1),Qi(),zn(),Qe(new Set),nn([]),mn.current=[],requestAnimationFrame(function(){requestAnimationFrame(function(){setTimeout(function(){ze(!1)},600)})})},50)}}),n.jsx(t.Box,e.__assign({ref:En,onScroll:no,sx:{flex:1,minHeight:0,pt:1.5,pb:1,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",overflowY:Me?"visible":"auto",borderTop:vt&&gt?"none":"1.5px solid #EEF0F4"}},{children:n.jsx(t.Box,e.__assign({sx:e.__assign({display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"},Me?{flex:1}:{})},{children:n.jsxs(t.Box,e.__assign({ref:cn,sx:e.__assign({display:"grid",gridTemplateColumns:"minmax(0, 1fr) 180px minmax(0, 1fr)",gap:"100px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0},Me?{flex:1,overflow:"visible"}:{})},{children:[n.jsx(I.default,{svgContainerRef:an,svgDimensions:eo,isResizing:qi,overallConnector:Qt,rootDeviationStyle:St,lines:Xt,isSideBySide:Ni,activeSideBySideSection:Vi,isArrowVisible:Mi,maintainRelativeOrder:Me,proposedSections:vi,existingSections:gi,cognitivePopup:kn,activeBadgeId:Gn,closeCognitivePopup:Xn,setActiveBadgeId:Kn,openCognitivePopupFromState:Jn,buildSectionPopupState:Nt,connectedLines:en,isGuidelineMode:ci,pathRefs:hn}),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)"},Me?{flex:1,overflow:"visible"}:{})},{children:[n.jsx(t.Box,e.__assign({ref:dn,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:ti,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:ti}))}))})),n.jsxs(t.Box,e.__assign({ref:On,onScroll:no,sx:e.__assign({p:"12px",display:"flex",flexDirection:"column"},Me?{maxHeight:"calc(100vh - 250px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,mr:"-180px",pr:"192px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[n.jsx("div",{ref:Bn,style:{width:"100%",height:"0px",flexShrink:0}}),xi&&Bo,n.jsx("div",{ref:Dn,style:{width:"100%",height:"0px",flexShrink:0}})]}))]})),n.jsx(t.Box,e.__assign({ref:Vt,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(),kn.open&&Gn===pt?Xn():(Kn(pt),Jn(Nt(n.currentTarget,{title:Ft,content:"",evaluationResult:ht,cognitiveData:{section_id:"",decisioning:[],gap:[],relevance_score:0,isMissingRationale:!0}},null,pt,!0,e.__assign(e.__assign({},St),{label:""}))))},sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:"5px",top:"-8px",borderRadius:"20px",bgcolor:St.badgeBg,color:St.badgeText,border:"1px solid ".concat(St.badgeBorder),fontSize:"12px",fontWeight:600,whiteSpace:"nowrap",position:"relative",zIndex:1,pointerEvents:"auto",cursor:"pointer"}},{children:[null!=mt?mt:n.jsx(v.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:kn.open&&Gn===pt?"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},Me?{flex:1,overflow:"visible",minHeight:0}:{})},{children:[Gi&&n.jsx(l.default,{sections:11}),n.jsx(t.Box,e.__assign({ref:fn,sx:e.__assign({p:"8px",bgcolor:ci?"#F1F3F5":"#F7F8FA",borderBottom:"1px solid #D7DCE2",borderRadius:"8px 8px 0 0",display:"flex",alignItems:"center"},Me?e.__assign({maxHeight:"calc(100vh - 250px)",overflowY:"auto",overflowX:"hidden",minHeight:0},ci?{"&::-webkit-scrollbar":{width:"6px",display:"block"},"&::-webkit-scrollbar-track":{background:"transparent"},"&::-webkit-scrollbar-thumb":{background:"#CBD5E1",borderRadius:"10px"},"&::-webkit-scrollbar-thumb:hover":{background:"#94A3B8"},scrollbarWidth:"thin",scrollbarColor:"#CBD5E1 transparent"}:{"&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}):{})},{children:ci?n.jsxs(t.Tabs,e.__assign({value:un,onChange:function(e,n){return sn(n)},variant:"fullWidth",TabIndicatorProps:{sx:{display:"none"}},sx:{width:"100%",minHeight:"36px","& .MuiTab-root":{minHeight:"36px",px:1,py:0,borderRadius:"8px",fontSize:"14px",lineHeight:1,fontWeight:500,textTransform:"none",color:"#374151",minWidth:0,transition:"background-color 160ms ease, box-shadow 160ms ease"},"& .Mui-selected":{color:"#374151",bgcolor:"#FFFFFF"}}},{children:[n.jsx(t.Tab,{label:n.jsx(t.Tooltip,e.__assign({title:si,placement:"top"},{children:n.jsx(t.Box,e.__assign({component:"span",sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"block",width:"100%"}},{children:"Redline Guidelines"}))}))}),n.jsx(t.Tab,{label:n.jsx(t.Tooltip,e.__assign({title:"Web & GPT Sources",placement:"top"},{children:n.jsx(t.Box,e.__assign({component:"span",sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"block",width:"100%"}},{children:"Web & GPT Sources"}))}))})]})):n.jsx(t.Tooltip,e.__assign({title:si,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:si}))}))})),n.jsxs(t.Box,e.__assign({ref:Tn,onScroll:no,sx:e.__assign({p:ci?"0px":"12px",display:"flex",flexDirection:"column"},Me?e.__assign(e.__assign({maxHeight:"calc(100vh - 250px)"},!ci&&{flex:1}),{overflowY:"auto",overflowX:"hidden",minHeight:0,ml:"-150px",pl:"165px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}):{})},{children:[n.jsx("div",{ref:wn,style:{width:"100%",height:"0px",flexShrink:0}}),ci?0===un?n.jsx(B.default,{guidelinesData:Pe,deviationData:Te,connectedSections:$e,proposedSections:vi}):n.jsx(D.default,{deviationData:Te,connectedSections:$e,proposedSections:vi}):xi&&Do,n.jsx("div",{ref:In,style:{width:"100%",height:"0px",flexShrink:0}})]}))]}))]}))}))}))]}))}))};
2
2
  //# sourceMappingURL=CognitiveCompare.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("./CognitiveCompareConstants.js"),e=require("./utils/normalizeRedlineMarkdown.js"),n=function(t){return null==t?"":"string"==typeof t?t:Array.isArray(t)?t.map(n).join("\n\n"):"object"==typeof t?JSON.stringify(t):String(t)},o=function(t){return null!=t&&("string"==typeof t?t.trim().length>0:!Array.isArray(t)||t.length>0&&t.some(function(t){return o(t)}))},r=function(t){for(var e=t+1,n="";e>0;){e-=1;n=String.fromCharCode(97+e%26)+n,e=Math.floor(e/26)}return n},i=function(t,e,n,o){var r;void 0===o&&(o={});var i=n[e],l=null===(r=null==t?void 0:t.comparison_inputs)||void 0===r?void 0:r[i];return l?(Array.isArray(l)?l:[l]).map(function(t,e){if(t&&"string"==typeof t&&t.trim()){var n=o[t];return n&&"object"==typeof n&&n?{contentId:t,data:n,attributes:n.additional_attributes||{}}:null}return t&&"object"==typeof t?{contentId:t.content_id||t.id||"".concat(i,"-direct-").concat(e),data:t,attributes:t.additional_attributes||{}}:null}).filter(Boolean):[]};var l=function(t){if(!t)return!0;var e=t.trim().toLowerCase();return e.includes("no equivalent")||"n/a"===e||"na"===e||"none"===e},u=function(t){var e;if("string"!=typeof t||!t)return!1;for(var n=/<(updated|deleted|changed|change)\b[^>]*>([\s\S]*?)<\/\1>/gi,o=null;null!==(o=n.exec(t));){if((null!==(e=o[2])&&void 0!==e?e:"").replace(/<[^>]*>/g,"").trim().length>0)return!0}return!1},a=function(t){return"string"==typeof t&&t?t.replace(/<\/?(updated|deleted|changed|change)\b[^>]*>/gi,""):""},s=function(t,e){for(var n="",o=[],r=[],i=0;i<t.length;i+=1){var l=t[i],u=e&&/[\.,;:]/.test(l),a=/\s/.test(l)||u?" ":/[’‘`]/.test(l)?"'":/[”“]/.test(l)?'"':/[—–]/.test(l)?"-":l;" "===a&&n.endsWith(" ")?r[r.length-1]=i+1:(n+=a,o.push(i),r.push(i+1))}return{text:n,starts:o,ends:r}},d=function(t,e,n){if(void 0===n&&(n=!1),!t||!e)return null;var o=t.toLowerCase().indexOf(e.toLowerCase());if(-1!==o)return{start:o,end:o+e.length};var r=s(t,n),i=s(e,n).text.trim().toLowerCase();if(!i)return null;var l=r.text.toLowerCase().indexOf(i);if(-1===l)return null;var u=l+i.length-1,a=r.starts[l],d=r.ends[u];return void 0===a||void 0===d?null:{start:a,end:d}},c=["#B91C1C","#A16207","#1D4ED8","#000000"],v=function(t){var e=c.findIndex(function(e){return e.toLowerCase()===t.toLowerCase()});return-1===e?c.length:e},f=function(t,e,n){if(!t)return null;if(t.id===n||t.nodeId===n||t.contentId===n)return e;if(!Array.isArray(t.subsections))return null;for(var o=0;o<t.subsections.length;o++){var r=f(t.subsections[o],"".concat(e,"-").concat(o),n);if(r)return r}return null},g=new WeakMap,p=function(t){if(t){var e=g.get(t);null!=e&&(clearTimeout(e),g.delete(t)),t.style.transition="box-shadow 300ms ease-out, outline 300ms ease-out",requestAnimationFrame(function(){t.style.outline="",t.style.boxShadow=""}),window.setTimeout(function(){t.style.transition="",t.style.borderRadius=""},300)}},h=function(t){if(t){var e=g.get(t);null!=e&&clearTimeout(e),t.style.transition="box-shadow 300ms ease-in-out, outline 300ms ease-in-out",t.style.outline="2px solid #ff9494",t.style.borderRadius="6px",t.style.boxShadow="0 0 12px 2px rgba(244, 113, 113, 0.33)";var n=window.setTimeout(function(){p(t)},3e3);g.set(t,n)}};exports.DEVIATION_BADGE_SEPARATOR="::",exports.areMarkdownPropsEqual=function(t,e){var n,o,r,i,l,u;if(t.content!==e.content)return!1;if(t.overlayContent!==e.overlayContent)return!1;if(t.sxStyles!==e.sxStyles)return!1;if(t.maintainRelativeOrder!==e.maintainRelativeOrder)return!1;if(t.highlightBg!==e.highlightBg)return!1;if(t.suppressHighlightBg!==e.suppressHighlightBg)return!1;if(t.collisionKey!==e.collisionKey)return!1;var a=t.highlights||[],s=e.highlights||[];if(a.length!==s.length)return!1;for(var d=0;d<a.length;d++)if(a[d]!==s[d])return!1;var c=t.deviationBadges||[],v=e.deviationBadges||[];if(c.length!==v.length)return!1;for(d=0;d<c.length;d++){if(c[d].id!==v[d].id)return!1;if(c[d].actionId!==v[d].actionId)return!1;if(c[d].label!==v[d].label)return!1;if(c[d].score!==v[d].score)return!1;if(c[d].isOrphan!==v[d].isOrphan)return!1;if(c[d].isConnected!==v[d].isConnected)return!1;if(c[d].showScrollLockToggle!==v[d].showScrollLockToggle)return!1;if(c[d].scrollSyncLocked!==v[d].scrollSyncLocked)return!1;if((null===(n=c[d].style)||void 0===n?void 0:n.badgeBg)!==(null===(o=v[d].style)||void 0===o?void 0:o.badgeBg))return!1;if((null===(r=c[d].style)||void 0===r?void 0:r.badgeBorder)!==(null===(i=v[d].style)||void 0===i?void 0:i.badgeBorder))return!1;if((null===(l=c[d].style)||void 0===l?void 0:l.badgeText)!==(null===(u=v[d].style)||void 0===u?void 0:u.badgeText))return!1}return!0},exports.debounce=function(t,e){var n;return function(){for(var o=[],r=0;r<arguments.length;r++)o[r]=arguments[r];var i=this;clearTimeout(n),n=setTimeout(function(){return t.apply(i,o)},e)}},exports.extractDeviationScore=function(t,e){var n,o,r,i,l,u,a;if(!t)return e;var s=null!==(u=null!==(i=null!==(o=null===(n=t.evaluation_output)||void 0===n?void 0:n.output_score)&&void 0!==o?o:null===(r=t.evaluation_outputs)||void 0===r?void 0:r.output_score)&&void 0!==i?i:null===(l=t.evaluation_outputs)||void 0===l?void 0:l.output_value)&&void 0!==u?u:t.output_score;return null!==(a=null!=s?s:e)&&void 0!==a?a:""},exports.findKeyPathByNodeId=function(t,e){for(var n=0;n<t.length;n++){var o=f(t[n],String(n),e);if(o)return o}return null},exports.findTextMatchRange=d,exports.generateColorPalette=function(t){var e=function(t,e){var n=function(t){var e=function(t){return 4===t.length?"#"+t[1]+t[1]+t[2]+t[2]+t[3]+t[3]:t}(t).replace("#",""),n=parseInt(e,16);return{r:n>>16&255,g:n>>8&255,b:255&n}}(t),o=n.r,r=n.g,i=n.b;return function(t,e,n){return"#"+[t,e,n].map(function(t){return t.toString(16).padStart(2,"0")}).join("").toUpperCase()}(Math.round(o+(255-o)*e),Math.round(r+(255-r)*e),Math.round(i+(255-i)*e))};return{bg:e(t,.8),border:e(t,.5),badgeBg:e(t,.8),badgeBorder:e(t,.5),badgeText:t.toUpperCase(),highlightBg:e(t,.8)}},exports.getAlphabeticSuffix=r,exports.getBentArrowPath=function(t,e,n,o,r){void 0===r&&(r=14);var i=t+.5*(n-t),l=o-e;if(Math.abs(l)<3)return"M ".concat(t," ").concat(e," H ").concat(n);var u=l>0?1:-1,a=Math.min(r,Math.abs(l)/2,Math.abs(i-t)/2,Math.abs(n-i)/2);return["M ".concat(t," ").concat(e),"H ".concat(i-a),"Q ".concat(i," ").concat(e," ").concat(i," ").concat(e+u*a),"V ".concat(o-u*a),"Q ".concat(i," ").concat(o," ").concat(i+a," ").concat(o),"H ".concat(n)].join(" ")},exports.getFirstDeviationColor=function(e){for(var n,o,r,i,l,u,a,s,d,c,f,g,p,h=[],b=0,m=Object.keys((null==e?void 0:e.deviations)||{}).sort(function(t,e){return Number(t)-Number(e)});b<m.length;b++){var y=m[b];(A=null===(i=null===(r=null===(o=null===(n=null==e?void 0:e.deviations)||void 0===n?void 0:n[y])||void 0===o?void 0:o.evaluation_outputs)||void 0===r?void 0:r.metadata)||void 0===i?void 0:i.label_color)&&h.push(A)}for(var x=0,_=Object.keys((null==e?void 0:e.deviation_entries)||{}).sort(function(t,e){return Number(t)-Number(e)});x<_.length;x++){y=_[x];(A=null===(s=null===(a=null===(u=null===(l=null==e?void 0:e.deviation_entries)||void 0===l?void 0:l[y])||void 0===u?void 0:u.evaluation_outputs)||void 0===a?void 0:a.metadata)||void 0===s?void 0:s.label_color)&&h.push(A)}for(var I=0,T=Object.keys(e||{}).filter(function(t){return/^\d+$/.test(t)}).sort(function(t,e){return Number(t)-Number(e)});I<T.length;I++){var A;y=T[I];(A=null===(f=null===(c=null===(d=null==e?void 0:e[y])||void 0===d?void 0:d.evaluation_outputs)||void 0===c?void 0:c.metadata)||void 0===f?void 0:f.label_color)&&h.push(A)}return 0===h.length?(null===(p=null===(g=null==e?void 0:e.evaluation_outputs)||void 0===g?void 0:g.metadata)||void 0===p?void 0:p.label_color)?e.evaluation_outputs.metadata.label_color:t.DEFAULT_DEVIAION_COLOR:h.sort(function(t,e){return v(t)-v(e)})[0]},exports.getFirstDeviationOutputValue=function(t){for(var e,n,o,r,i,l,u,a,s,d=0,c=Object.keys((null==t?void 0:t.deviations)||{}).sort(function(t,e){return Number(t)-Number(e)});d<c.length;d++){var v=c[d];if(b=null===(o=null===(n=null===(e=null==t?void 0:t.deviations)||void 0===e?void 0:e[v])||void 0===n?void 0:n.evaluation_outputs)||void 0===o?void 0:o.output_value)return b}for(var f=0,g=Object.keys((null==t?void 0:t.deviation_entries)||{}).sort(function(t,e){return Number(t)-Number(e)});f<g.length;f++){v=g[f];if(b=null===(l=null===(i=null===(r=null==t?void 0:t.deviation_entries)||void 0===r?void 0:r[v])||void 0===i?void 0:i.evaluation_outputs)||void 0===l?void 0:l.output_value)return b}for(var p=0,h=Object.keys(t||{}).filter(function(t){return/^\d+$/.test(t)}).sort(function(t,e){return Number(t)-Number(e)});p<h.length;p++){var b;v=h[p];if(b=null===(a=null===(u=null==t?void 0:t[v])||void 0===u?void 0:u.evaluation_outputs)||void 0===a?void 0:a.output_value)return b}return(null===(s=null==t?void 0:t.evaluation_outputs)||void 0===s?void 0:s.output_value)?t.evaluation_outputs.output_value:null},exports.getLhsDeviationDisplayIndexes=function(t,o,r){var i=new Map;if(!o)return i;var s=function(t){var o=n(t||"").replace(/\\n/g,"\n");return u(o)?a(e.normalizeRedlineMarkdown(o)):o};return(t||[]).forEach(function(t){var e=new Map,n=function(t){var i;if(t){var u=s(t.content);((null===(i=t.evaluationResults)||void 0===i?void 0:i.length)?t.evaluationResults:t.evaluationResult?[t.evaluationResult]:[]).forEach(function(n){var i=(null==n?void 0:n.nodeId)||t.nodeId||t.id;Object.entries((null==n?void 0:n.deviations)||{}).forEach(function(t){var n=t[0],a=t[1][o],c=s(a);if(c&&!l(a)&&d(u,c)){var v="".concat(i).concat("::").concat(n),f=r[v];null!=f&&e.set(v,f)}})}),(t.subsections||[]).forEach(n)}};if(n(t),0!==e.size){var u=Math.min.apply(Math,Array.from(e.values()));e.forEach(function(t,e){i.set(e,t-u+1)})}}),i},exports.getRationale=function(t){if(!t.mapping_rationale)return{cognitiveData:{decisioning:[],gap:[],relevance_score:0,isMissingRationale:!0,citations:[]},score:0,relation:"N/A"};var e=t.mapping_rationale,n=parseInt(e.decision_strength||"0");return{cognitiveData:{decisioning:e.decisioning_factors||[],gap:e.gaps_in_decision||[],relevance_score:n,citations:e.citations},score:0,relation:"N/A"}},exports.getRhsMappedSectionNumber=function(t){var e=t.section,n=t.proposedSections,o=t.leftNums,i=t.fallbackNumber,l=t.firstOnly,u=void 0!==l&&l;if(!(null==e?void 0:e.id))return i;var a=(n||[]).map(function(t){var n=Array.isArray(null==t?void 0:t.refIndexes)?t.refIndexes:[],i=n.findIndex(function(t){return t===e.selfIndex});if(-1===i)return null;var l=(null==t?void 0:t.id)?o.get(t.id):void 0;return null==l?null:n.length>1?"".concat(l).concat(r(i)):String(l)}).filter(Boolean);return 0===a.length?i:u?a[0]:a.join(", ")},exports.getSideData=function(t,e,o,r){var l,u,a;void 0===r&&(r={});var s=i(t,e,o,r),d=(null===(l=s[0])||void 0===l?void 0:l.data)||{},c=(null===(u=s[0])||void 0===u?void 0:u.attributes)||null;return{title:n((null==d?void 0:d.title)||""),content:n((null==d?void 0:d.content)||""),change_history:n((null==d?void 0:d.change_history)||""),attributes:c,subsections:(null==d?void 0:d.subsections)||[],contentId:null===(a=s[0])||void 0===a?void 0:a.contentId,allItems:s}},exports.hasMeaningfulRedlineTags=u,exports.hasSingleMappedLhsSection=function(t,e){return null!=(null==t?void 0:t.selfIndex)&&1===(e||[]).filter(function(e){return Array.isArray(null==e?void 0:e.refIndexes)&&e.refIndexes.includes(t.selfIndex)}).length},exports.hasValue=o,exports.highlightClause=h,exports.isMissingStr=l,exports.mixHexColors=function(t,e){var n=function(t){var e=t.replace("#","");return[parseInt(e.substring(0,2),16),parseInt(e.substring(2,4),16),parseInt(e.substring(4,6),16)]},o=function(t){var e=Math.round(t).toString(16);return 1===e.length?"0"+e:e};try{var r=n(t),i=n(e),l=(r[0]+i[0])/2*.95,u=(r[1]+i[1])/2*.95,a=(r[2]+i[2])/2*.95;return"#".concat(o(l)).concat(o(u)).concat(o(a))}catch(t){return"#FDE68A"}},exports.recursivelyFindSubSectionIdxById=f,exports.resetClauseHighlight=p,exports.resolveComparisonInputItems=i,exports.safeStringify=n,exports.scrollAndHighlightClause=function(t,e){var n=e.getBoundingClientRect(),o=t.getBoundingClientRect(),r=e.scrollTop+o.top-n.top-n.height/2+o.height/2;e.scrollTo({top:r,behavior:"smooth"});var i=function(){return h(t)};if("onscrollend"in e)e.addEventListener("scrollend",i,{once:!0});else{var l=e.scrollTop,u=function(){e.scrollTop===l?i():(l=e.scrollTop,requestAnimationFrame(u))};requestAnimationFrame(u)}},exports.scrollAndWait=function(t,e,n){if(Math.abs(t.scrollTop-e)<=2)n();else{var o,r=!1,i=function(){r||(r=!0,clearTimeout(o),t.removeEventListener("scrollend",l),n())},l=function(){return i()};t.addEventListener("scrollend",l),t.scrollTo({top:e,behavior:"smooth"}),o=setTimeout(i,800)}},exports.smoothScrollTo=function(t,e,n,o,r){void 0===n&&(n=300);var i=t.style.scrollBehavior;t.style.scrollBehavior="auto";var l=t.scrollTop,u=e-l,a=null,s=function(d){null===a&&(a=d);var c,v=d-a;v<n?(t.scrollTop=(c=v,c/=n,u*(--c*c*c+1)+l),r&&r(),requestAnimationFrame(s)):(t.scrollTop=e,t.style.scrollBehavior=i,r&&r(),o&&o())};requestAnimationFrame(s)},exports.stripRedlineTags=a,exports.waitForScrollIdle=function(t,e){return void 0===e&&(e=100),new Promise(function(n){var o,r=!1,i=function(){r||(r=!0,t.removeEventListener("scroll",l),n())},l=function(){clearTimeout(o),o=setTimeout(i,e)};t.addEventListener("scroll",l),o=setTimeout(i,e)})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("./CognitiveCompareConstants.js"),n=function(t){return null==t?"":"string"==typeof t?t:Array.isArray(t)?t.map(n).join("\n\n"):"object"==typeof t?JSON.stringify(t):String(t)},e=function(t){return null!=t&&("string"==typeof t?t.trim().length>0:!Array.isArray(t)||t.length>0&&t.some(function(t){return e(t)}))},o=function(t){for(var n=t+1,e="";n>0;){n-=1;e=String.fromCharCode(97+n%26)+e,n=Math.floor(n/26)}return e},r=function(t,n,e,o){var r;void 0===o&&(o={});var i=e[n],l=null===(r=null==t?void 0:t.comparison_inputs)||void 0===r?void 0:r[i];return l?(Array.isArray(l)?l:[l]).map(function(t,n){if(t&&"string"==typeof t&&t.trim()){var e=o[t];return e&&"object"==typeof e&&e?{contentId:t,data:e,attributes:e.additional_attributes||{}}:null}return t&&"object"==typeof t?{contentId:t.content_id||t.id||"".concat(i,"-direct-").concat(n),data:t,attributes:t.additional_attributes||{}}:null}).filter(Boolean):[]};var i=function(t){if(!t)return!0;var n=t.trim().toLowerCase();return n.includes("no equivalent")||"n/a"===n||"na"===n||"none"===n},l=function(t){var n;if("string"!=typeof t||!t)return!1;for(var e=/<(updated|deleted|changed|change)\b[^>]*>([\s\S]*?)<\/\1>/gi,o=null;null!==(o=e.exec(t));){if((null!==(n=o[2])&&void 0!==n?n:"").replace(/<[^>]*>/g,"").trim().length>0)return!0}return!1},u=function(t){return"string"==typeof t&&t?t.replace(/<\/?(updated|deleted|changed|change)\b[^>]*>/gi,""):""},a=["#B91C1C","#A16207","#1D4ED8","#000000"],s=function(t){var n=a.findIndex(function(n){return n.toLowerCase()===t.toLowerCase()});return-1===n?a.length:n},c=function(t,n,e){if(!t)return null;if(t.id===e||t.nodeId===e||t.contentId===e)return n;if(!Array.isArray(t.subsections))return null;for(var o=0;o<t.subsections.length;o++){var r=c(t.subsections[o],"".concat(n,"-").concat(o),e);if(r)return r}return null},d=new WeakMap,v=function(t){if(t){var n=d.get(t);null!=n&&(clearTimeout(n),d.delete(t)),t.style.transition="box-shadow 300ms ease-out, outline 300ms ease-out",requestAnimationFrame(function(){t.style.outline="",t.style.boxShadow=""}),window.setTimeout(function(){t.style.transition="",t.style.borderRadius=""},300)}},f=function(t){if(t){var n=d.get(t);null!=n&&clearTimeout(n),t.style.transition="box-shadow 300ms ease-in-out, outline 300ms ease-in-out",t.style.outline="2px solid #ff9494",t.style.borderRadius="6px",t.style.boxShadow="0 0 12px 2px rgba(244, 113, 113, 0.33)";var e=window.setTimeout(function(){v(t)},3e3);d.set(t,e)}};exports.DEVIATION_BADGE_SEPARATOR="::",exports.areMarkdownPropsEqual=function(t,n){var e,o,r,i,l,u;if(t.content!==n.content)return!1;if(t.overlayContent!==n.overlayContent)return!1;if(t.sxStyles!==n.sxStyles)return!1;if(t.maintainRelativeOrder!==n.maintainRelativeOrder)return!1;if(t.highlightBg!==n.highlightBg)return!1;if(t.suppressHighlightBg!==n.suppressHighlightBg)return!1;if(t.collisionKey!==n.collisionKey)return!1;var a=t.highlights||[],s=n.highlights||[];if(a.length!==s.length)return!1;for(var c=0;c<a.length;c++)if(a[c]!==s[c])return!1;var d=t.deviationBadges||[],v=n.deviationBadges||[];if(d.length!==v.length)return!1;for(c=0;c<d.length;c++){if(d[c].id!==v[c].id)return!1;if(d[c].actionId!==v[c].actionId)return!1;if(d[c].label!==v[c].label)return!1;if(d[c].score!==v[c].score)return!1;if(d[c].isOrphan!==v[c].isOrphan)return!1;if(d[c].isConnected!==v[c].isConnected)return!1;if(d[c].showScrollLockToggle!==v[c].showScrollLockToggle)return!1;if(d[c].scrollSyncLocked!==v[c].scrollSyncLocked)return!1;if((null===(e=d[c].style)||void 0===e?void 0:e.badgeBg)!==(null===(o=v[c].style)||void 0===o?void 0:o.badgeBg))return!1;if((null===(r=d[c].style)||void 0===r?void 0:r.badgeBorder)!==(null===(i=v[c].style)||void 0===i?void 0:i.badgeBorder))return!1;if((null===(l=d[c].style)||void 0===l?void 0:l.badgeText)!==(null===(u=v[c].style)||void 0===u?void 0:u.badgeText))return!1}return!0},exports.debounce=function(t,n){var e;return function(){for(var o=[],r=0;r<arguments.length;r++)o[r]=arguments[r];var i=this;clearTimeout(e),e=setTimeout(function(){return t.apply(i,o)},n)}},exports.extractDeviationScore=function(t,n){var e,o,r,i,l,u,a;if(!t)return n;var s=null!==(u=null!==(i=null!==(o=null===(e=t.evaluation_output)||void 0===e?void 0:e.output_score)&&void 0!==o?o:null===(r=t.evaluation_outputs)||void 0===r?void 0:r.output_score)&&void 0!==i?i:null===(l=t.evaluation_outputs)||void 0===l?void 0:l.output_value)&&void 0!==u?u:t.output_score;return null!==(a=null!=s?s:n)&&void 0!==a?a:""},exports.findKeyPathByNodeId=function(t,n){for(var e=0;e<t.length;e++){var o=c(t[e],String(e),n);if(o)return o}return null},exports.generateColorPalette=function(t){var n=function(t,n){var e=function(t){var n=function(t){return 4===t.length?"#"+t[1]+t[1]+t[2]+t[2]+t[3]+t[3]:t}(t).replace("#",""),e=parseInt(n,16);return{r:e>>16&255,g:e>>8&255,b:255&e}}(t),o=e.r,r=e.g,i=e.b;return function(t,n,e){return"#"+[t,n,e].map(function(t){return t.toString(16).padStart(2,"0")}).join("").toUpperCase()}(Math.round(o+(255-o)*n),Math.round(r+(255-r)*n),Math.round(i+(255-i)*n))};return{bg:n(t,.8),border:n(t,.5),badgeBg:n(t,.8),badgeBorder:n(t,.5),badgeText:t.toUpperCase(),highlightBg:n(t,.8)}},exports.getAlphabeticSuffix=o,exports.getBentArrowPath=function(t,n,e,o,r){void 0===r&&(r=14);var i=t+.5*(e-t),l=o-n;if(Math.abs(l)<3)return"M ".concat(t," ").concat(n," H ").concat(e);var u=l>0?1:-1,a=Math.min(r,Math.abs(l)/2,Math.abs(i-t)/2,Math.abs(e-i)/2);return["M ".concat(t," ").concat(n),"H ".concat(i-a),"Q ".concat(i," ").concat(n," ").concat(i," ").concat(n+u*a),"V ".concat(o-u*a),"Q ".concat(i," ").concat(o," ").concat(i+a," ").concat(o),"H ".concat(e)].join(" ")},exports.getFirstDeviationColor=function(n){for(var e,o,r,i,l,u,a,c,d,v,f,p,g,h=[],b=0,m=Object.keys((null==n?void 0:n.deviations)||{}).sort(function(t,n){return Number(t)-Number(n)});b<m.length;b++){var y=m[b];(T=null===(i=null===(r=null===(o=null===(e=null==n?void 0:n.deviations)||void 0===e?void 0:e[y])||void 0===o?void 0:o.evaluation_outputs)||void 0===r?void 0:r.metadata)||void 0===i?void 0:i.label_color)&&h.push(T)}for(var x=0,_=Object.keys((null==n?void 0:n.deviation_entries)||{}).sort(function(t,n){return Number(t)-Number(n)});x<_.length;x++){y=_[x];(T=null===(c=null===(a=null===(u=null===(l=null==n?void 0:n.deviation_entries)||void 0===l?void 0:l[y])||void 0===u?void 0:u.evaluation_outputs)||void 0===a?void 0:a.metadata)||void 0===c?void 0:c.label_color)&&h.push(T)}for(var I=0,A=Object.keys(n||{}).filter(function(t){return/^\d+$/.test(t)}).sort(function(t,n){return Number(t)-Number(n)});I<A.length;I++){var T;y=A[I];(T=null===(f=null===(v=null===(d=null==n?void 0:n[y])||void 0===d?void 0:d.evaluation_outputs)||void 0===v?void 0:v.metadata)||void 0===f?void 0:f.label_color)&&h.push(T)}return 0===h.length?(null===(g=null===(p=null==n?void 0:n.evaluation_outputs)||void 0===p?void 0:p.metadata)||void 0===g?void 0:g.label_color)?n.evaluation_outputs.metadata.label_color:t.DEFAULT_DEVIAION_COLOR:h.sort(function(t,n){return s(t)-s(n)})[0]},exports.getFirstDeviationOutputValue=function(t){for(var n,e,o,r,i,l,u,a,s,c=0,d=Object.keys((null==t?void 0:t.deviations)||{}).sort(function(t,n){return Number(t)-Number(n)});c<d.length;c++){var v=d[c];if(b=null===(o=null===(e=null===(n=null==t?void 0:t.deviations)||void 0===n?void 0:n[v])||void 0===e?void 0:e.evaluation_outputs)||void 0===o?void 0:o.output_value)return b}for(var f=0,p=Object.keys((null==t?void 0:t.deviation_entries)||{}).sort(function(t,n){return Number(t)-Number(n)});f<p.length;f++){v=p[f];if(b=null===(l=null===(i=null===(r=null==t?void 0:t.deviation_entries)||void 0===r?void 0:r[v])||void 0===i?void 0:i.evaluation_outputs)||void 0===l?void 0:l.output_value)return b}for(var g=0,h=Object.keys(t||{}).filter(function(t){return/^\d+$/.test(t)}).sort(function(t,n){return Number(t)-Number(n)});g<h.length;g++){var b;v=h[g];if(b=null===(a=null===(u=null==t?void 0:t[v])||void 0===u?void 0:u.evaluation_outputs)||void 0===a?void 0:a.output_value)return b}return(null===(s=null==t?void 0:t.evaluation_outputs)||void 0===s?void 0:s.output_value)?t.evaluation_outputs.output_value:null},exports.getLhsDeviationDisplayIndexes=function(t,e,o){var r=new Map;if(!e)return r;var a=function(t){var e=l(t)?u(t):n(t||"");return n(e).replace(/\\n/g,"\n")};return(t||[]).forEach(function(t){var n=new Map,l=function(t){var r;if(t){var u=a(t.content);((null===(r=t.evaluationResults)||void 0===r?void 0:r.length)?t.evaluationResults:t.evaluationResult?[t.evaluationResult]:[]).forEach(function(r){var l=(null==r?void 0:r.nodeId)||t.nodeId||t.id;Object.entries((null==r?void 0:r.deviations)||{}).forEach(function(t){var r=t[0],s=t[1][e],c=a(s);if(c&&!i(s)&&u.includes(c)){var d="".concat(l).concat("::").concat(r),v=o[d];null!=v&&n.set(d,v)}})}),(t.subsections||[]).forEach(l)}};if(l(t),0!==n.size){var u=Math.min.apply(Math,Array.from(n.values()));n.forEach(function(t,n){r.set(n,t-u+1)})}}),r},exports.getRationale=function(t){if(!t.mapping_rationale)return{cognitiveData:{decisioning:[],gap:[],relevance_score:0,isMissingRationale:!0,citations:[]},score:0,relation:"N/A"};var n=t.mapping_rationale,e=parseInt(n.decision_strength||"0");return{cognitiveData:{decisioning:n.decisioning_factors||[],gap:n.gaps_in_decision||[],relevance_score:e,citations:n.citations},score:0,relation:"N/A"}},exports.getRhsMappedSectionNumber=function(t){var n=t.section,e=t.proposedSections,r=t.leftNums,i=t.fallbackNumber,l=t.firstOnly,u=void 0!==l&&l;if(!(null==n?void 0:n.id))return i;var a=(e||[]).map(function(t){var e=Array.isArray(null==t?void 0:t.refIndexes)?t.refIndexes:[],i=e.findIndex(function(t){return t===n.selfIndex});if(-1===i)return null;var l=(null==t?void 0:t.id)?r.get(t.id):void 0;return null==l?null:e.length>1?"".concat(l).concat(o(i)):String(l)}).filter(Boolean);return 0===a.length?i:u?a[0]:a.join(", ")},exports.getSideData=function(t,e,o,i){var l,u,a;void 0===i&&(i={});var s=r(t,e,o,i),c=(null===(l=s[0])||void 0===l?void 0:l.data)||{},d=(null===(u=s[0])||void 0===u?void 0:u.attributes)||null;return{title:n((null==c?void 0:c.title)||""),content:n((null==c?void 0:c.content)||""),change_history:n((null==c?void 0:c.change_history)||""),attributes:d,subsections:(null==c?void 0:c.subsections)||[],contentId:null===(a=s[0])||void 0===a?void 0:a.contentId,allItems:s}},exports.hasMeaningfulRedlineTags=l,exports.hasSingleMappedLhsSection=function(t,n){return null!=(null==t?void 0:t.selfIndex)&&1===(n||[]).filter(function(n){return Array.isArray(null==n?void 0:n.refIndexes)&&n.refIndexes.includes(t.selfIndex)}).length},exports.hasValue=e,exports.highlightClause=f,exports.isMissingStr=i,exports.mixHexColors=function(t,n){var e=function(t){var n=t.replace("#","");return[parseInt(n.substring(0,2),16),parseInt(n.substring(2,4),16),parseInt(n.substring(4,6),16)]},o=function(t){var n=Math.round(t).toString(16);return 1===n.length?"0"+n:n};try{var r=e(t),i=e(n),l=(r[0]+i[0])/2*.95,u=(r[1]+i[1])/2*.95,a=(r[2]+i[2])/2*.95;return"#".concat(o(l)).concat(o(u)).concat(o(a))}catch(t){return"#FDE68A"}},exports.recursivelyFindSubSectionIdxById=c,exports.resetClauseHighlight=v,exports.resolveComparisonInputItems=r,exports.safeStringify=n,exports.scrollAndHighlightClause=function(t,n){var e=n.getBoundingClientRect(),o=t.getBoundingClientRect(),r=n.scrollTop+o.top-e.top-e.height/2+o.height/2;n.scrollTo({top:r,behavior:"smooth"});var i=function(){return f(t)};if("onscrollend"in n)n.addEventListener("scrollend",i,{once:!0});else{var l=n.scrollTop,u=function(){n.scrollTop===l?i():(l=n.scrollTop,requestAnimationFrame(u))};requestAnimationFrame(u)}},exports.scrollAndWait=function(t,n,e){if(Math.abs(t.scrollTop-n)<=2)e();else{var o,r=!1,i=function(){r||(r=!0,clearTimeout(o),t.removeEventListener("scrollend",l),e())},l=function(){return i()};t.addEventListener("scrollend",l),t.scrollTo({top:n,behavior:"smooth"}),o=setTimeout(i,800)}},exports.smoothScrollTo=function(t,n,e,o,r){void 0===e&&(e=300);var i=t.style.scrollBehavior;t.style.scrollBehavior="auto";var l=t.scrollTop,u=n-l,a=null,s=function(c){null===a&&(a=c);var d,v=c-a;v<e?(t.scrollTop=(d=v,d/=e,u*(--d*d*d+1)+l),r&&r(),requestAnimationFrame(s)):(t.scrollTop=n,t.style.scrollBehavior=i,r&&r(),o&&o())};requestAnimationFrame(s)},exports.stripRedlineTags=u,exports.waitForScrollIdle=function(t,n){return void 0===n&&(n=100),new Promise(function(e){var o,r=!1,i=function(){r||(r=!0,t.removeEventListener("scroll",l),e())},l=function(){clearTimeout(o),o=setTimeout(i,n)};t.addEventListener("scroll",l),o=setTimeout(i,n)})};
2
2
  //# sourceMappingURL=CognitiveComparehelpers.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var i=require("tslib"),o=require("react/jsx-runtime"),e=require("react"),n=require("@mui/material"),t=require("lucide-react"),s=require("react-dom"),a=require("../../assests/svg/SparkleIcon.js"),r=require("./CognitiveCompareConfig.js"),l=require("./CitationRenderer.js");function c(i){return i&&"object"==typeof i&&"default"in i?i:{default:i}}var d=c(s),x=10;exports.default=function(s){var c,p,g,u,v,h,b,f,_,m,y,F,j,w,C,k,B,D,S,E,T=s.open,I=s.onClose,R=s.sectionTitle,A=s.referenceSectionTitle,L=s.cognitiveData,P=s.relevanceScore,z=s.anchorEl,O=s.badgeStyle,W=s.popupRef,q=s.position,U=s.markdownStyles,H=s.docData,M=s.popupConfig,N=s.deviationData,G=void 0===N?null:N,Y=s.isLoading,K=i.__assign(i.__assign({},r.SHARED_MARKDOWN_STYLES),U),X=e.useMemo(function(){var o,e;return i.__assign(i.__assign(i.__assign({},r.DEFAULT_POPUP_CONFIG),M),{tabs:{deviation:i.__assign(i.__assign({},r.DEFAULT_POPUP_CONFIG.tabs.deviation),null===(o=null==M?void 0:M.tabs)||void 0===o?void 0:o.deviation),association:i.__assign(i.__assign({},r.DEFAULT_POPUP_CONFIG.tabs.association),null===(e=null==M?void 0:M.tabs)||void 0===e?void 0:e.association)},sectionTitles:i.__assign(i.__assign({},r.DEFAULT_POPUP_CONFIG.sectionTitles),null==M?void 0:M.sectionTitles)})},[M]),J=null==L?void 0:L.isMissingRationale,Q=e.useState(J?X.tabs.deviation.key:X.tabs.association.key),V=Q[0],Z=Q[1],$=e.useState(!1),ii=$[0],oi=$[1],ei=e.useCallback(function(i){oi(i)},[]);e.useEffect(function(){T?Z(J?X.tabs.deviation.key:X.tabs.association.key):oi(!1)},[T,J,X.tabs.deviation.key,X.tabs.association.key]);var ni=e.useMemo(function(){if(!O)return{border:X.accentColor,shadow:"".concat(X.accentColor,"2E")};var i=O.badgeText;return"#9F1239"===i||"#B42318"===i?{border:"#E11D48",shadow:"rgba(225,29,72,0.15)"}:"#1D4ED8"===i?{border:"#3B82F6",shadow:"rgba(59,130,246,0.15)"}:"#A16207"===i?{border:"#F59E0B",shadow:"rgba(245,158,11,0.15)"}:{border:X.accentColor,shadow:"".concat(X.accentColor,"2E")}},[O,X.accentColor]);e.useEffect(function(){if(T&&!ii){var i=function(i){var o;(null===(o=W.current)||void 0===o?void 0:o.contains(i.target))||(null==z?void 0:z.contains(i.target))||I()};return document.addEventListener("mousedown",i),function(){return document.removeEventListener("mousedown",i)}}},[T,I,z,W,ii]);var ti=J?[]:[X.tabs.deviation,X.tabs.association];if(1===ti.length&&ti[0].key===X.tabs.deviation.key)return null;if(!T||!L)return null;var si=null!==(g=null!==(p=V===X.tabs.deviation.key?null===(c=null==G?void 0:G.cognitive_decisioning)||void 0===c?void 0:c.decision_strength:L.relevance_score)&&void 0!==p?p:P)&&void 0!==g?g:0,ai=L.decisioning,ri=Array.isArray(ai)?ai:"string"==typeof ai&&ai.trim()?[ai]:[],li=L.gap,ci=Array.isArray(li)?li:"string"==typeof li&&li.trim()?[li]:[],di=q?q.left-150:-9999,xi=(null!==(u=null==q?void 0:q.arrowLeft)&&void 0!==u?u:60)+150,pi=o.jsxs(n.Box,i.__assign({ref:W,sx:{position:"fixed",top:null!==(v=null==q?void 0:q.top)&&void 0!==v?v:-9999,left:di,zIndex:9999,width:"".concat(1050,"px"),maxWidth:"min(".concat(1050,"px, calc(100vw - ").concat(di>0?di:0,"px - ").concat(12,"px))"),bgcolor:"#FFFFFF",borderRadius:"14px",border:"1.5px solid ".concat(ni.border),boxShadow:"0px 8px 32px ".concat(ni.shadow,", 0px 0px 0px 3px ").concat(ni.shadow),overflow:"visible",display:ii?"none":"flex",flexDirection:"column",maxHeight:(null==q?void 0:q.maxHeight)?"min(60vh, ".concat(q.maxHeight,"px)"):"60vh",visibility:q?"visible":"hidden",pointerEvents:ii?"none":"auto"}},{children:[q&&(q.openAbove?o.jsxs(o.Fragment,{children:[o.jsx(n.Box,{sx:{position:"absolute",bottom:-11,left:xi-x,width:0,height:0,borderLeft:"".concat(x,"px solid transparent"),borderRight:"".concat(x,"px solid transparent"),borderTop:"".concat(11,"px solid ").concat(ni.border),zIndex:1}}),o.jsx(n.Box,{sx:{position:"absolute",bottom:-9,left:xi-x+1,width:0,height:0,borderLeft:"".concat(9,"px solid transparent"),borderRight:"".concat(9,"px solid transparent"),borderTop:"".concat(x,"px solid #FFFFFF"),zIndex:2}})]}):o.jsxs(o.Fragment,{children:[o.jsx(n.Box,{sx:{position:"absolute",top:-11,left:xi-x,width:0,height:0,borderLeft:"".concat(x,"px solid transparent"),borderRight:"".concat(x,"px solid transparent"),borderBottom:"".concat(11,"px solid ").concat(ni.border),zIndex:1}}),o.jsx(n.Box,{sx:{position:"absolute",top:-9,left:xi-x+1,width:0,height:0,borderLeft:"".concat(9,"px solid transparent"),borderRight:"".concat(9,"px solid transparent"),borderBottom:"".concat(x,"px solid #FFFFFF"),zIndex:2}})]})),o.jsxs(n.Box,i.__assign({sx:{px:2.5,pt:2,pb:1.5,display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:2,flexShrink:0}},{children:[o.jsxs(n.Box,i.__assign({sx:{flex:1,minWidth:0}},{children:[("no counterpart"!==R||"no counterpart"!==A)&&o.jsxs(n.Typography,i.__assign({sx:{fontSize:"16px",fontWeight:600,color:"#101828",lineHeight:1.3,display:"flex",alignItems:"center",gap:1,flexWrap:"nowrap",overflow:"hidden",width:"100%"}},{children:[o.jsx(n.Box,i.__assign({component:"span",title:R,sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:"0 1 auto",maxWidth:"calc(50% - 16px)",minWidth:0}},{children:R})),o.jsx(n.Box,i.__assign({component:"span",sx:{color:"#667085",fontWeight:400,flexShrink:0,mx:.5}},{children:"↔"})),o.jsx(n.Box,i.__assign({component:"span",title:A||"Reference Section",sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1,minWidth:0}},{children:A||"Reference Section"}))]})),o.jsx(n.Box,i.__assign({sx:{mt:.75,display:"inline-flex",alignItems:"center",gap:.75}},{children:o.jsx(n.Typography,i.__assign({sx:{fontSize:"no counterpart"!==R||"no counterpart"!==A?"13px":"16px",fontWeight:400,color:"#5928ED",lineHeight:1}},{children:null===(h=Object.values(X.tabs).find(function(i){return i.key===V}))||void 0===h?void 0:h.subtitle}))}))]})),o.jsxs(n.Box,i.__assign({sx:{display:"flex",alignItems:"center",gap:1.5,flexShrink:0}},{children:[o.jsxs(n.Box,i.__assign({sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:.5,borderRadius:"20px",bgcolor:"#FFFFFF",border:"1px solid #5928ED",fontSize:"12px",fontWeight:600,color:"#5928ED"}},{children:[o.jsx(a.default,{}),X.decisionStrengthLabel," ",si,"%"]})),o.jsx(n.IconButton,i.__assign({onClick:I,size:"small",sx:{color:"#667085",width:24,height:24,"&:hover":{bgcolor:"transparent",color:"#101828"}}},{children:o.jsx(t.X,{size:22})}))]}))]})),o.jsx(n.Box,i.__assign({sx:{display:"flex",borderBottom:"1px solid #E4E7EC",px:2.5,flexShrink:0}},{children:ti.map(function(e){var t=V===e.key,s=e.key===X.tabs.deviation.key,a=ti.length>1&&s&&Y,r=o.jsx(n.Box,i.__assign({onClick:function(){a||Z(e.key)},sx:{pb:"10px",pt:"4px",mr:3,px:2,cursor:a?"not-allowed":"pointer",opacity:a?.5:1,fontSize:"14px",fontWeight:t?600:400,color:t?X.accentColor:"#667085",backgroundColor:t?"".concat(X.accentColor,"14"):"transparent",borderBottom:t?"2px solid ".concat(X.accentColor):"2px solid transparent",transition:"all 0.15s",userSelect:"none"}},{children:e.label}),e.key);return a?o.jsx(n.Tooltip,i.__assign({title:"Fetching deviation data",arrow:!0,placement:"top"},{children:o.jsx("span",{children:r})}),e.key):r})})),o.jsx(n.Box,i.__assign({sx:{flex:1,minHeight:0,overflowY:"auto",px:2.5,py:2,display:"flex",flexDirection:"column",gap:1.5,"&::-webkit-scrollbar":{width:"6px"},"&::-webkit-scrollbar-track":{background:"transparent"},"&::-webkit-scrollbar-thumb":{background:"".concat(ni.border,"55"),borderRadius:"10px"},"&::-webkit-scrollbar-thumb:hover":{background:ni.border},scrollbarWidth:"thin",scrollbarColor:"".concat(ni.border,"55 transparent")}},{children:V===X.tabs.deviation.key?G?o.jsxs(o.Fragment,{children:[(null===(f=(null===(b=null==G?void 0:G.cognitive_decisioning)||void 0===b?void 0:b.decisioning_factors)||[])||void 0===f?void 0:f.length)>0&&o.jsx(l.default,{title:"Decision Making Factors",content:null===(m=null===(_=null==G?void 0:G.cognitive_decisioning)||void 0===_?void 0:_.decisioning_factors)||void 0===m?void 0:m.join("\n\n"),citations:null===(y=null==G?void 0:G.cognitive_decisioning)||void 0===y?void 0:y.citations,styles:K,docData:H,deviationData:G,open:T,onCitationFullscreenChange:ei}),(null===(j=(null===(F=null==G?void 0:G.cognitive_decisioning)||void 0===F?void 0:F.gaps_in_decision)||[])||void 0===j?void 0:j.length)>0&&o.jsx(l.default,{title:"Gaps in Decision",content:null===(C=null===(w=null==G?void 0:G.cognitive_decisioning)||void 0===w?void 0:w.gaps_in_decision)||void 0===C?void 0:C.join("\n\n"),citations:null===(k=null==G?void 0:G.cognitive_decisioning)||void 0===k?void 0:k.citations,styles:K,docData:H,deviationData:G,open:T,onCitationFullscreenChange:ei}),0===(null===(D=(null===(B=null==G?void 0:G.cognitive_decisioning)||void 0===B?void 0:B.decisioning_factors)||[])||void 0===D?void 0:D.length)&&0===(null===(E=(null===(S=null==G?void 0:G.cognitive_decisioning)||void 0===S?void 0:S.gaps_in_decision)||[])||void 0===E?void 0:E.length)&&o.jsx(n.Box,i.__assign({sx:{p:2,bgcolor:"#F8FAFC",borderRadius:"8px",border:"1px solid #E2E8F0"}},{children:o.jsx(n.Typography,i.__assign({sx:{fontSize:"13px",color:"#64748B"}},{children:"No cognitive decisioning data available for this section."}))}))]}):o.jsx(l.default,{title:"Deviation Analysis",content:"Deviation analysis content will appear here. This tab shows\n structural and semantic deviations identified between the two\n sections being compared.",citations:{},styles:K,docData:H,open:T,onCitationFullscreenChange:ei}):o.jsxs(o.Fragment,{children:[ri.length>0&&o.jsx(l.default,{title:X.sectionTitles.decisioningFactors,content:ri.join("\n\n"),citations:L.citations,styles:K,open:T,docData:H,onCitationFullscreenChange:ei}),ci.length>0&&o.jsx(l.default,{title:X.sectionTitles.gaps,content:ci.join("\n\n"),citations:L.citations,styles:K,open:T,docData:H,onCitationFullscreenChange:ei}),0===ri.length&&0===ci.length&&o.jsx(n.Box,i.__assign({sx:{p:2,bgcolor:"#F8FAFC",borderRadius:"8px",border:"1px solid #E2E8F0"}},{children:o.jsx(n.Typography,i.__assign({sx:{fontSize:"13px",color:"#64748B"}},{children:X.emptyStateMessage}))}))]})}))]}));return d.default.createPortal(pi,document.body)};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var i=require("tslib"),o=require("react/jsx-runtime"),e=require("react"),n=require("@mui/material"),t=require("lucide-react"),s=require("react-dom"),a=require("../../assests/svg/SparkleIcon.js"),r=require("./CognitiveCompareConfig.js"),l=require("./CitationRenderer.js");function c(i){return i&&"object"==typeof i&&"default"in i?i:{default:i}}var d=c(s),x=10;exports.default=function(s){var c,p,g,u,v,h,b,f,_,m,y,F,j,w,C,k,B,D,S,E,T=s.open,I=s.onClose,R=s.sectionTitle,A=s.referenceSectionTitle,L=s.cognitiveData,P=s.relevanceScore,z=s.anchorEl,O=s.badgeStyle,W=s.popupRef,q=s.position,U=s.markdownStyles,H=s.docData,M=s.popupConfig,N=s.deviationData,G=void 0===N?null:N,Y=s.isLoading,K=i.__assign(i.__assign({},r.SHARED_MARKDOWN_STYLES),U),X=e.useMemo(function(){var o,e;return i.__assign(i.__assign(i.__assign({},r.DEFAULT_POPUP_CONFIG),M),{tabs:{deviation:i.__assign(i.__assign({},r.DEFAULT_POPUP_CONFIG.tabs.deviation),null===(o=null==M?void 0:M.tabs)||void 0===o?void 0:o.deviation),association:i.__assign(i.__assign({},r.DEFAULT_POPUP_CONFIG.tabs.association),null===(e=null==M?void 0:M.tabs)||void 0===e?void 0:e.association)},sectionTitles:i.__assign(i.__assign({},r.DEFAULT_POPUP_CONFIG.sectionTitles),null==M?void 0:M.sectionTitles)})},[M]),J=null==L?void 0:L.isMissingRationale,Q=e.useState(J?X.tabs.deviation.key:X.tabs.association.key),V=Q[0],Z=Q[1],$=e.useState(!1),ii=$[0],oi=$[1],ei=e.useCallback(function(i){oi(i)},[]);e.useEffect(function(){T?Z(J?X.tabs.deviation.key:X.tabs.association.key):oi(!1)},[T,J,X.tabs.deviation.key,X.tabs.association.key]);var ni=e.useMemo(function(){if(!O)return{border:X.accentColor,shadow:"".concat(X.accentColor,"2E")};var i=O.badgeText;return"#9F1239"===i||"#B42318"===i?{border:"#E11D48",shadow:"rgba(225,29,72,0.15)"}:"#1D4ED8"===i?{border:"#3B82F6",shadow:"rgba(59,130,246,0.15)"}:"#A16207"===i?{border:"#F59E0B",shadow:"rgba(245,158,11,0.15)"}:{border:X.accentColor,shadow:"".concat(X.accentColor,"2E")}},[O,X.accentColor]);e.useEffect(function(){if(T&&!ii){var i=function(i){var o;(null===(o=W.current)||void 0===o?void 0:o.contains(i.target))||(null==z?void 0:z.contains(i.target))||I()};return document.addEventListener("mousedown",i),function(){return document.removeEventListener("mousedown",i)}}},[T,I,z,W,ii]);var ti=J?[]:[X.tabs.deviation,X.tabs.association];if(1===ti.length&&ti[0].key===X.tabs.deviation.key)return null;if(!T||!L)return null;var si=null!==(g=null!==(p=V===X.tabs.deviation.key?null===(c=null==G?void 0:G.cognitive_decisioning)||void 0===c?void 0:c.decision_strength:L.relevance_score)&&void 0!==p?p:P)&&void 0!==g?g:0,ai=L.decisioning,ri=Array.isArray(ai)?ai:"string"==typeof ai&&ai.trim()?[ai]:[],li=L.gap,ci=Array.isArray(li)?li:"string"==typeof li&&li.trim()?[li]:[],di=q?q.left-150:-9999,xi=(null!==(u=null==q?void 0:q.arrowLeft)&&void 0!==u?u:60)+150,pi=o.jsxs(n.Box,i.__assign({ref:W,sx:{position:"fixed",top:null!==(v=null==q?void 0:q.top)&&void 0!==v?v:-9999,left:di,zIndex:9999,width:"".concat(1050,"px"),maxWidth:"min(".concat(1050,"px, calc(100vw - ").concat(di>0?di:0,"px - ").concat(12,"px))"),bgcolor:"#FFFFFF",borderRadius:"14px",border:"1.5px solid ".concat(ni.border),boxShadow:"0px 8px 32px ".concat(ni.shadow,", 0px 0px 0px 3px ").concat(ni.shadow),overflow:"visible",display:"flex",flexDirection:"column",maxHeight:(null==q?void 0:q.maxHeight)?"min(60vh, ".concat(q.maxHeight,"px)"):"60vh",visibility:!ii&&q?"visible":"hidden",pointerEvents:ii?"none":"auto"}},{children:[q&&(q.openAbove?o.jsxs(o.Fragment,{children:[o.jsx(n.Box,{sx:{position:"absolute",bottom:-11,left:xi-x,width:0,height:0,borderLeft:"".concat(x,"px solid transparent"),borderRight:"".concat(x,"px solid transparent"),borderTop:"".concat(11,"px solid ").concat(ni.border),zIndex:1}}),o.jsx(n.Box,{sx:{position:"absolute",bottom:-9,left:xi-x+1,width:0,height:0,borderLeft:"".concat(9,"px solid transparent"),borderRight:"".concat(9,"px solid transparent"),borderTop:"".concat(x,"px solid #FFFFFF"),zIndex:2}})]}):o.jsxs(o.Fragment,{children:[o.jsx(n.Box,{sx:{position:"absolute",top:-11,left:xi-x,width:0,height:0,borderLeft:"".concat(x,"px solid transparent"),borderRight:"".concat(x,"px solid transparent"),borderBottom:"".concat(11,"px solid ").concat(ni.border),zIndex:1}}),o.jsx(n.Box,{sx:{position:"absolute",top:-9,left:xi-x+1,width:0,height:0,borderLeft:"".concat(9,"px solid transparent"),borderRight:"".concat(9,"px solid transparent"),borderBottom:"".concat(x,"px solid #FFFFFF"),zIndex:2}})]})),o.jsxs(n.Box,i.__assign({sx:{px:2.5,pt:2,pb:1.5,display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:2,flexShrink:0}},{children:[o.jsxs(n.Box,i.__assign({sx:{flex:1,minWidth:0}},{children:[("no counterpart"!==R||"no counterpart"!==A)&&o.jsxs(n.Typography,i.__assign({sx:{fontSize:"16px",fontWeight:600,color:"#101828",lineHeight:1.3,display:"flex",alignItems:"center",gap:1,flexWrap:"nowrap",overflow:"hidden",width:"100%"}},{children:[o.jsx(n.Box,i.__assign({component:"span",title:R,sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:"0 1 auto",maxWidth:"calc(50% - 16px)",minWidth:0}},{children:R})),o.jsx(n.Box,i.__assign({component:"span",sx:{color:"#667085",fontWeight:400,flexShrink:0,mx:.5}},{children:"↔"})),o.jsx(n.Box,i.__assign({component:"span",title:A||"Reference Section",sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1,minWidth:0}},{children:A||"Reference Section"}))]})),o.jsx(n.Box,i.__assign({sx:{mt:.75,display:"inline-flex",alignItems:"center",gap:.75}},{children:o.jsx(n.Typography,i.__assign({sx:{fontSize:"no counterpart"!==R||"no counterpart"!==A?"13px":"16px",fontWeight:400,color:"#5928ED",lineHeight:1}},{children:null===(h=Object.values(X.tabs).find(function(i){return i.key===V}))||void 0===h?void 0:h.subtitle}))}))]})),o.jsxs(n.Box,i.__assign({sx:{display:"flex",alignItems:"center",gap:1.5,flexShrink:0}},{children:[o.jsxs(n.Box,i.__assign({sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:.5,borderRadius:"20px",bgcolor:"#FFFFFF",border:"1px solid #5928ED",fontSize:"12px",fontWeight:600,color:"#5928ED"}},{children:[o.jsx(a.default,{}),X.decisionStrengthLabel," ",si,"%"]})),o.jsx(n.IconButton,i.__assign({onClick:I,size:"small",sx:{color:"#667085",width:24,height:24,"&:hover":{bgcolor:"transparent",color:"#101828"}}},{children:o.jsx(t.X,{size:22})}))]}))]})),o.jsx(n.Box,i.__assign({sx:{display:"flex",borderBottom:"1px solid #E4E7EC",px:2.5,flexShrink:0}},{children:ti.map(function(e){var t=V===e.key,s=e.key===X.tabs.deviation.key,a=ti.length>1&&s&&Y,r=o.jsx(n.Box,i.__assign({onClick:function(){a||Z(e.key)},sx:{pb:"10px",pt:"4px",mr:3,px:2,cursor:a?"not-allowed":"pointer",opacity:a?.5:1,fontSize:"14px",fontWeight:t?600:400,color:t?X.accentColor:"#667085",backgroundColor:t?"".concat(X.accentColor,"14"):"transparent",borderBottom:t?"2px solid ".concat(X.accentColor):"2px solid transparent",transition:"all 0.15s",userSelect:"none"}},{children:e.label}),e.key);return a?o.jsx(n.Tooltip,i.__assign({title:"Fetching deviation data",arrow:!0,placement:"top"},{children:o.jsx("span",{children:r})}),e.key):r})})),o.jsx(n.Box,i.__assign({sx:{flex:1,minHeight:0,overflowY:"auto",px:2.5,py:2,display:"flex",flexDirection:"column",gap:1.5,"&::-webkit-scrollbar":{width:"6px"},"&::-webkit-scrollbar-track":{background:"transparent"},"&::-webkit-scrollbar-thumb":{background:"".concat(ni.border,"55"),borderRadius:"10px"},"&::-webkit-scrollbar-thumb:hover":{background:ni.border},scrollbarWidth:"thin",scrollbarColor:"".concat(ni.border,"55 transparent")}},{children:V===X.tabs.deviation.key?G?o.jsxs(o.Fragment,{children:[(null===(f=(null===(b=null==G?void 0:G.cognitive_decisioning)||void 0===b?void 0:b.decisioning_factors)||[])||void 0===f?void 0:f.length)>0&&o.jsx(l.default,{title:"Decision Making Factors",content:null===(m=null===(_=null==G?void 0:G.cognitive_decisioning)||void 0===_?void 0:_.decisioning_factors)||void 0===m?void 0:m.join("\n\n"),citations:null===(y=null==G?void 0:G.cognitive_decisioning)||void 0===y?void 0:y.citations,styles:K,docData:H,deviationData:G,open:T,onCitationFullscreenChange:ei}),(null===(j=(null===(F=null==G?void 0:G.cognitive_decisioning)||void 0===F?void 0:F.gaps_in_decision)||[])||void 0===j?void 0:j.length)>0&&o.jsx(l.default,{title:"Gaps in Decision",content:null===(C=null===(w=null==G?void 0:G.cognitive_decisioning)||void 0===w?void 0:w.gaps_in_decision)||void 0===C?void 0:C.join("\n\n"),citations:null===(k=null==G?void 0:G.cognitive_decisioning)||void 0===k?void 0:k.citations,styles:K,docData:H,deviationData:G,open:T,onCitationFullscreenChange:ei}),0===(null===(D=(null===(B=null==G?void 0:G.cognitive_decisioning)||void 0===B?void 0:B.decisioning_factors)||[])||void 0===D?void 0:D.length)&&0===(null===(E=(null===(S=null==G?void 0:G.cognitive_decisioning)||void 0===S?void 0:S.gaps_in_decision)||[])||void 0===E?void 0:E.length)&&o.jsx(n.Box,i.__assign({sx:{p:2,bgcolor:"#F8FAFC",borderRadius:"8px",border:"1px solid #E2E8F0"}},{children:o.jsx(n.Typography,i.__assign({sx:{fontSize:"13px",color:"#64748B"}},{children:"No cognitive decisioning data available for this section."}))}))]}):o.jsx(l.default,{title:"Deviation Analysis",content:"Deviation analysis content will appear here. This tab shows\n structural and semantic deviations identified between the two\n sections being compared.",citations:{},styles:K,docData:H,open:T,onCitationFullscreenChange:ei}):o.jsxs(o.Fragment,{children:[ri.length>0&&o.jsx(l.default,{title:X.sectionTitles.decisioningFactors,content:ri.join("\n\n"),citations:L.citations,styles:K,open:T,docData:H,onCitationFullscreenChange:ei}),ci.length>0&&o.jsx(l.default,{title:X.sectionTitles.gaps,content:ci.join("\n\n"),citations:L.citations,styles:K,open:T,docData:H,onCitationFullscreenChange:ei}),0===ri.length&&0===ci.length&&o.jsx(n.Box,i.__assign({sx:{p:2,bgcolor:"#F8FAFC",borderRadius:"8px",border:"1px solid #E2E8F0"}},{children:o.jsx(n.Typography,i.__assign({sx:{fontSize:"13px",color:"#64748B"}},{children:X.emptyStateMessage}))}))]})}))]}));return d.default.createPortal(pi,document.body)};
2
2
  //# sourceMappingURL=CognitivePopup.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),r=require("react/jsx-runtime"),i=require("react"),o=require("@mui/material"),l=require("react-markdown"),t=require("rehype-raw"),a=require("../../CognitiveCompareConfig.js"),n=require("../../CognitiveComparehelpers.js"),u=require("../utils/processGuidelinesMarkdown.js");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var d=s(l),g=s(t);exports.default=function(l){var t=l.guidelinesData,s=l.deviationData,v=l.connectedSections,_=l.proposedSections,p=Array.from(v)[0],c=i.useMemo(function(){var r;if(null==p||!s)return{targetHighlights:[],labelColor:""};var i="";"number"==typeof p?i=(null===(r=_[p])||void 0===r?void 0:r.nodeId)||"":"string"==typeof p&&(i=p.includes(n.DEVIATION_BADGE_SEPARATOR)?p.split(n.DEVIATION_BADGE_SEPARATOR)[0]:p.split("::")[0].split(":")[0]);var o=s[i];if(!o)return{targetHighlights:[],labelColor:""};var l=[],t=o.evaluation_result||{},a="";return Object.values(t).forEach(function(r){var i,o,t,u,s;(null===(i=null==r?void 0:r.deviation_highlights)||void 0===i?void 0:i.rulebook_guidelines)&&(l=e.__spreadArray(e.__spreadArray([],l,!0),r.deviation_highlights.rulebook_guidelines,!0),a=(null===(t=null===(o=r.evaluation_outputs)||void 0===o?void 0:o.metadata)||void 0===t?void 0:t.label_color)?n.generateColorPalette(null===(s=null===(u=r.evaluation_outputs)||void 0===u?void 0:u.metadata)||void 0===s?void 0:s.label_color).bg:"")}),{targetHighlights:l.filter(Boolean),labelColor:a}},[p,s,_]),h=c.targetHighlights,f=c.labelColor,b=i.useMemo(function(){return u.processGuidelinesMarkdown({guidelinesData:t,targetHighlights:h,labelColor:f||"#FEF08A"})},[t,h,f]);return r.jsx(o.Box,e.__assign({sx:e.__assign(e.__assign({padding:"0px 12px",marginTop:"12px",backgroundColor:"#FFFFFF",borderRadius:"8px"},a.SHARED_MARKDOWN_STYLES),{overflow:"visible"})},{children:r.jsx(d.default,e.__assign({rehypePlugins:[g.default]},{children:b}))}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),r=require("react/jsx-runtime"),i=require("react"),o=require("@mui/material"),l=require("react-markdown"),t=require("rehype-raw"),a=require("../../CognitiveCompareConfig.js"),n=require("../../CognitiveComparehelpers.js"),u=require("../utils/processGuidelinesMarkdown.js");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var d=s(l),g=s(t);exports.default=function(l){var t=l.guidelinesData,s=l.deviationData,v=l.connectedSections,_=l.proposedSections,p=Array.from(v)[0],c=i.useMemo(function(){var r;if(null==p||!s)return{targetHighlights:[],labelColor:""};var i="";"number"==typeof p?i=(null===(r=_[p])||void 0===r?void 0:r.nodeId)||"":"string"==typeof p&&(i=p.includes(n.DEVIATION_BADGE_SEPARATOR)?p.split(n.DEVIATION_BADGE_SEPARATOR)[0]:p.split("::")[0].split(":")[0]);var o=s[i];if(!o)return{targetHighlights:[],labelColor:""};var l=[],t=o.evaluation_result||{},a="";return Object.values(t).forEach(function(r){var i,o,t,u,s;(null===(i=null==r?void 0:r.deviation_highlights)||void 0===i?void 0:i.rulebook_guidelines)&&(l=e.__spreadArray(e.__spreadArray([],l,!0),r.deviation_highlights.rulebook_guidelines,!0),a=(null===(t=null===(o=r.evaluation_outputs)||void 0===o?void 0:o.metadata)||void 0===t?void 0:t.label_color)?n.generateColorPalette(null===(s=null===(u=r.evaluation_outputs)||void 0===u?void 0:u.metadata)||void 0===s?void 0:s.label_color).bg:"")}),{targetHighlights:l.filter(Boolean),labelColor:a}},[p,s,_]),h=c.targetHighlights,f=c.labelColor,b=i.useMemo(function(){return u.processGuidelinesMarkdown({guidelinesData:t,targetHighlights:h,labelColor:f||"#FEF08A"})},[t,h,f]);return r.jsx(o.Box,e.__assign({sx:e.__assign(e.__assign({padding:"0px 12px",backgroundColor:"#FFFFFF",borderRadius:"8px"},a.SHARED_MARKDOWN_STYLES),{overflow:"visible"})},{children:r.jsx(d.default,e.__assign({rehypePlugins:[g.default]},{children:b}))}))};
2
2
  //# sourceMappingURL=GuidelinePanel.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var n=function(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")},t=function(n){return n.trim().replace(/\s+/g," ")};exports.processGuidelinesMarkdown=function(r){var a,i,e=r.guidelinesData,o=r.targetHighlights,c=void 0===o?[]:o,l=r.labelColor,u=void 0===l?"#FEF08A":l,s="";return"string"==typeof e?s=e:(null==e?void 0:e.learnings_data)&&"object"==typeof e.learnings_data?(a=e.learnings_data,i=new Set,s=Object.values(a).map(function(n){var r="string"==typeof(null==n?void 0:n.title)?n.title.trim():"",a="string"==typeof(null==n?void 0:n.instruction_prompt)?n.instruction_prompt.trim():"";if(!a)return"";var e="".concat(t(r),"\n").concat(t(a));return i.has(e)?"":(i.add(e),r?"# ".concat(r,"\n\n").concat(a):a)}).filter(Boolean).join("\n\n")):s=function(n){var t,r,a=null===(r=null===(t=null==n?void 0:n.data)||void 0===t?void 0:t.artifactData)||void 0===r?void 0:r.userStorySnapshot;if(!Array.isArray(a))return"";var i="";return a.forEach(function(n){(null==n?void 0:n.title)&&(i+="### ".concat(n.title,"\n\n")),(null==n?void 0:n.value)&&(i+="".concat(n.value,"\n\n")),Array.isArray(null==n?void 0:n.sub_features)&&n.sub_features.forEach(function(n){(null==n?void 0:n.title)&&(i+="#### ".concat(n.title,"\n\n")),(null==n?void 0:n.value)&&(i+="".concat(n.value,"\n\n"))})}),i.trim()}(e),function(r,a,i){var e=r,o=new Set,c=0;return a.forEach(function(r){if("string"==typeof r){var a=r.trim(),l=t(a);if(l&&!o.has(l)){o.add(l);var u=a.split(/\s+/).map(n).join("\\s+"),s=new RegExp(u).exec(e);if(s){var d='<mark id="guideline-target-'.concat(c,'" style="background-color: ').concat(i,'; border-radius: 3px; padding: 2px;">').concat(s[0],"</mark>");e="".concat(e.slice(0,s.index)).concat(d).concat(e.slice(s.index+s[0].length)),c+=1}}}}),e}(s,Array.isArray(c)?c:[],u||"#FEF08A")};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.processGuidelinesMarkdown=function(t){var a,n,e=t.guidelinesData,o=t.targetHighlights,i=void 0===o?[]:o,r=t.labelColor,l=void 0===r?"#FEF08A":r,c="";if((null==e?void 0:e.learnings_data)&&Object.keys(e.learnings_data).length>0){var u=Object.keys(e.learnings_data)[0],d=e.learnings_data[u];(null==d?void 0:d.instruction_prompt)&&(c=d.instruction_prompt)}else{((null===(n=null===(a=null==e?void 0:e.data)||void 0===a?void 0:a.artifactData)||void 0===n?void 0:n.userStorySnapshot)||[]).forEach(function(t){var a;t.title&&(c+="### ".concat(t.title,"\n\n")),t.value&&(c+="".concat(t.value,"\n\n")),null===(a=t.sub_features)||void 0===a||a.forEach(function(t){t.title&&(c+="#### ".concat(t.title,"\n\n")),t.value&&(c+="".concat(t.value,"\n\n"))})})}return i.forEach(function(t,a){var n=t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"),e=new RegExp("(".concat(n,")"),"g");c=c.replace(e,'<mark id="guideline-target-'.concat(a,'" style="background-color: ').concat(l,'; border-radius: 3px; padding: 2px;">$1</mark>'))}),c};
2
2
  //# sourceMappingURL=processGuidelinesMarkdown.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),o=require("react/jsx-runtime"),i=require("react"),n=require("@mui/material"),t=require("lucide-react"),r=require("./SectionAccordion.js"),a=require("./ThreeDotsLoader.js"),l=require("../CognitiveComparehelpers.js"),s=require("../CompareContext.js");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=d(i).default.memo(function(i){var d,c,u,p=i.section,x=i.idx,g=s.useCompareContext(),v=g.maintainRelativeOrder,f=g.existingSections;g.proposedSections;var m=g.connectedSections,b=g.expandedSections,h=g.displayConfig,S=g.treeData;g.deviationNumberRegistry;var B=g.getSectionCompareStyle;g.getBadgeRef;var _=g.getSectionRowRef,y=g.sectionLeftRefs,R=g.lhsBadgeRefs,j=g.openMoreFunctionsPopup,w=g.handleOpenSummaryPopup,C=g.handleCloseSummaryPopup,I=g.toggleSection;g.showDeviationBadges,g.renderSubSectionAccordion,g.isProposingFix,g.proposingFixNodeId,g.isRedlineFlow,g.isSideBySide,g.activeSideBySideSection,g.scrollSyncLocked,g.toggleScrollSyncLocked,g.summaryPopupAnchorEl,g.deviationNodeIdToView,g.deviationTargetParentId;var N=g.showDeviationNavigation;g.showOpenNodeRef,g.resolvedMarkdownStyles;var q=g.unifiedNumbering,P=!p.title&&!p.content;if(v&&P)return null;var k=p,D=B(x,"left"),T=v?!(null===(d=k.refIndexes)||void 0===d?void 0:d.length)||k.selfIndex<0:!f[x],A=m.has(x);null===(c=R.current[x])||void 0===c||c.current;var L=l.extractDeviationScore(k.evaluationResult,null==D?void 0:D.deviationLabel),z=q.leftNums.get(k.id);return o.jsx(n.Box,e.__assign({ref:_(x),sx:{mb:1,width:"100%"}},{children:o.jsx(n.Box,e.__assign({ref:y.current[x],sx:e.__assign({width:"100%",display:"flex",flexDirection:"column",minWidth:0},A&&{borderRadius:"6px",outline:"2px solid ".concat((null==D?void 0:D.badgeBorder)||"#6366F1"),outlineOffset:"1px"})},{children:o.jsxs(n.Box,e.__assign({sx:{position:"relative",width:"100%"}},{children:[o.jsx(r.default,{section:p,idx:x,columnKey:"left",colRef:_("left-accordion-".concat(x)),mb:0,parentNodeId:(null===(u=null==S?void 0:S.input_index_map)||void 0===u?void 0:u[0])||"",isExpanded:v?!!b["left-".concat(x)]:!!b[String(x)],onToggle:function(){C(),I(x,"left")},navigation:p.id?N[p.id]:null}),v&&D&&o.jsxs(n.Box,e.__assign({ref:R.current[x],onClick:function(e){var o,i,n,t=h.enableDeviationSchemaBackwardCompatibility?null!==(o=k.evaluationResult)&&void 0!==o?o:null:null!==(n=null===(i=k.evaluationResult)||void 0===i?void 0:i[0])&&void 0!==n?n:null;w(e,String(x),T,t)},sx:{position:"absolute",top:"18px",right:0,transform:"translateY(-50%) translateX(calc(100% + 8px))",display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",bgcolor:D.badgeBg,color:D.badgeText,border:"1px solid ".concat(D.badgeBorder),borderRadius:"12px",px:1.2,py:.3,fontWeight:600,cursor:"pointer",whiteSpace:"nowrap",zIndex:20,boxShadow:"0 1px 3px rgba(0,0,0,0.07)"}},{children:[o.jsxs(n.Box,e.__assign({component:"span",onClick:function(e){var o,i,n;e.stopPropagation();var t=h.enableDeviationSchemaBackwardCompatibility?null!==(o=k.evaluationResult)&&void 0!==o?o:null:null!==(n=null===(i=k.evaluationResult)||void 0===i?void 0:i[0])&&void 0!==n?n:null;w(e,String(x),T,t)},sx:{display:"inline-flex",alignItems:"center",gap:"4px",px:.2,cursor:T?"default":"pointer",borderRight:"1px solid ".concat(D.badgeBorder),"&:hover":T?{}:{bgColor:"".concat(D.badgeBorder,"22")}}},{children:[null!=z&&o.jsx(n.Box,e.__assign({component:"span",sx:{fontSize:"11px",fontWeight:700,pr:.5,borderRight:"1px solid ".concat(D.badgeBorder)}},{children:z})),o.jsx(n.Box,e.__assign({component:"span",sx:{fontSize:"11px",px:.25}},{children:!h.isLoading||null!=k.evaluationResult&&void 0!==k.evaluationResult?"N/A"===L||"NA"===L?"N/A":0==L||null==L?"Same":"".concat(L):o.jsx(a.default,{color:D.badgeText})}))]})),o.jsx(n.Box,e.__assign({component:"span",onClick:function(e){var o;e.stopPropagation();var i=null===(o=k.refIndexes)||void 0===o?void 0:o[0],n=v?f.find(function(e){return e.selfIndex===i})||{title:"",content:""}:f[x]||{title:"",content:""};j(e,p,T,n,x,D)},sx:{display:"inline-flex",alignItems:"center",px:.2,cursor:"pointer","&:hover":{bgcolor:"".concat(D.badgeBorder,"22")}}},{children:o.jsx(t.EllipsisVertical,{size:11,color:D.badgeText})}))]}))]}))}))}),"left-row-".concat(x))});exports.default=c;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),o=require("react/jsx-runtime"),i=require("react"),n=require("@mui/material"),t=require("lucide-react"),r=require("./SectionAccordion.js"),a=require("./ThreeDotsLoader.js"),l=require("../CognitiveComparehelpers.js"),s=require("../CompareContext.js");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=d(i).default.memo(function(i){var d,c,u,p=i.section,x=i.idx,g=s.useCompareContext(),v=g.maintainRelativeOrder,f=g.existingSections;g.proposedSections;var m=g.connectedSections,b=g.expandedSections,h=g.displayConfig,S=g.treeData;g.deviationNumberRegistry;var B=g.getSectionCompareStyle;g.getBadgeRef;var _=g.getSectionRowRef,y=g.sectionLeftRefs,R=g.lhsBadgeRefs,j=g.openMoreFunctionsPopup,w=g.handleOpenSummaryPopup,C=g.handleCloseSummaryPopup,I=g.toggleSection;g.showDeviationBadges,g.renderSubSectionAccordion,g.isProposingFix,g.proposingFixNodeId,g.isRedlineFlow,g.isSideBySide,g.activeSideBySideSection,g.scrollSyncLocked,g.toggleScrollSyncLocked,g.summaryPopupAnchorEl,g.deviationNodeIdToView,g.deviationTargetParentId;var N=g.showDeviationNavigation;g.showOpenNodeRef,g.resolvedMarkdownStyles;var q=g.unifiedNumbering,P=!p.title&&!p.content;if(v&&P)return null;var k=p,D=B(x,"left"),T=v?!(null===(d=k.refIndexes)||void 0===d?void 0:d.length)||k.selfIndex<0:!f[x],A=m.has(x);null===(c=R.current[x])||void 0===c||c.current;var L=l.extractDeviationScore(k.evaluationResult,null==D?void 0:D.deviationLabel),z=q.leftNums.get(k.id);return o.jsx(n.Box,e.__assign({ref:_(x),sx:{mb:1,width:"100%"}},{children:o.jsx(n.Box,e.__assign({ref:y.current[x],sx:e.__assign({width:"100%",display:"flex",flexDirection:"column",minWidth:0},A&&{borderRadius:"6px",outline:"2px solid ".concat((null==D?void 0:D.badgeBorder)||"#6366F1"),outlineOffset:"1px"})},{children:o.jsxs(n.Box,e.__assign({sx:{position:"relative",width:"100%"}},{children:[o.jsx(r.default,{section:p,idx:x,columnKey:"left",colRef:_("left-accordion-".concat(x)),mb:0,parentNodeId:(null===(u=null==S?void 0:S.input_index_map)||void 0===u?void 0:u[0])||"",isExpanded:v?!!b["left-".concat(x)]:!!b[String(x)],onToggle:function(){C(),I(x,"left")},navigation:p.id?N[p.id]:null}),v&&D&&o.jsxs(n.Box,e.__assign({ref:R.current[x],onClick:function(e){var o,i,n,t=h.enableDeviationSchemaBackwardCompatibility?null!==(o=k.evaluationResult)&&void 0!==o?o:null:null!==(n=null===(i=k.evaluationResult)||void 0===i?void 0:i[0])&&void 0!==n?n:null;w(e,String(x),T,t)},sx:{position:"absolute",top:"18px",right:0,transform:"translateY(-50%) translateX(calc(100% + 8px))",display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",bgcolor:D.badgeBg,color:D.badgeText,border:"1px solid ".concat(D.badgeBorder),borderRadius:"12px",px:1.2,py:.3,fontWeight:600,cursor:"pointer",whiteSpace:"nowrap",zIndex:20,boxShadow:"0 1px 3px rgba(0,0,0,0.07)"}},{children:[o.jsxs(n.Box,e.__assign({component:"span",onClick:function(e){var o,i,n;e.stopPropagation();var t=h.enableDeviationSchemaBackwardCompatibility?null!==(o=k.evaluationResult)&&void 0!==o?o:null:null!==(n=null===(i=k.evaluationResult)||void 0===i?void 0:i[0])&&void 0!==n?n:null;w(e,String(x),T,t)},sx:{display:"inline-flex",alignItems:"center",gap:"4px",px:.2,cursor:T?"default":"pointer",borderRight:"1px solid ".concat(D.badgeBorder),"&:hover":T?{}:{bgColor:"".concat(D.badgeBorder,"22")}}},{children:[null!=z&&o.jsx(n.Box,e.__assign({component:"span",sx:{fontSize:"11px",fontWeight:700,pr:.5,borderRight:"1px solid ".concat(D.badgeBorder)}},{children:z})),o.jsx(n.Box,e.__assign({component:"span",sx:{fontSize:"11px",px:.25}},{children:!h.isLoading||null!=k.evaluationResult&&void 0!==k.evaluationResult?"N/A"===L||"NA"===L?"N/A":0==L||null==L?"Same":"".concat(L):o.jsx(a.default,{color:D.badgeText})}))]})),o.jsx(n.Box,e.__assign({component:"span",onClick:function(e){e.stopPropagation();var o=v?f.find(function(e){var o;return null===(o=k.refIndexes)||void 0===o?void 0:o.includes(e.selfIndex)})||{title:"",content:""}:f[x]||{title:"",content:""};j(e,p,T,o,x,D)},sx:{display:"inline-flex",alignItems:"center",px:.2,cursor:"pointer","&:hover":{bgcolor:"".concat(D.badgeBorder,"22")}}},{children:o.jsx(t.EllipsisVertical,{size:11,color:D.badgeText})}))]}))]}))}))}),"left-row-".concat(x))});exports.default=c;
2
2
  //# sourceMappingURL=LHSSectionRow.js.map