@viswa-test/test-citation 0.0.390 → 0.0.391
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/features/CognitiveCompare/CitationAnchor.js +1 -1
- package/dist/cjs/features/CognitiveCompare/CitationAnchor.js.map +1 -1
- package/dist/cjs/features/CognitiveCompare/CitationRenderer.js +1 -1
- package/dist/cjs/features/CognitiveCompare/CitationRenderer.js.map +1 -1
- package/dist/cjs/features/CognitiveCompare/CognitiveCompare.js +1 -1
- package/dist/cjs/features/CognitiveCompare/CognitiveCompare.js.map +1 -1
- package/dist/cjs/features/CognitiveCompare/CognitiveCompareConstants.js +1 -1
- package/dist/cjs/features/CognitiveCompare/CognitiveCompareConstants.js.map +1 -1
- package/dist/cjs/features/CognitiveCompare/CognitiveComparehelpers.js +1 -1
- package/dist/cjs/features/CognitiveCompare/CognitiveComparehelpers.js.map +1 -1
- package/dist/cjs/features/CognitiveCompare/CognitivePopup.js +1 -1
- package/dist/cjs/features/CognitiveCompare/CognitivePopup.js.map +1 -1
- package/dist/cjs/features/CognitiveCompare/CompareContext.js +1 -1
- package/dist/cjs/features/CognitiveCompare/CompareContext.js.map +1 -1
- package/dist/cjs/features/CognitiveCompare/Guidelines/components/GuidelinePanel.js +1 -1
- package/dist/cjs/features/CognitiveCompare/Guidelines/components/GuidelinePanel.js.map +1 -1
- package/dist/cjs/features/CognitiveCompare/Guidelines/components/WebGptPanel.js +1 -1
- package/dist/cjs/features/CognitiveCompare/Guidelines/components/WebGptPanel.js.map +1 -1
- package/dist/cjs/features/CognitiveCompare/Guidelines/utils/processGuidelinesMarkdown.js +1 -1
- package/dist/cjs/features/CognitiveCompare/Guidelines/utils/processGuidelinesMarkdown.js.map +1 -1
- package/dist/cjs/features/CognitiveCompare/components/LHSSectionRow.js +1 -1
- package/dist/cjs/features/CognitiveCompare/components/LHSSectionRow.js.map +1 -1
- package/dist/cjs/features/CognitiveCompare/components/RHSSectionRow.js +1 -1
- package/dist/cjs/features/CognitiveCompare/components/RHSSectionRow.js.map +1 -1
- package/dist/cjs/features/CognitiveCompare/components/SectionAccordion.js +1 -1
- package/dist/cjs/features/CognitiveCompare/components/SectionAccordion.js.map +1 -1
- package/dist/cjs/features/CognitiveCompare/components/SubSectionAccordion.js +1 -1
- package/dist/cjs/features/CognitiveCompare/components/SubSectionAccordion.js.map +1 -1
- package/dist/cjs/features/CognitiveCompare/components/SvgConnectors.js +1 -1
- package/dist/cjs/features/CognitiveCompare/components/SvgConnectors.js.map +1 -1
- package/dist/cjs/features/CognitiveCompare/hooks/memoizedMarkdown.js +1 -1
- package/dist/cjs/features/CognitiveCompare/hooks/memoizedMarkdown.js.map +1 -1
- package/dist/cjs/features/CognitiveCompare/hooks/useCompareData.js +1 -1
- package/dist/cjs/features/CognitiveCompare/hooks/useCompareData.js.map +1 -1
- package/dist/cjs/features/CognitiveCompare/hooks/useLinesCalculator.js +1 -1
- package/dist/cjs/features/CognitiveCompare/hooks/useLinesCalculator.js.map +1 -1
- package/dist/cjs/features/CognitiveCompare/hooks/useSideBySide.js +1 -1
- package/dist/cjs/features/CognitiveCompare/hooks/useSideBySide.js.map +1 -1
- package/dist/cjs/features/PdfViewer/PdfToolbar.js +1 -1
- package/dist/cjs/features/PdfViewer/PdfToolbar.js.map +1 -1
- package/dist/cjs/features/PdfViewer/PdfViewer.css.js +1 -1
- package/dist/cjs/features/PdfViewer/PdfViewer.js +1 -1
- package/dist/cjs/features/PdfViewer/PdfViewer.js.map +1 -1
- package/dist/cjs/features/PdfViewer/rotationManager.js +1 -1
- package/dist/cjs/features/PdfViewer/rotationManager.js.map +1 -1
- package/dist/cjs/features/PdfViewer/usePdfHighlight.js +1 -1
- package/dist/cjs/features/PdfViewer/usePdfHighlight.js.map +1 -1
- package/dist/cjs/features/PdfViewer/zoomStateManager.js +2 -0
- package/dist/cjs/features/PdfViewer/zoomStateManager.js.map +1 -0
- package/dist/cjs/features/SegmentReviewComponents/CognitiveScoreBadge.js +1 -1
- package/dist/cjs/features/SegmentReviewComponents/CognitiveScoreBadge.js.map +1 -1
- package/dist/cjs/features/SegmentReviewComponents/reviewStepAdapters.js +1 -1
- package/dist/cjs/features/SegmentReviewComponents/reviewStepAdapters.js.map +1 -1
- package/dist/features/CognitiveCompare/CitationAnchor.js +1 -1
- package/dist/features/CognitiveCompare/CitationAnchor.js.map +1 -1
- package/dist/features/CognitiveCompare/CitationRenderer.js +1 -1
- package/dist/features/CognitiveCompare/CitationRenderer.js.map +1 -1
- package/dist/features/CognitiveCompare/CognitiveCompare.js +1 -1
- package/dist/features/CognitiveCompare/CognitiveCompare.js.map +1 -1
- package/dist/features/CognitiveCompare/CognitiveCompareConstants.js +1 -1
- package/dist/features/CognitiveCompare/CognitiveCompareConstants.js.map +1 -1
- package/dist/features/CognitiveCompare/CognitiveComparehelpers.js +1 -1
- package/dist/features/CognitiveCompare/CognitiveComparehelpers.js.map +1 -1
- package/dist/features/CognitiveCompare/CognitivePopup.js +1 -1
- package/dist/features/CognitiveCompare/CognitivePopup.js.map +1 -1
- package/dist/features/CognitiveCompare/CompareContext.js +1 -1
- package/dist/features/CognitiveCompare/CompareContext.js.map +1 -1
- package/dist/features/CognitiveCompare/Guidelines/components/GuidelinePanel.js +1 -1
- package/dist/features/CognitiveCompare/Guidelines/components/GuidelinePanel.js.map +1 -1
- package/dist/features/CognitiveCompare/Guidelines/components/WebGptPanel.js +1 -1
- package/dist/features/CognitiveCompare/Guidelines/components/WebGptPanel.js.map +1 -1
- package/dist/features/CognitiveCompare/Guidelines/utils/processGuidelinesMarkdown.js +1 -1
- package/dist/features/CognitiveCompare/Guidelines/utils/processGuidelinesMarkdown.js.map +1 -1
- package/dist/features/CognitiveCompare/components/LHSSectionRow.js +1 -1
- package/dist/features/CognitiveCompare/components/LHSSectionRow.js.map +1 -1
- package/dist/features/CognitiveCompare/components/RHSSectionRow.js +1 -1
- package/dist/features/CognitiveCompare/components/RHSSectionRow.js.map +1 -1
- package/dist/features/CognitiveCompare/components/SectionAccordion.js +1 -1
- package/dist/features/CognitiveCompare/components/SectionAccordion.js.map +1 -1
- package/dist/features/CognitiveCompare/components/SubSectionAccordion.js +1 -1
- package/dist/features/CognitiveCompare/components/SubSectionAccordion.js.map +1 -1
- package/dist/features/CognitiveCompare/components/SvgConnectors.js +1 -1
- package/dist/features/CognitiveCompare/components/SvgConnectors.js.map +1 -1
- package/dist/features/CognitiveCompare/hooks/memoizedMarkdown.js +1 -1
- package/dist/features/CognitiveCompare/hooks/memoizedMarkdown.js.map +1 -1
- package/dist/features/CognitiveCompare/hooks/useCompareData.js +1 -1
- package/dist/features/CognitiveCompare/hooks/useCompareData.js.map +1 -1
- package/dist/features/CognitiveCompare/hooks/useLinesCalculator.js +1 -1
- package/dist/features/CognitiveCompare/hooks/useLinesCalculator.js.map +1 -1
- package/dist/features/CognitiveCompare/hooks/useSideBySide.js +1 -1
- package/dist/features/CognitiveCompare/hooks/useSideBySide.js.map +1 -1
- package/dist/features/PdfViewer/PdfToolbar.js +1 -1
- package/dist/features/PdfViewer/PdfToolbar.js.map +1 -1
- package/dist/features/PdfViewer/PdfViewer.css.js +1 -1
- package/dist/features/PdfViewer/PdfViewer.js +1 -1
- package/dist/features/PdfViewer/PdfViewer.js.map +1 -1
- package/dist/features/PdfViewer/rotationManager.js +1 -1
- package/dist/features/PdfViewer/rotationManager.js.map +1 -1
- package/dist/features/PdfViewer/usePdfHighlight.js +1 -1
- package/dist/features/PdfViewer/usePdfHighlight.js.map +1 -1
- package/dist/features/PdfViewer/zoomStateManager.js +2 -0
- package/dist/features/PdfViewer/zoomStateManager.js.map +1 -0
- package/dist/features/SegmentReviewComponents/CognitiveScoreBadge.js +1 -1
- package/dist/features/SegmentReviewComponents/CognitiveScoreBadge.js.map +1 -1
- package/dist/features/SegmentReviewComponents/reviewStepAdapters.js +1 -1
- package/dist/features/SegmentReviewComponents/reviewStepAdapters.js.map +1 -1
- package/dist/types/features/CognitiveCompare/CitationAnchor.d.ts +0 -2
- package/dist/types/features/CognitiveCompare/CitationAnchor.d.ts.map +1 -1
- package/dist/types/features/CognitiveCompare/CitationRenderer.d.ts +1 -8
- package/dist/types/features/CognitiveCompare/CitationRenderer.d.ts.map +1 -1
- package/dist/types/features/CognitiveCompare/CognitiveCompare.d.ts +1 -1
- package/dist/types/features/CognitiveCompare/CognitiveCompare.d.ts.map +1 -1
- package/dist/types/features/CognitiveCompare/CognitiveCompareConstants.d.ts +1 -1
- package/dist/types/features/CognitiveCompare/CognitiveCompareConstants.d.ts.map +1 -1
- package/dist/types/features/CognitiveCompare/CognitiveCompareTypes.d.ts +3 -12
- package/dist/types/features/CognitiveCompare/CognitiveCompareTypes.d.ts.map +1 -1
- package/dist/types/features/CognitiveCompare/CognitiveComparehelpers.d.ts +0 -12
- package/dist/types/features/CognitiveCompare/CognitiveComparehelpers.d.ts.map +1 -1
- package/dist/types/features/CognitiveCompare/CognitivePopup.d.ts.map +1 -1
- package/dist/types/features/CognitiveCompare/CompareContext.d.ts +2 -9
- package/dist/types/features/CognitiveCompare/CompareContext.d.ts.map +1 -1
- package/dist/types/features/CognitiveCompare/Guidelines/components/GuidelinePanel.d.ts.map +1 -1
- package/dist/types/features/CognitiveCompare/Guidelines/components/WebGptPanel.d.ts.map +1 -1
- package/dist/types/features/CognitiveCompare/Guidelines/utils/processGuidelinesMarkdown.d.ts +1 -14
- package/dist/types/features/CognitiveCompare/Guidelines/utils/processGuidelinesMarkdown.d.ts.map +1 -1
- package/dist/types/features/CognitiveCompare/components/LHSSectionRow.d.ts.map +1 -1
- package/dist/types/features/CognitiveCompare/components/RHSSectionRow.d.ts.map +1 -1
- package/dist/types/features/CognitiveCompare/components/SectionAccordion.d.ts.map +1 -1
- package/dist/types/features/CognitiveCompare/components/SubSectionAccordion.d.ts.map +1 -1
- package/dist/types/features/CognitiveCompare/components/SvgConnectors.d.ts +3 -2
- package/dist/types/features/CognitiveCompare/components/SvgConnectors.d.ts.map +1 -1
- package/dist/types/features/CognitiveCompare/hooks/memoizedMarkdown.d.ts +1 -2
- package/dist/types/features/CognitiveCompare/hooks/memoizedMarkdown.d.ts.map +1 -1
- package/dist/types/features/CognitiveCompare/hooks/useCompareData.d.ts +1 -1
- package/dist/types/features/CognitiveCompare/hooks/useCompareData.d.ts.map +1 -1
- package/dist/types/features/CognitiveCompare/hooks/useLinesCalculator.d.ts.map +1 -1
- package/dist/types/features/CognitiveCompare/hooks/useSideBySide.d.ts.map +1 -1
- package/dist/types/features/PdfViewer/PdfToolbar.d.ts.map +1 -1
- package/dist/types/features/PdfViewer/PdfViewer.d.ts.map +1 -1
- package/dist/types/features/PdfViewer/rotationManager.d.ts.map +1 -1
- package/dist/types/features/PdfViewer/usePdfHighlight.d.ts +1 -2
- package/dist/types/features/PdfViewer/usePdfHighlight.d.ts.map +1 -1
- package/dist/types/features/PdfViewer/zoomStateManager.d.ts +21 -0
- package/dist/types/features/PdfViewer/zoomStateManager.d.ts.map +1 -0
- package/package.json +4 -4
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import{useMemo as t}from"react";import{Box as o}from"@mui/material";import r from"react-markdown";import i from"rehype-raw";import{SHARED_MARKDOWN_STYLES as l}from"../../CognitiveCompareConfig.js";import{DEVIATION_BADGE_SEPARATOR as a,generateColorPalette as s}from"../../CognitiveComparehelpers.js";import{processGuidelinesMarkdown as n}from"../utils/processGuidelinesMarkdown.js";const g=({guidelinesData:g,deviationData:u,connectedSections:p,proposedSections:m})=>{const d=Array.from(p)[0],{targetHighlights:h,labelColor:c}=t(()=>{if(null==d||!u)return{targetHighlights:[],labelColor:""};let e="";"number"==typeof d?e=m[d]?.nodeId||"":"string"==typeof d&&(e=d.includes(a)?d.split(a)[0]:d.split("::")[0].split(":")[0]);const t=u[e];if(!t)return{targetHighlights:[],labelColor:""};let o=[];const r=t.evaluation_result||{};let i="";return Object.values(r).forEach(e=>{e?.deviation_highlights?.rulebook_guidelines&&(o=[...o,...e.deviation_highlights.rulebook_guidelines],i=e.evaluation_outputs?.metadata?.label_color?s(e.evaluation_outputs?.metadata?.label_color).bg:"")}),{targetHighlights:o.filter(Boolean),labelColor:i}},[d,u,m]),f=t(()=>n({guidelinesData:g,targetHighlights:h,labelColor:c||"#FEF08A"}),[g,h,c]);return e(o,{sx:{padding:"0px 12px",backgroundColor:"#FFFFFF",borderRadius:"8px",...l,overflow:"visible"},children:e(r,{rehypePlugins:[i],children:f})})};export{g as default};
|
|
2
2
|
//# sourceMappingURL=GuidelinePanel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GuidelinePanel.js","sources":["../../../../../src/features/CognitiveCompare/Guidelines/components/GuidelinePanel.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\nimport { Box } from '@mui/material';\nimport ReactMarkdown from 'react-markdown';\nimport rehypeRaw from 'rehype-raw';\nimport { SHARED_MARKDOWN_STYLES } from '../../CognitiveCompareConfig';\nimport { generateColorPalette } from '../../CognitiveComparehelpers';\nimport { processGuidelinesMarkdown } from '../utils/processGuidelinesMarkdown';\
|
|
1
|
+
{"version":3,"file":"GuidelinePanel.js","sources":["../../../../../src/features/CognitiveCompare/Guidelines/components/GuidelinePanel.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\nimport { Box } from '@mui/material';\nimport ReactMarkdown from 'react-markdown';\nimport rehypeRaw from 'rehype-raw';\nimport { SHARED_MARKDOWN_STYLES } from '../../CognitiveCompareConfig';\nimport { DEVIATION_BADGE_SEPARATOR, generateColorPalette } from '../../CognitiveComparehelpers';\nimport { processGuidelinesMarkdown } from '../utils/processGuidelinesMarkdown';\n// import { SHARED_MARKDOWN_STYLES } from '../CognitiveCompareConfig';\n// import { DEVIATION_BADGE_SEPARATOR } from '../CognitiveComparehelpers';\n\nconst GuidelinePanel = ({ guidelinesData, deviationData, connectedSections, proposedSections }: any) => {\n const activeNodeIdFull = Array.from(connectedSections)[0];\n\n const {targetHighlights, labelColor} = useMemo(() => {\n if (activeNodeIdFull == null || !deviationData) return { targetHighlights: [], labelColor: \"\" };\n\n let baseNodeId = \"\";\n\n // 1. Resolve the actual Node ID whether the input is an array index or a composite string\n if (typeof activeNodeIdFull === 'number') {\n baseNodeId = proposedSections[activeNodeIdFull]?.nodeId || \"\";\n } else if (typeof activeNodeIdFull === 'string') {\n if (activeNodeIdFull.includes(DEVIATION_BADGE_SEPARATOR)) {\n baseNodeId = activeNodeIdFull.split(DEVIATION_BADGE_SEPARATOR)[0];\n } else {\n baseNodeId = activeNodeIdFull.split('::')[0].split(':')[0];\n }\n }\n\n // 2. Extract rulebook guidelines from deviation data\n const nodeDevData = deviationData[baseNodeId];\n if (!nodeDevData) return { targetHighlights: [], labelColor: \"\" };\n\n let guidelines: string[] = [];\n const evalResults = nodeDevData.evaluation_result || {};\n let labelColor: string = \"\"\n \n Object.values(evalResults).forEach((evalNode: any) => {\n if (evalNode?.deviation_highlights?.rulebook_guidelines) {\n guidelines = [...guidelines, ...evalNode.deviation_highlights.rulebook_guidelines];\n labelColor = evalNode.evaluation_outputs?.metadata?.label_color ? generateColorPalette(evalNode.evaluation_outputs?.metadata?.label_color).bg : \"\";\n }\n });\n\n return { targetHighlights: guidelines.filter(Boolean), labelColor }; // Filter out empty strings\n }, [activeNodeIdFull, deviationData, proposedSections]);\n\n const processedMarkdown = useMemo(\n () =>\n processGuidelinesMarkdown({\n guidelinesData,\n targetHighlights,\n labelColor: labelColor || \"#FEF08A\",\n }),\n [guidelinesData, targetHighlights, labelColor]\n );\n\n return (\n <Box sx={{ \n padding: '0px 12px', \n backgroundColor: '#FFFFFF', \n borderRadius: '8px', \n ...SHARED_MARKDOWN_STYLES,\n overflow: 'visible' \n }}>\n <ReactMarkdown rehypePlugins={[rehypeRaw as any]}>\n {processedMarkdown}\n </ReactMarkdown>\n </Box>\n );\n};\n\nexport default GuidelinePanel;"],"names":["GuidelinePanel","guidelinesData","deviationData","connectedSections","proposedSections","activeNodeIdFull","Array","from","targetHighlights","labelColor","useMemo","baseNodeId","nodeId","includes","DEVIATION_BADGE_SEPARATOR","split","nodeDevData","guidelines","evalResults","evaluation_result","Object","values","forEach","evalNode","deviation_highlights","rulebook_guidelines","evaluation_outputs","metadata","label_color","generateColorPalette","bg","filter","Boolean","processedMarkdown","processGuidelinesMarkdown","jsx","Box","sx","padding","backgroundColor","borderRadius","SHARED_MARKDOWN_STYLES","overflow","children","ReactMarkdown","rehypePlugins","rehypeRaw"],"mappings":"saAUA,MAAMA,EAAiB,EAAGC,iBAAgBC,gBAAeC,oBAAmBC,uBAC1E,MAAMC,EAAmBC,MAAMC,KAAKJ,GAAmB,IAEjDK,iBAACA,EAAAC,WAAkBA,GAAcC,EAAQ,KACzC,GAAoB,MAApBL,IAA6BH,EAAe,MAAO,CAAEM,iBAAkB,GAAIC,WAAY,IAE3F,IAAIE,EAAa,GAGe,iBAArBN,EACIM,EAAAP,EAAiBC,IAAmBO,QAAU,GACtB,iBAArBP,IAEdM,EADEN,EAAiBQ,SAASC,GACfT,EAAiBU,MAAMD,GAA2B,GAElDT,EAAiBU,MAAM,MAAM,GAAGA,MAAM,KAAK,IAKtD,MAAAC,EAAcd,EAAcS,GAC9B,IAACK,EAAoB,MAAA,CAAER,iBAAkB,GAAIC,WAAY,IAE7D,IAAIQ,EAAuB,GACrB,MAAAC,EAAcF,EAAYG,mBAAqB,GACrD,IAAIV,EAAqB,GASzB,OAPAW,OAAOC,OAAOH,GAAaI,QAASC,IAC9BA,GAAUC,sBAAsBC,sBAClCR,EAAa,IAAIA,KAAeM,EAASC,qBAAqBC,qBAC9DhB,EAAac,EAASG,oBAAoBC,UAAUC,YAAcC,EAAqBN,EAASG,oBAAoBC,UAAUC,aAAaE,GAAK,MAI7I,CAAEtB,iBAAkBS,EAAWc,OAAOC,SAAUvB,WAAAA,IACtD,CAACJ,EAAkBH,EAAeE,IAE/B6B,EAAoBvB,EACxB,IACEwB,EAA0B,CACxBjC,iBACAO,mBACAC,WAAYA,GAAc,YAE9B,CAACR,EAAgBO,EAAkBC,IAInC,OAAA0B,EAACC,GAAIC,GAAI,CACPC,QAAS,WACTC,gBAAiB,UACjBC,aAAc,SACXC,EACHC,SAAU,WAEVC,WAACC,EAAc,CAAAC,cAAe,CAACC,GAC5BH"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as e}from"react/jsx-runtime";import{useMemo as
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import{useMemo as r}from"react";import{Box as a,Typography as t}from"@mui/material";import o from"react-markdown";import n from"rehype-raw";import{SHARED_MARKDOWN_STYLES as i}from"../../CognitiveCompareConfig.js";import{DEVIATION_BADGE_SEPARATOR as d,generateColorPalette as l}from"../../CognitiveComparehelpers.js";import s from"../../CitationAnchor.js";const c=({evalNode:e})=>!1===e?.evaluation_outputs?.guideline_flag?.rulebook_used,p=(e,r,a)=>`${e}::${r}::${a}`,u=(e,r)=>`${e}::${r}`,w={relativeWrapper:{verticalAlign:"baseline"},arrow:{color:"#6D28D9"}},b=({deviationData:b,connectedSections:m,proposedSections:y})=>{const v=Array.from(m||[])[0],f=r(()=>((e,r)=>"number"==typeof e?r[e]?.nodeId||"":e&&"string"==typeof e&&e.trim()?e.includes(d)?e.split(d)[0]:e.split("::")[0].split(":")[0]:"")(v,y||[]),[v,y]),g=r(()=>{if(!b||"object"!=typeof b)return[];return Object.entries(b).flatMap(([e,r])=>(e=>{const r=e&&"object"==typeof e?e.evaluation_result:null;return!r||"object"!=typeof r&&!Array.isArray(r)?[]:Array.isArray(r)?r.map((e,r)=>({evalNode:e,evaluationKey:String(r)})):"object"==typeof r?Object.entries(r).map(([e,r])=>({evalNode:r,evaluationKey:e})):[]})(r).filter(c).map(({evalNode:r,evaluationKey:a})=>({nodeId:e,evaluationKey:a,answerKey:u(e,a),evaluation:r,webSearchAnswer:r.web_search_answer,colorPalette:l(r?.evaluation_outputs?.metadata?.label_color||"")??{border:w.arrow.color}})).filter(({webSearchAnswer:e})=>!!e?.enhanced_content)).map((e,r)=>({...e,answerOrder:r}))},[b]),h=r(()=>g.reduce((e,r)=>{const a=r.webSearchAnswer?.extraMetaData||{};return Object.entries(a).forEach(([a,t])=>{const o=p(r.nodeId,r.evaluationKey,a);e[o]={nodeId:r.nodeId,evaluationKey:r.evaluationKey,answerKey:r.answerKey,answerOrder:r.answerOrder,reasoningId:a,evaluation:r.evaluation,webSearchAnswer:r.webSearchAnswer,extraMetaData:t}}),e},{}),[g]),x=r(()=>g.reduce((r,a)=>(r[a.answerKey]={a:({href:r="",children:t,type:o,reason:n,...i})=>{const d=i?.["data-cognitive-reasoning"],l=d?p(a.nodeId,a.evaluationKey,String(d)):"",c=l?h[l]:null;return e(s,{href:r,children:t,citationType:o,citationReason:n,metaData:{webGpt:c,webGptMetaKey:l},customStyle:w})}},r),{}),[g,h]);return e(a,{sx:{padding:"12px 12px 12px 0px",backgroundColor:"#FFFFFF",borderRadius:"8px",...i,overflow:"visible"},children:g.length>0?g.map((r,t)=>e(a,{id:r.nodeId===f?"guideline-target-0":void 0,"data-web-gpt-node-id":r.nodeId,"data-web-gpt-evaluation-key":r.evaluationKey,"data-web-gpt-answer-order":r.answerOrder,"data-web-gpt-active":r.nodeId===f?"true":"false",sx:{mb:1.5,border:r.nodeId===f?`2px solid ${r.colorPalette.border}`:"1px solid #d3d3d3",borderRadius:"6px",padding:"8px",backgroundColor:"#FFFFFF"},children:e(o,{rehypePlugins:[n],components:x[r.answerKey],children:r.webSearchAnswer.enhanced_content})},r.answerKey)):e(t,{sx:{color:"#64748B",fontSize:"14px",py:1},children:"No web GPT data available."})})};export{b as default};
|
|
2
2
|
//# sourceMappingURL=WebGptPanel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebGptPanel.js","sources":["../../../../../src/features/CognitiveCompare/Guidelines/components/WebGptPanel.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\nimport { Box, Typography } from '@mui/material';\nimport ReactMarkdown from 'react-markdown';\nimport rehypeRaw from 'rehype-raw';\nimport { SHARED_MARKDOWN_STYLES } from '../../CognitiveCompareConfig';\nimport { generateColorPalette } from '../../CognitiveComparehelpers';\nimport CitationAnchor from '../../CitationAnchor';\nimport { resolveGuidelineSelection } from '../utils/resolveGuidelineSelection';\n\nconst getEvaluationNodes = (nodeDevData: Record<string, unknown>) => {\n const evalResults = (nodeDevData && typeof nodeDevData === 'object') ? nodeDevData.evaluation_result : null;\n if (!evalResults || (typeof evalResults !== 'object' && !Array.isArray(evalResults))) return [];\n if (Array.isArray(evalResults)) {\n return evalResults.map((evalNode, index) => ({ evalNode, evaluationKey: String(index) }));\n }\n if (typeof evalResults === \"object\") {\n return Object.entries(evalResults).map(([evaluationKey, evalNode]) => ({ evalNode, evaluationKey }));\n }\n return [];\n};\n\nconst isWebGptEvaluation = ({ evalNode }: { evalNode: Record<string, any> }) =>\n evalNode?.evaluation_outputs?.guideline_flag?.rulebook_used === false;\n\nconst buildWebGptMetaKey = (nodeId: string, evaluationKey: string, reasoningId: string) =>\n `${nodeId}::${evaluationKey}::${reasoningId}`;\n\nconst buildWebGptAnswerKey = (nodeId: string, evaluationKey: string) =>\n `${nodeId}::${evaluationKey}`;\n\nconst WEB_GPT_CITATION_STYLE = {\n relativeWrapper: {\n verticalAlign: \"baseline\",\n },\n arrow: {\n color: \"#6D28D9\"\n }\n};\n\ninterface WebGptPanelProps {\n deviationData: Record<string, unknown>;\n connectedSections: Iterable<unknown>;\n proposedSections: Record<string, unknown>[];\n}\n\nconst WebGptPanel = ({ deviationData, connectedSections, proposedSections }: WebGptPanelProps) => {\n const activeNodeIdFull = Array.from(connectedSections || [])[0];\n const activeSelection = useMemo(\n () => resolveGuidelineSelection({\n activeIdentifier: activeNodeIdFull,\n deviationData,\n proposedSections: proposedSections || [],\n }),\n [activeNodeIdFull, deviationData, proposedSections],\n );\n\n const webSearchAnswers = useMemo(() => {\n if (!deviationData || typeof deviationData !== \"object\") return [];\n\n const collectFromNode = ([nodeId, nodeDevData]: [string, any]) =>\n getEvaluationNodes(nodeDevData)\n .filter(isWebGptEvaluation)\n .map(({ evalNode, evaluationKey }: any) => ({\n nodeId,\n evaluationKey,\n answerKey: buildWebGptAnswerKey(nodeId, evaluationKey),\n evaluation: evalNode,\n webSearchAnswer: evalNode.web_search_answer,\n colorPalette : generateColorPalette(evalNode?.evaluation_outputs?.metadata?.label_color || \"\") ?? {border: WEB_GPT_CITATION_STYLE.arrow.color},\n }))\n .filter(({ webSearchAnswer }: any) => !!webSearchAnswer?.enhanced_content);\n\n return Object.entries(deviationData)\n .flatMap(collectFromNode as any)\n .map((answer: any, answerOrder: number) => ({\n ...answer,\n answerOrder,\n }));\n }, [deviationData]);\n\n const activeAnswerKey = useMemo(() => {\n const exactMatch = activeSelection?.evaluationKey == null\n ? undefined\n : webSearchAnswers.find(\n (answer: any) =>\n answer.nodeId === activeSelection?.baseNodeId &&\n answer.evaluationKey === activeSelection?.evaluationKey,\n );\n\n return (\n exactMatch ||\n webSearchAnswers.find(\n (answer: any) => answer.nodeId === activeSelection?.baseNodeId,\n )\n )?.answerKey;\n }, [activeSelection.baseNodeId, activeSelection.evaluationKey, webSearchAnswers]);\n\n const webGptExtraMetaByKey = useMemo(() => {\n return webSearchAnswers.reduce((acc: Record<string, any>, answer: any) => {\n const extraMetaData = answer.webSearchAnswer?.extraMetaData || {};\n\n Object.entries(extraMetaData).forEach(([reasoningId, extraMetaDataForReasoning]) => {\n const metaKey = buildWebGptMetaKey(answer.nodeId, answer.evaluationKey, reasoningId);\n acc[metaKey] = {\n nodeId: answer.nodeId,\n evaluationKey: answer.evaluationKey,\n answerKey: answer.answerKey,\n answerOrder: answer.answerOrder,\n reasoningId,\n evaluation: answer.evaluation,\n webSearchAnswer: answer.webSearchAnswer,\n extraMetaData: extraMetaDataForReasoning,\n };\n });\n\n return acc;\n }, {});\n }, [webSearchAnswers]);\n\n const componentsByAnswerKey = useMemo(() => {\n return webSearchAnswers.reduce((acc: Record<string, any>, answer: any) => {\n acc[answer.answerKey] = {\n a: ({ href = \"\", children, type, reason, ...props }: any) => {\n const reasoningId = props?.[\"data-cognitive-reasoning\"];\n const metaKey = reasoningId\n ? buildWebGptMetaKey(answer.nodeId, answer.evaluationKey, String(reasoningId))\n : \"\";\n const matchedExtraMetaData = metaKey ? webGptExtraMetaByKey[metaKey] : null;\n\n return (\n <CitationAnchor\n href={href}\n children={children}\n citationType={type}\n citationReason={reason}\n metaData={{\n webGpt: matchedExtraMetaData,\n webGptMetaKey: metaKey,\n }}\n customStyle={WEB_GPT_CITATION_STYLE}\n />\n );\n },\n };\n\n return acc;\n }, {});\n }, [webSearchAnswers, webGptExtraMetaByKey]);\n\n return (\n <Box sx={{ \n padding: '12px 12px 12px 0px', \n backgroundColor: '#FFFFFF', \n borderRadius: '8px', \n ...SHARED_MARKDOWN_STYLES,\n overflow: 'visible' \n }}>\n {webSearchAnswers.length > 0 ? (\n webSearchAnswers.map((answer: any) => {\n const isActive = answer.answerKey === activeAnswerKey;\n\n return (\n <Box\n key={answer.answerKey}\n id={isActive ? \"guideline-target-0\" : undefined}\n data-web-gpt-node-id={answer.nodeId}\n data-web-gpt-evaluation-key={answer.evaluationKey}\n data-web-gpt-answer-order={answer.answerOrder}\n data-web-gpt-active={isActive ? \"true\" : \"false\"}\n sx={{ mb: 1.5,\n border: isActive ? `2px solid ${answer.colorPalette.border}` : \"1px solid #d3d3d3\",\n borderRadius: \"6px\",\n padding: \"8px\",\n backgroundColor: \"#FFFFFF\",\n }}\n >\n <ReactMarkdown\n rehypePlugins={[rehypeRaw as any]}\n components={componentsByAnswerKey[answer.answerKey]}\n >\n {answer.webSearchAnswer.enhanced_content}\n </ReactMarkdown>\n </Box>\n );\n })\n ) : (\n <Typography sx={{ color: \"#64748B\", fontSize: \"14px\", py: 1 }}>\n No web GPT data available.\n </Typography>\n )}\n </Box>\n );\n};\n\nexport default WebGptPanel;\n"],"names":["isWebGptEvaluation","evalNode","evaluation_outputs","guideline_flag","rulebook_used","buildWebGptMetaKey","nodeId","evaluationKey","reasoningId","buildWebGptAnswerKey","WEB_GPT_CITATION_STYLE","relativeWrapper","verticalAlign","arrow","color","WebGptPanel","deviationData","connectedSections","proposedSections","activeNodeIdFull","Array","from","activeSelection","useMemo","resolveGuidelineSelection","activeIdentifier","webSearchAnswers","Object","entries","flatMap","nodeDevData","evalResults","evaluation_result","isArray","map","index","String","getEvaluationNodes","filter","answerKey","evaluation","webSearchAnswer","web_search_answer","colorPalette","generateColorPalette","metadata","label_color","border","enhanced_content","answer","answerOrder","activeAnswerKey","exactMatch","find","baseNodeId","webGptExtraMetaByKey","reduce","acc","extraMetaData","forEach","extraMetaDataForReasoning","metaKey","componentsByAnswerKey","a","href","children","type","reason","props","matchedExtraMetaData","jsx","CitationAnchor","citationType","citationReason","metaData","webGpt","webGptMetaKey","customStyle","Box","sx","padding","backgroundColor","borderRadius","SHARED_MARKDOWN_STYLES","overflow","length","isActive","id","mb","ReactMarkdown","rehypePlugins","rehypeRaw","components","Typography","fontSize","py"],"mappings":"8bASA,MAYMA,EAAqB,EAAGC,eACoC,IAAhEA,GAAUC,oBAAoBC,gBAAgBC,cAE1CC,EAAqB,CAACC,EAAgBC,EAAuBC,IACjE,GAAGF,MAAWC,MAAkBC,IAE5BC,EAAuB,CAACH,EAAgBC,IAC5C,GAAGD,MAAWC,IAEVG,EAAyB,CAC7BC,gBAAiB,CACfC,cAAe,YAEjBC,MAAO,CACLC,MAAO,YAULC,EAAc,EAAGC,gBAAeC,oBAAmBC,uBACvD,MAAMC,EAAmBC,MAAMC,KAAKJ,GAAqB,IAAI,GACvDK,EAAkBC,EACtB,IAAMC,EAA0B,CAC9BC,iBAAkBN,EAClBH,gBACAE,iBAAkBA,GAAoB,KAExC,CAACC,EAAkBH,EAAeE,IAG9BQ,EAAmBH,EAAQ,KAC/B,IAAKP,GAA0C,iBAAlBA,QAAmC,GAezD,OAAAW,OAAOC,QAAQZ,GACnBa,QAdqB,EAAEvB,EAAQwB,KAlDX,CAACA,IAC1B,MAAMC,EAAe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+B,EAAAuB,EAAA,CAAWd,GAAI,CAAEjE,MAAO,UAAWgF,SAAU,OAAQC,GAAI,GAAK9B"}
|
|
1
|
+
{"version":3,"file":"WebGptPanel.js","sources":["../../../../../src/features/CognitiveCompare/Guidelines/components/WebGptPanel.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\nimport { Box, Typography } from '@mui/material';\nimport ReactMarkdown from 'react-markdown';\nimport rehypeRaw from 'rehype-raw';\nimport { SHARED_MARKDOWN_STYLES } from '../../CognitiveCompareConfig';\nimport { DEVIATION_BADGE_SEPARATOR, generateColorPalette } from '../../CognitiveComparehelpers';\nimport CitationAnchor from '../../CitationAnchor';\n\nconst getBaseNodeId = (activeNodeIdFull: unknown, proposedSections: Record<string, unknown>[]) => {\n if (typeof activeNodeIdFull === 'number') {\n return proposedSections[activeNodeIdFull]?.nodeId || \"\";\n }\n\n if (activeNodeIdFull && typeof activeNodeIdFull === 'string' && activeNodeIdFull.trim()) {\n if (activeNodeIdFull.includes(DEVIATION_BADGE_SEPARATOR)) {\n return activeNodeIdFull.split(DEVIATION_BADGE_SEPARATOR)[0];\n }\n\n return activeNodeIdFull.split('::')[0].split(':')[0];\n }\n\n return \"\";\n};\n\nconst getEvaluationNodes = (nodeDevData: Record<string, unknown>) => {\n const evalResults = (nodeDevData && typeof nodeDevData === 'object') ? nodeDevData.evaluation_result : null;\n if (!evalResults || (typeof evalResults !== 'object' && !Array.isArray(evalResults))) return [];\n if (Array.isArray(evalResults)) {\n return evalResults.map((evalNode, index) => ({ evalNode, evaluationKey: String(index) }));\n }\n if (typeof evalResults === \"object\") {\n return Object.entries(evalResults).map(([evaluationKey, evalNode]) => ({ evalNode, evaluationKey }));\n }\n return [];\n};\n\nconst isWebGptEvaluation = ({ evalNode }: { evalNode: Record<string, any> }) =>\n evalNode?.evaluation_outputs?.guideline_flag?.rulebook_used === false;\n\nconst buildWebGptMetaKey = (nodeId: string, evaluationKey: string, reasoningId: string) =>\n `${nodeId}::${evaluationKey}::${reasoningId}`;\n\nconst buildWebGptAnswerKey = (nodeId: string, evaluationKey: string) =>\n `${nodeId}::${evaluationKey}`;\n\nconst WEB_GPT_CITATION_STYLE = {\n relativeWrapper: {\n verticalAlign: \"baseline\",\n },\n arrow: {\n color: \"#6D28D9\"\n }\n};\n\ninterface WebGptPanelProps {\n deviationData: Record<string, unknown>;\n connectedSections: Iterable<unknown>;\n proposedSections: Record<string, unknown>[];\n}\n\nconst WebGptPanel = ({ deviationData, connectedSections, proposedSections }: WebGptPanelProps) => {\n const activeNodeIdFull = Array.from(connectedSections || [])[0];\n const activeBaseNodeId = useMemo(\n () => getBaseNodeId(activeNodeIdFull, proposedSections || []),\n [activeNodeIdFull, proposedSections],\n );\n\n const webSearchAnswers = useMemo(() => {\n if (!deviationData || typeof deviationData !== \"object\") return [];\n\n const collectFromNode = ([nodeId, nodeDevData]: [string, any]) =>\n getEvaluationNodes(nodeDevData)\n .filter(isWebGptEvaluation)\n .map(({ evalNode, evaluationKey }: any) => ({\n nodeId,\n evaluationKey,\n answerKey: buildWebGptAnswerKey(nodeId, evaluationKey),\n evaluation: evalNode,\n webSearchAnswer: evalNode.web_search_answer,\n colorPalette : generateColorPalette(evalNode?.evaluation_outputs?.metadata?.label_color || \"\") ?? {border: WEB_GPT_CITATION_STYLE.arrow.color},\n }))\n .filter(({ webSearchAnswer }: any) => !!webSearchAnswer?.enhanced_content);\n\n return Object.entries(deviationData)\n .flatMap(collectFromNode as any)\n .map((answer: any, answerOrder: number) => ({\n ...answer,\n answerOrder,\n }));\n }, [deviationData]);\n\n const webGptExtraMetaByKey = useMemo(() => {\n return webSearchAnswers.reduce((acc: Record<string, any>, answer: any) => {\n const extraMetaData = answer.webSearchAnswer?.extraMetaData || {};\n\n Object.entries(extraMetaData).forEach(([reasoningId, extraMetaDataForReasoning]) => {\n const metaKey = buildWebGptMetaKey(answer.nodeId, answer.evaluationKey, reasoningId);\n acc[metaKey] = {\n nodeId: answer.nodeId,\n evaluationKey: answer.evaluationKey,\n answerKey: answer.answerKey,\n answerOrder: answer.answerOrder,\n reasoningId,\n evaluation: answer.evaluation,\n webSearchAnswer: answer.webSearchAnswer,\n extraMetaData: extraMetaDataForReasoning,\n };\n });\n\n return acc;\n }, {});\n }, [webSearchAnswers]);\n\n const componentsByAnswerKey = useMemo(() => {\n return webSearchAnswers.reduce((acc: Record<string, any>, answer: any) => {\n acc[answer.answerKey] = {\n a: ({ href = \"\", children, type, reason, ...props }: any) => {\n const reasoningId = props?.[\"data-cognitive-reasoning\"];\n const metaKey = reasoningId\n ? buildWebGptMetaKey(answer.nodeId, answer.evaluationKey, String(reasoningId))\n : \"\";\n const matchedExtraMetaData = metaKey ? webGptExtraMetaByKey[metaKey] : null;\n\n return (\n <CitationAnchor\n href={href}\n children={children}\n citationType={type}\n citationReason={reason}\n metaData={{\n webGpt: matchedExtraMetaData,\n webGptMetaKey: metaKey,\n }}\n customStyle={WEB_GPT_CITATION_STYLE}\n />\n );\n },\n };\n\n return acc;\n }, {});\n }, [webSearchAnswers, webGptExtraMetaByKey]);\n\n return (\n <Box sx={{ \n padding: '12px 12px 12px 0px', \n backgroundColor: '#FFFFFF', \n borderRadius: '8px', \n ...SHARED_MARKDOWN_STYLES,\n overflow: 'visible' \n }}>\n {webSearchAnswers.length > 0 ? (\n webSearchAnswers.map((answer: any, index: number) => (\n <Box\n key={answer.answerKey}\n // ── MAGIC FIX: This ID tells alignStraightLines & the SVG drawer exactly where to connect! ──\n id={answer.nodeId === activeBaseNodeId ? \"guideline-target-0\" : undefined}\n data-web-gpt-node-id={answer.nodeId}\n data-web-gpt-evaluation-key={answer.evaluationKey}\n data-web-gpt-answer-order={answer.answerOrder}\n data-web-gpt-active={answer.nodeId === activeBaseNodeId ? \"true\" : \"false\"}\n sx={{ mb: 1.5,\n border: (answer.nodeId === activeBaseNodeId) ? `2px solid ${answer.colorPalette.border}` : \"1px solid #d3d3d3\",\n borderRadius: \"6px\",\n padding: \"8px\",\n backgroundColor: \"#FFFFFF\",\n }}\n >\n <ReactMarkdown\n rehypePlugins={[rehypeRaw as any]}\n components={componentsByAnswerKey[answer.answerKey]}\n >\n {answer.webSearchAnswer.enhanced_content}\n </ReactMarkdown>\n </Box>\n ))\n ) : (\n <Typography sx={{ color: \"#64748B\", fontSize: \"14px\", py: 1 }}>\n No web GPT data available.\n </Typography>\n )}\n </Box>\n );\n};\n\nexport default WebGptPanel;\n"],"names":["isWebGptEvaluation","evalNode","evaluation_outputs","guideline_flag","rulebook_used","buildWebGptMetaKey","nodeId","evaluationKey","reasoningId","buildWebGptAnswerKey","WEB_GPT_CITATION_STYLE","relativeWrapper","verticalAlign","arrow","color","WebGptPanel","deviationData","connectedSections","proposedSections","activeNodeIdFull","Array","from","activeBaseNodeId","useMemo","trim","includes","DEVIATION_BADGE_SEPARATOR","split","getBaseNodeId","webSearchAnswers","Object","entries","flatMap","nodeDevData","evalResults","evaluation_result","isArray","map","index","String","getEvaluationNodes","filter","answerKey","evaluation","webSearchAnswer","web_search_answer","colorPalette","generateColorPalette","metadata","label_color","border","enhanced_content","answer","answerOrder","webGptExtraMetaByKey","reduce","acc","extraMetaData","forEach","extraMetaDataForReasoning","metaKey","componentsByAnswerKey","a","href","children","type","reason","props","matchedExtraMetaData","jsx","CitationAnchor","citationType","citationReason","metaData","webGpt","webGptMetaKey","customStyle","Box","sx","padding","backgroundColor","borderRadius","SHARED_MARKDOWN_STYLES","overflow","length","id","mb","ReactMarkdown","rehypePlugins","rehypeRaw","components","Typography","fontSize","py"],"mappings":"2YAQA,MA4BMA,EAAqB,EAAGC,eACoC,IAAhEA,GAAUC,oBAAoBC,gBAAgBC,cAE1CC,EAAqB,CAACC,EAAgBC,EAAuBC,IACjE,GAAGF,MAAWC,MAAkBC,IAE5BC,EAAuB,CAACH,EAAgBC,IAC5C,GAAGD,MAAWC,IAEVG,EAAyB,CAC7BC,gBAAiB,CACfC,cAAe,YAEjBC,MAAO,CACLC,MAAO,YAULC,EAAc,EAAGC,gBAAeC,oBAAmBC,uB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ASE,EAAO9C,SAAWgB,EAAoB,aAAa8B,EAAON,aAAaI,SAAW,oBAC3F+B,aAAc,MACdF,QAAS,MACTC,gBAAiB,WAGnBhB,SAAAK,EAACkB,EAAA,CACCC,cAAe,CAACC,GAChBC,WAAY7B,EAAsBT,EAAOV,WAExCsB,WAAOpB,gBAAgBO,oBAlBrBC,EAAOV,YAuBf2B,EAAAsB,EAAA,CAAWb,GAAI,CAAEhE,MAAO,UAAW8E,SAAU,OAAQC,GAAI,GAAK7B"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const t=
|
|
1
|
+
const t=({guidelinesData:t,targetHighlights:e=[],labelColor:a="#FEF08A"})=>{let n="";if(t?.learnings_data&&Object.keys(t.learnings_data).length>0){const e=Object.keys(t.learnings_data)[0],a=t.learnings_data[e];a?.instruction_prompt&&(n=a.instruction_prompt)}else{(t?.data?.artifactData?.userStorySnapshot||[]).forEach(t=>{t.title&&(n+=`### ${t.title}\n\n`),t.value&&(n+=`${t.value}\n\n`),t.sub_features?.forEach(t=>{t.title&&(n+=`#### ${t.title}\n\n`),t.value&&(n+=`${t.value}\n\n`)})})}return e.forEach((t,e)=>{const r=t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"),l=new RegExp(`(${r})`,"g");n=n.replace(l,`<mark id="guideline-target-${e}" style="background-color: ${a}; border-radius: 3px; padding: 2px;">$1</mark>`)}),n};export{t as processGuidelinesMarkdown};
|
|
2
2
|
//# sourceMappingURL=processGuidelinesMarkdown.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processGuidelinesMarkdown.js","sources":["../../../../../src/features/CognitiveCompare/Guidelines/utils/processGuidelinesMarkdown.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"processGuidelinesMarkdown.js","sources":["../../../../../src/features/CognitiveCompare/Guidelines/utils/processGuidelinesMarkdown.ts"],"sourcesContent":["export const processGuidelinesMarkdown = ({\n guidelinesData,\n targetHighlights = [],\n labelColor = \"#FEF08A\",\n}: {\n guidelinesData: any;\n targetHighlights?: string[];\n labelColor?: string;\n}) => {\n let combinedMarkdown = \"\";\n\n // ── NEW STRUCTURE: Check for learnings_data and use instruction_prompt from the first entry ──\n if (guidelinesData?.learnings_data && Object.keys(guidelinesData.learnings_data).length > 0) {\n const firstLearningKey = Object.keys(guidelinesData.learnings_data)[0];\n const firstLearning = guidelinesData.learnings_data[firstLearningKey];\n \n if (firstLearning?.instruction_prompt) {\n combinedMarkdown = firstLearning.instruction_prompt;\n }\n } \n // ── OLD STRUCTURE FALLBACK (Prevents breaking existing functionality) ──\n else {\n const snapshots = guidelinesData?.data?.artifactData?.userStorySnapshot || [];\n snapshots.forEach((story: any) => {\n if (story.title) combinedMarkdown += `### ${story.title}\\n\\n`;\n if (story.value) combinedMarkdown += `${story.value}\\n\\n`;\n\n story.sub_features?.forEach((sub: any) => {\n if (sub.title) combinedMarkdown += `#### ${sub.title}\\n\\n`;\n if (sub.value) combinedMarkdown += `${sub.value}\\n\\n`;\n });\n });\n }\n\n targetHighlights.forEach((targetText, index) => {\n const escapedText = targetText.replace(\n /[-\\/\\\\^$*+?.()|[\\]{}]/g,\n \"\\\\$&\"\n );\n\n const regex = new RegExp(`(${escapedText})`, \"g\");\n\n combinedMarkdown = combinedMarkdown.replace(\n regex,\n `<mark id=\"guideline-target-${index}\" style=\"background-color: ${labelColor}; border-radius: 3px; padding: 2px;\">$1</mark>`\n );\n });\n\n return combinedMarkdown;\n};"],"names":["processGuidelinesMarkdown","guidelinesData","targetHighlights","labelColor","combinedMarkdown","learnings_data","Object","keys","length","firstLearningKey","firstLearning","instruction_prompt","data","artifactData","userStorySnapshot","forEach","story","title","value","sub_features","sub","targetText","index","escapedText","replace","regex","RegExp"],"mappings":"AAAO,MAAMA,EAA4B,EACvCC,iBACAC,mBAAmB,GACnBC,aAAa,cAMb,IAAIC,EAAmB,GAGnB,GAAAH,GAAgBI,gBAAkBC,OAAOC,KAAKN,EAAeI,gBAAgBG,OAAS,EAAG,CAC3F,MAAMC,EAAmBH,OAAOC,KAAKN,EAAeI,gBAAgB,GAC9DK,EAAgBT,EAAeI,eAAeI,GAEhDC,GAAeC,qBACjBP,EAAmBM,EAAcC,mBACnC,KAGG,EACeV,GAAgBW,MAAMC,cAAcC,mBAAqB,IACjEC,QAASC,IACbA,EAAMC,QAA2Bb,GAAA,OAAOY,EAAMC,aAC9CD,EAAME,QAA2Bd,GAAA,GAAGY,EAAME,aAExCF,EAAAG,cAAcJ,QAASK,IACvBA,EAAIH,QAA2Bb,GAAA,QAAQgB,EAAIH,aAC3CG,EAAIF,QAA2Bd,GAAA,GAAGgB,EAAIF,gBAGhD,CAgBO,OAdUhB,EAAAa,QAAQ,CAACM,EAAYC,KACpC,MAAMC,EAAcF,EAAWG,QAC7B,yBACA,QAGIC,EAAQ,IAAIC,OAAO,IAAIH,KAAgB,KAE7CnB,EAAmBA,EAAiBoB,QAClCC,EACA,8BAA8BH,+BAAmCnB,qDAI9DC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as e,jsxs as o}from"react/jsx-runtime";import i from"react";import{Box as t}from"@mui/material";import{EllipsisVertical as
|
|
1
|
+
import{jsx as e,jsxs as o}from"react/jsx-runtime";import i from"react";import{Box as n,Tooltip as t}from"@mui/material";import{EllipsisVertical as r}from"lucide-react";import a from"./SectionAccordion.js";import l from"./ThreeDotsLoader.js";import{extractDeviationScore as d}from"../CognitiveComparehelpers.js";import{useCompareContext as s}from"../CompareContext.js";const p=i.memo(({section:i,idx:p})=>{const{maintainRelativeOrder:c,existingSections:g,proposedSections:u,connectedSections:m,expandedSections:x,displayConfig:f,deviationAnalysisStatus:h,treeData:S,deviationNumberRegistry:b,getSectionCompareStyle:v,getBadgeRef:y,getSectionRowRef:R,sectionLeftRefs:w,lhsBadgeRefs:B,openMoreFunctionsPopup:C,handleOpenSummaryPopup:I,handleCloseSummaryPopup:N,toggleSection:$,showDeviationBadges:k=!1,renderSubSectionAccordion:D,isProposingFix:P,proposingFixNodeId:A,isRedlineFlow:T,isSideBySide:j,activeSideBySideSection:z,scrollSyncLocked:F,toggleScrollSyncLocked:L,summaryPopupAnchorEl:O,deviationNodeIdToView:_,deviationTargetParentId:W,showDeviationNavigation:E,showOpenNodeRef:M,resolvedMarkdownStyles:K,unifiedNumbering:V}=s(),X=!i.title&&!i.content;if(c&&X)return null;const Y=i,q=v(p,"left"),G=c?!Y.refIndexes?.length||Y.selfIndex<0:!g[p],H=m.has(p);B.current[p];const J=d(Y.evaluationResult,q?.deviationLabel),Q=V.leftNums.get(Y.id),U=("mapping_ready"===h||"deviations_streaming"===h)&&(null==Y.evaluationResult||void 0===Y.evaluationResult);return e(n,{ref:R(p),sx:{mb:1,width:"100%"},children:e(n,{ref:w.current[p],sx:{width:"100%",display:"flex",flexDirection:"column",minWidth:0,...H&&{borderRadius:"6px",outline:`2px solid ${q?.badgeBorder||"#6366F1"}`,outlineOffset:"1px"}},children:o(n,{sx:{position:"relative",width:"100%"},children:[e(a,{section:i,idx:p,columnKey:"left",colRef:R(`left-accordion-${p}`),mb:0,parentNodeId:S?.input_index_map?.[0]||"",isExpanded:c?!!x[`left-${p}`]:!!x[String(p)],onToggle:()=>{N(),$(p,"left")},navigation:i.id?E[i.id]:null}),c&&q&&o(n,{ref:B.current[p],onClick:e=>{const o=f.enableDeviationSchemaBackwardCompatibility?Y.evaluationResult??null:Y.evaluationResult?.[0]??null;I(e,String(p),G,o)},sx:{position:"absolute",top:"18px",right:0,transform:"translateY(-50%) translateX(calc(100% + 8px))",display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",bgcolor:q.badgeBg,color:q.badgeText,border:`1px solid ${q.badgeBorder}`,borderRadius:"12px",px:1.2,py:.3,fontWeight:600,cursor:"pointer",whiteSpace:"nowrap",zIndex:20,boxShadow:"0 1px 3px rgba(0,0,0,0.07)"},children:[o(n,{component:"span",onClick:e=>{e.stopPropagation();const o=f.enableDeviationSchemaBackwardCompatibility?Y.evaluationResult??null:Y.evaluationResult?.[0]??null;I(e,String(p),G,o)},sx:{display:"inline-flex",alignItems:"center",gap:"4px",px:.2,cursor:G?"default":"pointer",borderRight:`1px solid ${q.badgeBorder}`,"&:hover":G?{}:{bgColor:`${q.badgeBorder}22`}},children:[null!=Q&&e(n,{component:"span",sx:{fontSize:"11px",fontWeight:700,pr:.5,borderRight:`1px solid ${q.badgeBorder}`},children:Q}),e(n,{component:"span",sx:{fontSize:"11px",px:.25},children:U?e(t,{title:"Deviation data generation in progress",placement:"top",arrow:!0,children:e(n,{component:"span",sx:{display:"inline-flex",alignItems:"center"},children:e(l,{color:q.badgeText})})}):"N/A"===J||"NA"===J?"N/A":0==J||null==J?"Same":`${J}`})]}),e(n,{component:"span",onClick:e=>{e.stopPropagation();const o=c?g.find(e=>Y.refIndexes?.includes(e.selfIndex))||{title:"",content:""}:g[p]||{title:"",content:""};C(e,i,G,o,p,q)},sx:{display:"inline-flex",alignItems:"center",px:.2,cursor:"pointer","&:hover":{bgcolor:`${q.badgeBorder}22`}},children:e(r,{size:11,color:q.badgeText})})]})]})})},`left-row-${p}`)});export{p as default};
|
|
2
2
|
//# sourceMappingURL=LHSSectionRow.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LHSSectionRow.js","sources":["../../../../src/features/CognitiveCompare/components/LHSSectionRow.tsx"],"sourcesContent":["import React from \"react\";\nimport { Box } from \"@mui/material\";\nimport { EllipsisVertical } from \"lucide-react\";\n\nimport SectionAccordion from \"./SectionAccordion\";\nimport ThreeDotsLoader from \"./ThreeDotsLoader\";\nimport ScrollLockToggle from \"./ScrollLockToggle\";\nimport { extractDeviationScore } from \"../CognitiveComparehelpers\";\nimport { SectionBlock, StyleVariant } from \"../CognitiveCompareTypes\";\nimport { useCompareContext } from \"../CompareContext\";\n\ntype UnifiedNumbering = {\n leftNums: Map<string, number>;\n rightNums: Map<string, string>;\n};\n\ntype LHSSectionRowProps = {\n section: SectionBlock;\n idx: number;\n};\n\nconst LHSSectionRow = React.memo(\n ({\n section,\n idx,\n }: LHSSectionRowProps) => {\n const {\n maintainRelativeOrder,\n existingSections,\n proposedSections,\n connectedSections,\n expandedSections,\n displayConfig,\n treeData,\n deviationNumberRegistry,\n getSectionCompareStyle,\n getBadgeRef,\n getSectionRowRef,\n sectionLeftRefs,\n lhsBadgeRefs,\n openMoreFunctionsPopup,\n handleOpenSummaryPopup,\n handleCloseSummaryPopup,\n toggleSection,\n showDeviationBadges = false,\n renderSubSectionAccordion,\n isProposingFix,\n proposingFixNodeId,\n isRedlineFlow,\n isSideBySide,\n activeSideBySideSection,\n scrollSyncLocked,\n toggleScrollSyncLocked,\n summaryPopupAnchorEl,\n deviationNodeIdToView,\n deviationTargetParentId,\n showDeviationNavigation,\n showOpenNodeRef,\n resolvedMarkdownStyles,\n unifiedNumbering,\n } = useCompareContext();\n const isEmpty = !section.title && !section.content;\n if (maintainRelativeOrder && isEmpty) return null;\n\n const sec = section as any;\n const style = getSectionCompareStyle(idx, \"left\");\n const isOrphan = maintainRelativeOrder\n ? (!sec.refIndexes?.length || sec.selfIndex < 0)\n : !existingSections[idx];\n const isConnected = connectedSections.has(idx);\n const badgeEl = lhsBadgeRefs.current[idx]?.current;\n const showScrollLockToggle =\n isConnected ||\n (isSideBySide && activeSideBySideSection === idx) ||\n (!!summaryPopupAnchorEl && summaryPopupAnchorEl === badgeEl);\n const rawScore = extractDeviationScore(sec.evaluationResult, (style as any)?.deviationLabel);\n const displayNum = unifiedNumbering.leftNums.get(sec.id);\n\n return (\n <Box key={`left-row-${idx}`} ref={getSectionRowRef(idx)} sx={{ mb: 1, width: \"100%\" }}>\n <Box\n ref={sectionLeftRefs.current[idx]}\n sx={{\n width: \"100%\",\n display: \"flex\",\n flexDirection: \"column\",\n minWidth: 0,\n ...(isConnected && {\n borderRadius: \"6px\",\n outline: `2px solid ${style?.badgeBorder || \"#6366F1\"}`,\n outlineOffset: \"1px\",\n }),\n }}\n >\n <Box sx={{ position: \"relative\", width: \"100%\" }}>\n <SectionAccordion\n section={section}\n idx={idx}\n columnKey=\"left\"\n colRef={getSectionRowRef(`left-accordion-${idx}`)}\n mb={0}\n parentNodeId={treeData?.input_index_map?.[\"0\"] || \"\"}\n isExpanded={\n maintainRelativeOrder\n ? !!expandedSections[`left-${idx}`]\n : !!expandedSections[String(idx)]\n }\n onToggle={() => {\n handleCloseSummaryPopup();\n toggleSection(idx, \"left\");\n }}\n navigation={section.id ? showDeviationNavigation[section.id] : null}\n />\n\n {maintainRelativeOrder && style && (\n <Box\n ref={lhsBadgeRefs.current[idx]}\n onClick={(e) => {\n const evaluationResult = displayConfig.enableDeviationSchemaBackwardCompatibility\n ? (sec.evaluationResult ?? null)\n : (sec.evaluationResult?.[0] ?? null);\n handleOpenSummaryPopup(e, String(idx), isOrphan, evaluationResult);\n }}\n sx={{\n position: \"absolute\",\n top: \"18px\",\n right: 0,\n transform: \"translateY(-50%) translateX(calc(100% + 8px))\",\n display: \"inline-flex\",\n alignItems: \"center\",\n gap: \"4px\",\n fontSize: \"11px\",\n bgcolor: style.badgeBg,\n color: style.badgeText,\n border: `1px solid ${style.badgeBorder}`,\n borderRadius: \"12px\",\n px: 1.2,\n py: 0.3,\n fontWeight: 600,\n cursor: \"pointer\",\n whiteSpace: \"nowrap\",\n zIndex: 20,\n boxShadow: \"0 1px 3px rgba(0,0,0,0.07)\",\n }}\n >\n <Box\n component=\"span\"\n onClick={(e) => {\n e.stopPropagation();\n const evaluationResult = displayConfig.enableDeviationSchemaBackwardCompatibility\n ? (sec.evaluationResult ?? null)\n : (sec.evaluationResult?.[0] ?? null);\n handleOpenSummaryPopup(e, String(idx), isOrphan, evaluationResult);\n }}\n sx={{\n display: \"inline-flex\",\n alignItems: \"center\",\n gap: \"4px\",\n px: 0.2,\n cursor: isOrphan ? \"default\" : \"pointer\",\n borderRight: `1px solid ${style.badgeBorder}`,\n \"&:hover\": !isOrphan ? { bgColor: `${style.badgeBorder}22` } : {},\n }}\n >\n {displayNum != null && (\n <Box\n component=\"span\"\n sx={{\n fontSize: \"11px\",\n fontWeight: 700,\n pr: 0.5,\n borderRight: `1px solid ${style.badgeBorder}`,\n }}\n >\n {displayNum}\n </Box>\n )}\n\n <Box component=\"span\" sx={{ fontSize: \"11px\", px: 0.25 }}>\n {displayConfig.isLoading && (sec.evaluationResult == null || sec.evaluationResult === undefined)\n ? <ThreeDotsLoader color={style.badgeText} />\n : (rawScore === \"N/A\" || rawScore === \"NA\")\n ? \"N/A\"\n : (rawScore == 0 || rawScore == null)\n ? \"Same\"\n : `${rawScore}`}\n </Box>\n </Box>\n <Box\n component=\"span\"\n onClick={(e) => {\n e.stopPropagation();\n const refSec = maintainRelativeOrder\n ? (existingSections.find((s: any) => sec.refIndexes?.includes(s.selfIndex)) || { title: \"\", content: \"\" }) as SectionBlock\n : (existingSections[idx] || { title: \"\", content: \"\" }) as SectionBlock;\n\n openMoreFunctionsPopup(e, section, isOrphan, refSec, idx, style);\n }}\n sx={{\n display: \"inline-flex\",\n alignItems: \"center\",\n px: 0.2,\n cursor: \"pointer\",\n \"&:hover\": { bgcolor: `${style.badgeBorder}22` },\n }}\n >\n <EllipsisVertical size={11} color={style.badgeText} />\n </Box>\n {/* {showScrollLockToggle && (\n <ScrollLockToggle\n locked={scrollSyncLocked}\n onToggle={toggleScrollSyncLocked}\n color={style.badgeText}\n borderColor={style.badgeBorder}\n size={11}\n />\n )} */}\n </Box>\n )}\n </Box>\n </Box>\n </Box>\n );\n },\n);\n\nexport default LHSSectionRow;\n"],"names":["LHSSectionRow","React","memo","section","idx","maintainRelativeOrder","existingSections","proposedSections","connectedSections","expandedSections","displayConfig","treeData","deviationNumberRegistry","getSectionCompareStyle","getBadgeRef","getSectionRowRef","sectionLeftRefs","lhsBadgeRefs","openMoreFunctionsPopup","handleOpenSummaryPopup","handleCloseSummaryPopup","toggleSection","showDeviationBadges","renderSubSectionAccordion","isProposingFix","proposingFixNodeId","isRedlineFlow","isSideBySide","activeSideBySideSection","scrollSyncLocked","toggleScrollSyncLocked","summaryPopupAnchorEl","deviationNodeIdToView","deviationTargetParentId","showDeviationNavigation","showOpenNodeRef","resolvedMarkdownStyles","unifiedNumbering","useCompareContext","isEmpty","title","content","sec","style","isOrphan","refIndexes","length","selfIndex","isConnected","has","current","rawScore","extractDeviationScore","evaluationResult","deviationLabel","displayNum","leftNums","get","id","jsx","Box","ref","sx","mb","width","children","display","flexDirection","minWidth","borderRadius","outline","badgeBorder","outlineOffset","jsxs","position","SectionAccordion","columnKey","colRef","parentNodeId","input_index_map","isExpanded","String","onToggle","navigation","onClick","e","enableDeviationSchemaBackwardCompatibility","top","right","transform","alignItems","gap","fontSize","bgcolor","badgeBg","color","badgeText","border","px","py","fontWeight","cursor","whiteSpace","zIndex","boxShadow","component","stopPropagation","borderRight","bgColor","pr","isLoading","ThreeDotsLoader","refSec","find","s","includes","EllipsisVertical","size"],"mappings":"mWAqBA,MAAMA,EAAgBC,EAAMC,KAC1B,EACEC,UACAC,UAEM,MAAAC,sBACJA,EAAAC,iBACAA,EAAAC,iBACAA,EAAAC,kBACAA,EAAAC,iBACAA,EAAAC,cACAA,EAAAC,SACAA,EAAAC,wBACAA,EAAAC,uBACAA,EAAAC,YACAA,EAAAC,iBACAA,EAAAC,gBACAA,EAAAC,aACAA,EAAAC,uBACAA,EAAAC,uBACAA,EAAAC,wBACAA,EAAAC,cACAA,EAAAC,oBACAA,GAAsB,EAAAC,0BACtBA,EAAAC,eACAA,EAAAC,mBACAA,EAAAC,cACAA,EAAAC,aACAA,EAAAC,wBACAA,EAAAC,iBACAA,EAAAC,uBACAA,EAAAC,qBACAA,EAAAC,sBACAA,EAAAC,wBACAA,EAAAC,wBACAA,EAAAC,gBACAA,EAAAC,uBACAA,EAAAC,iBACAA,GACEC,IACEC,GAAWpC,EAAQqC,QAAUrC,EAAQsC,QACvC,GAAApC,GAAyBkC,EAAgB,OAAA,KAE7C,MAAMG,EAAMvC,EACNwC,EAAQ9B,EAAuBT,EAAK,QACpCwC,EAAWvC,GACX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AuBmE,EAAGlF,EAASyC,EAAUoE,EAAQ5G,EAAKuC,IAE5DmB,GAAI,CACFI,QAAS,cACTwB,WAAY,SACZQ,GAAI,GACJG,OAAQ,UACR,UAAW,CAAER,QAAS,GAAGlD,EAAM4B,kBAGjCN,WAACmD,EAAiB,CAAAC,KAAM,GAAItB,MAAOpD,EAAMqD,uBA/HzC,YAAY5F"}
|
|
1
|
+
{"version":3,"file":"LHSSectionRow.js","sources":["../../../../src/features/CognitiveCompare/components/LHSSectionRow.tsx"],"sourcesContent":["import React from \"react\";\nimport { Box, Tooltip } from \"@mui/material\";\nimport { EllipsisVertical } from \"lucide-react\";\n\nimport SectionAccordion from \"./SectionAccordion\";\nimport ThreeDotsLoader from \"./ThreeDotsLoader\";\nimport ScrollLockToggle from \"./ScrollLockToggle\";\nimport { extractDeviationScore } from \"../CognitiveComparehelpers\";\nimport { SectionBlock, StyleVariant } from \"../CognitiveCompareTypes\";\nimport { useCompareContext } from \"../CompareContext\";\n\ntype UnifiedNumbering = {\n leftNums: Map<string, number>;\n rightNums: Map<string, string>;\n};\n\ntype LHSSectionRowProps = {\n section: SectionBlock;\n idx: number;\n};\n\nconst LHSSectionRow = React.memo(\n ({\n section,\n idx,\n }: LHSSectionRowProps) => {\n const {\n maintainRelativeOrder,\n existingSections,\n proposedSections,\n connectedSections,\n expandedSections,\n displayConfig,\n deviationAnalysisStatus,\n treeData,\n deviationNumberRegistry,\n getSectionCompareStyle,\n getBadgeRef,\n getSectionRowRef,\n sectionLeftRefs,\n lhsBadgeRefs,\n openMoreFunctionsPopup,\n handleOpenSummaryPopup,\n handleCloseSummaryPopup,\n toggleSection,\n showDeviationBadges = false,\n renderSubSectionAccordion,\n isProposingFix,\n proposingFixNodeId,\n isRedlineFlow,\n isSideBySide,\n activeSideBySideSection,\n scrollSyncLocked,\n toggleScrollSyncLocked,\n summaryPopupAnchorEl,\n deviationNodeIdToView,\n deviationTargetParentId,\n showDeviationNavigation,\n showOpenNodeRef,\n resolvedMarkdownStyles,\n unifiedNumbering,\n } = useCompareContext();\n const isEmpty = !section.title && !section.content;\n if (maintainRelativeOrder && isEmpty) return null;\n\n const sec = section as any;\n const style = getSectionCompareStyle(idx, \"left\");\n const isOrphan = maintainRelativeOrder\n ? (!sec.refIndexes?.length || sec.selfIndex < 0)\n : !existingSections[idx];\n const isConnected = connectedSections.has(idx);\n const badgeEl = lhsBadgeRefs.current[idx]?.current;\n const showScrollLockToggle =\n isConnected ||\n (isSideBySide && activeSideBySideSection === idx) ||\n (!!summaryPopupAnchorEl && summaryPopupAnchorEl === badgeEl);\n const rawScore = extractDeviationScore(sec.evaluationResult, (style as any)?.deviationLabel);\n const displayNum = unifiedNumbering.leftNums.get(sec.id);\n const isDeviationGenerationInProgress =\n deviationAnalysisStatus === \"mapping_ready\" ||\n deviationAnalysisStatus === \"deviations_streaming\";\n const shouldShowDeviationLoader =\n isDeviationGenerationInProgress &&\n (sec.evaluationResult == null || sec.evaluationResult === undefined);\n\n return (\n <Box key={`left-row-${idx}`} ref={getSectionRowRef(idx)} sx={{ mb: 1, width: \"100%\" }}>\n <Box\n ref={sectionLeftRefs.current[idx]}\n sx={{\n width: \"100%\",\n display: \"flex\",\n flexDirection: \"column\",\n minWidth: 0,\n ...(isConnected && {\n borderRadius: \"6px\",\n outline: `2px solid ${style?.badgeBorder || \"#6366F1\"}`,\n outlineOffset: \"1px\",\n }),\n }}\n >\n <Box sx={{ position: \"relative\", width: \"100%\" }}>\n <SectionAccordion\n section={section}\n idx={idx}\n columnKey=\"left\"\n colRef={getSectionRowRef(`left-accordion-${idx}`)}\n mb={0}\n parentNodeId={treeData?.input_index_map?.[\"0\"] || \"\"}\n isExpanded={\n maintainRelativeOrder\n ? !!expandedSections[`left-${idx}`]\n : !!expandedSections[String(idx)]\n }\n onToggle={() => {\n handleCloseSummaryPopup();\n toggleSection(idx, \"left\");\n }}\n navigation={section.id ? showDeviationNavigation[section.id] : null}\n />\n\n {maintainRelativeOrder && style && (\n <Box\n ref={lhsBadgeRefs.current[idx]}\n onClick={(e) => {\n const evaluationResult = displayConfig.enableDeviationSchemaBackwardCompatibility\n ? (sec.evaluationResult ?? null)\n : (sec.evaluationResult?.[0] ?? null);\n handleOpenSummaryPopup(e, String(idx), isOrphan, evaluationResult);\n }}\n sx={{\n position: \"absolute\",\n top: \"18px\",\n right: 0,\n transform: \"translateY(-50%) translateX(calc(100% + 8px))\",\n display: \"inline-flex\",\n alignItems: \"center\",\n gap: \"4px\",\n fontSize: \"11px\",\n bgcolor: style.badgeBg,\n color: style.badgeText,\n border: `1px solid ${style.badgeBorder}`,\n borderRadius: \"12px\",\n px: 1.2,\n py: 0.3,\n fontWeight: 600,\n cursor: \"pointer\",\n whiteSpace: \"nowrap\",\n zIndex: 20,\n boxShadow: \"0 1px 3px rgba(0,0,0,0.07)\",\n }}\n >\n <Box\n component=\"span\"\n onClick={(e) => {\n e.stopPropagation();\n const evaluationResult = displayConfig.enableDeviationSchemaBackwardCompatibility\n ? (sec.evaluationResult ?? null)\n : (sec.evaluationResult?.[0] ?? null);\n handleOpenSummaryPopup(e, String(idx), isOrphan, evaluationResult);\n }}\n sx={{\n display: \"inline-flex\",\n alignItems: \"center\",\n gap: \"4px\",\n px: 0.2,\n cursor: isOrphan ? \"default\" : \"pointer\",\n borderRight: `1px solid ${style.badgeBorder}`,\n \"&:hover\": !isOrphan ? { bgColor: `${style.badgeBorder}22` } : {},\n }}\n >\n {displayNum != null && (\n <Box\n component=\"span\"\n sx={{\n fontSize: \"11px\",\n fontWeight: 700,\n pr: 0.5,\n borderRight: `1px solid ${style.badgeBorder}`,\n }}\n >\n {displayNum}\n </Box>\n )}\n\n <Box component=\"span\" sx={{ fontSize: \"11px\", px: 0.25 }}>\n {shouldShowDeviationLoader\n ? (\n <Tooltip title=\"Deviation data generation in progress\" placement=\"top\" arrow>\n <Box component=\"span\" sx={{ display: \"inline-flex\", alignItems: \"center\" }}>\n <ThreeDotsLoader color={style.badgeText} />\n </Box>\n </Tooltip>\n )\n : (rawScore === \"N/A\" || rawScore === \"NA\")\n ? \"N/A\"\n : (rawScore == 0 || rawScore == null)\n ? \"Same\"\n : `${rawScore}`}\n </Box>\n </Box>\n <Box\n component=\"span\"\n onClick={(e) => {\n e.stopPropagation();\n const refSec = maintainRelativeOrder\n ? (existingSections.find((s: any) => sec.refIndexes?.includes(s.selfIndex)) || { title: \"\", content: \"\" }) as SectionBlock\n : (existingSections[idx] || { title: \"\", content: \"\" }) as SectionBlock;\n\n openMoreFunctionsPopup(e, section, isOrphan, refSec, idx, style);\n }}\n sx={{\n display: \"inline-flex\",\n alignItems: \"center\",\n px: 0.2,\n cursor: \"pointer\",\n \"&:hover\": { bgcolor: `${style.badgeBorder}22` },\n }}\n >\n <EllipsisVertical size={11} color={style.badgeText} />\n </Box>\n {/* {showScrollLockToggle && (\n <ScrollLockToggle\n locked={scrollSyncLocked}\n onToggle={toggleScrollSyncLocked}\n color={style.badgeText}\n borderColor={style.badgeBorder}\n size={11}\n />\n )} */}\n </Box>\n )}\n </Box>\n </Box>\n </Box>\n );\n },\n);\n\nexport default LHSSectionRow;\n"],"names":["LHSSectionRow","React","memo","section","idx","maintainRelativeOrder","existingSections","proposedSections","connectedSections","expandedSections","displayConfig","deviationAnalysisStatus","treeData","deviationNumberRegistry","getSectionCompareStyle","getBadgeRef","getSectionRowRef","sectionLeftRefs","lhsBadgeRefs","openMoreFunctionsPopup","handleOpenSummaryPopup","handleCloseSummaryPopup","toggleSection","showDeviationBadges","renderSubSectionAccordion","isProposingFix","proposingFixNodeId","isRedlineFlow","isSideBySide","activeSideBySideSection","scrollSyncLocked","toggleScrollSyncLocked","summaryPopupAnchorEl","deviationNodeIdToView","deviationTargetParentId","showDeviationNavigation","showOpenNodeRef","resolvedMarkdownStyles","unifiedNumbering","useCompareContext","isEmpty","title","content","sec","style","isOrphan","refIndexes","length","selfIndex","isConnected","has","current","rawScore","extractDeviationScore","evaluationResult","deviationLabel","displayNum","leftNums","get","id","shouldShowDeviationLoader","jsx","Box","ref","sx","mb","width","children","display","flexDirection","minWidth","borderRadius","outline","badgeBorder","outlineOffset","jsxs","position","SectionAccordion","columnKey","colRef","parentNodeId","input_index_map","isExpanded","String","onToggle","navigation","onClick","e","enableDeviationSchemaBackwardCompatibility","top","right","transform","alignItems","gap","fontSize","bgcolor","badgeBg","color","badgeText","border","px","py","fontWeight","cursor","whiteSpace","zIndex","boxShadow","component","stopPropagation","borderRight","bgColor","pr","Tooltip","placement","arrow","ThreeDotsLoader","refSec","find","s","includes","EllipsisVertical","size"],"mappings":"gXAqBA,MAAMA,EAAgBC,EAAMC,KAC1B,EACEC,UACAC,UAEM,MAAAC,sBACJA,EAAAC,iBACAA,EAAAC,iBACAA,EAAAC,kBACAA,EAAAC,iBACAA,EAAAC,cACAA,EAAAC,wBACAA,EAAAC,SACAA,EAAAC,wBACAA,EAAAC,uBACAA,EAAAC,YACAA,EAAAC,iBACAA,EAAAC,gBACAA,EAAAC,aACAA,EAAAC,uBACAA,EAAAC,uBACAA,EAAAC,wBACAA,EAAAC,cACAA,EAAAC,oBACAA,GAAsB,EAAAC,0BACtBA,EAAAC,eACAA,EAAAC,mBACAA,EAAAC,cACAA,EAAAC,aACAA,EAAAC,wBACAA,EAAAC,iBACAA,EAAAC,uBACAA,EAAAC,qBACAA,EAAAC,sBACAA,EAAAC,wBACAA,EAAAC,wBACAA,EAAAC,gBACAA,EAAAC,uBACAA,EAAAC,iBACAA,GACEC,IACEC,GAAWrC,EAAQsC,QAAUtC,EAAQuC,QACvC,GAAArC,GAAyBmC,EAAgB,OAAA,KAE7C,MAAMG,EAAMxC,EACNyC,EAAQ9B,EAAuBV,EAAK,QACpCyC,EAAWxC,GACXsC,EAAIG,YAAYC,QAAUJ,EAAIK,UAAY,GAC3C1C,EAAiBF,GAChB6C,EAAczC,EAAkB0C,IAAI9C,GAC1Bc,EAAaiC,QAAQ/C,GAKrC,MAAMgD,EAAWC,EAAsBV,EAAIW,iBAAmBV,GAAeW,gBACvEC,EAAalB,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EAAuBoE,EAAGpF,EAAS0C,EAAUuE,EAAQhH,EAAKwC,IAE5DoB,GAAI,CACFI,QAAS,cACTwB,WAAY,SACZQ,GAAI,GACJG,OAAQ,UACR,UAAW,CAAER,QAAS,GAAGnD,EAAM6B,kBAGjCN,WAACqD,EAAiB,CAAAC,KAAM,GAAIxB,MAAOrD,EAAMsD,uBArIzC,YAAY9F"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as e,jsxs as n,Fragment as t}from"react/jsx-runtime";import i from"react";import{Box as o,Tooltip as r,Typography as l}from"@mui/material";import{EllipsisVertical as d}from"lucide-react";import s from"./SectionAccordion.js";import a from"./ThreeDotsLoader.js";import c from"./ScrollLockToggle.js";import{getRhsMappedSectionNumber as p,getAlphabeticSuffix as g}from"../CognitiveComparehelpers.js";import{useCompareContext as u}from"../CompareContext.js";const x=i.memo(({section:x,idx:f})=>{const{maintainRelativeOrder:m,existingSections:h,proposedSections:S,connectedSections:b,expandedSections:I,displayConfig:v,
|
|
1
|
+
import{jsx as e,jsxs as n,Fragment as t}from"react/jsx-runtime";import i from"react";import{Box as o,Tooltip as r,Typography as l}from"@mui/material";import{EllipsisVertical as d}from"lucide-react";import s from"./SectionAccordion.js";import a from"./ThreeDotsLoader.js";import c from"./ScrollLockToggle.js";import{getRhsMappedSectionNumber as p,getAlphabeticSuffix as g}from"../CognitiveComparehelpers.js";import{useCompareContext as u}from"../CompareContext.js";const x=i.memo(({section:x,idx:f})=>{const{maintainRelativeOrder:m,existingSections:h,proposedSections:S,connectedSections:b,expandedSections:I,displayConfig:v,deviationAnalysisStatus:y,treeData:R,deviationNumberRegistry:w,getSectionCompareStyle:B,getBadgeRef:$,getSectionRowRef:C,sectionRightRefs:N,rhsBadgeRefs:k,openMoreFunctionsPopup:T,handleOpenSummaryPopup:j,handleCloseSummaryPopup:D,toggleSection:z,showDeviationBadges:P=!1,renderSubSectionAccordion:M,isProposingFix:A,proposingFixNodeId:F,isRedlineFlow:L,isSideBySide:O,activeSideBySideSection:_,scrollSyncLocked:U,toggleScrollSyncLocked:W,deviationNodeIdToView:E,deviationTargetParentId:H,showDeviationNavigation:K,showOpenNodeRef:V,resolvedMarkdownStyles:X,unifiedNumbering:Y}=u(),q=x;let G=!1,J=null,Q=-1;const Z=(e,n)=>String(e??"")===String(n);let ee=-1;m?(ee=S.findIndex(e=>e.refIndexes?.includes(q.selfIndex)&&e.selfIndex>=0),Q=S.findIndex((e,n)=>(e=>b.has(e)||b.has(String(e))||null!=_&&!String(_).includes("::")&&Z(_,e))(n)&&e.refIndexes?.includes(q.selfIndex)),G=-1!==Q,G&&(J=B(Q,"left"))):(G=b.has(f)||b.has(String(f))||Z(_,f),G&&(J=B(f,"right")));const ne=m&&-1!==ee?B(ee,"left"):B(f,"right"),te=J||ne,ie=m?-1!==ee||!q.refIndexes?.length&&S.some(e=>e.id&&e.id===q.id):Boolean(S[f]),oe=m?q.selfIndex<0||!ie:!S[f],re=i.useMemo(()=>{const e=Y.rightNums.get(q.id);return m&&q.id?p({section:q,proposedSections:S,leftNums:Y.leftNums,fallbackNumber:e}):e},[m,S,q.id,q.selfIndex,Y]),le=i.useMemo(()=>{if(!m||null==q.selfIndex)return null!=re?[{label:String(re),title:q.title||"Untitled Section",lhsIdx:-1}]:[];const e=S.map((e,n)=>{const t=Array.isArray(e?.refIndexes)?e.refIndexes:[],i=t.findIndex(e=>e===q.selfIndex);if(-1===i)return null;const o=e?.id?Y.leftNums.get(e.id):void 0;if(null==o)return null;return{label:t.length>1?`${o}${g(i)}`:String(o),title:e?.title||"Untitled Section",lhsIdx:n}}).filter(Boolean);return-1===Q?e:[...e].sort((e,n)=>e.lhsIdx===Q?-1:n.lhsIdx===Q?1:0)},[m,S,q.selfIndex,q.title,re,Y.leftNums,Q]),de=i.useMemo(()=>{const e=le[0]?.label;if(!e)return null!=re?String(re):"";const n=le.length-1;return n>0?`${e} + ${n}`:e},[le,re]),se=i.useMemo(()=>0===le.length?"":le.map(e=>`${e.label}: ${e.title}`).join("\n"),[le]),ae=G||O&&(Z(_,f)||-1!==ee&&Z(_,ee)),ce=("mapping_ready"===y||"deviations_streaming"===y)&&(null==q.evaluationResult||void 0===q.evaluationResult);return e(o,{ref:C(f),sx:{mb:1,width:"100%"},children:e(o,{ref:N.current[f],sx:{width:"100%",display:"flex",...G&&J&&{borderRadius:"6px",outline:`2px solid ${J.badgeBorder}`,outlineOffset:"1px"}},children:n(o,{sx:{position:"relative",width:"100%"},children:[e(s,{section:x,idx:f,columnKey:"right",colRef:C(`right-accordion-${f}`),mb:0,parentNodeId:R?.input_index_map?.[1]||"",isExpanded:m?!!I[`right-${f}`]:!!I[String(f)],onToggle:()=>{D(),z(f,"right")},navigation:x.id?K[x.id]:null}),m&&te&&e(r,{title:se?e(o,{sx:{whiteSpace:"pre-line"},children:e(l,{component:"span",sx:{fontSize:"11px",lineHeight:1.5},children:se})}):"",placement:"top",arrow:!0,children:e(o,{ref:k.current[f],"data-section-id":q.id,onClick:e=>{if(!oe)return;const n=v.enableDeviationSchemaBackwardCompatibility?q.evaluationResult??null:q.evaluationResult?.[0]??null;j(e,String(f),oe,n)},sx:{position:"absolute",top:"18px",left:0,transform:"translateY(-50%) translateX(calc(-100% - 8px))",display:"inline-flex",alignItems:"center",justifyContent:"center",gap:oe?"4px":"0px",fontSize:"11px",bgcolor:te.badgeBg,color:te.badgeText,border:`1px solid ${te.badgeBorder}`,borderRadius:oe?"12px":"10px",px:oe?1.2:1,py:.3,fontWeight:oe?600:700,cursor:oe?"pointer":"default",whiteSpace:"nowrap",zIndex:20,boxShadow:oe?"0 1px 3px rgba(0,0,0,0.07)":"none"},children:oe?n(t,{children:[n(o,{component:"span",onClick:e=>{e.stopPropagation();const n=v.enableDeviationSchemaBackwardCompatibility?q.evaluationResult??null:q.evaluationResult?.[0]??null;j(e,String(f),oe,n)},sx:{display:"inline-flex",alignItems:"center",gap:"4px",px:.2,cursor:"pointer",borderRight:`1px solid ${te.badgeBorder}`,"&:hover":{bgcolor:`${te.badgeBorder}22`}},children:[null!=re&&e(o,{component:"span",sx:{fontSize:"11px",fontWeight:700,pr:.5,borderRight:`1px solid ${te.badgeBorder}`},children:re}),e(o,{component:"span",sx:{fontSize:"11px",px:.25},children:ce?e(r,{title:"Deviation data generation in progress",placement:"top",arrow:!0,children:e(o,{component:"span",sx:{display:"inline-flex",alignItems:"center"},children:e(a,{color:te.badgeText})})}):te.label?`${te.label}`:"100% Deviation"})]}),n(o,{component:"span",onClick:e=>{e.stopPropagation();const n=m?S.find(e=>e.refIndexes?.includes(q.selfIndex))||{title:"",content:""}:S[f]||{title:"",content:""};T(e,n,oe,q,f,te)},sx:{display:"inline-flex",alignItems:"center",px:.2,cursor:"pointer","&:hover":{bgcolor:`${te.badgeBorder}22`}},children:[e(d,{size:11,color:te.badgeText}),ae&&e(c,{locked:U,onToggle:W,color:te.badgeText,borderColor:te.badgeBorder,size:11})]})]}):e(t,{children:e(o,{component:"span",sx:{px:.2},children:de})})})})]})})},`right-row-${f}`)});export{x as default};
|
|
2
2
|
//# sourceMappingURL=RHSSectionRow.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RHSSectionRow.js","sources":["../../../../src/features/CognitiveCompare/components/RHSSectionRow.tsx"],"sourcesContent":["import React from \"react\";\nimport { Box, Tooltip, Typography } from \"@mui/material\";\nimport { EllipsisVertical } from \"lucide-react\";\n\nimport SectionAccordion from \"./SectionAccordion\";\nimport ThreeDotsLoader from \"./ThreeDotsLoader\";\nimport ScrollLockToggle from \"./ScrollLockToggle\";\nimport {\n extractDeviationScore,\n getAlphabeticSuffix,\n getRhsMappedSectionNumber,\n} from \"../CognitiveComparehelpers\";\nimport { SectionBlock, StyleVariant } from \"../CognitiveCompareTypes\";\nimport { useCompareContext } from \"../CompareContext\";\n\ntype UnifiedNumbering = {\n leftNums: Map<string, number>;\n rightNums: Map<string, string>;\n};\n\ntype RHSSectionRowProps = {\n section: SectionBlock;\n idx: number;\n};\n\nconst RHSSectionRow = React.memo(\n ({\n section,\n idx,\n }: RHSSectionRowProps) => {\n const {\n maintainRelativeOrder,\n existingSections,\n proposedSections,\n connectedSections,\n expandedSections,\n displayConfig,\n treeData,\n deviationNumberRegistry,\n getSectionCompareStyle,\n getBadgeRef,\n getSectionRowRef,\n sectionRightRefs,\n rhsBadgeRefs,\n openMoreFunctionsPopup,\n handleOpenSummaryPopup,\n handleCloseSummaryPopup,\n toggleSection,\n showDeviationBadges = false,\n renderSubSectionAccordion,\n isProposingFix,\n proposingFixNodeId,\n isRedlineFlow,\n isSideBySide,\n activeSideBySideSection,\n scrollSyncLocked,\n toggleScrollSyncLocked,\n deviationNodeIdToView,\n deviationTargetParentId,\n showDeviationNavigation,\n showOpenNodeRef,\n resolvedMarkdownStyles,\n unifiedNumbering,\n } = useCompareContext();\n const sec = section as any;\n\n let isTargetOfConnection = false;\n let connectedStyle = null;\n let connectedLhsIdx = -1;\n const isSameSectionId = (value: string | number | null | undefined, targetIdx: number) =>\n String(value ?? \"\") === String(targetIdx);\n const isSectionActive = (lhsIdx: number) =>\n connectedSections.has(lhsIdx) ||\n connectedSections.has(String(lhsIdx) as any) ||\n (\n activeSideBySideSection != null &&\n !String(activeSideBySideSection).includes(\"::\") &&\n isSameSectionId(activeSideBySideSection, lhsIdx)\n );\n\n let mappedLhsIdx = -1;\n if (maintainRelativeOrder) {\n mappedLhsIdx = (proposedSections as any[]).findIndex(\n (lhs) => lhs.refIndexes?.includes(sec.selfIndex) && lhs.selfIndex >= 0,\n );\n\n connectedLhsIdx = (proposedSections as SectionBlock[]).findIndex(\n (lhs, lhsIdx) => isSectionActive(lhsIdx) && lhs.refIndexes?.includes(sec.selfIndex),\n );\n isTargetOfConnection = connectedLhsIdx !== -1;\n if (isTargetOfConnection) {\n connectedStyle = getSectionCompareStyle(connectedLhsIdx, \"left\");\n }\n } else {\n isTargetOfConnection =\n connectedSections.has(idx) ||\n connectedSections.has(String(idx) as any) ||\n isSameSectionId(activeSideBySideSection, idx);\n if (isTargetOfConnection) {\n connectedStyle = getSectionCompareStyle(idx, \"right\");\n }\n }\n\n const style =\n maintainRelativeOrder && mappedLhsIdx !== -1\n ? getSectionCompareStyle(mappedLhsIdx, \"left\")\n : getSectionCompareStyle(idx, \"right\");\n const displayStyle = connectedStyle || style;\n\n const hasMappedLhs = maintainRelativeOrder\n ? (mappedLhsIdx !== -1 ||\n (!sec.refIndexes?.length && proposedSections.some((lhs: any) => lhs.id && lhs.id === sec.id)))\n : Boolean(proposedSections[idx]);\n const isOrphanRhs = maintainRelativeOrder\n ? sec.selfIndex < 0 || !hasMappedLhs\n : !proposedSections[idx];\n\n const displayNumRhs = React.useMemo(() => {\n const fallbackNumber = unifiedNumbering.rightNums.get(sec.id);\n\n if (!maintainRelativeOrder || !sec.id) return fallbackNumber;\n\n return getRhsMappedSectionNumber({\n section: sec,\n proposedSections: proposedSections as SectionBlock[],\n leftNums: unifiedNumbering.leftNums,\n fallbackNumber,\n });\n }, [maintainRelativeOrder, proposedSections, sec.id, sec.selfIndex, unifiedNumbering]);\n\n const rhsMappedSections = React.useMemo(() => {\n if (!maintainRelativeOrder || sec.selfIndex == null) {\n return displayNumRhs != null\n ? [{ label: String(displayNumRhs), title: sec.title || \"Untitled Section\", lhsIdx: -1 }]\n : [];\n }\n\n const mapped = (proposedSections as SectionBlock[])\n .map((lhs, lhsIdx) => {\n const refIndexes = Array.isArray(lhs?.refIndexes) ? lhs.refIndexes : [];\n const rhsPosition = refIndexes.findIndex(\n (refIndex: number) => refIndex === sec.selfIndex,\n );\n if (rhsPosition === -1) return null;\n\n const baseNumber = lhs?.id ? unifiedNumbering.leftNums.get(lhs.id) : undefined;\n if (baseNumber == null) return null;\n\n const label = refIndexes.length > 1\n ? `${baseNumber}${getAlphabeticSuffix(rhsPosition)}`\n : String(baseNumber);\n\n return {\n label,\n title: lhs?.title || \"Untitled Section\",\n lhsIdx,\n };\n })\n .filter(Boolean) as { label: string; title: string; lhsIdx: number }[];\n\n if (connectedLhsIdx === -1) return mapped;\n\n return [...mapped].sort((a, b) => {\n if (a.lhsIdx === connectedLhsIdx) return -1;\n if (b.lhsIdx === connectedLhsIdx) return 1;\n return 0;\n });\n }, [\n maintainRelativeOrder,\n proposedSections,\n sec.selfIndex,\n sec.title,\n displayNumRhs,\n unifiedNumbering.leftNums,\n connectedLhsIdx,\n ]);\n\n const rhsBadgeDisplayLabel = React.useMemo(() => {\n const firstLabel = rhsMappedSections[0]?.label;\n if (!firstLabel) return displayNumRhs != null ? String(displayNumRhs) : \"\";\n\n const remainingCount = rhsMappedSections.length - 1;\n return remainingCount > 0 ? `${firstLabel} + ${remainingCount}` : firstLabel;\n }, [rhsMappedSections, displayNumRhs]);\n\n const rhsBadgeTooltip = React.useMemo(() => {\n if (rhsMappedSections.length === 0) return \"\";\n return rhsMappedSections\n .map((mapped) => `${mapped.label}: ${mapped.title}`)\n .join(\"\\n\");\n }, [rhsMappedSections]);\n const showScrollLockToggle =\n isTargetOfConnection ||\n (isSideBySide &&\n (isSameSectionId(activeSideBySideSection, idx) ||\n (mappedLhsIdx !== -1 && isSameSectionId(activeSideBySideSection, mappedLhsIdx))));\n\n return (\n <Box key={`right-row-${idx}`} ref={getSectionRowRef(idx)} sx={{ mb: 1, width: \"100%\" }}>\n <Box\n ref={sectionRightRefs.current[idx]}\n sx={{\n width: \"100%\",\n display: \"flex\",\n ...(isTargetOfConnection && connectedStyle && {\n borderRadius: \"6px\",\n outline: `2px solid ${connectedStyle.badgeBorder}`,\n outlineOffset: \"1px\",\n }),\n }}\n >\n <Box sx={{ position: \"relative\", width: \"100%\" }}>\n <SectionAccordion\n section={section}\n idx={idx}\n columnKey=\"right\"\n colRef={getSectionRowRef(`right-accordion-${idx}`)}\n mb={0}\n parentNodeId={treeData?.input_index_map?.[\"1\"] || \"\"}\n isExpanded={\n maintainRelativeOrder\n ? !!expandedSections[`right-${idx}`]\n : !!expandedSections[String(idx)]\n }\n onToggle={() => {\n handleCloseSummaryPopup();\n toggleSection(idx, \"right\");\n }}\n navigation={section.id ? showDeviationNavigation[section.id] : null}\n />\n\n {maintainRelativeOrder && displayStyle && (\n <Tooltip\n title={\n rhsBadgeTooltip ? (\n <Box sx={{ whiteSpace: \"pre-line\" }}>\n <Typography component=\"span\" sx={{ fontSize: \"11px\", lineHeight: 1.5 }}>\n {rhsBadgeTooltip}\n </Typography>\n </Box>\n ) : \"\"\n }\n placement=\"top\"\n arrow\n >\n <Box\n ref={rhsBadgeRefs.current[idx]}\n data-section-id={sec.id}\n onClick={(e) => {\n if (!isOrphanRhs) return;\n const evaluationResult = displayConfig.enableDeviationSchemaBackwardCompatibility\n ? (sec.evaluationResult ?? null)\n : (sec.evaluationResult?.[0] ?? null);\n handleOpenSummaryPopup(e, String(idx), isOrphanRhs, evaluationResult);\n }}\n sx={{\n position: \"absolute\",\n top: \"18px\",\n left: 0,\n transform: \"translateY(-50%) translateX(calc(-100% - 8px))\",\n display: \"inline-flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n gap: isOrphanRhs ? \"4px\" : \"0px\",\n fontSize: \"11px\",\n bgcolor: displayStyle.badgeBg,\n color: displayStyle.badgeText,\n border: `1px solid ${displayStyle.badgeBorder}`,\n borderRadius: isOrphanRhs ? \"12px\" : \"10px\",\n px: isOrphanRhs ? 1.2 : 1,\n py: 0.3,\n fontWeight: isOrphanRhs ? 600 : 700,\n cursor: isOrphanRhs ? \"pointer\" : \"default\",\n whiteSpace: \"nowrap\",\n zIndex: 20,\n boxShadow: isOrphanRhs ? \"0 1px 3px rgba(0,0,0,0.07)\" : \"none\",\n }}\n >\n {isOrphanRhs ? (\n <>\n <Box\n component=\"span\"\n onClick={(e) => {\n e.stopPropagation();\n const evaluationResult = displayConfig.enableDeviationSchemaBackwardCompatibility\n ? (sec.evaluationResult ?? null)\n : (sec.evaluationResult?.[0] ?? null);\n handleOpenSummaryPopup(e, String(idx), isOrphanRhs, evaluationResult);\n }}\n sx={{\n display: \"inline-flex\",\n alignItems: \"center\",\n gap: \"4px\",\n px: 0.2,\n cursor: \"pointer\",\n borderRight: `1px solid ${displayStyle.badgeBorder}`,\n \"&:hover\": { bgcolor: `${displayStyle.badgeBorder}22` },\n }}\n >\n {displayNumRhs != null && (\n <Box\n component=\"span\"\n sx={{\n fontSize: \"11px\",\n fontWeight: 700,\n pr: 0.5,\n borderRight: `1px solid ${displayStyle.badgeBorder}`,\n }}\n >\n {displayNumRhs}\n </Box>\n )}\n\n <Box component=\"span\" sx={{ fontSize: \"11px\", px: 0.25 }}>\n {displayConfig.isLoading && (sec.evaluationResult == null || sec.evaluationResult === undefined)\n ? <ThreeDotsLoader color={displayStyle.badgeText} />\n : (displayStyle.label ? `${displayStyle.label}` : \"100% Deviation\")}\n </Box>\n </Box>\n <Box\n component=\"span\"\n onClick={(e) => {\n e.stopPropagation();\n const baseSec = maintainRelativeOrder\n ? (proposedSections.find((s: any) => s.refIndexes?.includes(sec.selfIndex)) || { title: \"\", content: \"\" }) as SectionBlock\n : (proposedSections[idx] || { title: \"\", content: \"\" }) as SectionBlock;\n\n openMoreFunctionsPopup(e, baseSec, isOrphanRhs, sec as SectionBlock, idx, displayStyle);\n }}\n sx={{\n display: \"inline-flex\",\n alignItems: \"center\",\n px: 0.2,\n cursor: \"pointer\",\n \"&:hover\": { bgcolor: `${displayStyle.badgeBorder}22` },\n }}\n >\n <EllipsisVertical size={11} color={displayStyle.badgeText} />\n {showScrollLockToggle && (\n <ScrollLockToggle\n locked={scrollSyncLocked}\n onToggle={toggleScrollSyncLocked}\n color={displayStyle.badgeText}\n borderColor={displayStyle.badgeBorder}\n size={11}\n />\n )}\n </Box>\n </>\n ) : (\n <>\n <Box component=\"span\" sx={{ px: 0.2 }}>\n {rhsBadgeDisplayLabel}\n </Box>\n </>\n )}\n </Box>\n </Tooltip>\n )}\n </Box>\n </Box>\n </Box>\n );\n },\n);\n\nexport default RHSSectionRow;\n"],"names":["RHSSectionRow","React","memo","section","idx","maintainRelativeOrder","existingSections","proposedSections","connectedSections","expandedSections","displayConfig","treeData","deviationNumberRegistry","getSectionCompareStyle","getBadgeRef","getSectionRowRef","sectionRightRefs","rhsBadgeRefs","openMoreFunctionsPopup","handleOpenSummaryPopup","handleCloseSummaryPopup","toggleSection","showDeviationBadges","renderSubSectionAccordion","isProposingFix","proposingFixNodeId","isRedlineFlow","isSideBySide","activeSideBySideSection","scrollSyncLocked","toggleScrollSyncLocked","deviationNodeIdToView","deviationTargetParentId","showDeviationNavigation","showOpenNodeRef","resolvedMarkdownStyles","unifiedNumbering","useCompareContext","sec","isTargetOfConnection","connectedStyle","connectedLhsIdx","isSameSectionId","value","targetIdx","String","mappedLhsIdx","findIndex","lhs","refIndexes","includes","selfIndex","lhsIdx","has","isSectionActive","style","displayStyle","hasMappedLhs","length","some","id","Boolean","isOrphanRhs","displayNumRhs","useMemo","fallbackNumber","rightNums","get","getRhsMappedSectionNumber","leftNums","rhsMappedSections","label","title","mapped","map","Array","isArray","rhsPosition","refIndex","baseNumber","getAlphabeticSuffix","filter","sort","a","b","rhsBadgeDisplayLabel","firstLabel","remainingCount","rhsBadgeTooltip","join","showScrollLockToggle","jsx","Box","ref","sx","mb","width","children","current","display","borderRadius","outline","badgeBorder","outlineOffset","jsxs","position","SectionAccordion","columnKey","colRef","parentNodeId","input_index_map","isExpanded","onToggle","navigation","Tooltip","whiteSpace","Typography","component","fontSize","lineHeight","placement","arrow","onClick","e","evaluationResult","enableDeviationSchemaBackwardCompatibility","top","left","transform","alignItems","justifyContent","gap","bgcolor","badgeBg","color","badgeText","border","px","py","fontWeight","cursor","zIndex","boxShadow","Fragment","stopPropagation","borderRight","pr","isLoading","ThreeDotsLoader","baseSec","find","s","content","EllipsisVertical","size","ScrollLockToggle","locked","borderColor"],"mappings":"gdAyBA,MAAMA,EAAgBC,EAAMC,KAC1B,EACEC,UACAC,UAEM,MAAAC,sBACJA,EAAAC,iBACAA,EAAAC,iBACAA,EAAAC,kBACAA,EAAAC,iBACAA,EAAAC,cACAA,EAAAC,SACAA,EAAAC,wBACAA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AAA,CAAiB,MAAjBlC,IACC4B,EAACC,EAAA,CACCyB,UAAU,OACVvB,GAAI,CACFwB,SAAU,OACVqB,WAAY,IACZO,GAAI,GACJD,YAAa,aAAazF,GAAa8C,eAGxCL,SAAAlC,KAIJ4B,EAAAC,EAAA,CAAIyB,UAAU,OAAOvB,GAAI,CAAEwB,SAAU,OAAQmB,GAAI,KAC/CxC,UAAAvF,EAAcyI,WAAsC,MAAxB7G,EAAIsF,uBAAqD,IAAzBtF,EAAIsF,iBAE5DpE,GAAae,MAAQ,GAAGf,GAAae,QAAU,iBAD/CoB,EAAAyD,EAAA,CAAgBd,MAAO9E,GAAa+E,iBAI7C/B,EAACZ,EAAA,CACCyB,UAAU,OACVK,QAAUC,IACRA,EAAEqB,kBACI,MAAAK,EAAUhJ,EACXE,EAAiB+I,KAAMC,GAAWA,EAAEtG,YAAYC,SAASZ,EAAIa,aAAe,CAAEqB,MAAO,GAAIgF,QAAS,IAClGjJ,EAAiBH,IAAQ,CAAEoE,MAAO,GAAIgF,QAAS,IAEnDtI,EAAuByG,EAAG0B,EAASvF,GAAaxB,EAAqBlC,EAAKoD,KAE7EsC,GAAI,CACFK,QAAS,cACT8B,WAAY,SACZQ,GAAI,GACJG,OAAQ,UACR,UAAW,CAAER,QAAS,GAAG5E,GAAa8C,kBAGxCL,SAAA,CAAAN,EAAC8D,EAAiB,CAAAC,KAAM,GAAIpB,MAAO9E,GAAa+E,YAC/C7C,IACDC,EAACgE,EAAA,CACCC,OAAQ/H,EACRmF,SAAUlF,EACVwG,MAAO9E,GAAa+E,UACpBsB,YAAarG,GAAa8C,YAC1BoD,KAAM,WAMZ/D,EAAAoD,EAAA,CACE9C,SAACN,EAAAC,EAAA,CAAIyB,UAAU,OAAOvB,GAAI,CAAE2C,GAAI,IAC7BxC,SAAAZ,iBA1JL,aAAajF"}
|
|
1
|
+
{"version":3,"file":"RHSSectionRow.js","sources":["../../../../src/features/CognitiveCompare/components/RHSSectionRow.tsx"],"sourcesContent":["import React from \"react\";\nimport { Box, Tooltip, Typography } from \"@mui/material\";\nimport { EllipsisVertical } from \"lucide-react\";\n\nimport SectionAccordion from \"./SectionAccordion\";\nimport ThreeDotsLoader from \"./ThreeDotsLoader\";\nimport ScrollLockToggle from \"./ScrollLockToggle\";\nimport {\n extractDeviationScore,\n getAlphabeticSuffix,\n getRhsMappedSectionNumber,\n} from \"../CognitiveComparehelpers\";\nimport { SectionBlock, StyleVariant } from \"../CognitiveCompareTypes\";\nimport { useCompareContext } from \"../CompareContext\";\n\ntype UnifiedNumbering = {\n leftNums: Map<string, number>;\n rightNums: Map<string, string>;\n};\n\ntype RHSSectionRowProps = {\n section: SectionBlock;\n idx: number;\n};\n\nconst RHSSectionRow = React.memo(\n ({\n section,\n idx,\n }: RHSSectionRowProps) => {\n const {\n maintainRelativeOrder,\n existingSections,\n proposedSections,\n connectedSections,\n expandedSections,\n displayConfig,\n deviationAnalysisStatus,\n treeData,\n deviationNumberRegistry,\n getSectionCompareStyle,\n getBadgeRef,\n getSectionRowRef,\n sectionRightRefs,\n rhsBadgeRefs,\n openMoreFunctionsPopup,\n handleOpenSummaryPopup,\n handleCloseSummaryPopup,\n toggleSection,\n showDeviationBadges = false,\n renderSubSectionAccordion,\n isProposingFix,\n proposingFixNodeId,\n isRedlineFlow,\n isSideBySide,\n activeSideBySideSection,\n scrollSyncLocked,\n toggleScrollSyncLocked,\n deviationNodeIdToView,\n deviationTargetParentId,\n showDeviationNavigation,\n showOpenNodeRef,\n resolvedMarkdownStyles,\n unifiedNumbering,\n } = useCompareContext();\n const sec = section as any;\n\n let isTargetOfConnection = false;\n let connectedStyle = null;\n let connectedLhsIdx = -1;\n const isSameSectionId = (value: string | number | null | undefined, targetIdx: number) =>\n String(value ?? \"\") === String(targetIdx);\n const isSectionActive = (lhsIdx: number) =>\n connectedSections.has(lhsIdx) ||\n connectedSections.has(String(lhsIdx) as any) ||\n (\n activeSideBySideSection != null &&\n !String(activeSideBySideSection).includes(\"::\") &&\n isSameSectionId(activeSideBySideSection, lhsIdx)\n );\n\n let mappedLhsIdx = -1;\n if (maintainRelativeOrder) {\n mappedLhsIdx = (proposedSections as any[]).findIndex(\n (lhs) => lhs.refIndexes?.includes(sec.selfIndex) && lhs.selfIndex >= 0,\n );\n\n connectedLhsIdx = (proposedSections as SectionBlock[]).findIndex(\n (lhs, lhsIdx) => isSectionActive(lhsIdx) && lhs.refIndexes?.includes(sec.selfIndex),\n );\n isTargetOfConnection = connectedLhsIdx !== -1;\n if (isTargetOfConnection) {\n connectedStyle = getSectionCompareStyle(connectedLhsIdx, \"left\");\n }\n } else {\n isTargetOfConnection =\n connectedSections.has(idx) ||\n connectedSections.has(String(idx) as any) ||\n isSameSectionId(activeSideBySideSection, idx);\n if (isTargetOfConnection) {\n connectedStyle = getSectionCompareStyle(idx, \"right\");\n }\n }\n\n const style =\n maintainRelativeOrder && mappedLhsIdx !== -1\n ? getSectionCompareStyle(mappedLhsIdx, \"left\")\n : getSectionCompareStyle(idx, \"right\");\n const displayStyle = connectedStyle || style;\n\n const hasMappedLhs = maintainRelativeOrder\n ? (mappedLhsIdx !== -1 ||\n (!sec.refIndexes?.length && proposedSections.some((lhs: any) => lhs.id && lhs.id === sec.id)))\n : Boolean(proposedSections[idx]);\n const isOrphanRhs = maintainRelativeOrder\n ? sec.selfIndex < 0 || !hasMappedLhs\n : !proposedSections[idx];\n\n const displayNumRhs = React.useMemo(() => {\n const fallbackNumber = unifiedNumbering.rightNums.get(sec.id);\n\n if (!maintainRelativeOrder || !sec.id) return fallbackNumber;\n\n return getRhsMappedSectionNumber({\n section: sec,\n proposedSections: proposedSections as SectionBlock[],\n leftNums: unifiedNumbering.leftNums,\n fallbackNumber,\n });\n }, [maintainRelativeOrder, proposedSections, sec.id, sec.selfIndex, unifiedNumbering]);\n\n const rhsMappedSections = React.useMemo(() => {\n if (!maintainRelativeOrder || sec.selfIndex == null) {\n return displayNumRhs != null\n ? [{ label: String(displayNumRhs), title: sec.title || \"Untitled Section\", lhsIdx: -1 }]\n : [];\n }\n\n const mapped = (proposedSections as SectionBlock[])\n .map((lhs, lhsIdx) => {\n const refIndexes = Array.isArray(lhs?.refIndexes) ? lhs.refIndexes : [];\n const rhsPosition = refIndexes.findIndex(\n (refIndex: number) => refIndex === sec.selfIndex,\n );\n if (rhsPosition === -1) return null;\n\n const baseNumber = lhs?.id ? unifiedNumbering.leftNums.get(lhs.id) : undefined;\n if (baseNumber == null) return null;\n\n const label = refIndexes.length > 1\n ? `${baseNumber}${getAlphabeticSuffix(rhsPosition)}`\n : String(baseNumber);\n\n return {\n label,\n title: lhs?.title || \"Untitled Section\",\n lhsIdx,\n };\n })\n .filter(Boolean) as { label: string; title: string; lhsIdx: number }[];\n\n if (connectedLhsIdx === -1) return mapped;\n\n return [...mapped].sort((a, b) => {\n if (a.lhsIdx === connectedLhsIdx) return -1;\n if (b.lhsIdx === connectedLhsIdx) return 1;\n return 0;\n });\n }, [\n maintainRelativeOrder,\n proposedSections,\n sec.selfIndex,\n sec.title,\n displayNumRhs,\n unifiedNumbering.leftNums,\n connectedLhsIdx,\n ]);\n\n const rhsBadgeDisplayLabel = React.useMemo(() => {\n const firstLabel = rhsMappedSections[0]?.label;\n if (!firstLabel) return displayNumRhs != null ? String(displayNumRhs) : \"\";\n\n const remainingCount = rhsMappedSections.length - 1;\n return remainingCount > 0 ? `${firstLabel} + ${remainingCount}` : firstLabel;\n }, [rhsMappedSections, displayNumRhs]);\n\n const rhsBadgeTooltip = React.useMemo(() => {\n if (rhsMappedSections.length === 0) return \"\";\n return rhsMappedSections\n .map((mapped) => `${mapped.label}: ${mapped.title}`)\n .join(\"\\n\");\n }, [rhsMappedSections]);\n const showScrollLockToggle =\n isTargetOfConnection ||\n (isSideBySide &&\n (isSameSectionId(activeSideBySideSection, idx) ||\n (mappedLhsIdx !== -1 && isSameSectionId(activeSideBySideSection, mappedLhsIdx))));\n const isDeviationGenerationInProgress =\n deviationAnalysisStatus === \"mapping_ready\" ||\n deviationAnalysisStatus === \"deviations_streaming\";\n const shouldShowDeviationLoader =\n isDeviationGenerationInProgress &&\n (sec.evaluationResult == null || sec.evaluationResult === undefined);\n\n return (\n <Box key={`right-row-${idx}`} ref={getSectionRowRef(idx)} sx={{ mb: 1, width: \"100%\" }}>\n <Box\n ref={sectionRightRefs.current[idx]}\n sx={{\n width: \"100%\",\n display: \"flex\",\n ...(isTargetOfConnection && connectedStyle && {\n borderRadius: \"6px\",\n outline: `2px solid ${connectedStyle.badgeBorder}`,\n outlineOffset: \"1px\",\n }),\n }}\n >\n <Box sx={{ position: \"relative\", width: \"100%\" }}>\n <SectionAccordion\n section={section}\n idx={idx}\n columnKey=\"right\"\n colRef={getSectionRowRef(`right-accordion-${idx}`)}\n mb={0}\n parentNodeId={treeData?.input_index_map?.[\"1\"] || \"\"}\n isExpanded={\n maintainRelativeOrder\n ? !!expandedSections[`right-${idx}`]\n : !!expandedSections[String(idx)]\n }\n onToggle={() => {\n handleCloseSummaryPopup();\n toggleSection(idx, \"right\");\n }}\n navigation={section.id ? showDeviationNavigation[section.id] : null}\n />\n\n {maintainRelativeOrder && displayStyle && (\n <Tooltip\n title={\n rhsBadgeTooltip ? (\n <Box sx={{ whiteSpace: \"pre-line\" }}>\n <Typography component=\"span\" sx={{ fontSize: \"11px\", lineHeight: 1.5 }}>\n {rhsBadgeTooltip}\n </Typography>\n </Box>\n ) : \"\"\n }\n placement=\"top\"\n arrow\n >\n <Box\n ref={rhsBadgeRefs.current[idx]}\n data-section-id={sec.id}\n onClick={(e) => {\n if (!isOrphanRhs) return;\n const evaluationResult = displayConfig.enableDeviationSchemaBackwardCompatibility\n ? (sec.evaluationResult ?? null)\n : (sec.evaluationResult?.[0] ?? null);\n handleOpenSummaryPopup(e, String(idx), isOrphanRhs, evaluationResult);\n }}\n sx={{\n position: \"absolute\",\n top: \"18px\",\n left: 0,\n transform: \"translateY(-50%) translateX(calc(-100% - 8px))\",\n display: \"inline-flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n gap: isOrphanRhs ? \"4px\" : \"0px\",\n fontSize: \"11px\",\n bgcolor: displayStyle.badgeBg,\n color: displayStyle.badgeText,\n border: `1px solid ${displayStyle.badgeBorder}`,\n borderRadius: isOrphanRhs ? \"12px\" : \"10px\",\n px: isOrphanRhs ? 1.2 : 1,\n py: 0.3,\n fontWeight: isOrphanRhs ? 600 : 700,\n cursor: isOrphanRhs ? \"pointer\" : \"default\",\n whiteSpace: \"nowrap\",\n zIndex: 20,\n boxShadow: isOrphanRhs ? \"0 1px 3px rgba(0,0,0,0.07)\" : \"none\",\n }}\n >\n {isOrphanRhs ? (\n <>\n <Box\n component=\"span\"\n onClick={(e) => {\n e.stopPropagation();\n const evaluationResult = displayConfig.enableDeviationSchemaBackwardCompatibility\n ? (sec.evaluationResult ?? null)\n : (sec.evaluationResult?.[0] ?? null);\n handleOpenSummaryPopup(e, String(idx), isOrphanRhs, evaluationResult);\n }}\n sx={{\n display: \"inline-flex\",\n alignItems: \"center\",\n gap: \"4px\",\n px: 0.2,\n cursor: \"pointer\",\n borderRight: `1px solid ${displayStyle.badgeBorder}`,\n \"&:hover\": { bgcolor: `${displayStyle.badgeBorder}22` },\n }}\n >\n {displayNumRhs != null && (\n <Box\n component=\"span\"\n sx={{\n fontSize: \"11px\",\n fontWeight: 700,\n pr: 0.5,\n borderRight: `1px solid ${displayStyle.badgeBorder}`,\n }}\n >\n {displayNumRhs}\n </Box>\n )}\n\n <Box component=\"span\" sx={{ fontSize: \"11px\", px: 0.25 }}>\n {shouldShowDeviationLoader\n ? (\n <Tooltip title=\"Deviation data generation in progress\" placement=\"top\" arrow>\n <Box component=\"span\" sx={{ display: \"inline-flex\", alignItems: \"center\" }}>\n <ThreeDotsLoader color={displayStyle.badgeText} />\n </Box>\n </Tooltip>\n )\n : (displayStyle.label ? `${displayStyle.label}` : \"100% Deviation\")}\n </Box>\n </Box>\n <Box\n component=\"span\"\n onClick={(e) => {\n e.stopPropagation();\n const baseSec = maintainRelativeOrder\n ? (proposedSections.find((s: any) => s.refIndexes?.includes(sec.selfIndex)) || { title: \"\", content: \"\" }) as SectionBlock\n : (proposedSections[idx] || { title: \"\", content: \"\" }) as SectionBlock;\n\n openMoreFunctionsPopup(e, baseSec, isOrphanRhs, sec as SectionBlock, idx, displayStyle);\n }}\n sx={{\n display: \"inline-flex\",\n alignItems: \"center\",\n px: 0.2,\n cursor: \"pointer\",\n \"&:hover\": { bgcolor: `${displayStyle.badgeBorder}22` },\n }}\n >\n <EllipsisVertical size={11} color={displayStyle.badgeText} />\n {showScrollLockToggle && (\n <ScrollLockToggle\n locked={scrollSyncLocked}\n onToggle={toggleScrollSyncLocked}\n color={displayStyle.badgeText}\n borderColor={displayStyle.badgeBorder}\n size={11}\n />\n )}\n </Box>\n </>\n ) : (\n <>\n <Box component=\"span\" sx={{ px: 0.2 }}>\n {rhsBadgeDisplayLabel}\n </Box>\n </>\n )}\n </Box>\n </Tooltip>\n )}\n </Box>\n </Box>\n </Box>\n );\n },\n);\n\nexport default RHSSectionRow;\n"],"names":["RHSSectionRow","React","memo","section","idx","maintainRelativeOrder","existingSections","proposedSections","connectedSections","expandedSections","displayConfig","deviationAnalysisStatus","treeData","deviationNumberRegistry","getSectionCompareStyle","getBadgeRef","getSectionRowRef","sectionRightRefs","rhsBadgeRefs","openMoreFunctionsPopup","handleOpenSummaryPopup","handleCloseSummaryPopup","toggleSection","showDeviationBadges","renderSubSectionAccordion","isProposingFix","proposingFixNodeId","isRedlineFlow","isSideBySide","activeSideBySideSection","scrollSyncLocked","toggleScrollSyncLocked","deviationNodeIdToView","deviationTargetParentId","showDeviationNavigation","showOpenNodeRef","resolvedMarkdownStyles","unifiedNumbering","useCompareContext","sec","isTargetOfConnection","connectedStyle","connectedLhsIdx","isSameSectionId","value","targetIdx","String","mappedLhsIdx","findIndex","lhs","refIndexes","includes","selfIndex","lhsIdx","has","isSectionActive","style","displayStyle","hasMappedLhs","length","some","id","Boolean","isOrphanRhs","displayNumRhs","useMemo","fallbackNumber","rightNums","get","getRhsMappedSectionNumber","leftNums","rhsMappedSections","label","title","mapped","map","Array","isArray","rhsPosition","refIndex","baseNumber","getAlphabeticSuffix","filter","sort","a","b","rhsBadgeDisplayLabel","firstLabel","remainingCount","rhsBadgeTooltip","join","showScrollLockToggle","shouldShowDeviationLoader","evaluationResult","jsx","Box","ref","sx","mb","width","children","current","display","borderRadius","outline","badgeBorder","outlineOffset","jsxs","position","SectionAccordion","columnKey","colRef","parentNodeId","input_index_map","isExpanded","onToggle","navigation","Tooltip","whiteSpace","Typography","component","fontSize","lineHeight","placement","arrow","onClick","e","enableDeviationSchemaBackwardCompatibility","top","left","transform","alignItems","justifyContent","gap","bgcolor","badgeBg","color","badgeText","border","px","py","fontWeight","cursor","zIndex","boxShadow","Fragment","stopPropagation","borderRight","pr","ThreeDotsLoader","baseSec","find","s","content","EllipsisVertical","size","ScrollLockToggle","locked","borderColor"],"mappings":"gdAyBA,MAAMA,EAAgBC,EAAMC,KAC1B,EACEC,UACAC,UAEM,MAAAC,sBACJA,EAAAC,iBACAA,EAAAC,iBACAA,EAAAC,kBACAA,EAAAC,iBACAA,EAAAC,cACAA,EAAAC,wBACAA,EAAAC,SACAA,EAAAC,wBACAA,EAAAC,uBACAA,EAAAC,YACAA,EAAAC,iBACAA,EAAAC,iBACAA,EAAAC,aACAA,EAAAC,uBACAA,EAAAC,uBACAA,EAAAC,wBACAA,EAAAC,cACAA,EAAAC,oBACAA,GAAsB,EAAAC,0BACtBA,EAAAC,eACAA,EAAAC,mBACAA,EAAAC,cACAA,EAAAC,aACAA,EAAAC,wBACAA,EAAAC,iBACAA,EAAAC,uBACAA,EAAAC,sBACAA,EAAAC,wBACAA,EAAAC,wBACAA,EAAAC,gBACAA,EAAAC,uBACAA,EAAAC,iBACAA,GACEC,IACEC,EAAMpC,EAEZ,IAAIqC,GAAuB,EACvBC,EAAiB,KACjBC,GAAkB,EAChB,MAAAC,EAAkB,CAACC,EAA2CC,IAClEC,OAAOF,GAAS,MAAQE,OAAO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iD,EAAgB,CAAAb,MAAO/E,GAAagF,gBAIxChF,GAAae,MAAQ,GAAGf,GAAae,QAAU,sBAGxDmC,EAACZ,EAAA,CACCyB,UAAU,OACVK,QAAUC,IACRA,EAAEoB,kBACI,MAAAI,EAAUjJ,EACXE,EAAiBgJ,KAAMC,GAAWA,EAAEtG,YAAYC,SAASZ,EAAIa,aAAe,CAAEqB,MAAO,GAAIgF,QAAS,IAClGlJ,EAAiBH,IAAQ,CAAEqE,MAAO,GAAIgF,QAAS,IAEnDtI,EAAuB2G,EAAGwB,EAASvF,GAAaxB,EAAqBnC,EAAKqD,KAE7EwC,GAAI,CACFK,QAAS,cACT6B,WAAY,SACZQ,GAAI,GACJG,OAAQ,UACR,UAAW,CAAER,QAAS,GAAG7E,GAAagD,kBAGxCL,SAAA,CAAAN,EAAC4D,EAAiB,CAAAC,KAAM,GAAInB,MAAO/E,GAAagF,YAC/C9C,IACDG,EAAC8D,EAAA,CACCC,OAAQ/H,EACRqF,SAAUpF,EACVyG,MAAO/E,GAAagF,UACpBqB,YAAarG,GAAagD,YAC1BkD,KAAM,WAMZ7D,EAAAmD,EAAA,CACE7C,SAACN,EAAAC,EAAA,CAAIyB,UAAU,OAAOvB,GAAI,CAAE0C,GAAI,IAC7BvC,SAAAd,iBAhKL,aAAalF"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsxs as e,jsx as t}from"react/jsx-runtime";import n,{useEffect as i}from"react";import{Box as o,Accordion as r,AccordionSummary as s,Tooltip as l,Typography as d,AccordionDetails as a}from"@mui/material";import{ChevronUp as c,ChevronDown as u}from"lucide-react";import{MemoizedMarkdown as f}from"../hooks/memoizedMarkdown.js";import{useCompareContext as p}from"../CompareContext.js";import{hasValue as h,hasMeaningfulRedlineTags as g,safeStringify as m,stripRedlineTags as x,hasSingleMappedLhsSection as I,generateColorPalette as v,getLhsDeviationDisplayIndexes as y,DEVIATION_BADGE_SEPARATOR as b,isMissingStr as w,getRhsMappedSectionNumber as S,findTextMatchRange as $}from"../CognitiveComparehelpers.js";import{findTextRangeWithFormatting as R}from"../utils/normalizeInlineMarkdown.js";import{DEFAULT_DEVIAION_COLOR as _}from"../CognitiveCompareConstants.js";import{normalizeRedlineMarkdown as M}from"../utils/normalizeRedlineMarkdown.js";const k=(n,i=!1)=>{if(!n)return null;return m(n).replace(/\\n/g,"\n").split(/(\*\*.*?\*\*)/g).map((n,o)=>n.startsWith("**")&&n.endsWith("**")?t("strong",{children:n.slice(2,-2)},o):e("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"8px",width:"100%"},children:[t("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n}),i&&t("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",padding:"0px 6px",borderRadius:"9999px",background:"#F3F4F6",border:"1px solid #D1D5DB",color:"#6B7280",fontSize:"9px",fontWeight:500,whiteSpace:"nowrap",flexShrink:0,lineHeight:1.4,marginRight:"4px"},children:"Multiple"})]},o))},F=({section:F,idx:N,columnKey:B,colRef:C,mb:E=1,isExpanded:A,onToggle:O,navigation:j,parentNodeId:W=""})=>{const{showOpenNodeRef:T,resolvedMarkdownStyles:D,maintainRelativeOrder:P,showDeviationBadges:z=!1,renderSubSectionAccordion:K,treeData:G,proposedSections:L,existingSections:X,deviationNumberRegistry:H,deviationParentRegistry:V,getBadgeRef:Y,openSummaryPopup:q,getSectionCompareStyle:J,connectedSections:Q,openMoreFunctionsPopup:U,isProposingFix:Z,proposingFixNodeId:ee,isRedlineFlow:te,isSideBySide:ne,activeSideBySideSection:ie,scrollSyncLocked:oe,unifiedNumbering:re,toggleScrollSyncLocked:se,summaryPopupAnchorEl:le}=p(),de=`${ne?"1":"0"}-${String(ie??"")}`,ae=(F.displayTitle??!0)&&h(F.title),ce=!(!Z||!ee||"left"!==B||F.id!==ee&&F.nodeId!==ee&&F.contentId!==ee),ue=g(F.content),fe="boolean"==typeof te?te:ue,pe=ue,he=F.change_history,ge=fe&&ue,me=n.useMemo(()=>ge?M(m(F.content)):m(F.content),[F.content,ge]),xe=ge?x(me):F.content,Ie=ge?me:void 0,ve=ue&&h(he)?m(he):void 0,ye=((F.displayContent??!0)||ue)&&h(F.content),be=!ae&&!ye;let we=F.title;ae||(we=ye?"No Title Found":"No Matching Section Found");const Se="left"===B&&(F.isMultipleMapping||(F.refContentIds?.length??1)>1),$e="left"===B&&we.length>29?`${we.slice(0,29).trimEnd()}...`:we;let Re=F.evaluationResult;if(!Re&&"right"===B)if(P){const e=F.refIndexes?.[0],t=L.find(t=>t.selfIndex===e);Re=t?.evaluationResult}else Re=L[N]?.evaluationResult;const _e=G?.input_index_map?.[0],Me=G?.input_index_map?.[1],ke="left"===B?Me:_e,Fe=(e,t)=>{if(!t||!e)return null;for(const n of e){if(n.id===t||n.nodeId===t||n.contentId===t)return n;if(n.subsections?.length){const e=Fe(n.subsections,t);if(e)return e}}return null};let Ne="left"===B?F:Fe(L,F.id),Be="right"===B?F:Fe(X,F.id);const Ce=n.useMemo(()=>{if(!P)return 0;let e=1/0;const t=e=>{const t=m(e||"").replace(/\\n/g,"\n");return g(t)?x(M(t)):t},n=(i,o,r,s)=>{if(!i)return;let l=i.nodeId||i.id;if(s&&"right"===B){const e=L.filter(e=>e.refIndexes?.includes(i.selfIndex));e.length>0&&(l=e[0].nodeId||e[0].id)}let d=i.nodeId||i.id||o?.nodeId||o?.id||r?.nodeId||r?.id;const a=i.evaluationResult||o?.evaluationResult||r?.evaluationResult,c=a?.deviations||{};Object.keys(c).forEach(n=>{const s=c[n]?.[W];if(!((e,n)=>{if("string"!=typeof n||w(n))return!1;const i=t(e?.content),o=t(n);return!!o&&!!$(i,o)})("left"===B?o||i:r||i,s))return;const a=`${l}${b}${n}`,u=H?.[a];null!=u&&u<e&&(e=u);const f=`${d}${b}${n}`,p=H?.[f];null!=p&&p<e&&(e=p)});const u=i.subsections||[],f=o?.subsections||[],p=r?.subsections||[],h=Math.max(u.length,f.length,p.length);for(let e=0;e<h;e++)n(u[e],f[e],p[e],!1)},i="right"===B?L.filter(e=>e.refIndexes?.includes(F.selfIndex)):[];if(1===i.length){const e=i[0];(e.refIndexes||[]).map(e=>X.find(t=>t.selfIndex===e)).filter(Boolean).forEach(t=>{n(t,e,t,!0)})}else n(F,Ne,Be,!0);return e!==1/0?e-1:0},[F,Ne,Be,B,W,H,P,L,X]);if(P)if("left"===B){const e=F.refIndexes?.[0],t=X.findIndex(t=>t.selfIndex===e);Be=-1!==t?X[t]:Fe(X,F.id)}else{const e=F.refIndexes?.[0],t=L.findIndex(t=>t.selfIndex===e);Ne=-1!==t?L[t]:Fe(L,F.id)}const Ee="left"===B?!Be:!Ne,Ae=P&&"right"===B&&I(F,L),Oe=Re||Ne?.evaluationResult||Be?.evaluationResult,je=Oe?.evaluation_outputs?.metadata?.label_color??_,We=v(je),{highlightBg:Te}=We,De=Oe?.deviations||{},Pe=n.useMemo(()=>P&&"right"===B?y(L,_e,H):new Map,[P,B,L,_e,H]);let ze=F.nodeId||F.id;if(P&&"left"!==B){const e=L.filter(e=>e.refIndexes?.includes(F.selfIndex));e.length>0?ze=e[0].nodeId||e[0].id:Ne?.id&&(ze=Ne.nodeId||Ne.id)}const Ke=n.useMemo(()=>{const e=new Map;if(!P||"right"!==B)return e;let t=1;const n=L.filter(e=>e.refIndexes?.includes(F.selfIndex)),i=1===n.length&&1===n[0].refIndexes?.length,o=e=>m(e||"").replace(/\\n/g,"\n"),r=(e,t)=>{const i=t?n[0]:Fe(L,e.nodeId||e.id||e.contentId);return{lhsNode:i,evalResult:e.evaluationResult||i?.evaluationResult,registryNodeId:i?i.nodeId||i.id:e.nodeId||e.id}};if(i){const e=(n,i=!1)=>{if(!n)return;const{lhsNode:s,evalResult:l,registryNodeId:d}=r(n,i),a=o(n.content);Object.entries(l?.deviations||{}).forEach(([e,n])=>{const i=n[W],r=o(i);if(!(!!s&&!w(n[ke]))||!r||!$(a,r))return;const l=H[`${d}${b}${e}`];null!=l&&(t=Math.max(t,Math.max(1,l-(Ce||0))+1))}),(n.subsections||[]).forEach(t=>e(t))};e(F,!0)}const s=(n,i=!1)=>{if(!n)return;const{lhsNode:l,evalResult:d,registryNodeId:a}=r(n,i),c=d?.deviations||{},u=o(n.content);Object.entries(c).map(([e,t])=>{const n=t[W],i=!l||w(t[ke]),r=o(n);let s=-1;r&&(s=$(u,r)?.start??-1,-1===s&&(s=R(u,r)?.start??-1));const d=`${a}${b}${e}`;return{refId:d,isRenderable:i&&!!r&&!w(n),position:s,registryIndex:H[d]??Number.MAX_SAFE_INTEGER}}).filter(e=>e.isRenderable).sort((e,t)=>(-1===e.position?Number.MAX_SAFE_INTEGER:e.position)-(-1===t.position?Number.MAX_SAFE_INTEGER:t.position)||e.registryIndex-t.registryIndex).forEach(n=>{e.set(n.refId,t++)}),(n.subsections||[]).forEach(e=>s(e))};return s(F,!0),e},[P,B,F,L,W,ke,H,Ce]),Ge=Object.keys(De)[0],Le=Ge?`${ze}${b}${Ge}`:null,Xe=Le?V?.[Le]:null;let He=N+1;if(P&&re){const e="left"===B?re.leftNums.get(F?.id):re.rightNums.get(F?.id);Ee&&void 0!==e?He=e:null!=Xe&&Xe>=0?He=Xe:void 0!==e&&(He=e)}else null!=Xe&&Xe>=0&&(He=Xe);let Ve=Math.max(0,...Object.keys(De).map(e=>H[`${ze}${b}${e}`]).filter(e=>"number"==typeof e&&Number.isFinite(e)))+1;const Ye=Object.entries(De).map(([e,t])=>{const n=`${ze}${b}${e}`;return{deviationKey:e,deviationMap:t,refId:n,currentIndex:H[n]??Ve++}});Ye.sort((e,t)=>e.currentIndex-t.currentIndex);const qe=Ye.map(e=>{const{deviationKey:t,deviationMap:n,refId:i}=e;let o=e.currentIndex,r=n[W];const s=w(r);if(s)r="";else if(!r)return null;let l=N,d=N;if(P)if("left"===B){const e=F.refIndexes?.[0],t=X.findIndex(t=>t.selfIndex===e);if(-1!==t)d=t;else{const e=X.findIndex(e=>e.id===F.id||e.nodeId===F.nodeId||e.contentId===F.contentId);d=-1!==e?e:N}}else{const e=F.refIndexes?.[0],t=L.findIndex(t=>t.selfIndex===e);if(-1!==t)l=t;else{const e=L.findIndex(e=>e.id===F.id||e.nodeId===F.nodeId||e.contentId===F.contentId);l=-1!==e?e:N}}const a=`${ze}${b}${t}${b}${l}${b}${d}`,c=n[ke],u=Ee||w(c),f=Ke.get(i),p=Pe.get(i);P&&"right"===B&&u&&void 0!==f?o=f:P&&"right"===B&&!u&&void 0!==p?o=p:P&&void 0!==Ce&&("right"!==B||u||Ae)&&(o-=Ce),o=Math.max(1,o);const h=`${P&&"right"===B&&u&&re?S({section:F,proposedSections:L,leftNums:re.leftNums,fallbackNumber:String(He),firstOnly:!0}):He}.${o}`;let g=N;if("right"===B&&P){const e=F.refIndexes?.[0],t=L.findIndex(t=>t.selfIndex===e);if(-1!==t)g=t;else{const e=L.findIndex(e=>e.id===F.id||e.nodeId===F.nodeId||e.contentId===F.contentId);-1!==e&&(g=e)}}const m=J?J(g):null,x=n?.evaluation_outputs||Oe?.evaluation_outputs,I=x?.output_value??null,y=v(x?.metadata?.label_color??je);let $=m?{...m,badgeBg:y.badgeBg,badgeBorder:y.badgeBorder,badgeText:y.badgeText}:{...y};const R=n?.deviation_summary?{deviation_summary:n.deviation_summary,deviation_title:n?.deviation_title||Oe?.deviation_title,deviation_impact:n?.deviation_impact||Oe?.deviation_impact,deviation_explanation:n?.deviation_explanation||Oe?.deviation_explanation,evaluation_outputs:x,cognitive_decisioning:n?.cognitive_decisioning||Oe?.cognitive_decisioning}:null;let _=0;const M=xe||"";if(r&&M){const e=M.split(/\n{2,}/),n=e.findIndex(e=>e.includes(r));if(-1!==n){const i=Object.entries(De).filter(([t,i])=>{const o=i[W];return o&&e[n].includes(o)}).sort((t,i)=>e[n].indexOf(t[1][W])-e[n].indexOf(i[1][W])).filter(([e,t])=>{const n=t[W];return n&&(n.includes(r)||r.includes(n))});i.length>1&&(_=Math.max(0,i.findIndex(([e])=>e===t)))}}const k=Y(B,i);return{id:i,actionId:a,label:h,highlight:r,side:B,style:$,stackIndex:_,score:I,isConnected:Q?.has(a),showScrollLockToggle:Q?.has(a)||ne&&ie===a||!!le&&le===k.current,scrollSyncLocked:oe,toggleScrollSyncLocked:se,isOrphan:u,isMissingClause:s,badgeRef:k,onClick:e=>{e.stopPropagation(),U&&U(e,Ne||{id:"orphan-left",title:"",content:""},u,Be||{id:"orphan-right",title:"",content:""},a,$)},onSummaryClick:e=>{e.stopPropagation(),q(e,a,u,R)}}}).filter(Boolean),Je=z||ce?qe:[],Qe=qe.map(e=>e.highlight).filter(Boolean),Ue=F.id&&B===j?.columnKey?j:null,Ze=n.useRef(!1);return i(()=>{A||(Ze.current=!1)},[A]),e(o,{ref:C,sx:{mb:E,width:"100%",display:"flex",flexDirection:"column",position:"relative",minWidth:0},children:[A&&Ue?.showAbove&&t("div",{style:{position:"sticky",top:0,height:"0px",cursor:"pointer"},onClick:()=>Ue?.showAboveRef?.current?.scrollIntoView({behavior:"smooth",block:"center"}),children:t("div",{style:{transform:`translateY(-50%) translateX(calc(100% ${"left"===B?"+":"-"} 130px))`,position:"absolute",paddingTop:"20px",..."left"===B?{right:"-20px"}:{left:"-20px"}},children:t(c,{color:Ue?.showAboveRef?.current?window.getComputedStyle(Ue.showAboveRef.current).color:void 0})})}),e(r,{disableGutters:!0,expanded:!be&&A,onChange:()=>{be||(O(),T.current=F.id)},sx:{boxShadow:"none",border:be?"1px dashed #E2E8F0":"1px solid #E2E8F0",bgcolor:be?"#FAFAFA":"#FFFFFF",borderRadius:"6px",flexGrow:1,width:"100%",display:"flex",flexDirection:"column",minWidth:0,"&:before":{display:"none"},"& .MuiAccordion-heading":{position:"sticky",top:-12,zIndex:10,background:"#fff"}},children:[t(s,{expandIcon:be?null:t(u,{size:16}),sx:{minHeight:"36px",flexShrink:0,cursor:be?"default":"pointer","& .MuiAccordionSummary-content":{my:.5,display:"grid",alignItems:"center",minWidth:0,width:"100%"},"& .MuiAccordionSummary-expandIconWrapper":{transition:"transform 0.2s ease"},"& .MuiAccordionSummary-expandIconWrapper.Mui-expanded":{transform:"rotate(180deg)"}},children:ae&&t(l,{title:we,placement:"top",children:t(d,{component:"div",sx:{fontSize:"12px",color:be?"#94A3B8":"#19213D",fontWeight:be?400:700,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0},children:k($e,Se)})})}),!be&&e(a,{sx:{pt:0,pb:1.25,bgcolor:"#FFFFFF",flex:1,display:"flex",flexDirection:"column",minWidth:0},children:[ye&&t(f,{content:xe,overlayContent:Ie,fallbackContent:ve,sxStyles:D,highlights:Qe,maintainRelativeOrder:P,highlightBg:Te,suppressHighlightBg:pe,deviationBadges:Je,collisionKey:de}),(F.subsections||[]).map((e,t)=>K({section:e,keyPath:`${N}-${t}`,depth:0,columnKey:B,parentNodeId:W,sectionOffset:Ce,rhsOrphanVisualIndexes:Ke}))]})]}),A&&Ue?.showBelow&&t("div",{style:{position:"sticky",bottom:0,height:"0px",cursor:"pointer"},onClick:()=>Ue?.showBelowRef?.current?.scrollIntoView({behavior:"smooth",block:"center"}),children:t("div",{style:{transform:`translateY(-50%) translateX(calc(100% ${"left"===B?"+":"-"} 130px))`,position:"absolute",paddingBottom:"20px",..."left"===B?{right:"-20px"}:{left:"-20px"}},children:t(u,{color:Ue?.showBelowRef?.current?window.getComputedStyle(Ue.showBelowRef.current).color:void 0})})})]},`${B}-sec-${N}`)};export{F as default};
|
|
1
|
+
import{jsxs as e,jsx as t}from"react/jsx-runtime";import n,{useEffect as i}from"react";import{Box as o,Accordion as r,AccordionSummary as d,Tooltip as s,Typography as l,AccordionDetails as c}from"@mui/material";import{ChevronUp as a,ChevronDown as u}from"lucide-react";import{MemoizedMarkdown as f}from"../hooks/memoizedMarkdown.js";import{useCompareContext as p}from"../CompareContext.js";import{hasValue as h,hasMeaningfulRedlineTags as g,stripRedlineTags as x,hasSingleMappedLhsSection as m,generateColorPalette as I,getLhsDeviationDisplayIndexes as v,isMissingStr as y,getRhsMappedSectionNumber as b,safeStringify as w,DEVIATION_BADGE_SEPARATOR as S}from"../CognitiveComparehelpers.js";import{DEFAULT_DEVIAION_COLOR as R}from"../CognitiveCompareConstants.js";const $=(n,i=!1)=>{if(!n)return null;return w(n).replace(/\\n/g,"\n").split(/(\*\*.*?\*\*)/g).map((n,o)=>n.startsWith("**")&&n.endsWith("**")?t("strong",{children:n.slice(2,-2)},o):e("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"8px",width:"100%"},children:[t("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n}),i&&t("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",padding:"0px 6px",borderRadius:"9999px",background:"#F3F4F6",border:"1px solid #D1D5DB",color:"#6B7280",fontSize:"9px",fontWeight:500,whiteSpace:"nowrap",flexShrink:0,lineHeight:1.4,marginRight:"4px"},children:"Multiple"})]},o))},_=({section:_,idx:F,columnKey:M,colRef:k,mb:N=1,isExpanded:B,onToggle:C,navigation:E,parentNodeId:A=""})=>{const{showOpenNodeRef:O,resolvedMarkdownStyles:j,maintainRelativeOrder:W,showDeviationBadges:T=!1,renderSubSectionAccordion:D,treeData:P,proposedSections:K,existingSections:z,deviationNumberRegistry:G,deviationParentRegistry:L,getBadgeRef:X,openSummaryPopup:H,getSectionCompareStyle:V,connectedSections:Y,openMoreFunctionsPopup:q,isProposingFix:J,proposingFixNodeId:Q,isRedlineFlow:U,isSideBySide:Z,activeSideBySideSection:ee,scrollSyncLocked:te,unifiedNumbering:ne,toggleScrollSyncLocked:ie,summaryPopupAnchorEl:oe}=p(),re=`${Z?"1":"0"}-${String(ee??"")}`,de=(_.displayTitle??!0)&&h(_.title),se=!(!J||!Q||"left"!==M||_.id!==Q&&_.nodeId!==Q),le=g(_.content),ce="boolean"==typeof U?U:le,ae=le,ue=ce&&le,fe=ue?x(_.content):_.content,pe=ue?_.content:void 0,he=((_.displayContent??!0)||le)&&h(_.content),ge=!de&&!he;let xe=_.title;de||(xe=he?"No Title Found":"No Matching Section Found");const me="left"===M&&(_.isMultipleMapping||(_.refContentIds?.length??1)>1),Ie="left"===M&&xe.length>29?`${xe.slice(0,29).trimEnd()}...`:xe;let ve=_.evaluationResult;if(!ve&&"right"===M)if(W){const e=_.refIndexes?.[0],t=K.find(t=>t.selfIndex===e);ve=t?.evaluationResult}else ve=K[F]?.evaluationResult;const ye=P?.input_index_map?.[0],be=P?.input_index_map?.[1],we="left"===M?be:ye,Se=(e,t)=>{if(!t||!e)return null;for(const n of e){if(n.id===t||n.nodeId===t||n.contentId===t)return n;if(n.subsections?.length){const e=Se(n.subsections,t);if(e)return e}}return null};let Re="left"===M?_:Se(K,_.id),$e="right"===M?_:Se(z,_.id);const _e=n.useMemo(()=>{if(!W)return 0;let e=1/0;const t=e=>{const t=g(e)?x(e):e;return w(t||"").replace(/\\n/g,"\n")},n=(i,o,r,d)=>{if(!i)return;let s=i.nodeId||i.id;if(d&&"right"===M){const e=K.filter(e=>e.refIndexes?.includes(i.selfIndex));e.length>0&&(s=e[0].nodeId||e[0].id)}let l=i.nodeId||i.id||o?.nodeId||o?.id||r?.nodeId||r?.id;const c=i.evaluationResult||o?.evaluationResult||r?.evaluationResult,a=c?.deviations||{};Object.keys(a).forEach(n=>{const d=a[n]?.[A];if(!((e,n)=>{if("string"!=typeof n||y(n))return!1;const i=t(e?.content),o=t(n);return!!o&&i.includes(o)})("left"===M?o||i:r||i,d))return;const c=`${s}${S}${n}`,u=G?.[c];null!=u&&u<e&&(e=u);const f=`${l}${S}${n}`,p=G?.[f];null!=p&&p<e&&(e=p)});const u=i.subsections||[],f=o?.subsections||[],p=r?.subsections||[],h=Math.max(u.length,f.length,p.length);for(let e=0;e<h;e++)n(u[e],f[e],p[e],!1)},i="right"===M?K.filter(e=>e.refIndexes?.includes(_.selfIndex)):[];if(1===i.length){const e=i[0];(e.refIndexes||[]).map(e=>z.find(t=>t.selfIndex===e)).filter(Boolean).forEach(t=>{n(t,e,t,!0)})}else n(_,Re,$e,!0);return e!==1/0?e-1:0},[_,Re,$e,M,A,G,W,K,z]);if(W)if("left"===M){const e=_.refIndexes?.[0],t=z.findIndex(t=>t.selfIndex===e);$e=-1!==t?z[t]:Se(z,_.id)}else{const e=_.refIndexes?.[0],t=K.findIndex(t=>t.selfIndex===e);Re=-1!==t?K[t]:Se(K,_.id)}const Fe="left"===M?!$e:!Re,Me=W&&"right"===M&&m(_,K),ke=ve||Re?.evaluationResult||$e?.evaluationResult,Ne=ke?.evaluation_outputs?.metadata?.label_color??R,Be=I(Ne),{highlightBg:Ce}=Be,Ee=ke?.deviations||{},Ae=n.useMemo(()=>W&&"right"===M?v(K,ye,G):new Map,[W,M,K,ye,G]);let Oe=_.nodeId||_.id;if(W&&"left"!==M){const e=K.filter(e=>e.refIndexes?.includes(_.selfIndex));e.length>0?Oe=e[0].nodeId||e[0].id:Re?.id&&(Oe=Re.nodeId||Re.id)}const je=n.useMemo(()=>{const e=new Map;if(!W||"right"!==M)return e;let t=1;const n=K.filter(e=>e.refIndexes?.includes(_.selfIndex)),i=1===n.length&&1===n[0].refIndexes?.length,o=e=>w(e||"").replace(/\\n/g,"\n"),r=(e,t)=>{const i=t?n[0]:Se(K,e.nodeId||e.id||e.contentId);return{lhsNode:i,evalResult:e.evaluationResult||i?.evaluationResult,registryNodeId:i?i.nodeId||i.id:e.nodeId||e.id}};if(i){const e=(n,i=!1)=>{if(!n)return;const{lhsNode:d,evalResult:s,registryNodeId:l}=r(n,i),c=o(n.content);Object.entries(s?.deviations||{}).forEach(([e,n])=>{const i=n[A],r=o(i);if(!(!!d&&!y(n[we]))||!r||!c.includes(r))return;const s=G[`${l}${S}${e}`];null!=s&&(t=Math.max(t,Math.max(1,s-(_e||0))+1))}),(n.subsections||[]).forEach(t=>e(t))};e(_,!0)}const d=(n,i=!1)=>{if(!n)return;const{lhsNode:s,evalResult:l,registryNodeId:c}=r(n,i),a=l?.deviations||{},u=o(n.content);Object.entries(a).map(([e,t])=>{const n=t[A],i=!s||y(t[we]),r=o(n),d=r?u.indexOf(r):-1,l=`${c}${S}${e}`;return{refId:l,isRenderable:i&&!!r&&!y(n),position:d,registryIndex:G[l]??Number.MAX_SAFE_INTEGER}}).filter(e=>e.isRenderable).sort((e,t)=>(-1===e.position?Number.MAX_SAFE_INTEGER:e.position)-(-1===t.position?Number.MAX_SAFE_INTEGER:t.position)||e.registryIndex-t.registryIndex).forEach(n=>{e.set(n.refId,t++)}),(n.subsections||[]).forEach(e=>d(e))};return d(_,!0),e},[W,M,_,K,A,we,G,_e]),We=Object.keys(Ee)[0],Te=We?`${Oe}${S}${We}`:null,De=Te?L?.[Te]:null;let Pe=F+1;if(W&&ne){const e="left"===M?ne.leftNums.get(_?.id):ne.rightNums.get(_?.id);Fe&&void 0!==e?Pe=e:null!=De&&De>=0?Pe=De:void 0!==e&&(Pe=e)}else null!=De&&De>=0&&(Pe=De);const Ke=Object.entries(Ee).map(([e,t])=>{const n=`${Oe}${S}${e}`;return{deviationKey:e,deviationMap:t,refId:n,currentIndex:G[n]}}).filter(e=>void 0!==e.currentIndex&&null!==e.currentIndex);Ke.sort((e,t)=>e.currentIndex-t.currentIndex);const ze=Ke.map(e=>{const{deviationKey:t,deviationMap:n,refId:i}=e;let o=e.currentIndex,r=n[A];const d=y(r);if(d)r="";else if(!r)return null;let s=F,l=F;if(W)if("left"===M){const e=_.refIndexes?.[0],t=z.findIndex(t=>t.selfIndex===e);if(-1!==t)l=t;else{const e=z.findIndex(e=>e.id===_.id||e.nodeId===_.nodeId||e.contentId===_.contentId);l=-1!==e?e:F}}else{const e=_.refIndexes?.[0],t=K.findIndex(t=>t.selfIndex===e);if(-1!==t)s=t;else{const e=K.findIndex(e=>e.id===_.id||e.nodeId===_.nodeId||e.contentId===_.contentId);s=-1!==e?e:F}}const c=`${Oe}${S}${t}${S}${s}${S}${l}`,a=n[we],u=Fe||y(a),f=je.get(i),p=Ae.get(i);W&&"right"===M&&u&&void 0!==f?o=f:W&&"right"===M&&!u&&void 0!==p?o=p:W&&void 0!==_e&&("right"!==M||u||Me)&&(o-=_e),o=Math.max(1,o);const h=`${W&&"right"===M&&u&&ne?b({section:_,proposedSections:K,leftNums:ne.leftNums,fallbackNumber:String(Pe),firstOnly:!0}):Pe}.${o}`;let g=F;if("right"===M&&W){const e=_.refIndexes?.[0],t=K.findIndex(t=>t.selfIndex===e);if(-1!==t)g=t;else{const e=K.findIndex(e=>e.id===_.id||e.nodeId===_.nodeId||e.contentId===_.contentId);-1!==e&&(g=e)}}const x=V?V(g):null,m=n?.evaluation_outputs||ke?.evaluation_outputs,v=m?.output_value??null,w=I(m?.metadata?.label_color??Ne);let R=x?{...x,badgeBg:w.badgeBg,badgeBorder:w.badgeBorder,badgeText:w.badgeText}:{...w};const $=n?.deviation_summary?{deviation_summary:n.deviation_summary,deviation_title:n?.deviation_title||ke?.deviation_title,deviation_impact:n?.deviation_impact||ke?.deviation_impact,deviation_explanation:n?.deviation_explanation||ke?.deviation_explanation,evaluation_outputs:m,cognitive_decisioning:n?.cognitive_decisioning||ke?.cognitive_decisioning}:null;let k=0;const N=fe||"";if(r&&N){const e=N.split(/\n{2,}/),n=e.findIndex(e=>e.includes(r));if(-1!==n){const i=Object.entries(Ee).filter(([t,i])=>{const o=i[A];return o&&e[n].includes(o)}).sort((t,i)=>e[n].indexOf(t[1][A])-e[n].indexOf(i[1][A])).filter(([e,t])=>{const n=t[A];return n&&(n.includes(r)||r.includes(n))});i.length>1&&(k=Math.max(0,i.findIndex(([e])=>e===t)))}}const B=X(M,i);return{id:i,actionId:c,label:h,highlight:r,side:M,style:R,stackIndex:k,score:v,isConnected:Y?.has(c),showScrollLockToggle:Y?.has(c)||Z&&ee===c||!!oe&&oe===B.current,scrollSyncLocked:te,toggleScrollSyncLocked:ie,isOrphan:u,isMissingClause:d,badgeRef:B,onClick:e=>{e.stopPropagation(),q&&q(e,Re||{id:"orphan-left",title:"",content:""},u,$e||{id:"orphan-right",title:"",content:""},c,R)},onSummaryClick:e=>{e.stopPropagation(),H(e,c,u,$)}}}).filter(Boolean),Ge=T||!ce&&se?ze:[],Le=ze.map(e=>e.highlight).filter(Boolean),Xe=_.id&&M===E?.columnKey?E:null,He=n.useRef(!1);return i(()=>{B||(He.current=!1)},[B]),e(o,{ref:k,sx:{mb:N,width:"100%",display:"flex",flexDirection:"column",position:"relative",minWidth:0},children:[B&&Xe?.showAbove&&t("div",{style:{position:"sticky",top:0,height:"0px",cursor:"pointer"},onClick:()=>Xe?.showAboveRef?.current?.scrollIntoView({behavior:"smooth",block:"center"}),children:t("div",{style:{transform:`translateY(-50%) translateX(calc(100% ${"left"===M?"+":"-"} 130px))`,position:"absolute",paddingTop:"20px",..."left"===M?{right:"-20px"}:{left:"-20px"}},children:t(a,{color:Xe?.showAboveRef?.current?window.getComputedStyle(Xe.showAboveRef.current).color:void 0})})}),e(r,{disableGutters:!0,expanded:!ge&&B,onChange:()=>{ge||(C(),O.current=_.id)},sx:{boxShadow:"none",border:ge?"1px dashed #E2E8F0":"1px solid #E2E8F0",bgcolor:ge?"#FAFAFA":"#FFFFFF",borderRadius:"6px",flexGrow:1,width:"100%",display:"flex",flexDirection:"column",minWidth:0,"&:before":{display:"none"},"& .MuiAccordion-heading":{position:"sticky",top:-12,zIndex:10,background:"#fff"}},children:[t(d,{expandIcon:ge?null:t(u,{size:16}),sx:{minHeight:"36px",flexShrink:0,cursor:ge?"default":"pointer","& .MuiAccordionSummary-content":{my:.5,display:"grid",alignItems:"center",minWidth:0,width:"100%"},"& .MuiAccordionSummary-expandIconWrapper":{transition:"transform 0.2s ease"},"& .MuiAccordionSummary-expandIconWrapper.Mui-expanded":{transform:"rotate(180deg)"}},children:de&&t(s,{title:xe,placement:"top",children:t(l,{component:"div",sx:{fontSize:"12px",color:ge?"#94A3B8":"#19213D",fontWeight:ge?400:700,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0},children:$(Ie,me)})})}),!ge&&e(c,{sx:{pt:0,pb:1.25,bgcolor:"#FFFFFF",flex:1,display:"flex",flexDirection:"column",minWidth:0},children:[he&&t(f,{content:fe,overlayContent:pe,sxStyles:j,highlights:Le,maintainRelativeOrder:W,highlightBg:Ce,suppressHighlightBg:ae,deviationBadges:Ge,collisionKey:re}),(_.subsections||[]).map((e,t)=>D({section:e,keyPath:`${F}-${t}`,depth:0,columnKey:M,parentNodeId:A,sectionOffset:_e,rhsOrphanVisualIndexes:je}))]})]}),B&&Xe?.showBelow&&t("div",{style:{position:"sticky",bottom:0,height:"0px",cursor:"pointer"},onClick:()=>Xe?.showBelowRef?.current?.scrollIntoView({behavior:"smooth",block:"center"}),children:t("div",{style:{transform:`translateY(-50%) translateX(calc(100% ${"left"===M?"+":"-"} 130px))`,position:"absolute",paddingBottom:"20px",..."left"===M?{right:"-20px"}:{left:"-20px"}},children:t(u,{color:Xe?.showBelowRef?.current?window.getComputedStyle(Xe.showBelowRef.current).color:void 0})})})]},`${M}-sec-${F}`)};export{_ as default};
|
|
2
2
|
//# sourceMappingURL=SectionAccordion.js.map
|