@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.
- package/dist/cjs/features/CognitiveCompare/CitationAnchor.js +1 -1
- package/dist/cjs/features/CognitiveCompare/CitationAnchor.js.map +1 -1
- package/dist/cjs/features/CognitiveCompare/CitationRenderer.js +1 -1
- package/dist/cjs/features/CognitiveCompare/CitationRenderer.js.map +1 -1
- package/dist/cjs/features/CognitiveCompare/CitationRendererInner.js +2 -0
- package/dist/cjs/features/CognitiveCompare/CitationRendererInner.js.map +1 -0
- package/dist/cjs/features/CognitiveCompare/CognitiveCompare.js +1 -1
- package/dist/cjs/features/CognitiveCompare/CognitiveCompare.js.map +1 -1
- package/dist/cjs/features/CognitiveCompare/CognitiveCompareConstants.js +1 -1
- package/dist/cjs/features/CognitiveCompare/CognitiveCompareConstants.js.map +1 -1
- package/dist/cjs/features/CognitiveCompare/CognitiveComparehelpers.js +1 -1
- package/dist/cjs/features/CognitiveCompare/CognitiveComparehelpers.js.map +1 -1
- package/dist/cjs/features/CognitiveCompare/CognitivePopup.js +1 -1
- package/dist/cjs/features/CognitiveCompare/CognitivePopup.js.map +1 -1
- package/dist/cjs/features/CognitiveCompare/CompareContext.js +1 -1
- package/dist/cjs/features/CognitiveCompare/CompareContext.js.map +1 -1
- package/dist/cjs/features/CognitiveCompare/GptWebCitationPanel.js +2 -0
- package/dist/cjs/features/CognitiveCompare/GptWebCitationPanel.js.map +1 -0
- package/dist/cjs/features/CognitiveCompare/Guidelines/components/GuidelinePanel.js +1 -1
- package/dist/cjs/features/CognitiveCompare/Guidelines/components/GuidelinePanel.js.map +1 -1
- package/dist/cjs/features/CognitiveCompare/Guidelines/components/WebGptPanel.js +1 -1
- package/dist/cjs/features/CognitiveCompare/Guidelines/components/WebGptPanel.js.map +1 -1
- package/dist/cjs/features/CognitiveCompare/Guidelines/utils/guidelineTargets.js +2 -0
- package/dist/cjs/features/CognitiveCompare/Guidelines/utils/guidelineTargets.js.map +1 -0
- package/dist/cjs/features/CognitiveCompare/Guidelines/utils/hasGptCitationObjects.js +2 -0
- package/dist/cjs/features/CognitiveCompare/Guidelines/utils/hasGptCitationObjects.js.map +1 -0
- package/dist/cjs/features/CognitiveCompare/Guidelines/utils/processGuidelinesMarkdown.js +1 -1
- package/dist/cjs/features/CognitiveCompare/Guidelines/utils/processGuidelinesMarkdown.js.map +1 -1
- package/dist/cjs/features/CognitiveCompare/Guidelines/utils/resolveGuidelineSelection.js +2 -0
- package/dist/cjs/features/CognitiveCompare/Guidelines/utils/resolveGuidelineSelection.js.map +1 -0
- package/dist/cjs/features/CognitiveCompare/components/GuidelineSkeletonLoader.js +2 -0
- package/dist/cjs/features/CognitiveCompare/components/GuidelineSkeletonLoader.js.map +1 -0
- package/dist/cjs/features/CognitiveCompare/components/LHSSectionRow.js +1 -1
- package/dist/cjs/features/CognitiveCompare/components/LHSSectionRow.js.map +1 -1
- package/dist/cjs/features/CognitiveCompare/components/RHSSectionRow.js +1 -1
- package/dist/cjs/features/CognitiveCompare/components/RHSSectionRow.js.map +1 -1
- package/dist/cjs/features/CognitiveCompare/components/SectionAccordion.js +1 -1
- package/dist/cjs/features/CognitiveCompare/components/SectionAccordion.js.map +1 -1
- package/dist/cjs/features/CognitiveCompare/components/SubSectionAccordion.js +1 -1
- package/dist/cjs/features/CognitiveCompare/components/SubSectionAccordion.js.map +1 -1
- package/dist/cjs/features/CognitiveCompare/components/SvgConnectors.js +1 -1
- package/dist/cjs/features/CognitiveCompare/components/SvgConnectors.js.map +1 -1
- package/dist/cjs/features/CognitiveCompare/hooks/memoizedMarkdown.js +1 -1
- package/dist/cjs/features/CognitiveCompare/hooks/memoizedMarkdown.js.map +1 -1
- package/dist/cjs/features/CognitiveCompare/hooks/useCompareData.js +1 -1
- package/dist/cjs/features/CognitiveCompare/hooks/useCompareData.js.map +1 -1
- package/dist/cjs/features/CognitiveCompare/hooks/useLinesCalculator.js +1 -1
- package/dist/cjs/features/CognitiveCompare/hooks/useLinesCalculator.js.map +1 -1
- package/dist/cjs/features/CognitiveCompare/hooks/useOnDemandCitationCache.js +2 -0
- package/dist/cjs/features/CognitiveCompare/hooks/useOnDemandCitationCache.js.map +1 -0
- package/dist/cjs/features/CognitiveCompare/hooks/useSideBySide.js +1 -1
- package/dist/cjs/features/CognitiveCompare/hooks/useSideBySide.js.map +1 -1
- package/dist/cjs/features/CognitiveCompare/onDemandCitations/cacheKey.js +2 -0
- package/dist/cjs/features/CognitiveCompare/onDemandCitations/cacheKey.js.map +1 -0
- package/dist/cjs/features/CognitiveCompare/onDemandCitations/contextBuilder.js +2 -0
- package/dist/cjs/features/CognitiveCompare/onDemandCitations/contextBuilder.js.map +1 -0
- package/dist/cjs/features/CognitiveCompare/onDemandCitations/href.js +2 -0
- package/dist/cjs/features/CognitiveCompare/onDemandCitations/href.js.map +1 -0
- package/dist/cjs/features/CognitiveCompare/onDemandCitations/payload.js +2 -0
- package/dist/cjs/features/CognitiveCompare/onDemandCitations/payload.js.map +1 -0
- package/dist/cjs/features/CognitiveCompare/onDemandCitations/response.js +2 -0
- package/dist/cjs/features/CognitiveCompare/onDemandCitations/response.js.map +1 -0
- package/dist/cjs/features/CognitiveCompare/utils/normalizeCompactedGfmTables.js +2 -0
- package/dist/cjs/features/CognitiveCompare/utils/normalizeCompactedGfmTables.js.map +1 -0
- package/dist/cjs/features/CognitiveCompare/utils/normalizeInlineMarkdown.js +2 -0
- package/dist/cjs/features/CognitiveCompare/utils/normalizeInlineMarkdown.js.map +1 -0
- package/dist/cjs/features/CognitiveCompare/utils/normalizeRedlineMarkdown.js +2 -0
- package/dist/cjs/features/CognitiveCompare/utils/normalizeRedlineMarkdown.js.map +1 -0
- package/dist/cjs/features/PdfViewer/PdfContainer.js +1 -1
- package/dist/cjs/features/PdfViewer/PdfContainer.js.map +1 -1
- package/dist/cjs/features/PdfViewer/PdfViewer.js +1 -1
- package/dist/cjs/features/PdfViewer/PdfViewer.js.map +1 -1
- package/dist/cjs/features/SegmentReviewComponents/ApprovalDescriptionBanner.js +2 -0
- package/dist/cjs/features/SegmentReviewComponents/ApprovalDescriptionBanner.js.map +1 -0
- package/dist/cjs/features/SegmentReviewComponents/BoundaryCard.js +1 -1
- package/dist/cjs/features/SegmentReviewComponents/BoundaryCard.js.map +1 -1
- package/dist/cjs/features/SegmentReviewComponents/RevertCard.js +1 -1
- package/dist/cjs/features/SegmentReviewComponents/RevertCard.js.map +1 -1
- package/dist/cjs/features/SegmentReviewComponents/SaveAsLearningCard.js +2 -0
- package/dist/cjs/features/SegmentReviewComponents/SaveAsLearningCard.js.map +1 -0
- package/dist/cjs/features/SegmentReviewComponents/SegmentReviewPdfWrapper.js +1 -1
- package/dist/cjs/features/SegmentReviewComponents/SegmentReviewPdfWrapper.js.map +1 -1
- package/dist/cjs/hooks/useOnDemandCitationFetch.js +1 -1
- package/dist/cjs/hooks/useOnDemandCitationFetch.js.map +1 -1
- package/dist/cjs/service/onDemandApi.js +1 -1
- package/dist/cjs/service/onDemandApi.js.map +1 -1
- package/dist/features/CognitiveCompare/CitationAnchor.js +1 -1
- package/dist/features/CognitiveCompare/CitationAnchor.js.map +1 -1
- package/dist/features/CognitiveCompare/CitationRenderer.js +1 -1
- package/dist/features/CognitiveCompare/CitationRenderer.js.map +1 -1
- package/dist/features/CognitiveCompare/CitationRendererInner.js +2 -0
- package/dist/features/CognitiveCompare/CitationRendererInner.js.map +1 -0
- package/dist/features/CognitiveCompare/CognitiveCompare.js +1 -1
- package/dist/features/CognitiveCompare/CognitiveCompare.js.map +1 -1
- package/dist/features/CognitiveCompare/CognitiveCompareConstants.js +1 -1
- package/dist/features/CognitiveCompare/CognitiveCompareConstants.js.map +1 -1
- package/dist/features/CognitiveCompare/CognitiveComparehelpers.js +1 -1
- package/dist/features/CognitiveCompare/CognitiveComparehelpers.js.map +1 -1
- package/dist/features/CognitiveCompare/CognitivePopup.js +1 -1
- package/dist/features/CognitiveCompare/CognitivePopup.js.map +1 -1
- package/dist/features/CognitiveCompare/CompareContext.js +1 -1
- package/dist/features/CognitiveCompare/CompareContext.js.map +1 -1
- package/dist/features/CognitiveCompare/GptWebCitationPanel.js +2 -0
- package/dist/features/CognitiveCompare/GptWebCitationPanel.js.map +1 -0
- package/dist/features/CognitiveCompare/Guidelines/components/GuidelinePanel.js +1 -1
- package/dist/features/CognitiveCompare/Guidelines/components/GuidelinePanel.js.map +1 -1
- package/dist/features/CognitiveCompare/Guidelines/components/WebGptPanel.js +1 -1
- package/dist/features/CognitiveCompare/Guidelines/components/WebGptPanel.js.map +1 -1
- package/dist/features/CognitiveCompare/Guidelines/utils/guidelineTargets.js +2 -0
- package/dist/features/CognitiveCompare/Guidelines/utils/guidelineTargets.js.map +1 -0
- package/dist/features/CognitiveCompare/Guidelines/utils/hasGptCitationObjects.js +2 -0
- package/dist/features/CognitiveCompare/Guidelines/utils/hasGptCitationObjects.js.map +1 -0
- package/dist/features/CognitiveCompare/Guidelines/utils/processGuidelinesMarkdown.js +1 -1
- package/dist/features/CognitiveCompare/Guidelines/utils/processGuidelinesMarkdown.js.map +1 -1
- package/dist/features/CognitiveCompare/Guidelines/utils/resolveGuidelineSelection.js +2 -0
- package/dist/features/CognitiveCompare/Guidelines/utils/resolveGuidelineSelection.js.map +1 -0
- package/dist/features/CognitiveCompare/components/GuidelineSkeletonLoader.js +2 -0
- package/dist/features/CognitiveCompare/components/GuidelineSkeletonLoader.js.map +1 -0
- package/dist/features/CognitiveCompare/components/LHSSectionRow.js +1 -1
- package/dist/features/CognitiveCompare/components/LHSSectionRow.js.map +1 -1
- package/dist/features/CognitiveCompare/components/RHSSectionRow.js +1 -1
- package/dist/features/CognitiveCompare/components/RHSSectionRow.js.map +1 -1
- package/dist/features/CognitiveCompare/components/SectionAccordion.js +1 -1
- package/dist/features/CognitiveCompare/components/SectionAccordion.js.map +1 -1
- package/dist/features/CognitiveCompare/components/SubSectionAccordion.js +1 -1
- package/dist/features/CognitiveCompare/components/SubSectionAccordion.js.map +1 -1
- package/dist/features/CognitiveCompare/components/SvgConnectors.js +1 -1
- package/dist/features/CognitiveCompare/components/SvgConnectors.js.map +1 -1
- package/dist/features/CognitiveCompare/hooks/memoizedMarkdown.js +1 -1
- package/dist/features/CognitiveCompare/hooks/memoizedMarkdown.js.map +1 -1
- package/dist/features/CognitiveCompare/hooks/useCompareData.js +1 -1
- package/dist/features/CognitiveCompare/hooks/useCompareData.js.map +1 -1
- package/dist/features/CognitiveCompare/hooks/useLinesCalculator.js +1 -1
- package/dist/features/CognitiveCompare/hooks/useLinesCalculator.js.map +1 -1
- package/dist/features/CognitiveCompare/hooks/useOnDemandCitationCache.js +2 -0
- package/dist/features/CognitiveCompare/hooks/useOnDemandCitationCache.js.map +1 -0
- package/dist/features/CognitiveCompare/hooks/useSideBySide.js +1 -1
- package/dist/features/CognitiveCompare/hooks/useSideBySide.js.map +1 -1
- package/dist/features/CognitiveCompare/onDemandCitations/cacheKey.js +2 -0
- package/dist/features/CognitiveCompare/onDemandCitations/cacheKey.js.map +1 -0
- package/dist/features/CognitiveCompare/onDemandCitations/contextBuilder.js +2 -0
- package/dist/features/CognitiveCompare/onDemandCitations/contextBuilder.js.map +1 -0
- package/dist/features/CognitiveCompare/onDemandCitations/href.js +2 -0
- package/dist/features/CognitiveCompare/onDemandCitations/href.js.map +1 -0
- package/dist/features/CognitiveCompare/onDemandCitations/payload.js +2 -0
- package/dist/features/CognitiveCompare/onDemandCitations/payload.js.map +1 -0
- package/dist/features/CognitiveCompare/onDemandCitations/response.js +2 -0
- package/dist/features/CognitiveCompare/onDemandCitations/response.js.map +1 -0
- package/dist/features/CognitiveCompare/utils/normalizeCompactedGfmTables.js +2 -0
- package/dist/features/CognitiveCompare/utils/normalizeCompactedGfmTables.js.map +1 -0
- package/dist/features/CognitiveCompare/utils/normalizeInlineMarkdown.js +2 -0
- package/dist/features/CognitiveCompare/utils/normalizeInlineMarkdown.js.map +1 -0
- package/dist/features/CognitiveCompare/utils/normalizeRedlineMarkdown.js +2 -0
- package/dist/features/CognitiveCompare/utils/normalizeRedlineMarkdown.js.map +1 -0
- package/dist/features/PdfViewer/PdfContainer.js +1 -1
- package/dist/features/PdfViewer/PdfContainer.js.map +1 -1
- package/dist/features/PdfViewer/PdfViewer.js +1 -1
- package/dist/features/PdfViewer/PdfViewer.js.map +1 -1
- package/dist/features/SegmentReviewComponents/ApprovalDescriptionBanner.js +2 -0
- package/dist/features/SegmentReviewComponents/ApprovalDescriptionBanner.js.map +1 -0
- package/dist/features/SegmentReviewComponents/BoundaryCard.js +1 -1
- package/dist/features/SegmentReviewComponents/BoundaryCard.js.map +1 -1
- package/dist/features/SegmentReviewComponents/RevertCard.js +1 -1
- package/dist/features/SegmentReviewComponents/RevertCard.js.map +1 -1
- package/dist/features/SegmentReviewComponents/SaveAsLearningCard.js +2 -0
- package/dist/features/SegmentReviewComponents/SaveAsLearningCard.js.map +1 -0
- package/dist/features/SegmentReviewComponents/SegmentReviewPdfWrapper.js +1 -1
- package/dist/features/SegmentReviewComponents/SegmentReviewPdfWrapper.js.map +1 -1
- package/dist/hooks/useOnDemandCitationFetch.js +1 -1
- package/dist/hooks/useOnDemandCitationFetch.js.map +1 -1
- package/dist/service/onDemandApi.js +1 -1
- package/dist/service/onDemandApi.js.map +1 -1
- package/dist/types/features/CognitiveCompare/CitationAnchor.d.ts +2 -0
- package/dist/types/features/CognitiveCompare/CitationAnchor.d.ts.map +1 -1
- package/dist/types/features/CognitiveCompare/CitationRenderer.d.ts +8 -1
- package/dist/types/features/CognitiveCompare/CitationRenderer.d.ts.map +1 -1
- package/dist/types/features/CognitiveCompare/CitationRendererInner.d.ts +13 -0
- package/dist/types/features/CognitiveCompare/CitationRendererInner.d.ts.map +1 -0
- package/dist/types/features/CognitiveCompare/CognitiveCompare.d.ts +1 -1
- package/dist/types/features/CognitiveCompare/CognitiveCompare.d.ts.map +1 -1
- package/dist/types/features/CognitiveCompare/CognitiveCompareConstants.d.ts +1 -1
- package/dist/types/features/CognitiveCompare/CognitiveCompareConstants.d.ts.map +1 -1
- package/dist/types/features/CognitiveCompare/CognitiveCompareTypes.d.ts +14 -1
- package/dist/types/features/CognitiveCompare/CognitiveCompareTypes.d.ts.map +1 -1
- package/dist/types/features/CognitiveCompare/CognitiveComparehelpers.d.ts +12 -0
- package/dist/types/features/CognitiveCompare/CognitiveComparehelpers.d.ts.map +1 -1
- package/dist/types/features/CognitiveCompare/CognitivePopup.d.ts.map +1 -1
- package/dist/types/features/CognitiveCompare/CompareContext.d.ts +10 -1
- package/dist/types/features/CognitiveCompare/CompareContext.d.ts.map +1 -1
- package/dist/types/features/CognitiveCompare/GptWebCitationPanel.d.ts +7 -0
- package/dist/types/features/CognitiveCompare/GptWebCitationPanel.d.ts.map +1 -0
- package/dist/types/features/CognitiveCompare/Guidelines/components/GuidelinePanel.d.ts.map +1 -1
- package/dist/types/features/CognitiveCompare/Guidelines/components/WebGptPanel.d.ts.map +1 -1
- package/dist/types/features/CognitiveCompare/Guidelines/utils/guidelineTargets.d.ts +3 -0
- package/dist/types/features/CognitiveCompare/Guidelines/utils/guidelineTargets.d.ts.map +1 -0
- package/dist/types/features/CognitiveCompare/Guidelines/utils/hasGptCitationObjects.d.ts +3 -0
- package/dist/types/features/CognitiveCompare/Guidelines/utils/hasGptCitationObjects.d.ts.map +1 -0
- package/dist/types/features/CognitiveCompare/Guidelines/utils/processGuidelinesMarkdown.d.ts +14 -1
- package/dist/types/features/CognitiveCompare/Guidelines/utils/processGuidelinesMarkdown.d.ts.map +1 -1
- package/dist/types/features/CognitiveCompare/Guidelines/utils/resolveGuidelineSelection.d.ts +19 -0
- package/dist/types/features/CognitiveCompare/Guidelines/utils/resolveGuidelineSelection.d.ts.map +1 -0
- package/dist/types/features/CognitiveCompare/components/GuidelineSkeletonLoader.d.ts +8 -0
- package/dist/types/features/CognitiveCompare/components/GuidelineSkeletonLoader.d.ts.map +1 -0
- package/dist/types/features/CognitiveCompare/components/LHSSectionRow.d.ts.map +1 -1
- package/dist/types/features/CognitiveCompare/components/RHSSectionRow.d.ts.map +1 -1
- package/dist/types/features/CognitiveCompare/components/SectionAccordion.d.ts.map +1 -1
- package/dist/types/features/CognitiveCompare/components/SubSectionAccordion.d.ts.map +1 -1
- package/dist/types/features/CognitiveCompare/components/SvgConnectors.d.ts +3 -2
- package/dist/types/features/CognitiveCompare/components/SvgConnectors.d.ts.map +1 -1
- package/dist/types/features/CognitiveCompare/hooks/memoizedMarkdown.d.ts +2 -1
- package/dist/types/features/CognitiveCompare/hooks/memoizedMarkdown.d.ts.map +1 -1
- package/dist/types/features/CognitiveCompare/hooks/useCompareData.d.ts +1 -1
- package/dist/types/features/CognitiveCompare/hooks/useCompareData.d.ts.map +1 -1
- package/dist/types/features/CognitiveCompare/hooks/useLinesCalculator.d.ts.map +1 -1
- package/dist/types/features/CognitiveCompare/hooks/useOnDemandCitationCache.d.ts +10 -0
- package/dist/types/features/CognitiveCompare/hooks/useOnDemandCitationCache.d.ts.map +1 -0
- package/dist/types/features/CognitiveCompare/hooks/useSideBySide.d.ts.map +1 -1
- package/dist/types/features/CognitiveCompare/onDemandCitations/cacheKey.d.ts +3 -0
- package/dist/types/features/CognitiveCompare/onDemandCitations/cacheKey.d.ts.map +1 -0
- package/dist/types/features/CognitiveCompare/onDemandCitations/contextBuilder.d.ts +16 -0
- package/dist/types/features/CognitiveCompare/onDemandCitations/contextBuilder.d.ts.map +1 -0
- package/dist/types/features/CognitiveCompare/onDemandCitations/href.d.ts +6 -0
- package/dist/types/features/CognitiveCompare/onDemandCitations/href.d.ts.map +1 -0
- package/dist/types/features/CognitiveCompare/onDemandCitations/index.d.ts +7 -0
- package/dist/types/features/CognitiveCompare/onDemandCitations/index.d.ts.map +1 -0
- package/dist/types/features/CognitiveCompare/onDemandCitations/payload.d.ts +4 -0
- package/dist/types/features/CognitiveCompare/onDemandCitations/payload.d.ts.map +1 -0
- package/dist/types/features/CognitiveCompare/onDemandCitations/response.d.ts +3 -0
- package/dist/types/features/CognitiveCompare/onDemandCitations/response.d.ts.map +1 -0
- package/dist/types/features/CognitiveCompare/onDemandCitations/types.d.ts +134 -0
- package/dist/types/features/CognitiveCompare/onDemandCitations/types.d.ts.map +1 -0
- package/dist/types/features/CognitiveCompare/utils/normalizeCompactedGfmTables.d.ts +7 -0
- package/dist/types/features/CognitiveCompare/utils/normalizeCompactedGfmTables.d.ts.map +1 -0
- package/dist/types/features/CognitiveCompare/utils/normalizeInlineMarkdown.d.ts +6 -0
- package/dist/types/features/CognitiveCompare/utils/normalizeInlineMarkdown.d.ts.map +1 -0
- package/dist/types/features/CognitiveCompare/utils/normalizeRedlineMarkdown.d.ts +6 -0
- package/dist/types/features/CognitiveCompare/utils/normalizeRedlineMarkdown.d.ts.map +1 -0
- package/dist/types/features/PdfViewer/PdfContainer.d.ts +3 -2
- package/dist/types/features/PdfViewer/PdfContainer.d.ts.map +1 -1
- package/dist/types/features/PdfViewer/PdfViewer.d.ts +3 -2
- package/dist/types/features/PdfViewer/PdfViewer.d.ts.map +1 -1
- package/dist/types/features/SegmentReviewComponents/ApprovalDescriptionBanner.d.ts +11 -0
- package/dist/types/features/SegmentReviewComponents/ApprovalDescriptionBanner.d.ts.map +1 -0
- package/dist/types/features/SegmentReviewComponents/BoundaryCard.d.ts.map +1 -1
- package/dist/types/features/SegmentReviewComponents/RevertCard.d.ts +9 -1
- package/dist/types/features/SegmentReviewComponents/RevertCard.d.ts.map +1 -1
- package/dist/types/features/SegmentReviewComponents/SaveAsLearningCard.d.ts +15 -0
- package/dist/types/features/SegmentReviewComponents/SaveAsLearningCard.d.ts.map +1 -0
- package/dist/types/features/SegmentReviewComponents/SegmentReviewPdfWrapper.d.ts +14 -1
- package/dist/types/features/SegmentReviewComponents/SegmentReviewPdfWrapper.d.ts.map +1 -1
- package/dist/types/hooks/useOnDemandCitationFetch.d.ts.map +1 -1
- package/dist/types/service/onDemandApi.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/cjs/features/Bookemon/BookemonStyles.js +0 -2
- package/dist/cjs/features/Bookemon/BookemonStyles.js.map +0 -1
- package/dist/cjs/lib/ui/icons.js +0 -2
- package/dist/cjs/lib/ui/icons.js.map +0 -1
- package/dist/cjs/lib/ui/materialCompat.js +0 -2
- package/dist/cjs/lib/ui/materialCompat.js.map +0 -1
- package/dist/features/Bookemon/BookemonStyles.js +0 -2
- package/dist/features/Bookemon/BookemonStyles.js.map +0 -1
- package/dist/lib/ui/icons.js +0 -2
- package/dist/lib/ui/icons.js.map +0 -1
- package/dist/lib/ui/materialCompat.js +0 -2
- package/dist/lib/ui/materialCompat.js.map +0 -1
- package/dist/types/features/Bookemon/BookemonStyles.d.ts +0 -6
- package/dist/types/features/Bookemon/BookemonStyles.d.ts.map +0 -1
- package/dist/types/lib/ui/icons.d.ts +0 -46
- package/dist/types/lib/ui/icons.d.ts.map +0 -1
- package/dist/types/lib/ui/materialCompat.d.ts +0 -117
- package/dist/types/lib/ui/materialCompat.d.ts.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsxs as e,jsx as t}from"react/jsx-runtime";import n,{useEffect as i}from"react";import{Box as o,Accordion as r,AccordionSummary as d,Tooltip as s,Typography as l,AccordionDetails as c}from"@mui/material";import{ChevronUp as a,ChevronDown as u}from"lucide-react";import{MemoizedMarkdown as f}from"../hooks/memoizedMarkdown.js";import{useCompareContext as p}from"../CompareContext.js";import{hasValue as h,hasMeaningfulRedlineTags as g,stripRedlineTags as x,hasSingleMappedLhsSection as m,generateColorPalette as I,getLhsDeviationDisplayIndexes as v,isMissingStr as y,getRhsMappedSectionNumber as b,safeStringify as w,DEVIATION_BADGE_SEPARATOR as S}from"../CognitiveComparehelpers.js";import{DEFAULT_DEVIAION_COLOR as R}from"../CognitiveCompareConstants.js";const $=(n,i=!1)=>{if(!n)return null;return w(n).replace(/\\n/g,"\n").split(/(\*\*.*?\*\*)/g).map((n,o)=>n.startsWith("**")&&n.endsWith("**")?t("strong",{children:n.slice(2,-2)},o):e("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"8px",width:"100%"},children:[t("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n}),i&&t("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",padding:"0px 6px",borderRadius:"9999px",background:"#F3F4F6",border:"1px solid #D1D5DB",color:"#6B7280",fontSize:"9px",fontWeight:500,whiteSpace:"nowrap",flexShrink:0,lineHeight:1.4,marginRight:"4px"},children:"Multiple"})]},o))},_=({section:_,idx:F,columnKey:M,colRef:k,mb:N=1,isExpanded:B,onToggle:C,navigation:E,parentNodeId:A=""})=>{const{showOpenNodeRef:O,resolvedMarkdownStyles:j,maintainRelativeOrder:W,showDeviationBadges:T=!1,renderSubSectionAccordion:D,treeData:P,proposedSections:K,existingSections:z,deviationNumberRegistry:G,deviationParentRegistry:L,getBadgeRef:X,openSummaryPopup:H,getSectionCompareStyle:V,connectedSections:Y,openMoreFunctionsPopup:q,isProposingFix:J,proposingFixNodeId:Q,isRedlineFlow:U,isSideBySide:Z,activeSideBySideSection:ee,scrollSyncLocked:te,unifiedNumbering:ne,toggleScrollSyncLocked:ie,summaryPopupAnchorEl:oe}=p(),re=`${Z?"1":"0"}-${String(ee??"")}`,de=(_.displayTitle??!0)&&h(_.title),se=!(!J||!Q||"left"!==M||_.id!==Q&&_.nodeId!==Q),le=g(_.content),ce="boolean"==typeof U?U:le,ae=le,ue=ce&&le,fe=ue?x(_.content):_.content,pe=ue?_.content:void 0,he=((_.displayContent??!0)||le)&&h(_.content),ge=!de&&!he;let xe=_.title;de||(xe=he?"No Title Found":"No Matching Section Found");const me="left"===M&&(_.isMultipleMapping||(_.refContentIds?.length??1)>1),Ie="left"===M&&xe.length>29?`${xe.slice(0,29).trimEnd()}...`:xe;let ve=_.evaluationResult;if(!ve&&"right"===M)if(W){const e=_.refIndexes?.[0],t=K.find(t=>t.selfIndex===e);ve=t?.evaluationResult}else ve=K[F]?.evaluationResult;const ye=P?.input_index_map?.[0],be=P?.input_index_map?.[1],we="left"===M?be:ye,Se=(e,t)=>{if(!t||!e)return null;for(const n of e){if(n.id===t||n.nodeId===t||n.contentId===t)return n;if(n.subsections?.length){const e=Se(n.subsections,t);if(e)return e}}return null};let Re="left"===M?_:Se(K,_.id),$e="right"===M?_:Se(z,_.id);const _e=n.useMemo(()=>{if(!W)return 0;let e=1/0;const t=e=>{const t=g(e)?x(e):e;return w(t||"").replace(/\\n/g,"\n")},n=(i,o,r,d)=>{if(!i)return;let s=i.nodeId||i.id;if(d&&"right"===M){const e=K.filter(e=>e.refIndexes?.includes(i.selfIndex));e.length>0&&(s=e[0].nodeId||e[0].id)}let l=i.nodeId||i.id||o?.nodeId||o?.id||r?.nodeId||r?.id;const c=i.evaluationResult||o?.evaluationResult||r?.evaluationResult,a=c?.deviations||{};Object.keys(a).forEach(n=>{const d=a[n]?.[A];if(!((e,n)=>{if("string"!=typeof n||y(n))return!1;const i=t(e?.content),o=t(n);return!!o&&i.includes(o)})("left"===M?o||i:r||i,d))return;const c=`${s}${S}${n}`,u=G?.[c];null!=u&&u<e&&(e=u);const f=`${l}${S}${n}`,p=G?.[f];null!=p&&p<e&&(e=p)});const u=i.subsections||[],f=o?.subsections||[],p=r?.subsections||[],h=Math.max(u.length,f.length,p.length);for(let e=0;e<h;e++)n(u[e],f[e],p[e],!1)},i="right"===M?K.filter(e=>e.refIndexes?.includes(_.selfIndex)):[];if(1===i.length){const e=i[0];(e.refIndexes||[]).map(e=>z.find(t=>t.selfIndex===e)).filter(Boolean).forEach(t=>{n(t,e,t,!0)})}else n(_,Re,$e,!0);return e!==1/0?e-1:0},[_,Re,$e,M,A,G,W,K,z]);if(W)if("left"===M){const e=_.refIndexes?.[0],t=z.findIndex(t=>t.selfIndex===e);$e=-1!==t?z[t]:Se(z,_.id)}else{const e=_.refIndexes?.[0],t=K.findIndex(t=>t.selfIndex===e);Re=-1!==t?K[t]:Se(K,_.id)}const Fe="left"===M?!$e:!Re,Me=W&&"right"===M&&m(_,K),ke=ve||Re?.evaluationResult||$e?.evaluationResult,Ne=ke?.evaluation_outputs?.metadata?.label_color??R,Be=I(Ne),{highlightBg:Ce}=Be,Ee=ke?.deviations||{},Ae=n.useMemo(()=>W&&"right"===M?v(K,ye,G):new Map,[W,M,K,ye,G]);let Oe=_.nodeId||_.id;if(W&&"left"!==M){const e=K.filter(e=>e.refIndexes?.includes(_.selfIndex));e.length>0?Oe=e[0].nodeId||e[0].id:Re?.id&&(Oe=Re.nodeId||Re.id)}const je=n.useMemo(()=>{const e=new Map;if(!W||"right"!==M)return e;let t=1;const n=K.filter(e=>e.refIndexes?.includes(_.selfIndex)),i=1===n.length&&1===n[0].refIndexes?.length,o=e=>w(e||"").replace(/\\n/g,"\n"),r=(e,t)=>{const i=t?n[0]:Se(K,e.nodeId||e.id||e.contentId);return{lhsNode:i,evalResult:e.evaluationResult||i?.evaluationResult,registryNodeId:i?i.nodeId||i.id:e.nodeId||e.id}};if(i){const e=(n,i=!1)=>{if(!n)return;const{lhsNode:d,evalResult:s,registryNodeId:l}=r(n,i),c=o(n.content);Object.entries(s?.deviations||{}).forEach(([e,n])=>{const i=n[A],r=o(i);if(!(!!d&&!y(n[we]))||!r||!c.includes(r))return;const s=G[`${l}${S}${e}`];null!=s&&(t=Math.max(t,Math.max(1,s-(_e||0))+1))}),(n.subsections||[]).forEach(t=>e(t))};e(_,!0)}const d=(n,i=!1)=>{if(!n)return;const{lhsNode:s,evalResult:l,registryNodeId:c}=r(n,i),a=l?.deviations||{},u=o(n.content);Object.entries(a).map(([e,t])=>{const n=t[A],i=!s||y(t[we]),r=o(n),d=r?u.indexOf(r):-1,l=`${c}${S}${e}`;return{refId:l,isRenderable:i&&!!r&&!y(n),position:d,registryIndex:G[l]??Number.MAX_SAFE_INTEGER}}).filter(e=>e.isRenderable).sort((e,t)=>(-1===e.position?Number.MAX_SAFE_INTEGER:e.position)-(-1===t.position?Number.MAX_SAFE_INTEGER:t.position)||e.registryIndex-t.registryIndex).forEach(n=>{e.set(n.refId,t++)}),(n.subsections||[]).forEach(e=>d(e))};return d(_,!0),e},[W,M,_,K,A,we,G,_e]),We=Object.keys(Ee)[0],Te=We?`${Oe}${S}${We}`:null,De=Te?L?.[Te]:null;let Pe=F+1;if(W&&ne){const e="left"===M?ne.leftNums.get(_?.id):ne.rightNums.get(_?.id);Fe&&void 0!==e?Pe=e:null!=De&&De>=0?Pe=De:void 0!==e&&(Pe=e)}else null!=De&&De>=0&&(Pe=De);const Ke=Object.entries(Ee).map(([e,t])=>{const n=`${Oe}${S}${e}`;return{deviationKey:e,deviationMap:t,refId:n,currentIndex:G[n]}}).filter(e=>void 0!==e.currentIndex&&null!==e.currentIndex);Ke.sort((e,t)=>e.currentIndex-t.currentIndex);const ze=Ke.map(e=>{const{deviationKey:t,deviationMap:n,refId:i}=e;let o=e.currentIndex,r=n[A];const d=y(r);if(d)r="";else if(!r)return null;let s=F,l=F;if(W)if("left"===M){const e=_.refIndexes?.[0],t=z.findIndex(t=>t.selfIndex===e);if(-1!==t)l=t;else{const e=z.findIndex(e=>e.id===_.id||e.nodeId===_.nodeId||e.contentId===_.contentId);l=-1!==e?e:F}}else{const e=_.refIndexes?.[0],t=K.findIndex(t=>t.selfIndex===e);if(-1!==t)s=t;else{const e=K.findIndex(e=>e.id===_.id||e.nodeId===_.nodeId||e.contentId===_.contentId);s=-1!==e?e:F}}const c=`${Oe}${S}${t}${S}${s}${S}${l}`,a=n[we],u=Fe||y(a),f=je.get(i),p=Ae.get(i);W&&"right"===M&&u&&void 0!==f?o=f:W&&"right"===M&&!u&&void 0!==p?o=p:W&&void 0!==_e&&("right"!==M||u||Me)&&(o-=_e),o=Math.max(1,o);const h=`${W&&"right"===M&&u&&ne?b({section:_,proposedSections:K,leftNums:ne.leftNums,fallbackNumber:String(Pe),firstOnly:!0}):Pe}.${o}`;let g=F;if("right"===M&&W){const e=_.refIndexes?.[0],t=K.findIndex(t=>t.selfIndex===e);if(-1!==t)g=t;else{const e=K.findIndex(e=>e.id===_.id||e.nodeId===_.nodeId||e.contentId===_.contentId);-1!==e&&(g=e)}}const x=V?V(g):null,m=n?.evaluation_outputs||ke?.evaluation_outputs,v=m?.output_value??null,w=I(m?.metadata?.label_color??Ne);let R=x?{...x,badgeBg:w.badgeBg,badgeBorder:w.badgeBorder,badgeText:w.badgeText}:{...w};const $=n?.deviation_summary?{deviation_summary:n.deviation_summary,deviation_title:n?.deviation_title||ke?.deviation_title,deviation_impact:n?.deviation_impact||ke?.deviation_impact,deviation_explanation:n?.deviation_explanation||ke?.deviation_explanation,evaluation_outputs:m,cognitive_decisioning:n?.cognitive_decisioning||ke?.cognitive_decisioning}:null;let k=0;const N=fe||"";if(r&&N){const e=N.split(/\n{2,}/),n=e.findIndex(e=>e.includes(r));if(-1!==n){const i=Object.entries(Ee).filter(([t,i])=>{const o=i[A];return o&&e[n].includes(o)}).sort((t,i)=>e[n].indexOf(t[1][A])-e[n].indexOf(i[1][A])).filter(([e,t])=>{const n=t[A];return n&&(n.includes(r)||r.includes(n))});i.length>1&&(k=Math.max(0,i.findIndex(([e])=>e===t)))}}const B=X(M,i);return{id:i,actionId:c,label:h,highlight:r,side:M,style:R,stackIndex:k,score:v,isConnected:Y?.has(c),showScrollLockToggle:Y?.has(c)||Z&&ee===c||!!oe&&oe===B.current,scrollSyncLocked:te,toggleScrollSyncLocked:ie,isOrphan:u,isMissingClause:d,badgeRef:B,onClick:e=>{e.stopPropagation(),q&&q(e,Re||{id:"orphan-left",title:"",content:""},u,$e||{id:"orphan-right",title:"",content:""},c,R)},onSummaryClick:e=>{e.stopPropagation(),H(e,c,u,$)}}}).filter(Boolean),Ge=T||!ce&&se?ze:[],Le=ze.map(e=>e.highlight).filter(Boolean),Xe=_.id&&M===E?.columnKey?E:null,He=n.useRef(!1);return i(()=>{B||(He.current=!1)},[B]),e(o,{ref:k,sx:{mb:N,width:"100%",display:"flex",flexDirection:"column",position:"relative",minWidth:0},children:[B&&Xe?.showAbove&&t("div",{style:{position:"sticky",top:0,height:"0px",cursor:"pointer"},onClick:()=>Xe?.showAboveRef?.current?.scrollIntoView({behavior:"smooth",block:"center"}),children:t("div",{style:{transform:`translateY(-50%) translateX(calc(100% ${"left"===M?"+":"-"} 130px))`,position:"absolute",paddingTop:"20px",..."left"===M?{right:"-20px"}:{left:"-20px"}},children:t(a,{color:Xe?.showAboveRef?.current?window.getComputedStyle(Xe.showAboveRef.current).color:void 0})})}),e(r,{disableGutters:!0,expanded:!ge&&B,onChange:()=>{ge||(C(),O.current=_.id)},sx:{boxShadow:"none",border:ge?"1px dashed #E2E8F0":"1px solid #E2E8F0",bgcolor:ge?"#FAFAFA":"#FFFFFF",borderRadius:"6px",flexGrow:1,width:"100%",display:"flex",flexDirection:"column",minWidth:0,"&:before":{display:"none"},"& .MuiAccordion-heading":{position:"sticky",top:-12,zIndex:10,background:"#fff"}},children:[t(d,{expandIcon:ge?null:t(u,{size:16}),sx:{minHeight:"36px",flexShrink:0,cursor:ge?"default":"pointer","& .MuiAccordionSummary-content":{my:.5,display:"grid",alignItems:"center",minWidth:0,width:"100%"},"& .MuiAccordionSummary-expandIconWrapper":{transition:"transform 0.2s ease"},"& .MuiAccordionSummary-expandIconWrapper.Mui-expanded":{transform:"rotate(180deg)"}},children:de&&t(s,{title:xe,placement:"top",children:t(l,{component:"div",sx:{fontSize:"12px",color:ge?"#94A3B8":"#19213D",fontWeight:ge?400:700,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0},children:$(Ie,me)})})}),!ge&&e(c,{sx:{pt:0,pb:1.25,bgcolor:"#FFFFFF",flex:1,display:"flex",flexDirection:"column",minWidth:0},children:[he&&t(f,{content:fe,overlayContent:pe,sxStyles:j,highlights:Le,maintainRelativeOrder:W,highlightBg:Ce,suppressHighlightBg:ae,deviationBadges:Ge,collisionKey:re}),(_.subsections||[]).map((e,t)=>D({section:e,keyPath:`${F}-${t}`,depth:0,columnKey:M,parentNodeId:A,sectionOffset:_e,rhsOrphanVisualIndexes:je}))]})]}),B&&Xe?.showBelow&&t("div",{style:{position:"sticky",bottom:0,height:"0px",cursor:"pointer"},onClick:()=>Xe?.showBelowRef?.current?.scrollIntoView({behavior:"smooth",block:"center"}),children:t("div",{style:{transform:`translateY(-50%) translateX(calc(100% ${"left"===M?"+":"-"} 130px))`,position:"absolute",paddingBottom:"20px",..."left"===M?{right:"-20px"}:{left:"-20px"}},children:t(u,{color:Xe?.showBelowRef?.current?window.getComputedStyle(Xe.showBelowRef.current).color:void 0})})})]},`${M}-sec-${F}`)};export{_ as default};
|
|
1
|
+
import{jsxs as e,jsx as t}from"react/jsx-runtime";import n,{useEffect as i}from"react";import{Box as o,Accordion as r,AccordionSummary as s,Tooltip as l,Typography as d,AccordionDetails as a}from"@mui/material";import{ChevronUp as c,ChevronDown as u}from"lucide-react";import{MemoizedMarkdown as f}from"../hooks/memoizedMarkdown.js";import{useCompareContext as p}from"../CompareContext.js";import{hasValue as h,hasMeaningfulRedlineTags as g,safeStringify as m,stripRedlineTags as x,hasSingleMappedLhsSection as I,generateColorPalette as v,getLhsDeviationDisplayIndexes as y,DEVIATION_BADGE_SEPARATOR as b,isMissingStr as w,getRhsMappedSectionNumber as S,findTextMatchRange as $}from"../CognitiveComparehelpers.js";import{findTextRangeWithFormatting as R}from"../utils/normalizeInlineMarkdown.js";import{DEFAULT_DEVIAION_COLOR as _}from"../CognitiveCompareConstants.js";import{normalizeRedlineMarkdown as M}from"../utils/normalizeRedlineMarkdown.js";const k=(n,i=!1)=>{if(!n)return null;return m(n).replace(/\\n/g,"\n").split(/(\*\*.*?\*\*)/g).map((n,o)=>n.startsWith("**")&&n.endsWith("**")?t("strong",{children:n.slice(2,-2)},o):e("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"8px",width:"100%"},children:[t("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n}),i&&t("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",padding:"0px 6px",borderRadius:"9999px",background:"#F3F4F6",border:"1px solid #D1D5DB",color:"#6B7280",fontSize:"9px",fontWeight:500,whiteSpace:"nowrap",flexShrink:0,lineHeight:1.4,marginRight:"4px"},children:"Multiple"})]},o))},F=({section:F,idx:N,columnKey:B,colRef:C,mb:E=1,isExpanded:A,onToggle:O,navigation:j,parentNodeId:W=""})=>{const{showOpenNodeRef:T,resolvedMarkdownStyles:D,maintainRelativeOrder:P,showDeviationBadges:z=!1,renderSubSectionAccordion:K,treeData:G,proposedSections:L,existingSections:X,deviationNumberRegistry:H,deviationParentRegistry:V,getBadgeRef:Y,openSummaryPopup:q,getSectionCompareStyle:J,connectedSections:Q,openMoreFunctionsPopup:U,isProposingFix:Z,proposingFixNodeId:ee,isRedlineFlow:te,isSideBySide:ne,activeSideBySideSection:ie,scrollSyncLocked:oe,unifiedNumbering:re,toggleScrollSyncLocked:se,summaryPopupAnchorEl:le}=p(),de=`${ne?"1":"0"}-${String(ie??"")}`,ae=(F.displayTitle??!0)&&h(F.title),ce=!(!Z||!ee||"left"!==B||F.id!==ee&&F.nodeId!==ee&&F.contentId!==ee),ue=g(F.content),fe="boolean"==typeof te?te:ue,pe=ue,he=F.change_history,ge=fe&&ue,me=n.useMemo(()=>ge?M(m(F.content)):m(F.content),[F.content,ge]),xe=ge?x(me):F.content,Ie=ge?me:void 0,ve=ue&&h(he)?m(he):void 0,ye=((F.displayContent??!0)||ue)&&h(F.content),be=!ae&&!ye;let we=F.title;ae||(we=ye?"No Title Found":"No Matching Section Found");const Se="left"===B&&(F.isMultipleMapping||(F.refContentIds?.length??1)>1),$e="left"===B&&we.length>29?`${we.slice(0,29).trimEnd()}...`:we;let Re=F.evaluationResult;if(!Re&&"right"===B)if(P){const e=F.refIndexes?.[0],t=L.find(t=>t.selfIndex===e);Re=t?.evaluationResult}else Re=L[N]?.evaluationResult;const _e=G?.input_index_map?.[0],Me=G?.input_index_map?.[1],ke="left"===B?Me:_e,Fe=(e,t)=>{if(!t||!e)return null;for(const n of e){if(n.id===t||n.nodeId===t||n.contentId===t)return n;if(n.subsections?.length){const e=Fe(n.subsections,t);if(e)return e}}return null};let Ne="left"===B?F:Fe(L,F.id),Be="right"===B?F:Fe(X,F.id);const Ce=n.useMemo(()=>{if(!P)return 0;let e=1/0;const t=e=>{const t=m(e||"").replace(/\\n/g,"\n");return g(t)?x(M(t)):t},n=(i,o,r,s)=>{if(!i)return;let l=i.nodeId||i.id;if(s&&"right"===B){const e=L.filter(e=>e.refIndexes?.includes(i.selfIndex));e.length>0&&(l=e[0].nodeId||e[0].id)}let d=i.nodeId||i.id||o?.nodeId||o?.id||r?.nodeId||r?.id;const a=i.evaluationResult||o?.evaluationResult||r?.evaluationResult,c=a?.deviations||{};Object.keys(c).forEach(n=>{const s=c[n]?.[W];if(!((e,n)=>{if("string"!=typeof n||w(n))return!1;const i=t(e?.content),o=t(n);return!!o&&!!$(i,o)})("left"===B?o||i:r||i,s))return;const a=`${l}${b}${n}`,u=H?.[a];null!=u&&u<e&&(e=u);const f=`${d}${b}${n}`,p=H?.[f];null!=p&&p<e&&(e=p)});const u=i.subsections||[],f=o?.subsections||[],p=r?.subsections||[],h=Math.max(u.length,f.length,p.length);for(let e=0;e<h;e++)n(u[e],f[e],p[e],!1)},i="right"===B?L.filter(e=>e.refIndexes?.includes(F.selfIndex)):[];if(1===i.length){const e=i[0];(e.refIndexes||[]).map(e=>X.find(t=>t.selfIndex===e)).filter(Boolean).forEach(t=>{n(t,e,t,!0)})}else n(F,Ne,Be,!0);return e!==1/0?e-1:0},[F,Ne,Be,B,W,H,P,L,X]);if(P)if("left"===B){const e=F.refIndexes?.[0],t=X.findIndex(t=>t.selfIndex===e);Be=-1!==t?X[t]:Fe(X,F.id)}else{const e=F.refIndexes?.[0],t=L.findIndex(t=>t.selfIndex===e);Ne=-1!==t?L[t]:Fe(L,F.id)}const Ee="left"===B?!Be:!Ne,Ae=P&&"right"===B&&I(F,L),Oe=Re||Ne?.evaluationResult||Be?.evaluationResult,je=Oe?.evaluation_outputs?.metadata?.label_color??_,We=v(je),{highlightBg:Te}=We,De=Oe?.deviations||{},Pe=n.useMemo(()=>P&&"right"===B?y(L,_e,H):new Map,[P,B,L,_e,H]);let ze=F.nodeId||F.id;if(P&&"left"!==B){const e=L.filter(e=>e.refIndexes?.includes(F.selfIndex));e.length>0?ze=e[0].nodeId||e[0].id:Ne?.id&&(ze=Ne.nodeId||Ne.id)}const Ke=n.useMemo(()=>{const e=new Map;if(!P||"right"!==B)return e;let t=1;const n=L.filter(e=>e.refIndexes?.includes(F.selfIndex)),i=1===n.length&&1===n[0].refIndexes?.length,o=e=>m(e||"").replace(/\\n/g,"\n"),r=(e,t)=>{const i=t?n[0]:Fe(L,e.nodeId||e.id||e.contentId);return{lhsNode:i,evalResult:e.evaluationResult||i?.evaluationResult,registryNodeId:i?i.nodeId||i.id:e.nodeId||e.id}};if(i){const e=(n,i=!1)=>{if(!n)return;const{lhsNode:s,evalResult:l,registryNodeId:d}=r(n,i),a=o(n.content);Object.entries(l?.deviations||{}).forEach(([e,n])=>{const i=n[W],r=o(i);if(!(!!s&&!w(n[ke]))||!r||!$(a,r))return;const l=H[`${d}${b}${e}`];null!=l&&(t=Math.max(t,Math.max(1,l-(Ce||0))+1))}),(n.subsections||[]).forEach(t=>e(t))};e(F,!0)}const s=(n,i=!1)=>{if(!n)return;const{lhsNode:l,evalResult:d,registryNodeId:a}=r(n,i),c=d?.deviations||{},u=o(n.content);Object.entries(c).map(([e,t])=>{const n=t[W],i=!l||w(t[ke]),r=o(n);let s=-1;r&&(s=$(u,r)?.start??-1,-1===s&&(s=R(u,r)?.start??-1));const d=`${a}${b}${e}`;return{refId:d,isRenderable:i&&!!r&&!w(n),position:s,registryIndex:H[d]??Number.MAX_SAFE_INTEGER}}).filter(e=>e.isRenderable).sort((e,t)=>(-1===e.position?Number.MAX_SAFE_INTEGER:e.position)-(-1===t.position?Number.MAX_SAFE_INTEGER:t.position)||e.registryIndex-t.registryIndex).forEach(n=>{e.set(n.refId,t++)}),(n.subsections||[]).forEach(e=>s(e))};return s(F,!0),e},[P,B,F,L,W,ke,H,Ce]),Ge=Object.keys(De)[0],Le=Ge?`${ze}${b}${Ge}`:null,Xe=Le?V?.[Le]:null;let He=N+1;if(P&&re){const e="left"===B?re.leftNums.get(F?.id):re.rightNums.get(F?.id);Ee&&void 0!==e?He=e:null!=Xe&&Xe>=0?He=Xe:void 0!==e&&(He=e)}else null!=Xe&&Xe>=0&&(He=Xe);let Ve=Math.max(0,...Object.keys(De).map(e=>H[`${ze}${b}${e}`]).filter(e=>"number"==typeof e&&Number.isFinite(e)))+1;const Ye=Object.entries(De).map(([e,t])=>{const n=`${ze}${b}${e}`;return{deviationKey:e,deviationMap:t,refId:n,currentIndex:H[n]??Ve++}});Ye.sort((e,t)=>e.currentIndex-t.currentIndex);const qe=Ye.map(e=>{const{deviationKey:t,deviationMap:n,refId:i}=e;let o=e.currentIndex,r=n[W];const s=w(r);if(s)r="";else if(!r)return null;let l=N,d=N;if(P)if("left"===B){const e=F.refIndexes?.[0],t=X.findIndex(t=>t.selfIndex===e);if(-1!==t)d=t;else{const e=X.findIndex(e=>e.id===F.id||e.nodeId===F.nodeId||e.contentId===F.contentId);d=-1!==e?e:N}}else{const e=F.refIndexes?.[0],t=L.findIndex(t=>t.selfIndex===e);if(-1!==t)l=t;else{const e=L.findIndex(e=>e.id===F.id||e.nodeId===F.nodeId||e.contentId===F.contentId);l=-1!==e?e:N}}const a=`${ze}${b}${t}${b}${l}${b}${d}`,c=n[ke],u=Ee||w(c),f=Ke.get(i),p=Pe.get(i);P&&"right"===B&&u&&void 0!==f?o=f:P&&"right"===B&&!u&&void 0!==p?o=p:P&&void 0!==Ce&&("right"!==B||u||Ae)&&(o-=Ce),o=Math.max(1,o);const h=`${P&&"right"===B&&u&&re?S({section:F,proposedSections:L,leftNums:re.leftNums,fallbackNumber:String(He),firstOnly:!0}):He}.${o}`;let g=N;if("right"===B&&P){const e=F.refIndexes?.[0],t=L.findIndex(t=>t.selfIndex===e);if(-1!==t)g=t;else{const e=L.findIndex(e=>e.id===F.id||e.nodeId===F.nodeId||e.contentId===F.contentId);-1!==e&&(g=e)}}const m=J?J(g):null,x=n?.evaluation_outputs||Oe?.evaluation_outputs,I=x?.output_value??null,y=v(x?.metadata?.label_color??je);let $=m?{...m,badgeBg:y.badgeBg,badgeBorder:y.badgeBorder,badgeText:y.badgeText}:{...y};const R=n?.deviation_summary?{deviation_summary:n.deviation_summary,deviation_title:n?.deviation_title||Oe?.deviation_title,deviation_impact:n?.deviation_impact||Oe?.deviation_impact,deviation_explanation:n?.deviation_explanation||Oe?.deviation_explanation,evaluation_outputs:x,cognitive_decisioning:n?.cognitive_decisioning||Oe?.cognitive_decisioning}:null;let _=0;const M=xe||"";if(r&&M){const e=M.split(/\n{2,}/),n=e.findIndex(e=>e.includes(r));if(-1!==n){const i=Object.entries(De).filter(([t,i])=>{const o=i[W];return o&&e[n].includes(o)}).sort((t,i)=>e[n].indexOf(t[1][W])-e[n].indexOf(i[1][W])).filter(([e,t])=>{const n=t[W];return n&&(n.includes(r)||r.includes(n))});i.length>1&&(_=Math.max(0,i.findIndex(([e])=>e===t)))}}const k=Y(B,i);return{id:i,actionId:a,label:h,highlight:r,side:B,style:$,stackIndex:_,score:I,isConnected:Q?.has(a),showScrollLockToggle:Q?.has(a)||ne&&ie===a||!!le&&le===k.current,scrollSyncLocked:oe,toggleScrollSyncLocked:se,isOrphan:u,isMissingClause:s,badgeRef:k,onClick:e=>{e.stopPropagation(),U&&U(e,Ne||{id:"orphan-left",title:"",content:""},u,Be||{id:"orphan-right",title:"",content:""},a,$)},onSummaryClick:e=>{e.stopPropagation(),q(e,a,u,R)}}}).filter(Boolean),Je=z||ce?qe:[],Qe=qe.map(e=>e.highlight).filter(Boolean),Ue=F.id&&B===j?.columnKey?j:null,Ze=n.useRef(!1);return i(()=>{A||(Ze.current=!1)},[A]),e(o,{ref:C,sx:{mb:E,width:"100%",display:"flex",flexDirection:"column",position:"relative",minWidth:0},children:[A&&Ue?.showAbove&&t("div",{style:{position:"sticky",top:0,height:"0px",cursor:"pointer"},onClick:()=>Ue?.showAboveRef?.current?.scrollIntoView({behavior:"smooth",block:"center"}),children:t("div",{style:{transform:`translateY(-50%) translateX(calc(100% ${"left"===B?"+":"-"} 130px))`,position:"absolute",paddingTop:"20px",..."left"===B?{right:"-20px"}:{left:"-20px"}},children:t(c,{color:Ue?.showAboveRef?.current?window.getComputedStyle(Ue.showAboveRef.current).color:void 0})})}),e(r,{disableGutters:!0,expanded:!be&&A,onChange:()=>{be||(O(),T.current=F.id)},sx:{boxShadow:"none",border:be?"1px dashed #E2E8F0":"1px solid #E2E8F0",bgcolor:be?"#FAFAFA":"#FFFFFF",borderRadius:"6px",flexGrow:1,width:"100%",display:"flex",flexDirection:"column",minWidth:0,"&:before":{display:"none"},"& .MuiAccordion-heading":{position:"sticky",top:-12,zIndex:10,background:"#fff"}},children:[t(s,{expandIcon:be?null:t(u,{size:16}),sx:{minHeight:"36px",flexShrink:0,cursor:be?"default":"pointer","& .MuiAccordionSummary-content":{my:.5,display:"grid",alignItems:"center",minWidth:0,width:"100%"},"& .MuiAccordionSummary-expandIconWrapper":{transition:"transform 0.2s ease"},"& .MuiAccordionSummary-expandIconWrapper.Mui-expanded":{transform:"rotate(180deg)"}},children:ae&&t(l,{title:we,placement:"top",children:t(d,{component:"div",sx:{fontSize:"12px",color:be?"#94A3B8":"#19213D",fontWeight:be?400:700,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0},children:k($e,Se)})})}),!be&&e(a,{sx:{pt:0,pb:1.25,bgcolor:"#FFFFFF",flex:1,display:"flex",flexDirection:"column",minWidth:0},children:[ye&&t(f,{content:xe,overlayContent:Ie,fallbackContent:ve,sxStyles:D,highlights:Qe,maintainRelativeOrder:P,highlightBg:Te,suppressHighlightBg:pe,deviationBadges:Je,collisionKey:de}),(F.subsections||[]).map((e,t)=>K({section:e,keyPath:`${N}-${t}`,depth:0,columnKey:B,parentNodeId:W,sectionOffset:Ce,rhsOrphanVisualIndexes:Ke}))]})]}),A&&Ue?.showBelow&&t("div",{style:{position:"sticky",bottom:0,height:"0px",cursor:"pointer"},onClick:()=>Ue?.showBelowRef?.current?.scrollIntoView({behavior:"smooth",block:"center"}),children:t("div",{style:{transform:`translateY(-50%) translateX(calc(100% ${"left"===B?"+":"-"} 130px))`,position:"absolute",paddingBottom:"20px",..."left"===B?{right:"-20px"}:{left:"-20px"}},children:t(u,{color:Ue?.showBelowRef?.current?window.getComputedStyle(Ue.showBelowRef.current).color:void 0})})})]},`${B}-sec-${N}`)};export{F as default};
|
|
2
2
|
//# sourceMappingURL=SectionAccordion.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SectionAccordion.js","sources":["../../../../src/features/CognitiveCompare/components/SectionAccordion.tsx"],"sourcesContent":["import React, { useEffect, useRef } from \"react\";\nimport {\n Accordion,\n AccordionDetails,\n AccordionSummary,\n Box,\n Tooltip,\n Typography,\n} from \"@mui/material\";\nimport { ChevronDown, ChevronUp } from \"lucide-react\";\nimport { MemoizedMarkdown } from \"../hooks/memoizedMarkdown\";\nimport { useCompareContext } from \"../CompareContext\";\nimport { \n generateColorPalette, \n hasValue, \n safeStringify,\n DEVIATION_BADGE_SEPARATOR,\n isMissingStr,\n escapeRegExp,\n hasMeaningfulRedlineTags,\n stripRedlineTags,\n getRhsMappedSectionNumber,\n hasSingleMappedLhsSection,\n getLhsDeviationDisplayIndexes,\n} from \"../CognitiveComparehelpers\";\nimport { DEFAULT_DEVIAION_COLOR } from \"../CognitiveCompareConstants\";\nimport { DeviationDataEntry, SectionBlock, StyleVariant } from \"../CognitiveCompareTypes\";\nimport { DeviationNavigationEntry } from \"../hooks/useDeviationNavigation\";\n\nconst renderSimpleMarkdown = (text: string, isMultiTag = false) => {\n if (!text) return null;\n\n const normalizedText = safeStringify(text).replace(/\\\\n/g, \"\\n\");\n const parts = normalizedText.split(/(\\*\\*.*?\\*\\*)/g);\n\n return parts.map((part: string, i: number) => {\n if (part.startsWith(\"**\") && part.endsWith(\"**\")) {\n return <strong key={i}>{part.slice(2, -2)}</strong>;\n }\n\n return (\n <div\n key={i}\n style={{\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"space-between\",\n gap: \"8px\",\n width: \"100%\",\n }}\n >\n <span\n style={{\n minWidth: 0,\n overflow: \"hidden\",\n textOverflow: \"ellipsis\",\n whiteSpace: \"nowrap\",\n }}\n >\n {part}\n </span>\n\n {isMultiTag && (\n <span\n style={{\n display: \"inline-flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n padding: \"0px 6px\",\n borderRadius: \"9999px\",\n background: \"#F3F4F6\",\n border: \"1px solid #D1D5DB\",\n color: \"#6B7280\",\n fontSize: \"9px\",\n fontWeight: 500,\n whiteSpace: \"nowrap\",\n flexShrink: 0,\n lineHeight: 1.4,\n marginRight: \"4px\",\n }}\n >\n Multiple\n </span>\n )}\n </div>\n );\n });\n};\n\nconst findScrollParent = (element: HTMLElement | null): HTMLElement | null => {\n let current = element?.parentElement || null;\n while (current) {\n const style = window.getComputedStyle(current);\n const overflowY = style.overflowY;\n const canScroll =\n (overflowY === \"auto\" || overflowY === \"scroll\") &&\n current.scrollHeight > current.clientHeight;\n\n if (canScroll) return current;\n current = current.parentElement;\n }\n\n return null;\n};\n\nconst isElementVisibleInScrollParent = (element: HTMLElement) => {\n const scrollParent = findScrollParent(element);\n const rect = element.getBoundingClientRect();\n const parentRect = scrollParent?.getBoundingClientRect() || {\n top: 0,\n bottom: window.innerHeight,\n };\n\n return rect.top >= parentRect.top && rect.bottom <= parentRect.bottom;\n};\n\ntype SectionAccordionProps = {\n section: SectionBlock;\n idx: number;\n columnKey: \"left\" | \"right\";\n colRef: React.RefObject<HTMLDivElement>;\n mb?: number;\n parentNodeId?: string;\n isExpanded: boolean;\n onToggle: () => void;\n navigation: DeviationNavigationEntry | null;\n};\n\nconst SectionAccordion = ({\n section,\n idx,\n columnKey,\n colRef,\n mb = 1,\n isExpanded,\n onToggle,\n navigation,\n parentNodeId = \"\",\n}: SectionAccordionProps) => {\n const {\n showOpenNodeRef,\n resolvedMarkdownStyles,\n maintainRelativeOrder,\n showDeviationBadges = false,\n renderSubSectionAccordion,\n treeData,\n proposedSections,\n existingSections,\n deviationNumberRegistry,\n deviationParentRegistry,\n getBadgeRef,\n openSummaryPopup,\n getSectionCompareStyle,\n connectedSections,\n openMoreFunctionsPopup,\n isProposingFix,\n proposingFixNodeId,\n isRedlineFlow,\n isSideBySide,\n activeSideBySideSection,\n scrollSyncLocked,\n unifiedNumbering,\n toggleScrollSyncLocked,\n summaryPopupAnchorEl,\n } = useCompareContext();\n const collisionKey = `${isSideBySide ? \"1\" : \"0\"}-${String(activeSideBySideSection ?? \"\")}`;\n const hasTitle = (section.displayTitle ?? true) && hasValue(section.title);\n const isProposedFixTarget =\n !!isProposingFix &&\n !!proposingFixNodeId &&\n columnKey === \"left\" &&\n (section.id === proposingFixNodeId || section.nodeId === proposingFixNodeId);\n \n const hasRedlineTags = hasMeaningfulRedlineTags(section.content);\n const inferredRedlineFlow = hasRedlineTags;\n const resolvedRedlineFlow =\n typeof isRedlineFlow === \"boolean\" ? isRedlineFlow : inferredRedlineFlow;\n const suppressHighlightBg = hasRedlineTags;\n\n // Use history as the base when redlines exist so badge matching still works.\n const shouldOverlayContent = resolvedRedlineFlow && hasRedlineTags;\n const baseContent = shouldOverlayContent\n ? stripRedlineTags(section.content)\n : section.content;\n const overlayContent = shouldOverlayContent ? section.content : undefined;\n const hasContent = ((section.displayContent ?? true) || hasRedlineTags) && hasValue(section.content);\n const isEmpty = !hasTitle && !hasContent;\n // const changeHistoryContent = section.change_history;\n // const isProposedFixTarget =\n // !!isProposingFix &&\n // !!proposingFixNodeId &&\n // columnKey === \"left\" &&\n // section.id === proposingFixNodeId;\n // const shouldOverlayContent = isProposedFixTarget && hasValue(changeHistoryContent);\n // const baseContent = shouldOverlayContent ? (changeHistoryContent || \"\") : section.content;\n // const overlayContent = shouldOverlayContent ? section.content : undefined;\n // const hasContent = (section.displayContent ?? true) && hasValue(baseContent);\n // const isEmpty = !hasTitle && !hasContent;\n\n \n\n let displayTitle = section.title;\n if (!hasTitle) {\n displayTitle = hasContent ? \"No Title Found\" : \"No Matching Section Found\";\n }\n const isMultipleMapping =\n columnKey === \"left\" &&\n (section.isMultipleMapping || (section.refContentIds?.length ?? 1) > 1);\n const visibleTitle =\n columnKey === \"left\" && displayTitle.length > 29\n ? `${displayTitle.slice(0, 29).trimEnd()}...`\n : displayTitle;\n\n let targetEvalResult = section.evaluationResult;\n if (!targetEvalResult && columnKey === \"right\") {\n if (maintainRelativeOrder) {\n const lhsSelfIndex = section.refIndexes?.[0];\n const lhsSection = proposedSections.find((s: any) => s.selfIndex === lhsSelfIndex);\n targetEvalResult = lhsSection?.evaluationResult;\n } else {\n targetEvalResult = proposedSections[idx]?.evaluationResult;\n }\n }\n\n const leftDocId = treeData?.input_index_map?.[\"0\"];\n const rightDocId = treeData?.input_index_map?.[\"1\"];\n const counterPartNodeId = columnKey === \"left\" ? rightDocId : leftDocId;\n const findNodeByIdDeep = (nodes: any[], id?: string): any => {\n if (!id || !nodes) return null;\n for (const n of nodes) {\n if (n.id === id || n.nodeId === id || n.contentId === id) return n;\n if (n.subsections?.length) {\n const found = findNodeByIdDeep(n.subsections, id);\n if (found) return found;\n }\n }\n return null;\n };\n\n let popupBaseSec: any = columnKey === \"left\" ? section : findNodeByIdDeep(proposedSections, section.id);\n let popupRefSec: any = columnKey === \"right\" ? section : findNodeByIdDeep(existingSections, section.id);\n\n const sectionOffset = React.useMemo(() => {\n if (!maintainRelativeOrder) return 0;\n let min = Infinity;\n\n const normalizeInlineContent = (value: unknown) => {\n const raw = hasMeaningfulRedlineTags(value) ? stripRedlineTags(value) : value;\n return safeStringify(raw || \"\").replace(/\\\\n/g, \"\\n\");\n };\n\n const canRenderInlineHighlight = (node: SectionBlock, highlight: unknown) => {\n if (typeof highlight !== \"string\" || isMissingStr(highlight)) return false;\n const content = normalizeInlineContent(node?.content);\n const normalizedHighlight = normalizeInlineContent(highlight);\n return !!normalizedHighlight && content.includes(normalizedHighlight);\n };\n\n const traverse = (node: any, bNode: any, rNode: any, isTopLevel: boolean) => {\n if (!node) return;\n\n let topNodeId = node.nodeId || node.id;\n if (isTopLevel && columnKey === \"right\") {\n const mappedLhs = proposedSections.filter((l: any) => l.refIndexes?.includes(node.selfIndex));\n if (mappedLhs.length > 0) topNodeId = mappedLhs[0].nodeId || mappedLhs[0].id;\n }\n\n let subNodeId = node.nodeId || node.id || bNode?.nodeId || bNode?.id || rNode?.nodeId || rNode?.id;\n\n const evalResult = node.evaluationResult || bNode?.evaluationResult || rNode?.evaluationResult;\n const devs = evalResult?.deviations || {};\n Object.keys(devs).forEach(devKey => {\n const highlight = devs[devKey]?.[parentNodeId];\n const renderNode = columnKey === \"left\" ? (bNode || node) : (rNode || node);\n if (!canRenderInlineHighlight(renderNode, highlight)) return;\n\n const refId1 = `${topNodeId}${DEVIATION_BADGE_SEPARATOR}${devKey}`;\n const idx1 = deviationNumberRegistry?.[refId1];\n if (idx1 !== undefined && idx1 !== null && idx1 < min) min = idx1;\n\n const refId2 = `${subNodeId}${DEVIATION_BADGE_SEPARATOR}${devKey}`;\n const idx2 = deviationNumberRegistry?.[refId2];\n if (idx2 !== undefined && idx2 !== null && idx2 < min) min = idx2;\n });\n\n const subs = node.subsections || [];\n const bSubs = bNode?.subsections || [];\n const rSubs = rNode?.subsections || [];\n const maxLen = Math.max(subs.length, bSubs.length, rSubs.length);\n\n for (let i = 0; i < maxLen; i++) {\n traverse(subs[i], bSubs[i], rSubs[i], false);\n }\n };\n\n const mappedLhsSections = columnKey === \"right\"\n ? proposedSections.filter((lhs: SectionBlock) => lhs.refIndexes?.includes(section.selfIndex as number))\n : [];\n\n if (mappedLhsSections.length === 1) {\n const mappedLhs = mappedLhsSections[0] as SectionBlock;\n const mappedRhsSections = (mappedLhs.refIndexes || [])\n .map((rhsSelfIndex: number) =>\n existingSections.find((rhs: SectionBlock) => rhs.selfIndex === rhsSelfIndex),\n )\n .filter(Boolean);\n\n mappedRhsSections.forEach((rhsSection: any) => {\n traverse(rhsSection, mappedLhs, rhsSection, true);\n });\n } else {\n traverse(section, popupBaseSec, popupRefSec, true);\n }\n\n return min !== Infinity ? min - 1 : 0;\n }, [section, popupBaseSec, popupRefSec, columnKey, parentNodeId, deviationNumberRegistry, maintainRelativeOrder, proposedSections, existingSections]);\n if (maintainRelativeOrder) {\n if (columnKey === \"left\") {\n const rhsSelfIndex = section.refIndexes?.[0];\n const rhsArrayIdx = existingSections.findIndex((s: any) => s.selfIndex === rhsSelfIndex);\n popupRefSec = rhsArrayIdx !== -1\n ? existingSections[rhsArrayIdx]\n : findNodeByIdDeep(existingSections, section.id);\n } else {\n const lhsSelfIndex = section.refIndexes?.[0];\n const lhsArrayIdx = proposedSections.findIndex((s: any) => s.selfIndex === lhsSelfIndex);\n popupBaseSec = lhsArrayIdx !== -1\n ? proposedSections[lhsArrayIdx]\n : findNodeByIdDeep(proposedSections, section.id);\n }\n }\n\n const isSecOrphan = columnKey === \"left\" ? !popupRefSec : !popupBaseSec;\n const hasSingleMappedLhs =\n maintainRelativeOrder &&\n columnKey === \"right\" &&\n hasSingleMappedLhsSection(section, proposedSections);\n\n const resolvedEvalResult = targetEvalResult || popupBaseSec?.evaluationResult || popupRefSec?.evaluationResult;\n const deviationColorData = resolvedEvalResult?.evaluation_outputs?.metadata?.label_color ?? DEFAULT_DEVIAION_COLOR;\n const deviationPalette = generateColorPalette(deviationColorData);\n const { highlightBg } = deviationPalette;\n const deviations = resolvedEvalResult?.deviations || {};\n\n const lhsDeviationDisplayIndexes = React.useMemo(\n () =>\n maintainRelativeOrder && columnKey === \"right\"\n ? getLhsDeviationDisplayIndexes(\n proposedSections,\n leftDocId,\n deviationNumberRegistry,\n )\n : new Map<string, number>(),\n [\n maintainRelativeOrder,\n columnKey,\n proposedSections,\n leftDocId,\n deviationNumberRegistry,\n ],\n );\n\n let nodeId = section.nodeId || section.id;\n\n // For RHS mapped sections, nodeId must match what the registry used (LHS id)\n if (maintainRelativeOrder && columnKey !== \"left\") {\n const mappedLhs = proposedSections.filter((l: any) => l.refIndexes?.includes(section.selfIndex));\n if (mappedLhs.length > 0) {\n nodeId = mappedLhs[0].nodeId || mappedLhs[0].id;\n } else if (popupBaseSec?.id) {\n nodeId = popupBaseSec.nodeId || popupBaseSec.id;\n }\n }\n\n const rhsOrphanVisualIndexes = React.useMemo(() => {\n const indexes = new Map<string, number>();\n if (!maintainRelativeOrder || columnKey !== \"right\") return indexes;\n\n let nextIndex = 1;\n const mappedLhsSections = proposedSections.filter((lhs: SectionBlock) =>\n lhs.refIndexes?.includes(section.selfIndex as number),\n );\n const isOneToOneSection =\n mappedLhsSections.length === 1 &&\n mappedLhsSections[0].refIndexes?.length === 1;\n const normalizeContent = (value: unknown) =>\n safeStringify(value || \"\").replace(/\\\\n/g, \"\\n\");\n\n const resolveNode = (rhsNode: SectionBlock, isRoot: boolean) => {\n const lhsNode = isRoot\n ? mappedLhsSections[0]\n : findNodeByIdDeep(\n proposedSections,\n rhsNode.nodeId || rhsNode.id || rhsNode.contentId,\n );\n const evalResult =\n rhsNode.evaluationResult || lhsNode?.evaluationResult;\n const registryNodeId = lhsNode\n ? lhsNode.nodeId || lhsNode.id\n : rhsNode.nodeId || rhsNode.id;\n return { lhsNode, evalResult, registryNodeId };\n };\n\n if (isOneToOneSection) {\n const reserveMappedIndexes = (rhsNode: SectionBlock | null, isRoot = false) => {\n if (!rhsNode) return;\n const { lhsNode, evalResult, registryNodeId } = resolveNode(\n rhsNode,\n isRoot,\n );\n const normalizedContent = normalizeContent(rhsNode.content);\n\n Object.entries(evalResult?.deviations || {}).forEach(\n ([deviationKey, deviationMap]: [string, any]) => {\n const highlight = deviationMap[parentNodeId];\n const normalizedHighlight = normalizeContent(highlight);\n const isMapped =\n !!lhsNode &&\n !isMissingStr(deviationMap[counterPartNodeId as string]);\n if (\n !isMapped ||\n !normalizedHighlight ||\n !normalizedContent.includes(normalizedHighlight)\n ) return;\n\n const refId = `${registryNodeId}${DEVIATION_BADGE_SEPARATOR}${deviationKey}`;\n const registryIndex = deviationNumberRegistry[refId];\n if (registryIndex === undefined || registryIndex === null) return;\n nextIndex = Math.max(\n nextIndex,\n Math.max(1, registryIndex - (sectionOffset || 0)) + 1,\n );\n },\n );\n\n (rhsNode.subsections || []).forEach((child: SectionBlock) =>\n reserveMappedIndexes(child),\n );\n };\n\n reserveMappedIndexes(section, true);\n }\n\n const visit = (rhsNode: SectionBlock | null, isRoot = false) => {\n if (!rhsNode) return;\n\n const { lhsNode, evalResult, registryNodeId } = resolveNode(\n rhsNode,\n isRoot,\n );\n const nodeDeviations = evalResult?.deviations || {};\n const normalizedContent = normalizeContent(rhsNode.content);\n\n Object.entries(nodeDeviations)\n .map(([deviationKey, deviationMap]: [string, any]) => {\n const highlight = deviationMap[parentNodeId];\n const isOrphan =\n !lhsNode || isMissingStr(deviationMap[counterPartNodeId as string]);\n const normalizedHighlight = normalizeContent(highlight);\n const position = normalizedHighlight\n ? normalizedContent.indexOf(normalizedHighlight)\n : -1;\n const refId = `${registryNodeId}${DEVIATION_BADGE_SEPARATOR}${deviationKey}`;\n return {\n refId,\n isRenderable:\n isOrphan && !!normalizedHighlight && !isMissingStr(highlight),\n position,\n registryIndex: deviationNumberRegistry[refId] ?? Number.MAX_SAFE_INTEGER,\n };\n })\n .filter((entry) => entry.isRenderable)\n .sort((a, b) => {\n const aPosition =\n a.position === -1 ? Number.MAX_SAFE_INTEGER : a.position;\n const bPosition =\n b.position === -1 ? Number.MAX_SAFE_INTEGER : b.position;\n return aPosition - bPosition || a.registryIndex - b.registryIndex;\n })\n .forEach((entry) => {\n indexes.set(entry.refId, nextIndex++);\n });\n\n (rhsNode.subsections || []).forEach((child: SectionBlock) => visit(child));\n };\n\n visit(section, true);\n return indexes;\n }, [\n maintainRelativeOrder,\n columnKey,\n section,\n proposedSections,\n parentNodeId,\n counterPartNodeId,\n deviationNumberRegistry,\n sectionOffset,\n ]);\n\n // Derive validatedParentNum from registry\n const firstDeviationKey = Object.keys(deviations)[0];\n const firstRefId = firstDeviationKey ? `${nodeId}${DEVIATION_BADGE_SEPARATOR}${firstDeviationKey}` : null;\n const registeredParentNum = firstRefId ? (deviationParentRegistry?.[firstRefId] as number) : null;\n\n let validatedParentNum: string | number = idx + 1;\n\n if (maintainRelativeOrder && unifiedNumbering) {\n const unifiedNum = columnKey === \"left\" \n ? unifiedNumbering.leftNums.get(section?.id as string) \n : unifiedNumbering.rightNums.get(section?.id as string);\n \n if (isSecOrphan && unifiedNum !== undefined) {\n validatedParentNum = unifiedNum;\n } else if (registeredParentNum !== null && registeredParentNum !== undefined && registeredParentNum >= 0) {\n validatedParentNum = registeredParentNum;\n } else if (unifiedNum !== undefined) {\n validatedParentNum = unifiedNum;\n }\n } else if (registeredParentNum !== null && registeredParentNum !== undefined && registeredParentNum >= 0) {\n validatedParentNum = registeredParentNum;\n }\n // const deviationNodeIdRef = useRef<string | undefined>(deviationNodeIdToView);\n // const deviationNodeParentRef = useRef<string | null>(deviationTargetParentId || null);\n const highlights: string[] = [];\n // Mapp through deviations to pass to memoized markdown for highlighting, also prepare deviation badges \n const rawDeviationEntries = Object.entries(deviations).map(([deviationKey, deviationMap]: [string, any]) => {\n const refId = `${nodeId}${DEVIATION_BADGE_SEPARATOR}${deviationKey}`;\n const currentIndex = deviationNumberRegistry[refId];\n return { deviationKey, deviationMap, refId, currentIndex };\n }).filter(item => item.currentIndex !== undefined && item.currentIndex !== null);\n\n // Sort by global index BEFORE mapping to prevent negative/zero offsets\n rawDeviationEntries.sort((a, b) => a.currentIndex - b.currentIndex);\n\n const deviationEntries = rawDeviationEntries.map((item) => {\n const { deviationKey, deviationMap, refId } = item;\n let currentIndex = item.currentIndex;\n\n let highlight = deviationMap[parentNodeId];\n const isMissingClause = isMissingStr(highlight);\n\n if (isMissingClause) {\n highlight = \"\"; \n } else if (!highlight) {\n return null; \n }\n\n highlights.push(highlight);\n\n // MAPPING Stricter Left/Right Index mapping to prevent cross-wiring\n let leftIdx = idx;\n let rightIdx = idx;\n\n if (maintainRelativeOrder) {\n if (columnKey === \"left\") {\n const rhsSelfIndex = section.refIndexes?.[0];\n const rhsArrayIdx = existingSections.findIndex((s: any) => s.selfIndex === rhsSelfIndex);\n if (rhsArrayIdx !== -1) {\n rightIdx = rhsArrayIdx;\n } else {\n const rhsByIdIdx = existingSections.findIndex((s: SectionBlock) =>\n s.id === section.id || s.nodeId === section.nodeId || s.contentId === section.contentId,\n );\n rightIdx = rhsByIdIdx !== -1 ? rhsByIdIdx : idx;\n }\n } else {\n const lhsSelfIndex = section.refIndexes?.[0];\n const lhsArrayIdx = proposedSections.findIndex((s: any) => s.selfIndex === lhsSelfIndex);\n if (lhsArrayIdx !== -1) {\n leftIdx = lhsArrayIdx;\n } else {\n const lhsByIdIdx = proposedSections.findIndex((s: SectionBlock) =>\n s.id === section.id || s.nodeId === section.nodeId || s.contentId === section.contentId,\n );\n leftIdx = lhsByIdIdx !== -1 ? lhsByIdIdx : idx;\n }\n }\n }\n\n const actionId = `${nodeId}${DEVIATION_BADGE_SEPARATOR}${deviationKey}${DEVIATION_BADGE_SEPARATOR}${leftIdx}${DEVIATION_BADGE_SEPARATOR}${rightIdx}`;\n \n // CONTENT Use the calculated mapped indices to grab correct counterpart text\n // const counterPartContentRaw = columnKey === \"left\" ? existingSections[rightIdx]?.content : proposedSections[leftIdx]?.content;\n const counterpartHighlight = deviationMap[counterPartNodeId as string];\n \n // Commented Out code for removing the highlight swallowing logic\n // let simulatedContent = safeStringify(counterPartContentRaw);\n\n // const counterPartHighlight = Object.keys(deviations)\n // .map(key => ({ key, text: deviations[key][counterPartNodeId as string] }))\n // .filter(item => !isMissingStr(item.text))\n // .sort((a, b) => b.text.length - a.text.length);\n\n // const survivingKeys = new Set();\n // counterPartHighlight.forEach(item => {\n // const clean = item.text.replace(/\\\\(['’])/g, \"$1\").replace(/\\\\n/g, \"\\n\");\n // if(!clean) return;\n\n // const regex = new RegExp(escapeRegExp(clean));\n // if(regex.test(simulatedContent)){\n // survivingKeys.add(item.key);\n // simulatedContent = simulatedContent.replace(regex, `__TOKEN_${item.key}__`);\n // }\n // });\n\n // const isCounterPartOverlapping = !isMissingStr(counterpartHighlight) && !survivingKeys.has(deviationKey);\n\n const isDeviationOrphan = isSecOrphan || isMissingStr(counterpartHighlight);\n const orphanVisualIndex = rhsOrphanVisualIndexes.get(refId);\n const mappedLhsIndex = lhsDeviationDisplayIndexes.get(refId);\n if (\n maintainRelativeOrder &&\n columnKey === \"right\" &&\n isDeviationOrphan &&\n orphanVisualIndex !== undefined\n ) {\n currentIndex = orphanVisualIndex;\n } else if (\n maintainRelativeOrder &&\n columnKey === \"right\" &&\n !isDeviationOrphan &&\n mappedLhsIndex !== undefined\n ) {\n currentIndex = mappedLhsIndex;\n } else if (\n maintainRelativeOrder &&\n sectionOffset !== undefined &&\n (columnKey !== \"right\" || isDeviationOrphan || hasSingleMappedLhs)\n ) {\n currentIndex = currentIndex - sectionOffset;\n }\n currentIndex = Math.max(1, currentIndex);\n\n const badgeParentNum =\n maintainRelativeOrder &&\n columnKey === \"right\" &&\n isDeviationOrphan &&\n unifiedNumbering\n ? getRhsMappedSectionNumber({\n section,\n proposedSections,\n leftNums: unifiedNumbering.leftNums,\n fallbackNumber: String(validatedParentNum),\n firstOnly: true,\n })\n : validatedParentNum;\n const badgeLabel = `${badgeParentNum}.${currentIndex}`;\n\n let mappedIdx = idx;\n if (columnKey === \"right\" && maintainRelativeOrder) {\n const lhsSelfIndex = section.refIndexes?.[0];\n const actualLhsIdx = proposedSections.findIndex((s: any) => s.selfIndex === lhsSelfIndex);\n if (actualLhsIdx !== -1) {\n mappedIdx = actualLhsIdx;\n } else {\n const lhsByIdIdx = proposedSections.findIndex((s: SectionBlock) =>\n s.id === section.id || s.nodeId === section.nodeId || s.contentId === section.contentId,\n );\n if (lhsByIdIdx !== -1) mappedIdx = lhsByIdIdx;\n }\n }\n const baseStyle = getSectionCompareStyle ? getSectionCompareStyle(mappedIdx) : null;\n \n // let isUIOverlapping = false;\n // if (highlight) {\n // const allHighlights = Object.values(deviations).map((d: any) => d[parentNodeId as string]).filter(Boolean);\n // isUIOverlapping = allHighlights.some((otherHl: any) => otherHl.length > highlight.length && otherHl.includes(highlight));\n // }\n\n const deviationOutput = deviationMap?.evaluation_outputs || resolvedEvalResult?.evaluation_outputs;\n const deviationScore = deviationOutput?.output_value ?? null;\n const deviationColorForBadge = deviationOutput?.metadata?.label_color ?? deviationColorData;\n const deviationPaletteForBadge = generateColorPalette(deviationColorForBadge);\n let badgeStyle = baseStyle\n ? {\n ...baseStyle,\n badgeBg: deviationPaletteForBadge.badgeBg,\n badgeBorder: deviationPaletteForBadge.badgeBorder,\n badgeText: deviationPaletteForBadge.badgeText,\n }\n : { ...deviationPaletteForBadge };\n\n // if (isUIOverlapping) {\n // badgeStyle.badgeBg = \"#FFFBEB\";\n // badgeStyle.badgeBorder = \"#FCD34D\";\n // badgeStyle.badgeText = \"#B45309\";\n // badgeStyle.highlightBg = \"#FDE68A\";\n // }\n\n const summaryPayload = deviationMap?.deviation_summary\n ? {\n deviation_summary: deviationMap.deviation_summary,\n deviation_title: deviationMap?.deviation_title || resolvedEvalResult?.deviation_title,\n deviation_impact: deviationMap?.deviation_impact || resolvedEvalResult?.deviation_impact,\n deviation_explanation:\n deviationMap?.deviation_explanation || resolvedEvalResult?.deviation_explanation,\n evaluation_outputs: deviationOutput,\n cognitive_decisioning:\n deviationMap?.cognitive_decisioning || resolvedEvalResult?.cognitive_decisioning,\n }\n : null;\n\n // Logic for overlapping highlight badges\n let stackIndex = 0;\n const contentStr = baseContent || \"\";\n if (highlight && contentStr) {\n const paragraphs = contentStr.split(/\\n{2,}/);\n const paraIndex = paragraphs.findIndex(p => p.includes(highlight));\n if (paraIndex !== -1) {\n const devsInPara = Object.entries(deviations)\n .filter(([_, dMap]: any) => {\n const hl = dMap[parentNodeId];\n return hl && paragraphs[paraIndex].includes(hl);\n })\n .sort((a: any, b: any) => paragraphs[paraIndex].indexOf(a[1][parentNodeId]) - paragraphs[paraIndex].indexOf(b[1][parentNodeId]));\n const overlappingDevs = devsInPara.filter(([_, dMap]: any) => {\n const hl = dMap[parentNodeId];\n return hl && (hl.includes(highlight) || highlight.includes(hl));\n });\n if (overlappingDevs.length > 1) {\n stackIndex = Math.max(0, overlappingDevs.findIndex(([k]) => k === deviationKey));\n }\n }\n }\n const badgeRef = getBadgeRef(columnKey, refId);\n\n return {\n id: refId,\n actionId: actionId,\n label: badgeLabel,\n highlight,\n side: columnKey,\n style: badgeStyle,\n stackIndex,\n score: deviationScore,\n isConnected: connectedSections?.has(actionId),\n showScrollLockToggle:\n connectedSections?.has(actionId) ||\n (isSideBySide && activeSideBySideSection === actionId) ||\n (!!summaryPopupAnchorEl && summaryPopupAnchorEl === badgeRef.current),\n scrollSyncLocked,\n toggleScrollSyncLocked,\n isOrphan: isDeviationOrphan,\n isMissingClause,\n badgeRef,\n onClick: (e: React.MouseEvent) => {\n e.stopPropagation();\n\n if (openMoreFunctionsPopup) {\n openMoreFunctionsPopup(\n e as any, \n popupBaseSec || { id: \"orphan-left\", title: \"\", content: \"\" }, \n isDeviationOrphan, \n popupRefSec || { id: \"orphan-right\", title: \"\", content: \"\" }, \n actionId as any, \n badgeStyle as StyleVariant | null\n );\n }\n },\n\n onSummaryClick: (e: React.MouseEvent) => {\n e.stopPropagation();\n openSummaryPopup(e, actionId, isDeviationOrphan, summaryPayload);\n },\n };\n }).filter(Boolean);\n const baseShouldRenderBadges =\n showDeviationBadges || (!resolvedRedlineFlow && isProposedFixTarget);\n const shouldRenderBadges = baseShouldRenderBadges;\n const deviationBadgesToRender = shouldRenderBadges ? deviationEntries : [];\n\n // NEW: Sync highlights to prevent ghost highlights\n const highlightsToRender = deviationEntries.map((b: any) => b.highlight).filter(Boolean)\n\n const show =\n section.id && columnKey === navigation?.columnKey ? navigation : null;\n\n // Local ref added to prevent race conditions\n const hasScrolledRef = React.useRef(false);\n\n // Reset scroll flag when section closed\n useEffect(() => {\n if (!isExpanded) {\n hasScrolledRef.current = false;\n }\n }, [isExpanded]);\n // useEffect(()=>{\n // deviationNodeIdRef.current = deviationNodeIdToView;\n // deviationNodeParentRef.current = deviationTargetParentId || null;\n // }, [deviationNodeIdToView, deviationTargetParentId]);\n\n // Commented out the auto scroll functionality which was breaking the LSC -> RHS opening\n // useEffect(() => {\n // const isDeviationTargetSection =\n // !!deviationNodeIdRef.current &&\n // !!deviationNodeParentRef.current &&\n // nodeId === deviationNodeParentRef.current;\n // // NEW CONDITION: Check if the deviation target is one of the direct subsections\n // const isTargetInSubsections =\n // !!deviationNodeIdRef.current &&\n // (section.subsections || []).some(\n // (sub) => sub.id === deviationNodeIdRef.current\n // );\n\n // // Abort scroll if it's already scrolled, not expanded, is the target section, \n // // OR if the target is inside its subsections\n // if (\n // !isExpanded ||\n // hasScrolledRef.current ||\n // isDeviationTargetSection ||\n // isTargetInSubsections\n // ) {\n // return;\n // }\n\n // const timer = setTimeout(() => {\n // const firstDeviationEl = show?.firstDeviationRef?.current;\n // const firstDeviationPosition = show?.firstDeviationPosition;\n\n // if (!firstDeviationEl) {\n // hasScrolledRef.current = true;\n // return;\n // }\n\n // if (\n // firstDeviationPosition === \"inside\" ||\n // isElementVisibleInScrollParent(firstDeviationEl)\n // ) {\n // hasScrolledRef.current = true;\n // return;\n // }\n\n // hasScrolledRef.current = true;\n // firstDeviationEl.scrollIntoView({\n // behavior: \"smooth\",\n // block: \"center\",\n // });\n // }, 600);\n\n // return () => clearTimeout(timer);\n // }, [\n // isExpanded,\n // nodeId,\n // show?.firstDeviationPosition,\n // show?.firstDeviationRef,\n // ]);\n \n return (\n <Box\n key={`${columnKey}-sec-${idx}`}\n ref={colRef}\n sx={{\n mb,\n width: \"100%\",\n display: \"flex\",\n flexDirection: \"column\",\n position: \"relative\",\n minWidth: 0,\n }}\n >\n {isExpanded && show?.showAbove && (\n <div\n style={{\n position: \"sticky\",\n top: 0,\n height: \"0px\",\n cursor: \"pointer\",\n }}\n onClick={() =>\n show?.showAboveRef?.current?.scrollIntoView({\n behavior: \"smooth\" as ScrollBehavior,\n block: \"center\",\n })\n }\n >\n <div\n style={{\n transform: `translateY(-50%) translateX(calc(100% ${\n columnKey === \"left\" ? \"+\" : \"-\"\n } 130px))`,\n position: \"absolute\",\n paddingTop: \"20px\",\n ...(columnKey === \"left\" ? {right: \"-20px\"} : {left: \"-20px\"}),\n }}\n >\n <ChevronUp\n color={\n show?.showAboveRef?.current\n ? window.getComputedStyle(show.showAboveRef.current).color\n : undefined\n }\n />\n </div>\n </div>\n )}\n <Accordion\n disableGutters\n expanded={isEmpty ? false : isExpanded}\n onChange={() => {\n if (!isEmpty) {\n onToggle();\n showOpenNodeRef.current = section.id;\n }\n }}\n sx={{\n boxShadow: \"none\",\n border: isEmpty ? \"1px dashed #E2E8F0\" : \"1px solid #E2E8F0\",\n bgcolor: isEmpty ? \"#FAFAFA\" : \"#FFFFFF\",\n borderRadius: \"6px\",\n flexGrow: 1,\n width: \"100%\",\n display: \"flex\",\n flexDirection: \"column\",\n minWidth: 0,\n \"&:before\": { display: \"none\" },\n \"& .MuiAccordion-heading\": {\n position: \"sticky\",\n top: -12,\n zIndex: 10,\n background: \"#fff\",\n },\n }}\n >\n <AccordionSummary\n expandIcon={isEmpty ? null : <ChevronDown size={16} />}\n sx={{\n minHeight: \"36px\",\n flexShrink: 0,\n cursor: isEmpty ? \"default\" : \"pointer\",\n \"& .MuiAccordionSummary-content\": {\n my: 0.5,\n display: \"grid\",\n alignItems: \"center\",\n minWidth: 0,\n width: \"100%\",\n },\n \"& .MuiAccordionSummary-expandIconWrapper\": {\n transition: \"transform 0.2s ease\",\n },\n \"& .MuiAccordionSummary-expandIconWrapper.Mui-expanded\": {\n transform: \"rotate(180deg)\",\n },\n }}\n >\n {hasTitle && (\n <Tooltip title={displayTitle} placement=\"top\">\n <Typography\n component=\"div\"\n sx={{\n fontSize: \"12px\",\n color: isEmpty ? \"#94A3B8\" : \"#19213D\",\n fontWeight: isEmpty ? 400 : 700,\n overflow: \"hidden\",\n textOverflow: \"ellipsis\",\n whiteSpace: \"nowrap\",\n width: \"100%\",\n minWidth: 0,\n }}\n >\n {renderSimpleMarkdown(visibleTitle, isMultipleMapping)}\n </Typography>\n </Tooltip>\n )}\n </AccordionSummary>\n {!isEmpty && (\n <AccordionDetails\n sx={{\n pt: 0,\n pb: 1.25,\n bgcolor: \"#FFFFFF\",\n flex: 1,\n display: \"flex\",\n flexDirection: \"column\",\n minWidth: 0,\n }}\n >\n {hasContent && (\n <MemoizedMarkdown\n content={baseContent}\n overlayContent={overlayContent}\n sxStyles={resolvedMarkdownStyles}\n highlights={highlightsToRender}\n maintainRelativeOrder={maintainRelativeOrder}\n highlightBg={highlightBg}\n suppressHighlightBg={suppressHighlightBg}\n deviationBadges={deviationBadgesToRender}\n collisionKey={collisionKey}\n />\n )}\n {(section.subsections || []).map((sub, subIdx) =>\n renderSubSectionAccordion({\n section: sub,\n keyPath: `${idx}-${subIdx}`,\n depth: 0,\n columnKey,\n parentNodeId,\n sectionOffset,\n rhsOrphanVisualIndexes,\n }),\n )}\n </AccordionDetails>\n )}\n </Accordion>\n {isExpanded && show?.showBelow && (\n <div\n style={{\n position: \"sticky\",\n bottom: 0,\n height: \"0px\",\n cursor: \"pointer\",\n }}\n onClick={() =>\n show?.showBelowRef?.current?.scrollIntoView({\n behavior: \"smooth\" as ScrollBehavior,\n block: \"center\",\n })\n }\n >\n <div\n style={{\n transform: `translateY(-50%) translateX(calc(100% ${\n columnKey === \"left\" ? \"+\" : \"-\"\n } 130px))`,\n position: \"absolute\",\n paddingBottom: \"20px\",\n ...(columnKey === \"left\" ? {right: \"-20px\"} : {left: \"-20px\"}),\n }}\n >\n <ChevronDown\n color={\n show?.showBelowRef?.current\n ? window.getComputedStyle(show.showBelowRef.current).color\n : undefined\n }\n />\n </div>\n </div>\n )}\n </Box>\n );\n};\n\nexport default SectionAccordion;\n"],"names":["renderSimpleMarkdown","text","isMultiTag","safeStringify","replace","split","map","part","i","startsWith","endsWith","children","slice","jsxs","style","display","alignItems","justifyContent","gap","width","jsx","minWidth","overflow","textOverflow","whiteSpace","padding","borderRadius","background","border","color","fontSize","fontWeight","flexShrink","lineHeight","marginRight","SectionAccordion","section","idx","columnKey","colRef","mb","isExpanded","onToggle","navigation","parentNodeId","showOpenNodeRef","resolvedMarkdownStyles","maintainRelativeOrder","showDeviationBadges","renderSubSectionAccordion","treeData","proposedSections","existingSections","deviationNumberRegistry","deviationParentRegistry","getBadgeRef","openSummaryPopup","getSectionCompareStyle","connectedSections","openMoreFunctionsPopup","isProposingFix","proposingFixNodeId","isRedlineFlow","isSideBySide","activeSideBySideSection","scrollSyncLocked","unifiedNumbering","toggleScrollSyncLocked","summaryPopupAnchorEl","useCompareContext","collisionKey","String","hasTitle","displayTitle","hasValue","title","isProposedFixTarget","id","nodeId","hasRedlineTags","hasMeaningfulRedlineTags","content","resolvedRedlineFlow","suppressHighlightBg","shouldOverlayContent","baseContent","stripRedlineTags","overlayContent","hasContent","displayContent","isEmpty","isMultipleMapping","refContentIds","length","visibleTitle","trimEnd","targetEvalResult","evaluationResult","lhsSelfIndex","refIndexes","lhsSection","find","s","selfIndex","leftDocId","input_index_map","rightDocId","counterPartNodeId","findNodeByIdDeep","nodes","n","contentId","subsections","found","popupBaseSec","popupRefSec","sectionOffset","React","useMemo","min","Infinity","normalizeInlineContent","value","raw","traverse","node","bNode","rNode","isTopLevel","topNodeId","mappedLhs","filter","l","includes","subNodeId","evalResult","devs","deviations","Object","keys","forEach","devKey","highlight","isMissingStr","normalizedHighlight","canRenderInlineHighlight","refId1","DEVIATION_BADGE_SEPARATOR","idx1","refId2","idx2","subs","bSubs","rSubs","maxLen","Math","max","mappedLhsSections","lhs","rhsSelfIndex","rhs","Boolean","rhsSection","rhsArrayIdx","findIndex","lhsArrayIdx","isSecOrphan","hasSingleMappedLhs","hasSingleMappedLhsSection","resolvedEvalResult","deviationColorData","evaluation_outputs","metadata","label_color","DEFAULT_DEVIAION_COLOR","deviationPalette","generateColorPalette","highlightBg","lhsDeviationDisplayIndexes","getLhsDeviationDisplayIndexes","Map","rhsOrphanVisualIndexes","indexes","nextIndex","isOneToOneSection","normalizeContent","resolveNode","rhsNode","isRoot","lhsNode","registryNodeId","reserveMappedIndexes","normalizedContent","entries","deviationKey","deviationMap","registryIndex","child","visit","nodeDeviations","isOrphan","position","indexOf","refId","isRenderable","Number","MAX_SAFE_INTEGER","entry","sort","a","b","set","firstDeviationKey","firstRefId","registeredParentNum","validatedParentNum","unifiedNum","leftNums","get","rightNums","rawDeviationEntries","currentIndex","item","deviationEntries","isMissingClause","leftIdx","rightIdx","rhsByIdIdx","lhsByIdIdx","actionId","counterpartHighlight","isDeviationOrphan","orphanVisualIndex","mappedLhsIndex","badgeLabel","getRhsMappedSectionNumber","fallbackNumber","firstOnly","mappedIdx","actualLhsIdx","baseStyle","deviationOutput","deviationScore","output_value","deviationPaletteForBadge","badgeStyle","badgeBg","badgeBorder","badgeText","summaryPayload","deviation_summary","deviation_title","deviation_impact","deviation_explanation","cognitive_decisioning","stackIndex","contentStr","paragraphs","paraIndex","p","overlappingDevs","_","dMap","hl","k","badgeRef","label","side","score","isConnected","has","showScrollLockToggle","current","onClick","e","stopPropagation","onSummaryClick","deviationBadgesToRender","highlightsToRender","show","hasScrolledRef","useRef","useEffect","Box","ref","sx","flexDirection","showAbove","top","height","cursor","showAboveRef","scrollIntoView","behavior","block","transform","paddingTop","right","left","ChevronUp","window","getComputedStyle","Accordion","disableGutters","expanded","onChange","boxShadow","bgcolor","flexGrow","zIndex","AccordionSummary","expandIcon","ChevronDown","size","minHeight","my","transition","Tooltip","placement","Typography","component","AccordionDetails","pt","pb","flex","MemoizedMarkdown","sxStyles","highlights","deviationBadges","sub","subIdx","keyPath","depth","showBelow","bottom","showBelowRef","paddingBottom"],"mapp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AAQ4E,aAAe,IAAI1G,IAAI,CAACmU,EAAKC,IACrCzR,EAA0B,CACxBb,QAASqS,EACTE,QAAS,GAAGtS,KAAOqS,IACnBE,MAAO,EACPtS,YACAM,eACAwE,iBACAiE,mCAMT5I,GAAc8O,IAAMsD,WACnBzT,EAAC,MAAA,CACCN,MAAO,CACL2L,SAAU,SACVqI,OAAQ,EACR7C,OAAQ,MACRC,OAAQ,WAEVjB,QAAS,IACPM,IAAMwD,cAAc/D,SAASoB,eAAe,CAC1CC,SAAU,SACVC,MAAO,WAIX3R,SAAAS,EAAC,MAAA,CACCN,MAAO,CACLyR,UAAW,yCACK,SAAdjQ,EAAuB,IAAM,cAE/BmK,SAAU,WACVuI,cAAe,UACG,SAAd1S,EAAuB,CAACmQ,MAAO,SAAW,CAACC,KAAM,UAGvD/R,SAAAS,EAACoS,EAAA,CACC3R,MACE0P,IAAMwD,cAAc/D,QAChB4B,OAAOC,iBAAiBtB,GAAKwD,aAAa/D,SAASnP,WACnD,UAvLT,GAAGS,SAAiBD"}
|
|
1
|
+
{"version":3,"file":"SectionAccordion.js","sources":["../../../../src/features/CognitiveCompare/components/SectionAccordion.tsx"],"sourcesContent":["import React, { useEffect, useRef } from \"react\";\nimport {\n Accordion,\n AccordionDetails,\n AccordionSummary,\n Box,\n Tooltip,\n Typography,\n} from \"@mui/material\";\nimport { ChevronDown, ChevronUp } from \"lucide-react\";\nimport { MemoizedMarkdown } from \"../hooks/memoizedMarkdown\";\nimport { useCompareContext } from \"../CompareContext\";\nimport { \n generateColorPalette, \n hasValue, \n safeStringify,\n DEVIATION_BADGE_SEPARATOR,\n isMissingStr,\n escapeRegExp,\n hasMeaningfulRedlineTags,\n stripRedlineTags,\n findTextMatchRange,\n getRhsMappedSectionNumber,\n hasSingleMappedLhsSection,\n getLhsDeviationDisplayIndexes,\n} from \"../CognitiveComparehelpers\";\nimport { findTextRangeWithFormatting } from \"../utils/normalizeInlineMarkdown\";\nimport { DEFAULT_DEVIAION_COLOR } from \"../CognitiveCompareConstants\";\nimport { DeviationDataEntry, SectionBlock, StyleVariant } from \"../CognitiveCompareTypes\";\nimport { DeviationNavigationEntry } from \"../hooks/useDeviationNavigation\";\nimport { normalizeRedlineMarkdown } from \"../utils/normalizeRedlineMarkdown\";\n\nconst renderSimpleMarkdown = (text: string, isMultiTag = false) => {\n if (!text) return null;\n\n const normalizedText = safeStringify(text).replace(/\\\\n/g, \"\\n\");\n const parts = normalizedText.split(/(\\*\\*.*?\\*\\*)/g);\n\n return parts.map((part: string, i: number) => {\n if (part.startsWith(\"**\") && part.endsWith(\"**\")) {\n return <strong key={i}>{part.slice(2, -2)}</strong>;\n }\n\n return (\n <div\n key={i}\n style={{\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"space-between\",\n gap: \"8px\",\n width: \"100%\",\n }}\n >\n <span\n style={{\n minWidth: 0,\n overflow: \"hidden\",\n textOverflow: \"ellipsis\",\n whiteSpace: \"nowrap\",\n }}\n >\n {part}\n </span>\n\n {isMultiTag && (\n <span\n style={{\n display: \"inline-flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n padding: \"0px 6px\",\n borderRadius: \"9999px\",\n background: \"#F3F4F6\",\n border: \"1px solid #D1D5DB\",\n color: \"#6B7280\",\n fontSize: \"9px\",\n fontWeight: 500,\n whiteSpace: \"nowrap\",\n flexShrink: 0,\n lineHeight: 1.4,\n marginRight: \"4px\",\n }}\n >\n Multiple\n </span>\n )}\n </div>\n );\n });\n};\n\nconst findScrollParent = (element: HTMLElement | null): HTMLElement | null => {\n let current = element?.parentElement || null;\n while (current) {\n const style = window.getComputedStyle(current);\n const overflowY = style.overflowY;\n const canScroll =\n (overflowY === \"auto\" || overflowY === \"scroll\") &&\n current.scrollHeight > current.clientHeight;\n\n if (canScroll) return current;\n current = current.parentElement;\n }\n\n return null;\n};\n\nconst isElementVisibleInScrollParent = (element: HTMLElement) => {\n const scrollParent = findScrollParent(element);\n const rect = element.getBoundingClientRect();\n const parentRect = scrollParent?.getBoundingClientRect() || {\n top: 0,\n bottom: window.innerHeight,\n };\n\n return rect.top >= parentRect.top && rect.bottom <= parentRect.bottom;\n};\n\ntype SectionAccordionProps = {\n section: SectionBlock;\n idx: number;\n columnKey: \"left\" | \"right\";\n colRef: React.RefObject<HTMLDivElement>;\n mb?: number;\n parentNodeId?: string;\n isExpanded: boolean;\n onToggle: () => void;\n navigation: DeviationNavigationEntry | null;\n};\n\nconst SectionAccordion = ({\n section,\n idx,\n columnKey,\n colRef,\n mb = 1,\n isExpanded,\n onToggle,\n navigation,\n parentNodeId = \"\",\n}: SectionAccordionProps) => {\n const {\n showOpenNodeRef,\n resolvedMarkdownStyles,\n maintainRelativeOrder,\n showDeviationBadges = false,\n renderSubSectionAccordion,\n treeData,\n proposedSections,\n existingSections,\n deviationNumberRegistry,\n deviationParentRegistry,\n getBadgeRef,\n openSummaryPopup,\n getSectionCompareStyle,\n connectedSections,\n openMoreFunctionsPopup,\n isProposingFix,\n proposingFixNodeId,\n isRedlineFlow,\n isSideBySide,\n activeSideBySideSection,\n scrollSyncLocked,\n unifiedNumbering,\n toggleScrollSyncLocked,\n summaryPopupAnchorEl,\n } = useCompareContext();\n const collisionKey = `${isSideBySide ? \"1\" : \"0\"}-${String(activeSideBySideSection ?? \"\")}`;\n const hasTitle = (section.displayTitle ?? true) && hasValue(section.title);\n const isProposedFixTarget =\n !!isProposingFix &&\n !!proposingFixNodeId &&\n columnKey === \"left\" &&\n (section.id === proposingFixNodeId ||\n section.nodeId === proposingFixNodeId ||\n section.contentId === proposingFixNodeId);\n \n const hasRedlineTags = hasMeaningfulRedlineTags(section.content);\n const inferredRedlineFlow = hasRedlineTags;\n const resolvedRedlineFlow =\n typeof isRedlineFlow === \"boolean\" ? isRedlineFlow : inferredRedlineFlow;\n const suppressHighlightBg = hasRedlineTags;\n const changeHistoryContent = section.change_history;\n\n // Use all visible redline text as the base so changed-only highlights can match.\n const shouldOverlayContent = resolvedRedlineFlow && hasRedlineTags;\n const normalizedRedlineContent = React.useMemo(\n () => shouldOverlayContent\n ? normalizeRedlineMarkdown(safeStringify(section.content))\n : safeStringify(section.content),\n [section.content, shouldOverlayContent],\n );\n const baseContent = shouldOverlayContent\n ? stripRedlineTags(normalizedRedlineContent)\n : section.content;\n const overlayContent = shouldOverlayContent ? normalizedRedlineContent : undefined;\n const fallbackContent =\n hasRedlineTags && hasValue(changeHistoryContent)\n ? safeStringify(changeHistoryContent)\n : undefined;\n const hasContent = ((section.displayContent ?? true) || hasRedlineTags) && hasValue(section.content);\n const isEmpty = !hasTitle && !hasContent;\n\n \n\n let displayTitle = section.title;\n if (!hasTitle) {\n displayTitle = hasContent ? \"No Title Found\" : \"No Matching Section Found\";\n }\n const isMultipleMapping =\n columnKey === \"left\" &&\n (section.isMultipleMapping || (section.refContentIds?.length ?? 1) > 1);\n const visibleTitle =\n columnKey === \"left\" && displayTitle.length > 29\n ? `${displayTitle.slice(0, 29).trimEnd()}...`\n : displayTitle;\n\n let targetEvalResult = section.evaluationResult;\n if (!targetEvalResult && columnKey === \"right\") {\n if (maintainRelativeOrder) {\n const lhsSelfIndex = section.refIndexes?.[0];\n const lhsSection = proposedSections.find((s: any) => s.selfIndex === lhsSelfIndex);\n targetEvalResult = lhsSection?.evaluationResult;\n } else {\n targetEvalResult = proposedSections[idx]?.evaluationResult;\n }\n }\n\n const leftDocId = treeData?.input_index_map?.[\"0\"];\n const rightDocId = treeData?.input_index_map?.[\"1\"];\n const counterPartNodeId = columnKey === \"left\" ? rightDocId : leftDocId;\n const findNodeByIdDeep = (nodes: any[], id?: string): any => {\n if (!id || !nodes) return null;\n for (const n of nodes) {\n if (n.id === id || n.nodeId === id || n.contentId === id) return n;\n if (n.subsections?.length) {\n const found = findNodeByIdDeep(n.subsections, id);\n if (found) return found;\n }\n }\n return null;\n };\n\n let popupBaseSec: any = columnKey === \"left\" ? section : findNodeByIdDeep(proposedSections, section.id);\n let popupRefSec: any = columnKey === \"right\" ? section : findNodeByIdDeep(existingSections, section.id);\n\n const sectionOffset = React.useMemo(() => {\n if (!maintainRelativeOrder) return 0;\n let min = Infinity;\n\n const normalizeInlineContent = (value: unknown) => {\n const raw = safeStringify(value || \"\").replace(/\\\\n/g, \"\\n\");\n return hasMeaningfulRedlineTags(raw)\n ? stripRedlineTags(normalizeRedlineMarkdown(raw))\n : raw;\n };\n\n const canRenderInlineHighlight = (node: SectionBlock, highlight: unknown) => {\n if (typeof highlight !== \"string\" || isMissingStr(highlight)) return false;\n const content = normalizeInlineContent(node?.content);\n const normalizedHighlight = normalizeInlineContent(highlight);\n return !!normalizedHighlight && !!findTextMatchRange(content, normalizedHighlight);\n };\n\n const traverse = (node: any, bNode: any, rNode: any, isTopLevel: boolean) => {\n if (!node) return;\n\n let topNodeId = node.nodeId || node.id;\n if (isTopLevel && columnKey === \"right\") {\n const mappedLhs = proposedSections.filter((l: any) => l.refIndexes?.includes(node.selfIndex));\n if (mappedLhs.length > 0) topNodeId = mappedLhs[0].nodeId || mappedLhs[0].id;\n }\n\n let subNodeId = node.nodeId || node.id || bNode?.nodeId || bNode?.id || rNode?.nodeId || rNode?.id;\n\n const evalResult = node.evaluationResult || bNode?.evaluationResult || rNode?.evaluationResult;\n const devs = evalResult?.deviations || {};\n Object.keys(devs).forEach(devKey => {\n const highlight = devs[devKey]?.[parentNodeId];\n const renderNode = columnKey === \"left\" ? (bNode || node) : (rNode || node);\n if (!canRenderInlineHighlight(renderNode, highlight)) return;\n\n const refId1 = `${topNodeId}${DEVIATION_BADGE_SEPARATOR}${devKey}`;\n const idx1 = deviationNumberRegistry?.[refId1];\n if (idx1 !== undefined && idx1 !== null && idx1 < min) min = idx1;\n\n const refId2 = `${subNodeId}${DEVIATION_BADGE_SEPARATOR}${devKey}`;\n const idx2 = deviationNumberRegistry?.[refId2];\n if (idx2 !== undefined && idx2 !== null && idx2 < min) min = idx2;\n });\n\n const subs = node.subsections || [];\n const bSubs = bNode?.subsections || [];\n const rSubs = rNode?.subsections || [];\n const maxLen = Math.max(subs.length, bSubs.length, rSubs.length);\n\n for (let i = 0; i < maxLen; i++) {\n traverse(subs[i], bSubs[i], rSubs[i], false);\n }\n };\n\n const mappedLhsSections = columnKey === \"right\"\n ? proposedSections.filter((lhs: SectionBlock) => lhs.refIndexes?.includes(section.selfIndex as number))\n : [];\n\n if (mappedLhsSections.length === 1) {\n const mappedLhs = mappedLhsSections[0] as SectionBlock;\n const mappedRhsSections = (mappedLhs.refIndexes || [])\n .map((rhsSelfIndex: number) =>\n existingSections.find((rhs: SectionBlock) => rhs.selfIndex === rhsSelfIndex),\n )\n .filter(Boolean);\n\n mappedRhsSections.forEach((rhsSection: any) => {\n traverse(rhsSection, mappedLhs, rhsSection, true);\n });\n } else {\n traverse(section, popupBaseSec, popupRefSec, true);\n }\n\n return min !== Infinity ? min - 1 : 0;\n }, [section, popupBaseSec, popupRefSec, columnKey, parentNodeId, deviationNumberRegistry, maintainRelativeOrder, proposedSections, existingSections]);\n if (maintainRelativeOrder) {\n if (columnKey === \"left\") {\n const rhsSelfIndex = section.refIndexes?.[0];\n const rhsArrayIdx = existingSections.findIndex((s: any) => s.selfIndex === rhsSelfIndex);\n popupRefSec = rhsArrayIdx !== -1\n ? existingSections[rhsArrayIdx]\n : findNodeByIdDeep(existingSections, section.id);\n } else {\n const lhsSelfIndex = section.refIndexes?.[0];\n const lhsArrayIdx = proposedSections.findIndex((s: any) => s.selfIndex === lhsSelfIndex);\n popupBaseSec = lhsArrayIdx !== -1\n ? proposedSections[lhsArrayIdx]\n : findNodeByIdDeep(proposedSections, section.id);\n }\n }\n\n const isSecOrphan = columnKey === \"left\" ? !popupRefSec : !popupBaseSec;\n const hasSingleMappedLhs =\n maintainRelativeOrder &&\n columnKey === \"right\" &&\n hasSingleMappedLhsSection(section, proposedSections);\n\n const resolvedEvalResult = targetEvalResult || popupBaseSec?.evaluationResult || popupRefSec?.evaluationResult;\n const deviationColorData = resolvedEvalResult?.evaluation_outputs?.metadata?.label_color ?? DEFAULT_DEVIAION_COLOR;\n const deviationPalette = generateColorPalette(deviationColorData);\n const { highlightBg } = deviationPalette;\n const deviations = resolvedEvalResult?.deviations || {};\n\n const lhsDeviationDisplayIndexes = React.useMemo(\n () =>\n maintainRelativeOrder && columnKey === \"right\"\n ? getLhsDeviationDisplayIndexes(\n proposedSections,\n leftDocId,\n deviationNumberRegistry,\n )\n : new Map<string, number>(),\n [\n maintainRelativeOrder,\n columnKey,\n proposedSections,\n leftDocId,\n deviationNumberRegistry,\n ],\n );\n\n let nodeId = section.nodeId || section.id;\n\n // For RHS mapped sections, nodeId must match what the registry used (LHS id)\n if (maintainRelativeOrder && columnKey !== \"left\") {\n const mappedLhs = proposedSections.filter((l: any) => l.refIndexes?.includes(section.selfIndex));\n if (mappedLhs.length > 0) {\n nodeId = mappedLhs[0].nodeId || mappedLhs[0].id;\n } else if (popupBaseSec?.id) {\n nodeId = popupBaseSec.nodeId || popupBaseSec.id;\n }\n }\n\n const rhsOrphanVisualIndexes = React.useMemo(() => {\n const indexes = new Map<string, number>();\n if (!maintainRelativeOrder || columnKey !== \"right\") return indexes;\n\n let nextIndex = 1;\n const mappedLhsSections = proposedSections.filter((lhs: SectionBlock) =>\n lhs.refIndexes?.includes(section.selfIndex as number),\n );\n const isOneToOneSection =\n mappedLhsSections.length === 1 &&\n mappedLhsSections[0].refIndexes?.length === 1;\n const normalizeContent = (value: unknown) =>\n safeStringify(value || \"\").replace(/\\\\n/g, \"\\n\");\n\n const resolveNode = (rhsNode: SectionBlock, isRoot: boolean) => {\n const lhsNode = isRoot\n ? mappedLhsSections[0]\n : findNodeByIdDeep(\n proposedSections,\n rhsNode.nodeId || rhsNode.id || rhsNode.contentId,\n );\n const evalResult =\n rhsNode.evaluationResult || lhsNode?.evaluationResult;\n const registryNodeId = lhsNode\n ? lhsNode.nodeId || lhsNode.id\n : rhsNode.nodeId || rhsNode.id;\n return { lhsNode, evalResult, registryNodeId };\n };\n\n if (isOneToOneSection) {\n const reserveMappedIndexes = (rhsNode: SectionBlock | null, isRoot = false) => {\n if (!rhsNode) return;\n const { lhsNode, evalResult, registryNodeId } = resolveNode(\n rhsNode,\n isRoot,\n );\n const normalizedContent = normalizeContent(rhsNode.content);\n\n Object.entries(evalResult?.deviations || {}).forEach(\n ([deviationKey, deviationMap]: [string, any]) => {\n const highlight = deviationMap[parentNodeId];\n const normalizedHighlight = normalizeContent(highlight);\n const isMapped =\n !!lhsNode &&\n !isMissingStr(deviationMap[counterPartNodeId as string]);\n if (\n !isMapped ||\n !normalizedHighlight ||\n !findTextMatchRange(normalizedContent, normalizedHighlight)\n ) return;\n\n const refId = `${registryNodeId}${DEVIATION_BADGE_SEPARATOR}${deviationKey}`;\n const registryIndex = deviationNumberRegistry[refId];\n if (registryIndex === undefined || registryIndex === null) return;\n nextIndex = Math.max(\n nextIndex,\n Math.max(1, registryIndex - (sectionOffset || 0)) + 1,\n );\n },\n );\n\n (rhsNode.subsections || []).forEach((child: SectionBlock) =>\n reserveMappedIndexes(child),\n );\n };\n\n reserveMappedIndexes(section, true);\n }\n\n const visit = (rhsNode: SectionBlock | null, isRoot = false) => {\n if (!rhsNode) return;\n\n const { lhsNode, evalResult, registryNodeId } = resolveNode(\n rhsNode,\n isRoot,\n );\n const nodeDeviations = evalResult?.deviations || {};\n const normalizedContent = normalizeContent(rhsNode.content);\n\n Object.entries(nodeDeviations)\n .map(([deviationKey, deviationMap]: [string, any]) => {\n const highlight = deviationMap[parentNodeId];\n const isOrphan =\n !lhsNode || isMissingStr(deviationMap[counterPartNodeId as string]);\n const normalizedHighlight = normalizeContent(highlight);\n let position = -1;\n if (normalizedHighlight) {\n position = findTextMatchRange(normalizedContent, normalizedHighlight)?.start ?? -1;\n if (position === -1) {\n position = findTextRangeWithFormatting(normalizedContent, normalizedHighlight)?.start ?? -1;\n }\n }\n const refId = `${registryNodeId}${DEVIATION_BADGE_SEPARATOR}${deviationKey}`;\n return {\n refId,\n isRenderable:\n isOrphan && !!normalizedHighlight && !isMissingStr(highlight),\n position,\n registryIndex: deviationNumberRegistry[refId] ?? Number.MAX_SAFE_INTEGER,\n };\n })\n .filter((entry) => entry.isRenderable)\n .sort((a, b) => {\n const aPosition =\n a.position === -1 ? Number.MAX_SAFE_INTEGER : a.position;\n const bPosition =\n b.position === -1 ? Number.MAX_SAFE_INTEGER : b.position;\n return aPosition - bPosition || a.registryIndex - b.registryIndex;\n })\n .forEach((entry) => {\n indexes.set(entry.refId, nextIndex++);\n });\n\n (rhsNode.subsections || []).forEach((child: SectionBlock) => visit(child));\n };\n\n visit(section, true);\n return indexes;\n }, [\n maintainRelativeOrder,\n columnKey,\n section,\n proposedSections,\n parentNodeId,\n counterPartNodeId,\n deviationNumberRegistry,\n sectionOffset,\n ]);\n\n // Derive validatedParentNum from registry\n const firstDeviationKey = Object.keys(deviations)[0];\n const firstRefId = firstDeviationKey ? `${nodeId}${DEVIATION_BADGE_SEPARATOR}${firstDeviationKey}` : null;\n const registeredParentNum = firstRefId ? (deviationParentRegistry?.[firstRefId] as number) : null;\n\n let validatedParentNum: string | number = idx + 1;\n\n if (maintainRelativeOrder && unifiedNumbering) {\n const unifiedNum = columnKey === \"left\" \n ? unifiedNumbering.leftNums.get(section?.id as string) \n : unifiedNumbering.rightNums.get(section?.id as string);\n \n if (isSecOrphan && unifiedNum !== undefined) {\n validatedParentNum = unifiedNum;\n } else if (registeredParentNum !== null && registeredParentNum !== undefined && registeredParentNum >= 0) {\n validatedParentNum = registeredParentNum;\n } else if (unifiedNum !== undefined) {\n validatedParentNum = unifiedNum;\n }\n } else if (registeredParentNum !== null && registeredParentNum !== undefined && registeredParentNum >= 0) {\n validatedParentNum = registeredParentNum;\n }\n // const deviationNodeIdRef = useRef<string | undefined>(deviationNodeIdToView);\n // const deviationNodeParentRef = useRef<string | null>(deviationTargetParentId || null);\n const highlights: string[] = [];\n // Mapp through deviations to pass to memoized markdown for highlighting, also prepare deviation badges \n let nextFallbackDeviationIndex = Math.max(\n 0,\n ...Object.keys(deviations).map(\n (deviationKey) =>\n deviationNumberRegistry[\n `${nodeId}${DEVIATION_BADGE_SEPARATOR}${deviationKey}`\n ],\n ).filter(\n (value): value is number => typeof value === \"number\" && Number.isFinite(value),\n ),\n ) + 1;\n const rawDeviationEntries = Object.entries(deviations).map(([deviationKey, deviationMap]: [string, any]) => {\n const refId = `${nodeId}${DEVIATION_BADGE_SEPARATOR}${deviationKey}`;\n // Registry numbering is presentation metadata, not a render gate. A valid\n // highlight must still receive a badge if registry traversal missed it.\n const currentIndex = deviationNumberRegistry[refId] ?? nextFallbackDeviationIndex++;\n return { deviationKey, deviationMap, refId, currentIndex };\n });\n\n // Sort by global index BEFORE mapping to prevent negative/zero offsets\n rawDeviationEntries.sort((a, b) => a.currentIndex - b.currentIndex);\n\n const deviationEntries = rawDeviationEntries.map((item) => {\n const { deviationKey, deviationMap, refId } = item;\n let currentIndex = item.currentIndex;\n\n let highlight = deviationMap[parentNodeId];\n const isMissingClause = isMissingStr(highlight);\n\n if (isMissingClause) {\n highlight = \"\"; \n } else if (!highlight) {\n return null; \n }\n\n highlights.push(highlight);\n\n // MAPPING Stricter Left/Right Index mapping to prevent cross-wiring\n let leftIdx = idx;\n let rightIdx = idx;\n\n if (maintainRelativeOrder) {\n if (columnKey === \"left\") {\n const rhsSelfIndex = section.refIndexes?.[0];\n const rhsArrayIdx = existingSections.findIndex((s: any) => s.selfIndex === rhsSelfIndex);\n if (rhsArrayIdx !== -1) {\n rightIdx = rhsArrayIdx;\n } else {\n const rhsByIdIdx = existingSections.findIndex((s: SectionBlock) =>\n s.id === section.id || s.nodeId === section.nodeId || s.contentId === section.contentId,\n );\n rightIdx = rhsByIdIdx !== -1 ? rhsByIdIdx : idx;\n }\n } else {\n const lhsSelfIndex = section.refIndexes?.[0];\n const lhsArrayIdx = proposedSections.findIndex((s: any) => s.selfIndex === lhsSelfIndex);\n if (lhsArrayIdx !== -1) {\n leftIdx = lhsArrayIdx;\n } else {\n const lhsByIdIdx = proposedSections.findIndex((s: SectionBlock) =>\n s.id === section.id || s.nodeId === section.nodeId || s.contentId === section.contentId,\n );\n leftIdx = lhsByIdIdx !== -1 ? lhsByIdIdx : idx;\n }\n }\n }\n\n const actionId = `${nodeId}${DEVIATION_BADGE_SEPARATOR}${deviationKey}${DEVIATION_BADGE_SEPARATOR}${leftIdx}${DEVIATION_BADGE_SEPARATOR}${rightIdx}`;\n \n // CONTENT Use the calculated mapped indices to grab correct counterpart text\n // const counterPartContentRaw = columnKey === \"left\" ? existingSections[rightIdx]?.content : proposedSections[leftIdx]?.content;\n const counterpartHighlight = deviationMap[counterPartNodeId as string];\n \n // Commented Out code for removing the highlight swallowing logic\n // let simulatedContent = safeStringify(counterPartContentRaw);\n\n // const counterPartHighlight = Object.keys(deviations)\n // .map(key => ({ key, text: deviations[key][counterPartNodeId as string] }))\n // .filter(item => !isMissingStr(item.text))\n // .sort((a, b) => b.text.length - a.text.length);\n\n // const survivingKeys = new Set();\n // counterPartHighlight.forEach(item => {\n // const clean = item.text.replace(/\\\\(['’])/g, \"$1\").replace(/\\\\n/g, \"\\n\");\n // if(!clean) return;\n\n // const regex = new RegExp(escapeRegExp(clean));\n // if(regex.test(simulatedContent)){\n // survivingKeys.add(item.key);\n // simulatedContent = simulatedContent.replace(regex, `__TOKEN_${item.key}__`);\n // }\n // });\n\n // const isCounterPartOverlapping = !isMissingStr(counterpartHighlight) && !survivingKeys.has(deviationKey);\n\n const isDeviationOrphan = isSecOrphan || isMissingStr(counterpartHighlight);\n const orphanVisualIndex = rhsOrphanVisualIndexes.get(refId);\n const mappedLhsIndex = lhsDeviationDisplayIndexes.get(refId);\n if (\n maintainRelativeOrder &&\n columnKey === \"right\" &&\n isDeviationOrphan &&\n orphanVisualIndex !== undefined\n ) {\n currentIndex = orphanVisualIndex;\n } else if (\n maintainRelativeOrder &&\n columnKey === \"right\" &&\n !isDeviationOrphan &&\n mappedLhsIndex !== undefined\n ) {\n currentIndex = mappedLhsIndex;\n } else if (\n maintainRelativeOrder &&\n sectionOffset !== undefined &&\n (columnKey !== \"right\" || isDeviationOrphan || hasSingleMappedLhs)\n ) {\n currentIndex = currentIndex - sectionOffset;\n }\n currentIndex = Math.max(1, currentIndex);\n\n const badgeParentNum =\n maintainRelativeOrder &&\n columnKey === \"right\" &&\n isDeviationOrphan &&\n unifiedNumbering\n ? getRhsMappedSectionNumber({\n section,\n proposedSections,\n leftNums: unifiedNumbering.leftNums,\n fallbackNumber: String(validatedParentNum),\n firstOnly: true,\n })\n : validatedParentNum;\n const badgeLabel = `${badgeParentNum}.${currentIndex}`;\n\n let mappedIdx = idx;\n if (columnKey === \"right\" && maintainRelativeOrder) {\n const lhsSelfIndex = section.refIndexes?.[0];\n const actualLhsIdx = proposedSections.findIndex((s: any) => s.selfIndex === lhsSelfIndex);\n if (actualLhsIdx !== -1) {\n mappedIdx = actualLhsIdx;\n } else {\n const lhsByIdIdx = proposedSections.findIndex((s: SectionBlock) =>\n s.id === section.id || s.nodeId === section.nodeId || s.contentId === section.contentId,\n );\n if (lhsByIdIdx !== -1) mappedIdx = lhsByIdIdx;\n }\n }\n const baseStyle = getSectionCompareStyle ? getSectionCompareStyle(mappedIdx) : null;\n \n // let isUIOverlapping = false;\n // if (highlight) {\n // const allHighlights = Object.values(deviations).map((d: any) => d[parentNodeId as string]).filter(Boolean);\n // isUIOverlapping = allHighlights.some((otherHl: any) => otherHl.length > highlight.length && otherHl.includes(highlight));\n // }\n\n const deviationOutput = deviationMap?.evaluation_outputs || resolvedEvalResult?.evaluation_outputs;\n const deviationScore = deviationOutput?.output_value ?? null;\n const deviationColorForBadge = deviationOutput?.metadata?.label_color ?? deviationColorData;\n const deviationPaletteForBadge = generateColorPalette(deviationColorForBadge);\n let badgeStyle = baseStyle\n ? {\n ...baseStyle,\n badgeBg: deviationPaletteForBadge.badgeBg,\n badgeBorder: deviationPaletteForBadge.badgeBorder,\n badgeText: deviationPaletteForBadge.badgeText,\n }\n : { ...deviationPaletteForBadge };\n\n // if (isUIOverlapping) {\n // badgeStyle.badgeBg = \"#FFFBEB\";\n // badgeStyle.badgeBorder = \"#FCD34D\";\n // badgeStyle.badgeText = \"#B45309\";\n // badgeStyle.highlightBg = \"#FDE68A\";\n // }\n\n const summaryPayload = deviationMap?.deviation_summary\n ? {\n deviation_summary: deviationMap.deviation_summary,\n deviation_title: deviationMap?.deviation_title || resolvedEvalResult?.deviation_title,\n deviation_impact: deviationMap?.deviation_impact || resolvedEvalResult?.deviation_impact,\n deviation_explanation:\n deviationMap?.deviation_explanation || resolvedEvalResult?.deviation_explanation,\n evaluation_outputs: deviationOutput,\n cognitive_decisioning:\n deviationMap?.cognitive_decisioning || resolvedEvalResult?.cognitive_decisioning,\n }\n : null;\n\n // Logic for overlapping highlight badges\n let stackIndex = 0;\n const contentStr = baseContent || \"\";\n if (highlight && contentStr) {\n const paragraphs = contentStr.split(/\\n{2,}/);\n const paraIndex = paragraphs.findIndex(p => p.includes(highlight));\n if (paraIndex !== -1) {\n const devsInPara = Object.entries(deviations)\n .filter(([_, dMap]: any) => {\n const hl = dMap[parentNodeId];\n return hl && paragraphs[paraIndex].includes(hl);\n })\n .sort((a: any, b: any) => paragraphs[paraIndex].indexOf(a[1][parentNodeId]) - paragraphs[paraIndex].indexOf(b[1][parentNodeId]));\n const overlappingDevs = devsInPara.filter(([_, dMap]: any) => {\n const hl = dMap[parentNodeId];\n return hl && (hl.includes(highlight) || highlight.includes(hl));\n });\n if (overlappingDevs.length > 1) {\n stackIndex = Math.max(0, overlappingDevs.findIndex(([k]) => k === deviationKey));\n }\n }\n }\n const badgeRef = getBadgeRef(columnKey, refId);\n\n return {\n id: refId,\n actionId: actionId,\n label: badgeLabel,\n highlight,\n side: columnKey,\n style: badgeStyle,\n stackIndex,\n score: deviationScore,\n isConnected: connectedSections?.has(actionId),\n showScrollLockToggle:\n connectedSections?.has(actionId) ||\n (isSideBySide && activeSideBySideSection === actionId) ||\n (!!summaryPopupAnchorEl && summaryPopupAnchorEl === badgeRef.current),\n scrollSyncLocked,\n toggleScrollSyncLocked,\n isOrphan: isDeviationOrphan,\n isMissingClause,\n badgeRef,\n onClick: (e: React.MouseEvent) => {\n e.stopPropagation();\n\n if (openMoreFunctionsPopup) {\n openMoreFunctionsPopup(\n e as any, \n popupBaseSec || { id: \"orphan-left\", title: \"\", content: \"\" }, \n isDeviationOrphan, \n popupRefSec || { id: \"orphan-right\", title: \"\", content: \"\" }, \n actionId as any, \n badgeStyle as StyleVariant | null\n );\n }\n },\n\n onSummaryClick: (e: React.MouseEvent) => {\n e.stopPropagation();\n openSummaryPopup(e, actionId, isDeviationOrphan, summaryPayload);\n },\n };\n }).filter(Boolean);\n const baseShouldRenderBadges = showDeviationBadges || isProposedFixTarget;\n const shouldRenderBadges = baseShouldRenderBadges;\n const deviationBadgesToRender = shouldRenderBadges ? deviationEntries : [];\n\n // NEW: Sync highlights to prevent ghost highlights\n const highlightsToRender = deviationEntries.map((b: any) => b.highlight).filter(Boolean)\n\n const show =\n section.id && columnKey === navigation?.columnKey ? navigation : null;\n\n // Local ref added to prevent race conditions\n const hasScrolledRef = React.useRef(false);\n\n // Reset scroll flag when section closed\n useEffect(() => {\n if (!isExpanded) {\n hasScrolledRef.current = false;\n }\n }, [isExpanded]);\n // useEffect(()=>{\n // deviationNodeIdRef.current = deviationNodeIdToView;\n // deviationNodeParentRef.current = deviationTargetParentId || null;\n // }, [deviationNodeIdToView, deviationTargetParentId]);\n\n // Commented out the auto scroll functionality which was breaking the LSC -> RHS opening\n // useEffect(() => {\n // const isDeviationTargetSection =\n // !!deviationNodeIdRef.current &&\n // !!deviationNodeParentRef.current &&\n // nodeId === deviationNodeParentRef.current;\n // // NEW CONDITION: Check if the deviation target is one of the direct subsections\n // const isTargetInSubsections =\n // !!deviationNodeIdRef.current &&\n // (section.subsections || []).some(\n // (sub) => sub.id === deviationNodeIdRef.current\n // );\n\n // // Abort scroll if it's already scrolled, not expanded, is the target section, \n // // OR if the target is inside its subsections\n // if (\n // !isExpanded ||\n // hasScrolledRef.current ||\n // isDeviationTargetSection ||\n // isTargetInSubsections\n // ) {\n // return;\n // }\n\n // const timer = setTimeout(() => {\n // const firstDeviationEl = show?.firstDeviationRef?.current;\n // const firstDeviationPosition = show?.firstDeviationPosition;\n\n // if (!firstDeviationEl) {\n // hasScrolledRef.current = true;\n // return;\n // }\n\n // if (\n // firstDeviationPosition === \"inside\" ||\n // isElementVisibleInScrollParent(firstDeviationEl)\n // ) {\n // hasScrolledRef.current = true;\n // return;\n // }\n\n // hasScrolledRef.current = true;\n // firstDeviationEl.scrollIntoView({\n // behavior: \"smooth\",\n // block: \"center\",\n // });\n // }, 600);\n\n // return () => clearTimeout(timer);\n // }, [\n // isExpanded,\n // nodeId,\n // show?.firstDeviationPosition,\n // show?.firstDeviationRef,\n // ]);\n \n return (\n <Box\n key={`${columnKey}-sec-${idx}`}\n ref={colRef}\n sx={{\n mb,\n width: \"100%\",\n display: \"flex\",\n flexDirection: \"column\",\n position: \"relative\",\n minWidth: 0,\n }}\n >\n {isExpanded && show?.showAbove && (\n <div\n style={{\n position: \"sticky\",\n top: 0,\n height: \"0px\",\n cursor: \"pointer\",\n }}\n onClick={() =>\n show?.showAboveRef?.current?.scrollIntoView({\n behavior: \"smooth\" as ScrollBehavior,\n block: \"center\",\n })\n }\n >\n <div\n style={{\n transform: `translateY(-50%) translateX(calc(100% ${\n columnKey === \"left\" ? \"+\" : \"-\"\n } 130px))`,\n position: \"absolute\",\n paddingTop: \"20px\",\n ...(columnKey === \"left\" ? {right: \"-20px\"} : {left: \"-20px\"}),\n }}\n >\n <ChevronUp\n color={\n show?.showAboveRef?.current\n ? window.getComputedStyle(show.showAboveRef.current).color\n : undefined\n }\n />\n </div>\n </div>\n )}\n <Accordion\n disableGutters\n expanded={isEmpty ? false : isExpanded}\n onChange={() => {\n if (!isEmpty) {\n onToggle();\n showOpenNodeRef.current = section.id;\n }\n }}\n sx={{\n boxShadow: \"none\",\n border: isEmpty ? \"1px dashed #E2E8F0\" : \"1px solid #E2E8F0\",\n bgcolor: isEmpty ? \"#FAFAFA\" : \"#FFFFFF\",\n borderRadius: \"6px\",\n flexGrow: 1,\n width: \"100%\",\n display: \"flex\",\n flexDirection: \"column\",\n minWidth: 0,\n \"&:before\": { display: \"none\" },\n \"& .MuiAccordion-heading\": {\n position: \"sticky\",\n top: -12,\n zIndex: 10,\n background: \"#fff\",\n },\n }}\n >\n <AccordionSummary\n expandIcon={isEmpty ? null : <ChevronDown size={16} />}\n sx={{\n minHeight: \"36px\",\n flexShrink: 0,\n cursor: isEmpty ? \"default\" : \"pointer\",\n \"& .MuiAccordionSummary-content\": {\n my: 0.5,\n display: \"grid\",\n alignItems: \"center\",\n minWidth: 0,\n width: \"100%\",\n },\n \"& .MuiAccordionSummary-expandIconWrapper\": {\n transition: \"transform 0.2s ease\",\n },\n \"& .MuiAccordionSummary-expandIconWrapper.Mui-expanded\": {\n transform: \"rotate(180deg)\",\n },\n }}\n >\n {hasTitle && (\n <Tooltip title={displayTitle} placement=\"top\">\n <Typography\n component=\"div\"\n sx={{\n fontSize: \"12px\",\n color: isEmpty ? \"#94A3B8\" : \"#19213D\",\n fontWeight: isEmpty ? 400 : 700,\n overflow: \"hidden\",\n textOverflow: \"ellipsis\",\n whiteSpace: \"nowrap\",\n width: \"100%\",\n minWidth: 0,\n }}\n >\n {renderSimpleMarkdown(visibleTitle, isMultipleMapping)}\n </Typography>\n </Tooltip>\n )}\n </AccordionSummary>\n {!isEmpty && (\n <AccordionDetails\n sx={{\n pt: 0,\n pb: 1.25,\n bgcolor: \"#FFFFFF\",\n flex: 1,\n display: \"flex\",\n flexDirection: \"column\",\n minWidth: 0,\n }}\n >\n {hasContent && (\n <MemoizedMarkdown\n content={baseContent}\n overlayContent={overlayContent}\n fallbackContent={fallbackContent}\n sxStyles={resolvedMarkdownStyles}\n highlights={highlightsToRender}\n maintainRelativeOrder={maintainRelativeOrder}\n highlightBg={highlightBg}\n suppressHighlightBg={suppressHighlightBg}\n deviationBadges={deviationBadgesToRender}\n collisionKey={collisionKey}\n />\n )}\n {(section.subsections || []).map((sub, subIdx) =>\n renderSubSectionAccordion({\n section: sub,\n keyPath: `${idx}-${subIdx}`,\n depth: 0,\n columnKey,\n parentNodeId,\n sectionOffset,\n rhsOrphanVisualIndexes,\n }),\n )}\n </AccordionDetails>\n )}\n </Accordion>\n {isExpanded && show?.showBelow && (\n <div\n style={{\n position: \"sticky\",\n bottom: 0,\n height: \"0px\",\n cursor: \"pointer\",\n }}\n onClick={() =>\n show?.showBelowRef?.current?.scrollIntoView({\n behavior: \"smooth\" as ScrollBehavior,\n block: \"center\",\n })\n }\n >\n <div\n style={{\n transform: `translateY(-50%) translateX(calc(100% ${\n columnKey === \"left\" ? \"+\" : \"-\"\n } 130px))`,\n position: \"absolute\",\n paddingBottom: \"20px\",\n ...(columnKey === \"left\" ? {right: \"-20px\"} : {left: \"-20px\"}),\n }}\n >\n <ChevronDown\n color={\n show?.showBelowRef?.current\n ? window.getComputedStyle(show.showBelowRef.current).color\n : undefined\n }\n />\n </div>\n </div>\n )}\n </Box>\n );\n};\n\nexport default SectionAccordion;\n"],"names":["renderSimpleMarkdown","text","isMultiTag","safeStringify","replace","split","map","part","i","startsWith","endsWith","children","slice","jsxs","style","display","alignItems","justifyContent","gap","width","jsx","minWidth","overflow","textOverflow","whiteSpace","padding","borderRadius","background","border","color","fontSize","fontWeight","flexShrink","lineHeight","marginRight","SectionAccordion","section","idx","columnKey","colRef","mb","isExpanded","onToggle","navigation","parentNodeId","showOpenNodeRef","resolvedMarkdownStyles","maintainRelativeOrder","showDeviationBadges","renderSubSectionAccordion","treeData","proposedSections","existingSections","deviationNumberRegistry","deviationParentRegistry","getBadgeRef","openSummaryPopup","getSectionCompareStyle","connectedSections","openMoreFunctionsPopup","isProposingFix","proposingFixNodeId","isRedlineFlow","isSideBySide","activeSideBySideSection","scrollSyncLocked","unifiedNumbering","toggleScrollSyncLocked","summaryPopupAnchorEl","useCompareContext","collisionKey","String","hasTitle","displayTitle","hasValue","title","isProposedFixTarget","id","nodeId","contentId","hasRedlineTags","hasMeaningfulRedlineTags","content","resolvedRedlineFlow","suppressHighlightBg","changeHistoryContent","change_history","shouldOverlayContent","normalizedRedlineContent","React","useMemo","normalizeRedlineMarkdown","baseContent","stripRedlineTags","overlayContent","fallbackContent","hasContent","displayContent","isEmpty","isMultipleMapping","refContentIds","length","visibleTitle","trimEnd","targetEvalResult","evaluationResult","lhsSelfIndex","refIndexes","lhsSection","find","s","selfIndex","leftDocId","input_index_map","rightDocId","counterPartNodeId","findNodeByIdDeep","nodes","n","subsections","found","popupBaseSec","popupRefSec","sectionOffset","min","Infinity","normalizeInlineContent","value","raw","traverse","node","bNode","rNode","isTopLevel","topNodeId","mappedLhs","filter","l","includes","subNodeId","evalResult","devs","deviations","Object","keys","forEach","devKey","highlight","isMissingStr","normalizedHighlight","findTextMatchRange","canRenderInlineHighlight","refId1","DEVIATION_BADGE_SEPARATOR","idx1","refId2","idx2","subs","bSubs","rSubs","maxLen","Math","max","mappedLhsSections","lhs","rhsSelfIndex","rhs","Boolean","rhsSection","rhsArrayIdx","findIndex","lhsArrayIdx","isSecOrphan","hasSingleMappedLhs","hasSingleMappedLhsSection","resolvedEvalResult","deviationColorData","evaluation_outputs","metadata","label_color","DEFAULT_DEVIAION_COLOR","deviationPalette","generateColorPalette","highlightBg","lhsDeviationDisplayIndexes","getLhsDeviationDisplayIndexes","Map","rhsOrphanVisualIndexes","indexes","nextIndex","isOneToOneSection","normalizeContent","resolveNode","rhsNode","isRoot","lhsNode","registryNodeId","reserveMappedIndexes","normalizedContent","entries","deviationKey","deviationMap","registryIndex","child","visit","nodeDeviations","isOrphan","position","start","findTextRangeWithFormatting","refId","isRenderable","Number","MAX_SAFE_INTEGER","entry","sort","a","b","set","firstDeviationKey","firstRefId","registeredParentNum","validatedParentNum","unifiedNum","leftNums","get","rightNums","nextFallbackDeviationIndex","isFinite","rawDeviationEntries","currentIndex","deviationEntries","item","isMissingClause","leftIdx","rightIdx","rhsByIdIdx","lhsByIdIdx","actionId","counterpartHighlight","isDeviationOrphan","orphanVisualIndex","mappedLhsIndex","badgeLabel","getRhsMappedSectionNumber","fallbackNumber","firstOnly","mappedIdx","actualLhsIdx","baseStyle","deviationOutput","deviationScore","output_value","deviationPaletteForBadge","badgeStyle","badgeBg","badgeBorder","badgeText","summaryPayload","deviation_summary","deviation_title","deviation_impact","deviation_explanation","cognitive_decisioning","stackIndex","contentStr","paragraphs","paraIndex","p","overlappingDevs","_","dMap","hl","indexOf","k","badgeRef","label","side","score","isConnected","has","showScrollLockToggle","current","onClick","e","stopPropagation","onSummaryClick","deviationBadgesToRender","highlightsToRender","show","hasScrolledRef","useRef","useEffect","Box","ref","sx","flexDirection","showAbove","top","height","cursor","showAboveRef","scrollIntoView","behavior","block","transform","paddingTop","right","left","ChevronUp","window","getComputedStyle","Accordion","disableGutters","expanded","onChange","boxShadow","bgcolor","flexGrow","zIndex","AccordionSummary","expandIcon","ChevronDown","size","minHeight","my","transition","Tooltip","placement","Typography","component","AccordionDetails","pt","pb","flex","MemoizedMarkdown","sxStyles","highlights","deviationBadges","sub","subIdx","keyPath","depth","showBelow","bottom","showBelowRef","paddingBottom"],"mappings":"q7BAgCA,MAAMA,EAAuB,CAACC,EAAcC,GAAa,KACnD,IAACD,EAAa,OAAA,KAKlB,OAHuBE,EAAcF,GAAMG,QAAQ,OAAQ,MAC9BC,MAAM,kBAEtBC,IAAI,CAACC,EAAcC,IAC1BD,EAAKE,WAAW,OAASF,EAAKG,SAAS,QACjC,SAAgB,CAAAC,SAAAJ,EAAKK,MAAM,GAAG,IAAlBJ,GAIpBK,EAAC,MAAA,CAECC,MAAO,CACLC,QAAS,OACTC,WAAY,SACZC,eAAgB,gBAChBC,IAAK,MACLC,MAAO,QAGTR,SAAA,CAAAS,EAAC,OAAA,CACCN,MAAO,CACLO,SAAU,EACVC,SAAU,SACVC,aAAc,WACdC,WAAY,UAGbb,SAAAJ,IAGFL,GACCkB,EAAC,OAAA,CACCN,MAAO,CACLC,QAAS,cACTC,WAAY,SACZC,eA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,GAAGhT,KAAO+S,IACnBE,MAAO,EACPhT,YACAM,eACA+E,iBACAgE,mCAMTlJ,GAAcwP,IAAMsD,WACnBnU,EAAC,MAAA,CACCN,MAAO,CACLiM,SAAU,SACVyI,OAAQ,EACR7C,OAAQ,MACRC,OAAQ,WAEVjB,QAAS,IACPM,IAAMwD,cAAc/D,SAASoB,eAAe,CAC1CC,SAAU,SACVC,MAAO,WAIXrS,SAAAS,EAAC,MAAA,CACCN,MAAO,CACLmS,UAAW,yCACK,SAAd3Q,EAAuB,IAAM,cAE/ByK,SAAU,WACV2I,cAAe,UACG,SAAdpT,EAAuB,CAAC6Q,MAAO,SAAW,CAACC,KAAM,UAGvDzS,SAAAS,EAAC8S,EAAA,CACCrS,MACEoQ,IAAMwD,cAAc/D,QAChB4B,OAAOC,iBAAiBtB,GAAKwD,aAAa/D,SAAS7P,WACnD,UAxLT,GAAGS,SAAiBD"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as e,jsxs as t}from"react/jsx-runtime";import n,{useMemo as i}from"react";import{Box as o,Accordion as s,AccordionSummary as
|
|
1
|
+
import{jsx as e,jsxs as t}from"react/jsx-runtime";import n,{useMemo as i}from"react";import{Box as o,Accordion as s,AccordionSummary as l,Typography as d,AccordionDetails as r}from"@mui/material";import{ChevronDown as a}from"lucide-react";import{MemoizedMarkdown as c}from"../hooks/memoizedMarkdown.js";import{useCompareContext as u}from"../CompareContext.js";import{hasValue as p,hasMeaningfulRedlineTags as h,safeStringify as m,stripRedlineTags as f,hasSingleMappedLhsSection as g,getLhsDeviationDisplayIndexes as x,generateColorPalette as v,DEVIATION_BADGE_SEPARATOR as y,isMissingStr as S,findTextMatchRange as I,getRhsMappedSectionNumber as b}from"../CognitiveComparehelpers.js";import{DEFAULT_DEVIAION_COLOR as _}from"../CognitiveCompareConstants.js";import{normalizeRedlineMarkdown as $}from"../utils/normalizeRedlineMarkdown.js";import{findTextRangeWithFormatting as k}from"../utils/normalizeInlineMarkdown.js";const w=n.memo(n=>{const{section:C,keyPath:N,depth:F=0,columnKey:M="left",parentNodeId:O="",sectionOffset:P,rhsOrphanVisualIndexes:B}=n,{expandedSubSections:R,setExpandedSubSections:E,maintainRelativeOrder:j,showDeviationBadges:A=!1,proposedSections:K,existingSections:W,treeData:L,deviationNumberRegistry:z,deviationParentRegistry:T,connectedSections:D,activeSideBySideSection:G,isSideBySide:H,scrollSyncLocked:V,toggleScrollSyncLocked:X,summaryPopupAnchorEl:U,resolvedMarkdownStyles:q,getSubSectionRef:J,getSubSectionCompareStyle:Q,getBadgeRef:Y,openMoreFunctionsPopup:Z,openSummaryPopup:ee,resetSideBySide:te,setConnectedSections:ne,setConnectedLines:ie,cachedConnectedPositions:oe,isProposingFix:se,proposingFixNodeId:le,isRedlineFlow:de,unifiedNumbering:re}=u(),ae=G??"",ce=(C.displayTitle??!0)&&p(C.title),ue=!(!se||!le||"left"!==M||C.id!==le&&C.nodeId!==le&&C.contentId!==le),pe=h(C.content),he="boolean"==typeof de?de:pe,me=pe,fe=C.change_history,ge=he&&pe,xe=i(()=>ge?$(m(C.content)):m(C.content),[C.content,ge]),ve=ge?f(xe):C.content,ye=ge?xe:void 0,Se=pe&&p(fe)?m(fe):void 0,Ie=((C.displayContent??!0)||pe)&&p(C.content),be=!ce&&!Ie,_e=ce?C.title:Ie?"No Title Found":"No Matching Section Found",$e=!!R[N],ke=J(M,N),we=N.split("-").map(Number)[0];let Ce=K[we],Ne=W[we],Fe=we,Me=we,Oe=!1;const Pe=(e,t,n)=>{if(!e||!t)return null;if(e.id===t||e.nodeId===t||e.contentId===t)return{section:e,keyPath:n};const i=(e.subsections||[]).map((e,t)=>({section:e,keyPath:`${n}-${t}`}));for(;i.length>0;){const e=i.shift();if(e?.section){if(e.section.id===t||e.section.nodeId===t||e.section.contentId===t)return e;(e.section.subsections||[]).forEach((t,n)=>{i.push({section:t,keyPath:`${e.keyPath}-${n}`})})}}return null};if(j)if("left"===M){const e=Ce?.refIndexes?.[0],t=W.findIndex(t=>t.selfIndex===e);-1!==t?(Ne=W[t],Me=t):Oe=!0}else{const e=Ne?.refIndexes?.[0],t=K.findIndex(t=>t.selfIndex===e);-1!==t?(Ce=K[t],Fe=t):Oe=!0}const Be=(e,t)=>{if(!t||!e)return null;for(let n=0;n<e.length;n++){const i=Pe(e[n],t,String(n));if(i)return i}return null};let Re=null,Ee=null,je="",Ae="";if(j)if("left"===M){Re=C,je=N;let e=Pe(Ne,C.nodeId||C.id,String(Me));e||(e=Be(W,C.nodeId||C.id)),Ee=e?.section||null,Ae=e?.keyPath||""}else{Ee=C,Ae=N;let e=Pe(Ce,C.nodeId||C.id,String(Fe));e||(e=Be(K,C.nodeId||C.id)),Re=e?.section||null,je=e?.keyPath||""}else if("left"===M){Re=C,je=N;const e=Be(W,C.nodeId||C.id);Ee=e?.section||null,Ae=e?.keyPath||""}else{Ee=C,Ae=N;const e=Be(K,C.nodeId||C.id);Re=e?.section||null,je=e?.keyPath||""}const Ke=(je?Q(je):null)||Q(N),We=L?.input_index_map?.[0],Le=L?.input_index_map?.[1],ze="left"===M?Le:We,Te="left"===M?!Ee:!Re,De=j&&"right"===M&&g(Ne,K),Ge=C.evaluationResult||Re?.evaluationResult||Ee?.evaluationResult,He=Ge?.deviations||{},Ve=i(()=>j&&"right"===M?x(K,We,z):new Map,[j,M,K,We,z]);let Xe=C.nodeId||C.id||Re?.nodeId||Re?.id||Ee?.nodeId||Ee?.id;j&&"left"!==M&&Re?.id&&(Xe=Re.nodeId||Re.id);const Ue=Object.keys(He)[0],qe=Ue?`${Xe}${y}${Ue}`:null,Je=qe?T?.[qe]:null;let Qe=we+1;if(j&&re){const e="left"===M?re.leftNums.get(Ce?.id):re.rightNums.get(Ne?.id);Oe&&void 0!==e?Qe=e:null!=Je&&Je>=0?Qe=Je:void 0!==e&&(Qe=e)}else null!=Je&&Je>=0&&(Qe=Je);const Ye=Ge?.evaluation_outputs?.metadata?.label_color??_,Ze=v(Ye),{highlightBg:et}=Ze;let tt=Math.max(0,...Object.keys(He).map(e=>z[`${Xe}${y}${e}`]).filter(e=>"number"==typeof e&&Number.isFinite(e)))+1;const nt=Object.entries(He).map(([e,t])=>{const n=`${Xe}${y}${e}`;return{deviationKey:e,deviationMap:t,refId:n,currentIndex:z[n]??tt++}});nt.sort((e,t)=>e.currentIndex-t.currentIndex);const it=new Map;if(!B&&j&&"right"===M){const e=m(ve||"").replace(/\\n/g,"\n");nt.filter(({deviationMap:e})=>{const t=e[O];return(Te||S(e[ze]))&&!!t&&!S(t)}).map(t=>{const n=m(t.deviationMap[O]||"").replace(/\\n/g,"\n");let i=-1;return n&&(i=I(e,n)?.start??-1,-1===i&&(i=k(e,n)?.start??-1)),{...t,position:i}}).sort((e,t)=>(-1===e.position?Number.MAX_SAFE_INTEGER:e.position)-(-1===t.position?Number.MAX_SAFE_INTEGER:t.position)||e.currentIndex-t.currentIndex).forEach((e,t)=>{it.set(e.refId,t+1)})}const ot=nt.map(e=>{const{deviationKey:t,deviationMap:n,refId:i}=e;let o=e.currentIndex,s=n[O];const l=S(s);if(l)s="";else if(!s)return null;const d=n[ze],r=Te||S(d),a=B?.get(i)??it.get(i),c=Ve.get(i);j&&"right"===M&&r&&void 0!==a?o=a:j&&"right"===M&&!r&&void 0!==c?o=c:j&&void 0!==P&&("right"!==M||r||De)&&(o-=P),o=Math.max(1,o);const u=`${j&&"right"===M&&r&&re?b({section:Ne,proposedSections:K,leftNums:re.leftNums,fallbackNumber:String(Qe),firstOnly:!0}):Qe}.${o}`,p=`${Xe}${y}${t}${y}${je}${y}${Ae}`,h=n?.evaluation_outputs||Ge?.evaluation_outputs,m=h?.output_value??null;let f={...v(h?.metadata?.label_color??Ye)};const g=n?.deviation_summary?{deviation_summary:n.deviation_summary||Ge?.deviation_summary,deviation_title:n?.deviation_title||Ge?.deviation_title,deviation_impact:n?.deviation_impact||Ge?.deviation_impact,deviation_explanation:n?.deviation_explanation||Ge?.deviation_explanation,evaluation_outputs:h,cognitive_decisioning:n?.cognitive_decisioning||Ge?.cognitive_decisioning}:null;let x=0;const I=ve||"";if(s&&I){const e=I.split(/\n{2,}/),n=e.findIndex(e=>e.includes(s));if(-1!==n){const i=Object.entries(He).filter(([t,i])=>{const o=i[O];return o&&e[n].includes(o)}).sort((t,i)=>e[n].indexOf(t[1][O])-e[n].indexOf(i[1][O])).filter(([e,t])=>{const n=t[O];return n&&(n.includes(s)||s.includes(n))});i.length>1&&(x=Math.max(0,i.findIndex(([e])=>e===t)))}}const _=Y(M,i);return{id:i,actionId:p,label:u,highlight:s,side:M,style:f,stackIndex:x,score:m,isConnected:D.has(p),showScrollLockToggle:D.has(p)||H&&G===p||!!U&&U===_.current,scrollSyncLocked:V,toggleScrollSyncLocked:X,isOrphan:r,isMissingClause:l,badgeRef:_,onClick:e=>{e.stopPropagation();const t=je&&K[Number(je.split("-")[0])]||Ce,n=Ae&&W[Number(Ae.split("-")[0])]||Ne,i=Re?{...Re,title:t?.title||Re?.title||""}:{id:"orphan-left",title:"",content:""},o=Ee?{...Ee,title:n?.title||Ee?.title||""}:{id:"orphan-right",title:"",content:""};Z(e,i,r,o,p,f)},onSummaryClick:e=>{e.stopPropagation(),ee(e,p,r,g)}}}).filter(Boolean).sort((e,t)=>parseFloat(e.label)-parseFloat(t.label)),st=i(()=>{const e=new Set;return ot.filter(t=>!e.has(t.id)&&(e.add(t.id),!0))},[ot]),lt=A||ue?st:[],dt=st.map(e=>e.highlight).filter(Boolean),rt=ot.find(e=>D.has(e.actionId)),at=!!rt;if(!(ce||Ie||C.subsections&&0!==C.subsections.length))return null;const ct=rt?.style?.badgeBorder||Ke?.badgeBorder,ut=at&&ct?{borderRadius:"4px",outline:`2px solid ${ct}`,outlineOffset:"1px"}:{};return e(o,ce?{ref:ke,sx:{mt:1,width:"100%",minWidth:0,position:"relative"},children:e(o,{sx:{width:"100%",...ut},children:t(s,{disableGutters:!0,expanded:!be&&$e,onChange:()=>{if(!be){if($e){const e=String(G||"");let t=e.includes(je)||e.includes(Ae);t||D.forEach(e=>{(String(e).includes(je)||String(e).includes(Ae))&&(t=!0)}),t&&(te(),ne(new Set),ie([]),oe.current=[])}E(e=>({...e,[N]:!e[N]}))}},sx:{mt:0,boxShadow:"none",border:be?"1px dashed #E2E8F0":"1px solid #EEF2F7",borderRadius:"4px !important",bgcolor:"#FFFFFF",minWidth:0,"&:before":{display:"none"}},children:[e(l,{expandIcon:be?null:e(a,{size:14}),sx:{minHeight:"32px","& .MuiAccordionSummary-content":{my:.5,display:"grid",alignItems:"center",minWidth:0,width:"100%"}},children:e(d,{component:"div",sx:{fontSize:"11px",fontWeight:600,color:be?"#94A3B8":"#19213D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0},children:_e||"Untitled Subsection"})}),!be&&t(r,{sx:{pt:0,pb:1,minWidth:0},children:[Ie&&e(c,{content:ve,overlayContent:ye,fallbackContent:Se,sxStyles:q,deviationBadges:lt,maintainRelativeOrder:j,highlightBg:et,suppressHighlightBg:me,highlights:dt,collisionKey:ae}),(C.subsections||[]).map((t,n)=>e(w,{section:t,keyPath:`${N}-${n}`,depth:F+1,columnKey:M,parentNodeId:O,sectionOffset:P,rhsOrphanVisualIndexes:B},`${N}-${n}`))]})]})})}:{ref:ke,sx:{mt:0===F?1:.75,width:"100%",minWidth:0,position:"relative"},children:!be&&t(o,{sx:{width:"100%",...ut},children:[Ie&&e(c,{content:ve,overlayContent:ye,fallbackContent:Se,sxStyles:q,deviationBadges:lt,maintainRelativeOrder:j,highlightBg:et,suppressHighlightBg:me,highlights:dt,collisionKey:ae}),(C.subsections||[]).map((t,n)=>e(w,{section:t,keyPath:`${N}-${n}`,depth:F+1,columnKey:M,parentNodeId:O,sectionOffset:P,rhsOrphanVisualIndexes:B},`${N}-${n}`))]})})});export{w as default};
|
|
2
2
|
//# sourceMappingURL=SubSectionAccordion.js.map
|