@viswa-test/test-citation 0.0.377 → 0.0.378
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/CognitiveCompare.js +1 -1
- package/dist/cjs/features/CognitiveCompare/CognitiveComparehelpers.js +1 -1
- package/dist/cjs/features/CognitiveCompare/CognitivePopup.js +1 -1
- package/dist/cjs/features/CognitiveCompare/Guidelines/components/GuidelinePanel.js +1 -1
- package/dist/cjs/features/CognitiveCompare/Guidelines/components/WebGptPanel.js +1 -1
- package/dist/cjs/features/CognitiveCompare/Guidelines/utils/processGuidelinesMarkdown.js +1 -1
- package/dist/cjs/features/CognitiveCompare/components/SectionAccordion.js +1 -1
- package/dist/cjs/features/CognitiveCompare/components/SubSectionAccordion.js +1 -1
- package/dist/cjs/features/CognitiveCompare/hooks/memoizedMarkdown.js +1 -1
- package/dist/cjs/features/CognitiveCompare/hooks/useCompareData.js +1 -1
- package/dist/cjs/features/CognitiveCompare/hooks/useLinesCalculator.js +1 -1
- package/dist/cjs/features/CognitiveCompare/hooks/useSideBySide.js +1 -1
- package/dist/cjs/features/CognitiveInternalgptReasoning/CognitiveInternalgptCoreComponent.js +1 -1
- package/dist/cjs/features/GptWebCitation/GptWebCitation.js +1 -1
- package/dist/cjs/features/GptWebCitation/GptWebCitationImageCitation.js +1 -1
- package/dist/cjs/features/GptWebCitation/utils/fixedHeight.utils.js +1 -1
- package/dist/cjs/features/PdfViewer/PdfContainer.js +1 -1
- package/dist/cjs/features/PdfViewer/PdfStyle.js +1 -1
- package/dist/cjs/features/PdfViewer/PdfToolbar.js +1 -1
- package/dist/cjs/features/PdfViewer/PdfViewer.js +1 -1
- package/dist/cjs/features/RequirementAI/components/RequirementAIWrapper/RequirementAIWrapper.js +1 -1
- package/dist/cjs/features/RequirementAI/components/RichTextEditor/Editor/constants/updateTags.js +2 -0
- package/dist/cjs/features/RequirementAI/components/RichTextEditor/Editor/constants/updateTags.js.map +1 -0
- package/dist/cjs/features/RequirementAI/components/RichTextEditor/Editor/plugins/InitialHtml.js +1 -1
- package/dist/cjs/features/RequirementAI/components/RichTextEditor/Editor/plugins/ManualNode.js +1 -1
- package/dist/cjs/features/RequirementAI/components/RichTextEditor/Editor/plugins/ProtectTableCellBoundaries.js +2 -0
- package/dist/cjs/features/RequirementAI/components/RichTextEditor/Editor/plugins/ProtectTableCellBoundaries.js.map +1 -0
- package/dist/cjs/features/RequirementAI/components/RichTextEditor/Editor/plugins/UpdateNode.js +1 -1
- package/dist/cjs/features/RequirementAI/components/RichTextEditor/Editor/utils/manualEditSerialization.js +2 -0
- package/dist/cjs/features/RequirementAI/components/RichTextEditor/Editor/utils/manualEditSerialization.js.map +1 -0
- package/dist/cjs/features/RequirementAI/components/RichTextEditor/Editor/utils/normalizeRedlineMarkdown.js +2 -0
- package/dist/cjs/features/RequirementAI/components/RichTextEditor/Editor/utils/normalizeRedlineMarkdown.js.map +1 -0
- package/dist/cjs/features/RequirementAI/components/RichTextEditor/Editor/utils/preserveMarkdownEmphasis.js +2 -0
- package/dist/cjs/features/RequirementAI/components/RichTextEditor/Editor/utils/preserveMarkdownEmphasis.js.map +1 -0
- package/dist/cjs/features/RequirementAI/components/RichTextEditor/Editor/utils/preserveMarkdownLineBreaks.js +2 -0
- package/dist/cjs/features/RequirementAI/components/RichTextEditor/Editor/utils/preserveMarkdownLineBreaks.js.map +1 -0
- package/dist/cjs/features/RequirementAI/components/RichTextEditor/Editor/utils/preserveMarkdownListFormatting.js +2 -0
- package/dist/cjs/features/RequirementAI/components/RichTextEditor/Editor/utils/preserveMarkdownListFormatting.js.map +1 -0
- package/dist/cjs/features/RequirementAI/components/RichTextEditor/Editor/utils/preserveReviewBoundaryWhitespace.js +2 -0
- package/dist/cjs/features/RequirementAI/components/RichTextEditor/Editor/utils/preserveReviewBoundaryWhitespace.js.map +1 -0
- package/dist/cjs/features/RequirementAI/components/RichTextEditor/Editor/utils/preserveTableDelimiters.js +2 -0
- package/dist/cjs/features/RequirementAI/components/RichTextEditor/Editor/utils/preserveTableDelimiters.js.map +1 -0
- package/dist/cjs/features/RequirementAI/components/RichTextEditor/Editor/utils/tableBoundaryRedlines.js +2 -0
- package/dist/cjs/features/RequirementAI/components/RichTextEditor/Editor/utils/tableBoundaryRedlines.js.map +1 -0
- package/dist/cjs/features/RequirementAI/components/RichTextEditor/RichTextEditor.js +1 -1
- package/dist/cjs/features/RequirementAI/components/UserStoryCard/Avatar/Avatar.css.js +2 -0
- package/dist/cjs/features/RequirementAI/components/UserStoryCard/Avatar/Avatar.css.js.map +1 -0
- package/dist/cjs/features/RequirementAI/components/UserStoryCard/Avatar/Avatar.js +2 -0
- package/dist/cjs/features/RequirementAI/components/UserStoryCard/Avatar/Avatar.js.map +1 -0
- package/dist/cjs/features/RequirementAI/components/UserStoryCard/Avatar/CollaboratorsGroup.css.js +2 -0
- package/dist/cjs/features/RequirementAI/components/UserStoryCard/Avatar/CollaboratorsGroup.css.js.map +1 -0
- package/dist/cjs/features/RequirementAI/components/UserStoryCard/Avatar/CollaboratorsGroup.js +2 -0
- package/dist/cjs/features/RequirementAI/components/UserStoryCard/Avatar/CollaboratorsGroup.js.map +1 -0
- package/dist/cjs/features/RequirementAI/components/UserStoryCard/Avatar/CollaboratorsPopup.css.js +2 -0
- package/dist/cjs/features/RequirementAI/components/UserStoryCard/Avatar/CollaboratorsPopup.css.js.map +1 -0
- package/dist/cjs/features/RequirementAI/components/UserStoryCard/Avatar/CollaboratorsPopup.js +2 -0
- package/dist/cjs/features/RequirementAI/components/UserStoryCard/Avatar/CollaboratorsPopup.js.map +1 -0
- package/dist/cjs/features/RequirementAI/components/UserStoryCard/Avatar/avatarUtils.js +2 -0
- package/dist/cjs/features/RequirementAI/components/UserStoryCard/Avatar/avatarUtils.js.map +1 -0
- package/dist/cjs/features/RequirementAI/components/UserStoryCard/CognitiveComponents/CitationAnchor.js +1 -1
- package/dist/cjs/features/RequirementAI/components/UserStoryCard/CognitiveComponents/CognitiveComponent.js +1 -1
- package/dist/cjs/features/RequirementAI/components/UserStoryCard/Popups/DeviationSummary.js +1 -1
- package/dist/cjs/features/RequirementAI/components/UserStoryCard/Popups/HistoryMenu.js +1 -1
- package/dist/cjs/features/RequirementAI/components/UserStoryCard/Popups/ManualEditPopup.js +1 -1
- package/dist/cjs/features/RequirementAI/components/UserStoryCard/Popups/RedlineStatusCard.js +1 -1
- package/dist/cjs/features/RequirementAI/components/UserStoryCard/UserStoryCard.js +1 -1
- package/dist/cjs/features/RequirementAI/components/UserStoryCard/UserStoryCard.module.css.js +1 -1
- package/dist/cjs/features/RequirementAI/components/UserStoryCard/cws/CwsEvent.js +1 -1
- package/dist/cjs/features/RequirementAI/components/UserStoryCard/cws/CwsEventProvider.js +1 -1
- package/dist/cjs/features/RequirementAI/components/UserStoryCard/cws/SocketManager.js +1 -1
- package/dist/cjs/features/RequirementAI/components/UserStoryCard/cws/useCwsEvent.js +1 -1
- package/dist/cjs/features/RequirementAI/components/ai-reasoning/AiReasonMarkdownWrapper.js +1 -1
- package/dist/cjs/features/RequirementAI/components/ai-reasoning/AiReasoningCitationContent.js +1 -1
- package/dist/cjs/features/RequirementAI/components/citations/file-citation/FileCitationContent.js +1 -1
- package/dist/cjs/features/RequirementAI/components/citations/file-citation/FileCitationContent.module.css.js +1 -1
- package/dist/cjs/features/RequirementAI/components/citations/file-citation/FileCitationRender.js +1 -1
- package/dist/cjs/features/RequirementAI/components/citations/readfile-citation/ReadFileCitationContent.js +1 -1
- package/dist/cjs/features/RequirementAI/components/lsc-reason-gap/CustomChatCrRedirection.js +1 -1
- package/dist/cjs/features/RequirementAI/components/lsc-reason-gap/GapFilterBlock.js +1 -1
- package/dist/cjs/features/RequirementAI/components/segment/Segment.js +1 -1
- package/dist/cjs/features/RequirementAI/components/segment/SegmentWrapper.js +1 -1
- package/dist/cjs/features/RequirementAI/components/userstory-approval-screen/UserStoryApprovalScreen.js +1 -1
- package/dist/cjs/features/RequirementAI/components/userstory-with-citation/UserStoryWithCitation.js +1 -1
- package/dist/cjs/features/RequirementAI/components/userstory-with-citation/UserStoryWithCitation.module.css.js +1 -1
- package/dist/cjs/features/RequirementAI/components/userstory-with-citation/components/InlineUpdatedComponent.js +1 -1
- package/dist/cjs/features/RequirementAI/components/userstory-with-citation/utils/inlineMarkdown.js +2 -0
- package/dist/cjs/features/RequirementAI/components/userstory-with-citation/utils/inlineMarkdown.js.map +1 -0
- package/dist/cjs/features/RequirementAI/hooks/useStreamContentHandler.js +1 -1
- package/dist/cjs/features/RequirementAI/utils/exponential-retry.js +2 -0
- package/dist/cjs/features/RequirementAI/utils/exponential-retry.js.map +1 -0
- package/dist/cjs/features/RequirementAI/utils/helpers.js +1 -1
- package/dist/cjs/features/RequirementAI/utils/proccess-stream.utils.js +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/service/redlineService.js +1 -1
- package/dist/cjs/utils/tagHelper.js +1 -1
- package/dist/features/CognitiveCompare/CitationAnchor.js +1 -1
- package/dist/features/CognitiveCompare/CognitiveCompare.js +1 -1
- package/dist/features/CognitiveCompare/CognitiveComparehelpers.js +1 -1
- package/dist/features/CognitiveCompare/CognitivePopup.js +1 -1
- package/dist/features/CognitiveCompare/Guidelines/components/GuidelinePanel.js +1 -1
- package/dist/features/CognitiveCompare/Guidelines/components/WebGptPanel.js +1 -1
- package/dist/features/CognitiveCompare/Guidelines/utils/processGuidelinesMarkdown.js +1 -1
- package/dist/features/CognitiveCompare/components/SectionAccordion.js +1 -1
- package/dist/features/CognitiveCompare/components/SubSectionAccordion.js +1 -1
- package/dist/features/CognitiveCompare/hooks/memoizedMarkdown.js +1 -1
- package/dist/features/CognitiveCompare/hooks/useCompareData.js +1 -1
- package/dist/features/CognitiveCompare/hooks/useLinesCalculator.js +1 -1
- package/dist/features/CognitiveCompare/hooks/useSideBySide.js +1 -1
- package/dist/features/CognitiveInternalgptReasoning/CognitiveInternalgptCoreComponent.js +1 -1
- package/dist/features/GptWebCitation/GptWebCitation.js +1 -1
- package/dist/features/GptWebCitation/GptWebCitationImageCitation.js +1 -1
- package/dist/features/GptWebCitation/utils/fixedHeight.utils.js +1 -1
- package/dist/features/PdfViewer/PdfContainer.js +1 -1
- package/dist/features/PdfViewer/PdfStyle.js +1 -1
- package/dist/features/PdfViewer/PdfToolbar.js +1 -1
- package/dist/features/PdfViewer/PdfViewer.js +1 -1
- package/dist/features/RequirementAI/components/RequirementAIWrapper/RequirementAIWrapper.js +1 -1
- package/dist/features/RequirementAI/components/RichTextEditor/Editor/constants/updateTags.js +2 -0
- package/dist/features/RequirementAI/components/RichTextEditor/Editor/constants/updateTags.js.map +1 -0
- package/dist/features/RequirementAI/components/RichTextEditor/Editor/plugins/InitialHtml.js +1 -1
- package/dist/features/RequirementAI/components/RichTextEditor/Editor/plugins/ManualNode.js +1 -1
- package/dist/features/RequirementAI/components/RichTextEditor/Editor/plugins/ProtectTableCellBoundaries.js +2 -0
- package/dist/features/RequirementAI/components/RichTextEditor/Editor/plugins/ProtectTableCellBoundaries.js.map +1 -0
- package/dist/features/RequirementAI/components/RichTextEditor/Editor/plugins/UpdateNode.js +1 -1
- package/dist/features/RequirementAI/components/RichTextEditor/Editor/utils/manualEditSerialization.js +2 -0
- package/dist/features/RequirementAI/components/RichTextEditor/Editor/utils/manualEditSerialization.js.map +1 -0
- package/dist/features/RequirementAI/components/RichTextEditor/Editor/utils/normalizeRedlineMarkdown.js +2 -0
- package/dist/features/RequirementAI/components/RichTextEditor/Editor/utils/normalizeRedlineMarkdown.js.map +1 -0
- package/dist/features/RequirementAI/components/RichTextEditor/Editor/utils/preserveMarkdownEmphasis.js +2 -0
- package/dist/features/RequirementAI/components/RichTextEditor/Editor/utils/preserveMarkdownEmphasis.js.map +1 -0
- package/dist/features/RequirementAI/components/RichTextEditor/Editor/utils/preserveMarkdownLineBreaks.js +2 -0
- package/dist/features/RequirementAI/components/RichTextEditor/Editor/utils/preserveMarkdownLineBreaks.js.map +1 -0
- package/dist/features/RequirementAI/components/RichTextEditor/Editor/utils/preserveMarkdownListFormatting.js +2 -0
- package/dist/features/RequirementAI/components/RichTextEditor/Editor/utils/preserveMarkdownListFormatting.js.map +1 -0
- package/dist/features/RequirementAI/components/RichTextEditor/Editor/utils/preserveReviewBoundaryWhitespace.js +2 -0
- package/dist/features/RequirementAI/components/RichTextEditor/Editor/utils/preserveReviewBoundaryWhitespace.js.map +1 -0
- package/dist/features/RequirementAI/components/RichTextEditor/Editor/utils/preserveTableDelimiters.js +2 -0
- package/dist/features/RequirementAI/components/RichTextEditor/Editor/utils/preserveTableDelimiters.js.map +1 -0
- package/dist/features/RequirementAI/components/RichTextEditor/Editor/utils/tableBoundaryRedlines.js +2 -0
- package/dist/features/RequirementAI/components/RichTextEditor/Editor/utils/tableBoundaryRedlines.js.map +1 -0
- package/dist/features/RequirementAI/components/RichTextEditor/RichTextEditor.js +1 -1
- package/dist/features/RequirementAI/components/UserStoryCard/Avatar/Avatar.css.js +2 -0
- package/dist/features/RequirementAI/components/UserStoryCard/Avatar/Avatar.css.js.map +1 -0
- package/dist/features/RequirementAI/components/UserStoryCard/Avatar/Avatar.js +2 -0
- package/dist/features/RequirementAI/components/UserStoryCard/Avatar/Avatar.js.map +1 -0
- package/dist/features/RequirementAI/components/UserStoryCard/Avatar/CollaboratorsGroup.css.js +2 -0
- package/dist/features/RequirementAI/components/UserStoryCard/Avatar/CollaboratorsGroup.css.js.map +1 -0
- package/dist/features/RequirementAI/components/UserStoryCard/Avatar/CollaboratorsGroup.js +2 -0
- package/dist/features/RequirementAI/components/UserStoryCard/Avatar/CollaboratorsGroup.js.map +1 -0
- package/dist/features/RequirementAI/components/UserStoryCard/Avatar/CollaboratorsPopup.css.js +2 -0
- package/dist/features/RequirementAI/components/UserStoryCard/Avatar/CollaboratorsPopup.css.js.map +1 -0
- package/dist/features/RequirementAI/components/UserStoryCard/Avatar/CollaboratorsPopup.js +2 -0
- package/dist/features/RequirementAI/components/UserStoryCard/Avatar/CollaboratorsPopup.js.map +1 -0
- package/dist/features/RequirementAI/components/UserStoryCard/Avatar/avatarUtils.js +2 -0
- package/dist/features/RequirementAI/components/UserStoryCard/Avatar/avatarUtils.js.map +1 -0
- package/dist/features/RequirementAI/components/UserStoryCard/CognitiveComponents/CitationAnchor.js +1 -1
- package/dist/features/RequirementAI/components/UserStoryCard/CognitiveComponents/CognitiveComponent.js +1 -1
- package/dist/features/RequirementAI/components/UserStoryCard/Popups/DeviationSummary.js +1 -1
- package/dist/features/RequirementAI/components/UserStoryCard/Popups/HistoryMenu.js +1 -1
- package/dist/features/RequirementAI/components/UserStoryCard/Popups/ManualEditPopup.js +1 -1
- package/dist/features/RequirementAI/components/UserStoryCard/Popups/RedlineStatusCard.js +1 -1
- package/dist/features/RequirementAI/components/UserStoryCard/UserStoryCard.js +1 -1
- package/dist/features/RequirementAI/components/UserStoryCard/UserStoryCard.module.css.js +1 -1
- package/dist/features/RequirementAI/components/UserStoryCard/cws/CwsEvent.js +1 -1
- package/dist/features/RequirementAI/components/UserStoryCard/cws/CwsEventProvider.js +1 -1
- package/dist/features/RequirementAI/components/UserStoryCard/cws/SocketManager.js +1 -1
- package/dist/features/RequirementAI/components/UserStoryCard/cws/useCwsEvent.js +1 -1
- package/dist/features/RequirementAI/components/ai-reasoning/AiReasonMarkdownWrapper.js +1 -1
- package/dist/features/RequirementAI/components/ai-reasoning/AiReasoningCitationContent.js +1 -1
- package/dist/features/RequirementAI/components/citations/file-citation/FileCitationContent.js +1 -1
- package/dist/features/RequirementAI/components/citations/file-citation/FileCitationContent.module.css.js +1 -1
- package/dist/features/RequirementAI/components/citations/file-citation/FileCitationRender.js +1 -1
- package/dist/features/RequirementAI/components/citations/readfile-citation/ReadFileCitationContent.js +1 -1
- package/dist/features/RequirementAI/components/lsc-reason-gap/CustomChatCrRedirection.js +1 -1
- package/dist/features/RequirementAI/components/lsc-reason-gap/GapFilterBlock.js +1 -1
- package/dist/features/RequirementAI/components/segment/Segment.js +1 -1
- package/dist/features/RequirementAI/components/segment/SegmentWrapper.js +1 -1
- package/dist/features/RequirementAI/components/userstory-approval-screen/UserStoryApprovalScreen.js +1 -1
- package/dist/features/RequirementAI/components/userstory-with-citation/UserStoryWithCitation.js +1 -1
- package/dist/features/RequirementAI/components/userstory-with-citation/UserStoryWithCitation.module.css.js +1 -1
- package/dist/features/RequirementAI/components/userstory-with-citation/components/InlineUpdatedComponent.js +1 -1
- package/dist/features/RequirementAI/components/userstory-with-citation/utils/inlineMarkdown.js +2 -0
- package/dist/features/RequirementAI/components/userstory-with-citation/utils/inlineMarkdown.js.map +1 -0
- package/dist/features/RequirementAI/hooks/useStreamContentHandler.js +1 -1
- package/dist/features/RequirementAI/utils/exponential-retry.js +2 -0
- package/dist/features/RequirementAI/utils/exponential-retry.js.map +1 -0
- package/dist/features/RequirementAI/utils/helpers.js +1 -1
- package/dist/features/RequirementAI/utils/proccess-stream.utils.js +1 -1
- package/dist/index.js +1 -1
- package/dist/service/redlineService.js +1 -1
- package/dist/types/src/CitationAccordionTest.d.ts +1 -0
- package/dist/types/src/CitationAccordionTest.d.ts.map +1 -0
- package/dist/types/src/MockDeviationSummary.d.ts +1 -0
- package/dist/types/src/MockDeviationSummary.d.ts.map +1 -0
- package/dist/types/src/RedlineEditorTest.d.ts.map +1 -1
- package/dist/types/src/RequirementAiTest.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/CitationAnchor.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/CognitiveCompare.d.ts +1 -1
- package/dist/types/src/features/CognitiveCompare/CognitiveCompare.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/CognitiveCompareTypes.d.ts +1 -1
- package/dist/types/src/features/CognitiveCompare/CognitiveCompareTypes.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/CognitiveComparehelpers.d.ts +12 -0
- package/dist/types/src/features/CognitiveCompare/CognitiveComparehelpers.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/Guidelines/components/GuidelinePanel.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/Guidelines/components/WebGptPanel.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/Guidelines/constants/guidelines.mockData.d.ts +11312 -433
- package/dist/types/src/features/CognitiveCompare/Guidelines/constants/guidelines.mockData.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/Guidelines/constants/new-guidelines.mockData.d.ts +33 -0
- package/dist/types/src/features/CognitiveCompare/Guidelines/constants/new-guidelines.mockData.d.ts.map +1 -0
- package/dist/types/src/features/CognitiveCompare/Guidelines/utils/processGuidelinesMarkdown.d.ts +14 -1
- package/dist/types/src/features/CognitiveCompare/Guidelines/utils/processGuidelinesMarkdown.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/components/SectionAccordion.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/components/SubSectionAccordion.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/hooks/memoizedMarkdown.d.ts +2 -1
- package/dist/types/src/features/CognitiveCompare/hooks/memoizedMarkdown.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/hooks/useCompareData.d.ts +1 -1
- package/dist/types/src/features/CognitiveCompare/hooks/useCompareData.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/hooks/useCompareLayout.d.ts +1 -0
- package/dist/types/src/features/CognitiveCompare/hooks/useCompareLayout.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/hooks/useLinesCalculator.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/hooks/useSideBySide.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveInternalgptReasoning/CognitiveInternalgptCoreComponent.d.ts +1 -0
- package/dist/types/src/features/CognitiveInternalgptReasoning/CognitiveInternalgptCoreComponent.d.ts.map +1 -1
- package/dist/types/src/features/GptWebCitation/GptWebCitation.d.ts.map +1 -1
- package/dist/types/src/features/GptWebCitation/GptWebCitationImageCitation.d.ts +2 -1
- package/dist/types/src/features/GptWebCitation/GptWebCitationImageCitation.d.ts.map +1 -1
- package/dist/types/src/features/GptWebCitation/types.d.ts +11 -0
- package/dist/types/src/features/GptWebCitation/types.d.ts.map +1 -1
- package/dist/types/src/features/GptWebCitation/utils/fixedHeight.utils.d.ts +2 -0
- package/dist/types/src/features/GptWebCitation/utils/fixedHeight.utils.d.ts.map +1 -1
- package/dist/types/src/features/PdfViewer/PdfContainer.d.ts +2 -4
- package/dist/types/src/features/PdfViewer/PdfContainer.d.ts.map +1 -1
- package/dist/types/src/features/PdfViewer/PdfStyle.d.ts.map +1 -1
- package/dist/types/src/features/PdfViewer/PdfToolbar.d.ts +1 -4
- package/dist/types/src/features/PdfViewer/PdfToolbar.d.ts.map +1 -1
- package/dist/types/src/features/PdfViewer/PdfViewer.d.ts +2 -19
- package/dist/types/src/features/PdfViewer/PdfViewer.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/RequirementAIWrapper/RequirementAIWrapper.d.ts +39 -29
- package/dist/types/src/features/RequirementAI/components/RequirementAIWrapper/RequirementAIWrapper.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/RichTextEditor/Editor/constants/updateTags.d.ts +2 -0
- package/dist/types/src/features/RequirementAI/components/RichTextEditor/Editor/constants/updateTags.d.ts.map +1 -0
- package/dist/types/src/features/RequirementAI/components/RichTextEditor/Editor/plugins/InitialHtml.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/RichTextEditor/Editor/plugins/ManualNode.d.ts +2 -0
- package/dist/types/src/features/RequirementAI/components/RichTextEditor/Editor/plugins/ManualNode.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/RichTextEditor/Editor/plugins/ProtectTableCellBoundaries.d.ts +3 -0
- package/dist/types/src/features/RequirementAI/components/RichTextEditor/Editor/plugins/ProtectTableCellBoundaries.d.ts.map +1 -0
- package/dist/types/src/features/RequirementAI/components/RichTextEditor/Editor/plugins/UpdateNode.d.ts +2 -0
- package/dist/types/src/features/RequirementAI/components/RichTextEditor/Editor/plugins/UpdateNode.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/RichTextEditor/Editor/plugins/reviewBoundaryLexical.test.d.ts +2 -0
- package/dist/types/src/features/RequirementAI/components/RichTextEditor/Editor/plugins/reviewBoundaryLexical.test.d.ts.map +1 -0
- package/dist/types/src/features/RequirementAI/components/RichTextEditor/Editor/utils/manualEditSerialization.d.ts +7 -0
- package/dist/types/src/features/RequirementAI/components/RichTextEditor/Editor/utils/manualEditSerialization.d.ts.map +1 -0
- package/dist/types/src/features/RequirementAI/components/RichTextEditor/Editor/utils/normalizeRedlineMarkdown.d.ts +2 -0
- package/dist/types/src/features/RequirementAI/components/RichTextEditor/Editor/utils/normalizeRedlineMarkdown.d.ts.map +1 -0
- package/dist/types/src/features/RequirementAI/components/RichTextEditor/Editor/utils/preserveMarkdownEmphasis.d.ts +29 -0
- package/dist/types/src/features/RequirementAI/components/RichTextEditor/Editor/utils/preserveMarkdownEmphasis.d.ts.map +1 -0
- package/dist/types/src/features/RequirementAI/components/RichTextEditor/Editor/utils/preserveMarkdownEmphasis.test.d.ts +2 -0
- package/dist/types/src/features/RequirementAI/components/RichTextEditor/Editor/utils/preserveMarkdownEmphasis.test.d.ts.map +1 -0
- package/dist/types/src/features/RequirementAI/components/RichTextEditor/Editor/utils/preserveMarkdownLineBreaks.d.ts +7 -0
- package/dist/types/src/features/RequirementAI/components/RichTextEditor/Editor/utils/preserveMarkdownLineBreaks.d.ts.map +1 -0
- package/dist/types/src/features/RequirementAI/components/RichTextEditor/Editor/utils/preserveMarkdownListFormatting.d.ts +3 -0
- package/dist/types/src/features/RequirementAI/components/RichTextEditor/Editor/utils/preserveMarkdownListFormatting.d.ts.map +1 -0
- package/dist/types/src/features/RequirementAI/components/RichTextEditor/Editor/utils/preserveReviewBoundaryWhitespace.d.ts +86 -0
- package/dist/types/src/features/RequirementAI/components/RichTextEditor/Editor/utils/preserveReviewBoundaryWhitespace.d.ts.map +1 -0
- package/dist/types/src/features/RequirementAI/components/RichTextEditor/Editor/utils/preserveReviewBoundaryWhitespace.test.d.ts +9 -0
- package/dist/types/src/features/RequirementAI/components/RichTextEditor/Editor/utils/preserveReviewBoundaryWhitespace.test.d.ts.map +1 -0
- package/dist/types/src/features/RequirementAI/components/RichTextEditor/Editor/utils/preserveTableDelimiters.d.ts +7 -0
- package/dist/types/src/features/RequirementAI/components/RichTextEditor/Editor/utils/preserveTableDelimiters.d.ts.map +1 -0
- package/dist/types/src/features/RequirementAI/components/RichTextEditor/Editor/utils/tableBoundaryRedlines.d.ts +5 -0
- package/dist/types/src/features/RequirementAI/components/RichTextEditor/Editor/utils/tableBoundaryRedlines.d.ts.map +1 -0
- package/dist/types/src/features/RequirementAI/components/RichTextEditor/RichTextEditor.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/Avatar/Avatar.d.ts +10 -0
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/Avatar/Avatar.d.ts.map +1 -0
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/Avatar/CollaboratorsGroup.d.ts +17 -0
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/Avatar/CollaboratorsGroup.d.ts.map +1 -0
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/Avatar/CollaboratorsPopup.d.ts +23 -0
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/Avatar/CollaboratorsPopup.d.ts.map +1 -0
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/Avatar/avatarUtils.d.ts +3 -0
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/Avatar/avatarUtils.d.ts.map +1 -0
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/CognitiveComponents/CitationAnchor.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/CognitiveComponents/CognitiveComponent.d.ts +1 -1
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/CognitiveComponents/CognitiveComponent.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/CognitiveComponents/userstory.mock.data.d.ts +84 -5439
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/CognitiveComponents/userstory.mock.data.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/DeviationSummary.d.ts +1 -1
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/DeviationSummary.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/ManualEditPopup.d.ts +1 -1
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/ManualEditPopup.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/RedlineStatusCard.d.ts +2 -2
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/RedlineStatusCard.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/UserStoryCard.d.ts +20 -2
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/UserStoryCard.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/cws/CwsEvent.d.ts +7 -2
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/cws/CwsEvent.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/cws/CwsEventProvider.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/cws/SocketManager.d.ts +15 -1
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/cws/SocketManager.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/cws/useCwsEvent.d.ts +2 -1
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/cws/useCwsEvent.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/ai-reasoning/AiReasonMarkdownWrapper.d.ts +3 -2
- package/dist/types/src/features/RequirementAI/components/ai-reasoning/AiReasonMarkdownWrapper.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/ai-reasoning/AiReasoningCitationContent.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/citations/file-citation/FileCitationContent.d.ts +1 -0
- package/dist/types/src/features/RequirementAI/components/citations/file-citation/FileCitationContent.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/citations/file-citation/FileCitationRender.d.ts +1 -0
- package/dist/types/src/features/RequirementAI/components/citations/file-citation/FileCitationRender.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/citations/readfile-citation/ReadFileCitationContent.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/common/onDemandCitationButton.d.ts +12 -0
- package/dist/types/src/features/RequirementAI/components/common/onDemandCitationButton.d.ts.map +1 -0
- package/dist/types/src/features/RequirementAI/components/lsc-reason-gap/CustomChatCrRedirection.d.ts +3 -2
- package/dist/types/src/features/RequirementAI/components/lsc-reason-gap/CustomChatCrRedirection.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/lsc-reason-gap/GapFilterBlock.d.ts +1 -1
- package/dist/types/src/features/RequirementAI/components/lsc-reason-gap/GapFilterBlock.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/segment/Segment.d.ts +3 -1
- package/dist/types/src/features/RequirementAI/components/segment/Segment.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/segment/SegmentWrapper.d.ts +2 -1
- package/dist/types/src/features/RequirementAI/components/segment/SegmentWrapper.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/userstory-approval-screen/UserStoryApprovalContext.d.ts +1 -0
- package/dist/types/src/features/RequirementAI/components/userstory-approval-screen/UserStoryApprovalContext.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/userstory-approval-screen/UserStoryApprovalScreen.d.ts +2 -0
- package/dist/types/src/features/RequirementAI/components/userstory-approval-screen/UserStoryApprovalScreen.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/userstory-with-citation/UserStoryWithCitation.d.ts +2 -1
- package/dist/types/src/features/RequirementAI/components/userstory-with-citation/UserStoryWithCitation.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/userstory-with-citation/components/InlineUpdatedComponent.d.ts +2 -1
- package/dist/types/src/features/RequirementAI/components/userstory-with-citation/components/InlineUpdatedComponent.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/userstory-with-citation/utils/inlineMarkdown.d.ts +9 -0
- package/dist/types/src/features/RequirementAI/components/userstory-with-citation/utils/inlineMarkdown.d.ts.map +1 -0
- package/dist/types/src/features/RequirementAI/hooks/useStreamContentHandler.d.ts +1 -1
- package/dist/types/src/features/RequirementAI/hooks/useStreamContentHandler.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/interfaces/userstory.interface.d.ts +2 -0
- package/dist/types/src/features/RequirementAI/interfaces/userstory.interface.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/types/aiReasoning.type.d.ts +7 -0
- package/dist/types/src/features/RequirementAI/types/aiReasoning.type.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/types/segment.type.d.ts +2 -1
- package/dist/types/src/features/RequirementAI/types/segment.type.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/utils/exponential-retry.d.ts +12 -0
- package/dist/types/src/features/RequirementAI/utils/exponential-retry.d.ts.map +1 -0
- package/dist/types/src/features/RequirementAI/utils/helpers.d.ts +2 -0
- package/dist/types/src/features/RequirementAI/utils/helpers.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/utils/proccess-stream.utils.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +0 -4
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/service/redlineService.d.ts.map +1 -1
- package/dist/types/src/utils/tagHelper.d.ts +9 -0
- package/dist/types/src/utils/tagHelper.d.ts.map +1 -1
- package/dist/utils/tagHelper.js +1 -1
- package/package.json +1 -1
- package/dist/assests/icons/InfoAlert.js +0 -2
- package/dist/assests/icons/InfoAlert.js.map +0 -1
- package/dist/cjs/assests/icons/InfoAlert.js +0 -2
- package/dist/cjs/assests/icons/InfoAlert.js.map +0 -1
- package/dist/cjs/features/ParentCitationComponent/ParentCitationComponent.js +0 -2
- package/dist/cjs/features/ParentCitationComponent/ParentCitationComponent.js.map +0 -1
- package/dist/cjs/features/PdfViewer/nyc-components/BoundaryCard.js +0 -2
- package/dist/cjs/features/PdfViewer/nyc-components/BoundaryCard.js.map +0 -1
- package/dist/cjs/features/PdfViewer/nyc-components/CardWrapper.js +0 -2
- package/dist/cjs/features/PdfViewer/nyc-components/CardWrapper.js.map +0 -1
- package/dist/cjs/features/PdfViewer/nyc-components/CognitiveIcon.js +0 -2
- package/dist/cjs/features/PdfViewer/nyc-components/CognitiveIcon.js.map +0 -1
- package/dist/cjs/features/PdfViewer/nyc-components/LabelCheck.js +0 -2
- package/dist/cjs/features/PdfViewer/nyc-components/LabelCheck.js.map +0 -1
- package/dist/cjs/features/PdfViewer/nyc-components/SegmentReviewPdfWrapper.js +0 -2
- package/dist/cjs/features/PdfViewer/nyc-components/SegmentReviewPdfWrapper.js.map +0 -1
- package/dist/cjs/features/PdfViewer/nyc-components/infoAlert.js +0 -2
- package/dist/cjs/features/PdfViewer/nyc-components/infoAlert.js.map +0 -1
- package/dist/cjs/features/PdfViewer/nyc-components/reviewStepAdapters.js +0 -2
- package/dist/cjs/features/PdfViewer/nyc-components/reviewStepAdapters.js.map +0 -1
- package/dist/cjs/features/PdfViewer/rotationManager.js +0 -2
- package/dist/cjs/features/PdfViewer/rotationManager.js.map +0 -1
- package/dist/cjs/features/ReviewPanel/ReviewPanel.js +0 -2
- package/dist/cjs/features/ReviewPanel/ReviewPanel.js.map +0 -1
- package/dist/cjs/features/SegmentReviewComponents/BoundaryCard.js +0 -2
- package/dist/cjs/features/SegmentReviewComponents/BoundaryCard.js.map +0 -1
- package/dist/cjs/features/SegmentReviewComponents/CardWrapper.js +0 -2
- package/dist/cjs/features/SegmentReviewComponents/CardWrapper.js.map +0 -1
- package/dist/cjs/features/SegmentReviewComponents/ChartBreakoutCircle.js +0 -2
- package/dist/cjs/features/SegmentReviewComponents/ChartBreakoutCircle.js.map +0 -1
- package/dist/cjs/features/SegmentReviewComponents/CognitiveIcon.js +0 -2
- package/dist/cjs/features/SegmentReviewComponents/CognitiveIcon.js.map +0 -1
- package/dist/cjs/features/SegmentReviewComponents/CognitiveIntegrity.js +0 -2
- package/dist/cjs/features/SegmentReviewComponents/CognitiveIntegrity.js.map +0 -1
- package/dist/cjs/features/SegmentReviewComponents/CognitiveScoreBadge.js +0 -2
- package/dist/cjs/features/SegmentReviewComponents/CognitiveScoreBadge.js.map +0 -1
- package/dist/cjs/features/SegmentReviewComponents/LabelCheck.js +0 -2
- package/dist/cjs/features/SegmentReviewComponents/LabelCheck.js.map +0 -1
- package/dist/cjs/features/SegmentReviewComponents/PageCheck.js +0 -2
- package/dist/cjs/features/SegmentReviewComponents/PageCheck.js.map +0 -1
- package/dist/cjs/features/SegmentReviewComponents/RevertCard.js +0 -2
- package/dist/cjs/features/SegmentReviewComponents/RevertCard.js.map +0 -1
- package/dist/cjs/features/SegmentReviewComponents/RevertSuccessCard.js +0 -2
- package/dist/cjs/features/SegmentReviewComponents/RevertSuccessCard.js.map +0 -1
- package/dist/cjs/features/SegmentReviewComponents/RevertSummaryNotice.js +0 -2
- package/dist/cjs/features/SegmentReviewComponents/RevertSummaryNotice.js.map +0 -1
- package/dist/cjs/features/SegmentReviewComponents/ReviewedBoundaryActions.js +0 -2
- package/dist/cjs/features/SegmentReviewComponents/ReviewedBoundaryActions.js.map +0 -1
- package/dist/cjs/features/SegmentReviewComponents/ReviewedCard.js +0 -2
- package/dist/cjs/features/SegmentReviewComponents/ReviewedCard.js.map +0 -1
- package/dist/cjs/features/SegmentReviewComponents/SegmentReviewPdfWrapper.js +0 -2
- package/dist/cjs/features/SegmentReviewComponents/SegmentReviewPdfWrapper.js.map +0 -1
- package/dist/cjs/features/SegmentReviewComponents/helper.js +0 -2
- package/dist/cjs/features/SegmentReviewComponents/helper.js.map +0 -1
- package/dist/cjs/features/SegmentReviewComponents/reviewStepAdapters.js +0 -2
- package/dist/cjs/features/SegmentReviewComponents/reviewStepAdapters.js.map +0 -1
- package/dist/features/ParentCitationComponent/ParentCitationComponent.js +0 -2
- package/dist/features/ParentCitationComponent/ParentCitationComponent.js.map +0 -1
- package/dist/features/PdfViewer/nyc-components/BoundaryCard.js +0 -2
- package/dist/features/PdfViewer/nyc-components/BoundaryCard.js.map +0 -1
- package/dist/features/PdfViewer/nyc-components/CardWrapper.js +0 -2
- package/dist/features/PdfViewer/nyc-components/CardWrapper.js.map +0 -1
- package/dist/features/PdfViewer/nyc-components/CognitiveIcon.js +0 -2
- package/dist/features/PdfViewer/nyc-components/CognitiveIcon.js.map +0 -1
- package/dist/features/PdfViewer/nyc-components/LabelCheck.js +0 -2
- package/dist/features/PdfViewer/nyc-components/LabelCheck.js.map +0 -1
- package/dist/features/PdfViewer/nyc-components/SegmentReviewPdfWrapper.js +0 -2
- package/dist/features/PdfViewer/nyc-components/SegmentReviewPdfWrapper.js.map +0 -1
- package/dist/features/PdfViewer/nyc-components/infoAlert.js +0 -2
- package/dist/features/PdfViewer/nyc-components/infoAlert.js.map +0 -1
- package/dist/features/PdfViewer/nyc-components/reviewStepAdapters.js +0 -2
- package/dist/features/PdfViewer/nyc-components/reviewStepAdapters.js.map +0 -1
- package/dist/features/PdfViewer/rotationManager.js +0 -2
- package/dist/features/PdfViewer/rotationManager.js.map +0 -1
- package/dist/features/ReviewPanel/ReviewPanel.js +0 -2
- package/dist/features/ReviewPanel/ReviewPanel.js.map +0 -1
- package/dist/features/SegmentReviewComponents/BoundaryCard.js +0 -2
- package/dist/features/SegmentReviewComponents/BoundaryCard.js.map +0 -1
- package/dist/features/SegmentReviewComponents/CardWrapper.js +0 -2
- package/dist/features/SegmentReviewComponents/CardWrapper.js.map +0 -1
- package/dist/features/SegmentReviewComponents/ChartBreakoutCircle.js +0 -2
- package/dist/features/SegmentReviewComponents/ChartBreakoutCircle.js.map +0 -1
- package/dist/features/SegmentReviewComponents/CognitiveIcon.js +0 -2
- package/dist/features/SegmentReviewComponents/CognitiveIcon.js.map +0 -1
- package/dist/features/SegmentReviewComponents/CognitiveIntegrity.js +0 -2
- package/dist/features/SegmentReviewComponents/CognitiveIntegrity.js.map +0 -1
- package/dist/features/SegmentReviewComponents/CognitiveScoreBadge.js +0 -2
- package/dist/features/SegmentReviewComponents/CognitiveScoreBadge.js.map +0 -1
- package/dist/features/SegmentReviewComponents/LabelCheck.js +0 -2
- package/dist/features/SegmentReviewComponents/LabelCheck.js.map +0 -1
- package/dist/features/SegmentReviewComponents/PageCheck.js +0 -2
- package/dist/features/SegmentReviewComponents/PageCheck.js.map +0 -1
- package/dist/features/SegmentReviewComponents/RevertCard.js +0 -2
- package/dist/features/SegmentReviewComponents/RevertCard.js.map +0 -1
- package/dist/features/SegmentReviewComponents/RevertSuccessCard.js +0 -2
- package/dist/features/SegmentReviewComponents/RevertSuccessCard.js.map +0 -1
- package/dist/features/SegmentReviewComponents/RevertSummaryNotice.js +0 -2
- package/dist/features/SegmentReviewComponents/RevertSummaryNotice.js.map +0 -1
- package/dist/features/SegmentReviewComponents/ReviewedBoundaryActions.js +0 -2
- package/dist/features/SegmentReviewComponents/ReviewedBoundaryActions.js.map +0 -1
- package/dist/features/SegmentReviewComponents/ReviewedCard.js +0 -2
- package/dist/features/SegmentReviewComponents/ReviewedCard.js.map +0 -1
- package/dist/features/SegmentReviewComponents/SegmentReviewPdfWrapper.js +0 -2
- package/dist/features/SegmentReviewComponents/SegmentReviewPdfWrapper.js.map +0 -1
- package/dist/features/SegmentReviewComponents/helper.js +0 -2
- package/dist/features/SegmentReviewComponents/helper.js.map +0 -1
- package/dist/features/SegmentReviewComponents/reviewStepAdapters.js +0 -2
- package/dist/features/SegmentReviewComponents/reviewStepAdapters.js.map +0 -1
- package/dist/types/src/RedlineApprovalCardTest.d.ts +0 -1
- package/dist/types/src/RedlineApprovalCardTest.d.ts.map +0 -1
- package/dist/types/src/RedlineEditorTest2.d.ts +0 -3
- package/dist/types/src/RedlineEditorTest2.d.ts.map +0 -1
- package/dist/types/src/assests/icons/ChartSplitIcon.d.ts +0 -3
- package/dist/types/src/assests/icons/ChartSplitIcon.d.ts.map +0 -1
- package/dist/types/src/assests/icons/InfoAlert.d.ts +0 -3
- package/dist/types/src/assests/icons/InfoAlert.d.ts.map +0 -1
- package/dist/types/src/commonConstants.d.ts +0 -31103
- package/dist/types/src/commonConstants.d.ts.map +0 -1
- package/dist/types/src/features/CognitiveCompare/utils/buildComparisonRows.test.d.ts +0 -2
- package/dist/types/src/features/CognitiveCompare/utils/buildComparisonRows.test.d.ts.map +0 -1
- package/dist/types/src/features/ParentCitationComponent/ParentCitationComponent.d.ts +0 -128
- package/dist/types/src/features/ParentCitationComponent/ParentCitationComponent.d.ts.map +0 -1
- package/dist/types/src/features/ParentCitationComponent/ParentCitationComponentTest.d.ts +0 -13
- package/dist/types/src/features/ParentCitationComponent/ParentCitationComponentTest.d.ts.map +0 -1
- package/dist/types/src/features/PdfViewer/coordinateTransformer.d.ts +0 -41
- package/dist/types/src/features/PdfViewer/coordinateTransformer.d.ts.map +0 -1
- package/dist/types/src/features/PdfViewer/nyc-components/BoundaryCard.d.ts +0 -59
- package/dist/types/src/features/PdfViewer/nyc-components/BoundaryCard.d.ts.map +0 -1
- package/dist/types/src/features/PdfViewer/nyc-components/CardWrapper.d.ts +0 -19
- package/dist/types/src/features/PdfViewer/nyc-components/CardWrapper.d.ts.map +0 -1
- package/dist/types/src/features/PdfViewer/nyc-components/CognitiveIcon.d.ts +0 -3
- package/dist/types/src/features/PdfViewer/nyc-components/CognitiveIcon.d.ts.map +0 -1
- package/dist/types/src/features/PdfViewer/nyc-components/LabelCheck.d.ts +0 -77
- package/dist/types/src/features/PdfViewer/nyc-components/LabelCheck.d.ts.map +0 -1
- package/dist/types/src/features/PdfViewer/nyc-components/SegmentReviewPdfWrapper.d.ts +0 -47
- package/dist/types/src/features/PdfViewer/nyc-components/SegmentReviewPdfWrapper.d.ts.map +0 -1
- package/dist/types/src/features/PdfViewer/nyc-components/index.d.ts +0 -15
- package/dist/types/src/features/PdfViewer/nyc-components/index.d.ts.map +0 -1
- package/dist/types/src/features/PdfViewer/nyc-components/infoAlert.d.ts +0 -3
- package/dist/types/src/features/PdfViewer/nyc-components/infoAlert.d.ts.map +0 -1
- package/dist/types/src/features/PdfViewer/nyc-components/reviewStepAdapters.d.ts +0 -36
- package/dist/types/src/features/PdfViewer/nyc-components/reviewStepAdapters.d.ts.map +0 -1
- package/dist/types/src/features/PdfViewer/rotationManager.d.ts +0 -23
- package/dist/types/src/features/PdfViewer/rotationManager.d.ts.map +0 -1
- package/dist/types/src/features/SegmentReviewComponents/BoundaryCard.d.ts +0 -85
- package/dist/types/src/features/SegmentReviewComponents/BoundaryCard.d.ts.map +0 -1
- package/dist/types/src/features/SegmentReviewComponents/CardWrapper.d.ts +0 -26
- package/dist/types/src/features/SegmentReviewComponents/CardWrapper.d.ts.map +0 -1
- package/dist/types/src/features/SegmentReviewComponents/ChartBreakoutCircle.d.ts +0 -3
- package/dist/types/src/features/SegmentReviewComponents/ChartBreakoutCircle.d.ts.map +0 -1
- package/dist/types/src/features/SegmentReviewComponents/CognitiveIcon.d.ts +0 -3
- package/dist/types/src/features/SegmentReviewComponents/CognitiveIcon.d.ts.map +0 -1
- package/dist/types/src/features/SegmentReviewComponents/CognitiveIntegrity.d.ts +0 -33
- package/dist/types/src/features/SegmentReviewComponents/CognitiveIntegrity.d.ts.map +0 -1
- package/dist/types/src/features/SegmentReviewComponents/CognitiveScoreBadge.d.ts +0 -7
- package/dist/types/src/features/SegmentReviewComponents/CognitiveScoreBadge.d.ts.map +0 -1
- package/dist/types/src/features/SegmentReviewComponents/LabelCheck.d.ts +0 -87
- package/dist/types/src/features/SegmentReviewComponents/LabelCheck.d.ts.map +0 -1
- package/dist/types/src/features/SegmentReviewComponents/PageCheck.d.ts +0 -51
- package/dist/types/src/features/SegmentReviewComponents/PageCheck.d.ts.map +0 -1
- package/dist/types/src/features/SegmentReviewComponents/RevertCard.d.ts +0 -37
- package/dist/types/src/features/SegmentReviewComponents/RevertCard.d.ts.map +0 -1
- package/dist/types/src/features/SegmentReviewComponents/RevertSuccessCard.d.ts +0 -9
- package/dist/types/src/features/SegmentReviewComponents/RevertSuccessCard.d.ts.map +0 -1
- package/dist/types/src/features/SegmentReviewComponents/RevertSummaryNotice.d.ts +0 -7
- package/dist/types/src/features/SegmentReviewComponents/RevertSummaryNotice.d.ts.map +0 -1
- package/dist/types/src/features/SegmentReviewComponents/ReviewedBoundaryActions.d.ts +0 -17
- package/dist/types/src/features/SegmentReviewComponents/ReviewedBoundaryActions.d.ts.map +0 -1
- package/dist/types/src/features/SegmentReviewComponents/ReviewedCard.d.ts +0 -33
- package/dist/types/src/features/SegmentReviewComponents/ReviewedCard.d.ts.map +0 -1
- package/dist/types/src/features/SegmentReviewComponents/SegmentReviewPdfWrapper.d.ts +0 -124
- package/dist/types/src/features/SegmentReviewComponents/SegmentReviewPdfWrapper.d.ts.map +0 -1
- package/dist/types/src/features/SegmentReviewComponents/SegmentReviewRedirectionTest.d.ts +0 -13
- package/dist/types/src/features/SegmentReviewComponents/SegmentReviewRedirectionTest.d.ts.map +0 -1
- package/dist/types/src/features/SegmentReviewComponents/helper.d.ts +0 -53
- package/dist/types/src/features/SegmentReviewComponents/helper.d.ts.map +0 -1
- package/dist/types/src/features/SegmentReviewComponents/helper.test.d.ts +0 -2
- package/dist/types/src/features/SegmentReviewComponents/helper.test.d.ts.map +0 -1
- package/dist/types/src/features/SegmentReviewComponents/index.d.ts +0 -23
- package/dist/types/src/features/SegmentReviewComponents/index.d.ts.map +0 -1
- package/dist/types/src/features/SegmentReviewComponents/reviewStepAdapters.d.ts +0 -242
- package/dist/types/src/features/SegmentReviewComponents/reviewStepAdapters.d.ts.map +0 -1
- package/dist/types/src/features/SegmentReviewComponents/segmentReviewEdgeCases.test.d.ts +0 -2
- package/dist/types/src/features/SegmentReviewComponents/segmentReviewEdgeCases.test.d.ts.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as n}from"tslib";import{jsxs as e,jsx as i}from"react/jsx-runtime";import o,{useEffect as t}from"react";import{Box as l,Accordion as d,AccordionSummary as r,Tooltip as a,Typography as u,AccordionDetails as c}from"@mui/material";import{ChevronUp as s,ChevronDown as v}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 y,isMissingStr as b,getRhsMappedSectionNumber as w,safeStringify as S,DEVIATION_BADGE_SEPARATOR as R}from"../CognitiveComparehelpers.js";import{DEFAULT_DEVIAION_COLOR as _}from"../CognitiveCompareConstants.js";var F=function(F){var M,k,N,B,C,E,A,O,j,W,T,D,P,K,z,G=F.section,L=F.idx,X=F.columnKey,H=F.colRef,V=F.mb,Y=void 0===V?1:V,q=F.isExpanded,J=F.onToggle,Q=F.navigation,U=F.parentNodeId,Z=void 0===U?"":U,$=p(),nn=$.showOpenNodeRef,en=$.resolvedMarkdownStyles,on=$.maintainRelativeOrder,tn=$.showDeviationBadges,ln=void 0!==tn&&tn,dn=$.renderSubSectionAccordion,rn=$.treeData,an=$.proposedSections,un=$.existingSections,cn=$.deviationNumberRegistry,sn=$.deviationParentRegistry,vn=$.getBadgeRef,fn=$.openSummaryPopup,pn=$.getSectionCompareStyle,hn=$.connectedSections,gn=$.openMoreFunctionsPopup,xn=$.isProposingFix,mn=$.proposingFixNodeId,In=$.isRedlineFlow,yn=$.isSideBySide,bn=$.activeSideBySideSection,wn=$.scrollSyncLocked,Sn=$.unifiedNumbering,Rn=$.toggleScrollSyncLocked,_n=$.summaryPopupAnchorEl,Fn="".concat(yn?"1":"0","-").concat(String(null!=bn?bn:"")),Mn=(null===(M=G.displayTitle)||void 0===M||M)&&h(G.title),kn=!(!xn||!mn||"left"!==X||G.id!==mn&&G.nodeId!==mn),Nn=g(G.content),Bn="boolean"==typeof In?In:Nn,Cn=Nn,En=Bn&&Nn,An=En?x(G.content):G.content,On=En?G.content:void 0,jn=(null===(k=G.displayContent)||void 0===k||k||Nn)&&h(G.content),Wn=!Mn&&!jn,Tn=G.title;Mn||(Tn=jn?"No Title Found":"No Matching Section Found");var Dn="left"===X&&(G.isMultipleMapping||(null!==(B=null===(N=G.refContentIds)||void 0===N?void 0:N.length)&&void 0!==B?B:1)>1),Pn="left"===X&&Tn.length>29?"".concat(Tn.slice(0,29).trimEnd(),"..."):Tn,Kn=G.evaluationResult;if(!Kn&&"right"===X)if(on){var zn=null===(C=G.refIndexes)||void 0===C?void 0:C[0],Gn=an.find(function(n){return n.selfIndex===zn});Kn=null==Gn?void 0:Gn.evaluationResult}else Kn=null===(E=an[L])||void 0===E?void 0:E.evaluationResult;var Ln=null===(A=null==rn?void 0:rn.input_index_map)||void 0===A?void 0:A[0],Xn=null===(O=null==rn?void 0:rn.input_index_map)||void 0===O?void 0:O[1],Hn="left"===X?Xn:Ln,Vn=function(n,e){var i;if(!e||!n)return null;for(var o=0,t=n;o<t.length;o++){var l=t[o];if(l.id===e||l.nodeId===e||l.contentId===e)return l;if(null===(i=l.subsections)||void 0===i?void 0:i.length){var d=Vn(l.subsections,e);if(d)return d}}return null},Yn="left"===X?G:Vn(an,G.id),qn="right"===X?G:Vn(un,G.id),Jn=o.useMemo(function(){if(!on)return 0;var n=1/0,e=function(n){var e=g(n)?x(n):n;return S(e||"").replace(/\\n/g,"\n")},i=function(o,t,l,d){if(o){var r=o.nodeId||o.id;if(d&&"right"===X){var a=an.filter(function(n){var e;return null===(e=n.refIndexes)||void 0===e?void 0:e.includes(o.selfIndex)});a.length>0&&(r=a[0].nodeId||a[0].id)}var u=o.nodeId||o.id||(null==t?void 0:t.nodeId)||(null==t?void 0:t.id)||(null==l?void 0:l.nodeId)||(null==l?void 0:l.id),c=o.evaluationResult||(null==t?void 0:t.evaluationResult)||(null==l?void 0:l.evaluationResult),s=(null==c?void 0:c.deviations)||{};Object.keys(s).forEach(function(i){var d,a=null===(d=s[i])||void 0===d?void 0:d[Z];if(function(n,i){if("string"!=typeof i||b(i))return!1;var o=e(null==n?void 0:n.content),t=e(i);return!!t&&o.includes(t)}("left"===X?t||o:l||o,a)){var c="".concat(r).concat(R).concat(i),v=null==cn?void 0:cn[c];null!=v&&v<n&&(n=v);var f="".concat(u).concat(R).concat(i),p=null==cn?void 0:cn[f];null!=p&&p<n&&(n=p)}});for(var v=o.subsections||[],f=(null==t?void 0:t.subsections)||[],p=(null==l?void 0:l.subsections)||[],h=Math.max(v.length,f.length,p.length),g=0;g<h;g++)i(v[g],f[g],p[g],!1)}},o="right"===X?an.filter(function(n){var e;return null===(e=n.refIndexes)||void 0===e?void 0:e.includes(G.selfIndex)}):[];if(1===o.length){var t=o[0];(t.refIndexes||[]).map(function(n){return un.find(function(e){return e.selfIndex===n})}).filter(Boolean).forEach(function(n){i(n,t,n,!0)})}else i(G,Yn,qn,!0);return n!==1/0?n-1:0},[G,Yn,qn,X,Z,cn,on,an,un]);if(on)if("left"===X){var Qn=null===(j=G.refIndexes)||void 0===j?void 0:j[0],Un=un.findIndex(function(n){return n.selfIndex===Qn});qn=-1!==Un?un[Un]:Vn(un,G.id)}else{var Zn=null===(W=G.refIndexes)||void 0===W?void 0:W[0],$n=an.findIndex(function(n){return n.selfIndex===Zn});Yn=-1!==$n?an[$n]:Vn(an,G.id)}var ne="left"===X?!qn:!Yn,ee=on&&"right"===X&&m(G,an),ie=Kn||(null==Yn?void 0:Yn.evaluationResult)||(null==qn?void 0:qn.evaluationResult),oe=null!==(P=null===(D=null===(T=null==ie?void 0:ie.evaluation_outputs)||void 0===T?void 0:T.metadata)||void 0===D?void 0:D.label_color)&&void 0!==P?P:_,te=I(oe).highlightBg,le=(null==ie?void 0:ie.deviations)||{},de=o.useMemo(function(){return on&&"right"===X?y(an,Ln,cn):new Map},[on,X,an,Ln,cn]),re=G.nodeId||G.id;if(on&&"left"!==X){var ae=an.filter(function(n){var e;return null===(e=n.refIndexes)||void 0===e?void 0:e.includes(G.selfIndex)});ae.length>0?re=ae[0].nodeId||ae[0].id:(null==Yn?void 0:Yn.id)&&(re=Yn.nodeId||Yn.id)}var ue=o.useMemo(function(){var n,e=new Map;if(!on||"right"!==X)return e;var i=1,o=an.filter(function(n){var e;return null===(e=n.refIndexes)||void 0===e?void 0:e.includes(G.selfIndex)}),t=1===o.length&&1===(null===(n=o[0].refIndexes)||void 0===n?void 0:n.length),l=function(n){return S(n||"").replace(/\\n/g,"\n")},d=function(n,e){var i=e?o[0]:Vn(an,n.nodeId||n.id||n.contentId);return{lhsNode:i,evalResult:n.evaluationResult||(null==i?void 0:i.evaluationResult),registryNodeId:i?i.nodeId||i.id:n.nodeId||n.id}};if(t){var r=function(n,e){if(void 0===e&&(e=!1),n){var o=d(n,e),t=o.lhsNode,a=o.evalResult,u=o.registryNodeId,c=l(n.content);Object.entries((null==a?void 0:a.deviations)||{}).forEach(function(n){var e=n[0],o=n[1],d=o[Z],r=l(d);if(!!t&&!b(o[Hn])&&r&&c.includes(r)){var a="".concat(u).concat(R).concat(e),s=cn[a];null!=s&&(i=Math.max(i,Math.max(1,s-(Jn||0))+1))}}),(n.subsections||[]).forEach(function(n){return r(n)})}};r(G,!0)}var a=function(n,o){if(void 0===o&&(o=!1),n){var t=d(n,o),r=t.lhsNode,u=t.evalResult,c=t.registryNodeId,s=(null==u?void 0:u.deviations)||{},v=l(n.content);Object.entries(s).map(function(n){var e,i=n[0],o=n[1],t=o[Z],d=!r||b(o[Hn]),a=l(t),u=a?v.indexOf(a):-1,s="".concat(c).concat(R).concat(i);return{refId:s,isRenderable:d&&!!a&&!b(t),position:u,registryIndex:null!==(e=cn[s])&&void 0!==e?e:Number.MAX_SAFE_INTEGER}}).filter(function(n){return n.isRenderable}).sort(function(n,e){return(-1===n.position?Number.MAX_SAFE_INTEGER:n.position)-(-1===e.position?Number.MAX_SAFE_INTEGER:e.position)||n.registryIndex-e.registryIndex}).forEach(function(n){e.set(n.refId,i++)}),(n.subsections||[]).forEach(function(n){return a(n)})}};return a(G,!0),e},[on,X,G,an,Z,Hn,cn,Jn]),ce=Object.keys(le)[0],se=ce?"".concat(re).concat(R).concat(ce):null,ve=se?null==sn?void 0:sn[se]:null,fe=L+1;if(on&&Sn){var pe="left"===X?Sn.leftNums.get(null==G?void 0:G.id):Sn.rightNums.get(null==G?void 0:G.id);ne&&void 0!==pe?fe=pe:null!=ve&&ve>=0?fe=ve:void 0!==pe&&(fe=pe)}else null!=ve&&ve>=0&&(fe=ve);var he=Object.entries(le).map(function(n){var e=n[0],i=n[1],o="".concat(re).concat(R).concat(e);return{deviationKey:e,deviationMap:i,refId:o,currentIndex:cn[o]}}).filter(function(n){return void 0!==n.currentIndex&&null!==n.currentIndex});he.sort(function(n,e){return n.currentIndex-e.currentIndex});var ge,xe,me=he.map(function(e){var i,o,t,l,d,r,a=e.deviationKey,u=e.deviationMap,c=e.refId,s=e.currentIndex,v=u[Z],f=b(v);if(f)v="";else if(!v)return null;var p=L,h=L;if(on)if("left"===X){var g=null===(i=G.refIndexes)||void 0===i?void 0:i[0],x=un.findIndex(function(n){return n.selfIndex===g});if(-1!==x)h=x;else{var m=un.findIndex(function(n){return n.id===G.id||n.nodeId===G.nodeId||n.contentId===G.contentId});h=-1!==m?m:L}}else{var y=null===(o=G.refIndexes)||void 0===o?void 0:o[0],S=an.findIndex(function(n){return n.selfIndex===y});if(-1!==S)p=S;else p=-1!==(A=an.findIndex(function(n){return n.id===G.id||n.nodeId===G.nodeId||n.contentId===G.contentId}))?A:L}var _="".concat(re).concat(R).concat(a).concat(R).concat(p).concat(R).concat(h),F=u[Hn],M=ne||b(F),k=ue.get(c),N=de.get(c);on&&"right"===X&&M&&void 0!==k?s=k:on&&"right"===X&&!M&&void 0!==N?s=N:on&&void 0!==Jn&&("right"!==X||M||ee)&&(s-=Jn),s=Math.max(1,s);var B=on&&"right"===X&&M&&Sn?w({section:G,proposedSections:an,leftNums:Sn.leftNums,fallbackNumber:String(fe),firstOnly:!0}):fe,C="".concat(B,".").concat(s),E=L;if("right"===X&&on){var A,O=null===(t=G.refIndexes)||void 0===t?void 0:t[0],j=an.findIndex(function(n){return n.selfIndex===O});if(-1!==j)E=j;else-1!==(A=an.findIndex(function(n){return n.id===G.id||n.nodeId===G.nodeId||n.contentId===G.contentId}))&&(E=A)}var W=pn?pn(E):null,T=(null==u?void 0:u.evaluation_outputs)||(null==ie?void 0:ie.evaluation_outputs),D=null!==(l=null==T?void 0:T.output_value)&&void 0!==l?l:null,P=null!==(r=null===(d=null==T?void 0:T.metadata)||void 0===d?void 0:d.label_color)&&void 0!==r?r:oe,K=I(P),z=W?n(n({},W),{badgeBg:K.badgeBg,badgeBorder:K.badgeBorder,badgeText:K.badgeText}):n({},K),H=(null==u?void 0:u.deviation_summary)?{deviation_summary:u.deviation_summary,deviation_title:(null==u?void 0:u.deviation_title)||(null==ie?void 0:ie.deviation_title),deviation_impact:(null==u?void 0:u.deviation_impact)||(null==ie?void 0:ie.deviation_impact),deviation_explanation:(null==u?void 0:u.deviation_explanation)||(null==ie?void 0:ie.deviation_explanation),evaluation_outputs:T,cognitive_decisioning:(null==u?void 0:u.cognitive_decisioning)||(null==ie?void 0:ie.cognitive_decisioning)}:null,V=0,Y=An||"";if(v&&Y){var q=Y.split(/\n{2,}/),J=q.findIndex(function(n){return n.includes(v)});if(-1!==J){var Q=Object.entries(le).filter(function(n){n[0];var e=n[1][Z];return e&&q[J].includes(e)}).sort(function(n,e){return q[J].indexOf(n[1][Z])-q[J].indexOf(e[1][Z])}),U=Q.filter(function(n){n[0];var e=n[1][Z];return e&&(e.includes(v)||v.includes(e))});U.length>1&&(V=Math.max(0,U.findIndex(function(n){return n[0]===a})))}}var $=vn(X,c);return{id:c,actionId:_,label:C,highlight:v,side:X,style:z,stackIndex:V,score:D,isConnected:null==hn?void 0:hn.has(_),showScrollLockToggle:(null==hn?void 0:hn.has(_))||yn&&bn===_||!!_n&&_n===$.current,scrollSyncLocked:wn,toggleScrollSyncLocked:Rn,isOrphan:M,isMissingClause:f,badgeRef:$,onClick:function(n){n.stopPropagation(),gn&&gn(n,Yn||{id:"orphan-left",title:"",content:""},M,qn||{id:"orphan-right",title:"",content:""},_,z)},onSummaryClick:function(n){n.stopPropagation(),fn(n,_,M,H)}}}).filter(Boolean),Ie=ln||!Bn&&kn?me:[],ye=me.map(function(n){return n.highlight}).filter(Boolean),be=G.id&&X===(null==Q?void 0:Q.columnKey)?Q:null,we=o.useRef(!1);return t(function(){q||(we.current=!1)},[q]),e(l,n({ref:H,sx:{mb:Y,width:"100%",display:"flex",flexDirection:"column",position:"relative",minWidth:0}},{children:[q&&(null==be?void 0:be.showAbove)&&i("div",n({style:{position:"sticky",top:0,height:"0px",cursor:"pointer"},onClick:function(){var n,e;return null===(e=null===(n=null==be?void 0:be.showAboveRef)||void 0===n?void 0:n.current)||void 0===e?void 0:e.scrollIntoView({behavior:"smooth",block:"center"})}},{children:i("div",n({style:n({transform:"translateY(-50%) translateX(calc(100% ".concat("left"===X?"+":"-"," 130px))"),position:"absolute",paddingTop:"20px"},"left"===X?{right:"-20px"}:{left:"-20px"})},{children:i(s,{color:(null===(K=null==be?void 0:be.showAboveRef)||void 0===K?void 0:K.current)?window.getComputedStyle(be.showAboveRef.current).color:void 0})}))})),e(d,n({disableGutters:!0,expanded:!Wn&&q,onChange:function(){Wn||(J(),nn.current=G.id)},sx:{boxShadow:"none",border:Wn?"1px dashed #E2E8F0":"1px solid #E2E8F0",bgcolor:Wn?"#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:[i(r,n({expandIcon:Wn?null:i(v,{size:16}),sx:{minHeight:"36px",flexShrink:0,cursor:Wn?"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:Mn&&i(a,n({title:Tn,placement:"top"},{children:i(u,n({component:"div",sx:{fontSize:"12px",color:Wn?"#94A3B8":"#19213D",fontWeight:Wn?400:700,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0}},{children:(ge=Pn,xe=Dn,void 0===xe&&(xe=!1),ge?S(ge).replace(/\\n/g,"\n").split(/(\*\*.*?\*\*)/g).map(function(o,t){return o.startsWith("**")&&o.endsWith("**")?i("strong",{children:o.slice(2,-2)},t):e("div",n({style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"8px",width:"100%"}},{children:[i("span",n({style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},{children:o})),xe&&i("span",n({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"}))]}),t)}):null)}))}))})),!Wn&&e(c,n({sx:{pt:0,pb:1.25,bgcolor:"#FFFFFF",flex:1,display:"flex",flexDirection:"column",minWidth:0}},{children:[jn&&i(f,{content:An,overlayContent:On,sxStyles:en,highlights:ye,maintainRelativeOrder:on,highlightBg:te,suppressHighlightBg:Cn,deviationBadges:Ie,collisionKey:Fn}),(G.subsections||[]).map(function(n,e){return dn({section:n,keyPath:"".concat(L,"-").concat(e),depth:0,columnKey:X,parentNodeId:Z,sectionOffset:Jn,rhsOrphanVisualIndexes:ue})})]}))]})),q&&(null==be?void 0:be.showBelow)&&i("div",n({style:{position:"sticky",bottom:0,height:"0px",cursor:"pointer"},onClick:function(){var n,e;return null===(e=null===(n=null==be?void 0:be.showBelowRef)||void 0===n?void 0:n.current)||void 0===e?void 0:e.scrollIntoView({behavior:"smooth",block:"center"})}},{children:i("div",n({style:n({transform:"translateY(-50%) translateX(calc(100% ".concat("left"===X?"+":"-"," 130px))"),position:"absolute",paddingBottom:"20px"},"left"===X?{right:"-20px"}:{left:"-20px"})},{children:i(v,{color:(null===(z=null==be?void 0:be.showBelowRef)||void 0===z?void 0:z.current)?window.getComputedStyle(be.showBelowRef.current).color:void 0})}))}))]}),"".concat(X,"-sec-").concat(L))};export{F as default};
|
|
1
|
+
import{__spreadArray as n,__assign as e}from"tslib";import{jsxs as i,jsx as o}from"react/jsx-runtime";import t,{useEffect as l}from"react";import{Box as r,Accordion as d,AccordionSummary as a,Tooltip as u,Typography as c,AccordionDetails as s}from"@mui/material";import{ChevronUp as v,ChevronDown as f}from"lucide-react";import{MemoizedMarkdown as p}from"../hooks/memoizedMarkdown.js";import{useCompareContext as h}from"../CompareContext.js";import{hasValue as g,hasMeaningfulRedlineTags as m,safeStringify as x,stripRedlineTags as I,hasSingleMappedLhsSection as y,generateColorPalette as b,getLhsDeviationDisplayIndexes as w,DEVIATION_BADGE_SEPARATOR as S,isMissingStr as R,getRhsMappedSectionNumber as _,findTextMatchRange as M}from"../CognitiveComparehelpers.js";import{DEFAULT_DEVIAION_COLOR as F}from"../CognitiveCompareConstants.js";import{normalizeRedlineMarkdown as k}from"../utils/normalizeRedlineMarkdown.js";var N=function(N){var B,C,E,A,O,j,W,T,D,P,z,K,G,L,X,H=N.section,V=N.idx,Y=N.columnKey,q=N.colRef,J=N.mb,Q=void 0===J?1:J,U=N.isExpanded,Z=N.onToggle,$=N.navigation,nn=N.parentNodeId,en=void 0===nn?"":nn,on=h(),tn=on.showOpenNodeRef,ln=on.resolvedMarkdownStyles,rn=on.maintainRelativeOrder,dn=on.showDeviationBadges,an=void 0!==dn&&dn,un=on.renderSubSectionAccordion,cn=on.treeData,sn=on.proposedSections,vn=on.existingSections,fn=on.deviationNumberRegistry,pn=on.deviationParentRegistry,hn=on.getBadgeRef,gn=on.openSummaryPopup,mn=on.getSectionCompareStyle,xn=on.connectedSections,In=on.openMoreFunctionsPopup,yn=on.isProposingFix,bn=on.proposingFixNodeId,wn=on.isRedlineFlow,Sn=on.isSideBySide,Rn=on.activeSideBySideSection,_n=on.scrollSyncLocked,Mn=on.unifiedNumbering,Fn=on.toggleScrollSyncLocked,kn=on.summaryPopupAnchorEl,Nn="".concat(Sn?"1":"0","-").concat(String(null!=Rn?Rn:"")),Bn=(null===(B=H.displayTitle)||void 0===B||B)&&g(H.title),Cn=!(!yn||!bn||"left"!==Y||H.id!==bn&&H.nodeId!==bn&&H.contentId!==bn),En=m(H.content),An="boolean"==typeof wn?wn:En,On=En,jn=H.change_history,Wn=An&&En,Tn=t.useMemo(function(){return Wn?k(x(H.content)):x(H.content)},[H.content,Wn]),Dn=Wn?I(Tn):H.content,Pn=Wn?Tn:void 0,zn=En&&g(jn)?x(jn):void 0,Kn=(null===(C=H.displayContent)||void 0===C||C||En)&&g(H.content),Gn=!Bn&&!Kn,Ln=H.title;Bn||(Ln=Kn?"No Title Found":"No Matching Section Found");var Xn="left"===Y&&(H.isMultipleMapping||(null!==(A=null===(E=H.refContentIds)||void 0===E?void 0:E.length)&&void 0!==A?A:1)>1),Hn="left"===Y&&Ln.length>29?"".concat(Ln.slice(0,29).trimEnd(),"..."):Ln,Vn=H.evaluationResult;if(!Vn&&"right"===Y)if(rn){var Yn=null===(O=H.refIndexes)||void 0===O?void 0:O[0],qn=sn.find(function(n){return n.selfIndex===Yn});Vn=null==qn?void 0:qn.evaluationResult}else Vn=null===(j=sn[V])||void 0===j?void 0:j.evaluationResult;var Jn=null===(W=null==cn?void 0:cn.input_index_map)||void 0===W?void 0:W[0],Qn=null===(T=null==cn?void 0:cn.input_index_map)||void 0===T?void 0:T[1],Un="left"===Y?Qn:Jn,Zn=function(n,e){var i;if(!e||!n)return null;for(var o=0,t=n;o<t.length;o++){var l=t[o];if(l.id===e||l.nodeId===e||l.contentId===e)return l;if(null===(i=l.subsections)||void 0===i?void 0:i.length){var r=Zn(l.subsections,e);if(r)return r}}return null},$n="left"===Y?H:Zn(sn,H.id),ne="right"===Y?H:Zn(vn,H.id),ee=t.useMemo(function(){if(!rn)return 0;var n=1/0,e=function(n){var e=x(n||"").replace(/\\n/g,"\n");return m(e)?I(k(e)):e},i=function(o,t,l,r){if(o){var d=o.nodeId||o.id;if(r&&"right"===Y){var a=sn.filter(function(n){var e;return null===(e=n.refIndexes)||void 0===e?void 0:e.includes(o.selfIndex)});a.length>0&&(d=a[0].nodeId||a[0].id)}var u=o.nodeId||o.id||(null==t?void 0:t.nodeId)||(null==t?void 0:t.id)||(null==l?void 0:l.nodeId)||(null==l?void 0:l.id),c=o.evaluationResult||(null==t?void 0:t.evaluationResult)||(null==l?void 0:l.evaluationResult),s=(null==c?void 0:c.deviations)||{};Object.keys(s).forEach(function(i){var r,a=null===(r=s[i])||void 0===r?void 0:r[en];if(function(n,i){if("string"!=typeof i||R(i))return!1;var o=e(null==n?void 0:n.content),t=e(i);return!!t&&!!M(o,t)}("left"===Y?t||o:l||o,a)){var c="".concat(d).concat(S).concat(i),v=null==fn?void 0:fn[c];null!=v&&v<n&&(n=v);var f="".concat(u).concat(S).concat(i),p=null==fn?void 0:fn[f];null!=p&&p<n&&(n=p)}});for(var v=o.subsections||[],f=(null==t?void 0:t.subsections)||[],p=(null==l?void 0:l.subsections)||[],h=Math.max(v.length,f.length,p.length),g=0;g<h;g++)i(v[g],f[g],p[g],!1)}},o="right"===Y?sn.filter(function(n){var e;return null===(e=n.refIndexes)||void 0===e?void 0:e.includes(H.selfIndex)}):[];if(1===o.length){var t=o[0];(t.refIndexes||[]).map(function(n){return vn.find(function(e){return e.selfIndex===n})}).filter(Boolean).forEach(function(n){i(n,t,n,!0)})}else i(H,$n,ne,!0);return n!==1/0?n-1:0},[H,$n,ne,Y,en,fn,rn,sn,vn]);if(rn)if("left"===Y){var ie=null===(D=H.refIndexes)||void 0===D?void 0:D[0],oe=vn.findIndex(function(n){return n.selfIndex===ie});ne=-1!==oe?vn[oe]:Zn(vn,H.id)}else{var te=null===(P=H.refIndexes)||void 0===P?void 0:P[0],le=sn.findIndex(function(n){return n.selfIndex===te});$n=-1!==le?sn[le]:Zn(sn,H.id)}var re="left"===Y?!ne:!$n,de=rn&&"right"===Y&&y(H,sn),ae=Vn||(null==$n?void 0:$n.evaluationResult)||(null==ne?void 0:ne.evaluationResult),ue=null!==(G=null===(K=null===(z=null==ae?void 0:ae.evaluation_outputs)||void 0===z?void 0:z.metadata)||void 0===K?void 0:K.label_color)&&void 0!==G?G:F,ce=b(ue).highlightBg,se=(null==ae?void 0:ae.deviations)||{},ve=t.useMemo(function(){return rn&&"right"===Y?w(sn,Jn,fn):new Map},[rn,Y,sn,Jn,fn]),fe=H.nodeId||H.id;if(rn&&"left"!==Y){var pe=sn.filter(function(n){var e;return null===(e=n.refIndexes)||void 0===e?void 0:e.includes(H.selfIndex)});pe.length>0?fe=pe[0].nodeId||pe[0].id:(null==$n?void 0:$n.id)&&(fe=$n.nodeId||$n.id)}var he=t.useMemo(function(){var n,e=new Map;if(!rn||"right"!==Y)return e;var i=1,o=sn.filter(function(n){var e;return null===(e=n.refIndexes)||void 0===e?void 0:e.includes(H.selfIndex)}),t=1===o.length&&1===(null===(n=o[0].refIndexes)||void 0===n?void 0:n.length),l=function(n){return x(n||"").replace(/\\n/g,"\n")},r=function(n,e){var i=e?o[0]:Zn(sn,n.nodeId||n.id||n.contentId);return{lhsNode:i,evalResult:n.evaluationResult||(null==i?void 0:i.evaluationResult),registryNodeId:i?i.nodeId||i.id:n.nodeId||n.id}};if(t){var d=function(n,e){if(void 0===e&&(e=!1),n){var o=r(n,e),t=o.lhsNode,a=o.evalResult,u=o.registryNodeId,c=l(n.content);Object.entries((null==a?void 0:a.deviations)||{}).forEach(function(n){var e=n[0],o=n[1],r=o[en],d=l(r);if(!!t&&!R(o[Un])&&d&&M(c,d)){var a="".concat(u).concat(S).concat(e),s=fn[a];null!=s&&(i=Math.max(i,Math.max(1,s-(ee||0))+1))}}),(n.subsections||[]).forEach(function(n){return d(n)})}};d(H,!0)}var a=function(n,o){if(void 0===o&&(o=!1),n){var t=r(n,o),d=t.lhsNode,u=t.evalResult,c=t.registryNodeId,s=(null==u?void 0:u.deviations)||{},v=l(n.content);Object.entries(s).map(function(n){var e,i,o,t=n[0],r=n[1],a=r[en],u=!d||R(r[Un]),s=l(a),f=s&&null!==(i=null===(e=M(v,s))||void 0===e?void 0:e.start)&&void 0!==i?i:-1,p="".concat(c).concat(S).concat(t);return{refId:p,isRenderable:u&&!!s&&!R(a),position:f,registryIndex:null!==(o=fn[p])&&void 0!==o?o:Number.MAX_SAFE_INTEGER}}).filter(function(n){return n.isRenderable}).sort(function(n,e){return(-1===n.position?Number.MAX_SAFE_INTEGER:n.position)-(-1===e.position?Number.MAX_SAFE_INTEGER:e.position)||n.registryIndex-e.registryIndex}).forEach(function(n){e.set(n.refId,i++)}),(n.subsections||[]).forEach(function(n){return a(n)})}};return a(H,!0),e},[rn,Y,H,sn,en,Un,fn,ee]),ge=Object.keys(se)[0],me=ge?"".concat(fe).concat(S).concat(ge):null,xe=me?null==pn?void 0:pn[me]:null,Ie=V+1;if(rn&&Mn){var ye="left"===Y?Mn.leftNums.get(null==H?void 0:H.id):Mn.rightNums.get(null==H?void 0:H.id);re&&void 0!==ye?Ie=ye:null!=xe&&xe>=0?Ie=xe:void 0!==ye&&(Ie=ye)}else null!=xe&&xe>=0&&(Ie=xe);var be=Math.max.apply(Math,n([0],Object.keys(se).map(function(n){return fn["".concat(fe).concat(S).concat(n)]}).filter(function(n){return"number"==typeof n&&Number.isFinite(n)}),!1))+1,we=Object.entries(se).map(function(n){var e,i=n[0],o=n[1],t="".concat(fe).concat(S).concat(i);return{deviationKey:i,deviationMap:o,refId:t,currentIndex:null!==(e=fn[t])&&void 0!==e?e:be++}});we.sort(function(n,e){return n.currentIndex-e.currentIndex});var Se,Re,_e=we.map(function(n){var i,o,t,l,r,d,a=n.deviationKey,u=n.deviationMap,c=n.refId,s=n.currentIndex,v=u[en],f=R(v);if(f)v="";else if(!v)return null;var p=V,h=V;if(rn)if("left"===Y){var g=null===(i=H.refIndexes)||void 0===i?void 0:i[0],m=vn.findIndex(function(n){return n.selfIndex===g});if(-1!==m)h=m;else{var x=vn.findIndex(function(n){return n.id===H.id||n.nodeId===H.nodeId||n.contentId===H.contentId});h=-1!==x?x:V}}else{var I=null===(o=H.refIndexes)||void 0===o?void 0:o[0],y=sn.findIndex(function(n){return n.selfIndex===I});if(-1!==y)p=y;else p=-1!==(A=sn.findIndex(function(n){return n.id===H.id||n.nodeId===H.nodeId||n.contentId===H.contentId}))?A:V}var w="".concat(fe).concat(S).concat(a).concat(S).concat(p).concat(S).concat(h),M=u[Un],F=re||R(M),k=he.get(c),N=ve.get(c);rn&&"right"===Y&&F&&void 0!==k?s=k:rn&&"right"===Y&&!F&&void 0!==N?s=N:rn&&void 0!==ee&&("right"!==Y||F||de)&&(s-=ee),s=Math.max(1,s);var B=rn&&"right"===Y&&F&&Mn?_({section:H,proposedSections:sn,leftNums:Mn.leftNums,fallbackNumber:String(Ie),firstOnly:!0}):Ie,C="".concat(B,".").concat(s),E=V;if("right"===Y&&rn){var A,O=null===(t=H.refIndexes)||void 0===t?void 0:t[0],j=sn.findIndex(function(n){return n.selfIndex===O});if(-1!==j)E=j;else-1!==(A=sn.findIndex(function(n){return n.id===H.id||n.nodeId===H.nodeId||n.contentId===H.contentId}))&&(E=A)}var W=mn?mn(E):null,T=(null==u?void 0:u.evaluation_outputs)||(null==ae?void 0:ae.evaluation_outputs),D=null!==(l=null==T?void 0:T.output_value)&&void 0!==l?l:null,P=null!==(d=null===(r=null==T?void 0:T.metadata)||void 0===r?void 0:r.label_color)&&void 0!==d?d:ue,z=b(P),K=W?e(e({},W),{badgeBg:z.badgeBg,badgeBorder:z.badgeBorder,badgeText:z.badgeText}):e({},z),G=(null==u?void 0:u.deviation_summary)?{deviation_summary:u.deviation_summary,deviation_title:(null==u?void 0:u.deviation_title)||(null==ae?void 0:ae.deviation_title),deviation_impact:(null==u?void 0:u.deviation_impact)||(null==ae?void 0:ae.deviation_impact),deviation_explanation:(null==u?void 0:u.deviation_explanation)||(null==ae?void 0:ae.deviation_explanation),evaluation_outputs:T,cognitive_decisioning:(null==u?void 0:u.cognitive_decisioning)||(null==ae?void 0:ae.cognitive_decisioning)}:null,L=0,X=Dn||"";if(v&&X){var q=X.split(/\n{2,}/),J=q.findIndex(function(n){return n.includes(v)});if(-1!==J){var Q=Object.entries(se).filter(function(n){n[0];var e=n[1][en];return e&&q[J].includes(e)}).sort(function(n,e){return q[J].indexOf(n[1][en])-q[J].indexOf(e[1][en])}),U=Q.filter(function(n){n[0];var e=n[1][en];return e&&(e.includes(v)||v.includes(e))});U.length>1&&(L=Math.max(0,U.findIndex(function(n){return n[0]===a})))}}var Z=hn(Y,c);return{id:c,actionId:w,label:C,highlight:v,side:Y,style:K,stackIndex:L,score:D,isConnected:null==xn?void 0:xn.has(w),showScrollLockToggle:(null==xn?void 0:xn.has(w))||Sn&&Rn===w||!!kn&&kn===Z.current,scrollSyncLocked:_n,toggleScrollSyncLocked:Fn,isOrphan:F,isMissingClause:f,badgeRef:Z,onClick:function(n){n.stopPropagation(),In&&In(n,$n||{id:"orphan-left",title:"",content:""},F,ne||{id:"orphan-right",title:"",content:""},w,K)},onSummaryClick:function(n){n.stopPropagation(),gn(n,w,F,G)}}}).filter(Boolean),Me=an||Cn?_e:[],Fe=_e.map(function(n){return n.highlight}).filter(Boolean),ke=H.id&&Y===(null==$?void 0:$.columnKey)?$:null,Ne=t.useRef(!1);return l(function(){U||(Ne.current=!1)},[U]),i(r,e({ref:q,sx:{mb:Q,width:"100%",display:"flex",flexDirection:"column",position:"relative",minWidth:0}},{children:[U&&(null==ke?void 0:ke.showAbove)&&o("div",e({style:{position:"sticky",top:0,height:"0px",cursor:"pointer"},onClick:function(){var n,e;return null===(e=null===(n=null==ke?void 0:ke.showAboveRef)||void 0===n?void 0:n.current)||void 0===e?void 0:e.scrollIntoView({behavior:"smooth",block:"center"})}},{children:o("div",e({style:e({transform:"translateY(-50%) translateX(calc(100% ".concat("left"===Y?"+":"-"," 130px))"),position:"absolute",paddingTop:"20px"},"left"===Y?{right:"-20px"}:{left:"-20px"})},{children:o(v,{color:(null===(L=null==ke?void 0:ke.showAboveRef)||void 0===L?void 0:L.current)?window.getComputedStyle(ke.showAboveRef.current).color:void 0})}))})),i(d,e({disableGutters:!0,expanded:!Gn&&U,onChange:function(){Gn||(Z(),tn.current=H.id)},sx:{boxShadow:"none",border:Gn?"1px dashed #E2E8F0":"1px solid #E2E8F0",bgcolor:Gn?"#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:[o(a,e({expandIcon:Gn?null:o(f,{size:16}),sx:{minHeight:"36px",flexShrink:0,cursor:Gn?"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:Bn&&o(u,e({title:Ln,placement:"top"},{children:o(c,e({component:"div",sx:{fontSize:"12px",color:Gn?"#94A3B8":"#19213D",fontWeight:Gn?400:700,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0}},{children:(Se=Hn,Re=Xn,void 0===Re&&(Re=!1),Se?x(Se).replace(/\\n/g,"\n").split(/(\*\*.*?\*\*)/g).map(function(n,t){return n.startsWith("**")&&n.endsWith("**")?o("strong",{children:n.slice(2,-2)},t):i("div",e({style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"8px",width:"100%"}},{children:[o("span",e({style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},{children:n})),Re&&o("span",e({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"}))]}),t)}):null)}))}))})),!Gn&&i(s,e({sx:{pt:0,pb:1.25,bgcolor:"#FFFFFF",flex:1,display:"flex",flexDirection:"column",minWidth:0}},{children:[Kn&&o(p,{content:Dn,overlayContent:Pn,fallbackContent:zn,sxStyles:ln,highlights:Fe,maintainRelativeOrder:rn,highlightBg:ce,suppressHighlightBg:On,deviationBadges:Me,collisionKey:Nn}),(H.subsections||[]).map(function(n,e){return un({section:n,keyPath:"".concat(V,"-").concat(e),depth:0,columnKey:Y,parentNodeId:en,sectionOffset:ee,rhsOrphanVisualIndexes:he})})]}))]})),U&&(null==ke?void 0:ke.showBelow)&&o("div",e({style:{position:"sticky",bottom:0,height:"0px",cursor:"pointer"},onClick:function(){var n,e;return null===(e=null===(n=null==ke?void 0:ke.showBelowRef)||void 0===n?void 0:n.current)||void 0===e?void 0:e.scrollIntoView({behavior:"smooth",block:"center"})}},{children:o("div",e({style:e({transform:"translateY(-50%) translateX(calc(100% ".concat("left"===Y?"+":"-"," 130px))"),position:"absolute",paddingBottom:"20px"},"left"===Y?{right:"-20px"}:{left:"-20px"})},{children:o(f,{color:(null===(X=null==ke?void 0:ke.showBelowRef)||void 0===X?void 0:X.current)?window.getComputedStyle(ke.showBelowRef.current).color:void 0})}))}))]}),"".concat(Y,"-sec-").concat(V))};export{N as default};
|
|
2
2
|
//# sourceMappingURL=SectionAccordion.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as n}from"tslib";import{jsx as i,jsxs as e}from"react/jsx-runtime";import t,{useMemo as o}from"react";import{Box as l,Accordion as d,AccordionSummary as r,Typography as a,AccordionDetails as u}from"@mui/material";import{ChevronDown as c}from"lucide-react";import{MemoizedMarkdown as s}from"../hooks/memoizedMarkdown.js";import{useCompareContext as v}from"../CompareContext.js";import{hasValue as f,hasMeaningfulRedlineTags as p,stripRedlineTags as h,hasSingleMappedLhsSection as m,getLhsDeviationDisplayIndexes as g,generateColorPalette as x,safeStringify as y,isMissingStr as S,getRhsMappedSectionNumber as I,DEVIATION_BADGE_SEPARATOR as b}from"../CognitiveComparehelpers.js";import{DEFAULT_DEVIAION_COLOR as _}from"../CognitiveCompareConstants.js";var k=t.memo(function(t){var w,C,F,O,P,N,B,M,R,E,j=t.section,A=t.keyPath,K=t.depth,W=void 0===K?0:K,L=t.columnKey,T=void 0===L?"left":L,z=t.parentNodeId,D=void 0===z?"":z,G=t.sectionOffset,H=t.rhsOrphanVisualIndexes,V=v(),X=V.expandedSubSections,U=V.setExpandedSubSections,q=V.maintainRelativeOrder,J=V.showDeviationBadges,Q=void 0!==J&&J,Y=V.proposedSections,Z=V.existingSections,$=V.treeData,nn=V.deviationNumberRegistry,en=V.deviationParentRegistry,tn=V.connectedSections,on=V.activeSideBySideSection,ln=V.isSideBySide,dn=V.scrollSyncLocked,rn=V.toggleScrollSyncLocked,an=V.summaryPopupAnchorEl,un=V.resolvedMarkdownStyles,cn=V.getSubSectionRef,sn=V.getSubSectionCompareStyle,vn=V.getBadgeRef,fn=V.openMoreFunctionsPopup,pn=V.openSummaryPopup,hn=V.resetSideBySide,mn=V.setConnectedSections,gn=V.setConnectedLines,xn=V.cachedConnectedPositions,yn=V.isProposingFix,Sn=V.proposingFixNodeId,In=V.isRedlineFlow,bn=V.unifiedNumbering,_n=null!=on?on:"",kn=(null===(w=j.displayTitle)||void 0===w||w)&&f(j.title),wn=!(!yn||!Sn||"left"!==T||j.id!==Sn&&j.nodeId!==Sn),Cn=p(j.content),Fn="boolean"==typeof In?In:Cn,On=Cn,Pn=Fn&&Cn,Nn=Pn?h(j.content):j.content,Bn=Pn?j.content:void 0,Mn=(null===(C=j.displayContent)||void 0===C||C||Cn)&&f(j.content),Rn=!kn&&!Mn,En=kn?j.title:Mn?"No Title Found":"No Matching Section Found",jn=!!X[A],An=cn(T,A),Kn=A.split("-").map(Number)[0],Wn=Y[Kn],Ln=Z[Kn],Tn=Kn,zn=Kn,Dn=!1,Gn=function(n,i,e){if(!n||!i)return null;if(n.id===i||n.nodeId===i||n.contentId===i)return{section:n,keyPath:e};for(var t=(n.subsections||[]).map(function(n,i){return{section:n,keyPath:"".concat(e,"-").concat(i)}}),o=function(){var n=t.shift();return(null==n?void 0:n.section)?n.section.id===i||n.section.nodeId===i||n.section.contentId===i?{value:n}:void(n.section.subsections||[]).forEach(function(i,e){t.push({section:i,keyPath:"".concat(n.keyPath,"-").concat(e)})}):"continue"};t.length>0;){var l=o();if("object"==typeof l)return l.value}return null};if(q)if("left"===T){var Hn=null===(F=null==Wn?void 0:Wn.refIndexes)||void 0===F?void 0:F[0],Vn=Z.findIndex(function(n){return n.selfIndex===Hn});-1!==Vn?(Ln=Z[Vn],zn=Vn):Dn=!0}else{var Xn=null===(O=null==Ln?void 0:Ln.refIndexes)||void 0===O?void 0:O[0],Un=Y.findIndex(function(n){return n.selfIndex===Xn});-1!==Un?(Wn=Y[Un],Tn=Un):Dn=!0}var qn=function(n,i){if(!i||!n)return null;for(var e=0;e<n.length;e++){var t=Gn(n[e],i,String(e));if(t)return t}return null},Jn=null,Qn=null,Yn="",Zn="";if(q)"left"===T?(Jn=j,Yn=A,($n=Gn(Ln,j.nodeId||j.id,String(zn)))||($n=qn(Z,j.nodeId||j.id)),Qn=(null==$n?void 0:$n.section)||null,Zn=(null==$n?void 0:$n.keyPath)||""):(Qn=j,Zn=A,(ni=Gn(Wn,j.nodeId||j.id,String(Tn)))||(ni=qn(Y,j.nodeId||j.id)),Jn=(null==ni?void 0:ni.section)||null,Yn=(null==ni?void 0:ni.keyPath)||"");else if("left"===T){Jn=j,Yn=A;var $n=qn(Z,j.nodeId||j.id);Qn=(null==$n?void 0:$n.section)||null,Zn=(null==$n?void 0:$n.keyPath)||""}else{Qn=j,Zn=A;var ni=qn(Y,j.nodeId||j.id);Jn=(null==ni?void 0:ni.section)||null,Yn=(null==ni?void 0:ni.keyPath)||""}var ii=(Yn?sn(Yn):null)||sn(A),ei=null===(P=null==$?void 0:$.input_index_map)||void 0===P?void 0:P[0],ti=null===(N=null==$?void 0:$.input_index_map)||void 0===N?void 0:N[1],oi="left"===T?ti:ei,li="left"===T?!Qn:!Jn,di=q&&"right"===T&&m(Ln,Y),ri=j.evaluationResult||(null==Jn?void 0:Jn.evaluationResult)||(null==Qn?void 0:Qn.evaluationResult),ai=(null==ri?void 0:ri.deviations)||{},ui=o(function(){return q&&"right"===T?g(Y,ei,nn):new Map},[q,T,Y,ei,nn]),ci=j.nodeId||j.id||(null==Jn?void 0:Jn.nodeId)||(null==Jn?void 0:Jn.id)||(null==Qn?void 0:Qn.nodeId)||(null==Qn?void 0:Qn.id);q&&"left"!==T&&(null==Jn?void 0:Jn.id)&&(ci=Jn.nodeId||Jn.id);var si=Object.keys(ai)[0],vi=si?"".concat(ci).concat(b).concat(si):null,fi=vi?null==en?void 0:en[vi]:null,pi=Kn+1;if(q&&bn){var hi="left"===T?bn.leftNums.get(null==Wn?void 0:Wn.id):bn.rightNums.get(null==Ln?void 0:Ln.id);Dn&&void 0!==hi?pi=hi:null!=fi&&fi>=0?pi=fi:void 0!==hi&&(pi=hi)}else null!=fi&&fi>=0&&(pi=fi);var mi=null!==(R=null===(M=null===(B=null==ri?void 0:ri.evaluation_outputs)||void 0===B?void 0:B.metadata)||void 0===M?void 0:M.label_color)&&void 0!==R?R:_,gi=x(mi).highlightBg,xi=Object.entries(ai).map(function(n){var i=n[0],e=n[1],t="".concat(ci).concat(b).concat(i);return{deviationKey:i,deviationMap:e,refId:t,currentIndex:nn[t]}}).filter(function(n){return void 0!==n.currentIndex&&null!==n.currentIndex});xi.sort(function(n,i){return n.currentIndex-i.currentIndex});var yi=new Map;if(!H&&q&&"right"===T){var Si=y(Nn||"").replace(/\\n/g,"\n");xi.filter(function(n){var i=n.deviationMap,e=i[D];return(li||S(i[oi]))&&!!e&&!S(e)}).map(function(i){var e=y(i.deviationMap[D]||"").replace(/\\n/g,"\n"),t=e?Si.indexOf(e):-1;return n(n({},i),{position:t})}).sort(function(n,i){return(-1===n.position?Number.MAX_SAFE_INTEGER:n.position)-(-1===i.position?Number.MAX_SAFE_INTEGER:i.position)||n.currentIndex-i.currentIndex}).forEach(function(n,i){yi.set(n.refId,i+1)})}var Ii=xi.map(function(i){var e,t,o,l,d=i.deviationKey,r=i.deviationMap,a=i.refId,u=i.currentIndex,c=r[D],s=S(c);if(s)c="";else if(!c)return null;var v=r[oi],f=li||S(v),p=null!==(e=null==H?void 0:H.get(a))&&void 0!==e?e:yi.get(a),h=ui.get(a);q&&"right"===T&&f&&void 0!==p?u=p:q&&"right"===T&&!f&&void 0!==h?u=h:q&&void 0!==G&&("right"!==T||f||di)&&(u-=G),u=Math.max(1,u);var m=q&&"right"===T&&f&&bn?I({section:Ln,proposedSections:Y,leftNums:bn.leftNums,fallbackNumber:String(pi),firstOnly:!0}):pi,g="".concat(m,".").concat(u),y="".concat(ci).concat(b).concat(d).concat(b).concat(Yn).concat(b).concat(Zn),_=(null==r?void 0:r.evaluation_outputs)||(null==ri?void 0:ri.evaluation_outputs),k=null!==(t=null==_?void 0:_.output_value)&&void 0!==t?t:null,w=null!==(l=null===(o=null==_?void 0:_.metadata)||void 0===o?void 0:o.label_color)&&void 0!==l?l:mi,C=x(w),F=n({},C),O=(null==r?void 0:r.deviation_summary)?{deviation_summary:r.deviation_summary||(null==ri?void 0:ri.deviation_summary),deviation_title:(null==r?void 0:r.deviation_title)||(null==ri?void 0:ri.deviation_title),deviation_impact:(null==r?void 0:r.deviation_impact)||(null==ri?void 0:ri.deviation_impact),deviation_explanation:(null==r?void 0:r.deviation_explanation)||(null==ri?void 0:ri.deviation_explanation),evaluation_outputs:_,cognitive_decisioning:(null==r?void 0:r.cognitive_decisioning)||(null==ri?void 0:ri.cognitive_decisioning)}:null,P=0,N=Nn||"";if(c&&N){var B=N.split(/\n{2,}/),M=B.findIndex(function(n){return n.includes(c)});if(-1!==M){var R=Object.entries(ai).filter(function(n){n[0];var i=n[1][D];return i&&B[M].includes(i)}).sort(function(n,i){return B[M].indexOf(n[1][D])-B[M].indexOf(i[1][D])}),E=R.filter(function(n){n[0];var i=n[1][D];return i&&(i.includes(c)||c.includes(i))});E.length>1&&(P=Math.max(0,E.findIndex(function(n){return n[0]===d})))}}var j=vn(T,a);return{id:a,actionId:y,label:g,highlight:c,side:T,style:F,stackIndex:P,score:k,isConnected:tn.has(y),showScrollLockToggle:tn.has(y)||ln&&on===y||!!an&&an===j.current,scrollSyncLocked:dn,toggleScrollSyncLocked:rn,isOrphan:f,isMissingClause:s,badgeRef:j,onClick:function(i){i.stopPropagation();var e=Jn?n(n({},Jn),{title:(null==Wn?void 0:Wn.title)||(null==Jn?void 0:Jn.title)||""}):{id:"orphan-left",title:"",content:""},t=Qn?n(n({},Qn),{title:(null==Ln?void 0:Ln.title)||(null==Qn?void 0:Qn.title)||""}):{id:"orphan-right",title:"",content:""};fn(i,e,f,t,y,F)},onSummaryClick:function(n){n.stopPropagation(),pn(n,y,f,O)}}}).filter(Boolean).sort(function(n,i){return parseFloat(n.label)-parseFloat(i.label)}),bi=o(function(){var n=new Set;return Ii.filter(function(i){return!n.has(i.id)&&(n.add(i.id),!0)})},[Ii]),_i=Q||!Fn&&wn?bi:[],ki=bi.map(function(n){return n.highlight}).filter(Boolean),wi=Ii.find(function(n){return tn.has(n.actionId)}),Ci=!!wi;if(!(kn||Mn||j.subsections&&0!==j.subsections.length))return null;var Fi=(null===(E=null==wi?void 0:wi.style)||void 0===E?void 0:E.badgeBorder)||(null==ii?void 0:ii.badgeBorder),Oi=Ci&&Fi?{borderRadius:"4px",outline:"2px solid ".concat(Fi),outlineOffset:"1px"}:{};return i(l,kn?n({ref:An,sx:{mt:1,width:"100%",minWidth:0,position:"relative"}},{children:i(l,n({sx:n({width:"100%"},Oi)},{children:e(d,n({disableGutters:!0,expanded:!Rn&&jn,onChange:function(){if(!Rn){if(jn){var i=String(on||""),e=i.includes(Yn)||i.includes(Zn);e||tn.forEach(function(n){(String(n).includes(Yn)||String(n).includes(Zn))&&(e=!0)}),e&&(hn(),mn(new Set),gn([]),xn.current=[])}U(function(i){var e;return n(n({},i),((e={})[A]=!i[A],e))})}},sx:{mt:0,boxShadow:"none",border:Rn?"1px dashed #E2E8F0":"1px solid #EEF2F7",borderRadius:"4px !important",bgcolor:"#FFFFFF",minWidth:0,"&:before":{display:"none"}}},{children:[i(r,n({expandIcon:Rn?null:i(c,{size:14}),sx:{minHeight:"32px","& .MuiAccordionSummary-content":{my:.5,display:"grid",alignItems:"center",minWidth:0,width:"100%"}}},{children:i(a,n({component:"div",sx:{fontSize:"11px",fontWeight:600,color:Rn?"#94A3B8":"#19213D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0}},{children:En||"Untitled Subsection"}))})),!Rn&&e(u,n({sx:{pt:0,pb:1,minWidth:0}},{children:[Mn&&i(s,{content:Nn,overlayContent:Bn,sxStyles:un,deviationBadges:_i,maintainRelativeOrder:q,highlightBg:gi,suppressHighlightBg:On,highlights:ki,collisionKey:_n}),(j.subsections||[]).map(function(n,e){return i(k,{section:n,keyPath:"".concat(A,"-").concat(e),depth:W+1,columnKey:T,parentNodeId:D,sectionOffset:G,rhsOrphanVisualIndexes:H},"".concat(A,"-").concat(e))})]}))]}))}))}):n({ref:An,sx:{mt:0===W?1:.75,width:"100%",minWidth:0,position:"relative"}},{children:!Rn&&e(l,n({sx:n({width:"100%"},Oi)},{children:[Mn&&i(s,{content:Nn,overlayContent:Bn,sxStyles:un,deviationBadges:_i,maintainRelativeOrder:q,highlightBg:gi,suppressHighlightBg:On,highlights:ki,collisionKey:_n}),(j.subsections||[]).map(function(n,e){return i(k,{section:n,keyPath:"".concat(A,"-").concat(e),depth:W+1,columnKey:T,parentNodeId:D,sectionOffset:G,rhsOrphanVisualIndexes:H},"".concat(A,"-").concat(e))})]}))}))});export{k as default};
|
|
1
|
+
import{__spreadArray as n,__assign as i}from"tslib";import{jsx as e,jsxs as t}from"react/jsx-runtime";import o,{useMemo as l}from"react";import{Box as d,Accordion as r,AccordionSummary as a,Typography as u,AccordionDetails as c}from"@mui/material";import{ChevronDown as s}from"lucide-react";import{MemoizedMarkdown as v}from"../hooks/memoizedMarkdown.js";import{useCompareContext as f}from"../CompareContext.js";import{hasValue as p,hasMeaningfulRedlineTags as h,safeStringify as m,stripRedlineTags as g,hasSingleMappedLhsSection as x,getLhsDeviationDisplayIndexes as y,generateColorPalette as S,DEVIATION_BADGE_SEPARATOR as b,isMissingStr as I,findTextMatchRange as _,getRhsMappedSectionNumber as k}from"../CognitiveComparehelpers.js";import{DEFAULT_DEVIAION_COLOR as w}from"../CognitiveCompareConstants.js";import{normalizeRedlineMarkdown as C}from"../utils/normalizeRedlineMarkdown.js";var N=o.memo(function(o){var F,M,O,P,B,R,E,j,A,K,W=o.section,L=o.keyPath,T=o.depth,z=void 0===T?0:T,D=o.columnKey,G=void 0===D?"left":D,H=o.parentNodeId,V=void 0===H?"":H,X=o.sectionOffset,U=o.rhsOrphanVisualIndexes,q=f(),J=q.expandedSubSections,Q=q.setExpandedSubSections,Y=q.maintainRelativeOrder,Z=q.showDeviationBadges,$=void 0!==Z&&Z,nn=q.proposedSections,en=q.existingSections,tn=q.treeData,on=q.deviationNumberRegistry,ln=q.deviationParentRegistry,dn=q.connectedSections,rn=q.activeSideBySideSection,an=q.isSideBySide,un=q.scrollSyncLocked,cn=q.toggleScrollSyncLocked,sn=q.summaryPopupAnchorEl,vn=q.resolvedMarkdownStyles,fn=q.getSubSectionRef,pn=q.getSubSectionCompareStyle,hn=q.getBadgeRef,mn=q.openMoreFunctionsPopup,gn=q.openSummaryPopup,xn=q.resetSideBySide,yn=q.setConnectedSections,Sn=q.setConnectedLines,bn=q.cachedConnectedPositions,In=q.isProposingFix,_n=q.proposingFixNodeId,kn=q.isRedlineFlow,wn=q.unifiedNumbering,Cn=null!=rn?rn:"",Nn=(null===(F=W.displayTitle)||void 0===F||F)&&p(W.title),Fn=!(!In||!_n||"left"!==G||W.id!==_n&&W.nodeId!==_n&&W.contentId!==_n),Mn=h(W.content),On="boolean"==typeof kn?kn:Mn,Pn=Mn,Bn=W.change_history,Rn=On&&Mn,En=l(function(){return Rn?C(m(W.content)):m(W.content)},[W.content,Rn]),jn=Rn?g(En):W.content,An=Rn?En:void 0,Kn=Mn&&p(Bn)?m(Bn):void 0,Wn=(null===(M=W.displayContent)||void 0===M||M||Mn)&&p(W.content),Ln=!Nn&&!Wn,Tn=Nn?W.title:Wn?"No Title Found":"No Matching Section Found",zn=!!J[L],Dn=fn(G,L),Gn=L.split("-").map(Number)[0],Hn=nn[Gn],Vn=en[Gn],Xn=Gn,Un=Gn,qn=!1,Jn=function(n,i,e){if(!n||!i)return null;if(n.id===i||n.nodeId===i||n.contentId===i)return{section:n,keyPath:e};for(var t=(n.subsections||[]).map(function(n,i){return{section:n,keyPath:"".concat(e,"-").concat(i)}}),o=function(){var n=t.shift();return(null==n?void 0:n.section)?n.section.id===i||n.section.nodeId===i||n.section.contentId===i?{value:n}:void(n.section.subsections||[]).forEach(function(i,e){t.push({section:i,keyPath:"".concat(n.keyPath,"-").concat(e)})}):"continue"};t.length>0;){var l=o();if("object"==typeof l)return l.value}return null};if(Y)if("left"===G){var Qn=null===(O=null==Hn?void 0:Hn.refIndexes)||void 0===O?void 0:O[0],Yn=en.findIndex(function(n){return n.selfIndex===Qn});-1!==Yn?(Vn=en[Yn],Un=Yn):qn=!0}else{var Zn=null===(P=null==Vn?void 0:Vn.refIndexes)||void 0===P?void 0:P[0],$n=nn.findIndex(function(n){return n.selfIndex===Zn});-1!==$n?(Hn=nn[$n],Xn=$n):qn=!0}var ni=function(n,i){if(!i||!n)return null;for(var e=0;e<n.length;e++){var t=Jn(n[e],i,String(e));if(t)return t}return null},ii=null,ei=null,ti="",oi="";if(Y)"left"===G?(ii=W,ti=L,(li=Jn(Vn,W.nodeId||W.id,String(Un)))||(li=ni(en,W.nodeId||W.id)),ei=(null==li?void 0:li.section)||null,oi=(null==li?void 0:li.keyPath)||""):(ei=W,oi=L,(di=Jn(Hn,W.nodeId||W.id,String(Xn)))||(di=ni(nn,W.nodeId||W.id)),ii=(null==di?void 0:di.section)||null,ti=(null==di?void 0:di.keyPath)||"");else if("left"===G){ii=W,ti=L;var li=ni(en,W.nodeId||W.id);ei=(null==li?void 0:li.section)||null,oi=(null==li?void 0:li.keyPath)||""}else{ei=W,oi=L;var di=ni(nn,W.nodeId||W.id);ii=(null==di?void 0:di.section)||null,ti=(null==di?void 0:di.keyPath)||""}var ri=(ti?pn(ti):null)||pn(L),ai=null===(B=null==tn?void 0:tn.input_index_map)||void 0===B?void 0:B[0],ui=null===(R=null==tn?void 0:tn.input_index_map)||void 0===R?void 0:R[1],ci="left"===G?ui:ai,si="left"===G?!ei:!ii,vi=Y&&"right"===G&&x(Vn,nn),fi=W.evaluationResult||(null==ii?void 0:ii.evaluationResult)||(null==ei?void 0:ei.evaluationResult),pi=(null==fi?void 0:fi.deviations)||{},hi=l(function(){return Y&&"right"===G?y(nn,ai,on):new Map},[Y,G,nn,ai,on]),mi=W.nodeId||W.id||(null==ii?void 0:ii.nodeId)||(null==ii?void 0:ii.id)||(null==ei?void 0:ei.nodeId)||(null==ei?void 0:ei.id);Y&&"left"!==G&&(null==ii?void 0:ii.id)&&(mi=ii.nodeId||ii.id);var gi=Object.keys(pi)[0],xi=gi?"".concat(mi).concat(b).concat(gi):null,yi=xi?null==ln?void 0:ln[xi]:null,Si=Gn+1;if(Y&&wn){var bi="left"===G?wn.leftNums.get(null==Hn?void 0:Hn.id):wn.rightNums.get(null==Vn?void 0:Vn.id);qn&&void 0!==bi?Si=bi:null!=yi&&yi>=0?Si=yi:void 0!==bi&&(Si=bi)}else null!=yi&&yi>=0&&(Si=yi);var Ii=null!==(A=null===(j=null===(E=null==fi?void 0:fi.evaluation_outputs)||void 0===E?void 0:E.metadata)||void 0===j?void 0:j.label_color)&&void 0!==A?A:w,_i=S(Ii).highlightBg,ki=Math.max.apply(Math,n([0],Object.keys(pi).map(function(n){return on["".concat(mi).concat(b).concat(n)]}).filter(function(n){return"number"==typeof n&&Number.isFinite(n)}),!1))+1,wi=Object.entries(pi).map(function(n){var i,e=n[0],t=n[1],o="".concat(mi).concat(b).concat(e);return{deviationKey:e,deviationMap:t,refId:o,currentIndex:null!==(i=on[o])&&void 0!==i?i:ki++}});wi.sort(function(n,i){return n.currentIndex-i.currentIndex});var Ci=new Map;if(!U&&Y&&"right"===G){var Ni=m(jn||"").replace(/\\n/g,"\n");wi.filter(function(n){var i=n.deviationMap,e=i[V];return(si||I(i[ci]))&&!!e&&!I(e)}).map(function(n){var e,t,o=m(n.deviationMap[V]||"").replace(/\\n/g,"\n"),l=o&&null!==(t=null===(e=_(Ni,o))||void 0===e?void 0:e.start)&&void 0!==t?t:-1;return i(i({},n),{position:l})}).sort(function(n,i){return(-1===n.position?Number.MAX_SAFE_INTEGER:n.position)-(-1===i.position?Number.MAX_SAFE_INTEGER:i.position)||n.currentIndex-i.currentIndex}).forEach(function(n,i){Ci.set(n.refId,i+1)})}var Fi=wi.map(function(n){var e,t,o,l,d=n.deviationKey,r=n.deviationMap,a=n.refId,u=n.currentIndex,c=r[V],s=I(c);if(s)c="";else if(!c)return null;var v=r[ci],f=si||I(v),p=null!==(e=null==U?void 0:U.get(a))&&void 0!==e?e:Ci.get(a),h=hi.get(a);Y&&"right"===G&&f&&void 0!==p?u=p:Y&&"right"===G&&!f&&void 0!==h?u=h:Y&&void 0!==X&&("right"!==G||f||vi)&&(u-=X),u=Math.max(1,u);var m=Y&&"right"===G&&f&&wn?k({section:Vn,proposedSections:nn,leftNums:wn.leftNums,fallbackNumber:String(Si),firstOnly:!0}):Si,g="".concat(m,".").concat(u),x="".concat(mi).concat(b).concat(d).concat(b).concat(ti).concat(b).concat(oi),y=(null==r?void 0:r.evaluation_outputs)||(null==fi?void 0:fi.evaluation_outputs),_=null!==(t=null==y?void 0:y.output_value)&&void 0!==t?t:null,w=null!==(l=null===(o=null==y?void 0:y.metadata)||void 0===o?void 0:o.label_color)&&void 0!==l?l:Ii,C=S(w),N=i({},C),F=(null==r?void 0:r.deviation_summary)?{deviation_summary:r.deviation_summary||(null==fi?void 0:fi.deviation_summary),deviation_title:(null==r?void 0:r.deviation_title)||(null==fi?void 0:fi.deviation_title),deviation_impact:(null==r?void 0:r.deviation_impact)||(null==fi?void 0:fi.deviation_impact),deviation_explanation:(null==r?void 0:r.deviation_explanation)||(null==fi?void 0:fi.deviation_explanation),evaluation_outputs:y,cognitive_decisioning:(null==r?void 0:r.cognitive_decisioning)||(null==fi?void 0:fi.cognitive_decisioning)}:null,M=0,O=jn||"";if(c&&O){var P=O.split(/\n{2,}/),B=P.findIndex(function(n){return n.includes(c)});if(-1!==B){var R=Object.entries(pi).filter(function(n){n[0];var i=n[1][V];return i&&P[B].includes(i)}).sort(function(n,i){return P[B].indexOf(n[1][V])-P[B].indexOf(i[1][V])}),E=R.filter(function(n){n[0];var i=n[1][V];return i&&(i.includes(c)||c.includes(i))});E.length>1&&(M=Math.max(0,E.findIndex(function(n){return n[0]===d})))}}var j=hn(G,a);return{id:a,actionId:x,label:g,highlight:c,side:G,style:N,stackIndex:M,score:_,isConnected:dn.has(x),showScrollLockToggle:dn.has(x)||an&&rn===x||!!sn&&sn===j.current,scrollSyncLocked:un,toggleScrollSyncLocked:cn,isOrphan:f,isMissingClause:s,badgeRef:j,onClick:function(n){n.stopPropagation();var e=ti&&nn[Number(ti.split("-")[0])]||Hn,t=oi&&en[Number(oi.split("-")[0])]||Vn,o=ii?i(i({},ii),{title:(null==e?void 0:e.title)||(null==ii?void 0:ii.title)||""}):{id:"orphan-left",title:"",content:""},l=ei?i(i({},ei),{title:(null==t?void 0:t.title)||(null==ei?void 0:ei.title)||""}):{id:"orphan-right",title:"",content:""};mn(n,o,f,l,x,N)},onSummaryClick:function(n){n.stopPropagation(),gn(n,x,f,F)}}}).filter(Boolean).sort(function(n,i){return parseFloat(n.label)-parseFloat(i.label)}),Mi=l(function(){var n=new Set;return Fi.filter(function(i){return!n.has(i.id)&&(n.add(i.id),!0)})},[Fi]),Oi=$||Fn?Mi:[],Pi=Mi.map(function(n){return n.highlight}).filter(Boolean),Bi=Fi.find(function(n){return dn.has(n.actionId)}),Ri=!!Bi;if(!(Nn||Wn||W.subsections&&0!==W.subsections.length))return null;var Ei=(null===(K=null==Bi?void 0:Bi.style)||void 0===K?void 0:K.badgeBorder)||(null==ri?void 0:ri.badgeBorder),ji=Ri&&Ei?{borderRadius:"4px",outline:"2px solid ".concat(Ei),outlineOffset:"1px"}:{};return e(d,Nn?i({ref:Dn,sx:{mt:1,width:"100%",minWidth:0,position:"relative"}},{children:e(d,i({sx:i({width:"100%"},ji)},{children:t(r,i({disableGutters:!0,expanded:!Ln&&zn,onChange:function(){if(!Ln){if(zn){var n=String(rn||""),e=n.includes(ti)||n.includes(oi);e||dn.forEach(function(n){(String(n).includes(ti)||String(n).includes(oi))&&(e=!0)}),e&&(xn(),yn(new Set),Sn([]),bn.current=[])}Q(function(n){var e;return i(i({},n),((e={})[L]=!n[L],e))})}},sx:{mt:0,boxShadow:"none",border:Ln?"1px dashed #E2E8F0":"1px solid #EEF2F7",borderRadius:"4px !important",bgcolor:"#FFFFFF",minWidth:0,"&:before":{display:"none"}}},{children:[e(a,i({expandIcon:Ln?null:e(s,{size:14}),sx:{minHeight:"32px","& .MuiAccordionSummary-content":{my:.5,display:"grid",alignItems:"center",minWidth:0,width:"100%"}}},{children:e(u,i({component:"div",sx:{fontSize:"11px",fontWeight:600,color:Ln?"#94A3B8":"#19213D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0}},{children:Tn||"Untitled Subsection"}))})),!Ln&&t(c,i({sx:{pt:0,pb:1,minWidth:0}},{children:[Wn&&e(v,{content:jn,overlayContent:An,fallbackContent:Kn,sxStyles:vn,deviationBadges:Oi,maintainRelativeOrder:Y,highlightBg:_i,suppressHighlightBg:Pn,highlights:Pi,collisionKey:Cn}),(W.subsections||[]).map(function(n,i){return e(N,{section:n,keyPath:"".concat(L,"-").concat(i),depth:z+1,columnKey:G,parentNodeId:V,sectionOffset:X,rhsOrphanVisualIndexes:U},"".concat(L,"-").concat(i))})]}))]}))}))}):i({ref:Dn,sx:{mt:0===z?1:.75,width:"100%",minWidth:0,position:"relative"}},{children:!Ln&&t(d,i({sx:i({width:"100%"},ji)},{children:[Wn&&e(v,{content:jn,overlayContent:An,fallbackContent:Kn,sxStyles:vn,deviationBadges:Oi,maintainRelativeOrder:Y,highlightBg:_i,suppressHighlightBg:Pn,highlights:Pi,collisionKey:Cn}),(W.subsections||[]).map(function(n,i){return e(N,{section:n,keyPath:"".concat(L,"-").concat(i),depth:z+1,columnKey:G,parentNodeId:V,sectionOffset:X,rhsOrphanVisualIndexes:U},"".concat(L,"-").concat(i))})]}))}))});export{N as default};
|
|
2
2
|
//# sourceMappingURL=SubSectionAccordion.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as n,__rest as e}from"tslib";import{jsx as t,jsxs as r,Fragment as i}from"react/jsx-runtime";import{Box as o,Typography as a}from"@mui/material";import l,{useRef as d,useMemo as c,useLayoutEffect as s}from"react";import{DEFAULT_DEVIAION_COLOR as u}from"../CognitiveCompareConstants.js";import{EllipsisVertical as h}from"lucide-react";import p from"react-markdown";import{mixHexColors as g,areMarkdownPropsEqual as f}from"../CognitiveComparehelpers.js";import v from"rehype-raw";import m from"remark-gfm";var b=function(n){return"function"==typeof n?n:(null==n?void 0:n.default)||n},x=[b(m)],y=[b(v)],w=l.memo(function(f){var v=f.content,m=f.overlayContent,b=f.sxStyles,w=f.deviationBadges,E=void 0===w?[]:w,S=f.highlights,k=void 0===S?[]:S;f.maintainRelativeOrder;var C=f.highlightBg,B=f.suppressHighlightBg,F=void 0!==B&&B,z=f.collisionKey,A=d(null),T=!!m,W=c(function(){return E.reduce(function(e,t){var r;return n(n({},e),((r={})[t.id]=t,r))},{})},[E]),O=d({badgeMap:W,highlightBg:C,hideHighlightBg:T,suppressHighlightBg:F});O.current={badgeMap:W,highlightBg:C,hideHighlightBg:T,suppressHighlightBg:F};var I=function(e,t){return l.Children.map(e,function(e){var r;if(!l.isValidElement(e))return e;var i=(null===(r=e.props)||void 0===r?void 0:r.children)?I(e.props.children,t):e.props.children,o=l.cloneElement(e,n(n({},e.props),{children:i}));return t(o)})},M=c(function(){return{mark:function(r){var i,o,a,l,d=r.children,c=e(r,["children"]),s=O.current,u=s.badgeMap,h=s.highlightBg,p=s.hideHighlightBg,g=s.suppressHighlightBg,f=c["data-badge-id"],v=f?u[f]:null,m=c["data-highlight-color"],b=null!==(l=null!==(o=null!=m?m:null===(i=null==v?void 0:v.style)||void 0===i?void 0:i.highlightBg)&&void 0!==o?o:null===(a=null==v?void 0:v.style)||void 0===a?void 0:a.badgeBg)&&void 0!==l?l:h,x="true"===c["data-is-suggested-deviation-fix"]||g;return t("span",n({style:n(n(n({},x?{}:{backgroundColor:b}),{borderRadius:"2px",display:"inline",boxDecorationBreak:"clone",WebkitBoxDecorationBreak:"clone",backgroundClip:"padding-box",padding:"0 1px"}),p?{color:"transparent"}:{})},{children:d}))},span:function(i){var a,l,d,c,s,p,g=i.children,f=e(i,["children"]),v=O.current.badgeMap,m=f["data-badge-id"];if(!m)return t("span",n({},f,{children:g}));var b=v[m];if(!b)return t("span",n({},f,{children:g}));var x="number"==typeof b.stackIndex?b.stackIndex:0,y="translateY(calc(-20% + ".concat(12*x,"px + var(--badge-nudge, 0px)))");return r(o,n({component:"span",sx:{position:"static",display:"inline"}},{children:[r(o,n({ref:b.badgeRef,className:"deviation-badge","data-side":b.side||"right",sx:n(n({fontStyle:"normal",position:"absolute",zIndex:30+x,display:"inline-flex",alignItems:"stretch",fontSize:"10px",bgcolor:(null===(a=b.style)||void 0===a?void 0:a.badgeBg)||"#EEF2FF",color:(null===(l=b.style)||void 0===l?void 0:l.badgeText)||u,border:"1px solid ".concat((null===(d=b.style)||void 0===d?void 0:d.badgeBorder)||"#C7D2FE"),borderRadius:"12px",fontWeight:600,whiteSpace:"nowrap",boxShadow:"0 1px 3px rgba(0,0,0,0.07)",overflow:"hidden",transition:"none"},"left"===b.side?{right:"-16px",transform:"".concat(y," translateX(calc(100% + 8px))")}:{left:"-16px",transform:"".concat(y," translateX(calc(-100% - 8px))")}),b.isConnected&&b.style&&{outline:"2px solid ".concat(b.style.badgeBorder),outlineOffset:"1px"})},{children:[r(o,n({onClick:function(n){n.stopPropagation(),b.onSummaryClick&&b.onSummaryClick(n)},sx:{display:"flex",alignItems:"center",px:1,py:.3,cursor:"pointer","&:hover":{bgcolor:"rgba(0,0,0,0.04)"}}},{children:[t(o,n({component:"span",sx:{fontSize:"10px",fontWeight:700}},{children:b.label})),("left"===b.side||b.isOrphan)&&t(o,n({component:"span",sx:{fontSize:"10px",pl:.5,ml:.5,borderLeft:"1px solid ".concat((null===(c=b.style)||void 0===c?void 0:c.badgeBorder)||"#C7D2FE")}},{children:null!=b.score&&"N/A"!==b.score&&"NA"!==b.score&&0!==b.score?"".concat(b.score):"N/A"===b.score||"NA"===b.score?"N/A":"Same"}))]})),("left"===b.side||b.isOrphan)&&t(o,n({onClick:function(n){n.stopPropagation(),b.onClick&&b.onClick(n)},sx:{display:"flex",alignItems:"center",px:.5,borderLeft:"1px solid ".concat((null===(s=b.style)||void 0===s?void 0:s.badgeBorder)||"#C7D2FE"),cursor:"pointer","&:hover":{bgcolor:"rgba(0,0,0,0.06)"}}},{children:t(h,{size:12,color:(null===(p=b.style)||void 0===p?void 0:p.badgeText)||"#3730A3"})}))]})),g]}))},table:function(e){var r=e.children;return t(o,n({sx:{display:"block",width:"100%",maxWidth:"100%",minWidth:0,boxSizing:"border-box",contain:"inline-size",overflowX:"auto",overflowY:"hidden",overscrollBehaviorX:"contain",WebkitOverflowScrolling:"touch",my:1}},{children:t(o,n({component:"table",sx:{width:"600px",minWidth:"600px",tableLayout:"fixed",borderCollapse:"collapse",fontSize:"inherit"}},{children:r}))}))},thead:function(e){var r=e.children;return t(o,n({component:"thead"},{children:r}))},tbody:function(e){var r=e.children;return t(o,n({component:"tbody"},{children:r}))},tr:function(e){var r=e.children;return t(o,n({component:"tr",sx:{borderBottom:"1px solid #E5E7EB"}},{children:r}))},th:function(e){var r=e.children;return t(o,n({component:"th",sx:{border:"1px solid #E5E7EB",padding:"8px",textAlign:"left",verticalAlign:"top",fontWeight:600,backgroundColor:"#F9FAFB",whiteSpace:"normal",wordBreak:"break-word",overflowWrap:"anywhere"}},{children:r}))},td:function(e){var r=e.children;return t(o,n({component:"td",sx:{border:"1px solid #E5E7EB",padding:"8px",verticalAlign:"top",whiteSpace:"normal",wordBreak:"break-word",overflowWrap:"anywhere"}},{children:r}))},code:function(e){var r=e.children;return t("span",n({style:{fontFamily:"inherit",fontSize:"inherit"}},{children:r}))},pre:function(e){var r=e.children;return t("span",n({style:{fontFamily:"inherit",fontSize:"inherit",display:"block",whiteSpace:"pre-wrap"}},{children:r}))},updated:function(n){var e=n.children;return t(i,{children:e})},deleted:function(e){var r=e.children,i=I(r,function(n){return l.cloneElement(n,{"data-is-suggested-deviation-fix":"true"})});return t("span",n({style:{boxShadow:"inset 0 1px 0 #EF4444, inset 0 -1px 0 #EF4444",backgroundColor:"#FCCCCC",textDecoration:"line-through"}},{children:i}))},changed:function(e){var r=e.children,i=I(r,function(n){return l.cloneElement(n,{"data-is-suggested-deviation-fix":"true"})});return t("span",n({style:{boxShadow:"inset 0 1px 0 #2F59FF, inset 0 -1px 0 #2F59FF",backgroundColor:"#D5E8FF"}},{children:i}))},ul:function(r){var i=r.children,a=e(r,["children"]);return t(o,n({component:"ul",sx:{mt:1,mb:1,pl:3,listStyleType:"disc"}},a,{children:i}))},ol:function(r){var i=r.children,a=e(r,["children"]);return t(o,n({component:"ol",sx:{mt:1,mb:1,pl:3,listStyleType:"decimal"}},a,{children:i}))},li:function(r){var i=r.children,a=e(r,["children"]);return t(o,n({component:"li",sx:{mb:.5,display:"list-item"}},a,{children:i}))}}},[]),$=function(n){if(!n||"string"!=typeof n)return"";var e=n,t=(e=(e=(e=(e=(e=(e=(e=(e=e.replace(/((?:<\/?[a-z]+[^>]*>\s*)+)([*+\-] |\d+\. )/gi,"$2$1")).replace(/\\(['"])/g,"$1").replace(/\\n/g,"\n").replace(/\\\./g,".").replace(/\r\n/g,"\n")).replace(/^(\d+\.)(\s{2,})/gm,function(n,e,t){return"".concat(e.slice(0,-1),"\\.").concat(t)})).replace(/^(\d+\.)\s*\n+(\s+)(\S)/gm,function(n,e,t,r){return"".concat(e," ").concat(r)})).replace(/([^\n])\n(#{1,6} )/g,"$1\n\n$2")).replace(/([^\n])\n([ \t]*(?:[#*+\-] |\d+\. ))/g,"$1\n\n$2")).replace(/\n{3,}/g,"\n\n")).replace(/^[ \t]+(?![ \t]*([\*\-\+] |\d+\. ))/gm,function(n){return n.replace(/ /g," ").replace(/\t/g," ")})).split(/(\n{2,})/);return(e=t.map(function(n){return/^\n+$/.test(n)||/\|.*\|/.test(n)&&/\|[\s:|-]+\|/.test(n)||/^#{1,6} /.test(n.trimStart())?n:n.replace(/\n(?=[^\n])/g,function(e,t){var r=n.slice(t+1);return/^[ \t]*([#>|\-*+]|\d+\.)/.test(r)?"\n":" "})}).join("")).trim()},j=function(n){return n.replace(/[\.,;:]/g," ")},P=c(function(){return E.map(function(n){return{id:n.id,connected:n.isConnected,stackIndex:n.stackIndex,size:n.size}})},[E]),D=c(function(){var e=$(v||""),t=F?j(e):e,r=(E||[]).map(function(n){var e,t;return{id:null==n?void 0:n.id,highlight:$((null==n?void 0:n.highlight)||""),highlightColor:(null===(e=null==n?void 0:n.style)||void 0===e?void 0:e.highlightBg)||(null===(t=null==n?void 0:n.style)||void 0===t?void 0:t.badgeBg)||C}}).filter(function(n){return n.id&&n.highlight}),i={};r.forEach(function(n){i[n.highlight]||(i[n.highlight]=[]),i[n.highlight].push(n)});var o=function(n,e,t,r){void 0===e&&(e=""),void 0===r&&(r=[]);var i=!1,o=function(n){var o=function(n,e,t){var r,i,o;void 0===e&&(e="");var a=n.match(/^(\s*)([\s\S]*?)(\s*)$/);if(!a)return n;var l=null!==(r=a[1])&&void 0!==r?r:"",d=null!==(i=a[2])&&void 0!==i?i:"",c=null!==(o=a[3])&&void 0!==o?o:"";return d?l+function(n,e){void 0===n&&(n="");var t=e?' data-highlight-color="'.concat(e,'"'):"",r=n?' data-badge-id="'.concat(n,'"'):"";return"<mark".concat(r).concat(t,">")}(e,t)+d+"</mark>"+c:n}(n,e,t),a=o;if(!i&&r.length>0){i=!0;var l="",d="";r.forEach(function(n){l+=function(n){return'<span data-badge-id="'.concat(n,'">')}(n.id),d="</span>"+d}),a=l+o+d}return""+a};return n.split(/(\n+)/).map(function(n){return/^\n+$/.test(n)?n:n.trim()?""===n.replace(/[|:\-\s]/g,"")&&n.includes("-")?n:n.includes("|")?n.split(/(\|)/).map(function(n){return"|"!==n&&n.trim()?o(n):n}).join(""):o(n):n}).join("")},a=[];Object.entries(i).forEach(function(n){var r=n[0],i=n[1],o=e.indexOf(r),l=!1;if(-1===o&&F){var d=j(r);-1!==(o=t.indexOf(d))&&(l=!0)}if(-1!==o){for(var c=i[0].highlightColor,s=1;s<i.length;s++)c=g(c,i[s].highlightColor||"");a.push({highlight:r,start:o,end:o+r.length,badges:i,color:c,usedLooseMatch:l})}});var l=new Set(Object.keys(i));(k||[]).forEach(function(n){if(n){var r=$(n);if(r&&!l.has(r)){var i=e.indexOf(r),o=!1;if(-1===i&&F){var d=j(r);-1!==(i=t.indexOf(d))&&(o=!0)}if(-1!==i){var c=e.slice(0,i);(c.match(/</g)||[]).length===(c.match(/>/g)||[]).length&&a.push({highlight:r,start:i,end:i+r.length,badges:[],color:C||"",usedLooseMatch:o})}}}}),a.sort(function(n,e){return n.start-e.start||e.end-n.end});var d=[],c={};a.forEach(function(n,e){for(var t=n.start,r=n.end,i=0,o=d;i<o.length;i++){var a=o[i],l=a.start,s=a.end,u=t<s&&r>s&&t>=l,h=t<l&&r>l&&r<=s;if(t>=l&&r<=s){n.orphaned=!0,c[e]=a.matchIdx;break}u&&(t=s),h&&(r=l)}n.trimmedStart=t,n.trimmedEnd=r,!n.orphaned&&t<r&&d.push({start:t,end:r,matchIdx:e})});var s={};Object.entries(c).forEach(function(n){var e=n[0],t=n[1],r=Number(e);s[t]||(s[t]=[]),s[t].push(r)});var u=a.map(function(e,t){return n(n({},e),{idx:t})}).filter(function(n){return!n.orphaned}).sort(function(n,e){var t,r;return(null!==(t=e.trimmedStart)&&void 0!==t?t:e.start)-(null!==(r=n.trimmedStart)&&void 0!==r?r:n.start)});return u.forEach(function(n){var t,r,i,l,d=null!==(t=n.trimmedStart)&&void 0!==t?t:n.start,c=null!==(r=n.trimmedEnd)&&void 0!==r?r:n.end;if(!(d>=c)){var u=e.slice(d,c),h=function(n,e,t,r){if(!t.length)return n;var i=t.map(function(n){return a[n]}).sort(function(n,e){return n.start-e.start}),l="",d=0;return i.forEach(function(t){var i,a,c=Math.max(d,t.start-e),s=Math.max(c,t.end-e);if(!(c>=s)){var u=g(r,t.color||"");l+=n.slice(d,c),l+=o(n.slice(c,s),(null===(a=null===(i=t.badges)||void 0===i?void 0:i[0])||void 0===a?void 0:a.id)||"",u,t.badges||[]),d=s}}),l+=n.slice(d)}(n.usedLooseMatch||d!==n.start||c!==n.end?u:n.highlight,n.start,s[n.idx]||[],n.color),p=o(h,(null===(l=null===(i=n.badges)||void 0===i?void 0:i[0])||void 0===l?void 0:l.id)||"",n.color,n.badges||[]);e=e.slice(0,d)+p+e.slice(c)}}),e},[v,E,k,C,F]),H=c(function(){return m?$(m||""):""},[m]),N=!!m,R={"& *":{fontFamily:"inherit"},"& code, & pre, & kbd, & samp":{fontFamily:"inherit !important",fontSize:"inherit",background:"none",padding:0,border:"none",whiteSpace:"pre-wrap"},"& p, & li, & ul, & ol":{position:"static",overflow:"visible",whiteSpace:"pre-wrap"}},L=n(n(n(n({},b),R),{position:"relative",width:"100%",maxWidth:"100%",minWidth:0,boxSizing:"border-box",overflow:"visible",whiteSpace:"normal",gridArea:"1 / 1",zIndex:2}),N?{color:"transparent",userSelect:"none",pointerEvents:"none","& .deviation-badge":{pointerEvents:"auto"},"& table":{visibility:"hidden",margin:"0 !important"},"& th, & td":{padding:"0 !important",border:"none !important",backgroundColor:"transparent !important"},"& tr":{border:"none !important"},"& p:empty":{display:"none"}}:{}),q=n(n(n({},b),R),{position:"relative",width:"100%",maxWidth:"100%",minWidth:0,boxSizing:"border-box",overflow:"visible",whiteSpace:"normal",gridArea:"1 / 1",zIndex:1,pointerEvents:"auto"});return s(function(){if(A.current){var n=function(){var n=Array.from(A.current.querySelectorAll(".deviation-badge"));if(0!==n.length){n.forEach(function(n){n.style.setProperty("--badge-nudge","0px")});var e=n.filter(function(n){return"left"===n.dataset.side}),t=n.filter(function(n){return"left"!==n.dataset.side}),r=A.current.getBoundingClientRect(),i=r.bottom-4,o=r.top+4,a=function(n){if(0!==n.length){var e=n.map(function(n){var e=n.getBoundingClientRect();return{el:n,naturalTop:e.top,height:e.height,currentTop:e.top}});e.sort(function(n,e){return n.naturalTop-e.naturalTop});var t=[],r=[];e.forEach(function(n){if(0===r.length)r.push(n);else{var e=r[r.length-1],i=e.currentTop+e.height;n.naturalTop<i+8?(n.currentTop=i+8,r.push(n)):(t.push(r),r=[n])}}),r.length>0&&t.push(r),t.forEach(function(n){var e=n[n.length-1],t=e.currentTop+e.height;if(t>i){var r=t-i,a=n[0].currentTop-o,l=Math.max(0,Math.min(r,a));n.forEach(function(n){n.currentTop-=l})}}),t.flat().forEach(function(n){var e=n.currentTop-n.naturalTop;n.el.style.setProperty("--badge-nudge","".concat(e,"px"))})}};a(e),a(t)}},e=requestAnimationFrame(function(){requestAnimationFrame(function(){n()})}),t=new ResizeObserver(function(){requestAnimationFrame(n)});return t.observe(A.current),function(){t.disconnect(),cancelAnimationFrame(e)}}},[D,z,P]),r(o,n({ref:A,sx:{position:"relative",display:"grid",gridTemplateColumns:"minmax(0, 1fr)",width:"100%",maxWidth:"100%",minWidth:0}},{children:[t(a,n({component:"div",sx:n(n({},L),{padding:"3px"})},{children:t(p,n({components:M,remarkPlugins:x,rehypePlugins:y},{children:D.replace(/#{3}/g,"")}))})),N&&t(a,n({component:"div",sx:q},{children:t(p,n({components:M,remarkPlugins:x,rehypePlugins:y},{children:H}))}))]}))},f);export{w as MemoizedMarkdown};
|
|
1
|
+
import{__assign as e,__rest as n}from"tslib";import{jsx as t,jsxs as r,Fragment as i}from"react/jsx-runtime";import{Box as o,Typography as a}from"@mui/material";import l,{useRef as c,useMemo as d,useLayoutEffect as s}from"react";import{DEFAULT_DEVIAION_COLOR as u}from"../CognitiveCompareConstants.js";import{EllipsisVertical as h}from"lucide-react";import p from"react-markdown";import{findRedlineTextAnchorRange as f,findTextMatchRange as g,mixHexColors as v,areMarkdownPropsEqual as m}from"../CognitiveComparehelpers.js";import b from"rehype-raw";import x from"remark-gfm";import{normalizeRedlineMarkdown as y}from"../utils/normalizeRedlineMarkdown.js";var S=function(e){return"function"==typeof e?e:(null==e?void 0:e.default)||e},E=[S(x)],k=[S(b)],C=l.memo(function(m){var b=m.content,x=m.overlayContent,S=m.fallbackContent,C=m.sxStyles,w=m.deviationBadges,B=void 0===w?[]:w,F=m.highlights,A=void 0===F?[]:F;m.maintainRelativeOrder;var z=m.highlightBg,T=m.suppressHighlightBg,W=void 0!==T&&T,I=m.collisionKey,M=c(null),j=!!x,q=d(function(){return B.reduce(function(n,t){var r;return e(e({},n),((r={})[t.id]=t,r))},{})},[B]),$=c({badgeMap:q,highlightBg:z,hideHighlightBg:j,suppressHighlightBg:W});$.current={badgeMap:q,highlightBg:z,hideHighlightBg:j,suppressHighlightBg:W};var H=function(n,t){return l.Children.map(n,function(n){var r;if(!l.isValidElement(n))return n;var i=(null===(r=n.props)||void 0===r?void 0:r.children)?H(n.props.children,t):n.props.children,o=l.cloneElement(n,e(e({},n.props),{children:i}));return t(o)})},O=d(function(){return{mark:function(r){var i,o,a,l,c=r.children,d=n(r,["children"]),s=$.current,u=s.badgeMap,h=s.highlightBg,p=s.hideHighlightBg,f=s.suppressHighlightBg,g=d["data-badge-id"],v=g?u[g]:null,m=d["data-highlight-color"],b=null!==(l=null!==(o=null!=m?m:null===(i=null==v?void 0:v.style)||void 0===i?void 0:i.highlightBg)&&void 0!==o?o:null===(a=null==v?void 0:v.style)||void 0===a?void 0:a.badgeBg)&&void 0!==l?l:h,x="true"===d["data-is-suggested-deviation-fix"]||f;return t("span",e({style:e(e(e({},x?{}:{backgroundColor:b}),{borderRadius:"2px",display:"inline",boxDecorationBreak:"clone",WebkitBoxDecorationBreak:"clone",backgroundClip:"padding-box",padding:"0 1px"}),p?{color:"transparent"}:{})},{children:c}))},span:function(i){var a,l,c,d,s,p,f=i.children,g=n(i,["children"]),v=$.current.badgeMap,m=g["data-badge-id"];if(!m)return t("span",e({},g,{children:f}));var b=v[m];if(!b)return t("span",e({},g,{children:f}));var x="number"==typeof b.stackIndex?b.stackIndex:0,y="translateY(calc(-20% + ".concat(12*x,"px + var(--badge-nudge, 0px)))");return r(o,e({component:"span",sx:{position:"static",display:"inline"}},{children:[r(o,e({ref:b.badgeRef,className:"deviation-badge","data-side":b.side||"right",sx:e(e({fontStyle:"normal",position:"absolute",zIndex:30+x,display:"inline-flex",alignItems:"stretch",fontSize:"10px",bgcolor:(null===(a=b.style)||void 0===a?void 0:a.badgeBg)||"#EEF2FF",color:(null===(l=b.style)||void 0===l?void 0:l.badgeText)||u,border:"1px solid ".concat((null===(c=b.style)||void 0===c?void 0:c.badgeBorder)||"#C7D2FE"),borderRadius:"12px",fontWeight:600,whiteSpace:"nowrap",boxShadow:"0 1px 3px rgba(0,0,0,0.07)",overflow:"hidden",transition:"none"},"left"===b.side?{right:"-16px",transform:"".concat(y," translateX(calc(100% + 8px))")}:{left:"-16px",transform:"".concat(y," translateX(calc(-100% - 8px))")}),b.isConnected&&b.style&&{outline:"2px solid ".concat(b.style.badgeBorder),outlineOffset:"1px"})},{children:[r(o,e({onClick:function(e){e.stopPropagation(),b.onSummaryClick&&b.onSummaryClick(e)},sx:{display:"flex",alignItems:"center",px:1,py:.3,cursor:"pointer","&:hover":{bgcolor:"rgba(0,0,0,0.04)"}}},{children:[t(o,e({component:"span",sx:{fontSize:"10px",fontWeight:700}},{children:b.label})),("left"===b.side||b.isOrphan)&&t(o,e({component:"span",sx:{fontSize:"10px",pl:.5,ml:.5,borderLeft:"1px solid ".concat((null===(d=b.style)||void 0===d?void 0:d.badgeBorder)||"#C7D2FE")}},{children:null!=b.score&&"N/A"!==b.score&&"NA"!==b.score&&0!==b.score?"".concat(b.score):"N/A"===b.score||"NA"===b.score?"N/A":"Same"}))]})),("left"===b.side||b.isOrphan)&&t(o,e({onClick:function(e){e.stopPropagation(),b.onClick&&b.onClick(e)},sx:{display:"flex",alignItems:"center",px:.5,borderLeft:"1px solid ".concat((null===(s=b.style)||void 0===s?void 0:s.badgeBorder)||"#C7D2FE"),cursor:"pointer","&:hover":{bgcolor:"rgba(0,0,0,0.06)"}}},{children:t(h,{size:12,color:(null===(p=b.style)||void 0===p?void 0:p.badgeText)||"#3730A3"})}))]})),f]}))},table:function(n){var r=n.children;return t(o,e({sx:{display:"block",width:"100%",maxWidth:"100%",minWidth:0,boxSizing:"border-box",contain:"inline-size",overflowX:"auto",overflowY:"hidden",overscrollBehaviorX:"contain",WebkitOverflowScrolling:"touch",my:1}},{children:t(o,e({component:"table",sx:{width:"600px",minWidth:"600px",tableLayout:"fixed",borderCollapse:"collapse",fontSize:"inherit"}},{children:r}))}))},thead:function(n){var r=n.children;return t(o,e({component:"thead"},{children:r}))},tbody:function(n){var r=n.children;return t(o,e({component:"tbody"},{children:r}))},tr:function(n){var r=n.children;return t(o,e({component:"tr",sx:{borderBottom:"1px solid #E5E7EB"}},{children:r}))},th:function(n){var r=n.children;return t(o,e({component:"th",sx:{border:"1px solid #E5E7EB",padding:"8px",textAlign:"left",verticalAlign:"top",fontWeight:600,backgroundColor:"#F9FAFB",whiteSpace:"normal",wordBreak:"break-word",overflowWrap:"anywhere"}},{children:r}))},td:function(n){var r=n.children;return t(o,e({component:"td",sx:{border:"1px solid #E5E7EB",padding:"8px",verticalAlign:"top",whiteSpace:"normal",wordBreak:"break-word",overflowWrap:"anywhere"}},{children:r}))},code:function(n){var r=n.children;return t("span",e({style:{fontFamily:"inherit",fontSize:"inherit"}},{children:r}))},pre:function(n){var r=n.children;return t("span",e({style:{fontFamily:"inherit",fontSize:"inherit",display:"block",whiteSpace:"pre-wrap"}},{children:r}))},updated:function(e){var n=e.children;return t(i,{children:n})},deleted:function(n){var r=n.children,i=H(r,function(e){return l.cloneElement(e,{"data-is-suggested-deviation-fix":"true"})});return t("span",e({style:{boxShadow:"inset 0 1px 0 #EF4444, inset 0 -1px 0 #EF4444",backgroundColor:"#FCCCCC",textDecoration:"line-through"}},{children:i}))},changed:function(n){var r=n.children,i=H(r,function(e){return l.cloneElement(e,{"data-is-suggested-deviation-fix":"true"})});return t("span",e({style:{boxShadow:"inset 0 1px 0 #2F59FF, inset 0 -1px 0 #2F59FF",backgroundColor:"#D5E8FF"}},{children:i}))},ul:function(r){var i=r.children,a=n(r,["children"]);return t(o,e({component:"ul",sx:{mt:1,mb:1,pl:3,listStyleType:"disc"}},a,{children:i}))},ol:function(r){var i=r.children,a=n(r,["children"]);return t(o,e({component:"ol",sx:{mt:1,mb:1,pl:3,listStyleType:"decimal"}},a,{children:i}))},li:function(r){var i=r.children,a=n(r,["children"]);return t(o,e({component:"li",sx:{mb:.5,display:"list-item"}},a,{children:i}))}}},[]),P=function(e){if(!e||"string"!=typeof e)return"";var n=e,t=(n=(n=(n=(n=(n=(n=(n=(n=n.replace(/((?:<\/?[a-z]+[^>]*>\s*)+)([*+\-] |\d+\. )/gi,"$2$1")).replace(/\\(['"])/g,"$1").replace(/\\n/g,"\n").replace(/\\\./g,".").replace(/\r\n/g,"\n")).replace(/^([ \t]*)(\d+\.)(\s{2,})/gm,function(e,n,t,r){return"".concat(n).concat(t.slice(0,-1),"\\.").concat(r)})).replace(/^(\d+\.)\s*\n+(\s+)(\S)/gm,function(e,n,t,r){return"".concat(n," ").concat(r)})).replace(/([^\n])\n(#{1,6} )/g,"$1\n\n$2")).replace(/([^\n])\n([ \t]*(?:[#*+\-] |\d+\. ))/g,"$1\n\n$2")).replace(/\n{3,}/g,"\n\n")).replace(/^[ \t]+(?![ \t]*([\*\-\+] |\d+\. ))/gm,function(e){return e.replace(/ /g," ").replace(/\t/g," ")})).split(/(\n{2,})/);return(n=t.map(function(e){return/^\n+$/.test(e)||/\|.*\|/.test(e)&&/\|[\s:|-]+\|/.test(e)||/^#{1,6} /.test(e.trimStart())?e:e.replace(/\n(?=[^\n])/g,function(n,t){var r=e.slice(t+1);return/^[ \t]*([#>|\-*+]|\d+\.)/.test(r)?"\n":" "})}).join("")).trim()},R=d(function(){return B.map(function(e){return{id:e.id,connected:e.isConnected,stackIndex:e.stackIndex,size:e.size}})},[B]),D=function(e){return P(y(e||""))},N=d(function(){var n=P(y(b||"")),t=S?P(y(S)):"",r=(B||[]).map(function(e){var n,t;return{id:null==e?void 0:e.id,highlight:D((null==e?void 0:e.highlight)||""),highlightColor:(null===(n=null==e?void 0:e.style)||void 0===n?void 0:n.highlightBg)||(null===(t=null==e?void 0:e.style)||void 0===t?void 0:t.badgeBg)||z}}).filter(function(e){return e.id&&e.highlight});if(t&&r.length>0){var i=function(e,n){return W?f(e,n):g(e,n,!1)},o=r.some(function(e){var t=e.highlight;return!i(n,t)}),a=r.every(function(e){var n=e.highlight;return!!i(t,n)});o&&a&&(n=t)}var l={};r.forEach(function(e){l[e.highlight]||(l[e.highlight]=[]),l[e.highlight].push(e)});var c=function(e,n,t,r){void 0===n&&(n=""),void 0===r&&(r=[]);var i=!1,o=function(e){var o=function(e,n,t){var r,i,o;void 0===n&&(n="");var a=e.match(/^(\s*)([\s\S]*?)(\s*)$/);if(!a)return e;var l=null!==(r=a[1])&&void 0!==r?r:"",c=null!==(i=a[2])&&void 0!==i?i:"",d=null!==(o=a[3])&&void 0!==o?o:"";return c?l+function(e,n){void 0===e&&(e="");var t=n?' data-highlight-color="'.concat(n,'"'):"",r=e?' data-badge-id="'.concat(e,'"'):"";return"<mark".concat(r).concat(t,">")}(n,t)+c+"</mark>"+d:e}(e,n,t),a=o;if(!i&&r.length>0){i=!0;var l="",c="";r.forEach(function(e){l+=function(e){return'<span data-badge-id="'.concat(e,'">')}(e.id),c="</span>"+c}),a=l+o+c}return""+a};return e.split(/(\n+)/).map(function(e){return/^\n+$/.test(e)?e:e.trim()?""===e.replace(/[|:\-\s]/g,"")&&e.includes("-")?e:e.includes("|")?e.split(/(\|)/).map(function(e){return"|"!==e&&e.trim()?o(e):e}).join(""):o(e):e}).join("")},d=[];Object.entries(l).forEach(function(e){var t=e[0],r=e[1],i=W?f(n,t):g(n,t,!1);if(i){for(var o=n.slice(i.start,i.end)!==t,a=r[0].highlightColor,l=1;l<r.length;l++)a=v(a,r[l].highlightColor||"");d.push({highlight:t,start:i.start,end:i.end,badges:r,color:a,usedLooseMatch:o})}});var s=new Set(Object.keys(l));(A||[]).forEach(function(e){if(e){var t=D(e);if(t&&!s.has(t)){var r=W?f(n,t):g(n,t,!1);if(r){var i=n.slice(r.start,r.end)!==t,o=n.slice(0,r.start);(o.match(/</g)||[]).length===(o.match(/>/g)||[]).length&&d.push({highlight:t,start:r.start,end:r.end,badges:[],color:z||"",usedLooseMatch:i})}}}}),d.sort(function(e,n){return e.start-n.start||n.end-e.end});var u=[],h={};d.forEach(function(e,n){for(var t=e.start,r=e.end,i=0,o=u;i<o.length;i++){var a=o[i],l=a.start,c=a.end,d=t<c&&r>c&&t>=l,s=t<l&&r>l&&r<=c;if(t>=l&&r<=c){e.orphaned=!0,h[n]=a.matchIdx;break}d&&(t=c),s&&(r=l)}e.trimmedStart=t,e.trimmedEnd=r,!e.orphaned&&t<r&&u.push({start:t,end:r,matchIdx:n})});var p={};Object.entries(h).forEach(function(e){var n=e[0],t=e[1],r=Number(n);p[t]||(p[t]=[]),p[t].push(r)});var m=d.map(function(n,t){return e(e({},n),{idx:t})}).filter(function(e){return!e.orphaned}).sort(function(e,n){var t,r;return(null!==(t=n.trimmedStart)&&void 0!==t?t:n.start)-(null!==(r=e.trimmedStart)&&void 0!==r?r:e.start)});return m.forEach(function(e){var t,r,i,o,a=null!==(t=e.trimmedStart)&&void 0!==t?t:e.start,l=null!==(r=e.trimmedEnd)&&void 0!==r?r:e.end;if(!(a>=l)){var s=n.slice(a,l),u=function(e,n,t,r){if(!t.length)return e;var i=t.map(function(e){return d[e]}).sort(function(e,n){return e.start-n.start}),o="",a=0;return i.forEach(function(t){var i,l,d=Math.max(a,t.start-n),s=Math.max(d,t.end-n);if(!(d>=s)){var u=v(r,t.color||"");o+=e.slice(a,d),o+=c(e.slice(d,s),(null===(l=null===(i=t.badges)||void 0===i?void 0:i[0])||void 0===l?void 0:l.id)||"",u,t.badges||[]),a=s}}),o+=e.slice(a)}(e.usedLooseMatch||a!==e.start||l!==e.end?s:e.highlight,e.start,p[e.idx]||[],e.color),h=c(u,(null===(o=null===(i=e.badges)||void 0===i?void 0:i[0])||void 0===o?void 0:o.id)||"",e.color,e.badges||[]);n=n.slice(0,a)+h+n.slice(l)}}),n},[b,S,B,A,z,W]),L=d(function(){return x?P(y(x||"")):""},[x]),X=!!x,Y=e(e(e({},C),{"& *":{fontFamily:"inherit"},"& code, & pre, & kbd, & samp":{fontFamily:"inherit !important",fontSize:"inherit",background:"none",padding:0,border:"none",whiteSpace:"pre-wrap"},"& p, & li, & ul, & ol":{position:"static",overflow:"visible",whiteSpace:"pre-wrap",lineHeight:"1.5"}}),{position:"relative",fontFamily:"system-ui, -apple-system, sans-serif",fontSize:"inherit",fontWeight:"400",lineHeight:"1.5",width:"100%",maxWidth:"100%",minWidth:0,boxSizing:"border-box",overflow:"visible",whiteSpace:"normal",gridArea:"1 / 1",padding:"3px"}),K=e(e(e({},Y),{zIndex:2}),X?{color:"transparent",userSelect:"none",pointerEvents:"none","& .deviation-badge":{pointerEvents:"auto",visibility:"visible"},"& table":{visibility:"hidden"}}:{}),V=e(e({},Y),{zIndex:1,pointerEvents:"auto"});return s(function(){if(M.current){var e=function(){var e,n,t=Array.from(M.current.querySelectorAll(".deviation-badge"));if(0!==t.length){t.forEach(function(e){e.style.setProperty("--badge-nudge","0px")});var r=M.current.getBoundingClientRect(),i=r.bottom-4,o=r.top+4,a=M.current.querySelector('div[data-layer="base"]')||(null===(e=M.current.querySelector("div"))||void 0===e?void 0:e.firstElementChild),l=X?M.current.querySelector('div[data-layer="overlay"]')||(null===(n=M.current.querySelector("div"))||void 0===n?void 0:n.lastElementChild):null,c=a?Array.from(a.querySelectorAll(".deviation-badge")):[],d=l?Array.from(l.querySelectorAll(".deviation-badge")):[],s=t.length>0?t.filter(function(e){return"left"===e.dataset.side}):c.filter(function(e){return"left"===e.dataset.side}),u=t.length>0?t.filter(function(e){return"left"!==e.dataset.side}):c.filter(function(e){return"left"!==e.dataset.side}),h=function(e){if(0!==e.length){var n=e.map(function(e){var n=e.getBoundingClientRect();return{el:e,naturalTop:n.top,height:n.height,currentTop:n.top}});n.sort(function(e,n){return e.naturalTop-n.naturalTop});var t=[],r=[];n.forEach(function(e){if(0===r.length)r.push(e);else{var n=r[r.length-1],i=n.currentTop+n.height;e.naturalTop<i+8?(e.currentTop=i+8,r.push(e)):(t.push(r),r=[e])}}),r.length>0&&t.push(r),t.forEach(function(e){var n=e[e.length-1],t=n.currentTop+n.height;if(t>i){var r=t-i,a=e[0].currentTop-o,l=Math.max(0,Math.min(r,a));e.forEach(function(e){e.currentTop-=l})}}),t.flat().forEach(function(e){var n=e.currentTop-e.naturalTop;e.el.style.setProperty("--badge-nudge","".concat(n,"px"))})}};if(X&&(c.length>0||d.length>0)){var p=c.filter(function(e){return"left"===e.dataset.side}),f=c.filter(function(e){return"left"!==e.dataset.side}),g=d.filter(function(e){return"left"===e.dataset.side}),v=d.filter(function(e){return"left"!==e.dataset.side});h(p),h(f),h(g),h(v)}else h(s),h(u)}},n=requestAnimationFrame(function(){requestAnimationFrame(function(){e()})}),t=new ResizeObserver(function(){requestAnimationFrame(e)});return t.observe(M.current),function(){t.disconnect(),cancelAnimationFrame(n)}}},[N,I,R]),r(o,e({ref:M,sx:{position:"relative",display:"grid",gridTemplateColumns:"minmax(0, 1fr)",width:"100%",maxWidth:"100%",minWidth:0}},{children:[t(a,e({component:"div",sx:K},{children:t(p,e({components:O,remarkPlugins:E,rehypePlugins:k},{children:N.replace(/#{3}/g,"")}))})),X&&t(a,e({component:"div",sx:V},{children:t(p,e({components:O,remarkPlugins:E,rehypePlugins:k},{children:L}))}))]}))},m);export{C as MemoizedMarkdown};
|
|
2
2
|
//# sourceMappingURL=memoizedMarkdown.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as n,__spreadArray as e}from"tslib";import{useMemo as t}from"react";import{isMissingStr as i,safeStringify as o,getRationale as r,resolveComparisonInputItems as a,getSideData as l,hasValue as d,DEVIATION_BADGE_SEPARATOR as s}from"../CognitiveComparehelpers.js";import{buildComparisonRows as u}from"../utils/buildComparisonRows.js";var v={id:"",title:"",similarity:0,sections:[]},c=function(c,f,p,I,_,h){var g,m;void 0===_&&(_=!0);var x="string"==typeof p?p:JSON.stringify(p||{}),b=Boolean(h&&(h.learnings_data||(null===(m=null===(g=h.data)||void 0===g?void 0:g.artifactData)||void 0===m?void 0:m.userStorySnapshot))),y=t(function(){if(!c||0===Object.keys(c).length)return{activeProposed:{},activeVariants:[],comparisonRows:[],parseError:"Tree data is required"};var t=JSON.parse(x);try{var d=c.nodes||c,s=[],v=[],p=[],I=c.base_root_id,g=c.input_index_map||{0:"left",1:"right"},m=c[I]||d[I];if(!m||!1===m.display_node)return{activeProposed:{title:"No Data",sections:[]},activeVariants:[],comparisonRows:[],parseError:null};var y=c.content_mapping||{},R=function(n){return c[n]||d[n]},C=function(e,t,o){if(!e||"object"!=typeof e)return e||null;if(e.deviations)return e;if(_)return e;var r=Object.keys(e).filter(function(n){return/^\d+$/.test(n)});if(!r.length)return e;var a=r.sort(function(n,e){return Number(n)-Number(e)}),l={},d={},s=null;return a.forEach(function(n){var r,a,u,v,c,f,p=e[n];if(p&&"object"==typeof p){s||(s=p);var I=!(null==p?void 0:p.status)||"pending"===p.status,_=(null==p?void 0:p.deviation_highlight)||(null===(a=null==p?void 0:p.web_search_answer)||void 0===a?void 0:a.deviation_highlight),h=function(n){var e,t=(null===(e=null==p?void 0:p.cognitive_decisioning)||void 0===e?void 0:e.citations)||(null==p?void 0:p.citations)||{};return Object.values(t).map(function(e){var t;return null===(t=null==e?void 0:e[n])||void 0===t?void 0:t.highlighted_text}).filter(function(n){return"string"==typeof n&&n.trim().length>0})},m=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];for(var t=0,o=n;t<o.length;t++){var r=o[t];if(Array.isArray(r)&&r.some(function(n){return!i(n)}))return r}return[]},x=I?m((null===(u=null==p?void 0:p.deviation_highlights)||void 0===u?void 0:u[t])||(null===(v=null==p?void 0:p.deviation_highlights)||void 0===v?void 0:v[g[0]]),"string"==typeof _?[_]:[],h(t),h(g[0])):[],b=I?m((null===(c=null==p?void 0:p.deviation_highlights)||void 0===c?void 0:c[o])||(null===(f=null==p?void 0:p.deviation_highlights)||void 0===f?void 0:f[g[1]]),h(o),h(g[1])):[];l[n]=((r={})[g[0]]=x[0]||"",r[g[1]]=b[0]||"",r.deviation_summary=(null==p?void 0:p.deviation_summary)||"",r.deviation_title=null==p?void 0:p.deviation_title,r.deviation_impact=null==p?void 0:p.deviation_impact,r.deviation_explanation=null==p?void 0:p.deviation_explanation,r.evaluation_outputs=null==p?void 0:p.evaluation_outputs,r.cognitive_decisioning=null==p?void 0:p.cognitive_decisioning,r.deviation_highlights=null==p?void 0:p.deviation_highlights,r),d[n]=p}}),n(n({},e),{deviation_title:(null==s?void 0:s.deviation_title)||(null==e?void 0:e.deviation_title),deviation_impact:(null==s?void 0:s.deviation_impact)||(null==e?void 0:e.deviation_impact),deviation_summary:(null==s?void 0:s.deviation_summary)||(null==e?void 0:e.deviation_summary),deviation_explanation:(null==s?void 0:s.deviation_explanation)||(null==e?void 0:e.deviation_explanation),evaluation_outputs:(null==s?void 0:s.evaluation_outputs)||(null==e?void 0:e.evaluation_outputs),cognitive_decisioning:(null==s?void 0:s.cognitive_decisioning)||(null==e?void 0:e.cognitive_decisioning),deviations:l,deviation_entries:d})},E=function(n){var e=new Map,t=function(n){n.forEach(function(n){var i;n.id&&e.set(n.id,n),(null===(i=n.subsections)||void 0===i?void 0:i.length)&&t(n.subsections)})};t(n);var i=function(n,t){for(var o,r=[],a=function(n){var a=n.ref_parent_section_node_id;if(a&&e.has(a)&&a!==(null==t?void 0:t.id)){var l=e.get(a);l.subsections||(l.subsections=[]),l.subsections.some(function(e){return e.id===n.id})||l.subsections.push(n)}else(null===(o=n.subsections)||void 0===o?void 0:o.length)&&(n.subsections=i(n.subsections,n)),r.push(n)},l=0,d=n;l<d.length;l++){a(d[l])}return r},o=i(n),r=function(n){n.forEach(function(n){n.subsections&&n.subsections.length>0&&(n.subsections.sort(function(n,e){return n.selfIndex<0&&e.selfIndex>=0?1:n.selfIndex>=0&&e.selfIndex<0?-1:(n.selfIndex||0)-(e.selfIndex||0)}),r(n.subsections))})};return r(o),o},O=function(n){var e=n.comparison_inputs?Object.keys(n.comparison_inputs):[],t=g[0],i=g[1];return e.length>0&&(t=e.includes(g[0])?g[0]:e[0],i=e.includes(g[1])?g[1]:e.length>1?e[1]:e[0]),{nodeLeftId:t,nodeRightId:i}},j=function(e,t,i,r){var a=t.attributes||{},l=t.data||{},d=!1!==a.display_title,s=!1!==a.display_content,u=d?o(l.title||""):"",v=s?o(l.content||""):"",c=s?o(l.change_history||""):"",f=void 0!==a.display_index&&null!==a.display_index?Number(a.display_index):-1,p=function(n){return(null==n?void 0:n.entity_id)||(null==n?void 0:n.ref_parent_section_node_id)||(null==n?void 0:n.parent_entity_id)||null}(a),I=!(!u.trim()&&!v.trim());return n(n({id:"".concat(e,"::").concat(t.contentId),nodeId:e,contentId:t.contentId,parentContentId:p,title:u,content:v,change_history:c,displayTitle:d,displayContent:s,subsections:[]},I?r:{score:void 0,relation:"not_defined"}),{evaluationResult:i,evaluationResults:i?[i]:[],selfIndex:f,refIndexes:[],refContentIds:[],ref_parent_section_node_id:p})},N=function(n,t){n.refIndexes=Array.from(new Set(e(e([],n.refIndexes||[],!0),t.refIndexes||[],!0))),n.refContentIds=Array.from(new Set(e(e([],n.refContentIds||[],!0),t.refContentIds||[],!0)));var i=new Set((n.subsections||[]).map(function(n){return n.id||n.contentId||n.nodeId}));(t.subsections||[]).forEach(function(t){var o=t.id||t.contentId||t.nodeId;i.has(o)||(n.subsections=e(e([],n.subsections||[],!0),[t],!1),i.add(o))});var o=e(e([],n.evaluationResults||(n.evaluationResult?[n.evaluationResult]:[]),!0),t.evaluationResults||(t.evaluationResult?[t.evaluationResult]:[]),!0).filter(Boolean),r=new Set;return n.evaluationResults=o.filter(function(n){var e=(null==n?void 0:n.nodeId)||JSON.stringify(Object.keys((null==n?void 0:n.deviations)||n||{}));return!r.has(e)&&(r.add(e),!0)}),!n.evaluationResult&&t.evaluationResult&&(n.evaluationResult=t.evaluationResult),!n.cognitiveData&&t.cognitiveData&&(n.cognitiveData=t.cognitiveData),n},S=function(n,e){return n.selfIndex<0&&e.selfIndex>=0?1:n.selfIndex>=0&&e.selfIndex<0?-1:n.selfIndex-e.selfIndex},w=function(e,i){var o,l=R(e);if(!l||!1===l.display_node)return[];if(b&&"1"===i)return[];var d=O(l),s=d.nodeLeftId,u=d.nodeRightId,v=r(l),c=(null===(o=null==t?void 0:t[e])||void 0===o?void 0:o.evaluation_result)||l.evaluation_result||null,f=C(c,s,u),p=f&&"object"==typeof f?n(n({},f),{nodeId:e}):f,I=a(l,i,g,y).map(function(n){return j(e,n,p,v)});if(l.next){var _=Object.values(l.next).flatMap(function(n){return w(n,i)});I.forEach(function(n){var e=_.filter(function(e){return!e.parentContentId||e.parentContentId===n.contentId||e.parentContentId===n.parentContentId});n.subsections=e.length?e:_})}return I};if(f){var k=function(e,i){var o;void 0===i&&(i=0);var l=[],d=[];if(!e)return{refSections:l,baseSections:d};var s={},u={},v=-1,c=-1,f=function(l){var d=e[l],f=R(d);if(!f||!1===f.display_node)return"continue";var p=O(f),I=p.nodeLeftId,_=p.nodeRightId,h=r(f),m=(null===(o=null==t?void 0:t[d])||void 0===o?void 0:o.evaluation_result)||f.evaluation_result||null,x=C(m,I,_),E=x&&"object"==typeof x?n(n({},x),{nodeId:d}):x,S=k(f.next,i+1),w=S.refSections,D=S.baseSections,P=a(f,"0",g,y).map(function(n){var e=j(d,n,E,h);return-1===e.selfIndex&&(e.selfIndex=c--),e}),K=[];if(!b){var V=a(f,"1",g,y);K=V.map(function(n){var e=j(d,n,E,h);return-1===e.selfIndex&&(e.selfIndex=v--),e})}P.forEach(function(n){K.forEach(function(e){var t,i,o,r,a,l,d,s;Number(e.selfIndex)>=0&&Number(n.selfIndex)>=0&&((null===(t=e.refIndexes)||void 0===t?void 0:t.includes(Number(n.selfIndex)))||null===(i=e.refIndexes)||void 0===i||i.push(Number(n.selfIndex)),(null===(o=n.refIndexes)||void 0===o?void 0:o.includes(Number(e.selfIndex)))||null===(r=n.refIndexes)||void 0===r||r.push(Number(e.selfIndex))),n.contentId&&!(null===(a=e.refContentIds)||void 0===a?void 0:a.includes(n.contentId))&&(null===(l=e.refContentIds)||void 0===l||l.push(n.contentId)),e.contentId&&!(null===(d=n.refContentIds)||void 0===d?void 0:d.includes(e.contentId))&&(null===(s=n.refContentIds)||void 0===s||s.push(e.contentId))})}),K.forEach(function(n){var e=w.filter(function(e){var t;return!e.parentContentId||e.parentContentId===n.contentId||e.parentContentId===n.parentContentId||(null===(t=n.refContentIds)||void 0===t?void 0:t.includes(e.parentContentId))});e.length>0&&(n.subsections=e);var t=0===i?String(n.selfIndex):"".concat(n.selfIndex,"_").concat(n.contentId||d);s[t]=s[t]?N(s[t],n):n}),P.forEach(function(n){var e=D.filter(function(e){var t;return!e.parentContentId||e.parentContentId===n.contentId||e.parentContentId===n.parentContentId||(null===(t=n.refContentIds)||void 0===t?void 0:t.includes(e.parentContentId))});e.length>0&&(n.subsections=e);var t=0===i?String(n.selfIndex):"".concat(n.selfIndex,"_").concat(n.contentId||d);u[t]=u[t]?N(u[t],n):n})};for(var p in e)f(p);return l=Object.values(s),d=Object.values(u),l.sort(S),d.sort(S),{refSections:l,baseSections:d}},D=k(m.next),P=D.refSections,K=D.baseSections;b||(v=E(P)),s=K}else m.next&&Object.values(m.next).forEach(function(n){var e=R(n);if(e&&!1!==e.display_node){var t=w(n,"0");if(b)s.push.apply(s,t);else{var i=E(w(n,"1"));p.push.apply(p,u(n,t,i))}}}),b||(s=p.map(function(n){return n.left}),v=p.map(function(n){return n.right}));var V=l(m,"0",g,y),T=l(m,"1",g,y),A={title:V.title||"Uploaded Contract",description:m.decision_scope_description||"",sections:s},G={id:"tree-variant-1",title:b?function(){var n,e;if((null==h?void 0:h.learnings_data)&&Object.keys(h.learnings_data).length>0){var t=Object.keys(h.learnings_data)[0];return(null===(n=h.learnings_data[t])||void 0===n?void 0:n.title)||"Rulebook Guidelines"}return(null===(e=null==h?void 0:h.data)||void 0===e?void 0:e.artifactTitle)||"Rulebook Guidelines"}():T.title||"Reference Template",similarity:0,sections:v,analysis:{rule_difference_comparison:{summary:{overall_score:0,overall_summary:m.decision_scope_description||""},fields:{}}}};return{activeProposed:A,activeVariants:[G],comparisonRows:p,parseError:null}}catch(n){return console.error("Data Transformation Error: ",n),{activeProposed:{},activeVariants:[],comparisonRows:[],parseError:n instanceof Error?n.message:"Unknown Parsing Error"}}},[c,f,x,_,h]),R=y.activeProposed,C=y.activeVariants,E=y.comparisonRows,O=y.parseError,j=(null==C?void 0:C[0])||v,N=t(function(){return(null==R?void 0:R.sections)||[]},[null==R?void 0:R.sections]),S=t(function(){return j.sections||[]},[j.sections]),w=N.length>0||S.length>0,k=t(function(){return I.fields.filter(function(n){var e=n.key;return(!w||"description"!==e)&&(d(null==R?void 0:R[e])||d(j[e]))})},[R,j,w,I.fields]),D=t(function(){var n,e,t={},o={},r={},a=0,l=null===(n=null==c?void 0:c.input_index_map)||void 0===n?void 0:n[0],d=null===(e=null==c?void 0:c.input_index_map)||void 0===e?void 0:e[1],u=function(n,e){if(!f){var t="left"===e?N.indexOf(n):S.indexOf(n);return{rootKey:"".concat(e,":").concat(t),parentNum:t+1}}if("left"===e){var i=n.selfIndex,o=void 0!==i&&i>=0?i+1:N.indexOf(n)+1;return{rootKey:"left-root:".concat(n.id),parentNum:o}}var r=n.selfIndex,a=N.find(function(n){var e;return null===(e=n.refIndexes)||void 0===e?void 0:e.includes(r)});if(a){var l=a.selfIndex,d=void 0!==l&&l>=0?l+1:N.indexOf(a)+1;return{rootKey:"left-root:".concat(a.id),parentNum:d}}var s=void 0!==r&&r>=0?r+1:S.indexOf(n)+1;return{rootKey:"right-orphan-root:".concat(n.id),parentNum:s}},v=function(n,e){if(n&&e)return n.find(function(n){return n.id===e.id||n.nodeId&&n.nodeId===e.nodeId||n.contentId&&n.contentId===e.contentId})||void 0},p=function(n,e,u,c,f,I,_){if(e&&function(n,e,t){var a;((null===(a=null==n?void 0:n.evaluationResults)||void 0===a?void 0:a.length)?n.evaluationResults:(null==n?void 0:n.evaluationResult)?[n.evaluationResult]:[]).forEach(function(a){var u=(null==a?void 0:a.deviations)||{};Object.keys(u).sort().forEach(function(v){var c=u[v];if(c){var f=!i(c[l]),p=!i(c[d]);if(f||p){var I=(null==a?void 0:a.nodeId)||n.nodeId||n.id,_="".concat(I).concat(s).concat(v);void 0===o[_]&&(void 0===r[e]&&(r[e]=1),o[_]={index:r[e]++,rootKey:e,parentNum:t})}}})})}(e,c,f),e&&!I){var h=(null==_?void 0:_.id)||"fallback_parent_".concat(a++);t[h]||(t[h]=[]),t[h].push(e)}((null==e?void 0:e.subsections)||(null==n?void 0:n.subsections)||(null==u?void 0:u.subsections)||[]).forEach(function(t){var i=v(null==n?void 0:n.subsections,t),o=v(null==u?void 0:u.subsections,t);p(t,i,o,c,f,!1,e||_)})};N.forEach(function(n){var e,t=u(n,"left"),i=t.rootKey,o=t.parentNum,r=null;if(f){var a=null===(e=n.refIndexes)||void 0===e?void 0:e[0];r=S.find(function(n){return n.selfIndex===a})}else r=S[N.indexOf(n)];p(n,n,r,i,o,!0,n)}),b||S.forEach(function(n){var e=u(n,"right"),t=e.rootKey,i=e.parentNum;t.startsWith("right-orphan-root:")&&p(n,null,n,t,i,!0,n)});var I=Object.fromEntries(Object.entries(o).map(function(n){return[n[0],n[1].index]})),_=Object.fromEntries(Object.entries(o).map(function(n){return[n[0],n[1].parentNum]}));return{parentDeviationRecord:t,registry:I,deviationParentRegistry:_}},[N,S,f,c,b]),P=D.parentDeviationRecord,K=D.registry,V=D.deviationParentRegistry;return{isGuidelineMode:b,activeProposed:R,activeVariants:C,comparisonRows:E,existingRule:j,proposedSections:N,existingSections:S,visibleFields:k,parentDeviationRecord:P,deviationNumberRegistry:K,deviationParentRegistry:V,parseError:O}};export{c as useCognitiveTreeData};
|
|
1
|
+
import{__assign as n,__spreadArray as e}from"tslib";import{useMemo as t}from"react";import{safeStringify as i,isMissingStr as o,getRationale as r,resolveComparisonInputItems as a,getSideData as l,hasValue as d,DEVIATION_BADGE_SEPARATOR as s}from"../CognitiveComparehelpers.js";import{buildComparisonRows as u}from"../utils/buildComparisonRows.js";var v={id:"",title:"",similarity:0,sections:[]},c=function(c,f,p,_,I,g,h){var m,x;void 0===I&&(I=!0);var b="string"==typeof p?p:JSON.stringify(p||{}),y=null!=h?h:Boolean("string"==typeof g?g.trim():g&&(g.learnings_data||(null===(x=null===(m=g.data)||void 0===m?void 0:m.artifactData)||void 0===x?void 0:x.userStorySnapshot))),R=t(function(){if(!c||0===Object.keys(c).length)return{activeProposed:{},activeVariants:[],comparisonRows:[],parseError:"Tree data is required"};var t=JSON.parse(b);try{var d=c.nodes||c,s=[],v=[],p=[],_=c.base_root_id,h=c.input_index_map||{0:"left",1:"right"},m=c[_]||d[_];if(!m||!1===m.display_node)return{activeProposed:{title:"No Data",sections:[]},activeVariants:[],comparisonRows:[],parseError:null};var x=c.content_mapping||{},R=function(n){return c[n]||d[n]},C=function(e,t,r){if(!e||"object"!=typeof e)return e||null;if(e.deviations)return e;if(I)return e;var a=Object.keys(e).filter(function(n){return/^\d+$/.test(n)});if(!a.length)return e;var l=a.sort(function(n,e){return Number(n)-Number(e)}),d={},s={},u=null;return l.forEach(function(n){var a,l,v,c,f,p,_,I=e[n];if(I&&"object"==typeof I){u||(u=I);var g="same"===i(null===(l=null==I?void 0:I.evaluation_outputs)||void 0===l?void 0:l.output_value).trim().toLowerCase(),m=!((null==I?void 0:I.status)&&"pending"!==I.status||g),x=(null==I?void 0:I.deviation_highlight)||(null===(v=null==I?void 0:I.web_search_answer)||void 0===v?void 0:v.deviation_highlight),b=function(n){var e,t=(null===(e=null==I?void 0:I.cognitive_decisioning)||void 0===e?void 0:e.citations)||(null==I?void 0:I.citations)||{};return Object.values(t).map(function(e){var t;return null===(t=null==e?void 0:e[n])||void 0===t?void 0:t.highlighted_text}).filter(function(n){return"string"==typeof n&&n.trim().length>0})},y=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];for(var t=0,i=n;t<i.length;t++){var r=i[t];if(Array.isArray(r)&&r.some(function(n){return!o(n)}))return r}return[]},R=m?y((null===(c=null==I?void 0:I.deviation_highlights)||void 0===c?void 0:c[t])||(null===(f=null==I?void 0:I.deviation_highlights)||void 0===f?void 0:f[h[0]]),"string"==typeof x?[x]:[],b(t),b(h[0])):[],C=m?y((null===(p=null==I?void 0:I.deviation_highlights)||void 0===p?void 0:p[r])||(null===(_=null==I?void 0:I.deviation_highlights)||void 0===_?void 0:_[h[1]]),b(r),b(h[1])):[];d[n]=((a={})[h[0]]=R[0]||"",a[h[1]]=C[0]||"",a.deviation_summary=(null==I?void 0:I.deviation_summary)||"",a.deviation_title=null==I?void 0:I.deviation_title,a.deviation_impact=null==I?void 0:I.deviation_impact,a.deviation_explanation=null==I?void 0:I.deviation_explanation,a.evaluation_outputs=null==I?void 0:I.evaluation_outputs,a.cognitive_decisioning=null==I?void 0:I.cognitive_decisioning,a.deviation_highlights=null==I?void 0:I.deviation_highlights,a),s[n]=I}}),n(n({},e),{deviation_title:(null==u?void 0:u.deviation_title)||(null==e?void 0:e.deviation_title),deviation_impact:(null==u?void 0:u.deviation_impact)||(null==e?void 0:e.deviation_impact),deviation_summary:(null==u?void 0:u.deviation_summary)||(null==e?void 0:e.deviation_summary),deviation_explanation:(null==u?void 0:u.deviation_explanation)||(null==e?void 0:e.deviation_explanation),evaluation_outputs:(null==u?void 0:u.evaluation_outputs)||(null==e?void 0:e.evaluation_outputs),cognitive_decisioning:(null==u?void 0:u.cognitive_decisioning)||(null==e?void 0:e.cognitive_decisioning),deviations:d,deviation_entries:s})},E=function(n){var e=new Map,t=function(n){n.forEach(function(n){var i;n.id&&e.set(n.id,n),(null===(i=n.subsections)||void 0===i?void 0:i.length)&&t(n.subsections)})};t(n);var i=function(n,t){for(var o,r=[],a=function(n){var a=n.ref_parent_section_node_id;if(a&&e.has(a)&&a!==(null==t?void 0:t.id)){var l=e.get(a);l.subsections||(l.subsections=[]),l.subsections.some(function(e){return e.id===n.id})||l.subsections.push(n)}else(null===(o=n.subsections)||void 0===o?void 0:o.length)&&(n.subsections=i(n.subsections,n)),r.push(n)},l=0,d=n;l<d.length;l++){a(d[l])}return r},o=i(n),r=function(n){n.forEach(function(n){n.subsections&&n.subsections.length>0&&(n.subsections.sort(function(n,e){return n.selfIndex<0&&e.selfIndex>=0?1:n.selfIndex>=0&&e.selfIndex<0?-1:(n.selfIndex||0)-(e.selfIndex||0)}),r(n.subsections))})};return r(o),o},O=function(n){var e=n.comparison_inputs?Object.keys(n.comparison_inputs):[],t=h[0],i=h[1];return e.length>0&&(t=e.includes(h[0])?h[0]:e[0],i=e.includes(h[1])?h[1]:e.length>1?e[1]:e[0]),{nodeLeftId:t,nodeRightId:i}},j=function(e,t,o,r){var a=t.attributes||{},l=t.data||{},d=!1!==a.display_title,s=!1!==a.display_content,u=d?i(l.title||""):"",v=s?i(l.content||""):"",c=s?i(l.change_history||""):"",f=void 0!==a.display_index&&null!==a.display_index?Number(a.display_index):-1,p=function(n){return(null==n?void 0:n.entity_id)||(null==n?void 0:n.ref_parent_section_node_id)||(null==n?void 0:n.parent_entity_id)||null}(a),_=!(!u.trim()&&!v.trim());return n(n({id:"".concat(e,"::").concat(t.contentId),nodeId:e,contentId:t.contentId,parentContentId:p,title:u,content:v,change_history:c,displayTitle:d,displayContent:s,subsections:[]},_?r:{score:void 0,relation:"not_defined"}),{evaluationResult:o,evaluationResults:o?[o]:[],selfIndex:f,refIndexes:[],refContentIds:[],ref_parent_section_node_id:p})},N=function(n,t){n.refIndexes=Array.from(new Set(e(e([],n.refIndexes||[],!0),t.refIndexes||[],!0))),n.refContentIds=Array.from(new Set(e(e([],n.refContentIds||[],!0),t.refContentIds||[],!0)));var i=new Set((n.subsections||[]).map(function(n){return n.id||n.contentId||n.nodeId}));(t.subsections||[]).forEach(function(t){var o=t.id||t.contentId||t.nodeId;i.has(o)||(n.subsections=e(e([],n.subsections||[],!0),[t],!1),i.add(o))});var o=e(e([],n.evaluationResults||(n.evaluationResult?[n.evaluationResult]:[]),!0),t.evaluationResults||(t.evaluationResult?[t.evaluationResult]:[]),!0).filter(Boolean),r=new Set;return n.evaluationResults=o.filter(function(n){var e=(null==n?void 0:n.nodeId)||JSON.stringify(Object.keys((null==n?void 0:n.deviations)||n||{}));return!r.has(e)&&(r.add(e),!0)}),!n.evaluationResult&&t.evaluationResult&&(n.evaluationResult=t.evaluationResult),!n.cognitiveData&&t.cognitiveData&&(n.cognitiveData=t.cognitiveData),n},S=function(n,e){return n.selfIndex<0&&e.selfIndex>=0?1:n.selfIndex>=0&&e.selfIndex<0?-1:n.selfIndex-e.selfIndex},w=function(e,i){var o,l=R(e);if(!l||!1===l.display_node)return[];if(y&&"1"===i)return[];var d=O(l),s=d.nodeLeftId,u=d.nodeRightId,v=r(l),c=(null===(o=null==t?void 0:t[e])||void 0===o?void 0:o.evaluation_result)||l.evaluation_result||null,f=C(c,s,u),p=f&&"object"==typeof f?n(n({},f),{nodeId:e}):f,_=a(l,i,h,x).map(function(n){return j(e,n,p,v)});if(l.next){var I=Object.values(l.next).flatMap(function(n){return w(n,i)});_.forEach(function(n){var e=I.filter(function(e){return!e.parentContentId||e.parentContentId===n.contentId||e.parentContentId===n.parentContentId});n.subsections=e.length?e:I})}return _};if(f){var k=function(e,i){var o;void 0===i&&(i=0);var l=[],d=[];if(!e)return{refSections:l,baseSections:d};var s={},u={},v=-1,c=-1,f=function(l){var d=e[l],f=R(d);if(!f||!1===f.display_node)return"continue";var p=O(f),_=p.nodeLeftId,I=p.nodeRightId,g=r(f),m=(null===(o=null==t?void 0:t[d])||void 0===o?void 0:o.evaluation_result)||f.evaluation_result||null,b=C(m,_,I),E=b&&"object"==typeof b?n(n({},b),{nodeId:d}):b,S=k(f.next,i+1),w=S.refSections,D=S.baseSections,P=a(f,"0",h,x).map(function(n){var e=j(d,n,E,g);return-1===e.selfIndex&&(e.selfIndex=c--),e}),K=[];if(!y){var V=a(f,"1",h,x);K=V.map(function(n){var e=j(d,n,E,g);return-1===e.selfIndex&&(e.selfIndex=v--),e})}P.forEach(function(n){K.forEach(function(e){var t,i,o,r,a,l,d,s;Number(e.selfIndex)>=0&&Number(n.selfIndex)>=0&&((null===(t=e.refIndexes)||void 0===t?void 0:t.includes(Number(n.selfIndex)))||null===(i=e.refIndexes)||void 0===i||i.push(Number(n.selfIndex)),(null===(o=n.refIndexes)||void 0===o?void 0:o.includes(Number(e.selfIndex)))||null===(r=n.refIndexes)||void 0===r||r.push(Number(e.selfIndex))),n.contentId&&!(null===(a=e.refContentIds)||void 0===a?void 0:a.includes(n.contentId))&&(null===(l=e.refContentIds)||void 0===l||l.push(n.contentId)),e.contentId&&!(null===(d=n.refContentIds)||void 0===d?void 0:d.includes(e.contentId))&&(null===(s=n.refContentIds)||void 0===s||s.push(e.contentId))})}),K.forEach(function(n){var e=w.filter(function(e){var t;return!e.parentContentId||e.parentContentId===n.contentId||e.parentContentId===n.parentContentId||(null===(t=n.refContentIds)||void 0===t?void 0:t.includes(e.parentContentId))});e.length>0&&(n.subsections=e);var t=0===i?String(n.selfIndex):"".concat(n.selfIndex,"_").concat(n.contentId||d);s[t]=s[t]?N(s[t],n):n}),P.forEach(function(n){var e=D.filter(function(e){var t;return!e.parentContentId||e.parentContentId===n.contentId||e.parentContentId===n.parentContentId||(null===(t=n.refContentIds)||void 0===t?void 0:t.includes(e.parentContentId))});e.length>0&&(n.subsections=e);var t=0===i?String(n.selfIndex):"".concat(n.selfIndex,"_").concat(n.contentId||d);u[t]=u[t]?N(u[t],n):n})};for(var p in e)f(p);return l=Object.values(s),d=Object.values(u),l.sort(S),d.sort(S),{refSections:l,baseSections:d}},D=k(m.next),P=D.refSections,K=D.baseSections;y||(v=E(P)),s=K}else m.next&&Object.values(m.next).forEach(function(n){var e=R(n);if(e&&!1!==e.display_node){var t=w(n,"0");if(y)s.push.apply(s,t);else{var i=E(w(n,"1"));p.push.apply(p,u(n,t,i))}}}),y||(s=p.map(function(n){return n.left}),v=p.map(function(n){return n.right}));var V=l(m,"0",h,x),T=l(m,"1",h,x),A={title:V.title||"Uploaded Contract",description:m.decision_scope_description||"",sections:s},L={id:"tree-variant-1",title:y?function(){var n,e;if("string"!=typeof g&&(null==g?void 0:g.learnings_data)&&Object.keys(g.learnings_data).length>0){var t=Object.keys(g.learnings_data)[0];return(null===(n=g.learnings_data[t])||void 0===n?void 0:n.title)||"Rulebook Guidelines"}return"string"!=typeof g&&(null===(e=null==g?void 0:g.data)||void 0===e?void 0:e.artifactTitle)||"Rulebook Guidelines"}():T.title||"Reference Template",similarity:0,sections:v,analysis:{rule_difference_comparison:{summary:{overall_score:0,overall_summary:m.decision_scope_description||""},fields:{}}}};return{activeProposed:A,activeVariants:[L],comparisonRows:p,parseError:null}}catch(n){return console.error("Data Transformation Error: ",n),{activeProposed:{},activeVariants:[],comparisonRows:[],parseError:n instanceof Error?n.message:"Unknown Parsing Error"}}},[c,f,b,I,g,y]),C=R.activeProposed,E=R.activeVariants,O=R.comparisonRows,j=R.parseError,N=(null==E?void 0:E[0])||v,S=t(function(){return(null==C?void 0:C.sections)||[]},[null==C?void 0:C.sections]),w=t(function(){return N.sections||[]},[N.sections]),k=S.length>0||w.length>0,D=t(function(){return _.fields.filter(function(n){var e=n.key;return(!k||"description"!==e)&&(d(null==C?void 0:C[e])||d(N[e]))})},[C,N,k,_.fields]),P=t(function(){var n,e,t={},i={},r={},a=0,l=null===(n=null==c?void 0:c.input_index_map)||void 0===n?void 0:n[0],d=null===(e=null==c?void 0:c.input_index_map)||void 0===e?void 0:e[1],u=function(n,e){if(!f){var t="left"===e?S.indexOf(n):w.indexOf(n);return{rootKey:"".concat(e,":").concat(t),parentNum:t+1}}if("left"===e){var i=n.selfIndex,o=void 0!==i&&i>=0?i+1:S.indexOf(n)+1;return{rootKey:"left-root:".concat(n.id),parentNum:o}}var r=n.selfIndex,a=S.find(function(n){var e;return null===(e=n.refIndexes)||void 0===e?void 0:e.includes(r)});if(a){var l=a.selfIndex,d=void 0!==l&&l>=0?l+1:S.indexOf(a)+1;return{rootKey:"left-root:".concat(a.id),parentNum:d}}var s=void 0!==r&&r>=0?r+1:w.indexOf(n)+1;return{rootKey:"right-orphan-root:".concat(n.id),parentNum:s}},v=function(n,e){if(n&&e)return n.find(function(n){return n.id===e.id||n.nodeId&&n.nodeId===e.nodeId||n.contentId&&n.contentId===e.contentId})||void 0},p=function(n,e,u,c,f,_,I){if(e&&function(n,e,t){var a;((null===(a=null==n?void 0:n.evaluationResults)||void 0===a?void 0:a.length)?n.evaluationResults:(null==n?void 0:n.evaluationResult)?[n.evaluationResult]:[]).forEach(function(a){var u=(null==a?void 0:a.deviations)||{};Object.keys(u).sort().forEach(function(v){var c=u[v];if(c){var f=!o(c[l]),p=!o(c[d]);if(f||p){var _=(null==a?void 0:a.nodeId)||n.nodeId||n.id,I="".concat(_).concat(s).concat(v);void 0===i[I]&&(void 0===r[e]&&(r[e]=1),i[I]={index:r[e]++,rootKey:e,parentNum:t})}}})})}(e,c,f),e&&!_){var g=(null==I?void 0:I.id)||"fallback_parent_".concat(a++);t[g]||(t[g]=[]),t[g].push(e)}((null==e?void 0:e.subsections)||(null==n?void 0:n.subsections)||(null==u?void 0:u.subsections)||[]).forEach(function(t){var i=v(null==n?void 0:n.subsections,t),o=v(null==u?void 0:u.subsections,t);p(t,i,o,c,f,!1,e||I)})};S.forEach(function(n){var e,t=u(n,"left"),i=t.rootKey,o=t.parentNum,r=null;if(f){var a=null===(e=n.refIndexes)||void 0===e?void 0:e[0];r=w.find(function(n){return n.selfIndex===a})}else r=w[S.indexOf(n)];p(n,n,r,i,o,!0,n)}),y||w.forEach(function(n){var e=u(n,"right"),t=e.rootKey,i=e.parentNum;t.startsWith("right-orphan-root:")&&p(n,null,n,t,i,!0,n)});var _=Object.fromEntries(Object.entries(i).map(function(n){return[n[0],n[1].index]})),I=Object.fromEntries(Object.entries(i).map(function(n){return[n[0],n[1].parentNum]}));return{parentDeviationRecord:t,registry:_,deviationParentRegistry:I}},[S,w,f,c,y]),K=P.parentDeviationRecord,V=P.registry,T=P.deviationParentRegistry;return{isGuidelineMode:y,activeProposed:C,activeVariants:E,comparisonRows:O,existingRule:N,proposedSections:S,existingSections:w,visibleFields:D,parentDeviationRecord:K,deviationNumberRegistry:V,deviationParentRegistry:T,parseError:j}};export{c as useCognitiveTreeData};
|
|
2
2
|
//# sourceMappingURL=useCompareData.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{useState as t,useRef as e,useCallback as n,useEffect as i}from"react";import{DEVIATION_BADGE_SEPARATOR as r}from"../CognitiveComparehelpers.js";var c=function(c){var o=c.containerRef,l=c.leftContainerRef,u=c.rightContainerRef;c.svgContainerRef;var a=c.pathRefs,d=c.leftHeaderRef,s=c.rightHeaderRef,v=c.proposedSections,h=c.existingSections,g=c.visibleFields,f=c.leftRefs,p=c.rightRefs,b=c.sectionLeftRefs,y=c.sectionRightRefs,x=c.subSectionLeftRefs,m=c.subSectionRightRefs,R=c.lhsBadgeRefs,C=c.rhsBadgeRefs,A=c.sectionRowRefs,B=c.expandedSections,S=c.expandedSubSections,M=c.connectedSections,I=c.isSideBySide,T=c.activeSideBySideSection,L=c.maintainRelativeOrder,F=c.isGuidelineMode,H=c.cognitiveMap,w=c.getSectionCompareStyle,k=c.getSubSectionCompareStyle,E=c.getDeviationStyleByKey,N=c.isArrowVisible,Y=c.isAnimatingRef,D=c.isSideBySideRef,j=c.sideBySideCacheRef,O=c.sideBySideLineRef,z=c.activeSideBySideSectionRef,P=c.activeSideBySideRightSectionRef,Q=c.connectedLines,X=c.setConnectedLines,q=c.cachedConnectedPositions,G=c.calculateLinesRef,K=c.resizeTimerRef,V=c.scrollLock,J=c.scrollSyncLocked,U=c.handleResizeRef,W=c.activeProposed,Z=c.existingRule,$=c.analysisData,_=c.pendingScrollTargetRef,tt=c.pendingScrollCallbackRef,et=c.resolvedComparisonConfig,nt=c.getFieldData,it=t([]),rt=it[0],ct=it[1],ot=t(null),lt=ot[0],ut=ot[1],at=t([]),dt=at[0],st=at[1],vt=null!=Q?Q:dt,ht=null!=X?X:st,gt=t({width:0,height:0}),ft=gt[0],pt=gt[1],bt=e(!1),yt=e(!1),xt=e(!1),mt=e(null),Rt=e([]),Ct=null!=q?q:Rt,At=function(t,e,n,i,r,c,o){if(Math.abs(i-e)<=1)return c&&o?"M ".concat(t,",").concat(e," L ").concat(n,",").concat(i):c&&!o?"M ".concat(t,",").concat(e," L ").concat(r,",").concat(e):!c&&o?"M ".concat(r,",").concat(e," L ").concat(n,",").concat(i):"M ".concat(r,",").concat(e," L ").concat(r,",").concat(i);var l=Math.min(15,Math.abs(r-t),Math.abs(i-e)/2),u=Math.min(15,Math.abs(n-r),Math.abs(i-e)/2),a=i>e?l:-l,d=i>e?u:-u,s=n>r?u:-u;return c&&o?"M ".concat(t,",").concat(e," L ").concat(r-l,",").concat(e," Q ").concat(r,",").concat(e," ").concat(r,",").concat(e+a," L ").concat(r,",").concat(i-d," Q ").concat(r,",").concat(i," ").concat(r+s,",").concat(i," L ").concat(n,",").concat(i):c&&!o?"M ".concat(t,",").concat(e," L ").concat(r-l,",").concat(e," Q ").concat(r,",").concat(e," ").concat(r,",").concat(e+a," L ").concat(r,",").concat(i):!c&&o?"M ".concat(r,",").concat(e," L ").concat(r,",").concat(i-d," Q ").concat(r,",").concat(i," ").concat(r+s,",").concat(i," L ").concat(n,",").concat(i):"M ".concat(r,",").concat(e," L ").concat(r,",").concat(i)},Bt=n(function(){var t,e,n,i,c,a,A,N,D,j,O,z,P,Q,X,q,G,K;if(!bt.current&&!Y.current){bt.current=!0;try{if(!o.current)return;var V=function(t){var e=t.split("-"),n=e[0];if(!B[n]&&!1===L)return!1;if(L&&!B["left-".concat(n)]&&!B["right-".concat(n)]&&!B[n])return!1;for(var i=n,r=1;r<e.length-1;r++)if(i+="-".concat(e[r]),!S[i])return!1;return!0},J=o.current.getBoundingClientRect();pt({width:J.width,height:J.height});var U=[];if(g.forEach(function(t){var e,n,i=t.key,r=null===(e=f.current[i])||void 0===e?void 0:e.current,c=null===(n=p.current[i])||void 0===n?void 0:n.current;r&&c&&(r.style.height="auto",c.style.height="auto",r.style.minHeight="0px",c.style.minHeight="0px")}),!Y.current){for(var W=0;W<Math.max(v.length,h.length);W++){var Z=null===(t=b.current[W])||void 0===t?void 0:t.current,$=null===(e=y.current[W])||void 0===e?void 0:e.current;Z&&(Z.style.height="auto",Z.style.minHeight="0px"),$&&($.style.height="auto",$.style.minHeight="0px")}L||Object.keys(x.current).forEach(function(t){var e,n;if(V(t)){var i=null===(e=x.current[t])||void 0===e?void 0:e.current,r=null===(n=m.current[t])||void 0===n?void 0:n.current;i&&r&&(i.style.height="auto",r.style.height="auto",i.style.minHeight="0px",r.style.minHeight="0px")}})}var _={};g.forEach(function(t){var e,n,i=t.key,r=null===(e=f.current[i])||void 0===e?void 0:e.current,c=null===(n=p.current[i])||void 0===n?void 0:n.current;if(r&&c){var o=r.getBoundingClientRect(),l=c.getBoundingClientRect();_[i]=Math.max(o.height,l.height)}});var tt={left:{},right:{}},et={};if(!Y.current)if(L){if(I&&null!==T)if("number"==typeof T){var nt=T,it=v[nt],rt=null===(c=b.current[nt])||void 0===c?void 0:c.current;rt&&it&&(it.refIndexes||[]).forEach(function(t){var e,n=h.findIndex(function(e){return e.selfIndex===t}),i=null===(e=y.current[n])||void 0===e?void 0:e.current;if(i&&(B["left-".concat(nt)]||B["right-".concat(n)])){var r=Math.max(rt.getBoundingClientRect().height,i.getBoundingClientRect().height);tt.left[nt]=Math.max(tt.left[nt]||0,r),tt.right[n]=Math.max(tt.right[n]||0,r)}})}else{var ot=T.split(r)[2];if(ot){Z=null===(a=x.current[ot])||void 0===a?void 0:a.current,$=null===(A=m.current[ot])||void 0===A?void 0:A.current;if(Z&&$){lt=Math.max(Z.getBoundingClientRect().height,$.getBoundingClientRect().height);et[ot]=Math.max(et[ot]||0,lt)}}}}else{Object.keys(x.current).forEach(function(t){var e,n;if(V(t)){var i=null===(e=x.current[t])||void 0===e?void 0:e.current,r=null===(n=m.current[t])||void 0===n?void 0:n.current;if(i&&r&&null!==i.offsetParent&&null!==r.offsetParent){var c=i.getBoundingClientRect(),o=r.getBoundingClientRect(),l=Math.max(c.height,o.height);et[t]=l,i.style.minHeight="".concat(l,"px"),r.style.minHeight="".concat(l,"px")}}});for(W=0;W<Math.min(v.length,h.length);W++){var Z=null===(n=b.current[W])||void 0===n?void 0:n.current,$=null===(i=y.current[W])||void 0===i?void 0:i.current;if(Z&&$){var lt=Math.max(Z.getBoundingClientRect().height,$.getBoundingClientRect().height);tt.left[W]=lt,tt.right[W]=lt}}}if(g.forEach(function(t){var e,n,i=t.key,r=null===(e=f.current[i])||void 0===e?void 0:e.current,c=null===(n=p.current[i])||void 0===n?void 0:n.current;if(r&&c){var o=_[i];r.style.minHeight="".concat(o,"px"),c.style.minHeight="".concat(o,"px")}}),Y.current||(Object.entries(tt.left).forEach(function(t){var e,n=t[0],i=t[1],r=null===(e=b.current[Number(n)])||void 0===e?void 0:e.current;r&&(r.style.minHeight="".concat(i,"px"))}),Object.entries(tt.right).forEach(function(t){var e,n=t[0],i=t[1],r=null===(e=y.current[Number(n)])||void 0===e?void 0:e.current;r&&(r.style.minHeight="".concat(i,"px"))}),L||Object.keys(et).forEach(function(t){var e,n,i=null===(e=x.current[t])||void 0===e?void 0:e.current,r=null===(n=m.current[t])||void 0===n?void 0:n.current;if(i&&r&&et[t]){var c=et[t];i.style.minHeight="".concat(c,"px"),r.style.minHeight="".concat(c,"px")}})),!F){v.forEach(function(t,e){var n,i=t.continuationSourceRowId?v.findIndex(function(e){return e.comparisonRowId===t.continuationSourceRowId}):-1,r=i>=0?i:e,c=null===(n=b.current[r])||void 0===n?void 0:n.current;if(c){var o=function(t,e){if(!L)return h[e]?[e]:[];var n=(t.refIndexes||[]).map(function(t){return h.findIndex(function(e){return e.selfIndex===t})}).filter(function(t){return-1!==t});return!n.length&&h[e]?[e]:Array.from(new Set(n))}(t,e);o.forEach(function(t){var n,o,a,d,s,g,f,p,b,x,m,R,C=null===(n=y.current[t])||void 0===n?void 0:n.current;if(C){var A=c.getBoundingClientRect(),B=C.getBoundingClientRect(),S=A.right-J.left,M=B.left-J.left,F=A.top+18-J.top,k=B.top+18-J.top;if(L&&I&&T===e){var E=null!==(a=null===(o=l.current)||void 0===o?void 0:o.getBoundingClientRect().top)&&void 0!==a?a:0,N=null!==(s=null===(d=u.current)||void 0===d?void 0:d.getBoundingClientRect().top)&&void 0!==s?s:0,Y=E+(null!==(f=null===(g=l.current)||void 0===g?void 0:g.clientHeight)&&void 0!==f?f:1/0),D=N+(null!==(b=null===(p=u.current)||void 0===p?void 0:p.clientHeight)&&void 0!==b?b:1/0),j=function(t,e,n){return Math.max(e,Math.min(n,t))};F=j(A.top+18,E,Y)-J.top,k=j(B.top+18,N,D)-J.top}var O=w(r);O&&U.push({id:"line-".concat(r,"-").concat(t),x1:S,y1:F,x2:M,y2:k,style:O,sectionIdx:r,targetRightIdx:t,isSubSection:!1,isMappingContinuation:i>=0,hasCognitive:!!((null===(x=v[r])||void 0===x?void 0:x.cognitiveData)||(null===(m=h[t])||void 0===m?void 0:m.cognitiveData)||(null===(R=v[r])||void 0===R?void 0:R.nodeId)&&H[v[r].nodeId])})}})}})}if(!F&&I&&"string"==typeof T&&T.includes(r)){var at=T.split(r),dt=at[0],st=at[1],vt=at[2],gt=(at[3],"".concat(dt).concat(r).concat(st)),ft=null===(N=R.current[gt])||void 0===N?void 0:N.current,yt=null===(D=C.current[gt])||void 0===D?void 0:D.current;if(ft&&yt){var xt=ft.getBoundingClientRect(),mt=yt.getBoundingClientRect(),Rt=xt.right-J.left,Bt=mt.left-J.left,Mt=xt.top+xt.height/2-J.top,It=mt.top+mt.height/2-J.top;if(L){var Tt=null!==(O=null===(j=l.current)||void 0===j?void 0:j.getBoundingClientRect().top)&&void 0!==O?O:0,Lt=null!==(P=null===(z=u.current)||void 0===z?void 0:z.getBoundingClientRect().top)&&void 0!==P?P:0,Ft=Tt+(null!==(X=null===(Q=l.current)||void 0===Q?void 0:Q.clientHeight)&&void 0!==X?X:1/0),Ht=Lt+(null!==(G=null===(q=u.current)||void 0===q?void 0:q.clientHeight)&&void 0!==G?G:1/0),wt=function(t,e,n){return Math.max(e,Math.min(n,t))};Mt=wt(xt.top+xt.height/2,Tt,Ft)-J.top,It=wt(mt.top+mt.height/2,Lt,Ht)-J.top}var kt=null!==(K=E(dt,st))&&void 0!==K?K:k(vt);kt&&U.push({id:"line-subsec-".concat(gt),x1:Rt,y1:Mt,x2:Bt,y2:It,style:kt,sectionIdx:Number(vt.split("-")[0]),isSubSection:!0,subSectionKeyPath:T})}}if(ct(U),d.current&&s.current){var Et=d.current.getBoundingClientRect(),Nt=s.current.getBoundingClientRect(),Yt=(Et.top+Et.height/2-J.top+Nt.top+Nt.height/2-J.top)/2;ut({x1:Et.right-J.left,x2:Nt.left-J.left,y:Yt})}else ut(null);if(M.size>0){var Dt=[],jt=l.current,Ot=u.current;if(jt&&Ot){var zt=[],Pt=jt.getBoundingClientRect().top,Qt=Ot.getBoundingClientRect().top,Xt=Pt+jt.clientHeight,qt=Qt+Ot.clientHeight,Gt=jt.scrollTop,Kt=Ot.scrollTop,Vt=J.top,Jt=function(t,e,n){return Math.max(e,Math.min(n,t))};M.forEach(function(t){var e,n,i,c,o,l,u,a,d;if(F){var s=null,g=null,f=null;if("string"==typeof t&&t.includes(r)){var p=t.split(r),b=p[0],y=p[1],x=p[2],m="".concat(b).concat(r).concat(y);s=null===(e=R.current[m])||void 0===e?void 0:e.current,f=null!==(n=E(b,y))&&void 0!==n?n:k(x),g=Number((null==x?void 0:x.split("-")[0])||0)}else g=Number(t),s=null===(i=R.current[g])||void 0===i?void 0:i.current,f=w(g);if(!s)return;var A=document.querySelectorAll('[id^="guideline-target-"]');A.forEach(function(e,n){var i=s.getBoundingClientRect(),c=e.getBoundingClientRect(),o=i.right-J.left,l=c.left-J.left-0,u=o+75,a=i.top+i.height/2,d=c.top+c.height/2,v=a-Pt+Gt,h=d-Qt+Kt,g="conn-guide-".concat(t,"-").concat(n),p="";"string"==typeof t&&t.includes(r)?p=(t.split(r)[2]||"").split("-").map(function(t){return Number(t)+1}).join("."):p=String(Number(t)+1);var b=String.fromCharCode(97+n),y=1===A.length?null:"".concat(p,"(").concat(b,")");zt.push({lhsScrollY:v,rhsScrollY:h,x1:o,x2:l,containerTop:Vt,leftIdx:t,rhsArrayIdx:n,styleColor:(null==f?void 0:f.badgeBorder)||"#6366F1",styleBg:(null==f?void 0:f.badgeBg)||"#FFFFFF",styleText:(null==f?void 0:f.badgeText)||"#A16207",styleId:g,centerX:u});var x=Jt(a,Pt,Xt),m=Jt(d,Qt,qt),R=x-Vt,C=m-Vt,B=At(o,R,l,C,u,a>=Pt-4&&a<=Xt+4,d>=Qt-4&&d<=qt+4);Dt.push({id:g,pathD:B,style:f,leftIdx:t,rhsArrayIdx:n,x1:o,x2:l,y1:R,y2:C,centerX:u,matchLabel:y,isGuideline:!0})})}else if("string"==typeof t&&t.includes(r)){var B=t.split(r),S=(b=B[0],y=B[1],x=B[2],B[3],m="".concat(b).concat(r).concat(y),null===(c=R.current[m])||void 0===c?void 0:c.current),M=null===(o=C.current[m])||void 0===o?void 0:o.current;if(!S||!M)return;var I=S.getBoundingClientRect(),T=M.getBoundingClientRect(),H=null!==(l=E(b,y))&&void 0!==l?l:k(x),N=I.right-J.left,Y=T.left-J.left-0,D=N+75,j=I.top+I.height/2,O=T.top+T.height/2,z=j-Pt+Gt,P=O-Qt+Kt,Q="conn-subsec-".concat(m),X=((x||"").split("-").map(function(t){return Number(t)+1}).join("."),null);zt.push({lhsScrollY:z,rhsScrollY:P,x1:N,x2:Y,containerTop:Vt,leftIdx:t,rhsArrayIdx:t,styleColor:(null==H?void 0:H.badgeBorder)||"#6366F1",styleBg:(null==H?void 0:H.badgeBg)||"#FFFFFF",styleText:(null==H?void 0:H.badgeText)||"#A16207",styleId:Q,centerX:D});var q=Jt(j,Pt,Xt),G=Jt(O,Qt,qt),K=At(N,$=q-Vt,Y,_=G-Vt,D,j>=Pt-4&&j<=Xt+4,O>=Qt-4&&O<=qt+4);Dt.push({id:Q,pathD:K,style:H,leftIdx:t,rhsArrayIdx:t,x1:N,x2:Y,y1:$,y2:_,matchLabel:X})}else if(L){var V=t,U=v[V];if(!(null===(d=null==U?void 0:U.refIndexes)||void 0===d?void 0:d.length))return;U.refIndexes.forEach(function(e,n){var i,r,c=h.findIndex(function(t){return t.selfIndex===e});if(-1!==c){var o=null===(i=R.current[V])||void 0===i?void 0:i.current,l=null===(r=C.current[c])||void 0===r?void 0:r.current;if(o&&l){var u=o.getBoundingClientRect(),a=l.getBoundingClientRect(),d=w(V),s=u.right-J.left,v=a.left-J.left-0,g=s+75,f=u.top+u.height/2,p=a.top+a.height/2,b=f-Pt+Gt,y=p-Qt+Kt,x="conn-".concat(V,"-").concat(c),m=String(Number(t)+1),A=String.fromCharCode(97+n),B=1===U.refIndexes.length?null:"".concat(m,"(").concat(A,")");zt.push({lhsScrollY:b,rhsScrollY:y,x1:s,x2:v,containerTop:Vt,leftIdx:V,rhsArrayIdx:c,styleColor:(null==d?void 0:d.badgeBorder)||"#6366F1",styleBg:(null==d?void 0:d.badgeBg)||"#FFFFFF",styleText:(null==d?void 0:d.badgeText)||"#A16207",styleId:x,centerX:g});var S=Jt(f,Pt,Xt),M=Jt(p,Qt,qt),I=S-Vt,T=M-Vt,L=At(s,I,v,T,g,f>=Pt-4&&f<=Xt+4,p>=Qt-4&&p<=qt+4);Dt.push({id:x,pathD:L,style:d,leftIdx:V,rhsArrayIdx:c,x1:s,x2:v,y1:I,y2:T,matchLabel:B})}}})}else{var W=t,Z=W;S=null===(u=R.current[W])||void 0===u?void 0:u.current,M=null===(a=C.current[Z])||void 0===a?void 0:a.current;if(!S||!M)return;I=S.getBoundingClientRect(),T=M.getBoundingClientRect(),H=w(W),N=I.right-J.left,Y=T.left-J.left-0,D=N+75,j=I.top+I.height/2,O=T.top+T.height/2,z=j-Pt+Gt,P=O-Qt+Kt,Q="conn-".concat(W,"-").concat(Z),String(Number(t)+1),X=null;zt.push({lhsScrollY:z,rhsScrollY:P,x1:N,x2:Y,containerTop:Vt,leftIdx:W,rhsArrayIdx:Z,styleColor:(null==H?void 0:H.badgeBorder)||"#6366F1",styleBg:(null==H?void 0:H.badgeBg)||"#FFFFFF",styleText:(null==H?void 0:H.badgeText)||"#A16207",styleId:Q,centerX:D});var $,_;q=Jt(j,Pt,Xt),G=Jt(O,Qt,qt),K=At(N,$=q-Vt,Y,_=G-Vt,D,j>=Pt-4&&j<=Xt+4,O>=Qt-4&&O<=qt+4);Dt.push({id:Q,pathD:K,style:H,leftIdx:W,rhsArrayIdx:Z,x1:N,x2:Y,y1:$,y2:_,matchLabel:X})}}),Ct.current=zt}ht(Dt),setTimeout(function(){return St()},10)}else ht([]),Ct.current=[],setTimeout(function(){return St()},10)}catch(t){console.error("Line render safe fail: ",t)}finally{bt.current=!1}}},[g,v,h,H,et,nt,w,E,L,I,T,M,B,S,F]),St=n(function(){var t,e,n,i,r,c,d,s,v,h,g,f,p,b,y,x,m,R,C,A=Ct.current;if(!A.length)return null===(t=a.current["guideline-up-stroke"])||void 0===t||t.setAttribute("visibility","hidden"),null===(e=a.current["guideline-up-badge"])||void 0===e||e.setAttribute("visibility","hidden"),null===(n=a.current["guideline-down-stroke"])||void 0===n||n.setAttribute("visibility","hidden"),void(null===(i=a.current["guideline-down-badge"])||void 0===i||i.setAttribute("visibility","hidden"));if(!Y.current){var B=null!==(c=null===(r=l.current)||void 0===r?void 0:r.scrollTop)&&void 0!==c?c:0,S=null!==(s=null===(d=u.current)||void 0===d?void 0:d.scrollTop)&&void 0!==s?s:0,M=null!==(h=null===(v=l.current)||void 0===v?void 0:v.clientHeight)&&void 0!==h?h:1/0,I=null!==(f=null===(g=u.current)||void 0===g?void 0:g.clientHeight)&&void 0!==f?f:1/0,T=null!==(b=null===(p=l.current)||void 0===p?void 0:p.getBoundingClientRect().top)&&void 0!==b?b:0,L=null!==(x=null===(y=u.current)||void 0===y?void 0:y.getBoundingClientRect().top)&&void 0!==x?x:0,F=T+M,H=L+I,w=null===(m=o.current)||void 0===m?void 0:m.getBoundingClientRect(),k=null!==(R=null==w?void 0:w.top)&&void 0!==R?R:0,E=null!==(C=null==w?void 0:w.height)&&void 0!==C?C:1/0,N=function(t,e,n){return Math.max(e,Math.min(n,t))},D=0,j=0,O=0,z=0,P="#6366F1",Q="#A16207",X=!1,q=0;if(A.forEach(function(t){var e=t.lhsScrollY-B+T,n=t.rhsScrollY-S+L,i=a.current[t.styleId+"-stroke"],r=a.current[t.styleId+"-bg"],c=a.current[t.styleId+"-btn"],o=a.current[t.styleId+"-number"];if(i||r){var l=N(e,T,F),u=N(n,L,H),d=l-k,s=u-k,v=e>=T-4&&e<=F+4,h=n>=L-4&&n<=H+4,g=!0;X=!0;var f=t.centerX||t.x1+75;0===O&&(O=t.x1,z=d,q=f,P=t.styleColor,t.styleBg,Q=t.styleText||"#A16207"),n<L-4?(D++,g=!1):n>H+4&&(j++,g=!1);var p=At(t.x1,d,t.x2,s,q,v,h);i&&(g&&p?(i.setAttribute("visibility","visible"),i.setAttribute("d",p)):i.setAttribute("visibility","hidden")),r&&(g&&p?(r.setAttribute("visibility","visible"),r.setAttribute("d",p)):r.setAttribute("visibility","hidden")),c&&(v&&g?(c.setAttribute("visibility","visible"),c.setAttribute("y",String(d-12))):c.setAttribute("visibility","hidden")),o&&(v&&g?(o.setAttribute("visibility","visible"),o.setAttribute("transform","translate(".concat(t.x2-42,", ").concat(s,")"))):o.setAttribute("visibility","hidden"))}}),X&&q>0){var G=a.current["guideline-up-stroke"],K=a.current["guideline-up-badge"],V=a.current["guideline-up-arrow"],J=a.current["guideline-up-text"],U=a.current["guideline-up-badge-rect"];if(D>0){var W=Math.max(15,L-k+15),Z=Math.min(15,Math.abs(q-O),Math.max(0,z-W)),$="M ".concat(O,",").concat(z," L ").concat(q-Z,",").concat(z," Q ").concat(q,",").concat(z," ").concat(q,",").concat(z-Z," L ").concat(q,",").concat(W);null==G||G.setAttribute("visibility","visible"),null==G||G.setAttribute("d",$),null==G||G.setAttribute("stroke",P),null==K||K.setAttribute("visibility","visible"),null==K||K.setAttribute("transform","translate(".concat(q,", ").concat(W,")")),V&&V.setAttribute("fill",P),J&&(J.textContent="+".concat(D),J.setAttribute("fill",Q)),U&&U.setAttribute("stroke",P)}else null==G||G.setAttribute("visibility","hidden"),null==K||K.setAttribute("visibility","hidden");var _=a.current["guideline-down-stroke"],tt=a.current["guideline-down-badge"],et=a.current["guideline-down-arrow"],nt=a.current["guideline-down-text"],it=a.current["guideline-down-badge-rect"];if(j>0){var rt=Math.min(E-15,H-k-15);Z=Math.min(15,Math.abs(q-O),Math.max(0,rt-z)),$="M ".concat(O,",").concat(z," L ").concat(q-Z,",").concat(z," Q ").concat(q,",").concat(z," ").concat(q,",").concat(z+Z," L ").concat(q,",").concat(rt);null==_||_.setAttribute("visibility","visible"),null==_||_.setAttribute("d",$),null==_||_.setAttribute("stroke",P),null==tt||tt.setAttribute("visibility","visible"),null==tt||tt.setAttribute("transform","translate(".concat(q,", ").concat(rt,")")),et&&et.setAttribute("fill",P),nt&&(nt.textContent="+".concat(j),nt.setAttribute("fill",Q)),it&&it.setAttribute("stroke",P)}else null==_||_.setAttribute("visibility","hidden"),null==tt||tt.setAttribute("visibility","hidden")}}},[]),Mt=n(function(){Ct.current.length>0&&!Y.current||(null!==mt.current&&clearTimeout(mt.current),mt.current=setTimeout(function(){G.current(),mt.current=null},50))},[]),It=n(function(t){if(null!==_.current&&tt.current&&Math.abs(t.currentTarget.scrollTop-_.current)<=2){var e=tt.current;_.current=null,tt.current=null,e()}if(!xt.current&&!V.current){if(L&&J&&(D.current||M.size>0)){var n=t.currentTarget,i=l.current,c=u.current,a=n===i?c:n===c?i:null;if(n&&a){var d=function(){var t,e,n,i,c,o,l,u,a,d,s,v=z.current,h=P.current;if(null===v)return{leftAnchor:null,rightAnchor:null};if("string"==typeof v&&v.includes(r)){var g=v.split(r),f="".concat(g[0]).concat(r).concat(g[1]);return{leftAnchor:(null===(t=R.current[f])||void 0===t?void 0:t.current)||(null===(e=x.current[g[2]])||void 0===e?void 0:e.current)||(null===(n=b.current[Number(g[2])])||void 0===n?void 0:n.current)||null,rightAnchor:(null===(i=C.current[f])||void 0===i?void 0:i.current)||(null===(c=m.current[g[3]])||void 0===c?void 0:c.current)||(null===(o=y.current[Number(g[3])])||void 0===o?void 0:o.current)||null}}var p=Number(v),B=null!==h?Number(h):p;return{leftAnchor:(null===(l=R.current[p])||void 0===l?void 0:l.current)||(null===(u=A.current[p])||void 0===u?void 0:u.current)||(null===(a=b.current[p])||void 0===a?void 0:a.current)||null,rightAnchor:(null===(d=C.current[B])||void 0===d?void 0:d.current)||(null===(s=y.current[B])||void 0===s?void 0:s.current)||null}}(),s=d.leftAnchor,v=d.rightAnchor,h=n===i?s:v,g=n===i?v:s,f=null;if(h&&g){var p=h.getBoundingClientRect(),B=g.getBoundingClientRect(),S=a.getBoundingClientRect(),I=p.top+p.height/2;f=B.top-S.top+a.scrollTop+B.height/2-(I-S.top)}else{var T=Math.max(0,n.scrollHeight-n.clientHeight),F=Math.max(0,a.scrollHeight-a.clientHeight);f=T>0?n.scrollTop/T*F:n.scrollTop}var H=Math.max(0,a.scrollHeight-a.clientHeight);f=Math.max(0,Math.min(f,H)),Math.abs(a.scrollTop-f)>1&&(xt.current=!0,a.scrollTop=f,requestAnimationFrame(function(){xt.current=!1}))}}L||Mt(),yt.current||(yt.current=!0,requestAnimationFrame(function(){var t,e,n,i,c,a,d;if(D.current){var s=l.current,v=u.current;if(s&&v&&O.current){if(!j.current){var h=z.current,g=void 0;if("string"==typeof h&&h.includes(r)){var f=h.split(r),p="".concat(f[0]).concat(r).concat(f[1]);g=null===(t=R.current[p])||void 0===t?void 0:t.current}else g=null===(e=R.current[h])||void 0===e?void 0:e.current;if(g){var b=g.getBoundingClientRect();j.current={badgeScreenY:b.top+b.height/2,initialScrollTop:s.scrollTop,leftTop:s.getBoundingClientRect().top,leftBottom:s.getBoundingClientRect().top+s.clientHeight,cTop:null!==(i=null===(n=o.current)||void 0===n?void 0:n.getBoundingClientRect().top)&&void 0!==i?i:0}}}if(j.current){var y=j.current,x=s.scrollTop-y.initialScrollTop,m=y.badgeScreenY-x,C=((c=m,a=y.leftTop,d=y.leftBottom,Math.max(a,Math.min(d,c)))-y.cTop).toString(),A=m>=y.leftTop-4&&m<=y.leftBottom+4;O.current.setAttribute("y1",C),O.current.setAttribute("y2",C),O.current.setAttribute("visibility",A?"visible":"hidden")}}}St(),yt.current=!1}))}},[St,L,J,M,Mt]);return i(function(){G.current=Bt},[Bt]),i(function(){var t=setTimeout(Mt,250),e=function(){return U.current()};return window.addEventListener("resize",e),function(){clearTimeout(t),null!==mt.current&&clearTimeout(mt.current),null!==K.current&&clearTimeout(K.current),window.removeEventListener("resize",e)}},[W,Z,$,g,B,S,v,h,et,Mt,I,T,N,M]),{lines:rt,setLines:ct,overallConnector:lt,setOverallConnector:ut,connectedLines:vt,setConnectedLines:ht,svgDimensions:ft,cachedConnectedPositions:Ct,calculateLines:Bt,calculateLinesRef:G,calculateLinesDebounced:Mt,handleColumnScroll:It}};export{c as useLinesCalculator};
|
|
1
|
+
import{useState as t,useRef as e,useCallback as n,useEffect as i}from"react";import{DEVIATION_BADGE_SEPARATOR as r}from"../CognitiveComparehelpers.js";import{getVisibleGuidelineTargets as c}from"../Guidelines/utils/guidelineTargets.js";var o=function(o){var l=o.containerRef,u=o.leftContainerRef,a=o.rightContainerRef;o.svgContainerRef;var d=o.pathRefs,s=o.leftHeaderRef,v=o.rightHeaderRef,h=o.proposedSections,g=o.existingSections,f=o.visibleFields,p=o.leftRefs,b=o.rightRefs,y=o.sectionLeftRefs,x=o.sectionRightRefs,m=o.subSectionLeftRefs,R=o.subSectionRightRefs,C=o.lhsBadgeRefs,B=o.rhsBadgeRefs,A=o.sectionRowRefs,S=o.expandedSections,M=o.expandedSubSections,T=o.connectedSections,I=o.isSideBySide,L=o.activeSideBySideSection,F=o.maintainRelativeOrder,H=o.isGuidelineMode,w=o.cognitiveMap,k=o.getSectionCompareStyle,E=o.getSubSectionCompareStyle,N=o.getDeviationStyleByKey,Y=o.isArrowVisible,D=o.isAnimatingRef,j=o.isSideBySideRef,O=o.sideBySideCacheRef,z=o.sideBySideLineRef,P=o.activeSideBySideSectionRef,Q=o.activeSideBySideRightSectionRef,X=o.connectedLines,G=o.setConnectedLines,q=o.cachedConnectedPositions,K=o.calculateLinesRef,V=o.resizeTimerRef,J=o.scrollLock,U=o.scrollSyncLocked,W=o.handleResizeRef,Z=o.activeProposed,$=o.existingRule,_=o.analysisData,tt=o.pendingScrollTargetRef,et=o.pendingScrollCallbackRef,nt=o.resolvedComparisonConfig,it=o.getFieldData,rt=t([]),ct=rt[0],ot=rt[1],lt=t(null),ut=lt[0],at=lt[1],dt=t([]),st=dt[0],vt=dt[1],ht=null!=X?X:st,gt=null!=G?G:vt,ft=t({width:0,height:0}),pt=ft[0],bt=ft[1],yt=e(!1),xt=e(!1),mt=e(!1),Rt=e(null),Ct=e([]),Bt=null!=q?q:Ct,At=function(t,e,n,i,r,c,o){if(Math.abs(i-e)<=1)return c&&o?"M ".concat(t,",").concat(e," L ").concat(n,",").concat(i):c&&!o?"M ".concat(t,",").concat(e," L ").concat(r,",").concat(e):!c&&o?"M ".concat(r,",").concat(e," L ").concat(n,",").concat(i):"M ".concat(r,",").concat(e," L ").concat(r,",").concat(i);var l=Math.min(15,Math.abs(r-t),Math.abs(i-e)/2),u=Math.min(15,Math.abs(n-r),Math.abs(i-e)/2),a=i>e?l:-l,d=i>e?u:-u,s=n>r?u:-u;return c&&o?"M ".concat(t,",").concat(e," L ").concat(r-l,",").concat(e," Q ").concat(r,",").concat(e," ").concat(r,",").concat(e+a," L ").concat(r,",").concat(i-d," Q ").concat(r,",").concat(i," ").concat(r+s,",").concat(i," L ").concat(n,",").concat(i):c&&!o?"M ".concat(t,",").concat(e," L ").concat(r-l,",").concat(e," Q ").concat(r,",").concat(e," ").concat(r,",").concat(e+a," L ").concat(r,",").concat(i):!c&&o?"M ".concat(r,",").concat(e," L ").concat(r,",").concat(i-d," Q ").concat(r,",").concat(i," ").concat(r+s,",").concat(i," L ").concat(n,",").concat(i):"M ".concat(r,",").concat(e," L ").concat(r,",").concat(i)},St=n(function(){var t,e,n,i,o,d,A,Y,j,O,z,P,Q,X,G,q,K,V;if(!yt.current&&!D.current){yt.current=!0;try{if(!l.current)return;var J=function(t){var e=t.split("-"),n=e[0];if(!S[n]&&!1===F)return!1;if(F&&!S["left-".concat(n)]&&!S["right-".concat(n)]&&!S[n])return!1;for(var i=n,r=1;r<e.length-1;r++)if(i+="-".concat(e[r]),!M[i])return!1;return!0},U=l.current.getBoundingClientRect();bt({width:U.width,height:U.height});var W=[];if(f.forEach(function(t){var e,n,i=t.key,r=null===(e=p.current[i])||void 0===e?void 0:e.current,c=null===(n=b.current[i])||void 0===n?void 0:n.current;r&&c&&(r.style.height="auto",c.style.height="auto",r.style.minHeight="0px",c.style.minHeight="0px")}),!D.current){for(var Z=0;Z<Math.max(h.length,g.length);Z++){var $=null===(t=y.current[Z])||void 0===t?void 0:t.current,_=null===(e=x.current[Z])||void 0===e?void 0:e.current;$&&($.style.height="auto",$.style.minHeight="0px"),_&&(_.style.height="auto",_.style.minHeight="0px")}F||Object.keys(m.current).forEach(function(t){var e,n;if(J(t)){var i=null===(e=m.current[t])||void 0===e?void 0:e.current,r=null===(n=R.current[t])||void 0===n?void 0:n.current;i&&r&&(i.style.height="auto",r.style.height="auto",i.style.minHeight="0px",r.style.minHeight="0px")}})}var tt={};f.forEach(function(t){var e,n,i=t.key,r=null===(e=p.current[i])||void 0===e?void 0:e.current,c=null===(n=b.current[i])||void 0===n?void 0:n.current;if(r&&c){var o=r.getBoundingClientRect(),l=c.getBoundingClientRect();tt[i]=Math.max(o.height,l.height)}});var et={left:{},right:{}},nt={};if(!D.current)if(F){if(I&&null!==L)if("number"==typeof L){var it=L,rt=h[it],ct=null===(o=y.current[it])||void 0===o?void 0:o.current;ct&&rt&&(rt.refIndexes||[]).forEach(function(t){var e,n=g.findIndex(function(e){return e.selfIndex===t}),i=null===(e=x.current[n])||void 0===e?void 0:e.current;if(i&&(S["left-".concat(it)]||S["right-".concat(n)])){var r=Math.max(ct.getBoundingClientRect().height,i.getBoundingClientRect().height);et.left[it]=Math.max(et.left[it]||0,r),et.right[n]=Math.max(et.right[n]||0,r)}})}else{var lt=L.split(r)[2];if(lt){$=null===(d=m.current[lt])||void 0===d?void 0:d.current,_=null===(A=R.current[lt])||void 0===A?void 0:A.current;if($&&_){ut=Math.max($.getBoundingClientRect().height,_.getBoundingClientRect().height);nt[lt]=Math.max(nt[lt]||0,ut)}}}}else{Object.keys(m.current).forEach(function(t){var e,n;if(J(t)){var i=null===(e=m.current[t])||void 0===e?void 0:e.current,r=null===(n=R.current[t])||void 0===n?void 0:n.current;if(i&&r&&null!==i.offsetParent&&null!==r.offsetParent){var c=i.getBoundingClientRect(),o=r.getBoundingClientRect(),l=Math.max(c.height,o.height);nt[t]=l,i.style.minHeight="".concat(l,"px"),r.style.minHeight="".concat(l,"px")}}});for(Z=0;Z<Math.min(h.length,g.length);Z++){var $=null===(n=y.current[Z])||void 0===n?void 0:n.current,_=null===(i=x.current[Z])||void 0===i?void 0:i.current;if($&&_){var ut=Math.max($.getBoundingClientRect().height,_.getBoundingClientRect().height);et.left[Z]=ut,et.right[Z]=ut}}}if(f.forEach(function(t){var e,n,i=t.key,r=null===(e=p.current[i])||void 0===e?void 0:e.current,c=null===(n=b.current[i])||void 0===n?void 0:n.current;if(r&&c){var o=tt[i];r.style.minHeight="".concat(o,"px"),c.style.minHeight="".concat(o,"px")}}),D.current||(Object.entries(et.left).forEach(function(t){var e,n=t[0],i=t[1],r=null===(e=y.current[Number(n)])||void 0===e?void 0:e.current;r&&(r.style.minHeight="".concat(i,"px"))}),Object.entries(et.right).forEach(function(t){var e,n=t[0],i=t[1],r=null===(e=x.current[Number(n)])||void 0===e?void 0:e.current;r&&(r.style.minHeight="".concat(i,"px"))}),F||Object.keys(nt).forEach(function(t){var e,n,i=null===(e=m.current[t])||void 0===e?void 0:e.current,r=null===(n=R.current[t])||void 0===n?void 0:n.current;if(i&&r&&nt[t]){var c=nt[t];i.style.minHeight="".concat(c,"px"),r.style.minHeight="".concat(c,"px")}})),!H){h.forEach(function(t,e){var n,i=t.continuationSourceRowId?h.findIndex(function(e){return e.comparisonRowId===t.continuationSourceRowId}):-1,r=i>=0?i:e,c=null===(n=y.current[r])||void 0===n?void 0:n.current;if(c){var o=function(t,e){if(!F)return g[e]?[e]:[];var n=(t.refIndexes||[]).map(function(t){return g.findIndex(function(e){return e.selfIndex===t})}).filter(function(t){return-1!==t});return!n.length&&g[e]?[e]:Array.from(new Set(n))}(t,e);o.forEach(function(t){var n,o,l,d,s,v,f,p,b,y,m,R,C=null===(n=x.current[t])||void 0===n?void 0:n.current;if(C){var B=c.getBoundingClientRect(),A=C.getBoundingClientRect(),S=B.right-U.left,M=A.left-U.left,T=B.top+18-U.top,H=A.top+18-U.top;if(F&&I&&L===e){var E=null!==(l=null===(o=u.current)||void 0===o?void 0:o.getBoundingClientRect().top)&&void 0!==l?l:0,N=null!==(s=null===(d=a.current)||void 0===d?void 0:d.getBoundingClientRect().top)&&void 0!==s?s:0,Y=E+(null!==(f=null===(v=u.current)||void 0===v?void 0:v.clientHeight)&&void 0!==f?f:1/0),D=N+(null!==(b=null===(p=a.current)||void 0===p?void 0:p.clientHeight)&&void 0!==b?b:1/0),j=function(t,e,n){return Math.max(e,Math.min(n,t))};T=j(B.top+18,E,Y)-U.top,H=j(A.top+18,N,D)-U.top}var O=k(r);O&&W.push({id:"line-".concat(r,"-").concat(t),x1:S,y1:T,x2:M,y2:H,style:O,sectionIdx:r,targetRightIdx:t,isSubSection:!1,isMappingContinuation:i>=0,hasCognitive:!!((null===(y=h[r])||void 0===y?void 0:y.cognitiveData)||(null===(m=g[t])||void 0===m?void 0:m.cognitiveData)||(null===(R=h[r])||void 0===R?void 0:R.nodeId)&&w[h[r].nodeId])})}})}})}if(!H&&I&&"string"==typeof L&&L.includes(r)){var dt=L.split(r),st=dt[0],vt=dt[1],ht=dt[2],ft=(dt[3],"".concat(st).concat(r).concat(vt)),pt=null===(Y=C.current[ft])||void 0===Y?void 0:Y.current,xt=null===(j=B.current[ft])||void 0===j?void 0:j.current;if(pt&&xt){var mt=pt.getBoundingClientRect(),Rt=xt.getBoundingClientRect(),Ct=mt.right-U.left,St=Rt.left-U.left,Tt=mt.top+mt.height/2-U.top,It=Rt.top+Rt.height/2-U.top;if(F){var Lt=null!==(z=null===(O=u.current)||void 0===O?void 0:O.getBoundingClientRect().top)&&void 0!==z?z:0,Ft=null!==(Q=null===(P=a.current)||void 0===P?void 0:P.getBoundingClientRect().top)&&void 0!==Q?Q:0,Ht=Lt+(null!==(G=null===(X=u.current)||void 0===X?void 0:X.clientHeight)&&void 0!==G?G:1/0),wt=Ft+(null!==(K=null===(q=a.current)||void 0===q?void 0:q.clientHeight)&&void 0!==K?K:1/0),kt=function(t,e,n){return Math.max(e,Math.min(n,t))};Tt=kt(mt.top+mt.height/2,Lt,Ht)-U.top,It=kt(Rt.top+Rt.height/2,Ft,wt)-U.top}var Et=null!==(V=N(st,vt))&&void 0!==V?V:E(ht);Et&&W.push({id:"line-subsec-".concat(ft),x1:Ct,y1:Tt,x2:St,y2:It,style:Et,sectionIdx:Number(ht.split("-")[0]),isSubSection:!0,subSectionKeyPath:L})}}if(ot(W),s.current&&v.current){var Nt=s.current.getBoundingClientRect(),Yt=v.current.getBoundingClientRect(),Dt=(Nt.top+Nt.height/2-U.top+Yt.top+Yt.height/2-U.top)/2;at({x1:Nt.right-U.left,x2:Yt.left-U.left,y:Dt})}else at(null);if(T.size>0){var jt=[],Ot=u.current,zt=a.current;if(Ot&&zt){var Pt=[],Qt=Ot.getBoundingClientRect().top,Xt=zt.getBoundingClientRect().top,Gt=Qt+Ot.clientHeight,qt=Xt+zt.clientHeight,Kt=Ot.scrollTop,Vt=zt.scrollTop,Jt=U.top,Ut=function(t,e,n){return Math.max(e,Math.min(n,t))};T.forEach(function(t){var e,n,i,o,l,u,a,d,s;if(H){var v=null,f=null,p=null;if("string"==typeof t&&t.includes(r)){var b=t.split(r),y=b[0],x=b[1],m=b[2],R="".concat(y).concat(r).concat(x);v=null===(e=C.current[R])||void 0===e?void 0:e.current,p=null!==(n=N(y,x))&&void 0!==n?n:E(m),f=Number((null==m?void 0:m.split("-")[0])||0)}else f=Number(t),v=null===(i=C.current[f])||void 0===i?void 0:i.current,p=k(f);if(!v)return;var A=c(zt);A.forEach(function(e,n){var i=v.getBoundingClientRect(),c=e.getBoundingClientRect(),o=i.right-U.left,l=c.left-U.left-0,u=o+75,a=i.top+i.height/2,d=c.top+c.height/2,s=a-Qt+Kt,h=d-Xt+Vt,g="conn-guide-".concat(t,"-").concat(n),f="";"string"==typeof t&&t.includes(r)?f=(t.split(r)[2]||"").split("-").map(function(t){return Number(t)+1}).join("."):f=String(Number(t)+1);var b=String.fromCharCode(97+n),y=1===A.length?null:"".concat(f,"(").concat(b,")");Pt.push({lhsScrollY:s,rhsScrollY:h,x1:o,x2:l,containerTop:Jt,leftIdx:t,rhsArrayIdx:n,styleColor:(null==p?void 0:p.badgeBorder)||"#6366F1",styleBg:(null==p?void 0:p.badgeBg)||"#FFFFFF",styleText:(null==p?void 0:p.badgeText)||"#A16207",styleId:g,centerX:u});var x=Ut(a,Qt,Gt),m=Ut(d,Xt,qt),R=x-Jt,C=m-Jt,B=At(o,R,l,C,u,a>=Qt-4&&a<=Gt+4,d>=Xt-4&&d<=qt+4);jt.push({id:g,pathD:B,style:p,leftIdx:t,rhsArrayIdx:n,x1:o,x2:l,y1:R,y2:C,centerX:u,matchLabel:y,isGuideline:!0})})}else if("string"==typeof t&&t.includes(r)){var S=t.split(r),M=(y=S[0],x=S[1],m=S[2],S[3],R="".concat(y).concat(r).concat(x),null===(o=C.current[R])||void 0===o?void 0:o.current),T=null===(l=B.current[R])||void 0===l?void 0:l.current;if(!M||!T)return;var I=M.getBoundingClientRect(),L=T.getBoundingClientRect(),w=null!==(u=N(y,x))&&void 0!==u?u:E(m),Y=I.right-U.left,D=L.left-U.left-0,j=Y+75,O=I.top+I.height/2,z=L.top+L.height/2,P=O-Qt+Kt,Q=z-Xt+Vt,X="conn-subsec-".concat(R),G=((m||"").split("-").map(function(t){return Number(t)+1}).join("."),null);Pt.push({lhsScrollY:P,rhsScrollY:Q,x1:Y,x2:D,containerTop:Jt,leftIdx:t,rhsArrayIdx:t,styleColor:(null==w?void 0:w.badgeBorder)||"#6366F1",styleBg:(null==w?void 0:w.badgeBg)||"#FFFFFF",styleText:(null==w?void 0:w.badgeText)||"#A16207",styleId:X,centerX:j});var q=Ut(O,Qt,Gt),K=Ut(z,Xt,qt),V=At(Y,_=q-Jt,D,tt=K-Jt,j,O>=Qt-4&&O<=Gt+4,z>=Xt-4&&z<=qt+4);jt.push({id:X,pathD:V,style:w,leftIdx:t,rhsArrayIdx:t,x1:Y,x2:D,y1:_,y2:tt,matchLabel:G})}else if(F){var J=t,W=h[J];if(!(null===(s=null==W?void 0:W.refIndexes)||void 0===s?void 0:s.length))return;W.refIndexes.forEach(function(e,n){var i,r,c=g.findIndex(function(t){return t.selfIndex===e});if(-1!==c){var o=null===(i=C.current[J])||void 0===i?void 0:i.current,l=null===(r=B.current[c])||void 0===r?void 0:r.current;if(o&&l){var u=o.getBoundingClientRect(),a=l.getBoundingClientRect(),d=k(J),s=u.right-U.left,v=a.left-U.left-0,h=s+75,f=u.top+u.height/2,p=a.top+a.height/2,b=f-Qt+Kt,y=p-Xt+Vt,x="conn-".concat(J,"-").concat(c),m=String(Number(t)+1),R=String.fromCharCode(97+n),A=1===W.refIndexes.length?null:"".concat(m,"(").concat(R,")");Pt.push({lhsScrollY:b,rhsScrollY:y,x1:s,x2:v,containerTop:Jt,leftIdx:J,rhsArrayIdx:c,styleColor:(null==d?void 0:d.badgeBorder)||"#6366F1",styleBg:(null==d?void 0:d.badgeBg)||"#FFFFFF",styleText:(null==d?void 0:d.badgeText)||"#A16207",styleId:x,centerX:h});var S=Ut(f,Qt,Gt),M=Ut(p,Xt,qt),T=S-Jt,I=M-Jt,L=At(s,T,v,I,h,f>=Qt-4&&f<=Gt+4,p>=Xt-4&&p<=qt+4);jt.push({id:x,pathD:L,style:d,leftIdx:J,rhsArrayIdx:c,x1:s,x2:v,y1:T,y2:I,matchLabel:A})}}})}else{var Z=t,$=Z;M=null===(a=C.current[Z])||void 0===a?void 0:a.current,T=null===(d=B.current[$])||void 0===d?void 0:d.current;if(!M||!T)return;I=M.getBoundingClientRect(),L=T.getBoundingClientRect(),w=k(Z),Y=I.right-U.left,D=L.left-U.left-0,j=Y+75,O=I.top+I.height/2,z=L.top+L.height/2,P=O-Qt+Kt,Q=z-Xt+Vt,X="conn-".concat(Z,"-").concat($),String(Number(t)+1),G=null;Pt.push({lhsScrollY:P,rhsScrollY:Q,x1:Y,x2:D,containerTop:Jt,leftIdx:Z,rhsArrayIdx:$,styleColor:(null==w?void 0:w.badgeBorder)||"#6366F1",styleBg:(null==w?void 0:w.badgeBg)||"#FFFFFF",styleText:(null==w?void 0:w.badgeText)||"#A16207",styleId:X,centerX:j});var _,tt;q=Ut(O,Qt,Gt),K=Ut(z,Xt,qt),V=At(Y,_=q-Jt,D,tt=K-Jt,j,O>=Qt-4&&O<=Gt+4,z>=Xt-4&&z<=qt+4);jt.push({id:X,pathD:V,style:w,leftIdx:Z,rhsArrayIdx:$,x1:Y,x2:D,y1:_,y2:tt,matchLabel:G})}}),Bt.current=Pt}gt(jt),setTimeout(function(){return Mt()},10)}else gt([]),Bt.current=[],setTimeout(function(){return Mt()},10)}catch(t){console.error("Line render safe fail: ",t)}finally{yt.current=!1}}},[f,h,g,w,nt,it,k,N,F,I,L,T,S,M,H]),Mt=n(function(){var t,e,n,i,r,c,o,s,v,h,g,f,p,b,y,x,m,R,C,B=Bt.current;if(!B.length)return null===(t=d.current["guideline-up-stroke"])||void 0===t||t.setAttribute("visibility","hidden"),null===(e=d.current["guideline-up-badge"])||void 0===e||e.setAttribute("visibility","hidden"),null===(n=d.current["guideline-down-stroke"])||void 0===n||n.setAttribute("visibility","hidden"),void(null===(i=d.current["guideline-down-badge"])||void 0===i||i.setAttribute("visibility","hidden"));if(!D.current){var A=null!==(c=null===(r=u.current)||void 0===r?void 0:r.scrollTop)&&void 0!==c?c:0,S=null!==(s=null===(o=a.current)||void 0===o?void 0:o.scrollTop)&&void 0!==s?s:0,M=null!==(h=null===(v=u.current)||void 0===v?void 0:v.clientHeight)&&void 0!==h?h:1/0,T=null!==(f=null===(g=a.current)||void 0===g?void 0:g.clientHeight)&&void 0!==f?f:1/0,I=null!==(b=null===(p=u.current)||void 0===p?void 0:p.getBoundingClientRect().top)&&void 0!==b?b:0,L=null!==(x=null===(y=a.current)||void 0===y?void 0:y.getBoundingClientRect().top)&&void 0!==x?x:0,F=I+M,H=L+T,w=null===(m=l.current)||void 0===m?void 0:m.getBoundingClientRect(),k=null!==(R=null==w?void 0:w.top)&&void 0!==R?R:0,E=null!==(C=null==w?void 0:w.height)&&void 0!==C?C:1/0,N=function(t,e,n){return Math.max(e,Math.min(n,t))},Y=0,j=0,O=0,z=0,P="#6366F1",Q="#A16207",X=!1,G=0;if(B.forEach(function(t){var e=t.lhsScrollY-A+I,n=t.rhsScrollY-S+L,i=d.current[t.styleId+"-stroke"],r=d.current[t.styleId+"-bg"],c=d.current[t.styleId+"-btn"],o=d.current[t.styleId+"-number"];if(i||r){var l=N(e,I,F),u=N(n,L,H),a=l-k,s=u-k,v=e>=I-4&&e<=F+4,h=n>=L-4&&n<=H+4,g=!0;X=!0;var f=t.centerX||t.x1+75;0===O&&(O=t.x1,z=a,G=f,P=t.styleColor,t.styleBg,Q=t.styleText||"#A16207"),n<L-4?(Y++,g=!1):n>H+4&&(j++,g=!1);var p=At(t.x1,a,t.x2,s,G,v,h);i&&(g&&p?(i.setAttribute("visibility","visible"),i.setAttribute("d",p)):i.setAttribute("visibility","hidden")),r&&(g&&p?(r.setAttribute("visibility","visible"),r.setAttribute("d",p)):r.setAttribute("visibility","hidden")),c&&(v&&g?(c.setAttribute("visibility","visible"),c.setAttribute("y",String(a-12))):c.setAttribute("visibility","hidden")),o&&(v&&g?(o.setAttribute("visibility","visible"),o.setAttribute("transform","translate(".concat(t.x2-42,", ").concat(s,")"))):o.setAttribute("visibility","hidden"))}}),X&&G>0){var q=d.current["guideline-up-stroke"],K=d.current["guideline-up-badge"],V=d.current["guideline-up-arrow"],J=d.current["guideline-up-text"],U=d.current["guideline-up-badge-rect"];if(Y>0){var W=Math.max(15,L-k+15),Z=Math.min(15,Math.abs(G-O),Math.max(0,z-W)),$="M ".concat(O,",").concat(z," L ").concat(G-Z,",").concat(z," Q ").concat(G,",").concat(z," ").concat(G,",").concat(z-Z," L ").concat(G,",").concat(W);null==q||q.setAttribute("visibility","visible"),null==q||q.setAttribute("d",$),null==q||q.setAttribute("stroke",P),null==K||K.setAttribute("visibility","visible"),null==K||K.setAttribute("transform","translate(".concat(G,", ").concat(W,")")),V&&V.setAttribute("fill",P),J&&(J.textContent="+".concat(Y),J.setAttribute("fill",Q)),U&&U.setAttribute("stroke",P)}else null==q||q.setAttribute("visibility","hidden"),null==K||K.setAttribute("visibility","hidden");var _=d.current["guideline-down-stroke"],tt=d.current["guideline-down-badge"],et=d.current["guideline-down-arrow"],nt=d.current["guideline-down-text"],it=d.current["guideline-down-badge-rect"];if(j>0){var rt=Math.min(E-15,H-k-15);Z=Math.min(15,Math.abs(G-O),Math.max(0,rt-z)),$="M ".concat(O,",").concat(z," L ").concat(G-Z,",").concat(z," Q ").concat(G,",").concat(z," ").concat(G,",").concat(z+Z," L ").concat(G,",").concat(rt);null==_||_.setAttribute("visibility","visible"),null==_||_.setAttribute("d",$),null==_||_.setAttribute("stroke",P),null==tt||tt.setAttribute("visibility","visible"),null==tt||tt.setAttribute("transform","translate(".concat(G,", ").concat(rt,")")),et&&et.setAttribute("fill",P),nt&&(nt.textContent="+".concat(j),nt.setAttribute("fill",Q)),it&&it.setAttribute("stroke",P)}else null==_||_.setAttribute("visibility","hidden"),null==tt||tt.setAttribute("visibility","hidden")}}},[]),Tt=n(function(){Bt.current.length>0&&!D.current||(null!==Rt.current&&clearTimeout(Rt.current),Rt.current=setTimeout(function(){K.current(),Rt.current=null},50))},[]),It=n(function(t){if(null!==tt.current&&et.current&&Math.abs(t.currentTarget.scrollTop-tt.current)<=2){var e=et.current;tt.current=null,et.current=null,e()}if(!mt.current&&!J.current){if(F&&U&&(j.current||T.size>0)){var n=t.currentTarget,i=u.current,c=a.current,o=n===i?c:n===c?i:null;if(n&&o){var d=function(){var t,e,n,i,c,o,l,u,a,d,s,v=P.current,h=Q.current;if(null===v)return{leftAnchor:null,rightAnchor:null};if("string"==typeof v&&v.includes(r)){var g=v.split(r),f="".concat(g[0]).concat(r).concat(g[1]);return{leftAnchor:(null===(t=C.current[f])||void 0===t?void 0:t.current)||(null===(e=m.current[g[2]])||void 0===e?void 0:e.current)||(null===(n=y.current[Number(g[2])])||void 0===n?void 0:n.current)||null,rightAnchor:(null===(i=B.current[f])||void 0===i?void 0:i.current)||(null===(c=R.current[g[3]])||void 0===c?void 0:c.current)||(null===(o=x.current[Number(g[3])])||void 0===o?void 0:o.current)||null}}var p=Number(v),b=null!==h?Number(h):p;return{leftAnchor:(null===(l=C.current[p])||void 0===l?void 0:l.current)||(null===(u=A.current[p])||void 0===u?void 0:u.current)||(null===(a=y.current[p])||void 0===a?void 0:a.current)||null,rightAnchor:(null===(d=B.current[b])||void 0===d?void 0:d.current)||(null===(s=x.current[b])||void 0===s?void 0:s.current)||null}}(),s=d.leftAnchor,v=d.rightAnchor,h=n===i?s:v,g=n===i?v:s,f=null;if(h&&g){var p=h.getBoundingClientRect(),b=g.getBoundingClientRect(),S=o.getBoundingClientRect(),M=p.top+p.height/2;f=b.top-S.top+o.scrollTop+b.height/2-(M-S.top)}else{var I=Math.max(0,n.scrollHeight-n.clientHeight),L=Math.max(0,o.scrollHeight-o.clientHeight);f=I>0?n.scrollTop/I*L:n.scrollTop}var H=Math.max(0,o.scrollHeight-o.clientHeight);f=Math.max(0,Math.min(f,H)),Math.abs(o.scrollTop-f)>1&&(mt.current=!0,o.scrollTop=f,requestAnimationFrame(function(){mt.current=!1}))}}F||Tt(),xt.current||(xt.current=!0,requestAnimationFrame(function(){var t,e,n,i,c,o,d;if(j.current){var s=u.current,v=a.current;if(s&&v&&z.current){if(!O.current){var h=P.current,g=void 0;if("string"==typeof h&&h.includes(r)){var f=h.split(r),p="".concat(f[0]).concat(r).concat(f[1]);g=null===(t=C.current[p])||void 0===t?void 0:t.current}else g=null===(e=C.current[h])||void 0===e?void 0:e.current;if(g){var b=g.getBoundingClientRect();O.current={badgeScreenY:b.top+b.height/2,initialScrollTop:s.scrollTop,leftTop:s.getBoundingClientRect().top,leftBottom:s.getBoundingClientRect().top+s.clientHeight,cTop:null!==(i=null===(n=l.current)||void 0===n?void 0:n.getBoundingClientRect().top)&&void 0!==i?i:0}}}if(O.current){var y=O.current,x=s.scrollTop-y.initialScrollTop,m=y.badgeScreenY-x,R=((c=m,o=y.leftTop,d=y.leftBottom,Math.max(o,Math.min(d,c)))-y.cTop).toString(),B=m>=y.leftTop-4&&m<=y.leftBottom+4;z.current.setAttribute("y1",R),z.current.setAttribute("y2",R),z.current.setAttribute("visibility",B?"visible":"hidden")}}}Mt(),xt.current=!1}))}},[Mt,F,U,T,Tt]);return i(function(){K.current=St},[St]),i(function(){var t=setTimeout(Tt,250),e=function(){return W.current()};return window.addEventListener("resize",e),function(){clearTimeout(t),null!==Rt.current&&clearTimeout(Rt.current),null!==V.current&&clearTimeout(V.current),window.removeEventListener("resize",e)}},[Z,$,_,f,S,M,h,g,nt,Tt,I,L,Y,T]),{lines:ct,setLines:ot,overallConnector:ut,setOverallConnector:at,connectedLines:ht,setConnectedLines:gt,svgDimensions:pt,cachedConnectedPositions:Bt,calculateLines:St,calculateLinesRef:K,calculateLinesDebounced:Tt,handleColumnScroll:It}};export{o as useLinesCalculator};
|
|
2
2
|
//# sourceMappingURL=useLinesCalculator.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{useState as e,useRef as n,useCallback as t,useEffect as r}from"react";import{DEVIATION_BADGE_SEPARATOR as i,resetClauseHighlight as l,smoothScrollTo as u}from"../CognitiveComparehelpers.js";var
|
|
1
|
+
import{useState as e,useRef as n,useCallback as t,useEffect as r}from"react";import{DEVIATION_BADGE_SEPARATOR as i,resetClauseHighlight as l,smoothScrollTo as u}from"../CognitiveComparehelpers.js";import{getVisibleGuidelineTargets as o}from"../Guidelines/utils/guidelineTargets.js";var c=function(c){var d=c.isGuidelineMode,s=c.maintainRelativeOrder,v=c.proposedSections,a=c.existingSections,p=c.leftContainerRef,g=c.rightContainerRef,f=c.scrollContainerRef,h=c.sectionLeftRefs,R=c.sectionRightRefs,S=c.subSectionLeftRefs,y=c.subSectionRightRefs,m=c.lhsBadgeRefs,B=c.rhsBadgeRefs,x=c.sectionRowRefs,C=c.sectionRightRowRefs,T=c.rhsTopSpacerRef,b=c.rhsBottomSpacerRef,A=c.lhsTopSpacerRef,w=c.lhsBottomSpacerRef,I=c.calculateLinesRef,L=c.setConnectedSections,F=c.setConnectedLines,N=c.cachedConnectedPositions,E=c.closeMoreFunctionsPopup,q=c.setErrorToast;c.moreFunctions,c.closeSummaryPopup;var H=e(!1),M=H[0],P=H[1],j=e(!1),z=j[0],G=j[1],V=e(!1),k=V[0],O=V[1],D=e(!1),J=D[0],K=D[1],Q=e(null),U=Q[0],W=Q[1],X=n(!1),Y=n(null),Z=n(!1),$=n(null),_=n(null),ee=n(null),ne=n(new Set),te=function(){ne.current.forEach(function(e){l(e)}),ne.current.clear()},re=function(e,n,t){var r,l,u,o,c,d,s,v,a,f,T,b,A=null,w=null,I=null,L=null,F=null,N=null,E=function(e,n){if(!e||!n)return!0;var t=e.getBoundingClientRect(),r=n.getBoundingClientRect();return t.bottom>=r.top&&t.top<=r.bottom};if(e){var q=n.split(i),H="".concat(q[0]).concat(i).concat(q[1]);A=(null===(r=S.current[q[2]])||void 0===r?void 0:r.current)||(null===(l=h.current[Number(q[2])])||void 0===l?void 0:l.current)||null,w=(null===(u=y.current[q[3]])||void 0===u?void 0:u.current)||(null===(o=R.current[Number(q[3])])||void 0===o?void 0:o.current)||null,I=(null===(c=m.current[H])||void 0===c?void 0:c.current)||A,L=(null===(d=B.current[H])||void 0===d?void 0:d.current)||w}else{var M=Number(n),P=null!==t?Number(t):M;A=(null===(s=h.current[M])||void 0===s?void 0:s.current)||null,w=(null===(v=R.current[P])||void 0===v?void 0:v.current)||null,F=(null===(a=m.current[M])||void 0===a?void 0:a.current)||null,N=(null===(f=B.current[P])||void 0===f?void 0:f.current)||null,I=F||(null===(T=x.current[M])||void 0===T?void 0:T.current)||A,L=N||(null===(b=C.current[P])||void 0===b?void 0:b.current)||w}if(A&&(A.style.paddingTop="0px"),w&&(w.style.paddingTop="0px"),e||(F&&(F.style.marginTop="0px"),N&&(N.style.marginTop="0px")),!e&&F&&N){var j=p.current,z=g.current;if(!E(F,j)||!E(N,z))return;var G=F.getBoundingClientRect(),V=N.getBoundingClientRect(),k=G.top-V.top;if(Math.abs(k)>32)return;k>0&&(N.style.marginTop="".concat(k,"px"))}else if(I&&L&&A&&w){G=I.getBoundingClientRect(),V=L.getBoundingClientRect();(k=G.top-V.top)>0&&(w.style.paddingTop="".concat(k,"px"))}},ie=t(function(){var e,n,t,r,l,u,o,c,d=$.current,s=_.current;if(null!==d)if("string"==typeof d&&d.includes(i)){var v=d.split(i),a=(null===(e=S.current[v[2]])||void 0===e?void 0:e.current)||(null===(n=h.current[Number(v[2])])||void 0===n?void 0:n.current)||null,p=(null===(t=y.current[v[3]])||void 0===t?void 0:t.current)||(null===(r=R.current[Number(v[3])])||void 0===r?void 0:r.current)||null;a&&(a.style.paddingTop="0px"),p&&(p.style.paddingTop="0px")}else{a=(null===(l=h.current[d])||void 0===l?void 0:l.current)||null,p=(null===(u=R.current[null!=s?s:d])||void 0===u?void 0:u.current)||null;a&&(a.style.paddingTop="0px"),p&&(p.style.paddingTop="0px");var g=(null===(o=m.current[d])||void 0===o?void 0:o.current)||null,f=(null===(c=B.current[null!=s?s:d])||void 0===c?void 0:c.current)||null;g&&(g.style.marginTop="0px"),f&&(f.style.marginTop="0px")}T.current&&(T.current.style.height="0px"),b.current&&(b.current.style.height="0px"),A.current&&(A.current.style.height="0px"),w.current&&(w.current.style.height="0px")},[]);r(function(){Z.current=M},[M]),r(function(){$.current=U},[U]);var le=t(function(){te(),P(!1),Z.current=!1,Y.current=null,ie(),W(null),$.current=null,_.current=null,G(!1),K(!1)},[ie]),ue=t(function(e,n,t){var r,l,c=null===(r=null==t?void 0:t.toggleIfSame)||void 0===r||r,S=null==t?void 0:t.onReady,y=null!==(l=null==t?void 0:t.sourceSide)&&void 0!==l?l:"left";if(E(),null!=e)if(!n||d){te();var H=M&&U===e;M&&null!==U&&ie(),H&&c?le():(L(new Set([e])),F([]),N.current=[],K(!0),X.current=!0,W(e),$.current=e,P(!0),Z.current=!0,G(!1),T.current&&(T.current.style.height="0px"),b.current&&(b.current.style.height="0px"),A.current&&(A.current.style.height="0px"),w.current&&(w.current.style.height="0px"),requestAnimationFrame(function(){var n=function(){var n,t,r,l,c,A,w,L,F,N,E,q="string"==typeof e&&e.includes(i),H=null,M=null,P=null;if(d){if(q){var j=e.split(i),z="".concat(j[0]).concat(i).concat(j[1]);H=(null===(n=m.current[z])||void 0===n?void 0:n.current)||null}else H=(null===(t=h.current[e])||void 0===t?void 0:t.current)||(null===(r=x.current[e])||void 0===r?void 0:r.current)||null;M=o(g.current)[0]||null,P=M?e:null}else if(q){j=e.split(i),z="".concat(j[0]).concat(i).concat(j[1]);H=(null===(l=m.current[z])||void 0===l?void 0:l.current)||null,M=(null===(c=B.current[z])||void 0===c?void 0:c.current)||null,P=M?e:null}else if(H=(null===(A=h.current[e])||void 0===A?void 0:A.current)||(null===(w=x.current[e])||void 0===w?void 0:w.current)||null,s){var V=v[e],k=(null==V?void 0:V.refIndexes)||[];if(k.length>0){var O=k[0],D=a.findIndex(function(e){return e.selfIndex===O});-1!==D&&(M=(null===(N=R.current[D])||void 0===N?void 0:N.current)||(null===(E=C.current[D])||void 0===E?void 0:E.current)||null,P=D)}}else M=(null===(L=R.current[e])||void 0===L?void 0:L.current)||(null===(F=C.current[e])||void 0===F?void 0:F.current)||null,P=M?e:null;_.current=P;var J=p.current,Q=g.current,U=function(){re(q,e,P),G(!0),I.current&&I.current(),X.current=!1,"right"===y&&Q?Q.dispatchEvent(new Event("scroll")):J&&J.dispatchEvent(new Event("scroll")),K(!1),null==S||S()};if(!H||!J)return X.current=!1,K(!1),void(null==S||S());if(M&&Q){if(!s){var W=0;W="right"===y?M?M.getBoundingClientRect().top:0:H?H.getBoundingClientRect().top:0;var Y=f.current,Z=(null==Y?void 0:Y.getBoundingClientRect().top)||0,$=Y?Y.scrollTop+W-Z-150:0;return Y?void u(Y,$,200,U):void U()}var ee=H.getBoundingClientRect().top-J.getBoundingClientRect().top+J.scrollTop,ne=M.getBoundingClientRect().top-Q.getBoundingClientRect().top+Q.scrollTop,te=200;if("left"===y){var ie=ne-(ee-J.scrollTop);ie<0&&T.current&&!d&&(T.current.style.height="".concat(Math.abs(ie),"px")),requestAnimationFrame(function(){var e,n=Q.scrollHeight-Q.clientHeight;if(ie<0)e=0;else{if(ie>n){var t=ie-n;return b.current&&!d&&(b.current.style.height="".concat(t+150,"px")),void requestAnimationFrame(function(){u(Q,ie,te,U)})}e=ie}u(Q,e,te,U)})}else{var le=ee-(ne-Q.scrollTop);requestAnimationFrame(function(){var e,n=J.scrollHeight-J.clientHeight;if(le<0)e=0;else{if(le>n)return void requestAnimationFrame(function(){return u(J,n,te,U)});e=le}u(J,e,te,U)})}}else U()};d?setTimeout(n,100):n()}))}else q("No counterpart exists for this section.")},[U,E,a,M,s,v,ie,le,d]);return{isSideBySide:M,setIsSideBySide:P,isArrowVisible:z,setIsArrowVisible:G,isResizing:k,setIsResizing:O,isSideBySideLoading:J,setIsSideBySideLoading:K,activeSideBySideSection:U,setActiveSideBySideSection:W,scrollLock:X,sideBySideCacheRef:Y,isSideBySideRef:Z,activeSideBySideSectionRef:$,activeSideBySideRightSectionRef:_,sideBySideLineRef:ee,highlightedClauseRefs:ne,clearClauseHighlight:te,applyAlignmentPadding:re,resetSideBySide:le,activateSideBySide:ue}};export{c as useSideBySide};
|
|
2
2
|
//# sourceMappingURL=useSideBySide.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__spreadArray as n,__assign as e}from"tslib";import{jsxs as l,jsx as i,Fragment as o}from"react/jsx-runtime";import{useMemo as t,useState as r,useRef as d,useEffect as a}from"react";import{ExternalLink as s,ChevronUp as c,ChevronDown as u}from"lucide-react";import v from"./CognitiveNonWebSearchReasoning.module.css.js";var h=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];return n.filter(Boolean).join(" ")},m=function(n){return n.split(/(\*\*.*?\*\*|__.*?__)/g).map(function(n,l){return n.startsWith("**")&&n.endsWith("**")||n.startsWith("__")&&n.endsWith("__")?i("strong",e({className:v.boldText},{children:n.slice(2,-2)}),l):n})},g=function(g){var p=g.item,f=g.headerTitle;g.index;var x=g.iconsConfig,y=g.DocumentTitle,b=g.previewCallback,N=g.bodyHeight,C=g.disableMaximize,I=void 0!==C&&C,k=g.splitterCustomStyle,T=void 0!==k&&k,H=g.themeTokens,L=g.classNames,B=g.styles,w=p.dataSource,z=p.confidence_score,S=p.trainingDataTitle,A=null==x?void 0:x.ChevronDownIcon,F=null==x?void 0:x.ChevronUpIcon,_=null==x?void 0:x.MaximizeIcon,D=null==x?void 0:x.CloseIcon,R=t(function(){var e=(w?w.replace(/\\n/g,"\n").replace(/\n+/g,"\n"):"").split(/(<highlight>[\s\S]*?<\/highlight>)/g),l=0,i=e.map(function(n){var e=n.startsWith("<highlight>"),i={text:e?n.replace(/<\/?highlight>/g,""):n,isHighlight:e,highlightIndex:e?l:-1};return e&&l++,i}),o=i.filter(function(n){return n.isHighlight}).length,t=[],r=[];return i.forEach(function(e){var l=e.text,i=e.isHighlight,o=e.highlightIndex;l.split("\n").forEach(function(e,l){l>0&&((r.length>0||t.length>0)&&t.push(n([],r,!0)),r=[]),e&&r.push({text:e,isHighlight:i,highlightIndex:o})})}),r.length>0&&t.push(n([],r,!0)),{processedLines:t.map(function(n){var e=n.map(function(n){return n.text}).join(""),l=e.match(/^(\s*)(-|\*|\d+\.)\s+(.*)$/);return{segments:n,isListItem:!!l,isHeader:!!e.match(/^(Title|Description|Training-basis):\s*(.*)$/i),indent:(null==l?void 0:l[1])||"",content:(null==l?void 0:l[3])||e}}),totalHighlights:o}},[w]),W=R.processedLines,j=R.totalHighlights,M=r(0),V=M[0],E=M[1],$=d(null),U=d(null),Y=d(null),q=d([]),G=d([]);a(function(){q.current=q.current.slice(0,j),G.current=G.current.slice(0,j)},[j]),a(function(){if(j>0){E(0);var n=setTimeout(function(){var n;null===(n=q.current[0])||void 0===n||n.scrollIntoView({behavior:"smooth",block:"center"})},50);return function(){return clearTimeout(n)}}},[j]);var J=function(n,e){setTimeout(function(){var l=e?G.current[n]:q.current[n];null==l||l.scrollIntoView({behavior:"smooth",block:"center"})},50)},K=function(n){if(void 0===n&&(n=!1),j){var e=V>0?V-1:j-1;E(e),J(e,n)}},O=function(n){if(void 0===n&&(n=!1),j){var e=V<j-1?V+1:0;E(e),J(e,n)}},P=function(n){var o=n?G:q,t=0;return W.map(function(n,r){n.isHeader&&(t=0),n.isListItem&&(t+=1);var d=function(){return n.segments.map(function(l,t){var r=l.isHighlight&&l.highlightIndex===V,d=l.text;return n.isListItem&&0===t&&(d=l.text.replace(/^(\s*)(-|\*|\d+\.)\s+/,"")),l.isHighlight?i("span",e({ref:function(n){n&&(o.current[l.highlightIndex]=n)},className:h(v.highlight,r?v.highlightActive:void 0,null==L?void 0:L.highlight,r?null==L?void 0:L.highlightActive:void 0),style:r?e(e({},null==B?void 0:B.highlight),null==B?void 0:B.highlightActive):null==B?void 0:B.highlight},{children:m(d)}),t):i("span",{children:m(d)},t)})};return n.isHeader?i("span",e({className:h(v.headerLine,null==L?void 0:L.headerLine),style:null==B?void 0:B.headerLine},{children:d()}),r):n.isListItem?l("span",e({className:h(v.listItemLine,null==L?void 0:L.listItemLine),style:e({paddingLeft:n.indent?"1rem":"0"},null==B?void 0:B.listItemLine)},{children:[l("span",e({className:h(v.listCounter,null==L?void 0:L.listCounter),style:null==B?void 0:B.listCounter},{children:[t,"."]})),i("span",{children:d()})]}),r):i("span",e({className:h(v.blockLine,null==L?void 0:L.blockLine),style:null==B?void 0:B.blockLine},{children:d()}),r)})},Q=function(n){return j>1?l("div",e({className:h(n?v.modalNavContainer:v.navigationContainer,n?null==L?void 0:L.modalNavContainer:null==L?void 0:L.navigationContainer),style:n?null==B?void 0:B.modalNavContainer:null==B?void 0:B.navigationContainer},{children:[F&&i("button",e({onClick:function(){return K(n)},className:h(n?v.modalNavButton:v.navButton,null==L?void 0:L.navButton),style:null==B?void 0:B.navButton},{children:i(F,{className:h(v.navIcon,null==L?void 0:L.navIcon),style:null==B?void 0:B.navIcon})})),l("span",e({className:h(v.navCounter,null==L?void 0:L.navCounter),style:null==B?void 0:B.navCounter},{children:[V+1,"/",j]})),A&&i("button",e({onClick:function(){return O(n)},className:h(n?v.modalNavButton:v.navButton,null==L?void 0:L.navButton),style:null==B?void 0:B.navButton},{children:i(A,{className:h(v.navIcon,null==L?void 0:L.navIcon),style:null==B?void 0:B.navIcon})}))]})):null},X=null!=z?l("span",e({className:h(v.confidenceBadge,null==L?void 0:L.confidenceBadge),style:null==B?void 0:B.confidenceBadge},{children:[i("span",e({className:v.confidenceStar},{children:"✦"})),l("span",e({className:v.confidenceScore},{children:[z,"%"]}))]})):null,Z=T?{backgroundColor:"white",padding:"1rem 1.5rem"}:void 0,nn=l(o,{children:[S&&i("div",e({className:h(v.footer,null==L?void 0:L.footer),style:e(e({},Z),null==B?void 0:B.footer)},{children:i("span",e({className:h(v.trainingTitle,null==L?void 0:L.trainingTitle),style:null==B?void 0:B.trainingTitle},{children:S}))})),y&&i("div",e({className:h(v.modalFooterSource,null==L?void 0:L.modalFooterSource),style:e(e({},Z),null==B?void 0:B.modalFooterSource)},{children:l("button",e({type:"button",onClick:function(){return null==b?void 0:b()},className:h(v.trainingTitleLink,null==L?void 0:L.trainingTitleLink),style:null==B?void 0:B.trainingTitleLink},{children:[y,i(s,{size:16,color:"#2563eb"})]}))}))]});return l(o,{children:[l("div",e({className:h(v.expandedContainer,null==L?void 0:L.expandedContainer),style:e(e(e(e({},H),N?{height:"".concat(N),display:"flex",flexDirection:"column"}:void 0),T?{border:"none",borderRadius:0,marginLeft:"0px",marginTop:"0px"}:void 0),null==B?void 0:B.expandedContainer)},{children:[l("div",e({className:h(v.expandedHeader,null==L?void 0:L.expandedHeader),style:e(e({},T?{backgroundColor:"white",padding:"0.5rem 1.5rem"}:void 0),null==B?void 0:B.expandedHeader)},{children:[i("span",e({className:h(v.headerTitle,null==L?void 0:L.headerTitle),style:null==B?void 0:B.headerTitle},{children:f})),l("div",e({className:h(v.headerActions,null==L?void 0:L.headerActions),style:null==B?void 0:B.headerActions},{children:[T?j>1&&l(o,{children:[l("span",e({style:{fontSize:"12px",color:"#888"}},{children:[V+1," / ",j]})),i("button",e({onClick:function(){return K(!0)},disabled:V<=0,style:{padding:"2px 4px",cursor:V<=0?"not-allowed":"pointer",opacity:V<=0?.4:1,border:"1px solid #ddd",borderRadius:"3px",background:"white",display:"flex",alignItems:"center"}},{children:i(c,{size:14,color:"#64748b"})})),i("button",e({onClick:function(){return O(!0)},disabled:V>=j-1,style:{padding:"2px 4px",cursor:V>=j-1?"not-allowed":"pointer",opacity:V>=j-1?.4:1,border:"1px solid #ddd",borderRadius:"3px",background:"white",display:"flex",alignItems:"center"}},{children:i(u,{size:14,color:"#64748b"})}))]}):Q(!1),X,!I&&_&&i("button",e({onClick:function(){var n;return null===(n=Y.current)||void 0===n?void 0:n.showModal()},className:h(v.maximizeButton,null==L?void 0:L.maximizeButton),style:null==B?void 0:B.maximizeButton,title:"View fullscreen"},{children:i(_,{className:v.maximizeIcon})}))]}))]})),i("div",e({ref:$,className:h(v.contentArea,null==L?void 0:L.contentArea),style:e(e(e({},N?{flex:1,maxHeight:"300px",overflowY:"scroll",minHeight:0}:void 0),T?{padding:"1rem 1.5rem"}:void 0),null==B?void 0:B.contentArea)},{children:i("div",e({className:h(v.contentInner,null==L?void 0:L.contentInner),style:null==B?void 0:B.contentInner},{children:P(!1)}))})),nn]})),!I&&i("dialog",e({ref:Y,className:v.modalDialog,onClick:function(n){var e;n.target===Y.current&&(null===(e=Y.current)||void 0===e||e.close())}},{children:l("div",e({className:h(v.modalContainer,null==L?void 0:L.modalContainer),style:null==B?void 0:B.modalContainer},{children:[l("div",e({className:h(v.modalHeader,null==L?void 0:L.modalHeader),style:null==B?void 0:B.modalHeader},{children:[i("span",e({className:h(v.modalHeaderTitle,null==L?void 0:L.modalHeaderTitle),style:null==B?void 0:B.modalHeaderTitle},{children:f})),l("div",e({className:h(v.modalHeaderActions,null==L?void 0:L.modalHeaderActions),style:null==B?void 0:B.modalHeaderActions},{children:[T?j>1&&l(o,{children:[l("span",e({style:{fontSize:"12px",color:"#888"}},{children:[V+1," / ",j]})),i("button",e({onClick:function(){return K(!0)},disabled:V<=0,style:{padding:"2px 4px",cursor:V<=0?"not-allowed":"pointer",opacity:V<=0?.4:1,border:"1px solid #ddd",borderRadius:"3px",background:"white",display:"flex",alignItems:"center"}},{children:i(c,{size:14,color:"#64748b"})})),i("button",e({onClick:function(){return O(!0)},disabled:V>=j-1,style:{padding:"2px 4px",cursor:V>=j-1?"not-allowed":"pointer",opacity:V>=j-1?.4:1,border:"1px solid #ddd",borderRadius:"3px",background:"white",display:"flex",alignItems:"center"}},{children:i(u,{size:14,color:"#64748b"})}))]}):Q(!0),X,D&&i("button",e({onClick:function(){var n;return null===(n=Y.current)||void 0===n?void 0:n.close()},className:h(v.closeButton,null==L?void 0:L.closeButton),style:null==B?void 0:B.closeButton,title:"Close"},{children:i(D,{className:h(v.closeIcon,null==L?void 0:L.closeIcon),style:null==B?void 0:B.closeIcon})}))]}))]})),i("div",e({ref:U,className:h(v.modalContent,null==L?void 0:L.modalContent),style:null==B?void 0:B.modalContent},{children:i("div",e({className:h(v.modalContentInner,null==L?void 0:L.modalContentInner),style:null==B?void 0:B.modalContentInner},{children:P(!0)}))})),S&&i("div",e({className:h(v.modalFooter,null==L?void 0:L.modalFooter),style:null==B?void 0:B.modalFooter},{children:i("span",e({className:h(v.trainingTitle,null==L?void 0:L.trainingTitle),style:null==B?void 0:B.trainingTitle},{children:S}))})),y&&i("div",e({className:h(v.modalFooterSource,null==L?void 0:L.modalFooterSource),style:null==B?void 0:B.modalFooterSource},{children:l("button",e({type:"button",onClick:function(){var n;null==b||b(),null===(n=Y.current)||void 0===n||n.close()},className:h(v.trainingTitleLink,null==L?void 0:L.trainingTitleLink),style:null==B?void 0:B.trainingTitleLink},{children:[y,i(s,{size:16,color:"#2563eb"})]}))}))]}))}))]})};export{g as default};
|
|
1
|
+
import{__spreadArray as n,__assign as e}from"tslib";import{jsxs as l,jsx as i,Fragment as o}from"react/jsx-runtime";import{useMemo as t,useState as r,useRef as d,useEffect as a}from"react";import{ExternalLink as c,ChevronUp as s,ChevronDown as u}from"lucide-react";import v from"./CognitiveNonWebSearchReasoning.module.css.js";var h=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];return n.filter(Boolean).join(" ")},m=function(n){return n.split(/(\*\*.*?\*\*|__.*?__)/g).map(function(n,l){return n.startsWith("**")&&n.endsWith("**")||n.startsWith("__")&&n.endsWith("__")?i("strong",e({className:v.boldText},{children:n.slice(2,-2)}),l):n})},g=function(g){var p=g.item,f=g.headerTitle;g.index;var x=g.iconsConfig,y=g.DocumentTitle,b=g.previewCallback,C=g.bodyHeight,N=g.disableMaximize,I=void 0!==N&&N,k=g.onFullscreenChange,T=g.splitterCustomStyle,H=void 0!==T&&T,L=g.themeTokens,B=g.classNames,w=g.styles,z=p.dataSource,S=p.confidence_score,A=p.trainingDataTitle,F=null==x?void 0:x.ChevronDownIcon,_=null==x?void 0:x.ChevronUpIcon,D=null==x?void 0:x.MaximizeIcon,R=null==x?void 0:x.CloseIcon,W=t(function(){var e=(z?z.replace(/\\n/g,"\n").replace(/\n+/g,"\n"):"").split(/(<highlight>[\s\S]*?<\/highlight>)/g),l=0,i=e.map(function(n){var e=n.startsWith("<highlight>"),i={text:e?n.replace(/<\/?highlight>/g,""):n,isHighlight:e,highlightIndex:e?l:-1};return e&&l++,i}),o=i.filter(function(n){return n.isHighlight}).length,t=[],r=[];return i.forEach(function(e){var l=e.text,i=e.isHighlight,o=e.highlightIndex;l.split("\n").forEach(function(e,l){l>0&&((r.length>0||t.length>0)&&t.push(n([],r,!0)),r=[]),e&&r.push({text:e,isHighlight:i,highlightIndex:o})})}),r.length>0&&t.push(n([],r,!0)),{processedLines:t.map(function(n){var e=n.map(function(n){return n.text}).join(""),l=e.match(/^(\s*)(-|\*|\d+\.)\s+(.*)$/);return{segments:n,isListItem:!!l,isHeader:!!e.match(/^(Title|Description|Training-basis):\s*(.*)$/i),indent:(null==l?void 0:l[1])||"",content:(null==l?void 0:l[3])||e}}),totalHighlights:o}},[z]),j=W.processedLines,M=W.totalHighlights,V=r(0),E=V[0],$=V[1],U=d(null),Y=d(null),q=d(null),G=d([]),J=d([]);a(function(){G.current=G.current.slice(0,M),J.current=J.current.slice(0,M)},[M]),a(function(){if(M>0){$(0);var n=setTimeout(function(){var n;null===(n=G.current[0])||void 0===n||n.scrollIntoView({behavior:"smooth",block:"center"})},50);return function(){return clearTimeout(n)}}},[M]),a(function(){return function(){var n;(null===(n=q.current)||void 0===n?void 0:n.open)&&(null==k||k(!1))}},[k]);var K=function(n,e){setTimeout(function(){var l=e?J.current[n]:G.current[n];null==l||l.scrollIntoView({behavior:"smooth",block:"center"})},50)},O=function(n){if(void 0===n&&(n=!1),M){var e=E>0?E-1:M-1;$(e),K(e,n)}},P=function(n){if(void 0===n&&(n=!1),M){var e=E<M-1?E+1:0;$(e),K(e,n)}},Q=function(n){var o=n?J:G,t=0;return j.map(function(n,r){n.isHeader&&(t=0),n.isListItem&&(t+=1);var d=function(){return n.segments.map(function(l,t){var r=l.isHighlight&&l.highlightIndex===E,d=l.text;return n.isListItem&&0===t&&(d=l.text.replace(/^(\s*)(-|\*|\d+\.)\s+/,"")),l.isHighlight?i("span",e({ref:function(n){n&&(o.current[l.highlightIndex]=n)},className:h(v.highlight,r?v.highlightActive:void 0,null==B?void 0:B.highlight,r?null==B?void 0:B.highlightActive:void 0),style:r?e(e({},null==w?void 0:w.highlight),null==w?void 0:w.highlightActive):null==w?void 0:w.highlight},{children:m(d)}),t):i("span",{children:m(d)},t)})};return n.isHeader?i("span",e({className:h(v.headerLine,null==B?void 0:B.headerLine),style:null==w?void 0:w.headerLine},{children:d()}),r):n.isListItem?l("span",e({className:h(v.listItemLine,null==B?void 0:B.listItemLine),style:e({paddingLeft:n.indent?"1rem":"0"},null==w?void 0:w.listItemLine)},{children:[l("span",e({className:h(v.listCounter,null==B?void 0:B.listCounter),style:null==w?void 0:w.listCounter},{children:[t,"."]})),i("span",{children:d()})]}),r):i("span",e({className:h(v.blockLine,null==B?void 0:B.blockLine),style:null==w?void 0:w.blockLine},{children:d()}),r)})},X=function(n){return M>1?l("div",e({className:h(n?v.modalNavContainer:v.navigationContainer,n?null==B?void 0:B.modalNavContainer:null==B?void 0:B.navigationContainer),style:n?null==w?void 0:w.modalNavContainer:null==w?void 0:w.navigationContainer},{children:[_&&i("button",e({onClick:function(){return O(n)},className:h(n?v.modalNavButton:v.navButton,null==B?void 0:B.navButton),style:null==w?void 0:w.navButton},{children:i(_,{className:h(v.navIcon,null==B?void 0:B.navIcon),style:null==w?void 0:w.navIcon})})),l("span",e({className:h(v.navCounter,null==B?void 0:B.navCounter),style:null==w?void 0:w.navCounter},{children:[E+1,"/",M]})),F&&i("button",e({onClick:function(){return P(n)},className:h(n?v.modalNavButton:v.navButton,null==B?void 0:B.navButton),style:null==w?void 0:w.navButton},{children:i(F,{className:h(v.navIcon,null==B?void 0:B.navIcon),style:null==w?void 0:w.navIcon})}))]})):null},Z=null!=S?l("span",e({className:h(v.confidenceBadge,null==B?void 0:B.confidenceBadge),style:null==w?void 0:w.confidenceBadge},{children:[i("span",e({className:v.confidenceStar},{children:"✦"})),l("span",e({className:v.confidenceScore},{children:[S,"%"]}))]})):null,nn=H?{backgroundColor:"white",padding:"1rem 1.5rem"}:void 0,en=l(o,{children:[A&&i("div",e({className:h(v.footer,null==B?void 0:B.footer),style:e(e({},nn),null==w?void 0:w.footer)},{children:i("span",e({className:h(v.trainingTitle,null==B?void 0:B.trainingTitle),style:null==w?void 0:w.trainingTitle},{children:A}))})),y&&i("div",e({className:h(v.modalFooterSource,null==B?void 0:B.modalFooterSource),style:e(e({},nn),null==w?void 0:w.modalFooterSource)},{children:l("button",e({type:"button",onClick:function(){return null==b?void 0:b()},className:h(v.trainingTitleLink,null==B?void 0:B.trainingTitleLink),style:null==w?void 0:w.trainingTitleLink},{children:[y,i(c,{size:16,color:"#2563eb"})]}))}))]});return l(o,{children:[l("div",e({className:h(v.expandedContainer,null==B?void 0:B.expandedContainer),style:e(e(e(e({},L),C?{height:"".concat(C),display:"flex",flexDirection:"column"}:void 0),H?{border:"none",borderRadius:0,marginLeft:"0px",marginTop:"0px"}:void 0),null==w?void 0:w.expandedContainer)},{children:[l("div",e({className:h(v.expandedHeader,null==B?void 0:B.expandedHeader),style:e(e({},H?{backgroundColor:"white",padding:"0.5rem 1.5rem"}:void 0),null==w?void 0:w.expandedHeader)},{children:[i("span",e({className:h(v.headerTitle,null==B?void 0:B.headerTitle),style:null==w?void 0:w.headerTitle},{children:f})),l("div",e({className:h(v.headerActions,null==B?void 0:B.headerActions),style:null==w?void 0:w.headerActions},{children:[H?M>1&&l(o,{children:[l("span",e({style:{fontSize:"12px",color:"#888"}},{children:[E+1," / ",M]})),i("button",e({onClick:function(){return O(!0)},disabled:E<=0,style:{padding:"2px 4px",cursor:E<=0?"not-allowed":"pointer",opacity:E<=0?.4:1,border:"1px solid #ddd",borderRadius:"3px",background:"white",display:"flex",alignItems:"center"}},{children:i(s,{size:14,color:"#64748b"})})),i("button",e({onClick:function(){return P(!0)},disabled:E>=M-1,style:{padding:"2px 4px",cursor:E>=M-1?"not-allowed":"pointer",opacity:E>=M-1?.4:1,border:"1px solid #ddd",borderRadius:"3px",background:"white",display:"flex",alignItems:"center"}},{children:i(u,{size:14,color:"#64748b"})}))]}):X(!1),Z,!I&&D&&i("button",e({onClick:function(){var n;null==k||k(!0),null===(n=q.current)||void 0===n||n.showModal()},className:h(v.maximizeButton,null==B?void 0:B.maximizeButton),style:null==w?void 0:w.maximizeButton,title:"View fullscreen"},{children:i(D,{className:v.maximizeIcon})}))]}))]})),i("div",e({ref:U,className:h(v.contentArea,null==B?void 0:B.contentArea),style:e(e(e({},C?{flex:1,maxHeight:"300px",overflowY:"scroll",minHeight:0}:void 0),H?{padding:"1rem 1.5rem"}:void 0),null==w?void 0:w.contentArea)},{children:i("div",e({className:h(v.contentInner,null==B?void 0:B.contentInner),style:null==w?void 0:w.contentInner},{children:Q(!1)}))})),en]})),!I&&i("dialog",e({ref:q,className:v.modalDialog,onClose:function(){return null==k?void 0:k(!1)},onClick:function(n){var e;n.target===q.current&&(null===(e=q.current)||void 0===e||e.close())}},{children:l("div",e({className:h(v.modalContainer,null==B?void 0:B.modalContainer),style:null==w?void 0:w.modalContainer},{children:[l("div",e({className:h(v.modalHeader,null==B?void 0:B.modalHeader),style:null==w?void 0:w.modalHeader},{children:[i("span",e({className:h(v.modalHeaderTitle,null==B?void 0:B.modalHeaderTitle),style:null==w?void 0:w.modalHeaderTitle},{children:f})),l("div",e({className:h(v.modalHeaderActions,null==B?void 0:B.modalHeaderActions),style:null==w?void 0:w.modalHeaderActions},{children:[H?M>1&&l(o,{children:[l("span",e({style:{fontSize:"12px",color:"#888"}},{children:[E+1," / ",M]})),i("button",e({onClick:function(){return O(!0)},disabled:E<=0,style:{padding:"2px 4px",cursor:E<=0?"not-allowed":"pointer",opacity:E<=0?.4:1,border:"1px solid #ddd",borderRadius:"3px",background:"white",display:"flex",alignItems:"center"}},{children:i(s,{size:14,color:"#64748b"})})),i("button",e({onClick:function(){return P(!0)},disabled:E>=M-1,style:{padding:"2px 4px",cursor:E>=M-1?"not-allowed":"pointer",opacity:E>=M-1?.4:1,border:"1px solid #ddd",borderRadius:"3px",background:"white",display:"flex",alignItems:"center"}},{children:i(u,{size:14,color:"#64748b"})}))]}):X(!0),Z,R&&i("button",e({onClick:function(){var n;return null===(n=q.current)||void 0===n?void 0:n.close()},className:h(v.closeButton,null==B?void 0:B.closeButton),style:null==w?void 0:w.closeButton,title:"Close"},{children:i(R,{className:h(v.closeIcon,null==B?void 0:B.closeIcon),style:null==w?void 0:w.closeIcon})}))]}))]})),i("div",e({ref:Y,className:h(v.modalContent,null==B?void 0:B.modalContent),style:null==w?void 0:w.modalContent},{children:i("div",e({className:h(v.modalContentInner,null==B?void 0:B.modalContentInner),style:null==w?void 0:w.modalContentInner},{children:Q(!0)}))})),A&&i("div",e({className:h(v.modalFooter,null==B?void 0:B.modalFooter),style:null==w?void 0:w.modalFooter},{children:i("span",e({className:h(v.trainingTitle,null==B?void 0:B.trainingTitle),style:null==w?void 0:w.trainingTitle},{children:A}))})),y&&i("div",e({className:h(v.modalFooterSource,null==B?void 0:B.modalFooterSource),style:null==w?void 0:w.modalFooterSource},{children:l("button",e({type:"button",onClick:function(){var n;null==b||b(),null===(n=q.current)||void 0===n||n.close()},className:h(v.trainingTitleLink,null==B?void 0:B.trainingTitleLink),style:null==w?void 0:w.trainingTitleLink},{children:[y,i(c,{size:16,color:"#2563eb"})]}))}))]}))}))]})};export{g as default};
|
|
2
2
|
//# sourceMappingURL=CognitiveInternalgptCoreComponent.js.map
|