@viswa-test/test-citation 0.0.49 → 0.0.51
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/CognitiveCompare.js +1 -1
- package/dist/features/CognitiveCompare/CognitiveCompare.js +1 -1
- package/dist/types/src/CommonConstants/CommonConstants.d.ts +1835 -1031
- package/dist/types/src/CommonConstants/CommonConstants.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/CognitiveCompare.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/CognitiveCompareTypes.d.ts +1 -0
- package/dist/types/src/features/CognitiveCompare/CognitiveCompareTypes.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as e,__rest as n,__spreadArray as t}from"tslib";import{jsx as i,jsxs as o,Fragment as r}from"react/jsx-runtime";import l,{useMemo as c,useState as u,useRef as a,useEffect as d,useCallback as s}from"react";import{Box as v,Typography as f,Snackbar as p,Alert as h,FormControlLabel as g,Switch as x,Tooltip as m,Accordion as y,AccordionSummary as b,AccordionDetails as I}from"@mui/material";import{EllipsisVertical as S,ChevronDown as w}from"lucide-react";import{ButtonCognitiveIcon as R}from"../../assests/svg/ButtonCognitiveIcon.js";import C from"./OverlayComponent.js";import _ from"react-markdown";import{safeStringify as F,hasValue as E,generateColorPalette as B,getSideData as T,getRationale as M}from"./CognitiveComparehelpers.js";import{SHARED_MARKDOWN_STYLES as k,DEFAULT_FIELD_CONFIG as A,DEFAULT_COMPARISON_CONFIG as D}from"./CognitiveCompareConfig.js";export{SHARED_MARKDOWN_STYLES}from"./CognitiveCompareConfig.js";import H from"./CognitivePopup.js";import O from"./MoreFunctionsPopup.js";import N from"./LoaderComponent.js";import W from"rehype-raw";var z="::",L=function(e){if(!e)return!0;var n=e.trim().toLowerCase();return n.includes("no equivalent")||"n/a"===n||"na"===n||"none"===n},j=l.memo(function(t){var l=t.content,u=t.sxStyles,a=t.deviationBadges,d=void 0===a?[]:a,s=t.highlights,p=void 0===s?[]:s,h=t.maintainRelativeOrder,g=void 0===h||h,x=t.highlightBg,m=c(function(){return d.reduce(function(n,t){var i;return e(e({},n),((i={})[t.id]=t,i))},{})},[d]),y=c(function(){return{mark:function(n){var t=n.children;return i("span",e({style:{backgroundColor:x,borderRadius:"2px"}},{children:t}))},span:function(t){var l,c,u,a,d,s=t.children,f=n(t,["children"]),p=f["data-badge-id"];if(!p)return i("span",e({},f,{children:s}));var h=m[p];return h?o(v,e({component:"span",sx:{position:"static",display:"inline"}},{children:[s,i(v,e({ref:h.badgeRef,onClick:h.onClick,sx:e(e({position:"absolute",zIndex:30,display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"10px",bgcolor:(null===(l=h.style)||void 0===l?void 0:l.badgeBg)||"#EEF2FF",color:(null===(c=h.style)||void 0===c?void 0:c.badgeText)||V,border:"1px solid ".concat((null===(u=h.style)||void 0===u?void 0:u.badgeBorder)||"#C7D2FE"),borderRadius:"12px",px:1,py:.3,fontWeight:600,cursor:"pointer",whiteSpace:"nowrap",boxShadow:"0 1px 3px rgba(0,0,0,0.07)"},"left"===h.side?{right:"-16px",transform:"translateY(-20%) translateX(calc(100% + 8px))"}:{left:"-16px",transform:"translateY(-20%) translateX(calc(-100% - 8px))"}),h.isConnected&&h.style&&{outline:"2px solid ".concat(h.style.badgeBorder),outlineOffset:"1px"})},{children:o(r,{children:[i(v,e({component:"span",sx:e({fontSize:"10px",fontWeight:700},"left"===h.side?{pr:.5,borderRight:"1px solid ".concat((null===(a=h.style)||void 0===a?void 0:a.badgeBorder)||"#C7D2FE")}:{})},{children:h.label})),"left"===h.side&&o(r,{children:[i(v,e({component:"span",sx:{fontSize:"10px",px:.25}},{children:null!=h.score&&"N/A"!==h.score&&"NA"!==h.score&&0!==h.score?"".concat(h.score):"N/A"===h.score||"NA"===h.score?"N/A":"Same"})),i(S,{size:10,color:(null===(d=h.style)||void 0===d?void 0:d.badgeText)||"#3730A3"})]})]})}))]})):i("span",e({},f,{children:s}))}}},[m,g]),b=c(function(){var e=l||"",n={},t=0;return function(){var i=null==d?void 0:d[0];if(i&&i.highlight){var o=i.highlight.replace(/\\(['’])/g,"$1"),r="__DEV_TOKEN_".concat(t++,"__");n[r]='<span data-badge-id="'.concat(i.id,'"><mark>').concat(o,"</mark></span>"),e=e.replace(o,r)}}(),p.forEach(function(i){if(i){var o=i.replace(/\\(['’])/g,"$1"),r="__HL_TOKEN_".concat(t++,"__");n[r]="<mark>".concat(o,"</mark>"),e=e.split(o).join(r)}}),Object.keys(n).forEach(function(t){e=e.split(t).join(n[t])}),e},[l,d,p]);return i(f,e({component:"div",sx:e(e({},u),{position:"relative",overflow:"visible","& p, & li, & ul, & ol":{position:"static",overflow:"visible"}})},{children:i(_,e({components:y,rehypePlugins:[W]},{children:F(b).replace(/\\n/g,"\n")}))}))},function(e,n){if(e.content!==n.content)return!1;if(e.sxStyles!==n.sxStyles)return!1;if(e.maintainRelativeOrder!==n.maintainRelativeOrder)return!1;var t=e.highlights||[],i=n.highlights||[];if(t.length!==i.length)return!1;for(var o=0;o<t.length;o++)if(t[o]!==i[o])return!1;var r=e.deviationBadges||[],l=n.deviationBadges||[];if(r.length!==l.length)return!1;for(o=0;o<r.length;o++){if(r[o].id!==l[o].id)return!1;if(r[o].label!==l[o].label)return!1;if(r[o].isConnected!==l[o].isConnected)return!1}return!0}),P=function(e,n,t,i,o){void 0===o&&(o=14);var r=e+.5*(t-e),l=i-n;if(Math.abs(l)<3)return"M ".concat(e," ").concat(n," H ").concat(t);var c=l>0?1:-1,u=Math.min(o,Math.abs(l)/2,Math.abs(r-e)/2,Math.abs(t-r)/2);return["M ".concat(e," ").concat(n),"H ".concat(r-u),"Q ".concat(r," ").concat(n," ").concat(r," ").concat(n+c*u),"V ".concat(i-c*u),"Q ".concat(r," ").concat(i," ").concat(r+u," ").concat(i),"H ".concat(t)].join(" ")},Y={id:"",title:""},K={open:!1,sectionTitle:"",refSectionTitle:"",cognitiveData:null,anchorEl:null,sectionAnchorEl:null,badgeStyle:null,sectionIdx:null,isOrphan:!1,docData:null,deviationData:null},V="#3730A3",X=function(e,n,t,i,o){void 0===t&&(t=300);var r=e.style.scrollBehavior;e.style.scrollBehavior="auto";var l=e.scrollTop,c=n-l,u=null,a=function(d){null===u&&(u=d);var s,v=d-u;v<t?(e.scrollTop=(s=v,s/=t,c*(--s*s*s+1)+l),o&&o(),requestAnimationFrame(a)):(e.scrollTop=n,e.style.scrollBehavior=r,o&&o(),i&&i())};requestAnimationFrame(a)},q=function(n){var r,_,W,q,U,$,G,J,Q=n.componentHeaderText,Z=void 0===Q?"Contract Comparison":Q,ee=n.treeData,ne=n.comparisonConfig,te=n.leftColumnTitleText,ie=n.rightColumnTitleText,oe=n.markdownStyles,re=n.displayConfig,le=void 0===re?{isHeaderVisible:!0,isToggleVisible:!0,maintainRelativeOrder:!1}:re,ce=n.popupConfig,ue=n.deviationData,ae=void 0===ue?{}:ue,de=u(le.maintainRelativeOrder),se=de[0],ve=de[1],fe=u(!1),pe=fe[0],he=fe[1],ge=u(!1),xe=ge[0],me=ge[1],ye=u(null),be=ye[0],Ie=ye[1],Se=u(!1),we=Se[0],Re=Se[1],Ce=u(!1),_e=Ce[0],Fe=Ce[1],Ee=a(!1),Be=u(null),Te=Be[0],Me=Be[1],ke=u(new Set),Ae=ke[0],De=ke[1],He=u([]),Oe=He[0],Ne=He[1],We=a(null),ze=a(!1),Le=a(null),je=a({}),Pe=a([]),Ye=a(!1),Ke=a(!1),Ve=a(null),Xe=c(function(){return(null==ee?void 0:ee.cognitive_decisioning)||{}},[ee]),qe=u(null),Ue=qe[0],$e=qe[1],Ge=a(null),Je=u({width:0,height:0}),Qe=Je[0],Ze=Je[1],en=c(function(){return e(e({},k),oe)},[oe]),nn=u({open:!1,sectionTitle:"",refSectionTitle:"",cognitiveData:null,anchorEl:null,isOrphan:!1,sectionAnchorEl:null,badgeStyle:null,sectionIdx:null,docData:null,deviationData:null}),tn=nn[0],on=nn[1],rn=u({open:!1,sectionTitle:"",refSectionTitle:"",cognitiveData:null,anchorEl:null,isOrphan:!1,sectionAnchorEl:null,badgeStyle:null,sectionIdx:null,docData:null,deviationData:null}),ln=rn[0],cn=rn[1],un=a(null),an=a(null),dn=a(null),sn=a(null),vn=a(null),fn=a(null),pn=a(null),hn=a(null),gn=a(!1),xn=a(null);d(function(){xn.current=null},[tn.sectionIdx,tn.open]);var mn=s(function(){$e(null),on(K),Me(null)},[]),yn=s(function(){cn(K)},[]),bn=s(function(){var e;if(tn.anchorEl&&tn.refSectionTitle){var n=tn.anchorEl.getBoundingClientRect(),t=(null===(e=null==Ge?void 0:Ge.current)||void 0===e?void 0:e.offsetHeight)||0,i=Math.min(680,window.innerWidth-24),o=window.innerHeight-n.bottom-12-12,r=n.top-12-12,l=o<t&&r>o;null!==xn.current?!0===xn.current&&(l=r>=t||r>=o):l=!(o>=t||o>=r),xn.current=l;var c=l?r:o,u=Math.min(t||9999,c),a=l?n.top-12-u:n.bottom+12,d=n.left+n.width/2,s=d-i/2,v=Math.max(12,Math.min(s,window.innerWidth-i-12)),f=Math.max(14,Math.min(d-v,i-10-4));$e({top:a,left:v,arrowLeft:f,openAbove:l,maxHeight:c})}},[tn.anchorEl,tn.refSectionTitle]);d(function(){if(tn.open){window.addEventListener("resize",bn);var e=requestAnimationFrame(bn),n=null;return Ge.current&&(n=new ResizeObserver(function(){cancelAnimationFrame(e),e=requestAnimationFrame(bn)})).observe(Ge.current),function(){cancelAnimationFrame(e),window.removeEventListener("resize",bn),n&&n.disconnect()}}},[tn.open,bn]),d(function(){var e=un.current;if(e&&tn.open){var n=function(e){Ge.current&&Ge.current.contains(e.target)||($e(null),mn())};return e.addEventListener("scroll",n,{capture:!0}),window.addEventListener("scroll",n,{capture:!0}),function(){e.removeEventListener("scroll",n,{capture:!0}),window.removeEventListener("scroll",n,{capture:!0})}}},[tn.open,mn]),d(function(){var e=un.current;if(e&&ln.open){var n=function(){yn()};return e.addEventListener("scroll",n,{capture:!0}),window.addEventListener("scroll",n,{capture:!0}),function(){e.removeEventListener("scroll",n,{capture:!0}),window.removeEventListener("scroll",n,{capture:!0})}}},[ln.open,yn]);var In=c(function(){var e,n,t,i,o,r,l;return{fields:null!==(e=null==ne?void 0:ne.fields)&&void 0!==e?e:A,thresholds:{high:null!==(t=null===(n=null==ne?void 0:ne.thresholds)||void 0===n?void 0:n.high)&&void 0!==t?t:D.thresholds.high,medium:null!==(o=null===(i=null==ne?void 0:ne.thresholds)||void 0===i?void 0:i.medium)&&void 0!==o?o:D.thresholds.medium,exact:null!==(l=null===(r=null==ne?void 0:ne.thresholds)||void 0===r?void 0:r.exact)&&void 0!==l?l:D.thresholds.exact}}},[ne]),Sn=c(function(){if(ee&&Object.keys(ee).length>0)try{var n=function(n,i,o){var r,l,c,u;void 0===i&&(i=!1),void 0===o&&(o=null);var a=n.nodes||n,d=[],s=[],v=n.base_root_id,f=n.input_index_map||{0:"left",1:"right"},p=n[v]||a[v];if(!p||!1===p.display_node)return{activeProposed:{title:"No Data",sections:[]},activeVariants:[]};var h=function(t,i){var r,l,c,u=n[t]||a[t];if(!u||!1===u.display_node)return null;var d=T(u,i,f),s=!1!==(null===(r=d.attributes)||void 0===r?void 0:r.display_title),v=!1!==(null===(l=d.attributes)||void 0===l?void 0:l.display_content),p=!!d.title.trim(),g=!!d.content.trim(),x=M(u),m=(null===(c=null==o?void 0:o[t])||void 0===c?void 0:c.evaluation_result)||u.evaluation_result||null,y=[];u.next&&Object.values(u.next).forEach(function(e){var n=a[e];if(n&&!1!==n.display_node){var t=h(e,i);t&&y.push(t)}});var b=!(!p&&!g);return e(e({id:t,title:p?d.title:"",content:g?d.content:"",displayTitle:s,displayContent:v,subsections:y},b?x:{score:void 0,relation:"not_defined"}),{evaluationResult:m})};if(i){var g=function(i,r){var l,c,u,d,s,v,p,h,x,m,y,b,I,S,w,R,C,_,F,E,B;void 0===r&&(r=0);var k=[],A=[];if(!i)return{refSections:k,baseSections:A};var D={},H={},O=-1,N=-1;for(var W in i){var z=i[W],L=n[z]||a[z];if(L&&!1!==L.display_node){var j=M(L),P=(null===(l=null==o?void 0:o[z])||void 0===l?void 0:l.evaluation_result)||L.evaluation_result||null,Y=T(L,"1",f),K=T(L,"0",f),V=!1!==(null===(c=Y.attributes)||void 0===c?void 0:c.display_title)&&Y.title.trim()||!1!==(null===(u=Y.attributes)||void 0===u?void 0:u.display_content)&&Y.content.trim(),X=!1!==(null===(d=K.attributes)||void 0===d?void 0:d.display_title)&&K.title.trim()||!1!==(null===(s=K.attributes)||void 0===s?void 0:s.display_content)&&K.content.trim(),q=Number(null!==(p=null===(v=Y.attributes)||void 0===v?void 0:v.display_index)&&void 0!==p?p:O--),U=Number(null!==(x=null===(h=K.attributes)||void 0===h?void 0:h.display_index)&&void 0!==x?x:N--),$=D[q]||e(e({id:z,title:!1!==(null===(m=Y.attributes)||void 0===m?void 0:m.display_title)?Y.title:"",content:!1!==(null===(y=Y.attributes)||void 0===y?void 0:y.display_content)?Y.content:"",subsections:[]},V?j:{score:void 0,relation:"not_defined"}),{refIndexes:[],selfIndex:q,evaluationResult:P,displayContent:null===(b=Y.attributes)||void 0===b?void 0:b.display_content,displayTitle:null===(I=Y.attributes)||void 0===I?void 0:I.display_title}),G=H[U]||e(e({id:z,title:!1!==(null===(S=K.attributes)||void 0===S?void 0:S.display_title)?K.title:"",content:!1!==(null===(w=K.attributes)||void 0===w?void 0:w.display_content)?K.content:"",subsections:[]},X?j:{score:void 0,relation:"not_defined"}),{refIndexes:[],selfIndex:U,evaluationResult:P,displayContent:null===(R=K.attributes)||void 0===R?void 0:R.display_content,displayTitle:null===(C=K.attributes)||void 0===C?void 0:C.display_title});Number(q)>=0&&Number(U)>=0&&((null===(_=$.refIndexes)||void 0===_?void 0:_.includes(Number(U)))||null===(F=$.refIndexes)||void 0===F||F.push(Number(U)),(null===(E=G.refIndexes)||void 0===E?void 0:E.includes(Number(q)))||null===(B=G.refIndexes)||void 0===B||B.push(Number(q))),D[q]=$,H[U]=G;var J=g(L.next,r+1),Q=J.refSections,Z=J.baseSections;Q.length>0&&($.subsections=t(t([],$.subsections||[],!0),Q,!0)),Z.length>0&&(G.subsections=t(t([],G.subsections||[],!0),Z,!0))}}return k=Object.values(D).map(function(e){return e}),A=Object.values(H).map(function(e){return e}),k.sort(function(e,n){return e.selfIndex<0&&n.selfIndex>=0?1:e.selfIndex>=0&&n.selfIndex<0?-1:e.selfIndex-n.selfIndex}),A.sort(function(e,n){return e.selfIndex<0&&n.selfIndex>=0?1:e.selfIndex>=0&&n.selfIndex<0?-1:e.selfIndex-n.selfIndex}),{refSections:k,baseSections:A}},x=g(p.next),m=x.refSections,y=x.baseSections;s=m,d=y}else p.next&&Object.values(p.next).forEach(function(e){var t=n[e]||a[e];t&&!1!==t.display_node&&(d.push(h(e,"0")||{id:e,title:"",content:"",subsections:[]}),s.push(h(e,"1")||{id:e,title:"",content:"",subsections:[]}))});return{activeProposed:{title:(null===(l=null===(r=p.comparison_inputs)||void 0===r?void 0:r[f[0]])||void 0===l?void 0:l.title)||"Uploaded Contract",description:p.decision_scope_description||"",sections:d},activeVariants:[{id:"tree-variant-1",title:(null===(u=null===(c=p.comparison_inputs)||void 0===c?void 0:c[f[1]])||void 0===u?void 0:u.title)||"Reference Template",similarity:0,sections:s,analysis:{rule_difference_comparison:{summary:{overall_score:0,overall_summary:p.decision_scope_description||""},fields:{}}}}]}}(ee,se,ae);return e(e({},n),{parseError:null})}catch(e){return console.error("Data Transformation Error: ",e),{activeProposed:{},activeVariants:[],parseError:e instanceof Error?e.message:"Unknown Parsing Error"}}return{activeProposed:{},activeVariants:[],parseError:"Tree data is required"}},[JSON.stringify(ee),se,JSON.stringify(ae)]),wn=Sn.activeProposed,Rn=Sn.activeVariants,Cn=Sn.parseError;d(function(){Cn&&Ie("Failed to load comparison: ".concat(Cn))},[Cn]);var _n=u(null),Fn=_n[0];_n[1];var En=u({}),Bn=En[0],Tn=En[1],Mn=u({}),kn=Mn[0],An=Mn[1],Dn=(null==Rn?void 0:Rn[0])||Y,Hn=null===(W=null===(r=null==ee?void 0:ee.documents)||void 0===r?void 0:r[null===(_=null==ee?void 0:ee.input_index_map)||void 0===_?void 0:_[0]])||void 0===W?void 0:W.title,On=null===($=null===(q=null==ee?void 0:ee.documents)||void 0===q?void 0:q[null===(U=null==ee?void 0:ee.input_index_map)||void 0===U?void 0:U[1]])||void 0===$?void 0:$.title,Nn=F(te||Hn||"Uploaded Contract"),Wn=F(ie||On||"Reference Template"),zn=c(function(){return(null==wn?void 0:wn.sections)||[]},[null==wn?void 0:wn.sections]),Ln=c(function(){return Dn.sections||[]},[Dn.sections]),jn=zn.length>0||Ln.length>0,Pn=Dn.analysis,Yn=F(null===(J=null===(G=null==Pn?void 0:Pn.rule_difference_comparison)||void 0===G?void 0:G.summary)||void 0===J?void 0:J.overall_summary),Kn=!!Yn.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),Vn=c(function(){var e,n,t={},i={},o=null===(e=null==ee?void 0:ee.input_index_map)||void 0===e?void 0:e[0],r=null===(n=null==ee?void 0:ee.input_index_map)||void 0===n?void 0:n[1],l=new Map,c=function(e){return e&&e.id?(l.has(e.id)||l.set(e.id,F(e.content||"").replace(/\\n/g,"\n")),l.get(e.id)):""},u=function(e,n,a,d,s){var v,f,p,h,g,x,m,y;e&&!s&&function(e,n,u,a){var d,s=(null===(d=null==e?void 0:e.evaluationResult)||void 0===d?void 0:d.deviations)||{};Object.keys(s).sort().forEach(function(d){var v=s[d];if(v){var f=v[o],p=v[r],h=!1,g=!1;if(!L(f)){var x=f.replace(/\\(['’])/g,"$1").replace(/\\n/g,"\n");if(n&&x){var m=c(n);m.includes(x)&&(h=!0,l.set(n.id,m.replace(x,"__TOKEN__")))}}if(!L(p)){var y=p.replace(/\\(['’])/g,"$1").replace(/\\n/g,"\n");if(u&&y){var b=c(u);b.includes(y)&&(g=!0,l.set(u.id,b.replace(y,"__TOKEN__")))}}if(h||g){var I="".concat(e.id).concat(z).concat(d);void 0===t[I]&&(void 0===i[a]&&(i[a]=1),t[I]=i[a]++)}}})}(e,n,a,d);for(var b=Math.max((null===(v=null==n?void 0:n.subsections)||void 0===v?void 0:v.length)||0,(null===(f=null==a?void 0:a.subsections)||void 0===f?void 0:f.length)||0,(null===(p=null==e?void 0:e.subsections)||void 0===p?void 0:p.length)||0),I=0;I<b;I++)u((null===(h=null==e?void 0:e.subsections)||void 0===h?void 0:h[I])||(null===(g=null==n?void 0:n.subsections)||void 0===g?void 0:g[I])||(null===(x=null==a?void 0:a.subsections)||void 0===x?void 0:x[I]),null===(m=null==n?void 0:n.subsections)||void 0===m?void 0:m[I],null===(y=null==a?void 0:a.subsections)||void 0===y?void 0:y[I],d,!1)};return zn.forEach(function(e,n){var t,i=n+1;se&&void 0!==e.selfIndex&&e.selfIndex>=0&&(i=e.selfIndex+1);var o=null;if(se){var r=null===(t=e.refIndexes)||void 0===t?void 0:t[0];o=Ln.find(function(e){return e.selfIndex===r})}else o=Ln[n];u(e,e,o,i,!0)}),Ln.forEach(function(e,n){var t,i=n+1,o=!1;if(se){var r=null===(t=e.refIndexes)||void 0===t?void 0:t[0],l=zn.find(function(e){return e.selfIndex===r});l&&void 0!==l.selfIndex&&l.selfIndex>=0?i=l.selfIndex+1:(o=!0,void 0!==e.selfIndex&&e.selfIndex>=0&&(i=e.selfIndex+1))}else n>=zn.length&&(o=!0);o&&u(e,null,e,i,!0)}),t},[zn,Ln,se,ee]),Xn=a({}),qn=function(e){return Xn.current[e]||(Xn.current[e]=l.createRef()),Xn.current[e]},Un=s(function(){var e,n,t,i;Re(!1),Ke.current=!1;var o=Ve.current,r=nt.current;if(null!==o)if("string"==typeof o&&o.includes(z)){var l=o.split(z);(c=null===(e=St.current[l[2]])||void 0===e?void 0:e.current)&&(c.style.paddingTop="0px")}else{var c;(c=null===(n=xt.current[o])||void 0===n?void 0:n.current)&&(c.style.paddingTop="0px")}if(null!==r)if("string"==typeof r&&r.includes(z)){l=r.split(z);(u=null===(t=wt.current[l[3]])||void 0===t?void 0:t.current)&&(u.style.paddingTop="0px")}else{var u;(u=null===(i=mt.current[r])||void 0===i?void 0:i.current)&&(u.style.paddingTop="0px")}dt(null),Ve.current=null,nt.current=null,Fe(!1),me(!1),sn.current&&(sn.current.style.height="0px"),vn.current&&(vn.current.style.height="0px"),fn.current&&(fn.current.style.height="0px"),pn.current&&(pn.current.style.height="0px")},[]),$n=s(function(e,n,t,i,o,r){var l,c,u=F(n.id)||F(t.id)||"",a=(u?Xe[u]:null)||n.cognitiveData||t.cognitiveData||{section_id:u,decisioning:[],gap:[],relevance_score:0},d=null!==(c=null===(l=Xn.current[i])||void 0===l?void 0:l.current)&&void 0!==c?c:null;return{open:!0,sectionTitle:n.displayTitle?n.title:"no title",refSectionTitle:n.displayTitle?n.title:"no title",cognitiveData:a,anchorEl:e,sectionAnchorEl:d,badgeStyle:r||null,sectionIdx:i,docData:{documents:null==ee?void 0:ee.documents,input_index_map:null==ee?void 0:ee.input_index_map},deviationData:n.evaluationResult||t.evaluationResult||null,isOrphan:!!o}},[Xe,ee]),Gn=s(function(e){yn(),$e(null),on(e)},[yn]),Jn=function(e,n,t,i,o,r){e.stopPropagation(),ln.open&&ln.sectionIdx===o?yn():(mn(),cn($n(e.currentTarget,n,i,o,t,r)))},Qn=s(function(){null!==ln.sectionIdx&&ln.anchorEl?Gn(e(e({},ln),{open:!0})):yn()},[ln,yn,Gn]),Zn=s(function(){var e=ln.sectionIdx,n=ln.isOrphan;yn(),null!==e&&(n?Ie("No counterpart exists to connect to."):(Ke.current&&Un(),De(function(n){return n.has(e)?new Set:new Set([e])})))},[ln.sectionIdx,yn,Un]),et=a(null),nt=a(null),tt=a(null),it=a(null),ot=a(null),rt=u([]),lt=rt[0],ct=rt[1],ut=u(null),at=ut[0],dt=ut[1];a(null);var st=u(null),vt=st[0],ft=st[1],pt=c(function(){return In.fields.filter(function(e){var n=e.key;return(!jn||"description"!==n)&&(E(null==wn?void 0:wn[n])||E(Dn[n]))})},[wn,Dn,jn,In.fields]),ht=a({}),gt=a({}),xt=a({}),mt=a({}),yt=a({}),bt=a({}),It=a({}),St=a({}),wt=a({});pt.forEach(function(e){for(var n=e.key,t=0;t<Math.max(zn.length,Ln.length);t+=1)xt.current[t]||(xt.current[t]=l.createRef()),mt.current[t]||(mt.current[t]=l.createRef()),yt.current[t]||(yt.current[t]=l.createRef()),bt.current[t]||(bt.current[t]=l.createRef()),It.current[t]||(It.current[t]=l.createRef());ht.current[n]||(ht.current[n]=l.createRef()),gt.current[n]||(gt.current[n]=l.createRef())});for(var Rt=0;Rt<Math.max(zn.length,Ln.length);Rt+=1)xt.current[Rt]||(xt.current[Rt]=l.createRef()),mt.current[Rt]||(mt.current[Rt]=l.createRef()),yt.current[Rt]||(yt.current[Rt]=l.createRef()),bt.current[Rt]||(bt.current[Rt]=l.createRef()),It.current[Rt]||(It.current[Rt]=l.createRef());d(function(){if(Fn){var e=In.fields.find(function(e){return e.analysisKey===Fn||e.key===Fn});if(e){var n=ht.current[e.key]||gt.current[e.key];(null==n?void 0:n.current)&&setTimeout(function(){return n.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[Fn,In.fields]);var Ct=s(function(e){var n,t,i,o,r,l,c,u,a,d=null===(n=null==Pn?void 0:Pn.rule_difference_comparison)||void 0===n?void 0:n.fields;if(!d||!d[e])return{score:0,relation:"",highlightsA:[],highlightsB:[],hasContent:!1};var s=d[e],v=(null==s?void 0:s.relation)||(null===(i=null===(t=null==s?void 0:s.highlights)||void 0===t?void 0:t.ruleA_spans)||void 0===i?void 0:i.length)||(null===(r=null===(o=null==s?void 0:s.highlights)||void 0===o?void 0:o.ruleB_spans)||void 0===r?void 0:r.length)||(null==s?void 0:s.mappings)&&s.mappings.length>0;if(s.mappings){var f=s.mappings[0]||{};return{score:s.score,relation:f.relation||"",highlightsA:(null===(l=f.highlights)||void 0===l?void 0:l.ruleA_spans)||[],highlightsB:(null===(c=f.highlights)||void 0===c?void 0:c.ruleB_spans)||[],hasContent:!!v}}return{score:s.score,relation:s.relation||"",highlightsA:(null===(u=s.highlights)||void 0===u?void 0:u.ruleA_spans)||[],highlightsB:(null===(a=s.highlights)||void 0===a?void 0:a.ruleB_spans)||[],hasContent:!!v}},[Pn]),_t=s(function(n){var t,i,o,r,l,c,u,a=zn[n],d=Ln[n],s=(null==a?void 0:a.relation)&&"not_defined"!==a.relation,v=(null==d?void 0:d.relation)&&"not_defined"!==d.relation;F(null==a?void 0:a.id)||F(null==d?void 0:d.id);var f=!(!(null==a?void 0:a.cognitiveData)&&!(null==d?void 0:d.cognitiveData));if(!s&&!v&&!f)return e(e({},B(V)),{label:"Not Defined"});var p=null!==(i=null!==(t=null==a?void 0:a.evaluationResult)&&void 0!==t?t:null==d?void 0:d.evaluationResult)&&void 0!==i?i:null,h=null===(o=null==p?void 0:p.evaluation_outputs)||void 0===o?void 0:o.output_value,g=null!==(c=null===(l=null===(r=null==p?void 0:p.evaluation_outputs)||void 0===r?void 0:r.metadata)||void 0===l?void 0:l.label_color)&&void 0!==c?c:V;return e(e({},B(g)),null!=p?{label:null!==(u=h)&&void 0!==u?u:""}:{label:"N/A"})},[zn,Ln,Xe,In,Ct]),Ft=s(function(n){for(var t,i,o,r,l,c,u,a,d,s=n.split("-").map(Number),v=zn[s[0]],f=Ln[s[0]],p=1;p<s.length;p++)(null==v?void 0:v.subsections)&&(v=v.subsections[s[p]]),(null==f?void 0:f.subsections)&&(f=f.subsections[s[p]]);if(!v&&!f)return null;var h=(null==v?void 0:v.relation)&&"not_defined"!==v.relation,g=(null==f?void 0:f.relation)&&"not_defined"!==f.relation,x=F(null==v?void 0:v.id)||F(null==f?void 0:f.id)||"",m=!(!(null==v?void 0:v.cognitiveData)&&!(null==f?void 0:f.cognitiveData));if(!h&&!g&&!m)return e(e({},B(V)),{label:"Not Defined"});null!==(i=null!==(t=null==v?void 0:v.cognitiveRelevanceScore)&&void 0!==t?t:null==f?void 0:f.cognitiveRelevanceScore)&&void 0!==i||x&&(null===(o=Xe[x])||void 0===o||o.relevance_score);var y=null!==(l=null!==(r=null==v?void 0:v.evaluationResult)&&void 0!==r?r:null==f?void 0:f.evaluationResult)&&void 0!==l?l:null,b=null===(c=null==y?void 0:y.evaluation_outputs)||void 0===c?void 0:c.output_value,I=null!==(d=null===(a=null===(u=null==y?void 0:y.evaluation_outputs)||void 0===u?void 0:u.metadata)||void 0===a?void 0:a.label_color)&&void 0!==d?d:V;return e(e({},B(I)),null!=y?{label:null!=b?b:""}:{label:"N/A"})},[zn,Ln,Xe,In]),Et=s(function(){var e,n,t,i,o,r,l,c,u,a,d,s,v,f,p,h,g,x,m,y,b,I;if(!gn.current&&!ze.current){gn.current=!0;try{if(!et.current)return;var S=function(e){var n=e.split("-"),t=n[0];if(!Bn[t]&&!1===se)return!1;if(se&&!Bn["left-".concat(t)]&&!Bn["right-".concat(t)]&&!Bn[t])return!1;for(var i=t,o=1;o<n.length-1;o++)if(i+="-".concat(n[o]),!kn[i])return!1;return!0},w=et.current.getBoundingClientRect();Ze({width:w.width,height:w.height});var R=[];if(pt.forEach(function(e){var n,t,i=e.key,o=null===(n=ht.current[i])||void 0===n?void 0:n.current,r=null===(t=gt.current[i])||void 0===t?void 0:t.current;o&&r&&(o.style.height="auto",r.style.height="auto",o.style.minHeight="0px",r.style.minHeight="0px")}),!ze.current){for(var C=0;C<Math.max(zn.length,Ln.length);C++){var _=null===(e=xt.current[C])||void 0===e?void 0:e.current,F=null===(n=mt.current[C])||void 0===n?void 0:n.current;_&&(_.style.height="auto",_.style.minHeight="0px"),F&&(F.style.height="auto",F.style.minHeight="0px")}se||Object.keys(St.current).forEach(function(e){var n,t;if(S(e)){var i=null===(n=St.current[e])||void 0===n?void 0:n.current,o=null===(t=wt.current[e])||void 0===t?void 0:t.current;i&&o&&(i.style.height="auto",o.style.height="auto",i.style.minHeight="0px",o.style.minHeight="0px")}})}var E={};pt.forEach(function(e){var n,t,i=e.key,o=null===(n=ht.current[i])||void 0===n?void 0:n.current,r=null===(t=gt.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=o.getBoundingClientRect(),c=r.getBoundingClientRect();E[i]=Math.max(l.height,c.height)}});var B={left:{},right:{}},T={};if(!ze.current)if(se){if(we&&null!==at)if("number"==typeof at){var M=at,k=zn[M],A=null===(o=xt.current[M])||void 0===o?void 0:o.current;A&&k&&(k.refIndexes||[]).forEach(function(e){var n,t=Ln.findIndex(function(n){return n.selfIndex===e}),i=null===(n=mt.current[t])||void 0===n?void 0:n.current;if(i&&(Bn["left-".concat(M)]||Bn["right-".concat(t)])){var o=Math.max(A.getBoundingClientRect().height,i.getBoundingClientRect().height);B.left[M]=Math.max(B.left[M]||0,o),B.right[t]=Math.max(B.right[t]||0,o)}})}else{var D=at.split(z)[2];if(D){_=null===(r=St.current[D])||void 0===r?void 0:r.current,F=null===(l=wt.current[D])||void 0===l?void 0:l.current;if(_&&F){H=Math.max(_.getBoundingClientRect().height,F.getBoundingClientRect().height);T[D]=Math.max(T[D]||0,H)}}}}else{Object.keys(St.current).forEach(function(e){var n,t;if(S(e)){var i=null===(n=St.current[e])||void 0===n?void 0:n.current,o=null===(t=wt.current[e])||void 0===t?void 0:t.current;if(i&&o&&null!==i.offsetParent&&null!==o.offsetParent){var r=i.getBoundingClientRect(),l=o.getBoundingClientRect(),c=Math.max(r.height,l.height);T[e]=c,i.style.minHeight="".concat(c,"px"),o.style.minHeight="".concat(c,"px")}}});for(C=0;C<Math.min(zn.length,Ln.length);C++){var _=null===(t=xt.current[C])||void 0===t?void 0:t.current,F=null===(i=mt.current[C])||void 0===i?void 0:i.current;if(_&&F){var H=Math.max(_.getBoundingClientRect().height,F.getBoundingClientRect().height);B.left[C]=H,B.right[C]=H}}}if(pt.forEach(function(e){var n,t,i=e.key,o=null===(n=ht.current[i])||void 0===n?void 0:n.current,r=null===(t=gt.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=E[i];o.style.minHeight="".concat(l,"px"),r.style.minHeight="".concat(l,"px")}}),ze.current||(Object.entries(B.left).forEach(function(e){var n,t=e[0],i=e[1],o=null===(n=xt.current[Number(t)])||void 0===n?void 0:n.current;o&&(o.style.minHeight="".concat(i,"px"))}),Object.entries(B.right).forEach(function(e){var n,t=e[0],i=e[1],o=null===(n=mt.current[Number(t)])||void 0===n?void 0:n.current;o&&(o.style.minHeight="".concat(i,"px"))}),se||Object.keys(T).forEach(function(e){var n,t,i=null===(n=St.current[e])||void 0===n?void 0:n.current,o=null===(t=wt.current[e])||void 0===t?void 0:t.current;if(i&&o&&T[e]){var r=T[e];i.style.minHeight="".concat(r,"px"),o.style.minHeight="".concat(r,"px")}})),se)zn.forEach(function(e,n){var t;(null===(t=xt.current[n])||void 0===t?void 0:t.current)&&(e.refIndexes||[]).forEach(function(e){var t,i,o,r,l,c,u,a,d,s,v=Ln.findIndex(function(n){return n.selfIndex===e});if(-1!==v){var f=null===(t=yt.current[n])||void 0===t?void 0:t.current,p=null===(i=bt.current[v])||void 0===i?void 0:i.current;if(f&&p){var h=f.getBoundingClientRect(),g=p.getBoundingClientRect(),x=h.right-w.left,m=g.left-w.left,y=h.top+h.height/2-w.top,b=g.top+g.height/2-w.top;if(we&&at===n){var I=null!==(r=null===(o=hn.current)||void 0===o?void 0:o.getBoundingClientRect().top)&&void 0!==r?r:0,S=null!==(c=null===(l=dn.current)||void 0===l?void 0:l.getBoundingClientRect().top)&&void 0!==c?c:0,C=I+(null!==(a=null===(u=hn.current)||void 0===u?void 0:u.clientHeight)&&void 0!==a?a:1/0),_=S+(null!==(s=null===(d=dn.current)||void 0===d?void 0:d.clientHeight)&&void 0!==s?s:1/0),F=h.top+h.height/2,E=function(e,n,t){return Math.max(n,Math.min(t,e))};y=E(F,I,C)-w.top,b=E(F,S,_)-w.top}var B=_t(n);B&&R.push({id:"line-".concat(n,"-").concat(v),x1:x,y1:y,x2:m,y2:b,style:B,sectionIdx:n,targetRightIdx:v})}}})});else for(C=0;C<Math.min(zn.length,Ln.length);C++){var O=null===(c=xt.current[C])||void 0===c?void 0:c.current,N=null===(u=mt.current[C])||void 0===u?void 0:u.current;if(O&&N){var W=O.getBoundingClientRect(),L=N.getBoundingClientRect(),j=Math.max(W.top,L.top)+18-w.top,Y=(null===(a=Ln[C])||void 0===a?void 0:a.id)||"sec-".concat(C);(J=_t(C))&&R.push({id:Y,x1:W.right-w.left,y1:j,x2:L.left-w.left,y2:j,style:J,sectionIdx:C,hasCognitive:!!((null===(d=zn[C])||void 0===d?void 0:d.cognitiveData)||(null===(s=Ln[C])||void 0===s?void 0:s.cognitiveData)||Y&&Xe[Y]),isSubSection:!1})}}if(we&&"string"==typeof at&&at.includes(z)){var K=at.split(z),V=K[0],X=K[1],q=K[2],U=(K[3],"".concat(V).concat(z).concat(X)),$=null===(v=yt.current[U])||void 0===v?void 0:v.current,G=null===(f=bt.current[U])||void 0===f?void 0:f.current;if($&&G){var J,Q=$.getBoundingClientRect(),Z=G.getBoundingClientRect(),ee=Q.right-w.left,ne=Z.left-w.left,te=Q.top+Q.height/2-w.top,ie=Z.top+Z.height/2-w.top;if(se){var oe=null!==(h=null===(p=hn.current)||void 0===p?void 0:p.getBoundingClientRect().top)&&void 0!==h?h:0,re=null!==(x=null===(g=dn.current)||void 0===g?void 0:g.getBoundingClientRect().top)&&void 0!==x?x:0,le=oe+(null!==(y=null===(m=hn.current)||void 0===m?void 0:m.clientHeight)&&void 0!==y?y:1/0),ce=re+(null!==(I=null===(b=dn.current)||void 0===b?void 0:b.clientHeight)&&void 0!==I?I:1/0),ue=function(e,n,t){return Math.max(n,Math.min(t,e))};te=ue(Q.top+Q.height/2,oe,le)-w.top,ie=ue(Z.top+Z.height/2,re,ce)-w.top}(J=Ft(q))&&R.push({id:"line-subsec-".concat(U),x1:ee,y1:te,x2:ne,y2:ie,style:J,sectionIdx:Number(q.split("-")[0]),isSubSection:!0,subSectionKeyPath:at})}}if(ct(R),it.current&&ot.current){var ae=it.current.getBoundingClientRect(),de=ot.current.getBoundingClientRect(),ve=(ae.top+ae.height/2-w.top+de.top+de.height/2-w.top)/2;ft({x1:ae.right-w.left,x2:de.left-w.left,y:ve})}else ft(null);if(Ae.size>0){var fe=[],pe=hn.current,he=dn.current;if(pe&&he){var ge=[],xe=pe.getBoundingClientRect().top,me=he.getBoundingClientRect().top,ye=xe+pe.clientHeight,be=me+he.clientHeight,Ie=pe.scrollTop,Se=he.scrollTop,Re=w.top,Ce=function(e,n,t){return Math.max(n,Math.min(t,e))};Ae.forEach(function(e){var n,t,i,o,r;if("string"==typeof e&&e.includes(z)){var l=e.split(z),c=l[0],u=l[1],a=l[2],d=(l[3],"".concat(c).concat(z).concat(u)),s=null===(n=yt.current[d])||void 0===n?void 0:n.current,v=null===(t=bt.current[d])||void 0===t?void 0:t.current;if(!s||!v)return;var f=s.getBoundingClientRect(),p=v.getBoundingClientRect(),h=Ft(a),g=(A=f.right-w.left)+.5*((D=p.left-w.left-0)-A),x=f.top+f.height/2,m=p.top+p.height/2,y=x-xe+Ie,b=m-me+Se,I="conn-subsec-".concat(d);ge.push({lhsScrollY:y,rhsScrollY:b,x1:A,x2:D,containerTop:Re,leftIdx:e,rhsArrayIdx:e,styleColor:(null==h?void 0:h.badgeBorder)||"#6366F1",styleId:I});var S=Ce(x,xe,ye),R=Ce(m,me,be),C=S-Re,_=R-Re,F=m>=me-4&&m<=be+4,E="";E=(H=x>=xe-4&&x<=ye+4)&&F?P(A,C,D,_):H&&!F?"M ".concat(A,",").concat(C," L ").concat(g,",").concat(C," L ").concat(g,",").concat(_):!H&&F?"M ".concat(g,",").concat(C," L ").concat(g,",").concat(_," L ").concat(D,",").concat(_):"M ".concat(g,",").concat(C," L ").concat(g,",").concat(_),fe.push({id:I,pathD:E,style:h,leftIdx:e,rhsArrayIdx:e})}else if(se){var B=e,T=zn[B];if(!(null===(r=null==T?void 0:T.refIndexes)||void 0===r?void 0:r.length))return;T.refIndexes.forEach(function(e){var n,t,i=Ln.findIndex(function(n){return n.selfIndex===e});if(-1!==i){var o=null===(n=yt.current[B])||void 0===n?void 0:n.current,r=null===(t=bt.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=o.getBoundingClientRect(),c=r.getBoundingClientRect(),u=_t(B),a=l.right-w.left,d=c.left-w.left-0,s=a+.5*(d-a),v=l.top+l.height/2,f=c.top+c.height/2,p=v-xe+Ie,h=f-me+Se,g="conn-".concat(B,"-").concat(i);ge.push({lhsScrollY:p,rhsScrollY:h,x1:a,x2:d,containerTop:Re,leftIdx:B,rhsArrayIdx:i,styleColor:(null==u?void 0:u.badgeBorder)||"#6366F1",styleId:g});var x=Ce(v,xe,ye),m=Ce(f,me,be),y=x-Re,b=m-Re,I=v>=xe-4&&v<=ye+4,S=f>=me-4&&f<=be+4,R="";R=I&&S?P(a,y,d,b):I&&!S?"M ".concat(a,",").concat(y," L ").concat(s,",").concat(y," L ").concat(s,",").concat(b):!I&&S?"M ".concat(s,",").concat(y," L ").concat(s,",").concat(b," L ").concat(d,",").concat(b):"M ".concat(s,",").concat(y," L ").concat(s,",").concat(b),fe.push({id:g,pathD:R,style:u,leftIdx:B,rhsArrayIdx:i})}}})}else{var M=e,k=M;s=null===(i=yt.current[M])||void 0===i?void 0:i.current,v=null===(o=bt.current[k])||void 0===o?void 0:o.current;if(!s||!v)return;var A,D;f=s.getBoundingClientRect(),p=v.getBoundingClientRect(),h=_t(M),g=(A=f.right-w.left)+.5*((D=p.left-w.left-0)-A),x=f.top+f.height/2,m=p.top+p.height/2,y=x-xe+Ie,b=m-me+Se,I="conn-".concat(M,"-").concat(k);ge.push({lhsScrollY:y,rhsScrollY:b,x1:A,x2:D,containerTop:Re,leftIdx:M,rhsArrayIdx:k,styleColor:(null==h?void 0:h.badgeBorder)||"#6366F1",styleId:I});var H;S=Ce(x,xe,ye),R=Ce(m,me,be),C=S-Re,_=R-Re,F=m>=me-4&&m<=be+4,E="";E=(H=x>=xe-4&&x<=ye+4)&&F?P(A,C,D,_):H&&!F?"M ".concat(A,",").concat(C," L ").concat(g,",").concat(C," L ").concat(g,",").concat(_):!H&&F?"M ".concat(g,",").concat(C," L ").concat(g,",").concat(_," L ").concat(D,",").concat(_):"M ".concat(g,",").concat(C," L ").concat(g,",").concat(_),fe.push({id:I,pathD:E,style:h,leftIdx:M,rhsArrayIdx:k})}}),Pe.current=ge}Ne(fe)}else Ne([]),Pe.current=[]}catch(e){console.error("Line render safe fail: ",e)}finally{gn.current=!1}}},[pt,zn,Ln,Xe,In,Ct,_t,se,we,at,Ae,Bn,kn]),Bt=s(function(){var e,n,t,i,o,r,l,c,u,a,d,s,v,f,p=Pe.current;if(p.length&&!ze.current){var h=null!==(n=null===(e=hn.current)||void 0===e?void 0:e.scrollTop)&&void 0!==n?n:0,g=null!==(i=null===(t=dn.current)||void 0===t?void 0:t.scrollTop)&&void 0!==i?i:0,x=null!==(r=null===(o=hn.current)||void 0===o?void 0:o.clientHeight)&&void 0!==r?r:1/0,m=null!==(c=null===(l=dn.current)||void 0===l?void 0:l.clientHeight)&&void 0!==c?c:1/0,y=null!==(a=null===(u=hn.current)||void 0===u?void 0:u.getBoundingClientRect().top)&&void 0!==a?a:0,b=null!==(s=null===(d=dn.current)||void 0===d?void 0:d.getBoundingClientRect().top)&&void 0!==s?s:0,I=y+x,S=b+m,w=null!==(f=null===(v=et.current)||void 0===v?void 0:v.getBoundingClientRect().top)&&void 0!==f?f:0,R=function(e,n,t){return Math.max(n,Math.min(t,e))};p.forEach(function(e){var n=e.lhsScrollY-h+y,t=e.rhsScrollY-g+b,i=je.current[e.styleId+"-stroke"],o=je.current[e.styleId+"-bg"];if(i||o){var r,l=R(n,y,I),c=R(t,b,S),u=l-w,a=c-w,d=n>=y-4&&n<=I+4,s=t>=b-4&&t<=S+4,v=e.x1+.5*(e.x2-e.x1);r=d&&s?P(e.x1,u,e.x2,a):d&&!s?"M ".concat(e.x1,",").concat(u," L ").concat(v,",").concat(u," L ").concat(v,",").concat(a):!d&&s?"M ".concat(v,",").concat(u," L ").concat(v,",").concat(a," L ").concat(e.x2,",").concat(a):"M ".concat(v,",").concat(u," L ").concat(v,",").concat(a),i&&(i.setAttribute("visibility","visible"),i.setAttribute("d",r)),o&&(o.setAttribute("visibility","visible"),o.setAttribute("d",r))}})}},[]),Tt=a(Et);d(function(){Tt.current=Et},[Et]);var Mt=a(null),kt=s(function(){null!==Mt.current&&clearTimeout(Mt.current),Mt.current=setTimeout(function(){Tt.current(),Mt.current=null},50)},[]),At=s(function(e){var n,t,i,o,r,l,c,u,a,d;if(!Ee.current){if(se||kt(),Ke.current){var s=Ve.current,v=nt.current,f=hn.current,p=dn.current;if(null!==s&&null!==v&&f&&p){var h="string"==typeof s&&s.includes(z)?null===(n=yt.current["".concat(s.split(z)[0]).concat(z).concat(s.split(z)[1])])||void 0===n?void 0:n.current:null===(t=Xn.current[s])||void 0===t?void 0:t.current,g="string"==typeof v&&v.includes(z)?null===(i=bt.current["".concat(v.split(z)[0]).concat(z).concat(v.split(z)[1])])||void 0===i?void 0:i.current:null===(o=It.current[v])||void 0===o?void 0:o.current;if(h&&g){var x=h.getBoundingClientRect().top-f.getBoundingClientRect().top+f.scrollTop,m=g.getBoundingClientRect().top-p.getBoundingClientRect().top+p.scrollTop;if(e.currentTarget===f){var y=m-(x-f.scrollTop),b=p.scrollHeight-p.clientHeight,I=Math.max(0,Math.min(y,b));Math.abs(p.scrollTop-I)>1&&(p.scrollTop=I)}else if(e.currentTarget===p){var S=x-(m-p.scrollTop),w=f.scrollHeight-f.clientHeight,R=Math.max(0,Math.min(S,w));Math.abs(f.scrollTop-R)>1&&(f.scrollTop=R)}if(tt.current){var C=void 0,_=void 0;if("string"==typeof s&&s.includes(z)){var F=s.split(z),E="".concat(F[0]).concat(z).concat(F[1]);C=null===(r=yt.current[E])||void 0===r?void 0:r.current,_=null===(l=bt.current[E])||void 0===l?void 0:l.current}else C=null===(c=yt.current[s])||void 0===c?void 0:c.current,_=null===(u=bt.current[v])||void 0===u?void 0:u.current;var B=null!==(d=null===(a=et.current)||void 0===a?void 0:a.getBoundingClientRect().top)&&void 0!==d?d:0,T=f.getBoundingClientRect().top,M=T+f.clientHeight,k=p.getBoundingClientRect().top,A=k+p.clientHeight,D=function(e,n,t){return Math.max(n,Math.min(t,e))};if(C&&_){var H=C.getBoundingClientRect(),O=_.getBoundingClientRect(),N=H.top+H.height/2,W=O.top+O.height/2,L=D(N,T,M),j=D(W,k,A);tt.current.setAttribute("y1",(L-B).toString()),tt.current.setAttribute("y2",(j-B).toString());var P=N>=T-4&&N<=M+4;tt.current.setAttribute("visibility",P?"visible":"hidden")}}}}}Pe.current.length>0&&!Ye.current&&(Ye.current=!0,requestAnimationFrame(function(){Bt(),Ye.current=!1}))}},[Bt,se,kt]);d(function(){var e=setTimeout(kt,250);window.addEventListener("resize",kt);var n=null,t=null;return un.current&&(n=new ResizeObserver(kt)).observe(un.current),et.current&&(t=new ResizeObserver(kt)).observe(et.current),function(){clearTimeout(e),window.removeEventListener("resize",kt),null==n||n.disconnect(),null==t||t.disconnect()}},[wn,Dn,Pn,pt,Bn,kn,zn,Ln,In,kt,we,at,_e,Ae]),d(function(){Ke.current=we},[we]),d(function(){Ve.current=at},[at]);var Dt=s(function(){var e,n,t,i,o=ln.sectionIdx,r=ln.isOrphan;if(yn(),null!=o)if(r)Ie("No counterpart exists for this section.");else if(we&&at===o)Un();else{if(!se){var l=Ve.current,c=nt.current;if(null!==l)if("string"==typeof l&&l.includes(z)){var u=l.split(z);(a=null===(e=St.current[u[2]])||void 0===e?void 0:e.current)&&(a.style.paddingTop="0px")}else{var a;(a=null===(n=xt.current[l])||void 0===n?void 0:n.current)&&(a.style.paddingTop="0px")}if(null!==c)if("string"==typeof c&&c.includes(z)){u=c.split(z);(d=null===(t=wt.current[u[3]])||void 0===t?void 0:t.current)&&(d.style.paddingTop="0px")}else{var d;(d=null===(i=mt.current[c])||void 0===i?void 0:i.current)&&(d.style.paddingTop="0px")}}De(new Set),Ne([]),Pe.current=[],me(!0),Ee.current=!0,dt(o),Ve.current=o,Re(!0),Ke.current=!0,Fe(!1),sn.current&&(sn.current.style.height="0px"),vn.current&&(vn.current.style.height="0px"),fn.current&&(fn.current.style.height="0px"),pn.current&&(pn.current.style.height="0px"),requestAnimationFrame(function(){var e,n,t,i,r,l,c,u,a,d,s,v=null,f=null,p=null,h=null,g=null;if("string"==typeof o&&o.includes(z)){var x=o.split(z),m="".concat(x[0]).concat(z).concat(x[1]);v=(null===(e=yt.current[m])||void 0===e?void 0:e.current)||null,g=(f=(null===(n=bt.current[m])||void 0===n?void 0:n.current)||null)?o:null,p=(null===(t=St.current[x[2]])||void 0===t?void 0:t.current)||null,h=(null===(i=wt.current[x[3]])||void 0===i?void 0:i.current)||null}else if(v=(null===(r=Xn.current[o])||void 0===r?void 0:r.current)||null,p=(null===(l=xt.current[o])||void 0===l?void 0:l.current)||null,se){var y=zn[o],b=(null==y?void 0:y.refIndexes)||[];if(b.length>0){var I=b[0],S=Ln.findIndex(function(e){return e.selfIndex===I});-1!==S&&(f=(null===(a=It.current[S])||void 0===a?void 0:a.current)||null,h=(null===(d=mt.current[S])||void 0===d?void 0:d.current)||null,g=S)}}else f=(null===(c=It.current[o])||void 0===c?void 0:c.current)||null,h=(null===(u=mt.current[o])||void 0===u?void 0:u.current)||null,g=f?o:null;nt.current=g;var w=hn.current,R=dn.current;if(!v||!w)return Ee.current=!1,void me(!1);if(!f||!R)return Fe(!0),Tt.current(),Ee.current=!1,void me(!1);if(!se){var C=v.getBoundingClientRect(),_=f.getBoundingClientRect(),F=C.top-_.top;p&&h&&(p.style.paddingTop="0px",h.style.paddingTop="0px",F>0?h.style.paddingTop="".concat(F,"px"):F<0&&(p.style.paddingTop="".concat(Math.abs(F),"px")));var E=v?v.getBoundingClientRect().top:(null==p?void 0:p.getBoundingClientRect().top)||0;return null===(s=un.current)||void 0===s||s.scrollTo({top:un.current.scrollTop+E-150,behavior:"smooth"}),Fe(!0),Tt.current(),Ee.current=!1,void me(!1)}var B=v.getBoundingClientRect().top-w.getBoundingClientRect().top+w.scrollTop,T=f.getBoundingClientRect().top-R.getBoundingClientRect().top+R.scrollTop-(B-w.scrollTop);T<0&&sn.current&&(sn.current.style.height="".concat(Math.abs(T),"px"));requestAnimationFrame(function(){var e,n=R.scrollHeight-R.clientHeight;if(T<0)e=0;else{if(T>n){var t=T-n;return vn.current&&(vn.current.style.height="".concat(t+150,"px")),void requestAnimationFrame(function(){X(R,T,200,function(){Fe(!0),Tt.current(),Ee.current=!1,me(!1)})})}e=T}X(R,e,200,function(){Fe(!0),Tt.current(),Ee.current=!1,me(!1)})})})}},[yn,ln.sectionIdx,we,at,zn,Ln,kt,Un]),Ht=null!==ln.sectionIdx&&Ae.has(ln.sectionIdx),Ot=function(n){var t,r,c,u,a,d,s,p=n.section,h=n.idx,g=n.columnKey,x=n.colRef,S=n.mb,R=void 0===S?1:S,C=n.parentNodeId,_=void 0===C?"":C,T=se?!!Bn["".concat(g,"-").concat(h)]:!!Bn[String(h)],M=(null===(t=p.displayTitle)||void 0===t||t)&&E(p.title),k=(null===(r=p.displayContent)||void 0===r||r)&&E(p.content),A=!M&&!k,D={current:1},H=p.title;M||(H=k?"No Title Found":"No Matching Section Found");var O,N=null!==(d=null===(a=null===(u=null===(c=p.evaluationResult)||void 0===c?void 0:c.evaluation_outputs)||void 0===u?void 0:u.metadata)||void 0===a?void 0:a.label_color)&&void 0!==d?d:V,W=B(N).highlightBg,z=[];if(null===(s=p.evaluationResult)||void 0===s?void 0:s.deviations){var L=p.evaluationResult.deviations;for(var P in L){var Y=L[P][_];Y&&z.push(Y)}}return i(v,e({ref:x,sx:{mb:R,width:"100%",display:"flex",flexDirection:"column",position:"relative",minWidth:0}},{children:o(y,e({disableGutters:!0,expanded:!A&&T,onChange:function(){return!A&&function(n,t){var i,o;ze.current=!0,Le.current&&clearTimeout(Le.current),We.current&&(We.current.style.opacity="0");var r=null===(i=xt.current[n])||void 0===i?void 0:i.current,l=null===(o=mt.current[n])||void 0===o?void 0:o.current;r&&(r.style.minHeight="0px"),l&&(l.style.minHeight="0px"),Le.current=setTimeout(function(){ze.current=!1,Tt.current(),We.current&&(We.current.style.opacity="1")},650),Tn(function(i){var o=e({},i),r=se?"".concat(t,"-").concat(n):String(n),l=!i[r];if(!l){var c=String(at||""),u=at===n||c.startsWith("".concat(n,"-")),a=!1;Ae.forEach(function(e){(e===n||String(e).startsWith("".concat(n,"-")))&&(a=!0)}),(u||a)&&(Un(),De(new Set),Ne([]),Pe.current=[])}if(!se)return o[String(n)]=l,o;if(o[r]=l,"left"===t)((null==(d=zn[n])?void 0:d.refIndexes)||[]).forEach(function(e){var n=Ln.findIndex(function(n){return n.selfIndex===e});-1!==n&&(o["right-".concat(n)]=l)});else{var d,s=null==(d=Ln[n])?void 0:d.selfIndex;zn.forEach(function(e,n){var t;(null===(t=e.refIndexes)||void 0===t?void 0:t.includes(s))&&(o["left-".concat(n)]=l)})}return o})}(h,g)},sx:{boxShadow:"none",border:A?"1px dashed #E2E8F0":"1px solid #E2E8F0",bgcolor:A?"#FAFAFA":"#FFFFFF",borderRadius:"6px",flexGrow:1,width:"100%",display:"flex",flexDirection:"column",minWidth:0,"&:before":{display:"none"}}},{children:[i(b,e({expandIcon:A?null:i(w,{size:16}),sx:{minHeight:"36px",flexShrink:0,cursor:A?"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:M&&i(m,e({title:H,placement:"top"},{children:i(f,e({component:"div",sx:{fontSize:"12px",color:A?"#94A3B8":"#19213D",fontWeight:A?400:700,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0}},{children:(O=H,O?F(O).replace(/\\n/g,"\n").split(/(\*\*.*?\*\*)/g).map(function(e,n){return e.startsWith("**")&&e.endsWith("**")?i("strong",{children:e.slice(2,-2)},n):i(l.Fragment,{children:e},n)}):null)}))}))})),!A&&o(I,e({sx:{pt:0,pb:1.25,bgcolor:"#FFFFFF",flex:1,display:"flex",flexDirection:"column",minWidth:0}},{children:[k&&i(j,{content:p.content,sxStyles:en,highlights:z,maintainRelativeOrder:se,highlightBg:W}),(p.subsections||[]).map(function(e,n){return Nt({section:e,keyPath:"".concat(h,"-").concat(n),depth:0,columnKey:g,parentNodeId:_,devCounter:D})})]}))]}))}),"".concat(g,"-sec-").concat(h))},Nt=function(n){var r,c,u,a,d,s,p,h,g,x,m,S,R,C,_,F=n.section,T=n.keyPath,M=n.depth,k=void 0===M?0:M,A=n.columnKey,D=void 0===A?"left":A,H=n.parentNodeId,O=void 0===H?"":H,N=(null===(r=F.displayTitle)||void 0===r||r)&&E(F.title),W=(null===(c=F.displayContent)||void 0===c||c)&&E(F.content),P=!N&&!W,Y=N?F.title:W?"No Title Found":"No Matching Section Found",K=!!kn[T];"left"!==D||St.current[T]||(St.current[T]=l.createRef()),"right"!==D||wt.current[T]||(wt.current[T]=l.createRef());var X="left"===D?St.current[T]:wt.current[T],q=Ft(T),U=T.split("-").map(Number),$=U[0],G=zn[$],J=Ln[$],Q=T,Z=T;if(se)if("left"===D){var ne=null===(u=null==G?void 0:G.refIndexes)||void 0===u?void 0:u[0],te=Ln.findIndex(function(e){return e.selfIndex===ne});-1!==te&&(J=Ln[te],Z=t([te],U.slice(1),!0).join("-"))}else{var ie=null===(a=null==J?void 0:J.refIndexes)||void 0===a?void 0:a[0],oe=zn.findIndex(function(e){return e.selfIndex===ie});-1!==oe&&(G=zn[oe],Q=t([oe],U.slice(1),!0).join("-"))}var re,le="left"===D?G:J;re=se&&void 0!==(null==le?void 0:le.selfIndex)&&le.selfIndex>=0?le.selfIndex+1:$+1;for(var ce=G,ue=J,ae=1;ae<U.length;ae++)(null==ce?void 0:ce.subsections)&&(ce=ce.subsections[U[ae]]),(null==ue?void 0:ue.subsections)&&(ue=ue.subsections[U[ae]]);var de=null===(d=null==ee?void 0:ee.input_index_map)||void 0===d?void 0:d[0],ve=null===(s=null==ee?void 0:ee.input_index_map)||void 0===s?void 0:s[1],fe="left"===D?ve:de,pe=se?!(null===(p=F.refIndexes)||void 0===p?void 0:p.length)||void 0!==F.selfIndex&&F.selfIndex<0:"left"===D?!ue:!ce,he=null!==(x=null===(g=null===(h=F.evaluationResult)||void 0===h?void 0:h.evaluation_outputs)||void 0===g?void 0:g.output_value)&&void 0!==x?x:null,ge=F.id,xe=null!==(C=null===(R=null===(S=null===(m=F.evaluationResult)||void 0===m?void 0:m.evaluation_outputs)||void 0===S?void 0:S.metadata)||void 0===R?void 0:R.label_color)&&void 0!==C?C:V,me=B(xe).highlightBg,ye=(null===(_=F.evaluationResult)||void 0===_?void 0:_.deviations)||{},be=Object.entries(ye).map(function(n){var t=n[0],i=n[1],o="".concat(ge).concat(z).concat(t),r=Vn[o];if(!r)return null;var c=i[O],u=L(c);if(u)c="";else if(!c)return null;var a=i[fe],d=pe||L(a),s="".concat(re,".").concat(r),v="".concat(ge).concat(z).concat(t).concat(z).concat(Q).concat(z).concat(Z);return"left"!==D||yt.current[o]||(yt.current[o]=l.createRef()),"right"!==D||bt.current[o]||(bt.current[o]=l.createRef()),{id:o,actionId:v,label:s,highlight:c,side:D,style:q,score:he,isConnected:Ae.has(v),isOrphan:d,isMissingClause:u,badgeRef:"left"===D?yt.current[o]:bt.current[o],onClick:function(n){n.stopPropagation();var t=e(e({},ce||{title:"",content:""}),{title:(null==G?void 0:G.title)||(null==ce?void 0:ce.title)||""}),i=e(e({},ue||{title:"",content:""}),{title:(null==J?void 0:J.title)||(null==ue?void 0:ue.title)||""});Jn(n,t,d,i,v,q)}}}).filter(Boolean),Ie=be.some(function(e){return Ae.has(e.actionId)});if(!(N||W||F.subsections&&0!==F.subsections.length))return null;var Se=function(){var e,n=[];if(null===(e=F.evaluationResult)||void 0===e?void 0:e.deviations){var t=F.evaluationResult.deviations;for(var i in t){var o=t[i][O];o&&n.push(o)}}return n}();return i(v,N?e({ref:X,sx:{mt:1,width:"100%",minWidth:0,position:"relative"}},{children:i(v,e({sx:e({width:"100%"},Ie&&q&&{borderRadius:"4px",outline:"2px solid ".concat(q.badgeBorder),outlineOffset:"1px"})},{children:o(y,e({disableGutters:!0,expanded:!P&&K,onChange:function(){if(!P){if(K){var n=String(at||""),t=n.includes(Q)||n.includes(Z);t||Ae.forEach(function(e){(String(e).includes(Q)||String(e).includes(Z))&&(t=!0)}),t&&(Un(),De(new Set),Ne([]),Pe.current=[])}An(function(n){var t;return e(e({},n),((t={})[T]=!n[T],t))})}},sx:{mt:0,boxShadow:"none",border:P?"1px dashed #E2E8F0":"1px solid #EEF2F7",borderRadius:"4px !important",bgcolor:"#FFFFFF",minWidth:0,"&:before":{display:"none"}}},{children:[i(b,e({expandIcon:P?null:i(w,{size:14}),sx:{minHeight:"32px","& .MuiAccordionSummary-content":{my:.5,display:"grid",alignItems:"center",minWidth:0,width:"100%"}}},{children:i(f,e({component:"div",sx:{fontSize:"11px",fontWeight:600,color:P?"#94A3B8":"#19213D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0}},{children:Y||"Untitled Subsection"}))})),!P&&o(I,e({sx:{pt:0,pb:1,minWidth:0}},{children:[W&&i(j,{content:F.content,sxStyles:en,deviationBadges:be,maintainRelativeOrder:se,highlightBg:me,highlights:Se}),(F.subsections||[]).map(function(e,n){return Nt({section:e,keyPath:"".concat(T,"-").concat(n),depth:k+1,columnKey:D,parentNodeId:O})})]}))]}))}))}):e({ref:X,sx:{mt:0===k?1:.75,width:"100%",minWidth:0,position:"relative"}},{children:!P&&o(v,e({sx:e({width:"100%"},Ie&&q&&{borderRadius:"4px",outline:"2px solid ".concat(q.badgeBorder),outlineOffset:"1px"})},{children:[W&&i(j,{content:F.content,sxStyles:en,deviationBadges:be,maintainRelativeOrder:se,highlightBg:me,highlights:Se}),(F.subsections||[]).map(function(e,n){return Nt({section:e,keyPath:"".concat(T,"-").concat(n),depth:k+1,columnKey:D,parentNodeId:O})})]}))}),T)};return o(v,e({ref:an,sx:e(e({display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif'},se?{}:{overflow:"visible"}),{position:"relative"})},{children:[pe&&i(v,e({sx:{position:"absolute",inset:0,bgcolor:"rgba(255, 255, 255, 0.6)",backdropFilter:"blur(10px)",zIndex:9999,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"8px"}},{children:i(N,{})})),i(O,{open:ln.open,anchorEl:ln.anchorEl,sectionTitle:ln.sectionTitle,referenceSectionTitle:ln.refSectionTitle,onClose:yn,onOpenCognitiveCompare:Qn,onOpenSideBySide:Dt,onConnect:Zn,isConnected:Ht,isOrphan:ln.isOrphan}),tn.open&&i(H,{open:tn.open,popupRef:Ge,position:Ue,popupConfig:ce,onClose:function(){$e(null),on(function(n){return e(e({},n),{open:!1})}),Me(null)},markdownStyles:oe,sectionTitle:tn.sectionTitle,referenceSectionTitle:tn.refSectionTitle,cognitiveData:tn.cognitiveData,anchorEl:tn.anchorEl,sectionAnchorEl:tn.sectionAnchorEl,scrollContainerEl:un.current,badgeStyle:tn.badgeStyle,docData:tn.docData,deviationData:tn.deviationData}),i(p,e({open:!!be,autoHideDuration:8e3,onClose:function(){return Ie(null)},anchorOrigin:{vertical:"top",horizontal:"center"}},{children:i(h,e({onClose:function(){return Ie(null)},severity:"error",sx:{width:"100%",whiteSpace:"pre-line"}},{children:be}))})),(le.isHeaderVisible||le.isToggleVisible)&&o(v,e({sx:{px:2,py:1,display:"flex",alignItems:"center",justifyContent:"space-between",bgcolor:"#FFFFFF",border:"1.5px solid #EEF0F4",borderTopLeftRadius:"8px",borderTopRightRadius:"8px"}},{children:[i(v,e({sx:{display:"flex",alignItems:"center",gap:1}},{children:le.isHeaderVisible&&i(f,e({sx:{fontSize:"16px",fontWeight:600,color:"#0F172A"}},{children:Z}))})),le.isToggleVisible&&i(v,e({sx:{display:"flex",alignItems:"center"}},{children:i(g,{control:i(x,{checked:!se,onChange:function(e){var n=e.target.checked;he(!0),setTimeout(function(){ve(!n),Un(),De(new Set),Ne([]),Pe.current=[],setTimeout(function(){he(!1)},400)},50)},color:"primary",size:"small",sx:{width:100,height:26,padding:0,"& .MuiSwitch-switchBase":{padding:0,margin:"3px",transitionDuration:"300ms","&.Mui-checked":{transform:"translateX(75px)",color:"#fff","& + .MuiSwitch-track":{backgroundColor:"#5928ED",opacity:1,border:0,"&::before":{content:'"Side by Side"',position:"absolute",left:"13px",top:"50%",transform:"translateY(-50%)",fontSize:"9px",fontWeight:700,color:"#fff",letterSpacing:"0.3px"}}}},"& .MuiSwitch-thumb":{boxSizing:"border-box",width:20,height:20},"& .MuiSwitch-track":{borderRadius:13,backgroundColor:"#9e9e9e",opacity:1,position:"relative","&::after":{content:'"Side by Side"',position:"absolute",right:"13px",top:"50%",transform:"translateY(-50%)",fontSize:"9px",fontWeight:700,color:"#fff",letterSpacing:"0.3px",opacity:1,transition:"opacity 0.2s"}},"& .MuiSwitch-switchBase.Mui-checked + .MuiSwitch-track":{"&::after":{opacity:0}}}}),label:"",labelPlacement:"start",sx:{m:0,gap:1}})}))]})),i(v,e({ref:un,onScroll:At,sx:{flex:1,minHeight:0,pt:1.5,pb:1,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",overflowY:se?"hidden":"auto",borderTop:Yn&&Kn?"none":"1.5px solid #EEF0F4"}},{children:i(v,e({sx:e({display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"},se?{flex:1,minHeight:0}:{})},{children:o(v,e({ref:et,sx:e({display:"grid",gridTemplateColumns:"minmax(0, 1fr) 180px minmax(0, 1fr)",gap:"10px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0},se?{flex:1,overflow:"visible"}:{})},{children:[o("svg",e({ref:We,style:{position:"absolute",top:0,left:0,width:Qe.width||"100%",height:Qe.height||"100%",pointerEvents:"none",zIndex:10,overflow:"visible",transition:"opacity 0.15s ease-in-out"}},{children:[vt&&!we&&o("g",{children:[i("line",{x1:vt.x1,y1:vt.y,x2:Math.max(vt.x1,(vt.x1+vt.x2)/2-70),y2:vt.y,stroke:"#BBF7D0",strokeWidth:"1.5"}),i("line",{x1:Math.min(vt.x2,(vt.x1+vt.x2)/2+70),y1:vt.y,x2:vt.x2,y2:vt.y,stroke:"#BBF7D0",strokeWidth:"1.5"})]}),lt.map(function(n){var t,r=n.x1+.5*(n.x2-n.x1),l=(n.y1+n.y2)/2;if("Not Defined"===n.style.label&&!n.hasCognitive)return null;var c=!1;if(n.isSubSection)c=we&&at===n.subSectionKeyPath&&_e;else{var u=zn[n.sectionIdx];(se?!(null===(t=null==u?void 0:u.refIndexes)||void 0===t?void 0:t.length)||(null==u?void 0:u.selfIndex)<0:!Ln[n.sectionIdx])||(c=we&&at===n.sectionIdx&&_e)}if(c)return o("g",e({style:{transition:"opacity 0.2s"}},{children:[i("defs",{children:i("marker",e({id:"arr-".concat(n.id),markerWidth:"7",markerHeight:"5",refX:"7",refY:"2.5",orient:"auto"},{children:i("polygon",{points:"0 0, 7 2.5, 0 5",fill:n.style.badgeBorder||"#6366F1"})}))}),i("line",{ref:tt,x1:n.x1,y1:n.y1,x2:n.x2,y2:n.y2,stroke:n.style.badgeBorder||"#6366F1",strokeWidth:"1.5",markerEnd:"url(#arr-".concat(n.id,")")})]}),n.id);if(!se){var a=n.isSubSection?P(n.x1,n.y1,n.x2,n.y2):"M ".concat(n.x1," ").concat(n.y1," L ").concat(n.x2," ").concat(n.y2);return o("g",{children:[i("path",{d:a,fill:"none",stroke:n.style.badgeBorder||"#E2E8F0",strokeWidth:"1.5"}),i("foreignObject",e({x:r-100,y:l-14,width:"200",height:"28",style:{pointerEvents:"auto",overflow:"visible"}},{children:i(v,e({sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},{children:o(v,e({onClick:function(t){if(t.stopPropagation(),tn.open&&Te===n.id)mn();else{var i=zn[n.sectionIdx]||{title:"",content:""},o=Ln[n.sectionIdx]||{title:"",content:""};if(n.isSubSection&&n.subSectionKeyPath){for(var r=n.subSectionKeyPath.split(z)[2].split("-").map(Number),l=zn[r[0]],c=Ln[r[0]],u=(null==l?void 0:l.title)||"",a=(null==c?void 0:c.title)||"",d=1;d<r.length;d++)(null==l?void 0:l.subsections)&&(l=l.subsections[r[d]]),(null==c?void 0:c.subsections)&&(c=c.subsections[r[d]]);l&&(i=e(e({},l),{title:u||l.title})),c&&(o=e(e({},c),{title:a||c.title}))}Me(n.id),Gn($n(t.currentTarget,i,o,n.sectionIdx,n.style))}},sx:{display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",bgcolor:n.style.badgeBg,color:n.style.badgeText,border:"1px solid ".concat(n.style.badgeBorder),borderRadius:"12px",px:1.5,py:.5,fontWeight:600,textAlign:"center",whiteSpace:"nowrap",cursor:"pointer"}},{children:[0===n.style.label?"Same":n.style.label,i(v,e({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:i(R,{})})),i(w,{size:11,style:{transform:tn.open&&Te===n.id?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))}))]},n.id)}return null}),Oe.map(function(n){var t,r=n.pathD,l=(null===(t=n.style)||void 0===t?void 0:t.badgeBorder)||"#6366F1",c="conn-marker-".concat(n.id),u="".concat(n.id,"-bg"),a="".concat(n.id,"-stroke");return o("g",{children:[i("defs",{children:i("clipPath",e({id:"connections-clip"},{children:i("marker",e({id:c,markerWidth:"8",markerHeight:"6",refX:"7",refY:"3",orient:"auto"},{children:i("polygon",{points:"0 0, 8 3, 0 6",fill:l})}))}))}),i("path",{ref:function(e){je.current[u]=e},d:r,fill:"none",stroke:"#FFFFFF",strokeWidth:"4",strokeOpacity:"0.7"}),i("path",{ref:function(e){je.current[a]=e},d:r,fill:"none",stroke:l,strokeWidth:"1.75",markerEnd:"url(#".concat(c,")")})]},n.id)})]})),o(v,e({sx:e({border:"1px solid #E7E7E9",borderRadius:"8px",bgcolor:"#FFFFFF",display:"flex",flexDirection:"column",position:"relative",zIndex:2,filter:"drop-shadow(0px 2px 4px #F2F2F2)"},se?{flex:1,overflow:"visible"}:{})},{children:[i(v,e({ref:it,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E7E7E9",borderRadius:"8px 8px 0 0",display:"flex",minHeight:"40px",alignItems:"center",overflowX:"hidden"}},{children:i(m,e({title:Nn,placement:"top"},{children:i(f,e({sx:{fontSize:"16px",fontWeight:500,color:"#19213D",overflow:"hidden",display:"flex",alignItems:"center",justifyContent:"center",textOverflow:"ellipsis",whiteSpace:"normal",width:"100%",height:"40px"}},{children:Nn}))}))})),o(v,e({ref:hn,onScroll:At,sx:e({p:"12px",display:"flex",flexDirection:"column"},se?{maxHeight:"calc(100vh - 150px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,mr:"-160px",pr:"172px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[i("div",{ref:fn,style:{width:"100%",height:"0px",flexShrink:0}}),jn&&zn.map(function(n,t){var r,c,u=!n.title&&!n.content;if(se&&u)return null;var a=n,d=_t(t),s=se?!(null===(r=a.refIndexes)||void 0===r?void 0:r.length)||a.selfIndex<0:!Ln[t],f=se?"number"==typeof a.selfIndex&&a.selfIndex>=0?a.selfIndex+1:null:t+1,p=Ae.has(t),h=function(e,n){var t,i,o,r,l,c;if(!e)return n;var u=null!==(c=null!==(r=null!==(i=null===(t=e.evaluation_output)||void 0===t?void 0:t.output_score)&&void 0!==i?i:null===(o=e.evaluation_outputs)||void 0===o?void 0:o.output_score)&&void 0!==r?r:null===(l=e.evaluation_outputs)||void 0===l?void 0:l.output_value)&&void 0!==c?c:e.output_score;return null!=u?u:n}(a.evaluationResult,null==d?void 0:d.deviationLabel);return i(v,e({ref:qn(t),sx:{mb:1,width:"100%"}},{children:o(v,e({sx:{position:"relative",width:"100%"}},{children:[i(v,e({ref:xt.current[t],sx:e({width:"100%",display:"flex"},p&&{borderRadius:"6px",outline:"2px solid ".concat((null==d?void 0:d.badgeBorder)||"#6366F1"),outlineOffset:"1px"})},{children:Ot({section:n,idx:t,columnKey:"left",colRef:l.createRef(),mb:0,parentNodeId:(null===(c=null==ee?void 0:ee.input_index_map)||void 0===c?void 0:c[0])||""})})),se&&d&&o(v,e({ref:yt.current[t],onClick:function(e){var i=se?Ln.find(function(e){var n;return null===(n=a.refIndexes)||void 0===n?void 0:n.includes(e.selfIndex)})||{title:"",content:""}:Ln[t]||{title:"",content:""};Jn(e,n,s,i,t,d)},sx:{position:"absolute",top:"18px",right:0,transform:"translateY(-50%) translateX(calc(100% + 8px))",display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",bgcolor:d.badgeBg,color:d.badgeText,border:"1px solid ".concat(d.badgeBorder),borderRadius:"12px",px:1.2,py:.4,fontWeight:600,cursor:"pointer",whiteSpace:"nowrap",zIndex:20,boxShadow:"0 1px 3px rgba(0,0,0,0.07)"}},{children:[null!==f&&i(v,e({component:"span",sx:{fontSize:"11px",fontWeight:700,pr:.5,borderRight:"1px solid ".concat(d.badgeBorder)}},{children:f})),i(v,e({component:"span",sx:{fontSize:"11px",px:.25}},{children:s?"No Deviation Found":"N/A"===h||"NA"===h?"N/A":0==h||null==h?"Same":"".concat(h)})),i(S,{size:11,color:d.badgeText})]}))]}))}),"left-row-".concat(t))}),i("div",{ref:pn,style:{width:"100%",height:"0px",flexShrink:0}})]}))]})),i(v,e({sx:{width:"180px",display:"flex",flexDirection:"column",alignItems:"center",pt:"15px",gap:0}},{children:i(v,e({sx:{display:"flex",justifyContent:"center",alignItems:"center",mt:0}},{children:o(v,e({sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:"5px",borderRadius:"20px",bgcolor:"#ECFDF3",border:"1px solid #A7F3D0",color:"#15803D",fontSize:"12px",fontWeight:600,whiteSpace:"nowrap",position:"relative",zIndex:1}},{children:[i(v,e({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:i(R,{})})),0,"% Similarity",i(w,{size:11})]}))}))})),o(v,e({sx:e({border:"1px solid #E3E6EA",borderRadius:"8px",bgcolor:"#FFFFFF",boxShadow:"0px 1px 4px #F7F4FE",position:"relative",zIndex:2,display:"flex",flexDirection:"column",minWidth:0},se?{flex:1,overflow:"visible",minHeight:0}:{})},{children:[xe&&i(C,{sections:11}),i(v,e({ref:ot,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E3E6EA",borderRadius:"8px 8px 0 0",minHeight:"40px",display:"flex",alignItems:"center",overflowX:"hidden"}},{children:i(m,e({title:Wn,placement:"top"},{children:i(f,e({sx:{fontSize:"16px",fontWeight:500,color:"#5928ED",overflow:"hidden",display:"flex",justifyContent:"center",alignItems:"center",textOverflow:"ellipsis",whiteSpace:"normal",width:"100%",height:"40px"}},{children:Wn}))}))})),o(v,e({ref:dn,onScroll:At,sx:e({p:"12px",display:"flex",flexDirection:"column"},se?{maxHeight:"calc(100vh - 150px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,ml:"-25px",pl:"45px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[i("div",{ref:sn,style:{width:"100%",height:"0px",flexShrink:0}}),jn&&Ln.map(function(n,t){var r,c=n,u=[],a=!1,d=null;if(se){u=zn.filter(function(e){var n;return(null===(n=e.refIndexes)||void 0===n?void 0:n.includes(c.selfIndex))&&e.selfIndex>=0}).map(function(e){return e.selfIndex+1});var s=zn.findIndex(function(e,n){var t;return Ae.has(n)&&(null===(t=e.refIndexes)||void 0===t?void 0:t.includes(c.selfIndex))});(a=-1!==s)&&(d=_t(s))}else u=[t+1],(a=Ae.has(t))&&(d=_t(t));var f=_t(t);return i(v,e({ref:It.current[t],sx:{mb:1,width:"100%"}},{children:o(v,e({sx:{position:"relative",width:"100%"}},{children:[i(v,e({ref:mt.current[t],sx:e({width:"100%",display:"flex"},a&&d&&{borderRadius:"6px",outline:"2px solid ".concat(d.badgeBorder),outlineOffset:"1px"})},{children:Ot({section:n,idx:t,columnKey:"right",colRef:l.createRef(),mb:0,parentNodeId:(null===(r=null==ee?void 0:ee.input_index_map)||void 0===r?void 0:r[1])||""})})),se&&!xe&&f&&i(v,e({ref:bt.current[t],sx:{position:"absolute",top:"18px",left:0,transform:"translateY(-50%) translateX(calc(-100% - 8px))",display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:"11px",bgcolor:f.badgeBg,color:f.badgeText,border:"1px solid ".concat(f.badgeBorder),borderRadius:"10px",px:1,py:.3,fontWeight:700,whiteSpace:"nowrap",zIndex:20}},{children:u.length>0?u.join(", "):"-"}))]}))}),"right-row-".concat(t))}),i("div",{ref:vn,style:{width:"100%",height:"0px",flexShrink:0}})]}))]}))]}))}))}))]}))};export{q as default};
|
|
1
|
+
import{__assign as e,__rest as n,__spreadArray as t}from"tslib";import{jsx as i,jsxs as o,Fragment as r}from"react/jsx-runtime";import l,{useMemo as c,useState as u,useRef as a,useEffect as d,useCallback as s}from"react";import{Box as v,Typography as f,Snackbar as p,Alert as h,FormControlLabel as g,Switch as x,Tooltip as m,Accordion as b,AccordionSummary as y,AccordionDetails as I}from"@mui/material";import{EllipsisVertical as S,ChevronDown as w}from"lucide-react";import{ButtonCognitiveIcon as R}from"../../assests/svg/ButtonCognitiveIcon.js";import _ from"./OverlayComponent.js";import C from"react-markdown";import{safeStringify as F,generateColorPalette as B,hasValue as E,getSideData as T,getRationale as M}from"./CognitiveComparehelpers.js";import{SHARED_MARKDOWN_STYLES as k,DEFAULT_FIELD_CONFIG as A,DEFAULT_COMPARISON_CONFIG as D}from"./CognitiveCompareConfig.js";export{SHARED_MARKDOWN_STYLES}from"./CognitiveCompareConfig.js";import H from"./CognitivePopup.js";import O from"./MoreFunctionsPopup.js";import N from"./LoaderComponent.js";import W from"rehype-raw";var z="::",L=function(e){if(!e)return!0;var n=e.trim().toLowerCase();return n.includes("no equivalent")||"n/a"===n||"na"===n||"none"===n},j=function(e,n){var t,i,o,r,l,c,u;if(!e)return n;var a=null!==(c=null!==(r=null!==(i=null===(t=e.evaluation_output)||void 0===t?void 0:t.output_score)&&void 0!==i?i:null===(o=e.evaluation_outputs)||void 0===o?void 0:o.output_score)&&void 0!==r?r:null===(l=e.evaluation_outputs)||void 0===l?void 0:l.output_value)&&void 0!==c?c:e.output_score;return null!==(u=null!=a?a:n)&&void 0!==u?u:""},P=l.memo(function(t){var l=t.content,u=t.sxStyles,a=t.deviationBadges,d=void 0===a?[]:a,s=t.highlights,p=void 0===s?[]:s,h=t.maintainRelativeOrder,g=void 0===h||h,x=t.highlightBg,m=c(function(){return d.reduce(function(n,t){var i;return e(e({},n),((i={})[t.id]=t,i))},{})},[d]),b=c(function(){return{mark:function(n){var t=n.children;return i("span",e({style:{backgroundColor:x,borderRadius:"2px"}},{children:t}))},span:function(t){var l,c,u,a,d,s=t.children,f=n(t,["children"]),p=f["data-badge-id"];if(!p)return i("span",e({},f,{children:s}));var h=m[p];return h?o(v,e({component:"span",sx:{position:"static",display:"inline"}},{children:[s,i(v,e({ref:h.badgeRef,onClick:h.onClick,sx:e(e({position:"absolute",zIndex:30,display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"10px",bgcolor:(null===(l=h.style)||void 0===l?void 0:l.badgeBg)||"#EEF2FF",color:(null===(c=h.style)||void 0===c?void 0:c.badgeText)||X,border:"1px solid ".concat((null===(u=h.style)||void 0===u?void 0:u.badgeBorder)||"#C7D2FE"),borderRadius:"12px",px:1,py:.3,fontWeight:600,cursor:"pointer",whiteSpace:"nowrap",boxShadow:"0 1px 3px rgba(0,0,0,0.07)"},"left"===h.side?{right:"-16px",transform:"translateY(-20%) translateX(calc(100% + 8px))"}:{left:"-16px",transform:"translateY(-20%) translateX(calc(-100% - 8px))"}),h.isConnected&&h.style&&{outline:"2px solid ".concat(h.style.badgeBorder),outlineOffset:"1px"})},{children:o(r,{children:[i(v,e({component:"span",sx:e({fontSize:"10px",fontWeight:700},"left"===h.side?{pr:.5,borderRight:"1px solid ".concat((null===(a=h.style)||void 0===a?void 0:a.badgeBorder)||"#C7D2FE")}:{})},{children:h.label})),"left"===h.side&&o(r,{children:[i(v,e({component:"span",sx:{fontSize:"10px",px:.25}},{children:null!=h.score&&"N/A"!==h.score&&"NA"!==h.score&&0!==h.score?"".concat(h.score):"N/A"===h.score||"NA"===h.score?"N/A":"Same"})),i(S,{size:10,color:(null===(d=h.style)||void 0===d?void 0:d.badgeText)||"#3730A3"})]})]})}))]})):i("span",e({},f,{children:s}))}}},[m,g]),y=c(function(){var e=l||"",n={},t=0;return function(){var i=null==d?void 0:d[0];if(i&&i.highlight){var o=i.highlight.replace(/\\(['’])/g,"$1"),r="__DEV_TOKEN_".concat(t++,"__");n[r]='<span data-badge-id="'.concat(i.id,'"><mark>').concat(o,"</mark></span>"),e=e.replace(o,r)}}(),p.forEach(function(i){if(i){var o=i.replace(/\\(['’])/g,"$1"),r="__HL_TOKEN_".concat(t++,"__");n[r]="<mark>".concat(o,"</mark>"),e=e.split(o).join(r)}}),Object.keys(n).forEach(function(t){e=e.split(t).join(n[t])}),e},[l,d,p]);return i(f,e({component:"div",sx:e(e({},u),{position:"relative",overflow:"visible","& p, & li, & ul, & ol":{position:"static",overflow:"visible"}})},{children:i(C,e({components:b,rehypePlugins:[W]},{children:F(y).replace(/\\n/g,"\n")}))}))},function(e,n){if(e.content!==n.content)return!1;if(e.sxStyles!==n.sxStyles)return!1;if(e.maintainRelativeOrder!==n.maintainRelativeOrder)return!1;var t=e.highlights||[],i=n.highlights||[];if(t.length!==i.length)return!1;for(var o=0;o<t.length;o++)if(t[o]!==i[o])return!1;var r=e.deviationBadges||[],l=n.deviationBadges||[];if(r.length!==l.length)return!1;for(o=0;o<r.length;o++){if(r[o].id!==l[o].id)return!1;if(r[o].label!==l[o].label)return!1;if(r[o].isConnected!==l[o].isConnected)return!1}return!0}),Y=function(e,n,t,i,o){void 0===o&&(o=14);var r=e+.5*(t-e),l=i-n;if(Math.abs(l)<3)return"M ".concat(e," ").concat(n," H ").concat(t);var c=l>0?1:-1,u=Math.min(o,Math.abs(l)/2,Math.abs(r-e)/2,Math.abs(t-r)/2);return["M ".concat(e," ").concat(n),"H ".concat(r-u),"Q ".concat(r," ").concat(n," ").concat(r," ").concat(n+c*u),"V ".concat(i-c*u),"Q ".concat(r," ").concat(i," ").concat(r+u," ").concat(i),"H ".concat(t)].join(" ")},K={id:"",title:""},V={open:!1,sectionTitle:"",refSectionTitle:"",cognitiveData:null,anchorEl:null,sectionAnchorEl:null,badgeStyle:null,sectionIdx:null,isOrphan:!1,docData:null,deviationData:null},X="#3730A3",q=function(e,n,t,i,o){void 0===t&&(t=300);var r=e.style.scrollBehavior;e.style.scrollBehavior="auto";var l=e.scrollTop,c=n-l,u=null,a=function(d){null===u&&(u=d);var s,v=d-u;v<t?(e.scrollTop=(s=v,s/=t,c*(--s*s*s+1)+l),o&&o(),requestAnimationFrame(a)):(e.scrollTop=n,e.style.scrollBehavior=r,o&&o(),i&&i())};requestAnimationFrame(a)},U=function(n){var r,C,W,U,$,G,J,Q,Z,ee,ne,te,ie,oe=n.componentHeaderText,re=void 0===oe?"Contract Comparison":oe,le=n.treeData,ce=n.comparisonConfig,ue=n.leftColumnTitleText,ae=n.rightColumnTitleText,de=n.markdownStyles,se=n.displayConfig,ve=void 0===se?{isHeaderVisible:!0,isToggleVisible:!0,maintainRelativeOrder:!1}:se,fe=n.popupConfig,pe=n.deviationData,he=void 0===pe?{}:pe,ge=u(ve.maintainRelativeOrder),xe=ge[0],me=ge[1],be=u(!1),ye=be[0],Ie=be[1],Se=u(!1),we=Se[0],Re=Se[1],_e=u(null),Ce=_e[0],Fe=_e[1],Be=u(!1),Ee=Be[0],Te=Be[1],Me=u(!1),ke=Me[0],Ae=Me[1],De=a(!1),He=u(null),Oe=He[0],Ne=He[1],We=u(new Set),ze=We[0],Le=We[1],je=u([]),Pe=je[0],Ye=je[1],Ke=a(null),Ve=a(!1),Xe=a(null),qe=a({}),Ue=a([]),$e=a(!1),Ge=a(!1),Je=a(null),Qe=c(function(){return(null==le?void 0:le.cognitive_decisioning)||{}},[le]),Ze=u(null),en=Ze[0],nn=Ze[1],tn=a(null),on=u({width:0,height:0}),rn=on[0],ln=on[1],cn=c(function(){return e(e({},k),de)},[de]),un=u({open:!1,sectionTitle:"",refSectionTitle:"",cognitiveData:null,anchorEl:null,isOrphan:!1,sectionAnchorEl:null,badgeStyle:null,sectionIdx:null,docData:null,deviationData:null}),an=un[0],dn=un[1],sn=u({open:!1,sectionTitle:"",refSectionTitle:"",cognitiveData:null,anchorEl:null,isOrphan:!1,sectionAnchorEl:null,badgeStyle:null,sectionIdx:null,docData:null,deviationData:null}),vn=sn[0],fn=sn[1],pn=a(null),hn=a(null),gn=a(null),xn=a(null),mn=a(null),bn=a(null),yn=a(null),In=a(null),Sn=a(!1),wn=a(null);d(function(){wn.current=null},[an.sectionIdx,an.open]);var Rn=s(function(){nn(null),dn(V),Ne(null)},[]),_n=s(function(){fn(V)},[]),Cn=s(function(){var e;if(an.anchorEl&&an.refSectionTitle){var n=an.anchorEl.getBoundingClientRect(),t=(null===(e=null==tn?void 0:tn.current)||void 0===e?void 0:e.offsetHeight)||0,i=Math.min(680,window.innerWidth-24),o=window.innerHeight-n.bottom-12-12,r=n.top-12-12,l=o<t&&r>o;null!==wn.current?!0===wn.current&&(l=r>=t||r>=o):l=!(o>=t||o>=r),wn.current=l;var c=l?r:o,u=Math.min(t||9999,c),a=l?n.top-12-u:n.bottom+12,d=n.left+n.width/2,s=d-i/2,v=Math.max(12,Math.min(s,window.innerWidth-i-12)),f=Math.max(14,Math.min(d-v,i-10-4));nn({top:a,left:v,arrowLeft:f,openAbove:l,maxHeight:c})}},[an.anchorEl,an.refSectionTitle]);d(function(){if(an.open){window.addEventListener("resize",Cn);var e=requestAnimationFrame(Cn),n=null;return tn.current&&(n=new ResizeObserver(function(){cancelAnimationFrame(e),e=requestAnimationFrame(Cn)})).observe(tn.current),function(){cancelAnimationFrame(e),window.removeEventListener("resize",Cn),n&&n.disconnect()}}},[an.open,Cn]),d(function(){var e=pn.current;if(e&&an.open){var n=function(e){tn.current&&tn.current.contains(e.target)||(nn(null),Rn())};return e.addEventListener("scroll",n,{capture:!0}),window.addEventListener("scroll",n,{capture:!0}),function(){e.removeEventListener("scroll",n,{capture:!0}),window.removeEventListener("scroll",n,{capture:!0})}}},[an.open,Rn]),d(function(){var e=pn.current;if(e&&vn.open){var n=function(){_n()};return e.addEventListener("scroll",n,{capture:!0}),window.addEventListener("scroll",n,{capture:!0}),function(){e.removeEventListener("scroll",n,{capture:!0}),window.removeEventListener("scroll",n,{capture:!0})}}},[vn.open,_n]);var Fn=c(function(){var e,n,t,i,o,r,l;return{fields:null!==(e=null==ce?void 0:ce.fields)&&void 0!==e?e:A,thresholds:{high:null!==(t=null===(n=null==ce?void 0:ce.thresholds)||void 0===n?void 0:n.high)&&void 0!==t?t:D.thresholds.high,medium:null!==(o=null===(i=null==ce?void 0:ce.thresholds)||void 0===i?void 0:i.medium)&&void 0!==o?o:D.thresholds.medium,exact:null!==(l=null===(r=null==ce?void 0:ce.thresholds)||void 0===r?void 0:r.exact)&&void 0!==l?l:D.thresholds.exact}}},[ce]),Bn=c(function(){if(le&&Object.keys(le).length>0)try{var n=function(n,i,o){var r,l,c,u;void 0===i&&(i=!1),void 0===o&&(o=null);var a=n.nodes||n,d=[],s=[],v=n.base_root_id,f=n.input_index_map||{0:"left",1:"right"},p=n[v]||a[v];if(!p||!1===p.display_node)return{activeProposed:{title:"No Data",sections:[]},activeVariants:[]};var h=function(t,i){var r,l,c,u=n[t]||a[t];if(!u||!1===u.display_node)return null;var d=T(u,i,f),s=!1!==(null===(r=d.attributes)||void 0===r?void 0:r.display_title),v=!1!==(null===(l=d.attributes)||void 0===l?void 0:l.display_content),p=!!d.title.trim(),g=!!d.content.trim(),x=M(u),m=(null===(c=null==o?void 0:o[t])||void 0===c?void 0:c.evaluation_result)||u.evaluation_result||null,b=[];u.next&&Object.values(u.next).forEach(function(e){var n=a[e];if(n&&!1!==n.display_node){var t=h(e,i);t&&b.push(t)}});var y=!(!p&&!g);return e(e({id:t,title:p?d.title:"",content:g?d.content:"",displayTitle:s,displayContent:v,subsections:b},y?x:{score:void 0,relation:"not_defined"}),{evaluationResult:m})};if(i){var g=function(i,r){var l,c,u,d,s,v,p,h,x,m,b,y,I,S,w,R,_,C,F,B,E;void 0===r&&(r=0);var k=[],A=[];if(!i)return{refSections:k,baseSections:A};var D={},H={},O=-1,N=-1;for(var W in i){var z=i[W],L=n[z]||a[z];if(L&&!1!==L.display_node){var j=M(L),P=(null===(l=null==o?void 0:o[z])||void 0===l?void 0:l.evaluation_result)||L.evaluation_result||null,Y=T(L,"1",f),K=T(L,"0",f),V=!1!==(null===(c=Y.attributes)||void 0===c?void 0:c.display_title)&&Y.title.trim()||!1!==(null===(u=Y.attributes)||void 0===u?void 0:u.display_content)&&Y.content.trim(),X=!1!==(null===(d=K.attributes)||void 0===d?void 0:d.display_title)&&K.title.trim()||!1!==(null===(s=K.attributes)||void 0===s?void 0:s.display_content)&&K.content.trim(),q=Number(null!==(p=null===(v=Y.attributes)||void 0===v?void 0:v.display_index)&&void 0!==p?p:O--),U=Number(null!==(x=null===(h=K.attributes)||void 0===h?void 0:h.display_index)&&void 0!==x?x:N--),$=D[q]||e(e({id:z,title:!1!==(null===(m=Y.attributes)||void 0===m?void 0:m.display_title)?Y.title:"",content:!1!==(null===(b=Y.attributes)||void 0===b?void 0:b.display_content)?Y.content:"",subsections:[]},V?j:{score:void 0,relation:"not_defined"}),{refIndexes:[],selfIndex:q,evaluationResult:P,displayContent:null===(y=Y.attributes)||void 0===y?void 0:y.display_content,displayTitle:null===(I=Y.attributes)||void 0===I?void 0:I.display_title}),G=H[U]||e(e({id:z,title:!1!==(null===(S=K.attributes)||void 0===S?void 0:S.display_title)?K.title:"",content:!1!==(null===(w=K.attributes)||void 0===w?void 0:w.display_content)?K.content:"",subsections:[]},X?j:{score:void 0,relation:"not_defined"}),{refIndexes:[],selfIndex:U,evaluationResult:P,displayContent:null===(R=K.attributes)||void 0===R?void 0:R.display_content,displayTitle:null===(_=K.attributes)||void 0===_?void 0:_.display_title});Number(q)>=0&&Number(U)>=0&&((null===(C=$.refIndexes)||void 0===C?void 0:C.includes(Number(U)))||null===(F=$.refIndexes)||void 0===F||F.push(Number(U)),(null===(B=G.refIndexes)||void 0===B?void 0:B.includes(Number(q)))||null===(E=G.refIndexes)||void 0===E||E.push(Number(q))),D[q]=$,H[U]=G;var J=g(L.next,r+1),Q=J.refSections,Z=J.baseSections;Q.length>0&&($.subsections=t(t([],$.subsections||[],!0),Q,!0)),Z.length>0&&(G.subsections=t(t([],G.subsections||[],!0),Z,!0))}}return k=Object.values(D).map(function(e){return e}),A=Object.values(H).map(function(e){return e}),k.sort(function(e,n){return e.selfIndex<0&&n.selfIndex>=0?1:e.selfIndex>=0&&n.selfIndex<0?-1:e.selfIndex-n.selfIndex}),A.sort(function(e,n){return e.selfIndex<0&&n.selfIndex>=0?1:e.selfIndex>=0&&n.selfIndex<0?-1:e.selfIndex-n.selfIndex}),{refSections:k,baseSections:A}},x=g(p.next),m=x.refSections,b=x.baseSections;s=m,d=b}else p.next&&Object.values(p.next).forEach(function(e){var t=n[e]||a[e];t&&!1!==t.display_node&&(d.push(h(e,"0")||{id:e,title:"",content:"",subsections:[]}),s.push(h(e,"1")||{id:e,title:"",content:"",subsections:[]}))});return{activeProposed:{title:(null===(l=null===(r=p.comparison_inputs)||void 0===r?void 0:r[f[0]])||void 0===l?void 0:l.title)||"Uploaded Contract",description:p.decision_scope_description||"",sections:d},activeVariants:[{id:"tree-variant-1",title:(null===(u=null===(c=p.comparison_inputs)||void 0===c?void 0:c[f[1]])||void 0===u?void 0:u.title)||"Reference Template",similarity:0,sections:s,analysis:{rule_difference_comparison:{summary:{overall_score:0,overall_summary:p.decision_scope_description||""},fields:{}}}}]}}(le,xe,he);return e(e({},n),{parseError:null})}catch(e){return console.error("Data Transformation Error: ",e),{activeProposed:{},activeVariants:[],parseError:e instanceof Error?e.message:"Unknown Parsing Error"}}return{activeProposed:{},activeVariants:[],parseError:"Tree data is required"}},[JSON.stringify(le),xe,JSON.stringify(he)]),En=Bn.activeProposed,Tn=Bn.activeVariants,Mn=Bn.parseError;d(function(){Mn&&Fe("Failed to load comparison: ".concat(Mn))},[Mn]);var kn=u(null),An=kn[0];kn[1];var Dn=u({}),Hn=Dn[0],On=Dn[1],Nn=u({}),Wn=Nn[0],zn=Nn[1],Ln=(null==Tn?void 0:Tn[0])||K,jn=null===(W=null===(r=null==le?void 0:le.documents)||void 0===r?void 0:r[null===(C=null==le?void 0:le.input_index_map)||void 0===C?void 0:C[0]])||void 0===W?void 0:W.title,Pn=null===(G=null===(U=null==le?void 0:le.documents)||void 0===U?void 0:U[null===($=null==le?void 0:le.input_index_map)||void 0===$?void 0:$[1]])||void 0===G?void 0:G.title,Yn=F(ue||jn||"Uploaded Contract"),Kn=F(ae||Pn||"Reference Template"),Vn=c(function(){return(null==En?void 0:En.sections)||[]},[null==En?void 0:En.sections]),Xn=c(function(){return Ln.sections||[]},[Ln.sections]),qn=Vn.length>0||Xn.length>0,Un=Ln.analysis,$n=F(null===(Q=null===(J=null==Un?void 0:Un.rule_difference_comparison)||void 0===J?void 0:J.summary)||void 0===Q?void 0:Q.overall_summary),Gn=!!$n.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),Jn=null!==(Z=null==le?void 0:le.base_root_id)&&void 0!==Z?Z:"-1",Qn=(null===(ee=null==he?void 0:he[Jn])||void 0===ee?void 0:ee.evaluation_result)||Jn.evaluation_result||null,Zn=j(Qn),et=B(null!==(ie=null===(te=null===(ne=null==Qn?void 0:Qn.evaluation_outputs)||void 0===ne?void 0:ne.metadata)||void 0===te?void 0:te.label_color)&&void 0!==ie?ie:""),nt=c(function(){var e,n,t={},i={},o=null===(e=null==le?void 0:le.input_index_map)||void 0===e?void 0:e[0],r=null===(n=null==le?void 0:le.input_index_map)||void 0===n?void 0:n[1],l=new Map,c=function(e){return e&&e.id?(l.has(e.id)||l.set(e.id,F(e.content||"").replace(/\\n/g,"\n")),l.get(e.id)):""},u=function(e,n,a,d,s){var v,f,p,h,g,x,m,b;e&&!s&&function(e,n,u,a){var d,s=(null===(d=null==e?void 0:e.evaluationResult)||void 0===d?void 0:d.deviations)||{};Object.keys(s).sort().forEach(function(d){var v=s[d];if(v){var f=v[o],p=v[r],h=!1,g=!1;if(!L(f)){var x=f.replace(/\\(['’])/g,"$1").replace(/\\n/g,"\n");if(n&&x){var m=c(n);m.includes(x)&&(h=!0,l.set(n.id,m.replace(x,"__TOKEN__")))}}if(!L(p)){var b=p.replace(/\\(['’])/g,"$1").replace(/\\n/g,"\n");if(u&&b){var y=c(u);y.includes(b)&&(g=!0,l.set(u.id,y.replace(b,"__TOKEN__")))}}if(h||g){var I="".concat(e.id).concat(z).concat(d);void 0===t[I]&&(void 0===i[a]&&(i[a]=1),t[I]=i[a]++)}}})}(e,n,a,d);for(var y=Math.max((null===(v=null==n?void 0:n.subsections)||void 0===v?void 0:v.length)||0,(null===(f=null==a?void 0:a.subsections)||void 0===f?void 0:f.length)||0,(null===(p=null==e?void 0:e.subsections)||void 0===p?void 0:p.length)||0),I=0;I<y;I++)u((null===(h=null==e?void 0:e.subsections)||void 0===h?void 0:h[I])||(null===(g=null==n?void 0:n.subsections)||void 0===g?void 0:g[I])||(null===(x=null==a?void 0:a.subsections)||void 0===x?void 0:x[I]),null===(m=null==n?void 0:n.subsections)||void 0===m?void 0:m[I],null===(b=null==a?void 0:a.subsections)||void 0===b?void 0:b[I],d,!1)};return Vn.forEach(function(e,n){var t,i=n+1;xe&&void 0!==e.selfIndex&&e.selfIndex>=0&&(i=e.selfIndex+1);var o=null;if(xe){var r=null===(t=e.refIndexes)||void 0===t?void 0:t[0];o=Xn.find(function(e){return e.selfIndex===r})}else o=Xn[n];u(e,e,o,i,!0)}),Xn.forEach(function(e,n){var t,i=n+1,o=!1;if(xe){var r=null===(t=e.refIndexes)||void 0===t?void 0:t[0],l=Vn.find(function(e){return e.selfIndex===r});l&&void 0!==l.selfIndex&&l.selfIndex>=0?i=l.selfIndex+1:(o=!0,void 0!==e.selfIndex&&e.selfIndex>=0&&(i=e.selfIndex+1))}else n>=Vn.length&&(o=!0);o&&u(e,null,e,i,!0)}),t},[Vn,Xn,xe,le]),tt=a({}),it=function(e){return tt.current[e]||(tt.current[e]=l.createRef()),tt.current[e]},ot=s(function(){var e,n,t,i;Te(!1),Ge.current=!1;var o=Je.current,r=st.current;if(null!==o)if("string"==typeof o&&o.includes(z)){var l=o.split(z);(c=null===(e=kt.current[l[2]])||void 0===e?void 0:e.current)&&(c.style.paddingTop="0px")}else{var c;(c=null===(n=Ft.current[o])||void 0===n?void 0:n.current)&&(c.style.paddingTop="0px")}if(null!==r)if("string"==typeof r&&r.includes(z)){l=r.split(z);(u=null===(t=At.current[l[3]])||void 0===t?void 0:t.current)&&(u.style.paddingTop="0px")}else{var u;(u=null===(i=Bt.current[r])||void 0===i?void 0:i.current)&&(u.style.paddingTop="0px")}yt(null),Je.current=null,st.current=null,Ae(!1),Re(!1),xn.current&&(xn.current.style.height="0px"),mn.current&&(mn.current.style.height="0px"),bn.current&&(bn.current.style.height="0px"),yn.current&&(yn.current.style.height="0px")},[]),rt=s(function(e,n,t,i,o,r,l){var c,u,a=F(null==n?void 0:n.id)||F(null==t?void 0:t.id)||"",d=(a?Qe[a]:null)||(null==n?void 0:n.cognitiveData)||(null==t?void 0:t.cognitiveData)||{section_id:a,decisioning:[],gap:[],relevance_score:0},s=null!==(u=null===(c=tt.current[i])||void 0===c?void 0:c.current)&&void 0!==u?u:null;return{open:!0,sectionTitle:(null==n?void 0:n.displayTitle)?null==n?void 0:n.title:"no title",refSectionTitle:(null==t?void 0:t.displayTitle)?null==t?void 0:t.title:"no title",cognitiveData:d,anchorEl:e,sectionAnchorEl:s,badgeStyle:r||null,sectionIdx:i,docData:{documents:null==le?void 0:le.documents,input_index_map:null==le?void 0:le.input_index_map},deviationData:(null==n?void 0:n.evaluationResult)||(null==t?void 0:t.evaluationResult)||null,isOrphan:!!o}},[Qe,le]),lt=s(function(e){_n(),nn(null),dn(e)},[_n]),ct=function(e,n,t,i,o,r){e.stopPropagation(),vn.open&&vn.sectionIdx===o?_n():(Rn(),fn(rt(e.currentTarget,n,i,o,t,r)))},ut=s(function(){null!==vn.sectionIdx&&vn.anchorEl?lt(e(e({},vn),{open:!0})):_n()},[vn,_n,lt]),at=s(function(){var e=vn.sectionIdx,n=vn.isOrphan;_n(),null!==e&&(n?Fe("No counterpart exists to connect to."):(Ge.current&&ot(),Le(function(n){return n.has(e)?new Set:new Set([e])})))},[vn.sectionIdx,_n,ot]),dt=a(null),st=a(null),vt=a(null),ft=a(null),pt=a(null),ht=u([]),gt=ht[0],xt=ht[1],mt=u(null),bt=mt[0],yt=mt[1];a(null);var It=u(null),St=It[0],wt=It[1],Rt=c(function(){return Fn.fields.filter(function(e){var n=e.key;return(!qn||"description"!==n)&&(E(null==En?void 0:En[n])||E(Ln[n]))})},[En,Ln,qn,Fn.fields]),_t=a({}),Ct=a({}),Ft=a({}),Bt=a({}),Et=a({}),Tt=a({}),Mt=a({}),kt=a({}),At=a({});Rt.forEach(function(e){for(var n=e.key,t=0;t<Math.max(Vn.length,Xn.length);t+=1)Ft.current[t]||(Ft.current[t]=l.createRef()),Bt.current[t]||(Bt.current[t]=l.createRef()),Et.current[t]||(Et.current[t]=l.createRef()),Tt.current[t]||(Tt.current[t]=l.createRef()),Mt.current[t]||(Mt.current[t]=l.createRef());_t.current[n]||(_t.current[n]=l.createRef()),Ct.current[n]||(Ct.current[n]=l.createRef())});for(var Dt=0;Dt<Math.max(Vn.length,Xn.length);Dt+=1)Ft.current[Dt]||(Ft.current[Dt]=l.createRef()),Bt.current[Dt]||(Bt.current[Dt]=l.createRef()),Et.current[Dt]||(Et.current[Dt]=l.createRef()),Tt.current[Dt]||(Tt.current[Dt]=l.createRef()),Mt.current[Dt]||(Mt.current[Dt]=l.createRef());d(function(){if(An){var e=Fn.fields.find(function(e){return e.analysisKey===An||e.key===An});if(e){var n=_t.current[e.key]||Ct.current[e.key];(null==n?void 0:n.current)&&setTimeout(function(){return n.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[An,Fn.fields]);var Ht=s(function(e){var n,t,i,o,r,l,c,u,a,d=null===(n=null==Un?void 0:Un.rule_difference_comparison)||void 0===n?void 0:n.fields;if(!d||!d[e])return{score:0,relation:"",highlightsA:[],highlightsB:[],hasContent:!1};var s=d[e],v=(null==s?void 0:s.relation)||(null===(i=null===(t=null==s?void 0:s.highlights)||void 0===t?void 0:t.ruleA_spans)||void 0===i?void 0:i.length)||(null===(r=null===(o=null==s?void 0:s.highlights)||void 0===o?void 0:o.ruleB_spans)||void 0===r?void 0:r.length)||(null==s?void 0:s.mappings)&&s.mappings.length>0;if(s.mappings){var f=s.mappings[0]||{};return{score:s.score,relation:f.relation||"",highlightsA:(null===(l=f.highlights)||void 0===l?void 0:l.ruleA_spans)||[],highlightsB:(null===(c=f.highlights)||void 0===c?void 0:c.ruleB_spans)||[],hasContent:!!v}}return{score:s.score,relation:s.relation||"",highlightsA:(null===(u=s.highlights)||void 0===u?void 0:u.ruleA_spans)||[],highlightsB:(null===(a=s.highlights)||void 0===a?void 0:a.ruleB_spans)||[],hasContent:!!v}},[Un]),Ot=s(function(n){var t,i,o,r,l,c,u,a=Vn[n],d=Xn[n],s=(null==a?void 0:a.relation)&&"not_defined"!==a.relation,v=(null==d?void 0:d.relation)&&"not_defined"!==d.relation;F(null==a?void 0:a.id)||F(null==d?void 0:d.id);var f=!(!(null==a?void 0:a.cognitiveData)&&!(null==d?void 0:d.cognitiveData));if(!s&&!v&&!f)return e(e({},B(X)),{label:"Not Defined"});var p=null!==(i=null!==(t=null==a?void 0:a.evaluationResult)&&void 0!==t?t:null==d?void 0:d.evaluationResult)&&void 0!==i?i:null,h=null===(o=null==p?void 0:p.evaluation_outputs)||void 0===o?void 0:o.output_value,g=null!==(c=null===(l=null===(r=null==p?void 0:p.evaluation_outputs)||void 0===r?void 0:r.metadata)||void 0===l?void 0:l.label_color)&&void 0!==c?c:X;return e(e({},B(g)),null!=p?{label:null!==(u=h)&&void 0!==u?u:""}:{label:"N/A"})},[Vn,Xn,Qe,Fn,Ht]),Nt=s(function(n){for(var t,i,o,r,l,c,u,a,d,s=n.split("-").map(Number),v=Vn[s[0]],f=Xn[s[0]],p=1;p<s.length;p++)(null==v?void 0:v.subsections)&&(v=v.subsections[s[p]]),(null==f?void 0:f.subsections)&&(f=f.subsections[s[p]]);if(!v&&!f)return null;var h=(null==v?void 0:v.relation)&&"not_defined"!==v.relation,g=(null==f?void 0:f.relation)&&"not_defined"!==f.relation,x=F(null==v?void 0:v.id)||F(null==f?void 0:f.id)||"",m=!(!(null==v?void 0:v.cognitiveData)&&!(null==f?void 0:f.cognitiveData));if(!h&&!g&&!m)return e(e({},B(X)),{label:"Not Defined"});null!==(i=null!==(t=null==v?void 0:v.cognitiveRelevanceScore)&&void 0!==t?t:null==f?void 0:f.cognitiveRelevanceScore)&&void 0!==i||x&&(null===(o=Qe[x])||void 0===o||o.relevance_score);var b=null!==(l=null!==(r=null==v?void 0:v.evaluationResult)&&void 0!==r?r:null==f?void 0:f.evaluationResult)&&void 0!==l?l:null,y=null===(c=null==b?void 0:b.evaluation_outputs)||void 0===c?void 0:c.output_value,I=null!==(d=null===(a=null===(u=null==b?void 0:b.evaluation_outputs)||void 0===u?void 0:u.metadata)||void 0===a?void 0:a.label_color)&&void 0!==d?d:X;return e(e({},B(I)),null!=b?{label:null!=y?y:""}:{label:"N/A"})},[Vn,Xn,Qe,Fn]),Wt=s(function(){var e,n,t,i,o,r,l,c,u,a,d,s,v,f,p,h,g,x,m,b,y,I;if(!Sn.current&&!Ve.current){Sn.current=!0;try{if(!dt.current)return;var S=function(e){var n=e.split("-"),t=n[0];if(!Hn[t]&&!1===xe)return!1;if(xe&&!Hn["left-".concat(t)]&&!Hn["right-".concat(t)]&&!Hn[t])return!1;for(var i=t,o=1;o<n.length-1;o++)if(i+="-".concat(n[o]),!Wn[i])return!1;return!0},w=dt.current.getBoundingClientRect();ln({width:w.width,height:w.height});var R=[];if(Rt.forEach(function(e){var n,t,i=e.key,o=null===(n=_t.current[i])||void 0===n?void 0:n.current,r=null===(t=Ct.current[i])||void 0===t?void 0:t.current;o&&r&&(o.style.height="auto",r.style.height="auto",o.style.minHeight="0px",r.style.minHeight="0px")}),!Ve.current){for(var _=0;_<Math.max(Vn.length,Xn.length);_++){var C=null===(e=Ft.current[_])||void 0===e?void 0:e.current,F=null===(n=Bt.current[_])||void 0===n?void 0:n.current;C&&(C.style.height="auto",C.style.minHeight="0px"),F&&(F.style.height="auto",F.style.minHeight="0px")}xe||Object.keys(kt.current).forEach(function(e){var n,t;if(S(e)){var i=null===(n=kt.current[e])||void 0===n?void 0:n.current,o=null===(t=At.current[e])||void 0===t?void 0:t.current;i&&o&&(i.style.height="auto",o.style.height="auto",i.style.minHeight="0px",o.style.minHeight="0px")}})}var B={};Rt.forEach(function(e){var n,t,i=e.key,o=null===(n=_t.current[i])||void 0===n?void 0:n.current,r=null===(t=Ct.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=o.getBoundingClientRect(),c=r.getBoundingClientRect();B[i]=Math.max(l.height,c.height)}});var E={left:{},right:{}},T={};if(!Ve.current)if(xe){if(Ee&&null!==bt)if("number"==typeof bt){var M=bt,k=Vn[M],A=null===(o=Ft.current[M])||void 0===o?void 0:o.current;A&&k&&(k.refIndexes||[]).forEach(function(e){var n,t=Xn.findIndex(function(n){return n.selfIndex===e}),i=null===(n=Bt.current[t])||void 0===n?void 0:n.current;if(i&&(Hn["left-".concat(M)]||Hn["right-".concat(t)])){var o=Math.max(A.getBoundingClientRect().height,i.getBoundingClientRect().height);E.left[M]=Math.max(E.left[M]||0,o),E.right[t]=Math.max(E.right[t]||0,o)}})}else{var D=bt.split(z)[2];if(D){C=null===(r=kt.current[D])||void 0===r?void 0:r.current,F=null===(l=At.current[D])||void 0===l?void 0:l.current;if(C&&F){H=Math.max(C.getBoundingClientRect().height,F.getBoundingClientRect().height);T[D]=Math.max(T[D]||0,H)}}}}else{Object.keys(kt.current).forEach(function(e){var n,t;if(S(e)){var i=null===(n=kt.current[e])||void 0===n?void 0:n.current,o=null===(t=At.current[e])||void 0===t?void 0:t.current;if(i&&o&&null!==i.offsetParent&&null!==o.offsetParent){var r=i.getBoundingClientRect(),l=o.getBoundingClientRect(),c=Math.max(r.height,l.height);T[e]=c,i.style.minHeight="".concat(c,"px"),o.style.minHeight="".concat(c,"px")}}});for(_=0;_<Math.min(Vn.length,Xn.length);_++){var C=null===(t=Ft.current[_])||void 0===t?void 0:t.current,F=null===(i=Bt.current[_])||void 0===i?void 0:i.current;if(C&&F){var H=Math.max(C.getBoundingClientRect().height,F.getBoundingClientRect().height);E.left[_]=H,E.right[_]=H}}}if(Rt.forEach(function(e){var n,t,i=e.key,o=null===(n=_t.current[i])||void 0===n?void 0:n.current,r=null===(t=Ct.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=B[i];o.style.minHeight="".concat(l,"px"),r.style.minHeight="".concat(l,"px")}}),Ve.current||(Object.entries(E.left).forEach(function(e){var n,t=e[0],i=e[1],o=null===(n=Ft.current[Number(t)])||void 0===n?void 0:n.current;o&&(o.style.minHeight="".concat(i,"px"))}),Object.entries(E.right).forEach(function(e){var n,t=e[0],i=e[1],o=null===(n=Bt.current[Number(t)])||void 0===n?void 0:n.current;o&&(o.style.minHeight="".concat(i,"px"))}),xe||Object.keys(T).forEach(function(e){var n,t,i=null===(n=kt.current[e])||void 0===n?void 0:n.current,o=null===(t=At.current[e])||void 0===t?void 0:t.current;if(i&&o&&T[e]){var r=T[e];i.style.minHeight="".concat(r,"px"),o.style.minHeight="".concat(r,"px")}})),xe)Vn.forEach(function(e,n){var t;(null===(t=Ft.current[n])||void 0===t?void 0:t.current)&&(e.refIndexes||[]).forEach(function(e){var t,i,o,r,l,c,u,a,d,s,v=Xn.findIndex(function(n){return n.selfIndex===e});if(-1!==v){var f=null===(t=Et.current[n])||void 0===t?void 0:t.current,p=null===(i=Tt.current[v])||void 0===i?void 0:i.current;if(f&&p){var h=f.getBoundingClientRect(),g=p.getBoundingClientRect(),x=h.right-w.left,m=g.left-w.left,b=h.top+h.height/2-w.top,y=g.top+g.height/2-w.top;if(Ee&&bt===n){var I=null!==(r=null===(o=In.current)||void 0===o?void 0:o.getBoundingClientRect().top)&&void 0!==r?r:0,S=null!==(c=null===(l=gn.current)||void 0===l?void 0:l.getBoundingClientRect().top)&&void 0!==c?c:0,_=I+(null!==(a=null===(u=In.current)||void 0===u?void 0:u.clientHeight)&&void 0!==a?a:1/0),C=S+(null!==(s=null===(d=gn.current)||void 0===d?void 0:d.clientHeight)&&void 0!==s?s:1/0),F=h.top+h.height/2,B=function(e,n,t){return Math.max(n,Math.min(t,e))};b=B(F,I,_)-w.top,y=B(F,S,C)-w.top}var E=Ot(n);E&&R.push({id:"line-".concat(n,"-").concat(v),x1:x,y1:b,x2:m,y2:y,style:E,sectionIdx:n,targetRightIdx:v})}}})});else for(_=0;_<Math.min(Vn.length,Xn.length);_++){var O=null===(c=Ft.current[_])||void 0===c?void 0:c.current,N=null===(u=Bt.current[_])||void 0===u?void 0:u.current;if(O&&N){var W=O.getBoundingClientRect(),L=N.getBoundingClientRect(),j=Math.max(W.top,L.top)+18-w.top,P=(null===(a=Xn[_])||void 0===a?void 0:a.id)||"sec-".concat(_);(J=Ot(_))&&R.push({id:P,x1:W.right-w.left,y1:j,x2:L.left-w.left,y2:j,style:J,sectionIdx:_,hasCognitive:!!((null===(d=Vn[_])||void 0===d?void 0:d.cognitiveData)||(null===(s=Xn[_])||void 0===s?void 0:s.cognitiveData)||P&&Qe[P]),isSubSection:!1})}}if(Ee&&"string"==typeof bt&&bt.includes(z)){var K=bt.split(z),V=K[0],X=K[1],q=K[2],U=(K[3],"".concat(V).concat(z).concat(X)),$=null===(v=Et.current[U])||void 0===v?void 0:v.current,G=null===(f=Tt.current[U])||void 0===f?void 0:f.current;if($&&G){var J,Q=$.getBoundingClientRect(),Z=G.getBoundingClientRect(),ee=Q.right-w.left,ne=Z.left-w.left,te=Q.top+Q.height/2-w.top,ie=Z.top+Z.height/2-w.top;if(xe){var oe=null!==(h=null===(p=In.current)||void 0===p?void 0:p.getBoundingClientRect().top)&&void 0!==h?h:0,re=null!==(x=null===(g=gn.current)||void 0===g?void 0:g.getBoundingClientRect().top)&&void 0!==x?x:0,le=oe+(null!==(b=null===(m=In.current)||void 0===m?void 0:m.clientHeight)&&void 0!==b?b:1/0),ce=re+(null!==(I=null===(y=gn.current)||void 0===y?void 0:y.clientHeight)&&void 0!==I?I:1/0),ue=function(e,n,t){return Math.max(n,Math.min(t,e))};te=ue(Q.top+Q.height/2,oe,le)-w.top,ie=ue(Z.top+Z.height/2,re,ce)-w.top}(J=Nt(q))&&R.push({id:"line-subsec-".concat(U),x1:ee,y1:te,x2:ne,y2:ie,style:J,sectionIdx:Number(q.split("-")[0]),isSubSection:!0,subSectionKeyPath:bt})}}if(xt(R),ft.current&&pt.current){var ae=ft.current.getBoundingClientRect(),de=pt.current.getBoundingClientRect(),se=(ae.top+ae.height/2-w.top+de.top+de.height/2-w.top)/2;wt({x1:ae.right-w.left,x2:de.left-w.left,y:se})}else wt(null);if(ze.size>0){var ve=[],fe=In.current,pe=gn.current;if(fe&&pe){var he=[],ge=fe.getBoundingClientRect().top,me=pe.getBoundingClientRect().top,be=ge+fe.clientHeight,ye=me+pe.clientHeight,Ie=fe.scrollTop,Se=pe.scrollTop,we=w.top,Re=function(e,n,t){return Math.max(n,Math.min(t,e))};ze.forEach(function(e){var n,t,i,o,r;if("string"==typeof e&&e.includes(z)){var l=e.split(z),c=l[0],u=l[1],a=l[2],d=(l[3],"".concat(c).concat(z).concat(u)),s=null===(n=Et.current[d])||void 0===n?void 0:n.current,v=null===(t=Tt.current[d])||void 0===t?void 0:t.current;if(!s||!v)return;var f=s.getBoundingClientRect(),p=v.getBoundingClientRect(),h=Nt(a),g=(A=f.right-w.left)+.5*((D=p.left-w.left-0)-A),x=f.top+f.height/2,m=p.top+p.height/2,b=x-ge+Ie,y=m-me+Se,I="conn-subsec-".concat(d);he.push({lhsScrollY:b,rhsScrollY:y,x1:A,x2:D,containerTop:we,leftIdx:e,rhsArrayIdx:e,styleColor:(null==h?void 0:h.badgeBorder)||"#6366F1",styleId:I});var S=Re(x,ge,be),R=Re(m,me,ye),_=S-we,C=R-we,F=m>=me-4&&m<=ye+4,B="";B=(H=x>=ge-4&&x<=be+4)&&F?Y(A,_,D,C):H&&!F?"M ".concat(A,",").concat(_," L ").concat(g,",").concat(_," L ").concat(g,",").concat(C):!H&&F?"M ".concat(g,",").concat(_," L ").concat(g,",").concat(C," L ").concat(D,",").concat(C):"M ".concat(g,",").concat(_," L ").concat(g,",").concat(C),ve.push({id:I,pathD:B,style:h,leftIdx:e,rhsArrayIdx:e})}else if(xe){var E=e,T=Vn[E];if(!(null===(r=null==T?void 0:T.refIndexes)||void 0===r?void 0:r.length))return;T.refIndexes.forEach(function(e){var n,t,i=Xn.findIndex(function(n){return n.selfIndex===e});if(-1!==i){var o=null===(n=Et.current[E])||void 0===n?void 0:n.current,r=null===(t=Tt.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=o.getBoundingClientRect(),c=r.getBoundingClientRect(),u=Ot(E),a=l.right-w.left,d=c.left-w.left-0,s=a+.5*(d-a),v=l.top+l.height/2,f=c.top+c.height/2,p=v-ge+Ie,h=f-me+Se,g="conn-".concat(E,"-").concat(i);he.push({lhsScrollY:p,rhsScrollY:h,x1:a,x2:d,containerTop:we,leftIdx:E,rhsArrayIdx:i,styleColor:(null==u?void 0:u.badgeBorder)||"#6366F1",styleId:g});var x=Re(v,ge,be),m=Re(f,me,ye),b=x-we,y=m-we,I=v>=ge-4&&v<=be+4,S=f>=me-4&&f<=ye+4,R="";R=I&&S?Y(a,b,d,y):I&&!S?"M ".concat(a,",").concat(b," L ").concat(s,",").concat(b," L ").concat(s,",").concat(y):!I&&S?"M ".concat(s,",").concat(b," L ").concat(s,",").concat(y," L ").concat(d,",").concat(y):"M ".concat(s,",").concat(b," L ").concat(s,",").concat(y),ve.push({id:g,pathD:R,style:u,leftIdx:E,rhsArrayIdx:i})}}})}else{var M=e,k=M;s=null===(i=Et.current[M])||void 0===i?void 0:i.current,v=null===(o=Tt.current[k])||void 0===o?void 0:o.current;if(!s||!v)return;var A,D;f=s.getBoundingClientRect(),p=v.getBoundingClientRect(),h=Ot(M),g=(A=f.right-w.left)+.5*((D=p.left-w.left-0)-A),x=f.top+f.height/2,m=p.top+p.height/2,b=x-ge+Ie,y=m-me+Se,I="conn-".concat(M,"-").concat(k);he.push({lhsScrollY:b,rhsScrollY:y,x1:A,x2:D,containerTop:we,leftIdx:M,rhsArrayIdx:k,styleColor:(null==h?void 0:h.badgeBorder)||"#6366F1",styleId:I});var H;S=Re(x,ge,be),R=Re(m,me,ye),_=S-we,C=R-we,F=m>=me-4&&m<=ye+4,B="";B=(H=x>=ge-4&&x<=be+4)&&F?Y(A,_,D,C):H&&!F?"M ".concat(A,",").concat(_," L ").concat(g,",").concat(_," L ").concat(g,",").concat(C):!H&&F?"M ".concat(g,",").concat(_," L ").concat(g,",").concat(C," L ").concat(D,",").concat(C):"M ".concat(g,",").concat(_," L ").concat(g,",").concat(C),ve.push({id:I,pathD:B,style:h,leftIdx:M,rhsArrayIdx:k})}}),Ue.current=he}Ye(ve)}else Ye([]),Ue.current=[]}catch(e){console.error("Line render safe fail: ",e)}finally{Sn.current=!1}}},[Rt,Vn,Xn,Qe,Fn,Ht,Ot,xe,Ee,bt,ze,Hn,Wn]),zt=s(function(){var e,n,t,i,o,r,l,c,u,a,d,s,v,f,p=Ue.current;if(p.length&&!Ve.current){var h=null!==(n=null===(e=In.current)||void 0===e?void 0:e.scrollTop)&&void 0!==n?n:0,g=null!==(i=null===(t=gn.current)||void 0===t?void 0:t.scrollTop)&&void 0!==i?i:0,x=null!==(r=null===(o=In.current)||void 0===o?void 0:o.clientHeight)&&void 0!==r?r:1/0,m=null!==(c=null===(l=gn.current)||void 0===l?void 0:l.clientHeight)&&void 0!==c?c:1/0,b=null!==(a=null===(u=In.current)||void 0===u?void 0:u.getBoundingClientRect().top)&&void 0!==a?a:0,y=null!==(s=null===(d=gn.current)||void 0===d?void 0:d.getBoundingClientRect().top)&&void 0!==s?s:0,I=b+x,S=y+m,w=null!==(f=null===(v=dt.current)||void 0===v?void 0:v.getBoundingClientRect().top)&&void 0!==f?f:0,R=function(e,n,t){return Math.max(n,Math.min(t,e))};p.forEach(function(e){var n=e.lhsScrollY-h+b,t=e.rhsScrollY-g+y,i=qe.current[e.styleId+"-stroke"],o=qe.current[e.styleId+"-bg"];if(i||o){var r,l=R(n,b,I),c=R(t,y,S),u=l-w,a=c-w,d=n>=b-4&&n<=I+4,s=t>=y-4&&t<=S+4,v=e.x1+.5*(e.x2-e.x1);r=d&&s?Y(e.x1,u,e.x2,a):d&&!s?"M ".concat(e.x1,",").concat(u," L ").concat(v,",").concat(u," L ").concat(v,",").concat(a):!d&&s?"M ".concat(v,",").concat(u," L ").concat(v,",").concat(a," L ").concat(e.x2,",").concat(a):"M ".concat(v,",").concat(u," L ").concat(v,",").concat(a),i&&(i.setAttribute("visibility","visible"),i.setAttribute("d",r)),o&&(o.setAttribute("visibility","visible"),o.setAttribute("d",r))}})}},[]),Lt=a(Wt);d(function(){Lt.current=Wt},[Wt]);var jt=a(null),Pt=s(function(){null!==jt.current&&clearTimeout(jt.current),jt.current=setTimeout(function(){Lt.current(),jt.current=null},50)},[]),Yt=s(function(e){var n,t,i,o,r,l,c,u,a,d;if(!De.current){if(xe||Pt(),Ge.current){var s=Je.current,v=st.current,f=In.current,p=gn.current;if(null!==s&&null!==v&&f&&p){var h="string"==typeof s&&s.includes(z)?null===(n=Et.current["".concat(s.split(z)[0]).concat(z).concat(s.split(z)[1])])||void 0===n?void 0:n.current:null===(t=tt.current[s])||void 0===t?void 0:t.current,g="string"==typeof v&&v.includes(z)?null===(i=Tt.current["".concat(v.split(z)[0]).concat(z).concat(v.split(z)[1])])||void 0===i?void 0:i.current:null===(o=Mt.current[v])||void 0===o?void 0:o.current;if(h&&g){var x=h.getBoundingClientRect().top-f.getBoundingClientRect().top+f.scrollTop,m=g.getBoundingClientRect().top-p.getBoundingClientRect().top+p.scrollTop;if(e.currentTarget===f){var b=m-(x-f.scrollTop),y=p.scrollHeight-p.clientHeight,I=Math.max(0,Math.min(b,y));Math.abs(p.scrollTop-I)>1&&(p.scrollTop=I)}else if(e.currentTarget===p){var S=x-(m-p.scrollTop),w=f.scrollHeight-f.clientHeight,R=Math.max(0,Math.min(S,w));Math.abs(f.scrollTop-R)>1&&(f.scrollTop=R)}if(vt.current){var _=void 0,C=void 0;if("string"==typeof s&&s.includes(z)){var F=s.split(z),B="".concat(F[0]).concat(z).concat(F[1]);_=null===(r=Et.current[B])||void 0===r?void 0:r.current,C=null===(l=Tt.current[B])||void 0===l?void 0:l.current}else _=null===(c=Et.current[s])||void 0===c?void 0:c.current,C=null===(u=Tt.current[v])||void 0===u?void 0:u.current;var E=null!==(d=null===(a=dt.current)||void 0===a?void 0:a.getBoundingClientRect().top)&&void 0!==d?d:0,T=f.getBoundingClientRect().top,M=T+f.clientHeight,k=p.getBoundingClientRect().top,A=k+p.clientHeight,D=function(e,n,t){return Math.max(n,Math.min(t,e))};if(_&&C){var H=_.getBoundingClientRect(),O=C.getBoundingClientRect(),N=H.top+H.height/2,W=O.top+O.height/2,L=D(N,T,M),j=D(W,k,A);vt.current.setAttribute("y1",(L-E).toString()),vt.current.setAttribute("y2",(j-E).toString());var P=N>=T-4&&N<=M+4;vt.current.setAttribute("visibility",P?"visible":"hidden")}}}}}Ue.current.length>0&&!$e.current&&($e.current=!0,requestAnimationFrame(function(){zt(),$e.current=!1}))}},[zt,xe,Pt]);d(function(){var e=setTimeout(Pt,250);window.addEventListener("resize",Pt);var n=null,t=null;return pn.current&&(n=new ResizeObserver(Pt)).observe(pn.current),dt.current&&(t=new ResizeObserver(Pt)).observe(dt.current),function(){clearTimeout(e),window.removeEventListener("resize",Pt),null==n||n.disconnect(),null==t||t.disconnect()}},[En,Ln,Un,Rt,Hn,Wn,Vn,Xn,Fn,Pt,Ee,bt,ke,ze]),d(function(){Ge.current=Ee},[Ee]),d(function(){Je.current=bt},[bt]);var Kt=s(function(){var e,n,t,i,o=vn.sectionIdx,r=vn.isOrphan;if(_n(),null!=o)if(r)Fe("No counterpart exists for this section.");else if(Ee&&bt===o)ot();else{if(!xe){var l=Je.current,c=st.current;if(null!==l)if("string"==typeof l&&l.includes(z)){var u=l.split(z);(a=null===(e=kt.current[u[2]])||void 0===e?void 0:e.current)&&(a.style.paddingTop="0px")}else{var a;(a=null===(n=Ft.current[l])||void 0===n?void 0:n.current)&&(a.style.paddingTop="0px")}if(null!==c)if("string"==typeof c&&c.includes(z)){u=c.split(z);(d=null===(t=At.current[u[3]])||void 0===t?void 0:t.current)&&(d.style.paddingTop="0px")}else{var d;(d=null===(i=Bt.current[c])||void 0===i?void 0:i.current)&&(d.style.paddingTop="0px")}}Le(new Set),Ye([]),Ue.current=[],Re(!0),De.current=!0,yt(o),Je.current=o,Te(!0),Ge.current=!0,Ae(!1),xn.current&&(xn.current.style.height="0px"),mn.current&&(mn.current.style.height="0px"),bn.current&&(bn.current.style.height="0px"),yn.current&&(yn.current.style.height="0px"),requestAnimationFrame(function(){var e,n,t,i,r,l,c,u,a,d,s,v=null,f=null,p=null,h=null,g=null;if("string"==typeof o&&o.includes(z)){var x=o.split(z),m="".concat(x[0]).concat(z).concat(x[1]);v=(null===(e=Et.current[m])||void 0===e?void 0:e.current)||null,g=(f=(null===(n=Tt.current[m])||void 0===n?void 0:n.current)||null)?o:null,p=(null===(t=kt.current[x[2]])||void 0===t?void 0:t.current)||null,h=(null===(i=At.current[x[3]])||void 0===i?void 0:i.current)||null}else if(v=(null===(r=tt.current[o])||void 0===r?void 0:r.current)||null,p=(null===(l=Ft.current[o])||void 0===l?void 0:l.current)||null,xe){var b=Vn[o],y=(null==b?void 0:b.refIndexes)||[];if(y.length>0){var I=y[0],S=Xn.findIndex(function(e){return e.selfIndex===I});-1!==S&&(f=(null===(a=Mt.current[S])||void 0===a?void 0:a.current)||null,h=(null===(d=Bt.current[S])||void 0===d?void 0:d.current)||null,g=S)}}else f=(null===(c=Mt.current[o])||void 0===c?void 0:c.current)||null,h=(null===(u=Bt.current[o])||void 0===u?void 0:u.current)||null,g=f?o:null;st.current=g;var w=In.current,R=gn.current;if(!v||!w)return De.current=!1,void Re(!1);if(!f||!R)return Ae(!0),Lt.current(),De.current=!1,void Re(!1);if(!xe){var _=v.getBoundingClientRect(),C=f.getBoundingClientRect(),F=_.top-C.top;p&&h&&(p.style.paddingTop="0px",h.style.paddingTop="0px",F>0?h.style.paddingTop="".concat(F,"px"):F<0&&(p.style.paddingTop="".concat(Math.abs(F),"px")));var B=v?v.getBoundingClientRect().top:(null==p?void 0:p.getBoundingClientRect().top)||0;return null===(s=pn.current)||void 0===s||s.scrollTo({top:pn.current.scrollTop+B-150,behavior:"smooth"}),Ae(!0),Lt.current(),De.current=!1,void Re(!1)}var E=v.getBoundingClientRect().top-w.getBoundingClientRect().top+w.scrollTop,T=f.getBoundingClientRect().top-R.getBoundingClientRect().top+R.scrollTop-(E-w.scrollTop);T<0&&xn.current&&(xn.current.style.height="".concat(Math.abs(T),"px"));requestAnimationFrame(function(){var e,n=R.scrollHeight-R.clientHeight;if(T<0)e=0;else{if(T>n){var t=T-n;return mn.current&&(mn.current.style.height="".concat(t+150,"px")),void requestAnimationFrame(function(){q(R,T,200,function(){Ae(!0),Lt.current(),De.current=!1,Re(!1)})})}e=T}q(R,e,200,function(){Ae(!0),Lt.current(),De.current=!1,Re(!1)})})})}},[_n,vn.sectionIdx,Ee,bt,Vn,Xn,Pt,ot]),Vt=null!==vn.sectionIdx&&ze.has(vn.sectionIdx),Xt=function(n){var t,r,c,u,a,d,s,p=n.section,h=n.idx,g=n.columnKey,x=n.colRef,S=n.mb,R=void 0===S?1:S,_=n.parentNodeId,C=void 0===_?"":_,T=xe?!!Hn["".concat(g,"-").concat(h)]:!!Hn[String(h)],M=(null===(t=p.displayTitle)||void 0===t||t)&&E(p.title),k=(null===(r=p.displayContent)||void 0===r||r)&&E(p.content),A=!M&&!k,D={current:1},H=p.title;M||(H=k?"No Title Found":"No Matching Section Found");var O,N=null!==(d=null===(a=null===(u=null===(c=p.evaluationResult)||void 0===c?void 0:c.evaluation_outputs)||void 0===u?void 0:u.metadata)||void 0===a?void 0:a.label_color)&&void 0!==d?d:X,W=B(N).highlightBg,z=[];if(null===(s=p.evaluationResult)||void 0===s?void 0:s.deviations){var L=p.evaluationResult.deviations;for(var j in L){var Y=L[j][C];Y&&z.push(Y)}}return i(v,e({ref:x,sx:{mb:R,width:"100%",display:"flex",flexDirection:"column",position:"relative",minWidth:0}},{children:o(b,e({disableGutters:!0,expanded:!A&&T,onChange:function(){return!A&&function(n,t){var i,o;Ve.current=!0,Xe.current&&clearTimeout(Xe.current),Ke.current&&(Ke.current.style.opacity="0");var r=null===(i=Ft.current[n])||void 0===i?void 0:i.current,l=null===(o=Bt.current[n])||void 0===o?void 0:o.current;r&&(r.style.minHeight="0px"),l&&(l.style.minHeight="0px"),Xe.current=setTimeout(function(){Ve.current=!1,Lt.current(),Ke.current&&(Ke.current.style.opacity="1")},650),On(function(i){var o=e({},i),r=xe?"".concat(t,"-").concat(n):String(n),l=!i[r];if(!l){var c=String(bt||""),u=bt===n||c.startsWith("".concat(n,"-")),a=!1;ze.forEach(function(e){(e===n||String(e).startsWith("".concat(n,"-")))&&(a=!0)}),(u||a)&&(ot(),Le(new Set),Ye([]),Ue.current=[])}if(!xe)return o[String(n)]=l,o;if(o[r]=l,"left"===t)((null==(d=Vn[n])?void 0:d.refIndexes)||[]).forEach(function(e){var n=Xn.findIndex(function(n){return n.selfIndex===e});-1!==n&&(o["right-".concat(n)]=l)});else{var d,s=null==(d=Xn[n])?void 0:d.selfIndex;Vn.forEach(function(e,n){var t;(null===(t=e.refIndexes)||void 0===t?void 0:t.includes(s))&&(o["left-".concat(n)]=l)})}return o})}(h,g)},sx:{boxShadow:"none",border:A?"1px dashed #E2E8F0":"1px solid #E2E8F0",bgcolor:A?"#FAFAFA":"#FFFFFF",borderRadius:"6px",flexGrow:1,width:"100%",display:"flex",flexDirection:"column",minWidth:0,"&:before":{display:"none"}}},{children:[i(y,e({expandIcon:A?null:i(w,{size:16}),sx:{minHeight:"36px",flexShrink:0,cursor:A?"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:M&&i(m,e({title:H,placement:"top"},{children:i(f,e({component:"div",sx:{fontSize:"12px",color:A?"#94A3B8":"#19213D",fontWeight:A?400:700,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0}},{children:(O=H,O?F(O).replace(/\\n/g,"\n").split(/(\*\*.*?\*\*)/g).map(function(e,n){return e.startsWith("**")&&e.endsWith("**")?i("strong",{children:e.slice(2,-2)},n):i(l.Fragment,{children:e},n)}):null)}))}))})),!A&&o(I,e({sx:{pt:0,pb:1.25,bgcolor:"#FFFFFF",flex:1,display:"flex",flexDirection:"column",minWidth:0}},{children:[k&&i(P,{content:p.content,sxStyles:cn,highlights:z,maintainRelativeOrder:xe,highlightBg:W}),(p.subsections||[]).map(function(e,n){return qt({section:e,keyPath:"".concat(h,"-").concat(n),depth:0,columnKey:g,parentNodeId:C,devCounter:D})})]}))]}))}),"".concat(g,"-sec-").concat(h))},qt=function(n){var r,c,u,a,d,s,p,h,g,x,m,S,R,_,C,F=n.section,T=n.keyPath,M=n.depth,k=void 0===M?0:M,A=n.columnKey,D=void 0===A?"left":A,H=n.parentNodeId,O=void 0===H?"":H,N=(null===(r=F.displayTitle)||void 0===r||r)&&E(F.title),W=(null===(c=F.displayContent)||void 0===c||c)&&E(F.content),j=!N&&!W,Y=N?F.title:W?"No Title Found":"No Matching Section Found",K=!!Wn[T];"left"!==D||kt.current[T]||(kt.current[T]=l.createRef()),"right"!==D||At.current[T]||(At.current[T]=l.createRef());var V="left"===D?kt.current[T]:At.current[T],q=Nt(T),U=T.split("-").map(Number),$=U[0],G=Vn[$],J=Xn[$],Q=T,Z=T;if(xe)if("left"===D){var ee=null===(u=null==G?void 0:G.refIndexes)||void 0===u?void 0:u[0],ne=Xn.findIndex(function(e){return e.selfIndex===ee});-1!==ne&&(J=Xn[ne],Z=t([ne],U.slice(1),!0).join("-"))}else{var te=null===(a=null==J?void 0:J.refIndexes)||void 0===a?void 0:a[0],ie=Vn.findIndex(function(e){return e.selfIndex===te});-1!==ie&&(G=Vn[ie],Q=t([ie],U.slice(1),!0).join("-"))}var oe,re="left"===D?G:J;oe=xe&&void 0!==(null==re?void 0:re.selfIndex)&&re.selfIndex>=0?re.selfIndex+1:$+1;for(var ce=G,ue=J,ae=1;ae<U.length;ae++)(null==ce?void 0:ce.subsections)&&(ce=ce.subsections[U[ae]]),(null==ue?void 0:ue.subsections)&&(ue=ue.subsections[U[ae]]);var de=null===(d=null==le?void 0:le.input_index_map)||void 0===d?void 0:d[0],se=null===(s=null==le?void 0:le.input_index_map)||void 0===s?void 0:s[1],ve="left"===D?se:de,fe=xe?!(null===(p=F.refIndexes)||void 0===p?void 0:p.length)||void 0!==F.selfIndex&&F.selfIndex<0:"left"===D?!ue:!ce,pe=null!==(x=null===(g=null===(h=F.evaluationResult)||void 0===h?void 0:h.evaluation_outputs)||void 0===g?void 0:g.output_value)&&void 0!==x?x:null,he=F.id,ge=null!==(_=null===(R=null===(S=null===(m=F.evaluationResult)||void 0===m?void 0:m.evaluation_outputs)||void 0===S?void 0:S.metadata)||void 0===R?void 0:R.label_color)&&void 0!==_?_:X,me=B(ge).highlightBg,be=(null===(C=F.evaluationResult)||void 0===C?void 0:C.deviations)||{},ye=Object.entries(be).map(function(n){var t=n[0],i=n[1],o="".concat(he).concat(z).concat(t),r=nt[o];if(!r)return null;var c=i[O],u=L(c);if(u)c="";else if(!c)return null;var a=i[ve],d=fe||L(a),s="".concat(oe,".").concat(r),v="".concat(he).concat(z).concat(t).concat(z).concat(Q).concat(z).concat(Z);return"left"!==D||Et.current[o]||(Et.current[o]=l.createRef()),"right"!==D||Tt.current[o]||(Tt.current[o]=l.createRef()),{id:o,actionId:v,label:s,highlight:c,side:D,style:q,score:pe,isConnected:ze.has(v),isOrphan:d,isMissingClause:u,badgeRef:"left"===D?Et.current[o]:Tt.current[o],onClick:function(n){n.stopPropagation();var t=e(e({},ce||{title:"",content:""}),{title:(null==G?void 0:G.title)||(null==ce?void 0:ce.title)||""}),i=e(e({},ue||{title:"",content:""}),{title:(null==J?void 0:J.title)||(null==ue?void 0:ue.title)||""});ct(n,t,d,i,v,q)}}}).filter(Boolean),Ie=ye.some(function(e){return ze.has(e.actionId)});if(!(N||W||F.subsections&&0!==F.subsections.length))return null;var Se=function(){var e,n=[];if(null===(e=F.evaluationResult)||void 0===e?void 0:e.deviations){var t=F.evaluationResult.deviations;for(var i in t){var o=t[i][O];o&&n.push(o)}}return n}();return i(v,N?e({ref:V,sx:{mt:1,width:"100%",minWidth:0,position:"relative"}},{children:i(v,e({sx:e({width:"100%"},Ie&&q&&{borderRadius:"4px",outline:"2px solid ".concat(q.badgeBorder),outlineOffset:"1px"})},{children:o(b,e({disableGutters:!0,expanded:!j&&K,onChange:function(){if(!j){if(K){var n=String(bt||""),t=n.includes(Q)||n.includes(Z);t||ze.forEach(function(e){(String(e).includes(Q)||String(e).includes(Z))&&(t=!0)}),t&&(ot(),Le(new Set),Ye([]),Ue.current=[])}zn(function(n){var t;return e(e({},n),((t={})[T]=!n[T],t))})}},sx:{mt:0,boxShadow:"none",border:j?"1px dashed #E2E8F0":"1px solid #EEF2F7",borderRadius:"4px !important",bgcolor:"#FFFFFF",minWidth:0,"&:before":{display:"none"}}},{children:[i(y,e({expandIcon:j?null:i(w,{size:14}),sx:{minHeight:"32px","& .MuiAccordionSummary-content":{my:.5,display:"grid",alignItems:"center",minWidth:0,width:"100%"}}},{children:i(f,e({component:"div",sx:{fontSize:"11px",fontWeight:600,color:j?"#94A3B8":"#19213D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0}},{children:Y||"Untitled Subsection"}))})),!j&&o(I,e({sx:{pt:0,pb:1,minWidth:0}},{children:[W&&i(P,{content:F.content,sxStyles:cn,deviationBadges:ye,maintainRelativeOrder:xe,highlightBg:me,highlights:Se}),(F.subsections||[]).map(function(e,n){return qt({section:e,keyPath:"".concat(T,"-").concat(n),depth:k+1,columnKey:D,parentNodeId:O})})]}))]}))}))}):e({ref:V,sx:{mt:0===k?1:.75,width:"100%",minWidth:0,position:"relative"}},{children:!j&&o(v,e({sx:e({width:"100%"},Ie&&q&&{borderRadius:"4px",outline:"2px solid ".concat(q.badgeBorder),outlineOffset:"1px"})},{children:[W&&i(P,{content:F.content,sxStyles:cn,deviationBadges:ye,maintainRelativeOrder:xe,highlightBg:me,highlights:Se}),(F.subsections||[]).map(function(e,n){return qt({section:e,keyPath:"".concat(T,"-").concat(n),depth:k+1,columnKey:D,parentNodeId:O})})]}))}),T)};return o(v,e({ref:hn,sx:e(e({display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif'},xe?{}:{overflow:"visible"}),{position:"relative"})},{children:[ye&&i(v,e({sx:{position:"absolute",inset:0,bgcolor:"rgba(255, 255, 255, 0.6)",backdropFilter:"blur(10px)",zIndex:9999,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"8px"}},{children:i(N,{})})),i(O,{open:vn.open,anchorEl:vn.anchorEl,sectionTitle:vn.sectionTitle,referenceSectionTitle:vn.refSectionTitle,onClose:_n,onOpenCognitiveCompare:ut,onOpenSideBySide:Kt,onConnect:at,isConnected:Vt,isOrphan:vn.isOrphan}),an.open&&i(H,{open:an.open,popupRef:tn,position:en,popupConfig:fe,onClose:function(){nn(null),dn(function(n){return e(e({},n),{open:!1})}),Ne(null)},markdownStyles:de,sectionTitle:an.sectionTitle,referenceSectionTitle:an.refSectionTitle,cognitiveData:an.cognitiveData,anchorEl:an.anchorEl,sectionAnchorEl:an.sectionAnchorEl,scrollContainerEl:pn.current,badgeStyle:an.badgeStyle,docData:an.docData,deviationData:an.deviationData}),i(p,e({open:!!Ce,autoHideDuration:8e3,onClose:function(){return Fe(null)},anchorOrigin:{vertical:"top",horizontal:"center"}},{children:i(h,e({onClose:function(){return Fe(null)},severity:"error",sx:{width:"100%",whiteSpace:"pre-line"}},{children:Ce}))})),(ve.isHeaderVisible||ve.isToggleVisible)&&o(v,e({sx:{px:2,py:1,display:"flex",alignItems:"center",justifyContent:"space-between",bgcolor:"#FFFFFF",border:"1.5px solid #EEF0F4",borderTopLeftRadius:"8px",borderTopRightRadius:"8px"}},{children:[i(v,e({sx:{display:"flex",alignItems:"center",gap:1}},{children:ve.isHeaderVisible&&i(f,e({sx:{fontSize:"16px",fontWeight:600,color:"#0F172A"}},{children:re}))})),ve.isToggleVisible&&i(v,e({sx:{display:"flex",alignItems:"center"}},{children:i(g,{control:i(x,{checked:!xe,onChange:function(e){var n=e.target.checked;Ie(!0),setTimeout(function(){me(!n),ot(),Le(new Set),Ye([]),Ue.current=[],setTimeout(function(){Ie(!1)},400)},50)},color:"primary",size:"small",sx:{width:100,height:26,padding:0,"& .MuiSwitch-switchBase":{padding:0,margin:"3px",transitionDuration:"300ms","&.Mui-checked":{transform:"translateX(75px)",color:"#fff","& + .MuiSwitch-track":{backgroundColor:"#5928ED",opacity:1,border:0,"&::before":{content:'"Side by Side"',position:"absolute",left:"13px",top:"50%",transform:"translateY(-50%)",fontSize:"9px",fontWeight:700,color:"#fff",letterSpacing:"0.3px"}}}},"& .MuiSwitch-thumb":{boxSizing:"border-box",width:20,height:20},"& .MuiSwitch-track":{borderRadius:13,backgroundColor:"#9e9e9e",opacity:1,position:"relative","&::after":{content:'"Side by Side"',position:"absolute",right:"13px",top:"50%",transform:"translateY(-50%)",fontSize:"9px",fontWeight:700,color:"#fff",letterSpacing:"0.3px",opacity:1,transition:"opacity 0.2s"}},"& .MuiSwitch-switchBase.Mui-checked + .MuiSwitch-track":{"&::after":{opacity:0}}}}),label:"",labelPlacement:"start",sx:{m:0,gap:1}})}))]})),i(v,e({ref:pn,onScroll:Yt,sx:{flex:1,minHeight:0,pt:1.5,pb:1,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",overflowY:xe?"hidden":"auto",borderTop:$n&&Gn?"none":"1.5px solid #EEF0F4"}},{children:i(v,e({sx:e({display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"},xe?{flex:1,minHeight:0}:{})},{children:o(v,e({ref:dt,sx:e({display:"grid",gridTemplateColumns:"minmax(0, 1fr) 180px minmax(0, 1fr)",gap:"10px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0},xe?{flex:1,overflow:"visible"}:{})},{children:[o("svg",e({ref:Ke,style:{position:"absolute",top:0,left:0,width:rn.width||"100%",height:rn.height||"100%",pointerEvents:"none",zIndex:10,overflow:"visible",transition:"opacity 0.15s ease-in-out"}},{children:[St&&!Ee&&o("g",{children:[i("line",{x1:St.x1,y1:St.y,x2:Math.max(St.x1,(St.x1+St.x2)/2-70),y2:St.y,stroke:et.badgeBorder,strokeWidth:"1.5"}),i("line",{x1:Math.min(St.x2,(St.x1+St.x2)/2+70),y1:St.y,x2:St.x2,y2:St.y,stroke:et.badgeBorder,strokeWidth:"1.5"})]}),gt.map(function(n){var t,r=n.x1+.5*(n.x2-n.x1),l=(n.y1+n.y2)/2;if("Not Defined"===n.style.label&&!n.hasCognitive)return null;var c=!1;if(n.isSubSection)c=Ee&&bt===n.subSectionKeyPath&&ke;else{var u=Vn[n.sectionIdx];(xe?!(null===(t=null==u?void 0:u.refIndexes)||void 0===t?void 0:t.length)||(null==u?void 0:u.selfIndex)<0:!Xn[n.sectionIdx])||(c=Ee&&bt===n.sectionIdx&&ke)}if(c)return o("g",e({style:{transition:"opacity 0.2s"}},{children:[i("defs",{children:i("marker",e({id:"arr-".concat(n.id),markerWidth:"7",markerHeight:"5",refX:"7",refY:"2.5",orient:"auto"},{children:i("polygon",{points:"0 0, 7 2.5, 0 5",fill:n.style.badgeBorder||"#6366F1"})}))}),i("line",{ref:vt,x1:n.x1,y1:n.y1,x2:n.x2,y2:n.y2,stroke:n.style.badgeBorder||"#6366F1",strokeWidth:"1.5",markerEnd:"url(#arr-".concat(n.id,")")})]}),n.id);if(!xe){var a=n.isSubSection?Y(n.x1,n.y1,n.x2,n.y2):"M ".concat(n.x1," ").concat(n.y1," L ").concat(n.x2," ").concat(n.y2);return o("g",{children:[i("path",{d:a,fill:"none",stroke:n.style.badgeBorder||"#E2E8F0",strokeWidth:"1.5"}),i("foreignObject",e({x:r-100,y:l-14,width:"200",height:"28",style:{pointerEvents:"auto",overflow:"visible"}},{children:i(v,e({sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},{children:o(v,e({onClick:function(t){if(t.stopPropagation(),an.open&&Oe===n.id)Rn();else{var i=Vn[n.sectionIdx]||{title:"",content:""},o=Xn[n.sectionIdx]||{title:"",content:""};if(n.isSubSection&&n.subSectionKeyPath){for(var r=n.subSectionKeyPath.split(z)[2].split("-").map(Number),l=Vn[r[0]],c=Xn[r[0]],u=(null==l?void 0:l.title)||"",a=(null==c?void 0:c.title)||"",d=1;d<r.length;d++)(null==l?void 0:l.subsections)&&(l=l.subsections[r[d]]),(null==c?void 0:c.subsections)&&(c=c.subsections[r[d]]);l&&(i=e(e({},l),{title:u||l.title})),c&&(o=e(e({},c),{title:a||c.title}))}Ne(n.id),lt(rt(t.currentTarget,i,o,n.sectionIdx,n.style))}},sx:{display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",bgcolor:n.style.badgeBg,color:n.style.badgeText,border:"1px solid ".concat(n.style.badgeBorder),borderRadius:"12px",px:1.5,py:.5,fontWeight:600,textAlign:"center",whiteSpace:"nowrap",cursor:"pointer"}},{children:[0===n.style.label?"Same":n.style.label,i(v,e({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:i(R,{})})),i(w,{size:11,style:{transform:an.open&&Oe===n.id?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))}))]},n.id)}return null}),Pe.map(function(n){var t,r=n.pathD,l=(null===(t=n.style)||void 0===t?void 0:t.badgeBorder)||"#6366F1",c="conn-marker-".concat(n.id),u="".concat(n.id,"-bg"),a="".concat(n.id,"-stroke");return o("g",{children:[i("defs",{children:i("clipPath",e({id:"connections-clip"},{children:i("marker",e({id:c,markerWidth:"8",markerHeight:"6",refX:"7",refY:"3",orient:"auto"},{children:i("polygon",{points:"0 0, 8 3, 0 6",fill:l})}))}))}),i("path",{ref:function(e){qe.current[u]=e},d:r,fill:"none",stroke:"#FFFFFF",strokeWidth:"4",strokeOpacity:"0.7"}),i("path",{ref:function(e){qe.current[a]=e},d:r,fill:"none",stroke:l,strokeWidth:"1.75",markerEnd:"url(#".concat(c,")")})]},n.id)})]})),o(v,e({sx:e({border:"1px solid #E7E7E9",borderRadius:"8px",bgcolor:"#FFFFFF",display:"flex",flexDirection:"column",position:"relative",zIndex:2,filter:"drop-shadow(0px 2px 4px #F2F2F2)"},xe?{flex:1,overflow:"visible"}:{})},{children:[i(v,e({ref:ft,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E7E7E9",borderRadius:"8px 8px 0 0",display:"flex",minHeight:"40px",alignItems:"center",overflowX:"hidden"}},{children:i(m,e({title:Yn,placement:"top"},{children:i(f,e({sx:{fontSize:"16px",fontWeight:500,color:"#19213D",overflow:"hidden",display:"flex",alignItems:"center",justifyContent:"center",textOverflow:"ellipsis",whiteSpace:"normal",width:"100%",height:"40px"}},{children:Yn}))}))})),o(v,e({ref:In,onScroll:Yt,sx:e({p:"12px",display:"flex",flexDirection:"column"},xe?{maxHeight:"calc(100vh - 150px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,mr:"-160px",pr:"172px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[i("div",{ref:bn,style:{width:"100%",height:"0px",flexShrink:0}}),qn&&Vn.map(function(n,t){var r,c,u=!n.title&&!n.content;if(xe&&u)return null;var a=n,d=Ot(t),s=xe?!(null===(r=a.refIndexes)||void 0===r?void 0:r.length)||a.selfIndex<0:!Xn[t],f=xe?"number"==typeof a.selfIndex&&a.selfIndex>=0?a.selfIndex+1:null:t+1,p=ze.has(t),h=j(a.evaluationResult,null==d?void 0:d.deviationLabel);return i(v,e({ref:it(t),sx:{mb:1,width:"100%"}},{children:o(v,e({sx:{position:"relative",width:"100%"}},{children:[i(v,e({ref:Ft.current[t],sx:e({width:"100%",display:"flex"},p&&{borderRadius:"6px",outline:"2px solid ".concat((null==d?void 0:d.badgeBorder)||"#6366F1"),outlineOffset:"1px"})},{children:Xt({section:n,idx:t,columnKey:"left",colRef:l.createRef(),mb:0,parentNodeId:(null===(c=null==le?void 0:le.input_index_map)||void 0===c?void 0:c[0])||""})})),xe&&d&&o(v,e({ref:Et.current[t],onClick:function(e){var i=xe?Xn.find(function(e){var n;return null===(n=a.refIndexes)||void 0===n?void 0:n.includes(e.selfIndex)})||{title:"",content:""}:Xn[t]||{title:"",content:""};ct(e,n,s,i,t,d)},sx:{position:"absolute",top:"18px",right:0,transform:"translateY(-50%) translateX(calc(100% + 8px))",display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",bgcolor:d.badgeBg,color:d.badgeText,border:"1px solid ".concat(d.badgeBorder),borderRadius:"12px",px:1.2,py:.4,fontWeight:600,cursor:"pointer",whiteSpace:"nowrap",zIndex:20,boxShadow:"0 1px 3px rgba(0,0,0,0.07)"}},{children:[null!==f&&i(v,e({component:"span",sx:{fontSize:"11px",fontWeight:700,pr:.5,borderRight:"1px solid ".concat(d.badgeBorder)}},{children:f})),i(v,e({component:"span",sx:{fontSize:"11px",px:.25}},{children:s?"No Deviation Found":"N/A"===h||"NA"===h?"N/A":0==h||null==h?"Same":"".concat(h)})),i(S,{size:11,color:d.badgeText})]}))]}))}),"left-row-".concat(t))}),i("div",{ref:yn,style:{width:"100%",height:"0px",flexShrink:0}})]}))]})),i(v,e({sx:{width:"180px",display:"flex",flexDirection:"column",alignItems:"center",pt:"15px",gap:0}},{children:i(v,e({sx:{display:"flex",justifyContent:"center",alignItems:"center",mt:0}},{children:o(v,e({sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:"5px",borderRadius:"20px",bgcolor:et.badgeBg,color:et.badgeText,border:"1px solid ".concat(et.badgeBorder),fontSize:"12px",fontWeight:600,whiteSpace:"nowrap",position:"relative",zIndex:1}},{children:[Zn,i(v,e({component:"span",onClick:function(n){n.stopPropagation(),an.open&&Oe===Jn?Rn():(Ne(Jn),lt(rt(n.currentTarget,{title:"",content:"",evaluationResult:Qn,cognitiveData:{section_id:"",decisioning:[],gap:[],relevance_score:0,isMissingRationale:!0}},null,Jn,!0,e(e({},et),{label:""}))))},sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:i(R,{})})),i(w,{size:11,style:{transform:an.open&&Oe===Jn?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))})),o(v,e({sx:e({border:"1px solid #E3E6EA",borderRadius:"8px",bgcolor:"#FFFFFF",boxShadow:"0px 1px 4px #F7F4FE",position:"relative",zIndex:2,display:"flex",flexDirection:"column",minWidth:0},xe?{flex:1,overflow:"visible",minHeight:0}:{})},{children:[we&&i(_,{sections:11}),i(v,e({ref:pt,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E3E6EA",borderRadius:"8px 8px 0 0",minHeight:"40px",display:"flex",alignItems:"center",overflowX:"hidden"}},{children:i(m,e({title:Kn,placement:"top"},{children:i(f,e({sx:{fontSize:"16px",fontWeight:500,color:"#5928ED",overflow:"hidden",display:"flex",justifyContent:"center",alignItems:"center",textOverflow:"ellipsis",whiteSpace:"normal",width:"100%",height:"40px"}},{children:Kn}))}))})),o(v,e({ref:gn,onScroll:Yt,sx:e({p:"12px",display:"flex",flexDirection:"column"},xe?{maxHeight:"calc(100vh - 150px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,ml:"-25px",pl:"45px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[i("div",{ref:xn,style:{width:"100%",height:"0px",flexShrink:0}}),qn&&Xn.map(function(n,t){var r,c=n,u=[],a=!1,d=null;if(xe){u=Vn.filter(function(e){var n;return(null===(n=e.refIndexes)||void 0===n?void 0:n.includes(c.selfIndex))&&e.selfIndex>=0}).map(function(e){return e.selfIndex+1});var s=Vn.findIndex(function(e,n){var t;return ze.has(n)&&(null===(t=e.refIndexes)||void 0===t?void 0:t.includes(c.selfIndex))});(a=-1!==s)&&(d=Ot(s))}else u=[t+1],(a=ze.has(t))&&(d=Ot(t));var f=Ot(t);return i(v,e({ref:Mt.current[t],sx:{mb:1,width:"100%"}},{children:o(v,e({sx:{position:"relative",width:"100%"}},{children:[i(v,e({ref:Bt.current[t],sx:e({width:"100%",display:"flex"},a&&d&&{borderRadius:"6px",outline:"2px solid ".concat(d.badgeBorder),outlineOffset:"1px"})},{children:Xt({section:n,idx:t,columnKey:"right",colRef:l.createRef(),mb:0,parentNodeId:(null===(r=null==le?void 0:le.input_index_map)||void 0===r?void 0:r[1])||""})})),xe&&!we&&f&&i(v,e({ref:Tt.current[t],sx:{position:"absolute",top:"18px",left:0,transform:"translateY(-50%) translateX(calc(-100% - 8px))",display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:"11px",bgcolor:f.badgeBg,color:f.badgeText,border:"1px solid ".concat(f.badgeBorder),borderRadius:"10px",px:1,py:.3,fontWeight:700,whiteSpace:"nowrap",zIndex:20}},{children:u.length>0?u.join(", "):"-"}))]}))}),"right-row-".concat(t))}),i("div",{ref:mn,style:{width:"100%",height:"0px",flexShrink:0}})]}))]}))]}))}))}))]}))};export{U as default};
|
|
2
2
|
//# sourceMappingURL=CognitiveCompare.js.map
|