@viswa-test/test-citation 0.0.35 → 0.0.36
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/features/CognitiveCompare/CognitiveCompare.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/CognitiveCompareTypes.d.ts +2 -0
- package/dist/types/src/features/CognitiveCompare/CognitiveCompareTypes.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),t=require("react"),i=require("@mui/material"),r=require("lucide-react"),o=require("../../assests/svg/ButtonCognitiveIcon.js"),l=require("./OverlayComponent.js"),s=require("react-markdown"),c=require("./CognitiveComparehelpers.js"),a=require("./CognitiveCompareConfig.js"),u=require("./CognitivePopup.js"),d=require("./MoreFunctionsPopup.js"),f=require("./LoaderComponent.js"),v=require("rehype-raw");function h(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var x=h(t),g=h(s),p=h(v),m=x.default.memo(function(r){var o=r.content,l=r.sxStyles,s=r.highlights,a=void 0===s?[]:s,u=t.useMemo(function(){return{mark:function(t){var i=t.children;return n.jsx("span",e.__assign({style:{backgroundColor:"#fccccc"}},{children:i}))}}},[]),d=t.useMemo(function(){var e=o;return a.forEach(function(n){e=e.replace(new RegExp(n,"g"),"<mark>".concat(n,"</mark>"))}),e},[o,a]);return n.jsx(i.Typography,e.__assign({component:"div",sx:l},{children:n.jsx(g.default,e.__assign({components:u,rehypePlugins:[p.default]},{children:c.safeStringify(d).replace(/\\n/g,"\n")}))}))},function(e,n){if(e.content!==n.content)return!1;if(e.sxStyles!==n.sxStyles)return!1;var t=e.highlights||[],i=n.highlights||[];if(t.length!==i.length)return!1;for(var r=0;r<t.length;r++)if(t[r]!==i[r])return!1;return!0}),y=function(e,n,t,i,r){void 0===r&&(r=14);var o=e+.65*(t-e),l=i-n;if(Math.abs(l)<3)return"M ".concat(e," ").concat(n," H ").concat(t);var s=l>0?1:-1,c=Math.min(r,Math.abs(l)/2,Math.abs(o-e)/2,Math.abs(t-o)/2);return["M ".concat(e," ").concat(n),"H ".concat(o-c),"Q ".concat(o," ").concat(n," ").concat(o," ").concat(n+s*c),"V ".concat(i-s*c),"Q ".concat(o," ").concat(i," ").concat(o+c," ").concat(i),"H ".concat(t)].join(" ")},_={id:"",title:""},b={open:!1,sectionTitle:"",refSectionTitle:"",cognitiveData:null,anchorEl:null,sectionAnchorEl:null,badgeStyle:null,sectionIdx:null,docData:null,deviationData:null},S=function(e,n,t,i,r){void 0===t&&(t=300);var o=e.style.scrollBehavior;e.style.scrollBehavior="auto";var l=e.scrollTop,s=n-l,c=null,a=function(u){null===c&&(c=u);var d,f=u-c;f<t?(e.scrollTop=(d=f,d/=t,s*(--d*d*d+1)+l),r&&r(),requestAnimationFrame(a)):(e.scrollTop=n,e.style.scrollBehavior=o,r&&r(),i&&i())};requestAnimationFrame(a)};exports.SHARED_MARKDOWN_STYLES=a.SHARED_MARKDOWN_STYLES,exports.default=function(s){var v,h,g,p,R,I,F,w,C=s.componentHeaderText,E=void 0===C?"Contract Comparison":C,j=s.treeData,B=s.comparisonConfig,T=s.leftColumnTitleText,k=s.rightColumnTitleText,D=s.markdownStyles,M=s.displayConfig,A=void 0===M?{isHeaderVisible:!0,isToggleVisible:!0,maintainRelativeOrder:!1}:M,H=s.popupConfig,O=s.deviationData,N=void 0===O?{}:O,W=t.useState(A.maintainRelativeOrder),L=W[0],z=W[1],P=t.useState(!1),q=P[0],V=P[1],K=t.useState(!1),Y=K[0],U=K[1],G=t.useState(null),X=G[0],J=G[1],Q=t.useState(!1),Z=Q[0],$=Q[1],ee=t.useState(!1),ne=ee[0],te=ee[1],ie=t.useRef(!1),re=t.useState(null),oe=re[0],le=re[1],se=t.useState(new Set),ce=se[0],ae=se[1],ue=t.useState([]),de=ue[0],fe=ue[1],ve=t.useRef(null),he=t.useRef(!1),xe=t.useRef(null),ge=t.useRef({}),pe=t.useRef([]),me=t.useRef(!1),ye=t.useRef(!1),_e=t.useRef(null),be=t.useMemo(function(){return(null==j?void 0:j.cognitive_decisioning)||{}},[j]),Se=t.useState(null),Re=Se[0],Ie=Se[1],Fe=t.useRef(null),we=t.useState({width:0,height:0}),Ce=we[0],Ee=we[1],je=t.useMemo(function(){return e.__assign(e.__assign({},a.SHARED_MARKDOWN_STYLES),D)},[D]),Be=t.useState({open:!1,sectionTitle:"",refSectionTitle:"",cognitiveData:null,anchorEl:null,sectionAnchorEl:null,badgeStyle:null,sectionIdx:null,docData:null,deviationData:null}),Te=Be[0],ke=Be[1],De=t.useState({open:!1,sectionTitle:"",refSectionTitle:"",cognitiveData:null,anchorEl:null,sectionAnchorEl:null,badgeStyle:null,sectionIdx:null,docData:null,deviationData:null}),Me=De[0],Ae=De[1],He=t.useRef(null),Oe=t.useRef(null),Ne=t.useRef(null),We=t.useRef(null),Le=t.useRef(null),ze=t.useRef(null),Pe=t.useRef(null),qe=t.useRef(null),Ve=t.useRef(!1),Ke=t.useRef(null);t.useEffect(function(){Ke.current=null},[Te.sectionIdx,Te.open]);var Ye=t.useCallback(function(){Ie(null),ke(b),le(null)},[]),Ue=t.useCallback(function(){Ae(b)},[]),Ge=t.useCallback(function(){var e;if(Te.anchorEl&&Te.refSectionTitle){var n=Te.anchorEl.getBoundingClientRect(),t=(null===(e=null==Fe?void 0:Fe.current)||void 0===e?void 0:e.offsetHeight)||0,i=Math.min(680,window.innerWidth-24),r=window.innerHeight-n.bottom-12-12,o=n.top-12-12,l=r<t&&o>r;null!==Ke.current?!0===Ke.current&&(l=o>=t||o>=r):l=!(r>=t||r>=o),Ke.current=l;var s=l?o:r,c=Math.min(t||9999,s),a=l?n.top-12-c:n.bottom+12,u=n.left+n.width/2,d=u-i/2,f=Math.max(12,Math.min(d,window.innerWidth-i-12)),v=Math.max(14,Math.min(u-f,i-10-4));Ie({top:a,left:f,arrowLeft:v,openAbove:l,maxHeight:s})}},[Te.anchorEl,Te.refSectionTitle]);t.useEffect(function(){if(Te.open){window.addEventListener("resize",Ge);var e=requestAnimationFrame(Ge),n=null;return Fe.current&&(n=new ResizeObserver(function(){cancelAnimationFrame(e),e=requestAnimationFrame(Ge)})).observe(Fe.current),function(){cancelAnimationFrame(e),window.removeEventListener("resize",Ge),n&&n.disconnect()}}},[Te.open,Ge]),t.useEffect(function(){var e=He.current;if(e&&Te.open){var n=function(e){Fe.current&&Fe.current.contains(e.target)||(Ie(null),Ye())};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})}}},[Te.open,Ye]),t.useEffect(function(){var e=He.current;if(e&&Me.open){var n=function(){Ue()};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})}}},[Me.open,Ue]);var Xe=t.useMemo(function(){var n,t,i,r,o,l,s,c,u,d,f,v;return{fields:null!==(n=null==B?void 0:B.fields)&&void 0!==n?n:a.DEFAULT_FIELD_CONFIG,thresholds:{high:null!==(i=null===(t=null==B?void 0:B.thresholds)||void 0===t?void 0:t.high)&&void 0!==i?i:a.DEFAULT_COMPARISON_CONFIG.thresholds.high,medium:null!==(o=null===(r=null==B?void 0:B.thresholds)||void 0===r?void 0:r.medium)&&void 0!==o?o:a.DEFAULT_COMPARISON_CONFIG.thresholds.medium,exact:null!==(s=null===(l=null==B?void 0:B.thresholds)||void 0===l?void 0:l.exact)&&void 0!==s?s:a.DEFAULT_COMPARISON_CONFIG.thresholds.exact},relationStyles:{noContent:e.__assign(e.__assign({},a.DEFAULT_COMPARISON_CONFIG.relationStyles.noContent),(null===(c=null==B?void 0:B.relationStyles)||void 0===c?void 0:c.noContent)||{}),high:e.__assign(e.__assign({},a.DEFAULT_COMPARISON_CONFIG.relationStyles.high),(null===(u=null==B?void 0:B.relationStyles)||void 0===u?void 0:u.high)||{}),exact:e.__assign(e.__assign({},a.DEFAULT_COMPARISON_CONFIG.relationStyles.exact),(null===(d=null==B?void 0:B.relationStyles)||void 0===d?void 0:d.exact)||{}),medium:e.__assign(e.__assign({},a.DEFAULT_COMPARISON_CONFIG.relationStyles.medium),(null===(f=null==B?void 0:B.relationStyles)||void 0===f?void 0:f.medium)||{}),low:e.__assign(e.__assign({},a.DEFAULT_COMPARISON_CONFIG.relationStyles.low),(null===(v=null==B?void 0:B.relationStyles)||void 0===v?void 0:v.low)||{})}}},[B]),Je=t.useMemo(function(){if(j&&Object.keys(j).length>0)try{var n=function(n,t,i){var r,o,l,s,a,u,d,f,v;void 0===t&&(t=!1),void 0===i&&(i=null);var h=[],x=[],g=n.base_root_id,p=n.input_index_map||{0:"left",1:"right"},m=n[g];if(!m||!1===m.display_node)return{activeProposed:{title:"No Data",sections:[]},activeVariants:[]};var y=function(t,r){var o,l=n[t];if(!l||!1===l.display_node)return null;var s=c.getSideData(l,r,p),a=!!s.title.trim(),u=!!s.content.trim(),d=c.getRationale(l),f=(null===(o=null==i?void 0:i[t])||void 0===o?void 0:o.evaluation_result)||l.evaluation_result||null,v=[];l.next&&Object.values(l.next).forEach(function(e){var t=n[e];if(t&&!1!==t.display_node){var i=y(e,r);i&&v.push(i)}});var h=!(!a&&!u);return e.__assign(e.__assign({id:t,title:a?s.title:"",content:u?s.content:"",subsections:v},h?d:{score:void 0,relation:"not_defined"}),{evaluationResult:f})};if(t){var _={},b={},S=-1,R=-1;for(var I in n)if(!["base_root_id","documents","input_index_map",g].includes(I)){var F=n[I];if(F&&!1!==F.display_node){var w=c.getRationale(F),C=c.getSideData(F,"0",p),E=c.getSideData(F,"1",p),j=C.title.trim()||C.content.trim(),B=E.title.trim()||E.content.trim(),T=(null===(r=null==i?void 0:i[I])||void 0===r?void 0:r.evaluation_result)||F.evaluation_result||null,k=Number(null!==(l=null===(o=C.attributes)||void 0===o?void 0:o.display_index)&&void 0!==l?l:S--),D=Number(null!==(a=null===(s=E.attributes)||void 0===s?void 0:s.display_index)&&void 0!==a?a:R--),M=b[D]||e.__assign(e.__assign({id:I,title:B?E.title:"",content:B?E.content:"",subsections:[]},B?w:{score:void 0,relation:"not_defined"}),{refIndexes:[],selfIndex:D,evaluationResult:T}),A=_[k]||e.__assign(e.__assign({id:I,title:j?C.title:"",content:j?C.content:"",subsections:[]},j?w:{score:void 0,relation:"not_defined"}),{refIndexes:[],selfIndex:k,evaluationResult:T});Number(D)>=0&&Number(k)>=0&&(M.refIndexes.includes(Number(k))||M.refIndexes.push(Number(k)),A.refIndexes.includes(Number(D))||A.refIndexes.push(Number(D))),b[D]=M,_[k]=A}}x=Object.values(b).map(function(e){return e}),h=Object.values(_).map(function(e){return e}),x.sort(function(e,n){return e.selfIndex<0&&n.selfIndex>=0?1:e.selfIndex>=0&&n.selfIndex<0?-1:e.selfIndex-n.selfIndex}),h.sort(function(e,n){return e.selfIndex<0&&n.selfIndex>=0?1:e.selfIndex>=0&&n.selfIndex<0?-1:e.selfIndex-n.selfIndex})}else m.next&&Object.values(m.next).forEach(function(e){var t=n[e];t&&!1!==t.display_node&&(h.push(y(e,"0")||{id:e,title:"",content:"",subsections:[]}),x.push(y(e,"1")||{id:e,title:"",content:"",subsections:[]}))});return{activeProposed:{title:(null===(d=null===(u=m.comparison_inputs)||void 0===u?void 0:u[p[0]])||void 0===d?void 0:d.title)||"Uploaded Contract",description:m.decision_scope_description||"",sections:h},activeVariants:[{id:"tree-variant-1",title:(null===(v=null===(f=m.comparison_inputs)||void 0===f?void 0:f[p[1]])||void 0===v?void 0:v.title)||"Reference Template",similarity:0,sections:x,analysis:{rule_difference_comparison:{summary:{overall_score:0,overall_summary:m.decision_scope_description||""},fields:{}}}}]}}(j,L,N);return e.__assign(e.__assign({},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(j),L,JSON.stringify(N)]),Qe=Je.activeProposed,Ze=Je.activeVariants,$e=Je.parseError;t.useEffect(function(){$e&&J("Failed to load comparison: ".concat($e))},[$e]);var en=t.useState(null),nn=en[0];en[1];var tn=t.useState({}),rn=tn[0],on=tn[1],ln=t.useState({}),sn=ln[0],cn=ln[1],an=(null==Ze?void 0:Ze[0])||_,un=null===(g=null===(v=null==j?void 0:j.documents)||void 0===v?void 0:v[null===(h=null==j?void 0:j.input_index_map)||void 0===h?void 0:h[0]])||void 0===g?void 0:g.title,dn=null===(I=null===(p=null==j?void 0:j.documents)||void 0===p?void 0:p[null===(R=null==j?void 0:j.input_index_map)||void 0===R?void 0:R[1]])||void 0===I?void 0:I.title,fn=c.safeStringify(T||un||"Uploaded Contract"),vn=c.safeStringify(k||dn||"Reference Template"),hn=t.useMemo(function(){return(null==Qe?void 0:Qe.sections)||[]},[null==Qe?void 0:Qe.sections]),xn=t.useMemo(function(){return an.sections||[]},[an.sections]),gn=hn.length>0||xn.length>0,pn=an.analysis,mn=c.safeStringify(null===(w=null===(F=null==pn?void 0:pn.rule_difference_comparison)||void 0===F?void 0:F.summary)||void 0===w?void 0:w.overall_summary),yn=!!mn.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),_n=t.useRef({}),bn=function(e){return _n.current[e]||(_n.current[e]=x.default.createRef()),_n.current[e]},Sn=t.useCallback(function(){$(!1),ye.current=!1,On(null),_e.current=null,En.current=null,te(!1),U(!1),We.current&&(We.current.style.height="0px"),Le.current&&(Le.current.style.height="0px"),ze.current&&(ze.current.style.height="0px"),Pe.current&&(Pe.current.style.height="0px")},[]),Rn=t.useCallback(function(e,n,t,i,r){var o,l,s=c.safeStringify(n.id)||c.safeStringify(t.id)||"",a=(s?be[s]:null)||n.cognitiveData||t.cognitiveData||{section_id:s,decisioning:[],gap:[],relevance_score:0},u=null!==(l=null===(o=_n.current[i])||void 0===o?void 0:o.current)&&void 0!==l?l:null;return{open:!0,sectionTitle:n.title||"N/A",refSectionTitle:t.title||"NA",cognitiveData:a,anchorEl:e,sectionAnchorEl:u,badgeStyle:r||null,sectionIdx:i,docData:{documents:null==j?void 0:j.documents,input_index_map:null==j?void 0:j.input_index_map},deviationData:n.evaluationResult||t.evaluationResult||null}},[be,j]),In=t.useCallback(function(e){Ue(),Ie(null),ke(e)},[Ue]),Fn=t.useCallback(function(){null!==Me.sectionIdx&&Me.anchorEl?In(e.__assign(e.__assign({},Me),{open:!0})):Ue()},[Me,Ue,In]);t.useCallback(function(e){Ue(),J("".concat(e," is coming soon."))},[Ue]);var wn=t.useCallback(function(){var e=Me.sectionIdx;Ue(),null!==e&&(ye.current&&Sn(),ae(function(n){return n.has(e)?new Set:new Set([e])}))},[Me.sectionIdx,Ue,Sn]),Cn=t.useRef(null),En=t.useRef(null),jn=t.useRef(null),Bn=t.useRef(null),Tn=t.useRef(null),kn=t.useState([]),Dn=kn[0],Mn=kn[1],An=t.useState(null),Hn=An[0],On=An[1];t.useRef(null);var Nn=t.useState(null),Wn=Nn[0],Ln=Nn[1],zn=t.useMemo(function(){return Xe.fields.filter(function(e){var n=e.key;return(!gn||"description"!==n)&&(c.hasValue(null==Qe?void 0:Qe[n])||c.hasValue(an[n]))})},[Qe,an,gn,Xe.fields]),Pn=t.useRef({}),qn=t.useRef({}),Vn=t.useRef({}),Kn=t.useRef({}),Yn=t.useRef({}),Un=t.useRef({}),Gn=t.useRef({}),Xn=t.useRef({}),Jn=t.useRef({});zn.forEach(function(e){for(var n=e.key,t=0;t<Math.max(hn.length,xn.length);t+=1)Vn.current[t]||(Vn.current[t]=x.default.createRef()),Kn.current[t]||(Kn.current[t]=x.default.createRef()),Yn.current[t]||(Yn.current[t]=x.default.createRef()),Un.current[t]||(Un.current[t]=x.default.createRef()),Gn.current[t]||(Gn.current[t]=x.default.createRef());Pn.current[n]||(Pn.current[n]=x.default.createRef()),qn.current[n]||(qn.current[n]=x.default.createRef())});for(var Qn=0;Qn<Math.max(hn.length,xn.length);Qn+=1)Vn.current[Qn]||(Vn.current[Qn]=x.default.createRef()),Kn.current[Qn]||(Kn.current[Qn]=x.default.createRef()),Yn.current[Qn]||(Yn.current[Qn]=x.default.createRef()),Un.current[Qn]||(Un.current[Qn]=x.default.createRef()),Gn.current[Qn]||(Gn.current[Qn]=x.default.createRef());t.useEffect(function(){if(nn){var e=Xe.fields.find(function(e){return e.analysisKey===nn||e.key===nn});if(e){var n=Pn.current[e.key]||qn.current[e.key];(null==n?void 0:n.current)&&setTimeout(function(){return n.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[nn,Xe.fields]);var Zn=t.useCallback(function(e){var n,t,i,r,o,l,s,c,a,u=null===(n=null==pn?void 0:pn.rule_difference_comparison)||void 0===n?void 0:n.fields;if(!u||!u[e])return{score:0,relation:"",highlightsA:[],highlightsB:[],hasContent:!1};var d=u[e],f=(null==d?void 0:d.relation)||(null===(i=null===(t=null==d?void 0:d.highlights)||void 0===t?void 0:t.ruleA_spans)||void 0===i?void 0:i.length)||(null===(o=null===(r=null==d?void 0:d.highlights)||void 0===r?void 0:r.ruleB_spans)||void 0===o?void 0:o.length)||(null==d?void 0:d.mappings)&&d.mappings.length>0;if(d.mappings){var v=d.mappings[0]||{};return{score:d.score,relation:v.relation||"",highlightsA:(null===(l=v.highlights)||void 0===l?void 0:l.ruleA_spans)||[],highlightsB:(null===(s=v.highlights)||void 0===s?void 0:s.ruleB_spans)||[],hasContent:!!f}}return{score:d.score,relation:d.relation||"",highlightsA:(null===(c=d.highlights)||void 0===c?void 0:c.ruleA_spans)||[],highlightsB:(null===(a=d.highlights)||void 0===a?void 0:a.ruleB_spans)||[],hasContent:!!f}},[pn]),$n=t.useCallback(function(n){var t,i,r,o,l=hn[n],s=xn[n],a=(null==l?void 0:l.relation)&&"not_defined"!==l.relation,u=(null==s?void 0:s.relation)&&"not_defined"!==s.relation,d=c.safeStringify(null==l?void 0:l.id)||c.safeStringify(null==s?void 0:s.id)||"",f=!(!(null==l?void 0:l.cognitiveData)&&!(null==s?void 0:s.cognitiveData));if(!a&&!u&&!f)return e.__assign(e.__assign({},Xe.relationStyles.noContent),{label:"Not Defined"});var v=Zn("description");if(null!=(null!==(i=null!==(t=null==l?void 0:l.cognitiveRelevanceScore)&&void 0!==t?t:null==s?void 0:s.cognitiveRelevanceScore)&&void 0!==i?i:d?null===(r=be[d])||void 0===r?void 0:r.relevance_score:void 0)){var h=c.cognitiveScoreToRelation(),x=h.score,g=h.relation;return c.getStyleForRelation(x,g,!0,Xe)}var p=a?l.relation:u?s.relation:v.relation,m=null!==(o=null==l?void 0:l.score)&&void 0!==o?o:null==s?void 0:s.score,y="number"==typeof m?m:v.score;return c.getStyleForRelation(y,p,!0,Xe)},[hn,xn,be,Xe,Zn]),et=t.useCallback(function(){var e,n,t,i,r,o,l,s,a,u;if(!Ve.current&&!he.current){Ve.current=!0;try{if(!Cn.current)return;var d=function(e){var n=e.split("-"),t=n[0];if(!rn[t]&&!1===L)return!1;if(L&&!rn["left-".concat(t)]&&!rn["right-".concat(t)]&&!rn[t])return!1;for(var i=t,r=1;r<n.length-1;r++)if(i+="-".concat(n[r]),!sn[i])return!1;return!0},f=Cn.current.getBoundingClientRect();Ee({width:f.width,height:f.height});var v=[];if(zn.forEach(function(e){var n,t,i=e.key,r=null===(n=Pn.current[i])||void 0===n?void 0:n.current,o=null===(t=qn.current[i])||void 0===t?void 0:t.current;r&&o&&(r.style.height="auto",o.style.height="auto",r.style.minHeight="0px",o.style.minHeight="0px")}),!he.current){for(var h=0;h<Math.max(hn.length,xn.length);h++){var x=null===(e=Vn.current[h])||void 0===e?void 0:e.current,g=null===(n=Kn.current[h])||void 0===n?void 0:n.current;x&&(x.style.height="auto",x.style.minHeight="0px"),g&&(g.style.height="auto",g.style.minHeight="0px")}L||Object.keys(Xn.current).forEach(function(e){var n,t;if(d(e)){var i=null===(n=Xn.current[e])||void 0===n?void 0:n.current,r=null===(t=Jn.current[e])||void 0===t?void 0:t.current;i&&r&&(i.style.height="auto",r.style.height="auto",i.style.minHeight="0px",r.style.minHeight="0px")}})}var p={};zn.forEach(function(e){var n,t,i=e.key,r=null===(n=Pn.current[i])||void 0===n?void 0:n.current,o=null===(t=qn.current[i])||void 0===t?void 0:t.current;if(r&&o){var l=r.getBoundingClientRect(),s=o.getBoundingClientRect();p[i]=Math.max(l.height,s.height)}});var m={left:{},right:{}},_={};if(!he.current)if(L){if(Z&&null!==Hn){var b=Hn,S=hn[b],R=null===(r=Vn.current[b])||void 0===r?void 0:r.current;R&&S&&(S.refIndexes||[]).forEach(function(e){var n,t=xn.findIndex(function(n){return n.selfIndex===e}),i=null===(n=Kn.current[t])||void 0===n?void 0:n.current;if(i&&(rn["left-".concat(b)]||rn["right-".concat(t)])){var r=Math.max(R.getBoundingClientRect().height,i.getBoundingClientRect().height);m.left[b]=Math.max(m.left[b]||0,r),m.right[t]=Math.max(m.right[t]||0,r)}})}}else{for(h=0;h<Math.min(hn.length,xn.length);h++){x=null===(t=Vn.current[h])||void 0===t?void 0:t.current,g=null===(i=Kn.current[h])||void 0===i?void 0:i.current;var I=!!rn[String(h)];if(x&&g&&I){var F=Math.max(x.getBoundingClientRect().height,g.getBoundingClientRect().height);m.left[h]=F,m.right[h]=F}}Object.keys(Xn.current).forEach(function(e){var n,t;if(d(e)){var i=null===(n=Xn.current[e])||void 0===n?void 0:n.current,r=null===(t=Jn.current[e])||void 0===t?void 0:t.current;if(i&&r&&null!==i.offsetParent&&null!==r.offsetParent){var o=i.getBoundingClientRect(),l=r.getBoundingClientRect();_[e]=Math.max(o.height,l.height)}}})}if(zn.forEach(function(e){var n,t,i=e.key,r=null===(n=Pn.current[i])||void 0===n?void 0:n.current,o=null===(t=qn.current[i])||void 0===t?void 0:t.current;if(r&&o){var l=p[i];r.style.minHeight="".concat(l,"px"),o.style.minHeight="".concat(l,"px")}}),he.current||(Object.entries(m.left).forEach(function(e){var n,t=e[0],i=e[1],r=null===(n=Vn.current[Number(t)])||void 0===n?void 0:n.current;r&&(r.style.minHeight="".concat(i,"px"))}),Object.entries(m.right).forEach(function(e){var n,t=e[0],i=e[1],r=null===(n=Kn.current[Number(t)])||void 0===n?void 0:n.current;r&&(r.style.minHeight="".concat(i,"px"))}),L||Object.keys(_).forEach(function(e){var n,t,i=null===(n=Xn.current[e])||void 0===n?void 0:n.current,r=null===(t=Jn.current[e])||void 0===t?void 0:t.current;if(i&&r&&_[e]){var o=_[e];i.style.minHeight="".concat(o,"px"),r.style.minHeight="".concat(o,"px")}})),zn.forEach(function(e){var n,t,i=e.key,r=e.analysisKey,o=null===(n=Pn.current[i])||void 0===n?void 0:n.current,l=null===(t=qn.current[i])||void 0===t?void 0:t.current;if(o&&l){var s=o.getBoundingClientRect(),a=l.getBoundingClientRect(),u=Zn(r),d=c.getStyleForRelation(u.score,u.relation,u.hasContent,Xe);if(!d)return;var h=s.top+s.height/2-f.top;v.push({id:"field-".concat(i),x1:s.right-f.left,y1:h,x2:a.left-f.left,y2:h,style:d})}}),L)hn.forEach(function(e,n){var t;(null===(t=Vn.current[n])||void 0===t?void 0:t.current)&&(e.refIndexes||[]).forEach(function(e){var t,i,r,o,l,s,c,a,u,d,h=xn.findIndex(function(n){return n.selfIndex===e});if(-1!==h){var x=null===(t=Yn.current[n])||void 0===t?void 0:t.current,g=null===(i=Un.current[h])||void 0===i?void 0:i.current;if(x&&g){var p=x.getBoundingClientRect(),m=g.getBoundingClientRect(),y=p.right-f.left,_=m.left-f.left,b=p.top+p.height/2-f.top,S=m.top+m.height/2-f.top;if(Z&&Hn===n){var R=null!==(o=null===(r=qe.current)||void 0===r?void 0:r.getBoundingClientRect().top)&&void 0!==o?o:0,I=null!==(s=null===(l=Ne.current)||void 0===l?void 0:l.getBoundingClientRect().top)&&void 0!==s?s:0,F=R+(null!==(a=null===(c=qe.current)||void 0===c?void 0:c.clientHeight)&&void 0!==a?a:1/0),w=I+(null!==(d=null===(u=Ne.current)||void 0===u?void 0:u.clientHeight)&&void 0!==d?d:1/0),C=p.top+p.height/2,E=function(e,n,t){return Math.max(n,Math.min(t,e))};b=E(C,R,F)-f.top,S=E(C,I,w)-f.top}var j=$n(n);j&&v.push({id:"line-".concat(n,"-").concat(h),x1:y,y1:b,x2:_,y2:S,style:j,sectionIdx:n,targetRightIdx:h})}}})});else{for(h=0;h<Math.min(hn.length,xn.length);h++){var w=null===(o=Vn.current[h])||void 0===o?void 0:o.current,C=null===(l=Kn.current[h])||void 0===l?void 0:l.current;if(w&&C){var E=w.getBoundingClientRect(),j=C.getBoundingClientRect(),B=(E.top+18-f.top+j.top+18-f.top)/2,T=(null===(s=xn[h])||void 0===s?void 0:s.id)||"sec-".concat(h),k=$n(h);k&&v.push({id:T,x1:E.right-f.left,y1:B,x2:j.left-f.left,y2:B,style:k,sectionIdx:h,hasCognitive:!!((null===(a=hn[h])||void 0===a?void 0:a.cognitiveData)||(null===(u=xn[h])||void 0===u?void 0:u.cognitiveData)||T&&be[T])})}}Object.keys(Xn.current).forEach(function(e){var n,t,i,r,o,l;if(d(e)){var s=null===(n=Xn.current[e])||void 0===n?void 0:n.current,a=null===(t=Jn.current[e])||void 0===t?void 0:t.current;if(s&&a&&null!==s.offsetParent&&null!==a.offsetParent){for(var u=s.getBoundingClientRect(),h=a.getBoundingClientRect(),x=(u.top+16-f.top+h.top+16-f.top)/2,g=e.split("-").map(Number),p=hn[g[0]],m=xn[g[0]],y=1;y<g.length;y++)(null==p?void 0:p.subsections)&&(p=p.subsections[g[y]]),(null==m?void 0:m.subsections)&&(m=m.subsections[g[y]]);if(!p&&!m)return;var _=(null==p?void 0:p.relation)&&"not_defined"!==p.relation,b=(null==m?void 0:m.relation)&&"not_defined"!==m.relation,S=c.safeStringify(null==p?void 0:p.id)||c.safeStringify(null==m?void 0:m.id)||"",R=!(!(null==p?void 0:p.cognitiveData)&&!(null==m?void 0:m.cognitiveData)),I=null;if(_||b||R){var F=null!==(r=null!==(i=null==p?void 0:p.cognitiveRelevanceScore)&&void 0!==i?i:null==m?void 0:m.cognitiveRelevanceScore)&&void 0!==r?r:S?null===(o=be[S])||void 0===o?void 0:o.relevance_score:void 0;if(null!=F){var w=c.cognitiveScoreToRelation(F),C=w.score,E=w.relation;I=c.getStyleForRelation(C,E,!0,Xe)}else{E=_?p.relation:b?m.relation:"not_defined";var j=null!==(l=null==p?void 0:p.score)&&void 0!==l?l:null==m?void 0:m.score;C="number"==typeof j?j:0;I=c.getStyleForRelation(C,E,!0,Xe)}}else I={badgeBg:"#EEF2FF",badgeText:"#3730A3",badgeBorder:"#C7D2FE",label:"N/A"};I&&v.push({id:"subsec-".concat(e),x1:u.right-f.left,y1:x,x2:h.left-f.left,y2:x,style:I,sectionIdx:g[0],isSubSection:!0,subSectionKeyPath:e,hasCognitive:R||S&&be[S]})}}})}if(Mn(v),Bn.current&&Tn.current){var D=Bn.current.getBoundingClientRect(),M=Tn.current.getBoundingClientRect(),A=(D.top+D.height/2-f.top+M.top+M.height/2-f.top)/2;Ln({x1:D.right-f.left,x2:M.left-f.left,y:A})}else Ln(null);if(L&&ce.size>0){var H=[],O=qe.current,N=Ne.current;if(O&&N){var W=[],z=O.getBoundingClientRect().top,P=N.getBoundingClientRect().top,q=z+O.clientHeight,V=P+N.clientHeight,K=O.scrollTop,Y=N.scrollTop,U=f.top,G=function(e,n,t){return Math.max(n,Math.min(t,e))};ce.forEach(function(e){var n,t=hn[e];(null===(n=null==t?void 0:t.refIndexes)||void 0===n?void 0:n.length)&&t.refIndexes.forEach(function(n){var t,i,r=xn.findIndex(function(e){return e.selfIndex===n});if(-1!==r){var o=null===(t=Yn.current[e])||void 0===t?void 0:t.current,l=null===(i=Un.current[r])||void 0===i?void 0:i.current;if(o&&l){var s=o.getBoundingClientRect(),c=l.getBoundingClientRect(),a=$n(e),u=s.right-f.left,d=c.left-f.left-0,v=u+.65*(d-u),h=s.top+s.height/2,x=c.top+c.height/2,g=h-z+K,p=x-P+Y,m="conn-".concat(e,"-").concat(r);W.push({lhsScrollY:g,rhsScrollY:p,x1:u,x2:d,containerTop:U,leftIdx:e,rhsArrayIdx:r,styleColor:(null==a?void 0:a.badgeBorder)||"#6366F1",styleId:m});var _=G(h,z,q),b=G(x,P,V),S=_-U,R=b-U,I=h>=z-4&&h<=q+4,F=x>=P-4&&x<=V+4,w="";w=I&&F?y(u,S,d,R):I&&!F?"M ".concat(u,",").concat(S," L ").concat(v,",").concat(S," L ").concat(v,",").concat(R):!I&&F?"M ".concat(v,",").concat(S," L ").concat(v,",").concat(R," L ").concat(d,",").concat(R):"M ".concat(v,",").concat(S," L ").concat(v,",").concat(R),H.push({id:m,pathD:w,style:a,leftIdx:e,rhsArrayIdx:r})}}})}),pe.current=W}fe(H)}else fe([]),pe.current=[]}catch(e){console.error("Line render safe fail: ",e)}finally{Ve.current=!1}}},[zn,hn,xn,be,Xe,Zn,$n,L,Z,Hn,ce,rn,sn]),nt=t.useCallback(function(){var e,n,t,i,r,o,l,s,c,a,u,d,f,v,h=pe.current;if(h.length&&!he.current){var x=null!==(n=null===(e=qe.current)||void 0===e?void 0:e.scrollTop)&&void 0!==n?n:0,g=null!==(i=null===(t=Ne.current)||void 0===t?void 0:t.scrollTop)&&void 0!==i?i:0,p=null!==(o=null===(r=qe.current)||void 0===r?void 0:r.clientHeight)&&void 0!==o?o:1/0,m=null!==(s=null===(l=Ne.current)||void 0===l?void 0:l.clientHeight)&&void 0!==s?s:1/0,_=null!==(a=null===(c=qe.current)||void 0===c?void 0:c.getBoundingClientRect().top)&&void 0!==a?a:0,b=null!==(d=null===(u=Ne.current)||void 0===u?void 0:u.getBoundingClientRect().top)&&void 0!==d?d:0,S=_+p,R=b+m,I=null!==(v=null===(f=Cn.current)||void 0===f?void 0:f.getBoundingClientRect().top)&&void 0!==v?v:0,F=function(e,n,t){return Math.max(n,Math.min(t,e))};h.forEach(function(e){var n=e.lhsScrollY-x+_,t=e.rhsScrollY-g+b,i=ge.current[e.styleId+"-stroke"],r=ge.current[e.styleId+"-bg"];if(i||r){var o,l=F(n,_,S),s=F(t,b,R),c=l-I,a=s-I,u=n>=_-4&&n<=S+4,d=t>=b-4&&t<=R+4,f=e.x1+.65*(e.x2-e.x1);o=u&&d?y(e.x1,c,e.x2,a):u&&!d?"M ".concat(e.x1,",").concat(c," L ").concat(f,",").concat(c," L ").concat(f,",").concat(a):!u&&d?"M ".concat(f,",").concat(c," L ").concat(f,",").concat(a," L ").concat(e.x2,",").concat(a):"M ".concat(f,",").concat(c," L ").concat(f,",").concat(a),i&&(i.setAttribute("visibility","visible"),i.setAttribute("d",o)),r&&(r.setAttribute("visibility","visible"),r.setAttribute("d",o))}})}},[]),tt=t.useRef(et);t.useEffect(function(){tt.current=et},[et]);var it=t.useRef(null),rt=t.useCallback(function(){null!==it.current&&clearTimeout(it.current),it.current=setTimeout(function(){tt.current(),it.current=null},50)},[]),ot=t.useCallback(function(e){var n,t,i,r,o,l;if(!ie.current){if(ye.current){var s=_e.current,c=En.current,a=qe.current,u=Ne.current;if(null!==s&&null!==c&&a&&u){var d=null===(n=_n.current[s])||void 0===n?void 0:n.current,f=null===(t=Gn.current[c])||void 0===t?void 0:t.current;if(d&&f){if(e.currentTarget===a){var v=d.offsetTop-a.scrollTop,h=f.offsetTop-v,x=u.scrollHeight-u.clientHeight,g=Math.max(0,Math.min(h,x));Math.abs(u.scrollTop-g)>1&&(u.scrollTop=g)}else if(e.currentTarget===u){var p=f.offsetTop-u.scrollTop,m=d.offsetTop-p,y=a.scrollHeight-a.clientHeight,_=Math.max(0,Math.min(m,y));Math.abs(a.scrollTop-_)>1&&(a.scrollTop=_)}if(jn.current){var b=null===(i=Yn.current[s])||void 0===i?void 0:i.current,S=null===(r=Un.current[c])||void 0===r?void 0:r.current,R=null!==(l=null===(o=Cn.current)||void 0===o?void 0:o.getBoundingClientRect().top)&&void 0!==l?l:0,I=a.getBoundingClientRect().top,F=I+a.clientHeight,w=u.getBoundingClientRect().top,C=w+u.clientHeight,E=function(e,n,t){return Math.max(n,Math.min(t,e))};if(b&&S){var j=b.getBoundingClientRect(),B=S.getBoundingClientRect(),T=j.top+j.height/2,k=B.top+B.height/2,D=E(T,I,F),M=E(k,w,C);jn.current.setAttribute("y1",(D-R).toString()),jn.current.setAttribute("y2",(M-R).toString());var A=T>=I-4&&T<=F+4;jn.current.setAttribute("visibility",A?"visible":"hidden")}}}}}pe.current.length>0&&!me.current&&(me.current=!0,requestAnimationFrame(function(){nt(),me.current=!1}))}},[nt]);t.useEffect(function(){var e=setTimeout(rt,250);window.addEventListener("resize",rt);var n=null,t=null;return He.current&&(n=new ResizeObserver(rt)).observe(He.current),Cn.current&&(t=new ResizeObserver(rt)).observe(Cn.current),function(){clearTimeout(e),window.removeEventListener("resize",rt),null==n||n.disconnect(),null==t||t.disconnect()}},[Qe,an,pn,zn,rn,sn,hn,xn,Xe,rt,Z,Hn,ne,ce]),t.useEffect(function(){ye.current=Z},[Z]),t.useEffect(function(){_e.current=Hn},[Hn]);var lt=t.useCallback(function(){var e=Me.sectionIdx;Ue(),null!==e&&(Z&&Hn===e?Sn():(ae(new Set),fe([]),pe.current=[],U(!0),ie.current=!0,On(e),_e.current=e,$(!0),ye.current=!0,te(!1),We.current&&(We.current.style.height="0px"),Le.current&&(Le.current.style.height="0px"),ze.current&&(ze.current.style.height="0px"),Pe.current&&(Pe.current.style.height="0px"),requestAnimationFrame(function(){var n,t,i=null===(n=_n.current[e])||void 0===n?void 0:n.current,r=hn[e],o=(null==r?void 0:r.refIndexes)||[],l=null,s=-1;if(o.length>0){var c=o[0];s=xn.findIndex(function(e){return e.selfIndex===c}),l=null===(t=Gn.current[s])||void 0===t?void 0:t.current}En.current=-1!==s?s:null;var a=qe.current,u=Ne.current;if(!i||!a)return ie.current=!1,void U(!1);var d=i.offsetTop-a.scrollTop;if(!l||!u)return te(!0),tt.current(),ie.current=!1,void U(!1);var f=l.offsetTop-d;f<0&&We.current&&(We.current.style.height="".concat(Math.abs(f),"px"));requestAnimationFrame(function(){var e,n=u.scrollHeight-u.clientHeight;if(f<0)e=0;else{if(f>n){var t=f-n;return Le.current&&(Le.current.style.height="".concat(t+150,"px")),void requestAnimationFrame(function(){S(u,f,200,function(){te(!0),tt.current(),ie.current=!1,U(!1)})})}e=f}S(u,e,200,function(){te(!0),tt.current(),ie.current=!1,U(!1)})})})))},[Ue,Me.sectionIdx,Z,Hn,hn,xn,rt,Sn]),st=null!==Me.sectionIdx&&ce.has(Me.sectionIdx),ct=function(t){var o,l=t.section,s=t.idx,a=t.columnKey,u=t.colRef,d=t.mb,f=void 0===d?1:d,v=t.parentNodeId,h=void 0===v?"":v,g=L?!!rn["".concat(a,"-").concat(s)]:!!rn[String(s)],p=c.hasValue(l.title),y=c.hasValue(l.content),_=!p&&!y,b=l.title;p||(b=y?"No Title Found":"No Matching Section Found");var S,R=[];if(null===(o=l.evaluationResult)||void 0===o?void 0:o.deviations){var I=l.evaluationResult.deviations;for(var F in I){var w=I[F][h];w&&R.push(w)}}return n.jsx(i.Box,e.__assign({ref:u,sx:{mb:f,width:"100%",display:"flex",flexDirection:"column",position:"relative",minWidth:0}},{children:n.jsxs(i.Accordion,e.__assign({disableGutters:!0,expanded:!_&&g,onChange:function(){return!_&&function(n,t){var i,r;he.current=!0,xe.current&&clearTimeout(xe.current),ve.current&&(ve.current.style.opacity="0");var o=null===(i=Vn.current[n])||void 0===i?void 0:i.current,l=null===(r=Kn.current[n])||void 0===r?void 0:r.current;if(o&&(o.style.minHeight="0px"),l&&(l.style.minHeight="0px"),Object.keys(Xn.current).forEach(function(e){var t,i;if(e.startsWith("".concat(n,"-"))){var r=null===(t=Xn.current[e])||void 0===t?void 0:t.current,o=null===(i=Jn.current[e])||void 0===i?void 0:i.current;r&&(r.style.minHeight="0px"),o&&(o.style.minHeight="0px")}}),L){var s=hn[n];((null==s?void 0:s.refIndexes)||[]).forEach(function(e){var n,t=xn.findIndex(function(n){return n.selfIndex===e}),i=null===(n=Kn.current[t])||void 0===n?void 0:n.current;i&&(i.style.minHeight="0px")});var c=xn[n],a=null==c?void 0:c.selfIndex;hn.forEach(function(e,n){var t,i;if(null===(t=e.refIndexes)||void 0===t?void 0:t.includes(a)){var r=null===(i=Vn.current[n])||void 0===i?void 0:i.current;r&&(r.style.minHeight="0px")}})}xe.current=setTimeout(function(){he.current=!1,tt.current(),ve.current&&(ve.current.style.opacity="1")},550),on(function(i){var r=e.__assign({},i);if(!L){var o=!!i[String(n)];return r[String(n)]=!o,r}var l="".concat(t,"-").concat(n),s=!i[l];if(r[l]=s,"left"===t)((null==(c=hn[n])?void 0:c.refIndexes)||[]).forEach(function(e){var n=xn.findIndex(function(n){return n.selfIndex===e});-1!==n&&(r["right-".concat(n)]=s)});else{var c,a=null==(c=xn[n])?void 0:c.selfIndex;hn.forEach(function(e,n){var t;(null===(t=e.refIndexes)||void 0===t?void 0:t.includes(a))&&(r["left-".concat(n)]=s)})}return r})}(s,a)},sx:{boxShadow:"none",border:_?"1px dashed #E2E8F0":"1px solid #E2E8F0",bgcolor:_?"#FAFAFA":"#FFFFFF",borderRadius:"6px",flexGrow:1,width:"100%",display:"flex",flexDirection:"column",minWidth:0,"&:before":{display:"none"}}},{children:[n.jsx(i.AccordionSummary,e.__assign({expandIcon:_?null:n.jsx(r.ChevronDown,{size:16}),sx:{minHeight:"36px",flexShrink:0,cursor:_?"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:n.jsx(i.Tooltip,e.__assign({title:b,placement:"top"},{children:n.jsx(i.Typography,e.__assign({component:"div",sx:{fontSize:"12px",color:_?"#94A3B8":"#19213D",fontWeight:_?400:700,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0}},{children:(S=b,S?c.safeStringify(S).replace(/\\n/g,"\n").split(/(\*\*.*?\*\*)/g).map(function(e,t){return e.startsWith("**")&&e.endsWith("**")?n.jsx("strong",{children:e.slice(2,-2)},t):n.jsx(x.default.Fragment,{children:e},t)}):null)}))}))})),!_&&n.jsxs(i.AccordionDetails,e.__assign({sx:{pt:0,pb:1.25,bgcolor:"#FFFFFF",flex:1,display:"flex",flexDirection:"column",minWidth:0}},{children:[n.jsx(m,{content:l.content,sxStyles:je,highlights:R}),(l.subsections||[]).map(function(e,n){return at({section:e,keyPath:"".concat(s,"-").concat(n),depth:0,columnKey:a,parentNodeId:h})})]}))]}))}),"".concat(a,"-sec-").concat(s))},at=function(t){var o=t.section,l=t.keyPath,s=t.depth,a=void 0===s?0:s,u=t.columnKey,d=void 0===u?"left":u,f=t.parentNodeId,v=void 0===f?"":f,h=c.hasValue(o.title),g=c.hasValue(o.content),p=!h&&!g,y=h?o.title:g?"No Title Found":"No Matching Section Found",_=!!sn[l];"left"!==d||Xn.current[l]||(Xn.current[l]=x.default.createRef()),"right"!==d||Jn.current[l]||(Jn.current[l]=x.default.createRef());var b="left"===d?Xn.current[l]:Jn.current[l];return o.title?n.jsx(i.Box,e.__assign({ref:b,sx:{mt:1,width:"100%",minWidth:0,position:"relative"}},{children:n.jsxs(i.Accordion,e.__assign({disableGutters:!0,expanded:!p&&_,onChange:function(){return!p&&function(n){var t,i;he.current=!0,xe.current&&clearTimeout(xe.current),ve.current&&(ve.current.style.opacity="0");var r=null===(t=Xn.current[n])||void 0===t?void 0:t.current,o=null===(i=Jn.current[n])||void 0===i?void 0:i.current;r&&(r.style.minHeight="0px"),o&&(o.style.minHeight="0px"),xe.current=setTimeout(function(){he.current=!1,tt.current(),ve.current&&(ve.current.style.opacity="1")},450),cn(function(t){var i;return e.__assign(e.__assign({},t),((i={})[n]=!t[n],i))})}(l)},sx:{mt:0,boxShadow:"none",border:p?"1px dashed #E2E8F0":"1px solid #EEF2F7",borderRadius:"4px !important",bgcolor:"#FFFFFF",minWidth:0,"&:before":{display:"none"}}},{children:[n.jsx(i.AccordionSummary,e.__assign({expandIcon:p?null:n.jsx(r.ChevronDown,{size:14}),sx:{minHeight:"32px","& .MuiAccordionSummary-content":{my:.5,display:"grid",alignItems:"center",minWidth:0,width:"100%"}}},{children:n.jsx(i.Typography,e.__assign({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&&n.jsxs(i.AccordionDetails,e.__assign({sx:{pt:0,pb:1,minWidth:0}},{children:[g&&n.jsx(m,{content:o.content,sxStyles:je,highlights:function(){var e,n;if(!(null===(e=o.evaluationResult)||void 0===e?void 0:e.deviations))return[];var t=(null===(n=o.evaluationResult)||void 0===n?void 0:n.deviations)||{},i=[];for(var r in t){var l=t[r][v];l&&i.push(l)}return i}()}),(o.subsections||[]).map(function(e,n){return at({section:e,keyPath:"".concat(l,"-").concat(n),depth:a+1,columnKey:d,parentNodeId:v})})]}))]}))}),l):n.jsx(i.Box,e.__assign({ref:b,sx:{mt:0===a?1:.75,width:"100%",minWidth:0}},{children:!p&&n.jsxs("div",{children:[g&&n.jsx(m,{content:o.content,sxStyles:je,highlights:function(){var e,n;if(!(null===(e=o.evaluationResult)||void 0===e?void 0:e.deviations))return[];var t=(null===(n=o.evaluationResult)||void 0===n?void 0:n.deviations)||{},i=[];for(var r in t){var l=t[r][v];l&&i.push(l)}return i}()}),(o.subsections||[]).map(function(e,n){return at({section:e,keyPath:"".concat(l,"-").concat(n),depth:a+1,columnKey:d,parentNodeId:v})})]})}),l)};return n.jsxs(i.Box,e.__assign({ref:Oe,sx:e.__assign(e.__assign({display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif'},L?{}:{overflow:"visible"}),{position:"relative"})},{children:[q&&n.jsx(i.Box,e.__assign({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:n.jsx(f.default,{})})),L&&n.jsx(d.default,{open:Me.open,anchorEl:Me.anchorEl,sectionTitle:Me.sectionTitle,referenceSectionTitle:Me.refSectionTitle,onClose:Ue,onOpenCognitiveCompare:Fn,onOpenSideBySide:lt,onConnect:wn,isConnected:st}),Te.open&&n.jsx(u.default,{open:Te.open,popupRef:Fe,position:Re,popupConfig:H,onClose:function(){Ie(null),ke(function(n){return e.__assign(e.__assign({},n),{open:!1})}),le(null)},markdownStyles:D,sectionTitle:Te.sectionTitle,referenceSectionTitle:Te.refSectionTitle,cognitiveData:Te.cognitiveData,anchorEl:Te.anchorEl,sectionAnchorEl:Te.sectionAnchorEl,scrollContainerEl:He.current,badgeStyle:Te.badgeStyle,docData:Te.docData,deviationData:Te.deviationData}),n.jsx(i.Snackbar,e.__assign({open:!!X,autoHideDuration:8e3,onClose:function(){return J(null)},anchorOrigin:{vertical:"top",horizontal:"center"}},{children:n.jsx(i.Alert,e.__assign({onClose:function(){return J(null)},severity:"error",sx:{width:"100%",whiteSpace:"pre-line"}},{children:X}))})),(A.isHeaderVisible||A.isToggleVisible)&&n.jsxs(i.Box,e.__assign({sx:{px:2,py:1,display:"flex",alignItems:"center",justifyContent:"space-between",bgcolor:"#FFFFFF",border:"1.5px solid #EEF0F4",borderTopLeftRadius:"8px",borderTopRightRadius:"8px"}},{children:[n.jsx(i.Box,e.__assign({sx:{display:"flex",alignItems:"center",gap:1}},{children:A.isHeaderVisible&&n.jsx(i.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:600,color:"#0F172A"}},{children:E}))})),A.isToggleVisible&&n.jsx(i.Box,e.__assign({sx:{display:"flex",alignItems:"center"}},{children:n.jsx(i.FormControlLabel,{control:n.jsx(i.Switch,{checked:L,onChange:function(e){var n=e.target.checked;V(!0),setTimeout(function(){z(n),Sn(),ae(new Set),fe([]),pe.current=[],setTimeout(function(){V(!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}})}))]})),n.jsx(i.Box,e.__assign({ref:He,onScroll:ot,sx:{flex:1,minHeight:0,pt:1.5,pb:1,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",overflowY:L?"hidden":"auto",borderTop:mn&&yn?"none":"1.5px solid #EEF0F4"}},{children:n.jsx(i.Box,e.__assign({sx:e.__assign({display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"},L?{flex:1,minHeight:0}:{})},{children:n.jsxs(i.Box,e.__assign({ref:Cn,sx:e.__assign({display:"grid",gridTemplateColumns:"minmax(0, 1fr) 180px minmax(0, 1fr)",gap:"10px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0},L?{flex:1,overflow:"visible"}:{})},{children:[n.jsxs("svg",e.__assign({ref:ve,style:{position:"absolute",top:0,left:0,width:Ce.width||"100%",height:Ce.height||"100%",pointerEvents:"none",zIndex:10,overflow:"visible",transition:"opacity 0.15s ease-in-out"}},{children:[Wn&&n.jsxs("g",{children:[n.jsx("line",{x1:Wn.x1,y1:Wn.y,x2:Math.max(Wn.x1,(Wn.x1+Wn.x2)/2-70),y2:Wn.y,stroke:"#BBF7D0",strokeWidth:"1.5"}),n.jsx("line",{x1:Math.min(Wn.x2,(Wn.x1+Wn.x2)/2+70),y1:Wn.y,x2:Wn.x2,y2:Wn.y,stroke:"#BBF7D0",strokeWidth:"1.5"})]}),Dn.map(function(t){var l,s=(t.x1+t.x2)/2;if("Not Defined"===t.style.label&&!t.hasCognitive)return null;if(!L)return n.jsxs("g",{children:[n.jsx("line",{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:t.style.badgeBorder||"#E2E8F0",strokeWidth:"1.5"}),n.jsx("foreignObject",e.__assign({x:s-100,y:t.y1-14,width:"200",height:"28",style:{pointerEvents:"auto",overflow:"visible"}},{children:n.jsx(i.Box,e.__assign({sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},{children:n.jsxs(i.Box,e.__assign({onClick:function(e){if(e.stopPropagation(),Te.open&&oe===t.id)Ye();else{var n=hn[t.sectionIdx]||{title:"",content:""},i=xn[t.sectionIdx]||{title:"",content:""};if(t.isSubSection&&t.subSectionKeyPath){for(var r=t.subSectionKeyPath.split("-").map(Number),o=hn[r[0]],l=xn[r[0]],s=1;s<r.length;s++)(null==o?void 0:o.subsections)&&(o=o.subsections[r[s]]),(null==l?void 0:l.subsections)&&(l=l.subsections[r[s]]);o&&(n=o),l&&(i=l)}le(t.id),In(Rn(e.currentTarget,n,i,t.sectionIdx,t.style))}},sx:{display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",bgcolor:t.style.badgeBg,color:t.style.badgeText,border:"1px solid ".concat(t.style.badgeBorder),borderRadius:"12px",px:1.5,py:.5,fontWeight:500,textAlign:"center",whiteSpace:"nowrap",cursor:"pointer"}},{children:[t.style.label,n.jsx(i.Box,e.__assign({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:n.jsx(o.ButtonCognitiveIcon,{})})),n.jsx(r.ChevronDown,{size:11,style:{transform:Te.open&&oe===t.id?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))}))]},t.id);var c=hn[t.sectionIdx];return!(null===(l=null==c?void 0:c.refIndexes)||void 0===l?void 0:l.length)||(null==c?void 0:c.selfIndex)<0?null:Z&&Hn===t.sectionIdx&&ne?n.jsxs("g",e.__assign({style:{transition:"opacity 0.2s"}},{children:[n.jsx("defs",{children:n.jsx("marker",e.__assign({id:"arr-".concat(t.id),markerWidth:"7",markerHeight:"5",refX:"7",refY:"2.5",orient:"auto"},{children:n.jsx("polygon",{points:"0 0, 7 2.5, 0 5",fill:t.style.badgeBorder||"#6366F1"})}))}),n.jsx("line",{ref:jn,x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:t.style.badgeBorder||"#6366F1",strokeWidth:"1.5",markerEnd:"url(#arr-".concat(t.id,")")})]}),t.id):null}),de.map(function(t){var i,r=t.pathD,o=(null===(i=t.style)||void 0===i?void 0:i.badgeBorder)||"#6366F1",l="conn-marker-".concat(t.id),s="".concat(t.id,"-bg"),c="".concat(t.id,"-stroke");return n.jsxs("g",{children:[n.jsx("defs",{children:n.jsx("clipPath",e.__assign({id:"connections-clip"},{children:n.jsx("marker",e.__assign({id:l,markerWidth:"8",markerHeight:"6",refX:"7",refY:"3",orient:"auto"},{children:n.jsx("polygon",{points:"0 0, 8 3, 0 6",fill:o})}))}))}),n.jsx("path",{ref:function(e){ge.current[s]=e},d:r,fill:"none",stroke:"#FFFFFF",strokeWidth:"4",strokeOpacity:"0.7"}),n.jsx("path",{ref:function(e){ge.current[c]=e},d:r,fill:"none",stroke:o,strokeWidth:"1.75",markerEnd:"url(#".concat(l,")")})]},t.id)})]})),n.jsxs(i.Box,e.__assign({sx:e.__assign({border:"1px solid #E7E7E9",borderRadius:"8px",bgcolor:"#FFFFFF",display:"flex",flexDirection:"column",position:"relative",zIndex:2,filter:"drop-shadow(0px 2px 4px #F2F2F2)"},L?{flex:1,overflow:"visible"}:{})},{children:[n.jsx(i.Box,e.__assign({ref:Bn,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E7E7E9",borderRadius:"8px 8px 0 0",display:"flex",minHeight:"40px",alignItems:"center",overflowX:"hidden"}},{children:n.jsx(i.Tooltip,e.__assign({title:fn,placement:"top"},{children:n.jsx(i.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:500,color:"#19213D",overflow:"hidden",display:"flex",alignItems:"center",justifyContent:"center",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",height:"40px"}},{children:fn}))}))})),n.jsxs(i.Box,e.__assign({ref:qe,onScroll:ot,sx:e.__assign({p:"12px",display:"flex",flexDirection:"column"},L?{maxHeight:"calc(100vh - 150px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,mr:"-160px",pr:"172px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[n.jsx("div",{ref:ze,style:{width:"100%",height:"0px",flexShrink:0}}),gn&&hn.map(function(t,o){var l,s,c,a=!t.title&&!t.content;if(L&&a)return null;if(!L)return n.jsx(i.Box,e.__assign({ref:bn(o)},{children:ct({section:t,idx:o,columnKey:"left",colRef:Vn.current[o],parentNodeId:(null===(l=null==j?void 0:j.input_index_map)||void 0===l?void 0:l[0])||""})}),"left-row-".concat(o));var u=t,d=$n(o),f=!(null===(s=u.refIndexes)||void 0===s?void 0:s.length)||u.selfIndex<0,v="number"==typeof u.selfIndex&&u.selfIndex>=0?u.selfIndex+1:null,h=ce.has(o);return n.jsx(i.Box,e.__assign({ref:bn(o),sx:{mb:1}},{children:n.jsxs(i.Box,e.__assign({sx:{position:"relative",width:"100%"}},{children:[n.jsx(i.Box,e.__assign({ref:Vn.current[o],sx:e.__assign({width:"100%",display:"flex"},h&&{borderRadius:"6px",outline:"2px solid ".concat((null==d?void 0:d.badgeBorder)||"#6366F1"),outlineOffset:"1px"})},{children:ct({section:t,idx:o,columnKey:"left",colRef:x.default.createRef(),mb:0,parentNodeId:(null===(c=null==j?void 0:j.input_index_map)||void 0===c?void 0:c[0])||""})})),d&&n.jsxs(i.Box,e.__assign({ref:Yn.current[o],onClick:function(e){var n=xn.find(function(e){var n;return null===(n=u.refIndexes)||void 0===n?void 0:n.includes(e.selfIndex)})||{title:"",content:""};!function(e,n,t,i,r){e.stopPropagation(),Me.open&&Me.sectionIdx===i?Ue():(Ye(),Ae(Rn(e.currentTarget,n,t,i,r)))}(e,t,n,o,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!==v&&n.jsx(i.Box,e.__assign({component:"span",sx:{fontSize:"11px",fontWeight:700,pr:.5,borderRight:"1px solid ".concat(d.badgeBorder)}},{children:v})),n.jsx(i.Box,e.__assign({component:"span",sx:{fontSize:"11px",px:.25}},{children:f?"No Deviation Found":0==d.deviationLabel||void 0===d.deviationLabel?"Same":"".concat(d.deviationLabel,"% Deviation")})),n.jsx(r.EllipsisVertical,{size:11,color:d.badgeText})]}))]}))}),"left-row-".concat(o))}),n.jsx("div",{ref:Pe,style:{width:"100%",height:"0px",flexShrink:0}})]}))]})),n.jsx(i.Box,e.__assign({sx:{width:"180px",display:"flex",flexDirection:"column",alignItems:"center",pt:"15px",gap:0}},{children:n.jsx(i.Box,e.__assign({sx:{display:"flex",justifyContent:"center",alignItems:"center",mt:0}},{children:n.jsxs(i.Box,e.__assign({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:[n.jsx(i.Box,e.__assign({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:n.jsx(o.ButtonCognitiveIcon,{})})),0,"% Similarity",n.jsx(r.ChevronDown,{size:11})]}))}))})),n.jsxs(i.Box,e.__assign({sx:e.__assign({border:"1px solid #E3E6EA",borderRadius:"8px",bgcolor:"#FFFFFF",boxShadow:"0px 1px 4px #F7F4FE",position:"relative",zIndex:2,display:"flex",flexDirection:"column",minWidth:0},L?{flex:1,overflow:"visible",minHeight:0}:{})},{children:[Y&&n.jsx(l.default,{sections:11}),n.jsx(i.Box,e.__assign({ref:Tn,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E3E6EA",borderRadius:"8px 8px 0 0",minHeight:"40px",display:"flex",alignItems:"center",overflowX:"hidden"}},{children:n.jsx(i.Tooltip,e.__assign({title:vn,placement:"top"},{children:n.jsx(i.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:500,color:"#5928ED",overflow:"hidden",display:"flex",justifyContent:"center",alignItems:"center",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",height:"40px"}},{children:vn}))}))})),n.jsxs(i.Box,e.__assign({ref:Ne,onScroll:ot,sx:e.__assign({p:"12px",display:"flex",flexDirection:"column"},L?{maxHeight:"calc(100vh - 150px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,ml:"-20px",pl:"40px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[n.jsx("div",{ref:We,style:{width:"100%",height:"0px",flexShrink:0}}),gn&&xn.map(function(t,r){var o,l;if(!L)return ct({section:t,idx:r,columnKey:"right",colRef:Kn.current[r],parentNodeId:(null===(o=null==j?void 0:j.input_index_map)||void 0===o?void 0:o[1])||""});var s=t,c=hn.filter(function(e){var n;return(null===(n=e.refIndexes)||void 0===n?void 0:n.includes(s.selfIndex))&&e.selfIndex>=0}).map(function(e){return e.selfIndex+1}),a=hn.some(function(e,n){var t;return ce.has(n)&&(null===(t=e.refIndexes)||void 0===t?void 0:t.includes(s.selfIndex))}),u=hn.findIndex(function(e,n){var t;return ce.has(n)&&(null===(t=e.refIndexes)||void 0===t?void 0:t.includes(s.selfIndex))}),d=-1!==u?$n(u):null;return n.jsx(i.Box,e.__assign({ref:Gn.current[r],sx:{mb:1}},{children:n.jsxs(i.Box,e.__assign({sx:{position:"relative",width:"100%"}},{children:[n.jsx(i.Box,e.__assign({ref:Kn.current[r],sx:e.__assign({width:"100%",display:"flex"},a&&d&&{borderRadius:"6px",outline:"2px solid ".concat(d.badgeBorder),outlineOffset:"1px"})},{children:ct({section:t,idx:r,columnKey:"right",colRef:x.default.createRef(),mb:0,parentNodeId:(null===(l=null==j?void 0:j.input_index_map)||void 0===l?void 0:l[1])||""})})),!Y&&n.jsx(i.Box,e.__assign({ref:Un.current[r],sx:{position:"absolute",top:"18px",left:0,transform:"translateY(-50%) translateX(calc(-100% - 8px))",display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:"11px",bgcolor:"#EEF2FF",color:"#3730A3",border:"1px solid #C7D2FE",borderRadius:"10px",px:1,py:.3,fontWeight:700,whiteSpace:"nowrap",zIndex:20}},{children:c.length>0?c.join(", "):"-"}))]}))}),"right-row-".concat(r))}),n.jsx("div",{ref:Le,style:{width:"100%",height:"0px",flexShrink:0}})]}))]}))]}))}))}))]}))};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),t=require("react"),i=require("@mui/material"),r=require("lucide-react"),o=require("../../assests/svg/ButtonCognitiveIcon.js"),l=require("./OverlayComponent.js"),s=require("react-markdown"),c=require("./CognitiveComparehelpers.js"),a=require("./CognitiveCompareConfig.js"),u=require("./CognitivePopup.js"),d=require("./MoreFunctionsPopup.js"),f=require("./LoaderComponent.js"),v=require("rehype-raw");function h(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var x=h(t),g=h(s),p=h(v),m=x.default.memo(function(r){var o=r.content,l=r.sxStyles,s=r.highlights,a=void 0===s?[]:s,u=t.useMemo(function(){return{mark:function(t){var i=t.children;return n.jsx("span",e.__assign({style:{backgroundColor:"#fccccc"}},{children:i}))}}},[]),d=t.useMemo(function(){var e=o;return a.forEach(function(n){e=e.replace(new RegExp(n,"g"),"<mark>".concat(n,"</mark>"))}),e},[o,a]);return n.jsx(i.Typography,e.__assign({component:"div",sx:l},{children:n.jsx(g.default,e.__assign({components:u,rehypePlugins:[p.default]},{children:c.safeStringify(d).replace(/\\n/g,"\n")}))}))},function(e,n){if(e.content!==n.content)return!1;if(e.sxStyles!==n.sxStyles)return!1;var t=e.highlights||[],i=n.highlights||[];if(t.length!==i.length)return!1;for(var r=0;r<t.length;r++)if(t[r]!==i[r])return!1;return!0}),y=function(e,n,t,i,r){void 0===r&&(r=14);var o=e+.65*(t-e),l=i-n;if(Math.abs(l)<3)return"M ".concat(e," ").concat(n," H ").concat(t);var s=l>0?1:-1,c=Math.min(r,Math.abs(l)/2,Math.abs(o-e)/2,Math.abs(t-o)/2);return["M ".concat(e," ").concat(n),"H ".concat(o-c),"Q ".concat(o," ").concat(n," ").concat(o," ").concat(n+s*c),"V ".concat(i-s*c),"Q ".concat(o," ").concat(i," ").concat(o+c," ").concat(i),"H ".concat(t)].join(" ")},_={id:"",title:""},b={open:!1,sectionTitle:"",refSectionTitle:"",cognitiveData:null,anchorEl:null,sectionAnchorEl:null,badgeStyle:null,sectionIdx:null,docData:null,deviationData:null},S=function(e,n,t,i,r){void 0===t&&(t=300);var o=e.style.scrollBehavior;e.style.scrollBehavior="auto";var l=e.scrollTop,s=n-l,c=null,a=function(u){null===c&&(c=u);var d,f=u-c;f<t?(e.scrollTop=(d=f,d/=t,s*(--d*d*d+1)+l),r&&r(),requestAnimationFrame(a)):(e.scrollTop=n,e.style.scrollBehavior=o,r&&r(),i&&i())};requestAnimationFrame(a)};exports.SHARED_MARKDOWN_STYLES=a.SHARED_MARKDOWN_STYLES,exports.default=function(s){var v,h,g,p,R,I,F,w,C=s.componentHeaderText,E=void 0===C?"Contract Comparison":C,j=s.treeData,B=s.comparisonConfig,T=s.leftColumnTitleText,k=s.rightColumnTitleText,D=s.markdownStyles,M=s.displayConfig,A=void 0===M?{isHeaderVisible:!0,isToggleVisible:!0,maintainRelativeOrder:!1}:M,H=s.popupConfig,O=s.deviationData,N=void 0===O?{}:O,W=t.useState(A.maintainRelativeOrder),L=W[0],z=W[1],P=t.useState(!1),q=P[0],V=P[1],K=t.useState(!1),Y=K[0],U=K[1],G=t.useState(null),X=G[0],J=G[1],Q=t.useState(!1),Z=Q[0],$=Q[1],ee=t.useState(!1),ne=ee[0],te=ee[1],ie=t.useRef(!1),re=t.useState(null),oe=re[0],le=re[1],se=t.useState(new Set),ce=se[0],ae=se[1],ue=t.useState([]),de=ue[0],fe=ue[1],ve=t.useRef(null),he=t.useRef(!1),xe=t.useRef(null),ge=t.useRef({}),pe=t.useRef([]),me=t.useRef(!1),ye=t.useRef(!1),_e=t.useRef(null),be=t.useMemo(function(){return(null==j?void 0:j.cognitive_decisioning)||{}},[j]),Se=t.useState(null),Re=Se[0],Ie=Se[1],Fe=t.useRef(null),we=t.useState({width:0,height:0}),Ce=we[0],Ee=we[1],je=t.useMemo(function(){return e.__assign(e.__assign({},a.SHARED_MARKDOWN_STYLES),D)},[D]),Be=t.useState({open:!1,sectionTitle:"",refSectionTitle:"",cognitiveData:null,anchorEl:null,sectionAnchorEl:null,badgeStyle:null,sectionIdx:null,docData:null,deviationData:null}),Te=Be[0],ke=Be[1],De=t.useState({open:!1,sectionTitle:"",refSectionTitle:"",cognitiveData:null,anchorEl:null,sectionAnchorEl:null,badgeStyle:null,sectionIdx:null,docData:null,deviationData:null}),Me=De[0],Ae=De[1],He=t.useRef(null),Oe=t.useRef(null),Ne=t.useRef(null),We=t.useRef(null),Le=t.useRef(null),ze=t.useRef(null),Pe=t.useRef(null),qe=t.useRef(null),Ve=t.useRef(!1),Ke=t.useRef(null);t.useEffect(function(){Ke.current=null},[Te.sectionIdx,Te.open]);var Ye=t.useCallback(function(){Ie(null),ke(b),le(null)},[]),Ue=t.useCallback(function(){Ae(b)},[]),Ge=t.useCallback(function(){var e;if(Te.anchorEl&&Te.refSectionTitle){var n=Te.anchorEl.getBoundingClientRect(),t=(null===(e=null==Fe?void 0:Fe.current)||void 0===e?void 0:e.offsetHeight)||0,i=Math.min(680,window.innerWidth-24),r=window.innerHeight-n.bottom-12-12,o=n.top-12-12,l=r<t&&o>r;null!==Ke.current?!0===Ke.current&&(l=o>=t||o>=r):l=!(r>=t||r>=o),Ke.current=l;var s=l?o:r,c=Math.min(t||9999,s),a=l?n.top-12-c:n.bottom+12,u=n.left+n.width/2,d=u-i/2,f=Math.max(12,Math.min(d,window.innerWidth-i-12)),v=Math.max(14,Math.min(u-f,i-10-4));Ie({top:a,left:f,arrowLeft:v,openAbove:l,maxHeight:s})}},[Te.anchorEl,Te.refSectionTitle]);t.useEffect(function(){if(Te.open){window.addEventListener("resize",Ge);var e=requestAnimationFrame(Ge),n=null;return Fe.current&&(n=new ResizeObserver(function(){cancelAnimationFrame(e),e=requestAnimationFrame(Ge)})).observe(Fe.current),function(){cancelAnimationFrame(e),window.removeEventListener("resize",Ge),n&&n.disconnect()}}},[Te.open,Ge]),t.useEffect(function(){var e=He.current;if(e&&Te.open){var n=function(e){Fe.current&&Fe.current.contains(e.target)||(Ie(null),Ye())};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})}}},[Te.open,Ye]),t.useEffect(function(){var e=He.current;if(e&&Me.open){var n=function(){Ue()};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})}}},[Me.open,Ue]);var Xe=t.useMemo(function(){var n,t,i,r,o,l,s,c,u,d,f,v;return{fields:null!==(n=null==B?void 0:B.fields)&&void 0!==n?n:a.DEFAULT_FIELD_CONFIG,thresholds:{high:null!==(i=null===(t=null==B?void 0:B.thresholds)||void 0===t?void 0:t.high)&&void 0!==i?i:a.DEFAULT_COMPARISON_CONFIG.thresholds.high,medium:null!==(o=null===(r=null==B?void 0:B.thresholds)||void 0===r?void 0:r.medium)&&void 0!==o?o:a.DEFAULT_COMPARISON_CONFIG.thresholds.medium,exact:null!==(s=null===(l=null==B?void 0:B.thresholds)||void 0===l?void 0:l.exact)&&void 0!==s?s:a.DEFAULT_COMPARISON_CONFIG.thresholds.exact},relationStyles:{noContent:e.__assign(e.__assign({},a.DEFAULT_COMPARISON_CONFIG.relationStyles.noContent),(null===(c=null==B?void 0:B.relationStyles)||void 0===c?void 0:c.noContent)||{}),high:e.__assign(e.__assign({},a.DEFAULT_COMPARISON_CONFIG.relationStyles.high),(null===(u=null==B?void 0:B.relationStyles)||void 0===u?void 0:u.high)||{}),exact:e.__assign(e.__assign({},a.DEFAULT_COMPARISON_CONFIG.relationStyles.exact),(null===(d=null==B?void 0:B.relationStyles)||void 0===d?void 0:d.exact)||{}),medium:e.__assign(e.__assign({},a.DEFAULT_COMPARISON_CONFIG.relationStyles.medium),(null===(f=null==B?void 0:B.relationStyles)||void 0===f?void 0:f.medium)||{}),low:e.__assign(e.__assign({},a.DEFAULT_COMPARISON_CONFIG.relationStyles.low),(null===(v=null==B?void 0:B.relationStyles)||void 0===v?void 0:v.low)||{})}}},[B]),Je=t.useMemo(function(){if(j&&Object.keys(j).length>0)try{var n=function(n,t,i){var r,o,l,s,a;void 0===t&&(t=!1),void 0===i&&(i=null);var u=[],d=[],f=n.base_root_id,v=n.input_index_map||{0:"left",1:"right"},h=n[f]||(null===(r=n.nodes)||void 0===r?void 0:r[f]);if(!h||!1===h.display_node)return{activeProposed:{title:"No Data",sections:[]},activeVariants:[]};var x=function(t,r){var o,l=n[t];if(!l||!1===l.display_node)return null;var s=c.getSideData(l,r,v),a=!!s.title.trim(),u=!!s.content.trim(),d=c.getRationale(l),f=(null===(o=null==i?void 0:i[t])||void 0===o?void 0:o.evaluation_result)||l.evaluation_result||null,h=[];l.next&&Object.values(l.next).forEach(function(e){var t=n[e];if(t&&!1!==t.display_node){var i=x(e,r);i&&h.push(i)}});var g=!(!a&&!u);return e.__assign(e.__assign({id:t,title:a?s.title:"",content:u?s.content:"",subsections:h},g?d:{score:void 0,relation:"not_defined"}),{evaluationResult:f})};if(t){var g=function(t,r){var o,l,s,a,u,d,f,h,x,p,m,y,_,b;void 0===r&&(r=0);var S=[],R=[];if(!t)return{refSections:S,baseSections:R};var I={},F={},w=-1,C=-1;for(var E in t){var j=t[E],B=n[j]||(null===(o=n.nodes)||void 0===o?void 0:o[j]);if(B&&!1!==B.display_node){var T=c.getRationale(B),k=(null===(l=null==i?void 0:i[j])||void 0===l?void 0:l.evaluation_result)||B.evaluation_result||null,D=c.getSideData(B,"1",v),M=c.getSideData(B,"0",v),A=D.title.trim()||D.content.trim(),H=M.title.trim()||M.content.trim(),O=Number(null!==(a=null===(s=D.attributes)||void 0===s?void 0:s.display_index)&&void 0!==a?a:w--),N=Number(null!==(d=null===(u=M.attributes)||void 0===u?void 0:u.display_index)&&void 0!==d?d:C--),W=I[O]||e.__assign(e.__assign({id:j,title:A?D.title:"",content:A?D.content:"",subsections:[]},A?T:{score:void 0,relation:"not_defined"}),{refIndexes:[],selfIndex:O,evaluationResult:k,displayContent:null===(f=D.attributes)||void 0===f?void 0:f.display_content,displayTitle:null===(h=D.attributes)||void 0===h?void 0:h.display_title}),L=F[N]||e.__assign(e.__assign({id:j,title:H?M.title:"",content:H?M.content:"",subsections:[]},H?T:{score:void 0,relation:"not_defined"}),{refIndexes:[],selfIndex:N,evaluationResult:k,displayContent:null===(x=M.attributes)||void 0===x?void 0:x.display_content,displayTitle:null===(p=M.attributes)||void 0===p?void 0:p.display_title});Number(O)>=0&&Number(N)>=0&&((null===(m=W.refIndexes)||void 0===m?void 0:m.includes(Number(N)))||null===(y=W.refIndexes)||void 0===y||y.push(Number(N)),(null===(_=L.refIndexes)||void 0===_?void 0:_.includes(Number(O)))||null===(b=L.refIndexes)||void 0===b||b.push(Number(O))),I[O]=W,F[N]=L;var z=g(B.next,r+1),P=z.refSections,q=z.baseSections;P.length&&q.length&&(W.subsections=P,L.subsections=q)}}return S=Object.values(I).map(function(e){return e}),R=Object.values(F).map(function(e){return e}),S.sort(function(e,n){return e.selfIndex<0&&n.selfIndex>=0?1:e.selfIndex>=0&&n.selfIndex<0?-1:e.selfIndex-n.selfIndex}),R.sort(function(e,n){return e.selfIndex<0&&n.selfIndex>=0?1:e.selfIndex>=0&&n.selfIndex<0?-1:e.selfIndex-n.selfIndex}),{refSections:S,baseSections:R}},p=g(h.next),m=p.refSections,y=p.baseSections;d=m,u=y}else h.next&&Object.values(h.next).forEach(function(e){var t=n[e];t&&!1!==t.display_node&&(u.push(x(e,"0")||{id:e,title:"",content:"",subsections:[]}),d.push(x(e,"1")||{id:e,title:"",content:"",subsections:[]}))});return{activeProposed:{title:(null===(l=null===(o=h.comparison_inputs)||void 0===o?void 0:o[v[0]])||void 0===l?void 0:l.title)||"Uploaded Contract",description:h.decision_scope_description||"",sections:u},activeVariants:[{id:"tree-variant-1",title:(null===(a=null===(s=h.comparison_inputs)||void 0===s?void 0:s[v[1]])||void 0===a?void 0:a.title)||"Reference Template",similarity:0,sections:d,analysis:{rule_difference_comparison:{summary:{overall_score:0,overall_summary:h.decision_scope_description||""},fields:{}}}}]}}(j,L,N);return e.__assign(e.__assign({},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(j),L,JSON.stringify(N)]),Qe=Je.activeProposed,Ze=Je.activeVariants,$e=Je.parseError;t.useEffect(function(){$e&&J("Failed to load comparison: ".concat($e))},[$e]);var en=t.useState(null),nn=en[0];en[1];var tn=t.useState({}),rn=tn[0],on=tn[1],ln=t.useState({}),sn=ln[0],cn=ln[1],an=(null==Ze?void 0:Ze[0])||_,un=null===(g=null===(v=null==j?void 0:j.documents)||void 0===v?void 0:v[null===(h=null==j?void 0:j.input_index_map)||void 0===h?void 0:h[0]])||void 0===g?void 0:g.title,dn=null===(I=null===(p=null==j?void 0:j.documents)||void 0===p?void 0:p[null===(R=null==j?void 0:j.input_index_map)||void 0===R?void 0:R[1]])||void 0===I?void 0:I.title,fn=c.safeStringify(T||un||"Uploaded Contract"),vn=c.safeStringify(k||dn||"Reference Template"),hn=t.useMemo(function(){return(null==Qe?void 0:Qe.sections)||[]},[null==Qe?void 0:Qe.sections]),xn=t.useMemo(function(){return an.sections||[]},[an.sections]),gn=hn.length>0||xn.length>0,pn=an.analysis,mn=c.safeStringify(null===(w=null===(F=null==pn?void 0:pn.rule_difference_comparison)||void 0===F?void 0:F.summary)||void 0===w?void 0:w.overall_summary),yn=!!mn.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),_n=t.useRef({}),bn=function(e){return _n.current[e]||(_n.current[e]=x.default.createRef()),_n.current[e]},Sn=t.useCallback(function(){$(!1),ye.current=!1,On(null),_e.current=null,En.current=null,te(!1),U(!1),We.current&&(We.current.style.height="0px"),Le.current&&(Le.current.style.height="0px"),ze.current&&(ze.current.style.height="0px"),Pe.current&&(Pe.current.style.height="0px")},[]),Rn=t.useCallback(function(e,n,t,i,r){var o,l,s=c.safeStringify(n.id)||c.safeStringify(t.id)||"",a=(s?be[s]:null)||n.cognitiveData||t.cognitiveData||{section_id:s,decisioning:[],gap:[],relevance_score:0},u=null!==(l=null===(o=_n.current[i])||void 0===o?void 0:o.current)&&void 0!==l?l:null;return{open:!0,sectionTitle:n.title||"N/A",refSectionTitle:t.title||"NA",cognitiveData:a,anchorEl:e,sectionAnchorEl:u,badgeStyle:r||null,sectionIdx:i,docData:{documents:null==j?void 0:j.documents,input_index_map:null==j?void 0:j.input_index_map},deviationData:n.evaluationResult||t.evaluationResult||null}},[be,j]),In=t.useCallback(function(e){Ue(),Ie(null),ke(e)},[Ue]),Fn=t.useCallback(function(){null!==Me.sectionIdx&&Me.anchorEl?In(e.__assign(e.__assign({},Me),{open:!0})):Ue()},[Me,Ue,In]);t.useCallback(function(e){Ue(),J("".concat(e," is coming soon."))},[Ue]);var wn=t.useCallback(function(){var e=Me.sectionIdx;Ue(),null!==e&&(ye.current&&Sn(),ae(function(n){return n.has(e)?new Set:new Set([e])}))},[Me.sectionIdx,Ue,Sn]),Cn=t.useRef(null),En=t.useRef(null),jn=t.useRef(null),Bn=t.useRef(null),Tn=t.useRef(null),kn=t.useState([]),Dn=kn[0],Mn=kn[1],An=t.useState(null),Hn=An[0],On=An[1];t.useRef(null);var Nn=t.useState(null),Wn=Nn[0],Ln=Nn[1],zn=t.useMemo(function(){return Xe.fields.filter(function(e){var n=e.key;return(!gn||"description"!==n)&&(c.hasValue(null==Qe?void 0:Qe[n])||c.hasValue(an[n]))})},[Qe,an,gn,Xe.fields]),Pn=t.useRef({}),qn=t.useRef({}),Vn=t.useRef({}),Kn=t.useRef({}),Yn=t.useRef({}),Un=t.useRef({}),Gn=t.useRef({}),Xn=t.useRef({}),Jn=t.useRef({});zn.forEach(function(e){for(var n=e.key,t=0;t<Math.max(hn.length,xn.length);t+=1)Vn.current[t]||(Vn.current[t]=x.default.createRef()),Kn.current[t]||(Kn.current[t]=x.default.createRef()),Yn.current[t]||(Yn.current[t]=x.default.createRef()),Un.current[t]||(Un.current[t]=x.default.createRef()),Gn.current[t]||(Gn.current[t]=x.default.createRef());Pn.current[n]||(Pn.current[n]=x.default.createRef()),qn.current[n]||(qn.current[n]=x.default.createRef())});for(var Qn=0;Qn<Math.max(hn.length,xn.length);Qn+=1)Vn.current[Qn]||(Vn.current[Qn]=x.default.createRef()),Kn.current[Qn]||(Kn.current[Qn]=x.default.createRef()),Yn.current[Qn]||(Yn.current[Qn]=x.default.createRef()),Un.current[Qn]||(Un.current[Qn]=x.default.createRef()),Gn.current[Qn]||(Gn.current[Qn]=x.default.createRef());t.useEffect(function(){if(nn){var e=Xe.fields.find(function(e){return e.analysisKey===nn||e.key===nn});if(e){var n=Pn.current[e.key]||qn.current[e.key];(null==n?void 0:n.current)&&setTimeout(function(){return n.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[nn,Xe.fields]);var Zn=t.useCallback(function(e){var n,t,i,r,o,l,s,c,a,u=null===(n=null==pn?void 0:pn.rule_difference_comparison)||void 0===n?void 0:n.fields;if(!u||!u[e])return{score:0,relation:"",highlightsA:[],highlightsB:[],hasContent:!1};var d=u[e],f=(null==d?void 0:d.relation)||(null===(i=null===(t=null==d?void 0:d.highlights)||void 0===t?void 0:t.ruleA_spans)||void 0===i?void 0:i.length)||(null===(o=null===(r=null==d?void 0:d.highlights)||void 0===r?void 0:r.ruleB_spans)||void 0===o?void 0:o.length)||(null==d?void 0:d.mappings)&&d.mappings.length>0;if(d.mappings){var v=d.mappings[0]||{};return{score:d.score,relation:v.relation||"",highlightsA:(null===(l=v.highlights)||void 0===l?void 0:l.ruleA_spans)||[],highlightsB:(null===(s=v.highlights)||void 0===s?void 0:s.ruleB_spans)||[],hasContent:!!f}}return{score:d.score,relation:d.relation||"",highlightsA:(null===(c=d.highlights)||void 0===c?void 0:c.ruleA_spans)||[],highlightsB:(null===(a=d.highlights)||void 0===a?void 0:a.ruleB_spans)||[],hasContent:!!f}},[pn]),$n=t.useCallback(function(n){var t,i,r,o,l=hn[n],s=xn[n],a=(null==l?void 0:l.relation)&&"not_defined"!==l.relation,u=(null==s?void 0:s.relation)&&"not_defined"!==s.relation,d=c.safeStringify(null==l?void 0:l.id)||c.safeStringify(null==s?void 0:s.id)||"",f=!(!(null==l?void 0:l.cognitiveData)&&!(null==s?void 0:s.cognitiveData));if(!a&&!u&&!f)return e.__assign(e.__assign({},Xe.relationStyles.noContent),{label:"Not Defined"});var v=Zn("description");if(null!=(null!==(i=null!==(t=null==l?void 0:l.cognitiveRelevanceScore)&&void 0!==t?t:null==s?void 0:s.cognitiveRelevanceScore)&&void 0!==i?i:d?null===(r=be[d])||void 0===r?void 0:r.relevance_score:void 0)){var h=c.cognitiveScoreToRelation(),x=h.score,g=h.relation;return c.getStyleForRelation(x,g,!0,Xe)}var p=a?l.relation:u?s.relation:v.relation,m=null!==(o=null==l?void 0:l.score)&&void 0!==o?o:null==s?void 0:s.score,y="number"==typeof m?m:v.score;return c.getStyleForRelation(y,p,!0,Xe)},[hn,xn,be,Xe,Zn]),et=t.useCallback(function(){var e,n,t,i,r,o,l,s,a,u;if(!Ve.current&&!he.current){Ve.current=!0;try{if(!Cn.current)return;var d=function(e){var n=e.split("-"),t=n[0];if(!rn[t]&&!1===L)return!1;if(L&&!rn["left-".concat(t)]&&!rn["right-".concat(t)]&&!rn[t])return!1;for(var i=t,r=1;r<n.length-1;r++)if(i+="-".concat(n[r]),!sn[i])return!1;return!0},f=Cn.current.getBoundingClientRect();Ee({width:f.width,height:f.height});var v=[];if(zn.forEach(function(e){var n,t,i=e.key,r=null===(n=Pn.current[i])||void 0===n?void 0:n.current,o=null===(t=qn.current[i])||void 0===t?void 0:t.current;r&&o&&(r.style.height="auto",o.style.height="auto",r.style.minHeight="0px",o.style.minHeight="0px")}),!he.current){for(var h=0;h<Math.max(hn.length,xn.length);h++){var x=null===(e=Vn.current[h])||void 0===e?void 0:e.current,g=null===(n=Kn.current[h])||void 0===n?void 0:n.current;x&&(x.style.height="auto",x.style.minHeight="0px"),g&&(g.style.height="auto",g.style.minHeight="0px")}L||Object.keys(Xn.current).forEach(function(e){var n,t;if(d(e)){var i=null===(n=Xn.current[e])||void 0===n?void 0:n.current,r=null===(t=Jn.current[e])||void 0===t?void 0:t.current;i&&r&&(i.style.height="auto",r.style.height="auto",i.style.minHeight="0px",r.style.minHeight="0px")}})}var p={};zn.forEach(function(e){var n,t,i=e.key,r=null===(n=Pn.current[i])||void 0===n?void 0:n.current,o=null===(t=qn.current[i])||void 0===t?void 0:t.current;if(r&&o){var l=r.getBoundingClientRect(),s=o.getBoundingClientRect();p[i]=Math.max(l.height,s.height)}});var m={left:{},right:{}},_={};if(!he.current)if(L){if(Z&&null!==Hn){var b=Hn,S=hn[b],R=null===(r=Vn.current[b])||void 0===r?void 0:r.current;R&&S&&(S.refIndexes||[]).forEach(function(e){var n,t=xn.findIndex(function(n){return n.selfIndex===e}),i=null===(n=Kn.current[t])||void 0===n?void 0:n.current;if(i&&(rn["left-".concat(b)]||rn["right-".concat(t)])){var r=Math.max(R.getBoundingClientRect().height,i.getBoundingClientRect().height);m.left[b]=Math.max(m.left[b]||0,r),m.right[t]=Math.max(m.right[t]||0,r)}})}}else{for(h=0;h<Math.min(hn.length,xn.length);h++){x=null===(t=Vn.current[h])||void 0===t?void 0:t.current,g=null===(i=Kn.current[h])||void 0===i?void 0:i.current;var I=!!rn[String(h)];if(x&&g&&I){var F=Math.max(x.getBoundingClientRect().height,g.getBoundingClientRect().height);m.left[h]=F,m.right[h]=F}}Object.keys(Xn.current).forEach(function(e){var n,t;if(d(e)){var i=null===(n=Xn.current[e])||void 0===n?void 0:n.current,r=null===(t=Jn.current[e])||void 0===t?void 0:t.current;if(i&&r&&null!==i.offsetParent&&null!==r.offsetParent){var o=i.getBoundingClientRect(),l=r.getBoundingClientRect();_[e]=Math.max(o.height,l.height)}}})}if(zn.forEach(function(e){var n,t,i=e.key,r=null===(n=Pn.current[i])||void 0===n?void 0:n.current,o=null===(t=qn.current[i])||void 0===t?void 0:t.current;if(r&&o){var l=p[i];r.style.minHeight="".concat(l,"px"),o.style.minHeight="".concat(l,"px")}}),he.current||(Object.entries(m.left).forEach(function(e){var n,t=e[0],i=e[1],r=null===(n=Vn.current[Number(t)])||void 0===n?void 0:n.current;r&&(r.style.minHeight="".concat(i,"px"))}),Object.entries(m.right).forEach(function(e){var n,t=e[0],i=e[1],r=null===(n=Kn.current[Number(t)])||void 0===n?void 0:n.current;r&&(r.style.minHeight="".concat(i,"px"))}),L||Object.keys(_).forEach(function(e){var n,t,i=null===(n=Xn.current[e])||void 0===n?void 0:n.current,r=null===(t=Jn.current[e])||void 0===t?void 0:t.current;if(i&&r&&_[e]){var o=_[e];i.style.minHeight="".concat(o,"px"),r.style.minHeight="".concat(o,"px")}})),zn.forEach(function(e){var n,t,i=e.key,r=e.analysisKey,o=null===(n=Pn.current[i])||void 0===n?void 0:n.current,l=null===(t=qn.current[i])||void 0===t?void 0:t.current;if(o&&l){var s=o.getBoundingClientRect(),a=l.getBoundingClientRect(),u=Zn(r),d=c.getStyleForRelation(u.score,u.relation,u.hasContent,Xe);if(!d)return;var h=s.top+s.height/2-f.top;v.push({id:"field-".concat(i),x1:s.right-f.left,y1:h,x2:a.left-f.left,y2:h,style:d})}}),L)hn.forEach(function(e,n){var t;(null===(t=Vn.current[n])||void 0===t?void 0:t.current)&&(e.refIndexes||[]).forEach(function(e){var t,i,r,o,l,s,c,a,u,d,h=xn.findIndex(function(n){return n.selfIndex===e});if(-1!==h){var x=null===(t=Yn.current[n])||void 0===t?void 0:t.current,g=null===(i=Un.current[h])||void 0===i?void 0:i.current;if(x&&g){var p=x.getBoundingClientRect(),m=g.getBoundingClientRect(),y=p.right-f.left,_=m.left-f.left,b=p.top+p.height/2-f.top,S=m.top+m.height/2-f.top;if(Z&&Hn===n){var R=null!==(o=null===(r=qe.current)||void 0===r?void 0:r.getBoundingClientRect().top)&&void 0!==o?o:0,I=null!==(s=null===(l=Ne.current)||void 0===l?void 0:l.getBoundingClientRect().top)&&void 0!==s?s:0,F=R+(null!==(a=null===(c=qe.current)||void 0===c?void 0:c.clientHeight)&&void 0!==a?a:1/0),w=I+(null!==(d=null===(u=Ne.current)||void 0===u?void 0:u.clientHeight)&&void 0!==d?d:1/0),C=p.top+p.height/2,E=function(e,n,t){return Math.max(n,Math.min(t,e))};b=E(C,R,F)-f.top,S=E(C,I,w)-f.top}var j=$n(n);j&&v.push({id:"line-".concat(n,"-").concat(h),x1:y,y1:b,x2:_,y2:S,style:j,sectionIdx:n,targetRightIdx:h})}}})});else{for(h=0;h<Math.min(hn.length,xn.length);h++){var w=null===(o=Vn.current[h])||void 0===o?void 0:o.current,C=null===(l=Kn.current[h])||void 0===l?void 0:l.current;if(w&&C){var E=w.getBoundingClientRect(),j=C.getBoundingClientRect(),B=(E.top+18-f.top+j.top+18-f.top)/2,T=(null===(s=xn[h])||void 0===s?void 0:s.id)||"sec-".concat(h),k=$n(h);k&&v.push({id:T,x1:E.right-f.left,y1:B,x2:j.left-f.left,y2:B,style:k,sectionIdx:h,hasCognitive:!!((null===(a=hn[h])||void 0===a?void 0:a.cognitiveData)||(null===(u=xn[h])||void 0===u?void 0:u.cognitiveData)||T&&be[T])})}}Object.keys(Xn.current).forEach(function(e){var n,t,i,r,o,l;if(d(e)){var s=null===(n=Xn.current[e])||void 0===n?void 0:n.current,a=null===(t=Jn.current[e])||void 0===t?void 0:t.current;if(s&&a&&null!==s.offsetParent&&null!==a.offsetParent){for(var u=s.getBoundingClientRect(),h=a.getBoundingClientRect(),x=(u.top+16-f.top+h.top+16-f.top)/2,g=e.split("-").map(Number),p=hn[g[0]],m=xn[g[0]],y=1;y<g.length;y++)(null==p?void 0:p.subsections)&&(p=p.subsections[g[y]]),(null==m?void 0:m.subsections)&&(m=m.subsections[g[y]]);if(!p&&!m)return;var _=(null==p?void 0:p.relation)&&"not_defined"!==p.relation,b=(null==m?void 0:m.relation)&&"not_defined"!==m.relation,S=c.safeStringify(null==p?void 0:p.id)||c.safeStringify(null==m?void 0:m.id)||"",R=!(!(null==p?void 0:p.cognitiveData)&&!(null==m?void 0:m.cognitiveData)),I=null;if(_||b||R){var F=null!==(r=null!==(i=null==p?void 0:p.cognitiveRelevanceScore)&&void 0!==i?i:null==m?void 0:m.cognitiveRelevanceScore)&&void 0!==r?r:S?null===(o=be[S])||void 0===o?void 0:o.relevance_score:void 0;if(null!=F){var w=c.cognitiveScoreToRelation(F),C=w.score,E=w.relation;I=c.getStyleForRelation(C,E,!0,Xe)}else{E=_?p.relation:b?m.relation:"not_defined";var j=null!==(l=null==p?void 0:p.score)&&void 0!==l?l:null==m?void 0:m.score;C="number"==typeof j?j:0;I=c.getStyleForRelation(C,E,!0,Xe)}}else I={badgeBg:"#EEF2FF",badgeText:"#3730A3",badgeBorder:"#C7D2FE",label:"N/A"};I&&v.push({id:"subsec-".concat(e),x1:u.right-f.left,y1:x,x2:h.left-f.left,y2:x,style:I,sectionIdx:g[0],isSubSection:!0,subSectionKeyPath:e,hasCognitive:R||S&&be[S]})}}})}if(Mn(v),Bn.current&&Tn.current){var D=Bn.current.getBoundingClientRect(),M=Tn.current.getBoundingClientRect(),A=(D.top+D.height/2-f.top+M.top+M.height/2-f.top)/2;Ln({x1:D.right-f.left,x2:M.left-f.left,y:A})}else Ln(null);if(L&&ce.size>0){var H=[],O=qe.current,N=Ne.current;if(O&&N){var W=[],z=O.getBoundingClientRect().top,P=N.getBoundingClientRect().top,q=z+O.clientHeight,V=P+N.clientHeight,K=O.scrollTop,Y=N.scrollTop,U=f.top,G=function(e,n,t){return Math.max(n,Math.min(t,e))};ce.forEach(function(e){var n,t=hn[e];(null===(n=null==t?void 0:t.refIndexes)||void 0===n?void 0:n.length)&&t.refIndexes.forEach(function(n){var t,i,r=xn.findIndex(function(e){return e.selfIndex===n});if(-1!==r){var o=null===(t=Yn.current[e])||void 0===t?void 0:t.current,l=null===(i=Un.current[r])||void 0===i?void 0:i.current;if(o&&l){var s=o.getBoundingClientRect(),c=l.getBoundingClientRect(),a=$n(e),u=s.right-f.left,d=c.left-f.left-0,v=u+.65*(d-u),h=s.top+s.height/2,x=c.top+c.height/2,g=h-z+K,p=x-P+Y,m="conn-".concat(e,"-").concat(r);W.push({lhsScrollY:g,rhsScrollY:p,x1:u,x2:d,containerTop:U,leftIdx:e,rhsArrayIdx:r,styleColor:(null==a?void 0:a.badgeBorder)||"#6366F1",styleId:m});var _=G(h,z,q),b=G(x,P,V),S=_-U,R=b-U,I=h>=z-4&&h<=q+4,F=x>=P-4&&x<=V+4,w="";w=I&&F?y(u,S,d,R):I&&!F?"M ".concat(u,",").concat(S," L ").concat(v,",").concat(S," L ").concat(v,",").concat(R):!I&&F?"M ".concat(v,",").concat(S," L ").concat(v,",").concat(R," L ").concat(d,",").concat(R):"M ".concat(v,",").concat(S," L ").concat(v,",").concat(R),H.push({id:m,pathD:w,style:a,leftIdx:e,rhsArrayIdx:r})}}})}),pe.current=W}fe(H)}else fe([]),pe.current=[]}catch(e){console.error("Line render safe fail: ",e)}finally{Ve.current=!1}}},[zn,hn,xn,be,Xe,Zn,$n,L,Z,Hn,ce,rn,sn]),nt=t.useCallback(function(){var e,n,t,i,r,o,l,s,c,a,u,d,f,v,h=pe.current;if(h.length&&!he.current){var x=null!==(n=null===(e=qe.current)||void 0===e?void 0:e.scrollTop)&&void 0!==n?n:0,g=null!==(i=null===(t=Ne.current)||void 0===t?void 0:t.scrollTop)&&void 0!==i?i:0,p=null!==(o=null===(r=qe.current)||void 0===r?void 0:r.clientHeight)&&void 0!==o?o:1/0,m=null!==(s=null===(l=Ne.current)||void 0===l?void 0:l.clientHeight)&&void 0!==s?s:1/0,_=null!==(a=null===(c=qe.current)||void 0===c?void 0:c.getBoundingClientRect().top)&&void 0!==a?a:0,b=null!==(d=null===(u=Ne.current)||void 0===u?void 0:u.getBoundingClientRect().top)&&void 0!==d?d:0,S=_+p,R=b+m,I=null!==(v=null===(f=Cn.current)||void 0===f?void 0:f.getBoundingClientRect().top)&&void 0!==v?v:0,F=function(e,n,t){return Math.max(n,Math.min(t,e))};h.forEach(function(e){var n=e.lhsScrollY-x+_,t=e.rhsScrollY-g+b,i=ge.current[e.styleId+"-stroke"],r=ge.current[e.styleId+"-bg"];if(i||r){var o,l=F(n,_,S),s=F(t,b,R),c=l-I,a=s-I,u=n>=_-4&&n<=S+4,d=t>=b-4&&t<=R+4,f=e.x1+.65*(e.x2-e.x1);o=u&&d?y(e.x1,c,e.x2,a):u&&!d?"M ".concat(e.x1,",").concat(c," L ").concat(f,",").concat(c," L ").concat(f,",").concat(a):!u&&d?"M ".concat(f,",").concat(c," L ").concat(f,",").concat(a," L ").concat(e.x2,",").concat(a):"M ".concat(f,",").concat(c," L ").concat(f,",").concat(a),i&&(i.setAttribute("visibility","visible"),i.setAttribute("d",o)),r&&(r.setAttribute("visibility","visible"),r.setAttribute("d",o))}})}},[]),tt=t.useRef(et);t.useEffect(function(){tt.current=et},[et]);var it=t.useRef(null),rt=t.useCallback(function(){null!==it.current&&clearTimeout(it.current),it.current=setTimeout(function(){tt.current(),it.current=null},50)},[]),ot=t.useCallback(function(e){var n,t,i,r,o,l;if(!ie.current){if(ye.current){var s=_e.current,c=En.current,a=qe.current,u=Ne.current;if(null!==s&&null!==c&&a&&u){var d=null===(n=_n.current[s])||void 0===n?void 0:n.current,f=null===(t=Gn.current[c])||void 0===t?void 0:t.current;if(d&&f){if(e.currentTarget===a){var v=d.offsetTop-a.scrollTop,h=f.offsetTop-v,x=u.scrollHeight-u.clientHeight,g=Math.max(0,Math.min(h,x));Math.abs(u.scrollTop-g)>1&&(u.scrollTop=g)}else if(e.currentTarget===u){var p=f.offsetTop-u.scrollTop,m=d.offsetTop-p,y=a.scrollHeight-a.clientHeight,_=Math.max(0,Math.min(m,y));Math.abs(a.scrollTop-_)>1&&(a.scrollTop=_)}if(jn.current){var b=null===(i=Yn.current[s])||void 0===i?void 0:i.current,S=null===(r=Un.current[c])||void 0===r?void 0:r.current,R=null!==(l=null===(o=Cn.current)||void 0===o?void 0:o.getBoundingClientRect().top)&&void 0!==l?l:0,I=a.getBoundingClientRect().top,F=I+a.clientHeight,w=u.getBoundingClientRect().top,C=w+u.clientHeight,E=function(e,n,t){return Math.max(n,Math.min(t,e))};if(b&&S){var j=b.getBoundingClientRect(),B=S.getBoundingClientRect(),T=j.top+j.height/2,k=B.top+B.height/2,D=E(T,I,F),M=E(k,w,C);jn.current.setAttribute("y1",(D-R).toString()),jn.current.setAttribute("y2",(M-R).toString());var A=T>=I-4&&T<=F+4;jn.current.setAttribute("visibility",A?"visible":"hidden")}}}}}pe.current.length>0&&!me.current&&(me.current=!0,requestAnimationFrame(function(){nt(),me.current=!1}))}},[nt]);t.useEffect(function(){var e=setTimeout(rt,250);window.addEventListener("resize",rt);var n=null,t=null;return He.current&&(n=new ResizeObserver(rt)).observe(He.current),Cn.current&&(t=new ResizeObserver(rt)).observe(Cn.current),function(){clearTimeout(e),window.removeEventListener("resize",rt),null==n||n.disconnect(),null==t||t.disconnect()}},[Qe,an,pn,zn,rn,sn,hn,xn,Xe,rt,Z,Hn,ne,ce]),t.useEffect(function(){ye.current=Z},[Z]),t.useEffect(function(){_e.current=Hn},[Hn]);var lt=t.useCallback(function(){var e=Me.sectionIdx;Ue(),null!==e&&(Z&&Hn===e?Sn():(ae(new Set),fe([]),pe.current=[],U(!0),ie.current=!0,On(e),_e.current=e,$(!0),ye.current=!0,te(!1),We.current&&(We.current.style.height="0px"),Le.current&&(Le.current.style.height="0px"),ze.current&&(ze.current.style.height="0px"),Pe.current&&(Pe.current.style.height="0px"),requestAnimationFrame(function(){var n,t,i=null===(n=_n.current[e])||void 0===n?void 0:n.current,r=hn[e],o=(null==r?void 0:r.refIndexes)||[],l=null,s=-1;if(o.length>0){var c=o[0];s=xn.findIndex(function(e){return e.selfIndex===c}),l=null===(t=Gn.current[s])||void 0===t?void 0:t.current}En.current=-1!==s?s:null;var a=qe.current,u=Ne.current;if(!i||!a)return ie.current=!1,void U(!1);var d=i.offsetTop-a.scrollTop;if(!l||!u)return te(!0),tt.current(),ie.current=!1,void U(!1);var f=l.offsetTop-d;f<0&&We.current&&(We.current.style.height="".concat(Math.abs(f),"px"));requestAnimationFrame(function(){var e,n=u.scrollHeight-u.clientHeight;if(f<0)e=0;else{if(f>n){var t=f-n;return Le.current&&(Le.current.style.height="".concat(t+150,"px")),void requestAnimationFrame(function(){S(u,f,200,function(){te(!0),tt.current(),ie.current=!1,U(!1)})})}e=f}S(u,e,200,function(){te(!0),tt.current(),ie.current=!1,U(!1)})})})))},[Ue,Me.sectionIdx,Z,Hn,hn,xn,rt,Sn]),st=null!==Me.sectionIdx&&ce.has(Me.sectionIdx),ct=function(t){var o,l,s,a=t.section,u=t.idx,d=t.columnKey,f=t.colRef,v=t.mb,h=void 0===v?1:v,g=t.parentNodeId,p=void 0===g?"":g,y=L?!!rn["".concat(d,"-").concat(u)]:!!rn[String(u)],_=(null===(o=a.displayTitle)||void 0===o||o)&&c.hasValue(a.title),b=(null===(l=a.displayContent)||void 0===l||l)&&c.hasValue(a.content),S=!_&&!b,R=a.title;_||(R=b?"No Title Found":"No Matching Section Found");var I,F=[];if(null===(s=a.evaluationResult)||void 0===s?void 0:s.deviations){var w=a.evaluationResult.deviations;for(var C in w){var E=w[C][p];E&&F.push(E)}}return n.jsx(i.Box,e.__assign({ref:f,sx:{mb:h,width:"100%",display:"flex",flexDirection:"column",position:"relative",minWidth:0}},{children:n.jsxs(i.Accordion,e.__assign({disableGutters:!0,expanded:!S&&y,onChange:function(){return!S&&function(n,t){var i,r;he.current=!0,xe.current&&clearTimeout(xe.current),ve.current&&(ve.current.style.opacity="0");var o=null===(i=Vn.current[n])||void 0===i?void 0:i.current,l=null===(r=Kn.current[n])||void 0===r?void 0:r.current;if(o&&(o.style.minHeight="0px"),l&&(l.style.minHeight="0px"),Object.keys(Xn.current).forEach(function(e){var t,i;if(e.startsWith("".concat(n,"-"))){var r=null===(t=Xn.current[e])||void 0===t?void 0:t.current,o=null===(i=Jn.current[e])||void 0===i?void 0:i.current;r&&(r.style.minHeight="0px"),o&&(o.style.minHeight="0px")}}),L){var s=hn[n];((null==s?void 0:s.refIndexes)||[]).forEach(function(e){var n,t=xn.findIndex(function(n){return n.selfIndex===e}),i=null===(n=Kn.current[t])||void 0===n?void 0:n.current;i&&(i.style.minHeight="0px")});var c=xn[n],a=null==c?void 0:c.selfIndex;hn.forEach(function(e,n){var t,i;if(null===(t=e.refIndexes)||void 0===t?void 0:t.includes(a)){var r=null===(i=Vn.current[n])||void 0===i?void 0:i.current;r&&(r.style.minHeight="0px")}})}xe.current=setTimeout(function(){he.current=!1,tt.current(),ve.current&&(ve.current.style.opacity="1")},550),on(function(i){var r=e.__assign({},i);if(!L){var o=!!i[String(n)];return r[String(n)]=!o,r}var l="".concat(t,"-").concat(n),s=!i[l];if(r[l]=s,"left"===t)((null==(c=hn[n])?void 0:c.refIndexes)||[]).forEach(function(e){var n=xn.findIndex(function(n){return n.selfIndex===e});-1!==n&&(r["right-".concat(n)]=s)});else{var c,a=null==(c=xn[n])?void 0:c.selfIndex;hn.forEach(function(e,n){var t;(null===(t=e.refIndexes)||void 0===t?void 0:t.includes(a))&&(r["left-".concat(n)]=s)})}return r})}(u,d)},sx:{boxShadow:"none",border:S?"1px dashed #E2E8F0":"1px solid #E2E8F0",bgcolor:S?"#FAFAFA":"#FFFFFF",borderRadius:"6px",flexGrow:1,width:"100%",display:"flex",flexDirection:"column",minWidth:0,"&:before":{display:"none"}}},{children:[n.jsx(i.AccordionSummary,e.__assign({expandIcon:S?null:n.jsx(r.ChevronDown,{size:16}),sx:{minHeight:"36px",flexShrink:0,cursor:S?"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:_&&n.jsx(i.Tooltip,e.__assign({title:R,placement:"top"},{children:n.jsx(i.Typography,e.__assign({component:"div",sx:{fontSize:"12px",color:S?"#94A3B8":"#19213D",fontWeight:S?400:700,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0}},{children:(I=R,I?c.safeStringify(I).replace(/\\n/g,"\n").split(/(\*\*.*?\*\*)/g).map(function(e,t){return e.startsWith("**")&&e.endsWith("**")?n.jsx("strong",{children:e.slice(2,-2)},t):n.jsx(x.default.Fragment,{children:e},t)}):null)}))}))})),!S&&n.jsxs(i.AccordionDetails,e.__assign({sx:{pt:0,pb:1.25,bgcolor:"#FFFFFF",flex:1,display:"flex",flexDirection:"column",minWidth:0}},{children:[b&&n.jsx(m,{content:a.content,sxStyles:je,highlights:F}),(a.subsections||[]).map(function(e,n){return at({section:e,keyPath:"".concat(u,"-").concat(n),depth:0,columnKey:d,parentNodeId:p})})]}))]}))}),"".concat(d,"-sec-").concat(u))},at=function(t){var o,l,s=t.section,a=t.keyPath,u=t.depth,d=void 0===u?0:u,f=t.columnKey,v=void 0===f?"left":f,h=t.parentNodeId,g=void 0===h?"":h,p=(null===(o=s.displayTitle)||void 0===o||o)&&c.hasValue(s.title),y=(null===(l=s.displayContent)||void 0===l||l)&&c.hasValue(s.content),_=!p&&!y,b=p?s.title:y?"No Title Found":"No Matching Section Found",S=!!sn[a];"left"!==v||Xn.current[a]||(Xn.current[a]=x.default.createRef()),"right"!==v||Jn.current[a]||(Jn.current[a]=x.default.createRef());var R="left"===v?Xn.current[a]:Jn.current[a];return p?n.jsx(i.Box,e.__assign({ref:R,sx:{mt:1,width:"100%",minWidth:0,position:"relative"}},{children:n.jsxs(i.Accordion,e.__assign({disableGutters:!0,expanded:!_&&S,onChange:function(){return!_&&function(n){var t,i;he.current=!0,xe.current&&clearTimeout(xe.current),ve.current&&(ve.current.style.opacity="0");var r=null===(t=Xn.current[n])||void 0===t?void 0:t.current,o=null===(i=Jn.current[n])||void 0===i?void 0:i.current;r&&(r.style.minHeight="0px"),o&&(o.style.minHeight="0px"),xe.current=setTimeout(function(){he.current=!1,tt.current(),ve.current&&(ve.current.style.opacity="1")},450),cn(function(t){var i;return e.__assign(e.__assign({},t),((i={})[n]=!t[n],i))})}(a)},sx:{mt:0,boxShadow:"none",border:_?"1px dashed #E2E8F0":"1px solid #EEF2F7",borderRadius:"4px !important",bgcolor:"#FFFFFF",minWidth:0,"&:before":{display:"none"}}},{children:[n.jsx(i.AccordionSummary,e.__assign({expandIcon:_?null:n.jsx(r.ChevronDown,{size:14}),sx:{minHeight:"32px","& .MuiAccordionSummary-content":{my:.5,display:"grid",alignItems:"center",minWidth:0,width:"100%"}}},{children:n.jsx(i.Typography,e.__assign({component:"div",sx:{fontSize:"11px",fontWeight:600,color:_?"#94A3B8":"#19213D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0}},{children:b||"Untitled Subsection"}))})),!_&&n.jsxs(i.AccordionDetails,e.__assign({sx:{pt:0,pb:1,minWidth:0}},{children:[y&&n.jsx(m,{content:s.content,sxStyles:je,highlights:function(){var e,n;if(!(null===(e=s.evaluationResult)||void 0===e?void 0:e.deviations))return[];var t=(null===(n=s.evaluationResult)||void 0===n?void 0:n.deviations)||{},i=[];for(var r in t){var o=t[r][g];o&&i.push(o)}return i}()}),(s.subsections||[]).map(function(e,n){return at({section:e,keyPath:"".concat(a,"-").concat(n),depth:d+1,columnKey:v,parentNodeId:g})})]}))]}))}),a):n.jsx(i.Box,e.__assign({ref:R,sx:{mt:0===d?1:.75,width:"100%",minWidth:0}},{children:!_&&n.jsxs("div",{children:[y&&n.jsx(m,{content:s.content,sxStyles:je,highlights:function(){var e,n;if(!(null===(e=s.evaluationResult)||void 0===e?void 0:e.deviations))return[];var t=(null===(n=s.evaluationResult)||void 0===n?void 0:n.deviations)||{},i=[];for(var r in t){var o=t[r][g];o&&i.push(o)}return i}()}),(s.subsections||[]).map(function(e,n){return at({section:e,keyPath:"".concat(a,"-").concat(n),depth:d+1,columnKey:v,parentNodeId:g})})]})}),a)};return n.jsxs(i.Box,e.__assign({ref:Oe,sx:e.__assign(e.__assign({display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif'},L?{}:{overflow:"visible"}),{position:"relative"})},{children:[q&&n.jsx(i.Box,e.__assign({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:n.jsx(f.default,{})})),L&&n.jsx(d.default,{open:Me.open,anchorEl:Me.anchorEl,sectionTitle:Me.sectionTitle,referenceSectionTitle:Me.refSectionTitle,onClose:Ue,onOpenCognitiveCompare:Fn,onOpenSideBySide:lt,onConnect:wn,isConnected:st}),Te.open&&n.jsx(u.default,{open:Te.open,popupRef:Fe,position:Re,popupConfig:H,onClose:function(){Ie(null),ke(function(n){return e.__assign(e.__assign({},n),{open:!1})}),le(null)},markdownStyles:D,sectionTitle:Te.sectionTitle,referenceSectionTitle:Te.refSectionTitle,cognitiveData:Te.cognitiveData,anchorEl:Te.anchorEl,sectionAnchorEl:Te.sectionAnchorEl,scrollContainerEl:He.current,badgeStyle:Te.badgeStyle,docData:Te.docData,deviationData:Te.deviationData}),n.jsx(i.Snackbar,e.__assign({open:!!X,autoHideDuration:8e3,onClose:function(){return J(null)},anchorOrigin:{vertical:"top",horizontal:"center"}},{children:n.jsx(i.Alert,e.__assign({onClose:function(){return J(null)},severity:"error",sx:{width:"100%",whiteSpace:"pre-line"}},{children:X}))})),(A.isHeaderVisible||A.isToggleVisible)&&n.jsxs(i.Box,e.__assign({sx:{px:2,py:1,display:"flex",alignItems:"center",justifyContent:"space-between",bgcolor:"#FFFFFF",border:"1.5px solid #EEF0F4",borderTopLeftRadius:"8px",borderTopRightRadius:"8px"}},{children:[n.jsx(i.Box,e.__assign({sx:{display:"flex",alignItems:"center",gap:1}},{children:A.isHeaderVisible&&n.jsx(i.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:600,color:"#0F172A"}},{children:E}))})),A.isToggleVisible&&n.jsx(i.Box,e.__assign({sx:{display:"flex",alignItems:"center"}},{children:n.jsx(i.FormControlLabel,{control:n.jsx(i.Switch,{checked:L,onChange:function(e){var n=e.target.checked;V(!0),setTimeout(function(){z(n),Sn(),ae(new Set),fe([]),pe.current=[],setTimeout(function(){V(!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}})}))]})),n.jsx(i.Box,e.__assign({ref:He,onScroll:ot,sx:{flex:1,minHeight:0,pt:1.5,pb:1,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",overflowY:L?"hidden":"auto",borderTop:mn&&yn?"none":"1.5px solid #EEF0F4"}},{children:n.jsx(i.Box,e.__assign({sx:e.__assign({display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"},L?{flex:1,minHeight:0}:{})},{children:n.jsxs(i.Box,e.__assign({ref:Cn,sx:e.__assign({display:"grid",gridTemplateColumns:"minmax(0, 1fr) 180px minmax(0, 1fr)",gap:"10px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0},L?{flex:1,overflow:"visible"}:{})},{children:[n.jsxs("svg",e.__assign({ref:ve,style:{position:"absolute",top:0,left:0,width:Ce.width||"100%",height:Ce.height||"100%",pointerEvents:"none",zIndex:10,overflow:"visible",transition:"opacity 0.15s ease-in-out"}},{children:[Wn&&n.jsxs("g",{children:[n.jsx("line",{x1:Wn.x1,y1:Wn.y,x2:Math.max(Wn.x1,(Wn.x1+Wn.x2)/2-70),y2:Wn.y,stroke:"#BBF7D0",strokeWidth:"1.5"}),n.jsx("line",{x1:Math.min(Wn.x2,(Wn.x1+Wn.x2)/2+70),y1:Wn.y,x2:Wn.x2,y2:Wn.y,stroke:"#BBF7D0",strokeWidth:"1.5"})]}),Dn.map(function(t){var l,s=(t.x1+t.x2)/2;if("Not Defined"===t.style.label&&!t.hasCognitive)return null;if(!L)return n.jsxs("g",{children:[n.jsx("line",{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:t.style.badgeBorder||"#E2E8F0",strokeWidth:"1.5"}),n.jsx("foreignObject",e.__assign({x:s-100,y:t.y1-14,width:"200",height:"28",style:{pointerEvents:"auto",overflow:"visible"}},{children:n.jsx(i.Box,e.__assign({sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},{children:n.jsxs(i.Box,e.__assign({onClick:function(e){if(e.stopPropagation(),Te.open&&oe===t.id)Ye();else{var n=hn[t.sectionIdx]||{title:"",content:""},i=xn[t.sectionIdx]||{title:"",content:""};if(t.isSubSection&&t.subSectionKeyPath){for(var r=t.subSectionKeyPath.split("-").map(Number),o=hn[r[0]],l=xn[r[0]],s=1;s<r.length;s++)(null==o?void 0:o.subsections)&&(o=o.subsections[r[s]]),(null==l?void 0:l.subsections)&&(l=l.subsections[r[s]]);o&&(n=o),l&&(i=l)}le(t.id),In(Rn(e.currentTarget,n,i,t.sectionIdx,t.style))}},sx:{display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",bgcolor:t.style.badgeBg,color:t.style.badgeText,border:"1px solid ".concat(t.style.badgeBorder),borderRadius:"12px",px:1.5,py:.5,fontWeight:500,textAlign:"center",whiteSpace:"nowrap",cursor:"pointer"}},{children:[t.style.label,n.jsx(i.Box,e.__assign({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:n.jsx(o.ButtonCognitiveIcon,{})})),n.jsx(r.ChevronDown,{size:11,style:{transform:Te.open&&oe===t.id?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))}))]},t.id);var c=hn[t.sectionIdx];return!(null===(l=null==c?void 0:c.refIndexes)||void 0===l?void 0:l.length)||(null==c?void 0:c.selfIndex)<0?null:Z&&Hn===t.sectionIdx&&ne?n.jsxs("g",e.__assign({style:{transition:"opacity 0.2s"}},{children:[n.jsx("defs",{children:n.jsx("marker",e.__assign({id:"arr-".concat(t.id),markerWidth:"7",markerHeight:"5",refX:"7",refY:"2.5",orient:"auto"},{children:n.jsx("polygon",{points:"0 0, 7 2.5, 0 5",fill:t.style.badgeBorder||"#6366F1"})}))}),n.jsx("line",{ref:jn,x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:t.style.badgeBorder||"#6366F1",strokeWidth:"1.5",markerEnd:"url(#arr-".concat(t.id,")")})]}),t.id):null}),de.map(function(t){var i,r=t.pathD,o=(null===(i=t.style)||void 0===i?void 0:i.badgeBorder)||"#6366F1",l="conn-marker-".concat(t.id),s="".concat(t.id,"-bg"),c="".concat(t.id,"-stroke");return n.jsxs("g",{children:[n.jsx("defs",{children:n.jsx("clipPath",e.__assign({id:"connections-clip"},{children:n.jsx("marker",e.__assign({id:l,markerWidth:"8",markerHeight:"6",refX:"7",refY:"3",orient:"auto"},{children:n.jsx("polygon",{points:"0 0, 8 3, 0 6",fill:o})}))}))}),n.jsx("path",{ref:function(e){ge.current[s]=e},d:r,fill:"none",stroke:"#FFFFFF",strokeWidth:"4",strokeOpacity:"0.7"}),n.jsx("path",{ref:function(e){ge.current[c]=e},d:r,fill:"none",stroke:o,strokeWidth:"1.75",markerEnd:"url(#".concat(l,")")})]},t.id)})]})),n.jsxs(i.Box,e.__assign({sx:e.__assign({border:"1px solid #E7E7E9",borderRadius:"8px",bgcolor:"#FFFFFF",display:"flex",flexDirection:"column",position:"relative",zIndex:2,filter:"drop-shadow(0px 2px 4px #F2F2F2)"},L?{flex:1,overflow:"visible"}:{})},{children:[n.jsx(i.Box,e.__assign({ref:Bn,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E7E7E9",borderRadius:"8px 8px 0 0",display:"flex",minHeight:"40px",alignItems:"center",overflowX:"hidden"}},{children:n.jsx(i.Tooltip,e.__assign({title:fn,placement:"top"},{children:n.jsx(i.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:500,color:"#19213D",overflow:"hidden",display:"flex",alignItems:"center",justifyContent:"center",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",height:"40px"}},{children:fn}))}))})),n.jsxs(i.Box,e.__assign({ref:qe,onScroll:ot,sx:e.__assign({p:"12px",display:"flex",flexDirection:"column"},L?{maxHeight:"calc(100vh - 150px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,mr:"-160px",pr:"172px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[n.jsx("div",{ref:ze,style:{width:"100%",height:"0px",flexShrink:0}}),gn&&hn.map(function(t,o){var l,s,c,a=!t.title&&!t.content;if(L&&a)return null;if(!L)return n.jsx(i.Box,e.__assign({ref:bn(o)},{children:ct({section:t,idx:o,columnKey:"left",colRef:Vn.current[o],parentNodeId:(null===(l=null==j?void 0:j.input_index_map)||void 0===l?void 0:l[0])||""})}),"left-row-".concat(o));var u=t,d=$n(o),f=!(null===(s=u.refIndexes)||void 0===s?void 0:s.length)||u.selfIndex<0,v="number"==typeof u.selfIndex&&u.selfIndex>=0?u.selfIndex+1:null,h=ce.has(o);return n.jsx(i.Box,e.__assign({ref:bn(o),sx:{mb:1}},{children:n.jsxs(i.Box,e.__assign({sx:{position:"relative",width:"100%"}},{children:[n.jsx(i.Box,e.__assign({ref:Vn.current[o],sx:e.__assign({width:"100%",display:"flex"},h&&{borderRadius:"6px",outline:"2px solid ".concat((null==d?void 0:d.badgeBorder)||"#6366F1"),outlineOffset:"1px"})},{children:ct({section:t,idx:o,columnKey:"left",colRef:x.default.createRef(),mb:0,parentNodeId:(null===(c=null==j?void 0:j.input_index_map)||void 0===c?void 0:c[0])||""})})),d&&n.jsxs(i.Box,e.__assign({ref:Yn.current[o],onClick:function(e){var n=xn.find(function(e){var n;return null===(n=u.refIndexes)||void 0===n?void 0:n.includes(e.selfIndex)})||{title:"",content:""};!function(e,n,t,i,r){e.stopPropagation(),Me.open&&Me.sectionIdx===i?Ue():(Ye(),Ae(Rn(e.currentTarget,n,t,i,r)))}(e,t,n,o,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!==v&&n.jsx(i.Box,e.__assign({component:"span",sx:{fontSize:"11px",fontWeight:700,pr:.5,borderRight:"1px solid ".concat(d.badgeBorder)}},{children:v})),n.jsx(i.Box,e.__assign({component:"span",sx:{fontSize:"11px",px:.25}},{children:f?"No Deviation Found":0==d.deviationLabel||void 0===d.deviationLabel?"Same":"".concat(d.deviationLabel,"% Deviation")})),n.jsx(r.EllipsisVertical,{size:11,color:d.badgeText})]}))]}))}),"left-row-".concat(o))}),n.jsx("div",{ref:Pe,style:{width:"100%",height:"0px",flexShrink:0}})]}))]})),n.jsx(i.Box,e.__assign({sx:{width:"180px",display:"flex",flexDirection:"column",alignItems:"center",pt:"15px",gap:0}},{children:n.jsx(i.Box,e.__assign({sx:{display:"flex",justifyContent:"center",alignItems:"center",mt:0}},{children:n.jsxs(i.Box,e.__assign({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:[n.jsx(i.Box,e.__assign({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:n.jsx(o.ButtonCognitiveIcon,{})})),0,"% Similarity",n.jsx(r.ChevronDown,{size:11})]}))}))})),n.jsxs(i.Box,e.__assign({sx:e.__assign({border:"1px solid #E3E6EA",borderRadius:"8px",bgcolor:"#FFFFFF",boxShadow:"0px 1px 4px #F7F4FE",position:"relative",zIndex:2,display:"flex",flexDirection:"column",minWidth:0},L?{flex:1,overflow:"visible",minHeight:0}:{})},{children:[Y&&n.jsx(l.default,{sections:11}),n.jsx(i.Box,e.__assign({ref:Tn,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E3E6EA",borderRadius:"8px 8px 0 0",minHeight:"40px",display:"flex",alignItems:"center",overflowX:"hidden"}},{children:n.jsx(i.Tooltip,e.__assign({title:vn,placement:"top"},{children:n.jsx(i.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:500,color:"#5928ED",overflow:"hidden",display:"flex",justifyContent:"center",alignItems:"center",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",height:"40px"}},{children:vn}))}))})),n.jsxs(i.Box,e.__assign({ref:Ne,onScroll:ot,sx:e.__assign({p:"12px",display:"flex",flexDirection:"column"},L?{maxHeight:"calc(100vh - 150px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,ml:"-20px",pl:"40px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[n.jsx("div",{ref:We,style:{width:"100%",height:"0px",flexShrink:0}}),gn&&xn.map(function(t,r){var o,l;if(!L)return ct({section:t,idx:r,columnKey:"right",colRef:Kn.current[r],parentNodeId:(null===(o=null==j?void 0:j.input_index_map)||void 0===o?void 0:o[1])||""});var s=t,c=hn.filter(function(e){var n;return(null===(n=e.refIndexes)||void 0===n?void 0:n.includes(s.selfIndex))&&e.selfIndex>=0}).map(function(e){return e.selfIndex+1}),a=hn.some(function(e,n){var t;return ce.has(n)&&(null===(t=e.refIndexes)||void 0===t?void 0:t.includes(s.selfIndex))}),u=hn.findIndex(function(e,n){var t;return ce.has(n)&&(null===(t=e.refIndexes)||void 0===t?void 0:t.includes(s.selfIndex))}),d=-1!==u?$n(u):null;return n.jsx(i.Box,e.__assign({ref:Gn.current[r],sx:{mb:1}},{children:n.jsxs(i.Box,e.__assign({sx:{position:"relative",width:"100%"}},{children:[n.jsx(i.Box,e.__assign({ref:Kn.current[r],sx:e.__assign({width:"100%",display:"flex"},a&&d&&{borderRadius:"6px",outline:"2px solid ".concat(d.badgeBorder),outlineOffset:"1px"})},{children:ct({section:t,idx:r,columnKey:"right",colRef:x.default.createRef(),mb:0,parentNodeId:(null===(l=null==j?void 0:j.input_index_map)||void 0===l?void 0:l[1])||""})})),!Y&&n.jsx(i.Box,e.__assign({ref:Un.current[r],sx:{position:"absolute",top:"18px",left:0,transform:"translateY(-50%) translateX(calc(-100% - 8px))",display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:"11px",bgcolor:"#EEF2FF",color:"#3730A3",border:"1px solid #C7D2FE",borderRadius:"10px",px:1,py:.3,fontWeight:700,whiteSpace:"nowrap",zIndex:20}},{children:c.length>0?c.join(", "):"-"}))]}))}),"right-row-".concat(r))}),n.jsx("div",{ref:Le,style:{width:"100%",height:"0px",flexShrink:0}})]}))]}))]}))}))}))]}))};
|
|
2
2
|
//# sourceMappingURL=CognitiveCompare.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as e}from"tslib";import{jsx as n,jsxs as t}from"react/jsx-runtime";import i,{useMemo as r,useState as o,useRef as l,useEffect as c,useCallback as u}from"react";import{Typography as a,Box as d,Snackbar as s,Alert as v,FormControlLabel as f,Switch as h,Tooltip as p,Accordion as g,AccordionSummary as x,AccordionDetails as m}from"@mui/material";import{ChevronDown as y,EllipsisVertical as b}from"lucide-react";import{ButtonCognitiveIcon as w}from"../../assests/svg/ButtonCognitiveIcon.js";import I from"./OverlayComponent.js";import S from"react-markdown";import{safeStringify as F,hasValue as E,getStyleForRelation as R,cognitiveScoreToRelation as C,getRationale as T,getSideData as _}from"./CognitiveComparehelpers.js";import{SHARED_MARKDOWN_STYLES as k,DEFAULT_FIELD_CONFIG as B,DEFAULT_COMPARISON_CONFIG as M}from"./CognitiveCompareConfig.js";export{SHARED_MARKDOWN_STYLES}from"./CognitiveCompareConfig.js";import D from"./CognitivePopup.js";import H from"./MoreFunctionsPopup.js";import A from"./LoaderComponent.js";import W from"rehype-raw";var z=i.memo(function(t){var i=t.content,o=t.sxStyles,l=t.highlights,c=void 0===l?[]:l,u=r(function(){return{mark:function(t){var i=t.children;return n("span",e({style:{backgroundColor:"#fccccc"}},{children:i}))}}},[]),d=r(function(){var e=i;return c.forEach(function(n){e=e.replace(new RegExp(n,"g"),"<mark>".concat(n,"</mark>"))}),e},[i,c]);return n(a,e({component:"div",sx:o},{children:n(S,e({components:u,rehypePlugins:[W]},{children:F(d).replace(/\\n/g,"\n")}))}))},function(e,n){if(e.content!==n.content)return!1;if(e.sxStyles!==n.sxStyles)return!1;var t=e.highlights||[],i=n.highlights||[];if(t.length!==i.length)return!1;for(var r=0;r<t.length;r++)if(t[r]!==i[r])return!1;return!0}),N=function(e,n,t,i,r){void 0===r&&(r=14);var o=e+.65*(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(r,Math.abs(l)/2,Math.abs(o-e)/2,Math.abs(t-o)/2);return["M ".concat(e," ").concat(n),"H ".concat(o-u),"Q ".concat(o," ").concat(n," ").concat(o," ").concat(n+c*u),"V ".concat(i-c*u),"Q ".concat(o," ").concat(i," ").concat(o+u," ").concat(i),"H ".concat(t)].join(" ")},j={id:"",title:""},O={open:!1,sectionTitle:"",refSectionTitle:"",cognitiveData:null,anchorEl:null,sectionAnchorEl:null,badgeStyle:null,sectionIdx:null,docData:null,deviationData:null},L=function(e,n,t,i,r){void 0===t&&(t=300);var o=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),r&&r(),requestAnimationFrame(a)):(e.scrollTop=n,e.style.scrollBehavior=o,r&&r(),i&&i())};requestAnimationFrame(a)},P=function(S){var W,P,K,Y,V,q,X,U,G=S.componentHeaderText,J=void 0===G?"Contract Comparison":G,Q=S.treeData,Z=S.comparisonConfig,$=S.leftColumnTitleText,ee=S.rightColumnTitleText,ne=S.markdownStyles,te=S.displayConfig,ie=void 0===te?{isHeaderVisible:!0,isToggleVisible:!0,maintainRelativeOrder:!1}:te,re=S.popupConfig,oe=S.deviationData,le=void 0===oe?{}:oe,ce=o(ie.maintainRelativeOrder),ue=ce[0],ae=ce[1],de=o(!1),se=de[0],ve=de[1],fe=o(!1),he=fe[0],pe=fe[1],ge=o(null),xe=ge[0],me=ge[1],ye=o(!1),be=ye[0],we=ye[1],Ie=o(!1),Se=Ie[0],Fe=Ie[1],Ee=l(!1),Re=o(null),Ce=Re[0],Te=Re[1],_e=o(new Set),ke=_e[0],Be=_e[1],Me=o([]),De=Me[0],He=Me[1],Ae=l(null),We=l(!1),ze=l(null),Ne=l({}),je=l([]),Oe=l(!1),Le=l(!1),Pe=l(null),Ke=r(function(){return(null==Q?void 0:Q.cognitive_decisioning)||{}},[Q]),Ye=o(null),Ve=Ye[0],qe=Ye[1],Xe=l(null),Ue=o({width:0,height:0}),Ge=Ue[0],Je=Ue[1],Qe=r(function(){return e(e({},k),ne)},[ne]),Ze=o({open:!1,sectionTitle:"",refSectionTitle:"",cognitiveData:null,anchorEl:null,sectionAnchorEl:null,badgeStyle:null,sectionIdx:null,docData:null,deviationData:null}),$e=Ze[0],en=Ze[1],nn=o({open:!1,sectionTitle:"",refSectionTitle:"",cognitiveData:null,anchorEl:null,sectionAnchorEl:null,badgeStyle:null,sectionIdx:null,docData:null,deviationData:null}),tn=nn[0],rn=nn[1],on=l(null),ln=l(null),cn=l(null),un=l(null),an=l(null),dn=l(null),sn=l(null),vn=l(null),fn=l(!1),hn=l(null);c(function(){hn.current=null},[$e.sectionIdx,$e.open]);var pn=u(function(){qe(null),en(O),Te(null)},[]),gn=u(function(){rn(O)},[]),xn=u(function(){var e;if($e.anchorEl&&$e.refSectionTitle){var n=$e.anchorEl.getBoundingClientRect(),t=(null===(e=null==Xe?void 0:Xe.current)||void 0===e?void 0:e.offsetHeight)||0,i=Math.min(680,window.innerWidth-24),r=window.innerHeight-n.bottom-12-12,o=n.top-12-12,l=r<t&&o>r;null!==hn.current?!0===hn.current&&(l=o>=t||o>=r):l=!(r>=t||r>=o),hn.current=l;var c=l?o:r,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));qe({top:a,left:v,arrowLeft:f,openAbove:l,maxHeight:c})}},[$e.anchorEl,$e.refSectionTitle]);c(function(){if($e.open){window.addEventListener("resize",xn);var e=requestAnimationFrame(xn),n=null;return Xe.current&&(n=new ResizeObserver(function(){cancelAnimationFrame(e),e=requestAnimationFrame(xn)})).observe(Xe.current),function(){cancelAnimationFrame(e),window.removeEventListener("resize",xn),n&&n.disconnect()}}},[$e.open,xn]),c(function(){var e=on.current;if(e&&$e.open){var n=function(e){Xe.current&&Xe.current.contains(e.target)||(qe(null),pn())};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})}}},[$e.open,pn]),c(function(){var e=on.current;if(e&&tn.open){var n=function(){gn()};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,gn]);var mn=r(function(){var n,t,i,r,o,l,c,u,a,d,s,v;return{fields:null!==(n=null==Z?void 0:Z.fields)&&void 0!==n?n:B,thresholds:{high:null!==(i=null===(t=null==Z?void 0:Z.thresholds)||void 0===t?void 0:t.high)&&void 0!==i?i:M.thresholds.high,medium:null!==(o=null===(r=null==Z?void 0:Z.thresholds)||void 0===r?void 0:r.medium)&&void 0!==o?o:M.thresholds.medium,exact:null!==(c=null===(l=null==Z?void 0:Z.thresholds)||void 0===l?void 0:l.exact)&&void 0!==c?c:M.thresholds.exact},relationStyles:{noContent:e(e({},M.relationStyles.noContent),(null===(u=null==Z?void 0:Z.relationStyles)||void 0===u?void 0:u.noContent)||{}),high:e(e({},M.relationStyles.high),(null===(a=null==Z?void 0:Z.relationStyles)||void 0===a?void 0:a.high)||{}),exact:e(e({},M.relationStyles.exact),(null===(d=null==Z?void 0:Z.relationStyles)||void 0===d?void 0:d.exact)||{}),medium:e(e({},M.relationStyles.medium),(null===(s=null==Z?void 0:Z.relationStyles)||void 0===s?void 0:s.medium)||{}),low:e(e({},M.relationStyles.low),(null===(v=null==Z?void 0:Z.relationStyles)||void 0===v?void 0:v.low)||{})}}},[Z]),yn=r(function(){if(Q&&Object.keys(Q).length>0)try{var n=function(n,t,i){var r,o,l,c,u,a,d,s,v;void 0===t&&(t=!1),void 0===i&&(i=null);var f=[],h=[],p=n.base_root_id,g=n.input_index_map||{0:"left",1:"right"},x=n[p];if(!x||!1===x.display_node)return{activeProposed:{title:"No Data",sections:[]},activeVariants:[]};var m=function(t,r){var o,l=n[t];if(!l||!1===l.display_node)return null;var c=_(l,r,g),u=!!c.title.trim(),a=!!c.content.trim(),d=T(l),s=(null===(o=null==i?void 0:i[t])||void 0===o?void 0:o.evaluation_result)||l.evaluation_result||null,v=[];l.next&&Object.values(l.next).forEach(function(e){var t=n[e];if(t&&!1!==t.display_node){var i=m(e,r);i&&v.push(i)}});var f=!(!u&&!a);return e(e({id:t,title:u?c.title:"",content:a?c.content:"",subsections:v},f?d:{score:void 0,relation:"not_defined"}),{evaluationResult:s})};if(t){var y={},b={},w=-1,I=-1;for(var S in n)if(!["base_root_id","documents","input_index_map",p].includes(S)){var F=n[S];if(F&&!1!==F.display_node){var E=T(F),R=_(F,"0",g),C=_(F,"1",g),k=R.title.trim()||R.content.trim(),B=C.title.trim()||C.content.trim(),M=(null===(r=null==i?void 0:i[S])||void 0===r?void 0:r.evaluation_result)||F.evaluation_result||null,D=Number(null!==(l=null===(o=R.attributes)||void 0===o?void 0:o.display_index)&&void 0!==l?l:w--),H=Number(null!==(u=null===(c=C.attributes)||void 0===c?void 0:c.display_index)&&void 0!==u?u:I--),A=b[H]||e(e({id:S,title:B?C.title:"",content:B?C.content:"",subsections:[]},B?E:{score:void 0,relation:"not_defined"}),{refIndexes:[],selfIndex:H,evaluationResult:M}),W=y[D]||e(e({id:S,title:k?R.title:"",content:k?R.content:"",subsections:[]},k?E:{score:void 0,relation:"not_defined"}),{refIndexes:[],selfIndex:D,evaluationResult:M});Number(H)>=0&&Number(D)>=0&&(A.refIndexes.includes(Number(D))||A.refIndexes.push(Number(D)),W.refIndexes.includes(Number(H))||W.refIndexes.push(Number(H))),b[H]=A,y[D]=W}}h=Object.values(b).map(function(e){return e}),f=Object.values(y).map(function(e){return e}),h.sort(function(e,n){return e.selfIndex<0&&n.selfIndex>=0?1:e.selfIndex>=0&&n.selfIndex<0?-1:e.selfIndex-n.selfIndex}),f.sort(function(e,n){return e.selfIndex<0&&n.selfIndex>=0?1:e.selfIndex>=0&&n.selfIndex<0?-1:e.selfIndex-n.selfIndex})}else x.next&&Object.values(x.next).forEach(function(e){var t=n[e];t&&!1!==t.display_node&&(f.push(m(e,"0")||{id:e,title:"",content:"",subsections:[]}),h.push(m(e,"1")||{id:e,title:"",content:"",subsections:[]}))});return{activeProposed:{title:(null===(d=null===(a=x.comparison_inputs)||void 0===a?void 0:a[g[0]])||void 0===d?void 0:d.title)||"Uploaded Contract",description:x.decision_scope_description||"",sections:f},activeVariants:[{id:"tree-variant-1",title:(null===(v=null===(s=x.comparison_inputs)||void 0===s?void 0:s[g[1]])||void 0===v?void 0:v.title)||"Reference Template",similarity:0,sections:h,analysis:{rule_difference_comparison:{summary:{overall_score:0,overall_summary:x.decision_scope_description||""},fields:{}}}}]}}(Q,ue,le);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(Q),ue,JSON.stringify(le)]),bn=yn.activeProposed,wn=yn.activeVariants,In=yn.parseError;c(function(){In&&me("Failed to load comparison: ".concat(In))},[In]);var Sn=o(null),Fn=Sn[0];Sn[1];var En=o({}),Rn=En[0],Cn=En[1],Tn=o({}),_n=Tn[0],kn=Tn[1],Bn=(null==wn?void 0:wn[0])||j,Mn=null===(K=null===(W=null==Q?void 0:Q.documents)||void 0===W?void 0:W[null===(P=null==Q?void 0:Q.input_index_map)||void 0===P?void 0:P[0]])||void 0===K?void 0:K.title,Dn=null===(q=null===(Y=null==Q?void 0:Q.documents)||void 0===Y?void 0:Y[null===(V=null==Q?void 0:Q.input_index_map)||void 0===V?void 0:V[1]])||void 0===q?void 0:q.title,Hn=F($||Mn||"Uploaded Contract"),An=F(ee||Dn||"Reference Template"),Wn=r(function(){return(null==bn?void 0:bn.sections)||[]},[null==bn?void 0:bn.sections]),zn=r(function(){return Bn.sections||[]},[Bn.sections]),Nn=Wn.length>0||zn.length>0,jn=Bn.analysis,On=F(null===(U=null===(X=null==jn?void 0:jn.rule_difference_comparison)||void 0===X?void 0:X.summary)||void 0===U?void 0:U.overall_summary),Ln=!!On.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),Pn=l({}),Kn=function(e){return Pn.current[e]||(Pn.current[e]=i.createRef()),Pn.current[e]},Yn=u(function(){we(!1),Le.current=!1,ot(null),Pe.current=null,Jn.current=null,Fe(!1),pe(!1),un.current&&(un.current.style.height="0px"),an.current&&(an.current.style.height="0px"),dn.current&&(dn.current.style.height="0px"),sn.current&&(sn.current.style.height="0px")},[]),Vn=u(function(e,n,t,i,r){var o,l,c=F(n.id)||F(t.id)||"",u=(c?Ke[c]:null)||n.cognitiveData||t.cognitiveData||{section_id:c,decisioning:[],gap:[],relevance_score:0},a=null!==(l=null===(o=Pn.current[i])||void 0===o?void 0:o.current)&&void 0!==l?l:null;return{open:!0,sectionTitle:n.title||"N/A",refSectionTitle:t.title||"NA",cognitiveData:u,anchorEl:e,sectionAnchorEl:a,badgeStyle:r||null,sectionIdx:i,docData:{documents:null==Q?void 0:Q.documents,input_index_map:null==Q?void 0:Q.input_index_map},deviationData:n.evaluationResult||t.evaluationResult||null}},[Ke,Q]),qn=u(function(e){gn(),qe(null),en(e)},[gn]),Xn=u(function(){null!==tn.sectionIdx&&tn.anchorEl?qn(e(e({},tn),{open:!0})):gn()},[tn,gn,qn]);u(function(e){gn(),me("".concat(e," is coming soon."))},[gn]);var Un=u(function(){var e=tn.sectionIdx;gn(),null!==e&&(Le.current&&Yn(),Be(function(n){return n.has(e)?new Set:new Set([e])}))},[tn.sectionIdx,gn,Yn]),Gn=l(null),Jn=l(null),Qn=l(null),Zn=l(null),$n=l(null),et=o([]),nt=et[0],tt=et[1],it=o(null),rt=it[0],ot=it[1];l(null);var lt=o(null),ct=lt[0],ut=lt[1],at=r(function(){return mn.fields.filter(function(e){var n=e.key;return(!Nn||"description"!==n)&&(E(null==bn?void 0:bn[n])||E(Bn[n]))})},[bn,Bn,Nn,mn.fields]),dt=l({}),st=l({}),vt=l({}),ft=l({}),ht=l({}),pt=l({}),gt=l({}),xt=l({}),mt=l({});at.forEach(function(e){for(var n=e.key,t=0;t<Math.max(Wn.length,zn.length);t+=1)vt.current[t]||(vt.current[t]=i.createRef()),ft.current[t]||(ft.current[t]=i.createRef()),ht.current[t]||(ht.current[t]=i.createRef()),pt.current[t]||(pt.current[t]=i.createRef()),gt.current[t]||(gt.current[t]=i.createRef());dt.current[n]||(dt.current[n]=i.createRef()),st.current[n]||(st.current[n]=i.createRef())});for(var yt=0;yt<Math.max(Wn.length,zn.length);yt+=1)vt.current[yt]||(vt.current[yt]=i.createRef()),ft.current[yt]||(ft.current[yt]=i.createRef()),ht.current[yt]||(ht.current[yt]=i.createRef()),pt.current[yt]||(pt.current[yt]=i.createRef()),gt.current[yt]||(gt.current[yt]=i.createRef());c(function(){if(Fn){var e=mn.fields.find(function(e){return e.analysisKey===Fn||e.key===Fn});if(e){var n=dt.current[e.key]||st.current[e.key];(null==n?void 0:n.current)&&setTimeout(function(){return n.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[Fn,mn.fields]);var bt=u(function(e){var n,t,i,r,o,l,c,u,a,d=null===(n=null==jn?void 0:jn.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===(o=null===(r=null==s?void 0:s.highlights)||void 0===r?void 0:r.ruleB_spans)||void 0===o?void 0:o.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}},[jn]),wt=u(function(n){var t,i,r,o,l=Wn[n],c=zn[n],u=(null==l?void 0:l.relation)&&"not_defined"!==l.relation,a=(null==c?void 0:c.relation)&&"not_defined"!==c.relation,d=F(null==l?void 0:l.id)||F(null==c?void 0:c.id)||"",s=!(!(null==l?void 0:l.cognitiveData)&&!(null==c?void 0:c.cognitiveData));if(!u&&!a&&!s)return e(e({},mn.relationStyles.noContent),{label:"Not Defined"});var v=bt("description");if(null!=(null!==(i=null!==(t=null==l?void 0:l.cognitiveRelevanceScore)&&void 0!==t?t:null==c?void 0:c.cognitiveRelevanceScore)&&void 0!==i?i:d?null===(r=Ke[d])||void 0===r?void 0:r.relevance_score:void 0)){var f=C(),h=f.score,p=f.relation;return R(h,p,!0,mn)}var g=u?l.relation:a?c.relation:v.relation,x=null!==(o=null==l?void 0:l.score)&&void 0!==o?o:null==c?void 0:c.score,m="number"==typeof x?x:v.score;return R(m,g,!0,mn)},[Wn,zn,Ke,mn,bt]),It=u(function(){var e,n,t,i,r,o,l,c,u,a;if(!fn.current&&!We.current){fn.current=!0;try{if(!Gn.current)return;var d=function(e){var n=e.split("-"),t=n[0];if(!Rn[t]&&!1===ue)return!1;if(ue&&!Rn["left-".concat(t)]&&!Rn["right-".concat(t)]&&!Rn[t])return!1;for(var i=t,r=1;r<n.length-1;r++)if(i+="-".concat(n[r]),!_n[i])return!1;return!0},s=Gn.current.getBoundingClientRect();Je({width:s.width,height:s.height});var v=[];if(at.forEach(function(e){var n,t,i=e.key,r=null===(n=dt.current[i])||void 0===n?void 0:n.current,o=null===(t=st.current[i])||void 0===t?void 0:t.current;r&&o&&(r.style.height="auto",o.style.height="auto",r.style.minHeight="0px",o.style.minHeight="0px")}),!We.current){for(var f=0;f<Math.max(Wn.length,zn.length);f++){var h=null===(e=vt.current[f])||void 0===e?void 0:e.current,p=null===(n=ft.current[f])||void 0===n?void 0:n.current;h&&(h.style.height="auto",h.style.minHeight="0px"),p&&(p.style.height="auto",p.style.minHeight="0px")}ue||Object.keys(xt.current).forEach(function(e){var n,t;if(d(e)){var i=null===(n=xt.current[e])||void 0===n?void 0:n.current,r=null===(t=mt.current[e])||void 0===t?void 0:t.current;i&&r&&(i.style.height="auto",r.style.height="auto",i.style.minHeight="0px",r.style.minHeight="0px")}})}var g={};at.forEach(function(e){var n,t,i=e.key,r=null===(n=dt.current[i])||void 0===n?void 0:n.current,o=null===(t=st.current[i])||void 0===t?void 0:t.current;if(r&&o){var l=r.getBoundingClientRect(),c=o.getBoundingClientRect();g[i]=Math.max(l.height,c.height)}});var x={left:{},right:{}},m={};if(!We.current)if(ue){if(be&&null!==rt){var y=rt,b=Wn[y],w=null===(r=vt.current[y])||void 0===r?void 0:r.current;w&&b&&(b.refIndexes||[]).forEach(function(e){var n,t=zn.findIndex(function(n){return n.selfIndex===e}),i=null===(n=ft.current[t])||void 0===n?void 0:n.current;if(i&&(Rn["left-".concat(y)]||Rn["right-".concat(t)])){var r=Math.max(w.getBoundingClientRect().height,i.getBoundingClientRect().height);x.left[y]=Math.max(x.left[y]||0,r),x.right[t]=Math.max(x.right[t]||0,r)}})}}else{for(f=0;f<Math.min(Wn.length,zn.length);f++){h=null===(t=vt.current[f])||void 0===t?void 0:t.current,p=null===(i=ft.current[f])||void 0===i?void 0:i.current;var I=!!Rn[String(f)];if(h&&p&&I){var S=Math.max(h.getBoundingClientRect().height,p.getBoundingClientRect().height);x.left[f]=S,x.right[f]=S}}Object.keys(xt.current).forEach(function(e){var n,t;if(d(e)){var i=null===(n=xt.current[e])||void 0===n?void 0:n.current,r=null===(t=mt.current[e])||void 0===t?void 0:t.current;if(i&&r&&null!==i.offsetParent&&null!==r.offsetParent){var o=i.getBoundingClientRect(),l=r.getBoundingClientRect();m[e]=Math.max(o.height,l.height)}}})}if(at.forEach(function(e){var n,t,i=e.key,r=null===(n=dt.current[i])||void 0===n?void 0:n.current,o=null===(t=st.current[i])||void 0===t?void 0:t.current;if(r&&o){var l=g[i];r.style.minHeight="".concat(l,"px"),o.style.minHeight="".concat(l,"px")}}),We.current||(Object.entries(x.left).forEach(function(e){var n,t=e[0],i=e[1],r=null===(n=vt.current[Number(t)])||void 0===n?void 0:n.current;r&&(r.style.minHeight="".concat(i,"px"))}),Object.entries(x.right).forEach(function(e){var n,t=e[0],i=e[1],r=null===(n=ft.current[Number(t)])||void 0===n?void 0:n.current;r&&(r.style.minHeight="".concat(i,"px"))}),ue||Object.keys(m).forEach(function(e){var n,t,i=null===(n=xt.current[e])||void 0===n?void 0:n.current,r=null===(t=mt.current[e])||void 0===t?void 0:t.current;if(i&&r&&m[e]){var o=m[e];i.style.minHeight="".concat(o,"px"),r.style.minHeight="".concat(o,"px")}})),at.forEach(function(e){var n,t,i=e.key,r=e.analysisKey,o=null===(n=dt.current[i])||void 0===n?void 0:n.current,l=null===(t=st.current[i])||void 0===t?void 0:t.current;if(o&&l){var c=o.getBoundingClientRect(),u=l.getBoundingClientRect(),a=bt(r),d=R(a.score,a.relation,a.hasContent,mn);if(!d)return;var f=c.top+c.height/2-s.top;v.push({id:"field-".concat(i),x1:c.right-s.left,y1:f,x2:u.left-s.left,y2:f,style:d})}}),ue)Wn.forEach(function(e,n){var t;(null===(t=vt.current[n])||void 0===t?void 0:t.current)&&(e.refIndexes||[]).forEach(function(e){var t,i,r,o,l,c,u,a,d,f,h=zn.findIndex(function(n){return n.selfIndex===e});if(-1!==h){var p=null===(t=ht.current[n])||void 0===t?void 0:t.current,g=null===(i=pt.current[h])||void 0===i?void 0:i.current;if(p&&g){var x=p.getBoundingClientRect(),m=g.getBoundingClientRect(),y=x.right-s.left,b=m.left-s.left,w=x.top+x.height/2-s.top,I=m.top+m.height/2-s.top;if(be&&rt===n){var S=null!==(o=null===(r=vn.current)||void 0===r?void 0:r.getBoundingClientRect().top)&&void 0!==o?o:0,F=null!==(c=null===(l=cn.current)||void 0===l?void 0:l.getBoundingClientRect().top)&&void 0!==c?c:0,E=S+(null!==(a=null===(u=vn.current)||void 0===u?void 0:u.clientHeight)&&void 0!==a?a:1/0),R=F+(null!==(f=null===(d=cn.current)||void 0===d?void 0:d.clientHeight)&&void 0!==f?f:1/0),C=x.top+x.height/2,T=function(e,n,t){return Math.max(n,Math.min(t,e))};w=T(C,S,E)-s.top,I=T(C,F,R)-s.top}var _=wt(n);_&&v.push({id:"line-".concat(n,"-").concat(h),x1:y,y1:w,x2:b,y2:I,style:_,sectionIdx:n,targetRightIdx:h})}}})});else{for(f=0;f<Math.min(Wn.length,zn.length);f++){var E=null===(o=vt.current[f])||void 0===o?void 0:o.current,T=null===(l=ft.current[f])||void 0===l?void 0:l.current;if(E&&T){var _=E.getBoundingClientRect(),k=T.getBoundingClientRect(),B=(_.top+18-s.top+k.top+18-s.top)/2,M=(null===(c=zn[f])||void 0===c?void 0:c.id)||"sec-".concat(f),D=wt(f);D&&v.push({id:M,x1:_.right-s.left,y1:B,x2:k.left-s.left,y2:B,style:D,sectionIdx:f,hasCognitive:!!((null===(u=Wn[f])||void 0===u?void 0:u.cognitiveData)||(null===(a=zn[f])||void 0===a?void 0:a.cognitiveData)||M&&Ke[M])})}}Object.keys(xt.current).forEach(function(e){var n,t,i,r,o,l;if(d(e)){var c=null===(n=xt.current[e])||void 0===n?void 0:n.current,u=null===(t=mt.current[e])||void 0===t?void 0:t.current;if(c&&u&&null!==c.offsetParent&&null!==u.offsetParent){for(var a=c.getBoundingClientRect(),f=u.getBoundingClientRect(),h=(a.top+16-s.top+f.top+16-s.top)/2,p=e.split("-").map(Number),g=Wn[p[0]],x=zn[p[0]],m=1;m<p.length;m++)(null==g?void 0:g.subsections)&&(g=g.subsections[p[m]]),(null==x?void 0:x.subsections)&&(x=x.subsections[p[m]]);if(!g&&!x)return;var y=(null==g?void 0:g.relation)&&"not_defined"!==g.relation,b=(null==x?void 0:x.relation)&&"not_defined"!==x.relation,w=F(null==g?void 0:g.id)||F(null==x?void 0:x.id)||"",I=!(!(null==g?void 0:g.cognitiveData)&&!(null==x?void 0:x.cognitiveData)),S=null;if(y||b||I){var E=null!==(r=null!==(i=null==g?void 0:g.cognitiveRelevanceScore)&&void 0!==i?i:null==x?void 0:x.cognitiveRelevanceScore)&&void 0!==r?r:w?null===(o=Ke[w])||void 0===o?void 0:o.relevance_score:void 0;if(null!=E){var T=C(E),_=T.score,k=T.relation;S=R(_,k,!0,mn)}else{k=y?g.relation:b?x.relation:"not_defined";var B=null!==(l=null==g?void 0:g.score)&&void 0!==l?l:null==x?void 0:x.score;S=R(_="number"==typeof B?B:0,k,!0,mn)}}else S={badgeBg:"#EEF2FF",badgeText:"#3730A3",badgeBorder:"#C7D2FE",label:"N/A"};S&&v.push({id:"subsec-".concat(e),x1:a.right-s.left,y1:h,x2:f.left-s.left,y2:h,style:S,sectionIdx:p[0],isSubSection:!0,subSectionKeyPath:e,hasCognitive:I||w&&Ke[w]})}}})}if(tt(v),Zn.current&&$n.current){var H=Zn.current.getBoundingClientRect(),A=$n.current.getBoundingClientRect(),W=(H.top+H.height/2-s.top+A.top+A.height/2-s.top)/2;ut({x1:H.right-s.left,x2:A.left-s.left,y:W})}else ut(null);if(ue&&ke.size>0){var z=[],j=vn.current,O=cn.current;if(j&&O){var L=[],P=j.getBoundingClientRect().top,K=O.getBoundingClientRect().top,Y=P+j.clientHeight,V=K+O.clientHeight,q=j.scrollTop,X=O.scrollTop,U=s.top,G=function(e,n,t){return Math.max(n,Math.min(t,e))};ke.forEach(function(e){var n,t=Wn[e];(null===(n=null==t?void 0:t.refIndexes)||void 0===n?void 0:n.length)&&t.refIndexes.forEach(function(n){var t,i,r=zn.findIndex(function(e){return e.selfIndex===n});if(-1!==r){var o=null===(t=ht.current[e])||void 0===t?void 0:t.current,l=null===(i=pt.current[r])||void 0===i?void 0:i.current;if(o&&l){var c=o.getBoundingClientRect(),u=l.getBoundingClientRect(),a=wt(e),d=c.right-s.left,v=u.left-s.left-0,f=d+.65*(v-d),h=c.top+c.height/2,p=u.top+u.height/2,g=h-P+q,x=p-K+X,m="conn-".concat(e,"-").concat(r);L.push({lhsScrollY:g,rhsScrollY:x,x1:d,x2:v,containerTop:U,leftIdx:e,rhsArrayIdx:r,styleColor:(null==a?void 0:a.badgeBorder)||"#6366F1",styleId:m});var y=G(h,P,Y),b=G(p,K,V),w=y-U,I=b-U,S=h>=P-4&&h<=Y+4,F=p>=K-4&&p<=V+4,E="";E=S&&F?N(d,w,v,I):S&&!F?"M ".concat(d,",").concat(w," L ").concat(f,",").concat(w," L ").concat(f,",").concat(I):!S&&F?"M ".concat(f,",").concat(w," L ").concat(f,",").concat(I," L ").concat(v,",").concat(I):"M ".concat(f,",").concat(w," L ").concat(f,",").concat(I),z.push({id:m,pathD:E,style:a,leftIdx:e,rhsArrayIdx:r})}}})}),je.current=L}He(z)}else He([]),je.current=[]}catch(e){console.error("Line render safe fail: ",e)}finally{fn.current=!1}}},[at,Wn,zn,Ke,mn,bt,wt,ue,be,rt,ke,Rn,_n]),St=u(function(){var e,n,t,i,r,o,l,c,u,a,d,s,v,f,h=je.current;if(h.length&&!We.current){var p=null!==(n=null===(e=vn.current)||void 0===e?void 0:e.scrollTop)&&void 0!==n?n:0,g=null!==(i=null===(t=cn.current)||void 0===t?void 0:t.scrollTop)&&void 0!==i?i:0,x=null!==(o=null===(r=vn.current)||void 0===r?void 0:r.clientHeight)&&void 0!==o?o:1/0,m=null!==(c=null===(l=cn.current)||void 0===l?void 0:l.clientHeight)&&void 0!==c?c:1/0,y=null!==(a=null===(u=vn.current)||void 0===u?void 0:u.getBoundingClientRect().top)&&void 0!==a?a:0,b=null!==(s=null===(d=cn.current)||void 0===d?void 0:d.getBoundingClientRect().top)&&void 0!==s?s:0,w=y+x,I=b+m,S=null!==(f=null===(v=Gn.current)||void 0===v?void 0:v.getBoundingClientRect().top)&&void 0!==f?f:0,F=function(e,n,t){return Math.max(n,Math.min(t,e))};h.forEach(function(e){var n=e.lhsScrollY-p+y,t=e.rhsScrollY-g+b,i=Ne.current[e.styleId+"-stroke"],r=Ne.current[e.styleId+"-bg"];if(i||r){var o,l=F(n,y,w),c=F(t,b,I),u=l-S,a=c-S,d=n>=y-4&&n<=w+4,s=t>=b-4&&t<=I+4,v=e.x1+.65*(e.x2-e.x1);o=d&&s?N(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",o)),r&&(r.setAttribute("visibility","visible"),r.setAttribute("d",o))}})}},[]),Ft=l(It);c(function(){Ft.current=It},[It]);var Et=l(null),Rt=u(function(){null!==Et.current&&clearTimeout(Et.current),Et.current=setTimeout(function(){Ft.current(),Et.current=null},50)},[]),Ct=u(function(e){var n,t,i,r,o,l;if(!Ee.current){if(Le.current){var c=Pe.current,u=Jn.current,a=vn.current,d=cn.current;if(null!==c&&null!==u&&a&&d){var s=null===(n=Pn.current[c])||void 0===n?void 0:n.current,v=null===(t=gt.current[u])||void 0===t?void 0:t.current;if(s&&v){if(e.currentTarget===a){var f=s.offsetTop-a.scrollTop,h=v.offsetTop-f,p=d.scrollHeight-d.clientHeight,g=Math.max(0,Math.min(h,p));Math.abs(d.scrollTop-g)>1&&(d.scrollTop=g)}else if(e.currentTarget===d){var x=v.offsetTop-d.scrollTop,m=s.offsetTop-x,y=a.scrollHeight-a.clientHeight,b=Math.max(0,Math.min(m,y));Math.abs(a.scrollTop-b)>1&&(a.scrollTop=b)}if(Qn.current){var w=null===(i=ht.current[c])||void 0===i?void 0:i.current,I=null===(r=pt.current[u])||void 0===r?void 0:r.current,S=null!==(l=null===(o=Gn.current)||void 0===o?void 0:o.getBoundingClientRect().top)&&void 0!==l?l:0,F=a.getBoundingClientRect().top,E=F+a.clientHeight,R=d.getBoundingClientRect().top,C=R+d.clientHeight,T=function(e,n,t){return Math.max(n,Math.min(t,e))};if(w&&I){var _=w.getBoundingClientRect(),k=I.getBoundingClientRect(),B=_.top+_.height/2,M=k.top+k.height/2,D=T(B,F,E),H=T(M,R,C);Qn.current.setAttribute("y1",(D-S).toString()),Qn.current.setAttribute("y2",(H-S).toString());var A=B>=F-4&&B<=E+4;Qn.current.setAttribute("visibility",A?"visible":"hidden")}}}}}je.current.length>0&&!Oe.current&&(Oe.current=!0,requestAnimationFrame(function(){St(),Oe.current=!1}))}},[St]);c(function(){var e=setTimeout(Rt,250);window.addEventListener("resize",Rt);var n=null,t=null;return on.current&&(n=new ResizeObserver(Rt)).observe(on.current),Gn.current&&(t=new ResizeObserver(Rt)).observe(Gn.current),function(){clearTimeout(e),window.removeEventListener("resize",Rt),null==n||n.disconnect(),null==t||t.disconnect()}},[bn,Bn,jn,at,Rn,_n,Wn,zn,mn,Rt,be,rt,Se,ke]),c(function(){Le.current=be},[be]),c(function(){Pe.current=rt},[rt]);var Tt=u(function(){var e=tn.sectionIdx;gn(),null!==e&&(be&&rt===e?Yn():(Be(new Set),He([]),je.current=[],pe(!0),Ee.current=!0,ot(e),Pe.current=e,we(!0),Le.current=!0,Fe(!1),un.current&&(un.current.style.height="0px"),an.current&&(an.current.style.height="0px"),dn.current&&(dn.current.style.height="0px"),sn.current&&(sn.current.style.height="0px"),requestAnimationFrame(function(){var n,t,i=null===(n=Pn.current[e])||void 0===n?void 0:n.current,r=Wn[e],o=(null==r?void 0:r.refIndexes)||[],l=null,c=-1;if(o.length>0){var u=o[0];c=zn.findIndex(function(e){return e.selfIndex===u}),l=null===(t=gt.current[c])||void 0===t?void 0:t.current}Jn.current=-1!==c?c:null;var a=vn.current,d=cn.current;if(!i||!a)return Ee.current=!1,void pe(!1);var s=i.offsetTop-a.scrollTop;if(!l||!d)return Fe(!0),Ft.current(),Ee.current=!1,void pe(!1);var v=l.offsetTop-s;v<0&&un.current&&(un.current.style.height="".concat(Math.abs(v),"px"));requestAnimationFrame(function(){var e,n=d.scrollHeight-d.clientHeight;if(v<0)e=0;else{if(v>n){var t=v-n;return an.current&&(an.current.style.height="".concat(t+150,"px")),void requestAnimationFrame(function(){L(d,v,200,function(){Fe(!0),Ft.current(),Ee.current=!1,pe(!1)})})}e=v}L(d,e,200,function(){Fe(!0),Ft.current(),Ee.current=!1,pe(!1)})})})))},[gn,tn.sectionIdx,be,rt,Wn,zn,Rt,Yn]),_t=null!==tn.sectionIdx&&ke.has(tn.sectionIdx),kt=function(r){var o,l=r.section,c=r.idx,u=r.columnKey,s=r.colRef,v=r.mb,f=void 0===v?1:v,h=r.parentNodeId,b=void 0===h?"":h,w=ue?!!Rn["".concat(u,"-").concat(c)]:!!Rn[String(c)],I=E(l.title),S=E(l.content),R=!I&&!S,C=l.title;I||(C=S?"No Title Found":"No Matching Section Found");var T,_=[];if(null===(o=l.evaluationResult)||void 0===o?void 0:o.deviations){var k=l.evaluationResult.deviations;for(var B in k){var M=k[B][b];M&&_.push(M)}}return n(d,e({ref:s,sx:{mb:f,width:"100%",display:"flex",flexDirection:"column",position:"relative",minWidth:0}},{children:t(g,e({disableGutters:!0,expanded:!R&&w,onChange:function(){return!R&&function(n,t){var i,r;We.current=!0,ze.current&&clearTimeout(ze.current),Ae.current&&(Ae.current.style.opacity="0");var o=null===(i=vt.current[n])||void 0===i?void 0:i.current,l=null===(r=ft.current[n])||void 0===r?void 0:r.current;if(o&&(o.style.minHeight="0px"),l&&(l.style.minHeight="0px"),Object.keys(xt.current).forEach(function(e){var t,i;if(e.startsWith("".concat(n,"-"))){var r=null===(t=xt.current[e])||void 0===t?void 0:t.current,o=null===(i=mt.current[e])||void 0===i?void 0:i.current;r&&(r.style.minHeight="0px"),o&&(o.style.minHeight="0px")}}),ue){var c=Wn[n];((null==c?void 0:c.refIndexes)||[]).forEach(function(e){var n,t=zn.findIndex(function(n){return n.selfIndex===e}),i=null===(n=ft.current[t])||void 0===n?void 0:n.current;i&&(i.style.minHeight="0px")});var u=zn[n],a=null==u?void 0:u.selfIndex;Wn.forEach(function(e,n){var t,i;if(null===(t=e.refIndexes)||void 0===t?void 0:t.includes(a)){var r=null===(i=vt.current[n])||void 0===i?void 0:i.current;r&&(r.style.minHeight="0px")}})}ze.current=setTimeout(function(){We.current=!1,Ft.current(),Ae.current&&(Ae.current.style.opacity="1")},550),Cn(function(i){var r=e({},i);if(!ue){var o=!!i[String(n)];return r[String(n)]=!o,r}var l="".concat(t,"-").concat(n),c=!i[l];if(r[l]=c,"left"===t)((null==(u=Wn[n])?void 0:u.refIndexes)||[]).forEach(function(e){var n=zn.findIndex(function(n){return n.selfIndex===e});-1!==n&&(r["right-".concat(n)]=c)});else{var u,a=null==(u=zn[n])?void 0:u.selfIndex;Wn.forEach(function(e,n){var t;(null===(t=e.refIndexes)||void 0===t?void 0:t.includes(a))&&(r["left-".concat(n)]=c)})}return r})}(c,u)},sx:{boxShadow:"none",border:R?"1px dashed #E2E8F0":"1px solid #E2E8F0",bgcolor:R?"#FAFAFA":"#FFFFFF",borderRadius:"6px",flexGrow:1,width:"100%",display:"flex",flexDirection:"column",minWidth:0,"&:before":{display:"none"}}},{children:[n(x,e({expandIcon:R?null:n(y,{size:16}),sx:{minHeight:"36px",flexShrink:0,cursor:R?"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:n(p,e({title:C,placement:"top"},{children:n(a,e({component:"div",sx:{fontSize:"12px",color:R?"#94A3B8":"#19213D",fontWeight:R?400:700,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0}},{children:(T=C,T?F(T).replace(/\\n/g,"\n").split(/(\*\*.*?\*\*)/g).map(function(e,t){return e.startsWith("**")&&e.endsWith("**")?n("strong",{children:e.slice(2,-2)},t):n(i.Fragment,{children:e},t)}):null)}))}))})),!R&&t(m,e({sx:{pt:0,pb:1.25,bgcolor:"#FFFFFF",flex:1,display:"flex",flexDirection:"column",minWidth:0}},{children:[n(z,{content:l.content,sxStyles:Qe,highlights:_}),(l.subsections||[]).map(function(e,n){return Bt({section:e,keyPath:"".concat(c,"-").concat(n),depth:0,columnKey:u,parentNodeId:b})})]}))]}))}),"".concat(u,"-sec-").concat(c))},Bt=function(r){var o=r.section,l=r.keyPath,c=r.depth,u=void 0===c?0:c,s=r.columnKey,v=void 0===s?"left":s,f=r.parentNodeId,h=void 0===f?"":f,p=E(o.title),b=E(o.content),w=!p&&!b,I=p?o.title:b?"No Title Found":"No Matching Section Found",S=!!_n[l];"left"!==v||xt.current[l]||(xt.current[l]=i.createRef()),"right"!==v||mt.current[l]||(mt.current[l]=i.createRef());var F="left"===v?xt.current[l]:mt.current[l];return o.title?n(d,e({ref:F,sx:{mt:1,width:"100%",minWidth:0,position:"relative"}},{children:t(g,e({disableGutters:!0,expanded:!w&&S,onChange:function(){return!w&&function(n){var t,i;We.current=!0,ze.current&&clearTimeout(ze.current),Ae.current&&(Ae.current.style.opacity="0");var r=null===(t=xt.current[n])||void 0===t?void 0:t.current,o=null===(i=mt.current[n])||void 0===i?void 0:i.current;r&&(r.style.minHeight="0px"),o&&(o.style.minHeight="0px"),ze.current=setTimeout(function(){We.current=!1,Ft.current(),Ae.current&&(Ae.current.style.opacity="1")},450),kn(function(t){var i;return e(e({},t),((i={})[n]=!t[n],i))})}(l)},sx:{mt:0,boxShadow:"none",border:w?"1px dashed #E2E8F0":"1px solid #EEF2F7",borderRadius:"4px !important",bgcolor:"#FFFFFF",minWidth:0,"&:before":{display:"none"}}},{children:[n(x,e({expandIcon:w?null:n(y,{size:14}),sx:{minHeight:"32px","& .MuiAccordionSummary-content":{my:.5,display:"grid",alignItems:"center",minWidth:0,width:"100%"}}},{children:n(a,e({component:"div",sx:{fontSize:"11px",fontWeight:600,color:w?"#94A3B8":"#19213D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0}},{children:I||"Untitled Subsection"}))})),!w&&t(m,e({sx:{pt:0,pb:1,minWidth:0}},{children:[b&&n(z,{content:o.content,sxStyles:Qe,highlights:function(){var e,n;if(!(null===(e=o.evaluationResult)||void 0===e?void 0:e.deviations))return[];var t=(null===(n=o.evaluationResult)||void 0===n?void 0:n.deviations)||{},i=[];for(var r in t){var l=t[r][h];l&&i.push(l)}return i}()}),(o.subsections||[]).map(function(e,n){return Bt({section:e,keyPath:"".concat(l,"-").concat(n),depth:u+1,columnKey:v,parentNodeId:h})})]}))]}))}),l):n(d,e({ref:F,sx:{mt:0===u?1:.75,width:"100%",minWidth:0}},{children:!w&&t("div",{children:[b&&n(z,{content:o.content,sxStyles:Qe,highlights:function(){var e,n;if(!(null===(e=o.evaluationResult)||void 0===e?void 0:e.deviations))return[];var t=(null===(n=o.evaluationResult)||void 0===n?void 0:n.deviations)||{},i=[];for(var r in t){var l=t[r][h];l&&i.push(l)}return i}()}),(o.subsections||[]).map(function(e,n){return Bt({section:e,keyPath:"".concat(l,"-").concat(n),depth:u+1,columnKey:v,parentNodeId:h})})]})}),l)};return t(d,e({ref:ln,sx:e(e({display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif'},ue?{}:{overflow:"visible"}),{position:"relative"})},{children:[se&&n(d,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:n(A,{})})),ue&&n(H,{open:tn.open,anchorEl:tn.anchorEl,sectionTitle:tn.sectionTitle,referenceSectionTitle:tn.refSectionTitle,onClose:gn,onOpenCognitiveCompare:Xn,onOpenSideBySide:Tt,onConnect:Un,isConnected:_t}),$e.open&&n(D,{open:$e.open,popupRef:Xe,position:Ve,popupConfig:re,onClose:function(){qe(null),en(function(n){return e(e({},n),{open:!1})}),Te(null)},markdownStyles:ne,sectionTitle:$e.sectionTitle,referenceSectionTitle:$e.refSectionTitle,cognitiveData:$e.cognitiveData,anchorEl:$e.anchorEl,sectionAnchorEl:$e.sectionAnchorEl,scrollContainerEl:on.current,badgeStyle:$e.badgeStyle,docData:$e.docData,deviationData:$e.deviationData}),n(s,e({open:!!xe,autoHideDuration:8e3,onClose:function(){return me(null)},anchorOrigin:{vertical:"top",horizontal:"center"}},{children:n(v,e({onClose:function(){return me(null)},severity:"error",sx:{width:"100%",whiteSpace:"pre-line"}},{children:xe}))})),(ie.isHeaderVisible||ie.isToggleVisible)&&t(d,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:[n(d,e({sx:{display:"flex",alignItems:"center",gap:1}},{children:ie.isHeaderVisible&&n(a,e({sx:{fontSize:"16px",fontWeight:600,color:"#0F172A"}},{children:J}))})),ie.isToggleVisible&&n(d,e({sx:{display:"flex",alignItems:"center"}},{children:n(f,{control:n(h,{checked:ue,onChange:function(e){var n=e.target.checked;ve(!0),setTimeout(function(){ae(n),Yn(),Be(new Set),He([]),je.current=[],setTimeout(function(){ve(!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}})}))]})),n(d,e({ref:on,onScroll:Ct,sx:{flex:1,minHeight:0,pt:1.5,pb:1,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",overflowY:ue?"hidden":"auto",borderTop:On&&Ln?"none":"1.5px solid #EEF0F4"}},{children:n(d,e({sx:e({display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"},ue?{flex:1,minHeight:0}:{})},{children:t(d,e({ref:Gn,sx:e({display:"grid",gridTemplateColumns:"minmax(0, 1fr) 180px minmax(0, 1fr)",gap:"10px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0},ue?{flex:1,overflow:"visible"}:{})},{children:[t("svg",e({ref:Ae,style:{position:"absolute",top:0,left:0,width:Ge.width||"100%",height:Ge.height||"100%",pointerEvents:"none",zIndex:10,overflow:"visible",transition:"opacity 0.15s ease-in-out"}},{children:[ct&&t("g",{children:[n("line",{x1:ct.x1,y1:ct.y,x2:Math.max(ct.x1,(ct.x1+ct.x2)/2-70),y2:ct.y,stroke:"#BBF7D0",strokeWidth:"1.5"}),n("line",{x1:Math.min(ct.x2,(ct.x1+ct.x2)/2+70),y1:ct.y,x2:ct.x2,y2:ct.y,stroke:"#BBF7D0",strokeWidth:"1.5"})]}),nt.map(function(i){var r,o=(i.x1+i.x2)/2;if("Not Defined"===i.style.label&&!i.hasCognitive)return null;if(!ue)return t("g",{children:[n("line",{x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2,stroke:i.style.badgeBorder||"#E2E8F0",strokeWidth:"1.5"}),n("foreignObject",e({x:o-100,y:i.y1-14,width:"200",height:"28",style:{pointerEvents:"auto",overflow:"visible"}},{children:n(d,e({sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},{children:t(d,e({onClick:function(e){if(e.stopPropagation(),$e.open&&Ce===i.id)pn();else{var n=Wn[i.sectionIdx]||{title:"",content:""},t=zn[i.sectionIdx]||{title:"",content:""};if(i.isSubSection&&i.subSectionKeyPath){for(var r=i.subSectionKeyPath.split("-").map(Number),o=Wn[r[0]],l=zn[r[0]],c=1;c<r.length;c++)(null==o?void 0:o.subsections)&&(o=o.subsections[r[c]]),(null==l?void 0:l.subsections)&&(l=l.subsections[r[c]]);o&&(n=o),l&&(t=l)}Te(i.id),qn(Vn(e.currentTarget,n,t,i.sectionIdx,i.style))}},sx:{display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",bgcolor:i.style.badgeBg,color:i.style.badgeText,border:"1px solid ".concat(i.style.badgeBorder),borderRadius:"12px",px:1.5,py:.5,fontWeight:500,textAlign:"center",whiteSpace:"nowrap",cursor:"pointer"}},{children:[i.style.label,n(d,e({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:n(w,{})})),n(y,{size:11,style:{transform:$e.open&&Ce===i.id?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))}))]},i.id);var l=Wn[i.sectionIdx];return!(null===(r=null==l?void 0:l.refIndexes)||void 0===r?void 0:r.length)||(null==l?void 0:l.selfIndex)<0?null:be&&rt===i.sectionIdx&&Se?t("g",e({style:{transition:"opacity 0.2s"}},{children:[n("defs",{children:n("marker",e({id:"arr-".concat(i.id),markerWidth:"7",markerHeight:"5",refX:"7",refY:"2.5",orient:"auto"},{children:n("polygon",{points:"0 0, 7 2.5, 0 5",fill:i.style.badgeBorder||"#6366F1"})}))}),n("line",{ref:Qn,x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2,stroke:i.style.badgeBorder||"#6366F1",strokeWidth:"1.5",markerEnd:"url(#arr-".concat(i.id,")")})]}),i.id):null}),De.map(function(i){var r,o=i.pathD,l=(null===(r=i.style)||void 0===r?void 0:r.badgeBorder)||"#6366F1",c="conn-marker-".concat(i.id),u="".concat(i.id,"-bg"),a="".concat(i.id,"-stroke");return t("g",{children:[n("defs",{children:n("clipPath",e({id:"connections-clip"},{children:n("marker",e({id:c,markerWidth:"8",markerHeight:"6",refX:"7",refY:"3",orient:"auto"},{children:n("polygon",{points:"0 0, 8 3, 0 6",fill:l})}))}))}),n("path",{ref:function(e){Ne.current[u]=e},d:o,fill:"none",stroke:"#FFFFFF",strokeWidth:"4",strokeOpacity:"0.7"}),n("path",{ref:function(e){Ne.current[a]=e},d:o,fill:"none",stroke:l,strokeWidth:"1.75",markerEnd:"url(#".concat(c,")")})]},i.id)})]})),t(d,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)"},ue?{flex:1,overflow:"visible"}:{})},{children:[n(d,e({ref:Zn,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E7E7E9",borderRadius:"8px 8px 0 0",display:"flex",minHeight:"40px",alignItems:"center",overflowX:"hidden"}},{children:n(p,e({title:Hn,placement:"top"},{children:n(a,e({sx:{fontSize:"16px",fontWeight:500,color:"#19213D",overflow:"hidden",display:"flex",alignItems:"center",justifyContent:"center",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",height:"40px"}},{children:Hn}))}))})),t(d,e({ref:vn,onScroll:Ct,sx:e({p:"12px",display:"flex",flexDirection:"column"},ue?{maxHeight:"calc(100vh - 150px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,mr:"-160px",pr:"172px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[n("div",{ref:dn,style:{width:"100%",height:"0px",flexShrink:0}}),Nn&&Wn.map(function(r,o){var l,c,u,a=!r.title&&!r.content;if(ue&&a)return null;if(!ue)return n(d,e({ref:Kn(o)},{children:kt({section:r,idx:o,columnKey:"left",colRef:vt.current[o],parentNodeId:(null===(l=null==Q?void 0:Q.input_index_map)||void 0===l?void 0:l[0])||""})}),"left-row-".concat(o));var s=r,v=wt(o),f=!(null===(c=s.refIndexes)||void 0===c?void 0:c.length)||s.selfIndex<0,h="number"==typeof s.selfIndex&&s.selfIndex>=0?s.selfIndex+1:null,p=ke.has(o);return n(d,e({ref:Kn(o),sx:{mb:1}},{children:t(d,e({sx:{position:"relative",width:"100%"}},{children:[n(d,e({ref:vt.current[o],sx:e({width:"100%",display:"flex"},p&&{borderRadius:"6px",outline:"2px solid ".concat((null==v?void 0:v.badgeBorder)||"#6366F1"),outlineOffset:"1px"})},{children:kt({section:r,idx:o,columnKey:"left",colRef:i.createRef(),mb:0,parentNodeId:(null===(u=null==Q?void 0:Q.input_index_map)||void 0===u?void 0:u[0])||""})})),v&&t(d,e({ref:ht.current[o],onClick:function(e){var n=zn.find(function(e){var n;return null===(n=s.refIndexes)||void 0===n?void 0:n.includes(e.selfIndex)})||{title:"",content:""};!function(e,n,t,i,r){e.stopPropagation(),tn.open&&tn.sectionIdx===i?gn():(pn(),rn(Vn(e.currentTarget,n,t,i,r)))}(e,r,n,o,v)},sx:{position:"absolute",top:"18px",right:0,transform:"translateY(-50%) translateX(calc(100% + 8px))",display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",bgcolor:v.badgeBg,color:v.badgeText,border:"1px solid ".concat(v.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!==h&&n(d,e({component:"span",sx:{fontSize:"11px",fontWeight:700,pr:.5,borderRight:"1px solid ".concat(v.badgeBorder)}},{children:h})),n(d,e({component:"span",sx:{fontSize:"11px",px:.25}},{children:f?"No Deviation Found":0==v.deviationLabel||void 0===v.deviationLabel?"Same":"".concat(v.deviationLabel,"% Deviation")})),n(b,{size:11,color:v.badgeText})]}))]}))}),"left-row-".concat(o))}),n("div",{ref:sn,style:{width:"100%",height:"0px",flexShrink:0}})]}))]})),n(d,e({sx:{width:"180px",display:"flex",flexDirection:"column",alignItems:"center",pt:"15px",gap:0}},{children:n(d,e({sx:{display:"flex",justifyContent:"center",alignItems:"center",mt:0}},{children:t(d,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:[n(d,e({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:n(w,{})})),0,"% Similarity",n(y,{size:11})]}))}))})),t(d,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},ue?{flex:1,overflow:"visible",minHeight:0}:{})},{children:[he&&n(I,{sections:11}),n(d,e({ref:$n,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E3E6EA",borderRadius:"8px 8px 0 0",minHeight:"40px",display:"flex",alignItems:"center",overflowX:"hidden"}},{children:n(p,e({title:An,placement:"top"},{children:n(a,e({sx:{fontSize:"16px",fontWeight:500,color:"#5928ED",overflow:"hidden",display:"flex",justifyContent:"center",alignItems:"center",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",height:"40px"}},{children:An}))}))})),t(d,e({ref:cn,onScroll:Ct,sx:e({p:"12px",display:"flex",flexDirection:"column"},ue?{maxHeight:"calc(100vh - 150px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,ml:"-20px",pl:"40px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[n("div",{ref:un,style:{width:"100%",height:"0px",flexShrink:0}}),Nn&&zn.map(function(r,o){var l,c;if(!ue)return kt({section:r,idx:o,columnKey:"right",colRef:ft.current[o],parentNodeId:(null===(l=null==Q?void 0:Q.input_index_map)||void 0===l?void 0:l[1])||""});var u=r,a=Wn.filter(function(e){var n;return(null===(n=e.refIndexes)||void 0===n?void 0:n.includes(u.selfIndex))&&e.selfIndex>=0}).map(function(e){return e.selfIndex+1}),s=Wn.some(function(e,n){var t;return ke.has(n)&&(null===(t=e.refIndexes)||void 0===t?void 0:t.includes(u.selfIndex))}),v=Wn.findIndex(function(e,n){var t;return ke.has(n)&&(null===(t=e.refIndexes)||void 0===t?void 0:t.includes(u.selfIndex))}),f=-1!==v?wt(v):null;return n(d,e({ref:gt.current[o],sx:{mb:1}},{children:t(d,e({sx:{position:"relative",width:"100%"}},{children:[n(d,e({ref:ft.current[o],sx:e({width:"100%",display:"flex"},s&&f&&{borderRadius:"6px",outline:"2px solid ".concat(f.badgeBorder),outlineOffset:"1px"})},{children:kt({section:r,idx:o,columnKey:"right",colRef:i.createRef(),mb:0,parentNodeId:(null===(c=null==Q?void 0:Q.input_index_map)||void 0===c?void 0:c[1])||""})})),!he&&n(d,e({ref:pt.current[o],sx:{position:"absolute",top:"18px",left:0,transform:"translateY(-50%) translateX(calc(-100% - 8px))",display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:"11px",bgcolor:"#EEF2FF",color:"#3730A3",border:"1px solid #C7D2FE",borderRadius:"10px",px:1,py:.3,fontWeight:700,whiteSpace:"nowrap",zIndex:20}},{children:a.length>0?a.join(", "):"-"}))]}))}),"right-row-".concat(o))}),n("div",{ref:an,style:{width:"100%",height:"0px",flexShrink:0}})]}))]}))]}))}))}))]}))};export{P as default};
|
|
1
|
+
import{__assign as e}from"tslib";import{jsx as n,jsxs as t}from"react/jsx-runtime";import i,{useMemo as r,useState as o,useRef as l,useEffect as c,useCallback as u}from"react";import{Typography as a,Box as d,Snackbar as s,Alert as v,FormControlLabel as f,Switch as h,Tooltip as p,Accordion as g,AccordionSummary as x,AccordionDetails as m}from"@mui/material";import{ChevronDown as y,EllipsisVertical as b}from"lucide-react";import{ButtonCognitiveIcon as S}from"../../assests/svg/ButtonCognitiveIcon.js";import w from"./OverlayComponent.js";import I from"react-markdown";import{safeStringify as F,hasValue as E,getStyleForRelation as C,cognitiveScoreToRelation as R,getSideData as T,getRationale as _}from"./CognitiveComparehelpers.js";import{SHARED_MARKDOWN_STYLES as k,DEFAULT_FIELD_CONFIG as B,DEFAULT_COMPARISON_CONFIG as M}from"./CognitiveCompareConfig.js";export{SHARED_MARKDOWN_STYLES}from"./CognitiveCompareConfig.js";import D from"./CognitivePopup.js";import H from"./MoreFunctionsPopup.js";import A from"./LoaderComponent.js";import W from"rehype-raw";var z=i.memo(function(t){var i=t.content,o=t.sxStyles,l=t.highlights,c=void 0===l?[]:l,u=r(function(){return{mark:function(t){var i=t.children;return n("span",e({style:{backgroundColor:"#fccccc"}},{children:i}))}}},[]),d=r(function(){var e=i;return c.forEach(function(n){e=e.replace(new RegExp(n,"g"),"<mark>".concat(n,"</mark>"))}),e},[i,c]);return n(a,e({component:"div",sx:o},{children:n(I,e({components:u,rehypePlugins:[W]},{children:F(d).replace(/\\n/g,"\n")}))}))},function(e,n){if(e.content!==n.content)return!1;if(e.sxStyles!==n.sxStyles)return!1;var t=e.highlights||[],i=n.highlights||[];if(t.length!==i.length)return!1;for(var r=0;r<t.length;r++)if(t[r]!==i[r])return!1;return!0}),N=function(e,n,t,i,r){void 0===r&&(r=14);var o=e+.65*(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(r,Math.abs(l)/2,Math.abs(o-e)/2,Math.abs(t-o)/2);return["M ".concat(e," ").concat(n),"H ".concat(o-u),"Q ".concat(o," ").concat(n," ").concat(o," ").concat(n+c*u),"V ".concat(i-c*u),"Q ".concat(o," ").concat(i," ").concat(o+u," ").concat(i),"H ".concat(t)].join(" ")},j={id:"",title:""},O={open:!1,sectionTitle:"",refSectionTitle:"",cognitiveData:null,anchorEl:null,sectionAnchorEl:null,badgeStyle:null,sectionIdx:null,docData:null,deviationData:null},L=function(e,n,t,i,r){void 0===t&&(t=300);var o=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),r&&r(),requestAnimationFrame(a)):(e.scrollTop=n,e.style.scrollBehavior=o,r&&r(),i&&i())};requestAnimationFrame(a)},P=function(I){var W,P,K,Y,V,q,X,U,G=I.componentHeaderText,J=void 0===G?"Contract Comparison":G,Q=I.treeData,Z=I.comparisonConfig,$=I.leftColumnTitleText,ee=I.rightColumnTitleText,ne=I.markdownStyles,te=I.displayConfig,ie=void 0===te?{isHeaderVisible:!0,isToggleVisible:!0,maintainRelativeOrder:!1}:te,re=I.popupConfig,oe=I.deviationData,le=void 0===oe?{}:oe,ce=o(ie.maintainRelativeOrder),ue=ce[0],ae=ce[1],de=o(!1),se=de[0],ve=de[1],fe=o(!1),he=fe[0],pe=fe[1],ge=o(null),xe=ge[0],me=ge[1],ye=o(!1),be=ye[0],Se=ye[1],we=o(!1),Ie=we[0],Fe=we[1],Ee=l(!1),Ce=o(null),Re=Ce[0],Te=Ce[1],_e=o(new Set),ke=_e[0],Be=_e[1],Me=o([]),De=Me[0],He=Me[1],Ae=l(null),We=l(!1),ze=l(null),Ne=l({}),je=l([]),Oe=l(!1),Le=l(!1),Pe=l(null),Ke=r(function(){return(null==Q?void 0:Q.cognitive_decisioning)||{}},[Q]),Ye=o(null),Ve=Ye[0],qe=Ye[1],Xe=l(null),Ue=o({width:0,height:0}),Ge=Ue[0],Je=Ue[1],Qe=r(function(){return e(e({},k),ne)},[ne]),Ze=o({open:!1,sectionTitle:"",refSectionTitle:"",cognitiveData:null,anchorEl:null,sectionAnchorEl:null,badgeStyle:null,sectionIdx:null,docData:null,deviationData:null}),$e=Ze[0],en=Ze[1],nn=o({open:!1,sectionTitle:"",refSectionTitle:"",cognitiveData:null,anchorEl:null,sectionAnchorEl:null,badgeStyle:null,sectionIdx:null,docData:null,deviationData:null}),tn=nn[0],rn=nn[1],on=l(null),ln=l(null),cn=l(null),un=l(null),an=l(null),dn=l(null),sn=l(null),vn=l(null),fn=l(!1),hn=l(null);c(function(){hn.current=null},[$e.sectionIdx,$e.open]);var pn=u(function(){qe(null),en(O),Te(null)},[]),gn=u(function(){rn(O)},[]),xn=u(function(){var e;if($e.anchorEl&&$e.refSectionTitle){var n=$e.anchorEl.getBoundingClientRect(),t=(null===(e=null==Xe?void 0:Xe.current)||void 0===e?void 0:e.offsetHeight)||0,i=Math.min(680,window.innerWidth-24),r=window.innerHeight-n.bottom-12-12,o=n.top-12-12,l=r<t&&o>r;null!==hn.current?!0===hn.current&&(l=o>=t||o>=r):l=!(r>=t||r>=o),hn.current=l;var c=l?o:r,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));qe({top:a,left:v,arrowLeft:f,openAbove:l,maxHeight:c})}},[$e.anchorEl,$e.refSectionTitle]);c(function(){if($e.open){window.addEventListener("resize",xn);var e=requestAnimationFrame(xn),n=null;return Xe.current&&(n=new ResizeObserver(function(){cancelAnimationFrame(e),e=requestAnimationFrame(xn)})).observe(Xe.current),function(){cancelAnimationFrame(e),window.removeEventListener("resize",xn),n&&n.disconnect()}}},[$e.open,xn]),c(function(){var e=on.current;if(e&&$e.open){var n=function(e){Xe.current&&Xe.current.contains(e.target)||(qe(null),pn())};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})}}},[$e.open,pn]),c(function(){var e=on.current;if(e&&tn.open){var n=function(){gn()};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,gn]);var mn=r(function(){var n,t,i,r,o,l,c,u,a,d,s,v;return{fields:null!==(n=null==Z?void 0:Z.fields)&&void 0!==n?n:B,thresholds:{high:null!==(i=null===(t=null==Z?void 0:Z.thresholds)||void 0===t?void 0:t.high)&&void 0!==i?i:M.thresholds.high,medium:null!==(o=null===(r=null==Z?void 0:Z.thresholds)||void 0===r?void 0:r.medium)&&void 0!==o?o:M.thresholds.medium,exact:null!==(c=null===(l=null==Z?void 0:Z.thresholds)||void 0===l?void 0:l.exact)&&void 0!==c?c:M.thresholds.exact},relationStyles:{noContent:e(e({},M.relationStyles.noContent),(null===(u=null==Z?void 0:Z.relationStyles)||void 0===u?void 0:u.noContent)||{}),high:e(e({},M.relationStyles.high),(null===(a=null==Z?void 0:Z.relationStyles)||void 0===a?void 0:a.high)||{}),exact:e(e({},M.relationStyles.exact),(null===(d=null==Z?void 0:Z.relationStyles)||void 0===d?void 0:d.exact)||{}),medium:e(e({},M.relationStyles.medium),(null===(s=null==Z?void 0:Z.relationStyles)||void 0===s?void 0:s.medium)||{}),low:e(e({},M.relationStyles.low),(null===(v=null==Z?void 0:Z.relationStyles)||void 0===v?void 0:v.low)||{})}}},[Z]),yn=r(function(){if(Q&&Object.keys(Q).length>0)try{var n=function(n,t,i){var r,o,l,c,u;void 0===t&&(t=!1),void 0===i&&(i=null);var a=[],d=[],s=n.base_root_id,v=n.input_index_map||{0:"left",1:"right"},f=n[s]||(null===(r=n.nodes)||void 0===r?void 0:r[s]);if(!f||!1===f.display_node)return{activeProposed:{title:"No Data",sections:[]},activeVariants:[]};var h=function(t,r){var o,l=n[t];if(!l||!1===l.display_node)return null;var c=T(l,r,v),u=!!c.title.trim(),a=!!c.content.trim(),d=_(l),s=(null===(o=null==i?void 0:i[t])||void 0===o?void 0:o.evaluation_result)||l.evaluation_result||null,f=[];l.next&&Object.values(l.next).forEach(function(e){var t=n[e];if(t&&!1!==t.display_node){var i=h(e,r);i&&f.push(i)}});var p=!(!u&&!a);return e(e({id:t,title:u?c.title:"",content:a?c.content:"",subsections:f},p?d:{score:void 0,relation:"not_defined"}),{evaluationResult:s})};if(t){var p=function(t,r){var o,l,c,u,a,d,s,f,h,g,x,m,y,b;void 0===r&&(r=0);var S=[],w=[];if(!t)return{refSections:S,baseSections:w};var I={},F={},E=-1,C=-1;for(var R in t){var k=t[R],B=n[k]||(null===(o=n.nodes)||void 0===o?void 0:o[k]);if(B&&!1!==B.display_node){var M=_(B),D=(null===(l=null==i?void 0:i[k])||void 0===l?void 0:l.evaluation_result)||B.evaluation_result||null,H=T(B,"1",v),A=T(B,"0",v),W=H.title.trim()||H.content.trim(),z=A.title.trim()||A.content.trim(),N=Number(null!==(u=null===(c=H.attributes)||void 0===c?void 0:c.display_index)&&void 0!==u?u:E--),j=Number(null!==(d=null===(a=A.attributes)||void 0===a?void 0:a.display_index)&&void 0!==d?d:C--),O=I[N]||e(e({id:k,title:W?H.title:"",content:W?H.content:"",subsections:[]},W?M:{score:void 0,relation:"not_defined"}),{refIndexes:[],selfIndex:N,evaluationResult:D,displayContent:null===(s=H.attributes)||void 0===s?void 0:s.display_content,displayTitle:null===(f=H.attributes)||void 0===f?void 0:f.display_title}),L=F[j]||e(e({id:k,title:z?A.title:"",content:z?A.content:"",subsections:[]},z?M:{score:void 0,relation:"not_defined"}),{refIndexes:[],selfIndex:j,evaluationResult:D,displayContent:null===(h=A.attributes)||void 0===h?void 0:h.display_content,displayTitle:null===(g=A.attributes)||void 0===g?void 0:g.display_title});Number(N)>=0&&Number(j)>=0&&((null===(x=O.refIndexes)||void 0===x?void 0:x.includes(Number(j)))||null===(m=O.refIndexes)||void 0===m||m.push(Number(j)),(null===(y=L.refIndexes)||void 0===y?void 0:y.includes(Number(N)))||null===(b=L.refIndexes)||void 0===b||b.push(Number(N))),I[N]=O,F[j]=L;var P=p(B.next,r+1),K=P.refSections,Y=P.baseSections;K.length&&Y.length&&(O.subsections=K,L.subsections=Y)}}return S=Object.values(I).map(function(e){return e}),w=Object.values(F).map(function(e){return e}),S.sort(function(e,n){return e.selfIndex<0&&n.selfIndex>=0?1:e.selfIndex>=0&&n.selfIndex<0?-1:e.selfIndex-n.selfIndex}),w.sort(function(e,n){return e.selfIndex<0&&n.selfIndex>=0?1:e.selfIndex>=0&&n.selfIndex<0?-1:e.selfIndex-n.selfIndex}),{refSections:S,baseSections:w}},g=p(f.next),x=g.refSections,m=g.baseSections;d=x,a=m}else f.next&&Object.values(f.next).forEach(function(e){var t=n[e];t&&!1!==t.display_node&&(a.push(h(e,"0")||{id:e,title:"",content:"",subsections:[]}),d.push(h(e,"1")||{id:e,title:"",content:"",subsections:[]}))});return{activeProposed:{title:(null===(l=null===(o=f.comparison_inputs)||void 0===o?void 0:o[v[0]])||void 0===l?void 0:l.title)||"Uploaded Contract",description:f.decision_scope_description||"",sections:a},activeVariants:[{id:"tree-variant-1",title:(null===(u=null===(c=f.comparison_inputs)||void 0===c?void 0:c[v[1]])||void 0===u?void 0:u.title)||"Reference Template",similarity:0,sections:d,analysis:{rule_difference_comparison:{summary:{overall_score:0,overall_summary:f.decision_scope_description||""},fields:{}}}}]}}(Q,ue,le);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(Q),ue,JSON.stringify(le)]),bn=yn.activeProposed,Sn=yn.activeVariants,wn=yn.parseError;c(function(){wn&&me("Failed to load comparison: ".concat(wn))},[wn]);var In=o(null),Fn=In[0];In[1];var En=o({}),Cn=En[0],Rn=En[1],Tn=o({}),_n=Tn[0],kn=Tn[1],Bn=(null==Sn?void 0:Sn[0])||j,Mn=null===(K=null===(W=null==Q?void 0:Q.documents)||void 0===W?void 0:W[null===(P=null==Q?void 0:Q.input_index_map)||void 0===P?void 0:P[0]])||void 0===K?void 0:K.title,Dn=null===(q=null===(Y=null==Q?void 0:Q.documents)||void 0===Y?void 0:Y[null===(V=null==Q?void 0:Q.input_index_map)||void 0===V?void 0:V[1]])||void 0===q?void 0:q.title,Hn=F($||Mn||"Uploaded Contract"),An=F(ee||Dn||"Reference Template"),Wn=r(function(){return(null==bn?void 0:bn.sections)||[]},[null==bn?void 0:bn.sections]),zn=r(function(){return Bn.sections||[]},[Bn.sections]),Nn=Wn.length>0||zn.length>0,jn=Bn.analysis,On=F(null===(U=null===(X=null==jn?void 0:jn.rule_difference_comparison)||void 0===X?void 0:X.summary)||void 0===U?void 0:U.overall_summary),Ln=!!On.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),Pn=l({}),Kn=function(e){return Pn.current[e]||(Pn.current[e]=i.createRef()),Pn.current[e]},Yn=u(function(){Se(!1),Le.current=!1,ot(null),Pe.current=null,Jn.current=null,Fe(!1),pe(!1),un.current&&(un.current.style.height="0px"),an.current&&(an.current.style.height="0px"),dn.current&&(dn.current.style.height="0px"),sn.current&&(sn.current.style.height="0px")},[]),Vn=u(function(e,n,t,i,r){var o,l,c=F(n.id)||F(t.id)||"",u=(c?Ke[c]:null)||n.cognitiveData||t.cognitiveData||{section_id:c,decisioning:[],gap:[],relevance_score:0},a=null!==(l=null===(o=Pn.current[i])||void 0===o?void 0:o.current)&&void 0!==l?l:null;return{open:!0,sectionTitle:n.title||"N/A",refSectionTitle:t.title||"NA",cognitiveData:u,anchorEl:e,sectionAnchorEl:a,badgeStyle:r||null,sectionIdx:i,docData:{documents:null==Q?void 0:Q.documents,input_index_map:null==Q?void 0:Q.input_index_map},deviationData:n.evaluationResult||t.evaluationResult||null}},[Ke,Q]),qn=u(function(e){gn(),qe(null),en(e)},[gn]),Xn=u(function(){null!==tn.sectionIdx&&tn.anchorEl?qn(e(e({},tn),{open:!0})):gn()},[tn,gn,qn]);u(function(e){gn(),me("".concat(e," is coming soon."))},[gn]);var Un=u(function(){var e=tn.sectionIdx;gn(),null!==e&&(Le.current&&Yn(),Be(function(n){return n.has(e)?new Set:new Set([e])}))},[tn.sectionIdx,gn,Yn]),Gn=l(null),Jn=l(null),Qn=l(null),Zn=l(null),$n=l(null),et=o([]),nt=et[0],tt=et[1],it=o(null),rt=it[0],ot=it[1];l(null);var lt=o(null),ct=lt[0],ut=lt[1],at=r(function(){return mn.fields.filter(function(e){var n=e.key;return(!Nn||"description"!==n)&&(E(null==bn?void 0:bn[n])||E(Bn[n]))})},[bn,Bn,Nn,mn.fields]),dt=l({}),st=l({}),vt=l({}),ft=l({}),ht=l({}),pt=l({}),gt=l({}),xt=l({}),mt=l({});at.forEach(function(e){for(var n=e.key,t=0;t<Math.max(Wn.length,zn.length);t+=1)vt.current[t]||(vt.current[t]=i.createRef()),ft.current[t]||(ft.current[t]=i.createRef()),ht.current[t]||(ht.current[t]=i.createRef()),pt.current[t]||(pt.current[t]=i.createRef()),gt.current[t]||(gt.current[t]=i.createRef());dt.current[n]||(dt.current[n]=i.createRef()),st.current[n]||(st.current[n]=i.createRef())});for(var yt=0;yt<Math.max(Wn.length,zn.length);yt+=1)vt.current[yt]||(vt.current[yt]=i.createRef()),ft.current[yt]||(ft.current[yt]=i.createRef()),ht.current[yt]||(ht.current[yt]=i.createRef()),pt.current[yt]||(pt.current[yt]=i.createRef()),gt.current[yt]||(gt.current[yt]=i.createRef());c(function(){if(Fn){var e=mn.fields.find(function(e){return e.analysisKey===Fn||e.key===Fn});if(e){var n=dt.current[e.key]||st.current[e.key];(null==n?void 0:n.current)&&setTimeout(function(){return n.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[Fn,mn.fields]);var bt=u(function(e){var n,t,i,r,o,l,c,u,a,d=null===(n=null==jn?void 0:jn.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===(o=null===(r=null==s?void 0:s.highlights)||void 0===r?void 0:r.ruleB_spans)||void 0===o?void 0:o.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}},[jn]),St=u(function(n){var t,i,r,o,l=Wn[n],c=zn[n],u=(null==l?void 0:l.relation)&&"not_defined"!==l.relation,a=(null==c?void 0:c.relation)&&"not_defined"!==c.relation,d=F(null==l?void 0:l.id)||F(null==c?void 0:c.id)||"",s=!(!(null==l?void 0:l.cognitiveData)&&!(null==c?void 0:c.cognitiveData));if(!u&&!a&&!s)return e(e({},mn.relationStyles.noContent),{label:"Not Defined"});var v=bt("description");if(null!=(null!==(i=null!==(t=null==l?void 0:l.cognitiveRelevanceScore)&&void 0!==t?t:null==c?void 0:c.cognitiveRelevanceScore)&&void 0!==i?i:d?null===(r=Ke[d])||void 0===r?void 0:r.relevance_score:void 0)){var f=R(),h=f.score,p=f.relation;return C(h,p,!0,mn)}var g=u?l.relation:a?c.relation:v.relation,x=null!==(o=null==l?void 0:l.score)&&void 0!==o?o:null==c?void 0:c.score,m="number"==typeof x?x:v.score;return C(m,g,!0,mn)},[Wn,zn,Ke,mn,bt]),wt=u(function(){var e,n,t,i,r,o,l,c,u,a;if(!fn.current&&!We.current){fn.current=!0;try{if(!Gn.current)return;var d=function(e){var n=e.split("-"),t=n[0];if(!Cn[t]&&!1===ue)return!1;if(ue&&!Cn["left-".concat(t)]&&!Cn["right-".concat(t)]&&!Cn[t])return!1;for(var i=t,r=1;r<n.length-1;r++)if(i+="-".concat(n[r]),!_n[i])return!1;return!0},s=Gn.current.getBoundingClientRect();Je({width:s.width,height:s.height});var v=[];if(at.forEach(function(e){var n,t,i=e.key,r=null===(n=dt.current[i])||void 0===n?void 0:n.current,o=null===(t=st.current[i])||void 0===t?void 0:t.current;r&&o&&(r.style.height="auto",o.style.height="auto",r.style.minHeight="0px",o.style.minHeight="0px")}),!We.current){for(var f=0;f<Math.max(Wn.length,zn.length);f++){var h=null===(e=vt.current[f])||void 0===e?void 0:e.current,p=null===(n=ft.current[f])||void 0===n?void 0:n.current;h&&(h.style.height="auto",h.style.minHeight="0px"),p&&(p.style.height="auto",p.style.minHeight="0px")}ue||Object.keys(xt.current).forEach(function(e){var n,t;if(d(e)){var i=null===(n=xt.current[e])||void 0===n?void 0:n.current,r=null===(t=mt.current[e])||void 0===t?void 0:t.current;i&&r&&(i.style.height="auto",r.style.height="auto",i.style.minHeight="0px",r.style.minHeight="0px")}})}var g={};at.forEach(function(e){var n,t,i=e.key,r=null===(n=dt.current[i])||void 0===n?void 0:n.current,o=null===(t=st.current[i])||void 0===t?void 0:t.current;if(r&&o){var l=r.getBoundingClientRect(),c=o.getBoundingClientRect();g[i]=Math.max(l.height,c.height)}});var x={left:{},right:{}},m={};if(!We.current)if(ue){if(be&&null!==rt){var y=rt,b=Wn[y],S=null===(r=vt.current[y])||void 0===r?void 0:r.current;S&&b&&(b.refIndexes||[]).forEach(function(e){var n,t=zn.findIndex(function(n){return n.selfIndex===e}),i=null===(n=ft.current[t])||void 0===n?void 0:n.current;if(i&&(Cn["left-".concat(y)]||Cn["right-".concat(t)])){var r=Math.max(S.getBoundingClientRect().height,i.getBoundingClientRect().height);x.left[y]=Math.max(x.left[y]||0,r),x.right[t]=Math.max(x.right[t]||0,r)}})}}else{for(f=0;f<Math.min(Wn.length,zn.length);f++){h=null===(t=vt.current[f])||void 0===t?void 0:t.current,p=null===(i=ft.current[f])||void 0===i?void 0:i.current;var w=!!Cn[String(f)];if(h&&p&&w){var I=Math.max(h.getBoundingClientRect().height,p.getBoundingClientRect().height);x.left[f]=I,x.right[f]=I}}Object.keys(xt.current).forEach(function(e){var n,t;if(d(e)){var i=null===(n=xt.current[e])||void 0===n?void 0:n.current,r=null===(t=mt.current[e])||void 0===t?void 0:t.current;if(i&&r&&null!==i.offsetParent&&null!==r.offsetParent){var o=i.getBoundingClientRect(),l=r.getBoundingClientRect();m[e]=Math.max(o.height,l.height)}}})}if(at.forEach(function(e){var n,t,i=e.key,r=null===(n=dt.current[i])||void 0===n?void 0:n.current,o=null===(t=st.current[i])||void 0===t?void 0:t.current;if(r&&o){var l=g[i];r.style.minHeight="".concat(l,"px"),o.style.minHeight="".concat(l,"px")}}),We.current||(Object.entries(x.left).forEach(function(e){var n,t=e[0],i=e[1],r=null===(n=vt.current[Number(t)])||void 0===n?void 0:n.current;r&&(r.style.minHeight="".concat(i,"px"))}),Object.entries(x.right).forEach(function(e){var n,t=e[0],i=e[1],r=null===(n=ft.current[Number(t)])||void 0===n?void 0:n.current;r&&(r.style.minHeight="".concat(i,"px"))}),ue||Object.keys(m).forEach(function(e){var n,t,i=null===(n=xt.current[e])||void 0===n?void 0:n.current,r=null===(t=mt.current[e])||void 0===t?void 0:t.current;if(i&&r&&m[e]){var o=m[e];i.style.minHeight="".concat(o,"px"),r.style.minHeight="".concat(o,"px")}})),at.forEach(function(e){var n,t,i=e.key,r=e.analysisKey,o=null===(n=dt.current[i])||void 0===n?void 0:n.current,l=null===(t=st.current[i])||void 0===t?void 0:t.current;if(o&&l){var c=o.getBoundingClientRect(),u=l.getBoundingClientRect(),a=bt(r),d=C(a.score,a.relation,a.hasContent,mn);if(!d)return;var f=c.top+c.height/2-s.top;v.push({id:"field-".concat(i),x1:c.right-s.left,y1:f,x2:u.left-s.left,y2:f,style:d})}}),ue)Wn.forEach(function(e,n){var t;(null===(t=vt.current[n])||void 0===t?void 0:t.current)&&(e.refIndexes||[]).forEach(function(e){var t,i,r,o,l,c,u,a,d,f,h=zn.findIndex(function(n){return n.selfIndex===e});if(-1!==h){var p=null===(t=ht.current[n])||void 0===t?void 0:t.current,g=null===(i=pt.current[h])||void 0===i?void 0:i.current;if(p&&g){var x=p.getBoundingClientRect(),m=g.getBoundingClientRect(),y=x.right-s.left,b=m.left-s.left,S=x.top+x.height/2-s.top,w=m.top+m.height/2-s.top;if(be&&rt===n){var I=null!==(o=null===(r=vn.current)||void 0===r?void 0:r.getBoundingClientRect().top)&&void 0!==o?o:0,F=null!==(c=null===(l=cn.current)||void 0===l?void 0:l.getBoundingClientRect().top)&&void 0!==c?c:0,E=I+(null!==(a=null===(u=vn.current)||void 0===u?void 0:u.clientHeight)&&void 0!==a?a:1/0),C=F+(null!==(f=null===(d=cn.current)||void 0===d?void 0:d.clientHeight)&&void 0!==f?f:1/0),R=x.top+x.height/2,T=function(e,n,t){return Math.max(n,Math.min(t,e))};S=T(R,I,E)-s.top,w=T(R,F,C)-s.top}var _=St(n);_&&v.push({id:"line-".concat(n,"-").concat(h),x1:y,y1:S,x2:b,y2:w,style:_,sectionIdx:n,targetRightIdx:h})}}})});else{for(f=0;f<Math.min(Wn.length,zn.length);f++){var E=null===(o=vt.current[f])||void 0===o?void 0:o.current,T=null===(l=ft.current[f])||void 0===l?void 0:l.current;if(E&&T){var _=E.getBoundingClientRect(),k=T.getBoundingClientRect(),B=(_.top+18-s.top+k.top+18-s.top)/2,M=(null===(c=zn[f])||void 0===c?void 0:c.id)||"sec-".concat(f),D=St(f);D&&v.push({id:M,x1:_.right-s.left,y1:B,x2:k.left-s.left,y2:B,style:D,sectionIdx:f,hasCognitive:!!((null===(u=Wn[f])||void 0===u?void 0:u.cognitiveData)||(null===(a=zn[f])||void 0===a?void 0:a.cognitiveData)||M&&Ke[M])})}}Object.keys(xt.current).forEach(function(e){var n,t,i,r,o,l;if(d(e)){var c=null===(n=xt.current[e])||void 0===n?void 0:n.current,u=null===(t=mt.current[e])||void 0===t?void 0:t.current;if(c&&u&&null!==c.offsetParent&&null!==u.offsetParent){for(var a=c.getBoundingClientRect(),f=u.getBoundingClientRect(),h=(a.top+16-s.top+f.top+16-s.top)/2,p=e.split("-").map(Number),g=Wn[p[0]],x=zn[p[0]],m=1;m<p.length;m++)(null==g?void 0:g.subsections)&&(g=g.subsections[p[m]]),(null==x?void 0:x.subsections)&&(x=x.subsections[p[m]]);if(!g&&!x)return;var y=(null==g?void 0:g.relation)&&"not_defined"!==g.relation,b=(null==x?void 0:x.relation)&&"not_defined"!==x.relation,S=F(null==g?void 0:g.id)||F(null==x?void 0:x.id)||"",w=!(!(null==g?void 0:g.cognitiveData)&&!(null==x?void 0:x.cognitiveData)),I=null;if(y||b||w){var E=null!==(r=null!==(i=null==g?void 0:g.cognitiveRelevanceScore)&&void 0!==i?i:null==x?void 0:x.cognitiveRelevanceScore)&&void 0!==r?r:S?null===(o=Ke[S])||void 0===o?void 0:o.relevance_score:void 0;if(null!=E){var T=R(E),_=T.score,k=T.relation;I=C(_,k,!0,mn)}else{k=y?g.relation:b?x.relation:"not_defined";var B=null!==(l=null==g?void 0:g.score)&&void 0!==l?l:null==x?void 0:x.score;I=C(_="number"==typeof B?B:0,k,!0,mn)}}else I={badgeBg:"#EEF2FF",badgeText:"#3730A3",badgeBorder:"#C7D2FE",label:"N/A"};I&&v.push({id:"subsec-".concat(e),x1:a.right-s.left,y1:h,x2:f.left-s.left,y2:h,style:I,sectionIdx:p[0],isSubSection:!0,subSectionKeyPath:e,hasCognitive:w||S&&Ke[S]})}}})}if(tt(v),Zn.current&&$n.current){var H=Zn.current.getBoundingClientRect(),A=$n.current.getBoundingClientRect(),W=(H.top+H.height/2-s.top+A.top+A.height/2-s.top)/2;ut({x1:H.right-s.left,x2:A.left-s.left,y:W})}else ut(null);if(ue&&ke.size>0){var z=[],j=vn.current,O=cn.current;if(j&&O){var L=[],P=j.getBoundingClientRect().top,K=O.getBoundingClientRect().top,Y=P+j.clientHeight,V=K+O.clientHeight,q=j.scrollTop,X=O.scrollTop,U=s.top,G=function(e,n,t){return Math.max(n,Math.min(t,e))};ke.forEach(function(e){var n,t=Wn[e];(null===(n=null==t?void 0:t.refIndexes)||void 0===n?void 0:n.length)&&t.refIndexes.forEach(function(n){var t,i,r=zn.findIndex(function(e){return e.selfIndex===n});if(-1!==r){var o=null===(t=ht.current[e])||void 0===t?void 0:t.current,l=null===(i=pt.current[r])||void 0===i?void 0:i.current;if(o&&l){var c=o.getBoundingClientRect(),u=l.getBoundingClientRect(),a=St(e),d=c.right-s.left,v=u.left-s.left-0,f=d+.65*(v-d),h=c.top+c.height/2,p=u.top+u.height/2,g=h-P+q,x=p-K+X,m="conn-".concat(e,"-").concat(r);L.push({lhsScrollY:g,rhsScrollY:x,x1:d,x2:v,containerTop:U,leftIdx:e,rhsArrayIdx:r,styleColor:(null==a?void 0:a.badgeBorder)||"#6366F1",styleId:m});var y=G(h,P,Y),b=G(p,K,V),S=y-U,w=b-U,I=h>=P-4&&h<=Y+4,F=p>=K-4&&p<=V+4,E="";E=I&&F?N(d,S,v,w):I&&!F?"M ".concat(d,",").concat(S," L ").concat(f,",").concat(S," L ").concat(f,",").concat(w):!I&&F?"M ".concat(f,",").concat(S," L ").concat(f,",").concat(w," L ").concat(v,",").concat(w):"M ".concat(f,",").concat(S," L ").concat(f,",").concat(w),z.push({id:m,pathD:E,style:a,leftIdx:e,rhsArrayIdx:r})}}})}),je.current=L}He(z)}else He([]),je.current=[]}catch(e){console.error("Line render safe fail: ",e)}finally{fn.current=!1}}},[at,Wn,zn,Ke,mn,bt,St,ue,be,rt,ke,Cn,_n]),It=u(function(){var e,n,t,i,r,o,l,c,u,a,d,s,v,f,h=je.current;if(h.length&&!We.current){var p=null!==(n=null===(e=vn.current)||void 0===e?void 0:e.scrollTop)&&void 0!==n?n:0,g=null!==(i=null===(t=cn.current)||void 0===t?void 0:t.scrollTop)&&void 0!==i?i:0,x=null!==(o=null===(r=vn.current)||void 0===r?void 0:r.clientHeight)&&void 0!==o?o:1/0,m=null!==(c=null===(l=cn.current)||void 0===l?void 0:l.clientHeight)&&void 0!==c?c:1/0,y=null!==(a=null===(u=vn.current)||void 0===u?void 0:u.getBoundingClientRect().top)&&void 0!==a?a:0,b=null!==(s=null===(d=cn.current)||void 0===d?void 0:d.getBoundingClientRect().top)&&void 0!==s?s:0,S=y+x,w=b+m,I=null!==(f=null===(v=Gn.current)||void 0===v?void 0:v.getBoundingClientRect().top)&&void 0!==f?f:0,F=function(e,n,t){return Math.max(n,Math.min(t,e))};h.forEach(function(e){var n=e.lhsScrollY-p+y,t=e.rhsScrollY-g+b,i=Ne.current[e.styleId+"-stroke"],r=Ne.current[e.styleId+"-bg"];if(i||r){var o,l=F(n,y,S),c=F(t,b,w),u=l-I,a=c-I,d=n>=y-4&&n<=S+4,s=t>=b-4&&t<=w+4,v=e.x1+.65*(e.x2-e.x1);o=d&&s?N(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",o)),r&&(r.setAttribute("visibility","visible"),r.setAttribute("d",o))}})}},[]),Ft=l(wt);c(function(){Ft.current=wt},[wt]);var Et=l(null),Ct=u(function(){null!==Et.current&&clearTimeout(Et.current),Et.current=setTimeout(function(){Ft.current(),Et.current=null},50)},[]),Rt=u(function(e){var n,t,i,r,o,l;if(!Ee.current){if(Le.current){var c=Pe.current,u=Jn.current,a=vn.current,d=cn.current;if(null!==c&&null!==u&&a&&d){var s=null===(n=Pn.current[c])||void 0===n?void 0:n.current,v=null===(t=gt.current[u])||void 0===t?void 0:t.current;if(s&&v){if(e.currentTarget===a){var f=s.offsetTop-a.scrollTop,h=v.offsetTop-f,p=d.scrollHeight-d.clientHeight,g=Math.max(0,Math.min(h,p));Math.abs(d.scrollTop-g)>1&&(d.scrollTop=g)}else if(e.currentTarget===d){var x=v.offsetTop-d.scrollTop,m=s.offsetTop-x,y=a.scrollHeight-a.clientHeight,b=Math.max(0,Math.min(m,y));Math.abs(a.scrollTop-b)>1&&(a.scrollTop=b)}if(Qn.current){var S=null===(i=ht.current[c])||void 0===i?void 0:i.current,w=null===(r=pt.current[u])||void 0===r?void 0:r.current,I=null!==(l=null===(o=Gn.current)||void 0===o?void 0:o.getBoundingClientRect().top)&&void 0!==l?l:0,F=a.getBoundingClientRect().top,E=F+a.clientHeight,C=d.getBoundingClientRect().top,R=C+d.clientHeight,T=function(e,n,t){return Math.max(n,Math.min(t,e))};if(S&&w){var _=S.getBoundingClientRect(),k=w.getBoundingClientRect(),B=_.top+_.height/2,M=k.top+k.height/2,D=T(B,F,E),H=T(M,C,R);Qn.current.setAttribute("y1",(D-I).toString()),Qn.current.setAttribute("y2",(H-I).toString());var A=B>=F-4&&B<=E+4;Qn.current.setAttribute("visibility",A?"visible":"hidden")}}}}}je.current.length>0&&!Oe.current&&(Oe.current=!0,requestAnimationFrame(function(){It(),Oe.current=!1}))}},[It]);c(function(){var e=setTimeout(Ct,250);window.addEventListener("resize",Ct);var n=null,t=null;return on.current&&(n=new ResizeObserver(Ct)).observe(on.current),Gn.current&&(t=new ResizeObserver(Ct)).observe(Gn.current),function(){clearTimeout(e),window.removeEventListener("resize",Ct),null==n||n.disconnect(),null==t||t.disconnect()}},[bn,Bn,jn,at,Cn,_n,Wn,zn,mn,Ct,be,rt,Ie,ke]),c(function(){Le.current=be},[be]),c(function(){Pe.current=rt},[rt]);var Tt=u(function(){var e=tn.sectionIdx;gn(),null!==e&&(be&&rt===e?Yn():(Be(new Set),He([]),je.current=[],pe(!0),Ee.current=!0,ot(e),Pe.current=e,Se(!0),Le.current=!0,Fe(!1),un.current&&(un.current.style.height="0px"),an.current&&(an.current.style.height="0px"),dn.current&&(dn.current.style.height="0px"),sn.current&&(sn.current.style.height="0px"),requestAnimationFrame(function(){var n,t,i=null===(n=Pn.current[e])||void 0===n?void 0:n.current,r=Wn[e],o=(null==r?void 0:r.refIndexes)||[],l=null,c=-1;if(o.length>0){var u=o[0];c=zn.findIndex(function(e){return e.selfIndex===u}),l=null===(t=gt.current[c])||void 0===t?void 0:t.current}Jn.current=-1!==c?c:null;var a=vn.current,d=cn.current;if(!i||!a)return Ee.current=!1,void pe(!1);var s=i.offsetTop-a.scrollTop;if(!l||!d)return Fe(!0),Ft.current(),Ee.current=!1,void pe(!1);var v=l.offsetTop-s;v<0&&un.current&&(un.current.style.height="".concat(Math.abs(v),"px"));requestAnimationFrame(function(){var e,n=d.scrollHeight-d.clientHeight;if(v<0)e=0;else{if(v>n){var t=v-n;return an.current&&(an.current.style.height="".concat(t+150,"px")),void requestAnimationFrame(function(){L(d,v,200,function(){Fe(!0),Ft.current(),Ee.current=!1,pe(!1)})})}e=v}L(d,e,200,function(){Fe(!0),Ft.current(),Ee.current=!1,pe(!1)})})})))},[gn,tn.sectionIdx,be,rt,Wn,zn,Ct,Yn]),_t=null!==tn.sectionIdx&&ke.has(tn.sectionIdx),kt=function(r){var o,l,c,u=r.section,s=r.idx,v=r.columnKey,f=r.colRef,h=r.mb,b=void 0===h?1:h,S=r.parentNodeId,w=void 0===S?"":S,I=ue?!!Cn["".concat(v,"-").concat(s)]:!!Cn[String(s)],C=(null===(o=u.displayTitle)||void 0===o||o)&&E(u.title),R=(null===(l=u.displayContent)||void 0===l||l)&&E(u.content),T=!C&&!R,_=u.title;C||(_=R?"No Title Found":"No Matching Section Found");var k,B=[];if(null===(c=u.evaluationResult)||void 0===c?void 0:c.deviations){var M=u.evaluationResult.deviations;for(var D in M){var H=M[D][w];H&&B.push(H)}}return n(d,e({ref:f,sx:{mb:b,width:"100%",display:"flex",flexDirection:"column",position:"relative",minWidth:0}},{children:t(g,e({disableGutters:!0,expanded:!T&&I,onChange:function(){return!T&&function(n,t){var i,r;We.current=!0,ze.current&&clearTimeout(ze.current),Ae.current&&(Ae.current.style.opacity="0");var o=null===(i=vt.current[n])||void 0===i?void 0:i.current,l=null===(r=ft.current[n])||void 0===r?void 0:r.current;if(o&&(o.style.minHeight="0px"),l&&(l.style.minHeight="0px"),Object.keys(xt.current).forEach(function(e){var t,i;if(e.startsWith("".concat(n,"-"))){var r=null===(t=xt.current[e])||void 0===t?void 0:t.current,o=null===(i=mt.current[e])||void 0===i?void 0:i.current;r&&(r.style.minHeight="0px"),o&&(o.style.minHeight="0px")}}),ue){var c=Wn[n];((null==c?void 0:c.refIndexes)||[]).forEach(function(e){var n,t=zn.findIndex(function(n){return n.selfIndex===e}),i=null===(n=ft.current[t])||void 0===n?void 0:n.current;i&&(i.style.minHeight="0px")});var u=zn[n],a=null==u?void 0:u.selfIndex;Wn.forEach(function(e,n){var t,i;if(null===(t=e.refIndexes)||void 0===t?void 0:t.includes(a)){var r=null===(i=vt.current[n])||void 0===i?void 0:i.current;r&&(r.style.minHeight="0px")}})}ze.current=setTimeout(function(){We.current=!1,Ft.current(),Ae.current&&(Ae.current.style.opacity="1")},550),Rn(function(i){var r=e({},i);if(!ue){var o=!!i[String(n)];return r[String(n)]=!o,r}var l="".concat(t,"-").concat(n),c=!i[l];if(r[l]=c,"left"===t)((null==(u=Wn[n])?void 0:u.refIndexes)||[]).forEach(function(e){var n=zn.findIndex(function(n){return n.selfIndex===e});-1!==n&&(r["right-".concat(n)]=c)});else{var u,a=null==(u=zn[n])?void 0:u.selfIndex;Wn.forEach(function(e,n){var t;(null===(t=e.refIndexes)||void 0===t?void 0:t.includes(a))&&(r["left-".concat(n)]=c)})}return r})}(s,v)},sx:{boxShadow:"none",border:T?"1px dashed #E2E8F0":"1px solid #E2E8F0",bgcolor:T?"#FAFAFA":"#FFFFFF",borderRadius:"6px",flexGrow:1,width:"100%",display:"flex",flexDirection:"column",minWidth:0,"&:before":{display:"none"}}},{children:[n(x,e({expandIcon:T?null:n(y,{size:16}),sx:{minHeight:"36px",flexShrink:0,cursor:T?"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:C&&n(p,e({title:_,placement:"top"},{children:n(a,e({component:"div",sx:{fontSize:"12px",color:T?"#94A3B8":"#19213D",fontWeight:T?400:700,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0}},{children:(k=_,k?F(k).replace(/\\n/g,"\n").split(/(\*\*.*?\*\*)/g).map(function(e,t){return e.startsWith("**")&&e.endsWith("**")?n("strong",{children:e.slice(2,-2)},t):n(i.Fragment,{children:e},t)}):null)}))}))})),!T&&t(m,e({sx:{pt:0,pb:1.25,bgcolor:"#FFFFFF",flex:1,display:"flex",flexDirection:"column",minWidth:0}},{children:[R&&n(z,{content:u.content,sxStyles:Qe,highlights:B}),(u.subsections||[]).map(function(e,n){return Bt({section:e,keyPath:"".concat(s,"-").concat(n),depth:0,columnKey:v,parentNodeId:w})})]}))]}))}),"".concat(v,"-sec-").concat(s))},Bt=function(r){var o,l,c=r.section,u=r.keyPath,s=r.depth,v=void 0===s?0:s,f=r.columnKey,h=void 0===f?"left":f,p=r.parentNodeId,b=void 0===p?"":p,S=(null===(o=c.displayTitle)||void 0===o||o)&&E(c.title),w=(null===(l=c.displayContent)||void 0===l||l)&&E(c.content),I=!S&&!w,F=S?c.title:w?"No Title Found":"No Matching Section Found",C=!!_n[u];"left"!==h||xt.current[u]||(xt.current[u]=i.createRef()),"right"!==h||mt.current[u]||(mt.current[u]=i.createRef());var R="left"===h?xt.current[u]:mt.current[u];return n(d,S?e({ref:R,sx:{mt:1,width:"100%",minWidth:0,position:"relative"}},{children:t(g,e({disableGutters:!0,expanded:!I&&C,onChange:function(){return!I&&function(n){var t,i;We.current=!0,ze.current&&clearTimeout(ze.current),Ae.current&&(Ae.current.style.opacity="0");var r=null===(t=xt.current[n])||void 0===t?void 0:t.current,o=null===(i=mt.current[n])||void 0===i?void 0:i.current;r&&(r.style.minHeight="0px"),o&&(o.style.minHeight="0px"),ze.current=setTimeout(function(){We.current=!1,Ft.current(),Ae.current&&(Ae.current.style.opacity="1")},450),kn(function(t){var i;return e(e({},t),((i={})[n]=!t[n],i))})}(u)},sx:{mt:0,boxShadow:"none",border:I?"1px dashed #E2E8F0":"1px solid #EEF2F7",borderRadius:"4px !important",bgcolor:"#FFFFFF",minWidth:0,"&:before":{display:"none"}}},{children:[n(x,e({expandIcon:I?null:n(y,{size:14}),sx:{minHeight:"32px","& .MuiAccordionSummary-content":{my:.5,display:"grid",alignItems:"center",minWidth:0,width:"100%"}}},{children:n(a,e({component:"div",sx:{fontSize:"11px",fontWeight:600,color:I?"#94A3B8":"#19213D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0}},{children:F||"Untitled Subsection"}))})),!I&&t(m,e({sx:{pt:0,pb:1,minWidth:0}},{children:[w&&n(z,{content:c.content,sxStyles:Qe,highlights:function(){var e,n;if(!(null===(e=c.evaluationResult)||void 0===e?void 0:e.deviations))return[];var t=(null===(n=c.evaluationResult)||void 0===n?void 0:n.deviations)||{},i=[];for(var r in t){var o=t[r][b];o&&i.push(o)}return i}()}),(c.subsections||[]).map(function(e,n){return Bt({section:e,keyPath:"".concat(u,"-").concat(n),depth:v+1,columnKey:h,parentNodeId:b})})]}))]}))}):e({ref:R,sx:{mt:0===v?1:.75,width:"100%",minWidth:0}},{children:!I&&t("div",{children:[w&&n(z,{content:c.content,sxStyles:Qe,highlights:function(){var e,n;if(!(null===(e=c.evaluationResult)||void 0===e?void 0:e.deviations))return[];var t=(null===(n=c.evaluationResult)||void 0===n?void 0:n.deviations)||{},i=[];for(var r in t){var o=t[r][b];o&&i.push(o)}return i}()}),(c.subsections||[]).map(function(e,n){return Bt({section:e,keyPath:"".concat(u,"-").concat(n),depth:v+1,columnKey:h,parentNodeId:b})})]})}),u)};return t(d,e({ref:ln,sx:e(e({display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif'},ue?{}:{overflow:"visible"}),{position:"relative"})},{children:[se&&n(d,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:n(A,{})})),ue&&n(H,{open:tn.open,anchorEl:tn.anchorEl,sectionTitle:tn.sectionTitle,referenceSectionTitle:tn.refSectionTitle,onClose:gn,onOpenCognitiveCompare:Xn,onOpenSideBySide:Tt,onConnect:Un,isConnected:_t}),$e.open&&n(D,{open:$e.open,popupRef:Xe,position:Ve,popupConfig:re,onClose:function(){qe(null),en(function(n){return e(e({},n),{open:!1})}),Te(null)},markdownStyles:ne,sectionTitle:$e.sectionTitle,referenceSectionTitle:$e.refSectionTitle,cognitiveData:$e.cognitiveData,anchorEl:$e.anchorEl,sectionAnchorEl:$e.sectionAnchorEl,scrollContainerEl:on.current,badgeStyle:$e.badgeStyle,docData:$e.docData,deviationData:$e.deviationData}),n(s,e({open:!!xe,autoHideDuration:8e3,onClose:function(){return me(null)},anchorOrigin:{vertical:"top",horizontal:"center"}},{children:n(v,e({onClose:function(){return me(null)},severity:"error",sx:{width:"100%",whiteSpace:"pre-line"}},{children:xe}))})),(ie.isHeaderVisible||ie.isToggleVisible)&&t(d,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:[n(d,e({sx:{display:"flex",alignItems:"center",gap:1}},{children:ie.isHeaderVisible&&n(a,e({sx:{fontSize:"16px",fontWeight:600,color:"#0F172A"}},{children:J}))})),ie.isToggleVisible&&n(d,e({sx:{display:"flex",alignItems:"center"}},{children:n(f,{control:n(h,{checked:ue,onChange:function(e){var n=e.target.checked;ve(!0),setTimeout(function(){ae(n),Yn(),Be(new Set),He([]),je.current=[],setTimeout(function(){ve(!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}})}))]})),n(d,e({ref:on,onScroll:Rt,sx:{flex:1,minHeight:0,pt:1.5,pb:1,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",overflowY:ue?"hidden":"auto",borderTop:On&&Ln?"none":"1.5px solid #EEF0F4"}},{children:n(d,e({sx:e({display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"},ue?{flex:1,minHeight:0}:{})},{children:t(d,e({ref:Gn,sx:e({display:"grid",gridTemplateColumns:"minmax(0, 1fr) 180px minmax(0, 1fr)",gap:"10px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0},ue?{flex:1,overflow:"visible"}:{})},{children:[t("svg",e({ref:Ae,style:{position:"absolute",top:0,left:0,width:Ge.width||"100%",height:Ge.height||"100%",pointerEvents:"none",zIndex:10,overflow:"visible",transition:"opacity 0.15s ease-in-out"}},{children:[ct&&t("g",{children:[n("line",{x1:ct.x1,y1:ct.y,x2:Math.max(ct.x1,(ct.x1+ct.x2)/2-70),y2:ct.y,stroke:"#BBF7D0",strokeWidth:"1.5"}),n("line",{x1:Math.min(ct.x2,(ct.x1+ct.x2)/2+70),y1:ct.y,x2:ct.x2,y2:ct.y,stroke:"#BBF7D0",strokeWidth:"1.5"})]}),nt.map(function(i){var r,o=(i.x1+i.x2)/2;if("Not Defined"===i.style.label&&!i.hasCognitive)return null;if(!ue)return t("g",{children:[n("line",{x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2,stroke:i.style.badgeBorder||"#E2E8F0",strokeWidth:"1.5"}),n("foreignObject",e({x:o-100,y:i.y1-14,width:"200",height:"28",style:{pointerEvents:"auto",overflow:"visible"}},{children:n(d,e({sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},{children:t(d,e({onClick:function(e){if(e.stopPropagation(),$e.open&&Re===i.id)pn();else{var n=Wn[i.sectionIdx]||{title:"",content:""},t=zn[i.sectionIdx]||{title:"",content:""};if(i.isSubSection&&i.subSectionKeyPath){for(var r=i.subSectionKeyPath.split("-").map(Number),o=Wn[r[0]],l=zn[r[0]],c=1;c<r.length;c++)(null==o?void 0:o.subsections)&&(o=o.subsections[r[c]]),(null==l?void 0:l.subsections)&&(l=l.subsections[r[c]]);o&&(n=o),l&&(t=l)}Te(i.id),qn(Vn(e.currentTarget,n,t,i.sectionIdx,i.style))}},sx:{display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",bgcolor:i.style.badgeBg,color:i.style.badgeText,border:"1px solid ".concat(i.style.badgeBorder),borderRadius:"12px",px:1.5,py:.5,fontWeight:500,textAlign:"center",whiteSpace:"nowrap",cursor:"pointer"}},{children:[i.style.label,n(d,e({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:n(S,{})})),n(y,{size:11,style:{transform:$e.open&&Re===i.id?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))}))]},i.id);var l=Wn[i.sectionIdx];return!(null===(r=null==l?void 0:l.refIndexes)||void 0===r?void 0:r.length)||(null==l?void 0:l.selfIndex)<0?null:be&&rt===i.sectionIdx&&Ie?t("g",e({style:{transition:"opacity 0.2s"}},{children:[n("defs",{children:n("marker",e({id:"arr-".concat(i.id),markerWidth:"7",markerHeight:"5",refX:"7",refY:"2.5",orient:"auto"},{children:n("polygon",{points:"0 0, 7 2.5, 0 5",fill:i.style.badgeBorder||"#6366F1"})}))}),n("line",{ref:Qn,x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2,stroke:i.style.badgeBorder||"#6366F1",strokeWidth:"1.5",markerEnd:"url(#arr-".concat(i.id,")")})]}),i.id):null}),De.map(function(i){var r,o=i.pathD,l=(null===(r=i.style)||void 0===r?void 0:r.badgeBorder)||"#6366F1",c="conn-marker-".concat(i.id),u="".concat(i.id,"-bg"),a="".concat(i.id,"-stroke");return t("g",{children:[n("defs",{children:n("clipPath",e({id:"connections-clip"},{children:n("marker",e({id:c,markerWidth:"8",markerHeight:"6",refX:"7",refY:"3",orient:"auto"},{children:n("polygon",{points:"0 0, 8 3, 0 6",fill:l})}))}))}),n("path",{ref:function(e){Ne.current[u]=e},d:o,fill:"none",stroke:"#FFFFFF",strokeWidth:"4",strokeOpacity:"0.7"}),n("path",{ref:function(e){Ne.current[a]=e},d:o,fill:"none",stroke:l,strokeWidth:"1.75",markerEnd:"url(#".concat(c,")")})]},i.id)})]})),t(d,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)"},ue?{flex:1,overflow:"visible"}:{})},{children:[n(d,e({ref:Zn,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E7E7E9",borderRadius:"8px 8px 0 0",display:"flex",minHeight:"40px",alignItems:"center",overflowX:"hidden"}},{children:n(p,e({title:Hn,placement:"top"},{children:n(a,e({sx:{fontSize:"16px",fontWeight:500,color:"#19213D",overflow:"hidden",display:"flex",alignItems:"center",justifyContent:"center",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",height:"40px"}},{children:Hn}))}))})),t(d,e({ref:vn,onScroll:Rt,sx:e({p:"12px",display:"flex",flexDirection:"column"},ue?{maxHeight:"calc(100vh - 150px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,mr:"-160px",pr:"172px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[n("div",{ref:dn,style:{width:"100%",height:"0px",flexShrink:0}}),Nn&&Wn.map(function(r,o){var l,c,u,a=!r.title&&!r.content;if(ue&&a)return null;if(!ue)return n(d,e({ref:Kn(o)},{children:kt({section:r,idx:o,columnKey:"left",colRef:vt.current[o],parentNodeId:(null===(l=null==Q?void 0:Q.input_index_map)||void 0===l?void 0:l[0])||""})}),"left-row-".concat(o));var s=r,v=St(o),f=!(null===(c=s.refIndexes)||void 0===c?void 0:c.length)||s.selfIndex<0,h="number"==typeof s.selfIndex&&s.selfIndex>=0?s.selfIndex+1:null,p=ke.has(o);return n(d,e({ref:Kn(o),sx:{mb:1}},{children:t(d,e({sx:{position:"relative",width:"100%"}},{children:[n(d,e({ref:vt.current[o],sx:e({width:"100%",display:"flex"},p&&{borderRadius:"6px",outline:"2px solid ".concat((null==v?void 0:v.badgeBorder)||"#6366F1"),outlineOffset:"1px"})},{children:kt({section:r,idx:o,columnKey:"left",colRef:i.createRef(),mb:0,parentNodeId:(null===(u=null==Q?void 0:Q.input_index_map)||void 0===u?void 0:u[0])||""})})),v&&t(d,e({ref:ht.current[o],onClick:function(e){var n=zn.find(function(e){var n;return null===(n=s.refIndexes)||void 0===n?void 0:n.includes(e.selfIndex)})||{title:"",content:""};!function(e,n,t,i,r){e.stopPropagation(),tn.open&&tn.sectionIdx===i?gn():(pn(),rn(Vn(e.currentTarget,n,t,i,r)))}(e,r,n,o,v)},sx:{position:"absolute",top:"18px",right:0,transform:"translateY(-50%) translateX(calc(100% + 8px))",display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",bgcolor:v.badgeBg,color:v.badgeText,border:"1px solid ".concat(v.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!==h&&n(d,e({component:"span",sx:{fontSize:"11px",fontWeight:700,pr:.5,borderRight:"1px solid ".concat(v.badgeBorder)}},{children:h})),n(d,e({component:"span",sx:{fontSize:"11px",px:.25}},{children:f?"No Deviation Found":0==v.deviationLabel||void 0===v.deviationLabel?"Same":"".concat(v.deviationLabel,"% Deviation")})),n(b,{size:11,color:v.badgeText})]}))]}))}),"left-row-".concat(o))}),n("div",{ref:sn,style:{width:"100%",height:"0px",flexShrink:0}})]}))]})),n(d,e({sx:{width:"180px",display:"flex",flexDirection:"column",alignItems:"center",pt:"15px",gap:0}},{children:n(d,e({sx:{display:"flex",justifyContent:"center",alignItems:"center",mt:0}},{children:t(d,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:[n(d,e({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:n(S,{})})),0,"% Similarity",n(y,{size:11})]}))}))})),t(d,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},ue?{flex:1,overflow:"visible",minHeight:0}:{})},{children:[he&&n(w,{sections:11}),n(d,e({ref:$n,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E3E6EA",borderRadius:"8px 8px 0 0",minHeight:"40px",display:"flex",alignItems:"center",overflowX:"hidden"}},{children:n(p,e({title:An,placement:"top"},{children:n(a,e({sx:{fontSize:"16px",fontWeight:500,color:"#5928ED",overflow:"hidden",display:"flex",justifyContent:"center",alignItems:"center",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",height:"40px"}},{children:An}))}))})),t(d,e({ref:cn,onScroll:Rt,sx:e({p:"12px",display:"flex",flexDirection:"column"},ue?{maxHeight:"calc(100vh - 150px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,ml:"-20px",pl:"40px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[n("div",{ref:un,style:{width:"100%",height:"0px",flexShrink:0}}),Nn&&zn.map(function(r,o){var l,c;if(!ue)return kt({section:r,idx:o,columnKey:"right",colRef:ft.current[o],parentNodeId:(null===(l=null==Q?void 0:Q.input_index_map)||void 0===l?void 0:l[1])||""});var u=r,a=Wn.filter(function(e){var n;return(null===(n=e.refIndexes)||void 0===n?void 0:n.includes(u.selfIndex))&&e.selfIndex>=0}).map(function(e){return e.selfIndex+1}),s=Wn.some(function(e,n){var t;return ke.has(n)&&(null===(t=e.refIndexes)||void 0===t?void 0:t.includes(u.selfIndex))}),v=Wn.findIndex(function(e,n){var t;return ke.has(n)&&(null===(t=e.refIndexes)||void 0===t?void 0:t.includes(u.selfIndex))}),f=-1!==v?St(v):null;return n(d,e({ref:gt.current[o],sx:{mb:1}},{children:t(d,e({sx:{position:"relative",width:"100%"}},{children:[n(d,e({ref:ft.current[o],sx:e({width:"100%",display:"flex"},s&&f&&{borderRadius:"6px",outline:"2px solid ".concat(f.badgeBorder),outlineOffset:"1px"})},{children:kt({section:r,idx:o,columnKey:"right",colRef:i.createRef(),mb:0,parentNodeId:(null===(c=null==Q?void 0:Q.input_index_map)||void 0===c?void 0:c[1])||""})})),!he&&n(d,e({ref:pt.current[o],sx:{position:"absolute",top:"18px",left:0,transform:"translateY(-50%) translateX(calc(-100% - 8px))",display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:"11px",bgcolor:"#EEF2FF",color:"#3730A3",border:"1px solid #C7D2FE",borderRadius:"10px",px:1,py:.3,fontWeight:700,whiteSpace:"nowrap",zIndex:20}},{children:a.length>0?a.join(", "):"-"}))]}))}),"right-row-".concat(o))}),n("div",{ref:an,style:{width:"100%",height:"0px",flexShrink:0}})]}))]}))]}))}))}))]}))};export{P as default};
|
|
2
2
|
//# sourceMappingURL=CognitiveCompare.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CognitiveCompare.d.ts","sourceRoot":"","sources":["../../../../../src/features/CognitiveCompare/CognitiveCompare.tsx"],"names":[],"mappings":"AAgCA,OAAO,EAIL,qBAAqB,EAOtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAGL,sBAAsB,EACvB,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"CognitiveCompare.d.ts","sourceRoot":"","sources":["../../../../../src/features/CognitiveCompare/CognitiveCompare.tsx"],"names":[],"mappings":"AAgCA,OAAO,EAIL,qBAAqB,EAOtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAGL,sBAAsB,EACvB,MAAM,0BAA0B,CAAC;AA0XlC,QAAA,MAAM,gBAAgB,+JAUnB,qBAAqB,4CAqvFvB,CAAC;AAEF,OAAO,EAAE,sBAAsB,EAAE,CAAC;AAClC,eAAe,gBAAgB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CognitiveCompareTypes.d.ts","sourceRoot":"","sources":["../../../../../src/features/CognitiveCompare/CognitiveCompareTypes.ts"],"names":[],"mappings":"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
|
|
1
|
+
{"version":3,"file":"CognitiveCompareTypes.d.ts","sourceRoot":"","sources":["../../../../../src/features/CognitiveCompare/CognitiveCompareTypes.ts"],"names":[],"mappings":";AAEA,MAAM,WAAW,uBAAuB;IACtC,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE;QACX,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;QACvB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;KACxB,CAAC;CACH;AAED,MAAM,WAAW,kBAAkB;IACjC,0BAA0B,EAAE;QAC1B,OAAO,EAAE;YACP,aAAa,EAAE,MAAM,CAAC;YACtB,eAAe,EAAE,MAAM,CAAC;SACzB,CAAC;QACF,MAAM,EAAE;YACN,CAAC,GAAG,EAAE,MAAM,GACV,uBAAuB,GACvB;gBAAE,KAAK,EAAE,MAAM,CAAC;gBAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAA;aAAE,CAAC;SAC1D,CAAC;KACH,CAAC;CACH;AAED,MAAM,WAAW,kBAAkB;IACjC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,qBAAqB,CAAC,EAAE,MAAM,EAAE,CAAC;IACjC,kBAAkB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5C,qBAAqB,CAAC,EAAE;QACtB,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;QAC/B,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;QAC5B,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;KACjC,CAAA;IACD,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAClC;AAED,MAAM,WAAW,yBAAyB;IACxC,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAChC,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACjC;AAED,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,kBAAkB,CAAC;IAC9B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE;QACT,EAAE,CAAC,EAAE,MAAM,CAAC;QACZ,KAAK,EAAE,MAAM,CAAC;QACd,OAAO,EAAE,MAAM,CAAC;QAChB,WAAW,CAAC,EAAE,YAAY,EAAE,CAAC;QAC7B,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,uBAAuB,CAAC,EAAE,MAAM,CAAC;QACjC,aAAa,CAAC,EAAE,yBAAyB,CAAC;KAC3C,EAAE,CAAC;CACL;AAED,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;CACtC,CAAC;AACF,MAAM,MAAM,cAAc,GAAG;IAC3B,eAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,eAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,qBAAsB,CAAC,EAAE,OAAO,CAAC;CAClC,CAAA;AACD,MAAM,WAAW,qBAAqB;IACpC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;IACtC,gBAAgB,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAC7C,WAAW,CAAC,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACpE,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,YAAY,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IACrD,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,cAAc,CAAC,EAAE,KAAK,CAAC,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAE3D,aAAa,EAAE,cAAc,CAAC;IAC9B,WAAW,CAAC,EAAE,oBAAoB,CAAC;IACnC,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACrC;AAED,MAAM,MAAM,YAAY,GAAG;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,IAAI,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;AAE7D,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,EAAE,eAAe,EAAE,CAAC;IAC1B,UAAU,EAAE;QACV,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,cAAc,EAAE;QACd,SAAS,EAAE,kBAAkB,CAAC;QAC9B,IAAI,EAAE,kBAAkB,CAAC;QACzB,KAAK,EAAE,kBAAkB,CAAC;QAC1B,MAAM,EAAE,kBAAkB,CAAC;QAC3B,GAAG,EAAE,kBAAkB,CAAC;KACzB,CAAC;CACH,CAAC;AAGF,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,qBAAqB,EAAE,MAAM,CAAC;IAC9B,aAAa,EAAE,yBAAyB,GAAG,IAAI,CAAC;IAChD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,WAAW,GAAG,IAAI,CAAC;IAC7B,eAAe,EAAE,WAAW,GAAG,IAAI,CAAC;IACpC,iBAAiB,EAAE,WAAW,GAAG,IAAI,CAAC;IACtC,WAAW,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;IACjC,UAAU,CAAC,EAAE,YAAY,GAAG,IAAI,CAAC;IACjC,aAAa,CAAC,EAAE,GAAG,CAAC;IACpB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IAC1C,QAAQ,EAAE,aAAa,GAAG,IAAI,CAAC;IAC/B,cAAc,CAAC,EAAE,KAAK,CAAC,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC3D,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;IACrC,aAAa,CAAC,EAAE,kBAAkB,GAAG,IAAI,CAAC;CAC3C;AAED,MAAM,MAAM,YAAY,GAAG;IACvB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,YAAY,EAAE,CAAC;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,aAAa,CAAC,EAAE,yBAAyB,CAAC;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,gBAAgB,CAAC,EAAE,kBAAkB,CAAC;IACtC,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,CAAC;AAEJ,MAAM,MAAM,iBAAiB,GAAG;IAC5B,IAAI,EAAE,OAAO,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB,aAAa,EAAE,yBAAyB,GAAG,IAAI,CAAC;IAChD,QAAQ,EAAE,WAAW,GAAG,IAAI,CAAC;IAC7B,eAAe,EAAE,WAAW,GAAG,IAAI,CAAC;IACpC,UAAU,EAAE,YAAY,GAAG,IAAI,CAAC;IAChC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;IACpC,aAAa,CAAC,EAAE,kBAAkB,GAAG,IAAI,CAAC;CAC7C,CAAC;AAEF,MAAM,MAAM,GAAG,GAAG;IAChB,IAAI,CAAC,EAAE,YAAY,CAAA;IACnB,KAAK,CAAC,EAAE,YAAY,CAAA;CACrB,CAAA;AAID,MAAM,WAAW,oBAAoB;IACnC,IAAI,CAAC,EAAE;QACL,SAAS,CAAC,EAAE;YACV,KAAK,CAAC,EAAE,MAAM,CAAC;YACf,QAAQ,CAAC,EAAE,MAAM,CAAC;YAClB,gBAAgB,CAAC,EAAE,MAAM,CAAC;YAC1B,eAAe,CAAC,EAAE,MAAM,CAAC;SAC1B,CAAC;QACF,WAAW,CAAC,EAAE;YACZ,KAAK,CAAC,EAAE,MAAM,CAAC;YACf,QAAQ,CAAC,EAAE,MAAM,CAAC;SACnB,CAAC;KACH,CAAC;IACF,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,aAAa,CAAC,EAAE;QACd,kBAAkB,CAAC,EAAE,MAAM,CAAC;QAC5B,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,CAAC;IACF,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB"}
|