@viswa-test/test-citation 0.0.90 → 0.0.92
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/features/CognitiveCompare/CognitiveCompare.js +1 -1
- package/dist/cjs/features/CognitiveCompare/components/SectionAccordion.js +1 -1
- package/dist/cjs/features/CognitiveCompare/components/SubSectionAccordion.js +1 -1
- package/dist/cjs/features/CognitiveCompare/hooks/useCompareData.js +1 -1
- package/dist/features/CognitiveCompare/CognitiveCompare.js +1 -1
- package/dist/features/CognitiveCompare/components/SectionAccordion.js +1 -1
- package/dist/features/CognitiveCompare/components/SubSectionAccordion.js +1 -1
- package/dist/features/CognitiveCompare/hooks/useCompareData.js +1 -1
- package/dist/types/src/CommonConstants/CommonConstants.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/CognitiveCompare.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/hooks/useCompareData.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),t=require("react"),i=require("@mui/material"),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"),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(A){var b,E,I,T,B,C,D,O,w,N,j,P,F,k,M,L=A.componentHeaderText,V=void 0===L?a.DEFAULT_COMPONENT_HEADER_TEXT:L,H=A.treeData,G=A.comparisonConfig,q=A.leftColumnTitleText,z=A.rightColumnTitleText,W=A.markdownStyles,Y=A.displayConfig,K=void 0===Y?{isHeaderVisible:!0,isToggleVisible:!0,maintainRelativeOrder:!1,isLoading:!0}:Y,U=A.popupConfig,X=A.deviationData,J=void 0===X?{}:X,Q=A.deviationNodeIdToView,Z=A.resetDeviationNodeId,$=t.useState(K.maintainRelativeOrder),ee=$[0],ne=$[1],te=t.useState(!1),ie=te[0],oe=te[1],re=t.useState(!1),le=re[0],ue=re[1],ce=t.useState(null),ae=ce[0],se=ce[1],de=t.useState(!1),ve=de[0],ge=de[1],fe=t.useState(!1),pe=fe[0],he=fe[1],xe=t.useState(!1),me=xe[0],_e=xe[1],Re=t.useState(null),ye=Re[0],Se=Re[1],Ae=t.useRef(!1),be=t.useState(new Set),Ee=be[0],Ie=be[1],Te=t.useState([]),Be=Te[0],Ce=Te[1],De=t.useRef(null),Oe=t.useRef(!1),we=t.useRef(null),Ne=t.useRef({}),je=t.useRef([]),Pe=t.useRef(!1),Fe=t.useRef(!1),ke=t.useRef(null),Me=t.useRef(function(){}),Le=t.useMemo(function(){return(null==H?void 0:H.cognitive_decisioning)||{}},[H]),Ve=t.useState({width:0,height:0}),He=Ve[0],Ge=Ve[1],qe=t.useMemo(function(){return e.__assign(e.__assign({},c.SHARED_MARKDOWN_STYLES),W)},[W]),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(null),Ze=t.useRef(!1),$e=t.useRef(null),en=t.useRef(null),nn=p.useComparePopups(ze),tn=nn.cognitivePopup,on=nn.setCognitivePopup,rn=nn.moreFunctions,ln=nn.setMoreFunctions,un=nn.position,cn=nn.setPosition,an=nn.activeBadgeId,sn=nn.summaryPopup,dn=nn.setSummaryPopup,vn=nn.closeSummaryPopup,gn=nn.setActiveBadgeId,fn=nn.popupRef,pn=nn.closeCognitivePopup,hn=nn.closeMoreFunctionsPopup,xn=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]),mn=t.useState(null),_n=mn[0];mn[1];var Rn=null===(I=null===(b=null==H?void 0:H.documents)||void 0===b?void 0:b[null===(E=null==H?void 0:H.input_index_map)||void 0===E?void 0:E[0]])||void 0===I?void 0:I.title,yn=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,Sn=u.safeStringify(q||Rn||"Uploaded Contract"),An=u.safeStringify(z||yn||"Reference Template"),bn=f.useCognitiveTreeData(H,ee,J,xn),En=bn.activeProposed,In=bn.existingRule,Tn=bn.proposedSections,Bn=bn.existingSections,Cn=bn.visibleFields,Dn=bn.parentDeviationRecord,On=bn.deviationNumberRegistry,wn=bn.parseError;t.useEffect(function(){wn&&se("Failed to load comparison: ".concat(wn))},[wn]);var Nn=Tn.length>0||Bn.length>0,jn=h.useSectionRefs(Cn.map(function(e){return e.key}),Math.max(Tn.length,Bn.length)),Pn=jn.leftRefs,Fn=jn.rightRefs,kn=jn.sectionLeftRefs,Mn=jn.sectionRightRefs,Ln=jn.lhsBadgeRefs,Vn=jn.rhsBadgeRefs,Hn=jn.sectionRightRowRefs,Gn=jn.subSectionLeftRefs,qn=jn.subSectionRightRefs,zn=jn.sectionRowRefs,Wn=jn.getSectionRowRef,Yn=jn.getSubSectionRef,Kn=jn.getBadgeRef,Un=In.analysis,Xn=u.safeStringify(null===(O=null===(D=null==Un?void 0:Un.rule_difference_comparison)||void 0===D?void 0:D.summary)||void 0===O?void 0:O.overall_summary),Jn=!!Xn.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),Qn=null!==(w=null==H?void 0:H.base_root_id)&&void 0!==w?w:"-1";null==H||H[Qn];var Zn=(null===(N=null==J?void 0:J[Qn])||void 0===N?void 0:N.evaluation_result)||(null===(P=null===(j=null==H?void 0:H.nodes)||void 0===j?void 0:j[Qn])||void 0===P?void 0:P.evaluation_result)||null,$n=u.extractDeviationScore(Zn),et=u.generateColorPalette(null!==(M=null===(k=null===(F=null==Zn?void 0:Zn.evaluation_outputs)||void 0===F?void 0:F.metadata)||void 0===k?void 0:k.label_color)&&void 0!==M?M:""),nt=t.useCallback(function(){var e,n,t,i,o,r;ge(!1),Fe.current=!1;var l=ke.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=Gn.current[a[2]])||void 0===e?void 0:e.current)||(null===(n=kn.current[Number(a[2])])||void 0===n?void 0:n.current))&&(s.style.paddingTop="0px")}else{var s;(s=null===(t=kn.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=qn.current[a[3]])||void 0===i?void 0:i.current)||(null===(o=Mn.current[Number(a[3])])||void 0===o?void 0:o.current))&&(d.style.paddingTop="0px")}else{var d;(d=null===(r=Mn.current[c])||void 0===r?void 0:r.current)&&(d.style.paddingTop="0px")}Se(null),ke.current=null,ft.current=null,he(!1),ue(!1),Ke.current&&(Ke.current.style.height="0px"),Ue.current&&(Ue.current.style.height="0px"),Xe.current&&(Xe.current.style.height="0px"),Je.current&&(Je.current.style.height="0px")},[]),tt=x.useAccordionState({maintainRelativeOrder:!!ee,proposedSections:Tn,existingSections:Bn,activeSideBySideSection:ye,connectedSections:Ee,resetSideBySide:nt,setConnectedSections:Ie,setConnectedLines:Ce,cachedConnectedPositions:je,svgContainerRef:De,isAnimatingRef:Oe,animationTimerRef:we,calculateLinesRef:Me,sectionLeftRefs:kn,sectionRightRefs:Mn,subSectionLeftRefs:Gn,subSectionRightRefs:qn}),it=tt.expandedSections,ot=tt.expandedSubSections,rt=tt.setExpandedSubSections,lt=tt.toggleSection,ut=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?Le[d]:null)||(null==n?void 0:n.cognitiveData)||(null==t?void 0:t.cognitiveData)||{section_id:d,decisioning:[],gap:[],relevance_score:0},g=null!==(a=null===(c=zn.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:g,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}},[Le,H]),ct=t.useCallback(function(e){hn(),cn(null),on(e)},[hn]),at=function(e,n,t,i,o,r){var l;if(e.stopPropagation(),rn.open&&rn.sectionIdx===o)hn();else{var c=e.currentTarget,a="left";(null===(l=Ye.current)||void 0===l?void 0:l.contains(c))&&(a="right");Fe.current&&nt(),Ie(new Set),Ce([]),je.current=[],pn(),sn.open?kt():vn(),requestAnimationFrame(function(){var e=function(){var e,n,t,i;if("string"==typeof o&&o.includes(u.DEVIATION_BADGE_SEPARATOR)){var r=o.split(u.DEVIATION_BADGE_SEPARATOR),l="".concat(r[0]).concat(u.DEVIATION_BADGE_SEPARATOR).concat(r[1]);return"right"===a?null===(e=Vn.current[l])||void 0===e?void 0:e.current:null===(n=Ln.current[l])||void 0===n?void 0:n.current}return"right"===a?null===(t=Vn.current[o])||void 0===t?void 0:t.current:null===(i=Ln.current[o])||void 0===i?void 0:i.current}()||c;ln(ut(e,n,i,o,t,r))})}},st=t.useCallback(function(){null!==rn.sectionIdx&&rn.anchorEl?ct(e.__assign(e.__assign({},rn),{open:!0})):hn()},[rn,hn,ct]),dt=t.useCallback(function(){var e=rn.sectionIdx,n=rn.isOrphan;hn(),vn(),null!==e&&(n?se("No counterpart exists to connect to."):(Fe.current&&nt(),Ce([]),je.current=[],Ie(function(n){return n.has(e)?new Set:new Set([e])}),setTimeout(function(){Me.current&&Me.current()},50)))},[rn.sectionIdx,rn.isOrphan,hn,vn,nt]),vt=t.useRef(null),gt=t.useRef(null),ft=t.useRef(null),pt=t.useRef(null),ht=t.useRef(null),xt=t.useRef(null),mt=t.useState([]),_t=mt[0],Rt=mt[1];t.useRef(null);var yt=t.useState(null),St=yt[0],At=yt[1];t.useEffect(function(){if(_n){var e=xn.fields.find(function(e){return e.analysisKey===_n||e.key===_n});if(e){var n=Pn.current[e.key]||Fn.current[e.key];(null==n?void 0:n.current)&&setTimeout(function(){return n.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[_n,xn.fields]);var bt=t.useCallback(function(e){var n,t,i,o,r,l,u,c,a,s=null===(n=null==Un?void 0:Un.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 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===(a=d.highlights)||void 0===a?void 0:a.ruleB_spans)||[],hasContent:!!v}},[Un]),Et=t.useCallback(function(n,t){var i,o,r,l,c,s,d;void 0===t&&(t="left");var v=null,g=null;if("left"===t)if(v=Tn[n],ee&&v){var f=Bn.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=Bn[n];else if(g=Bn[n],ee&&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(a.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!==(s=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!==s?s:a.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,Bn,Le,xn,ee]),It=t.useCallback(function(n){for(var t,i,o,r,l,c,s,d,v,g=n.split("-").map(Number),f=Tn[g[0]],p=Bn[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(a.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=Le[_])||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,A=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(A)),{label:null!=S?S:""}):e.__assign(e.__assign({},u.generateColorPalette(A)),{label:null})},[Tn,Bn,Le,xn]),Tt=t.useCallback(function(){var e,n,t,i,o,r,l,c,a,s,d,v,g,f,p,h,x,m,_,R,y,S;if(!Ze.current&&!Oe.current){Ze.current=!0;try{if(!vt.current)return;var A=function(e){var n=e.split("-"),t=n[0];if(!it[t]&&!1===ee)return!1;if(ee&&!it["left-".concat(t)]&&!it["right-".concat(t)]&&!it[t])return!1;for(var i=t,o=1;o<n.length-1;o++)if(i+="-".concat(n[o]),!ot[i])return!1;return!0},b=vt.current.getBoundingClientRect();Ge({width:b.width,height:b.height});var E=[];if(Cn.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=Fn.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")}),!Oe.current){for(var I=0;I<Math.max(Tn.length,Bn.length);I++){var T=null===(e=kn.current[I])||void 0===e?void 0:e.current,B=null===(n=Mn.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")}ee||Object.keys(Gn.current).forEach(function(e){var n,t;if(A(e)){var i=null===(n=Gn.current[e])||void 0===n?void 0:n.current,o=null===(t=qn.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={};Cn.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=Fn.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(!Oe.current)if(ee){if(ve&&null!==ye)if("number"==typeof ye){var w=ye,N=Tn[w],j=null===(o=kn.current[w])||void 0===o?void 0:o.current;j&&N&&(N.refIndexes||[]).forEach(function(e){var n,t=Bn.findIndex(function(n){return n.selfIndex===e}),i=null===(n=Mn.current[t])||void 0===n?void 0:n.current;if(i&&(it["left-".concat(w)]||it["right-".concat(t)])){var o=Math.max(j.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 P=ye.split(u.DEVIATION_BADGE_SEPARATOR)[2];if(P){T=null===(r=Gn.current[P])||void 0===r?void 0:r.current,B=null===(l=qn.current[P])||void 0===l?void 0:l.current;if(T&&B){F=Math.max(T.getBoundingClientRect().height,B.getBoundingClientRect().height);O[P]=Math.max(O[P]||0,F)}}}}else{Object.keys(Gn.current).forEach(function(e){var n,t;if(A(e)){var i=null===(n=Gn.current[e])||void 0===n?void 0:n.current,o=null===(t=qn.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(Tn.length,Bn.length);I++){var T=null===(t=kn.current[I])||void 0===t?void 0:t.current,B=null===(i=Mn.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(Cn.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=Fn.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")}}),Oe.current||(Object.entries(D.left).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.entries(D.right).forEach(function(e){var n,t=e[0],i=e[1],o=null===(n=Mn.current[Number(t)])||void 0===n?void 0:n.current;o&&(o.style.minHeight="".concat(i,"px"))}),ee||Object.keys(O).forEach(function(e){var n,t,i=null===(n=Gn.current[e])||void 0===n?void 0:n.current,o=null===(t=qn.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")}})),ee)Tn.forEach(function(e,n){var t;(null===(t=kn.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=Bn.findIndex(function(n){return n.selfIndex===e});if(-1!==v){var g=null===(t=Ln.current[n])||void 0===t?void 0:t.current,f=null===(i=Vn.current[v])||void 0===i?void 0:i.current;if(g&&f){var p=g.getBoundingClientRect(),h=f.getBoundingClientRect(),x=p.right-b.left,m=h.left-b.left,_=p.top+p.height/2-b.top,R=h.top+h.height/2-b.top;if(ve&&ye===n){var y=null!==(r=null===(o=Qe.current)||void 0===o?void 0:o.getBoundingClientRect().top)&&void 0!==r?r:0,S=null!==(u=null===(l=Ye.current)||void 0===l?void 0:l.getBoundingClientRect().top)&&void 0!==u?u:0,A=y+(null!==(a=null===(c=Qe.current)||void 0===c?void 0:c.clientHeight)&&void 0!==a?a:1/0),I=S+(null!==(d=null===(s=Ye.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))};_=C(T,y,A)-b.top,R=C(B,S,I)-b.top}var D=Et(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(I=0;I<Math.min(Tn.length,Bn.length);I++){var k=null===(c=kn.current[I])||void 0===c?void 0:c.current,M=null===(a=Mn.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-b.top,G=(null===(s=Bn[I])||void 0===s?void 0:s.id)||"sec-".concat(I);(J=Et(I))&&E.push({id:G,x1:L.right-b.left,y1:H,x2:V.left-b.left,y2:H,style:J,sectionIdx:I,hasCognitive:!!((null===(d=Tn[I])||void 0===d?void 0:d.cognitiveData)||(null===(v=Bn[I])||void 0===v?void 0:v.cognitiveData)||G&&Le[G]),isSubSection:!1})}}Object.keys(Gn.current).forEach(function(e){var n,t,i,o,r,l;if(A(e)){var c=null===(n=Gn.current[e])||void 0===n?void 0:n.current,a=null===(t=qn.current[e])||void 0===t?void 0:t.current;if(c&&a){for(var s=e.split("-").map(Number),d=Tn[s[0]],v=Bn[s[0]],g=1;g<s.length;g++)(null==d?void 0:d.subsections)&&(d=d.subsections[s[g]]),(null==v?void 0:v.subsections)&&(v=v.subsections[s[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(),_=a.getBoundingClientRect(),R=Math.max(m.top,_.top)+16-b.top,y=It(e);y&&"Not Defined"!==y.label&&E.push({id:"subsec-".concat(e),x1:m.right-b.left,y1:R,x2:_.left-b.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(ve&&"string"==typeof ye&&ye.includes(u.DEVIATION_BADGE_SEPARATOR)){var q=ye.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=Ln.current[K])||void 0===g?void 0:g.current,X=null===(f=Vn.current[K])||void 0===f?void 0:f.current;if(U&&X){var J,Q=U.getBoundingClientRect(),Z=X.getBoundingClientRect(),$=Q.right-b.left,ne=Z.left-b.left,te=Q.top+Q.height/2-b.top,ie=Z.top+Z.height/2-b.top;if(ee){var oe=null!==(h=null===(p=Qe.current)||void 0===p?void 0:p.getBoundingClientRect().top)&&void 0!==h?h:0,re=null!==(m=null===(x=Ye.current)||void 0===x?void 0:x.getBoundingClientRect().top)&&void 0!==m?m:0,le=oe+(null!==(R=null===(_=Qe.current)||void 0===_?void 0:_.clientHeight)&&void 0!==R?R:1/0),ue=re+(null!==(S=null===(y=Ye.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)-b.top,ie=ce(Z.top+Z.height/2,re,ue)-b.top}(J=It(Y))&&E.push({id:"line-subsec-".concat(K),x1:$,y1:te,x2:ne,y2:ie,style:J,sectionIdx:Number(Y.split("-")[0]),isSubSection:!0,subSectionKeyPath:ye})}}if(Rt(E),ht.current&&xt.current){var ae=ht.current.getBoundingClientRect(),se=xt.current.getBoundingClientRect(),de=(ae.top+ae.height/2-b.top+se.top+se.height/2-b.top)/2;At({x1:ae.right-b.left,x2:se.left-b.left,y:de})}else At(null);if(Ee.size>0){var ge=[],fe=Qe.current,pe=Ye.current;if(fe&&pe){var he=[],xe=fe.getBoundingClientRect().top,me=pe.getBoundingClientRect().top,_e=xe+fe.clientHeight,Re=me+pe.clientHeight,Se=fe.scrollTop,Ae=pe.scrollTop,be=b.top,Ie=function(e,n,t){return Math.max(n,Math.min(t,e))};Ee.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=Ln.current[d])||void 0===n?void 0:n.current,g=null===(t=Vn.current[d])||void 0===t?void 0:t.current;if(!v||!g)return;var f=v.getBoundingClientRect(),p=g.getBoundingClientRect(),h=It(s),x=(j=f.right-b.left)+.5*((P=p.left-b.left-0)-j),m=f.top+f.height/2,_=p.top+p.height/2,R=m-xe+Se,y=_-me+Ae,S="conn-subsec-".concat(d);he.push({lhsScrollY:R,rhsScrollY:y,x1:j,x2:P,containerTop:be,leftIdx:e,rhsArrayIdx:e,styleColor:(null==h?void 0:h.badgeBorder)||"#6366F1",styleId:S});var A=Ie(m,xe,_e),E=Ie(_,me,Re),I=A-be,T=E-be,B=_>=me-4&&_<=Re+4,C="";C=(F=m>=xe-4&&m<=_e+4)&&B?u.getBentArrowPath(j,I,P,T):F&&!B?"M ".concat(j,",").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(P,",").concat(T):"M ".concat(x,",").concat(I," L ").concat(x,",").concat(T),ge.push({id:S,pathD:C,style:h,leftIdx:e,rhsArrayIdx:e})}else if(ee){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=Bn.findIndex(function(n){return n.selfIndex===e});if(-1!==i){var o=null===(n=Ln.current[D])||void 0===n?void 0:n.current,r=null===(t=Vn.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=o.getBoundingClientRect(),c=r.getBoundingClientRect(),a=Et(D),s=l.right-b.left,d=c.left-b.left-0,v=s+.5*(d-s),g=l.top+l.height/2,f=c.top+c.height/2,p=g-xe+Se,h=f-me+Ae,x="conn-".concat(D,"-").concat(i);he.push({lhsScrollY:p,rhsScrollY:h,x1:s,x2:d,containerTop:be,leftIdx:D,rhsArrayIdx:i,styleColor:(null==a?void 0:a.badgeBorder)||"#6366F1",styleId:x});var m=Ie(g,xe,_e),_=Ie(f,me,Re),R=m-be,y=_-be,S=g>=xe-4&&g<=_e+4,A=f>=me-4&&f<=Re+4,E="";E=S&&A?u.getBentArrowPath(s,R,d,y):S&&!A?"M ".concat(s,",").concat(R," L ").concat(v,",").concat(R," L ").concat(v,",").concat(y):!S&&A?"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:a,leftIdx:D,rhsArrayIdx:i})}}})}else{var w=e,N=w;v=null===(i=Ln.current[w])||void 0===i?void 0:i.current,g=null===(o=Vn.current[N])||void 0===o?void 0:o.current;if(!v||!g)return;var j,P;f=v.getBoundingClientRect(),p=g.getBoundingClientRect(),h=Et(w),x=(j=f.right-b.left)+.5*((P=p.left-b.left-0)-j),m=f.top+f.height/2,_=p.top+p.height/2,R=m-xe+Se,y=_-me+Ae,S="conn-".concat(w,"-").concat(N);he.push({lhsScrollY:R,rhsScrollY:y,x1:j,x2:P,containerTop:be,leftIdx:w,rhsArrayIdx:N,styleColor:(null==h?void 0:h.badgeBorder)||"#6366F1",styleId:S});var F;A=Ie(m,xe,_e),E=Ie(_,me,Re),I=A-be,T=E-be,B=_>=me-4&&_<=Re+4,C="";C=(F=m>=xe-4&&m<=_e+4)&&B?u.getBentArrowPath(j,I,P,T):F&&!B?"M ".concat(j,",").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(P,",").concat(T):"M ".concat(x,",").concat(I," L ").concat(x,",").concat(T),ge.push({id:S,pathD:C,style:h,leftIdx:w,rhsArrayIdx:N})}}),je.current=he}Ce(ge)}else Ce([]),je.current=[]}catch(e){console.error("Line render safe fail: ",e)}finally{Ze.current=!1}}},[Cn,Tn,Bn,Le,xn,bt,Et,ee,ve,ye,Ee,it,ot]),Bt=t.useCallback(function(){var e,n,t,i,o,r,l,c,a,s,d,v,g,f,p=je.current;if(p.length&&!Oe.current){var h=null!==(n=null===(e=Qe.current)||void 0===e?void 0:e.scrollTop)&&void 0!==n?n:0,x=null!==(i=null===(t=Ye.current)||void 0===t?void 0:t.scrollTop)&&void 0!==i?i:0,m=null!==(r=null===(o=Qe.current)||void 0===o?void 0:o.clientHeight)&&void 0!==r?r:1/0,_=null!==(c=null===(l=Ye.current)||void 0===l?void 0:l.clientHeight)&&void 0!==c?c:1/0,R=null!==(s=null===(a=Qe.current)||void 0===a?void 0:a.getBoundingClientRect().top)&&void 0!==s?s:0,y=null!==(v=null===(d=Ye.current)||void 0===d?void 0:d.getBoundingClientRect().top)&&void 0!==v?v:0,S=R+m,A=y+_,b=null!==(f=null===(g=vt.current)||void 0===g?void 0:g.getBoundingClientRect().top)&&void 0!==f?f: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=Ne.current[e.styleId+"-stroke"],o=Ne.current[e.styleId+"-bg"];if(i||o){var r,l=E(n,R,S),c=E(t,y,A),a=l-b,s=c-b,d=n>=R-4&&n<=S+4,v=t>=y-4&&t<=A+4,g=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(g,",").concat(a," L ").concat(g,",").concat(s):!d&&v?"M ".concat(g,",").concat(a," L ").concat(g,",").concat(s," L ").concat(e.x2,",").concat(s):"M ".concat(g,",").concat(a," L ").concat(g,",").concat(s),i&&(i.setAttribute("visibility","visible"),i.setAttribute("d",r)),o&&(o.setAttribute("visibility","visible"),o.setAttribute("d",r))}})}},[]);t.useEffect(function(){Me.current=Tt},[Tt]);var Ct=t.useRef(null),Dt=t.useRef(null),Ot=t.useCallback(function(){je.current.length>0&&!Oe.current||(null!==Ct.current&&clearTimeout(Ct.current),Ct.current=setTimeout(function(){Me.current(),Ct.current=null},50))},[]),wt=t.useCallback(function(){_e(!0),he(!1),null!==Dt.current&&clearTimeout(Dt.current),null!==Ct.current&&(clearTimeout(Ct.current),Ct.current=null),Dt.current=setTimeout(function(){var e,n,t,i,o,r,l,c,a,s;if(je.current=[],Fe.current&&null!==ke.current&&null!==ft.current){var d=ke.current,v=ft.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=Ln.current[m])||void 0===e?void 0:e.current)||null,f=(null===(n=Vn.current[m])||void 0===n?void 0:n.current)||null,p=(null===(t=Gn.current[x[2]])||void 0===t?void 0:t.current)||(null===(i=kn.current[Number(x[2])])||void 0===i?void 0:i.current)||null,h=(null===(o=qn.current[x[3]])||void 0===o?void 0:o.current)||(null===(r=Mn.current[Number(x[3])])||void 0===r?void 0:r.current)||null}else g=(null===(l=zn.current[d])||void 0===l?void 0:l.current)||null,p=(null===(c=kn.current[d])||void 0===c?void 0:c.current)||null,f=(null===(a=Hn.current[v])||void 0===a?void 0:a.current)||null,h=(null===(s=Mn.current[v])||void 0===s?void 0:s.current)||null;if(g&&f&&p&&h){if(p.style.paddingTop="0px",h.style.paddingTop="0px",!ee){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=Qe.current,A=Ye.current;if(S&&A){var b=g.getBoundingClientRect().top-S.getBoundingClientRect().top+S.scrollTop,E=f.getBoundingClientRect().top-A.getBoundingClientRect().top+A.scrollTop-(b-S.scrollTop);Math.abs(A.scrollTop-E)>1&&(A.scrollTop=E)}}}Me.current(),Fe.current&&he(!0),_e(!1),Dt.current=null},150)},[ee,Tn,Bn]),Nt=t.useCallback(function(e){var n,t,i,o,r,l,c,a,s,d;if(null!==$e.current&&en.current&&Math.abs(e.currentTarget.scrollTop-$e.current)<=2){var v=en.current;$e.current=null,en.current=null,v()}if(!Ae.current){if(ee||Ot(),Fe.current){var g=ke.current,f=ft.current,p=Qe.current,h=Ye.current;if(null!==g&&null!==f&&p&&h){var x="string"==typeof g&&g.includes(u.DEVIATION_BADGE_SEPARATOR)?null===(n=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===n?void 0:n.current:null===(t=zn.current[g])||void 0===t?void 0:t.current,m="string"==typeof f&&f.includes(u.DEVIATION_BADGE_SEPARATOR)?null===(i=Vn.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&&pt.current){var _=void 0,R=void 0;if("string"==typeof g&&g.includes(u.DEVIATION_BADGE_SEPARATOR)){var y=g.split(u.DEVIATION_BADGE_SEPARATOR),S="".concat(y[0]).concat(u.DEVIATION_BADGE_SEPARATOR).concat(y[1]);_=null===(r=Ln.current[S])||void 0===r?void 0:r.current,R=null===(l=Vn.current[S])||void 0===l?void 0:l.current}else _=null===(c=Ln.current[g])||void 0===c?void 0:c.current,R=null===(a=Vn.current[f])||void 0===a?void 0:a.current;var A=null!==(d=null===(s=vt.current)||void 0===s?void 0:s.getBoundingClientRect().top)&&void 0!==d?d:0,b=p.getBoundingClientRect().top,E=b+p.clientHeight;h.getBoundingClientRect().top;h.clientHeight;if(_&&R){var I=_.getBoundingClientRect(),T=R.getBoundingClientRect(),B=I.top+I.height/2;T.top,T.height;var C=((O=B,w=b,N=E,Math.max(w,Math.min(N,O)))-A).toString();pt.current.setAttribute("y1",C),pt.current.setAttribute("y2",C);var D=B>=b-4&&B<=E+4;pt.current.setAttribute("visibility",D?"visible":"hidden")}}}}var O,w,N;je.current.length>0&&!Pe.current&&(Pe.current=!0,requestAnimationFrame(function(){Bt(),Pe.current=!1}))}},[Bt,ee,Ot]);t.useEffect(function(){var e=setTimeout(Ot,250);window.addEventListener("resize",wt);var n=null,t=null;return ze.current&&(n=new ResizeObserver(Ot)).observe(ze.current),vt.current&&(t=new ResizeObserver(Ot)).observe(vt.current),function(){clearTimeout(e),null!==Ct.current&&clearTimeout(Ct.current),null!==Dt.current&&clearTimeout(Dt.current),window.removeEventListener("resize",wt),null==n||n.disconnect(),null==t||t.disconnect()}},[En,In,Un,Cn,it,ot,Tn,Bn,xn,Ot,wt,ve,ye,pe,Ee]),t.useEffect(function(){Fe.current=ve},[ve]),t.useEffect(function(){ke.current=ye},[ye]);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";hn(),null!=e&&(n?se("No counterpart exists for this section."):ve&&ye===e?r?nt():null==l||l():(Ie(new Set([e])),Ce([]),je.current=[],ue(!0),Ae.current=!0,Se(e),ke.current=e,ge(!0),Fe.current=!0,he(!1),Ke.current&&(Ke.current.style.height="0px"),Ue.current&&(Ue.current.style.height="0px"),Xe.current&&(Xe.current.style.height="0px"),Je.current&&(Je.current.style.height="0px"),requestAnimationFrame(function(){var n,t,i,o,r,a="string"==typeof e&&e.includes(u.DEVIATION_BADGE_SEPARATOR),s=null,d=null,v=null;if(a){var g=e.split(u.DEVIATION_BADGE_SEPARATOR),f="".concat(g[0]).concat(u.DEVIATION_BADGE_SEPARATOR).concat(g[1]);s=(null===(n=Ln.current[f])||void 0===n?void 0:n.current)||null,d=(null===(t=Vn.current[f])||void 0===t?void 0:t.current)||null,v=d?e:null}else if(s=(null===(i=zn.current[e])||void 0===i?void 0:i.current)||null,ee){var p=Tn[e],h=(null==p?void 0:p.refIndexes)||[];if(h.length>0){var x=h[0],m=Bn.findIndex(function(e){return e.selfIndex===x});-1!==m&&(d=(null===(r=Hn.current[m])||void 0===r?void 0:r.current)||null,v=m)}}else d=(null===(o=Hn.current[e])||void 0===o?void 0:o.current)||null,v=d?e:null;ft.current=v;var _=Qe.current,R=Ye.current,y=function(){!function(){var n,t,i,o,r,l,c,s,d,g,f,p,h=null,x=null,m=null,_=null;if(a){var R=e.split(u.DEVIATION_BADGE_SEPARATOR),y="".concat(R[0]).concat(u.DEVIATION_BADGE_SEPARATOR).concat(R[1]);h=(null===(n=Gn.current[R[2]])||void 0===n?void 0:n.current)||(null===(t=kn.current[Number(R[2])])||void 0===t?void 0:t.current)||null,x=(null===(i=qn.current[R[3]])||void 0===i?void 0:i.current)||(null===(o=Mn.current[Number(R[3])])||void 0===o?void 0:o.current)||null,m=(null===(r=Ln.current[y])||void 0===r?void 0:r.current)||h,_=(null===(l=Vn.current[y])||void 0===l?void 0:l.current)||x}else{var S=Number(e),A=null!==v?Number(v):S;h=(null===(c=kn.current[S])||void 0===c?void 0:c.current)||null,x=(null===(s=Mn.current[A])||void 0===s?void 0:s.current)||null,m=(null===(d=Ln.current[S])||void 0===d?void 0:d.current)||(null===(g=zn.current[S])||void 0===g?void 0:g.current)||h,_=(null===(f=Vn.current[A])||void 0===f?void 0:f.current)||(null===(p=Hn.current[A])||void 0===p?void 0:p.current)||x}if(m&&_&&h&&x){h.style.paddingTop="0px",x.style.paddingTop="0px";var b=m.getBoundingClientRect(),E=_.getBoundingClientRect(),I=b.top-E.top;I>0?x.style.paddingTop="".concat(I,"px"):I<0&&(h.style.paddingTop="".concat(Math.abs(I),"px"))}}(),he(!0),Me.current&&Me.current(),Ae.current=!1,"right"===c&&R?R.dispatchEvent(new Event("scroll")):_&&_.dispatchEvent(new Event("scroll")),ue(!1),null==l||l()};if(!s||!_)return Ae.current=!1,ue(!1),void(null==l||l());if(d&&R){if(!ee){var S=0;S="right"===c?d?d.getBoundingClientRect().top:0:s?s.getBoundingClientRect().top:0;var A=ze.current,b=(null==A?void 0:A.getBoundingClientRect().top)||0,E=A?A.scrollTop+S-b-150:0;return A?void u.smoothScrollTo(A,E,200,y):void y()}var I=s.getBoundingClientRect().top-_.getBoundingClientRect().top+_.scrollTop,T=d.getBoundingClientRect().top-R.getBoundingClientRect().top+R.scrollTop,B=200;if("left"===c){var C=T-(I-_.scrollTop);C<0&&Ke.current&&(Ke.current.style.height="".concat(Math.abs(C),"px")),requestAnimationFrame(function(){var e,n=R.scrollHeight-R.clientHeight;if(C<0)e=0;else{if(C>n){var t=C-n;return Ue.current&&(Ue.current.style.height="".concat(t+150,"px")),void requestAnimationFrame(function(){u.smoothScrollTo(R,C,B,y)})}e=C}u.smoothScrollTo(R,e,B,y)})}else{var D=I-(T-R.scrollTop);D<0&&Xe.current&&(Xe.current.style.height="".concat(Math.abs(D),"px")),requestAnimationFrame(function(){var e,n=_.scrollHeight-_.clientHeight;if(D<0)e=0;else{if(D>n){var t=D-n;return Je.current&&(Je.current.style.height="".concat(t+150,"px")),void requestAnimationFrame(function(){u.smoothScrollTo(_,D,B,y)})}e=D}u.smoothScrollTo(_,e,B,y)})}}else y()})))},[ye,hn,Bn,ve,ee,Tn,nt]),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;pn();var c="left";(null===(o=Ye.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=Vn.current[l])||void 0===e?void 0:e.current:null===(t=Ln.current[l])||void 0===t?void 0:t.current}return"right"===c?null===(i=Vn.current[n])||void 0===i?void 0:i.current:null===(o=Ln.current[n])||void 0===o?void 0:o.current};if(t)return nt(),Ie(new Set),Ce([]),je.current=[],void(r&&requestAnimationFrame(function(){var e=a()||l;dn({open:!0,anchorEl:e,summary:i})}));jt(n,t,r?{toggleIfSame:!1,sourceSide:c,onReady:function(){var e=a()||l;dn({open:!0,anchorEl:e,summary:i})}}:{toggleIfSame:!1,sourceSide:c})},[jt,pn,dn,nt]),Ft=t.useCallback(function(){var e,n=rn.sectionIdx,t=rn.isOrphan;if(vn(),null!=n){var i="left";rn.anchorEl&&(null===(e=Ye.current)||void 0===e?void 0:e.contains(rn.anchorEl))&&(i="right"),jt(n,t,{sourceSide:i})}},[jt,rn.isOrphan,rn.sectionIdx,rn.anchorEl,vn]),kt=t.useCallback(function(){vn(),nt(),Ie(new Set),Ce([]),je.current=[]},[vn,nt]),Mt=null!==rn.sectionIdx&&Ee.has(rn.sectionIdx),Lt=m.useDeviationNavigation({proposedSections:Tn,existingSections:Bn,parentDeviationRecord:Dn,expandedSections:it,maintainRelativeOrder:!!ee,scrollContainerRef:ze,leftContainerRef:Qe,lhsBadgeRefs:Ln,rhsBadgeRefs:Vn}),Vt=Lt.showDeviationNavigation,Ht=Lt.showOpenNodeRef,Gt=t.useMemo(function(){if(!Q)return null;for(var e in Dn){if((Dn[e]||[]).some(function(e){return e.id===Q}))return e}return null},[Q,Dn]),qt=t.useRef(null),zt=t.useRef(null);t.useEffect(function(){if(Q&&qt.current!==Q){zt.current!==Q&&(vn(),pn(),nt(),Ie(new Set),Ce([]),je.current=[],zt.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,g=null;for(var f in Dn){var p=Dn[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}),x=Bn.findIndex(function(e){return e.id===v}),m=-1===h&&-1!==x;if(m){if(!(ee?!!it["right-".concat(x)]:!!it[String(x)]))return lt(x,"right"),t+=1,void(i=setTimeout(l,450))}else if(!(ee?!!it["left-".concat(h)]:!!it[String(h)])&&h>=0)return lt(h,"left"),t+=1,void(i=setTimeout(l,450));var _=r(Tn,g.id),R=r(Bn,g.id);if(_&&!R&&!m){var y=_.split("-"),S=Number(y[0]);if(ee){var A=null===(a=null===(c=Tn[S])||void 0===c?void 0:c.refIndexes)||void 0===a?void 0:a[0],b=Bn.findIndex(function(e){return e.selfIndex===A});-1!==b&&(S=b)}R=e.__spreadArray([S],y.slice(1),!0).join("-")}if(_||R){var E,I=_||"",T=R||"",B="".concat(g.id).concat(u.DEVIATION_BADGE_SEPARATOR,"0").concat(u.DEVIATION_BADGE_SEPARATOR).concat(I).concat(u.DEVIATION_BADGE_SEPARATOR).concat(T),C="".concat(g.id).concat(u.DEVIATION_BADGE_SEPARATOR,"0"),D=null===(s=Ln.current[C])||void 0===s?void 0:s.current,O=null===(d=Vn.current[C])||void 0===d?void 0:d.current,w=m?O:D;if(E=ee?m?Ye.current:Qe.current:ze.current,w&&E){var N=w.getBoundingClientRect();if(0===N.height)return void((t+=1)<20&&(i=setTimeout(l,o)));var j=E.getBoundingClientRect(),P=N.top-j.top+E.scrollTop-j.height/2+N.height/2,F=function(){var e,t,i,o,r;if(!n){qt.current=Q;var l=window.getComputedStyle(w).color;D&&(D.style.transition="box-shadow 300ms ease-in-out",D.style.boxShadow="0 0 10px ".concat(l)),O&&(O.style.transition="box-shadow 300ms ease-in-out",O.style.boxShadow="0 0 10px ".concat(l)),setTimeout(function(){D&&(D.style.boxShadow=""),O&&(O.style.boxShadow="")},2e3);var u=(null===(t=null===(e=g.evaluationResult)||void 0===e?void 0:e.deviations)||void 0===t?void 0:t[0])||g,c=(null===(i=g.evaluationResult)||void 0===i?void 0:i.evaluation_outputs)||g.evaluation_outputs;if(!(D&&O&&!m)){var a=m?(null===(o=Vn.current[C])||void 0===o?void 0:o.current)||O:(null===(r=Ln.current[C])||void 0===r?void 0:r.current)||D;return dn({open:!0,anchorEl:a,summary:{deviation_summary:u.deviation_summary||u,evaluation_outputs:c}}),void(null==Z||Z())}jt(B,!1,{toggleIfSame:!1,sourceSide:"left",onReady:function(){var e,n=(null===(e=Ln.current[C])||void 0===e?void 0:e.current)||D;dn({open:!0,anchorEl:n,summary:{deviation_summary:u.deviation_summary||u,evaluation_outputs:c}})}})}};Math.abs(E.scrollTop-P)<=2?F():($e.current=P,en.current=F,E.scrollTo({top:P,behavior:"smooth"}),i&&clearTimeout(i),i=setTimeout(function(){if(en.current){$e.current=null;var e=en.current;en.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,Dn,Tn,Bn,ee,it,lt,jt,dn]);var Wt=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:ot,setExpandedSubSections:rt,maintainRelativeOrder:ee||!1,proposedSections:Tn,existingSections:Bn,treeData:H,deviationNumberRegistry:On,connectedSections:Ee,activeSideBySideSection:ye,resolvedMarkdownStyles:qe,getSubSectionRef:Yn,getSubSectionCompareStyle:It,getBadgeRef:Kn,openMoreFunctionsPopup:at,openSummaryPopup:Pt,resetSideBySide:nt,setConnectedSections:Ie,setConnectedLines:Ce,cachedConnectedPositions:je})};return n.jsxs(i.Box,e.__assign({ref:We,sx:e.__assign(e.__assign({display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif'},ee?{}:{overflow:"visible"}),{position:"relative"})},{children:[ie&&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:gt.current,clipTopEl:ht.current,scrollContainerEl:ze.current,onClose:kt,summary:sn.summary}),n.jsx(d.default,{open:rn.open,anchorEl:rn.anchorEl,sectionTitle:rn.sectionTitle,referenceSectionTitle:rn.refSectionTitle,onClose:hn,onOpenCognitiveCompare:st,onOpenSideBySide:Ft,onConnect:dt,isConnected:Mt,isOrphan:rn.isOrphan}),tn.open&&n.jsx(s.default,{open:tn.open,popupRef:fn,position:un,popupConfig:U,onClose:function(){cn(null),on(function(n){return e.__assign(e.__assign({},n),{open:!1})}),gn(null)},markdownStyles:W,sectionTitle:tn.sectionTitle,referenceSectionTitle:tn.refSectionTitle,cognitiveData:tn.cognitiveData,anchorEl:tn.anchorEl,sectionAnchorEl:tn.sectionAnchorEl,scrollContainerEl:ze.current,badgeStyle:tn.badgeStyle,docData:tn.docData,deviationData:tn.deviationData,isLoading:tn.isLoading}),n.jsx(i.Snackbar,e.__assign({open:!!ae,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:ae}))})),n.jsx(_.default,{componentHeaderText:V,displayConfig:K,maintainRelativeOrder:ee,onToggleView:function(e){oe(!0),setTimeout(function(){ne(!e),nt(),vn(),Ie(new Set),Ce([]),je.current=[],requestAnimationFrame(function(){requestAnimationFrame(function(){setTimeout(function(){oe(!1)},600)})})},50)}}),n.jsx(i.Box,e.__assign({ref:ze,onScroll:Nt,sx:{flex:1,minHeight:0,pt:1.5,pb:1,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",overflowY:ee?"hidden":"auto",borderTop:Xn&&Jn?"none":"1.5px solid #EEF0F4"}},{children:n.jsx(i.Box,e.__assign({sx:e.__assign({display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"},ee?{flex:1,minHeight:0}:{})},{children:n.jsxs(i.Box,e.__assign({ref:vt,sx:e.__assign({display:"grid",gridTemplateColumns:"minmax(0, 1fr) 180px minmax(0, 1fr)",gap:"40px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0},ee?{flex:1,overflow:"visible"}:{})},{children:[n.jsxs("svg",e.__assign({ref:De,style:{position:"absolute",top:0,left:0,width:He.width||"100%",height:He.height||"100%",pointerEvents:"none",zIndex:10,overflow:"visible",opacity:me?0:1,transition:"opacity 0.15s ease-in-out"}},{children:[St&&n.jsx("g",{children:n.jsx("line",{x1:St.x1,y1:St.y,x2:St.x2,y2:St.y,stroke:et.badgeBorder,strokeWidth:"1.5"})}),_t.map(function(t){var l,c,s,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?ve&&ye===t.subSectionKeyPath&&pe:ve&&ye===t.sectionIdx&&pe)return null;if(!ee){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:""},_=Bn[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,A=y.split("-").map(Number),b=S.split("-").map(Number),E=null,I=null;A.length>0&&(E=Tn[A[0]]),b.length>0&&(I=Bn[b[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<A.length;C++)(null==E?void 0:E.subsections)&&(E=E.subsections[A[C]]);for(C=1;C<b.length;C++)(null==I?void 0:I.subsections)&&(I=I.subsections[b[C]]);E&&(m=e.__assign(e.__assign({},E),{title:T||E.title})),console.log("Base Section for Subsection Badge:",m),I&&(_=e.__assign(e.__assign({},I),{title:B||I.title})),console.log("Ref Section for Subsection Badge:",_)}var D=!(null===(l=m.cognitiveData)||void 0===l?void 0:l.isMissingRationale)||Boolean(null===(s=null===(c=m.cognitiveData)||void 0===c?void 0:c.decisioning)||void 0===s?void 0:s.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&&(tn.open&&an===t.id?pn():(gn(t.id),ct(ut(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(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:tn.open&&an===t.id?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))}))]},t.id)}return null}),Be.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){Ne.current[u]=e},d:o,fill:"none",stroke:"#FFFFFF",strokeWidth:"4",strokeOpacity:"0.7"}),n.jsx("path",{ref:function(e){Ne.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)"},ee?{flex:1,overflow:"visible"}:{})},{children:[n.jsx(i.Box,e.__assign({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:n.jsx(i.Tooltip,e.__assign({title:Sn,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:Sn}))}))})),n.jsxs(i.Box,e.__assign({ref:Qe,onScroll:Nt,sx:e.__assign({p:"12px",display:"flex",flexDirection:"column"},ee?{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:Xe,style:{width:"100%",height:"0px",flexShrink:0}}),Nn&&Tn.map(function(t,r){var l,c,a=!t.title&&!t.content;if(ee&&a)return null;var s=t,d=Et(r,"left"),v=ee?!(null===(l=s.refIndexes)||void 0===l?void 0:l.length)||s.selfIndex<0:!Bn[r],f=ee?"number"==typeof s.selfIndex&&s.selfIndex>=0?s.selfIndex+1:null:r+1,p=Ee.has(r),h=u.extractDeviationScore(s.evaluationResult,null==d?void 0:d.deviationLabel);return n.jsx(i.Box,e.__assign({ref:Wn(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:kn.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:Wn("left-accordion-".concat(r)),mb:0,treeData:H,proposedSections:Tn,existingSections:Bn,deviationNumberRegistry:On,getSectionCompareStyle:Et,getBadgeRef:Kn,connectedSections:Ee,openMoreFunctionsPopup:at,openSummaryPopup:Pt,deviationNodeIdToView:Q,deviationTargetParentId:Gt,parentNodeId:(null===(c=null==H?void 0:H.input_index_map)||void 0===c?void 0:c[0])||"",isExpanded:ee?!!it["left-".concat(r)]:!!it[String(r)],onToggle:function(){kt(),lt(r,"left")},navigation:t.id?Vt[t.id]:null,showOpenNodeRef:Ht,resolvedMarkdownStyles:qe,maintainRelativeOrder:ee,renderSubSections:Wt})})),ee&&d&&n.jsxs(i.Box,e.__assign({ref:Ln.current[r],onClick:function(e){var n=ee?Bn.find(function(e){var n;return null===(n=s.refIndexes)||void 0===n?void 0:n.includes(e.selfIndex)})||{title:"",content:""}:Bn[r]||{title:"",content:""};at(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!=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(g.default,{color:d.badgeText})})),n.jsx(o.EllipsisVertical,{size:11,color:d.badgeText})]}))]}))}),"left-row-".concat(r))}),n.jsx("div",{ref:Je,style:{width:"100%",height:"0px",flexShrink:0}})]}))]})),n.jsx(i.Box,e.__assign({ref:gt,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(),tn.open&&an===Qn?pn():(gn(Qn),ct(ut(n.currentTarget,{title:"",content:"",evaluationResult:Zn,cognitiveData:{section_id:"",decisioning:[],gap:[],relevance_score:0,isMissingRationale:!0}},null,Qn,!0,e.__assign(e.__assign({},et),{label:""}))))},sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:"5px",top:"-5px",borderRadius:"20px",bgcolor:et.badgeBg,color:et.badgeText,border:"1px solid ".concat(et.badgeBorder),fontSize:"12px",fontWeight:600,whiteSpace:"nowrap",position:"relative",zIndex:1,pointerEvents:"auto",cursor:"pointer"}},{children:[null!=$n?$n: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:tn.open&&an===Qn?"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},ee?{flex:1,overflow:"visible",minHeight:0}:{})},{children:[le&&n.jsx(l.default,{sections:11}),n.jsx(i.Box,e.__assign({ref:xt,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:An,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:An}))}))})),n.jsxs(i.Box,e.__assign({ref:Ye,onScroll:Nt,sx:e.__assign({p:"12px",display:"flex",flexDirection:"column"},ee?{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:Ke,style:{width:"100%",height:"0px",flexShrink:0}}),Nn&&Bn.map(function(t,o){var r,l=t,u=[],c=!1,a=null,s=-1;if(ee){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}),s=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 Ee.has(n)&&(null===(t=e.refIndexes)||void 0===t?void 0:t.includes(l.selfIndex))});(c=-1!==d)&&(a=Et(d))}else u=[o+1],(c=Ee.has(o))&&(a=Et(o));var v=Et(ee&&-1!==s?s: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:Mn.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:Wn("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:ee?!!it["right-".concat(o)]:!!it[String(o)],treeData:H,proposedSections:Tn,existingSections:Bn,deviationNumberRegistry:On,getBadgeRef:Kn,getSectionCompareStyle:Et,connectedSections:Ee,openMoreFunctionsPopup:at,openSummaryPopup:Pt,deviationNodeIdToView:Q,deviationTargetParentId:Gt,onToggle:function(){kt(),lt(o,"right")},navigation:t.id?Vt[t.id]:null,showOpenNodeRef:Ht,resolvedMarkdownStyles:qe,maintainRelativeOrder:ee,renderSubSections:Wt})})),ee&&v&&n.jsx(i.Box,e.__assign({ref:Vn.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:Ue,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"),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(A){var b,E,I,T,B,C,D,O,w,N,j,P,F,k,M,L=A.componentHeaderText,V=void 0===L?a.DEFAULT_COMPONENT_HEADER_TEXT:L,H=A.treeData,G=A.comparisonConfig,q=A.leftColumnTitleText,z=A.rightColumnTitleText,W=A.markdownStyles,Y=A.displayConfig,K=void 0===Y?{isHeaderVisible:!0,isToggleVisible:!0,maintainRelativeOrder:!1,isLoading:!0}:Y,U=A.popupConfig,X=A.deviationData,J=void 0===X?{}:X,Q=A.deviationNodeIdToView,Z=A.resetDeviationNodeId,$=t.useState(K.maintainRelativeOrder),ee=$[0],ne=$[1],te=t.useState(!1),ie=te[0],oe=te[1],re=t.useState(!1),le=re[0],ue=re[1],ce=t.useState(null),ae=ce[0],se=ce[1],de=t.useState(!1),ve=de[0],ge=de[1],fe=t.useState(!1),pe=fe[0],he=fe[1],xe=t.useState(!1),me=xe[0],_e=xe[1],Re=t.useState(null),ye=Re[0],Se=Re[1],Ae=t.useRef(!1),be=t.useState(new Set),Ee=be[0],Ie=be[1],Te=t.useState([]),Be=Te[0],Ce=Te[1],De=t.useRef(null),Oe=t.useRef(!1),we=t.useRef(null),Ne=t.useRef({}),je=t.useRef([]),Pe=t.useRef(!1),Fe=t.useRef(!1),ke=t.useRef(null),Me=t.useRef(function(){}),Le=t.useMemo(function(){return(null==H?void 0:H.cognitive_decisioning)||{}},[H]),Ve=t.useState({width:0,height:0}),He=Ve[0],Ge=Ve[1],qe=t.useMemo(function(){return e.__assign(e.__assign({},c.SHARED_MARKDOWN_STYLES),W)},[W]),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(null),Ze=t.useRef(!1),$e=t.useRef(null),en=t.useRef(null),nn=p.useComparePopups(ze),tn=nn.cognitivePopup,on=nn.setCognitivePopup,rn=nn.moreFunctions,ln=nn.setMoreFunctions,un=nn.position,cn=nn.setPosition,an=nn.activeBadgeId,sn=nn.summaryPopup,dn=nn.setSummaryPopup,vn=nn.closeSummaryPopup,gn=nn.setActiveBadgeId,fn=nn.popupRef,pn=nn.closeCognitivePopup,hn=nn.closeMoreFunctionsPopup,xn=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]),mn=t.useState(null),_n=mn[0];mn[1];var Rn=null===(I=null===(b=null==H?void 0:H.documents)||void 0===b?void 0:b[null===(E=null==H?void 0:H.input_index_map)||void 0===E?void 0:E[0]])||void 0===I?void 0:I.title,yn=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,Sn=u.safeStringify(q||Rn||"Uploaded Contract"),An=u.safeStringify(z||yn||"Reference Template"),bn=f.useCognitiveTreeData(H,ee,J,xn),En=bn.activeProposed,In=bn.existingRule,Tn=bn.proposedSections,Bn=bn.existingSections,Cn=bn.visibleFields,Dn=bn.parentDeviationRecord,On=bn.deviationNumberRegistry,wn=bn.parseError;t.useEffect(function(){wn&&se("Failed to load comparison: ".concat(wn))},[wn]);var Nn=Tn.length>0||Bn.length>0,jn=h.useSectionRefs(Cn.map(function(e){return e.key}),Math.max(Tn.length,Bn.length)),Pn=jn.leftRefs,Fn=jn.rightRefs,kn=jn.sectionLeftRefs,Mn=jn.sectionRightRefs,Ln=jn.lhsBadgeRefs,Vn=jn.rhsBadgeRefs,Hn=jn.sectionRightRowRefs,Gn=jn.subSectionLeftRefs,qn=jn.subSectionRightRefs,zn=jn.sectionRowRefs,Wn=jn.getSectionRowRef,Yn=jn.getSubSectionRef,Kn=jn.getBadgeRef,Un=In.analysis,Xn=u.safeStringify(null===(O=null===(D=null==Un?void 0:Un.rule_difference_comparison)||void 0===D?void 0:D.summary)||void 0===O?void 0:O.overall_summary),Jn=!!Xn.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),Qn=null!==(w=null==H?void 0:H.base_root_id)&&void 0!==w?w:"-1";null==H||H[Qn];var Zn=(null===(N=null==J?void 0:J[Qn])||void 0===N?void 0:N.evaluation_result)||(null===(P=null===(j=null==H?void 0:H.nodes)||void 0===j?void 0:j[Qn])||void 0===P?void 0:P.evaluation_result)||null,$n=u.extractDeviationScore(Zn),et=u.generateColorPalette(null!==(M=null===(k=null===(F=null==Zn?void 0:Zn.evaluation_outputs)||void 0===F?void 0:F.metadata)||void 0===k?void 0:k.label_color)&&void 0!==M?M:""),nt=t.useCallback(function(){var e,n,t,i,o,r;ge(!1),Fe.current=!1;var l=ke.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=Gn.current[a[2]])||void 0===e?void 0:e.current)||(null===(n=kn.current[Number(a[2])])||void 0===n?void 0:n.current))&&(s.style.paddingTop="0px")}else{var s;(s=null===(t=kn.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=qn.current[a[3]])||void 0===i?void 0:i.current)||(null===(o=Mn.current[Number(a[3])])||void 0===o?void 0:o.current))&&(d.style.paddingTop="0px")}else{var d;(d=null===(r=Mn.current[c])||void 0===r?void 0:r.current)&&(d.style.paddingTop="0px")}Se(null),ke.current=null,ft.current=null,he(!1),ue(!1),Ke.current&&(Ke.current.style.height="0px"),Ue.current&&(Ue.current.style.height="0px"),Xe.current&&(Xe.current.style.height="0px"),Je.current&&(Je.current.style.height="0px")},[]),tt=x.useAccordionState({maintainRelativeOrder:!!ee,proposedSections:Tn,existingSections:Bn,activeSideBySideSection:ye,connectedSections:Ee,resetSideBySide:nt,setConnectedSections:Ie,setConnectedLines:Ce,cachedConnectedPositions:je,svgContainerRef:De,isAnimatingRef:Oe,animationTimerRef:we,calculateLinesRef:Me,sectionLeftRefs:kn,sectionRightRefs:Mn,subSectionLeftRefs:Gn,subSectionRightRefs:qn}),it=tt.expandedSections,ot=tt.expandedSubSections,rt=tt.setExpandedSubSections,lt=tt.toggleSection,ut=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?Le[d]:null)||(null==n?void 0:n.cognitiveData)||(null==t?void 0:t.cognitiveData)||{section_id:d,decisioning:[],gap:[],relevance_score:0},g=null!==(a=null===(c=zn.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:g,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}},[Le,H]),ct=t.useCallback(function(e){hn(),cn(null),on(e)},[hn]),at=function(e,n,t,i,o,r){var l;if(e.stopPropagation(),rn.open&&rn.sectionIdx===o)hn();else{var c=e.currentTarget,a="left";(null===(l=Ye.current)||void 0===l?void 0:l.contains(c))&&(a="right");Fe.current&&nt(),Ie(new Set),Ce([]),je.current=[],pn(),sn.open?kt():vn(),requestAnimationFrame(function(){var e=function(){var e,n,t,i;if("string"==typeof o&&o.includes(u.DEVIATION_BADGE_SEPARATOR)){var r=o.split(u.DEVIATION_BADGE_SEPARATOR),l="".concat(r[0]).concat(u.DEVIATION_BADGE_SEPARATOR).concat(r[1]);return"right"===a?null===(e=Vn.current[l])||void 0===e?void 0:e.current:null===(n=Ln.current[l])||void 0===n?void 0:n.current}return"right"===a?null===(t=Vn.current[o])||void 0===t?void 0:t.current:null===(i=Ln.current[o])||void 0===i?void 0:i.current}()||c;ln(ut(e,n,i,o,t,r))})}},st=t.useCallback(function(){null!==rn.sectionIdx&&rn.anchorEl?ct(e.__assign(e.__assign({},rn),{open:!0})):hn()},[rn,hn,ct]),dt=t.useCallback(function(){var e=rn.sectionIdx,n=rn.isOrphan;hn(),vn(),null!==e&&(n?se("No counterpart exists to connect to."):(Fe.current&&nt(),Ce([]),je.current=[],Ie(function(n){return n.has(e)?new Set:new Set([e])}),setTimeout(function(){Me.current&&Me.current()},50)))},[rn.sectionIdx,rn.isOrphan,hn,vn,nt]),vt=t.useRef(null),gt=t.useRef(null),ft=t.useRef(null),pt=t.useRef(null),ht=t.useRef(null),xt=t.useRef(null),mt=t.useState([]),_t=mt[0],Rt=mt[1];t.useRef(null);var yt=t.useState(null),St=yt[0],At=yt[1];t.useEffect(function(){if(_n){var e=xn.fields.find(function(e){return e.analysisKey===_n||e.key===_n});if(e){var n=Pn.current[e.key]||Fn.current[e.key];(null==n?void 0:n.current)&&setTimeout(function(){return n.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[_n,xn.fields]);var bt=t.useCallback(function(e){var n,t,i,o,r,l,u,c,a,s=null===(n=null==Un?void 0:Un.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 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===(a=d.highlights)||void 0===a?void 0:a.ruleB_spans)||[],hasContent:!!v}},[Un]),Et=t.useCallback(function(n,t){var i,o,r,l,c,s,d;void 0===t&&(t="left");var v=null,g=null;if("left"===t)if(v=Tn[n],ee&&v){var f=Bn.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=Bn[n];else if(g=Bn[n],ee&&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(a.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!==(s=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!==s?s:a.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,Bn,Le,xn,ee]),It=t.useCallback(function(n){for(var t,i,o,r,l,c,s,d,v,g=n.split("-").map(Number),f=Tn[g[0]],p=Bn[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(a.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=Le[_])||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,A=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(A)),{label:null!=S?S:""}):e.__assign(e.__assign({},u.generateColorPalette(A)),{label:null})},[Tn,Bn,Le,xn]),Tt=t.useCallback(function(){var e,n,t,i,o,r,l,c,a,s,d,v,g,f,p,h,x,m,_,R,y,S;if(!Ze.current&&!Oe.current){Ze.current=!0;try{if(!vt.current)return;var A=function(e){var n=e.split("-"),t=n[0];if(!it[t]&&!1===ee)return!1;if(ee&&!it["left-".concat(t)]&&!it["right-".concat(t)]&&!it[t])return!1;for(var i=t,o=1;o<n.length-1;o++)if(i+="-".concat(n[o]),!ot[i])return!1;return!0},b=vt.current.getBoundingClientRect();Ge({width:b.width,height:b.height});var E=[];if(Cn.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=Fn.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")}),!Oe.current){for(var I=0;I<Math.max(Tn.length,Bn.length);I++){var T=null===(e=kn.current[I])||void 0===e?void 0:e.current,B=null===(n=Mn.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")}ee||Object.keys(Gn.current).forEach(function(e){var n,t;if(A(e)){var i=null===(n=Gn.current[e])||void 0===n?void 0:n.current,o=null===(t=qn.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={};Cn.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=Fn.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(!Oe.current)if(ee){if(ve&&null!==ye)if("number"==typeof ye){var w=ye,N=Tn[w],j=null===(o=kn.current[w])||void 0===o?void 0:o.current;j&&N&&(N.refIndexes||[]).forEach(function(e){var n,t=Bn.findIndex(function(n){return n.selfIndex===e}),i=null===(n=Mn.current[t])||void 0===n?void 0:n.current;if(i&&(it["left-".concat(w)]||it["right-".concat(t)])){var o=Math.max(j.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 P=ye.split(u.DEVIATION_BADGE_SEPARATOR)[2];if(P){T=null===(r=Gn.current[P])||void 0===r?void 0:r.current,B=null===(l=qn.current[P])||void 0===l?void 0:l.current;if(T&&B){F=Math.max(T.getBoundingClientRect().height,B.getBoundingClientRect().height);O[P]=Math.max(O[P]||0,F)}}}}else{Object.keys(Gn.current).forEach(function(e){var n,t;if(A(e)){var i=null===(n=Gn.current[e])||void 0===n?void 0:n.current,o=null===(t=qn.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(Tn.length,Bn.length);I++){var T=null===(t=kn.current[I])||void 0===t?void 0:t.current,B=null===(i=Mn.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(Cn.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=Fn.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")}}),Oe.current||(Object.entries(D.left).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.entries(D.right).forEach(function(e){var n,t=e[0],i=e[1],o=null===(n=Mn.current[Number(t)])||void 0===n?void 0:n.current;o&&(o.style.minHeight="".concat(i,"px"))}),ee||Object.keys(O).forEach(function(e){var n,t,i=null===(n=Gn.current[e])||void 0===n?void 0:n.current,o=null===(t=qn.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")}})),ee)Tn.forEach(function(e,n){var t;(null===(t=kn.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=Bn.findIndex(function(n){return n.selfIndex===e});if(-1!==v){var g=null===(t=Ln.current[n])||void 0===t?void 0:t.current,f=null===(i=Vn.current[v])||void 0===i?void 0:i.current;if(g&&f){var p=g.getBoundingClientRect(),h=f.getBoundingClientRect(),x=p.right-b.left,m=h.left-b.left,_=p.top+p.height/2-b.top,R=h.top+h.height/2-b.top;if(ve&&ye===n){var y=null!==(r=null===(o=Qe.current)||void 0===o?void 0:o.getBoundingClientRect().top)&&void 0!==r?r:0,S=null!==(u=null===(l=Ye.current)||void 0===l?void 0:l.getBoundingClientRect().top)&&void 0!==u?u:0,A=y+(null!==(a=null===(c=Qe.current)||void 0===c?void 0:c.clientHeight)&&void 0!==a?a:1/0),I=S+(null!==(d=null===(s=Ye.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))};_=C(T,y,A)-b.top,R=C(B,S,I)-b.top}var D=Et(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(I=0;I<Math.min(Tn.length,Bn.length);I++){var k=null===(c=kn.current[I])||void 0===c?void 0:c.current,M=null===(a=Mn.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-b.top,G=(null===(s=Bn[I])||void 0===s?void 0:s.id)||"sec-".concat(I);(J=Et(I))&&E.push({id:G,x1:L.right-b.left,y1:H,x2:V.left-b.left,y2:H,style:J,sectionIdx:I,hasCognitive:!!((null===(d=Tn[I])||void 0===d?void 0:d.cognitiveData)||(null===(v=Bn[I])||void 0===v?void 0:v.cognitiveData)||G&&Le[G]),isSubSection:!1})}}Object.keys(Gn.current).forEach(function(e){var n,t,i,o,r,l;if(A(e)){var c=null===(n=Gn.current[e])||void 0===n?void 0:n.current,a=null===(t=qn.current[e])||void 0===t?void 0:t.current;if(c&&a){for(var s=e.split("-").map(Number),d=Tn[s[0]],v=Bn[s[0]],g=1;g<s.length;g++)(null==d?void 0:d.subsections)&&(d=d.subsections[s[g]]),(null==v?void 0:v.subsections)&&(v=v.subsections[s[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(),_=a.getBoundingClientRect(),R=Math.max(m.top,_.top)+16-b.top,y=It(e);y&&"Not Defined"!==y.label&&E.push({id:"subsec-".concat(e),x1:m.right-b.left,y1:R,x2:_.left-b.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(ve&&"string"==typeof ye&&ye.includes(u.DEVIATION_BADGE_SEPARATOR)){var q=ye.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=Ln.current[K])||void 0===g?void 0:g.current,X=null===(f=Vn.current[K])||void 0===f?void 0:f.current;if(U&&X){var J,Q=U.getBoundingClientRect(),Z=X.getBoundingClientRect(),$=Q.right-b.left,ne=Z.left-b.left,te=Q.top+Q.height/2-b.top,ie=Z.top+Z.height/2-b.top;if(ee){var oe=null!==(h=null===(p=Qe.current)||void 0===p?void 0:p.getBoundingClientRect().top)&&void 0!==h?h:0,re=null!==(m=null===(x=Ye.current)||void 0===x?void 0:x.getBoundingClientRect().top)&&void 0!==m?m:0,le=oe+(null!==(R=null===(_=Qe.current)||void 0===_?void 0:_.clientHeight)&&void 0!==R?R:1/0),ue=re+(null!==(S=null===(y=Ye.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)-b.top,ie=ce(Z.top+Z.height/2,re,ue)-b.top}(J=It(Y))&&E.push({id:"line-subsec-".concat(K),x1:$,y1:te,x2:ne,y2:ie,style:J,sectionIdx:Number(Y.split("-")[0]),isSubSection:!0,subSectionKeyPath:ye})}}if(Rt(E),ht.current&&xt.current){var ae=ht.current.getBoundingClientRect(),se=xt.current.getBoundingClientRect(),de=(ae.top+ae.height/2-b.top+se.top+se.height/2-b.top)/2;At({x1:ae.right-b.left,x2:se.left-b.left,y:de})}else At(null);if(Ee.size>0){var ge=[],fe=Qe.current,pe=Ye.current;if(fe&&pe){var he=[],xe=fe.getBoundingClientRect().top,me=pe.getBoundingClientRect().top,_e=xe+fe.clientHeight,Re=me+pe.clientHeight,Se=fe.scrollTop,Ae=pe.scrollTop,be=b.top,Ie=function(e,n,t){return Math.max(n,Math.min(t,e))};Ee.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=Ln.current[d])||void 0===n?void 0:n.current,g=null===(t=Vn.current[d])||void 0===t?void 0:t.current;if(!v||!g)return;var f=v.getBoundingClientRect(),p=g.getBoundingClientRect(),h=It(s),x=(j=f.right-b.left)+.5*((P=p.left-b.left-0)-j),m=f.top+f.height/2,_=p.top+p.height/2,R=m-xe+Se,y=_-me+Ae,S="conn-subsec-".concat(d);he.push({lhsScrollY:R,rhsScrollY:y,x1:j,x2:P,containerTop:be,leftIdx:e,rhsArrayIdx:e,styleColor:(null==h?void 0:h.badgeBorder)||"#6366F1",styleId:S});var A=Ie(m,xe,_e),E=Ie(_,me,Re),I=A-be,T=E-be,B=_>=me-4&&_<=Re+4,C="";C=(F=m>=xe-4&&m<=_e+4)&&B?u.getBentArrowPath(j,I,P,T):F&&!B?"M ".concat(j,",").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(P,",").concat(T):"M ".concat(x,",").concat(I," L ").concat(x,",").concat(T),ge.push({id:S,pathD:C,style:h,leftIdx:e,rhsArrayIdx:e})}else if(ee){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=Bn.findIndex(function(n){return n.selfIndex===e});if(-1!==i){var o=null===(n=Ln.current[D])||void 0===n?void 0:n.current,r=null===(t=Vn.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=o.getBoundingClientRect(),c=r.getBoundingClientRect(),a=Et(D),s=l.right-b.left,d=c.left-b.left-0,v=s+.5*(d-s),g=l.top+l.height/2,f=c.top+c.height/2,p=g-xe+Se,h=f-me+Ae,x="conn-".concat(D,"-").concat(i);he.push({lhsScrollY:p,rhsScrollY:h,x1:s,x2:d,containerTop:be,leftIdx:D,rhsArrayIdx:i,styleColor:(null==a?void 0:a.badgeBorder)||"#6366F1",styleId:x});var m=Ie(g,xe,_e),_=Ie(f,me,Re),R=m-be,y=_-be,S=g>=xe-4&&g<=_e+4,A=f>=me-4&&f<=Re+4,E="";E=S&&A?u.getBentArrowPath(s,R,d,y):S&&!A?"M ".concat(s,",").concat(R," L ").concat(v,",").concat(R," L ").concat(v,",").concat(y):!S&&A?"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:a,leftIdx:D,rhsArrayIdx:i})}}})}else{var w=e,N=w;v=null===(i=Ln.current[w])||void 0===i?void 0:i.current,g=null===(o=Vn.current[N])||void 0===o?void 0:o.current;if(!v||!g)return;var j,P;f=v.getBoundingClientRect(),p=g.getBoundingClientRect(),h=Et(w),x=(j=f.right-b.left)+.5*((P=p.left-b.left-0)-j),m=f.top+f.height/2,_=p.top+p.height/2,R=m-xe+Se,y=_-me+Ae,S="conn-".concat(w,"-").concat(N);he.push({lhsScrollY:R,rhsScrollY:y,x1:j,x2:P,containerTop:be,leftIdx:w,rhsArrayIdx:N,styleColor:(null==h?void 0:h.badgeBorder)||"#6366F1",styleId:S});var F;A=Ie(m,xe,_e),E=Ie(_,me,Re),I=A-be,T=E-be,B=_>=me-4&&_<=Re+4,C="";C=(F=m>=xe-4&&m<=_e+4)&&B?u.getBentArrowPath(j,I,P,T):F&&!B?"M ".concat(j,",").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(P,",").concat(T):"M ".concat(x,",").concat(I," L ").concat(x,",").concat(T),ge.push({id:S,pathD:C,style:h,leftIdx:w,rhsArrayIdx:N})}}),je.current=he}Ce(ge)}else Ce([]),je.current=[]}catch(e){console.error("Line render safe fail: ",e)}finally{Ze.current=!1}}},[Cn,Tn,Bn,Le,xn,bt,Et,ee,ve,ye,Ee,it,ot]),Bt=t.useCallback(function(){var e,n,t,i,o,r,l,c,a,s,d,v,g,f,p=je.current;if(p.length&&!Oe.current){var h=null!==(n=null===(e=Qe.current)||void 0===e?void 0:e.scrollTop)&&void 0!==n?n:0,x=null!==(i=null===(t=Ye.current)||void 0===t?void 0:t.scrollTop)&&void 0!==i?i:0,m=null!==(r=null===(o=Qe.current)||void 0===o?void 0:o.clientHeight)&&void 0!==r?r:1/0,_=null!==(c=null===(l=Ye.current)||void 0===l?void 0:l.clientHeight)&&void 0!==c?c:1/0,R=null!==(s=null===(a=Qe.current)||void 0===a?void 0:a.getBoundingClientRect().top)&&void 0!==s?s:0,y=null!==(v=null===(d=Ye.current)||void 0===d?void 0:d.getBoundingClientRect().top)&&void 0!==v?v:0,S=R+m,A=y+_,b=null!==(f=null===(g=vt.current)||void 0===g?void 0:g.getBoundingClientRect().top)&&void 0!==f?f: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=Ne.current[e.styleId+"-stroke"],o=Ne.current[e.styleId+"-bg"];if(i||o){var r,l=E(n,R,S),c=E(t,y,A),a=l-b,s=c-b,d=n>=R-4&&n<=S+4,v=t>=y-4&&t<=A+4,g=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(g,",").concat(a," L ").concat(g,",").concat(s):!d&&v?"M ".concat(g,",").concat(a," L ").concat(g,",").concat(s," L ").concat(e.x2,",").concat(s):"M ".concat(g,",").concat(a," L ").concat(g,",").concat(s),i&&(i.setAttribute("visibility","visible"),i.setAttribute("d",r)),o&&(o.setAttribute("visibility","visible"),o.setAttribute("d",r))}})}},[]);t.useEffect(function(){Me.current=Tt},[Tt]);var Ct=t.useRef(null),Dt=t.useRef(null),Ot=t.useCallback(function(){je.current.length>0&&!Oe.current||(null!==Ct.current&&clearTimeout(Ct.current),Ct.current=setTimeout(function(){Me.current(),Ct.current=null},50))},[]),wt=t.useCallback(function(){_e(!0),he(!1),null!==Dt.current&&clearTimeout(Dt.current),null!==Ct.current&&(clearTimeout(Ct.current),Ct.current=null),Dt.current=setTimeout(function(){var e,n,t,i,o,r,l,c,a,s;if(je.current=[],Fe.current&&null!==ke.current&&null!==ft.current){var d=ke.current,v=ft.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=Ln.current[m])||void 0===e?void 0:e.current)||null,f=(null===(n=Vn.current[m])||void 0===n?void 0:n.current)||null,p=(null===(t=Gn.current[x[2]])||void 0===t?void 0:t.current)||(null===(i=kn.current[Number(x[2])])||void 0===i?void 0:i.current)||null,h=(null===(o=qn.current[x[3]])||void 0===o?void 0:o.current)||(null===(r=Mn.current[Number(x[3])])||void 0===r?void 0:r.current)||null}else g=(null===(l=zn.current[d])||void 0===l?void 0:l.current)||null,p=(null===(c=kn.current[d])||void 0===c?void 0:c.current)||null,f=(null===(a=Hn.current[v])||void 0===a?void 0:a.current)||null,h=(null===(s=Mn.current[v])||void 0===s?void 0:s.current)||null;if(g&&f&&p&&h){if(p.style.paddingTop="0px",h.style.paddingTop="0px",!ee){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=Qe.current,A=Ye.current;if(S&&A){var b=g.getBoundingClientRect().top-S.getBoundingClientRect().top+S.scrollTop,E=f.getBoundingClientRect().top-A.getBoundingClientRect().top+A.scrollTop-(b-S.scrollTop);Math.abs(A.scrollTop-E)>1&&(A.scrollTop=E)}}}Me.current(),Fe.current&&he(!0),_e(!1),Dt.current=null},150)},[ee,Tn,Bn]),Nt=t.useCallback(function(e){var n,t,i,o,r,l,c,a,s,d;if(null!==$e.current&&en.current&&Math.abs(e.currentTarget.scrollTop-$e.current)<=2){var v=en.current;$e.current=null,en.current=null,v()}if(!Ae.current){if(ee||Ot(),Fe.current){var g=ke.current,f=ft.current,p=Qe.current,h=Ye.current;if(null!==g&&null!==f&&p&&h){var x="string"==typeof g&&g.includes(u.DEVIATION_BADGE_SEPARATOR)?null===(n=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===n?void 0:n.current:null===(t=zn.current[g])||void 0===t?void 0:t.current,m="string"==typeof f&&f.includes(u.DEVIATION_BADGE_SEPARATOR)?null===(i=Vn.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&&pt.current){var _=void 0,R=void 0;if("string"==typeof g&&g.includes(u.DEVIATION_BADGE_SEPARATOR)){var y=g.split(u.DEVIATION_BADGE_SEPARATOR),S="".concat(y[0]).concat(u.DEVIATION_BADGE_SEPARATOR).concat(y[1]);_=null===(r=Ln.current[S])||void 0===r?void 0:r.current,R=null===(l=Vn.current[S])||void 0===l?void 0:l.current}else _=null===(c=Ln.current[g])||void 0===c?void 0:c.current,R=null===(a=Vn.current[f])||void 0===a?void 0:a.current;var A=null!==(d=null===(s=vt.current)||void 0===s?void 0:s.getBoundingClientRect().top)&&void 0!==d?d:0,b=p.getBoundingClientRect().top,E=b+p.clientHeight;h.getBoundingClientRect().top;h.clientHeight;if(_&&R){var I=_.getBoundingClientRect(),T=R.getBoundingClientRect(),B=I.top+I.height/2;T.top,T.height;var C=((O=B,w=b,N=E,Math.max(w,Math.min(N,O)))-A).toString();pt.current.setAttribute("y1",C),pt.current.setAttribute("y2",C);var D=B>=b-4&&B<=E+4;pt.current.setAttribute("visibility",D?"visible":"hidden")}}}}var O,w,N;je.current.length>0&&!Pe.current&&(Pe.current=!0,requestAnimationFrame(function(){Bt(),Pe.current=!1}))}},[Bt,ee,Ot]);t.useEffect(function(){var e=setTimeout(Ot,250);window.addEventListener("resize",wt);var n=null,t=null;return ze.current&&(n=new ResizeObserver(Ot)).observe(ze.current),vt.current&&(t=new ResizeObserver(Ot)).observe(vt.current),function(){clearTimeout(e),null!==Ct.current&&clearTimeout(Ct.current),null!==Dt.current&&clearTimeout(Dt.current),window.removeEventListener("resize",wt),null==n||n.disconnect(),null==t||t.disconnect()}},[En,In,Un,Cn,it,ot,Tn,Bn,xn,Ot,wt,ve,ye,pe,Ee]),t.useEffect(function(){Fe.current=ve},[ve]),t.useEffect(function(){ke.current=ye},[ye]);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";hn(),null!=e&&(n?se("No counterpart exists for this section."):ve&&ye===e?r?nt():null==l||l():(Ie(new Set([e])),Ce([]),je.current=[],ue(!0),Ae.current=!0,Se(e),ke.current=e,ge(!0),Fe.current=!0,he(!1),Ke.current&&(Ke.current.style.height="0px"),Ue.current&&(Ue.current.style.height="0px"),Xe.current&&(Xe.current.style.height="0px"),Je.current&&(Je.current.style.height="0px"),requestAnimationFrame(function(){var n,t,i,o,r,a="string"==typeof e&&e.includes(u.DEVIATION_BADGE_SEPARATOR),s=null,d=null,v=null;if(a){var g=e.split(u.DEVIATION_BADGE_SEPARATOR),f="".concat(g[0]).concat(u.DEVIATION_BADGE_SEPARATOR).concat(g[1]);s=(null===(n=Ln.current[f])||void 0===n?void 0:n.current)||null,d=(null===(t=Vn.current[f])||void 0===t?void 0:t.current)||null,v=d?e:null}else if(s=(null===(i=zn.current[e])||void 0===i?void 0:i.current)||null,ee){var p=Tn[e],h=(null==p?void 0:p.refIndexes)||[];if(h.length>0){var x=h[0],m=Bn.findIndex(function(e){return e.selfIndex===x});-1!==m&&(d=(null===(r=Hn.current[m])||void 0===r?void 0:r.current)||null,v=m)}}else d=(null===(o=Hn.current[e])||void 0===o?void 0:o.current)||null,v=d?e:null;ft.current=v;var _=Qe.current,R=Ye.current,y=function(){!function(){var n,t,i,o,r,l,c,s,d,g,f,p,h=null,x=null,m=null,_=null;if(a){var R=e.split(u.DEVIATION_BADGE_SEPARATOR),y="".concat(R[0]).concat(u.DEVIATION_BADGE_SEPARATOR).concat(R[1]);h=(null===(n=Gn.current[R[2]])||void 0===n?void 0:n.current)||(null===(t=kn.current[Number(R[2])])||void 0===t?void 0:t.current)||null,x=(null===(i=qn.current[R[3]])||void 0===i?void 0:i.current)||(null===(o=Mn.current[Number(R[3])])||void 0===o?void 0:o.current)||null,m=(null===(r=Ln.current[y])||void 0===r?void 0:r.current)||h,_=(null===(l=Vn.current[y])||void 0===l?void 0:l.current)||x}else{var S=Number(e),A=null!==v?Number(v):S;h=(null===(c=kn.current[S])||void 0===c?void 0:c.current)||null,x=(null===(s=Mn.current[A])||void 0===s?void 0:s.current)||null,m=(null===(d=Ln.current[S])||void 0===d?void 0:d.current)||(null===(g=zn.current[S])||void 0===g?void 0:g.current)||h,_=(null===(f=Vn.current[A])||void 0===f?void 0:f.current)||(null===(p=Hn.current[A])||void 0===p?void 0:p.current)||x}if(m&&_&&h&&x){h.style.paddingTop="0px",x.style.paddingTop="0px";var b=m.getBoundingClientRect(),E=_.getBoundingClientRect(),I=b.top-E.top;I>0?x.style.paddingTop="".concat(I,"px"):I<0&&(h.style.paddingTop="".concat(Math.abs(I),"px"))}}(),he(!0),Me.current&&Me.current(),Ae.current=!1,"right"===c&&R?R.dispatchEvent(new Event("scroll")):_&&_.dispatchEvent(new Event("scroll")),ue(!1),null==l||l()};if(!s||!_)return Ae.current=!1,ue(!1),void(null==l||l());if(d&&R){if(!ee){var S=0;S="right"===c?d?d.getBoundingClientRect().top:0:s?s.getBoundingClientRect().top:0;var A=ze.current,b=(null==A?void 0:A.getBoundingClientRect().top)||0,E=A?A.scrollTop+S-b-150:0;return A?void u.smoothScrollTo(A,E,200,y):void y()}var I=s.getBoundingClientRect().top-_.getBoundingClientRect().top+_.scrollTop,T=d.getBoundingClientRect().top-R.getBoundingClientRect().top+R.scrollTop,B=200;if("left"===c){var C=T-(I-_.scrollTop);C<0&&Ke.current&&(Ke.current.style.height="".concat(Math.abs(C),"px")),requestAnimationFrame(function(){var e,n=R.scrollHeight-R.clientHeight;if(C<0)e=0;else{if(C>n){var t=C-n;return Ue.current&&(Ue.current.style.height="".concat(t+150,"px")),void requestAnimationFrame(function(){u.smoothScrollTo(R,C,B,y)})}e=C}u.smoothScrollTo(R,e,B,y)})}else{var D=I-(T-R.scrollTop);D<0&&Xe.current&&(Xe.current.style.height="".concat(Math.abs(D),"px")),requestAnimationFrame(function(){var e,n=_.scrollHeight-_.clientHeight;if(D<0)e=0;else{if(D>n){var t=D-n;return Je.current&&(Je.current.style.height="".concat(t+150,"px")),void requestAnimationFrame(function(){u.smoothScrollTo(_,D,B,y)})}e=D}u.smoothScrollTo(_,e,B,y)})}}else y()})))},[ye,hn,Bn,ve,ee,Tn,nt]),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;pn();var c="left";(null===(o=Ye.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=Vn.current[l])||void 0===e?void 0:e.current:null===(t=Ln.current[l])||void 0===t?void 0:t.current}return"right"===c?null===(i=Vn.current[n])||void 0===i?void 0:i.current:null===(o=Ln.current[n])||void 0===o?void 0:o.current};if(t)return nt(),Ie(new Set),Ce([]),je.current=[],void(r&&requestAnimationFrame(function(){var e=a()||l;dn({open:!0,anchorEl:e,summary:i})}));jt(n,t,r?{toggleIfSame:!1,sourceSide:c,onReady:function(){var e=a()||l;dn({open:!0,anchorEl:e,summary:i})}}:{toggleIfSame:!1,sourceSide:c})},[jt,pn,dn,nt]),Ft=t.useCallback(function(){var e,n=rn.sectionIdx,t=rn.isOrphan;if(vn(),null!=n){var i="left";rn.anchorEl&&(null===(e=Ye.current)||void 0===e?void 0:e.contains(rn.anchorEl))&&(i="right"),jt(n,t,{sourceSide:i})}},[jt,rn.isOrphan,rn.sectionIdx,rn.anchorEl,vn]),kt=t.useCallback(function(){vn(),nt(),Ie(new Set),Ce([]),je.current=[]},[vn,nt]),Mt=null!==rn.sectionIdx&&Ee.has(rn.sectionIdx),Lt=m.useDeviationNavigation({proposedSections:Tn,existingSections:Bn,parentDeviationRecord:Dn,expandedSections:it,maintainRelativeOrder:!!ee,scrollContainerRef:ze,leftContainerRef:Qe,lhsBadgeRefs:Ln,rhsBadgeRefs:Vn}),Vt=Lt.showDeviationNavigation,Ht=Lt.showOpenNodeRef,Gt=t.useMemo(function(){if(!Q)return null;for(var e in Dn){if((Dn[e]||[]).some(function(e){return e.id===Q}))return e}return null},[Q,Dn]),qt=t.useRef(null),zt=t.useRef(null);t.useEffect(function(){if(Q&&qt.current!==Q){zt.current!==Q&&(vn(),pn(),nt(),Ie(new Set),Ce([]),je.current=[],zt.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,g=null;for(var f in Dn){var p=Dn[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}),x=Bn.findIndex(function(e){return e.id===v}),m=-1===h&&-1!==x,_=r(Tn,g.id),R=r(Bn,g.id);if(_&&!R&&!m){var y=_.split("-"),S=Number(y[0]);if(ee){var A=null===(a=null===(c=Tn[S])||void 0===c?void 0:c.refIndexes)||void 0===a?void 0:a[0],b=Bn.findIndex(function(e){return e.selfIndex===A});-1!==b&&(S=b)}R=e.__spreadArray([S],y.slice(1),!0).join("-")}if(_||R){var E=m||!_&&!!R,I=_?Number(_.split("-")[0]):h,T=R?Number(R.split("-")[0]):x;if(E){if(!(ee?!!it["right-".concat(T)]:!!it[String(T)])&&T>=0)return lt(T,"right"),t+=1,void(i=setTimeout(l,450))}else if(!(ee?!!it["left-".concat(I)]:!!it[String(I)])&&I>=0)return lt(I,"left"),t+=1,void(i=setTimeout(l,450));var B,C=_||"",D=R||"",O="".concat(g.id).concat(u.DEVIATION_BADGE_SEPARATOR,"0").concat(u.DEVIATION_BADGE_SEPARATOR).concat(C).concat(u.DEVIATION_BADGE_SEPARATOR).concat(D),w="".concat(g.id).concat(u.DEVIATION_BADGE_SEPARATOR,"0"),N=null===(s=Ln.current[w])||void 0===s?void 0:s.current,j=null===(d=Vn.current[w])||void 0===d?void 0:d.current,P=E||!N&&!!j,F=P?j:N;if(B=ee?P?Ye.current:Qe.current:ze.current,F&&B){var k=F.getBoundingClientRect();if(0===k.height)return void((t+=1)<20&&(i=setTimeout(l,o)));var M=B.getBoundingClientRect(),L=k.top-M.top+B.scrollTop-M.height/2+k.height/2,V=function(){var e,t,i,o,r;if(!n){qt.current=Q;var l=window.getComputedStyle(F).color;N&&(N.style.transition="box-shadow 300ms ease-in-out",N.style.boxShadow="0 0 10px ".concat(l)),j&&(j.style.transition="box-shadow 300ms ease-in-out",j.style.boxShadow="0 0 10px ".concat(l)),setTimeout(function(){N&&(N.style.boxShadow=""),j&&(j.style.boxShadow="")},2e3);var u=(null===(t=null===(e=g.evaluationResult)||void 0===e?void 0:e.deviations)||void 0===t?void 0:t[0])||g,c=(null===(i=g.evaluationResult)||void 0===i?void 0:i.evaluation_outputs)||g.evaluation_outputs;if(!(!!N&&!!j)){var a=P?(null===(o=Vn.current[w])||void 0===o?void 0:o.current)||j:(null===(r=Ln.current[w])||void 0===r?void 0:r.current)||N;return dn({open:!0,anchorEl:a,summary:{deviation_summary:u.deviation_summary||u,evaluation_outputs:c}}),void(null==Z||Z())}jt(O,!1,{toggleIfSame:!1,sourceSide:"left",onReady:function(){var e,n=(null===(e=Ln.current[w])||void 0===e?void 0:e.current)||N;dn({open:!0,anchorEl:n,summary:{deviation_summary:u.deviation_summary||u,evaluation_outputs:c}})}})}};Math.abs(B.scrollTop-L)<=2?V():($e.current=L,en.current=V,B.scrollTo({top:L,behavior:"smooth"}),i&&clearTimeout(i),i=setTimeout(function(){if(en.current){$e.current=null;var e=en.current;en.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,Dn,Tn,Bn,ee,it,lt,jt,dn]);var Wt=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:ot,setExpandedSubSections:rt,maintainRelativeOrder:ee||!1,proposedSections:Tn,existingSections:Bn,treeData:H,deviationNumberRegistry:On,connectedSections:Ee,activeSideBySideSection:ye,resolvedMarkdownStyles:qe,getSubSectionRef:Yn,getSubSectionCompareStyle:It,getBadgeRef:Kn,openMoreFunctionsPopup:at,openSummaryPopup:Pt,resetSideBySide:nt,setConnectedSections:Ie,setConnectedLines:Ce,cachedConnectedPositions:je})};return n.jsxs(i.Box,e.__assign({ref:We,sx:e.__assign(e.__assign({display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif'},ee?{}:{overflow:"visible"}),{position:"relative"})},{children:[ie&&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:gt.current,clipTopEl:ht.current,scrollContainerEl:ze.current,onClose:kt,summary:sn.summary}),n.jsx(d.default,{open:rn.open,anchorEl:rn.anchorEl,sectionTitle:rn.sectionTitle,referenceSectionTitle:rn.refSectionTitle,onClose:hn,onOpenCognitiveCompare:st,onOpenSideBySide:Ft,onConnect:dt,isConnected:Mt,isOrphan:rn.isOrphan}),tn.open&&n.jsx(s.default,{open:tn.open,popupRef:fn,position:un,popupConfig:U,onClose:function(){cn(null),on(function(n){return e.__assign(e.__assign({},n),{open:!1})}),gn(null)},markdownStyles:W,sectionTitle:tn.sectionTitle,referenceSectionTitle:tn.refSectionTitle,cognitiveData:tn.cognitiveData,anchorEl:tn.anchorEl,sectionAnchorEl:tn.sectionAnchorEl,scrollContainerEl:ze.current,badgeStyle:tn.badgeStyle,docData:tn.docData,deviationData:tn.deviationData,isLoading:tn.isLoading}),n.jsx(i.Snackbar,e.__assign({open:!!ae,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:ae}))})),n.jsx(_.default,{componentHeaderText:V,displayConfig:K,maintainRelativeOrder:ee,onToggleView:function(e){oe(!0),setTimeout(function(){ne(!e),nt(),vn(),Ie(new Set),Ce([]),je.current=[],requestAnimationFrame(function(){requestAnimationFrame(function(){setTimeout(function(){oe(!1)},600)})})},50)}}),n.jsx(i.Box,e.__assign({ref:ze,onScroll:Nt,sx:{flex:1,minHeight:0,pt:1.5,pb:1,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",overflowY:ee?"hidden":"auto",borderTop:Xn&&Jn?"none":"1.5px solid #EEF0F4"}},{children:n.jsx(i.Box,e.__assign({sx:e.__assign({display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"},ee?{flex:1,minHeight:0}:{})},{children:n.jsxs(i.Box,e.__assign({ref:vt,sx:e.__assign({display:"grid",gridTemplateColumns:"minmax(0, 1fr) 180px minmax(0, 1fr)",gap:"40px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0},ee?{flex:1,overflow:"visible"}:{})},{children:[n.jsxs("svg",e.__assign({ref:De,style:{position:"absolute",top:0,left:0,width:He.width||"100%",height:He.height||"100%",pointerEvents:"none",zIndex:10,overflow:"visible",opacity:me?0:1,transition:"opacity 0.15s ease-in-out"}},{children:[St&&n.jsx("g",{children:n.jsx("line",{x1:St.x1,y1:St.y,x2:St.x2,y2:St.y,stroke:et.badgeBorder,strokeWidth:"1.5"})}),_t.map(function(t){var l,c,s,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?ve&&ye===t.subSectionKeyPath&&pe:ve&&ye===t.sectionIdx&&pe)return null;if(!ee){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:""},_=Bn[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,A=y.split("-").map(Number),b=S.split("-").map(Number),E=null,I=null;A.length>0&&(E=Tn[A[0]]),b.length>0&&(I=Bn[b[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<A.length;C++)(null==E?void 0:E.subsections)&&(E=E.subsections[A[C]]);for(C=1;C<b.length;C++)(null==I?void 0:I.subsections)&&(I=I.subsections[b[C]]);E&&(m=e.__assign(e.__assign({},E),{title:T||E.title})),console.log("Base Section for Subsection Badge:",m),I&&(_=e.__assign(e.__assign({},I),{title:B||I.title})),console.log("Ref Section for Subsection Badge:",_)}var D=!(null===(l=m.cognitiveData)||void 0===l?void 0:l.isMissingRationale)||Boolean(null===(s=null===(c=m.cognitiveData)||void 0===c?void 0:c.decisioning)||void 0===s?void 0:s.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&&(tn.open&&an===t.id?pn():(gn(t.id),ct(ut(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(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:tn.open&&an===t.id?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))}))]},t.id)}return null}),Be.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){Ne.current[u]=e},d:o,fill:"none",stroke:"#FFFFFF",strokeWidth:"4",strokeOpacity:"0.7"}),n.jsx("path",{ref:function(e){Ne.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)"},ee?{flex:1,overflow:"visible"}:{})},{children:[n.jsx(i.Box,e.__assign({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:n.jsx(i.Tooltip,e.__assign({title:Sn,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:Sn}))}))})),n.jsxs(i.Box,e.__assign({ref:Qe,onScroll:Nt,sx:e.__assign({p:"12px",display:"flex",flexDirection:"column"},ee?{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:Xe,style:{width:"100%",height:"0px",flexShrink:0}}),Nn&&Tn.map(function(t,r){var l,c,a=!t.title&&!t.content;if(ee&&a)return null;var s=t,d=Et(r,"left"),v=ee?!(null===(l=s.refIndexes)||void 0===l?void 0:l.length)||s.selfIndex<0:!Bn[r],f=ee?"number"==typeof s.selfIndex&&s.selfIndex>=0?s.selfIndex+1:null:r+1,p=Ee.has(r),h=u.extractDeviationScore(s.evaluationResult,null==d?void 0:d.deviationLabel);return n.jsx(i.Box,e.__assign({ref:Wn(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:kn.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:Wn("left-accordion-".concat(r)),mb:0,treeData:H,proposedSections:Tn,existingSections:Bn,deviationNumberRegistry:On,getSectionCompareStyle:Et,getBadgeRef:Kn,connectedSections:Ee,openMoreFunctionsPopup:at,openSummaryPopup:Pt,deviationNodeIdToView:Q,deviationTargetParentId:Gt,parentNodeId:(null===(c=null==H?void 0:H.input_index_map)||void 0===c?void 0:c[0])||"",isExpanded:ee?!!it["left-".concat(r)]:!!it[String(r)],onToggle:function(){kt(),lt(r,"left")},navigation:t.id?Vt[t.id]:null,showOpenNodeRef:Ht,resolvedMarkdownStyles:qe,maintainRelativeOrder:ee,renderSubSections:Wt})})),ee&&d&&n.jsxs(i.Box,e.__assign({ref:Ln.current[r],onClick:function(e){var n=ee?Bn.find(function(e){var n;return null===(n=s.refIndexes)||void 0===n?void 0:n.includes(e.selfIndex)})||{title:"",content:""}:Bn[r]||{title:"",content:""};at(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!=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(g.default,{color:d.badgeText})})),n.jsx(o.EllipsisVertical,{size:11,color:d.badgeText})]}))]}))}),"left-row-".concat(r))}),n.jsx("div",{ref:Je,style:{width:"100%",height:"0px",flexShrink:0}})]}))]})),n.jsx(i.Box,e.__assign({ref:gt,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(),tn.open&&an===Qn?pn():(gn(Qn),ct(ut(n.currentTarget,{title:"",content:"",evaluationResult:Zn,cognitiveData:{section_id:"",decisioning:[],gap:[],relevance_score:0,isMissingRationale:!0}},null,Qn,!0,e.__assign(e.__assign({},et),{label:""}))))},sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:"5px",top:"-5px",borderRadius:"20px",bgcolor:et.badgeBg,color:et.badgeText,border:"1px solid ".concat(et.badgeBorder),fontSize:"12px",fontWeight:600,whiteSpace:"nowrap",position:"relative",zIndex:1,pointerEvents:"auto",cursor:"pointer"}},{children:[null!=$n?$n: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:tn.open&&an===Qn?"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},ee?{flex:1,overflow:"visible",minHeight:0}:{})},{children:[le&&n.jsx(l.default,{sections:11}),n.jsx(i.Box,e.__assign({ref:xt,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:An,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:An}))}))})),n.jsxs(i.Box,e.__assign({ref:Ye,onScroll:Nt,sx:e.__assign({p:"12px",display:"flex",flexDirection:"column"},ee?{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:Ke,style:{width:"100%",height:"0px",flexShrink:0}}),Nn&&Bn.map(function(t,o){var r,l=t,u=[],c=!1,a=null,s=-1;if(ee){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}),s=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 Ee.has(n)&&(null===(t=e.refIndexes)||void 0===t?void 0:t.includes(l.selfIndex))});(c=-1!==d)&&(a=Et(d))}else u=[o+1],(c=Ee.has(o))&&(a=Et(o));var v=Et(ee&&-1!==s?s: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:Mn.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:Wn("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:ee?!!it["right-".concat(o)]:!!it[String(o)],treeData:H,proposedSections:Tn,existingSections:Bn,deviationNumberRegistry:On,getBadgeRef:Kn,getSectionCompareStyle:Et,connectedSections:Ee,openMoreFunctionsPopup:at,openSummaryPopup:Pt,deviationNodeIdToView:Q,deviationTargetParentId:Gt,onToggle:function(){kt(),lt(o,"right")},navigation:t.id?Vt[t.id]:null,showOpenNodeRef:Ht,resolvedMarkdownStyles:qe,maintainRelativeOrder:ee,renderSubSections:Wt})})),ee&&v&&n.jsx(i.Box,e.__assign({ref:Vn.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:Ue,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"),n=require("react/jsx-runtime"),i=require("react"),o=require("@mui/material"),t=require("lucide-react"),l=require("../hooks/memoizedMarkdown.js"),r=require("../CognitiveComparehelpers.js"),d=require("../CognitiveCompareConstants.js");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=a(i);exports.default=function(a){var u,c,v,f,p,x,g,h,m,_,y,I,b,w,S,A,R=a.section,j=a.idx,E=a.columnKey,C=a.colRef,F=a.mb,k=void 0===F?1:F,O=a.parentNodeId,T=void 0===O?"":O,B=a.isExpanded,D=a.onToggle,M=a.navigation,N=a.showOpenNodeRef,P=a.resolvedMarkdownStyles,V=a.maintainRelativeOrder,W=a.renderSubSections,q=a.treeData,G=a.proposedSections,z=void 0===G?[]:G,K=a.existingSections,L=void 0===K?[]:K,U=a.deviationNumberRegistry,X=void 0===U?{}:U,Y=a.getBadgeRef,H=a.openSummaryPopup,$=a.getSectionCompareStyle,J=a.connectedSections,Q=a.openMoreFunctionsPopup;a.deviationNodeIdToView,a.deviationTargetParentId;var Z=(null===(u=R.displayTitle)||void 0===u||u)&&r.hasValue(R.title),ee=(null===(c=R.displayContent)||void 0===c||c)&&r.hasValue(R.content),ne=!Z&&!ee,ie={current:1},oe=R.title;Z||(oe=ee?"No Title Found":"No Matching Section Found");var te=R.evaluationResult;if(!te&&"right"===E)if(V){var le=null===(v=R.refIndexes)||void 0===v?void 0:v[0],re=z.find(function(e){return e.selfIndex===le});te=null==re?void 0:re.evaluationResult}else te=null===(f=z[j])||void 0===f?void 0:f.evaluationResult;var de=null===(p=null==q?void 0:q.input_index_map)||void 0===p?void 0:p[0],ae=null===(x=null==q?void 0:q.input_index_map)||void 0===x?void 0:x[1],se="left"===E?ae:de,ue="left"===E?R:z[j],ce="right"===E?R:L[j];if(V)if("left"===E){var ve=null===(g=R.refIndexes)||void 0===g?void 0:g[0],fe=L.findIndex(function(e){return e.selfIndex===ve});ce=-1!==fe?L[fe]:void 0}else{var pe=null===(h=R.refIndexes)||void 0===h?void 0:h[0],xe=z.findIndex(function(e){return e.selfIndex===pe});ue=-1!==xe?z[xe]:void 0}var ge="left"===E?!ce:!ue,he=te||(null==ue?void 0:ue.evaluationResult)||(null==ce?void 0:ce.evaluationResult),me=null!==(y=null===(_=null===(m=null==he?void 0:he.evaluation_outputs)||void 0===m?void 0:m.metadata)||void 0===_?void 0:_.label_color)&&void 0!==y?y:d.DEFAULT_DEVIAION_COLOR,_e=r.generateColorPalette(me),ye=_e.highlightBg,Ie=null!==(b=null===(I=null==he?void 0:he.evaluation_outputs)||void 0===I?void 0:I.output_value)&&void 0!==b?b:null,be=(null==he?void 0:he.deviations)||{},we=j+1,Se=R.id;if("right"===E&&V){var Ae=null===(w=R.refIndexes)||void 0===w?void 0:w[0];-1!==(xe=z.findIndex(function(e){return e.selfIndex===Ae}))&&(we=xe+1,Se=z[xe].id)}var Re,je=[],Ee=Object.entries(be).map(function(n){var i,o,t,l,d,a=n[0],s=n[1],u="".concat(Se).concat(r.DEVIATION_BADGE_SEPARATOR).concat(a),c=X[u];if(
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),i=require("react"),o=require("@mui/material"),t=require("lucide-react"),l=require("../hooks/memoizedMarkdown.js"),r=require("../CognitiveComparehelpers.js"),d=require("../CognitiveCompareConstants.js");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=a(i);exports.default=function(a){var u,c,v,f,p,x,g,h,m,_,y,I,b,w,S,A,R=a.section,j=a.idx,E=a.columnKey,C=a.colRef,F=a.mb,k=void 0===F?1:F,O=a.parentNodeId,T=void 0===O?"":O,B=a.isExpanded,D=a.onToggle,M=a.navigation,N=a.showOpenNodeRef,P=a.resolvedMarkdownStyles,V=a.maintainRelativeOrder,W=a.renderSubSections,q=a.treeData,G=a.proposedSections,z=void 0===G?[]:G,K=a.existingSections,L=void 0===K?[]:K,U=a.deviationNumberRegistry,X=void 0===U?{}:U,Y=a.getBadgeRef,H=a.openSummaryPopup,$=a.getSectionCompareStyle,J=a.connectedSections,Q=a.openMoreFunctionsPopup;a.deviationNodeIdToView,a.deviationTargetParentId;var Z=(null===(u=R.displayTitle)||void 0===u||u)&&r.hasValue(R.title),ee=(null===(c=R.displayContent)||void 0===c||c)&&r.hasValue(R.content),ne=!Z&&!ee,ie={current:1},oe=R.title;Z||(oe=ee?"No Title Found":"No Matching Section Found");var te=R.evaluationResult;if(!te&&"right"===E)if(V){var le=null===(v=R.refIndexes)||void 0===v?void 0:v[0],re=z.find(function(e){return e.selfIndex===le});te=null==re?void 0:re.evaluationResult}else te=null===(f=z[j])||void 0===f?void 0:f.evaluationResult;var de=null===(p=null==q?void 0:q.input_index_map)||void 0===p?void 0:p[0],ae=null===(x=null==q?void 0:q.input_index_map)||void 0===x?void 0:x[1],se="left"===E?ae:de,ue="left"===E?R:z[j],ce="right"===E?R:L[j];if(V)if("left"===E){var ve=null===(g=R.refIndexes)||void 0===g?void 0:g[0],fe=L.findIndex(function(e){return e.selfIndex===ve});ce=-1!==fe?L[fe]:void 0}else{var pe=null===(h=R.refIndexes)||void 0===h?void 0:h[0],xe=z.findIndex(function(e){return e.selfIndex===pe});ue=-1!==xe?z[xe]:void 0}var ge="left"===E?!ce:!ue,he=te||(null==ue?void 0:ue.evaluationResult)||(null==ce?void 0:ce.evaluationResult),me=null!==(y=null===(_=null===(m=null==he?void 0:he.evaluation_outputs)||void 0===m?void 0:m.metadata)||void 0===_?void 0:_.label_color)&&void 0!==y?y:d.DEFAULT_DEVIAION_COLOR,_e=r.generateColorPalette(me),ye=_e.highlightBg,Ie=null!==(b=null===(I=null==he?void 0:he.evaluation_outputs)||void 0===I?void 0:I.output_value)&&void 0!==b?b:null,be=(null==he?void 0:he.deviations)||{},we=j+1,Se=R.id;if("right"===E&&V){var Ae=null===(w=R.refIndexes)||void 0===w?void 0:w[0];-1!==(xe=z.findIndex(function(e){return e.selfIndex===Ae}))&&(we=xe+1,Se=z[xe].id)}var Re,je=[],Ee=Object.entries(be).map(function(n){var i,o,t,l,d,a=n[0],s=n[1],u="".concat(Se).concat(r.DEVIATION_BADGE_SEPARATOR).concat(a),c=X[u];if(null==c)return null;var v=s[T],f=r.isMissingStr(v);if(f)v="";else if(!v)return null;je.push(v);var p=j,x=j;if(V)if("left"===E){var g=null===(i=R.refIndexes)||void 0===i?void 0:i[0],h=L.findIndex(function(e){return e.selfIndex===g});x=-1!==h?h:j}else{var m=null===(o=R.refIndexes)||void 0===o?void 0:o[0],_=z.findIndex(function(e){return e.selfIndex===m});p=-1!==_?_:j}var y="".concat(Se).concat(r.DEVIATION_BADGE_SEPARATOR).concat(a).concat(r.DEVIATION_BADGE_SEPARATOR).concat(p).concat(r.DEVIATION_BADGE_SEPARATOR).concat(x),I="left"===E?null===(t=L[x])||void 0===t?void 0:t.content:null===(l=z[p])||void 0===l?void 0:l.content,b=s[se],w=r.safeStringify(I),S=Object.keys(be).map(function(e){return{key:e,text:be[e][se]}}).filter(function(e){return!r.isMissingStr(e.text)}).sort(function(e,n){return n.text.length-e.text.length}),A=new Set;S.forEach(function(e){var n=e.text.replace(/\\(['’])/g,"$1").replace(/\\n/g,"\n");if(n){var i=new RegExp(r.escapeRegExp(n));i.test(w)&&(A.add(e.key),w=w.replace(i,"__TOKEN_".concat(e.key,"__")))}});var C=!r.isMissingStr(b)&&!A.has(a),F=ge||r.isMissingStr(b)||C,k="".concat(we,".").concat(c),O=j;if("right"===E&&V){var B=null===(d=R.refIndexes)||void 0===d?void 0:d[0],D=z.findIndex(function(e){return e.selfIndex===B});-1!==D&&(O=D)}var M=$?$(O):null,N=M?e.__assign(e.__assign({},M),{badgeBg:_e.badgeBg,badgeBorder:_e.badgeBorder,badgeText:_e.badgeText}):e.__assign({},_e),P=(null==s?void 0:s.deviation_summary)?{deviation_summary:s.deviation_summary,deviation_title:null==he?void 0:he.deviation_title,evaluation_outputs:null==he?void 0:he.evaluation_outputs}:null;return{id:u,actionId:y,label:k,highlight:v,side:E,style:N,score:Ie,isConnected:null==J?void 0:J.has(y),isOrphan:F,isMissingClause:f,badgeRef:Y(E,u),onClick:function(e){e.stopPropagation(),Q&&Q(e,ue||{id:"orphan-left",title:"",content:""},F,ce||{id:"orphan-right",title:"",content:""},y,N)},onSummaryClick:function(e){e.stopPropagation(),H(e,y,F,P)}}}).filter(Boolean),Ce=R.id&&E===(null==M?void 0:M.columnKey)?M:null,Fe=s.default.useRef(!1);return i.useEffect(function(){B||(Fe.current=!1)},[B]),n.jsxs(o.Box,e.__assign({ref:C,sx:{mb:k,width:"100%",display:"flex",flexDirection:"column",position:"relative",minWidth:0}},{children:[B&&(null==Ce?void 0:Ce.showAbove)&&n.jsx("div",e.__assign({style:{position:"sticky",top:0,height:"0px",cursor:"pointer"},onClick:function(){var e,n;return null===(n=null===(e=null==Ce?void 0:Ce.showAboveRef)||void 0===e?void 0:e.current)||void 0===n?void 0:n.scrollIntoView({behavior:"smooth",block:"center"})}},{children:n.jsx("div",e.__assign({style:e.__assign({transform:"translateY(-50%) translateX(calc(100% ".concat("left"===E?"+":"-"," 130px))"),position:"absolute",paddingTop:"20px"},"left"===E?{right:"0px"}:{left:"0px"})},{children:n.jsx(t.ChevronUp,{color:window.getComputedStyle(null===(S=null==Ce?void 0:Ce.showAboveRef)||void 0===S?void 0:S.current).color})}))})),n.jsxs(o.Accordion,e.__assign({disableGutters:!0,expanded:!ne&&B,onChange:function(){ne||(D(),N.current=R.id)},sx:{boxShadow:"none",border:ne?"1px dashed #E2E8F0":"1px solid #E2E8F0",bgcolor:ne?"#FAFAFA":"#FFFFFF",borderRadius:"6px",flexGrow:1,width:"100%",display:"flex",flexDirection:"column",minWidth:0,"&:before":{display:"none"},"& .MuiAccordion-heading":{position:"sticky",top:-12,zIndex:10,background:"#fff"}}},{children:[n.jsx(o.AccordionSummary,e.__assign({expandIcon:ne?null:n.jsx(t.ChevronDown,{size:16}),sx:{minHeight:"36px",flexShrink:0,cursor:ne?"default":"pointer","& .MuiAccordionSummary-content":{my:.5,display:"grid",alignItems:"center",minWidth:0,width:"100%"},"& .MuiAccordionSummary-expandIconWrapper":{transition:"transform 0.2s ease"},"& .MuiAccordionSummary-expandIconWrapper.Mui-expanded":{transform:"rotate(180deg)"}}},{children:Z&&n.jsx(o.Tooltip,e.__assign({title:oe,placement:"top"},{children:n.jsx(o.Typography,e.__assign({component:"div",sx:{fontSize:"12px",color:ne?"#94A3B8":"#19213D",fontWeight:ne?400:700,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0}},{children:(Re=oe,Re?r.safeStringify(Re).replace(/\\n/g,"\n").split(/(\*\*.*?\*\*)/g).map(function(e,i){return e.startsWith("**")&&e.endsWith("**")?n.jsx("strong",{children:e.slice(2,-2)},i):n.jsx(s.default.Fragment,{children:e},i)}):null)}))}))})),!ne&&n.jsxs(o.AccordionDetails,e.__assign({sx:{pt:0,pb:1.25,bgcolor:"#FFFFFF",flex:1,display:"flex",flexDirection:"column",minWidth:0}},{children:[ee&&n.jsx(l.MemoizedMarkdown,{content:R.content,sxStyles:P,highlights:je,maintainRelativeOrder:V,highlightBg:ye,deviationBadges:Ee}),(R.subsections||[]).map(function(e,n){return W({section:e,keyPath:"".concat(j,"-").concat(n),depth:0,columnKey:E,parentNodeId:T,devCounter:ie})})]}))]})),B&&(null==Ce?void 0:Ce.showBelow)&&n.jsx("div",e.__assign({style:{position:"sticky",bottom:0,height:"0px",cursor:"pointer"},onClick:function(){var e,n;return null===(n=null===(e=null==Ce?void 0:Ce.showBelowRef)||void 0===e?void 0:e.current)||void 0===n?void 0:n.scrollIntoView({behavior:"smooth",block:"center"})}},{children:n.jsx("div",e.__assign({style:e.__assign({transform:"translateY(-50%) translateX(calc(100% ".concat("left"===E?"+":"-"," 130px))"),position:"absolute",paddingBottom:"20px"},"left"===E?{right:"0px"}:{left:"0px"})},{children:n.jsx(t.ChevronDown,{color:window.getComputedStyle(null===(A=null==Ce?void 0:Ce.showBelowRef)||void 0===A?void 0:A.current).color})}))}))]}),"".concat(E,"-sec-").concat(j))};
|
|
2
2
|
//# sourceMappingURL=SectionAccordion.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var n=require("tslib"),e=require("react/jsx-runtime"),i=require("react"),t=require("@mui/material"),o=require("lucide-react"),l=require("../hooks/memoizedMarkdown.js"),s=require("../CognitiveComparehelpers.js"),a=require("../CognitiveCompareConstants.js");function r(n){return n&&"object"==typeof n&&"default"in n?n:{default:n}}var u=r(i).default.memo(function(r){var d,c,v,f,h,p,g,_,m,x,S,b=r.section,y=r.keyPath,A=r.depth,E=void 0===A?0:A,I=r.columnKey,R=void 0===I?"left":I,j=r.parentNodeId,B=void 0===j?"":j,O=r.expandedSubSections,P=r.setExpandedSubSections,w=r.maintainRelativeOrder,C=r.proposedSections,k=r.existingSections,F=r.treeData,D=r.deviationNumberRegistry,T=r.connectedSections,M=r.activeSideBySideSection,N=r.resolvedMarkdownStyles,q=r.getSubSectionRef,V=r.getSubSectionCompareStyle,W=r.getBadgeRef,z=r.openMoreFunctionsPopup,G=r.openSummaryPopup,L=r.resetSideBySide,U=r.setConnectedSections,H=r.setConnectedLines,K=r.cachedConnectedPositions,J=(null===(d=b.displayTitle)||void 0===d||d)&&s.hasValue(b.title),Q=(null===(c=b.displayContent)||void 0===c||c)&&s.hasValue(b.content),X=!J&&!Q,Y=J?b.title:Q?"No Title Found":"No Matching Section Found",Z=!!O[y],$=q(R,y),nn=y.split("-").map(Number),en=nn[0],tn=C[en],on=k[en],ln=y,sn=y,an=en,rn=en,un=function(n,e,i){if(!n||!e)return null;if(n.id===e)return{section:n,keyPath:i};for(var t=(n.subsections||[]).map(function(n,e){return{section:n,keyPath:"".concat(i,"-").concat(e)}}),o=function(){var n=t.shift();return(null==n?void 0:n.section)?n.section.id===e?{value:n}:void(n.section.subsections||[]).forEach(function(e,i){t.push({section:e,keyPath:"".concat(n.keyPath,"-").concat(i)})}):"continue"};t.length>0;){var l=o();if("object"==typeof l)return l.value}return null};if(w)if("left"===R){var dn=null===(v=null==tn?void 0:tn.refIndexes)||void 0===v?void 0:v[0],cn=k.findIndex(function(n){return n.selfIndex===dn});-1!==cn&&(on=k[cn],rn=cn)}else{var vn=null===(f=null==on?void 0:on.refIndexes)||void 0===f?void 0:f[0];-1!==(mn=C.findIndex(function(n){return n.selfIndex===vn}))&&(tn=C[mn],an=mn)}var fn=tn,hn=on;if(w)if("left"===R){fn=b,ln=y;var pn=un(on,b.id,String(rn));hn=(null==pn?void 0:pn.section)||null,sn=(null==pn?void 0:pn.keyPath)||""}else{hn=b,sn=y;var gn=un(tn,b.id,String(an));fn=(null==gn?void 0:gn.section)||null,ln=(null==gn?void 0:gn.keyPath)||""}else for(var _n=1;_n<nn.length;_n++)(null==fn?void 0:fn.subsections)&&(fn=fn.subsections[nn[_n]]),(null==hn?void 0:hn.subsections)&&(hn=hn.subsections[nn[_n]]);var mn,xn=(ln?V(ln):null)||V(y),Sn=null===(h=null==F?void 0:F.input_index_map)||void 0===h?void 0:h[0],bn=null===(p=null==F?void 0:F.input_index_map)||void 0===p?void 0:p[1],yn="left"===R?bn:Sn,An="left"===R?!hn:!fn,En=b.evaluationResult||(null==fn?void 0:fn.evaluationResult)||(null==hn?void 0:hn.evaluationResult),In=null!==(_=null===(g=null==En?void 0:En.evaluation_outputs)||void 0===g?void 0:g.output_value)&&void 0!==_?_:null,Rn=en+1,jn=b.id||(null==fn?void 0:fn.id)||(null==hn?void 0:hn.id);"right"===R&&w&&(tn&&-1!==(mn=C.findIndex(function(n){return n.id===tn.id}))&&(Rn=mn+1));var Bn=null!==(S=null===(x=null===(m=null==En?void 0:En.evaluation_outputs)||void 0===m?void 0:m.metadata)||void 0===x?void 0:x.label_color)&&void 0!==S?S:a.DEFAULT_DEVIAION_COLOR,On=s.generateColorPalette(Bn),Pn=On.highlightBg,wn=(null==En?void 0:En.deviations)||{},Cn=[],kn=Object.entries(wn).map(function(e){var i=e[0],t=e[1],o="".concat(jn).concat(s.DEVIATION_BADGE_SEPARATOR).concat(i),l=D[o];if(
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var n=require("tslib"),e=require("react/jsx-runtime"),i=require("react"),t=require("@mui/material"),o=require("lucide-react"),l=require("../hooks/memoizedMarkdown.js"),s=require("../CognitiveComparehelpers.js"),a=require("../CognitiveCompareConstants.js");function r(n){return n&&"object"==typeof n&&"default"in n?n:{default:n}}var u=r(i).default.memo(function(r){var d,c,v,f,h,p,g,_,m,x,S,b=r.section,y=r.keyPath,A=r.depth,E=void 0===A?0:A,I=r.columnKey,R=void 0===I?"left":I,j=r.parentNodeId,B=void 0===j?"":j,O=r.expandedSubSections,P=r.setExpandedSubSections,w=r.maintainRelativeOrder,C=r.proposedSections,k=r.existingSections,F=r.treeData,D=r.deviationNumberRegistry,T=r.connectedSections,M=r.activeSideBySideSection,N=r.resolvedMarkdownStyles,q=r.getSubSectionRef,V=r.getSubSectionCompareStyle,W=r.getBadgeRef,z=r.openMoreFunctionsPopup,G=r.openSummaryPopup,L=r.resetSideBySide,U=r.setConnectedSections,H=r.setConnectedLines,K=r.cachedConnectedPositions,J=(null===(d=b.displayTitle)||void 0===d||d)&&s.hasValue(b.title),Q=(null===(c=b.displayContent)||void 0===c||c)&&s.hasValue(b.content),X=!J&&!Q,Y=J?b.title:Q?"No Title Found":"No Matching Section Found",Z=!!O[y],$=q(R,y),nn=y.split("-").map(Number),en=nn[0],tn=C[en],on=k[en],ln=y,sn=y,an=en,rn=en,un=function(n,e,i){if(!n||!e)return null;if(n.id===e)return{section:n,keyPath:i};for(var t=(n.subsections||[]).map(function(n,e){return{section:n,keyPath:"".concat(i,"-").concat(e)}}),o=function(){var n=t.shift();return(null==n?void 0:n.section)?n.section.id===e?{value:n}:void(n.section.subsections||[]).forEach(function(e,i){t.push({section:e,keyPath:"".concat(n.keyPath,"-").concat(i)})}):"continue"};t.length>0;){var l=o();if("object"==typeof l)return l.value}return null};if(w)if("left"===R){var dn=null===(v=null==tn?void 0:tn.refIndexes)||void 0===v?void 0:v[0],cn=k.findIndex(function(n){return n.selfIndex===dn});-1!==cn&&(on=k[cn],rn=cn)}else{var vn=null===(f=null==on?void 0:on.refIndexes)||void 0===f?void 0:f[0];-1!==(mn=C.findIndex(function(n){return n.selfIndex===vn}))&&(tn=C[mn],an=mn)}var fn=tn,hn=on;if(w)if("left"===R){fn=b,ln=y;var pn=un(on,b.id,String(rn));hn=(null==pn?void 0:pn.section)||null,sn=(null==pn?void 0:pn.keyPath)||""}else{hn=b,sn=y;var gn=un(tn,b.id,String(an));fn=(null==gn?void 0:gn.section)||null,ln=(null==gn?void 0:gn.keyPath)||""}else for(var _n=1;_n<nn.length;_n++)(null==fn?void 0:fn.subsections)&&(fn=fn.subsections[nn[_n]]),(null==hn?void 0:hn.subsections)&&(hn=hn.subsections[nn[_n]]);var mn,xn=(ln?V(ln):null)||V(y),Sn=null===(h=null==F?void 0:F.input_index_map)||void 0===h?void 0:h[0],bn=null===(p=null==F?void 0:F.input_index_map)||void 0===p?void 0:p[1],yn="left"===R?bn:Sn,An="left"===R?!hn:!fn,En=b.evaluationResult||(null==fn?void 0:fn.evaluationResult)||(null==hn?void 0:hn.evaluationResult),In=null!==(_=null===(g=null==En?void 0:En.evaluation_outputs)||void 0===g?void 0:g.output_value)&&void 0!==_?_:null,Rn=en+1,jn=b.id||(null==fn?void 0:fn.id)||(null==hn?void 0:hn.id);"right"===R&&w&&(tn&&-1!==(mn=C.findIndex(function(n){return n.id===tn.id}))&&(Rn=mn+1));var Bn=null!==(S=null===(x=null===(m=null==En?void 0:En.evaluation_outputs)||void 0===m?void 0:m.metadata)||void 0===x?void 0:x.label_color)&&void 0!==S?S:a.DEFAULT_DEVIAION_COLOR,On=s.generateColorPalette(Bn),Pn=On.highlightBg,wn=(null==En?void 0:En.deviations)||{},Cn=[],kn=Object.entries(wn).map(function(e){var i=e[0],t=e[1],o="".concat(jn).concat(s.DEVIATION_BADGE_SEPARATOR).concat(i),l=D[o];if(null==l)return null;var a=t[B],r=s.isMissingStr(a);if(r)a="";else if(!a)return null;Cn.push(a);var u=t[yn],d=!1;u&&(d=Object.values(wn).map(function(n){return n[yn]}).filter(Boolean).some(function(n){return n.length>u.length&&n.includes(u)}));var c=An||s.isMissingStr(u)||d,v="".concat(Rn,".").concat(l),f="".concat(jn).concat(s.DEVIATION_BADGE_SEPARATOR).concat(i).concat(s.DEVIATION_BADGE_SEPARATOR).concat(ln).concat(s.DEVIATION_BADGE_SEPARATOR).concat(sn),h=n.__assign({},On),p=(null==t?void 0:t.deviation_summary)?{deviation_summary:t.deviation_summary||(null==En?void 0:En.deviation_summary),deviation_title:null==En?void 0:En.deviation_title,evaluation_outputs:null==En?void 0:En.evaluation_outputs}:null;return{id:o,actionId:f,label:v,highlight:a,side:R,style:h,score:In,isConnected:T.has(f),isOrphan:c,isMissingClause:r,badgeRef:W(R,o),onClick:function(e){e.stopPropagation();var i=fn?n.__assign(n.__assign({},fn),{title:(null==tn?void 0:tn.title)||(null==fn?void 0:fn.title)||""}):{id:"orphan-left",title:"",content:""},t=hn?n.__assign(n.__assign({},hn),{title:(null==on?void 0:on.title)||(null==hn?void 0:hn.title)||""}):{id:"orphan-right",title:"",content:""};z(e,i,c,t,f,h)},onSummaryClick:function(n){n.stopPropagation(),G(n,f,c,p)}}}).filter(Boolean).sort(function(n,e){return parseFloat(n.label)-parseFloat(e.label)}),Fn=i.useRef(!1);i.useEffect(function(){Z||(Fn.current=!1)},[Z]),i.useEffect(function(){if(Z&&!Fn.current){var n=setTimeout(function(){var n,e;Fn.current=!0;var i=null===(e=null===(n=kn[0])||void 0===n?void 0:n.badgeRef)||void 0===e?void 0:e.current;i&&i.scrollIntoView({behavior:"smooth",block:"center"})},350);return function(){return clearTimeout(n)}}},[Z,kn]);var Dn=kn.some(function(n){return T.has(n.actionId)});if(!(J||Q||b.subsections&&0!==b.subsections.length))return null;var Tn=!w&&J&&Q,Mn=Dn&&xn?{borderRadius:"4px",outline:"2px solid ".concat(xn.badgeBorder),outlineOffset:"1px"}:{};return J?e.jsx(t.Box,n.__assign({ref:$,sx:{mt:1,width:"100%",minWidth:0,position:"relative"}},{children:e.jsx(t.Box,n.__assign({sx:n.__assign({width:"100%"},Mn)},{children:e.jsxs(t.Accordion,n.__assign({disableGutters:!0,expanded:!X&&Z,onChange:function(){if(!X){if(Z){var e=String(M||""),i=e.includes(ln)||e.includes(sn);i||T.forEach(function(n){(String(n).includes(ln)||String(n).includes(sn))&&(i=!0)}),i&&(L(),U(new Set),H([]),K.current=[])}P(function(e){var i;return n.__assign(n.__assign({},e),((i={})[y]=!e[y],i))})}},sx:{mt:0,boxShadow:"none",border:X?"1px dashed #E2E8F0":"1px solid #EEF2F7",borderRadius:"4px !important",bgcolor:"#FFFFFF",minWidth:0,"&:before":{display:"none"}}},{children:[e.jsx(t.AccordionSummary,n.__assign({expandIcon:X?null:e.jsx(o.ChevronDown,{size:14}),sx:{minHeight:"32px","& .MuiAccordionSummary-content":{my:.5,display:"grid",alignItems:"center",minWidth:0,width:"100%"}}},{children:e.jsx(t.Typography,n.__assign({component:"div",sx:{fontSize:"11px",fontWeight:600,color:X?"#94A3B8":"#19213D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0}},{children:Y||"Untitled Subsection"}))})),!X&&e.jsxs(t.AccordionDetails,n.__assign({sx:{pt:0,pb:1,minWidth:0}},{children:[Q&&e.jsx(l.MemoizedMarkdown,{content:b.content,sxStyles:N,deviationBadges:Tn?[]:kn,maintainRelativeOrder:w,highlightBg:Pn,highlights:Cn}),(b.subsections||[]).map(function(i,t){return e.jsx(u,n.__assign({},r,{section:i,keyPath:"".concat(y,"-").concat(t),depth:E+1}),"".concat(y,"-").concat(t))})]}))]}))}))})):e.jsx(t.Box,n.__assign({ref:$,sx:{mt:0===E?1:.75,width:"100%",minWidth:0,position:"relative"}},{children:!X&&e.jsxs(t.Box,n.__assign({sx:n.__assign({width:"100%"},Mn)},{children:[Q&&e.jsx(l.MemoizedMarkdown,{content:b.content,sxStyles:N,deviationBadges:kn,maintainRelativeOrder:w,highlightBg:Pn,highlights:Cn}),(b.subsections||[]).map(function(i,t){return e.jsx(u,n.__assign({},r,{section:i,keyPath:"".concat(y,"-").concat(t),depth:E+1}),"".concat(y,"-").concat(t))})]}))}))});exports.default=u;
|
|
2
2
|
//# sourceMappingURL=SubSectionAccordion.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),i=require("react"),t=require("../CognitiveComparehelpers.js"),n={id:"",title:"",similarity:0,sections:[]};exports.useCognitiveTreeData=function(o,s,l,r){var d=JSON.stringify(l||{}),a=i.useMemo(function(){var i,n,l,r;if(!o||0===Object.keys(o).length)return{activeProposed:{},activeVariants:[],parseError:"Tree data is required"};var a=JSON.parse(d);try{var u=o.nodes||o,v=[],c=[],f=o.base_root_id,p=o.input_index_map||{0:"left",1:"right"},_=o[f]||u[f];if(!_||!1===_.display_node)return{activeProposed:{title:"No Data",sections:[]},activeVariants:[],parseError:null};var b=function(i,n){var s,l,r,d=o[i]||u[i];if(!d||!1===d.display_node)return null;var v=t.getSideData(d,n,p),c=!1!==(null===(s=v.attributes)||void 0===s?void 0:s.display_title),f=!1!==(null===(l=v.attributes)||void 0===l?void 0:l.display_content),_=!!v.title.trim(),y=!!v.content.trim(),x=t.getRationale(d),m=(null===(r=null==a?void 0:a[i])||void 0===r?void 0:r.evaluation_result)||d.evaluation_result||null,g=[];d.next&&Object.values(d.next).forEach(function(e){var i=u[e];if(i&&!1!==i.display_node){var t=b(e,n);t&&g.push(t)}});var I=!(!_&&!y);return e.__assign(e.__assign({id:i,title:_?v.title:"",content:y?v.content:"",displayTitle:c,displayContent:f,subsections:g},I?x:{score:void 0,relation:"not_defined"}),{evaluationResult:m})};if(s){var y=function(i,n){var s,l,r,d,v,c,f,_,b,x,m,g,I,h,S,E,R,N,D,O,M;void 0===n&&(n=0);var P=[],T=[];if(!i)return{refSections:P,baseSections:T};var V={},j={},A=-1,C=-1;for(var k in i){var q=i[k],J=o[q]||u[q];if(J&&!1!==J.display_node){var U=t.getRationale(J),w=(null===(s=null==a?void 0:a[q])||void 0===s?void 0:s.evaluation_result)||J.evaluation_result||null,B=t.getSideData(J,"1",p),F=t.getSideData(J,"0",p),G=!1!==(null===(l=B.attributes)||void 0===l?void 0:l.display_title)&&B.title.trim()||!1!==(null===(r=B.attributes)||void 0===r?void 0:r.display_content)&&B.content.trim(),z=!1!==(null===(d=F.attributes)||void 0===d?void 0:d.display_title)&&F.title.trim()||!1!==(null===(v=F.attributes)||void 0===v?void 0:v.display_content)&&F.content.trim(),H=Number(null!==(f=null===(c=B.attributes)||void 0===c?void 0:c.display_index)&&void 0!==f?f:A--),K=Number(null!==(b=null===(_=F.attributes)||void 0===_?void 0:_.display_index)&&void 0!==b?b:C--),L=V[H]||e.__assign(e.__assign({id:q,title:!1!==(null===(x=B.attributes)||void 0===x?void 0:x.display_title)?B.title:"",content:!1!==(null===(m=B.attributes)||void 0===m?void 0:m.display_content)?B.content:"",subsections:[]},G?U:{score:void 0,relation:"not_defined"}),{refIndexes:[],selfIndex:H,evaluationResult:w,displayContent:null===(g=B.attributes)||void 0===g?void 0:g.display_content,displayTitle:null===(I=B.attributes)||void 0===I?void 0:I.display_title}),Q=j[K]||e.__assign(e.__assign({id:q,title:!1!==(null===(h=F.attributes)||void 0===h?void 0:h.display_title)?F.title:"",content:!1!==(null===(S=F.attributes)||void 0===S?void 0:S.display_content)?F.content:"",subsections:[]},z?U:{score:void 0,relation:"not_defined"}),{refIndexes:[],selfIndex:K,evaluationResult:w,displayContent:null===(E=F.attributes)||void 0===E?void 0:E.display_content,displayTitle:null===(R=F.attributes)||void 0===R?void 0:R.display_title});Number(H)>=0&&Number(K)>=0&&((null===(N=L.refIndexes)||void 0===N?void 0:N.includes(Number(K)))||null===(D=L.refIndexes)||void 0===D||D.push(Number(K)),(null===(O=Q.refIndexes)||void 0===O?void 0:O.includes(Number(H)))||null===(M=Q.refIndexes)||void 0===M||M.push(Number(H))),V[H]=L,j[K]=Q;var W=y(J.next,n+1),X=W.refSections,Y=W.baseSections;X.length>0&&(L.subsections=e.__spreadArray(e.__spreadArray([],L.subsections||[],!0),X,!0)),Y.length>0&&(Q.subsections=e.__spreadArray(e.__spreadArray([],Q.subsections||[],!0),Y,!0))}}P=Object.values(V),T=Object.values(j);var Z=function(e,i){return e.selfIndex<0&&i.selfIndex>=0?1:e.selfIndex>=0&&i.selfIndex<0?-1:e.selfIndex-i.selfIndex};return P.sort(Z),T.sort(Z),{refSections:P,baseSections:T}},x=y(_.next),m=x.refSections,g=x.baseSections;c=m,v=g}else _.next&&Object.values(_.next).forEach(function(e){var i=o[e]||u[e];i&&!1!==i.display_node&&(v.push(b(e,"0")||{id:e,title:"",content:"",subsections:[]}),c.push(b(e,"1")||{id:e,title:"",content:"",subsections:[]}))});return{activeProposed:{title:(null===(n=null===(i=_.comparison_inputs)||void 0===i?void 0:i[p[0]])||void 0===n?void 0:n.title)||"Uploaded Contract",description:_.decision_scope_description||"",sections:v},activeVariants:[{id:"tree-variant-1",title:(null===(r=null===(l=_.comparison_inputs)||void 0===l?void 0:l[p[1]])||void 0===r?void 0:r.title)||"Reference Template",similarity:0,sections:c,analysis:{rule_difference_comparison:{summary:{overall_score:0,overall_summary:_.decision_scope_description||""},fields:{}}}}],parseError:null}}catch(e){return console.error("Data Transformation Error: ",e),{activeProposed:{},activeVariants:[],parseError:e instanceof Error?e.message:"Unknown Parsing Error"}}},[o,s,d]),u=a.activeProposed,v=a.activeVariants,c=a.parseError,f=(null==v?void 0:v[0])||n,p=i.useMemo(function(){return(null==u?void 0:u.sections)||[]},[null==u?void 0:u.sections]),_=i.useMemo(function(){return f.sections||[]},[f.sections]),b=p.length>0||_.length>0,y=i.useMemo(function(){return r.fields.filter(function(e){var i=e.key;return(!b||"description"!==i)&&(t.hasValue(null==u?void 0:u[i])||t.hasValue(f[i]))})},[u,f,b,r.fields]),x=i.useMemo(function(){var e,i,n={},l={},r={},d=0,a=null===(e=null==o?void 0:o.input_index_map)||void 0===e?void 0:e[0],u=null===(i=null==o?void 0:o.input_index_map)||void 0===i?void 0:i[1],v=function(e,i,o,s,c,f){var p,_,b,y,x,m,g,I;if(e
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),i=require("react"),t=require("../CognitiveComparehelpers.js"),n={id:"",title:"",similarity:0,sections:[]};exports.useCognitiveTreeData=function(o,s,l,r){var d=JSON.stringify(l||{}),a=i.useMemo(function(){var i,n,l,r;if(!o||0===Object.keys(o).length)return{activeProposed:{},activeVariants:[],parseError:"Tree data is required"};var a=JSON.parse(d);try{var u=o.nodes||o,v=[],c=[],f=o.base_root_id,p=o.input_index_map||{0:"left",1:"right"},_=o[f]||u[f];if(!_||!1===_.display_node)return{activeProposed:{title:"No Data",sections:[]},activeVariants:[],parseError:null};var b=function(i,n){var s,l,r,d=o[i]||u[i];if(!d||!1===d.display_node)return null;var v=t.getSideData(d,n,p),c=!1!==(null===(s=v.attributes)||void 0===s?void 0:s.display_title),f=!1!==(null===(l=v.attributes)||void 0===l?void 0:l.display_content),_=!!v.title.trim(),y=!!v.content.trim(),x=t.getRationale(d),m=(null===(r=null==a?void 0:a[i])||void 0===r?void 0:r.evaluation_result)||d.evaluation_result||null,g=[];d.next&&Object.values(d.next).forEach(function(e){var i=u[e];if(i&&!1!==i.display_node){var t=b(e,n);t&&g.push(t)}});var I=!(!_&&!y);return e.__assign(e.__assign({id:i,title:_?v.title:"",content:y?v.content:"",displayTitle:c,displayContent:f,subsections:g},I?x:{score:void 0,relation:"not_defined"}),{evaluationResult:m})};if(s){var y=function(i,n){var s,l,r,d,v,c,f,_,b,x,m,g,I,h,S,E,R,N,D,O,M;void 0===n&&(n=0);var P=[],T=[];if(!i)return{refSections:P,baseSections:T};var V={},j={},A=-1,C=-1;for(var k in i){var q=i[k],J=o[q]||u[q];if(J&&!1!==J.display_node){var U=t.getRationale(J),w=(null===(s=null==a?void 0:a[q])||void 0===s?void 0:s.evaluation_result)||J.evaluation_result||null,B=t.getSideData(J,"1",p),F=t.getSideData(J,"0",p),G=!1!==(null===(l=B.attributes)||void 0===l?void 0:l.display_title)&&B.title.trim()||!1!==(null===(r=B.attributes)||void 0===r?void 0:r.display_content)&&B.content.trim(),z=!1!==(null===(d=F.attributes)||void 0===d?void 0:d.display_title)&&F.title.trim()||!1!==(null===(v=F.attributes)||void 0===v?void 0:v.display_content)&&F.content.trim(),H=Number(null!==(f=null===(c=B.attributes)||void 0===c?void 0:c.display_index)&&void 0!==f?f:A--),K=Number(null!==(b=null===(_=F.attributes)||void 0===_?void 0:_.display_index)&&void 0!==b?b:C--),L=V[H]||e.__assign(e.__assign({id:q,title:!1!==(null===(x=B.attributes)||void 0===x?void 0:x.display_title)?B.title:"",content:!1!==(null===(m=B.attributes)||void 0===m?void 0:m.display_content)?B.content:"",subsections:[]},G?U:{score:void 0,relation:"not_defined"}),{refIndexes:[],selfIndex:H,evaluationResult:w,displayContent:null===(g=B.attributes)||void 0===g?void 0:g.display_content,displayTitle:null===(I=B.attributes)||void 0===I?void 0:I.display_title}),Q=j[K]||e.__assign(e.__assign({id:q,title:!1!==(null===(h=F.attributes)||void 0===h?void 0:h.display_title)?F.title:"",content:!1!==(null===(S=F.attributes)||void 0===S?void 0:S.display_content)?F.content:"",subsections:[]},z?U:{score:void 0,relation:"not_defined"}),{refIndexes:[],selfIndex:K,evaluationResult:w,displayContent:null===(E=F.attributes)||void 0===E?void 0:E.display_content,displayTitle:null===(R=F.attributes)||void 0===R?void 0:R.display_title});Number(H)>=0&&Number(K)>=0&&((null===(N=L.refIndexes)||void 0===N?void 0:N.includes(Number(K)))||null===(D=L.refIndexes)||void 0===D||D.push(Number(K)),(null===(O=Q.refIndexes)||void 0===O?void 0:O.includes(Number(H)))||null===(M=Q.refIndexes)||void 0===M||M.push(Number(H))),V[H]=L,j[K]=Q;var W=y(J.next,n+1),X=W.refSections,Y=W.baseSections;X.length>0&&(L.subsections=e.__spreadArray(e.__spreadArray([],L.subsections||[],!0),X,!0)),Y.length>0&&(Q.subsections=e.__spreadArray(e.__spreadArray([],Q.subsections||[],!0),Y,!0))}}P=Object.values(V),T=Object.values(j);var Z=function(e,i){return e.selfIndex<0&&i.selfIndex>=0?1:e.selfIndex>=0&&i.selfIndex<0?-1:e.selfIndex-i.selfIndex};return P.sort(Z),T.sort(Z),{refSections:P,baseSections:T}},x=y(_.next),m=x.refSections,g=x.baseSections;c=m,v=g}else _.next&&Object.values(_.next).forEach(function(e){var i=o[e]||u[e];i&&!1!==i.display_node&&(v.push(b(e,"0")||{id:e,title:"",content:"",subsections:[]}),c.push(b(e,"1")||{id:e,title:"",content:"",subsections:[]}))});return{activeProposed:{title:(null===(n=null===(i=_.comparison_inputs)||void 0===i?void 0:i[p[0]])||void 0===n?void 0:n.title)||"Uploaded Contract",description:_.decision_scope_description||"",sections:v},activeVariants:[{id:"tree-variant-1",title:(null===(r=null===(l=_.comparison_inputs)||void 0===l?void 0:l[p[1]])||void 0===r?void 0:r.title)||"Reference Template",similarity:0,sections:c,analysis:{rule_difference_comparison:{summary:{overall_score:0,overall_summary:_.decision_scope_description||""},fields:{}}}}],parseError:null}}catch(e){return console.error("Data Transformation Error: ",e),{activeProposed:{},activeVariants:[],parseError:e instanceof Error?e.message:"Unknown Parsing Error"}}},[o,s,d]),u=a.activeProposed,v=a.activeVariants,c=a.parseError,f=(null==v?void 0:v[0])||n,p=i.useMemo(function(){return(null==u?void 0:u.sections)||[]},[null==u?void 0:u.sections]),_=i.useMemo(function(){return f.sections||[]},[f.sections]),b=p.length>0||_.length>0,y=i.useMemo(function(){return r.fields.filter(function(e){var i=e.key;return(!b||"description"!==i)&&(t.hasValue(null==u?void 0:u[i])||t.hasValue(f[i]))})},[u,f,b,r.fields]),x=i.useMemo(function(){var e,i,n={},l={},r={},d=0,a=null===(e=null==o?void 0:o.input_index_map)||void 0===e?void 0:e[0],u=null===(i=null==o?void 0:o.input_index_map)||void 0===i?void 0:i[1],v=function(e,i,o,s,c,f){var p,_,b,y,x,m,g,I;if(e&&function(e,i){var n,o=(null===(n=null==e?void 0:e.evaluationResult)||void 0===n?void 0:n.deviations)||{};Object.keys(o).sort().forEach(function(n){var s=o[n];if(s){var d=!t.isMissingStr(s[a]),v=!t.isMissingStr(s[u]);if(d||v){var c="".concat(e.id).concat(t.DEVIATION_BADGE_SEPARATOR).concat(n);void 0===l[c]&&(void 0===r[i]&&(r[i]=1),l[c]=r[i]++)}}})}(e,s),e&&!c){var h=(null==f?void 0:f.id)||"fallback_parent_".concat(d++);n[h]||(n[h]=[]),n[h].push(e)}for(var S=Math.max((null===(p=null==i?void 0:i.subsections)||void 0===p?void 0:p.length)||0,(null===(_=null==o?void 0:o.subsections)||void 0===_?void 0:_.length)||0,(null===(b=null==e?void 0:e.subsections)||void 0===b?void 0:b.length)||0),E=0;E<S;E++)v((null===(y=null==e?void 0:e.subsections)||void 0===y?void 0:y[E])||(null===(x=null==i?void 0:i.subsections)||void 0===x?void 0:x[E])||(null===(m=null==o?void 0:o.subsections)||void 0===m?void 0:m[E]),null===(g=null==i?void 0:i.subsections)||void 0===g?void 0:g[E],null===(I=null==o?void 0:o.subsections)||void 0===I?void 0:I[E],s,!1,f)};return p.forEach(function(e,i){var t,n=i+1;s&&void 0!==e.selfIndex&&e.selfIndex>=0&&(n=e.selfIndex+1);var o=null;if(s){var l=null===(t=e.refIndexes)||void 0===t?void 0:t[0];o=_.find(function(e){return e.selfIndex===l})}else o=_[i];v(e,e,o,n,!0,e)}),_.forEach(function(e,i){var t,n=i+1,o=!1;if(s){var l=null===(t=e.refIndexes)||void 0===t?void 0:t[0],r=p.find(function(e){return e.selfIndex===l});r&&void 0!==r.selfIndex&&r.selfIndex>=0?n=r.selfIndex+1:(o=!0,void 0!==e.selfIndex&&e.selfIndex>=0&&(n=e.selfIndex+1))}else i>=p.length&&(o=!0);o&&v(e,null,e,n,!0,e)}),{parentDeviationRecord:n,registry:l}},[p,_,s,o]),m=x.parentDeviationRecord,g=x.registry;return{activeProposed:u,activeVariants:v,existingRule:f,proposedSections:p,existingSections:_,visibleFields:y,parentDeviationRecord:m,deviationNumberRegistry:g,parseError:c}};
|
|
2
2
|
//# sourceMappingURL=useCompareData.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 _ from"./CognitivePopup.js";import M from"./MoreFunctionsPopup.js";import D from"./LoaderComponent.js";import k from"./components/ThreeDotsLoader.js";import{useCognitiveTreeData as A}from"./hooks/useCompareData.js";import{useComparePopups as H}from"./hooks/useComparePopups.js";import{useSectionRefs as N}from"./hooks/useSectionRefs.js";import{useAccordionState as L}from"./hooks/useAccordionState.js";import{useDeviationNavigation as P}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=Y.resetDeviationNodeId,ye=o(pe.maintainRelativeOrder),be=ye[0],Se=ye[1],Re=o(!1),Ce=Re[0],Ie=Re[1],Te=o(!1),Be=Te[0],we=Te[1],Ee=o(null),Fe=Ee[0],_e=Ee[1],Me=o(!1),De=Me[0],ke=Me[1],Ae=o(!1),He=Ae[0],Ne=Ae[1],Le=o(!1),Pe=Le[0],Oe=Le[1],je=o(null),ze=je[0],We=je[1],Ye=r(!1),Ke=o(new Set),qe=Ke[0],Ve=Ke[1],Xe=o([]),Je=Xe[0],Ue=Xe[1],Ge=r(null),Qe=r(!1),Ze=r(null),$e=r({}),en=r([]),nn=r(!1),tn=r(!1),on=r(null),rn=r(function(){}),ln=l(function(){return(null==ce?void 0:ce.cognitive_decisioning)||{}},[ce]),cn=o({width:0,height:0}),un=cn[0],dn=cn[1],an=l(function(){return e(e({},T),se)},[se]),sn=r(null),vn=r(null),pn=r(null),fn=r(null),gn=r(null),hn=r(null),xn=r(null),mn=r(null),yn=r(!1),bn=r(null),Sn=r(null),Rn=H(sn),Cn=Rn.cognitivePopup,In=Rn.setCognitivePopup,Tn=Rn.moreFunctions,Bn=Rn.setMoreFunctions,wn=Rn.position,En=Rn.setPosition,Fn=Rn.activeBadgeId,_n=Rn.summaryPopup,Mn=Rn.setSummaryPopup,Dn=Rn.closeSummaryPopup,kn=Rn.setActiveBadgeId,An=Rn.popupRef,Hn=Rn.closeCognitivePopup,Nn=Rn.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: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]),Pn=o(null),On=Pn[0];Pn[1];var jn=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,zn=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,Wn=m(de||jn||"Uploaded Contract"),Yn=m(ae||zn||"Reference Template"),Kn=A(ce,be,he,Ln),qn=Kn.activeProposed,Vn=Kn.existingRule,Xn=Kn.proposedSections,Jn=Kn.existingSections,Un=Kn.visibleFields,Gn=Kn.parentDeviationRecord,Qn=Kn.deviationNumberRegistry,Zn=Kn.parseError;c(function(){Zn&&_e("Failed to load comparison: ".concat(Zn))},[Zn]);var $n=Xn.length>0||Jn.length>0,et=N(Un.map(function(e){return e.key}),Math.max(Xn.length,Jn.length)),nt=et.leftRefs,tt=et.rightRefs,it=et.sectionLeftRefs,ot=et.sectionRightRefs,rt=et.lhsBadgeRefs,lt=et.rhsBadgeRefs,ct=et.sectionRightRowRefs,ut=et.subSectionLeftRefs,dt=et.subSectionRightRefs,at=et.sectionRowRefs,st=et.getSectionRowRef,vt=et.getSubSectionRef,pt=et.getBadgeRef,ft=Vn.analysis,gt=m(null===(Q=null===(G=null==ft?void 0:ft.rule_difference_comparison)||void 0===G?void 0:G.summary)||void 0===Q?void 0:Q.overall_summary),ht=!!gt.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),xt=null!==(Z=null==ce?void 0:ce.base_root_id)&&void 0!==Z?Z:"-1";null==ce||ce[xt];var mt=(null===($=null==he?void 0:he[xt])||void 0===$?void 0:$.evaluation_result)||(null===(ne=null===(ee=null==ce?void 0:ce.nodes)||void 0===ee?void 0:ee[xt])||void 0===ne?void 0:ne.evaluation_result)||null,yt=y(mt),bt=b(null!==(oe=null===(ie=null===(te=null==mt?void 0:mt.evaluation_outputs)||void 0===te?void 0:te.metadata)||void 0===ie?void 0:ie.label_color)&&void 0!==oe?oe:""),St=u(function(){var e,n,t,i,o,r;ke(!1),tn.current=!1;var l=on.current,c=At.current;if(null!==l)if("string"==typeof l&&l.includes(S)){var u=l.split(S);(d=(null===(e=ut.current[u[2]])||void 0===e?void 0:e.current)||(null===(n=it.current[Number(u[2])])||void 0===n?void 0:n.current))&&(d.style.paddingTop="0px")}else{var d;(d=null===(t=it.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=dt.current[u[3]])||void 0===i?void 0:i.current)||(null===(o=ot.current[Number(u[3])])||void 0===o?void 0:o.current))&&(a.style.paddingTop="0px")}else{var a;(a=null===(r=ot.current[c])||void 0===r?void 0:r.current)&&(a.style.paddingTop="0px")}We(null),on.current=null,At.current=null,Ne(!1),we(!1),fn.current&&(fn.current.style.height="0px"),gn.current&&(gn.current.style.height="0px"),hn.current&&(hn.current.style.height="0px"),xn.current&&(xn.current.style.height="0px")},[]),Rt=L({maintainRelativeOrder:!!be,proposedSections:Xn,existingSections:Jn,activeSideBySideSection:ze,connectedSections:qe,resetSideBySide:St,setConnectedSections:Ve,setConnectedLines:Ue,cachedConnectedPositions:en,svgContainerRef:Ge,isAnimatingRef:Qe,animationTimerRef:Ze,calculateLinesRef:rn,sectionLeftRefs:it,sectionRightRefs:ot,subSectionLeftRefs:ut,subSectionRightRefs:dt}),Ct=Rt.expandedSections,It=Rt.expandedSubSections,Tt=Rt.setExpandedSubSections,Bt=Rt.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?ln[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=at.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}},[ln,ce]),Et=u(function(e){Nn(),En(null),In(e)},[Nn]),Ft=function(e,n,t,i,o,r){var l;if(e.stopPropagation(),Tn.open&&Tn.sectionIdx===o)Nn();else{var c=e.currentTarget,u="left";(null===(l=pn.current)||void 0===l?void 0:l.contains(c))&&(u="right");tn.current&&St(),Ve(new Set),Ue([]),en.current=[],Hn(),_n.open?ii():Dn(),requestAnimationFrame(function(){var e=function(){var e,n,t,i;if("string"==typeof o&&o.includes(S)){var r=o.split(S),l="".concat(r[0]).concat(S).concat(r[1]);return"right"===u?null===(e=lt.current[l])||void 0===e?void 0:e.current:null===(n=rt.current[l])||void 0===n?void 0:n.current}return"right"===u?null===(t=lt.current[o])||void 0===t?void 0:t.current:null===(i=rt.current[o])||void 0===i?void 0:i.current}()||c;Bn(wt(e,n,i,o,t,r))})}},_t=u(function(){null!==Tn.sectionIdx&&Tn.anchorEl?Et(e(e({},Tn),{open:!0})):Nn()},[Tn,Nn,Et]),Mt=u(function(){var e=Tn.sectionIdx,n=Tn.isOrphan;Nn(),Dn(),null!==e&&(n?_e("No counterpart exists to connect to."):(tn.current&&St(),Ue([]),en.current=[],Ve(function(n){return n.has(e)?new Set:new Set([e])}),setTimeout(function(){rn.current&&rn.current()},50)))},[Tn.sectionIdx,Tn.isOrphan,Nn,Dn,St]),Dt=r(null),kt=r(null),At=r(null),Ht=r(null),Nt=r(null),Lt=r(null),Pt=o([]),Ot=Pt[0],jt=Pt[1];r(null);var zt=o(null),Wt=zt[0],Yt=zt[1];c(function(){if(On){var e=Ln.fields.find(function(e){return e.analysisKey===On||e.key===On});if(e){var n=nt.current[e.key]||tt.current[e.key];(null==n?void 0:n.current)&&setTimeout(function(){return n.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[On,Ln.fields]);var Kt=u(function(e){var n,t,i,o,r,l,c,u,d,a=null===(n=null==ft?void 0:ft.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}},[ft]),qt=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],be&&a){var v=Jn.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=Jn[n];else if(s=Jn[n],be&&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,Jn,ln,Ln,be]),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=Jn[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=ln[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,Jn,ln,Ln]),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(!yn.current&&!Qe.current){yn.current=!0;try{if(!Dt.current)return;var T=function(e){var n=e.split("-"),t=n[0];if(!Ct[t]&&!1===be)return!1;if(be&&!Ct["left-".concat(t)]&&!Ct["right-".concat(t)]&&!Ct[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},B=Dt.current.getBoundingClientRect();dn({width:B.width,height:B.height});var w=[];if(Un.forEach(function(e){var n,t,i=e.key,o=null===(n=nt.current[i])||void 0===n?void 0:n.current,r=null===(t=tt.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")}),!Qe.current){for(var E=0;E<Math.max(Xn.length,Jn.length);E++){var F=null===(e=it.current[E])||void 0===e?void 0:e.current,_=null===(n=ot.current[E])||void 0===n?void 0:n.current;F&&(F.style.height="auto",F.style.minHeight="0px"),_&&(_.style.height="auto",_.style.minHeight="0px")}be||Object.keys(ut.current).forEach(function(e){var n,t;if(T(e)){var i=null===(n=ut.current[e])||void 0===n?void 0:n.current,o=null===(t=dt.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={};Un.forEach(function(e){var n,t,i=e.key,o=null===(n=nt.current[i])||void 0===n?void 0:n.current,r=null===(t=tt.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=o.getBoundingClientRect(),c=r.getBoundingClientRect();M[i]=Math.max(l.height,c.height)}});var D={left:{},right:{}},k={};if(!Qe.current)if(be){if(De&&null!==ze)if("number"==typeof ze){var A=ze,H=Xn[A],N=null===(o=it.current[A])||void 0===o?void 0:o.current;N&&H&&(H.refIndexes||[]).forEach(function(e){var n,t=Jn.findIndex(function(n){return n.selfIndex===e}),i=null===(n=ot.current[t])||void 0===n?void 0:n.current;if(i&&(Ct["left-".concat(A)]||Ct["right-".concat(t)])){var o=Math.max(N.getBoundingClientRect().height,i.getBoundingClientRect().height);D.left[A]=Math.max(D.left[A]||0,o),D.right[t]=Math.max(D.right[t]||0,o)}})}else{var L=ze.split(S)[2];if(L){F=null===(r=ut.current[L])||void 0===r?void 0:r.current,_=null===(l=dt.current[L])||void 0===l?void 0:l.current;if(F&&_){P=Math.max(F.getBoundingClientRect().height,_.getBoundingClientRect().height);k[L]=Math.max(k[L]||0,P)}}}}else{Object.keys(ut.current).forEach(function(e){var n,t;if(T(e)){var i=null===(n=ut.current[e])||void 0===n?void 0:n.current,o=null===(t=dt.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);k[e]=c,i.style.minHeight="".concat(c,"px"),o.style.minHeight="".concat(c,"px")}}});for(E=0;E<Math.min(Xn.length,Jn.length);E++){var F=null===(t=it.current[E])||void 0===t?void 0:t.current,_=null===(i=ot.current[E])||void 0===i?void 0:i.current;if(F&&_){var P=Math.max(F.getBoundingClientRect().height,_.getBoundingClientRect().height);D.left[E]=P,D.right[E]=P}}}if(Un.forEach(function(e){var n,t,i=e.key,o=null===(n=nt.current[i])||void 0===n?void 0:n.current,r=null===(t=tt.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=M[i];o.style.minHeight="".concat(l,"px"),r.style.minHeight="".concat(l,"px")}}),Qe.current||(Object.entries(D.left).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"))}),Object.entries(D.right).forEach(function(e){var n,t=e[0],i=e[1],o=null===(n=ot.current[Number(t)])||void 0===n?void 0:n.current;o&&(o.style.minHeight="".concat(i,"px"))}),be||Object.keys(k).forEach(function(e){var n,t,i=null===(n=ut.current[e])||void 0===n?void 0:n.current,o=null===(t=dt.current[e])||void 0===t?void 0:t.current;if(i&&o&&k[e]){var r=k[e];i.style.minHeight="".concat(r,"px"),o.style.minHeight="".concat(r,"px")}})),be)Xn.forEach(function(e,n){var t;(null===(t=it.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=Jn.findIndex(function(n){return n.selfIndex===e});if(-1!==v){var p=null===(t=rt.current[n])||void 0===t?void 0:t.current,f=null===(i=lt.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(De&&ze===n){var S=null!==(r=null===(o=mn.current)||void 0===o?void 0:o.getBoundingClientRect().top)&&void 0!==r?r:0,R=null!==(c=null===(l=pn.current)||void 0===l?void 0:l.getBoundingClientRect().top)&&void 0!==c?c:0,C=S+(null!==(d=null===(u=mn.current)||void 0===u?void 0:u.clientHeight)&&void 0!==d?d:1/0),I=R+(null!==(s=null===(a=pn.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 _=qt(n);_&&w.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(Xn.length,Jn.length);E++){var O=null===(c=it.current[E])||void 0===c?void 0:c.current,j=null===(u=ot.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=Jn[E])||void 0===d?void 0:d.id)||"sec-".concat(E);(Z=qt(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=Jn[E])||void 0===s?void 0:s.cognitiveData)||K&&ln[K]),isSubSection:!1})}}Object.keys(ut.current).forEach(function(e){var n,t,i,o,r,l;if(T(e)){var c=null===(n=ut.current[e])||void 0===n?void 0:n.current,u=null===(t=dt.current[e])||void 0===t?void 0:t.current;if(c&&u){for(var d=e.split("-").map(Number),a=Xn[d[0]],s=Jn[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(De&&"string"==typeof ze&&ze.includes(S)){var q=ze.split(S),V=q[0],X=q[1],J=q[2],U=(q[3],"".concat(V).concat(S).concat(X)),G=null===(v=rt.current[U])||void 0===v?void 0:v.current,Q=null===(p=lt.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(be){var re=null!==(g=null===(f=mn.current)||void 0===f?void 0:f.getBoundingClientRect().top)&&void 0!==g?g:0,le=null!==(x=null===(h=pn.current)||void 0===h?void 0:h.getBoundingClientRect().top)&&void 0!==x?x:0,ce=re+(null!==(y=null===(m=mn.current)||void 0===m?void 0:m.clientHeight)&&void 0!==y?y:1/0),ue=le+(null!==(I=null===(b=pn.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:ze})}}if(jt(w),Nt.current&&Lt.current){var ae=Nt.current.getBoundingClientRect(),se=Lt.current.getBoundingClientRect(),ve=(ae.top+ae.height/2-B.top+se.top+se.height/2-B.top)/2;Yt({x1:ae.right-B.left,x2:se.left-B.left,y:ve})}else Yt(null);if(qe.size>0){var pe=[],fe=mn.current,ge=pn.current;if(fe&&ge){var he=[],xe=fe.getBoundingClientRect().top,me=ge.getBoundingClientRect().top,ye=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))};qe.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=rt.current[a])||void 0===n?void 0:n.current,v=null===(t=lt.current[a])||void 0===t?void 0:t.current;if(!s||!v)return;var p=s.getBoundingClientRect(),f=v.getBoundingClientRect(),g=Vt(d),h=(H=p.right-B.left)+.5*((N=f.left-B.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:N,containerTop:Ie,leftIdx:e,rhsArrayIdx:e,styleColor:(null==g?void 0:g.badgeBorder)||"#6366F1",styleId:R});var I=Te(x,xe,ye),T=Te(m,me,Se),w=I-Ie,E=T-Ie,F=m>=me-4&&m<=Se+4,_="";_=(L=x>=xe-4&&x<=ye+4)&&F?C(H,w,N,E):L&&!F?"M ".concat(H,",").concat(w," L ").concat(h,",").concat(w," L ").concat(h,",").concat(E):!L&&F?"M ".concat(h,",").concat(w," L ").concat(h,",").concat(E," L ").concat(N,",").concat(E):"M ".concat(h,",").concat(w," L ").concat(h,",").concat(E),pe.push({id:R,pathD:_,style:g,leftIdx:e,rhsArrayIdx:e})}else if(be){var M=e,D=Xn[M];if(!(null===(r=null==D?void 0:D.refIndexes)||void 0===r?void 0:r.length))return;D.refIndexes.forEach(function(e){var n,t,i=Jn.findIndex(function(n){return n.selfIndex===e});if(-1!==i){var o=null===(n=rt.current[M])||void 0===n?void 0:n.current,r=null===(t=lt.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=o.getBoundingClientRect(),c=r.getBoundingClientRect(),u=qt(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,ye),m=Te(p,me,Se),y=x-Ie,b=m-Ie,S=v>=xe-4&&v<=ye+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 k=e,A=k;s=null===(i=rt.current[k])||void 0===i?void 0:i.current,v=null===(o=lt.current[A])||void 0===o?void 0:o.current;if(!s||!v)return;var H,N;p=s.getBoundingClientRect(),f=v.getBoundingClientRect(),g=qt(k),h=(H=p.right-B.left)+.5*((N=f.left-B.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(k,"-").concat(A);he.push({lhsScrollY:y,rhsScrollY:b,x1:H,x2:N,containerTop:Ie,leftIdx:k,rhsArrayIdx:A,styleColor:(null==g?void 0:g.badgeBorder)||"#6366F1",styleId:R});var L;I=Te(x,xe,ye),T=Te(m,me,Se),w=I-Ie,E=T-Ie,F=m>=me-4&&m<=Se+4,_="";_=(L=x>=xe-4&&x<=ye+4)&&F?C(H,w,N,E):L&&!F?"M ".concat(H,",").concat(w," L ").concat(h,",").concat(w," L ").concat(h,",").concat(E):!L&&F?"M ".concat(h,",").concat(w," L ").concat(h,",").concat(E," L ").concat(N,",").concat(E):"M ".concat(h,",").concat(w," L ").concat(h,",").concat(E),pe.push({id:R,pathD:_,style:g,leftIdx:k,rhsArrayIdx:A})}}),en.current=he}Ue(pe)}else Ue([]),en.current=[]}catch(e){console.error("Line render safe fail: ",e)}finally{yn.current=!1}}},[Un,Xn,Jn,ln,Ln,Kt,qt,be,De,ze,qe,Ct,It]),Jt=u(function(){var e,n,t,i,o,r,l,c,u,d,a,s,v,p,f=en.current;if(f.length&&!Qe.current){var g=null!==(n=null===(e=mn.current)||void 0===e?void 0:e.scrollTop)&&void 0!==n?n:0,h=null!==(i=null===(t=pn.current)||void 0===t?void 0:t.scrollTop)&&void 0!==i?i:0,x=null!==(r=null===(o=mn.current)||void 0===o?void 0:o.clientHeight)&&void 0!==r?r:1/0,m=null!==(c=null===(l=pn.current)||void 0===l?void 0:l.clientHeight)&&void 0!==c?c:1/0,y=null!==(d=null===(u=mn.current)||void 0===u?void 0:u.getBoundingClientRect().top)&&void 0!==d?d:0,b=null!==(s=null===(a=pn.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=Dt.current)||void 0===v?void 0:v.getBoundingClientRect().top)&&void 0!==p?p:0,T=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=$e.current[e.styleId+"-stroke"],o=$e.current[e.styleId+"-bg"];if(i||o){var r,l=T(n,y,S),c=T(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(){rn.current=Xt},[Xt]);var Ut=r(null),Gt=r(null),Qt=u(function(){en.current.length>0&&!Qe.current||(null!==Ut.current&&clearTimeout(Ut.current),Ut.current=setTimeout(function(){rn.current(),Ut.current=null},50))},[]),Zt=u(function(){Oe(!0),Ne(!1),null!==Gt.current&&clearTimeout(Gt.current),null!==Ut.current&&(clearTimeout(Ut.current),Ut.current=null),Gt.current=setTimeout(function(){var e,n,t,i,o,r,l,c,u,d;if(en.current=[],tn.current&&null!==on.current&&null!==At.current){var a=on.current,s=At.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=rt.current[x])||void 0===e?void 0:e.current)||null,p=(null===(n=lt.current[x])||void 0===n?void 0:n.current)||null,f=(null===(t=ut.current[h[2]])||void 0===t?void 0:t.current)||(null===(i=it.current[Number(h[2])])||void 0===i?void 0:i.current)||null,g=(null===(o=dt.current[h[3]])||void 0===o?void 0:o.current)||(null===(r=ot.current[Number(h[3])])||void 0===r?void 0:r.current)||null}else v=(null===(l=at.current[a])||void 0===l?void 0:l.current)||null,f=(null===(c=it.current[a])||void 0===c?void 0:c.current)||null,p=(null===(u=ct.current[s])||void 0===u?void 0:u.current)||null,g=(null===(d=ot.current[s])||void 0===d?void 0:d.current)||null;if(v&&p&&f&&g){if(f.style.paddingTop="0px",g.style.paddingTop="0px",!be){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=mn.current,C=pn.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)}}}rn.current(),tn.current&&Ne(!0),Oe(!1),Gt.current=null},150)},[be,Xn,Jn]),$t=u(function(e){var n,t,i,o,r,l,c,u,d,a;if(null!==bn.current&&Sn.current&&Math.abs(e.currentTarget.scrollTop-bn.current)<=2){var s=Sn.current;bn.current=null,Sn.current=null,s()}if(!Ye.current){if(be||Qt(),tn.current){var v=on.current,p=At.current,f=mn.current,g=pn.current;if(null!==v&&null!==p&&f&&g){var h="string"==typeof v&&v.includes(S)?null===(n=rt.current["".concat(v.split(S)[0]).concat(S).concat(v.split(S)[1])])||void 0===n?void 0:n.current:null===(t=at.current[v])||void 0===t?void 0:t.current,x="string"==typeof p&&p.includes(S)?null===(i=lt.current["".concat(p.split(S)[0]).concat(S).concat(p.split(S)[1])])||void 0===i?void 0:i.current:null===(o=ct.current[p])||void 0===o?void 0:o.current;if(h&&x&&Ht.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=rt.current[R])||void 0===r?void 0:r.current,y=null===(l=lt.current[R])||void 0===l?void 0:l.current}else m=null===(c=rt.current[v])||void 0===c?void 0:c.current,y=null===(u=lt.current[p])||void 0===u?void 0:u.current;var C=null!==(a=null===(d=Dt.current)||void 0===d?void 0:d.getBoundingClientRect().top)&&void 0!==a?a:0,I=f.getBoundingClientRect().top,T=I+f.clientHeight;g.getBoundingClientRect().top;g.clientHeight;if(m&&y){var B=m.getBoundingClientRect(),w=y.getBoundingClientRect(),E=B.top+B.height/2;w.top,w.height;var F=((M=E,D=I,k=T,Math.max(D,Math.min(k,M)))-C).toString();Ht.current.setAttribute("y1",F),Ht.current.setAttribute("y2",F);var _=E>=I-4&&E<=T+4;Ht.current.setAttribute("visibility",_?"visible":"hidden")}}}}var M,D,k;en.current.length>0&&!nn.current&&(nn.current=!0,requestAnimationFrame(function(){Jt(),nn.current=!1}))}},[Jt,be,Qt]);c(function(){var e=setTimeout(Qt,250);window.addEventListener("resize",Zt);var n=null,t=null;return sn.current&&(n=new ResizeObserver(Qt)).observe(sn.current),Dt.current&&(t=new ResizeObserver(Qt)).observe(Dt.current),function(){clearTimeout(e),null!==Ut.current&&clearTimeout(Ut.current),null!==Gt.current&&clearTimeout(Gt.current),window.removeEventListener("resize",Zt),null==n||n.disconnect(),null==t||t.disconnect()}},[qn,Vn,ft,Un,Ct,It,Xn,Jn,Ln,Qt,Zt,De,ze,He,qe]),c(function(){tn.current=De},[De]),c(function(){on.current=ze},[ze]);var ei=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";Nn(),null!=e&&(n?_e("No counterpart exists for this section."):De&&ze===e?r?St():null==l||l():(Ve(new Set([e])),Ue([]),en.current=[],we(!0),Ye.current=!0,We(e),on.current=e,ke(!0),tn.current=!0,Ne(!1),fn.current&&(fn.current.style.height="0px"),gn.current&&(gn.current.style.height="0px"),hn.current&&(hn.current.style.height="0px"),xn.current&&(xn.current.style.height="0px"),requestAnimationFrame(function(){var n,t,i,o,r,u="string"==typeof e&&e.includes(S),d=null,a=null,s=null;if(u){var v=e.split(S),p="".concat(v[0]).concat(S).concat(v[1]);d=(null===(n=rt.current[p])||void 0===n?void 0:n.current)||null,a=(null===(t=lt.current[p])||void 0===t?void 0:t.current)||null,s=a?e:null}else if(d=(null===(i=at.current[e])||void 0===i?void 0:i.current)||null,be){var f=Xn[e],g=(null==f?void 0:f.refIndexes)||[];if(g.length>0){var h=g[0],x=Jn.findIndex(function(e){return e.selfIndex===h});-1!==x&&(a=(null===(r=ct.current[x])||void 0===r?void 0:r.current)||null,s=x)}}else a=(null===(o=ct.current[e])||void 0===o?void 0:o.current)||null,s=a?e:null;At.current=s;var m=mn.current,y=pn.current,b=function(){!function(){var n,t,i,o,r,l,c,d,a,v,p,f,g=null,h=null,x=null,m=null;if(u){var y=e.split(S),b="".concat(y[0]).concat(S).concat(y[1]);g=(null===(n=ut.current[y[2]])||void 0===n?void 0:n.current)||(null===(t=it.current[Number(y[2])])||void 0===t?void 0:t.current)||null,h=(null===(i=dt.current[y[3]])||void 0===i?void 0:i.current)||(null===(o=ot.current[Number(y[3])])||void 0===o?void 0:o.current)||null,x=(null===(r=rt.current[b])||void 0===r?void 0:r.current)||g,m=(null===(l=lt.current[b])||void 0===l?void 0:l.current)||h}else{var R=Number(e),C=null!==s?Number(s):R;g=(null===(c=it.current[R])||void 0===c?void 0:c.current)||null,h=(null===(d=ot.current[C])||void 0===d?void 0:d.current)||null,x=(null===(a=rt.current[R])||void 0===a?void 0:a.current)||(null===(v=at.current[R])||void 0===v?void 0:v.current)||g,m=(null===(p=lt.current[C])||void 0===p?void 0:p.current)||(null===(f=ct.current[C])||void 0===f?void 0:f.current)||h}if(x&&m&&g&&h){g.style.paddingTop="0px",h.style.paddingTop="0px";var I=x.getBoundingClientRect(),T=m.getBoundingClientRect(),B=I.top-T.top;B>0?h.style.paddingTop="".concat(B,"px"):B<0&&(g.style.paddingTop="".concat(Math.abs(B),"px"))}}(),Ne(!0),rn.current&&rn.current(),Ye.current=!1,"right"===c&&y?y.dispatchEvent(new Event("scroll")):m&&m.dispatchEvent(new Event("scroll")),we(!1),null==l||l()};if(!d||!m)return Ye.current=!1,we(!1),void(null==l||l());if(a&&y){if(!be){var R=0;R="right"===c?a?a.getBoundingClientRect().top:0:d?d.getBoundingClientRect().top:0;var C=sn.current,T=(null==C?void 0:C.getBoundingClientRect().top)||0,B=C?C.scrollTop+R-T-150:0;return C?void I(C,B,200,b):void b()}var w=d.getBoundingClientRect().top-m.getBoundingClientRect().top+m.scrollTop,E=a.getBoundingClientRect().top-y.getBoundingClientRect().top+y.scrollTop,F=200;if("left"===c){var _=E-(w-m.scrollTop);_<0&&fn.current&&(fn.current.style.height="".concat(Math.abs(_),"px")),requestAnimationFrame(function(){var e,n=y.scrollHeight-y.clientHeight;if(_<0)e=0;else{if(_>n){var t=_-n;return gn.current&&(gn.current.style.height="".concat(t+150,"px")),void requestAnimationFrame(function(){I(y,_,F,b)})}e=_}I(y,e,F,b)})}else{var M=w-(E-y.scrollTop);M<0&&hn.current&&(hn.current.style.height="".concat(Math.abs(M),"px")),requestAnimationFrame(function(){var e,n=m.scrollHeight-m.clientHeight;if(M<0)e=0;else{if(M>n){var t=M-n;return xn.current&&(xn.current.style.height="".concat(t+150,"px")),void requestAnimationFrame(function(){I(m,M,F,b)})}e=M}I(m,e,F,b)})}}else b()})))},[ze,Nn,Jn,De,be,Xn,St]),ni=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";(null===(o=pn.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=lt.current[l])||void 0===e?void 0:e.current:null===(t=rt.current[l])||void 0===t?void 0:t.current}return"right"===c?null===(i=lt.current[n])||void 0===i?void 0:i.current:null===(o=rt.current[n])||void 0===o?void 0:o.current};if(t)return St(),Ve(new Set),Ue([]),en.current=[],void(r&&requestAnimationFrame(function(){var e=u()||l;Mn({open:!0,anchorEl:e,summary:i})}));ei(n,t,r?{toggleIfSame:!1,sourceSide:c,onReady:function(){var e=u()||l;Mn({open:!0,anchorEl:e,summary:i})}}:{toggleIfSame:!1,sourceSide:c})},[ei,Hn,Mn,St]),ti=u(function(){var e,n=Tn.sectionIdx,t=Tn.isOrphan;if(Dn(),null!=n){var i="left";Tn.anchorEl&&(null===(e=pn.current)||void 0===e?void 0:e.contains(Tn.anchorEl))&&(i="right"),ei(n,t,{sourceSide:i})}},[ei,Tn.isOrphan,Tn.sectionIdx,Tn.anchorEl,Dn]),ii=u(function(){Dn(),St(),Ve(new Set),Ue([]),en.current=[]},[Dn,St]),oi=null!==Tn.sectionIdx&&qe.has(Tn.sectionIdx),ri=P({proposedSections:Xn,existingSections:Jn,parentDeviationRecord:Gn,expandedSections:Ct,maintainRelativeOrder:!!be,scrollContainerRef:sn,leftContainerRef:mn,lhsBadgeRefs:rt,rhsBadgeRefs:lt}),li=ri.showDeviationNavigation,ci=ri.showOpenNodeRef,ui=l(function(){if(!xe)return null;for(var e in Gn){if((Gn[e]||[]).some(function(e){return e.id===xe}))return e}return null},[xe,Gn]),di=r(null),ai=r(null);c(function(){if(xe&&di.current!==xe){ai.current!==xe&&(Dn(),Hn(),St(),Ve(new Set),Ue([]),en.current=[],ai.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 Gn){var f=Gn[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}),h=Jn.findIndex(function(e){return e.id===s}),x=-1===g&&-1!==h;if(x){if(!(be?!!Ct["right-".concat(h)]:!!Ct[String(h)]))return Bt(h,"right"),t+=1,void(i=setTimeout(l,450))}else if(!(be?!!Ct["left-".concat(g)]:!!Ct[String(g)])&&g>=0)return Bt(g,"left"),t+=1,void(i=setTimeout(l,450));var m=r(Xn,v.id),y=r(Jn,v.id);if(m&&!y&&!x){var b=m.split("-"),R=Number(b[0]);if(be){var C=null===(u=null===(c=Xn[R])||void 0===c?void 0:c.refIndexes)||void 0===u?void 0:u[0],I=Jn.findIndex(function(e){return e.selfIndex===C});-1!==I&&(R=I)}y=n([R],b.slice(1),!0).join("-")}if(m||y){var T,B=m||"",w=y||"",E="".concat(v.id).concat(S,"0").concat(S).concat(B).concat(S).concat(w),F="".concat(v.id).concat(S,"0"),_=null===(d=rt.current[F])||void 0===d?void 0:d.current,M=null===(a=lt.current[F])||void 0===a?void 0:a.current,D=x?M:_;if(T=be?x?pn.current:mn.current:sn.current,D&&T){var k=D.getBoundingClientRect();if(0===k.height)return void((t+=1)<20&&(i=setTimeout(l,o)));var A=T.getBoundingClientRect(),H=k.top-A.top+T.scrollTop-A.height/2+k.height/2,N=function(){var n,t,i,o,r;if(!e){di.current=xe;var l=window.getComputedStyle(D).color;_&&(_.style.transition="box-shadow 300ms ease-in-out",_.style.boxShadow="0 0 10px ".concat(l)),M&&(M.style.transition="box-shadow 300ms ease-in-out",M.style.boxShadow="0 0 10px ".concat(l)),setTimeout(function(){_&&(_.style.boxShadow=""),M&&(M.style.boxShadow="")},2e3);var c=(null===(t=null===(n=v.evaluationResult)||void 0===n?void 0:n.deviations)||void 0===t?void 0:t[0])||v,u=(null===(i=v.evaluationResult)||void 0===i?void 0:i.evaluation_outputs)||v.evaluation_outputs;if(!(_&&M&&!x)){var d=x?(null===(o=lt.current[F])||void 0===o?void 0:o.current)||M:(null===(r=rt.current[F])||void 0===r?void 0:r.current)||_;return Mn({open:!0,anchorEl:d,summary:{deviation_summary:c.deviation_summary||c,evaluation_outputs:u}}),void(null==me||me())}ei(E,!1,{toggleIfSame:!1,sourceSide:"left",onReady:function(){var e,n=(null===(e=rt.current[F])||void 0===e?void 0:e.current)||_;Mn({open:!0,anchorEl:n,summary:{deviation_summary:c.deviation_summary||c,evaluation_outputs:u}})}})}};Math.abs(T.scrollTop-H)<=2?N():(bn.current=H,Sn.current=N,T.scrollTo({top:H,behavior:"smooth"}),i&&clearTimeout(i),i=setTimeout(function(){if(Sn.current){bn.current=null;var e=Sn.current;Sn.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,Gn,Xn,Jn,be,Ct,Bt,ei,Mn]);var si=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:It,setExpandedSubSections:Tt,maintainRelativeOrder:be||!1,proposedSections:Xn,existingSections:Jn,treeData:ce,deviationNumberRegistry:Qn,connectedSections:qe,activeSideBySideSection:ze,resolvedMarkdownStyles:an,getSubSectionRef:vt,getSubSectionCompareStyle:Vt,getBadgeRef:pt,openMoreFunctionsPopup:Ft,openSummaryPopup:ni,resetSideBySide:St,setConnectedSections:Ve,setConnectedLines:Ue,cachedConnectedPositions:en})};return t(d,e({ref:vn,sx:e(e({display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif'},be?{}:{overflow:"visible"}),{position:"relative"})},{children:[Ce&&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(D,{})})),_n.open&&i(W,{open:_n.open,anchorEl:_n.anchorEl,containerEl:kt.current,clipTopEl:Nt.current,scrollContainerEl:sn.current,onClose:ii,summary:_n.summary}),i(M,{open:Tn.open,anchorEl:Tn.anchorEl,sectionTitle:Tn.sectionTitle,referenceSectionTitle:Tn.refSectionTitle,onClose:Nn,onOpenCognitiveCompare:_t,onOpenSideBySide:ti,onConnect:Mt,isConnected:oi,isOrphan:Tn.isOrphan}),Cn.open&&i(_,{open:Cn.open,popupRef:An,position:wn,popupConfig:fe,onClose:function(){En(null),In(function(n){return e(e({},n),{open:!1})}),kn(null)},markdownStyles:se,sectionTitle:Cn.sectionTitle,referenceSectionTitle:Cn.refSectionTitle,cognitiveData:Cn.cognitiveData,anchorEl:Cn.anchorEl,sectionAnchorEl:Cn.sectionAnchorEl,scrollContainerEl:sn.current,badgeStyle:Cn.badgeStyle,docData:Cn.docData,deviationData:Cn.deviationData,isLoading:Cn.isLoading}),i(a,e({open:!!Fe,autoHideDuration:8e3,onClose:function(){return _e(null)},anchorOrigin:{vertical:"top",horizontal:"center"}},{children:i(s,e({onClose:function(){return _e(null)},severity:"error",sx:{width:"100%",whiteSpace:"pre-line"}},{children:Fe}))})),i(O,{componentHeaderText:le,displayConfig:pe,maintainRelativeOrder:be,onToggleView:function(e){Ie(!0),setTimeout(function(){Se(!e),St(),Dn(),Ve(new Set),Ue([]),en.current=[],requestAnimationFrame(function(){requestAnimationFrame(function(){setTimeout(function(){Ie(!1)},600)})})},50)}}),i(d,e({ref:sn,onScroll:$t,sx:{flex:1,minHeight:0,pt:1.5,pb:1,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",overflowY:be?"hidden":"auto",borderTop:gt&&ht?"none":"1.5px solid #EEF0F4"}},{children:i(d,e({sx:e({display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"},be?{flex:1,minHeight:0}:{})},{children:t(d,e({ref:Dt,sx:e({display:"grid",gridTemplateColumns:"minmax(0, 1fr) 180px minmax(0, 1fr)",gap:"40px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0},be?{flex:1,overflow:"visible"}:{})},{children:[t("svg",e({ref:Ge,style:{position:"absolute",top:0,left:0,width:un.width||"100%",height:un.height||"100%",pointerEvents:"none",zIndex:10,overflow:"visible",opacity:Pe?0:1,transition:"opacity 0.15s ease-in-out"}},{children:[Wt&&i("g",{children:i("line",{x1:Wt.x1,y1:Wt.y,x2:Wt.x2,y2:Wt.y,stroke:bt.badgeBorder,strokeWidth:"1.5"})}),Ot.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?De&&ze===n.subSectionKeyPath&&He:De&&ze===n.sectionIdx&&He)return null;if(!be){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=Jn[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=Jn[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 _=1;_<R.length;_++)(null==T?void 0:T.subsections)&&(T=T.subsections[R[_]]);for(_=1;_<I.length;_++)(null==B?void 0:B.subsections)&&(B=B.subsections[I[_]]);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),D=(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||D;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&&(Cn.open&&Fn===n.id?Hn():(kn(n.id),Et(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(k,{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:Cn.open&&Fn===n.id?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))}))]},n.id)}return null}),Je.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){$e.current[u]=e},d:r,fill:"none",stroke:"#FFFFFF",strokeWidth:"4",strokeOpacity:"0.7"}),i("path",{ref:function(e){$e.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)"},be?{flex:1,overflow:"visible"}:{})},{children:[i(d,e({ref:Nt,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:Wn,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:Wn}))}))})),t(d,e({ref:mn,onScroll:$t,sx:e({p:"12px",display:"flex",flexDirection:"column"},be?{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:hn,style:{width:"100%",height:"0px",flexShrink:0}}),$n&&Xn.map(function(n,o){var r,l,c=!n.title&&!n.content;if(be&&c)return null;var u=n,a=qt(o,"left"),s=be?!(null===(r=u.refIndexes)||void 0===r?void 0:r.length)||u.selfIndex<0:!Jn[o],v=be?"number"==typeof u.selfIndex&&u.selfIndex>=0?u.selfIndex+1:null:o+1,p=qe.has(o),f=y(u.evaluationResult,null==a?void 0:a.deviationLabel);return i(d,e({ref:st(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"},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:st("left-accordion-".concat(o)),mb:0,treeData:ce,proposedSections:Xn,existingSections:Jn,deviationNumberRegistry:Qn,getSectionCompareStyle:qt,getBadgeRef:pt,connectedSections:qe,openMoreFunctionsPopup:Ft,openSummaryPopup:ni,deviationNodeIdToView:xe,deviationTargetParentId:ui,parentNodeId:(null===(l=null==ce?void 0:ce.input_index_map)||void 0===l?void 0:l[0])||"",isExpanded:be?!!Ct["left-".concat(o)]:!!Ct[String(o)],onToggle:function(){ii(),Bt(o,"left")},navigation:n.id?li[n.id]:null,showOpenNodeRef:ci,resolvedMarkdownStyles:an,maintainRelativeOrder:be,renderSubSections:si})})),be&&a&&t(d,e({ref:rt.current[o],onClick:function(e){var t=be?Jn.find(function(e){var n;return null===(n=u.refIndexes)||void 0===n?void 0:n.includes(e.selfIndex)})||{title:"",content:""}:Jn[o]||{title:"",content:""};Ft(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(k,{color:a.badgeText})})),i(g,{size:11,color:a.badgeText})]}))]}))}),"left-row-".concat(o))}),i("div",{ref:xn,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(),Cn.open&&Fn===xt?Hn():(kn(xt),Et(wt(n.currentTarget,{title:"",content:"",evaluationResult:mt,cognitiveData:{section_id:"",decisioning:[],gap:[],relevance_score:0,isMissingRationale:!0}},null,xt,!0,e(e({},bt),{label:""}))))},sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:"5px",top:"-5px",borderRadius:"20px",bgcolor:bt.badgeBg,color:bt.badgeText,border:"1px solid ".concat(bt.badgeBorder),fontSize:"12px",fontWeight:600,whiteSpace:"nowrap",position:"relative",zIndex:1,pointerEvents:"auto",cursor:"pointer"}},{children:[null!=yt?yt:i(k,{}),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:Cn.open&&Fn===xt?"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},be?{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:Yn,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:Yn}))}))})),t(d,e({ref:pn,onScroll:$t,sx:e({p:"12px",display:"flex",flexDirection:"column"},be?{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:fn,style:{width:"100%",height:"0px",flexShrink:0}}),$n&&Jn.map(function(n,o){var r,l=n,c=[],u=!1,a=null,s=-1;if(be){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 qe.has(n)&&(null===(t=e.refIndexes)||void 0===t?void 0:t.includes(l.selfIndex))});(u=-1!==v)&&(a=qt(v))}else c=[o+1],(u=qe.has(o))&&(a=qt(o));var p=qt(be&&-1!==s?s:o);return i(d,e({ref:ct.current[o],sx:{mb:1,width:"100%"}},{children:t(d,e({sx:{position:"relative",width:"100%"}},{children:[i(d,e({ref:ot.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:st("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:be?!!Ct["right-".concat(o)]:!!Ct[String(o)],treeData:ce,proposedSections:Xn,existingSections:Jn,deviationNumberRegistry:Qn,getBadgeRef:pt,getSectionCompareStyle:qt,connectedSections:qe,openMoreFunctionsPopup:Ft,openSummaryPopup:ni,deviationNodeIdToView:xe,deviationTargetParentId:ui,onToggle:function(){ii(),Bt(o,"right")},navigation:n.id?li[n.id]:null,showOpenNodeRef:ci,resolvedMarkdownStyles:an,maintainRelativeOrder:be,renderSubSections:si})})),be&&p&&i(d,e({ref:lt.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:gn,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 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 _ from"./CognitivePopup.js";import M from"./MoreFunctionsPopup.js";import D from"./LoaderComponent.js";import k from"./components/ThreeDotsLoader.js";import{useCognitiveTreeData as A}from"./hooks/useCompareData.js";import{useComparePopups as N}from"./hooks/useComparePopups.js";import{useSectionRefs as H}from"./hooks/useSectionRefs.js";import{useAccordionState as L}from"./hooks/useAccordionState.js";import{useDeviationNavigation as P}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=Y.resetDeviationNodeId,ye=o(pe.maintainRelativeOrder),be=ye[0],Se=ye[1],Re=o(!1),Ce=Re[0],Ie=Re[1],Te=o(!1),Be=Te[0],we=Te[1],Ee=o(null),Fe=Ee[0],_e=Ee[1],Me=o(!1),De=Me[0],ke=Me[1],Ae=o(!1),Ne=Ae[0],He=Ae[1],Le=o(!1),Pe=Le[0],Oe=Le[1],je=o(null),ze=je[0],We=je[1],Ye=r(!1),Ke=o(new Set),qe=Ke[0],Ve=Ke[1],Xe=o([]),Je=Xe[0],Ue=Xe[1],Ge=r(null),Qe=r(!1),Ze=r(null),$e=r({}),en=r([]),nn=r(!1),tn=r(!1),on=r(null),rn=r(function(){}),ln=l(function(){return(null==ce?void 0:ce.cognitive_decisioning)||{}},[ce]),cn=o({width:0,height:0}),un=cn[0],dn=cn[1],an=l(function(){return e(e({},T),se)},[se]),sn=r(null),vn=r(null),pn=r(null),fn=r(null),gn=r(null),hn=r(null),xn=r(null),mn=r(null),yn=r(!1),bn=r(null),Sn=r(null),Rn=N(sn),Cn=Rn.cognitivePopup,In=Rn.setCognitivePopup,Tn=Rn.moreFunctions,Bn=Rn.setMoreFunctions,wn=Rn.position,En=Rn.setPosition,Fn=Rn.activeBadgeId,_n=Rn.summaryPopup,Mn=Rn.setSummaryPopup,Dn=Rn.closeSummaryPopup,kn=Rn.setActiveBadgeId,An=Rn.popupRef,Nn=Rn.closeCognitivePopup,Hn=Rn.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: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]),Pn=o(null),On=Pn[0];Pn[1];var jn=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,zn=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,Wn=m(de||jn||"Uploaded Contract"),Yn=m(ae||zn||"Reference Template"),Kn=A(ce,be,he,Ln),qn=Kn.activeProposed,Vn=Kn.existingRule,Xn=Kn.proposedSections,Jn=Kn.existingSections,Un=Kn.visibleFields,Gn=Kn.parentDeviationRecord,Qn=Kn.deviationNumberRegistry,Zn=Kn.parseError;c(function(){Zn&&_e("Failed to load comparison: ".concat(Zn))},[Zn]);var $n=Xn.length>0||Jn.length>0,et=H(Un.map(function(e){return e.key}),Math.max(Xn.length,Jn.length)),nt=et.leftRefs,tt=et.rightRefs,it=et.sectionLeftRefs,ot=et.sectionRightRefs,rt=et.lhsBadgeRefs,lt=et.rhsBadgeRefs,ct=et.sectionRightRowRefs,ut=et.subSectionLeftRefs,dt=et.subSectionRightRefs,at=et.sectionRowRefs,st=et.getSectionRowRef,vt=et.getSubSectionRef,pt=et.getBadgeRef,ft=Vn.analysis,gt=m(null===(Q=null===(G=null==ft?void 0:ft.rule_difference_comparison)||void 0===G?void 0:G.summary)||void 0===Q?void 0:Q.overall_summary),ht=!!gt.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),xt=null!==(Z=null==ce?void 0:ce.base_root_id)&&void 0!==Z?Z:"-1";null==ce||ce[xt];var mt=(null===($=null==he?void 0:he[xt])||void 0===$?void 0:$.evaluation_result)||(null===(ne=null===(ee=null==ce?void 0:ce.nodes)||void 0===ee?void 0:ee[xt])||void 0===ne?void 0:ne.evaluation_result)||null,yt=y(mt),bt=b(null!==(oe=null===(ie=null===(te=null==mt?void 0:mt.evaluation_outputs)||void 0===te?void 0:te.metadata)||void 0===ie?void 0:ie.label_color)&&void 0!==oe?oe:""),St=u(function(){var e,n,t,i,o,r;ke(!1),tn.current=!1;var l=on.current,c=At.current;if(null!==l)if("string"==typeof l&&l.includes(S)){var u=l.split(S);(d=(null===(e=ut.current[u[2]])||void 0===e?void 0:e.current)||(null===(n=it.current[Number(u[2])])||void 0===n?void 0:n.current))&&(d.style.paddingTop="0px")}else{var d;(d=null===(t=it.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=dt.current[u[3]])||void 0===i?void 0:i.current)||(null===(o=ot.current[Number(u[3])])||void 0===o?void 0:o.current))&&(a.style.paddingTop="0px")}else{var a;(a=null===(r=ot.current[c])||void 0===r?void 0:r.current)&&(a.style.paddingTop="0px")}We(null),on.current=null,At.current=null,He(!1),we(!1),fn.current&&(fn.current.style.height="0px"),gn.current&&(gn.current.style.height="0px"),hn.current&&(hn.current.style.height="0px"),xn.current&&(xn.current.style.height="0px")},[]),Rt=L({maintainRelativeOrder:!!be,proposedSections:Xn,existingSections:Jn,activeSideBySideSection:ze,connectedSections:qe,resetSideBySide:St,setConnectedSections:Ve,setConnectedLines:Ue,cachedConnectedPositions:en,svgContainerRef:Ge,isAnimatingRef:Qe,animationTimerRef:Ze,calculateLinesRef:rn,sectionLeftRefs:it,sectionRightRefs:ot,subSectionLeftRefs:ut,subSectionRightRefs:dt}),Ct=Rt.expandedSections,It=Rt.expandedSubSections,Tt=Rt.setExpandedSubSections,Bt=Rt.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?ln[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=at.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}},[ln,ce]),Et=u(function(e){Hn(),En(null),In(e)},[Hn]),Ft=function(e,n,t,i,o,r){var l;if(e.stopPropagation(),Tn.open&&Tn.sectionIdx===o)Hn();else{var c=e.currentTarget,u="left";(null===(l=pn.current)||void 0===l?void 0:l.contains(c))&&(u="right");tn.current&&St(),Ve(new Set),Ue([]),en.current=[],Nn(),_n.open?ii():Dn(),requestAnimationFrame(function(){var e=function(){var e,n,t,i;if("string"==typeof o&&o.includes(S)){var r=o.split(S),l="".concat(r[0]).concat(S).concat(r[1]);return"right"===u?null===(e=lt.current[l])||void 0===e?void 0:e.current:null===(n=rt.current[l])||void 0===n?void 0:n.current}return"right"===u?null===(t=lt.current[o])||void 0===t?void 0:t.current:null===(i=rt.current[o])||void 0===i?void 0:i.current}()||c;Bn(wt(e,n,i,o,t,r))})}},_t=u(function(){null!==Tn.sectionIdx&&Tn.anchorEl?Et(e(e({},Tn),{open:!0})):Hn()},[Tn,Hn,Et]),Mt=u(function(){var e=Tn.sectionIdx,n=Tn.isOrphan;Hn(),Dn(),null!==e&&(n?_e("No counterpart exists to connect to."):(tn.current&&St(),Ue([]),en.current=[],Ve(function(n){return n.has(e)?new Set:new Set([e])}),setTimeout(function(){rn.current&&rn.current()},50)))},[Tn.sectionIdx,Tn.isOrphan,Hn,Dn,St]),Dt=r(null),kt=r(null),At=r(null),Nt=r(null),Ht=r(null),Lt=r(null),Pt=o([]),Ot=Pt[0],jt=Pt[1];r(null);var zt=o(null),Wt=zt[0],Yt=zt[1];c(function(){if(On){var e=Ln.fields.find(function(e){return e.analysisKey===On||e.key===On});if(e){var n=nt.current[e.key]||tt.current[e.key];(null==n?void 0:n.current)&&setTimeout(function(){return n.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[On,Ln.fields]);var Kt=u(function(e){var n,t,i,o,r,l,c,u,d,a=null===(n=null==ft?void 0:ft.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}},[ft]),qt=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],be&&a){var v=Jn.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=Jn[n];else if(s=Jn[n],be&&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,Jn,ln,Ln,be]),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=Jn[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=ln[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,Jn,ln,Ln]),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(!yn.current&&!Qe.current){yn.current=!0;try{if(!Dt.current)return;var T=function(e){var n=e.split("-"),t=n[0];if(!Ct[t]&&!1===be)return!1;if(be&&!Ct["left-".concat(t)]&&!Ct["right-".concat(t)]&&!Ct[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},B=Dt.current.getBoundingClientRect();dn({width:B.width,height:B.height});var w=[];if(Un.forEach(function(e){var n,t,i=e.key,o=null===(n=nt.current[i])||void 0===n?void 0:n.current,r=null===(t=tt.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")}),!Qe.current){for(var E=0;E<Math.max(Xn.length,Jn.length);E++){var F=null===(e=it.current[E])||void 0===e?void 0:e.current,_=null===(n=ot.current[E])||void 0===n?void 0:n.current;F&&(F.style.height="auto",F.style.minHeight="0px"),_&&(_.style.height="auto",_.style.minHeight="0px")}be||Object.keys(ut.current).forEach(function(e){var n,t;if(T(e)){var i=null===(n=ut.current[e])||void 0===n?void 0:n.current,o=null===(t=dt.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={};Un.forEach(function(e){var n,t,i=e.key,o=null===(n=nt.current[i])||void 0===n?void 0:n.current,r=null===(t=tt.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=o.getBoundingClientRect(),c=r.getBoundingClientRect();M[i]=Math.max(l.height,c.height)}});var D={left:{},right:{}},k={};if(!Qe.current)if(be){if(De&&null!==ze)if("number"==typeof ze){var A=ze,N=Xn[A],H=null===(o=it.current[A])||void 0===o?void 0:o.current;H&&N&&(N.refIndexes||[]).forEach(function(e){var n,t=Jn.findIndex(function(n){return n.selfIndex===e}),i=null===(n=ot.current[t])||void 0===n?void 0:n.current;if(i&&(Ct["left-".concat(A)]||Ct["right-".concat(t)])){var o=Math.max(H.getBoundingClientRect().height,i.getBoundingClientRect().height);D.left[A]=Math.max(D.left[A]||0,o),D.right[t]=Math.max(D.right[t]||0,o)}})}else{var L=ze.split(S)[2];if(L){F=null===(r=ut.current[L])||void 0===r?void 0:r.current,_=null===(l=dt.current[L])||void 0===l?void 0:l.current;if(F&&_){P=Math.max(F.getBoundingClientRect().height,_.getBoundingClientRect().height);k[L]=Math.max(k[L]||0,P)}}}}else{Object.keys(ut.current).forEach(function(e){var n,t;if(T(e)){var i=null===(n=ut.current[e])||void 0===n?void 0:n.current,o=null===(t=dt.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);k[e]=c,i.style.minHeight="".concat(c,"px"),o.style.minHeight="".concat(c,"px")}}});for(E=0;E<Math.min(Xn.length,Jn.length);E++){var F=null===(t=it.current[E])||void 0===t?void 0:t.current,_=null===(i=ot.current[E])||void 0===i?void 0:i.current;if(F&&_){var P=Math.max(F.getBoundingClientRect().height,_.getBoundingClientRect().height);D.left[E]=P,D.right[E]=P}}}if(Un.forEach(function(e){var n,t,i=e.key,o=null===(n=nt.current[i])||void 0===n?void 0:n.current,r=null===(t=tt.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=M[i];o.style.minHeight="".concat(l,"px"),r.style.minHeight="".concat(l,"px")}}),Qe.current||(Object.entries(D.left).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"))}),Object.entries(D.right).forEach(function(e){var n,t=e[0],i=e[1],o=null===(n=ot.current[Number(t)])||void 0===n?void 0:n.current;o&&(o.style.minHeight="".concat(i,"px"))}),be||Object.keys(k).forEach(function(e){var n,t,i=null===(n=ut.current[e])||void 0===n?void 0:n.current,o=null===(t=dt.current[e])||void 0===t?void 0:t.current;if(i&&o&&k[e]){var r=k[e];i.style.minHeight="".concat(r,"px"),o.style.minHeight="".concat(r,"px")}})),be)Xn.forEach(function(e,n){var t;(null===(t=it.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=Jn.findIndex(function(n){return n.selfIndex===e});if(-1!==v){var p=null===(t=rt.current[n])||void 0===t?void 0:t.current,f=null===(i=lt.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(De&&ze===n){var S=null!==(r=null===(o=mn.current)||void 0===o?void 0:o.getBoundingClientRect().top)&&void 0!==r?r:0,R=null!==(c=null===(l=pn.current)||void 0===l?void 0:l.getBoundingClientRect().top)&&void 0!==c?c:0,C=S+(null!==(d=null===(u=mn.current)||void 0===u?void 0:u.clientHeight)&&void 0!==d?d:1/0),I=R+(null!==(s=null===(a=pn.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 _=qt(n);_&&w.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(Xn.length,Jn.length);E++){var O=null===(c=it.current[E])||void 0===c?void 0:c.current,j=null===(u=ot.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=Jn[E])||void 0===d?void 0:d.id)||"sec-".concat(E);(Z=qt(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=Jn[E])||void 0===s?void 0:s.cognitiveData)||K&&ln[K]),isSubSection:!1})}}Object.keys(ut.current).forEach(function(e){var n,t,i,o,r,l;if(T(e)){var c=null===(n=ut.current[e])||void 0===n?void 0:n.current,u=null===(t=dt.current[e])||void 0===t?void 0:t.current;if(c&&u){for(var d=e.split("-").map(Number),a=Xn[d[0]],s=Jn[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(De&&"string"==typeof ze&&ze.includes(S)){var q=ze.split(S),V=q[0],X=q[1],J=q[2],U=(q[3],"".concat(V).concat(S).concat(X)),G=null===(v=rt.current[U])||void 0===v?void 0:v.current,Q=null===(p=lt.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(be){var re=null!==(g=null===(f=mn.current)||void 0===f?void 0:f.getBoundingClientRect().top)&&void 0!==g?g:0,le=null!==(x=null===(h=pn.current)||void 0===h?void 0:h.getBoundingClientRect().top)&&void 0!==x?x:0,ce=re+(null!==(y=null===(m=mn.current)||void 0===m?void 0:m.clientHeight)&&void 0!==y?y:1/0),ue=le+(null!==(I=null===(b=pn.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:ze})}}if(jt(w),Ht.current&&Lt.current){var ae=Ht.current.getBoundingClientRect(),se=Lt.current.getBoundingClientRect(),ve=(ae.top+ae.height/2-B.top+se.top+se.height/2-B.top)/2;Yt({x1:ae.right-B.left,x2:se.left-B.left,y:ve})}else Yt(null);if(qe.size>0){var pe=[],fe=mn.current,ge=pn.current;if(fe&&ge){var he=[],xe=fe.getBoundingClientRect().top,me=ge.getBoundingClientRect().top,ye=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))};qe.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=rt.current[a])||void 0===n?void 0:n.current,v=null===(t=lt.current[a])||void 0===t?void 0:t.current;if(!s||!v)return;var p=s.getBoundingClientRect(),f=v.getBoundingClientRect(),g=Vt(d),h=(N=p.right-B.left)+.5*((H=f.left-B.left-0)-N),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:N,x2:H,containerTop:Ie,leftIdx:e,rhsArrayIdx:e,styleColor:(null==g?void 0:g.badgeBorder)||"#6366F1",styleId:R});var I=Te(x,xe,ye),T=Te(m,me,Se),w=I-Ie,E=T-Ie,F=m>=me-4&&m<=Se+4,_="";_=(L=x>=xe-4&&x<=ye+4)&&F?C(N,w,H,E):L&&!F?"M ".concat(N,",").concat(w," L ").concat(h,",").concat(w," L ").concat(h,",").concat(E):!L&&F?"M ".concat(h,",").concat(w," L ").concat(h,",").concat(E," L ").concat(H,",").concat(E):"M ".concat(h,",").concat(w," L ").concat(h,",").concat(E),pe.push({id:R,pathD:_,style:g,leftIdx:e,rhsArrayIdx:e})}else if(be){var M=e,D=Xn[M];if(!(null===(r=null==D?void 0:D.refIndexes)||void 0===r?void 0:r.length))return;D.refIndexes.forEach(function(e){var n,t,i=Jn.findIndex(function(n){return n.selfIndex===e});if(-1!==i){var o=null===(n=rt.current[M])||void 0===n?void 0:n.current,r=null===(t=lt.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=o.getBoundingClientRect(),c=r.getBoundingClientRect(),u=qt(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,ye),m=Te(p,me,Se),y=x-Ie,b=m-Ie,S=v>=xe-4&&v<=ye+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 k=e,A=k;s=null===(i=rt.current[k])||void 0===i?void 0:i.current,v=null===(o=lt.current[A])||void 0===o?void 0:o.current;if(!s||!v)return;var N,H;p=s.getBoundingClientRect(),f=v.getBoundingClientRect(),g=qt(k),h=(N=p.right-B.left)+.5*((H=f.left-B.left-0)-N),x=p.top+p.height/2,m=f.top+f.height/2,y=x-xe+Re,b=m-me+Ce,R="conn-".concat(k,"-").concat(A);he.push({lhsScrollY:y,rhsScrollY:b,x1:N,x2:H,containerTop:Ie,leftIdx:k,rhsArrayIdx:A,styleColor:(null==g?void 0:g.badgeBorder)||"#6366F1",styleId:R});var L;I=Te(x,xe,ye),T=Te(m,me,Se),w=I-Ie,E=T-Ie,F=m>=me-4&&m<=Se+4,_="";_=(L=x>=xe-4&&x<=ye+4)&&F?C(N,w,H,E):L&&!F?"M ".concat(N,",").concat(w," L ").concat(h,",").concat(w," L ").concat(h,",").concat(E):!L&&F?"M ".concat(h,",").concat(w," L ").concat(h,",").concat(E," L ").concat(H,",").concat(E):"M ".concat(h,",").concat(w," L ").concat(h,",").concat(E),pe.push({id:R,pathD:_,style:g,leftIdx:k,rhsArrayIdx:A})}}),en.current=he}Ue(pe)}else Ue([]),en.current=[]}catch(e){console.error("Line render safe fail: ",e)}finally{yn.current=!1}}},[Un,Xn,Jn,ln,Ln,Kt,qt,be,De,ze,qe,Ct,It]),Jt=u(function(){var e,n,t,i,o,r,l,c,u,d,a,s,v,p,f=en.current;if(f.length&&!Qe.current){var g=null!==(n=null===(e=mn.current)||void 0===e?void 0:e.scrollTop)&&void 0!==n?n:0,h=null!==(i=null===(t=pn.current)||void 0===t?void 0:t.scrollTop)&&void 0!==i?i:0,x=null!==(r=null===(o=mn.current)||void 0===o?void 0:o.clientHeight)&&void 0!==r?r:1/0,m=null!==(c=null===(l=pn.current)||void 0===l?void 0:l.clientHeight)&&void 0!==c?c:1/0,y=null!==(d=null===(u=mn.current)||void 0===u?void 0:u.getBoundingClientRect().top)&&void 0!==d?d:0,b=null!==(s=null===(a=pn.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=Dt.current)||void 0===v?void 0:v.getBoundingClientRect().top)&&void 0!==p?p:0,T=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=$e.current[e.styleId+"-stroke"],o=$e.current[e.styleId+"-bg"];if(i||o){var r,l=T(n,y,S),c=T(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(){rn.current=Xt},[Xt]);var Ut=r(null),Gt=r(null),Qt=u(function(){en.current.length>0&&!Qe.current||(null!==Ut.current&&clearTimeout(Ut.current),Ut.current=setTimeout(function(){rn.current(),Ut.current=null},50))},[]),Zt=u(function(){Oe(!0),He(!1),null!==Gt.current&&clearTimeout(Gt.current),null!==Ut.current&&(clearTimeout(Ut.current),Ut.current=null),Gt.current=setTimeout(function(){var e,n,t,i,o,r,l,c,u,d;if(en.current=[],tn.current&&null!==on.current&&null!==At.current){var a=on.current,s=At.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=rt.current[x])||void 0===e?void 0:e.current)||null,p=(null===(n=lt.current[x])||void 0===n?void 0:n.current)||null,f=(null===(t=ut.current[h[2]])||void 0===t?void 0:t.current)||(null===(i=it.current[Number(h[2])])||void 0===i?void 0:i.current)||null,g=(null===(o=dt.current[h[3]])||void 0===o?void 0:o.current)||(null===(r=ot.current[Number(h[3])])||void 0===r?void 0:r.current)||null}else v=(null===(l=at.current[a])||void 0===l?void 0:l.current)||null,f=(null===(c=it.current[a])||void 0===c?void 0:c.current)||null,p=(null===(u=ct.current[s])||void 0===u?void 0:u.current)||null,g=(null===(d=ot.current[s])||void 0===d?void 0:d.current)||null;if(v&&p&&f&&g){if(f.style.paddingTop="0px",g.style.paddingTop="0px",!be){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=mn.current,C=pn.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)}}}rn.current(),tn.current&&He(!0),Oe(!1),Gt.current=null},150)},[be,Xn,Jn]),$t=u(function(e){var n,t,i,o,r,l,c,u,d,a;if(null!==bn.current&&Sn.current&&Math.abs(e.currentTarget.scrollTop-bn.current)<=2){var s=Sn.current;bn.current=null,Sn.current=null,s()}if(!Ye.current){if(be||Qt(),tn.current){var v=on.current,p=At.current,f=mn.current,g=pn.current;if(null!==v&&null!==p&&f&&g){var h="string"==typeof v&&v.includes(S)?null===(n=rt.current["".concat(v.split(S)[0]).concat(S).concat(v.split(S)[1])])||void 0===n?void 0:n.current:null===(t=at.current[v])||void 0===t?void 0:t.current,x="string"==typeof p&&p.includes(S)?null===(i=lt.current["".concat(p.split(S)[0]).concat(S).concat(p.split(S)[1])])||void 0===i?void 0:i.current:null===(o=ct.current[p])||void 0===o?void 0:o.current;if(h&&x&&Nt.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=rt.current[R])||void 0===r?void 0:r.current,y=null===(l=lt.current[R])||void 0===l?void 0:l.current}else m=null===(c=rt.current[v])||void 0===c?void 0:c.current,y=null===(u=lt.current[p])||void 0===u?void 0:u.current;var C=null!==(a=null===(d=Dt.current)||void 0===d?void 0:d.getBoundingClientRect().top)&&void 0!==a?a:0,I=f.getBoundingClientRect().top,T=I+f.clientHeight;g.getBoundingClientRect().top;g.clientHeight;if(m&&y){var B=m.getBoundingClientRect(),w=y.getBoundingClientRect(),E=B.top+B.height/2;w.top,w.height;var F=((M=E,D=I,k=T,Math.max(D,Math.min(k,M)))-C).toString();Nt.current.setAttribute("y1",F),Nt.current.setAttribute("y2",F);var _=E>=I-4&&E<=T+4;Nt.current.setAttribute("visibility",_?"visible":"hidden")}}}}var M,D,k;en.current.length>0&&!nn.current&&(nn.current=!0,requestAnimationFrame(function(){Jt(),nn.current=!1}))}},[Jt,be,Qt]);c(function(){var e=setTimeout(Qt,250);window.addEventListener("resize",Zt);var n=null,t=null;return sn.current&&(n=new ResizeObserver(Qt)).observe(sn.current),Dt.current&&(t=new ResizeObserver(Qt)).observe(Dt.current),function(){clearTimeout(e),null!==Ut.current&&clearTimeout(Ut.current),null!==Gt.current&&clearTimeout(Gt.current),window.removeEventListener("resize",Zt),null==n||n.disconnect(),null==t||t.disconnect()}},[qn,Vn,ft,Un,Ct,It,Xn,Jn,Ln,Qt,Zt,De,ze,Ne,qe]),c(function(){tn.current=De},[De]),c(function(){on.current=ze},[ze]);var ei=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?_e("No counterpart exists for this section."):De&&ze===e?r?St():null==l||l():(Ve(new Set([e])),Ue([]),en.current=[],we(!0),Ye.current=!0,We(e),on.current=e,ke(!0),tn.current=!0,He(!1),fn.current&&(fn.current.style.height="0px"),gn.current&&(gn.current.style.height="0px"),hn.current&&(hn.current.style.height="0px"),xn.current&&(xn.current.style.height="0px"),requestAnimationFrame(function(){var n,t,i,o,r,u="string"==typeof e&&e.includes(S),d=null,a=null,s=null;if(u){var v=e.split(S),p="".concat(v[0]).concat(S).concat(v[1]);d=(null===(n=rt.current[p])||void 0===n?void 0:n.current)||null,a=(null===(t=lt.current[p])||void 0===t?void 0:t.current)||null,s=a?e:null}else if(d=(null===(i=at.current[e])||void 0===i?void 0:i.current)||null,be){var f=Xn[e],g=(null==f?void 0:f.refIndexes)||[];if(g.length>0){var h=g[0],x=Jn.findIndex(function(e){return e.selfIndex===h});-1!==x&&(a=(null===(r=ct.current[x])||void 0===r?void 0:r.current)||null,s=x)}}else a=(null===(o=ct.current[e])||void 0===o?void 0:o.current)||null,s=a?e:null;At.current=s;var m=mn.current,y=pn.current,b=function(){!function(){var n,t,i,o,r,l,c,d,a,v,p,f,g=null,h=null,x=null,m=null;if(u){var y=e.split(S),b="".concat(y[0]).concat(S).concat(y[1]);g=(null===(n=ut.current[y[2]])||void 0===n?void 0:n.current)||(null===(t=it.current[Number(y[2])])||void 0===t?void 0:t.current)||null,h=(null===(i=dt.current[y[3]])||void 0===i?void 0:i.current)||(null===(o=ot.current[Number(y[3])])||void 0===o?void 0:o.current)||null,x=(null===(r=rt.current[b])||void 0===r?void 0:r.current)||g,m=(null===(l=lt.current[b])||void 0===l?void 0:l.current)||h}else{var R=Number(e),C=null!==s?Number(s):R;g=(null===(c=it.current[R])||void 0===c?void 0:c.current)||null,h=(null===(d=ot.current[C])||void 0===d?void 0:d.current)||null,x=(null===(a=rt.current[R])||void 0===a?void 0:a.current)||(null===(v=at.current[R])||void 0===v?void 0:v.current)||g,m=(null===(p=lt.current[C])||void 0===p?void 0:p.current)||(null===(f=ct.current[C])||void 0===f?void 0:f.current)||h}if(x&&m&&g&&h){g.style.paddingTop="0px",h.style.paddingTop="0px";var I=x.getBoundingClientRect(),T=m.getBoundingClientRect(),B=I.top-T.top;B>0?h.style.paddingTop="".concat(B,"px"):B<0&&(g.style.paddingTop="".concat(Math.abs(B),"px"))}}(),He(!0),rn.current&&rn.current(),Ye.current=!1,"right"===c&&y?y.dispatchEvent(new Event("scroll")):m&&m.dispatchEvent(new Event("scroll")),we(!1),null==l||l()};if(!d||!m)return Ye.current=!1,we(!1),void(null==l||l());if(a&&y){if(!be){var R=0;R="right"===c?a?a.getBoundingClientRect().top:0:d?d.getBoundingClientRect().top:0;var C=sn.current,T=(null==C?void 0:C.getBoundingClientRect().top)||0,B=C?C.scrollTop+R-T-150:0;return C?void I(C,B,200,b):void b()}var w=d.getBoundingClientRect().top-m.getBoundingClientRect().top+m.scrollTop,E=a.getBoundingClientRect().top-y.getBoundingClientRect().top+y.scrollTop,F=200;if("left"===c){var _=E-(w-m.scrollTop);_<0&&fn.current&&(fn.current.style.height="".concat(Math.abs(_),"px")),requestAnimationFrame(function(){var e,n=y.scrollHeight-y.clientHeight;if(_<0)e=0;else{if(_>n){var t=_-n;return gn.current&&(gn.current.style.height="".concat(t+150,"px")),void requestAnimationFrame(function(){I(y,_,F,b)})}e=_}I(y,e,F,b)})}else{var M=w-(E-y.scrollTop);M<0&&hn.current&&(hn.current.style.height="".concat(Math.abs(M),"px")),requestAnimationFrame(function(){var e,n=m.scrollHeight-m.clientHeight;if(M<0)e=0;else{if(M>n){var t=M-n;return xn.current&&(xn.current.style.height="".concat(t+150,"px")),void requestAnimationFrame(function(){I(m,M,F,b)})}e=M}I(m,e,F,b)})}}else b()})))},[ze,Hn,Jn,De,be,Xn,St]),ni=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;Nn();var c="left";(null===(o=pn.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=lt.current[l])||void 0===e?void 0:e.current:null===(t=rt.current[l])||void 0===t?void 0:t.current}return"right"===c?null===(i=lt.current[n])||void 0===i?void 0:i.current:null===(o=rt.current[n])||void 0===o?void 0:o.current};if(t)return St(),Ve(new Set),Ue([]),en.current=[],void(r&&requestAnimationFrame(function(){var e=u()||l;Mn({open:!0,anchorEl:e,summary:i})}));ei(n,t,r?{toggleIfSame:!1,sourceSide:c,onReady:function(){var e=u()||l;Mn({open:!0,anchorEl:e,summary:i})}}:{toggleIfSame:!1,sourceSide:c})},[ei,Nn,Mn,St]),ti=u(function(){var e,n=Tn.sectionIdx,t=Tn.isOrphan;if(Dn(),null!=n){var i="left";Tn.anchorEl&&(null===(e=pn.current)||void 0===e?void 0:e.contains(Tn.anchorEl))&&(i="right"),ei(n,t,{sourceSide:i})}},[ei,Tn.isOrphan,Tn.sectionIdx,Tn.anchorEl,Dn]),ii=u(function(){Dn(),St(),Ve(new Set),Ue([]),en.current=[]},[Dn,St]),oi=null!==Tn.sectionIdx&&qe.has(Tn.sectionIdx),ri=P({proposedSections:Xn,existingSections:Jn,parentDeviationRecord:Gn,expandedSections:Ct,maintainRelativeOrder:!!be,scrollContainerRef:sn,leftContainerRef:mn,lhsBadgeRefs:rt,rhsBadgeRefs:lt}),li=ri.showDeviationNavigation,ci=ri.showOpenNodeRef,ui=l(function(){if(!xe)return null;for(var e in Gn){if((Gn[e]||[]).some(function(e){return e.id===xe}))return e}return null},[xe,Gn]),di=r(null),ai=r(null);c(function(){if(xe&&di.current!==xe){ai.current!==xe&&(Dn(),Nn(),St(),Ve(new Set),Ue([]),en.current=[],ai.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 Gn){var f=Gn[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}),h=Jn.findIndex(function(e){return e.id===s}),x=-1===g&&-1!==h,m=r(Xn,v.id),y=r(Jn,v.id);if(m&&!y&&!x){var b=m.split("-"),R=Number(b[0]);if(be){var C=null===(u=null===(c=Xn[R])||void 0===c?void 0:c.refIndexes)||void 0===u?void 0:u[0],I=Jn.findIndex(function(e){return e.selfIndex===C});-1!==I&&(R=I)}y=n([R],b.slice(1),!0).join("-")}if(m||y){var T=x||!m&&!!y,B=m?Number(m.split("-")[0]):g,w=y?Number(y.split("-")[0]):h;if(T){if(!(be?!!Ct["right-".concat(w)]:!!Ct[String(w)])&&w>=0)return Bt(w,"right"),t+=1,void(i=setTimeout(l,450))}else if(!(be?!!Ct["left-".concat(B)]:!!Ct[String(B)])&&B>=0)return Bt(B,"left"),t+=1,void(i=setTimeout(l,450));var E,F=m||"",_=y||"",M="".concat(v.id).concat(S,"0").concat(S).concat(F).concat(S).concat(_),D="".concat(v.id).concat(S,"0"),k=null===(d=rt.current[D])||void 0===d?void 0:d.current,A=null===(a=lt.current[D])||void 0===a?void 0:a.current,N=T||!k&&!!A,H=N?A:k;if(E=be?N?pn.current:mn.current:sn.current,H&&E){var L=H.getBoundingClientRect();if(0===L.height)return void((t+=1)<20&&(i=setTimeout(l,o)));var P=E.getBoundingClientRect(),O=L.top-P.top+E.scrollTop-P.height/2+L.height/2,j=function(){var n,t,i,o,r;if(!e){di.current=xe;var l=window.getComputedStyle(H).color;k&&(k.style.transition="box-shadow 300ms ease-in-out",k.style.boxShadow="0 0 10px ".concat(l)),A&&(A.style.transition="box-shadow 300ms ease-in-out",A.style.boxShadow="0 0 10px ".concat(l)),setTimeout(function(){k&&(k.style.boxShadow=""),A&&(A.style.boxShadow="")},2e3);var c=(null===(t=null===(n=v.evaluationResult)||void 0===n?void 0:n.deviations)||void 0===t?void 0:t[0])||v,u=(null===(i=v.evaluationResult)||void 0===i?void 0:i.evaluation_outputs)||v.evaluation_outputs;if(!(!!k&&!!A)){var d=N?(null===(o=lt.current[D])||void 0===o?void 0:o.current)||A:(null===(r=rt.current[D])||void 0===r?void 0:r.current)||k;return Mn({open:!0,anchorEl:d,summary:{deviation_summary:c.deviation_summary||c,evaluation_outputs:u}}),void(null==me||me())}ei(M,!1,{toggleIfSame:!1,sourceSide:"left",onReady:function(){var e,n=(null===(e=rt.current[D])||void 0===e?void 0:e.current)||k;Mn({open:!0,anchorEl:n,summary:{deviation_summary:c.deviation_summary||c,evaluation_outputs:u}})}})}};Math.abs(E.scrollTop-O)<=2?j():(bn.current=O,Sn.current=j,E.scrollTo({top:O,behavior:"smooth"}),i&&clearTimeout(i),i=setTimeout(function(){if(Sn.current){bn.current=null;var e=Sn.current;Sn.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,Gn,Xn,Jn,be,Ct,Bt,ei,Mn]);var si=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:It,setExpandedSubSections:Tt,maintainRelativeOrder:be||!1,proposedSections:Xn,existingSections:Jn,treeData:ce,deviationNumberRegistry:Qn,connectedSections:qe,activeSideBySideSection:ze,resolvedMarkdownStyles:an,getSubSectionRef:vt,getSubSectionCompareStyle:Vt,getBadgeRef:pt,openMoreFunctionsPopup:Ft,openSummaryPopup:ni,resetSideBySide:St,setConnectedSections:Ve,setConnectedLines:Ue,cachedConnectedPositions:en})};return t(d,e({ref:vn,sx:e(e({display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif'},be?{}:{overflow:"visible"}),{position:"relative"})},{children:[Ce&&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(D,{})})),_n.open&&i(W,{open:_n.open,anchorEl:_n.anchorEl,containerEl:kt.current,clipTopEl:Ht.current,scrollContainerEl:sn.current,onClose:ii,summary:_n.summary}),i(M,{open:Tn.open,anchorEl:Tn.anchorEl,sectionTitle:Tn.sectionTitle,referenceSectionTitle:Tn.refSectionTitle,onClose:Hn,onOpenCognitiveCompare:_t,onOpenSideBySide:ti,onConnect:Mt,isConnected:oi,isOrphan:Tn.isOrphan}),Cn.open&&i(_,{open:Cn.open,popupRef:An,position:wn,popupConfig:fe,onClose:function(){En(null),In(function(n){return e(e({},n),{open:!1})}),kn(null)},markdownStyles:se,sectionTitle:Cn.sectionTitle,referenceSectionTitle:Cn.refSectionTitle,cognitiveData:Cn.cognitiveData,anchorEl:Cn.anchorEl,sectionAnchorEl:Cn.sectionAnchorEl,scrollContainerEl:sn.current,badgeStyle:Cn.badgeStyle,docData:Cn.docData,deviationData:Cn.deviationData,isLoading:Cn.isLoading}),i(a,e({open:!!Fe,autoHideDuration:8e3,onClose:function(){return _e(null)},anchorOrigin:{vertical:"top",horizontal:"center"}},{children:i(s,e({onClose:function(){return _e(null)},severity:"error",sx:{width:"100%",whiteSpace:"pre-line"}},{children:Fe}))})),i(O,{componentHeaderText:le,displayConfig:pe,maintainRelativeOrder:be,onToggleView:function(e){Ie(!0),setTimeout(function(){Se(!e),St(),Dn(),Ve(new Set),Ue([]),en.current=[],requestAnimationFrame(function(){requestAnimationFrame(function(){setTimeout(function(){Ie(!1)},600)})})},50)}}),i(d,e({ref:sn,onScroll:$t,sx:{flex:1,minHeight:0,pt:1.5,pb:1,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",overflowY:be?"hidden":"auto",borderTop:gt&&ht?"none":"1.5px solid #EEF0F4"}},{children:i(d,e({sx:e({display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"},be?{flex:1,minHeight:0}:{})},{children:t(d,e({ref:Dt,sx:e({display:"grid",gridTemplateColumns:"minmax(0, 1fr) 180px minmax(0, 1fr)",gap:"40px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0},be?{flex:1,overflow:"visible"}:{})},{children:[t("svg",e({ref:Ge,style:{position:"absolute",top:0,left:0,width:un.width||"100%",height:un.height||"100%",pointerEvents:"none",zIndex:10,overflow:"visible",opacity:Pe?0:1,transition:"opacity 0.15s ease-in-out"}},{children:[Wt&&i("g",{children:i("line",{x1:Wt.x1,y1:Wt.y,x2:Wt.x2,y2:Wt.y,stroke:bt.badgeBorder,strokeWidth:"1.5"})}),Ot.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?De&&ze===n.subSectionKeyPath&&Ne:De&&ze===n.sectionIdx&&Ne)return null;if(!be){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=Jn[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=Jn[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 _=1;_<R.length;_++)(null==T?void 0:T.subsections)&&(T=T.subsections[R[_]]);for(_=1;_<I.length;_++)(null==B?void 0:B.subsections)&&(B=B.subsections[I[_]]);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),D=(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||D;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&&(Cn.open&&Fn===n.id?Nn():(kn(n.id),Et(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(k,{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:Cn.open&&Fn===n.id?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))}))]},n.id)}return null}),Je.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){$e.current[u]=e},d:r,fill:"none",stroke:"#FFFFFF",strokeWidth:"4",strokeOpacity:"0.7"}),i("path",{ref:function(e){$e.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)"},be?{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:Wn,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:Wn}))}))})),t(d,e({ref:mn,onScroll:$t,sx:e({p:"12px",display:"flex",flexDirection:"column"},be?{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:hn,style:{width:"100%",height:"0px",flexShrink:0}}),$n&&Xn.map(function(n,o){var r,l,c=!n.title&&!n.content;if(be&&c)return null;var u=n,a=qt(o,"left"),s=be?!(null===(r=u.refIndexes)||void 0===r?void 0:r.length)||u.selfIndex<0:!Jn[o],v=be?"number"==typeof u.selfIndex&&u.selfIndex>=0?u.selfIndex+1:null:o+1,p=qe.has(o),f=y(u.evaluationResult,null==a?void 0:a.deviationLabel);return i(d,e({ref:st(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"},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:st("left-accordion-".concat(o)),mb:0,treeData:ce,proposedSections:Xn,existingSections:Jn,deviationNumberRegistry:Qn,getSectionCompareStyle:qt,getBadgeRef:pt,connectedSections:qe,openMoreFunctionsPopup:Ft,openSummaryPopup:ni,deviationNodeIdToView:xe,deviationTargetParentId:ui,parentNodeId:(null===(l=null==ce?void 0:ce.input_index_map)||void 0===l?void 0:l[0])||"",isExpanded:be?!!Ct["left-".concat(o)]:!!Ct[String(o)],onToggle:function(){ii(),Bt(o,"left")},navigation:n.id?li[n.id]:null,showOpenNodeRef:ci,resolvedMarkdownStyles:an,maintainRelativeOrder:be,renderSubSections:si})})),be&&a&&t(d,e({ref:rt.current[o],onClick:function(e){var t=be?Jn.find(function(e){var n;return null===(n=u.refIndexes)||void 0===n?void 0:n.includes(e.selfIndex)})||{title:"",content:""}:Jn[o]||{title:"",content:""};Ft(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(k,{color:a.badgeText})})),i(g,{size:11,color:a.badgeText})]}))]}))}),"left-row-".concat(o))}),i("div",{ref:xn,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(),Cn.open&&Fn===xt?Nn():(kn(xt),Et(wt(n.currentTarget,{title:"",content:"",evaluationResult:mt,cognitiveData:{section_id:"",decisioning:[],gap:[],relevance_score:0,isMissingRationale:!0}},null,xt,!0,e(e({},bt),{label:""}))))},sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:"5px",top:"-5px",borderRadius:"20px",bgcolor:bt.badgeBg,color:bt.badgeText,border:"1px solid ".concat(bt.badgeBorder),fontSize:"12px",fontWeight:600,whiteSpace:"nowrap",position:"relative",zIndex:1,pointerEvents:"auto",cursor:"pointer"}},{children:[null!=yt?yt:i(k,{}),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:Cn.open&&Fn===xt?"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},be?{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:Yn,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:Yn}))}))})),t(d,e({ref:pn,onScroll:$t,sx:e({p:"12px",display:"flex",flexDirection:"column"},be?{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:fn,style:{width:"100%",height:"0px",flexShrink:0}}),$n&&Jn.map(function(n,o){var r,l=n,c=[],u=!1,a=null,s=-1;if(be){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 qe.has(n)&&(null===(t=e.refIndexes)||void 0===t?void 0:t.includes(l.selfIndex))});(u=-1!==v)&&(a=qt(v))}else c=[o+1],(u=qe.has(o))&&(a=qt(o));var p=qt(be&&-1!==s?s:o);return i(d,e({ref:ct.current[o],sx:{mb:1,width:"100%"}},{children:t(d,e({sx:{position:"relative",width:"100%"}},{children:[i(d,e({ref:ot.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:st("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:be?!!Ct["right-".concat(o)]:!!Ct[String(o)],treeData:ce,proposedSections:Xn,existingSections:Jn,deviationNumberRegistry:Qn,getBadgeRef:pt,getSectionCompareStyle:qt,connectedSections:qe,openMoreFunctionsPopup:Ft,openSummaryPopup:ni,deviationNodeIdToView:xe,deviationTargetParentId:ui,onToggle:function(){ii(),Bt(o,"right")},navigation:n.id?li[n.id]:null,showOpenNodeRef:ci,resolvedMarkdownStyles:an,maintainRelativeOrder:be,renderSubSections:si})})),be&&p&&i(d,e({ref:lt.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:gn,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 e}from"tslib";import{jsxs as n,jsx as o}from"react/jsx-runtime";import i,{useEffect as t}from"react";import{Box as l,Accordion as r,AccordionSummary as d,Tooltip as a,Typography as u,AccordionDetails as c}from"@mui/material";import{ChevronUp as s,ChevronDown as v}from"lucide-react";import{MemoizedMarkdown as f}from"../hooks/memoizedMarkdown.js";import{hasValue as p,generateColorPalette as h,isMissingStr as m,safeStringify as x,escapeRegExp as g,DEVIATION_BADGE_SEPARATOR as y}from"../CognitiveComparehelpers.js";import{DEFAULT_DEVIAION_COLOR as b}from"../CognitiveCompareConstants.js";var I=function(I){var w,S,F,_,k,R,C,B,A,M,W,T,E,N,O,j,P=I.section,D=I.idx,z=I.columnKey,K=I.colRef,V=I.mb,G=void 0===V?1:V,X=I.parentNodeId,Y=void 0===X?"":X,H=I.isExpanded,$=I.onToggle,q=I.navigation,J=I.showOpenNodeRef,L=I.resolvedMarkdownStyles,Q=I.maintainRelativeOrder,U=I.renderSubSections,Z=I.treeData,ee=I.proposedSections,ne=void 0===ee?[]:ee,oe=I.existingSections,ie=void 0===oe?[]:oe,te=I.deviationNumberRegistry,le=void 0===te?{}:te,re=I.getBadgeRef,de=I.openSummaryPopup,ae=I.getSectionCompareStyle,ue=I.connectedSections,ce=I.openMoreFunctionsPopup;I.deviationNodeIdToView,I.deviationTargetParentId;var se=(null===(w=P.displayTitle)||void 0===w||w)&&p(P.title),ve=(null===(S=P.displayContent)||void 0===S||S)&&p(P.content),fe=!se&&!ve,pe={current:1},he=P.title;se||(he=ve?"No Title Found":"No Matching Section Found");var me=P.evaluationResult;if(!me&&"right"===z)if(Q){var xe=null===(F=P.refIndexes)||void 0===F?void 0:F[0],ge=ne.find(function(e){return e.selfIndex===xe});me=null==ge?void 0:ge.evaluationResult}else me=null===(_=ne[D])||void 0===_?void 0:_.evaluationResult;var ye=null===(k=null==Z?void 0:Z.input_index_map)||void 0===k?void 0:k[0],be=null===(R=null==Z?void 0:Z.input_index_map)||void 0===R?void 0:R[1],Ie="left"===z?be:ye,we="left"===z?P:ne[D],Se="right"===z?P:ie[D];if(Q)if("left"===z){var Fe=null===(C=P.refIndexes)||void 0===C?void 0:C[0],_e=ie.findIndex(function(e){return e.selfIndex===Fe});Se=-1!==_e?ie[_e]:void 0}else{var ke=null===(B=P.refIndexes)||void 0===B?void 0:B[0],Re=ne.findIndex(function(e){return e.selfIndex===ke});we=-1!==Re?ne[Re]:void 0}var Ce="left"===z?!Se:!we,Be=me||(null==we?void 0:we.evaluationResult)||(null==Se?void 0:Se.evaluationResult),Ae=null!==(W=null===(M=null===(A=null==Be?void 0:Be.evaluation_outputs)||void 0===A?void 0:A.metadata)||void 0===M?void 0:M.label_color)&&void 0!==W?W:b,Me=h(Ae),We=Me.highlightBg,Te=null!==(E=null===(T=null==Be?void 0:Be.evaluation_outputs)||void 0===T?void 0:T.output_value)&&void 0!==E?E:null,Ee=(null==Be?void 0:Be.deviations)||{},Ne=D+1,Oe=P.id;if("right"===z&&Q){var je=null===(N=P.refIndexes)||void 0===N?void 0:N[0];-1!==(Re=ne.findIndex(function(e){return e.selfIndex===je}))&&(Ne=Re+1,Oe=ne[Re].id)}var Pe,De=[],ze=Object.entries(Ee).map(function(n){var o,i,t,l,r,d=n[0],a=n[1],u="".concat(Oe).concat(y).concat(d),c=le[u];if(
|
|
1
|
+
import{__assign as e}from"tslib";import{jsxs as n,jsx as o}from"react/jsx-runtime";import i,{useEffect as t}from"react";import{Box as l,Accordion as r,AccordionSummary as d,Tooltip as a,Typography as u,AccordionDetails as c}from"@mui/material";import{ChevronUp as s,ChevronDown as v}from"lucide-react";import{MemoizedMarkdown as f}from"../hooks/memoizedMarkdown.js";import{hasValue as p,generateColorPalette as h,isMissingStr as m,safeStringify as x,escapeRegExp as g,DEVIATION_BADGE_SEPARATOR as y}from"../CognitiveComparehelpers.js";import{DEFAULT_DEVIAION_COLOR as b}from"../CognitiveCompareConstants.js";var I=function(I){var w,S,F,_,k,R,C,B,A,M,W,T,E,N,O,j,P=I.section,D=I.idx,z=I.columnKey,K=I.colRef,V=I.mb,G=void 0===V?1:V,X=I.parentNodeId,Y=void 0===X?"":X,H=I.isExpanded,$=I.onToggle,q=I.navigation,J=I.showOpenNodeRef,L=I.resolvedMarkdownStyles,Q=I.maintainRelativeOrder,U=I.renderSubSections,Z=I.treeData,ee=I.proposedSections,ne=void 0===ee?[]:ee,oe=I.existingSections,ie=void 0===oe?[]:oe,te=I.deviationNumberRegistry,le=void 0===te?{}:te,re=I.getBadgeRef,de=I.openSummaryPopup,ae=I.getSectionCompareStyle,ue=I.connectedSections,ce=I.openMoreFunctionsPopup;I.deviationNodeIdToView,I.deviationTargetParentId;var se=(null===(w=P.displayTitle)||void 0===w||w)&&p(P.title),ve=(null===(S=P.displayContent)||void 0===S||S)&&p(P.content),fe=!se&&!ve,pe={current:1},he=P.title;se||(he=ve?"No Title Found":"No Matching Section Found");var me=P.evaluationResult;if(!me&&"right"===z)if(Q){var xe=null===(F=P.refIndexes)||void 0===F?void 0:F[0],ge=ne.find(function(e){return e.selfIndex===xe});me=null==ge?void 0:ge.evaluationResult}else me=null===(_=ne[D])||void 0===_?void 0:_.evaluationResult;var ye=null===(k=null==Z?void 0:Z.input_index_map)||void 0===k?void 0:k[0],be=null===(R=null==Z?void 0:Z.input_index_map)||void 0===R?void 0:R[1],Ie="left"===z?be:ye,we="left"===z?P:ne[D],Se="right"===z?P:ie[D];if(Q)if("left"===z){var Fe=null===(C=P.refIndexes)||void 0===C?void 0:C[0],_e=ie.findIndex(function(e){return e.selfIndex===Fe});Se=-1!==_e?ie[_e]:void 0}else{var ke=null===(B=P.refIndexes)||void 0===B?void 0:B[0],Re=ne.findIndex(function(e){return e.selfIndex===ke});we=-1!==Re?ne[Re]:void 0}var Ce="left"===z?!Se:!we,Be=me||(null==we?void 0:we.evaluationResult)||(null==Se?void 0:Se.evaluationResult),Ae=null!==(W=null===(M=null===(A=null==Be?void 0:Be.evaluation_outputs)||void 0===A?void 0:A.metadata)||void 0===M?void 0:M.label_color)&&void 0!==W?W:b,Me=h(Ae),We=Me.highlightBg,Te=null!==(E=null===(T=null==Be?void 0:Be.evaluation_outputs)||void 0===T?void 0:T.output_value)&&void 0!==E?E:null,Ee=(null==Be?void 0:Be.deviations)||{},Ne=D+1,Oe=P.id;if("right"===z&&Q){var je=null===(N=P.refIndexes)||void 0===N?void 0:N[0];-1!==(Re=ne.findIndex(function(e){return e.selfIndex===je}))&&(Ne=Re+1,Oe=ne[Re].id)}var Pe,De=[],ze=Object.entries(Ee).map(function(n){var o,i,t,l,r,d=n[0],a=n[1],u="".concat(Oe).concat(y).concat(d),c=le[u];if(null==c)return null;var s=a[Y],v=m(s);if(v)s="";else if(!s)return null;De.push(s);var f=D,p=D;if(Q)if("left"===z){var h=null===(o=P.refIndexes)||void 0===o?void 0:o[0],b=ie.findIndex(function(e){return e.selfIndex===h});p=-1!==b?b:D}else{var I=null===(i=P.refIndexes)||void 0===i?void 0:i[0],w=ne.findIndex(function(e){return e.selfIndex===I});f=-1!==w?w:D}var S="".concat(Oe).concat(y).concat(d).concat(y).concat(f).concat(y).concat(p),F="left"===z?null===(t=ie[p])||void 0===t?void 0:t.content:null===(l=ne[f])||void 0===l?void 0:l.content,_=a[Ie],k=x(F),R=Object.keys(Ee).map(function(e){return{key:e,text:Ee[e][Ie]}}).filter(function(e){return!m(e.text)}).sort(function(e,n){return n.text.length-e.text.length}),C=new Set;R.forEach(function(e){var n=e.text.replace(/\\(['’])/g,"$1").replace(/\\n/g,"\n");if(n){var o=new RegExp(g(n));o.test(k)&&(C.add(e.key),k=k.replace(o,"__TOKEN_".concat(e.key,"__")))}});var B=!m(_)&&!C.has(d),A=Ce||m(_)||B,M="".concat(Ne,".").concat(c),W=D;if("right"===z&&Q){var T=null===(r=P.refIndexes)||void 0===r?void 0:r[0],E=ne.findIndex(function(e){return e.selfIndex===T});-1!==E&&(W=E)}var N=ae?ae(W):null,O=N?e(e({},N),{badgeBg:Me.badgeBg,badgeBorder:Me.badgeBorder,badgeText:Me.badgeText}):e({},Me),j=(null==a?void 0:a.deviation_summary)?{deviation_summary:a.deviation_summary,deviation_title:null==Be?void 0:Be.deviation_title,evaluation_outputs:null==Be?void 0:Be.evaluation_outputs}:null;return{id:u,actionId:S,label:M,highlight:s,side:z,style:O,score:Te,isConnected:null==ue?void 0:ue.has(S),isOrphan:A,isMissingClause:v,badgeRef:re(z,u),onClick:function(e){e.stopPropagation(),ce&&ce(e,we||{id:"orphan-left",title:"",content:""},A,Se||{id:"orphan-right",title:"",content:""},S,O)},onSummaryClick:function(e){e.stopPropagation(),de(e,S,A,j)}}}).filter(Boolean),Ke=P.id&&z===(null==q?void 0:q.columnKey)?q:null,Ve=i.useRef(!1);return t(function(){H||(Ve.current=!1)},[H]),n(l,e({ref:K,sx:{mb:G,width:"100%",display:"flex",flexDirection:"column",position:"relative",minWidth:0}},{children:[H&&(null==Ke?void 0:Ke.showAbove)&&o("div",e({style:{position:"sticky",top:0,height:"0px",cursor:"pointer"},onClick:function(){var e,n;return null===(n=null===(e=null==Ke?void 0:Ke.showAboveRef)||void 0===e?void 0:e.current)||void 0===n?void 0:n.scrollIntoView({behavior:"smooth",block:"center"})}},{children:o("div",e({style:e({transform:"translateY(-50%) translateX(calc(100% ".concat("left"===z?"+":"-"," 130px))"),position:"absolute",paddingTop:"20px"},"left"===z?{right:"0px"}:{left:"0px"})},{children:o(s,{color:window.getComputedStyle(null===(O=null==Ke?void 0:Ke.showAboveRef)||void 0===O?void 0:O.current).color})}))})),n(r,e({disableGutters:!0,expanded:!fe&&H,onChange:function(){fe||($(),J.current=P.id)},sx:{boxShadow:"none",border:fe?"1px dashed #E2E8F0":"1px solid #E2E8F0",bgcolor:fe?"#FAFAFA":"#FFFFFF",borderRadius:"6px",flexGrow:1,width:"100%",display:"flex",flexDirection:"column",minWidth:0,"&:before":{display:"none"},"& .MuiAccordion-heading":{position:"sticky",top:-12,zIndex:10,background:"#fff"}}},{children:[o(d,e({expandIcon:fe?null:o(v,{size:16}),sx:{minHeight:"36px",flexShrink:0,cursor:fe?"default":"pointer","& .MuiAccordionSummary-content":{my:.5,display:"grid",alignItems:"center",minWidth:0,width:"100%"},"& .MuiAccordionSummary-expandIconWrapper":{transition:"transform 0.2s ease"},"& .MuiAccordionSummary-expandIconWrapper.Mui-expanded":{transform:"rotate(180deg)"}}},{children:se&&o(a,e({title:he,placement:"top"},{children:o(u,e({component:"div",sx:{fontSize:"12px",color:fe?"#94A3B8":"#19213D",fontWeight:fe?400:700,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0}},{children:(Pe=he,Pe?x(Pe).replace(/\\n/g,"\n").split(/(\*\*.*?\*\*)/g).map(function(e,n){return e.startsWith("**")&&e.endsWith("**")?o("strong",{children:e.slice(2,-2)},n):o(i.Fragment,{children:e},n)}):null)}))}))})),!fe&&n(c,e({sx:{pt:0,pb:1.25,bgcolor:"#FFFFFF",flex:1,display:"flex",flexDirection:"column",minWidth:0}},{children:[ve&&o(f,{content:P.content,sxStyles:L,highlights:De,maintainRelativeOrder:Q,highlightBg:We,deviationBadges:ze}),(P.subsections||[]).map(function(e,n){return U({section:e,keyPath:"".concat(D,"-").concat(n),depth:0,columnKey:z,parentNodeId:Y,devCounter:pe})})]}))]})),H&&(null==Ke?void 0:Ke.showBelow)&&o("div",e({style:{position:"sticky",bottom:0,height:"0px",cursor:"pointer"},onClick:function(){var e,n;return null===(n=null===(e=null==Ke?void 0:Ke.showBelowRef)||void 0===e?void 0:e.current)||void 0===n?void 0:n.scrollIntoView({behavior:"smooth",block:"center"})}},{children:o("div",e({style:e({transform:"translateY(-50%) translateX(calc(100% ".concat("left"===z?"+":"-"," 130px))"),position:"absolute",paddingBottom:"20px"},"left"===z?{right:"0px"}:{left:"0px"})},{children:o(v,{color:window.getComputedStyle(null===(j=null==Ke?void 0:Ke.showBelowRef)||void 0===j?void 0:j.current).color})}))}))]}),"".concat(z,"-sec-").concat(D))};export{I as default};
|
|
2
2
|
//# sourceMappingURL=SectionAccordion.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as n}from"tslib";import{jsx as t,jsxs as i}from"react/jsx-runtime";import e,{useRef as o,useEffect as l}from"react";import{Box as r,Accordion as a,AccordionSummary as u,Typography as d,AccordionDetails as c}from"@mui/material";import{ChevronDown as s}from"lucide-react";import{MemoizedMarkdown as v}from"../hooks/memoizedMarkdown.js";import{hasValue as f,generateColorPalette as h,isMissingStr as p,DEVIATION_BADGE_SEPARATOR as m}from"../CognitiveComparehelpers.js";import{DEFAULT_DEVIAION_COLOR as g}from"../CognitiveCompareConstants.js";var b=e.memo(function(e){var x,S,y,_,k,w,C,F,P,I,R,B=e.section,O=e.keyPath,j=e.depth,E=void 0===j?0:j,W=e.columnKey,M=void 0===W?"left":W,N=e.parentNodeId,T=void 0===N?"":N,z=e.expandedSubSections,A=e.setExpandedSubSections,D=e.maintainRelativeOrder,G=e.proposedSections,H=e.existingSections,K=e.treeData,L=e.deviationNumberRegistry,U=e.connectedSections,V=e.activeSideBySideSection,q=e.resolvedMarkdownStyles,J=e.getSubSectionRef,Q=e.getSubSectionCompareStyle,X=e.getBadgeRef,Y=e.openMoreFunctionsPopup,Z=e.openSummaryPopup,$=e.resetSideBySide,nn=e.setConnectedSections,tn=e.setConnectedLines,en=e.cachedConnectedPositions,on=(null===(x=B.displayTitle)||void 0===x||x)&&f(B.title),ln=(null===(S=B.displayContent)||void 0===S||S)&&f(B.content),rn=!on&&!ln,an=on?B.title:ln?"No Title Found":"No Matching Section Found",un=!!z[O],dn=J(M,O),cn=O.split("-").map(Number),sn=cn[0],vn=G[sn],fn=H[sn],hn=O,pn=O,mn=sn,gn=sn,bn=function(n,t,i){if(!n||!t)return null;if(n.id===t)return{section:n,keyPath:i};for(var e=(n.subsections||[]).map(function(n,t){return{section:n,keyPath:"".concat(i,"-").concat(t)}}),o=function(){var n=e.shift();return(null==n?void 0:n.section)?n.section.id===t?{value:n}:void(n.section.subsections||[]).forEach(function(t,i){e.push({section:t,keyPath:"".concat(n.keyPath,"-").concat(i)})}):"continue"};e.length>0;){var l=o();if("object"==typeof l)return l.value}return null};if(D)if("left"===M){var xn=null===(y=null==vn?void 0:vn.refIndexes)||void 0===y?void 0:y[0],Sn=H.findIndex(function(n){return n.selfIndex===xn});-1!==Sn&&(fn=H[Sn],gn=Sn)}else{var yn=null===(_=null==fn?void 0:fn.refIndexes)||void 0===_?void 0:_[0];-1!==(Pn=G.findIndex(function(n){return n.selfIndex===yn}))&&(vn=G[Pn],mn=Pn)}var _n=vn,kn=fn;if(D)if("left"===M){_n=B,hn=O;var wn=bn(fn,B.id,String(gn));kn=(null==wn?void 0:wn.section)||null,pn=(null==wn?void 0:wn.keyPath)||""}else{kn=B,pn=O;var Cn=bn(vn,B.id,String(mn));_n=(null==Cn?void 0:Cn.section)||null,hn=(null==Cn?void 0:Cn.keyPath)||""}else for(var Fn=1;Fn<cn.length;Fn++)(null==_n?void 0:_n.subsections)&&(_n=_n.subsections[cn[Fn]]),(null==kn?void 0:kn.subsections)&&(kn=kn.subsections[cn[Fn]]);var Pn,In=(hn?Q(hn):null)||Q(O),Rn=null===(k=null==K?void 0:K.input_index_map)||void 0===k?void 0:k[0],Bn=null===(w=null==K?void 0:K.input_index_map)||void 0===w?void 0:w[1],On="left"===M?Bn:Rn,jn="left"===M?!kn:!_n,En=B.evaluationResult||(null==_n?void 0:_n.evaluationResult)||(null==kn?void 0:kn.evaluationResult),Wn=null!==(F=null===(C=null==En?void 0:En.evaluation_outputs)||void 0===C?void 0:C.output_value)&&void 0!==F?F:null,Mn=sn+1,Nn=B.id||(null==_n?void 0:_n.id)||(null==kn?void 0:kn.id);"right"===M&&D&&(vn&&-1!==(Pn=G.findIndex(function(n){return n.id===vn.id}))&&(Mn=Pn+1));var Tn=null!==(R=null===(I=null===(P=null==En?void 0:En.evaluation_outputs)||void 0===P?void 0:P.metadata)||void 0===I?void 0:I.label_color)&&void 0!==R?R:g,zn=h(Tn),An=zn.highlightBg,Dn=(null==En?void 0:En.deviations)||{},Gn=[],Hn=Object.entries(Dn).map(function(t){var i=t[0],e=t[1],o="".concat(Nn).concat(m).concat(i),l=L[o];if(
|
|
1
|
+
import{__assign as n}from"tslib";import{jsx as t,jsxs as i}from"react/jsx-runtime";import e,{useRef as o,useEffect as l}from"react";import{Box as r,Accordion as a,AccordionSummary as u,Typography as d,AccordionDetails as c}from"@mui/material";import{ChevronDown as s}from"lucide-react";import{MemoizedMarkdown as v}from"../hooks/memoizedMarkdown.js";import{hasValue as f,generateColorPalette as h,isMissingStr as p,DEVIATION_BADGE_SEPARATOR as m}from"../CognitiveComparehelpers.js";import{DEFAULT_DEVIAION_COLOR as g}from"../CognitiveCompareConstants.js";var b=e.memo(function(e){var x,S,y,_,k,w,C,F,P,I,R,B=e.section,O=e.keyPath,j=e.depth,E=void 0===j?0:j,W=e.columnKey,M=void 0===W?"left":W,N=e.parentNodeId,T=void 0===N?"":N,z=e.expandedSubSections,A=e.setExpandedSubSections,D=e.maintainRelativeOrder,G=e.proposedSections,H=e.existingSections,K=e.treeData,L=e.deviationNumberRegistry,U=e.connectedSections,V=e.activeSideBySideSection,q=e.resolvedMarkdownStyles,J=e.getSubSectionRef,Q=e.getSubSectionCompareStyle,X=e.getBadgeRef,Y=e.openMoreFunctionsPopup,Z=e.openSummaryPopup,$=e.resetSideBySide,nn=e.setConnectedSections,tn=e.setConnectedLines,en=e.cachedConnectedPositions,on=(null===(x=B.displayTitle)||void 0===x||x)&&f(B.title),ln=(null===(S=B.displayContent)||void 0===S||S)&&f(B.content),rn=!on&&!ln,an=on?B.title:ln?"No Title Found":"No Matching Section Found",un=!!z[O],dn=J(M,O),cn=O.split("-").map(Number),sn=cn[0],vn=G[sn],fn=H[sn],hn=O,pn=O,mn=sn,gn=sn,bn=function(n,t,i){if(!n||!t)return null;if(n.id===t)return{section:n,keyPath:i};for(var e=(n.subsections||[]).map(function(n,t){return{section:n,keyPath:"".concat(i,"-").concat(t)}}),o=function(){var n=e.shift();return(null==n?void 0:n.section)?n.section.id===t?{value:n}:void(n.section.subsections||[]).forEach(function(t,i){e.push({section:t,keyPath:"".concat(n.keyPath,"-").concat(i)})}):"continue"};e.length>0;){var l=o();if("object"==typeof l)return l.value}return null};if(D)if("left"===M){var xn=null===(y=null==vn?void 0:vn.refIndexes)||void 0===y?void 0:y[0],Sn=H.findIndex(function(n){return n.selfIndex===xn});-1!==Sn&&(fn=H[Sn],gn=Sn)}else{var yn=null===(_=null==fn?void 0:fn.refIndexes)||void 0===_?void 0:_[0];-1!==(Pn=G.findIndex(function(n){return n.selfIndex===yn}))&&(vn=G[Pn],mn=Pn)}var _n=vn,kn=fn;if(D)if("left"===M){_n=B,hn=O;var wn=bn(fn,B.id,String(gn));kn=(null==wn?void 0:wn.section)||null,pn=(null==wn?void 0:wn.keyPath)||""}else{kn=B,pn=O;var Cn=bn(vn,B.id,String(mn));_n=(null==Cn?void 0:Cn.section)||null,hn=(null==Cn?void 0:Cn.keyPath)||""}else for(var Fn=1;Fn<cn.length;Fn++)(null==_n?void 0:_n.subsections)&&(_n=_n.subsections[cn[Fn]]),(null==kn?void 0:kn.subsections)&&(kn=kn.subsections[cn[Fn]]);var Pn,In=(hn?Q(hn):null)||Q(O),Rn=null===(k=null==K?void 0:K.input_index_map)||void 0===k?void 0:k[0],Bn=null===(w=null==K?void 0:K.input_index_map)||void 0===w?void 0:w[1],On="left"===M?Bn:Rn,jn="left"===M?!kn:!_n,En=B.evaluationResult||(null==_n?void 0:_n.evaluationResult)||(null==kn?void 0:kn.evaluationResult),Wn=null!==(F=null===(C=null==En?void 0:En.evaluation_outputs)||void 0===C?void 0:C.output_value)&&void 0!==F?F:null,Mn=sn+1,Nn=B.id||(null==_n?void 0:_n.id)||(null==kn?void 0:kn.id);"right"===M&&D&&(vn&&-1!==(Pn=G.findIndex(function(n){return n.id===vn.id}))&&(Mn=Pn+1));var Tn=null!==(R=null===(I=null===(P=null==En?void 0:En.evaluation_outputs)||void 0===P?void 0:P.metadata)||void 0===I?void 0:I.label_color)&&void 0!==R?R:g,zn=h(Tn),An=zn.highlightBg,Dn=(null==En?void 0:En.deviations)||{},Gn=[],Hn=Object.entries(Dn).map(function(t){var i=t[0],e=t[1],o="".concat(Nn).concat(m).concat(i),l=L[o];if(null==l)return null;var r=e[T],a=p(r);if(a)r="";else if(!r)return null;Gn.push(r);var u=e[On],d=!1;u&&(d=Object.values(Dn).map(function(n){return n[On]}).filter(Boolean).some(function(n){return n.length>u.length&&n.includes(u)}));var c=jn||p(u)||d,s="".concat(Mn,".").concat(l),v="".concat(Nn).concat(m).concat(i).concat(m).concat(hn).concat(m).concat(pn),f=n({},zn),h=(null==e?void 0:e.deviation_summary)?{deviation_summary:e.deviation_summary||(null==En?void 0:En.deviation_summary),deviation_title:null==En?void 0:En.deviation_title,evaluation_outputs:null==En?void 0:En.evaluation_outputs}:null;return{id:o,actionId:v,label:s,highlight:r,side:M,style:f,score:Wn,isConnected:U.has(v),isOrphan:c,isMissingClause:a,badgeRef:X(M,o),onClick:function(t){t.stopPropagation();var i=_n?n(n({},_n),{title:(null==vn?void 0:vn.title)||(null==_n?void 0:_n.title)||""}):{id:"orphan-left",title:"",content:""},e=kn?n(n({},kn),{title:(null==fn?void 0:fn.title)||(null==kn?void 0:kn.title)||""}):{id:"orphan-right",title:"",content:""};Y(t,i,c,e,v,f)},onSummaryClick:function(n){n.stopPropagation(),Z(n,v,c,h)}}}).filter(Boolean).sort(function(n,t){return parseFloat(n.label)-parseFloat(t.label)}),Kn=o(!1);l(function(){un||(Kn.current=!1)},[un]),l(function(){if(un&&!Kn.current){var n=setTimeout(function(){var n,t;Kn.current=!0;var i=null===(t=null===(n=Hn[0])||void 0===n?void 0:n.badgeRef)||void 0===t?void 0:t.current;i&&i.scrollIntoView({behavior:"smooth",block:"center"})},350);return function(){return clearTimeout(n)}}},[un,Hn]);var Ln=Hn.some(function(n){return U.has(n.actionId)});if(!(on||ln||B.subsections&&0!==B.subsections.length))return null;var Un=!D&&on&&ln,Vn=Ln&&In?{borderRadius:"4px",outline:"2px solid ".concat(In.badgeBorder),outlineOffset:"1px"}:{};return t(r,on?n({ref:dn,sx:{mt:1,width:"100%",minWidth:0,position:"relative"}},{children:t(r,n({sx:n({width:"100%"},Vn)},{children:i(a,n({disableGutters:!0,expanded:!rn&&un,onChange:function(){if(!rn){if(un){var t=String(V||""),i=t.includes(hn)||t.includes(pn);i||U.forEach(function(n){(String(n).includes(hn)||String(n).includes(pn))&&(i=!0)}),i&&($(),nn(new Set),tn([]),en.current=[])}A(function(t){var i;return n(n({},t),((i={})[O]=!t[O],i))})}},sx:{mt:0,boxShadow:"none",border:rn?"1px dashed #E2E8F0":"1px solid #EEF2F7",borderRadius:"4px !important",bgcolor:"#FFFFFF",minWidth:0,"&:before":{display:"none"}}},{children:[t(u,n({expandIcon:rn?null:t(s,{size:14}),sx:{minHeight:"32px","& .MuiAccordionSummary-content":{my:.5,display:"grid",alignItems:"center",minWidth:0,width:"100%"}}},{children:t(d,n({component:"div",sx:{fontSize:"11px",fontWeight:600,color:rn?"#94A3B8":"#19213D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0}},{children:an||"Untitled Subsection"}))})),!rn&&i(c,n({sx:{pt:0,pb:1,minWidth:0}},{children:[ln&&t(v,{content:B.content,sxStyles:q,deviationBadges:Un?[]:Hn,maintainRelativeOrder:D,highlightBg:An,highlights:Gn}),(B.subsections||[]).map(function(i,o){return t(b,n({},e,{section:i,keyPath:"".concat(O,"-").concat(o),depth:E+1}),"".concat(O,"-").concat(o))})]}))]}))}))}):n({ref:dn,sx:{mt:0===E?1:.75,width:"100%",minWidth:0,position:"relative"}},{children:!rn&&i(r,n({sx:n({width:"100%"},Vn)},{children:[ln&&t(v,{content:B.content,sxStyles:q,deviationBadges:Hn,maintainRelativeOrder:D,highlightBg:An,highlights:Gn}),(B.subsections||[]).map(function(i,o){return t(b,n({},e,{section:i,keyPath:"".concat(O,"-").concat(o),depth:E+1}),"".concat(O,"-").concat(o))})]}))}))});export{b as default};
|
|
2
2
|
//# sourceMappingURL=SubSectionAccordion.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as i,__spreadArray as e}from"tslib";import{useMemo as t}from"react";import{getSideData as n,getRationale as o,hasValue as l,isMissingStr as s,DEVIATION_BADGE_SEPARATOR as r}from"../CognitiveComparehelpers.js";var d={id:"",title:"",similarity:0,sections:[]},a=function(a,u,v,c){var f=JSON.stringify(v||{}),p=t(function(){var t,l,s,r;if(!a||0===Object.keys(a).length)return{activeProposed:{},activeVariants:[],parseError:"Tree data is required"};var d=JSON.parse(f);try{var v=a.nodes||a,c=[],p=[],b=a.base_root_id,_=a.input_index_map||{0:"left",1:"right"},x=a[b]||v[b];if(!x||!1===x.display_node)return{activeProposed:{title:"No Data",sections:[]},activeVariants:[],parseError:null};var y=function(e,t){var l,s,r,u=a[e]||v[e];if(!u||!1===u.display_node)return null;var c=n(u,t,_),f=!1!==(null===(l=c.attributes)||void 0===l?void 0:l.display_title),p=!1!==(null===(s=c.attributes)||void 0===s?void 0:s.display_content),b=!!c.title.trim(),x=!!c.content.trim(),m=o(u),I=(null===(r=null==d?void 0:d[e])||void 0===r?void 0:r.evaluation_result)||u.evaluation_result||null,h=[];u.next&&Object.values(u.next).forEach(function(i){var e=v[i];if(e&&!1!==e.display_node){var n=y(i,t);n&&h.push(n)}});var g=!(!b&&!x);return i(i({id:e,title:b?c.title:"",content:x?c.content:"",displayTitle:f,displayContent:p,subsections:h},g?m:{score:void 0,relation:"not_defined"}),{evaluationResult:I})};if(u){var m=function(t,l){var s,r,u,c,f,p,b,x,y,I,h,g,E,N,S,R,O,j,P,C,T;void 0===l&&(l=0);var V=[],k=[];if(!t)return{refSections:V,baseSections:k};var D={},J={},U=-1,q=-1;for(var w in t){var F=t[w],M=a[F]||v[F];if(M&&!1!==M.display_node){var z=o(M),A=(null===(s=null==d?void 0:d[F])||void 0===s?void 0:s.evaluation_result)||M.evaluation_result||null,B=n(M,"1",_),G=n(M,"0",_),H=!1!==(null===(r=B.attributes)||void 0===r?void 0:r.display_title)&&B.title.trim()||!1!==(null===(u=B.attributes)||void 0===u?void 0:u.display_content)&&B.content.trim(),K=!1!==(null===(c=G.attributes)||void 0===c?void 0:c.display_title)&&G.title.trim()||!1!==(null===(f=G.attributes)||void 0===f?void 0:f.display_content)&&G.content.trim(),L=Number(null!==(b=null===(p=B.attributes)||void 0===p?void 0:p.display_index)&&void 0!==b?b:U--),Q=Number(null!==(y=null===(x=G.attributes)||void 0===x?void 0:x.display_index)&&void 0!==y?y:q--),W=D[L]||i(i({id:F,title:!1!==(null===(I=B.attributes)||void 0===I?void 0:I.display_title)?B.title:"",content:!1!==(null===(h=B.attributes)||void 0===h?void 0:h.display_content)?B.content:"",subsections:[]},H?z:{score:void 0,relation:"not_defined"}),{refIndexes:[],selfIndex:L,evaluationResult:A,displayContent:null===(g=B.attributes)||void 0===g?void 0:g.display_content,displayTitle:null===(E=B.attributes)||void 0===E?void 0:E.display_title}),X=J[Q]||i(i({id:F,title:!1!==(null===(N=G.attributes)||void 0===N?void 0:N.display_title)?G.title:"",content:!1!==(null===(S=G.attributes)||void 0===S?void 0:S.display_content)?G.content:"",subsections:[]},K?z:{score:void 0,relation:"not_defined"}),{refIndexes:[],selfIndex:Q,evaluationResult:A,displayContent:null===(R=G.attributes)||void 0===R?void 0:R.display_content,displayTitle:null===(O=G.attributes)||void 0===O?void 0:O.display_title});Number(L)>=0&&Number(Q)>=0&&((null===(j=W.refIndexes)||void 0===j?void 0:j.includes(Number(Q)))||null===(P=W.refIndexes)||void 0===P||P.push(Number(Q)),(null===(C=X.refIndexes)||void 0===C?void 0:C.includes(Number(L)))||null===(T=X.refIndexes)||void 0===T||T.push(Number(L))),D[L]=W,J[Q]=X;var Y=m(M.next,l+1),Z=Y.refSections,$=Y.baseSections;Z.length>0&&(W.subsections=e(e([],W.subsections||[],!0),Z,!0)),$.length>0&&(X.subsections=e(e([],X.subsections||[],!0),$,!0))}}V=Object.values(D),k=Object.values(J);var ii=function(i,e){return i.selfIndex<0&&e.selfIndex>=0?1:i.selfIndex>=0&&e.selfIndex<0?-1:i.selfIndex-e.selfIndex};return V.sort(ii),k.sort(ii),{refSections:V,baseSections:k}},I=m(x.next),h=I.refSections,g=I.baseSections;p=h,c=g}else x.next&&Object.values(x.next).forEach(function(i){var e=a[i]||v[i];e&&!1!==e.display_node&&(c.push(y(i,"0")||{id:i,title:"",content:"",subsections:[]}),p.push(y(i,"1")||{id:i,title:"",content:"",subsections:[]}))});return{activeProposed:{title:(null===(l=null===(t=x.comparison_inputs)||void 0===t?void 0:t[_[0]])||void 0===l?void 0:l.title)||"Uploaded Contract",description:x.decision_scope_description||"",sections:c},activeVariants:[{id:"tree-variant-1",title:(null===(r=null===(s=x.comparison_inputs)||void 0===s?void 0:s[_[1]])||void 0===r?void 0:r.title)||"Reference Template",similarity:0,sections:p,analysis:{rule_difference_comparison:{summary:{overall_score:0,overall_summary:x.decision_scope_description||""},fields:{}}}}],parseError:null}}catch(i){return console.error("Data Transformation Error: ",i),{activeProposed:{},activeVariants:[],parseError:i instanceof Error?i.message:"Unknown Parsing Error"}}},[a,u,f]),b=p.activeProposed,_=p.activeVariants,x=p.parseError,y=(null==_?void 0:_[0])||d,m=t(function(){return(null==b?void 0:b.sections)||[]},[null==b?void 0:b.sections]),I=t(function(){return y.sections||[]},[y.sections]),h=m.length>0||I.length>0,g=t(function(){return c.fields.filter(function(i){var e=i.key;return(!h||"description"!==e)&&(l(null==b?void 0:b[e])||l(y[e]))})},[b,y,h,c.fields]),E=t(function(){var i,e,t={},n={},o={},l=0,d=null===(i=null==a?void 0:a.input_index_map)||void 0===i?void 0:i[0],v=null===(e=null==a?void 0:a.input_index_map)||void 0===e?void 0:e[1],c=function(i,e,a,u,f,p){var b,_,x,y,m,I,h,g;if(i
|
|
1
|
+
import{__assign as i,__spreadArray as e}from"tslib";import{useMemo as t}from"react";import{getSideData as n,getRationale as o,hasValue as l,isMissingStr as s,DEVIATION_BADGE_SEPARATOR as r}from"../CognitiveComparehelpers.js";var d={id:"",title:"",similarity:0,sections:[]},a=function(a,u,v,c){var f=JSON.stringify(v||{}),p=t(function(){var t,l,s,r;if(!a||0===Object.keys(a).length)return{activeProposed:{},activeVariants:[],parseError:"Tree data is required"};var d=JSON.parse(f);try{var v=a.nodes||a,c=[],p=[],b=a.base_root_id,_=a.input_index_map||{0:"left",1:"right"},x=a[b]||v[b];if(!x||!1===x.display_node)return{activeProposed:{title:"No Data",sections:[]},activeVariants:[],parseError:null};var y=function(e,t){var l,s,r,u=a[e]||v[e];if(!u||!1===u.display_node)return null;var c=n(u,t,_),f=!1!==(null===(l=c.attributes)||void 0===l?void 0:l.display_title),p=!1!==(null===(s=c.attributes)||void 0===s?void 0:s.display_content),b=!!c.title.trim(),x=!!c.content.trim(),m=o(u),I=(null===(r=null==d?void 0:d[e])||void 0===r?void 0:r.evaluation_result)||u.evaluation_result||null,h=[];u.next&&Object.values(u.next).forEach(function(i){var e=v[i];if(e&&!1!==e.display_node){var n=y(i,t);n&&h.push(n)}});var g=!(!b&&!x);return i(i({id:e,title:b?c.title:"",content:x?c.content:"",displayTitle:f,displayContent:p,subsections:h},g?m:{score:void 0,relation:"not_defined"}),{evaluationResult:I})};if(u){var m=function(t,l){var s,r,u,c,f,p,b,x,y,I,h,g,E,N,S,R,O,j,P,C,T;void 0===l&&(l=0);var V=[],k=[];if(!t)return{refSections:V,baseSections:k};var D={},J={},U=-1,q=-1;for(var w in t){var F=t[w],M=a[F]||v[F];if(M&&!1!==M.display_node){var z=o(M),A=(null===(s=null==d?void 0:d[F])||void 0===s?void 0:s.evaluation_result)||M.evaluation_result||null,B=n(M,"1",_),G=n(M,"0",_),H=!1!==(null===(r=B.attributes)||void 0===r?void 0:r.display_title)&&B.title.trim()||!1!==(null===(u=B.attributes)||void 0===u?void 0:u.display_content)&&B.content.trim(),K=!1!==(null===(c=G.attributes)||void 0===c?void 0:c.display_title)&&G.title.trim()||!1!==(null===(f=G.attributes)||void 0===f?void 0:f.display_content)&&G.content.trim(),L=Number(null!==(b=null===(p=B.attributes)||void 0===p?void 0:p.display_index)&&void 0!==b?b:U--),Q=Number(null!==(y=null===(x=G.attributes)||void 0===x?void 0:x.display_index)&&void 0!==y?y:q--),W=D[L]||i(i({id:F,title:!1!==(null===(I=B.attributes)||void 0===I?void 0:I.display_title)?B.title:"",content:!1!==(null===(h=B.attributes)||void 0===h?void 0:h.display_content)?B.content:"",subsections:[]},H?z:{score:void 0,relation:"not_defined"}),{refIndexes:[],selfIndex:L,evaluationResult:A,displayContent:null===(g=B.attributes)||void 0===g?void 0:g.display_content,displayTitle:null===(E=B.attributes)||void 0===E?void 0:E.display_title}),X=J[Q]||i(i({id:F,title:!1!==(null===(N=G.attributes)||void 0===N?void 0:N.display_title)?G.title:"",content:!1!==(null===(S=G.attributes)||void 0===S?void 0:S.display_content)?G.content:"",subsections:[]},K?z:{score:void 0,relation:"not_defined"}),{refIndexes:[],selfIndex:Q,evaluationResult:A,displayContent:null===(R=G.attributes)||void 0===R?void 0:R.display_content,displayTitle:null===(O=G.attributes)||void 0===O?void 0:O.display_title});Number(L)>=0&&Number(Q)>=0&&((null===(j=W.refIndexes)||void 0===j?void 0:j.includes(Number(Q)))||null===(P=W.refIndexes)||void 0===P||P.push(Number(Q)),(null===(C=X.refIndexes)||void 0===C?void 0:C.includes(Number(L)))||null===(T=X.refIndexes)||void 0===T||T.push(Number(L))),D[L]=W,J[Q]=X;var Y=m(M.next,l+1),Z=Y.refSections,$=Y.baseSections;Z.length>0&&(W.subsections=e(e([],W.subsections||[],!0),Z,!0)),$.length>0&&(X.subsections=e(e([],X.subsections||[],!0),$,!0))}}V=Object.values(D),k=Object.values(J);var ii=function(i,e){return i.selfIndex<0&&e.selfIndex>=0?1:i.selfIndex>=0&&e.selfIndex<0?-1:i.selfIndex-e.selfIndex};return V.sort(ii),k.sort(ii),{refSections:V,baseSections:k}},I=m(x.next),h=I.refSections,g=I.baseSections;p=h,c=g}else x.next&&Object.values(x.next).forEach(function(i){var e=a[i]||v[i];e&&!1!==e.display_node&&(c.push(y(i,"0")||{id:i,title:"",content:"",subsections:[]}),p.push(y(i,"1")||{id:i,title:"",content:"",subsections:[]}))});return{activeProposed:{title:(null===(l=null===(t=x.comparison_inputs)||void 0===t?void 0:t[_[0]])||void 0===l?void 0:l.title)||"Uploaded Contract",description:x.decision_scope_description||"",sections:c},activeVariants:[{id:"tree-variant-1",title:(null===(r=null===(s=x.comparison_inputs)||void 0===s?void 0:s[_[1]])||void 0===r?void 0:r.title)||"Reference Template",similarity:0,sections:p,analysis:{rule_difference_comparison:{summary:{overall_score:0,overall_summary:x.decision_scope_description||""},fields:{}}}}],parseError:null}}catch(i){return console.error("Data Transformation Error: ",i),{activeProposed:{},activeVariants:[],parseError:i instanceof Error?i.message:"Unknown Parsing Error"}}},[a,u,f]),b=p.activeProposed,_=p.activeVariants,x=p.parseError,y=(null==_?void 0:_[0])||d,m=t(function(){return(null==b?void 0:b.sections)||[]},[null==b?void 0:b.sections]),I=t(function(){return y.sections||[]},[y.sections]),h=m.length>0||I.length>0,g=t(function(){return c.fields.filter(function(i){var e=i.key;return(!h||"description"!==e)&&(l(null==b?void 0:b[e])||l(y[e]))})},[b,y,h,c.fields]),E=t(function(){var i,e,t={},n={},o={},l=0,d=null===(i=null==a?void 0:a.input_index_map)||void 0===i?void 0:i[0],v=null===(e=null==a?void 0:a.input_index_map)||void 0===e?void 0:e[1],c=function(i,e,a,u,f,p){var b,_,x,y,m,I,h,g;if(i&&function(i,e){var t,l=(null===(t=null==i?void 0:i.evaluationResult)||void 0===t?void 0:t.deviations)||{};Object.keys(l).sort().forEach(function(t){var a=l[t];if(a){var u=!s(a[d]),c=!s(a[v]);if(u||c){var f="".concat(i.id).concat(r).concat(t);void 0===n[f]&&(void 0===o[e]&&(o[e]=1),n[f]=o[e]++)}}})}(i,u),i&&!f){var E=(null==p?void 0:p.id)||"fallback_parent_".concat(l++);t[E]||(t[E]=[]),t[E].push(i)}for(var N=Math.max((null===(b=null==e?void 0:e.subsections)||void 0===b?void 0:b.length)||0,(null===(_=null==a?void 0:a.subsections)||void 0===_?void 0:_.length)||0,(null===(x=null==i?void 0:i.subsections)||void 0===x?void 0:x.length)||0),S=0;S<N;S++)c((null===(y=null==i?void 0:i.subsections)||void 0===y?void 0:y[S])||(null===(m=null==e?void 0:e.subsections)||void 0===m?void 0:m[S])||(null===(I=null==a?void 0:a.subsections)||void 0===I?void 0:I[S]),null===(h=null==e?void 0:e.subsections)||void 0===h?void 0:h[S],null===(g=null==a?void 0:a.subsections)||void 0===g?void 0:g[S],u,!1,p)};return m.forEach(function(i,e){var t,n=e+1;u&&void 0!==i.selfIndex&&i.selfIndex>=0&&(n=i.selfIndex+1);var o=null;if(u){var l=null===(t=i.refIndexes)||void 0===t?void 0:t[0];o=I.find(function(i){return i.selfIndex===l})}else o=I[e];c(i,i,o,n,!0,i)}),I.forEach(function(i,e){var t,n=e+1,o=!1;if(u){var l=null===(t=i.refIndexes)||void 0===t?void 0:t[0],s=m.find(function(i){return i.selfIndex===l});s&&void 0!==s.selfIndex&&s.selfIndex>=0?n=s.selfIndex+1:(o=!0,void 0!==i.selfIndex&&i.selfIndex>=0&&(n=i.selfIndex+1))}else e>=m.length&&(o=!0);o&&c(i,null,i,n,!0,i)}),{parentDeviationRecord:t,registry:n}},[m,I,u,a]),N=E.parentDeviationRecord,S=E.registry;return{activeProposed:b,activeVariants:_,existingRule:y,proposedSections:m,existingSections:I,visibleFields:g,parentDeviationRecord:N,deviationNumberRegistry:S,parseError:x}};export{a as useCognitiveTreeData};
|
|
2
2
|
//# sourceMappingURL=useCompareData.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,
|
|
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,GAkczB,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,4MAYnB,qBAAqB,
|
|
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,4MAYnB,qBAAqB,4CAkhGvB,CAAC;AAEF,OAAO,EAAE,sBAAsB,EAAE,CAAC;AAClC,eAAe,gBAAgB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCompareData.d.ts","sourceRoot":"","sources":["../../../../../../src/features/CognitiveCompare/hooks/useCompareData.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAItG,eAAO,MAAM,oBAAoB,aACrB,OAAO,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,yBAClB,OAAO,iBACf,OAAO,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,4BACf,gBAAgB;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"useCompareData.d.ts","sourceRoot":"","sources":["../../../../../../src/features/CognitiveCompare/hooks/useCompareData.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAItG,eAAO,MAAM,oBAAoB,aACrB,OAAO,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,yBAClB,OAAO,iBACf,OAAO,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,4BACf,gBAAgB;;;;;;;;;;CAmT3C,CAAC"}
|