@viswa-test/test-citation 0.0.23 → 0.0.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/features/CognitiveCompare/CognitiveCompare.js +1 -1
- package/dist/features/CognitiveCompare/CognitiveCompare.js +1 -1
- package/dist/types/src/CommonConstants/CommonConstants.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/CognitiveCompare.d.ts +1 -1
- package/dist/types/src/features/CognitiveCompare/CognitiveCompare.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("react-markdown"),s=require("./CognitiveComparehelpers.js"),a=require("./CognitiveCompareConfig.js"),c=require("./CognitivePopup.js"),u=require("./MoreFunctionsPopup.js");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var f=d(t),x=d(l),p={id:"",title:""},v={open:!1,sectionTitle:"",refSectionTitle:"",cognitiveData:null,anchorEl:null,sectionAnchorEl:null,badgeStyle:null,sectionIdx:null,docData:null};exports.SHARED_MARKDOWN_STYLES=a.SHARED_MARKDOWN_STYLES,exports.default=function(l){var d,g,h,_,m,y,b,S,F=l.componentHeaderText,E=void 0===F?"Learning Comparison":F,w=l.treeData,I=l.comparisonConfig,j=l.leftColumnTitleText,C=l.rightColumnTitleText,R=l.markdownStyles,B=l.maintainRelativeOrder,T=void 0!==B&&B,D=l.popupConfig,A=t.useState(null),k=A[0],O=A[1],M=t.useState(!1),N=M[0],L=M[1],z=t.useState(!1),H=z[0],W=z[1],P=t.useRef(!1),q=t.useMemo(function(){return(null==w?void 0:w.cognitive_decisioning)||{}},[w]),V=t.useState(null),U=V[0],G=V[1],Y=t.useRef(null),X=t.useState({width:0,height:0}),K=X[0],J=X[1],Q=t.useMemo(function(){return e.__assign(e.__assign({},a.SHARED_MARKDOWN_STYLES),R)},[R]),Z=t.useState({open:!1,sectionTitle:"",refSectionTitle:"",cognitiveData:null,anchorEl:null,sectionAnchorEl:null,badgeStyle:null,sectionIdx:null,docData:null}),$=Z[0],ee=Z[1],ne=t.useState({open:!1,sectionTitle:"",refSectionTitle:"",cognitiveData:null,anchorEl:null,sectionAnchorEl:null,badgeStyle:null,sectionIdx:null,docData:null}),te=ne[0],ie=ne[1],re=t.useRef(null),oe=t.useRef(null),le=t.useRef(!1),se=t.useRef(null);t.useEffect(function(){se.current=null},[$.sectionIdx,$.open]);var ae=t.useCallback(function(){G(null),ee(v)},[]),ce=t.useCallback(function(){ie(v)},[]),ue=t.useCallback(function(){var e;if($.anchorEl&&$.refSectionTitle){var n=$.anchorEl.getBoundingClientRect(),t=(null===(e=null==Y?void 0:Y.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!==se.current?!0===se.current&&(l=o>=t||o>=r):l=!(r>=t||r>=o),se.current=l;var s=l?o:r,a=Math.min(t||9999,s),c=l?n.top-12-a:n.bottom+12,u=n.left+n.width/2,d=u-i/2,f=Math.max(12,Math.min(d,window.innerWidth-i-12)),x=Math.max(14,Math.min(u-f,i-10-4));G({top:c,left:f,arrowLeft:x,openAbove:l,maxHeight:s})}},[$.anchorEl,$.refSectionTitle]);t.useEffect(function(){if($.open){window.addEventListener("resize",ue);var e=requestAnimationFrame(ue),n=null;return Y.current&&(n=new ResizeObserver(function(){cancelAnimationFrame(e),e=requestAnimationFrame(ue)})).observe(Y.current),function(){cancelAnimationFrame(e),window.removeEventListener("resize",ue),n&&n.disconnect()}}},[$.open,ue]),t.useEffect(function(){var e=re.current;if(e&&$.open){var n=function(e){Y.current&&Y.current.contains(e.target)||(G(null),ae())};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})}}},[$.open,ae]),t.useEffect(function(){var e=re.current;if(e&&te.open){var n=function(){ce()};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,ce]);var de=t.useMemo(function(){var n,t,i,r,o,l,s,c,u,d,f,x;return{fields:null!==(n=null==I?void 0:I.fields)&&void 0!==n?n:a.DEFAULT_FIELD_CONFIG,thresholds:{high:null!==(i=null===(t=null==I?void 0:I.thresholds)||void 0===t?void 0:t.high)&&void 0!==i?i:a.DEFAULT_COMPARISON_CONFIG.thresholds.high,medium:null!==(o=null===(r=null==I?void 0:I.thresholds)||void 0===r?void 0:r.medium)&&void 0!==o?o:a.DEFAULT_COMPARISON_CONFIG.thresholds.medium,exact:null!==(s=null===(l=null==I?void 0:I.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==I?void 0:I.relationStyles)||void 0===c?void 0:c.noContent)||{}),high:e.__assign(e.__assign({},a.DEFAULT_COMPARISON_CONFIG.relationStyles.high),(null===(u=null==I?void 0:I.relationStyles)||void 0===u?void 0:u.high)||{}),exact:e.__assign(e.__assign({},a.DEFAULT_COMPARISON_CONFIG.relationStyles.exact),(null===(d=null==I?void 0:I.relationStyles)||void 0===d?void 0:d.exact)||{}),medium:e.__assign(e.__assign({},a.DEFAULT_COMPARISON_CONFIG.relationStyles.medium),(null===(f=null==I?void 0:I.relationStyles)||void 0===f?void 0:f.medium)||{}),low:e.__assign(e.__assign({},a.DEFAULT_COMPARISON_CONFIG.relationStyles.low),(null===(x=null==I?void 0:I.relationStyles)||void 0===x?void 0:x.low)||{})}}},[I]),fe=t.useMemo(function(){if(w&&Object.keys(w).length>0)try{var n=function(n,t){var i,r,o,l,a,c,u,d;void 0===t&&(t=!1);var f=[],x=[],p=n.base_root_id,v=n.input_index_map||{0:"left",1:"right"},g=n[p];if(!g||!1===g.display_node)return{activeProposed:{title:"No Data",sections:[]},activeVariants:[]};var h=function(t,i){var r=n[t];if(!r)return null;var o=s.getSideData(r,i,v),l=!!o.title.trim(),a=!!o.content.trim(),c=s.getRationale(r),u=[];r.next&&Object.values(r.next).forEach(function(e){if(n[e]){var t=h(e,i);t&&u.push(t)}});var d=!(!l&&!a);return e.__assign({id:t,title:l?o.title:"",content:a?o.content:"",subsections:u},d?c:{score:void 0,relation:"not_defined"})};if(t){var _={},m={},y=-1,b=-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=s.getRationale(F),w=s.getSideData(F,"0",v),I=s.getSideData(F,"1",v),j=w.title.trim()||w.content.trim(),C=I.title.trim()||I.content.trim(),R=Number(null!==(r=null===(i=w.attributes)||void 0===i?void 0:i.display_index)&&void 0!==r?r:y--),B=Number(null!==(l=null===(o=I.attributes)||void 0===o?void 0:o.display_index)&&void 0!==l?l:b--),T=m[B]||e.__assign(e.__assign({id:S,title:C?I.title:"",content:C?I.content:"",subsections:[]},C?E:{score:void 0,relation:"not_defined"}),{refIndexes:[],selfIndex:B}),D=_[R]||e.__assign(e.__assign({id:S,title:j?w.title:"",content:j?w.content:"",subsections:[]},j?E:{score:void 0,relation:"not_defined"}),{refIndexes:[],selfIndex:R});Number(B)>=0&&Number(R)>=0&&(T.refIndexes.includes(Number(R))||T.refIndexes.push(Number(R)),D.refIndexes.includes(Number(B))||D.refIndexes.push(Number(B))),m[B]=T,_[R]=D}}x=Object.values(m).map(function(e){return e}),f=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}),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 g.next&&Object.values(g.next).forEach(function(e){var t=n[e];t&&!1!==t.display_node&&(f.push(h(e,"0")||{id:e,title:"",content:"",subsections:[]}),x.push(h(e,"1")||{id:e,title:"",content:"",subsections:[]}))});return{activeProposed:{title:(null===(c=null===(a=g.comparison_inputs)||void 0===a?void 0:a[v[0]])||void 0===c?void 0:c.title)||"Uploaded Contract",description:g.decision_scope_description||"",sections:f},activeVariants:[{id:"tree-variant-1",title:(null===(d=null===(u=g.comparison_inputs)||void 0===u?void 0:u[v[1]])||void 0===d?void 0:d.title)||"Reference Template",similarity:0,sections:x,analysis:{rule_difference_comparison:{summary:{overall_score:0,overall_summary:g.decision_scope_description||""},fields:{}}}}]}}(w,T);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"}},[w,T]),xe=fe.activeProposed,pe=fe.activeVariants,ve=fe.parseError;t.useEffect(function(){ve&&O("Failed to load comparison: ".concat(ve))},[ve]);var ge=t.useState(null),he=ge[0];ge[1];var _e=t.useState({}),me=_e[0],ye=_e[1],be=t.useState({}),Se=be[0],Fe=be[1],Ee=(null==pe?void 0:pe[0])||p,we=null===(h=null===(d=null==w?void 0:w.documents)||void 0===d?void 0:d[null===(g=null==w?void 0:w.input_index_map)||void 0===g?void 0:g[0]])||void 0===h?void 0:h.title,Ie=null===(y=null===(_=null==w?void 0:w.documents)||void 0===_?void 0:_[null===(m=null==w?void 0:w.input_index_map)||void 0===m?void 0:m[1]])||void 0===y?void 0:y.title,je=s.safeStringify(j||we||"Uploaded Contract"),Ce=s.safeStringify(C||Ie||"Reference Template"),Re=t.useMemo(function(){return(null==xe?void 0:xe.sections)||[]},[null==xe?void 0:xe.sections]),Be=t.useMemo(function(){return Ee.sections||[]},[Ee.sections]),Te=Re.length>0||Be.length>0,De=Ee.analysis,Ae=s.safeStringify(null===(S=null===(b=null==De?void 0:De.rule_difference_comparison)||void 0===b?void 0:b.summary)||void 0===S?void 0:S.overall_summary),ke=!!Ae.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),Oe=t.useRef({}),Me=function(e){return Oe.current[e]||(Oe.current[e]=f.default.createRef()),Oe.current[e]},Ne=t.useCallback(function(e,n,t,i,r){var o,l,a=s.safeStringify(n.id)||s.safeStringify(t.id)||"",c=(a?q[a]:null)||n.cognitiveData||t.cognitiveData||{section_id:a,decisioning:[],gap:[],relevance_score:0},u=null!==(l=null===(o=Oe.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:c,anchorEl:e,sectionAnchorEl:u,badgeStyle:r||null,sectionIdx:i,docData:{documents:null==w?void 0:w.documents,input_index_map:null==w?void 0:w.input_index_map}}},[q]),Le=t.useCallback(function(e){ce(),G(null),ee(e)},[ce]),ze=t.useCallback(function(){null!==te.sectionIdx&&te.anchorEl?Le(e.__assign(e.__assign({},te),{open:!0})):ce()},[te,ce,Le]);t.useCallback(function(e){ce(),O("".concat(e," is coming soon."))},[ce]);var He=t.useRef(null),We=t.useRef(null),Pe=t.useRef(null),qe=t.useState([]),Ve=qe[0],Ue=qe[1],Ge=t.useState(null),Ye=Ge[0],Xe=Ge[1],Ke=t.useRef(null),Je=t.useState(null),Qe=Je[0],Ze=Je[1],$e=t.useCallback(function(){var e=te.sectionIdx;ce(),null!==e&&(N&&Ye===e?(L(!1),Xe(null),W(!1)):(P.current=!0,Xe(e),L(!0),W(!1),setTimeout(function(){var n,t=null===(n=Oe.current[e])||void 0===n?void 0:n.current;t&&t.scrollIntoView({behavior:"smooth",block:"center"})},50),setTimeout(function(){W(!0),P.current=!1},600)))},[ce,te.sectionIdx,N,Ye]),en=t.useMemo(function(){return de.fields.filter(function(e){var n=e.key;return(!Te||"description"!==n)&&(s.hasValue(null==xe?void 0:xe[n])||s.hasValue(Ee[n]))})},[xe,Ee,Te,de.fields]),nn=t.useRef({}),tn=t.useRef({}),rn=t.useRef({}),on=t.useRef({}),ln=t.useRef({}),sn=t.useRef({}),an=t.useRef({});en.forEach(function(e){for(var n=e.key,t=0;t<Math.max(Re.length,Be.length);t+=1)rn.current[t]||(rn.current[t]=f.default.createRef()),on.current[t]||(on.current[t]=f.default.createRef()),ln.current[t]||(ln.current[t]=f.default.createRef()),sn.current[t]||(sn.current[t]=f.default.createRef()),an.current[t]||(an.current[t]=f.default.createRef());nn.current[n]||(nn.current[n]=f.default.createRef()),tn.current[n]||(tn.current[n]=f.default.createRef())});for(var cn=0;cn<Math.max(Re.length,Be.length);cn+=1)rn.current[cn]||(rn.current[cn]=f.default.createRef()),on.current[cn]||(on.current[cn]=f.default.createRef()),ln.current[cn]||(ln.current[cn]=f.default.createRef()),sn.current[cn]||(sn.current[cn]=f.default.createRef()),an.current[cn]||(an.current[cn]=f.default.createRef());t.useEffect(function(){if(he){var e=de.fields.find(function(e){return e.analysisKey===he||e.key===he});if(e){var n=nn.current[e.key]||tn.current[e.key];(null==n?void 0:n.current)&&setTimeout(function(){return n.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[he,de.fields]);var un=t.useCallback(function(e){var n,t,i,r,o,l,s,a,c,u=null===(n=null==De?void 0:De.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 x=d.mappings[0]||{};return{score:d.score,relation:x.relation||"",highlightsA:(null===(l=x.highlights)||void 0===l?void 0:l.ruleA_spans)||[],highlightsB:(null===(s=x.highlights)||void 0===s?void 0:s.ruleB_spans)||[],hasContent:!!f}}return{score:d.score,relation:d.relation||"",highlightsA:(null===(a=d.highlights)||void 0===a?void 0:a.ruleA_spans)||[],highlightsB:(null===(c=d.highlights)||void 0===c?void 0:c.ruleB_spans)||[],hasContent:!!f}},[De]),dn=t.useCallback(function(n){var t,i,r,o,l=Re[n],a=Be[n],c=(null==l?void 0:l.relation)&&"not_defined"!==l.relation,u=(null==a?void 0:a.relation)&&"not_defined"!==a.relation,d=s.safeStringify(null==l?void 0:l.id)||s.safeStringify(null==a?void 0:a.id)||"",f=!(!(null==l?void 0:l.cognitiveData)&&!(null==a?void 0:a.cognitiveData));if(!c&&!u&&!f)return e.__assign(e.__assign({},de.relationStyles.noContent),{label:"Not Defined"});var x=un("description");if(null!=(null!==(i=null!==(t=null==l?void 0:l.cognitiveRelevanceScore)&&void 0!==t?t:null==a?void 0:a.cognitiveRelevanceScore)&&void 0!==i?i:d?null===(r=q[d])||void 0===r?void 0:r.relevance_score:void 0)){var p=s.cognitiveScoreToRelation(),v=p.score,g=p.relation;return s.getStyleForRelation(v,g,!0,de)}var h=c?l.relation:u?a.relation:x.relation,_=null!==(o=null==l?void 0:l.score)&&void 0!==o?o:null==a?void 0:a.score,m="number"==typeof _?_:x.score;return s.getStyleForRelation(m,h,!0,de)},[Re,Be,q,de,un]),fn=t.useCallback(function(){var e,n,t,i,r,o,l,a,c,u,d,f,x;if(!le.current){le.current=!0;try{if(!He.current)return;if(Object.values(Oe.current).forEach(function(e){e.current&&(e.current.style.paddingTop="0px",e.current.style.marginTop="0px")}),Object.values(an.current).forEach(function(e){e.current&&(e.current.style.paddingTop="0px",e.current.style.marginTop="0px")}),T&&N&&null!==Ye){var p=Re[Ye],v=(null==p?void 0:p.refIndexes)||[];if(v.length>0){var g=v[0],h=Be.findIndex(function(e){return e.selfIndex===g});if(-1!==h){var _=null===(e=Oe.current[Ye])||void 0===e?void 0:e.current,m=null===(n=an.current[h])||void 0===n?void 0:n.current;if(_&&m){var y=_.getBoundingClientRect().top-m.getBoundingClientRect().top;if(m.style.transition="padding-top 0.3s ease-in-out",y>1)m.style.paddingTop="".concat(y,"px");else if(y<-1){var b=m.parentElement;b&&(P.current=!0,b.scrollTo({top:b.scrollTop+Math.abs(y),behavior:"smooth"}),setTimeout(function(){P.current=!1},400))}}}}}var S=He.current.getBoundingClientRect();J({width:S.width,height:S.height});var F=[];if(en.forEach(function(e){var n,t,i=e.key,r=null===(n=nn.current[i])||void 0===n?void 0:n.current,o=null===(t=tn.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")}),!T)for(var E=0;E<Math.min(Re.length,Be.length);E++){var w=null===(t=rn.current[E])||void 0===t?void 0:t.current,I=null===(i=on.current[E])||void 0===i?void 0:i.current;w&&I&&(w.style.height="auto",I.style.height="auto",w.style.minHeight="0px",I.style.minHeight="0px")}var j={};en.forEach(function(e){var n,t,i=e.key,r=null===(n=nn.current[i])||void 0===n?void 0:n.current,o=null===(t=tn.current[i])||void 0===t?void 0:t.current;if(r&&o){var l=r.getBoundingClientRect(),s=o.getBoundingClientRect();j[i]=Math.max(l.height,s.height)}});var C=[];if(!T)for(E=0;E<Math.min(Re.length,Be.length);E++){w=null===(r=rn.current[E])||void 0===r?void 0:r.current,I=null===(o=on.current[E])||void 0===o?void 0:o.current;if(w&&I){var R=w.getBoundingClientRect(),B=I.getBoundingClientRect();C[E]=Math.max(R.height,B.height)}}if(en.forEach(function(e){var n,t,i=e.key,r=null===(n=nn.current[i])||void 0===n?void 0:n.current,o=null===(t=tn.current[i])||void 0===t?void 0:t.current;if(r&&o){var l=j[i];r.style.minHeight="".concat(l,"px"),o.style.minHeight="".concat(l,"px")}}),!T)for(E=0;E<C.length;E++){w=null===(l=rn.current[E])||void 0===l?void 0:l.current,I=null===(a=on.current[E])||void 0===a?void 0:a.current;if(w&&I){var D=C[E];w.style.minHeight="".concat(D,"px"),I.style.minHeight="".concat(D,"px")}}if(en.forEach(function(e){var n,t,i=e.key,r=e.analysisKey,o=null===(n=nn.current[i])||void 0===n?void 0:n.current,l=null===(t=tn.current[i])||void 0===t?void 0:t.current;if(o&&l){var a=o.getBoundingClientRect(),c=l.getBoundingClientRect(),u=un(r),d=s.getStyleForRelation(u.score,u.relation,u.hasContent,de);if(!d)return;var f=a.top+a.height/2-S.top;F.push({id:"field-".concat(i),x1:a.right-S.left,y1:f,x2:c.left-S.left,y2:f,style:d})}}),T)Re.forEach(function(e,n){var t;(null===(t=rn.current[n])||void 0===t?void 0:t.current)&&(e.refIndexes||[]).forEach(function(e){var t,i,r=Be.findIndex(function(n){return n.selfIndex===e});if(-1!==r){var o=null===(t=ln.current[n])||void 0===t?void 0:t.current,l=null===(i=sn.current[r])||void 0===i?void 0:i.current;if(o&&l){var s=o.getBoundingClientRect(),a=l.getBoundingClientRect(),c=s.right-S.left,u=a.left-S.left,d=s.top+s.height/2-S.top,f=a.top+a.height/2-S.top,x=dn(n);x&&F.push({id:"line-".concat(n,"-").concat(r),x1:c,y1:d,x2:u,y2:f,style:x,sectionIdx:n,targetRightIdx:r})}}})});else for(E=0;E<Math.min(Re.length,Be.length);E++){var A=null===(c=rn.current[E])||void 0===c?void 0:c.current,k=null===(u=on.current[E])||void 0===u?void 0:u.current;if(A&&k){var O=A.querySelector(".MuiAccordionSummary-root"),M=k.querySelector(".MuiAccordionSummary-root");if(O&&M){var L=O.getBoundingClientRect(),z=M.getBoundingClientRect(),H=(L.top+L.height/2-S.top+z.top+z.height/2-S.top)/2,W=(null===(d=Be[E])||void 0===d?void 0:d.id)||"sec-".concat(E),V=dn(E);V&&F.push({id:W,x1:L.right-S.left,y1:H,x2:z.left-S.left,y2:H,style:V,sectionIdx:E,hasCognitive:!!((null===(f=Re[E])||void 0===f?void 0:f.cognitiveData)||(null===(x=Be[E])||void 0===x?void 0:x.cognitiveData)||W&&q[W])})}}}if(Ue(F),We.current&&Pe.current){var U=We.current.getBoundingClientRect(),G=Pe.current.getBoundingClientRect(),Y=(U.top+U.height/2-S.top+G.top+G.height/2-S.top)/2;Ze({x1:U.right-S.left,x2:G.left-S.left,y:Y})}else Ze(null)}catch(e){console.error("Line render safe fail: ",e)}finally{le.current=!1}}},[en,Re,Be,q,de,un,dn,T,N,Ye,Se]),xn=t.useCallback(function(){null!==Ke.current&&window.cancelAnimationFrame(Ke.current),Ke.current=window.requestAnimationFrame(function(){fn(),Ke.current=null})},[fn]),pn=t.useCallback(function(){xn(),N&&!P.current&&(L(!1),Xe(null),W(!1))},[xn,N]);t.useEffect(function(){var e=setTimeout(xn,250);window.addEventListener("resize",xn);var n=null,t=null;return re.current&&(n=new ResizeObserver(xn)).observe(re.current),He.current&&(t=new ResizeObserver(xn)).observe(He.current),function(){clearTimeout(e),window.removeEventListener("resize",xn),null==n||n.disconnect(),null==t||t.disconnect()}},[xe,Ee,De,en,me,Re,Be,de,xn]);var vn=function(t,o,l,a,c){void 0===c&&(c=1);var u,d=T?!!me["".concat(l,"-").concat(o)]:!!me[String(o)],p=s.hasValue(t.title),v=s.hasValue(t.content),g=!p&&!v,h=t.title;return p||(h=v?"No Title Found":"No Matching Section Found"),n.jsx(i.Box,e.__assign({ref:a,sx:e.__assign(e.__assign({mb:c},T?{height:"fit-content"}:{minHeight:0}),{display:"flex",flexDirection:"column",position:"relative"})},{children:n.jsxs(i.Accordion,e.__assign({disableGutters:!0,expanded:!g&&d,onChange:function(){return!g&&function(n,t){ye(function(i){var r=e.__assign({},i);if(!T){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==(a=Re[n])?void 0:a.refIndexes)||[]).forEach(function(e){var n=Be.findIndex(function(n){return n.selfIndex===e});-1!==n&&(r["right-".concat(n)]=s)});else{var a,c=null==(a=Be[n])?void 0:a.selfIndex;Re.forEach(function(e,n){var t;(null===(t=e.refIndexes)||void 0===t?void 0:t.includes(c))&&(r["left-".concat(n)]=s)})}return r})}(o,l)},sx:{boxShadow:"none",border:g?"1px dashed #E2E8F0":"1px solid #E2E8F0",bgcolor:g?"#FAFAFA":"#FFFFFF",borderRadius:"6px",flex:1,display:"flex",flexDirection:"column","&:before":{display:"none"}}},{children:[n.jsx(i.AccordionSummary,e.__assign({expandIcon:g?null:n.jsx(r.ChevronDown,{size:16}),sx:{minHeight:"36px",flexShrink:0,cursor:g?"default":"pointer","& .MuiAccordionSummary-content":{my:.5,display:"flex",alignItems:"center",overflow:"hidden"},"& .MuiAccordionSummary-expandIconWrapper":{transition:"transform 0.2s ease"},"& .MuiAccordionSummary-expandIconWrapper.Mui-expanded":{transform:"rotate(180deg)"}}},{children:n.jsx(i.Tooltip,e.__assign({title:h,placement:"top"},{children:n.jsx(i.Typography,e.__assign({sx:{fontSize:"12px",color:g?"#94A3B8":"#19213D",fontWeight:g?400:700,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},{children:(u=h,u?s.safeStringify(u).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(f.default.Fragment,{children:e},t)}):null)}))}))})),!g&&n.jsxs(i.AccordionDetails,e.__assign({sx:{pt:0,pb:1.25,bgcolor:"#FFFFFF",flex:1,display:"flex",flexDirection:"column"}},{children:[n.jsx(i.Typography,e.__assign({component:"div",sx:Q},{children:n.jsx(x.default,{children:s.safeStringify(t.content).replace(/\\n/g,"\n")})})),(t.subsections||[]).map(function(e,n){return gn(e,"".concat(o,"-").concat(n),0)})]}))]}))}),"".concat(l,"-sec-").concat(o))},gn=function(t,o,l){void 0===l&&(l=0);var a=s.hasValue(t.title),c=s.hasValue(t.content),u=!a&&!c,d=a?t.title:c?"No Title Found":"No Matching Section Found",f=!!Se[o];return t.title?n.jsxs(i.Accordion,e.__assign({disableGutters:!0,expanded:!u&&f,onChange:function(){return!u&&Fe(function(n){var t;return e.__assign(e.__assign({},n),((t={})[o]=!n[o],t))})},sx:{mt:1,boxShadow:"none",border:u?"1px dashed #E2E8F0":"1px solid #EEF2F7",borderRadius:"4px !important",bgcolor:"#FFFFFF","&:before":{display:"none"}}},{children:[n.jsx(i.AccordionSummary,e.__assign({expandIcon:u?null:n.jsx(r.ChevronDown,{size:14}),sx:{minHeight:"32px","& .MuiAccordionSummary-content":{my:.5}}},{children:n.jsx(i.Typography,e.__assign({sx:{fontSize:"11px",fontWeight:600,color:u?"#94A3B8":"#19213D"}},{children:d||"Untitled Subsection"}))})),!u&&n.jsxs(i.AccordionDetails,e.__assign({sx:{pt:0,pb:1}},{children:[c&&n.jsx(i.Typography,e.__assign({component:"div",sx:Q},{children:n.jsx(x.default,{children:s.safeStringify(t.content).replace(/\\n/g,"\n")})})),(t.subsections||[]).map(function(e,n){return gn(e,"".concat(o,"-").concat(n),l+1)})]}))]}),o):n.jsx(i.Box,e.__assign({sx:{mt:0===l?1:.75}},{children:!u&&n.jsxs("div",{children:[c&&n.jsx(i.Typography,e.__assign({component:"div",sx:Q},{children:n.jsx(x.default,{children:s.safeStringify(t.content).replace(/\\n/g,"\n")})})),(t.subsections||[]).map(function(e,n){return gn(e,"".concat(o,"-").concat(n),l+1)})]})}),o)};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'},T?{}:{overflow:"visible"}),{position:"relative"})},{children:[T&&n.jsx(u.default,{open:te.open,anchorEl:te.anchorEl,sectionTitle:te.sectionTitle,referenceSectionTitle:te.refSectionTitle,onClose:ce,onOpenCognitiveCompare:ze,onOpenSideBySide:$e}),$.open&&n.jsx(c.default,{open:$.open,popupRef:Y,position:U,popupConfig:D,onClose:function(){G(null),ee(function(n){return e.__assign(e.__assign({},n),{open:!1})})},markdownStyles:R,sectionTitle:$.sectionTitle,referenceSectionTitle:$.refSectionTitle,cognitiveData:$.cognitiveData,anchorEl:$.anchorEl,sectionAnchorEl:$.sectionAnchorEl,scrollContainerEl:re.current,badgeStyle:$.badgeStyle,docData:$.docData}),n.jsx(i.Snackbar,e.__assign({open:!!k,autoHideDuration:8e3,onClose:function(){return O(null)},anchorOrigin:{vertical:"top",horizontal:"center"}},{children:n.jsx(i.Alert,e.__assign({onClose:function(){return O(null)},severity:"error",sx:{width:"100%",whiteSpace:"pre-line"}},{children:k}))})),n.jsx(i.Box,e.__assign({sx:{px:2,py:1,display:"flex",alignItems:"center",justifyContent:"space-between",bgcolor:"#FFFFFF",border:"1.5px solid #EEF0F4"}},{children:n.jsx(i.Box,e.__assign({sx:{display:"flex",alignItems:"center",gap:1}},{children:n.jsx(i.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:450,color:"#0F172A"}},{children:E}))}))})),n.jsx(i.Box,e.__assign({ref:re,onScroll:pn,sx:{flex:1,minHeight:0,pt:1.5,pb:8,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",overflowY:T?"hidden":"auto",borderTop:Ae&&ke?"none":"1.5px solid #EEF0F4"}},{children:n.jsx(i.Box,e.__assign({sx:e.__assign({display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"},T?{flex:1,minHeight:0}:{})},{children:n.jsxs(i.Box,e.__assign({ref:He,sx:e.__assign({display:"grid",gridTemplateColumns:"1fr auto 1fr",gap:"60px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0},T?{flex:1,overflow:"visible"}:{})},{children:[n.jsxs("svg",e.__assign({style:{position:"absolute",top:0,left:0,width:K.width||"100%",height:K.height||"100%",pointerEvents:"none",zIndex:10,overflow:"visible"}},{children:[Qe&&n.jsxs("g",{children:[n.jsx("line",{x1:Qe.x1,y1:Qe.y,x2:Math.max(Qe.x1,(Qe.x1+Qe.x2)/2-70),y2:Qe.y,stroke:"#BBF7D0",strokeWidth:"1.5"}),n.jsx("line",{x1:Math.min(Qe.x2,(Qe.x1+Qe.x2)/2+70),y1:Qe.y,x2:Qe.x2,y2:Qe.y,stroke:"#BBF7D0",strokeWidth:"1.5"})]}),Ve.map(function(t){var l,s=(t.x1+t.x2)/2;if("Not Defined"===t.style.label&&!t.hasCognitive)return null;if(!T)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){var n=Re[t.sectionIdx]||{title:"",content:""},i=Be[t.sectionIdx]||{title:"",content:""};Le(Ne(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})]}))}))}))]},t.id);var a=Re[t.sectionIdx];return!(null===(l=null==a?void 0:a.refIndexes)||void 0===l?void 0:l.length)||(null==a?void 0:a.selfIndex)<0?null:N&&Ye===t.sectionIdx&&H?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",{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})]})),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)"},T?{flex:1,overflow:"visible"}:{})},{children:[n.jsx(i.Box,e.__assign({ref:We,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:je,placement:"top"},{children:n.jsx(i.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:500,color:"#19213D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",height:"40px"}},{children:je}))}))})),n.jsx(i.Box,e.__assign({onScroll:pn,sx:e.__assign({p:"12px",display:"flex",flexDirection:"column"},T?{maxHeight:"500px",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,mr:"-160px",pr:"172px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:Te&&Re.map(function(t,o){var l;if(!T)return n.jsx(i.Box,e.__assign({ref:Me(o)},{children:vn(t,o,"left",rn.current[o])}),"left-row-".concat(o));var s=t,a=dn(o),c=!(null===(l=s.refIndexes)||void 0===l?void 0:l.length)||s.selfIndex<0,u="number"==typeof s.selfIndex&&s.selfIndex>=0?s.selfIndex+1:null;return n.jsx(i.Box,e.__assign({ref:Me(o),sx:{mb:1}},{children:n.jsxs(i.Box,e.__assign({sx:{position:"relative",width:"100%"}},{children:[n.jsx(i.Box,e.__assign({ref:rn.current[o],sx:{width:"100%"}},{children:vn(t,o,"left",f.default.createRef(),0)})),a&&n.jsxs(i.Box,e.__assign({ref:ln.current[o],onClick:function(e){var n=Be.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(),te.open&&te.sectionIdx===i?ce():(ae(),ie(Ne(e.currentTarget,n,t,i,r)))}(e,t,n,o,a)},sx:{position:"absolute",top:"18px",right:0,transform:"translateY(-50%) translateX(calc(100% + 8px))",display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",bgcolor:a.badgeBg,color:a.badgeText,border:"1px solid ".concat(a.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!==u&&n.jsx(i.Box,e.__assign({component:"span",sx:{fontSize:"11px",fontWeight:700,pr:.5,borderRight:"1px solid ".concat(a.badgeBorder)}},{children:u})),n.jsx(i.Box,e.__assign({component:"span",sx:{fontSize:"11px",px:.25}},{children:c?"No Deviation Found":0==a.deviationLabel||void 0===a.deviationLabel?"Same":"".concat(a.deviationLabel,"% Deviation")})),n.jsx(r.EllipsisVertical,{size:11,color:a.badgeText})]}))]}))}),"left-row-".concat(o))})}))]})),n.jsx(i.Box,e.__assign({sx:{width:"180px",display:"flex",flexDirection:"column",alignItems:"center",pt:"6px",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},T?{flex:1,overflow:"visible",minHeight:0}:{})},{children:[n.jsx(i.Box,e.__assign({ref:Pe,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:Ce,placement:"top"},{children:n.jsx(i.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:500,color:"#5928ED",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",height:"40px"}},{children:Ce}))}))})),n.jsx(i.Box,e.__assign({onScroll:pn,sx:e.__assign({p:"12px",display:"flex",flexDirection:"column"},T?{maxHeight:"500px",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,ml:"-160px",pl:"172px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:Te&&Be.map(function(t,r){if(!T)return vn(t,r,"right",on.current[r]);var o=t,l=Re.filter(function(e){var n;return(null===(n=e.refIndexes)||void 0===n?void 0:n.includes(o.selfIndex))&&e.selfIndex>=0}).map(function(e){return e.selfIndex+1});return n.jsx(i.Box,e.__assign({ref:an.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:on.current[r],sx:{width:"100%"}},{children:vn(t,r,"right",f.default.createRef(),0)})),n.jsx(i.Box,e.__assign({ref:sn.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:l.length>0?l.join(", "):"-"}))]}))}),"right-row-".concat(r))})}))]}))]}))}))}))]}))};
|
|
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("react-markdown"),s=require("./CognitiveComparehelpers.js"),a=require("./CognitiveCompareConfig.js"),c=require("./CognitivePopup.js"),u=require("./MoreFunctionsPopup.js");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var f=d(t),x=d(l),h={id:"",title:""},p={open:!1,sectionTitle:"",refSectionTitle:"",cognitiveData:null,anchorEl:null,sectionAnchorEl:null,badgeStyle:null,sectionIdx:null,docData:null};exports.SHARED_MARKDOWN_STYLES=a.SHARED_MARKDOWN_STYLES,exports.default=function(l){var d,v,g,_,m,y,b,S,F=l.componentHeaderText,w=void 0===F?"Learning Comparison":F,E=l.treeData,I=l.comparisonConfig,j=l.leftColumnTitleText,C=l.rightColumnTitleText,R=l.markdownStyles,B=l.maintainRelativeOrder,T=void 0!==B&&B,A=l.popupConfig,D=t.useState(T),k=D[0],O=D[1],M=t.useState(null),N=M[0],L=M[1],z=t.useState(!1),H=z[0],W=z[1],q=t.useState(!1),P=q[0],U=q[1],V=t.useRef(!1),G=t.useMemo(function(){return(null==E?void 0:E.cognitive_decisioning)||{}},[E]),Y=t.useState(null),X=Y[0],K=Y[1],J=t.useRef(null),Q=t.useState({width:0,height:0}),Z=Q[0],$=Q[1],ee=t.useMemo(function(){return e.__assign(e.__assign({},a.SHARED_MARKDOWN_STYLES),R)},[R]),ne=t.useState({open:!1,sectionTitle:"",refSectionTitle:"",cognitiveData:null,anchorEl:null,sectionAnchorEl:null,badgeStyle:null,sectionIdx:null,docData:null}),te=ne[0],ie=ne[1],re=t.useState({open:!1,sectionTitle:"",refSectionTitle:"",cognitiveData:null,anchorEl:null,sectionAnchorEl:null,badgeStyle:null,sectionIdx:null,docData:null}),oe=re[0],le=re[1],se=t.useRef(null),ae=t.useRef(null),ce=t.useRef(null),ue=t.useRef(null),de=t.useRef(null),fe=t.useRef(!1),xe=t.useRef(null);t.useEffect(function(){xe.current=null},[te.sectionIdx,te.open]);var he=t.useCallback(function(){K(null),ie(p)},[]),pe=t.useCallback(function(){le(p)},[]),ve=t.useCallback(function(){var e;if(te.anchorEl&&te.refSectionTitle){var n=te.anchorEl.getBoundingClientRect(),t=(null===(e=null==J?void 0:J.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!==xe.current?!0===xe.current&&(l=o>=t||o>=r):l=!(r>=t||r>=o),xe.current=l;var s=l?o:r,a=Math.min(t||9999,s),c=l?n.top-12-a:n.bottom+12,u=n.left+n.width/2,d=u-i/2,f=Math.max(12,Math.min(d,window.innerWidth-i-12)),x=Math.max(14,Math.min(u-f,i-10-4));K({top:c,left:f,arrowLeft:x,openAbove:l,maxHeight:s})}},[te.anchorEl,te.refSectionTitle]);t.useEffect(function(){if(te.open){window.addEventListener("resize",ve);var e=requestAnimationFrame(ve),n=null;return J.current&&(n=new ResizeObserver(function(){cancelAnimationFrame(e),e=requestAnimationFrame(ve)})).observe(J.current),function(){cancelAnimationFrame(e),window.removeEventListener("resize",ve),n&&n.disconnect()}}},[te.open,ve]),t.useEffect(function(){var e=se.current;if(e&&te.open){var n=function(e){J.current&&J.current.contains(e.target)||(K(null),he())};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,he]),t.useEffect(function(){var e=se.current;if(e&&oe.open){var n=function(){pe()};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})}}},[oe.open,pe]);var ge=t.useMemo(function(){var n,t,i,r,o,l,s,c,u,d,f,x;return{fields:null!==(n=null==I?void 0:I.fields)&&void 0!==n?n:a.DEFAULT_FIELD_CONFIG,thresholds:{high:null!==(i=null===(t=null==I?void 0:I.thresholds)||void 0===t?void 0:t.high)&&void 0!==i?i:a.DEFAULT_COMPARISON_CONFIG.thresholds.high,medium:null!==(o=null===(r=null==I?void 0:I.thresholds)||void 0===r?void 0:r.medium)&&void 0!==o?o:a.DEFAULT_COMPARISON_CONFIG.thresholds.medium,exact:null!==(s=null===(l=null==I?void 0:I.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==I?void 0:I.relationStyles)||void 0===c?void 0:c.noContent)||{}),high:e.__assign(e.__assign({},a.DEFAULT_COMPARISON_CONFIG.relationStyles.high),(null===(u=null==I?void 0:I.relationStyles)||void 0===u?void 0:u.high)||{}),exact:e.__assign(e.__assign({},a.DEFAULT_COMPARISON_CONFIG.relationStyles.exact),(null===(d=null==I?void 0:I.relationStyles)||void 0===d?void 0:d.exact)||{}),medium:e.__assign(e.__assign({},a.DEFAULT_COMPARISON_CONFIG.relationStyles.medium),(null===(f=null==I?void 0:I.relationStyles)||void 0===f?void 0:f.medium)||{}),low:e.__assign(e.__assign({},a.DEFAULT_COMPARISON_CONFIG.relationStyles.low),(null===(x=null==I?void 0:I.relationStyles)||void 0===x?void 0:x.low)||{})}}},[I]),_e=t.useMemo(function(){if(E&&Object.keys(E).length>0)try{var n=function(n,t){var i,r,o,l,a,c,u,d;void 0===t&&(t=!1);var f=[],x=[],h=n.base_root_id,p=n.input_index_map||{0:"left",1:"right"},v=n[h];if(!v||!1===v.display_node)return{activeProposed:{title:"No Data",sections:[]},activeVariants:[]};var g=function(t,i){var r=n[t];if(!r)return null;var o=s.getSideData(r,i,p),l=!!o.title.trim(),a=!!o.content.trim(),c=s.getRationale(r),u=[];r.next&&Object.values(r.next).forEach(function(e){if(n[e]){var t=g(e,i);t&&u.push(t)}});var d=!(!l&&!a);return e.__assign({id:t,title:l?o.title:"",content:a?o.content:"",subsections:u},d?c:{score:void 0,relation:"not_defined"})};if(t){var _={},m={},y=-1,b=-1;for(var S in n)if(!["base_root_id","documents","input_index_map",h].includes(S)){var F=n[S];if(F&&!1!==F.display_node){var w=s.getRationale(F),E=s.getSideData(F,"0",p),I=s.getSideData(F,"1",p),j=E.title.trim()||E.content.trim(),C=I.title.trim()||I.content.trim(),R=Number(null!==(r=null===(i=E.attributes)||void 0===i?void 0:i.display_index)&&void 0!==r?r:y--),B=Number(null!==(l=null===(o=I.attributes)||void 0===o?void 0:o.display_index)&&void 0!==l?l:b--),T=m[B]||e.__assign(e.__assign({id:S,title:C?I.title:"",content:C?I.content:"",subsections:[]},C?w:{score:void 0,relation:"not_defined"}),{refIndexes:[],selfIndex:B}),A=_[R]||e.__assign(e.__assign({id:S,title:j?E.title:"",content:j?E.content:"",subsections:[]},j?w:{score:void 0,relation:"not_defined"}),{refIndexes:[],selfIndex:R});Number(B)>=0&&Number(R)>=0&&(T.refIndexes.includes(Number(R))||T.refIndexes.push(Number(R)),A.refIndexes.includes(Number(B))||A.refIndexes.push(Number(B))),m[B]=T,_[R]=A}}x=Object.values(m).map(function(e){return e}),f=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}),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 v.next&&Object.values(v.next).forEach(function(e){var t=n[e];t&&!1!==t.display_node&&(f.push(g(e,"0")||{id:e,title:"",content:"",subsections:[]}),x.push(g(e,"1")||{id:e,title:"",content:"",subsections:[]}))});return{activeProposed:{title:(null===(c=null===(a=v.comparison_inputs)||void 0===a?void 0:a[p[0]])||void 0===c?void 0:c.title)||"Uploaded Contract",description:v.decision_scope_description||"",sections:f},activeVariants:[{id:"tree-variant-1",title:(null===(d=null===(u=v.comparison_inputs)||void 0===u?void 0:u[p[1]])||void 0===d?void 0:d.title)||"Reference Template",similarity:0,sections:x,analysis:{rule_difference_comparison:{summary:{overall_score:0,overall_summary:v.decision_scope_description||""},fields:{}}}}]}}(E,k);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"}},[E,k]),me=_e.activeProposed,ye=_e.activeVariants,be=_e.parseError;t.useEffect(function(){be&&L("Failed to load comparison: ".concat(be))},[be]);var Se=t.useState(null),Fe=Se[0];Se[1];var we=t.useState({}),Ee=we[0],Ie=we[1],je=t.useState({}),Ce=je[0],Re=je[1],Be=(null==ye?void 0:ye[0])||h,Te=null===(g=null===(d=null==E?void 0:E.documents)||void 0===d?void 0:d[null===(v=null==E?void 0:E.input_index_map)||void 0===v?void 0:v[0]])||void 0===g?void 0:g.title,Ae=null===(y=null===(_=null==E?void 0:E.documents)||void 0===_?void 0:_[null===(m=null==E?void 0:E.input_index_map)||void 0===m?void 0:m[1]])||void 0===y?void 0:y.title,De=s.safeStringify(j||Te||"Uploaded Contract"),ke=s.safeStringify(C||Ae||"Reference Template"),Oe=t.useMemo(function(){return(null==me?void 0:me.sections)||[]},[null==me?void 0:me.sections]),Me=t.useMemo(function(){return Be.sections||[]},[Be.sections]),Ne=Oe.length>0||Me.length>0,Le=Be.analysis,ze=s.safeStringify(null===(S=null===(b=null==Le?void 0:Le.rule_difference_comparison)||void 0===b?void 0:b.summary)||void 0===S?void 0:S.overall_summary),He=!!ze.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),We=t.useRef({}),qe=function(e){return We.current[e]||(We.current[e]=f.default.createRef()),We.current[e]},Pe=t.useCallback(function(){W(!1),nn(null),U(!1),ue.current&&(ue.current.style.height="0px"),de.current&&(de.current.style.height="0px")},[]),Ue=t.useCallback(function(e,n,t,i,r){var o,l,a=s.safeStringify(n.id)||s.safeStringify(t.id)||"",c=(a?G[a]:null)||n.cognitiveData||t.cognitiveData||{section_id:a,decisioning:[],gap:[],relevance_score:0},u=null!==(l=null===(o=We.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:c,anchorEl:e,sectionAnchorEl:u,badgeStyle:r||null,sectionIdx:i,docData:{documents:null==E?void 0:E.documents,input_index_map:null==E?void 0:E.input_index_map}}},[G]),Ve=t.useCallback(function(e){pe(),K(null),ie(e)},[pe]),Ge=t.useCallback(function(){null!==oe.sectionIdx&&oe.anchorEl?Ve(e.__assign(e.__assign({},oe),{open:!0})):pe()},[oe,pe,Ve]);t.useCallback(function(e){pe(),L("".concat(e," is coming soon."))},[pe]);var Ye=t.useRef(null),Xe=t.useRef(null),Ke=t.useRef(null),Je=t.useState([]),Qe=Je[0],Ze=Je[1],$e=t.useState(null),en=$e[0],nn=$e[1],tn=t.useRef(null),rn=t.useState(null),on=rn[0],ln=rn[1],sn=t.useMemo(function(){return ge.fields.filter(function(e){var n=e.key;return(!Ne||"description"!==n)&&(s.hasValue(null==me?void 0:me[n])||s.hasValue(Be[n]))})},[me,Be,Ne,ge.fields]),an=t.useRef({}),cn=t.useRef({}),un=t.useRef({}),dn=t.useRef({}),fn=t.useRef({}),xn=t.useRef({}),hn=t.useRef({});sn.forEach(function(e){for(var n=e.key,t=0;t<Math.max(Oe.length,Me.length);t+=1)un.current[t]||(un.current[t]=f.default.createRef()),dn.current[t]||(dn.current[t]=f.default.createRef()),fn.current[t]||(fn.current[t]=f.default.createRef()),xn.current[t]||(xn.current[t]=f.default.createRef()),hn.current[t]||(hn.current[t]=f.default.createRef());an.current[n]||(an.current[n]=f.default.createRef()),cn.current[n]||(cn.current[n]=f.default.createRef())});for(var pn=0;pn<Math.max(Oe.length,Me.length);pn+=1)un.current[pn]||(un.current[pn]=f.default.createRef()),dn.current[pn]||(dn.current[pn]=f.default.createRef()),fn.current[pn]||(fn.current[pn]=f.default.createRef()),xn.current[pn]||(xn.current[pn]=f.default.createRef()),hn.current[pn]||(hn.current[pn]=f.default.createRef());t.useEffect(function(){if(Fe){var e=ge.fields.find(function(e){return e.analysisKey===Fe||e.key===Fe});if(e){var n=an.current[e.key]||cn.current[e.key];(null==n?void 0:n.current)&&setTimeout(function(){return n.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[Fe,ge.fields]);var vn=t.useCallback(function(e){var n,t,i,r,o,l,s,a,c,u=null===(n=null==Le?void 0:Le.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 x=d.mappings[0]||{};return{score:d.score,relation:x.relation||"",highlightsA:(null===(l=x.highlights)||void 0===l?void 0:l.ruleA_spans)||[],highlightsB:(null===(s=x.highlights)||void 0===s?void 0:s.ruleB_spans)||[],hasContent:!!f}}return{score:d.score,relation:d.relation||"",highlightsA:(null===(a=d.highlights)||void 0===a?void 0:a.ruleA_spans)||[],highlightsB:(null===(c=d.highlights)||void 0===c?void 0:c.ruleB_spans)||[],hasContent:!!f}},[Le]),gn=t.useCallback(function(n){var t,i,r,o,l=Oe[n],a=Me[n],c=(null==l?void 0:l.relation)&&"not_defined"!==l.relation,u=(null==a?void 0:a.relation)&&"not_defined"!==a.relation,d=s.safeStringify(null==l?void 0:l.id)||s.safeStringify(null==a?void 0:a.id)||"",f=!(!(null==l?void 0:l.cognitiveData)&&!(null==a?void 0:a.cognitiveData));if(!c&&!u&&!f)return e.__assign(e.__assign({},ge.relationStyles.noContent),{label:"Not Defined"});var x=vn("description");if(null!=(null!==(i=null!==(t=null==l?void 0:l.cognitiveRelevanceScore)&&void 0!==t?t:null==a?void 0:a.cognitiveRelevanceScore)&&void 0!==i?i:d?null===(r=G[d])||void 0===r?void 0:r.relevance_score:void 0)){var h=s.cognitiveScoreToRelation(),p=h.score,v=h.relation;return s.getStyleForRelation(p,v,!0,ge)}var g=c?l.relation:u?a.relation:x.relation,_=null!==(o=null==l?void 0:l.score)&&void 0!==o?o:null==a?void 0:a.score,m="number"==typeof _?_:x.score;return s.getStyleForRelation(m,g,!0,ge)},[Oe,Me,G,ge,vn]),_n=t.useCallback(function(){var e,n,t,i,r,o,l,a,c,u,d;if(!fe.current){fe.current=!0;try{if(!Ye.current)return;var f=Ye.current.getBoundingClientRect();$({width:f.width,height:f.height});var x=[];if(sn.forEach(function(e){var n,t,i=e.key,r=null===(n=an.current[i])||void 0===n?void 0:n.current,o=null===(t=cn.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")}),!k)for(var h=0;h<Math.min(Oe.length,Me.length);h++){var p=null===(e=un.current[h])||void 0===e?void 0:e.current,v=null===(n=dn.current[h])||void 0===n?void 0:n.current;p&&v&&(p.style.height="auto",v.style.height="auto",p.style.minHeight="0px",v.style.minHeight="0px")}var g={};sn.forEach(function(e){var n,t,i=e.key,r=null===(n=an.current[i])||void 0===n?void 0:n.current,o=null===(t=cn.current[i])||void 0===t?void 0:t.current;if(r&&o){var l=r.getBoundingClientRect(),s=o.getBoundingClientRect();g[i]=Math.max(l.height,s.height)}});var _=[];if(!k)for(h=0;h<Math.min(Oe.length,Me.length);h++){p=null===(t=un.current[h])||void 0===t?void 0:t.current,v=null===(i=dn.current[h])||void 0===i?void 0:i.current;if(p&&v){var m=p.getBoundingClientRect(),y=v.getBoundingClientRect();_[h]=Math.max(m.height,y.height)}}if(sn.forEach(function(e){var n,t,i=e.key,r=null===(n=an.current[i])||void 0===n?void 0:n.current,o=null===(t=cn.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")}}),!k)for(h=0;h<_.length;h++){p=null===(r=un.current[h])||void 0===r?void 0:r.current,v=null===(o=dn.current[h])||void 0===o?void 0:o.current;if(p&&v){var b=_[h];p.style.minHeight="".concat(b,"px"),v.style.minHeight="".concat(b,"px")}}if(sn.forEach(function(e){var n,t,i=e.key,r=e.analysisKey,o=null===(n=an.current[i])||void 0===n?void 0:n.current,l=null===(t=cn.current[i])||void 0===t?void 0:t.current;if(o&&l){var a=o.getBoundingClientRect(),c=l.getBoundingClientRect(),u=vn(r),d=s.getStyleForRelation(u.score,u.relation,u.hasContent,ge);if(!d)return;var h=a.top+a.height/2-f.top;x.push({id:"field-".concat(i),x1:a.right-f.left,y1:h,x2:c.left-f.left,y2:h,style:d})}}),k)Oe.forEach(function(e,n){var t;(null===(t=un.current[n])||void 0===t?void 0:t.current)&&(e.refIndexes||[]).forEach(function(e){var t,i,r=Me.findIndex(function(n){return n.selfIndex===e});if(-1!==r){var o=null===(t=fn.current[n])||void 0===t?void 0:t.current,l=null===(i=xn.current[r])||void 0===i?void 0:i.current;if(o&&l){var s=o.getBoundingClientRect(),a=l.getBoundingClientRect(),c=s.right-f.left,u=a.left-f.left,d=s.top+s.height/2-f.top,h=a.top+a.height/2-f.top;H&&en===n&&(h=d);var p=gn(n);p&&x.push({id:"line-".concat(n,"-").concat(r),x1:c,y1:d,x2:u,y2:h,style:p,sectionIdx:n,targetRightIdx:r})}}})});else for(h=0;h<Math.min(Oe.length,Me.length);h++){var S=null===(l=un.current[h])||void 0===l?void 0:l.current,F=null===(a=dn.current[h])||void 0===a?void 0:a.current;if(S&&F){var w=S.querySelector(".MuiAccordionSummary-root"),E=F.querySelector(".MuiAccordionSummary-root");if(w&&E){var I=w.getBoundingClientRect(),j=E.getBoundingClientRect(),C=(I.top+I.height/2-f.top+j.top+j.height/2-f.top)/2,R=(null===(c=Me[h])||void 0===c?void 0:c.id)||"sec-".concat(h),B=gn(h);B&&x.push({id:R,x1:I.right-f.left,y1:C,x2:j.left-f.left,y2:C,style:B,sectionIdx:h,hasCognitive:!!((null===(u=Oe[h])||void 0===u?void 0:u.cognitiveData)||(null===(d=Me[h])||void 0===d?void 0:d.cognitiveData)||R&&G[R])})}}}if(Ze(x),Xe.current&&Ke.current){var T=Xe.current.getBoundingClientRect(),A=Ke.current.getBoundingClientRect(),D=(T.top+T.height/2-f.top+A.top+A.height/2-f.top)/2;ln({x1:T.right-f.left,x2:A.left-f.left,y:D})}else ln(null)}catch(e){console.error("Line render safe fail: ",e)}finally{fe.current=!1}}},[sn,Oe,Me,G,ge,vn,gn,k,H,en]),mn=t.useRef(_n);t.useEffect(function(){mn.current=_n},[_n]);var yn=t.useCallback(function(){null!==tn.current&&window.cancelAnimationFrame(tn.current),tn.current=window.requestAnimationFrame(function(){mn.current(),tn.current=null})},[]),bn=t.useCallback(function(){var e=oe.sectionIdx;pe(),null!==e&&(H&&en===e?Pe():(V.current=!0,nn(e),W(!0),U(!1),ue.current&&(ue.current.style.height="0px"),de.current&&(de.current.style.height="0px"),requestAnimationFrame(function(){var n,t,i=null===(n=We.current[e])||void 0===n?void 0:n.current,r=Oe[e],o=(null==r?void 0:r.refIndexes)||[],l=null;if(o.length>0){var s=o[0],a=Me.findIndex(function(e){return e.selfIndex===s});l=null===(t=hn.current[a])||void 0===t?void 0:t.current}var c=null==i?void 0:i.parentElement,u=ce.current;if(i&&c){var d=i.offsetTop-c.scrollTop,f=null;if(l&&u){var x=l.offsetTop-d;if(x<0)ue.current&&(ue.current.style.height="".concat(Math.abs(x),"px")),f=0;else{var h=u.scrollHeight-u.clientHeight;x>h?(de.current&&(de.current.style.height="".concat(x-h+150,"px")),f=x):f=x}}u&&null!==f?function(e,n,t,i){void 0===t&&(t=300);var r=e.style.scrollBehavior;e.style.scrollBehavior="auto";var o=e.scrollTop,l=n-o,s=null,a=function(c){null===s&&(s=c);var u,d=c-s;d<t?(e.scrollTop=(u=d,u/=t,l*(--u*u*u+1)+o),requestAnimationFrame(a)):(e.scrollTop=n,e.style.scrollBehavior=r,i&&i())};requestAnimationFrame(a)}(u,f,300,function(){U(!0),yn(),setTimeout(function(){V.current=!1},50)}):setTimeout(function(){U(!0),yn(),V.current=!1},350)}})))},[pe,oe.sectionIdx,H,en,Oe,Me,yn,Pe]),Sn=t.useCallback(function(){V.current||(yn(),H&&!V.current&&(W(!1),nn(null),U(!1),ue.current&&(ue.current.style.height="0px"),de.current&&(de.current.style.height="0px")))},[yn,H]);t.useEffect(function(){var e=setTimeout(yn,250);window.addEventListener("resize",yn);var n=null,t=null;return se.current&&(n=new ResizeObserver(yn)).observe(se.current),Ye.current&&(t=new ResizeObserver(yn)).observe(Ye.current),function(){clearTimeout(e),window.removeEventListener("resize",yn),null==n||n.disconnect(),null==t||t.disconnect()}},[me,Be,Le,sn,Ee,Ce,Oe,Me,ge,yn,H,en,P]);var Fn=function(t,o,l,a,c){void 0===c&&(c=1);var u,d=k?!!Ee["".concat(l,"-").concat(o)]:!!Ee[String(o)],h=s.hasValue(t.title),p=s.hasValue(t.content),v=!h&&!p,g=t.title;return h||(g=p?"No Title Found":"No Matching Section Found"),n.jsx(i.Box,e.__assign({ref:a,sx:e.__assign(e.__assign({mb:c},k?{height:"fit-content"}:{minHeight:0}),{display:"flex",flexDirection:"column",position:"relative"})},{children:n.jsxs(i.Accordion,e.__assign({disableGutters:!0,expanded:!v&&d,onChange:function(){return!v&&function(n,t){Ie(function(i){var r=e.__assign({},i);if(!k){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==(a=Oe[n])?void 0:a.refIndexes)||[]).forEach(function(e){var n=Me.findIndex(function(n){return n.selfIndex===e});-1!==n&&(r["right-".concat(n)]=s)});else{var a,c=null==(a=Me[n])?void 0:a.selfIndex;Oe.forEach(function(e,n){var t;(null===(t=e.refIndexes)||void 0===t?void 0:t.includes(c))&&(r["left-".concat(n)]=s)})}return r})}(o,l)},sx:{boxShadow:"none",border:v?"1px dashed #E2E8F0":"1px solid #E2E8F0",bgcolor:v?"#FAFAFA":"#FFFFFF",borderRadius:"6px",flex:1,display:"flex",flexDirection:"column","&:before":{display:"none"}}},{children:[n.jsx(i.AccordionSummary,e.__assign({expandIcon:v?null:n.jsx(r.ChevronDown,{size:16}),sx:{minHeight:"36px",flexShrink:0,cursor:v?"default":"pointer","& .MuiAccordionSummary-content":{my:.5,display:"flex",alignItems:"center",overflow:"hidden"},"& .MuiAccordionSummary-expandIconWrapper":{transition:"transform 0.2s ease"},"& .MuiAccordionSummary-expandIconWrapper.Mui-expanded":{transform:"rotate(180deg)"}}},{children:n.jsx(i.Tooltip,e.__assign({title:g,placement:"top"},{children:n.jsx(i.Typography,e.__assign({sx:{fontSize:"12px",color:v?"#94A3B8":"#19213D",fontWeight:v?400:700,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},{children:(u=g,u?s.safeStringify(u).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(f.default.Fragment,{children:e},t)}):null)}))}))})),!v&&n.jsxs(i.AccordionDetails,e.__assign({sx:{pt:0,pb:1.25,bgcolor:"#FFFFFF",flex:1,display:"flex",flexDirection:"column"}},{children:[n.jsx(i.Typography,e.__assign({component:"div",sx:ee},{children:n.jsx(x.default,{children:s.safeStringify(t.content).replace(/\\n/g,"\n")})})),(t.subsections||[]).map(function(e,n){return wn(e,"".concat(o,"-").concat(n),0)})]}))]}))}),"".concat(l,"-sec-").concat(o))},wn=function(t,o,l){void 0===l&&(l=0);var a=s.hasValue(t.title),c=s.hasValue(t.content),u=!a&&!c,d=a?t.title:c?"No Title Found":"No Matching Section Found",f=!!Ce[o];return t.title?n.jsxs(i.Accordion,e.__assign({disableGutters:!0,expanded:!u&&f,onChange:function(){return!u&&Re(function(n){var t;return e.__assign(e.__assign({},n),((t={})[o]=!n[o],t))})},sx:{mt:1,boxShadow:"none",border:u?"1px dashed #E2E8F0":"1px solid #EEF2F7",borderRadius:"4px !important",bgcolor:"#FFFFFF","&:before":{display:"none"}}},{children:[n.jsx(i.AccordionSummary,e.__assign({expandIcon:u?null:n.jsx(r.ChevronDown,{size:14}),sx:{minHeight:"32px","& .MuiAccordionSummary-content":{my:.5}}},{children:n.jsx(i.Typography,e.__assign({sx:{fontSize:"11px",fontWeight:600,color:u?"#94A3B8":"#19213D"}},{children:d||"Untitled Subsection"}))})),!u&&n.jsxs(i.AccordionDetails,e.__assign({sx:{pt:0,pb:1}},{children:[c&&n.jsx(i.Typography,e.__assign({component:"div",sx:ee},{children:n.jsx(x.default,{children:s.safeStringify(t.content).replace(/\\n/g,"\n")})})),(t.subsections||[]).map(function(e,n){return wn(e,"".concat(o,"-").concat(n),l+1)})]}))]}),o):n.jsx(i.Box,e.__assign({sx:{mt:0===l?1:.75}},{children:!u&&n.jsxs("div",{children:[c&&n.jsx(i.Typography,e.__assign({component:"div",sx:ee},{children:n.jsx(x.default,{children:s.safeStringify(t.content).replace(/\\n/g,"\n")})})),(t.subsections||[]).map(function(e,n){return wn(e,"".concat(o,"-").concat(n),l+1)})]})}),o)};return n.jsxs(i.Box,e.__assign({ref:ae,sx:e.__assign(e.__assign({display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif'},k?{}:{overflow:"visible"}),{position:"relative"})},{children:[k&&n.jsx(u.default,{open:oe.open,anchorEl:oe.anchorEl,sectionTitle:oe.sectionTitle,referenceSectionTitle:oe.refSectionTitle,onClose:pe,onOpenCognitiveCompare:Ge,onOpenSideBySide:bn}),te.open&&n.jsx(c.default,{open:te.open,popupRef:J,position:X,popupConfig:A,onClose:function(){K(null),ie(function(n){return e.__assign(e.__assign({},n),{open:!1})})},markdownStyles:R,sectionTitle:te.sectionTitle,referenceSectionTitle:te.refSectionTitle,cognitiveData:te.cognitiveData,anchorEl:te.anchorEl,sectionAnchorEl:te.sectionAnchorEl,scrollContainerEl:se.current,badgeStyle:te.badgeStyle,docData:te.docData}),n.jsx(i.Snackbar,e.__assign({open:!!N,autoHideDuration:8e3,onClose:function(){return L(null)},anchorOrigin:{vertical:"top",horizontal:"center"}},{children:n.jsx(i.Alert,e.__assign({onClose:function(){return L(null)},severity:"error",sx:{width:"100%",whiteSpace:"pre-line"}},{children:N}))})),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:n.jsx(i.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:600,color:"#0F172A"}},{children:w}))})),n.jsx(i.Box,e.__assign({sx:{display:"flex",alignItems:"center"}},{children:n.jsx(i.FormControlLabel,{control:n.jsx(i.Switch,{checked:k,onChange:function(e){return O(e.target.checked)},color:"primary",size:"small"}),label:n.jsx(i.Typography,e.__assign({sx:{fontSize:"13px",fontWeight:500,color:"#64748B"}},{children:"Relative Order"})),labelPlacement:"start",sx:{m:0,gap:1}})}))]})),n.jsx(i.Box,e.__assign({ref:se,onScroll:Sn,sx:{flex:1,minHeight:0,pt:1.5,pb:8,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",overflowY:k?"hidden":"auto",borderTop:ze&&He?"none":"1.5px solid #EEF0F4"}},{children:n.jsx(i.Box,e.__assign({sx:e.__assign({display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"},k?{flex:1,minHeight:0}:{})},{children:n.jsxs(i.Box,e.__assign({ref:Ye,sx:e.__assign({display:"grid",gridTemplateColumns:"minmax(0, 1fr) 180px minmax(0, 1fr)",gap:"60px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0},k?{flex:1,overflow:"visible"}:{})},{children:[n.jsxs("svg",e.__assign({style:{position:"absolute",top:0,left:0,width:Z.width||"100%",height:Z.height||"100%",pointerEvents:"none",zIndex:10,overflow:"visible"}},{children:[on&&n.jsxs("g",{children:[n.jsx("line",{x1:on.x1,y1:on.y,x2:Math.max(on.x1,(on.x1+on.x2)/2-70),y2:on.y,stroke:"#BBF7D0",strokeWidth:"1.5"}),n.jsx("line",{x1:Math.min(on.x2,(on.x1+on.x2)/2+70),y1:on.y,x2:on.x2,y2:on.y,stroke:"#BBF7D0",strokeWidth:"1.5"})]}),Qe.map(function(t){var l,s=(t.x1+t.x2)/2;if("Not Defined"===t.style.label&&!t.hasCognitive)return null;if(!k)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){var n=Oe[t.sectionIdx]||{title:"",content:""},i=Me[t.sectionIdx]||{title:"",content:""};Ve(Ue(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})]}))}))}))]},t.id);var a=Oe[t.sectionIdx];return!(null===(l=null==a?void 0:a.refIndexes)||void 0===l?void 0:l.length)||(null==a?void 0:a.selfIndex)<0?null:H&&en===t.sectionIdx&&P?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",{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})]})),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)"},k?{flex:1,overflow:"visible"}:{})},{children:[n.jsx(i.Box,e.__assign({ref:Xe,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:De,placement:"top"},{children:n.jsx(i.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:500,color:"#19213D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",height:"40px"}},{children:De}))}))})),n.jsx(i.Box,e.__assign({onScroll:Sn,sx:e.__assign({p:"12px",display:"flex",flexDirection:"column"},k?{maxHeight:"500px",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,mr:"-160px",pr:"172px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:Ne&&Oe.map(function(t,o){var l;if(!k)return n.jsx(i.Box,e.__assign({ref:qe(o)},{children:Fn(t,o,"left",un.current[o])}),"left-row-".concat(o));var s=t,a=gn(o),c=!(null===(l=s.refIndexes)||void 0===l?void 0:l.length)||s.selfIndex<0,u="number"==typeof s.selfIndex&&s.selfIndex>=0?s.selfIndex+1:null;return n.jsx(i.Box,e.__assign({ref:qe(o),sx:{mb:1}},{children:n.jsxs(i.Box,e.__assign({sx:{position:"relative",width:"100%"}},{children:[n.jsx(i.Box,e.__assign({ref:un.current[o],sx:{width:"100%"}},{children:Fn(t,o,"left",f.default.createRef(),0)})),a&&n.jsxs(i.Box,e.__assign({ref:fn.current[o],onClick:function(e){var n=Me.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(),oe.open&&oe.sectionIdx===i?pe():(he(),le(Ue(e.currentTarget,n,t,i,r)))}(e,t,n,o,a)},sx:{position:"absolute",top:"18px",right:0,transform:"translateY(-50%) translateX(calc(100% + 8px))",display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",bgcolor:a.badgeBg,color:a.badgeText,border:"1px solid ".concat(a.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!==u&&n.jsx(i.Box,e.__assign({component:"span",sx:{fontSize:"11px",fontWeight:700,pr:.5,borderRight:"1px solid ".concat(a.badgeBorder)}},{children:u})),n.jsx(i.Box,e.__assign({component:"span",sx:{fontSize:"11px",px:.25}},{children:c?"No Deviation Found":0==a.deviationLabel||void 0===a.deviationLabel?"Same":"".concat(a.deviationLabel,"% Deviation")})),n.jsx(r.EllipsisVertical,{size:11,color:a.badgeText})]}))]}))}),"left-row-".concat(o))})}))]})),n.jsx(i.Box,e.__assign({sx:{width:"180px",display:"flex",flexDirection:"column",alignItems:"center",pt:"6px",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},k?{flex:1,overflow:"visible",minHeight:0}:{})},{children:[n.jsx(i.Box,e.__assign({ref:Ke,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:ke,placement:"top"},{children:n.jsx(i.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:500,color:"#5928ED",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",height:"40px"}},{children:ke}))}))})),n.jsxs(i.Box,e.__assign({ref:ce,onScroll:Sn,sx:e.__assign({p:"12px",display:"flex",flexDirection:"column"},k?{maxHeight:"500px",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,ml:"-160px",pl:"172px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[n.jsx("div",{ref:ue,style:{width:"100%",height:"0px",flexShrink:0}}),Ne&&Me.map(function(t,r){if(!k)return Fn(t,r,"right",dn.current[r]);var o=t,l=Oe.filter(function(e){var n;return(null===(n=e.refIndexes)||void 0===n?void 0:n.includes(o.selfIndex))&&e.selfIndex>=0}).map(function(e){return e.selfIndex+1});return n.jsx(i.Box,e.__assign({ref:hn.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:dn.current[r],sx:{width:"100%"}},{children:Fn(t,r,"right",f.default.createRef(),0)})),n.jsx(i.Box,e.__assign({ref:xn.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:l.length>0?l.join(", "):"-"}))]}))}),"right-row-".concat(r))}),n.jsx("div",{ref:de,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{jsxs as n,jsx as t}from"react/jsx-runtime";import i,{useState as r,useRef as o,useMemo as l,useEffect as c,useCallback as d}from"react";import{Box as a,Snackbar as u,Alert as s,Typography as f,Tooltip as v,Accordion as p,AccordionSummary as h,AccordionDetails as x}from"@mui/material";import{ChevronDown as g,EllipsisVertical as m}from"lucide-react";import{ButtonCognitiveIcon as y}from"../../assests/svg/ButtonCognitiveIcon.js";import b from"react-markdown";import{safeStringify as w,hasValue as F,getStyleForRelation as E,getRationale as I,getSideData as S,cognitiveScoreToRelation as C}from"./CognitiveComparehelpers.js";import{SHARED_MARKDOWN_STYLES as _,DEFAULT_FIELD_CONFIG as R,DEFAULT_COMPARISON_CONFIG as T}from"./CognitiveCompareConfig.js";export{SHARED_MARKDOWN_STYLES}from"./CognitiveCompareConfig.js";import D from"./CognitivePopup.js";import A from"./MoreFunctionsPopup.js";var B={id:"",title:""},k={open:!1,sectionTitle:"",refSectionTitle:"",cognitiveData:null,anchorEl:null,sectionAnchorEl:null,badgeStyle:null,sectionIdx:null,docData:null},z=function(z){var H,M,W,j,L,N,O,P,V=z.componentHeaderText,X=void 0===V?"Learning Comparison":V,Y=z.treeData,q=z.comparisonConfig,U=z.leftColumnTitleText,K=z.rightColumnTitleText,G=z.markdownStyles,J=z.maintainRelativeOrder,Q=void 0!==J&&J,Z=z.popupConfig,$=r(null),ee=$[0],ne=$[1],te=r(!1),ie=te[0],re=te[1],oe=r(!1),le=oe[0],ce=oe[1],de=o(!1),ae=l(function(){return(null==Y?void 0:Y.cognitive_decisioning)||{}},[Y]),ue=r(null),se=ue[0],fe=ue[1],ve=o(null),pe=r({width:0,height:0}),he=pe[0],xe=pe[1],ge=l(function(){return e(e({},_),G)},[G]),me=r({open:!1,sectionTitle:"",refSectionTitle:"",cognitiveData:null,anchorEl:null,sectionAnchorEl:null,badgeStyle:null,sectionIdx:null,docData:null}),ye=me[0],be=me[1],we=r({open:!1,sectionTitle:"",refSectionTitle:"",cognitiveData:null,anchorEl:null,sectionAnchorEl:null,badgeStyle:null,sectionIdx:null,docData:null}),Fe=we[0],Ee=we[1],Ie=o(null),Se=o(null),Ce=o(!1),_e=o(null);c(function(){_e.current=null},[ye.sectionIdx,ye.open]);var Re=d(function(){fe(null),be(k)},[]),Te=d(function(){Ee(k)},[]),De=d(function(){var e;if(ye.anchorEl&&ye.refSectionTitle){var n=ye.anchorEl.getBoundingClientRect(),t=(null===(e=null==ve?void 0:ve.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!==_e.current?!0===_e.current&&(l=o>=t||o>=r):l=!(r>=t||r>=o),_e.current=l;var c=l?o:r,d=Math.min(t||9999,c),a=l?n.top-12-d:n.bottom+12,u=n.left+n.width/2,s=u-i/2,f=Math.max(12,Math.min(s,window.innerWidth-i-12)),v=Math.max(14,Math.min(u-f,i-10-4));fe({top:a,left:f,arrowLeft:v,openAbove:l,maxHeight:c})}},[ye.anchorEl,ye.refSectionTitle]);c(function(){if(ye.open){window.addEventListener("resize",De);var e=requestAnimationFrame(De),n=null;return ve.current&&(n=new ResizeObserver(function(){cancelAnimationFrame(e),e=requestAnimationFrame(De)})).observe(ve.current),function(){cancelAnimationFrame(e),window.removeEventListener("resize",De),n&&n.disconnect()}}},[ye.open,De]),c(function(){var e=Ie.current;if(e&&ye.open){var n=function(e){ve.current&&ve.current.contains(e.target)||(fe(null),Re())};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})}}},[ye.open,Re]),c(function(){var e=Ie.current;if(e&&Fe.open){var n=function(){Te()};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})}}},[Fe.open,Te]);var Ae=l(function(){var n,t,i,r,o,l,c,d,a,u,s,f;return{fields:null!==(n=null==q?void 0:q.fields)&&void 0!==n?n:R,thresholds:{high:null!==(i=null===(t=null==q?void 0:q.thresholds)||void 0===t?void 0:t.high)&&void 0!==i?i:T.thresholds.high,medium:null!==(o=null===(r=null==q?void 0:q.thresholds)||void 0===r?void 0:r.medium)&&void 0!==o?o:T.thresholds.medium,exact:null!==(c=null===(l=null==q?void 0:q.thresholds)||void 0===l?void 0:l.exact)&&void 0!==c?c:T.thresholds.exact},relationStyles:{noContent:e(e({},T.relationStyles.noContent),(null===(d=null==q?void 0:q.relationStyles)||void 0===d?void 0:d.noContent)||{}),high:e(e({},T.relationStyles.high),(null===(a=null==q?void 0:q.relationStyles)||void 0===a?void 0:a.high)||{}),exact:e(e({},T.relationStyles.exact),(null===(u=null==q?void 0:q.relationStyles)||void 0===u?void 0:u.exact)||{}),medium:e(e({},T.relationStyles.medium),(null===(s=null==q?void 0:q.relationStyles)||void 0===s?void 0:s.medium)||{}),low:e(e({},T.relationStyles.low),(null===(f=null==q?void 0:q.relationStyles)||void 0===f?void 0:f.low)||{})}}},[q]),Be=l(function(){if(Y&&Object.keys(Y).length>0)try{var n=function(n,t){var i,r,o,l,c,d,a,u;void 0===t&&(t=!1);var s=[],f=[],v=n.base_root_id,p=n.input_index_map||{0:"left",1:"right"},h=n[v];if(!h||!1===h.display_node)return{activeProposed:{title:"No Data",sections:[]},activeVariants:[]};var x=function(t,i){var r=n[t];if(!r)return null;var o=S(r,i,p),l=!!o.title.trim(),c=!!o.content.trim(),d=I(r),a=[];r.next&&Object.values(r.next).forEach(function(e){if(n[e]){var t=x(e,i);t&&a.push(t)}});var u=!(!l&&!c);return e({id:t,title:l?o.title:"",content:c?o.content:"",subsections:a},u?d:{score:void 0,relation:"not_defined"})};if(t){var g={},m={},y=-1,b=-1;for(var w in n)if(!["base_root_id","documents","input_index_map",v].includes(w)){var F=n[w];if(F&&!1!==F.display_node){var E=I(F),C=S(F,"0",p),_=S(F,"1",p),R=C.title.trim()||C.content.trim(),T=_.title.trim()||_.content.trim(),D=Number(null!==(r=null===(i=C.attributes)||void 0===i?void 0:i.display_index)&&void 0!==r?r:y--),A=Number(null!==(l=null===(o=_.attributes)||void 0===o?void 0:o.display_index)&&void 0!==l?l:b--),B=m[A]||e(e({id:w,title:T?_.title:"",content:T?_.content:"",subsections:[]},T?E:{score:void 0,relation:"not_defined"}),{refIndexes:[],selfIndex:A}),k=g[D]||e(e({id:w,title:R?C.title:"",content:R?C.content:"",subsections:[]},R?E:{score:void 0,relation:"not_defined"}),{refIndexes:[],selfIndex:D});Number(A)>=0&&Number(D)>=0&&(B.refIndexes.includes(Number(D))||B.refIndexes.push(Number(D)),k.refIndexes.includes(Number(A))||k.refIndexes.push(Number(A))),m[A]=B,g[D]=k}}f=Object.values(m).map(function(e){return e}),s=Object.values(g).map(function(e){return e}),f.sort(function(e,n){return e.selfIndex<0&&n.selfIndex>=0?1:e.selfIndex>=0&&n.selfIndex<0?-1:e.selfIndex-n.selfIndex}),s.sort(function(e,n){return e.selfIndex<0&&n.selfIndex>=0?1:e.selfIndex>=0&&n.selfIndex<0?-1:e.selfIndex-n.selfIndex})}else h.next&&Object.values(h.next).forEach(function(e){var t=n[e];t&&!1!==t.display_node&&(s.push(x(e,"0")||{id:e,title:"",content:"",subsections:[]}),f.push(x(e,"1")||{id:e,title:"",content:"",subsections:[]}))});return{activeProposed:{title:(null===(d=null===(c=h.comparison_inputs)||void 0===c?void 0:c[p[0]])||void 0===d?void 0:d.title)||"Uploaded Contract",description:h.decision_scope_description||"",sections:s},activeVariants:[{id:"tree-variant-1",title:(null===(u=null===(a=h.comparison_inputs)||void 0===a?void 0:a[p[1]])||void 0===u?void 0:u.title)||"Reference Template",similarity:0,sections:f,analysis:{rule_difference_comparison:{summary:{overall_score:0,overall_summary:h.decision_scope_description||""},fields:{}}}}]}}(Y,Q);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"}},[Y,Q]),ke=Be.activeProposed,ze=Be.activeVariants,He=Be.parseError;c(function(){He&&ne("Failed to load comparison: ".concat(He))},[He]);var Me=r(null),We=Me[0];Me[1];var je=r({}),Le=je[0],Ne=je[1],Oe=r({}),Pe=Oe[0],Ve=Oe[1],Xe=(null==ze?void 0:ze[0])||B,Ye=null===(W=null===(H=null==Y?void 0:Y.documents)||void 0===H?void 0:H[null===(M=null==Y?void 0:Y.input_index_map)||void 0===M?void 0:M[0]])||void 0===W?void 0:W.title,qe=null===(N=null===(j=null==Y?void 0:Y.documents)||void 0===j?void 0:j[null===(L=null==Y?void 0:Y.input_index_map)||void 0===L?void 0:L[1]])||void 0===N?void 0:N.title,Ue=w(U||Ye||"Uploaded Contract"),Ke=w(K||qe||"Reference Template"),Ge=l(function(){return(null==ke?void 0:ke.sections)||[]},[null==ke?void 0:ke.sections]),Je=l(function(){return Xe.sections||[]},[Xe.sections]),Qe=Ge.length>0||Je.length>0,Ze=Xe.analysis,$e=w(null===(P=null===(O=null==Ze?void 0:Ze.rule_difference_comparison)||void 0===O?void 0:O.summary)||void 0===P?void 0:P.overall_summary),en=!!$e.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),nn=o({}),tn=function(e){return nn.current[e]||(nn.current[e]=i.createRef()),nn.current[e]},rn=d(function(e,n,t,i,r){var o,l,c=w(n.id)||w(t.id)||"",d=(c?ae[c]:null)||n.cognitiveData||t.cognitiveData||{section_id:c,decisioning:[],gap:[],relevance_score:0},a=null!==(l=null===(o=nn.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:d,anchorEl:e,sectionAnchorEl:a,badgeStyle:r||null,sectionIdx:i,docData:{documents:null==Y?void 0:Y.documents,input_index_map:null==Y?void 0:Y.input_index_map}}},[ae]),on=d(function(e){Te(),fe(null),be(e)},[Te]),ln=d(function(){null!==Fe.sectionIdx&&Fe.anchorEl?on(e(e({},Fe),{open:!0})):Te()},[Fe,Te,on]);d(function(e){Te(),ne("".concat(e," is coming soon."))},[Te]);var cn=o(null),dn=o(null),an=o(null),un=r([]),sn=un[0],fn=un[1],vn=r(null),pn=vn[0],hn=vn[1],xn=o(null),gn=r(null),mn=gn[0],yn=gn[1],bn=d(function(){var e=Fe.sectionIdx;Te(),null!==e&&(ie&&pn===e?(re(!1),hn(null),ce(!1)):(de.current=!0,hn(e),re(!0),ce(!1),setTimeout(function(){var n,t=null===(n=nn.current[e])||void 0===n?void 0:n.current;t&&t.scrollIntoView({behavior:"smooth",block:"center"})},50),setTimeout(function(){ce(!0),de.current=!1},600)))},[Te,Fe.sectionIdx,ie,pn]),wn=l(function(){return Ae.fields.filter(function(e){var n=e.key;return(!Qe||"description"!==n)&&(F(null==ke?void 0:ke[n])||F(Xe[n]))})},[ke,Xe,Qe,Ae.fields]),Fn=o({}),En=o({}),In=o({}),Sn=o({}),Cn=o({}),_n=o({}),Rn=o({});wn.forEach(function(e){for(var n=e.key,t=0;t<Math.max(Ge.length,Je.length);t+=1)In.current[t]||(In.current[t]=i.createRef()),Sn.current[t]||(Sn.current[t]=i.createRef()),Cn.current[t]||(Cn.current[t]=i.createRef()),_n.current[t]||(_n.current[t]=i.createRef()),Rn.current[t]||(Rn.current[t]=i.createRef());Fn.current[n]||(Fn.current[n]=i.createRef()),En.current[n]||(En.current[n]=i.createRef())});for(var Tn=0;Tn<Math.max(Ge.length,Je.length);Tn+=1)In.current[Tn]||(In.current[Tn]=i.createRef()),Sn.current[Tn]||(Sn.current[Tn]=i.createRef()),Cn.current[Tn]||(Cn.current[Tn]=i.createRef()),_n.current[Tn]||(_n.current[Tn]=i.createRef()),Rn.current[Tn]||(Rn.current[Tn]=i.createRef());c(function(){if(We){var e=Ae.fields.find(function(e){return e.analysisKey===We||e.key===We});if(e){var n=Fn.current[e.key]||En.current[e.key];(null==n?void 0:n.current)&&setTimeout(function(){return n.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[We,Ae.fields]);var Dn=d(function(e){var n,t,i,r,o,l,c,d,a,u=null===(n=null==Ze?void 0:Ze.rule_difference_comparison)||void 0===n?void 0:n.fields;if(!u||!u[e])return{score:0,relation:"",highlightsA:[],highlightsB:[],hasContent:!1};var s=u[e],f=(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 v=s.mappings[0]||{};return{score:s.score,relation:v.relation||"",highlightsA:(null===(l=v.highlights)||void 0===l?void 0:l.ruleA_spans)||[],highlightsB:(null===(c=v.highlights)||void 0===c?void 0:c.ruleB_spans)||[],hasContent:!!f}}return{score:s.score,relation:s.relation||"",highlightsA:(null===(d=s.highlights)||void 0===d?void 0:d.ruleA_spans)||[],highlightsB:(null===(a=s.highlights)||void 0===a?void 0:a.ruleB_spans)||[],hasContent:!!f}},[Ze]),An=d(function(n){var t,i,r,o,l=Ge[n],c=Je[n],d=(null==l?void 0:l.relation)&&"not_defined"!==l.relation,a=(null==c?void 0:c.relation)&&"not_defined"!==c.relation,u=w(null==l?void 0:l.id)||w(null==c?void 0:c.id)||"",s=!(!(null==l?void 0:l.cognitiveData)&&!(null==c?void 0:c.cognitiveData));if(!d&&!a&&!s)return e(e({},Ae.relationStyles.noContent),{label:"Not Defined"});var f=Dn("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:u?null===(r=ae[u])||void 0===r?void 0:r.relevance_score:void 0)){var v=C(),p=v.score,h=v.relation;return E(p,h,!0,Ae)}var x=d?l.relation:a?c.relation:f.relation,g=null!==(o=null==l?void 0:l.score)&&void 0!==o?o:null==c?void 0:c.score,m="number"==typeof g?g:f.score;return E(m,x,!0,Ae)},[Ge,Je,ae,Ae,Dn]),Bn=d(function(){var e,n,t,i,r,o,l,c,d,a,u,s,f;if(!Ce.current){Ce.current=!0;try{if(!cn.current)return;if(Object.values(nn.current).forEach(function(e){e.current&&(e.current.style.paddingTop="0px",e.current.style.marginTop="0px")}),Object.values(Rn.current).forEach(function(e){e.current&&(e.current.style.paddingTop="0px",e.current.style.marginTop="0px")}),Q&&ie&&null!==pn){var v=Ge[pn],p=(null==v?void 0:v.refIndexes)||[];if(p.length>0){var h=p[0],x=Je.findIndex(function(e){return e.selfIndex===h});if(-1!==x){var g=null===(e=nn.current[pn])||void 0===e?void 0:e.current,m=null===(n=Rn.current[x])||void 0===n?void 0:n.current;if(g&&m){var y=g.getBoundingClientRect().top-m.getBoundingClientRect().top;if(m.style.transition="padding-top 0.3s ease-in-out",y>1)m.style.paddingTop="".concat(y,"px");else if(y<-1){var b=m.parentElement;b&&(de.current=!0,b.scrollTo({top:b.scrollTop+Math.abs(y),behavior:"smooth"}),setTimeout(function(){de.current=!1},400))}}}}}var w=cn.current.getBoundingClientRect();xe({width:w.width,height:w.height});var F=[];if(wn.forEach(function(e){var n,t,i=e.key,r=null===(n=Fn.current[i])||void 0===n?void 0:n.current,o=null===(t=En.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")}),!Q)for(var I=0;I<Math.min(Ge.length,Je.length);I++){var S=null===(t=In.current[I])||void 0===t?void 0:t.current,C=null===(i=Sn.current[I])||void 0===i?void 0:i.current;S&&C&&(S.style.height="auto",C.style.height="auto",S.style.minHeight="0px",C.style.minHeight="0px")}var _={};wn.forEach(function(e){var n,t,i=e.key,r=null===(n=Fn.current[i])||void 0===n?void 0:n.current,o=null===(t=En.current[i])||void 0===t?void 0:t.current;if(r&&o){var l=r.getBoundingClientRect(),c=o.getBoundingClientRect();_[i]=Math.max(l.height,c.height)}});var R=[];if(!Q)for(I=0;I<Math.min(Ge.length,Je.length);I++){S=null===(r=In.current[I])||void 0===r?void 0:r.current,C=null===(o=Sn.current[I])||void 0===o?void 0:o.current;if(S&&C){var T=S.getBoundingClientRect(),D=C.getBoundingClientRect();R[I]=Math.max(T.height,D.height)}}if(wn.forEach(function(e){var n,t,i=e.key,r=null===(n=Fn.current[i])||void 0===n?void 0:n.current,o=null===(t=En.current[i])||void 0===t?void 0:t.current;if(r&&o){var l=_[i];r.style.minHeight="".concat(l,"px"),o.style.minHeight="".concat(l,"px")}}),!Q)for(I=0;I<R.length;I++){S=null===(l=In.current[I])||void 0===l?void 0:l.current,C=null===(c=Sn.current[I])||void 0===c?void 0:c.current;if(S&&C){var A=R[I];S.style.minHeight="".concat(A,"px"),C.style.minHeight="".concat(A,"px")}}if(wn.forEach(function(e){var n,t,i=e.key,r=e.analysisKey,o=null===(n=Fn.current[i])||void 0===n?void 0:n.current,l=null===(t=En.current[i])||void 0===t?void 0:t.current;if(o&&l){var c=o.getBoundingClientRect(),d=l.getBoundingClientRect(),a=Dn(r),u=E(a.score,a.relation,a.hasContent,Ae);if(!u)return;var s=c.top+c.height/2-w.top;F.push({id:"field-".concat(i),x1:c.right-w.left,y1:s,x2:d.left-w.left,y2:s,style:u})}}),Q)Ge.forEach(function(e,n){var t;(null===(t=In.current[n])||void 0===t?void 0:t.current)&&(e.refIndexes||[]).forEach(function(e){var t,i,r=Je.findIndex(function(n){return n.selfIndex===e});if(-1!==r){var o=null===(t=Cn.current[n])||void 0===t?void 0:t.current,l=null===(i=_n.current[r])||void 0===i?void 0:i.current;if(o&&l){var c=o.getBoundingClientRect(),d=l.getBoundingClientRect(),a=c.right-w.left,u=d.left-w.left,s=c.top+c.height/2-w.top,f=d.top+d.height/2-w.top,v=An(n);v&&F.push({id:"line-".concat(n,"-").concat(r),x1:a,y1:s,x2:u,y2:f,style:v,sectionIdx:n,targetRightIdx:r})}}})});else for(I=0;I<Math.min(Ge.length,Je.length);I++){var B=null===(d=In.current[I])||void 0===d?void 0:d.current,k=null===(a=Sn.current[I])||void 0===a?void 0:a.current;if(B&&k){var z=B.querySelector(".MuiAccordionSummary-root"),H=k.querySelector(".MuiAccordionSummary-root");if(z&&H){var M=z.getBoundingClientRect(),W=H.getBoundingClientRect(),j=(M.top+M.height/2-w.top+W.top+W.height/2-w.top)/2,L=(null===(u=Je[I])||void 0===u?void 0:u.id)||"sec-".concat(I),N=An(I);N&&F.push({id:L,x1:M.right-w.left,y1:j,x2:W.left-w.left,y2:j,style:N,sectionIdx:I,hasCognitive:!!((null===(s=Ge[I])||void 0===s?void 0:s.cognitiveData)||(null===(f=Je[I])||void 0===f?void 0:f.cognitiveData)||L&&ae[L])})}}}if(fn(F),dn.current&&an.current){var O=dn.current.getBoundingClientRect(),P=an.current.getBoundingClientRect(),V=(O.top+O.height/2-w.top+P.top+P.height/2-w.top)/2;yn({x1:O.right-w.left,x2:P.left-w.left,y:V})}else yn(null)}catch(e){console.error("Line render safe fail: ",e)}finally{Ce.current=!1}}},[wn,Ge,Je,ae,Ae,Dn,An,Q,ie,pn,Pe]),kn=d(function(){null!==xn.current&&window.cancelAnimationFrame(xn.current),xn.current=window.requestAnimationFrame(function(){Bn(),xn.current=null})},[Bn]),zn=d(function(){kn(),ie&&!de.current&&(re(!1),hn(null),ce(!1))},[kn,ie]);c(function(){var e=setTimeout(kn,250);window.addEventListener("resize",kn);var n=null,t=null;return Ie.current&&(n=new ResizeObserver(kn)).observe(Ie.current),cn.current&&(t=new ResizeObserver(kn)).observe(cn.current),function(){clearTimeout(e),window.removeEventListener("resize",kn),null==n||n.disconnect(),null==t||t.disconnect()}},[ke,Xe,Ze,wn,Le,Ge,Je,Ae,kn]);var Hn=function(r,o,l,c,d){void 0===d&&(d=1);var u,s=Q?!!Le["".concat(l,"-").concat(o)]:!!Le[String(o)],m=F(r.title),y=F(r.content),E=!m&&!y,I=r.title;return m||(I=y?"No Title Found":"No Matching Section Found"),t(a,e({ref:c,sx:e(e({mb:d},Q?{height:"fit-content"}:{minHeight:0}),{display:"flex",flexDirection:"column",position:"relative"})},{children:n(p,e({disableGutters:!0,expanded:!E&&s,onChange:function(){return!E&&function(n,t){Ne(function(i){var r=e({},i);if(!Q){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==(d=Ge[n])?void 0:d.refIndexes)||[]).forEach(function(e){var n=Je.findIndex(function(n){return n.selfIndex===e});-1!==n&&(r["right-".concat(n)]=c)});else{var d,a=null==(d=Je[n])?void 0:d.selfIndex;Ge.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})}(o,l)},sx:{boxShadow:"none",border:E?"1px dashed #E2E8F0":"1px solid #E2E8F0",bgcolor:E?"#FAFAFA":"#FFFFFF",borderRadius:"6px",flex:1,display:"flex",flexDirection:"column","&:before":{display:"none"}}},{children:[t(h,e({expandIcon:E?null:t(g,{size:16}),sx:{minHeight:"36px",flexShrink:0,cursor:E?"default":"pointer","& .MuiAccordionSummary-content":{my:.5,display:"flex",alignItems:"center",overflow:"hidden"},"& .MuiAccordionSummary-expandIconWrapper":{transition:"transform 0.2s ease"},"& .MuiAccordionSummary-expandIconWrapper.Mui-expanded":{transform:"rotate(180deg)"}}},{children:t(v,e({title:I,placement:"top"},{children:t(f,e({sx:{fontSize:"12px",color:E?"#94A3B8":"#19213D",fontWeight:E?400:700,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},{children:(u=I,u?w(u).replace(/\\n/g,"\n").split(/(\*\*.*?\*\*)/g).map(function(e,n){return e.startsWith("**")&&e.endsWith("**")?t("strong",{children:e.slice(2,-2)},n):t(i.Fragment,{children:e},n)}):null)}))}))})),!E&&n(x,e({sx:{pt:0,pb:1.25,bgcolor:"#FFFFFF",flex:1,display:"flex",flexDirection:"column"}},{children:[t(f,e({component:"div",sx:ge},{children:t(b,{children:w(r.content).replace(/\\n/g,"\n")})})),(r.subsections||[]).map(function(e,n){return Mn(e,"".concat(o,"-").concat(n),0)})]}))]}))}),"".concat(l,"-sec-").concat(o))},Mn=function(i,r,o){void 0===o&&(o=0);var l=F(i.title),c=F(i.content),d=!l&&!c,u=l?i.title:c?"No Title Found":"No Matching Section Found",s=!!Pe[r];return i.title?n(p,e({disableGutters:!0,expanded:!d&&s,onChange:function(){return!d&&Ve(function(n){var t;return e(e({},n),((t={})[r]=!n[r],t))})},sx:{mt:1,boxShadow:"none",border:d?"1px dashed #E2E8F0":"1px solid #EEF2F7",borderRadius:"4px !important",bgcolor:"#FFFFFF","&:before":{display:"none"}}},{children:[t(h,e({expandIcon:d?null:t(g,{size:14}),sx:{minHeight:"32px","& .MuiAccordionSummary-content":{my:.5}}},{children:t(f,e({sx:{fontSize:"11px",fontWeight:600,color:d?"#94A3B8":"#19213D"}},{children:u||"Untitled Subsection"}))})),!d&&n(x,e({sx:{pt:0,pb:1}},{children:[c&&t(f,e({component:"div",sx:ge},{children:t(b,{children:w(i.content).replace(/\\n/g,"\n")})})),(i.subsections||[]).map(function(e,n){return Mn(e,"".concat(r,"-").concat(n),o+1)})]}))]}),r):t(a,e({sx:{mt:0===o?1:.75}},{children:!d&&n("div",{children:[c&&t(f,e({component:"div",sx:ge},{children:t(b,{children:w(i.content).replace(/\\n/g,"\n")})})),(i.subsections||[]).map(function(e,n){return Mn(e,"".concat(r,"-").concat(n),o+1)})]})}),r)};return n(a,e({ref:Se,sx:e(e({display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif'},Q?{}:{overflow:"visible"}),{position:"relative"})},{children:[Q&&t(A,{open:Fe.open,anchorEl:Fe.anchorEl,sectionTitle:Fe.sectionTitle,referenceSectionTitle:Fe.refSectionTitle,onClose:Te,onOpenCognitiveCompare:ln,onOpenSideBySide:bn}),ye.open&&t(D,{open:ye.open,popupRef:ve,position:se,popupConfig:Z,onClose:function(){fe(null),be(function(n){return e(e({},n),{open:!1})})},markdownStyles:G,sectionTitle:ye.sectionTitle,referenceSectionTitle:ye.refSectionTitle,cognitiveData:ye.cognitiveData,anchorEl:ye.anchorEl,sectionAnchorEl:ye.sectionAnchorEl,scrollContainerEl:Ie.current,badgeStyle:ye.badgeStyle,docData:ye.docData}),t(u,e({open:!!ee,autoHideDuration:8e3,onClose:function(){return ne(null)},anchorOrigin:{vertical:"top",horizontal:"center"}},{children:t(s,e({onClose:function(){return ne(null)},severity:"error",sx:{width:"100%",whiteSpace:"pre-line"}},{children:ee}))})),t(a,e({sx:{px:2,py:1,display:"flex",alignItems:"center",justifyContent:"space-between",bgcolor:"#FFFFFF",border:"1.5px solid #EEF0F4"}},{children:t(a,e({sx:{display:"flex",alignItems:"center",gap:1}},{children:t(f,e({sx:{fontSize:"16px",fontWeight:450,color:"#0F172A"}},{children:X}))}))})),t(a,e({ref:Ie,onScroll:zn,sx:{flex:1,minHeight:0,pt:1.5,pb:8,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",overflowY:Q?"hidden":"auto",borderTop:$e&&en?"none":"1.5px solid #EEF0F4"}},{children:t(a,e({sx:e({display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"},Q?{flex:1,minHeight:0}:{})},{children:n(a,e({ref:cn,sx:e({display:"grid",gridTemplateColumns:"1fr auto 1fr",gap:"60px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0},Q?{flex:1,overflow:"visible"}:{})},{children:[n("svg",e({style:{position:"absolute",top:0,left:0,width:he.width||"100%",height:he.height||"100%",pointerEvents:"none",zIndex:10,overflow:"visible"}},{children:[mn&&n("g",{children:[t("line",{x1:mn.x1,y1:mn.y,x2:Math.max(mn.x1,(mn.x1+mn.x2)/2-70),y2:mn.y,stroke:"#BBF7D0",strokeWidth:"1.5"}),t("line",{x1:Math.min(mn.x2,(mn.x1+mn.x2)/2+70),y1:mn.y,x2:mn.x2,y2:mn.y,stroke:"#BBF7D0",strokeWidth:"1.5"})]}),sn.map(function(i){var r,o=(i.x1+i.x2)/2;if("Not Defined"===i.style.label&&!i.hasCognitive)return null;if(!Q)return n("g",{children:[t("line",{x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2,stroke:i.style.badgeBorder||"#E2E8F0",strokeWidth:"1.5"}),t("foreignObject",e({x:o-100,y:i.y1-14,width:"200",height:"28",style:{pointerEvents:"auto",overflow:"visible"}},{children:t(a,e({sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},{children:n(a,e({onClick:function(e){var n=Ge[i.sectionIdx]||{title:"",content:""},t=Je[i.sectionIdx]||{title:"",content:""};on(rn(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,t(a,e({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:t(y,{})})),t(g,{size:11})]}))}))}))]},i.id);var l=Ge[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:ie&&pn===i.sectionIdx&&le?n("g",e({style:{transition:"opacity 0.2s"}},{children:[t("defs",{children:t("marker",e({id:"arr-".concat(i.id),markerWidth:"7",markerHeight:"5",refX:"7",refY:"2.5",orient:"auto"},{children:t("polygon",{points:"0 0, 7 2.5, 0 5",fill:i.style.badgeBorder||"#6366F1"})}))}),t("line",{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})]})),n(a,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)"},Q?{flex:1,overflow:"visible"}:{})},{children:[t(a,e({ref:dn,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E7E7E9",borderRadius:"8px 8px 0 0",display:"flex",minHeight:"40px",alignItems:"center",overflowX:"hidden"}},{children:t(v,e({title:Ue,placement:"top"},{children:t(f,e({sx:{fontSize:"16px",fontWeight:500,color:"#19213D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",height:"40px"}},{children:Ue}))}))})),t(a,e({onScroll:zn,sx:e({p:"12px",display:"flex",flexDirection:"column"},Q?{maxHeight:"500px",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,mr:"-160px",pr:"172px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:Qe&&Ge.map(function(r,o){var l;if(!Q)return t(a,e({ref:tn(o)},{children:Hn(r,o,"left",In.current[o])}),"left-row-".concat(o));var c=r,d=An(o),u=!(null===(l=c.refIndexes)||void 0===l?void 0:l.length)||c.selfIndex<0,s="number"==typeof c.selfIndex&&c.selfIndex>=0?c.selfIndex+1:null;return t(a,e({ref:tn(o),sx:{mb:1}},{children:n(a,e({sx:{position:"relative",width:"100%"}},{children:[t(a,e({ref:In.current[o],sx:{width:"100%"}},{children:Hn(r,o,"left",i.createRef(),0)})),d&&n(a,e({ref:Cn.current[o],onClick:function(e){var n=Je.find(function(e){var n;return null===(n=c.refIndexes)||void 0===n?void 0:n.includes(e.selfIndex)})||{title:"",content:""};!function(e,n,t,i,r){e.stopPropagation(),Fe.open&&Fe.sectionIdx===i?Te():(Re(),Ee(rn(e.currentTarget,n,t,i,r)))}(e,r,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!==s&&t(a,e({component:"span",sx:{fontSize:"11px",fontWeight:700,pr:.5,borderRight:"1px solid ".concat(d.badgeBorder)}},{children:s})),t(a,e({component:"span",sx:{fontSize:"11px",px:.25}},{children:u?"No Deviation Found":0==d.deviationLabel||void 0===d.deviationLabel?"Same":"".concat(d.deviationLabel,"% Deviation")})),t(m,{size:11,color:d.badgeText})]}))]}))}),"left-row-".concat(o))})}))]})),t(a,e({sx:{width:"180px",display:"flex",flexDirection:"column",alignItems:"center",pt:"6px",gap:0}},{children:t(a,e({sx:{display:"flex",justifyContent:"center",alignItems:"center",mt:0}},{children:n(a,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:[t(a,e({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:t(y,{})})),0,"% Similarity",t(g,{size:11})]}))}))})),n(a,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},Q?{flex:1,overflow:"visible",minHeight:0}:{})},{children:[t(a,e({ref:an,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E3E6EA",borderRadius:"8px 8px 0 0",minHeight:"40px",display:"flex",alignItems:"center",overflowX:"hidden"}},{children:t(v,e({title:Ke,placement:"top"},{children:t(f,e({sx:{fontSize:"16px",fontWeight:500,color:"#5928ED",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",height:"40px"}},{children:Ke}))}))})),t(a,e({onScroll:zn,sx:e({p:"12px",display:"flex",flexDirection:"column"},Q?{maxHeight:"500px",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,ml:"-160px",pl:"172px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:Qe&&Je.map(function(r,o){if(!Q)return Hn(r,o,"right",Sn.current[o]);var l=r,c=Ge.filter(function(e){var n;return(null===(n=e.refIndexes)||void 0===n?void 0:n.includes(l.selfIndex))&&e.selfIndex>=0}).map(function(e){return e.selfIndex+1});return t(a,e({ref:Rn.current[o],sx:{mb:1}},{children:n(a,e({sx:{position:"relative",width:"100%"}},{children:[t(a,e({ref:Sn.current[o],sx:{width:"100%"}},{children:Hn(r,o,"right",i.createRef(),0)})),t(a,e({ref:_n.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:c.length>0?c.join(", "):"-"}))]}))}),"right-row-".concat(o))})}))]}))]}))}))}))]}))};export{z as default};
|
|
1
|
+
import{__assign as e}from"tslib";import{jsxs as n,jsx as t}from"react/jsx-runtime";import i,{useState as r,useRef as o,useMemo as l,useEffect as c,useCallback as a}from"react";import{Box as d,Snackbar as u,Alert as s,Typography as f,FormControlLabel as h,Switch as v,Tooltip as p,Accordion as x,AccordionSummary as g,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 F from"react-markdown";import{safeStringify as I,hasValue as E,getStyleForRelation as S,getRationale as C,getSideData as R,cognitiveScoreToRelation as _}from"./CognitiveComparehelpers.js";import{SHARED_MARKDOWN_STYLES as T,DEFAULT_FIELD_CONFIG as D,DEFAULT_COMPARISON_CONFIG as A}from"./CognitiveCompareConfig.js";export{SHARED_MARKDOWN_STYLES}from"./CognitiveCompareConfig.js";import B from"./CognitivePopup.js";import k from"./MoreFunctionsPopup.js";var z={id:"",title:""},H={open:!1,sectionTitle:"",refSectionTitle:"",cognitiveData:null,anchorEl:null,sectionAnchorEl:null,badgeStyle:null,sectionIdx:null,docData:null},W=function(W){var M,L,j,N,O,P,q,X,Y=W.componentHeaderText,V=void 0===Y?"Learning Comparison":Y,U=W.treeData,K=W.comparisonConfig,G=W.leftColumnTitleText,J=W.rightColumnTitleText,Q=W.markdownStyles,Z=W.maintainRelativeOrder,$=void 0!==Z&&Z,ee=W.popupConfig,ne=r($),te=ne[0],ie=ne[1],re=r(null),oe=re[0],le=re[1],ce=r(!1),ae=ce[0],de=ce[1],ue=r(!1),se=ue[0],fe=ue[1],he=o(!1),ve=l(function(){return(null==U?void 0:U.cognitive_decisioning)||{}},[U]),pe=r(null),xe=pe[0],ge=pe[1],me=o(null),ye=r({width:0,height:0}),be=ye[0],we=ye[1],Fe=l(function(){return e(e({},T),Q)},[Q]),Ie=r({open:!1,sectionTitle:"",refSectionTitle:"",cognitiveData:null,anchorEl:null,sectionAnchorEl:null,badgeStyle:null,sectionIdx:null,docData:null}),Ee=Ie[0],Se=Ie[1],Ce=r({open:!1,sectionTitle:"",refSectionTitle:"",cognitiveData:null,anchorEl:null,sectionAnchorEl:null,badgeStyle:null,sectionIdx:null,docData:null}),Re=Ce[0],_e=Ce[1],Te=o(null),De=o(null),Ae=o(null),Be=o(null),ke=o(null),ze=o(!1),He=o(null);c(function(){He.current=null},[Ee.sectionIdx,Ee.open]);var We=a(function(){ge(null),Se(H)},[]),Me=a(function(){_e(H)},[]),Le=a(function(){var e;if(Ee.anchorEl&&Ee.refSectionTitle){var n=Ee.anchorEl.getBoundingClientRect(),t=(null===(e=null==me?void 0:me.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!==He.current?!0===He.current&&(l=o>=t||o>=r):l=!(r>=t||r>=o),He.current=l;var c=l?o:r,a=Math.min(t||9999,c),d=l?n.top-12-a:n.bottom+12,u=n.left+n.width/2,s=u-i/2,f=Math.max(12,Math.min(s,window.innerWidth-i-12)),h=Math.max(14,Math.min(u-f,i-10-4));ge({top:d,left:f,arrowLeft:h,openAbove:l,maxHeight:c})}},[Ee.anchorEl,Ee.refSectionTitle]);c(function(){if(Ee.open){window.addEventListener("resize",Le);var e=requestAnimationFrame(Le),n=null;return me.current&&(n=new ResizeObserver(function(){cancelAnimationFrame(e),e=requestAnimationFrame(Le)})).observe(me.current),function(){cancelAnimationFrame(e),window.removeEventListener("resize",Le),n&&n.disconnect()}}},[Ee.open,Le]),c(function(){var e=Te.current;if(e&&Ee.open){var n=function(e){me.current&&me.current.contains(e.target)||(ge(null),We())};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})}}},[Ee.open,We]),c(function(){var e=Te.current;if(e&&Re.open){var n=function(){Me()};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})}}},[Re.open,Me]);var je=l(function(){var n,t,i,r,o,l,c,a,d,u,s,f;return{fields:null!==(n=null==K?void 0:K.fields)&&void 0!==n?n:D,thresholds:{high:null!==(i=null===(t=null==K?void 0:K.thresholds)||void 0===t?void 0:t.high)&&void 0!==i?i:A.thresholds.high,medium:null!==(o=null===(r=null==K?void 0:K.thresholds)||void 0===r?void 0:r.medium)&&void 0!==o?o:A.thresholds.medium,exact:null!==(c=null===(l=null==K?void 0:K.thresholds)||void 0===l?void 0:l.exact)&&void 0!==c?c:A.thresholds.exact},relationStyles:{noContent:e(e({},A.relationStyles.noContent),(null===(a=null==K?void 0:K.relationStyles)||void 0===a?void 0:a.noContent)||{}),high:e(e({},A.relationStyles.high),(null===(d=null==K?void 0:K.relationStyles)||void 0===d?void 0:d.high)||{}),exact:e(e({},A.relationStyles.exact),(null===(u=null==K?void 0:K.relationStyles)||void 0===u?void 0:u.exact)||{}),medium:e(e({},A.relationStyles.medium),(null===(s=null==K?void 0:K.relationStyles)||void 0===s?void 0:s.medium)||{}),low:e(e({},A.relationStyles.low),(null===(f=null==K?void 0:K.relationStyles)||void 0===f?void 0:f.low)||{})}}},[K]),Ne=l(function(){if(U&&Object.keys(U).length>0)try{var n=function(n,t){var i,r,o,l,c,a,d,u;void 0===t&&(t=!1);var s=[],f=[],h=n.base_root_id,v=n.input_index_map||{0:"left",1:"right"},p=n[h];if(!p||!1===p.display_node)return{activeProposed:{title:"No Data",sections:[]},activeVariants:[]};var x=function(t,i){var r=n[t];if(!r)return null;var o=R(r,i,v),l=!!o.title.trim(),c=!!o.content.trim(),a=C(r),d=[];r.next&&Object.values(r.next).forEach(function(e){if(n[e]){var t=x(e,i);t&&d.push(t)}});var u=!(!l&&!c);return e({id:t,title:l?o.title:"",content:c?o.content:"",subsections:d},u?a:{score:void 0,relation:"not_defined"})};if(t){var g={},m={},y=-1,b=-1;for(var w in n)if(!["base_root_id","documents","input_index_map",h].includes(w)){var F=n[w];if(F&&!1!==F.display_node){var I=C(F),E=R(F,"0",v),S=R(F,"1",v),_=E.title.trim()||E.content.trim(),T=S.title.trim()||S.content.trim(),D=Number(null!==(r=null===(i=E.attributes)||void 0===i?void 0:i.display_index)&&void 0!==r?r:y--),A=Number(null!==(l=null===(o=S.attributes)||void 0===o?void 0:o.display_index)&&void 0!==l?l:b--),B=m[A]||e(e({id:w,title:T?S.title:"",content:T?S.content:"",subsections:[]},T?I:{score:void 0,relation:"not_defined"}),{refIndexes:[],selfIndex:A}),k=g[D]||e(e({id:w,title:_?E.title:"",content:_?E.content:"",subsections:[]},_?I:{score:void 0,relation:"not_defined"}),{refIndexes:[],selfIndex:D});Number(A)>=0&&Number(D)>=0&&(B.refIndexes.includes(Number(D))||B.refIndexes.push(Number(D)),k.refIndexes.includes(Number(A))||k.refIndexes.push(Number(A))),m[A]=B,g[D]=k}}f=Object.values(m).map(function(e){return e}),s=Object.values(g).map(function(e){return e}),f.sort(function(e,n){return e.selfIndex<0&&n.selfIndex>=0?1:e.selfIndex>=0&&n.selfIndex<0?-1:e.selfIndex-n.selfIndex}),s.sort(function(e,n){return e.selfIndex<0&&n.selfIndex>=0?1:e.selfIndex>=0&&n.selfIndex<0?-1:e.selfIndex-n.selfIndex})}else p.next&&Object.values(p.next).forEach(function(e){var t=n[e];t&&!1!==t.display_node&&(s.push(x(e,"0")||{id:e,title:"",content:"",subsections:[]}),f.push(x(e,"1")||{id:e,title:"",content:"",subsections:[]}))});return{activeProposed:{title:(null===(a=null===(c=p.comparison_inputs)||void 0===c?void 0:c[v[0]])||void 0===a?void 0:a.title)||"Uploaded Contract",description:p.decision_scope_description||"",sections:s},activeVariants:[{id:"tree-variant-1",title:(null===(u=null===(d=p.comparison_inputs)||void 0===d?void 0:d[v[1]])||void 0===u?void 0:u.title)||"Reference Template",similarity:0,sections:f,analysis:{rule_difference_comparison:{summary:{overall_score:0,overall_summary:p.decision_scope_description||""},fields:{}}}}]}}(U,te);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"}},[U,te]),Oe=Ne.activeProposed,Pe=Ne.activeVariants,qe=Ne.parseError;c(function(){qe&&le("Failed to load comparison: ".concat(qe))},[qe]);var Xe=r(null),Ye=Xe[0];Xe[1];var Ve=r({}),Ue=Ve[0],Ke=Ve[1],Ge=r({}),Je=Ge[0],Qe=Ge[1],Ze=(null==Pe?void 0:Pe[0])||z,$e=null===(j=null===(M=null==U?void 0:U.documents)||void 0===M?void 0:M[null===(L=null==U?void 0:U.input_index_map)||void 0===L?void 0:L[0]])||void 0===j?void 0:j.title,en=null===(P=null===(N=null==U?void 0:U.documents)||void 0===N?void 0:N[null===(O=null==U?void 0:U.input_index_map)||void 0===O?void 0:O[1]])||void 0===P?void 0:P.title,nn=I(G||$e||"Uploaded Contract"),tn=I(J||en||"Reference Template"),rn=l(function(){return(null==Oe?void 0:Oe.sections)||[]},[null==Oe?void 0:Oe.sections]),on=l(function(){return Ze.sections||[]},[Ze.sections]),ln=rn.length>0||on.length>0,cn=Ze.analysis,an=I(null===(X=null===(q=null==cn?void 0:cn.rule_difference_comparison)||void 0===q?void 0:q.summary)||void 0===X?void 0:X.overall_summary),dn=!!an.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),un=o({}),sn=function(e){return un.current[e]||(un.current[e]=i.createRef()),un.current[e]},fn=a(function(){de(!1),En(null),fe(!1),Be.current&&(Be.current.style.height="0px"),ke.current&&(ke.current.style.height="0px")},[]),hn=a(function(e,n,t,i,r){var o,l,c=I(n.id)||I(t.id)||"",a=(c?ve[c]:null)||n.cognitiveData||t.cognitiveData||{section_id:c,decisioning:[],gap:[],relevance_score:0},d=null!==(l=null===(o=un.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:d,badgeStyle:r||null,sectionIdx:i,docData:{documents:null==U?void 0:U.documents,input_index_map:null==U?void 0:U.input_index_map}}},[ve]),vn=a(function(e){Me(),ge(null),Se(e)},[Me]),pn=a(function(){null!==Re.sectionIdx&&Re.anchorEl?vn(e(e({},Re),{open:!0})):Me()},[Re,Me,vn]);a(function(e){Me(),le("".concat(e," is coming soon."))},[Me]);var xn=o(null),gn=o(null),mn=o(null),yn=r([]),bn=yn[0],wn=yn[1],Fn=r(null),In=Fn[0],En=Fn[1],Sn=o(null),Cn=r(null),Rn=Cn[0],_n=Cn[1],Tn=l(function(){return je.fields.filter(function(e){var n=e.key;return(!ln||"description"!==n)&&(E(null==Oe?void 0:Oe[n])||E(Ze[n]))})},[Oe,Ze,ln,je.fields]),Dn=o({}),An=o({}),Bn=o({}),kn=o({}),zn=o({}),Hn=o({}),Wn=o({});Tn.forEach(function(e){for(var n=e.key,t=0;t<Math.max(rn.length,on.length);t+=1)Bn.current[t]||(Bn.current[t]=i.createRef()),kn.current[t]||(kn.current[t]=i.createRef()),zn.current[t]||(zn.current[t]=i.createRef()),Hn.current[t]||(Hn.current[t]=i.createRef()),Wn.current[t]||(Wn.current[t]=i.createRef());Dn.current[n]||(Dn.current[n]=i.createRef()),An.current[n]||(An.current[n]=i.createRef())});for(var Mn=0;Mn<Math.max(rn.length,on.length);Mn+=1)Bn.current[Mn]||(Bn.current[Mn]=i.createRef()),kn.current[Mn]||(kn.current[Mn]=i.createRef()),zn.current[Mn]||(zn.current[Mn]=i.createRef()),Hn.current[Mn]||(Hn.current[Mn]=i.createRef()),Wn.current[Mn]||(Wn.current[Mn]=i.createRef());c(function(){if(Ye){var e=je.fields.find(function(e){return e.analysisKey===Ye||e.key===Ye});if(e){var n=Dn.current[e.key]||An.current[e.key];(null==n?void 0:n.current)&&setTimeout(function(){return n.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[Ye,je.fields]);var Ln=a(function(e){var n,t,i,r,o,l,c,a,d,u=null===(n=null==cn?void 0:cn.rule_difference_comparison)||void 0===n?void 0:n.fields;if(!u||!u[e])return{score:0,relation:"",highlightsA:[],highlightsB:[],hasContent:!1};var s=u[e],f=(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 h=s.mappings[0]||{};return{score:s.score,relation:h.relation||"",highlightsA:(null===(l=h.highlights)||void 0===l?void 0:l.ruleA_spans)||[],highlightsB:(null===(c=h.highlights)||void 0===c?void 0:c.ruleB_spans)||[],hasContent:!!f}}return{score:s.score,relation:s.relation||"",highlightsA:(null===(a=s.highlights)||void 0===a?void 0:a.ruleA_spans)||[],highlightsB:(null===(d=s.highlights)||void 0===d?void 0:d.ruleB_spans)||[],hasContent:!!f}},[cn]),jn=a(function(n){var t,i,r,o,l=rn[n],c=on[n],a=(null==l?void 0:l.relation)&&"not_defined"!==l.relation,d=(null==c?void 0:c.relation)&&"not_defined"!==c.relation,u=I(null==l?void 0:l.id)||I(null==c?void 0:c.id)||"",s=!(!(null==l?void 0:l.cognitiveData)&&!(null==c?void 0:c.cognitiveData));if(!a&&!d&&!s)return e(e({},je.relationStyles.noContent),{label:"Not Defined"});var f=Ln("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:u?null===(r=ve[u])||void 0===r?void 0:r.relevance_score:void 0)){var h=_(),v=h.score,p=h.relation;return S(v,p,!0,je)}var x=a?l.relation:d?c.relation:f.relation,g=null!==(o=null==l?void 0:l.score)&&void 0!==o?o:null==c?void 0:c.score,m="number"==typeof g?g:f.score;return S(m,x,!0,je)},[rn,on,ve,je,Ln]),Nn=a(function(){var e,n,t,i,r,o,l,c,a,d,u;if(!ze.current){ze.current=!0;try{if(!xn.current)return;var s=xn.current.getBoundingClientRect();we({width:s.width,height:s.height});var f=[];if(Tn.forEach(function(e){var n,t,i=e.key,r=null===(n=Dn.current[i])||void 0===n?void 0:n.current,o=null===(t=An.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")}),!te)for(var h=0;h<Math.min(rn.length,on.length);h++){var v=null===(e=Bn.current[h])||void 0===e?void 0:e.current,p=null===(n=kn.current[h])||void 0===n?void 0:n.current;v&&p&&(v.style.height="auto",p.style.height="auto",v.style.minHeight="0px",p.style.minHeight="0px")}var x={};Tn.forEach(function(e){var n,t,i=e.key,r=null===(n=Dn.current[i])||void 0===n?void 0:n.current,o=null===(t=An.current[i])||void 0===t?void 0:t.current;if(r&&o){var l=r.getBoundingClientRect(),c=o.getBoundingClientRect();x[i]=Math.max(l.height,c.height)}});var g=[];if(!te)for(h=0;h<Math.min(rn.length,on.length);h++){v=null===(t=Bn.current[h])||void 0===t?void 0:t.current,p=null===(i=kn.current[h])||void 0===i?void 0:i.current;if(v&&p){var m=v.getBoundingClientRect(),y=p.getBoundingClientRect();g[h]=Math.max(m.height,y.height)}}if(Tn.forEach(function(e){var n,t,i=e.key,r=null===(n=Dn.current[i])||void 0===n?void 0:n.current,o=null===(t=An.current[i])||void 0===t?void 0:t.current;if(r&&o){var l=x[i];r.style.minHeight="".concat(l,"px"),o.style.minHeight="".concat(l,"px")}}),!te)for(h=0;h<g.length;h++){v=null===(r=Bn.current[h])||void 0===r?void 0:r.current,p=null===(o=kn.current[h])||void 0===o?void 0:o.current;if(v&&p){var b=g[h];v.style.minHeight="".concat(b,"px"),p.style.minHeight="".concat(b,"px")}}if(Tn.forEach(function(e){var n,t,i=e.key,r=e.analysisKey,o=null===(n=Dn.current[i])||void 0===n?void 0:n.current,l=null===(t=An.current[i])||void 0===t?void 0:t.current;if(o&&l){var c=o.getBoundingClientRect(),a=l.getBoundingClientRect(),d=Ln(r),u=S(d.score,d.relation,d.hasContent,je);if(!u)return;var h=c.top+c.height/2-s.top;f.push({id:"field-".concat(i),x1:c.right-s.left,y1:h,x2:a.left-s.left,y2:h,style:u})}}),te)rn.forEach(function(e,n){var t;(null===(t=Bn.current[n])||void 0===t?void 0:t.current)&&(e.refIndexes||[]).forEach(function(e){var t,i,r=on.findIndex(function(n){return n.selfIndex===e});if(-1!==r){var o=null===(t=zn.current[n])||void 0===t?void 0:t.current,l=null===(i=Hn.current[r])||void 0===i?void 0:i.current;if(o&&l){var c=o.getBoundingClientRect(),a=l.getBoundingClientRect(),d=c.right-s.left,u=a.left-s.left,h=c.top+c.height/2-s.top,v=a.top+a.height/2-s.top;ae&&In===n&&(v=h);var p=jn(n);p&&f.push({id:"line-".concat(n,"-").concat(r),x1:d,y1:h,x2:u,y2:v,style:p,sectionIdx:n,targetRightIdx:r})}}})});else for(h=0;h<Math.min(rn.length,on.length);h++){var w=null===(l=Bn.current[h])||void 0===l?void 0:l.current,F=null===(c=kn.current[h])||void 0===c?void 0:c.current;if(w&&F){var I=w.querySelector(".MuiAccordionSummary-root"),E=F.querySelector(".MuiAccordionSummary-root");if(I&&E){var C=I.getBoundingClientRect(),R=E.getBoundingClientRect(),_=(C.top+C.height/2-s.top+R.top+R.height/2-s.top)/2,T=(null===(a=on[h])||void 0===a?void 0:a.id)||"sec-".concat(h),D=jn(h);D&&f.push({id:T,x1:C.right-s.left,y1:_,x2:R.left-s.left,y2:_,style:D,sectionIdx:h,hasCognitive:!!((null===(d=rn[h])||void 0===d?void 0:d.cognitiveData)||(null===(u=on[h])||void 0===u?void 0:u.cognitiveData)||T&&ve[T])})}}}if(wn(f),gn.current&&mn.current){var A=gn.current.getBoundingClientRect(),B=mn.current.getBoundingClientRect(),k=(A.top+A.height/2-s.top+B.top+B.height/2-s.top)/2;_n({x1:A.right-s.left,x2:B.left-s.left,y:k})}else _n(null)}catch(e){console.error("Line render safe fail: ",e)}finally{ze.current=!1}}},[Tn,rn,on,ve,je,Ln,jn,te,ae,In]),On=o(Nn);c(function(){On.current=Nn},[Nn]);var Pn=a(function(){null!==Sn.current&&window.cancelAnimationFrame(Sn.current),Sn.current=window.requestAnimationFrame(function(){On.current(),Sn.current=null})},[]),qn=a(function(){var e=Re.sectionIdx;Me(),null!==e&&(ae&&In===e?fn():(he.current=!0,En(e),de(!0),fe(!1),Be.current&&(Be.current.style.height="0px"),ke.current&&(ke.current.style.height="0px"),requestAnimationFrame(function(){var n,t,i=null===(n=un.current[e])||void 0===n?void 0:n.current,r=rn[e],o=(null==r?void 0:r.refIndexes)||[],l=null;if(o.length>0){var c=o[0],a=on.findIndex(function(e){return e.selfIndex===c});l=null===(t=Wn.current[a])||void 0===t?void 0:t.current}var d=null==i?void 0:i.parentElement,u=Ae.current;if(i&&d){var s=i.offsetTop-d.scrollTop,f=null;if(l&&u){var h=l.offsetTop-s;if(h<0)Be.current&&(Be.current.style.height="".concat(Math.abs(h),"px")),f=0;else{var v=u.scrollHeight-u.clientHeight;h>v?(ke.current&&(ke.current.style.height="".concat(h-v+150,"px")),f=h):f=h}}u&&null!==f?function(e,n,t,i){void 0===t&&(t=300);var r=e.style.scrollBehavior;e.style.scrollBehavior="auto";var o=e.scrollTop,l=n-o,c=null,a=function(d){null===c&&(c=d);var u,s=d-c;s<t?(e.scrollTop=(u=s,u/=t,l*(--u*u*u+1)+o),requestAnimationFrame(a)):(e.scrollTop=n,e.style.scrollBehavior=r,i&&i())};requestAnimationFrame(a)}(u,f,300,function(){fe(!0),Pn(),setTimeout(function(){he.current=!1},50)}):setTimeout(function(){fe(!0),Pn(),he.current=!1},350)}})))},[Me,Re.sectionIdx,ae,In,rn,on,Pn,fn]),Xn=a(function(){he.current||(Pn(),ae&&!he.current&&(de(!1),En(null),fe(!1),Be.current&&(Be.current.style.height="0px"),ke.current&&(ke.current.style.height="0px")))},[Pn,ae]);c(function(){var e=setTimeout(Pn,250);window.addEventListener("resize",Pn);var n=null,t=null;return Te.current&&(n=new ResizeObserver(Pn)).observe(Te.current),xn.current&&(t=new ResizeObserver(Pn)).observe(xn.current),function(){clearTimeout(e),window.removeEventListener("resize",Pn),null==n||n.disconnect(),null==t||t.disconnect()}},[Oe,Ze,cn,Tn,Ue,Je,rn,on,je,Pn,ae,In,se]);var Yn=function(r,o,l,c,a){void 0===a&&(a=1);var u,s=te?!!Ue["".concat(l,"-").concat(o)]:!!Ue[String(o)],h=E(r.title),v=E(r.content),b=!h&&!v,w=r.title;return h||(w=v?"No Title Found":"No Matching Section Found"),t(d,e({ref:c,sx:e(e({mb:a},te?{height:"fit-content"}:{minHeight:0}),{display:"flex",flexDirection:"column",position:"relative"})},{children:n(x,e({disableGutters:!0,expanded:!b&&s,onChange:function(){return!b&&function(n,t){Ke(function(i){var r=e({},i);if(!te){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==(a=rn[n])?void 0:a.refIndexes)||[]).forEach(function(e){var n=on.findIndex(function(n){return n.selfIndex===e});-1!==n&&(r["right-".concat(n)]=c)});else{var a,d=null==(a=on[n])?void 0:a.selfIndex;rn.forEach(function(e,n){var t;(null===(t=e.refIndexes)||void 0===t?void 0:t.includes(d))&&(r["left-".concat(n)]=c)})}return r})}(o,l)},sx:{boxShadow:"none",border:b?"1px dashed #E2E8F0":"1px solid #E2E8F0",bgcolor:b?"#FAFAFA":"#FFFFFF",borderRadius:"6px",flex:1,display:"flex",flexDirection:"column","&:before":{display:"none"}}},{children:[t(g,e({expandIcon:b?null:t(y,{size:16}),sx:{minHeight:"36px",flexShrink:0,cursor:b?"default":"pointer","& .MuiAccordionSummary-content":{my:.5,display:"flex",alignItems:"center",overflow:"hidden"},"& .MuiAccordionSummary-expandIconWrapper":{transition:"transform 0.2s ease"},"& .MuiAccordionSummary-expandIconWrapper.Mui-expanded":{transform:"rotate(180deg)"}}},{children:t(p,e({title:w,placement:"top"},{children:t(f,e({sx:{fontSize:"12px",color:b?"#94A3B8":"#19213D",fontWeight:b?400:700,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},{children:(u=w,u?I(u).replace(/\\n/g,"\n").split(/(\*\*.*?\*\*)/g).map(function(e,n){return e.startsWith("**")&&e.endsWith("**")?t("strong",{children:e.slice(2,-2)},n):t(i.Fragment,{children:e},n)}):null)}))}))})),!b&&n(m,e({sx:{pt:0,pb:1.25,bgcolor:"#FFFFFF",flex:1,display:"flex",flexDirection:"column"}},{children:[t(f,e({component:"div",sx:Fe},{children:t(F,{children:I(r.content).replace(/\\n/g,"\n")})})),(r.subsections||[]).map(function(e,n){return Vn(e,"".concat(o,"-").concat(n),0)})]}))]}))}),"".concat(l,"-sec-").concat(o))},Vn=function(i,r,o){void 0===o&&(o=0);var l=E(i.title),c=E(i.content),a=!l&&!c,u=l?i.title:c?"No Title Found":"No Matching Section Found",s=!!Je[r];return i.title?n(x,e({disableGutters:!0,expanded:!a&&s,onChange:function(){return!a&&Qe(function(n){var t;return e(e({},n),((t={})[r]=!n[r],t))})},sx:{mt:1,boxShadow:"none",border:a?"1px dashed #E2E8F0":"1px solid #EEF2F7",borderRadius:"4px !important",bgcolor:"#FFFFFF","&:before":{display:"none"}}},{children:[t(g,e({expandIcon:a?null:t(y,{size:14}),sx:{minHeight:"32px","& .MuiAccordionSummary-content":{my:.5}}},{children:t(f,e({sx:{fontSize:"11px",fontWeight:600,color:a?"#94A3B8":"#19213D"}},{children:u||"Untitled Subsection"}))})),!a&&n(m,e({sx:{pt:0,pb:1}},{children:[c&&t(f,e({component:"div",sx:Fe},{children:t(F,{children:I(i.content).replace(/\\n/g,"\n")})})),(i.subsections||[]).map(function(e,n){return Vn(e,"".concat(r,"-").concat(n),o+1)})]}))]}),r):t(d,e({sx:{mt:0===o?1:.75}},{children:!a&&n("div",{children:[c&&t(f,e({component:"div",sx:Fe},{children:t(F,{children:I(i.content).replace(/\\n/g,"\n")})})),(i.subsections||[]).map(function(e,n){return Vn(e,"".concat(r,"-").concat(n),o+1)})]})}),r)};return n(d,e({ref:De,sx:e(e({display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif'},te?{}:{overflow:"visible"}),{position:"relative"})},{children:[te&&t(k,{open:Re.open,anchorEl:Re.anchorEl,sectionTitle:Re.sectionTitle,referenceSectionTitle:Re.refSectionTitle,onClose:Me,onOpenCognitiveCompare:pn,onOpenSideBySide:qn}),Ee.open&&t(B,{open:Ee.open,popupRef:me,position:xe,popupConfig:ee,onClose:function(){ge(null),Se(function(n){return e(e({},n),{open:!1})})},markdownStyles:Q,sectionTitle:Ee.sectionTitle,referenceSectionTitle:Ee.refSectionTitle,cognitiveData:Ee.cognitiveData,anchorEl:Ee.anchorEl,sectionAnchorEl:Ee.sectionAnchorEl,scrollContainerEl:Te.current,badgeStyle:Ee.badgeStyle,docData:Ee.docData}),t(u,e({open:!!oe,autoHideDuration:8e3,onClose:function(){return le(null)},anchorOrigin:{vertical:"top",horizontal:"center"}},{children:t(s,e({onClose:function(){return le(null)},severity:"error",sx:{width:"100%",whiteSpace:"pre-line"}},{children:oe}))})),n(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:[t(d,e({sx:{display:"flex",alignItems:"center",gap:1}},{children:t(f,e({sx:{fontSize:"16px",fontWeight:600,color:"#0F172A"}},{children:V}))})),t(d,e({sx:{display:"flex",alignItems:"center"}},{children:t(h,{control:t(v,{checked:te,onChange:function(e){return ie(e.target.checked)},color:"primary",size:"small"}),label:t(f,e({sx:{fontSize:"13px",fontWeight:500,color:"#64748B"}},{children:"Relative Order"})),labelPlacement:"start",sx:{m:0,gap:1}})}))]})),t(d,e({ref:Te,onScroll:Xn,sx:{flex:1,minHeight:0,pt:1.5,pb:8,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",overflowY:te?"hidden":"auto",borderTop:an&&dn?"none":"1.5px solid #EEF0F4"}},{children:t(d,e({sx:e({display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"},te?{flex:1,minHeight:0}:{})},{children:n(d,e({ref:xn,sx:e({display:"grid",gridTemplateColumns:"minmax(0, 1fr) 180px minmax(0, 1fr)",gap:"60px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0},te?{flex:1,overflow:"visible"}:{})},{children:[n("svg",e({style:{position:"absolute",top:0,left:0,width:be.width||"100%",height:be.height||"100%",pointerEvents:"none",zIndex:10,overflow:"visible"}},{children:[Rn&&n("g",{children:[t("line",{x1:Rn.x1,y1:Rn.y,x2:Math.max(Rn.x1,(Rn.x1+Rn.x2)/2-70),y2:Rn.y,stroke:"#BBF7D0",strokeWidth:"1.5"}),t("line",{x1:Math.min(Rn.x2,(Rn.x1+Rn.x2)/2+70),y1:Rn.y,x2:Rn.x2,y2:Rn.y,stroke:"#BBF7D0",strokeWidth:"1.5"})]}),bn.map(function(i){var r,o=(i.x1+i.x2)/2;if("Not Defined"===i.style.label&&!i.hasCognitive)return null;if(!te)return n("g",{children:[t("line",{x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2,stroke:i.style.badgeBorder||"#E2E8F0",strokeWidth:"1.5"}),t("foreignObject",e({x:o-100,y:i.y1-14,width:"200",height:"28",style:{pointerEvents:"auto",overflow:"visible"}},{children:t(d,e({sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},{children:n(d,e({onClick:function(e){var n=rn[i.sectionIdx]||{title:"",content:""},t=on[i.sectionIdx]||{title:"",content:""};vn(hn(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,t(d,e({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:t(w,{})})),t(y,{size:11})]}))}))}))]},i.id);var l=rn[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:ae&&In===i.sectionIdx&&se?n("g",e({style:{transition:"opacity 0.2s"}},{children:[t("defs",{children:t("marker",e({id:"arr-".concat(i.id),markerWidth:"7",markerHeight:"5",refX:"7",refY:"2.5",orient:"auto"},{children:t("polygon",{points:"0 0, 7 2.5, 0 5",fill:i.style.badgeBorder||"#6366F1"})}))}),t("line",{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})]})),n(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)"},te?{flex:1,overflow:"visible"}:{})},{children:[t(d,e({ref:gn,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E7E7E9",borderRadius:"8px 8px 0 0",display:"flex",minHeight:"40px",alignItems:"center",overflowX:"hidden"}},{children:t(p,e({title:nn,placement:"top"},{children:t(f,e({sx:{fontSize:"16px",fontWeight:500,color:"#19213D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",height:"40px"}},{children:nn}))}))})),t(d,e({onScroll:Xn,sx:e({p:"12px",display:"flex",flexDirection:"column"},te?{maxHeight:"500px",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,mr:"-160px",pr:"172px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:ln&&rn.map(function(r,o){var l;if(!te)return t(d,e({ref:sn(o)},{children:Yn(r,o,"left",Bn.current[o])}),"left-row-".concat(o));var c=r,a=jn(o),u=!(null===(l=c.refIndexes)||void 0===l?void 0:l.length)||c.selfIndex<0,s="number"==typeof c.selfIndex&&c.selfIndex>=0?c.selfIndex+1:null;return t(d,e({ref:sn(o),sx:{mb:1}},{children:n(d,e({sx:{position:"relative",width:"100%"}},{children:[t(d,e({ref:Bn.current[o],sx:{width:"100%"}},{children:Yn(r,o,"left",i.createRef(),0)})),a&&n(d,e({ref:zn.current[o],onClick:function(e){var n=on.find(function(e){var n;return null===(n=c.refIndexes)||void 0===n?void 0:n.includes(e.selfIndex)})||{title:"",content:""};!function(e,n,t,i,r){e.stopPropagation(),Re.open&&Re.sectionIdx===i?Me():(We(),_e(hn(e.currentTarget,n,t,i,r)))}(e,r,n,o,a)},sx:{position:"absolute",top:"18px",right:0,transform:"translateY(-50%) translateX(calc(100% + 8px))",display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",bgcolor:a.badgeBg,color:a.badgeText,border:"1px solid ".concat(a.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!==s&&t(d,e({component:"span",sx:{fontSize:"11px",fontWeight:700,pr:.5,borderRight:"1px solid ".concat(a.badgeBorder)}},{children:s})),t(d,e({component:"span",sx:{fontSize:"11px",px:.25}},{children:u?"No Deviation Found":0==a.deviationLabel||void 0===a.deviationLabel?"Same":"".concat(a.deviationLabel,"% Deviation")})),t(b,{size:11,color:a.badgeText})]}))]}))}),"left-row-".concat(o))})}))]})),t(d,e({sx:{width:"180px",display:"flex",flexDirection:"column",alignItems:"center",pt:"6px",gap:0}},{children:t(d,e({sx:{display:"flex",justifyContent:"center",alignItems:"center",mt:0}},{children:n(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:[t(d,e({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:t(w,{})})),0,"% Similarity",t(y,{size:11})]}))}))})),n(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},te?{flex:1,overflow:"visible",minHeight:0}:{})},{children:[t(d,e({ref:mn,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E3E6EA",borderRadius:"8px 8px 0 0",minHeight:"40px",display:"flex",alignItems:"center",overflowX:"hidden"}},{children:t(p,e({title:tn,placement:"top"},{children:t(f,e({sx:{fontSize:"16px",fontWeight:500,color:"#5928ED",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",height:"40px"}},{children:tn}))}))})),n(d,e({ref:Ae,onScroll:Xn,sx:e({p:"12px",display:"flex",flexDirection:"column"},te?{maxHeight:"500px",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,ml:"-160px",pl:"172px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[t("div",{ref:Be,style:{width:"100%",height:"0px",flexShrink:0}}),ln&&on.map(function(r,o){if(!te)return Yn(r,o,"right",kn.current[o]);var l=r,c=rn.filter(function(e){var n;return(null===(n=e.refIndexes)||void 0===n?void 0:n.includes(l.selfIndex))&&e.selfIndex>=0}).map(function(e){return e.selfIndex+1});return t(d,e({ref:Wn.current[o],sx:{mb:1}},{children:n(d,e({sx:{position:"relative",width:"100%"}},{children:[t(d,e({ref:kn.current[o],sx:{width:"100%"}},{children:Yn(r,o,"right",i.createRef(),0)})),t(d,e({ref:Hn.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:c.length>0?c.join(", "):"-"}))]}))}),"right-row-".concat(o))}),t("div",{ref:ke,style:{width:"100%",height:"0px",flexShrink:0}})]}))]}))]}))}))}))]}))};export{W as default};
|
|
2
2
|
//# sourceMappingURL=CognitiveCompare.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommonConstants.d.ts","sourceRoot":"","sources":["../../../../src/CommonConstants/CommonConstants.tsx"],"names":[],"mappings":"AACA,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,OAAO,CAAC;AAC5C,eAAO,MAAM,OAAO,EAAE,aAAqB,CAAC;AAC5C,eAAO,MAAM,SAAS,EAAE,aAAuB,CAAC;AAChD,eAAO,MAAM,6BAA6B,yCAAwC,CAAA;AAElF,eAAO,MAAM,iBAAiB,EAAE,
|
|
1
|
+
{"version":3,"file":"CommonConstants.d.ts","sourceRoot":"","sources":["../../../../src/CommonConstants/CommonConstants.tsx"],"names":[],"mappings":"AACA,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,OAAO,CAAC;AAC5C,eAAO,MAAM,OAAO,EAAE,aAAqB,CAAC;AAC5C,eAAO,MAAM,SAAS,EAAE,aAAuB,CAAC;AAChD,eAAO,MAAM,6BAA6B,yCAAwC,CAAA;AAElF,eAAO,MAAM,iBAAiB,EAAE,GAyxG/B,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CognitiveCompareProps } from "./CognitiveCompareTypes";
|
|
2
2
|
import { SHARED_MARKDOWN_STYLES } from "./CognitiveCompareConfig";
|
|
3
|
-
declare const CognitiveCompare: ({ componentHeaderText, treeData, comparisonConfig, leftColumnTitleText, rightColumnTitleText, markdownStyles, maintainRelativeOrder, popupConfig, }: CognitiveCompareProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
declare const CognitiveCompare: ({ componentHeaderText, treeData, comparisonConfig, leftColumnTitleText, rightColumnTitleText, markdownStyles, maintainRelativeOrder: initialMaintainRelativeOrder, popupConfig, }: CognitiveCompareProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
export { SHARED_MARKDOWN_STYLES };
|
|
5
5
|
export default CognitiveCompare;
|
|
6
6
|
//# sourceMappingURL=CognitiveCompare.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CognitiveCompare.d.ts","sourceRoot":"","sources":["../../../../../src/features/CognitiveCompare/CognitiveCompare.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CognitiveCompare.d.ts","sourceRoot":"","sources":["../../../../../src/features/CognitiveCompare/CognitiveCompare.tsx"],"names":[],"mappings":"AA+BA,OAAO,EAIL,qBAAqB,EAMtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAGL,sBAAsB,EACvB,MAAM,0BAA0B,CAAC;AA4PlC,QAAA,MAAM,gBAAgB,sLASnB,qBAAqB,4CA+0DvB,CAAC;AACF,OAAO,EAAE,sBAAsB,EAAE,CAAC;AAClC,eAAe,gBAAgB,CAAC"}
|