@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
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),r=require("@mui/material"),i=require("react-markdown"),l=require("rehype-raw"),o=require("../../CognitiveCompareConfig.js"),a=require("../../CognitiveComparehelpers.js"),s=require("../utils/processGuidelinesMarkdown.js");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=u(i),d=u(l);exports.default=({guidelinesData:i,deviationData:l,connectedSections:u,proposedSections:g})=>{const c=Array.from(u)[0],{targetHighlights:p,labelColor:h}=t.useMemo(()=>{if(null==c||!l)return{targetHighlights:[],labelColor:""};let e="";"number"==typeof c?e=g[c]?.nodeId||"":"string"==typeof c&&(e=c.includes(a.DEVIATION_BADGE_SEPARATOR)?c.split(a.DEVIATION_BADGE_SEPARATOR)[0]:c.split("::")[0].split(":")[0]);const t=l[e];if(!t)return{targetHighlights:[],labelColor:""};let r=[];const i=t.evaluation_result||{};let o="";return Object.values(i).forEach(e=>{e?.deviation_highlights?.rulebook_guidelines&&(r=[...r,...e.deviation_highlights.rulebook_guidelines],o=e.evaluation_outputs?.metadata?.label_color?a.generateColorPalette(e.evaluation_outputs?.metadata?.label_color).bg:"")}),{targetHighlights:r.filter(Boolean),labelColor:o}},[c,l,g]),b=t.useMemo(()=>s.processGuidelinesMarkdown({guidelinesData:i,targetHighlights:p,labelColor:h||"#FEF08A"}),[i,p,h]);return e.jsx(r.Box,{sx:{padding:"0px 12px",backgroundColor:"#FFFFFF",borderRadius:"8px",...o.SHARED_MARKDOWN_STYLES,overflow:"visible"},children:e.jsx(n.default,{rehypePlugins:[d.default],children:b})})};
|
|
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":["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":"icAUuB,EAAGA,iBAAgBC,gBAAeC,oBAAmBC,uBAC1E,MAAMC,EAAmBC,MAAMC,KAAKJ,GAAmB,IAEjDK,iBAACA,EAAAC,WAAkBA,GAAcC,UAAQ,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,EAAAA,2BACfT,EAAiBU,MAAMD,EAAAA,2BAA2B,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,EAAqBA,qBAAAN,EAASG,oBAAoBC,UAAUC,aAAaE,GAAK,MAI7I,CAAEtB,iBAAkBS,EAAWc,OAAOC,SAAUvB,WAAAA,IACtD,CAACJ,EAAkBH,EAAeE,IAE/B6B,EAAoBvB,EAAAA,QACxB,IACEwB,4BAA0B,CACxBjC,iBACAO,mBACAC,WAAYA,GAAc,YAE9B,CAACR,EAAgBO,EAAkBC,IAInC,OAAA0B,EAAAA,IAACC,OAAIC,GAAI,CACPC,QAAS,WACTC,gBAAiB,UACjBC,aAAc,SACXC,EAAAA,uBACHC,SAAU,WAEVC,eAACC,EAAc,QAAA,CAAAC,cAAe,CAACC,EAAgB,SAC5CH"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),a=require("@mui/material"),t=require("react-markdown"),o=require("rehype-raw"),n=require("../../CognitiveCompareConfig.js"),i=require("../../CognitiveComparehelpers.js"),d=require("../../CitationAnchor.js");function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=l(t),u=l(o);const c=({evalNode:e})=>!1===e?.evaluation_outputs?.guideline_flag?.rulebook_used,p=(e,r,a)=>`${e}::${r}::${a}`,y=(e,r)=>`${e}::${r}`,b={relativeWrapper:{verticalAlign:"baseline"},arrow:{color:"#6D28D9"}};exports.default=({deviationData:t,connectedSections:o,proposedSections:l})=>{const w=Array.from(o||[])[0],v=r.useMemo(()=>((e,r)=>"number"==typeof e?r[e]?.nodeId||"":e&&"string"==typeof e&&e.trim()?e.includes(i.DEVIATION_BADGE_SEPARATOR)?e.split(i.DEVIATION_BADGE_SEPARATOR)[0]:e.split("::")[0].split(":")[0]:"")(w,l||[]),[w,l]),f=r.useMemo(()=>{if(!t||"object"!=typeof t)return[];return Object.entries(t).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:y(e,a),evaluation:r,webSearchAnswer:r.web_search_answer,colorPalette:i.generateColorPalette(r?.evaluation_outputs?.metadata?.label_color||"")??{border:b.arrow.color}})).filter(({webSearchAnswer:e})=>!!e?.enhanced_content)).map((e,r)=>({...e,answerOrder:r}))},[t]),g=r.useMemo(()=>f.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},{}),[f]),x=r.useMemo(()=>f.reduce((r,a)=>(r[a.answerKey]={a:({href:r="",children:t,type:o,reason:n,...i})=>{const l=i?.["data-cognitive-reasoning"],s=l?p(a.nodeId,a.evaluationKey,String(l)):"",u=s?g[s]:null;return e.jsx(d.default,{href:r,children:t,citationType:o,citationReason:n,metaData:{webGpt:u,webGptMetaKey:s},customStyle:b})}},r),{}),[f,g]);return e.jsx(a.Box,{sx:{padding:"12px 12px 12px 0px",backgroundColor:"#FFFFFF",borderRadius:"8px",...n.SHARED_MARKDOWN_STYLES,overflow:"visible"},children:f.length>0?f.map((r,t)=>e.jsx(a.Box,{id:r.nodeId===v?"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===v?"true":"false",sx:{mb:1.5,border:r.nodeId===v?`2px solid ${r.colorPalette.border}`:"1px solid #d3d3d3",borderRadius:"6px",padding:"8px",backgroundColor:"#FFFFFF"},children:e.jsx(s.default,{rehypePlugins:[u.default],components:x[r.answerKey],children:r.webSearchAnswer.enhanced_content})},r.answerKey)):e.jsx(a.Typography,{sx:{color:"#64748B",fontSize:"14px",py:1},children:"No web GPT data available."})})};
|
|
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","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":"sdASA,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,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AAqC,EAAWrC,EAAOV,YAAcY,EAGpC,OAAAmB,EAAAA,IAACQ,EAAAA,IAAA,CAECS,GAAID,EAAW,0BAAuB,EACtC,uBAAsBrC,EAAO1C,OAC7B,8BAA6B0C,EAAOzC,cACpC,4BAA2ByC,EAAOC,YAClC,sBAAqBoC,EAAW,OAAS,QACzCP,GAAI,CAAES,GAAI,IACRzC,OAAQuC,EAAW,aAAarC,EAAON,aAAaI,SAAW,oBAC/DmC,aAAc,MACdF,QAAS,MACTC,gBAAiB,WAGnBhB,SAAAK,EAAAA,IAACmB,EAAA,QAAA,CACCC,cAAe,CAACC,EAAAA,SAChBC,WAAY9B,EAAsBb,EAAOV,WAExC0B,WAAOxB,gBAAgBO,oBAjBrBC,EAAOV,aAuBjB+B,EAAAA,IAAAuB,EAAAA,WAAA,CAAWd,GAAI,CAAEhE,MAAO,UAAW+E,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","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":"maAQA,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,4BAUS,EAAGC,gBAAeC,oBAAmBC,uBACvD,MAAMC,EAAmBC,MAAMC,KAAKJ,GAAqB,IAAI,GACvDK,EAAmBC,EAAAA,QACvB,IAvDkB,EAACJ,EAA2BD,IAChB,iBAArBC,EACFD,EAAiBC,IAAmBZ,QAAU,GAGnDY,GAAgD,iBAArBA,GAAiCA,EAAiBK,OAC3EL,EAAiBM,SAASC,EAAAA,2BACrBP,EAAiBQ,MAAMD,6BAA2B,GAGpDP,EAAiBQ,MAAM,MAAM,GAAGA,MAAM,KAAK,GAG7C,GA0CCC,CAAcT,EAAkBD,GAAoB,IAC1D,CAACC,EAAkBD,IAGfW,EAAmBN,EAAAA,QAAQ,KAC/B,IAAKP,GAA0C,iBAAlBA,QAAmC,GAezD,OAAAc,OAAOC,QAAQf,GACnBgB,QAdqB,EAAEzB,EAAQ0B,KA9CX,CAACA,IAC1B,MAAMC,EAAeD,GAAsC,iBAAhBA,EAA4BA,EAAYE,kBAAoB,KACnG,OAACD,GAAuC,iBAAhBA,IAA6Bd,MAAMgB,QAAQF,GAAsB,GACzFd,MAAMgB,QAAQF,GACTA,EAAYG,IAAI,CAACnC,EAAUoC,KAAW,CAAEpC,WAAUM,cAAe+B,OAAOD,MAEtD,iBAAhBJ,EACFJ,OAAOC,QAAQ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AACC,EAAA,QAAA,CACCP,OACAC,WACAO,aAAcN,EACdO,eAAgBN,EAChBO,SAAU,CACRC,OAAQN,EACRO,cAAef,GAEjBgB,YAAajE,MAMd6C,GACN,CAAE,GACJ,CAAC3B,EAAkByB,IAGpB,OAAAe,EAAAA,IAACQ,OAAIC,GAAI,CACPC,QAAS,qBACTC,gBAAiB,UACjBC,aAAc,SACXC,EAAAA,uBACHC,SAAU,WAETnB,WAAiBoB,OAAS,EACzBvD,EAAiBQ,IAAI,CAACe,EAAad,IACjC+B,EAAAA,IAACQ,EAAAA,IAAA,CAGCQ,GAAIjC,EAAO7C,SAAWe,EAAmB,0BAAuB,EAChE,uBAAsB8B,EAAO7C,OAC7B,8BAA6B6C,EAAO5C,cACpC,4BAA2B4C,EAAOC,YAClC,sBAAqBD,EAAO7C,SAAWe,EAAmB,OAAS,QACnEwD,GAAI,CAAEQ,GAAI,IACRpC,OAASE,EAAO7C,SAAWe,EAAoB,aAAa8B,EAAON,aAAaI,SAAW,oBAC3F+B,aAAc,MACdF,QAAS,MACTC,gBAAiB,WAGnBhB,SAAAK,EAAAA,IAACkB,EAAA,QAAA,CACCC,cAAe,CAACC,EAAAA,SAChBC,WAAY7B,EAAsBT,EAAOV,WAExCsB,WAAOpB,gBAAgBO,oBAlBrBC,EAAOV,YAuBf2B,EAAAA,IAAAsB,EAAAA,WAAA,CAAWb,GAAI,CAAE/D,MAAO,UAAW6E,SAAU,OAAQC,GAAI,GAAK7B"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.processGuidelinesMarkdown=({guidelinesData:e,targetHighlights:t=[],labelColor:a="#FEF08A"})=>{let r="";if(e?.learnings_data&&Object.keys(e.learnings_data).length>0){const t=Object.keys(e.learnings_data)[0],a=e.learnings_data[t];a?.instruction_prompt&&(r=a.instruction_prompt)}else{(e?.data?.artifactData?.userStorySnapshot||[]).forEach(e=>{e.title&&(r+=`### ${e.title}\n\n`),e.value&&(r+=`${e.value}\n\n`),e.sub_features?.forEach(e=>{e.title&&(r+=`#### ${e.title}\n\n`),e.value&&(r+=`${e.value}\n\n`)})})}return t.forEach((e,t)=>{const n=e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"),l=new RegExp(`(${n})`,"g");r=r.replace(l,`<mark id="guideline-target-${t}" style="background-color: ${a}; border-radius: 3px; padding: 2px;">$1</mark>`)}),r};
|
|
2
2
|
//# sourceMappingURL=processGuidelinesMarkdown.js.map
|
package/dist/cjs/features/CognitiveCompare/Guidelines/utils/processGuidelinesMarkdown.js.map
CHANGED
|
@@ -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":["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":"sGAAyC,EACvCA,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
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),o=require("react"),t=require("@mui/material"),i=require("lucide-react"),n=require("./SectionAccordion.js"),r=require("./ThreeDotsLoader.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),o=require("react"),t=require("@mui/material"),i=require("lucide-react"),n=require("./SectionAccordion.js"),r=require("./ThreeDotsLoader.js"),a=require("../CognitiveComparehelpers.js"),l=require("../CompareContext.js");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const d=s(o).default.memo(({section:o,idx:s})=>{const{maintainRelativeOrder:d,existingSections:c,proposedSections:p,connectedSections:x,expandedSections:u,displayConfig:g,deviationAnalysisStatus:f,treeData:m,deviationNumberRegistry:h,getSectionCompareStyle:S,getBadgeRef:b,getSectionRowRef:v,sectionLeftRefs:y,lhsBadgeRefs:B,openMoreFunctionsPopup:R,handleOpenSummaryPopup:j,handleCloseSummaryPopup:w,toggleSection:C,showDeviationBadges:I=!1,renderSubSectionAccordion:N,isProposingFix:$,proposingFixNodeId:D,isRedlineFlow:P,isSideBySide:k,activeSideBySideSection:q,scrollSyncLocked:T,toggleScrollSyncLocked:A,summaryPopupAnchorEl:_,deviationNodeIdToView:z,deviationTargetParentId:F,showDeviationNavigation:L,showOpenNodeRef:O,resolvedMarkdownStyles:E,unifiedNumbering:M}=l.useCompareContext(),W=!o.title&&!o.content;if(d&&W)return null;const V=o,K=S(s,"left"),X=d?!V.refIndexes?.length||V.selfIndex<0:!c[s],Y=x.has(s);B.current[s];const G=a.extractDeviationScore(V.evaluationResult,K?.deviationLabel),H=M.leftNums.get(V.id),J=("mapping_ready"===f||"deviations_streaming"===f)&&(null==V.evaluationResult||void 0===V.evaluationResult);return e.jsx(t.Box,{ref:v(s),sx:{mb:1,width:"100%"},children:e.jsx(t.Box,{ref:y.current[s],sx:{width:"100%",display:"flex",flexDirection:"column",minWidth:0,...Y&&{borderRadius:"6px",outline:`2px solid ${K?.badgeBorder||"#6366F1"}`,outlineOffset:"1px"}},children:e.jsxs(t.Box,{sx:{position:"relative",width:"100%"},children:[e.jsx(n.default,{section:o,idx:s,columnKey:"left",colRef:v(`left-accordion-${s}`),mb:0,parentNodeId:m?.input_index_map?.[0]||"",isExpanded:d?!!u[`left-${s}`]:!!u[String(s)],onToggle:()=>{w(),C(s,"left")},navigation:o.id?L[o.id]:null}),d&&K&&e.jsxs(t.Box,{ref:B.current[s],onClick:e=>{const o=g.enableDeviationSchemaBackwardCompatibility?V.evaluationResult??null:V.evaluationResult?.[0]??null;j(e,String(s),X,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:K.badgeBg,color:K.badgeText,border:`1px solid ${K.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:[e.jsxs(t.Box,{component:"span",onClick:e=>{e.stopPropagation();const o=g.enableDeviationSchemaBackwardCompatibility?V.evaluationResult??null:V.evaluationResult?.[0]??null;j(e,String(s),X,o)},sx:{display:"inline-flex",alignItems:"center",gap:"4px",px:.2,cursor:X?"default":"pointer",borderRight:`1px solid ${K.badgeBorder}`,"&:hover":X?{}:{bgColor:`${K.badgeBorder}22`}},children:[null!=H&&e.jsx(t.Box,{component:"span",sx:{fontSize:"11px",fontWeight:700,pr:.5,borderRight:`1px solid ${K.badgeBorder}`},children:H}),e.jsx(t.Box,{component:"span",sx:{fontSize:"11px",px:.25},children:J?e.jsx(t.Tooltip,{title:"Deviation data generation in progress",placement:"top",arrow:!0,children:e.jsx(t.Box,{component:"span",sx:{display:"inline-flex",alignItems:"center"},children:e.jsx(r.default,{color:K.badgeText})})}):"N/A"===G||"NA"===G?"N/A":0==G||null==G?"Same":`${G}`})]}),e.jsx(t.Box,{component:"span",onClick:e=>{e.stopPropagation();const t=d?c.find(e=>V.refIndexes?.includes(e.selfIndex))||{title:"",content:""}:c[s]||{title:"",content:""};R(e,o,X,t,s,K)},sx:{display:"inline-flex",alignItems:"center",px:.2,cursor:"pointer","&:hover":{bgcolor:`${K.badgeBorder}22`}},children:e.jsx(i.EllipsisVertical,{size:11,color:K.badgeText})})]})]})})},`left-row-${s}`)});exports.default=d;
|
|
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","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":"yYAqBA,MAAMA,OAAsB,QAAAC,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,EAAkBA,oBAChBC,GAAWpC,EAAQqC,QAAUrC,EAAQsC,QACvC,GAAApC,GAAyBkC,EAAgB,OAAA,KAE7C,MAAMG,EAAMvC,EACNwC,EAAQ9B,EAAuBT,EAAK,QACpCwC,EAAWvC,GACXqC,EAAIG,YAAYC,QAAUJ,EAAIK,UAAY,GAC3CzC,EAAiBF,GAChB4C,EAAcxC,EAAkByC,IAAI7C,GAC1Ba,EAAaiC,QAAQ9C,GAKrC,MAAM+C,EAAWC,EAAAA,sBAAsBV,EAAIW,iBAAmBV,GAAeW,gBACvEC,EAAalB,EAAiBmB,SAASC,IAAIf,EAAIgB,IAErD,OACGC,EAAAA,IAAAC,EAAAA,IAAA,CAA4BC,IAAK9C,EAAiBX,GAAM0D,GAAI,CAAEC,GA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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","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":"yYAqBA,MAAMA,OAAsB,QAAAC,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,EAAkBA,oBAChBC,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,EAAAA,sBAAsBV,EAAIW,iBAAmBV,GAAeW,gBACvEC,EAAalB,EAAiBmB,SAASC,IAAIf,EAAIgB,IAI/CC,GAFwB,kBAA5BjD,GAC4B,yBAA5BA,KAGyB,MAAxBgC,EAAIW,uBAAqD,IAAzBX,EAAIW,kBAEvC,OACGO,EAAAA,IAAAC,EAAAA,IAAA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oE,EAAGpF,EAAS0C,EAAUuE,EAAQhH,EAAKwC,IAE5DoB,GAAI,CACFI,QAAS,cACTwB,WAAY,SACZQ,GAAI,GACJG,OAAQ,UACR,UAAW,CAAER,QAAS,GAAGnD,EAAM6B,kBAGjCN,eAACqD,EAAAA,iBAAiB,CAAAC,KAAM,GAAIxB,MAAOrD,EAAMsD,uBArIzC,YAAY9F"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),n=require("react"),t=require("@mui/material"),i=require("lucide-react"),o=require("./SectionAccordion.js"),r=require("./ThreeDotsLoader.js"),l=require("./ScrollLockToggle.js"),s=require("../CognitiveComparehelpers.js"),a=require("../CompareContext.js");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=d(n);const x=c.default.memo(({section:n,idx:d})=>{const{maintainRelativeOrder:x,existingSections:p,proposedSections:u,connectedSections:g,expandedSections:f,displayConfig:h,deviationAnalysisStatus:m,treeData:S,deviationNumberRegistry:b,getSectionCompareStyle:v,getBadgeRef:I,getSectionRowRef:j,sectionRightRefs:y,rhsBadgeRefs:B,openMoreFunctionsPopup:R,handleOpenSummaryPopup:w,handleCloseSummaryPopup:C,toggleSection:$,showDeviationBadges:N=!1,renderSubSectionAccordion:T,isProposingFix:k,proposingFixNodeId:q,isRedlineFlow:D,isSideBySide:M,activeSideBySideSection:P,scrollSyncLocked:z,toggleScrollSyncLocked:A,deviationNodeIdToView:F,deviationTargetParentId:_,showDeviationNavigation:O,showOpenNodeRef:L,resolvedMarkdownStyles:E,unifiedNumbering:U}=a.useCompareContext(),V=n;let W=!1,H=null,K=-1;const X=(e,n)=>String(e??"")===String(n);let Y=-1;x?(Y=u.findIndex(e=>e.refIndexes?.includes(V.selfIndex)&&e.selfIndex>=0),K=u.findIndex((e,n)=>(e=>g.has(e)||g.has(String(e))||null!=P&&!String(P).includes("::")&&X(P,e))(n)&&e.refIndexes?.includes(V.selfIndex)),W=-1!==K,W&&(H=v(K,"left"))):(W=g.has(d)||g.has(String(d))||X(P,d),W&&(H=v(d,"right")));const G=x&&-1!==Y?v(Y,"left"):v(d,"right"),J=H||G,Q=x?-1!==Y||!V.refIndexes?.length&&u.some(e=>e.id&&e.id===V.id):Boolean(u[d]),Z=x?V.selfIndex<0||!Q:!u[d],ee=c.default.useMemo(()=>{const e=U.rightNums.get(V.id);return x&&V.id?s.getRhsMappedSectionNumber({section:V,proposedSections:u,leftNums:U.leftNums,fallbackNumber:e}):e},[x,u,V.id,V.selfIndex,U]),ne=c.default.useMemo(()=>{if(!x||null==V.selfIndex)return null!=ee?[{label:String(ee),title:V.title||"Untitled Section",lhsIdx:-1}]:[];const e=u.map((e,n)=>{const t=Array.isArray(e?.refIndexes)?e.refIndexes:[],i=t.findIndex(e=>e===V.selfIndex);if(-1===i)return null;const o=e?.id?U.leftNums.get(e.id):void 0;if(null==o)return null;return{label:t.length>1?`${o}${s.getAlphabeticSuffix(i)}`:String(o),title:e?.title||"Untitled Section",lhsIdx:n}}).filter(Boolean);return-1===K?e:[...e].sort((e,n)=>e.lhsIdx===K?-1:n.lhsIdx===K?1:0)},[x,u,V.selfIndex,V.title,ee,U.leftNums,K]),te=c.default.useMemo(()=>{const e=ne[0]?.label;if(!e)return null!=ee?String(ee):"";const n=ne.length-1;return n>0?`${e} + ${n}`:e},[ne,ee]),ie=c.default.useMemo(()=>0===ne.length?"":ne.map(e=>`${e.label}: ${e.title}`).join("\n"),[ne]),oe=W||M&&(X(P,d)||-1!==Y&&X(P,Y)),re=("mapping_ready"===m||"deviations_streaming"===m)&&(null==V.evaluationResult||void 0===V.evaluationResult);return e.jsx(t.Box,{ref:j(d),sx:{mb:1,width:"100%"},children:e.jsx(t.Box,{ref:y.current[d],sx:{width:"100%",display:"flex",...W&&H&&{borderRadius:"6px",outline:`2px solid ${H.badgeBorder}`,outlineOffset:"1px"}},children:e.jsxs(t.Box,{sx:{position:"relative",width:"100%"},children:[e.jsx(o.default,{section:n,idx:d,columnKey:"right",colRef:j(`right-accordion-${d}`),mb:0,parentNodeId:S?.input_index_map?.[1]||"",isExpanded:x?!!f[`right-${d}`]:!!f[String(d)],onToggle:()=>{C(),$(d,"right")},navigation:n.id?O[n.id]:null}),x&&J&&e.jsx(t.Tooltip,{title:ie?e.jsx(t.Box,{sx:{whiteSpace:"pre-line"},children:e.jsx(t.Typography,{component:"span",sx:{fontSize:"11px",lineHeight:1.5},children:ie})}):"",placement:"top",arrow:!0,children:e.jsx(t.Box,{ref:B.current[d],"data-section-id":V.id,onClick:e=>{if(!Z)return;const n=h.enableDeviationSchemaBackwardCompatibility?V.evaluationResult??null:V.evaluationResult?.[0]??null;w(e,String(d),Z,n)},sx:{position:"absolute",top:"18px",left:0,transform:"translateY(-50%) translateX(calc(-100% - 8px))",display:"inline-flex",alignItems:"center",justifyContent:"center",gap:Z?"4px":"0px",fontSize:"11px",bgcolor:J.badgeBg,color:J.badgeText,border:`1px solid ${J.badgeBorder}`,borderRadius:Z?"12px":"10px",px:Z?1.2:1,py:.3,fontWeight:Z?600:700,cursor:Z?"pointer":"default",whiteSpace:"nowrap",zIndex:20,boxShadow:Z?"0 1px 3px rgba(0,0,0,0.07)":"none"},children:Z?e.jsxs(e.Fragment,{children:[e.jsxs(t.Box,{component:"span",onClick:e=>{e.stopPropagation();const n=h.enableDeviationSchemaBackwardCompatibility?V.evaluationResult??null:V.evaluationResult?.[0]??null;w(e,String(d),Z,n)},sx:{display:"inline-flex",alignItems:"center",gap:"4px",px:.2,cursor:"pointer",borderRight:`1px solid ${J.badgeBorder}`,"&:hover":{bgcolor:`${J.badgeBorder}22`}},children:[null!=ee&&e.jsx(t.Box,{component:"span",sx:{fontSize:"11px",fontWeight:700,pr:.5,borderRight:`1px solid ${J.badgeBorder}`},children:ee}),e.jsx(t.Box,{component:"span",sx:{fontSize:"11px",px:.25},children:re?e.jsx(t.Tooltip,{title:"Deviation data generation in progress",placement:"top",arrow:!0,children:e.jsx(t.Box,{component:"span",sx:{display:"inline-flex",alignItems:"center"},children:e.jsx(r.default,{color:J.badgeText})})}):J.label?`${J.label}`:"100% Deviation"})]}),e.jsxs(t.Box,{component:"span",onClick:e=>{e.stopPropagation();const n=x?u.find(e=>e.refIndexes?.includes(V.selfIndex))||{title:"",content:""}:u[d]||{title:"",content:""};R(e,n,Z,V,d,J)},sx:{display:"inline-flex",alignItems:"center",px:.2,cursor:"pointer","&:hover":{bgcolor:`${J.badgeBorder}22`}},children:[e.jsx(i.EllipsisVertical,{size:11,color:J.badgeText}),oe&&e.jsx(l.default,{locked:z,onToggle:A,color:J.badgeText,borderColor:J.badgeBorder,size:11})]})]}):e.jsx(e.Fragment,{children:e.jsx(t.Box,{component:"span",sx:{px:.2},children:te})})})})]})})},`right-row-${d}`)});exports.default=x;
|
|
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":"ubAyBA,MAAMA,EAAgBC,EAAM,QAAAC,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,iBACA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,SAACN,EAAAA,IAAAC,EAAAA,IAAA,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":"ubAyBA,MAAMA,EAAgBC,EAAM,QAAAC,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,sBAC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AAOvB,GAAI,CAAE0C,GAAI,IAC7BvC,SAAAd,iBAhKL,aAAalF"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),n=require("@mui/material"),i=require("lucide-react"),o=require("../hooks/memoizedMarkdown.js"),s=require("../CompareContext.js"),r=require("../CognitiveComparehelpers.js"),l=require("../utils/normalizeInlineMarkdown.js"),d=require("../CognitiveCompareConstants.js"),a=require("../utils/normalizeRedlineMarkdown.js");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=c(t);const f=(t,n=!1)=>{if(!t)return null;return r.safeStringify(t).replace(/\\n/g,"\n").split(/(\*\*.*?\*\*)/g).map((t,i)=>t.startsWith("**")&&t.endsWith("**")?e.jsx("strong",{children:t.slice(2,-2)},i):e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"8px",width:"100%"},children:[e.jsx("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t}),n&&e.jsx("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"})]},i))};exports.default=({section:c,idx:p,columnKey:g,colRef:h,mb:x=1,isExpanded:I,onToggle:m,navigation:v,parentNodeId:y=""})=>{const{showOpenNodeRef:R,resolvedMarkdownStyles:S,maintainRelativeOrder:b,showDeviationBadges:A=!1,renderSubSectionAccordion:_,treeData:E,proposedSections:w,existingSections:M,deviationNumberRegistry:O,deviationParentRegistry:T,getBadgeRef:$,openSummaryPopup:N,getSectionCompareStyle:j,connectedSections:D,openMoreFunctionsPopup:B,isProposingFix:k,proposingFixNodeId:F,isRedlineFlow:C,isSideBySide:P,activeSideBySideSection:V,scrollSyncLocked:G,unifiedNumbering:W,toggleScrollSyncLocked:q,summaryPopupAnchorEl:z}=s.useCompareContext(),L=`${P?"1":"0"}-${String(V??"")}`,K=(c.displayTitle??!0)&&r.hasValue(c.title),X=!(!k||!F||"left"!==g||c.id!==F&&c.nodeId!==F&&c.contentId!==F),H=r.hasMeaningfulRedlineTags(c.content),U="boolean"==typeof C?C:H,Y=H,J=c.change_history,Q=U&&H,Z=u.default.useMemo(()=>Q?a.normalizeRedlineMarkdown(r.safeStringify(c.content)):r.safeStringify(c.content),[c.content,Q]),ee=Q?r.stripRedlineTags(Z):c.content,te=Q?Z:void 0,ne=H&&r.hasValue(J)?r.safeStringify(J):void 0,ie=((c.displayContent??!0)||H)&&r.hasValue(c.content),oe=!K&&!ie;let se=c.title;K||(se=ie?"No Title Found":"No Matching Section Found");const re="left"===g&&(c.isMultipleMapping||(c.refContentIds?.length??1)>1),le="left"===g&&se.length>29?`${se.slice(0,29).trimEnd()}...`:se;let de=c.evaluationResult;if(!de&&"right"===g)if(b){const e=c.refIndexes?.[0],t=w.find(t=>t.selfIndex===e);de=t?.evaluationResult}else de=w[p]?.evaluationResult;const ae=E?.input_index_map?.[0],ce=E?.input_index_map?.[1],ue="left"===g?ce:ae,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 pe="left"===g?c:fe(w,c.id),ge="right"===g?c:fe(M,c.id);const he=u.default.useMemo(()=>{if(!b)return 0;let e=1/0;const t=e=>{const t=r.safeStringify(e||"").replace(/\\n/g,"\n");return r.hasMeaningfulRedlineTags(t)?r.stripRedlineTags(a.normalizeRedlineMarkdown(t)):t},n=(i,o,s,l)=>{if(!i)return;let d=i.nodeId||i.id;if(l&&"right"===g){const e=w.filter(e=>e.refIndexes?.includes(i.selfIndex));e.length>0&&(d=e[0].nodeId||e[0].id)}let a=i.nodeId||i.id||o?.nodeId||o?.id||s?.nodeId||s?.id;const c=i.evaluationResult||o?.evaluationResult||s?.evaluationResult,u=c?.deviations||{};Object.keys(u).forEach(n=>{const l=u[n]?.[y];if(!((e,n)=>{if("string"!=typeof n||r.isMissingStr(n))return!1;const i=t(e?.content),o=t(n);return!!o&&!!r.findTextMatchRange(i,o)})("left"===g?o||i:s||i,l))return;const c=`${d}${r.DEVIATION_BADGE_SEPARATOR}${n}`,f=O?.[c];null!=f&&f<e&&(e=f);const p=`${a}${r.DEVIATION_BADGE_SEPARATOR}${n}`,h=O?.[p];null!=h&&h<e&&(e=h)});const f=i.subsections||[],p=o?.subsections||[],h=s?.subsections||[],x=Math.max(f.length,p.length,h.length);for(let e=0;e<x;e++)n(f[e],p[e],h[e],!1)},i="right"===g?w.filter(e=>e.refIndexes?.includes(c.selfIndex)):[];if(1===i.length){const e=i[0];(e.refIndexes||[]).map(e=>M.find(t=>t.selfIndex===e)).filter(Boolean).forEach(t=>{n(t,e,t,!0)})}else n(c,pe,ge,!0);return e!==1/0?e-1:0},[c,pe,ge,g,y,O,b,w,M]);if(b)if("left"===g){const e=c.refIndexes?.[0],t=M.findIndex(t=>t.selfIndex===e);ge=-1!==t?M[t]:fe(M,c.id)}else{const e=c.refIndexes?.[0],t=w.findIndex(t=>t.selfIndex===e);pe=-1!==t?w[t]:fe(w,c.id)}const xe="left"===g?!ge:!pe,Ie=b&&"right"===g&&r.hasSingleMappedLhsSection(c,w),me=de||pe?.evaluationResult||ge?.evaluationResult,ve=me?.evaluation_outputs?.metadata?.label_color??d.DEFAULT_DEVIAION_COLOR,ye=r.generateColorPalette(ve),{highlightBg:Re}=ye,Se=me?.deviations||{},be=u.default.useMemo(()=>b&&"right"===g?r.getLhsDeviationDisplayIndexes(w,ae,O):new Map,[b,g,w,ae,O]);let Ae=c.nodeId||c.id;if(b&&"left"!==g){const e=w.filter(e=>e.refIndexes?.includes(c.selfIndex));e.length>0?Ae=e[0].nodeId||e[0].id:pe?.id&&(Ae=pe.nodeId||pe.id)}const _e=u.default.useMemo(()=>{const e=new Map;if(!b||"right"!==g)return e;let t=1;const n=w.filter(e=>e.refIndexes?.includes(c.selfIndex)),i=1===n.length&&1===n[0].refIndexes?.length,o=e=>r.safeStringify(e||"").replace(/\\n/g,"\n"),s=(e,t)=>{const i=t?n[0]:fe(w,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:l,evalResult:d,registryNodeId:a}=s(n,i),c=o(n.content);Object.entries(d?.deviations||{}).forEach(([e,n])=>{const i=n[y],s=o(i);if(!(!!l&&!r.isMissingStr(n[ue]))||!s||!r.findTextMatchRange(c,s))return;const d=`${a}${r.DEVIATION_BADGE_SEPARATOR}${e}`,u=O[d];null!=u&&(t=Math.max(t,Math.max(1,u-(he||0))+1))}),(n.subsections||[]).forEach(t=>e(t))};e(c,!0)}const d=(n,i=!1)=>{if(!n)return;const{lhsNode:a,evalResult:c,registryNodeId:u}=s(n,i),f=c?.deviations||{},p=o(n.content);Object.entries(f).map(([e,t])=>{const n=t[y],i=!a||r.isMissingStr(t[ue]),s=o(n);let d=-1;s&&(d=r.findTextMatchRange(p,s)?.start??-1,-1===d&&(d=l.findTextRangeWithFormatting(p,s)?.start??-1));const c=`${u}${r.DEVIATION_BADGE_SEPARATOR}${e}`;return{refId:c,isRenderable:i&&!!s&&!r.isMissingStr(n),position:d,registryIndex:O[c]??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(c,!0),e},[b,g,c,w,y,ue,O,he]),Ee=Object.keys(Se)[0],we=Ee?`${Ae}${r.DEVIATION_BADGE_SEPARATOR}${Ee}`:null,Me=we?T?.[we]:null;let Oe=p+1;if(b&&W){const e="left"===g?W.leftNums.get(c?.id):W.rightNums.get(c?.id);xe&&void 0!==e?Oe=e:null!=Me&&Me>=0?Oe=Me:void 0!==e&&(Oe=e)}else null!=Me&&Me>=0&&(Oe=Me);let Te=Math.max(0,...Object.keys(Se).map(e=>O[`${Ae}${r.DEVIATION_BADGE_SEPARATOR}${e}`]).filter(e=>"number"==typeof e&&Number.isFinite(e)))+1;const $e=Object.entries(Se).map(([e,t])=>{const n=`${Ae}${r.DEVIATION_BADGE_SEPARATOR}${e}`;return{deviationKey:e,deviationMap:t,refId:n,currentIndex:O[n]??Te++}});$e.sort((e,t)=>e.currentIndex-t.currentIndex);const Ne=$e.map(e=>{const{deviationKey:t,deviationMap:n,refId:i}=e;let o=e.currentIndex,s=n[y];const l=r.isMissingStr(s);if(l)s="";else if(!s)return null;let d=p,a=p;if(b)if("left"===g){const e=c.refIndexes?.[0],t=M.findIndex(t=>t.selfIndex===e);if(-1!==t)a=t;else{const e=M.findIndex(e=>e.id===c.id||e.nodeId===c.nodeId||e.contentId===c.contentId);a=-1!==e?e:p}}else{const e=c.refIndexes?.[0],t=w.findIndex(t=>t.selfIndex===e);if(-1!==t)d=t;else{const e=w.findIndex(e=>e.id===c.id||e.nodeId===c.nodeId||e.contentId===c.contentId);d=-1!==e?e:p}}const u=`${Ae}${r.DEVIATION_BADGE_SEPARATOR}${t}${r.DEVIATION_BADGE_SEPARATOR}${d}${r.DEVIATION_BADGE_SEPARATOR}${a}`,f=n[ue],h=xe||r.isMissingStr(f),x=_e.get(i),I=be.get(i);b&&"right"===g&&h&&void 0!==x?o=x:b&&"right"===g&&!h&&void 0!==I?o=I:b&&void 0!==he&&("right"!==g||h||Ie)&&(o-=he),o=Math.max(1,o);const m=`${b&&"right"===g&&h&&W?r.getRhsMappedSectionNumber({section:c,proposedSections:w,leftNums:W.leftNums,fallbackNumber:String(Oe),firstOnly:!0}):Oe}.${o}`;let v=p;if("right"===g&&b){const e=c.refIndexes?.[0],t=w.findIndex(t=>t.selfIndex===e);if(-1!==t)v=t;else{const e=w.findIndex(e=>e.id===c.id||e.nodeId===c.nodeId||e.contentId===c.contentId);-1!==e&&(v=e)}}const R=j?j(v):null,S=n?.evaluation_outputs||me?.evaluation_outputs,A=S?.output_value??null,_=S?.metadata?.label_color??ve,E=r.generateColorPalette(_);let O=R?{...R,badgeBg:E.badgeBg,badgeBorder:E.badgeBorder,badgeText:E.badgeText}:{...E};const T=n?.deviation_summary?{deviation_summary:n.deviation_summary,deviation_title:n?.deviation_title||me?.deviation_title,deviation_impact:n?.deviation_impact||me?.deviation_impact,deviation_explanation:n?.deviation_explanation||me?.deviation_explanation,evaluation_outputs:S,cognitive_decisioning:n?.cognitive_decisioning||me?.cognitive_decisioning}:null;let k=0;const F=ee||"";if(s&&F){const e=F.split(/\n{2,}/),n=e.findIndex(e=>e.includes(s));if(-1!==n){const i=Object.entries(Se).filter(([t,i])=>{const o=i[y];return o&&e[n].includes(o)}).sort((t,i)=>e[n].indexOf(t[1][y])-e[n].indexOf(i[1][y])).filter(([e,t])=>{const n=t[y];return n&&(n.includes(s)||s.includes(n))});i.length>1&&(k=Math.max(0,i.findIndex(([e])=>e===t)))}}const C=$(g,i);return{id:i,actionId:u,label:m,highlight:s,side:g,style:O,stackIndex:k,score:A,isConnected:D?.has(u),showScrollLockToggle:D?.has(u)||P&&V===u||!!z&&z===C.current,scrollSyncLocked:G,toggleScrollSyncLocked:q,isOrphan:h,isMissingClause:l,badgeRef:C,onClick:e=>{e.stopPropagation(),B&&B(e,pe||{id:"orphan-left",title:"",content:""},h,ge||{id:"orphan-right",title:"",content:""},u,O)},onSummaryClick:e=>{e.stopPropagation(),N(e,u,h,T)}}}).filter(Boolean),je=A||X?Ne:[],De=Ne.map(e=>e.highlight).filter(Boolean),Be=c.id&&g===v?.columnKey?v:null,ke=u.default.useRef(!1);return t.useEffect(()=>{I||(ke.current=!1)},[I]),e.jsxs(n.Box,{ref:h,sx:{mb:x,width:"100%",display:"flex",flexDirection:"column",position:"relative",minWidth:0},children:[I&&Be?.showAbove&&e.jsx("div",{style:{position:"sticky",top:0,height:"0px",cursor:"pointer"},onClick:()=>Be?.showAboveRef?.current?.scrollIntoView({behavior:"smooth",block:"center"}),children:e.jsx("div",{style:{transform:`translateY(-50%) translateX(calc(100% ${"left"===g?"+":"-"} 130px))`,position:"absolute",paddingTop:"20px",..."left"===g?{right:"-20px"}:{left:"-20px"}},children:e.jsx(i.ChevronUp,{color:Be?.showAboveRef?.current?window.getComputedStyle(Be.showAboveRef.current).color:void 0})})}),e.jsxs(n.Accordion,{disableGutters:!0,expanded:!oe&&I,onChange:()=>{oe||(m(),R.current=c.id)},sx:{boxShadow:"none",border:oe?"1px dashed #E2E8F0":"1px solid #E2E8F0",bgcolor:oe?"#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:[e.jsx(n.AccordionSummary,{expandIcon:oe?null:e.jsx(i.ChevronDown,{size:16}),sx:{minHeight:"36px",flexShrink:0,cursor:oe?"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:K&&e.jsx(n.Tooltip,{title:se,placement:"top",children:e.jsx(n.Typography,{component:"div",sx:{fontSize:"12px",color:oe?"#94A3B8":"#19213D",fontWeight:oe?400:700,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0},children:f(le,re)})})}),!oe&&e.jsxs(n.AccordionDetails,{sx:{pt:0,pb:1.25,bgcolor:"#FFFFFF",flex:1,display:"flex",flexDirection:"column",minWidth:0},children:[ie&&e.jsx(o.MemoizedMarkdown,{content:ee,overlayContent:te,fallbackContent:ne,sxStyles:S,highlights:De,maintainRelativeOrder:b,highlightBg:Re,suppressHighlightBg:Y,deviationBadges:je,collisionKey:L}),(c.subsections||[]).map((e,t)=>_({section:e,keyPath:`${p}-${t}`,depth:0,columnKey:g,parentNodeId:y,sectionOffset:he,rhsOrphanVisualIndexes:_e}))]})]}),I&&Be?.showBelow&&e.jsx("div",{style:{position:"sticky",bottom:0,height:"0px",cursor:"pointer"},onClick:()=>Be?.showBelowRef?.current?.scrollIntoView({behavior:"smooth",block:"center"}),children:e.jsx("div",{style:{transform:`translateY(-50%) translateX(calc(100% ${"left"===g?"+":"-"} 130px))`,position:"absolute",paddingBottom:"20px",..."left"===g?{right:"-20px"}:{left:"-20px"}},children:e.jsx(i.ChevronDown,{color:Be?.showBelowRef?.current?window.getComputedStyle(Be.showBelowRef.current).color:void 0})})})]},`${g}-sec-${p}`)};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),n=require("@mui/material"),i=require("lucide-react"),o=require("../hooks/memoizedMarkdown.js"),s=require("../CompareContext.js"),r=require("../CognitiveComparehelpers.js"),l=require("../CognitiveCompareConstants.js");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=d(t);const c=(t,n=!1)=>{if(!t)return null;return r.safeStringify(t).replace(/\\n/g,"\n").split(/(\*\*.*?\*\*)/g).map((t,i)=>t.startsWith("**")&&t.endsWith("**")?e.jsx("strong",{children:t.slice(2,-2)},i):e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"8px",width:"100%"},children:[e.jsx("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t}),n&&e.jsx("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"})]},i))};exports.default=({section:d,idx:u,columnKey:f,colRef:p,mb:g=1,isExpanded:h,onToggle:x,navigation:I,parentNodeId:m=""})=>{const{showOpenNodeRef:v,resolvedMarkdownStyles:y,maintainRelativeOrder:S,showDeviationBadges:b=!1,renderSubSectionAccordion:A,treeData:R,proposedSections:_,existingSections:E,deviationNumberRegistry:w,deviationParentRegistry:M,getBadgeRef:O,openSummaryPopup:N,getSectionCompareStyle:$,connectedSections:T,openMoreFunctionsPopup:D,isProposingFix:j,proposingFixNodeId:B,isRedlineFlow:C,isSideBySide:F,activeSideBySideSection:k,scrollSyncLocked:P,unifiedNumbering:V,toggleScrollSyncLocked:G,summaryPopupAnchorEl:W}=s.useCompareContext(),L=`${F?"1":"0"}-${String(k??"")}`,q=(d.displayTitle??!0)&&r.hasValue(d.title),z=!(!j||!B||"left"!==f||d.id!==B&&d.nodeId!==B),K=r.hasMeaningfulRedlineTags(d.content),X="boolean"==typeof C?C:K,H=K,U=X&&K,Y=U?r.stripRedlineTags(d.content):d.content,J=U?d.content:void 0,Q=((d.displayContent??!0)||K)&&r.hasValue(d.content),Z=!q&&!Q;let ee=d.title;q||(ee=Q?"No Title Found":"No Matching Section Found");const te="left"===f&&(d.isMultipleMapping||(d.refContentIds?.length??1)>1),ne="left"===f&&ee.length>29?`${ee.slice(0,29).trimEnd()}...`:ee;let ie=d.evaluationResult;if(!ie&&"right"===f)if(S){const e=d.refIndexes?.[0],t=_.find(t=>t.selfIndex===e);ie=t?.evaluationResult}else ie=_[u]?.evaluationResult;const oe=R?.input_index_map?.[0],se=R?.input_index_map?.[1],re="left"===f?se:oe,le=(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=le(n.subsections,t);if(e)return e}}return null};let de="left"===f?d:le(_,d.id),ae="right"===f?d:le(E,d.id);const ce=a.default.useMemo(()=>{if(!S)return 0;let e=1/0;const t=e=>{const t=r.hasMeaningfulRedlineTags(e)?r.stripRedlineTags(e):e;return r.safeStringify(t||"").replace(/\\n/g,"\n")},n=(i,o,s,l)=>{if(!i)return;let d=i.nodeId||i.id;if(l&&"right"===f){const e=_.filter(e=>e.refIndexes?.includes(i.selfIndex));e.length>0&&(d=e[0].nodeId||e[0].id)}let a=i.nodeId||i.id||o?.nodeId||o?.id||s?.nodeId||s?.id;const c=i.evaluationResult||o?.evaluationResult||s?.evaluationResult,u=c?.deviations||{};Object.keys(u).forEach(n=>{const l=u[n]?.[m];if(!((e,n)=>{if("string"!=typeof n||r.isMissingStr(n))return!1;const i=t(e?.content),o=t(n);return!!o&&i.includes(o)})("left"===f?o||i:s||i,l))return;const c=`${d}${r.DEVIATION_BADGE_SEPARATOR}${n}`,p=w?.[c];null!=p&&p<e&&(e=p);const g=`${a}${r.DEVIATION_BADGE_SEPARATOR}${n}`,h=w?.[g];null!=h&&h<e&&(e=h)});const p=i.subsections||[],g=o?.subsections||[],h=s?.subsections||[],x=Math.max(p.length,g.length,h.length);for(let e=0;e<x;e++)n(p[e],g[e],h[e],!1)},i="right"===f?_.filter(e=>e.refIndexes?.includes(d.selfIndex)):[];if(1===i.length){const e=i[0];(e.refIndexes||[]).map(e=>E.find(t=>t.selfIndex===e)).filter(Boolean).forEach(t=>{n(t,e,t,!0)})}else n(d,de,ae,!0);return e!==1/0?e-1:0},[d,de,ae,f,m,w,S,_,E]);if(S)if("left"===f){const e=d.refIndexes?.[0],t=E.findIndex(t=>t.selfIndex===e);ae=-1!==t?E[t]:le(E,d.id)}else{const e=d.refIndexes?.[0],t=_.findIndex(t=>t.selfIndex===e);de=-1!==t?_[t]:le(_,d.id)}const ue="left"===f?!ae:!de,fe=S&&"right"===f&&r.hasSingleMappedLhsSection(d,_),pe=ie||de?.evaluationResult||ae?.evaluationResult,ge=pe?.evaluation_outputs?.metadata?.label_color??l.DEFAULT_DEVIAION_COLOR,he=r.generateColorPalette(ge),{highlightBg:xe}=he,Ie=pe?.deviations||{},me=a.default.useMemo(()=>S&&"right"===f?r.getLhsDeviationDisplayIndexes(_,oe,w):new Map,[S,f,_,oe,w]);let ve=d.nodeId||d.id;if(S&&"left"!==f){const e=_.filter(e=>e.refIndexes?.includes(d.selfIndex));e.length>0?ve=e[0].nodeId||e[0].id:de?.id&&(ve=de.nodeId||de.id)}const ye=a.default.useMemo(()=>{const e=new Map;if(!S||"right"!==f)return e;let t=1;const n=_.filter(e=>e.refIndexes?.includes(d.selfIndex)),i=1===n.length&&1===n[0].refIndexes?.length,o=e=>r.safeStringify(e||"").replace(/\\n/g,"\n"),s=(e,t)=>{const i=t?n[0]:le(_,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:l,evalResult:d,registryNodeId:a}=s(n,i),c=o(n.content);Object.entries(d?.deviations||{}).forEach(([e,n])=>{const i=n[m],s=o(i);if(!(!!l&&!r.isMissingStr(n[re]))||!s||!c.includes(s))return;const d=`${a}${r.DEVIATION_BADGE_SEPARATOR}${e}`,u=w[d];null!=u&&(t=Math.max(t,Math.max(1,u-(ce||0))+1))}),(n.subsections||[]).forEach(t=>e(t))};e(d,!0)}const l=(n,i=!1)=>{if(!n)return;const{lhsNode:d,evalResult:a,registryNodeId:c}=s(n,i),u=a?.deviations||{},f=o(n.content);Object.entries(u).map(([e,t])=>{const n=t[m],i=!d||r.isMissingStr(t[re]),s=o(n),l=s?f.indexOf(s):-1,a=`${c}${r.DEVIATION_BADGE_SEPARATOR}${e}`;return{refId:a,isRenderable:i&&!!s&&!r.isMissingStr(n),position:l,registryIndex:w[a]??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=>l(e))};return l(d,!0),e},[S,f,d,_,m,re,w,ce]),Se=Object.keys(Ie)[0],be=Se?`${ve}${r.DEVIATION_BADGE_SEPARATOR}${Se}`:null,Ae=be?M?.[be]:null;let Re=u+1;if(S&&V){const e="left"===f?V.leftNums.get(d?.id):V.rightNums.get(d?.id);ue&&void 0!==e?Re=e:null!=Ae&&Ae>=0?Re=Ae:void 0!==e&&(Re=e)}else null!=Ae&&Ae>=0&&(Re=Ae);const _e=Object.entries(Ie).map(([e,t])=>{const n=`${ve}${r.DEVIATION_BADGE_SEPARATOR}${e}`;return{deviationKey:e,deviationMap:t,refId:n,currentIndex:w[n]}}).filter(e=>void 0!==e.currentIndex&&null!==e.currentIndex);_e.sort((e,t)=>e.currentIndex-t.currentIndex);const Ee=_e.map(e=>{const{deviationKey:t,deviationMap:n,refId:i}=e;let o=e.currentIndex,s=n[m];const l=r.isMissingStr(s);if(l)s="";else if(!s)return null;let a=u,c=u;if(S)if("left"===f){const e=d.refIndexes?.[0],t=E.findIndex(t=>t.selfIndex===e);if(-1!==t)c=t;else{const e=E.findIndex(e=>e.id===d.id||e.nodeId===d.nodeId||e.contentId===d.contentId);c=-1!==e?e:u}}else{const e=d.refIndexes?.[0],t=_.findIndex(t=>t.selfIndex===e);if(-1!==t)a=t;else{const e=_.findIndex(e=>e.id===d.id||e.nodeId===d.nodeId||e.contentId===d.contentId);a=-1!==e?e:u}}const p=`${ve}${r.DEVIATION_BADGE_SEPARATOR}${t}${r.DEVIATION_BADGE_SEPARATOR}${a}${r.DEVIATION_BADGE_SEPARATOR}${c}`,g=n[re],h=ue||r.isMissingStr(g),x=ye.get(i),I=me.get(i);S&&"right"===f&&h&&void 0!==x?o=x:S&&"right"===f&&!h&&void 0!==I?o=I:S&&void 0!==ce&&("right"!==f||h||fe)&&(o-=ce),o=Math.max(1,o);const v=`${S&&"right"===f&&h&&V?r.getRhsMappedSectionNumber({section:d,proposedSections:_,leftNums:V.leftNums,fallbackNumber:String(Re),firstOnly:!0}):Re}.${o}`;let y=u;if("right"===f&&S){const e=d.refIndexes?.[0],t=_.findIndex(t=>t.selfIndex===e);if(-1!==t)y=t;else{const e=_.findIndex(e=>e.id===d.id||e.nodeId===d.nodeId||e.contentId===d.contentId);-1!==e&&(y=e)}}const b=$?$(y):null,A=n?.evaluation_outputs||pe?.evaluation_outputs,R=A?.output_value??null,w=A?.metadata?.label_color??ge,M=r.generateColorPalette(w);let j=b?{...b,badgeBg:M.badgeBg,badgeBorder:M.badgeBorder,badgeText:M.badgeText}:{...M};const B=n?.deviation_summary?{deviation_summary:n.deviation_summary,deviation_title:n?.deviation_title||pe?.deviation_title,deviation_impact:n?.deviation_impact||pe?.deviation_impact,deviation_explanation:n?.deviation_explanation||pe?.deviation_explanation,evaluation_outputs:A,cognitive_decisioning:n?.cognitive_decisioning||pe?.cognitive_decisioning}:null;let C=0;const L=Y||"";if(s&&L){const e=L.split(/\n{2,}/),n=e.findIndex(e=>e.includes(s));if(-1!==n){const i=Object.entries(Ie).filter(([t,i])=>{const o=i[m];return o&&e[n].includes(o)}).sort((t,i)=>e[n].indexOf(t[1][m])-e[n].indexOf(i[1][m])).filter(([e,t])=>{const n=t[m];return n&&(n.includes(s)||s.includes(n))});i.length>1&&(C=Math.max(0,i.findIndex(([e])=>e===t)))}}const q=O(f,i);return{id:i,actionId:p,label:v,highlight:s,side:f,style:j,stackIndex:C,score:R,isConnected:T?.has(p),showScrollLockToggle:T?.has(p)||F&&k===p||!!W&&W===q.current,scrollSyncLocked:P,toggleScrollSyncLocked:G,isOrphan:h,isMissingClause:l,badgeRef:q,onClick:e=>{e.stopPropagation(),D&&D(e,de||{id:"orphan-left",title:"",content:""},h,ae||{id:"orphan-right",title:"",content:""},p,j)},onSummaryClick:e=>{e.stopPropagation(),N(e,p,h,B)}}}).filter(Boolean),we=b||!X&&z?Ee:[],Me=Ee.map(e=>e.highlight).filter(Boolean),Oe=d.id&&f===I?.columnKey?I:null,Ne=a.default.useRef(!1);return t.useEffect(()=>{h||(Ne.current=!1)},[h]),e.jsxs(n.Box,{ref:p,sx:{mb:g,width:"100%",display:"flex",flexDirection:"column",position:"relative",minWidth:0},children:[h&&Oe?.showAbove&&e.jsx("div",{style:{position:"sticky",top:0,height:"0px",cursor:"pointer"},onClick:()=>Oe?.showAboveRef?.current?.scrollIntoView({behavior:"smooth",block:"center"}),children:e.jsx("div",{style:{transform:`translateY(-50%) translateX(calc(100% ${"left"===f?"+":"-"} 130px))`,position:"absolute",paddingTop:"20px",..."left"===f?{right:"-20px"}:{left:"-20px"}},children:e.jsx(i.ChevronUp,{color:Oe?.showAboveRef?.current?window.getComputedStyle(Oe.showAboveRef.current).color:void 0})})}),e.jsxs(n.Accordion,{disableGutters:!0,expanded:!Z&&h,onChange:()=>{Z||(x(),v.current=d.id)},sx:{boxShadow:"none",border:Z?"1px dashed #E2E8F0":"1px solid #E2E8F0",bgcolor:Z?"#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:[e.jsx(n.AccordionSummary,{expandIcon:Z?null:e.jsx(i.ChevronDown,{size:16}),sx:{minHeight:"36px",flexShrink:0,cursor:Z?"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:q&&e.jsx(n.Tooltip,{title:ee,placement:"top",children:e.jsx(n.Typography,{component:"div",sx:{fontSize:"12px",color:Z?"#94A3B8":"#19213D",fontWeight:Z?400:700,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0},children:c(ne,te)})})}),!Z&&e.jsxs(n.AccordionDetails,{sx:{pt:0,pb:1.25,bgcolor:"#FFFFFF",flex:1,display:"flex",flexDirection:"column",minWidth:0},children:[Q&&e.jsx(o.MemoizedMarkdown,{content:Y,overlayContent:J,sxStyles:y,highlights:Me,maintainRelativeOrder:S,highlightBg:xe,suppressHighlightBg:H,deviationBadges:we,collisionKey:L}),(d.subsections||[]).map((e,t)=>A({section:e,keyPath:`${u}-${t}`,depth:0,columnKey:f,parentNodeId:m,sectionOffset:ce,rhsOrphanVisualIndexes:ye}))]})]}),h&&Oe?.showBelow&&e.jsx("div",{style:{position:"sticky",bottom:0,height:"0px",cursor:"pointer"},onClick:()=>Oe?.showBelowRef?.current?.scrollIntoView({behavior:"smooth",block:"center"}),children:e.jsx("div",{style:{transform:`translateY(-50%) translateX(calc(100% ${"left"===f?"+":"-"} 130px))`,position:"absolute",paddingBottom:"20px",..."left"===f?{right:"-20px"}:{left:"-20px"}},children:e.jsx(i.ChevronDown,{color:Oe?.showBelowRef?.current?window.getComputedStyle(Oe.showBelowRef.current).color:void 0})})})]},`${f}-sec-${u}`)};
|
|
2
2
|
//# sourceMappingURL=SectionAccordion.js.map
|