@viswa-test/test-citation 0.0.82 → 0.0.84

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.
@@ -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"),o=require("lucide-react"),r=require("../../assests/svg/ButtonCognitiveIcon.js"),l=require("./OverlayComponent.js"),u=require("./CognitiveComparehelpers.js"),c=require("./CognitiveCompareConfig.js"),s=require("./CognitiveCompareConstants.js"),a=require("./CognitivePopup.js"),d=require("./MoreFunctionsPopup.js"),v=require("./LoaderComponent.js"),g=require("./components/ThreeDotsLoader.js"),f=require("./hooks/useCompareData.js"),p=require("./hooks/useComparePopups.js"),h=require("./hooks/useSectionRefs.js"),x=require("./hooks/useAccordionState.js"),m=require("./hooks/useDeviationNavigation.js"),_=require("./components/CompareHeader.js"),R=require("./components/SectionAccordion.js"),y=require("./components/SubSectionAccordion.js"),S=require("./components/CognitiveSummaryPopup.js");exports.SHARED_MARKDOWN_STYLES=c.SHARED_MARKDOWN_STYLES,exports.default=function(b){var A,E,T,I,B,C,D,O,w,j,P,N,F,k,M,L=b.componentHeaderText,H=void 0===L?s.DEFAULT_COMPONENT_HEADER_TEXT:L,V=b.treeData,G=b.comparisonConfig,q=b.leftColumnTitleText,z=b.rightColumnTitleText,W=b.markdownStyles,Y=b.displayConfig,K=void 0===Y?{isHeaderVisible:!0,isToggleVisible:!0,maintainRelativeOrder:!1,isLoading:!0}:Y,U=b.popupConfig,X=b.deviationData,J=void 0===X?{}:X,Q=b.deviationNodeIdToView,Z=t.useState(K.maintainRelativeOrder),$=Z[0],ee=Z[1],ne=t.useState(!1),te=ne[0],ie=ne[1],oe=t.useState(!1),re=oe[0],le=oe[1],ue=t.useState(null),ce=ue[0],se=ue[1],ae=t.useState(!1),de=ae[0],ve=ae[1],ge=t.useState(!1),fe=ge[0],pe=ge[1],he=t.useState(!1),xe=he[0],me=he[1],_e=t.useState(null),Re=_e[0],ye=_e[1],Se=t.useRef(!1),be=t.useState(new Set),Ae=be[0],Ee=be[1],Te=t.useState([]),Ie=Te[0],Be=Te[1],Ce=t.useRef(null),De=t.useRef(!1),Oe=t.useRef(null),we=t.useRef({}),je=t.useRef([]),Pe=t.useRef(!1),Ne=t.useRef(!1),Fe=t.useRef(null),ke=t.useRef(function(){}),Me=t.useMemo(function(){return(null==V?void 0:V.cognitive_decisioning)||{}},[V]),Le=t.useState({width:0,height:0}),He=Le[0],Ve=Le[1],Ge=t.useMemo(function(){return e.__assign(e.__assign({},c.SHARED_MARKDOWN_STYLES),W)},[W]),qe=t.useRef(null),ze=t.useRef(null),We=t.useRef(null),Ye=t.useRef(null),Ke=t.useRef(null),Ue=t.useRef(null),Xe=t.useRef(null),Je=t.useRef(null),Qe=t.useRef(!1),Ze=t.useRef(null),$e=t.useRef(null),en=p.useComparePopups(qe),nn=en.cognitivePopup,tn=en.setCognitivePopup,on=en.moreFunctions,rn=en.setMoreFunctions,ln=en.position,un=en.setPosition,cn=en.activeBadgeId,sn=en.summaryPopup,an=en.setSummaryPopup,dn=en.closeSummaryPopup,vn=en.setActiveBadgeId,gn=en.popupRef,fn=en.closeCognitivePopup,pn=en.closeMoreFunctionsPopup,hn=t.useMemo(function(){var e,n,t,i,o,r,l;return{fields:null!==(e=null==G?void 0:G.fields)&&void 0!==e?e:c.DEFAULT_FIELD_CONFIG,thresholds:{high:null!==(t=null===(n=null==G?void 0:G.thresholds)||void 0===n?void 0:n.high)&&void 0!==t?t:c.DEFAULT_COMPARISON_CONFIG.thresholds.high,medium:null!==(o=null===(i=null==G?void 0:G.thresholds)||void 0===i?void 0:i.medium)&&void 0!==o?o:c.DEFAULT_COMPARISON_CONFIG.thresholds.medium,exact:null!==(l=null===(r=null==G?void 0:G.thresholds)||void 0===r?void 0:r.exact)&&void 0!==l?l:c.DEFAULT_COMPARISON_CONFIG.thresholds.exact}}},[G]),xn=t.useState(null),mn=xn[0];xn[1];var _n=null===(T=null===(A=null==V?void 0:V.documents)||void 0===A?void 0:A[null===(E=null==V?void 0:V.input_index_map)||void 0===E?void 0:E[0]])||void 0===T?void 0:T.title,Rn=null===(C=null===(I=null==V?void 0:V.documents)||void 0===I?void 0:I[null===(B=null==V?void 0:V.input_index_map)||void 0===B?void 0:B[1]])||void 0===C?void 0:C.title,yn=u.safeStringify(q||_n||"Uploaded Contract"),Sn=u.safeStringify(z||Rn||"Reference Template"),bn=f.useCognitiveTreeData(V,$,J,hn),An=bn.activeProposed,En=bn.existingRule,Tn=bn.proposedSections,In=bn.existingSections,Bn=bn.visibleFields,Cn=bn.parentDeviationRecord,Dn=bn.deviationNumberRegistry,On=bn.parseError;t.useEffect(function(){On&&se("Failed to load comparison: ".concat(On))},[On]);var wn=Tn.length>0||In.length>0,jn=h.useSectionRefs(Bn.map(function(e){return e.key}),Math.max(Tn.length,In.length)),Pn=jn.leftRefs,Nn=jn.rightRefs,Fn=jn.sectionLeftRefs,kn=jn.sectionRightRefs,Mn=jn.lhsBadgeRefs,Ln=jn.rhsBadgeRefs,Hn=jn.sectionRightRowRefs,Vn=jn.subSectionLeftRefs,Gn=jn.subSectionRightRefs,qn=jn.sectionRowRefs,zn=jn.getSectionRowRef,Wn=jn.getSubSectionRef,Yn=jn.getBadgeRef,Kn=En.analysis,Un=u.safeStringify(null===(O=null===(D=null==Kn?void 0:Kn.rule_difference_comparison)||void 0===D?void 0:D.summary)||void 0===O?void 0:O.overall_summary),Xn=!!Un.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),Jn=null!==(w=null==V?void 0:V.base_root_id)&&void 0!==w?w:"-1";null==V||V[Jn];var Qn=(null===(j=null==J?void 0:J[Jn])||void 0===j?void 0:j.evaluation_result)||(null===(N=null===(P=null==V?void 0:V.nodes)||void 0===P?void 0:P[Jn])||void 0===N?void 0:N.evaluation_result)||null,Zn=u.extractDeviationScore(Qn),$n=u.generateColorPalette(null!==(M=null===(k=null===(F=null==Qn?void 0:Qn.evaluation_outputs)||void 0===F?void 0:F.metadata)||void 0===k?void 0:k.label_color)&&void 0!==M?M:""),et=t.useCallback(function(){var e,n,t,i,o,r;ve(!1),Ne.current=!1;var l=Fe.current,c=gt.current;if(null!==l)if("string"==typeof l&&l.includes(u.DEVIATION_BADGE_SEPARATOR)){var s=l.split(u.DEVIATION_BADGE_SEPARATOR);(a=(null===(e=Vn.current[s[2]])||void 0===e?void 0:e.current)||(null===(n=Fn.current[Number(s[2])])||void 0===n?void 0:n.current))&&(a.style.paddingTop="0px")}else{var a;(a=null===(t=Fn.current[l])||void 0===t?void 0:t.current)&&(a.style.paddingTop="0px")}if(null!==c)if("string"==typeof c&&c.includes(u.DEVIATION_BADGE_SEPARATOR)){s=c.split(u.DEVIATION_BADGE_SEPARATOR);(d=(null===(i=Gn.current[s[3]])||void 0===i?void 0:i.current)||(null===(o=kn.current[Number(s[3])])||void 0===o?void 0:o.current))&&(d.style.paddingTop="0px")}else{var d;(d=null===(r=kn.current[c])||void 0===r?void 0:r.current)&&(d.style.paddingTop="0px")}ye(null),Fe.current=null,gt.current=null,pe(!1),le(!1),Ye.current&&(Ye.current.style.height="0px"),Ke.current&&(Ke.current.style.height="0px"),Ue.current&&(Ue.current.style.height="0px"),Xe.current&&(Xe.current.style.height="0px")},[]),nt=x.useAccordionState({maintainRelativeOrder:!!$,proposedSections:Tn,existingSections:In,activeSideBySideSection:Re,connectedSections:Ae,resetSideBySide:et,setConnectedSections:Ee,setConnectedLines:Be,cachedConnectedPositions:je,svgContainerRef:Ce,isAnimatingRef:De,animationTimerRef:Oe,calculateLinesRef:ke,sectionLeftRefs:Fn,sectionRightRefs:kn,subSectionLeftRefs:Vn,subSectionRightRefs:Gn}),tt=nt.expandedSections,it=nt.expandedSubSections,ot=nt.setExpandedSubSections,rt=nt.toggleSection,lt=t.useCallback(function(e,n,t,i,o,r,l){var c,s,a,d=u.safeStringify(null==n?void 0:n.id)||u.safeStringify(null==t?void 0:t.id)||"",v=(d?Me[d]:null)||(null==n?void 0:n.cognitiveData)||(null==t?void 0:t.cognitiveData)||{section_id:d,decisioning:[],gap:[],relevance_score:0},g=null!==(s=null===(c=qn.current[i])||void 0===c?void 0:c.current)&&void 0!==s?s:null;return{isLoading:null!==(a=null==K?void 0:K.isLoading)&&void 0!==a&&a,open:!0,sectionTitle:(null==n?void 0:n.displayTitle)?null==n?void 0:n.title:"no title",refSectionTitle:(null==t?void 0:t.displayTitle)?null==t?void 0:t.title:"no title",cognitiveData:v,anchorEl:e,sectionAnchorEl:g,badgeStyle:r||null,sectionIdx:i,docData:{documents:null==V?void 0:V.documents,input_index_map:null==V?void 0:V.input_index_map},deviationData:(null==n?void 0:n.evaluationResult)||(null==t?void 0:t.evaluationResult)||null,isOrphan:!!o}},[Me,V]),ut=t.useCallback(function(e){pn(),un(null),tn(e)},[pn]),ct=function(e,n,t,i,o,r){e.stopPropagation(),on.open&&on.sectionIdx===o?pn():(fn(),sn.open?Ft():dn(),rn(lt(e.currentTarget,n,i,o,t,r)))},st=t.useCallback(function(){null!==on.sectionIdx&&on.anchorEl?ut(e.__assign(e.__assign({},on),{open:!0})):pn()},[on,pn,ut]),at=t.useCallback(function(){var e=on.sectionIdx,n=on.isOrphan;pn(),dn(),null!==e&&(n?se("No counterpart exists to connect to."):(Ne.current&&et(),Be([]),je.current=[],Ee(function(n){return n.has(e)?new Set:new Set([e])}),setTimeout(function(){ke.current&&ke.current()},50)))},[on.sectionIdx,on.isOrphan,pn,dn,et]),dt=t.useRef(null),vt=t.useRef(null),gt=t.useRef(null),ft=t.useRef(null),pt=t.useRef(null),ht=t.useRef(null),xt=t.useState([]),mt=xt[0],_t=xt[1];t.useRef(null);var Rt=t.useState(null),yt=Rt[0],St=Rt[1];t.useEffect(function(){if(mn){var e=hn.fields.find(function(e){return e.analysisKey===mn||e.key===mn});if(e){var n=Pn.current[e.key]||Nn.current[e.key];(null==n?void 0:n.current)&&setTimeout(function(){return n.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[mn,hn.fields]);var bt=t.useCallback(function(e){var n,t,i,o,r,l,u,c,s,a=null===(n=null==Kn?void 0:Kn.rule_difference_comparison)||void 0===n?void 0:n.fields;if(!a||!a[e])return{score:0,relation:"",highlightsA:[],highlightsB:[],hasContent:!1};var d=a[e],v=(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===(r=null===(o=null==d?void 0:d.highlights)||void 0===o?void 0:o.ruleB_spans)||void 0===r?void 0:r.length)||(null==d?void 0:d.mappings)&&d.mappings.length>0;if(d.mappings){var g=d.mappings[0]||{};return{score:d.score,relation:g.relation||"",highlightsA:(null===(l=g.highlights)||void 0===l?void 0:l.ruleA_spans)||[],highlightsB:(null===(u=g.highlights)||void 0===u?void 0:u.ruleB_spans)||[],hasContent:!!v}}return{score:d.score,relation:d.relation||"",highlightsA:(null===(c=d.highlights)||void 0===c?void 0:c.ruleA_spans)||[],highlightsB:(null===(s=d.highlights)||void 0===s?void 0:s.ruleB_spans)||[],hasContent:!!v}},[Kn]),At=t.useCallback(function(n,t){var i,o,r,l,c,a,d;void 0===t&&(t="left");var v=null,g=null;if("left"===t)if(v=Tn[n],$&&v){var f=In.filter(function(e){var n;return null===(n=v.refIndexes)||void 0===n?void 0:n.includes(e.selfIndex)});g=f.find(function(e){return e.evaluationResult})||f[0]}else g=In[n];else if(g=In[n],$&&g){var p=Tn.filter(function(e){var n;return null===(n=e.refIndexes)||void 0===n?void 0:n.includes(g.selfIndex)});v=p.find(function(e){return e.evaluationResult})||p[0]}else v=Tn[n];var h=(null==v?void 0:v.relation)&&"not_defined"!==v.relation,x=(null==g?void 0:g.relation)&&"not_defined"!==g.relation,m=!(!(null==v?void 0:v.cognitiveData)&&!(null==g?void 0:g.cognitiveData));if(!h&&!x&&!m)return e.__assign(e.__assign({},u.generateColorPalette(s.DEFAULT_DEVIAION_COLOR)),{label:"Not Defined"});var _=null!==(o=null!==(i=null==v?void 0:v.evaluationResult)&&void 0!==i?i:null==g?void 0:g.evaluationResult)&&void 0!==o?o:null,R=null===(r=null==_?void 0:_.evaluation_outputs)||void 0===r?void 0:r.output_value,y=null!==(a=null===(c=null===(l=null==_?void 0:_.evaluation_outputs)||void 0===l?void 0:l.metadata)||void 0===c?void 0:c.label_color)&&void 0!==a?a:s.DEFAULT_DEVIAION_COLOR;return null!=_?e.__assign(e.__assign({},u.generateColorPalette(y)),{label:null!==(d=R)&&void 0!==d?d:""}):e.__assign(e.__assign({},u.generateColorPalette(y)),{label:null})},[Tn,In,Me,hn,$]),Et=t.useCallback(function(n){for(var t,i,o,r,l,c,a,d,v,g=n.split("-").map(Number),f=Tn[g[0]],p=In[g[0]],h=1;h<g.length;h++)(null==f?void 0:f.subsections)&&(f=f.subsections[g[h]]),(null==p?void 0:p.subsections)&&(p=p.subsections[g[h]]);if(!f&&!p)return null;var x=(null==f?void 0:f.relation)&&"not_defined"!==f.relation,m=(null==p?void 0:p.relation)&&"not_defined"!==p.relation,_=u.safeStringify(null==f?void 0:f.id)||u.safeStringify(null==p?void 0:p.id)||"",R=!(!(null==f?void 0:f.cognitiveData)&&!(null==p?void 0:p.cognitiveData));if(!x&&!m&&!R)return e.__assign(e.__assign({},u.generateColorPalette(s.DEFAULT_DEVIAION_COLOR)),{label:"Not Defined"});null!==(i=null!==(t=null==f?void 0:f.cognitiveRelevanceScore)&&void 0!==t?t:null==p?void 0:p.cognitiveRelevanceScore)&&void 0!==i||_&&(null===(o=Me[_])||void 0===o||o.relevance_score);var y=null!==(l=null!==(r=null==f?void 0:f.evaluationResult)&&void 0!==r?r:null==p?void 0:p.evaluationResult)&&void 0!==l?l:null,S=null===(c=null==y?void 0:y.evaluation_outputs)||void 0===c?void 0:c.output_value,b=null!==(v=null===(d=null===(a=null==y?void 0:y.evaluation_outputs)||void 0===a?void 0:a.metadata)||void 0===d?void 0:d.label_color)&&void 0!==v?v:s.DEFAULT_DEVIAION_COLOR;return null!=y?e.__assign(e.__assign({},u.generateColorPalette(b)),{label:null!=S?S:""}):e.__assign(e.__assign({},u.generateColorPalette(b)),{label:null})},[Tn,In,Me,hn]),Tt=t.useCallback(function(){var e,n,t,i,o,r,l,c,s,a,d,v,g,f,p,h,x,m,_,R,y,S;if(!Qe.current&&!De.current){Qe.current=!0;try{if(!dt.current)return;var b=function(e){var n=e.split("-"),t=n[0];if(!tt[t]&&!1===$)return!1;if($&&!tt["left-".concat(t)]&&!tt["right-".concat(t)]&&!tt[t])return!1;for(var i=t,o=1;o<n.length-1;o++)if(i+="-".concat(n[o]),!it[i])return!1;return!0},A=dt.current.getBoundingClientRect();Ve({width:A.width,height:A.height});var E=[];if(Bn.forEach(function(e){var n,t,i=e.key,o=null===(n=Pn.current[i])||void 0===n?void 0:n.current,r=null===(t=Nn.current[i])||void 0===t?void 0:t.current;o&&r&&(o.style.height="auto",r.style.height="auto",o.style.minHeight="0px",r.style.minHeight="0px")}),!De.current){for(var T=0;T<Math.max(Tn.length,In.length);T++){var I=null===(e=Fn.current[T])||void 0===e?void 0:e.current,B=null===(n=kn.current[T])||void 0===n?void 0:n.current;I&&(I.style.height="auto",I.style.minHeight="0px"),B&&(B.style.height="auto",B.style.minHeight="0px")}$||Object.keys(Vn.current).forEach(function(e){var n,t;if(b(e)){var i=null===(n=Vn.current[e])||void 0===n?void 0:n.current,o=null===(t=Gn.current[e])||void 0===t?void 0:t.current;i&&o&&(i.style.height="auto",o.style.height="auto",i.style.minHeight="0px",o.style.minHeight="0px")}})}var C={};Bn.forEach(function(e){var n,t,i=e.key,o=null===(n=Pn.current[i])||void 0===n?void 0:n.current,r=null===(t=Nn.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=o.getBoundingClientRect(),u=r.getBoundingClientRect();C[i]=Math.max(l.height,u.height)}});var D={left:{},right:{}},O={};if(!De.current)if($){if(de&&null!==Re)if("number"==typeof Re){var w=Re,j=Tn[w],P=null===(o=Fn.current[w])||void 0===o?void 0:o.current;P&&j&&(j.refIndexes||[]).forEach(function(e){var n,t=In.findIndex(function(n){return n.selfIndex===e}),i=null===(n=kn.current[t])||void 0===n?void 0:n.current;if(i&&(tt["left-".concat(w)]||tt["right-".concat(t)])){var o=Math.max(P.getBoundingClientRect().height,i.getBoundingClientRect().height);D.left[w]=Math.max(D.left[w]||0,o),D.right[t]=Math.max(D.right[t]||0,o)}})}else{var N=Re.split(u.DEVIATION_BADGE_SEPARATOR)[2];if(N){I=null===(r=Vn.current[N])||void 0===r?void 0:r.current,B=null===(l=Gn.current[N])||void 0===l?void 0:l.current;if(I&&B){F=Math.max(I.getBoundingClientRect().height,B.getBoundingClientRect().height);O[N]=Math.max(O[N]||0,F)}}}}else{Object.keys(Vn.current).forEach(function(e){var n,t;if(b(e)){var i=null===(n=Vn.current[e])||void 0===n?void 0:n.current,o=null===(t=Gn.current[e])||void 0===t?void 0:t.current;if(i&&o&&null!==i.offsetParent&&null!==o.offsetParent){var r=i.getBoundingClientRect(),l=o.getBoundingClientRect(),u=Math.max(r.height,l.height);O[e]=u,i.style.minHeight="".concat(u,"px"),o.style.minHeight="".concat(u,"px")}}});for(T=0;T<Math.min(Tn.length,In.length);T++){var I=null===(t=Fn.current[T])||void 0===t?void 0:t.current,B=null===(i=kn.current[T])||void 0===i?void 0:i.current;if(I&&B){var F=Math.max(I.getBoundingClientRect().height,B.getBoundingClientRect().height);D.left[T]=F,D.right[T]=F}}}if(Bn.forEach(function(e){var n,t,i=e.key,o=null===(n=Pn.current[i])||void 0===n?void 0:n.current,r=null===(t=Nn.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=C[i];o.style.minHeight="".concat(l,"px"),r.style.minHeight="".concat(l,"px")}}),De.current||(Object.entries(D.left).forEach(function(e){var n,t=e[0],i=e[1],o=null===(n=Fn.current[Number(t)])||void 0===n?void 0:n.current;o&&(o.style.minHeight="".concat(i,"px"))}),Object.entries(D.right).forEach(function(e){var n,t=e[0],i=e[1],o=null===(n=kn.current[Number(t)])||void 0===n?void 0:n.current;o&&(o.style.minHeight="".concat(i,"px"))}),$||Object.keys(O).forEach(function(e){var n,t,i=null===(n=Vn.current[e])||void 0===n?void 0:n.current,o=null===(t=Gn.current[e])||void 0===t?void 0:t.current;if(i&&o&&O[e]){var r=O[e];i.style.minHeight="".concat(r,"px"),o.style.minHeight="".concat(r,"px")}})),$)Tn.forEach(function(e,n){var t;(null===(t=Fn.current[n])||void 0===t?void 0:t.current)&&(e.refIndexes||[]).forEach(function(e){var t,i,o,r,l,u,c,s,a,d,v=In.findIndex(function(n){return n.selfIndex===e});if(-1!==v){var g=null===(t=Mn.current[n])||void 0===t?void 0:t.current,f=null===(i=Ln.current[v])||void 0===i?void 0:i.current;if(g&&f){var p=g.getBoundingClientRect(),h=f.getBoundingClientRect(),x=p.right-A.left,m=h.left-A.left,_=p.top+p.height/2-A.top,R=h.top+h.height/2-A.top;if(de&&Re===n){var y=null!==(r=null===(o=Je.current)||void 0===o?void 0:o.getBoundingClientRect().top)&&void 0!==r?r:0,S=null!==(u=null===(l=We.current)||void 0===l?void 0:l.getBoundingClientRect().top)&&void 0!==u?u:0,b=y+(null!==(s=null===(c=Je.current)||void 0===c?void 0:c.clientHeight)&&void 0!==s?s:1/0),T=S+(null!==(d=null===(a=We.current)||void 0===a?void 0:a.clientHeight)&&void 0!==d?d:1/0),I=p.top+p.height/2,B=h.top+h.height/2,C=function(e,n,t){return Math.max(n,Math.min(t,e))};_=C(I,y,b)-A.top,R=C(B,S,T)-A.top}var D=At(n);D&&E.push({id:"line-".concat(n,"-").concat(v),x1:x,y1:_,x2:m,y2:R,style:D,sectionIdx:n,targetRightIdx:v})}}})});else{for(T=0;T<Math.min(Tn.length,In.length);T++){var k=null===(c=Fn.current[T])||void 0===c?void 0:c.current,M=null===(s=kn.current[T])||void 0===s?void 0:s.current;if(k&&M){var L=k.getBoundingClientRect(),H=M.getBoundingClientRect(),V=Math.max(L.top,H.top)+18-A.top,G=(null===(a=In[T])||void 0===a?void 0:a.id)||"sec-".concat(T);(J=At(T))&&E.push({id:G,x1:L.right-A.left,y1:V,x2:H.left-A.left,y2:V,style:J,sectionIdx:T,hasCognitive:!!((null===(d=Tn[T])||void 0===d?void 0:d.cognitiveData)||(null===(v=In[T])||void 0===v?void 0:v.cognitiveData)||G&&Me[G]),isSubSection:!1})}}Object.keys(Vn.current).forEach(function(e){var n,t,i,o,r,l;if(b(e)){var c=null===(n=Vn.current[e])||void 0===n?void 0:n.current,s=null===(t=Gn.current[e])||void 0===t?void 0:t.current;if(c&&s){for(var a=e.split("-").map(Number),d=Tn[a[0]],v=In[a[0]],g=1;g<a.length;g++)(null==d?void 0:d.subsections)&&(d=d.subsections[a[g]]),(null==v?void 0:v.subsections)&&(v=v.subsections[a[g]]);var f=!!d&&((null===(i=d.displayTitle)||void 0===i||i)&&u.hasValue(d.title)),p=!!d&&((null===(o=d.displayContent)||void 0===o||o)&&u.hasValue(d.content)),h=!!v&&((null===(r=v.displayTitle)||void 0===r||r)&&u.hasValue(v.title)),x=!!v&&((null===(l=v.displayContent)||void 0===l||l)&&u.hasValue(v.content));if(f&&p||h&&x){var m=c.getBoundingClientRect(),_=s.getBoundingClientRect(),R=Math.max(m.top,_.top)+16-A.top,y=Et(e);y&&"Not Defined"!==y.label&&E.push({id:"subsec-".concat(e),x1:m.right-A.left,y1:R,x2:_.left-A.left,y2:R,style:y,sectionIdx:a[0],isSubSection:!0,subSectionKeyPath:e,hasCognitive:!(!(null==d?void 0:d.cognitiveData)&&!(null==v?void 0:v.cognitiveData))})}}}})}if(de&&"string"==typeof Re&&Re.includes(u.DEVIATION_BADGE_SEPARATOR)){var q=Re.split(u.DEVIATION_BADGE_SEPARATOR),z=q[0],W=q[1],Y=q[2],K=(q[3],"".concat(z).concat(u.DEVIATION_BADGE_SEPARATOR).concat(W)),U=null===(g=Mn.current[K])||void 0===g?void 0:g.current,X=null===(f=Ln.current[K])||void 0===f?void 0:f.current;if(U&&X){var J,Q=U.getBoundingClientRect(),Z=X.getBoundingClientRect(),ee=Q.right-A.left,ne=Z.left-A.left,te=Q.top+Q.height/2-A.top,ie=Z.top+Z.height/2-A.top;if($){var oe=null!==(h=null===(p=Je.current)||void 0===p?void 0:p.getBoundingClientRect().top)&&void 0!==h?h:0,re=null!==(m=null===(x=We.current)||void 0===x?void 0:x.getBoundingClientRect().top)&&void 0!==m?m:0,le=oe+(null!==(R=null===(_=Je.current)||void 0===_?void 0:_.clientHeight)&&void 0!==R?R:1/0),ue=re+(null!==(S=null===(y=We.current)||void 0===y?void 0:y.clientHeight)&&void 0!==S?S:1/0),ce=function(e,n,t){return Math.max(n,Math.min(t,e))};te=ce(Q.top+Q.height/2,oe,le)-A.top,ie=ce(Z.top+Z.height/2,re,ue)-A.top}(J=Et(Y))&&E.push({id:"line-subsec-".concat(K),x1:ee,y1:te,x2:ne,y2:ie,style:J,sectionIdx:Number(Y.split("-")[0]),isSubSection:!0,subSectionKeyPath:Re})}}if(_t(E),pt.current&&ht.current){var se=pt.current.getBoundingClientRect(),ae=ht.current.getBoundingClientRect(),ve=(se.top+se.height/2-A.top+ae.top+ae.height/2-A.top)/2;St({x1:se.right-A.left,x2:ae.left-A.left,y:ve})}else St(null);if(Ae.size>0){var ge=[],fe=Je.current,pe=We.current;if(fe&&pe){var he=[],xe=fe.getBoundingClientRect().top,me=pe.getBoundingClientRect().top,_e=xe+fe.clientHeight,ye=me+pe.clientHeight,Se=fe.scrollTop,be=pe.scrollTop,Ee=A.top,Te=function(e,n,t){return Math.max(n,Math.min(t,e))};Ae.forEach(function(e){var n,t,i,o,r;if("string"==typeof e&&e.includes(u.DEVIATION_BADGE_SEPARATOR)){var l=e.split(u.DEVIATION_BADGE_SEPARATOR),c=l[0],s=l[1],a=l[2],d=(l[3],"".concat(c).concat(u.DEVIATION_BADGE_SEPARATOR).concat(s)),v=null===(n=Mn.current[d])||void 0===n?void 0:n.current,g=null===(t=Ln.current[d])||void 0===t?void 0:t.current;if(!v||!g)return;var f=v.getBoundingClientRect(),p=g.getBoundingClientRect(),h=Et(a),x=(P=f.right-A.left)+.5*((N=p.left-A.left-0)-P),m=f.top+f.height/2,_=p.top+p.height/2,R=m-xe+Se,y=_-me+be,S="conn-subsec-".concat(d);he.push({lhsScrollY:R,rhsScrollY:y,x1:P,x2:N,containerTop:Ee,leftIdx:e,rhsArrayIdx:e,styleColor:(null==h?void 0:h.badgeBorder)||"#6366F1",styleId:S});var b=Te(m,xe,_e),E=Te(_,me,ye),T=b-Ee,I=E-Ee,B=_>=me-4&&_<=ye+4,C="";C=(F=m>=xe-4&&m<=_e+4)&&B?u.getBentArrowPath(P,T,N,I):F&&!B?"M ".concat(P,",").concat(T," L ").concat(x,",").concat(T," L ").concat(x,",").concat(I):!F&&B?"M ".concat(x,",").concat(T," L ").concat(x,",").concat(I," L ").concat(N,",").concat(I):"M ".concat(x,",").concat(T," L ").concat(x,",").concat(I),ge.push({id:S,pathD:C,style:h,leftIdx:e,rhsArrayIdx:e})}else if($){var D=e,O=Tn[D];if(!(null===(r=null==O?void 0:O.refIndexes)||void 0===r?void 0:r.length))return;O.refIndexes.forEach(function(e){var n,t,i=In.findIndex(function(n){return n.selfIndex===e});if(-1!==i){var o=null===(n=Mn.current[D])||void 0===n?void 0:n.current,r=null===(t=Ln.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=o.getBoundingClientRect(),c=r.getBoundingClientRect(),s=At(D),a=l.right-A.left,d=c.left-A.left-0,v=a+.5*(d-a),g=l.top+l.height/2,f=c.top+c.height/2,p=g-xe+Se,h=f-me+be,x="conn-".concat(D,"-").concat(i);he.push({lhsScrollY:p,rhsScrollY:h,x1:a,x2:d,containerTop:Ee,leftIdx:D,rhsArrayIdx:i,styleColor:(null==s?void 0:s.badgeBorder)||"#6366F1",styleId:x});var m=Te(g,xe,_e),_=Te(f,me,ye),R=m-Ee,y=_-Ee,S=g>=xe-4&&g<=_e+4,b=f>=me-4&&f<=ye+4,E="";E=S&&b?u.getBentArrowPath(a,R,d,y):S&&!b?"M ".concat(a,",").concat(R," L ").concat(v,",").concat(R," L ").concat(v,",").concat(y):!S&&b?"M ".concat(v,",").concat(R," L ").concat(v,",").concat(y," L ").concat(d,",").concat(y):"M ".concat(v,",").concat(R," L ").concat(v,",").concat(y),ge.push({id:x,pathD:E,style:s,leftIdx:D,rhsArrayIdx:i})}}})}else{var w=e,j=w;v=null===(i=Mn.current[w])||void 0===i?void 0:i.current,g=null===(o=Ln.current[j])||void 0===o?void 0:o.current;if(!v||!g)return;var P,N;f=v.getBoundingClientRect(),p=g.getBoundingClientRect(),h=At(w),x=(P=f.right-A.left)+.5*((N=p.left-A.left-0)-P),m=f.top+f.height/2,_=p.top+p.height/2,R=m-xe+Se,y=_-me+be,S="conn-".concat(w,"-").concat(j);he.push({lhsScrollY:R,rhsScrollY:y,x1:P,x2:N,containerTop:Ee,leftIdx:w,rhsArrayIdx:j,styleColor:(null==h?void 0:h.badgeBorder)||"#6366F1",styleId:S});var F;b=Te(m,xe,_e),E=Te(_,me,ye),T=b-Ee,I=E-Ee,B=_>=me-4&&_<=ye+4,C="";C=(F=m>=xe-4&&m<=_e+4)&&B?u.getBentArrowPath(P,T,N,I):F&&!B?"M ".concat(P,",").concat(T," L ").concat(x,",").concat(T," L ").concat(x,",").concat(I):!F&&B?"M ".concat(x,",").concat(T," L ").concat(x,",").concat(I," L ").concat(N,",").concat(I):"M ".concat(x,",").concat(T," L ").concat(x,",").concat(I),ge.push({id:S,pathD:C,style:h,leftIdx:w,rhsArrayIdx:j})}}),je.current=he}Be(ge)}else Be([]),je.current=[]}catch(e){console.error("Line render safe fail: ",e)}finally{Qe.current=!1}}},[Bn,Tn,In,Me,hn,bt,At,$,de,Re,Ae,tt,it]),It=t.useCallback(function(){var e,n,t,i,o,r,l,u,c,s,a,d,v,g,f=je.current;if(f.length&&!De.current){var p=null!==(n=null===(e=Je.current)||void 0===e?void 0:e.scrollTop)&&void 0!==n?n:0,h=null!==(i=null===(t=We.current)||void 0===t?void 0:t.scrollTop)&&void 0!==i?i:0,x=null!==(r=null===(o=Je.current)||void 0===o?void 0:o.clientHeight)&&void 0!==r?r:1/0,m=null!==(u=null===(l=We.current)||void 0===l?void 0:l.clientHeight)&&void 0!==u?u:1/0,_=null!==(s=null===(c=Je.current)||void 0===c?void 0:c.getBoundingClientRect().top)&&void 0!==s?s:0,R=null!==(d=null===(a=We.current)||void 0===a?void 0:a.getBoundingClientRect().top)&&void 0!==d?d:0,y=_+x,S=R+m,b=null!==(g=null===(v=dt.current)||void 0===v?void 0:v.getBoundingClientRect().top)&&void 0!==g?g:0,A=function(e,n,t){return Math.max(n,Math.min(t,e))};f.forEach(function(e){var n=e.lhsScrollY-p+_,t=e.rhsScrollY-h+R,i=we.current[e.styleId+"-stroke"],o=we.current[e.styleId+"-bg"];if(i||o){var r,l=A(n,_,y),u=A(t,R,S),c=l-b,s=u-b;r="M ".concat(e.x1,",").concat(c," L ").concat(e.x2,",").concat(s),i&&(i.setAttribute("visibility","visible"),i.setAttribute("d",r)),o&&(o.setAttribute("visibility","visible"),o.setAttribute("d",r))}})}},[]);t.useEffect(function(){ke.current=Tt},[Tt]);var Bt=t.useRef(null),Ct=t.useRef(null),Dt=t.useCallback(function(){je.current.length>0&&!De.current||(null!==Bt.current&&clearTimeout(Bt.current),Bt.current=setTimeout(function(){ke.current(),Bt.current=null},50))},[]),Ot=t.useCallback(function(){me(!0),pe(!1),null!==Ct.current&&clearTimeout(Ct.current),null!==Bt.current&&(clearTimeout(Bt.current),Bt.current=null),Ct.current=setTimeout(function(){var e,n,t,i,o,r,l,c,s,a;if(je.current=[],Ne.current&&null!==Fe.current&&null!==gt.current){var d=Fe.current,v=gt.current,g=null,f=null,p=null,h=null;if("string"==typeof d&&d.includes(u.DEVIATION_BADGE_SEPARATOR)){var x=d.split(u.DEVIATION_BADGE_SEPARATOR),m="".concat(x[0]).concat(u.DEVIATION_BADGE_SEPARATOR).concat(x[1]);g=(null===(e=Mn.current[m])||void 0===e?void 0:e.current)||null,f=(null===(n=Ln.current[m])||void 0===n?void 0:n.current)||null,p=(null===(t=Vn.current[x[2]])||void 0===t?void 0:t.current)||(null===(i=Fn.current[Number(x[2])])||void 0===i?void 0:i.current)||null,h=(null===(o=Gn.current[x[3]])||void 0===o?void 0:o.current)||(null===(r=kn.current[Number(x[3])])||void 0===r?void 0:r.current)||null}else g=(null===(l=qn.current[d])||void 0===l?void 0:l.current)||null,p=(null===(c=Fn.current[d])||void 0===c?void 0:c.current)||null,f=(null===(s=Hn.current[v])||void 0===s?void 0:s.current)||null,h=(null===(a=kn.current[v])||void 0===a?void 0:a.current)||null;if(g&&f&&p&&h){if(p.style.paddingTop="0px",h.style.paddingTop="0px",!$){var _=g.getBoundingClientRect(),R=f.getBoundingClientRect(),y=_.top-R.top;y>0?h.style.paddingTop="".concat(y,"px"):y<0&&(p.style.paddingTop="".concat(Math.abs(y),"px"))}var S=Je.current,b=We.current;if(S&&b){var A=g.getBoundingClientRect().top-S.getBoundingClientRect().top+S.scrollTop,E=f.getBoundingClientRect().top-b.getBoundingClientRect().top+b.scrollTop-(A-S.scrollTop);Math.abs(b.scrollTop-E)>1&&(b.scrollTop=E)}}}ke.current(),Ne.current&&pe(!0),me(!1),Ct.current=null},150)},[$,Tn,In]),wt=t.useCallback(function(e){var n,t,i,o,r,l,c,s,a,d;if(null!==Ze.current&&$e.current&&Math.abs(e.currentTarget.scrollTop-Ze.current)<=2){var v=$e.current;Ze.current=null,$e.current=null,v()}if(!Se.current){if($||Dt(),Ne.current){var g=Fe.current,f=gt.current,p=Je.current,h=We.current;if(null!==g&&null!==f&&p&&h){var x="string"==typeof g&&g.includes(u.DEVIATION_BADGE_SEPARATOR)?null===(n=Mn.current["".concat(g.split(u.DEVIATION_BADGE_SEPARATOR)[0]).concat(u.DEVIATION_BADGE_SEPARATOR).concat(g.split(u.DEVIATION_BADGE_SEPARATOR)[1])])||void 0===n?void 0:n.current:null===(t=qn.current[g])||void 0===t?void 0:t.current,m="string"==typeof f&&f.includes(u.DEVIATION_BADGE_SEPARATOR)?null===(i=Ln.current["".concat(f.split(u.DEVIATION_BADGE_SEPARATOR)[0]).concat(u.DEVIATION_BADGE_SEPARATOR).concat(f.split(u.DEVIATION_BADGE_SEPARATOR)[1])])||void 0===i?void 0:i.current:null===(o=Hn.current[f])||void 0===o?void 0:o.current;if(x&&m){var _=x.getBoundingClientRect().top-p.getBoundingClientRect().top+p.scrollTop,R=m.getBoundingClientRect().top-h.getBoundingClientRect().top+h.scrollTop;if(e.currentTarget===p){var y=R-(_-p.scrollTop),S=h.scrollHeight-h.clientHeight,b=Math.max(0,Math.min(y,S));Math.abs(h.scrollTop-b)>1&&(h.scrollTop=b)}else if(e.currentTarget===h){var A=_-(R-h.scrollTop),E=p.scrollHeight-p.clientHeight,T=Math.max(0,Math.min(A,E));Math.abs(p.scrollTop-T)>1&&(p.scrollTop=T)}if(ft.current){var I=void 0,B=void 0;if("string"==typeof g&&g.includes(u.DEVIATION_BADGE_SEPARATOR)){var C=g.split(u.DEVIATION_BADGE_SEPARATOR),D="".concat(C[0]).concat(u.DEVIATION_BADGE_SEPARATOR).concat(C[1]);I=null===(r=Mn.current[D])||void 0===r?void 0:r.current,B=null===(l=Ln.current[D])||void 0===l?void 0:l.current}else I=null===(c=Mn.current[g])||void 0===c?void 0:c.current,B=null===(s=Ln.current[f])||void 0===s?void 0:s.current;var O=null!==(d=null===(a=dt.current)||void 0===a?void 0:a.getBoundingClientRect().top)&&void 0!==d?d:0,w=p.getBoundingClientRect().top,j=w+p.clientHeight;h.getBoundingClientRect().top;h.clientHeight;if(I&&B){var P=I.getBoundingClientRect(),N=B.getBoundingClientRect(),F=P.top+P.height/2;N.top,N.height;var k=((L=F,H=w,V=j,Math.max(H,Math.min(V,L)))-O).toString();ft.current.setAttribute("y1",k),ft.current.setAttribute("y2",k);var M=F>=w-4&&F<=j+4;ft.current.setAttribute("visibility",M?"visible":"hidden")}}}}}var L,H,V;je.current.length>0&&!Pe.current&&(Pe.current=!0,requestAnimationFrame(function(){It(),Pe.current=!1}))}},[It,$,Dt]);t.useEffect(function(){var e=setTimeout(Dt,250);window.addEventListener("resize",Ot);var n=null,t=null;return qe.current&&(n=new ResizeObserver(Dt)).observe(qe.current),dt.current&&(t=new ResizeObserver(Dt)).observe(dt.current),function(){clearTimeout(e),null!==Bt.current&&clearTimeout(Bt.current),null!==Ct.current&&clearTimeout(Ct.current),window.removeEventListener("resize",Ot),null==n||n.disconnect(),null==t||t.disconnect()}},[An,En,Kn,Bn,tt,it,Tn,In,hn,Dt,Ot,de,Re,fe,Ae]),t.useEffect(function(){Ne.current=de},[de]),t.useEffect(function(){Fe.current=Re},[Re]);var jt=t.useCallback(function(e,n,t){var i,o,r=null===(i=null==t?void 0:t.toggleIfSame)||void 0===i||i,l=null==t?void 0:t.onReady,c=null!==(o=null==t?void 0:t.sourceSide)&&void 0!==o?o:"left";pn(),null!=e&&(n?se("No counterpart exists for this section."):de&&Re===e?r?et():null==l||l():(Ee(new Set),Be([]),je.current=[],le(!0),Se.current=!0,ye(e),Fe.current=e,ve(!0),Ne.current=!0,pe(!1),Ye.current&&(Ye.current.style.height="0px"),Ke.current&&(Ke.current.style.height="0px"),Ue.current&&(Ue.current.style.height="0px"),Xe.current&&(Xe.current.style.height="0px"),requestAnimationFrame(function(){var n,t,i,o,r,s=null,a=null,d=null;if("string"==typeof e&&e.includes(u.DEVIATION_BADGE_SEPARATOR)){var v=e.split(u.DEVIATION_BADGE_SEPARATOR),g="".concat(v[0]).concat(u.DEVIATION_BADGE_SEPARATOR).concat(v[1]);s=(null===(n=Mn.current[g])||void 0===n?void 0:n.current)||null,d=(a=(null===(t=Ln.current[g])||void 0===t?void 0:t.current)||null)?e:null}else if(s=(null===(i=qn.current[e])||void 0===i?void 0:i.current)||null,$){var f=Tn[e],p=(null==f?void 0:f.refIndexes)||[];if(p.length>0){var h=p[0],x=In.findIndex(function(e){return e.selfIndex===h});-1!==x&&(a=(null===(r=Hn.current[x])||void 0===r?void 0:r.current)||null,d=x)}}else d=(a=(null===(o=Hn.current[e])||void 0===o?void 0:o.current)||null)?e:null;gt.current=d;var m=Je.current,_=We.current,R=function(){"right"===c&&_?_.dispatchEvent(new Event("scroll")):m&&m.dispatchEvent(new Event("scroll"))};if(!s||!m)return Se.current=!1,le(!1),void(null==l||l());if(!a||!_)return pe(!0),ke.current(),Se.current=!1,le(!1),void(null==l||l());if(!$){var y=0;y="right"===c?a?a.getBoundingClientRect().top:0:s?s.getBoundingClientRect().top:0;var S=qe.current,b=(null==S?void 0:S.getBoundingClientRect().top)||0,A=S?S.scrollTop+y-b-150:0;return S?void u.smoothScrollTo(S,A,200,function(){pe(!0),ke.current(),Se.current=!1,R(),le(!1),null==l||l()}):(pe(!0),ke.current(),Se.current=!1,le(!1),void(null==l||l()))}var E=s.getBoundingClientRect().top-m.getBoundingClientRect().top+m.scrollTop,T=a.getBoundingClientRect().top-_.getBoundingClientRect().top+_.scrollTop,I=200;if("left"===c){var B=T-(E-m.scrollTop);B<0&&Ye.current&&(Ye.current.style.height="".concat(Math.abs(B),"px")),requestAnimationFrame(function(){var e,n=_.scrollHeight-_.clientHeight;if(B<0)e=0;else{if(B>n){var t=B-n;return Ke.current&&(Ke.current.style.height="".concat(t+150,"px")),void requestAnimationFrame(function(){u.smoothScrollTo(_,B,I,function(){pe(!0),ke.current(),Se.current=!1,R(),le(!1),null==l||l()})})}e=B}u.smoothScrollTo(_,e,I,function(){pe(!0),ke.current(),Se.current=!1,R(),le(!1),null==l||l()})})}else{var C=E-(T-_.scrollTop);C<0&&Ue.current&&(Ue.current.style.height="".concat(Math.abs(C),"px")),requestAnimationFrame(function(){var e,n=m.scrollHeight-m.clientHeight;if(C<0)e=0;else{if(C>n){var t=C-n;return Xe.current&&(Xe.current.style.height="".concat(t+150,"px")),void requestAnimationFrame(function(){u.smoothScrollTo(m,C,I,function(){pe(!0),ke.current(),Se.current=!1,R(),le(!1),null==l||l()})})}e=C}u.smoothScrollTo(m,e,I,function(){pe(!0),ke.current(),Se.current=!1,R(),le(!1),null==l||l()})})}})))},[Re,pn,In,de,$,Tn,et]),Pt=t.useCallback(function(e,n,t,i){var o,r="string"==typeof i?u.safeStringify(i).trim():u.safeStringify(null==i?void 0:i.deviation_summary).trim(),l=e.currentTarget;fn();var c="left";if((null===(o=We.current)||void 0===o?void 0:o.contains(l))&&(c="right"),t)return et(),Ee(new Set),Be([]),je.current=[],void(r&&an({open:!0,anchorEl:l,summary:i}));jt(n,t,r?{toggleIfSame:!1,sourceSide:c,onReady:function(){an({open:!0,anchorEl:l,summary:i})}}:{toggleIfSame:!1,sourceSide:c})},[jt,fn,an,et]),Nt=t.useCallback(function(){var e,n=on.sectionIdx,t=on.isOrphan;if(dn(),null!=n){var i="left";on.anchorEl&&(null===(e=We.current)||void 0===e?void 0:e.contains(on.anchorEl))&&(i="right"),jt(n,t,{sourceSide:i})}},[jt,on.isOrphan,on.sectionIdx,on.anchorEl,dn]),Ft=t.useCallback(function(){dn(),et(),Ee(new Set),Be([]),je.current=[]},[dn,et]),kt=null!==on.sectionIdx&&Ae.has(on.sectionIdx),Mt=m.useDeviationNavigation({proposedSections:Tn,existingSections:In,parentDeviationRecord:Cn,expandedSections:tt,maintainRelativeOrder:!!$,scrollContainerRef:qe,leftContainerRef:Je,lhsBadgeRefs:Mn,rhsBadgeRefs:Ln}),Lt=Mt.showDeviationNavigation,Ht=Mt.showOpenNodeRef,Vt=t.useMemo(function(){if(!Q)return null;for(var e in Cn){if((Cn[e]||[]).some(function(e){return e.id===Q}))return e}return null},[Q,Cn]),Gt=t.useRef(null);t.useEffect(function(){if(Q&&Gt.current!==Q){var n=!1,t=0,i=null,o=150,r=function(e,n){for(var t=function(e,i){if(!e)return null;if(e.id===n)return i;if(!Array.isArray(e.subsections))return null;for(var o=0;o<e.subsections.length;o++){var r=t(e.subsections[o],"".concat(i,"-").concat(o));if(r)return r}return null},i=0;i<e.length;i++){var o=t(e[i],String(i));if(o)return o}return null},l=function(){var c,s,a,d;if(!n){var v=null,g=null;for(var f in Cn){var p=Cn[f].find(function(e){return e.id===Q});if(p){v=f,g=p;break}}if(g&&v){var h=Tn.findIndex(function(e){return e.id===v});if(!($?!!tt["left-".concat(h)]:!!tt[String(h)])&&h>=0)return rt(h,"left"),t+=1,void(i=setTimeout(l,450));var x=r(Tn,g.id),m=r(In,g.id);if(x&&!m){var _=x.split("-"),R=Number(_[0]);if($){var y=null===(s=null===(c=Tn[R])||void 0===c?void 0:c.refIndexes)||void 0===s?void 0:s[0],S=In.findIndex(function(e){return e.selfIndex===y});-1!==S&&(R=S)}m=e.__spreadArray([R],_.slice(1),!0).join("-")}if(x&&m){var b="".concat(g.id).concat(u.DEVIATION_BADGE_SEPARATOR,"0").concat(u.DEVIATION_BADGE_SEPARATOR).concat(x).concat(u.DEVIATION_BADGE_SEPARATOR).concat(m),A="".concat(g.id).concat(u.DEVIATION_BADGE_SEPARATOR,"0"),E=null===(a=Mn.current[A])||void 0===a?void 0:a.current,T=null===(d=Ln.current[A])||void 0===d?void 0:d.current,I=$?Je.current:qe.current;if(E&&I){var B=E.getBoundingClientRect();if(0===B.height)return void((t+=1)<20&&(i=setTimeout(l,o)));var C=I.getBoundingClientRect(),D=B.top-C.top+I.scrollTop-C.height/2+B.height/2,O=function(){var e,t,i;if(!n){Gt.current=Q;var o=window.getComputedStyle(E).color;E.style.transition="box-shadow 300ms ease-in-out",E.style.boxShadow="0 0 10px ".concat(o),T&&(T.style.transition="box-shadow 300ms ease-in-out",T.style.boxShadow="0 0 10px ".concat(o)),setTimeout(function(){E&&(E.style.boxShadow=""),T&&(T.style.boxShadow="")},2e3);var r=(null===(t=null===(e=g.evaluationResult)||void 0===e?void 0:e.deviations)||void 0===t?void 0:t[0])||g,l=(null===(i=g.evaluationResult)||void 0===i?void 0:i.evaluation_outputs)||g.evaluation_outputs;jt(b,!1,{toggleIfSame:!1,sourceSide:"left",onReady:function(){an({open:!0,anchorEl:E,summary:{deviation_summary:r.deviation_summary||r,evaluation_outputs:l}})}})}};Math.abs(I.scrollTop-D)<=2?O():(Ze.current=D,$e.current=O,I.scrollTo({top:D,behavior:"smooth"}),i&&clearTimeout(i),i=setTimeout(function(){if($e.current){Ze.current=null;var e=$e.current;$e.current=null,e()}},800))}else(t+=1)<20&&(i=setTimeout(l,o))}else(t+=1)<20&&(i=setTimeout(l,o))}else(t+=1)<20&&(i=setTimeout(l,o))}};return i=setTimeout(l,o),function(){n=!0,i&&clearTimeout(i)}}},[Q,Cn,Tn,In,$,tt,rt,jt,an]);var qt=function(e){var t=e.section,i=e.keyPath,o=e.depth,r=void 0===o?0:o,l=e.columnKey,u=void 0===l?"left":l,c=e.parentNodeId,s=void 0===c?"":c;return n.jsx(y.default,{section:t,keyPath:i,depth:r,columnKey:u,parentNodeId:s,expandedSubSections:it,setExpandedSubSections:ot,maintainRelativeOrder:$||!1,proposedSections:Tn,existingSections:In,treeData:V,deviationNumberRegistry:Dn,connectedSections:Ae,activeSideBySideSection:Re,resolvedMarkdownStyles:Ge,getSubSectionRef:Wn,getSubSectionCompareStyle:Et,getBadgeRef:Yn,openMoreFunctionsPopup:ct,openSummaryPopup:Pt,resetSideBySide:et,setConnectedSections:Ee,setConnectedLines:Be,cachedConnectedPositions:je})};return n.jsxs(i.Box,e.__assign({ref:ze,sx:e.__assign(e.__assign({display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif'},$?{}:{overflow:"visible"}),{position:"relative"})},{children:[te&&n.jsx(i.Box,e.__assign({sx:{position:"absolute",inset:0,bgcolor:"rgba(255, 255, 255, 0.6)",backdropFilter:"blur(10px)",zIndex:9999,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"8px"}},{children:n.jsx(v.default,{})})),sn.open&&n.jsx(S.default,{open:sn.open,anchorEl:sn.anchorEl,containerEl:vt.current,clipTopEl:pt.current,onClose:Ft,summary:sn.summary}),n.jsx(d.default,{open:on.open,anchorEl:on.anchorEl,sectionTitle:on.sectionTitle,referenceSectionTitle:on.refSectionTitle,onClose:pn,onOpenCognitiveCompare:st,onOpenSideBySide:Nt,onConnect:at,isConnected:kt,isOrphan:on.isOrphan}),nn.open&&n.jsx(a.default,{open:nn.open,popupRef:gn,position:ln,popupConfig:U,onClose:function(){un(null),tn(function(n){return e.__assign(e.__assign({},n),{open:!1})}),vn(null)},markdownStyles:W,sectionTitle:nn.sectionTitle,referenceSectionTitle:nn.refSectionTitle,cognitiveData:nn.cognitiveData,anchorEl:nn.anchorEl,sectionAnchorEl:nn.sectionAnchorEl,scrollContainerEl:qe.current,badgeStyle:nn.badgeStyle,docData:nn.docData,deviationData:nn.deviationData,isLoading:nn.isLoading}),n.jsx(i.Snackbar,e.__assign({open:!!ce,autoHideDuration:8e3,onClose:function(){return se(null)},anchorOrigin:{vertical:"top",horizontal:"center"}},{children:n.jsx(i.Alert,e.__assign({onClose:function(){return se(null)},severity:"error",sx:{width:"100%",whiteSpace:"pre-line"}},{children:ce}))})),n.jsx(_.default,{componentHeaderText:H,displayConfig:K,maintainRelativeOrder:$,onToggleView:function(e){ie(!0),setTimeout(function(){ee(!e),et(),dn(),Ee(new Set),Be([]),je.current=[],setTimeout(function(){ie(!1)},400)},50)}}),n.jsx(i.Box,e.__assign({ref:qe,onScroll:wt,sx:{flex:1,minHeight:0,pt:1.5,pb:1,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",overflowY:$?"hidden":"auto",borderTop:Un&&Xn?"none":"1.5px solid #EEF0F4"}},{children:n.jsx(i.Box,e.__assign({sx:e.__assign({display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"},$?{flex:1,minHeight:0}:{})},{children:n.jsxs(i.Box,e.__assign({ref:dt,sx:e.__assign({display:"grid",gridTemplateColumns:"minmax(0, 1fr) 180px minmax(0, 1fr)",gap:"40px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0},$?{flex:1,overflow:"visible"}:{})},{children:[n.jsxs("svg",e.__assign({ref:Ce,style:{position:"absolute",top:0,left:0,width:He.width||"100%",height:He.height||"100%",pointerEvents:"none",zIndex:10,overflow:"visible",opacity:xe?0:1,transition:"opacity 0.15s ease-in-out"}},{children:[yt&&n.jsx("g",{children:n.jsx("line",{x1:yt.x1,y1:yt.y,x2:yt.x2,y2:yt.y,stroke:$n.badgeBorder,strokeWidth:"1.5"})}),mt.map(function(t){var l,c,a,d,v,f,p=t.x1+.5*(t.x2-t.x1),h=(t.y1+t.y2)/2;if("Not Defined"===t.style.label&&!t.hasCognitive)return null;if(t.isSubSection?de&&Re===t.subSectionKeyPath&&fe:de&&Re===t.sectionIdx&&fe)return n.jsxs("g",e.__assign({style:{transition:"opacity 0.2s"}},{children:[n.jsx("defs",{children:n.jsx("marker",e.__assign({id:"arr-".concat(t.id),markerWidth:"7",markerHeight:"5",refX:"7",refY:"2.5",orient:"auto"},{children:n.jsx("polygon",{points:"0 0, 7 2.5, 0 5",fill:t.style.badgeBorder||"#6366F1"})}))}),n.jsx("line",{ref:ft,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);if(!$){var x=t.isSubSection?u.getBentArrowPath(t.x1,t.y1,t.x2,t.y2):"M ".concat(t.x1," ").concat(t.y1," L ").concat(t.x2," ").concat(t.y2),m=Tn[t.sectionIdx]||{title:"",content:""},_=In[t.sectionIdx]||{title:"",content:""};if(console.log("Base and Ref Sections for Badge:",m,_),t.isSubSection&&t.subSectionKeyPath){var R=t.subSectionKeyPath.includes(u.DEVIATION_BADGE_SEPARATOR)?t.subSectionKeyPath.split(u.DEVIATION_BADGE_SEPARATOR):[],y=R[2]||t.subSectionKeyPath,S=R[3]||y,b=y.split("-").map(Number),A=S.split("-").map(Number),E=null,T=null;b.length>0&&(E=Tn[b[0]]),A.length>0&&(T=In[A[0]]);var I=(null==E?void 0:E.title)||"",B=(null==T?void 0:T.title)||"";console.log("Root Parent Titles:",I,B);for(var C=1;C<b.length;C++)(null==E?void 0:E.subsections)&&(E=E.subsections[b[C]]);for(C=1;C<A.length;C++)(null==T?void 0:T.subsections)&&(T=T.subsections[A[C]]);E&&(m=e.__assign(e.__assign({},E),{title:I||E.title})),console.log("Base Section for Subsection Badge:",m),T&&(_=e.__assign(e.__assign({},T),{title:B||T.title})),console.log("Ref Section for Subsection Badge:",_)}var D=!(null===(l=m.cognitiveData)||void 0===l?void 0:l.isMissingRationale)||Boolean(null===(a=null===(c=m.cognitiveData)||void 0===c?void 0:c.decisioning)||void 0===a?void 0:a.length),O=(null===(f=null===(v=null===(d=m.evaluationResult)||void 0===d?void 0:d.cognitive_decisioning)||void 0===v?void 0:v.decisioning_factors)||void 0===f?void 0:f.length)||!1,w=D||O;return n.jsxs("g",{children:[n.jsx("path",{d:x,fill:"none",stroke:t.style.badgeBorder||"#E2E8F0",strokeWidth:"1.5"}),n.jsx("foreignObject",e.__assign({x:p-100,y:h-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){e.stopPropagation(),w&&(nn.open&&cn===t.id?fn():(vn(t.id),ut(lt(e.currentTarget,m,_,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:600,textAlign:"center",whiteSpace:"nowrap",cursor:w?"pointer":"default"}},{children:[t.style.badgeText===s.DEFAULT_DEVIAION_COLOR&&null==t.style.label?n.jsx(g.default,{color:t.style.badgeText}):0===t.style.label?"Same":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(r.ButtonCognitiveIcon,{})})),w&&n.jsx(o.ChevronDown,{size:11,style:{transform:nn.open&&cn===t.id?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))}))]},t.id)}return null}),Ie.map(function(t){var i,o=t.pathD,r=(null===(i=t.style)||void 0===i?void 0:i.badgeBorder)||"#6366F1",l="conn-marker-".concat(t.id),u="".concat(t.id,"-bg"),c="".concat(t.id,"-stroke");return n.jsxs("g",{children:[n.jsx("defs",{children:n.jsx("clipPath",e.__assign({id:"connections-clip"},{children:n.jsx("marker",e.__assign({id:l,markerWidth:"8",markerHeight:"6",refX:"7",refY:"3",orient:"auto"},{children:n.jsx("polygon",{points:"0 0, 8 3, 0 6",fill:r})}))}))}),n.jsx("path",{ref:function(e){we.current[u]=e},d:o,fill:"none",stroke:"#FFFFFF",strokeWidth:"4",strokeOpacity:"0.7"}),n.jsx("path",{ref:function(e){we.current[c]=e},d:o,fill:"none",stroke:r,strokeWidth:"1.75",markerEnd:"url(#".concat(l,")")})]},t.id)})]})),n.jsxs(i.Box,e.__assign({sx:e.__assign({border:"1px solid #E7E7E9",borderRadius:"8px",bgcolor:"#FFFFFF",display:"flex",flexDirection:"column",position:"relative",zIndex:2,filter:"drop-shadow(0px 2px 4px #F2F2F2)"},$?{flex:1,overflow:"visible"}:{})},{children:[n.jsx(i.Box,e.__assign({ref:pt,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E7E7E9",borderRadius:"8px 8px 0 0",display:"flex",alignItems:"center",minHeight:"40px",overflow:"hidden",minWidth:0}},{children:n.jsx(i.Tooltip,e.__assign({title:yn,placement:"top"},{children:n.jsx(i.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:500,color:"#19213D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0,textAlign:"center",display:"block"}},{children:yn}))}))})),n.jsxs(i.Box,e.__assign({ref:Je,onScroll:wt,sx:e.__assign({p:"12px",display:"flex",flexDirection:"column"},$?{maxHeight:"calc(100vh - 150px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,mr:"-160px",pr:"172px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[n.jsx("div",{ref:Ue,style:{width:"100%",height:"0px",flexShrink:0}}),wn&&Tn.map(function(t,r){var l,c,s=!t.title&&!t.content;if($&&s)return null;var a=t,d=At(r,"left"),v=$?!(null===(l=a.refIndexes)||void 0===l?void 0:l.length)||a.selfIndex<0:!In[r],f=$?"number"==typeof a.selfIndex&&a.selfIndex>=0?a.selfIndex+1:null:r+1,p=Ae.has(r),h=u.extractDeviationScore(a.evaluationResult,null==d?void 0:d.deviationLabel);return n.jsx(i.Box,e.__assign({ref:zn(r),sx:{mb:1,width:"100%"}},{children:n.jsxs(i.Box,e.__assign({sx:{position:"relative",width:"100%"}},{children:[n.jsx(i.Box,e.__assign({ref:Fn.current[r],sx:e.__assign({width:"100%",display:"flex"},p&&{borderRadius:"6px",outline:"2px solid ".concat((null==d?void 0:d.badgeBorder)||"#6366F1"),outlineOffset:"1px"})},{children:n.jsx(R.default,{section:t,idx:r,columnKey:"left",colRef:zn("left-accordion-".concat(r)),mb:0,treeData:V,proposedSections:Tn,existingSections:In,deviationNumberRegistry:Dn,getSectionCompareStyle:At,getBadgeRef:Yn,connectedSections:Ae,openMoreFunctionsPopup:ct,openSummaryPopup:Pt,deviationNodeIdToView:Q,deviationTargetParentId:Vt,parentNodeId:(null===(c=null==V?void 0:V.input_index_map)||void 0===c?void 0:c[0])||"",isExpanded:$?!!tt["left-".concat(r)]:!!tt[String(r)],onToggle:function(){Ft(),rt(r,"left")},navigation:t.id?Lt[t.id]:null,showOpenNodeRef:Ht,resolvedMarkdownStyles:Ge,maintainRelativeOrder:$,renderSubSections:qt})})),$&&d&&n.jsxs(i.Box,e.__assign({ref:Mn.current[r],onClick:function(e){var n=$?In.find(function(e){var n;return null===(n=a.refIndexes)||void 0===n?void 0:n.includes(e.selfIndex)})||{title:"",content:""}:In[r]||{title:"",content:""};ct(e,t,v,n,r,d)},sx:{position:"absolute",top:"18px",right:0,transform:"translateY(-50%) translateX(calc(100% + 8px))",display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",bgcolor:d.badgeBg,color:d.badgeText,border:"1px solid ".concat(d.badgeBorder),borderRadius:"12px",px:1.2,py:.4,fontWeight:600,cursor:"pointer",whiteSpace:"nowrap",zIndex:20,boxShadow:"0 1px 3px rgba(0,0,0,0.07)"}},{children:[null!==f&&n.jsx(i.Box,e.__assign({component:"span",sx:{fontSize:"11px",fontWeight:700,pr:.5,borderRight:"1px solid ".concat(d.badgeBorder)}},{children:f})),n.jsx(i.Box,e.__assign({component:"span",sx:{fontSize:"11px",px:.25}},{children:!K.isLoading||null!=a.evaluationResult&&null!=a.evaluationResult?v?"No Deviation Found":"N/A"===h||"NA"===h?"N/A":0==h||null==h?"Same":"".concat(h):n.jsx(g.default,{color:d.badgeText})})),n.jsx(o.EllipsisVertical,{size:11,color:d.badgeText})]}))]}))}),"left-row-".concat(r))}),n.jsx("div",{ref:Xe,style:{width:"100%",height:"0px",flexShrink:0}})]}))]})),n.jsx(i.Box,e.__assign({ref:vt,sx:{width:"180px",display:"flex",flexDirection:"column",alignItems:"center",pt:"15px",gap:0,zIndex:20,pointerEvents:"none"}},{children:n.jsx(i.Box,e.__assign({sx:{display:"flex",justifyContent:"center",alignItems:"center",mt:0}},{children:n.jsxs(i.Box,e.__assign({onClick:function(n){n.stopPropagation(),nn.open&&cn===Jn?fn():(vn(Jn),ut(lt(n.currentTarget,{title:"",content:"",evaluationResult:Qn,cognitiveData:{section_id:"",decisioning:[],gap:[],relevance_score:0,isMissingRationale:!0}},null,Jn,!0,e.__assign(e.__assign({},$n),{label:""}))))},sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:"5px",top:"-5px",borderRadius:"20px",bgcolor:$n.badgeBg,color:$n.badgeText,border:"1px solid ".concat($n.badgeBorder),fontSize:"12px",fontWeight:600,whiteSpace:"nowrap",position:"relative",zIndex:1,pointerEvents:"auto",cursor:"pointer"}},{children:[null!=Zn?Zn:n.jsx(g.default,{}),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(r.ButtonCognitiveIcon,{})})),n.jsx(o.ChevronDown,{size:11,style:{transform:nn.open&&cn===Jn?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))})),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},$?{flex:1,overflow:"visible",minHeight:0}:{})},{children:[re&&n.jsx(l.default,{sections:11}),n.jsx(i.Box,e.__assign({ref:ht,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:Sn,placement:"top"},{children:n.jsx(i.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:500,color:"#5928ED",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0,textAlign:"center",display:"block"}},{children:Sn}))}))})),n.jsxs(i.Box,e.__assign({ref:We,onScroll:wt,sx:e.__assign({p:"12px",display:"flex",flexDirection:"column"},$?{maxHeight:"calc(100vh - 150px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,ml:"-120px",pl:"140px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[n.jsx("div",{ref:Ye,style:{width:"100%",height:"0px",flexShrink:0}}),wn&&In.map(function(t,o){var r,l=t,u=[],c=!1,s=null,a=-1;if($){u=Tn.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}),a=Tn.findIndex(function(e){var n;return(null===(n=e.refIndexes)||void 0===n?void 0:n.includes(l.selfIndex))&&e.selfIndex>=0});var d=Tn.findIndex(function(e,n){var t;return Ae.has(n)&&(null===(t=e.refIndexes)||void 0===t?void 0:t.includes(l.selfIndex))});(c=-1!==d)&&(s=At(d))}else u=[o+1],(c=Ae.has(o))&&(s=At(o));var v=At($&&-1!==a?a:o);return n.jsx(i.Box,e.__assign({ref:Hn.current[o],sx:{mb:1,width:"100%"}},{children:n.jsxs(i.Box,e.__assign({sx:{position:"relative",width:"100%"}},{children:[n.jsx(i.Box,e.__assign({ref:kn.current[o],sx:e.__assign({width:"100%",display:"flex"},c&&s&&{borderRadius:"6px",outline:"2px solid ".concat(s.badgeBorder),outlineOffset:"1px"})},{children:n.jsx(R.default,{section:t,idx:o,columnKey:"right",colRef:zn("right-accordion-".concat(o)),mb:0,parentNodeId:(null===(r=null==V?void 0:V.input_index_map)||void 0===r?void 0:r[1])||"",isExpanded:$?!!tt["right-".concat(o)]:!!tt[String(o)],treeData:V,proposedSections:Tn,existingSections:In,deviationNumberRegistry:Dn,getBadgeRef:Yn,getSectionCompareStyle:At,connectedSections:Ae,openMoreFunctionsPopup:ct,openSummaryPopup:Pt,deviationNodeIdToView:Q,deviationTargetParentId:Vt,onToggle:function(){Ft(),rt(o,"right")},navigation:t.id?Lt[t.id]:null,showOpenNodeRef:Ht,resolvedMarkdownStyles:Ge,maintainRelativeOrder:$,renderSubSections:qt})})),$&&!re&&v&&n.jsx(i.Box,e.__assign({ref:Ln.current[o],"data-section-id":l.id,sx:{position:"absolute",top:"18px",left:0,transform:"translateY(-50%) translateX(calc(-100% - 8px))",display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:"11px",bgcolor:v.badgeBg,color:v.badgeText,border:"1px solid ".concat(v.badgeBorder),borderRadius:"10px",px:1,py:.3,fontWeight:700,whiteSpace:"nowrap",zIndex:20}},{children:u.length>0?u.join(", "):"-"}))]}))}),"right-row-".concat(o))}),n.jsx("div",{ref:Ke,style:{width:"100%",height:"0px",flexShrink:0}})]}))]}))]}))}))}))]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),t=require("react"),i=require("@mui/material"),o=require("lucide-react"),r=require("../../assests/svg/ButtonCognitiveIcon.js"),l=require("./OverlayComponent.js"),u=require("./CognitiveComparehelpers.js"),c=require("./CognitiveCompareConfig.js"),a=require("./CognitiveCompareConstants.js"),s=require("./CognitivePopup.js"),d=require("./MoreFunctionsPopup.js"),v=require("./LoaderComponent.js"),f=require("./components/ThreeDotsLoader.js"),g=require("./hooks/useCompareData.js"),p=require("./hooks/useComparePopups.js"),h=require("./hooks/useSectionRefs.js"),x=require("./hooks/useAccordionState.js"),_=require("./hooks/useDeviationNavigation.js"),m=require("./components/CompareHeader.js"),R=require("./components/SectionAccordion.js"),y=require("./components/SubSectionAccordion.js"),S=require("./components/CognitiveSummaryPopup.js");exports.SHARED_MARKDOWN_STYLES=c.SHARED_MARKDOWN_STYLES,exports.default=function(b){var A,E,I,T,B,C,D,O,w,j,P,N,F,k,M,L=b.componentHeaderText,V=void 0===L?a.DEFAULT_COMPONENT_HEADER_TEXT:L,H=b.treeData,G=b.comparisonConfig,q=b.leftColumnTitleText,z=b.rightColumnTitleText,W=b.markdownStyles,Y=b.displayConfig,K=void 0===Y?{isHeaderVisible:!0,isToggleVisible:!0,maintainRelativeOrder:!1,isLoading:!0}:Y,U=b.popupConfig,X=b.deviationData,J=void 0===X?{}:X,Q=b.deviationNodeIdToView,Z=t.useState(K.maintainRelativeOrder),$=Z[0],ee=Z[1],ne=t.useState(!1),te=ne[0],ie=ne[1],oe=t.useState(!1),re=oe[0],le=oe[1],ue=t.useState(null),ce=ue[0],ae=ue[1],se=t.useState(!1),de=se[0],ve=se[1],fe=t.useState(!1),ge=fe[0],pe=fe[1],he=t.useState(!1),xe=he[0],_e=he[1],me=t.useState(null),Re=me[0],ye=me[1],Se=t.useRef(!1),be=t.useState(new Set),Ae=be[0],Ee=be[1],Ie=t.useState([]),Te=Ie[0],Be=Ie[1],Ce=t.useRef(null),De=t.useRef(!1),Oe=t.useRef(null),we=t.useRef({}),je=t.useRef([]),Pe=t.useRef(!1),Ne=t.useRef(!1),Fe=t.useRef(null),ke=t.useRef(function(){}),Me=t.useMemo(function(){return(null==H?void 0:H.cognitive_decisioning)||{}},[H]),Le=t.useState({width:0,height:0}),Ve=Le[0],He=Le[1],Ge=t.useMemo(function(){return e.__assign(e.__assign({},c.SHARED_MARKDOWN_STYLES),W)},[W]),qe=t.useRef(null),ze=t.useRef(null),We=t.useRef(null),Ye=t.useRef(null),Ke=t.useRef(null),Ue=t.useRef(null),Xe=t.useRef(null),Je=t.useRef(null),Qe=t.useRef(!1),Ze=t.useRef(null),$e=t.useRef(null),en=p.useComparePopups(qe),nn=en.cognitivePopup,tn=en.setCognitivePopup,on=en.moreFunctions,rn=en.setMoreFunctions,ln=en.position,un=en.setPosition,cn=en.activeBadgeId,an=en.summaryPopup,sn=en.setSummaryPopup,dn=en.closeSummaryPopup,vn=en.setActiveBadgeId,fn=en.popupRef,gn=en.closeCognitivePopup,pn=en.closeMoreFunctionsPopup,hn=t.useMemo(function(){var e,n,t,i,o,r,l;return{fields:null!==(e=null==G?void 0:G.fields)&&void 0!==e?e:c.DEFAULT_FIELD_CONFIG,thresholds:{high:null!==(t=null===(n=null==G?void 0:G.thresholds)||void 0===n?void 0:n.high)&&void 0!==t?t:c.DEFAULT_COMPARISON_CONFIG.thresholds.high,medium:null!==(o=null===(i=null==G?void 0:G.thresholds)||void 0===i?void 0:i.medium)&&void 0!==o?o:c.DEFAULT_COMPARISON_CONFIG.thresholds.medium,exact:null!==(l=null===(r=null==G?void 0:G.thresholds)||void 0===r?void 0:r.exact)&&void 0!==l?l:c.DEFAULT_COMPARISON_CONFIG.thresholds.exact}}},[G]),xn=t.useState(null),_n=xn[0];xn[1];var mn=null===(I=null===(A=null==H?void 0:H.documents)||void 0===A?void 0:A[null===(E=null==H?void 0:H.input_index_map)||void 0===E?void 0:E[0]])||void 0===I?void 0:I.title,Rn=null===(C=null===(T=null==H?void 0:H.documents)||void 0===T?void 0:T[null===(B=null==H?void 0:H.input_index_map)||void 0===B?void 0:B[1]])||void 0===C?void 0:C.title,yn=u.safeStringify(q||mn||"Uploaded Contract"),Sn=u.safeStringify(z||Rn||"Reference Template"),bn=g.useCognitiveTreeData(H,$,J,hn),An=bn.activeProposed,En=bn.existingRule,In=bn.proposedSections,Tn=bn.existingSections,Bn=bn.visibleFields,Cn=bn.parentDeviationRecord,Dn=bn.deviationNumberRegistry,On=bn.parseError;t.useEffect(function(){On&&ae("Failed to load comparison: ".concat(On))},[On]);var wn=In.length>0||Tn.length>0,jn=h.useSectionRefs(Bn.map(function(e){return e.key}),Math.max(In.length,Tn.length)),Pn=jn.leftRefs,Nn=jn.rightRefs,Fn=jn.sectionLeftRefs,kn=jn.sectionRightRefs,Mn=jn.lhsBadgeRefs,Ln=jn.rhsBadgeRefs,Vn=jn.sectionRightRowRefs,Hn=jn.subSectionLeftRefs,Gn=jn.subSectionRightRefs,qn=jn.sectionRowRefs,zn=jn.getSectionRowRef,Wn=jn.getSubSectionRef,Yn=jn.getBadgeRef,Kn=En.analysis,Un=u.safeStringify(null===(O=null===(D=null==Kn?void 0:Kn.rule_difference_comparison)||void 0===D?void 0:D.summary)||void 0===O?void 0:O.overall_summary),Xn=!!Un.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),Jn=null!==(w=null==H?void 0:H.base_root_id)&&void 0!==w?w:"-1";null==H||H[Jn];var Qn=(null===(j=null==J?void 0:J[Jn])||void 0===j?void 0:j.evaluation_result)||(null===(N=null===(P=null==H?void 0:H.nodes)||void 0===P?void 0:P[Jn])||void 0===N?void 0:N.evaluation_result)||null,Zn=u.extractDeviationScore(Qn),$n=u.generateColorPalette(null!==(M=null===(k=null===(F=null==Qn?void 0:Qn.evaluation_outputs)||void 0===F?void 0:F.metadata)||void 0===k?void 0:k.label_color)&&void 0!==M?M:""),et=t.useCallback(function(){var e,n,t,i,o,r;ve(!1),Ne.current=!1;var l=Fe.current,c=ft.current;if(null!==l)if("string"==typeof l&&l.includes(u.DEVIATION_BADGE_SEPARATOR)){var a=l.split(u.DEVIATION_BADGE_SEPARATOR);(s=(null===(e=Hn.current[a[2]])||void 0===e?void 0:e.current)||(null===(n=Fn.current[Number(a[2])])||void 0===n?void 0:n.current))&&(s.style.paddingTop="0px")}else{var s;(s=null===(t=Fn.current[l])||void 0===t?void 0:t.current)&&(s.style.paddingTop="0px")}if(null!==c)if("string"==typeof c&&c.includes(u.DEVIATION_BADGE_SEPARATOR)){a=c.split(u.DEVIATION_BADGE_SEPARATOR);(d=(null===(i=Gn.current[a[3]])||void 0===i?void 0:i.current)||(null===(o=kn.current[Number(a[3])])||void 0===o?void 0:o.current))&&(d.style.paddingTop="0px")}else{var d;(d=null===(r=kn.current[c])||void 0===r?void 0:r.current)&&(d.style.paddingTop="0px")}ye(null),Fe.current=null,ft.current=null,pe(!1),le(!1),Ye.current&&(Ye.current.style.height="0px"),Ke.current&&(Ke.current.style.height="0px"),Ue.current&&(Ue.current.style.height="0px"),Xe.current&&(Xe.current.style.height="0px")},[]),nt=x.useAccordionState({maintainRelativeOrder:!!$,proposedSections:In,existingSections:Tn,activeSideBySideSection:Re,connectedSections:Ae,resetSideBySide:et,setConnectedSections:Ee,setConnectedLines:Be,cachedConnectedPositions:je,svgContainerRef:Ce,isAnimatingRef:De,animationTimerRef:Oe,calculateLinesRef:ke,sectionLeftRefs:Fn,sectionRightRefs:kn,subSectionLeftRefs:Hn,subSectionRightRefs:Gn}),tt=nt.expandedSections,it=nt.expandedSubSections,ot=nt.setExpandedSubSections,rt=nt.toggleSection,lt=t.useCallback(function(e,n,t,i,o,r,l){var c,a,s,d=u.safeStringify(null==n?void 0:n.id)||u.safeStringify(null==t?void 0:t.id)||"",v=(d?Me[d]:null)||(null==n?void 0:n.cognitiveData)||(null==t?void 0:t.cognitiveData)||{section_id:d,decisioning:[],gap:[],relevance_score:0},f=null!==(a=null===(c=qn.current[i])||void 0===c?void 0:c.current)&&void 0!==a?a:null;return{isLoading:null!==(s=null==K?void 0:K.isLoading)&&void 0!==s&&s,open:!0,sectionTitle:(null==n?void 0:n.displayTitle)?null==n?void 0:n.title:"no title",refSectionTitle:(null==t?void 0:t.displayTitle)?null==t?void 0:t.title:"no title",cognitiveData:v,anchorEl:e,sectionAnchorEl:f,badgeStyle:r||null,sectionIdx:i,docData:{documents:null==H?void 0:H.documents,input_index_map:null==H?void 0:H.input_index_map},deviationData:(null==n?void 0:n.evaluationResult)||(null==t?void 0:t.evaluationResult)||null,isOrphan:!!o}},[Me,H]),ut=t.useCallback(function(e){pn(),un(null),tn(e)},[pn]),ct=function(e,n,t,i,o,r){e.stopPropagation(),on.open&&on.sectionIdx===o?pn():(gn(),an.open?Ft():dn(),rn(lt(e.currentTarget,n,i,o,t,r)))},at=t.useCallback(function(){null!==on.sectionIdx&&on.anchorEl?ut(e.__assign(e.__assign({},on),{open:!0})):pn()},[on,pn,ut]),st=t.useCallback(function(){var e=on.sectionIdx,n=on.isOrphan;pn(),dn(),null!==e&&(n?ae("No counterpart exists to connect to."):(Ne.current&&et(),Be([]),je.current=[],Ee(function(n){return n.has(e)?new Set:new Set([e])}),setTimeout(function(){ke.current&&ke.current()},50)))},[on.sectionIdx,on.isOrphan,pn,dn,et]),dt=t.useRef(null),vt=t.useRef(null),ft=t.useRef(null),gt=t.useRef(null),pt=t.useRef(null),ht=t.useRef(null),xt=t.useState([]),_t=xt[0],mt=xt[1];t.useRef(null);var Rt=t.useState(null),yt=Rt[0],St=Rt[1];t.useEffect(function(){if(_n){var e=hn.fields.find(function(e){return e.analysisKey===_n||e.key===_n});if(e){var n=Pn.current[e.key]||Nn.current[e.key];(null==n?void 0:n.current)&&setTimeout(function(){return n.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[_n,hn.fields]);var bt=t.useCallback(function(e){var n,t,i,o,r,l,u,c,a,s=null===(n=null==Kn?void 0:Kn.rule_difference_comparison)||void 0===n?void 0:n.fields;if(!s||!s[e])return{score:0,relation:"",highlightsA:[],highlightsB:[],hasContent:!1};var d=s[e],v=(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===(r=null===(o=null==d?void 0:d.highlights)||void 0===o?void 0:o.ruleB_spans)||void 0===r?void 0:r.length)||(null==d?void 0:d.mappings)&&d.mappings.length>0;if(d.mappings){var f=d.mappings[0]||{};return{score:d.score,relation:f.relation||"",highlightsA:(null===(l=f.highlights)||void 0===l?void 0:l.ruleA_spans)||[],highlightsB:(null===(u=f.highlights)||void 0===u?void 0:u.ruleB_spans)||[],hasContent:!!v}}return{score:d.score,relation:d.relation||"",highlightsA:(null===(c=d.highlights)||void 0===c?void 0:c.ruleA_spans)||[],highlightsB:(null===(a=d.highlights)||void 0===a?void 0:a.ruleB_spans)||[],hasContent:!!v}},[Kn]),At=t.useCallback(function(n,t){var i,o,r,l,c,s,d;void 0===t&&(t="left");var v=null,f=null;if("left"===t)if(v=In[n],$&&v){var g=Tn.filter(function(e){var n;return null===(n=v.refIndexes)||void 0===n?void 0:n.includes(e.selfIndex)});f=g.find(function(e){return e.evaluationResult})||g[0]}else f=Tn[n];else if(f=Tn[n],$&&f){var p=In.filter(function(e){var n;return null===(n=e.refIndexes)||void 0===n?void 0:n.includes(f.selfIndex)});v=p.find(function(e){return e.evaluationResult})||p[0]}else v=In[n];var h=(null==v?void 0:v.relation)&&"not_defined"!==v.relation,x=(null==f?void 0:f.relation)&&"not_defined"!==f.relation,_=!(!(null==v?void 0:v.cognitiveData)&&!(null==f?void 0:f.cognitiveData));if(!h&&!x&&!_)return e.__assign(e.__assign({},u.generateColorPalette(a.DEFAULT_DEVIAION_COLOR)),{label:"Not Defined"});var m=null!==(o=null!==(i=null==v?void 0:v.evaluationResult)&&void 0!==i?i:null==f?void 0:f.evaluationResult)&&void 0!==o?o:null,R=null===(r=null==m?void 0:m.evaluation_outputs)||void 0===r?void 0:r.output_value,y=null!==(s=null===(c=null===(l=null==m?void 0:m.evaluation_outputs)||void 0===l?void 0:l.metadata)||void 0===c?void 0:c.label_color)&&void 0!==s?s:a.DEFAULT_DEVIAION_COLOR;return null!=m?e.__assign(e.__assign({},u.generateColorPalette(y)),{label:null!==(d=R)&&void 0!==d?d:""}):e.__assign(e.__assign({},u.generateColorPalette(y)),{label:null})},[In,Tn,Me,hn,$]),Et=t.useCallback(function(n){for(var t,i,o,r,l,c,s,d,v,f=n.split("-").map(Number),g=In[f[0]],p=Tn[f[0]],h=1;h<f.length;h++)(null==g?void 0:g.subsections)&&(g=g.subsections[f[h]]),(null==p?void 0:p.subsections)&&(p=p.subsections[f[h]]);if(!g&&!p)return null;var x=(null==g?void 0:g.relation)&&"not_defined"!==g.relation,_=(null==p?void 0:p.relation)&&"not_defined"!==p.relation,m=u.safeStringify(null==g?void 0:g.id)||u.safeStringify(null==p?void 0:p.id)||"",R=!(!(null==g?void 0:g.cognitiveData)&&!(null==p?void 0:p.cognitiveData));if(!x&&!_&&!R)return e.__assign(e.__assign({},u.generateColorPalette(a.DEFAULT_DEVIAION_COLOR)),{label:"Not Defined"});null!==(i=null!==(t=null==g?void 0:g.cognitiveRelevanceScore)&&void 0!==t?t:null==p?void 0:p.cognitiveRelevanceScore)&&void 0!==i||m&&(null===(o=Me[m])||void 0===o||o.relevance_score);var y=null!==(l=null!==(r=null==g?void 0:g.evaluationResult)&&void 0!==r?r:null==p?void 0:p.evaluationResult)&&void 0!==l?l:null,S=null===(c=null==y?void 0:y.evaluation_outputs)||void 0===c?void 0:c.output_value,b=null!==(v=null===(d=null===(s=null==y?void 0:y.evaluation_outputs)||void 0===s?void 0:s.metadata)||void 0===d?void 0:d.label_color)&&void 0!==v?v:a.DEFAULT_DEVIAION_COLOR;return null!=y?e.__assign(e.__assign({},u.generateColorPalette(b)),{label:null!=S?S:""}):e.__assign(e.__assign({},u.generateColorPalette(b)),{label:null})},[In,Tn,Me,hn]),It=t.useCallback(function(){var e,n,t,i,o,r,l,c,a,s,d,v,f,g,p,h,x,_,m,R,y,S;if(!Qe.current&&!De.current){Qe.current=!0;try{if(!dt.current)return;var b=function(e){var n=e.split("-"),t=n[0];if(!tt[t]&&!1===$)return!1;if($&&!tt["left-".concat(t)]&&!tt["right-".concat(t)]&&!tt[t])return!1;for(var i=t,o=1;o<n.length-1;o++)if(i+="-".concat(n[o]),!it[i])return!1;return!0},A=dt.current.getBoundingClientRect();He({width:A.width,height:A.height});var E=[];if(Bn.forEach(function(e){var n,t,i=e.key,o=null===(n=Pn.current[i])||void 0===n?void 0:n.current,r=null===(t=Nn.current[i])||void 0===t?void 0:t.current;o&&r&&(o.style.height="auto",r.style.height="auto",o.style.minHeight="0px",r.style.minHeight="0px")}),!De.current){for(var I=0;I<Math.max(In.length,Tn.length);I++){var T=null===(e=Fn.current[I])||void 0===e?void 0:e.current,B=null===(n=kn.current[I])||void 0===n?void 0:n.current;T&&(T.style.height="auto",T.style.minHeight="0px"),B&&(B.style.height="auto",B.style.minHeight="0px")}$||Object.keys(Hn.current).forEach(function(e){var n,t;if(b(e)){var i=null===(n=Hn.current[e])||void 0===n?void 0:n.current,o=null===(t=Gn.current[e])||void 0===t?void 0:t.current;i&&o&&(i.style.height="auto",o.style.height="auto",i.style.minHeight="0px",o.style.minHeight="0px")}})}var C={};Bn.forEach(function(e){var n,t,i=e.key,o=null===(n=Pn.current[i])||void 0===n?void 0:n.current,r=null===(t=Nn.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=o.getBoundingClientRect(),u=r.getBoundingClientRect();C[i]=Math.max(l.height,u.height)}});var D={left:{},right:{}},O={};if(!De.current)if($){if(de&&null!==Re)if("number"==typeof Re){var w=Re,j=In[w],P=null===(o=Fn.current[w])||void 0===o?void 0:o.current;P&&j&&(j.refIndexes||[]).forEach(function(e){var n,t=Tn.findIndex(function(n){return n.selfIndex===e}),i=null===(n=kn.current[t])||void 0===n?void 0:n.current;if(i&&(tt["left-".concat(w)]||tt["right-".concat(t)])){var o=Math.max(P.getBoundingClientRect().height,i.getBoundingClientRect().height);D.left[w]=Math.max(D.left[w]||0,o),D.right[t]=Math.max(D.right[t]||0,o)}})}else{var N=Re.split(u.DEVIATION_BADGE_SEPARATOR)[2];if(N){T=null===(r=Hn.current[N])||void 0===r?void 0:r.current,B=null===(l=Gn.current[N])||void 0===l?void 0:l.current;if(T&&B){F=Math.max(T.getBoundingClientRect().height,B.getBoundingClientRect().height);O[N]=Math.max(O[N]||0,F)}}}}else{Object.keys(Hn.current).forEach(function(e){var n,t;if(b(e)){var i=null===(n=Hn.current[e])||void 0===n?void 0:n.current,o=null===(t=Gn.current[e])||void 0===t?void 0:t.current;if(i&&o&&null!==i.offsetParent&&null!==o.offsetParent){var r=i.getBoundingClientRect(),l=o.getBoundingClientRect(),u=Math.max(r.height,l.height);O[e]=u,i.style.minHeight="".concat(u,"px"),o.style.minHeight="".concat(u,"px")}}});for(I=0;I<Math.min(In.length,Tn.length);I++){var T=null===(t=Fn.current[I])||void 0===t?void 0:t.current,B=null===(i=kn.current[I])||void 0===i?void 0:i.current;if(T&&B){var F=Math.max(T.getBoundingClientRect().height,B.getBoundingClientRect().height);D.left[I]=F,D.right[I]=F}}}if(Bn.forEach(function(e){var n,t,i=e.key,o=null===(n=Pn.current[i])||void 0===n?void 0:n.current,r=null===(t=Nn.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=C[i];o.style.minHeight="".concat(l,"px"),r.style.minHeight="".concat(l,"px")}}),De.current||(Object.entries(D.left).forEach(function(e){var n,t=e[0],i=e[1],o=null===(n=Fn.current[Number(t)])||void 0===n?void 0:n.current;o&&(o.style.minHeight="".concat(i,"px"))}),Object.entries(D.right).forEach(function(e){var n,t=e[0],i=e[1],o=null===(n=kn.current[Number(t)])||void 0===n?void 0:n.current;o&&(o.style.minHeight="".concat(i,"px"))}),$||Object.keys(O).forEach(function(e){var n,t,i=null===(n=Hn.current[e])||void 0===n?void 0:n.current,o=null===(t=Gn.current[e])||void 0===t?void 0:t.current;if(i&&o&&O[e]){var r=O[e];i.style.minHeight="".concat(r,"px"),o.style.minHeight="".concat(r,"px")}})),$)In.forEach(function(e,n){var t;(null===(t=Fn.current[n])||void 0===t?void 0:t.current)&&(e.refIndexes||[]).forEach(function(e){var t,i,o,r,l,u,c,a,s,d,v=Tn.findIndex(function(n){return n.selfIndex===e});if(-1!==v){var f=null===(t=Mn.current[n])||void 0===t?void 0:t.current,g=null===(i=Ln.current[v])||void 0===i?void 0:i.current;if(f&&g){var p=f.getBoundingClientRect(),h=g.getBoundingClientRect(),x=p.right-A.left,_=h.left-A.left,m=p.top+p.height/2-A.top,R=h.top+h.height/2-A.top;if(de&&Re===n){var y=null!==(r=null===(o=Je.current)||void 0===o?void 0:o.getBoundingClientRect().top)&&void 0!==r?r:0,S=null!==(u=null===(l=We.current)||void 0===l?void 0:l.getBoundingClientRect().top)&&void 0!==u?u:0,b=y+(null!==(a=null===(c=Je.current)||void 0===c?void 0:c.clientHeight)&&void 0!==a?a:1/0),I=S+(null!==(d=null===(s=We.current)||void 0===s?void 0:s.clientHeight)&&void 0!==d?d:1/0),T=p.top+p.height/2,B=h.top+h.height/2,C=function(e,n,t){return Math.max(n,Math.min(t,e))};m=C(T,y,b)-A.top,R=C(B,S,I)-A.top}var D=At(n);D&&E.push({id:"line-".concat(n,"-").concat(v),x1:x,y1:m,x2:_,y2:R,style:D,sectionIdx:n,targetRightIdx:v})}}})});else{for(I=0;I<Math.min(In.length,Tn.length);I++){var k=null===(c=Fn.current[I])||void 0===c?void 0:c.current,M=null===(a=kn.current[I])||void 0===a?void 0:a.current;if(k&&M){var L=k.getBoundingClientRect(),V=M.getBoundingClientRect(),H=Math.max(L.top,V.top)+18-A.top,G=(null===(s=Tn[I])||void 0===s?void 0:s.id)||"sec-".concat(I);(J=At(I))&&E.push({id:G,x1:L.right-A.left,y1:H,x2:V.left-A.left,y2:H,style:J,sectionIdx:I,hasCognitive:!!((null===(d=In[I])||void 0===d?void 0:d.cognitiveData)||(null===(v=Tn[I])||void 0===v?void 0:v.cognitiveData)||G&&Me[G]),isSubSection:!1})}}Object.keys(Hn.current).forEach(function(e){var n,t,i,o,r,l;if(b(e)){var c=null===(n=Hn.current[e])||void 0===n?void 0:n.current,a=null===(t=Gn.current[e])||void 0===t?void 0:t.current;if(c&&a){for(var s=e.split("-").map(Number),d=In[s[0]],v=Tn[s[0]],f=1;f<s.length;f++)(null==d?void 0:d.subsections)&&(d=d.subsections[s[f]]),(null==v?void 0:v.subsections)&&(v=v.subsections[s[f]]);var g=!!d&&((null===(i=d.displayTitle)||void 0===i||i)&&u.hasValue(d.title)),p=!!d&&((null===(o=d.displayContent)||void 0===o||o)&&u.hasValue(d.content)),h=!!v&&((null===(r=v.displayTitle)||void 0===r||r)&&u.hasValue(v.title)),x=!!v&&((null===(l=v.displayContent)||void 0===l||l)&&u.hasValue(v.content));if(g&&p||h&&x){var _=c.getBoundingClientRect(),m=a.getBoundingClientRect(),R=Math.max(_.top,m.top)+16-A.top,y=Et(e);y&&"Not Defined"!==y.label&&E.push({id:"subsec-".concat(e),x1:_.right-A.left,y1:R,x2:m.left-A.left,y2:R,style:y,sectionIdx:s[0],isSubSection:!0,subSectionKeyPath:e,hasCognitive:!(!(null==d?void 0:d.cognitiveData)&&!(null==v?void 0:v.cognitiveData))})}}}})}if(de&&"string"==typeof Re&&Re.includes(u.DEVIATION_BADGE_SEPARATOR)){var q=Re.split(u.DEVIATION_BADGE_SEPARATOR),z=q[0],W=q[1],Y=q[2],K=(q[3],"".concat(z).concat(u.DEVIATION_BADGE_SEPARATOR).concat(W)),U=null===(f=Mn.current[K])||void 0===f?void 0:f.current,X=null===(g=Ln.current[K])||void 0===g?void 0:g.current;if(U&&X){var J,Q=U.getBoundingClientRect(),Z=X.getBoundingClientRect(),ee=Q.right-A.left,ne=Z.left-A.left,te=Q.top+Q.height/2-A.top,ie=Z.top+Z.height/2-A.top;if($){var oe=null!==(h=null===(p=Je.current)||void 0===p?void 0:p.getBoundingClientRect().top)&&void 0!==h?h:0,re=null!==(_=null===(x=We.current)||void 0===x?void 0:x.getBoundingClientRect().top)&&void 0!==_?_:0,le=oe+(null!==(R=null===(m=Je.current)||void 0===m?void 0:m.clientHeight)&&void 0!==R?R:1/0),ue=re+(null!==(S=null===(y=We.current)||void 0===y?void 0:y.clientHeight)&&void 0!==S?S:1/0),ce=function(e,n,t){return Math.max(n,Math.min(t,e))};te=ce(Q.top+Q.height/2,oe,le)-A.top,ie=ce(Z.top+Z.height/2,re,ue)-A.top}(J=Et(Y))&&E.push({id:"line-subsec-".concat(K),x1:ee,y1:te,x2:ne,y2:ie,style:J,sectionIdx:Number(Y.split("-")[0]),isSubSection:!0,subSectionKeyPath:Re})}}if(mt(E),pt.current&&ht.current){var ae=pt.current.getBoundingClientRect(),se=ht.current.getBoundingClientRect(),ve=(ae.top+ae.height/2-A.top+se.top+se.height/2-A.top)/2;St({x1:ae.right-A.left,x2:se.left-A.left,y:ve})}else St(null);if(Ae.size>0){var fe=[],ge=Je.current,pe=We.current;if(ge&&pe){var he=[],xe=ge.getBoundingClientRect().top,_e=pe.getBoundingClientRect().top,me=xe+ge.clientHeight,ye=_e+pe.clientHeight,Se=ge.scrollTop,be=pe.scrollTop,Ee=A.top,Ie=function(e,n,t){return Math.max(n,Math.min(t,e))};Ae.forEach(function(e){var n,t,i,o,r;if("string"==typeof e&&e.includes(u.DEVIATION_BADGE_SEPARATOR)){var l=e.split(u.DEVIATION_BADGE_SEPARATOR),c=l[0],a=l[1],s=l[2],d=(l[3],"".concat(c).concat(u.DEVIATION_BADGE_SEPARATOR).concat(a)),v=null===(n=Mn.current[d])||void 0===n?void 0:n.current,f=null===(t=Ln.current[d])||void 0===t?void 0:t.current;if(!v||!f)return;var g=v.getBoundingClientRect(),p=f.getBoundingClientRect(),h=Et(s),x=(P=g.right-A.left)+.5*((N=p.left-A.left-0)-P),_=g.top+g.height/2,m=p.top+p.height/2,R=_-xe+Se,y=m-_e+be,S="conn-subsec-".concat(d);he.push({lhsScrollY:R,rhsScrollY:y,x1:P,x2:N,containerTop:Ee,leftIdx:e,rhsArrayIdx:e,styleColor:(null==h?void 0:h.badgeBorder)||"#6366F1",styleId:S});var b=Ie(_,xe,me),E=Ie(m,_e,ye),I=b-Ee,T=E-Ee,B=m>=_e-4&&m<=ye+4,C="";C=(F=_>=xe-4&&_<=me+4)&&B?u.getBentArrowPath(P,I,N,T):F&&!B?"M ".concat(P,",").concat(I," L ").concat(x,",").concat(I," L ").concat(x,",").concat(T):!F&&B?"M ".concat(x,",").concat(I," L ").concat(x,",").concat(T," L ").concat(N,",").concat(T):"M ".concat(x,",").concat(I," L ").concat(x,",").concat(T),fe.push({id:S,pathD:C,style:h,leftIdx:e,rhsArrayIdx:e})}else if($){var D=e,O=In[D];if(!(null===(r=null==O?void 0:O.refIndexes)||void 0===r?void 0:r.length))return;O.refIndexes.forEach(function(e){var n,t,i=Tn.findIndex(function(n){return n.selfIndex===e});if(-1!==i){var o=null===(n=Mn.current[D])||void 0===n?void 0:n.current,r=null===(t=Ln.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=o.getBoundingClientRect(),c=r.getBoundingClientRect(),a=At(D),s=l.right-A.left,d=c.left-A.left-0,v=s+.5*(d-s),f=l.top+l.height/2,g=c.top+c.height/2,p=f-xe+Se,h=g-_e+be,x="conn-".concat(D,"-").concat(i);he.push({lhsScrollY:p,rhsScrollY:h,x1:s,x2:d,containerTop:Ee,leftIdx:D,rhsArrayIdx:i,styleColor:(null==a?void 0:a.badgeBorder)||"#6366F1",styleId:x});var _=Ie(f,xe,me),m=Ie(g,_e,ye),R=_-Ee,y=m-Ee,S=f>=xe-4&&f<=me+4,b=g>=_e-4&&g<=ye+4,E="";E=S&&b?u.getBentArrowPath(s,R,d,y):S&&!b?"M ".concat(s,",").concat(R," L ").concat(v,",").concat(R," L ").concat(v,",").concat(y):!S&&b?"M ".concat(v,",").concat(R," L ").concat(v,",").concat(y," L ").concat(d,",").concat(y):"M ".concat(v,",").concat(R," L ").concat(v,",").concat(y),fe.push({id:x,pathD:E,style:a,leftIdx:D,rhsArrayIdx:i})}}})}else{var w=e,j=w;v=null===(i=Mn.current[w])||void 0===i?void 0:i.current,f=null===(o=Ln.current[j])||void 0===o?void 0:o.current;if(!v||!f)return;var P,N;g=v.getBoundingClientRect(),p=f.getBoundingClientRect(),h=At(w),x=(P=g.right-A.left)+.5*((N=p.left-A.left-0)-P),_=g.top+g.height/2,m=p.top+p.height/2,R=_-xe+Se,y=m-_e+be,S="conn-".concat(w,"-").concat(j);he.push({lhsScrollY:R,rhsScrollY:y,x1:P,x2:N,containerTop:Ee,leftIdx:w,rhsArrayIdx:j,styleColor:(null==h?void 0:h.badgeBorder)||"#6366F1",styleId:S});var F;b=Ie(_,xe,me),E=Ie(m,_e,ye),I=b-Ee,T=E-Ee,B=m>=_e-4&&m<=ye+4,C="";C=(F=_>=xe-4&&_<=me+4)&&B?u.getBentArrowPath(P,I,N,T):F&&!B?"M ".concat(P,",").concat(I," L ").concat(x,",").concat(I," L ").concat(x,",").concat(T):!F&&B?"M ".concat(x,",").concat(I," L ").concat(x,",").concat(T," L ").concat(N,",").concat(T):"M ".concat(x,",").concat(I," L ").concat(x,",").concat(T),fe.push({id:S,pathD:C,style:h,leftIdx:w,rhsArrayIdx:j})}}),je.current=he}Be(fe)}else Be([]),je.current=[]}catch(e){console.error("Line render safe fail: ",e)}finally{Qe.current=!1}}},[Bn,In,Tn,Me,hn,bt,At,$,de,Re,Ae,tt,it]),Tt=t.useCallback(function(){var e,n,t,i,o,r,l,c,a,s,d,v,f,g,p=je.current;if(p.length&&!De.current){var h=null!==(n=null===(e=Je.current)||void 0===e?void 0:e.scrollTop)&&void 0!==n?n:0,x=null!==(i=null===(t=We.current)||void 0===t?void 0:t.scrollTop)&&void 0!==i?i:0,_=null!==(r=null===(o=Je.current)||void 0===o?void 0:o.clientHeight)&&void 0!==r?r:1/0,m=null!==(c=null===(l=We.current)||void 0===l?void 0:l.clientHeight)&&void 0!==c?c:1/0,R=null!==(s=null===(a=Je.current)||void 0===a?void 0:a.getBoundingClientRect().top)&&void 0!==s?s:0,y=null!==(v=null===(d=We.current)||void 0===d?void 0:d.getBoundingClientRect().top)&&void 0!==v?v:0,S=R+_,b=y+m,A=null!==(g=null===(f=dt.current)||void 0===f?void 0:f.getBoundingClientRect().top)&&void 0!==g?g:0,E=function(e,n,t){return Math.max(n,Math.min(t,e))};p.forEach(function(e){var n=e.lhsScrollY-h+R,t=e.rhsScrollY-x+y,i=we.current[e.styleId+"-stroke"],o=we.current[e.styleId+"-bg"];if(i||o){var r,l=E(n,R,S),c=E(t,y,b),a=l-A,s=c-A,d=n>=R-4&&n<=S+4,v=t>=y-4&&t<=b+4,f=e.x1+.5*(e.x2-e.x1);r=d&&v?u.getBentArrowPath(e.x1,a,e.x2,s):d&&!v?"M ".concat(e.x1,",").concat(a," L ").concat(f,",").concat(a," L ").concat(f,",").concat(s):!d&&v?"M ".concat(f,",").concat(a," L ").concat(f,",").concat(s," L ").concat(e.x2,",").concat(s):"M ".concat(f,",").concat(a," L ").concat(f,",").concat(s),i&&(i.setAttribute("visibility","visible"),i.setAttribute("d",r)),o&&(o.setAttribute("visibility","visible"),o.setAttribute("d",r))}})}},[]);t.useEffect(function(){ke.current=It},[It]);var Bt=t.useRef(null),Ct=t.useRef(null),Dt=t.useCallback(function(){je.current.length>0&&!De.current||(null!==Bt.current&&clearTimeout(Bt.current),Bt.current=setTimeout(function(){ke.current(),Bt.current=null},50))},[]),Ot=t.useCallback(function(){_e(!0),pe(!1),null!==Ct.current&&clearTimeout(Ct.current),null!==Bt.current&&(clearTimeout(Bt.current),Bt.current=null),Ct.current=setTimeout(function(){var e,n,t,i,o,r,l,c,a,s;if(je.current=[],Ne.current&&null!==Fe.current&&null!==ft.current){var d=Fe.current,v=ft.current,f=null,g=null,p=null,h=null;if("string"==typeof d&&d.includes(u.DEVIATION_BADGE_SEPARATOR)){var x=d.split(u.DEVIATION_BADGE_SEPARATOR),_="".concat(x[0]).concat(u.DEVIATION_BADGE_SEPARATOR).concat(x[1]);f=(null===(e=Mn.current[_])||void 0===e?void 0:e.current)||null,g=(null===(n=Ln.current[_])||void 0===n?void 0:n.current)||null,p=(null===(t=Hn.current[x[2]])||void 0===t?void 0:t.current)||(null===(i=Fn.current[Number(x[2])])||void 0===i?void 0:i.current)||null,h=(null===(o=Gn.current[x[3]])||void 0===o?void 0:o.current)||(null===(r=kn.current[Number(x[3])])||void 0===r?void 0:r.current)||null}else f=(null===(l=qn.current[d])||void 0===l?void 0:l.current)||null,p=(null===(c=Fn.current[d])||void 0===c?void 0:c.current)||null,g=(null===(a=Vn.current[v])||void 0===a?void 0:a.current)||null,h=(null===(s=kn.current[v])||void 0===s?void 0:s.current)||null;if(f&&g&&p&&h){if(p.style.paddingTop="0px",h.style.paddingTop="0px",!$){var m=f.getBoundingClientRect(),R=g.getBoundingClientRect(),y=m.top-R.top;y>0?h.style.paddingTop="".concat(y,"px"):y<0&&(p.style.paddingTop="".concat(Math.abs(y),"px"))}var S=Je.current,b=We.current;if(S&&b){var A=f.getBoundingClientRect().top-S.getBoundingClientRect().top+S.scrollTop,E=g.getBoundingClientRect().top-b.getBoundingClientRect().top+b.scrollTop-(A-S.scrollTop);Math.abs(b.scrollTop-E)>1&&(b.scrollTop=E)}}}ke.current(),Ne.current&&pe(!0),_e(!1),Ct.current=null},150)},[$,In,Tn]),wt=t.useCallback(function(e){var n,t,i,o,r,l,c,a,s,d;if(null!==Ze.current&&$e.current&&Math.abs(e.currentTarget.scrollTop-Ze.current)<=2){var v=$e.current;Ze.current=null,$e.current=null,v()}if(!Se.current){if($||Dt(),Ne.current){var f=Fe.current,g=ft.current,p=Je.current,h=We.current;if(null!==f&&null!==g&&p&&h){var x="string"==typeof f&&f.includes(u.DEVIATION_BADGE_SEPARATOR)?null===(n=Mn.current["".concat(f.split(u.DEVIATION_BADGE_SEPARATOR)[0]).concat(u.DEVIATION_BADGE_SEPARATOR).concat(f.split(u.DEVIATION_BADGE_SEPARATOR)[1])])||void 0===n?void 0:n.current:null===(t=qn.current[f])||void 0===t?void 0:t.current,_="string"==typeof g&&g.includes(u.DEVIATION_BADGE_SEPARATOR)?null===(i=Ln.current["".concat(g.split(u.DEVIATION_BADGE_SEPARATOR)[0]).concat(u.DEVIATION_BADGE_SEPARATOR).concat(g.split(u.DEVIATION_BADGE_SEPARATOR)[1])])||void 0===i?void 0:i.current:null===(o=Vn.current[g])||void 0===o?void 0:o.current;if(x&&_&&gt.current){var m=void 0,R=void 0;if("string"==typeof f&&f.includes(u.DEVIATION_BADGE_SEPARATOR)){var y=f.split(u.DEVIATION_BADGE_SEPARATOR),S="".concat(y[0]).concat(u.DEVIATION_BADGE_SEPARATOR).concat(y[1]);m=null===(r=Mn.current[S])||void 0===r?void 0:r.current,R=null===(l=Ln.current[S])||void 0===l?void 0:l.current}else m=null===(c=Mn.current[f])||void 0===c?void 0:c.current,R=null===(a=Ln.current[g])||void 0===a?void 0:a.current;var b=null!==(d=null===(s=dt.current)||void 0===s?void 0:s.getBoundingClientRect().top)&&void 0!==d?d:0,A=p.getBoundingClientRect().top,E=A+p.clientHeight;h.getBoundingClientRect().top;h.clientHeight;if(m&&R){var I=m.getBoundingClientRect(),T=R.getBoundingClientRect(),B=I.top+I.height/2;T.top,T.height;var C=((O=B,w=A,j=E,Math.max(w,Math.min(j,O)))-b).toString();gt.current.setAttribute("y1",C),gt.current.setAttribute("y2",C);var D=B>=A-4&&B<=E+4;gt.current.setAttribute("visibility",D?"visible":"hidden")}}}}var O,w,j;je.current.length>0&&!Pe.current&&(Pe.current=!0,requestAnimationFrame(function(){Tt(),Pe.current=!1}))}},[Tt,$,Dt]);t.useEffect(function(){var e=setTimeout(Dt,250);window.addEventListener("resize",Ot);var n=null,t=null;return qe.current&&(n=new ResizeObserver(Dt)).observe(qe.current),dt.current&&(t=new ResizeObserver(Dt)).observe(dt.current),function(){clearTimeout(e),null!==Bt.current&&clearTimeout(Bt.current),null!==Ct.current&&clearTimeout(Ct.current),window.removeEventListener("resize",Ot),null==n||n.disconnect(),null==t||t.disconnect()}},[An,En,Kn,Bn,tt,it,In,Tn,hn,Dt,Ot,de,Re,ge,Ae]),t.useEffect(function(){Ne.current=de},[de]),t.useEffect(function(){Fe.current=Re},[Re]);var jt=t.useCallback(function(e,n,t){var i,o,r=null===(i=null==t?void 0:t.toggleIfSame)||void 0===i||i,l=null==t?void 0:t.onReady,c=null!==(o=null==t?void 0:t.sourceSide)&&void 0!==o?o:"left";pn(),null!=e&&(n?ae("No counterpart exists for this section."):de&&Re===e?r?et():null==l||l():(Ee(new Set([e])),Be([]),je.current=[],le(!0),Se.current=!0,ye(e),Fe.current=e,ve(!0),Ne.current=!0,pe(!1),Ye.current&&(Ye.current.style.height="0px"),Ke.current&&(Ke.current.style.height="0px"),Ue.current&&(Ue.current.style.height="0px"),Xe.current&&(Xe.current.style.height="0px"),requestAnimationFrame(function(){var n,t,i,o,r,a=null,s=null,d=null;if("string"==typeof e&&e.includes(u.DEVIATION_BADGE_SEPARATOR)){var v=e.split(u.DEVIATION_BADGE_SEPARATOR),f="".concat(v[0]).concat(u.DEVIATION_BADGE_SEPARATOR).concat(v[1]);a=(null===(n=Mn.current[f])||void 0===n?void 0:n.current)||null,d=(s=(null===(t=Ln.current[f])||void 0===t?void 0:t.current)||null)?e:null}else if(a=(null===(i=qn.current[e])||void 0===i?void 0:i.current)||null,$){var g=In[e],p=(null==g?void 0:g.refIndexes)||[];if(p.length>0){var h=p[0],x=Tn.findIndex(function(e){return e.selfIndex===h});-1!==x&&(s=(null===(r=Vn.current[x])||void 0===r?void 0:r.current)||null,d=x)}}else d=(s=(null===(o=Vn.current[e])||void 0===o?void 0:o.current)||null)?e:null;ft.current=d;var _=Je.current,m=We.current,R=function(){"right"===c&&m?m.dispatchEvent(new Event("scroll")):_&&_.dispatchEvent(new Event("scroll"))};if(!a||!_)return Se.current=!1,le(!1),void(null==l||l());if(!s||!m)return pe(!0),ke.current(),Se.current=!1,le(!1),void(null==l||l());if(!$){var y=0;y="right"===c?s?s.getBoundingClientRect().top:0:a?a.getBoundingClientRect().top:0;var S=qe.current,b=(null==S?void 0:S.getBoundingClientRect().top)||0,A=S?S.scrollTop+y-b-150:0;return S?void u.smoothScrollTo(S,A,200,function(){pe(!0),ke.current(),Se.current=!1,R(),le(!1),null==l||l()}):(pe(!0),ke.current(),Se.current=!1,le(!1),void(null==l||l()))}var E=a.getBoundingClientRect().top-_.getBoundingClientRect().top+_.scrollTop,I=s.getBoundingClientRect().top-m.getBoundingClientRect().top+m.scrollTop,T=200;if("left"===c){var B=I-(E-_.scrollTop);B<0&&Ye.current&&(Ye.current.style.height="".concat(Math.abs(B),"px")),requestAnimationFrame(function(){var e,n=m.scrollHeight-m.clientHeight;if(B<0)e=0;else{if(B>n){var t=B-n;return Ke.current&&(Ke.current.style.height="".concat(t+150,"px")),void requestAnimationFrame(function(){u.smoothScrollTo(m,B,T,function(){pe(!0),ke.current(),Se.current=!1,R(),le(!1),null==l||l()})})}e=B}u.smoothScrollTo(m,e,T,function(){pe(!0),ke.current(),Se.current=!1,R(),le(!1),null==l||l()})})}else{var C=E-(I-m.scrollTop);C<0&&Ue.current&&(Ue.current.style.height="".concat(Math.abs(C),"px")),requestAnimationFrame(function(){var e,n=_.scrollHeight-_.clientHeight;if(C<0)e=0;else{if(C>n){var t=C-n;return Xe.current&&(Xe.current.style.height="".concat(t+150,"px")),void requestAnimationFrame(function(){u.smoothScrollTo(_,C,T,function(){pe(!0),ke.current(),Se.current=!1,R(),le(!1),null==l||l()})})}e=C}u.smoothScrollTo(_,e,T,function(){pe(!0),ke.current(),Se.current=!1,R(),le(!1),null==l||l()})})}})))},[Re,pn,Tn,de,$,In,et]),Pt=t.useCallback(function(e,n,t,i){var o,r="string"==typeof i?u.safeStringify(i).trim():u.safeStringify(null==i?void 0:i.deviation_summary).trim(),l=e.currentTarget;gn();var c="left";(null===(o=We.current)||void 0===o?void 0:o.contains(l))&&(c="right");var a=function(){var e,t,i,o;if("string"==typeof n&&n.includes(u.DEVIATION_BADGE_SEPARATOR)){var r=n.split(u.DEVIATION_BADGE_SEPARATOR),l="".concat(r[0]).concat(u.DEVIATION_BADGE_SEPARATOR).concat(r[1]);return"right"===c?null===(e=Ln.current[l])||void 0===e?void 0:e.current:null===(t=Mn.current[l])||void 0===t?void 0:t.current}return"right"===c?null===(i=Ln.current[n])||void 0===i?void 0:i.current:null===(o=Mn.current[n])||void 0===o?void 0:o.current};if(t)return et(),Ee(new Set),Be([]),je.current=[],void(r&&requestAnimationFrame(function(){var e=a()||l;sn({open:!0,anchorEl:e,summary:i})}));jt(n,t,r?{toggleIfSame:!1,sourceSide:c,onReady:function(){var e=a()||l;sn({open:!0,anchorEl:e,summary:i})}}:{toggleIfSame:!1,sourceSide:c})},[jt,gn,sn,et]),Nt=t.useCallback(function(){var e,n=on.sectionIdx,t=on.isOrphan;if(dn(),null!=n){var i="left";on.anchorEl&&(null===(e=We.current)||void 0===e?void 0:e.contains(on.anchorEl))&&(i="right"),jt(n,t,{sourceSide:i})}},[jt,on.isOrphan,on.sectionIdx,on.anchorEl,dn]),Ft=t.useCallback(function(){dn(),et(),Ee(new Set),Be([]),je.current=[]},[dn,et]),kt=null!==on.sectionIdx&&Ae.has(on.sectionIdx),Mt=_.useDeviationNavigation({proposedSections:In,existingSections:Tn,parentDeviationRecord:Cn,expandedSections:tt,maintainRelativeOrder:!!$,scrollContainerRef:qe,leftContainerRef:Je,lhsBadgeRefs:Mn,rhsBadgeRefs:Ln}),Lt=Mt.showDeviationNavigation,Vt=Mt.showOpenNodeRef,Ht=t.useMemo(function(){if(!Q)return null;for(var e in Cn){if((Cn[e]||[]).some(function(e){return e.id===Q}))return e}return null},[Q,Cn]),Gt=t.useRef(null);t.useEffect(function(){if(Q&&Gt.current!==Q){var n=!1,t=0,i=null,o=150,r=function(e,n){for(var t=function(e,i){if(!e)return null;if(e.id===n)return i;if(!Array.isArray(e.subsections))return null;for(var o=0;o<e.subsections.length;o++){var r=t(e.subsections[o],"".concat(i,"-").concat(o));if(r)return r}return null},i=0;i<e.length;i++){var o=t(e[i],String(i));if(o)return o}return null},l=function(){var c,a,s,d;if(!n){var v=null,f=null;for(var g in Cn){var p=Cn[g].find(function(e){return e.id===Q});if(p){v=g,f=p;break}}if(f&&v){var h=In.findIndex(function(e){return e.id===v});if(!($?!!tt["left-".concat(h)]:!!tt[String(h)])&&h>=0)return rt(h,"left"),t+=1,void(i=setTimeout(l,450));var x=r(In,f.id),_=r(Tn,f.id);if(x&&!_){var m=x.split("-"),R=Number(m[0]);if($){var y=null===(a=null===(c=In[R])||void 0===c?void 0:c.refIndexes)||void 0===a?void 0:a[0],S=Tn.findIndex(function(e){return e.selfIndex===y});-1!==S&&(R=S)}_=e.__spreadArray([R],m.slice(1),!0).join("-")}if(x&&_){var b="".concat(f.id).concat(u.DEVIATION_BADGE_SEPARATOR,"0").concat(u.DEVIATION_BADGE_SEPARATOR).concat(x).concat(u.DEVIATION_BADGE_SEPARATOR).concat(_),A="".concat(f.id).concat(u.DEVIATION_BADGE_SEPARATOR,"0"),E=null===(s=Mn.current[A])||void 0===s?void 0:s.current,I=null===(d=Ln.current[A])||void 0===d?void 0:d.current,T=$?Je.current:qe.current;if(E&&T){var B=E.getBoundingClientRect();if(0===B.height)return void((t+=1)<20&&(i=setTimeout(l,o)));var C=T.getBoundingClientRect(),D=B.top-C.top+T.scrollTop-C.height/2+B.height/2,O=function(){var e,t,i;if(!n){Gt.current=Q;var o=window.getComputedStyle(E).color;E.style.transition="box-shadow 300ms ease-in-out",E.style.boxShadow="0 0 10px ".concat(o),I&&(I.style.transition="box-shadow 300ms ease-in-out",I.style.boxShadow="0 0 10px ".concat(o)),setTimeout(function(){E&&(E.style.boxShadow=""),I&&(I.style.boxShadow="")},2e3);var r=(null===(t=null===(e=f.evaluationResult)||void 0===e?void 0:e.deviations)||void 0===t?void 0:t[0])||f,l=(null===(i=f.evaluationResult)||void 0===i?void 0:i.evaluation_outputs)||f.evaluation_outputs;jt(b,!1,{toggleIfSame:!1,sourceSide:"left",onReady:function(){var e,n=(null===(e=Mn.current[A])||void 0===e?void 0:e.current)||E;sn({open:!0,anchorEl:n,summary:{deviation_summary:r.deviation_summary||r,evaluation_outputs:l}})}})}};Math.abs(T.scrollTop-D)<=2?O():(Ze.current=D,$e.current=O,T.scrollTo({top:D,behavior:"smooth"}),i&&clearTimeout(i),i=setTimeout(function(){if($e.current){Ze.current=null;var e=$e.current;$e.current=null,e()}},800))}else(t+=1)<20&&(i=setTimeout(l,o))}else(t+=1)<20&&(i=setTimeout(l,o))}else(t+=1)<20&&(i=setTimeout(l,o))}};return i=setTimeout(l,o),function(){n=!0,i&&clearTimeout(i)}}},[Q,Cn,In,Tn,$,tt,rt,jt,sn]);var qt=function(e){var t=e.section,i=e.keyPath,o=e.depth,r=void 0===o?0:o,l=e.columnKey,u=void 0===l?"left":l,c=e.parentNodeId,a=void 0===c?"":c;return n.jsx(y.default,{section:t,keyPath:i,depth:r,columnKey:u,parentNodeId:a,expandedSubSections:it,setExpandedSubSections:ot,maintainRelativeOrder:$||!1,proposedSections:In,existingSections:Tn,treeData:H,deviationNumberRegistry:Dn,connectedSections:Ae,activeSideBySideSection:Re,resolvedMarkdownStyles:Ge,getSubSectionRef:Wn,getSubSectionCompareStyle:Et,getBadgeRef:Yn,openMoreFunctionsPopup:ct,openSummaryPopup:Pt,resetSideBySide:et,setConnectedSections:Ee,setConnectedLines:Be,cachedConnectedPositions:je})};return n.jsxs(i.Box,e.__assign({ref:ze,sx:e.__assign(e.__assign({display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif'},$?{}:{overflow:"visible"}),{position:"relative"})},{children:[te&&n.jsx(i.Box,e.__assign({sx:{position:"absolute",inset:0,bgcolor:"rgba(255, 255, 255, 0.6)",backdropFilter:"blur(10px)",zIndex:9999,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"8px"}},{children:n.jsx(v.default,{})})),an.open&&n.jsx(S.default,{open:an.open,anchorEl:an.anchorEl,containerEl:vt.current,clipTopEl:pt.current,scrollContainerEl:qe.current,onClose:Ft,summary:an.summary}),n.jsx(d.default,{open:on.open,anchorEl:on.anchorEl,sectionTitle:on.sectionTitle,referenceSectionTitle:on.refSectionTitle,onClose:pn,onOpenCognitiveCompare:at,onOpenSideBySide:Nt,onConnect:st,isConnected:kt,isOrphan:on.isOrphan}),nn.open&&n.jsx(s.default,{open:nn.open,popupRef:fn,position:ln,popupConfig:U,onClose:function(){un(null),tn(function(n){return e.__assign(e.__assign({},n),{open:!1})}),vn(null)},markdownStyles:W,sectionTitle:nn.sectionTitle,referenceSectionTitle:nn.refSectionTitle,cognitiveData:nn.cognitiveData,anchorEl:nn.anchorEl,sectionAnchorEl:nn.sectionAnchorEl,scrollContainerEl:qe.current,badgeStyle:nn.badgeStyle,docData:nn.docData,deviationData:nn.deviationData,isLoading:nn.isLoading}),n.jsx(i.Snackbar,e.__assign({open:!!ce,autoHideDuration:8e3,onClose:function(){return ae(null)},anchorOrigin:{vertical:"top",horizontal:"center"}},{children:n.jsx(i.Alert,e.__assign({onClose:function(){return ae(null)},severity:"error",sx:{width:"100%",whiteSpace:"pre-line"}},{children:ce}))})),n.jsx(m.default,{componentHeaderText:V,displayConfig:K,maintainRelativeOrder:$,onToggleView:function(e){ie(!0),setTimeout(function(){ee(!e),et(),dn(),Ee(new Set),Be([]),je.current=[],setTimeout(function(){ie(!1)},400)},50)}}),n.jsx(i.Box,e.__assign({ref:qe,onScroll:wt,sx:{flex:1,minHeight:0,pt:1.5,pb:1,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",overflowY:$?"hidden":"auto",borderTop:Un&&Xn?"none":"1.5px solid #EEF0F4"}},{children:n.jsx(i.Box,e.__assign({sx:e.__assign({display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"},$?{flex:1,minHeight:0}:{})},{children:n.jsxs(i.Box,e.__assign({ref:dt,sx:e.__assign({display:"grid",gridTemplateColumns:"minmax(0, 1fr) 180px minmax(0, 1fr)",gap:"40px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0},$?{flex:1,overflow:"visible"}:{})},{children:[n.jsxs("svg",e.__assign({ref:Ce,style:{position:"absolute",top:0,left:0,width:Ve.width||"100%",height:Ve.height||"100%",pointerEvents:"none",zIndex:10,overflow:"visible",opacity:xe?0:1,transition:"opacity 0.15s ease-in-out"}},{children:[yt&&n.jsx("g",{children:n.jsx("line",{x1:yt.x1,y1:yt.y,x2:yt.x2,y2:yt.y,stroke:$n.badgeBorder,strokeWidth:"1.5"})}),_t.map(function(t){var l,c,s,d,v,g,p=t.x1+.5*(t.x2-t.x1),h=(t.y1+t.y2)/2;if("Not Defined"===t.style.label&&!t.hasCognitive)return null;if(t.isSubSection?de&&Re===t.subSectionKeyPath&&ge:de&&Re===t.sectionIdx&&ge)return null;if(!$){var x=t.isSubSection?u.getBentArrowPath(t.x1,t.y1,t.x2,t.y2):"M ".concat(t.x1," ").concat(t.y1," L ").concat(t.x2," ").concat(t.y2),_=In[t.sectionIdx]||{title:"",content:""},m=Tn[t.sectionIdx]||{title:"",content:""};if(console.log("Base and Ref Sections for Badge:",_,m),t.isSubSection&&t.subSectionKeyPath){var R=t.subSectionKeyPath.includes(u.DEVIATION_BADGE_SEPARATOR)?t.subSectionKeyPath.split(u.DEVIATION_BADGE_SEPARATOR):[],y=R[2]||t.subSectionKeyPath,S=R[3]||y,b=y.split("-").map(Number),A=S.split("-").map(Number),E=null,I=null;b.length>0&&(E=In[b[0]]),A.length>0&&(I=Tn[A[0]]);var T=(null==E?void 0:E.title)||"",B=(null==I?void 0:I.title)||"";console.log("Root Parent Titles:",T,B);for(var C=1;C<b.length;C++)(null==E?void 0:E.subsections)&&(E=E.subsections[b[C]]);for(C=1;C<A.length;C++)(null==I?void 0:I.subsections)&&(I=I.subsections[A[C]]);E&&(_=e.__assign(e.__assign({},E),{title:T||E.title})),console.log("Base Section for Subsection Badge:",_),I&&(m=e.__assign(e.__assign({},I),{title:B||I.title})),console.log("Ref Section for Subsection Badge:",m)}var D=!(null===(l=_.cognitiveData)||void 0===l?void 0:l.isMissingRationale)||Boolean(null===(s=null===(c=_.cognitiveData)||void 0===c?void 0:c.decisioning)||void 0===s?void 0:s.length),O=(null===(g=null===(v=null===(d=_.evaluationResult)||void 0===d?void 0:d.cognitive_decisioning)||void 0===v?void 0:v.decisioning_factors)||void 0===g?void 0:g.length)||!1,w=D||O;return n.jsxs("g",{children:[n.jsx("path",{d:x,fill:"none",stroke:t.style.badgeBorder||"#E2E8F0",strokeWidth:"1.5"}),n.jsx("foreignObject",e.__assign({x:p-100,y:h-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){e.stopPropagation(),w&&(nn.open&&cn===t.id?gn():(vn(t.id),ut(lt(e.currentTarget,_,m,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:600,textAlign:"center",whiteSpace:"nowrap",cursor:w?"pointer":"default"}},{children:[t.style.badgeText===a.DEFAULT_DEVIAION_COLOR&&null==t.style.label?n.jsx(f.default,{color:t.style.badgeText}):0===t.style.label?"Same":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(r.ButtonCognitiveIcon,{})})),w&&n.jsx(o.ChevronDown,{size:11,style:{transform:nn.open&&cn===t.id?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))}))]},t.id)}return null}),Te.map(function(t){var i,o=t.pathD,r=(null===(i=t.style)||void 0===i?void 0:i.badgeBorder)||"#6366F1",l="conn-marker-".concat(t.id),u="".concat(t.id,"-bg"),c="".concat(t.id,"-stroke");return n.jsxs("g",{children:[n.jsx("defs",{children:n.jsx("clipPath",e.__assign({id:"connections-clip"},{children:n.jsx("marker",e.__assign({id:l,markerWidth:"8",markerHeight:"6",refX:"7",refY:"3",orient:"auto"},{children:n.jsx("polygon",{points:"0 0, 8 3, 0 6",fill:r})}))}))}),n.jsx("path",{ref:function(e){we.current[u]=e},d:o,fill:"none",stroke:"#FFFFFF",strokeWidth:"4",strokeOpacity:"0.7"}),n.jsx("path",{ref:function(e){we.current[c]=e},d:o,fill:"none",stroke:r,strokeWidth:"1.75",markerEnd:"url(#".concat(l,")")})]},t.id)})]})),n.jsxs(i.Box,e.__assign({sx:e.__assign({border:"1px solid #E7E7E9",borderRadius:"8px",bgcolor:"#FFFFFF",display:"flex",flexDirection:"column",position:"relative",zIndex:2,filter:"drop-shadow(0px 2px 4px #F2F2F2)"},$?{flex:1,overflow:"visible"}:{})},{children:[n.jsx(i.Box,e.__assign({ref:pt,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E7E7E9",borderRadius:"8px 8px 0 0",display:"flex",alignItems:"center",minHeight:"40px",overflow:"hidden",minWidth:0}},{children:n.jsx(i.Tooltip,e.__assign({title:yn,placement:"top"},{children:n.jsx(i.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:500,color:"#19213D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0,textAlign:"center",display:"block"}},{children:yn}))}))})),n.jsxs(i.Box,e.__assign({ref:Je,onScroll:wt,sx:e.__assign({p:"12px",display:"flex",flexDirection:"column"},$?{maxHeight:"calc(100vh - 150px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,mr:"-160px",pr:"172px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[n.jsx("div",{ref:Ue,style:{width:"100%",height:"0px",flexShrink:0}}),wn&&In.map(function(t,r){var l,c,a=!t.title&&!t.content;if($&&a)return null;var s=t,d=At(r,"left"),v=$?!(null===(l=s.refIndexes)||void 0===l?void 0:l.length)||s.selfIndex<0:!Tn[r],g=$?"number"==typeof s.selfIndex&&s.selfIndex>=0?s.selfIndex+1:null:r+1,p=Ae.has(r),h=u.extractDeviationScore(s.evaluationResult,null==d?void 0:d.deviationLabel);return n.jsx(i.Box,e.__assign({ref:zn(r),sx:{mb:1,width:"100%"}},{children:n.jsxs(i.Box,e.__assign({sx:{position:"relative",width:"100%"}},{children:[n.jsx(i.Box,e.__assign({ref:Fn.current[r],sx:e.__assign({width:"100%",display:"flex"},p&&{borderRadius:"6px",outline:"2px solid ".concat((null==d?void 0:d.badgeBorder)||"#6366F1"),outlineOffset:"1px"})},{children:n.jsx(R.default,{section:t,idx:r,columnKey:"left",colRef:zn("left-accordion-".concat(r)),mb:0,treeData:H,proposedSections:In,existingSections:Tn,deviationNumberRegistry:Dn,getSectionCompareStyle:At,getBadgeRef:Yn,connectedSections:Ae,openMoreFunctionsPopup:ct,openSummaryPopup:Pt,deviationNodeIdToView:Q,deviationTargetParentId:Ht,parentNodeId:(null===(c=null==H?void 0:H.input_index_map)||void 0===c?void 0:c[0])||"",isExpanded:$?!!tt["left-".concat(r)]:!!tt[String(r)],onToggle:function(){Ft(),rt(r,"left")},navigation:t.id?Lt[t.id]:null,showOpenNodeRef:Vt,resolvedMarkdownStyles:Ge,maintainRelativeOrder:$,renderSubSections:qt})})),$&&d&&n.jsxs(i.Box,e.__assign({ref:Mn.current[r],onClick:function(e){var n=$?Tn.find(function(e){var n;return null===(n=s.refIndexes)||void 0===n?void 0:n.includes(e.selfIndex)})||{title:"",content:""}:Tn[r]||{title:"",content:""};ct(e,t,v,n,r,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!==g&&n.jsx(i.Box,e.__assign({component:"span",sx:{fontSize:"11px",fontWeight:700,pr:.5,borderRight:"1px solid ".concat(d.badgeBorder)}},{children:g})),n.jsx(i.Box,e.__assign({component:"span",sx:{fontSize:"11px",px:.25}},{children:!K.isLoading||null!=s.evaluationResult&&null!=s.evaluationResult?v?"No Deviation Found":"N/A"===h||"NA"===h?"N/A":0==h||null==h?"Same":"".concat(h):n.jsx(f.default,{color:d.badgeText})})),n.jsx(o.EllipsisVertical,{size:11,color:d.badgeText})]}))]}))}),"left-row-".concat(r))}),n.jsx("div",{ref:Xe,style:{width:"100%",height:"0px",flexShrink:0}})]}))]})),n.jsx(i.Box,e.__assign({ref:vt,sx:{width:"180px",display:"flex",flexDirection:"column",alignItems:"center",pt:"15px",gap:0,zIndex:20,pointerEvents:"none"}},{children:n.jsx(i.Box,e.__assign({sx:{display:"flex",justifyContent:"center",alignItems:"center",mt:0}},{children:n.jsxs(i.Box,e.__assign({onClick:function(n){n.stopPropagation(),nn.open&&cn===Jn?gn():(vn(Jn),ut(lt(n.currentTarget,{title:"",content:"",evaluationResult:Qn,cognitiveData:{section_id:"",decisioning:[],gap:[],relevance_score:0,isMissingRationale:!0}},null,Jn,!0,e.__assign(e.__assign({},$n),{label:""}))))},sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:"5px",top:"-5px",borderRadius:"20px",bgcolor:$n.badgeBg,color:$n.badgeText,border:"1px solid ".concat($n.badgeBorder),fontSize:"12px",fontWeight:600,whiteSpace:"nowrap",position:"relative",zIndex:1,pointerEvents:"auto",cursor:"pointer"}},{children:[null!=Zn?Zn:n.jsx(f.default,{}),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(r.ButtonCognitiveIcon,{})})),n.jsx(o.ChevronDown,{size:11,style:{transform:nn.open&&cn===Jn?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))})),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},$?{flex:1,overflow:"visible",minHeight:0}:{})},{children:[re&&n.jsx(l.default,{sections:11}),n.jsx(i.Box,e.__assign({ref:ht,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:Sn,placement:"top"},{children:n.jsx(i.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:500,color:"#5928ED",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0,textAlign:"center",display:"block"}},{children:Sn}))}))})),n.jsxs(i.Box,e.__assign({ref:We,onScroll:wt,sx:e.__assign({p:"12px",display:"flex",flexDirection:"column"},$?{maxHeight:"calc(100vh - 150px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,ml:"-120px",pl:"140px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[n.jsx("div",{ref:Ye,style:{width:"100%",height:"0px",flexShrink:0}}),wn&&Tn.map(function(t,o){var r,l=t,u=[],c=!1,a=null,s=-1;if($){u=In.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}),s=In.findIndex(function(e){var n;return(null===(n=e.refIndexes)||void 0===n?void 0:n.includes(l.selfIndex))&&e.selfIndex>=0});var d=In.findIndex(function(e,n){var t;return Ae.has(n)&&(null===(t=e.refIndexes)||void 0===t?void 0:t.includes(l.selfIndex))});(c=-1!==d)&&(a=At(d))}else u=[o+1],(c=Ae.has(o))&&(a=At(o));var v=At($&&-1!==s?s:o);return n.jsx(i.Box,e.__assign({ref:Vn.current[o],sx:{mb:1,width:"100%"}},{children:n.jsxs(i.Box,e.__assign({sx:{position:"relative",width:"100%"}},{children:[n.jsx(i.Box,e.__assign({ref:kn.current[o],sx:e.__assign({width:"100%",display:"flex"},c&&a&&{borderRadius:"6px",outline:"2px solid ".concat(a.badgeBorder),outlineOffset:"1px"})},{children:n.jsx(R.default,{section:t,idx:o,columnKey:"right",colRef:zn("right-accordion-".concat(o)),mb:0,parentNodeId:(null===(r=null==H?void 0:H.input_index_map)||void 0===r?void 0:r[1])||"",isExpanded:$?!!tt["right-".concat(o)]:!!tt[String(o)],treeData:H,proposedSections:In,existingSections:Tn,deviationNumberRegistry:Dn,getBadgeRef:Yn,getSectionCompareStyle:At,connectedSections:Ae,openMoreFunctionsPopup:ct,openSummaryPopup:Pt,deviationNodeIdToView:Q,deviationTargetParentId:Ht,onToggle:function(){Ft(),rt(o,"right")},navigation:t.id?Lt[t.id]:null,showOpenNodeRef:Vt,resolvedMarkdownStyles:Ge,maintainRelativeOrder:$,renderSubSections:qt})})),$&&v&&n.jsx(i.Box,e.__assign({ref:Ln.current[o],"data-section-id":l.id,sx:{position:"absolute",top:"18px",left:0,transform:"translateY(-50%) translateX(calc(-100% - 8px))",display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:"11px",bgcolor:v.badgeBg,color:v.badgeText,border:"1px solid ".concat(v.badgeBorder),borderRadius:"10px",px:1,py:.3,fontWeight:700,whiteSpace:"nowrap",zIndex:20}},{children:u.length>0?u.join(", "):"-"}))]}))}),"right-row-".concat(o))}),n.jsx("div",{ref:Ke,style:{width:"100%",height:"0px",flexShrink:0}})]}))]}))]}))}))}))]}))};
2
2
  //# sourceMappingURL=CognitiveCompare.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("react/jsx-runtime"),n=require("@mui/material"),i=require("lucide-react"),o=require("react");exports.default=function(l){var r,a,s,u=l.open,c=l.anchorEl,d=l.containerEl,p=l.clipTopEl,m=l.onClose,f=l.summary;l.markdownStyles,l.isLoading;var g=o.useRef(null),x=o.useState(null),h=x[0],v=x[1],_=o.useState(null),b=_[0],w=_[1],y="string"==typeof f?{deviation_summary:f}:null!=f?f:{};y.deviation_title;var B=y.deviation_summary,C=y.evaluation_outputs,j=(null===(r=null==C?void 0:C.metadata)||void 0===r?void 0:r.label_color)||"#6366F1",R=null!==(a=null==d?void 0:d.getBoundingClientRect().width)&&void 0!==a?a:180,E=Math.max(148,R+70),S=c&&d?{top:c.getBoundingClientRect().top,bottom:c.getBoundingClientRect().bottom,left:d.getBoundingClientRect().left+d.getBoundingClientRect().width/2}:null;o.useEffect(function(){if(!u||!c||!d)return v(null),void w(null);var e=function(){null!==g.current&&cancelAnimationFrame(g.current),g.current=requestAnimationFrame(function(){var e,t=c.getBoundingClientRect(),n=d.getBoundingClientRect(),i=null==p?void 0:p.getBoundingClientRect();v({top:t.top,bottom:t.bottom,left:n.left+n.width/2}),w(null!==(e=null==i?void 0:i.bottom)&&void 0!==e?e:null)})};e();var t=!0;return window.addEventListener("scroll",e,{passive:!0,capture:t}),window.addEventListener("resize",e),function(){null!==g.current&&cancelAnimationFrame(g.current),window.removeEventListener("scroll",e,t),window.removeEventListener("resize",e)}},[u,c,d,p]);var z=null!==(s=null!=h?h:S)&&void 0!==s?s:{top:0,bottom:0,left:0},q=z.bottom+20,I=null!=b?Math.max(0,b-q):0;return f?t.jsx(n.Popper,e.__assign({open:u,disablePortal:!0,popperOptions:{strategy:"fixed"},anchorEl:{getBoundingClientRect:function(){return{width:0,height:0,top:z.top,bottom:z.top,left:z.left,right:z.left,x:z.left,y:z.top,toJSON:function(){}}}},placement:"bottom",modifiers:[{name:"offset",options:{offset:[0,20]}}],sx:{zIndex:20}},{children:t.jsxs(n.Paper,e.__assign({sx:e.__assign(e.__assign({p:1.5,borderRadius:"12px",width:E,maxWidth:E},I>0&&{clipPath:"inset(".concat(I,"px 0 0 0 round 12px)")}),{transition:"transform 80ms linear",willChange:"transform",backfaceVisibility:"hidden",transform:"translateZ(0)",boxShadow:"0px 10px 24px rgba(15, 23, 42, 0.18)",border:"1px solid ".concat(j,"26"),borderTop:"3px solid ".concat(j),overflow:"hidden",bgcolor:"#fff"})},{children:[t.jsxs(n.Box,e.__assign({sx:{display:"flex",alignItems:"center",justifyContent:"space-between",mb:.75}},{children:[t.jsxs(n.Box,e.__assign({sx:{display:"flex",alignItems:"center",gap:.75,minWidth:0}},{children:[t.jsx(i.Info,{size:14,color:j}),t.jsx(n.Typography,e.__assign({sx:{fontSize:"11px",fontWeight:700,color:j,textTransform:"uppercase",letterSpacing:"0.4px",lineHeight:1.2}},{children:"Summary"}))]})),t.jsx(n.IconButton,e.__assign({size:"small",onClick:m,sx:{p:.25,ml:.5,color:"#64748B"}},{children:t.jsx(i.X,{size:14})}))]})),t.jsx(n.Typography,e.__assign({sx:{fontSize:"12px",color:"#475569",lineHeight:1.5,fontWeight:400,overflowWrap:"anywhere"}},{children:B||"No summary available."}))]}))})):null};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("react/jsx-runtime"),n=require("@mui/material"),o=require("lucide-react"),i=require("react");exports.default=function(l){var r,a,s,u=l.open,c=l.anchorEl,d=l.containerEl,p=l.clipTopEl,m=l.scrollContainerEl,f=l.onClose,g=l.summary;l.markdownStyles,l.isLoading;var x=i.useRef(null),v=i.useRef(null),h=i.useState(null),b=h[0],_=h[1],w=i.useState(null),y=w[0],C=w[1],B=i.useState(null),R=B[0],j=B[1],S=i.useState(0),E=S[0],z=S[1],q="string"==typeof g?{deviation_summary:g}:null!=g?g:{};q.deviation_title;var I=q.deviation_summary,L=q.evaluation_outputs,P=(null===(r=null==L?void 0:L.metadata)||void 0===r?void 0:r.label_color)||"#6366F1",T=null!==(a=null==d?void 0:d.getBoundingClientRect().width)&&void 0!==a?a:180,W=Math.max(148,T+70),F=c&&d?{top:c.getBoundingClientRect().top,bottom:c.getBoundingClientRect().bottom,left:d.getBoundingClientRect().left+d.getBoundingClientRect().width/2}:null;i.useEffect(function(){if(!u||!c||!d)return _(null),C(null),void j(null);var e=function(){null!==x.current&&cancelAnimationFrame(x.current),x.current=requestAnimationFrame(function(){var e,t,n=c.getBoundingClientRect(),o=d.getBoundingClientRect(),i=null==p?void 0:p.getBoundingClientRect(),l=null==m?void 0:m.getBoundingClientRect();_({top:n.top,bottom:n.bottom,left:o.left+o.width/2}),C(null!==(e=null==i?void 0:i.bottom)&&void 0!==e?e:null),j(null!==(t=null==l?void 0:l.bottom)&&void 0!==t?t:null),v.current&&z(v.current.offsetHeight)})};e();var t=!0;return window.addEventListener("scroll",e,{passive:!0,capture:t}),window.addEventListener("resize",e),function(){null!==x.current&&cancelAnimationFrame(x.current),window.removeEventListener("scroll",e,t),window.removeEventListener("resize",e)}},[u,c,d,p,m]);var M=null!==(s=null!=b?b:F)&&void 0!==s?s:{top:0,bottom:0,left:0},k=M.bottom+20,A=k+E,H=null!=y?Math.max(0,y-k):0,O=null!=R?Math.max(0,A-R):0,N=H>0||O>0;return g?t.jsx(n.Popper,e.__assign({open:u,disablePortal:!0,popperOptions:{strategy:"fixed"},anchorEl:{getBoundingClientRect:function(){return{width:0,height:M.bottom-M.top,top:M.top,bottom:M.bottom,left:M.left,right:M.left,x:M.left,y:M.top,toJSON:function(){}}}},placement:"bottom",modifiers:[{name:"offset",options:{offset:[0,20]}}],sx:{zIndex:20}},{children:t.jsxs(n.Paper,e.__assign({ref:v,sx:e.__assign(e.__assign({p:1.5,borderRadius:"12px",width:W,maxWidth:W},N&&{clipPath:"inset(".concat(H,"px 0 ").concat(O-150,"px 0 round 12px)")}),{transition:"transform 80ms linear",willChange:"transform",backfaceVisibility:"hidden",transform:"translateZ(0)",boxShadow:"0px 10px 24px rgba(15, 23, 42, 0.18)",border:"1px solid ".concat(P,"26"),borderTop:"3px solid ".concat(P),overflow:"hidden",bgcolor:"#fff"})},{children:[t.jsxs(n.Box,e.__assign({sx:{display:"flex",alignItems:"center",justifyContent:"space-between",mb:.75}},{children:[t.jsxs(n.Box,e.__assign({sx:{display:"flex",alignItems:"center",gap:.75,minWidth:0}},{children:[t.jsx(o.Info,{size:14,color:P}),t.jsx(n.Typography,e.__assign({sx:{fontSize:"11px",fontWeight:700,color:P,textTransform:"uppercase",letterSpacing:"0.4px",lineHeight:1.2}},{children:"Summary"}))]})),t.jsx(n.IconButton,e.__assign({size:"small",onClick:f,sx:{p:.25,ml:.5,color:"#64748B"}},{children:t.jsx(o.X,{size:14})}))]})),t.jsx(n.Typography,e.__assign({sx:{fontSize:"12px",color:"#475569",lineHeight:1.5,fontWeight:400,overflowWrap:"anywhere"}},{children:I||"No summary available."}))]}))})):null};
2
2
  //# sourceMappingURL=CognitiveSummaryPopup.js.map
@@ -1,2 +1,2 @@
1
- import{__assign as e,__spreadArray as n}from"tslib";import{jsxs as t,jsx as i}from"react/jsx-runtime";import{useState as o,useRef as r,useMemo as l,useEffect as c,useCallback as u}from"react";import{Box as d,Snackbar as a,Alert as s,Tooltip as v,Typography as p}from"@mui/material";import{ChevronDown as f,EllipsisVertical as g}from"lucide-react";import{ButtonCognitiveIcon as h}from"../../assests/svg/ButtonCognitiveIcon.js";import x from"./OverlayComponent.js";import{safeStringify as m,extractDeviationScore as y,generateColorPalette as b,DEVIATION_BADGE_SEPARATOR as S,hasValue as R,getBentArrowPath as C,smoothScrollTo as I}from"./CognitiveComparehelpers.js";import{SHARED_MARKDOWN_STYLES as T,DEFAULT_FIELD_CONFIG as B,DEFAULT_COMPARISON_CONFIG as w}from"./CognitiveCompareConfig.js";export{SHARED_MARKDOWN_STYLES}from"./CognitiveCompareConfig.js";import{DEFAULT_DEVIAION_COLOR as E,DEFAULT_COMPONENT_HEADER_TEXT as F}from"./CognitiveCompareConstants.js";import k from"./CognitivePopup.js";import M from"./MoreFunctionsPopup.js";import _ from"./LoaderComponent.js";import D from"./components/ThreeDotsLoader.js";import{useCognitiveTreeData as H}from"./hooks/useCompareData.js";import{useComparePopups as A}from"./hooks/useComparePopups.js";import{useSectionRefs as P}from"./hooks/useSectionRefs.js";import{useAccordionState as N}from"./hooks/useAccordionState.js";import{useDeviationNavigation as L}from"./hooks/useDeviationNavigation.js";import O from"./components/CompareHeader.js";import j from"./components/SectionAccordion.js";import z from"./components/SubSectionAccordion.js";import W from"./components/CognitiveSummaryPopup.js";var Y=function(Y){var K,V,X,q,J,U,G,Q,Z,$,ee,ne,te,ie,oe,re=Y.componentHeaderText,le=void 0===re?F:re,ce=Y.treeData,ue=Y.comparisonConfig,de=Y.leftColumnTitleText,ae=Y.rightColumnTitleText,se=Y.markdownStyles,ve=Y.displayConfig,pe=void 0===ve?{isHeaderVisible:!0,isToggleVisible:!0,maintainRelativeOrder:!1,isLoading:!0}:ve,fe=Y.popupConfig,ge=Y.deviationData,he=void 0===ge?{}:ge,xe=Y.deviationNodeIdToView,me=o(pe.maintainRelativeOrder),ye=me[0],be=me[1],Se=o(!1),Re=Se[0],Ce=Se[1],Ie=o(!1),Te=Ie[0],Be=Ie[1],we=o(null),Ee=we[0],Fe=we[1],ke=o(!1),Me=ke[0],_e=ke[1],De=o(!1),He=De[0],Ae=De[1],Pe=o(!1),Ne=Pe[0],Le=Pe[1],Oe=o(null),je=Oe[0],ze=Oe[1],We=r(!1),Ye=o(new Set),Ke=Ye[0],Ve=Ye[1],Xe=o([]),qe=Xe[0],Je=Xe[1],Ue=r(null),Ge=r(!1),Qe=r(null),Ze=r({}),$e=r([]),en=r(!1),nn=r(!1),tn=r(null),on=r(function(){}),rn=l(function(){return(null==ce?void 0:ce.cognitive_decisioning)||{}},[ce]),ln=o({width:0,height:0}),cn=ln[0],un=ln[1],dn=l(function(){return e(e({},T),se)},[se]),an=r(null),sn=r(null),vn=r(null),pn=r(null),fn=r(null),gn=r(null),hn=r(null),xn=r(null),mn=r(!1),yn=r(null),bn=r(null),Sn=A(an),Rn=Sn.cognitivePopup,Cn=Sn.setCognitivePopup,In=Sn.moreFunctions,Tn=Sn.setMoreFunctions,Bn=Sn.position,wn=Sn.setPosition,En=Sn.activeBadgeId,Fn=Sn.summaryPopup,kn=Sn.setSummaryPopup,Mn=Sn.closeSummaryPopup,_n=Sn.setActiveBadgeId,Dn=Sn.popupRef,Hn=Sn.closeCognitivePopup,An=Sn.closeMoreFunctionsPopup,Pn=l(function(){var e,n,t,i,o,r,l;return{fields:null!==(e=null==ue?void 0:ue.fields)&&void 0!==e?e:B,thresholds:{high:null!==(t=null===(n=null==ue?void 0:ue.thresholds)||void 0===n?void 0:n.high)&&void 0!==t?t:w.thresholds.high,medium:null!==(o=null===(i=null==ue?void 0:ue.thresholds)||void 0===i?void 0:i.medium)&&void 0!==o?o:w.thresholds.medium,exact:null!==(l=null===(r=null==ue?void 0:ue.thresholds)||void 0===r?void 0:r.exact)&&void 0!==l?l:w.thresholds.exact}}},[ue]),Nn=o(null),Ln=Nn[0];Nn[1];var On=null===(X=null===(K=null==ce?void 0:ce.documents)||void 0===K?void 0:K[null===(V=null==ce?void 0:ce.input_index_map)||void 0===V?void 0:V[0]])||void 0===X?void 0:X.title,jn=null===(U=null===(q=null==ce?void 0:ce.documents)||void 0===q?void 0:q[null===(J=null==ce?void 0:ce.input_index_map)||void 0===J?void 0:J[1]])||void 0===U?void 0:U.title,zn=m(de||On||"Uploaded Contract"),Wn=m(ae||jn||"Reference Template"),Yn=H(ce,ye,he,Pn),Kn=Yn.activeProposed,Vn=Yn.existingRule,Xn=Yn.proposedSections,qn=Yn.existingSections,Jn=Yn.visibleFields,Un=Yn.parentDeviationRecord,Gn=Yn.deviationNumberRegistry,Qn=Yn.parseError;c(function(){Qn&&Fe("Failed to load comparison: ".concat(Qn))},[Qn]);var Zn=Xn.length>0||qn.length>0,$n=P(Jn.map(function(e){return e.key}),Math.max(Xn.length,qn.length)),et=$n.leftRefs,nt=$n.rightRefs,tt=$n.sectionLeftRefs,it=$n.sectionRightRefs,ot=$n.lhsBadgeRefs,rt=$n.rhsBadgeRefs,lt=$n.sectionRightRowRefs,ct=$n.subSectionLeftRefs,ut=$n.subSectionRightRefs,dt=$n.sectionRowRefs,at=$n.getSectionRowRef,st=$n.getSubSectionRef,vt=$n.getBadgeRef,pt=Vn.analysis,ft=m(null===(Q=null===(G=null==pt?void 0:pt.rule_difference_comparison)||void 0===G?void 0:G.summary)||void 0===Q?void 0:Q.overall_summary),gt=!!ft.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),ht=null!==(Z=null==ce?void 0:ce.base_root_id)&&void 0!==Z?Z:"-1";null==ce||ce[ht];var xt=(null===($=null==he?void 0:he[ht])||void 0===$?void 0:$.evaluation_result)||(null===(ne=null===(ee=null==ce?void 0:ce.nodes)||void 0===ee?void 0:ee[ht])||void 0===ne?void 0:ne.evaluation_result)||null,mt=y(xt),yt=b(null!==(oe=null===(ie=null===(te=null==xt?void 0:xt.evaluation_outputs)||void 0===te?void 0:te.metadata)||void 0===ie?void 0:ie.label_color)&&void 0!==oe?oe:""),bt=u(function(){var e,n,t,i,o,r;_e(!1),nn.current=!1;var l=tn.current,c=Dt.current;if(null!==l)if("string"==typeof l&&l.includes(S)){var u=l.split(S);(d=(null===(e=ct.current[u[2]])||void 0===e?void 0:e.current)||(null===(n=tt.current[Number(u[2])])||void 0===n?void 0:n.current))&&(d.style.paddingTop="0px")}else{var d;(d=null===(t=tt.current[l])||void 0===t?void 0:t.current)&&(d.style.paddingTop="0px")}if(null!==c)if("string"==typeof c&&c.includes(S)){u=c.split(S);(a=(null===(i=ut.current[u[3]])||void 0===i?void 0:i.current)||(null===(o=it.current[Number(u[3])])||void 0===o?void 0:o.current))&&(a.style.paddingTop="0px")}else{var a;(a=null===(r=it.current[c])||void 0===r?void 0:r.current)&&(a.style.paddingTop="0px")}ze(null),tn.current=null,Dt.current=null,Ae(!1),Be(!1),pn.current&&(pn.current.style.height="0px"),fn.current&&(fn.current.style.height="0px"),gn.current&&(gn.current.style.height="0px"),hn.current&&(hn.current.style.height="0px")},[]),St=N({maintainRelativeOrder:!!ye,proposedSections:Xn,existingSections:qn,activeSideBySideSection:je,connectedSections:Ke,resetSideBySide:bt,setConnectedSections:Ve,setConnectedLines:Je,cachedConnectedPositions:$e,svgContainerRef:Ue,isAnimatingRef:Ge,animationTimerRef:Qe,calculateLinesRef:on,sectionLeftRefs:tt,sectionRightRefs:it,subSectionLeftRefs:ct,subSectionRightRefs:ut}),Rt=St.expandedSections,Ct=St.expandedSubSections,It=St.setExpandedSubSections,Tt=St.toggleSection,Bt=u(function(e,n,t,i,o,r,l){var c,u,d,a=m(null==n?void 0:n.id)||m(null==t?void 0:t.id)||"",s=(a?rn[a]:null)||(null==n?void 0:n.cognitiveData)||(null==t?void 0:t.cognitiveData)||{section_id:a,decisioning:[],gap:[],relevance_score:0},v=null!==(u=null===(c=dt.current[i])||void 0===c?void 0:c.current)&&void 0!==u?u:null;return{isLoading:null!==(d=null==pe?void 0:pe.isLoading)&&void 0!==d&&d,open:!0,sectionTitle:(null==n?void 0:n.displayTitle)?null==n?void 0:n.title:"no title",refSectionTitle:(null==t?void 0:t.displayTitle)?null==t?void 0:t.title:"no title",cognitiveData:s,anchorEl:e,sectionAnchorEl:v,badgeStyle:r||null,sectionIdx:i,docData:{documents:null==ce?void 0:ce.documents,input_index_map:null==ce?void 0:ce.input_index_map},deviationData:(null==n?void 0:n.evaluationResult)||(null==t?void 0:t.evaluationResult)||null,isOrphan:!!o}},[rn,ce]),wt=u(function(e){An(),wn(null),Cn(e)},[An]),Et=function(e,n,t,i,o,r){e.stopPropagation(),In.open&&In.sectionIdx===o?An():(Hn(),Fn.open?ti():Mn(),Tn(Bt(e.currentTarget,n,i,o,t,r)))},Ft=u(function(){null!==In.sectionIdx&&In.anchorEl?wt(e(e({},In),{open:!0})):An()},[In,An,wt]),kt=u(function(){var e=In.sectionIdx,n=In.isOrphan;An(),Mn(),null!==e&&(n?Fe("No counterpart exists to connect to."):(nn.current&&bt(),Je([]),$e.current=[],Ve(function(n){return n.has(e)?new Set:new Set([e])}),setTimeout(function(){on.current&&on.current()},50)))},[In.sectionIdx,In.isOrphan,An,Mn,bt]),Mt=r(null),_t=r(null),Dt=r(null),Ht=r(null),At=r(null),Pt=r(null),Nt=o([]),Lt=Nt[0],Ot=Nt[1];r(null);var jt=o(null),zt=jt[0],Wt=jt[1];c(function(){if(Ln){var e=Pn.fields.find(function(e){return e.analysisKey===Ln||e.key===Ln});if(e){var n=et.current[e.key]||nt.current[e.key];(null==n?void 0:n.current)&&setTimeout(function(){return n.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[Ln,Pn.fields]);var Yt=u(function(e){var n,t,i,o,r,l,c,u,d,a=null===(n=null==pt?void 0:pt.rule_difference_comparison)||void 0===n?void 0:n.fields;if(!a||!a[e])return{score:0,relation:"",highlightsA:[],highlightsB:[],hasContent:!1};var s=a[e],v=(null==s?void 0:s.relation)||(null===(i=null===(t=null==s?void 0:s.highlights)||void 0===t?void 0:t.ruleA_spans)||void 0===i?void 0:i.length)||(null===(r=null===(o=null==s?void 0:s.highlights)||void 0===o?void 0:o.ruleB_spans)||void 0===r?void 0:r.length)||(null==s?void 0:s.mappings)&&s.mappings.length>0;if(s.mappings){var p=s.mappings[0]||{};return{score:s.score,relation:p.relation||"",highlightsA:(null===(l=p.highlights)||void 0===l?void 0:l.ruleA_spans)||[],highlightsB:(null===(c=p.highlights)||void 0===c?void 0:c.ruleB_spans)||[],hasContent:!!v}}return{score:s.score,relation:s.relation||"",highlightsA:(null===(u=s.highlights)||void 0===u?void 0:u.ruleA_spans)||[],highlightsB:(null===(d=s.highlights)||void 0===d?void 0:d.ruleB_spans)||[],hasContent:!!v}},[pt]),Kt=u(function(n,t){var i,o,r,l,c,u,d;void 0===t&&(t="left");var a=null,s=null;if("left"===t)if(a=Xn[n],ye&&a){var v=qn.filter(function(e){var n;return null===(n=a.refIndexes)||void 0===n?void 0:n.includes(e.selfIndex)});s=v.find(function(e){return e.evaluationResult})||v[0]}else s=qn[n];else if(s=qn[n],ye&&s){var p=Xn.filter(function(e){var n;return null===(n=e.refIndexes)||void 0===n?void 0:n.includes(s.selfIndex)});a=p.find(function(e){return e.evaluationResult})||p[0]}else a=Xn[n];var f=(null==a?void 0:a.relation)&&"not_defined"!==a.relation,g=(null==s?void 0:s.relation)&&"not_defined"!==s.relation,h=!(!(null==a?void 0:a.cognitiveData)&&!(null==s?void 0:s.cognitiveData));if(!f&&!g&&!h)return e(e({},b(E)),{label:"Not Defined"});var x=null!==(o=null!==(i=null==a?void 0:a.evaluationResult)&&void 0!==i?i:null==s?void 0:s.evaluationResult)&&void 0!==o?o:null,m=null===(r=null==x?void 0:x.evaluation_outputs)||void 0===r?void 0:r.output_value,y=null!==(u=null===(c=null===(l=null==x?void 0:x.evaluation_outputs)||void 0===l?void 0:l.metadata)||void 0===c?void 0:c.label_color)&&void 0!==u?u:E;return e(e({},b(y)),null!=x?{label:null!==(d=m)&&void 0!==d?d:""}:{label:null})},[Xn,qn,rn,Pn,ye]),Vt=u(function(n){for(var t,i,o,r,l,c,u,d,a,s=n.split("-").map(Number),v=Xn[s[0]],p=qn[s[0]],f=1;f<s.length;f++)(null==v?void 0:v.subsections)&&(v=v.subsections[s[f]]),(null==p?void 0:p.subsections)&&(p=p.subsections[s[f]]);if(!v&&!p)return null;var g=(null==v?void 0:v.relation)&&"not_defined"!==v.relation,h=(null==p?void 0:p.relation)&&"not_defined"!==p.relation,x=m(null==v?void 0:v.id)||m(null==p?void 0:p.id)||"",y=!(!(null==v?void 0:v.cognitiveData)&&!(null==p?void 0:p.cognitiveData));if(!g&&!h&&!y)return e(e({},b(E)),{label:"Not Defined"});null!==(i=null!==(t=null==v?void 0:v.cognitiveRelevanceScore)&&void 0!==t?t:null==p?void 0:p.cognitiveRelevanceScore)&&void 0!==i||x&&(null===(o=rn[x])||void 0===o||o.relevance_score);var S=null!==(l=null!==(r=null==v?void 0:v.evaluationResult)&&void 0!==r?r:null==p?void 0:p.evaluationResult)&&void 0!==l?l:null,R=null===(c=null==S?void 0:S.evaluation_outputs)||void 0===c?void 0:c.output_value,C=null!==(a=null===(d=null===(u=null==S?void 0:S.evaluation_outputs)||void 0===u?void 0:u.metadata)||void 0===d?void 0:d.label_color)&&void 0!==a?a:E;return e(e({},b(C)),null!=S?{label:null!=R?R:""}:{label:null})},[Xn,qn,rn,Pn]),Xt=u(function(){var e,n,t,i,o,r,l,c,u,d,a,s,v,p,f,g,h,x,m,y,b,I;if(!mn.current&&!Ge.current){mn.current=!0;try{if(!Mt.current)return;var T=function(e){var n=e.split("-"),t=n[0];if(!Rt[t]&&!1===ye)return!1;if(ye&&!Rt["left-".concat(t)]&&!Rt["right-".concat(t)]&&!Rt[t])return!1;for(var i=t,o=1;o<n.length-1;o++)if(i+="-".concat(n[o]),!Ct[i])return!1;return!0},B=Mt.current.getBoundingClientRect();un({width:B.width,height:B.height});var w=[];if(Jn.forEach(function(e){var n,t,i=e.key,o=null===(n=et.current[i])||void 0===n?void 0:n.current,r=null===(t=nt.current[i])||void 0===t?void 0:t.current;o&&r&&(o.style.height="auto",r.style.height="auto",o.style.minHeight="0px",r.style.minHeight="0px")}),!Ge.current){for(var E=0;E<Math.max(Xn.length,qn.length);E++){var F=null===(e=tt.current[E])||void 0===e?void 0:e.current,k=null===(n=it.current[E])||void 0===n?void 0:n.current;F&&(F.style.height="auto",F.style.minHeight="0px"),k&&(k.style.height="auto",k.style.minHeight="0px")}ye||Object.keys(ct.current).forEach(function(e){var n,t;if(T(e)){var i=null===(n=ct.current[e])||void 0===n?void 0:n.current,o=null===(t=ut.current[e])||void 0===t?void 0:t.current;i&&o&&(i.style.height="auto",o.style.height="auto",i.style.minHeight="0px",o.style.minHeight="0px")}})}var M={};Jn.forEach(function(e){var n,t,i=e.key,o=null===(n=et.current[i])||void 0===n?void 0:n.current,r=null===(t=nt.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=o.getBoundingClientRect(),c=r.getBoundingClientRect();M[i]=Math.max(l.height,c.height)}});var _={left:{},right:{}},D={};if(!Ge.current)if(ye){if(Me&&null!==je)if("number"==typeof je){var H=je,A=Xn[H],P=null===(o=tt.current[H])||void 0===o?void 0:o.current;P&&A&&(A.refIndexes||[]).forEach(function(e){var n,t=qn.findIndex(function(n){return n.selfIndex===e}),i=null===(n=it.current[t])||void 0===n?void 0:n.current;if(i&&(Rt["left-".concat(H)]||Rt["right-".concat(t)])){var o=Math.max(P.getBoundingClientRect().height,i.getBoundingClientRect().height);_.left[H]=Math.max(_.left[H]||0,o),_.right[t]=Math.max(_.right[t]||0,o)}})}else{var N=je.split(S)[2];if(N){F=null===(r=ct.current[N])||void 0===r?void 0:r.current,k=null===(l=ut.current[N])||void 0===l?void 0:l.current;if(F&&k){L=Math.max(F.getBoundingClientRect().height,k.getBoundingClientRect().height);D[N]=Math.max(D[N]||0,L)}}}}else{Object.keys(ct.current).forEach(function(e){var n,t;if(T(e)){var i=null===(n=ct.current[e])||void 0===n?void 0:n.current,o=null===(t=ut.current[e])||void 0===t?void 0:t.current;if(i&&o&&null!==i.offsetParent&&null!==o.offsetParent){var r=i.getBoundingClientRect(),l=o.getBoundingClientRect(),c=Math.max(r.height,l.height);D[e]=c,i.style.minHeight="".concat(c,"px"),o.style.minHeight="".concat(c,"px")}}});for(E=0;E<Math.min(Xn.length,qn.length);E++){var F=null===(t=tt.current[E])||void 0===t?void 0:t.current,k=null===(i=it.current[E])||void 0===i?void 0:i.current;if(F&&k){var L=Math.max(F.getBoundingClientRect().height,k.getBoundingClientRect().height);_.left[E]=L,_.right[E]=L}}}if(Jn.forEach(function(e){var n,t,i=e.key,o=null===(n=et.current[i])||void 0===n?void 0:n.current,r=null===(t=nt.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=M[i];o.style.minHeight="".concat(l,"px"),r.style.minHeight="".concat(l,"px")}}),Ge.current||(Object.entries(_.left).forEach(function(e){var n,t=e[0],i=e[1],o=null===(n=tt.current[Number(t)])||void 0===n?void 0:n.current;o&&(o.style.minHeight="".concat(i,"px"))}),Object.entries(_.right).forEach(function(e){var n,t=e[0],i=e[1],o=null===(n=it.current[Number(t)])||void 0===n?void 0:n.current;o&&(o.style.minHeight="".concat(i,"px"))}),ye||Object.keys(D).forEach(function(e){var n,t,i=null===(n=ct.current[e])||void 0===n?void 0:n.current,o=null===(t=ut.current[e])||void 0===t?void 0:t.current;if(i&&o&&D[e]){var r=D[e];i.style.minHeight="".concat(r,"px"),o.style.minHeight="".concat(r,"px")}})),ye)Xn.forEach(function(e,n){var t;(null===(t=tt.current[n])||void 0===t?void 0:t.current)&&(e.refIndexes||[]).forEach(function(e){var t,i,o,r,l,c,u,d,a,s,v=qn.findIndex(function(n){return n.selfIndex===e});if(-1!==v){var p=null===(t=ot.current[n])||void 0===t?void 0:t.current,f=null===(i=rt.current[v])||void 0===i?void 0:i.current;if(p&&f){var g=p.getBoundingClientRect(),h=f.getBoundingClientRect(),x=g.right-B.left,m=h.left-B.left,y=g.top+g.height/2-B.top,b=h.top+h.height/2-B.top;if(Me&&je===n){var S=null!==(r=null===(o=xn.current)||void 0===o?void 0:o.getBoundingClientRect().top)&&void 0!==r?r:0,R=null!==(c=null===(l=vn.current)||void 0===l?void 0:l.getBoundingClientRect().top)&&void 0!==c?c:0,C=S+(null!==(d=null===(u=xn.current)||void 0===u?void 0:u.clientHeight)&&void 0!==d?d:1/0),I=R+(null!==(s=null===(a=vn.current)||void 0===a?void 0:a.clientHeight)&&void 0!==s?s:1/0),T=g.top+g.height/2,E=h.top+h.height/2,F=function(e,n,t){return Math.max(n,Math.min(t,e))};y=F(T,S,C)-B.top,b=F(E,R,I)-B.top}var k=Kt(n);k&&w.push({id:"line-".concat(n,"-").concat(v),x1:x,y1:y,x2:m,y2:b,style:k,sectionIdx:n,targetRightIdx:v})}}})});else{for(E=0;E<Math.min(Xn.length,qn.length);E++){var O=null===(c=tt.current[E])||void 0===c?void 0:c.current,j=null===(u=it.current[E])||void 0===u?void 0:u.current;if(O&&j){var z=O.getBoundingClientRect(),W=j.getBoundingClientRect(),Y=Math.max(z.top,W.top)+18-B.top,K=(null===(d=qn[E])||void 0===d?void 0:d.id)||"sec-".concat(E);(Z=Kt(E))&&w.push({id:K,x1:z.right-B.left,y1:Y,x2:W.left-B.left,y2:Y,style:Z,sectionIdx:E,hasCognitive:!!((null===(a=Xn[E])||void 0===a?void 0:a.cognitiveData)||(null===(s=qn[E])||void 0===s?void 0:s.cognitiveData)||K&&rn[K]),isSubSection:!1})}}Object.keys(ct.current).forEach(function(e){var n,t,i,o,r,l;if(T(e)){var c=null===(n=ct.current[e])||void 0===n?void 0:n.current,u=null===(t=ut.current[e])||void 0===t?void 0:t.current;if(c&&u){for(var d=e.split("-").map(Number),a=Xn[d[0]],s=qn[d[0]],v=1;v<d.length;v++)(null==a?void 0:a.subsections)&&(a=a.subsections[d[v]]),(null==s?void 0:s.subsections)&&(s=s.subsections[d[v]]);var p=!!a&&((null===(i=a.displayTitle)||void 0===i||i)&&R(a.title)),f=!!a&&((null===(o=a.displayContent)||void 0===o||o)&&R(a.content)),g=!!s&&((null===(r=s.displayTitle)||void 0===r||r)&&R(s.title)),h=!!s&&((null===(l=s.displayContent)||void 0===l||l)&&R(s.content));if(p&&f||g&&h){var x=c.getBoundingClientRect(),m=u.getBoundingClientRect(),y=Math.max(x.top,m.top)+16-B.top,b=Vt(e);b&&"Not Defined"!==b.label&&w.push({id:"subsec-".concat(e),x1:x.right-B.left,y1:y,x2:m.left-B.left,y2:y,style:b,sectionIdx:d[0],isSubSection:!0,subSectionKeyPath:e,hasCognitive:!(!(null==a?void 0:a.cognitiveData)&&!(null==s?void 0:s.cognitiveData))})}}}})}if(Me&&"string"==typeof je&&je.includes(S)){var V=je.split(S),X=V[0],q=V[1],J=V[2],U=(V[3],"".concat(X).concat(S).concat(q)),G=null===(v=ot.current[U])||void 0===v?void 0:v.current,Q=null===(p=rt.current[U])||void 0===p?void 0:p.current;if(G&&Q){var Z,$=G.getBoundingClientRect(),ee=Q.getBoundingClientRect(),ne=$.right-B.left,te=ee.left-B.left,ie=$.top+$.height/2-B.top,oe=ee.top+ee.height/2-B.top;if(ye){var re=null!==(g=null===(f=xn.current)||void 0===f?void 0:f.getBoundingClientRect().top)&&void 0!==g?g:0,le=null!==(x=null===(h=vn.current)||void 0===h?void 0:h.getBoundingClientRect().top)&&void 0!==x?x:0,ce=re+(null!==(y=null===(m=xn.current)||void 0===m?void 0:m.clientHeight)&&void 0!==y?y:1/0),ue=le+(null!==(I=null===(b=vn.current)||void 0===b?void 0:b.clientHeight)&&void 0!==I?I:1/0),de=function(e,n,t){return Math.max(n,Math.min(t,e))};ie=de($.top+$.height/2,re,ce)-B.top,oe=de(ee.top+ee.height/2,le,ue)-B.top}(Z=Vt(J))&&w.push({id:"line-subsec-".concat(U),x1:ne,y1:ie,x2:te,y2:oe,style:Z,sectionIdx:Number(J.split("-")[0]),isSubSection:!0,subSectionKeyPath:je})}}if(Ot(w),At.current&&Pt.current){var ae=At.current.getBoundingClientRect(),se=Pt.current.getBoundingClientRect(),ve=(ae.top+ae.height/2-B.top+se.top+se.height/2-B.top)/2;Wt({x1:ae.right-B.left,x2:se.left-B.left,y:ve})}else Wt(null);if(Ke.size>0){var pe=[],fe=xn.current,ge=vn.current;if(fe&&ge){var he=[],xe=fe.getBoundingClientRect().top,me=ge.getBoundingClientRect().top,be=xe+fe.clientHeight,Se=me+ge.clientHeight,Re=fe.scrollTop,Ce=ge.scrollTop,Ie=B.top,Te=function(e,n,t){return Math.max(n,Math.min(t,e))};Ke.forEach(function(e){var n,t,i,o,r;if("string"==typeof e&&e.includes(S)){var l=e.split(S),c=l[0],u=l[1],d=l[2],a=(l[3],"".concat(c).concat(S).concat(u)),s=null===(n=ot.current[a])||void 0===n?void 0:n.current,v=null===(t=rt.current[a])||void 0===t?void 0:t.current;if(!s||!v)return;var p=s.getBoundingClientRect(),f=v.getBoundingClientRect(),g=Vt(d),h=(A=p.right-B.left)+.5*((P=f.left-B.left-0)-A),x=p.top+p.height/2,m=f.top+f.height/2,y=x-xe+Re,b=m-me+Ce,R="conn-subsec-".concat(a);he.push({lhsScrollY:y,rhsScrollY:b,x1:A,x2:P,containerTop:Ie,leftIdx:e,rhsArrayIdx:e,styleColor:(null==g?void 0:g.badgeBorder)||"#6366F1",styleId:R});var I=Te(x,xe,be),T=Te(m,me,Se),w=I-Ie,E=T-Ie,F=m>=me-4&&m<=Se+4,k="";k=(N=x>=xe-4&&x<=be+4)&&F?C(A,w,P,E):N&&!F?"M ".concat(A,",").concat(w," L ").concat(h,",").concat(w," L ").concat(h,",").concat(E):!N&&F?"M ".concat(h,",").concat(w," L ").concat(h,",").concat(E," L ").concat(P,",").concat(E):"M ".concat(h,",").concat(w," L ").concat(h,",").concat(E),pe.push({id:R,pathD:k,style:g,leftIdx:e,rhsArrayIdx:e})}else if(ye){var M=e,_=Xn[M];if(!(null===(r=null==_?void 0:_.refIndexes)||void 0===r?void 0:r.length))return;_.refIndexes.forEach(function(e){var n,t,i=qn.findIndex(function(n){return n.selfIndex===e});if(-1!==i){var o=null===(n=ot.current[M])||void 0===n?void 0:n.current,r=null===(t=rt.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=o.getBoundingClientRect(),c=r.getBoundingClientRect(),u=Kt(M),d=l.right-B.left,a=c.left-B.left-0,s=d+.5*(a-d),v=l.top+l.height/2,p=c.top+c.height/2,f=v-xe+Re,g=p-me+Ce,h="conn-".concat(M,"-").concat(i);he.push({lhsScrollY:f,rhsScrollY:g,x1:d,x2:a,containerTop:Ie,leftIdx:M,rhsArrayIdx:i,styleColor:(null==u?void 0:u.badgeBorder)||"#6366F1",styleId:h});var x=Te(v,xe,be),m=Te(p,me,Se),y=x-Ie,b=m-Ie,S=v>=xe-4&&v<=be+4,R=p>=me-4&&p<=Se+4,I="";I=S&&R?C(d,y,a,b):S&&!R?"M ".concat(d,",").concat(y," L ").concat(s,",").concat(y," L ").concat(s,",").concat(b):!S&&R?"M ".concat(s,",").concat(y," L ").concat(s,",").concat(b," L ").concat(a,",").concat(b):"M ".concat(s,",").concat(y," L ").concat(s,",").concat(b),pe.push({id:h,pathD:I,style:u,leftIdx:M,rhsArrayIdx:i})}}})}else{var D=e,H=D;s=null===(i=ot.current[D])||void 0===i?void 0:i.current,v=null===(o=rt.current[H])||void 0===o?void 0:o.current;if(!s||!v)return;var A,P;p=s.getBoundingClientRect(),f=v.getBoundingClientRect(),g=Kt(D),h=(A=p.right-B.left)+.5*((P=f.left-B.left-0)-A),x=p.top+p.height/2,m=f.top+f.height/2,y=x-xe+Re,b=m-me+Ce,R="conn-".concat(D,"-").concat(H);he.push({lhsScrollY:y,rhsScrollY:b,x1:A,x2:P,containerTop:Ie,leftIdx:D,rhsArrayIdx:H,styleColor:(null==g?void 0:g.badgeBorder)||"#6366F1",styleId:R});var N;I=Te(x,xe,be),T=Te(m,me,Se),w=I-Ie,E=T-Ie,F=m>=me-4&&m<=Se+4,k="";k=(N=x>=xe-4&&x<=be+4)&&F?C(A,w,P,E):N&&!F?"M ".concat(A,",").concat(w," L ").concat(h,",").concat(w," L ").concat(h,",").concat(E):!N&&F?"M ".concat(h,",").concat(w," L ").concat(h,",").concat(E," L ").concat(P,",").concat(E):"M ".concat(h,",").concat(w," L ").concat(h,",").concat(E),pe.push({id:R,pathD:k,style:g,leftIdx:D,rhsArrayIdx:H})}}),$e.current=he}Je(pe)}else Je([]),$e.current=[]}catch(e){console.error("Line render safe fail: ",e)}finally{mn.current=!1}}},[Jn,Xn,qn,rn,Pn,Yt,Kt,ye,Me,je,Ke,Rt,Ct]),qt=u(function(){var e,n,t,i,o,r,l,c,u,d,a,s,v,p,f=$e.current;if(f.length&&!Ge.current){var g=null!==(n=null===(e=xn.current)||void 0===e?void 0:e.scrollTop)&&void 0!==n?n:0,h=null!==(i=null===(t=vn.current)||void 0===t?void 0:t.scrollTop)&&void 0!==i?i:0,x=null!==(r=null===(o=xn.current)||void 0===o?void 0:o.clientHeight)&&void 0!==r?r:1/0,m=null!==(c=null===(l=vn.current)||void 0===l?void 0:l.clientHeight)&&void 0!==c?c:1/0,y=null!==(d=null===(u=xn.current)||void 0===u?void 0:u.getBoundingClientRect().top)&&void 0!==d?d:0,b=null!==(s=null===(a=vn.current)||void 0===a?void 0:a.getBoundingClientRect().top)&&void 0!==s?s:0,S=y+x,R=b+m,C=null!==(p=null===(v=Mt.current)||void 0===v?void 0:v.getBoundingClientRect().top)&&void 0!==p?p:0,I=function(e,n,t){return Math.max(n,Math.min(t,e))};f.forEach(function(e){var n=e.lhsScrollY-g+y,t=e.rhsScrollY-h+b,i=Ze.current[e.styleId+"-stroke"],o=Ze.current[e.styleId+"-bg"];if(i||o){var r,l=I(n,y,S),c=I(t,b,R),u=l-C,d=c-C;r="M ".concat(e.x1,",").concat(u," L ").concat(e.x2,",").concat(d),i&&(i.setAttribute("visibility","visible"),i.setAttribute("d",r)),o&&(o.setAttribute("visibility","visible"),o.setAttribute("d",r))}})}},[]);c(function(){on.current=Xt},[Xt]);var Jt=r(null),Ut=r(null),Gt=u(function(){$e.current.length>0&&!Ge.current||(null!==Jt.current&&clearTimeout(Jt.current),Jt.current=setTimeout(function(){on.current(),Jt.current=null},50))},[]),Qt=u(function(){Le(!0),Ae(!1),null!==Ut.current&&clearTimeout(Ut.current),null!==Jt.current&&(clearTimeout(Jt.current),Jt.current=null),Ut.current=setTimeout(function(){var e,n,t,i,o,r,l,c,u,d;if($e.current=[],nn.current&&null!==tn.current&&null!==Dt.current){var a=tn.current,s=Dt.current,v=null,p=null,f=null,g=null;if("string"==typeof a&&a.includes(S)){var h=a.split(S),x="".concat(h[0]).concat(S).concat(h[1]);v=(null===(e=ot.current[x])||void 0===e?void 0:e.current)||null,p=(null===(n=rt.current[x])||void 0===n?void 0:n.current)||null,f=(null===(t=ct.current[h[2]])||void 0===t?void 0:t.current)||(null===(i=tt.current[Number(h[2])])||void 0===i?void 0:i.current)||null,g=(null===(o=ut.current[h[3]])||void 0===o?void 0:o.current)||(null===(r=it.current[Number(h[3])])||void 0===r?void 0:r.current)||null}else v=(null===(l=dt.current[a])||void 0===l?void 0:l.current)||null,f=(null===(c=tt.current[a])||void 0===c?void 0:c.current)||null,p=(null===(u=lt.current[s])||void 0===u?void 0:u.current)||null,g=(null===(d=it.current[s])||void 0===d?void 0:d.current)||null;if(v&&p&&f&&g){if(f.style.paddingTop="0px",g.style.paddingTop="0px",!ye){var m=v.getBoundingClientRect(),y=p.getBoundingClientRect(),b=m.top-y.top;b>0?g.style.paddingTop="".concat(b,"px"):b<0&&(f.style.paddingTop="".concat(Math.abs(b),"px"))}var R=xn.current,C=vn.current;if(R&&C){var I=v.getBoundingClientRect().top-R.getBoundingClientRect().top+R.scrollTop,T=p.getBoundingClientRect().top-C.getBoundingClientRect().top+C.scrollTop-(I-R.scrollTop);Math.abs(C.scrollTop-T)>1&&(C.scrollTop=T)}}}on.current(),nn.current&&Ae(!0),Le(!1),Ut.current=null},150)},[ye,Xn,qn]),Zt=u(function(e){var n,t,i,o,r,l,c,u,d,a;if(null!==yn.current&&bn.current&&Math.abs(e.currentTarget.scrollTop-yn.current)<=2){var s=bn.current;yn.current=null,bn.current=null,s()}if(!We.current){if(ye||Gt(),nn.current){var v=tn.current,p=Dt.current,f=xn.current,g=vn.current;if(null!==v&&null!==p&&f&&g){var h="string"==typeof v&&v.includes(S)?null===(n=ot.current["".concat(v.split(S)[0]).concat(S).concat(v.split(S)[1])])||void 0===n?void 0:n.current:null===(t=dt.current[v])||void 0===t?void 0:t.current,x="string"==typeof p&&p.includes(S)?null===(i=rt.current["".concat(p.split(S)[0]).concat(S).concat(p.split(S)[1])])||void 0===i?void 0:i.current:null===(o=lt.current[p])||void 0===o?void 0:o.current;if(h&&x){var m=h.getBoundingClientRect().top-f.getBoundingClientRect().top+f.scrollTop,y=x.getBoundingClientRect().top-g.getBoundingClientRect().top+g.scrollTop;if(e.currentTarget===f){var b=y-(m-f.scrollTop),R=g.scrollHeight-g.clientHeight,C=Math.max(0,Math.min(b,R));Math.abs(g.scrollTop-C)>1&&(g.scrollTop=C)}else if(e.currentTarget===g){var I=m-(y-g.scrollTop),T=f.scrollHeight-f.clientHeight,B=Math.max(0,Math.min(I,T));Math.abs(f.scrollTop-B)>1&&(f.scrollTop=B)}if(Ht.current){var w=void 0,E=void 0;if("string"==typeof v&&v.includes(S)){var F=v.split(S),k="".concat(F[0]).concat(S).concat(F[1]);w=null===(r=ot.current[k])||void 0===r?void 0:r.current,E=null===(l=rt.current[k])||void 0===l?void 0:l.current}else w=null===(c=ot.current[v])||void 0===c?void 0:c.current,E=null===(u=rt.current[p])||void 0===u?void 0:u.current;var M=null!==(a=null===(d=Mt.current)||void 0===d?void 0:d.getBoundingClientRect().top)&&void 0!==a?a:0,_=f.getBoundingClientRect().top,D=_+f.clientHeight;g.getBoundingClientRect().top;g.clientHeight;if(w&&E){var H=w.getBoundingClientRect(),A=E.getBoundingClientRect(),P=H.top+H.height/2;A.top,A.height;var N=((O=P,j=_,z=D,Math.max(j,Math.min(z,O)))-M).toString();Ht.current.setAttribute("y1",N),Ht.current.setAttribute("y2",N);var L=P>=_-4&&P<=D+4;Ht.current.setAttribute("visibility",L?"visible":"hidden")}}}}}var O,j,z;$e.current.length>0&&!en.current&&(en.current=!0,requestAnimationFrame(function(){qt(),en.current=!1}))}},[qt,ye,Gt]);c(function(){var e=setTimeout(Gt,250);window.addEventListener("resize",Qt);var n=null,t=null;return an.current&&(n=new ResizeObserver(Gt)).observe(an.current),Mt.current&&(t=new ResizeObserver(Gt)).observe(Mt.current),function(){clearTimeout(e),null!==Jt.current&&clearTimeout(Jt.current),null!==Ut.current&&clearTimeout(Ut.current),window.removeEventListener("resize",Qt),null==n||n.disconnect(),null==t||t.disconnect()}},[Kn,Vn,pt,Jn,Rt,Ct,Xn,qn,Pn,Gt,Qt,Me,je,He,Ke]),c(function(){nn.current=Me},[Me]),c(function(){tn.current=je},[je]);var $t=u(function(e,n,t){var i,o,r=null===(i=null==t?void 0:t.toggleIfSame)||void 0===i||i,l=null==t?void 0:t.onReady,c=null!==(o=null==t?void 0:t.sourceSide)&&void 0!==o?o:"left";An(),null!=e&&(n?Fe("No counterpart exists for this section."):Me&&je===e?r?bt():null==l||l():(Ve(new Set),Je([]),$e.current=[],Be(!0),We.current=!0,ze(e),tn.current=e,_e(!0),nn.current=!0,Ae(!1),pn.current&&(pn.current.style.height="0px"),fn.current&&(fn.current.style.height="0px"),gn.current&&(gn.current.style.height="0px"),hn.current&&(hn.current.style.height="0px"),requestAnimationFrame(function(){var n,t,i,o,r,u=null,d=null,a=null;if("string"==typeof e&&e.includes(S)){var s=e.split(S),v="".concat(s[0]).concat(S).concat(s[1]);u=(null===(n=ot.current[v])||void 0===n?void 0:n.current)||null,a=(d=(null===(t=rt.current[v])||void 0===t?void 0:t.current)||null)?e:null}else if(u=(null===(i=dt.current[e])||void 0===i?void 0:i.current)||null,ye){var p=Xn[e],f=(null==p?void 0:p.refIndexes)||[];if(f.length>0){var g=f[0],h=qn.findIndex(function(e){return e.selfIndex===g});-1!==h&&(d=(null===(r=lt.current[h])||void 0===r?void 0:r.current)||null,a=h)}}else a=(d=(null===(o=lt.current[e])||void 0===o?void 0:o.current)||null)?e:null;Dt.current=a;var x=xn.current,m=vn.current,y=function(){"right"===c&&m?m.dispatchEvent(new Event("scroll")):x&&x.dispatchEvent(new Event("scroll"))};if(!u||!x)return We.current=!1,Be(!1),void(null==l||l());if(!d||!m)return Ae(!0),on.current(),We.current=!1,Be(!1),void(null==l||l());if(!ye){var b=0;b="right"===c?d?d.getBoundingClientRect().top:0:u?u.getBoundingClientRect().top:0;var R=an.current,C=(null==R?void 0:R.getBoundingClientRect().top)||0,T=R?R.scrollTop+b-C-150:0;return R?void I(R,T,200,function(){Ae(!0),on.current(),We.current=!1,y(),Be(!1),null==l||l()}):(Ae(!0),on.current(),We.current=!1,Be(!1),void(null==l||l()))}var B=u.getBoundingClientRect().top-x.getBoundingClientRect().top+x.scrollTop,w=d.getBoundingClientRect().top-m.getBoundingClientRect().top+m.scrollTop,E=200;if("left"===c){var F=w-(B-x.scrollTop);F<0&&pn.current&&(pn.current.style.height="".concat(Math.abs(F),"px")),requestAnimationFrame(function(){var e,n=m.scrollHeight-m.clientHeight;if(F<0)e=0;else{if(F>n){var t=F-n;return fn.current&&(fn.current.style.height="".concat(t+150,"px")),void requestAnimationFrame(function(){I(m,F,E,function(){Ae(!0),on.current(),We.current=!1,y(),Be(!1),null==l||l()})})}e=F}I(m,e,E,function(){Ae(!0),on.current(),We.current=!1,y(),Be(!1),null==l||l()})})}else{var k=B-(w-m.scrollTop);k<0&&gn.current&&(gn.current.style.height="".concat(Math.abs(k),"px")),requestAnimationFrame(function(){var e,n=x.scrollHeight-x.clientHeight;if(k<0)e=0;else{if(k>n){var t=k-n;return hn.current&&(hn.current.style.height="".concat(t+150,"px")),void requestAnimationFrame(function(){I(x,k,E,function(){Ae(!0),on.current(),We.current=!1,y(),Be(!1),null==l||l()})})}e=k}I(x,e,E,function(){Ae(!0),on.current(),We.current=!1,y(),Be(!1),null==l||l()})})}})))},[je,An,qn,Me,ye,Xn,bt]),ei=u(function(e,n,t,i){var o,r="string"==typeof i?m(i).trim():m(null==i?void 0:i.deviation_summary).trim(),l=e.currentTarget;Hn();var c="left";if((null===(o=vn.current)||void 0===o?void 0:o.contains(l))&&(c="right"),t)return bt(),Ve(new Set),Je([]),$e.current=[],void(r&&kn({open:!0,anchorEl:l,summary:i}));$t(n,t,r?{toggleIfSame:!1,sourceSide:c,onReady:function(){kn({open:!0,anchorEl:l,summary:i})}}:{toggleIfSame:!1,sourceSide:c})},[$t,Hn,kn,bt]),ni=u(function(){var e,n=In.sectionIdx,t=In.isOrphan;if(Mn(),null!=n){var i="left";In.anchorEl&&(null===(e=vn.current)||void 0===e?void 0:e.contains(In.anchorEl))&&(i="right"),$t(n,t,{sourceSide:i})}},[$t,In.isOrphan,In.sectionIdx,In.anchorEl,Mn]),ti=u(function(){Mn(),bt(),Ve(new Set),Je([]),$e.current=[]},[Mn,bt]),ii=null!==In.sectionIdx&&Ke.has(In.sectionIdx),oi=L({proposedSections:Xn,existingSections:qn,parentDeviationRecord:Un,expandedSections:Rt,maintainRelativeOrder:!!ye,scrollContainerRef:an,leftContainerRef:xn,lhsBadgeRefs:ot,rhsBadgeRefs:rt}),ri=oi.showDeviationNavigation,li=oi.showOpenNodeRef,ci=l(function(){if(!xe)return null;for(var e in Un){if((Un[e]||[]).some(function(e){return e.id===xe}))return e}return null},[xe,Un]),ui=r(null);c(function(){if(xe&&ui.current!==xe){var e=!1,t=0,i=null,o=150,r=function(e,n){for(var t=function(e,i){if(!e)return null;if(e.id===n)return i;if(!Array.isArray(e.subsections))return null;for(var o=0;o<e.subsections.length;o++){var r=t(e.subsections[o],"".concat(i,"-").concat(o));if(r)return r}return null},i=0;i<e.length;i++){var o=t(e[i],String(i));if(o)return o}return null},l=function(){var c,u,d,a;if(!e){var s=null,v=null;for(var p in Un){var f=Un[p].find(function(e){return e.id===xe});if(f){s=p,v=f;break}}if(v&&s){var g=Xn.findIndex(function(e){return e.id===s});if(!(ye?!!Rt["left-".concat(g)]:!!Rt[String(g)])&&g>=0)return Tt(g,"left"),t+=1,void(i=setTimeout(l,450));var h=r(Xn,v.id),x=r(qn,v.id);if(h&&!x){var m=h.split("-"),y=Number(m[0]);if(ye){var b=null===(u=null===(c=Xn[y])||void 0===c?void 0:c.refIndexes)||void 0===u?void 0:u[0],R=qn.findIndex(function(e){return e.selfIndex===b});-1!==R&&(y=R)}x=n([y],m.slice(1),!0).join("-")}if(h&&x){var C="".concat(v.id).concat(S,"0").concat(S).concat(h).concat(S).concat(x),I="".concat(v.id).concat(S,"0"),T=null===(d=ot.current[I])||void 0===d?void 0:d.current,B=null===(a=rt.current[I])||void 0===a?void 0:a.current,w=ye?xn.current:an.current;if(T&&w){var E=T.getBoundingClientRect();if(0===E.height)return void((t+=1)<20&&(i=setTimeout(l,o)));var F=w.getBoundingClientRect(),k=E.top-F.top+w.scrollTop-F.height/2+E.height/2,M=function(){var n,t,i;if(!e){ui.current=xe;var o=window.getComputedStyle(T).color;T.style.transition="box-shadow 300ms ease-in-out",T.style.boxShadow="0 0 10px ".concat(o),B&&(B.style.transition="box-shadow 300ms ease-in-out",B.style.boxShadow="0 0 10px ".concat(o)),setTimeout(function(){T&&(T.style.boxShadow=""),B&&(B.style.boxShadow="")},2e3);var r=(null===(t=null===(n=v.evaluationResult)||void 0===n?void 0:n.deviations)||void 0===t?void 0:t[0])||v,l=(null===(i=v.evaluationResult)||void 0===i?void 0:i.evaluation_outputs)||v.evaluation_outputs;$t(C,!1,{toggleIfSame:!1,sourceSide:"left",onReady:function(){kn({open:!0,anchorEl:T,summary:{deviation_summary:r.deviation_summary||r,evaluation_outputs:l}})}})}};Math.abs(w.scrollTop-k)<=2?M():(yn.current=k,bn.current=M,w.scrollTo({top:k,behavior:"smooth"}),i&&clearTimeout(i),i=setTimeout(function(){if(bn.current){yn.current=null;var e=bn.current;bn.current=null,e()}},800))}else(t+=1)<20&&(i=setTimeout(l,o))}else(t+=1)<20&&(i=setTimeout(l,o))}else(t+=1)<20&&(i=setTimeout(l,o))}};return i=setTimeout(l,o),function(){e=!0,i&&clearTimeout(i)}}},[xe,Un,Xn,qn,ye,Rt,Tt,$t,kn]);var di=function(e){var n=e.section,t=e.keyPath,o=e.depth,r=void 0===o?0:o,l=e.columnKey,c=void 0===l?"left":l,u=e.parentNodeId;return i(z,{section:n,keyPath:t,depth:r,columnKey:c,parentNodeId:void 0===u?"":u,expandedSubSections:Ct,setExpandedSubSections:It,maintainRelativeOrder:ye||!1,proposedSections:Xn,existingSections:qn,treeData:ce,deviationNumberRegistry:Gn,connectedSections:Ke,activeSideBySideSection:je,resolvedMarkdownStyles:dn,getSubSectionRef:st,getSubSectionCompareStyle:Vt,getBadgeRef:vt,openMoreFunctionsPopup:Et,openSummaryPopup:ei,resetSideBySide:bt,setConnectedSections:Ve,setConnectedLines:Je,cachedConnectedPositions:$e})};return t(d,e({ref:sn,sx:e(e({display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif'},ye?{}:{overflow:"visible"}),{position:"relative"})},{children:[Re&&i(d,e({sx:{position:"absolute",inset:0,bgcolor:"rgba(255, 255, 255, 0.6)",backdropFilter:"blur(10px)",zIndex:9999,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"8px"}},{children:i(_,{})})),Fn.open&&i(W,{open:Fn.open,anchorEl:Fn.anchorEl,containerEl:_t.current,clipTopEl:At.current,onClose:ti,summary:Fn.summary}),i(M,{open:In.open,anchorEl:In.anchorEl,sectionTitle:In.sectionTitle,referenceSectionTitle:In.refSectionTitle,onClose:An,onOpenCognitiveCompare:Ft,onOpenSideBySide:ni,onConnect:kt,isConnected:ii,isOrphan:In.isOrphan}),Rn.open&&i(k,{open:Rn.open,popupRef:Dn,position:Bn,popupConfig:fe,onClose:function(){wn(null),Cn(function(n){return e(e({},n),{open:!1})}),_n(null)},markdownStyles:se,sectionTitle:Rn.sectionTitle,referenceSectionTitle:Rn.refSectionTitle,cognitiveData:Rn.cognitiveData,anchorEl:Rn.anchorEl,sectionAnchorEl:Rn.sectionAnchorEl,scrollContainerEl:an.current,badgeStyle:Rn.badgeStyle,docData:Rn.docData,deviationData:Rn.deviationData,isLoading:Rn.isLoading}),i(a,e({open:!!Ee,autoHideDuration:8e3,onClose:function(){return Fe(null)},anchorOrigin:{vertical:"top",horizontal:"center"}},{children:i(s,e({onClose:function(){return Fe(null)},severity:"error",sx:{width:"100%",whiteSpace:"pre-line"}},{children:Ee}))})),i(O,{componentHeaderText:le,displayConfig:pe,maintainRelativeOrder:ye,onToggleView:function(e){Ce(!0),setTimeout(function(){be(!e),bt(),Mn(),Ve(new Set),Je([]),$e.current=[],setTimeout(function(){Ce(!1)},400)},50)}}),i(d,e({ref:an,onScroll:Zt,sx:{flex:1,minHeight:0,pt:1.5,pb:1,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",overflowY:ye?"hidden":"auto",borderTop:ft&&gt?"none":"1.5px solid #EEF0F4"}},{children:i(d,e({sx:e({display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"},ye?{flex:1,minHeight:0}:{})},{children:t(d,e({ref:Mt,sx:e({display:"grid",gridTemplateColumns:"minmax(0, 1fr) 180px minmax(0, 1fr)",gap:"40px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0},ye?{flex:1,overflow:"visible"}:{})},{children:[t("svg",e({ref:Ue,style:{position:"absolute",top:0,left:0,width:cn.width||"100%",height:cn.height||"100%",pointerEvents:"none",zIndex:10,overflow:"visible",opacity:Ne?0:1,transition:"opacity 0.15s ease-in-out"}},{children:[zt&&i("g",{children:i("line",{x1:zt.x1,y1:zt.y,x2:zt.x2,y2:zt.y,stroke:yt.badgeBorder,strokeWidth:"1.5"})}),Lt.map(function(n){var o,r,l,c,u,a,s=n.x1+.5*(n.x2-n.x1),v=(n.y1+n.y2)/2;if("Not Defined"===n.style.label&&!n.hasCognitive)return null;if(n.isSubSection?Me&&je===n.subSectionKeyPath&&He:Me&&je===n.sectionIdx&&He)return t("g",e({style:{transition:"opacity 0.2s"}},{children:[i("defs",{children:i("marker",e({id:"arr-".concat(n.id),markerWidth:"7",markerHeight:"5",refX:"7",refY:"2.5",orient:"auto"},{children:i("polygon",{points:"0 0, 7 2.5, 0 5",fill:n.style.badgeBorder||"#6366F1"})}))}),i("line",{ref:Ht,x1:n.x1,y1:n.y1,x2:n.x2,y2:n.y2,stroke:n.style.badgeBorder||"#6366F1",strokeWidth:"1.5",markerEnd:"url(#arr-".concat(n.id,")")})]}),n.id);if(!ye){var p=n.isSubSection?C(n.x1,n.y1,n.x2,n.y2):"M ".concat(n.x1," ").concat(n.y1," L ").concat(n.x2," ").concat(n.y2),g=Xn[n.sectionIdx]||{title:"",content:""},x=qn[n.sectionIdx]||{title:"",content:""};if(console.log("Base and Ref Sections for Badge:",g,x),n.isSubSection&&n.subSectionKeyPath){var m=n.subSectionKeyPath.includes(S)?n.subSectionKeyPath.split(S):[],y=m[2]||n.subSectionKeyPath,b=m[3]||y,R=y.split("-").map(Number),I=b.split("-").map(Number),T=null,B=null;R.length>0&&(T=Xn[R[0]]),I.length>0&&(B=qn[I[0]]);var w=(null==T?void 0:T.title)||"",F=(null==B?void 0:B.title)||"";console.log("Root Parent Titles:",w,F);for(var k=1;k<R.length;k++)(null==T?void 0:T.subsections)&&(T=T.subsections[R[k]]);for(k=1;k<I.length;k++)(null==B?void 0:B.subsections)&&(B=B.subsections[I[k]]);T&&(g=e(e({},T),{title:w||T.title})),console.log("Base Section for Subsection Badge:",g),B&&(x=e(e({},B),{title:F||B.title})),console.log("Ref Section for Subsection Badge:",x)}var M=!(null===(o=g.cognitiveData)||void 0===o?void 0:o.isMissingRationale)||Boolean(null===(l=null===(r=g.cognitiveData)||void 0===r?void 0:r.decisioning)||void 0===l?void 0:l.length),_=(null===(a=null===(u=null===(c=g.evaluationResult)||void 0===c?void 0:c.cognitive_decisioning)||void 0===u?void 0:u.decisioning_factors)||void 0===a?void 0:a.length)||!1,H=M||_;return t("g",{children:[i("path",{d:p,fill:"none",stroke:n.style.badgeBorder||"#E2E8F0",strokeWidth:"1.5"}),i("foreignObject",e({x:s-100,y:v-14,width:"200",height:"28",style:{pointerEvents:"auto",overflow:"visible"}},{children:i(d,e({sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},{children:t(d,e({onClick:function(e){e.stopPropagation(),H&&(Rn.open&&En===n.id?Hn():(_n(n.id),wt(Bt(e.currentTarget,g,x,n.sectionIdx,n.style))))},sx:{display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",bgcolor:n.style.badgeBg,color:n.style.badgeText,border:"1px solid ".concat(n.style.badgeBorder),borderRadius:"12px",px:1.5,py:.5,fontWeight:600,textAlign:"center",whiteSpace:"nowrap",cursor:H?"pointer":"default"}},{children:[n.style.badgeText===E&&null==n.style.label?i(D,{color:n.style.badgeText}):0===n.style.label?"Same":n.style.label,i(d,e({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:i(h,{})})),H&&i(f,{size:11,style:{transform:Rn.open&&En===n.id?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))}))]},n.id)}return null}),qe.map(function(n){var o,r=n.pathD,l=(null===(o=n.style)||void 0===o?void 0:o.badgeBorder)||"#6366F1",c="conn-marker-".concat(n.id),u="".concat(n.id,"-bg"),d="".concat(n.id,"-stroke");return t("g",{children:[i("defs",{children:i("clipPath",e({id:"connections-clip"},{children:i("marker",e({id:c,markerWidth:"8",markerHeight:"6",refX:"7",refY:"3",orient:"auto"},{children:i("polygon",{points:"0 0, 8 3, 0 6",fill:l})}))}))}),i("path",{ref:function(e){Ze.current[u]=e},d:r,fill:"none",stroke:"#FFFFFF",strokeWidth:"4",strokeOpacity:"0.7"}),i("path",{ref:function(e){Ze.current[d]=e},d:r,fill:"none",stroke:l,strokeWidth:"1.75",markerEnd:"url(#".concat(c,")")})]},n.id)})]})),t(d,e({sx:e({border:"1px solid #E7E7E9",borderRadius:"8px",bgcolor:"#FFFFFF",display:"flex",flexDirection:"column",position:"relative",zIndex:2,filter:"drop-shadow(0px 2px 4px #F2F2F2)"},ye?{flex:1,overflow:"visible"}:{})},{children:[i(d,e({ref:At,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E7E7E9",borderRadius:"8px 8px 0 0",display:"flex",alignItems:"center",minHeight:"40px",overflow:"hidden",minWidth:0}},{children:i(v,e({title:zn,placement:"top"},{children:i(p,e({sx:{fontSize:"16px",fontWeight:500,color:"#19213D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0,textAlign:"center",display:"block"}},{children:zn}))}))})),t(d,e({ref:xn,onScroll:Zt,sx:e({p:"12px",display:"flex",flexDirection:"column"},ye?{maxHeight:"calc(100vh - 150px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,mr:"-160px",pr:"172px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[i("div",{ref:gn,style:{width:"100%",height:"0px",flexShrink:0}}),Zn&&Xn.map(function(n,o){var r,l,c=!n.title&&!n.content;if(ye&&c)return null;var u=n,a=Kt(o,"left"),s=ye?!(null===(r=u.refIndexes)||void 0===r?void 0:r.length)||u.selfIndex<0:!qn[o],v=ye?"number"==typeof u.selfIndex&&u.selfIndex>=0?u.selfIndex+1:null:o+1,p=Ke.has(o),f=y(u.evaluationResult,null==a?void 0:a.deviationLabel);return i(d,e({ref:at(o),sx:{mb:1,width:"100%"}},{children:t(d,e({sx:{position:"relative",width:"100%"}},{children:[i(d,e({ref:tt.current[o],sx:e({width:"100%",display:"flex"},p&&{borderRadius:"6px",outline:"2px solid ".concat((null==a?void 0:a.badgeBorder)||"#6366F1"),outlineOffset:"1px"})},{children:i(j,{section:n,idx:o,columnKey:"left",colRef:at("left-accordion-".concat(o)),mb:0,treeData:ce,proposedSections:Xn,existingSections:qn,deviationNumberRegistry:Gn,getSectionCompareStyle:Kt,getBadgeRef:vt,connectedSections:Ke,openMoreFunctionsPopup:Et,openSummaryPopup:ei,deviationNodeIdToView:xe,deviationTargetParentId:ci,parentNodeId:(null===(l=null==ce?void 0:ce.input_index_map)||void 0===l?void 0:l[0])||"",isExpanded:ye?!!Rt["left-".concat(o)]:!!Rt[String(o)],onToggle:function(){ti(),Tt(o,"left")},navigation:n.id?ri[n.id]:null,showOpenNodeRef:li,resolvedMarkdownStyles:dn,maintainRelativeOrder:ye,renderSubSections:di})})),ye&&a&&t(d,e({ref:ot.current[o],onClick:function(e){var t=ye?qn.find(function(e){var n;return null===(n=u.refIndexes)||void 0===n?void 0:n.includes(e.selfIndex)})||{title:"",content:""}:qn[o]||{title:"",content:""};Et(e,n,s,t,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!==v&&i(d,e({component:"span",sx:{fontSize:"11px",fontWeight:700,pr:.5,borderRight:"1px solid ".concat(a.badgeBorder)}},{children:v})),i(d,e({component:"span",sx:{fontSize:"11px",px:.25}},{children:!pe.isLoading||null!=u.evaluationResult&&null!=u.evaluationResult?s?"No Deviation Found":"N/A"===f||"NA"===f?"N/A":0==f||null==f?"Same":"".concat(f):i(D,{color:a.badgeText})})),i(g,{size:11,color:a.badgeText})]}))]}))}),"left-row-".concat(o))}),i("div",{ref:hn,style:{width:"100%",height:"0px",flexShrink:0}})]}))]})),i(d,e({ref:_t,sx:{width:"180px",display:"flex",flexDirection:"column",alignItems:"center",pt:"15px",gap:0,zIndex:20,pointerEvents:"none"}},{children:i(d,e({sx:{display:"flex",justifyContent:"center",alignItems:"center",mt:0}},{children:t(d,e({onClick:function(n){n.stopPropagation(),Rn.open&&En===ht?Hn():(_n(ht),wt(Bt(n.currentTarget,{title:"",content:"",evaluationResult:xt,cognitiveData:{section_id:"",decisioning:[],gap:[],relevance_score:0,isMissingRationale:!0}},null,ht,!0,e(e({},yt),{label:""}))))},sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:"5px",top:"-5px",borderRadius:"20px",bgcolor:yt.badgeBg,color:yt.badgeText,border:"1px solid ".concat(yt.badgeBorder),fontSize:"12px",fontWeight:600,whiteSpace:"nowrap",position:"relative",zIndex:1,pointerEvents:"auto",cursor:"pointer"}},{children:[null!=mt?mt:i(D,{}),i(d,e({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:i(h,{})})),i(f,{size:11,style:{transform:Rn.open&&En===ht?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))})),t(d,e({sx:e({border:"1px solid #E3E6EA",borderRadius:"8px",bgcolor:"#FFFFFF",boxShadow:"0px 1px 4px #F7F4FE",position:"relative",zIndex:2,display:"flex",flexDirection:"column",minWidth:0},ye?{flex:1,overflow:"visible",minHeight:0}:{})},{children:[Te&&i(x,{sections:11}),i(d,e({ref:Pt,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E3E6EA",borderRadius:"8px 8px 0 0",minHeight:"40px",display:"flex",alignItems:"center",overflowX:"hidden"}},{children:i(v,e({title:Wn,placement:"top"},{children:i(p,e({sx:{fontSize:"16px",fontWeight:500,color:"#5928ED",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0,textAlign:"center",display:"block"}},{children:Wn}))}))})),t(d,e({ref:vn,onScroll:Zt,sx:e({p:"12px",display:"flex",flexDirection:"column"},ye?{maxHeight:"calc(100vh - 150px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,ml:"-120px",pl:"140px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[i("div",{ref:pn,style:{width:"100%",height:"0px",flexShrink:0}}),Zn&&qn.map(function(n,o){var r,l=n,c=[],u=!1,a=null,s=-1;if(ye){c=Xn.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}),s=Xn.findIndex(function(e){var n;return(null===(n=e.refIndexes)||void 0===n?void 0:n.includes(l.selfIndex))&&e.selfIndex>=0});var v=Xn.findIndex(function(e,n){var t;return Ke.has(n)&&(null===(t=e.refIndexes)||void 0===t?void 0:t.includes(l.selfIndex))});(u=-1!==v)&&(a=Kt(v))}else c=[o+1],(u=Ke.has(o))&&(a=Kt(o));var p=Kt(ye&&-1!==s?s:o);return i(d,e({ref:lt.current[o],sx:{mb:1,width:"100%"}},{children:t(d,e({sx:{position:"relative",width:"100%"}},{children:[i(d,e({ref:it.current[o],sx:e({width:"100%",display:"flex"},u&&a&&{borderRadius:"6px",outline:"2px solid ".concat(a.badgeBorder),outlineOffset:"1px"})},{children:i(j,{section:n,idx:o,columnKey:"right",colRef:at("right-accordion-".concat(o)),mb:0,parentNodeId:(null===(r=null==ce?void 0:ce.input_index_map)||void 0===r?void 0:r[1])||"",isExpanded:ye?!!Rt["right-".concat(o)]:!!Rt[String(o)],treeData:ce,proposedSections:Xn,existingSections:qn,deviationNumberRegistry:Gn,getBadgeRef:vt,getSectionCompareStyle:Kt,connectedSections:Ke,openMoreFunctionsPopup:Et,openSummaryPopup:ei,deviationNodeIdToView:xe,deviationTargetParentId:ci,onToggle:function(){ti(),Tt(o,"right")},navigation:n.id?ri[n.id]:null,showOpenNodeRef:li,resolvedMarkdownStyles:dn,maintainRelativeOrder:ye,renderSubSections:di})})),ye&&!Te&&p&&i(d,e({ref:rt.current[o],"data-section-id":l.id,sx:{position:"absolute",top:"18px",left:0,transform:"translateY(-50%) translateX(calc(-100% - 8px))",display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:"11px",bgcolor:p.badgeBg,color:p.badgeText,border:"1px solid ".concat(p.badgeBorder),borderRadius:"10px",px:1,py:.3,fontWeight:700,whiteSpace:"nowrap",zIndex:20}},{children:c.length>0?c.join(", "):"-"}))]}))}),"right-row-".concat(o))}),i("div",{ref:fn,style:{width:"100%",height:"0px",flexShrink:0}})]}))]}))]}))}))}))]}))};export{Y as default};
1
+ import{__assign as e,__spreadArray as n}from"tslib";import{jsxs as t,jsx as i}from"react/jsx-runtime";import{useState as o,useRef as r,useMemo as l,useEffect as c,useCallback as u}from"react";import{Box as d,Snackbar as a,Alert as s,Tooltip as v,Typography as p}from"@mui/material";import{ChevronDown as f,EllipsisVertical as g}from"lucide-react";import{ButtonCognitiveIcon as h}from"../../assests/svg/ButtonCognitiveIcon.js";import x from"./OverlayComponent.js";import{safeStringify as m,extractDeviationScore as y,generateColorPalette as b,DEVIATION_BADGE_SEPARATOR as S,hasValue as R,getBentArrowPath as C,smoothScrollTo as I}from"./CognitiveComparehelpers.js";import{SHARED_MARKDOWN_STYLES as B,DEFAULT_FIELD_CONFIG as w,DEFAULT_COMPARISON_CONFIG as T}from"./CognitiveCompareConfig.js";export{SHARED_MARKDOWN_STYLES}from"./CognitiveCompareConfig.js";import{DEFAULT_DEVIAION_COLOR as E,DEFAULT_COMPONENT_HEADER_TEXT as F}from"./CognitiveCompareConstants.js";import _ from"./CognitivePopup.js";import M from"./MoreFunctionsPopup.js";import k from"./LoaderComponent.js";import D from"./components/ThreeDotsLoader.js";import{useCognitiveTreeData as A}from"./hooks/useCompareData.js";import{useComparePopups as H}from"./hooks/useComparePopups.js";import{useSectionRefs as L}from"./hooks/useSectionRefs.js";import{useAccordionState as P}from"./hooks/useAccordionState.js";import{useDeviationNavigation as N}from"./hooks/useDeviationNavigation.js";import O from"./components/CompareHeader.js";import j from"./components/SectionAccordion.js";import z from"./components/SubSectionAccordion.js";import W from"./components/CognitiveSummaryPopup.js";var Y=function(Y){var K,q,V,X,J,U,G,Q,Z,$,ee,ne,te,ie,oe,re=Y.componentHeaderText,le=void 0===re?F:re,ce=Y.treeData,ue=Y.comparisonConfig,de=Y.leftColumnTitleText,ae=Y.rightColumnTitleText,se=Y.markdownStyles,ve=Y.displayConfig,pe=void 0===ve?{isHeaderVisible:!0,isToggleVisible:!0,maintainRelativeOrder:!1,isLoading:!0}:ve,fe=Y.popupConfig,ge=Y.deviationData,he=void 0===ge?{}:ge,xe=Y.deviationNodeIdToView,me=o(pe.maintainRelativeOrder),ye=me[0],be=me[1],Se=o(!1),Re=Se[0],Ce=Se[1],Ie=o(!1),Be=Ie[0],we=Ie[1],Te=o(null),Ee=Te[0],Fe=Te[1],_e=o(!1),Me=_e[0],ke=_e[1],De=o(!1),Ae=De[0],He=De[1],Le=o(!1),Pe=Le[0],Ne=Le[1],Oe=o(null),je=Oe[0],ze=Oe[1],We=r(!1),Ye=o(new Set),Ke=Ye[0],qe=Ye[1],Ve=o([]),Xe=Ve[0],Je=Ve[1],Ue=r(null),Ge=r(!1),Qe=r(null),Ze=r({}),$e=r([]),en=r(!1),nn=r(!1),tn=r(null),on=r(function(){}),rn=l(function(){return(null==ce?void 0:ce.cognitive_decisioning)||{}},[ce]),ln=o({width:0,height:0}),cn=ln[0],un=ln[1],dn=l(function(){return e(e({},B),se)},[se]),an=r(null),sn=r(null),vn=r(null),pn=r(null),fn=r(null),gn=r(null),hn=r(null),xn=r(null),mn=r(!1),yn=r(null),bn=r(null),Sn=H(an),Rn=Sn.cognitivePopup,Cn=Sn.setCognitivePopup,In=Sn.moreFunctions,Bn=Sn.setMoreFunctions,wn=Sn.position,Tn=Sn.setPosition,En=Sn.activeBadgeId,Fn=Sn.summaryPopup,_n=Sn.setSummaryPopup,Mn=Sn.closeSummaryPopup,kn=Sn.setActiveBadgeId,Dn=Sn.popupRef,An=Sn.closeCognitivePopup,Hn=Sn.closeMoreFunctionsPopup,Ln=l(function(){var e,n,t,i,o,r,l;return{fields:null!==(e=null==ue?void 0:ue.fields)&&void 0!==e?e:w,thresholds:{high:null!==(t=null===(n=null==ue?void 0:ue.thresholds)||void 0===n?void 0:n.high)&&void 0!==t?t:T.thresholds.high,medium:null!==(o=null===(i=null==ue?void 0:ue.thresholds)||void 0===i?void 0:i.medium)&&void 0!==o?o:T.thresholds.medium,exact:null!==(l=null===(r=null==ue?void 0:ue.thresholds)||void 0===r?void 0:r.exact)&&void 0!==l?l:T.thresholds.exact}}},[ue]),Pn=o(null),Nn=Pn[0];Pn[1];var On=null===(V=null===(K=null==ce?void 0:ce.documents)||void 0===K?void 0:K[null===(q=null==ce?void 0:ce.input_index_map)||void 0===q?void 0:q[0]])||void 0===V?void 0:V.title,jn=null===(U=null===(X=null==ce?void 0:ce.documents)||void 0===X?void 0:X[null===(J=null==ce?void 0:ce.input_index_map)||void 0===J?void 0:J[1]])||void 0===U?void 0:U.title,zn=m(de||On||"Uploaded Contract"),Wn=m(ae||jn||"Reference Template"),Yn=A(ce,ye,he,Ln),Kn=Yn.activeProposed,qn=Yn.existingRule,Vn=Yn.proposedSections,Xn=Yn.existingSections,Jn=Yn.visibleFields,Un=Yn.parentDeviationRecord,Gn=Yn.deviationNumberRegistry,Qn=Yn.parseError;c(function(){Qn&&Fe("Failed to load comparison: ".concat(Qn))},[Qn]);var Zn=Vn.length>0||Xn.length>0,$n=L(Jn.map(function(e){return e.key}),Math.max(Vn.length,Xn.length)),et=$n.leftRefs,nt=$n.rightRefs,tt=$n.sectionLeftRefs,it=$n.sectionRightRefs,ot=$n.lhsBadgeRefs,rt=$n.rhsBadgeRefs,lt=$n.sectionRightRowRefs,ct=$n.subSectionLeftRefs,ut=$n.subSectionRightRefs,dt=$n.sectionRowRefs,at=$n.getSectionRowRef,st=$n.getSubSectionRef,vt=$n.getBadgeRef,pt=qn.analysis,ft=m(null===(Q=null===(G=null==pt?void 0:pt.rule_difference_comparison)||void 0===G?void 0:G.summary)||void 0===Q?void 0:Q.overall_summary),gt=!!ft.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),ht=null!==(Z=null==ce?void 0:ce.base_root_id)&&void 0!==Z?Z:"-1";null==ce||ce[ht];var xt=(null===($=null==he?void 0:he[ht])||void 0===$?void 0:$.evaluation_result)||(null===(ne=null===(ee=null==ce?void 0:ce.nodes)||void 0===ee?void 0:ee[ht])||void 0===ne?void 0:ne.evaluation_result)||null,mt=y(xt),yt=b(null!==(oe=null===(ie=null===(te=null==xt?void 0:xt.evaluation_outputs)||void 0===te?void 0:te.metadata)||void 0===ie?void 0:ie.label_color)&&void 0!==oe?oe:""),bt=u(function(){var e,n,t,i,o,r;ke(!1),nn.current=!1;var l=tn.current,c=Dt.current;if(null!==l)if("string"==typeof l&&l.includes(S)){var u=l.split(S);(d=(null===(e=ct.current[u[2]])||void 0===e?void 0:e.current)||(null===(n=tt.current[Number(u[2])])||void 0===n?void 0:n.current))&&(d.style.paddingTop="0px")}else{var d;(d=null===(t=tt.current[l])||void 0===t?void 0:t.current)&&(d.style.paddingTop="0px")}if(null!==c)if("string"==typeof c&&c.includes(S)){u=c.split(S);(a=(null===(i=ut.current[u[3]])||void 0===i?void 0:i.current)||(null===(o=it.current[Number(u[3])])||void 0===o?void 0:o.current))&&(a.style.paddingTop="0px")}else{var a;(a=null===(r=it.current[c])||void 0===r?void 0:r.current)&&(a.style.paddingTop="0px")}ze(null),tn.current=null,Dt.current=null,He(!1),we(!1),pn.current&&(pn.current.style.height="0px"),fn.current&&(fn.current.style.height="0px"),gn.current&&(gn.current.style.height="0px"),hn.current&&(hn.current.style.height="0px")},[]),St=P({maintainRelativeOrder:!!ye,proposedSections:Vn,existingSections:Xn,activeSideBySideSection:je,connectedSections:Ke,resetSideBySide:bt,setConnectedSections:qe,setConnectedLines:Je,cachedConnectedPositions:$e,svgContainerRef:Ue,isAnimatingRef:Ge,animationTimerRef:Qe,calculateLinesRef:on,sectionLeftRefs:tt,sectionRightRefs:it,subSectionLeftRefs:ct,subSectionRightRefs:ut}),Rt=St.expandedSections,Ct=St.expandedSubSections,It=St.setExpandedSubSections,Bt=St.toggleSection,wt=u(function(e,n,t,i,o,r,l){var c,u,d,a=m(null==n?void 0:n.id)||m(null==t?void 0:t.id)||"",s=(a?rn[a]:null)||(null==n?void 0:n.cognitiveData)||(null==t?void 0:t.cognitiveData)||{section_id:a,decisioning:[],gap:[],relevance_score:0},v=null!==(u=null===(c=dt.current[i])||void 0===c?void 0:c.current)&&void 0!==u?u:null;return{isLoading:null!==(d=null==pe?void 0:pe.isLoading)&&void 0!==d&&d,open:!0,sectionTitle:(null==n?void 0:n.displayTitle)?null==n?void 0:n.title:"no title",refSectionTitle:(null==t?void 0:t.displayTitle)?null==t?void 0:t.title:"no title",cognitiveData:s,anchorEl:e,sectionAnchorEl:v,badgeStyle:r||null,sectionIdx:i,docData:{documents:null==ce?void 0:ce.documents,input_index_map:null==ce?void 0:ce.input_index_map},deviationData:(null==n?void 0:n.evaluationResult)||(null==t?void 0:t.evaluationResult)||null,isOrphan:!!o}},[rn,ce]),Tt=u(function(e){Hn(),Tn(null),Cn(e)},[Hn]),Et=function(e,n,t,i,o,r){e.stopPropagation(),In.open&&In.sectionIdx===o?Hn():(An(),Fn.open?ti():Mn(),Bn(wt(e.currentTarget,n,i,o,t,r)))},Ft=u(function(){null!==In.sectionIdx&&In.anchorEl?Tt(e(e({},In),{open:!0})):Hn()},[In,Hn,Tt]),_t=u(function(){var e=In.sectionIdx,n=In.isOrphan;Hn(),Mn(),null!==e&&(n?Fe("No counterpart exists to connect to."):(nn.current&&bt(),Je([]),$e.current=[],qe(function(n){return n.has(e)?new Set:new Set([e])}),setTimeout(function(){on.current&&on.current()},50)))},[In.sectionIdx,In.isOrphan,Hn,Mn,bt]),Mt=r(null),kt=r(null),Dt=r(null),At=r(null),Ht=r(null),Lt=r(null),Pt=o([]),Nt=Pt[0],Ot=Pt[1];r(null);var jt=o(null),zt=jt[0],Wt=jt[1];c(function(){if(Nn){var e=Ln.fields.find(function(e){return e.analysisKey===Nn||e.key===Nn});if(e){var n=et.current[e.key]||nt.current[e.key];(null==n?void 0:n.current)&&setTimeout(function(){return n.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[Nn,Ln.fields]);var Yt=u(function(e){var n,t,i,o,r,l,c,u,d,a=null===(n=null==pt?void 0:pt.rule_difference_comparison)||void 0===n?void 0:n.fields;if(!a||!a[e])return{score:0,relation:"",highlightsA:[],highlightsB:[],hasContent:!1};var s=a[e],v=(null==s?void 0:s.relation)||(null===(i=null===(t=null==s?void 0:s.highlights)||void 0===t?void 0:t.ruleA_spans)||void 0===i?void 0:i.length)||(null===(r=null===(o=null==s?void 0:s.highlights)||void 0===o?void 0:o.ruleB_spans)||void 0===r?void 0:r.length)||(null==s?void 0:s.mappings)&&s.mappings.length>0;if(s.mappings){var p=s.mappings[0]||{};return{score:s.score,relation:p.relation||"",highlightsA:(null===(l=p.highlights)||void 0===l?void 0:l.ruleA_spans)||[],highlightsB:(null===(c=p.highlights)||void 0===c?void 0:c.ruleB_spans)||[],hasContent:!!v}}return{score:s.score,relation:s.relation||"",highlightsA:(null===(u=s.highlights)||void 0===u?void 0:u.ruleA_spans)||[],highlightsB:(null===(d=s.highlights)||void 0===d?void 0:d.ruleB_spans)||[],hasContent:!!v}},[pt]),Kt=u(function(n,t){var i,o,r,l,c,u,d;void 0===t&&(t="left");var a=null,s=null;if("left"===t)if(a=Vn[n],ye&&a){var v=Xn.filter(function(e){var n;return null===(n=a.refIndexes)||void 0===n?void 0:n.includes(e.selfIndex)});s=v.find(function(e){return e.evaluationResult})||v[0]}else s=Xn[n];else if(s=Xn[n],ye&&s){var p=Vn.filter(function(e){var n;return null===(n=e.refIndexes)||void 0===n?void 0:n.includes(s.selfIndex)});a=p.find(function(e){return e.evaluationResult})||p[0]}else a=Vn[n];var f=(null==a?void 0:a.relation)&&"not_defined"!==a.relation,g=(null==s?void 0:s.relation)&&"not_defined"!==s.relation,h=!(!(null==a?void 0:a.cognitiveData)&&!(null==s?void 0:s.cognitiveData));if(!f&&!g&&!h)return e(e({},b(E)),{label:"Not Defined"});var x=null!==(o=null!==(i=null==a?void 0:a.evaluationResult)&&void 0!==i?i:null==s?void 0:s.evaluationResult)&&void 0!==o?o:null,m=null===(r=null==x?void 0:x.evaluation_outputs)||void 0===r?void 0:r.output_value,y=null!==(u=null===(c=null===(l=null==x?void 0:x.evaluation_outputs)||void 0===l?void 0:l.metadata)||void 0===c?void 0:c.label_color)&&void 0!==u?u:E;return e(e({},b(y)),null!=x?{label:null!==(d=m)&&void 0!==d?d:""}:{label:null})},[Vn,Xn,rn,Ln,ye]),qt=u(function(n){for(var t,i,o,r,l,c,u,d,a,s=n.split("-").map(Number),v=Vn[s[0]],p=Xn[s[0]],f=1;f<s.length;f++)(null==v?void 0:v.subsections)&&(v=v.subsections[s[f]]),(null==p?void 0:p.subsections)&&(p=p.subsections[s[f]]);if(!v&&!p)return null;var g=(null==v?void 0:v.relation)&&"not_defined"!==v.relation,h=(null==p?void 0:p.relation)&&"not_defined"!==p.relation,x=m(null==v?void 0:v.id)||m(null==p?void 0:p.id)||"",y=!(!(null==v?void 0:v.cognitiveData)&&!(null==p?void 0:p.cognitiveData));if(!g&&!h&&!y)return e(e({},b(E)),{label:"Not Defined"});null!==(i=null!==(t=null==v?void 0:v.cognitiveRelevanceScore)&&void 0!==t?t:null==p?void 0:p.cognitiveRelevanceScore)&&void 0!==i||x&&(null===(o=rn[x])||void 0===o||o.relevance_score);var S=null!==(l=null!==(r=null==v?void 0:v.evaluationResult)&&void 0!==r?r:null==p?void 0:p.evaluationResult)&&void 0!==l?l:null,R=null===(c=null==S?void 0:S.evaluation_outputs)||void 0===c?void 0:c.output_value,C=null!==(a=null===(d=null===(u=null==S?void 0:S.evaluation_outputs)||void 0===u?void 0:u.metadata)||void 0===d?void 0:d.label_color)&&void 0!==a?a:E;return e(e({},b(C)),null!=S?{label:null!=R?R:""}:{label:null})},[Vn,Xn,rn,Ln]),Vt=u(function(){var e,n,t,i,o,r,l,c,u,d,a,s,v,p,f,g,h,x,m,y,b,I;if(!mn.current&&!Ge.current){mn.current=!0;try{if(!Mt.current)return;var B=function(e){var n=e.split("-"),t=n[0];if(!Rt[t]&&!1===ye)return!1;if(ye&&!Rt["left-".concat(t)]&&!Rt["right-".concat(t)]&&!Rt[t])return!1;for(var i=t,o=1;o<n.length-1;o++)if(i+="-".concat(n[o]),!Ct[i])return!1;return!0},w=Mt.current.getBoundingClientRect();un({width:w.width,height:w.height});var T=[];if(Jn.forEach(function(e){var n,t,i=e.key,o=null===(n=et.current[i])||void 0===n?void 0:n.current,r=null===(t=nt.current[i])||void 0===t?void 0:t.current;o&&r&&(o.style.height="auto",r.style.height="auto",o.style.minHeight="0px",r.style.minHeight="0px")}),!Ge.current){for(var E=0;E<Math.max(Vn.length,Xn.length);E++){var F=null===(e=tt.current[E])||void 0===e?void 0:e.current,_=null===(n=it.current[E])||void 0===n?void 0:n.current;F&&(F.style.height="auto",F.style.minHeight="0px"),_&&(_.style.height="auto",_.style.minHeight="0px")}ye||Object.keys(ct.current).forEach(function(e){var n,t;if(B(e)){var i=null===(n=ct.current[e])||void 0===n?void 0:n.current,o=null===(t=ut.current[e])||void 0===t?void 0:t.current;i&&o&&(i.style.height="auto",o.style.height="auto",i.style.minHeight="0px",o.style.minHeight="0px")}})}var M={};Jn.forEach(function(e){var n,t,i=e.key,o=null===(n=et.current[i])||void 0===n?void 0:n.current,r=null===(t=nt.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=o.getBoundingClientRect(),c=r.getBoundingClientRect();M[i]=Math.max(l.height,c.height)}});var k={left:{},right:{}},D={};if(!Ge.current)if(ye){if(Me&&null!==je)if("number"==typeof je){var A=je,H=Vn[A],L=null===(o=tt.current[A])||void 0===o?void 0:o.current;L&&H&&(H.refIndexes||[]).forEach(function(e){var n,t=Xn.findIndex(function(n){return n.selfIndex===e}),i=null===(n=it.current[t])||void 0===n?void 0:n.current;if(i&&(Rt["left-".concat(A)]||Rt["right-".concat(t)])){var o=Math.max(L.getBoundingClientRect().height,i.getBoundingClientRect().height);k.left[A]=Math.max(k.left[A]||0,o),k.right[t]=Math.max(k.right[t]||0,o)}})}else{var P=je.split(S)[2];if(P){F=null===(r=ct.current[P])||void 0===r?void 0:r.current,_=null===(l=ut.current[P])||void 0===l?void 0:l.current;if(F&&_){N=Math.max(F.getBoundingClientRect().height,_.getBoundingClientRect().height);D[P]=Math.max(D[P]||0,N)}}}}else{Object.keys(ct.current).forEach(function(e){var n,t;if(B(e)){var i=null===(n=ct.current[e])||void 0===n?void 0:n.current,o=null===(t=ut.current[e])||void 0===t?void 0:t.current;if(i&&o&&null!==i.offsetParent&&null!==o.offsetParent){var r=i.getBoundingClientRect(),l=o.getBoundingClientRect(),c=Math.max(r.height,l.height);D[e]=c,i.style.minHeight="".concat(c,"px"),o.style.minHeight="".concat(c,"px")}}});for(E=0;E<Math.min(Vn.length,Xn.length);E++){var F=null===(t=tt.current[E])||void 0===t?void 0:t.current,_=null===(i=it.current[E])||void 0===i?void 0:i.current;if(F&&_){var N=Math.max(F.getBoundingClientRect().height,_.getBoundingClientRect().height);k.left[E]=N,k.right[E]=N}}}if(Jn.forEach(function(e){var n,t,i=e.key,o=null===(n=et.current[i])||void 0===n?void 0:n.current,r=null===(t=nt.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=M[i];o.style.minHeight="".concat(l,"px"),r.style.minHeight="".concat(l,"px")}}),Ge.current||(Object.entries(k.left).forEach(function(e){var n,t=e[0],i=e[1],o=null===(n=tt.current[Number(t)])||void 0===n?void 0:n.current;o&&(o.style.minHeight="".concat(i,"px"))}),Object.entries(k.right).forEach(function(e){var n,t=e[0],i=e[1],o=null===(n=it.current[Number(t)])||void 0===n?void 0:n.current;o&&(o.style.minHeight="".concat(i,"px"))}),ye||Object.keys(D).forEach(function(e){var n,t,i=null===(n=ct.current[e])||void 0===n?void 0:n.current,o=null===(t=ut.current[e])||void 0===t?void 0:t.current;if(i&&o&&D[e]){var r=D[e];i.style.minHeight="".concat(r,"px"),o.style.minHeight="".concat(r,"px")}})),ye)Vn.forEach(function(e,n){var t;(null===(t=tt.current[n])||void 0===t?void 0:t.current)&&(e.refIndexes||[]).forEach(function(e){var t,i,o,r,l,c,u,d,a,s,v=Xn.findIndex(function(n){return n.selfIndex===e});if(-1!==v){var p=null===(t=ot.current[n])||void 0===t?void 0:t.current,f=null===(i=rt.current[v])||void 0===i?void 0:i.current;if(p&&f){var g=p.getBoundingClientRect(),h=f.getBoundingClientRect(),x=g.right-w.left,m=h.left-w.left,y=g.top+g.height/2-w.top,b=h.top+h.height/2-w.top;if(Me&&je===n){var S=null!==(r=null===(o=xn.current)||void 0===o?void 0:o.getBoundingClientRect().top)&&void 0!==r?r:0,R=null!==(c=null===(l=vn.current)||void 0===l?void 0:l.getBoundingClientRect().top)&&void 0!==c?c:0,C=S+(null!==(d=null===(u=xn.current)||void 0===u?void 0:u.clientHeight)&&void 0!==d?d:1/0),I=R+(null!==(s=null===(a=vn.current)||void 0===a?void 0:a.clientHeight)&&void 0!==s?s:1/0),B=g.top+g.height/2,E=h.top+h.height/2,F=function(e,n,t){return Math.max(n,Math.min(t,e))};y=F(B,S,C)-w.top,b=F(E,R,I)-w.top}var _=Kt(n);_&&T.push({id:"line-".concat(n,"-").concat(v),x1:x,y1:y,x2:m,y2:b,style:_,sectionIdx:n,targetRightIdx:v})}}})});else{for(E=0;E<Math.min(Vn.length,Xn.length);E++){var O=null===(c=tt.current[E])||void 0===c?void 0:c.current,j=null===(u=it.current[E])||void 0===u?void 0:u.current;if(O&&j){var z=O.getBoundingClientRect(),W=j.getBoundingClientRect(),Y=Math.max(z.top,W.top)+18-w.top,K=(null===(d=Xn[E])||void 0===d?void 0:d.id)||"sec-".concat(E);(Z=Kt(E))&&T.push({id:K,x1:z.right-w.left,y1:Y,x2:W.left-w.left,y2:Y,style:Z,sectionIdx:E,hasCognitive:!!((null===(a=Vn[E])||void 0===a?void 0:a.cognitiveData)||(null===(s=Xn[E])||void 0===s?void 0:s.cognitiveData)||K&&rn[K]),isSubSection:!1})}}Object.keys(ct.current).forEach(function(e){var n,t,i,o,r,l;if(B(e)){var c=null===(n=ct.current[e])||void 0===n?void 0:n.current,u=null===(t=ut.current[e])||void 0===t?void 0:t.current;if(c&&u){for(var d=e.split("-").map(Number),a=Vn[d[0]],s=Xn[d[0]],v=1;v<d.length;v++)(null==a?void 0:a.subsections)&&(a=a.subsections[d[v]]),(null==s?void 0:s.subsections)&&(s=s.subsections[d[v]]);var p=!!a&&((null===(i=a.displayTitle)||void 0===i||i)&&R(a.title)),f=!!a&&((null===(o=a.displayContent)||void 0===o||o)&&R(a.content)),g=!!s&&((null===(r=s.displayTitle)||void 0===r||r)&&R(s.title)),h=!!s&&((null===(l=s.displayContent)||void 0===l||l)&&R(s.content));if(p&&f||g&&h){var x=c.getBoundingClientRect(),m=u.getBoundingClientRect(),y=Math.max(x.top,m.top)+16-w.top,b=qt(e);b&&"Not Defined"!==b.label&&T.push({id:"subsec-".concat(e),x1:x.right-w.left,y1:y,x2:m.left-w.left,y2:y,style:b,sectionIdx:d[0],isSubSection:!0,subSectionKeyPath:e,hasCognitive:!(!(null==a?void 0:a.cognitiveData)&&!(null==s?void 0:s.cognitiveData))})}}}})}if(Me&&"string"==typeof je&&je.includes(S)){var q=je.split(S),V=q[0],X=q[1],J=q[2],U=(q[3],"".concat(V).concat(S).concat(X)),G=null===(v=ot.current[U])||void 0===v?void 0:v.current,Q=null===(p=rt.current[U])||void 0===p?void 0:p.current;if(G&&Q){var Z,$=G.getBoundingClientRect(),ee=Q.getBoundingClientRect(),ne=$.right-w.left,te=ee.left-w.left,ie=$.top+$.height/2-w.top,oe=ee.top+ee.height/2-w.top;if(ye){var re=null!==(g=null===(f=xn.current)||void 0===f?void 0:f.getBoundingClientRect().top)&&void 0!==g?g:0,le=null!==(x=null===(h=vn.current)||void 0===h?void 0:h.getBoundingClientRect().top)&&void 0!==x?x:0,ce=re+(null!==(y=null===(m=xn.current)||void 0===m?void 0:m.clientHeight)&&void 0!==y?y:1/0),ue=le+(null!==(I=null===(b=vn.current)||void 0===b?void 0:b.clientHeight)&&void 0!==I?I:1/0),de=function(e,n,t){return Math.max(n,Math.min(t,e))};ie=de($.top+$.height/2,re,ce)-w.top,oe=de(ee.top+ee.height/2,le,ue)-w.top}(Z=qt(J))&&T.push({id:"line-subsec-".concat(U),x1:ne,y1:ie,x2:te,y2:oe,style:Z,sectionIdx:Number(J.split("-")[0]),isSubSection:!0,subSectionKeyPath:je})}}if(Ot(T),Ht.current&&Lt.current){var ae=Ht.current.getBoundingClientRect(),se=Lt.current.getBoundingClientRect(),ve=(ae.top+ae.height/2-w.top+se.top+se.height/2-w.top)/2;Wt({x1:ae.right-w.left,x2:se.left-w.left,y:ve})}else Wt(null);if(Ke.size>0){var pe=[],fe=xn.current,ge=vn.current;if(fe&&ge){var he=[],xe=fe.getBoundingClientRect().top,me=ge.getBoundingClientRect().top,be=xe+fe.clientHeight,Se=me+ge.clientHeight,Re=fe.scrollTop,Ce=ge.scrollTop,Ie=w.top,Be=function(e,n,t){return Math.max(n,Math.min(t,e))};Ke.forEach(function(e){var n,t,i,o,r;if("string"==typeof e&&e.includes(S)){var l=e.split(S),c=l[0],u=l[1],d=l[2],a=(l[3],"".concat(c).concat(S).concat(u)),s=null===(n=ot.current[a])||void 0===n?void 0:n.current,v=null===(t=rt.current[a])||void 0===t?void 0:t.current;if(!s||!v)return;var p=s.getBoundingClientRect(),f=v.getBoundingClientRect(),g=qt(d),h=(H=p.right-w.left)+.5*((L=f.left-w.left-0)-H),x=p.top+p.height/2,m=f.top+f.height/2,y=x-xe+Re,b=m-me+Ce,R="conn-subsec-".concat(a);he.push({lhsScrollY:y,rhsScrollY:b,x1:H,x2:L,containerTop:Ie,leftIdx:e,rhsArrayIdx:e,styleColor:(null==g?void 0:g.badgeBorder)||"#6366F1",styleId:R});var I=Be(x,xe,be),B=Be(m,me,Se),T=I-Ie,E=B-Ie,F=m>=me-4&&m<=Se+4,_="";_=(P=x>=xe-4&&x<=be+4)&&F?C(H,T,L,E):P&&!F?"M ".concat(H,",").concat(T," L ").concat(h,",").concat(T," L ").concat(h,",").concat(E):!P&&F?"M ".concat(h,",").concat(T," L ").concat(h,",").concat(E," L ").concat(L,",").concat(E):"M ".concat(h,",").concat(T," L ").concat(h,",").concat(E),pe.push({id:R,pathD:_,style:g,leftIdx:e,rhsArrayIdx:e})}else if(ye){var M=e,k=Vn[M];if(!(null===(r=null==k?void 0:k.refIndexes)||void 0===r?void 0:r.length))return;k.refIndexes.forEach(function(e){var n,t,i=Xn.findIndex(function(n){return n.selfIndex===e});if(-1!==i){var o=null===(n=ot.current[M])||void 0===n?void 0:n.current,r=null===(t=rt.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=o.getBoundingClientRect(),c=r.getBoundingClientRect(),u=Kt(M),d=l.right-w.left,a=c.left-w.left-0,s=d+.5*(a-d),v=l.top+l.height/2,p=c.top+c.height/2,f=v-xe+Re,g=p-me+Ce,h="conn-".concat(M,"-").concat(i);he.push({lhsScrollY:f,rhsScrollY:g,x1:d,x2:a,containerTop:Ie,leftIdx:M,rhsArrayIdx:i,styleColor:(null==u?void 0:u.badgeBorder)||"#6366F1",styleId:h});var x=Be(v,xe,be),m=Be(p,me,Se),y=x-Ie,b=m-Ie,S=v>=xe-4&&v<=be+4,R=p>=me-4&&p<=Se+4,I="";I=S&&R?C(d,y,a,b):S&&!R?"M ".concat(d,",").concat(y," L ").concat(s,",").concat(y," L ").concat(s,",").concat(b):!S&&R?"M ".concat(s,",").concat(y," L ").concat(s,",").concat(b," L ").concat(a,",").concat(b):"M ".concat(s,",").concat(y," L ").concat(s,",").concat(b),pe.push({id:h,pathD:I,style:u,leftIdx:M,rhsArrayIdx:i})}}})}else{var D=e,A=D;s=null===(i=ot.current[D])||void 0===i?void 0:i.current,v=null===(o=rt.current[A])||void 0===o?void 0:o.current;if(!s||!v)return;var H,L;p=s.getBoundingClientRect(),f=v.getBoundingClientRect(),g=Kt(D),h=(H=p.right-w.left)+.5*((L=f.left-w.left-0)-H),x=p.top+p.height/2,m=f.top+f.height/2,y=x-xe+Re,b=m-me+Ce,R="conn-".concat(D,"-").concat(A);he.push({lhsScrollY:y,rhsScrollY:b,x1:H,x2:L,containerTop:Ie,leftIdx:D,rhsArrayIdx:A,styleColor:(null==g?void 0:g.badgeBorder)||"#6366F1",styleId:R});var P;I=Be(x,xe,be),B=Be(m,me,Se),T=I-Ie,E=B-Ie,F=m>=me-4&&m<=Se+4,_="";_=(P=x>=xe-4&&x<=be+4)&&F?C(H,T,L,E):P&&!F?"M ".concat(H,",").concat(T," L ").concat(h,",").concat(T," L ").concat(h,",").concat(E):!P&&F?"M ".concat(h,",").concat(T," L ").concat(h,",").concat(E," L ").concat(L,",").concat(E):"M ".concat(h,",").concat(T," L ").concat(h,",").concat(E),pe.push({id:R,pathD:_,style:g,leftIdx:D,rhsArrayIdx:A})}}),$e.current=he}Je(pe)}else Je([]),$e.current=[]}catch(e){console.error("Line render safe fail: ",e)}finally{mn.current=!1}}},[Jn,Vn,Xn,rn,Ln,Yt,Kt,ye,Me,je,Ke,Rt,Ct]),Xt=u(function(){var e,n,t,i,o,r,l,c,u,d,a,s,v,p,f=$e.current;if(f.length&&!Ge.current){var g=null!==(n=null===(e=xn.current)||void 0===e?void 0:e.scrollTop)&&void 0!==n?n:0,h=null!==(i=null===(t=vn.current)||void 0===t?void 0:t.scrollTop)&&void 0!==i?i:0,x=null!==(r=null===(o=xn.current)||void 0===o?void 0:o.clientHeight)&&void 0!==r?r:1/0,m=null!==(c=null===(l=vn.current)||void 0===l?void 0:l.clientHeight)&&void 0!==c?c:1/0,y=null!==(d=null===(u=xn.current)||void 0===u?void 0:u.getBoundingClientRect().top)&&void 0!==d?d:0,b=null!==(s=null===(a=vn.current)||void 0===a?void 0:a.getBoundingClientRect().top)&&void 0!==s?s:0,S=y+x,R=b+m,I=null!==(p=null===(v=Mt.current)||void 0===v?void 0:v.getBoundingClientRect().top)&&void 0!==p?p:0,B=function(e,n,t){return Math.max(n,Math.min(t,e))};f.forEach(function(e){var n=e.lhsScrollY-g+y,t=e.rhsScrollY-h+b,i=Ze.current[e.styleId+"-stroke"],o=Ze.current[e.styleId+"-bg"];if(i||o){var r,l=B(n,y,S),c=B(t,b,R),u=l-I,d=c-I,a=n>=y-4&&n<=S+4,s=t>=b-4&&t<=R+4,v=e.x1+.5*(e.x2-e.x1);r=a&&s?C(e.x1,u,e.x2,d):a&&!s?"M ".concat(e.x1,",").concat(u," L ").concat(v,",").concat(u," L ").concat(v,",").concat(d):!a&&s?"M ".concat(v,",").concat(u," L ").concat(v,",").concat(d," L ").concat(e.x2,",").concat(d):"M ".concat(v,",").concat(u," L ").concat(v,",").concat(d),i&&(i.setAttribute("visibility","visible"),i.setAttribute("d",r)),o&&(o.setAttribute("visibility","visible"),o.setAttribute("d",r))}})}},[]);c(function(){on.current=Vt},[Vt]);var Jt=r(null),Ut=r(null),Gt=u(function(){$e.current.length>0&&!Ge.current||(null!==Jt.current&&clearTimeout(Jt.current),Jt.current=setTimeout(function(){on.current(),Jt.current=null},50))},[]),Qt=u(function(){Ne(!0),He(!1),null!==Ut.current&&clearTimeout(Ut.current),null!==Jt.current&&(clearTimeout(Jt.current),Jt.current=null),Ut.current=setTimeout(function(){var e,n,t,i,o,r,l,c,u,d;if($e.current=[],nn.current&&null!==tn.current&&null!==Dt.current){var a=tn.current,s=Dt.current,v=null,p=null,f=null,g=null;if("string"==typeof a&&a.includes(S)){var h=a.split(S),x="".concat(h[0]).concat(S).concat(h[1]);v=(null===(e=ot.current[x])||void 0===e?void 0:e.current)||null,p=(null===(n=rt.current[x])||void 0===n?void 0:n.current)||null,f=(null===(t=ct.current[h[2]])||void 0===t?void 0:t.current)||(null===(i=tt.current[Number(h[2])])||void 0===i?void 0:i.current)||null,g=(null===(o=ut.current[h[3]])||void 0===o?void 0:o.current)||(null===(r=it.current[Number(h[3])])||void 0===r?void 0:r.current)||null}else v=(null===(l=dt.current[a])||void 0===l?void 0:l.current)||null,f=(null===(c=tt.current[a])||void 0===c?void 0:c.current)||null,p=(null===(u=lt.current[s])||void 0===u?void 0:u.current)||null,g=(null===(d=it.current[s])||void 0===d?void 0:d.current)||null;if(v&&p&&f&&g){if(f.style.paddingTop="0px",g.style.paddingTop="0px",!ye){var m=v.getBoundingClientRect(),y=p.getBoundingClientRect(),b=m.top-y.top;b>0?g.style.paddingTop="".concat(b,"px"):b<0&&(f.style.paddingTop="".concat(Math.abs(b),"px"))}var R=xn.current,C=vn.current;if(R&&C){var I=v.getBoundingClientRect().top-R.getBoundingClientRect().top+R.scrollTop,B=p.getBoundingClientRect().top-C.getBoundingClientRect().top+C.scrollTop-(I-R.scrollTop);Math.abs(C.scrollTop-B)>1&&(C.scrollTop=B)}}}on.current(),nn.current&&He(!0),Ne(!1),Ut.current=null},150)},[ye,Vn,Xn]),Zt=u(function(e){var n,t,i,o,r,l,c,u,d,a;if(null!==yn.current&&bn.current&&Math.abs(e.currentTarget.scrollTop-yn.current)<=2){var s=bn.current;yn.current=null,bn.current=null,s()}if(!We.current){if(ye||Gt(),nn.current){var v=tn.current,p=Dt.current,f=xn.current,g=vn.current;if(null!==v&&null!==p&&f&&g){var h="string"==typeof v&&v.includes(S)?null===(n=ot.current["".concat(v.split(S)[0]).concat(S).concat(v.split(S)[1])])||void 0===n?void 0:n.current:null===(t=dt.current[v])||void 0===t?void 0:t.current,x="string"==typeof p&&p.includes(S)?null===(i=rt.current["".concat(p.split(S)[0]).concat(S).concat(p.split(S)[1])])||void 0===i?void 0:i.current:null===(o=lt.current[p])||void 0===o?void 0:o.current;if(h&&x&&At.current){var m=void 0,y=void 0;if("string"==typeof v&&v.includes(S)){var b=v.split(S),R="".concat(b[0]).concat(S).concat(b[1]);m=null===(r=ot.current[R])||void 0===r?void 0:r.current,y=null===(l=rt.current[R])||void 0===l?void 0:l.current}else m=null===(c=ot.current[v])||void 0===c?void 0:c.current,y=null===(u=rt.current[p])||void 0===u?void 0:u.current;var C=null!==(a=null===(d=Mt.current)||void 0===d?void 0:d.getBoundingClientRect().top)&&void 0!==a?a:0,I=f.getBoundingClientRect().top,B=I+f.clientHeight;g.getBoundingClientRect().top;g.clientHeight;if(m&&y){var w=m.getBoundingClientRect(),T=y.getBoundingClientRect(),E=w.top+w.height/2;T.top,T.height;var F=((M=E,k=I,D=B,Math.max(k,Math.min(D,M)))-C).toString();At.current.setAttribute("y1",F),At.current.setAttribute("y2",F);var _=E>=I-4&&E<=B+4;At.current.setAttribute("visibility",_?"visible":"hidden")}}}}var M,k,D;$e.current.length>0&&!en.current&&(en.current=!0,requestAnimationFrame(function(){Xt(),en.current=!1}))}},[Xt,ye,Gt]);c(function(){var e=setTimeout(Gt,250);window.addEventListener("resize",Qt);var n=null,t=null;return an.current&&(n=new ResizeObserver(Gt)).observe(an.current),Mt.current&&(t=new ResizeObserver(Gt)).observe(Mt.current),function(){clearTimeout(e),null!==Jt.current&&clearTimeout(Jt.current),null!==Ut.current&&clearTimeout(Ut.current),window.removeEventListener("resize",Qt),null==n||n.disconnect(),null==t||t.disconnect()}},[Kn,qn,pt,Jn,Rt,Ct,Vn,Xn,Ln,Gt,Qt,Me,je,Ae,Ke]),c(function(){nn.current=Me},[Me]),c(function(){tn.current=je},[je]);var $t=u(function(e,n,t){var i,o,r=null===(i=null==t?void 0:t.toggleIfSame)||void 0===i||i,l=null==t?void 0:t.onReady,c=null!==(o=null==t?void 0:t.sourceSide)&&void 0!==o?o:"left";Hn(),null!=e&&(n?Fe("No counterpart exists for this section."):Me&&je===e?r?bt():null==l||l():(qe(new Set([e])),Je([]),$e.current=[],we(!0),We.current=!0,ze(e),tn.current=e,ke(!0),nn.current=!0,He(!1),pn.current&&(pn.current.style.height="0px"),fn.current&&(fn.current.style.height="0px"),gn.current&&(gn.current.style.height="0px"),hn.current&&(hn.current.style.height="0px"),requestAnimationFrame(function(){var n,t,i,o,r,u=null,d=null,a=null;if("string"==typeof e&&e.includes(S)){var s=e.split(S),v="".concat(s[0]).concat(S).concat(s[1]);u=(null===(n=ot.current[v])||void 0===n?void 0:n.current)||null,a=(d=(null===(t=rt.current[v])||void 0===t?void 0:t.current)||null)?e:null}else if(u=(null===(i=dt.current[e])||void 0===i?void 0:i.current)||null,ye){var p=Vn[e],f=(null==p?void 0:p.refIndexes)||[];if(f.length>0){var g=f[0],h=Xn.findIndex(function(e){return e.selfIndex===g});-1!==h&&(d=(null===(r=lt.current[h])||void 0===r?void 0:r.current)||null,a=h)}}else a=(d=(null===(o=lt.current[e])||void 0===o?void 0:o.current)||null)?e:null;Dt.current=a;var x=xn.current,m=vn.current,y=function(){"right"===c&&m?m.dispatchEvent(new Event("scroll")):x&&x.dispatchEvent(new Event("scroll"))};if(!u||!x)return We.current=!1,we(!1),void(null==l||l());if(!d||!m)return He(!0),on.current(),We.current=!1,we(!1),void(null==l||l());if(!ye){var b=0;b="right"===c?d?d.getBoundingClientRect().top:0:u?u.getBoundingClientRect().top:0;var R=an.current,C=(null==R?void 0:R.getBoundingClientRect().top)||0,B=R?R.scrollTop+b-C-150:0;return R?void I(R,B,200,function(){He(!0),on.current(),We.current=!1,y(),we(!1),null==l||l()}):(He(!0),on.current(),We.current=!1,we(!1),void(null==l||l()))}var w=u.getBoundingClientRect().top-x.getBoundingClientRect().top+x.scrollTop,T=d.getBoundingClientRect().top-m.getBoundingClientRect().top+m.scrollTop,E=200;if("left"===c){var F=T-(w-x.scrollTop);F<0&&pn.current&&(pn.current.style.height="".concat(Math.abs(F),"px")),requestAnimationFrame(function(){var e,n=m.scrollHeight-m.clientHeight;if(F<0)e=0;else{if(F>n){var t=F-n;return fn.current&&(fn.current.style.height="".concat(t+150,"px")),void requestAnimationFrame(function(){I(m,F,E,function(){He(!0),on.current(),We.current=!1,y(),we(!1),null==l||l()})})}e=F}I(m,e,E,function(){He(!0),on.current(),We.current=!1,y(),we(!1),null==l||l()})})}else{var _=w-(T-m.scrollTop);_<0&&gn.current&&(gn.current.style.height="".concat(Math.abs(_),"px")),requestAnimationFrame(function(){var e,n=x.scrollHeight-x.clientHeight;if(_<0)e=0;else{if(_>n){var t=_-n;return hn.current&&(hn.current.style.height="".concat(t+150,"px")),void requestAnimationFrame(function(){I(x,_,E,function(){He(!0),on.current(),We.current=!1,y(),we(!1),null==l||l()})})}e=_}I(x,e,E,function(){He(!0),on.current(),We.current=!1,y(),we(!1),null==l||l()})})}})))},[je,Hn,Xn,Me,ye,Vn,bt]),ei=u(function(e,n,t,i){var o,r="string"==typeof i?m(i).trim():m(null==i?void 0:i.deviation_summary).trim(),l=e.currentTarget;An();var c="left";(null===(o=vn.current)||void 0===o?void 0:o.contains(l))&&(c="right");var u=function(){var e,t,i,o;if("string"==typeof n&&n.includes(S)){var r=n.split(S),l="".concat(r[0]).concat(S).concat(r[1]);return"right"===c?null===(e=rt.current[l])||void 0===e?void 0:e.current:null===(t=ot.current[l])||void 0===t?void 0:t.current}return"right"===c?null===(i=rt.current[n])||void 0===i?void 0:i.current:null===(o=ot.current[n])||void 0===o?void 0:o.current};if(t)return bt(),qe(new Set),Je([]),$e.current=[],void(r&&requestAnimationFrame(function(){var e=u()||l;_n({open:!0,anchorEl:e,summary:i})}));$t(n,t,r?{toggleIfSame:!1,sourceSide:c,onReady:function(){var e=u()||l;_n({open:!0,anchorEl:e,summary:i})}}:{toggleIfSame:!1,sourceSide:c})},[$t,An,_n,bt]),ni=u(function(){var e,n=In.sectionIdx,t=In.isOrphan;if(Mn(),null!=n){var i="left";In.anchorEl&&(null===(e=vn.current)||void 0===e?void 0:e.contains(In.anchorEl))&&(i="right"),$t(n,t,{sourceSide:i})}},[$t,In.isOrphan,In.sectionIdx,In.anchorEl,Mn]),ti=u(function(){Mn(),bt(),qe(new Set),Je([]),$e.current=[]},[Mn,bt]),ii=null!==In.sectionIdx&&Ke.has(In.sectionIdx),oi=N({proposedSections:Vn,existingSections:Xn,parentDeviationRecord:Un,expandedSections:Rt,maintainRelativeOrder:!!ye,scrollContainerRef:an,leftContainerRef:xn,lhsBadgeRefs:ot,rhsBadgeRefs:rt}),ri=oi.showDeviationNavigation,li=oi.showOpenNodeRef,ci=l(function(){if(!xe)return null;for(var e in Un){if((Un[e]||[]).some(function(e){return e.id===xe}))return e}return null},[xe,Un]),ui=r(null);c(function(){if(xe&&ui.current!==xe){var e=!1,t=0,i=null,o=150,r=function(e,n){for(var t=function(e,i){if(!e)return null;if(e.id===n)return i;if(!Array.isArray(e.subsections))return null;for(var o=0;o<e.subsections.length;o++){var r=t(e.subsections[o],"".concat(i,"-").concat(o));if(r)return r}return null},i=0;i<e.length;i++){var o=t(e[i],String(i));if(o)return o}return null},l=function(){var c,u,d,a;if(!e){var s=null,v=null;for(var p in Un){var f=Un[p].find(function(e){return e.id===xe});if(f){s=p,v=f;break}}if(v&&s){var g=Vn.findIndex(function(e){return e.id===s});if(!(ye?!!Rt["left-".concat(g)]:!!Rt[String(g)])&&g>=0)return Bt(g,"left"),t+=1,void(i=setTimeout(l,450));var h=r(Vn,v.id),x=r(Xn,v.id);if(h&&!x){var m=h.split("-"),y=Number(m[0]);if(ye){var b=null===(u=null===(c=Vn[y])||void 0===c?void 0:c.refIndexes)||void 0===u?void 0:u[0],R=Xn.findIndex(function(e){return e.selfIndex===b});-1!==R&&(y=R)}x=n([y],m.slice(1),!0).join("-")}if(h&&x){var C="".concat(v.id).concat(S,"0").concat(S).concat(h).concat(S).concat(x),I="".concat(v.id).concat(S,"0"),B=null===(d=ot.current[I])||void 0===d?void 0:d.current,w=null===(a=rt.current[I])||void 0===a?void 0:a.current,T=ye?xn.current:an.current;if(B&&T){var E=B.getBoundingClientRect();if(0===E.height)return void((t+=1)<20&&(i=setTimeout(l,o)));var F=T.getBoundingClientRect(),_=E.top-F.top+T.scrollTop-F.height/2+E.height/2,M=function(){var n,t,i;if(!e){ui.current=xe;var o=window.getComputedStyle(B).color;B.style.transition="box-shadow 300ms ease-in-out",B.style.boxShadow="0 0 10px ".concat(o),w&&(w.style.transition="box-shadow 300ms ease-in-out",w.style.boxShadow="0 0 10px ".concat(o)),setTimeout(function(){B&&(B.style.boxShadow=""),w&&(w.style.boxShadow="")},2e3);var r=(null===(t=null===(n=v.evaluationResult)||void 0===n?void 0:n.deviations)||void 0===t?void 0:t[0])||v,l=(null===(i=v.evaluationResult)||void 0===i?void 0:i.evaluation_outputs)||v.evaluation_outputs;$t(C,!1,{toggleIfSame:!1,sourceSide:"left",onReady:function(){var e,n=(null===(e=ot.current[I])||void 0===e?void 0:e.current)||B;_n({open:!0,anchorEl:n,summary:{deviation_summary:r.deviation_summary||r,evaluation_outputs:l}})}})}};Math.abs(T.scrollTop-_)<=2?M():(yn.current=_,bn.current=M,T.scrollTo({top:_,behavior:"smooth"}),i&&clearTimeout(i),i=setTimeout(function(){if(bn.current){yn.current=null;var e=bn.current;bn.current=null,e()}},800))}else(t+=1)<20&&(i=setTimeout(l,o))}else(t+=1)<20&&(i=setTimeout(l,o))}else(t+=1)<20&&(i=setTimeout(l,o))}};return i=setTimeout(l,o),function(){e=!0,i&&clearTimeout(i)}}},[xe,Un,Vn,Xn,ye,Rt,Bt,$t,_n]);var di=function(e){var n=e.section,t=e.keyPath,o=e.depth,r=void 0===o?0:o,l=e.columnKey,c=void 0===l?"left":l,u=e.parentNodeId;return i(z,{section:n,keyPath:t,depth:r,columnKey:c,parentNodeId:void 0===u?"":u,expandedSubSections:Ct,setExpandedSubSections:It,maintainRelativeOrder:ye||!1,proposedSections:Vn,existingSections:Xn,treeData:ce,deviationNumberRegistry:Gn,connectedSections:Ke,activeSideBySideSection:je,resolvedMarkdownStyles:dn,getSubSectionRef:st,getSubSectionCompareStyle:qt,getBadgeRef:vt,openMoreFunctionsPopup:Et,openSummaryPopup:ei,resetSideBySide:bt,setConnectedSections:qe,setConnectedLines:Je,cachedConnectedPositions:$e})};return t(d,e({ref:sn,sx:e(e({display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif'},ye?{}:{overflow:"visible"}),{position:"relative"})},{children:[Re&&i(d,e({sx:{position:"absolute",inset:0,bgcolor:"rgba(255, 255, 255, 0.6)",backdropFilter:"blur(10px)",zIndex:9999,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"8px"}},{children:i(k,{})})),Fn.open&&i(W,{open:Fn.open,anchorEl:Fn.anchorEl,containerEl:kt.current,clipTopEl:Ht.current,scrollContainerEl:an.current,onClose:ti,summary:Fn.summary}),i(M,{open:In.open,anchorEl:In.anchorEl,sectionTitle:In.sectionTitle,referenceSectionTitle:In.refSectionTitle,onClose:Hn,onOpenCognitiveCompare:Ft,onOpenSideBySide:ni,onConnect:_t,isConnected:ii,isOrphan:In.isOrphan}),Rn.open&&i(_,{open:Rn.open,popupRef:Dn,position:wn,popupConfig:fe,onClose:function(){Tn(null),Cn(function(n){return e(e({},n),{open:!1})}),kn(null)},markdownStyles:se,sectionTitle:Rn.sectionTitle,referenceSectionTitle:Rn.refSectionTitle,cognitiveData:Rn.cognitiveData,anchorEl:Rn.anchorEl,sectionAnchorEl:Rn.sectionAnchorEl,scrollContainerEl:an.current,badgeStyle:Rn.badgeStyle,docData:Rn.docData,deviationData:Rn.deviationData,isLoading:Rn.isLoading}),i(a,e({open:!!Ee,autoHideDuration:8e3,onClose:function(){return Fe(null)},anchorOrigin:{vertical:"top",horizontal:"center"}},{children:i(s,e({onClose:function(){return Fe(null)},severity:"error",sx:{width:"100%",whiteSpace:"pre-line"}},{children:Ee}))})),i(O,{componentHeaderText:le,displayConfig:pe,maintainRelativeOrder:ye,onToggleView:function(e){Ce(!0),setTimeout(function(){be(!e),bt(),Mn(),qe(new Set),Je([]),$e.current=[],setTimeout(function(){Ce(!1)},400)},50)}}),i(d,e({ref:an,onScroll:Zt,sx:{flex:1,minHeight:0,pt:1.5,pb:1,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",overflowY:ye?"hidden":"auto",borderTop:ft&&gt?"none":"1.5px solid #EEF0F4"}},{children:i(d,e({sx:e({display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"},ye?{flex:1,minHeight:0}:{})},{children:t(d,e({ref:Mt,sx:e({display:"grid",gridTemplateColumns:"minmax(0, 1fr) 180px minmax(0, 1fr)",gap:"40px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0},ye?{flex:1,overflow:"visible"}:{})},{children:[t("svg",e({ref:Ue,style:{position:"absolute",top:0,left:0,width:cn.width||"100%",height:cn.height||"100%",pointerEvents:"none",zIndex:10,overflow:"visible",opacity:Pe?0:1,transition:"opacity 0.15s ease-in-out"}},{children:[zt&&i("g",{children:i("line",{x1:zt.x1,y1:zt.y,x2:zt.x2,y2:zt.y,stroke:yt.badgeBorder,strokeWidth:"1.5"})}),Nt.map(function(n){var o,r,l,c,u,a,s=n.x1+.5*(n.x2-n.x1),v=(n.y1+n.y2)/2;if("Not Defined"===n.style.label&&!n.hasCognitive)return null;if(n.isSubSection?Me&&je===n.subSectionKeyPath&&Ae:Me&&je===n.sectionIdx&&Ae)return null;if(!ye){var p=n.isSubSection?C(n.x1,n.y1,n.x2,n.y2):"M ".concat(n.x1," ").concat(n.y1," L ").concat(n.x2," ").concat(n.y2),g=Vn[n.sectionIdx]||{title:"",content:""},x=Xn[n.sectionIdx]||{title:"",content:""};if(console.log("Base and Ref Sections for Badge:",g,x),n.isSubSection&&n.subSectionKeyPath){var m=n.subSectionKeyPath.includes(S)?n.subSectionKeyPath.split(S):[],y=m[2]||n.subSectionKeyPath,b=m[3]||y,R=y.split("-").map(Number),I=b.split("-").map(Number),B=null,w=null;R.length>0&&(B=Vn[R[0]]),I.length>0&&(w=Xn[I[0]]);var T=(null==B?void 0:B.title)||"",F=(null==w?void 0:w.title)||"";console.log("Root Parent Titles:",T,F);for(var _=1;_<R.length;_++)(null==B?void 0:B.subsections)&&(B=B.subsections[R[_]]);for(_=1;_<I.length;_++)(null==w?void 0:w.subsections)&&(w=w.subsections[I[_]]);B&&(g=e(e({},B),{title:T||B.title})),console.log("Base Section for Subsection Badge:",g),w&&(x=e(e({},w),{title:F||w.title})),console.log("Ref Section for Subsection Badge:",x)}var M=!(null===(o=g.cognitiveData)||void 0===o?void 0:o.isMissingRationale)||Boolean(null===(l=null===(r=g.cognitiveData)||void 0===r?void 0:r.decisioning)||void 0===l?void 0:l.length),k=(null===(a=null===(u=null===(c=g.evaluationResult)||void 0===c?void 0:c.cognitive_decisioning)||void 0===u?void 0:u.decisioning_factors)||void 0===a?void 0:a.length)||!1,A=M||k;return t("g",{children:[i("path",{d:p,fill:"none",stroke:n.style.badgeBorder||"#E2E8F0",strokeWidth:"1.5"}),i("foreignObject",e({x:s-100,y:v-14,width:"200",height:"28",style:{pointerEvents:"auto",overflow:"visible"}},{children:i(d,e({sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},{children:t(d,e({onClick:function(e){e.stopPropagation(),A&&(Rn.open&&En===n.id?An():(kn(n.id),Tt(wt(e.currentTarget,g,x,n.sectionIdx,n.style))))},sx:{display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",bgcolor:n.style.badgeBg,color:n.style.badgeText,border:"1px solid ".concat(n.style.badgeBorder),borderRadius:"12px",px:1.5,py:.5,fontWeight:600,textAlign:"center",whiteSpace:"nowrap",cursor:A?"pointer":"default"}},{children:[n.style.badgeText===E&&null==n.style.label?i(D,{color:n.style.badgeText}):0===n.style.label?"Same":n.style.label,i(d,e({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:i(h,{})})),A&&i(f,{size:11,style:{transform:Rn.open&&En===n.id?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))}))]},n.id)}return null}),Xe.map(function(n){var o,r=n.pathD,l=(null===(o=n.style)||void 0===o?void 0:o.badgeBorder)||"#6366F1",c="conn-marker-".concat(n.id),u="".concat(n.id,"-bg"),d="".concat(n.id,"-stroke");return t("g",{children:[i("defs",{children:i("clipPath",e({id:"connections-clip"},{children:i("marker",e({id:c,markerWidth:"8",markerHeight:"6",refX:"7",refY:"3",orient:"auto"},{children:i("polygon",{points:"0 0, 8 3, 0 6",fill:l})}))}))}),i("path",{ref:function(e){Ze.current[u]=e},d:r,fill:"none",stroke:"#FFFFFF",strokeWidth:"4",strokeOpacity:"0.7"}),i("path",{ref:function(e){Ze.current[d]=e},d:r,fill:"none",stroke:l,strokeWidth:"1.75",markerEnd:"url(#".concat(c,")")})]},n.id)})]})),t(d,e({sx:e({border:"1px solid #E7E7E9",borderRadius:"8px",bgcolor:"#FFFFFF",display:"flex",flexDirection:"column",position:"relative",zIndex:2,filter:"drop-shadow(0px 2px 4px #F2F2F2)"},ye?{flex:1,overflow:"visible"}:{})},{children:[i(d,e({ref:Ht,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E7E7E9",borderRadius:"8px 8px 0 0",display:"flex",alignItems:"center",minHeight:"40px",overflow:"hidden",minWidth:0}},{children:i(v,e({title:zn,placement:"top"},{children:i(p,e({sx:{fontSize:"16px",fontWeight:500,color:"#19213D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0,textAlign:"center",display:"block"}},{children:zn}))}))})),t(d,e({ref:xn,onScroll:Zt,sx:e({p:"12px",display:"flex",flexDirection:"column"},ye?{maxHeight:"calc(100vh - 150px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,mr:"-160px",pr:"172px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[i("div",{ref:gn,style:{width:"100%",height:"0px",flexShrink:0}}),Zn&&Vn.map(function(n,o){var r,l,c=!n.title&&!n.content;if(ye&&c)return null;var u=n,a=Kt(o,"left"),s=ye?!(null===(r=u.refIndexes)||void 0===r?void 0:r.length)||u.selfIndex<0:!Xn[o],v=ye?"number"==typeof u.selfIndex&&u.selfIndex>=0?u.selfIndex+1:null:o+1,p=Ke.has(o),f=y(u.evaluationResult,null==a?void 0:a.deviationLabel);return i(d,e({ref:at(o),sx:{mb:1,width:"100%"}},{children:t(d,e({sx:{position:"relative",width:"100%"}},{children:[i(d,e({ref:tt.current[o],sx:e({width:"100%",display:"flex"},p&&{borderRadius:"6px",outline:"2px solid ".concat((null==a?void 0:a.badgeBorder)||"#6366F1"),outlineOffset:"1px"})},{children:i(j,{section:n,idx:o,columnKey:"left",colRef:at("left-accordion-".concat(o)),mb:0,treeData:ce,proposedSections:Vn,existingSections:Xn,deviationNumberRegistry:Gn,getSectionCompareStyle:Kt,getBadgeRef:vt,connectedSections:Ke,openMoreFunctionsPopup:Et,openSummaryPopup:ei,deviationNodeIdToView:xe,deviationTargetParentId:ci,parentNodeId:(null===(l=null==ce?void 0:ce.input_index_map)||void 0===l?void 0:l[0])||"",isExpanded:ye?!!Rt["left-".concat(o)]:!!Rt[String(o)],onToggle:function(){ti(),Bt(o,"left")},navigation:n.id?ri[n.id]:null,showOpenNodeRef:li,resolvedMarkdownStyles:dn,maintainRelativeOrder:ye,renderSubSections:di})})),ye&&a&&t(d,e({ref:ot.current[o],onClick:function(e){var t=ye?Xn.find(function(e){var n;return null===(n=u.refIndexes)||void 0===n?void 0:n.includes(e.selfIndex)})||{title:"",content:""}:Xn[o]||{title:"",content:""};Et(e,n,s,t,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!==v&&i(d,e({component:"span",sx:{fontSize:"11px",fontWeight:700,pr:.5,borderRight:"1px solid ".concat(a.badgeBorder)}},{children:v})),i(d,e({component:"span",sx:{fontSize:"11px",px:.25}},{children:!pe.isLoading||null!=u.evaluationResult&&null!=u.evaluationResult?s?"No Deviation Found":"N/A"===f||"NA"===f?"N/A":0==f||null==f?"Same":"".concat(f):i(D,{color:a.badgeText})})),i(g,{size:11,color:a.badgeText})]}))]}))}),"left-row-".concat(o))}),i("div",{ref:hn,style:{width:"100%",height:"0px",flexShrink:0}})]}))]})),i(d,e({ref:kt,sx:{width:"180px",display:"flex",flexDirection:"column",alignItems:"center",pt:"15px",gap:0,zIndex:20,pointerEvents:"none"}},{children:i(d,e({sx:{display:"flex",justifyContent:"center",alignItems:"center",mt:0}},{children:t(d,e({onClick:function(n){n.stopPropagation(),Rn.open&&En===ht?An():(kn(ht),Tt(wt(n.currentTarget,{title:"",content:"",evaluationResult:xt,cognitiveData:{section_id:"",decisioning:[],gap:[],relevance_score:0,isMissingRationale:!0}},null,ht,!0,e(e({},yt),{label:""}))))},sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:"5px",top:"-5px",borderRadius:"20px",bgcolor:yt.badgeBg,color:yt.badgeText,border:"1px solid ".concat(yt.badgeBorder),fontSize:"12px",fontWeight:600,whiteSpace:"nowrap",position:"relative",zIndex:1,pointerEvents:"auto",cursor:"pointer"}},{children:[null!=mt?mt:i(D,{}),i(d,e({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:i(h,{})})),i(f,{size:11,style:{transform:Rn.open&&En===ht?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))})),t(d,e({sx:e({border:"1px solid #E3E6EA",borderRadius:"8px",bgcolor:"#FFFFFF",boxShadow:"0px 1px 4px #F7F4FE",position:"relative",zIndex:2,display:"flex",flexDirection:"column",minWidth:0},ye?{flex:1,overflow:"visible",minHeight:0}:{})},{children:[Be&&i(x,{sections:11}),i(d,e({ref:Lt,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E3E6EA",borderRadius:"8px 8px 0 0",minHeight:"40px",display:"flex",alignItems:"center",overflowX:"hidden"}},{children:i(v,e({title:Wn,placement:"top"},{children:i(p,e({sx:{fontSize:"16px",fontWeight:500,color:"#5928ED",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0,textAlign:"center",display:"block"}},{children:Wn}))}))})),t(d,e({ref:vn,onScroll:Zt,sx:e({p:"12px",display:"flex",flexDirection:"column"},ye?{maxHeight:"calc(100vh - 150px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,ml:"-120px",pl:"140px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[i("div",{ref:pn,style:{width:"100%",height:"0px",flexShrink:0}}),Zn&&Xn.map(function(n,o){var r,l=n,c=[],u=!1,a=null,s=-1;if(ye){c=Vn.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}),s=Vn.findIndex(function(e){var n;return(null===(n=e.refIndexes)||void 0===n?void 0:n.includes(l.selfIndex))&&e.selfIndex>=0});var v=Vn.findIndex(function(e,n){var t;return Ke.has(n)&&(null===(t=e.refIndexes)||void 0===t?void 0:t.includes(l.selfIndex))});(u=-1!==v)&&(a=Kt(v))}else c=[o+1],(u=Ke.has(o))&&(a=Kt(o));var p=Kt(ye&&-1!==s?s:o);return i(d,e({ref:lt.current[o],sx:{mb:1,width:"100%"}},{children:t(d,e({sx:{position:"relative",width:"100%"}},{children:[i(d,e({ref:it.current[o],sx:e({width:"100%",display:"flex"},u&&a&&{borderRadius:"6px",outline:"2px solid ".concat(a.badgeBorder),outlineOffset:"1px"})},{children:i(j,{section:n,idx:o,columnKey:"right",colRef:at("right-accordion-".concat(o)),mb:0,parentNodeId:(null===(r=null==ce?void 0:ce.input_index_map)||void 0===r?void 0:r[1])||"",isExpanded:ye?!!Rt["right-".concat(o)]:!!Rt[String(o)],treeData:ce,proposedSections:Vn,existingSections:Xn,deviationNumberRegistry:Gn,getBadgeRef:vt,getSectionCompareStyle:Kt,connectedSections:Ke,openMoreFunctionsPopup:Et,openSummaryPopup:ei,deviationNodeIdToView:xe,deviationTargetParentId:ci,onToggle:function(){ti(),Bt(o,"right")},navigation:n.id?ri[n.id]:null,showOpenNodeRef:li,resolvedMarkdownStyles:dn,maintainRelativeOrder:ye,renderSubSections:di})})),ye&&p&&i(d,e({ref:rt.current[o],"data-section-id":l.id,sx:{position:"absolute",top:"18px",left:0,transform:"translateY(-50%) translateX(calc(-100% - 8px))",display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:"11px",bgcolor:p.badgeBg,color:p.badgeText,border:"1px solid ".concat(p.badgeBorder),borderRadius:"10px",px:1,py:.3,fontWeight:700,whiteSpace:"nowrap",zIndex:20}},{children:c.length>0?c.join(", "):"-"}))]}))}),"right-row-".concat(o))}),i("div",{ref:fn,style:{width:"100%",height:"0px",flexShrink:0}})]}))]}))]}))}))}))]}))};export{Y as default};
2
2
  //# sourceMappingURL=CognitiveCompare.js.map
@@ -1,2 +1,2 @@
1
- import{__assign as t}from"tslib";import{jsx as e,jsxs as n}from"react/jsx-runtime";import{Popper as o,Paper as i,Box as l,Typography as r,IconButton as a}from"@mui/material";import{Info as d,X as c}from"lucide-react";import{useRef as u,useState as s,useEffect as m}from"react";function p(p){var f,g,h,v=p.open,x=p.anchorEl,b=p.containerEl,w=p.clipTopEl,y=p.onClose,C=p.summary;p.markdownStyles,p.isLoading;var B=u(null),R=s(null),z=R[0],E=R[1],S=s(null),L=S[0],W=S[1],_="string"==typeof C?{deviation_summary:C}:null!=C?C:{};_.deviation_title;var F=_.deviation_summary,k=_.evaluation_outputs,A=(null===(f=null==k?void 0:k.metadata)||void 0===f?void 0:f.label_color)||"#6366F1",I=null!==(g=null==b?void 0:b.getBoundingClientRect().width)&&void 0!==g?g:180,T=Math.max(148,I+70),j=x&&b?{top:x.getBoundingClientRect().top,bottom:x.getBoundingClientRect().bottom,left:b.getBoundingClientRect().left+b.getBoundingClientRect().width/2}:null;m(function(){if(!v||!x||!b)return E(null),void W(null);var t=function(){null!==B.current&&cancelAnimationFrame(B.current),B.current=requestAnimationFrame(function(){var t,e=x.getBoundingClientRect(),n=b.getBoundingClientRect(),o=null==w?void 0:w.getBoundingClientRect();E({top:e.top,bottom:e.bottom,left:n.left+n.width/2}),W(null!==(t=null==o?void 0:o.bottom)&&void 0!==t?t:null)})};t();var e=!0;return window.addEventListener("scroll",t,{passive:!0,capture:e}),window.addEventListener("resize",t),function(){null!==B.current&&cancelAnimationFrame(B.current),window.removeEventListener("scroll",t,e),window.removeEventListener("resize",t)}},[v,x,b,w]);var H=null!==(h=null!=z?z:j)&&void 0!==h?h:{top:0,bottom:0,left:0},M=H.bottom+20,N=null!=L?Math.max(0,L-M):0;return C?e(o,t({open:v,disablePortal:!0,popperOptions:{strategy:"fixed"},anchorEl:{getBoundingClientRect:function(){return{width:0,height:0,top:H.top,bottom:H.top,left:H.left,right:H.left,x:H.left,y:H.top,toJSON:function(){}}}},placement:"bottom",modifiers:[{name:"offset",options:{offset:[0,20]}}],sx:{zIndex:20}},{children:n(i,t({sx:t(t({p:1.5,borderRadius:"12px",width:T,maxWidth:T},N>0&&{clipPath:"inset(".concat(N,"px 0 0 0 round 12px)")}),{transition:"transform 80ms linear",willChange:"transform",backfaceVisibility:"hidden",transform:"translateZ(0)",boxShadow:"0px 10px 24px rgba(15, 23, 42, 0.18)",border:"1px solid ".concat(A,"26"),borderTop:"3px solid ".concat(A),overflow:"hidden",bgcolor:"#fff"})},{children:[n(l,t({sx:{display:"flex",alignItems:"center",justifyContent:"space-between",mb:.75}},{children:[n(l,t({sx:{display:"flex",alignItems:"center",gap:.75,minWidth:0}},{children:[e(d,{size:14,color:A}),e(r,t({sx:{fontSize:"11px",fontWeight:700,color:A,textTransform:"uppercase",letterSpacing:"0.4px",lineHeight:1.2}},{children:"Summary"}))]})),e(a,t({size:"small",onClick:y,sx:{p:.25,ml:.5,color:"#64748B"}},{children:e(c,{size:14})}))]})),e(r,t({sx:{fontSize:"12px",color:"#475569",lineHeight:1.5,fontWeight:400,overflowWrap:"anywhere"}},{children:F||"No summary available."}))]}))})):null}export{p as default};
1
+ import{__assign as t}from"tslib";import{jsx as e,jsxs as n}from"react/jsx-runtime";import{Popper as o,Paper as l,Box as i,Typography as r,IconButton as a}from"@mui/material";import{Info as u,X as c}from"lucide-react";import{useRef as d,useState as m,useEffect as s}from"react";function p(p){var f,g,v,h=p.open,x=p.anchorEl,b=p.containerEl,w=p.clipTopEl,C=p.scrollContainerEl,y=p.onClose,B=p.summary;p.markdownStyles,p.isLoading;var R=d(null),E=d(null),z=m(null),S=z[0],L=z[1],W=m(null),_=W[0],F=W[1],k=m(null),A=k[0],H=k[1],I=m(0),M=I[0],T=I[1],j="string"==typeof B?{deviation_summary:B}:null!=B?B:{};j.deviation_title;var N=j.deviation_summary,O=j.evaluation_outputs,P=(null===(f=null==O?void 0:O.metadata)||void 0===f?void 0:f.label_color)||"#6366F1",q=null!==(g=null==b?void 0:b.getBoundingClientRect().width)&&void 0!==g?g:180,J=Math.max(148,q+70),V=x&&b?{top:x.getBoundingClientRect().top,bottom:x.getBoundingClientRect().bottom,left:b.getBoundingClientRect().left+b.getBoundingClientRect().width/2}:null;s(function(){if(!h||!x||!b)return L(null),F(null),void H(null);var t=function(){null!==R.current&&cancelAnimationFrame(R.current),R.current=requestAnimationFrame(function(){var t,e,n=x.getBoundingClientRect(),o=b.getBoundingClientRect(),l=null==w?void 0:w.getBoundingClientRect(),i=null==C?void 0:C.getBoundingClientRect();L({top:n.top,bottom:n.bottom,left:o.left+o.width/2}),F(null!==(t=null==l?void 0:l.bottom)&&void 0!==t?t:null),H(null!==(e=null==i?void 0:i.bottom)&&void 0!==e?e:null),E.current&&T(E.current.offsetHeight)})};t();var e=!0;return window.addEventListener("scroll",t,{passive:!0,capture:e}),window.addEventListener("resize",t),function(){null!==R.current&&cancelAnimationFrame(R.current),window.removeEventListener("scroll",t,e),window.removeEventListener("resize",t)}},[h,x,b,w,C]);var Z=null!==(v=null!=S?S:V)&&void 0!==v?v:{top:0,bottom:0,left:0},D=Z.bottom+20,G=D+M,K=null!=_?Math.max(0,_-D):0,Q=null!=A?Math.max(0,G-A):0;return B?e(o,t({open:h,disablePortal:!0,popperOptions:{strategy:"fixed"},anchorEl:{getBoundingClientRect:function(){return{width:0,height:Z.bottom-Z.top,top:Z.top,bottom:Z.bottom,left:Z.left,right:Z.left,x:Z.left,y:Z.top,toJSON:function(){}}}},placement:"bottom",modifiers:[{name:"offset",options:{offset:[0,20]}}],sx:{zIndex:20}},{children:n(l,t({ref:E,sx:t(t({p:1.5,borderRadius:"12px",width:J,maxWidth:J},(K>0||Q>0)&&{clipPath:"inset(".concat(K,"px 0 ").concat(Q-150,"px 0 round 12px)")}),{transition:"transform 80ms linear",willChange:"transform",backfaceVisibility:"hidden",transform:"translateZ(0)",boxShadow:"0px 10px 24px rgba(15, 23, 42, 0.18)",border:"1px solid ".concat(P,"26"),borderTop:"3px solid ".concat(P),overflow:"hidden",bgcolor:"#fff"})},{children:[n(i,t({sx:{display:"flex",alignItems:"center",justifyContent:"space-between",mb:.75}},{children:[n(i,t({sx:{display:"flex",alignItems:"center",gap:.75,minWidth:0}},{children:[e(u,{size:14,color:P}),e(r,t({sx:{fontSize:"11px",fontWeight:700,color:P,textTransform:"uppercase",letterSpacing:"0.4px",lineHeight:1.2}},{children:"Summary"}))]})),e(a,t({size:"small",onClick:y,sx:{p:.25,ml:.5,color:"#64748B"}},{children:e(c,{size:14})}))]})),e(r,t({sx:{fontSize:"12px",color:"#475569",lineHeight:1.5,fontWeight:400,overflowWrap:"anywhere"}},{children:N||"No summary available."}))]}))})):null}export{p as default};
2
2
  //# sourceMappingURL=CognitiveSummaryPopup.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,yCAAyC,CAAA;AAEnF,eAAO,MAAM,iBAAiB,EAAE,GAg+M/B,CAAA"}
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,yCAAyC,CAAA;AAEnF,eAAO,MAAM,iBAAiB,EAAE,GAsnO/B,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"CognitiveCompare.d.ts","sourceRoot":"","sources":["../../../../../src/features/CognitiveCompare/CognitiveCompare.tsx"],"names":[],"mappings":"AAgCA,OAAO,EAEL,qBAAqB,EAMtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAGL,sBAAsB,EACvB,MAAM,0BAA0B,CAAC;AAiBlC,QAAA,MAAM,gBAAgB,sLAWnB,qBAAqB,4CAy7FvB,CAAC;AAEF,OAAO,EAAE,sBAAsB,EAAE,CAAC;AAClC,eAAe,gBAAgB,CAAC"}
1
+ {"version":3,"file":"CognitiveCompare.d.ts","sourceRoot":"","sources":["../../../../../src/features/CognitiveCompare/CognitiveCompare.tsx"],"names":[],"mappings":"AAgCA,OAAO,EAEL,qBAAqB,EAMtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAGL,sBAAsB,EACvB,MAAM,0BAA0B,CAAC;AAiBlC,QAAA,MAAM,gBAAgB,sLAWnB,qBAAqB,4CAy6FvB,CAAC;AAEF,OAAO,EAAE,sBAAsB,EAAE,CAAC;AAClC,eAAe,gBAAgB,CAAC"}
@@ -235,6 +235,7 @@ export type CognitiveSummaryPopupProps = {
235
235
  clipTopEl?: HTMLElement | null;
236
236
  onClose: () => void;
237
237
  summary: string | Record<string, any> | null;
238
+ scrollContainerEl?: HTMLElement | null;
238
239
  markdownStyles?: React.CSSProperties & Record<string, any>;
239
240
  isLoading?: boolean;
240
241
  };
@@ -1 +1 @@
1
- {"version":3,"file":"CognitiveCompareTypes.d.ts","sourceRoot":"","sources":["../../../../../src/features/CognitiveCompare/CognitiveCompareTypes.ts"],"names":[],"mappings":"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"}
1
+ {"version":3,"file":"CognitiveCompareTypes.d.ts","sourceRoot":"","sources":["../../../../../src/features/CognitiveCompare/CognitiveCompareTypes.ts"],"names":[],"mappings":"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"}
@@ -1,3 +1,3 @@
1
1
  import { CognitiveSummaryPopupProps } from "../CognitiveCompareTypes";
2
- export default function CognitiveSummaryPopup({ open, anchorEl, containerEl, clipTopEl, onClose, summary, markdownStyles, isLoading, }: CognitiveSummaryPopupProps): import("react/jsx-runtime").JSX.Element | null;
2
+ export default function CognitiveSummaryPopup({ open, anchorEl, containerEl, clipTopEl, scrollContainerEl, onClose, summary, markdownStyles, isLoading, }: CognitiveSummaryPopupProps): import("react/jsx-runtime").JSX.Element | null;
3
3
  //# sourceMappingURL=CognitiveSummaryPopup.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CognitiveSummaryPopup.d.ts","sourceRoot":"","sources":["../../../../../../src/features/CognitiveCompare/components/CognitiveSummaryPopup.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AAGtE,MAAM,CAAC,OAAO,UAAU,qBAAqB,CAAC,EAC5C,IAAI,EACJ,QAAQ,EACR,WAAW,EACX,SAAS,EACT,OAAO,EACP,OAAO,EACP,cAAc,EACd,SAAS,GACV,EAAE,0BAA0B,kDAyN5B"}
1
+ {"version":3,"file":"CognitiveSummaryPopup.d.ts","sourceRoot":"","sources":["../../../../../../src/features/CognitiveCompare/components/CognitiveSummaryPopup.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AAGtE,MAAM,CAAC,OAAO,UAAU,qBAAqB,CAAC,EAC5C,IAAI,EACJ,QAAQ,EACR,WAAW,EACX,SAAS,EACT,iBAAiB,EACjB,OAAO,EACP,OAAO,EACP,cAAc,EACd,SAAS,GACV,EAAE,0BAA0B,kDAwO5B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@viswa-test/test-citation",
3
- "version": "0.0.82",
3
+ "version": "0.0.84",
4
4
  "author": "Viswa Koduru",
5
5
  "description": "",
6
6
  "license": "MIT",