@e-llm-studio/citation 0.0.251 → 0.0.253

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 (271) hide show
  1. package/dist/cjs/features/CognitiveCompare/CitationAnchor.js +1 -1
  2. package/dist/cjs/features/CognitiveCompare/CitationAnchor.js.map +1 -1
  3. package/dist/cjs/features/CognitiveCompare/CitationRenderer.js +1 -1
  4. package/dist/cjs/features/CognitiveCompare/CitationRenderer.js.map +1 -1
  5. package/dist/cjs/features/CognitiveCompare/CitationRendererInner.js +2 -0
  6. package/dist/cjs/features/CognitiveCompare/CitationRendererInner.js.map +1 -0
  7. package/dist/cjs/features/CognitiveCompare/CognitiveCompare.js +1 -1
  8. package/dist/cjs/features/CognitiveCompare/CognitiveCompare.js.map +1 -1
  9. package/dist/cjs/features/CognitiveCompare/CognitiveCompareConstants.js +1 -1
  10. package/dist/cjs/features/CognitiveCompare/CognitiveCompareConstants.js.map +1 -1
  11. package/dist/cjs/features/CognitiveCompare/CognitiveComparehelpers.js +1 -1
  12. package/dist/cjs/features/CognitiveCompare/CognitiveComparehelpers.js.map +1 -1
  13. package/dist/cjs/features/CognitiveCompare/CognitivePopup.js +1 -1
  14. package/dist/cjs/features/CognitiveCompare/CognitivePopup.js.map +1 -1
  15. package/dist/cjs/features/CognitiveCompare/CompareContext.js +1 -1
  16. package/dist/cjs/features/CognitiveCompare/CompareContext.js.map +1 -1
  17. package/dist/cjs/features/CognitiveCompare/GptWebCitationPanel.js +2 -0
  18. package/dist/cjs/features/CognitiveCompare/GptWebCitationPanel.js.map +1 -0
  19. package/dist/cjs/features/CognitiveCompare/Guidelines/components/GuidelinePanel.js +1 -1
  20. package/dist/cjs/features/CognitiveCompare/Guidelines/components/GuidelinePanel.js.map +1 -1
  21. package/dist/cjs/features/CognitiveCompare/Guidelines/components/WebGptPanel.js +1 -1
  22. package/dist/cjs/features/CognitiveCompare/Guidelines/components/WebGptPanel.js.map +1 -1
  23. package/dist/cjs/features/CognitiveCompare/Guidelines/utils/guidelineTargets.js +2 -0
  24. package/dist/cjs/features/CognitiveCompare/Guidelines/utils/guidelineTargets.js.map +1 -0
  25. package/dist/cjs/features/CognitiveCompare/Guidelines/utils/hasGptCitationObjects.js +2 -0
  26. package/dist/cjs/features/CognitiveCompare/Guidelines/utils/hasGptCitationObjects.js.map +1 -0
  27. package/dist/cjs/features/CognitiveCompare/Guidelines/utils/processGuidelinesMarkdown.js +1 -1
  28. package/dist/cjs/features/CognitiveCompare/Guidelines/utils/processGuidelinesMarkdown.js.map +1 -1
  29. package/dist/cjs/features/CognitiveCompare/Guidelines/utils/resolveGuidelineSelection.js +2 -0
  30. package/dist/cjs/features/CognitiveCompare/Guidelines/utils/resolveGuidelineSelection.js.map +1 -0
  31. package/dist/cjs/features/CognitiveCompare/components/GuidelineSkeletonLoader.js +2 -0
  32. package/dist/cjs/features/CognitiveCompare/components/GuidelineSkeletonLoader.js.map +1 -0
  33. package/dist/cjs/features/CognitiveCompare/components/LHSSectionRow.js +1 -1
  34. package/dist/cjs/features/CognitiveCompare/components/LHSSectionRow.js.map +1 -1
  35. package/dist/cjs/features/CognitiveCompare/components/RHSSectionRow.js +1 -1
  36. package/dist/cjs/features/CognitiveCompare/components/RHSSectionRow.js.map +1 -1
  37. package/dist/cjs/features/CognitiveCompare/components/SectionAccordion.js +1 -1
  38. package/dist/cjs/features/CognitiveCompare/components/SectionAccordion.js.map +1 -1
  39. package/dist/cjs/features/CognitiveCompare/components/SubSectionAccordion.js +1 -1
  40. package/dist/cjs/features/CognitiveCompare/components/SubSectionAccordion.js.map +1 -1
  41. package/dist/cjs/features/CognitiveCompare/components/SvgConnectors.js +1 -1
  42. package/dist/cjs/features/CognitiveCompare/components/SvgConnectors.js.map +1 -1
  43. package/dist/cjs/features/CognitiveCompare/hooks/memoizedMarkdown.js +1 -1
  44. package/dist/cjs/features/CognitiveCompare/hooks/memoizedMarkdown.js.map +1 -1
  45. package/dist/cjs/features/CognitiveCompare/hooks/useCompareData.js +1 -1
  46. package/dist/cjs/features/CognitiveCompare/hooks/useCompareData.js.map +1 -1
  47. package/dist/cjs/features/CognitiveCompare/hooks/useLinesCalculator.js +1 -1
  48. package/dist/cjs/features/CognitiveCompare/hooks/useLinesCalculator.js.map +1 -1
  49. package/dist/cjs/features/CognitiveCompare/hooks/useOnDemandCitationCache.js +2 -0
  50. package/dist/cjs/features/CognitiveCompare/hooks/useOnDemandCitationCache.js.map +1 -0
  51. package/dist/cjs/features/CognitiveCompare/hooks/useSideBySide.js +1 -1
  52. package/dist/cjs/features/CognitiveCompare/hooks/useSideBySide.js.map +1 -1
  53. package/dist/cjs/features/CognitiveCompare/onDemandCitations/cacheKey.js +2 -0
  54. package/dist/cjs/features/CognitiveCompare/onDemandCitations/cacheKey.js.map +1 -0
  55. package/dist/cjs/features/CognitiveCompare/onDemandCitations/contextBuilder.js +2 -0
  56. package/dist/cjs/features/CognitiveCompare/onDemandCitations/contextBuilder.js.map +1 -0
  57. package/dist/cjs/features/CognitiveCompare/onDemandCitations/href.js +2 -0
  58. package/dist/cjs/features/CognitiveCompare/onDemandCitations/href.js.map +1 -0
  59. package/dist/cjs/features/CognitiveCompare/onDemandCitations/payload.js +2 -0
  60. package/dist/cjs/features/CognitiveCompare/onDemandCitations/payload.js.map +1 -0
  61. package/dist/cjs/features/CognitiveCompare/onDemandCitations/response.js +2 -0
  62. package/dist/cjs/features/CognitiveCompare/onDemandCitations/response.js.map +1 -0
  63. package/dist/cjs/features/CognitiveCompare/utils/normalizeCompactedGfmTables.js +2 -0
  64. package/dist/cjs/features/CognitiveCompare/utils/normalizeCompactedGfmTables.js.map +1 -0
  65. package/dist/cjs/features/CognitiveCompare/utils/normalizeInlineMarkdown.js +2 -0
  66. package/dist/cjs/features/CognitiveCompare/utils/normalizeInlineMarkdown.js.map +1 -0
  67. package/dist/cjs/features/CognitiveCompare/utils/normalizeRedlineMarkdown.js +2 -0
  68. package/dist/cjs/features/CognitiveCompare/utils/normalizeRedlineMarkdown.js.map +1 -0
  69. package/dist/cjs/features/PdfViewer/PdfContainer.js +1 -1
  70. package/dist/cjs/features/PdfViewer/PdfContainer.js.map +1 -1
  71. package/dist/cjs/features/PdfViewer/PdfViewer.js +1 -1
  72. package/dist/cjs/features/PdfViewer/PdfViewer.js.map +1 -1
  73. package/dist/cjs/features/SegmentReviewComponents/ApprovalDescriptionBanner.js +2 -0
  74. package/dist/cjs/features/SegmentReviewComponents/ApprovalDescriptionBanner.js.map +1 -0
  75. package/dist/cjs/features/SegmentReviewComponents/BoundaryCard.js +1 -1
  76. package/dist/cjs/features/SegmentReviewComponents/BoundaryCard.js.map +1 -1
  77. package/dist/cjs/features/SegmentReviewComponents/RevertCard.js +1 -1
  78. package/dist/cjs/features/SegmentReviewComponents/RevertCard.js.map +1 -1
  79. package/dist/cjs/features/SegmentReviewComponents/SaveAsLearningCard.js +2 -0
  80. package/dist/cjs/features/SegmentReviewComponents/SaveAsLearningCard.js.map +1 -0
  81. package/dist/cjs/features/SegmentReviewComponents/SegmentReviewPdfWrapper.js +1 -1
  82. package/dist/cjs/features/SegmentReviewComponents/SegmentReviewPdfWrapper.js.map +1 -1
  83. package/dist/cjs/hooks/useOnDemandCitationFetch.js +1 -1
  84. package/dist/cjs/hooks/useOnDemandCitationFetch.js.map +1 -1
  85. package/dist/cjs/service/onDemandApi.js +1 -1
  86. package/dist/cjs/service/onDemandApi.js.map +1 -1
  87. package/dist/features/CognitiveCompare/CitationAnchor.js +1 -1
  88. package/dist/features/CognitiveCompare/CitationAnchor.js.map +1 -1
  89. package/dist/features/CognitiveCompare/CitationRenderer.js +1 -1
  90. package/dist/features/CognitiveCompare/CitationRenderer.js.map +1 -1
  91. package/dist/features/CognitiveCompare/CitationRendererInner.js +2 -0
  92. package/dist/features/CognitiveCompare/CitationRendererInner.js.map +1 -0
  93. package/dist/features/CognitiveCompare/CognitiveCompare.js +1 -1
  94. package/dist/features/CognitiveCompare/CognitiveCompare.js.map +1 -1
  95. package/dist/features/CognitiveCompare/CognitiveCompareConstants.js +1 -1
  96. package/dist/features/CognitiveCompare/CognitiveCompareConstants.js.map +1 -1
  97. package/dist/features/CognitiveCompare/CognitiveComparehelpers.js +1 -1
  98. package/dist/features/CognitiveCompare/CognitiveComparehelpers.js.map +1 -1
  99. package/dist/features/CognitiveCompare/CognitivePopup.js +1 -1
  100. package/dist/features/CognitiveCompare/CognitivePopup.js.map +1 -1
  101. package/dist/features/CognitiveCompare/CompareContext.js +1 -1
  102. package/dist/features/CognitiveCompare/CompareContext.js.map +1 -1
  103. package/dist/features/CognitiveCompare/GptWebCitationPanel.js +2 -0
  104. package/dist/features/CognitiveCompare/GptWebCitationPanel.js.map +1 -0
  105. package/dist/features/CognitiveCompare/Guidelines/components/GuidelinePanel.js +1 -1
  106. package/dist/features/CognitiveCompare/Guidelines/components/GuidelinePanel.js.map +1 -1
  107. package/dist/features/CognitiveCompare/Guidelines/components/WebGptPanel.js +1 -1
  108. package/dist/features/CognitiveCompare/Guidelines/components/WebGptPanel.js.map +1 -1
  109. package/dist/features/CognitiveCompare/Guidelines/utils/guidelineTargets.js +2 -0
  110. package/dist/features/CognitiveCompare/Guidelines/utils/guidelineTargets.js.map +1 -0
  111. package/dist/features/CognitiveCompare/Guidelines/utils/hasGptCitationObjects.js +2 -0
  112. package/dist/features/CognitiveCompare/Guidelines/utils/hasGptCitationObjects.js.map +1 -0
  113. package/dist/features/CognitiveCompare/Guidelines/utils/processGuidelinesMarkdown.js +1 -1
  114. package/dist/features/CognitiveCompare/Guidelines/utils/processGuidelinesMarkdown.js.map +1 -1
  115. package/dist/features/CognitiveCompare/Guidelines/utils/resolveGuidelineSelection.js +2 -0
  116. package/dist/features/CognitiveCompare/Guidelines/utils/resolveGuidelineSelection.js.map +1 -0
  117. package/dist/features/CognitiveCompare/components/GuidelineSkeletonLoader.js +2 -0
  118. package/dist/features/CognitiveCompare/components/GuidelineSkeletonLoader.js.map +1 -0
  119. package/dist/features/CognitiveCompare/components/LHSSectionRow.js +1 -1
  120. package/dist/features/CognitiveCompare/components/LHSSectionRow.js.map +1 -1
  121. package/dist/features/CognitiveCompare/components/RHSSectionRow.js +1 -1
  122. package/dist/features/CognitiveCompare/components/RHSSectionRow.js.map +1 -1
  123. package/dist/features/CognitiveCompare/components/SectionAccordion.js +1 -1
  124. package/dist/features/CognitiveCompare/components/SectionAccordion.js.map +1 -1
  125. package/dist/features/CognitiveCompare/components/SubSectionAccordion.js +1 -1
  126. package/dist/features/CognitiveCompare/components/SubSectionAccordion.js.map +1 -1
  127. package/dist/features/CognitiveCompare/components/SvgConnectors.js +1 -1
  128. package/dist/features/CognitiveCompare/components/SvgConnectors.js.map +1 -1
  129. package/dist/features/CognitiveCompare/hooks/memoizedMarkdown.js +1 -1
  130. package/dist/features/CognitiveCompare/hooks/memoizedMarkdown.js.map +1 -1
  131. package/dist/features/CognitiveCompare/hooks/useCompareData.js +1 -1
  132. package/dist/features/CognitiveCompare/hooks/useCompareData.js.map +1 -1
  133. package/dist/features/CognitiveCompare/hooks/useLinesCalculator.js +1 -1
  134. package/dist/features/CognitiveCompare/hooks/useLinesCalculator.js.map +1 -1
  135. package/dist/features/CognitiveCompare/hooks/useOnDemandCitationCache.js +2 -0
  136. package/dist/features/CognitiveCompare/hooks/useOnDemandCitationCache.js.map +1 -0
  137. package/dist/features/CognitiveCompare/hooks/useSideBySide.js +1 -1
  138. package/dist/features/CognitiveCompare/hooks/useSideBySide.js.map +1 -1
  139. package/dist/features/CognitiveCompare/onDemandCitations/cacheKey.js +2 -0
  140. package/dist/features/CognitiveCompare/onDemandCitations/cacheKey.js.map +1 -0
  141. package/dist/features/CognitiveCompare/onDemandCitations/contextBuilder.js +2 -0
  142. package/dist/features/CognitiveCompare/onDemandCitations/contextBuilder.js.map +1 -0
  143. package/dist/features/CognitiveCompare/onDemandCitations/href.js +2 -0
  144. package/dist/features/CognitiveCompare/onDemandCitations/href.js.map +1 -0
  145. package/dist/features/CognitiveCompare/onDemandCitations/payload.js +2 -0
  146. package/dist/features/CognitiveCompare/onDemandCitations/payload.js.map +1 -0
  147. package/dist/features/CognitiveCompare/onDemandCitations/response.js +2 -0
  148. package/dist/features/CognitiveCompare/onDemandCitations/response.js.map +1 -0
  149. package/dist/features/CognitiveCompare/utils/normalizeCompactedGfmTables.js +2 -0
  150. package/dist/features/CognitiveCompare/utils/normalizeCompactedGfmTables.js.map +1 -0
  151. package/dist/features/CognitiveCompare/utils/normalizeInlineMarkdown.js +2 -0
  152. package/dist/features/CognitiveCompare/utils/normalizeInlineMarkdown.js.map +1 -0
  153. package/dist/features/CognitiveCompare/utils/normalizeRedlineMarkdown.js +2 -0
  154. package/dist/features/CognitiveCompare/utils/normalizeRedlineMarkdown.js.map +1 -0
  155. package/dist/features/PdfViewer/PdfContainer.js +1 -1
  156. package/dist/features/PdfViewer/PdfContainer.js.map +1 -1
  157. package/dist/features/PdfViewer/PdfViewer.js +1 -1
  158. package/dist/features/PdfViewer/PdfViewer.js.map +1 -1
  159. package/dist/features/SegmentReviewComponents/ApprovalDescriptionBanner.js +2 -0
  160. package/dist/features/SegmentReviewComponents/ApprovalDescriptionBanner.js.map +1 -0
  161. package/dist/features/SegmentReviewComponents/BoundaryCard.js +1 -1
  162. package/dist/features/SegmentReviewComponents/BoundaryCard.js.map +1 -1
  163. package/dist/features/SegmentReviewComponents/RevertCard.js +1 -1
  164. package/dist/features/SegmentReviewComponents/RevertCard.js.map +1 -1
  165. package/dist/features/SegmentReviewComponents/SaveAsLearningCard.js +2 -0
  166. package/dist/features/SegmentReviewComponents/SaveAsLearningCard.js.map +1 -0
  167. package/dist/features/SegmentReviewComponents/SegmentReviewPdfWrapper.js +1 -1
  168. package/dist/features/SegmentReviewComponents/SegmentReviewPdfWrapper.js.map +1 -1
  169. package/dist/hooks/useOnDemandCitationFetch.js +1 -1
  170. package/dist/hooks/useOnDemandCitationFetch.js.map +1 -1
  171. package/dist/service/onDemandApi.js +1 -1
  172. package/dist/service/onDemandApi.js.map +1 -1
  173. package/dist/types/features/CognitiveCompare/CitationAnchor.d.ts +2 -0
  174. package/dist/types/features/CognitiveCompare/CitationAnchor.d.ts.map +1 -1
  175. package/dist/types/features/CognitiveCompare/CitationRenderer.d.ts +8 -1
  176. package/dist/types/features/CognitiveCompare/CitationRenderer.d.ts.map +1 -1
  177. package/dist/types/features/CognitiveCompare/CitationRendererInner.d.ts +13 -0
  178. package/dist/types/features/CognitiveCompare/CitationRendererInner.d.ts.map +1 -0
  179. package/dist/types/features/CognitiveCompare/CognitiveCompare.d.ts +1 -1
  180. package/dist/types/features/CognitiveCompare/CognitiveCompare.d.ts.map +1 -1
  181. package/dist/types/features/CognitiveCompare/CognitiveCompareConstants.d.ts +1 -1
  182. package/dist/types/features/CognitiveCompare/CognitiveCompareConstants.d.ts.map +1 -1
  183. package/dist/types/features/CognitiveCompare/CognitiveCompareTypes.d.ts +14 -1
  184. package/dist/types/features/CognitiveCompare/CognitiveCompareTypes.d.ts.map +1 -1
  185. package/dist/types/features/CognitiveCompare/CognitiveComparehelpers.d.ts +12 -0
  186. package/dist/types/features/CognitiveCompare/CognitiveComparehelpers.d.ts.map +1 -1
  187. package/dist/types/features/CognitiveCompare/CognitivePopup.d.ts.map +1 -1
  188. package/dist/types/features/CognitiveCompare/CompareContext.d.ts +10 -1
  189. package/dist/types/features/CognitiveCompare/CompareContext.d.ts.map +1 -1
  190. package/dist/types/features/CognitiveCompare/GptWebCitationPanel.d.ts +7 -0
  191. package/dist/types/features/CognitiveCompare/GptWebCitationPanel.d.ts.map +1 -0
  192. package/dist/types/features/CognitiveCompare/Guidelines/components/GuidelinePanel.d.ts.map +1 -1
  193. package/dist/types/features/CognitiveCompare/Guidelines/components/WebGptPanel.d.ts.map +1 -1
  194. package/dist/types/features/CognitiveCompare/Guidelines/utils/guidelineTargets.d.ts +3 -0
  195. package/dist/types/features/CognitiveCompare/Guidelines/utils/guidelineTargets.d.ts.map +1 -0
  196. package/dist/types/features/CognitiveCompare/Guidelines/utils/hasGptCitationObjects.d.ts +3 -0
  197. package/dist/types/features/CognitiveCompare/Guidelines/utils/hasGptCitationObjects.d.ts.map +1 -0
  198. package/dist/types/features/CognitiveCompare/Guidelines/utils/processGuidelinesMarkdown.d.ts +14 -1
  199. package/dist/types/features/CognitiveCompare/Guidelines/utils/processGuidelinesMarkdown.d.ts.map +1 -1
  200. package/dist/types/features/CognitiveCompare/Guidelines/utils/resolveGuidelineSelection.d.ts +19 -0
  201. package/dist/types/features/CognitiveCompare/Guidelines/utils/resolveGuidelineSelection.d.ts.map +1 -0
  202. package/dist/types/features/CognitiveCompare/components/GuidelineSkeletonLoader.d.ts +8 -0
  203. package/dist/types/features/CognitiveCompare/components/GuidelineSkeletonLoader.d.ts.map +1 -0
  204. package/dist/types/features/CognitiveCompare/components/LHSSectionRow.d.ts.map +1 -1
  205. package/dist/types/features/CognitiveCompare/components/RHSSectionRow.d.ts.map +1 -1
  206. package/dist/types/features/CognitiveCompare/components/SectionAccordion.d.ts.map +1 -1
  207. package/dist/types/features/CognitiveCompare/components/SubSectionAccordion.d.ts.map +1 -1
  208. package/dist/types/features/CognitiveCompare/components/SvgConnectors.d.ts +3 -2
  209. package/dist/types/features/CognitiveCompare/components/SvgConnectors.d.ts.map +1 -1
  210. package/dist/types/features/CognitiveCompare/hooks/memoizedMarkdown.d.ts +2 -1
  211. package/dist/types/features/CognitiveCompare/hooks/memoizedMarkdown.d.ts.map +1 -1
  212. package/dist/types/features/CognitiveCompare/hooks/useCompareData.d.ts +1 -1
  213. package/dist/types/features/CognitiveCompare/hooks/useCompareData.d.ts.map +1 -1
  214. package/dist/types/features/CognitiveCompare/hooks/useLinesCalculator.d.ts.map +1 -1
  215. package/dist/types/features/CognitiveCompare/hooks/useOnDemandCitationCache.d.ts +10 -0
  216. package/dist/types/features/CognitiveCompare/hooks/useOnDemandCitationCache.d.ts.map +1 -0
  217. package/dist/types/features/CognitiveCompare/hooks/useSideBySide.d.ts.map +1 -1
  218. package/dist/types/features/CognitiveCompare/onDemandCitations/cacheKey.d.ts +3 -0
  219. package/dist/types/features/CognitiveCompare/onDemandCitations/cacheKey.d.ts.map +1 -0
  220. package/dist/types/features/CognitiveCompare/onDemandCitations/contextBuilder.d.ts +16 -0
  221. package/dist/types/features/CognitiveCompare/onDemandCitations/contextBuilder.d.ts.map +1 -0
  222. package/dist/types/features/CognitiveCompare/onDemandCitations/href.d.ts +6 -0
  223. package/dist/types/features/CognitiveCompare/onDemandCitations/href.d.ts.map +1 -0
  224. package/dist/types/features/CognitiveCompare/onDemandCitations/index.d.ts +7 -0
  225. package/dist/types/features/CognitiveCompare/onDemandCitations/index.d.ts.map +1 -0
  226. package/dist/types/features/CognitiveCompare/onDemandCitations/payload.d.ts +4 -0
  227. package/dist/types/features/CognitiveCompare/onDemandCitations/payload.d.ts.map +1 -0
  228. package/dist/types/features/CognitiveCompare/onDemandCitations/response.d.ts +3 -0
  229. package/dist/types/features/CognitiveCompare/onDemandCitations/response.d.ts.map +1 -0
  230. package/dist/types/features/CognitiveCompare/onDemandCitations/types.d.ts +134 -0
  231. package/dist/types/features/CognitiveCompare/onDemandCitations/types.d.ts.map +1 -0
  232. package/dist/types/features/CognitiveCompare/utils/normalizeCompactedGfmTables.d.ts +7 -0
  233. package/dist/types/features/CognitiveCompare/utils/normalizeCompactedGfmTables.d.ts.map +1 -0
  234. package/dist/types/features/CognitiveCompare/utils/normalizeInlineMarkdown.d.ts +6 -0
  235. package/dist/types/features/CognitiveCompare/utils/normalizeInlineMarkdown.d.ts.map +1 -0
  236. package/dist/types/features/CognitiveCompare/utils/normalizeRedlineMarkdown.d.ts +6 -0
  237. package/dist/types/features/CognitiveCompare/utils/normalizeRedlineMarkdown.d.ts.map +1 -0
  238. package/dist/types/features/PdfViewer/PdfContainer.d.ts +3 -2
  239. package/dist/types/features/PdfViewer/PdfContainer.d.ts.map +1 -1
  240. package/dist/types/features/PdfViewer/PdfViewer.d.ts +3 -2
  241. package/dist/types/features/PdfViewer/PdfViewer.d.ts.map +1 -1
  242. package/dist/types/features/SegmentReviewComponents/ApprovalDescriptionBanner.d.ts +11 -0
  243. package/dist/types/features/SegmentReviewComponents/ApprovalDescriptionBanner.d.ts.map +1 -0
  244. package/dist/types/features/SegmentReviewComponents/BoundaryCard.d.ts.map +1 -1
  245. package/dist/types/features/SegmentReviewComponents/RevertCard.d.ts +9 -1
  246. package/dist/types/features/SegmentReviewComponents/RevertCard.d.ts.map +1 -1
  247. package/dist/types/features/SegmentReviewComponents/SaveAsLearningCard.d.ts +15 -0
  248. package/dist/types/features/SegmentReviewComponents/SaveAsLearningCard.d.ts.map +1 -0
  249. package/dist/types/features/SegmentReviewComponents/SegmentReviewPdfWrapper.d.ts +14 -1
  250. package/dist/types/features/SegmentReviewComponents/SegmentReviewPdfWrapper.d.ts.map +1 -1
  251. package/dist/types/hooks/useOnDemandCitationFetch.d.ts.map +1 -1
  252. package/dist/types/service/onDemandApi.d.ts.map +1 -1
  253. package/package.json +1 -1
  254. package/dist/cjs/features/Bookemon/BookemonStyles.js +0 -2
  255. package/dist/cjs/features/Bookemon/BookemonStyles.js.map +0 -1
  256. package/dist/cjs/lib/ui/icons.js +0 -2
  257. package/dist/cjs/lib/ui/icons.js.map +0 -1
  258. package/dist/cjs/lib/ui/materialCompat.js +0 -2
  259. package/dist/cjs/lib/ui/materialCompat.js.map +0 -1
  260. package/dist/features/Bookemon/BookemonStyles.js +0 -2
  261. package/dist/features/Bookemon/BookemonStyles.js.map +0 -1
  262. package/dist/lib/ui/icons.js +0 -2
  263. package/dist/lib/ui/icons.js.map +0 -1
  264. package/dist/lib/ui/materialCompat.js +0 -2
  265. package/dist/lib/ui/materialCompat.js.map +0 -1
  266. package/dist/types/features/Bookemon/BookemonStyles.d.ts +0 -6
  267. package/dist/types/features/Bookemon/BookemonStyles.d.ts.map +0 -1
  268. package/dist/types/lib/ui/icons.d.ts +0 -46
  269. package/dist/types/lib/ui/icons.d.ts.map +0 -1
  270. package/dist/types/lib/ui/materialCompat.d.ts +0 -117
  271. package/dist/types/lib/ui/materialCompat.d.ts.map +0 -1
@@ -1,2 +1,2 @@
1
- import{jsx as e,jsxs as t}from"react/jsx-runtime";import{useState as n,useRef as i,useMemo as o,useEffect as r,useCallback as s}from"react";import{Box as l,Snackbar as c,Alert as a,Tooltip as u,Typography as d,Tabs as p,Tab as f}from"@mui/material";import{ChevronDown as g}from"lucide-react";import{ButtonCognitiveIcon as h}from"../../assests/svg/ButtonCognitiveIcon.js";import m from"./OverlayComponent.js";import{safeStringify as S,extractDeviationScore as v,generateColorPalette as x,findKeyPathByNodeId as R,DEVIATION_BADGE_SEPARATOR as y,hasMeaningfulRedlineTags as b,scrollAndHighlightClause as C,scrollAndWait as w,waitForScrollIdle as B}from"./CognitiveComparehelpers.js";import{SHARED_MARKDOWN_STYLES as _,DEFAULT_FIELD_CONFIG as I,DEFAULT_COMPARISON_CONFIG as F}from"./CognitiveCompareConfig.js";export{SHARED_MARKDOWN_STYLES}from"./CognitiveCompareConfig.js";import{DEFAULT_DEVIAION_COLOR as T,EMPTY_SUMMARY_POPUP_STATE as E,DEFAULT_COMPONENT_HEADER_TEXT as A}from"./CognitiveCompareConstants.js";import D from"./CognitivePopup.js";import k from"./MoreFunctionsPopup.js";import P from"./LoaderComponent.js";import O from"./components/ThreeDotsLoader.js";import{useCognitiveTreeData as L}from"./hooks/useCompareData.js";import{useComparePopups as $}from"./hooks/useComparePopups.js";import{useSectionRefs as j}from"./hooks/useSectionRefs.js";import{useAccordionState as N}from"./hooks/useAccordionState.js";import{useDeviationNavigation as M}from"./hooks/useDeviationNavigation.js";import H from"./components/CompareHeader.js";import z from"./components/SubSectionAccordion.js";import W from"./components/LHSSectionRow.js";import q from"./components/RHSSectionRow.js";import G from"./components/CognitiveSummaryPopup.js";import{CompareContextProvider as V}from"./CompareContext.js";import{useStyleHelpers as K}from"./hooks/useStyles.js";import{useResizeHandler as J}from"./hooks/useResizeHandler.js";import{useLinesCalculator as Y}from"./hooks/useLinesCalculator.js";import{useSideBySide as X}from"./hooks/useSideBySide.js";import U from"./components/SvgConnectors.js";import Q from"./Guidelines/components/GuidelinePanel.js";import Z from"./Guidelines/components/WebGptPanel.js";const ee=({componentHeaderText:ee=A,treeData:te,comparisonConfig:ne,leftColumnTitleText:ie,rightColumnTitleText:oe,markdownStyles:re,resetTrigger:se,displayConfig:le={isHeaderVisible:!0,isToggleVisible:!0,maintainRelativeOrder:!1,isLoading:!0,showDeviationBadges:!1,enableDeviationSchemaBackwardCompatibility:!1,displayEmailNotifier:!0,isStreamingEnabled:!1},onMaintainRelativeOrderChange:ce,popupConfig:ae,deviationData:ue={},deviationNodeIdToView:de,resetDeviationNodeId:pe,isProposingFix:fe=!1,proposingFixNodeId:ge,isRedlineFlow:he,badgeStyleOverride:me,guidelinesData:Se,gptWebCitationConfig:ve})=>{const[xe,Re]=n(le.maintainRelativeOrder),ye=le?.expandLevels??0,be=!!le?.expandAllSections,Ce=!!xe||!!le?.showDeviationBadges,[we,Be]=n(!1),[_e,Ie]=n(null),[Fe]=n(te?.newEvaluationResult??le?.enableDeviationSchemaBackwardCompatibility??!0),[Te,Ee]=n(new Set),[Ae,De]=n([]),[ke,Pe]=n(!1),[Oe,Le]=n(0),$e=i(null),je=i(null),Ne=i(null),Me=i(null),He=i(null),ze=i(!1),We=i(null),qe=i({}),Ge=i([]),Ve=i(()=>{}),Ke=i(null),Je=i(()=>{}),Ye=o(()=>JSON.stringify(ue||{}),[JSON.stringify(ue)]),Xe=o(()=>ue||{},[Ye]),Ue=o(()=>te?.cognitive_decisioning||{},[te]),Qe=o(()=>({..._,...re}),[re]),Ze=i(null),et=i(null),tt=i(null),nt=i(null),it=i(null),ot=i(null),rt=i(null),st=i(null),lt=i(null),ct=i(null),{cognitivePopup:at,setCognitivePopup:ut,moreFunctions:dt,setMoreFunctions:pt,position:ft,setPosition:gt,activeBadgeId:ht,summaryPopup:mt,setSummaryPopup:St,closeSummaryPopup:vt,setActiveBadgeId:xt,popupRef:Rt,handleOpenCognitiveCompare:yt,openCognitivePopupFromState:bt,closeCognitivePopup:Ct,closeMoreFunctionsPopup:wt}=$(Ze),Bt=o(()=>({fields:ne?.fields??I,thresholds:{high:ne?.thresholds?.high??F.thresholds.high,medium:ne?.thresholds?.medium??F.thresholds.medium,exact:ne?.thresholds?.exact??F.thresholds.exact}}),[ne]),[_t,It]=n(null),Ft=te?.documents?.[te?.input_index_map?.[0]]?.title,Tt=te?.documents?.[te?.input_index_map?.[1]]?.title,Et=S(ie||Ft||"Uploaded Contract"),At=te?.documents?.[te?.input_index_map?.[0]]?.metadata?.file_name,Dt=S(At),kt=te?.documents?.[te?.input_index_map?.[1]]?.metadata?.file_name,Pt=S(kt),Ot=S(oe||Tt||"Reference Template"),{isGuidelineMode:Lt,activeProposed:$t,existingRule:jt,proposedSections:Nt,existingSections:Mt,visibleFields:Ht,parentDeviationRecord:zt,deviationNumberRegistry:Wt,deviationParentRegistry:qt,parseError:Gt}=L(te,xe,Xe,Bt,Fe,Se);r(()=>{Gt&&Ie(`Failed to load comparison: ${Gt}`)},[Gt]);const Vt=Nt.length>0||Mt.length>0,Kt=o(()=>{if(!he)return"off";let e=0,t=0;const n=i=>{Array.isArray(i)&&i.forEach(i=>{const o=i?.content||"";b(o)&&(e+=1,t+=String(o).length),i?.subsections?.length&&n(i.subsections)})};return n(Nt),n(Mt),`${e}:${t}`},[he,Nt,Mt]);r(()=>{if(Nt.length||Mt.length)if(be){const e={},t={},n=(n,i)=>{n.forEach((n,o)=>{const r=xe?`${i}-${o}`:String(o);e[r]=!0;const s=(e,n)=>{e?.forEach((e,i)=>{const o=`${n}-${i}`;t[o]=!0,e.subsections?.length&&s(e.subsections,o)})};n.subsections?.length&&s(n.subsections,String(o))})};n(Nt,"left"),n(Mt,"right"),An(e),kn(t)}else if(ye>0){const e={},t={},n=(n,i,o)=>{n.forEach((n,r)=>{if(o>=1){const t=xe?`${i}-${r}`:String(r);e[t]=!0}const s=(e,n,i)=>{i>o||e?.forEach((e,o)=>{const r=`${n}-${o}`;t[r]=!0,e.subsections?.length&&s(e.subsections,r,i+1)})};n.subsections?.length&&o>=2&&s(n.subsections,String(r),2)})};n(Nt,"left",ye),n(Mt,"right",ye),An(e),kn(t)}},[be,ye,Nt,Mt,xe]);const{leftRefs:Jt,rightRefs:Yt,sectionLeftRefs:Xt,sectionRightRefs:Ut,lhsBadgeRefs:Qt,rhsBadgeRefs:Zt,sectionRightRowRefs:en,subSectionLeftRefs:tn,subSectionRightRefs:nn,sectionRowRefs:on,getSectionRowRef:rn,getSubSectionRef:sn,getBadgeRef:ln}=j(Ht.map(({key:e})=>e),Math.max(Nt.length,Mt.length)),{isSideBySide:cn,isArrowVisible:an,setIsSideBySide:un,setIsArrowVisible:dn,isResizing:pn,setIsResizing:fn,isSideBySideLoading:gn,setIsSideBySideLoading:hn,activeSideBySideSection:mn,setActiveSideBySideSection:Sn,scrollLock:vn,sideBySideCacheRef:xn,isSideBySideRef:Rn,activeSideBySideRightSectionRef:yn,activeSideBySideSectionRef:bn,sideBySideLineRef:Cn,highlightedClauseRefs:wn,clearClauseHighlight:Bn,applyAlignmentPadding:_n,resetSideBySide:In,activateSideBySide:Fn}=X({isGuidelineMode:Lt,maintainRelativeOrder:xe,proposedSections:Nt,existingSections:Mt,leftContainerRef:st,rightContainerRef:tt,scrollContainerRef:Ze,sectionLeftRefs:Xt,sectionRightRefs:Ut,subSectionLeftRefs:tn,subSectionRightRefs:nn,lhsBadgeRefs:Qt,rhsBadgeRefs:Zt,sectionRowRefs:on,sectionRightRowRefs:en,rhsTopSpacerRef:nt,rhsBottomSpacerRef:it,lhsTopSpacerRef:ot,lhsBottomSpacerRef:rt,calculateLinesRef:Ve,setConnectedSections:Ee,setConnectedLines:De,cachedConnectedPositions:Ge,closeMoreFunctionsPopup:wt,setErrorToast:Ie,moreFunctions:dt,closeSummaryPopup:vt}),Tn=i(Fn);r(()=>{Tn.current=Fn},[Fn]);const{expandedSections:En,setExpandedSections:An,expandedSubSections:Dn,setExpandedSubSections:kn,handleSubSectionToggle:Pn,toggleSection:On,forceExpandCrossWiredSections:Ln}=N({maintainRelativeOrder:!!xe,proposedSections:Nt,existingSections:Mt,activeSideBySideSection:mn,connectedSections:Te,resetSideBySide:In,setConnectedSections:Ee,setConnectedLines:De,cachedConnectedPositions:Ge,svgContainerRef:$e,isAnimatingRef:ze,animationTimerRef:We,calculateLinesRef:Ve,sectionLeftRefs:Xt,sectionRightRefs:Ut,subSectionLeftRefs:tn,subSectionRightRefs:nn}),$n=()=>{if(null==mn)return;const e=Xt.current[mn]?.current,t=Ut.current[mn]?.current,n=tt.current;if(!e||!t||!n)return;const i=e.getBoundingClientRect(),o=t.getBoundingClientRect(),r=n.getBoundingClientRect(),s=i.top-r.top,l=o.top-r.top-s;n.scrollBy({top:l,behavior:"smooth"})},jn=s(e=>{e?.stopPropagation(),Pe(e=>{const t=!e;return t&&requestAnimationFrame(()=>{$n()}),t})},[$n]);r(()=>{he&&"off"!==Kt&&"0:0"!==Kt&&(xn.current=null,Ge.current=[],requestAnimationFrame(()=>{Ve.current?.()}))},[he,Kt]);const Nn=o(()=>{const e=new Map,t=new Map;let n=1;if(xe)Nt.forEach(t=>{!t.title&&!t.content||t.id&&e.set(t.id,n++)}),Mt.forEach(i=>{if(!i.id)return;if(!i.title&&!i.content)return;const o=Nt.filter(e=>e.refIndexes?.includes(i.selfIndex));if(o.length>0){const n=o.map(t=>e.get(t.id)).filter(Boolean);t.set(i.id,n.join(", "))}else t.set(i.id,String(n++))});else{const i=Math.max(Nt.length,Mt.length);for(let o=0;o<i;o++){const i=Nt[o],r=Mt[o];i?(e.set(i.id,n),r&&t.set(r.id,String(n)),n++):r&&t.set(r.id,String(n++))}}return{leftNums:e,rightNums:t}},[Nt,Mt,xe]),Mn=jt.analysis,Hn=S(Mn?.rule_difference_comparison?.summary?.overall_summary),zn=!!Hn.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),Wn=te?.base_root_id??"-1",qn=Fe?(ue&&ue?.[Wn]?.evaluation_result)??te?.nodes?.[Wn]?.evaluation_result??null:(ue&&ue?.[Wn]?.evaluation_result?.[0])??te?.nodes?.[Wn]?.evaluation_result?.[0]??null,Gn=v(qn);let Vn=x(qn?.evaluation_outputs?.metadata?.label_color??T);if(me){const e=me(Gn);e&&(Vn={...Vn,badgeBg:e.bg,badgeText:e.text,badgeBorder:e.border})}const Kn=i(In);r(()=>{Kn.current=In},[In]);const Jn=i(Ct);r(()=>{Jn.current=Ct},[Ct]);const Yn=s((e,t,n,i,o,r)=>no.current(e,t,n,i,o,r),[]),Xn=s((e,t,n,i,o)=>oo.current(e,t,n,i,o),[]),Un=s(()=>ro.current(),[]),Qn=s((e,t)=>so.current(e,t),[]),Zn=s(e=>lo.current(e),[]),ei=s(e=>co.current(e),[]),ti=s(()=>ao.current(),[]),ni=s(()=>{Bn(),Kn.current?.(),Pe(!1),Ee(new Set),De([]),Ge.current=[],yi([]),Ci(null),St(E),Jn.current?.(),requestAnimationFrame(()=>{Ve.current?.()})},[]),ii=i(ni);r(()=>{ii.current=ni},[ni]),r(()=>{se&&ii.current()},[se]);const oi=o(()=>({documents:te?.documents,input_index_map:te?.input_index_map}),[JSON.stringify(te?.documents),JSON.stringify(te?.input_index_map)]),[ri,si]=n(""),li=i(te);r(()=>{li.current=te;const e=te?.input_index_map?.[0],t=te?.documents?.[e]?.title;si(t)},[te]);const ci=i(Ue);r(()=>{ci.current=Ue},[Ue]);const ai=s((e,t,n,i,o,r,s)=>{const l=S(t?.id)||S(n?.id)||"",c=(l?ci.current?.[l]:null)||t?.cognitiveData||n?.cognitiveData||{section_id:l,decisioning:[],gap:[],relevance_score:0},a=on.current[i]?.current??null,u=(()=>{const e=t?.evaluationResult||n?.evaluationResult||null,o=e=>{const t=(e=>{if(!e||"object"!=typeof e)return null;const t=e?.deviation_entries;if(t&&"object"==typeof t){const e=Object.keys(t).sort((e,t)=>Number(e)-Number(t))[0];if(e&&t[e])return t[e]}const n=Object.keys(e).filter(e=>/^\d+$/.test(e)).sort((e,t)=>Number(e)-Number(t));if(n.length&&e[n[0]])return e[n[0]];const i=e?.deviations;if(i&&"object"==typeof i){const e=Object.keys(i).sort((e,t)=>Number(e)-Number(t))[0];if(e&&i[e])return i[e]}return null})(e);return t?{...e,deviation_summary:e?.deviation_summary||t?.deviation_summary,deviation_title:e?.deviation_title||t?.deviation_title,deviation_impact:e?.deviation_impact||t?.deviation_impact,deviation_explanation:e?.deviation_explanation||t?.deviation_explanation,evaluation_outputs:e?.evaluation_outputs||t?.evaluation_outputs,cognitive_decisioning:e?.cognitive_decisioning||t?.cognitive_decisioning}:e};if(!("string"==typeof i&&i.includes(y)))return o(e);const r=i.split(y)[1];if(!r)return e;const s=t?.evaluationResult||n?.evaluationResult||{},l=s?.deviation_entries?.[r]||s?.deviations?.[r]||null;return l?{...s,...l,deviation_summary:l?.deviation_summary||s?.deviation_summary,deviation_title:l?.deviation_title||s?.deviation_title,deviation_impact:l?.deviation_impact||s?.deviation_impact,deviation_explanation:l?.deviation_explanation||s?.deviation_explanation,evaluation_outputs:l?.evaluation_outputs||s?.evaluation_outputs,cognitive_decisioning:l?.cognitive_decisioning||s?.cognitive_decisioning}:o(e)})(),d=(u?.cognitive_decisioning?.decisioning_factors?.length??0)>0||(u?.cognitive_decisioning?.gaps_in_decision?.length??0)>0,p=le?.isLoading??!1;let f=!0;if(Lt){const e=u?.deviation_highlights;if(e&&"object"==typeof e){f=Object.values(e).some(e=>Array.isArray(e)&&e.length>0)}else f=!1}return{isLoading:p&&!d,open:!0,sectionTitle:t?.title?t?.title:"No Counterpart",refSectionTitle:n?.title?n?.title:"No Counterpart",cognitiveData:c,anchorEl:e,sectionAnchorEl:a,badgeStyle:r||null,sectionIdx:i,docData:oi,deviationData:u,isOrphan:!!o,hasGuidelineMatches:f}},[oi,le?.isLoading,Lt]),ui=s((e,t,n,i,o,r)=>{if(e.stopPropagation(),dt.open&&dt.sectionIdx===o)return void wt();const s=e.currentTarget;let l="left";tt.current?.contains(s)&&(l="right");Bn(),Rn.current&&In(),Ee(new Set),De([]),Ge.current=[],Ct(),mt.open?ji():vt(),requestAnimationFrame(()=>{const e=(()=>{if("string"==typeof o&&o.includes(y)){const e=o.split(y),t=`${e[0]}${y}${e[1]}`;return"right"===l?Zt.current[t]?.current:Qt.current[t]?.current}return"right"===l?Zt.current[o]?.current:Qt.current[o]?.current})()||s;pt(ai(e,t,i,o,n,r))})},[dt.open,dt.sectionIdx,wt,vt,ai]),di=s(()=>{const e=dt.sectionIdx;dt.isOrphan,wt(),vt(),null!==e&&(Ln(e),Bn(),Rn.current&&In(),De([]),Ge.current=[],Lt&&null!==e&&Le(Oi(e)),Ee(t=>t.has(e)?new Set:new Set([e])),setTimeout(()=>{Ve.current&&Ve.current()},50))},[dt.sectionIdx,dt.isOrphan,wt,vt,In]),pi=s(()=>{const e=He.current;if(!e)return;He.current=null;const t=Nt.findIndex(t=>t.id===e),n=Mt.findIndex(t=>t.id===e),i=-1===t?R(Nt,e):null,o=-1===n?R(Mt,e):null,r=-1!==t?t:i?Number(i.split("-")[0]):-1,s=-1!==n?n:o?Number(o.split("-")[0]):-1,l=(e,t,n,i)=>-1!==e?n.current[e]?.current??null:t?i.current[t]?.current??null:null,c=(e,t,n=30)=>{let i=0;const o=()=>{const r=e();r&&0!==r.getBoundingClientRect().height?(wn.current.add(r),C(r,t)):i++<n&&requestAnimationFrame(o)};requestAnimationFrame(o)};if(xe)-1!==r&&st.current&&c(()=>l(t,i,Xt,tn),st.current),-1!==s&&tt.current&&c(()=>l(n,o,Ut,nn),tt.current);else{const e=Ze.current;if(!e)return;c(()=>-1!==r?l(t,i,Xt,tn):l(n,o,Ut,nn),e)}},[Nt,Mt,xe,Xt,Ut,tn,nn,st,tt,Ze]),fi=s(e=>{if(!e)return;Bn(),In(),Ee(new Set),De([]),Ge.current=[],vt(),Ct();const t=Nt.findIndex(t=>t.id===e),n=Mt.findIndex(t=>t.id===e),i=-1===t?R(Nt,e):null,o=-1===n?R(Mt,e):null;if(-1===t&&!i&&-1===n&&!o)return void console.warn(`scrollToAndHighlightClause: nodeId "${e}" not found`);const r=-1!==t?t:i?Number(i.split("-")[0]):-1,s=-1!==n?n:o?Number(o.split("-")[0]):-1;He.current=e,An(e=>{const t={...e};let n=!1;if(-1!==r){const e=xe?`left-${r}`:String(r);t[e]||(t[e]=!0,n=!0)}if(-1!==s){const e=xe?`right-${s}`:String(s);t[e]||(t[e]=!0,n=!0)}return n?t:e}),kn(e=>{const t={...e};let n=!1;const r=e=>{const i=e.split("-");let o=i[0];for(let e=1;e<i.length;e++)o+=`-${i[e]}`,t[o]||(t[o]=!0,n=!0)};return i&&r(i),o&&r(o),n?t:e}),setTimeout(()=>{requestAnimationFrame(()=>{He.current===e&&gi.current()})},50)},[Nt,Mt,xe,An,kn,In,vt,Ct]),gi=i(pi);r(()=>{gi.current=pi},[pi]);const hi=i(null);r(()=>{if(_t){const e=Bt.fields.find(e=>e.analysisKey===_t||e.key===_t);if(e){const t=Jt.current[e.key]||Yt.current[e.key];t?.current&&setTimeout(()=>t.current.scrollIntoView({behavior:"smooth",block:"center"}),150)}}},[_t,Bt.fields]);const mi=s(e=>{const t=Mn?.rule_difference_comparison?.fields;if(!t||!t[e])return{score:0,relation:"",highlightsA:[],highlightsB:[],hasContent:!1};const n=t[e],i=n?.relation||n?.highlights?.ruleA_spans?.length||n?.highlights?.ruleB_spans?.length||n?.mappings&&n.mappings.length>0;if(n.mappings){const e=n.mappings[0]||{};return{score:n.score,relation:e.relation||"",highlightsA:e.highlights?.ruleA_spans||[],highlightsB:e.highlights?.ruleB_spans||[],hasContent:!!i}}return{score:n.score,relation:n.relation||"",highlightsA:n.highlights?.ruleA_spans||[],highlightsB:n.highlights?.ruleB_spans||[],hasContent:!!i}},[Mn]),{getSectionCompareStyle:Si,getSubSectionCompareStyle:vi,getDeviationStyleByKey:xi}=K({proposedSections:Nt,existingSections:Mt,maintainRelativeOrder:xe,cognitiveMap:Ue,deviationData:Xe,treeData:te,resolvedComparisonConfig:Bt,badgeStyleOverride:me}),{lines:Ri,setLines:yi,overallConnector:bi,setOverallConnector:Ci,svgDimensions:wi,calculateLines:Bi,calculateLinesDebounced:_i,handleColumnScroll:Ii}=Y({containerRef:je,leftContainerRef:st,rightContainerRef:tt,svgContainerRef:$e,pathRefs:qe,leftHeaderRef:Ne,rightHeaderRef:Me,proposedSections:Nt,existingSections:Mt,visibleFields:Ht,leftRefs:Jt,rightRefs:Yt,sectionLeftRefs:Xt,sectionRightRefs:Ut,subSectionLeftRefs:tn,subSectionRightRefs:nn,lhsBadgeRefs:Qt,rhsBadgeRefs:Zt,sectionRowRefs:on,expandedSections:En,expandedSubSections:Dn,connectedSections:Te,isSideBySide:cn,activeSideBySideSection:mn,maintainRelativeOrder:xe,isGuidelineMode:Lt,cognitiveMap:Ue,getSectionCompareStyle:Si,getSubSectionCompareStyle:vi,getDeviationStyleByKey:xi,isArrowVisible:an,isAnimatingRef:ze,isSideBySideRef:Rn,sideBySideCacheRef:xn,sideBySideLineRef:Cn,activeSideBySideSectionRef:bn,activeSideBySideRightSectionRef:yn,connectedLines:Ae,setConnectedLines:De,cachedConnectedPositions:Ge,calculateLinesRef:Ve,resizeTimerRef:Ke,scrollLock:vn,scrollSyncLocked:ke,handleResizeRef:Je,activeProposed:$t,existingRule:jt,analysisData:Mn,pendingScrollTargetRef:lt,pendingScrollCallbackRef:ct,resolvedComparisonConfig:Bt,getFieldData:mi});r(()=>{mt.anchorEl&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{Ve.current?.()})})},[mt.anchorEl,ke]);const Fi=s(()=>{Bn(),Pe(!1),An({}),kn({}),In(),Ee(new Set),De([]),Ge.current=[],vt(),Ct(),wt(),requestAnimationFrame(()=>{Ve.current&&Ve.current()})},[An,kn,In,vt,Ct,wt]);r(()=>{cn||0!==Te.size||Pe(!1)},[cn,Te]);const Ti=o(()=>Object.values(En).some(Boolean)||Object.values(Dn).some(Boolean),[En,Dn]),Ei=i(null),Ai=i(0),Di=i(0),ki=i(0),{handleResize:Pi}=J({timerRef:Ei,ruleComponentRef:et,scrollContainerRef:Ze,containerRef:je,maintainRelativeOrder:xe,proposedSections:Nt,existingSections:Mt,isSideBySideRef:Rn,activeSideBySideSectionRef:bn,activeSideBySideRightSectionRef:yn,sectionRowRefs:on,sectionRightRowRefs:en,sectionLeftRefs:Xt,sectionRightRefs:Ut,subSectionLeftRefs:tn,subSectionRightRefs:nn,lhsBadgeRefs:Qt,rhsBadgeRefs:Zt,leftContainerRef:st,rightContainerRef:tt,calculateLinesRef:Ve,handleResizeRef:Je,setIsResizing:fn,setIsArrowVisible:dn,sideBySideCacheRef:xn,cachedConnectedPositions:Ge});r(()=>{Je.current=Pi},[Pi,Je]),r(()=>{const e=(e,t,n,i,o)=>{t.current=e.getBoundingClientRect().width;const r=new ResizeObserver(e=>{null!==n.current&&cancelAnimationFrame(n.current),n.current=requestAnimationFrame(()=>{n.current=null;const r=e[e.length-1];if(!r)return;const s=r.borderBoxSize?.[0]?.inlineSize??r.contentRect.width;Math.abs(s-t.current)<1?o():(t.current=s,i())})});return r.observe(e),r},t={current:null},n={current:null},i={current:null},o=[],r=[t,n,i];return et.current&&o.push(e(et.current,Ai,t,()=>Je.current(),()=>{})),Ze.current&&o.push(e(Ze.current,Di,n,()=>Je.current(),()=>Ve.current())),je.current&&o.push(e(je.current,ki,i,()=>Je.current(),()=>Ve.current())),()=>{o.forEach(e=>e.disconnect()),r.forEach(e=>{null!==e.current&&(cancelAnimationFrame(e.current),e.current=null)})}},[]),r(()=>{Rn.current=cn},[cn]),r(()=>{bn.current=mn},[mn]);const Oi=s(e=>{let t="",n="0";if("number"==typeof e)t=Nt[e]?.nodeId||Nt[e]?.id||"";else{const i=String(e).split(y);t=i[0],n=i[1]||"0"}const i=Xe?.[t]?.evaluation_result,o=Array.isArray(i)?i[parseInt(n,10)]:i?.[n];return!1===o?.evaluation_outputs?.guideline_flag?.rulebook_used?1:0},[Nt,Xe]),Li=s(e=>{const t=document.querySelectorAll('[id^="guideline-target-"], [data-web-gpt-active="true"]'),n=st.current,i=tt.current,o="string"==typeof e&&e.includes(y);let r=e;if(o){const t=e.split(y);t.length>=2&&(r=`${t[0]}${y}${t[1]}`)}const s=Qt.current[r]?.current||Qt.current[e]?.current;if(t.length>0&&s&&n&&i){const e=t[0];ot.current&&(ot.current.style.height="0px"),nt.current&&(nt.current.style.height="0px"),rt.current&&(rt.current.style.height="0px"),it.current&&(it.current.style.height="0px"),requestAnimationFrame(()=>{const t=s.getBoundingClientRect(),o=e.getBoundingClientRect(),r=n.getBoundingClientRect(),l=i.getBoundingClientRect(),c=n.scrollTop+(t.top-r.top)+t.height/2,a=i.scrollTop+(o.top-l.top)+o.height/2,u=c-r.height/2,d=Math.max(0,u),p=n.scrollHeight-n.clientHeight,f=d>p?d-p:0,g=r.top+c-d;let h=l.top+a-g,m=0;h<0&&(m=Math.abs(h),h=0);const S=i.scrollHeight-i.clientHeight+m,v=h>S?h-S:0;rt.current&&(rt.current.style.height=`${f}px`),nt.current&&(nt.current.style.height=`${m}px`),it.current&&(it.current.style.height=`${v}px`),requestAnimationFrame(()=>{n.scrollTo({top:d,behavior:"smooth"}),i.scrollTo({top:h,behavior:"smooth"}),Ve.current&&setTimeout(()=>Ve.current(),50)})})}},[y]),$i=s(()=>{const e=dt.sectionIdx,t=dt.isOrphan;if(vt(),null==e)return;let n="left";dt.anchorEl&&tt.current?.contains(dt.anchorEl)&&(n="right"),Ln(e),Lt&&(Le(Oi(e)),Ee(new Set([e]))),Fn(e,t,{sourceSide:n,onReady:()=>{Lt&&setTimeout(()=>Li(String(e)),150)}})},[Fn,dt.isOrphan,dt.sectionIdx,dt.anchorEl,vt,Ln,Lt,Li,Oi]),ji=s(()=>{vt(),In(),Ee(new Set),De([]),Ge.current=[]},[vt,In]),Ni=null!==dt.sectionIdx&&Te.has(dt.sectionIdx),{showDeviationNavigation:Mi,showOpenNodeRef:Hi,adjustScrollForPopup:zi}=M({proposedSections:Nt,existingSections:Mt,parentDeviationRecord:zt,expandedSections:En,maintainRelativeOrder:!!xe,scrollContainerRef:Ze,leftContainerRef:st,rightContainerRef:tt,lhsBadgeRefs:Qt,rhsBadgeRefs:Zt}),Wi=s((e,t,n,i,o)=>{const r="string"==typeof i?S(i).trim():S(i?.deviation_summary).trim(),s=e.currentTarget;Ct();let l="left";tt.current?.contains(s)&&(l="right");const c=()=>{if("string"==typeof t&&t.includes(y)){const e=t.split(y),n=`${e[0]}${y}${e[1]}`;return"right"===l?Zt.current[n]?.current:Qt.current[n]?.current}return"right"===l?Zt.current[t]?.current:Qt.current[t]?.current};if(n&&!Lt)return In(),Ee(new Set),De([]),Ge.current=[],void(r&&(Ln(t),requestAnimationFrame(()=>{const e=c()||s;if(e){e.getBoundingClientRect().top>.8*window.innerHeight&&e.scrollIntoView({behavior:"smooth",block:"center"})}St({open:!0,anchorEl:e,summary:i,displayImpact:o})})));Ln(t),Lt&&(Le(Oi(t)),Ee(new Set([t]))),r?setTimeout(()=>{Fn(t,n,{toggleIfSame:!1,sourceSide:l,onReady:()=>{const e=c()||s;if(Lt)setTimeout(()=>Li(t),150);else if(e){const t=e.getBoundingClientRect();if(t.top>.8*window.innerHeight||t.top<100){const e=t.top-window.innerHeight/2;xe?(st.current?.scrollBy({top:e,behavior:"smooth"}),tt.current?.scrollBy({top:e,behavior:"smooth"})):Ze.current?.scrollBy({top:e,behavior:"smooth"})}}St({open:!0,anchorEl:e,summary:i,displayImpact:o})}})},350):setTimeout(()=>{Fn(t,n,{toggleIfSame:!1,sourceSide:l}),Lt&&setTimeout(()=>Li(t),150)},350)},[Fn,Ct,St,In,Ln,Lt,xe,Li,Xe]),qi=o(()=>{if(!de)return null;const e=de?.id?.split(":")[0];for(const t in zt){if((zt[t]||[]).some(t=>t.id===e))return t}return null},[de,zt]),Gi=i({id:null,triggerMs:null}),Vi=i(null);r(()=>{if(!de?.id)return;const e=Number(de.trigger),t=Gi.current;if(t?.id===de.id&&t?.triggerMs===e)return;if(!(de.id.includes(":")&&/:\d+$/.test(de.id))){Gi.current={id:de.id,triggerMs:e},fi(de.id);const t=Nt.findIndex(e=>e.id===de.id),n=Mt.findIndex(e=>e.id===de.id);return void(-1===t&&-1===n||setTimeout(()=>{const e=-1!==t?t:n,i=-1===t;Lt&&Le(Oi(e)),Ee(new Set([e])),Tn.current(e,i,{sourceSide:i?"right":"left",onReady:()=>{Lt&&setTimeout(()=>Li(String(e)),150)}})},400))}const[n,i]=de.id.split(":"),o=i??"0",r=`${de.id}:${e}`;Vi.current!==r&&(vt(),Ct(),In(),Ee(new Set),De([]),Ge.current=[],Vi.current=r);let s=!1,l=0;let c=null,a=null,u=!1;const d=(e,t)=>{const n=(e,i)=>{if(!e)return null;if(t.includes(e.id)||t.includes(e.nodeId)||t.includes(e.contentId))return i;if(!Array.isArray(e.subsections))return null;for(let t=0;t<e.subsections.length;t++){const o=n(e.subsections[t],`${i}-${t}`);if(o)return o}return null};for(let t=0;t<e.length;t++){const i=n(e[t],String(t));if(i)return i}return null},p=()=>{if(s)return;const t=()=>{Gi.current={id:de.id,triggerMs:e}};let i=null,r=null;for(const e in zt){const t=zt[e].find(e=>e.id===n||e.nodeId===n||e.contentId===n||e.evaluationResult?.nodeId===n);if(t){i=e,r=t;break}}if(!r||!i)return l++,void(l<30&&(c=setTimeout(p,100)));const f=Array.from(new Set([n,r.id,r.nodeId,r.contentId,r.evaluationResult?.nodeId].filter(Boolean))),g=Nt.findIndex(e=>e.id===i),h=Mt.findIndex(e=>e.id===i),m=-1===g&&-1!==h,S=d(Nt,f);let v=d(Mt,f);if(S&&!v&&!m){const e=S.split("-");let t=Number(e[0]);if(xe){const e=Nt[t]?.refIndexes?.[0],n=Mt.findIndex(t=>t.selfIndex===e);-1!==n&&(t=n)}v=[t,...e.slice(1)].join("-")}if(!S&&!v)return l++,void(l<30&&(c=setTimeout(p,100)));const x=S?Number(S.split("-")[0]):g,R=v?Number(v.split("-")[0]):h,b=R>=0?R:v?Number(v.split("-")[0]):-1,C=Nt[x],_=Mt[b],I=C&&!C.title&&!C.content,F=_&&!_.title&&!_.content,T=m||(!S&&!!v||I&&!F);if(T){if(!(xe?!!io.current[`right-${R}`]:!!io.current[String(R)])&&R>=0)return On(R,"right"),void(c=setTimeout(p,200))}else{if(!(xe?!!io.current[`left-${x}`]:!!io.current[String(x)])&&x>=0)return On(x,"left"),void(c=setTimeout(p,200))}const E=S||"",A=v||"",D=f.map(e=>`${e}${y}${o}`),k=D[0],P=()=>{for(const e of D){const t=Qt.current[e]?.current||null,n=Zt.current[e]?.current||null;if(t||n)return{refId:e,left:t,right:n}}return{refId:k,left:null,right:null}},O=e=>`${e}${y}${E}${y}${A}`;if(!u){Ln(O(k)),u=!0,l=0;const e=()=>{const{left:e,right:t}=P();return T||!e&&!!t?t:e};return a?.(),void(c=setTimeout(()=>{s||(a=((e,t)=>{let n,i=0,o=null,r=null;const l=performance.now(),c=()=>{if(s)return;if(performance.now()-l>3e3)return void t();const a=e();if(!a||0===a.getBoundingClientRect().height)return void(n=requestAnimationFrame(c));const u=a.getBoundingClientRect(),d=u.top,p=u.height,f=null!==o&&Math.abs(d-o)<.5,g=null!==r&&Math.abs(p-r)<.5;if(f&&g){if(i++,i>=5)return void t()}else i=0;o=d,r=p,n=requestAnimationFrame(c)};return n=requestAnimationFrame(c),()=>cancelAnimationFrame(n)})(e,()=>{s||(a=null,p())}))},300))}const{refId:L,left:$,right:j}=P(),N=O(L);if(!$&&!j)return l++,void(l<30&&(c=setTimeout(p,100)));const M=T||!$&&!!j,H=M?j:$,z=xe?M?tt.current:st.current:Ze.current;if(!H||!z)return l++,void(l<30&&(c=setTimeout(p,100)));const W=H.getBoundingClientRect();if(0===W.height)return l++,void(l<30&&(c=setTimeout(p,100)));const q=z.getBoundingClientRect(),G=W.top-q.top+z.scrollTop-q.height/2+W.height/2,V=S?.includes("-")||v?.includes("-"),K=async()=>{if(s)return;t();const e=H instanceof Element?window.getComputedStyle(H).color:"";[$,j].forEach(t=>{t&&(t.style.transition="box-shadow 300ms ease-in-out",t.style.boxShadow=`0 0 10px ${e}`)}),setTimeout(()=>{[$,j].forEach(e=>{e&&(e.style.boxShadow="")})},2e3);const n=r.evaluationResult?.deviations?.[o]||r,i=r.evaluationResult?.evaluation_outputs||r.evaluation_outputs;if(!(!!$&&!!j)&&!Lt){const e=M?Zt.current[V?L:R]?.current||j:Qt.current[V?L:x]?.current||$;return zi(e,()=>{St({open:!0,anchorEl:e,displayImpact:de.displayImpact,summary:{...n,evaluation_outputs:i}})},{skipScroll:!0}),void pe?.()}const l=(e,t)=>Promise.race([e,new Promise(e=>setTimeout(e,t))]);xe&&await Promise.all([st.current?l(B(st.current),600):Promise.resolve(),tt.current?l(B(tt.current),600):Promise.resolve()]),Lt&&(Le(Oi(N)),Ee(new Set([N]))),Tn.current(N,!1,{toggleIfSame:!1,sourceSide:m?"right":"left",onReady:()=>{t();const e=M?Zt.current[L]?.current||j:Qt.current[L]?.current||$;if(Lt)setTimeout(()=>Li(N),150);else{const e=Qt.current[L]?.current||$,t=Zt.current[L]?.current||j;e&&(e.style.scrollMarginTop="150px",e.scrollIntoView({behavior:"smooth",block:"start"})),t&&(t.style.scrollMarginTop="150px",t.scrollIntoView({behavior:"smooth",block:"start"}))}St({open:!0,anchorEl:e,displayImpact:de.displayImpact,summary:{...n}}),pe?.()}})};Math.abs(z.scrollTop-G)<=2?K():w(z,G,K)};return c=setTimeout(p,100),()=>{s=!0,c&&clearTimeout(c),a?.()}},[de?.id,de?.trigger,de?.displayImpact,zt,Nt,Mt,xe,St,fi,Lt,Oi,Li]),r(()=>{if(!mt.open)return;const e=mt.anchorEl;if(!e)return;if(e.isConnected)return;const t=t=>{for(const[n,i]of Object.entries(t))if(i.current?.textContent===e.textContent)return n;return null},n=e.dataset?.deviationRefId||t(Qt.current)||t(Zt.current);if(!n)return;const i=Zt.current[n]?.current||Qt.current[n]?.current;i&&i.isConnected&&St(e=>({...e,anchorEl:i}))},[mt.open,mt.anchorEl,ke,Te,En]);const{open:Ki,sectionIdx:Ji,isOrphan:Yi,badgeStyle:Xi,anchorEl:Ui,sectionAnchorEl:Qi}=at;r(()=>{if(!le.isStreamingEnabled)return;if(!Ki||null==Ji)return;if(Ji===Wn)return;const e="string"==typeof Ji?Ji.split(y)[0]:null,t=(e,n)=>{if(!e||!Array.isArray(e))return null;for(const i of e){if(i.id===n)return i;if(i.subsections?.length){const e=t(i.subsections,n);if(e)return e}}return null},n=e&&"string"==typeof e?t(Nt,e):null,i=e&&"string"==typeof e?t(Mt,e):null,o="number"==typeof Ji?Nt[Ji]||null:n||e&&(te?.nodes?.[e]||te?.[e])||null,r="number"==typeof Ji?Mt[Ji]||null:i,s=ai(Ui,o,r,Ji,Yi,Xi);ut(e=>{if(!e.open)return e;return S(e.cognitiveData)===S(s.cognitiveData)&&S(e.deviationData)===S(s.deviationData)&&e.sectionTitle===s.sectionTitle&&e.refSectionTitle===s.refSectionTitle?e:{...e,...s,open:!0,anchorEl:e.anchorEl,sectionAnchorEl:e.sectionAnchorEl}})},[Ki,Ji,Yi,Xi,Ui,Qi,Nt,Mt,ai]);const Zi=s(({section:t,keyPath:n,depth:i=0,columnKey:o="left",parentNodeId:r="",sectionOffset:s,rhsOrphanVisualIndexes:l})=>e(z,{section:t,keyPath:n,depth:i,columnKey:o,parentNodeId:r,sectionOffset:s,rhsOrphanVisualIndexes:l}),[]),eo=o(()=>Nt.map((t,n)=>{const i=!t?.title&&!t?.content,o=!t?.refIndexes||0===t.refIndexes.length;return i&&o&&xe?null:e(W,{section:t,idx:n},t?.layoutKey??t?.id??`left-row-${n}`)}),[Nt,xe]),to=o(()=>Mt.map((t,n)=>{const i=!t?.title&&!t?.content,o=!t?.refIndexes||0===t.refIndexes.length;return i&&o&&xe?null:e(q,{section:t,idx:n},t?.layoutKey??t?.id??`right-row-${n}`)}),[Mt,xe]),no=i(ui);r(()=>{no.current=ui},[ui]);const io=i(En);r(()=>{io.current=En},[En]);const oo=i(Wi);r(()=>{oo.current=Wi},[Wi]);const ro=i(ji);r(()=>{ro.current=ji},[ji]);const so=i(On);r(()=>{so.current=On},[On]);const lo=i(Pn);r(()=>{lo.current=Pn},[Pn]);const co=i(Zi);r(()=>{co.current=Zi},[Zi]);const ao=i(In);r(()=>{ao.current=In},[In]);const uo=o(()=>({isGuidelineMode:Lt,maintainRelativeOrder:!!xe,showDeviationBadges:Ce,isProposingFix:fe,proposingFixNodeId:ge,isRedlineFlow:he,isSideBySide:cn,activeSideBySideSection:mn,scrollSyncLocked:ke,toggleScrollSyncLocked:jn,summaryPopupAnchorEl:mt.anchorEl,connectedSections:Te,proposedSections:Nt,existingSections:Mt,deviationNumberRegistry:Wt,deviationParentRegistry:qt,treeData:te,displayConfig:le,resolvedMarkdownStyles:Qe,unifiedNumbering:Nn,expandedSections:En,expandedSubSections:Dn,setExpandedSubSections:kn,getSectionCompareStyle:Si,getSubSectionCompareStyle:vi,getBadgeRef:ln,getSectionRowRef:rn,getSubSectionRef:sn,sectionLeftRefs:Xt,sectionRightRefs:Ut,sectionRowRefs:on,sectionRightRowRefs:en,subSectionLeftRefs:tn,subSectionRightRefs:nn,lhsBadgeRefs:Qt,rhsBadgeRefs:Zt,openMoreFunctionsPopup:Yn,handleOpenSummaryPopup:Xn,openSummaryPopup:Xn,handleCloseSummaryPopup:Un,toggleSection:Qn,handleSubSectionToggle:Zn,renderSubSectionAccordion:ei,resetSideBySide:ti,setConnectedSections:Ee,setConnectedLines:De,cachedConnectedPositions:Ge,showDeviationNavigation:Mi,showOpenNodeRef:Hi,deviationNodeIdToView:de?.id,deviationTargetParentId:qi,guidelinesData:Se,gptWebCitationConfig:ve}),[Lt,xe,Ce,fe,ge,he,cn,mn,ke,jn,mt.anchorEl,Te,Nt,Mt,Wt,le,Qe,Nn,En,Dn,kn,Si,vi,ln,rn,sn,Mi,Hi,de,qi,Se,ve]),po=S(at.sectionTitle||Dt||Et),fo=S(Lt?Pt||Ot||at.refSectionTitle:at.refSectionTitle||Pt||Ot);return e(V,{value:uo,children:t(l,{ref:et,sx:{display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif',overflow:"visible",position:"relative"},children:[we&&e(l,{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:e(P,{})}),mt.open&&e(G,{open:mt.open,anchorEl:mt.anchorEl,containerEl:hi.current,clipTopEl:Ne.current,scrollContainerEl:Ze.current,onClose:ji,summary:mt.summary,displayImpact:mt.displayImpact,isScrollLocked:ke}),e(k,{open:dt.open,anchorEl:dt.anchorEl,maintainRelativeOrder:!!xe,sectionTitle:dt.sectionTitle,referenceSectionTitle:dt.refSectionTitle,onClose:wt,onOpenCognitiveCompare:yt,onOpenSideBySide:$i,onConnect:di,isConnected:Ni,isOrphan:!Lt&&!!dt.isOrphan,isGuidelineMode:Lt,hasGuidelineMatches:dt.hasGuidelineMatches}),at.open&&e(D,{open:at.open,popupRef:Rt,position:ft,popupConfig:ae,onClose:()=>{gt(null),ut(e=>({...e,open:!1})),xt(null)},markdownStyles:re,sectionTitle:po,referenceSectionTitle:fo,cognitiveData:at.cognitiveData,anchorEl:at.anchorEl,sectionAnchorEl:at.sectionAnchorEl,scrollContainerEl:Ze.current,badgeStyle:at.badgeStyle,docData:at.docData,deviationData:at.deviationData,isLoading:at.isLoading}),e(c,{open:!!_e,autoHideDuration:8e3,onClose:()=>Ie(null),anchorOrigin:{vertical:"top",horizontal:"center"},children:e(a,{onClose:()=>Ie(null),severity:"error",sx:{width:"100%",whiteSpace:"pre-line"},children:_e})}),e(H,{componentHeaderText:ee,displayConfig:le,maintainRelativeOrder:xe,onCollapseAll:Fi,showCollapseAll:Ti,onToggleView:e=>{Be(!0),setTimeout(()=>{Re(!e),ce?.(!e),Pe(!1),In(),vt(),Ee(new Set),De([]),Ge.current=[],requestAnimationFrame(()=>{requestAnimationFrame(()=>{setTimeout(()=>{Be(!1)},600)})})},50)}}),e(l,{ref:Ze,onScroll:Ii,sx:{flex:1,minHeight:0,pt:1.5,pb:1,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",overflowY:xe?"visible":"auto",borderTop:Hn&&zn?"none":"1.5px solid #EEF0F4"},children:e(l,{sx:{display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px",...xe?{flex:1}:{}},children:t(l,{ref:je,sx:{display:"grid",gridTemplateColumns:"minmax(0, 1fr) 180px minmax(0, 1fr)",gap:"100px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0,...xe?{flex:1,overflow:"visible"}:{}},children:[e(U,{svgContainerRef:$e,svgDimensions:wi,isResizing:pn,overallConnector:bi,rootDeviationStyle:Vn,lines:Ri,isSideBySide:cn,activeSideBySideSection:mn,isArrowVisible:an,maintainRelativeOrder:xe,proposedSections:Nt,existingSections:Mt,cognitivePopup:at,activeBadgeId:ht,closeCognitivePopup:Ct,setActiveBadgeId:xt,openCognitivePopupFromState:bt,buildSectionPopupState:ai,connectedLines:Ae,isGuidelineMode:Lt,pathRefs:qe}),t(l,{sx:{border:"1px solid #E7E7E9",borderRadius:"8px",bgcolor:"#FFFFFF",display:"flex",flexDirection:"column",position:"relative",zIndex:2,filter:"drop-shadow(0px 2px 4px #F2F2F2)",...xe?{flex:1,overflow:"visible"}:{}},children:[e(l,{ref:Ne,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:e(u,{title:Et,placement:"top",children:e(d,{sx:{fontSize:"16px",fontWeight:500,color:"#19213D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0,textAlign:"center",display:"block"},children:Et})})}),t(l,{ref:st,onScroll:Ii,sx:{p:"12px",display:"flex",flexDirection:"column",...xe?{maxHeight:"calc(100vh - 250px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,mr:"-180px",pr:"192px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{}},children:[e("div",{ref:ot,style:{width:"100%",height:"0px",flexShrink:0}}),Vt&&eo,e("div",{ref:rt,style:{width:"100%",height:"0px",flexShrink:0}})]})]}),e(l,{ref:hi,sx:{width:"180px",display:"flex",flexDirection:"column",alignItems:"center",pt:"15px",gap:0,zIndex:20,pointerEvents:"none"},children:e(l,{sx:{display:"flex",justifyContent:"center",alignItems:"center",mt:0},children:t(l,{onClick:e=>{e.stopPropagation(),at.open&&ht===Wn?Ct():(xt(Wn),bt(ai(e.currentTarget,{title:ri,content:"",evaluationResult:qn,cognitiveData:{section_id:"",decisioning:[],gap:[],relevance_score:0,isMissingRationale:!0}},null,Wn,!0,{...Vn,label:""})))},sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:"5px",top:"-8px",borderRadius:"20px",bgcolor:Vn.badgeBg,color:Vn.badgeText,border:`1px solid ${Vn.badgeBorder}`,fontSize:"12px",fontWeight:600,whiteSpace:"nowrap",position:"relative",zIndex:1,pointerEvents:"auto",cursor:"pointer"},children:[Gn??e(O,{}),e(l,{component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}},children:e(h,{})}),e(g,{size:11,style:{transform:at.open&&ht===Wn?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]})})}),t(l,{sx:{border:"1px solid #E3E6EA",borderRadius:"8px",bgcolor:"#FFFFFF",boxShadow:"0px 1px 4px #F7F4FE",position:"relative",zIndex:2,display:"flex",flexDirection:"column",minWidth:0,...xe?{flex:1,overflow:"visible",minHeight:0}:{}},children:[gn&&e(m,{sections:11}),e(l,{ref:Me,sx:{p:"8px",bgcolor:Lt?"#F1F3F5":"#F7F8FA",borderBottom:"1px solid #D7DCE2",borderRadius:"8px 8px 0 0",display:"flex",alignItems:"center",...xe?{maxHeight:"calc(100vh - 250px)",overflowY:"auto",overflowX:"hidden",minHeight:0,...Lt?{"&::-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:Lt?t(p,{value:Oe,onChange:(e,t)=>Le(t),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:[e(f,{label:e(u,{title:Ot,placement:"top",children:e(l,{component:"span",sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"block",width:"100%"},children:"Redline Guidelines"})})}),e(f,{label:e(u,{title:"Web & GPT Sources",placement:"top",children:e(l,{component:"span",sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"block",width:"100%"},children:"Web & GPT Sources"})})})]}):e(u,{title:Ot,placement:"top",children:e(d,{sx:{fontSize:"16px",fontWeight:500,color:"#5928ED",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0,textAlign:"center",display:"block"},children:Ot})})}),t(l,{ref:tt,onScroll:Ii,sx:{p:Lt?"0px":"12px",display:"flex",flexDirection:"column",...xe?{maxHeight:"calc(100vh - 250px)",...!Lt&&{flex:1},overflowY:"auto",overflowX:"hidden",minHeight:0,ml:"-150px",pl:"165px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{}},children:[e("div",{ref:nt,style:{width:"100%",height:"0px",flexShrink:0}}),Lt?0===Oe?e(Q,{guidelinesData:Se,deviationData:ue,connectedSections:Te,proposedSections:Nt}):e(Z,{deviationData:ue,connectedSections:Te,proposedSections:Nt}):Vt&&to,e("div",{ref:it,style:{width:"100%",height:"0px",flexShrink:0}})]})]})]})})})]})})};export{ee as default};
1
+ import{jsx as e,jsxs as t}from"react/jsx-runtime";import{useState as n,useRef as i,useMemo as o,useEffect as r,useCallback as s}from"react";import{Box as l,Snackbar as c,Alert as a,Tooltip as u,Typography as d,Tabs as p,Tab as f}from"@mui/material";import{ChevronDown as g}from"lucide-react";import{ButtonCognitiveIcon as h}from"../../assests/svg/ButtonCognitiveIcon.js";import m from"./OverlayComponent.js";import{safeStringify as S,extractDeviationScore as v,generateColorPalette as x,DEVIATION_BADGE_SEPARATOR as y,findKeyPathByNodeId as R,hasMeaningfulRedlineTags as b,scrollAndHighlightClause as C,scrollAndWait as w,waitForScrollIdle as I}from"./CognitiveComparehelpers.js";import{SHARED_MARKDOWN_STYLES as _,DEFAULT_FIELD_CONFIG as B,DEFAULT_COMPARISON_CONFIG as T}from"./CognitiveCompareConfig.js";export{SHARED_MARKDOWN_STYLES}from"./CognitiveCompareConfig.js";import{DEFAULT_DEVIAION_COLOR as F,EMPTY_SUMMARY_POPUP_STATE as E,DEFAULT_COMPONENT_HEADER_TEXT as A}from"./CognitiveCompareConstants.js";import D from"./CognitivePopup.js";import O from"./MoreFunctionsPopup.js";import k from"./LoaderComponent.js";import P from"./components/ThreeDotsLoader.js";import{useCognitiveTreeData as j}from"./hooks/useCompareData.js";import{useComparePopups as L}from"./hooks/useComparePopups.js";import{useSectionRefs as $}from"./hooks/useSectionRefs.js";import{useAccordionState as N}from"./hooks/useAccordionState.js";import{useDeviationNavigation as M}from"./hooks/useDeviationNavigation.js";import{useOnDemandCitationCache as H}from"./hooks/useOnDemandCitationCache.js";import z from"./components/CompareHeader.js";import G from"./components/SubSectionAccordion.js";import W from"./components/LHSSectionRow.js";import q from"./components/RHSSectionRow.js";import V from"./components/CognitiveSummaryPopup.js";import{CompareContextProvider as K}from"./CompareContext.js";import{useStyleHelpers as J}from"./hooks/useStyles.js";import{useResizeHandler as Y}from"./hooks/useResizeHandler.js";import{useLinesCalculator as X}from"./hooks/useLinesCalculator.js";import{useSideBySide as U}from"./hooks/useSideBySide.js";import Q from"./components/SvgConnectors.js";import Z from"./Guidelines/components/GuidelinePanel.js";import ee from"./Guidelines/components/WebGptPanel.js";import{GuidelineSkeleton as te}from"./components/GuidelineSkeletonLoader.js";import{getVisibleGuidelineTargets as ne}from"./Guidelines/utils/guidelineTargets.js";import{hasGptCitationObjects as ie}from"./Guidelines/utils/hasGptCitationObjects.js";const oe=({componentHeaderText:oe=A,treeData:re,comparisonConfig:se,leftColumnTitleText:le,rightColumnTitleText:ce,markdownStyles:ae,resetTrigger:ue,displayConfig:de={isHeaderVisible:!0,isToggleVisible:!0,maintainRelativeOrder:!1,isLoading:!0,showDeviationBadges:!1,enableDeviationSchemaBackwardCompatibility:!1,displayEmailNotifier:!0,isStreamingEnabled:!1},deviationAnalysisStatus:pe,onMaintainRelativeOrderChange:fe,popupConfig:ge,deviationData:he={},deviationNodeIdToView:me,resetDeviationNodeId:Se,isProposingFix:ve=!1,proposingFixNodeId:xe,isRedlineFlow:ye,badgeStyleOverride:Re,guidelinesData:be,isGuidelineMode:Ce,gptWebCitationConfig:we,onDemandCitationConfig:Ie})=>{const[_e,Be]=n(de.maintainRelativeOrder),Te=de?.expandLevels??0,Fe=!!de?.expandAllSections,Ee=!!_e||!!de?.showDeviationBadges,[Ae,De]=n(!1),[Oe,ke]=n(null),[Pe]=n(re?.newEvaluationResult??de?.enableDeviationSchemaBackwardCompatibility??!0),[je,Le]=n(new Set),[$e,Ne]=n([]),[Me,He]=n(!1),[ze,Ge]=n(0),We=pe??(de?.isLoading?"deviations_streaming":"complete"),qe="mapping_ready"===We||"deviations_streaming"===We,Ve=i(null),Ke=i(null),Je=i(null),Ye=i(null),Xe=i(null),Ue=i(!1),Qe=i(null),Ze=i({}),et=i([]),tt=i(()=>{}),nt=i(null),it=i(()=>{}),ot=o(()=>JSON.stringify(he||{}),[JSON.stringify(he)]),rt=o(()=>he||{},[ot]),st=o(()=>ie(rt),[rt]),lt=o(()=>re?.cognitive_decisioning||{},[re]),ct=o(()=>({..._,...ae}),[ae]),at=i(null),ut=i(null),dt=i(null),pt=i(null),ft=i(null),gt=i(null),ht=i(null),mt=i(null),St=i(null),vt=i(null),{cognitivePopup:xt,setCognitivePopup:yt,moreFunctions:Rt,setMoreFunctions:bt,position:Ct,setPosition:wt,activeBadgeId:It,summaryPopup:_t,setSummaryPopup:Bt,closeSummaryPopup:Tt,setActiveBadgeId:Ft,popupRef:Et,handleOpenCognitiveCompare:At,openCognitivePopupFromState:Dt,closeCognitivePopup:Ot,closeMoreFunctionsPopup:kt}=L(at),Pt=o(()=>({fields:se?.fields??B,thresholds:{high:se?.thresholds?.high??T.thresholds.high,medium:se?.thresholds?.medium??T.thresholds.medium,exact:se?.thresholds?.exact??T.thresholds.exact}}),[se]),[jt,Lt]=n(null),$t=re?.documents?.[re?.input_index_map?.[0]]?.title,Nt=re?.documents?.[re?.input_index_map?.[1]]?.title,Mt=S(le||$t||"Uploaded Contract"),Ht=re?.documents?.[re?.input_index_map?.[0]]?.metadata?.file_name,zt=S(Ht),Gt=re?.documents?.[re?.input_index_map?.[1]]?.metadata?.file_name,Wt=S(Gt),qt=S(ce||Nt||"Reference Template"),{isGuidelineMode:Vt,activeProposed:Kt,existingRule:Jt,proposedSections:Yt,existingSections:Xt,visibleFields:Ut,parentDeviationRecord:Qt,deviationNumberRegistry:Zt,deviationParentRegistry:en,parseError:tn}=j(re,_e,rt,Pt,Pe,be,Ce);r(()=>{tn&&ke(`Failed to load comparison: ${tn}`)},[tn]);const nn=Yt.length>0||Xt.length>0,on=o(()=>{if(!ye)return"off";let e=0,t=0;const n=i=>{Array.isArray(i)&&i.forEach(i=>{const o=i?.content||"";b(o)&&(e+=1,t+=String(o).length),i?.subsections?.length&&n(i.subsections)})};return n(Yt),n(Xt),`${e}:${t}`},[ye,Yt,Xt]);r(()=>{if(Yt.length||Xt.length)if(Fe){const e={},t={},n=(n,i)=>{n.forEach((n,o)=>{const r=_e?`${i}-${o}`:String(o);e[r]=!0;const s=(e,n)=>{e?.forEach((e,i)=>{const o=`${n}-${i}`;t[o]=!0,e.subsections?.length&&s(e.subsections,o)})};n.subsections?.length&&s(n.subsections,String(o))})};n(Yt,"left"),n(Xt,"right"),Hn(e),Gn(t)}else if(Te>0){const e={},t={},n=(n,i,o)=>{n.forEach((n,r)=>{if(o>=1){const t=_e?`${i}-${r}`:String(r);e[t]=!0}const s=(e,n,i)=>{i>o||e?.forEach((e,o)=>{const r=`${n}-${o}`;t[r]=!0,e.subsections?.length&&s(e.subsections,r,i+1)})};n.subsections?.length&&o>=2&&s(n.subsections,String(r),2)})};n(Yt,"left",Te),n(Xt,"right",Te),Hn(e),Gn(t)}},[Fe,Te,Yt,Xt,_e]);const{leftRefs:rn,rightRefs:sn,sectionLeftRefs:ln,sectionRightRefs:cn,lhsBadgeRefs:an,rhsBadgeRefs:un,sectionRightRowRefs:dn,subSectionLeftRefs:pn,subSectionRightRefs:fn,sectionRowRefs:gn,getSectionRowRef:hn,getSubSectionRef:mn,getBadgeRef:Sn}=$(Ut.map(({key:e})=>e),Math.max(Yt.length,Xt.length)),{isSideBySide:vn,isArrowVisible:xn,setIsSideBySide:yn,setIsArrowVisible:Rn,isResizing:bn,setIsResizing:Cn,isSideBySideLoading:wn,setIsSideBySideLoading:In,activeSideBySideSection:_n,setActiveSideBySideSection:Bn,scrollLock:Tn,sideBySideCacheRef:Fn,isSideBySideRef:En,activeSideBySideRightSectionRef:An,activeSideBySideSectionRef:Dn,sideBySideLineRef:On,highlightedClauseRefs:kn,clearClauseHighlight:Pn,applyAlignmentPadding:jn,resetSideBySide:Ln,activateSideBySide:$n}=U({isGuidelineMode:Vt,maintainRelativeOrder:_e,proposedSections:Yt,existingSections:Xt,leftContainerRef:mt,rightContainerRef:dt,scrollContainerRef:at,sectionLeftRefs:ln,sectionRightRefs:cn,subSectionLeftRefs:pn,subSectionRightRefs:fn,lhsBadgeRefs:an,rhsBadgeRefs:un,sectionRowRefs:gn,sectionRightRowRefs:dn,rhsTopSpacerRef:pt,rhsBottomSpacerRef:ft,lhsTopSpacerRef:gt,lhsBottomSpacerRef:ht,calculateLinesRef:tt,setConnectedSections:Le,setConnectedLines:Ne,cachedConnectedPositions:et,closeMoreFunctionsPopup:kt,setErrorToast:ke,moreFunctions:Rt,closeSummaryPopup:Tt}),Nn=i($n);r(()=>{Nn.current=$n},[$n]);const{expandedSections:Mn,setExpandedSections:Hn,expandedSubSections:zn,setExpandedSubSections:Gn,handleSubSectionToggle:Wn,toggleSection:qn,forceExpandCrossWiredSections:Vn}=N({maintainRelativeOrder:!!_e,proposedSections:Yt,existingSections:Xt,activeSideBySideSection:_n,connectedSections:je,resetSideBySide:Ln,setConnectedSections:Le,setConnectedLines:Ne,cachedConnectedPositions:et,svgContainerRef:Ve,isAnimatingRef:Ue,animationTimerRef:Qe,calculateLinesRef:tt,sectionLeftRefs:ln,sectionRightRefs:cn,subSectionLeftRefs:pn,subSectionRightRefs:fn}),Kn=()=>{if(null==_n)return;const e=ln.current[_n]?.current,t=cn.current[_n]?.current,n=dt.current;if(!e||!t||!n)return;const i=e.getBoundingClientRect(),o=t.getBoundingClientRect(),r=n.getBoundingClientRect(),s=i.top-r.top,l=o.top-r.top-s;n.scrollBy({top:l,behavior:"smooth"})},Jn=s(e=>{e?.stopPropagation(),He(e=>{const t=!e;return t&&requestAnimationFrame(()=>{Kn()}),t})},[Kn]);r(()=>{ye&&"off"!==on&&"0:0"!==on&&(Fn.current=null,et.current=[],requestAnimationFrame(()=>{tt.current?.()}))},[ye,on]);const Yn=o(()=>{const e=new Map,t=new Map;let n=1;if(_e)Yt.forEach(t=>{!t.title&&!t.content||t.id&&e.set(t.id,n++)}),Xt.forEach(i=>{if(!i.id)return;if(!i.title&&!i.content)return;const o=Yt.filter(e=>e.refIndexes?.includes(i.selfIndex));if(o.length>0){const n=o.map(t=>e.get(t.id)).filter(Boolean);t.set(i.id,n.join(", "))}else t.set(i.id,String(n++))});else{const i=Math.max(Yt.length,Xt.length);for(let o=0;o<i;o++){const i=Yt[o],r=Xt[o];i?(e.set(i.id,n),r&&t.set(r.id,String(n)),n++):r&&t.set(r.id,String(n++))}}return{leftNums:e,rightNums:t}},[Yt,Xt,_e]),Xn=Jt.analysis,Un=S(Xn?.rule_difference_comparison?.summary?.overall_summary),Qn=!!Un.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),Zn=re?.base_root_id??"-1",ei=Pe?(he&&he?.[Zn]?.evaluation_result)??re?.nodes?.[Zn]?.evaluation_result??null:(he&&he?.[Zn]?.evaluation_result?.[0])??re?.nodes?.[Zn]?.evaluation_result?.[0]??null,ti=v(ei),ni=qe&&null==ei,ii=ni?null:ti??("complete"===We&&null==ei?"Same":null);let oi=x(ei?.evaluation_outputs?.metadata?.label_color??F);if(Re){const e=Re(ti);e&&(oi={...oi,badgeBg:e.bg,badgeText:e.text,badgeBorder:e.border})}const ri=i(Ln);r(()=>{ri.current=Ln},[Ln]);const si=i(Ot);r(()=>{si.current=Ot},[Ot]);const li=s((e,t,n,i,o,r)=>vo.current(e,t,n,i,o,r),[]),ci=s((e,t,n,i,o)=>yo.current(e,t,n,i,o),[]),ai=s(()=>Ro.current(),[]),ui=s((e,t)=>bo.current(e,t),[]),di=s(e=>Co.current(e),[]),pi=s(e=>wo.current(e),[]),fi=s(()=>Io.current(),[]),gi=s(()=>{Pn(),ri.current?.(),He(!1),Le(new Set),Ne([]),et.current=[],ki([]),ji(null),Bt(E),si.current?.(),requestAnimationFrame(()=>{tt.current?.()})},[]),hi=i(gi);r(()=>{hi.current=gi},[gi]),r(()=>{ue&&hi.current()},[ue]);const mi=o(()=>({documents:re?.documents,input_index_map:re?.input_index_map}),[JSON.stringify(re?.documents),JSON.stringify(re?.input_index_map)]),[Si,vi]=n(""),xi=S(Nt),yi=i(re);r(()=>{yi.current=re;const e=re?.input_index_map?.[0],t=re?.documents?.[e]?.title;vi(t)},[re]);const Ri=i(lt);r(()=>{Ri.current=lt},[lt]);const bi=s((e,t,n,i,o,r,s)=>{const l=S(t?.id)||S(n?.id)||"",c="string"==typeof i?i.split(y):[],a=c[0]||S(t?.nodeId)||S(n?.nodeId)||S(t?.id).split(y)[0]||S(n?.id).split(y)[0]||void 0,u=c.length>1&&void 0!==c[1]?c[1]:void 0,d=(l?Ri.current?.[l]:null)||t?.cognitiveData||n?.cognitiveData||{section_id:l,decisioning:[],gap:[],relevance_score:0},p=gn.current[i]?.current??null,f=(()=>{const e=t?.evaluationResult||n?.evaluationResult||null,o=e=>{const t=(e=>{if(!e||"object"!=typeof e)return null;const t=e?.deviation_entries;if(t&&"object"==typeof t){const e=Object.keys(t).sort((e,t)=>Number(e)-Number(t))[0];if(e&&t[e])return t[e]}const n=Object.keys(e).filter(e=>/^\d+$/.test(e)).sort((e,t)=>Number(e)-Number(t));if(n.length&&e[n[0]])return e[n[0]];const i=e?.deviations;if(i&&"object"==typeof i){const e=Object.keys(i).sort((e,t)=>Number(e)-Number(t))[0];if(e&&i[e])return i[e]}return null})(e);return t?{...e,deviation_summary:e?.deviation_summary||t?.deviation_summary,deviation_title:e?.deviation_title||t?.deviation_title,deviation_impact:e?.deviation_impact||t?.deviation_impact,deviation_explanation:e?.deviation_explanation||t?.deviation_explanation,evaluation_outputs:e?.evaluation_outputs||t?.evaluation_outputs,cognitive_decisioning:e?.cognitive_decisioning||t?.cognitive_decisioning}:e};if(!("string"==typeof i&&i.includes(y)))return o(e);const r=i.split(y)[1];if(!r)return e;const s=t?.evaluationResult||n?.evaluationResult||{},l=s?.deviation_entries?.[r]||s?.deviations?.[r]||null;return l?{...s,...l,deviation_summary:l?.deviation_summary||s?.deviation_summary,deviation_title:l?.deviation_title||s?.deviation_title,deviation_impact:l?.deviation_impact||s?.deviation_impact,deviation_explanation:l?.deviation_explanation||s?.deviation_explanation,evaluation_outputs:l?.evaluation_outputs||s?.evaluation_outputs,cognitive_decisioning:l?.cognitive_decisioning||s?.cognitive_decisioning}:o(e)})(),g=(f?.cognitive_decisioning?.decisioning_factors?.length??0)>0||(f?.cognitive_decisioning?.gaps_in_decision?.length??0)>0,h=qe;let m=!0;if(Vt){const e=f?.deviation_highlights;if(e&&"object"==typeof e){m=Object.values(e).some(e=>Array.isArray(e)&&e.length>0)}else m=!1}return{isLoading:h&&!g,open:!0,sectionTitle:t?.title?t?.title:"No Counterpart",refSectionTitle:n?.title?n?.title:"No Counterpart",cognitiveData:d,anchorEl:e,sectionAnchorEl:p,badgeStyle:r||null,sectionIdx:i,docData:mi,deviationData:f,isOrphan:!!o,hasGuidelineMatches:m,sourceNodeId:a,deviationKey:u,baseContentId:t?.contentId,compareContentIds:[...n?.contentId?[n.contentId]:[],...t?.refContentIds||[],...n?.refContentIds||[]].filter(Boolean)}},[mi,qe,Vt]),Ci=s((e,t,n,i,o,r)=>{if(e.stopPropagation(),Rt.open&&Rt.sectionIdx===o)return void kt();const s=e.currentTarget;let l="left";dt.current?.contains(s)&&(l="right");Pn(),En.current&&Ln(),Le(new Set),Ne([]),et.current=[],Ot(),_t.open?Zi():Tt(),requestAnimationFrame(()=>{const e=(()=>{if("string"==typeof o&&o.includes(y)){const e=o.split(y),t=`${e[0]}${y}${e[1]}`;return"right"===l?un.current[t]?.current:an.current[t]?.current}return"right"===l?un.current[o]?.current:an.current[o]?.current})()||s;bt(bi(e,t,i,o,n,r))})},[Rt.open,Rt.sectionIdx,kt,Tt,bi]),wi=s(()=>{const e=Rt.sectionIdx;Rt.isOrphan,kt(),Tt(),null!==e&&(Vn(e),Pn(),En.current&&Ln(),Ne([]),et.current=[],Vt&&null!==e&&Ge(Ji(e)),Le(t=>t.has(e)?new Set:new Set([e])),setTimeout(()=>{tt.current&&tt.current()},50))},[Rt.sectionIdx,Rt.isOrphan,kt,Tt,Ln]),Ii=s(()=>{const e=Xe.current;if(!e)return;Xe.current=null;const t=Yt.findIndex(t=>t.id===e),n=Xt.findIndex(t=>t.id===e),i=-1===t?R(Yt,e):null,o=-1===n?R(Xt,e):null,r=-1!==t?t:i?Number(i.split("-")[0]):-1,s=-1!==n?n:o?Number(o.split("-")[0]):-1,l=(e,t,n,i)=>-1!==e?n.current[e]?.current??null:t?i.current[t]?.current??null:null,c=(e,t,n=30)=>{let i=0;const o=()=>{const r=e();r&&0!==r.getBoundingClientRect().height?(kn.current.add(r),C(r,t)):i++<n&&requestAnimationFrame(o)};requestAnimationFrame(o)};if(_e)-1!==r&&mt.current&&c(()=>l(t,i,ln,pn),mt.current),-1!==s&&dt.current&&c(()=>l(n,o,cn,fn),dt.current);else{const e=at.current;if(!e)return;c(()=>-1!==r?l(t,i,ln,pn):l(n,o,cn,fn),e)}},[Yt,Xt,_e,ln,cn,pn,fn,mt,dt,at]),_i=s(e=>{if(!e)return;Pn(),Ln(),Le(new Set),Ne([]),et.current=[],Tt(),Ot();const t=Yt.findIndex(t=>t.id===e),n=Xt.findIndex(t=>t.id===e),i=-1===t?R(Yt,e):null,o=-1===n?R(Xt,e):null;if(-1===t&&!i&&-1===n&&!o)return void console.warn(`scrollToAndHighlightClause: nodeId "${e}" not found`);const r=-1!==t?t:i?Number(i.split("-")[0]):-1,s=-1!==n?n:o?Number(o.split("-")[0]):-1;Xe.current=e,Hn(e=>{const t={...e};let n=!1;if(-1!==r){const e=_e?`left-${r}`:String(r);t[e]||(t[e]=!0,n=!0)}if(-1!==s){const e=_e?`right-${s}`:String(s);t[e]||(t[e]=!0,n=!0)}return n?t:e}),Gn(e=>{const t={...e};let n=!1;const r=e=>{const i=e.split("-");let o=i[0];for(let e=1;e<i.length;e++)o+=`-${i[e]}`,t[o]||(t[o]=!0,n=!0)};return i&&r(i),o&&r(o),n?t:e}),setTimeout(()=>{requestAnimationFrame(()=>{Xe.current===e&&Bi.current()})},50)},[Yt,Xt,_e,Hn,Gn,Ln,Tt,Ot]),Bi=i(Ii);r(()=>{Bi.current=Ii},[Ii]);const Ti=i(null);r(()=>{if(jt){const e=Pt.fields.find(e=>e.analysisKey===jt||e.key===jt);if(e){const t=rn.current[e.key]||sn.current[e.key];t?.current&&setTimeout(()=>t.current.scrollIntoView({behavior:"smooth",block:"center"}),150)}}},[jt,Pt.fields]);const Fi=s(e=>{const t=Xn?.rule_difference_comparison?.fields;if(!t||!t[e])return{score:0,relation:"",highlightsA:[],highlightsB:[],hasContent:!1};const n=t[e],i=n?.relation||n?.highlights?.ruleA_spans?.length||n?.highlights?.ruleB_spans?.length||n?.mappings&&n.mappings.length>0;if(n.mappings){const e=n.mappings[0]||{};return{score:n.score,relation:e.relation||"",highlightsA:e.highlights?.ruleA_spans||[],highlightsB:e.highlights?.ruleB_spans||[],hasContent:!!i}}return{score:n.score,relation:n.relation||"",highlightsA:n.highlights?.ruleA_spans||[],highlightsB:n.highlights?.ruleB_spans||[],hasContent:!!i}},[Xn]),{getSectionCompareStyle:Ei,getSubSectionCompareStyle:Ai,getDeviationStyleByKey:Di}=J({proposedSections:Yt,existingSections:Xt,maintainRelativeOrder:_e,cognitiveMap:lt,deviationData:rt,treeData:re,resolvedComparisonConfig:Pt,badgeStyleOverride:Re}),{lines:Oi,setLines:ki,overallConnector:Pi,setOverallConnector:ji,svgDimensions:Li,calculateLines:$i,calculateLinesDebounced:Ni,handleColumnScroll:Mi}=X({containerRef:Ke,leftContainerRef:mt,rightContainerRef:dt,svgContainerRef:Ve,pathRefs:Ze,leftHeaderRef:Je,rightHeaderRef:Ye,proposedSections:Yt,existingSections:Xt,visibleFields:Ut,leftRefs:rn,rightRefs:sn,sectionLeftRefs:ln,sectionRightRefs:cn,subSectionLeftRefs:pn,subSectionRightRefs:fn,lhsBadgeRefs:an,rhsBadgeRefs:un,sectionRowRefs:gn,expandedSections:Mn,expandedSubSections:zn,connectedSections:je,isSideBySide:vn,activeSideBySideSection:_n,maintainRelativeOrder:_e,isGuidelineMode:Vt,cognitiveMap:lt,getSectionCompareStyle:Ei,getSubSectionCompareStyle:Ai,getDeviationStyleByKey:Di,isArrowVisible:xn,isAnimatingRef:Ue,isSideBySideRef:En,sideBySideCacheRef:Fn,sideBySideLineRef:On,activeSideBySideSectionRef:Dn,activeSideBySideRightSectionRef:An,connectedLines:$e,setConnectedLines:Ne,cachedConnectedPositions:et,calculateLinesRef:tt,resizeTimerRef:nt,scrollLock:Tn,scrollSyncLocked:Me,handleResizeRef:it,activeProposed:Kt,existingRule:Jt,analysisData:Xn,pendingScrollTargetRef:St,pendingScrollCallbackRef:vt,resolvedComparisonConfig:Pt,getFieldData:Fi});r(()=>{_t.anchorEl&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{tt.current?.()})})},[_t.anchorEl,Me]);const Hi=s(()=>{Pn(),He(!1),Hn({}),Gn({}),Ln(),Le(new Set),Ne([]),et.current=[],Tt(),Ot(),kt(),requestAnimationFrame(()=>{tt.current&&tt.current()})},[Hn,Gn,Ln,Tt,Ot,kt]);r(()=>{vn||0!==je.size||He(!1)},[vn,je]);const zi=o(()=>Object.values(Mn).some(Boolean)||Object.values(zn).some(Boolean),[Mn,zn]),Gi=i(null),Wi=i(0),qi=i(0),Vi=i(0),{handleResize:Ki}=Y({timerRef:Gi,ruleComponentRef:ut,scrollContainerRef:at,containerRef:Ke,maintainRelativeOrder:_e,proposedSections:Yt,existingSections:Xt,isSideBySideRef:En,activeSideBySideSectionRef:Dn,activeSideBySideRightSectionRef:An,sectionRowRefs:gn,sectionRightRowRefs:dn,sectionLeftRefs:ln,sectionRightRefs:cn,subSectionLeftRefs:pn,subSectionRightRefs:fn,lhsBadgeRefs:an,rhsBadgeRefs:un,leftContainerRef:mt,rightContainerRef:dt,calculateLinesRef:tt,handleResizeRef:it,setIsResizing:Cn,setIsArrowVisible:Rn,sideBySideCacheRef:Fn,cachedConnectedPositions:et});r(()=>{it.current=Ki},[Ki,it]),r(()=>{const e=(e,t,n,i,o)=>{t.current=e.getBoundingClientRect().width;const r=new ResizeObserver(e=>{null!==n.current&&cancelAnimationFrame(n.current),n.current=requestAnimationFrame(()=>{n.current=null;const r=e[e.length-1];if(!r)return;const s=r.borderBoxSize?.[0]?.inlineSize??r.contentRect.width;Math.abs(s-t.current)<1?o():(t.current=s,i())})});return r.observe(e),r},t={current:null},n={current:null},i={current:null},o=[],r=[t,n,i];return ut.current&&o.push(e(ut.current,Wi,t,()=>it.current(),()=>{})),at.current&&o.push(e(at.current,qi,n,()=>it.current(),()=>tt.current())),Ke.current&&o.push(e(Ke.current,Vi,i,()=>it.current(),()=>tt.current())),()=>{o.forEach(e=>e.disconnect()),r.forEach(e=>{null!==e.current&&(cancelAnimationFrame(e.current),e.current=null)})}},[]),r(()=>{En.current=vn},[vn]),r(()=>{Dn.current=_n},[_n]);const Ji=s(e=>{let t="",n="0";if("number"==typeof e)t=Yt[e]?.nodeId||Yt[e]?.id||"";else{const i=String(e).split(y);t=i[0],n=i[1]||"0"}const i=rt?.[t]?.evaluation_result,o=Array.isArray(i)?i[parseInt(n,10)]:i?.[n];return!1===o?.evaluation_outputs?.guideline_flag?.rulebook_used&&ie(o)?1:0},[Yt,rt]),Yi=s(()=>{Ln(),Le(new Set),Ne([]),et.current=[]},[Ln]),Xi=s((e,t)=>{t!==ze&&(Yi(),Ge(t))},[ze,Yi]);r(()=>{st||0===ze||(Yi(),Ge(0))},[ze,st,Yi]);const Ui=s(e=>{const t=mt.current,n=dt.current,i=ne(n);if(!n)return;const o="string"==typeof e&&e.includes(y);let r=e;if(o){const t=e.split(y);t.length>=2&&(r=`${t[0]}${y}${t[1]}`)}const s=an.current[r]?.current||an.current[e]?.current;if(i.length>0&&s&&t&&n){const e=i[0];gt.current&&(gt.current.style.height="0px"),pt.current&&(pt.current.style.height="0px"),ht.current&&(ht.current.style.height="0px"),ft.current&&(ft.current.style.height="0px"),requestAnimationFrame(()=>{const i=s.getBoundingClientRect(),o=e.getBoundingClientRect(),r=t.getBoundingClientRect(),l=n.getBoundingClientRect(),c=t.scrollTop+(i.top-r.top)+i.height/2,a=n.scrollTop+(o.top-l.top)+o.height/2,u=c-r.height/2,d=Math.max(0,u),p=t.scrollHeight-t.clientHeight,f=d>p?d-p:0,g=r.top+c-d;let h=l.top+a-g,m=0;h<0&&(m=Math.abs(h),h=0);const S=n.scrollHeight-n.clientHeight+m,v=h>S?h-S:0;ht.current&&(ht.current.style.height=`${f}px`),pt.current&&(pt.current.style.height=`${m}px`),ft.current&&(ft.current.style.height=`${v}px`),requestAnimationFrame(()=>{t.scrollTo({top:d,behavior:"smooth"}),n.scrollTo({top:h,behavior:"smooth"}),tt.current&&setTimeout(()=>tt.current(),50)})})}},[y]),Qi=s(()=>{const e=Rt.sectionIdx,t=Rt.isOrphan;if(Tt(),null==e)return;let n="left";Rt.anchorEl&&dt.current?.contains(Rt.anchorEl)&&(n="right"),Vn(e),Vt&&(Ge(Ji(e)),Le(new Set([e]))),$n(e,t,{sourceSide:n,onReady:()=>{Vt&&setTimeout(()=>Ui(String(e)),150)}})},[$n,Rt.isOrphan,Rt.sectionIdx,Rt.anchorEl,Tt,Vn,Vt,Ui,Ji]),Zi=s(()=>{Tt(),Ln(),Le(new Set),Ne([]),et.current=[]},[Tt,Ln]),eo=null!==Rt.sectionIdx&&je.has(Rt.sectionIdx),{showDeviationNavigation:to,showOpenNodeRef:no,adjustScrollForPopup:io}=M({proposedSections:Yt,existingSections:Xt,parentDeviationRecord:Qt,expandedSections:Mn,maintainRelativeOrder:!!_e,scrollContainerRef:at,leftContainerRef:mt,rightContainerRef:dt,lhsBadgeRefs:an,rhsBadgeRefs:un}),oo=s((e,t,n,i,o)=>{const r="string"==typeof i?S(i).trim():S(i?.deviation_summary).trim(),s=e.currentTarget;Ot();let l="left";dt.current?.contains(s)&&(l="right");const c=()=>{if("string"==typeof t&&t.includes(y)){const e=t.split(y),n=`${e[0]}${y}${e[1]}`;return"right"===l?un.current[n]?.current:an.current[n]?.current}return"right"===l?un.current[t]?.current:an.current[t]?.current};if(n&&!Vt)return Ln(),Le(new Set),Ne([]),et.current=[],void(r&&(Vn(t),requestAnimationFrame(()=>{const e=c()||s;if(e){e.getBoundingClientRect().top>.8*window.innerHeight&&e.scrollIntoView({behavior:"smooth",block:"center"})}Bt({open:!0,anchorEl:e,summary:i,displayImpact:o})})));Vn(t),Vt&&(Ge(Ji(t)),Le(new Set([t]))),r?setTimeout(()=>{$n(t,n,{toggleIfSame:!1,sourceSide:l,onReady:()=>{const e=c()||s;if(Vt)setTimeout(()=>Ui(t),150);else if(e){const t=e.getBoundingClientRect();if(t.top>.8*window.innerHeight||t.top<100){const e=t.top-window.innerHeight/2;_e?(mt.current?.scrollBy({top:e,behavior:"smooth"}),dt.current?.scrollBy({top:e,behavior:"smooth"})):at.current?.scrollBy({top:e,behavior:"smooth"})}}Bt({open:!0,anchorEl:e,summary:i,displayImpact:o})}})},350):setTimeout(()=>{$n(t,n,{toggleIfSame:!1,sourceSide:l}),Vt&&setTimeout(()=>Ui(t),150)},350)},[$n,Ot,Bt,Ln,Vn,Vt,_e,Ui,rt]),ro=o(()=>{if(!me)return null;const e=me?.id?.split(":")[0];for(const t in Qt){if((Qt[t]||[]).some(t=>t.id===e))return t}return null},[me,Qt]),so=i({id:null,triggerMs:null}),lo=i(null);r(()=>{if(!me?.id)return;const e=Number(me.trigger),t=so.current;if(t?.id===me.id&&t?.triggerMs===e)return;if(!(me.id.includes(":")&&/:\d+$/.test(me.id))){so.current={id:me.id,triggerMs:e},_i(me.id);const t=Yt.findIndex(e=>e.id===me.id),n=Xt.findIndex(e=>e.id===me.id);return void(-1===t&&-1===n||setTimeout(()=>{const e=-1!==t?t:n,i=-1===t;Vt&&Ge(Ji(e)),Le(new Set([e])),Nn.current(e,i,{sourceSide:i?"right":"left",onReady:()=>{Vt&&setTimeout(()=>Ui(String(e)),150)}})},400))}const[n,i]=me.id.split(":"),o=i??"0",r=`${me.id}:${e}`;lo.current!==r&&(Tt(),Ot(),Ln(),Le(new Set),Ne([]),et.current=[],lo.current=r);let s=!1,l=0;let c=null,a=null,u=!1;const d=(e,t)=>{const n=(e,i)=>{if(!e)return null;if(t.includes(e.id)||t.includes(e.nodeId)||t.includes(e.contentId))return i;if(!Array.isArray(e.subsections))return null;for(let t=0;t<e.subsections.length;t++){const o=n(e.subsections[t],`${i}-${t}`);if(o)return o}return null};for(let t=0;t<e.length;t++){const i=n(e[t],String(t));if(i)return i}return null},p=()=>{if(s)return;const t=()=>{so.current={id:me.id,triggerMs:e}};let i=null,r=null;for(const e in Qt){const t=Qt[e].find(e=>e.id===n||e.nodeId===n||e.contentId===n||e.evaluationResult?.nodeId===n);if(t){i=e,r=t;break}}if(!r||!i)return l++,void(l<30&&(c=setTimeout(p,100)));const f=Array.from(new Set([n,r.id,r.nodeId,r.contentId,r.evaluationResult?.nodeId].filter(Boolean))),g=Yt.findIndex(e=>e.id===i),h=Xt.findIndex(e=>e.id===i),m=-1===g&&-1!==h,S=d(Yt,f);let v=d(Xt,f);if(S&&!v&&!m){const e=S.split("-");let t=Number(e[0]);if(_e){const e=Yt[t]?.refIndexes?.[0],n=Xt.findIndex(t=>t.selfIndex===e);-1!==n&&(t=n)}v=[t,...e.slice(1)].join("-")}if(!S&&!v)return l++,void(l<30&&(c=setTimeout(p,100)));const x=S?Number(S.split("-")[0]):g,R=v?Number(v.split("-")[0]):h,b=R>=0?R:v?Number(v.split("-")[0]):-1,C=Yt[x],_=Xt[b],B=C&&!C.title&&!C.content,T=_&&!_.title&&!_.content,F=m||(!S&&!!v||B&&!T);if(F){if(!(_e?!!xo.current[`right-${R}`]:!!xo.current[String(R)])&&R>=0)return qn(R,"right"),void(c=setTimeout(p,200))}else{if(!(_e?!!xo.current[`left-${x}`]:!!xo.current[String(x)])&&x>=0)return qn(x,"left"),void(c=setTimeout(p,200))}const E=S||"",A=v||"",D=f.map(e=>`${e}${y}${o}`),O=D[0],k=()=>{for(const e of D){const t=an.current[e]?.current||null,n=un.current[e]?.current||null;if(t||n)return{refId:e,left:t,right:n}}return{refId:O,left:null,right:null}},P=e=>`${e}${y}${E}${y}${A}`;if(!u){Vn(P(O)),u=!0,l=0;const e=()=>{const{left:e,right:t}=k();return F||!e&&!!t?t:e};return a?.(),void(c=setTimeout(()=>{s||(a=((e,t)=>{let n,i=0,o=null,r=null;const l=performance.now(),c=()=>{if(s)return;if(performance.now()-l>3e3)return void t();const a=e();if(!a||0===a.getBoundingClientRect().height)return void(n=requestAnimationFrame(c));const u=a.getBoundingClientRect(),d=u.top,p=u.height,f=null!==o&&Math.abs(d-o)<.5,g=null!==r&&Math.abs(p-r)<.5;if(f&&g){if(i++,i>=5)return void t()}else i=0;o=d,r=p,n=requestAnimationFrame(c)};return n=requestAnimationFrame(c),()=>cancelAnimationFrame(n)})(e,()=>{s||(a=null,p())}))},300))}const{refId:j,left:L,right:$}=k(),N=P(j);if(!L&&!$)return l++,void(l<30&&(c=setTimeout(p,100)));const M=F||!L&&!!$,H=M?$:L,z=_e?M?dt.current:mt.current:at.current;if(!H||!z)return l++,void(l<30&&(c=setTimeout(p,100)));const G=H.getBoundingClientRect();if(0===G.height)return l++,void(l<30&&(c=setTimeout(p,100)));const W=z.getBoundingClientRect(),q=G.top-W.top+z.scrollTop-W.height/2+G.height/2,V=S?.includes("-")||v?.includes("-"),K=async()=>{if(s)return;t();const e=H instanceof Element?window.getComputedStyle(H).color:"";[L,$].forEach(t=>{t&&(t.style.transition="box-shadow 300ms ease-in-out",t.style.boxShadow=`0 0 10px ${e}`)}),setTimeout(()=>{[L,$].forEach(e=>{e&&(e.style.boxShadow="")})},2e3);const n=r.evaluationResult?.deviations?.[o]||r,i=r.evaluationResult?.evaluation_outputs||r.evaluation_outputs;if(!(!!L&&!!$)&&!Vt){const e=M?un.current[V?j:R]?.current||$:an.current[V?j:x]?.current||L;return io(e,()=>{Bt({open:!0,anchorEl:e,displayImpact:me.displayImpact,summary:{...n,evaluation_outputs:i}})},{skipScroll:!0}),void Se?.()}const l=(e,t)=>Promise.race([e,new Promise(e=>setTimeout(e,t))]);_e&&await Promise.all([mt.current?l(I(mt.current),600):Promise.resolve(),dt.current?l(I(dt.current),600):Promise.resolve()]),Vt&&(Ge(Ji(N)),Le(new Set([N]))),Nn.current(N,!1,{toggleIfSame:!1,sourceSide:m?"right":"left",onReady:()=>{t();const e=M?un.current[j]?.current||$:an.current[j]?.current||L;if(Vt)setTimeout(()=>Ui(N),150);else{const e=an.current[j]?.current||L,t=un.current[j]?.current||$;e&&(e.style.scrollMarginTop="150px",e.scrollIntoView({behavior:"smooth",block:"start"})),t&&(t.style.scrollMarginTop="150px",t.scrollIntoView({behavior:"smooth",block:"start"}))}Bt({open:!0,anchorEl:e,displayImpact:me.displayImpact,summary:{...n}}),Se?.()}})};Math.abs(z.scrollTop-q)<=2?K():w(z,q,K)};return c=setTimeout(p,100),()=>{s=!0,c&&clearTimeout(c),a?.()}},[me?.id,me?.trigger,me?.displayImpact,Qt,Yt,Xt,_e,Bt,_i,Vt,Ji,Ui]),r(()=>{if(!_t.open)return;const e=_t.anchorEl;if(!e)return;if(e.isConnected)return;const t=t=>{for(const[n,i]of Object.entries(t))if(i.current?.textContent===e.textContent)return n;return null},n=e.dataset?.deviationRefId||t(an.current)||t(un.current);if(!n)return;const i=un.current[n]?.current||an.current[n]?.current;i&&i.isConnected&&Bt(e=>({...e,anchorEl:i}))},[_t.open,_t.anchorEl,Me,je,Mn]);const{open:co,sectionIdx:ao,isOrphan:uo,badgeStyle:po,anchorEl:fo,sectionAnchorEl:go}=xt;r(()=>{if(!de.isStreamingEnabled)return;if(!co||null==ao)return;if(ao===Zn)return;const e="string"==typeof ao?ao.split(y)[0]:null,t=(e,n)=>{if(!e||!Array.isArray(e))return null;for(const i of e){if(i.id===n)return i;if(i.subsections?.length){const e=t(i.subsections,n);if(e)return e}}return null},n=e&&"string"==typeof e?t(Yt,e):null,i=e&&"string"==typeof e?t(Xt,e):null,o="number"==typeof ao?Yt[ao]||null:n||e&&(re?.nodes?.[e]||re?.[e])||null,r="number"==typeof ao?Xt[ao]||null:i,s=bi(fo,o,r,ao,uo,po);yt(e=>{if(!e.open)return e;return S(e.cognitiveData)===S(s.cognitiveData)&&S(e.deviationData)===S(s.deviationData)&&e.sectionTitle===s.sectionTitle&&e.refSectionTitle===s.refSectionTitle?e:{...e,...s,open:!0,anchorEl:e.anchorEl,sectionAnchorEl:e.sectionAnchorEl}})},[co,ao,uo,po,fo,go,Yt,Xt,bi]);const ho=s(({section:t,keyPath:n,depth:i=0,columnKey:o="left",parentNodeId:r="",sectionOffset:s,rhsOrphanVisualIndexes:l})=>e(G,{section:t,keyPath:n,depth:i,columnKey:o,parentNodeId:r,sectionOffset:s,rhsOrphanVisualIndexes:l}),[]),mo=o(()=>Yt.map((t,n)=>{const i=!t?.title&&!t?.content,o=!t?.refIndexes||0===t.refIndexes.length;return i&&o&&_e?null:e(W,{section:t,idx:n},t?.layoutKey??t?.id??`left-row-${n}`)}),[Yt,_e]),So=o(()=>Xt.map((t,n)=>{const i=!t?.title&&!t?.content,o=!t?.refIndexes||0===t.refIndexes.length;return i&&o&&_e?null:e(q,{section:t,idx:n},t?.layoutKey??t?.id??`right-row-${n}`)}),[Xt,_e]),vo=i(Ci);r(()=>{vo.current=Ci},[Ci]);const xo=i(Mn);r(()=>{xo.current=Mn},[Mn]);const yo=i(oo);r(()=>{yo.current=oo},[oo]);const Ro=i(Zi);r(()=>{Ro.current=Zi},[Zi]);const bo=i(qn);r(()=>{bo.current=qn},[qn]);const Co=i(Wn);r(()=>{Co.current=Wn},[Wn]);const wo=i(ho);r(()=>{wo.current=ho},[ho]);const Io=i(Ln);r(()=>{Io.current=Ln},[Ln]);const{cacheVersion:_o,getCacheKey:Bo,getCacheEntry:To,fetchCitationContext:Fo,prefetchCitationContexts:Eo,abortCitationContexts:Ao}=H(Ie),Do=o(()=>({isGuidelineMode:Vt,maintainRelativeOrder:!!_e,showDeviationBadges:Ee,isProposingFix:ve,proposingFixNodeId:xe,isRedlineFlow:ye,isSideBySide:vn,activeSideBySideSection:_n,scrollSyncLocked:Me,toggleScrollSyncLocked:Jn,summaryPopupAnchorEl:_t.anchorEl,connectedSections:je,proposedSections:Yt,existingSections:Xt,deviationNumberRegistry:Zt,deviationParentRegistry:en,treeData:re,displayConfig:de,deviationAnalysisStatus:We,resolvedMarkdownStyles:ct,unifiedNumbering:Yn,expandedSections:Mn,expandedSubSections:zn,setExpandedSubSections:Gn,getSectionCompareStyle:Ei,getSubSectionCompareStyle:Ai,getBadgeRef:Sn,getSectionRowRef:hn,getSubSectionRef:mn,sectionLeftRefs:ln,sectionRightRefs:cn,sectionRowRefs:gn,sectionRightRowRefs:dn,subSectionLeftRefs:pn,subSectionRightRefs:fn,lhsBadgeRefs:an,rhsBadgeRefs:un,openMoreFunctionsPopup:li,handleOpenSummaryPopup:ci,openSummaryPopup:ci,handleCloseSummaryPopup:ai,toggleSection:ui,handleSubSectionToggle:di,renderSubSectionAccordion:pi,resetSideBySide:fi,setConnectedSections:Le,setConnectedLines:Ne,cachedConnectedPositions:et,showDeviationNavigation:to,showOpenNodeRef:no,deviationNodeIdToView:me?.id,deviationTargetParentId:ro,guidelinesData:be,gptWebCitationConfig:we,onDemandCitationConfig:Ie,onDemandCitationCacheVersion:_o,getOnDemandCitationCacheKey:Bo,getOnDemandCitationCacheEntry:To,fetchOnDemandCitationContext:Fo,prefetchOnDemandCitationContexts:Eo,abortOnDemandCitationContexts:Ao}),[Vt,_e,Ee,ve,xe,ye,vn,_n,Me,Jn,_t.anchorEl,je,Yt,Xt,Zt,de,We,ct,Yn,Mn,zn,Gn,Ei,Ai,Sn,hn,mn,to,no,me,ro,be,we,Ie,_o,Bo,To,Fo,Eo,Ao]),Oo=S(xt.sectionTitle||zt||Mt),ko=S(Vt?Wt||qt||xt.refSectionTitle:xt.refSectionTitle||Wt||qt);return e(K,{value:Do,children:t(l,{ref:ut,sx:{display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif',overflow:"visible",position:"relative"},children:[Ae&&e(l,{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:e(k,{})}),_t.open&&e(V,{open:_t.open,anchorEl:_t.anchorEl,containerEl:Ti.current,clipTopEl:Je.current,scrollContainerEl:at.current,onClose:Zi,summary:_t.summary,displayImpact:_t.displayImpact,isScrollLocked:Me}),e(O,{open:Rt.open,anchorEl:Rt.anchorEl,maintainRelativeOrder:!!_e,sectionTitle:Rt.sectionTitle,referenceSectionTitle:Rt.refSectionTitle,onClose:kt,onOpenCognitiveCompare:At,onOpenSideBySide:Qi,onConnect:wi,isConnected:eo,isOrphan:!Vt&&!!Rt.isOrphan,isGuidelineMode:Vt,hasGuidelineMatches:Rt.hasGuidelineMatches}),xt.open&&e(D,{open:xt.open,popupRef:Et,position:Ct,popupConfig:ge,onClose:()=>{wt(null),yt(e=>({...e,open:!1})),Ft(null)},markdownStyles:ae,sectionTitle:Oo,referenceSectionTitle:ko,cognitiveData:xt.cognitiveData,anchorEl:xt.anchorEl,sectionAnchorEl:xt.sectionAnchorEl,scrollContainerEl:at.current,badgeStyle:xt.badgeStyle,docData:xt.docData,deviationData:xt.deviationData,isLoading:xt.isLoading,sourceNodeId:xt.sourceNodeId,deviationKey:xt.deviationKey,baseContentId:xt.baseContentId,compareContentIds:xt.compareContentIds}),e(c,{open:!!Oe,autoHideDuration:8e3,onClose:()=>ke(null),anchorOrigin:{vertical:"top",horizontal:"center"},children:e(a,{onClose:()=>ke(null),severity:"error",sx:{width:"100%",whiteSpace:"pre-line"},children:Oe})}),e(z,{componentHeaderText:oe,displayConfig:de,maintainRelativeOrder:_e,onCollapseAll:Hi,showCollapseAll:zi,onToggleView:e=>{De(!0),setTimeout(()=>{Be(!e),fe?.(!e),He(!1),Ln(),Tt(),Le(new Set),Ne([]),et.current=[],requestAnimationFrame(()=>{requestAnimationFrame(()=>{setTimeout(()=>{De(!1)},600)})})},50)}}),e(l,{ref:at,onScroll:Mi,sx:{flex:1,minHeight:0,pt:1.5,pb:1,px:3,display:"flex",justifyContent:"center",alignItems:_e?"stretch":"flex-start",bgcolor:"#FFFFFF",overflowY:_e?"visible":"auto",borderTop:Un&&Qn?"none":"1.5px solid #EEF0F4"},children:e(l,{sx:{display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px",minHeight:0,..._e?{flex:1}:{}},children:t(l,{ref:Ke,sx:{display:"grid",gridTemplateColumns:"minmax(0, 1fr) 180px minmax(0, 1fr)",gap:"100px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0,..._e?{flex:1,overflow:"visible"}:{}},children:[e(Q,{svgContainerRef:Ve,svgDimensions:Li,isResizing:bn,overallConnector:Pi,rootDeviationStyle:oi,lines:Oi,isSideBySide:vn,activeSideBySideSection:_n,isArrowVisible:xn,maintainRelativeOrder:_e,proposedSections:Yt,existingSections:Xt,cognitivePopup:xt,activeBadgeId:It,closeCognitivePopup:Ot,setActiveBadgeId:Ft,openCognitivePopupFromState:Dt,buildSectionPopupState:bi,connectedLines:$e,isGuidelineMode:Vt,deviationAnalysisStatus:We,pathRefs:Ze}),t(l,{sx:{border:"1px solid #E7E7E9",borderRadius:"8px",bgcolor:"#FFFFFF",display:"flex",flexDirection:"column",position:"relative",zIndex:2,filter:"drop-shadow(0px 2px 4px #F2F2F2)",..._e?{flex:1,overflow:"visible",minHeight:0}:{}},children:[e(l,{ref:Je,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E7E7E9",borderRadius:"8px 8px 0 0",display:"flex",alignItems:"center",minHeight:"40px",overflow:"hidden",minWidth:0},children:e(u,{title:Mt,placement:"top",children:e(d,{sx:{fontSize:"16px",fontWeight:500,color:"#19213D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0,textAlign:"center",display:"block"},children:Mt})})}),t(l,{ref:mt,onScroll:Mi,sx:{p:"12px",display:"flex",flexDirection:"column",..._e?{flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,mr:"-180px",pr:"192px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{}},children:[e("div",{ref:gt,style:{width:"100%",height:"0px",flexShrink:0}}),nn&&mo,e("div",{ref:ht,style:{width:"100%",height:"0px",flexShrink:0}})]})]}),e(l,{ref:Ti,sx:{width:"180px",display:"flex",flexDirection:"column",alignItems:"center",pt:"15px",gap:0,zIndex:20,pointerEvents:"none"},children:e(l,{sx:{display:"flex",justifyContent:"center",alignItems:"center",mt:0},children:t(l,{onClick:e=>{e.stopPropagation(),xt.open&&It===Zn?Ot():(Ft(Zn),Dt(bi(e.currentTarget,{title:Si,content:"",evaluationResult:ei,cognitiveData:{section_id:"",decisioning:[],gap:[],relevance_score:0,isMissingRationale:!0}},{title:xi,content:""},Zn,!0,{...oi,label:""})))},sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:"5px",top:"-8px",borderRadius:"20px",bgcolor:oi.badgeBg,color:oi.badgeText,border:`1px solid ${oi.badgeBorder}`,fontSize:"12px",fontWeight:600,whiteSpace:"nowrap",position:"relative",zIndex:1,pointerEvents:"auto",cursor:"pointer"},children:[ni?e(u,{title:"Deviation data generation in progress",placement:"top",arrow:!0,children:e(l,{component:"span",sx:{display:"inline-flex",alignItems:"center"},children:e(P,{color:oi.badgeText})})}):ii??e(P,{color:oi.badgeText}),e(l,{component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}},children:e(h,{})}),e(g,{size:11,style:{transform:xt.open&&It===Zn?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]})})}),t(l,{sx:{border:"1px solid #E3E6EA",borderRadius:"8px",bgcolor:"#FFFFFF",boxShadow:"0px 1px 4px #F7F4FE",position:"relative",zIndex:2,display:"flex",flexDirection:"column",minWidth:0,..._e?{flex:1,overflow:"visible",minHeight:0}:{}},children:[wn&&e(m,{sections:11}),e(l,{ref:Ye,sx:{p:"8px",bgcolor:Vt?"#F1F3F5":"#F7F8FA",borderBottom:"1px solid #D7DCE2",borderRadius:"8px 8px 0 0",display:"flex",alignItems:"center",flexShrink:0},children:Vt?t(p,{value:ze,onChange:Xi,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:[e(f,{label:e(u,{title:qt,placement:"top",children:e(l,{component:"span",sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"block",width:"100%"},children:"Redline Guidelines"})})}),st&&e(f,{label:e(u,{title:"Web & GPT Sources",placement:"top",children:e(l,{component:"span",sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"block",width:"100%"},children:"Web & GPT Sources"})})})]}):e(u,{title:qt,placement:"top",children:e(d,{sx:{fontSize:"16px",fontWeight:500,color:"#5928ED",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0,textAlign:"center",display:"block"},children:qt})})}),t(l,{ref:dt,onScroll:Mi,sx:{p:Vt?"0px":"12px",display:"flex",flexDirection:"column",..._e?{flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,ml:"-150px",pl:"165px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{}},children:[e("div",{ref:pt,style:{width:"100%",height:"0px",flexShrink:0}}),Vt?be?0!==ze&&st?e(ee,{deviationData:he,connectedSections:je,proposedSections:Yt}):e(Z,{guidelinesData:be,deviationData:he,connectedSections:je,proposedSections:Yt}):e(te,{}):nn&&So,e("div",{ref:ft,style:{width:"100%",height:"0px",flexShrink:0}})]})]})]})})})]})})};export{oe as default};
2
2
  //# sourceMappingURL=CognitiveCompare.js.map