@viswa-test/test-citation 0.0.120 → 0.0.121
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/features/CognitiveCompare/CognitiveCompare.js +1 -1
- package/dist/cjs/features/CognitiveCompare/CognitivePopup.js +1 -1
- package/dist/cjs/features/CognitiveCompare/components/SectionAccordion.js +1 -1
- package/dist/cjs/features/CognitiveCompare/components/SubSectionAccordion.js +1 -1
- package/dist/features/CognitiveCompare/CognitiveCompare.js +1 -1
- package/dist/features/CognitiveCompare/CognitivePopup.js +1 -1
- package/dist/features/CognitiveCompare/components/SectionAccordion.js +1 -1
- package/dist/features/CognitiveCompare/components/SubSectionAccordion.js +1 -1
- package/dist/types/src/CommonConstants/CommonConstants.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/CognitiveCompare.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/components/SectionAccordion.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/components/SubSectionAccordion.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),t=require("react"),i=require("@mui/material"),o=require("lucide-react"),r=require("../../assests/svg/ButtonCognitiveIcon.js"),l=require("./OverlayComponent.js"),u=require("./CognitiveComparehelpers.js"),c=require("./CognitiveCompareConfig.js"),a=require("./CognitiveCompareConstants.js"),s=require("./CognitivePopup.js"),d=require("./MoreFunctionsPopup.js"),v=require("./LoaderComponent.js"),f=require("./components/ThreeDotsLoader.js"),g=require("./hooks/useCompareData.js"),p=require("./hooks/useComparePopups.js"),h=require("./hooks/useSectionRefs.js"),x=require("./hooks/useAccordionState.js"),m=require("./hooks/useDeviationNavigation.js"),_=require("./components/CompareHeader.js"),y=require("./components/SectionAccordion.js"),R=require("./components/SubSectionAccordion.js"),b=require("./components/CognitiveSummaryPopup.js"),S=require("./components/connectedLines.js");exports.SHARED_MARKDOWN_STYLES=c.SHARED_MARKDOWN_STYLES,exports.default=function(A){var I,E,T,B,C,D,O,w,N,j,P,F,M,k,L,V,H,q,G,z,K,W,Y,U,X,$,J=A.componentHeaderText,Q=void 0===J?a.DEFAULT_COMPONENT_HEADER_TEXT:J,Z=A.treeData,ee=A.comparisonConfig,ne=A.leftColumnTitleText,te=A.rightColumnTitleText,ie=A.markdownStyles,oe=A.resetTrigger,re=A.displayConfig,le=void 0===re?{isHeaderVisible:!0,isToggleVisible:!0,maintainRelativeOrder:!1,isLoading:!0,showDeviationBadges:!1,enableDeviationSchemaBackwardCompatibility:!1}:re,ue=A.popupConfig,ce=A.deviationData,ae=void 0===ce?{}:ce,se=A.deviationNodeIdToView,de=A.resetDeviationNodeId,ve=A.isProposingFix,fe=void 0!==ve&&ve,ge=A.proposingFixNodeId,pe=t.useState(le.maintainRelativeOrder),he=pe[0],xe=pe[1],me=!!he||!!(null==le?void 0:le.showDeviationBadges),_e=t.useState(!1),ye=_e[0],Re=_e[1],be=t.useState(!1),Se=be[0],Ae=be[1],Ie=t.useState(null),Ee=Ie[0],Te=Ie[1],Be=t.useState(!1),Ce=Be[0],De=Be[1],Oe=t.useState(null===(E=null!==(I=null==Z?void 0:Z.newEvaluationResult)&&void 0!==I?I:null==le?void 0:le.enableDeviationSchemaBackwardCompatibility)||void 0===E||E)[0],we=t.useState(!1),Ne=we[0],je=we[1],Pe=t.useState(!1),Fe=Pe[0],Me=Pe[1],ke=t.useState(null),Le=ke[0],Ve=ke[1],He=t.useRef(!1),qe=t.useState(new Set),Ge=qe[0],ze=qe[1],Ke=t.useState([]),We=Ke[0],Ye=Ke[1],Ue=t.useRef(null),Xe=t.useRef(null),$e=t.useRef(null),Je=t.useRef(new Set),Qe=t.useRef(!1),Ze=t.useRef(null),en=t.useRef({}),nn=t.useRef([]),tn=t.useRef(!1),on=t.useRef(!1),rn=t.useRef(null),ln=t.useRef(function(){}),un=t.useMemo(function(){return(null==Z?void 0:Z.cognitive_decisioning)||{}},[Z]),cn=t.useState({width:0,height:0}),an=cn[0],sn=cn[1],dn=t.useMemo(function(){return e.__assign(e.__assign({},c.SHARED_MARKDOWN_STYLES),ie)},[ie]),vn=t.useRef(null),fn=t.useRef(null),gn=t.useRef(null),pn=t.useRef(null),hn=t.useRef(null),xn=t.useRef(null),mn=t.useRef(null),_n=t.useRef(null),yn=t.useRef(!1),Rn=t.useRef(null),bn=t.useRef(null),Sn=p.useComparePopups(vn),An=Sn.cognitivePopup,In=Sn.setCognitivePopup,En=Sn.moreFunctions,Tn=Sn.setMoreFunctions,Bn=Sn.position,Cn=Sn.setPosition,Dn=Sn.activeBadgeId,On=Sn.summaryPopup,wn=Sn.setSummaryPopup,Nn=Sn.closeSummaryPopup,jn=Sn.setActiveBadgeId,Pn=Sn.popupRef,Fn=Sn.closeCognitivePopup,Mn=Sn.closeMoreFunctionsPopup,kn=t.useMemo(function(){var e,n,t,i,o,r,l;return{fields:null!==(e=null==ee?void 0:ee.fields)&&void 0!==e?e:c.DEFAULT_FIELD_CONFIG,thresholds:{high:null!==(t=null===(n=null==ee?void 0:ee.thresholds)||void 0===n?void 0:n.high)&&void 0!==t?t:c.DEFAULT_COMPARISON_CONFIG.thresholds.high,medium:null!==(o=null===(i=null==ee?void 0:ee.thresholds)||void 0===i?void 0:i.medium)&&void 0!==o?o:c.DEFAULT_COMPARISON_CONFIG.thresholds.medium,exact:null!==(l=null===(r=null==ee?void 0:ee.thresholds)||void 0===r?void 0:r.exact)&&void 0!==l?l:c.DEFAULT_COMPARISON_CONFIG.thresholds.exact}}},[ee]),Ln=t.useState(null),Vn=Ln[0];Ln[1];var Hn=null===(C=null===(T=null==Z?void 0:Z.documents)||void 0===T?void 0:T[null===(B=null==Z?void 0:Z.input_index_map)||void 0===B?void 0:B[0]])||void 0===C?void 0:C.title,qn=null===(w=null===(D=null==Z?void 0:Z.documents)||void 0===D?void 0:D[null===(O=null==Z?void 0:Z.input_index_map)||void 0===O?void 0:O[1]])||void 0===w?void 0:w.title,Gn=u.safeStringify(ne||Hn||"Uploaded Contract"),zn=u.safeStringify(te||qn||"Reference Template"),Kn=g.useCognitiveTreeData(Z,he,ae,kn,Oe),Wn=Kn.activeProposed,Yn=Kn.existingRule,Un=Kn.proposedSections,Xn=Kn.existingSections,$n=Kn.visibleFields,Jn=Kn.parentDeviationRecord,Qn=Kn.deviationNumberRegistry,Zn=Kn.parseError;t.useEffect(function(){Zn&&Te("Failed to load comparison: ".concat(Zn))},[Zn]);var et=Un.length>0||Xn.length>0,nt=h.useSectionRefs($n.map(function(e){return e.key}),Math.max(Un.length,Xn.length)),tt=nt.leftRefs,it=nt.rightRefs,ot=nt.sectionLeftRefs,rt=nt.sectionRightRefs,lt=nt.lhsBadgeRefs,ut=nt.rhsBadgeRefs,ct=nt.sectionRightRowRefs,at=nt.subSectionLeftRefs,st=nt.subSectionRightRefs,dt=nt.sectionRowRefs,vt=nt.getSectionRowRef,ft=nt.getSubSectionRef,gt=nt.getBadgeRef,pt=Yn.analysis,ht=u.safeStringify(null===(j=null===(N=null==pt?void 0:pt.rule_difference_comparison)||void 0===N?void 0:N.summary)||void 0===j?void 0:j.overall_summary),xt=!!ht.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),mt=null!==(P=null==Z?void 0:Z.base_root_id)&&void 0!==P?P:"-1";null==Z||Z[mt];var _t=Oe?null!==(Y=null!==(z=ae&&(null===(G=null==ae?void 0:ae[mt])||void 0===G?void 0:G.evaluation_result))&&void 0!==z?z:null===(W=null===(K=null==Z?void 0:Z.nodes)||void 0===K?void 0:K[mt])||void 0===W?void 0:W.evaluation_result)&&void 0!==Y?Y:null:null!==(q=null!==(k=ae&&(null===(M=null===(F=null==ae?void 0:ae[mt])||void 0===F?void 0:F.evaluation_result)||void 0===M?void 0:M[0]))&&void 0!==k?k:null===(H=null===(V=null===(L=null==Z?void 0:Z.nodes)||void 0===L?void 0:L[mt])||void 0===V?void 0:V.evaluation_result)||void 0===H?void 0:H[0])&&void 0!==q?q:null,yt=u.extractDeviationScore(_t),Rt=u.generateColorPalette(null!==($=null===(X=null===(U=null==_t?void 0:_t.evaluation_outputs)||void 0===U?void 0:U.metadata)||void 0===X?void 0:X.label_color)&&void 0!==$?$:""),bt=function(){Je.current.forEach(function(e){u.resetClauseHighlight(e)}),Je.current.clear()},St=t.useCallback(function(){var e,n,t,i,o,r;bt(),De(!1),on.current=!1,Xe.current=null;var l=rn.current,c=qt.current;if(null!==l)if("string"==typeof l&&l.includes(u.DEVIATION_BADGE_SEPARATOR)){var a=l.split(u.DEVIATION_BADGE_SEPARATOR);(s=(null===(e=at.current[a[2]])||void 0===e?void 0:e.current)||(null===(n=ot.current[Number(a[2])])||void 0===n?void 0:n.current))&&(s.style.paddingTop="0px")}else{var s;(s=null===(t=ot.current[l])||void 0===t?void 0:t.current)&&(s.style.paddingTop="0px")}if(null!==c)if("string"==typeof c&&c.includes(u.DEVIATION_BADGE_SEPARATOR)){a=c.split(u.DEVIATION_BADGE_SEPARATOR);(d=(null===(i=st.current[a[3]])||void 0===i?void 0:i.current)||(null===(o=rt.current[Number(a[3])])||void 0===o?void 0:o.current))&&(d.style.paddingTop="0px")}else{var d;(d=null===(r=rt.current[c])||void 0===r?void 0:r.current)&&(d.style.paddingTop="0px")}Ve(null),rn.current=null,qt.current=null,je(!1),Ae(!1),pn.current&&(pn.current.style.height="0px"),hn.current&&(hn.current.style.height="0px"),xn.current&&(xn.current.style.height="0px"),mn.current&&(mn.current.style.height="0px")},[]),At=t.useCallback(function(){bt(),St(),ze(new Set),Ye([]),nn.current=[],Ut([]),Jt(null),wn(a.EMPTY_SUMMARY_POPUP_STATE),Fn(),requestAnimationFrame(function(){var e;null===(e=ln.current)||void 0===e||e.call(ln)})},[]),It=t.useRef(At);t.useEffect(function(){It.current=At},[At]),t.useEffect(function(){oe&&It.current()},[oe]);var Et=x.useAccordionState({maintainRelativeOrder:!!he,proposedSections:Un,existingSections:Xn,activeSideBySideSection:Le,connectedSections:Ge,resetSideBySide:St,setConnectedSections:ze,setConnectedLines:Ye,cachedConnectedPositions:nn,svgContainerRef:Ue,isAnimatingRef:Qe,animationTimerRef:Ze,calculateLinesRef:ln,sectionLeftRefs:ot,sectionRightRefs:rt,subSectionLeftRefs:at,subSectionRightRefs:st}),Tt=Et.expandedSections,Bt=Et.setExpandedSections,Ct=Et.expandedSubSections,Dt=Et.setExpandedSubSections,Ot=Et.toggleSection,wt=t.useCallback(function(n,t,i,o,r,l,c){var a,s,d,v=u.safeStringify(null==t?void 0:t.id)||u.safeStringify(null==i?void 0:i.id)||"",f=(v?un[v]:null)||(null==t?void 0:t.cognitiveData)||(null==i?void 0:i.cognitiveData)||{section_id:v,decisioning:[],gap:[],relevance_score:0},g=null!==(s=null===(a=dt.current[o])||void 0===a?void 0:a.current)&&void 0!==s?s:null;return{isLoading:null!==(d=null==le?void 0:le.isLoading)&&void 0!==d&&d,open:!0,sectionTitle:(null==t?void 0:t.displayTitle)?null==t?void 0:t.title:"no title",refSectionTitle:(null==i?void 0:i.displayTitle)?null==i?void 0:i.title:"no title",cognitiveData:f,anchorEl:n,sectionAnchorEl:g,badgeStyle:l||null,sectionIdx:o,docData:{documents:null==Z?void 0:Z.documents,input_index_map:null==Z?void 0:Z.input_index_map},deviationData:function(){var n,r,l=(null==t?void 0:t.evaluationResult)||(null==i?void 0:i.evaluationResult)||null,c=function(n){var t=function(e){if(!e||"object"!=typeof e)return null;var n=null==e?void 0:e.deviation_entries;if(n&&"object"==typeof n){var t=Object.keys(n).sort(function(e,n){return Number(e)-Number(n)})[0];if(t&&n[t])return n[t]}var i=Object.keys(e).filter(function(e){return/^\d+$/.test(e)}).sort(function(e,n){return Number(e)-Number(n)});if(i.length&&e[i[0]])return e[i[0]];var o=null==e?void 0:e.deviations;if(o&&"object"==typeof o){var r=Object.keys(o).sort(function(e,n){return Number(e)-Number(n)})[0];if(r&&o[r])return o[r]}return null}(n);return t?e.__assign(e.__assign({},n),{deviation_summary:(null==n?void 0:n.deviation_summary)||(null==t?void 0:t.deviation_summary),deviation_title:(null==n?void 0:n.deviation_title)||(null==t?void 0:t.deviation_title),deviation_impact:(null==n?void 0:n.deviation_impact)||(null==t?void 0:t.deviation_impact),deviation_explanation:(null==n?void 0:n.deviation_explanation)||(null==t?void 0:t.deviation_explanation),evaluation_outputs:(null==n?void 0:n.evaluation_outputs)||(null==t?void 0:t.evaluation_outputs),cognitive_decisioning:(null==n?void 0:n.cognitive_decisioning)||(null==t?void 0:t.cognitive_decisioning)}):n};if(!("string"==typeof o&&o.includes(u.DEVIATION_BADGE_SEPARATOR)))return c(l);var a=o.split(u.DEVIATION_BADGE_SEPARATOR)[1];if(!a)return l;var s=(null==t?void 0:t.evaluationResult)||(null==i?void 0:i.evaluationResult)||{},d=(null===(n=null==s?void 0:s.deviation_entries)||void 0===n?void 0:n[a])||(null===(r=null==s?void 0:s.deviations)||void 0===r?void 0:r[a])||null;return d?e.__assign(e.__assign(e.__assign({},s),d),{deviation_summary:(null==d?void 0:d.deviation_summary)||(null==s?void 0:s.deviation_summary),deviation_title:(null==d?void 0:d.deviation_title)||(null==s?void 0:s.deviation_title),deviation_impact:(null==d?void 0:d.deviation_impact)||(null==s?void 0:s.deviation_impact),deviation_explanation:(null==d?void 0:d.deviation_explanation)||(null==s?void 0:s.deviation_explanation),evaluation_outputs:(null==d?void 0:d.evaluation_outputs)||(null==s?void 0:s.evaluation_outputs),cognitive_decisioning:(null==d?void 0:d.cognitive_decisioning)||(null==s?void 0:s.cognitive_decisioning)}):c(l)}(),isOrphan:!!r}},[un,Z]),Nt=t.useCallback(function(e){Mn(),Cn(null),In(e)},[Mn]),jt=function(e,n,t,i,o,r){var l;if(e.stopPropagation(),En.open&&En.sectionIdx===o)Mn();else{var c=e.currentTarget,a="left";(null===(l=gn.current)||void 0===l?void 0:l.contains(c))&&(a="right");bt(),on.current&&St(),ze(new Set),Ye([]),nn.current=[],Fn(),On.open?mi():Nn(),requestAnimationFrame(function(){var e=function(){var e,n,t,i;if("string"==typeof o&&o.includes(u.DEVIATION_BADGE_SEPARATOR)){var r=o.split(u.DEVIATION_BADGE_SEPARATOR),l="".concat(r[0]).concat(u.DEVIATION_BADGE_SEPARATOR).concat(r[1]);return"right"===a?null===(e=ut.current[l])||void 0===e?void 0:e.current:null===(n=lt.current[l])||void 0===n?void 0:n.current}return"right"===a?null===(t=ut.current[o])||void 0===t?void 0:t.current:null===(i=lt.current[o])||void 0===i?void 0:i.current}()||c;Tn(wt(e,n,i,o,t,r))})}},Pt=t.useCallback(function(){null!==En.sectionIdx&&En.anchorEl?Nt(e.__assign(e.__assign({},En),{open:!0})):Mn()},[En,Mn,Nt]),Ft=t.useCallback(function(){var e=En.sectionIdx,n=En.isOrphan;Mn(),Nn(),null!==e&&(n?Te("No counterpart exists to connect to."):(bt(),on.current&&St(),Ye([]),nn.current=[],ze(function(n){return n.has(e)?new Set:new Set([e])}),setTimeout(function(){ln.current&&ln.current()},50)))},[En.sectionIdx,En.isOrphan,Mn,Nn,St]),Mt=t.useCallback(function(){var e=$e.current;if(e){$e.current=null;var n=Un.findIndex(function(n){return n.id===e}),t=Xn.findIndex(function(n){return n.id===e}),i=-1===n?u.findKeyPathByNodeId(Un,e):null,o=-1===t?u.findKeyPathByNodeId(Xn,e):null,r=-1!==n?n:i?Number(i.split("-")[0]):-1,l=-1!==t?t:o?Number(o.split("-")[0]):-1,c=function(e,n,t,i){var o,r,l,u;return-1!==e?null!==(r=null===(o=t.current[e])||void 0===o?void 0:o.current)&&void 0!==r?r:null:n&&null!==(u=null===(l=i.current[n])||void 0===l?void 0:l.current)&&void 0!==u?u:null},a=function(e,n,t){void 0===t&&(t=30);var i=0,o=function(){var r=e();r&&0!==r.getBoundingClientRect().height?(Je.current.add(r),u.scrollAndHighlightClause(r,n)):i++<t&&requestAnimationFrame(o)};requestAnimationFrame(o)};if(he)-1!==r&&_n.current&&a(function(){return c(n,i,ot,at)},_n.current),-1!==l&&gn.current&&a(function(){return c(t,o,rt,st)},gn.current);else{var s=vn.current;if(!s)return;a(function(){return-1!==r?c(n,i,ot,at):c(t,o,rt,st)},s)}}},[Un,Xn,he,ot,rt,at,st,_n,gn,vn]),kt=t.useCallback(function(n){if(n){bt(),St(),ze(new Set),Ye([]),nn.current=[],Nn(),Fn();var t=Un.findIndex(function(e){return e.id===n}),i=Xn.findIndex(function(e){return e.id===n}),o=-1===t?u.findKeyPathByNodeId(Un,n):null,r=-1===i?u.findKeyPathByNodeId(Xn,n):null;if(-1!==t||o||-1!==i||r){var l=-1!==t?t:o?Number(o.split("-")[0]):-1,c=-1!==i?i:r?Number(r.split("-")[0]):-1;$e.current=n,Bt(function(n){var t,i=e.__assign({},n),o=!1;-1!==l&&(i[t=he?"left-".concat(l):String(l)]||(i[t]=!0,o=!0));-1!==c&&(i[t=he?"right-".concat(c):String(c)]||(i[t]=!0,o=!0));return o?i:n}),Dt(function(n){var t=e.__assign({},n),i=!1,l=function(e){for(var n=e.split("-"),o=n[0],r=1;r<n.length;r++)o+="-".concat(n[r]),t[o]||(t[o]=!0,i=!0)};return o&&l(o),r&&l(r),i?t:n}),setTimeout(function(){requestAnimationFrame(function(){$e.current===n&&Lt.current()})},50)}else console.warn('scrollToAndHighlightClause: nodeId "'.concat(n,'" not found'))}},[Un,Xn,he,Bt,Dt,St,Nn,Fn]),Lt=t.useRef(Mt);t.useEffect(function(){Lt.current=Mt},[Mt]);var Vt=t.useRef(null),Ht=t.useRef(null),qt=t.useRef(null),Gt=t.useRef(null),zt=t.useRef(null),Kt=t.useRef(null),Wt=t.useState([]),Yt=Wt[0],Ut=Wt[1];t.useRef(null);var Xt=t.useState(null),$t=Xt[0],Jt=Xt[1];t.useEffect(function(){if(Vn){var e=kn.fields.find(function(e){return e.analysisKey===Vn||e.key===Vn});if(e){var n=tt.current[e.key]||it.current[e.key];(null==n?void 0:n.current)&&setTimeout(function(){return n.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[Vn,kn.fields]);var Qt=t.useCallback(function(e){var n,t,i,o,r,l,u,c,a,s=null===(n=null==pt?void 0:pt.rule_difference_comparison)||void 0===n?void 0:n.fields;if(!s||!s[e])return{score:0,relation:"",highlightsA:[],highlightsB:[],hasContent:!1};var d=s[e],v=(null==d?void 0:d.relation)||(null===(i=null===(t=null==d?void 0:d.highlights)||void 0===t?void 0:t.ruleA_spans)||void 0===i?void 0:i.length)||(null===(r=null===(o=null==d?void 0:d.highlights)||void 0===o?void 0:o.ruleB_spans)||void 0===r?void 0:r.length)||(null==d?void 0:d.mappings)&&d.mappings.length>0;if(d.mappings){var f=d.mappings[0]||{};return{score:d.score,relation:f.relation||"",highlightsA:(null===(l=f.highlights)||void 0===l?void 0:l.ruleA_spans)||[],highlightsB:(null===(u=f.highlights)||void 0===u?void 0:u.ruleB_spans)||[],hasContent:!!v}}return{score:d.score,relation:d.relation||"",highlightsA:(null===(c=d.highlights)||void 0===c?void 0:c.ruleA_spans)||[],highlightsB:(null===(a=d.highlights)||void 0===a?void 0:a.ruleB_spans)||[],hasContent:!!v}},[pt]),Zt=t.useCallback(function(n,t){var i,o,r;void 0===t&&(t="left");var l=null,c=null;if("left"===t)if(l=Un[n],he&&l){var s=Xn.filter(function(e){var n;return null===(n=l.refIndexes)||void 0===n?void 0:n.includes(e.selfIndex)});c=s.find(function(e){return e.evaluationResult})||s[0]}else c=Xn[n];else if(c=Xn[n],he&&c){var d=Un.filter(function(e){var n;return null===(n=e.refIndexes)||void 0===n?void 0:n.includes(c.selfIndex)});l=d.find(function(e){return e.evaluationResult})||d[0]}else l=Un[n];var v=(null==l?void 0:l.relation)&&"not_defined"!==l.relation,f=(null==c?void 0:c.relation)&&"not_defined"!==c.relation,g=!(!(null==l?void 0:l.cognitiveData)&&!(null==c?void 0:c.cognitiveData));if(!v&&!f&&!g)return e.__assign(e.__assign({},u.generateColorPalette(a.DEFAULT_DEVIAION_COLOR)),{label:"Not Defined"});var p=null!==(o=null!==(i=null==l?void 0:l.evaluationResult)&&void 0!==i?i:null==c?void 0:c.evaluationResult)&&void 0!==o?o:null,h=u.getFirstDeviationOutputValue(p),x=u.getFirstDeviationColor(p);return null!=p?e.__assign(e.__assign({},u.generateColorPalette(x)),{label:null!==(r=h)&&void 0!==r?r:""}):e.__assign(e.__assign({},u.generateColorPalette(x)),{label:null})},[Un,Xn,un,kn,he]),ei=t.useCallback(function(n){for(var t,i,o,r,l,c=n.split("-").map(Number),s=Un[c[0]],d=Xn[c[0]],v=1;v<c.length;v++)(null==s?void 0:s.subsections)&&(s=s.subsections[c[v]]),(null==d?void 0:d.subsections)&&(d=d.subsections[c[v]]);if(!s&&!d)return null;var f=(null==s?void 0:s.relation)&&"not_defined"!==s.relation,g=(null==d?void 0:d.relation)&&"not_defined"!==d.relation,p=u.safeStringify(null==s?void 0:s.id)||u.safeStringify(null==d?void 0:d.id)||"",h=!(!(null==s?void 0:s.cognitiveData)&&!(null==d?void 0:d.cognitiveData));if(!f&&!g&&!h)return e.__assign(e.__assign({},u.generateColorPalette(a.DEFAULT_DEVIAION_COLOR)),{label:"Not Defined"});null!==(i=null!==(t=null==s?void 0:s.cognitiveRelevanceScore)&&void 0!==t?t:null==d?void 0:d.cognitiveRelevanceScore)&&void 0!==i||p&&(null===(o=un[p])||void 0===o||o.relevance_score);var x=null!==(l=null!==(r=null==s?void 0:s.evaluationResult)&&void 0!==r?r:null==d?void 0:d.evaluationResult)&&void 0!==l?l:null,m=u.getFirstDeviationOutputValue(x),_=u.getFirstDeviationColor(x);return null!=x?e.__assign(e.__assign({},u.generateColorPalette(_)),{label:null!=m?m:""}):e.__assign(e.__assign({},u.generateColorPalette(_)),{label:null})},[Un,Xn,un,kn]),ni=t.useCallback(function(n,t){var i,o,r,l,c,s,d,v,f,g,p,h,x,m,_,y,R;if(!n||null==t)return null;var b=null!==(d=null!==(c=null!==(o=null===(i=null==ae?void 0:ae[n])||void 0===i?void 0:i.evaluation_result)&&void 0!==o?o:null===(l=null===(r=null==Z?void 0:Z.nodes)||void 0===r?void 0:r[n])||void 0===l?void 0:l.evaluation_result)&&void 0!==c?c:null===(s=null==Z?void 0:Z[n])||void 0===s?void 0:s.evaluation_result)&&void 0!==d?d:null;if(!b||"object"!=typeof b)return null;var S=null!==(p=null!==(f=null===(v=null==b?void 0:b.deviations)||void 0===v?void 0:v[t])&&void 0!==f?f:null===(g=null==b?void 0:b.deviation_entries)||void 0===g?void 0:g[t])&&void 0!==p?p:null==b?void 0:b[t],A=null!==(R=null!==(m=null===(x=null===(h=null==S?void 0:S.evaluation_outputs)||void 0===h?void 0:h.metadata)||void 0===x?void 0:x.label_color)&&void 0!==m?m:null===(y=null===(_=null==b?void 0:b.evaluation_outputs)||void 0===_?void 0:_.metadata)||void 0===y?void 0:y.label_color)&&void 0!==R?R:a.DEFAULT_DEVIAION_COLOR;return e.__assign(e.__assign({},u.generateColorPalette(A)),{label:null})},[ae,Z]),ti=t.useCallback(function(){bt(),Bt({}),Dt({}),St(),ze(new Set),Ye([]),nn.current=[],Nn(),Fn(),Mn(),requestAnimationFrame(function(){ln.current&&ln.current()})},[Bt,Dt,St,Nn,Fn,Mn]),ii=t.useMemo(function(){return Object.values(Tt).some(Boolean)||Object.values(Ct).some(Boolean)},[Tt,Ct]),oi=t.useCallback(function(){var e,n,t,i,o,r,l,c,a,s,d,v,f,g,p,h,x,m,_,y,R,b,S;if(!yn.current&&!Qe.current){yn.current=!0;try{if(!Vt.current)return;var A=function(e){var n=e.split("-"),t=n[0];if(!Tt[t]&&!1===he)return!1;if(he&&!Tt["left-".concat(t)]&&!Tt["right-".concat(t)]&&!Tt[t])return!1;for(var i=t,o=1;o<n.length-1;o++)if(i+="-".concat(n[o]),!Ct[i])return!1;return!0},I=Vt.current.getBoundingClientRect();sn({width:I.width,height:I.height});var E=[];if($n.forEach(function(e){var n,t,i=e.key,o=null===(n=tt.current[i])||void 0===n?void 0:n.current,r=null===(t=it.current[i])||void 0===t?void 0:t.current;o&&r&&(o.style.height="auto",r.style.height="auto",o.style.minHeight="0px",r.style.minHeight="0px")}),!Qe.current){for(var T=0;T<Math.max(Un.length,Xn.length);T++){var B=null===(e=ot.current[T])||void 0===e?void 0:e.current,C=null===(n=rt.current[T])||void 0===n?void 0:n.current;B&&(B.style.height="auto",B.style.minHeight="0px"),C&&(C.style.height="auto",C.style.minHeight="0px")}he||Object.keys(at.current).forEach(function(e){var n,t;if(A(e)){var i=null===(n=at.current[e])||void 0===n?void 0:n.current,o=null===(t=st.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 D={};$n.forEach(function(e){var n,t,i=e.key,o=null===(n=tt.current[i])||void 0===n?void 0:n.current,r=null===(t=it.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=o.getBoundingClientRect(),u=r.getBoundingClientRect();D[i]=Math.max(l.height,u.height)}});var O={left:{},right:{}},w={};if(!Qe.current)if(he){if(Ce&&null!==Le)if("number"==typeof Le){var N=Le,j=Un[N],P=null===(o=ot.current[N])||void 0===o?void 0:o.current;P&&j&&(j.refIndexes||[]).forEach(function(e){var n,t=Xn.findIndex(function(n){return n.selfIndex===e}),i=null===(n=rt.current[t])||void 0===n?void 0:n.current;if(i&&(Tt["left-".concat(N)]||Tt["right-".concat(t)])){var o=Math.max(P.getBoundingClientRect().height,i.getBoundingClientRect().height);O.left[N]=Math.max(O.left[N]||0,o),O.right[t]=Math.max(O.right[t]||0,o)}})}else{var F=Le.split(u.DEVIATION_BADGE_SEPARATOR)[2];if(F){B=null===(r=at.current[F])||void 0===r?void 0:r.current,C=null===(l=st.current[F])||void 0===l?void 0:l.current;if(B&&C){M=Math.max(B.getBoundingClientRect().height,C.getBoundingClientRect().height);w[F]=Math.max(w[F]||0,M)}}}}else{Object.keys(at.current).forEach(function(e){var n,t;if(A(e)){var i=null===(n=at.current[e])||void 0===n?void 0:n.current,o=null===(t=st.current[e])||void 0===t?void 0:t.current;if(i&&o&&null!==i.offsetParent&&null!==o.offsetParent){var r=i.getBoundingClientRect(),l=o.getBoundingClientRect(),u=Math.max(r.height,l.height);w[e]=u,i.style.minHeight="".concat(u,"px"),o.style.minHeight="".concat(u,"px")}}});for(T=0;T<Math.min(Un.length,Xn.length);T++){var B=null===(t=ot.current[T])||void 0===t?void 0:t.current,C=null===(i=rt.current[T])||void 0===i?void 0:i.current;if(B&&C){var M=Math.max(B.getBoundingClientRect().height,C.getBoundingClientRect().height);O.left[T]=M,O.right[T]=M}}}if($n.forEach(function(e){var n,t,i=e.key,o=null===(n=tt.current[i])||void 0===n?void 0:n.current,r=null===(t=it.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=D[i];o.style.minHeight="".concat(l,"px"),r.style.minHeight="".concat(l,"px")}}),Qe.current||(Object.entries(O.left).forEach(function(e){var n,t=e[0],i=e[1],o=null===(n=ot.current[Number(t)])||void 0===n?void 0:n.current;o&&(o.style.minHeight="".concat(i,"px"))}),Object.entries(O.right).forEach(function(e){var n,t=e[0],i=e[1],o=null===(n=rt.current[Number(t)])||void 0===n?void 0:n.current;o&&(o.style.minHeight="".concat(i,"px"))}),he||Object.keys(w).forEach(function(e){var n,t,i=null===(n=at.current[e])||void 0===n?void 0:n.current,o=null===(t=st.current[e])||void 0===t?void 0:t.current;if(i&&o&&w[e]){var r=w[e];i.style.minHeight="".concat(r,"px"),o.style.minHeight="".concat(r,"px")}})),he)Un.forEach(function(e,n){var t;(null===(t=ot.current[n])||void 0===t?void 0:t.current)&&(e.refIndexes||[]).forEach(function(e){var t,i,o,r,l,u,c,a,s,d,v=Xn.findIndex(function(n){return n.selfIndex===e});if(-1!==v){var f=null===(t=lt.current[n])||void 0===t?void 0:t.current,g=null===(i=ut.current[v])||void 0===i?void 0:i.current;if(f&&g){var p=f.getBoundingClientRect(),h=g.getBoundingClientRect(),x=p.right-I.left,m=h.left-I.left,_=p.top+p.height/2-I.top,y=h.top+h.height/2-I.top;if(Ce&&Le===n){var R=null!==(r=null===(o=_n.current)||void 0===o?void 0:o.getBoundingClientRect().top)&&void 0!==r?r:0,b=null!==(u=null===(l=gn.current)||void 0===l?void 0:l.getBoundingClientRect().top)&&void 0!==u?u:0,S=R+(null!==(a=null===(c=_n.current)||void 0===c?void 0:c.clientHeight)&&void 0!==a?a:1/0),A=b+(null!==(d=null===(s=gn.current)||void 0===s?void 0:s.clientHeight)&&void 0!==d?d:1/0),T=p.top+p.height/2,B=h.top+h.height/2,C=function(e,n,t){return Math.max(n,Math.min(t,e))};_=C(T,R,S)-I.top,y=C(B,b,A)-I.top}var D=Zt(n);D&&E.push({id:"line-".concat(n,"-").concat(v),x1:x,y1:_,x2:m,y2:y,style:D,sectionIdx:n,targetRightIdx:v})}}})});else{for(T=0;T<Math.min(Un.length,Xn.length);T++){var k=null===(c=ot.current[T])||void 0===c?void 0:c.current,L=null===(a=rt.current[T])||void 0===a?void 0:a.current;if(k&&L){var V=k.getBoundingClientRect(),H=L.getBoundingClientRect(),q=Math.max(V.top,H.top)+18-I.top,G=(null===(s=Xn[T])||void 0===s?void 0:s.id)||"sec-".concat(T);(J=Zt(T))&&E.push({id:G,x1:V.right-I.left,y1:q,x2:H.left-I.left,y2:q,style:J,sectionIdx:T,hasCognitive:!!((null===(d=Un[T])||void 0===d?void 0:d.cognitiveData)||(null===(v=Xn[T])||void 0===v?void 0:v.cognitiveData)||G&&un[G]),isSubSection:!1})}}Object.keys(at.current).forEach(function(e){var n,t,i,o,r,l;if(A(e)){var c=null===(n=at.current[e])||void 0===n?void 0:n.current,a=null===(t=st.current[e])||void 0===t?void 0:t.current;if(c&&a){for(var s=e.split("-").map(Number),d=Un[s[0]],v=Xn[s[0]],f=1;f<s.length;f++)(null==d?void 0:d.subsections)&&(d=d.subsections[s[f]]),(null==v?void 0:v.subsections)&&(v=v.subsections[s[f]]);var g=!!d&&((null===(i=d.displayTitle)||void 0===i||i)&&u.hasValue(d.title)),p=!!d&&((null===(o=d.displayContent)||void 0===o||o)&&u.hasValue(d.content)),h=!!v&&((null===(r=v.displayTitle)||void 0===r||r)&&u.hasValue(v.title)),x=!!v&&((null===(l=v.displayContent)||void 0===l||l)&&u.hasValue(v.content));if(g&&p||h&&x){var m=c.getBoundingClientRect(),_=a.getBoundingClientRect(),y=Math.max(m.top,_.top)+16-I.top,R=ei(e);R&&"Not Defined"!==R.label&&E.push({id:"subsec-".concat(e),x1:m.right-I.left,y1:y,x2:_.left-I.left,y2:y,style:R,sectionIdx:s[0],isSubSection:!0,subSectionKeyPath:e,hasCognitive:!(!(null==d?void 0:d.cognitiveData)&&!(null==v?void 0:v.cognitiveData))})}}}})}if(Ce&&"string"==typeof Le&&Le.includes(u.DEVIATION_BADGE_SEPARATOR)){var z=Le.split(u.DEVIATION_BADGE_SEPARATOR),K=z[0],W=z[1],Y=z[2],U=(z[3],"".concat(K).concat(u.DEVIATION_BADGE_SEPARATOR).concat(W)),X=null===(f=lt.current[U])||void 0===f?void 0:f.current,$=null===(g=ut.current[U])||void 0===g?void 0:g.current;if(X&&$){var J,Q=X.getBoundingClientRect(),Z=$.getBoundingClientRect(),ee=Q.right-I.left,ne=Z.left-I.left,te=Q.top+Q.height/2-I.top,ie=Z.top+Z.height/2-I.top;if(he){var oe=null!==(h=null===(p=_n.current)||void 0===p?void 0:p.getBoundingClientRect().top)&&void 0!==h?h:0,re=null!==(m=null===(x=gn.current)||void 0===x?void 0:x.getBoundingClientRect().top)&&void 0!==m?m:0,le=oe+(null!==(y=null===(_=_n.current)||void 0===_?void 0:_.clientHeight)&&void 0!==y?y:1/0),ue=re+(null!==(b=null===(R=gn.current)||void 0===R?void 0:R.clientHeight)&&void 0!==b?b:1/0),ce=function(e,n,t){return Math.max(n,Math.min(t,e))};te=ce(Q.top+Q.height/2,oe,le)-I.top,ie=ce(Z.top+Z.height/2,re,ue)-I.top}(J=null!==(S=ni(K,W))&&void 0!==S?S:ei(Y))&&E.push({id:"line-subsec-".concat(U),x1:ee,y1:te,x2:ne,y2:ie,style:J,sectionIdx:Number(Y.split("-")[0]),isSubSection:!0,subSectionKeyPath:Le})}}if(Ut(E),zt.current&&Kt.current){var ae=zt.current.getBoundingClientRect(),se=Kt.current.getBoundingClientRect(),de=(ae.top+ae.height/2-I.top+se.top+se.height/2-I.top)/2;Jt({x1:ae.right-I.left,x2:se.left-I.left,y:de})}else Jt(null);if(Ge.size>0){var ve=[],fe=_n.current,ge=gn.current;if(fe&&ge){var pe=[],xe=fe.getBoundingClientRect().top,me=ge.getBoundingClientRect().top,_e=xe+fe.clientHeight,ye=me+ge.clientHeight,Re=fe.scrollTop,be=ge.scrollTop,Se=I.top,Ae=function(e,n,t){return Math.max(n,Math.min(t,e))};Ge.forEach(function(e){var n,t,i,o,r,l;if("string"==typeof e&&e.includes(u.DEVIATION_BADGE_SEPARATOR)){var c=e.split(u.DEVIATION_BADGE_SEPARATOR),a=c[0],s=c[1],d=c[2],v=(c[3],"".concat(a).concat(u.DEVIATION_BADGE_SEPARATOR).concat(s)),f=null===(n=lt.current[v])||void 0===n?void 0:n.current,g=null===(t=ut.current[v])||void 0===t?void 0:t.current;if(!f||!g)return;var p=f.getBoundingClientRect(),h=g.getBoundingClientRect(),x=null!==(i=ni(a,s))&&void 0!==i?i:ei(d),m=(P=p.right-I.left)+.5*((F=h.left-I.left-0)-P),_=p.top+p.height/2,y=h.top+h.height/2,R=_-xe+Re,b=y-me+be,S="conn-subsec-".concat(v);pe.push({lhsScrollY:R,rhsScrollY:b,x1:P,x2:F,containerTop:Se,leftIdx:e,rhsArrayIdx:e,styleColor:(null==x?void 0:x.badgeBorder)||"#6366F1",styleId:S});var A=Ae(_,xe,_e),E=Ae(y,me,ye),T=A-Se,B=E-Se,C=y>=me-4&&y<=ye+4,D="";D=(M=_>=xe-4&&_<=_e+4)&&C?u.getBentArrowPath(P,T,F,B):M&&!C?"M ".concat(P,",").concat(T," L ").concat(m,",").concat(T," L ").concat(m,",").concat(B):!M&&C?"M ".concat(m,",").concat(T," L ").concat(m,",").concat(B," L ").concat(F,",").concat(B):"M ".concat(m,",").concat(T," L ").concat(m,",").concat(B),ve.push({id:S,pathD:D,style:x,leftIdx:e,rhsArrayIdx:e})}else if(he){var O=e,w=Un[O];if(!(null===(l=null==w?void 0:w.refIndexes)||void 0===l?void 0:l.length))return;w.refIndexes.forEach(function(e){var n,t,i=Xn.findIndex(function(n){return n.selfIndex===e});if(-1!==i){var o=null===(n=lt.current[O])||void 0===n?void 0:n.current,r=null===(t=ut.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=o.getBoundingClientRect(),c=r.getBoundingClientRect(),a=Zt(O),s=l.right-I.left,d=c.left-I.left-0,v=s+.5*(d-s),f=l.top+l.height/2,g=c.top+c.height/2,p=f-xe+Re,h=g-me+be,x="conn-".concat(O,"-").concat(i);pe.push({lhsScrollY:p,rhsScrollY:h,x1:s,x2:d,containerTop:Se,leftIdx:O,rhsArrayIdx:i,styleColor:(null==a?void 0:a.badgeBorder)||"#6366F1",styleId:x});var m=Ae(f,xe,_e),_=Ae(g,me,ye),y=m-Se,R=_-Se,b=f>=xe-4&&f<=_e+4,S=g>=me-4&&g<=ye+4,A="";A=b&&S?u.getBentArrowPath(s,y,d,R):b&&!S?"M ".concat(s,",").concat(y," L ").concat(v,",").concat(y," L ").concat(v,",").concat(R):!b&&S?"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),ve.push({id:x,pathD:A,style:a,leftIdx:O,rhsArrayIdx:i})}}})}else{var N=e,j=N;f=null===(o=lt.current[N])||void 0===o?void 0:o.current,g=null===(r=ut.current[j])||void 0===r?void 0:r.current;if(!f||!g)return;var P,F;p=f.getBoundingClientRect(),h=g.getBoundingClientRect(),x=Zt(N),m=(P=p.right-I.left)+.5*((F=h.left-I.left-0)-P),_=p.top+p.height/2,y=h.top+h.height/2,R=_-xe+Re,b=y-me+be,S="conn-".concat(N,"-").concat(j);pe.push({lhsScrollY:R,rhsScrollY:b,x1:P,x2:F,containerTop:Se,leftIdx:N,rhsArrayIdx:j,styleColor:(null==x?void 0:x.badgeBorder)||"#6366F1",styleId:S});var M;A=Ae(_,xe,_e),E=Ae(y,me,ye),T=A-Se,B=E-Se,C=y>=me-4&&y<=ye+4,D="";D=(M=_>=xe-4&&_<=_e+4)&&C?u.getBentArrowPath(P,T,F,B):M&&!C?"M ".concat(P,",").concat(T," L ").concat(m,",").concat(T," L ").concat(m,",").concat(B):!M&&C?"M ".concat(m,",").concat(T," L ").concat(m,",").concat(B," L ").concat(F,",").concat(B):"M ".concat(m,",").concat(T," L ").concat(m,",").concat(B),ve.push({id:S,pathD:D,style:x,leftIdx:N,rhsArrayIdx:j})}}),nn.current=pe}Ye(ve)}else Ye([]),nn.current=[]}catch(e){console.error("Line render safe fail: ",e)}finally{yn.current=!1}}},[$n,Un,Xn,un,kn,Qt,Zt,ni,he,Ce,Le,Ge,Tt,Ct]),ri=t.useCallback(function(){var e,n,t,i,o,r,l,c,a,s,d,v,f,g,p=nn.current;if(p.length&&!Qe.current){var h=null!==(n=null===(e=_n.current)||void 0===e?void 0:e.scrollTop)&&void 0!==n?n:0,x=null!==(i=null===(t=gn.current)||void 0===t?void 0:t.scrollTop)&&void 0!==i?i:0,m=null!==(r=null===(o=_n.current)||void 0===o?void 0:o.clientHeight)&&void 0!==r?r:1/0,_=null!==(c=null===(l=gn.current)||void 0===l?void 0:l.clientHeight)&&void 0!==c?c:1/0,y=null!==(s=null===(a=_n.current)||void 0===a?void 0:a.getBoundingClientRect().top)&&void 0!==s?s:0,R=null!==(v=null===(d=gn.current)||void 0===d?void 0:d.getBoundingClientRect().top)&&void 0!==v?v:0,b=y+m,S=R+_,A=null!==(g=null===(f=Vt.current)||void 0===f?void 0:f.getBoundingClientRect().top)&&void 0!==g?g:0,I=function(e,n,t){return Math.max(n,Math.min(t,e))};p.forEach(function(e){var n=e.lhsScrollY-h+y,t=e.rhsScrollY-x+R,i=en.current[e.styleId+"-stroke"],o=en.current[e.styleId+"-bg"];if(i||o){var r,l=I(n,y,b),c=I(t,R,S),a=l-A,s=c-A,d=n>=y-4&&n<=b+4,v=t>=R-4&&t<=S+4,f=e.x1+.5*(e.x2-e.x1);r=d&&v?u.getBentArrowPath(e.x1,a,e.x2,s):d&&!v?"M ".concat(e.x1,",").concat(a," L ").concat(f,",").concat(a," L ").concat(f,",").concat(s):!d&&v?"M ".concat(f,",").concat(a," L ").concat(f,",").concat(s," L ").concat(e.x2,",").concat(s):"M ".concat(f,",").concat(a," L ").concat(f,",").concat(s),i&&(i.setAttribute("visibility","visible"),i.setAttribute("d",r)),o&&(o.setAttribute("visibility","visible"),o.setAttribute("d",r))}})}},[]);t.useEffect(function(){ln.current=oi},[oi]);var li=t.useRef(null),ui=t.useRef(null),ci=t.useCallback(function(){nn.current.length>0&&!Qe.current||(null!==li.current&&clearTimeout(li.current),li.current=setTimeout(function(){ln.current(),li.current=null},50))},[]),ai=t.useCallback(function(){Me(!0),je(!1),Xe.current=null,null!==ui.current&&clearTimeout(ui.current),null!==li.current&&(clearTimeout(li.current),li.current=null),ui.current=setTimeout(function(){var e,n,t,i,o,r,l,c,a,s,d;try{if(nn.current=[],on.current&&null!==rn.current&&null!==qt.current){var v=rn.current,f=qt.current,g="string"==typeof v&&v.includes(u.DEVIATION_BADGE_SEPARATOR),p=null,h=null,x=null,m=null;if(g){var _=v.split(u.DEVIATION_BADGE_SEPARATOR),y="".concat(_[0]).concat(u.DEVIATION_BADGE_SEPARATOR).concat(_[1]);p=(null===(e=lt.current[y])||void 0===e?void 0:e.current)||null,h=(null===(n=ut.current[y])||void 0===n?void 0:n.current)||null,x=(null===(t=at.current[_[2]])||void 0===t?void 0:t.current)||(null===(i=ot.current[Number(_[2])])||void 0===i?void 0:i.current)||null,m=(null===(o=st.current[_[3]])||void 0===o?void 0:o.current)||(null===(r=rt.current[Number(_[3])])||void 0===r?void 0:r.current)||null}else p=(null===(l=dt.current[v])||void 0===l?void 0:l.current)||null,x=(null===(c=ot.current[v])||void 0===c?void 0:c.current)||null,h=(null===(a=ct.current[f])||void 0===a?void 0:a.current)||null,m=(null===(s=rt.current[f])||void 0===s?void 0:s.current)||null;if(p&&h&&x&&m){if(x.style.paddingTop="0px",m.style.paddingTop="0px",!he){var R=p.getBoundingClientRect(),b=h.getBoundingClientRect(),S=R.top-b.top;S>0?m.style.paddingTop="".concat(S,"px"):S<0&&(x.style.paddingTop="".concat(Math.abs(S),"px"))}var A=_n.current,I=gn.current;if(A&&I){var E=p.getBoundingClientRect().top-A.getBoundingClientRect().top+A.scrollTop,T=h.getBoundingClientRect().top-I.getBoundingClientRect().top+I.scrollTop-(E-A.scrollTop);Math.abs(I.scrollTop-T)>1&&(I.scrollTop=T)}}}null===(d=ln.current)||void 0===d||d.call(ln),on.current&&je(!0)}catch(e){console.error("Safely caught error during resize calculation:",e)}finally{Me(!1),ui.current=null}},150)},[he,Un,Xn]),si=t.useCallback(function(e){if(null!==Rn.current&&bn.current&&Math.abs(e.currentTarget.scrollTop-Rn.current)<=2){var n=bn.current;Rn.current=null,bn.current=null,n()}He.current||(he||ci(),tn.current||(tn.current=!0,requestAnimationFrame(function(){var e,n,t,i,o,r,l;if(on.current){var c=_n.current,a=gn.current;if(c&&a&&Gt.current){if(!Xe.current){var s=rn.current,d=void 0;if("string"==typeof s&&s.includes(u.DEVIATION_BADGE_SEPARATOR)){var v=s.split(u.DEVIATION_BADGE_SEPARATOR),f="".concat(v[0]).concat(u.DEVIATION_BADGE_SEPARATOR).concat(v[1]);d=null===(e=lt.current[f])||void 0===e?void 0:e.current}else d=null===(n=lt.current[s])||void 0===n?void 0:n.current;if(d){var g=d.getBoundingClientRect();Xe.current={badgeScreenY:g.top+g.height/2,initialScrollTop:c.scrollTop,leftTop:c.getBoundingClientRect().top,leftBottom:c.getBoundingClientRect().top+c.clientHeight,cTop:null!==(i=null===(t=Vt.current)||void 0===t?void 0:t.getBoundingClientRect().top)&&void 0!==i?i:0}}}if(Xe.current){var p=Xe.current,h=c.scrollTop-p.initialScrollTop,x=p.badgeScreenY-h,m=((o=x,r=p.leftTop,l=p.leftBottom,Math.max(r,Math.min(l,o)))-p.cTop).toString(),_=x>=p.leftTop-4&&x<=p.leftBottom+4;Gt.current.setAttribute("y1",m),Gt.current.setAttribute("y2",m),Gt.current.setAttribute("visibility",_?"visible":"hidden")}}}nn.current.length>0&&ri(),tn.current=!1})))},[ri,he,ci]),di=t.useRef(0),vi=t.useRef(0),fi=t.useRef(0),gi=t.useRef(function(){});t.useRef(null),t.useEffect(function(){gi.current=ai},[ai]),t.useEffect(function(){var e=setTimeout(ci,250),n=function(){return gi.current()};return window.addEventListener("resize",n),function(){clearTimeout(e),null!==li.current&&clearTimeout(li.current),null!==ui.current&&clearTimeout(ui.current),window.removeEventListener("resize",n)}},[Wn,Yn,pt,$n,Tt,Ct,Un,Xn,kn,ci,Ce,Le,Ne,Ge]),t.useEffect(function(){var e=function(e,n,t,i,o){n.current=e.getBoundingClientRect().width;var r=new ResizeObserver(function(e){null!==t.current&&cancelAnimationFrame(t.current),t.current=requestAnimationFrame(function(){var r,l,u;t.current=null;var c=e[e.length-1];if(c){var a=null!==(u=null===(l=null===(r=c.borderBoxSize)||void 0===r?void 0:r[0])||void 0===l?void 0:l.inlineSize)&&void 0!==u?u:c.contentRect.width;Math.abs(a-n.current)<1?o():(n.current=a,i())}})});return r.observe(e),r},n={current:null},t={current:null},i={current:null},o=[],r=[n,t,i];return fn.current&&o.push(e(fn.current,di,n,function(){return gi.current()},function(){})),vn.current&&o.push(e(vn.current,vi,t,function(){return gi.current()},function(){return ln.current()})),Vt.current&&o.push(e(Vt.current,fi,i,function(){return gi.current()},function(){return ln.current()})),function(){o.forEach(function(e){return e.disconnect()}),r.forEach(function(e){null!==e.current&&(cancelAnimationFrame(e.current),e.current=null)})}},[]),t.useEffect(function(){on.current=Ce},[Ce]),t.useEffect(function(){rn.current=Le},[Le]);var pi=t.useCallback(function(e,n,t){var i,o,r=null===(i=null==t?void 0:t.toggleIfSame)||void 0===i||i,l=null==t?void 0:t.onReady,c=null!==(o=null==t?void 0:t.sourceSide)&&void 0!==o?o:"left";Mn(),null!=e&&(n?Te("No counterpart exists for this section."):(bt(),Ce&&Le===e?r?St():null==l||l():(ze(new Set([e])),Ye([]),nn.current=[],Ae(!0),He.current=!0,Ve(e),rn.current=e,De(!0),on.current=!0,je(!1),pn.current&&(pn.current.style.height="0px"),hn.current&&(hn.current.style.height="0px"),xn.current&&(xn.current.style.height="0px"),mn.current&&(mn.current.style.height="0px"),requestAnimationFrame(function(){var n,t,i,o,r,a="string"==typeof e&&e.includes(u.DEVIATION_BADGE_SEPARATOR),s=null,d=null,v=null;if(a){var f=e.split(u.DEVIATION_BADGE_SEPARATOR),g="".concat(f[0]).concat(u.DEVIATION_BADGE_SEPARATOR).concat(f[1]);s=(null===(n=lt.current[g])||void 0===n?void 0:n.current)||null,d=(null===(t=ut.current[g])||void 0===t?void 0:t.current)||null,v=d?e:null}else if(s=(null===(i=dt.current[e])||void 0===i?void 0:i.current)||null,he){var p=Un[e],h=(null==p?void 0:p.refIndexes)||[];if(h.length>0){var x=h[0],m=Xn.findIndex(function(e){return e.selfIndex===x});-1!==m&&(d=(null===(r=ct.current[m])||void 0===r?void 0:r.current)||null,v=m)}}else d=(null===(o=ct.current[e])||void 0===o?void 0:o.current)||null,v=d?e:null;qt.current=v;var _=_n.current,y=gn.current,R=function(){!function(){var n,t,i,o,r,l,c,s,d,f,g,p,h=null,x=null,m=null,_=null;if(a){var y=e.split(u.DEVIATION_BADGE_SEPARATOR),R="".concat(y[0]).concat(u.DEVIATION_BADGE_SEPARATOR).concat(y[1]);h=(null===(n=at.current[y[2]])||void 0===n?void 0:n.current)||(null===(t=ot.current[Number(y[2])])||void 0===t?void 0:t.current)||null,x=(null===(i=st.current[y[3]])||void 0===i?void 0:i.current)||(null===(o=rt.current[Number(y[3])])||void 0===o?void 0:o.current)||null,m=(null===(r=lt.current[R])||void 0===r?void 0:r.current)||h,_=(null===(l=ut.current[R])||void 0===l?void 0:l.current)||x}else{var b=Number(e),S=null!==v?Number(v):b;h=(null===(c=ot.current[b])||void 0===c?void 0:c.current)||null,x=(null===(s=rt.current[S])||void 0===s?void 0:s.current)||null,m=(null===(d=lt.current[b])||void 0===d?void 0:d.current)||(null===(f=dt.current[b])||void 0===f?void 0:f.current)||h,_=(null===(g=ut.current[S])||void 0===g?void 0:g.current)||(null===(p=ct.current[S])||void 0===p?void 0:p.current)||x}if(m&&_&&h&&x){h.style.paddingTop="0px",x.style.paddingTop="0px";var A=m.getBoundingClientRect(),I=_.getBoundingClientRect(),E=A.top-I.top;E>0?x.style.paddingTop="".concat(E,"px"):E<0&&(h.style.paddingTop="".concat(Math.abs(E),"px"))}}(),je(!0),ln.current&&ln.current(),He.current=!1,"right"===c&&y?y.dispatchEvent(new Event("scroll")):_&&_.dispatchEvent(new Event("scroll")),Ae(!1),null==l||l()};if(!s||!_)return He.current=!1,Ae(!1),void(null==l||l());if(d&&y){if(!he){var b=0;b="right"===c?d?d.getBoundingClientRect().top:0:s?s.getBoundingClientRect().top:0;var S=vn.current,A=(null==S?void 0:S.getBoundingClientRect().top)||0,I=S?S.scrollTop+b-A-150:0;return S?void u.smoothScrollTo(S,I,200,R):void R()}var E=s.getBoundingClientRect().top-_.getBoundingClientRect().top+_.scrollTop,T=d.getBoundingClientRect().top-y.getBoundingClientRect().top+y.scrollTop,B=200;if("left"===c){var C=T-(E-_.scrollTop);C<0&&pn.current&&(pn.current.style.height="".concat(Math.abs(C),"px")),requestAnimationFrame(function(){var e,n=y.scrollHeight-y.clientHeight;if(C<0)e=0;else{if(C>n){var t=C-n;return hn.current&&(hn.current.style.height="".concat(t+150,"px")),void requestAnimationFrame(function(){u.smoothScrollTo(y,C,B,R)})}e=C}u.smoothScrollTo(y,e,B,R)})}else{var D=E-(T-y.scrollTop);D<0&&xn.current&&(xn.current.style.height="".concat(Math.abs(D),"px")),requestAnimationFrame(function(){var e,n=_.scrollHeight-_.clientHeight;if(D<0)e=0;else{if(D>n){var t=D-n;return mn.current&&(mn.current.style.height="".concat(t+150,"px")),void requestAnimationFrame(function(){u.smoothScrollTo(_,D,B,R)})}e=D}u.smoothScrollTo(_,e,B,R)})}}else R()}))))},[Le,Mn,Xn,Ce,he,Un,St]),hi=t.useCallback(function(e,n,t,i,o){var r,l="string"==typeof i?u.safeStringify(i).trim():u.safeStringify(null==i?void 0:i.deviation_summary).trim(),c=e.currentTarget;Fn();var a="left";(null===(r=gn.current)||void 0===r?void 0:r.contains(c))&&(a="right");var s=function(){var e,t,i,o;if("string"==typeof n&&n.includes(u.DEVIATION_BADGE_SEPARATOR)){var r=n.split(u.DEVIATION_BADGE_SEPARATOR),l="".concat(r[0]).concat(u.DEVIATION_BADGE_SEPARATOR).concat(r[1]);return"right"===a?null===(e=ut.current[l])||void 0===e?void 0:e.current:null===(t=lt.current[l])||void 0===t?void 0:t.current}return"right"===a?null===(i=ut.current[n])||void 0===i?void 0:i.current:null===(o=lt.current[n])||void 0===o?void 0:o.current};if(t)return St(),ze(new Set),Ye([]),nn.current=[],void(l&&requestAnimationFrame(function(){var e=s()||c;wn({open:!0,anchorEl:e,summary:i,displayImpact:o})}));pi(n,t,l?{toggleIfSame:!1,sourceSide:a,onReady:function(){var e=s()||c;wn({open:!0,anchorEl:e,summary:i,displayImpact:o})}}:{toggleIfSame:!1,sourceSide:a})},[pi,Fn,wn,St]),xi=t.useCallback(function(){var e,n=En.sectionIdx,t=En.isOrphan;if(Nn(),null!=n){var i="left";En.anchorEl&&(null===(e=gn.current)||void 0===e?void 0:e.contains(En.anchorEl))&&(i="right"),pi(n,t,{sourceSide:i})}},[pi,En.isOrphan,En.sectionIdx,En.anchorEl,Nn]),mi=t.useCallback(function(){Nn(),St(),ze(new Set),Ye([]),nn.current=[]},[Nn,St]),_i=null!==En.sectionIdx&&Ge.has(En.sectionIdx),yi=m.useDeviationNavigation({proposedSections:Un,existingSections:Xn,parentDeviationRecord:Jn,expandedSections:Tt,maintainRelativeOrder:!!he,scrollContainerRef:vn,leftContainerRef:_n,lhsBadgeRefs:lt,rhsBadgeRefs:ut}),Ri=yi.showDeviationNavigation,bi=yi.showOpenNodeRef,Si=t.useMemo(function(){var e;if(!se)return null;var n=null===(e=null==se?void 0:se.id)||void 0===e?void 0:e.split(":")[0];for(var t in Jn){if((Jn[t]||[]).some(function(e){return e.id===n}))return t}return null},[se,Jn]),Ai=t.useRef({id:null,triggerMs:null}),Ii=t.useRef(null);t.useEffect(function(){var n;if(null==se?void 0:se.id){var t=Number(se.trigger),i=Ai.current;if((null==i?void 0:i.triggerMs)!==t){if(!(se.id.includes(":")&&/:\d+$/.test(se.id)))return Ai.current={id:se.id,triggerMs:t},void kt(se.id);var o=null===(n=null==se?void 0:se.id)||void 0===n?void 0:n.split(":"),r=o[0],l=o[1],c=null!=l?l:"0";Ii.current!==se.id&&(Nn(),Fn(),St(),ze(new Set),Ye([]),nn.current=[],Ii.current=se.id);var a=!1,s=0,d=null,v=150,f=function(e,n){for(var t=function(e,i){if(!e)return null;if(e.id===n)return i;if(!Array.isArray(e.subsections))return null;for(var o=0;o<e.subsections.length;o++){var r=t(e.subsections[o],"".concat(i,"-").concat(o));if(r)return r}return null},i=0;i<e.length;i++){var o=t(e[i],String(i));if(o)return o}return null},g=function(){var n,i,o,l;if(!a){var p=function(){Ai.current={id:se.id,triggerMs:t}},h=null,x=null;for(var m in Jn){var _=Jn[m].find(function(e){return e.id===r});if(_){h=m,x=_;break}}if(x&&h){var y=Un.findIndex(function(e){return e.id===h}),R=Xn.findIndex(function(e){return e.id===h}),b=-1===y&&-1!==R,S=f(Un,x.id),A=f(Xn,x.id);if(S&&!A&&!b){var I=S.split("-"),E=Number(I[0]);if(he){var T=null===(i=null===(n=Un[E])||void 0===n?void 0:n.refIndexes)||void 0===i?void 0:i[0],B=Xn.findIndex(function(e){return e.selfIndex===T});-1!==B&&(E=B)}A=e.__spreadArray([E],I.slice(1),!0).join("-")}if(S||A){var C=b||!S&&!!A,D=S?Number(S.split("-")[0]):y,O=A?Number(A.split("-")[0]):R;if(C){if(!(he?!!Tt["right-".concat(O)]:!!Tt[String(O)])&&O>=0)return Ot(O,"right"),s+=1,void(d=setTimeout(g,450))}else if(!(he?!!Tt["left-".concat(D)]:!!Tt[String(D)])&&D>=0)return Ot(D,"left"),s+=1,void(d=setTimeout(g,450));var w,N=S||"",j=A||"",P="".concat(x.id).concat(u.DEVIATION_BADGE_SEPARATOR).concat(c).concat(u.DEVIATION_BADGE_SEPARATOR).concat(N).concat(u.DEVIATION_BADGE_SEPARATOR).concat(j),F="".concat(x.id).concat(u.DEVIATION_BADGE_SEPARATOR).concat(c),M=null===(o=lt.current[F])||void 0===o?void 0:o.current,k=null===(l=ut.current[F])||void 0===l?void 0:l.current,L=C||!M&&!!k,V=L?k:M;if(w=he?L?gn.current:_n.current:vn.current,V&&w){var H=V.getBoundingClientRect();if(0===H.height)return void((s+=1)<2?d=setTimeout(g,v):p());var q=w.getBoundingClientRect(),G=H.top-q.top+w.scrollTop-q.height/2+H.height/2+150,z=function(){var n,t,i,o,r;if(!a){p();var l=V instanceof Element?window.getComputedStyle(V).color:"";M&&(M.style.transition="box-shadow 300ms ease-in-out",M.style.boxShadow="0 0 10px ".concat(l)),k&&(k.style.transition="box-shadow 300ms ease-in-out",k.style.boxShadow="0 0 10px ".concat(l)),setTimeout(function(){M&&(M.style.boxShadow=""),k&&(k.style.boxShadow="")},2e3);var u=(null===(t=null===(n=x.evaluationResult)||void 0===n?void 0:n.deviations)||void 0===t?void 0:t[c])||x,s=(null===(i=x.evaluationResult)||void 0===i?void 0:i.evaluation_outputs)||x.evaluation_outputs;if(!(!!M&&!!k)){var d=L?(null===(o=ut.current[F])||void 0===o?void 0:o.current)||k:(null===(r=lt.current[F])||void 0===r?void 0:r.current)||M;return wn({open:!0,anchorEl:d,displayImpact:se.displayImpact,summary:e.__assign(e.__assign({},u),{evaluation_outputs:s})}),void(null==de||de())}pi(P,!1,{toggleIfSame:!1,sourceSide:"left",onReady:function(){var n,t=(null===(n=lt.current[F])||void 0===n?void 0:n.current)||M;console.log("Summary data",s,u),wn({open:!0,anchorEl:t,displayImpact:null==se?void 0:se.displayImpact,summary:e.__assign({},u)})}})}};Math.abs(w.scrollTop-G)<=2?z():(Rn.current=G,bn.current=z,w.scrollTo({top:G,behavior:"smooth"}),d&&clearTimeout(d),d=setTimeout(function(){if(bn.current){Rn.current=null;var e=bn.current;bn.current=null,e()}},800))}else(s+=1)<2?d=setTimeout(g,v):p()}else(s+=1)<2?d=setTimeout(g,v):p()}else(s+=1)<2?d=setTimeout(g,v):p()}};return d=setTimeout(g,v),function(){a=!0,d&&clearTimeout(d)}}}},[se,Jn,Un,Xn,he,Tt,Ot,pi,wn,kt]);var Ei=function(e){var t=e.section,i=e.keyPath,o=e.depth,r=void 0===o?0:o,l=e.columnKey,u=void 0===l?"left":l,c=e.parentNodeId,a=void 0===c?"":c;return n.jsx(R.default,{section:t,keyPath:i,depth:r,columnKey:u,parentNodeId:a,expandedSubSections:Ct,setExpandedSubSections:Dt,maintainRelativeOrder:he||!1,proposedSections:Un,existingSections:Xn,treeData:Z,deviationNumberRegistry:Qn,connectedSections:Ge,activeSideBySideSection:Le,resolvedMarkdownStyles:dn,getSubSectionRef:ft,getSubSectionCompareStyle:ei,getBadgeRef:gt,openMoreFunctionsPopup:jt,openSummaryPopup:hi,showDeviationBadges:me,resetSideBySide:St,setConnectedSections:ze,setConnectedLines:Ye,cachedConnectedPositions:nn,isProposingFix:fe,proposingFixNodeId:ge})};return n.jsxs(i.Box,e.__assign({ref:fn,sx:e.__assign(e.__assign({display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif'},he?{}:{overflow:"visible"}),{position:"relative"})},{children:[ye&&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(b.default,{open:On.open,anchorEl:On.anchorEl,containerEl:Ht.current,clipTopEl:zt.current,scrollContainerEl:vn.current,onClose:mi,summary:On.summary,displayImpact:On.displayImpact}),n.jsx(d.default,{open:En.open,anchorEl:En.anchorEl,sectionTitle:En.sectionTitle,referenceSectionTitle:En.refSectionTitle,onClose:Mn,onOpenCognitiveCompare:Pt,onOpenSideBySide:xi,onConnect:Ft,isConnected:_i,isOrphan:En.isOrphan}),An.open&&n.jsx(s.default,{open:An.open,popupRef:Pn,position:Bn,popupConfig:ue,onClose:function(){Cn(null),In(function(n){return e.__assign(e.__assign({},n),{open:!1})}),jn(null)},markdownStyles:ie,sectionTitle:An.sectionTitle,referenceSectionTitle:An.refSectionTitle,cognitiveData:An.cognitiveData,anchorEl:An.anchorEl,sectionAnchorEl:An.sectionAnchorEl,scrollContainerEl:vn.current,badgeStyle:An.badgeStyle,docData:An.docData,deviationData:An.deviationData,isLoading:An.isLoading}),n.jsx(i.Snackbar,e.__assign({open:!!Ee,autoHideDuration:8e3,onClose:function(){return Te(null)},anchorOrigin:{vertical:"top",horizontal:"center"}},{children:n.jsx(i.Alert,e.__assign({onClose:function(){return Te(null)},severity:"error",sx:{width:"100%",whiteSpace:"pre-line"}},{children:Ee}))})),n.jsx(_.default,{componentHeaderText:Q,displayConfig:le,maintainRelativeOrder:he,onCollapseAll:ti,showCollapseAll:ii,onToggleView:function(e){Re(!0),setTimeout(function(){xe(!e),St(),Nn(),ze(new Set),Ye([]),nn.current=[],requestAnimationFrame(function(){requestAnimationFrame(function(){setTimeout(function(){Re(!1)},600)})})},50)}}),n.jsx(i.Box,e.__assign({ref:vn,onScroll:si,sx:{flex:1,minHeight:0,pt:1.5,pb:1,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",overflowY:he?"hidden":"auto",borderTop:ht&&xt?"none":"1.5px solid #EEF0F4"}},{children:n.jsx(i.Box,e.__assign({sx:e.__assign({display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"},he?{flex:1,minHeight:0}:{})},{children:n.jsxs(i.Box,e.__assign({ref:Vt,sx:e.__assign({display:"grid",gridTemplateColumns:"minmax(0, 1fr) 180px minmax(0, 1fr)",gap:"40px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0},he?{flex:1,overflow:"visible"}:{})},{children:[n.jsxs("svg",e.__assign({ref:Ue,style:{position:"absolute",top:0,left:0,width:an.width||"100%",height:an.height||"100%",pointerEvents:"none",zIndex:10,overflow:"visible",opacity:Fe?0:1,transition:"opacity 0.15s ease-in-out"}},{children:[$t&&n.jsx("g",{children:n.jsx("line",{x1:$t.x1,y1:$t.y,x2:$t.x2,y2:$t.y,stroke:Rt.badgeBorder,strokeWidth:"1.5"})}),Yt.map(function(t){var l,c,s,d,v,g,p=t.x1+.5*(t.x2-t.x1),h=(t.y1+t.y2)/2;if("Not Defined"===t.style.label&&!t.hasCognitive)return null;if(t.isSubSection?Ce&&Le===t.subSectionKeyPath&&Ne:Ce&&Le===t.sectionIdx&&Ne)return null;if(!he){var x=t.isSubSection?u.getBentArrowPath(t.x1,t.y1,t.x2,t.y2):"M ".concat(t.x1," ").concat(t.y1," L ").concat(t.x2," ").concat(t.y2),m=Un[t.sectionIdx]||{title:"",content:""},_=Xn[t.sectionIdx]||{title:"",content:""};if(console.log("Base and Ref Sections for Badge:",m,_),t.isSubSection&&t.subSectionKeyPath){var y=t.subSectionKeyPath.includes(u.DEVIATION_BADGE_SEPARATOR)?t.subSectionKeyPath.split(u.DEVIATION_BADGE_SEPARATOR):[],R=y[2]||t.subSectionKeyPath,b=y[3]||R,S=R.split("-").map(Number),A=b.split("-").map(Number),I=null,E=null;S.length>0&&(I=Un[S[0]]),A.length>0&&(E=Xn[A[0]]);var T=(null==I?void 0:I.title)||"",B=(null==E?void 0:E.title)||"";console.log("Root Parent Titles:",T,B);for(var C=1;C<S.length;C++)(null==I?void 0:I.subsections)&&(I=I.subsections[S[C]]);for(C=1;C<A.length;C++)(null==E?void 0:E.subsections)&&(E=E.subsections[A[C]]);I&&(m=e.__assign(e.__assign({},I),{title:T||I.title})),console.log("Base Section for Subsection Badge:",m),E&&(_=e.__assign(e.__assign({},E),{title:B||E.title})),console.log("Ref Section for Subsection Badge:",_)}var D=!(null===(l=m.cognitiveData)||void 0===l?void 0:l.isMissingRationale)||Boolean(null===(s=null===(c=m.cognitiveData)||void 0===c?void 0:c.decisioning)||void 0===s?void 0:s.length),O=(null===(g=null===(v=null===(d=m.evaluationResult)||void 0===d?void 0:d.cognitive_decisioning)||void 0===v?void 0:v.decisioning_factors)||void 0===g?void 0:g.length)||!1,w=D||O;return n.jsxs("g",{children:[n.jsx("path",{d:x,fill:"none",stroke:t.style.badgeBorder||"#E2E8F0",strokeWidth:"1.5"}),n.jsx("foreignObject",e.__assign({x:p-100,y:h-14,width:"200",height:"28",style:{pointerEvents:"auto",overflow:"visible"}},{children:n.jsx(i.Box,e.__assign({sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},{children:n.jsxs(i.Box,e.__assign({onClick:function(e){e.stopPropagation(),w&&(An.open&&Dn===t.id?Fn():(jn(t.id),Nt(wt(e.currentTarget,m,_,t.sectionIdx,t.style))))},sx:{display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",bgcolor:t.style.badgeBg,color:t.style.badgeText,border:"1px solid ".concat(t.style.badgeBorder),borderRadius:"12px",px:1.5,py:.5,fontWeight:600,textAlign:"center",whiteSpace:"nowrap",cursor:w?"pointer":"default"}},{children:[t.style.badgeText===a.DEFAULT_DEVIAION_COLOR&&null==t.style.label?n.jsx(f.default,{color:t.style.badgeText}):0===t.style.label?"Same":t.style.label,n.jsx(i.Box,e.__assign({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:n.jsx(r.ButtonCognitiveIcon,{})})),w&&n.jsx(o.ChevronDown,{size:11,style:{transform:An.open&&Dn===t.id?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))}))]},t.id)}return null}),n.jsx(S.default,{connectedLines:We,pathRefs:en})]})),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)"},he?{flex:1,overflow:"visible"}:{})},{children:[n.jsx(i.Box,e.__assign({ref:zt,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:Gn,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:Gn}))}))})),n.jsxs(i.Box,e.__assign({ref:_n,onScroll:si,sx:e.__assign({p:"12px",display:"flex",flexDirection:"column"},he?{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:xn,style:{width:"100%",height:"0px",flexShrink:0}}),et&&Un.map(function(t,r){var l,c,a=!t.title&&!t.content;if(he&&a)return null;var s=t,d=Zt(r,"left"),v=he?!(null===(l=s.refIndexes)||void 0===l?void 0:l.length)||s.selfIndex<0:!Xn[r],g=he?"number"==typeof s.selfIndex&&s.selfIndex>=0?s.selfIndex+1:null:r+1,p=Ge.has(r),h=u.extractDeviationScore(s.evaluationResult,null==d?void 0:d.deviationLabel);return n.jsx(i.Box,e.__assign({ref:vt(r),sx:{mb:1,width:"100%"}},{children:n.jsxs(i.Box,e.__assign({sx:{position:"relative",width:"100%"}},{children:[n.jsx(i.Box,e.__assign({ref:ot.current[r],sx:e.__assign({width:"100%",display:"flex",flexDirection:"column",minWidth:0},p&&{borderRadius:"6px",outline:"2px solid ".concat((null==d?void 0:d.badgeBorder)||"#6366F1"),outlineOffset:"1px"})},{children:n.jsx(y.default,{section:t,idx:r,columnKey:"left",colRef:vt("left-accordion-".concat(r)),mb:0,treeData:Z,proposedSections:Un,existingSections:Xn,deviationNumberRegistry:Qn,getSectionCompareStyle:Zt,getBadgeRef:gt,connectedSections:Ge,openMoreFunctionsPopup:jt,openSummaryPopup:hi,deviationNodeIdToView:null==se?void 0:se.id,deviationTargetParentId:Si,parentNodeId:(null===(c=null==Z?void 0:Z.input_index_map)||void 0===c?void 0:c[0])||"",isExpanded:he?!!Tt["left-".concat(r)]:!!Tt[String(r)],onToggle:function(){mi(),Ot(r,"left")},navigation:t.id?Ri[t.id]:null,showOpenNodeRef:bi,resolvedMarkdownStyles:dn,maintainRelativeOrder:he,showDeviationBadges:me,renderSubSections:Ei,isProposingFix:fe,proposingFixNodeId:ge,collisionKey:"".concat(Ce?"1":"0","-").concat(String(null!=Le?Le:""))})})),he&&d&&n.jsxs(i.Box,e.__assign({ref:lt.current[r],onClick:function(e){var n,t,i,o=le.enableDeviationSchemaBackwardCompatibility?null!==(n=s.evaluationResult)&&void 0!==n?n:null:null!==(i=null===(t=s.evaluationResult)||void 0===t?void 0:t[0])&&void 0!==i?i:null;hi(e,String(r),v,o)},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:[n.jsxs(i.Box,e.__assign({component:"span",onClick:function(e){var n,t,i;e.stopPropagation();var o=le.enableDeviationSchemaBackwardCompatibility?null!==(n=s.evaluationResult)&&void 0!==n?n:null:null!==(i=null===(t=s.evaluationResult)||void 0===t?void 0:t[0])&&void 0!==i?i:null;hi(e,String(r),v,o)},sx:{display:"inline-flex",alignItems:"center",gap:"4px",px:.2,cursor:v?"default":"pointer",borderRight:"1px solid ".concat(d.badgeBorder),"&:hover":v?{}:{bgColor:"".concat(d.badgeBorder,"22")}}},{children:[null!=g&&n.jsx(i.Box,e.__assign({component:"span",sx:{fontSize:"11px",fontWeight:700,pr:.5,borderRight:"1px solid ".concat(d.badgeBorder)}},{children:g})),n.jsx(i.Box,e.__assign({component:"span",sx:{fontSize:"11px",px:.25}},{children:!le.isLoading||null!=s.evaluationResult&&null!=s.evaluationResult?"N/A"===h||"NA"===h?"N/A":0==h||null==h?"Same":"".concat(h):n.jsx(f.default,{color:d.badgeText})}))]})),n.jsx(i.Box,e.__assign({component:"span",onClick:function(e){e.stopPropagation();var n=he?Xn.find(function(e){var n;return(null===(n=s.refIndexes)||void 0===n?void 0:n.includes(e))||{title:"",content:""}}):Xn[r]||{title:"",content:""};jt(e,t,v,n,r,d)},sx:{display:"inline-flex",alignItems:"center",px:.2,cursor:"pointer","&:hover":{bgcolor:"".concat(d.badgeBorder,"22")}}},{children:n.jsx(o.EllipsisVertical,{size:11,color:d.badgeText})}))]}))]}))}),"left-row-".concat(r))}),n.jsx("div",{ref:mn,style:{width:"100%",height:"0px",flexShrink:0}})]}))]})),n.jsx(i.Box,e.__assign({ref:Ht,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(),An.open&&Dn===mt?Fn():(jn(mt),Nt(wt(n.currentTarget,{title:"",content:"",evaluationResult:_t,cognitiveData:{section_id:"",decisioning:[],gap:[],relevance_score:0,isMissingRationale:!0}},null,mt,!0,e.__assign(e.__assign({},Rt),{label:""}))))},sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:"5px",top:"-8px",borderRadius:"20px",bgcolor:Rt.badgeBg,color:Rt.badgeText,border:"1px solid ".concat(Rt.badgeBorder),fontSize:"12px",fontWeight:600,whiteSpace:"nowrap",position:"relative",zIndex:1,pointerEvents:"auto",cursor:"pointer"}},{children:[null!=yt?yt:n.jsx(f.default,{}),n.jsx(i.Box,e.__assign({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:n.jsx(r.ButtonCognitiveIcon,{})})),n.jsx(o.ChevronDown,{size:11,style:{transform:An.open&&Dn===mt?"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},he?{flex:1,overflow:"visible",minHeight:0}:{})},{children:[Se&&n.jsx(l.default,{sections:11}),n.jsx(i.Box,e.__assign({ref:Kt,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:zn,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:zn}))}))})),n.jsxs(i.Box,e.__assign({ref:gn,onScroll:si,sx:e.__assign({p:"12px",display:"flex",flexDirection:"column"},he?{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:pn,style:{width:"100%",height:"0px",flexShrink:0}}),et&&Xn.map(function(t,o){var r,l=t,u=[],c=!1,a=null,s=-1;if(he){u=Un.filter(function(e){var n;return(null===(n=e.refIndexes)||void 0===n?void 0:n.includes(l.selfIndex))&&e.selfIndex>=0}).map(function(e){return e.selfIndex+1}),s=Un.findIndex(function(e){var n;return(null===(n=e.refIndexes)||void 0===n?void 0:n.includes(l.selfIndex))&&e.selfIndex>=0});var d=Un.findIndex(function(e,n){var t;return Ge.has(n)&&(null===(t=e.refIndexes)||void 0===t?void 0:t.includes(l.selfIndex))});(c=-1!==d)&&(a=Zt(d))}else u=[o+1],(c=Ge.has(o))&&(a=Zt(o));var v=Zt(he&&-1!==s?s:o);return n.jsx(i.Box,e.__assign({ref:ct.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:rt.current[o],sx:e.__assign({width:"100%",display:"flex"},c&&a&&{borderRadius:"6px",outline:"2px solid ".concat(a.badgeBorder),outlineOffset:"1px"})},{children:n.jsx(y.default,{section:t,idx:o,columnKey:"right",colRef:vt("right-accordion-".concat(o)),mb:0,parentNodeId:(null===(r=null==Z?void 0:Z.input_index_map)||void 0===r?void 0:r[1])||"",isExpanded:he?!!Tt["right-".concat(o)]:!!Tt[String(o)],treeData:Z,proposedSections:Un,existingSections:Xn,deviationNumberRegistry:Qn,getBadgeRef:gt,getSectionCompareStyle:Zt,connectedSections:Ge,openMoreFunctionsPopup:jt,openSummaryPopup:hi,deviationNodeIdToView:null==se?void 0:se.id,deviationTargetParentId:Si,onToggle:function(){mi(),Ot(o,"right")},navigation:t.id?Ri[t.id]:null,showOpenNodeRef:bi,resolvedMarkdownStyles:dn,maintainRelativeOrder:he,showDeviationBadges:me,renderSubSections:Ei,isProposingFix:fe,proposingFixNodeId:ge,collisionKey:"".concat(Ce?"1":"0","-").concat(String(null!=Le?Le:""))})})),he&&v&&n.jsx(i.Box,e.__assign({ref:ut.current[o],"data-section-id":l.id,sx:{position:"absolute",top:"18px",left:0,transform:"translateY(-50%) translateX(calc(-100% - 8px))",display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:"11px",bgcolor:v.badgeBg,color:v.badgeText,border:"1px solid ".concat(v.badgeBorder),borderRadius:"10px",px:1,py:.3,fontWeight:700,whiteSpace:"nowrap",zIndex:20}},{children:u.length>0?u.join(", "):"-"}))]}))}),"right-row-".concat(o))}),n.jsx("div",{ref:hn,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"),u=require("./CognitiveComparehelpers.js"),c=require("./CognitiveCompareConfig.js"),a=require("./CognitiveCompareConstants.js"),s=require("./CognitivePopup.js"),d=require("./MoreFunctionsPopup.js"),v=require("./LoaderComponent.js"),f=require("./components/ThreeDotsLoader.js"),g=require("./hooks/useCompareData.js"),p=require("./hooks/useComparePopups.js"),h=require("./hooks/useSectionRefs.js"),x=require("./hooks/useAccordionState.js"),m=require("./hooks/useDeviationNavigation.js"),_=require("./components/CompareHeader.js"),R=require("./components/SectionAccordion.js"),y=require("./components/SubSectionAccordion.js"),b=require("./components/CognitiveSummaryPopup.js"),S=require("./components/connectedLines.js");exports.SHARED_MARKDOWN_STYLES=c.SHARED_MARKDOWN_STYLES,exports.default=function(A){var E,I,T,B,C,D,O,w,N,j,P,F,k,M,L,V,H,q,G,z,W,K,Y,U,X,$,J=A.componentHeaderText,Q=void 0===J?a.DEFAULT_COMPONENT_HEADER_TEXT:J,Z=A.treeData,ee=A.comparisonConfig,ne=A.leftColumnTitleText,te=A.rightColumnTitleText,ie=A.markdownStyles,oe=A.resetTrigger,le=A.displayConfig,re=void 0===le?{isHeaderVisible:!0,isToggleVisible:!0,maintainRelativeOrder:!1,isLoading:!0,showDeviationBadges:!1,enableDeviationSchemaBackwardCompatibility:!1}:le,ue=A.popupConfig,ce=A.deviationData,ae=void 0===ce?{}:ce,se=A.deviationNodeIdToView,de=A.resetDeviationNodeId,ve=A.isProposingFix,fe=void 0!==ve&&ve,ge=A.proposingFixNodeId,pe=t.useState(re.maintainRelativeOrder),he=pe[0],xe=pe[1],me=!!he||!!(null==re?void 0:re.showDeviationBadges),_e=t.useState(!1),Re=_e[0],ye=_e[1],be=t.useState(!1),Se=be[0],Ae=be[1],Ee=t.useState(null),Ie=Ee[0],Te=Ee[1],Be=t.useState(!1),Ce=Be[0],De=Be[1],Oe=t.useState(null===(I=null!==(E=null==Z?void 0:Z.newEvaluationResult)&&void 0!==E?E:null==re?void 0:re.enableDeviationSchemaBackwardCompatibility)||void 0===I||I)[0],we=t.useState(!1),Ne=we[0],je=we[1],Pe=t.useState(!1),Fe=Pe[0],ke=Pe[1],Me=t.useState(null),Le=Me[0],Ve=Me[1],He=t.useRef(!1),qe=t.useState(new Set),Ge=qe[0],ze=qe[1],We=t.useState([]),Ke=We[0],Ye=We[1],Ue=t.useRef(null),Xe=t.useRef(null),$e=t.useRef(null),Je=t.useRef(new Set),Qe=t.useRef(!1),Ze=t.useRef(null),en=t.useRef({}),nn=t.useRef([]),tn=t.useRef(!1),on=t.useRef(!1),ln=t.useRef(null),rn=t.useRef(function(){}),un=t.useMemo(function(){return(null==Z?void 0:Z.cognitive_decisioning)||{}},[Z]),cn=t.useState({width:0,height:0}),an=cn[0],sn=cn[1],dn=t.useMemo(function(){return e.__assign(e.__assign({},c.SHARED_MARKDOWN_STYLES),ie)},[ie]),vn=t.useRef(null),fn=t.useRef(null),gn=t.useRef(null),pn=t.useRef(null),hn=t.useRef(null),xn=t.useRef(null),mn=t.useRef(null),_n=t.useRef(null),Rn=t.useRef(!1),yn=t.useRef(null),bn=t.useRef(null),Sn=p.useComparePopups(vn),An=Sn.cognitivePopup,En=Sn.setCognitivePopup,In=Sn.moreFunctions,Tn=Sn.setMoreFunctions,Bn=Sn.position,Cn=Sn.setPosition,Dn=Sn.activeBadgeId,On=Sn.summaryPopup,wn=Sn.setSummaryPopup,Nn=Sn.closeSummaryPopup,jn=Sn.setActiveBadgeId,Pn=Sn.popupRef,Fn=Sn.closeCognitivePopup,kn=Sn.closeMoreFunctionsPopup,Mn=t.useMemo(function(){var e,n,t,i,o,l,r;return{fields:null!==(e=null==ee?void 0:ee.fields)&&void 0!==e?e:c.DEFAULT_FIELD_CONFIG,thresholds:{high:null!==(t=null===(n=null==ee?void 0:ee.thresholds)||void 0===n?void 0:n.high)&&void 0!==t?t:c.DEFAULT_COMPARISON_CONFIG.thresholds.high,medium:null!==(o=null===(i=null==ee?void 0:ee.thresholds)||void 0===i?void 0:i.medium)&&void 0!==o?o:c.DEFAULT_COMPARISON_CONFIG.thresholds.medium,exact:null!==(r=null===(l=null==ee?void 0:ee.thresholds)||void 0===l?void 0:l.exact)&&void 0!==r?r:c.DEFAULT_COMPARISON_CONFIG.thresholds.exact}}},[ee]),Ln=t.useState(null),Vn=Ln[0];Ln[1];var Hn=null===(C=null===(T=null==Z?void 0:Z.documents)||void 0===T?void 0:T[null===(B=null==Z?void 0:Z.input_index_map)||void 0===B?void 0:B[0]])||void 0===C?void 0:C.title,qn=null===(w=null===(D=null==Z?void 0:Z.documents)||void 0===D?void 0:D[null===(O=null==Z?void 0:Z.input_index_map)||void 0===O?void 0:O[1]])||void 0===w?void 0:w.title,Gn=u.safeStringify(ne||Hn||"Uploaded Contract"),zn=u.safeStringify(te||qn||"Reference Template"),Wn=g.useCognitiveTreeData(Z,he,ae,Mn,Oe),Kn=Wn.activeProposed,Yn=Wn.existingRule,Un=Wn.proposedSections,Xn=Wn.existingSections,$n=Wn.visibleFields,Jn=Wn.parentDeviationRecord,Qn=Wn.deviationNumberRegistry,Zn=Wn.parseError;t.useEffect(function(){Zn&&Te("Failed to load comparison: ".concat(Zn))},[Zn]);var et=Un.length>0||Xn.length>0,nt=t.useMemo(function(){var e=new Map,n=new Map,t=1;if(he)Un.forEach(function(n){!n.title&&!n.content||n.id&&e.set(n.id,t++)}),Xn.forEach(function(i){if(i.id){var o=Un.filter(function(e){var n;return null===(n=e.refIndexes)||void 0===n?void 0:n.includes(i.selfIndex)});if(o.length>0){var l=o.map(function(n){return e.get(n.id)}).filter(Boolean);n.set(i.id,l.join(", "))}else n.set(i.id,String(t++))}});else for(var i=Math.max(Un.length,Xn.length),o=0;o<i;o++){var l=Un[o],r=Xn[o];l?(e.set(l.id,t),r&&n.set(r.id,String(t)),t++):r&&n.set(r.id,String(t++))}return{leftNums:e,rightNums:n}},[Un,Xn,he]),tt=h.useSectionRefs($n.map(function(e){return e.key}),Math.max(Un.length,Xn.length)),it=tt.leftRefs,ot=tt.rightRefs,lt=tt.sectionLeftRefs,rt=tt.sectionRightRefs,ut=tt.lhsBadgeRefs,ct=tt.rhsBadgeRefs,at=tt.sectionRightRowRefs,st=tt.subSectionLeftRefs,dt=tt.subSectionRightRefs,vt=tt.sectionRowRefs,ft=tt.getSectionRowRef,gt=tt.getSubSectionRef,pt=tt.getBadgeRef,ht=Yn.analysis,xt=u.safeStringify(null===(j=null===(N=null==ht?void 0:ht.rule_difference_comparison)||void 0===N?void 0:N.summary)||void 0===j?void 0:j.overall_summary),mt=!!xt.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),_t=null!==(P=null==Z?void 0:Z.base_root_id)&&void 0!==P?P:"-1";null==Z||Z[_t];var Rt=Oe?null!==(Y=null!==(z=ae&&(null===(G=null==ae?void 0:ae[_t])||void 0===G?void 0:G.evaluation_result))&&void 0!==z?z:null===(K=null===(W=null==Z?void 0:Z.nodes)||void 0===W?void 0:W[_t])||void 0===K?void 0:K.evaluation_result)&&void 0!==Y?Y:null:null!==(q=null!==(M=ae&&(null===(k=null===(F=null==ae?void 0:ae[_t])||void 0===F?void 0:F.evaluation_result)||void 0===k?void 0:k[0]))&&void 0!==M?M:null===(H=null===(V=null===(L=null==Z?void 0:Z.nodes)||void 0===L?void 0:L[_t])||void 0===V?void 0:V.evaluation_result)||void 0===H?void 0:H[0])&&void 0!==q?q:null,yt=u.extractDeviationScore(Rt),bt=u.generateColorPalette(null!==($=null===(X=null===(U=null==Rt?void 0:Rt.evaluation_outputs)||void 0===U?void 0:U.metadata)||void 0===X?void 0:X.label_color)&&void 0!==$?$:""),St=function(){Je.current.forEach(function(e){u.resetClauseHighlight(e)}),Je.current.clear()},At=t.useCallback(function(){var e,n,t,i,o,l;St(),De(!1),on.current=!1,Xe.current=null;var r=ln.current,c=Gt.current;if(null!==r)if("string"==typeof r&&r.includes(u.DEVIATION_BADGE_SEPARATOR)){var a=r.split(u.DEVIATION_BADGE_SEPARATOR);(s=(null===(e=st.current[a[2]])||void 0===e?void 0:e.current)||(null===(n=lt.current[Number(a[2])])||void 0===n?void 0:n.current))&&(s.style.paddingTop="0px")}else{var s;(s=null===(t=lt.current[r])||void 0===t?void 0:t.current)&&(s.style.paddingTop="0px")}if(null!==c)if("string"==typeof c&&c.includes(u.DEVIATION_BADGE_SEPARATOR)){a=c.split(u.DEVIATION_BADGE_SEPARATOR);(d=(null===(i=dt.current[a[3]])||void 0===i?void 0:i.current)||(null===(o=rt.current[Number(a[3])])||void 0===o?void 0:o.current))&&(d.style.paddingTop="0px")}else{var d;(d=null===(l=rt.current[c])||void 0===l?void 0:l.current)&&(d.style.paddingTop="0px")}Ve(null),ln.current=null,Gt.current=null,je(!1),Ae(!1),pn.current&&(pn.current.style.height="0px"),hn.current&&(hn.current.style.height="0px"),xn.current&&(xn.current.style.height="0px"),mn.current&&(mn.current.style.height="0px")},[]),Et=t.useCallback(function(){St(),At(),ze(new Set),Ye([]),nn.current=[],Xt([]),Qt(null),wn(a.EMPTY_SUMMARY_POPUP_STATE),Fn(),requestAnimationFrame(function(){var e;null===(e=rn.current)||void 0===e||e.call(rn)})},[]),It=t.useRef(Et);t.useEffect(function(){It.current=Et},[Et]),t.useEffect(function(){oe&&It.current()},[oe]);var Tt=x.useAccordionState({maintainRelativeOrder:!!he,proposedSections:Un,existingSections:Xn,activeSideBySideSection:Le,connectedSections:Ge,resetSideBySide:At,setConnectedSections:ze,setConnectedLines:Ye,cachedConnectedPositions:nn,svgContainerRef:Ue,isAnimatingRef:Qe,animationTimerRef:Ze,calculateLinesRef:rn,sectionLeftRefs:lt,sectionRightRefs:rt,subSectionLeftRefs:st,subSectionRightRefs:dt}),Bt=Tt.expandedSections,Ct=Tt.setExpandedSections,Dt=Tt.expandedSubSections,Ot=Tt.setExpandedSubSections,wt=Tt.toggleSection,Nt=t.useCallback(function(n,t,i,o,l,r,c){var a,s,d,v=u.safeStringify(null==t?void 0:t.id)||u.safeStringify(null==i?void 0:i.id)||"",f=(v?un[v]:null)||(null==t?void 0:t.cognitiveData)||(null==i?void 0:i.cognitiveData)||{section_id:v,decisioning:[],gap:[],relevance_score:0},g=null!==(s=null===(a=vt.current[o])||void 0===a?void 0:a.current)&&void 0!==s?s:null;return{isLoading:null!==(d=null==re?void 0:re.isLoading)&&void 0!==d&&d,open:!0,sectionTitle:(null==t?void 0:t.displayTitle)?null==t?void 0:t.title:"No Counterpart",refSectionTitle:(null==i?void 0:i.displayTitle)?null==i?void 0:i.title:"No Counterpart",cognitiveData:f,anchorEl:n,sectionAnchorEl:g,badgeStyle:r||null,sectionIdx:o,docData:{documents:null==Z?void 0:Z.documents,input_index_map:null==Z?void 0:Z.input_index_map},deviationData:function(){var n,l,r=(null==t?void 0:t.evaluationResult)||(null==i?void 0:i.evaluationResult)||null,c=function(n){var t=function(e){if(!e||"object"!=typeof e)return null;var n=null==e?void 0:e.deviation_entries;if(n&&"object"==typeof n){var t=Object.keys(n).sort(function(e,n){return Number(e)-Number(n)})[0];if(t&&n[t])return n[t]}var i=Object.keys(e).filter(function(e){return/^\d+$/.test(e)}).sort(function(e,n){return Number(e)-Number(n)});if(i.length&&e[i[0]])return e[i[0]];var o=null==e?void 0:e.deviations;if(o&&"object"==typeof o){var l=Object.keys(o).sort(function(e,n){return Number(e)-Number(n)})[0];if(l&&o[l])return o[l]}return null}(n);return t?e.__assign(e.__assign({},n),{deviation_summary:(null==n?void 0:n.deviation_summary)||(null==t?void 0:t.deviation_summary),deviation_title:(null==n?void 0:n.deviation_title)||(null==t?void 0:t.deviation_title),deviation_impact:(null==n?void 0:n.deviation_impact)||(null==t?void 0:t.deviation_impact),deviation_explanation:(null==n?void 0:n.deviation_explanation)||(null==t?void 0:t.deviation_explanation),evaluation_outputs:(null==n?void 0:n.evaluation_outputs)||(null==t?void 0:t.evaluation_outputs),cognitive_decisioning:(null==n?void 0:n.cognitive_decisioning)||(null==t?void 0:t.cognitive_decisioning)}):n};if(!("string"==typeof o&&o.includes(u.DEVIATION_BADGE_SEPARATOR)))return c(r);var a=o.split(u.DEVIATION_BADGE_SEPARATOR)[1];if(!a)return r;var s=(null==t?void 0:t.evaluationResult)||(null==i?void 0:i.evaluationResult)||{},d=(null===(n=null==s?void 0:s.deviation_entries)||void 0===n?void 0:n[a])||(null===(l=null==s?void 0:s.deviations)||void 0===l?void 0:l[a])||null;return d?e.__assign(e.__assign(e.__assign({},s),d),{deviation_summary:(null==d?void 0:d.deviation_summary)||(null==s?void 0:s.deviation_summary),deviation_title:(null==d?void 0:d.deviation_title)||(null==s?void 0:s.deviation_title),deviation_impact:(null==d?void 0:d.deviation_impact)||(null==s?void 0:s.deviation_impact),deviation_explanation:(null==d?void 0:d.deviation_explanation)||(null==s?void 0:s.deviation_explanation),evaluation_outputs:(null==d?void 0:d.evaluation_outputs)||(null==s?void 0:s.evaluation_outputs),cognitive_decisioning:(null==d?void 0:d.cognitive_decisioning)||(null==s?void 0:s.cognitive_decisioning)}):c(r)}(),isOrphan:!!l}},[un,Z]),jt=t.useCallback(function(e){kn(),Cn(null),En(e)},[kn]),Pt=function(e,n,t,i,o,l){var r;if(e.stopPropagation(),In.open&&In.sectionIdx===o)kn();else{var c=e.currentTarget,a="left";(null===(r=gn.current)||void 0===r?void 0:r.contains(c))&&(a="right");St(),on.current&&At(),ze(new Set),Ye([]),nn.current=[],Fn(),On.open?_i():Nn(),requestAnimationFrame(function(){var e=function(){var e,n,t,i;if("string"==typeof o&&o.includes(u.DEVIATION_BADGE_SEPARATOR)){var l=o.split(u.DEVIATION_BADGE_SEPARATOR),r="".concat(l[0]).concat(u.DEVIATION_BADGE_SEPARATOR).concat(l[1]);return"right"===a?null===(e=ct.current[r])||void 0===e?void 0:e.current:null===(n=ut.current[r])||void 0===n?void 0:n.current}return"right"===a?null===(t=ct.current[o])||void 0===t?void 0:t.current:null===(i=ut.current[o])||void 0===i?void 0:i.current}()||c;Tn(Nt(e,n,i,o,t,l))})}},Ft=t.useCallback(function(){null!==In.sectionIdx&&In.anchorEl?jt(e.__assign(e.__assign({},In),{open:!0})):kn()},[In,kn,jt]),kt=t.useCallback(function(){var e=In.sectionIdx,n=In.isOrphan;kn(),Nn(),null!==e&&(n?Te("No counterpart exists to connect to."):(St(),on.current&&At(),Ye([]),nn.current=[],ze(function(n){return n.has(e)?new Set:new Set([e])}),setTimeout(function(){rn.current&&rn.current()},50)))},[In.sectionIdx,In.isOrphan,kn,Nn,At]),Mt=t.useCallback(function(){var e=$e.current;if(e){$e.current=null;var n=Un.findIndex(function(n){return n.id===e}),t=Xn.findIndex(function(n){return n.id===e}),i=-1===n?u.findKeyPathByNodeId(Un,e):null,o=-1===t?u.findKeyPathByNodeId(Xn,e):null,l=-1!==n?n:i?Number(i.split("-")[0]):-1,r=-1!==t?t:o?Number(o.split("-")[0]):-1,c=function(e,n,t,i){var o,l,r,u;return-1!==e?null!==(l=null===(o=t.current[e])||void 0===o?void 0:o.current)&&void 0!==l?l:null:n&&null!==(u=null===(r=i.current[n])||void 0===r?void 0:r.current)&&void 0!==u?u:null},a=function(e,n,t){void 0===t&&(t=30);var i=0,o=function(){var l=e();l&&0!==l.getBoundingClientRect().height?(Je.current.add(l),u.scrollAndHighlightClause(l,n)):i++<t&&requestAnimationFrame(o)};requestAnimationFrame(o)};if(he)-1!==l&&_n.current&&a(function(){return c(n,i,lt,st)},_n.current),-1!==r&&gn.current&&a(function(){return c(t,o,rt,dt)},gn.current);else{var s=vn.current;if(!s)return;a(function(){return-1!==l?c(n,i,lt,st):c(t,o,rt,dt)},s)}}},[Un,Xn,he,lt,rt,st,dt,_n,gn,vn]),Lt=t.useCallback(function(n){if(n){St(),At(),ze(new Set),Ye([]),nn.current=[],Nn(),Fn();var t=Un.findIndex(function(e){return e.id===n}),i=Xn.findIndex(function(e){return e.id===n}),o=-1===t?u.findKeyPathByNodeId(Un,n):null,l=-1===i?u.findKeyPathByNodeId(Xn,n):null;if(-1!==t||o||-1!==i||l){var r=-1!==t?t:o?Number(o.split("-")[0]):-1,c=-1!==i?i:l?Number(l.split("-")[0]):-1;$e.current=n,Ct(function(n){var t,i=e.__assign({},n),o=!1;-1!==r&&(i[t=he?"left-".concat(r):String(r)]||(i[t]=!0,o=!0));-1!==c&&(i[t=he?"right-".concat(c):String(c)]||(i[t]=!0,o=!0));return o?i:n}),Ot(function(n){var t=e.__assign({},n),i=!1,r=function(e){for(var n=e.split("-"),o=n[0],l=1;l<n.length;l++)o+="-".concat(n[l]),t[o]||(t[o]=!0,i=!0)};return o&&r(o),l&&r(l),i?t:n}),setTimeout(function(){requestAnimationFrame(function(){$e.current===n&&Vt.current()})},50)}else console.warn('scrollToAndHighlightClause: nodeId "'.concat(n,'" not found'))}},[Un,Xn,he,Ct,Ot,At,Nn,Fn]),Vt=t.useRef(Mt);t.useEffect(function(){Vt.current=Mt},[Mt]);var Ht=t.useRef(null),qt=t.useRef(null),Gt=t.useRef(null),zt=t.useRef(null),Wt=t.useRef(null),Kt=t.useRef(null),Yt=t.useState([]),Ut=Yt[0],Xt=Yt[1];t.useRef(null);var $t=t.useState(null),Jt=$t[0],Qt=$t[1];t.useEffect(function(){if(Vn){var e=Mn.fields.find(function(e){return e.analysisKey===Vn||e.key===Vn});if(e){var n=it.current[e.key]||ot.current[e.key];(null==n?void 0:n.current)&&setTimeout(function(){return n.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[Vn,Mn.fields]);var Zt=t.useCallback(function(e){var n,t,i,o,l,r,u,c,a,s=null===(n=null==ht?void 0:ht.rule_difference_comparison)||void 0===n?void 0:n.fields;if(!s||!s[e])return{score:0,relation:"",highlightsA:[],highlightsB:[],hasContent:!1};var d=s[e],v=(null==d?void 0:d.relation)||(null===(i=null===(t=null==d?void 0:d.highlights)||void 0===t?void 0:t.ruleA_spans)||void 0===i?void 0:i.length)||(null===(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 f=d.mappings[0]||{};return{score:d.score,relation:f.relation||"",highlightsA:(null===(r=f.highlights)||void 0===r?void 0:r.ruleA_spans)||[],highlightsB:(null===(u=f.highlights)||void 0===u?void 0:u.ruleB_spans)||[],hasContent:!!v}}return{score:d.score,relation:d.relation||"",highlightsA:(null===(c=d.highlights)||void 0===c?void 0:c.ruleA_spans)||[],highlightsB:(null===(a=d.highlights)||void 0===a?void 0:a.ruleB_spans)||[],hasContent:!!v}},[ht]),ei=t.useCallback(function(n,t){var i,o,l;void 0===t&&(t="left");var r=null,c=null;if("left"===t)if(r=Un[n],he&&r){var s=Xn.filter(function(e){var n;return null===(n=r.refIndexes)||void 0===n?void 0:n.includes(e.selfIndex)});c=s.find(function(e){return e.evaluationResult})||s[0]}else c=Xn[n];else if(c=Xn[n],he&&c){var d=Un.filter(function(e){var n;return null===(n=e.refIndexes)||void 0===n?void 0:n.includes(c.selfIndex)});r=d.find(function(e){return e.evaluationResult})||d[0]}else r=Un[n];var v=(null==r?void 0:r.relation)&&"not_defined"!==r.relation,f=(null==c?void 0:c.relation)&&"not_defined"!==c.relation,g=!(!(null==r?void 0:r.cognitiveData)&&!(null==c?void 0:c.cognitiveData));if(!v&&!f&&!g)return e.__assign(e.__assign({},u.generateColorPalette(a.DEFAULT_DEVIAION_COLOR)),{label:"Not Defined"});var p=null!==(o=null!==(i=null==r?void 0:r.evaluationResult)&&void 0!==i?i:null==c?void 0:c.evaluationResult)&&void 0!==o?o:null,h=u.getFirstDeviationOutputValue(p),x=u.getFirstDeviationColor(p);return null!=p?e.__assign(e.__assign({},u.generateColorPalette(x)),{label:null!==(l=h)&&void 0!==l?l:""}):e.__assign(e.__assign({},u.generateColorPalette(x)),{label:null})},[Un,Xn,un,Mn,he]),ni=t.useCallback(function(n){for(var t,i,o,l,r,c=n.split("-").map(Number),s=Un[c[0]],d=Xn[c[0]],v=1;v<c.length;v++)(null==s?void 0:s.subsections)&&(s=s.subsections[c[v]]),(null==d?void 0:d.subsections)&&(d=d.subsections[c[v]]);if(!s&&!d)return null;var f=(null==s?void 0:s.relation)&&"not_defined"!==s.relation,g=(null==d?void 0:d.relation)&&"not_defined"!==d.relation,p=u.safeStringify(null==s?void 0:s.id)||u.safeStringify(null==d?void 0:d.id)||"",h=!(!(null==s?void 0:s.cognitiveData)&&!(null==d?void 0:d.cognitiveData));if(!f&&!g&&!h)return e.__assign(e.__assign({},u.generateColorPalette(a.DEFAULT_DEVIAION_COLOR)),{label:"Not Defined"});null!==(i=null!==(t=null==s?void 0:s.cognitiveRelevanceScore)&&void 0!==t?t:null==d?void 0:d.cognitiveRelevanceScore)&&void 0!==i||p&&(null===(o=un[p])||void 0===o||o.relevance_score);var x=null!==(r=null!==(l=null==s?void 0:s.evaluationResult)&&void 0!==l?l:null==d?void 0:d.evaluationResult)&&void 0!==r?r:null,m=u.getFirstDeviationOutputValue(x),_=u.getFirstDeviationColor(x);return null!=x?e.__assign(e.__assign({},u.generateColorPalette(_)),{label:null!=m?m:""}):e.__assign(e.__assign({},u.generateColorPalette(_)),{label:null})},[Un,Xn,un,Mn]),ti=t.useCallback(function(n,t){var i,o,l,r,c,s,d,v,f,g,p,h,x,m,_,R,y;if(!n||null==t)return null;var b=null!==(d=null!==(c=null!==(o=null===(i=null==ae?void 0:ae[n])||void 0===i?void 0:i.evaluation_result)&&void 0!==o?o:null===(r=null===(l=null==Z?void 0:Z.nodes)||void 0===l?void 0:l[n])||void 0===r?void 0:r.evaluation_result)&&void 0!==c?c:null===(s=null==Z?void 0:Z[n])||void 0===s?void 0:s.evaluation_result)&&void 0!==d?d:null;if(!b||"object"!=typeof b)return null;var S=null!==(p=null!==(f=null===(v=null==b?void 0:b.deviations)||void 0===v?void 0:v[t])&&void 0!==f?f:null===(g=null==b?void 0:b.deviation_entries)||void 0===g?void 0:g[t])&&void 0!==p?p:null==b?void 0:b[t],A=null!==(y=null!==(m=null===(x=null===(h=null==S?void 0:S.evaluation_outputs)||void 0===h?void 0:h.metadata)||void 0===x?void 0:x.label_color)&&void 0!==m?m:null===(R=null===(_=null==b?void 0:b.evaluation_outputs)||void 0===_?void 0:_.metadata)||void 0===R?void 0:R.label_color)&&void 0!==y?y:a.DEFAULT_DEVIAION_COLOR;return e.__assign(e.__assign({},u.generateColorPalette(A)),{label:null})},[ae,Z]),ii=t.useCallback(function(){St(),Ct({}),Ot({}),At(),ze(new Set),Ye([]),nn.current=[],Nn(),Fn(),kn(),requestAnimationFrame(function(){rn.current&&rn.current()})},[Ct,Ot,At,Nn,Fn,kn]),oi=t.useMemo(function(){return Object.values(Bt).some(Boolean)||Object.values(Dt).some(Boolean)},[Bt,Dt]),li=t.useCallback(function(){var e,n,t,i,o,l,r,c,a,s,d,v,f,g,p,h,x,m,_,R,y,b,S;if(!Rn.current&&!Qe.current){Rn.current=!0;try{if(!Ht.current)return;var A=function(e){var n=e.split("-"),t=n[0];if(!Bt[t]&&!1===he)return!1;if(he&&!Bt["left-".concat(t)]&&!Bt["right-".concat(t)]&&!Bt[t])return!1;for(var i=t,o=1;o<n.length-1;o++)if(i+="-".concat(n[o]),!Dt[i])return!1;return!0},E=Ht.current.getBoundingClientRect();sn({width:E.width,height:E.height});var I=[];if($n.forEach(function(e){var n,t,i=e.key,o=null===(n=it.current[i])||void 0===n?void 0:n.current,l=null===(t=ot.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")}),!Qe.current){for(var T=0;T<Math.max(Un.length,Xn.length);T++){var B=null===(e=lt.current[T])||void 0===e?void 0:e.current,C=null===(n=rt.current[T])||void 0===n?void 0:n.current;B&&(B.style.height="auto",B.style.minHeight="0px"),C&&(C.style.height="auto",C.style.minHeight="0px")}he||Object.keys(st.current).forEach(function(e){var n,t;if(A(e)){var i=null===(n=st.current[e])||void 0===n?void 0:n.current,o=null===(t=dt.current[e])||void 0===t?void 0:t.current;i&&o&&(i.style.height="auto",o.style.height="auto",i.style.minHeight="0px",o.style.minHeight="0px")}})}var D={};$n.forEach(function(e){var n,t,i=e.key,o=null===(n=it.current[i])||void 0===n?void 0:n.current,l=null===(t=ot.current[i])||void 0===t?void 0:t.current;if(o&&l){var r=o.getBoundingClientRect(),u=l.getBoundingClientRect();D[i]=Math.max(r.height,u.height)}});var O={left:{},right:{}},w={};if(!Qe.current)if(he){if(Ce&&null!==Le)if("number"==typeof Le){var N=Le,j=Un[N],P=null===(o=lt.current[N])||void 0===o?void 0:o.current;P&&j&&(j.refIndexes||[]).forEach(function(e){var n,t=Xn.findIndex(function(n){return n.selfIndex===e}),i=null===(n=rt.current[t])||void 0===n?void 0:n.current;if(i&&(Bt["left-".concat(N)]||Bt["right-".concat(t)])){var o=Math.max(P.getBoundingClientRect().height,i.getBoundingClientRect().height);O.left[N]=Math.max(O.left[N]||0,o),O.right[t]=Math.max(O.right[t]||0,o)}})}else{var F=Le.split(u.DEVIATION_BADGE_SEPARATOR)[2];if(F){B=null===(l=st.current[F])||void 0===l?void 0:l.current,C=null===(r=dt.current[F])||void 0===r?void 0:r.current;if(B&&C){k=Math.max(B.getBoundingClientRect().height,C.getBoundingClientRect().height);w[F]=Math.max(w[F]||0,k)}}}}else{Object.keys(st.current).forEach(function(e){var n,t;if(A(e)){var i=null===(n=st.current[e])||void 0===n?void 0:n.current,o=null===(t=dt.current[e])||void 0===t?void 0:t.current;if(i&&o&&null!==i.offsetParent&&null!==o.offsetParent){var l=i.getBoundingClientRect(),r=o.getBoundingClientRect(),u=Math.max(l.height,r.height);w[e]=u,i.style.minHeight="".concat(u,"px"),o.style.minHeight="".concat(u,"px")}}});for(T=0;T<Math.min(Un.length,Xn.length);T++){var B=null===(t=lt.current[T])||void 0===t?void 0:t.current,C=null===(i=rt.current[T])||void 0===i?void 0:i.current;if(B&&C){var k=Math.max(B.getBoundingClientRect().height,C.getBoundingClientRect().height);O.left[T]=k,O.right[T]=k}}}if($n.forEach(function(e){var n,t,i=e.key,o=null===(n=it.current[i])||void 0===n?void 0:n.current,l=null===(t=ot.current[i])||void 0===t?void 0:t.current;if(o&&l){var r=D[i];o.style.minHeight="".concat(r,"px"),l.style.minHeight="".concat(r,"px")}}),Qe.current||(Object.entries(O.left).forEach(function(e){var n,t=e[0],i=e[1],o=null===(n=lt.current[Number(t)])||void 0===n?void 0:n.current;o&&(o.style.minHeight="".concat(i,"px"))}),Object.entries(O.right).forEach(function(e){var n,t=e[0],i=e[1],o=null===(n=rt.current[Number(t)])||void 0===n?void 0:n.current;o&&(o.style.minHeight="".concat(i,"px"))}),he||Object.keys(w).forEach(function(e){var n,t,i=null===(n=st.current[e])||void 0===n?void 0:n.current,o=null===(t=dt.current[e])||void 0===t?void 0:t.current;if(i&&o&&w[e]){var l=w[e];i.style.minHeight="".concat(l,"px"),o.style.minHeight="".concat(l,"px")}})),he)Un.forEach(function(e,n){var t;(null===(t=lt.current[n])||void 0===t?void 0:t.current)&&(e.refIndexes||[]).forEach(function(e){var t,i,o,l,r,u,c,a,s,d,v=Xn.findIndex(function(n){return n.selfIndex===e});if(-1!==v){var f=null===(t=ut.current[n])||void 0===t?void 0:t.current,g=null===(i=ct.current[v])||void 0===i?void 0:i.current;if(f&&g){var p=f.getBoundingClientRect(),h=g.getBoundingClientRect(),x=p.right-E.left,m=h.left-E.left,_=p.top+p.height/2-E.top,R=h.top+h.height/2-E.top;if(Ce&&Le===n){var y=null!==(l=null===(o=_n.current)||void 0===o?void 0:o.getBoundingClientRect().top)&&void 0!==l?l:0,b=null!==(u=null===(r=gn.current)||void 0===r?void 0:r.getBoundingClientRect().top)&&void 0!==u?u:0,S=y+(null!==(a=null===(c=_n.current)||void 0===c?void 0:c.clientHeight)&&void 0!==a?a:1/0),A=b+(null!==(d=null===(s=gn.current)||void 0===s?void 0:s.clientHeight)&&void 0!==d?d:1/0),T=p.top+p.height/2,B=h.top+h.height/2,C=function(e,n,t){return Math.max(n,Math.min(t,e))};_=C(T,y,S)-E.top,R=C(B,b,A)-E.top}var D=ei(n);D&&I.push({id:"line-".concat(n,"-").concat(v),x1:x,y1:_,x2:m,y2:R,style:D,sectionIdx:n,targetRightIdx:v})}}})});else{for(T=0;T<Math.min(Un.length,Xn.length);T++){var M=null===(c=lt.current[T])||void 0===c?void 0:c.current,L=null===(a=rt.current[T])||void 0===a?void 0:a.current;if(M&&L){var V=M.getBoundingClientRect(),H=L.getBoundingClientRect(),q=Math.max(V.top,H.top)+18-E.top,G=(null===(s=Xn[T])||void 0===s?void 0:s.id)||"sec-".concat(T);(J=ei(T))&&I.push({id:G,x1:V.right-E.left,y1:q,x2:H.left-E.left,y2:q,style:J,sectionIdx:T,hasCognitive:!!((null===(d=Un[T])||void 0===d?void 0:d.cognitiveData)||(null===(v=Xn[T])||void 0===v?void 0:v.cognitiveData)||G&&un[G]),isSubSection:!1})}}Object.keys(st.current).forEach(function(e){var n,t,i,o,l,r;if(A(e)){var c=null===(n=st.current[e])||void 0===n?void 0:n.current,a=null===(t=dt.current[e])||void 0===t?void 0:t.current;if(c&&a){for(var s=e.split("-").map(Number),d=Un[s[0]],v=Xn[s[0]],f=1;f<s.length;f++)(null==d?void 0:d.subsections)&&(d=d.subsections[s[f]]),(null==v?void 0:v.subsections)&&(v=v.subsections[s[f]]);var g=!!d&&((null===(i=d.displayTitle)||void 0===i||i)&&u.hasValue(d.title)),p=!!d&&((null===(o=d.displayContent)||void 0===o||o)&&u.hasValue(d.content)),h=!!v&&((null===(l=v.displayTitle)||void 0===l||l)&&u.hasValue(v.title)),x=!!v&&((null===(r=v.displayContent)||void 0===r||r)&&u.hasValue(v.content));if(g&&p||h&&x){var m=c.getBoundingClientRect(),_=a.getBoundingClientRect(),R=Math.max(m.top,_.top)+16-E.top,y=ni(e);y&&"Not Defined"!==y.label&&I.push({id:"subsec-".concat(e),x1:m.right-E.left,y1:R,x2:_.left-E.left,y2:R,style:y,sectionIdx:s[0],isSubSection:!0,subSectionKeyPath:e,hasCognitive:!(!(null==d?void 0:d.cognitiveData)&&!(null==v?void 0:v.cognitiveData))})}}}})}if(Ce&&"string"==typeof Le&&Le.includes(u.DEVIATION_BADGE_SEPARATOR)){var z=Le.split(u.DEVIATION_BADGE_SEPARATOR),W=z[0],K=z[1],Y=z[2],U=(z[3],"".concat(W).concat(u.DEVIATION_BADGE_SEPARATOR).concat(K)),X=null===(f=ut.current[U])||void 0===f?void 0:f.current,$=null===(g=ct.current[U])||void 0===g?void 0:g.current;if(X&&$){var J,Q=X.getBoundingClientRect(),Z=$.getBoundingClientRect(),ee=Q.right-E.left,ne=Z.left-E.left,te=Q.top+Q.height/2-E.top,ie=Z.top+Z.height/2-E.top;if(he){var oe=null!==(h=null===(p=_n.current)||void 0===p?void 0:p.getBoundingClientRect().top)&&void 0!==h?h:0,le=null!==(m=null===(x=gn.current)||void 0===x?void 0:x.getBoundingClientRect().top)&&void 0!==m?m:0,re=oe+(null!==(R=null===(_=_n.current)||void 0===_?void 0:_.clientHeight)&&void 0!==R?R:1/0),ue=le+(null!==(b=null===(y=gn.current)||void 0===y?void 0:y.clientHeight)&&void 0!==b?b:1/0),ce=function(e,n,t){return Math.max(n,Math.min(t,e))};te=ce(Q.top+Q.height/2,oe,re)-E.top,ie=ce(Z.top+Z.height/2,le,ue)-E.top}(J=null!==(S=ti(W,K))&&void 0!==S?S:ni(Y))&&I.push({id:"line-subsec-".concat(U),x1:ee,y1:te,x2:ne,y2:ie,style:J,sectionIdx:Number(Y.split("-")[0]),isSubSection:!0,subSectionKeyPath:Le})}}if(Xt(I),Wt.current&&Kt.current){var ae=Wt.current.getBoundingClientRect(),se=Kt.current.getBoundingClientRect(),de=(ae.top+ae.height/2-E.top+se.top+se.height/2-E.top)/2;Qt({x1:ae.right-E.left,x2:se.left-E.left,y:de})}else Qt(null);if(Ge.size>0){var ve=[],fe=_n.current,ge=gn.current;if(fe&&ge){var pe=[],xe=fe.getBoundingClientRect().top,me=ge.getBoundingClientRect().top,_e=xe+fe.clientHeight,Re=me+ge.clientHeight,ye=fe.scrollTop,be=ge.scrollTop,Se=E.top,Ae=function(e,n,t){return Math.max(n,Math.min(t,e))};Ge.forEach(function(e){var n,t,i,o,l,r;if("string"==typeof e&&e.includes(u.DEVIATION_BADGE_SEPARATOR)){var c=e.split(u.DEVIATION_BADGE_SEPARATOR),a=c[0],s=c[1],d=c[2],v=(c[3],"".concat(a).concat(u.DEVIATION_BADGE_SEPARATOR).concat(s)),f=null===(n=ut.current[v])||void 0===n?void 0:n.current,g=null===(t=ct.current[v])||void 0===t?void 0:t.current;if(!f||!g)return;var p=f.getBoundingClientRect(),h=g.getBoundingClientRect(),x=null!==(i=ti(a,s))&&void 0!==i?i:ni(d),m=(P=p.right-E.left)+.5*((F=h.left-E.left-0)-P),_=p.top+p.height/2,R=h.top+h.height/2,y=_-xe+ye,b=R-me+be,S="conn-subsec-".concat(v);pe.push({lhsScrollY:y,rhsScrollY:b,x1:P,x2:F,containerTop:Se,leftIdx:e,rhsArrayIdx:e,styleColor:(null==x?void 0:x.badgeBorder)||"#6366F1",styleId:S});var A=Ae(_,xe,_e),I=Ae(R,me,Re),T=A-Se,B=I-Se,C=R>=me-4&&R<=Re+4,D="";D=(k=_>=xe-4&&_<=_e+4)&&C?u.getBentArrowPath(P,T,F,B):k&&!C?"M ".concat(P,",").concat(T," L ").concat(m,",").concat(T," L ").concat(m,",").concat(B):!k&&C?"M ".concat(m,",").concat(T," L ").concat(m,",").concat(B," L ").concat(F,",").concat(B):"M ".concat(m,",").concat(T," L ").concat(m,",").concat(B),ve.push({id:S,pathD:D,style:x,leftIdx:e,rhsArrayIdx:e})}else if(he){var O=e,w=Un[O];if(!(null===(r=null==w?void 0:w.refIndexes)||void 0===r?void 0:r.length))return;w.refIndexes.forEach(function(e){var n,t,i=Xn.findIndex(function(n){return n.selfIndex===e});if(-1!==i){var o=null===(n=ut.current[O])||void 0===n?void 0:n.current,l=null===(t=ct.current[i])||void 0===t?void 0:t.current;if(o&&l){var r=o.getBoundingClientRect(),c=l.getBoundingClientRect(),a=ei(O),s=r.right-E.left,d=c.left-E.left-0,v=s+.5*(d-s),f=r.top+r.height/2,g=c.top+c.height/2,p=f-xe+ye,h=g-me+be,x="conn-".concat(O,"-").concat(i);pe.push({lhsScrollY:p,rhsScrollY:h,x1:s,x2:d,containerTop:Se,leftIdx:O,rhsArrayIdx:i,styleColor:(null==a?void 0:a.badgeBorder)||"#6366F1",styleId:x});var m=Ae(f,xe,_e),_=Ae(g,me,Re),R=m-Se,y=_-Se,b=f>=xe-4&&f<=_e+4,S=g>=me-4&&g<=Re+4,A="";A=b&&S?u.getBentArrowPath(s,R,d,y):b&&!S?"M ".concat(s,",").concat(R," L ").concat(v,",").concat(R," L ").concat(v,",").concat(y):!b&&S?"M ".concat(v,",").concat(R," L ").concat(v,",").concat(y," L ").concat(d,",").concat(y):"M ".concat(v,",").concat(R," L ").concat(v,",").concat(y),ve.push({id:x,pathD:A,style:a,leftIdx:O,rhsArrayIdx:i})}}})}else{var N=e,j=N;f=null===(o=ut.current[N])||void 0===o?void 0:o.current,g=null===(l=ct.current[j])||void 0===l?void 0:l.current;if(!f||!g)return;var P,F;p=f.getBoundingClientRect(),h=g.getBoundingClientRect(),x=ei(N),m=(P=p.right-E.left)+.5*((F=h.left-E.left-0)-P),_=p.top+p.height/2,R=h.top+h.height/2,y=_-xe+ye,b=R-me+be,S="conn-".concat(N,"-").concat(j);pe.push({lhsScrollY:y,rhsScrollY:b,x1:P,x2:F,containerTop:Se,leftIdx:N,rhsArrayIdx:j,styleColor:(null==x?void 0:x.badgeBorder)||"#6366F1",styleId:S});var k;A=Ae(_,xe,_e),I=Ae(R,me,Re),T=A-Se,B=I-Se,C=R>=me-4&&R<=Re+4,D="";D=(k=_>=xe-4&&_<=_e+4)&&C?u.getBentArrowPath(P,T,F,B):k&&!C?"M ".concat(P,",").concat(T," L ").concat(m,",").concat(T," L ").concat(m,",").concat(B):!k&&C?"M ".concat(m,",").concat(T," L ").concat(m,",").concat(B," L ").concat(F,",").concat(B):"M ".concat(m,",").concat(T," L ").concat(m,",").concat(B),ve.push({id:S,pathD:D,style:x,leftIdx:N,rhsArrayIdx:j})}}),nn.current=pe}Ye(ve)}else Ye([]),nn.current=[]}catch(e){console.error("Line render safe fail: ",e)}finally{Rn.current=!1}}},[$n,Un,Xn,un,Mn,Zt,ei,ti,he,Ce,Le,Ge,Bt,Dt]),ri=t.useCallback(function(){var e,n,t,i,o,l,r,c,a,s,d,v,f,g,p=nn.current;if(p.length&&!Qe.current){var h=null!==(n=null===(e=_n.current)||void 0===e?void 0:e.scrollTop)&&void 0!==n?n:0,x=null!==(i=null===(t=gn.current)||void 0===t?void 0:t.scrollTop)&&void 0!==i?i:0,m=null!==(l=null===(o=_n.current)||void 0===o?void 0:o.clientHeight)&&void 0!==l?l:1/0,_=null!==(c=null===(r=gn.current)||void 0===r?void 0:r.clientHeight)&&void 0!==c?c:1/0,R=null!==(s=null===(a=_n.current)||void 0===a?void 0:a.getBoundingClientRect().top)&&void 0!==s?s:0,y=null!==(v=null===(d=gn.current)||void 0===d?void 0:d.getBoundingClientRect().top)&&void 0!==v?v:0,b=R+m,S=y+_,A=null!==(g=null===(f=Ht.current)||void 0===f?void 0:f.getBoundingClientRect().top)&&void 0!==g?g:0,E=function(e,n,t){return Math.max(n,Math.min(t,e))};p.forEach(function(e){var n=e.lhsScrollY-h+R,t=e.rhsScrollY-x+y,i=en.current[e.styleId+"-stroke"],o=en.current[e.styleId+"-bg"];if(i||o){var l,r=E(n,R,b),c=E(t,y,S),a=r-A,s=c-A,d=n>=R-4&&n<=b+4,v=t>=y-4&&t<=S+4,f=e.x1+.5*(e.x2-e.x1);l=d&&v?u.getBentArrowPath(e.x1,a,e.x2,s):d&&!v?"M ".concat(e.x1,",").concat(a," L ").concat(f,",").concat(a," L ").concat(f,",").concat(s):!d&&v?"M ".concat(f,",").concat(a," L ").concat(f,",").concat(s," L ").concat(e.x2,",").concat(s):"M ".concat(f,",").concat(a," L ").concat(f,",").concat(s),i&&(i.setAttribute("visibility","visible"),i.setAttribute("d",l)),o&&(o.setAttribute("visibility","visible"),o.setAttribute("d",l))}})}},[]);t.useEffect(function(){rn.current=li},[li]);var ui=t.useRef(null),ci=t.useRef(null),ai=t.useCallback(function(){nn.current.length>0&&!Qe.current||(null!==ui.current&&clearTimeout(ui.current),ui.current=setTimeout(function(){rn.current(),ui.current=null},50))},[]),si=t.useCallback(function(){ke(!0),je(!1),Xe.current=null,null!==ci.current&&clearTimeout(ci.current),null!==ui.current&&(clearTimeout(ui.current),ui.current=null),ci.current=setTimeout(function(){var e,n,t,i,o,l,r,c,a,s,d;try{if(nn.current=[],on.current&&null!==ln.current&&null!==Gt.current){var v=ln.current,f=Gt.current,g="string"==typeof v&&v.includes(u.DEVIATION_BADGE_SEPARATOR),p=null,h=null,x=null,m=null;if(g){var _=v.split(u.DEVIATION_BADGE_SEPARATOR),R="".concat(_[0]).concat(u.DEVIATION_BADGE_SEPARATOR).concat(_[1]);p=(null===(e=ut.current[R])||void 0===e?void 0:e.current)||null,h=(null===(n=ct.current[R])||void 0===n?void 0:n.current)||null,x=(null===(t=st.current[_[2]])||void 0===t?void 0:t.current)||(null===(i=lt.current[Number(_[2])])||void 0===i?void 0:i.current)||null,m=(null===(o=dt.current[_[3]])||void 0===o?void 0:o.current)||(null===(l=rt.current[Number(_[3])])||void 0===l?void 0:l.current)||null}else p=(null===(r=vt.current[v])||void 0===r?void 0:r.current)||null,x=(null===(c=lt.current[v])||void 0===c?void 0:c.current)||null,h=(null===(a=at.current[f])||void 0===a?void 0:a.current)||null,m=(null===(s=rt.current[f])||void 0===s?void 0:s.current)||null;if(p&&h&&x&&m){if(x.style.paddingTop="0px",m.style.paddingTop="0px",!he){var y=p.getBoundingClientRect(),b=h.getBoundingClientRect(),S=y.top-b.top;S>0?m.style.paddingTop="".concat(S,"px"):S<0&&(x.style.paddingTop="".concat(Math.abs(S),"px"))}var A=_n.current,E=gn.current;if(A&&E){var I=p.getBoundingClientRect().top-A.getBoundingClientRect().top+A.scrollTop,T=h.getBoundingClientRect().top-E.getBoundingClientRect().top+E.scrollTop-(I-A.scrollTop);Math.abs(E.scrollTop-T)>1&&(E.scrollTop=T)}}}null===(d=rn.current)||void 0===d||d.call(rn),on.current&&je(!0)}catch(e){console.error("Safely caught error during resize calculation:",e)}finally{ke(!1),ci.current=null}},150)},[he,Un,Xn]),di=t.useCallback(function(e){if(null!==yn.current&&bn.current&&Math.abs(e.currentTarget.scrollTop-yn.current)<=2){var n=bn.current;yn.current=null,bn.current=null,n()}He.current||(he||ai(),tn.current||(tn.current=!0,requestAnimationFrame(function(){var e,n,t,i,o,l,r;if(on.current){var c=_n.current,a=gn.current;if(c&&a&&zt.current){if(!Xe.current){var s=ln.current,d=void 0;if("string"==typeof s&&s.includes(u.DEVIATION_BADGE_SEPARATOR)){var v=s.split(u.DEVIATION_BADGE_SEPARATOR),f="".concat(v[0]).concat(u.DEVIATION_BADGE_SEPARATOR).concat(v[1]);d=null===(e=ut.current[f])||void 0===e?void 0:e.current}else d=null===(n=ut.current[s])||void 0===n?void 0:n.current;if(d){var g=d.getBoundingClientRect();Xe.current={badgeScreenY:g.top+g.height/2,initialScrollTop:c.scrollTop,leftTop:c.getBoundingClientRect().top,leftBottom:c.getBoundingClientRect().top+c.clientHeight,cTop:null!==(i=null===(t=Ht.current)||void 0===t?void 0:t.getBoundingClientRect().top)&&void 0!==i?i:0}}}if(Xe.current){var p=Xe.current,h=c.scrollTop-p.initialScrollTop,x=p.badgeScreenY-h,m=((o=x,l=p.leftTop,r=p.leftBottom,Math.max(l,Math.min(r,o)))-p.cTop).toString(),_=x>=p.leftTop-4&&x<=p.leftBottom+4;zt.current.setAttribute("y1",m),zt.current.setAttribute("y2",m),zt.current.setAttribute("visibility",_?"visible":"hidden")}}}nn.current.length>0&&ri(),tn.current=!1})))},[ri,he,ai]),vi=t.useRef(0),fi=t.useRef(0),gi=t.useRef(0),pi=t.useRef(function(){});t.useRef(null),t.useEffect(function(){pi.current=si},[si]),t.useEffect(function(){var e=setTimeout(ai,250),n=function(){return pi.current()};return window.addEventListener("resize",n),function(){clearTimeout(e),null!==ui.current&&clearTimeout(ui.current),null!==ci.current&&clearTimeout(ci.current),window.removeEventListener("resize",n)}},[Kn,Yn,ht,$n,Bt,Dt,Un,Xn,Mn,ai,Ce,Le,Ne,Ge]),t.useEffect(function(){var e=function(e,n,t,i,o){n.current=e.getBoundingClientRect().width;var l=new ResizeObserver(function(e){null!==t.current&&cancelAnimationFrame(t.current),t.current=requestAnimationFrame(function(){var l,r,u;t.current=null;var c=e[e.length-1];if(c){var a=null!==(u=null===(r=null===(l=c.borderBoxSize)||void 0===l?void 0:l[0])||void 0===r?void 0:r.inlineSize)&&void 0!==u?u:c.contentRect.width;Math.abs(a-n.current)<1?o():(n.current=a,i())}})});return l.observe(e),l},n={current:null},t={current:null},i={current:null},o=[],l=[n,t,i];return fn.current&&o.push(e(fn.current,vi,n,function(){return pi.current()},function(){})),vn.current&&o.push(e(vn.current,fi,t,function(){return pi.current()},function(){return rn.current()})),Ht.current&&o.push(e(Ht.current,gi,i,function(){return pi.current()},function(){return rn.current()})),function(){o.forEach(function(e){return e.disconnect()}),l.forEach(function(e){null!==e.current&&(cancelAnimationFrame(e.current),e.current=null)})}},[]),t.useEffect(function(){on.current=Ce},[Ce]),t.useEffect(function(){ln.current=Le},[Le]);var hi=t.useCallback(function(e,n,t){var i,o,l=null===(i=null==t?void 0:t.toggleIfSame)||void 0===i||i,r=null==t?void 0:t.onReady,c=null!==(o=null==t?void 0:t.sourceSide)&&void 0!==o?o:"left";kn(),null!=e&&(n?Te("No counterpart exists for this section."):(St(),Ce&&Le===e?l?At():null==r||r():(ze(new Set([e])),Ye([]),nn.current=[],Ae(!0),He.current=!0,Ve(e),ln.current=e,De(!0),on.current=!0,je(!1),pn.current&&(pn.current.style.height="0px"),hn.current&&(hn.current.style.height="0px"),xn.current&&(xn.current.style.height="0px"),mn.current&&(mn.current.style.height="0px"),requestAnimationFrame(function(){var n,t,i,o,l,a="string"==typeof e&&e.includes(u.DEVIATION_BADGE_SEPARATOR),s=null,d=null,v=null;if(a){var f=e.split(u.DEVIATION_BADGE_SEPARATOR),g="".concat(f[0]).concat(u.DEVIATION_BADGE_SEPARATOR).concat(f[1]);s=(null===(n=ut.current[g])||void 0===n?void 0:n.current)||null,d=(null===(t=ct.current[g])||void 0===t?void 0:t.current)||null,v=d?e:null}else if(s=(null===(i=vt.current[e])||void 0===i?void 0:i.current)||null,he){var p=Un[e],h=(null==p?void 0:p.refIndexes)||[];if(h.length>0){var x=h[0],m=Xn.findIndex(function(e){return e.selfIndex===x});-1!==m&&(d=(null===(l=at.current[m])||void 0===l?void 0:l.current)||null,v=m)}}else d=(null===(o=at.current[e])||void 0===o?void 0:o.current)||null,v=d?e:null;Gt.current=v;var _=_n.current,R=gn.current,y=function(){!function(){var n,t,i,o,l,r,c,s,d,f,g,p,h=null,x=null,m=null,_=null;if(a){var R=e.split(u.DEVIATION_BADGE_SEPARATOR),y="".concat(R[0]).concat(u.DEVIATION_BADGE_SEPARATOR).concat(R[1]);h=(null===(n=st.current[R[2]])||void 0===n?void 0:n.current)||(null===(t=lt.current[Number(R[2])])||void 0===t?void 0:t.current)||null,x=(null===(i=dt.current[R[3]])||void 0===i?void 0:i.current)||(null===(o=rt.current[Number(R[3])])||void 0===o?void 0:o.current)||null,m=(null===(l=ut.current[y])||void 0===l?void 0:l.current)||h,_=(null===(r=ct.current[y])||void 0===r?void 0:r.current)||x}else{var b=Number(e),S=null!==v?Number(v):b;h=(null===(c=lt.current[b])||void 0===c?void 0:c.current)||null,x=(null===(s=rt.current[S])||void 0===s?void 0:s.current)||null,m=(null===(d=ut.current[b])||void 0===d?void 0:d.current)||(null===(f=vt.current[b])||void 0===f?void 0:f.current)||h,_=(null===(g=ct.current[S])||void 0===g?void 0:g.current)||(null===(p=at.current[S])||void 0===p?void 0:p.current)||x}if(m&&_&&h&&x){h.style.paddingTop="0px",x.style.paddingTop="0px";var A=m.getBoundingClientRect(),E=_.getBoundingClientRect(),I=A.top-E.top;I>0?x.style.paddingTop="".concat(I,"px"):I<0&&(h.style.paddingTop="".concat(Math.abs(I),"px"))}}(),je(!0),rn.current&&rn.current(),He.current=!1,"right"===c&&R?R.dispatchEvent(new Event("scroll")):_&&_.dispatchEvent(new Event("scroll")),Ae(!1),null==r||r()};if(!s||!_)return He.current=!1,Ae(!1),void(null==r||r());if(d&&R){if(!he){var b=0;b="right"===c?d?d.getBoundingClientRect().top:0:s?s.getBoundingClientRect().top:0;var S=vn.current,A=(null==S?void 0:S.getBoundingClientRect().top)||0,E=S?S.scrollTop+b-A-150:0;return S?void u.smoothScrollTo(S,E,200,y):void y()}var I=s.getBoundingClientRect().top-_.getBoundingClientRect().top+_.scrollTop,T=d.getBoundingClientRect().top-R.getBoundingClientRect().top+R.scrollTop,B=200;if("left"===c){var C=T-(I-_.scrollTop);C<0&&pn.current&&(pn.current.style.height="".concat(Math.abs(C),"px")),requestAnimationFrame(function(){var e,n=R.scrollHeight-R.clientHeight;if(C<0)e=0;else{if(C>n){var t=C-n;return hn.current&&(hn.current.style.height="".concat(t+150,"px")),void requestAnimationFrame(function(){u.smoothScrollTo(R,C,B,y)})}e=C}u.smoothScrollTo(R,e,B,y)})}else{var D=I-(T-R.scrollTop);D<0&&xn.current&&(xn.current.style.height="".concat(Math.abs(D),"px")),requestAnimationFrame(function(){var e,n=_.scrollHeight-_.clientHeight;if(D<0)e=0;else{if(D>n){var t=D-n;return mn.current&&(mn.current.style.height="".concat(t+150,"px")),void requestAnimationFrame(function(){u.smoothScrollTo(_,D,B,y)})}e=D}u.smoothScrollTo(_,e,B,y)})}}else y()}))))},[Le,kn,Xn,Ce,he,Un,At]),xi=t.useCallback(function(e,n,t,i,o){var l,r="string"==typeof i?u.safeStringify(i).trim():u.safeStringify(null==i?void 0:i.deviation_summary).trim(),c=e.currentTarget;Fn();var a="left";(null===(l=gn.current)||void 0===l?void 0:l.contains(c))&&(a="right");var s=function(){var e,t,i,o;if("string"==typeof n&&n.includes(u.DEVIATION_BADGE_SEPARATOR)){var l=n.split(u.DEVIATION_BADGE_SEPARATOR),r="".concat(l[0]).concat(u.DEVIATION_BADGE_SEPARATOR).concat(l[1]);return"right"===a?null===(e=ct.current[r])||void 0===e?void 0:e.current:null===(t=ut.current[r])||void 0===t?void 0:t.current}return"right"===a?null===(i=ct.current[n])||void 0===i?void 0:i.current:null===(o=ut.current[n])||void 0===o?void 0:o.current};if(t)return At(),ze(new Set),Ye([]),nn.current=[],void(r&&requestAnimationFrame(function(){var e=s()||c;wn({open:!0,anchorEl:e,summary:i,displayImpact:o})}));hi(n,t,r?{toggleIfSame:!1,sourceSide:a,onReady:function(){var e=s()||c;wn({open:!0,anchorEl:e,summary:i,displayImpact:o})}}:{toggleIfSame:!1,sourceSide:a})},[hi,Fn,wn,At]),mi=t.useCallback(function(){var e,n=In.sectionIdx,t=In.isOrphan;if(Nn(),null!=n){var i="left";In.anchorEl&&(null===(e=gn.current)||void 0===e?void 0:e.contains(In.anchorEl))&&(i="right"),hi(n,t,{sourceSide:i})}},[hi,In.isOrphan,In.sectionIdx,In.anchorEl,Nn]),_i=t.useCallback(function(){Nn(),At(),ze(new Set),Ye([]),nn.current=[]},[Nn,At]),Ri=null!==In.sectionIdx&&Ge.has(In.sectionIdx),yi=m.useDeviationNavigation({proposedSections:Un,existingSections:Xn,parentDeviationRecord:Jn,expandedSections:Bt,maintainRelativeOrder:!!he,scrollContainerRef:vn,leftContainerRef:_n,lhsBadgeRefs:ut,rhsBadgeRefs:ct}),bi=yi.showDeviationNavigation,Si=yi.showOpenNodeRef,Ai=t.useMemo(function(){var e;if(!se)return null;var n=null===(e=null==se?void 0:se.id)||void 0===e?void 0:e.split(":")[0];for(var t in Jn){if((Jn[t]||[]).some(function(e){return e.id===n}))return t}return null},[se,Jn]),Ei=t.useRef({id:null,triggerMs:null}),Ii=t.useRef(null);t.useEffect(function(){var n;if(null==se?void 0:se.id){var t=Number(se.trigger),i=Ei.current;if((null==i?void 0:i.triggerMs)!==t){if(!(se.id.includes(":")&&/:\d+$/.test(se.id)))return Ei.current={id:se.id,triggerMs:t},void Lt(se.id);var o=null===(n=null==se?void 0:se.id)||void 0===n?void 0:n.split(":"),l=o[0],r=o[1],c=null!=r?r:"0";Ii.current!==se.id&&(Nn(),Fn(),At(),ze(new Set),Ye([]),nn.current=[],Ii.current=se.id);var a=!1,s=0,d=null,v=150,f=function(e,n){for(var t=function(e,i){if(!e)return null;if(e.id===n)return i;if(!Array.isArray(e.subsections))return null;for(var o=0;o<e.subsections.length;o++){var l=t(e.subsections[o],"".concat(i,"-").concat(o));if(l)return l}return null},i=0;i<e.length;i++){var o=t(e[i],String(i));if(o)return o}return null},g=function(){var n,i,o,r;if(!a){var p=function(){Ei.current={id:se.id,triggerMs:t}},h=null,x=null;for(var m in Jn){var _=Jn[m].find(function(e){return e.id===l});if(_){h=m,x=_;break}}if(x&&h){var R=Un.findIndex(function(e){return e.id===h}),y=Xn.findIndex(function(e){return e.id===h}),b=-1===R&&-1!==y,S=f(Un,x.id),A=f(Xn,x.id);if(S&&!A&&!b){var E=S.split("-"),I=Number(E[0]);if(he){var T=null===(i=null===(n=Un[I])||void 0===n?void 0:n.refIndexes)||void 0===i?void 0:i[0],B=Xn.findIndex(function(e){return e.selfIndex===T});-1!==B&&(I=B)}A=e.__spreadArray([I],E.slice(1),!0).join("-")}if(S||A){var C=b||!S&&!!A,D=S?Number(S.split("-")[0]):R,O=A?Number(A.split("-")[0]):y;if(C){if(!(he?!!Bt["right-".concat(O)]:!!Bt[String(O)])&&O>=0)return wt(O,"right"),s+=1,void(d=setTimeout(g,450))}else if(!(he?!!Bt["left-".concat(D)]:!!Bt[String(D)])&&D>=0)return wt(D,"left"),s+=1,void(d=setTimeout(g,450));var w,N=S||"",j=A||"",P="".concat(x.id).concat(u.DEVIATION_BADGE_SEPARATOR).concat(c).concat(u.DEVIATION_BADGE_SEPARATOR).concat(N).concat(u.DEVIATION_BADGE_SEPARATOR).concat(j),F="".concat(x.id).concat(u.DEVIATION_BADGE_SEPARATOR).concat(c),k=null===(o=ut.current[F])||void 0===o?void 0:o.current,M=null===(r=ct.current[F])||void 0===r?void 0:r.current,L=C||!k&&!!M,V=L?M:k;if(w=he?L?gn.current:_n.current:vn.current,V&&w){var H=V.getBoundingClientRect();if(0===H.height)return void((s+=1)<2?d=setTimeout(g,v):p());var q=w.getBoundingClientRect(),G=H.top-q.top+w.scrollTop-q.height/2+H.height/2+150,z=function(){var n,t,i,o,l;if(!a){p();var r=V instanceof Element?window.getComputedStyle(V).color:"";k&&(k.style.transition="box-shadow 300ms ease-in-out",k.style.boxShadow="0 0 10px ".concat(r)),M&&(M.style.transition="box-shadow 300ms ease-in-out",M.style.boxShadow="0 0 10px ".concat(r)),setTimeout(function(){k&&(k.style.boxShadow=""),M&&(M.style.boxShadow="")},2e3);var u=(null===(t=null===(n=x.evaluationResult)||void 0===n?void 0:n.deviations)||void 0===t?void 0:t[c])||x,s=(null===(i=x.evaluationResult)||void 0===i?void 0:i.evaluation_outputs)||x.evaluation_outputs;if(!(!!k&&!!M)){var d=L?(null===(o=ct.current[F])||void 0===o?void 0:o.current)||M:(null===(l=ut.current[F])||void 0===l?void 0:l.current)||k;return wn({open:!0,anchorEl:d,displayImpact:se.displayImpact,summary:e.__assign(e.__assign({},u),{evaluation_outputs:s})}),void(null==de||de())}hi(P,!1,{toggleIfSame:!1,sourceSide:"left",onReady:function(){var n,t=(null===(n=ut.current[F])||void 0===n?void 0:n.current)||k;console.log("Summary data",s,u),wn({open:!0,anchorEl:t,displayImpact:null==se?void 0:se.displayImpact,summary:e.__assign({},u)})}})}};Math.abs(w.scrollTop-G)<=2?z():(yn.current=G,bn.current=z,w.scrollTo({top:G,behavior:"smooth"}),d&&clearTimeout(d),d=setTimeout(function(){if(bn.current){yn.current=null;var e=bn.current;bn.current=null,e()}},800))}else(s+=1)<2?d=setTimeout(g,v):p()}else(s+=1)<2?d=setTimeout(g,v):p()}else(s+=1)<2?d=setTimeout(g,v):p()}};return d=setTimeout(g,v),function(){a=!0,d&&clearTimeout(d)}}}},[se,Jn,Un,Xn,he,Bt,wt,hi,wn,Lt]);var Ti=function(e){var t=e.section,i=e.keyPath,o=e.depth,l=void 0===o?0:o,r=e.columnKey,u=void 0===r?"left":r,c=e.parentNodeId,a=void 0===c?"":c;return n.jsx(y.default,{section:t,keyPath:i,depth:l,columnKey:u,parentNodeId:a,expandedSubSections:Dt,setExpandedSubSections:Ot,maintainRelativeOrder:he||!1,proposedSections:Un,existingSections:Xn,treeData:Z,deviationNumberRegistry:Qn,connectedSections:Ge,activeSideBySideSection:Le,resolvedMarkdownStyles:dn,getSubSectionRef:gt,getSubSectionCompareStyle:ni,getBadgeRef:pt,openMoreFunctionsPopup:Pt,openSummaryPopup:xi,showDeviationBadges:me,resetSideBySide:At,setConnectedSections:ze,setConnectedLines:Ye,cachedConnectedPositions:nn,isProposingFix:fe,proposingFixNodeId:ge})};return n.jsxs(i.Box,e.__assign({ref:fn,sx:e.__assign(e.__assign({display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif'},he?{}:{overflow:"visible"}),{position:"relative"})},{children:[Re&&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(b.default,{open:On.open,anchorEl:On.anchorEl,containerEl:qt.current,clipTopEl:Wt.current,scrollContainerEl:vn.current,onClose:_i,summary:On.summary,displayImpact:On.displayImpact}),n.jsx(d.default,{open:In.open,anchorEl:In.anchorEl,sectionTitle:In.sectionTitle,referenceSectionTitle:In.refSectionTitle,onClose:kn,onOpenCognitiveCompare:Ft,onOpenSideBySide:mi,onConnect:kt,isConnected:Ri,isOrphan:In.isOrphan}),An.open&&n.jsx(s.default,{open:An.open,popupRef:Pn,position:Bn,popupConfig:ue,onClose:function(){Cn(null),En(function(n){return e.__assign(e.__assign({},n),{open:!1})}),jn(null)},markdownStyles:ie,sectionTitle:An.sectionTitle,referenceSectionTitle:An.refSectionTitle,cognitiveData:An.cognitiveData,anchorEl:An.anchorEl,sectionAnchorEl:An.sectionAnchorEl,scrollContainerEl:vn.current,badgeStyle:An.badgeStyle,docData:An.docData,deviationData:An.deviationData,isLoading:An.isLoading}),n.jsx(i.Snackbar,e.__assign({open:!!Ie,autoHideDuration:8e3,onClose:function(){return Te(null)},anchorOrigin:{vertical:"top",horizontal:"center"}},{children:n.jsx(i.Alert,e.__assign({onClose:function(){return Te(null)},severity:"error",sx:{width:"100%",whiteSpace:"pre-line"}},{children:Ie}))})),n.jsx(_.default,{componentHeaderText:Q,displayConfig:re,maintainRelativeOrder:he,onCollapseAll:ii,showCollapseAll:oi,onToggleView:function(e){ye(!0),setTimeout(function(){xe(!e),At(),Nn(),ze(new Set),Ye([]),nn.current=[],requestAnimationFrame(function(){requestAnimationFrame(function(){setTimeout(function(){ye(!1)},600)})})},50)}}),n.jsx(i.Box,e.__assign({ref:vn,onScroll:di,sx:{flex:1,minHeight:0,pt:1.5,pb:1,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",overflowY:he?"hidden":"auto",borderTop:xt&&mt?"none":"1.5px solid #EEF0F4"}},{children:n.jsx(i.Box,e.__assign({sx:e.__assign({display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"},he?{flex:1,minHeight:0}:{})},{children:n.jsxs(i.Box,e.__assign({ref:Ht,sx:e.__assign({display:"grid",gridTemplateColumns:"minmax(0, 1fr) 180px minmax(0, 1fr)",gap:"50px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0},he?{flex:1,overflow:"visible"}:{})},{children:[n.jsxs("svg",e.__assign({ref:Ue,style:{position:"absolute",top:0,left:0,width:an.width||"100%",height:an.height||"100%",pointerEvents:"none",zIndex:10,overflow:"visible",opacity:Fe?0:1,transition:"opacity 0.15s ease-in-out"}},{children:[Jt&&n.jsx("g",{children:n.jsx("line",{x1:Jt.x1,y1:Jt.y,x2:Jt.x2,y2:Jt.y,stroke:bt.badgeBorder,strokeWidth:"1.5"})}),Ut.map(function(t){var r,c,s,d,v,g,p,h=t.x1+.5*(t.x2-t.x1),x=(t.y1+t.y2)/2;if("Not Defined"===t.style.label&&!t.hasCognitive)return null;if(t.isSubSection?Ce&&Le===t.subSectionKeyPath&&Ne:Ce&&Le===t.sectionIdx&&Ne)return null;if(!he){var m=t.isSubSection?u.getBentArrowPath(t.x1,t.y1,t.x2,t.y2):"M ".concat(t.x1," ").concat(t.y1," L ").concat(t.x2," ").concat(t.y2),_=Un[t.sectionIdx]||{title:"",content:""},R=Xn[null!==(r=t.targetRightIdx)&&void 0!==r?r:t.sectionIdx]||{title:"",content:""};if(console.log("Base and Ref Sections for Badge:",_,R),t.isSubSection&&t.subSectionKeyPath){var y=t.subSectionKeyPath.includes(u.DEVIATION_BADGE_SEPARATOR)?t.subSectionKeyPath.split(u.DEVIATION_BADGE_SEPARATOR):[],b=y[2]||t.subSectionKeyPath,S=y[3]||b,A=b.split("-").map(Number),E=S.split("-").map(Number),I=null,T=null;A.length>0&&(I=Un[A[0]]),E.length>0&&(T=Xn[E[0]]);var B=(null==I?void 0:I.title)||"",C=(null==T?void 0:T.title)||"";console.log("Root Parent Titles:",B,C);for(var D=1;D<A.length;D++)(null==I?void 0:I.subsections)&&(I=I.subsections[A[D]]);for(D=1;D<E.length;D++)(null==T?void 0:T.subsections)&&(T=T.subsections[E[D]]);I&&(_=e.__assign(e.__assign({},I),{title:B||I.title})),console.log("Base Section for Subsection Badge:",_),T&&(R=e.__assign(e.__assign({},T),{title:C||T.title})),console.log("Ref Section for Subsection Badge:",R)}var O=!(null===(c=_.cognitiveData)||void 0===c?void 0:c.isMissingRationale)||Boolean(null===(d=null===(s=_.cognitiveData)||void 0===s?void 0:s.decisioning)||void 0===d?void 0:d.length),w=(null===(p=null===(g=null===(v=_.evaluationResult)||void 0===v?void 0:v.cognitive_decisioning)||void 0===g?void 0:g.decisioning_factors)||void 0===p?void 0:p.length)||!1,N=O||w;return n.jsxs("g",{children:[n.jsx("path",{d:m,fill:"none",stroke:t.style.badgeBorder||"#E2E8F0",strokeWidth:"1.5"}),n.jsx("foreignObject",e.__assign({x:h-100,y:x-14,width:"200",height:"28",style:{pointerEvents:"auto",overflow:"visible"}},{children:n.jsx(i.Box,e.__assign({sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},{children:n.jsxs(i.Box,e.__assign({onClick:function(e){e.stopPropagation(),N&&(An.open&&Dn===t.id?Fn():(jn(t.id),jt(Nt(e.currentTarget,_,R,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:N?"pointer":"default"}},{children:[t.style.badgeText===a.DEFAULT_DEVIAION_COLOR&&null==t.style.label?n.jsx(f.default,{color:t.style.badgeText}):0===t.style.label?"Same":t.style.label,n.jsx(i.Box,e.__assign({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:n.jsx(l.ButtonCognitiveIcon,{})})),N&&n.jsx(o.ChevronDown,{size:11,style:{transform:An.open&&Dn===t.id?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))}))]},t.id)}return null}),n.jsx(S.default,{connectedLines:Ke,pathRefs:en})]})),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)"},he?{flex:1,overflow:"visible"}:{})},{children:[n.jsx(i.Box,e.__assign({ref:Wt,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:Gn,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:Gn}))}))})),n.jsxs(i.Box,e.__assign({ref:_n,onScroll:di,sx:e.__assign({p:"12px",display:"flex",flexDirection:"column"},he?{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:xn,style:{width:"100%",height:"0px",flexShrink:0}}),et&&Un.map(function(t,l){var r,c,a=!t.title&&!t.content;if(he&&a)return null;var s=t,d=ei(l,"left"),v=he?!(null===(r=s.refIndexes)||void 0===r?void 0:r.length)||s.selfIndex<0:!Xn[l],g=Ge.has(l),p=u.extractDeviationScore(s.evaluationResult,null==d?void 0:d.deviationLabel),h=nt.leftNums.get(s.id);return n.jsx(i.Box,e.__assign({ref:ft(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:lt.current[l],sx:e.__assign({width:"100%",display:"flex",flexDirection:"column",minWidth:0},g&&{borderRadius:"6px",outline:"2px solid ".concat((null==d?void 0:d.badgeBorder)||"#6366F1"),outlineOffset:"1px"})},{children:n.jsx(R.default,{section:t,idx:l,columnKey:"left",colRef:ft("left-accordion-".concat(l)),mb:0,treeData:Z,proposedSections:Un,existingSections:Xn,deviationNumberRegistry:Qn,getSectionCompareStyle:ei,getBadgeRef:pt,connectedSections:Ge,openMoreFunctionsPopup:Pt,openSummaryPopup:xi,deviationNodeIdToView:null==se?void 0:se.id,deviationTargetParentId:Ai,parentNodeId:(null===(c=null==Z?void 0:Z.input_index_map)||void 0===c?void 0:c[0])||"",isExpanded:he?!!Bt["left-".concat(l)]:!!Bt[String(l)],onToggle:function(){_i(),wt(l,"left")},navigation:t.id?bi[t.id]:null,showOpenNodeRef:Si,resolvedMarkdownStyles:dn,maintainRelativeOrder:he,showDeviationBadges:me,renderSubSections:Ti,isProposingFix:fe,proposingFixNodeId:ge,collisionKey:"".concat(Ce?"1":"0","-").concat(String(null!=Le?Le:""))})})),he&&d&&n.jsxs(i.Box,e.__assign({ref:ut.current[l],onClick:function(e){var n,t,i,o=re.enableDeviationSchemaBackwardCompatibility?null!==(n=s.evaluationResult)&&void 0!==n?n:null:null!==(i=null===(t=s.evaluationResult)||void 0===t?void 0:t[0])&&void 0!==i?i:null;xi(e,String(l),v,o)},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:[n.jsxs(i.Box,e.__assign({component:"span",onClick:function(e){var n,t,i;e.stopPropagation();var o=re.enableDeviationSchemaBackwardCompatibility?null!==(n=s.evaluationResult)&&void 0!==n?n:null:null!==(i=null===(t=s.evaluationResult)||void 0===t?void 0:t[0])&&void 0!==i?i:null;xi(e,String(l),v,o)},sx:{display:"inline-flex",alignItems:"center",gap:"4px",px:.2,cursor:v?"default":"pointer",borderRight:"1px solid ".concat(d.badgeBorder),"&:hover":v?{}:{bgColor:"".concat(d.badgeBorder,"22")}}},{children:[null!=h&&n.jsx(i.Box,e.__assign({component:"span",sx:{fontSize:"11px",fontWeight:700,pr:.5,borderRight:"1px solid ".concat(d.badgeBorder)}},{children:h})),n.jsx(i.Box,e.__assign({component:"span",sx:{fontSize:"11px",px:.25}},{children:!re.isLoading||null!=s.evaluationResult&&null!=s.evaluationResult?"N/A"===p||"NA"===p?"N/A":0==p||null==p?"Same":"".concat(p):n.jsx(f.default,{color:d.badgeText})}))]})),n.jsx(i.Box,e.__assign({component:"span",onClick:function(e){e.stopPropagation();var n=he?Xn.find(function(e){var n;return null===(n=s.refIndexes)||void 0===n?void 0:n.includes(e.selfIndex)})||{title:"",content:""}:Xn[l]||{title:"",content:""};Pt(e,t,v,n,l,d)},sx:{display:"inline-flex",alignItems:"center",px:.2,cursor:"pointer","&:hover":{bgcolor:"".concat(d.badgeBorder,"22")}}},{children:n.jsx(o.EllipsisVertical,{size:11,color:d.badgeText})}))]}))]}))}),"left-row-".concat(l))}),n.jsx("div",{ref:mn,style:{width:"100%",height:"0px",flexShrink:0}})]}))]})),n.jsx(i.Box,e.__assign({ref:qt,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(),An.open&&Dn===_t?Fn():(jn(_t),jt(Nt(n.currentTarget,{title:"",content:"",evaluationResult:Rt,cognitiveData:{section_id:"",decisioning:[],gap:[],relevance_score:0,isMissingRationale:!0}},null,_t,!0,e.__assign(e.__assign({},bt),{label:""}))))},sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:"5px",top:"-8px",borderRadius:"20px",bgcolor:bt.badgeBg,color:bt.badgeText,border:"1px solid ".concat(bt.badgeBorder),fontSize:"12px",fontWeight:600,whiteSpace:"nowrap",position:"relative",zIndex:1,pointerEvents:"auto",cursor:"pointer"}},{children:[null!=yt?yt:n.jsx(f.default,{}),n.jsx(i.Box,e.__assign({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:n.jsx(l.ButtonCognitiveIcon,{})})),n.jsx(o.ChevronDown,{size:11,style:{transform:An.open&&Dn===_t?"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},he?{flex:1,overflow:"visible",minHeight:0}:{})},{children:[Se&&n.jsx(r.default,{sections:11}),n.jsx(i.Box,e.__assign({ref:Kt,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:zn,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:zn}))}))})),n.jsxs(i.Box,e.__assign({ref:gn,onScroll:di,sx:e.__assign({p:"12px",display:"flex",flexDirection:"column"},he?{maxHeight:"calc(100vh - 150px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,ml:"-140px",pl:"160px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[n.jsx("div",{ref:pn,style:{width:"100%",height:"0px",flexShrink:0}}),et&&Xn.map(function(t,l){var r,u,c=t,a=!1,s=null,d=-1;if(he){d=Un.findIndex(function(e){var n;return(null===(n=e.refIndexes)||void 0===n?void 0:n.includes(c.selfIndex))&&e.selfIndex>=0});var v=Un.findIndex(function(e,n){var t;return Ge.has(n)&&(null===(t=e.refIndexes)||void 0===t?void 0:t.includes(c.selfIndex))});(a=-1!==v)&&(s=ei(v))}else(a=Ge.has(l))&&(s=ei(l));var g=ei(he&&-1!==d?d:l),p=he?!(null===(r=c.refIndexes)||void 0===r?void 0:r.length)||c.selfIndex<0:!Un[l],h=nt.rightNums.get(c.id);return n.jsx(i.Box,e.__assign({ref:at.current[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:rt.current[l],sx:e.__assign({width:"100%",display:"flex"},a&&s&&{borderRadius:"6px",outline:"2px solid ".concat(s.badgeBorder),outlineOffset:"1px"})},{children:n.jsx(R.default,{section:t,idx:l,columnKey:"right",colRef:ft("right-accordion-".concat(l)),mb:0,parentNodeId:(null===(u=null==Z?void 0:Z.input_index_map)||void 0===u?void 0:u[1])||"",isExpanded:he?!!Bt["right-".concat(l)]:!!Bt[String(l)],treeData:Z,proposedSections:Un,existingSections:Xn,deviationNumberRegistry:Qn,getBadgeRef:pt,getSectionCompareStyle:ei,connectedSections:Ge,openMoreFunctionsPopup:Pt,openSummaryPopup:xi,deviationNodeIdToView:null==se?void 0:se.id,deviationTargetParentId:Ai,onToggle:function(){_i(),wt(l,"right")},navigation:t.id?bi[t.id]:null,showOpenNodeRef:Si,resolvedMarkdownStyles:dn,maintainRelativeOrder:he,showDeviationBadges:me,renderSubSections:Ti,isProposingFix:fe,proposingFixNodeId:ge,collisionKey:"".concat(Ce?"1":"0","-").concat(String(null!=Le?Le:""))})})),he&&g&&n.jsx(i.Box,e.__assign({ref:ct.current[l],"data-section-id":c.id,onClick:function(e){var n,t,i;if(p){var o=re.enableDeviationSchemaBackwardCompatibility?null!==(n=c.evaluationResult)&&void 0!==n?n:null:null!==(i=null===(t=c.evaluationResult)||void 0===t?void 0:t[0])&&void 0!==i?i:null;xi(e,String(l),p,o)}},sx:{position:"absolute",top:"18px",left:0,transform:"translateY(-50%) translateX(calc(-100% - 8px))",display:"inline-flex",alignItems:"center",justifyContent:"center",gap:p?"4px":"0px",fontSize:"11px",bgcolor:p?"#F1D2D2":g.badgeBg,color:p?"#B91C1C":g.badgeText,border:p?"1px solid #DC8E8E":"1px solid ".concat(g.badgeBorder),borderRadius:p?"12px":"10px",px:p?1.2:1,py:p?.4:.3,fontWeight:p?600:700,cursor:p?"pointer":"default",whiteSpace:"nowrap",zIndex:20,boxShadow:p?"0 1px 3px rgba(0,0,0,0.07)":"none"}},{children:p?n.jsxs(n.Fragment,{children:[n.jsxs(i.Box,e.__assign({component:"span",onClick:function(e){var n,t,i;e.stopPropagation();var o=re.enableDeviationSchemaBackwardCompatibility?null!==(n=c.evaluationResult)&&void 0!==n?n:null:null!==(i=null===(t=c.evaluationResult)||void 0===t?void 0:t[0])&&void 0!==i?i:null;xi(e,String(l),p,o)},sx:{display:"inline-flex",alignItems:"center",gap:"4px",px:.2,cursor:"pointer",borderRight:p?"1px solid #DC8E8E":"1px solid ".concat(g.badgeBorder),"&:hover":{bgcolor:p?"#F1D2D2":"".concat(g.badgeBorder,"22")}}},{children:[null!=h&&n.jsx(i.Box,e.__assign({component:"span",sx:{fontSize:"11px",fontWeight:700,pr:.5,borderRight:p?"1px solid #DC8E8E":"1px solid ".concat(g.badgeBorder)}},{children:h})),n.jsx(i.Box,e.__assign({component:"span",sx:{fontSize:"11px",px:.25}},{children:!re.isLoading||null!=c.evaluationResult&&null!=c.evaluationResult?"100% Deviation":n.jsx(f.default,{color:p?"#B91C1C":g.badgeText})}))]})),n.jsx(i.Box,e.__assign({component:"span",onClick:function(e){e.stopPropagation();var n=he?Un.find(function(e){var n;return null===(n=e.refIndexes)||void 0===n?void 0:n.includes(c.selfIndex)})||{title:"",content:""}:Un[l]||{title:"",content:""};Pt(e,n,p,c,l,g)},sx:{display:"inline-flex",alignItems:"center",px:.2,cursor:"pointer","&:hover":{bgcolor:"".concat(g.badgeBorder,"22")}}},{children:n.jsx(o.EllipsisVertical,{size:11,color:p?"#B91C1C":g.badgeText})}))]}):null!=h?h:""}))]}))}),"right-row-".concat(l))}),n.jsx("div",{ref:hn,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 i=require("tslib"),o=require("react/jsx-runtime"),e=require("react"),n=require("@mui/material"),t=require("lucide-react"),s=require("react-dom"),a=require("../../assests/svg/SparkleIcon.js"),r=require("./CognitiveCompareConfig.js"),l=require("./CitationRenderer.js");function c(i){return i&&"object"==typeof i&&"default"in i?i:{default:i}}var d=c(s),x=10;exports.default=function(s){var c,p,g,u,v,h,b,f,_,m,y,F,j,w,k,B,S,C,D,E,T=s.open,I=s.onClose,R=s.sectionTitle,A=s.referenceSectionTitle,L=s.cognitiveData,P=s.relevanceScore,z=s.anchorEl,O=s.badgeStyle,W=s.popupRef,q=s.position,U=s.markdownStyles,H=s.docData,M=s.popupConfig,N=s.deviationData,G=void 0===N?null:N,Y=s.isLoading,K=i.__assign(i.__assign({},r.SHARED_MARKDOWN_STYLES),U),X=e.useMemo(function(){var o,e;return i.__assign(i.__assign(i.__assign({},r.DEFAULT_POPUP_CONFIG),M),{tabs:{deviation:i.__assign(i.__assign({},r.DEFAULT_POPUP_CONFIG.tabs.deviation),null===(o=null==M?void 0:M.tabs)||void 0===o?void 0:o.deviation),association:i.__assign(i.__assign({},r.DEFAULT_POPUP_CONFIG.tabs.association),null===(e=null==M?void 0:M.tabs)||void 0===e?void 0:e.association)},sectionTitles:i.__assign(i.__assign({},r.DEFAULT_POPUP_CONFIG.sectionTitles),null==M?void 0:M.sectionTitles)})},[M]),J=null==L?void 0:L.isMissingRationale,Q=e.useState(J?X.tabs.deviation.key:X.tabs.association.key),V=Q[0],Z=Q[1];e.useEffect(function(){T&&Z(J?X.tabs.deviation.key:X.tabs.association.key)},[T,J,X.tabs.deviation.key,X.tabs.association.key]);var $=e.useMemo(function(){if(!O)return{border:X.accentColor,shadow:"".concat(X.accentColor,"2E")};var i=O.badgeText;return"#9F1239"===i||"#B42318"===i?{border:"#E11D48",shadow:"rgba(225,29,72,0.15)"}:"#1D4ED8"===i?{border:"#3B82F6",shadow:"rgba(59,130,246,0.15)"}:"#A16207"===i?{border:"#F59E0B",shadow:"rgba(245,158,11,0.15)"}:{border:X.accentColor,shadow:"".concat(X.accentColor,"2E")}},[O,X.accentColor]);e.useEffect(function(){if(T){var i=function(i){var o;(null===(o=W.current)||void 0===o?void 0:o.contains(i.target))||(null==z?void 0:z.contains(i.target))||I()};return document.addEventListener("mousedown",i),function(){return document.removeEventListener("mousedown",i)}}},[T,I,z,W]);var ii=J?[]:[X.tabs.deviation,X.tabs.association];if(1===ii.length&&ii[0].key===X.tabs.deviation.key)return null;if(!T||!L)return null;var oi=null!==(g=null!==(p=V===X.tabs.deviation.key?null===(c=null==G?void 0:G.cognitive_decisioning)||void 0===c?void 0:c.decision_strength:L.relevance_score)&&void 0!==p?p:P)&&void 0!==g?g:0,ei=L.decisioning,ni=Array.isArray(ei)?ei:"string"==typeof ei&&ei.trim()?[ei]:[],ti=L.gap,si=Array.isArray(ti)?ti:"string"==typeof ti&&ti.trim()?[ti]:[],ai=q?q.left-150:-9999,ri=(null!==(u=null==q?void 0:q.arrowLeft)&&void 0!==u?u:60)+150,li=o.jsxs(n.Box,i.__assign({ref:W,sx:{position:"fixed",top:null!==(v=null==q?void 0:q.top)&&void 0!==v?v:-9999,left:ai,zIndex:9999,width:"".concat(1050,"px"),maxWidth:"min(".concat(1050,"px, calc(100vw - ").concat(ai>0?ai:0,"px - ").concat(12,"px))"),bgcolor:"#FFFFFF",borderRadius:"14px",border:"1.5px solid ".concat($.border),boxShadow:"0px 8px 32px ".concat($.shadow,", 0px 0px 0px 3px ").concat($.shadow),overflow:"visible",display:"flex",flexDirection:"column",maxHeight:(null==q?void 0:q.maxHeight)?"min(60vh, ".concat(q.maxHeight,"px)"):"60vh",visibility:q?"visible":"hidden"}},{children:[q&&(q.openAbove?o.jsxs(o.Fragment,{children:[o.jsx(n.Box,{sx:{position:"absolute",bottom:-11,left:ri-x,width:0,height:0,borderLeft:"".concat(x,"px solid transparent"),borderRight:"".concat(x,"px solid transparent"),borderTop:"".concat(11,"px solid ").concat($.border),zIndex:1}}),o.jsx(n.Box,{sx:{position:"absolute",bottom:-9,left:ri-x+1,width:0,height:0,borderLeft:"".concat(9,"px solid transparent"),borderRight:"".concat(9,"px solid transparent"),borderTop:"".concat(x,"px solid #FFFFFF"),zIndex:2}})]}):o.jsxs(o.Fragment,{children:[o.jsx(n.Box,{sx:{position:"absolute",top:-11,left:ri-x,width:0,height:0,borderLeft:"".concat(x,"px solid transparent"),borderRight:"".concat(x,"px solid transparent"),borderBottom:"".concat(11,"px solid ").concat($.border),zIndex:1}}),o.jsx(n.Box,{sx:{position:"absolute",top:-9,left:ri-x+1,width:0,height:0,borderLeft:"".concat(9,"px solid transparent"),borderRight:"".concat(9,"px solid transparent"),borderBottom:"".concat(x,"px solid #FFFFFF"),zIndex:2}})]})),o.jsxs(n.Box,i.__assign({sx:{px:2.5,pt:2,pb:1.5,display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:2,flexShrink:0}},{children:[o.jsxs(n.Box,i.__assign({sx:{flex:1,minWidth:0}},{children:[("no
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var i=require("tslib"),o=require("react/jsx-runtime"),e=require("react"),n=require("@mui/material"),t=require("lucide-react"),s=require("react-dom"),a=require("../../assests/svg/SparkleIcon.js"),r=require("./CognitiveCompareConfig.js"),l=require("./CitationRenderer.js");function c(i){return i&&"object"==typeof i&&"default"in i?i:{default:i}}var d=c(s),x=10;exports.default=function(s){var c,p,g,u,v,h,b,f,_,m,y,F,j,w,k,B,S,C,D,E,T=s.open,I=s.onClose,R=s.sectionTitle,A=s.referenceSectionTitle,L=s.cognitiveData,P=s.relevanceScore,z=s.anchorEl,O=s.badgeStyle,W=s.popupRef,q=s.position,U=s.markdownStyles,H=s.docData,M=s.popupConfig,N=s.deviationData,G=void 0===N?null:N,Y=s.isLoading,K=i.__assign(i.__assign({},r.SHARED_MARKDOWN_STYLES),U),X=e.useMemo(function(){var o,e;return i.__assign(i.__assign(i.__assign({},r.DEFAULT_POPUP_CONFIG),M),{tabs:{deviation:i.__assign(i.__assign({},r.DEFAULT_POPUP_CONFIG.tabs.deviation),null===(o=null==M?void 0:M.tabs)||void 0===o?void 0:o.deviation),association:i.__assign(i.__assign({},r.DEFAULT_POPUP_CONFIG.tabs.association),null===(e=null==M?void 0:M.tabs)||void 0===e?void 0:e.association)},sectionTitles:i.__assign(i.__assign({},r.DEFAULT_POPUP_CONFIG.sectionTitles),null==M?void 0:M.sectionTitles)})},[M]),J=null==L?void 0:L.isMissingRationale,Q=e.useState(J?X.tabs.deviation.key:X.tabs.association.key),V=Q[0],Z=Q[1];e.useEffect(function(){T&&Z(J?X.tabs.deviation.key:X.tabs.association.key)},[T,J,X.tabs.deviation.key,X.tabs.association.key]);var $=e.useMemo(function(){if(!O)return{border:X.accentColor,shadow:"".concat(X.accentColor,"2E")};var i=O.badgeText;return"#9F1239"===i||"#B42318"===i?{border:"#E11D48",shadow:"rgba(225,29,72,0.15)"}:"#1D4ED8"===i?{border:"#3B82F6",shadow:"rgba(59,130,246,0.15)"}:"#A16207"===i?{border:"#F59E0B",shadow:"rgba(245,158,11,0.15)"}:{border:X.accentColor,shadow:"".concat(X.accentColor,"2E")}},[O,X.accentColor]);e.useEffect(function(){if(T){var i=function(i){var o;(null===(o=W.current)||void 0===o?void 0:o.contains(i.target))||(null==z?void 0:z.contains(i.target))||I()};return document.addEventListener("mousedown",i),function(){return document.removeEventListener("mousedown",i)}}},[T,I,z,W]);var ii=J?[]:[X.tabs.deviation,X.tabs.association];if(1===ii.length&&ii[0].key===X.tabs.deviation.key)return null;if(!T||!L)return null;var oi=null!==(g=null!==(p=V===X.tabs.deviation.key?null===(c=null==G?void 0:G.cognitive_decisioning)||void 0===c?void 0:c.decision_strength:L.relevance_score)&&void 0!==p?p:P)&&void 0!==g?g:0,ei=L.decisioning,ni=Array.isArray(ei)?ei:"string"==typeof ei&&ei.trim()?[ei]:[],ti=L.gap,si=Array.isArray(ti)?ti:"string"==typeof ti&&ti.trim()?[ti]:[],ai=q?q.left-150:-9999,ri=(null!==(u=null==q?void 0:q.arrowLeft)&&void 0!==u?u:60)+150,li=o.jsxs(n.Box,i.__assign({ref:W,sx:{position:"fixed",top:null!==(v=null==q?void 0:q.top)&&void 0!==v?v:-9999,left:ai,zIndex:9999,width:"".concat(1050,"px"),maxWidth:"min(".concat(1050,"px, calc(100vw - ").concat(ai>0?ai:0,"px - ").concat(12,"px))"),bgcolor:"#FFFFFF",borderRadius:"14px",border:"1.5px solid ".concat($.border),boxShadow:"0px 8px 32px ".concat($.shadow,", 0px 0px 0px 3px ").concat($.shadow),overflow:"visible",display:"flex",flexDirection:"column",maxHeight:(null==q?void 0:q.maxHeight)?"min(60vh, ".concat(q.maxHeight,"px)"):"60vh",visibility:q?"visible":"hidden"}},{children:[q&&(q.openAbove?o.jsxs(o.Fragment,{children:[o.jsx(n.Box,{sx:{position:"absolute",bottom:-11,left:ri-x,width:0,height:0,borderLeft:"".concat(x,"px solid transparent"),borderRight:"".concat(x,"px solid transparent"),borderTop:"".concat(11,"px solid ").concat($.border),zIndex:1}}),o.jsx(n.Box,{sx:{position:"absolute",bottom:-9,left:ri-x+1,width:0,height:0,borderLeft:"".concat(9,"px solid transparent"),borderRight:"".concat(9,"px solid transparent"),borderTop:"".concat(x,"px solid #FFFFFF"),zIndex:2}})]}):o.jsxs(o.Fragment,{children:[o.jsx(n.Box,{sx:{position:"absolute",top:-11,left:ri-x,width:0,height:0,borderLeft:"".concat(x,"px solid transparent"),borderRight:"".concat(x,"px solid transparent"),borderBottom:"".concat(11,"px solid ").concat($.border),zIndex:1}}),o.jsx(n.Box,{sx:{position:"absolute",top:-9,left:ri-x+1,width:0,height:0,borderLeft:"".concat(9,"px solid transparent"),borderRight:"".concat(9,"px solid transparent"),borderBottom:"".concat(x,"px solid #FFFFFF"),zIndex:2}})]})),o.jsxs(n.Box,i.__assign({sx:{px:2.5,pt:2,pb:1.5,display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:2,flexShrink:0}},{children:[o.jsxs(n.Box,i.__assign({sx:{flex:1,minWidth:0}},{children:[("no counterpart"!==R||"no counterpart"!==A)&&o.jsxs(n.Typography,i.__assign({sx:{fontSize:"16px",fontWeight:600,color:"#101828",lineHeight:1.3,display:"flex",alignItems:"center",gap:1,flexWrap:"nowrap",overflow:"hidden",width:"100%"}},{children:[o.jsx(n.Box,i.__assign({component:"span",title:R,sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:"0 1 auto",maxWidth:"calc(50% - 16px)",minWidth:0}},{children:R})),o.jsx(n.Box,i.__assign({component:"span",sx:{color:"#667085",fontWeight:400,flexShrink:0,mx:.5}},{children:"↔"})),o.jsx(n.Box,i.__assign({component:"span",title:A||"Reference Section",sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1,minWidth:0}},{children:A||"Reference Section"}))]})),o.jsx(n.Box,i.__assign({sx:{mt:.75,display:"inline-flex",alignItems:"center",gap:.75}},{children:o.jsx(n.Typography,i.__assign({sx:{fontSize:"no counterpart"!==R||"no counterpart"!==A?"13px":"16px",fontWeight:400,color:"#5928ED",lineHeight:1}},{children:null===(h=Object.values(X.tabs).find(function(i){return i.key===V}))||void 0===h?void 0:h.subtitle}))}))]})),o.jsxs(n.Box,i.__assign({sx:{display:"flex",alignItems:"center",gap:1.5,flexShrink:0}},{children:[o.jsxs(n.Box,i.__assign({sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:.5,borderRadius:"20px",bgcolor:"#FFFFFF",border:"1px solid #5928ED",fontSize:"12px",fontWeight:600,color:"#5928ED"}},{children:[o.jsx(a.default,{}),X.decisionStrengthLabel," ",oi,"%"]})),o.jsx(n.IconButton,i.__assign({onClick:I,size:"small",sx:{color:"#667085",width:24,height:24,"&:hover":{bgcolor:"transparent",color:"#101828"}}},{children:o.jsx(t.X,{size:22})}))]}))]})),o.jsx(n.Box,i.__assign({sx:{display:"flex",borderBottom:"1px solid #E4E7EC",px:2.5,flexShrink:0}},{children:ii.map(function(e){var t=V===e.key,s=e.key===X.tabs.deviation.key,a=ii.length>1&&s&&Y,r=o.jsx(n.Box,i.__assign({onClick:function(){a||Z(e.key)},sx:{pb:"10px",pt:"4px",mr:3,px:2,cursor:a?"not-allowed":"pointer",opacity:a?.5:1,fontSize:"14px",fontWeight:t?600:400,color:t?X.accentColor:"#667085",backgroundColor:t?"".concat(X.accentColor,"14"):"transparent",borderBottom:t?"2px solid ".concat(X.accentColor):"2px solid transparent",transition:"all 0.15s",userSelect:"none"}},{children:e.label}),e.key);return a?o.jsx(n.Tooltip,i.__assign({title:"Fetching deviation data",arrow:!0,placement:"top"},{children:o.jsx("span",{children:r})}),e.key):r})})),o.jsx(n.Box,i.__assign({sx:{flex:1,minHeight:0,overflowY:"auto",px:2.5,py:2,display:"flex",flexDirection:"column",gap:1.5,"&::-webkit-scrollbar":{width:"6px"},"&::-webkit-scrollbar-track":{background:"transparent"},"&::-webkit-scrollbar-thumb":{background:"".concat($.border,"55"),borderRadius:"10px"},"&::-webkit-scrollbar-thumb:hover":{background:$.border},scrollbarWidth:"thin",scrollbarColor:"".concat($.border,"55 transparent")}},{children:V===X.tabs.deviation.key?G?o.jsxs(o.Fragment,{children:[(null===(f=(null===(b=null==G?void 0:G.cognitive_decisioning)||void 0===b?void 0:b.decisioning_factors)||[])||void 0===f?void 0:f.length)>0&&o.jsx(l.default,{title:"Decision Making Factors",content:null===(m=null===(_=null==G?void 0:G.cognitive_decisioning)||void 0===_?void 0:_.decisioning_factors)||void 0===m?void 0:m.join("\n\n"),citations:null===(y=null==G?void 0:G.cognitive_decisioning)||void 0===y?void 0:y.citations,styles:K,docData:H,open:T}),(null===(j=(null===(F=null==G?void 0:G.cognitive_decisioning)||void 0===F?void 0:F.gaps_in_decision)||[])||void 0===j?void 0:j.length)>0&&o.jsx(l.default,{title:"Gaps in Decision",content:null===(k=null===(w=null==G?void 0:G.cognitive_decisioning)||void 0===w?void 0:w.gaps_in_decision)||void 0===k?void 0:k.join("\n\n"),citations:null===(B=null==G?void 0:G.cognitive_decisioning)||void 0===B?void 0:B.citations,styles:K,docData:H,open:T}),0===(null===(C=(null===(S=null==G?void 0:G.cognitive_decisioning)||void 0===S?void 0:S.decisioning_factors)||[])||void 0===C?void 0:C.length)&&0===(null===(E=(null===(D=null==G?void 0:G.cognitive_decisioning)||void 0===D?void 0:D.gaps_in_decision)||[])||void 0===E?void 0:E.length)&&o.jsx(n.Box,i.__assign({sx:{p:2,bgcolor:"#F8FAFC",borderRadius:"8px",border:"1px solid #E2E8F0"}},{children:o.jsx(n.Typography,i.__assign({sx:{fontSize:"13px",color:"#64748B"}},{children:"No cognitive decisioning data available for this section."}))}))]}):o.jsx(l.default,{title:"Deviation Analysis",content:"Deviation analysis content will appear here. This tab shows\n structural and semantic deviations identified between the two\n sections being compared.",citations:{},styles:K,docData:H,open:T}):o.jsxs(o.Fragment,{children:[ni.length>0&&o.jsx(l.default,{title:X.sectionTitles.decisioningFactors,content:ni.join("\n\n"),citations:L.citations,styles:K,open:T,docData:H}),si.length>0&&o.jsx(l.default,{title:X.sectionTitles.gaps,content:si.join("\n\n"),citations:L.citations,styles:K,open:T,docData:H}),0===ni.length&&0===si.length&&o.jsx(n.Box,i.__assign({sx:{p:2,bgcolor:"#F8FAFC",borderRadius:"8px",border:"1px solid #E2E8F0"}},{children:o.jsx(n.Typography,i.__assign({sx:{fontSize:"13px",color:"#64748B"}},{children:X.emptyStateMessage}))}))]})}))]}));return d.default.createPortal(li,document.body)};
|
|
2
2
|
//# sourceMappingURL=CognitivePopup.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),i=require("react/jsx-runtime"),n=require("react"),o=require("@mui/material"),t=require("lucide-react"),l=require("../hooks/memoizedMarkdown.js"),d=require("../CognitiveComparehelpers.js"),r=require("../CognitiveCompareConstants.js");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=a(n);exports.default=function(a){var u,c,v,f,p,x,g,h,m,_,I,y,b,w=a.section,A=a.idx,R=a.columnKey,S=a.colRef,j=a.mb,C=void 0===j?1:j,F=a.parentNodeId,B=void 0===F?"":F,E=a.isExpanded,O=a.onToggle,k=a.navigation,D=a.showOpenNodeRef,T=a.resolvedMarkdownStyles,M=a.maintainRelativeOrder,P=a.showDeviationBadges,N=void 0!==P&&P,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,J=a.connectedSections,Q=a.openMoreFunctionsPopup;a.deviationNodeIdToView,a.deviationTargetParentId;var Z=a.isProposingFix,$=a.proposingFixNodeId,ee=a.collisionKey,ie=(null===(u=w.displayTitle)||void 0===u||u)&&d.hasValue(w.title),ne=w.change_history,oe=!!Z&&!!$&&"left"===R&&w.id===$&&d.hasValue(ne),te=oe?ne||"":w.content,le=oe?w.content:void 0,de=(null===(c=w.displayContent)||void 0===c||c)&&d.hasValue(te),re=!ie&&!de,ae={current:1},se=w.title;ie||(se=de?"No Title Found":"No Matching Section Found");var ue=w.evaluationResult;if(!ue&&"right"===R)if(M){var ce=null===(v=w.refIndexes)||void 0===v?void 0:v[0],ve=G.find(function(e){return e.selfIndex===ce});ue=null==ve?void 0:ve.evaluationResult}else ue=null===(f=G[A])||void 0===f?void 0:f.evaluationResult;var fe=null===(p=null==W?void 0:W.input_index_map)||void 0===p?void 0:p[0],pe=null===(x=null==W?void 0:W.input_index_map)||void 0===x?void 0:x[1],xe="left"===R?pe:fe,ge=function(e,i){return e.find(function(e){return(null==e?void 0:e.id)&&i&&e.id===i})},he="left"===R?w:G[A],me="right"===R?w:K[A];if(M)if("left"===R){var _e=null===(g=w.refIndexes)||void 0===g?void 0:g[0],Ie=K.findIndex(function(e){return e.selfIndex===_e});me=-1!==Ie?K[Ie]:ge(K,w.id)}else{var ye=null===(h=w.refIndexes)||void 0===h?void 0:h[0],be=G.findIndex(function(e){return e.selfIndex===ye});he=-1!==be?G[be]:ge(G,w.id)}var we="left"===R?!me:!he,Ae=ue||(null==he?void 0:he.evaluationResult)||(null==me?void 0:me.evaluationResult),Re=null!==(I=null===(_=null===(m=null==Ae?void 0:Ae.evaluation_outputs)||void 0===m?void 0:m.metadata)||void 0===_?void 0:_.label_color)&&void 0!==I?I:r.DEFAULT_DEVIAION_COLOR,Se=d.generateColorPalette(Re).highlightBg,je=(null==Ae?void 0:Ae.deviations)||{},Ce=A+1,Fe=w.id;if(M){var Be=1,Ee=new Map;if(G.forEach(function(e){e.id&&Ee.set(e.id,Be++)}),"left"===R)Ce=Ee.get(w.id)||A+1;else{var Oe=G.filter(function(e){var i;return null===(i=e.refIndexes)||void 0===i?void 0:i.includes(w.selfIndex)});if(Oe.length>0)Ce=Ee.get(Oe[0].id)||A+1,Fe=Oe[0].id;else for(var ke=Be,De=function(e){var i=G.some(function(i){var n;return null===(n=i.refIndexes)||void 0===n?void 0:n.includes(e.selfIndex)});if(!i){if(e.id===w.id)return Ce=ke,"break";ke++}},Te=0,Me=K;Te<Me.length;Te++){if("break"===De(Me[Te]))break}}}var Pe,Ne=[],Ve=Object.entries(je).map(function(i){var n,o,t,l,r,a,s=i[0],u=i[1],c="".concat(Fe).concat(d.DEVIATION_BADGE_SEPARATOR).concat(s),v=U[c];if(null==v)return null;var f=u[B],p=d.isMissingStr(f);if(p)f="";else if(!f)return null;Ne.push(f);var x=A,g=A;if(M)if("left"===R){var h=null===(n=w.refIndexes)||void 0===n?void 0:n[0],m=K.findIndex(function(e){return e.selfIndex===h});if(-1!==m)g=m;else{var _=K.findIndex(function(e){return e.id===w.id});g=-1!==_?_:A}}else{var I=null===(o=w.refIndexes)||void 0===o?void 0:o[0],y=G.findIndex(function(e){return e.selfIndex===I});if(-1!==y)x=y;else{var b=G.findIndex(function(e){return e.id===w.id});x=-1!==b?b:A}}var S="".concat(Fe).concat(d.DEVIATION_BADGE_SEPARATOR).concat(s).concat(d.DEVIATION_BADGE_SEPARATOR).concat(x).concat(d.DEVIATION_BADGE_SEPARATOR).concat(g),j=u[xe],C=we||d.isMissingStr(j),F="".concat(Ce,".").concat(v),E=A;if("right"===R&&M){var O=null===(t=w.refIndexes)||void 0===t?void 0:t[0],k=G.findIndex(function(e){return e.selfIndex===O});if(-1!==k)E=k;else{b=G.findIndex(function(e){return e.id===w.id});-1!==b&&(E=b)}}var D=H?H(E):null,T=(null==u?void 0:u.evaluation_outputs)||(null==Ae?void 0:Ae.evaluation_outputs),P=null!==(l=null==T?void 0:T.output_value)&&void 0!==l?l:null,N=null!==(a=null===(r=null==T?void 0:T.metadata)||void 0===r?void 0:r.label_color)&&void 0!==a?a:Re,V=d.generateColorPalette(N),W=D?e.__assign(e.__assign({},D),{badgeBg:V.badgeBg,badgeBorder:V.badgeBorder,badgeText:V.badgeText}):e.__assign({},V),q=(null==u?void 0:u.deviation_summary)?{deviation_summary:u.deviation_summary,deviation_title:(null==u?void 0:u.deviation_title)||(null==Ae?void 0:Ae.deviation_title),deviation_impact:(null==u?void 0:u.deviation_impact)||(null==Ae?void 0:Ae.deviation_impact),deviation_explanation:(null==u?void 0:u.deviation_explanation)||(null==Ae?void 0:Ae.deviation_explanation),evaluation_outputs:T,cognitive_decisioning:(null==u?void 0:u.cognitive_decisioning)||(null==Ae?void 0:Ae.cognitive_decisioning)}:null,z=0,L=te||"";if(f&&L){var Z=L.split(/\n{2,}/),$=Z.findIndex(function(e){return e.includes(f)});if(-1!==$){var ee=Object.entries(je).filter(function(e){e[0];var i=e[1][B];return i&&Z[$].includes(i)}).sort(function(e,i){return Z[$].indexOf(e[1][B])-Z[$].indexOf(i[1][B])});z=Math.max(0,ee.findIndex(function(e){return e[0]===s}))}}return{id:c,actionId:S,label:F,highlight:f,side:R,style:W,stackIndex:z,score:P,isConnected:null==J?void 0:J.has(S),isOrphan:C,isMissingClause:p,badgeRef:X(R,c),onClick:function(e){e.stopPropagation(),Q&&Q(e,he||{id:"orphan-left",title:"",content:""},C,me||{id:"orphan-right",title:"",content:""},S,W)},onSummaryClick:function(e){e.stopPropagation(),Y(e,S,C,q)}}}).filter(Boolean),We=N?Ve:[],qe=w.id&&R===(null==k?void 0:k.columnKey)?k:null,Ge=s.default.useRef(!1);return n.useEffect(function(){E||(Ge.current=!1)},[E]),i.jsxs(o.Box,e.__assign({ref:S,sx:{mb:C,width:"100%",display:"flex",flexDirection:"column",position:"relative",minWidth:0}},{children:[E&&(null==qe?void 0:qe.showAbove)&&i.jsx("div",e.__assign({style:{position:"sticky",top:0,height:"0px",cursor:"pointer"},onClick:function(){var e,i;return null===(i=null===(e=null==qe?void 0:qe.showAboveRef)||void 0===e?void 0:e.current)||void 0===i?void 0:i.scrollIntoView({behavior:"smooth",block:"center"})}},{children:i.jsx("div",e.__assign({style:e.__assign({transform:"translateY(-50%) translateX(calc(100% ".concat("left"===R?"+":"-"," 130px))"),position:"absolute",paddingTop:"20px"},"left"===R?{right:"0px"}:{left:"0px"})},{children:i.jsx(t.ChevronUp,{color:(null===(y=null==qe?void 0:qe.showAboveRef)||void 0===y?void 0:y.current)?window.getComputedStyle(qe.showAboveRef.current).color:void 0})}))})),i.jsxs(o.Accordion,e.__assign({disableGutters:!0,expanded:!re&&E,onChange:function(){re||(O(),D.current=w.id)},sx:{boxShadow:"none",border:re?"1px dashed #E2E8F0":"1px solid #E2E8F0",bgcolor:re?"#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:[i.jsx(o.AccordionSummary,e.__assign({expandIcon:re?null:i.jsx(t.ChevronDown,{size:16}),sx:{minHeight:"36px",flexShrink:0,cursor:re?"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:ie&&i.jsx(o.Tooltip,e.__assign({title:se,placement:"top"},{children:i.jsx(o.Typography,e.__assign({component:"div",sx:{fontSize:"12px",color:re?"#94A3B8":"#19213D",fontWeight:re?400:700,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0}},{children:(Pe=se,Pe?d.safeStringify(Pe).replace(/\\n/g,"\n").split(/(\*\*.*?\*\*)/g).map(function(e,n){return e.startsWith("**")&&e.endsWith("**")?i.jsx("strong",{children:e.slice(2,-2)},n):i.jsx(s.default.Fragment,{children:e},n)}):null)}))}))})),!re&&i.jsxs(o.AccordionDetails,e.__assign({sx:{pt:0,pb:1.25,bgcolor:"#FFFFFF",flex:1,display:"flex",flexDirection:"column",minWidth:0}},{children:[de&&i.jsx(l.MemoizedMarkdown,{content:te,overlayContent:le,sxStyles:T,highlights:Ne,maintainRelativeOrder:M,highlightBg:Se,deviationBadges:We,collisionKey:ee}),(w.subsections||[]).map(function(e,i){return V({section:e,keyPath:"".concat(A,"-").concat(i),depth:0,columnKey:R,parentNodeId:B,devCounter:ae})})]}))]})),E&&(null==qe?void 0:qe.showBelow)&&i.jsx("div",e.__assign({style:{position:"sticky",bottom:0,height:"0px",cursor:"pointer"},onClick:function(){var e,i;return null===(i=null===(e=null==qe?void 0:qe.showBelowRef)||void 0===e?void 0:e.current)||void 0===i?void 0:i.scrollIntoView({behavior:"smooth",block:"center"})}},{children:i.jsx("div",e.__assign({style:e.__assign({transform:"translateY(-50%) translateX(calc(100% ".concat("left"===R?"+":"-"," 130px))"),position:"absolute",paddingBottom:"20px"},"left"===R?{right:"0px"}:{left:"0px"})},{children:i.jsx(t.ChevronDown,{color:(null===(b=null==qe?void 0:qe.showBelowRef)||void 0===b?void 0:b.current)?window.getComputedStyle(qe.showBelowRef.current).color:void 0})}))}))]}),"".concat(R,"-sec-").concat(A))};
|
|
2
2
|
//# sourceMappingURL=SectionAccordion.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var i=require("tslib"),n=require("react/jsx-runtime"),e=require("react"),t=require("@mui/material"),o=require("lucide-react"),l=require("../hooks/memoizedMarkdown.js"),a=require("../CognitiveComparehelpers.js"),s=require("../CognitiveCompareConstants.js");function d(i){return i&&"object"==typeof i&&"default"in i?i:{default:i}}var r=d(e).default.memo(function(d){var u,c,v,f,h,p,
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var i=require("tslib"),n=require("react/jsx-runtime"),e=require("react"),t=require("@mui/material"),o=require("lucide-react"),l=require("../hooks/memoizedMarkdown.js"),a=require("../CognitiveComparehelpers.js"),s=require("../CognitiveCompareConstants.js");function d(i){return i&&"object"==typeof i&&"default"in i?i:{default:i}}var r=d(e).default.memo(function(d){var u,c,v,f,h,g,p,_,x,m,b=d.section,y=d.keyPath,S=d.depth,I=void 0===S?0:S,E=d.columnKey,A=void 0===E?"left":E,R=d.parentNodeId,j=void 0===R?"":R,O=d.expandedSubSections,P=d.setExpandedSubSections,k=d.maintainRelativeOrder,B=d.showDeviationBadges,C=void 0!==B&&B,w=d.proposedSections,F=d.existingSections,D=d.treeData,M=d.deviationNumberRegistry,T=d.connectedSections,N=d.activeSideBySideSection,V=d.resolvedMarkdownStyles,q=d.getSubSectionRef,W=d.getSubSectionCompareStyle,z=d.getBadgeRef,G=d.openMoreFunctionsPopup,K=d.openSummaryPopup,L=d.resetSideBySide,U=d.setConnectedSections,H=d.setConnectedLines,J=d.cachedConnectedPositions,Q=d.isProposingFix,X=d.proposingFixNodeId,Y=null!=N?N:"",Z=(null===(u=b.displayTitle)||void 0===u||u)&&a.hasValue(b.title),$=b.change_history,ii=!!Q&&!!X&&"left"===A&&b.id===X&&a.hasValue($),ni=ii?$||"":b.content,ei=ii?b.content:void 0,ti=(null===(c=b.displayContent)||void 0===c||c)&&a.hasValue(ni),oi=!Z&&!ti,li=Z?b.title:ti?"No Title Found":"No Matching Section Found",ai=!!O[y],si=q(A,y),di=y.split("-").map(Number),ri=di[0],ui=w[ri],ci=F[ri],vi=y,fi=y,hi=ri,gi=ri,pi=function(i,n,e){if(!i||!n)return null;if(i.id===n)return{section:i,keyPath:e};for(var t=(i.subsections||[]).map(function(i,n){return{section:i,keyPath:"".concat(e,"-").concat(n)}}),o=function(){var i=t.shift();return(null==i?void 0:i.section)?i.section.id===n?{value:i}:void(i.section.subsections||[]).forEach(function(n,e){t.push({section:n,keyPath:"".concat(i.keyPath,"-").concat(e)})}):"continue"};t.length>0;){var l=o();if("object"==typeof l)return l.value}return null};if(k)if("left"===A){var _i=null===(v=null==ui?void 0:ui.refIndexes)||void 0===v?void 0:v[0],xi=F.findIndex(function(i){return i.selfIndex===_i});-1!==xi&&(ci=F[xi],gi=xi)}else{var mi=null===(f=null==ci?void 0:ci.refIndexes)||void 0===f?void 0:f[0],bi=w.findIndex(function(i){return i.selfIndex===mi});-1!==bi&&(ui=w[bi],hi=bi)}var yi=ui,Si=ci;if(k)if("left"===A){yi=b,vi=y;var Ii=pi(ci,b.id,String(gi));Si=(null==Ii?void 0:Ii.section)||null,fi=(null==Ii?void 0:Ii.keyPath)||""}else{Si=b,fi=y;var Ei=pi(ui,b.id,String(hi));yi=(null==Ei?void 0:Ei.section)||null,vi=(null==Ei?void 0:Ei.keyPath)||""}else for(var Ai=1;Ai<di.length;Ai++)(null==yi?void 0:yi.subsections)&&(yi=yi.subsections[di[Ai]]),(null==Si?void 0:Si.subsections)&&(Si=Si.subsections[di[Ai]]);var Ri=(vi?W(vi):null)||W(y),ji=null===(h=null==D?void 0:D.input_index_map)||void 0===h?void 0:h[0],Oi=null===(g=null==D?void 0:D.input_index_map)||void 0===g?void 0:g[1],Pi="left"===A?Oi:ji,ki="left"===A?!Si:!yi,Bi=b.evaluationResult||(null==yi?void 0:yi.evaluationResult)||(null==Si?void 0:Si.evaluationResult),Ci=ri+1,wi=b.id||(null==yi?void 0:yi.id)||(null==Si?void 0:Si.id);if(k){var Fi=1,Di=new Map;if(w.forEach(function(i){i.id&&Di.set(i.id,Fi++)}),"left"===A)Ci=Di.get(null==ui?void 0:ui.id)||ri+1;else{var Mi=w.filter(function(i){var n;return null===(n=i.refIndexes)||void 0===n?void 0:n.includes(null==ci?void 0:ci.selfIndex)});if(Mi.length>0)Ci=Di.get(Mi[0].id)||ri+1;else for(var Ti=Fi,Ni=function(i){var n=w.some(function(n){var e;return null===(e=n.refIndexes)||void 0===e?void 0:e.includes(i.selfIndex)});if(!n){if(i.id===(null==ci?void 0:ci.id))return Ci=Ti,"break";Ti++}},Vi=0,qi=F;Vi<qi.length;Vi++){if("break"===Ni(qi[Vi]))break}}}var Wi=null!==(x=null===(_=null===(p=null==Bi?void 0:Bi.evaluation_outputs)||void 0===p?void 0:p.metadata)||void 0===_?void 0:_.label_color)&&void 0!==x?x:s.DEFAULT_DEVIAION_COLOR,zi=a.generateColorPalette(Wi).highlightBg,Gi=(null==Bi?void 0:Bi.deviations)||{},Ki=[],Li=Object.entries(Gi).map(function(n){var e,t,o,l=n[0],s=n[1],d="".concat(wi).concat(a.DEVIATION_BADGE_SEPARATOR).concat(l),r=M[d];if(null==r)return null;var u=s[j],c=a.isMissingStr(u);if(c)u="";else if(!u)return null;Ki.push(u);var v=s[Pi],f=ki||a.isMissingStr(v),h="".concat(Ci,".").concat(r),g="".concat(wi).concat(a.DEVIATION_BADGE_SEPARATOR).concat(l).concat(a.DEVIATION_BADGE_SEPARATOR).concat(vi).concat(a.DEVIATION_BADGE_SEPARATOR).concat(fi),p=(null==s?void 0:s.evaluation_outputs)||(null==Bi?void 0:Bi.evaluation_outputs),_=null!==(e=null==p?void 0:p.output_value)&&void 0!==e?e:null,x=null!==(o=null===(t=null==p?void 0:p.metadata)||void 0===t?void 0:t.label_color)&&void 0!==o?o:Wi,m=a.generateColorPalette(x),b=i.__assign({},m),y=(null==s?void 0:s.deviation_summary)?{deviation_summary:s.deviation_summary||(null==Bi?void 0:Bi.deviation_summary),deviation_title:(null==s?void 0:s.deviation_title)||(null==Bi?void 0:Bi.deviation_title),deviation_impact:(null==s?void 0:s.deviation_impact)||(null==Bi?void 0:Bi.deviation_impact),deviation_explanation:(null==s?void 0:s.deviation_explanation)||(null==Bi?void 0:Bi.deviation_explanation),evaluation_outputs:p,cognitive_decisioning:(null==s?void 0:s.cognitive_decisioning)||(null==Bi?void 0:Bi.cognitive_decisioning)}:null,S=0,I=ni||"";if(u&&I){var E=I.split(/\n{2,}/),R=E.findIndex(function(i){return i.includes(u)});if(-1!==R){var O=Object.entries(Gi).filter(function(i){i[0];var n=i[1][j];return n&&E[R].includes(n)}).sort(function(i,n){return E[R].indexOf(i[1][j])-E[R].indexOf(n[1][j])});S=Math.max(0,O.findIndex(function(i){return i[0]===l}))}}return{id:d,actionId:g,label:h,highlight:u,side:A,style:b,stackIndex:S,score:_,isConnected:T.has(g),isOrphan:f,isMissingClause:c,badgeRef:z(A,d),onClick:function(n){n.stopPropagation();var e=yi?i.__assign(i.__assign({},yi),{title:(null==ui?void 0:ui.title)||(null==yi?void 0:yi.title)||""}):{id:"orphan-left",title:"",content:""},t=Si?i.__assign(i.__assign({},Si),{title:(null==ci?void 0:ci.title)||(null==Si?void 0:Si.title)||""}):{id:"orphan-right",title:"",content:""};G(n,e,f,t,g,b)},onSummaryClick:function(i){i.stopPropagation(),K(i,g,f,y)}}}).filter(Boolean).sort(function(i,n){return parseFloat(i.label)-parseFloat(n.label)}),Ui=C?Li:[],Hi=e.useRef(!1);e.useEffect(function(){ai||(Hi.current=!1)},[ai]),e.useEffect(function(){if(ai&&!Hi.current){var i=setTimeout(function(){var i,n;Hi.current=!0;var e=null===(n=null===(i=Li[0])||void 0===i?void 0:i.badgeRef)||void 0===n?void 0:n.current;e&&e.scrollIntoView({behavior:"smooth",block:"center"})},350);return function(){return clearTimeout(i)}}},[ai,Li]);var Ji=Li.find(function(i){return T.has(i.actionId)}),Qi=!!Ji;if(!(Z||ti||b.subsections&&0!==b.subsections.length))return null;var Xi=(null===(m=null==Ji?void 0:Ji.style)||void 0===m?void 0:m.badgeBorder)||(null==Ri?void 0:Ri.badgeBorder),Yi=Qi&&Xi?{borderRadius:"4px",outline:"2px solid ".concat(Xi),outlineOffset:"1px"}:{};return Z?n.jsx(t.Box,i.__assign({ref:si,sx:{mt:1,width:"100%",minWidth:0,position:"relative"}},{children:n.jsx(t.Box,i.__assign({sx:i.__assign({width:"100%"},Yi)},{children:n.jsxs(t.Accordion,i.__assign({disableGutters:!0,expanded:!oi&&ai,onChange:function(){if(!oi){if(ai){var n=String(N||""),e=n.includes(vi)||n.includes(fi);e||T.forEach(function(i){(String(i).includes(vi)||String(i).includes(fi))&&(e=!0)}),e&&(L(),U(new Set),H([]),J.current=[])}P(function(n){var e;return i.__assign(i.__assign({},n),((e={})[y]=!n[y],e))})}},sx:{mt:0,boxShadow:"none",border:oi?"1px dashed #E2E8F0":"1px solid #EEF2F7",borderRadius:"4px !important",bgcolor:"#FFFFFF",minWidth:0,"&:before":{display:"none"}}},{children:[n.jsx(t.AccordionSummary,i.__assign({expandIcon:oi?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,i.__assign({component:"div",sx:{fontSize:"11px",fontWeight:600,color:oi?"#94A3B8":"#19213D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0}},{children:li||"Untitled Subsection"}))})),!oi&&n.jsxs(t.AccordionDetails,i.__assign({sx:{pt:0,pb:1,minWidth:0}},{children:[ti&&n.jsx(l.MemoizedMarkdown,{content:ni,overlayContent:ei,sxStyles:V,deviationBadges:Ui,maintainRelativeOrder:k,highlightBg:zi,highlights:Ki,collisionKey:Y}),(b.subsections||[]).map(function(e,t){return n.jsx(r,i.__assign({},d,{section:e,keyPath:"".concat(y,"-").concat(t),depth:I+1}),"".concat(y,"-").concat(t))})]}))]}))}))})):n.jsx(t.Box,i.__assign({ref:si,sx:{mt:0===I?1:.75,width:"100%",minWidth:0,position:"relative"}},{children:!oi&&n.jsxs(t.Box,i.__assign({sx:i.__assign({width:"100%"},Yi)},{children:[ti&&n.jsx(l.MemoizedMarkdown,{content:ni,overlayContent:ei,sxStyles:V,deviationBadges:Ui,maintainRelativeOrder:k,highlightBg:zi,highlights:Ki,collisionKey:Y}),(b.subsections||[]).map(function(e,t){return n.jsx(r,i.__assign({},d,{section:e,keyPath:"".concat(y,"-").concat(t),depth:I+1}),"".concat(y,"-").concat(t))})]}))}))});exports.default=r;
|
|
2
2
|
//# sourceMappingURL=SubSectionAccordion.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as n,__spreadArray as e}from"tslib";import{jsxs as t,jsx as i}from"react/jsx-runtime";import{useState as o,useRef as r,useMemo as l,useEffect as u,useCallback as c}from"react";import{Box as a,Snackbar as d,Alert as s,Tooltip as v,Typography as p}from"@mui/material";import{ChevronDown as f,EllipsisVertical as g}from"lucide-react";import{ButtonCognitiveIcon as h}from"../../assests/svg/ButtonCognitiveIcon.js";import m from"./OverlayComponent.js";import{safeStringify as x,extractDeviationScore as y,generateColorPalette as b,DEVIATION_BADGE_SEPARATOR as S,findKeyPathByNodeId as R,getFirstDeviationOutputValue as C,getFirstDeviationColor as I,hasValue as B,getBentArrowPath as w,smoothScrollTo as T,resetClauseHighlight as _,scrollAndHighlightClause as E}from"./CognitiveComparehelpers.js";import{SHARED_MARKDOWN_STYLES as F,DEFAULT_FIELD_CONFIG as D,DEFAULT_COMPARISON_CONFIG as A}from"./CognitiveCompareConfig.js";export{SHARED_MARKDOWN_STYLES}from"./CognitiveCompareConfig.js";import{EMPTY_SUMMARY_POPUP_STATE as M,DEFAULT_DEVIAION_COLOR as N,DEFAULT_COMPONENT_HEADER_TEXT as k}from"./CognitiveCompareConstants.js";import P from"./CognitivePopup.js";import j from"./MoreFunctionsPopup.js";import H from"./LoaderComponent.js";import L from"./components/ThreeDotsLoader.js";import{useCognitiveTreeData as O}from"./hooks/useCompareData.js";import{useComparePopups as z}from"./hooks/useComparePopups.js";import{useSectionRefs as W}from"./hooks/useSectionRefs.js";import{useAccordionState as q}from"./hooks/useAccordionState.js";import{useDeviationNavigation as Y}from"./hooks/useDeviationNavigation.js";import K from"./components/CompareHeader.js";import V from"./components/SectionAccordion.js";import X from"./components/SubSectionAccordion.js";import $ from"./components/CognitiveSummaryPopup.js";import J from"./components/connectedLines.js";var U=function(U){var G,Q,Z,nn,en,tn,on,rn,ln,un,cn,an,dn,sn,vn,pn,fn,gn,hn,mn,xn,yn,bn,Sn,Rn,Cn,In=U.componentHeaderText,Bn=void 0===In?k:In,wn=U.treeData,Tn=U.comparisonConfig,_n=U.leftColumnTitleText,En=U.rightColumnTitleText,Fn=U.markdownStyles,Dn=U.resetTrigger,An=U.displayConfig,Mn=void 0===An?{isHeaderVisible:!0,isToggleVisible:!0,maintainRelativeOrder:!1,isLoading:!0,showDeviationBadges:!1,enableDeviationSchemaBackwardCompatibility:!1}:An,Nn=U.popupConfig,kn=U.deviationData,Pn=void 0===kn?{}:kn,jn=U.deviationNodeIdToView,Hn=U.resetDeviationNodeId,Ln=U.isProposingFix,On=void 0!==Ln&&Ln,zn=U.proposingFixNodeId,Wn=o(Mn.maintainRelativeOrder),qn=Wn[0],Yn=Wn[1],Kn=!!qn||!!(null==Mn?void 0:Mn.showDeviationBadges),Vn=o(!1),Xn=Vn[0],$n=Vn[1],Jn=o(!1),Un=Jn[0],Gn=Jn[1],Qn=o(null),Zn=Qn[0],ne=Qn[1],ee=o(!1),te=ee[0],ie=ee[1],oe=o(null===(Q=null!==(G=null==wn?void 0:wn.newEvaluationResult)&&void 0!==G?G:null==Mn?void 0:Mn.enableDeviationSchemaBackwardCompatibility)||void 0===Q||Q)[0],re=o(!1),le=re[0],ue=re[1],ce=o(!1),ae=ce[0],de=ce[1],se=o(null),ve=se[0],pe=se[1],fe=r(!1),ge=o(new Set),he=ge[0],me=ge[1],xe=o([]),ye=xe[0],be=xe[1],Se=r(null),Re=r(null),Ce=r(null),Ie=r(new Set),Be=r(!1),we=r(null),Te=r({}),_e=r([]),Ee=r(!1),Fe=r(!1),De=r(null),Ae=r(function(){}),Me=l(function(){return(null==wn?void 0:wn.cognitive_decisioning)||{}},[wn]),Ne=o({width:0,height:0}),ke=Ne[0],Pe=Ne[1],je=l(function(){return n(n({},F),Fn)},[Fn]),He=r(null),Le=r(null),Oe=r(null),ze=r(null),We=r(null),qe=r(null),Ye=r(null),Ke=r(null),Ve=r(!1),Xe=r(null),$e=r(null),Je=z(He),Ue=Je.cognitivePopup,Ge=Je.setCognitivePopup,Qe=Je.moreFunctions,Ze=Je.setMoreFunctions,nt=Je.position,et=Je.setPosition,tt=Je.activeBadgeId,it=Je.summaryPopup,ot=Je.setSummaryPopup,rt=Je.closeSummaryPopup,lt=Je.setActiveBadgeId,ut=Je.popupRef,ct=Je.closeCognitivePopup,at=Je.closeMoreFunctionsPopup,dt=l(function(){var n,e,t,i,o,r,l;return{fields:null!==(n=null==Tn?void 0:Tn.fields)&&void 0!==n?n:D,thresholds:{high:null!==(t=null===(e=null==Tn?void 0:Tn.thresholds)||void 0===e?void 0:e.high)&&void 0!==t?t:A.thresholds.high,medium:null!==(o=null===(i=null==Tn?void 0:Tn.thresholds)||void 0===i?void 0:i.medium)&&void 0!==o?o:A.thresholds.medium,exact:null!==(l=null===(r=null==Tn?void 0:Tn.thresholds)||void 0===r?void 0:r.exact)&&void 0!==l?l:A.thresholds.exact}}},[Tn]),st=o(null),vt=st[0];st[1];var pt=null===(en=null===(Z=null==wn?void 0:wn.documents)||void 0===Z?void 0:Z[null===(nn=null==wn?void 0:wn.input_index_map)||void 0===nn?void 0:nn[0]])||void 0===en?void 0:en.title,ft=null===(rn=null===(tn=null==wn?void 0:wn.documents)||void 0===tn?void 0:tn[null===(on=null==wn?void 0:wn.input_index_map)||void 0===on?void 0:on[1]])||void 0===rn?void 0:rn.title,gt=x(_n||pt||"Uploaded Contract"),ht=x(En||ft||"Reference Template"),mt=O(wn,qn,Pn,dt,oe),xt=mt.activeProposed,yt=mt.existingRule,bt=mt.proposedSections,St=mt.existingSections,Rt=mt.visibleFields,Ct=mt.parentDeviationRecord,It=mt.deviationNumberRegistry,Bt=mt.parseError;u(function(){Bt&&ne("Failed to load comparison: ".concat(Bt))},[Bt]);var wt=bt.length>0||St.length>0,Tt=W(Rt.map(function(n){return n.key}),Math.max(bt.length,St.length)),_t=Tt.leftRefs,Et=Tt.rightRefs,Ft=Tt.sectionLeftRefs,Dt=Tt.sectionRightRefs,At=Tt.lhsBadgeRefs,Mt=Tt.rhsBadgeRefs,Nt=Tt.sectionRightRowRefs,kt=Tt.subSectionLeftRefs,Pt=Tt.subSectionRightRefs,jt=Tt.sectionRowRefs,Ht=Tt.getSectionRowRef,Lt=Tt.getSubSectionRef,Ot=Tt.getBadgeRef,zt=yt.analysis,Wt=x(null===(un=null===(ln=null==zt?void 0:zt.rule_difference_comparison)||void 0===ln?void 0:ln.summary)||void 0===un?void 0:un.overall_summary),qt=!!Wt.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),Yt=null!==(cn=null==wn?void 0:wn.base_root_id)&&void 0!==cn?cn:"-1";null==wn||wn[Yt];var Kt=oe?null!==(bn=null!==(mn=Pn&&(null===(hn=null==Pn?void 0:Pn[Yt])||void 0===hn?void 0:hn.evaluation_result))&&void 0!==mn?mn:null===(yn=null===(xn=null==wn?void 0:wn.nodes)||void 0===xn?void 0:xn[Yt])||void 0===yn?void 0:yn.evaluation_result)&&void 0!==bn?bn:null:null!==(gn=null!==(sn=Pn&&(null===(dn=null===(an=null==Pn?void 0:Pn[Yt])||void 0===an?void 0:an.evaluation_result)||void 0===dn?void 0:dn[0]))&&void 0!==sn?sn:null===(fn=null===(pn=null===(vn=null==wn?void 0:wn.nodes)||void 0===vn?void 0:vn[Yt])||void 0===pn?void 0:pn.evaluation_result)||void 0===fn?void 0:fn[0])&&void 0!==gn?gn:null,Vt=y(Kt),Xt=b(null!==(Cn=null===(Rn=null===(Sn=null==Kt?void 0:Kt.evaluation_outputs)||void 0===Sn?void 0:Sn.metadata)||void 0===Rn?void 0:Rn.label_color)&&void 0!==Cn?Cn:""),$t=function(){Ie.current.forEach(function(n){_(n)}),Ie.current.clear()},Jt=c(function(){var n,e,t,i,o,r;$t(),ie(!1),Fe.current=!1,Re.current=null;var l=De.current,u=fi.current;if(null!==l)if("string"==typeof l&&l.includes(S)){var c=l.split(S);(a=(null===(n=kt.current[c[2]])||void 0===n?void 0:n.current)||(null===(e=Ft.current[Number(c[2])])||void 0===e?void 0:e.current))&&(a.style.paddingTop="0px")}else{var a;(a=null===(t=Ft.current[l])||void 0===t?void 0:t.current)&&(a.style.paddingTop="0px")}if(null!==u)if("string"==typeof u&&u.includes(S)){c=u.split(S);(d=(null===(i=Pt.current[c[3]])||void 0===i?void 0:i.current)||(null===(o=Dt.current[Number(c[3])])||void 0===o?void 0:o.current))&&(d.style.paddingTop="0px")}else{var d;(d=null===(r=Dt.current[u])||void 0===r?void 0:r.current)&&(d.style.paddingTop="0px")}pe(null),De.current=null,fi.current=null,ue(!1),Gn(!1),ze.current&&(ze.current.style.height="0px"),We.current&&(We.current.style.height="0px"),qe.current&&(qe.current.style.height="0px"),Ye.current&&(Ye.current.style.height="0px")},[]),Ut=c(function(){$t(),Jt(),me(new Set),be([]),_e.current=[],bi([]),Ci(null),ot(M),ct(),requestAnimationFrame(function(){var n;null===(n=Ae.current)||void 0===n||n.call(Ae)})},[]),Gt=r(Ut);u(function(){Gt.current=Ut},[Ut]),u(function(){Dn&&Gt.current()},[Dn]);var Qt=q({maintainRelativeOrder:!!qn,proposedSections:bt,existingSections:St,activeSideBySideSection:ve,connectedSections:he,resetSideBySide:Jt,setConnectedSections:me,setConnectedLines:be,cachedConnectedPositions:_e,svgContainerRef:Se,isAnimatingRef:Be,animationTimerRef:we,calculateLinesRef:Ae,sectionLeftRefs:Ft,sectionRightRefs:Dt,subSectionLeftRefs:kt,subSectionRightRefs:Pt}),Zt=Qt.expandedSections,ni=Qt.setExpandedSections,ei=Qt.expandedSubSections,ti=Qt.setExpandedSubSections,ii=Qt.toggleSection,oi=c(function(e,t,i,o,r,l,u){var c,a,d,s=x(null==t?void 0:t.id)||x(null==i?void 0:i.id)||"",v=(s?Me[s]:null)||(null==t?void 0:t.cognitiveData)||(null==i?void 0:i.cognitiveData)||{section_id:s,decisioning:[],gap:[],relevance_score:0},p=null!==(a=null===(c=jt.current[o])||void 0===c?void 0:c.current)&&void 0!==a?a:null;return{isLoading:null!==(d=null==Mn?void 0:Mn.isLoading)&&void 0!==d&&d,open:!0,sectionTitle:(null==t?void 0:t.displayTitle)?null==t?void 0:t.title:"no title",refSectionTitle:(null==i?void 0:i.displayTitle)?null==i?void 0:i.title:"no title",cognitiveData:v,anchorEl:e,sectionAnchorEl:p,badgeStyle:l||null,sectionIdx:o,docData:{documents:null==wn?void 0:wn.documents,input_index_map:null==wn?void 0:wn.input_index_map},deviationData:function(){var e,r,l=(null==t?void 0:t.evaluationResult)||(null==i?void 0:i.evaluationResult)||null,u=function(e){var t=function(n){if(!n||"object"!=typeof n)return null;var e=null==n?void 0:n.deviation_entries;if(e&&"object"==typeof e){var t=Object.keys(e).sort(function(n,e){return Number(n)-Number(e)})[0];if(t&&e[t])return e[t]}var i=Object.keys(n).filter(function(n){return/^\d+$/.test(n)}).sort(function(n,e){return Number(n)-Number(e)});if(i.length&&n[i[0]])return n[i[0]];var o=null==n?void 0:n.deviations;if(o&&"object"==typeof o){var r=Object.keys(o).sort(function(n,e){return Number(n)-Number(e)})[0];if(r&&o[r])return o[r]}return null}(e);return t?n(n({},e),{deviation_summary:(null==e?void 0:e.deviation_summary)||(null==t?void 0:t.deviation_summary),deviation_title:(null==e?void 0:e.deviation_title)||(null==t?void 0:t.deviation_title),deviation_impact:(null==e?void 0:e.deviation_impact)||(null==t?void 0:t.deviation_impact),deviation_explanation:(null==e?void 0:e.deviation_explanation)||(null==t?void 0:t.deviation_explanation),evaluation_outputs:(null==e?void 0:e.evaluation_outputs)||(null==t?void 0:t.evaluation_outputs),cognitive_decisioning:(null==e?void 0:e.cognitive_decisioning)||(null==t?void 0:t.cognitive_decisioning)}):e};if(!("string"==typeof o&&o.includes(S)))return u(l);var c=o.split(S)[1];if(!c)return l;var a=(null==t?void 0:t.evaluationResult)||(null==i?void 0:i.evaluationResult)||{},d=(null===(e=null==a?void 0:a.deviation_entries)||void 0===e?void 0:e[c])||(null===(r=null==a?void 0:a.deviations)||void 0===r?void 0:r[c])||null;return d?n(n(n({},a),d),{deviation_summary:(null==d?void 0:d.deviation_summary)||(null==a?void 0:a.deviation_summary),deviation_title:(null==d?void 0:d.deviation_title)||(null==a?void 0:a.deviation_title),deviation_impact:(null==d?void 0:d.deviation_impact)||(null==a?void 0:a.deviation_impact),deviation_explanation:(null==d?void 0:d.deviation_explanation)||(null==a?void 0:a.deviation_explanation),evaluation_outputs:(null==d?void 0:d.evaluation_outputs)||(null==a?void 0:a.evaluation_outputs),cognitive_decisioning:(null==d?void 0:d.cognitive_decisioning)||(null==a?void 0:a.cognitive_decisioning)}):u(l)}(),isOrphan:!!r}},[Me,wn]),ri=c(function(n){at(),et(null),Ge(n)},[at]),li=function(n,e,t,i,o,r){var l;if(n.stopPropagation(),Qe.open&&Qe.sectionIdx===o)at();else{var u=n.currentTarget,c="left";(null===(l=Oe.current)||void 0===l?void 0:l.contains(u))&&(c="right");$t(),Fe.current&&Jt(),me(new Set),be([]),_e.current=[],ct(),it.open?Yi():rt(),requestAnimationFrame(function(){var n=function(){var n,e,t,i;if("string"==typeof o&&o.includes(S)){var r=o.split(S),l="".concat(r[0]).concat(S).concat(r[1]);return"right"===c?null===(n=Mt.current[l])||void 0===n?void 0:n.current:null===(e=At.current[l])||void 0===e?void 0:e.current}return"right"===c?null===(t=Mt.current[o])||void 0===t?void 0:t.current:null===(i=At.current[o])||void 0===i?void 0:i.current}()||u;Ze(oi(n,e,i,o,t,r))})}},ui=c(function(){null!==Qe.sectionIdx&&Qe.anchorEl?ri(n(n({},Qe),{open:!0})):at()},[Qe,at,ri]),ci=c(function(){var n=Qe.sectionIdx,e=Qe.isOrphan;at(),rt(),null!==n&&(e?ne("No counterpart exists to connect to."):($t(),Fe.current&&Jt(),be([]),_e.current=[],me(function(e){return e.has(n)?new Set:new Set([n])}),setTimeout(function(){Ae.current&&Ae.current()},50)))},[Qe.sectionIdx,Qe.isOrphan,at,rt,Jt]),ai=c(function(){var n=Ce.current;if(n){Ce.current=null;var e=bt.findIndex(function(e){return e.id===n}),t=St.findIndex(function(e){return e.id===n}),i=-1===e?R(bt,n):null,o=-1===t?R(St,n):null,r=-1!==e?e:i?Number(i.split("-")[0]):-1,l=-1!==t?t:o?Number(o.split("-")[0]):-1,u=function(n,e,t,i){var o,r,l,u;return-1!==n?null!==(r=null===(o=t.current[n])||void 0===o?void 0:o.current)&&void 0!==r?r:null:e&&null!==(u=null===(l=i.current[e])||void 0===l?void 0:l.current)&&void 0!==u?u:null},c=function(n,e,t){void 0===t&&(t=30);var i=0,o=function(){var r=n();r&&0!==r.getBoundingClientRect().height?(Ie.current.add(r),E(r,e)):i++<t&&requestAnimationFrame(o)};requestAnimationFrame(o)};if(qn)-1!==r&&Ke.current&&c(function(){return u(e,i,Ft,kt)},Ke.current),-1!==l&&Oe.current&&c(function(){return u(t,o,Dt,Pt)},Oe.current);else{var a=He.current;if(!a)return;c(function(){return-1!==r?u(e,i,Ft,kt):u(t,o,Dt,Pt)},a)}}},[bt,St,qn,Ft,Dt,kt,Pt,Ke,Oe,He]),di=c(function(e){if(e){$t(),Jt(),me(new Set),be([]),_e.current=[],rt(),ct();var t=bt.findIndex(function(n){return n.id===e}),i=St.findIndex(function(n){return n.id===e}),o=-1===t?R(bt,e):null,r=-1===i?R(St,e):null;if(-1!==t||o||-1!==i||r){var l=-1!==t?t:o?Number(o.split("-")[0]):-1,u=-1!==i?i:r?Number(r.split("-")[0]):-1;Ce.current=e,ni(function(e){var t,i=n({},e),o=!1;-1!==l&&(i[t=qn?"left-".concat(l):String(l)]||(i[t]=!0,o=!0));-1!==u&&(i[t=qn?"right-".concat(u):String(u)]||(i[t]=!0,o=!0));return o?i:e}),ti(function(e){var t=n({},e),i=!1,l=function(n){for(var e=n.split("-"),o=e[0],r=1;r<e.length;r++)o+="-".concat(e[r]),t[o]||(t[o]=!0,i=!0)};return o&&l(o),r&&l(r),i?t:e}),setTimeout(function(){requestAnimationFrame(function(){Ce.current===e&&si.current()})},50)}else console.warn('scrollToAndHighlightClause: nodeId "'.concat(e,'" not found'))}},[bt,St,qn,ni,ti,Jt,rt,ct]),si=r(ai);u(function(){si.current=ai},[ai]);var vi=r(null),pi=r(null),fi=r(null),gi=r(null),hi=r(null),mi=r(null),xi=o([]),yi=xi[0],bi=xi[1];r(null);var Si=o(null),Ri=Si[0],Ci=Si[1];u(function(){if(vt){var n=dt.fields.find(function(n){return n.analysisKey===vt||n.key===vt});if(n){var e=_t.current[n.key]||Et.current[n.key];(null==e?void 0:e.current)&&setTimeout(function(){return e.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[vt,dt.fields]);var Ii=c(function(n){var e,t,i,o,r,l,u,c,a,d=null===(e=null==zt?void 0:zt.rule_difference_comparison)||void 0===e?void 0:e.fields;if(!d||!d[n])return{score:0,relation:"",highlightsA:[],highlightsB:[],hasContent:!1};var s=d[n],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===(u=p.highlights)||void 0===u?void 0:u.ruleB_spans)||[],hasContent:!!v}}return{score:s.score,relation:s.relation||"",highlightsA:(null===(c=s.highlights)||void 0===c?void 0:c.ruleA_spans)||[],highlightsB:(null===(a=s.highlights)||void 0===a?void 0:a.ruleB_spans)||[],hasContent:!!v}},[zt]),Bi=c(function(e,t){var i,o,r;void 0===t&&(t="left");var l=null,u=null;if("left"===t)if(l=bt[e],qn&&l){var c=St.filter(function(n){var e;return null===(e=l.refIndexes)||void 0===e?void 0:e.includes(n.selfIndex)});u=c.find(function(n){return n.evaluationResult})||c[0]}else u=St[e];else if(u=St[e],qn&&u){var a=bt.filter(function(n){var e;return null===(e=n.refIndexes)||void 0===e?void 0:e.includes(u.selfIndex)});l=a.find(function(n){return n.evaluationResult})||a[0]}else l=bt[e];var d=(null==l?void 0:l.relation)&&"not_defined"!==l.relation,s=(null==u?void 0:u.relation)&&"not_defined"!==u.relation,v=!(!(null==l?void 0:l.cognitiveData)&&!(null==u?void 0:u.cognitiveData));if(!d&&!s&&!v)return n(n({},b(N)),{label:"Not Defined"});var p=null!==(o=null!==(i=null==l?void 0:l.evaluationResult)&&void 0!==i?i:null==u?void 0:u.evaluationResult)&&void 0!==o?o:null,f=C(p),g=I(p);return n(n({},b(g)),null!=p?{label:null!==(r=f)&&void 0!==r?r:""}:{label:null})},[bt,St,Me,dt,qn]),wi=c(function(e){for(var t,i,o,r,l,u=e.split("-").map(Number),c=bt[u[0]],a=St[u[0]],d=1;d<u.length;d++)(null==c?void 0:c.subsections)&&(c=c.subsections[u[d]]),(null==a?void 0:a.subsections)&&(a=a.subsections[u[d]]);if(!c&&!a)return null;var s=(null==c?void 0:c.relation)&&"not_defined"!==c.relation,v=(null==a?void 0:a.relation)&&"not_defined"!==a.relation,p=x(null==c?void 0:c.id)||x(null==a?void 0:a.id)||"",f=!(!(null==c?void 0:c.cognitiveData)&&!(null==a?void 0:a.cognitiveData));if(!s&&!v&&!f)return n(n({},b(N)),{label:"Not Defined"});null!==(i=null!==(t=null==c?void 0:c.cognitiveRelevanceScore)&&void 0!==t?t:null==a?void 0:a.cognitiveRelevanceScore)&&void 0!==i||p&&(null===(o=Me[p])||void 0===o||o.relevance_score);var g=null!==(l=null!==(r=null==c?void 0:c.evaluationResult)&&void 0!==r?r:null==a?void 0:a.evaluationResult)&&void 0!==l?l:null,h=C(g),m=I(g);return n(n({},b(m)),null!=g?{label:null!=h?h:""}:{label:null})},[bt,St,Me,dt]),Ti=c(function(e,t){var i,o,r,l,u,c,a,d,s,v,p,f,g,h,m,x,y;if(!e||null==t)return null;var S=null!==(a=null!==(u=null!==(o=null===(i=null==Pn?void 0:Pn[e])||void 0===i?void 0:i.evaluation_result)&&void 0!==o?o:null===(l=null===(r=null==wn?void 0:wn.nodes)||void 0===r?void 0:r[e])||void 0===l?void 0:l.evaluation_result)&&void 0!==u?u:null===(c=null==wn?void 0:wn[e])||void 0===c?void 0:c.evaluation_result)&&void 0!==a?a:null;if(!S||"object"!=typeof S)return null;var R=null!==(p=null!==(s=null===(d=null==S?void 0:S.deviations)||void 0===d?void 0:d[t])&&void 0!==s?s:null===(v=null==S?void 0:S.deviation_entries)||void 0===v?void 0:v[t])&&void 0!==p?p:null==S?void 0:S[t],C=null!==(y=null!==(h=null===(g=null===(f=null==R?void 0:R.evaluation_outputs)||void 0===f?void 0:f.metadata)||void 0===g?void 0:g.label_color)&&void 0!==h?h:null===(x=null===(m=null==S?void 0:S.evaluation_outputs)||void 0===m?void 0:m.metadata)||void 0===x?void 0:x.label_color)&&void 0!==y?y:N;return n(n({},b(C)),{label:null})},[Pn,wn]),_i=c(function(){$t(),ni({}),ti({}),Jt(),me(new Set),be([]),_e.current=[],rt(),ct(),at(),requestAnimationFrame(function(){Ae.current&&Ae.current()})},[ni,ti,Jt,rt,ct,at]),Ei=l(function(){return Object.values(Zt).some(Boolean)||Object.values(ei).some(Boolean)},[Zt,ei]),Fi=c(function(){var n,e,t,i,o,r,l,u,c,a,d,s,v,p,f,g,h,m,x,y,b,R,C;if(!Ve.current&&!Be.current){Ve.current=!0;try{if(!vi.current)return;var I=function(n){var e=n.split("-"),t=e[0];if(!Zt[t]&&!1===qn)return!1;if(qn&&!Zt["left-".concat(t)]&&!Zt["right-".concat(t)]&&!Zt[t])return!1;for(var i=t,o=1;o<e.length-1;o++)if(i+="-".concat(e[o]),!ei[i])return!1;return!0},T=vi.current.getBoundingClientRect();Pe({width:T.width,height:T.height});var _=[];if(Rt.forEach(function(n){var e,t,i=n.key,o=null===(e=_t.current[i])||void 0===e?void 0:e.current,r=null===(t=Et.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")}),!Be.current){for(var E=0;E<Math.max(bt.length,St.length);E++){var F=null===(n=Ft.current[E])||void 0===n?void 0:n.current,D=null===(e=Dt.current[E])||void 0===e?void 0:e.current;F&&(F.style.height="auto",F.style.minHeight="0px"),D&&(D.style.height="auto",D.style.minHeight="0px")}qn||Object.keys(kt.current).forEach(function(n){var e,t;if(I(n)){var i=null===(e=kt.current[n])||void 0===e?void 0:e.current,o=null===(t=Pt.current[n])||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 A={};Rt.forEach(function(n){var e,t,i=n.key,o=null===(e=_t.current[i])||void 0===e?void 0:e.current,r=null===(t=Et.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=o.getBoundingClientRect(),u=r.getBoundingClientRect();A[i]=Math.max(l.height,u.height)}});var M={left:{},right:{}},N={};if(!Be.current)if(qn){if(te&&null!==ve)if("number"==typeof ve){var k=ve,P=bt[k],j=null===(o=Ft.current[k])||void 0===o?void 0:o.current;j&&P&&(P.refIndexes||[]).forEach(function(n){var e,t=St.findIndex(function(e){return e.selfIndex===n}),i=null===(e=Dt.current[t])||void 0===e?void 0:e.current;if(i&&(Zt["left-".concat(k)]||Zt["right-".concat(t)])){var o=Math.max(j.getBoundingClientRect().height,i.getBoundingClientRect().height);M.left[k]=Math.max(M.left[k]||0,o),M.right[t]=Math.max(M.right[t]||0,o)}})}else{var H=ve.split(S)[2];if(H){F=null===(r=kt.current[H])||void 0===r?void 0:r.current,D=null===(l=Pt.current[H])||void 0===l?void 0:l.current;if(F&&D){L=Math.max(F.getBoundingClientRect().height,D.getBoundingClientRect().height);N[H]=Math.max(N[H]||0,L)}}}}else{Object.keys(kt.current).forEach(function(n){var e,t;if(I(n)){var i=null===(e=kt.current[n])||void 0===e?void 0:e.current,o=null===(t=Pt.current[n])||void 0===t?void 0:t.current;if(i&&o&&null!==i.offsetParent&&null!==o.offsetParent){var r=i.getBoundingClientRect(),l=o.getBoundingClientRect(),u=Math.max(r.height,l.height);N[n]=u,i.style.minHeight="".concat(u,"px"),o.style.minHeight="".concat(u,"px")}}});for(E=0;E<Math.min(bt.length,St.length);E++){var F=null===(t=Ft.current[E])||void 0===t?void 0:t.current,D=null===(i=Dt.current[E])||void 0===i?void 0:i.current;if(F&&D){var L=Math.max(F.getBoundingClientRect().height,D.getBoundingClientRect().height);M.left[E]=L,M.right[E]=L}}}if(Rt.forEach(function(n){var e,t,i=n.key,o=null===(e=_t.current[i])||void 0===e?void 0:e.current,r=null===(t=Et.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=A[i];o.style.minHeight="".concat(l,"px"),r.style.minHeight="".concat(l,"px")}}),Be.current||(Object.entries(M.left).forEach(function(n){var e,t=n[0],i=n[1],o=null===(e=Ft.current[Number(t)])||void 0===e?void 0:e.current;o&&(o.style.minHeight="".concat(i,"px"))}),Object.entries(M.right).forEach(function(n){var e,t=n[0],i=n[1],o=null===(e=Dt.current[Number(t)])||void 0===e?void 0:e.current;o&&(o.style.minHeight="".concat(i,"px"))}),qn||Object.keys(N).forEach(function(n){var e,t,i=null===(e=kt.current[n])||void 0===e?void 0:e.current,o=null===(t=Pt.current[n])||void 0===t?void 0:t.current;if(i&&o&&N[n]){var r=N[n];i.style.minHeight="".concat(r,"px"),o.style.minHeight="".concat(r,"px")}})),qn)bt.forEach(function(n,e){var t;(null===(t=Ft.current[e])||void 0===t?void 0:t.current)&&(n.refIndexes||[]).forEach(function(n){var t,i,o,r,l,u,c,a,d,s,v=St.findIndex(function(e){return e.selfIndex===n});if(-1!==v){var p=null===(t=At.current[e])||void 0===t?void 0:t.current,f=null===(i=Mt.current[v])||void 0===i?void 0:i.current;if(p&&f){var g=p.getBoundingClientRect(),h=f.getBoundingClientRect(),m=g.right-T.left,x=h.left-T.left,y=g.top+g.height/2-T.top,b=h.top+h.height/2-T.top;if(te&&ve===e){var S=null!==(r=null===(o=Ke.current)||void 0===o?void 0:o.getBoundingClientRect().top)&&void 0!==r?r:0,R=null!==(u=null===(l=Oe.current)||void 0===l?void 0:l.getBoundingClientRect().top)&&void 0!==u?u:0,C=S+(null!==(a=null===(c=Ke.current)||void 0===c?void 0:c.clientHeight)&&void 0!==a?a:1/0),I=R+(null!==(s=null===(d=Oe.current)||void 0===d?void 0:d.clientHeight)&&void 0!==s?s:1/0),B=g.top+g.height/2,w=h.top+h.height/2,E=function(n,e,t){return Math.max(e,Math.min(t,n))};y=E(B,S,C)-T.top,b=E(w,R,I)-T.top}var F=Bi(e);F&&_.push({id:"line-".concat(e,"-").concat(v),x1:m,y1:y,x2:x,y2:b,style:F,sectionIdx:e,targetRightIdx:v})}}})});else{for(E=0;E<Math.min(bt.length,St.length);E++){var O=null===(u=Ft.current[E])||void 0===u?void 0:u.current,z=null===(c=Dt.current[E])||void 0===c?void 0:c.current;if(O&&z){var W=O.getBoundingClientRect(),q=z.getBoundingClientRect(),Y=Math.max(W.top,q.top)+18-T.top,K=(null===(a=St[E])||void 0===a?void 0:a.id)||"sec-".concat(E);(Z=Bi(E))&&_.push({id:K,x1:W.right-T.left,y1:Y,x2:q.left-T.left,y2:Y,style:Z,sectionIdx:E,hasCognitive:!!((null===(d=bt[E])||void 0===d?void 0:d.cognitiveData)||(null===(s=St[E])||void 0===s?void 0:s.cognitiveData)||K&&Me[K]),isSubSection:!1})}}Object.keys(kt.current).forEach(function(n){var e,t,i,o,r,l;if(I(n)){var u=null===(e=kt.current[n])||void 0===e?void 0:e.current,c=null===(t=Pt.current[n])||void 0===t?void 0:t.current;if(u&&c){for(var a=n.split("-").map(Number),d=bt[a[0]],s=St[a[0]],v=1;v<a.length;v++)(null==d?void 0:d.subsections)&&(d=d.subsections[a[v]]),(null==s?void 0:s.subsections)&&(s=s.subsections[a[v]]);var p=!!d&&((null===(i=d.displayTitle)||void 0===i||i)&&B(d.title)),f=!!d&&((null===(o=d.displayContent)||void 0===o||o)&&B(d.content)),g=!!s&&((null===(r=s.displayTitle)||void 0===r||r)&&B(s.title)),h=!!s&&((null===(l=s.displayContent)||void 0===l||l)&&B(s.content));if(p&&f||g&&h){var m=u.getBoundingClientRect(),x=c.getBoundingClientRect(),y=Math.max(m.top,x.top)+16-T.top,b=wi(n);b&&"Not Defined"!==b.label&&_.push({id:"subsec-".concat(n),x1:m.right-T.left,y1:y,x2:x.left-T.left,y2:y,style:b,sectionIdx:a[0],isSubSection:!0,subSectionKeyPath:n,hasCognitive:!(!(null==d?void 0:d.cognitiveData)&&!(null==s?void 0:s.cognitiveData))})}}}})}if(te&&"string"==typeof ve&&ve.includes(S)){var V=ve.split(S),X=V[0],$=V[1],J=V[2],U=(V[3],"".concat(X).concat(S).concat($)),G=null===(v=At.current[U])||void 0===v?void 0:v.current,Q=null===(p=Mt.current[U])||void 0===p?void 0:p.current;if(G&&Q){var Z,nn=G.getBoundingClientRect(),en=Q.getBoundingClientRect(),tn=nn.right-T.left,on=en.left-T.left,rn=nn.top+nn.height/2-T.top,ln=en.top+en.height/2-T.top;if(qn){var un=null!==(g=null===(f=Ke.current)||void 0===f?void 0:f.getBoundingClientRect().top)&&void 0!==g?g:0,cn=null!==(m=null===(h=Oe.current)||void 0===h?void 0:h.getBoundingClientRect().top)&&void 0!==m?m:0,an=un+(null!==(y=null===(x=Ke.current)||void 0===x?void 0:x.clientHeight)&&void 0!==y?y:1/0),dn=cn+(null!==(R=null===(b=Oe.current)||void 0===b?void 0:b.clientHeight)&&void 0!==R?R:1/0),sn=function(n,e,t){return Math.max(e,Math.min(t,n))};rn=sn(nn.top+nn.height/2,un,an)-T.top,ln=sn(en.top+en.height/2,cn,dn)-T.top}(Z=null!==(C=Ti(X,$))&&void 0!==C?C:wi(J))&&_.push({id:"line-subsec-".concat(U),x1:tn,y1:rn,x2:on,y2:ln,style:Z,sectionIdx:Number(J.split("-")[0]),isSubSection:!0,subSectionKeyPath:ve})}}if(bi(_),hi.current&&mi.current){var vn=hi.current.getBoundingClientRect(),pn=mi.current.getBoundingClientRect(),fn=(vn.top+vn.height/2-T.top+pn.top+pn.height/2-T.top)/2;Ci({x1:vn.right-T.left,x2:pn.left-T.left,y:fn})}else Ci(null);if(he.size>0){var gn=[],hn=Ke.current,mn=Oe.current;if(hn&&mn){var xn=[],yn=hn.getBoundingClientRect().top,bn=mn.getBoundingClientRect().top,Sn=yn+hn.clientHeight,Rn=bn+mn.clientHeight,Cn=hn.scrollTop,In=mn.scrollTop,Bn=T.top,wn=function(n,e,t){return Math.max(e,Math.min(t,n))};he.forEach(function(n){var e,t,i,o,r,l;if("string"==typeof n&&n.includes(S)){var u=n.split(S),c=u[0],a=u[1],d=u[2],s=(u[3],"".concat(c).concat(S).concat(a)),v=null===(e=At.current[s])||void 0===e?void 0:e.current,p=null===(t=Mt.current[s])||void 0===t?void 0:t.current;if(!v||!p)return;var f=v.getBoundingClientRect(),g=p.getBoundingClientRect(),h=null!==(i=Ti(c,a))&&void 0!==i?i:wi(d),m=(P=f.right-T.left)+.5*((j=g.left-T.left-0)-P),x=f.top+f.height/2,y=g.top+g.height/2,b=x-yn+Cn,R=y-bn+In,C="conn-subsec-".concat(s);xn.push({lhsScrollY:b,rhsScrollY:R,x1:P,x2:j,containerTop:Bn,leftIdx:n,rhsArrayIdx:n,styleColor:(null==h?void 0:h.badgeBorder)||"#6366F1",styleId:C});var I=wn(x,yn,Sn),B=wn(y,bn,Rn),_=I-Bn,E=B-Bn,F=y>=bn-4&&y<=Rn+4,D="";D=(H=x>=yn-4&&x<=Sn+4)&&F?w(P,_,j,E):H&&!F?"M ".concat(P,",").concat(_," L ").concat(m,",").concat(_," L ").concat(m,",").concat(E):!H&&F?"M ".concat(m,",").concat(_," L ").concat(m,",").concat(E," L ").concat(j,",").concat(E):"M ".concat(m,",").concat(_," L ").concat(m,",").concat(E),gn.push({id:C,pathD:D,style:h,leftIdx:n,rhsArrayIdx:n})}else if(qn){var A=n,M=bt[A];if(!(null===(l=null==M?void 0:M.refIndexes)||void 0===l?void 0:l.length))return;M.refIndexes.forEach(function(n){var e,t,i=St.findIndex(function(e){return e.selfIndex===n});if(-1!==i){var o=null===(e=At.current[A])||void 0===e?void 0:e.current,r=null===(t=Mt.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=o.getBoundingClientRect(),u=r.getBoundingClientRect(),c=Bi(A),a=l.right-T.left,d=u.left-T.left-0,s=a+.5*(d-a),v=l.top+l.height/2,p=u.top+u.height/2,f=v-yn+Cn,g=p-bn+In,h="conn-".concat(A,"-").concat(i);xn.push({lhsScrollY:f,rhsScrollY:g,x1:a,x2:d,containerTop:Bn,leftIdx:A,rhsArrayIdx:i,styleColor:(null==c?void 0:c.badgeBorder)||"#6366F1",styleId:h});var m=wn(v,yn,Sn),x=wn(p,bn,Rn),y=m-Bn,b=x-Bn,S=v>=yn-4&&v<=Sn+4,R=p>=bn-4&&p<=Rn+4,C="";C=S&&R?w(a,y,d,b):S&&!R?"M ".concat(a,",").concat(y," L ").concat(s,",").concat(y," L ").concat(s,",").concat(b):!S&&R?"M ".concat(s,",").concat(y," L ").concat(s,",").concat(b," L ").concat(d,",").concat(b):"M ".concat(s,",").concat(y," L ").concat(s,",").concat(b),gn.push({id:h,pathD:C,style:c,leftIdx:A,rhsArrayIdx:i})}}})}else{var N=n,k=N;v=null===(o=At.current[N])||void 0===o?void 0:o.current,p=null===(r=Mt.current[k])||void 0===r?void 0:r.current;if(!v||!p)return;var P,j;f=v.getBoundingClientRect(),g=p.getBoundingClientRect(),h=Bi(N),m=(P=f.right-T.left)+.5*((j=g.left-T.left-0)-P),x=f.top+f.height/2,y=g.top+g.height/2,b=x-yn+Cn,R=y-bn+In,C="conn-".concat(N,"-").concat(k);xn.push({lhsScrollY:b,rhsScrollY:R,x1:P,x2:j,containerTop:Bn,leftIdx:N,rhsArrayIdx:k,styleColor:(null==h?void 0:h.badgeBorder)||"#6366F1",styleId:C});var H;I=wn(x,yn,Sn),B=wn(y,bn,Rn),_=I-Bn,E=B-Bn,F=y>=bn-4&&y<=Rn+4,D="";D=(H=x>=yn-4&&x<=Sn+4)&&F?w(P,_,j,E):H&&!F?"M ".concat(P,",").concat(_," L ").concat(m,",").concat(_," L ").concat(m,",").concat(E):!H&&F?"M ".concat(m,",").concat(_," L ").concat(m,",").concat(E," L ").concat(j,",").concat(E):"M ".concat(m,",").concat(_," L ").concat(m,",").concat(E),gn.push({id:C,pathD:D,style:h,leftIdx:N,rhsArrayIdx:k})}}),_e.current=xn}be(gn)}else be([]),_e.current=[]}catch(n){console.error("Line render safe fail: ",n)}finally{Ve.current=!1}}},[Rt,bt,St,Me,dt,Ii,Bi,Ti,qn,te,ve,he,Zt,ei]),Di=c(function(){var n,e,t,i,o,r,l,u,c,a,d,s,v,p,f=_e.current;if(f.length&&!Be.current){var g=null!==(e=null===(n=Ke.current)||void 0===n?void 0:n.scrollTop)&&void 0!==e?e:0,h=null!==(i=null===(t=Oe.current)||void 0===t?void 0:t.scrollTop)&&void 0!==i?i:0,m=null!==(r=null===(o=Ke.current)||void 0===o?void 0:o.clientHeight)&&void 0!==r?r:1/0,x=null!==(u=null===(l=Oe.current)||void 0===l?void 0:l.clientHeight)&&void 0!==u?u:1/0,y=null!==(a=null===(c=Ke.current)||void 0===c?void 0:c.getBoundingClientRect().top)&&void 0!==a?a:0,b=null!==(s=null===(d=Oe.current)||void 0===d?void 0:d.getBoundingClientRect().top)&&void 0!==s?s:0,S=y+m,R=b+x,C=null!==(p=null===(v=vi.current)||void 0===v?void 0:v.getBoundingClientRect().top)&&void 0!==p?p:0,I=function(n,e,t){return Math.max(e,Math.min(t,n))};f.forEach(function(n){var e=n.lhsScrollY-g+y,t=n.rhsScrollY-h+b,i=Te.current[n.styleId+"-stroke"],o=Te.current[n.styleId+"-bg"];if(i||o){var r,l=I(e,y,S),u=I(t,b,R),c=l-C,a=u-C,d=e>=y-4&&e<=S+4,s=t>=b-4&&t<=R+4,v=n.x1+.5*(n.x2-n.x1);r=d&&s?w(n.x1,c,n.x2,a):d&&!s?"M ".concat(n.x1,",").concat(c," L ").concat(v,",").concat(c," L ").concat(v,",").concat(a):!d&&s?"M ".concat(v,",").concat(c," L ").concat(v,",").concat(a," L ").concat(n.x2,",").concat(a):"M ".concat(v,",").concat(c," L ").concat(v,",").concat(a),i&&(i.setAttribute("visibility","visible"),i.setAttribute("d",r)),o&&(o.setAttribute("visibility","visible"),o.setAttribute("d",r))}})}},[]);u(function(){Ae.current=Fi},[Fi]);var Ai=r(null),Mi=r(null),Ni=c(function(){_e.current.length>0&&!Be.current||(null!==Ai.current&&clearTimeout(Ai.current),Ai.current=setTimeout(function(){Ae.current(),Ai.current=null},50))},[]),ki=c(function(){de(!0),ue(!1),Re.current=null,null!==Mi.current&&clearTimeout(Mi.current),null!==Ai.current&&(clearTimeout(Ai.current),Ai.current=null),Mi.current=setTimeout(function(){var n,e,t,i,o,r,l,u,c,a,d;try{if(_e.current=[],Fe.current&&null!==De.current&&null!==fi.current){var s=De.current,v=fi.current,p="string"==typeof s&&s.includes(S),f=null,g=null,h=null,m=null;if(p){var x=s.split(S),y="".concat(x[0]).concat(S).concat(x[1]);f=(null===(n=At.current[y])||void 0===n?void 0:n.current)||null,g=(null===(e=Mt.current[y])||void 0===e?void 0:e.current)||null,h=(null===(t=kt.current[x[2]])||void 0===t?void 0:t.current)||(null===(i=Ft.current[Number(x[2])])||void 0===i?void 0:i.current)||null,m=(null===(o=Pt.current[x[3]])||void 0===o?void 0:o.current)||(null===(r=Dt.current[Number(x[3])])||void 0===r?void 0:r.current)||null}else f=(null===(l=jt.current[s])||void 0===l?void 0:l.current)||null,h=(null===(u=Ft.current[s])||void 0===u?void 0:u.current)||null,g=(null===(c=Nt.current[v])||void 0===c?void 0:c.current)||null,m=(null===(a=Dt.current[v])||void 0===a?void 0:a.current)||null;if(f&&g&&h&&m){if(h.style.paddingTop="0px",m.style.paddingTop="0px",!qn){var b=f.getBoundingClientRect(),R=g.getBoundingClientRect(),C=b.top-R.top;C>0?m.style.paddingTop="".concat(C,"px"):C<0&&(h.style.paddingTop="".concat(Math.abs(C),"px"))}var I=Ke.current,B=Oe.current;if(I&&B){var w=f.getBoundingClientRect().top-I.getBoundingClientRect().top+I.scrollTop,T=g.getBoundingClientRect().top-B.getBoundingClientRect().top+B.scrollTop-(w-I.scrollTop);Math.abs(B.scrollTop-T)>1&&(B.scrollTop=T)}}}null===(d=Ae.current)||void 0===d||d.call(Ae),Fe.current&&ue(!0)}catch(n){console.error("Safely caught error during resize calculation:",n)}finally{de(!1),Mi.current=null}},150)},[qn,bt,St]),Pi=c(function(n){if(null!==Xe.current&&$e.current&&Math.abs(n.currentTarget.scrollTop-Xe.current)<=2){var e=$e.current;Xe.current=null,$e.current=null,e()}fe.current||(qn||Ni(),Ee.current||(Ee.current=!0,requestAnimationFrame(function(){var n,e,t,i,o,r,l;if(Fe.current){var u=Ke.current,c=Oe.current;if(u&&c&&gi.current){if(!Re.current){var a=De.current,d=void 0;if("string"==typeof a&&a.includes(S)){var s=a.split(S),v="".concat(s[0]).concat(S).concat(s[1]);d=null===(n=At.current[v])||void 0===n?void 0:n.current}else d=null===(e=At.current[a])||void 0===e?void 0:e.current;if(d){var p=d.getBoundingClientRect();Re.current={badgeScreenY:p.top+p.height/2,initialScrollTop:u.scrollTop,leftTop:u.getBoundingClientRect().top,leftBottom:u.getBoundingClientRect().top+u.clientHeight,cTop:null!==(i=null===(t=vi.current)||void 0===t?void 0:t.getBoundingClientRect().top)&&void 0!==i?i:0}}}if(Re.current){var f=Re.current,g=u.scrollTop-f.initialScrollTop,h=f.badgeScreenY-g,m=((o=h,r=f.leftTop,l=f.leftBottom,Math.max(r,Math.min(l,o)))-f.cTop).toString(),x=h>=f.leftTop-4&&h<=f.leftBottom+4;gi.current.setAttribute("y1",m),gi.current.setAttribute("y2",m),gi.current.setAttribute("visibility",x?"visible":"hidden")}}}_e.current.length>0&&Di(),Ee.current=!1})))},[Di,qn,Ni]),ji=r(0),Hi=r(0),Li=r(0),Oi=r(function(){});r(null),u(function(){Oi.current=ki},[ki]),u(function(){var n=setTimeout(Ni,250),e=function(){return Oi.current()};return window.addEventListener("resize",e),function(){clearTimeout(n),null!==Ai.current&&clearTimeout(Ai.current),null!==Mi.current&&clearTimeout(Mi.current),window.removeEventListener("resize",e)}},[xt,yt,zt,Rt,Zt,ei,bt,St,dt,Ni,te,ve,le,he]),u(function(){var n=function(n,e,t,i,o){e.current=n.getBoundingClientRect().width;var r=new ResizeObserver(function(n){null!==t.current&&cancelAnimationFrame(t.current),t.current=requestAnimationFrame(function(){var r,l,u;t.current=null;var c=n[n.length-1];if(c){var a=null!==(u=null===(l=null===(r=c.borderBoxSize)||void 0===r?void 0:r[0])||void 0===l?void 0:l.inlineSize)&&void 0!==u?u:c.contentRect.width;Math.abs(a-e.current)<1?o():(e.current=a,i())}})});return r.observe(n),r},e={current:null},t={current:null},i={current:null},o=[],r=[e,t,i];return Le.current&&o.push(n(Le.current,ji,e,function(){return Oi.current()},function(){})),He.current&&o.push(n(He.current,Hi,t,function(){return Oi.current()},function(){return Ae.current()})),vi.current&&o.push(n(vi.current,Li,i,function(){return Oi.current()},function(){return Ae.current()})),function(){o.forEach(function(n){return n.disconnect()}),r.forEach(function(n){null!==n.current&&(cancelAnimationFrame(n.current),n.current=null)})}},[]),u(function(){Fe.current=te},[te]),u(function(){De.current=ve},[ve]);var zi=c(function(n,e,t){var i,o,r=null===(i=null==t?void 0:t.toggleIfSame)||void 0===i||i,l=null==t?void 0:t.onReady,u=null!==(o=null==t?void 0:t.sourceSide)&&void 0!==o?o:"left";at(),null!=n&&(e?ne("No counterpart exists for this section."):($t(),te&&ve===n?r?Jt():null==l||l():(me(new Set([n])),be([]),_e.current=[],Gn(!0),fe.current=!0,pe(n),De.current=n,ie(!0),Fe.current=!0,ue(!1),ze.current&&(ze.current.style.height="0px"),We.current&&(We.current.style.height="0px"),qe.current&&(qe.current.style.height="0px"),Ye.current&&(Ye.current.style.height="0px"),requestAnimationFrame(function(){var e,t,i,o,r,c="string"==typeof n&&n.includes(S),a=null,d=null,s=null;if(c){var v=n.split(S),p="".concat(v[0]).concat(S).concat(v[1]);a=(null===(e=At.current[p])||void 0===e?void 0:e.current)||null,d=(null===(t=Mt.current[p])||void 0===t?void 0:t.current)||null,s=d?n:null}else if(a=(null===(i=jt.current[n])||void 0===i?void 0:i.current)||null,qn){var f=bt[n],g=(null==f?void 0:f.refIndexes)||[];if(g.length>0){var h=g[0],m=St.findIndex(function(n){return n.selfIndex===h});-1!==m&&(d=(null===(r=Nt.current[m])||void 0===r?void 0:r.current)||null,s=m)}}else d=(null===(o=Nt.current[n])||void 0===o?void 0:o.current)||null,s=d?n:null;fi.current=s;var x=Ke.current,y=Oe.current,b=function(){!function(){var e,t,i,o,r,l,u,a,d,v,p,f,g=null,h=null,m=null,x=null;if(c){var y=n.split(S),b="".concat(y[0]).concat(S).concat(y[1]);g=(null===(e=kt.current[y[2]])||void 0===e?void 0:e.current)||(null===(t=Ft.current[Number(y[2])])||void 0===t?void 0:t.current)||null,h=(null===(i=Pt.current[y[3]])||void 0===i?void 0:i.current)||(null===(o=Dt.current[Number(y[3])])||void 0===o?void 0:o.current)||null,m=(null===(r=At.current[b])||void 0===r?void 0:r.current)||g,x=(null===(l=Mt.current[b])||void 0===l?void 0:l.current)||h}else{var R=Number(n),C=null!==s?Number(s):R;g=(null===(u=Ft.current[R])||void 0===u?void 0:u.current)||null,h=(null===(a=Dt.current[C])||void 0===a?void 0:a.current)||null,m=(null===(d=At.current[R])||void 0===d?void 0:d.current)||(null===(v=jt.current[R])||void 0===v?void 0:v.current)||g,x=(null===(p=Mt.current[C])||void 0===p?void 0:p.current)||(null===(f=Nt.current[C])||void 0===f?void 0:f.current)||h}if(m&&x&&g&&h){g.style.paddingTop="0px",h.style.paddingTop="0px";var I=m.getBoundingClientRect(),B=x.getBoundingClientRect(),w=I.top-B.top;w>0?h.style.paddingTop="".concat(w,"px"):w<0&&(g.style.paddingTop="".concat(Math.abs(w),"px"))}}(),ue(!0),Ae.current&&Ae.current(),fe.current=!1,"right"===u&&y?y.dispatchEvent(new Event("scroll")):x&&x.dispatchEvent(new Event("scroll")),Gn(!1),null==l||l()};if(!a||!x)return fe.current=!1,Gn(!1),void(null==l||l());if(d&&y){if(!qn){var R=0;R="right"===u?d?d.getBoundingClientRect().top:0:a?a.getBoundingClientRect().top:0;var C=He.current,I=(null==C?void 0:C.getBoundingClientRect().top)||0,B=C?C.scrollTop+R-I-150:0;return C?void T(C,B,200,b):void b()}var w=a.getBoundingClientRect().top-x.getBoundingClientRect().top+x.scrollTop,_=d.getBoundingClientRect().top-y.getBoundingClientRect().top+y.scrollTop,E=200;if("left"===u){var F=_-(w-x.scrollTop);F<0&&ze.current&&(ze.current.style.height="".concat(Math.abs(F),"px")),requestAnimationFrame(function(){var n,e=y.scrollHeight-y.clientHeight;if(F<0)n=0;else{if(F>e){var t=F-e;return We.current&&(We.current.style.height="".concat(t+150,"px")),void requestAnimationFrame(function(){T(y,F,E,b)})}n=F}T(y,n,E,b)})}else{var D=w-(_-y.scrollTop);D<0&&qe.current&&(qe.current.style.height="".concat(Math.abs(D),"px")),requestAnimationFrame(function(){var n,e=x.scrollHeight-x.clientHeight;if(D<0)n=0;else{if(D>e){var t=D-e;return Ye.current&&(Ye.current.style.height="".concat(t+150,"px")),void requestAnimationFrame(function(){T(x,D,E,b)})}n=D}T(x,n,E,b)})}}else b()}))))},[ve,at,St,te,qn,bt,Jt]),Wi=c(function(n,e,t,i,o){var r,l="string"==typeof i?x(i).trim():x(null==i?void 0:i.deviation_summary).trim(),u=n.currentTarget;ct();var c="left";(null===(r=Oe.current)||void 0===r?void 0:r.contains(u))&&(c="right");var a=function(){var n,t,i,o;if("string"==typeof e&&e.includes(S)){var r=e.split(S),l="".concat(r[0]).concat(S).concat(r[1]);return"right"===c?null===(n=Mt.current[l])||void 0===n?void 0:n.current:null===(t=At.current[l])||void 0===t?void 0:t.current}return"right"===c?null===(i=Mt.current[e])||void 0===i?void 0:i.current:null===(o=At.current[e])||void 0===o?void 0:o.current};if(t)return Jt(),me(new Set),be([]),_e.current=[],void(l&&requestAnimationFrame(function(){var n=a()||u;ot({open:!0,anchorEl:n,summary:i,displayImpact:o})}));zi(e,t,l?{toggleIfSame:!1,sourceSide:c,onReady:function(){var n=a()||u;ot({open:!0,anchorEl:n,summary:i,displayImpact:o})}}:{toggleIfSame:!1,sourceSide:c})},[zi,ct,ot,Jt]),qi=c(function(){var n,e=Qe.sectionIdx,t=Qe.isOrphan;if(rt(),null!=e){var i="left";Qe.anchorEl&&(null===(n=Oe.current)||void 0===n?void 0:n.contains(Qe.anchorEl))&&(i="right"),zi(e,t,{sourceSide:i})}},[zi,Qe.isOrphan,Qe.sectionIdx,Qe.anchorEl,rt]),Yi=c(function(){rt(),Jt(),me(new Set),be([]),_e.current=[]},[rt,Jt]),Ki=null!==Qe.sectionIdx&&he.has(Qe.sectionIdx),Vi=Y({proposedSections:bt,existingSections:St,parentDeviationRecord:Ct,expandedSections:Zt,maintainRelativeOrder:!!qn,scrollContainerRef:He,leftContainerRef:Ke,lhsBadgeRefs:At,rhsBadgeRefs:Mt}),Xi=Vi.showDeviationNavigation,$i=Vi.showOpenNodeRef,Ji=l(function(){var n;if(!jn)return null;var e=null===(n=null==jn?void 0:jn.id)||void 0===n?void 0:n.split(":")[0];for(var t in Ct){if((Ct[t]||[]).some(function(n){return n.id===e}))return t}return null},[jn,Ct]),Ui=r({id:null,triggerMs:null}),Gi=r(null);u(function(){var t;if(null==jn?void 0:jn.id){var i=Number(jn.trigger),o=Ui.current;if((null==o?void 0:o.triggerMs)!==i){if(!(jn.id.includes(":")&&/:\d+$/.test(jn.id)))return Ui.current={id:jn.id,triggerMs:i},void di(jn.id);var r=null===(t=null==jn?void 0:jn.id)||void 0===t?void 0:t.split(":"),l=r[0],u=r[1],c=null!=u?u:"0";Gi.current!==jn.id&&(rt(),ct(),Jt(),me(new Set),be([]),_e.current=[],Gi.current=jn.id);var a=!1,d=0,s=null,v=150,p=function(n,e){for(var t=function(n,i){if(!n)return null;if(n.id===e)return i;if(!Array.isArray(n.subsections))return null;for(var o=0;o<n.subsections.length;o++){var r=t(n.subsections[o],"".concat(i,"-").concat(o));if(r)return r}return null},i=0;i<n.length;i++){var o=t(n[i],String(i));if(o)return o}return null},f=function(){var t,o,r,u;if(!a){var g=function(){Ui.current={id:jn.id,triggerMs:i}},h=null,m=null;for(var x in Ct){var y=Ct[x].find(function(n){return n.id===l});if(y){h=x,m=y;break}}if(m&&h){var b=bt.findIndex(function(n){return n.id===h}),R=St.findIndex(function(n){return n.id===h}),C=-1===b&&-1!==R,I=p(bt,m.id),B=p(St,m.id);if(I&&!B&&!C){var w=I.split("-"),T=Number(w[0]);if(qn){var _=null===(o=null===(t=bt[T])||void 0===t?void 0:t.refIndexes)||void 0===o?void 0:o[0],E=St.findIndex(function(n){return n.selfIndex===_});-1!==E&&(T=E)}B=e([T],w.slice(1),!0).join("-")}if(I||B){var F=C||!I&&!!B,D=I?Number(I.split("-")[0]):b,A=B?Number(B.split("-")[0]):R;if(F){if(!(qn?!!Zt["right-".concat(A)]:!!Zt[String(A)])&&A>=0)return ii(A,"right"),d+=1,void(s=setTimeout(f,450))}else if(!(qn?!!Zt["left-".concat(D)]:!!Zt[String(D)])&&D>=0)return ii(D,"left"),d+=1,void(s=setTimeout(f,450));var M,N=I||"",k=B||"",P="".concat(m.id).concat(S).concat(c).concat(S).concat(N).concat(S).concat(k),j="".concat(m.id).concat(S).concat(c),H=null===(r=At.current[j])||void 0===r?void 0:r.current,L=null===(u=Mt.current[j])||void 0===u?void 0:u.current,O=F||!H&&!!L,z=O?L:H;if(M=qn?O?Oe.current:Ke.current:He.current,z&&M){var W=z.getBoundingClientRect();if(0===W.height)return void((d+=1)<2?s=setTimeout(f,v):g());var q=M.getBoundingClientRect(),Y=W.top-q.top+M.scrollTop-q.height/2+W.height/2+150,K=function(){var e,t,i,o,r;if(!a){g();var l=z instanceof Element?window.getComputedStyle(z).color:"";H&&(H.style.transition="box-shadow 300ms ease-in-out",H.style.boxShadow="0 0 10px ".concat(l)),L&&(L.style.transition="box-shadow 300ms ease-in-out",L.style.boxShadow="0 0 10px ".concat(l)),setTimeout(function(){H&&(H.style.boxShadow=""),L&&(L.style.boxShadow="")},2e3);var u=(null===(t=null===(e=m.evaluationResult)||void 0===e?void 0:e.deviations)||void 0===t?void 0:t[c])||m,d=(null===(i=m.evaluationResult)||void 0===i?void 0:i.evaluation_outputs)||m.evaluation_outputs;if(!(!!H&&!!L)){var s=O?(null===(o=Mt.current[j])||void 0===o?void 0:o.current)||L:(null===(r=At.current[j])||void 0===r?void 0:r.current)||H;return ot({open:!0,anchorEl:s,displayImpact:jn.displayImpact,summary:n(n({},u),{evaluation_outputs:d})}),void(null==Hn||Hn())}zi(P,!1,{toggleIfSame:!1,sourceSide:"left",onReady:function(){var e,t=(null===(e=At.current[j])||void 0===e?void 0:e.current)||H;console.log("Summary data",d,u),ot({open:!0,anchorEl:t,displayImpact:null==jn?void 0:jn.displayImpact,summary:n({},u)})}})}};Math.abs(M.scrollTop-Y)<=2?K():(Xe.current=Y,$e.current=K,M.scrollTo({top:Y,behavior:"smooth"}),s&&clearTimeout(s),s=setTimeout(function(){if($e.current){Xe.current=null;var n=$e.current;$e.current=null,n()}},800))}else(d+=1)<2?s=setTimeout(f,v):g()}else(d+=1)<2?s=setTimeout(f,v):g()}else(d+=1)<2?s=setTimeout(f,v):g()}};return s=setTimeout(f,v),function(){a=!0,s&&clearTimeout(s)}}}},[jn,Ct,bt,St,qn,Zt,ii,zi,ot,di]);var Qi=function(n){var e=n.section,t=n.keyPath,o=n.depth,r=void 0===o?0:o,l=n.columnKey,u=void 0===l?"left":l,c=n.parentNodeId;return i(X,{section:e,keyPath:t,depth:r,columnKey:u,parentNodeId:void 0===c?"":c,expandedSubSections:ei,setExpandedSubSections:ti,maintainRelativeOrder:qn||!1,proposedSections:bt,existingSections:St,treeData:wn,deviationNumberRegistry:It,connectedSections:he,activeSideBySideSection:ve,resolvedMarkdownStyles:je,getSubSectionRef:Lt,getSubSectionCompareStyle:wi,getBadgeRef:Ot,openMoreFunctionsPopup:li,openSummaryPopup:Wi,showDeviationBadges:Kn,resetSideBySide:Jt,setConnectedSections:me,setConnectedLines:be,cachedConnectedPositions:_e,isProposingFix:On,proposingFixNodeId:zn})};return t(a,n({ref:Le,sx:n(n({display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif'},qn?{}:{overflow:"visible"}),{position:"relative"})},{children:[Xn&&i(a,n({sx:{position:"absolute",inset:0,bgcolor:"rgba(255, 255, 255, 0.6)",backdropFilter:"blur(10px)",zIndex:9999,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"8px"}},{children:i(H,{})})),it.open&&i($,{open:it.open,anchorEl:it.anchorEl,containerEl:pi.current,clipTopEl:hi.current,scrollContainerEl:He.current,onClose:Yi,summary:it.summary,displayImpact:it.displayImpact}),i(j,{open:Qe.open,anchorEl:Qe.anchorEl,sectionTitle:Qe.sectionTitle,referenceSectionTitle:Qe.refSectionTitle,onClose:at,onOpenCognitiveCompare:ui,onOpenSideBySide:qi,onConnect:ci,isConnected:Ki,isOrphan:Qe.isOrphan}),Ue.open&&i(P,{open:Ue.open,popupRef:ut,position:nt,popupConfig:Nn,onClose:function(){et(null),Ge(function(e){return n(n({},e),{open:!1})}),lt(null)},markdownStyles:Fn,sectionTitle:Ue.sectionTitle,referenceSectionTitle:Ue.refSectionTitle,cognitiveData:Ue.cognitiveData,anchorEl:Ue.anchorEl,sectionAnchorEl:Ue.sectionAnchorEl,scrollContainerEl:He.current,badgeStyle:Ue.badgeStyle,docData:Ue.docData,deviationData:Ue.deviationData,isLoading:Ue.isLoading}),i(d,n({open:!!Zn,autoHideDuration:8e3,onClose:function(){return ne(null)},anchorOrigin:{vertical:"top",horizontal:"center"}},{children:i(s,n({onClose:function(){return ne(null)},severity:"error",sx:{width:"100%",whiteSpace:"pre-line"}},{children:Zn}))})),i(K,{componentHeaderText:Bn,displayConfig:Mn,maintainRelativeOrder:qn,onCollapseAll:_i,showCollapseAll:Ei,onToggleView:function(n){$n(!0),setTimeout(function(){Yn(!n),Jt(),rt(),me(new Set),be([]),_e.current=[],requestAnimationFrame(function(){requestAnimationFrame(function(){setTimeout(function(){$n(!1)},600)})})},50)}}),i(a,n({ref:He,onScroll:Pi,sx:{flex:1,minHeight:0,pt:1.5,pb:1,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",overflowY:qn?"hidden":"auto",borderTop:Wt&&qt?"none":"1.5px solid #EEF0F4"}},{children:i(a,n({sx:n({display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"},qn?{flex:1,minHeight:0}:{})},{children:t(a,n({ref:vi,sx:n({display:"grid",gridTemplateColumns:"minmax(0, 1fr) 180px minmax(0, 1fr)",gap:"40px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0},qn?{flex:1,overflow:"visible"}:{})},{children:[t("svg",n({ref:Se,style:{position:"absolute",top:0,left:0,width:ke.width||"100%",height:ke.height||"100%",pointerEvents:"none",zIndex:10,overflow:"visible",opacity:ae?0:1,transition:"opacity 0.15s ease-in-out"}},{children:[Ri&&i("g",{children:i("line",{x1:Ri.x1,y1:Ri.y,x2:Ri.x2,y2:Ri.y,stroke:Xt.badgeBorder,strokeWidth:"1.5"})}),yi.map(function(e){var o,r,l,u,c,d,s=e.x1+.5*(e.x2-e.x1),v=(e.y1+e.y2)/2;if("Not Defined"===e.style.label&&!e.hasCognitive)return null;if(e.isSubSection?te&&ve===e.subSectionKeyPath&&le:te&&ve===e.sectionIdx&&le)return null;if(!qn){var p=e.isSubSection?w(e.x1,e.y1,e.x2,e.y2):"M ".concat(e.x1," ").concat(e.y1," L ").concat(e.x2," ").concat(e.y2),g=bt[e.sectionIdx]||{title:"",content:""},m=St[e.sectionIdx]||{title:"",content:""};if(console.log("Base and Ref Sections for Badge:",g,m),e.isSubSection&&e.subSectionKeyPath){var x=e.subSectionKeyPath.includes(S)?e.subSectionKeyPath.split(S):[],y=x[2]||e.subSectionKeyPath,b=x[3]||y,R=y.split("-").map(Number),C=b.split("-").map(Number),I=null,B=null;R.length>0&&(I=bt[R[0]]),C.length>0&&(B=St[C[0]]);var T=(null==I?void 0:I.title)||"",_=(null==B?void 0:B.title)||"";console.log("Root Parent Titles:",T,_);for(var E=1;E<R.length;E++)(null==I?void 0:I.subsections)&&(I=I.subsections[R[E]]);for(E=1;E<C.length;E++)(null==B?void 0:B.subsections)&&(B=B.subsections[C[E]]);I&&(g=n(n({},I),{title:T||I.title})),console.log("Base Section for Subsection Badge:",g),B&&(m=n(n({},B),{title:_||B.title})),console.log("Ref Section for Subsection Badge:",m)}var F=!(null===(o=g.cognitiveData)||void 0===o?void 0:o.isMissingRationale)||Boolean(null===(l=null===(r=g.cognitiveData)||void 0===r?void 0:r.decisioning)||void 0===l?void 0:l.length),D=(null===(d=null===(c=null===(u=g.evaluationResult)||void 0===u?void 0:u.cognitive_decisioning)||void 0===c?void 0:c.decisioning_factors)||void 0===d?void 0:d.length)||!1,A=F||D;return t("g",{children:[i("path",{d:p,fill:"none",stroke:e.style.badgeBorder||"#E2E8F0",strokeWidth:"1.5"}),i("foreignObject",n({x:s-100,y:v-14,width:"200",height:"28",style:{pointerEvents:"auto",overflow:"visible"}},{children:i(a,n({sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},{children:t(a,n({onClick:function(n){n.stopPropagation(),A&&(Ue.open&&tt===e.id?ct():(lt(e.id),ri(oi(n.currentTarget,g,m,e.sectionIdx,e.style))))},sx:{display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",bgcolor:e.style.badgeBg,color:e.style.badgeText,border:"1px solid ".concat(e.style.badgeBorder),borderRadius:"12px",px:1.5,py:.5,fontWeight:600,textAlign:"center",whiteSpace:"nowrap",cursor:A?"pointer":"default"}},{children:[e.style.badgeText===N&&null==e.style.label?i(L,{color:e.style.badgeText}):0===e.style.label?"Same":e.style.label,i(a,n({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:i(h,{})})),A&&i(f,{size:11,style:{transform:Ue.open&&tt===e.id?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))}))]},e.id)}return null}),i(J,{connectedLines:ye,pathRefs:Te})]})),t(a,n({sx:n({border:"1px solid #E7E7E9",borderRadius:"8px",bgcolor:"#FFFFFF",display:"flex",flexDirection:"column",position:"relative",zIndex:2,filter:"drop-shadow(0px 2px 4px #F2F2F2)"},qn?{flex:1,overflow:"visible"}:{})},{children:[i(a,n({ref:hi,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E7E7E9",borderRadius:"8px 8px 0 0",display:"flex",alignItems:"center",minHeight:"40px",overflow:"hidden",minWidth:0}},{children:i(v,n({title:gt,placement:"top"},{children:i(p,n({sx:{fontSize:"16px",fontWeight:500,color:"#19213D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0,textAlign:"center",display:"block"}},{children:gt}))}))})),t(a,n({ref:Ke,onScroll:Pi,sx:n({p:"12px",display:"flex",flexDirection:"column"},qn?{maxHeight:"calc(100vh - 150px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,mr:"-160px",pr:"172px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[i("div",{ref:qe,style:{width:"100%",height:"0px",flexShrink:0}}),wt&&bt.map(function(e,o){var r,l,u=!e.title&&!e.content;if(qn&&u)return null;var c=e,d=Bi(o,"left"),s=qn?!(null===(r=c.refIndexes)||void 0===r?void 0:r.length)||c.selfIndex<0:!St[o],v=qn?"number"==typeof c.selfIndex&&c.selfIndex>=0?c.selfIndex+1:null:o+1,p=he.has(o),f=y(c.evaluationResult,null==d?void 0:d.deviationLabel);return i(a,n({ref:Ht(o),sx:{mb:1,width:"100%"}},{children:t(a,n({sx:{position:"relative",width:"100%"}},{children:[i(a,n({ref:Ft.current[o],sx:n({width:"100%",display:"flex",flexDirection:"column",minWidth:0},p&&{borderRadius:"6px",outline:"2px solid ".concat((null==d?void 0:d.badgeBorder)||"#6366F1"),outlineOffset:"1px"})},{children:i(V,{section:e,idx:o,columnKey:"left",colRef:Ht("left-accordion-".concat(o)),mb:0,treeData:wn,proposedSections:bt,existingSections:St,deviationNumberRegistry:It,getSectionCompareStyle:Bi,getBadgeRef:Ot,connectedSections:he,openMoreFunctionsPopup:li,openSummaryPopup:Wi,deviationNodeIdToView:null==jn?void 0:jn.id,deviationTargetParentId:Ji,parentNodeId:(null===(l=null==wn?void 0:wn.input_index_map)||void 0===l?void 0:l[0])||"",isExpanded:qn?!!Zt["left-".concat(o)]:!!Zt[String(o)],onToggle:function(){Yi(),ii(o,"left")},navigation:e.id?Xi[e.id]:null,showOpenNodeRef:$i,resolvedMarkdownStyles:je,maintainRelativeOrder:qn,showDeviationBadges:Kn,renderSubSections:Qi,isProposingFix:On,proposingFixNodeId:zn,collisionKey:"".concat(te?"1":"0","-").concat(String(null!=ve?ve:""))})})),qn&&d&&t(a,n({ref:At.current[o],onClick:function(n){var e,t,i,r=Mn.enableDeviationSchemaBackwardCompatibility?null!==(e=c.evaluationResult)&&void 0!==e?e:null:null!==(i=null===(t=c.evaluationResult)||void 0===t?void 0:t[0])&&void 0!==i?i:null;Wi(n,String(o),s,r)},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:[t(a,n({component:"span",onClick:function(n){var e,t,i;n.stopPropagation();var r=Mn.enableDeviationSchemaBackwardCompatibility?null!==(e=c.evaluationResult)&&void 0!==e?e:null:null!==(i=null===(t=c.evaluationResult)||void 0===t?void 0:t[0])&&void 0!==i?i:null;Wi(n,String(o),s,r)},sx:{display:"inline-flex",alignItems:"center",gap:"4px",px:.2,cursor:s?"default":"pointer",borderRight:"1px solid ".concat(d.badgeBorder),"&:hover":s?{}:{bgColor:"".concat(d.badgeBorder,"22")}}},{children:[null!=v&&i(a,n({component:"span",sx:{fontSize:"11px",fontWeight:700,pr:.5,borderRight:"1px solid ".concat(d.badgeBorder)}},{children:v})),i(a,n({component:"span",sx:{fontSize:"11px",px:.25}},{children:!Mn.isLoading||null!=c.evaluationResult&&null!=c.evaluationResult?"N/A"===f||"NA"===f?"N/A":0==f||null==f?"Same":"".concat(f):i(L,{color:d.badgeText})}))]})),i(a,n({component:"span",onClick:function(n){n.stopPropagation();var t=qn?St.find(function(n){var e;return(null===(e=c.refIndexes)||void 0===e?void 0:e.includes(n))||{title:"",content:""}}):St[o]||{title:"",content:""};li(n,e,s,t,o,d)},sx:{display:"inline-flex",alignItems:"center",px:.2,cursor:"pointer","&:hover":{bgcolor:"".concat(d.badgeBorder,"22")}}},{children:i(g,{size:11,color:d.badgeText})}))]}))]}))}),"left-row-".concat(o))}),i("div",{ref:Ye,style:{width:"100%",height:"0px",flexShrink:0}})]}))]})),i(a,n({ref:pi,sx:{width:"180px",display:"flex",flexDirection:"column",alignItems:"center",pt:"15px",gap:0,zIndex:20,pointerEvents:"none"}},{children:i(a,n({sx:{display:"flex",justifyContent:"center",alignItems:"center",mt:0}},{children:t(a,n({onClick:function(e){e.stopPropagation(),Ue.open&&tt===Yt?ct():(lt(Yt),ri(oi(e.currentTarget,{title:"",content:"",evaluationResult:Kt,cognitiveData:{section_id:"",decisioning:[],gap:[],relevance_score:0,isMissingRationale:!0}},null,Yt,!0,n(n({},Xt),{label:""}))))},sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:"5px",top:"-8px",borderRadius:"20px",bgcolor:Xt.badgeBg,color:Xt.badgeText,border:"1px solid ".concat(Xt.badgeBorder),fontSize:"12px",fontWeight:600,whiteSpace:"nowrap",position:"relative",zIndex:1,pointerEvents:"auto",cursor:"pointer"}},{children:[null!=Vt?Vt:i(L,{}),i(a,n({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:i(h,{})})),i(f,{size:11,style:{transform:Ue.open&&tt===Yt?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))})),t(a,n({sx:n({border:"1px solid #E3E6EA",borderRadius:"8px",bgcolor:"#FFFFFF",boxShadow:"0px 1px 4px #F7F4FE",position:"relative",zIndex:2,display:"flex",flexDirection:"column",minWidth:0},qn?{flex:1,overflow:"visible",minHeight:0}:{})},{children:[Un&&i(m,{sections:11}),i(a,n({ref:mi,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E3E6EA",borderRadius:"8px 8px 0 0",minHeight:"40px",display:"flex",alignItems:"center",overflowX:"hidden"}},{children:i(v,n({title:ht,placement:"top"},{children:i(p,n({sx:{fontSize:"16px",fontWeight:500,color:"#5928ED",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0,textAlign:"center",display:"block"}},{children:ht}))}))})),t(a,n({ref:Oe,onScroll:Pi,sx:n({p:"12px",display:"flex",flexDirection:"column"},qn?{maxHeight:"calc(100vh - 150px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,ml:"-120px",pl:"140px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[i("div",{ref:ze,style:{width:"100%",height:"0px",flexShrink:0}}),wt&&St.map(function(e,o){var r,l=e,u=[],c=!1,d=null,s=-1;if(qn){u=bt.filter(function(n){var e;return(null===(e=n.refIndexes)||void 0===e?void 0:e.includes(l.selfIndex))&&n.selfIndex>=0}).map(function(n){return n.selfIndex+1}),s=bt.findIndex(function(n){var e;return(null===(e=n.refIndexes)||void 0===e?void 0:e.includes(l.selfIndex))&&n.selfIndex>=0});var v=bt.findIndex(function(n,e){var t;return he.has(e)&&(null===(t=n.refIndexes)||void 0===t?void 0:t.includes(l.selfIndex))});(c=-1!==v)&&(d=Bi(v))}else u=[o+1],(c=he.has(o))&&(d=Bi(o));var p=Bi(qn&&-1!==s?s:o);return i(a,n({ref:Nt.current[o],sx:{mb:1,width:"100%"}},{children:t(a,n({sx:{position:"relative",width:"100%"}},{children:[i(a,n({ref:Dt.current[o],sx:n({width:"100%",display:"flex"},c&&d&&{borderRadius:"6px",outline:"2px solid ".concat(d.badgeBorder),outlineOffset:"1px"})},{children:i(V,{section:e,idx:o,columnKey:"right",colRef:Ht("right-accordion-".concat(o)),mb:0,parentNodeId:(null===(r=null==wn?void 0:wn.input_index_map)||void 0===r?void 0:r[1])||"",isExpanded:qn?!!Zt["right-".concat(o)]:!!Zt[String(o)],treeData:wn,proposedSections:bt,existingSections:St,deviationNumberRegistry:It,getBadgeRef:Ot,getSectionCompareStyle:Bi,connectedSections:he,openMoreFunctionsPopup:li,openSummaryPopup:Wi,deviationNodeIdToView:null==jn?void 0:jn.id,deviationTargetParentId:Ji,onToggle:function(){Yi(),ii(o,"right")},navigation:e.id?Xi[e.id]:null,showOpenNodeRef:$i,resolvedMarkdownStyles:je,maintainRelativeOrder:qn,showDeviationBadges:Kn,renderSubSections:Qi,isProposingFix:On,proposingFixNodeId:zn,collisionKey:"".concat(te?"1":"0","-").concat(String(null!=ve?ve:""))})})),qn&&p&&i(a,n({ref:Mt.current[o],"data-section-id":l.id,sx:{position:"absolute",top:"18px",left:0,transform:"translateY(-50%) translateX(calc(-100% - 8px))",display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:"11px",bgcolor:p.badgeBg,color:p.badgeText,border:"1px solid ".concat(p.badgeBorder),borderRadius:"10px",px:1,py:.3,fontWeight:700,whiteSpace:"nowrap",zIndex:20}},{children:u.length>0?u.join(", "):"-"}))]}))}),"right-row-".concat(o))}),i("div",{ref:We,style:{width:"100%",height:"0px",flexShrink:0}})]}))]}))]}))}))}))]}))};export{U as default};
|
|
1
|
+
import{__assign as n,__spreadArray as e}from"tslib";import{jsxs as t,jsx as i,Fragment as o}from"react/jsx-runtime";import{useState as r,useRef as l,useMemo as u,useEffect as c,useCallback as a}from"react";import{Box as d,Snackbar as s,Alert as v,Tooltip as p,Typography as f}from"@mui/material";import{ChevronDown as g,EllipsisVertical as h}from"lucide-react";import{ButtonCognitiveIcon as x}from"../../assests/svg/ButtonCognitiveIcon.js";import m from"./OverlayComponent.js";import{safeStringify as y,extractDeviationScore as b,generateColorPalette as S,DEVIATION_BADGE_SEPARATOR as R,findKeyPathByNodeId as C,getFirstDeviationOutputValue as I,getFirstDeviationColor as B,hasValue as w,getBentArrowPath as T,smoothScrollTo as _,resetClauseHighlight as E,scrollAndHighlightClause as F}from"./CognitiveComparehelpers.js";import{SHARED_MARKDOWN_STYLES as D,DEFAULT_FIELD_CONFIG as N,DEFAULT_COMPARISON_CONFIG as M}from"./CognitiveCompareConfig.js";export{SHARED_MARKDOWN_STYLES}from"./CognitiveCompareConfig.js";import{EMPTY_SUMMARY_POPUP_STATE as A,DEFAULT_DEVIAION_COLOR as k,DEFAULT_COMPONENT_HEADER_TEXT as P}from"./CognitiveCompareConstants.js";import j from"./CognitivePopup.js";import H from"./MoreFunctionsPopup.js";import L from"./LoaderComponent.js";import O from"./components/ThreeDotsLoader.js";import{useCognitiveTreeData as z}from"./hooks/useCompareData.js";import{useComparePopups as W}from"./hooks/useComparePopups.js";import{useSectionRefs as q}from"./hooks/useSectionRefs.js";import{useAccordionState as Y}from"./hooks/useAccordionState.js";import{useDeviationNavigation as K}from"./hooks/useDeviationNavigation.js";import V from"./components/CompareHeader.js";import X from"./components/SectionAccordion.js";import $ from"./components/SubSectionAccordion.js";import J from"./components/CognitiveSummaryPopup.js";import U from"./components/connectedLines.js";var G=function(G){var Q,Z,nn,en,tn,on,rn,ln,un,cn,an,dn,sn,vn,pn,fn,gn,hn,xn,mn,yn,bn,Sn,Rn,Cn,In,Bn=G.componentHeaderText,wn=void 0===Bn?P:Bn,Tn=G.treeData,_n=G.comparisonConfig,En=G.leftColumnTitleText,Fn=G.rightColumnTitleText,Dn=G.markdownStyles,Nn=G.resetTrigger,Mn=G.displayConfig,An=void 0===Mn?{isHeaderVisible:!0,isToggleVisible:!0,maintainRelativeOrder:!1,isLoading:!0,showDeviationBadges:!1,enableDeviationSchemaBackwardCompatibility:!1}:Mn,kn=G.popupConfig,Pn=G.deviationData,jn=void 0===Pn?{}:Pn,Hn=G.deviationNodeIdToView,Ln=G.resetDeviationNodeId,On=G.isProposingFix,zn=void 0!==On&&On,Wn=G.proposingFixNodeId,qn=r(An.maintainRelativeOrder),Yn=qn[0],Kn=qn[1],Vn=!!Yn||!!(null==An?void 0:An.showDeviationBadges),Xn=r(!1),$n=Xn[0],Jn=Xn[1],Un=r(!1),Gn=Un[0],Qn=Un[1],Zn=r(null),ne=Zn[0],ee=Zn[1],te=r(!1),ie=te[0],oe=te[1],re=r(null===(Z=null!==(Q=null==Tn?void 0:Tn.newEvaluationResult)&&void 0!==Q?Q:null==An?void 0:An.enableDeviationSchemaBackwardCompatibility)||void 0===Z||Z)[0],le=r(!1),ue=le[0],ce=le[1],ae=r(!1),de=ae[0],se=ae[1],ve=r(null),pe=ve[0],fe=ve[1],ge=l(!1),he=r(new Set),xe=he[0],me=he[1],ye=r([]),be=ye[0],Se=ye[1],Re=l(null),Ce=l(null),Ie=l(null),Be=l(new Set),we=l(!1),Te=l(null),_e=l({}),Ee=l([]),Fe=l(!1),De=l(!1),Ne=l(null),Me=l(function(){}),Ae=u(function(){return(null==Tn?void 0:Tn.cognitive_decisioning)||{}},[Tn]),ke=r({width:0,height:0}),Pe=ke[0],je=ke[1],He=u(function(){return n(n({},D),Dn)},[Dn]),Le=l(null),Oe=l(null),ze=l(null),We=l(null),qe=l(null),Ye=l(null),Ke=l(null),Ve=l(null),Xe=l(!1),$e=l(null),Je=l(null),Ue=W(Le),Ge=Ue.cognitivePopup,Qe=Ue.setCognitivePopup,Ze=Ue.moreFunctions,nt=Ue.setMoreFunctions,et=Ue.position,tt=Ue.setPosition,it=Ue.activeBadgeId,ot=Ue.summaryPopup,rt=Ue.setSummaryPopup,lt=Ue.closeSummaryPopup,ut=Ue.setActiveBadgeId,ct=Ue.popupRef,at=Ue.closeCognitivePopup,dt=Ue.closeMoreFunctionsPopup,st=u(function(){var n,e,t,i,o,r,l;return{fields:null!==(n=null==_n?void 0:_n.fields)&&void 0!==n?n:N,thresholds:{high:null!==(t=null===(e=null==_n?void 0:_n.thresholds)||void 0===e?void 0:e.high)&&void 0!==t?t:M.thresholds.high,medium:null!==(o=null===(i=null==_n?void 0:_n.thresholds)||void 0===i?void 0:i.medium)&&void 0!==o?o:M.thresholds.medium,exact:null!==(l=null===(r=null==_n?void 0:_n.thresholds)||void 0===r?void 0:r.exact)&&void 0!==l?l:M.thresholds.exact}}},[_n]),vt=r(null),pt=vt[0];vt[1];var ft=null===(tn=null===(nn=null==Tn?void 0:Tn.documents)||void 0===nn?void 0:nn[null===(en=null==Tn?void 0:Tn.input_index_map)||void 0===en?void 0:en[0]])||void 0===tn?void 0:tn.title,gt=null===(ln=null===(on=null==Tn?void 0:Tn.documents)||void 0===on?void 0:on[null===(rn=null==Tn?void 0:Tn.input_index_map)||void 0===rn?void 0:rn[1]])||void 0===ln?void 0:ln.title,ht=y(En||ft||"Uploaded Contract"),xt=y(Fn||gt||"Reference Template"),mt=z(Tn,Yn,jn,st,re),yt=mt.activeProposed,bt=mt.existingRule,St=mt.proposedSections,Rt=mt.existingSections,Ct=mt.visibleFields,It=mt.parentDeviationRecord,Bt=mt.deviationNumberRegistry,wt=mt.parseError;c(function(){wt&&ee("Failed to load comparison: ".concat(wt))},[wt]);var Tt=St.length>0||Rt.length>0,_t=u(function(){var n=new Map,e=new Map,t=1;if(Yn)St.forEach(function(e){!e.title&&!e.content||e.id&&n.set(e.id,t++)}),Rt.forEach(function(i){if(i.id){var o=St.filter(function(n){var e;return null===(e=n.refIndexes)||void 0===e?void 0:e.includes(i.selfIndex)});if(o.length>0){var r=o.map(function(e){return n.get(e.id)}).filter(Boolean);e.set(i.id,r.join(", "))}else e.set(i.id,String(t++))}});else for(var i=Math.max(St.length,Rt.length),o=0;o<i;o++){var r=St[o],l=Rt[o];r?(n.set(r.id,t),l&&e.set(l.id,String(t)),t++):l&&e.set(l.id,String(t++))}return{leftNums:n,rightNums:e}},[St,Rt,Yn]),Et=q(Ct.map(function(n){return n.key}),Math.max(St.length,Rt.length)),Ft=Et.leftRefs,Dt=Et.rightRefs,Nt=Et.sectionLeftRefs,Mt=Et.sectionRightRefs,At=Et.lhsBadgeRefs,kt=Et.rhsBadgeRefs,Pt=Et.sectionRightRowRefs,jt=Et.subSectionLeftRefs,Ht=Et.subSectionRightRefs,Lt=Et.sectionRowRefs,Ot=Et.getSectionRowRef,zt=Et.getSubSectionRef,Wt=Et.getBadgeRef,qt=bt.analysis,Yt=y(null===(cn=null===(un=null==qt?void 0:qt.rule_difference_comparison)||void 0===un?void 0:un.summary)||void 0===cn?void 0:cn.overall_summary),Kt=!!Yt.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),Vt=null!==(an=null==Tn?void 0:Tn.base_root_id)&&void 0!==an?an:"-1";null==Tn||Tn[Vt];var Xt=re?null!==(Sn=null!==(mn=jn&&(null===(xn=null==jn?void 0:jn[Vt])||void 0===xn?void 0:xn.evaluation_result))&&void 0!==mn?mn:null===(bn=null===(yn=null==Tn?void 0:Tn.nodes)||void 0===yn?void 0:yn[Vt])||void 0===bn?void 0:bn.evaluation_result)&&void 0!==Sn?Sn:null:null!==(hn=null!==(vn=jn&&(null===(sn=null===(dn=null==jn?void 0:jn[Vt])||void 0===dn?void 0:dn.evaluation_result)||void 0===sn?void 0:sn[0]))&&void 0!==vn?vn:null===(gn=null===(fn=null===(pn=null==Tn?void 0:Tn.nodes)||void 0===pn?void 0:pn[Vt])||void 0===fn?void 0:fn.evaluation_result)||void 0===gn?void 0:gn[0])&&void 0!==hn?hn:null,$t=b(Xt),Jt=S(null!==(In=null===(Cn=null===(Rn=null==Xt?void 0:Xt.evaluation_outputs)||void 0===Rn?void 0:Rn.metadata)||void 0===Cn?void 0:Cn.label_color)&&void 0!==In?In:""),Ut=function(){Be.current.forEach(function(n){E(n)}),Be.current.clear()},Gt=a(function(){var n,e,t,i,o,r;Ut(),oe(!1),De.current=!1,Ce.current=null;var l=Ne.current,u=hi.current;if(null!==l)if("string"==typeof l&&l.includes(R)){var c=l.split(R);(a=(null===(n=jt.current[c[2]])||void 0===n?void 0:n.current)||(null===(e=Nt.current[Number(c[2])])||void 0===e?void 0:e.current))&&(a.style.paddingTop="0px")}else{var a;(a=null===(t=Nt.current[l])||void 0===t?void 0:t.current)&&(a.style.paddingTop="0px")}if(null!==u)if("string"==typeof u&&u.includes(R)){c=u.split(R);(d=(null===(i=Ht.current[c[3]])||void 0===i?void 0:i.current)||(null===(o=Mt.current[Number(c[3])])||void 0===o?void 0:o.current))&&(d.style.paddingTop="0px")}else{var d;(d=null===(r=Mt.current[u])||void 0===r?void 0:r.current)&&(d.style.paddingTop="0px")}fe(null),Ne.current=null,hi.current=null,ce(!1),Qn(!1),We.current&&(We.current.style.height="0px"),qe.current&&(qe.current.style.height="0px"),Ye.current&&(Ye.current.style.height="0px"),Ke.current&&(Ke.current.style.height="0px")},[]),Qt=a(function(){Ut(),Gt(),me(new Set),Se([]),Ee.current=[],Ri([]),Bi(null),rt(A),at(),requestAnimationFrame(function(){var n;null===(n=Me.current)||void 0===n||n.call(Me)})},[]),Zt=l(Qt);c(function(){Zt.current=Qt},[Qt]),c(function(){Nn&&Zt.current()},[Nn]);var ni=Y({maintainRelativeOrder:!!Yn,proposedSections:St,existingSections:Rt,activeSideBySideSection:pe,connectedSections:xe,resetSideBySide:Gt,setConnectedSections:me,setConnectedLines:Se,cachedConnectedPositions:Ee,svgContainerRef:Re,isAnimatingRef:we,animationTimerRef:Te,calculateLinesRef:Me,sectionLeftRefs:Nt,sectionRightRefs:Mt,subSectionLeftRefs:jt,subSectionRightRefs:Ht}),ei=ni.expandedSections,ti=ni.setExpandedSections,ii=ni.expandedSubSections,oi=ni.setExpandedSubSections,ri=ni.toggleSection,li=a(function(e,t,i,o,r,l,u){var c,a,d,s=y(null==t?void 0:t.id)||y(null==i?void 0:i.id)||"",v=(s?Ae[s]:null)||(null==t?void 0:t.cognitiveData)||(null==i?void 0:i.cognitiveData)||{section_id:s,decisioning:[],gap:[],relevance_score:0},p=null!==(a=null===(c=Lt.current[o])||void 0===c?void 0:c.current)&&void 0!==a?a:null;return{isLoading:null!==(d=null==An?void 0:An.isLoading)&&void 0!==d&&d,open:!0,sectionTitle:(null==t?void 0:t.displayTitle)?null==t?void 0:t.title:"No Counterpart",refSectionTitle:(null==i?void 0:i.displayTitle)?null==i?void 0:i.title:"No Counterpart",cognitiveData:v,anchorEl:e,sectionAnchorEl:p,badgeStyle:l||null,sectionIdx:o,docData:{documents:null==Tn?void 0:Tn.documents,input_index_map:null==Tn?void 0:Tn.input_index_map},deviationData:function(){var e,r,l=(null==t?void 0:t.evaluationResult)||(null==i?void 0:i.evaluationResult)||null,u=function(e){var t=function(n){if(!n||"object"!=typeof n)return null;var e=null==n?void 0:n.deviation_entries;if(e&&"object"==typeof e){var t=Object.keys(e).sort(function(n,e){return Number(n)-Number(e)})[0];if(t&&e[t])return e[t]}var i=Object.keys(n).filter(function(n){return/^\d+$/.test(n)}).sort(function(n,e){return Number(n)-Number(e)});if(i.length&&n[i[0]])return n[i[0]];var o=null==n?void 0:n.deviations;if(o&&"object"==typeof o){var r=Object.keys(o).sort(function(n,e){return Number(n)-Number(e)})[0];if(r&&o[r])return o[r]}return null}(e);return t?n(n({},e),{deviation_summary:(null==e?void 0:e.deviation_summary)||(null==t?void 0:t.deviation_summary),deviation_title:(null==e?void 0:e.deviation_title)||(null==t?void 0:t.deviation_title),deviation_impact:(null==e?void 0:e.deviation_impact)||(null==t?void 0:t.deviation_impact),deviation_explanation:(null==e?void 0:e.deviation_explanation)||(null==t?void 0:t.deviation_explanation),evaluation_outputs:(null==e?void 0:e.evaluation_outputs)||(null==t?void 0:t.evaluation_outputs),cognitive_decisioning:(null==e?void 0:e.cognitive_decisioning)||(null==t?void 0:t.cognitive_decisioning)}):e};if(!("string"==typeof o&&o.includes(R)))return u(l);var c=o.split(R)[1];if(!c)return l;var a=(null==t?void 0:t.evaluationResult)||(null==i?void 0:i.evaluationResult)||{},d=(null===(e=null==a?void 0:a.deviation_entries)||void 0===e?void 0:e[c])||(null===(r=null==a?void 0:a.deviations)||void 0===r?void 0:r[c])||null;return d?n(n(n({},a),d),{deviation_summary:(null==d?void 0:d.deviation_summary)||(null==a?void 0:a.deviation_summary),deviation_title:(null==d?void 0:d.deviation_title)||(null==a?void 0:a.deviation_title),deviation_impact:(null==d?void 0:d.deviation_impact)||(null==a?void 0:a.deviation_impact),deviation_explanation:(null==d?void 0:d.deviation_explanation)||(null==a?void 0:a.deviation_explanation),evaluation_outputs:(null==d?void 0:d.evaluation_outputs)||(null==a?void 0:a.evaluation_outputs),cognitive_decisioning:(null==d?void 0:d.cognitive_decisioning)||(null==a?void 0:a.cognitive_decisioning)}):u(l)}(),isOrphan:!!r}},[Ae,Tn]),ui=a(function(n){dt(),tt(null),Qe(n)},[dt]),ci=function(n,e,t,i,o,r){var l;if(n.stopPropagation(),Ze.open&&Ze.sectionIdx===o)dt();else{var u=n.currentTarget,c="left";(null===(l=ze.current)||void 0===l?void 0:l.contains(u))&&(c="right");Ut(),De.current&&Gt(),me(new Set),Se([]),Ee.current=[],at(),ot.open?Vi():lt(),requestAnimationFrame(function(){var n=function(){var n,e,t,i;if("string"==typeof o&&o.includes(R)){var r=o.split(R),l="".concat(r[0]).concat(R).concat(r[1]);return"right"===c?null===(n=kt.current[l])||void 0===n?void 0:n.current:null===(e=At.current[l])||void 0===e?void 0:e.current}return"right"===c?null===(t=kt.current[o])||void 0===t?void 0:t.current:null===(i=At.current[o])||void 0===i?void 0:i.current}()||u;nt(li(n,e,i,o,t,r))})}},ai=a(function(){null!==Ze.sectionIdx&&Ze.anchorEl?ui(n(n({},Ze),{open:!0})):dt()},[Ze,dt,ui]),di=a(function(){var n=Ze.sectionIdx,e=Ze.isOrphan;dt(),lt(),null!==n&&(e?ee("No counterpart exists to connect to."):(Ut(),De.current&&Gt(),Se([]),Ee.current=[],me(function(e){return e.has(n)?new Set:new Set([n])}),setTimeout(function(){Me.current&&Me.current()},50)))},[Ze.sectionIdx,Ze.isOrphan,dt,lt,Gt]),si=a(function(){var n=Ie.current;if(n){Ie.current=null;var e=St.findIndex(function(e){return e.id===n}),t=Rt.findIndex(function(e){return e.id===n}),i=-1===e?C(St,n):null,o=-1===t?C(Rt,n):null,r=-1!==e?e:i?Number(i.split("-")[0]):-1,l=-1!==t?t:o?Number(o.split("-")[0]):-1,u=function(n,e,t,i){var o,r,l,u;return-1!==n?null!==(r=null===(o=t.current[n])||void 0===o?void 0:o.current)&&void 0!==r?r:null:e&&null!==(u=null===(l=i.current[e])||void 0===l?void 0:l.current)&&void 0!==u?u:null},c=function(n,e,t){void 0===t&&(t=30);var i=0,o=function(){var r=n();r&&0!==r.getBoundingClientRect().height?(Be.current.add(r),F(r,e)):i++<t&&requestAnimationFrame(o)};requestAnimationFrame(o)};if(Yn)-1!==r&&Ve.current&&c(function(){return u(e,i,Nt,jt)},Ve.current),-1!==l&&ze.current&&c(function(){return u(t,o,Mt,Ht)},ze.current);else{var a=Le.current;if(!a)return;c(function(){return-1!==r?u(e,i,Nt,jt):u(t,o,Mt,Ht)},a)}}},[St,Rt,Yn,Nt,Mt,jt,Ht,Ve,ze,Le]),vi=a(function(e){if(e){Ut(),Gt(),me(new Set),Se([]),Ee.current=[],lt(),at();var t=St.findIndex(function(n){return n.id===e}),i=Rt.findIndex(function(n){return n.id===e}),o=-1===t?C(St,e):null,r=-1===i?C(Rt,e):null;if(-1!==t||o||-1!==i||r){var l=-1!==t?t:o?Number(o.split("-")[0]):-1,u=-1!==i?i:r?Number(r.split("-")[0]):-1;Ie.current=e,ti(function(e){var t,i=n({},e),o=!1;-1!==l&&(i[t=Yn?"left-".concat(l):String(l)]||(i[t]=!0,o=!0));-1!==u&&(i[t=Yn?"right-".concat(u):String(u)]||(i[t]=!0,o=!0));return o?i:e}),oi(function(e){var t=n({},e),i=!1,l=function(n){for(var e=n.split("-"),o=e[0],r=1;r<e.length;r++)o+="-".concat(e[r]),t[o]||(t[o]=!0,i=!0)};return o&&l(o),r&&l(r),i?t:e}),setTimeout(function(){requestAnimationFrame(function(){Ie.current===e&&pi.current()})},50)}else console.warn('scrollToAndHighlightClause: nodeId "'.concat(e,'" not found'))}},[St,Rt,Yn,ti,oi,Gt,lt,at]),pi=l(si);c(function(){pi.current=si},[si]);var fi=l(null),gi=l(null),hi=l(null),xi=l(null),mi=l(null),yi=l(null),bi=r([]),Si=bi[0],Ri=bi[1];l(null);var Ci=r(null),Ii=Ci[0],Bi=Ci[1];c(function(){if(pt){var n=st.fields.find(function(n){return n.analysisKey===pt||n.key===pt});if(n){var e=Ft.current[n.key]||Dt.current[n.key];(null==e?void 0:e.current)&&setTimeout(function(){return e.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[pt,st.fields]);var wi=a(function(n){var e,t,i,o,r,l,u,c,a,d=null===(e=null==qt?void 0:qt.rule_difference_comparison)||void 0===e?void 0:e.fields;if(!d||!d[n])return{score:0,relation:"",highlightsA:[],highlightsB:[],hasContent:!1};var s=d[n],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===(u=p.highlights)||void 0===u?void 0:u.ruleB_spans)||[],hasContent:!!v}}return{score:s.score,relation:s.relation||"",highlightsA:(null===(c=s.highlights)||void 0===c?void 0:c.ruleA_spans)||[],highlightsB:(null===(a=s.highlights)||void 0===a?void 0:a.ruleB_spans)||[],hasContent:!!v}},[qt]),Ti=a(function(e,t){var i,o,r;void 0===t&&(t="left");var l=null,u=null;if("left"===t)if(l=St[e],Yn&&l){var c=Rt.filter(function(n){var e;return null===(e=l.refIndexes)||void 0===e?void 0:e.includes(n.selfIndex)});u=c.find(function(n){return n.evaluationResult})||c[0]}else u=Rt[e];else if(u=Rt[e],Yn&&u){var a=St.filter(function(n){var e;return null===(e=n.refIndexes)||void 0===e?void 0:e.includes(u.selfIndex)});l=a.find(function(n){return n.evaluationResult})||a[0]}else l=St[e];var d=(null==l?void 0:l.relation)&&"not_defined"!==l.relation,s=(null==u?void 0:u.relation)&&"not_defined"!==u.relation,v=!(!(null==l?void 0:l.cognitiveData)&&!(null==u?void 0:u.cognitiveData));if(!d&&!s&&!v)return n(n({},S(k)),{label:"Not Defined"});var p=null!==(o=null!==(i=null==l?void 0:l.evaluationResult)&&void 0!==i?i:null==u?void 0:u.evaluationResult)&&void 0!==o?o:null,f=I(p),g=B(p);return n(n({},S(g)),null!=p?{label:null!==(r=f)&&void 0!==r?r:""}:{label:null})},[St,Rt,Ae,st,Yn]),_i=a(function(e){for(var t,i,o,r,l,u=e.split("-").map(Number),c=St[u[0]],a=Rt[u[0]],d=1;d<u.length;d++)(null==c?void 0:c.subsections)&&(c=c.subsections[u[d]]),(null==a?void 0:a.subsections)&&(a=a.subsections[u[d]]);if(!c&&!a)return null;var s=(null==c?void 0:c.relation)&&"not_defined"!==c.relation,v=(null==a?void 0:a.relation)&&"not_defined"!==a.relation,p=y(null==c?void 0:c.id)||y(null==a?void 0:a.id)||"",f=!(!(null==c?void 0:c.cognitiveData)&&!(null==a?void 0:a.cognitiveData));if(!s&&!v&&!f)return n(n({},S(k)),{label:"Not Defined"});null!==(i=null!==(t=null==c?void 0:c.cognitiveRelevanceScore)&&void 0!==t?t:null==a?void 0:a.cognitiveRelevanceScore)&&void 0!==i||p&&(null===(o=Ae[p])||void 0===o||o.relevance_score);var g=null!==(l=null!==(r=null==c?void 0:c.evaluationResult)&&void 0!==r?r:null==a?void 0:a.evaluationResult)&&void 0!==l?l:null,h=I(g),x=B(g);return n(n({},S(x)),null!=g?{label:null!=h?h:""}:{label:null})},[St,Rt,Ae,st]),Ei=a(function(e,t){var i,o,r,l,u,c,a,d,s,v,p,f,g,h,x,m,y;if(!e||null==t)return null;var b=null!==(a=null!==(u=null!==(o=null===(i=null==jn?void 0:jn[e])||void 0===i?void 0:i.evaluation_result)&&void 0!==o?o:null===(l=null===(r=null==Tn?void 0:Tn.nodes)||void 0===r?void 0:r[e])||void 0===l?void 0:l.evaluation_result)&&void 0!==u?u:null===(c=null==Tn?void 0:Tn[e])||void 0===c?void 0:c.evaluation_result)&&void 0!==a?a:null;if(!b||"object"!=typeof b)return null;var R=null!==(p=null!==(s=null===(d=null==b?void 0:b.deviations)||void 0===d?void 0:d[t])&&void 0!==s?s:null===(v=null==b?void 0:b.deviation_entries)||void 0===v?void 0:v[t])&&void 0!==p?p:null==b?void 0:b[t],C=null!==(y=null!==(h=null===(g=null===(f=null==R?void 0:R.evaluation_outputs)||void 0===f?void 0:f.metadata)||void 0===g?void 0:g.label_color)&&void 0!==h?h:null===(m=null===(x=null==b?void 0:b.evaluation_outputs)||void 0===x?void 0:x.metadata)||void 0===m?void 0:m.label_color)&&void 0!==y?y:k;return n(n({},S(C)),{label:null})},[jn,Tn]),Fi=a(function(){Ut(),ti({}),oi({}),Gt(),me(new Set),Se([]),Ee.current=[],lt(),at(),dt(),requestAnimationFrame(function(){Me.current&&Me.current()})},[ti,oi,Gt,lt,at,dt]),Di=u(function(){return Object.values(ei).some(Boolean)||Object.values(ii).some(Boolean)},[ei,ii]),Ni=a(function(){var n,e,t,i,o,r,l,u,c,a,d,s,v,p,f,g,h,x,m,y,b,S,C;if(!Xe.current&&!we.current){Xe.current=!0;try{if(!fi.current)return;var I=function(n){var e=n.split("-"),t=e[0];if(!ei[t]&&!1===Yn)return!1;if(Yn&&!ei["left-".concat(t)]&&!ei["right-".concat(t)]&&!ei[t])return!1;for(var i=t,o=1;o<e.length-1;o++)if(i+="-".concat(e[o]),!ii[i])return!1;return!0},B=fi.current.getBoundingClientRect();je({width:B.width,height:B.height});var _=[];if(Ct.forEach(function(n){var e,t,i=n.key,o=null===(e=Ft.current[i])||void 0===e?void 0:e.current,r=null===(t=Dt.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")}),!we.current){for(var E=0;E<Math.max(St.length,Rt.length);E++){var F=null===(n=Nt.current[E])||void 0===n?void 0:n.current,D=null===(e=Mt.current[E])||void 0===e?void 0:e.current;F&&(F.style.height="auto",F.style.minHeight="0px"),D&&(D.style.height="auto",D.style.minHeight="0px")}Yn||Object.keys(jt.current).forEach(function(n){var e,t;if(I(n)){var i=null===(e=jt.current[n])||void 0===e?void 0:e.current,o=null===(t=Ht.current[n])||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 N={};Ct.forEach(function(n){var e,t,i=n.key,o=null===(e=Ft.current[i])||void 0===e?void 0:e.current,r=null===(t=Dt.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=o.getBoundingClientRect(),u=r.getBoundingClientRect();N[i]=Math.max(l.height,u.height)}});var M={left:{},right:{}},A={};if(!we.current)if(Yn){if(ie&&null!==pe)if("number"==typeof pe){var k=pe,P=St[k],j=null===(o=Nt.current[k])||void 0===o?void 0:o.current;j&&P&&(P.refIndexes||[]).forEach(function(n){var e,t=Rt.findIndex(function(e){return e.selfIndex===n}),i=null===(e=Mt.current[t])||void 0===e?void 0:e.current;if(i&&(ei["left-".concat(k)]||ei["right-".concat(t)])){var o=Math.max(j.getBoundingClientRect().height,i.getBoundingClientRect().height);M.left[k]=Math.max(M.left[k]||0,o),M.right[t]=Math.max(M.right[t]||0,o)}})}else{var H=pe.split(R)[2];if(H){F=null===(r=jt.current[H])||void 0===r?void 0:r.current,D=null===(l=Ht.current[H])||void 0===l?void 0:l.current;if(F&&D){L=Math.max(F.getBoundingClientRect().height,D.getBoundingClientRect().height);A[H]=Math.max(A[H]||0,L)}}}}else{Object.keys(jt.current).forEach(function(n){var e,t;if(I(n)){var i=null===(e=jt.current[n])||void 0===e?void 0:e.current,o=null===(t=Ht.current[n])||void 0===t?void 0:t.current;if(i&&o&&null!==i.offsetParent&&null!==o.offsetParent){var r=i.getBoundingClientRect(),l=o.getBoundingClientRect(),u=Math.max(r.height,l.height);A[n]=u,i.style.minHeight="".concat(u,"px"),o.style.minHeight="".concat(u,"px")}}});for(E=0;E<Math.min(St.length,Rt.length);E++){var F=null===(t=Nt.current[E])||void 0===t?void 0:t.current,D=null===(i=Mt.current[E])||void 0===i?void 0:i.current;if(F&&D){var L=Math.max(F.getBoundingClientRect().height,D.getBoundingClientRect().height);M.left[E]=L,M.right[E]=L}}}if(Ct.forEach(function(n){var e,t,i=n.key,o=null===(e=Ft.current[i])||void 0===e?void 0:e.current,r=null===(t=Dt.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=N[i];o.style.minHeight="".concat(l,"px"),r.style.minHeight="".concat(l,"px")}}),we.current||(Object.entries(M.left).forEach(function(n){var e,t=n[0],i=n[1],o=null===(e=Nt.current[Number(t)])||void 0===e?void 0:e.current;o&&(o.style.minHeight="".concat(i,"px"))}),Object.entries(M.right).forEach(function(n){var e,t=n[0],i=n[1],o=null===(e=Mt.current[Number(t)])||void 0===e?void 0:e.current;o&&(o.style.minHeight="".concat(i,"px"))}),Yn||Object.keys(A).forEach(function(n){var e,t,i=null===(e=jt.current[n])||void 0===e?void 0:e.current,o=null===(t=Ht.current[n])||void 0===t?void 0:t.current;if(i&&o&&A[n]){var r=A[n];i.style.minHeight="".concat(r,"px"),o.style.minHeight="".concat(r,"px")}})),Yn)St.forEach(function(n,e){var t;(null===(t=Nt.current[e])||void 0===t?void 0:t.current)&&(n.refIndexes||[]).forEach(function(n){var t,i,o,r,l,u,c,a,d,s,v=Rt.findIndex(function(e){return e.selfIndex===n});if(-1!==v){var p=null===(t=At.current[e])||void 0===t?void 0:t.current,f=null===(i=kt.current[v])||void 0===i?void 0:i.current;if(p&&f){var g=p.getBoundingClientRect(),h=f.getBoundingClientRect(),x=g.right-B.left,m=h.left-B.left,y=g.top+g.height/2-B.top,b=h.top+h.height/2-B.top;if(ie&&pe===e){var S=null!==(r=null===(o=Ve.current)||void 0===o?void 0:o.getBoundingClientRect().top)&&void 0!==r?r:0,R=null!==(u=null===(l=ze.current)||void 0===l?void 0:l.getBoundingClientRect().top)&&void 0!==u?u:0,C=S+(null!==(a=null===(c=Ve.current)||void 0===c?void 0:c.clientHeight)&&void 0!==a?a:1/0),I=R+(null!==(s=null===(d=ze.current)||void 0===d?void 0:d.clientHeight)&&void 0!==s?s:1/0),w=g.top+g.height/2,T=h.top+h.height/2,E=function(n,e,t){return Math.max(e,Math.min(t,n))};y=E(w,S,C)-B.top,b=E(T,R,I)-B.top}var F=Ti(e);F&&_.push({id:"line-".concat(e,"-").concat(v),x1:x,y1:y,x2:m,y2:b,style:F,sectionIdx:e,targetRightIdx:v})}}})});else{for(E=0;E<Math.min(St.length,Rt.length);E++){var O=null===(u=Nt.current[E])||void 0===u?void 0:u.current,z=null===(c=Mt.current[E])||void 0===c?void 0:c.current;if(O&&z){var W=O.getBoundingClientRect(),q=z.getBoundingClientRect(),Y=Math.max(W.top,q.top)+18-B.top,K=(null===(a=Rt[E])||void 0===a?void 0:a.id)||"sec-".concat(E);(Z=Ti(E))&&_.push({id:K,x1:W.right-B.left,y1:Y,x2:q.left-B.left,y2:Y,style:Z,sectionIdx:E,hasCognitive:!!((null===(d=St[E])||void 0===d?void 0:d.cognitiveData)||(null===(s=Rt[E])||void 0===s?void 0:s.cognitiveData)||K&&Ae[K]),isSubSection:!1})}}Object.keys(jt.current).forEach(function(n){var e,t,i,o,r,l;if(I(n)){var u=null===(e=jt.current[n])||void 0===e?void 0:e.current,c=null===(t=Ht.current[n])||void 0===t?void 0:t.current;if(u&&c){for(var a=n.split("-").map(Number),d=St[a[0]],s=Rt[a[0]],v=1;v<a.length;v++)(null==d?void 0:d.subsections)&&(d=d.subsections[a[v]]),(null==s?void 0:s.subsections)&&(s=s.subsections[a[v]]);var p=!!d&&((null===(i=d.displayTitle)||void 0===i||i)&&w(d.title)),f=!!d&&((null===(o=d.displayContent)||void 0===o||o)&&w(d.content)),g=!!s&&((null===(r=s.displayTitle)||void 0===r||r)&&w(s.title)),h=!!s&&((null===(l=s.displayContent)||void 0===l||l)&&w(s.content));if(p&&f||g&&h){var x=u.getBoundingClientRect(),m=c.getBoundingClientRect(),y=Math.max(x.top,m.top)+16-B.top,b=_i(n);b&&"Not Defined"!==b.label&&_.push({id:"subsec-".concat(n),x1:x.right-B.left,y1:y,x2:m.left-B.left,y2:y,style:b,sectionIdx:a[0],isSubSection:!0,subSectionKeyPath:n,hasCognitive:!(!(null==d?void 0:d.cognitiveData)&&!(null==s?void 0:s.cognitiveData))})}}}})}if(ie&&"string"==typeof pe&&pe.includes(R)){var V=pe.split(R),X=V[0],$=V[1],J=V[2],U=(V[3],"".concat(X).concat(R).concat($)),G=null===(v=At.current[U])||void 0===v?void 0:v.current,Q=null===(p=kt.current[U])||void 0===p?void 0:p.current;if(G&&Q){var Z,nn=G.getBoundingClientRect(),en=Q.getBoundingClientRect(),tn=nn.right-B.left,on=en.left-B.left,rn=nn.top+nn.height/2-B.top,ln=en.top+en.height/2-B.top;if(Yn){var un=null!==(g=null===(f=Ve.current)||void 0===f?void 0:f.getBoundingClientRect().top)&&void 0!==g?g:0,cn=null!==(x=null===(h=ze.current)||void 0===h?void 0:h.getBoundingClientRect().top)&&void 0!==x?x:0,an=un+(null!==(y=null===(m=Ve.current)||void 0===m?void 0:m.clientHeight)&&void 0!==y?y:1/0),dn=cn+(null!==(S=null===(b=ze.current)||void 0===b?void 0:b.clientHeight)&&void 0!==S?S:1/0),sn=function(n,e,t){return Math.max(e,Math.min(t,n))};rn=sn(nn.top+nn.height/2,un,an)-B.top,ln=sn(en.top+en.height/2,cn,dn)-B.top}(Z=null!==(C=Ei(X,$))&&void 0!==C?C:_i(J))&&_.push({id:"line-subsec-".concat(U),x1:tn,y1:rn,x2:on,y2:ln,style:Z,sectionIdx:Number(J.split("-")[0]),isSubSection:!0,subSectionKeyPath:pe})}}if(Ri(_),mi.current&&yi.current){var vn=mi.current.getBoundingClientRect(),pn=yi.current.getBoundingClientRect(),fn=(vn.top+vn.height/2-B.top+pn.top+pn.height/2-B.top)/2;Bi({x1:vn.right-B.left,x2:pn.left-B.left,y:fn})}else Bi(null);if(xe.size>0){var gn=[],hn=Ve.current,xn=ze.current;if(hn&&xn){var mn=[],yn=hn.getBoundingClientRect().top,bn=xn.getBoundingClientRect().top,Sn=yn+hn.clientHeight,Rn=bn+xn.clientHeight,Cn=hn.scrollTop,In=xn.scrollTop,Bn=B.top,wn=function(n,e,t){return Math.max(e,Math.min(t,n))};xe.forEach(function(n){var e,t,i,o,r,l;if("string"==typeof n&&n.includes(R)){var u=n.split(R),c=u[0],a=u[1],d=u[2],s=(u[3],"".concat(c).concat(R).concat(a)),v=null===(e=At.current[s])||void 0===e?void 0:e.current,p=null===(t=kt.current[s])||void 0===t?void 0:t.current;if(!v||!p)return;var f=v.getBoundingClientRect(),g=p.getBoundingClientRect(),h=null!==(i=Ei(c,a))&&void 0!==i?i:_i(d),x=(P=f.right-B.left)+.5*((j=g.left-B.left-0)-P),m=f.top+f.height/2,y=g.top+g.height/2,b=m-yn+Cn,S=y-bn+In,C="conn-subsec-".concat(s);mn.push({lhsScrollY:b,rhsScrollY:S,x1:P,x2:j,containerTop:Bn,leftIdx:n,rhsArrayIdx:n,styleColor:(null==h?void 0:h.badgeBorder)||"#6366F1",styleId:C});var I=wn(m,yn,Sn),w=wn(y,bn,Rn),_=I-Bn,E=w-Bn,F=y>=bn-4&&y<=Rn+4,D="";D=(H=m>=yn-4&&m<=Sn+4)&&F?T(P,_,j,E):H&&!F?"M ".concat(P,",").concat(_," L ").concat(x,",").concat(_," L ").concat(x,",").concat(E):!H&&F?"M ".concat(x,",").concat(_," L ").concat(x,",").concat(E," L ").concat(j,",").concat(E):"M ".concat(x,",").concat(_," L ").concat(x,",").concat(E),gn.push({id:C,pathD:D,style:h,leftIdx:n,rhsArrayIdx:n})}else if(Yn){var N=n,M=St[N];if(!(null===(l=null==M?void 0:M.refIndexes)||void 0===l?void 0:l.length))return;M.refIndexes.forEach(function(n){var e,t,i=Rt.findIndex(function(e){return e.selfIndex===n});if(-1!==i){var o=null===(e=At.current[N])||void 0===e?void 0:e.current,r=null===(t=kt.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=o.getBoundingClientRect(),u=r.getBoundingClientRect(),c=Ti(N),a=l.right-B.left,d=u.left-B.left-0,s=a+.5*(d-a),v=l.top+l.height/2,p=u.top+u.height/2,f=v-yn+Cn,g=p-bn+In,h="conn-".concat(N,"-").concat(i);mn.push({lhsScrollY:f,rhsScrollY:g,x1:a,x2:d,containerTop:Bn,leftIdx:N,rhsArrayIdx:i,styleColor:(null==c?void 0:c.badgeBorder)||"#6366F1",styleId:h});var x=wn(v,yn,Sn),m=wn(p,bn,Rn),y=x-Bn,b=m-Bn,S=v>=yn-4&&v<=Sn+4,R=p>=bn-4&&p<=Rn+4,C="";C=S&&R?T(a,y,d,b):S&&!R?"M ".concat(a,",").concat(y," L ").concat(s,",").concat(y," L ").concat(s,",").concat(b):!S&&R?"M ".concat(s,",").concat(y," L ").concat(s,",").concat(b," L ").concat(d,",").concat(b):"M ".concat(s,",").concat(y," L ").concat(s,",").concat(b),gn.push({id:h,pathD:C,style:c,leftIdx:N,rhsArrayIdx:i})}}})}else{var A=n,k=A;v=null===(o=At.current[A])||void 0===o?void 0:o.current,p=null===(r=kt.current[k])||void 0===r?void 0:r.current;if(!v||!p)return;var P,j;f=v.getBoundingClientRect(),g=p.getBoundingClientRect(),h=Ti(A),x=(P=f.right-B.left)+.5*((j=g.left-B.left-0)-P),m=f.top+f.height/2,y=g.top+g.height/2,b=m-yn+Cn,S=y-bn+In,C="conn-".concat(A,"-").concat(k);mn.push({lhsScrollY:b,rhsScrollY:S,x1:P,x2:j,containerTop:Bn,leftIdx:A,rhsArrayIdx:k,styleColor:(null==h?void 0:h.badgeBorder)||"#6366F1",styleId:C});var H;I=wn(m,yn,Sn),w=wn(y,bn,Rn),_=I-Bn,E=w-Bn,F=y>=bn-4&&y<=Rn+4,D="";D=(H=m>=yn-4&&m<=Sn+4)&&F?T(P,_,j,E):H&&!F?"M ".concat(P,",").concat(_," L ").concat(x,",").concat(_," L ").concat(x,",").concat(E):!H&&F?"M ".concat(x,",").concat(_," L ").concat(x,",").concat(E," L ").concat(j,",").concat(E):"M ".concat(x,",").concat(_," L ").concat(x,",").concat(E),gn.push({id:C,pathD:D,style:h,leftIdx:A,rhsArrayIdx:k})}}),Ee.current=mn}Se(gn)}else Se([]),Ee.current=[]}catch(n){console.error("Line render safe fail: ",n)}finally{Xe.current=!1}}},[Ct,St,Rt,Ae,st,wi,Ti,Ei,Yn,ie,pe,xe,ei,ii]),Mi=a(function(){var n,e,t,i,o,r,l,u,c,a,d,s,v,p,f=Ee.current;if(f.length&&!we.current){var g=null!==(e=null===(n=Ve.current)||void 0===n?void 0:n.scrollTop)&&void 0!==e?e:0,h=null!==(i=null===(t=ze.current)||void 0===t?void 0:t.scrollTop)&&void 0!==i?i:0,x=null!==(r=null===(o=Ve.current)||void 0===o?void 0:o.clientHeight)&&void 0!==r?r:1/0,m=null!==(u=null===(l=ze.current)||void 0===l?void 0:l.clientHeight)&&void 0!==u?u:1/0,y=null!==(a=null===(c=Ve.current)||void 0===c?void 0:c.getBoundingClientRect().top)&&void 0!==a?a:0,b=null!==(s=null===(d=ze.current)||void 0===d?void 0:d.getBoundingClientRect().top)&&void 0!==s?s:0,S=y+x,R=b+m,C=null!==(p=null===(v=fi.current)||void 0===v?void 0:v.getBoundingClientRect().top)&&void 0!==p?p:0,I=function(n,e,t){return Math.max(e,Math.min(t,n))};f.forEach(function(n){var e=n.lhsScrollY-g+y,t=n.rhsScrollY-h+b,i=_e.current[n.styleId+"-stroke"],o=_e.current[n.styleId+"-bg"];if(i||o){var r,l=I(e,y,S),u=I(t,b,R),c=l-C,a=u-C,d=e>=y-4&&e<=S+4,s=t>=b-4&&t<=R+4,v=n.x1+.5*(n.x2-n.x1);r=d&&s?T(n.x1,c,n.x2,a):d&&!s?"M ".concat(n.x1,",").concat(c," L ").concat(v,",").concat(c," L ").concat(v,",").concat(a):!d&&s?"M ".concat(v,",").concat(c," L ").concat(v,",").concat(a," L ").concat(n.x2,",").concat(a):"M ".concat(v,",").concat(c," L ").concat(v,",").concat(a),i&&(i.setAttribute("visibility","visible"),i.setAttribute("d",r)),o&&(o.setAttribute("visibility","visible"),o.setAttribute("d",r))}})}},[]);c(function(){Me.current=Ni},[Ni]);var Ai=l(null),ki=l(null),Pi=a(function(){Ee.current.length>0&&!we.current||(null!==Ai.current&&clearTimeout(Ai.current),Ai.current=setTimeout(function(){Me.current(),Ai.current=null},50))},[]),ji=a(function(){se(!0),ce(!1),Ce.current=null,null!==ki.current&&clearTimeout(ki.current),null!==Ai.current&&(clearTimeout(Ai.current),Ai.current=null),ki.current=setTimeout(function(){var n,e,t,i,o,r,l,u,c,a,d;try{if(Ee.current=[],De.current&&null!==Ne.current&&null!==hi.current){var s=Ne.current,v=hi.current,p="string"==typeof s&&s.includes(R),f=null,g=null,h=null,x=null;if(p){var m=s.split(R),y="".concat(m[0]).concat(R).concat(m[1]);f=(null===(n=At.current[y])||void 0===n?void 0:n.current)||null,g=(null===(e=kt.current[y])||void 0===e?void 0:e.current)||null,h=(null===(t=jt.current[m[2]])||void 0===t?void 0:t.current)||(null===(i=Nt.current[Number(m[2])])||void 0===i?void 0:i.current)||null,x=(null===(o=Ht.current[m[3]])||void 0===o?void 0:o.current)||(null===(r=Mt.current[Number(m[3])])||void 0===r?void 0:r.current)||null}else f=(null===(l=Lt.current[s])||void 0===l?void 0:l.current)||null,h=(null===(u=Nt.current[s])||void 0===u?void 0:u.current)||null,g=(null===(c=Pt.current[v])||void 0===c?void 0:c.current)||null,x=(null===(a=Mt.current[v])||void 0===a?void 0:a.current)||null;if(f&&g&&h&&x){if(h.style.paddingTop="0px",x.style.paddingTop="0px",!Yn){var b=f.getBoundingClientRect(),S=g.getBoundingClientRect(),C=b.top-S.top;C>0?x.style.paddingTop="".concat(C,"px"):C<0&&(h.style.paddingTop="".concat(Math.abs(C),"px"))}var I=Ve.current,B=ze.current;if(I&&B){var w=f.getBoundingClientRect().top-I.getBoundingClientRect().top+I.scrollTop,T=g.getBoundingClientRect().top-B.getBoundingClientRect().top+B.scrollTop-(w-I.scrollTop);Math.abs(B.scrollTop-T)>1&&(B.scrollTop=T)}}}null===(d=Me.current)||void 0===d||d.call(Me),De.current&&ce(!0)}catch(n){console.error("Safely caught error during resize calculation:",n)}finally{se(!1),ki.current=null}},150)},[Yn,St,Rt]),Hi=a(function(n){if(null!==$e.current&&Je.current&&Math.abs(n.currentTarget.scrollTop-$e.current)<=2){var e=Je.current;$e.current=null,Je.current=null,e()}ge.current||(Yn||Pi(),Fe.current||(Fe.current=!0,requestAnimationFrame(function(){var n,e,t,i,o,r,l;if(De.current){var u=Ve.current,c=ze.current;if(u&&c&&xi.current){if(!Ce.current){var a=Ne.current,d=void 0;if("string"==typeof a&&a.includes(R)){var s=a.split(R),v="".concat(s[0]).concat(R).concat(s[1]);d=null===(n=At.current[v])||void 0===n?void 0:n.current}else d=null===(e=At.current[a])||void 0===e?void 0:e.current;if(d){var p=d.getBoundingClientRect();Ce.current={badgeScreenY:p.top+p.height/2,initialScrollTop:u.scrollTop,leftTop:u.getBoundingClientRect().top,leftBottom:u.getBoundingClientRect().top+u.clientHeight,cTop:null!==(i=null===(t=fi.current)||void 0===t?void 0:t.getBoundingClientRect().top)&&void 0!==i?i:0}}}if(Ce.current){var f=Ce.current,g=u.scrollTop-f.initialScrollTop,h=f.badgeScreenY-g,x=((o=h,r=f.leftTop,l=f.leftBottom,Math.max(r,Math.min(l,o)))-f.cTop).toString(),m=h>=f.leftTop-4&&h<=f.leftBottom+4;xi.current.setAttribute("y1",x),xi.current.setAttribute("y2",x),xi.current.setAttribute("visibility",m?"visible":"hidden")}}}Ee.current.length>0&&Mi(),Fe.current=!1})))},[Mi,Yn,Pi]),Li=l(0),Oi=l(0),zi=l(0),Wi=l(function(){});l(null),c(function(){Wi.current=ji},[ji]),c(function(){var n=setTimeout(Pi,250),e=function(){return Wi.current()};return window.addEventListener("resize",e),function(){clearTimeout(n),null!==Ai.current&&clearTimeout(Ai.current),null!==ki.current&&clearTimeout(ki.current),window.removeEventListener("resize",e)}},[yt,bt,qt,Ct,ei,ii,St,Rt,st,Pi,ie,pe,ue,xe]),c(function(){var n=function(n,e,t,i,o){e.current=n.getBoundingClientRect().width;var r=new ResizeObserver(function(n){null!==t.current&&cancelAnimationFrame(t.current),t.current=requestAnimationFrame(function(){var r,l,u;t.current=null;var c=n[n.length-1];if(c){var a=null!==(u=null===(l=null===(r=c.borderBoxSize)||void 0===r?void 0:r[0])||void 0===l?void 0:l.inlineSize)&&void 0!==u?u:c.contentRect.width;Math.abs(a-e.current)<1?o():(e.current=a,i())}})});return r.observe(n),r},e={current:null},t={current:null},i={current:null},o=[],r=[e,t,i];return Oe.current&&o.push(n(Oe.current,Li,e,function(){return Wi.current()},function(){})),Le.current&&o.push(n(Le.current,Oi,t,function(){return Wi.current()},function(){return Me.current()})),fi.current&&o.push(n(fi.current,zi,i,function(){return Wi.current()},function(){return Me.current()})),function(){o.forEach(function(n){return n.disconnect()}),r.forEach(function(n){null!==n.current&&(cancelAnimationFrame(n.current),n.current=null)})}},[]),c(function(){De.current=ie},[ie]),c(function(){Ne.current=pe},[pe]);var qi=a(function(n,e,t){var i,o,r=null===(i=null==t?void 0:t.toggleIfSame)||void 0===i||i,l=null==t?void 0:t.onReady,u=null!==(o=null==t?void 0:t.sourceSide)&&void 0!==o?o:"left";dt(),null!=n&&(e?ee("No counterpart exists for this section."):(Ut(),ie&&pe===n?r?Gt():null==l||l():(me(new Set([n])),Se([]),Ee.current=[],Qn(!0),ge.current=!0,fe(n),Ne.current=n,oe(!0),De.current=!0,ce(!1),We.current&&(We.current.style.height="0px"),qe.current&&(qe.current.style.height="0px"),Ye.current&&(Ye.current.style.height="0px"),Ke.current&&(Ke.current.style.height="0px"),requestAnimationFrame(function(){var e,t,i,o,r,c="string"==typeof n&&n.includes(R),a=null,d=null,s=null;if(c){var v=n.split(R),p="".concat(v[0]).concat(R).concat(v[1]);a=(null===(e=At.current[p])||void 0===e?void 0:e.current)||null,d=(null===(t=kt.current[p])||void 0===t?void 0:t.current)||null,s=d?n:null}else if(a=(null===(i=Lt.current[n])||void 0===i?void 0:i.current)||null,Yn){var f=St[n],g=(null==f?void 0:f.refIndexes)||[];if(g.length>0){var h=g[0],x=Rt.findIndex(function(n){return n.selfIndex===h});-1!==x&&(d=(null===(r=Pt.current[x])||void 0===r?void 0:r.current)||null,s=x)}}else d=(null===(o=Pt.current[n])||void 0===o?void 0:o.current)||null,s=d?n:null;hi.current=s;var m=Ve.current,y=ze.current,b=function(){!function(){var e,t,i,o,r,l,u,a,d,v,p,f,g=null,h=null,x=null,m=null;if(c){var y=n.split(R),b="".concat(y[0]).concat(R).concat(y[1]);g=(null===(e=jt.current[y[2]])||void 0===e?void 0:e.current)||(null===(t=Nt.current[Number(y[2])])||void 0===t?void 0:t.current)||null,h=(null===(i=Ht.current[y[3]])||void 0===i?void 0:i.current)||(null===(o=Mt.current[Number(y[3])])||void 0===o?void 0:o.current)||null,x=(null===(r=At.current[b])||void 0===r?void 0:r.current)||g,m=(null===(l=kt.current[b])||void 0===l?void 0:l.current)||h}else{var S=Number(n),C=null!==s?Number(s):S;g=(null===(u=Nt.current[S])||void 0===u?void 0:u.current)||null,h=(null===(a=Mt.current[C])||void 0===a?void 0:a.current)||null,x=(null===(d=At.current[S])||void 0===d?void 0:d.current)||(null===(v=Lt.current[S])||void 0===v?void 0:v.current)||g,m=(null===(p=kt.current[C])||void 0===p?void 0:p.current)||(null===(f=Pt.current[C])||void 0===f?void 0:f.current)||h}if(x&&m&&g&&h){g.style.paddingTop="0px",h.style.paddingTop="0px";var I=x.getBoundingClientRect(),B=m.getBoundingClientRect(),w=I.top-B.top;w>0?h.style.paddingTop="".concat(w,"px"):w<0&&(g.style.paddingTop="".concat(Math.abs(w),"px"))}}(),ce(!0),Me.current&&Me.current(),ge.current=!1,"right"===u&&y?y.dispatchEvent(new Event("scroll")):m&&m.dispatchEvent(new Event("scroll")),Qn(!1),null==l||l()};if(!a||!m)return ge.current=!1,Qn(!1),void(null==l||l());if(d&&y){if(!Yn){var S=0;S="right"===u?d?d.getBoundingClientRect().top:0:a?a.getBoundingClientRect().top:0;var C=Le.current,I=(null==C?void 0:C.getBoundingClientRect().top)||0,B=C?C.scrollTop+S-I-150:0;return C?void _(C,B,200,b):void b()}var w=a.getBoundingClientRect().top-m.getBoundingClientRect().top+m.scrollTop,T=d.getBoundingClientRect().top-y.getBoundingClientRect().top+y.scrollTop,E=200;if("left"===u){var F=T-(w-m.scrollTop);F<0&&We.current&&(We.current.style.height="".concat(Math.abs(F),"px")),requestAnimationFrame(function(){var n,e=y.scrollHeight-y.clientHeight;if(F<0)n=0;else{if(F>e){var t=F-e;return qe.current&&(qe.current.style.height="".concat(t+150,"px")),void requestAnimationFrame(function(){_(y,F,E,b)})}n=F}_(y,n,E,b)})}else{var D=w-(T-y.scrollTop);D<0&&Ye.current&&(Ye.current.style.height="".concat(Math.abs(D),"px")),requestAnimationFrame(function(){var n,e=m.scrollHeight-m.clientHeight;if(D<0)n=0;else{if(D>e){var t=D-e;return Ke.current&&(Ke.current.style.height="".concat(t+150,"px")),void requestAnimationFrame(function(){_(m,D,E,b)})}n=D}_(m,n,E,b)})}}else b()}))))},[pe,dt,Rt,ie,Yn,St,Gt]),Yi=a(function(n,e,t,i,o){var r,l="string"==typeof i?y(i).trim():y(null==i?void 0:i.deviation_summary).trim(),u=n.currentTarget;at();var c="left";(null===(r=ze.current)||void 0===r?void 0:r.contains(u))&&(c="right");var a=function(){var n,t,i,o;if("string"==typeof e&&e.includes(R)){var r=e.split(R),l="".concat(r[0]).concat(R).concat(r[1]);return"right"===c?null===(n=kt.current[l])||void 0===n?void 0:n.current:null===(t=At.current[l])||void 0===t?void 0:t.current}return"right"===c?null===(i=kt.current[e])||void 0===i?void 0:i.current:null===(o=At.current[e])||void 0===o?void 0:o.current};if(t)return Gt(),me(new Set),Se([]),Ee.current=[],void(l&&requestAnimationFrame(function(){var n=a()||u;rt({open:!0,anchorEl:n,summary:i,displayImpact:o})}));qi(e,t,l?{toggleIfSame:!1,sourceSide:c,onReady:function(){var n=a()||u;rt({open:!0,anchorEl:n,summary:i,displayImpact:o})}}:{toggleIfSame:!1,sourceSide:c})},[qi,at,rt,Gt]),Ki=a(function(){var n,e=Ze.sectionIdx,t=Ze.isOrphan;if(lt(),null!=e){var i="left";Ze.anchorEl&&(null===(n=ze.current)||void 0===n?void 0:n.contains(Ze.anchorEl))&&(i="right"),qi(e,t,{sourceSide:i})}},[qi,Ze.isOrphan,Ze.sectionIdx,Ze.anchorEl,lt]),Vi=a(function(){lt(),Gt(),me(new Set),Se([]),Ee.current=[]},[lt,Gt]),Xi=null!==Ze.sectionIdx&&xe.has(Ze.sectionIdx),$i=K({proposedSections:St,existingSections:Rt,parentDeviationRecord:It,expandedSections:ei,maintainRelativeOrder:!!Yn,scrollContainerRef:Le,leftContainerRef:Ve,lhsBadgeRefs:At,rhsBadgeRefs:kt}),Ji=$i.showDeviationNavigation,Ui=$i.showOpenNodeRef,Gi=u(function(){var n;if(!Hn)return null;var e=null===(n=null==Hn?void 0:Hn.id)||void 0===n?void 0:n.split(":")[0];for(var t in It){if((It[t]||[]).some(function(n){return n.id===e}))return t}return null},[Hn,It]),Qi=l({id:null,triggerMs:null}),Zi=l(null);c(function(){var t;if(null==Hn?void 0:Hn.id){var i=Number(Hn.trigger),o=Qi.current;if((null==o?void 0:o.triggerMs)!==i){if(!(Hn.id.includes(":")&&/:\d+$/.test(Hn.id)))return Qi.current={id:Hn.id,triggerMs:i},void vi(Hn.id);var r=null===(t=null==Hn?void 0:Hn.id)||void 0===t?void 0:t.split(":"),l=r[0],u=r[1],c=null!=u?u:"0";Zi.current!==Hn.id&&(lt(),at(),Gt(),me(new Set),Se([]),Ee.current=[],Zi.current=Hn.id);var a=!1,d=0,s=null,v=150,p=function(n,e){for(var t=function(n,i){if(!n)return null;if(n.id===e)return i;if(!Array.isArray(n.subsections))return null;for(var o=0;o<n.subsections.length;o++){var r=t(n.subsections[o],"".concat(i,"-").concat(o));if(r)return r}return null},i=0;i<n.length;i++){var o=t(n[i],String(i));if(o)return o}return null},f=function(){var t,o,r,u;if(!a){var g=function(){Qi.current={id:Hn.id,triggerMs:i}},h=null,x=null;for(var m in It){var y=It[m].find(function(n){return n.id===l});if(y){h=m,x=y;break}}if(x&&h){var b=St.findIndex(function(n){return n.id===h}),S=Rt.findIndex(function(n){return n.id===h}),C=-1===b&&-1!==S,I=p(St,x.id),B=p(Rt,x.id);if(I&&!B&&!C){var w=I.split("-"),T=Number(w[0]);if(Yn){var _=null===(o=null===(t=St[T])||void 0===t?void 0:t.refIndexes)||void 0===o?void 0:o[0],E=Rt.findIndex(function(n){return n.selfIndex===_});-1!==E&&(T=E)}B=e([T],w.slice(1),!0).join("-")}if(I||B){var F=C||!I&&!!B,D=I?Number(I.split("-")[0]):b,N=B?Number(B.split("-")[0]):S;if(F){if(!(Yn?!!ei["right-".concat(N)]:!!ei[String(N)])&&N>=0)return ri(N,"right"),d+=1,void(s=setTimeout(f,450))}else if(!(Yn?!!ei["left-".concat(D)]:!!ei[String(D)])&&D>=0)return ri(D,"left"),d+=1,void(s=setTimeout(f,450));var M,A=I||"",k=B||"",P="".concat(x.id).concat(R).concat(c).concat(R).concat(A).concat(R).concat(k),j="".concat(x.id).concat(R).concat(c),H=null===(r=At.current[j])||void 0===r?void 0:r.current,L=null===(u=kt.current[j])||void 0===u?void 0:u.current,O=F||!H&&!!L,z=O?L:H;if(M=Yn?O?ze.current:Ve.current:Le.current,z&&M){var W=z.getBoundingClientRect();if(0===W.height)return void((d+=1)<2?s=setTimeout(f,v):g());var q=M.getBoundingClientRect(),Y=W.top-q.top+M.scrollTop-q.height/2+W.height/2+150,K=function(){var e,t,i,o,r;if(!a){g();var l=z instanceof Element?window.getComputedStyle(z).color:"";H&&(H.style.transition="box-shadow 300ms ease-in-out",H.style.boxShadow="0 0 10px ".concat(l)),L&&(L.style.transition="box-shadow 300ms ease-in-out",L.style.boxShadow="0 0 10px ".concat(l)),setTimeout(function(){H&&(H.style.boxShadow=""),L&&(L.style.boxShadow="")},2e3);var u=(null===(t=null===(e=x.evaluationResult)||void 0===e?void 0:e.deviations)||void 0===t?void 0:t[c])||x,d=(null===(i=x.evaluationResult)||void 0===i?void 0:i.evaluation_outputs)||x.evaluation_outputs;if(!(!!H&&!!L)){var s=O?(null===(o=kt.current[j])||void 0===o?void 0:o.current)||L:(null===(r=At.current[j])||void 0===r?void 0:r.current)||H;return rt({open:!0,anchorEl:s,displayImpact:Hn.displayImpact,summary:n(n({},u),{evaluation_outputs:d})}),void(null==Ln||Ln())}qi(P,!1,{toggleIfSame:!1,sourceSide:"left",onReady:function(){var e,t=(null===(e=At.current[j])||void 0===e?void 0:e.current)||H;console.log("Summary data",d,u),rt({open:!0,anchorEl:t,displayImpact:null==Hn?void 0:Hn.displayImpact,summary:n({},u)})}})}};Math.abs(M.scrollTop-Y)<=2?K():($e.current=Y,Je.current=K,M.scrollTo({top:Y,behavior:"smooth"}),s&&clearTimeout(s),s=setTimeout(function(){if(Je.current){$e.current=null;var n=Je.current;Je.current=null,n()}},800))}else(d+=1)<2?s=setTimeout(f,v):g()}else(d+=1)<2?s=setTimeout(f,v):g()}else(d+=1)<2?s=setTimeout(f,v):g()}};return s=setTimeout(f,v),function(){a=!0,s&&clearTimeout(s)}}}},[Hn,It,St,Rt,Yn,ei,ri,qi,rt,vi]);var no=function(n){var e=n.section,t=n.keyPath,o=n.depth,r=void 0===o?0:o,l=n.columnKey,u=void 0===l?"left":l,c=n.parentNodeId;return i($,{section:e,keyPath:t,depth:r,columnKey:u,parentNodeId:void 0===c?"":c,expandedSubSections:ii,setExpandedSubSections:oi,maintainRelativeOrder:Yn||!1,proposedSections:St,existingSections:Rt,treeData:Tn,deviationNumberRegistry:Bt,connectedSections:xe,activeSideBySideSection:pe,resolvedMarkdownStyles:He,getSubSectionRef:zt,getSubSectionCompareStyle:_i,getBadgeRef:Wt,openMoreFunctionsPopup:ci,openSummaryPopup:Yi,showDeviationBadges:Vn,resetSideBySide:Gt,setConnectedSections:me,setConnectedLines:Se,cachedConnectedPositions:Ee,isProposingFix:zn,proposingFixNodeId:Wn})};return t(d,n({ref:Oe,sx:n(n({display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif'},Yn?{}:{overflow:"visible"}),{position:"relative"})},{children:[$n&&i(d,n({sx:{position:"absolute",inset:0,bgcolor:"rgba(255, 255, 255, 0.6)",backdropFilter:"blur(10px)",zIndex:9999,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"8px"}},{children:i(L,{})})),ot.open&&i(J,{open:ot.open,anchorEl:ot.anchorEl,containerEl:gi.current,clipTopEl:mi.current,scrollContainerEl:Le.current,onClose:Vi,summary:ot.summary,displayImpact:ot.displayImpact}),i(H,{open:Ze.open,anchorEl:Ze.anchorEl,sectionTitle:Ze.sectionTitle,referenceSectionTitle:Ze.refSectionTitle,onClose:dt,onOpenCognitiveCompare:ai,onOpenSideBySide:Ki,onConnect:di,isConnected:Xi,isOrphan:Ze.isOrphan}),Ge.open&&i(j,{open:Ge.open,popupRef:ct,position:et,popupConfig:kn,onClose:function(){tt(null),Qe(function(e){return n(n({},e),{open:!1})}),ut(null)},markdownStyles:Dn,sectionTitle:Ge.sectionTitle,referenceSectionTitle:Ge.refSectionTitle,cognitiveData:Ge.cognitiveData,anchorEl:Ge.anchorEl,sectionAnchorEl:Ge.sectionAnchorEl,scrollContainerEl:Le.current,badgeStyle:Ge.badgeStyle,docData:Ge.docData,deviationData:Ge.deviationData,isLoading:Ge.isLoading}),i(s,n({open:!!ne,autoHideDuration:8e3,onClose:function(){return ee(null)},anchorOrigin:{vertical:"top",horizontal:"center"}},{children:i(v,n({onClose:function(){return ee(null)},severity:"error",sx:{width:"100%",whiteSpace:"pre-line"}},{children:ne}))})),i(V,{componentHeaderText:wn,displayConfig:An,maintainRelativeOrder:Yn,onCollapseAll:Fi,showCollapseAll:Di,onToggleView:function(n){Jn(!0),setTimeout(function(){Kn(!n),Gt(),lt(),me(new Set),Se([]),Ee.current=[],requestAnimationFrame(function(){requestAnimationFrame(function(){setTimeout(function(){Jn(!1)},600)})})},50)}}),i(d,n({ref:Le,onScroll:Hi,sx:{flex:1,minHeight:0,pt:1.5,pb:1,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",overflowY:Yn?"hidden":"auto",borderTop:Yt&&Kt?"none":"1.5px solid #EEF0F4"}},{children:i(d,n({sx:n({display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"},Yn?{flex:1,minHeight:0}:{})},{children:t(d,n({ref:fi,sx:n({display:"grid",gridTemplateColumns:"minmax(0, 1fr) 180px minmax(0, 1fr)",gap:"50px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0},Yn?{flex:1,overflow:"visible"}:{})},{children:[t("svg",n({ref:Re,style:{position:"absolute",top:0,left:0,width:Pe.width||"100%",height:Pe.height||"100%",pointerEvents:"none",zIndex:10,overflow:"visible",opacity:de?0:1,transition:"opacity 0.15s ease-in-out"}},{children:[Ii&&i("g",{children:i("line",{x1:Ii.x1,y1:Ii.y,x2:Ii.x2,y2:Ii.y,stroke:Jt.badgeBorder,strokeWidth:"1.5"})}),Si.map(function(e){var o,r,l,u,c,a,s,v=e.x1+.5*(e.x2-e.x1),p=(e.y1+e.y2)/2;if("Not Defined"===e.style.label&&!e.hasCognitive)return null;if(e.isSubSection?ie&&pe===e.subSectionKeyPath&&ue:ie&&pe===e.sectionIdx&&ue)return null;if(!Yn){var f=e.isSubSection?T(e.x1,e.y1,e.x2,e.y2):"M ".concat(e.x1," ").concat(e.y1," L ").concat(e.x2," ").concat(e.y2),h=St[e.sectionIdx]||{title:"",content:""},m=Rt[null!==(o=e.targetRightIdx)&&void 0!==o?o:e.sectionIdx]||{title:"",content:""};if(console.log("Base and Ref Sections for Badge:",h,m),e.isSubSection&&e.subSectionKeyPath){var y=e.subSectionKeyPath.includes(R)?e.subSectionKeyPath.split(R):[],b=y[2]||e.subSectionKeyPath,S=y[3]||b,C=b.split("-").map(Number),I=S.split("-").map(Number),B=null,w=null;C.length>0&&(B=St[C[0]]),I.length>0&&(w=Rt[I[0]]);var _=(null==B?void 0:B.title)||"",E=(null==w?void 0:w.title)||"";console.log("Root Parent Titles:",_,E);for(var F=1;F<C.length;F++)(null==B?void 0:B.subsections)&&(B=B.subsections[C[F]]);for(F=1;F<I.length;F++)(null==w?void 0:w.subsections)&&(w=w.subsections[I[F]]);B&&(h=n(n({},B),{title:_||B.title})),console.log("Base Section for Subsection Badge:",h),w&&(m=n(n({},w),{title:E||w.title})),console.log("Ref Section for Subsection Badge:",m)}var D=!(null===(r=h.cognitiveData)||void 0===r?void 0:r.isMissingRationale)||Boolean(null===(u=null===(l=h.cognitiveData)||void 0===l?void 0:l.decisioning)||void 0===u?void 0:u.length),N=(null===(s=null===(a=null===(c=h.evaluationResult)||void 0===c?void 0:c.cognitive_decisioning)||void 0===a?void 0:a.decisioning_factors)||void 0===s?void 0:s.length)||!1,M=D||N;return t("g",{children:[i("path",{d:f,fill:"none",stroke:e.style.badgeBorder||"#E2E8F0",strokeWidth:"1.5"}),i("foreignObject",n({x:v-100,y:p-14,width:"200",height:"28",style:{pointerEvents:"auto",overflow:"visible"}},{children:i(d,n({sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},{children:t(d,n({onClick:function(n){n.stopPropagation(),M&&(Ge.open&&it===e.id?at():(ut(e.id),ui(li(n.currentTarget,h,m,e.sectionIdx,e.style))))},sx:{display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",bgcolor:e.style.badgeBg,color:e.style.badgeText,border:"1px solid ".concat(e.style.badgeBorder),borderRadius:"12px",px:1.5,py:.5,fontWeight:600,textAlign:"center",whiteSpace:"nowrap",cursor:M?"pointer":"default"}},{children:[e.style.badgeText===k&&null==e.style.label?i(O,{color:e.style.badgeText}):0===e.style.label?"Same":e.style.label,i(d,n({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:i(x,{})})),M&&i(g,{size:11,style:{transform:Ge.open&&it===e.id?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))}))]},e.id)}return null}),i(U,{connectedLines:be,pathRefs:_e})]})),t(d,n({sx:n({border:"1px solid #E7E7E9",borderRadius:"8px",bgcolor:"#FFFFFF",display:"flex",flexDirection:"column",position:"relative",zIndex:2,filter:"drop-shadow(0px 2px 4px #F2F2F2)"},Yn?{flex:1,overflow:"visible"}:{})},{children:[i(d,n({ref:mi,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E7E7E9",borderRadius:"8px 8px 0 0",display:"flex",alignItems:"center",minHeight:"40px",overflow:"hidden",minWidth:0}},{children:i(p,n({title:ht,placement:"top"},{children:i(f,n({sx:{fontSize:"16px",fontWeight:500,color:"#19213D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0,textAlign:"center",display:"block"}},{children:ht}))}))})),t(d,n({ref:Ve,onScroll:Hi,sx:n({p:"12px",display:"flex",flexDirection:"column"},Yn?{maxHeight:"calc(100vh - 150px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,mr:"-160px",pr:"172px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[i("div",{ref:Ye,style:{width:"100%",height:"0px",flexShrink:0}}),Tt&&St.map(function(e,o){var r,l,u=!e.title&&!e.content;if(Yn&&u)return null;var c=e,a=Ti(o,"left"),s=Yn?!(null===(r=c.refIndexes)||void 0===r?void 0:r.length)||c.selfIndex<0:!Rt[o],v=xe.has(o),p=b(c.evaluationResult,null==a?void 0:a.deviationLabel),f=_t.leftNums.get(c.id);return i(d,n({ref:Ot(o),sx:{mb:1,width:"100%"}},{children:t(d,n({sx:{position:"relative",width:"100%"}},{children:[i(d,n({ref:Nt.current[o],sx:n({width:"100%",display:"flex",flexDirection:"column",minWidth:0},v&&{borderRadius:"6px",outline:"2px solid ".concat((null==a?void 0:a.badgeBorder)||"#6366F1"),outlineOffset:"1px"})},{children:i(X,{section:e,idx:o,columnKey:"left",colRef:Ot("left-accordion-".concat(o)),mb:0,treeData:Tn,proposedSections:St,existingSections:Rt,deviationNumberRegistry:Bt,getSectionCompareStyle:Ti,getBadgeRef:Wt,connectedSections:xe,openMoreFunctionsPopup:ci,openSummaryPopup:Yi,deviationNodeIdToView:null==Hn?void 0:Hn.id,deviationTargetParentId:Gi,parentNodeId:(null===(l=null==Tn?void 0:Tn.input_index_map)||void 0===l?void 0:l[0])||"",isExpanded:Yn?!!ei["left-".concat(o)]:!!ei[String(o)],onToggle:function(){Vi(),ri(o,"left")},navigation:e.id?Ji[e.id]:null,showOpenNodeRef:Ui,resolvedMarkdownStyles:He,maintainRelativeOrder:Yn,showDeviationBadges:Vn,renderSubSections:no,isProposingFix:zn,proposingFixNodeId:Wn,collisionKey:"".concat(ie?"1":"0","-").concat(String(null!=pe?pe:""))})})),Yn&&a&&t(d,n({ref:At.current[o],onClick:function(n){var e,t,i,r=An.enableDeviationSchemaBackwardCompatibility?null!==(e=c.evaluationResult)&&void 0!==e?e:null:null!==(i=null===(t=c.evaluationResult)||void 0===t?void 0:t[0])&&void 0!==i?i:null;Yi(n,String(o),s,r)},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:[t(d,n({component:"span",onClick:function(n){var e,t,i;n.stopPropagation();var r=An.enableDeviationSchemaBackwardCompatibility?null!==(e=c.evaluationResult)&&void 0!==e?e:null:null!==(i=null===(t=c.evaluationResult)||void 0===t?void 0:t[0])&&void 0!==i?i:null;Yi(n,String(o),s,r)},sx:{display:"inline-flex",alignItems:"center",gap:"4px",px:.2,cursor:s?"default":"pointer",borderRight:"1px solid ".concat(a.badgeBorder),"&:hover":s?{}:{bgColor:"".concat(a.badgeBorder,"22")}}},{children:[null!=f&&i(d,n({component:"span",sx:{fontSize:"11px",fontWeight:700,pr:.5,borderRight:"1px solid ".concat(a.badgeBorder)}},{children:f})),i(d,n({component:"span",sx:{fontSize:"11px",px:.25}},{children:!An.isLoading||null!=c.evaluationResult&&null!=c.evaluationResult?"N/A"===p||"NA"===p?"N/A":0==p||null==p?"Same":"".concat(p):i(O,{color:a.badgeText})}))]})),i(d,n({component:"span",onClick:function(n){n.stopPropagation();var t=Yn?Rt.find(function(n){var e;return null===(e=c.refIndexes)||void 0===e?void 0:e.includes(n.selfIndex)})||{title:"",content:""}:Rt[o]||{title:"",content:""};ci(n,e,s,t,o,a)},sx:{display:"inline-flex",alignItems:"center",px:.2,cursor:"pointer","&:hover":{bgcolor:"".concat(a.badgeBorder,"22")}}},{children:i(h,{size:11,color:a.badgeText})}))]}))]}))}),"left-row-".concat(o))}),i("div",{ref:Ke,style:{width:"100%",height:"0px",flexShrink:0}})]}))]})),i(d,n({ref:gi,sx:{width:"180px",display:"flex",flexDirection:"column",alignItems:"center",pt:"15px",gap:0,zIndex:20,pointerEvents:"none"}},{children:i(d,n({sx:{display:"flex",justifyContent:"center",alignItems:"center",mt:0}},{children:t(d,n({onClick:function(e){e.stopPropagation(),Ge.open&&it===Vt?at():(ut(Vt),ui(li(e.currentTarget,{title:"",content:"",evaluationResult:Xt,cognitiveData:{section_id:"",decisioning:[],gap:[],relevance_score:0,isMissingRationale:!0}},null,Vt,!0,n(n({},Jt),{label:""}))))},sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:"5px",top:"-8px",borderRadius:"20px",bgcolor:Jt.badgeBg,color:Jt.badgeText,border:"1px solid ".concat(Jt.badgeBorder),fontSize:"12px",fontWeight:600,whiteSpace:"nowrap",position:"relative",zIndex:1,pointerEvents:"auto",cursor:"pointer"}},{children:[null!=$t?$t:i(O,{}),i(d,n({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:i(x,{})})),i(g,{size:11,style:{transform:Ge.open&&it===Vt?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))})),t(d,n({sx:n({border:"1px solid #E3E6EA",borderRadius:"8px",bgcolor:"#FFFFFF",boxShadow:"0px 1px 4px #F7F4FE",position:"relative",zIndex:2,display:"flex",flexDirection:"column",minWidth:0},Yn?{flex:1,overflow:"visible",minHeight:0}:{})},{children:[Gn&&i(m,{sections:11}),i(d,n({ref:yi,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E3E6EA",borderRadius:"8px 8px 0 0",minHeight:"40px",display:"flex",alignItems:"center",overflowX:"hidden"}},{children:i(p,n({title:xt,placement:"top"},{children:i(f,n({sx:{fontSize:"16px",fontWeight:500,color:"#5928ED",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0,textAlign:"center",display:"block"}},{children:xt}))}))})),t(d,n({ref:ze,onScroll:Hi,sx:n({p:"12px",display:"flex",flexDirection:"column"},Yn?{maxHeight:"calc(100vh - 150px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,ml:"-140px",pl:"160px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[i("div",{ref:We,style:{width:"100%",height:"0px",flexShrink:0}}),Tt&&Rt.map(function(e,r){var l,u,c=e,a=!1,s=null,v=-1;if(Yn){v=St.findIndex(function(n){var e;return(null===(e=n.refIndexes)||void 0===e?void 0:e.includes(c.selfIndex))&&n.selfIndex>=0});var p=St.findIndex(function(n,e){var t;return xe.has(e)&&(null===(t=n.refIndexes)||void 0===t?void 0:t.includes(c.selfIndex))});(a=-1!==p)&&(s=Ti(p))}else(a=xe.has(r))&&(s=Ti(r));var f=Ti(Yn&&-1!==v?v:r),g=Yn?!(null===(l=c.refIndexes)||void 0===l?void 0:l.length)||c.selfIndex<0:!St[r],x=_t.rightNums.get(c.id);return i(d,n({ref:Pt.current[r],sx:{mb:1,width:"100%"}},{children:t(d,n({sx:{position:"relative",width:"100%"}},{children:[i(d,n({ref:Mt.current[r],sx:n({width:"100%",display:"flex"},a&&s&&{borderRadius:"6px",outline:"2px solid ".concat(s.badgeBorder),outlineOffset:"1px"})},{children:i(X,{section:e,idx:r,columnKey:"right",colRef:Ot("right-accordion-".concat(r)),mb:0,parentNodeId:(null===(u=null==Tn?void 0:Tn.input_index_map)||void 0===u?void 0:u[1])||"",isExpanded:Yn?!!ei["right-".concat(r)]:!!ei[String(r)],treeData:Tn,proposedSections:St,existingSections:Rt,deviationNumberRegistry:Bt,getBadgeRef:Wt,getSectionCompareStyle:Ti,connectedSections:xe,openMoreFunctionsPopup:ci,openSummaryPopup:Yi,deviationNodeIdToView:null==Hn?void 0:Hn.id,deviationTargetParentId:Gi,onToggle:function(){Vi(),ri(r,"right")},navigation:e.id?Ji[e.id]:null,showOpenNodeRef:Ui,resolvedMarkdownStyles:He,maintainRelativeOrder:Yn,showDeviationBadges:Vn,renderSubSections:no,isProposingFix:zn,proposingFixNodeId:Wn,collisionKey:"".concat(ie?"1":"0","-").concat(String(null!=pe?pe:""))})})),Yn&&f&&i(d,n({ref:kt.current[r],"data-section-id":c.id,onClick:function(n){var e,t,i;if(g){var o=An.enableDeviationSchemaBackwardCompatibility?null!==(e=c.evaluationResult)&&void 0!==e?e:null:null!==(i=null===(t=c.evaluationResult)||void 0===t?void 0:t[0])&&void 0!==i?i:null;Yi(n,String(r),g,o)}},sx:{position:"absolute",top:"18px",left:0,transform:"translateY(-50%) translateX(calc(-100% - 8px))",display:"inline-flex",alignItems:"center",justifyContent:"center",gap:g?"4px":"0px",fontSize:"11px",bgcolor:g?"#F1D2D2":f.badgeBg,color:g?"#B91C1C":f.badgeText,border:g?"1px solid #DC8E8E":"1px solid ".concat(f.badgeBorder),borderRadius:g?"12px":"10px",px:g?1.2:1,py:g?.4:.3,fontWeight:g?600:700,cursor:g?"pointer":"default",whiteSpace:"nowrap",zIndex:20,boxShadow:g?"0 1px 3px rgba(0,0,0,0.07)":"none"}},{children:g?t(o,{children:[t(d,n({component:"span",onClick:function(n){var e,t,i;n.stopPropagation();var o=An.enableDeviationSchemaBackwardCompatibility?null!==(e=c.evaluationResult)&&void 0!==e?e:null:null!==(i=null===(t=c.evaluationResult)||void 0===t?void 0:t[0])&&void 0!==i?i:null;Yi(n,String(r),g,o)},sx:{display:"inline-flex",alignItems:"center",gap:"4px",px:.2,cursor:"pointer",borderRight:g?"1px solid #DC8E8E":"1px solid ".concat(f.badgeBorder),"&:hover":{bgcolor:g?"#F1D2D2":"".concat(f.badgeBorder,"22")}}},{children:[null!=x&&i(d,n({component:"span",sx:{fontSize:"11px",fontWeight:700,pr:.5,borderRight:g?"1px solid #DC8E8E":"1px solid ".concat(f.badgeBorder)}},{children:x})),i(d,n({component:"span",sx:{fontSize:"11px",px:.25}},{children:!An.isLoading||null!=c.evaluationResult&&null!=c.evaluationResult?"100% Deviation":i(O,{color:g?"#B91C1C":f.badgeText})}))]})),i(d,n({component:"span",onClick:function(n){n.stopPropagation();var e=Yn?St.find(function(n){var e;return null===(e=n.refIndexes)||void 0===e?void 0:e.includes(c.selfIndex)})||{title:"",content:""}:St[r]||{title:"",content:""};ci(n,e,g,c,r,f)},sx:{display:"inline-flex",alignItems:"center",px:.2,cursor:"pointer","&:hover":{bgcolor:"".concat(f.badgeBorder,"22")}}},{children:i(h,{size:11,color:g?"#B91C1C":f.badgeText})}))]}):null!=x?x:""}))]}))}),"right-row-".concat(r))}),i("div",{ref:qe,style:{width:"100%",height:"0px",flexShrink:0}})]}))]}))]}))}))}))]}))};export{G as default};
|
|
2
2
|
//# sourceMappingURL=CognitiveCompare.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as o}from"tslib";import{jsxs as i,Fragment as
|
|
1
|
+
import{__assign as o}from"tslib";import{jsxs as i,Fragment as n,jsx as t}from"react/jsx-runtime";import{useMemo as e,useState as r,useEffect as l}from"react";import{Box as a,Typography as c,IconButton as s,Tooltip as d}from"@mui/material";import{X as p}from"lucide-react";import v from"react-dom";import x from"../../assests/svg/SparkleIcon.js";import{SHARED_MARKDOWN_STYLES as h,DEFAULT_POPUP_CONFIG as u}from"./CognitiveCompareConfig.js";import b from"./CitationRenderer.js";var g=10,f=function(f){var m,y,w,F,k,S,C,D,_,E,R,z,W,I,T,j,A,B,L,H,M=f.open,O=f.onClose,G=f.sectionTitle,N=f.referenceSectionTitle,P=f.cognitiveData,Y=f.relevanceScore,q=f.anchorEl,J=f.badgeStyle,K=f.popupRef,Q=f.position,U=f.markdownStyles,V=f.docData,X=f.popupConfig,Z=f.deviationData,$=void 0===Z?null:Z,oo=f.isLoading,io=o(o({},h),U),no=e(function(){var i,n;return o(o(o({},u),X),{tabs:{deviation:o(o({},u.tabs.deviation),null===(i=null==X?void 0:X.tabs)||void 0===i?void 0:i.deviation),association:o(o({},u.tabs.association),null===(n=null==X?void 0:X.tabs)||void 0===n?void 0:n.association)},sectionTitles:o(o({},u.sectionTitles),null==X?void 0:X.sectionTitles)})},[X]),to=null==P?void 0:P.isMissingRationale,eo=r(to?no.tabs.deviation.key:no.tabs.association.key),ro=eo[0],lo=eo[1];l(function(){M&&lo(to?no.tabs.deviation.key:no.tabs.association.key)},[M,to,no.tabs.deviation.key,no.tabs.association.key]);var ao=e(function(){if(!J)return{border:no.accentColor,shadow:"".concat(no.accentColor,"2E")};var o=J.badgeText;return"#9F1239"===o||"#B42318"===o?{border:"#E11D48",shadow:"rgba(225,29,72,0.15)"}:"#1D4ED8"===o?{border:"#3B82F6",shadow:"rgba(59,130,246,0.15)"}:"#A16207"===o?{border:"#F59E0B",shadow:"rgba(245,158,11,0.15)"}:{border:no.accentColor,shadow:"".concat(no.accentColor,"2E")}},[J,no.accentColor]);l(function(){if(M){var o=function(o){var i;(null===(i=K.current)||void 0===i?void 0:i.contains(o.target))||(null==q?void 0:q.contains(o.target))||O()};return document.addEventListener("mousedown",o),function(){return document.removeEventListener("mousedown",o)}}},[M,O,q,K]);var co=to?[]:[no.tabs.deviation,no.tabs.association];if(1===co.length&&co[0].key===no.tabs.deviation.key)return null;if(!M||!P)return null;var so=null!==(w=null!==(y=ro===no.tabs.deviation.key?null===(m=null==$?void 0:$.cognitive_decisioning)||void 0===m?void 0:m.decision_strength:P.relevance_score)&&void 0!==y?y:Y)&&void 0!==w?w:0,po=P.decisioning,vo=Array.isArray(po)?po:"string"==typeof po&&po.trim()?[po]:[],xo=P.gap,ho=Array.isArray(xo)?xo:"string"==typeof xo&&xo.trim()?[xo]:[],uo=Q?Q.left-150:-9999,bo=(null!==(F=null==Q?void 0:Q.arrowLeft)&&void 0!==F?F:60)+150,go=i(a,o({ref:K,sx:{position:"fixed",top:null!==(k=null==Q?void 0:Q.top)&&void 0!==k?k:-9999,left:uo,zIndex:9999,width:"".concat(1050,"px"),maxWidth:"min(".concat(1050,"px, calc(100vw - ").concat(uo>0?uo:0,"px - ").concat(12,"px))"),bgcolor:"#FFFFFF",borderRadius:"14px",border:"1.5px solid ".concat(ao.border),boxShadow:"0px 8px 32px ".concat(ao.shadow,", 0px 0px 0px 3px ").concat(ao.shadow),overflow:"visible",display:"flex",flexDirection:"column",maxHeight:(null==Q?void 0:Q.maxHeight)?"min(60vh, ".concat(Q.maxHeight,"px)"):"60vh",visibility:Q?"visible":"hidden"}},{children:[Q&&(Q.openAbove?i(n,{children:[t(a,{sx:{position:"absolute",bottom:-11,left:bo-g,width:0,height:0,borderLeft:"".concat(g,"px solid transparent"),borderRight:"".concat(g,"px solid transparent"),borderTop:"".concat(11,"px solid ").concat(ao.border),zIndex:1}}),t(a,{sx:{position:"absolute",bottom:-9,left:bo-g+1,width:0,height:0,borderLeft:"".concat(9,"px solid transparent"),borderRight:"".concat(9,"px solid transparent"),borderTop:"".concat(g,"px solid #FFFFFF"),zIndex:2}})]}):i(n,{children:[t(a,{sx:{position:"absolute",top:-11,left:bo-g,width:0,height:0,borderLeft:"".concat(g,"px solid transparent"),borderRight:"".concat(g,"px solid transparent"),borderBottom:"".concat(11,"px solid ").concat(ao.border),zIndex:1}}),t(a,{sx:{position:"absolute",top:-9,left:bo-g+1,width:0,height:0,borderLeft:"".concat(9,"px solid transparent"),borderRight:"".concat(9,"px solid transparent"),borderBottom:"".concat(g,"px solid #FFFFFF"),zIndex:2}})]})),i(a,o({sx:{px:2.5,pt:2,pb:1.5,display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:2,flexShrink:0}},{children:[i(a,o({sx:{flex:1,minWidth:0}},{children:[("no counterpart"!==G||"no counterpart"!==N)&&i(c,o({sx:{fontSize:"16px",fontWeight:600,color:"#101828",lineHeight:1.3,display:"flex",alignItems:"center",gap:1,flexWrap:"nowrap",overflow:"hidden",width:"100%"}},{children:[t(a,o({component:"span",title:G,sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:"0 1 auto",maxWidth:"calc(50% - 16px)",minWidth:0}},{children:G})),t(a,o({component:"span",sx:{color:"#667085",fontWeight:400,flexShrink:0,mx:.5}},{children:"↔"})),t(a,o({component:"span",title:N||"Reference Section",sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1,minWidth:0}},{children:N||"Reference Section"}))]})),t(a,o({sx:{mt:.75,display:"inline-flex",alignItems:"center",gap:.75}},{children:t(c,o({sx:{fontSize:"no counterpart"!==G||"no counterpart"!==N?"13px":"16px",fontWeight:400,color:"#5928ED",lineHeight:1}},{children:null===(S=Object.values(no.tabs).find(function(o){return o.key===ro}))||void 0===S?void 0:S.subtitle}))}))]})),i(a,o({sx:{display:"flex",alignItems:"center",gap:1.5,flexShrink:0}},{children:[i(a,o({sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:.5,borderRadius:"20px",bgcolor:"#FFFFFF",border:"1px solid #5928ED",fontSize:"12px",fontWeight:600,color:"#5928ED"}},{children:[t(x,{}),no.decisionStrengthLabel," ",so,"%"]})),t(s,o({onClick:O,size:"small",sx:{color:"#667085",width:24,height:24,"&:hover":{bgcolor:"transparent",color:"#101828"}}},{children:t(p,{size:22})}))]}))]})),t(a,o({sx:{display:"flex",borderBottom:"1px solid #E4E7EC",px:2.5,flexShrink:0}},{children:co.map(function(i){var n=ro===i.key,e=i.key===no.tabs.deviation.key,r=co.length>1&&e&&oo,l=t(a,o({onClick:function(){r||lo(i.key)},sx:{pb:"10px",pt:"4px",mr:3,px:2,cursor:r?"not-allowed":"pointer",opacity:r?.5:1,fontSize:"14px",fontWeight:n?600:400,color:n?no.accentColor:"#667085",backgroundColor:n?"".concat(no.accentColor,"14"):"transparent",borderBottom:n?"2px solid ".concat(no.accentColor):"2px solid transparent",transition:"all 0.15s",userSelect:"none"}},{children:i.label}),i.key);return r?t(d,o({title:"Fetching deviation data",arrow:!0,placement:"top"},{children:t("span",{children:l})}),i.key):l})})),t(a,o({sx:{flex:1,minHeight:0,overflowY:"auto",px:2.5,py:2,display:"flex",flexDirection:"column",gap:1.5,"&::-webkit-scrollbar":{width:"6px"},"&::-webkit-scrollbar-track":{background:"transparent"},"&::-webkit-scrollbar-thumb":{background:"".concat(ao.border,"55"),borderRadius:"10px"},"&::-webkit-scrollbar-thumb:hover":{background:ao.border},scrollbarWidth:"thin",scrollbarColor:"".concat(ao.border,"55 transparent")}},{children:ro===no.tabs.deviation.key?$?i(n,{children:[(null===(D=(null===(C=null==$?void 0:$.cognitive_decisioning)||void 0===C?void 0:C.decisioning_factors)||[])||void 0===D?void 0:D.length)>0&&t(b,{title:"Decision Making Factors",content:null===(E=null===(_=null==$?void 0:$.cognitive_decisioning)||void 0===_?void 0:_.decisioning_factors)||void 0===E?void 0:E.join("\n\n"),citations:null===(R=null==$?void 0:$.cognitive_decisioning)||void 0===R?void 0:R.citations,styles:io,docData:V,open:M}),(null===(W=(null===(z=null==$?void 0:$.cognitive_decisioning)||void 0===z?void 0:z.gaps_in_decision)||[])||void 0===W?void 0:W.length)>0&&t(b,{title:"Gaps in Decision",content:null===(T=null===(I=null==$?void 0:$.cognitive_decisioning)||void 0===I?void 0:I.gaps_in_decision)||void 0===T?void 0:T.join("\n\n"),citations:null===(j=null==$?void 0:$.cognitive_decisioning)||void 0===j?void 0:j.citations,styles:io,docData:V,open:M}),0===(null===(B=(null===(A=null==$?void 0:$.cognitive_decisioning)||void 0===A?void 0:A.decisioning_factors)||[])||void 0===B?void 0:B.length)&&0===(null===(H=(null===(L=null==$?void 0:$.cognitive_decisioning)||void 0===L?void 0:L.gaps_in_decision)||[])||void 0===H?void 0:H.length)&&t(a,o({sx:{p:2,bgcolor:"#F8FAFC",borderRadius:"8px",border:"1px solid #E2E8F0"}},{children:t(c,o({sx:{fontSize:"13px",color:"#64748B"}},{children:"No cognitive decisioning data available for this section."}))}))]}):t(b,{title:"Deviation Analysis",content:"Deviation analysis content will appear here. This tab shows\n structural and semantic deviations identified between the two\n sections being compared.",citations:{},styles:io,docData:V,open:M}):i(n,{children:[vo.length>0&&t(b,{title:no.sectionTitles.decisioningFactors,content:vo.join("\n\n"),citations:P.citations,styles:io,open:M,docData:V}),ho.length>0&&t(b,{title:no.sectionTitles.gaps,content:ho.join("\n\n"),citations:P.citations,styles:io,open:M,docData:V}),0===vo.length&&0===ho.length&&t(a,o({sx:{p:2,bgcolor:"#F8FAFC",borderRadius:"8px",border:"1px solid #E2E8F0"}},{children:t(c,o({sx:{fontSize:"13px",color:"#64748B"}},{children:no.emptyStateMessage}))}))]})}))]}));return v.createPortal(go,document.body)};export{f as default};
|
|
2
2
|
//# sourceMappingURL=CognitivePopup.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as i}from"tslib";import{jsxs as n,jsx as e}from"react/jsx-runtime";import o,{useEffect as t}from"react";import{Box as l,Accordion as d,AccordionSummary as r,Tooltip as a,Typography as u,AccordionDetails as c}from"@mui/material";import{ChevronUp as s,ChevronDown as v}from"lucide-react";import{MemoizedMarkdown as f}from"../hooks/memoizedMarkdown.js";import{hasValue as p,generateColorPalette as
|
|
1
|
+
import{__assign as i}from"tslib";import{jsxs as n,jsx as e}from"react/jsx-runtime";import o,{useEffect as t}from"react";import{Box as l,Accordion as d,AccordionSummary as r,Tooltip as a,Typography as u,AccordionDetails as c}from"@mui/material";import{ChevronUp as s,ChevronDown as v}from"lucide-react";import{MemoizedMarkdown as f}from"../hooks/memoizedMarkdown.js";import{hasValue as p,generateColorPalette as h,isMissingStr as m,safeStringify as x,DEVIATION_BADGE_SEPARATOR as g}from"../CognitiveComparehelpers.js";import{DEFAULT_DEVIAION_COLOR as b}from"../CognitiveCompareConstants.js";var I=function(I){var y,w,_,F,S,R,k,C,B,A,M,W,O,N=I.section,T=I.idx,P=I.columnKey,j=I.colRef,D=I.mb,E=void 0===D?1:D,K=I.parentNodeId,z=void 0===K?"":K,V=I.isExpanded,G=I.onToggle,X=I.navigation,Y=I.showOpenNodeRef,H=I.resolvedMarkdownStyles,q=I.maintainRelativeOrder,J=I.showDeviationBadges,L=void 0!==J&&J,Q=I.renderSubSections,U=I.treeData,Z=I.proposedSections,$=void 0===Z?[]:Z,ii=I.existingSections,ni=void 0===ii?[]:ii,ei=I.deviationNumberRegistry,oi=void 0===ei?{}:ei,ti=I.getBadgeRef,li=I.openSummaryPopup,di=I.getSectionCompareStyle,ri=I.connectedSections,ai=I.openMoreFunctionsPopup;I.deviationNodeIdToView,I.deviationTargetParentId;var ui=I.isProposingFix,ci=I.proposingFixNodeId,si=I.collisionKey,vi=(null===(y=N.displayTitle)||void 0===y||y)&&p(N.title),fi=N.change_history,pi=!!ui&&!!ci&&"left"===P&&N.id===ci&&p(fi),hi=pi?fi||"":N.content,mi=pi?N.content:void 0,xi=(null===(w=N.displayContent)||void 0===w||w)&&p(hi),gi=!vi&&!xi,bi={current:1},Ii=N.title;vi||(Ii=xi?"No Title Found":"No Matching Section Found");var yi=N.evaluationResult;if(!yi&&"right"===P)if(q){var wi=null===(_=N.refIndexes)||void 0===_?void 0:_[0],_i=$.find(function(i){return i.selfIndex===wi});yi=null==_i?void 0:_i.evaluationResult}else yi=null===(F=$[T])||void 0===F?void 0:F.evaluationResult;var Fi=null===(S=null==U?void 0:U.input_index_map)||void 0===S?void 0:S[0],Si=null===(R=null==U?void 0:U.input_index_map)||void 0===R?void 0:R[1],Ri="left"===P?Si:Fi,ki=function(i,n){return i.find(function(i){return(null==i?void 0:i.id)&&n&&i.id===n})},Ci="left"===P?N:$[T],Bi="right"===P?N:ni[T];if(q)if("left"===P){var Ai=null===(k=N.refIndexes)||void 0===k?void 0:k[0],Mi=ni.findIndex(function(i){return i.selfIndex===Ai});Bi=-1!==Mi?ni[Mi]:ki(ni,N.id)}else{var Wi=null===(C=N.refIndexes)||void 0===C?void 0:C[0],Oi=$.findIndex(function(i){return i.selfIndex===Wi});Ci=-1!==Oi?$[Oi]:ki($,N.id)}var Ni="left"===P?!Bi:!Ci,Ti=yi||(null==Ci?void 0:Ci.evaluationResult)||(null==Bi?void 0:Bi.evaluationResult),Pi=null!==(M=null===(A=null===(B=null==Ti?void 0:Ti.evaluation_outputs)||void 0===B?void 0:B.metadata)||void 0===A?void 0:A.label_color)&&void 0!==M?M:b,ji=h(Pi).highlightBg,Di=(null==Ti?void 0:Ti.deviations)||{},Ei=T+1,Ki=N.id;if(q){var zi=1,Vi=new Map;if($.forEach(function(i){i.id&&Vi.set(i.id,zi++)}),"left"===P)Ei=Vi.get(N.id)||T+1;else{var Gi=$.filter(function(i){var n;return null===(n=i.refIndexes)||void 0===n?void 0:n.includes(N.selfIndex)});if(Gi.length>0)Ei=Vi.get(Gi[0].id)||T+1,Ki=Gi[0].id;else for(var Xi=zi,Yi=function(i){var n=$.some(function(n){var e;return null===(e=n.refIndexes)||void 0===e?void 0:e.includes(i.selfIndex)});if(!n){if(i.id===N.id)return Ei=Xi,"break";Xi++}},Hi=0,qi=ni;Hi<qi.length;Hi++){if("break"===Yi(qi[Hi]))break}}}var Ji,Li=[],Qi=Object.entries(Di).map(function(n){var e,o,t,l,d,r,a=n[0],u=n[1],c="".concat(Ki).concat(g).concat(a),s=oi[c];if(null==s)return null;var v=u[z],f=m(v);if(f)v="";else if(!v)return null;Li.push(v);var p=T,x=T;if(q)if("left"===P){var b=null===(e=N.refIndexes)||void 0===e?void 0:e[0],I=ni.findIndex(function(i){return i.selfIndex===b});if(-1!==I)x=I;else{var y=ni.findIndex(function(i){return i.id===N.id});x=-1!==y?y:T}}else{var w=null===(o=N.refIndexes)||void 0===o?void 0:o[0],_=$.findIndex(function(i){return i.selfIndex===w});if(-1!==_)p=_;else{var F=$.findIndex(function(i){return i.id===N.id});p=-1!==F?F:T}}var S="".concat(Ki).concat(g).concat(a).concat(g).concat(p).concat(g).concat(x),R=u[Ri],k=Ni||m(R),C="".concat(Ei,".").concat(s),B=T;if("right"===P&&q){var A=null===(t=N.refIndexes)||void 0===t?void 0:t[0],M=$.findIndex(function(i){return i.selfIndex===A});if(-1!==M)B=M;else{F=$.findIndex(function(i){return i.id===N.id});-1!==F&&(B=F)}}var W=di?di(B):null,O=(null==u?void 0:u.evaluation_outputs)||(null==Ti?void 0:Ti.evaluation_outputs),j=null!==(l=null==O?void 0:O.output_value)&&void 0!==l?l:null,D=null!==(r=null===(d=null==O?void 0:O.metadata)||void 0===d?void 0:d.label_color)&&void 0!==r?r:Pi,E=h(D),K=W?i(i({},W),{badgeBg:E.badgeBg,badgeBorder:E.badgeBorder,badgeText:E.badgeText}):i({},E),V=(null==u?void 0:u.deviation_summary)?{deviation_summary:u.deviation_summary,deviation_title:(null==u?void 0:u.deviation_title)||(null==Ti?void 0:Ti.deviation_title),deviation_impact:(null==u?void 0:u.deviation_impact)||(null==Ti?void 0:Ti.deviation_impact),deviation_explanation:(null==u?void 0:u.deviation_explanation)||(null==Ti?void 0:Ti.deviation_explanation),evaluation_outputs:O,cognitive_decisioning:(null==u?void 0:u.cognitive_decisioning)||(null==Ti?void 0:Ti.cognitive_decisioning)}:null,G=0,X=hi||"";if(v&&X){var Y=X.split(/\n{2,}/),H=Y.findIndex(function(i){return i.includes(v)});if(-1!==H){var J=Object.entries(Di).filter(function(i){i[0];var n=i[1][z];return n&&Y[H].includes(n)}).sort(function(i,n){return Y[H].indexOf(i[1][z])-Y[H].indexOf(n[1][z])});G=Math.max(0,J.findIndex(function(i){return i[0]===a}))}}return{id:c,actionId:S,label:C,highlight:v,side:P,style:K,stackIndex:G,score:j,isConnected:null==ri?void 0:ri.has(S),isOrphan:k,isMissingClause:f,badgeRef:ti(P,c),onClick:function(i){i.stopPropagation(),ai&&ai(i,Ci||{id:"orphan-left",title:"",content:""},k,Bi||{id:"orphan-right",title:"",content:""},S,K)},onSummaryClick:function(i){i.stopPropagation(),li(i,S,k,V)}}}).filter(Boolean),Ui=L?Qi:[],Zi=N.id&&P===(null==X?void 0:X.columnKey)?X:null,$i=o.useRef(!1);return t(function(){V||($i.current=!1)},[V]),n(l,i({ref:j,sx:{mb:E,width:"100%",display:"flex",flexDirection:"column",position:"relative",minWidth:0}},{children:[V&&(null==Zi?void 0:Zi.showAbove)&&e("div",i({style:{position:"sticky",top:0,height:"0px",cursor:"pointer"},onClick:function(){var i,n;return null===(n=null===(i=null==Zi?void 0:Zi.showAboveRef)||void 0===i?void 0:i.current)||void 0===n?void 0:n.scrollIntoView({behavior:"smooth",block:"center"})}},{children:e("div",i({style:i({transform:"translateY(-50%) translateX(calc(100% ".concat("left"===P?"+":"-"," 130px))"),position:"absolute",paddingTop:"20px"},"left"===P?{right:"0px"}:{left:"0px"})},{children:e(s,{color:(null===(W=null==Zi?void 0:Zi.showAboveRef)||void 0===W?void 0:W.current)?window.getComputedStyle(Zi.showAboveRef.current).color:void 0})}))})),n(d,i({disableGutters:!0,expanded:!gi&&V,onChange:function(){gi||(G(),Y.current=N.id)},sx:{boxShadow:"none",border:gi?"1px dashed #E2E8F0":"1px solid #E2E8F0",bgcolor:gi?"#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:[e(r,i({expandIcon:gi?null:e(v,{size:16}),sx:{minHeight:"36px",flexShrink:0,cursor:gi?"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:vi&&e(a,i({title:Ii,placement:"top"},{children:e(u,i({component:"div",sx:{fontSize:"12px",color:gi?"#94A3B8":"#19213D",fontWeight:gi?400:700,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0}},{children:(Ji=Ii,Ji?x(Ji).replace(/\\n/g,"\n").split(/(\*\*.*?\*\*)/g).map(function(i,n){return i.startsWith("**")&&i.endsWith("**")?e("strong",{children:i.slice(2,-2)},n):e(o.Fragment,{children:i},n)}):null)}))}))})),!gi&&n(c,i({sx:{pt:0,pb:1.25,bgcolor:"#FFFFFF",flex:1,display:"flex",flexDirection:"column",minWidth:0}},{children:[xi&&e(f,{content:hi,overlayContent:mi,sxStyles:H,highlights:Li,maintainRelativeOrder:q,highlightBg:ji,deviationBadges:Ui,collisionKey:si}),(N.subsections||[]).map(function(i,n){return Q({section:i,keyPath:"".concat(T,"-").concat(n),depth:0,columnKey:P,parentNodeId:z,devCounter:bi})})]}))]})),V&&(null==Zi?void 0:Zi.showBelow)&&e("div",i({style:{position:"sticky",bottom:0,height:"0px",cursor:"pointer"},onClick:function(){var i,n;return null===(n=null===(i=null==Zi?void 0:Zi.showBelowRef)||void 0===i?void 0:i.current)||void 0===n?void 0:n.scrollIntoView({behavior:"smooth",block:"center"})}},{children:e("div",i({style:i({transform:"translateY(-50%) translateX(calc(100% ".concat("left"===P?"+":"-"," 130px))"),position:"absolute",paddingBottom:"20px"},"left"===P?{right:"0px"}:{left:"0px"})},{children:e(v,{color:(null===(O=null==Zi?void 0:Zi.showBelowRef)||void 0===O?void 0:O.current)?window.getComputedStyle(Zi.showBelowRef.current).color:void 0})}))}))]}),"".concat(P,"-sec-").concat(T))};export{I as default};
|
|
2
2
|
//# sourceMappingURL=SectionAccordion.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as i}from"tslib";import{jsx as n,jsxs as
|
|
1
|
+
import{__assign as i}from"tslib";import{jsx as n,jsxs as e}from"react/jsx-runtime";import t,{useRef as o,useEffect as l}from"react";import{Box as d,Accordion as r,AccordionSummary as a,Typography as u,AccordionDetails as c}from"@mui/material";import{ChevronDown as s}from"lucide-react";import{MemoizedMarkdown as v}from"../hooks/memoizedMarkdown.js";import{hasValue as f,generateColorPalette as p,isMissingStr as h,DEVIATION_BADGE_SEPARATOR as m}from"../CognitiveComparehelpers.js";import{DEFAULT_DEVIAION_COLOR as g}from"../CognitiveCompareConstants.js";var x=t.memo(function(t){var b,y,S,_,I,k,w,C,F,P,B=t.section,R=t.keyPath,O=t.depth,E=void 0===O?0:O,M=t.columnKey,j=void 0===M?"left":M,W=t.parentNodeId,N=void 0===W?"":W,T=t.expandedSubSections,z=t.setExpandedSubSections,D=t.maintainRelativeOrder,K=t.showDeviationBadges,A=void 0!==K&&K,G=t.proposedSections,H=t.existingSections,L=t.treeData,U=t.deviationNumberRegistry,V=t.connectedSections,q=t.activeSideBySideSection,J=t.resolvedMarkdownStyles,Q=t.getSubSectionRef,X=t.getSubSectionCompareStyle,Y=t.getBadgeRef,Z=t.openMoreFunctionsPopup,$=t.openSummaryPopup,ii=t.resetSideBySide,ni=t.setConnectedSections,ei=t.setConnectedLines,ti=t.cachedConnectedPositions,oi=t.isProposingFix,li=t.proposingFixNodeId,di=null!=q?q:"",ri=(null===(b=B.displayTitle)||void 0===b||b)&&f(B.title),ai=B.change_history,ui=!!oi&&!!li&&"left"===j&&B.id===li&&f(ai),ci=ui?ai||"":B.content,si=ui?B.content:void 0,vi=(null===(y=B.displayContent)||void 0===y||y)&&f(ci),fi=!ri&&!vi,pi=ri?B.title:vi?"No Title Found":"No Matching Section Found",hi=!!T[R],mi=Q(j,R),gi=R.split("-").map(Number),xi=gi[0],bi=G[xi],yi=H[xi],Si=R,_i=R,Ii=xi,ki=xi,wi=function(i,n,e){if(!i||!n)return null;if(i.id===n)return{section:i,keyPath:e};for(var t=(i.subsections||[]).map(function(i,n){return{section:i,keyPath:"".concat(e,"-").concat(n)}}),o=function(){var i=t.shift();return(null==i?void 0:i.section)?i.section.id===n?{value:i}:void(i.section.subsections||[]).forEach(function(n,e){t.push({section:n,keyPath:"".concat(i.keyPath,"-").concat(e)})}):"continue"};t.length>0;){var l=o();if("object"==typeof l)return l.value}return null};if(D)if("left"===j){var Ci=null===(S=null==bi?void 0:bi.refIndexes)||void 0===S?void 0:S[0],Fi=H.findIndex(function(i){return i.selfIndex===Ci});-1!==Fi&&(yi=H[Fi],ki=Fi)}else{var Pi=null===(_=null==yi?void 0:yi.refIndexes)||void 0===_?void 0:_[0],Bi=G.findIndex(function(i){return i.selfIndex===Pi});-1!==Bi&&(bi=G[Bi],Ii=Bi)}var Ri=bi,Oi=yi;if(D)if("left"===j){Ri=B,Si=R;var Ei=wi(yi,B.id,String(ki));Oi=(null==Ei?void 0:Ei.section)||null,_i=(null==Ei?void 0:Ei.keyPath)||""}else{Oi=B,_i=R;var Mi=wi(bi,B.id,String(Ii));Ri=(null==Mi?void 0:Mi.section)||null,Si=(null==Mi?void 0:Mi.keyPath)||""}else for(var ji=1;ji<gi.length;ji++)(null==Ri?void 0:Ri.subsections)&&(Ri=Ri.subsections[gi[ji]]),(null==Oi?void 0:Oi.subsections)&&(Oi=Oi.subsections[gi[ji]]);var Wi=(Si?X(Si):null)||X(R),Ni=null===(I=null==L?void 0:L.input_index_map)||void 0===I?void 0:I[0],Ti=null===(k=null==L?void 0:L.input_index_map)||void 0===k?void 0:k[1],zi="left"===j?Ti:Ni,Di="left"===j?!Oi:!Ri,Ki=B.evaluationResult||(null==Ri?void 0:Ri.evaluationResult)||(null==Oi?void 0:Oi.evaluationResult),Ai=xi+1,Gi=B.id||(null==Ri?void 0:Ri.id)||(null==Oi?void 0:Oi.id);if(D){var Hi=1,Li=new Map;if(G.forEach(function(i){i.id&&Li.set(i.id,Hi++)}),"left"===j)Ai=Li.get(null==bi?void 0:bi.id)||xi+1;else{var Ui=G.filter(function(i){var n;return null===(n=i.refIndexes)||void 0===n?void 0:n.includes(null==yi?void 0:yi.selfIndex)});if(Ui.length>0)Ai=Li.get(Ui[0].id)||xi+1;else for(var Vi=Hi,qi=function(i){var n=G.some(function(n){var e;return null===(e=n.refIndexes)||void 0===e?void 0:e.includes(i.selfIndex)});if(!n){if(i.id===(null==yi?void 0:yi.id))return Ai=Vi,"break";Vi++}},Ji=0,Qi=H;Ji<Qi.length;Ji++){if("break"===qi(Qi[Ji]))break}}}var Xi=null!==(F=null===(C=null===(w=null==Ki?void 0:Ki.evaluation_outputs)||void 0===w?void 0:w.metadata)||void 0===C?void 0:C.label_color)&&void 0!==F?F:g,Yi=p(Xi).highlightBg,Zi=(null==Ki?void 0:Ki.deviations)||{},$i=[],nn=Object.entries(Zi).map(function(n){var e,t,o,l=n[0],d=n[1],r="".concat(Gi).concat(m).concat(l),a=U[r];if(null==a)return null;var u=d[N],c=h(u);if(c)u="";else if(!u)return null;$i.push(u);var s=d[zi],v=Di||h(s),f="".concat(Ai,".").concat(a),g="".concat(Gi).concat(m).concat(l).concat(m).concat(Si).concat(m).concat(_i),x=(null==d?void 0:d.evaluation_outputs)||(null==Ki?void 0:Ki.evaluation_outputs),b=null!==(e=null==x?void 0:x.output_value)&&void 0!==e?e:null,y=null!==(o=null===(t=null==x?void 0:x.metadata)||void 0===t?void 0:t.label_color)&&void 0!==o?o:Xi,S=p(y),_=i({},S),I=(null==d?void 0:d.deviation_summary)?{deviation_summary:d.deviation_summary||(null==Ki?void 0:Ki.deviation_summary),deviation_title:(null==d?void 0:d.deviation_title)||(null==Ki?void 0:Ki.deviation_title),deviation_impact:(null==d?void 0:d.deviation_impact)||(null==Ki?void 0:Ki.deviation_impact),deviation_explanation:(null==d?void 0:d.deviation_explanation)||(null==Ki?void 0:Ki.deviation_explanation),evaluation_outputs:x,cognitive_decisioning:(null==d?void 0:d.cognitive_decisioning)||(null==Ki?void 0:Ki.cognitive_decisioning)}:null,k=0,w=ci||"";if(u&&w){var C=w.split(/\n{2,}/),F=C.findIndex(function(i){return i.includes(u)});if(-1!==F){var P=Object.entries(Zi).filter(function(i){i[0];var n=i[1][N];return n&&C[F].includes(n)}).sort(function(i,n){return C[F].indexOf(i[1][N])-C[F].indexOf(n[1][N])});k=Math.max(0,P.findIndex(function(i){return i[0]===l}))}}return{id:r,actionId:g,label:f,highlight:u,side:j,style:_,stackIndex:k,score:b,isConnected:V.has(g),isOrphan:v,isMissingClause:c,badgeRef:Y(j,r),onClick:function(n){n.stopPropagation();var e=Ri?i(i({},Ri),{title:(null==bi?void 0:bi.title)||(null==Ri?void 0:Ri.title)||""}):{id:"orphan-left",title:"",content:""},t=Oi?i(i({},Oi),{title:(null==yi?void 0:yi.title)||(null==Oi?void 0:Oi.title)||""}):{id:"orphan-right",title:"",content:""};Z(n,e,v,t,g,_)},onSummaryClick:function(i){i.stopPropagation(),$(i,g,v,I)}}}).filter(Boolean).sort(function(i,n){return parseFloat(i.label)-parseFloat(n.label)}),en=A?nn:[],tn=o(!1);l(function(){hi||(tn.current=!1)},[hi]),l(function(){if(hi&&!tn.current){var i=setTimeout(function(){var i,n;tn.current=!0;var e=null===(n=null===(i=nn[0])||void 0===i?void 0:i.badgeRef)||void 0===n?void 0:n.current;e&&e.scrollIntoView({behavior:"smooth",block:"center"})},350);return function(){return clearTimeout(i)}}},[hi,nn]);var on=nn.find(function(i){return V.has(i.actionId)}),ln=!!on;if(!(ri||vi||B.subsections&&0!==B.subsections.length))return null;var dn=(null===(P=null==on?void 0:on.style)||void 0===P?void 0:P.badgeBorder)||(null==Wi?void 0:Wi.badgeBorder),rn=ln&&dn?{borderRadius:"4px",outline:"2px solid ".concat(dn),outlineOffset:"1px"}:{};return n(d,ri?i({ref:mi,sx:{mt:1,width:"100%",minWidth:0,position:"relative"}},{children:n(d,i({sx:i({width:"100%"},rn)},{children:e(r,i({disableGutters:!0,expanded:!fi&&hi,onChange:function(){if(!fi){if(hi){var n=String(q||""),e=n.includes(Si)||n.includes(_i);e||V.forEach(function(i){(String(i).includes(Si)||String(i).includes(_i))&&(e=!0)}),e&&(ii(),ni(new Set),ei([]),ti.current=[])}z(function(n){var e;return i(i({},n),((e={})[R]=!n[R],e))})}},sx:{mt:0,boxShadow:"none",border:fi?"1px dashed #E2E8F0":"1px solid #EEF2F7",borderRadius:"4px !important",bgcolor:"#FFFFFF",minWidth:0,"&:before":{display:"none"}}},{children:[n(a,i({expandIcon:fi?null:n(s,{size:14}),sx:{minHeight:"32px","& .MuiAccordionSummary-content":{my:.5,display:"grid",alignItems:"center",minWidth:0,width:"100%"}}},{children:n(u,i({component:"div",sx:{fontSize:"11px",fontWeight:600,color:fi?"#94A3B8":"#19213D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0}},{children:pi||"Untitled Subsection"}))})),!fi&&e(c,i({sx:{pt:0,pb:1,minWidth:0}},{children:[vi&&n(v,{content:ci,overlayContent:si,sxStyles:J,deviationBadges:en,maintainRelativeOrder:D,highlightBg:Yi,highlights:$i,collisionKey:di}),(B.subsections||[]).map(function(e,o){return n(x,i({},t,{section:e,keyPath:"".concat(R,"-").concat(o),depth:E+1}),"".concat(R,"-").concat(o))})]}))]}))}))}):i({ref:mi,sx:{mt:0===E?1:.75,width:"100%",minWidth:0,position:"relative"}},{children:!fi&&e(d,i({sx:i({width:"100%"},rn)},{children:[vi&&n(v,{content:ci,overlayContent:si,sxStyles:J,deviationBadges:en,maintainRelativeOrder:D,highlightBg:Yi,highlights:$i,collisionKey:di}),(B.subsections||[]).map(function(e,o){return n(x,i({},t,{section:e,keyPath:"".concat(R,"-").concat(o),depth:E+1}),"".concat(R,"-").concat(o))})]}))}))});export{x as default};
|
|
2
2
|
//# sourceMappingURL=SubSectionAccordion.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommonConstants.d.ts","sourceRoot":"","sources":["../../../../src/CommonConstants/CommonConstants.tsx"],"names":[],"mappings":"AACA,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,OAAO,CAAC;AAC5C,eAAO,MAAM,OAAO,EAAE,aAAqB,CAAC;AAC5C,eAAO,MAAM,SAAS,EAAE,aAAuB,CAAC;AAChD,eAAO,MAAM,6BAA6B,yCAAyC,CAAA;AAEnF,eAAO,MAAM,iBAAiB,EAAE,
|
|
1
|
+
{"version":3,"file":"CommonConstants.d.ts","sourceRoot":"","sources":["../../../../src/CommonConstants/CommonConstants.tsx"],"names":[],"mappings":"AACA,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,OAAO,CAAC;AAC5C,eAAO,MAAM,OAAO,EAAE,aAAqB,CAAC;AAC5C,eAAO,MAAM,SAAS,EAAE,aAAuB,CAAC;AAChD,eAAO,MAAM,6BAA6B,yCAAyC,CAAA;AAEnF,eAAO,MAAM,iBAAiB,EAAE,GA0+X/B,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CognitiveCompare.d.ts","sourceRoot":"","sources":["../../../../../src/features/CognitiveCompare/CognitiveCompare.tsx"],"names":[],"mappings":"AAuCA,OAAO,EAEL,qBAAqB,EAMtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAGL,sBAAsB,EACvB,MAAM,0BAA0B,CAAC;AAkBlC,QAAA,MAAM,gBAAgB,8PAsBnB,qBAAqB,
|
|
1
|
+
{"version":3,"file":"CognitiveCompare.d.ts","sourceRoot":"","sources":["../../../../../src/features/CognitiveCompare/CognitiveCompare.tsx"],"names":[],"mappings":"AAuCA,OAAO,EAEL,qBAAqB,EAMtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAGL,sBAAsB,EACvB,MAAM,0BAA0B,CAAC;AAkBlC,QAAA,MAAM,gBAAgB,8PAsBnB,qBAAqB,4CAwsHvB,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,KAA4B,MAAM,OAAO,CAAC;AAoBjD,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAC5E,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AA0C3E,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,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,qBAAqB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3C,uBAAuB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxC,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC/B,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,gdA6BnB,qBAAqB,
|
|
1
|
+
{"version":3,"file":"SectionAccordion.d.ts","sourceRoot":"","sources":["../../../../../../src/features/CognitiveCompare/components/SectionAccordion.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4B,MAAM,OAAO,CAAC;AAoBjD,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAC5E,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AA0C3E,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,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,qBAAqB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3C,uBAAuB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxC,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC/B,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,gdA6BnB,qBAAqB,4CA+hBvB,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,KAAqC,MAAM,OAAO,CAAC;AAqB1D,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,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,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;IACxD,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,QAAA,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,wBAAwB,
|
|
1
|
+
{"version":3,"file":"SubSectionAccordion.d.ts","sourceRoot":"","sources":["../../../../../../src/features/CognitiveCompare/components/SubSectionAccordion.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqC,MAAM,OAAO,CAAC;AAqB1D,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,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,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;IACxD,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,QAAA,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,wBAAwB,CAsb1D,CAAC;AAEH,eAAe,mBAAmB,CAAC"}
|