@viswa-test/test-citation 0.0.61 → 0.0.62

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),t=require("react"),i=require("@mui/material"),o=require("lucide-react"),l=require("../../assests/svg/ButtonCognitiveIcon.js"),r=require("./OverlayComponent.js"),c=require("./CognitiveComparehelpers.js"),s=require("./CognitiveCompareConfig.js"),u=require("./CognitiveCompareConstants.js"),a=require("./CognitivePopup.js"),d=require("./MoreFunctionsPopup.js"),v=require("./LoaderComponent.js"),g=require("./components/ThreeDotsLoader.js"),p=require("./hooks/useCompareData.js"),f=require("./hooks/useComparePopups.js"),h=require("./hooks/useSectionRefs.js"),x=require("./hooks/useAccordionState.js"),_=require("./hooks/useDeviationNavigation.js"),m=require("./components/CompareHeader.js"),y=require("./components/SectionAccordion.js"),R=require("./components/SubSectionAccordion.js"),S=require("./components/CognitiveSummaryPopup.js");exports.SHARED_MARKDOWN_STYLES=s.SHARED_MARKDOWN_STYLES,exports.default=function(b){var A,E,I,T,C,B,D,O,j,w,P,k,F,N,M,L=b.componentHeaderText,H=void 0===L?u.DEFAULT_COMPONENT_HEADER_TEXT:L,V=b.treeData,G=b.comparisonConfig,q=b.leftColumnTitleText,z=b.rightColumnTitleText,W=b.markdownStyles,Y=b.displayConfig,K=void 0===Y?{isHeaderVisible:!0,isToggleVisible:!0,maintainRelativeOrder:!1,isLoading:!0}:Y,U=b.popupConfig,X=b.deviationData,J=void 0===X?{}:X,Q=b.deviationNodeIdToView,Z=t.useState(K.maintainRelativeOrder),$=Z[0],ee=Z[1],ne=t.useState(!1),te=ne[0],ie=ne[1],oe=t.useState(!1),le=oe[0],re=oe[1],ce=t.useState(null),se=ce[0],ue=ce[1],ae=t.useState(!1),de=ae[0],ve=ae[1],ge=t.useState(!1),pe=ge[0],fe=ge[1],he=t.useState(null),xe=he[0],_e=he[1],me=t.useRef(!1),ye=t.useState(new Set),Re=ye[0],Se=ye[1],be=t.useState([]),Ae=be[0],Ee=be[1],Ie=t.useRef(null),Te=t.useRef(!1),Ce=t.useRef(null),Be=t.useRef({}),De=t.useRef([]),Oe=t.useRef(!1),je=t.useRef(!1),we=t.useRef(null),Pe=t.useRef(function(){}),ke=t.useMemo(function(){return(null==V?void 0:V.cognitive_decisioning)||{}},[V]),Fe=t.useState({width:0,height:0}),Ne=Fe[0],Me=Fe[1],Le=t.useMemo(function(){return e.__assign(e.__assign({},s.SHARED_MARKDOWN_STYLES),W)},[W]),He=t.useRef(null),Ve=t.useRef(null),Ge=t.useRef(null),qe=t.useRef(null),ze=t.useRef(null),We=t.useRef(null),Ye=t.useRef(null),Ke=t.useRef(null),Ue=t.useRef(!1),Xe=f.useComparePopups(He),Je=Xe.cognitivePopup,Qe=Xe.setCognitivePopup,Ze=Xe.moreFunctions,$e=Xe.setMoreFunctions,en=Xe.position,nn=Xe.setPosition,tn=Xe.activeBadgeId,on=Xe.summaryPopup,ln=Xe.setSummaryPopup,rn=Xe.closeSummaryPopup,cn=Xe.setActiveBadgeId,sn=Xe.popupRef,un=Xe.closeCognitivePopup,an=Xe.closeMoreFunctionsPopup,dn=t.useMemo(function(){var e,n,t,i,o,l,r;return{fields:null!==(e=null==G?void 0:G.fields)&&void 0!==e?e:s.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:s.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:s.DEFAULT_COMPARISON_CONFIG.thresholds.medium,exact:null!==(r=null===(l=null==G?void 0:G.thresholds)||void 0===l?void 0:l.exact)&&void 0!==r?r:s.DEFAULT_COMPARISON_CONFIG.thresholds.exact}}},[G]),vn=t.useState(null),gn=vn[0];vn[1];var pn=null===(I=null===(A=null==V?void 0:V.documents)||void 0===A?void 0:A[null===(E=null==V?void 0:V.input_index_map)||void 0===E?void 0:E[0]])||void 0===I?void 0:I.title,fn=null===(B=null===(T=null==V?void 0:V.documents)||void 0===T?void 0:T[null===(C=null==V?void 0:V.input_index_map)||void 0===C?void 0:C[1]])||void 0===B?void 0:B.title,hn=c.safeStringify(q||pn||"Uploaded Contract"),xn=c.safeStringify(z||fn||"Reference Template"),_n=p.useCognitiveTreeData(V,$,J,dn),mn=_n.activeProposed,yn=_n.existingRule,Rn=_n.proposedSections,Sn=_n.existingSections,bn=_n.visibleFields,An=_n.parentDeviationRecord,En=_n.deviationNumberRegistry,In=_n.parseError;t.useEffect(function(){In&&ue("Failed to load comparison: ".concat(In))},[In]);var Tn=Rn.length>0||Sn.length>0,Cn=h.useSectionRefs(bn.map(function(e){return e.key}),Math.max(Rn.length,Sn.length)),Bn=Cn.leftRefs,Dn=Cn.rightRefs,On=Cn.sectionLeftRefs,jn=Cn.sectionRightRefs,wn=Cn.lhsBadgeRefs,Pn=Cn.rhsBadgeRefs,kn=Cn.sectionRightRowRefs,Fn=Cn.subSectionLeftRefs,Nn=Cn.subSectionRightRefs,Mn=Cn.sectionRowRefs,Ln=Cn.getSectionRowRef,Hn=Cn.getSubSectionRef,Vn=Cn.getBadgeRef,Gn=yn.analysis,qn=c.safeStringify(null===(O=null===(D=null==Gn?void 0:Gn.rule_difference_comparison)||void 0===D?void 0:D.summary)||void 0===O?void 0:O.overall_summary),zn=!!qn.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),Wn=null!==(j=null==V?void 0:V.base_root_id)&&void 0!==j?j:"-1";null==V||V[Wn];var Yn=(null===(w=null==J?void 0:J[Wn])||void 0===w?void 0:w.evaluation_result)||(null===(k=null===(P=null==V?void 0:V.nodes)||void 0===P?void 0:P[Wn])||void 0===k?void 0:k.evaluation_result)||null,Kn=c.extractDeviationScore(Yn),Un=c.generateColorPalette(null!==(M=null===(N=null===(F=null==Yn?void 0:Yn.evaluation_outputs)||void 0===F?void 0:F.metadata)||void 0===N?void 0:N.label_color)&&void 0!==M?M:""),Xn=t.useCallback(function(){var e,n,t,i;ve(!1),je.current=!1;var o=we.current,l=st.current;if(null!==o)if("string"==typeof o&&o.includes(c.DEVIATION_BADGE_SEPARATOR)){var r=o.split(c.DEVIATION_BADGE_SEPARATOR);(s=null===(e=Fn.current[r[2]])||void 0===e?void 0:e.current)&&(s.style.paddingTop="0px")}else{var s;(s=null===(n=On.current[o])||void 0===n?void 0:n.current)&&(s.style.paddingTop="0px")}if(null!==l)if("string"==typeof l&&l.includes(c.DEVIATION_BADGE_SEPARATOR)){r=l.split(c.DEVIATION_BADGE_SEPARATOR);(u=null===(t=Nn.current[r[3]])||void 0===t?void 0:t.current)&&(u.style.paddingTop="0px")}else{var u;(u=null===(i=jn.current[l])||void 0===i?void 0:i.current)&&(u.style.paddingTop="0px")}_e(null),we.current=null,st.current=null,fe(!1),re(!1),qe.current&&(qe.current.style.height="0px"),ze.current&&(ze.current.style.height="0px"),We.current&&(We.current.style.height="0px"),Ye.current&&(Ye.current.style.height="0px")},[]),Jn=x.useAccordionState({maintainRelativeOrder:!!$,proposedSections:Rn,existingSections:Sn,activeSideBySideSection:xe,connectedSections:Re,resetSideBySide:Xn,setConnectedSections:Se,setConnectedLines:Ee,cachedConnectedPositions:De,svgContainerRef:Ie,isAnimatingRef:Te,animationTimerRef:Ce,calculateLinesRef:Pe,sectionLeftRefs:On,sectionRightRefs:jn,subSectionLeftRefs:Fn,subSectionRightRefs:Nn}),Qn=Jn.expandedSections,Zn=Jn.expandedSubSections,$n=Jn.setExpandedSubSections,et=Jn.toggleSection,nt=t.useCallback(function(e,n,t,i,o,l,r){var s,u,a,d=c.safeStringify(null==n?void 0:n.id)||c.safeStringify(null==t?void 0:t.id)||"",v=(d?ke[d]:null)||(null==n?void 0:n.cognitiveData)||(null==t?void 0:t.cognitiveData)||{section_id:d,decisioning:[],gap:[],relevance_score:0},g=null!==(u=null===(s=Mn.current[i])||void 0===s?void 0:s.current)&&void 0!==u?u:null;return{isLoading:null!==(a=null==K?void 0:K.isLoading)&&void 0!==a&&a,open:!0,sectionTitle:(null==n?void 0:n.displayTitle)?null==n?void 0:n.title:"no title",refSectionTitle:(null==t?void 0:t.displayTitle)?null==t?void 0:t.title:"no title",cognitiveData:v,anchorEl:e,sectionAnchorEl:g,badgeStyle:l||null,sectionIdx:i,docData:{documents:null==V?void 0:V.documents,input_index_map:null==V?void 0:V.input_index_map},deviationData:(null==n?void 0:n.evaluationResult)||(null==t?void 0:t.evaluationResult)||null,isOrphan:!!o}},[ke,V]),tt=t.useCallback(function(e){an(),nn(null),Qe(e)},[an]),it=function(e,n,t,i,o,l){e.stopPropagation(),Ze.open&&Ze.sectionIdx===o?an():(un(),$e(nt(e.currentTarget,n,i,o,t,l)))},ot=t.useCallback(function(){null!==Ze.sectionIdx&&Ze.anchorEl?tt(e.__assign(e.__assign({},Ze),{open:!0})):an()},[Ze,an,tt]),lt=t.useCallback(function(){var e=Ze.sectionIdx,n=Ze.isOrphan,t=null!==e&&Re.has(e);an(),null!==e&&(n?ue("No counterpart exists to connect to."):(je.current&&Xn(),t&&(Ee([]),De.current=[]),Se(function(n){return n.has(e)?new Set:new Set([e])})))},[Ze.sectionIdx,an,Xn]),rt=t.useRef(null),ct=t.useRef(null),st=t.useRef(null),ut=t.useRef(null),at=t.useRef(null),dt=t.useRef(null),vt=t.useState([]),gt=vt[0],pt=vt[1];t.useRef(null);var ft=t.useState(null),ht=ft[0],xt=ft[1];t.useEffect(function(){if(gn){var e=dn.fields.find(function(e){return e.analysisKey===gn||e.key===gn});if(e){var n=Bn.current[e.key]||Dn.current[e.key];(null==n?void 0:n.current)&&setTimeout(function(){return n.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[gn,dn.fields]);var _t=t.useCallback(function(e){var n,t,i,o,l,r,c,s,u,a=null===(n=null==Gn?void 0:Gn.rule_difference_comparison)||void 0===n?void 0:n.fields;if(!a||!a[e])return{score:0,relation:"",highlightsA:[],highlightsB:[],hasContent:!1};var d=a[e],v=(null==d?void 0:d.relation)||(null===(i=null===(t=null==d?void 0:d.highlights)||void 0===t?void 0:t.ruleA_spans)||void 0===i?void 0:i.length)||(null===(l=null===(o=null==d?void 0:d.highlights)||void 0===o?void 0:o.ruleB_spans)||void 0===l?void 0:l.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===(r=g.highlights)||void 0===r?void 0:r.ruleA_spans)||[],highlightsB:(null===(c=g.highlights)||void 0===c?void 0:c.ruleB_spans)||[],hasContent:!!v}}return{score:d.score,relation:d.relation||"",highlightsA:(null===(s=d.highlights)||void 0===s?void 0:s.ruleA_spans)||[],highlightsB:(null===(u=d.highlights)||void 0===u?void 0:u.ruleB_spans)||[],hasContent:!!v}},[Gn]),mt=t.useCallback(function(n){var t,i,o,l,r,s,a,d=Rn[n],v=Sn[n],g=(null==d?void 0:d.relation)&&"not_defined"!==d.relation,p=(null==v?void 0:v.relation)&&"not_defined"!==v.relation;c.safeStringify(null==d?void 0:d.id)||c.safeStringify(null==v?void 0:v.id);var f=!(!(null==d?void 0:d.cognitiveData)&&!(null==v?void 0:v.cognitiveData));if(!g&&!p&&!f)return e.__assign(e.__assign({},c.generateColorPalette(u.DEFAULT_DEVIAION_COLOR)),{label:"Not Defined"});var h=null!==(i=null!==(t=null==d?void 0:d.evaluationResult)&&void 0!==t?t:null==v?void 0:v.evaluationResult)&&void 0!==i?i:null,x=null===(o=null==h?void 0:h.evaluation_outputs)||void 0===o?void 0:o.output_value,_=null!==(s=null===(r=null===(l=null==h?void 0:h.evaluation_outputs)||void 0===l?void 0:l.metadata)||void 0===r?void 0:r.label_color)&&void 0!==s?s:u.DEFAULT_DEVIAION_COLOR;return null!=h?e.__assign(e.__assign({},c.generateColorPalette(_)),{label:null!==(a=x)&&void 0!==a?a:""}):e.__assign(e.__assign({},c.generateColorPalette(_)),{label:null})},[Rn,Sn,ke,dn,_t]),yt=t.useCallback(function(n){for(var t,i,o,l,r,s,a,d,v,g=n.split("-").map(Number),p=Rn[g[0]],f=Sn[g[0]],h=1;h<g.length;h++)(null==p?void 0:p.subsections)&&(p=p.subsections[g[h]]),(null==f?void 0:f.subsections)&&(f=f.subsections[g[h]]);if(!p&&!f)return null;var x=(null==p?void 0:p.relation)&&"not_defined"!==p.relation,_=(null==f?void 0:f.relation)&&"not_defined"!==f.relation,m=c.safeStringify(null==p?void 0:p.id)||c.safeStringify(null==f?void 0:f.id)||"",y=!(!(null==p?void 0:p.cognitiveData)&&!(null==f?void 0:f.cognitiveData));if(!x&&!_&&!y)return e.__assign(e.__assign({},c.generateColorPalette(u.DEFAULT_DEVIAION_COLOR)),{label:"Not Defined"});null!==(i=null!==(t=null==p?void 0:p.cognitiveRelevanceScore)&&void 0!==t?t:null==f?void 0:f.cognitiveRelevanceScore)&&void 0!==i||m&&(null===(o=ke[m])||void 0===o||o.relevance_score);var R=null!==(r=null!==(l=null==p?void 0:p.evaluationResult)&&void 0!==l?l:null==f?void 0:f.evaluationResult)&&void 0!==r?r:null,S=null===(s=null==R?void 0:R.evaluation_outputs)||void 0===s?void 0:s.output_value,b=null!==(v=null===(d=null===(a=null==R?void 0:R.evaluation_outputs)||void 0===a?void 0:a.metadata)||void 0===d?void 0:d.label_color)&&void 0!==v?v:u.DEFAULT_DEVIAION_COLOR;return null!=R?e.__assign(e.__assign({},c.generateColorPalette(b)),{label:null!=S?S:""}):e.__assign(e.__assign({},c.generateColorPalette(b)),{label:null})},[Rn,Sn,ke,dn]),Rt=t.useCallback(function(){var e,n,t,i,o,l,r,s,u,a,d,v,g,p,f,h,x,_,m,y,R,S;if(!Ue.current&&!Te.current){Ue.current=!0;try{if(!rt.current)return;var b=function(e){var n=e.split("-"),t=n[0];if(!Qn[t]&&!1===$)return!1;if($&&!Qn["left-".concat(t)]&&!Qn["right-".concat(t)]&&!Qn[t])return!1;for(var i=t,o=1;o<n.length-1;o++)if(i+="-".concat(n[o]),!Zn[i])return!1;return!0},A=rt.current.getBoundingClientRect();Me({width:A.width,height:A.height});var E=[];if(bn.forEach(function(e){var n,t,i=e.key,o=null===(n=Bn.current[i])||void 0===n?void 0:n.current,l=null===(t=Dn.current[i])||void 0===t?void 0:t.current;o&&l&&(o.style.height="auto",l.style.height="auto",o.style.minHeight="0px",l.style.minHeight="0px")}),!Te.current){for(var I=0;I<Math.max(Rn.length,Sn.length);I++){var T=null===(e=On.current[I])||void 0===e?void 0:e.current,C=null===(n=jn.current[I])||void 0===n?void 0:n.current;T&&(T.style.height="auto",T.style.minHeight="0px"),C&&(C.style.height="auto",C.style.minHeight="0px")}$||Object.keys(Fn.current).forEach(function(e){var n,t;if(b(e)){var i=null===(n=Fn.current[e])||void 0===n?void 0:n.current,o=null===(t=Nn.current[e])||void 0===t?void 0:t.current;i&&o&&(i.style.height="auto",o.style.height="auto",i.style.minHeight="0px",o.style.minHeight="0px")}})}var B={};bn.forEach(function(e){var n,t,i=e.key,o=null===(n=Bn.current[i])||void 0===n?void 0:n.current,l=null===(t=Dn.current[i])||void 0===t?void 0:t.current;if(o&&l){var r=o.getBoundingClientRect(),c=l.getBoundingClientRect();B[i]=Math.max(r.height,c.height)}});var D={left:{},right:{}},O={};if(!Te.current)if($){if(de&&null!==xe)if("number"==typeof xe){var j=xe,w=Rn[j],P=null===(o=On.current[j])||void 0===o?void 0:o.current;P&&w&&(w.refIndexes||[]).forEach(function(e){var n,t=Sn.findIndex(function(n){return n.selfIndex===e}),i=null===(n=jn.current[t])||void 0===n?void 0:n.current;if(i&&(Qn["left-".concat(j)]||Qn["right-".concat(t)])){var o=Math.max(P.getBoundingClientRect().height,i.getBoundingClientRect().height);D.left[j]=Math.max(D.left[j]||0,o),D.right[t]=Math.max(D.right[t]||0,o)}})}else{var k=xe.split(c.DEVIATION_BADGE_SEPARATOR)[2];if(k){T=null===(l=Fn.current[k])||void 0===l?void 0:l.current,C=null===(r=Nn.current[k])||void 0===r?void 0:r.current;if(T&&C){F=Math.max(T.getBoundingClientRect().height,C.getBoundingClientRect().height);O[k]=Math.max(O[k]||0,F)}}}}else{Object.keys(Fn.current).forEach(function(e){var n,t;if(b(e)){var i=null===(n=Fn.current[e])||void 0===n?void 0:n.current,o=null===(t=Nn.current[e])||void 0===t?void 0:t.current;if(i&&o&&null!==i.offsetParent&&null!==o.offsetParent){var l=i.getBoundingClientRect(),r=o.getBoundingClientRect(),c=Math.max(l.height,r.height);O[e]=c,i.style.minHeight="".concat(c,"px"),o.style.minHeight="".concat(c,"px")}}});for(I=0;I<Math.min(Rn.length,Sn.length);I++){var T=null===(t=On.current[I])||void 0===t?void 0:t.current,C=null===(i=jn.current[I])||void 0===i?void 0:i.current;if(T&&C){var F=Math.max(T.getBoundingClientRect().height,C.getBoundingClientRect().height);D.left[I]=F,D.right[I]=F}}}if(bn.forEach(function(e){var n,t,i=e.key,o=null===(n=Bn.current[i])||void 0===n?void 0:n.current,l=null===(t=Dn.current[i])||void 0===t?void 0:t.current;if(o&&l){var r=B[i];o.style.minHeight="".concat(r,"px"),l.style.minHeight="".concat(r,"px")}}),Te.current||(Object.entries(D.left).forEach(function(e){var n,t=e[0],i=e[1],o=null===(n=On.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=jn.current[Number(t)])||void 0===n?void 0:n.current;o&&(o.style.minHeight="".concat(i,"px"))}),$||Object.keys(O).forEach(function(e){var n,t,i=null===(n=Fn.current[e])||void 0===n?void 0:n.current,o=null===(t=Nn.current[e])||void 0===t?void 0:t.current;if(i&&o&&O[e]){var l=O[e];i.style.minHeight="".concat(l,"px"),o.style.minHeight="".concat(l,"px")}})),$)Rn.forEach(function(e,n){var t;(null===(t=On.current[n])||void 0===t?void 0:t.current)&&(e.refIndexes||[]).forEach(function(e){var t,i,o,l,r,c,s,u,a,d,v=Sn.findIndex(function(n){return n.selfIndex===e});if(-1!==v){var g=null===(t=wn.current[n])||void 0===t?void 0:t.current,p=null===(i=Pn.current[v])||void 0===i?void 0:i.current;if(g&&p){var f=g.getBoundingClientRect(),h=p.getBoundingClientRect(),x=f.right-A.left,_=h.left-A.left,m=f.top+f.height/2-A.top,y=h.top+h.height/2-A.top;if(de&&xe===n){var R=null!==(l=null===(o=Ke.current)||void 0===o?void 0:o.getBoundingClientRect().top)&&void 0!==l?l:0,S=null!==(c=null===(r=Ge.current)||void 0===r?void 0:r.getBoundingClientRect().top)&&void 0!==c?c:0,b=R+(null!==(u=null===(s=Ke.current)||void 0===s?void 0:s.clientHeight)&&void 0!==u?u:1/0),I=S+(null!==(d=null===(a=Ge.current)||void 0===a?void 0:a.clientHeight)&&void 0!==d?d:1/0),T=f.top+f.height/2,C=function(e,n,t){return Math.max(n,Math.min(t,e))};m=C(T,R,b)-A.top,y=C(T,S,I)-A.top}var B=mt(n);B&&E.push({id:"line-".concat(n,"-").concat(v),x1:x,y1:m,x2:_,y2:y,style:B,sectionIdx:n,targetRightIdx:v})}}})});else{for(I=0;I<Math.min(Rn.length,Sn.length);I++){var N=null===(s=On.current[I])||void 0===s?void 0:s.current,M=null===(u=jn.current[I])||void 0===u?void 0:u.current;if(N&&M){var L=N.getBoundingClientRect(),H=M.getBoundingClientRect(),V=Math.max(L.top,H.top)+18-A.top,G=(null===(a=Sn[I])||void 0===a?void 0:a.id)||"sec-".concat(I);(J=mt(I))&&E.push({id:G,x1:L.right-A.left,y1:V,x2:H.left-A.left,y2:V,style:J,sectionIdx:I,hasCognitive:!!((null===(d=Rn[I])||void 0===d?void 0:d.cognitiveData)||(null===(v=Sn[I])||void 0===v?void 0:v.cognitiveData)||G&&ke[G]),isSubSection:!1})}}Object.keys(Fn.current).forEach(function(e){var n,t,i,o,l,r;if(b(e)){var s=null===(n=Fn.current[e])||void 0===n?void 0:n.current,u=null===(t=Nn.current[e])||void 0===t?void 0:t.current;if(s&&u){for(var a=e.split("-").map(Number),d=Rn[a[0]],v=Sn[a[0]],g=1;g<a.length;g++)(null==d?void 0:d.subsections)&&(d=d.subsections[a[g]]),(null==v?void 0:v.subsections)&&(v=v.subsections[a[g]]);var p=!!d&&((null===(i=d.displayTitle)||void 0===i||i)&&c.hasValue(d.title)),f=!!d&&((null===(o=d.displayContent)||void 0===o||o)&&c.hasValue(d.content)),h=!!v&&((null===(l=v.displayTitle)||void 0===l||l)&&c.hasValue(v.title)),x=!!v&&((null===(r=v.displayContent)||void 0===r||r)&&c.hasValue(v.content));if(p&&f||h&&x){var _=s.getBoundingClientRect(),m=u.getBoundingClientRect(),y=Math.max(_.top,m.top)+16-A.top,R=yt(e);R&&"Not Defined"!==R.label&&E.push({id:"subsec-".concat(e),x1:_.right-A.left,y1:y,x2:m.left-A.left,y2:y,style:R,sectionIdx:a[0],isSubSection:!0,subSectionKeyPath:e,hasCognitive:!(!(null==d?void 0:d.cognitiveData)&&!(null==v?void 0:v.cognitiveData))})}}}})}if(de&&"string"==typeof xe&&xe.includes(c.DEVIATION_BADGE_SEPARATOR)){var q=xe.split(c.DEVIATION_BADGE_SEPARATOR),z=q[0],W=q[1],Y=q[2],K=(q[3],"".concat(z).concat(c.DEVIATION_BADGE_SEPARATOR).concat(W)),U=null===(g=wn.current[K])||void 0===g?void 0:g.current,X=null===(p=Pn.current[K])||void 0===p?void 0:p.current;if(U&&X){var J,Q=U.getBoundingClientRect(),Z=X.getBoundingClientRect(),ee=Q.right-A.left,ne=Z.left-A.left,te=Q.top+Q.height/2-A.top,ie=Z.top+Z.height/2-A.top;if($){var oe=null!==(h=null===(f=Ke.current)||void 0===f?void 0:f.getBoundingClientRect().top)&&void 0!==h?h:0,le=null!==(_=null===(x=Ge.current)||void 0===x?void 0:x.getBoundingClientRect().top)&&void 0!==_?_:0,re=oe+(null!==(y=null===(m=Ke.current)||void 0===m?void 0:m.clientHeight)&&void 0!==y?y:1/0),ce=le+(null!==(S=null===(R=Ge.current)||void 0===R?void 0:R.clientHeight)&&void 0!==S?S:1/0),se=function(e,n,t){return Math.max(n,Math.min(t,e))};te=se(Q.top+Q.height/2,oe,re)-A.top,ie=se(Z.top+Z.height/2,le,ce)-A.top}(J=yt(Y))&&E.push({id:"line-subsec-".concat(K),x1:ee,y1:te,x2:ne,y2:ie,style:J,sectionIdx:Number(Y.split("-")[0]),isSubSection:!0,subSectionKeyPath:xe})}}if(pt(E),at.current&&dt.current){var ue=at.current.getBoundingClientRect(),ae=dt.current.getBoundingClientRect(),ve=(ue.top+ue.height/2-A.top+ae.top+ae.height/2-A.top)/2;xt({x1:ue.right-A.left,x2:ae.left-A.left,y:ve})}else xt(null);if(Re.size>0){var ge=[],pe=Ke.current,fe=Ge.current;if(pe&&fe){var he=[],_e=pe.getBoundingClientRect().top,me=fe.getBoundingClientRect().top,ye=_e+pe.clientHeight,Se=me+fe.clientHeight,be=pe.scrollTop,Ae=fe.scrollTop,Ie=A.top,Ce=function(e,n,t){return Math.max(n,Math.min(t,e))};Re.forEach(function(e){var n,t,i,o,l;if("string"==typeof e&&e.includes(c.DEVIATION_BADGE_SEPARATOR)){var r=e.split(c.DEVIATION_BADGE_SEPARATOR),s=r[0],u=r[1],a=r[2],d=(r[3],"".concat(s).concat(c.DEVIATION_BADGE_SEPARATOR).concat(u)),v=null===(n=wn.current[d])||void 0===n?void 0:n.current,g=null===(t=Pn.current[d])||void 0===t?void 0:t.current;if(!v||!g)return;var p=v.getBoundingClientRect(),f=g.getBoundingClientRect(),h=yt(a),x=(P=p.right-A.left)+.5*((k=f.left-A.left-0)-P),_=p.top+p.height/2,m=f.top+f.height/2,y=_-_e+be,R=m-me+Ae,S="conn-subsec-".concat(d);he.push({lhsScrollY:y,rhsScrollY:R,x1:P,x2:k,containerTop:Ie,leftIdx:e,rhsArrayIdx:e,styleColor:(null==h?void 0:h.badgeBorder)||"#6366F1",styleId:S});var b=Ce(_,_e,ye),E=Ce(m,me,Se),I=b-Ie,T=E-Ie,C=m>=me-4&&m<=Se+4,B="";B=(F=_>=_e-4&&_<=ye+4)&&C?c.getBentArrowPath(P,I,k,T):F&&!C?"M ".concat(P,",").concat(I," L ").concat(x,",").concat(I," L ").concat(x,",").concat(T):!F&&C?"M ".concat(x,",").concat(I," L ").concat(x,",").concat(T," L ").concat(k,",").concat(T):"M ".concat(x,",").concat(I," L ").concat(x,",").concat(T),ge.push({id:S,pathD:B,style:h,leftIdx:e,rhsArrayIdx:e})}else if($){var D=e,O=Rn[D];if(!(null===(l=null==O?void 0:O.refIndexes)||void 0===l?void 0:l.length))return;O.refIndexes.forEach(function(e){var n,t,i=Sn.findIndex(function(n){return n.selfIndex===e});if(-1!==i){var o=null===(n=wn.current[D])||void 0===n?void 0:n.current,l=null===(t=Pn.current[i])||void 0===t?void 0:t.current;if(o&&l){var r=o.getBoundingClientRect(),s=l.getBoundingClientRect(),u=mt(D),a=r.right-A.left,d=s.left-A.left-0,v=a+.5*(d-a),g=r.top+r.height/2,p=s.top+s.height/2,f=g-_e+be,h=p-me+Ae,x="conn-".concat(D,"-").concat(i);he.push({lhsScrollY:f,rhsScrollY:h,x1:a,x2:d,containerTop:Ie,leftIdx:D,rhsArrayIdx:i,styleColor:(null==u?void 0:u.badgeBorder)||"#6366F1",styleId:x});var _=Ce(g,_e,ye),m=Ce(p,me,Se),y=_-Ie,R=m-Ie,S=g>=_e-4&&g<=ye+4,b=p>=me-4&&p<=Se+4,E="";E=S&&b?c.getBentArrowPath(a,y,d,R):S&&!b?"M ".concat(a,",").concat(y," L ").concat(v,",").concat(y," L ").concat(v,",").concat(R):!S&&b?"M ".concat(v,",").concat(y," L ").concat(v,",").concat(R," L ").concat(d,",").concat(R):"M ".concat(v,",").concat(y," L ").concat(v,",").concat(R),ge.push({id:x,pathD:E,style:u,leftIdx:D,rhsArrayIdx:i})}}})}else{var j=e,w=j;v=null===(i=wn.current[j])||void 0===i?void 0:i.current,g=null===(o=Pn.current[w])||void 0===o?void 0:o.current;if(!v||!g)return;var P,k;p=v.getBoundingClientRect(),f=g.getBoundingClientRect(),h=mt(j),x=(P=p.right-A.left)+.5*((k=f.left-A.left-0)-P),_=p.top+p.height/2,m=f.top+f.height/2,y=_-_e+be,R=m-me+Ae,S="conn-".concat(j,"-").concat(w);he.push({lhsScrollY:y,rhsScrollY:R,x1:P,x2:k,containerTop:Ie,leftIdx:j,rhsArrayIdx:w,styleColor:(null==h?void 0:h.badgeBorder)||"#6366F1",styleId:S});var F;b=Ce(_,_e,ye),E=Ce(m,me,Se),I=b-Ie,T=E-Ie,C=m>=me-4&&m<=Se+4,B="";B=(F=_>=_e-4&&_<=ye+4)&&C?c.getBentArrowPath(P,I,k,T):F&&!C?"M ".concat(P,",").concat(I," L ").concat(x,",").concat(I," L ").concat(x,",").concat(T):!F&&C?"M ".concat(x,",").concat(I," L ").concat(x,",").concat(T," L ").concat(k,",").concat(T):"M ".concat(x,",").concat(I," L ").concat(x,",").concat(T),ge.push({id:S,pathD:B,style:h,leftIdx:j,rhsArrayIdx:w})}}),De.current=he}Ee(ge)}else Ee([]),De.current=[]}catch(e){console.error("Line render safe fail: ",e)}finally{Ue.current=!1}}},[bn,Rn,Sn,ke,dn,_t,mt,$,de,xe,Re,Qn,Zn]),St=t.useCallback(function(){var e,n,t,i,o,l,r,s,u,a,d,v,g,p,f=De.current;if(f.length&&!Te.current){var h=null!==(n=null===(e=Ke.current)||void 0===e?void 0:e.scrollTop)&&void 0!==n?n:0,x=null!==(i=null===(t=Ge.current)||void 0===t?void 0:t.scrollTop)&&void 0!==i?i:0,_=null!==(l=null===(o=Ke.current)||void 0===o?void 0:o.clientHeight)&&void 0!==l?l:1/0,m=null!==(s=null===(r=Ge.current)||void 0===r?void 0:r.clientHeight)&&void 0!==s?s:1/0,y=null!==(a=null===(u=Ke.current)||void 0===u?void 0:u.getBoundingClientRect().top)&&void 0!==a?a:0,R=null!==(v=null===(d=Ge.current)||void 0===d?void 0:d.getBoundingClientRect().top)&&void 0!==v?v:0,S=y+_,b=R+m,A=null!==(p=null===(g=rt.current)||void 0===g?void 0:g.getBoundingClientRect().top)&&void 0!==p?p:0,E=function(e,n,t){return Math.max(n,Math.min(t,e))};f.forEach(function(e){var n=e.lhsScrollY-h+y,t=e.rhsScrollY-x+R,i=Be.current[e.styleId+"-stroke"],o=Be.current[e.styleId+"-bg"];if(i||o){var l,r=E(n,y,S),s=E(t,R,b),u=r-A,a=s-A,d=n>=y-4&&n<=S+4,v=t>=R-4&&t<=b+4,g=e.x1+.5*(e.x2-e.x1);l=d&&v?c.getBentArrowPath(e.x1,u,e.x2,a):d&&!v?"M ".concat(e.x1,",").concat(u," L ").concat(g,",").concat(u," L ").concat(g,",").concat(a):!d&&v?"M ".concat(g,",").concat(u," L ").concat(g,",").concat(a," L ").concat(e.x2,",").concat(a):"M ".concat(g,",").concat(u," L ").concat(g,",").concat(a),i&&(i.setAttribute("visibility","visible"),i.setAttribute("d",l)),o&&(o.setAttribute("visibility","visible"),o.setAttribute("d",l))}})}},[]);t.useEffect(function(){Pe.current=Rt},[Rt]);var bt=t.useRef(null),At=t.useCallback(function(){De.current.length>0&&!Te.current||(null!==bt.current&&clearTimeout(bt.current),bt.current=setTimeout(function(){Pe.current(),bt.current=null},50))},[]),Et=t.useCallback(function(e){var n,t,i,o,l,r,s,u,a,d;if(!me.current){if($||At(),je.current){var v=we.current,g=st.current,p=Ke.current,f=Ge.current;if(null!==v&&null!==g&&p&&f){var h="string"==typeof v&&v.includes(c.DEVIATION_BADGE_SEPARATOR)?null===(n=wn.current["".concat(v.split(c.DEVIATION_BADGE_SEPARATOR)[0]).concat(c.DEVIATION_BADGE_SEPARATOR).concat(v.split(c.DEVIATION_BADGE_SEPARATOR)[1])])||void 0===n?void 0:n.current:null===(t=Mn.current[v])||void 0===t?void 0:t.current,x="string"==typeof g&&g.includes(c.DEVIATION_BADGE_SEPARATOR)?null===(i=Pn.current["".concat(g.split(c.DEVIATION_BADGE_SEPARATOR)[0]).concat(c.DEVIATION_BADGE_SEPARATOR).concat(g.split(c.DEVIATION_BADGE_SEPARATOR)[1])])||void 0===i?void 0:i.current:null===(o=kn.current[g])||void 0===o?void 0:o.current;if(h&&x){var _=h.getBoundingClientRect().top-p.getBoundingClientRect().top+p.scrollTop,m=x.getBoundingClientRect().top-f.getBoundingClientRect().top+f.scrollTop;if(e.currentTarget===p){var y=m-(_-p.scrollTop),R=f.scrollHeight-f.clientHeight,S=Math.max(0,Math.min(y,R));Math.abs(f.scrollTop-S)>1&&(f.scrollTop=S)}else if(e.currentTarget===f){var b=_-(m-f.scrollTop),A=p.scrollHeight-p.clientHeight,E=Math.max(0,Math.min(b,A));Math.abs(p.scrollTop-E)>1&&(p.scrollTop=E)}if(ut.current){var I=void 0,T=void 0;if("string"==typeof v&&v.includes(c.DEVIATION_BADGE_SEPARATOR)){var C=v.split(c.DEVIATION_BADGE_SEPARATOR),B="".concat(C[0]).concat(c.DEVIATION_BADGE_SEPARATOR).concat(C[1]);I=null===(l=wn.current[B])||void 0===l?void 0:l.current,T=null===(r=Pn.current[B])||void 0===r?void 0:r.current}else I=null===(s=wn.current[v])||void 0===s?void 0:s.current,T=null===(u=Pn.current[g])||void 0===u?void 0:u.current;var D=null!==(d=null===(a=rt.current)||void 0===a?void 0:a.getBoundingClientRect().top)&&void 0!==d?d:0,O=p.getBoundingClientRect().top,j=O+p.clientHeight,w=f.getBoundingClientRect().top,P=w+f.clientHeight,k=function(e,n,t){return Math.max(n,Math.min(t,e))};if(I&&T){var F=I.getBoundingClientRect(),N=T.getBoundingClientRect(),M=F.top+F.height/2,L=N.top+N.height/2,H=k(M,O,j),V=k(L,w,P);ut.current.setAttribute("y1",(H-D).toString()),ut.current.setAttribute("y2",(V-D).toString());var G=M>=O-4&&M<=j+4;ut.current.setAttribute("visibility",G?"visible":"hidden")}}}}}De.current.length>0&&!Oe.current&&(Oe.current=!0,requestAnimationFrame(function(){St(),Oe.current=!1}))}},[St,$,At]);t.useEffect(function(){var e=setTimeout(At,250);window.addEventListener("resize",At);var n=null,t=null;return He.current&&(n=new ResizeObserver(At)).observe(He.current),rt.current&&(t=new ResizeObserver(At)).observe(rt.current),function(){clearTimeout(e),window.removeEventListener("resize",At),null==n||n.disconnect(),null==t||t.disconnect()}},[mn,yn,Gn,bn,Qn,Zn,Rn,Sn,dn,At,de,xe,pe,Re]),t.useEffect(function(){je.current=de},[de]),t.useEffect(function(){we.current=xe},[xe]);var It=t.useCallback(function(e,n,t){var i,o,l,r,s,u=null===(i=null==t?void 0:t.toggleIfSame)||void 0===i||i,a=null==t?void 0:t.onReady;if(an(),null!=e)if(n)ue("No counterpart exists for this section.");else if(de&&xe===e)u?Xn():null==a||a();else{if(!$){var d=we.current,v=st.current;if(null!==d)if("string"==typeof d&&d.includes(c.DEVIATION_BADGE_SEPARATOR)){var g=d.split(c.DEVIATION_BADGE_SEPARATOR);(p=null===(o=Fn.current[g[2]])||void 0===o?void 0:o.current)&&(p.style.paddingTop="0px")}else{var p;(p=null===(l=On.current[d])||void 0===l?void 0:l.current)&&(p.style.paddingTop="0px")}if(null!==v)if("string"==typeof v&&v.includes(c.DEVIATION_BADGE_SEPARATOR)){g=v.split(c.DEVIATION_BADGE_SEPARATOR);(f=null===(r=Nn.current[g[3]])||void 0===r?void 0:r.current)&&(f.style.paddingTop="0px")}else{var f;(f=null===(s=jn.current[v])||void 0===s?void 0:s.current)&&(f.style.paddingTop="0px")}}Se(new Set),Ee([]),De.current=[],re(!0),me.current=!0,_e(e),we.current=e,ve(!0),je.current=!0,fe(!1),qe.current&&(qe.current.style.height="0px"),ze.current&&(ze.current.style.height="0px"),We.current&&(We.current.style.height="0px"),Ye.current&&(Ye.current.style.height="0px"),requestAnimationFrame(function(){var n,t,i,o,l,r,s,u,d,v,g=null,p=null,f=null,h=null,x=null;if("string"==typeof e&&e.includes(c.DEVIATION_BADGE_SEPARATOR)){var _=e.split(c.DEVIATION_BADGE_SEPARATOR),m="".concat(_[0]).concat(c.DEVIATION_BADGE_SEPARATOR).concat(_[1]);g=(null===(n=wn.current[m])||void 0===n?void 0:n.current)||null,x=(p=(null===(t=Pn.current[m])||void 0===t?void 0:t.current)||null)?e:null,f=(null===(i=Fn.current[_[2]])||void 0===i?void 0:i.current)||null,h=(null===(o=Nn.current[_[3]])||void 0===o?void 0:o.current)||null}else if(g=(null===(l=Mn.current[e])||void 0===l?void 0:l.current)||null,f=(null===(r=On.current[e])||void 0===r?void 0:r.current)||null,$){var y=Rn[e],R=(null==y?void 0:y.refIndexes)||[];if(R.length>0){var S=R[0],b=Sn.findIndex(function(e){return e.selfIndex===S});-1!==b&&(p=(null===(d=kn.current[b])||void 0===d?void 0:d.current)||null,h=(null===(v=jn.current[b])||void 0===v?void 0:v.current)||null,x=b)}}else p=(null===(s=kn.current[e])||void 0===s?void 0:s.current)||null,h=(null===(u=jn.current[e])||void 0===u?void 0:u.current)||null,x=p?e:null;st.current=x;var A=Ke.current,E=Ge.current;if(!g||!A)return me.current=!1,re(!1),void(null==a||a());if(!p||!E)return fe(!0),Pe.current(),me.current=!1,re(!1),void(null==a||a());if(!$){var I=g.getBoundingClientRect(),T=p.getBoundingClientRect(),C=I.top-T.top;f&&h&&(f.style.paddingTop="0px",h.style.paddingTop="0px",C>0?h.style.paddingTop="".concat(C,"px"):C<0&&(f.style.paddingTop="".concat(Math.abs(C),"px")));var B=g?g.getBoundingClientRect().top:(null==f?void 0:f.getBoundingClientRect().top)||0,D=He.current,O=D?D.scrollTop+B-150:0;return D?void c.smoothScrollTo(D,O,200,function(){fe(!0),Pe.current(),me.current=!1,re(!1),null==a||a()}):(fe(!0),Pe.current(),me.current=!1,re(!1),void(null==a||a()))}var j=g.getBoundingClientRect().top-A.getBoundingClientRect().top+A.scrollTop,w=p.getBoundingClientRect().top-E.getBoundingClientRect().top+E.scrollTop-(j-A.scrollTop);w<0&&qe.current&&(qe.current.style.height="".concat(Math.abs(w),"px"));requestAnimationFrame(function(){var e,n=E.scrollHeight-E.clientHeight;if(w<0)e=0;else{if(w>n){var t=w-n;return ze.current&&(ze.current.style.height="".concat(t+150,"px")),void requestAnimationFrame(function(){c.smoothScrollTo(E,w,200,function(){fe(!0),Pe.current(),me.current=!1,re(!1),null==a||a()})})}e=w}c.smoothScrollTo(E,e,200,function(){fe(!0),Pe.current(),me.current=!1,re(!1),null==a||a()})})})}},[xe,an,Sn,de,$,Rn,Xn]),Tt=t.useCallback(function(e,n,t,i){var o="string"==typeof i?c.safeStringify(i).trim():c.safeStringify(null==i?void 0:i.deviation_summary).trim(),l=e.currentTarget;un(),It(n,t,o?{toggleIfSame:!1,onReady:function(){ln({open:!0,anchorEl:l,summary:i})}}:{toggleIfSame:!1})},[It,un,ln]),Ct=t.useCallback(function(){var e=Ze.sectionIdx,n=Ze.isOrphan;null!=e&&It(e,n)},[It,Ze.isOrphan,Ze.sectionIdx]),Bt=t.useCallback(function(){rn(),Xn()},[rn,Xn]),Dt=null!==Ze.sectionIdx&&Re.has(Ze.sectionIdx),Ot=_.useDeviationNavigation({proposedSections:Rn,existingSections:Sn,parentDeviationRecord:An,expandedSections:Qn,maintainRelativeOrder:!!$,scrollContainerRef:He,leftContainerRef:Ke,lhsBadgeRefs:wn,rhsBadgeRefs:Pn}),jt=Ot.showDeviationNavigation,wt=Ot.showOpenNodeRef;t.useEffect(function(){if(Q){var e=function(e){var n=An[e].find(function(e){return e.id===Q});if(n){var t=Rn.findIndex(function(n){return n.id===e});($?!!Qn["right-".concat(t)]:!!Qn[String(t)])||et(t,"left");var i="".concat(n.id).concat(c.DEVIATION_BADGE_SEPARATOR,"0"),o=setInterval(function(){var e,n,t=null===(e=wn.current[i])||void 0===e?void 0:e.current,l=null===(n=Pn.current[i])||void 0===n?void 0:n.current;if(t){t.scrollIntoView({behavior:"smooth",block:"center"});var r=window.getComputedStyle(t).color;t.style.transition="box-shadow 300ms ease-in-out",t.style.boxShadow="0 0 10px ".concat(r),l&&(l.style.transition="box-shadow 300ms ease-in-out",l.style.boxShadow="0 0 10px ".concat(r)),setTimeout(function(){t.style.boxShadow="",l&&(l.style.boxShadow="")},2e3),clearTimeout(o)}},600);return"break"}};for(var n in An){if("break"===e(n))break}}},[Q]);var Pt=function(e){var t=e.section,i=e.keyPath,o=e.depth,l=void 0===o?0:o,r=e.columnKey,c=void 0===r?"left":r,s=e.parentNodeId,u=void 0===s?"":s;return n.jsx(R.default,{section:t,keyPath:i,depth:l,columnKey:c,parentNodeId:u,expandedSubSections:Zn,setExpandedSubSections:$n,maintainRelativeOrder:$||!1,proposedSections:Rn,existingSections:Sn,treeData:V,deviationNumberRegistry:En,connectedSections:Re,activeSideBySideSection:xe,resolvedMarkdownStyles:Le,getSubSectionRef:Hn,getSubSectionCompareStyle:yt,getBadgeRef:Vn,openMoreFunctionsPopup:it,openSummaryPopup:Tt,resetSideBySide:Xn,setConnectedSections:Se,setConnectedLines:Ee,cachedConnectedPositions:De})};return n.jsxs(i.Box,e.__assign({ref:Ve,sx:e.__assign(e.__assign({display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif'},$?{}:{overflow:"visible"}),{position:"relative"})},{children:[te&&n.jsx(i.Box,e.__assign({sx:{position:"absolute",inset:0,bgcolor:"rgba(255, 255, 255, 0.6)",backdropFilter:"blur(10px)",zIndex:9999,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"8px"}},{children:n.jsx(v.default,{})})),on.open&&n.jsx(S.default,{open:on.open,anchorEl:on.anchorEl,containerEl:ct.current,onClose:Bt,summary:on.summary}),n.jsx(d.default,{open:Ze.open,anchorEl:Ze.anchorEl,sectionTitle:Ze.sectionTitle,referenceSectionTitle:Ze.refSectionTitle,onClose:an,onOpenCognitiveCompare:ot,onOpenSideBySide:Ct,onConnect:lt,isConnected:Dt,isOrphan:Ze.isOrphan}),Je.open&&n.jsx(a.default,{open:Je.open,popupRef:sn,position:en,popupConfig:U,onClose:function(){nn(null),Qe(function(n){return e.__assign(e.__assign({},n),{open:!1})}),cn(null)},markdownStyles:W,sectionTitle:Je.sectionTitle,referenceSectionTitle:Je.refSectionTitle,cognitiveData:Je.cognitiveData,anchorEl:Je.anchorEl,sectionAnchorEl:Je.sectionAnchorEl,scrollContainerEl:He.current,badgeStyle:Je.badgeStyle,docData:Je.docData,deviationData:Je.deviationData,isLoading:Je.isLoading}),n.jsx(i.Snackbar,e.__assign({open:!!se,autoHideDuration:8e3,onClose:function(){return ue(null)},anchorOrigin:{vertical:"top",horizontal:"center"}},{children:n.jsx(i.Alert,e.__assign({onClose:function(){return ue(null)},severity:"error",sx:{width:"100%",whiteSpace:"pre-line"}},{children:se}))})),n.jsx(m.default,{componentHeaderText:H,displayConfig:K,maintainRelativeOrder:$,onToggleView:function(e){ie(!0),setTimeout(function(){ee(!e),Xn(),Se(new Set),Ee([]),De.current=[],setTimeout(function(){ie(!1)},400)},50)}}),n.jsx(i.Box,e.__assign({ref:He,onScroll:Et,sx:{flex:1,minHeight:0,pt:1.5,pb:1,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",overflowY:$?"hidden":"auto",borderTop:qn&&zn?"none":"1.5px solid #EEF0F4"}},{children:n.jsx(i.Box,e.__assign({sx:e.__assign({display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"},$?{flex:1,minHeight:0}:{})},{children:n.jsxs(i.Box,e.__assign({ref:rt,sx:e.__assign({display:"grid",gridTemplateColumns:"minmax(0, 1fr) 180px minmax(0, 1fr)",gap:"40px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0},$?{flex:1,overflow:"visible"}:{})},{children:[n.jsxs("svg",e.__assign({ref:Ie,style:{position:"absolute",top:0,left:0,width:Ne.width||"100%",height:Ne.height||"100%",pointerEvents:"none",zIndex:10,overflow:"visible",transition:"opacity 0.15s ease-in-out"}},{children:[ht&&n.jsx("g",{children:n.jsx("line",{x1:ht.x1,y1:ht.y,x2:ht.x2,y2:ht.y,stroke:Un.badgeBorder,strokeWidth:"1.5"})}),gt.map(function(t){var r=t.x1+.5*(t.x2-t.x1),s=(t.y1+t.y2)/2;if("Not Defined"===t.style.label&&!t.hasCognitive)return null;if(t.isSubSection?de&&xe===t.subSectionKeyPath&&pe:de&&xe===t.sectionIdx&&pe)return n.jsxs("g",e.__assign({style:{transition:"opacity 0.2s"}},{children:[n.jsx("defs",{children:n.jsx("marker",e.__assign({id:"arr-".concat(t.id),markerWidth:"7",markerHeight:"5",refX:"7",refY:"2.5",orient:"auto"},{children:n.jsx("polygon",{points:"0 0, 7 2.5, 0 5",fill:t.style.badgeBorder||"#6366F1"})}))}),n.jsx("line",{ref:ut,x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:t.style.badgeBorder||"#6366F1",strokeWidth:"1.5",markerEnd:"url(#arr-".concat(t.id,")")})]}),t.id);if(!$){var a=t.isSubSection?c.getBentArrowPath(t.x1,t.y1,t.x2,t.y2):"M ".concat(t.x1," ").concat(t.y1," L ").concat(t.x2," ").concat(t.y2);return n.jsxs("g",{children:[n.jsx("path",{d:a,fill:"none",stroke:t.style.badgeBorder||"#E2E8F0",strokeWidth:"1.5"}),n.jsx("foreignObject",e.__assign({x:r-100,y:s-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(n){if(n.stopPropagation(),Je.open&&tn===t.id)un();else{var i=Rn[t.sectionIdx]||{title:"",content:""},o=Sn[t.sectionIdx]||{title:"",content:""};if(t.isSubSection&&t.subSectionKeyPath){for(var l=t.subSectionKeyPath.split(c.DEVIATION_BADGE_SEPARATOR)[2].split("-").map(Number),r=Rn[l[0]],s=Sn[l[0]],u=(null==r?void 0:r.title)||"",a=(null==s?void 0:s.title)||"",d=1;d<l.length;d++)(null==r?void 0:r.subsections)&&(r=r.subsections[l[d]]),(null==s?void 0:s.subsections)&&(s=s.subsections[l[d]]);r&&(i=e.__assign(e.__assign({},r),{title:u||r.title})),s&&(o=e.__assign(e.__assign({},s),{title:a||s.title}))}cn(t.id),tt(nt(n.currentTarget,i,o,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:"pointer"}},{children:[t.style.badgeText===u.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(l.ButtonCognitiveIcon,{})})),n.jsx(o.ChevronDown,{size:11,style:{transform:Je.open&&tn===t.id?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))}))]},t.id)}return null}),Ae.map(function(t){var i,o=t.pathD,l=(null===(i=t.style)||void 0===i?void 0:i.badgeBorder)||"#6366F1",r="conn-marker-".concat(t.id),c="".concat(t.id,"-bg"),s="".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:r,markerWidth:"8",markerHeight:"6",refX:"7",refY:"3",orient:"auto"},{children:n.jsx("polygon",{points:"0 0, 8 3, 0 6",fill:l})}))}))}),n.jsx("path",{ref:function(e){Be.current[c]=e},d:o,fill:"none",stroke:"#FFFFFF",strokeWidth:"4",strokeOpacity:"0.7"}),n.jsx("path",{ref:function(e){Be.current[s]=e},d:o,fill:"none",stroke:l,strokeWidth:"1.75",markerEnd:"url(#".concat(r,")")})]},t.id)})]})),n.jsxs(i.Box,e.__assign({sx:e.__assign({border:"1px solid #E7E7E9",borderRadius:"8px",bgcolor:"#FFFFFF",display:"flex",flexDirection:"column",position:"relative",zIndex:2,filter:"drop-shadow(0px 2px 4px #F2F2F2)"},$?{flex:1,overflow:"visible"}:{})},{children:[n.jsx(i.Box,e.__assign({ref:at,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E7E7E9",borderRadius:"8px 8px 0 0",display:"flex",alignItems:"center",minHeight:"40px",overflow:"hidden",minWidth:0}},{children:n.jsx(i.Tooltip,e.__assign({title:hn,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:hn}))}))})),n.jsxs(i.Box,e.__assign({ref:Ke,onScroll:Et,sx:e.__assign({p:"12px",display:"flex",flexDirection:"column"},$?{maxHeight:"calc(100vh - 150px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,mr:"-160px",pr:"172px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[n.jsx("div",{ref:We,style:{width:"100%",height:"0px",flexShrink:0}}),Tn&&Rn.map(function(t,l){var r,s,u=!t.title&&!t.content;if($&&u)return null;var a=t,d=mt(l),v=$?!(null===(r=a.refIndexes)||void 0===r?void 0:r.length)||a.selfIndex<0:!Sn[l],p=$?"number"==typeof a.selfIndex&&a.selfIndex>=0?a.selfIndex+1:null:l+1,f=Re.has(l),h=c.extractDeviationScore(a.evaluationResult,null==d?void 0:d.deviationLabel);return n.jsx(i.Box,e.__assign({ref:Ln(l),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:On.current[l],sx:e.__assign({width:"100%",display:"flex"},f&&{borderRadius:"6px",outline:"2px solid ".concat((null==d?void 0:d.badgeBorder)||"#6366F1"),outlineOffset:"1px"})},{children:n.jsx(y.default,{section:t,idx:l,columnKey:"left",colRef:Ln("left-accordion-".concat(l)),mb:0,treeData:V,proposedSections:Rn,existingSections:Sn,deviationNumberRegistry:En,getSectionCompareStyle:mt,getBadgeRef:Vn,connectedSections:Re,openMoreFunctionsPopup:it,openSummaryPopup:Tt,parentNodeId:(null===(s=null==V?void 0:V.input_index_map)||void 0===s?void 0:s[0])||"",isExpanded:$?!!Qn["left-".concat(l)]:!!Qn[String(l)],onToggle:function(){return et(l,"left")},navigation:t.id?jt[t.id]:null,showOpenNodeRef:wt,resolvedMarkdownStyles:Le,maintainRelativeOrder:$,renderSubSections:Pt})})),$&&d&&n.jsxs(i.Box,e.__assign({ref:wn.current[l],onClick:function(e){var n=$?Sn.find(function(e){var n;return null===(n=a.refIndexes)||void 0===n?void 0:n.includes(e.selfIndex)})||{title:"",content:""}:Sn[l]||{title:"",content:""};it(e,t,v,n,l,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!==p&&n.jsx(i.Box,e.__assign({component:"span",sx:{fontSize:"11px",fontWeight:700,pr:.5,borderRight:"1px solid ".concat(d.badgeBorder)}},{children:p})),n.jsx(i.Box,e.__assign({component:"span",sx:{fontSize:"11px",px:.25}},{children:!K.isLoading||null!=a.evaluationResult&&null!=a.evaluationResult?v?"No Deviation Found":"N/A"===h||"NA"===h?"N/A":0==h||null==h?"Same":"".concat(h):n.jsx(g.default,{color:d.badgeText})})),n.jsx(o.EllipsisVertical,{size:11,color:d.badgeText})]}))]}))}),"left-row-".concat(l))}),n.jsx("div",{ref:Ye,style:{width:"100%",height:"0px",flexShrink:0}})]}))]})),n.jsx(i.Box,e.__assign({ref:ct,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({sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:"5px",top:"-5px",borderRadius:"20px",bgcolor:Un.badgeBg,color:Un.badgeText,border:"1px solid ".concat(Un.badgeBorder),fontSize:"12px",fontWeight:600,whiteSpace:"nowrap",position:"relative",zIndex:1,pointerEvents:"auto",cursor:"pointer"}},{children:[null!=Kn?Kn:n.jsx(g.default,{}),n.jsx(i.Box,e.__assign({component:"span",onClick:function(n){n.stopPropagation(),Je.open&&tn===Wn?un():(cn(Wn),tt(nt(n.currentTarget,{title:"",content:"",evaluationResult:Yn,cognitiveData:{section_id:"",decisioning:[],gap:[],relevance_score:0,isMissingRationale:!0}},null,Wn,!0,e.__assign(e.__assign({},Un),{label:""}))))},sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:n.jsx(l.ButtonCognitiveIcon,{})})),n.jsx(o.ChevronDown,{size:11,style:{transform:Je.open&&tn===Wn?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))})),n.jsxs(i.Box,e.__assign({sx:e.__assign({border:"1px solid #E3E6EA",borderRadius:"8px",bgcolor:"#FFFFFF",boxShadow:"0px 1px 4px #F7F4FE",position:"relative",zIndex:2,display:"flex",flexDirection:"column",minWidth:0},$?{flex:1,overflow:"visible",minHeight:0}:{})},{children:[le&&n.jsx(r.default,{sections:11}),n.jsx(i.Box,e.__assign({ref:dt,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:xn,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:xn}))}))})),n.jsxs(i.Box,e.__assign({ref:Ge,onScroll:Et,sx:e.__assign({p:"12px",display:"flex",flexDirection:"column"},$?{maxHeight:"calc(100vh - 150px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,ml:"-120px",pl:"140px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[n.jsx("div",{ref:qe,style:{width:"100%",height:"0px",flexShrink:0}}),Tn&&Sn.map(function(t,o){var l,r=t,c=[],s=!1,u=null;if($){c=Rn.filter(function(e){var n;return(null===(n=e.refIndexes)||void 0===n?void 0:n.includes(r.selfIndex))&&e.selfIndex>=0}).map(function(e){return e.selfIndex+1});var a=Rn.findIndex(function(e,n){var t;return Re.has(n)&&(null===(t=e.refIndexes)||void 0===t?void 0:t.includes(r.selfIndex))});(s=-1!==a)&&(u=mt(a))}else c=[o+1],(s=Re.has(o))&&(u=mt(o));var d=mt(o);return n.jsx(i.Box,e.__assign({ref:kn.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:jn.current[o],sx:e.__assign({width:"100%",display:"flex"},s&&u&&{borderRadius:"6px",outline:"2px solid ".concat(u.badgeBorder),outlineOffset:"1px"})},{children:n.jsx(y.default,{section:t,idx:o,columnKey:"right",colRef:Ln("right-accordion-".concat(o)),mb:0,parentNodeId:(null===(l=null==V?void 0:V.input_index_map)||void 0===l?void 0:l[1])||"",isExpanded:$?!!Qn["right-".concat(o)]:!!Qn[String(o)],treeData:V,proposedSections:Rn,existingSections:Sn,deviationNumberRegistry:En,getBadgeRef:Vn,getSectionCompareStyle:mt,connectedSections:Re,openMoreFunctionsPopup:it,openSummaryPopup:Tt,onToggle:function(){return et(o,"right")},navigation:t.id?jt[t.id]:null,showOpenNodeRef:wt,resolvedMarkdownStyles:Le,maintainRelativeOrder:$,renderSubSections:Pt})})),$&&!le&&d&&n.jsx(i.Box,e.__assign({ref:Pn.current[o],"data-section-id":r.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:d.badgeBg,color:d.badgeText,border:"1px solid ".concat(d.badgeBorder),borderRadius:"10px",px:1,py:.3,fontWeight:700,whiteSpace:"nowrap",zIndex:20}},{children:c.length>0?c.join(", "):"-"}))]}))}),"right-row-".concat(o))}),n.jsx("div",{ref:ze,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"),l=require("../../assests/svg/ButtonCognitiveIcon.js"),r=require("./OverlayComponent.js"),c=require("./CognitiveComparehelpers.js"),s=require("./CognitiveCompareConfig.js"),u=require("./CognitiveCompareConstants.js"),a=require("./CognitivePopup.js"),d=require("./MoreFunctionsPopup.js"),v=require("./LoaderComponent.js"),g=require("./components/ThreeDotsLoader.js"),p=require("./hooks/useCompareData.js"),f=require("./hooks/useComparePopups.js"),h=require("./hooks/useSectionRefs.js"),x=require("./hooks/useAccordionState.js"),_=require("./hooks/useDeviationNavigation.js"),m=require("./components/CompareHeader.js"),y=require("./components/SectionAccordion.js"),R=require("./components/SubSectionAccordion.js"),S=require("./components/CognitiveSummaryPopup.js");exports.SHARED_MARKDOWN_STYLES=s.SHARED_MARKDOWN_STYLES,exports.default=function(b){var A,E,I,T,C,B,D,O,j,w,P,k,F,N,M,L=b.componentHeaderText,H=void 0===L?u.DEFAULT_COMPONENT_HEADER_TEXT:L,V=b.treeData,G=b.comparisonConfig,q=b.leftColumnTitleText,z=b.rightColumnTitleText,W=b.markdownStyles,Y=b.displayConfig,K=void 0===Y?{isHeaderVisible:!0,isToggleVisible:!0,maintainRelativeOrder:!1,isLoading:!0}:Y,U=b.popupConfig,X=b.deviationData,J=void 0===X?{}:X,Q=b.deviationNodeIdToView,Z=t.useState(K.maintainRelativeOrder),$=Z[0],ee=Z[1],ne=t.useState(!1),te=ne[0],ie=ne[1],oe=t.useState(!1),le=oe[0],re=oe[1],ce=t.useState(null),se=ce[0],ue=ce[1],ae=t.useState(!1),de=ae[0],ve=ae[1],ge=t.useState(!1),pe=ge[0],fe=ge[1],he=t.useState(null),xe=he[0],_e=he[1],me=t.useRef(!1),ye=t.useState(new Set),Re=ye[0],Se=ye[1],be=t.useState([]),Ae=be[0],Ee=be[1],Ie=t.useRef(null),Te=t.useRef(!1),Ce=t.useRef(null),Be=t.useRef({}),De=t.useRef([]),Oe=t.useRef(!1),je=t.useRef(!1),we=t.useRef(null),Pe=t.useRef(function(){}),ke=t.useMemo(function(){return(null==V?void 0:V.cognitive_decisioning)||{}},[V]),Fe=t.useState({width:0,height:0}),Ne=Fe[0],Me=Fe[1],Le=t.useMemo(function(){return e.__assign(e.__assign({},s.SHARED_MARKDOWN_STYLES),W)},[W]),He=t.useRef(null),Ve=t.useRef(null),Ge=t.useRef(null),qe=t.useRef(null),ze=t.useRef(null),We=t.useRef(null),Ye=t.useRef(null),Ke=t.useRef(null),Ue=t.useRef(!1),Xe=f.useComparePopups(He),Je=Xe.cognitivePopup,Qe=Xe.setCognitivePopup,Ze=Xe.moreFunctions,$e=Xe.setMoreFunctions,en=Xe.position,nn=Xe.setPosition,tn=Xe.activeBadgeId,on=Xe.summaryPopup,ln=Xe.setSummaryPopup,rn=Xe.closeSummaryPopup,cn=Xe.setActiveBadgeId,sn=Xe.popupRef,un=Xe.closeCognitivePopup,an=Xe.closeMoreFunctionsPopup,dn=t.useMemo(function(){var e,n,t,i,o,l,r;return{fields:null!==(e=null==G?void 0:G.fields)&&void 0!==e?e:s.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:s.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:s.DEFAULT_COMPARISON_CONFIG.thresholds.medium,exact:null!==(r=null===(l=null==G?void 0:G.thresholds)||void 0===l?void 0:l.exact)&&void 0!==r?r:s.DEFAULT_COMPARISON_CONFIG.thresholds.exact}}},[G]),vn=t.useState(null),gn=vn[0];vn[1];var pn=null===(I=null===(A=null==V?void 0:V.documents)||void 0===A?void 0:A[null===(E=null==V?void 0:V.input_index_map)||void 0===E?void 0:E[0]])||void 0===I?void 0:I.title,fn=null===(B=null===(T=null==V?void 0:V.documents)||void 0===T?void 0:T[null===(C=null==V?void 0:V.input_index_map)||void 0===C?void 0:C[1]])||void 0===B?void 0:B.title,hn=c.safeStringify(q||pn||"Uploaded Contract"),xn=c.safeStringify(z||fn||"Reference Template"),_n=p.useCognitiveTreeData(V,$,J,dn),mn=_n.activeProposed,yn=_n.existingRule,Rn=_n.proposedSections,Sn=_n.existingSections,bn=_n.visibleFields,An=_n.parentDeviationRecord,En=_n.deviationNumberRegistry,In=_n.parseError;t.useEffect(function(){In&&ue("Failed to load comparison: ".concat(In))},[In]);var Tn=Rn.length>0||Sn.length>0,Cn=h.useSectionRefs(bn.map(function(e){return e.key}),Math.max(Rn.length,Sn.length)),Bn=Cn.leftRefs,Dn=Cn.rightRefs,On=Cn.sectionLeftRefs,jn=Cn.sectionRightRefs,wn=Cn.lhsBadgeRefs,Pn=Cn.rhsBadgeRefs,kn=Cn.sectionRightRowRefs,Fn=Cn.subSectionLeftRefs,Nn=Cn.subSectionRightRefs,Mn=Cn.sectionRowRefs,Ln=Cn.getSectionRowRef,Hn=Cn.getSubSectionRef,Vn=Cn.getBadgeRef,Gn=yn.analysis,qn=c.safeStringify(null===(O=null===(D=null==Gn?void 0:Gn.rule_difference_comparison)||void 0===D?void 0:D.summary)||void 0===O?void 0:O.overall_summary),zn=!!qn.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),Wn=null!==(j=null==V?void 0:V.base_root_id)&&void 0!==j?j:"-1";null==V||V[Wn];var Yn=(null===(w=null==J?void 0:J[Wn])||void 0===w?void 0:w.evaluation_result)||(null===(k=null===(P=null==V?void 0:V.nodes)||void 0===P?void 0:P[Wn])||void 0===k?void 0:k.evaluation_result)||null,Kn=c.extractDeviationScore(Yn),Un=c.generateColorPalette(null!==(M=null===(N=null===(F=null==Yn?void 0:Yn.evaluation_outputs)||void 0===F?void 0:F.metadata)||void 0===N?void 0:N.label_color)&&void 0!==M?M:""),Xn=t.useCallback(function(){var e,n,t,i;ve(!1),je.current=!1;var o=we.current,l=st.current;if(null!==o)if("string"==typeof o&&o.includes(c.DEVIATION_BADGE_SEPARATOR)){var r=o.split(c.DEVIATION_BADGE_SEPARATOR);(s=null===(e=Fn.current[r[2]])||void 0===e?void 0:e.current)&&(s.style.paddingTop="0px")}else{var s;(s=null===(n=On.current[o])||void 0===n?void 0:n.current)&&(s.style.paddingTop="0px")}if(null!==l)if("string"==typeof l&&l.includes(c.DEVIATION_BADGE_SEPARATOR)){r=l.split(c.DEVIATION_BADGE_SEPARATOR);(u=null===(t=Nn.current[r[3]])||void 0===t?void 0:t.current)&&(u.style.paddingTop="0px")}else{var u;(u=null===(i=jn.current[l])||void 0===i?void 0:i.current)&&(u.style.paddingTop="0px")}_e(null),we.current=null,st.current=null,fe(!1),re(!1),qe.current&&(qe.current.style.height="0px"),ze.current&&(ze.current.style.height="0px"),We.current&&(We.current.style.height="0px"),Ye.current&&(Ye.current.style.height="0px")},[]),Jn=x.useAccordionState({maintainRelativeOrder:!!$,proposedSections:Rn,existingSections:Sn,activeSideBySideSection:xe,connectedSections:Re,resetSideBySide:Xn,setConnectedSections:Se,setConnectedLines:Ee,cachedConnectedPositions:De,svgContainerRef:Ie,isAnimatingRef:Te,animationTimerRef:Ce,calculateLinesRef:Pe,sectionLeftRefs:On,sectionRightRefs:jn,subSectionLeftRefs:Fn,subSectionRightRefs:Nn}),Qn=Jn.expandedSections,Zn=Jn.expandedSubSections,$n=Jn.setExpandedSubSections,et=Jn.toggleSection,nt=t.useCallback(function(e,n,t,i,o,l,r){var s,u,a,d=c.safeStringify(null==n?void 0:n.id)||c.safeStringify(null==t?void 0:t.id)||"",v=(d?ke[d]:null)||(null==n?void 0:n.cognitiveData)||(null==t?void 0:t.cognitiveData)||{section_id:d,decisioning:[],gap:[],relevance_score:0},g=null!==(u=null===(s=Mn.current[i])||void 0===s?void 0:s.current)&&void 0!==u?u:null;return{isLoading:null!==(a=null==K?void 0:K.isLoading)&&void 0!==a&&a,open:!0,sectionTitle:(null==n?void 0:n.displayTitle)?null==n?void 0:n.title:"no title",refSectionTitle:(null==t?void 0:t.displayTitle)?null==t?void 0:t.title:"no title",cognitiveData:v,anchorEl:e,sectionAnchorEl:g,badgeStyle:l||null,sectionIdx:i,docData:{documents:null==V?void 0:V.documents,input_index_map:null==V?void 0:V.input_index_map},deviationData:(null==n?void 0:n.evaluationResult)||(null==t?void 0:t.evaluationResult)||null,isOrphan:!!o}},[ke,V]),tt=t.useCallback(function(e){an(),nn(null),Qe(e)},[an]),it=function(e,n,t,i,o,l){e.stopPropagation(),Ze.open&&Ze.sectionIdx===o?an():(un(),$e(nt(e.currentTarget,n,i,o,t,l)))},ot=t.useCallback(function(){null!==Ze.sectionIdx&&Ze.anchorEl?tt(e.__assign(e.__assign({},Ze),{open:!0})):an()},[Ze,an,tt]),lt=t.useCallback(function(){var e=Ze.sectionIdx,n=Ze.isOrphan,t=null!==e&&Re.has(e);an(),null!==e&&(n?ue("No counterpart exists to connect to."):(je.current&&Xn(),t&&(Ee([]),De.current=[]),Se(function(n){return n.has(e)?new Set:new Set([e])})))},[Ze.sectionIdx,an,Xn]),rt=t.useRef(null),ct=t.useRef(null),st=t.useRef(null),ut=t.useRef(null),at=t.useRef(null),dt=t.useRef(null),vt=t.useState([]),gt=vt[0],pt=vt[1];t.useRef(null);var ft=t.useState(null),ht=ft[0],xt=ft[1];t.useEffect(function(){if(gn){var e=dn.fields.find(function(e){return e.analysisKey===gn||e.key===gn});if(e){var n=Bn.current[e.key]||Dn.current[e.key];(null==n?void 0:n.current)&&setTimeout(function(){return n.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[gn,dn.fields]);var _t=t.useCallback(function(e){var n,t,i,o,l,r,c,s,u,a=null===(n=null==Gn?void 0:Gn.rule_difference_comparison)||void 0===n?void 0:n.fields;if(!a||!a[e])return{score:0,relation:"",highlightsA:[],highlightsB:[],hasContent:!1};var d=a[e],v=(null==d?void 0:d.relation)||(null===(i=null===(t=null==d?void 0:d.highlights)||void 0===t?void 0:t.ruleA_spans)||void 0===i?void 0:i.length)||(null===(l=null===(o=null==d?void 0:d.highlights)||void 0===o?void 0:o.ruleB_spans)||void 0===l?void 0:l.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===(r=g.highlights)||void 0===r?void 0:r.ruleA_spans)||[],highlightsB:(null===(c=g.highlights)||void 0===c?void 0:c.ruleB_spans)||[],hasContent:!!v}}return{score:d.score,relation:d.relation||"",highlightsA:(null===(s=d.highlights)||void 0===s?void 0:s.ruleA_spans)||[],highlightsB:(null===(u=d.highlights)||void 0===u?void 0:u.ruleB_spans)||[],hasContent:!!v}},[Gn]),mt=t.useCallback(function(n){var t,i,o,l,r,s,a,d=Rn[n],v=Sn[n],g=(null==d?void 0:d.relation)&&"not_defined"!==d.relation,p=(null==v?void 0:v.relation)&&"not_defined"!==v.relation;c.safeStringify(null==d?void 0:d.id)||c.safeStringify(null==v?void 0:v.id);var f=!(!(null==d?void 0:d.cognitiveData)&&!(null==v?void 0:v.cognitiveData));if(!g&&!p&&!f)return e.__assign(e.__assign({},c.generateColorPalette(u.DEFAULT_DEVIAION_COLOR)),{label:"Not Defined"});var h=null!==(i=null!==(t=null==d?void 0:d.evaluationResult)&&void 0!==t?t:null==v?void 0:v.evaluationResult)&&void 0!==i?i:null,x=null===(o=null==h?void 0:h.evaluation_outputs)||void 0===o?void 0:o.output_value,_=null!==(s=null===(r=null===(l=null==h?void 0:h.evaluation_outputs)||void 0===l?void 0:l.metadata)||void 0===r?void 0:r.label_color)&&void 0!==s?s:u.DEFAULT_DEVIAION_COLOR;return null!=h?e.__assign(e.__assign({},c.generateColorPalette(_)),{label:null!==(a=x)&&void 0!==a?a:""}):e.__assign(e.__assign({},c.generateColorPalette(_)),{label:null})},[Rn,Sn,ke,dn,_t]),yt=t.useCallback(function(n){for(var t,i,o,l,r,s,a,d,v,g=n.split("-").map(Number),p=Rn[g[0]],f=Sn[g[0]],h=1;h<g.length;h++)(null==p?void 0:p.subsections)&&(p=p.subsections[g[h]]),(null==f?void 0:f.subsections)&&(f=f.subsections[g[h]]);if(!p&&!f)return null;var x=(null==p?void 0:p.relation)&&"not_defined"!==p.relation,_=(null==f?void 0:f.relation)&&"not_defined"!==f.relation,m=c.safeStringify(null==p?void 0:p.id)||c.safeStringify(null==f?void 0:f.id)||"",y=!(!(null==p?void 0:p.cognitiveData)&&!(null==f?void 0:f.cognitiveData));if(!x&&!_&&!y)return e.__assign(e.__assign({},c.generateColorPalette(u.DEFAULT_DEVIAION_COLOR)),{label:"Not Defined"});null!==(i=null!==(t=null==p?void 0:p.cognitiveRelevanceScore)&&void 0!==t?t:null==f?void 0:f.cognitiveRelevanceScore)&&void 0!==i||m&&(null===(o=ke[m])||void 0===o||o.relevance_score);var R=null!==(r=null!==(l=null==p?void 0:p.evaluationResult)&&void 0!==l?l:null==f?void 0:f.evaluationResult)&&void 0!==r?r:null,S=null===(s=null==R?void 0:R.evaluation_outputs)||void 0===s?void 0:s.output_value,b=null!==(v=null===(d=null===(a=null==R?void 0:R.evaluation_outputs)||void 0===a?void 0:a.metadata)||void 0===d?void 0:d.label_color)&&void 0!==v?v:u.DEFAULT_DEVIAION_COLOR;return null!=R?e.__assign(e.__assign({},c.generateColorPalette(b)),{label:null!=S?S:""}):e.__assign(e.__assign({},c.generateColorPalette(b)),{label:null})},[Rn,Sn,ke,dn]),Rt=t.useCallback(function(){var e,n,t,i,o,l,r,s,u,a,d,v,g,p,f,h,x,_,m,y,R,S;if(!Ue.current&&!Te.current){Ue.current=!0;try{if(!rt.current)return;var b=function(e){var n=e.split("-"),t=n[0];if(!Qn[t]&&!1===$)return!1;if($&&!Qn["left-".concat(t)]&&!Qn["right-".concat(t)]&&!Qn[t])return!1;for(var i=t,o=1;o<n.length-1;o++)if(i+="-".concat(n[o]),!Zn[i])return!1;return!0},A=rt.current.getBoundingClientRect();Me({width:A.width,height:A.height});var E=[];if(bn.forEach(function(e){var n,t,i=e.key,o=null===(n=Bn.current[i])||void 0===n?void 0:n.current,l=null===(t=Dn.current[i])||void 0===t?void 0:t.current;o&&l&&(o.style.height="auto",l.style.height="auto",o.style.minHeight="0px",l.style.minHeight="0px")}),!Te.current){for(var I=0;I<Math.max(Rn.length,Sn.length);I++){var T=null===(e=On.current[I])||void 0===e?void 0:e.current,C=null===(n=jn.current[I])||void 0===n?void 0:n.current;T&&(T.style.height="auto",T.style.minHeight="0px"),C&&(C.style.height="auto",C.style.minHeight="0px")}$||Object.keys(Fn.current).forEach(function(e){var n,t;if(b(e)){var i=null===(n=Fn.current[e])||void 0===n?void 0:n.current,o=null===(t=Nn.current[e])||void 0===t?void 0:t.current;i&&o&&(i.style.height="auto",o.style.height="auto",i.style.minHeight="0px",o.style.minHeight="0px")}})}var B={};bn.forEach(function(e){var n,t,i=e.key,o=null===(n=Bn.current[i])||void 0===n?void 0:n.current,l=null===(t=Dn.current[i])||void 0===t?void 0:t.current;if(o&&l){var r=o.getBoundingClientRect(),c=l.getBoundingClientRect();B[i]=Math.max(r.height,c.height)}});var D={left:{},right:{}},O={};if(!Te.current)if($){if(de&&null!==xe)if("number"==typeof xe){var j=xe,w=Rn[j],P=null===(o=On.current[j])||void 0===o?void 0:o.current;P&&w&&(w.refIndexes||[]).forEach(function(e){var n,t=Sn.findIndex(function(n){return n.selfIndex===e}),i=null===(n=jn.current[t])||void 0===n?void 0:n.current;if(i&&(Qn["left-".concat(j)]||Qn["right-".concat(t)])){var o=Math.max(P.getBoundingClientRect().height,i.getBoundingClientRect().height);D.left[j]=Math.max(D.left[j]||0,o),D.right[t]=Math.max(D.right[t]||0,o)}})}else{var k=xe.split(c.DEVIATION_BADGE_SEPARATOR)[2];if(k){T=null===(l=Fn.current[k])||void 0===l?void 0:l.current,C=null===(r=Nn.current[k])||void 0===r?void 0:r.current;if(T&&C){F=Math.max(T.getBoundingClientRect().height,C.getBoundingClientRect().height);O[k]=Math.max(O[k]||0,F)}}}}else{Object.keys(Fn.current).forEach(function(e){var n,t;if(b(e)){var i=null===(n=Fn.current[e])||void 0===n?void 0:n.current,o=null===(t=Nn.current[e])||void 0===t?void 0:t.current;if(i&&o&&null!==i.offsetParent&&null!==o.offsetParent){var l=i.getBoundingClientRect(),r=o.getBoundingClientRect(),c=Math.max(l.height,r.height);O[e]=c,i.style.minHeight="".concat(c,"px"),o.style.minHeight="".concat(c,"px")}}});for(I=0;I<Math.min(Rn.length,Sn.length);I++){var T=null===(t=On.current[I])||void 0===t?void 0:t.current,C=null===(i=jn.current[I])||void 0===i?void 0:i.current;if(T&&C){var F=Math.max(T.getBoundingClientRect().height,C.getBoundingClientRect().height);D.left[I]=F,D.right[I]=F}}}if(bn.forEach(function(e){var n,t,i=e.key,o=null===(n=Bn.current[i])||void 0===n?void 0:n.current,l=null===(t=Dn.current[i])||void 0===t?void 0:t.current;if(o&&l){var r=B[i];o.style.minHeight="".concat(r,"px"),l.style.minHeight="".concat(r,"px")}}),Te.current||(Object.entries(D.left).forEach(function(e){var n,t=e[0],i=e[1],o=null===(n=On.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=jn.current[Number(t)])||void 0===n?void 0:n.current;o&&(o.style.minHeight="".concat(i,"px"))}),$||Object.keys(O).forEach(function(e){var n,t,i=null===(n=Fn.current[e])||void 0===n?void 0:n.current,o=null===(t=Nn.current[e])||void 0===t?void 0:t.current;if(i&&o&&O[e]){var l=O[e];i.style.minHeight="".concat(l,"px"),o.style.minHeight="".concat(l,"px")}})),$)Rn.forEach(function(e,n){var t;(null===(t=On.current[n])||void 0===t?void 0:t.current)&&(e.refIndexes||[]).forEach(function(e){var t,i,o,l,r,c,s,u,a,d,v=Sn.findIndex(function(n){return n.selfIndex===e});if(-1!==v){var g=null===(t=wn.current[n])||void 0===t?void 0:t.current,p=null===(i=Pn.current[v])||void 0===i?void 0:i.current;if(g&&p){var f=g.getBoundingClientRect(),h=p.getBoundingClientRect(),x=f.right-A.left,_=h.left-A.left,m=f.top+f.height/2-A.top,y=h.top+h.height/2-A.top;if(de&&xe===n){var R=null!==(l=null===(o=Ke.current)||void 0===o?void 0:o.getBoundingClientRect().top)&&void 0!==l?l:0,S=null!==(c=null===(r=Ge.current)||void 0===r?void 0:r.getBoundingClientRect().top)&&void 0!==c?c:0,b=R+(null!==(u=null===(s=Ke.current)||void 0===s?void 0:s.clientHeight)&&void 0!==u?u:1/0),I=S+(null!==(d=null===(a=Ge.current)||void 0===a?void 0:a.clientHeight)&&void 0!==d?d:1/0),T=f.top+f.height/2,C=function(e,n,t){return Math.max(n,Math.min(t,e))};m=C(T,R,b)-A.top,y=C(T,S,I)-A.top}var B=mt(n);B&&E.push({id:"line-".concat(n,"-").concat(v),x1:x,y1:m,x2:_,y2:y,style:B,sectionIdx:n,targetRightIdx:v})}}})});else{for(I=0;I<Math.min(Rn.length,Sn.length);I++){var N=null===(s=On.current[I])||void 0===s?void 0:s.current,M=null===(u=jn.current[I])||void 0===u?void 0:u.current;if(N&&M){var L=N.getBoundingClientRect(),H=M.getBoundingClientRect(),V=Math.max(L.top,H.top)+18-A.top,G=(null===(a=Sn[I])||void 0===a?void 0:a.id)||"sec-".concat(I);(J=mt(I))&&E.push({id:G,x1:L.right-A.left,y1:V,x2:H.left-A.left,y2:V,style:J,sectionIdx:I,hasCognitive:!!((null===(d=Rn[I])||void 0===d?void 0:d.cognitiveData)||(null===(v=Sn[I])||void 0===v?void 0:v.cognitiveData)||G&&ke[G]),isSubSection:!1})}}Object.keys(Fn.current).forEach(function(e){var n,t,i,o,l,r;if(b(e)){var s=null===(n=Fn.current[e])||void 0===n?void 0:n.current,u=null===(t=Nn.current[e])||void 0===t?void 0:t.current;if(s&&u){for(var a=e.split("-").map(Number),d=Rn[a[0]],v=Sn[a[0]],g=1;g<a.length;g++)(null==d?void 0:d.subsections)&&(d=d.subsections[a[g]]),(null==v?void 0:v.subsections)&&(v=v.subsections[a[g]]);var p=!!d&&((null===(i=d.displayTitle)||void 0===i||i)&&c.hasValue(d.title)),f=!!d&&((null===(o=d.displayContent)||void 0===o||o)&&c.hasValue(d.content)),h=!!v&&((null===(l=v.displayTitle)||void 0===l||l)&&c.hasValue(v.title)),x=!!v&&((null===(r=v.displayContent)||void 0===r||r)&&c.hasValue(v.content));if(p&&f||h&&x){var _=s.getBoundingClientRect(),m=u.getBoundingClientRect(),y=Math.max(_.top,m.top)+16-A.top,R=yt(e);R&&"Not Defined"!==R.label&&E.push({id:"subsec-".concat(e),x1:_.right-A.left,y1:y,x2:m.left-A.left,y2:y,style:R,sectionIdx:a[0],isSubSection:!0,subSectionKeyPath:e,hasCognitive:!(!(null==d?void 0:d.cognitiveData)&&!(null==v?void 0:v.cognitiveData))})}}}})}if(de&&"string"==typeof xe&&xe.includes(c.DEVIATION_BADGE_SEPARATOR)){var q=xe.split(c.DEVIATION_BADGE_SEPARATOR),z=q[0],W=q[1],Y=q[2],K=(q[3],"".concat(z).concat(c.DEVIATION_BADGE_SEPARATOR).concat(W)),U=null===(g=wn.current[K])||void 0===g?void 0:g.current,X=null===(p=Pn.current[K])||void 0===p?void 0:p.current;if(U&&X){var J,Q=U.getBoundingClientRect(),Z=X.getBoundingClientRect(),ee=Q.right-A.left,ne=Z.left-A.left,te=Q.top+Q.height/2-A.top,ie=Z.top+Z.height/2-A.top;if($){var oe=null!==(h=null===(f=Ke.current)||void 0===f?void 0:f.getBoundingClientRect().top)&&void 0!==h?h:0,le=null!==(_=null===(x=Ge.current)||void 0===x?void 0:x.getBoundingClientRect().top)&&void 0!==_?_:0,re=oe+(null!==(y=null===(m=Ke.current)||void 0===m?void 0:m.clientHeight)&&void 0!==y?y:1/0),ce=le+(null!==(S=null===(R=Ge.current)||void 0===R?void 0:R.clientHeight)&&void 0!==S?S:1/0),se=function(e,n,t){return Math.max(n,Math.min(t,e))};te=se(Q.top+Q.height/2,oe,re)-A.top,ie=se(Z.top+Z.height/2,le,ce)-A.top}(J=yt(Y))&&E.push({id:"line-subsec-".concat(K),x1:ee,y1:te,x2:ne,y2:ie,style:J,sectionIdx:Number(Y.split("-")[0]),isSubSection:!0,subSectionKeyPath:xe})}}if(pt(E),at.current&&dt.current){var ue=at.current.getBoundingClientRect(),ae=dt.current.getBoundingClientRect(),ve=(ue.top+ue.height/2-A.top+ae.top+ae.height/2-A.top)/2;xt({x1:ue.right-A.left,x2:ae.left-A.left,y:ve})}else xt(null);if(Re.size>0){var ge=[],pe=Ke.current,fe=Ge.current;if(pe&&fe){var he=[],_e=pe.getBoundingClientRect().top,me=fe.getBoundingClientRect().top,ye=_e+pe.clientHeight,Se=me+fe.clientHeight,be=pe.scrollTop,Ae=fe.scrollTop,Ie=A.top,Ce=function(e,n,t){return Math.max(n,Math.min(t,e))};Re.forEach(function(e){var n,t,i,o,l;if("string"==typeof e&&e.includes(c.DEVIATION_BADGE_SEPARATOR)){var r=e.split(c.DEVIATION_BADGE_SEPARATOR),s=r[0],u=r[1],a=r[2],d=(r[3],"".concat(s).concat(c.DEVIATION_BADGE_SEPARATOR).concat(u)),v=null===(n=wn.current[d])||void 0===n?void 0:n.current,g=null===(t=Pn.current[d])||void 0===t?void 0:t.current;if(!v||!g)return;var p=v.getBoundingClientRect(),f=g.getBoundingClientRect(),h=yt(a),x=(P=p.right-A.left)+.5*((k=f.left-A.left-0)-P),_=p.top+p.height/2,m=f.top+f.height/2,y=_-_e+be,R=m-me+Ae,S="conn-subsec-".concat(d);he.push({lhsScrollY:y,rhsScrollY:R,x1:P,x2:k,containerTop:Ie,leftIdx:e,rhsArrayIdx:e,styleColor:(null==h?void 0:h.badgeBorder)||"#6366F1",styleId:S});var b=Ce(_,_e,ye),E=Ce(m,me,Se),I=b-Ie,T=E-Ie,C=m>=me-4&&m<=Se+4,B="";B=(F=_>=_e-4&&_<=ye+4)&&C?c.getBentArrowPath(P,I,k,T):F&&!C?"M ".concat(P,",").concat(I," L ").concat(x,",").concat(I," L ").concat(x,",").concat(T):!F&&C?"M ".concat(x,",").concat(I," L ").concat(x,",").concat(T," L ").concat(k,",").concat(T):"M ".concat(x,",").concat(I," L ").concat(x,",").concat(T),ge.push({id:S,pathD:B,style:h,leftIdx:e,rhsArrayIdx:e})}else if($){var D=e,O=Rn[D];if(!(null===(l=null==O?void 0:O.refIndexes)||void 0===l?void 0:l.length))return;O.refIndexes.forEach(function(e){var n,t,i=Sn.findIndex(function(n){return n.selfIndex===e});if(-1!==i){var o=null===(n=wn.current[D])||void 0===n?void 0:n.current,l=null===(t=Pn.current[i])||void 0===t?void 0:t.current;if(o&&l){var r=o.getBoundingClientRect(),s=l.getBoundingClientRect(),u=mt(D),a=r.right-A.left,d=s.left-A.left-0,v=a+.5*(d-a),g=r.top+r.height/2,p=s.top+s.height/2,f=g-_e+be,h=p-me+Ae,x="conn-".concat(D,"-").concat(i);he.push({lhsScrollY:f,rhsScrollY:h,x1:a,x2:d,containerTop:Ie,leftIdx:D,rhsArrayIdx:i,styleColor:(null==u?void 0:u.badgeBorder)||"#6366F1",styleId:x});var _=Ce(g,_e,ye),m=Ce(p,me,Se),y=_-Ie,R=m-Ie,S=g>=_e-4&&g<=ye+4,b=p>=me-4&&p<=Se+4,E="";E=S&&b?c.getBentArrowPath(a,y,d,R):S&&!b?"M ".concat(a,",").concat(y," L ").concat(v,",").concat(y," L ").concat(v,",").concat(R):!S&&b?"M ".concat(v,",").concat(y," L ").concat(v,",").concat(R," L ").concat(d,",").concat(R):"M ".concat(v,",").concat(y," L ").concat(v,",").concat(R),ge.push({id:x,pathD:E,style:u,leftIdx:D,rhsArrayIdx:i})}}})}else{var j=e,w=j;v=null===(i=wn.current[j])||void 0===i?void 0:i.current,g=null===(o=Pn.current[w])||void 0===o?void 0:o.current;if(!v||!g)return;var P,k;p=v.getBoundingClientRect(),f=g.getBoundingClientRect(),h=mt(j),x=(P=p.right-A.left)+.5*((k=f.left-A.left-0)-P),_=p.top+p.height/2,m=f.top+f.height/2,y=_-_e+be,R=m-me+Ae,S="conn-".concat(j,"-").concat(w);he.push({lhsScrollY:y,rhsScrollY:R,x1:P,x2:k,containerTop:Ie,leftIdx:j,rhsArrayIdx:w,styleColor:(null==h?void 0:h.badgeBorder)||"#6366F1",styleId:S});var F;b=Ce(_,_e,ye),E=Ce(m,me,Se),I=b-Ie,T=E-Ie,C=m>=me-4&&m<=Se+4,B="";B=(F=_>=_e-4&&_<=ye+4)&&C?c.getBentArrowPath(P,I,k,T):F&&!C?"M ".concat(P,",").concat(I," L ").concat(x,",").concat(I," L ").concat(x,",").concat(T):!F&&C?"M ".concat(x,",").concat(I," L ").concat(x,",").concat(T," L ").concat(k,",").concat(T):"M ".concat(x,",").concat(I," L ").concat(x,",").concat(T),ge.push({id:S,pathD:B,style:h,leftIdx:j,rhsArrayIdx:w})}}),De.current=he}Ee(ge)}else Ee([]),De.current=[]}catch(e){console.error("Line render safe fail: ",e)}finally{Ue.current=!1}}},[bn,Rn,Sn,ke,dn,_t,mt,$,de,xe,Re,Qn,Zn]),St=t.useCallback(function(){var e,n,t,i,o,l,r,s,u,a,d,v,g,p,f=De.current;if(f.length&&!Te.current){var h=null!==(n=null===(e=Ke.current)||void 0===e?void 0:e.scrollTop)&&void 0!==n?n:0,x=null!==(i=null===(t=Ge.current)||void 0===t?void 0:t.scrollTop)&&void 0!==i?i:0,_=null!==(l=null===(o=Ke.current)||void 0===o?void 0:o.clientHeight)&&void 0!==l?l:1/0,m=null!==(s=null===(r=Ge.current)||void 0===r?void 0:r.clientHeight)&&void 0!==s?s:1/0,y=null!==(a=null===(u=Ke.current)||void 0===u?void 0:u.getBoundingClientRect().top)&&void 0!==a?a:0,R=null!==(v=null===(d=Ge.current)||void 0===d?void 0:d.getBoundingClientRect().top)&&void 0!==v?v:0,S=y+_,b=R+m,A=null!==(p=null===(g=rt.current)||void 0===g?void 0:g.getBoundingClientRect().top)&&void 0!==p?p:0,E=function(e,n,t){return Math.max(n,Math.min(t,e))};f.forEach(function(e){var n=e.lhsScrollY-h+y,t=e.rhsScrollY-x+R,i=Be.current[e.styleId+"-stroke"],o=Be.current[e.styleId+"-bg"];if(i||o){var l,r=E(n,y,S),s=E(t,R,b),u=r-A,a=s-A,d=n>=y-4&&n<=S+4,v=t>=R-4&&t<=b+4,g=e.x1+.5*(e.x2-e.x1);l=d&&v?c.getBentArrowPath(e.x1,u,e.x2,a):d&&!v?"M ".concat(e.x1,",").concat(u," L ").concat(g,",").concat(u," L ").concat(g,",").concat(a):!d&&v?"M ".concat(g,",").concat(u," L ").concat(g,",").concat(a," L ").concat(e.x2,",").concat(a):"M ".concat(g,",").concat(u," L ").concat(g,",").concat(a),i&&(i.setAttribute("visibility","visible"),i.setAttribute("d",l)),o&&(o.setAttribute("visibility","visible"),o.setAttribute("d",l))}})}},[]);t.useEffect(function(){Pe.current=Rt},[Rt]);var bt=t.useRef(null),At=t.useCallback(function(){De.current.length>0&&!Te.current||(null!==bt.current&&clearTimeout(bt.current),bt.current=setTimeout(function(){Pe.current(),bt.current=null},50))},[]),Et=t.useCallback(function(e){var n,t,i,o,l,r,s,u,a,d;if(!me.current){if($||At(),je.current){var v=we.current,g=st.current,p=Ke.current,f=Ge.current;if(null!==v&&null!==g&&p&&f){var h="string"==typeof v&&v.includes(c.DEVIATION_BADGE_SEPARATOR)?null===(n=wn.current["".concat(v.split(c.DEVIATION_BADGE_SEPARATOR)[0]).concat(c.DEVIATION_BADGE_SEPARATOR).concat(v.split(c.DEVIATION_BADGE_SEPARATOR)[1])])||void 0===n?void 0:n.current:null===(t=Mn.current[v])||void 0===t?void 0:t.current,x="string"==typeof g&&g.includes(c.DEVIATION_BADGE_SEPARATOR)?null===(i=Pn.current["".concat(g.split(c.DEVIATION_BADGE_SEPARATOR)[0]).concat(c.DEVIATION_BADGE_SEPARATOR).concat(g.split(c.DEVIATION_BADGE_SEPARATOR)[1])])||void 0===i?void 0:i.current:null===(o=kn.current[g])||void 0===o?void 0:o.current;if(h&&x){var _=h.getBoundingClientRect().top-p.getBoundingClientRect().top+p.scrollTop,m=x.getBoundingClientRect().top-f.getBoundingClientRect().top+f.scrollTop;if(e.currentTarget===p){var y=m-(_-p.scrollTop),R=f.scrollHeight-f.clientHeight,S=Math.max(0,Math.min(y,R));Math.abs(f.scrollTop-S)>1&&(f.scrollTop=S)}else if(e.currentTarget===f){var b=_-(m-f.scrollTop),A=p.scrollHeight-p.clientHeight,E=Math.max(0,Math.min(b,A));Math.abs(p.scrollTop-E)>1&&(p.scrollTop=E)}if(ut.current){var I=void 0,T=void 0;if("string"==typeof v&&v.includes(c.DEVIATION_BADGE_SEPARATOR)){var C=v.split(c.DEVIATION_BADGE_SEPARATOR),B="".concat(C[0]).concat(c.DEVIATION_BADGE_SEPARATOR).concat(C[1]);I=null===(l=wn.current[B])||void 0===l?void 0:l.current,T=null===(r=Pn.current[B])||void 0===r?void 0:r.current}else I=null===(s=wn.current[v])||void 0===s?void 0:s.current,T=null===(u=Pn.current[g])||void 0===u?void 0:u.current;var D=null!==(d=null===(a=rt.current)||void 0===a?void 0:a.getBoundingClientRect().top)&&void 0!==d?d:0,O=p.getBoundingClientRect().top,j=O+p.clientHeight,w=f.getBoundingClientRect().top,P=w+f.clientHeight,k=function(e,n,t){return Math.max(n,Math.min(t,e))};if(I&&T){var F=I.getBoundingClientRect(),N=T.getBoundingClientRect(),M=F.top+F.height/2,L=N.top+N.height/2,H=k(M,O,j),V=k(L,w,P);ut.current.setAttribute("y1",(H-D).toString()),ut.current.setAttribute("y2",(V-D).toString());var G=M>=O-4&&M<=j+4;ut.current.setAttribute("visibility",G?"visible":"hidden")}}}}}De.current.length>0&&!Oe.current&&(Oe.current=!0,requestAnimationFrame(function(){St(),Oe.current=!1}))}},[St,$,At]);t.useEffect(function(){var e=setTimeout(At,250);window.addEventListener("resize",At);var n=null,t=null;return He.current&&(n=new ResizeObserver(At)).observe(He.current),rt.current&&(t=new ResizeObserver(At)).observe(rt.current),function(){clearTimeout(e),window.removeEventListener("resize",At),null==n||n.disconnect(),null==t||t.disconnect()}},[mn,yn,Gn,bn,Qn,Zn,Rn,Sn,dn,At,de,xe,pe,Re]),t.useEffect(function(){je.current=de},[de]),t.useEffect(function(){we.current=xe},[xe]);var It=t.useCallback(function(e,n,t){var i,o,l,r,s,u=null===(i=null==t?void 0:t.toggleIfSame)||void 0===i||i,a=null==t?void 0:t.onReady;if(an(),null!=e)if(n)ue("No counterpart exists for this section.");else if(de&&xe===e)u?Xn():null==a||a();else{if(!$){var d=we.current,v=st.current;if(null!==d)if("string"==typeof d&&d.includes(c.DEVIATION_BADGE_SEPARATOR)){var g=d.split(c.DEVIATION_BADGE_SEPARATOR);(p=null===(o=Fn.current[g[2]])||void 0===o?void 0:o.current)&&(p.style.paddingTop="0px")}else{var p;(p=null===(l=On.current[d])||void 0===l?void 0:l.current)&&(p.style.paddingTop="0px")}if(null!==v)if("string"==typeof v&&v.includes(c.DEVIATION_BADGE_SEPARATOR)){g=v.split(c.DEVIATION_BADGE_SEPARATOR);(f=null===(r=Nn.current[g[3]])||void 0===r?void 0:r.current)&&(f.style.paddingTop="0px")}else{var f;(f=null===(s=jn.current[v])||void 0===s?void 0:s.current)&&(f.style.paddingTop="0px")}}Se(new Set),Ee([]),De.current=[],re(!0),me.current=!0,_e(e),we.current=e,ve(!0),je.current=!0,fe(!1),qe.current&&(qe.current.style.height="0px"),ze.current&&(ze.current.style.height="0px"),We.current&&(We.current.style.height="0px"),Ye.current&&(Ye.current.style.height="0px"),requestAnimationFrame(function(){var n,t,i,o,l,r,s,u,d,v,g=null,p=null,f=null,h=null,x=null;if("string"==typeof e&&e.includes(c.DEVIATION_BADGE_SEPARATOR)){var _=e.split(c.DEVIATION_BADGE_SEPARATOR),m="".concat(_[0]).concat(c.DEVIATION_BADGE_SEPARATOR).concat(_[1]);g=(null===(n=wn.current[m])||void 0===n?void 0:n.current)||null,x=(p=(null===(t=Pn.current[m])||void 0===t?void 0:t.current)||null)?e:null,f=(null===(i=Fn.current[_[2]])||void 0===i?void 0:i.current)||null,h=(null===(o=Nn.current[_[3]])||void 0===o?void 0:o.current)||null}else if(g=(null===(l=Mn.current[e])||void 0===l?void 0:l.current)||null,f=(null===(r=On.current[e])||void 0===r?void 0:r.current)||null,$){var y=Rn[e],R=(null==y?void 0:y.refIndexes)||[];if(R.length>0){var S=R[0],b=Sn.findIndex(function(e){return e.selfIndex===S});-1!==b&&(p=(null===(d=kn.current[b])||void 0===d?void 0:d.current)||null,h=(null===(v=jn.current[b])||void 0===v?void 0:v.current)||null,x=b)}}else p=(null===(s=kn.current[e])||void 0===s?void 0:s.current)||null,h=(null===(u=jn.current[e])||void 0===u?void 0:u.current)||null,x=p?e:null;st.current=x;var A=Ke.current,E=Ge.current;if(!g||!A)return me.current=!1,re(!1),void(null==a||a());if(!p||!E)return fe(!0),Pe.current(),me.current=!1,re(!1),void(null==a||a());if(!$){var I=g.getBoundingClientRect(),T=p.getBoundingClientRect(),C=I.top-T.top;f&&h&&(f.style.paddingTop="0px",h.style.paddingTop="0px",C>0?h.style.paddingTop="".concat(C,"px"):C<0&&(f.style.paddingTop="".concat(Math.abs(C),"px")));var B=g?g.getBoundingClientRect().top:(null==f?void 0:f.getBoundingClientRect().top)||0,D=He.current,O=D?D.scrollTop+B-150:0;return D?void c.smoothScrollTo(D,O,200,function(){fe(!0),Pe.current(),me.current=!1,re(!1),null==a||a()}):(fe(!0),Pe.current(),me.current=!1,re(!1),void(null==a||a()))}var j=g.getBoundingClientRect().top-A.getBoundingClientRect().top+A.scrollTop,w=p.getBoundingClientRect().top-E.getBoundingClientRect().top+E.scrollTop-(j-A.scrollTop);w<0&&qe.current&&(qe.current.style.height="".concat(Math.abs(w),"px"));requestAnimationFrame(function(){var e,n=E.scrollHeight-E.clientHeight;if(w<0)e=0;else{if(w>n){var t=w-n;return ze.current&&(ze.current.style.height="".concat(t+150,"px")),void requestAnimationFrame(function(){c.smoothScrollTo(E,w,200,function(){fe(!0),Pe.current(),me.current=!1,re(!1),null==a||a()})})}e=w}c.smoothScrollTo(E,e,200,function(){fe(!0),Pe.current(),me.current=!1,re(!1),null==a||a()})})})}},[xe,an,Sn,de,$,Rn,Xn]),Tt=t.useCallback(function(e,n,t,i){var o="string"==typeof i?c.safeStringify(i).trim():c.safeStringify(null==i?void 0:i.deviation_summary).trim(),l=e.currentTarget;un(),It(n,t,o?{toggleIfSame:!1,onReady:function(){ln({open:!0,anchorEl:l,summary:i})}}:{toggleIfSame:!1})},[It,un,ln]),Ct=t.useCallback(function(){var e=Ze.sectionIdx,n=Ze.isOrphan;null!=e&&It(e,n)},[It,Ze.isOrphan,Ze.sectionIdx]),Bt=t.useCallback(function(){rn(),Xn()},[rn,Xn]),Dt=null!==Ze.sectionIdx&&Re.has(Ze.sectionIdx),Ot=_.useDeviationNavigation({proposedSections:Rn,existingSections:Sn,parentDeviationRecord:An,expandedSections:Qn,maintainRelativeOrder:!!$,scrollContainerRef:He,leftContainerRef:Ke,lhsBadgeRefs:wn,rhsBadgeRefs:Pn}),jt=Ot.showDeviationNavigation,wt=Ot.showOpenNodeRef;t.useEffect(function(){if(Q){var e=function(e){var n=An[e].find(function(e){return e.id===Q});if(n){var t=Rn.findIndex(function(n){return n.id===e});($?!!Qn["right-".concat(t)]:!!Qn[String(t)])||et(t,"left");var i="".concat(n.id).concat(c.DEVIATION_BADGE_SEPARATOR,"0"),o=setInterval(function(){var e,n,t=null===(e=wn.current[i])||void 0===e?void 0:e.current,l=null===(n=Pn.current[i])||void 0===n?void 0:n.current;if(t){t.scrollIntoView({behavior:"smooth",block:"center"});var r=window.getComputedStyle(t).color;t.style.transition="box-shadow 300ms ease-in-out",t.style.boxShadow="0 0 10px ".concat(r),l&&(l.style.transition="box-shadow 300ms ease-in-out",l.style.boxShadow="0 0 10px ".concat(r)),setTimeout(function(){t.style.boxShadow="",l&&(l.style.boxShadow="")},2e3),clearTimeout(o)}},600);return"break"}};for(var n in An){if("break"===e(n))break}}},[Q]);var Pt=function(e){var t=e.section,i=e.keyPath,o=e.depth,l=void 0===o?0:o,r=e.columnKey,c=void 0===r?"left":r,s=e.parentNodeId,u=void 0===s?"":s;return n.jsx(R.default,{section:t,keyPath:i,depth:l,columnKey:c,parentNodeId:u,expandedSubSections:Zn,setExpandedSubSections:$n,maintainRelativeOrder:$||!1,proposedSections:Rn,existingSections:Sn,treeData:V,deviationNumberRegistry:En,connectedSections:Re,activeSideBySideSection:xe,resolvedMarkdownStyles:Le,getSubSectionRef:Hn,getSubSectionCompareStyle:yt,getBadgeRef:Vn,openMoreFunctionsPopup:it,openSummaryPopup:Tt,resetSideBySide:Xn,setConnectedSections:Se,setConnectedLines:Ee,cachedConnectedPositions:De})};return n.jsxs(i.Box,e.__assign({ref:Ve,sx:e.__assign(e.__assign({display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif'},$?{}:{overflow:"visible"}),{position:"relative"})},{children:[te&&n.jsx(i.Box,e.__assign({sx:{position:"absolute",inset:0,bgcolor:"rgba(255, 255, 255, 0.6)",backdropFilter:"blur(10px)",zIndex:9999,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"8px"}},{children:n.jsx(v.default,{})})),on.open&&n.jsx(S.default,{open:on.open,anchorEl:on.anchorEl,containerEl:ct.current,onClose:Bt,summary:on.summary}),n.jsx(d.default,{open:Ze.open,anchorEl:Ze.anchorEl,sectionTitle:Ze.sectionTitle,referenceSectionTitle:Ze.refSectionTitle,onClose:an,onOpenCognitiveCompare:ot,onOpenSideBySide:Ct,onConnect:lt,isConnected:Dt,isOrphan:Ze.isOrphan}),Je.open&&n.jsx(a.default,{open:Je.open,popupRef:sn,position:en,popupConfig:U,onClose:function(){nn(null),Qe(function(n){return e.__assign(e.__assign({},n),{open:!1})}),cn(null)},markdownStyles:W,sectionTitle:Je.sectionTitle,referenceSectionTitle:Je.refSectionTitle,cognitiveData:Je.cognitiveData,anchorEl:Je.anchorEl,sectionAnchorEl:Je.sectionAnchorEl,scrollContainerEl:He.current,badgeStyle:Je.badgeStyle,docData:Je.docData,deviationData:Je.deviationData,isLoading:Je.isLoading}),n.jsx(i.Snackbar,e.__assign({open:!!se,autoHideDuration:8e3,onClose:function(){return ue(null)},anchorOrigin:{vertical:"top",horizontal:"center"}},{children:n.jsx(i.Alert,e.__assign({onClose:function(){return ue(null)},severity:"error",sx:{width:"100%",whiteSpace:"pre-line"}},{children:se}))})),n.jsx(m.default,{componentHeaderText:H,displayConfig:K,maintainRelativeOrder:$,onToggleView:function(e){ie(!0),setTimeout(function(){ee(!e),Xn(),Se(new Set),Ee([]),De.current=[],setTimeout(function(){ie(!1)},400)},50)}}),n.jsx(i.Box,e.__assign({ref:He,onScroll:Et,sx:{flex:1,minHeight:0,pt:1.5,pb:1,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",overflowY:$?"hidden":"auto",borderTop:qn&&zn?"none":"1.5px solid #EEF0F4"}},{children:n.jsx(i.Box,e.__assign({sx:e.__assign({display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"},$?{flex:1,minHeight:0}:{})},{children:n.jsxs(i.Box,e.__assign({ref:rt,sx:e.__assign({display:"grid",gridTemplateColumns:"minmax(0, 1fr) 180px minmax(0, 1fr)",gap:"40px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0},$?{flex:1,overflow:"visible"}:{})},{children:[n.jsxs("svg",e.__assign({ref:Ie,style:{position:"absolute",top:0,left:0,width:Ne.width||"100%",height:Ne.height||"100%",pointerEvents:"none",zIndex:10,overflow:"visible",transition:"opacity 0.15s ease-in-out"}},{children:[ht&&n.jsx("g",{children:n.jsx("line",{x1:ht.x1,y1:ht.y,x2:ht.x2,y2:ht.y,stroke:Un.badgeBorder,strokeWidth:"1.5"})}),gt.map(function(t){var r=t.x1+.5*(t.x2-t.x1),s=(t.y1+t.y2)/2;if("Not Defined"===t.style.label&&!t.hasCognitive)return null;if(t.isSubSection?de&&xe===t.subSectionKeyPath&&pe:de&&xe===t.sectionIdx&&pe)return n.jsxs("g",e.__assign({style:{transition:"opacity 0.2s"}},{children:[n.jsx("defs",{children:n.jsx("marker",e.__assign({id:"arr-".concat(t.id),markerWidth:"7",markerHeight:"5",refX:"7",refY:"2.5",orient:"auto"},{children:n.jsx("polygon",{points:"0 0, 7 2.5, 0 5",fill:t.style.badgeBorder||"#6366F1"})}))}),n.jsx("line",{ref:ut,x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:t.style.badgeBorder||"#6366F1",strokeWidth:"1.5",markerEnd:"url(#arr-".concat(t.id,")")})]}),t.id);if(!$){var a=t.isSubSection?c.getBentArrowPath(t.x1,t.y1,t.x2,t.y2):"M ".concat(t.x1," ").concat(t.y1," L ").concat(t.x2," ").concat(t.y2);return n.jsxs("g",{children:[n.jsx("path",{d:a,fill:"none",stroke:t.style.badgeBorder||"#E2E8F0",strokeWidth:"1.5"}),n.jsx("foreignObject",e.__assign({x:r-100,y:s-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(n){if(n.stopPropagation(),Je.open&&tn===t.id)un();else{var i=Rn[t.sectionIdx]||{title:"",content:""},o=Sn[t.sectionIdx]||{title:"",content:""};if(t.isSubSection&&t.subSectionKeyPath){for(var l=t.subSectionKeyPath.split(c.DEVIATION_BADGE_SEPARATOR)[2].split("-").map(Number),r=Rn[l[0]],s=Sn[l[0]],u=(null==r?void 0:r.title)||"",a=(null==s?void 0:s.title)||"",d=1;d<l.length;d++)(null==r?void 0:r.subsections)&&(r=r.subsections[l[d]]),(null==s?void 0:s.subsections)&&(s=s.subsections[l[d]]);r&&(i=e.__assign(e.__assign({},r),{title:u||r.title})),s&&(o=e.__assign(e.__assign({},s),{title:a||s.title}))}cn(t.id),tt(nt(n.currentTarget,i,o,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:"pointer"}},{children:[t.style.badgeText===u.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(l.ButtonCognitiveIcon,{})})),n.jsx(o.ChevronDown,{size:11,style:{transform:Je.open&&tn===t.id?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))}))]},t.id)}return null}),Ae.map(function(t){var i,o=t.pathD,l=(null===(i=t.style)||void 0===i?void 0:i.badgeBorder)||"#6366F1",r="conn-marker-".concat(t.id),c="".concat(t.id,"-bg"),s="".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:r,markerWidth:"8",markerHeight:"6",refX:"7",refY:"3",orient:"auto"},{children:n.jsx("polygon",{points:"0 0, 8 3, 0 6",fill:l})}))}))}),n.jsx("path",{ref:function(e){Be.current[c]=e},d:o,fill:"none",stroke:"#FFFFFF",strokeWidth:"4",strokeOpacity:"0.7"}),n.jsx("path",{ref:function(e){Be.current[s]=e},d:o,fill:"none",stroke:l,strokeWidth:"1.75",markerEnd:"url(#".concat(r,")")})]},t.id)})]})),n.jsxs(i.Box,e.__assign({sx:e.__assign({border:"1px solid #E7E7E9",borderRadius:"8px",bgcolor:"#FFFFFF",display:"flex",flexDirection:"column",position:"relative",zIndex:2,filter:"drop-shadow(0px 2px 4px #F2F2F2)"},$?{flex:1,overflow:"visible"}:{})},{children:[n.jsx(i.Box,e.__assign({ref:at,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E7E7E9",borderRadius:"8px 8px 0 0",display:"flex",alignItems:"center",minHeight:"40px",overflow:"hidden",minWidth:0}},{children:n.jsx(i.Tooltip,e.__assign({title:hn,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:hn}))}))})),n.jsxs(i.Box,e.__assign({ref:Ke,onScroll:Et,sx:e.__assign({p:"12px",display:"flex",flexDirection:"column"},$?{maxHeight:"calc(100vh - 150px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,mr:"-160px",pr:"172px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[n.jsx("div",{ref:We,style:{width:"100%",height:"0px",flexShrink:0}}),Tn&&Rn.map(function(t,l){var r,s,u=!t.title&&!t.content;if($&&u)return null;var a=t,d=mt(l),v=$?!(null===(r=a.refIndexes)||void 0===r?void 0:r.length)||a.selfIndex<0:!Sn[l],p=$?"number"==typeof a.selfIndex&&a.selfIndex>=0?a.selfIndex+1:null:l+1,f=Re.has(l),h=c.extractDeviationScore(a.evaluationResult,null==d?void 0:d.deviationLabel);return n.jsx(i.Box,e.__assign({ref:Ln(l),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:On.current[l],sx:e.__assign({width:"100%",display:"flex"},f&&{borderRadius:"6px",outline:"2px solid ".concat((null==d?void 0:d.badgeBorder)||"#6366F1"),outlineOffset:"1px"})},{children:n.jsx(y.default,{section:t,idx:l,columnKey:"left",colRef:Ln("left-accordion-".concat(l)),mb:0,treeData:V,proposedSections:Rn,existingSections:Sn,deviationNumberRegistry:En,getSectionCompareStyle:mt,getBadgeRef:Vn,connectedSections:Re,openMoreFunctionsPopup:it,openSummaryPopup:Tt,parentNodeId:(null===(s=null==V?void 0:V.input_index_map)||void 0===s?void 0:s[0])||"",isExpanded:$?!!Qn["left-".concat(l)]:!!Qn[String(l)],onToggle:function(){return et(l,"left")},navigation:t.id?jt[t.id]:null,showOpenNodeRef:wt,resolvedMarkdownStyles:Le,maintainRelativeOrder:$,renderSubSections:Pt})})),$&&d&&n.jsxs(i.Box,e.__assign({ref:wn.current[l],onClick:function(e){var n=$?Sn.find(function(e){var n;return null===(n=a.refIndexes)||void 0===n?void 0:n.includes(e.selfIndex)})||{title:"",content:""}:Sn[l]||{title:"",content:""};it(e,t,v,n,l,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!==p&&n.jsx(i.Box,e.__assign({component:"span",sx:{fontSize:"11px",fontWeight:700,pr:.5,borderRight:"1px solid ".concat(d.badgeBorder)}},{children:p})),n.jsx(i.Box,e.__assign({component:"span",sx:{fontSize:"11px",px:.25}},{children:!K.isLoading||null!=a.evaluationResult&&null!=a.evaluationResult?v?"No Deviation Found":"N/A"===h||"NA"===h?"N/A":0==h||null==h?"Same":"".concat(h):n.jsx(g.default,{color:d.badgeText})})),n.jsx(o.EllipsisVertical,{size:11,color:d.badgeText})]}))]}))}),"left-row-".concat(l))}),n.jsx("div",{ref:Ye,style:{width:"100%",height:"0px",flexShrink:0}})]}))]})),n.jsx(i.Box,e.__assign({ref:ct,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(),Je.open&&tn===Wn?un():(cn(Wn),tt(nt(n.currentTarget,{title:"",content:"",evaluationResult:Yn,cognitiveData:{section_id:"",decisioning:[],gap:[],relevance_score:0,isMissingRationale:!0}},null,Wn,!0,e.__assign(e.__assign({},Un),{label:""}))))},sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:"5px",top:"-5px",borderRadius:"20px",bgcolor:Un.badgeBg,color:Un.badgeText,border:"1px solid ".concat(Un.badgeBorder),fontSize:"12px",fontWeight:600,whiteSpace:"nowrap",position:"relative",zIndex:1,pointerEvents:"auto",cursor:"pointer"}},{children:[null!=Kn?Kn: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(l.ButtonCognitiveIcon,{})})),n.jsx(o.ChevronDown,{size:11,style:{transform:Je.open&&tn===Wn?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))})),n.jsxs(i.Box,e.__assign({sx:e.__assign({border:"1px solid #E3E6EA",borderRadius:"8px",bgcolor:"#FFFFFF",boxShadow:"0px 1px 4px #F7F4FE",position:"relative",zIndex:2,display:"flex",flexDirection:"column",minWidth:0},$?{flex:1,overflow:"visible",minHeight:0}:{})},{children:[le&&n.jsx(r.default,{sections:11}),n.jsx(i.Box,e.__assign({ref:dt,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:xn,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:xn}))}))})),n.jsxs(i.Box,e.__assign({ref:Ge,onScroll:Et,sx:e.__assign({p:"12px",display:"flex",flexDirection:"column"},$?{maxHeight:"calc(100vh - 150px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,ml:"-120px",pl:"140px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[n.jsx("div",{ref:qe,style:{width:"100%",height:"0px",flexShrink:0}}),Tn&&Sn.map(function(t,o){var l,r=t,c=[],s=!1,u=null;if($){c=Rn.filter(function(e){var n;return(null===(n=e.refIndexes)||void 0===n?void 0:n.includes(r.selfIndex))&&e.selfIndex>=0}).map(function(e){return e.selfIndex+1});var a=Rn.findIndex(function(e,n){var t;return Re.has(n)&&(null===(t=e.refIndexes)||void 0===t?void 0:t.includes(r.selfIndex))});(s=-1!==a)&&(u=mt(a))}else c=[o+1],(s=Re.has(o))&&(u=mt(o));var d=mt(o);return n.jsx(i.Box,e.__assign({ref:kn.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:jn.current[o],sx:e.__assign({width:"100%",display:"flex"},s&&u&&{borderRadius:"6px",outline:"2px solid ".concat(u.badgeBorder),outlineOffset:"1px"})},{children:n.jsx(y.default,{section:t,idx:o,columnKey:"right",colRef:Ln("right-accordion-".concat(o)),mb:0,parentNodeId:(null===(l=null==V?void 0:V.input_index_map)||void 0===l?void 0:l[1])||"",isExpanded:$?!!Qn["right-".concat(o)]:!!Qn[String(o)],treeData:V,proposedSections:Rn,existingSections:Sn,deviationNumberRegistry:En,getBadgeRef:Vn,getSectionCompareStyle:mt,connectedSections:Re,openMoreFunctionsPopup:it,openSummaryPopup:Tt,onToggle:function(){return et(o,"right")},navigation:t.id?jt[t.id]:null,showOpenNodeRef:wt,resolvedMarkdownStyles:Le,maintainRelativeOrder:$,renderSubSections:Pt})})),$&&!le&&d&&n.jsx(i.Box,e.__assign({ref:Pn.current[o],"data-section-id":r.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:d.badgeBg,color:d.badgeText,border:"1px solid ".concat(d.badgeBorder),borderRadius:"10px",px:1,py:.3,fontWeight:700,whiteSpace:"nowrap",zIndex:20}},{children:c.length>0?c.join(", "):"-"}))]}))}),"right-row-".concat(o))}),n.jsx("div",{ref:ze,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"),o=require("react/jsx-runtime"),i=require("@mui/material"),n=require("lucide-react");exports.default=function(t){var r,a,l=t.open,s=t.anchorEl,c=t.containerEl,d=t.onClose,p=t.summary,u=t.markdownStyles;if(t.isLoading,!p)return null;var x="string"==typeof p?{deviation_summary:p}:p;x.deviation_title;var g=x.deviation_summary,h=x.evaluation_outputs,m=(null===(r=null==h?void 0:h.metadata)||void 0===r?void 0:r.label_color)||"#6366F1",v=null!==(a=null==c?void 0:c.getBoundingClientRect().width)&&void 0!==a?a:180,_=Math.max(148,Math.min(172,v-8)),f=s&&c?{top:s.getBoundingClientRect().bottom+8,left:c.getBoundingClientRect().left+c.getBoundingClientRect().width/2}:null;return o.jsxs(i.Popover,e.__assign({open:l,anchorEl:f?void 0:s,anchorReference:f?"anchorPosition":"anchorEl",anchorPosition:f||void 0,onClose:d,disableScrollLock:!0,anchorOrigin:{vertical:"bottom",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},slotProps:{paper:{sx:e.__assign({mt:0,p:1.5,borderRadius:"12px",boxShadow:"0px 10px 24px rgba(15, 23, 42, 0.18)",width:"".concat(_,"px"),maxWidth:"".concat(_,"px"),bgcolor:"#FFFFFF",opacity:1,border:"1px solid ".concat(m,"26"),borderTop:"3px solid ".concat(m),overflow:"hidden"},u)}}},{children:[o.jsxs(i.Box,e.__assign({sx:{display:"flex",alignItems:"center",justifyContent:"space-between",mb:.75}},{children:[o.jsxs(i.Box,e.__assign({sx:{display:"flex",alignItems:"center",gap:.75,minWidth:0}},{children:[o.jsx(n.Info,{size:14,color:m}),o.jsx(i.Typography,e.__assign({sx:{fontSize:"11px",fontWeight:700,color:m,textTransform:"uppercase",letterSpacing:"0.4px",lineHeight:1.2}},{children:"Summary"}))]})),o.jsx(i.IconButton,e.__assign({size:"small",onClick:d,sx:{p:.25,ml:.5,color:"#64748B"}},{children:o.jsx(n.X,{size:14})}))]})),o.jsx(i.Typography,e.__assign({sx:{fontSize:"12px",color:"#475569",lineHeight:1.5,fontWeight:400,overflowWrap:"anywhere"}},{children:g||"No summary available."}))]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),o=require("react/jsx-runtime"),i=require("@mui/material"),n=require("lucide-react");exports.default=function(t){var r,a,l=t.open,s=t.anchorEl,c=t.containerEl,d=t.onClose,p=t.summary,u=t.markdownStyles;if(t.isLoading,!p)return null;var x="string"==typeof p?{deviation_summary:p}:p;x.deviation_title;var g=x.deviation_summary,h=x.evaluation_outputs,m=(null===(r=null==h?void 0:h.metadata)||void 0===r?void 0:r.label_color)||"#6366F1",v=null!==(a=null==c?void 0:c.getBoundingClientRect().width)&&void 0!==a?a:180,_=Math.max(148,v),f=s&&c?{top:s.getBoundingClientRect().bottom+8,left:c.getBoundingClientRect().left+c.getBoundingClientRect().width/2}:null;return o.jsxs(i.Popover,e.__assign({open:l,anchorEl:f?void 0:s,anchorReference:f?"anchorPosition":"anchorEl",anchorPosition:f||void 0,onClose:d,disableScrollLock:!0,anchorOrigin:{vertical:"bottom",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},slotProps:{paper:{sx:e.__assign({mt:0,p:1.5,borderRadius:"12px",boxShadow:"0px 10px 24px rgba(15, 23, 42, 0.18)",width:"".concat(_,"px"),maxWidth:"".concat(_,"px"),bgcolor:"#FFFFFF",opacity:1,border:"1px solid ".concat(m,"26"),borderTop:"3px solid ".concat(m),overflow:"hidden"},u)}}},{children:[o.jsxs(i.Box,e.__assign({sx:{display:"flex",alignItems:"center",justifyContent:"space-between",mb:.75}},{children:[o.jsxs(i.Box,e.__assign({sx:{display:"flex",alignItems:"center",gap:.75,minWidth:0}},{children:[o.jsx(n.Info,{size:14,color:m}),o.jsx(i.Typography,e.__assign({sx:{fontSize:"11px",fontWeight:700,color:m,textTransform:"uppercase",letterSpacing:"0.4px",lineHeight:1.2}},{children:"Summary"}))]})),o.jsx(i.IconButton,e.__assign({size:"small",onClick:d,sx:{p:.25,ml:.5,color:"#64748B"}},{children:o.jsx(n.X,{size:14})}))]})),o.jsx(i.Typography,e.__assign({sx:{fontSize:"12px",color:"#475569",lineHeight:1.5,fontWeight:400,overflowWrap:"anywhere"}},{children:g||"No summary available."}))]}))};
2
2
  //# sourceMappingURL=CognitiveSummaryPopup.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),o=require("react"),i=require("@mui/material"),t=require("lucide-react"),l=require("../hooks/memoizedMarkdown.js"),r=require("../CognitiveComparehelpers.js"),s=require("../CognitiveCompareConstants.js");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var d=a(o);exports.default=function(a){var c,u,v,p,f,h,x,g,m,_,y,w,b,S,A,I=a.section,R=a.idx,j=a.columnKey,E=a.colRef,C=a.mb,F=void 0===C?1:C,k=a.parentNodeId,O=void 0===k?"":k,D=a.isExpanded,B=a.onToggle,M=a.navigation,T=a.showOpenNodeRef,N=a.resolvedMarkdownStyles,P=a.maintainRelativeOrder,V=a.renderSubSections,W=a.treeData,q=a.proposedSections,G=void 0===q?[]:q,z=a.existingSections,K=void 0===z?[]:z,L=a.deviationNumberRegistry,U=void 0===L?{}:L,X=a.getBadgeRef,Y=a.openSummaryPopup,H=a.getSectionCompareStyle,$=a.connectedSections,J=a.openMoreFunctionsPopup,Q=(null===(c=I.displayTitle)||void 0===c||c)&&r.hasValue(I.title),Z=(null===(u=I.displayContent)||void 0===u||u)&&r.hasValue(I.content),ee=!Q&&!Z,ne={current:1},oe=I.title;Q||(oe=Z?"No Title Found":"No Matching Section Found");var ie,te=null!==(h=null===(f=null===(p=null===(v=I.evaluationResult)||void 0===v?void 0:v.evaluation_outputs)||void 0===p?void 0:p.metadata)||void 0===f?void 0:f.label_color)&&void 0!==h?h:s.DEFAULT_DEVIAION_COLOR,le=r.generateColorPalette(te).highlightBg,re=I.id,se=null!==(m=null===(g=null===(x=I.evaluationResult)||void 0===x?void 0:x.evaluation_outputs)||void 0===g?void 0:g.output_value)&&void 0!==m?m:null,ae=(null===(_=I.evaluationResult)||void 0===_?void 0:_.deviations)||{},de=null===(y=null==W?void 0:W.input_index_map)||void 0===y?void 0:y[0],ce=null===(w=null==W?void 0:W.input_index_map)||void 0===w?void 0:w[1],ue="left"===j?ce:de,ve=P?!(null===(b=I.refIndexes)||void 0===b?void 0:b.length)||void 0!==I.selfIndex&&I.selfIndex<0:"left"===j?!K[R]:!G[R],pe=P&&void 0!==I.selfIndex&&I.selfIndex>=0?I.selfIndex+1:R+1,fe=[],he=Object.entries(ae).map(function(e){var n,o,i=e[0],t=e[1],l="".concat(re).concat(r.DEVIATION_BADGE_SEPARATOR).concat(i),s=U[l];if(!s)return null;var a=t[O],d=r.isMissingStr(a);if(d)a="";else if(!a)return null;fe.push(a);var c=t[ue],u="left"===j?null===(n=G[R])||void 0===n?void 0:n.content:null===(o=K[R])||void 0===o?void 0:o.content,v=r.safeStringify(u),p=Object.keys(ae).map(function(e){return{key:e,text:ae[e][ue]}}).filter(function(e){return!r.isMissingStr(e.text)}).sort(function(e,n){return n.text.length-e.text.length}),f=new Set;p.forEach(function(e){var n=e.text.replace(/\\(['’])/g,"$1").replace(/\\n/g,"\n");if(n){var o=new RegExp(r.escapeRegExp(n));o.test(v)&&(f.add(e.key),v=v.replace(o,"__TOKEN_".concat(e.key,"__")))}});var h=!r.isMissingStr(c)&&!f.has(i),x=ve||r.isMissingStr(c)||h,g="".concat(pe,".").concat(s),m="".concat(re).concat(r.DEVIATION_BADGE_SEPARATOR).concat(i).concat(r.DEVIATION_BADGE_SEPARATOR).concat(R).concat(r.DEVIATION_BADGE_SEPARATOR).concat(R),_=H?H(R):null;return{id:l,actionId:m,label:g,highlight:a,side:j,style:_,score:se,isConnected:null==$?void 0:$.has(m),isOrphan:x,isMissingClause:d,badgeRef:X(j,l),onClick:function(e){var n;e.stopPropagation();var o=K[R]||{title:"",content:""};if(P&&"left"===j){var i=null===(n=I.refIndexes)||void 0===n?void 0:n[0],t=K.findIndex(function(e){return e.selfIndex===i});-1!==t&&(o=K[t])}J&&J(e,I,x,o,m,_)},onSummaryClick:function(e){e.stopPropagation(),Y(e,m,x,I.evaluationResult||null)}}}).filter(Boolean),xe=I.id&&j===(null==M?void 0:M.columnKey)?M:null;return o.useEffect(function(){D&&T.current===I.id&&(null==xe?void 0:xe.showBelow)&&setTimeout(function(){var e,n;T.current===I.id&&(T.current="",null===(n=null===(e=null==xe?void 0:xe.showBelowRef)||void 0===e?void 0:e.current)||void 0===n||n.scrollIntoView({behavior:"smooth",block:"center"}))},600)},[D,I.id,xe,T]),n.jsxs(i.Box,e.__assign({ref:E,sx:{mb:F,width:"100%",display:"flex",flexDirection:"column",position:"relative",minWidth:0}},{children:[D&&(null==xe?void 0:xe.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==xe?void 0:xe.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"===j?"+":"-"," 130px))"),position:"absolute",paddingTop:"20px"},"left"===j?{right:"0px"}:{left:"0px"})},{children:n.jsx(t.ChevronUp,{color:window.getComputedStyle(null===(S=null==xe?void 0:xe.showAboveRef)||void 0===S?void 0:S.current).color})}))})),n.jsxs(i.Accordion,e.__assign({disableGutters:!0,expanded:!ee&&D,onChange:function(){ee||(B(),T.current=I.id)},sx:{boxShadow:"none",border:ee?"1px dashed #E2E8F0":"1px solid #E2E8F0",bgcolor:ee?"#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(i.AccordionSummary,e.__assign({expandIcon:ee?null:n.jsx(t.ChevronDown,{size:16}),sx:{minHeight:"36px",flexShrink:0,cursor:ee?"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:Q&&n.jsx(i.Tooltip,e.__assign({title:oe,placement:"top"},{children:n.jsx(i.Typography,e.__assign({component:"div",sx:{fontSize:"12px",color:ee?"#94A3B8":"#19213D",fontWeight:ee?400:700,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0}},{children:(ie=oe,ie?r.safeStringify(ie).replace(/\\n/g,"\n").split(/(\*\*.*?\*\*)/g).map(function(e,o){return e.startsWith("**")&&e.endsWith("**")?n.jsx("strong",{children:e.slice(2,-2)},o):n.jsx(d.default.Fragment,{children:e},o)}):null)}))}))})),!ee&&n.jsxs(i.AccordionDetails,e.__assign({sx:{pt:0,pb:1.25,bgcolor:"#FFFFFF",flex:1,display:"flex",flexDirection:"column",minWidth:0}},{children:[Z&&n.jsx(l.MemoizedMarkdown,{content:I.content,sxStyles:N,highlights:fe,maintainRelativeOrder:P,highlightBg:le,deviationBadges:he}),(I.subsections||[]).map(function(e,n){return V({section:e,keyPath:"".concat(R,"-").concat(n),depth:0,columnKey:j,parentNodeId:O,devCounter:ne})})]}))]})),D&&(null==xe?void 0:xe.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==xe?void 0:xe.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"===j?"+":"-"," 130px))"),position:"absolute",paddingBottom:"20px"},"left"===j?{right:"0px"}:{left:"0px"})},{children:n.jsx(t.ChevronDown,{color:window.getComputedStyle(null===(A=null==xe?void 0:xe.showBelowRef)||void 0===A?void 0:A.current).color})}))}))]}),"".concat(j,"-sec-").concat(R))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),o=require("react"),i=require("@mui/material"),t=require("lucide-react"),l=require("../hooks/memoizedMarkdown.js"),r=require("../CognitiveComparehelpers.js"),a=require("../CognitiveCompareConstants.js");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var d=s(o);exports.default=function(s){var c,u,v,p,f,h,x,g,m,_,y,w,b,S,A,I=s.section,R=s.idx,j=s.columnKey,E=s.colRef,C=s.mb,F=void 0===C?1:C,k=s.parentNodeId,O=void 0===k?"":k,D=s.isExpanded,B=s.onToggle,M=s.navigation,T=s.showOpenNodeRef,N=s.resolvedMarkdownStyles,P=s.maintainRelativeOrder,V=s.renderSubSections,W=s.treeData,q=s.proposedSections,G=void 0===q?[]:q,z=s.existingSections,K=void 0===z?[]:z,L=s.deviationNumberRegistry,U=void 0===L?{}:L,X=s.getBadgeRef,Y=s.openSummaryPopup,H=s.getSectionCompareStyle,$=s.connectedSections,J=s.openMoreFunctionsPopup,Q=(null===(c=I.displayTitle)||void 0===c||c)&&r.hasValue(I.title),Z=(null===(u=I.displayContent)||void 0===u||u)&&r.hasValue(I.content),ee=!Q&&!Z,ne={current:1},oe=I.title;Q||(oe=Z?"No Title Found":"No Matching Section Found");var ie,te=null!==(h=null===(f=null===(p=null===(v=I.evaluationResult)||void 0===v?void 0:v.evaluation_outputs)||void 0===p?void 0:p.metadata)||void 0===f?void 0:f.label_color)&&void 0!==h?h:a.DEFAULT_DEVIAION_COLOR,le=r.generateColorPalette(te).highlightBg,re=I.id,ae=null!==(m=null===(g=null===(x=I.evaluationResult)||void 0===x?void 0:x.evaluation_outputs)||void 0===g?void 0:g.output_value)&&void 0!==m?m:null,se=(null===(_=I.evaluationResult)||void 0===_?void 0:_.deviations)||{},de=null===(y=null==W?void 0:W.input_index_map)||void 0===y?void 0:y[0],ce=null===(w=null==W?void 0:W.input_index_map)||void 0===w?void 0:w[1],ue="left"===j?ce:de,ve=P?!(null===(b=I.refIndexes)||void 0===b?void 0:b.length)||void 0!==I.selfIndex&&I.selfIndex<0:"left"===j?!K[R]:!G[R],pe=P&&void 0!==I.selfIndex&&I.selfIndex>=0?I.selfIndex+1:R+1,fe=[],he=Object.entries(se).map(function(e){var n,o,i,t,l=e[0],a=e[1],s="".concat(re).concat(r.DEVIATION_BADGE_SEPARATOR).concat(l),d=U[s];if(!d)return null;var c=a[O],u=r.isMissingStr(c);if(u)c="";else if(!c)return null;fe.push(c);var v=a[ue],p="left"===j?null===(n=G[R])||void 0===n?void 0:n.content:null===(o=K[R])||void 0===o?void 0:o.content,f=r.safeStringify(p),h=Object.keys(se).map(function(e){return{key:e,text:se[e][ue]}}).filter(function(e){return!r.isMissingStr(e.text)}).sort(function(e,n){return n.text.length-e.text.length}),x=new Set;h.forEach(function(e){var n=e.text.replace(/\\(['’])/g,"$1").replace(/\\n/g,"\n");if(n){var o=new RegExp(r.escapeRegExp(n));o.test(f)&&(x.add(e.key),f=f.replace(o,"__TOKEN_".concat(e.key,"__")))}});var g=!r.isMissingStr(v)&&!x.has(l),m=ve||r.isMissingStr(v)||g,_="".concat(pe,".").concat(d),y="".concat(re).concat(r.DEVIATION_BADGE_SEPARATOR).concat(l).concat(r.DEVIATION_BADGE_SEPARATOR).concat(R).concat(r.DEVIATION_BADGE_SEPARATOR).concat(R),w=H?H(R):null,b=(null==a?void 0:a.deviation_summary)?{deviation_summary:a.deviation_summary,deviation_title:null===(i=I.evaluationResult)||void 0===i?void 0:i.deviation_title,evaluation_outputs:null===(t=I.evaluationResult)||void 0===t?void 0:t.evaluation_outputs}:null;return{id:s,actionId:y,label:_,highlight:c,side:j,style:w,score:ae,isConnected:null==$?void 0:$.has(y),isOrphan:m,isMissingClause:u,badgeRef:X(j,s),onClick:function(e){var n;e.stopPropagation();var o=K[R]||{title:"",content:""};if(P&&"left"===j){var i=null===(n=I.refIndexes)||void 0===n?void 0:n[0],t=K.findIndex(function(e){return e.selfIndex===i});-1!==t&&(o=K[t])}J&&J(e,I,m,o,y,w)},onSummaryClick:function(e){e.stopPropagation(),Y(e,y,m,b)}}}).filter(Boolean),xe=I.id&&j===(null==M?void 0:M.columnKey)?M:null;return o.useEffect(function(){D&&T.current===I.id&&(null==xe?void 0:xe.showBelow)&&setTimeout(function(){var e,n;T.current===I.id&&(T.current="",null===(n=null===(e=null==xe?void 0:xe.showBelowRef)||void 0===e?void 0:e.current)||void 0===n||n.scrollIntoView({behavior:"smooth",block:"center"}))},600)},[D,I.id,xe,T]),n.jsxs(i.Box,e.__assign({ref:E,sx:{mb:F,width:"100%",display:"flex",flexDirection:"column",position:"relative",minWidth:0}},{children:[D&&(null==xe?void 0:xe.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==xe?void 0:xe.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"===j?"+":"-"," 130px))"),position:"absolute",paddingTop:"20px"},"left"===j?{right:"0px"}:{left:"0px"})},{children:n.jsx(t.ChevronUp,{color:window.getComputedStyle(null===(S=null==xe?void 0:xe.showAboveRef)||void 0===S?void 0:S.current).color})}))})),n.jsxs(i.Accordion,e.__assign({disableGutters:!0,expanded:!ee&&D,onChange:function(){ee||(B(),T.current=I.id)},sx:{boxShadow:"none",border:ee?"1px dashed #E2E8F0":"1px solid #E2E8F0",bgcolor:ee?"#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(i.AccordionSummary,e.__assign({expandIcon:ee?null:n.jsx(t.ChevronDown,{size:16}),sx:{minHeight:"36px",flexShrink:0,cursor:ee?"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:Q&&n.jsx(i.Tooltip,e.__assign({title:oe,placement:"top"},{children:n.jsx(i.Typography,e.__assign({component:"div",sx:{fontSize:"12px",color:ee?"#94A3B8":"#19213D",fontWeight:ee?400:700,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0}},{children:(ie=oe,ie?r.safeStringify(ie).replace(/\\n/g,"\n").split(/(\*\*.*?\*\*)/g).map(function(e,o){return e.startsWith("**")&&e.endsWith("**")?n.jsx("strong",{children:e.slice(2,-2)},o):n.jsx(d.default.Fragment,{children:e},o)}):null)}))}))})),!ee&&n.jsxs(i.AccordionDetails,e.__assign({sx:{pt:0,pb:1.25,bgcolor:"#FFFFFF",flex:1,display:"flex",flexDirection:"column",minWidth:0}},{children:[Z&&n.jsx(l.MemoizedMarkdown,{content:I.content,sxStyles:N,highlights:fe,maintainRelativeOrder:P,highlightBg:le,deviationBadges:he}),(I.subsections||[]).map(function(e,n){return V({section:e,keyPath:"".concat(R,"-").concat(n),depth:0,columnKey:j,parentNodeId:O,devCounter:ne})})]}))]})),D&&(null==xe?void 0:xe.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==xe?void 0:xe.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"===j?"+":"-"," 130px))"),position:"absolute",paddingBottom:"20px"},"left"===j?{right:"0px"}:{left:"0px"})},{children:n.jsx(t.ChevronDown,{color:window.getComputedStyle(null===(A=null==xe?void 0:xe.showBelowRef)||void 0===A?void 0:A.current).color})}))}))]}),"".concat(j,"-sec-").concat(R))};
2
2
  //# sourceMappingURL=SectionAccordion.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"),t=require("@mui/material"),o=require("lucide-react"),s=require("../hooks/memoizedMarkdown.js"),l=require("../CognitiveComparehelpers.js"),a=require("../CognitiveCompareConstants.js");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=d(i).default.memo(function(i){var d,c,u,v,h,p,g,f,_,x,m,S,b,y,I,A,j=i.section,R=i.keyPath,B=i.depth,E=void 0===B?0:B,O=i.columnKey,C=void 0===O?"left":O,w=i.parentNodeId,D=void 0===w?"":w,P=i.expandedSubSections,F=i.setExpandedSubSections,M=i.maintainRelativeOrder,T=i.proposedSections,k=i.existingSections,N=i.treeData,q=i.deviationNumberRegistry,V=i.connectedSections,W=i.activeSideBySideSection,z=i.resolvedMarkdownStyles,G=i.getSubSectionRef,L=i.getSubSectionCompareStyle,U=i.getBadgeRef,H=i.openMoreFunctionsPopup,K=i.openSummaryPopup,J=i.resetSideBySide,Q=i.setConnectedSections,X=i.setConnectedLines,Y=i.cachedConnectedPositions,Z=(null===(d=j.displayTitle)||void 0===d||d)&&l.hasValue(j.title),$=(null===(c=j.displayContent)||void 0===c||c)&&l.hasValue(j.content),ee=!Z&&!$,ne=Z?j.title:$?"No Title Found":"No Matching Section Found",ie=!!P[R],te=G(C,R),oe=L(R),se=R.split("-").map(Number),le=se[0],ae=T[le],de=k[le],re=R,ce=R;if(M)if("left"===C){var ue=null===(u=null==ae?void 0:ae.refIndexes)||void 0===u?void 0:u[0],ve=k.findIndex(function(e){return e.selfIndex===ue});-1!==ve&&(de=k[ve],ce=e.__spreadArray([ve],se.slice(1),!0).join("-"))}else{var he=null===(v=null==de?void 0:de.refIndexes)||void 0===v?void 0:v[0],pe=T.findIndex(function(e){return e.selfIndex===he});-1!==pe&&(ae=T[pe],re=e.__spreadArray([pe],se.slice(1),!0).join("-"))}var ge="left"===C?ae:de;A=M&&void 0!==(null==ge?void 0:ge.selfIndex)&&ge.selfIndex>=0?ge.selfIndex+1:le+1;for(var fe=ae,_e=de,xe=1;xe<se.length;xe++)(null==fe?void 0:fe.subsections)&&(fe=fe.subsections[se[xe]]),(null==_e?void 0:_e.subsections)&&(_e=_e.subsections[se[xe]]);var me=null===(h=null==N?void 0:N.input_index_map)||void 0===h?void 0:h[0],Se=null===(p=null==N?void 0:N.input_index_map)||void 0===p?void 0:p[1],be="left"===C?Se:me,ye=M?!(null===(g=j.refIndexes)||void 0===g?void 0:g.length)||void 0!==j.selfIndex&&j.selfIndex<0:"left"===C?!_e:!fe,Ie=null!==(x=null===(_=null===(f=j.evaluationResult)||void 0===f?void 0:f.evaluation_outputs)||void 0===_?void 0:_.output_value)&&void 0!==x?x:null,Ae=j.id,je=null!==(y=null===(b=null===(S=null===(m=j.evaluationResult)||void 0===m?void 0:m.evaluation_outputs)||void 0===S?void 0:S.metadata)||void 0===b?void 0:b.label_color)&&void 0!==y?y:a.DEFAULT_DEVIAION_COLOR,Re=l.generateColorPalette(je).highlightBg,Be=(null===(I=j.evaluationResult)||void 0===I?void 0:I.deviations)||{},Ee=[],Oe=Object.entries(Be).map(function(n){var i=n[0],t=n[1],o="".concat(Ae).concat(l.DEVIATION_BADGE_SEPARATOR).concat(i),s=q[o];if(!s)return null;var a=t[D],d=l.isMissingStr(a);if(d)a="";else if(!a)return null;Ee.push(a);var r=t[be],c=!1;r&&(c=Object.values(Be).map(function(e){return e[be]}).filter(Boolean).some(function(e){return e.length>r.length&&e.includes(r)}));var u=ye||l.isMissingStr(r)||c,v="".concat(A,".").concat(s),h="".concat(Ae).concat(l.DEVIATION_BADGE_SEPARATOR).concat(i).concat(l.DEVIATION_BADGE_SEPARATOR).concat(re).concat(l.DEVIATION_BADGE_SEPARATOR).concat(ce);return{id:o,actionId:h,label:v,highlight:a,side:C,style:oe,score:Ie,isConnected:V.has(h),isOrphan:u,isMissingClause:d,badgeRef:U(C,o),onClick:function(n){n.stopPropagation();var i=e.__assign(e.__assign({},fe),{title:(null==ae?void 0:ae.title)||(null==fe?void 0:fe.title)||""}),t=e.__assign(e.__assign({},_e),{title:(null==de?void 0:de.title)||(null==_e?void 0:_e.title)||""});H(n,i,u,t,h,oe)},onSummaryClick:function(e){e.stopPropagation(),K(e,h,u,j.evaluationResult||null)}}}).filter(Boolean),Ce=Oe.some(function(e){return V.has(e.actionId)});if(!(Z||$||j.subsections&&0!==j.subsections.length))return null;var we=!M&&Z&&$,De=Ce&&oe?{borderRadius:"4px",outline:"2px solid ".concat(oe.badgeBorder),outlineOffset:"1px"}:{};return Z?n.jsx(t.Box,e.__assign({ref:te,sx:{mt:1,width:"100%",minWidth:0,position:"relative"}},{children:n.jsx(t.Box,e.__assign({sx:e.__assign({width:"100%"},De)},{children:n.jsxs(t.Accordion,e.__assign({disableGutters:!0,expanded:!ee&&ie,onChange:function(){if(!ee){if(ie){var n=String(W||""),i=n.includes(re)||n.includes(ce);i||V.forEach(function(e){(String(e).includes(re)||String(e).includes(ce))&&(i=!0)}),i&&(J(),Q(new Set),X([]),Y.current=[])}F(function(n){var i;return e.__assign(e.__assign({},n),((i={})[R]=!n[R],i))})}},sx:{mt:0,boxShadow:"none",border:ee?"1px dashed #E2E8F0":"1px solid #EEF2F7",borderRadius:"4px !important",bgcolor:"#FFFFFF",minWidth:0,"&:before":{display:"none"}}},{children:[n.jsx(t.AccordionSummary,e.__assign({expandIcon:ee?null:n.jsx(o.ChevronDown,{size:14}),sx:{minHeight:"32px","& .MuiAccordionSummary-content":{my:.5,display:"grid",alignItems:"center",minWidth:0,width:"100%"}}},{children:n.jsx(t.Typography,e.__assign({component:"div",sx:{fontSize:"11px",fontWeight:600,color:ee?"#94A3B8":"#19213D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0}},{children:ne||"Untitled Subsection"}))})),!ee&&n.jsxs(t.AccordionDetails,e.__assign({sx:{pt:0,pb:1,minWidth:0}},{children:[$&&n.jsx(s.MemoizedMarkdown,{content:j.content,sxStyles:z,deviationBadges:we?[]:Oe,maintainRelativeOrder:M,highlightBg:Re,highlights:Ee}),(j.subsections||[]).map(function(t,o){return n.jsx(r,e.__assign({},i,{section:t,keyPath:"".concat(R,"-").concat(o),depth:E+1}),"".concat(R,"-").concat(o))})]}))]}))}))})):n.jsx(t.Box,e.__assign({ref:te,sx:{mt:0===E?1:.75,width:"100%",minWidth:0,position:"relative"}},{children:!ee&&n.jsxs(t.Box,e.__assign({sx:e.__assign({width:"100%"},De)},{children:[$&&n.jsx(s.MemoizedMarkdown,{content:j.content,sxStyles:z,deviationBadges:Oe,maintainRelativeOrder:M,highlightBg:Re,highlights:Ee}),(j.subsections||[]).map(function(t,o){return n.jsx(r,e.__assign({},i,{section:t,keyPath:"".concat(R,"-").concat(o),depth:E+1}),"".concat(R,"-").concat(o))})]}))}))});exports.default=r;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),i=require("react/jsx-runtime"),n=require("react"),t=require("@mui/material"),o=require("lucide-react"),s=require("../hooks/memoizedMarkdown.js"),l=require("../CognitiveComparehelpers.js"),a=require("../CognitiveCompareConstants.js");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=d(n).default.memo(function(n){var d,u,c,v,p,h,_,g,f,x,m,S,b,y,I,A,R=n.section,j=n.keyPath,B=n.depth,E=void 0===B?0:B,O=n.columnKey,C=void 0===O?"left":O,w=n.parentNodeId,D=void 0===w?"":w,P=n.expandedSubSections,F=n.setExpandedSubSections,M=n.maintainRelativeOrder,T=n.proposedSections,k=n.existingSections,N=n.treeData,q=n.deviationNumberRegistry,V=n.connectedSections,W=n.activeSideBySideSection,z=n.resolvedMarkdownStyles,G=n.getSubSectionRef,L=n.getSubSectionCompareStyle,U=n.getBadgeRef,H=n.openMoreFunctionsPopup,K=n.openSummaryPopup,J=n.resetSideBySide,Q=n.setConnectedSections,X=n.setConnectedLines,Y=n.cachedConnectedPositions,Z=(null===(d=R.displayTitle)||void 0===d||d)&&l.hasValue(R.title),$=(null===(u=R.displayContent)||void 0===u||u)&&l.hasValue(R.content),ee=!Z&&!$,ie=Z?R.title:$?"No Title Found":"No Matching Section Found",ne=!!P[j],te=G(C,j),oe=L(j),se=j.split("-").map(Number),le=se[0],ae=T[le],de=k[le],re=j,ue=j;if(M)if("left"===C){var ce=null===(c=null==ae?void 0:ae.refIndexes)||void 0===c?void 0:c[0],ve=k.findIndex(function(e){return e.selfIndex===ce});-1!==ve&&(de=k[ve],ue=e.__spreadArray([ve],se.slice(1),!0).join("-"))}else{var pe=null===(v=null==de?void 0:de.refIndexes)||void 0===v?void 0:v[0],he=T.findIndex(function(e){return e.selfIndex===pe});-1!==he&&(ae=T[he],re=e.__spreadArray([he],se.slice(1),!0).join("-"))}var _e="left"===C?ae:de;A=M&&void 0!==(null==_e?void 0:_e.selfIndex)&&_e.selfIndex>=0?_e.selfIndex+1:le+1;for(var ge=ae,fe=de,xe=1;xe<se.length;xe++)(null==ge?void 0:ge.subsections)&&(ge=ge.subsections[se[xe]]),(null==fe?void 0:fe.subsections)&&(fe=fe.subsections[se[xe]]);var me=null===(p=null==N?void 0:N.input_index_map)||void 0===p?void 0:p[0],Se=null===(h=null==N?void 0:N.input_index_map)||void 0===h?void 0:h[1],be="left"===C?Se:me,ye=M?!(null===(_=R.refIndexes)||void 0===_?void 0:_.length)||void 0!==R.selfIndex&&R.selfIndex<0:"left"===C?!fe:!ge,Ie=null!==(x=null===(f=null===(g=R.evaluationResult)||void 0===g?void 0:g.evaluation_outputs)||void 0===f?void 0:f.output_value)&&void 0!==x?x:null,Ae=R.id,Re=null!==(y=null===(b=null===(S=null===(m=R.evaluationResult)||void 0===m?void 0:m.evaluation_outputs)||void 0===S?void 0:S.metadata)||void 0===b?void 0:b.label_color)&&void 0!==y?y:a.DEFAULT_DEVIAION_COLOR,je=l.generateColorPalette(Re).highlightBg,Be=(null===(I=R.evaluationResult)||void 0===I?void 0:I.deviations)||{},Ee=[],Oe=Object.entries(Be).map(function(i){var n,t,o,s=i[0],a=i[1],d="".concat(Ae).concat(l.DEVIATION_BADGE_SEPARATOR).concat(s),r=q[d];if(!r)return null;var u=a[D],c=l.isMissingStr(u);if(c)u="";else if(!u)return null;Ee.push(u);var v=a[be],p=!1;v&&(p=Object.values(Be).map(function(e){return e[be]}).filter(Boolean).some(function(e){return e.length>v.length&&e.includes(v)}));var h=ye||l.isMissingStr(v)||p,_="".concat(A,".").concat(r),g="".concat(Ae).concat(l.DEVIATION_BADGE_SEPARATOR).concat(s).concat(l.DEVIATION_BADGE_SEPARATOR).concat(re).concat(l.DEVIATION_BADGE_SEPARATOR).concat(ue),f=(null==a?void 0:a.deviation_summary)?{deviation_summary:a.deviation_summary||(null===(n=R.evaluationResult)||void 0===n?void 0:n.deviation_summary),deviation_title:null===(t=R.evaluationResult)||void 0===t?void 0:t.deviation_title,evaluation_outputs:null===(o=R.evaluationResult)||void 0===o?void 0:o.evaluation_outputs}:null;return{id:d,actionId:g,label:_,highlight:u,side:C,style:oe,score:Ie,isConnected:V.has(g),isOrphan:h,isMissingClause:c,badgeRef:U(C,d),onClick:function(i){i.stopPropagation();var n=e.__assign(e.__assign({},ge),{title:(null==ae?void 0:ae.title)||(null==ge?void 0:ge.title)||""}),t=e.__assign(e.__assign({},fe),{title:(null==de?void 0:de.title)||(null==fe?void 0:fe.title)||""});H(i,n,h,t,g,oe)},onSummaryClick:function(e){e.stopPropagation(),K(e,g,h,f)}}}).filter(Boolean),Ce=Oe.some(function(e){return V.has(e.actionId)});if(!(Z||$||R.subsections&&0!==R.subsections.length))return null;var we=!M&&Z&&$,De=Ce&&oe?{borderRadius:"4px",outline:"2px solid ".concat(oe.badgeBorder),outlineOffset:"1px"}:{};return Z?i.jsx(t.Box,e.__assign({ref:te,sx:{mt:1,width:"100%",minWidth:0,position:"relative"}},{children:i.jsx(t.Box,e.__assign({sx:e.__assign({width:"100%"},De)},{children:i.jsxs(t.Accordion,e.__assign({disableGutters:!0,expanded:!ee&&ne,onChange:function(){if(!ee){if(ne){var i=String(W||""),n=i.includes(re)||i.includes(ue);n||V.forEach(function(e){(String(e).includes(re)||String(e).includes(ue))&&(n=!0)}),n&&(J(),Q(new Set),X([]),Y.current=[])}F(function(i){var n;return e.__assign(e.__assign({},i),((n={})[j]=!i[j],n))})}},sx:{mt:0,boxShadow:"none",border:ee?"1px dashed #E2E8F0":"1px solid #EEF2F7",borderRadius:"4px !important",bgcolor:"#FFFFFF",minWidth:0,"&:before":{display:"none"}}},{children:[i.jsx(t.AccordionSummary,e.__assign({expandIcon:ee?null:i.jsx(o.ChevronDown,{size:14}),sx:{minHeight:"32px","& .MuiAccordionSummary-content":{my:.5,display:"grid",alignItems:"center",minWidth:0,width:"100%"}}},{children:i.jsx(t.Typography,e.__assign({component:"div",sx:{fontSize:"11px",fontWeight:600,color:ee?"#94A3B8":"#19213D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0}},{children:ie||"Untitled Subsection"}))})),!ee&&i.jsxs(t.AccordionDetails,e.__assign({sx:{pt:0,pb:1,minWidth:0}},{children:[$&&i.jsx(s.MemoizedMarkdown,{content:R.content,sxStyles:z,deviationBadges:we?[]:Oe,maintainRelativeOrder:M,highlightBg:je,highlights:Ee}),(R.subsections||[]).map(function(t,o){return i.jsx(r,e.__assign({},n,{section:t,keyPath:"".concat(j,"-").concat(o),depth:E+1}),"".concat(j,"-").concat(o))})]}))]}))}))})):i.jsx(t.Box,e.__assign({ref:te,sx:{mt:0===E?1:.75,width:"100%",minWidth:0,position:"relative"}},{children:!ee&&i.jsxs(t.Box,e.__assign({sx:e.__assign({width:"100%"},De)},{children:[$&&i.jsx(s.MemoizedMarkdown,{content:R.content,sxStyles:z,deviationBadges:Oe,maintainRelativeOrder:M,highlightBg:je,highlights:Ee}),(R.subsections||[]).map(function(t,o){return i.jsx(r,e.__assign({},n,{section:t,keyPath:"".concat(j,"-").concat(o),depth:E+1}),"".concat(j,"-").concat(o))})]}))}))});exports.default=r;
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/jsx-runtime"),r=require("@mui/material"),n=require("react"),o=require("../CognitiveCompareConstants.js"),s=require("lucide-react"),t=require("react-markdown"),a=require("../CognitiveComparehelpers.js"),l=require("rehype-raw");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var d=c(n),p=c(t),u=c(l),g=d.default.memo(function(t){var l=t.content,c=t.sxStyles,d=t.deviationBadges,g=void 0===d?[]:d,x=t.highlights,h=void 0===x?[]:x,f=t.maintainRelativeOrder,_=void 0===f||f,v=t.highlightBg,m=n.useMemo(function(){return g.reduce(function(i,r){var n;return e.__assign(e.__assign({},i),((n={})[r.id]=r,n))},{})},[g]),b=n.useMemo(function(){return{mark:function(r){var n=r.children;return i.jsx("span",e.__assign({style:{backgroundColor:v,borderRadius:"2px"}},{children:n}))},span:function(n){var t,a,l,c,d,p,u=n.children,g=e.__rest(n,["children"]),x=g["data-badge-id"];if(!x)return i.jsx("span",e.__assign({},g,{children:u}));var h=m[x];return h?i.jsxs(r.Box,e.__assign({component:"span",sx:{position:"static",display:"inline"}},{children:[i.jsxs(r.Box,e.__assign({ref:h.badgeRef,sx:e.__assign(e.__assign({position:"absolute",zIndex:30,display:"inline-flex",alignItems:"stretch",fontSize:"10px",bgcolor:(null===(t=h.style)||void 0===t?void 0:t.badgeBg)||"#EEF2FF",color:(null===(a=h.style)||void 0===a?void 0:a.badgeText)||o.DEFAULT_DEVIAION_COLOR,border:"1px solid ".concat((null===(l=h.style)||void 0===l?void 0:l.badgeBorder)||"#C7D2FE"),borderRadius:"12px",fontWeight:600,whiteSpace:"nowrap",boxShadow:"0 1px 3px rgba(0,0,0,0.07)",overflow:"hidden"},"left"===h.side?{right:"-16px",transform:"translateY(-20%) translateX(calc(100% + 8px))"}:{left:"-16px",transform:"translateY(-20%) translateX(calc(-100% - 8px))"}),h.isConnected&&h.style&&{outline:"2px solid ".concat(h.style.badgeBorder),outlineOffset:"1px"})},{children:[i.jsxs(r.Box,e.__assign({onClick:function(e){e.stopPropagation(),h.onSummaryClick&&h.onSummaryClick(e)},sx:{display:"flex",alignItems:"center",px:1,py:.3,cursor:"pointer","&:hover":{bgcolor:"rgba(0,0,0,0.04)"}}},{children:[i.jsx(r.Box,e.__assign({component:"span",sx:{fontSize:"10px",fontWeight:700}},{children:h.label})),("left"===h.side||h.isOrphan)&&i.jsx(r.Box,e.__assign({component:"span",sx:{fontSize:"10px",pl:.5,ml:.5,borderLeft:"1px solid ".concat((null===(c=h.style)||void 0===c?void 0:c.badgeBorder)||"#C7D2FE")}},{children:null!=h.score&&"N/A"!==h.score&&"NA"!==h.score&&0!==h.score?"".concat(h.score):"N/A"===h.score||"NA"===h.score?"N/A":"Same"}))]})),("left"===h.side||h.isOrphan)&&i.jsx(r.Box,e.__assign({onClick:function(e){e.stopPropagation(),h.onClick&&h.onClick(e)},sx:{display:"flex",alignItems:"center",px:.5,borderLeft:"1px solid ".concat((null===(d=h.style)||void 0===d?void 0:d.badgeBorder)||"#C7D2FE"),cursor:"pointer","&:hover":{bgcolor:"rgba(0,0,0,0.06)"}}},{children:i.jsx(s.EllipsisVertical,{size:12,color:(null===(p=h.style)||void 0===p?void 0:p.badgeText)||"#3730A3"})}))]})),u]})):i.jsx("span",e.__assign({},g,{children:u}))}}},[m,_]),y=n.useMemo(function(){var i=l||"",r={},n=0,o=e.__spreadArray([],g,!0).sort(function(e,i){var r,n;return((null===(r=i.highlight)||void 0===r?void 0:r.length)||0)-((null===(n=e.highlight)||void 0===n?void 0:n.length)||0)});return o.forEach(function(e){if(e&&e.highlight){var o=e.highlight.replace(/\\(['’])/g,"$1").replace(/\\n/g,"\n");if(o){var s="__DEV_TOKEN_".concat(n++,"__");r[s]='<span data-badge-id="'.concat(e.id,'"><mark>').concat(o,"</mark></span>"),i=i.replace(o,s)}}}),Object.keys(r).forEach(function(e){i=i.split(e).join(r[e])}),i},[l,g,h]);return i.jsx(r.Typography,e.__assign({component:"div",sx:e.__assign(e.__assign({},c),{position:"relative",overflow:"visible","& p, & li, & ul, & ol":{position:"static",overflow:"visible"}})},{children:i.jsx(p.default,e.__assign({components:b,rehypePlugins:[u.default]},{children:a.safeStringify(y).replace(/\\n/g,"\n")}))}))},a.areMarkdownPropsEqual);exports.MemoizedMarkdown=g;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),r=require("react/jsx-runtime"),n=require("@mui/material"),i=require("react"),o=require("../CognitiveCompareConstants.js"),a=require("lucide-react"),t=require("react-markdown"),s=require("../CognitiveComparehelpers.js"),l=require("rehype-raw");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var d=c(i),p=c(t),g=c(l),u=d.default.memo(function(t){var l=t.content,c=t.sxStyles,d=t.deviationBadges,u=void 0===d?[]:d,f=t.highlights,_=void 0===f?[]:f,h=t.maintainRelativeOrder,x=void 0===h||h,v=t.highlightBg,m=i.useMemo(function(){return u.reduce(function(r,n){var i;return e.__assign(e.__assign({},r),((i={})[n.id]=n,i))},{})},[u]),b=i.useMemo(function(){return{mark:function(n){var i=n.children;return r.jsx("span",e.__assign({style:{backgroundColor:v,borderRadius:"2px"}},{children:i}))},span:function(i){var t,s,l,c,d,p,g=i.children,u=e.__rest(i,["children"]),f=u["data-badge-id"];if(!f)return r.jsx("span",e.__assign({},u,{children:g}));var _=m[f];return _?r.jsxs(n.Box,e.__assign({component:"span",sx:{position:"static",display:"inline"}},{children:[r.jsxs(n.Box,e.__assign({ref:_.badgeRef,sx:e.__assign(e.__assign({position:"absolute",zIndex:30,display:"inline-flex",alignItems:"stretch",fontSize:"10px",bgcolor:(null===(t=_.style)||void 0===t?void 0:t.badgeBg)||"#EEF2FF",color:(null===(s=_.style)||void 0===s?void 0:s.badgeText)||o.DEFAULT_DEVIAION_COLOR,border:"1px solid ".concat((null===(l=_.style)||void 0===l?void 0:l.badgeBorder)||"#C7D2FE"),borderRadius:"12px",fontWeight:600,whiteSpace:"nowrap",boxShadow:"0 1px 3px rgba(0,0,0,0.07)",overflow:"hidden"},"left"===_.side?{right:"-16px",transform:"translateY(-20%) translateX(calc(100% + 8px))"}:{left:"-16px",transform:"translateY(-20%) translateX(calc(-100% - 8px))"}),_.isConnected&&_.style&&{outline:"2px solid ".concat(_.style.badgeBorder),outlineOffset:"1px"})},{children:[r.jsxs(n.Box,e.__assign({onClick:function(e){e.stopPropagation(),_.onSummaryClick&&_.onSummaryClick(e)},sx:{display:"flex",alignItems:"center",px:1,py:.3,cursor:"pointer","&:hover":{bgcolor:"rgba(0,0,0,0.04)"}}},{children:[r.jsx(n.Box,e.__assign({component:"span",sx:{fontSize:"10px",fontWeight:700}},{children:_.label})),("left"===_.side||_.isOrphan)&&r.jsx(n.Box,e.__assign({component:"span",sx:{fontSize:"10px",pl:.5,ml:.5,borderLeft:"1px solid ".concat((null===(c=_.style)||void 0===c?void 0:c.badgeBorder)||"#C7D2FE")}},{children:null!=_.score&&"N/A"!==_.score&&"NA"!==_.score&&0!==_.score?"".concat(_.score):"N/A"===_.score||"NA"===_.score?"N/A":"Same"}))]})),("left"===_.side||_.isOrphan)&&r.jsx(n.Box,e.__assign({onClick:function(e){e.stopPropagation(),_.onClick&&_.onClick(e)},sx:{display:"flex",alignItems:"center",px:.5,borderLeft:"1px solid ".concat((null===(d=_.style)||void 0===d?void 0:d.badgeBorder)||"#C7D2FE"),cursor:"pointer","&:hover":{bgcolor:"rgba(0,0,0,0.06)"}}},{children:r.jsx(a.EllipsisVertical,{size:12,color:(null===(p=_.style)||void 0===p?void 0:p.badgeText)||"#3730A3"})}))]})),g]})):r.jsx("span",e.__assign({},u,{children:g}))}}},[m,x]),y=i.useMemo(function(){var r=function(e){return e?e.replace(/\\([''])/g,"$1").replace(/\\n/g,"\n").replace(/\r\n/g,"\n").split(/(\n{2,})/).map(function(e){return e.startsWith("\n")?e:e.replace(/\n/g," ")}).join(""):""},n=r(s.safeStringify(l||"")),i=e.__spreadArray([],u,!0).sort(function(e,r){var n,i;return((null===(n=r.highlight)||void 0===n?void 0:n.length)||0)-((null===(i=e.highlight)||void 0===i?void 0:i.length)||0)}),o={},a=0;i.forEach(function(e){if(e&&e.highlight){var i=r(e.highlight);if(i){var t="__DEV_TOKEN_".concat(a++,"__");o[t]='<span data-badge-id="'.concat(e.id,'"><mark>').concat(i,"</mark></span>"),n=n.replace(i,t);var s=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),l="__HIGHLIGHT_TOKEN_".concat(a++,"__");o[l]="<mark>".concat(i,"</mark>"),n=n.replace(new RegExp(s,"g"),l)}}});var t=new Set(i.map(function(e){return r(e.highlight)}).filter(Boolean));return _.forEach(function(e){if(e){var i=r(e);if(i&&!t.has(i)){var s=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),l="__PLAIN_TOKEN_".concat(a++,"__");o[l]="<mark>".concat(i,"</mark>"),n=n.replace(new RegExp(s,"g"),l)}}}),Object.keys(o).forEach(function(e){n=n.split(e).join(o[e])}),n},[l,u,_]);return r.jsx(n.Typography,e.__assign({component:"div",sx:e.__assign(e.__assign({},c),{position:"relative",overflow:"visible",whiteSpace:"pre-wrap","& p, & li, & ul, & ol":{position:"static",overflow:"visible",whiteSpace:"pre-wrap"}})},{children:r.jsx(p.default,e.__assign({components:b,rehypePlugins:[g.default]},{children:s.safeStringify(y).replace(/\\n/g,"\n")}))}))},s.areMarkdownPropsEqual);exports.MemoizedMarkdown=u;
2
2
  //# sourceMappingURL=memoizedMarkdown.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=i.useMemo(function(){var i,n,r,d;if(!o||0===Object.keys(o).length)return{activeProposed:{},activeVariants:[],parseError:"Tree data is required"};try{var a=o.nodes||o,u=[],v=[],c=o.base_root_id,f=o.input_index_map||{0:"left",1:"right"},p=o[c]||a[c];if(!p||!1===p.display_node)return{activeProposed:{title:"No Data",sections:[]},activeVariants:[],parseError:null};var _=function(i,n){var s,r,d,u=o[i]||a[i];if(!u||!1===u.display_node)return null;var v=t.getSideData(u,n,f),c=!1!==(null===(s=v.attributes)||void 0===s?void 0:s.display_title),p=!1!==(null===(r=v.attributes)||void 0===r?void 0:r.display_content),b=!!v.title.trim(),y=!!v.content.trim(),x=t.getRationale(u),m=(null===(d=null==l?void 0:l[i])||void 0===d?void 0:d.evaluation_result)||u.evaluation_result||null,g=[];u.next&&Object.values(u.next).forEach(function(e){var i=a[e];if(i&&!1!==i.display_node){var t=_(e,n);t&&g.push(t)}});var I=!(!b&&!y);return e.__assign(e.__assign({id:i,title:b?v.title:"",content:y?v.content:"",displayTitle:c,displayContent:p,subsections:g},I?x:{score:void 0,relation:"not_defined"}),{evaluationResult:m})};if(s){var b=function(i,n){var s,r,d,u,v,c,p,_,y,x,m,g,I,h,E,S,R,D,N,M,O;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],U=o[q]||a[q];if(U&&!1!==U.display_node){var w=t.getRationale(U),B=(null===(s=null==l?void 0:l[q])||void 0===s?void 0:s.evaluation_result)||U.evaluation_result||null,F=t.getSideData(U,"1",f),G=t.getSideData(U,"0",f),z=!1!==(null===(r=F.attributes)||void 0===r?void 0:r.display_title)&&F.title.trim()||!1!==(null===(d=F.attributes)||void 0===d?void 0:d.display_content)&&F.content.trim(),H=!1!==(null===(u=G.attributes)||void 0===u?void 0:u.display_title)&&G.title.trim()||!1!==(null===(v=G.attributes)||void 0===v?void 0:v.display_content)&&G.content.trim(),J=Number(null!==(p=null===(c=F.attributes)||void 0===c?void 0:c.display_index)&&void 0!==p?p:A--),K=Number(null!==(y=null===(_=G.attributes)||void 0===_?void 0:_.display_index)&&void 0!==y?y:C--),L=V[J]||e.__assign(e.__assign({id:q,title:!1!==(null===(x=F.attributes)||void 0===x?void 0:x.display_title)?F.title:"",content:!1!==(null===(m=F.attributes)||void 0===m?void 0:m.display_content)?F.content:"",subsections:[]},z?w:{score:void 0,relation:"not_defined"}),{refIndexes:[],selfIndex:J,evaluationResult:B,displayContent:null===(g=F.attributes)||void 0===g?void 0:g.display_content,displayTitle:null===(I=F.attributes)||void 0===I?void 0:I.display_title}),Q=j[K]||e.__assign(e.__assign({id:q,title:!1!==(null===(h=G.attributes)||void 0===h?void 0:h.display_title)?G.title:"",content:!1!==(null===(E=G.attributes)||void 0===E?void 0:E.display_content)?G.content:"",subsections:[]},H?w:{score:void 0,relation:"not_defined"}),{refIndexes:[],selfIndex:K,evaluationResult:B,displayContent:null===(S=G.attributes)||void 0===S?void 0:S.display_content,displayTitle:null===(R=G.attributes)||void 0===R?void 0:R.display_title});Number(J)>=0&&Number(K)>=0&&((null===(D=L.refIndexes)||void 0===D?void 0:D.includes(Number(K)))||null===(N=L.refIndexes)||void 0===N||N.push(Number(K)),(null===(M=Q.refIndexes)||void 0===M?void 0:M.includes(Number(J)))||null===(O=Q.refIndexes)||void 0===O||O.push(Number(J))),V[J]=L,j[K]=Q;var W=b(U.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}},y=b(p.next),x=y.refSections,m=y.baseSections;v=x,u=m}else p.next&&Object.values(p.next).forEach(function(e){var i=o[e]||a[e];i&&!1!==i.display_node&&(u.push(_(e,"0")||{id:e,title:"",content:"",subsections:[]}),v.push(_(e,"1")||{id:e,title:"",content:"",subsections:[]}))});return{activeProposed:{title:(null===(n=null===(i=p.comparison_inputs)||void 0===i?void 0:i[f[0]])||void 0===n?void 0:n.title)||"Uploaded Contract",description:p.decision_scope_description||"",sections:u},activeVariants:[{id:"tree-variant-1",title:(null===(d=null===(r=p.comparison_inputs)||void 0===r?void 0:r[f[1]])||void 0===d?void 0:d.title)||"Reference Template",similarity:0,sections:v,analysis:{rule_difference_comparison:{summary:{overall_score:0,overall_summary:p.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,l]),a=d.activeProposed,u=d.activeVariants,v=d.parseError,c=(null==u?void 0:u[0])||n,f=i.useMemo(function(){return(null==a?void 0:a.sections)||[]},[null==a?void 0:a.sections]),p=i.useMemo(function(){return c.sections||[]},[c.sections]),_=f.length>0||p.length>0,b=i.useMemo(function(){return r.fields.filter(function(e){var i=e.key;return(!_||"description"!==i)&&(t.hasValue(null==a?void 0:a[i])||t.hasValue(c[i]))})},[a,c,_,r.fields]),y=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&&!c){var h=(null==f?void 0:f.id)||"fallback_parent_".concat(d++);n[h]||(n[h]=[]),n[h].push(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)}for(var E=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),S=0;S<E;S++)v((null===(y=null==e?void 0:e.subsections)||void 0===y?void 0:y[S])||(null===(x=null==i?void 0:i.subsections)||void 0===x?void 0:x[S])||(null===(m=null==o?void 0:o.subsections)||void 0===m?void 0:m[S]),null===(g=null==i?void 0:i.subsections)||void 0===g?void 0:g[S],null===(I=null==o?void 0:o.subsections)||void 0===I?void 0:I[S],s,!1,f)};return f.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=p.find(function(e){return e.selfIndex===l})}else o=p[i];v(e,e,o,n,!0,e)}),p.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=f.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>=f.length&&(o=!0);o&&v(e,null,e,n,!0,e)}),{parentDeviationRecord:n,registry:l}},[f,p,s,o]),x=y.parentDeviationRecord,m=y.registry;return{activeProposed:a,activeVariants:u,existingRule:c,proposedSections:f,existingSections:p,visibleFields:b,parentDeviationRecord:x,deviationNumberRegistry:m,parseError:v}};
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=i.useMemo(function(){var i,n,r,d;if(!o||0===Object.keys(o).length)return{activeProposed:{},activeVariants:[],parseError:"Tree data is required"};try{var a=o.nodes||o,u=[],v=[],c=o.base_root_id,f=o.input_index_map||{0:"left",1:"right"},p=o[c]||a[c];if(!p||!1===p.display_node)return{activeProposed:{title:"No Data",sections:[]},activeVariants:[],parseError:null};var _=function(i,n){var s,r,d,u=o[i]||a[i];if(!u||!1===u.display_node)return null;var v=t.getSideData(u,n,f),c=!1!==(null===(s=v.attributes)||void 0===s?void 0:s.display_title),p=!1!==(null===(r=v.attributes)||void 0===r?void 0:r.display_content),b=!!v.title.trim(),y=!!v.content.trim(),x=t.getRationale(u),m=(null===(d=null==l?void 0:l[i])||void 0===d?void 0:d.evaluation_result)||u.evaluation_result||null,g=[];u.next&&Object.values(u.next).forEach(function(e){var i=a[e];if(i&&!1!==i.display_node){var t=_(e,n);t&&g.push(t)}});var I=!(!b&&!y);return e.__assign(e.__assign({id:i,title:b?v.title:"",content:y?v.content:"",displayTitle:c,displayContent:p,subsections:g},I?x:{score:void 0,relation:"not_defined"}),{evaluationResult:m})};if(s){var b=function(i,n){var s,r,d,u,v,c,p,_,y,x,m,g,I,h,E,S,R,D,N,M,O;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],U=o[q]||a[q];if(U&&!1!==U.display_node){var w=t.getRationale(U),B=(null===(s=null==l?void 0:l[q])||void 0===s?void 0:s.evaluation_result)||U.evaluation_result||null,F=t.getSideData(U,"1",f),G=t.getSideData(U,"0",f),z=!1!==(null===(r=F.attributes)||void 0===r?void 0:r.display_title)&&F.title.trim()||!1!==(null===(d=F.attributes)||void 0===d?void 0:d.display_content)&&F.content.trim(),H=!1!==(null===(u=G.attributes)||void 0===u?void 0:u.display_title)&&G.title.trim()||!1!==(null===(v=G.attributes)||void 0===v?void 0:v.display_content)&&G.content.trim(),J=Number(null!==(p=null===(c=F.attributes)||void 0===c?void 0:c.display_index)&&void 0!==p?p:A--),K=Number(null!==(y=null===(_=G.attributes)||void 0===_?void 0:_.display_index)&&void 0!==y?y:C--),L=V[J]||e.__assign(e.__assign({id:q,title:!1!==(null===(x=F.attributes)||void 0===x?void 0:x.display_title)?F.title:"",content:!1!==(null===(m=F.attributes)||void 0===m?void 0:m.display_content)?F.content:"",subsections:[]},z?w:{score:void 0,relation:"not_defined"}),{refIndexes:[],selfIndex:J,evaluationResult:B,displayContent:null===(g=F.attributes)||void 0===g?void 0:g.display_content,displayTitle:null===(I=F.attributes)||void 0===I?void 0:I.display_title}),Q=j[K]||e.__assign(e.__assign({id:q,title:!1!==(null===(h=G.attributes)||void 0===h?void 0:h.display_title)?G.title:"",content:!1!==(null===(E=G.attributes)||void 0===E?void 0:E.display_content)?G.content:"",subsections:[]},H?w:{score:void 0,relation:"not_defined"}),{refIndexes:[],selfIndex:K,evaluationResult:B,displayContent:null===(S=G.attributes)||void 0===S?void 0:S.display_content,displayTitle:null===(R=G.attributes)||void 0===R?void 0:R.display_title});Number(J)>=0&&Number(K)>=0&&((null===(D=L.refIndexes)||void 0===D?void 0:D.includes(Number(K)))||null===(N=L.refIndexes)||void 0===N||N.push(Number(K)),(null===(M=Q.refIndexes)||void 0===M?void 0:M.includes(Number(J)))||null===(O=Q.refIndexes)||void 0===O||O.push(Number(J))),V[J]=L,j[K]=Q;var W=b(U.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}},y=b(p.next),x=y.refSections,m=y.baseSections;v=x,u=m}else p.next&&Object.values(p.next).forEach(function(e){var i=o[e]||a[e];i&&!1!==i.display_node&&(u.push(_(e,"0")||{id:e,title:"",content:"",subsections:[]}),v.push(_(e,"1")||{id:e,title:"",content:"",subsections:[]}))});return{activeProposed:{title:(null===(n=null===(i=p.comparison_inputs)||void 0===i?void 0:i[f[0]])||void 0===n?void 0:n.title)||"Uploaded Contract",description:p.decision_scope_description||"",sections:u},activeVariants:[{id:"tree-variant-1",title:(null===(d=null===(r=p.comparison_inputs)||void 0===r?void 0:r[f[1]])||void 0===d?void 0:d.title)||"Reference Template",similarity:0,sections:v,analysis:{rule_difference_comparison:{summary:{overall_score:0,overall_summary:p.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]),a=d.activeProposed,u=d.activeVariants,v=d.parseError,c=(null==u?void 0:u[0])||n,f=i.useMemo(function(){return(null==a?void 0:a.sections)||[]},[null==a?void 0:a.sections]),p=i.useMemo(function(){return c.sections||[]},[c.sections]),_=f.length>0||p.length>0,b=i.useMemo(function(){return r.fields.filter(function(e){var i=e.key;return(!_||"description"!==i)&&(t.hasValue(null==a?void 0:a[i])||t.hasValue(c[i]))})},[a,c,_,r.fields]),y=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&&!c){var h=(null==f?void 0:f.id)||"fallback_parent_".concat(d++);n[h]||(n[h]=[]),n[h].push(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)}for(var E=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),S=0;S<E;S++)v((null===(y=null==e?void 0:e.subsections)||void 0===y?void 0:y[S])||(null===(x=null==i?void 0:i.subsections)||void 0===x?void 0:x[S])||(null===(m=null==o?void 0:o.subsections)||void 0===m?void 0:m[S]),null===(g=null==i?void 0:i.subsections)||void 0===g?void 0:g[S],null===(I=null==o?void 0:o.subsections)||void 0===I?void 0:I[S],s,!1,f)};return f.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=p.find(function(e){return e.selfIndex===l})}else o=p[i];v(e,e,o,n,!0,e)}),p.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=f.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>=f.length&&(o=!0);o&&v(e,null,e,n,!0,e)}),{parentDeviationRecord:n,registry:l}},[f,p,s,o]),x=y.parentDeviationRecord,m=y.registry;return{activeProposed:a,activeVariants:u,existingRule:c,proposedSections:f,existingSections:p,visibleFields:b,parentDeviationRecord:x,deviationNumberRegistry:m,parseError:v}};
2
2
  //# sourceMappingURL=useCompareData.js.map
@@ -1,2 +1,2 @@
1
- import{__assign as e}from"tslib";import{jsxs as n,jsx as t}from"react/jsx-runtime";import{useState as i,useRef as o,useMemo as r,useEffect as l,useCallback as c}from"react";import{Box as u,Snackbar as d,Alert as a,Tooltip as s,Typography as v}from"@mui/material";import{ChevronDown as p,EllipsisVertical as h}from"lucide-react";import{ButtonCognitiveIcon as f}from"../../assests/svg/ButtonCognitiveIcon.js";import g from"./OverlayComponent.js";import{safeStringify as x,extractDeviationScore as m,generateColorPalette as y,DEVIATION_BADGE_SEPARATOR as b,hasValue as S,getBentArrowPath as R,smoothScrollTo as C}from"./CognitiveComparehelpers.js";import{SHARED_MARKDOWN_STYLES as w,DEFAULT_FIELD_CONFIG as I,DEFAULT_COMPARISON_CONFIG as B}from"./CognitiveCompareConfig.js";export{SHARED_MARKDOWN_STYLES}from"./CognitiveCompareConfig.js";import{DEFAULT_DEVIAION_COLOR as T,DEFAULT_COMPONENT_HEADER_TEXT as F}from"./CognitiveCompareConstants.js";import k from"./CognitivePopup.js";import E from"./MoreFunctionsPopup.js";import M from"./LoaderComponent.js";import D from"./components/ThreeDotsLoader.js";import{useCognitiveTreeData as _}from"./hooks/useCompareData.js";import{useComparePopups as H}from"./hooks/useComparePopups.js";import{useSectionRefs as A}from"./hooks/useSectionRefs.js";import{useAccordionState as L}from"./hooks/useAccordionState.js";import{useDeviationNavigation as O}from"./hooks/useDeviationNavigation.js";import P from"./components/CompareHeader.js";import j from"./components/SectionAccordion.js";import N from"./components/SubSectionAccordion.js";import z from"./components/CognitiveSummaryPopup.js";var W=function(W){var Y,K,X,V,q,J,U,G,Q,Z,$,ee,ne,te,ie,oe=W.componentHeaderText,re=void 0===oe?F:oe,le=W.treeData,ce=W.comparisonConfig,ue=W.leftColumnTitleText,de=W.rightColumnTitleText,ae=W.markdownStyles,se=W.displayConfig,ve=void 0===se?{isHeaderVisible:!0,isToggleVisible:!0,maintainRelativeOrder:!1,isLoading:!0}:se,pe=W.popupConfig,he=W.deviationData,fe=void 0===he?{}:he,ge=W.deviationNodeIdToView,xe=i(ve.maintainRelativeOrder),me=xe[0],ye=xe[1],be=i(!1),Se=be[0],Re=be[1],Ce=i(!1),we=Ce[0],Ie=Ce[1],Be=i(null),Te=Be[0],Fe=Be[1],ke=i(!1),Ee=ke[0],Me=ke[1],De=i(!1),_e=De[0],He=De[1],Ae=i(null),Le=Ae[0],Oe=Ae[1],Pe=o(!1),je=i(new Set),Ne=je[0],ze=je[1],We=i([]),Ye=We[0],Ke=We[1],Xe=o(null),Ve=o(!1),qe=o(null),Je=o({}),Ue=o([]),Ge=o(!1),Qe=o(!1),Ze=o(null),$e=o(function(){}),en=r(function(){return(null==le?void 0:le.cognitive_decisioning)||{}},[le]),nn=i({width:0,height:0}),tn=nn[0],on=nn[1],rn=r(function(){return e(e({},w),ae)},[ae]),ln=o(null),cn=o(null),un=o(null),dn=o(null),an=o(null),sn=o(null),vn=o(null),pn=o(null),hn=o(!1),fn=H(ln),gn=fn.cognitivePopup,xn=fn.setCognitivePopup,mn=fn.moreFunctions,yn=fn.setMoreFunctions,bn=fn.position,Sn=fn.setPosition,Rn=fn.activeBadgeId,Cn=fn.summaryPopup,wn=fn.setSummaryPopup,In=fn.closeSummaryPopup,Bn=fn.setActiveBadgeId,Tn=fn.popupRef,Fn=fn.closeCognitivePopup,kn=fn.closeMoreFunctionsPopup,En=r(function(){var e,n,t,i,o,r,l;return{fields:null!==(e=null==ce?void 0:ce.fields)&&void 0!==e?e:I,thresholds:{high:null!==(t=null===(n=null==ce?void 0:ce.thresholds)||void 0===n?void 0:n.high)&&void 0!==t?t:B.thresholds.high,medium:null!==(o=null===(i=null==ce?void 0:ce.thresholds)||void 0===i?void 0:i.medium)&&void 0!==o?o:B.thresholds.medium,exact:null!==(l=null===(r=null==ce?void 0:ce.thresholds)||void 0===r?void 0:r.exact)&&void 0!==l?l:B.thresholds.exact}}},[ce]),Mn=i(null),Dn=Mn[0];Mn[1];var _n=null===(X=null===(Y=null==le?void 0:le.documents)||void 0===Y?void 0:Y[null===(K=null==le?void 0:le.input_index_map)||void 0===K?void 0:K[0]])||void 0===X?void 0:X.title,Hn=null===(J=null===(V=null==le?void 0:le.documents)||void 0===V?void 0:V[null===(q=null==le?void 0:le.input_index_map)||void 0===q?void 0:q[1]])||void 0===J?void 0:J.title,An=x(ue||_n||"Uploaded Contract"),Ln=x(de||Hn||"Reference Template"),On=_(le,me,fe,En),Pn=On.activeProposed,jn=On.existingRule,Nn=On.proposedSections,zn=On.existingSections,Wn=On.visibleFields,Yn=On.parentDeviationRecord,Kn=On.deviationNumberRegistry,Xn=On.parseError;l(function(){Xn&&Fe("Failed to load comparison: ".concat(Xn))},[Xn]);var Vn=Nn.length>0||zn.length>0,qn=A(Wn.map(function(e){return e.key}),Math.max(Nn.length,zn.length)),Jn=qn.leftRefs,Un=qn.rightRefs,Gn=qn.sectionLeftRefs,Qn=qn.sectionRightRefs,Zn=qn.lhsBadgeRefs,$n=qn.rhsBadgeRefs,et=qn.sectionRightRowRefs,nt=qn.subSectionLeftRefs,tt=qn.subSectionRightRefs,it=qn.sectionRowRefs,ot=qn.getSectionRowRef,rt=qn.getSubSectionRef,lt=qn.getBadgeRef,ct=jn.analysis,ut=x(null===(G=null===(U=null==ct?void 0:ct.rule_difference_comparison)||void 0===U?void 0:U.summary)||void 0===G?void 0:G.overall_summary),dt=!!ut.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),at=null!==(Q=null==le?void 0:le.base_root_id)&&void 0!==Q?Q:"-1";null==le||le[at];var st=(null===(Z=null==fe?void 0:fe[at])||void 0===Z?void 0:Z.evaluation_result)||(null===(ee=null===($=null==le?void 0:le.nodes)||void 0===$?void 0:$[at])||void 0===ee?void 0:ee.evaluation_result)||null,vt=m(st),pt=y(null!==(ie=null===(te=null===(ne=null==st?void 0:st.evaluation_outputs)||void 0===ne?void 0:ne.metadata)||void 0===te?void 0:te.label_color)&&void 0!==ie?ie:""),ht=c(function(){var e,n,t,i;Me(!1),Qe.current=!1;var o=Ze.current,r=Tt.current;if(null!==o)if("string"==typeof o&&o.includes(b)){var l=o.split(b);(c=null===(e=nt.current[l[2]])||void 0===e?void 0:e.current)&&(c.style.paddingTop="0px")}else{var c;(c=null===(n=Gn.current[o])||void 0===n?void 0:n.current)&&(c.style.paddingTop="0px")}if(null!==r)if("string"==typeof r&&r.includes(b)){l=r.split(b);(u=null===(t=tt.current[l[3]])||void 0===t?void 0:t.current)&&(u.style.paddingTop="0px")}else{var u;(u=null===(i=Qn.current[r])||void 0===i?void 0:i.current)&&(u.style.paddingTop="0px")}Oe(null),Ze.current=null,Tt.current=null,He(!1),Ie(!1),dn.current&&(dn.current.style.height="0px"),an.current&&(an.current.style.height="0px"),sn.current&&(sn.current.style.height="0px"),vn.current&&(vn.current.style.height="0px")},[]),ft=L({maintainRelativeOrder:!!me,proposedSections:Nn,existingSections:zn,activeSideBySideSection:Le,connectedSections:Ne,resetSideBySide:ht,setConnectedSections:ze,setConnectedLines:Ke,cachedConnectedPositions:Ue,svgContainerRef:Xe,isAnimatingRef:Ve,animationTimerRef:qe,calculateLinesRef:$e,sectionLeftRefs:Gn,sectionRightRefs:Qn,subSectionLeftRefs:nt,subSectionRightRefs:tt}),gt=ft.expandedSections,xt=ft.expandedSubSections,mt=ft.setExpandedSubSections,yt=ft.toggleSection,bt=c(function(e,n,t,i,o,r,l){var c,u,d,a=x(null==n?void 0:n.id)||x(null==t?void 0:t.id)||"",s=(a?en[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=it.current[i])||void 0===c?void 0:c.current)&&void 0!==u?u:null;return{isLoading:null!==(d=null==ve?void 0:ve.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==le?void 0:le.documents,input_index_map:null==le?void 0:le.input_index_map},deviationData:(null==n?void 0:n.evaluationResult)||(null==t?void 0:t.evaluationResult)||null,isOrphan:!!o}},[en,le]),St=c(function(e){kn(),Sn(null),xn(e)},[kn]),Rt=function(e,n,t,i,o,r){e.stopPropagation(),mn.open&&mn.sectionIdx===o?kn():(Fn(),yn(bt(e.currentTarget,n,i,o,t,r)))},Ct=c(function(){null!==mn.sectionIdx&&mn.anchorEl?St(e(e({},mn),{open:!0})):kn()},[mn,kn,St]),wt=c(function(){var e=mn.sectionIdx,n=mn.isOrphan,t=null!==e&&Ne.has(e);kn(),null!==e&&(n?Fe("No counterpart exists to connect to."):(Qe.current&&ht(),t&&(Ke([]),Ue.current=[]),ze(function(n){return n.has(e)?new Set:new Set([e])})))},[mn.sectionIdx,kn,ht]),It=o(null),Bt=o(null),Tt=o(null),Ft=o(null),kt=o(null),Et=o(null),Mt=i([]),Dt=Mt[0],_t=Mt[1];o(null);var Ht=i(null),At=Ht[0],Lt=Ht[1];l(function(){if(Dn){var e=En.fields.find(function(e){return e.analysisKey===Dn||e.key===Dn});if(e){var n=Jn.current[e.key]||Un.current[e.key];(null==n?void 0:n.current)&&setTimeout(function(){return n.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[Dn,En.fields]);var Ot=c(function(e){var n,t,i,o,r,l,c,u,d,a=null===(n=null==ct?void 0:ct.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}},[ct]),Pt=c(function(n){var t,i,o,r,l,c,u,d=Nn[n],a=zn[n],s=(null==d?void 0:d.relation)&&"not_defined"!==d.relation,v=(null==a?void 0:a.relation)&&"not_defined"!==a.relation;x(null==d?void 0:d.id)||x(null==a?void 0:a.id);var p=!(!(null==d?void 0:d.cognitiveData)&&!(null==a?void 0:a.cognitiveData));if(!s&&!v&&!p)return e(e({},y(T)),{label:"Not Defined"});var h=null!==(i=null!==(t=null==d?void 0:d.evaluationResult)&&void 0!==t?t:null==a?void 0:a.evaluationResult)&&void 0!==i?i:null,f=null===(o=null==h?void 0:h.evaluation_outputs)||void 0===o?void 0:o.output_value,g=null!==(c=null===(l=null===(r=null==h?void 0:h.evaluation_outputs)||void 0===r?void 0:r.metadata)||void 0===l?void 0:l.label_color)&&void 0!==c?c:T;return e(e({},y(g)),null!=h?{label:null!==(u=f)&&void 0!==u?u:""}:{label:null})},[Nn,zn,en,En,Ot]),jt=c(function(n){for(var t,i,o,r,l,c,u,d,a,s=n.split("-").map(Number),v=Nn[s[0]],p=zn[s[0]],h=1;h<s.length;h++)(null==v?void 0:v.subsections)&&(v=v.subsections[s[h]]),(null==p?void 0:p.subsections)&&(p=p.subsections[s[h]]);if(!v&&!p)return null;var f=(null==v?void 0:v.relation)&&"not_defined"!==v.relation,g=(null==p?void 0:p.relation)&&"not_defined"!==p.relation,m=x(null==v?void 0:v.id)||x(null==p?void 0:p.id)||"",b=!(!(null==v?void 0:v.cognitiveData)&&!(null==p?void 0:p.cognitiveData));if(!f&&!g&&!b)return e(e({},y(T)),{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||m&&(null===(o=en[m])||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:T;return e(e({},y(C)),null!=S?{label:null!=R?R:""}:{label:null})},[Nn,zn,en,En]),Nt=c(function(){var e,n,t,i,o,r,l,c,u,d,a,s,v,p,h,f,g,x,m,y,C,w;if(!hn.current&&!Ve.current){hn.current=!0;try{if(!It.current)return;var I=function(e){var n=e.split("-"),t=n[0];if(!gt[t]&&!1===me)return!1;if(me&&!gt["left-".concat(t)]&&!gt["right-".concat(t)]&&!gt[t])return!1;for(var i=t,o=1;o<n.length-1;o++)if(i+="-".concat(n[o]),!xt[i])return!1;return!0},B=It.current.getBoundingClientRect();on({width:B.width,height:B.height});var T=[];if(Wn.forEach(function(e){var n,t,i=e.key,o=null===(n=Jn.current[i])||void 0===n?void 0:n.current,r=null===(t=Un.current[i])||void 0===t?void 0:t.current;o&&r&&(o.style.height="auto",r.style.height="auto",o.style.minHeight="0px",r.style.minHeight="0px")}),!Ve.current){for(var F=0;F<Math.max(Nn.length,zn.length);F++){var k=null===(e=Gn.current[F])||void 0===e?void 0:e.current,E=null===(n=Qn.current[F])||void 0===n?void 0:n.current;k&&(k.style.height="auto",k.style.minHeight="0px"),E&&(E.style.height="auto",E.style.minHeight="0px")}me||Object.keys(nt.current).forEach(function(e){var n,t;if(I(e)){var i=null===(n=nt.current[e])||void 0===n?void 0:n.current,o=null===(t=tt.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={};Wn.forEach(function(e){var n,t,i=e.key,o=null===(n=Jn.current[i])||void 0===n?void 0:n.current,r=null===(t=Un.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:{}},_={};if(!Ve.current)if(me){if(Ee&&null!==Le)if("number"==typeof Le){var H=Le,A=Nn[H],L=null===(o=Gn.current[H])||void 0===o?void 0:o.current;L&&A&&(A.refIndexes||[]).forEach(function(e){var n,t=zn.findIndex(function(n){return n.selfIndex===e}),i=null===(n=Qn.current[t])||void 0===n?void 0:n.current;if(i&&(gt["left-".concat(H)]||gt["right-".concat(t)])){var o=Math.max(L.getBoundingClientRect().height,i.getBoundingClientRect().height);D.left[H]=Math.max(D.left[H]||0,o),D.right[t]=Math.max(D.right[t]||0,o)}})}else{var O=Le.split(b)[2];if(O){k=null===(r=nt.current[O])||void 0===r?void 0:r.current,E=null===(l=tt.current[O])||void 0===l?void 0:l.current;if(k&&E){P=Math.max(k.getBoundingClientRect().height,E.getBoundingClientRect().height);_[O]=Math.max(_[O]||0,P)}}}}else{Object.keys(nt.current).forEach(function(e){var n,t;if(I(e)){var i=null===(n=nt.current[e])||void 0===n?void 0:n.current,o=null===(t=tt.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);_[e]=c,i.style.minHeight="".concat(c,"px"),o.style.minHeight="".concat(c,"px")}}});for(F=0;F<Math.min(Nn.length,zn.length);F++){var k=null===(t=Gn.current[F])||void 0===t?void 0:t.current,E=null===(i=Qn.current[F])||void 0===i?void 0:i.current;if(k&&E){var P=Math.max(k.getBoundingClientRect().height,E.getBoundingClientRect().height);D.left[F]=P,D.right[F]=P}}}if(Wn.forEach(function(e){var n,t,i=e.key,o=null===(n=Jn.current[i])||void 0===n?void 0:n.current,r=null===(t=Un.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")}}),Ve.current||(Object.entries(D.left).forEach(function(e){var n,t=e[0],i=e[1],o=null===(n=Gn.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=Qn.current[Number(t)])||void 0===n?void 0:n.current;o&&(o.style.minHeight="".concat(i,"px"))}),me||Object.keys(_).forEach(function(e){var n,t,i=null===(n=nt.current[e])||void 0===n?void 0:n.current,o=null===(t=tt.current[e])||void 0===t?void 0:t.current;if(i&&o&&_[e]){var r=_[e];i.style.minHeight="".concat(r,"px"),o.style.minHeight="".concat(r,"px")}})),me)Nn.forEach(function(e,n){var t;(null===(t=Gn.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=zn.findIndex(function(n){return n.selfIndex===e});if(-1!==v){var p=null===(t=Zn.current[n])||void 0===t?void 0:t.current,h=null===(i=$n.current[v])||void 0===i?void 0:i.current;if(p&&h){var f=p.getBoundingClientRect(),g=h.getBoundingClientRect(),x=f.right-B.left,m=g.left-B.left,y=f.top+f.height/2-B.top,b=g.top+g.height/2-B.top;if(Ee&&Le===n){var S=null!==(r=null===(o=pn.current)||void 0===o?void 0:o.getBoundingClientRect().top)&&void 0!==r?r:0,R=null!==(c=null===(l=un.current)||void 0===l?void 0:l.getBoundingClientRect().top)&&void 0!==c?c:0,C=S+(null!==(d=null===(u=pn.current)||void 0===u?void 0:u.clientHeight)&&void 0!==d?d:1/0),w=R+(null!==(s=null===(a=un.current)||void 0===a?void 0:a.clientHeight)&&void 0!==s?s:1/0),I=f.top+f.height/2,F=function(e,n,t){return Math.max(n,Math.min(t,e))};y=F(I,S,C)-B.top,b=F(I,R,w)-B.top}var k=Pt(n);k&&T.push({id:"line-".concat(n,"-").concat(v),x1:x,y1:y,x2:m,y2:b,style:k,sectionIdx:n,targetRightIdx:v})}}})});else{for(F=0;F<Math.min(Nn.length,zn.length);F++){var j=null===(c=Gn.current[F])||void 0===c?void 0:c.current,N=null===(u=Qn.current[F])||void 0===u?void 0:u.current;if(j&&N){var z=j.getBoundingClientRect(),W=N.getBoundingClientRect(),Y=Math.max(z.top,W.top)+18-B.top,K=(null===(d=zn[F])||void 0===d?void 0:d.id)||"sec-".concat(F);(Z=Pt(F))&&T.push({id:K,x1:z.right-B.left,y1:Y,x2:W.left-B.left,y2:Y,style:Z,sectionIdx:F,hasCognitive:!!((null===(a=Nn[F])||void 0===a?void 0:a.cognitiveData)||(null===(s=zn[F])||void 0===s?void 0:s.cognitiveData)||K&&en[K]),isSubSection:!1})}}Object.keys(nt.current).forEach(function(e){var n,t,i,o,r,l;if(I(e)){var c=null===(n=nt.current[e])||void 0===n?void 0:n.current,u=null===(t=tt.current[e])||void 0===t?void 0:t.current;if(c&&u){for(var d=e.split("-").map(Number),a=Nn[d[0]],s=zn[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)&&S(a.title)),h=!!a&&((null===(o=a.displayContent)||void 0===o||o)&&S(a.content)),f=!!s&&((null===(r=s.displayTitle)||void 0===r||r)&&S(s.title)),g=!!s&&((null===(l=s.displayContent)||void 0===l||l)&&S(s.content));if(p&&h||f&&g){var x=c.getBoundingClientRect(),m=u.getBoundingClientRect(),y=Math.max(x.top,m.top)+16-B.top,b=jt(e);b&&"Not Defined"!==b.label&&T.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(Ee&&"string"==typeof Le&&Le.includes(b)){var X=Le.split(b),V=X[0],q=X[1],J=X[2],U=(X[3],"".concat(V).concat(b).concat(q)),G=null===(v=Zn.current[U])||void 0===v?void 0:v.current,Q=null===(p=$n.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(me){var re=null!==(f=null===(h=pn.current)||void 0===h?void 0:h.getBoundingClientRect().top)&&void 0!==f?f:0,le=null!==(x=null===(g=un.current)||void 0===g?void 0:g.getBoundingClientRect().top)&&void 0!==x?x:0,ce=re+(null!==(y=null===(m=pn.current)||void 0===m?void 0:m.clientHeight)&&void 0!==y?y:1/0),ue=le+(null!==(w=null===(C=un.current)||void 0===C?void 0:C.clientHeight)&&void 0!==w?w: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=jt(J))&&T.push({id:"line-subsec-".concat(U),x1:ne,y1:ie,x2:te,y2:oe,style:Z,sectionIdx:Number(J.split("-")[0]),isSubSection:!0,subSectionKeyPath:Le})}}if(_t(T),kt.current&&Et.current){var ae=kt.current.getBoundingClientRect(),se=Et.current.getBoundingClientRect(),ve=(ae.top+ae.height/2-B.top+se.top+se.height/2-B.top)/2;Lt({x1:ae.right-B.left,x2:se.left-B.left,y:ve})}else Lt(null);if(Ne.size>0){var pe=[],he=pn.current,fe=un.current;if(he&&fe){var ge=[],xe=he.getBoundingClientRect().top,ye=fe.getBoundingClientRect().top,be=xe+he.clientHeight,Se=ye+fe.clientHeight,Re=he.scrollTop,Ce=fe.scrollTop,we=B.top,Ie=function(e,n,t){return Math.max(n,Math.min(t,e))};Ne.forEach(function(e){var n,t,i,o,r;if("string"==typeof e&&e.includes(b)){var l=e.split(b),c=l[0],u=l[1],d=l[2],a=(l[3],"".concat(c).concat(b).concat(u)),s=null===(n=Zn.current[a])||void 0===n?void 0:n.current,v=null===(t=$n.current[a])||void 0===t?void 0:t.current;if(!s||!v)return;var p=s.getBoundingClientRect(),h=v.getBoundingClientRect(),f=jt(d),g=(A=p.right-B.left)+.5*((L=h.left-B.left-0)-A),x=p.top+p.height/2,m=h.top+h.height/2,y=x-xe+Re,S=m-ye+Ce,C="conn-subsec-".concat(a);ge.push({lhsScrollY:y,rhsScrollY:S,x1:A,x2:L,containerTop:we,leftIdx:e,rhsArrayIdx:e,styleColor:(null==f?void 0:f.badgeBorder)||"#6366F1",styleId:C});var w=Ie(x,xe,be),I=Ie(m,ye,Se),T=w-we,F=I-we,k=m>=ye-4&&m<=Se+4,E="";E=(O=x>=xe-4&&x<=be+4)&&k?R(A,T,L,F):O&&!k?"M ".concat(A,",").concat(T," L ").concat(g,",").concat(T," L ").concat(g,",").concat(F):!O&&k?"M ".concat(g,",").concat(T," L ").concat(g,",").concat(F," L ").concat(L,",").concat(F):"M ".concat(g,",").concat(T," L ").concat(g,",").concat(F),pe.push({id:C,pathD:E,style:f,leftIdx:e,rhsArrayIdx:e})}else if(me){var M=e,D=Nn[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=zn.findIndex(function(n){return n.selfIndex===e});if(-1!==i){var o=null===(n=Zn.current[M])||void 0===n?void 0:n.current,r=null===(t=$n.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=o.getBoundingClientRect(),c=r.getBoundingClientRect(),u=Pt(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,h=v-xe+Re,f=p-ye+Ce,g="conn-".concat(M,"-").concat(i);ge.push({lhsScrollY:h,rhsScrollY:f,x1:d,x2:a,containerTop:we,leftIdx:M,rhsArrayIdx:i,styleColor:(null==u?void 0:u.badgeBorder)||"#6366F1",styleId:g});var x=Ie(v,xe,be),m=Ie(p,ye,Se),y=x-we,b=m-we,S=v>=xe-4&&v<=be+4,C=p>=ye-4&&p<=Se+4,w="";w=S&&C?R(d,y,a,b):S&&!C?"M ".concat(d,",").concat(y," L ").concat(s,",").concat(y," L ").concat(s,",").concat(b):!S&&C?"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:g,pathD:w,style:u,leftIdx:M,rhsArrayIdx:i})}}})}else{var _=e,H=_;s=null===(i=Zn.current[_])||void 0===i?void 0:i.current,v=null===(o=$n.current[H])||void 0===o?void 0:o.current;if(!s||!v)return;var A,L;p=s.getBoundingClientRect(),h=v.getBoundingClientRect(),f=Pt(_),g=(A=p.right-B.left)+.5*((L=h.left-B.left-0)-A),x=p.top+p.height/2,m=h.top+h.height/2,y=x-xe+Re,S=m-ye+Ce,C="conn-".concat(_,"-").concat(H);ge.push({lhsScrollY:y,rhsScrollY:S,x1:A,x2:L,containerTop:we,leftIdx:_,rhsArrayIdx:H,styleColor:(null==f?void 0:f.badgeBorder)||"#6366F1",styleId:C});var O;w=Ie(x,xe,be),I=Ie(m,ye,Se),T=w-we,F=I-we,k=m>=ye-4&&m<=Se+4,E="";E=(O=x>=xe-4&&x<=be+4)&&k?R(A,T,L,F):O&&!k?"M ".concat(A,",").concat(T," L ").concat(g,",").concat(T," L ").concat(g,",").concat(F):!O&&k?"M ".concat(g,",").concat(T," L ").concat(g,",").concat(F," L ").concat(L,",").concat(F):"M ".concat(g,",").concat(T," L ").concat(g,",").concat(F),pe.push({id:C,pathD:E,style:f,leftIdx:_,rhsArrayIdx:H})}}),Ue.current=ge}Ke(pe)}else Ke([]),Ue.current=[]}catch(e){console.error("Line render safe fail: ",e)}finally{hn.current=!1}}},[Wn,Nn,zn,en,En,Ot,Pt,me,Ee,Le,Ne,gt,xt]),zt=c(function(){var e,n,t,i,o,r,l,c,u,d,a,s,v,p,h=Ue.current;if(h.length&&!Ve.current){var f=null!==(n=null===(e=pn.current)||void 0===e?void 0:e.scrollTop)&&void 0!==n?n:0,g=null!==(i=null===(t=un.current)||void 0===t?void 0:t.scrollTop)&&void 0!==i?i:0,x=null!==(r=null===(o=pn.current)||void 0===o?void 0:o.clientHeight)&&void 0!==r?r:1/0,m=null!==(c=null===(l=un.current)||void 0===l?void 0:l.clientHeight)&&void 0!==c?c:1/0,y=null!==(d=null===(u=pn.current)||void 0===u?void 0:u.getBoundingClientRect().top)&&void 0!==d?d:0,b=null!==(s=null===(a=un.current)||void 0===a?void 0:a.getBoundingClientRect().top)&&void 0!==s?s:0,S=y+x,C=b+m,w=null!==(p=null===(v=It.current)||void 0===v?void 0:v.getBoundingClientRect().top)&&void 0!==p?p:0,I=function(e,n,t){return Math.max(n,Math.min(t,e))};h.forEach(function(e){var n=e.lhsScrollY-f+y,t=e.rhsScrollY-g+b,i=Je.current[e.styleId+"-stroke"],o=Je.current[e.styleId+"-bg"];if(i||o){var r,l=I(n,y,S),c=I(t,b,C),u=l-w,d=c-w,a=n>=y-4&&n<=S+4,s=t>=b-4&&t<=C+4,v=e.x1+.5*(e.x2-e.x1);r=a&&s?R(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))}})}},[]);l(function(){$e.current=Nt},[Nt]);var Wt=o(null),Yt=c(function(){Ue.current.length>0&&!Ve.current||(null!==Wt.current&&clearTimeout(Wt.current),Wt.current=setTimeout(function(){$e.current(),Wt.current=null},50))},[]),Kt=c(function(e){var n,t,i,o,r,l,c,u,d,a;if(!Pe.current){if(me||Yt(),Qe.current){var s=Ze.current,v=Tt.current,p=pn.current,h=un.current;if(null!==s&&null!==v&&p&&h){var f="string"==typeof s&&s.includes(b)?null===(n=Zn.current["".concat(s.split(b)[0]).concat(b).concat(s.split(b)[1])])||void 0===n?void 0:n.current:null===(t=it.current[s])||void 0===t?void 0:t.current,g="string"==typeof v&&v.includes(b)?null===(i=$n.current["".concat(v.split(b)[0]).concat(b).concat(v.split(b)[1])])||void 0===i?void 0:i.current:null===(o=et.current[v])||void 0===o?void 0:o.current;if(f&&g){var x=f.getBoundingClientRect().top-p.getBoundingClientRect().top+p.scrollTop,m=g.getBoundingClientRect().top-h.getBoundingClientRect().top+h.scrollTop;if(e.currentTarget===p){var y=m-(x-p.scrollTop),S=h.scrollHeight-h.clientHeight,R=Math.max(0,Math.min(y,S));Math.abs(h.scrollTop-R)>1&&(h.scrollTop=R)}else if(e.currentTarget===h){var C=x-(m-h.scrollTop),w=p.scrollHeight-p.clientHeight,I=Math.max(0,Math.min(C,w));Math.abs(p.scrollTop-I)>1&&(p.scrollTop=I)}if(Ft.current){var B=void 0,T=void 0;if("string"==typeof s&&s.includes(b)){var F=s.split(b),k="".concat(F[0]).concat(b).concat(F[1]);B=null===(r=Zn.current[k])||void 0===r?void 0:r.current,T=null===(l=$n.current[k])||void 0===l?void 0:l.current}else B=null===(c=Zn.current[s])||void 0===c?void 0:c.current,T=null===(u=$n.current[v])||void 0===u?void 0:u.current;var E=null!==(a=null===(d=It.current)||void 0===d?void 0:d.getBoundingClientRect().top)&&void 0!==a?a:0,M=p.getBoundingClientRect().top,D=M+p.clientHeight,_=h.getBoundingClientRect().top,H=_+h.clientHeight,A=function(e,n,t){return Math.max(n,Math.min(t,e))};if(B&&T){var L=B.getBoundingClientRect(),O=T.getBoundingClientRect(),P=L.top+L.height/2,j=O.top+O.height/2,N=A(P,M,D),z=A(j,_,H);Ft.current.setAttribute("y1",(N-E).toString()),Ft.current.setAttribute("y2",(z-E).toString());var W=P>=M-4&&P<=D+4;Ft.current.setAttribute("visibility",W?"visible":"hidden")}}}}}Ue.current.length>0&&!Ge.current&&(Ge.current=!0,requestAnimationFrame(function(){zt(),Ge.current=!1}))}},[zt,me,Yt]);l(function(){var e=setTimeout(Yt,250);window.addEventListener("resize",Yt);var n=null,t=null;return ln.current&&(n=new ResizeObserver(Yt)).observe(ln.current),It.current&&(t=new ResizeObserver(Yt)).observe(It.current),function(){clearTimeout(e),window.removeEventListener("resize",Yt),null==n||n.disconnect(),null==t||t.disconnect()}},[Pn,jn,ct,Wn,gt,xt,Nn,zn,En,Yt,Ee,Le,_e,Ne]),l(function(){Qe.current=Ee},[Ee]),l(function(){Ze.current=Le},[Le]);var Xt=c(function(e,n,t){var i,o,r,l,c,u=null===(i=null==t?void 0:t.toggleIfSame)||void 0===i||i,d=null==t?void 0:t.onReady;if(kn(),null!=e)if(n)Fe("No counterpart exists for this section.");else if(Ee&&Le===e)u?ht():null==d||d();else{if(!me){var a=Ze.current,s=Tt.current;if(null!==a)if("string"==typeof a&&a.includes(b)){var v=a.split(b);(p=null===(o=nt.current[v[2]])||void 0===o?void 0:o.current)&&(p.style.paddingTop="0px")}else{var p;(p=null===(r=Gn.current[a])||void 0===r?void 0:r.current)&&(p.style.paddingTop="0px")}if(null!==s)if("string"==typeof s&&s.includes(b)){v=s.split(b);(h=null===(l=tt.current[v[3]])||void 0===l?void 0:l.current)&&(h.style.paddingTop="0px")}else{var h;(h=null===(c=Qn.current[s])||void 0===c?void 0:c.current)&&(h.style.paddingTop="0px")}}ze(new Set),Ke([]),Ue.current=[],Ie(!0),Pe.current=!0,Oe(e),Ze.current=e,Me(!0),Qe.current=!0,He(!1),dn.current&&(dn.current.style.height="0px"),an.current&&(an.current.style.height="0px"),sn.current&&(sn.current.style.height="0px"),vn.current&&(vn.current.style.height="0px"),requestAnimationFrame(function(){var n,t,i,o,r,l,c,u,a,s,v=null,p=null,h=null,f=null,g=null;if("string"==typeof e&&e.includes(b)){var x=e.split(b),m="".concat(x[0]).concat(b).concat(x[1]);v=(null===(n=Zn.current[m])||void 0===n?void 0:n.current)||null,g=(p=(null===(t=$n.current[m])||void 0===t?void 0:t.current)||null)?e:null,h=(null===(i=nt.current[x[2]])||void 0===i?void 0:i.current)||null,f=(null===(o=tt.current[x[3]])||void 0===o?void 0:o.current)||null}else if(v=(null===(r=it.current[e])||void 0===r?void 0:r.current)||null,h=(null===(l=Gn.current[e])||void 0===l?void 0:l.current)||null,me){var y=Nn[e],S=(null==y?void 0:y.refIndexes)||[];if(S.length>0){var R=S[0],w=zn.findIndex(function(e){return e.selfIndex===R});-1!==w&&(p=(null===(a=et.current[w])||void 0===a?void 0:a.current)||null,f=(null===(s=Qn.current[w])||void 0===s?void 0:s.current)||null,g=w)}}else p=(null===(c=et.current[e])||void 0===c?void 0:c.current)||null,f=(null===(u=Qn.current[e])||void 0===u?void 0:u.current)||null,g=p?e:null;Tt.current=g;var I=pn.current,B=un.current;if(!v||!I)return Pe.current=!1,Ie(!1),void(null==d||d());if(!p||!B)return He(!0),$e.current(),Pe.current=!1,Ie(!1),void(null==d||d());if(!me){var T=v.getBoundingClientRect(),F=p.getBoundingClientRect(),k=T.top-F.top;h&&f&&(h.style.paddingTop="0px",f.style.paddingTop="0px",k>0?f.style.paddingTop="".concat(k,"px"):k<0&&(h.style.paddingTop="".concat(Math.abs(k),"px")));var E=v?v.getBoundingClientRect().top:(null==h?void 0:h.getBoundingClientRect().top)||0,M=ln.current,D=M?M.scrollTop+E-150:0;return M?void C(M,D,200,function(){He(!0),$e.current(),Pe.current=!1,Ie(!1),null==d||d()}):(He(!0),$e.current(),Pe.current=!1,Ie(!1),void(null==d||d()))}var _=v.getBoundingClientRect().top-I.getBoundingClientRect().top+I.scrollTop,H=p.getBoundingClientRect().top-B.getBoundingClientRect().top+B.scrollTop-(_-I.scrollTop);H<0&&dn.current&&(dn.current.style.height="".concat(Math.abs(H),"px"));requestAnimationFrame(function(){var e,n=B.scrollHeight-B.clientHeight;if(H<0)e=0;else{if(H>n){var t=H-n;return an.current&&(an.current.style.height="".concat(t+150,"px")),void requestAnimationFrame(function(){C(B,H,200,function(){He(!0),$e.current(),Pe.current=!1,Ie(!1),null==d||d()})})}e=H}C(B,e,200,function(){He(!0),$e.current(),Pe.current=!1,Ie(!1),null==d||d()})})})}},[Le,kn,zn,Ee,me,Nn,ht]),Vt=c(function(e,n,t,i){var o="string"==typeof i?x(i).trim():x(null==i?void 0:i.deviation_summary).trim(),r=e.currentTarget;Fn(),Xt(n,t,o?{toggleIfSame:!1,onReady:function(){wn({open:!0,anchorEl:r,summary:i})}}:{toggleIfSame:!1})},[Xt,Fn,wn]),qt=c(function(){var e=mn.sectionIdx,n=mn.isOrphan;null!=e&&Xt(e,n)},[Xt,mn.isOrphan,mn.sectionIdx]),Jt=c(function(){In(),ht()},[In,ht]),Ut=null!==mn.sectionIdx&&Ne.has(mn.sectionIdx),Gt=O({proposedSections:Nn,existingSections:zn,parentDeviationRecord:Yn,expandedSections:gt,maintainRelativeOrder:!!me,scrollContainerRef:ln,leftContainerRef:pn,lhsBadgeRefs:Zn,rhsBadgeRefs:$n}),Qt=Gt.showDeviationNavigation,Zt=Gt.showOpenNodeRef;l(function(){if(ge){var e=function(e){var n=Yn[e].find(function(e){return e.id===ge});if(n){var t=Nn.findIndex(function(n){return n.id===e});(me?!!gt["right-".concat(t)]:!!gt[String(t)])||yt(t,"left");var i="".concat(n.id).concat(b,"0"),o=setInterval(function(){var e,n,t=null===(e=Zn.current[i])||void 0===e?void 0:e.current,r=null===(n=$n.current[i])||void 0===n?void 0:n.current;if(t){t.scrollIntoView({behavior:"smooth",block:"center"});var l=window.getComputedStyle(t).color;t.style.transition="box-shadow 300ms ease-in-out",t.style.boxShadow="0 0 10px ".concat(l),r&&(r.style.transition="box-shadow 300ms ease-in-out",r.style.boxShadow="0 0 10px ".concat(l)),setTimeout(function(){t.style.boxShadow="",r&&(r.style.boxShadow="")},2e3),clearTimeout(o)}},600);return"break"}};for(var n in Yn){if("break"===e(n))break}}},[ge]);var $t=function(e){var n=e.section,i=e.keyPath,o=e.depth,r=void 0===o?0:o,l=e.columnKey,c=void 0===l?"left":l,u=e.parentNodeId;return t(N,{section:n,keyPath:i,depth:r,columnKey:c,parentNodeId:void 0===u?"":u,expandedSubSections:xt,setExpandedSubSections:mt,maintainRelativeOrder:me||!1,proposedSections:Nn,existingSections:zn,treeData:le,deviationNumberRegistry:Kn,connectedSections:Ne,activeSideBySideSection:Le,resolvedMarkdownStyles:rn,getSubSectionRef:rt,getSubSectionCompareStyle:jt,getBadgeRef:lt,openMoreFunctionsPopup:Rt,openSummaryPopup:Vt,resetSideBySide:ht,setConnectedSections:ze,setConnectedLines:Ke,cachedConnectedPositions:Ue})};return n(u,e({ref:cn,sx:e(e({display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif'},me?{}:{overflow:"visible"}),{position:"relative"})},{children:[Se&&t(u,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:t(M,{})})),Cn.open&&t(z,{open:Cn.open,anchorEl:Cn.anchorEl,containerEl:Bt.current,onClose:Jt,summary:Cn.summary}),t(E,{open:mn.open,anchorEl:mn.anchorEl,sectionTitle:mn.sectionTitle,referenceSectionTitle:mn.refSectionTitle,onClose:kn,onOpenCognitiveCompare:Ct,onOpenSideBySide:qt,onConnect:wt,isConnected:Ut,isOrphan:mn.isOrphan}),gn.open&&t(k,{open:gn.open,popupRef:Tn,position:bn,popupConfig:pe,onClose:function(){Sn(null),xn(function(n){return e(e({},n),{open:!1})}),Bn(null)},markdownStyles:ae,sectionTitle:gn.sectionTitle,referenceSectionTitle:gn.refSectionTitle,cognitiveData:gn.cognitiveData,anchorEl:gn.anchorEl,sectionAnchorEl:gn.sectionAnchorEl,scrollContainerEl:ln.current,badgeStyle:gn.badgeStyle,docData:gn.docData,deviationData:gn.deviationData,isLoading:gn.isLoading}),t(d,e({open:!!Te,autoHideDuration:8e3,onClose:function(){return Fe(null)},anchorOrigin:{vertical:"top",horizontal:"center"}},{children:t(a,e({onClose:function(){return Fe(null)},severity:"error",sx:{width:"100%",whiteSpace:"pre-line"}},{children:Te}))})),t(P,{componentHeaderText:re,displayConfig:ve,maintainRelativeOrder:me,onToggleView:function(e){Re(!0),setTimeout(function(){ye(!e),ht(),ze(new Set),Ke([]),Ue.current=[],setTimeout(function(){Re(!1)},400)},50)}}),t(u,e({ref:ln,onScroll:Kt,sx:{flex:1,minHeight:0,pt:1.5,pb:1,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",overflowY:me?"hidden":"auto",borderTop:ut&&dt?"none":"1.5px solid #EEF0F4"}},{children:t(u,e({sx:e({display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"},me?{flex:1,minHeight:0}:{})},{children:n(u,e({ref:It,sx:e({display:"grid",gridTemplateColumns:"minmax(0, 1fr) 180px minmax(0, 1fr)",gap:"40px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0},me?{flex:1,overflow:"visible"}:{})},{children:[n("svg",e({ref:Xe,style:{position:"absolute",top:0,left:0,width:tn.width||"100%",height:tn.height||"100%",pointerEvents:"none",zIndex:10,overflow:"visible",transition:"opacity 0.15s ease-in-out"}},{children:[At&&t("g",{children:t("line",{x1:At.x1,y1:At.y,x2:At.x2,y2:At.y,stroke:pt.badgeBorder,strokeWidth:"1.5"})}),Dt.map(function(i){var o=i.x1+.5*(i.x2-i.x1),r=(i.y1+i.y2)/2;if("Not Defined"===i.style.label&&!i.hasCognitive)return null;if(i.isSubSection?Ee&&Le===i.subSectionKeyPath&&_e:Ee&&Le===i.sectionIdx&&_e)return n("g",e({style:{transition:"opacity 0.2s"}},{children:[t("defs",{children:t("marker",e({id:"arr-".concat(i.id),markerWidth:"7",markerHeight:"5",refX:"7",refY:"2.5",orient:"auto"},{children:t("polygon",{points:"0 0, 7 2.5, 0 5",fill:i.style.badgeBorder||"#6366F1"})}))}),t("line",{ref:Ft,x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2,stroke:i.style.badgeBorder||"#6366F1",strokeWidth:"1.5",markerEnd:"url(#arr-".concat(i.id,")")})]}),i.id);if(!me){var l=i.isSubSection?R(i.x1,i.y1,i.x2,i.y2):"M ".concat(i.x1," ").concat(i.y1," L ").concat(i.x2," ").concat(i.y2);return n("g",{children:[t("path",{d:l,fill:"none",stroke:i.style.badgeBorder||"#E2E8F0",strokeWidth:"1.5"}),t("foreignObject",e({x:o-100,y:r-14,width:"200",height:"28",style:{pointerEvents:"auto",overflow:"visible"}},{children:t(u,e({sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},{children:n(u,e({onClick:function(n){if(n.stopPropagation(),gn.open&&Rn===i.id)Fn();else{var t=Nn[i.sectionIdx]||{title:"",content:""},o=zn[i.sectionIdx]||{title:"",content:""};if(i.isSubSection&&i.subSectionKeyPath){for(var r=i.subSectionKeyPath.split(b)[2].split("-").map(Number),l=Nn[r[0]],c=zn[r[0]],u=(null==l?void 0:l.title)||"",d=(null==c?void 0:c.title)||"",a=1;a<r.length;a++)(null==l?void 0:l.subsections)&&(l=l.subsections[r[a]]),(null==c?void 0:c.subsections)&&(c=c.subsections[r[a]]);l&&(t=e(e({},l),{title:u||l.title})),c&&(o=e(e({},c),{title:d||c.title}))}Bn(i.id),St(bt(n.currentTarget,t,o,i.sectionIdx,i.style))}},sx:{display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",bgcolor:i.style.badgeBg,color:i.style.badgeText,border:"1px solid ".concat(i.style.badgeBorder),borderRadius:"12px",px:1.5,py:.5,fontWeight:600,textAlign:"center",whiteSpace:"nowrap",cursor:"pointer"}},{children:[i.style.badgeText===T&&null==i.style.label?t(D,{color:i.style.badgeText}):0===i.style.label?"Same":i.style.label,t(u,e({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:t(f,{})})),t(p,{size:11,style:{transform:gn.open&&Rn===i.id?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))}))]},i.id)}return null}),Ye.map(function(i){var o,r=i.pathD,l=(null===(o=i.style)||void 0===o?void 0:o.badgeBorder)||"#6366F1",c="conn-marker-".concat(i.id),u="".concat(i.id,"-bg"),d="".concat(i.id,"-stroke");return n("g",{children:[t("defs",{children:t("clipPath",e({id:"connections-clip"},{children:t("marker",e({id:c,markerWidth:"8",markerHeight:"6",refX:"7",refY:"3",orient:"auto"},{children:t("polygon",{points:"0 0, 8 3, 0 6",fill:l})}))}))}),t("path",{ref:function(e){Je.current[u]=e},d:r,fill:"none",stroke:"#FFFFFF",strokeWidth:"4",strokeOpacity:"0.7"}),t("path",{ref:function(e){Je.current[d]=e},d:r,fill:"none",stroke:l,strokeWidth:"1.75",markerEnd:"url(#".concat(c,")")})]},i.id)})]})),n(u,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)"},me?{flex:1,overflow:"visible"}:{})},{children:[t(u,e({ref:kt,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:t(s,e({title:An,placement:"top"},{children:t(v,e({sx:{fontSize:"16px",fontWeight:500,color:"#19213D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0,textAlign:"center",display:"block"}},{children:An}))}))})),n(u,e({ref:pn,onScroll:Kt,sx:e({p:"12px",display:"flex",flexDirection:"column"},me?{maxHeight:"calc(100vh - 150px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,mr:"-160px",pr:"172px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[t("div",{ref:sn,style:{width:"100%",height:"0px",flexShrink:0}}),Vn&&Nn.map(function(i,o){var r,l,c=!i.title&&!i.content;if(me&&c)return null;var d=i,a=Pt(o),s=me?!(null===(r=d.refIndexes)||void 0===r?void 0:r.length)||d.selfIndex<0:!zn[o],v=me?"number"==typeof d.selfIndex&&d.selfIndex>=0?d.selfIndex+1:null:o+1,p=Ne.has(o),f=m(d.evaluationResult,null==a?void 0:a.deviationLabel);return t(u,e({ref:ot(o),sx:{mb:1,width:"100%"}},{children:n(u,e({sx:{position:"relative",width:"100%"}},{children:[t(u,e({ref:Gn.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:t(j,{section:i,idx:o,columnKey:"left",colRef:ot("left-accordion-".concat(o)),mb:0,treeData:le,proposedSections:Nn,existingSections:zn,deviationNumberRegistry:Kn,getSectionCompareStyle:Pt,getBadgeRef:lt,connectedSections:Ne,openMoreFunctionsPopup:Rt,openSummaryPopup:Vt,parentNodeId:(null===(l=null==le?void 0:le.input_index_map)||void 0===l?void 0:l[0])||"",isExpanded:me?!!gt["left-".concat(o)]:!!gt[String(o)],onToggle:function(){return yt(o,"left")},navigation:i.id?Qt[i.id]:null,showOpenNodeRef:Zt,resolvedMarkdownStyles:rn,maintainRelativeOrder:me,renderSubSections:$t})})),me&&a&&n(u,e({ref:Zn.current[o],onClick:function(e){var n=me?zn.find(function(e){var n;return null===(n=d.refIndexes)||void 0===n?void 0:n.includes(e.selfIndex)})||{title:"",content:""}:zn[o]||{title:"",content:""};Rt(e,i,s,n,o,a)},sx:{position:"absolute",top:"18px",right:0,transform:"translateY(-50%) translateX(calc(100% + 8px))",display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",bgcolor:a.badgeBg,color:a.badgeText,border:"1px solid ".concat(a.badgeBorder),borderRadius:"12px",px:1.2,py:.4,fontWeight:600,cursor:"pointer",whiteSpace:"nowrap",zIndex:20,boxShadow:"0 1px 3px rgba(0,0,0,0.07)"}},{children:[null!==v&&t(u,e({component:"span",sx:{fontSize:"11px",fontWeight:700,pr:.5,borderRight:"1px solid ".concat(a.badgeBorder)}},{children:v})),t(u,e({component:"span",sx:{fontSize:"11px",px:.25}},{children:!ve.isLoading||null!=d.evaluationResult&&null!=d.evaluationResult?s?"No Deviation Found":"N/A"===f||"NA"===f?"N/A":0==f||null==f?"Same":"".concat(f):t(D,{color:a.badgeText})})),t(h,{size:11,color:a.badgeText})]}))]}))}),"left-row-".concat(o))}),t("div",{ref:vn,style:{width:"100%",height:"0px",flexShrink:0}})]}))]})),t(u,e({ref:Bt,sx:{width:"180px",display:"flex",flexDirection:"column",alignItems:"center",pt:"15px",gap:0,zIndex:20,pointerEvents:"none"}},{children:t(u,e({sx:{display:"flex",justifyContent:"center",alignItems:"center",mt:0}},{children:n(u,e({sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:"5px",top:"-5px",borderRadius:"20px",bgcolor:pt.badgeBg,color:pt.badgeText,border:"1px solid ".concat(pt.badgeBorder),fontSize:"12px",fontWeight:600,whiteSpace:"nowrap",position:"relative",zIndex:1,pointerEvents:"auto",cursor:"pointer"}},{children:[null!=vt?vt:t(D,{}),t(u,e({component:"span",onClick:function(n){n.stopPropagation(),gn.open&&Rn===at?Fn():(Bn(at),St(bt(n.currentTarget,{title:"",content:"",evaluationResult:st,cognitiveData:{section_id:"",decisioning:[],gap:[],relevance_score:0,isMissingRationale:!0}},null,at,!0,e(e({},pt),{label:""}))))},sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:t(f,{})})),t(p,{size:11,style:{transform:gn.open&&Rn===at?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))})),n(u,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},me?{flex:1,overflow:"visible",minHeight:0}:{})},{children:[we&&t(g,{sections:11}),t(u,e({ref:Et,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E3E6EA",borderRadius:"8px 8px 0 0",minHeight:"40px",display:"flex",alignItems:"center",overflowX:"hidden"}},{children:t(s,e({title:Ln,placement:"top"},{children:t(v,e({sx:{fontSize:"16px",fontWeight:500,color:"#5928ED",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0,textAlign:"center",display:"block"}},{children:Ln}))}))})),n(u,e({ref:un,onScroll:Kt,sx:e({p:"12px",display:"flex",flexDirection:"column"},me?{maxHeight:"calc(100vh - 150px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,ml:"-120px",pl:"140px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[t("div",{ref:dn,style:{width:"100%",height:"0px",flexShrink:0}}),Vn&&zn.map(function(i,o){var r,l=i,c=[],d=!1,a=null;if(me){c=Nn.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});var s=Nn.findIndex(function(e,n){var t;return Ne.has(n)&&(null===(t=e.refIndexes)||void 0===t?void 0:t.includes(l.selfIndex))});(d=-1!==s)&&(a=Pt(s))}else c=[o+1],(d=Ne.has(o))&&(a=Pt(o));var v=Pt(o);return t(u,e({ref:et.current[o],sx:{mb:1,width:"100%"}},{children:n(u,e({sx:{position:"relative",width:"100%"}},{children:[t(u,e({ref:Qn.current[o],sx:e({width:"100%",display:"flex"},d&&a&&{borderRadius:"6px",outline:"2px solid ".concat(a.badgeBorder),outlineOffset:"1px"})},{children:t(j,{section:i,idx:o,columnKey:"right",colRef:ot("right-accordion-".concat(o)),mb:0,parentNodeId:(null===(r=null==le?void 0:le.input_index_map)||void 0===r?void 0:r[1])||"",isExpanded:me?!!gt["right-".concat(o)]:!!gt[String(o)],treeData:le,proposedSections:Nn,existingSections:zn,deviationNumberRegistry:Kn,getBadgeRef:lt,getSectionCompareStyle:Pt,connectedSections:Ne,openMoreFunctionsPopup:Rt,openSummaryPopup:Vt,onToggle:function(){return yt(o,"right")},navigation:i.id?Qt[i.id]:null,showOpenNodeRef:Zt,resolvedMarkdownStyles:rn,maintainRelativeOrder:me,renderSubSections:$t})})),me&&!we&&v&&t(u,e({ref:$n.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:c.length>0?c.join(", "):"-"}))]}))}),"right-row-".concat(o))}),t("div",{ref:an,style:{width:"100%",height:"0px",flexShrink:0}})]}))]}))]}))}))}))]}))};export{W as default};
1
+ import{__assign as e}from"tslib";import{jsxs as n,jsx as t}from"react/jsx-runtime";import{useState as i,useRef as o,useMemo as r,useEffect as l,useCallback as c}from"react";import{Box as u,Snackbar as d,Alert as a,Tooltip as s,Typography as v}from"@mui/material";import{ChevronDown as p,EllipsisVertical as h}from"lucide-react";import{ButtonCognitiveIcon as f}from"../../assests/svg/ButtonCognitiveIcon.js";import g from"./OverlayComponent.js";import{safeStringify as x,extractDeviationScore as m,generateColorPalette as y,DEVIATION_BADGE_SEPARATOR as b,hasValue as S,getBentArrowPath as R,smoothScrollTo as C}from"./CognitiveComparehelpers.js";import{SHARED_MARKDOWN_STYLES as w,DEFAULT_FIELD_CONFIG as I,DEFAULT_COMPARISON_CONFIG as B}from"./CognitiveCompareConfig.js";export{SHARED_MARKDOWN_STYLES}from"./CognitiveCompareConfig.js";import{DEFAULT_DEVIAION_COLOR as T,DEFAULT_COMPONENT_HEADER_TEXT as F}from"./CognitiveCompareConstants.js";import k from"./CognitivePopup.js";import E from"./MoreFunctionsPopup.js";import M from"./LoaderComponent.js";import D from"./components/ThreeDotsLoader.js";import{useCognitiveTreeData as _}from"./hooks/useCompareData.js";import{useComparePopups as H}from"./hooks/useComparePopups.js";import{useSectionRefs as A}from"./hooks/useSectionRefs.js";import{useAccordionState as L}from"./hooks/useAccordionState.js";import{useDeviationNavigation as O}from"./hooks/useDeviationNavigation.js";import P from"./components/CompareHeader.js";import j from"./components/SectionAccordion.js";import N from"./components/SubSectionAccordion.js";import z from"./components/CognitiveSummaryPopup.js";var W=function(W){var Y,K,X,V,q,J,U,G,Q,Z,$,ee,ne,te,ie,oe=W.componentHeaderText,re=void 0===oe?F:oe,le=W.treeData,ce=W.comparisonConfig,ue=W.leftColumnTitleText,de=W.rightColumnTitleText,ae=W.markdownStyles,se=W.displayConfig,ve=void 0===se?{isHeaderVisible:!0,isToggleVisible:!0,maintainRelativeOrder:!1,isLoading:!0}:se,pe=W.popupConfig,he=W.deviationData,fe=void 0===he?{}:he,ge=W.deviationNodeIdToView,xe=i(ve.maintainRelativeOrder),me=xe[0],ye=xe[1],be=i(!1),Se=be[0],Re=be[1],Ce=i(!1),we=Ce[0],Ie=Ce[1],Be=i(null),Te=Be[0],Fe=Be[1],ke=i(!1),Ee=ke[0],Me=ke[1],De=i(!1),_e=De[0],He=De[1],Ae=i(null),Le=Ae[0],Oe=Ae[1],Pe=o(!1),je=i(new Set),Ne=je[0],ze=je[1],We=i([]),Ye=We[0],Ke=We[1],Xe=o(null),Ve=o(!1),qe=o(null),Je=o({}),Ue=o([]),Ge=o(!1),Qe=o(!1),Ze=o(null),$e=o(function(){}),en=r(function(){return(null==le?void 0:le.cognitive_decisioning)||{}},[le]),nn=i({width:0,height:0}),tn=nn[0],on=nn[1],rn=r(function(){return e(e({},w),ae)},[ae]),ln=o(null),cn=o(null),un=o(null),dn=o(null),an=o(null),sn=o(null),vn=o(null),pn=o(null),hn=o(!1),fn=H(ln),gn=fn.cognitivePopup,xn=fn.setCognitivePopup,mn=fn.moreFunctions,yn=fn.setMoreFunctions,bn=fn.position,Sn=fn.setPosition,Rn=fn.activeBadgeId,Cn=fn.summaryPopup,wn=fn.setSummaryPopup,In=fn.closeSummaryPopup,Bn=fn.setActiveBadgeId,Tn=fn.popupRef,Fn=fn.closeCognitivePopup,kn=fn.closeMoreFunctionsPopup,En=r(function(){var e,n,t,i,o,r,l;return{fields:null!==(e=null==ce?void 0:ce.fields)&&void 0!==e?e:I,thresholds:{high:null!==(t=null===(n=null==ce?void 0:ce.thresholds)||void 0===n?void 0:n.high)&&void 0!==t?t:B.thresholds.high,medium:null!==(o=null===(i=null==ce?void 0:ce.thresholds)||void 0===i?void 0:i.medium)&&void 0!==o?o:B.thresholds.medium,exact:null!==(l=null===(r=null==ce?void 0:ce.thresholds)||void 0===r?void 0:r.exact)&&void 0!==l?l:B.thresholds.exact}}},[ce]),Mn=i(null),Dn=Mn[0];Mn[1];var _n=null===(X=null===(Y=null==le?void 0:le.documents)||void 0===Y?void 0:Y[null===(K=null==le?void 0:le.input_index_map)||void 0===K?void 0:K[0]])||void 0===X?void 0:X.title,Hn=null===(J=null===(V=null==le?void 0:le.documents)||void 0===V?void 0:V[null===(q=null==le?void 0:le.input_index_map)||void 0===q?void 0:q[1]])||void 0===J?void 0:J.title,An=x(ue||_n||"Uploaded Contract"),Ln=x(de||Hn||"Reference Template"),On=_(le,me,fe,En),Pn=On.activeProposed,jn=On.existingRule,Nn=On.proposedSections,zn=On.existingSections,Wn=On.visibleFields,Yn=On.parentDeviationRecord,Kn=On.deviationNumberRegistry,Xn=On.parseError;l(function(){Xn&&Fe("Failed to load comparison: ".concat(Xn))},[Xn]);var Vn=Nn.length>0||zn.length>0,qn=A(Wn.map(function(e){return e.key}),Math.max(Nn.length,zn.length)),Jn=qn.leftRefs,Un=qn.rightRefs,Gn=qn.sectionLeftRefs,Qn=qn.sectionRightRefs,Zn=qn.lhsBadgeRefs,$n=qn.rhsBadgeRefs,et=qn.sectionRightRowRefs,nt=qn.subSectionLeftRefs,tt=qn.subSectionRightRefs,it=qn.sectionRowRefs,ot=qn.getSectionRowRef,rt=qn.getSubSectionRef,lt=qn.getBadgeRef,ct=jn.analysis,ut=x(null===(G=null===(U=null==ct?void 0:ct.rule_difference_comparison)||void 0===U?void 0:U.summary)||void 0===G?void 0:G.overall_summary),dt=!!ut.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),at=null!==(Q=null==le?void 0:le.base_root_id)&&void 0!==Q?Q:"-1";null==le||le[at];var st=(null===(Z=null==fe?void 0:fe[at])||void 0===Z?void 0:Z.evaluation_result)||(null===(ee=null===($=null==le?void 0:le.nodes)||void 0===$?void 0:$[at])||void 0===ee?void 0:ee.evaluation_result)||null,vt=m(st),pt=y(null!==(ie=null===(te=null===(ne=null==st?void 0:st.evaluation_outputs)||void 0===ne?void 0:ne.metadata)||void 0===te?void 0:te.label_color)&&void 0!==ie?ie:""),ht=c(function(){var e,n,t,i;Me(!1),Qe.current=!1;var o=Ze.current,r=Tt.current;if(null!==o)if("string"==typeof o&&o.includes(b)){var l=o.split(b);(c=null===(e=nt.current[l[2]])||void 0===e?void 0:e.current)&&(c.style.paddingTop="0px")}else{var c;(c=null===(n=Gn.current[o])||void 0===n?void 0:n.current)&&(c.style.paddingTop="0px")}if(null!==r)if("string"==typeof r&&r.includes(b)){l=r.split(b);(u=null===(t=tt.current[l[3]])||void 0===t?void 0:t.current)&&(u.style.paddingTop="0px")}else{var u;(u=null===(i=Qn.current[r])||void 0===i?void 0:i.current)&&(u.style.paddingTop="0px")}Oe(null),Ze.current=null,Tt.current=null,He(!1),Ie(!1),dn.current&&(dn.current.style.height="0px"),an.current&&(an.current.style.height="0px"),sn.current&&(sn.current.style.height="0px"),vn.current&&(vn.current.style.height="0px")},[]),ft=L({maintainRelativeOrder:!!me,proposedSections:Nn,existingSections:zn,activeSideBySideSection:Le,connectedSections:Ne,resetSideBySide:ht,setConnectedSections:ze,setConnectedLines:Ke,cachedConnectedPositions:Ue,svgContainerRef:Xe,isAnimatingRef:Ve,animationTimerRef:qe,calculateLinesRef:$e,sectionLeftRefs:Gn,sectionRightRefs:Qn,subSectionLeftRefs:nt,subSectionRightRefs:tt}),gt=ft.expandedSections,xt=ft.expandedSubSections,mt=ft.setExpandedSubSections,yt=ft.toggleSection,bt=c(function(e,n,t,i,o,r,l){var c,u,d,a=x(null==n?void 0:n.id)||x(null==t?void 0:t.id)||"",s=(a?en[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=it.current[i])||void 0===c?void 0:c.current)&&void 0!==u?u:null;return{isLoading:null!==(d=null==ve?void 0:ve.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==le?void 0:le.documents,input_index_map:null==le?void 0:le.input_index_map},deviationData:(null==n?void 0:n.evaluationResult)||(null==t?void 0:t.evaluationResult)||null,isOrphan:!!o}},[en,le]),St=c(function(e){kn(),Sn(null),xn(e)},[kn]),Rt=function(e,n,t,i,o,r){e.stopPropagation(),mn.open&&mn.sectionIdx===o?kn():(Fn(),yn(bt(e.currentTarget,n,i,o,t,r)))},Ct=c(function(){null!==mn.sectionIdx&&mn.anchorEl?St(e(e({},mn),{open:!0})):kn()},[mn,kn,St]),wt=c(function(){var e=mn.sectionIdx,n=mn.isOrphan,t=null!==e&&Ne.has(e);kn(),null!==e&&(n?Fe("No counterpart exists to connect to."):(Qe.current&&ht(),t&&(Ke([]),Ue.current=[]),ze(function(n){return n.has(e)?new Set:new Set([e])})))},[mn.sectionIdx,kn,ht]),It=o(null),Bt=o(null),Tt=o(null),Ft=o(null),kt=o(null),Et=o(null),Mt=i([]),Dt=Mt[0],_t=Mt[1];o(null);var Ht=i(null),At=Ht[0],Lt=Ht[1];l(function(){if(Dn){var e=En.fields.find(function(e){return e.analysisKey===Dn||e.key===Dn});if(e){var n=Jn.current[e.key]||Un.current[e.key];(null==n?void 0:n.current)&&setTimeout(function(){return n.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[Dn,En.fields]);var Ot=c(function(e){var n,t,i,o,r,l,c,u,d,a=null===(n=null==ct?void 0:ct.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}},[ct]),Pt=c(function(n){var t,i,o,r,l,c,u,d=Nn[n],a=zn[n],s=(null==d?void 0:d.relation)&&"not_defined"!==d.relation,v=(null==a?void 0:a.relation)&&"not_defined"!==a.relation;x(null==d?void 0:d.id)||x(null==a?void 0:a.id);var p=!(!(null==d?void 0:d.cognitiveData)&&!(null==a?void 0:a.cognitiveData));if(!s&&!v&&!p)return e(e({},y(T)),{label:"Not Defined"});var h=null!==(i=null!==(t=null==d?void 0:d.evaluationResult)&&void 0!==t?t:null==a?void 0:a.evaluationResult)&&void 0!==i?i:null,f=null===(o=null==h?void 0:h.evaluation_outputs)||void 0===o?void 0:o.output_value,g=null!==(c=null===(l=null===(r=null==h?void 0:h.evaluation_outputs)||void 0===r?void 0:r.metadata)||void 0===l?void 0:l.label_color)&&void 0!==c?c:T;return e(e({},y(g)),null!=h?{label:null!==(u=f)&&void 0!==u?u:""}:{label:null})},[Nn,zn,en,En,Ot]),jt=c(function(n){for(var t,i,o,r,l,c,u,d,a,s=n.split("-").map(Number),v=Nn[s[0]],p=zn[s[0]],h=1;h<s.length;h++)(null==v?void 0:v.subsections)&&(v=v.subsections[s[h]]),(null==p?void 0:p.subsections)&&(p=p.subsections[s[h]]);if(!v&&!p)return null;var f=(null==v?void 0:v.relation)&&"not_defined"!==v.relation,g=(null==p?void 0:p.relation)&&"not_defined"!==p.relation,m=x(null==v?void 0:v.id)||x(null==p?void 0:p.id)||"",b=!(!(null==v?void 0:v.cognitiveData)&&!(null==p?void 0:p.cognitiveData));if(!f&&!g&&!b)return e(e({},y(T)),{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||m&&(null===(o=en[m])||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:T;return e(e({},y(C)),null!=S?{label:null!=R?R:""}:{label:null})},[Nn,zn,en,En]),Nt=c(function(){var e,n,t,i,o,r,l,c,u,d,a,s,v,p,h,f,g,x,m,y,C,w;if(!hn.current&&!Ve.current){hn.current=!0;try{if(!It.current)return;var I=function(e){var n=e.split("-"),t=n[0];if(!gt[t]&&!1===me)return!1;if(me&&!gt["left-".concat(t)]&&!gt["right-".concat(t)]&&!gt[t])return!1;for(var i=t,o=1;o<n.length-1;o++)if(i+="-".concat(n[o]),!xt[i])return!1;return!0},B=It.current.getBoundingClientRect();on({width:B.width,height:B.height});var T=[];if(Wn.forEach(function(e){var n,t,i=e.key,o=null===(n=Jn.current[i])||void 0===n?void 0:n.current,r=null===(t=Un.current[i])||void 0===t?void 0:t.current;o&&r&&(o.style.height="auto",r.style.height="auto",o.style.minHeight="0px",r.style.minHeight="0px")}),!Ve.current){for(var F=0;F<Math.max(Nn.length,zn.length);F++){var k=null===(e=Gn.current[F])||void 0===e?void 0:e.current,E=null===(n=Qn.current[F])||void 0===n?void 0:n.current;k&&(k.style.height="auto",k.style.minHeight="0px"),E&&(E.style.height="auto",E.style.minHeight="0px")}me||Object.keys(nt.current).forEach(function(e){var n,t;if(I(e)){var i=null===(n=nt.current[e])||void 0===n?void 0:n.current,o=null===(t=tt.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={};Wn.forEach(function(e){var n,t,i=e.key,o=null===(n=Jn.current[i])||void 0===n?void 0:n.current,r=null===(t=Un.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:{}},_={};if(!Ve.current)if(me){if(Ee&&null!==Le)if("number"==typeof Le){var H=Le,A=Nn[H],L=null===(o=Gn.current[H])||void 0===o?void 0:o.current;L&&A&&(A.refIndexes||[]).forEach(function(e){var n,t=zn.findIndex(function(n){return n.selfIndex===e}),i=null===(n=Qn.current[t])||void 0===n?void 0:n.current;if(i&&(gt["left-".concat(H)]||gt["right-".concat(t)])){var o=Math.max(L.getBoundingClientRect().height,i.getBoundingClientRect().height);D.left[H]=Math.max(D.left[H]||0,o),D.right[t]=Math.max(D.right[t]||0,o)}})}else{var O=Le.split(b)[2];if(O){k=null===(r=nt.current[O])||void 0===r?void 0:r.current,E=null===(l=tt.current[O])||void 0===l?void 0:l.current;if(k&&E){P=Math.max(k.getBoundingClientRect().height,E.getBoundingClientRect().height);_[O]=Math.max(_[O]||0,P)}}}}else{Object.keys(nt.current).forEach(function(e){var n,t;if(I(e)){var i=null===(n=nt.current[e])||void 0===n?void 0:n.current,o=null===(t=tt.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);_[e]=c,i.style.minHeight="".concat(c,"px"),o.style.minHeight="".concat(c,"px")}}});for(F=0;F<Math.min(Nn.length,zn.length);F++){var k=null===(t=Gn.current[F])||void 0===t?void 0:t.current,E=null===(i=Qn.current[F])||void 0===i?void 0:i.current;if(k&&E){var P=Math.max(k.getBoundingClientRect().height,E.getBoundingClientRect().height);D.left[F]=P,D.right[F]=P}}}if(Wn.forEach(function(e){var n,t,i=e.key,o=null===(n=Jn.current[i])||void 0===n?void 0:n.current,r=null===(t=Un.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")}}),Ve.current||(Object.entries(D.left).forEach(function(e){var n,t=e[0],i=e[1],o=null===(n=Gn.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=Qn.current[Number(t)])||void 0===n?void 0:n.current;o&&(o.style.minHeight="".concat(i,"px"))}),me||Object.keys(_).forEach(function(e){var n,t,i=null===(n=nt.current[e])||void 0===n?void 0:n.current,o=null===(t=tt.current[e])||void 0===t?void 0:t.current;if(i&&o&&_[e]){var r=_[e];i.style.minHeight="".concat(r,"px"),o.style.minHeight="".concat(r,"px")}})),me)Nn.forEach(function(e,n){var t;(null===(t=Gn.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=zn.findIndex(function(n){return n.selfIndex===e});if(-1!==v){var p=null===(t=Zn.current[n])||void 0===t?void 0:t.current,h=null===(i=$n.current[v])||void 0===i?void 0:i.current;if(p&&h){var f=p.getBoundingClientRect(),g=h.getBoundingClientRect(),x=f.right-B.left,m=g.left-B.left,y=f.top+f.height/2-B.top,b=g.top+g.height/2-B.top;if(Ee&&Le===n){var S=null!==(r=null===(o=pn.current)||void 0===o?void 0:o.getBoundingClientRect().top)&&void 0!==r?r:0,R=null!==(c=null===(l=un.current)||void 0===l?void 0:l.getBoundingClientRect().top)&&void 0!==c?c:0,C=S+(null!==(d=null===(u=pn.current)||void 0===u?void 0:u.clientHeight)&&void 0!==d?d:1/0),w=R+(null!==(s=null===(a=un.current)||void 0===a?void 0:a.clientHeight)&&void 0!==s?s:1/0),I=f.top+f.height/2,F=function(e,n,t){return Math.max(n,Math.min(t,e))};y=F(I,S,C)-B.top,b=F(I,R,w)-B.top}var k=Pt(n);k&&T.push({id:"line-".concat(n,"-").concat(v),x1:x,y1:y,x2:m,y2:b,style:k,sectionIdx:n,targetRightIdx:v})}}})});else{for(F=0;F<Math.min(Nn.length,zn.length);F++){var j=null===(c=Gn.current[F])||void 0===c?void 0:c.current,N=null===(u=Qn.current[F])||void 0===u?void 0:u.current;if(j&&N){var z=j.getBoundingClientRect(),W=N.getBoundingClientRect(),Y=Math.max(z.top,W.top)+18-B.top,K=(null===(d=zn[F])||void 0===d?void 0:d.id)||"sec-".concat(F);(Z=Pt(F))&&T.push({id:K,x1:z.right-B.left,y1:Y,x2:W.left-B.left,y2:Y,style:Z,sectionIdx:F,hasCognitive:!!((null===(a=Nn[F])||void 0===a?void 0:a.cognitiveData)||(null===(s=zn[F])||void 0===s?void 0:s.cognitiveData)||K&&en[K]),isSubSection:!1})}}Object.keys(nt.current).forEach(function(e){var n,t,i,o,r,l;if(I(e)){var c=null===(n=nt.current[e])||void 0===n?void 0:n.current,u=null===(t=tt.current[e])||void 0===t?void 0:t.current;if(c&&u){for(var d=e.split("-").map(Number),a=Nn[d[0]],s=zn[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)&&S(a.title)),h=!!a&&((null===(o=a.displayContent)||void 0===o||o)&&S(a.content)),f=!!s&&((null===(r=s.displayTitle)||void 0===r||r)&&S(s.title)),g=!!s&&((null===(l=s.displayContent)||void 0===l||l)&&S(s.content));if(p&&h||f&&g){var x=c.getBoundingClientRect(),m=u.getBoundingClientRect(),y=Math.max(x.top,m.top)+16-B.top,b=jt(e);b&&"Not Defined"!==b.label&&T.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(Ee&&"string"==typeof Le&&Le.includes(b)){var X=Le.split(b),V=X[0],q=X[1],J=X[2],U=(X[3],"".concat(V).concat(b).concat(q)),G=null===(v=Zn.current[U])||void 0===v?void 0:v.current,Q=null===(p=$n.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(me){var re=null!==(f=null===(h=pn.current)||void 0===h?void 0:h.getBoundingClientRect().top)&&void 0!==f?f:0,le=null!==(x=null===(g=un.current)||void 0===g?void 0:g.getBoundingClientRect().top)&&void 0!==x?x:0,ce=re+(null!==(y=null===(m=pn.current)||void 0===m?void 0:m.clientHeight)&&void 0!==y?y:1/0),ue=le+(null!==(w=null===(C=un.current)||void 0===C?void 0:C.clientHeight)&&void 0!==w?w: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=jt(J))&&T.push({id:"line-subsec-".concat(U),x1:ne,y1:ie,x2:te,y2:oe,style:Z,sectionIdx:Number(J.split("-")[0]),isSubSection:!0,subSectionKeyPath:Le})}}if(_t(T),kt.current&&Et.current){var ae=kt.current.getBoundingClientRect(),se=Et.current.getBoundingClientRect(),ve=(ae.top+ae.height/2-B.top+se.top+se.height/2-B.top)/2;Lt({x1:ae.right-B.left,x2:se.left-B.left,y:ve})}else Lt(null);if(Ne.size>0){var pe=[],he=pn.current,fe=un.current;if(he&&fe){var ge=[],xe=he.getBoundingClientRect().top,ye=fe.getBoundingClientRect().top,be=xe+he.clientHeight,Se=ye+fe.clientHeight,Re=he.scrollTop,Ce=fe.scrollTop,we=B.top,Ie=function(e,n,t){return Math.max(n,Math.min(t,e))};Ne.forEach(function(e){var n,t,i,o,r;if("string"==typeof e&&e.includes(b)){var l=e.split(b),c=l[0],u=l[1],d=l[2],a=(l[3],"".concat(c).concat(b).concat(u)),s=null===(n=Zn.current[a])||void 0===n?void 0:n.current,v=null===(t=$n.current[a])||void 0===t?void 0:t.current;if(!s||!v)return;var p=s.getBoundingClientRect(),h=v.getBoundingClientRect(),f=jt(d),g=(A=p.right-B.left)+.5*((L=h.left-B.left-0)-A),x=p.top+p.height/2,m=h.top+h.height/2,y=x-xe+Re,S=m-ye+Ce,C="conn-subsec-".concat(a);ge.push({lhsScrollY:y,rhsScrollY:S,x1:A,x2:L,containerTop:we,leftIdx:e,rhsArrayIdx:e,styleColor:(null==f?void 0:f.badgeBorder)||"#6366F1",styleId:C});var w=Ie(x,xe,be),I=Ie(m,ye,Se),T=w-we,F=I-we,k=m>=ye-4&&m<=Se+4,E="";E=(O=x>=xe-4&&x<=be+4)&&k?R(A,T,L,F):O&&!k?"M ".concat(A,",").concat(T," L ").concat(g,",").concat(T," L ").concat(g,",").concat(F):!O&&k?"M ".concat(g,",").concat(T," L ").concat(g,",").concat(F," L ").concat(L,",").concat(F):"M ".concat(g,",").concat(T," L ").concat(g,",").concat(F),pe.push({id:C,pathD:E,style:f,leftIdx:e,rhsArrayIdx:e})}else if(me){var M=e,D=Nn[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=zn.findIndex(function(n){return n.selfIndex===e});if(-1!==i){var o=null===(n=Zn.current[M])||void 0===n?void 0:n.current,r=null===(t=$n.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=o.getBoundingClientRect(),c=r.getBoundingClientRect(),u=Pt(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,h=v-xe+Re,f=p-ye+Ce,g="conn-".concat(M,"-").concat(i);ge.push({lhsScrollY:h,rhsScrollY:f,x1:d,x2:a,containerTop:we,leftIdx:M,rhsArrayIdx:i,styleColor:(null==u?void 0:u.badgeBorder)||"#6366F1",styleId:g});var x=Ie(v,xe,be),m=Ie(p,ye,Se),y=x-we,b=m-we,S=v>=xe-4&&v<=be+4,C=p>=ye-4&&p<=Se+4,w="";w=S&&C?R(d,y,a,b):S&&!C?"M ".concat(d,",").concat(y," L ").concat(s,",").concat(y," L ").concat(s,",").concat(b):!S&&C?"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:g,pathD:w,style:u,leftIdx:M,rhsArrayIdx:i})}}})}else{var _=e,H=_;s=null===(i=Zn.current[_])||void 0===i?void 0:i.current,v=null===(o=$n.current[H])||void 0===o?void 0:o.current;if(!s||!v)return;var A,L;p=s.getBoundingClientRect(),h=v.getBoundingClientRect(),f=Pt(_),g=(A=p.right-B.left)+.5*((L=h.left-B.left-0)-A),x=p.top+p.height/2,m=h.top+h.height/2,y=x-xe+Re,S=m-ye+Ce,C="conn-".concat(_,"-").concat(H);ge.push({lhsScrollY:y,rhsScrollY:S,x1:A,x2:L,containerTop:we,leftIdx:_,rhsArrayIdx:H,styleColor:(null==f?void 0:f.badgeBorder)||"#6366F1",styleId:C});var O;w=Ie(x,xe,be),I=Ie(m,ye,Se),T=w-we,F=I-we,k=m>=ye-4&&m<=Se+4,E="";E=(O=x>=xe-4&&x<=be+4)&&k?R(A,T,L,F):O&&!k?"M ".concat(A,",").concat(T," L ").concat(g,",").concat(T," L ").concat(g,",").concat(F):!O&&k?"M ".concat(g,",").concat(T," L ").concat(g,",").concat(F," L ").concat(L,",").concat(F):"M ".concat(g,",").concat(T," L ").concat(g,",").concat(F),pe.push({id:C,pathD:E,style:f,leftIdx:_,rhsArrayIdx:H})}}),Ue.current=ge}Ke(pe)}else Ke([]),Ue.current=[]}catch(e){console.error("Line render safe fail: ",e)}finally{hn.current=!1}}},[Wn,Nn,zn,en,En,Ot,Pt,me,Ee,Le,Ne,gt,xt]),zt=c(function(){var e,n,t,i,o,r,l,c,u,d,a,s,v,p,h=Ue.current;if(h.length&&!Ve.current){var f=null!==(n=null===(e=pn.current)||void 0===e?void 0:e.scrollTop)&&void 0!==n?n:0,g=null!==(i=null===(t=un.current)||void 0===t?void 0:t.scrollTop)&&void 0!==i?i:0,x=null!==(r=null===(o=pn.current)||void 0===o?void 0:o.clientHeight)&&void 0!==r?r:1/0,m=null!==(c=null===(l=un.current)||void 0===l?void 0:l.clientHeight)&&void 0!==c?c:1/0,y=null!==(d=null===(u=pn.current)||void 0===u?void 0:u.getBoundingClientRect().top)&&void 0!==d?d:0,b=null!==(s=null===(a=un.current)||void 0===a?void 0:a.getBoundingClientRect().top)&&void 0!==s?s:0,S=y+x,C=b+m,w=null!==(p=null===(v=It.current)||void 0===v?void 0:v.getBoundingClientRect().top)&&void 0!==p?p:0,I=function(e,n,t){return Math.max(n,Math.min(t,e))};h.forEach(function(e){var n=e.lhsScrollY-f+y,t=e.rhsScrollY-g+b,i=Je.current[e.styleId+"-stroke"],o=Je.current[e.styleId+"-bg"];if(i||o){var r,l=I(n,y,S),c=I(t,b,C),u=l-w,d=c-w,a=n>=y-4&&n<=S+4,s=t>=b-4&&t<=C+4,v=e.x1+.5*(e.x2-e.x1);r=a&&s?R(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))}})}},[]);l(function(){$e.current=Nt},[Nt]);var Wt=o(null),Yt=c(function(){Ue.current.length>0&&!Ve.current||(null!==Wt.current&&clearTimeout(Wt.current),Wt.current=setTimeout(function(){$e.current(),Wt.current=null},50))},[]),Kt=c(function(e){var n,t,i,o,r,l,c,u,d,a;if(!Pe.current){if(me||Yt(),Qe.current){var s=Ze.current,v=Tt.current,p=pn.current,h=un.current;if(null!==s&&null!==v&&p&&h){var f="string"==typeof s&&s.includes(b)?null===(n=Zn.current["".concat(s.split(b)[0]).concat(b).concat(s.split(b)[1])])||void 0===n?void 0:n.current:null===(t=it.current[s])||void 0===t?void 0:t.current,g="string"==typeof v&&v.includes(b)?null===(i=$n.current["".concat(v.split(b)[0]).concat(b).concat(v.split(b)[1])])||void 0===i?void 0:i.current:null===(o=et.current[v])||void 0===o?void 0:o.current;if(f&&g){var x=f.getBoundingClientRect().top-p.getBoundingClientRect().top+p.scrollTop,m=g.getBoundingClientRect().top-h.getBoundingClientRect().top+h.scrollTop;if(e.currentTarget===p){var y=m-(x-p.scrollTop),S=h.scrollHeight-h.clientHeight,R=Math.max(0,Math.min(y,S));Math.abs(h.scrollTop-R)>1&&(h.scrollTop=R)}else if(e.currentTarget===h){var C=x-(m-h.scrollTop),w=p.scrollHeight-p.clientHeight,I=Math.max(0,Math.min(C,w));Math.abs(p.scrollTop-I)>1&&(p.scrollTop=I)}if(Ft.current){var B=void 0,T=void 0;if("string"==typeof s&&s.includes(b)){var F=s.split(b),k="".concat(F[0]).concat(b).concat(F[1]);B=null===(r=Zn.current[k])||void 0===r?void 0:r.current,T=null===(l=$n.current[k])||void 0===l?void 0:l.current}else B=null===(c=Zn.current[s])||void 0===c?void 0:c.current,T=null===(u=$n.current[v])||void 0===u?void 0:u.current;var E=null!==(a=null===(d=It.current)||void 0===d?void 0:d.getBoundingClientRect().top)&&void 0!==a?a:0,M=p.getBoundingClientRect().top,D=M+p.clientHeight,_=h.getBoundingClientRect().top,H=_+h.clientHeight,A=function(e,n,t){return Math.max(n,Math.min(t,e))};if(B&&T){var L=B.getBoundingClientRect(),O=T.getBoundingClientRect(),P=L.top+L.height/2,j=O.top+O.height/2,N=A(P,M,D),z=A(j,_,H);Ft.current.setAttribute("y1",(N-E).toString()),Ft.current.setAttribute("y2",(z-E).toString());var W=P>=M-4&&P<=D+4;Ft.current.setAttribute("visibility",W?"visible":"hidden")}}}}}Ue.current.length>0&&!Ge.current&&(Ge.current=!0,requestAnimationFrame(function(){zt(),Ge.current=!1}))}},[zt,me,Yt]);l(function(){var e=setTimeout(Yt,250);window.addEventListener("resize",Yt);var n=null,t=null;return ln.current&&(n=new ResizeObserver(Yt)).observe(ln.current),It.current&&(t=new ResizeObserver(Yt)).observe(It.current),function(){clearTimeout(e),window.removeEventListener("resize",Yt),null==n||n.disconnect(),null==t||t.disconnect()}},[Pn,jn,ct,Wn,gt,xt,Nn,zn,En,Yt,Ee,Le,_e,Ne]),l(function(){Qe.current=Ee},[Ee]),l(function(){Ze.current=Le},[Le]);var Xt=c(function(e,n,t){var i,o,r,l,c,u=null===(i=null==t?void 0:t.toggleIfSame)||void 0===i||i,d=null==t?void 0:t.onReady;if(kn(),null!=e)if(n)Fe("No counterpart exists for this section.");else if(Ee&&Le===e)u?ht():null==d||d();else{if(!me){var a=Ze.current,s=Tt.current;if(null!==a)if("string"==typeof a&&a.includes(b)){var v=a.split(b);(p=null===(o=nt.current[v[2]])||void 0===o?void 0:o.current)&&(p.style.paddingTop="0px")}else{var p;(p=null===(r=Gn.current[a])||void 0===r?void 0:r.current)&&(p.style.paddingTop="0px")}if(null!==s)if("string"==typeof s&&s.includes(b)){v=s.split(b);(h=null===(l=tt.current[v[3]])||void 0===l?void 0:l.current)&&(h.style.paddingTop="0px")}else{var h;(h=null===(c=Qn.current[s])||void 0===c?void 0:c.current)&&(h.style.paddingTop="0px")}}ze(new Set),Ke([]),Ue.current=[],Ie(!0),Pe.current=!0,Oe(e),Ze.current=e,Me(!0),Qe.current=!0,He(!1),dn.current&&(dn.current.style.height="0px"),an.current&&(an.current.style.height="0px"),sn.current&&(sn.current.style.height="0px"),vn.current&&(vn.current.style.height="0px"),requestAnimationFrame(function(){var n,t,i,o,r,l,c,u,a,s,v=null,p=null,h=null,f=null,g=null;if("string"==typeof e&&e.includes(b)){var x=e.split(b),m="".concat(x[0]).concat(b).concat(x[1]);v=(null===(n=Zn.current[m])||void 0===n?void 0:n.current)||null,g=(p=(null===(t=$n.current[m])||void 0===t?void 0:t.current)||null)?e:null,h=(null===(i=nt.current[x[2]])||void 0===i?void 0:i.current)||null,f=(null===(o=tt.current[x[3]])||void 0===o?void 0:o.current)||null}else if(v=(null===(r=it.current[e])||void 0===r?void 0:r.current)||null,h=(null===(l=Gn.current[e])||void 0===l?void 0:l.current)||null,me){var y=Nn[e],S=(null==y?void 0:y.refIndexes)||[];if(S.length>0){var R=S[0],w=zn.findIndex(function(e){return e.selfIndex===R});-1!==w&&(p=(null===(a=et.current[w])||void 0===a?void 0:a.current)||null,f=(null===(s=Qn.current[w])||void 0===s?void 0:s.current)||null,g=w)}}else p=(null===(c=et.current[e])||void 0===c?void 0:c.current)||null,f=(null===(u=Qn.current[e])||void 0===u?void 0:u.current)||null,g=p?e:null;Tt.current=g;var I=pn.current,B=un.current;if(!v||!I)return Pe.current=!1,Ie(!1),void(null==d||d());if(!p||!B)return He(!0),$e.current(),Pe.current=!1,Ie(!1),void(null==d||d());if(!me){var T=v.getBoundingClientRect(),F=p.getBoundingClientRect(),k=T.top-F.top;h&&f&&(h.style.paddingTop="0px",f.style.paddingTop="0px",k>0?f.style.paddingTop="".concat(k,"px"):k<0&&(h.style.paddingTop="".concat(Math.abs(k),"px")));var E=v?v.getBoundingClientRect().top:(null==h?void 0:h.getBoundingClientRect().top)||0,M=ln.current,D=M?M.scrollTop+E-150:0;return M?void C(M,D,200,function(){He(!0),$e.current(),Pe.current=!1,Ie(!1),null==d||d()}):(He(!0),$e.current(),Pe.current=!1,Ie(!1),void(null==d||d()))}var _=v.getBoundingClientRect().top-I.getBoundingClientRect().top+I.scrollTop,H=p.getBoundingClientRect().top-B.getBoundingClientRect().top+B.scrollTop-(_-I.scrollTop);H<0&&dn.current&&(dn.current.style.height="".concat(Math.abs(H),"px"));requestAnimationFrame(function(){var e,n=B.scrollHeight-B.clientHeight;if(H<0)e=0;else{if(H>n){var t=H-n;return an.current&&(an.current.style.height="".concat(t+150,"px")),void requestAnimationFrame(function(){C(B,H,200,function(){He(!0),$e.current(),Pe.current=!1,Ie(!1),null==d||d()})})}e=H}C(B,e,200,function(){He(!0),$e.current(),Pe.current=!1,Ie(!1),null==d||d()})})})}},[Le,kn,zn,Ee,me,Nn,ht]),Vt=c(function(e,n,t,i){var o="string"==typeof i?x(i).trim():x(null==i?void 0:i.deviation_summary).trim(),r=e.currentTarget;Fn(),Xt(n,t,o?{toggleIfSame:!1,onReady:function(){wn({open:!0,anchorEl:r,summary:i})}}:{toggleIfSame:!1})},[Xt,Fn,wn]),qt=c(function(){var e=mn.sectionIdx,n=mn.isOrphan;null!=e&&Xt(e,n)},[Xt,mn.isOrphan,mn.sectionIdx]),Jt=c(function(){In(),ht()},[In,ht]),Ut=null!==mn.sectionIdx&&Ne.has(mn.sectionIdx),Gt=O({proposedSections:Nn,existingSections:zn,parentDeviationRecord:Yn,expandedSections:gt,maintainRelativeOrder:!!me,scrollContainerRef:ln,leftContainerRef:pn,lhsBadgeRefs:Zn,rhsBadgeRefs:$n}),Qt=Gt.showDeviationNavigation,Zt=Gt.showOpenNodeRef;l(function(){if(ge){var e=function(e){var n=Yn[e].find(function(e){return e.id===ge});if(n){var t=Nn.findIndex(function(n){return n.id===e});(me?!!gt["right-".concat(t)]:!!gt[String(t)])||yt(t,"left");var i="".concat(n.id).concat(b,"0"),o=setInterval(function(){var e,n,t=null===(e=Zn.current[i])||void 0===e?void 0:e.current,r=null===(n=$n.current[i])||void 0===n?void 0:n.current;if(t){t.scrollIntoView({behavior:"smooth",block:"center"});var l=window.getComputedStyle(t).color;t.style.transition="box-shadow 300ms ease-in-out",t.style.boxShadow="0 0 10px ".concat(l),r&&(r.style.transition="box-shadow 300ms ease-in-out",r.style.boxShadow="0 0 10px ".concat(l)),setTimeout(function(){t.style.boxShadow="",r&&(r.style.boxShadow="")},2e3),clearTimeout(o)}},600);return"break"}};for(var n in Yn){if("break"===e(n))break}}},[ge]);var $t=function(e){var n=e.section,i=e.keyPath,o=e.depth,r=void 0===o?0:o,l=e.columnKey,c=void 0===l?"left":l,u=e.parentNodeId;return t(N,{section:n,keyPath:i,depth:r,columnKey:c,parentNodeId:void 0===u?"":u,expandedSubSections:xt,setExpandedSubSections:mt,maintainRelativeOrder:me||!1,proposedSections:Nn,existingSections:zn,treeData:le,deviationNumberRegistry:Kn,connectedSections:Ne,activeSideBySideSection:Le,resolvedMarkdownStyles:rn,getSubSectionRef:rt,getSubSectionCompareStyle:jt,getBadgeRef:lt,openMoreFunctionsPopup:Rt,openSummaryPopup:Vt,resetSideBySide:ht,setConnectedSections:ze,setConnectedLines:Ke,cachedConnectedPositions:Ue})};return n(u,e({ref:cn,sx:e(e({display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif'},me?{}:{overflow:"visible"}),{position:"relative"})},{children:[Se&&t(u,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:t(M,{})})),Cn.open&&t(z,{open:Cn.open,anchorEl:Cn.anchorEl,containerEl:Bt.current,onClose:Jt,summary:Cn.summary}),t(E,{open:mn.open,anchorEl:mn.anchorEl,sectionTitle:mn.sectionTitle,referenceSectionTitle:mn.refSectionTitle,onClose:kn,onOpenCognitiveCompare:Ct,onOpenSideBySide:qt,onConnect:wt,isConnected:Ut,isOrphan:mn.isOrphan}),gn.open&&t(k,{open:gn.open,popupRef:Tn,position:bn,popupConfig:pe,onClose:function(){Sn(null),xn(function(n){return e(e({},n),{open:!1})}),Bn(null)},markdownStyles:ae,sectionTitle:gn.sectionTitle,referenceSectionTitle:gn.refSectionTitle,cognitiveData:gn.cognitiveData,anchorEl:gn.anchorEl,sectionAnchorEl:gn.sectionAnchorEl,scrollContainerEl:ln.current,badgeStyle:gn.badgeStyle,docData:gn.docData,deviationData:gn.deviationData,isLoading:gn.isLoading}),t(d,e({open:!!Te,autoHideDuration:8e3,onClose:function(){return Fe(null)},anchorOrigin:{vertical:"top",horizontal:"center"}},{children:t(a,e({onClose:function(){return Fe(null)},severity:"error",sx:{width:"100%",whiteSpace:"pre-line"}},{children:Te}))})),t(P,{componentHeaderText:re,displayConfig:ve,maintainRelativeOrder:me,onToggleView:function(e){Re(!0),setTimeout(function(){ye(!e),ht(),ze(new Set),Ke([]),Ue.current=[],setTimeout(function(){Re(!1)},400)},50)}}),t(u,e({ref:ln,onScroll:Kt,sx:{flex:1,minHeight:0,pt:1.5,pb:1,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",overflowY:me?"hidden":"auto",borderTop:ut&&dt?"none":"1.5px solid #EEF0F4"}},{children:t(u,e({sx:e({display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"},me?{flex:1,minHeight:0}:{})},{children:n(u,e({ref:It,sx:e({display:"grid",gridTemplateColumns:"minmax(0, 1fr) 180px minmax(0, 1fr)",gap:"40px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0},me?{flex:1,overflow:"visible"}:{})},{children:[n("svg",e({ref:Xe,style:{position:"absolute",top:0,left:0,width:tn.width||"100%",height:tn.height||"100%",pointerEvents:"none",zIndex:10,overflow:"visible",transition:"opacity 0.15s ease-in-out"}},{children:[At&&t("g",{children:t("line",{x1:At.x1,y1:At.y,x2:At.x2,y2:At.y,stroke:pt.badgeBorder,strokeWidth:"1.5"})}),Dt.map(function(i){var o=i.x1+.5*(i.x2-i.x1),r=(i.y1+i.y2)/2;if("Not Defined"===i.style.label&&!i.hasCognitive)return null;if(i.isSubSection?Ee&&Le===i.subSectionKeyPath&&_e:Ee&&Le===i.sectionIdx&&_e)return n("g",e({style:{transition:"opacity 0.2s"}},{children:[t("defs",{children:t("marker",e({id:"arr-".concat(i.id),markerWidth:"7",markerHeight:"5",refX:"7",refY:"2.5",orient:"auto"},{children:t("polygon",{points:"0 0, 7 2.5, 0 5",fill:i.style.badgeBorder||"#6366F1"})}))}),t("line",{ref:Ft,x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2,stroke:i.style.badgeBorder||"#6366F1",strokeWidth:"1.5",markerEnd:"url(#arr-".concat(i.id,")")})]}),i.id);if(!me){var l=i.isSubSection?R(i.x1,i.y1,i.x2,i.y2):"M ".concat(i.x1," ").concat(i.y1," L ").concat(i.x2," ").concat(i.y2);return n("g",{children:[t("path",{d:l,fill:"none",stroke:i.style.badgeBorder||"#E2E8F0",strokeWidth:"1.5"}),t("foreignObject",e({x:o-100,y:r-14,width:"200",height:"28",style:{pointerEvents:"auto",overflow:"visible"}},{children:t(u,e({sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},{children:n(u,e({onClick:function(n){if(n.stopPropagation(),gn.open&&Rn===i.id)Fn();else{var t=Nn[i.sectionIdx]||{title:"",content:""},o=zn[i.sectionIdx]||{title:"",content:""};if(i.isSubSection&&i.subSectionKeyPath){for(var r=i.subSectionKeyPath.split(b)[2].split("-").map(Number),l=Nn[r[0]],c=zn[r[0]],u=(null==l?void 0:l.title)||"",d=(null==c?void 0:c.title)||"",a=1;a<r.length;a++)(null==l?void 0:l.subsections)&&(l=l.subsections[r[a]]),(null==c?void 0:c.subsections)&&(c=c.subsections[r[a]]);l&&(t=e(e({},l),{title:u||l.title})),c&&(o=e(e({},c),{title:d||c.title}))}Bn(i.id),St(bt(n.currentTarget,t,o,i.sectionIdx,i.style))}},sx:{display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",bgcolor:i.style.badgeBg,color:i.style.badgeText,border:"1px solid ".concat(i.style.badgeBorder),borderRadius:"12px",px:1.5,py:.5,fontWeight:600,textAlign:"center",whiteSpace:"nowrap",cursor:"pointer"}},{children:[i.style.badgeText===T&&null==i.style.label?t(D,{color:i.style.badgeText}):0===i.style.label?"Same":i.style.label,t(u,e({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:t(f,{})})),t(p,{size:11,style:{transform:gn.open&&Rn===i.id?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))}))]},i.id)}return null}),Ye.map(function(i){var o,r=i.pathD,l=(null===(o=i.style)||void 0===o?void 0:o.badgeBorder)||"#6366F1",c="conn-marker-".concat(i.id),u="".concat(i.id,"-bg"),d="".concat(i.id,"-stroke");return n("g",{children:[t("defs",{children:t("clipPath",e({id:"connections-clip"},{children:t("marker",e({id:c,markerWidth:"8",markerHeight:"6",refX:"7",refY:"3",orient:"auto"},{children:t("polygon",{points:"0 0, 8 3, 0 6",fill:l})}))}))}),t("path",{ref:function(e){Je.current[u]=e},d:r,fill:"none",stroke:"#FFFFFF",strokeWidth:"4",strokeOpacity:"0.7"}),t("path",{ref:function(e){Je.current[d]=e},d:r,fill:"none",stroke:l,strokeWidth:"1.75",markerEnd:"url(#".concat(c,")")})]},i.id)})]})),n(u,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)"},me?{flex:1,overflow:"visible"}:{})},{children:[t(u,e({ref:kt,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:t(s,e({title:An,placement:"top"},{children:t(v,e({sx:{fontSize:"16px",fontWeight:500,color:"#19213D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0,textAlign:"center",display:"block"}},{children:An}))}))})),n(u,e({ref:pn,onScroll:Kt,sx:e({p:"12px",display:"flex",flexDirection:"column"},me?{maxHeight:"calc(100vh - 150px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,mr:"-160px",pr:"172px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[t("div",{ref:sn,style:{width:"100%",height:"0px",flexShrink:0}}),Vn&&Nn.map(function(i,o){var r,l,c=!i.title&&!i.content;if(me&&c)return null;var d=i,a=Pt(o),s=me?!(null===(r=d.refIndexes)||void 0===r?void 0:r.length)||d.selfIndex<0:!zn[o],v=me?"number"==typeof d.selfIndex&&d.selfIndex>=0?d.selfIndex+1:null:o+1,p=Ne.has(o),f=m(d.evaluationResult,null==a?void 0:a.deviationLabel);return t(u,e({ref:ot(o),sx:{mb:1,width:"100%"}},{children:n(u,e({sx:{position:"relative",width:"100%"}},{children:[t(u,e({ref:Gn.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:t(j,{section:i,idx:o,columnKey:"left",colRef:ot("left-accordion-".concat(o)),mb:0,treeData:le,proposedSections:Nn,existingSections:zn,deviationNumberRegistry:Kn,getSectionCompareStyle:Pt,getBadgeRef:lt,connectedSections:Ne,openMoreFunctionsPopup:Rt,openSummaryPopup:Vt,parentNodeId:(null===(l=null==le?void 0:le.input_index_map)||void 0===l?void 0:l[0])||"",isExpanded:me?!!gt["left-".concat(o)]:!!gt[String(o)],onToggle:function(){return yt(o,"left")},navigation:i.id?Qt[i.id]:null,showOpenNodeRef:Zt,resolvedMarkdownStyles:rn,maintainRelativeOrder:me,renderSubSections:$t})})),me&&a&&n(u,e({ref:Zn.current[o],onClick:function(e){var n=me?zn.find(function(e){var n;return null===(n=d.refIndexes)||void 0===n?void 0:n.includes(e.selfIndex)})||{title:"",content:""}:zn[o]||{title:"",content:""};Rt(e,i,s,n,o,a)},sx:{position:"absolute",top:"18px",right:0,transform:"translateY(-50%) translateX(calc(100% + 8px))",display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",bgcolor:a.badgeBg,color:a.badgeText,border:"1px solid ".concat(a.badgeBorder),borderRadius:"12px",px:1.2,py:.4,fontWeight:600,cursor:"pointer",whiteSpace:"nowrap",zIndex:20,boxShadow:"0 1px 3px rgba(0,0,0,0.07)"}},{children:[null!==v&&t(u,e({component:"span",sx:{fontSize:"11px",fontWeight:700,pr:.5,borderRight:"1px solid ".concat(a.badgeBorder)}},{children:v})),t(u,e({component:"span",sx:{fontSize:"11px",px:.25}},{children:!ve.isLoading||null!=d.evaluationResult&&null!=d.evaluationResult?s?"No Deviation Found":"N/A"===f||"NA"===f?"N/A":0==f||null==f?"Same":"".concat(f):t(D,{color:a.badgeText})})),t(h,{size:11,color:a.badgeText})]}))]}))}),"left-row-".concat(o))}),t("div",{ref:vn,style:{width:"100%",height:"0px",flexShrink:0}})]}))]})),t(u,e({ref:Bt,sx:{width:"180px",display:"flex",flexDirection:"column",alignItems:"center",pt:"15px",gap:0,zIndex:20,pointerEvents:"none"}},{children:t(u,e({sx:{display:"flex",justifyContent:"center",alignItems:"center",mt:0}},{children:n(u,e({onClick:function(n){n.stopPropagation(),gn.open&&Rn===at?Fn():(Bn(at),St(bt(n.currentTarget,{title:"",content:"",evaluationResult:st,cognitiveData:{section_id:"",decisioning:[],gap:[],relevance_score:0,isMissingRationale:!0}},null,at,!0,e(e({},pt),{label:""}))))},sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:"5px",top:"-5px",borderRadius:"20px",bgcolor:pt.badgeBg,color:pt.badgeText,border:"1px solid ".concat(pt.badgeBorder),fontSize:"12px",fontWeight:600,whiteSpace:"nowrap",position:"relative",zIndex:1,pointerEvents:"auto",cursor:"pointer"}},{children:[null!=vt?vt:t(D,{}),t(u,e({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:t(f,{})})),t(p,{size:11,style:{transform:gn.open&&Rn===at?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))})),n(u,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},me?{flex:1,overflow:"visible",minHeight:0}:{})},{children:[we&&t(g,{sections:11}),t(u,e({ref:Et,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E3E6EA",borderRadius:"8px 8px 0 0",minHeight:"40px",display:"flex",alignItems:"center",overflowX:"hidden"}},{children:t(s,e({title:Ln,placement:"top"},{children:t(v,e({sx:{fontSize:"16px",fontWeight:500,color:"#5928ED",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0,textAlign:"center",display:"block"}},{children:Ln}))}))})),n(u,e({ref:un,onScroll:Kt,sx:e({p:"12px",display:"flex",flexDirection:"column"},me?{maxHeight:"calc(100vh - 150px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,ml:"-120px",pl:"140px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[t("div",{ref:dn,style:{width:"100%",height:"0px",flexShrink:0}}),Vn&&zn.map(function(i,o){var r,l=i,c=[],d=!1,a=null;if(me){c=Nn.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});var s=Nn.findIndex(function(e,n){var t;return Ne.has(n)&&(null===(t=e.refIndexes)||void 0===t?void 0:t.includes(l.selfIndex))});(d=-1!==s)&&(a=Pt(s))}else c=[o+1],(d=Ne.has(o))&&(a=Pt(o));var v=Pt(o);return t(u,e({ref:et.current[o],sx:{mb:1,width:"100%"}},{children:n(u,e({sx:{position:"relative",width:"100%"}},{children:[t(u,e({ref:Qn.current[o],sx:e({width:"100%",display:"flex"},d&&a&&{borderRadius:"6px",outline:"2px solid ".concat(a.badgeBorder),outlineOffset:"1px"})},{children:t(j,{section:i,idx:o,columnKey:"right",colRef:ot("right-accordion-".concat(o)),mb:0,parentNodeId:(null===(r=null==le?void 0:le.input_index_map)||void 0===r?void 0:r[1])||"",isExpanded:me?!!gt["right-".concat(o)]:!!gt[String(o)],treeData:le,proposedSections:Nn,existingSections:zn,deviationNumberRegistry:Kn,getBadgeRef:lt,getSectionCompareStyle:Pt,connectedSections:Ne,openMoreFunctionsPopup:Rt,openSummaryPopup:Vt,onToggle:function(){return yt(o,"right")},navigation:i.id?Qt[i.id]:null,showOpenNodeRef:Zt,resolvedMarkdownStyles:rn,maintainRelativeOrder:me,renderSubSections:$t})})),me&&!we&&v&&t(u,e({ref:$n.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:c.length>0?c.join(", "):"-"}))]}))}),"right-row-".concat(o))}),t("div",{ref:an,style:{width:"100%",height:"0px",flexShrink:0}})]}))]}))]}))}))}))]}))};export{W as default};
2
2
  //# sourceMappingURL=CognitiveCompare.js.map
@@ -1,2 +1,2 @@
1
- import{__assign as o}from"tslib";import{jsxs as e,jsx as t}from"react/jsx-runtime";import{Popover as i,Box as n,Typography as r,IconButton as l}from"@mui/material";import{Info as a,X as c}from"lucide-react";function d(d){var s,m,p=d.open,h=d.anchorEl,u=d.containerEl,x=d.onClose,f=d.summary,g=d.markdownStyles;if(d.isLoading,!f)return null;var v="string"==typeof f?{deviation_summary:f}:f;v.deviation_title;var b=v.deviation_summary,y=v.evaluation_outputs,w=(null===(s=null==y?void 0:y.metadata)||void 0===s?void 0:s.label_color)||"#6366F1",C=null!==(m=null==u?void 0:u.getBoundingClientRect().width)&&void 0!==m?m:180,z=Math.max(148,Math.min(172,C-8)),F=h&&u?{top:h.getBoundingClientRect().bottom+8,left:u.getBoundingClientRect().left+u.getBoundingClientRect().width/2}:null;return e(i,o({open:p,anchorEl:F?void 0:h,anchorReference:F?"anchorPosition":"anchorEl",anchorPosition:F||void 0,onClose:x,disableScrollLock:!0,anchorOrigin:{vertical:"bottom",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},slotProps:{paper:{sx:o({mt:0,p:1.5,borderRadius:"12px",boxShadow:"0px 10px 24px rgba(15, 23, 42, 0.18)",width:"".concat(z,"px"),maxWidth:"".concat(z,"px"),bgcolor:"#FFFFFF",opacity:1,border:"1px solid ".concat(w,"26"),borderTop:"3px solid ".concat(w),overflow:"hidden"},g)}}},{children:[e(n,o({sx:{display:"flex",alignItems:"center",justifyContent:"space-between",mb:.75}},{children:[e(n,o({sx:{display:"flex",alignItems:"center",gap:.75,minWidth:0}},{children:[t(a,{size:14,color:w}),t(r,o({sx:{fontSize:"11px",fontWeight:700,color:w,textTransform:"uppercase",letterSpacing:"0.4px",lineHeight:1.2}},{children:"Summary"}))]})),t(l,o({size:"small",onClick:x,sx:{p:.25,ml:.5,color:"#64748B"}},{children:t(c,{size:14})}))]})),t(r,o({sx:{fontSize:"12px",color:"#475569",lineHeight:1.5,fontWeight:400,overflowWrap:"anywhere"}},{children:b||"No summary available."}))]}))}export{d as default};
1
+ import{__assign as o}from"tslib";import{jsxs as e,jsx as t}from"react/jsx-runtime";import{Popover as i,Box as n,Typography as r,IconButton as l}from"@mui/material";import{Info as a,X as c}from"lucide-react";function d(d){var s,p,m=d.open,h=d.anchorEl,u=d.containerEl,x=d.onClose,f=d.summary,g=d.markdownStyles;if(d.isLoading,!f)return null;var v="string"==typeof f?{deviation_summary:f}:f;v.deviation_title;var b=v.deviation_summary,y=v.evaluation_outputs,w=(null===(s=null==y?void 0:y.metadata)||void 0===s?void 0:s.label_color)||"#6366F1",C=null!==(p=null==u?void 0:u.getBoundingClientRect().width)&&void 0!==p?p:180,z=Math.max(148,C),F=h&&u?{top:h.getBoundingClientRect().bottom+8,left:u.getBoundingClientRect().left+u.getBoundingClientRect().width/2}:null;return e(i,o({open:m,anchorEl:F?void 0:h,anchorReference:F?"anchorPosition":"anchorEl",anchorPosition:F||void 0,onClose:x,disableScrollLock:!0,anchorOrigin:{vertical:"bottom",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},slotProps:{paper:{sx:o({mt:0,p:1.5,borderRadius:"12px",boxShadow:"0px 10px 24px rgba(15, 23, 42, 0.18)",width:"".concat(z,"px"),maxWidth:"".concat(z,"px"),bgcolor:"#FFFFFF",opacity:1,border:"1px solid ".concat(w,"26"),borderTop:"3px solid ".concat(w),overflow:"hidden"},g)}}},{children:[e(n,o({sx:{display:"flex",alignItems:"center",justifyContent:"space-between",mb:.75}},{children:[e(n,o({sx:{display:"flex",alignItems:"center",gap:.75,minWidth:0}},{children:[t(a,{size:14,color:w}),t(r,o({sx:{fontSize:"11px",fontWeight:700,color:w,textTransform:"uppercase",letterSpacing:"0.4px",lineHeight:1.2}},{children:"Summary"}))]})),t(l,o({size:"small",onClick:x,sx:{p:.25,ml:.5,color:"#64748B"}},{children:t(c,{size:14})}))]})),t(r,o({sx:{fontSize:"12px",color:"#475569",lineHeight:1.5,fontWeight:400,overflowWrap:"anywhere"}},{children:b||"No summary available."}))]}))}export{d as default};
2
2
  //# sourceMappingURL=CognitiveSummaryPopup.js.map
@@ -1,2 +1,2 @@
1
- import{__assign as o}from"tslib";import{jsxs as e,jsx as n}from"react/jsx-runtime";import t,{useEffect as i}from"react";import{Box as l,Accordion as r,AccordionSummary as d,Tooltip as c,Typography as a,AccordionDetails as u}from"@mui/material";import{ChevronUp as s,ChevronDown as v}from"lucide-react";import{MemoizedMarkdown as p}from"../hooks/memoizedMarkdown.js";import{hasValue as f,generateColorPalette as h,isMissingStr as m,safeStringify as x,escapeRegExp as g,DEVIATION_BADGE_SEPARATOR as w}from"../CognitiveComparehelpers.js";import{DEFAULT_DEVIAION_COLOR as y}from"../CognitiveCompareConstants.js";var b=function(b){var S,F,k,I,R,C,_,B,A,M,W,E,O,N,j,T=b.section,D=b.idx,P=b.columnKey,z=b.colRef,K=b.mb,V=void 0===K?1:K,G=b.parentNodeId,X=void 0===G?"":G,Y=b.isExpanded,H=b.onToggle,$=b.navigation,q=b.showOpenNodeRef,J=b.resolvedMarkdownStyles,L=b.maintainRelativeOrder,Q=b.renderSubSections,U=b.treeData,Z=b.proposedSections,oo=void 0===Z?[]:Z,eo=b.existingSections,no=void 0===eo?[]:eo,to=b.deviationNumberRegistry,io=void 0===to?{}:to,lo=b.getBadgeRef,ro=b.openSummaryPopup,co=b.getSectionCompareStyle,ao=b.connectedSections,uo=b.openMoreFunctionsPopup,so=(null===(S=T.displayTitle)||void 0===S||S)&&f(T.title),vo=(null===(F=T.displayContent)||void 0===F||F)&&f(T.content),po=!so&&!vo,fo={current:1},ho=T.title;so||(ho=vo?"No Title Found":"No Matching Section Found");var mo,xo=null!==(C=null===(R=null===(I=null===(k=T.evaluationResult)||void 0===k?void 0:k.evaluation_outputs)||void 0===I?void 0:I.metadata)||void 0===R?void 0:R.label_color)&&void 0!==C?C:y,go=h(xo).highlightBg,wo=T.id,yo=null!==(A=null===(B=null===(_=T.evaluationResult)||void 0===_?void 0:_.evaluation_outputs)||void 0===B?void 0:B.output_value)&&void 0!==A?A:null,bo=(null===(M=T.evaluationResult)||void 0===M?void 0:M.deviations)||{},So=null===(W=null==U?void 0:U.input_index_map)||void 0===W?void 0:W[0],Fo=null===(E=null==U?void 0:U.input_index_map)||void 0===E?void 0:E[1],ko="left"===P?Fo:So,Io=L?!(null===(O=T.refIndexes)||void 0===O?void 0:O.length)||void 0!==T.selfIndex&&T.selfIndex<0:"left"===P?!no[D]:!oo[D],Ro=L&&void 0!==T.selfIndex&&T.selfIndex>=0?T.selfIndex+1:D+1,Co=[],_o=Object.entries(bo).map(function(o){var e,n,t=o[0],i=o[1],l="".concat(wo).concat(w).concat(t),r=io[l];if(!r)return null;var d=i[X],c=m(d);if(c)d="";else if(!d)return null;Co.push(d);var a=i[ko],u="left"===P?null===(e=oo[D])||void 0===e?void 0:e.content:null===(n=no[D])||void 0===n?void 0:n.content,s=x(u),v=Object.keys(bo).map(function(o){return{key:o,text:bo[o][ko]}}).filter(function(o){return!m(o.text)}).sort(function(o,e){return e.text.length-o.text.length}),p=new Set;v.forEach(function(o){var e=o.text.replace(/\\(['’])/g,"$1").replace(/\\n/g,"\n");if(e){var n=new RegExp(g(e));n.test(s)&&(p.add(o.key),s=s.replace(n,"__TOKEN_".concat(o.key,"__")))}});var f=!m(a)&&!p.has(t),h=Io||m(a)||f,y="".concat(Ro,".").concat(r),b="".concat(wo).concat(w).concat(t).concat(w).concat(D).concat(w).concat(D),S=co?co(D):null;return{id:l,actionId:b,label:y,highlight:d,side:P,style:S,score:yo,isConnected:null==ao?void 0:ao.has(b),isOrphan:h,isMissingClause:c,badgeRef:lo(P,l),onClick:function(o){var e;o.stopPropagation();var n=no[D]||{title:"",content:""};if(L&&"left"===P){var t=null===(e=T.refIndexes)||void 0===e?void 0:e[0],i=no.findIndex(function(o){return o.selfIndex===t});-1!==i&&(n=no[i])}uo&&uo(o,T,h,n,b,S)},onSummaryClick:function(o){o.stopPropagation(),ro(o,b,h,T.evaluationResult||null)}}}).filter(Boolean),Bo=T.id&&P===(null==$?void 0:$.columnKey)?$:null;return i(function(){Y&&q.current===T.id&&(null==Bo?void 0:Bo.showBelow)&&setTimeout(function(){var o,e;q.current===T.id&&(q.current="",null===(e=null===(o=null==Bo?void 0:Bo.showBelowRef)||void 0===o?void 0:o.current)||void 0===e||e.scrollIntoView({behavior:"smooth",block:"center"}))},600)},[Y,T.id,Bo,q]),e(l,o({ref:z,sx:{mb:V,width:"100%",display:"flex",flexDirection:"column",position:"relative",minWidth:0}},{children:[Y&&(null==Bo?void 0:Bo.showAbove)&&n("div",o({style:{position:"sticky",top:0,height:"0px",cursor:"pointer"},onClick:function(){var o,e;return null===(e=null===(o=null==Bo?void 0:Bo.showAboveRef)||void 0===o?void 0:o.current)||void 0===e?void 0:e.scrollIntoView({behavior:"smooth",block:"center"})}},{children:n("div",o({style:o({transform:"translateY(-50%) translateX(calc(100% ".concat("left"===P?"+":"-"," 130px))"),position:"absolute",paddingTop:"20px"},"left"===P?{right:"0px"}:{left:"0px"})},{children:n(s,{color:window.getComputedStyle(null===(N=null==Bo?void 0:Bo.showAboveRef)||void 0===N?void 0:N.current).color})}))})),e(r,o({disableGutters:!0,expanded:!po&&Y,onChange:function(){po||(H(),q.current=T.id)},sx:{boxShadow:"none",border:po?"1px dashed #E2E8F0":"1px solid #E2E8F0",bgcolor:po?"#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(d,o({expandIcon:po?null:n(v,{size:16}),sx:{minHeight:"36px",flexShrink:0,cursor:po?"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:so&&n(c,o({title:ho,placement:"top"},{children:n(a,o({component:"div",sx:{fontSize:"12px",color:po?"#94A3B8":"#19213D",fontWeight:po?400:700,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0}},{children:(mo=ho,mo?x(mo).replace(/\\n/g,"\n").split(/(\*\*.*?\*\*)/g).map(function(o,e){return o.startsWith("**")&&o.endsWith("**")?n("strong",{children:o.slice(2,-2)},e):n(t.Fragment,{children:o},e)}):null)}))}))})),!po&&e(u,o({sx:{pt:0,pb:1.25,bgcolor:"#FFFFFF",flex:1,display:"flex",flexDirection:"column",minWidth:0}},{children:[vo&&n(p,{content:T.content,sxStyles:J,highlights:Co,maintainRelativeOrder:L,highlightBg:go,deviationBadges:_o}),(T.subsections||[]).map(function(o,e){return Q({section:o,keyPath:"".concat(D,"-").concat(e),depth:0,columnKey:P,parentNodeId:X,devCounter:fo})})]}))]})),Y&&(null==Bo?void 0:Bo.showBelow)&&n("div",o({style:{position:"sticky",bottom:0,height:"0px",cursor:"pointer"},onClick:function(){var o,e;return null===(e=null===(o=null==Bo?void 0:Bo.showBelowRef)||void 0===o?void 0:o.current)||void 0===e?void 0:e.scrollIntoView({behavior:"smooth",block:"center"})}},{children:n("div",o({style:o({transform:"translateY(-50%) translateX(calc(100% ".concat("left"===P?"+":"-"," 130px))"),position:"absolute",paddingBottom:"20px"},"left"===P?{right:"0px"}:{left:"0px"})},{children:n(v,{color:window.getComputedStyle(null===(j=null==Bo?void 0:Bo.showBelowRef)||void 0===j?void 0:j.current).color})}))}))]}),"".concat(P,"-sec-").concat(D))};export{b as default};
1
+ import{__assign as o}from"tslib";import{jsxs as e,jsx as n}from"react/jsx-runtime";import t,{useEffect as i}from"react";import{Box as l,Accordion as r,AccordionSummary as d,Tooltip as a,Typography as c,AccordionDetails as u}from"@mui/material";import{ChevronUp as s,ChevronDown as v}from"lucide-react";import{MemoizedMarkdown as p}from"../hooks/memoizedMarkdown.js";import{hasValue as f,generateColorPalette as m,isMissingStr as h,safeStringify as x,escapeRegExp as g,DEVIATION_BADGE_SEPARATOR as y}from"../CognitiveComparehelpers.js";import{DEFAULT_DEVIAION_COLOR as w}from"../CognitiveCompareConstants.js";var b=function(b){var S,F,k,I,_,R,C,B,A,M,W,E,O,N,j,T=b.section,D=b.idx,P=b.columnKey,z=b.colRef,K=b.mb,V=void 0===K?1:K,G=b.parentNodeId,X=void 0===G?"":G,Y=b.isExpanded,H=b.onToggle,$=b.navigation,q=b.showOpenNodeRef,J=b.resolvedMarkdownStyles,L=b.maintainRelativeOrder,Q=b.renderSubSections,U=b.treeData,Z=b.proposedSections,oo=void 0===Z?[]:Z,eo=b.existingSections,no=void 0===eo?[]:eo,to=b.deviationNumberRegistry,io=void 0===to?{}:to,lo=b.getBadgeRef,ro=b.openSummaryPopup,ao=b.getSectionCompareStyle,co=b.connectedSections,uo=b.openMoreFunctionsPopup,so=(null===(S=T.displayTitle)||void 0===S||S)&&f(T.title),vo=(null===(F=T.displayContent)||void 0===F||F)&&f(T.content),po=!so&&!vo,fo={current:1},mo=T.title;so||(mo=vo?"No Title Found":"No Matching Section Found");var ho,xo=null!==(R=null===(_=null===(I=null===(k=T.evaluationResult)||void 0===k?void 0:k.evaluation_outputs)||void 0===I?void 0:I.metadata)||void 0===_?void 0:_.label_color)&&void 0!==R?R:w,go=m(xo).highlightBg,yo=T.id,wo=null!==(A=null===(B=null===(C=T.evaluationResult)||void 0===C?void 0:C.evaluation_outputs)||void 0===B?void 0:B.output_value)&&void 0!==A?A:null,bo=(null===(M=T.evaluationResult)||void 0===M?void 0:M.deviations)||{},So=null===(W=null==U?void 0:U.input_index_map)||void 0===W?void 0:W[0],Fo=null===(E=null==U?void 0:U.input_index_map)||void 0===E?void 0:E[1],ko="left"===P?Fo:So,Io=L?!(null===(O=T.refIndexes)||void 0===O?void 0:O.length)||void 0!==T.selfIndex&&T.selfIndex<0:"left"===P?!no[D]:!oo[D],_o=L&&void 0!==T.selfIndex&&T.selfIndex>=0?T.selfIndex+1:D+1,Ro=[],Co=Object.entries(bo).map(function(o){var e,n,t,i,l=o[0],r=o[1],d="".concat(yo).concat(y).concat(l),a=io[d];if(!a)return null;var c=r[X],u=h(c);if(u)c="";else if(!c)return null;Ro.push(c);var s=r[ko],v="left"===P?null===(e=oo[D])||void 0===e?void 0:e.content:null===(n=no[D])||void 0===n?void 0:n.content,p=x(v),f=Object.keys(bo).map(function(o){return{key:o,text:bo[o][ko]}}).filter(function(o){return!h(o.text)}).sort(function(o,e){return e.text.length-o.text.length}),m=new Set;f.forEach(function(o){var e=o.text.replace(/\\(['’])/g,"$1").replace(/\\n/g,"\n");if(e){var n=new RegExp(g(e));n.test(p)&&(m.add(o.key),p=p.replace(n,"__TOKEN_".concat(o.key,"__")))}});var w=!h(s)&&!m.has(l),b=Io||h(s)||w,S="".concat(_o,".").concat(a),F="".concat(yo).concat(y).concat(l).concat(y).concat(D).concat(y).concat(D),k=ao?ao(D):null,I=(null==r?void 0:r.deviation_summary)?{deviation_summary:r.deviation_summary,deviation_title:null===(t=T.evaluationResult)||void 0===t?void 0:t.deviation_title,evaluation_outputs:null===(i=T.evaluationResult)||void 0===i?void 0:i.evaluation_outputs}:null;return{id:d,actionId:F,label:S,highlight:c,side:P,style:k,score:wo,isConnected:null==co?void 0:co.has(F),isOrphan:b,isMissingClause:u,badgeRef:lo(P,d),onClick:function(o){var e;o.stopPropagation();var n=no[D]||{title:"",content:""};if(L&&"left"===P){var t=null===(e=T.refIndexes)||void 0===e?void 0:e[0],i=no.findIndex(function(o){return o.selfIndex===t});-1!==i&&(n=no[i])}uo&&uo(o,T,b,n,F,k)},onSummaryClick:function(o){o.stopPropagation(),ro(o,F,b,I)}}}).filter(Boolean),Bo=T.id&&P===(null==$?void 0:$.columnKey)?$:null;return i(function(){Y&&q.current===T.id&&(null==Bo?void 0:Bo.showBelow)&&setTimeout(function(){var o,e;q.current===T.id&&(q.current="",null===(e=null===(o=null==Bo?void 0:Bo.showBelowRef)||void 0===o?void 0:o.current)||void 0===e||e.scrollIntoView({behavior:"smooth",block:"center"}))},600)},[Y,T.id,Bo,q]),e(l,o({ref:z,sx:{mb:V,width:"100%",display:"flex",flexDirection:"column",position:"relative",minWidth:0}},{children:[Y&&(null==Bo?void 0:Bo.showAbove)&&n("div",o({style:{position:"sticky",top:0,height:"0px",cursor:"pointer"},onClick:function(){var o,e;return null===(e=null===(o=null==Bo?void 0:Bo.showAboveRef)||void 0===o?void 0:o.current)||void 0===e?void 0:e.scrollIntoView({behavior:"smooth",block:"center"})}},{children:n("div",o({style:o({transform:"translateY(-50%) translateX(calc(100% ".concat("left"===P?"+":"-"," 130px))"),position:"absolute",paddingTop:"20px"},"left"===P?{right:"0px"}:{left:"0px"})},{children:n(s,{color:window.getComputedStyle(null===(N=null==Bo?void 0:Bo.showAboveRef)||void 0===N?void 0:N.current).color})}))})),e(r,o({disableGutters:!0,expanded:!po&&Y,onChange:function(){po||(H(),q.current=T.id)},sx:{boxShadow:"none",border:po?"1px dashed #E2E8F0":"1px solid #E2E8F0",bgcolor:po?"#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(d,o({expandIcon:po?null:n(v,{size:16}),sx:{minHeight:"36px",flexShrink:0,cursor:po?"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:so&&n(a,o({title:mo,placement:"top"},{children:n(c,o({component:"div",sx:{fontSize:"12px",color:po?"#94A3B8":"#19213D",fontWeight:po?400:700,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0}},{children:(ho=mo,ho?x(ho).replace(/\\n/g,"\n").split(/(\*\*.*?\*\*)/g).map(function(o,e){return o.startsWith("**")&&o.endsWith("**")?n("strong",{children:o.slice(2,-2)},e):n(t.Fragment,{children:o},e)}):null)}))}))})),!po&&e(u,o({sx:{pt:0,pb:1.25,bgcolor:"#FFFFFF",flex:1,display:"flex",flexDirection:"column",minWidth:0}},{children:[vo&&n(p,{content:T.content,sxStyles:J,highlights:Ro,maintainRelativeOrder:L,highlightBg:go,deviationBadges:Co}),(T.subsections||[]).map(function(o,e){return Q({section:o,keyPath:"".concat(D,"-").concat(e),depth:0,columnKey:P,parentNodeId:X,devCounter:fo})})]}))]})),Y&&(null==Bo?void 0:Bo.showBelow)&&n("div",o({style:{position:"sticky",bottom:0,height:"0px",cursor:"pointer"},onClick:function(){var o,e;return null===(e=null===(o=null==Bo?void 0:Bo.showBelowRef)||void 0===o?void 0:o.current)||void 0===e?void 0:e.scrollIntoView({behavior:"smooth",block:"center"})}},{children:n("div",o({style:o({transform:"translateY(-50%) translateX(calc(100% ".concat("left"===P?"+":"-"," 130px))"),position:"absolute",paddingBottom:"20px"},"left"===P?{right:"0px"}:{left:"0px"})},{children:n(v,{color:window.getComputedStyle(null===(j=null==Bo?void 0:Bo.showBelowRef)||void 0===j?void 0:j.current).color})}))}))]}),"".concat(P,"-sec-").concat(D))};export{b as default};
2
2
  //# sourceMappingURL=SectionAccordion.js.map
@@ -1,2 +1,2 @@
1
- import{__spreadArray as e,__assign as n}from"tslib";import{jsx as i,jsxs as t}from"react/jsx-runtime";import o from"react";import{Box as l,Accordion as d,AccordionSummary as a,Typography as r,AccordionDetails as s}from"@mui/material";import{ChevronDown as c}from"lucide-react";import{MemoizedMarkdown as u}from"../hooks/memoizedMarkdown.js";import{hasValue as v,generateColorPalette as p,isMissingStr as h,DEVIATION_BADGE_SEPARATOR as f}from"../CognitiveComparehelpers.js";import{DEFAULT_DEVIAION_COLOR as m}from"../CognitiveCompareConstants.js";var g=o.memo(function(o){var x,S,b,y,I,C,w,R,B,F,j,k,O,P,_,W,E=o.section,M=o.keyPath,N=o.depth,z=void 0===N?0:N,A=o.columnKey,D=void 0===A?"left":A,T=o.parentNodeId,G=void 0===T?"":T,H=o.expandedSubSections,K=o.setExpandedSubSections,L=o.maintainRelativeOrder,U=o.proposedSections,q=o.existingSections,J=o.treeData,Q=o.deviationNumberRegistry,V=o.connectedSections,X=o.activeSideBySideSection,Y=o.resolvedMarkdownStyles,Z=o.getSubSectionRef,$=o.getSubSectionCompareStyle,ee=o.getBadgeRef,ne=o.openMoreFunctionsPopup,ie=o.openSummaryPopup,te=o.resetSideBySide,oe=o.setConnectedSections,le=o.setConnectedLines,de=o.cachedConnectedPositions,ae=(null===(x=E.displayTitle)||void 0===x||x)&&v(E.title),re=(null===(S=E.displayContent)||void 0===S||S)&&v(E.content),se=!ae&&!re,ce=ae?E.title:re?"No Title Found":"No Matching Section Found",ue=!!H[M],ve=Z(D,M),pe=$(M),he=M.split("-").map(Number),fe=he[0],me=U[fe],ge=q[fe],xe=M,Se=M;if(L)if("left"===D){var be=null===(b=null==me?void 0:me.refIndexes)||void 0===b?void 0:b[0],ye=q.findIndex(function(e){return e.selfIndex===be});-1!==ye&&(ge=q[ye],Se=e([ye],he.slice(1),!0).join("-"))}else{var Ie=null===(y=null==ge?void 0:ge.refIndexes)||void 0===y?void 0:y[0],Ce=U.findIndex(function(e){return e.selfIndex===Ie});-1!==Ce&&(me=U[Ce],xe=e([Ce],he.slice(1),!0).join("-"))}var we="left"===D?me:ge;W=L&&void 0!==(null==we?void 0:we.selfIndex)&&we.selfIndex>=0?we.selfIndex+1:fe+1;for(var Re=me,Be=ge,Fe=1;Fe<he.length;Fe++)(null==Re?void 0:Re.subsections)&&(Re=Re.subsections[he[Fe]]),(null==Be?void 0:Be.subsections)&&(Be=Be.subsections[he[Fe]]);var je=null===(I=null==J?void 0:J.input_index_map)||void 0===I?void 0:I[0],ke=null===(C=null==J?void 0:J.input_index_map)||void 0===C?void 0:C[1],Oe="left"===D?ke:je,Pe=L?!(null===(w=E.refIndexes)||void 0===w?void 0:w.length)||void 0!==E.selfIndex&&E.selfIndex<0:"left"===D?!Be:!Re,_e=null!==(F=null===(B=null===(R=E.evaluationResult)||void 0===R?void 0:R.evaluation_outputs)||void 0===B?void 0:B.output_value)&&void 0!==F?F:null,We=E.id,Ee=null!==(P=null===(O=null===(k=null===(j=E.evaluationResult)||void 0===j?void 0:j.evaluation_outputs)||void 0===k?void 0:k.metadata)||void 0===O?void 0:O.label_color)&&void 0!==P?P:m,Me=p(Ee).highlightBg,Ne=(null===(_=E.evaluationResult)||void 0===_?void 0:_.deviations)||{},ze=[],Ae=Object.entries(Ne).map(function(e){var i=e[0],t=e[1],o="".concat(We).concat(f).concat(i),l=Q[o];if(!l)return null;var d=t[G],a=h(d);if(a)d="";else if(!d)return null;ze.push(d);var r=t[Oe],s=!1;r&&(s=Object.values(Ne).map(function(e){return e[Oe]}).filter(Boolean).some(function(e){return e.length>r.length&&e.includes(r)}));var c=Pe||h(r)||s,u="".concat(W,".").concat(l),v="".concat(We).concat(f).concat(i).concat(f).concat(xe).concat(f).concat(Se);return{id:o,actionId:v,label:u,highlight:d,side:D,style:pe,score:_e,isConnected:V.has(v),isOrphan:c,isMissingClause:a,badgeRef:ee(D,o),onClick:function(e){e.stopPropagation();var i=n(n({},Re),{title:(null==me?void 0:me.title)||(null==Re?void 0:Re.title)||""}),t=n(n({},Be),{title:(null==ge?void 0:ge.title)||(null==Be?void 0:Be.title)||""});ne(e,i,c,t,v,pe)},onSummaryClick:function(e){e.stopPropagation(),ie(e,v,c,E.evaluationResult||null)}}}).filter(Boolean),De=Ae.some(function(e){return V.has(e.actionId)});if(!(ae||re||E.subsections&&0!==E.subsections.length))return null;var Te=!L&&ae&&re,Ge=De&&pe?{borderRadius:"4px",outline:"2px solid ".concat(pe.badgeBorder),outlineOffset:"1px"}:{};return i(l,ae?n({ref:ve,sx:{mt:1,width:"100%",minWidth:0,position:"relative"}},{children:i(l,n({sx:n({width:"100%"},Ge)},{children:t(d,n({disableGutters:!0,expanded:!se&&ue,onChange:function(){if(!se){if(ue){var e=String(X||""),i=e.includes(xe)||e.includes(Se);i||V.forEach(function(e){(String(e).includes(xe)||String(e).includes(Se))&&(i=!0)}),i&&(te(),oe(new Set),le([]),de.current=[])}K(function(e){var i;return n(n({},e),((i={})[M]=!e[M],i))})}},sx:{mt:0,boxShadow:"none",border:se?"1px dashed #E2E8F0":"1px solid #EEF2F7",borderRadius:"4px !important",bgcolor:"#FFFFFF",minWidth:0,"&:before":{display:"none"}}},{children:[i(a,n({expandIcon:se?null:i(c,{size:14}),sx:{minHeight:"32px","& .MuiAccordionSummary-content":{my:.5,display:"grid",alignItems:"center",minWidth:0,width:"100%"}}},{children:i(r,n({component:"div",sx:{fontSize:"11px",fontWeight:600,color:se?"#94A3B8":"#19213D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0}},{children:ce||"Untitled Subsection"}))})),!se&&t(s,n({sx:{pt:0,pb:1,minWidth:0}},{children:[re&&i(u,{content:E.content,sxStyles:Y,deviationBadges:Te?[]:Ae,maintainRelativeOrder:L,highlightBg:Me,highlights:ze}),(E.subsections||[]).map(function(e,t){return i(g,n({},o,{section:e,keyPath:"".concat(M,"-").concat(t),depth:z+1}),"".concat(M,"-").concat(t))})]}))]}))}))}):n({ref:ve,sx:{mt:0===z?1:.75,width:"100%",minWidth:0,position:"relative"}},{children:!se&&t(l,n({sx:n({width:"100%"},Ge)},{children:[re&&i(u,{content:E.content,sxStyles:Y,deviationBadges:Ae,maintainRelativeOrder:L,highlightBg:Me,highlights:ze}),(E.subsections||[]).map(function(e,t){return i(g,n({},o,{section:e,keyPath:"".concat(M,"-").concat(t),depth:z+1}),"".concat(M,"-").concat(t))})]}))}))});export{g as default};
1
+ import{__spreadArray as e,__assign as i}from"tslib";import{jsx as n,jsxs as t}from"react/jsx-runtime";import o from"react";import{Box as l,Accordion as d,AccordionSummary as a,Typography as s,AccordionDetails as r}from"@mui/material";import{ChevronDown as u}from"lucide-react";import{MemoizedMarkdown as c}from"../hooks/memoizedMarkdown.js";import{hasValue as v,generateColorPalette as p,isMissingStr as m,DEVIATION_BADGE_SEPARATOR as h}from"../CognitiveComparehelpers.js";import{DEFAULT_DEVIAION_COLOR as f}from"../CognitiveCompareConstants.js";var g=o.memo(function(o){var x,S,b,y,I,_,C,R,w,B,F,j,k,O,P,W,E=o.section,M=o.keyPath,N=o.depth,z=void 0===N?0:N,A=o.columnKey,D=void 0===A?"left":A,T=o.parentNodeId,G=void 0===T?"":T,H=o.expandedSubSections,K=o.setExpandedSubSections,L=o.maintainRelativeOrder,U=o.proposedSections,q=o.existingSections,J=o.treeData,Q=o.deviationNumberRegistry,V=o.connectedSections,X=o.activeSideBySideSection,Y=o.resolvedMarkdownStyles,Z=o.getSubSectionRef,$=o.getSubSectionCompareStyle,ee=o.getBadgeRef,ie=o.openMoreFunctionsPopup,ne=o.openSummaryPopup,te=o.resetSideBySide,oe=o.setConnectedSections,le=o.setConnectedLines,de=o.cachedConnectedPositions,ae=(null===(x=E.displayTitle)||void 0===x||x)&&v(E.title),se=(null===(S=E.displayContent)||void 0===S||S)&&v(E.content),re=!ae&&!se,ue=ae?E.title:se?"No Title Found":"No Matching Section Found",ce=!!H[M],ve=Z(D,M),pe=$(M),me=M.split("-").map(Number),he=me[0],fe=U[he],ge=q[he],xe=M,Se=M;if(L)if("left"===D){var be=null===(b=null==fe?void 0:fe.refIndexes)||void 0===b?void 0:b[0],ye=q.findIndex(function(e){return e.selfIndex===be});-1!==ye&&(ge=q[ye],Se=e([ye],me.slice(1),!0).join("-"))}else{var Ie=null===(y=null==ge?void 0:ge.refIndexes)||void 0===y?void 0:y[0],_e=U.findIndex(function(e){return e.selfIndex===Ie});-1!==_e&&(fe=U[_e],xe=e([_e],me.slice(1),!0).join("-"))}var Ce="left"===D?fe:ge;W=L&&void 0!==(null==Ce?void 0:Ce.selfIndex)&&Ce.selfIndex>=0?Ce.selfIndex+1:he+1;for(var Re=fe,we=ge,Be=1;Be<me.length;Be++)(null==Re?void 0:Re.subsections)&&(Re=Re.subsections[me[Be]]),(null==we?void 0:we.subsections)&&(we=we.subsections[me[Be]]);var Fe=null===(I=null==J?void 0:J.input_index_map)||void 0===I?void 0:I[0],je=null===(_=null==J?void 0:J.input_index_map)||void 0===_?void 0:_[1],ke="left"===D?je:Fe,Oe=L?!(null===(C=E.refIndexes)||void 0===C?void 0:C.length)||void 0!==E.selfIndex&&E.selfIndex<0:"left"===D?!we:!Re,Pe=null!==(B=null===(w=null===(R=E.evaluationResult)||void 0===R?void 0:R.evaluation_outputs)||void 0===w?void 0:w.output_value)&&void 0!==B?B:null,We=E.id,Ee=null!==(O=null===(k=null===(j=null===(F=E.evaluationResult)||void 0===F?void 0:F.evaluation_outputs)||void 0===j?void 0:j.metadata)||void 0===k?void 0:k.label_color)&&void 0!==O?O:f,Me=p(Ee).highlightBg,Ne=(null===(P=E.evaluationResult)||void 0===P?void 0:P.deviations)||{},ze=[],Ae=Object.entries(Ne).map(function(e){var n,t,o,l=e[0],d=e[1],a="".concat(We).concat(h).concat(l),s=Q[a];if(!s)return null;var r=d[G],u=m(r);if(u)r="";else if(!r)return null;ze.push(r);var c=d[ke],v=!1;c&&(v=Object.values(Ne).map(function(e){return e[ke]}).filter(Boolean).some(function(e){return e.length>c.length&&e.includes(c)}));var p=Oe||m(c)||v,f="".concat(W,".").concat(s),g="".concat(We).concat(h).concat(l).concat(h).concat(xe).concat(h).concat(Se),x=(null==d?void 0:d.deviation_summary)?{deviation_summary:d.deviation_summary||(null===(n=E.evaluationResult)||void 0===n?void 0:n.deviation_summary),deviation_title:null===(t=E.evaluationResult)||void 0===t?void 0:t.deviation_title,evaluation_outputs:null===(o=E.evaluationResult)||void 0===o?void 0:o.evaluation_outputs}:null;return{id:a,actionId:g,label:f,highlight:r,side:D,style:pe,score:Pe,isConnected:V.has(g),isOrphan:p,isMissingClause:u,badgeRef:ee(D,a),onClick:function(e){e.stopPropagation();var n=i(i({},Re),{title:(null==fe?void 0:fe.title)||(null==Re?void 0:Re.title)||""}),t=i(i({},we),{title:(null==ge?void 0:ge.title)||(null==we?void 0:we.title)||""});ie(e,n,p,t,g,pe)},onSummaryClick:function(e){e.stopPropagation(),ne(e,g,p,x)}}}).filter(Boolean),De=Ae.some(function(e){return V.has(e.actionId)});if(!(ae||se||E.subsections&&0!==E.subsections.length))return null;var Te=!L&&ae&&se,Ge=De&&pe?{borderRadius:"4px",outline:"2px solid ".concat(pe.badgeBorder),outlineOffset:"1px"}:{};return n(l,ae?i({ref:ve,sx:{mt:1,width:"100%",minWidth:0,position:"relative"}},{children:n(l,i({sx:i({width:"100%"},Ge)},{children:t(d,i({disableGutters:!0,expanded:!re&&ce,onChange:function(){if(!re){if(ce){var e=String(X||""),n=e.includes(xe)||e.includes(Se);n||V.forEach(function(e){(String(e).includes(xe)||String(e).includes(Se))&&(n=!0)}),n&&(te(),oe(new Set),le([]),de.current=[])}K(function(e){var n;return i(i({},e),((n={})[M]=!e[M],n))})}},sx:{mt:0,boxShadow:"none",border:re?"1px dashed #E2E8F0":"1px solid #EEF2F7",borderRadius:"4px !important",bgcolor:"#FFFFFF",minWidth:0,"&:before":{display:"none"}}},{children:[n(a,i({expandIcon:re?null:n(u,{size:14}),sx:{minHeight:"32px","& .MuiAccordionSummary-content":{my:.5,display:"grid",alignItems:"center",minWidth:0,width:"100%"}}},{children:n(s,i({component:"div",sx:{fontSize:"11px",fontWeight:600,color:re?"#94A3B8":"#19213D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0}},{children:ue||"Untitled Subsection"}))})),!re&&t(r,i({sx:{pt:0,pb:1,minWidth:0}},{children:[se&&n(c,{content:E.content,sxStyles:Y,deviationBadges:Te?[]:Ae,maintainRelativeOrder:L,highlightBg:Me,highlights:ze}),(E.subsections||[]).map(function(e,t){return n(g,i({},o,{section:e,keyPath:"".concat(M,"-").concat(t),depth:z+1}),"".concat(M,"-").concat(t))})]}))]}))}))}):i({ref:ve,sx:{mt:0===z?1:.75,width:"100%",minWidth:0,position:"relative"}},{children:!re&&t(l,i({sx:i({width:"100%"},Ge)},{children:[se&&n(c,{content:E.content,sxStyles:Y,deviationBadges:Ae,maintainRelativeOrder:L,highlightBg:Me,highlights:ze}),(E.subsections||[]).map(function(e,t){return n(g,i({},o,{section:e,keyPath:"".concat(M,"-").concat(t),depth:z+1}),"".concat(M,"-").concat(t))})]}))}))});export{g as default};
2
2
  //# sourceMappingURL=SubSectionAccordion.js.map
@@ -1,2 +1,2 @@
1
- import{__assign as e,__rest as o,__spreadArray as r}from"tslib";import{jsx as i,jsxs as n}from"react/jsx-runtime";import{Box as t,Typography as l}from"@mui/material";import a,{useMemo as c}from"react";import{DEFAULT_DEVIAION_COLOR as s}from"../CognitiveCompareConstants.js";import{EllipsisVertical as d}from"lucide-react";import p from"react-markdown";import{safeStringify as h,areMarkdownPropsEqual as f}from"../CognitiveComparehelpers.js";import g from"rehype-raw";var m=a.memo(function(a){var f=a.content,m=a.sxStyles,u=a.deviationBadges,v=void 0===u?[]:u,x=a.highlights,b=void 0===x?[]:x,y=a.maintainRelativeOrder,C=void 0===y||y,k=a.highlightBg,E=c(function(){return v.reduce(function(o,r){var i;return e(e({},o),((i={})[r.id]=r,i))},{})},[v]),S=c(function(){return{mark:function(o){var r=o.children;return i("span",e({style:{backgroundColor:k,borderRadius:"2px"}},{children:r}))},span:function(r){var l,a,c,p,h,f,g=r.children,m=o(r,["children"]),u=m["data-badge-id"];if(!u)return i("span",e({},m,{children:g}));var v=E[u];return v?n(t,e({component:"span",sx:{position:"static",display:"inline"}},{children:[n(t,e({ref:v.badgeRef,sx:e(e({position:"absolute",zIndex:30,display:"inline-flex",alignItems:"stretch",fontSize:"10px",bgcolor:(null===(l=v.style)||void 0===l?void 0:l.badgeBg)||"#EEF2FF",color:(null===(a=v.style)||void 0===a?void 0:a.badgeText)||s,border:"1px solid ".concat((null===(c=v.style)||void 0===c?void 0:c.badgeBorder)||"#C7D2FE"),borderRadius:"12px",fontWeight:600,whiteSpace:"nowrap",boxShadow:"0 1px 3px rgba(0,0,0,0.07)",overflow:"hidden"},"left"===v.side?{right:"-16px",transform:"translateY(-20%) translateX(calc(100% + 8px))"}:{left:"-16px",transform:"translateY(-20%) translateX(calc(-100% - 8px))"}),v.isConnected&&v.style&&{outline:"2px solid ".concat(v.style.badgeBorder),outlineOffset:"1px"})},{children:[n(t,e({onClick:function(e){e.stopPropagation(),v.onSummaryClick&&v.onSummaryClick(e)},sx:{display:"flex",alignItems:"center",px:1,py:.3,cursor:"pointer","&:hover":{bgcolor:"rgba(0,0,0,0.04)"}}},{children:[i(t,e({component:"span",sx:{fontSize:"10px",fontWeight:700}},{children:v.label})),("left"===v.side||v.isOrphan)&&i(t,e({component:"span",sx:{fontSize:"10px",pl:.5,ml:.5,borderLeft:"1px solid ".concat((null===(p=v.style)||void 0===p?void 0:p.badgeBorder)||"#C7D2FE")}},{children:null!=v.score&&"N/A"!==v.score&&"NA"!==v.score&&0!==v.score?"".concat(v.score):"N/A"===v.score||"NA"===v.score?"N/A":"Same"}))]})),("left"===v.side||v.isOrphan)&&i(t,e({onClick:function(e){e.stopPropagation(),v.onClick&&v.onClick(e)},sx:{display:"flex",alignItems:"center",px:.5,borderLeft:"1px solid ".concat((null===(h=v.style)||void 0===h?void 0:h.badgeBorder)||"#C7D2FE"),cursor:"pointer","&:hover":{bgcolor:"rgba(0,0,0,0.06)"}}},{children:i(d,{size:12,color:(null===(f=v.style)||void 0===f?void 0:f.badgeText)||"#3730A3"})}))]})),g]})):i("span",e({},m,{children:g}))}}},[E,C]),w=c(function(){var e=f||"",o={},i=0,n=r([],v,!0).sort(function(e,o){var r,i;return((null===(r=o.highlight)||void 0===r?void 0:r.length)||0)-((null===(i=e.highlight)||void 0===i?void 0:i.length)||0)});return n.forEach(function(r){if(r&&r.highlight){var n=r.highlight.replace(/\\(['’])/g,"$1").replace(/\\n/g,"\n");if(n){var t="__DEV_TOKEN_".concat(i++,"__");o[t]='<span data-badge-id="'.concat(r.id,'"><mark>').concat(n,"</mark></span>"),e=e.replace(n,t)}}}),Object.keys(o).forEach(function(r){e=e.split(r).join(o[r])}),e},[f,v,b]);return i(l,e({component:"div",sx:e(e({},m),{position:"relative",overflow:"visible","& p, & li, & ul, & ol":{position:"static",overflow:"visible"}})},{children:i(p,e({components:S,rehypePlugins:[g]},{children:h(w).replace(/\\n/g,"\n")}))}))},f);export{m as MemoizedMarkdown};
1
+ import{__assign as e,__rest as r,__spreadArray as o}from"tslib";import{jsx as n,jsxs as i}from"react/jsx-runtime";import{Box as t,Typography as a}from"@mui/material";import l,{useMemo as c}from"react";import{DEFAULT_DEVIAION_COLOR as s}from"../CognitiveCompareConstants.js";import{EllipsisVertical as p}from"lucide-react";import d from"react-markdown";import{safeStringify as g,areMarkdownPropsEqual as h}from"../CognitiveComparehelpers.js";import f from"rehype-raw";var u=l.memo(function(l){var h=l.content,u=l.sxStyles,m=l.deviationBadges,v=void 0===m?[]:m,x=l.highlights,b=void 0===x?[]:x,y=l.maintainRelativeOrder,_=void 0===y||y,k=l.highlightBg,C=c(function(){return v.reduce(function(r,o){var n;return e(e({},r),((n={})[o.id]=o,n))},{})},[v]),w=c(function(){return{mark:function(r){var o=r.children;return n("span",e({style:{backgroundColor:k,borderRadius:"2px"}},{children:o}))},span:function(o){var a,l,c,d,g,h,f=o.children,u=r(o,["children"]),m=u["data-badge-id"];if(!m)return n("span",e({},u,{children:f}));var v=C[m];return v?i(t,e({component:"span",sx:{position:"static",display:"inline"}},{children:[i(t,e({ref:v.badgeRef,sx:e(e({position:"absolute",zIndex:30,display:"inline-flex",alignItems:"stretch",fontSize:"10px",bgcolor:(null===(a=v.style)||void 0===a?void 0:a.badgeBg)||"#EEF2FF",color:(null===(l=v.style)||void 0===l?void 0:l.badgeText)||s,border:"1px solid ".concat((null===(c=v.style)||void 0===c?void 0:c.badgeBorder)||"#C7D2FE"),borderRadius:"12px",fontWeight:600,whiteSpace:"nowrap",boxShadow:"0 1px 3px rgba(0,0,0,0.07)",overflow:"hidden"},"left"===v.side?{right:"-16px",transform:"translateY(-20%) translateX(calc(100% + 8px))"}:{left:"-16px",transform:"translateY(-20%) translateX(calc(-100% - 8px))"}),v.isConnected&&v.style&&{outline:"2px solid ".concat(v.style.badgeBorder),outlineOffset:"1px"})},{children:[i(t,e({onClick:function(e){e.stopPropagation(),v.onSummaryClick&&v.onSummaryClick(e)},sx:{display:"flex",alignItems:"center",px:1,py:.3,cursor:"pointer","&:hover":{bgcolor:"rgba(0,0,0,0.04)"}}},{children:[n(t,e({component:"span",sx:{fontSize:"10px",fontWeight:700}},{children:v.label})),("left"===v.side||v.isOrphan)&&n(t,e({component:"span",sx:{fontSize:"10px",pl:.5,ml:.5,borderLeft:"1px solid ".concat((null===(d=v.style)||void 0===d?void 0:d.badgeBorder)||"#C7D2FE")}},{children:null!=v.score&&"N/A"!==v.score&&"NA"!==v.score&&0!==v.score?"".concat(v.score):"N/A"===v.score||"NA"===v.score?"N/A":"Same"}))]})),("left"===v.side||v.isOrphan)&&n(t,e({onClick:function(e){e.stopPropagation(),v.onClick&&v.onClick(e)},sx:{display:"flex",alignItems:"center",px:.5,borderLeft:"1px solid ".concat((null===(g=v.style)||void 0===g?void 0:g.badgeBorder)||"#C7D2FE"),cursor:"pointer","&:hover":{bgcolor:"rgba(0,0,0,0.06)"}}},{children:n(p,{size:12,color:(null===(h=v.style)||void 0===h?void 0:h.badgeText)||"#3730A3"})}))]})),f]})):n("span",e({},u,{children:f}))}}},[C,_]),E=c(function(){var e=function(e){return e?e.replace(/\\([''])/g,"$1").replace(/\\n/g,"\n").replace(/\r\n/g,"\n").split(/(\n{2,})/).map(function(e){return e.startsWith("\n")?e:e.replace(/\n/g," ")}).join(""):""},r=e(g(h||"")),n=o([],v,!0).sort(function(e,r){var o,n;return((null===(o=r.highlight)||void 0===o?void 0:o.length)||0)-((null===(n=e.highlight)||void 0===n?void 0:n.length)||0)}),i={},t=0;n.forEach(function(o){if(o&&o.highlight){var n=e(o.highlight);if(n){var a="__DEV_TOKEN_".concat(t++,"__");i[a]='<span data-badge-id="'.concat(o.id,'"><mark>').concat(n,"</mark></span>"),r=r.replace(n,a);var l=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),c="__HIGHLIGHT_TOKEN_".concat(t++,"__");i[c]="<mark>".concat(n,"</mark>"),r=r.replace(new RegExp(l,"g"),c)}}});var a=new Set(n.map(function(r){return e(r.highlight)}).filter(Boolean));return b.forEach(function(o){if(o){var n=e(o);if(n&&!a.has(n)){var l=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),c="__PLAIN_TOKEN_".concat(t++,"__");i[c]="<mark>".concat(n,"</mark>"),r=r.replace(new RegExp(l,"g"),c)}}}),Object.keys(i).forEach(function(e){r=r.split(e).join(i[e])}),r},[h,v,b]);return n(a,e({component:"div",sx:e(e({},u),{position:"relative",overflow:"visible",whiteSpace:"pre-wrap","& p, & li, & ul, & ol":{position:"static",overflow:"visible",whiteSpace:"pre-wrap"}})},{children:n(d,e({components:w,rehypePlugins:[f]},{children:g(E).replace(/\\n/g,"\n")}))}))},h);export{u as MemoizedMarkdown};
2
2
  //# sourceMappingURL=memoizedMarkdown.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=t(function(){var t,l,s,r;if(!a||0===Object.keys(a).length)return{activeProposed:{},activeVariants:[],parseError:"Tree data is required"};try{var d=a.nodes||a,c=[],f=[],p=a.base_root_id,b=a.input_index_map||{0:"left",1:"right"},_=a[p]||d[p];if(!_||!1===_.display_node)return{activeProposed:{title:"No Data",sections:[]},activeVariants:[],parseError:null};var x=function(e,t){var l,s,r,u=a[e]||d[e];if(!u||!1===u.display_node)return null;var c=n(u,t,b),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),_=!!c.title.trim(),y=!!c.content.trim(),m=o(u),I=(null===(r=null==v?void 0:v[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=d[i];if(e&&!1!==e.display_node){var n=x(i,t);n&&h.push(n)}});var g=!(!_&&!y);return i(i({id:e,title:_?c.title:"",content:y?c.content:"",displayTitle:f,displayContent:p,subsections:h},g?m:{score:void 0,relation:"not_defined"}),{evaluationResult:I})};if(u){var y=function(t,l){var s,r,u,c,f,p,_,x,m,I,h,g,E,N,R,S,j,P,C,O,T;void 0===l&&(l=0);var V=[],k=[];if(!t)return{refSections:V,baseSections:k};var D={},U={},q=-1,w=-1;for(var F in t){var M=t[F],z=a[M]||d[M];if(z&&!1!==z.display_node){var A=o(z),B=(null===(s=null==v?void 0:v[M])||void 0===s?void 0:s.evaluation_result)||z.evaluation_result||null,G=n(z,"1",b),H=n(z,"0",b),J=!1!==(null===(r=G.attributes)||void 0===r?void 0:r.display_title)&&G.title.trim()||!1!==(null===(u=G.attributes)||void 0===u?void 0:u.display_content)&&G.content.trim(),K=!1!==(null===(c=H.attributes)||void 0===c?void 0:c.display_title)&&H.title.trim()||!1!==(null===(f=H.attributes)||void 0===f?void 0:f.display_content)&&H.content.trim(),L=Number(null!==(_=null===(p=G.attributes)||void 0===p?void 0:p.display_index)&&void 0!==_?_:q--),Q=Number(null!==(m=null===(x=H.attributes)||void 0===x?void 0:x.display_index)&&void 0!==m?m:w--),W=D[L]||i(i({id:M,title:!1!==(null===(I=G.attributes)||void 0===I?void 0:I.display_title)?G.title:"",content:!1!==(null===(h=G.attributes)||void 0===h?void 0:h.display_content)?G.content:"",subsections:[]},J?A:{score:void 0,relation:"not_defined"}),{refIndexes:[],selfIndex:L,evaluationResult:B,displayContent:null===(g=G.attributes)||void 0===g?void 0:g.display_content,displayTitle:null===(E=G.attributes)||void 0===E?void 0:E.display_title}),X=U[Q]||i(i({id:M,title:!1!==(null===(N=H.attributes)||void 0===N?void 0:N.display_title)?H.title:"",content:!1!==(null===(R=H.attributes)||void 0===R?void 0:R.display_content)?H.content:"",subsections:[]},K?A:{score:void 0,relation:"not_defined"}),{refIndexes:[],selfIndex:Q,evaluationResult:B,displayContent:null===(S=H.attributes)||void 0===S?void 0:S.display_content,displayTitle:null===(j=H.attributes)||void 0===j?void 0:j.display_title});Number(L)>=0&&Number(Q)>=0&&((null===(P=W.refIndexes)||void 0===P?void 0:P.includes(Number(Q)))||null===(C=W.refIndexes)||void 0===C||C.push(Number(Q)),(null===(O=X.refIndexes)||void 0===O?void 0:O.includes(Number(L)))||null===(T=X.refIndexes)||void 0===T||T.push(Number(L))),D[L]=W,U[Q]=X;var Y=y(z.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(U);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}},m=y(_.next),I=m.refSections,h=m.baseSections;f=I,c=h}else _.next&&Object.values(_.next).forEach(function(i){var e=a[i]||d[i];e&&!1!==e.display_node&&(c.push(x(i,"0")||{id:i,title:"",content:"",subsections:[]}),f.push(x(i,"1")||{id:i,title:"",content:"",subsections:[]}))});return{activeProposed:{title:(null===(l=null===(t=_.comparison_inputs)||void 0===t?void 0:t[b[0]])||void 0===l?void 0:l.title)||"Uploaded Contract",description:_.decision_scope_description||"",sections:c},activeVariants:[{id:"tree-variant-1",title:(null===(r=null===(s=_.comparison_inputs)||void 0===s?void 0:s[b[1]])||void 0===r?void 0:r.title)||"Reference Template",similarity:0,sections:f,analysis:{rule_difference_comparison:{summary:{overall_score:0,overall_summary:_.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,v]),p=f.activeProposed,b=f.activeVariants,_=f.parseError,x=(null==b?void 0:b[0])||d,y=t(function(){return(null==p?void 0:p.sections)||[]},[null==p?void 0:p.sections]),m=t(function(){return x.sections||[]},[x.sections]),I=y.length>0||m.length>0,h=t(function(){return c.fields.filter(function(i){var e=i.key;return(!I||"description"!==e)&&(l(null==p?void 0:p[e])||l(x[e]))})},[p,x,I,c.fields]),g=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&&!f){var E=(null==p?void 0:p.id)||"fallback_parent_".concat(l++);t[E]||(t[E]=[]),t[E].push(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)}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),R=0;R<N;R++)c((null===(y=null==i?void 0:i.subsections)||void 0===y?void 0:y[R])||(null===(m=null==e?void 0:e.subsections)||void 0===m?void 0:m[R])||(null===(I=null==a?void 0:a.subsections)||void 0===I?void 0:I[R]),null===(h=null==e?void 0:e.subsections)||void 0===h?void 0:h[R],null===(g=null==a?void 0:a.subsections)||void 0===g?void 0:g[R],u,!1,p)};return y.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=m.find(function(i){return i.selfIndex===l})}else o=m[e];c(i,i,o,n,!0,i)}),m.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=y.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>=y.length&&(o=!0);o&&c(i,null,i,n,!0,i)}),{parentDeviationRecord:t,registry:n}},[y,m,u,a]),E=g.parentDeviationRecord,N=g.registry;return{activeProposed:p,activeVariants:b,existingRule:x,proposedSections:y,existingSections:m,visibleFields:h,parentDeviationRecord:E,deviationNumberRegistry:N,parseError:_}};export{a as useCognitiveTreeData};
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=t(function(){var t,l,s,r;if(!a||0===Object.keys(a).length)return{activeProposed:{},activeVariants:[],parseError:"Tree data is required"};try{var d=a.nodes||a,c=[],f=[],p=a.base_root_id,b=a.input_index_map||{0:"left",1:"right"},_=a[p]||d[p];if(!_||!1===_.display_node)return{activeProposed:{title:"No Data",sections:[]},activeVariants:[],parseError:null};var x=function(e,t){var l,s,r,u=a[e]||d[e];if(!u||!1===u.display_node)return null;var c=n(u,t,b),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),_=!!c.title.trim(),y=!!c.content.trim(),m=o(u),I=(null===(r=null==v?void 0:v[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=d[i];if(e&&!1!==e.display_node){var n=x(i,t);n&&h.push(n)}});var g=!(!_&&!y);return i(i({id:e,title:_?c.title:"",content:y?c.content:"",displayTitle:f,displayContent:p,subsections:h},g?m:{score:void 0,relation:"not_defined"}),{evaluationResult:I})};if(u){var y=function(t,l){var s,r,u,c,f,p,_,x,m,I,h,g,E,N,R,S,j,P,C,O,T;void 0===l&&(l=0);var V=[],k=[];if(!t)return{refSections:V,baseSections:k};var D={},U={},q=-1,w=-1;for(var F in t){var M=t[F],z=a[M]||d[M];if(z&&!1!==z.display_node){var A=o(z),B=(null===(s=null==v?void 0:v[M])||void 0===s?void 0:s.evaluation_result)||z.evaluation_result||null,G=n(z,"1",b),H=n(z,"0",b),J=!1!==(null===(r=G.attributes)||void 0===r?void 0:r.display_title)&&G.title.trim()||!1!==(null===(u=G.attributes)||void 0===u?void 0:u.display_content)&&G.content.trim(),K=!1!==(null===(c=H.attributes)||void 0===c?void 0:c.display_title)&&H.title.trim()||!1!==(null===(f=H.attributes)||void 0===f?void 0:f.display_content)&&H.content.trim(),L=Number(null!==(_=null===(p=G.attributes)||void 0===p?void 0:p.display_index)&&void 0!==_?_:q--),Q=Number(null!==(m=null===(x=H.attributes)||void 0===x?void 0:x.display_index)&&void 0!==m?m:w--),W=D[L]||i(i({id:M,title:!1!==(null===(I=G.attributes)||void 0===I?void 0:I.display_title)?G.title:"",content:!1!==(null===(h=G.attributes)||void 0===h?void 0:h.display_content)?G.content:"",subsections:[]},J?A:{score:void 0,relation:"not_defined"}),{refIndexes:[],selfIndex:L,evaluationResult:B,displayContent:null===(g=G.attributes)||void 0===g?void 0:g.display_content,displayTitle:null===(E=G.attributes)||void 0===E?void 0:E.display_title}),X=U[Q]||i(i({id:M,title:!1!==(null===(N=H.attributes)||void 0===N?void 0:N.display_title)?H.title:"",content:!1!==(null===(R=H.attributes)||void 0===R?void 0:R.display_content)?H.content:"",subsections:[]},K?A:{score:void 0,relation:"not_defined"}),{refIndexes:[],selfIndex:Q,evaluationResult:B,displayContent:null===(S=H.attributes)||void 0===S?void 0:S.display_content,displayTitle:null===(j=H.attributes)||void 0===j?void 0:j.display_title});Number(L)>=0&&Number(Q)>=0&&((null===(P=W.refIndexes)||void 0===P?void 0:P.includes(Number(Q)))||null===(C=W.refIndexes)||void 0===C||C.push(Number(Q)),(null===(O=X.refIndexes)||void 0===O?void 0:O.includes(Number(L)))||null===(T=X.refIndexes)||void 0===T||T.push(Number(L))),D[L]=W,U[Q]=X;var Y=y(z.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(U);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}},m=y(_.next),I=m.refSections,h=m.baseSections;f=I,c=h}else _.next&&Object.values(_.next).forEach(function(i){var e=a[i]||d[i];e&&!1!==e.display_node&&(c.push(x(i,"0")||{id:i,title:"",content:"",subsections:[]}),f.push(x(i,"1")||{id:i,title:"",content:"",subsections:[]}))});return{activeProposed:{title:(null===(l=null===(t=_.comparison_inputs)||void 0===t?void 0:t[b[0]])||void 0===l?void 0:l.title)||"Uploaded Contract",description:_.decision_scope_description||"",sections:c},activeVariants:[{id:"tree-variant-1",title:(null===(r=null===(s=_.comparison_inputs)||void 0===s?void 0:s[b[1]])||void 0===r?void 0:r.title)||"Reference Template",similarity:0,sections:f,analysis:{rule_difference_comparison:{summary:{overall_score:0,overall_summary:_.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]),p=f.activeProposed,b=f.activeVariants,_=f.parseError,x=(null==b?void 0:b[0])||d,y=t(function(){return(null==p?void 0:p.sections)||[]},[null==p?void 0:p.sections]),m=t(function(){return x.sections||[]},[x.sections]),I=y.length>0||m.length>0,h=t(function(){return c.fields.filter(function(i){var e=i.key;return(!I||"description"!==e)&&(l(null==p?void 0:p[e])||l(x[e]))})},[p,x,I,c.fields]),g=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&&!f){var E=(null==p?void 0:p.id)||"fallback_parent_".concat(l++);t[E]||(t[E]=[]),t[E].push(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)}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),R=0;R<N;R++)c((null===(y=null==i?void 0:i.subsections)||void 0===y?void 0:y[R])||(null===(m=null==e?void 0:e.subsections)||void 0===m?void 0:m[R])||(null===(I=null==a?void 0:a.subsections)||void 0===I?void 0:I[R]),null===(h=null==e?void 0:e.subsections)||void 0===h?void 0:h[R],null===(g=null==a?void 0:a.subsections)||void 0===g?void 0:g[R],u,!1,p)};return y.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=m.find(function(i){return i.selfIndex===l})}else o=m[e];c(i,i,o,n,!0,i)}),m.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=y.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>=y.length&&(o=!0);o&&c(i,null,i,n,!0,i)}),{parentDeviationRecord:t,registry:n}},[y,m,u,a]),E=g.parentDeviationRecord,N=g.registry;return{activeProposed:p,activeVariants:b,existingRule:x,proposedSections:y,existingSections:m,visibleFields:h,parentDeviationRecord:E,deviationNumberRegistry:N,parseError:_}};export{a as useCognitiveTreeData};
2
2
  //# sourceMappingURL=useCompareData.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CognitiveCompare.d.ts","sourceRoot":"","sources":["../../../../../src/features/CognitiveCompare/CognitiveCompare.tsx"],"names":[],"mappings":"AAgCA,OAAO,EAEL,qBAAqB,EAMtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAGL,sBAAsB,EACvB,MAAM,0BAA0B,CAAC;AAiBlC,QAAA,MAAM,gBAAgB,sLAWnB,qBAAqB,4CAsjFvB,CAAC;AAEF,OAAO,EAAE,sBAAsB,EAAE,CAAC;AAClC,eAAe,gBAAgB,CAAC"}
1
+ {"version":3,"file":"CognitiveCompare.d.ts","sourceRoot":"","sources":["../../../../../src/features/CognitiveCompare/CognitiveCompare.tsx"],"names":[],"mappings":"AAgCA,OAAO,EAEL,qBAAqB,EAMtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAGL,sBAAsB,EACvB,MAAM,0BAA0B,CAAC;AAiBlC,QAAA,MAAM,gBAAgB,sLAWnB,qBAAqB,4CAyjFvB,CAAC;AAEF,OAAO,EAAE,sBAAsB,EAAE,CAAC;AAClC,eAAe,gBAAgB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"SectionAccordion.d.ts","sourceRoot":"","sources":["../../../../../../src/features/CognitiveCompare/components/SectionAccordion.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAoBzC,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAC5E,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAe3E,KAAK,qBAAqB,GAAG;IAC3B,OAAO,EAAE,YAAY,CAAC;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC;IAC5B,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IACxC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,UAAU,EAAE,wBAAwB,GAAG,IAAI,CAAC;IAC5C,eAAe,EAAE,KAAK,CAAC,gBAAgB,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAC5D,sBAAsB,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC5C,qBAAqB,EAAE,OAAO,GAAG,SAAS,CAAC;IAC3C,gBAAgB,EAAE,CAChB,CAAC,EAAE,KAAK,CAAC,UAAU,EACnB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,OAAO,EACjB,OAAO,EAAE,kBAAkB,GAAG,IAAI,KAC/B,IAAI,CAAC;IACV,iBAAiB,EAAE,CAAC,IAAI,EAAE;QACxB,OAAO,EAAE,YAAY,CAAC;QACtB,OAAO,EAAE,MAAM,CAAC;QAChB,KAAK,EAAE,MAAM,CAAC;QACd,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC;QAC5B,YAAY,EAAE,MAAM,CAAC;QACrB,UAAU,EAAE;YAAE,OAAO,EAAE,MAAM,CAAA;SAAE,CAAC;KACjC,KAAK,KAAK,CAAC,SAAS,CAAC;IAGtB,QAAQ,CAAC,EAAE,GAAG,CAAC;IACf,gBAAgB,CAAC,EAAE,GAAG,EAAE,CAAC;IACzB,gBAAgB,CAAC,EAAE,GAAG,EAAE,CAAC;IACzB,uBAAuB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjD,WAAW,EAAE,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,EAAE,OAAO,EAAE,MAAM,KAAK,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,GAAG,IAAI,CAAC;IACtG,sBAAsB,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,GAAG,CAAC;IAC9C,iBAAiB,CAAC,EAAE,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;IACzC,sBAAsB,CAAC,EAAE,CACvB,CAAC,EAAE,KAAK,CAAC,UAAU,EACnB,OAAO,EAAE,GAAG,EACZ,QAAQ,EAAE,OAAO,EACjB,MAAM,EAAE,GAAG,EACX,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,GAAG,KACP,IAAI,CAAC;CACX,CAAC;AAEF,QAAA,MAAM,gBAAgB,yVAuBnB,qBAAqB,4CAyTvB,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
1
+ {"version":3,"file":"SectionAccordion.d.ts","sourceRoot":"","sources":["../../../../../../src/features/CognitiveCompare/components/SectionAccordion.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAoBzC,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAC5E,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAe3E,KAAK,qBAAqB,GAAG;IAC3B,OAAO,EAAE,YAAY,CAAC;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC;IAC5B,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IACxC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,UAAU,EAAE,wBAAwB,GAAG,IAAI,CAAC;IAC5C,eAAe,EAAE,KAAK,CAAC,gBAAgB,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAC5D,sBAAsB,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC5C,qBAAqB,EAAE,OAAO,GAAG,SAAS,CAAC;IAC3C,gBAAgB,EAAE,CAChB,CAAC,EAAE,KAAK,CAAC,UAAU,EACnB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,OAAO,EACjB,OAAO,EAAE,kBAAkB,GAAG,IAAI,KAC/B,IAAI,CAAC;IACV,iBAAiB,EAAE,CAAC,IAAI,EAAE;QACxB,OAAO,EAAE,YAAY,CAAC;QACtB,OAAO,EAAE,MAAM,CAAC;QAChB,KAAK,EAAE,MAAM,CAAC;QACd,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC;QAC5B,YAAY,EAAE,MAAM,CAAC;QACrB,UAAU,EAAE;YAAE,OAAO,EAAE,MAAM,CAAA;SAAE,CAAC;KACjC,KAAK,KAAK,CAAC,SAAS,CAAC;IAGtB,QAAQ,CAAC,EAAE,GAAG,CAAC;IACf,gBAAgB,CAAC,EAAE,GAAG,EAAE,CAAC;IACzB,gBAAgB,CAAC,EAAE,GAAG,EAAE,CAAC;IACzB,uBAAuB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjD,WAAW,EAAE,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,EAAE,OAAO,EAAE,MAAM,KAAK,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,GAAG,IAAI,CAAC;IACtG,sBAAsB,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,GAAG,CAAC;IAC9C,iBAAiB,CAAC,EAAE,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;IACzC,sBAAsB,CAAC,EAAE,CACvB,CAAC,EAAE,KAAK,CAAC,UAAU,EACnB,OAAO,EAAE,GAAG,EACZ,QAAQ,EAAE,OAAO,EACjB,MAAM,EAAE,GAAG,EACX,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,GAAG,KACP,IAAI,CAAC;CACX,CAAC;AAEF,QAAA,MAAM,gBAAgB,yVAuBnB,qBAAqB,4CAkUvB,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"SubSectionAccordion.d.ts","sourceRoot":"","sources":["../../../../../../src/features/CognitiveCompare/components/SubSectionAccordion.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAC;AAqBvC,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAE1F,UAAU,wBAAwB;IAChC,OAAO,EAAE,YAAY,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC7B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,mBAAmB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC7C,sBAAsB,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;IACtF,qBAAqB,EAAE,OAAO,CAAC;IAC/B,gBAAgB,EAAE,GAAG,EAAE,CAAC;IACxB,gBAAgB,EAAE,GAAG,EAAE,CAAC;IACxB,QAAQ,EAAE,GAAG,CAAC;IACd,uBAAuB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChD,iBAAiB,EAAE,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;IACxC,uBAAuB,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAChD,sBAAsB,EAAE,GAAG,CAAC;IAC5B,gBAAgB,EAAE,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IAC5F,yBAAyB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,YAAY,GAAG,IAAI,CAAC;IACjE,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,EAAE,EAAE,EAAE,MAAM,KAAK,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IACrF,sBAAsB,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,YAAY,GAAG,IAAI,KAAK,IAAI,CAAC;IAC7I,gBAAgB,EAAE,CAChB,CAAC,EAAE,KAAK,CAAC,UAAU,EACnB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,OAAO,EACjB,OAAO,EAAE,kBAAkB,GAAG,IAAI,KAC/B,IAAI,CAAC;IACV,eAAe,EAAE,MAAM,IAAI,CAAC;IAC5B,oBAAoB,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;IACjF,iBAAiB,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;IAC/D,wBAAwB,EAAE,KAAK,CAAC,gBAAgB,CAAC,GAAG,EAAE,CAAC,CAAC;CACzD;AAED,QAAA,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,wBAAwB,CAsQ1D,CAAC;AAEH,eAAe,mBAAmB,CAAC"}
1
+ {"version":3,"file":"SubSectionAccordion.d.ts","sourceRoot":"","sources":["../../../../../../src/features/CognitiveCompare/components/SubSectionAccordion.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAC;AAqBvC,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAE1F,UAAU,wBAAwB;IAChC,OAAO,EAAE,YAAY,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC7B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,mBAAmB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC7C,sBAAsB,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;IACtF,qBAAqB,EAAE,OAAO,CAAC;IAC/B,gBAAgB,EAAE,GAAG,EAAE,CAAC;IACxB,gBAAgB,EAAE,GAAG,EAAE,CAAC;IACxB,QAAQ,EAAE,GAAG,CAAC;IACd,uBAAuB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChD,iBAAiB,EAAE,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;IACxC,uBAAuB,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAChD,sBAAsB,EAAE,GAAG,CAAC;IAC5B,gBAAgB,EAAE,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IAC5F,yBAAyB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,YAAY,GAAG,IAAI,CAAC;IACjE,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,EAAE,EAAE,EAAE,MAAM,KAAK,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IACrF,sBAAsB,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,YAAY,GAAG,IAAI,KAAK,IAAI,CAAC;IAC7I,gBAAgB,EAAE,CAChB,CAAC,EAAE,KAAK,CAAC,UAAU,EACnB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,OAAO,EACjB,OAAO,EAAE,kBAAkB,GAAG,IAAI,KAC/B,IAAI,CAAC;IACV,eAAe,EAAE,MAAM,IAAI,CAAC;IAC5B,oBAAoB,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;IACjF,iBAAiB,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;IAC/D,wBAAwB,EAAE,KAAK,CAAC,gBAAgB,CAAC,GAAG,EAAE,CAAC,CAAC;CACzD;AAED,QAAA,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,wBAAwB,CA4Q1D,CAAC;AAEH,eAAe,mBAAmB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"memoizedMarkdown.d.ts","sourceRoot":"","sources":["../../../../../../src/features/CognitiveCompare/hooks/memoizedMarkdown.tsx"],"names":[],"mappings":"AACA,OAAO,KAAkB,MAAM,OAAO,CAAC;AAMvC,eAAO,MAAM,gBAAgB;aAQlB,MAAM;cACL,GAAG;;;;iBAIA,MAAM;8CA0II,CAAC"}
1
+ {"version":3,"file":"memoizedMarkdown.d.ts","sourceRoot":"","sources":["../../../../../../src/features/CognitiveCompare/hooks/memoizedMarkdown.tsx"],"names":[],"mappings":"AACA,OAAO,KAAkB,MAAM,OAAO,CAAC;AAMvC,eAAO,MAAM,gBAAgB;aAQlB,MAAM;cACL,GAAG;;;;iBAIA,MAAM;8CA+KI,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;;;;;;;;;;CAiT3C,CAAC"}
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;;;;;;;;;;CAwS3C,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@viswa-test/test-citation",
3
- "version": "0.0.61",
3
+ "version": "0.0.62",
4
4
  "author": "Viswa Koduru",
5
5
  "description": "",
6
6
  "license": "MIT",