@viswa-test/test-citation 0.0.213 → 0.0.214
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/components/SectionAccordion.js +1 -1
- package/dist/features/CognitiveCompare/components/SectionAccordion.js +1 -1
- package/dist/types/src/CommonConstants/CommonConstants.d.ts +2916 -2068
- package/dist/types/src/CommonConstants/CommonConstants.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),i=require("react"),o=require("@mui/material"),t=require("lucide-react"),l=require("../hooks/memoizedMarkdown.js"),r=require("../CompareContext.js"),d=require("../CognitiveComparehelpers.js"),a=require("../CognitiveCompareConstants.js");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=s(i);exports.default=function(s){var c,v,f,p,x,g,h,m,_,I,y,b,A,S=s.section,R=s.idx,w=s.columnKey,E=s.colRef,O=s.mb,B=void 0===O?1:O,j=s.isExpanded,C=s.onToggle,T=s.navigation,D=s.parentNodeId,F=void 0===D?"":D,k=r.useCompareContext(),M=k.showOpenNodeRef,P=k.resolvedMarkdownStyles,N=k.maintainRelativeOrder,V=k.showDeviationBadges,W=void 0!==V&&V,q=k.renderSubSectionAccordion,G=k.treeData,L=k.proposedSections,K=k.existingSections,z=k.deviationNumberRegistry,H=k.deviationParentRegistry,U=k.getBadgeRef,X=k.openSummaryPopup,Y=k.getSectionCompareStyle,J=k.connectedSections,Q=k.openMoreFunctionsPopup,Z=k.isProposingFix,$=k.proposingFixNodeId,ee=k.isRedlineFlow,ne=k.isSideBySide,ie=k.activeSideBySideSection,oe=k.scrollSyncLocked,te=k.toggleScrollSyncLocked,le=k.summaryPopupAnchorEl,re="".concat(ne?"1":"0","-").concat(String(null!=ie?ie:"")),de=(null===(c=S.displayTitle)||void 0===c||c)&&d.hasValue(S.title),ae=!!Z&&!!$&&"left"===w&&S.id===$,se=d.hasMeaningfulRedlineTags(S.content),ue="boolean"==typeof ee?ee:se,ce=se,ve=ue&&se,fe=ve?d.stripRedlineTags(S.content):S.content,pe=ve?S.content:void 0,xe=(null===(v=S.displayContent)||void 0===v||v||se)&&d.hasValue(S.content),ge=!de&&!xe,he=S.title;de||(he=xe?"No Title Found":"No Matching Section Found");var me=S.evaluationResult;if(!me&&"right"===w)if(N){var _e=null===(f=S.refIndexes)||void 0===f?void 0:f[0],Ie=L.find(function(e){return e.selfIndex===_e});me=null==Ie?void 0:Ie.evaluationResult}else me=null===(p=L[R])||void 0===p?void 0:p.evaluationResult;var ye=null===(x=null==G?void 0:G.input_index_map)||void 0===x?void 0:x[0],be=null===(g=null==G?void 0:G.input_index_map)||void 0===g?void 0:g[1],Ae="left"===w?be:ye,Se=function(e,n){var i;if(!n||!e)return null;for(var o=0,t=e;o<t.length;o++){var l=t[o];if(l.id===n)return l;if(null===(i=l.subsections)||void 0===i?void 0:i.length){var r=Se(l.subsections,n);if(r)return r}}return null},Re="left"===w?S:Se(L,S.id),we="right"===w?S:Se(K,S.id),Ee=u.default.useMemo(function(){if(!N)return 0;var e=1/0,n=function(i,o,t,l){var r;if(i){var a=i.id;if(l&&"right"===w){var s=L.filter(function(e){var n;return null===(n=e.refIndexes)||void 0===n?void 0:n.includes(i.selfIndex)});s.length>0&&(a=s[0].id)}var u=i.id||(null==o?void 0:o.id)||(null==t?void 0:t.id),c=(null===(r=i.evaluationResult)||void 0===r?void 0:r.deviations)||{};Object.keys(c).forEach(function(n){var i="".concat(a).concat(d.DEVIATION_BADGE_SEPARATOR).concat(n),o=null==z?void 0:z[i];null!=o&&o<e&&(e=o);var t="".concat(u).concat(d.DEVIATION_BADGE_SEPARATOR).concat(n),l=null==z?void 0:z[t];null!=l&&l<e&&(e=l)});for(var v=i.subsections||[],f=(null==o?void 0:o.subsections)||[],p=(null==t?void 0:t.subsections)||[],x=Math.max(v.length,f.length,p.length),g=0;g<x;g++)n(v[g],f[g],p[g],!1)}};return n(S,Re,we,!0),e!==1/0?e-1:0},[S,Re,we,w,z,N,L]);if(N)if("left"===w){var Oe=null===(h=S.refIndexes)||void 0===h?void 0:h[0],Be=K.findIndex(function(e){return e.selfIndex===Oe});we=-1!==Be?K[Be]:Se(K,S.id)}else{var je=null===(m=S.refIndexes)||void 0===m?void 0:m[0],Ce=L.findIndex(function(e){return e.selfIndex===je});Re=-1!==Ce?L[Ce]:Se(L,S.id)}var Te="left"===w?!we:!Re,De=me||(null==Re?void 0:Re.evaluationResult)||(null==we?void 0:we.evaluationResult),Fe=null!==(y=null===(I=null===(_=null==De?void 0:De.evaluation_outputs)||void 0===_?void 0:_.metadata)||void 0===I?void 0:I.label_color)&&void 0!==y?y:a.DEFAULT_DEVIAION_COLOR,ke=d.generateColorPalette(Fe).highlightBg,Me=(null==De?void 0:De.deviations)||{},Pe=S.id;if(N&&"left"!==w){var Ne=L.filter(function(e){var n;return null===(n=e.refIndexes)||void 0===n?void 0:n.includes(S.selfIndex)});Ne.length>0?Pe=Ne[0].id:(null==Re?void 0:Re.id)&&(Pe=Re.id)}var Ve=Object.keys(Me)[0],We=Ve?"".concat(Pe).concat(d.DEVIATION_BADGE_SEPARATOR).concat(Ve):null,qe=We?null==H?void 0:H[We]:null,Ge=null!=qe?qe:R+1;if(null==qe&&N)if("left"===w)Ge=void 0!==S.selfIndex&&S.selfIndex>=0?S.selfIndex+1:R+1;else{Ne=L.filter(function(e){var n;return null===(n=e.refIndexes)||void 0===n?void 0:n.includes(S.selfIndex)});Ge=Ne.length>0?void 0!==Ne[0].selfIndex&&Ne[0].selfIndex>=0?Ne[0].selfIndex+1:R+1:void 0!==S.selfIndex&&S.selfIndex>=0?S.selfIndex+1:R+1}var Le=Object.entries(Me).map(function(e){var n=e[0],i=e[1],o="".concat(Pe).concat(d.DEVIATION_BADGE_SEPARATOR).concat(n);return{deviationKey:n,deviationMap:i,refId:o,currentIndex:z[o]}}).filter(function(e){return void 0!==e.currentIndex&&null!==e.currentIndex});Le.sort(function(e,n){return e.currentIndex-n.currentIndex});var Ke,ze=Le.map(function(n){var i,o,t,l,r,a,s=n.deviationKey,u=n.deviationMap,c=n.refId,v=n.currentIndex;N&&void 0!==Ee&&(v-=Ee);var f=u[F],p=d.isMissingStr(f);if(p)f="";else if(!f)return null;var x=R,g=R;if(N)if("left"===w){var h=null===(i=S.refIndexes)||void 0===i?void 0:i[0],m=K.findIndex(function(e){return e.selfIndex===h});if(-1!==m)g=m;else{var _=K.findIndex(function(e){return e.id===S.id});g=-1!==_?_:R}}else{var I=null===(o=S.refIndexes)||void 0===o?void 0:o[0],y=L.findIndex(function(e){return e.selfIndex===I});if(-1!==y)x=y;else x=-1!==(j=L.findIndex(function(e){return e.id===S.id}))?j:R}var b="".concat(Pe).concat(d.DEVIATION_BADGE_SEPARATOR).concat(s).concat(d.DEVIATION_BADGE_SEPARATOR).concat(x).concat(d.DEVIATION_BADGE_SEPARATOR).concat(g),A=u[Ae],E=Te||d.isMissingStr(A),O="".concat(Ge,".").concat(v),B=R;if("right"===w&&N){var j,C=null===(t=S.refIndexes)||void 0===t?void 0:t[0],T=L.findIndex(function(e){return e.selfIndex===C});if(-1!==T)B=T;else-1!==(j=L.findIndex(function(e){return e.id===S.id}))&&(B=j)}var D=Y?Y(B):null,k=(null==u?void 0:u.evaluation_outputs)||(null==De?void 0:De.evaluation_outputs),M=null!==(l=null==k?void 0:k.output_value)&&void 0!==l?l:null,P=null!==(a=null===(r=null==k?void 0:k.metadata)||void 0===r?void 0:r.label_color)&&void 0!==a?a:Fe,V=d.generateColorPalette(P),W=D?e.__assign(e.__assign({},D),{badgeBg:V.badgeBg,badgeBorder:V.badgeBorder,badgeText:V.badgeText}):e.__assign({},V),q=(null==u?void 0:u.deviation_summary)?{deviation_summary:u.deviation_summary,deviation_title:(null==u?void 0:u.deviation_title)||(null==De?void 0:De.deviation_title),deviation_impact:(null==u?void 0:u.deviation_impact)||(null==De?void 0:De.deviation_impact),deviation_explanation:(null==u?void 0:u.deviation_explanation)||(null==De?void 0:De.deviation_explanation),evaluation_outputs:k,cognitive_decisioning:(null==u?void 0:u.cognitive_decisioning)||(null==De?void 0:De.cognitive_decisioning)}:null,G=0,z=fe||"";if(f&&z){var H=z.split(/\n{2,}/),Z=H.findIndex(function(e){return e.includes(f)});if(-1!==Z){var $=Object.entries(Me).filter(function(e){e[0];var n=e[1][F];return n&&H[Z].includes(n)}).sort(function(e,n){return H[Z].indexOf(e[1][F])-H[Z].indexOf(n[1][F])}),ee=$.filter(function(e){e[0];var n=e[1][F];return n&&(n.includes(f)||f.includes(n))});ee.length>1&&(G=Math.max(0,ee.findIndex(function(e){return e[0]===s})))}}var re=U(w,c);return{id:c,actionId:b,label:O,highlight:f,side:w,style:W,stackIndex:G,score:M,isConnected:null==J?void 0:J.has(b),showScrollLockToggle:(null==J?void 0:J.has(b))||ne&&ie===b||!!le&&le===re.current,scrollSyncLocked:oe,toggleScrollSyncLocked:te,isOrphan:E,isMissingClause:p,badgeRef:re,onClick:function(e){e.stopPropagation(),Q&&Q(e,Re||{id:"orphan-left",title:"",content:""},E,we||{id:"orphan-right",title:"",content:""},b,W)},onSummaryClick:function(e){e.stopPropagation(),X(e,b,E,q)}}}).filter(Boolean),He=W||!ue&&ae?ze:[],Ue=ze.map(function(e){return e.highlight}).filter(Boolean),Xe=S.id&&w===(null==T?void 0:T.columnKey)?T:null,Ye=u.default.useRef(!1);return i.useEffect(function(){j||(Ye.current=!1)},[j]),n.jsxs(o.Box,e.__assign({ref:E,sx:{mb:B,width:"100%",display:"flex",flexDirection:"column",position:"relative",minWidth:0}},{children:[j&&(null==Xe?void 0:Xe.showAbove)&&n.jsx("div",e.__assign({style:{position:"sticky",top:0,height:"0px",cursor:"pointer"},onClick:function(){var e,n;return null===(n=null===(e=null==Xe?void 0:Xe.showAboveRef)||void 0===e?void 0:e.current)||void 0===n?void 0:n.scrollIntoView({behavior:"smooth",block:"center"})}},{children:n.jsx("div",e.__assign({style:e.__assign({transform:"translateY(-50%) translateX(calc(100% ".concat("left"===w?"+":"-"," 130px))"),position:"absolute",paddingTop:"20px"},"left"===w?{right:"0px"}:{left:"0px"})},{children:n.jsx(t.ChevronUp,{color:(null===(b=null==Xe?void 0:Xe.showAboveRef)||void 0===b?void 0:b.current)?window.getComputedStyle(Xe.showAboveRef.current).color:void 0})}))})),n.jsxs(o.Accordion,e.__assign({disableGutters:!0,expanded:!ge&&j,onChange:function(){ge||(C(),M.current=S.id)},sx:{boxShadow:"none",border:ge?"1px dashed #E2E8F0":"1px solid #E2E8F0",bgcolor:ge?"#FAFAFA":"#FFFFFF",borderRadius:"6px",flexGrow:1,width:"100%",display:"flex",flexDirection:"column",minWidth:0,"&:before":{display:"none"},"& .MuiAccordion-heading":{position:"sticky",top:-12,zIndex:10,background:"#fff"}}},{children:[n.jsx(o.AccordionSummary,e.__assign({expandIcon:ge?null:n.jsx(t.ChevronDown,{size:16}),sx:{minHeight:"36px",flexShrink:0,cursor:ge?"default":"pointer","& .MuiAccordionSummary-content":{my:.5,display:"grid",alignItems:"center",minWidth:0,width:"100%"},"& .MuiAccordionSummary-expandIconWrapper":{transition:"transform 0.2s ease"},"& .MuiAccordionSummary-expandIconWrapper.Mui-expanded":{transform:"rotate(180deg)"}}},{children:de&&n.jsx(o.Tooltip,e.__assign({title:he,placement:"top"},{children:n.jsx(o.Typography,e.__assign({component:"div",sx:{fontSize:"12px",color:ge?"#94A3B8":"#19213D",fontWeight:ge?400:700,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0}},{children:(Ke=he,Ke?d.safeStringify(Ke).replace(/\\n/g,"\n").split(/(\*\*.*?\*\*)/g).map(function(e,i){return e.startsWith("**")&&e.endsWith("**")?n.jsx("strong",{children:e.slice(2,-2)},i):n.jsx(u.default.Fragment,{children:e},i)}):null)}))}))})),!ge&&n.jsxs(o.AccordionDetails,e.__assign({sx:{pt:0,pb:1.25,bgcolor:"#FFFFFF",flex:1,display:"flex",flexDirection:"column",minWidth:0}},{children:[xe&&n.jsx(l.MemoizedMarkdown,{content:fe,overlayContent:pe,sxStyles:P,highlights:Ue,maintainRelativeOrder:N,highlightBg:ke,suppressHighlightBg:ce,deviationBadges:He,collisionKey:re}),(S.subsections||[]).map(function(e,n){return q({section:e,keyPath:"".concat(R,"-").concat(n),depth:0,columnKey:w,parentNodeId:F,sectionOffset:Ee})})]}))]})),j&&(null==Xe?void 0:Xe.showBelow)&&n.jsx("div",e.__assign({style:{position:"sticky",bottom:0,height:"0px",cursor:"pointer"},onClick:function(){var e,n;return null===(n=null===(e=null==Xe?void 0:Xe.showBelowRef)||void 0===e?void 0:e.current)||void 0===n?void 0:n.scrollIntoView({behavior:"smooth",block:"center"})}},{children:n.jsx("div",e.__assign({style:e.__assign({transform:"translateY(-50%) translateX(calc(100% ".concat("left"===w?"+":"-"," 130px))"),position:"absolute",paddingBottom:"20px"},"left"===w?{right:"0px"}:{left:"0px"})},{children:n.jsx(t.ChevronDown,{color:(null===(A=null==Xe?void 0:Xe.showBelowRef)||void 0===A?void 0:A.current)?window.getComputedStyle(Xe.showBelowRef.current).color:void 0})}))}))]}),"".concat(w,"-sec-").concat(R))};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),i=require("react"),o=require("@mui/material"),t=require("lucide-react"),l=require("../hooks/memoizedMarkdown.js"),r=require("../CompareContext.js"),d=require("../CognitiveComparehelpers.js"),a=require("../CognitiveCompareConstants.js");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=s(i);exports.default=function(s){var c,v,f,p,x,g,h,m,_,I,y,b,A,S=s.section,R=s.idx,w=s.columnKey,E=s.colRef,O=s.mb,B=void 0===O?1:O,j=s.isExpanded,C=s.onToggle,T=s.navigation,D=s.parentNodeId,F=void 0===D?"":D,k=r.useCompareContext(),M=k.showOpenNodeRef,P=k.resolvedMarkdownStyles,N=k.maintainRelativeOrder,V=k.showDeviationBadges,W=void 0!==V&&V,q=k.renderSubSectionAccordion,G=k.treeData,L=k.proposedSections,K=k.existingSections,z=k.deviationNumberRegistry,H=k.deviationParentRegistry,U=k.getBadgeRef,X=k.openSummaryPopup,Y=k.getSectionCompareStyle,J=k.connectedSections,Q=k.openMoreFunctionsPopup,Z=k.isProposingFix,$=k.proposingFixNodeId,ee=k.isRedlineFlow,ne=k.isSideBySide,ie=k.activeSideBySideSection,oe=k.scrollSyncLocked,te=k.toggleScrollSyncLocked,le=k.summaryPopupAnchorEl,re="".concat(ne?"1":"0","-").concat(String(null!=ie?ie:"")),de=(null===(c=S.displayTitle)||void 0===c||c)&&d.hasValue(S.title),ae=!!Z&&!!$&&"left"===w&&S.id===$,se=d.hasMeaningfulRedlineTags(S.content),ue="boolean"==typeof ee?ee:se,ce=se,ve=ue&&se,fe=ve?d.stripRedlineTags(S.content):S.content,pe=ve?S.content:void 0,xe=(null===(v=S.displayContent)||void 0===v||v||se)&&d.hasValue(S.content),ge=!de&&!xe,he=S.title;de||(he=xe?"No Title Found":"No Matching Section Found");var me=S.evaluationResult;if(!me&&"right"===w)if(N){var _e=null===(f=S.refIndexes)||void 0===f?void 0:f[0],Ie=L.find(function(e){return e.selfIndex===_e});me=null==Ie?void 0:Ie.evaluationResult}else me=null===(p=L[R])||void 0===p?void 0:p.evaluationResult;var ye=null===(x=null==G?void 0:G.input_index_map)||void 0===x?void 0:x[0],be=null===(g=null==G?void 0:G.input_index_map)||void 0===g?void 0:g[1],Ae="left"===w?be:ye,Se=function(e,n){var i;if(!n||!e)return null;for(var o=0,t=e;o<t.length;o++){var l=t[o];if(l.id===n)return l;if(null===(i=l.subsections)||void 0===i?void 0:i.length){var r=Se(l.subsections,n);if(r)return r}}return null},Re="left"===w?S:Se(L,S.id),we="right"===w?S:Se(K,S.id),Ee=u.default.useMemo(function(){if(!N)return 0;var e=1/0,n=function(i,o,t,l){var r;if(i){var a=i.id;if(l&&"right"===w){var s=L.filter(function(e){var n;return null===(n=e.refIndexes)||void 0===n?void 0:n.includes(i.selfIndex)});s.length>0&&(a=s[0].id)}var u=i.id||(null==o?void 0:o.id)||(null==t?void 0:t.id),c=(null===(r=i.evaluationResult)||void 0===r?void 0:r.deviations)||{};Object.keys(c).forEach(function(n){var i="".concat(a).concat(d.DEVIATION_BADGE_SEPARATOR).concat(n),o=null==z?void 0:z[i];null!=o&&o<e&&(e=o);var t="".concat(u).concat(d.DEVIATION_BADGE_SEPARATOR).concat(n),l=null==z?void 0:z[t];null!=l&&l<e&&(e=l)});for(var v=i.subsections||[],f=(null==o?void 0:o.subsections)||[],p=(null==t?void 0:t.subsections)||[],x=Math.max(v.length,f.length,p.length),g=0;g<x;g++)n(v[g],f[g],p[g],!1)}};return n(S,Re,we,!0),e!==1/0?e-1:0},[S,Re,we,w,z,N,L]);if(N)if("left"===w){var Oe=null===(h=S.refIndexes)||void 0===h?void 0:h[0],Be=K.findIndex(function(e){return e.selfIndex===Oe});we=-1!==Be?K[Be]:Se(K,S.id)}else{var je=null===(m=S.refIndexes)||void 0===m?void 0:m[0],Ce=L.findIndex(function(e){return e.selfIndex===je});Re=-1!==Ce?L[Ce]:Se(L,S.id)}var Te="left"===w?!we:!Re,De=me||(null==Re?void 0:Re.evaluationResult)||(null==we?void 0:we.evaluationResult),Fe=null!==(y=null===(I=null===(_=null==De?void 0:De.evaluation_outputs)||void 0===_?void 0:_.metadata)||void 0===I?void 0:I.label_color)&&void 0!==y?y:a.DEFAULT_DEVIAION_COLOR,ke=d.generateColorPalette(Fe).highlightBg,Me=(null==De?void 0:De.deviations)||{},Pe=S.id;if(N&&"left"!==w){var Ne=L.filter(function(e){var n;return null===(n=e.refIndexes)||void 0===n?void 0:n.includes(S.selfIndex)});Ne.length>0?Pe=Ne[0].id:(null==Re?void 0:Re.id)&&(Pe=Re.id)}var Ve=Object.keys(Me)[0],We=Ve?"".concat(Pe).concat(d.DEVIATION_BADGE_SEPARATOR).concat(Ve):null,qe=We?null==H?void 0:H[We]:null,Ge=null!=qe?qe:R+1;if(null==qe&&N)if("left"===w)Ge=void 0!==S.selfIndex&&S.selfIndex>=0?S.selfIndex+1:R+1;else{Ne=L.filter(function(e){var n;return null===(n=e.refIndexes)||void 0===n?void 0:n.includes(S.selfIndex)});Ge=Ne.length>0?void 0!==Ne[0].selfIndex&&Ne[0].selfIndex>=0?Ne[0].selfIndex+1:R+1:void 0!==S.selfIndex&&S.selfIndex>=0?S.selfIndex+1:R+1}var Le=Object.entries(Me).map(function(e){var n=e[0],i=e[1],o="".concat(Pe).concat(d.DEVIATION_BADGE_SEPARATOR).concat(n);return{deviationKey:n,deviationMap:i,refId:o,currentIndex:z[o]}}).filter(function(e){return void 0!==e.currentIndex&&null!==e.currentIndex});Le.sort(function(e,n){return e.currentIndex-n.currentIndex});var Ke,ze=Le.map(function(n){var i,o,t,l,r,a,s=n.deviationKey,u=n.deviationMap,c=n.refId,v=n.currentIndex;N&&void 0!==Ee&&(v-=Ee);var f=u[F],p=d.isMissingStr(f);if(p)f="";else if(!f)return null;var x=R,g=R;if(N)if("left"===w){var h=null===(i=S.refIndexes)||void 0===i?void 0:i[0],m=K.findIndex(function(e){return e.selfIndex===h});if(-1!==m)g=m;else{var _=K.findIndex(function(e){return e.id===S.id});g=-1!==_?_:R}}else{var I=null===(o=S.refIndexes)||void 0===o?void 0:o[0],y=L.findIndex(function(e){return e.selfIndex===I});if(-1!==y)x=y;else x=-1!==(j=L.findIndex(function(e){return e.id===S.id}))?j:R}var b="".concat(Pe).concat(d.DEVIATION_BADGE_SEPARATOR).concat(s).concat(d.DEVIATION_BADGE_SEPARATOR).concat(x).concat(d.DEVIATION_BADGE_SEPARATOR).concat(g),A=u[Ae],E=Te||d.isMissingStr(A),O="".concat(Ge,".").concat(v),B=R;if("right"===w&&N){var j,C=null===(t=S.refIndexes)||void 0===t?void 0:t[0],T=L.findIndex(function(e){return e.selfIndex===C});if(-1!==T)B=T;else-1!==(j=L.findIndex(function(e){return e.id===S.id}))&&(B=j)}var D=Y?Y(B):null,k=(null==u?void 0:u.evaluation_outputs)||(null==De?void 0:De.evaluation_outputs),M=null!==(l=null==k?void 0:k.output_value)&&void 0!==l?l:null,P=null!==(a=null===(r=null==k?void 0:k.metadata)||void 0===r?void 0:r.label_color)&&void 0!==a?a:Fe,V=d.generateColorPalette(P),W=D?e.__assign(e.__assign({},D),{badgeBg:V.badgeBg,badgeBorder:V.badgeBorder,badgeText:V.badgeText}):e.__assign({},V),q=(null==u?void 0:u.deviation_summary)?{deviation_summary:u.deviation_summary,deviation_title:(null==u?void 0:u.deviation_title)||(null==De?void 0:De.deviation_title),deviation_impact:(null==u?void 0:u.deviation_impact)||(null==De?void 0:De.deviation_impact),deviation_explanation:(null==u?void 0:u.deviation_explanation)||(null==De?void 0:De.deviation_explanation),evaluation_outputs:k,cognitive_decisioning:(null==u?void 0:u.cognitive_decisioning)||(null==De?void 0:De.cognitive_decisioning)}:null,G=0,z=fe||"";if(f&&z){var H=z.split(/\n{2,}/),Z=H.findIndex(function(e){return e.includes(f)});if(-1!==Z){var $=Object.entries(Me).filter(function(e){e[0];var n=e[1][F];return n&&H[Z].includes(n)}).sort(function(e,n){return H[Z].indexOf(e[1][F])-H[Z].indexOf(n[1][F])}),ee=$.filter(function(e){e[0];var n=e[1][F];return n&&(n.includes(f)||f.includes(n))});ee.length>1&&(G=Math.max(0,ee.findIndex(function(e){return e[0]===s})))}}var re=U(w,c);return{id:c,actionId:b,label:O,highlight:f,side:w,style:W,stackIndex:G,score:M,isConnected:null==J?void 0:J.has(b),showScrollLockToggle:(null==J?void 0:J.has(b))||ne&&ie===b||!!le&&le===re.current,scrollSyncLocked:oe,toggleScrollSyncLocked:te,isOrphan:E,isMissingClause:p,badgeRef:re,onClick:function(e){e.stopPropagation(),Q&&Q(e,Re||{id:"orphan-left",title:"",content:""},E,we||{id:"orphan-right",title:"",content:""},b,W)},onSummaryClick:function(e){e.stopPropagation(),X(e,b,E,q)}}}).filter(Boolean),He=W||!ue&&ae?ze:[],Ue=ze.map(function(e){return e.highlight}).filter(Boolean),Xe=S.id&&w===(null==T?void 0:T.columnKey)?T:null,Ye=u.default.useRef(!1);return i.useEffect(function(){j||(Ye.current=!1)},[j]),n.jsxs(o.Box,e.__assign({ref:E,sx:{mb:B,width:"100%",display:"flex",flexDirection:"column",position:"relative",minWidth:0}},{children:[j&&(null==Xe?void 0:Xe.showAbove)&&n.jsx("div",e.__assign({style:{position:"sticky",top:0,height:"0px",cursor:"pointer"},onClick:function(){var e,n;return null===(n=null===(e=null==Xe?void 0:Xe.showAboveRef)||void 0===e?void 0:e.current)||void 0===n?void 0:n.scrollIntoView({behavior:"smooth",block:"center"})}},{children:n.jsx("div",e.__assign({style:e.__assign({transform:"translateY(-50%) translateX(calc(100% ".concat("left"===w?"+":"-"," 130px))"),position:"absolute",paddingTop:"20px"},"left"===w?{right:"-20px"}:{left:"-20px"})},{children:n.jsx(t.ChevronUp,{color:(null===(b=null==Xe?void 0:Xe.showAboveRef)||void 0===b?void 0:b.current)?window.getComputedStyle(Xe.showAboveRef.current).color:void 0})}))})),n.jsxs(o.Accordion,e.__assign({disableGutters:!0,expanded:!ge&&j,onChange:function(){ge||(C(),M.current=S.id)},sx:{boxShadow:"none",border:ge?"1px dashed #E2E8F0":"1px solid #E2E8F0",bgcolor:ge?"#FAFAFA":"#FFFFFF",borderRadius:"6px",flexGrow:1,width:"100%",display:"flex",flexDirection:"column",minWidth:0,"&:before":{display:"none"},"& .MuiAccordion-heading":{position:"sticky",top:-12,zIndex:10,background:"#fff"}}},{children:[n.jsx(o.AccordionSummary,e.__assign({expandIcon:ge?null:n.jsx(t.ChevronDown,{size:16}),sx:{minHeight:"36px",flexShrink:0,cursor:ge?"default":"pointer","& .MuiAccordionSummary-content":{my:.5,display:"grid",alignItems:"center",minWidth:0,width:"100%"},"& .MuiAccordionSummary-expandIconWrapper":{transition:"transform 0.2s ease"},"& .MuiAccordionSummary-expandIconWrapper.Mui-expanded":{transform:"rotate(180deg)"}}},{children:de&&n.jsx(o.Tooltip,e.__assign({title:he,placement:"top"},{children:n.jsx(o.Typography,e.__assign({component:"div",sx:{fontSize:"12px",color:ge?"#94A3B8":"#19213D",fontWeight:ge?400:700,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0}},{children:(Ke=he,Ke?d.safeStringify(Ke).replace(/\\n/g,"\n").split(/(\*\*.*?\*\*)/g).map(function(e,i){return e.startsWith("**")&&e.endsWith("**")?n.jsx("strong",{children:e.slice(2,-2)},i):n.jsx(u.default.Fragment,{children:e},i)}):null)}))}))})),!ge&&n.jsxs(o.AccordionDetails,e.__assign({sx:{pt:0,pb:1.25,bgcolor:"#FFFFFF",flex:1,display:"flex",flexDirection:"column",minWidth:0}},{children:[xe&&n.jsx(l.MemoizedMarkdown,{content:fe,overlayContent:pe,sxStyles:P,highlights:Ue,maintainRelativeOrder:N,highlightBg:ke,suppressHighlightBg:ce,deviationBadges:He,collisionKey:re}),(S.subsections||[]).map(function(e,n){return q({section:e,keyPath:"".concat(R,"-").concat(n),depth:0,columnKey:w,parentNodeId:F,sectionOffset:Ee})})]}))]})),j&&(null==Xe?void 0:Xe.showBelow)&&n.jsx("div",e.__assign({style:{position:"sticky",bottom:0,height:"0px",cursor:"pointer"},onClick:function(){var e,n;return null===(n=null===(e=null==Xe?void 0:Xe.showBelowRef)||void 0===e?void 0:e.current)||void 0===n?void 0:n.scrollIntoView({behavior:"smooth",block:"center"})}},{children:n.jsx("div",e.__assign({style:e.__assign({transform:"translateY(-50%) translateX(calc(100% ".concat("left"===w?"+":"-"," 130px))"),position:"absolute",paddingBottom:"20px"},"left"===w?{right:"-20px"}:{left:"-20px"})},{children:n.jsx(t.ChevronDown,{color:(null===(A=null==Xe?void 0:Xe.showBelowRef)||void 0===A?void 0:A.current)?window.getComputedStyle(Xe.showBelowRef.current).color:void 0})}))}))]}),"".concat(w,"-sec-").concat(R))};
|
|
2
2
|
//# sourceMappingURL=SectionAccordion.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as n}from"tslib";import{jsxs as e,jsx as i}from"react/jsx-runtime";import o,{useEffect as t}from"react";import{Box as l,Accordion as d,AccordionSummary as r,Tooltip as a,Typography as c,AccordionDetails as u}from"@mui/material";import{ChevronUp as s,ChevronDown as v}from"lucide-react";import{MemoizedMarkdown as f}from"../hooks/memoizedMarkdown.js";import{useCompareContext as p}from"../CompareContext.js";import{hasValue as x,hasMeaningfulRedlineTags as h,stripRedlineTags as g,generateColorPalette as m,isMissingStr as I,safeStringify as y,DEVIATION_BADGE_SEPARATOR as b}from"../CognitiveComparehelpers.js";import{DEFAULT_DEVIAION_COLOR as w}from"../CognitiveCompareConstants.js";var S=function(S){var _,F,k,R,B,C,M,A,O,W,j,P,E,N=S.section,T=S.idx,D=S.columnKey,K=S.colRef,L=S.mb,z=void 0===L?1:L,G=S.isExpanded,H=S.onToggle,V=S.navigation,X=S.parentNodeId,Y=void 0===X?"":X,q=p(),J=q.showOpenNodeRef,Q=q.resolvedMarkdownStyles,U=q.maintainRelativeOrder,Z=q.showDeviationBadges,$=void 0!==Z&&Z,nn=q.renderSubSectionAccordion,en=q.treeData,on=q.proposedSections,tn=q.existingSections,ln=q.deviationNumberRegistry,dn=q.deviationParentRegistry,rn=q.getBadgeRef,an=q.openSummaryPopup,cn=q.getSectionCompareStyle,un=q.connectedSections,sn=q.openMoreFunctionsPopup,vn=q.isProposingFix,fn=q.proposingFixNodeId,pn=q.isRedlineFlow,xn=q.isSideBySide,hn=q.activeSideBySideSection,gn=q.scrollSyncLocked,mn=q.toggleScrollSyncLocked,In=q.summaryPopupAnchorEl,yn="".concat(xn?"1":"0","-").concat(String(null!=hn?hn:"")),bn=(null===(_=N.displayTitle)||void 0===_||_)&&x(N.title),wn=!!vn&&!!fn&&"left"===D&&N.id===fn,Sn=h(N.content),_n="boolean"==typeof pn?pn:Sn,Fn=Sn,kn=_n&&Sn,Rn=kn?g(N.content):N.content,Bn=kn?N.content:void 0,Cn=(null===(F=N.displayContent)||void 0===F||F||Sn)&&x(N.content),Mn=!bn&&!Cn,An=N.title;bn||(An=Cn?"No Title Found":"No Matching Section Found");var On=N.evaluationResult;if(!On&&"right"===D)if(U){var Wn=null===(k=N.refIndexes)||void 0===k?void 0:k[0],jn=on.find(function(n){return n.selfIndex===Wn});On=null==jn?void 0:jn.evaluationResult}else On=null===(R=on[T])||void 0===R?void 0:R.evaluationResult;var Pn=null===(B=null==en?void 0:en.input_index_map)||void 0===B?void 0:B[0],En=null===(C=null==en?void 0:en.input_index_map)||void 0===C?void 0:C[1],Nn="left"===D?En:Pn,Tn=function(n,e){var i;if(!e||!n)return null;for(var o=0,t=n;o<t.length;o++){var l=t[o];if(l.id===e)return l;if(null===(i=l.subsections)||void 0===i?void 0:i.length){var d=Tn(l.subsections,e);if(d)return d}}return null},Dn="left"===D?N:Tn(on,N.id),Kn="right"===D?N:Tn(tn,N.id),Ln=o.useMemo(function(){if(!U)return 0;var n=1/0,e=function(i,o,t,l){var d;if(i){var r=i.id;if(l&&"right"===D){var a=on.filter(function(n){var e;return null===(e=n.refIndexes)||void 0===e?void 0:e.includes(i.selfIndex)});a.length>0&&(r=a[0].id)}var c=i.id||(null==o?void 0:o.id)||(null==t?void 0:t.id),u=(null===(d=i.evaluationResult)||void 0===d?void 0:d.deviations)||{};Object.keys(u).forEach(function(e){var i="".concat(r).concat(b).concat(e),o=null==ln?void 0:ln[i];null!=o&&o<n&&(n=o);var t="".concat(c).concat(b).concat(e),l=null==ln?void 0:ln[t];null!=l&&l<n&&(n=l)});for(var s=i.subsections||[],v=(null==o?void 0:o.subsections)||[],f=(null==t?void 0:t.subsections)||[],p=Math.max(s.length,v.length,f.length),x=0;x<p;x++)e(s[x],v[x],f[x],!1)}};return e(N,Dn,Kn,!0),n!==1/0?n-1:0},[N,Dn,Kn,D,ln,U,on]);if(U)if("left"===D){var zn=null===(M=N.refIndexes)||void 0===M?void 0:M[0],Gn=tn.findIndex(function(n){return n.selfIndex===zn});Kn=-1!==Gn?tn[Gn]:Tn(tn,N.id)}else{var Hn=null===(A=N.refIndexes)||void 0===A?void 0:A[0],Vn=on.findIndex(function(n){return n.selfIndex===Hn});Dn=-1!==Vn?on[Vn]:Tn(on,N.id)}var Xn="left"===D?!Kn:!Dn,Yn=On||(null==Dn?void 0:Dn.evaluationResult)||(null==Kn?void 0:Kn.evaluationResult),qn=null!==(j=null===(W=null===(O=null==Yn?void 0:Yn.evaluation_outputs)||void 0===O?void 0:O.metadata)||void 0===W?void 0:W.label_color)&&void 0!==j?j:w,Jn=m(qn).highlightBg,Qn=(null==Yn?void 0:Yn.deviations)||{},Un=N.id;if(U&&"left"!==D){var Zn=on.filter(function(n){var e;return null===(e=n.refIndexes)||void 0===e?void 0:e.includes(N.selfIndex)});Zn.length>0?Un=Zn[0].id:(null==Dn?void 0:Dn.id)&&(Un=Dn.id)}var $n=Object.keys(Qn)[0],ne=$n?"".concat(Un).concat(b).concat($n):null,ee=ne?null==dn?void 0:dn[ne]:null,ie=null!=ee?ee:T+1;if(null==ee&&U)if("left"===D)ie=void 0!==N.selfIndex&&N.selfIndex>=0?N.selfIndex+1:T+1;else{Zn=on.filter(function(n){var e;return null===(e=n.refIndexes)||void 0===e?void 0:e.includes(N.selfIndex)});ie=Zn.length>0?void 0!==Zn[0].selfIndex&&Zn[0].selfIndex>=0?Zn[0].selfIndex+1:T+1:void 0!==N.selfIndex&&N.selfIndex>=0?N.selfIndex+1:T+1}var oe=Object.entries(Qn).map(function(n){var e=n[0],i=n[1],o="".concat(Un).concat(b).concat(e);return{deviationKey:e,deviationMap:i,refId:o,currentIndex:ln[o]}}).filter(function(n){return void 0!==n.currentIndex&&null!==n.currentIndex});oe.sort(function(n,e){return n.currentIndex-e.currentIndex});var te,le=oe.map(function(e){var i,o,t,l,d,r,a=e.deviationKey,c=e.deviationMap,u=e.refId,s=e.currentIndex;U&&void 0!==Ln&&(s-=Ln);var v=c[Y],f=I(v);if(f)v="";else if(!v)return null;var p=T,x=T;if(U)if("left"===D){var h=null===(i=N.refIndexes)||void 0===i?void 0:i[0],g=tn.findIndex(function(n){return n.selfIndex===h});if(-1!==g)x=g;else{var y=tn.findIndex(function(n){return n.id===N.id});x=-1!==y?y:T}}else{var w=null===(o=N.refIndexes)||void 0===o?void 0:o[0],S=on.findIndex(function(n){return n.selfIndex===w});if(-1!==S)p=S;else p=-1!==(C=on.findIndex(function(n){return n.id===N.id}))?C:T}var _="".concat(Un).concat(b).concat(a).concat(b).concat(p).concat(b).concat(x),F=c[Nn],k=Xn||I(F),R="".concat(ie,".").concat(s),B=T;if("right"===D&&U){var C,M=null===(t=N.refIndexes)||void 0===t?void 0:t[0],A=on.findIndex(function(n){return n.selfIndex===M});if(-1!==A)B=A;else-1!==(C=on.findIndex(function(n){return n.id===N.id}))&&(B=C)}var O=cn?cn(B):null,W=(null==c?void 0:c.evaluation_outputs)||(null==Yn?void 0:Yn.evaluation_outputs),j=null!==(l=null==W?void 0:W.output_value)&&void 0!==l?l:null,P=null!==(r=null===(d=null==W?void 0:W.metadata)||void 0===d?void 0:d.label_color)&&void 0!==r?r:qn,E=m(P),K=O?n(n({},O),{badgeBg:E.badgeBg,badgeBorder:E.badgeBorder,badgeText:E.badgeText}):n({},E),L=(null==c?void 0:c.deviation_summary)?{deviation_summary:c.deviation_summary,deviation_title:(null==c?void 0:c.deviation_title)||(null==Yn?void 0:Yn.deviation_title),deviation_impact:(null==c?void 0:c.deviation_impact)||(null==Yn?void 0:Yn.deviation_impact),deviation_explanation:(null==c?void 0:c.deviation_explanation)||(null==Yn?void 0:Yn.deviation_explanation),evaluation_outputs:W,cognitive_decisioning:(null==c?void 0:c.cognitive_decisioning)||(null==Yn?void 0:Yn.cognitive_decisioning)}:null,z=0,G=Rn||"";if(v&&G){var H=G.split(/\n{2,}/),V=H.findIndex(function(n){return n.includes(v)});if(-1!==V){var X=Object.entries(Qn).filter(function(n){n[0];var e=n[1][Y];return e&&H[V].includes(e)}).sort(function(n,e){return H[V].indexOf(n[1][Y])-H[V].indexOf(e[1][Y])}),q=X.filter(function(n){n[0];var e=n[1][Y];return e&&(e.includes(v)||v.includes(e))});q.length>1&&(z=Math.max(0,q.findIndex(function(n){return n[0]===a})))}}var J=rn(D,u);return{id:u,actionId:_,label:R,highlight:v,side:D,style:K,stackIndex:z,score:j,isConnected:null==un?void 0:un.has(_),showScrollLockToggle:(null==un?void 0:un.has(_))||xn&&hn===_||!!In&&In===J.current,scrollSyncLocked:gn,toggleScrollSyncLocked:mn,isOrphan:k,isMissingClause:f,badgeRef:J,onClick:function(n){n.stopPropagation(),sn&&sn(n,Dn||{id:"orphan-left",title:"",content:""},k,Kn||{id:"orphan-right",title:"",content:""},_,K)},onSummaryClick:function(n){n.stopPropagation(),an(n,_,k,L)}}}).filter(Boolean),de=$||!_n&&wn?le:[],re=le.map(function(n){return n.highlight}).filter(Boolean),ae=N.id&&D===(null==V?void 0:V.columnKey)?V:null,ce=o.useRef(!1);return t(function(){G||(ce.current=!1)},[G]),e(l,n({ref:K,sx:{mb:z,width:"100%",display:"flex",flexDirection:"column",position:"relative",minWidth:0}},{children:[G&&(null==ae?void 0:ae.showAbove)&&i("div",n({style:{position:"sticky",top:0,height:"0px",cursor:"pointer"},onClick:function(){var n,e;return null===(e=null===(n=null==ae?void 0:ae.showAboveRef)||void 0===n?void 0:n.current)||void 0===e?void 0:e.scrollIntoView({behavior:"smooth",block:"center"})}},{children:i("div",n({style:n({transform:"translateY(-50%) translateX(calc(100% ".concat("left"===D?"+":"-"," 130px))"),position:"absolute",paddingTop:"20px"},"left"===D?{right:"0px"}:{left:"0px"})},{children:i(s,{color:(null===(P=null==ae?void 0:ae.showAboveRef)||void 0===P?void 0:P.current)?window.getComputedStyle(ae.showAboveRef.current).color:void 0})}))})),e(d,n({disableGutters:!0,expanded:!Mn&&G,onChange:function(){Mn||(H(),J.current=N.id)},sx:{boxShadow:"none",border:Mn?"1px dashed #E2E8F0":"1px solid #E2E8F0",bgcolor:Mn?"#FAFAFA":"#FFFFFF",borderRadius:"6px",flexGrow:1,width:"100%",display:"flex",flexDirection:"column",minWidth:0,"&:before":{display:"none"},"& .MuiAccordion-heading":{position:"sticky",top:-12,zIndex:10,background:"#fff"}}},{children:[i(r,n({expandIcon:Mn?null:i(v,{size:16}),sx:{minHeight:"36px",flexShrink:0,cursor:Mn?"default":"pointer","& .MuiAccordionSummary-content":{my:.5,display:"grid",alignItems:"center",minWidth:0,width:"100%"},"& .MuiAccordionSummary-expandIconWrapper":{transition:"transform 0.2s ease"},"& .MuiAccordionSummary-expandIconWrapper.Mui-expanded":{transform:"rotate(180deg)"}}},{children:bn&&i(a,n({title:An,placement:"top"},{children:i(c,n({component:"div",sx:{fontSize:"12px",color:Mn?"#94A3B8":"#19213D",fontWeight:Mn?400:700,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0}},{children:(te=An,te?y(te).replace(/\\n/g,"\n").split(/(\*\*.*?\*\*)/g).map(function(n,e){return n.startsWith("**")&&n.endsWith("**")?i("strong",{children:n.slice(2,-2)},e):i(o.Fragment,{children:n},e)}):null)}))}))})),!Mn&&e(u,n({sx:{pt:0,pb:1.25,bgcolor:"#FFFFFF",flex:1,display:"flex",flexDirection:"column",minWidth:0}},{children:[Cn&&i(f,{content:Rn,overlayContent:Bn,sxStyles:Q,highlights:re,maintainRelativeOrder:U,highlightBg:Jn,suppressHighlightBg:Fn,deviationBadges:de,collisionKey:yn}),(N.subsections||[]).map(function(n,e){return nn({section:n,keyPath:"".concat(T,"-").concat(e),depth:0,columnKey:D,parentNodeId:Y,sectionOffset:Ln})})]}))]})),G&&(null==ae?void 0:ae.showBelow)&&i("div",n({style:{position:"sticky",bottom:0,height:"0px",cursor:"pointer"},onClick:function(){var n,e;return null===(e=null===(n=null==ae?void 0:ae.showBelowRef)||void 0===n?void 0:n.current)||void 0===e?void 0:e.scrollIntoView({behavior:"smooth",block:"center"})}},{children:i("div",n({style:n({transform:"translateY(-50%) translateX(calc(100% ".concat("left"===D?"+":"-"," 130px))"),position:"absolute",paddingBottom:"20px"},"left"===D?{right:"0px"}:{left:"0px"})},{children:i(v,{color:(null===(E=null==ae?void 0:ae.showBelowRef)||void 0===E?void 0:E.current)?window.getComputedStyle(ae.showBelowRef.current).color:void 0})}))}))]}),"".concat(D,"-sec-").concat(T))};export{S as default};
|
|
1
|
+
import{__assign as n}from"tslib";import{jsxs as e,jsx as i}from"react/jsx-runtime";import o,{useEffect as t}from"react";import{Box as l,Accordion as d,AccordionSummary as r,Tooltip as a,Typography as c,AccordionDetails as u}from"@mui/material";import{ChevronUp as s,ChevronDown as v}from"lucide-react";import{MemoizedMarkdown as f}from"../hooks/memoizedMarkdown.js";import{useCompareContext as p}from"../CompareContext.js";import{hasValue as x,hasMeaningfulRedlineTags as h,stripRedlineTags as g,generateColorPalette as m,isMissingStr as I,safeStringify as y,DEVIATION_BADGE_SEPARATOR as b}from"../CognitiveComparehelpers.js";import{DEFAULT_DEVIAION_COLOR as w}from"../CognitiveCompareConstants.js";var S=function(S){var _,F,k,R,B,C,M,A,O,W,j,P,E,N=S.section,T=S.idx,D=S.columnKey,K=S.colRef,L=S.mb,z=void 0===L?1:L,G=S.isExpanded,H=S.onToggle,V=S.navigation,X=S.parentNodeId,Y=void 0===X?"":X,q=p(),J=q.showOpenNodeRef,Q=q.resolvedMarkdownStyles,U=q.maintainRelativeOrder,Z=q.showDeviationBadges,$=void 0!==Z&&Z,nn=q.renderSubSectionAccordion,en=q.treeData,on=q.proposedSections,tn=q.existingSections,ln=q.deviationNumberRegistry,dn=q.deviationParentRegistry,rn=q.getBadgeRef,an=q.openSummaryPopup,cn=q.getSectionCompareStyle,un=q.connectedSections,sn=q.openMoreFunctionsPopup,vn=q.isProposingFix,fn=q.proposingFixNodeId,pn=q.isRedlineFlow,xn=q.isSideBySide,hn=q.activeSideBySideSection,gn=q.scrollSyncLocked,mn=q.toggleScrollSyncLocked,In=q.summaryPopupAnchorEl,yn="".concat(xn?"1":"0","-").concat(String(null!=hn?hn:"")),bn=(null===(_=N.displayTitle)||void 0===_||_)&&x(N.title),wn=!!vn&&!!fn&&"left"===D&&N.id===fn,Sn=h(N.content),_n="boolean"==typeof pn?pn:Sn,Fn=Sn,kn=_n&&Sn,Rn=kn?g(N.content):N.content,Bn=kn?N.content:void 0,Cn=(null===(F=N.displayContent)||void 0===F||F||Sn)&&x(N.content),Mn=!bn&&!Cn,An=N.title;bn||(An=Cn?"No Title Found":"No Matching Section Found");var On=N.evaluationResult;if(!On&&"right"===D)if(U){var Wn=null===(k=N.refIndexes)||void 0===k?void 0:k[0],jn=on.find(function(n){return n.selfIndex===Wn});On=null==jn?void 0:jn.evaluationResult}else On=null===(R=on[T])||void 0===R?void 0:R.evaluationResult;var Pn=null===(B=null==en?void 0:en.input_index_map)||void 0===B?void 0:B[0],En=null===(C=null==en?void 0:en.input_index_map)||void 0===C?void 0:C[1],Nn="left"===D?En:Pn,Tn=function(n,e){var i;if(!e||!n)return null;for(var o=0,t=n;o<t.length;o++){var l=t[o];if(l.id===e)return l;if(null===(i=l.subsections)||void 0===i?void 0:i.length){var d=Tn(l.subsections,e);if(d)return d}}return null},Dn="left"===D?N:Tn(on,N.id),Kn="right"===D?N:Tn(tn,N.id),Ln=o.useMemo(function(){if(!U)return 0;var n=1/0,e=function(i,o,t,l){var d;if(i){var r=i.id;if(l&&"right"===D){var a=on.filter(function(n){var e;return null===(e=n.refIndexes)||void 0===e?void 0:e.includes(i.selfIndex)});a.length>0&&(r=a[0].id)}var c=i.id||(null==o?void 0:o.id)||(null==t?void 0:t.id),u=(null===(d=i.evaluationResult)||void 0===d?void 0:d.deviations)||{};Object.keys(u).forEach(function(e){var i="".concat(r).concat(b).concat(e),o=null==ln?void 0:ln[i];null!=o&&o<n&&(n=o);var t="".concat(c).concat(b).concat(e),l=null==ln?void 0:ln[t];null!=l&&l<n&&(n=l)});for(var s=i.subsections||[],v=(null==o?void 0:o.subsections)||[],f=(null==t?void 0:t.subsections)||[],p=Math.max(s.length,v.length,f.length),x=0;x<p;x++)e(s[x],v[x],f[x],!1)}};return e(N,Dn,Kn,!0),n!==1/0?n-1:0},[N,Dn,Kn,D,ln,U,on]);if(U)if("left"===D){var zn=null===(M=N.refIndexes)||void 0===M?void 0:M[0],Gn=tn.findIndex(function(n){return n.selfIndex===zn});Kn=-1!==Gn?tn[Gn]:Tn(tn,N.id)}else{var Hn=null===(A=N.refIndexes)||void 0===A?void 0:A[0],Vn=on.findIndex(function(n){return n.selfIndex===Hn});Dn=-1!==Vn?on[Vn]:Tn(on,N.id)}var Xn="left"===D?!Kn:!Dn,Yn=On||(null==Dn?void 0:Dn.evaluationResult)||(null==Kn?void 0:Kn.evaluationResult),qn=null!==(j=null===(W=null===(O=null==Yn?void 0:Yn.evaluation_outputs)||void 0===O?void 0:O.metadata)||void 0===W?void 0:W.label_color)&&void 0!==j?j:w,Jn=m(qn).highlightBg,Qn=(null==Yn?void 0:Yn.deviations)||{},Un=N.id;if(U&&"left"!==D){var Zn=on.filter(function(n){var e;return null===(e=n.refIndexes)||void 0===e?void 0:e.includes(N.selfIndex)});Zn.length>0?Un=Zn[0].id:(null==Dn?void 0:Dn.id)&&(Un=Dn.id)}var $n=Object.keys(Qn)[0],ne=$n?"".concat(Un).concat(b).concat($n):null,ee=ne?null==dn?void 0:dn[ne]:null,ie=null!=ee?ee:T+1;if(null==ee&&U)if("left"===D)ie=void 0!==N.selfIndex&&N.selfIndex>=0?N.selfIndex+1:T+1;else{Zn=on.filter(function(n){var e;return null===(e=n.refIndexes)||void 0===e?void 0:e.includes(N.selfIndex)});ie=Zn.length>0?void 0!==Zn[0].selfIndex&&Zn[0].selfIndex>=0?Zn[0].selfIndex+1:T+1:void 0!==N.selfIndex&&N.selfIndex>=0?N.selfIndex+1:T+1}var oe=Object.entries(Qn).map(function(n){var e=n[0],i=n[1],o="".concat(Un).concat(b).concat(e);return{deviationKey:e,deviationMap:i,refId:o,currentIndex:ln[o]}}).filter(function(n){return void 0!==n.currentIndex&&null!==n.currentIndex});oe.sort(function(n,e){return n.currentIndex-e.currentIndex});var te,le=oe.map(function(e){var i,o,t,l,d,r,a=e.deviationKey,c=e.deviationMap,u=e.refId,s=e.currentIndex;U&&void 0!==Ln&&(s-=Ln);var v=c[Y],f=I(v);if(f)v="";else if(!v)return null;var p=T,x=T;if(U)if("left"===D){var h=null===(i=N.refIndexes)||void 0===i?void 0:i[0],g=tn.findIndex(function(n){return n.selfIndex===h});if(-1!==g)x=g;else{var y=tn.findIndex(function(n){return n.id===N.id});x=-1!==y?y:T}}else{var w=null===(o=N.refIndexes)||void 0===o?void 0:o[0],S=on.findIndex(function(n){return n.selfIndex===w});if(-1!==S)p=S;else p=-1!==(C=on.findIndex(function(n){return n.id===N.id}))?C:T}var _="".concat(Un).concat(b).concat(a).concat(b).concat(p).concat(b).concat(x),F=c[Nn],k=Xn||I(F),R="".concat(ie,".").concat(s),B=T;if("right"===D&&U){var C,M=null===(t=N.refIndexes)||void 0===t?void 0:t[0],A=on.findIndex(function(n){return n.selfIndex===M});if(-1!==A)B=A;else-1!==(C=on.findIndex(function(n){return n.id===N.id}))&&(B=C)}var O=cn?cn(B):null,W=(null==c?void 0:c.evaluation_outputs)||(null==Yn?void 0:Yn.evaluation_outputs),j=null!==(l=null==W?void 0:W.output_value)&&void 0!==l?l:null,P=null!==(r=null===(d=null==W?void 0:W.metadata)||void 0===d?void 0:d.label_color)&&void 0!==r?r:qn,E=m(P),K=O?n(n({},O),{badgeBg:E.badgeBg,badgeBorder:E.badgeBorder,badgeText:E.badgeText}):n({},E),L=(null==c?void 0:c.deviation_summary)?{deviation_summary:c.deviation_summary,deviation_title:(null==c?void 0:c.deviation_title)||(null==Yn?void 0:Yn.deviation_title),deviation_impact:(null==c?void 0:c.deviation_impact)||(null==Yn?void 0:Yn.deviation_impact),deviation_explanation:(null==c?void 0:c.deviation_explanation)||(null==Yn?void 0:Yn.deviation_explanation),evaluation_outputs:W,cognitive_decisioning:(null==c?void 0:c.cognitive_decisioning)||(null==Yn?void 0:Yn.cognitive_decisioning)}:null,z=0,G=Rn||"";if(v&&G){var H=G.split(/\n{2,}/),V=H.findIndex(function(n){return n.includes(v)});if(-1!==V){var X=Object.entries(Qn).filter(function(n){n[0];var e=n[1][Y];return e&&H[V].includes(e)}).sort(function(n,e){return H[V].indexOf(n[1][Y])-H[V].indexOf(e[1][Y])}),q=X.filter(function(n){n[0];var e=n[1][Y];return e&&(e.includes(v)||v.includes(e))});q.length>1&&(z=Math.max(0,q.findIndex(function(n){return n[0]===a})))}}var J=rn(D,u);return{id:u,actionId:_,label:R,highlight:v,side:D,style:K,stackIndex:z,score:j,isConnected:null==un?void 0:un.has(_),showScrollLockToggle:(null==un?void 0:un.has(_))||xn&&hn===_||!!In&&In===J.current,scrollSyncLocked:gn,toggleScrollSyncLocked:mn,isOrphan:k,isMissingClause:f,badgeRef:J,onClick:function(n){n.stopPropagation(),sn&&sn(n,Dn||{id:"orphan-left",title:"",content:""},k,Kn||{id:"orphan-right",title:"",content:""},_,K)},onSummaryClick:function(n){n.stopPropagation(),an(n,_,k,L)}}}).filter(Boolean),de=$||!_n&&wn?le:[],re=le.map(function(n){return n.highlight}).filter(Boolean),ae=N.id&&D===(null==V?void 0:V.columnKey)?V:null,ce=o.useRef(!1);return t(function(){G||(ce.current=!1)},[G]),e(l,n({ref:K,sx:{mb:z,width:"100%",display:"flex",flexDirection:"column",position:"relative",minWidth:0}},{children:[G&&(null==ae?void 0:ae.showAbove)&&i("div",n({style:{position:"sticky",top:0,height:"0px",cursor:"pointer"},onClick:function(){var n,e;return null===(e=null===(n=null==ae?void 0:ae.showAboveRef)||void 0===n?void 0:n.current)||void 0===e?void 0:e.scrollIntoView({behavior:"smooth",block:"center"})}},{children:i("div",n({style:n({transform:"translateY(-50%) translateX(calc(100% ".concat("left"===D?"+":"-"," 130px))"),position:"absolute",paddingTop:"20px"},"left"===D?{right:"-20px"}:{left:"-20px"})},{children:i(s,{color:(null===(P=null==ae?void 0:ae.showAboveRef)||void 0===P?void 0:P.current)?window.getComputedStyle(ae.showAboveRef.current).color:void 0})}))})),e(d,n({disableGutters:!0,expanded:!Mn&&G,onChange:function(){Mn||(H(),J.current=N.id)},sx:{boxShadow:"none",border:Mn?"1px dashed #E2E8F0":"1px solid #E2E8F0",bgcolor:Mn?"#FAFAFA":"#FFFFFF",borderRadius:"6px",flexGrow:1,width:"100%",display:"flex",flexDirection:"column",minWidth:0,"&:before":{display:"none"},"& .MuiAccordion-heading":{position:"sticky",top:-12,zIndex:10,background:"#fff"}}},{children:[i(r,n({expandIcon:Mn?null:i(v,{size:16}),sx:{minHeight:"36px",flexShrink:0,cursor:Mn?"default":"pointer","& .MuiAccordionSummary-content":{my:.5,display:"grid",alignItems:"center",minWidth:0,width:"100%"},"& .MuiAccordionSummary-expandIconWrapper":{transition:"transform 0.2s ease"},"& .MuiAccordionSummary-expandIconWrapper.Mui-expanded":{transform:"rotate(180deg)"}}},{children:bn&&i(a,n({title:An,placement:"top"},{children:i(c,n({component:"div",sx:{fontSize:"12px",color:Mn?"#94A3B8":"#19213D",fontWeight:Mn?400:700,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0}},{children:(te=An,te?y(te).replace(/\\n/g,"\n").split(/(\*\*.*?\*\*)/g).map(function(n,e){return n.startsWith("**")&&n.endsWith("**")?i("strong",{children:n.slice(2,-2)},e):i(o.Fragment,{children:n},e)}):null)}))}))})),!Mn&&e(u,n({sx:{pt:0,pb:1.25,bgcolor:"#FFFFFF",flex:1,display:"flex",flexDirection:"column",minWidth:0}},{children:[Cn&&i(f,{content:Rn,overlayContent:Bn,sxStyles:Q,highlights:re,maintainRelativeOrder:U,highlightBg:Jn,suppressHighlightBg:Fn,deviationBadges:de,collisionKey:yn}),(N.subsections||[]).map(function(n,e){return nn({section:n,keyPath:"".concat(T,"-").concat(e),depth:0,columnKey:D,parentNodeId:Y,sectionOffset:Ln})})]}))]})),G&&(null==ae?void 0:ae.showBelow)&&i("div",n({style:{position:"sticky",bottom:0,height:"0px",cursor:"pointer"},onClick:function(){var n,e;return null===(e=null===(n=null==ae?void 0:ae.showBelowRef)||void 0===n?void 0:n.current)||void 0===e?void 0:e.scrollIntoView({behavior:"smooth",block:"center"})}},{children:i("div",n({style:n({transform:"translateY(-50%) translateX(calc(100% ".concat("left"===D?"+":"-"," 130px))"),position:"absolute",paddingBottom:"20px"},"left"===D?{right:"-20px"}:{left:"-20px"})},{children:i(v,{color:(null===(E=null==ae?void 0:ae.showBelowRef)||void 0===E?void 0:E.current)?window.getComputedStyle(ae.showBelowRef.current).color:void 0})}))}))]}),"".concat(D,"-sec-").concat(T))};export{S as default};
|
|
2
2
|
//# sourceMappingURL=SectionAccordion.js.map
|