@viswa-test/test-citation 0.0.236 → 0.0.238
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/features/CognitiveCompare/CognitiveCompare.js +1 -1
- package/dist/cjs/features/CognitiveCompare/components/SectionAccordion.js +1 -1
- package/dist/cjs/features/CognitiveCompare/components/SvgConnectors.js +1 -1
- package/dist/cjs/features/CognitiveCompare/components/connectedLines.js +1 -1
- package/dist/features/CognitiveCompare/CognitiveCompare.js +1 -1
- package/dist/features/CognitiveCompare/components/SectionAccordion.js +1 -1
- package/dist/features/CognitiveCompare/components/SvgConnectors.js +1 -1
- package/dist/features/CognitiveCompare/components/connectedLines.js +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/SvgConnectors.d.ts +2 -1
- package/dist/types/src/features/CognitiveCompare/components/SvgConnectors.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/components/connectedLines.d.ts +1 -0
- package/dist/types/src/features/CognitiveCompare/components/connectedLines.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/hooks/useCompareLayout.d.ts +1 -0
- package/dist/types/src/features/CognitiveCompare/hooks/useCompareLayout.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"),i=require("react"),t=require("@mui/material"),o=require("lucide-react"),r=require("../../assests/svg/ButtonCognitiveIcon.js"),l=require("./OverlayComponent.js"),u=require("./CognitiveComparehelpers.js"),s=require("./CognitiveCompareConfig.js"),a=require("./CognitiveCompareConstants.js"),c=require("./CognitivePopup.js"),d=require("./MoreFunctionsPopup.js"),f=require("./LoaderComponent.js"),v=require("./components/ThreeDotsLoader.js"),g=require("./hooks/useCompareData.js"),p=require("./hooks/useComparePopups.js"),h=require("./hooks/useSectionRefs.js"),m=require("./hooks/useAccordionState.js"),S=require("./hooks/useDeviationNavigation.js"),R=require("./components/CompareHeader.js"),x=require("./components/SubSectionAccordion.js"),_=require("./components/LHSSectionRow.js"),y=require("./components/RHSSectionRow.js"),b=require("./components/CognitiveSummaryPopup.js"),C=require("./CompareContext.js"),E=require("./hooks/useStyles.js"),A=require("./hooks/useResizeHandler.js"),B=require("./hooks/useLinesCalculator.js"),I=require("./hooks/useSideBySide.js"),w=require("./components/SvgConnectors.js"),T=require("./Guidelines/components/GuidelinePanel.js");exports.SHARED_MARKDOWN_STYLES=s.SHARED_MARKDOWN_STYLES,exports.default=function(D){var O,F,j,k,P,N,M,L,q,H,V,G,z,W,K,Y,U,J,X,$,Q,Z,ee,ne,ie,te,oe,re,le,ue,se,ae,ce,de,fe,ve=D.componentHeaderText,ge=void 0===ve?a.DEFAULT_COMPONENT_HEADER_TEXT:ve,pe=D.treeData,he=D.comparisonConfig,me=D.leftColumnTitleText,Se=D.rightColumnTitleText,Re=D.markdownStyles,xe=D.resetTrigger,_e=D.displayConfig,ye=void 0===_e?{isHeaderVisible:!0,isToggleVisible:!0,maintainRelativeOrder:!1,isLoading:!0,showDeviationBadges:!1,enableDeviationSchemaBackwardCompatibility:!1,displayEmailNotifier:!0,isStreamingEnabled:!1}:_e,be=D.onMaintainRelativeOrderChange,Ce=D.popupConfig,Ee=D.deviationData,Ae=void 0===Ee?{}:Ee,Be=D.deviationNodeIdToView,Ie=D.resetDeviationNodeId,we=D.isProposingFix,Te=void 0!==we&&we,De=D.proposingFixNodeId,Oe=D.isRedlineFlow,Fe=D.badgeStyleOverride,je=D.guidelinesData,ke=i.useState(ye.maintainRelativeOrder),Pe=ke[0],Ne=ke[1],Me=null!==(O=null==ye?void 0:ye.expandLevels)&&void 0!==O?O:0,Le=!!(null==ye?void 0:ye.expandAllSections),qe=!!Pe||!!(null==ye?void 0:ye.showDeviationBadges),He=i.useState(!1),Ve=He[0],Ge=He[1],ze=i.useState(null),We=ze[0],Ke=ze[1],Ye=i.useState(null===(j=null!==(F=null==pe?void 0:pe.newEvaluationResult)&&void 0!==F?F:null==ye?void 0:ye.enableDeviationSchemaBackwardCompatibility)||void 0===j||j)[0],Ue=i.useState(new Set),Je=Ue[0],Xe=Ue[1],$e=i.useState([]),Qe=$e[0],Ze=$e[1],en=i.useState(!1),nn=en[0],tn=en[1],on=i.useRef(null),rn=i.useRef(null),ln=i.useRef(null),un=i.useRef(null),sn=i.useRef(null),an=i.useRef(!1),cn=i.useRef(null),dn=i.useRef({}),fn=i.useRef([]),vn=i.useRef(function(){}),gn=i.useRef(null),pn=i.useRef(function(){}),hn=i.useMemo(function(){return JSON.stringify(Ae||{})},[JSON.stringify(Ae)]),mn=i.useMemo(function(){return Ae||{}},[hn]),Sn=i.useMemo(function(){return(null==pe?void 0:pe.cognitive_decisioning)||{}},[pe]),Rn=i.useMemo(function(){return e.__assign(e.__assign({},s.SHARED_MARKDOWN_STYLES),Re)},[Re]),xn=i.useRef(null),_n=i.useRef(null),yn=i.useRef(null),bn=i.useRef(null),Cn=i.useRef(null),En=i.useRef(null),An=i.useRef(null),Bn=i.useRef(null),In=i.useRef(null),wn=i.useRef(null),Tn=p.useComparePopups(xn),Dn=Tn.cognitivePopup,On=Tn.setCognitivePopup,Fn=Tn.moreFunctions,jn=Tn.setMoreFunctions,kn=Tn.position,Pn=Tn.setPosition,Nn=Tn.activeBadgeId,Mn=Tn.summaryPopup,Ln=Tn.setSummaryPopup,qn=Tn.closeSummaryPopup,Hn=Tn.setActiveBadgeId,Vn=Tn.popupRef,Gn=Tn.handleOpenCognitiveCompare,zn=Tn.openCognitivePopupFromState,Wn=Tn.closeCognitivePopup,Kn=Tn.closeMoreFunctionsPopup,Yn=i.useMemo(function(){var e,n,i,t,o,r,l;return{fields:null!==(e=null==he?void 0:he.fields)&&void 0!==e?e:s.DEFAULT_FIELD_CONFIG,thresholds:{high:null!==(i=null===(n=null==he?void 0:he.thresholds)||void 0===n?void 0:n.high)&&void 0!==i?i:s.DEFAULT_COMPARISON_CONFIG.thresholds.high,medium:null!==(o=null===(t=null==he?void 0:he.thresholds)||void 0===t?void 0:t.medium)&&void 0!==o?o:s.DEFAULT_COMPARISON_CONFIG.thresholds.medium,exact:null!==(l=null===(r=null==he?void 0:he.thresholds)||void 0===r?void 0:r.exact)&&void 0!==l?l:s.DEFAULT_COMPARISON_CONFIG.thresholds.exact}}},[he]),Un=i.useState(null),Jn=Un[0];Un[1];var Xn=null===(N=null===(k=null==pe?void 0:pe.documents)||void 0===k?void 0:k[null===(P=null==pe?void 0:pe.input_index_map)||void 0===P?void 0:P[0]])||void 0===N?void 0:N.title,$n=null===(q=null===(M=null==pe?void 0:pe.documents)||void 0===M?void 0:M[null===(L=null==pe?void 0:pe.input_index_map)||void 0===L?void 0:L[1]])||void 0===q?void 0:q.title,Qn=u.safeStringify(me||Xn||"Uploaded Contract"),Zn=null===(z=null===(G=null===(H=null==pe?void 0:pe.documents)||void 0===H?void 0:H[null===(V=null==pe?void 0:pe.input_index_map)||void 0===V?void 0:V[0]])||void 0===G?void 0:G.metadata)||void 0===z?void 0:z.file_name,ei=u.safeStringify(Zn),ni=null===(U=null===(Y=null===(W=null==pe?void 0:pe.documents)||void 0===W?void 0:W[null===(K=null==pe?void 0:pe.input_index_map)||void 0===K?void 0:K[1]])||void 0===Y?void 0:Y.metadata)||void 0===U?void 0:U.file_name,ii=u.safeStringify(ni),ti=u.safeStringify(Se||$n||"Reference Template"),oi=g.useCognitiveTreeData(pe,Pe,mn,Yn,Ye,je),ri=oi.isGuidelineMode,li=oi.activeProposed,ui=oi.existingRule,si=oi.proposedSections,ai=oi.existingSections,ci=oi.visibleFields,di=oi.parentDeviationRecord,fi=oi.deviationNumberRegistry,vi=oi.deviationParentRegistry,gi=oi.parseError;i.useEffect(function(){gi&&Ke("Failed to load comparison: ".concat(gi))},[gi]);var pi=si.length>0||ai.length>0,hi=i.useMemo(function(){if(!Oe)return"off";var e=0,n=0,i=function(t){Array.isArray(t)&&t.forEach(function(t){var o,r=(null==t?void 0:t.content)||"";u.hasMeaningfulRedlineTags(r)&&(e+=1,n+=String(r).length),(null===(o=null==t?void 0:t.subsections)||void 0===o?void 0:o.length)&&i(t.subsections)})};return i(si),i(ai),"".concat(e,":").concat(n)},[Oe,si,ai]);i.useEffect(function(){if(si.length||ai.length)if(Le){var e={},n={},i=function(i,t){i.forEach(function(i,o){var r,l=Pe?"".concat(t,"-").concat(o):String(o);e[l]=!0;var u=function(e,i){null==e||e.forEach(function(e,t){var o,r="".concat(i,"-").concat(t);n[r]=!0,(null===(o=e.subsections)||void 0===o?void 0:o.length)&&u(e.subsections,r)})};(null===(r=i.subsections)||void 0===r?void 0:r.length)&&u(i.subsections,String(o))})};i(si,"left"),i(ai,"right"),Qi(e),et(n)}else if(Me>0){var t={},o={},r=function(e,n,i){e.forEach(function(e,r){var l;if(i>=1){var u=Pe?"".concat(n,"-").concat(r):String(r);t[u]=!0}var s=function(e,n,t){t>i||null==e||e.forEach(function(e,i){var r,l="".concat(n,"-").concat(i);o[l]=!0,(null===(r=e.subsections)||void 0===r?void 0:r.length)&&s(e.subsections,l,t+1)})};(null===(l=e.subsections)||void 0===l?void 0:l.length)&&i>=2&&s(e.subsections,String(r),2)})};r(si,"left",Me),r(ai,"right",Me),Qi(t),et(o)}},[Le,Me,si,ai,Pe]);var mi=h.useSectionRefs(ci.map(function(e){return e.key}),Math.max(si.length,ai.length)),Si=mi.leftRefs,Ri=mi.rightRefs,xi=mi.sectionLeftRefs,_i=mi.sectionRightRefs,yi=mi.lhsBadgeRefs,bi=mi.rhsBadgeRefs,Ci=mi.sectionRightRowRefs,Ei=mi.subSectionLeftRefs,Ai=mi.subSectionRightRefs,Bi=mi.sectionRowRefs,Ii=mi.getSectionRowRef,wi=mi.getSubSectionRef,Ti=mi.getBadgeRef,Di=I.useSideBySide({isGuidelineMode:ri,maintainRelativeOrder:Pe,proposedSections:si,existingSections:ai,leftContainerRef:Bn,rightContainerRef:yn,scrollContainerRef:xn,sectionLeftRefs:xi,sectionRightRefs:_i,subSectionLeftRefs:Ei,subSectionRightRefs:Ai,lhsBadgeRefs:yi,rhsBadgeRefs:bi,sectionRowRefs:Bi,sectionRightRowRefs:Ci,rhsTopSpacerRef:bn,rhsBottomSpacerRef:Cn,lhsTopSpacerRef:En,lhsBottomSpacerRef:An,calculateLinesRef:vn,setConnectedSections:Xe,setConnectedLines:Ze,cachedConnectedPositions:fn,closeMoreFunctionsPopup:Kn,setErrorToast:Ke,moreFunctions:Fn,closeSummaryPopup:qn}),Oi=Di.isSideBySide,Fi=Di.isArrowVisible,ji=Di.setIsArrowVisible,ki=Di.isResizing,Pi=Di.setIsResizing,Ni=Di.isSideBySideLoading,Mi=Di.activeSideBySideSection,Li=Di.scrollLock,qi=Di.sideBySideCacheRef,Hi=Di.isSideBySideRef,Vi=Di.activeSideBySideRightSectionRef,Gi=Di.activeSideBySideSectionRef,zi=Di.sideBySideLineRef,Wi=Di.highlightedClauseRefs,Ki=Di.clearClauseHighlight,Yi=Di.resetSideBySide,Ui=Di.activateSideBySide,Ji=i.useRef(Ui);i.useEffect(function(){Ji.current=Ui},[Ui]);var Xi=m.useAccordionState({maintainRelativeOrder:!!Pe,proposedSections:si,existingSections:ai,activeSideBySideSection:Mi,connectedSections:Je,resetSideBySide:Yi,setConnectedSections:Xe,setConnectedLines:Ze,cachedConnectedPositions:fn,svgContainerRef:on,isAnimatingRef:an,animationTimerRef:cn,calculateLinesRef:vn,sectionLeftRefs:xi,sectionRightRefs:_i,subSectionLeftRefs:Ei,subSectionRightRefs:Ai}),$i=Xi.expandedSections,Qi=Xi.setExpandedSections,Zi=Xi.expandedSubSections,et=Xi.setExpandedSubSections,nt=Xi.handleSubSectionToggle,it=Xi.toggleSection,tt=Xi.forceExpandCrossWiredSections,ot=function(){var e,n;if(null!=Mi){var i=null===(e=xi.current[Mi])||void 0===e?void 0:e.current,t=null===(n=_i.current[Mi])||void 0===n?void 0:n.current,o=yn.current;if(i&&t&&o){var r=i.getBoundingClientRect(),l=t.getBoundingClientRect(),u=o.getBoundingClientRect(),s=r.top-u.top,a=l.top-u.top-s;o.scrollBy({top:a,behavior:"smooth"})}}},rt=i.useCallback(function(e){null==e||e.stopPropagation(),tn(function(e){var n=!e;return n&&requestAnimationFrame(function(){ot()}),n})},[ot]);i.useEffect(function(){Oe&&"off"!==hi&&"0:0"!==hi&&(qi.current=null,fn.current=[],requestAnimationFrame(function(){var e;null===(e=vn.current)||void 0===e||e.call(vn)}))},[Oe,hi]);var lt=i.useMemo(function(){var e=new Map,n=new Map,i=1;if(Pe)si.forEach(function(n){!n.title&&!n.content||n.id&&e.set(n.id,i++)}),ai.forEach(function(t){if(t.id&&!(!t.title&&!t.content)){var o=si.filter(function(e){var n;return null===(n=e.refIndexes)||void 0===n?void 0:n.includes(t.selfIndex)});if(o.length>0){var r=o.map(function(n){return e.get(n.id)}).filter(Boolean);n.set(t.id,r.join(", "))}else n.set(t.id,String(i++))}});else for(var t=Math.max(si.length,ai.length),o=0;o<t;o++){var r=si[o],l=ai[o];r?(e.set(r.id,i),l&&n.set(l.id,String(i)),i++):l&&n.set(l.id,String(i++))}return{leftNums:e,rightNums:n}},[si,ai,Pe]),ut=ui.analysis,st=u.safeStringify(null===(X=null===(J=null==ut?void 0:ut.rule_difference_comparison)||void 0===J?void 0:J.summary)||void 0===X?void 0:X.overall_summary),at=!!st.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),ct=null!==($=null==pe?void 0:pe.base_root_id)&&void 0!==$?$:"-1";null==pe||pe[ct];var dt=Ye?null!==(ae=null!==(le=Ae&&(null===(re=null==Ae?void 0:Ae[ct])||void 0===re?void 0:re.evaluation_result))&&void 0!==le?le:null===(se=null===(ue=null==pe?void 0:pe.nodes)||void 0===ue?void 0:ue[ct])||void 0===se?void 0:se.evaluation_result)&&void 0!==ae?ae:null:null!==(oe=null!==(ee=Ae&&(null===(Z=null===(Q=null==Ae?void 0:Ae[ct])||void 0===Q?void 0:Q.evaluation_result)||void 0===Z?void 0:Z[0]))&&void 0!==ee?ee:null===(te=null===(ie=null===(ne=null==pe?void 0:pe.nodes)||void 0===ne?void 0:ne[ct])||void 0===ie?void 0:ie.evaluation_result)||void 0===te?void 0:te[0])&&void 0!==oe?oe:null,ft=u.extractDeviationScore(dt),vt=u.generateColorPalette(null!==(fe=null===(de=null===(ce=null==dt?void 0:dt.evaluation_outputs)||void 0===ce?void 0:ce.metadata)||void 0===de?void 0:de.label_color)&&void 0!==fe?fe:a.DEFAULT_DEVIAION_COLOR);if(Fe){var gt=Fe(ft);gt&&(vt=e.__assign(e.__assign({},vt),{badgeBg:gt.bg,badgeText:gt.text,badgeBorder:gt.border}))}var pt=i.useRef(Yi);i.useEffect(function(){pt.current=Yi},[Yi]);var ht=i.useRef(Wn);i.useEffect(function(){ht.current=Wn},[Wn]);var mt=i.useCallback(function(e,n,i,t,o,r){return yo.current(e,n,i,t,o,r)},[]),St=i.useCallback(function(e,n,i,t,o){return Co.current(e,n,i,t,o)},[]),Rt=i.useCallback(function(){return Eo.current()},[]),xt=i.useCallback(function(e,n){return Ao.current(e,n)},[]),_t=i.useCallback(function(e){return Bo.current(e)},[]),yt=i.useCallback(function(e){return Io.current(e)},[]),bt=i.useCallback(function(){return wo.current()},[]),Ct=i.useCallback(function(){var e,n;Ki(),null===(e=pt.current)||void 0===e||e.call(pt),tn(!1),Xe(new Set),Ze([]),fn.current=[],Gt([]),Wt(null),Ln(a.EMPTY_SUMMARY_POPUP_STATE),null===(n=ht.current)||void 0===n||n.call(ht),requestAnimationFrame(function(){var e;null===(e=vn.current)||void 0===e||e.call(vn)})},[]),Et=i.useRef(Ct);i.useEffect(function(){Et.current=Ct},[Ct]),i.useEffect(function(){xe&&Et.current()},[xe]);var At=i.useMemo(function(){return{documents:null==pe?void 0:pe.documents,input_index_map:null==pe?void 0:pe.input_index_map}},[JSON.stringify(null==pe?void 0:pe.documents),JSON.stringify(null==pe?void 0:pe.input_index_map)]),Bt=i.useRef(pe);i.useEffect(function(){Bt.current=pe},[pe]);var It=i.useRef(Sn);i.useEffect(function(){It.current=Sn},[Sn]);var wt=i.useCallback(function(n,i,t,o,r,l,s){var a,c,d,f,v,g,p,h,m,S,R,x,_=u.safeStringify(null==i?void 0:i.id)||u.safeStringify(null==t?void 0:t.id)||"",y=(_?null===(a=It.current)||void 0===a?void 0:a[_]:null)||(null==i?void 0:i.cognitiveData)||(null==t?void 0:t.cognitiveData)||{section_id:_,decisioning:[],gap:[],relevance_score:0},b=null!==(d=null===(c=Bi.current[o])||void 0===c?void 0:c.current)&&void 0!==d?d:null,C=function(){var n,r,l=(null==i?void 0:i.evaluationResult)||(null==t?void 0:t.evaluationResult)||null,s=function(n){var i=function(e){if(!e||"object"!=typeof e)return null;var n=null==e?void 0:e.deviation_entries;if(n&&"object"==typeof n){var i=Object.keys(n).sort(function(e,n){return Number(e)-Number(n)})[0];if(i&&n[i])return n[i]}var t=Object.keys(e).filter(function(e){return/^\d+$/.test(e)}).sort(function(e,n){return Number(e)-Number(n)});if(t.length&&e[t[0]])return e[t[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 i?e.__assign(e.__assign({},n),{deviation_summary:(null==n?void 0:n.deviation_summary)||(null==i?void 0:i.deviation_summary),deviation_title:(null==n?void 0:n.deviation_title)||(null==i?void 0:i.deviation_title),deviation_impact:(null==n?void 0:n.deviation_impact)||(null==i?void 0:i.deviation_impact),deviation_explanation:(null==n?void 0:n.deviation_explanation)||(null==i?void 0:i.deviation_explanation),evaluation_outputs:(null==n?void 0:n.evaluation_outputs)||(null==i?void 0:i.evaluation_outputs),cognitive_decisioning:(null==n?void 0:n.cognitive_decisioning)||(null==i?void 0:i.cognitive_decisioning)}):n};if(!("string"==typeof o&&o.includes(u.DEVIATION_BADGE_SEPARATOR)))return s(l);var a=o.split(u.DEVIATION_BADGE_SEPARATOR)[1];if(!a)return l;var c=(null==i?void 0:i.evaluationResult)||(null==t?void 0:t.evaluationResult)||{},d=(null===(n=null==c?void 0:c.deviation_entries)||void 0===n?void 0:n[a])||(null===(r=null==c?void 0:c.deviations)||void 0===r?void 0:r[a])||null;return d?e.__assign(e.__assign(e.__assign({},c),d),{deviation_summary:(null==d?void 0:d.deviation_summary)||(null==c?void 0:c.deviation_summary),deviation_title:(null==d?void 0:d.deviation_title)||(null==c?void 0:c.deviation_title),deviation_impact:(null==d?void 0:d.deviation_impact)||(null==c?void 0:c.deviation_impact),deviation_explanation:(null==d?void 0:d.deviation_explanation)||(null==c?void 0:c.deviation_explanation),evaluation_outputs:(null==d?void 0:d.evaluation_outputs)||(null==c?void 0:c.evaluation_outputs),cognitive_decisioning:(null==d?void 0:d.cognitive_decisioning)||(null==c?void 0:c.cognitive_decisioning)}):s(l)}(),E=(null!==(g=null===(v=null===(f=null==C?void 0:C.cognitive_decisioning)||void 0===f?void 0:f.decisioning_factors)||void 0===v?void 0:v.length)&&void 0!==g?g:0)>0||(null!==(m=null===(h=null===(p=null==C?void 0:C.cognitive_decisioning)||void 0===p?void 0:p.gaps_in_decision)||void 0===h?void 0:h.length)&&void 0!==m?m:0)>0,A=null!==(S=null==ye?void 0:ye.isLoading)&&void 0!==S&&S,B=!0;if(ri)if(C&&Object.keys(C).length>0){var I=Array.isArray(C)?C[0]:C,w=null===(x=null===(R=null==I?void 0:I.evaluation_outputs)||void 0===R?void 0:R.metadata)||void 0===x?void 0:x.is_orphan;!0!==w&&"true"!==w&&"Yes"!==w&&"yes"!==w||(B=!1)}else B=!1;return{isLoading:A&&!E,open:!0,sectionTitle:(null==i?void 0:i.title)?null==i?void 0:i.title:"No Counterpart",refSectionTitle:(null==t?void 0:t.title)?null==t?void 0:t.title:"No Counterpart",cognitiveData:y,anchorEl:n,sectionAnchorEl:b,badgeStyle:l||null,sectionIdx:o,docData:At,deviationData:C,isOrphan:!!r,hasGuidelineMatches:B}},[At,null==ye?void 0:ye.isLoading,ri]),Tt=i.useCallback(function(e,n,i,t,o,r){var l;if(e.stopPropagation(),Fn.open&&Fn.sectionIdx===o)Kn();else{var s=e.currentTarget,a="left";(null===(l=yn.current)||void 0===l?void 0:l.contains(s))&&(a="right");Ki(),Hi.current&&Yi(),Xe(new Set),Ze([]),fn.current=[],Wn(),Mn.open?io():qn(),requestAnimationFrame(function(){var e=function(){var e,n,i,t;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=bi.current[l])||void 0===e?void 0:e.current:null===(n=yi.current[l])||void 0===n?void 0:n.current}return"right"===a?null===(i=bi.current[o])||void 0===i?void 0:i.current:null===(t=yi.current[o])||void 0===t?void 0:t.current}()||s;jn(wt(e,n,t,o,i,r))})}},[Fn.open,Fn.sectionIdx,Kn,qn,wt]),Dt=i.useCallback(function(){var e=Fn.sectionIdx;Fn.isOrphan,Kn(),qn(),null!==e&&(tt(e),Ki(),Hi.current&&Yi(),Ze([]),fn.current=[],Xe(function(n){return n.has(e)?new Set:new Set([e])}),setTimeout(function(){vn.current&&vn.current()},50))},[Fn.sectionIdx,Fn.isOrphan,Kn,qn,Yi]),Ot=i.useCallback(function(){var e=sn.current;if(e){sn.current=null;var n=si.findIndex(function(n){return n.id===e}),i=ai.findIndex(function(n){return n.id===e}),t=-1===n?u.findKeyPathByNodeId(si,e):null,o=-1===i?u.findKeyPathByNodeId(ai,e):null,r=-1!==n?n:t?Number(t.split("-")[0]):-1,l=-1!==i?i:o?Number(o.split("-")[0]):-1,s=function(e,n,i,t){var o,r,l,u;return-1!==e?null!==(r=null===(o=i.current[e])||void 0===o?void 0:o.current)&&void 0!==r?r:null:n&&null!==(u=null===(l=t.current[n])||void 0===l?void 0:l.current)&&void 0!==u?u:null},a=function(e,n,i){void 0===i&&(i=30);var t=0,o=function(){var r=e();r&&0!==r.getBoundingClientRect().height?(Wi.current.add(r),u.scrollAndHighlightClause(r,n)):t++<i&&requestAnimationFrame(o)};requestAnimationFrame(o)};if(Pe)-1!==r&&Bn.current&&a(function(){return s(n,t,xi,Ei)},Bn.current),-1!==l&&yn.current&&a(function(){return s(i,o,_i,Ai)},yn.current);else{var c=xn.current;if(!c)return;a(function(){return-1!==r?s(n,t,xi,Ei):s(i,o,_i,Ai)},c)}}},[si,ai,Pe,xi,_i,Ei,Ai,Bn,yn,xn]),Ft=i.useCallback(function(n){if(n){Ki(),Yi(),Xe(new Set),Ze([]),fn.current=[],qn(),Wn();var i=si.findIndex(function(e){return e.id===n}),t=ai.findIndex(function(e){return e.id===n}),o=-1===i?u.findKeyPathByNodeId(si,n):null,r=-1===t?u.findKeyPathByNodeId(ai,n):null;if(-1!==i||o||-1!==t||r){var l=-1!==i?i:o?Number(o.split("-")[0]):-1,s=-1!==t?t:r?Number(r.split("-")[0]):-1;sn.current=n,Qi(function(n){var i,t=e.__assign({},n),o=!1;-1!==l&&(t[i=Pe?"left-".concat(l):String(l)]||(t[i]=!0,o=!0));-1!==s&&(t[i=Pe?"right-".concat(s):String(s)]||(t[i]=!0,o=!0));return o?t:n}),et(function(n){var i=e.__assign({},n),t=!1,l=function(e){for(var n=e.split("-"),o=n[0],r=1;r<n.length;r++)o+="-".concat(n[r]),i[o]||(i[o]=!0,t=!0)};return o&&l(o),r&&l(r),t?i:n}),setTimeout(function(){requestAnimationFrame(function(){sn.current===n&&jt.current()})},50)}else console.warn('scrollToAndHighlightClause: nodeId "'.concat(n,'" not found'))}},[si,ai,Pe,Qi,et,Yi,qn,Wn]),jt=i.useRef(Ot);i.useEffect(function(){jt.current=Ot},[Ot]);var kt=i.useRef(null);i.useEffect(function(){if(Jn){var e=Yn.fields.find(function(e){return e.analysisKey===Jn||e.key===Jn});if(e){var n=Si.current[e.key]||Ri.current[e.key];(null==n?void 0:n.current)&&setTimeout(function(){return n.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[Jn,Yn.fields]);var Pt=i.useCallback(function(e){var n,i,t,o,r,l,u,s,a,c=null===(n=null==ut?void 0:ut.rule_difference_comparison)||void 0===n?void 0:n.fields;if(!c||!c[e])return{score:0,relation:"",highlightsA:[],highlightsB:[],hasContent:!1};var d=c[e],f=(null==d?void 0:d.relation)||(null===(t=null===(i=null==d?void 0:d.highlights)||void 0===i?void 0:i.ruleA_spans)||void 0===t?void 0:t.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 v=d.mappings[0]||{};return{score:d.score,relation:v.relation||"",highlightsA:(null===(l=v.highlights)||void 0===l?void 0:l.ruleA_spans)||[],highlightsB:(null===(u=v.highlights)||void 0===u?void 0:u.ruleB_spans)||[],hasContent:!!f}}return{score:d.score,relation:d.relation||"",highlightsA:(null===(s=d.highlights)||void 0===s?void 0:s.ruleA_spans)||[],highlightsB:(null===(a=d.highlights)||void 0===a?void 0:a.ruleB_spans)||[],hasContent:!!f}},[ut]),Nt=E.useStyleHelpers({proposedSections:si,existingSections:ai,maintainRelativeOrder:Pe,cognitiveMap:Sn,deviationData:mn,treeData:pe,resolvedComparisonConfig:Yn,badgeStyleOverride:Fe}),Mt=Nt.getSectionCompareStyle,Lt=Nt.getSubSectionCompareStyle,qt=Nt.getDeviationStyleByKey,Ht=B.useLinesCalculator({containerRef:rn,leftContainerRef:Bn,rightContainerRef:yn,svgContainerRef:on,pathRefs:dn,leftHeaderRef:ln,rightHeaderRef:un,proposedSections:si,existingSections:ai,visibleFields:ci,leftRefs:Si,rightRefs:Ri,sectionLeftRefs:xi,sectionRightRefs:_i,subSectionLeftRefs:Ei,subSectionRightRefs:Ai,lhsBadgeRefs:yi,rhsBadgeRefs:bi,sectionRowRefs:Bi,expandedSections:$i,expandedSubSections:Zi,connectedSections:Je,isSideBySide:Oi,activeSideBySideSection:Mi,maintainRelativeOrder:Pe,isGuidelineMode:ri,cognitiveMap:Sn,getSectionCompareStyle:Mt,getSubSectionCompareStyle:Lt,getDeviationStyleByKey:qt,isArrowVisible:Fi,isAnimatingRef:an,isSideBySideRef:Hi,sideBySideCacheRef:qi,sideBySideLineRef:zi,activeSideBySideSectionRef:Gi,activeSideBySideRightSectionRef:Vi,connectedLines:Qe,setConnectedLines:Ze,cachedConnectedPositions:fn,calculateLinesRef:vn,resizeTimerRef:gn,scrollLock:Li,scrollSyncLocked:nn,handleResizeRef:pn,activeProposed:li,existingRule:ui,analysisData:ut,pendingScrollTargetRef:In,pendingScrollCallbackRef:wn,resolvedComparisonConfig:Yn,getFieldData:Pt}),Vt=Ht.lines,Gt=Ht.setLines,zt=Ht.overallConnector,Wt=Ht.setOverallConnector,Kt=Ht.svgDimensions,Yt=Ht.handleColumnScroll;i.useEffect(function(){Mn.anchorEl&&requestAnimationFrame(function(){requestAnimationFrame(function(){var e;null===(e=vn.current)||void 0===e||e.call(vn)})})},[Mn.anchorEl,nn]);var Ut=i.useCallback(function(){Ki(),tn(!1),Qi({}),et({}),Yi(),Xe(new Set),Ze([]),fn.current=[],qn(),Wn(),Kn(),requestAnimationFrame(function(){vn.current&&vn.current()})},[Qi,et,Yi,qn,Wn,Kn]);i.useEffect(function(){Oi||0!==Je.size||tn(!1)},[Oi,Je]);var Jt=i.useMemo(function(){return Object.values($i).some(Boolean)||Object.values(Zi).some(Boolean)},[$i,Zi]),Xt=i.useRef(null),$t=i.useRef(0),Qt=i.useRef(0),Zt=i.useRef(0),eo=A.useResizeHandler({timerRef:Xt,ruleComponentRef:_n,scrollContainerRef:xn,containerRef:rn,maintainRelativeOrder:Pe,proposedSections:si,existingSections:ai,isSideBySideRef:Hi,activeSideBySideSectionRef:Gi,activeSideBySideRightSectionRef:Vi,sectionRowRefs:Bi,sectionRightRowRefs:Ci,sectionLeftRefs:xi,sectionRightRefs:_i,subSectionLeftRefs:Ei,subSectionRightRefs:Ai,lhsBadgeRefs:yi,rhsBadgeRefs:bi,leftContainerRef:Bn,rightContainerRef:yn,calculateLinesRef:vn,handleResizeRef:pn,setIsResizing:Pi,setIsArrowVisible:ji,sideBySideCacheRef:qi,cachedConnectedPositions:fn}).handleResize;i.useEffect(function(){pn.current=eo},[eo,pn]),i.useEffect(function(){var e=function(e,n,i,t,o){n.current=e.getBoundingClientRect().width;var r=new ResizeObserver(function(e){null!==i.current&&cancelAnimationFrame(i.current),i.current=requestAnimationFrame(function(){var r,l,u;i.current=null;var s=e[e.length-1];if(s){var a=null!==(u=null===(l=null===(r=s.borderBoxSize)||void 0===r?void 0:r[0])||void 0===l?void 0:l.inlineSize)&&void 0!==u?u:s.contentRect.width;Math.abs(a-n.current)<1?o():(n.current=a,t())}})});return r.observe(e),r},n={current:null},i={current:null},t={current:null},o=[],r=[n,i,t];return _n.current&&o.push(e(_n.current,$t,n,function(){return pn.current()},function(){})),xn.current&&o.push(e(xn.current,Qt,i,function(){return pn.current()},function(){return vn.current()})),rn.current&&o.push(e(rn.current,Zt,t,function(){return pn.current()},function(){return vn.current()})),function(){o.forEach(function(e){return e.disconnect()}),r.forEach(function(e){null!==e.current&&(cancelAnimationFrame(e.current),e.current=null)})}},[]),i.useEffect(function(){Hi.current=Oi},[Oi]),i.useEffect(function(){Gi.current=Mi},[Mi]);var no=i.useCallback(function(){var e,n=Fn.sectionIdx,i=Fn.isOrphan;if(qn(),null!=n){var t="left";Fn.anchorEl&&(null===(e=yn.current)||void 0===e?void 0:e.contains(Fn.anchorEl))&&(t="right"),tt(n),Ui(n,i,{sourceSide:t})}},[Ui,Fn.isOrphan,Fn.sectionIdx,Fn.anchorEl,qn]),io=i.useCallback(function(){qn(),Yi(),Xe(new Set),Ze([]),fn.current=[]},[qn,Yi]),to=null!==Fn.sectionIdx&&Je.has(Fn.sectionIdx),oo=S.useDeviationNavigation({proposedSections:si,existingSections:ai,parentDeviationRecord:di,expandedSections:$i,maintainRelativeOrder:!!Pe,scrollContainerRef:xn,leftContainerRef:Bn,rightContainerRef:yn,lhsBadgeRefs:yi,rhsBadgeRefs:bi}),ro=oo.showDeviationNavigation,lo=oo.showOpenNodeRef,uo=oo.adjustScrollForPopup,so=i.useCallback(function(e,n,i,t,o){var r,l="string"==typeof t?u.safeStringify(t).trim():u.safeStringify(null==t?void 0:t.deviation_summary).trim(),s=e.currentTarget;Wn();var a="left";(null===(r=yn.current)||void 0===r?void 0:r.contains(s))&&(a="right");var c=function(){var e,i,t,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=bi.current[l])||void 0===e?void 0:e.current:null===(i=yi.current[l])||void 0===i?void 0:i.current}return"right"===a?null===(t=bi.current[n])||void 0===t?void 0:t.current:null===(o=yi.current[n])||void 0===o?void 0:o.current};if(i)return Yi(),Xe(new Set),Ze([]),fn.current=[],void(l&&(tt(n),requestAnimationFrame(function(){var e=c()||s;e&&(e.getBoundingClientRect().top>.8*window.innerHeight&&e.scrollIntoView({behavior:"smooth",block:"center"}));Ln({open:!0,anchorEl:e,summary:t,displayImpact:o})})));tt(n),l?setTimeout(function(){Ui(n,i,{toggleIfSame:!1,sourceSide:a,onReady:function(){var e,n,i,r=c()||s;if(r){var l=r.getBoundingClientRect();if(l.top>.8*window.innerHeight||l.top<100){var u=l.top-window.innerHeight/2;Pe?(null===(e=Bn.current)||void 0===e||e.scrollBy({top:u,behavior:"smooth"}),null===(n=yn.current)||void 0===n||n.scrollBy({top:u,behavior:"smooth"})):null===(i=xn.current)||void 0===i||i.scrollBy({top:u,behavior:"smooth"})}}Ln({open:!0,anchorEl:r,summary:t,displayImpact:o})}})},350):setTimeout(function(){Ui(n,i,{toggleIfSame:!1,sourceSide:a})},350)},[Ui,Wn,Ln,Yi,tt]),ao=i.useMemo(function(){var e;if(!Be)return null;var n=null===(e=null==Be?void 0:Be.id)||void 0===e?void 0:e.split(":")[0];for(var i in di){if((di[i]||[]).some(function(e){return e.id===n}))return i}return null},[Be,di]),co=i.useRef({id:null,triggerMs:null}),fo=i.useRef(null);i.useEffect(function(){if(null==Be?void 0:Be.id){var n=Number(Be.trigger),i=co.current;if((null==i?void 0:i.id)!==Be.id||(null==i?void 0:i.triggerMs)!==n){if(!(Be.id.includes(":")&&/:\d+$/.test(Be.id)))return co.current={id:Be.id,triggerMs:n},void Ft(Be.id);var t=Be.id.split(":"),o=t[0],r=t[1],l=null!=r?r:"0",s="".concat(Be.id,":").concat(n);fo.current!==s&&(qn(),Wn(),Yi(),Xe(new Set),Ze([]),fn.current=[],fo.current=s);var a=!1,c=0,d=null,f=null,v=!1,g=function(e,n){for(var i=function(e,t){if(!e)return null;if(n.includes(e.id)||n.includes(e.nodeId)||n.includes(e.contentId))return t;if(!Array.isArray(e.subsections))return null;for(var o=0;o<e.subsections.length;o++){var r=i(e.subsections[o],"".concat(t,"-").concat(o));if(r)return r}return null},t=0;t<e.length;t++){var o=i(e[t],String(t));if(o)return o}return null},p=function(){var i,t,r;if(!a){var s=function(){co.current={id:Be.id,triggerMs:n}},h=null,m=null;for(var S in di){var R=di[S].find(function(e){var n;return e.id===o||e.nodeId===o||e.contentId===o||(null===(n=e.evaluationResult)||void 0===n?void 0:n.nodeId)===o});if(R){h=S,m=R;break}}if(m&&h){var x=Array.from(new Set([o,m.id,m.nodeId,m.contentId,null===(i=m.evaluationResult)||void 0===i?void 0:i.nodeId].filter(Boolean))),_=si.findIndex(function(e){return e.id===h}),y=ai.findIndex(function(e){return e.id===h}),b=-1===_&&-1!==y,C=g(si,x),E=g(ai,x);if(C&&!E&&!b){var A=C.split("-"),B=Number(A[0]);if(Pe){var I=null===(r=null===(t=si[B])||void 0===t?void 0:t.refIndexes)||void 0===r?void 0:r[0],w=ai.findIndex(function(e){return e.selfIndex===I});-1!==w&&(B=w)}E=e.__spreadArray([B],A.slice(1),!0).join("-")}if(C||E){var T=C?Number(C.split("-")[0]):_,D=E?Number(E.split("-")[0]):y,O=D>=0?D:E?Number(E.split("-")[0]):-1,F=si[T],j=ai[O],k=F&&!F.title&&!F.content,P=j&&!j.title&&!j.content,N=b||(!C&&!!E||k&&!P);if(N){if(!(Pe?!!bo.current["right-".concat(D)]:!!bo.current[String(D)])&&D>=0)return it(D,"right"),void(d=setTimeout(p,200))}else if(!(Pe?!!bo.current["left-".concat(T)]:!!bo.current[String(T)])&&T>=0)return it(T,"left"),void(d=setTimeout(p,200));var M=C||"",L=E||"",q=x.map(function(e){return"".concat(e).concat(u.DEVIATION_BADGE_SEPARATOR).concat(l)}),H=q[0],V=function(){for(var e,n,i=0,t=q;i<t.length;i++){var o=t[i],r=(null===(e=yi.current[o])||void 0===e?void 0:e.current)||null,l=(null===(n=bi.current[o])||void 0===n?void 0:n.current)||null;if(r||l)return{refId:o,left:r,right:l}}return{refId:H,left:null,right:null}},G=function(e){return"".concat(e).concat(u.DEVIATION_BADGE_SEPARATOR).concat(M).concat(u.DEVIATION_BADGE_SEPARATOR).concat(L)};if(!v){tt(G(H)),v=!0,c=0;var z=function(){var e=V(),n=e.left,i=e.right;return N||!n&&!!i?i:n};return null==f||f(),void(d=setTimeout(function(){var e,n,i,t,o,r,l,u;a||(e=z,n=function(){a||(f=null,p())},t=0,o=null,r=null,l=performance.now(),u=function(){if(!a)if(performance.now()-l>3e3)n();else{var s=e();if(s&&0!==s.getBoundingClientRect().height){var c=s.getBoundingClientRect(),d=c.top,f=c.height,v=null!==o&&Math.abs(d-o)<.5,g=null!==r&&Math.abs(f-r)<.5;if(v&&g){if(++t>=5)return void n()}else t=0;o=d,r=f,i=requestAnimationFrame(u)}else i=requestAnimationFrame(u)}},i=requestAnimationFrame(u),f=function(){return cancelAnimationFrame(i)})},300))}var W=V(),K=W.refId,Y=W.left,U=W.right,J=G(K);if(Y||U){var X=N||!Y&&!!U,$=X?U:Y,Q=Pe?X?yn.current:Bn.current:xn.current;if($&&Q){var Z=$.getBoundingClientRect();if(0!==Z.height){var ee=Q.getBoundingClientRect(),ne=Z.top-ee.top+Q.scrollTop-ee.height/2+Z.height/2,ie=(null==C?void 0:C.includes("-"))||(null==E?void 0:E.includes("-")),te=function(){return e.__awaiter(void 0,void 0,void 0,function(){var n,i,t,o,r,c,d,f,v,g;return e.__generator(this,function(p){switch(p.label){case 0:return a?[2]:(s(),n=$ instanceof Element?window.getComputedStyle($).color:"",[Y,U].forEach(function(e){e&&(e.style.transition="box-shadow 300ms ease-in-out",e.style.boxShadow="0 0 10px ".concat(n))}),setTimeout(function(){[Y,U].forEach(function(e){e&&(e.style.boxShadow="")})},2e3),i=(null===(d=null===(c=m.evaluationResult)||void 0===c?void 0:c.deviations)||void 0===d?void 0:d[l])||m,t=(null===(f=m.evaluationResult)||void 0===f?void 0:f.evaluation_outputs)||m.evaluation_outputs,!!Y&&!!U?(r=function(e,n){return Promise.race([e,new Promise(function(e){return setTimeout(e,n)})])},Pe?[4,Promise.all([Bn.current?r(u.waitForScrollIdle(Bn.current),600):Promise.resolve(),yn.current?r(u.waitForScrollIdle(yn.current),600):Promise.resolve()])]:[3,2]):(o=X?(null===(v=bi.current[ie?K:D])||void 0===v?void 0:v.current)||U:(null===(g=yi.current[ie?K:T])||void 0===g?void 0:g.current)||Y,uo(o,function(){Ln({open:!0,anchorEl:o,displayImpact:Be.displayImpact,summary:e.__assign(e.__assign({},i),{evaluation_outputs:t})})},{skipScroll:!0}),null==Ie||Ie(),[2]));case 1:p.sent(),p.label=2;case 2:return Ji.current(J,!1,{toggleIfSame:!1,sourceSide:b?"right":"left",onReady:function(){var n,t,o,r;s();var l=X?(null===(n=bi.current[K])||void 0===n?void 0:n.current)||U:(null===(t=yi.current[K])||void 0===t?void 0:t.current)||Y,u=(null===(o=yi.current[K])||void 0===o?void 0:o.current)||Y,a=(null===(r=bi.current[K])||void 0===r?void 0:r.current)||U;u&&(u.style.scrollMarginTop="150px",u.scrollIntoView({behavior:"smooth",block:"start"})),a&&(a.style.scrollMarginTop="150px",a.scrollIntoView({behavior:"smooth",block:"start"})),Ln({open:!0,anchorEl:l,displayImpact:Be.displayImpact,summary:e.__assign({},i)}),null==Ie||Ie()}}),[2]}})})};Math.abs(Q.scrollTop-ne)<=2?te():u.scrollAndWait(Q,ne,te)}else++c<30&&(d=setTimeout(p,100))}else++c<30&&(d=setTimeout(p,100))}else++c<30&&(d=setTimeout(p,100))}else++c<30&&(d=setTimeout(p,100))}else++c<30&&(d=setTimeout(p,100))}};return d=setTimeout(p,100),function(){a=!0,d&&clearTimeout(d),null==f||f()}}}},[null==Be?void 0:Be.id,null==Be?void 0:Be.trigger,null==Be?void 0:Be.displayImpact,di,si,ai,Pe,Ln,Ft]),i.useEffect(function(){var n,i,t;if(Mn.open){var o=Mn.anchorEl;if(o&&!o.isConnected){var r=function(e){for(var n,i=0,t=Object.entries(e);i<t.length;i++){var r=t[i],l=r[0];if((null===(n=r[1].current)||void 0===n?void 0:n.textContent)===o.textContent)return l}return null},l=(null===(n=o.dataset)||void 0===n?void 0:n.deviationRefId)||r(yi.current)||r(bi.current);if(l){var u=(null===(i=bi.current[l])||void 0===i?void 0:i.current)||(null===(t=yi.current[l])||void 0===t?void 0:t.current);u&&u.isConnected&&Ln(function(n){return e.__assign(e.__assign({},n),{anchorEl:u})})}}}},[Mn.open,Mn.anchorEl,nn,Je,$i]);var vo=Dn.open,go=Dn.sectionIdx,po=Dn.isOrphan,ho=Dn.badgeStyle,mo=Dn.anchorEl,So=Dn.sectionAnchorEl;i.useEffect(function(){var n;if(ye.isStreamingEnabled&&vo&&null!=go&&go!==ct){var i="string"==typeof go?go.split(u.DEVIATION_BADGE_SEPARATOR)[0]:null,t=function(e,n){var i;if(!e||!Array.isArray(e))return null;for(var o=0,r=e;o<r.length;o++){var l=r[o];if(l.id===n)return l;if(null===(i=l.subsections)||void 0===i?void 0:i.length){var u=t(l.subsections,n);if(u)return u}}return null},o=i&&"string"==typeof i?t(si,i):null,r=i&&"string"==typeof i?t(ai,i):null,l="number"==typeof go?si[go]||null:o||i&&((null===(n=null==pe?void 0:pe.nodes)||void 0===n?void 0:n[i])||(null==pe?void 0:pe[i]))||null,s="number"==typeof go?ai[go]||null:r,a=wt(mo,l,s,go,po,ho);On(function(n){return n.open?u.safeStringify(n.cognitiveData)===u.safeStringify(a.cognitiveData)&&u.safeStringify(n.deviationData)===u.safeStringify(a.deviationData)&&n.sectionTitle===a.sectionTitle&&n.refSectionTitle===a.refSectionTitle?n:e.__assign(e.__assign(e.__assign({},n),a),{open:!0,anchorEl:n.anchorEl,sectionAnchorEl:n.sectionAnchorEl}):n})}},[vo,go,po,ho,mo,So,si,ai,wt]);var Ro=i.useCallback(function(e){var i=e.section,t=e.keyPath,o=e.depth,r=void 0===o?0:o,l=e.columnKey,u=void 0===l?"left":l,s=e.parentNodeId,a=void 0===s?"":s,c=e.sectionOffset,d=e.rhsOrphanVisualIndexes;return n.jsx(x.default,{section:i,keyPath:t,depth:r,columnKey:u,parentNodeId:a,sectionOffset:c,rhsOrphanVisualIndexes:d})},[]),xo=i.useMemo(function(){return si.map(function(e,i){var t,o=!(null==e?void 0:e.title)&&!(null==e?void 0:e.content),r=!(null==e?void 0:e.refIndexes)||0===e.refIndexes.length;return o&&r&&Pe?null:n.jsx(_.default,{section:e,idx:i},null!==(t=null==e?void 0:e.id)&&void 0!==t?t:"left-row-".concat(i))})},[si]),_o=i.useMemo(function(){return ai.map(function(e,i){var t,o=!(null==e?void 0:e.title)&&!(null==e?void 0:e.content),r=!(null==e?void 0:e.refIndexes)||0===e.refIndexes.length;return o&&r&&Pe?null:n.jsx(y.default,{section:e,idx:i},null!==(t=null==e?void 0:e.id)&&void 0!==t?t:"right-row-".concat(i))})},[ai]),yo=i.useRef(Tt);i.useEffect(function(){yo.current=Tt},[Tt]);var bo=i.useRef($i);i.useEffect(function(){bo.current=$i},[$i]);var Co=i.useRef(so);i.useEffect(function(){Co.current=so},[so]);var Eo=i.useRef(io);i.useEffect(function(){Eo.current=io},[io]);var Ao=i.useRef(it);i.useEffect(function(){Ao.current=it},[it]);var Bo=i.useRef(nt);i.useEffect(function(){Bo.current=nt},[nt]);var Io=i.useRef(Ro);i.useEffect(function(){Io.current=Ro},[Ro]);var wo=i.useRef(Yi);i.useEffect(function(){wo.current=Yi},[Yi]);var To=i.useMemo(function(){return{isGuidelineMode:ri,maintainRelativeOrder:!!Pe,showDeviationBadges:qe,isProposingFix:Te,proposingFixNodeId:De,isRedlineFlow:Oe,isSideBySide:Oi,activeSideBySideSection:Mi,scrollSyncLocked:nn,toggleScrollSyncLocked:rt,summaryPopupAnchorEl:Mn.anchorEl,connectedSections:Je,proposedSections:si,existingSections:ai,deviationNumberRegistry:fi,deviationParentRegistry:vi,treeData:pe,displayConfig:ye,resolvedMarkdownStyles:Rn,unifiedNumbering:lt,expandedSections:$i,expandedSubSections:Zi,setExpandedSubSections:et,getSectionCompareStyle:Mt,getSubSectionCompareStyle:Lt,getBadgeRef:Ti,getSectionRowRef:Ii,getSubSectionRef:wi,sectionLeftRefs:xi,sectionRightRefs:_i,sectionRowRefs:Bi,sectionRightRowRefs:Ci,subSectionLeftRefs:Ei,subSectionRightRefs:Ai,lhsBadgeRefs:yi,rhsBadgeRefs:bi,openMoreFunctionsPopup:mt,handleOpenSummaryPopup:St,openSummaryPopup:St,handleCloseSummaryPopup:Rt,toggleSection:xt,handleSubSectionToggle:_t,renderSubSectionAccordion:yt,resetSideBySide:bt,setConnectedSections:Xe,setConnectedLines:Ze,cachedConnectedPositions:fn,showDeviationNavigation:ro,showOpenNodeRef:lo,deviationNodeIdToView:null==Be?void 0:Be.id,deviationTargetParentId:ao,guidelinesData:je}},[ri,Pe,qe,Te,De,Oe,Oi,Mi,nn,rt,Mn.anchorEl,Je,si,ai,fi,ye,Rn,lt,$i,Zi,et,Mt,Lt,Ti,Ii,wi,ro,lo,Be,ao,je]);return n.jsx(C.CompareContextProvider,e.__assign({value:To},{children:n.jsxs(t.Box,e.__assign({ref:_n,sx:{display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif',overflow:"visible",position:"relative"}},{children:[Ve&&n.jsx(t.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(f.default,{})})),Mn.open&&n.jsx(b.default,{open:Mn.open,anchorEl:Mn.anchorEl,containerEl:kt.current,clipTopEl:ln.current,scrollContainerEl:xn.current,onClose:io,summary:Mn.summary,displayImpact:Mn.displayImpact,isScrollLocked:nn}),n.jsx(d.default,{open:Fn.open,anchorEl:Fn.anchorEl,maintainRelativeOrder:!!Pe,sectionTitle:Fn.sectionTitle,referenceSectionTitle:Fn.refSectionTitle,onClose:Kn,onOpenCognitiveCompare:Gn,onOpenSideBySide:no,onConnect:Dt,isConnected:to,isOrphan:!ri&&!!Fn.isOrphan,isGuidelineMode:ri,hasGuidelineMatches:Fn.hasGuidelineMatches}),Dn.open&&n.jsx(c.default,{open:Dn.open,popupRef:Vn,position:kn,popupConfig:Ce,onClose:function(){Pn(null),On(function(n){return e.__assign(e.__assign({},n),{open:!1})}),Hn(null)},markdownStyles:Re,sectionTitle:ei,referenceSectionTitle:ii,cognitiveData:Dn.cognitiveData,anchorEl:Dn.anchorEl,sectionAnchorEl:Dn.sectionAnchorEl,scrollContainerEl:xn.current,badgeStyle:Dn.badgeStyle,docData:Dn.docData,deviationData:Dn.deviationData,isLoading:Dn.isLoading}),n.jsx(t.Snackbar,e.__assign({open:!!We,autoHideDuration:8e3,onClose:function(){return Ke(null)},anchorOrigin:{vertical:"top",horizontal:"center"}},{children:n.jsx(t.Alert,e.__assign({onClose:function(){return Ke(null)},severity:"error",sx:{width:"100%",whiteSpace:"pre-line"}},{children:We}))})),n.jsx(R.default,{componentHeaderText:ge,displayConfig:ye,maintainRelativeOrder:Pe,onCollapseAll:Ut,showCollapseAll:Jt,onToggleView:function(e){Ge(!0),setTimeout(function(){Ne(!e),null==be||be(!e),tn(!1),Yi(),qn(),Xe(new Set),Ze([]),fn.current=[],requestAnimationFrame(function(){requestAnimationFrame(function(){setTimeout(function(){Ge(!1)},600)})})},50)}}),n.jsx(t.Box,e.__assign({ref:xn,onScroll:Yt,sx:{flex:1,minHeight:0,pt:1.5,pb:1,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",overflowY:Pe?"visible":"auto",borderTop:st&&at?"none":"1.5px solid #EEF0F4"}},{children:n.jsx(t.Box,e.__assign({sx:e.__assign({display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"},Pe?{flex:1}:{})},{children:n.jsxs(t.Box,e.__assign({ref:rn,sx:e.__assign({display:"grid",gridTemplateColumns:"minmax(0, 1fr) 180px minmax(0, 1fr)",gap:"80px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0},Pe?{flex:1,overflow:"visible"}:{})},{children:[n.jsx(w.default,{svgContainerRef:on,svgDimensions:Kt,isResizing:ki,overallConnector:zt,rootDeviationStyle:vt,lines:Vt,isSideBySide:Oi,activeSideBySideSection:Mi,isArrowVisible:Fi,maintainRelativeOrder:Pe,proposedSections:si,existingSections:ai,cognitivePopup:Dn,activeBadgeId:Nn,closeCognitivePopup:Wn,setActiveBadgeId:Hn,openCognitivePopupFromState:zn,buildSectionPopupState:wt,connectedLines:Qe,pathRefs:dn}),n.jsxs(t.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)"},Pe?{flex:1,overflow:"visible"}:{})},{children:[n.jsx(t.Box,e.__assign({ref:ln,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(t.Tooltip,e.__assign({title:Qn,placement:"top"},{children:n.jsx(t.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:Qn}))}))})),n.jsxs(t.Box,e.__assign({ref:Bn,onScroll:Yt,sx:e.__assign({p:"12px",display:"flex",flexDirection:"column"},Pe?{maxHeight:"calc(100vh - 250px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,mr:"-180px",pr:"192px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[n.jsx("div",{ref:En,style:{width:"100%",height:"0px",flexShrink:0}}),pi&&xo,n.jsx("div",{ref:An,style:{width:"100%",height:"0px",flexShrink:0}})]}))]})),n.jsx(t.Box,e.__assign({ref:kt,sx:{width:"180px",display:"flex",flexDirection:"column",alignItems:"center",pt:"15px",gap:0,zIndex:20,pointerEvents:"none"}},{children:n.jsx(t.Box,e.__assign({sx:{display:"flex",justifyContent:"center",alignItems:"center",mt:0}},{children:n.jsxs(t.Box,e.__assign({onClick:function(n){n.stopPropagation(),Dn.open&&Nn===ct?Wn():(Hn(ct),zn(wt(n.currentTarget,{title:"",content:"",evaluationResult:dt,cognitiveData:{section_id:"",decisioning:[],gap:[],relevance_score:0,isMissingRationale:!0}},null,ct,!0,e.__assign(e.__assign({},vt),{label:""}))))},sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:"5px",top:"-8px",borderRadius:"20px",bgcolor:vt.badgeBg,color:vt.badgeText,border:"1px solid ".concat(vt.badgeBorder),fontSize:"12px",fontWeight:600,whiteSpace:"nowrap",position:"relative",zIndex:1,pointerEvents:"auto",cursor:"pointer"}},{children:[null!=ft?ft:n.jsx(v.default,{}),n.jsx(t.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:Dn.open&&Nn===ct?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))})),n.jsxs(t.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},Pe?{flex:1,overflow:"visible",minHeight:0}:{})},{children:[Ni&&n.jsx(l.default,{sections:11}),n.jsx(t.Box,e.__assign({ref:un,sx:e.__assign({p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E3E6EA",borderRadius:"8px 8px 0 0",display:"flex",alignItems:"center"},Pe?e.__assign({maxHeight:"calc(100vh - 250px)",overflowY:"auto",overflowX:"hidden",minHeight:0},ri?{"&::-webkit-scrollbar":{width:"6px",display:"block"},"&::-webkit-scrollbar-track":{background:"transparent"},"&::-webkit-scrollbar-thumb":{background:"#CBD5E1",borderRadius:"10px"},"&::-webkit-scrollbar-thumb:hover":{background:"#94A3B8"},scrollbarWidth:"thin",scrollbarColor:"#CBD5E1 transparent"}:{"&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}):{})},{children:n.jsx(t.Tooltip,e.__assign({title:ti,placement:"top"},{children:n.jsx(t.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:ti}))}))})),n.jsxs(t.Box,e.__assign({ref:yn,onScroll:Yt,sx:e.__assign({p:ri?"0px":"12px",display:"flex",flexDirection:"column"},Pe?e.__assign(e.__assign({maxHeight:"calc(100vh - 250px)"},!ri&&{flex:1}),{overflowY:"auto",overflowX:"hidden",minHeight:0,ml:"-150px",pl:"165px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}):{})},{children:[n.jsx("div",{ref:bn,style:{width:"100%",height:"0px",flexShrink:0}}),ri?n.jsx(T.default,{guidelinesData:je,deviationData:Ae,connectedSections:Je,proposedSections:si}):pi&&_o,n.jsx("div",{ref:Cn,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"),i=require("react"),t=require("@mui/material"),o=require("lucide-react"),r=require("../../assests/svg/ButtonCognitiveIcon.js"),l=require("./OverlayComponent.js"),u=require("./CognitiveComparehelpers.js"),s=require("./CognitiveCompareConfig.js"),a=require("./CognitiveCompareConstants.js"),c=require("./CognitivePopup.js"),d=require("./MoreFunctionsPopup.js"),f=require("./LoaderComponent.js"),v=require("./components/ThreeDotsLoader.js"),g=require("./hooks/useCompareData.js"),p=require("./hooks/useComparePopups.js"),h=require("./hooks/useSectionRefs.js"),m=require("./hooks/useAccordionState.js"),S=require("./hooks/useDeviationNavigation.js"),R=require("./components/CompareHeader.js"),x=require("./components/SubSectionAccordion.js"),_=require("./components/LHSSectionRow.js"),y=require("./components/RHSSectionRow.js"),b=require("./components/CognitiveSummaryPopup.js"),C=require("./CompareContext.js"),E=require("./hooks/useStyles.js"),A=require("./hooks/useResizeHandler.js"),B=require("./hooks/useLinesCalculator.js"),I=require("./hooks/useSideBySide.js"),w=require("./components/SvgConnectors.js"),T=require("./Guidelines/components/GuidelinePanel.js");exports.SHARED_MARKDOWN_STYLES=s.SHARED_MARKDOWN_STYLES,exports.default=function(D){var O,F,j,k,P,N,M,L,q,H,V,G,z,W,K,Y,U,J,X,$,Q,Z,ee,ne,ie,te,oe,re,le,ue,se,ae,ce,de,fe,ve=D.componentHeaderText,ge=void 0===ve?a.DEFAULT_COMPONENT_HEADER_TEXT:ve,pe=D.treeData,he=D.comparisonConfig,me=D.leftColumnTitleText,Se=D.rightColumnTitleText,Re=D.markdownStyles,xe=D.resetTrigger,_e=D.displayConfig,ye=void 0===_e?{isHeaderVisible:!0,isToggleVisible:!0,maintainRelativeOrder:!1,isLoading:!0,showDeviationBadges:!1,enableDeviationSchemaBackwardCompatibility:!1,displayEmailNotifier:!0,isStreamingEnabled:!1}:_e,be=D.onMaintainRelativeOrderChange,Ce=D.popupConfig,Ee=D.deviationData,Ae=void 0===Ee?{}:Ee,Be=D.deviationNodeIdToView,Ie=D.resetDeviationNodeId,we=D.isProposingFix,Te=void 0!==we&&we,De=D.proposingFixNodeId,Oe=D.isRedlineFlow,Fe=D.badgeStyleOverride,je=D.guidelinesData,ke=i.useState(ye.maintainRelativeOrder),Pe=ke[0],Ne=ke[1],Me=null!==(O=null==ye?void 0:ye.expandLevels)&&void 0!==O?O:0,Le=!!(null==ye?void 0:ye.expandAllSections),qe=!!Pe||!!(null==ye?void 0:ye.showDeviationBadges),He=i.useState(!1),Ve=He[0],Ge=He[1],ze=i.useState(null),We=ze[0],Ke=ze[1],Ye=i.useState(null===(j=null!==(F=null==pe?void 0:pe.newEvaluationResult)&&void 0!==F?F:null==ye?void 0:ye.enableDeviationSchemaBackwardCompatibility)||void 0===j||j)[0],Ue=i.useState(new Set),Je=Ue[0],Xe=Ue[1],$e=i.useState([]),Qe=$e[0],Ze=$e[1],en=i.useState(!1),nn=en[0],tn=en[1],on=i.useRef(null),rn=i.useRef(null),ln=i.useRef(null),un=i.useRef(null),sn=i.useRef(null),an=i.useRef(!1),cn=i.useRef(null),dn=i.useRef({}),fn=i.useRef([]),vn=i.useRef(function(){}),gn=i.useRef(null),pn=i.useRef(function(){}),hn=i.useMemo(function(){return JSON.stringify(Ae||{})},[JSON.stringify(Ae)]),mn=i.useMemo(function(){return Ae||{}},[hn]),Sn=i.useMemo(function(){return(null==pe?void 0:pe.cognitive_decisioning)||{}},[pe]),Rn=i.useMemo(function(){return e.__assign(e.__assign({},s.SHARED_MARKDOWN_STYLES),Re)},[Re]),xn=i.useRef(null),_n=i.useRef(null),yn=i.useRef(null),bn=i.useRef(null),Cn=i.useRef(null),En=i.useRef(null),An=i.useRef(null),Bn=i.useRef(null),In=i.useRef(null),wn=i.useRef(null),Tn=p.useComparePopups(xn),Dn=Tn.cognitivePopup,On=Tn.setCognitivePopup,Fn=Tn.moreFunctions,jn=Tn.setMoreFunctions,kn=Tn.position,Pn=Tn.setPosition,Nn=Tn.activeBadgeId,Mn=Tn.summaryPopup,Ln=Tn.setSummaryPopup,qn=Tn.closeSummaryPopup,Hn=Tn.setActiveBadgeId,Vn=Tn.popupRef,Gn=Tn.handleOpenCognitiveCompare,zn=Tn.openCognitivePopupFromState,Wn=Tn.closeCognitivePopup,Kn=Tn.closeMoreFunctionsPopup,Yn=i.useMemo(function(){var e,n,i,t,o,r,l;return{fields:null!==(e=null==he?void 0:he.fields)&&void 0!==e?e:s.DEFAULT_FIELD_CONFIG,thresholds:{high:null!==(i=null===(n=null==he?void 0:he.thresholds)||void 0===n?void 0:n.high)&&void 0!==i?i:s.DEFAULT_COMPARISON_CONFIG.thresholds.high,medium:null!==(o=null===(t=null==he?void 0:he.thresholds)||void 0===t?void 0:t.medium)&&void 0!==o?o:s.DEFAULT_COMPARISON_CONFIG.thresholds.medium,exact:null!==(l=null===(r=null==he?void 0:he.thresholds)||void 0===r?void 0:r.exact)&&void 0!==l?l:s.DEFAULT_COMPARISON_CONFIG.thresholds.exact}}},[he]),Un=i.useState(null),Jn=Un[0];Un[1];var Xn=null===(N=null===(k=null==pe?void 0:pe.documents)||void 0===k?void 0:k[null===(P=null==pe?void 0:pe.input_index_map)||void 0===P?void 0:P[0]])||void 0===N?void 0:N.title,$n=null===(q=null===(M=null==pe?void 0:pe.documents)||void 0===M?void 0:M[null===(L=null==pe?void 0:pe.input_index_map)||void 0===L?void 0:L[1]])||void 0===q?void 0:q.title,Qn=u.safeStringify(me||Xn||"Uploaded Contract"),Zn=null===(z=null===(G=null===(H=null==pe?void 0:pe.documents)||void 0===H?void 0:H[null===(V=null==pe?void 0:pe.input_index_map)||void 0===V?void 0:V[0]])||void 0===G?void 0:G.metadata)||void 0===z?void 0:z.file_name,ei=u.safeStringify(Zn),ni=null===(U=null===(Y=null===(W=null==pe?void 0:pe.documents)||void 0===W?void 0:W[null===(K=null==pe?void 0:pe.input_index_map)||void 0===K?void 0:K[1]])||void 0===Y?void 0:Y.metadata)||void 0===U?void 0:U.file_name,ii=u.safeStringify(ni),ti=u.safeStringify(Se||$n||"Reference Template"),oi=g.useCognitiveTreeData(pe,Pe,mn,Yn,Ye,je),ri=oi.isGuidelineMode,li=oi.activeProposed,ui=oi.existingRule,si=oi.proposedSections,ai=oi.existingSections,ci=oi.visibleFields,di=oi.parentDeviationRecord,fi=oi.deviationNumberRegistry,vi=oi.deviationParentRegistry,gi=oi.parseError;i.useEffect(function(){gi&&Ke("Failed to load comparison: ".concat(gi))},[gi]);var pi=si.length>0||ai.length>0,hi=i.useMemo(function(){if(!Oe)return"off";var e=0,n=0,i=function(t){Array.isArray(t)&&t.forEach(function(t){var o,r=(null==t?void 0:t.content)||"";u.hasMeaningfulRedlineTags(r)&&(e+=1,n+=String(r).length),(null===(o=null==t?void 0:t.subsections)||void 0===o?void 0:o.length)&&i(t.subsections)})};return i(si),i(ai),"".concat(e,":").concat(n)},[Oe,si,ai]);i.useEffect(function(){if(si.length||ai.length)if(Le){var e={},n={},i=function(i,t){i.forEach(function(i,o){var r,l=Pe?"".concat(t,"-").concat(o):String(o);e[l]=!0;var u=function(e,i){null==e||e.forEach(function(e,t){var o,r="".concat(i,"-").concat(t);n[r]=!0,(null===(o=e.subsections)||void 0===o?void 0:o.length)&&u(e.subsections,r)})};(null===(r=i.subsections)||void 0===r?void 0:r.length)&&u(i.subsections,String(o))})};i(si,"left"),i(ai,"right"),Qi(e),et(n)}else if(Me>0){var t={},o={},r=function(e,n,i){e.forEach(function(e,r){var l;if(i>=1){var u=Pe?"".concat(n,"-").concat(r):String(r);t[u]=!0}var s=function(e,n,t){t>i||null==e||e.forEach(function(e,i){var r,l="".concat(n,"-").concat(i);o[l]=!0,(null===(r=e.subsections)||void 0===r?void 0:r.length)&&s(e.subsections,l,t+1)})};(null===(l=e.subsections)||void 0===l?void 0:l.length)&&i>=2&&s(e.subsections,String(r),2)})};r(si,"left",Me),r(ai,"right",Me),Qi(t),et(o)}},[Le,Me,si,ai,Pe]);var mi=h.useSectionRefs(ci.map(function(e){return e.key}),Math.max(si.length,ai.length)),Si=mi.leftRefs,Ri=mi.rightRefs,xi=mi.sectionLeftRefs,_i=mi.sectionRightRefs,yi=mi.lhsBadgeRefs,bi=mi.rhsBadgeRefs,Ci=mi.sectionRightRowRefs,Ei=mi.subSectionLeftRefs,Ai=mi.subSectionRightRefs,Bi=mi.sectionRowRefs,Ii=mi.getSectionRowRef,wi=mi.getSubSectionRef,Ti=mi.getBadgeRef,Di=I.useSideBySide({isGuidelineMode:ri,maintainRelativeOrder:Pe,proposedSections:si,existingSections:ai,leftContainerRef:Bn,rightContainerRef:yn,scrollContainerRef:xn,sectionLeftRefs:xi,sectionRightRefs:_i,subSectionLeftRefs:Ei,subSectionRightRefs:Ai,lhsBadgeRefs:yi,rhsBadgeRefs:bi,sectionRowRefs:Bi,sectionRightRowRefs:Ci,rhsTopSpacerRef:bn,rhsBottomSpacerRef:Cn,lhsTopSpacerRef:En,lhsBottomSpacerRef:An,calculateLinesRef:vn,setConnectedSections:Xe,setConnectedLines:Ze,cachedConnectedPositions:fn,closeMoreFunctionsPopup:Kn,setErrorToast:Ke,moreFunctions:Fn,closeSummaryPopup:qn}),Oi=Di.isSideBySide,Fi=Di.isArrowVisible,ji=Di.setIsArrowVisible,ki=Di.isResizing,Pi=Di.setIsResizing,Ni=Di.isSideBySideLoading,Mi=Di.activeSideBySideSection,Li=Di.scrollLock,qi=Di.sideBySideCacheRef,Hi=Di.isSideBySideRef,Vi=Di.activeSideBySideRightSectionRef,Gi=Di.activeSideBySideSectionRef,zi=Di.sideBySideLineRef,Wi=Di.highlightedClauseRefs,Ki=Di.clearClauseHighlight,Yi=Di.resetSideBySide,Ui=Di.activateSideBySide,Ji=i.useRef(Ui);i.useEffect(function(){Ji.current=Ui},[Ui]);var Xi=m.useAccordionState({maintainRelativeOrder:!!Pe,proposedSections:si,existingSections:ai,activeSideBySideSection:Mi,connectedSections:Je,resetSideBySide:Yi,setConnectedSections:Xe,setConnectedLines:Ze,cachedConnectedPositions:fn,svgContainerRef:on,isAnimatingRef:an,animationTimerRef:cn,calculateLinesRef:vn,sectionLeftRefs:xi,sectionRightRefs:_i,subSectionLeftRefs:Ei,subSectionRightRefs:Ai}),$i=Xi.expandedSections,Qi=Xi.setExpandedSections,Zi=Xi.expandedSubSections,et=Xi.setExpandedSubSections,nt=Xi.handleSubSectionToggle,it=Xi.toggleSection,tt=Xi.forceExpandCrossWiredSections,ot=function(){var e,n;if(null!=Mi){var i=null===(e=xi.current[Mi])||void 0===e?void 0:e.current,t=null===(n=_i.current[Mi])||void 0===n?void 0:n.current,o=yn.current;if(i&&t&&o){var r=i.getBoundingClientRect(),l=t.getBoundingClientRect(),u=o.getBoundingClientRect(),s=r.top-u.top,a=l.top-u.top-s;o.scrollBy({top:a,behavior:"smooth"})}}},rt=i.useCallback(function(e){null==e||e.stopPropagation(),tn(function(e){var n=!e;return n&&requestAnimationFrame(function(){ot()}),n})},[ot]);i.useEffect(function(){Oe&&"off"!==hi&&"0:0"!==hi&&(qi.current=null,fn.current=[],requestAnimationFrame(function(){var e;null===(e=vn.current)||void 0===e||e.call(vn)}))},[Oe,hi]);var lt=i.useMemo(function(){var e=new Map,n=new Map,i=1;if(Pe)si.forEach(function(n){!n.title&&!n.content||n.id&&e.set(n.id,i++)}),ai.forEach(function(t){if(t.id&&!(!t.title&&!t.content)){var o=si.filter(function(e){var n;return null===(n=e.refIndexes)||void 0===n?void 0:n.includes(t.selfIndex)});if(o.length>0){var r=o.map(function(n){return e.get(n.id)}).filter(Boolean);n.set(t.id,r.join(", "))}else n.set(t.id,String(i++))}});else for(var t=Math.max(si.length,ai.length),o=0;o<t;o++){var r=si[o],l=ai[o];r?(e.set(r.id,i),l&&n.set(l.id,String(i)),i++):l&&n.set(l.id,String(i++))}return{leftNums:e,rightNums:n}},[si,ai,Pe]),ut=ui.analysis,st=u.safeStringify(null===(X=null===(J=null==ut?void 0:ut.rule_difference_comparison)||void 0===J?void 0:J.summary)||void 0===X?void 0:X.overall_summary),at=!!st.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),ct=null!==($=null==pe?void 0:pe.base_root_id)&&void 0!==$?$:"-1";null==pe||pe[ct];var dt=Ye?null!==(ae=null!==(le=Ae&&(null===(re=null==Ae?void 0:Ae[ct])||void 0===re?void 0:re.evaluation_result))&&void 0!==le?le:null===(se=null===(ue=null==pe?void 0:pe.nodes)||void 0===ue?void 0:ue[ct])||void 0===se?void 0:se.evaluation_result)&&void 0!==ae?ae:null:null!==(oe=null!==(ee=Ae&&(null===(Z=null===(Q=null==Ae?void 0:Ae[ct])||void 0===Q?void 0:Q.evaluation_result)||void 0===Z?void 0:Z[0]))&&void 0!==ee?ee:null===(te=null===(ie=null===(ne=null==pe?void 0:pe.nodes)||void 0===ne?void 0:ne[ct])||void 0===ie?void 0:ie.evaluation_result)||void 0===te?void 0:te[0])&&void 0!==oe?oe:null,ft=u.extractDeviationScore(dt),vt=u.generateColorPalette(null!==(fe=null===(de=null===(ce=null==dt?void 0:dt.evaluation_outputs)||void 0===ce?void 0:ce.metadata)||void 0===de?void 0:de.label_color)&&void 0!==fe?fe:a.DEFAULT_DEVIAION_COLOR);if(Fe){var gt=Fe(ft);gt&&(vt=e.__assign(e.__assign({},vt),{badgeBg:gt.bg,badgeText:gt.text,badgeBorder:gt.border}))}var pt=i.useRef(Yi);i.useEffect(function(){pt.current=Yi},[Yi]);var ht=i.useRef(Wn);i.useEffect(function(){ht.current=Wn},[Wn]);var mt=i.useCallback(function(e,n,i,t,o,r){return yo.current(e,n,i,t,o,r)},[]),St=i.useCallback(function(e,n,i,t,o){return Co.current(e,n,i,t,o)},[]),Rt=i.useCallback(function(){return Eo.current()},[]),xt=i.useCallback(function(e,n){return Ao.current(e,n)},[]),_t=i.useCallback(function(e){return Bo.current(e)},[]),yt=i.useCallback(function(e){return Io.current(e)},[]),bt=i.useCallback(function(){return wo.current()},[]),Ct=i.useCallback(function(){var e,n;Ki(),null===(e=pt.current)||void 0===e||e.call(pt),tn(!1),Xe(new Set),Ze([]),fn.current=[],Gt([]),Wt(null),Ln(a.EMPTY_SUMMARY_POPUP_STATE),null===(n=ht.current)||void 0===n||n.call(ht),requestAnimationFrame(function(){var e;null===(e=vn.current)||void 0===e||e.call(vn)})},[]),Et=i.useRef(Ct);i.useEffect(function(){Et.current=Ct},[Ct]),i.useEffect(function(){xe&&Et.current()},[xe]);var At=i.useMemo(function(){return{documents:null==pe?void 0:pe.documents,input_index_map:null==pe?void 0:pe.input_index_map}},[JSON.stringify(null==pe?void 0:pe.documents),JSON.stringify(null==pe?void 0:pe.input_index_map)]),Bt=i.useRef(pe);i.useEffect(function(){Bt.current=pe},[pe]);var It=i.useRef(Sn);i.useEffect(function(){It.current=Sn},[Sn]);var wt=i.useCallback(function(n,i,t,o,r,l,s){var a,c,d,f,v,g,p,h,m,S,R,x,_=u.safeStringify(null==i?void 0:i.id)||u.safeStringify(null==t?void 0:t.id)||"",y=(_?null===(a=It.current)||void 0===a?void 0:a[_]:null)||(null==i?void 0:i.cognitiveData)||(null==t?void 0:t.cognitiveData)||{section_id:_,decisioning:[],gap:[],relevance_score:0},b=null!==(d=null===(c=Bi.current[o])||void 0===c?void 0:c.current)&&void 0!==d?d:null,C=function(){var n,r,l=(null==i?void 0:i.evaluationResult)||(null==t?void 0:t.evaluationResult)||null,s=function(n){var i=function(e){if(!e||"object"!=typeof e)return null;var n=null==e?void 0:e.deviation_entries;if(n&&"object"==typeof n){var i=Object.keys(n).sort(function(e,n){return Number(e)-Number(n)})[0];if(i&&n[i])return n[i]}var t=Object.keys(e).filter(function(e){return/^\d+$/.test(e)}).sort(function(e,n){return Number(e)-Number(n)});if(t.length&&e[t[0]])return e[t[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 i?e.__assign(e.__assign({},n),{deviation_summary:(null==n?void 0:n.deviation_summary)||(null==i?void 0:i.deviation_summary),deviation_title:(null==n?void 0:n.deviation_title)||(null==i?void 0:i.deviation_title),deviation_impact:(null==n?void 0:n.deviation_impact)||(null==i?void 0:i.deviation_impact),deviation_explanation:(null==n?void 0:n.deviation_explanation)||(null==i?void 0:i.deviation_explanation),evaluation_outputs:(null==n?void 0:n.evaluation_outputs)||(null==i?void 0:i.evaluation_outputs),cognitive_decisioning:(null==n?void 0:n.cognitive_decisioning)||(null==i?void 0:i.cognitive_decisioning)}):n};if(!("string"==typeof o&&o.includes(u.DEVIATION_BADGE_SEPARATOR)))return s(l);var a=o.split(u.DEVIATION_BADGE_SEPARATOR)[1];if(!a)return l;var c=(null==i?void 0:i.evaluationResult)||(null==t?void 0:t.evaluationResult)||{},d=(null===(n=null==c?void 0:c.deviation_entries)||void 0===n?void 0:n[a])||(null===(r=null==c?void 0:c.deviations)||void 0===r?void 0:r[a])||null;return d?e.__assign(e.__assign(e.__assign({},c),d),{deviation_summary:(null==d?void 0:d.deviation_summary)||(null==c?void 0:c.deviation_summary),deviation_title:(null==d?void 0:d.deviation_title)||(null==c?void 0:c.deviation_title),deviation_impact:(null==d?void 0:d.deviation_impact)||(null==c?void 0:c.deviation_impact),deviation_explanation:(null==d?void 0:d.deviation_explanation)||(null==c?void 0:c.deviation_explanation),evaluation_outputs:(null==d?void 0:d.evaluation_outputs)||(null==c?void 0:c.evaluation_outputs),cognitive_decisioning:(null==d?void 0:d.cognitive_decisioning)||(null==c?void 0:c.cognitive_decisioning)}):s(l)}(),E=(null!==(g=null===(v=null===(f=null==C?void 0:C.cognitive_decisioning)||void 0===f?void 0:f.decisioning_factors)||void 0===v?void 0:v.length)&&void 0!==g?g:0)>0||(null!==(m=null===(h=null===(p=null==C?void 0:C.cognitive_decisioning)||void 0===p?void 0:p.gaps_in_decision)||void 0===h?void 0:h.length)&&void 0!==m?m:0)>0,A=null!==(S=null==ye?void 0:ye.isLoading)&&void 0!==S&&S,B=!0;if(ri)if(C&&Object.keys(C).length>0){var I=Array.isArray(C)?C[0]:C,w=null===(x=null===(R=null==I?void 0:I.evaluation_outputs)||void 0===R?void 0:R.metadata)||void 0===x?void 0:x.is_orphan;!0!==w&&"true"!==w&&"Yes"!==w&&"yes"!==w||(B=!1)}else B=!1;return{isLoading:A&&!E,open:!0,sectionTitle:(null==i?void 0:i.title)?null==i?void 0:i.title:"No Counterpart",refSectionTitle:(null==t?void 0:t.title)?null==t?void 0:t.title:"No Counterpart",cognitiveData:y,anchorEl:n,sectionAnchorEl:b,badgeStyle:l||null,sectionIdx:o,docData:At,deviationData:C,isOrphan:!!r,hasGuidelineMatches:B}},[At,null==ye?void 0:ye.isLoading,ri]),Tt=i.useCallback(function(e,n,i,t,o,r){var l;if(e.stopPropagation(),Fn.open&&Fn.sectionIdx===o)Kn();else{var s=e.currentTarget,a="left";(null===(l=yn.current)||void 0===l?void 0:l.contains(s))&&(a="right");Ki(),Hi.current&&Yi(),Xe(new Set),Ze([]),fn.current=[],Wn(),Mn.open?io():qn(),requestAnimationFrame(function(){var e=function(){var e,n,i,t;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=bi.current[l])||void 0===e?void 0:e.current:null===(n=yi.current[l])||void 0===n?void 0:n.current}return"right"===a?null===(i=bi.current[o])||void 0===i?void 0:i.current:null===(t=yi.current[o])||void 0===t?void 0:t.current}()||s;jn(wt(e,n,t,o,i,r))})}},[Fn.open,Fn.sectionIdx,Kn,qn,wt]),Dt=i.useCallback(function(){var e=Fn.sectionIdx;Fn.isOrphan,Kn(),qn(),null!==e&&(tt(e),Ki(),Hi.current&&Yi(),Ze([]),fn.current=[],Xe(function(n){return n.has(e)?new Set:new Set([e])}),setTimeout(function(){vn.current&&vn.current()},50))},[Fn.sectionIdx,Fn.isOrphan,Kn,qn,Yi]),Ot=i.useCallback(function(){var e=sn.current;if(e){sn.current=null;var n=si.findIndex(function(n){return n.id===e}),i=ai.findIndex(function(n){return n.id===e}),t=-1===n?u.findKeyPathByNodeId(si,e):null,o=-1===i?u.findKeyPathByNodeId(ai,e):null,r=-1!==n?n:t?Number(t.split("-")[0]):-1,l=-1!==i?i:o?Number(o.split("-")[0]):-1,s=function(e,n,i,t){var o,r,l,u;return-1!==e?null!==(r=null===(o=i.current[e])||void 0===o?void 0:o.current)&&void 0!==r?r:null:n&&null!==(u=null===(l=t.current[n])||void 0===l?void 0:l.current)&&void 0!==u?u:null},a=function(e,n,i){void 0===i&&(i=30);var t=0,o=function(){var r=e();r&&0!==r.getBoundingClientRect().height?(Wi.current.add(r),u.scrollAndHighlightClause(r,n)):t++<i&&requestAnimationFrame(o)};requestAnimationFrame(o)};if(Pe)-1!==r&&Bn.current&&a(function(){return s(n,t,xi,Ei)},Bn.current),-1!==l&&yn.current&&a(function(){return s(i,o,_i,Ai)},yn.current);else{var c=xn.current;if(!c)return;a(function(){return-1!==r?s(n,t,xi,Ei):s(i,o,_i,Ai)},c)}}},[si,ai,Pe,xi,_i,Ei,Ai,Bn,yn,xn]),Ft=i.useCallback(function(n){if(n){Ki(),Yi(),Xe(new Set),Ze([]),fn.current=[],qn(),Wn();var i=si.findIndex(function(e){return e.id===n}),t=ai.findIndex(function(e){return e.id===n}),o=-1===i?u.findKeyPathByNodeId(si,n):null,r=-1===t?u.findKeyPathByNodeId(ai,n):null;if(-1!==i||o||-1!==t||r){var l=-1!==i?i:o?Number(o.split("-")[0]):-1,s=-1!==t?t:r?Number(r.split("-")[0]):-1;sn.current=n,Qi(function(n){var i,t=e.__assign({},n),o=!1;-1!==l&&(t[i=Pe?"left-".concat(l):String(l)]||(t[i]=!0,o=!0));-1!==s&&(t[i=Pe?"right-".concat(s):String(s)]||(t[i]=!0,o=!0));return o?t:n}),et(function(n){var i=e.__assign({},n),t=!1,l=function(e){for(var n=e.split("-"),o=n[0],r=1;r<n.length;r++)o+="-".concat(n[r]),i[o]||(i[o]=!0,t=!0)};return o&&l(o),r&&l(r),t?i:n}),setTimeout(function(){requestAnimationFrame(function(){sn.current===n&&jt.current()})},50)}else console.warn('scrollToAndHighlightClause: nodeId "'.concat(n,'" not found'))}},[si,ai,Pe,Qi,et,Yi,qn,Wn]),jt=i.useRef(Ot);i.useEffect(function(){jt.current=Ot},[Ot]);var kt=i.useRef(null);i.useEffect(function(){if(Jn){var e=Yn.fields.find(function(e){return e.analysisKey===Jn||e.key===Jn});if(e){var n=Si.current[e.key]||Ri.current[e.key];(null==n?void 0:n.current)&&setTimeout(function(){return n.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[Jn,Yn.fields]);var Pt=i.useCallback(function(e){var n,i,t,o,r,l,u,s,a,c=null===(n=null==ut?void 0:ut.rule_difference_comparison)||void 0===n?void 0:n.fields;if(!c||!c[e])return{score:0,relation:"",highlightsA:[],highlightsB:[],hasContent:!1};var d=c[e],f=(null==d?void 0:d.relation)||(null===(t=null===(i=null==d?void 0:d.highlights)||void 0===i?void 0:i.ruleA_spans)||void 0===t?void 0:t.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 v=d.mappings[0]||{};return{score:d.score,relation:v.relation||"",highlightsA:(null===(l=v.highlights)||void 0===l?void 0:l.ruleA_spans)||[],highlightsB:(null===(u=v.highlights)||void 0===u?void 0:u.ruleB_spans)||[],hasContent:!!f}}return{score:d.score,relation:d.relation||"",highlightsA:(null===(s=d.highlights)||void 0===s?void 0:s.ruleA_spans)||[],highlightsB:(null===(a=d.highlights)||void 0===a?void 0:a.ruleB_spans)||[],hasContent:!!f}},[ut]),Nt=E.useStyleHelpers({proposedSections:si,existingSections:ai,maintainRelativeOrder:Pe,cognitiveMap:Sn,deviationData:mn,treeData:pe,resolvedComparisonConfig:Yn,badgeStyleOverride:Fe}),Mt=Nt.getSectionCompareStyle,Lt=Nt.getSubSectionCompareStyle,qt=Nt.getDeviationStyleByKey,Ht=B.useLinesCalculator({containerRef:rn,leftContainerRef:Bn,rightContainerRef:yn,svgContainerRef:on,pathRefs:dn,leftHeaderRef:ln,rightHeaderRef:un,proposedSections:si,existingSections:ai,visibleFields:ci,leftRefs:Si,rightRefs:Ri,sectionLeftRefs:xi,sectionRightRefs:_i,subSectionLeftRefs:Ei,subSectionRightRefs:Ai,lhsBadgeRefs:yi,rhsBadgeRefs:bi,sectionRowRefs:Bi,expandedSections:$i,expandedSubSections:Zi,connectedSections:Je,isSideBySide:Oi,activeSideBySideSection:Mi,maintainRelativeOrder:Pe,isGuidelineMode:ri,cognitiveMap:Sn,getSectionCompareStyle:Mt,getSubSectionCompareStyle:Lt,getDeviationStyleByKey:qt,isArrowVisible:Fi,isAnimatingRef:an,isSideBySideRef:Hi,sideBySideCacheRef:qi,sideBySideLineRef:zi,activeSideBySideSectionRef:Gi,activeSideBySideRightSectionRef:Vi,connectedLines:Qe,setConnectedLines:Ze,cachedConnectedPositions:fn,calculateLinesRef:vn,resizeTimerRef:gn,scrollLock:Li,scrollSyncLocked:nn,handleResizeRef:pn,activeProposed:li,existingRule:ui,analysisData:ut,pendingScrollTargetRef:In,pendingScrollCallbackRef:wn,resolvedComparisonConfig:Yn,getFieldData:Pt}),Vt=Ht.lines,Gt=Ht.setLines,zt=Ht.overallConnector,Wt=Ht.setOverallConnector,Kt=Ht.svgDimensions,Yt=Ht.handleColumnScroll;i.useEffect(function(){Mn.anchorEl&&requestAnimationFrame(function(){requestAnimationFrame(function(){var e;null===(e=vn.current)||void 0===e||e.call(vn)})})},[Mn.anchorEl,nn]);var Ut=i.useCallback(function(){Ki(),tn(!1),Qi({}),et({}),Yi(),Xe(new Set),Ze([]),fn.current=[],qn(),Wn(),Kn(),requestAnimationFrame(function(){vn.current&&vn.current()})},[Qi,et,Yi,qn,Wn,Kn]);i.useEffect(function(){Oi||0!==Je.size||tn(!1)},[Oi,Je]);var Jt=i.useMemo(function(){return Object.values($i).some(Boolean)||Object.values(Zi).some(Boolean)},[$i,Zi]),Xt=i.useRef(null),$t=i.useRef(0),Qt=i.useRef(0),Zt=i.useRef(0),eo=A.useResizeHandler({timerRef:Xt,ruleComponentRef:_n,scrollContainerRef:xn,containerRef:rn,maintainRelativeOrder:Pe,proposedSections:si,existingSections:ai,isSideBySideRef:Hi,activeSideBySideSectionRef:Gi,activeSideBySideRightSectionRef:Vi,sectionRowRefs:Bi,sectionRightRowRefs:Ci,sectionLeftRefs:xi,sectionRightRefs:_i,subSectionLeftRefs:Ei,subSectionRightRefs:Ai,lhsBadgeRefs:yi,rhsBadgeRefs:bi,leftContainerRef:Bn,rightContainerRef:yn,calculateLinesRef:vn,handleResizeRef:pn,setIsResizing:Pi,setIsArrowVisible:ji,sideBySideCacheRef:qi,cachedConnectedPositions:fn}).handleResize;i.useEffect(function(){pn.current=eo},[eo,pn]),i.useEffect(function(){var e=function(e,n,i,t,o){n.current=e.getBoundingClientRect().width;var r=new ResizeObserver(function(e){null!==i.current&&cancelAnimationFrame(i.current),i.current=requestAnimationFrame(function(){var r,l,u;i.current=null;var s=e[e.length-1];if(s){var a=null!==(u=null===(l=null===(r=s.borderBoxSize)||void 0===r?void 0:r[0])||void 0===l?void 0:l.inlineSize)&&void 0!==u?u:s.contentRect.width;Math.abs(a-n.current)<1?o():(n.current=a,t())}})});return r.observe(e),r},n={current:null},i={current:null},t={current:null},o=[],r=[n,i,t];return _n.current&&o.push(e(_n.current,$t,n,function(){return pn.current()},function(){})),xn.current&&o.push(e(xn.current,Qt,i,function(){return pn.current()},function(){return vn.current()})),rn.current&&o.push(e(rn.current,Zt,t,function(){return pn.current()},function(){return vn.current()})),function(){o.forEach(function(e){return e.disconnect()}),r.forEach(function(e){null!==e.current&&(cancelAnimationFrame(e.current),e.current=null)})}},[]),i.useEffect(function(){Hi.current=Oi},[Oi]),i.useEffect(function(){Gi.current=Mi},[Mi]);var no=i.useCallback(function(){var e,n=Fn.sectionIdx,i=Fn.isOrphan;if(qn(),null!=n){var t="left";Fn.anchorEl&&(null===(e=yn.current)||void 0===e?void 0:e.contains(Fn.anchorEl))&&(t="right"),tt(n),Ui(n,i,{sourceSide:t})}},[Ui,Fn.isOrphan,Fn.sectionIdx,Fn.anchorEl,qn]),io=i.useCallback(function(){qn(),Yi(),Xe(new Set),Ze([]),fn.current=[]},[qn,Yi]),to=null!==Fn.sectionIdx&&Je.has(Fn.sectionIdx),oo=S.useDeviationNavigation({proposedSections:si,existingSections:ai,parentDeviationRecord:di,expandedSections:$i,maintainRelativeOrder:!!Pe,scrollContainerRef:xn,leftContainerRef:Bn,rightContainerRef:yn,lhsBadgeRefs:yi,rhsBadgeRefs:bi}),ro=oo.showDeviationNavigation,lo=oo.showOpenNodeRef,uo=oo.adjustScrollForPopup,so=i.useCallback(function(e,n,i,t,o){var r,l="string"==typeof t?u.safeStringify(t).trim():u.safeStringify(null==t?void 0:t.deviation_summary).trim(),s=e.currentTarget;Wn();var a="left";(null===(r=yn.current)||void 0===r?void 0:r.contains(s))&&(a="right");var c=function(){var e,i,t,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=bi.current[l])||void 0===e?void 0:e.current:null===(i=yi.current[l])||void 0===i?void 0:i.current}return"right"===a?null===(t=bi.current[n])||void 0===t?void 0:t.current:null===(o=yi.current[n])||void 0===o?void 0:o.current};if(i)return Yi(),Xe(new Set),Ze([]),fn.current=[],void(l&&(tt(n),requestAnimationFrame(function(){var e=c()||s;e&&(e.getBoundingClientRect().top>.8*window.innerHeight&&e.scrollIntoView({behavior:"smooth",block:"center"}));Ln({open:!0,anchorEl:e,summary:t,displayImpact:o})})));tt(n),l?setTimeout(function(){Ui(n,i,{toggleIfSame:!1,sourceSide:a,onReady:function(){var e,n,i,r=c()||s;if(r){var l=r.getBoundingClientRect();if(l.top>.8*window.innerHeight||l.top<100){var u=l.top-window.innerHeight/2;Pe?(null===(e=Bn.current)||void 0===e||e.scrollBy({top:u,behavior:"smooth"}),null===(n=yn.current)||void 0===n||n.scrollBy({top:u,behavior:"smooth"})):null===(i=xn.current)||void 0===i||i.scrollBy({top:u,behavior:"smooth"})}}Ln({open:!0,anchorEl:r,summary:t,displayImpact:o})}})},350):setTimeout(function(){Ui(n,i,{toggleIfSame:!1,sourceSide:a})},350)},[Ui,Wn,Ln,Yi,tt]),ao=i.useMemo(function(){var e;if(!Be)return null;var n=null===(e=null==Be?void 0:Be.id)||void 0===e?void 0:e.split(":")[0];for(var i in di){if((di[i]||[]).some(function(e){return e.id===n}))return i}return null},[Be,di]),co=i.useRef({id:null,triggerMs:null}),fo=i.useRef(null);i.useEffect(function(){if(null==Be?void 0:Be.id){var n=Number(Be.trigger),i=co.current;if((null==i?void 0:i.id)!==Be.id||(null==i?void 0:i.triggerMs)!==n){if(!(Be.id.includes(":")&&/:\d+$/.test(Be.id)))return co.current={id:Be.id,triggerMs:n},void Ft(Be.id);var t=Be.id.split(":"),o=t[0],r=t[1],l=null!=r?r:"0",s="".concat(Be.id,":").concat(n);fo.current!==s&&(qn(),Wn(),Yi(),Xe(new Set),Ze([]),fn.current=[],fo.current=s);var a=!1,c=0,d=null,f=null,v=!1,g=function(e,n){for(var i=function(e,t){if(!e)return null;if(n.includes(e.id)||n.includes(e.nodeId)||n.includes(e.contentId))return t;if(!Array.isArray(e.subsections))return null;for(var o=0;o<e.subsections.length;o++){var r=i(e.subsections[o],"".concat(t,"-").concat(o));if(r)return r}return null},t=0;t<e.length;t++){var o=i(e[t],String(t));if(o)return o}return null},p=function(){var i,t,r;if(!a){var s=function(){co.current={id:Be.id,triggerMs:n}},h=null,m=null;for(var S in di){var R=di[S].find(function(e){var n;return e.id===o||e.nodeId===o||e.contentId===o||(null===(n=e.evaluationResult)||void 0===n?void 0:n.nodeId)===o});if(R){h=S,m=R;break}}if(m&&h){var x=Array.from(new Set([o,m.id,m.nodeId,m.contentId,null===(i=m.evaluationResult)||void 0===i?void 0:i.nodeId].filter(Boolean))),_=si.findIndex(function(e){return e.id===h}),y=ai.findIndex(function(e){return e.id===h}),b=-1===_&&-1!==y,C=g(si,x),E=g(ai,x);if(C&&!E&&!b){var A=C.split("-"),B=Number(A[0]);if(Pe){var I=null===(r=null===(t=si[B])||void 0===t?void 0:t.refIndexes)||void 0===r?void 0:r[0],w=ai.findIndex(function(e){return e.selfIndex===I});-1!==w&&(B=w)}E=e.__spreadArray([B],A.slice(1),!0).join("-")}if(C||E){var T=C?Number(C.split("-")[0]):_,D=E?Number(E.split("-")[0]):y,O=D>=0?D:E?Number(E.split("-")[0]):-1,F=si[T],j=ai[O],k=F&&!F.title&&!F.content,P=j&&!j.title&&!j.content,N=b||(!C&&!!E||k&&!P);if(N){if(!(Pe?!!bo.current["right-".concat(D)]:!!bo.current[String(D)])&&D>=0)return it(D,"right"),void(d=setTimeout(p,200))}else if(!(Pe?!!bo.current["left-".concat(T)]:!!bo.current[String(T)])&&T>=0)return it(T,"left"),void(d=setTimeout(p,200));var M=C||"",L=E||"",q=x.map(function(e){return"".concat(e).concat(u.DEVIATION_BADGE_SEPARATOR).concat(l)}),H=q[0],V=function(){for(var e,n,i=0,t=q;i<t.length;i++){var o=t[i],r=(null===(e=yi.current[o])||void 0===e?void 0:e.current)||null,l=(null===(n=bi.current[o])||void 0===n?void 0:n.current)||null;if(r||l)return{refId:o,left:r,right:l}}return{refId:H,left:null,right:null}},G=function(e){return"".concat(e).concat(u.DEVIATION_BADGE_SEPARATOR).concat(M).concat(u.DEVIATION_BADGE_SEPARATOR).concat(L)};if(!v){tt(G(H)),v=!0,c=0;var z=function(){var e=V(),n=e.left,i=e.right;return N||!n&&!!i?i:n};return null==f||f(),void(d=setTimeout(function(){var e,n,i,t,o,r,l,u;a||(e=z,n=function(){a||(f=null,p())},t=0,o=null,r=null,l=performance.now(),u=function(){if(!a)if(performance.now()-l>3e3)n();else{var s=e();if(s&&0!==s.getBoundingClientRect().height){var c=s.getBoundingClientRect(),d=c.top,f=c.height,v=null!==o&&Math.abs(d-o)<.5,g=null!==r&&Math.abs(f-r)<.5;if(v&&g){if(++t>=5)return void n()}else t=0;o=d,r=f,i=requestAnimationFrame(u)}else i=requestAnimationFrame(u)}},i=requestAnimationFrame(u),f=function(){return cancelAnimationFrame(i)})},300))}var W=V(),K=W.refId,Y=W.left,U=W.right,J=G(K);if(Y||U){var X=N||!Y&&!!U,$=X?U:Y,Q=Pe?X?yn.current:Bn.current:xn.current;if($&&Q){var Z=$.getBoundingClientRect();if(0!==Z.height){var ee=Q.getBoundingClientRect(),ne=Z.top-ee.top+Q.scrollTop-ee.height/2+Z.height/2,ie=(null==C?void 0:C.includes("-"))||(null==E?void 0:E.includes("-")),te=function(){return e.__awaiter(void 0,void 0,void 0,function(){var n,i,t,o,r,c,d,f,v,g;return e.__generator(this,function(p){switch(p.label){case 0:return a?[2]:(s(),n=$ instanceof Element?window.getComputedStyle($).color:"",[Y,U].forEach(function(e){e&&(e.style.transition="box-shadow 300ms ease-in-out",e.style.boxShadow="0 0 10px ".concat(n))}),setTimeout(function(){[Y,U].forEach(function(e){e&&(e.style.boxShadow="")})},2e3),i=(null===(d=null===(c=m.evaluationResult)||void 0===c?void 0:c.deviations)||void 0===d?void 0:d[l])||m,t=(null===(f=m.evaluationResult)||void 0===f?void 0:f.evaluation_outputs)||m.evaluation_outputs,!!Y&&!!U?(r=function(e,n){return Promise.race([e,new Promise(function(e){return setTimeout(e,n)})])},Pe?[4,Promise.all([Bn.current?r(u.waitForScrollIdle(Bn.current),600):Promise.resolve(),yn.current?r(u.waitForScrollIdle(yn.current),600):Promise.resolve()])]:[3,2]):(o=X?(null===(v=bi.current[ie?K:D])||void 0===v?void 0:v.current)||U:(null===(g=yi.current[ie?K:T])||void 0===g?void 0:g.current)||Y,uo(o,function(){Ln({open:!0,anchorEl:o,displayImpact:Be.displayImpact,summary:e.__assign(e.__assign({},i),{evaluation_outputs:t})})},{skipScroll:!0}),null==Ie||Ie(),[2]));case 1:p.sent(),p.label=2;case 2:return Ji.current(J,!1,{toggleIfSame:!1,sourceSide:b?"right":"left",onReady:function(){var n,t,o,r;s();var l=X?(null===(n=bi.current[K])||void 0===n?void 0:n.current)||U:(null===(t=yi.current[K])||void 0===t?void 0:t.current)||Y,u=(null===(o=yi.current[K])||void 0===o?void 0:o.current)||Y,a=(null===(r=bi.current[K])||void 0===r?void 0:r.current)||U;u&&(u.style.scrollMarginTop="150px",u.scrollIntoView({behavior:"smooth",block:"start"})),a&&(a.style.scrollMarginTop="150px",a.scrollIntoView({behavior:"smooth",block:"start"})),Ln({open:!0,anchorEl:l,displayImpact:Be.displayImpact,summary:e.__assign({},i)}),null==Ie||Ie()}}),[2]}})})};Math.abs(Q.scrollTop-ne)<=2?te():u.scrollAndWait(Q,ne,te)}else++c<30&&(d=setTimeout(p,100))}else++c<30&&(d=setTimeout(p,100))}else++c<30&&(d=setTimeout(p,100))}else++c<30&&(d=setTimeout(p,100))}else++c<30&&(d=setTimeout(p,100))}};return d=setTimeout(p,100),function(){a=!0,d&&clearTimeout(d),null==f||f()}}}},[null==Be?void 0:Be.id,null==Be?void 0:Be.trigger,null==Be?void 0:Be.displayImpact,di,si,ai,Pe,Ln,Ft]),i.useEffect(function(){var n,i,t;if(Mn.open){var o=Mn.anchorEl;if(o&&!o.isConnected){var r=function(e){for(var n,i=0,t=Object.entries(e);i<t.length;i++){var r=t[i],l=r[0];if((null===(n=r[1].current)||void 0===n?void 0:n.textContent)===o.textContent)return l}return null},l=(null===(n=o.dataset)||void 0===n?void 0:n.deviationRefId)||r(yi.current)||r(bi.current);if(l){var u=(null===(i=bi.current[l])||void 0===i?void 0:i.current)||(null===(t=yi.current[l])||void 0===t?void 0:t.current);u&&u.isConnected&&Ln(function(n){return e.__assign(e.__assign({},n),{anchorEl:u})})}}}},[Mn.open,Mn.anchorEl,nn,Je,$i]);var vo=Dn.open,go=Dn.sectionIdx,po=Dn.isOrphan,ho=Dn.badgeStyle,mo=Dn.anchorEl,So=Dn.sectionAnchorEl;i.useEffect(function(){var n;if(ye.isStreamingEnabled&&vo&&null!=go&&go!==ct){var i="string"==typeof go?go.split(u.DEVIATION_BADGE_SEPARATOR)[0]:null,t=function(e,n){var i;if(!e||!Array.isArray(e))return null;for(var o=0,r=e;o<r.length;o++){var l=r[o];if(l.id===n)return l;if(null===(i=l.subsections)||void 0===i?void 0:i.length){var u=t(l.subsections,n);if(u)return u}}return null},o=i&&"string"==typeof i?t(si,i):null,r=i&&"string"==typeof i?t(ai,i):null,l="number"==typeof go?si[go]||null:o||i&&((null===(n=null==pe?void 0:pe.nodes)||void 0===n?void 0:n[i])||(null==pe?void 0:pe[i]))||null,s="number"==typeof go?ai[go]||null:r,a=wt(mo,l,s,go,po,ho);On(function(n){return n.open?u.safeStringify(n.cognitiveData)===u.safeStringify(a.cognitiveData)&&u.safeStringify(n.deviationData)===u.safeStringify(a.deviationData)&&n.sectionTitle===a.sectionTitle&&n.refSectionTitle===a.refSectionTitle?n:e.__assign(e.__assign(e.__assign({},n),a),{open:!0,anchorEl:n.anchorEl,sectionAnchorEl:n.sectionAnchorEl}):n})}},[vo,go,po,ho,mo,So,si,ai,wt]);var Ro=i.useCallback(function(e){var i=e.section,t=e.keyPath,o=e.depth,r=void 0===o?0:o,l=e.columnKey,u=void 0===l?"left":l,s=e.parentNodeId,a=void 0===s?"":s,c=e.sectionOffset,d=e.rhsOrphanVisualIndexes;return n.jsx(x.default,{section:i,keyPath:t,depth:r,columnKey:u,parentNodeId:a,sectionOffset:c,rhsOrphanVisualIndexes:d})},[]),xo=i.useMemo(function(){return si.map(function(e,i){var t,o=!(null==e?void 0:e.title)&&!(null==e?void 0:e.content),r=!(null==e?void 0:e.refIndexes)||0===e.refIndexes.length;return o&&r&&Pe?null:n.jsx(_.default,{section:e,idx:i},null!==(t=null==e?void 0:e.id)&&void 0!==t?t:"left-row-".concat(i))})},[si]),_o=i.useMemo(function(){return ai.map(function(e,i){var t,o=!(null==e?void 0:e.title)&&!(null==e?void 0:e.content),r=!(null==e?void 0:e.refIndexes)||0===e.refIndexes.length;return o&&r&&Pe?null:n.jsx(y.default,{section:e,idx:i},null!==(t=null==e?void 0:e.id)&&void 0!==t?t:"right-row-".concat(i))})},[ai]),yo=i.useRef(Tt);i.useEffect(function(){yo.current=Tt},[Tt]);var bo=i.useRef($i);i.useEffect(function(){bo.current=$i},[$i]);var Co=i.useRef(so);i.useEffect(function(){Co.current=so},[so]);var Eo=i.useRef(io);i.useEffect(function(){Eo.current=io},[io]);var Ao=i.useRef(it);i.useEffect(function(){Ao.current=it},[it]);var Bo=i.useRef(nt);i.useEffect(function(){Bo.current=nt},[nt]);var Io=i.useRef(Ro);i.useEffect(function(){Io.current=Ro},[Ro]);var wo=i.useRef(Yi);i.useEffect(function(){wo.current=Yi},[Yi]);var To=i.useMemo(function(){return{isGuidelineMode:ri,maintainRelativeOrder:!!Pe,showDeviationBadges:qe,isProposingFix:Te,proposingFixNodeId:De,isRedlineFlow:Oe,isSideBySide:Oi,activeSideBySideSection:Mi,scrollSyncLocked:nn,toggleScrollSyncLocked:rt,summaryPopupAnchorEl:Mn.anchorEl,connectedSections:Je,proposedSections:si,existingSections:ai,deviationNumberRegistry:fi,deviationParentRegistry:vi,treeData:pe,displayConfig:ye,resolvedMarkdownStyles:Rn,unifiedNumbering:lt,expandedSections:$i,expandedSubSections:Zi,setExpandedSubSections:et,getSectionCompareStyle:Mt,getSubSectionCompareStyle:Lt,getBadgeRef:Ti,getSectionRowRef:Ii,getSubSectionRef:wi,sectionLeftRefs:xi,sectionRightRefs:_i,sectionRowRefs:Bi,sectionRightRowRefs:Ci,subSectionLeftRefs:Ei,subSectionRightRefs:Ai,lhsBadgeRefs:yi,rhsBadgeRefs:bi,openMoreFunctionsPopup:mt,handleOpenSummaryPopup:St,openSummaryPopup:St,handleCloseSummaryPopup:Rt,toggleSection:xt,handleSubSectionToggle:_t,renderSubSectionAccordion:yt,resetSideBySide:bt,setConnectedSections:Xe,setConnectedLines:Ze,cachedConnectedPositions:fn,showDeviationNavigation:ro,showOpenNodeRef:lo,deviationNodeIdToView:null==Be?void 0:Be.id,deviationTargetParentId:ao,guidelinesData:je}},[ri,Pe,qe,Te,De,Oe,Oi,Mi,nn,rt,Mn.anchorEl,Je,si,ai,fi,ye,Rn,lt,$i,Zi,et,Mt,Lt,Ti,Ii,wi,ro,lo,Be,ao,je]);return n.jsx(C.CompareContextProvider,e.__assign({value:To},{children:n.jsxs(t.Box,e.__assign({ref:_n,sx:{display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif',overflow:"visible",position:"relative"}},{children:[Ve&&n.jsx(t.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(f.default,{})})),Mn.open&&n.jsx(b.default,{open:Mn.open,anchorEl:Mn.anchorEl,containerEl:kt.current,clipTopEl:ln.current,scrollContainerEl:xn.current,onClose:io,summary:Mn.summary,displayImpact:Mn.displayImpact,isScrollLocked:nn}),n.jsx(d.default,{open:Fn.open,anchorEl:Fn.anchorEl,maintainRelativeOrder:!!Pe,sectionTitle:Fn.sectionTitle,referenceSectionTitle:Fn.refSectionTitle,onClose:Kn,onOpenCognitiveCompare:Gn,onOpenSideBySide:no,onConnect:Dt,isConnected:to,isOrphan:!ri&&!!Fn.isOrphan,isGuidelineMode:ri,hasGuidelineMatches:Fn.hasGuidelineMatches}),Dn.open&&n.jsx(c.default,{open:Dn.open,popupRef:Vn,position:kn,popupConfig:Ce,onClose:function(){Pn(null),On(function(n){return e.__assign(e.__assign({},n),{open:!1})}),Hn(null)},markdownStyles:Re,sectionTitle:ei,referenceSectionTitle:ii,cognitiveData:Dn.cognitiveData,anchorEl:Dn.anchorEl,sectionAnchorEl:Dn.sectionAnchorEl,scrollContainerEl:xn.current,badgeStyle:Dn.badgeStyle,docData:Dn.docData,deviationData:Dn.deviationData,isLoading:Dn.isLoading}),n.jsx(t.Snackbar,e.__assign({open:!!We,autoHideDuration:8e3,onClose:function(){return Ke(null)},anchorOrigin:{vertical:"top",horizontal:"center"}},{children:n.jsx(t.Alert,e.__assign({onClose:function(){return Ke(null)},severity:"error",sx:{width:"100%",whiteSpace:"pre-line"}},{children:We}))})),n.jsx(R.default,{componentHeaderText:ge,displayConfig:ye,maintainRelativeOrder:Pe,onCollapseAll:Ut,showCollapseAll:Jt,onToggleView:function(e){Ge(!0),setTimeout(function(){Ne(!e),null==be||be(!e),tn(!1),Yi(),qn(),Xe(new Set),Ze([]),fn.current=[],requestAnimationFrame(function(){requestAnimationFrame(function(){setTimeout(function(){Ge(!1)},600)})})},50)}}),n.jsx(t.Box,e.__assign({ref:xn,onScroll:Yt,sx:{flex:1,minHeight:0,pt:1.5,pb:1,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",overflowY:Pe?"visible":"auto",borderTop:st&&at?"none":"1.5px solid #EEF0F4"}},{children:n.jsx(t.Box,e.__assign({sx:e.__assign({display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"},Pe?{flex:1}:{})},{children:n.jsxs(t.Box,e.__assign({ref:rn,sx:e.__assign({display:"grid",gridTemplateColumns:"minmax(0, 1fr) 180px minmax(0, 1fr)",gap:"100px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0},Pe?{flex:1,overflow:"visible"}:{})},{children:[n.jsx(w.default,{svgContainerRef:on,svgDimensions:Kt,isResizing:ki,overallConnector:zt,rootDeviationStyle:vt,lines:Vt,isSideBySide:Oi,activeSideBySideSection:Mi,isArrowVisible:Fi,maintainRelativeOrder:Pe,proposedSections:si,existingSections:ai,cognitivePopup:Dn,activeBadgeId:Nn,closeCognitivePopup:Wn,setActiveBadgeId:Hn,openCognitivePopupFromState:zn,buildSectionPopupState:wt,connectedLines:Qe,isGuidelineMode:ri,pathRefs:dn}),n.jsxs(t.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)"},Pe?{flex:1,overflow:"visible"}:{})},{children:[n.jsx(t.Box,e.__assign({ref:ln,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(t.Tooltip,e.__assign({title:Qn,placement:"top"},{children:n.jsx(t.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:Qn}))}))})),n.jsxs(t.Box,e.__assign({ref:Bn,onScroll:Yt,sx:e.__assign({p:"12px",display:"flex",flexDirection:"column"},Pe?{maxHeight:"calc(100vh - 250px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,mr:"-180px",pr:"192px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[n.jsx("div",{ref:En,style:{width:"100%",height:"0px",flexShrink:0}}),pi&&xo,n.jsx("div",{ref:An,style:{width:"100%",height:"0px",flexShrink:0}})]}))]})),n.jsx(t.Box,e.__assign({ref:kt,sx:{width:"180px",display:"flex",flexDirection:"column",alignItems:"center",pt:"15px",gap:0,zIndex:20,pointerEvents:"none"}},{children:n.jsx(t.Box,e.__assign({sx:{display:"flex",justifyContent:"center",alignItems:"center",mt:0}},{children:n.jsxs(t.Box,e.__assign({onClick:function(n){n.stopPropagation(),Dn.open&&Nn===ct?Wn():(Hn(ct),zn(wt(n.currentTarget,{title:"",content:"",evaluationResult:dt,cognitiveData:{section_id:"",decisioning:[],gap:[],relevance_score:0,isMissingRationale:!0}},null,ct,!0,e.__assign(e.__assign({},vt),{label:""}))))},sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:"5px",top:"-8px",borderRadius:"20px",bgcolor:vt.badgeBg,color:vt.badgeText,border:"1px solid ".concat(vt.badgeBorder),fontSize:"12px",fontWeight:600,whiteSpace:"nowrap",position:"relative",zIndex:1,pointerEvents:"auto",cursor:"pointer"}},{children:[null!=ft?ft:n.jsx(v.default,{}),n.jsx(t.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:Dn.open&&Nn===ct?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))})),n.jsxs(t.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},Pe?{flex:1,overflow:"visible",minHeight:0}:{})},{children:[Ni&&n.jsx(l.default,{sections:11}),n.jsx(t.Box,e.__assign({ref:un,sx:e.__assign({p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E3E6EA",borderRadius:"8px 8px 0 0",display:"flex",alignItems:"center"},Pe?e.__assign({maxHeight:"calc(100vh - 250px)",overflowY:"auto",overflowX:"hidden",minHeight:0},ri?{"&::-webkit-scrollbar":{width:"6px",display:"block"},"&::-webkit-scrollbar-track":{background:"transparent"},"&::-webkit-scrollbar-thumb":{background:"#CBD5E1",borderRadius:"10px"},"&::-webkit-scrollbar-thumb:hover":{background:"#94A3B8"},scrollbarWidth:"thin",scrollbarColor:"#CBD5E1 transparent"}:{"&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}):{})},{children:n.jsx(t.Tooltip,e.__assign({title:ti,placement:"top"},{children:n.jsx(t.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:ti}))}))})),n.jsxs(t.Box,e.__assign({ref:yn,onScroll:Yt,sx:e.__assign({p:ri?"0px":"12px",display:"flex",flexDirection:"column"},Pe?e.__assign(e.__assign({maxHeight:"calc(100vh - 250px)"},!ri&&{flex:1}),{overflowY:"auto",overflowX:"hidden",minHeight:0,ml:"-150px",pl:"165px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}):{})},{children:[n.jsx("div",{ref:bn,style:{width:"100%",height:"0px",flexShrink:0}}),ri?n.jsx(T.default,{guidelinesData:je,deviationData:Ae,connectedSections:Je,proposedSections:si}):pi&&_o,n.jsx("div",{ref:Cn,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 n=require("tslib"),e=require("react/jsx-runtime"),i=require("react"),t=require("@mui/material"),o=require("lucide-react"),l=require("../hooks/memoizedMarkdown.js"),r=require("../CompareContext.js"),d=require("../CognitiveComparehelpers.js"),a=require("../CognitiveCompareConstants.js");function s(n){return n&&"object"==typeof n&&"default"in n?n:{default:n}}var u=s(i);exports.default=function(s){var c,v,f,g,p,h,x,I,m,_,y,b,S,A,R,E=s.section,w=s.idx,O=s.columnKey,M=s.colRef,N=s.mb,T=void 0===N?1:N,j=s.isExpanded,B=s.onToggle,D=s.navigation,C=s.parentNodeId,F=void 0===C?"":C,k=r.useCompareContext(),P=k.showOpenNodeRef,V=k.resolvedMarkdownStyles,G=k.maintainRelativeOrder,W=k.showDeviationBadges,q=void 0!==W&&W,L=k.renderSubSectionAccordion,z=k.treeData,K=k.proposedSections,X=k.existingSections,H=k.deviationNumberRegistry,U=k.deviationParentRegistry,Y=k.getBadgeRef,J=k.openSummaryPopup,Q=k.getSectionCompareStyle,Z=k.connectedSections,$=k.openMoreFunctionsPopup,nn=k.isProposingFix,en=k.proposingFixNodeId,tn=k.isRedlineFlow,on=k.isSideBySide,ln=k.activeSideBySideSection,rn=k.scrollSyncLocked,dn=k.unifiedNumbering,an=k.toggleScrollSyncLocked,sn=k.summaryPopupAnchorEl,un="".concat(on?"1":"0","-").concat(String(null!=ln?ln:"")),cn=(null===(c=E.displayTitle)||void 0===c||c)&&d.hasValue(E.title),vn=!(!nn||!en||"left"!==O||E.id!==en&&E.nodeId!==en),fn=d.hasMeaningfulRedlineTags(E.content),gn="boolean"==typeof tn?tn:fn,pn=fn,hn=gn&&fn,xn=hn?d.stripRedlineTags(E.content):E.content,In=hn?E.content:void 0,mn=(null===(v=E.displayContent)||void 0===v||v||fn)&&d.hasValue(E.content),_n=!cn&&!mn,yn=E.title;cn||(yn=mn?"No Title Found":"No Matching Section Found");var bn=E.evaluationResult;if(!bn&&"right"===O)if(G){var Sn=null===(f=E.refIndexes)||void 0===f?void 0:f[0],An=K.find(function(n){return n.selfIndex===Sn});bn=null==An?void 0:An.evaluationResult}else bn=null===(g=K[w])||void 0===g?void 0:g.evaluationResult;var Rn=null===(p=null==z?void 0:z.input_index_map)||void 0===p?void 0:p[0],En=null===(h=null==z?void 0:z.input_index_map)||void 0===h?void 0:h[1],wn="left"===O?En:Rn,On=function(n,e){var i;if(!e||!n)return null;for(var t=0,o=n;t<o.length;t++){var l=o[t];if(l.id===e||l.nodeId===e||l.contentId===e)return l;if(null===(i=l.subsections)||void 0===i?void 0:i.length){var r=On(l.subsections,e);if(r)return r}}return null},Mn="left"===O?E:On(K,E.id),Nn="right"===O?E:On(X,E.id),Tn=u.default.useMemo(function(){if(!G)return 0;var n=1/0,e=function(n){var e=d.hasMeaningfulRedlineTags(n)?d.stripRedlineTags(n):n;return d.safeStringify(e||"").replace(/\\n/g,"\n")},i=function(t,o,l,r){if(t){var a=t.nodeId||t.id;if(r&&"right"===O){var s=K.filter(function(n){var e;return null===(e=n.refIndexes)||void 0===e?void 0:e.includes(t.selfIndex)});s.length>0&&(a=s[0].nodeId||s[0].id)}var u=t.nodeId||t.id||(null==o?void 0:o.nodeId)||(null==o?void 0:o.id)||(null==l?void 0:l.nodeId)||(null==l?void 0:l.id),c=t.evaluationResult||(null==o?void 0:o.evaluationResult)||(null==l?void 0:l.evaluationResult),v=(null==c?void 0:c.deviations)||{};Object.keys(v).forEach(function(i){var r,s=null===(r=v[i])||void 0===r?void 0:r[F];if(function(n,i){if("string"!=typeof i||d.isMissingStr(i))return!1;var t=e(null==n?void 0:n.content),o=e(i);return!!o&&t.includes(o)}("left"===O?o||t:l||t,s)){var c="".concat(a).concat(d.DEVIATION_BADGE_SEPARATOR).concat(i),f=null==H?void 0:H[c];null!=f&&f<n&&(n=f);var g="".concat(u).concat(d.DEVIATION_BADGE_SEPARATOR).concat(i),p=null==H?void 0:H[g];null!=p&&p<n&&(n=p)}});for(var f=t.subsections||[],g=(null==o?void 0:o.subsections)||[],p=(null==l?void 0:l.subsections)||[],h=Math.max(f.length,g.length,p.length),x=0;x<h;x++)i(f[x],g[x],p[x],!1)}},t="right"===O?K.filter(function(n){var e;return null===(e=n.refIndexes)||void 0===e?void 0:e.includes(E.selfIndex)}):[];if(1===t.length){var o=t[0];(o.refIndexes||[]).map(function(n){return X.find(function(e){return e.selfIndex===n})}).filter(Boolean).forEach(function(n){i(n,o,n,!0)})}else i(E,Mn,Nn,!0);return n!==1/0?n-1:0},[E,Mn,Nn,O,F,H,G,K,X]);if(G)if("left"===O){var jn=null===(x=E.refIndexes)||void 0===x?void 0:x[0],Bn=X.findIndex(function(n){return n.selfIndex===jn});Nn=-1!==Bn?X[Bn]:On(X,E.id)}else{var Dn=null===(I=E.refIndexes)||void 0===I?void 0:I[0],Cn=K.findIndex(function(n){return n.selfIndex===Dn});Mn=-1!==Cn?K[Cn]:On(K,E.id)}var Fn="left"===O?!Nn:!Mn,kn=G&&"right"===O&&d.hasSingleMappedLhsSection(E,K),Pn=bn||(null==Mn?void 0:Mn.evaluationResult)||(null==Nn?void 0:Nn.evaluationResult),Vn=null!==(y=null===(_=null===(m=null==Pn?void 0:Pn.evaluation_outputs)||void 0===m?void 0:m.metadata)||void 0===_?void 0:_.label_color)&&void 0!==y?y:a.DEFAULT_DEVIAION_COLOR,Gn=d.generateColorPalette(Vn).highlightBg,Wn=(null==Pn?void 0:Pn.deviations)||{},qn=E.nodeId||E.id;if(G&&"left"!==O){var Ln=K.filter(function(n){var e;return null===(e=n.refIndexes)||void 0===e?void 0:e.includes(E.selfIndex)});Ln.length>0?qn=Ln[0].nodeId||Ln[0].id:(null==Mn?void 0:Mn.id)&&(qn=Mn.nodeId||Mn.id)}var zn=u.default.useMemo(function(){var n,e=new Map;if(!G||"right"!==O)return e;var i=1,t=K.filter(function(n){var e;return null===(e=n.refIndexes)||void 0===e?void 0:e.includes(E.selfIndex)}),o=1===t.length&&1===(null===(n=t[0].refIndexes)||void 0===n?void 0:n.length),l=function(n){return d.safeStringify(n||"").replace(/\\n/g,"\n")},r=function(n,e){var i=e?t[0]:On(K,n.nodeId||n.id||n.contentId);return{lhsNode:i,evalResult:n.evaluationResult||(null==i?void 0:i.evaluationResult),registryNodeId:i?i.nodeId||i.id:n.nodeId||n.id}};if(o){var a=function(n,e){if(void 0===e&&(e=!1),n){var t=r(n,e),o=t.lhsNode,s=t.evalResult,u=t.registryNodeId,c=l(n.content);Object.entries((null==s?void 0:s.deviations)||{}).forEach(function(n){var e=n[0],t=n[1],r=t[F],a=l(r);if(!!o&&!d.isMissingStr(t[wn])&&a&&c.includes(a)){var s="".concat(u).concat(d.DEVIATION_BADGE_SEPARATOR).concat(e),v=H[s];null!=v&&(i=Math.max(i,Math.max(1,v-(Tn||0))+1))}}),(n.subsections||[]).forEach(function(n){return a(n)})}};a(E,!0)}var s=function(n,t){if(void 0===t&&(t=!1),n){var o=r(n,t),a=o.lhsNode,u=o.evalResult,c=o.registryNodeId,v=(null==u?void 0:u.deviations)||{},f=l(n.content);Object.entries(v).map(function(n){var e,i=n[0],t=n[1],o=t[F],r=!a||d.isMissingStr(t[wn]),s=l(o),u=s?f.indexOf(s):-1,v="".concat(c).concat(d.DEVIATION_BADGE_SEPARATOR).concat(i);return{refId:v,isRenderable:r&&!!s&&!d.isMissingStr(o),position:u,registryIndex:null!==(e=H[v])&&void 0!==e?e:Number.MAX_SAFE_INTEGER}}).filter(function(n){return n.isRenderable}).sort(function(n,e){return(-1===n.position?Number.MAX_SAFE_INTEGER:n.position)-(-1===e.position?Number.MAX_SAFE_INTEGER:e.position)||n.registryIndex-e.registryIndex}).forEach(function(n){e.set(n.refId,i++)}),(n.subsections||[]).forEach(function(n){return s(n)})}};return s(E,!0),e},[G,O,E,K,F,wn,H,Tn]),Kn=Object.keys(Wn)[0],Xn=Kn?"".concat(qn).concat(d.DEVIATION_BADGE_SEPARATOR).concat(Kn):null,Hn=Xn?null==U?void 0:U[Xn]:null,Un=w+1;if(G&&dn){var Yn="left"===O?dn.leftNums.get(null==E?void 0:E.id):dn.rightNums.get(null==E?void 0:E.id);Fn&&void 0!==Yn?Un=Yn:null!=Hn&&Hn>=0?Un=Hn:void 0!==Yn&&(Un=Yn)}else null!=Hn&&Hn>=0&&(Un=Hn);var Jn=Object.entries(Wn).map(function(n){var e=n[0],i=n[1],t="".concat(qn).concat(d.DEVIATION_BADGE_SEPARATOR).concat(e);return{deviationKey:e,deviationMap:i,refId:t,currentIndex:H[t]}}).filter(function(n){return void 0!==n.currentIndex&&null!==n.currentIndex});Jn.sort(function(n,e){return n.currentIndex-e.currentIndex});var Qn,Zn,$n=Jn.map(function(e){var i,t,o,l,r,a,s=e.deviationKey,u=e.deviationMap,c=e.refId,v=e.currentIndex,f=u[F],g=d.isMissingStr(f);if(g)f="";else if(!f)return null;var p=w,h=w;if(G)if("left"===O){var x=null===(i=E.refIndexes)||void 0===i?void 0:i[0],I=X.findIndex(function(n){return n.selfIndex===x});if(-1!==I)h=I;else{var m=X.findIndex(function(n){return n.id===E.id||n.nodeId===E.nodeId||n.contentId===E.contentId});h=-1!==m?m:w}}else{var _=null===(t=E.refIndexes)||void 0===t?void 0:t[0],y=K.findIndex(function(n){return n.selfIndex===_});if(-1!==y)p=y;else p=-1!==(j=K.findIndex(function(n){return n.id===E.id||n.nodeId===E.nodeId||n.contentId===E.contentId}))?j:w}var b="".concat(qn).concat(d.DEVIATION_BADGE_SEPARATOR).concat(s).concat(d.DEVIATION_BADGE_SEPARATOR).concat(p).concat(d.DEVIATION_BADGE_SEPARATOR).concat(h),S=u[wn],A=Fn||d.isMissingStr(S),R=zn.get(c);G&&"right"===O&&A&&void 0!==R?v=R:G&&void 0!==Tn&&("right"!==O||A||kn)&&(v-=Tn),v=Math.max(1,v);var M=G&&"right"===O&&A&&dn?d.getRhsMappedSectionNumber({section:E,proposedSections:K,leftNums:dn.leftNums,fallbackNumber:String(Un),firstOnly:!0}):Un,N="".concat(M,".").concat(v),T=w;if("right"===O&&G){var j,B=null===(o=E.refIndexes)||void 0===o?void 0:o[0],D=K.findIndex(function(n){return n.selfIndex===B});if(-1!==D)T=D;else-1!==(j=K.findIndex(function(n){return n.id===E.id||n.nodeId===E.nodeId||n.contentId===E.contentId}))&&(T=j)}var C=Q?Q(T):null,k=(null==u?void 0:u.evaluation_outputs)||(null==Pn?void 0:Pn.evaluation_outputs),P=null!==(l=null==k?void 0:k.output_value)&&void 0!==l?l:null,V=null!==(a=null===(r=null==k?void 0:k.metadata)||void 0===r?void 0:r.label_color)&&void 0!==a?a:Vn,W=d.generateColorPalette(V),q=C?n.__assign(n.__assign({},C),{badgeBg:W.badgeBg,badgeBorder:W.badgeBorder,badgeText:W.badgeText}):n.__assign({},W),L=(null==u?void 0:u.deviation_summary)?{deviation_summary:u.deviation_summary,deviation_title:(null==u?void 0:u.deviation_title)||(null==Pn?void 0:Pn.deviation_title),deviation_impact:(null==u?void 0:u.deviation_impact)||(null==Pn?void 0:Pn.deviation_impact),deviation_explanation:(null==u?void 0:u.deviation_explanation)||(null==Pn?void 0:Pn.deviation_explanation),evaluation_outputs:k,cognitive_decisioning:(null==u?void 0:u.cognitive_decisioning)||(null==Pn?void 0:Pn.cognitive_decisioning)}:null,z=0,H=xn||"";if(f&&H){var U=H.split(/\n{2,}/),nn=U.findIndex(function(n){return n.includes(f)});if(-1!==nn){var en=Object.entries(Wn).filter(function(n){n[0];var e=n[1][F];return e&&U[nn].includes(e)}).sort(function(n,e){return U[nn].indexOf(n[1][F])-U[nn].indexOf(e[1][F])}),tn=en.filter(function(n){n[0];var e=n[1][F];return e&&(e.includes(f)||f.includes(e))});tn.length>1&&(z=Math.max(0,tn.findIndex(function(n){return n[0]===s})))}}var un=Y(O,c);return{id:c,actionId:b,label:N,highlight:f,side:O,style:q,stackIndex:z,score:P,isConnected:null==Z?void 0:Z.has(b),showScrollLockToggle:(null==Z?void 0:Z.has(b))||on&&ln===b||!!sn&&sn===un.current,scrollSyncLocked:rn,toggleScrollSyncLocked:an,isOrphan:A,isMissingClause:g,badgeRef:un,onClick:function(n){n.stopPropagation(),$&&$(n,Mn||{id:"orphan-left",title:"",content:""},A,Nn||{id:"orphan-right",title:"",content:""},b,q)},onSummaryClick:function(n){n.stopPropagation(),J(n,b,A,L)}}}).filter(Boolean),ne=q||!gn&&vn?$n:[],ee=$n.map(function(n){return n.highlight}).filter(Boolean),ie=E.id&&O===(null==D?void 0:D.columnKey)?D:null,te=u.default.useRef(!1);return i.useEffect(function(){j||(te.current=!1)},[j]),e.jsxs(t.Box,n.__assign({ref:M,sx:{mb:T,width:"100%",display:"flex",flexDirection:"column",position:"relative",minWidth:0}},{children:[j&&(null==ie?void 0:ie.showAbove)&&e.jsx("div",n.__assign({style:{position:"sticky",top:0,height:"0px",cursor:"pointer"},onClick:function(){var n,e;return null===(e=null===(n=null==ie?void 0:ie.showAboveRef)||void 0===n?void 0:n.current)||void 0===e?void 0:e.scrollIntoView({behavior:"smooth",block:"center"})}},{children:e.jsx("div",n.__assign({style:n.__assign({transform:"translateY(-50%) translateX(calc(100% ".concat("left"===O?"+":"-"," 130px))"),position:"absolute",paddingTop:"20px"},"left"===O?{right:"-20px"}:{left:"-20px"})},{children:e.jsx(o.ChevronUp,{color:(null===(b=null==ie?void 0:ie.showAboveRef)||void 0===b?void 0:b.current)?window.getComputedStyle(ie.showAboveRef.current).color:void 0})}))})),e.jsxs(t.Accordion,n.__assign({disableGutters:!0,expanded:!_n&&j,onChange:function(){_n||(B(),P.current=E.id)},sx:{boxShadow:"none",border:_n?"1px dashed #E2E8F0":"1px solid #E2E8F0",bgcolor:_n?"#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.jsx(t.AccordionSummary,n.__assign({expandIcon:_n?null:e.jsx(o.ChevronDown,{size:16}),sx:{minHeight:"36px",flexShrink:0,cursor:_n?"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:cn&&e.jsx(t.Tooltip,n.__assign({title:yn,placement:"top"},{children:e.jsx(t.Typography,n.__assign({component:"div",sx:{fontSize:"12px",color:_n?"#94A3B8":"#19213D",fontWeight:_n?400:700,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0}},{children:(Qn=yn,Zn="left"===O&&(null!==(A=null===(S=null==E?void 0:E.refContentIds)||void 0===S?void 0:S.length)&&void 0!==A?A:1)>1,void 0===Zn&&(Zn=!1),Qn?d.safeStringify(Qn).replace(/\\n/g,"\n").split(/(\*\*.*?\*\*)/g).map(function(i,t){return i.startsWith("**")&&i.endsWith("**")?e.jsx("strong",{children:i.slice(2,-2)},t):e.jsxs("div",n.__assign({style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"8px",width:"100%"}},{children:[e.jsx("span",{children:i}),Zn&&e.jsx("span",n.__assign({style:{display:"inline-flex",alignItems:"center",justifyContent:"center",padding:"0px 6px",borderRadius:"9999px",background:"#F3F4F6",border:"1px solid #D1D5DB",color:"#6B7280",fontSize:"9px",fontWeight:500,whiteSpace:"nowrap",lineHeight:1.4,marginRight:"4px"}},{children:"Multiple"}))]}),t)}):null)}))}))})),!_n&&e.jsxs(t.AccordionDetails,n.__assign({sx:{pt:0,pb:1.25,bgcolor:"#FFFFFF",flex:1,display:"flex",flexDirection:"column",minWidth:0}},{children:[mn&&e.jsx(l.MemoizedMarkdown,{content:xn,overlayContent:In,sxStyles:V,highlights:ee,maintainRelativeOrder:G,highlightBg:Gn,suppressHighlightBg:pn,deviationBadges:ne,collisionKey:un}),(E.subsections||[]).map(function(n,e){return L({section:n,keyPath:"".concat(w,"-").concat(e),depth:0,columnKey:O,parentNodeId:F,sectionOffset:Tn,rhsOrphanVisualIndexes:zn})})]}))]})),j&&(null==ie?void 0:ie.showBelow)&&e.jsx("div",n.__assign({style:{position:"sticky",bottom:0,height:"0px",cursor:"pointer"},onClick:function(){var n,e;return null===(e=null===(n=null==ie?void 0:ie.showBelowRef)||void 0===n?void 0:n.current)||void 0===e?void 0:e.scrollIntoView({behavior:"smooth",block:"center"})}},{children:e.jsx("div",n.__assign({style:n.__assign({transform:"translateY(-50%) translateX(calc(100% ".concat("left"===O?"+":"-"," 130px))"),position:"absolute",paddingBottom:"20px"},"left"===O?{right:"-20px"}:{left:"-20px"})},{children:e.jsx(o.ChevronDown,{color:(null===(R=null==ie?void 0:ie.showBelowRef)||void 0===R?void 0:R.current)?window.getComputedStyle(ie.showBelowRef.current).color:void 0})}))}))]}),"".concat(O,"-sec-").concat(w))};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var n=require("tslib"),e=require("react/jsx-runtime"),i=require("react"),t=require("@mui/material"),o=require("lucide-react"),l=require("../hooks/memoizedMarkdown.js"),r=require("../CompareContext.js"),d=require("../CognitiveComparehelpers.js"),a=require("../CognitiveCompareConstants.js");function s(n){return n&&"object"==typeof n&&"default"in n?n:{default:n}}var u=s(i);exports.default=function(s){var c,v,f,g,p,h,x,I,m,_,y,b,S,A,R,E=s.section,w=s.idx,O=s.columnKey,M=s.colRef,N=s.mb,T=void 0===N?1:N,j=s.isExpanded,B=s.onToggle,D=s.navigation,C=s.parentNodeId,F=void 0===C?"":C,k=r.useCompareContext(),P=k.showOpenNodeRef,V=k.resolvedMarkdownStyles,G=k.maintainRelativeOrder,W=k.showDeviationBadges,q=void 0!==W&&W,L=k.renderSubSectionAccordion,z=k.treeData,K=k.proposedSections,X=k.existingSections,H=k.deviationNumberRegistry,U=k.deviationParentRegistry,Y=k.getBadgeRef,J=k.openSummaryPopup,Q=k.getSectionCompareStyle,Z=k.connectedSections,$=k.openMoreFunctionsPopup,nn=k.isProposingFix,en=k.proposingFixNodeId,tn=k.isRedlineFlow,on=k.isSideBySide,ln=k.activeSideBySideSection,rn=k.scrollSyncLocked,dn=k.unifiedNumbering,an=k.toggleScrollSyncLocked,sn=k.summaryPopupAnchorEl,un="".concat(on?"1":"0","-").concat(String(null!=ln?ln:"")),cn=(null===(c=E.displayTitle)||void 0===c||c)&&d.hasValue(E.title),vn=!(!nn||!en||"left"!==O||E.id!==en&&E.nodeId!==en),fn=d.hasMeaningfulRedlineTags(E.content),gn="boolean"==typeof tn?tn:fn,pn=fn,hn=gn&&fn,xn=hn?d.stripRedlineTags(E.content):E.content,In=hn?E.content:void 0,mn=(null===(v=E.displayContent)||void 0===v||v||fn)&&d.hasValue(E.content),_n=!cn&&!mn,yn=E.title;cn||(yn=mn?"No Title Found":"No Matching Section Found");var bn="left"===O&&(null!==(g=null===(f=null==E?void 0:E.refContentIds)||void 0===f?void 0:f.length)&&void 0!==g?g:1)>1,Sn="left"===O&&yn.length>29?"".concat(yn.slice(0,29).trimEnd(),"..."):yn,An=E.evaluationResult;if(!An&&"right"===O)if(G){var Rn=null===(p=E.refIndexes)||void 0===p?void 0:p[0],En=K.find(function(n){return n.selfIndex===Rn});An=null==En?void 0:En.evaluationResult}else An=null===(h=K[w])||void 0===h?void 0:h.evaluationResult;var wn=null===(x=null==z?void 0:z.input_index_map)||void 0===x?void 0:x[0],On=null===(I=null==z?void 0:z.input_index_map)||void 0===I?void 0:I[1],Mn="left"===O?On:wn,Nn=function(n,e){var i;if(!e||!n)return null;for(var t=0,o=n;t<o.length;t++){var l=o[t];if(l.id===e||l.nodeId===e||l.contentId===e)return l;if(null===(i=l.subsections)||void 0===i?void 0:i.length){var r=Nn(l.subsections,e);if(r)return r}}return null},Tn="left"===O?E:Nn(K,E.id),jn="right"===O?E:Nn(X,E.id),Bn=u.default.useMemo(function(){if(!G)return 0;var n=1/0,e=function(n){var e=d.hasMeaningfulRedlineTags(n)?d.stripRedlineTags(n):n;return d.safeStringify(e||"").replace(/\\n/g,"\n")},i=function(t,o,l,r){if(t){var a=t.nodeId||t.id;if(r&&"right"===O){var s=K.filter(function(n){var e;return null===(e=n.refIndexes)||void 0===e?void 0:e.includes(t.selfIndex)});s.length>0&&(a=s[0].nodeId||s[0].id)}var u=t.nodeId||t.id||(null==o?void 0:o.nodeId)||(null==o?void 0:o.id)||(null==l?void 0:l.nodeId)||(null==l?void 0:l.id),c=t.evaluationResult||(null==o?void 0:o.evaluationResult)||(null==l?void 0:l.evaluationResult),v=(null==c?void 0:c.deviations)||{};Object.keys(v).forEach(function(i){var r,s=null===(r=v[i])||void 0===r?void 0:r[F];if(function(n,i){if("string"!=typeof i||d.isMissingStr(i))return!1;var t=e(null==n?void 0:n.content),o=e(i);return!!o&&t.includes(o)}("left"===O?o||t:l||t,s)){var c="".concat(a).concat(d.DEVIATION_BADGE_SEPARATOR).concat(i),f=null==H?void 0:H[c];null!=f&&f<n&&(n=f);var g="".concat(u).concat(d.DEVIATION_BADGE_SEPARATOR).concat(i),p=null==H?void 0:H[g];null!=p&&p<n&&(n=p)}});for(var f=t.subsections||[],g=(null==o?void 0:o.subsections)||[],p=(null==l?void 0:l.subsections)||[],h=Math.max(f.length,g.length,p.length),x=0;x<h;x++)i(f[x],g[x],p[x],!1)}},t="right"===O?K.filter(function(n){var e;return null===(e=n.refIndexes)||void 0===e?void 0:e.includes(E.selfIndex)}):[];if(1===t.length){var o=t[0];(o.refIndexes||[]).map(function(n){return X.find(function(e){return e.selfIndex===n})}).filter(Boolean).forEach(function(n){i(n,o,n,!0)})}else i(E,Tn,jn,!0);return n!==1/0?n-1:0},[E,Tn,jn,O,F,H,G,K,X]);if(G)if("left"===O){var Dn=null===(m=E.refIndexes)||void 0===m?void 0:m[0],Cn=X.findIndex(function(n){return n.selfIndex===Dn});jn=-1!==Cn?X[Cn]:Nn(X,E.id)}else{var Fn=null===(_=E.refIndexes)||void 0===_?void 0:_[0],kn=K.findIndex(function(n){return n.selfIndex===Fn});Tn=-1!==kn?K[kn]:Nn(K,E.id)}var Pn="left"===O?!jn:!Tn,Vn=G&&"right"===O&&d.hasSingleMappedLhsSection(E,K),Gn=An||(null==Tn?void 0:Tn.evaluationResult)||(null==jn?void 0:jn.evaluationResult),Wn=null!==(S=null===(b=null===(y=null==Gn?void 0:Gn.evaluation_outputs)||void 0===y?void 0:y.metadata)||void 0===b?void 0:b.label_color)&&void 0!==S?S:a.DEFAULT_DEVIAION_COLOR,qn=d.generateColorPalette(Wn).highlightBg,Ln=(null==Gn?void 0:Gn.deviations)||{},zn=E.nodeId||E.id;if(G&&"left"!==O){var Kn=K.filter(function(n){var e;return null===(e=n.refIndexes)||void 0===e?void 0:e.includes(E.selfIndex)});Kn.length>0?zn=Kn[0].nodeId||Kn[0].id:(null==Tn?void 0:Tn.id)&&(zn=Tn.nodeId||Tn.id)}var Xn=u.default.useMemo(function(){var n,e=new Map;if(!G||"right"!==O)return e;var i=1,t=K.filter(function(n){var e;return null===(e=n.refIndexes)||void 0===e?void 0:e.includes(E.selfIndex)}),o=1===t.length&&1===(null===(n=t[0].refIndexes)||void 0===n?void 0:n.length),l=function(n){return d.safeStringify(n||"").replace(/\\n/g,"\n")},r=function(n,e){var i=e?t[0]:Nn(K,n.nodeId||n.id||n.contentId);return{lhsNode:i,evalResult:n.evaluationResult||(null==i?void 0:i.evaluationResult),registryNodeId:i?i.nodeId||i.id:n.nodeId||n.id}};if(o){var a=function(n,e){if(void 0===e&&(e=!1),n){var t=r(n,e),o=t.lhsNode,s=t.evalResult,u=t.registryNodeId,c=l(n.content);Object.entries((null==s?void 0:s.deviations)||{}).forEach(function(n){var e=n[0],t=n[1],r=t[F],a=l(r);if(!!o&&!d.isMissingStr(t[Mn])&&a&&c.includes(a)){var s="".concat(u).concat(d.DEVIATION_BADGE_SEPARATOR).concat(e),v=H[s];null!=v&&(i=Math.max(i,Math.max(1,v-(Bn||0))+1))}}),(n.subsections||[]).forEach(function(n){return a(n)})}};a(E,!0)}var s=function(n,t){if(void 0===t&&(t=!1),n){var o=r(n,t),a=o.lhsNode,u=o.evalResult,c=o.registryNodeId,v=(null==u?void 0:u.deviations)||{},f=l(n.content);Object.entries(v).map(function(n){var e,i=n[0],t=n[1],o=t[F],r=!a||d.isMissingStr(t[Mn]),s=l(o),u=s?f.indexOf(s):-1,v="".concat(c).concat(d.DEVIATION_BADGE_SEPARATOR).concat(i);return{refId:v,isRenderable:r&&!!s&&!d.isMissingStr(o),position:u,registryIndex:null!==(e=H[v])&&void 0!==e?e:Number.MAX_SAFE_INTEGER}}).filter(function(n){return n.isRenderable}).sort(function(n,e){return(-1===n.position?Number.MAX_SAFE_INTEGER:n.position)-(-1===e.position?Number.MAX_SAFE_INTEGER:e.position)||n.registryIndex-e.registryIndex}).forEach(function(n){e.set(n.refId,i++)}),(n.subsections||[]).forEach(function(n){return s(n)})}};return s(E,!0),e},[G,O,E,K,F,Mn,H,Bn]),Hn=Object.keys(Ln)[0],Un=Hn?"".concat(zn).concat(d.DEVIATION_BADGE_SEPARATOR).concat(Hn):null,Yn=Un?null==U?void 0:U[Un]:null,Jn=w+1;if(G&&dn){var Qn="left"===O?dn.leftNums.get(null==E?void 0:E.id):dn.rightNums.get(null==E?void 0:E.id);Pn&&void 0!==Qn?Jn=Qn:null!=Yn&&Yn>=0?Jn=Yn:void 0!==Qn&&(Jn=Qn)}else null!=Yn&&Yn>=0&&(Jn=Yn);var Zn=Object.entries(Ln).map(function(n){var e=n[0],i=n[1],t="".concat(zn).concat(d.DEVIATION_BADGE_SEPARATOR).concat(e);return{deviationKey:e,deviationMap:i,refId:t,currentIndex:H[t]}}).filter(function(n){return void 0!==n.currentIndex&&null!==n.currentIndex});Zn.sort(function(n,e){return n.currentIndex-e.currentIndex});var $n,ne,ee=Zn.map(function(e){var i,t,o,l,r,a,s=e.deviationKey,u=e.deviationMap,c=e.refId,v=e.currentIndex,f=u[F],g=d.isMissingStr(f);if(g)f="";else if(!f)return null;var p=w,h=w;if(G)if("left"===O){var x=null===(i=E.refIndexes)||void 0===i?void 0:i[0],I=X.findIndex(function(n){return n.selfIndex===x});if(-1!==I)h=I;else{var m=X.findIndex(function(n){return n.id===E.id||n.nodeId===E.nodeId||n.contentId===E.contentId});h=-1!==m?m:w}}else{var _=null===(t=E.refIndexes)||void 0===t?void 0:t[0],y=K.findIndex(function(n){return n.selfIndex===_});if(-1!==y)p=y;else p=-1!==(j=K.findIndex(function(n){return n.id===E.id||n.nodeId===E.nodeId||n.contentId===E.contentId}))?j:w}var b="".concat(zn).concat(d.DEVIATION_BADGE_SEPARATOR).concat(s).concat(d.DEVIATION_BADGE_SEPARATOR).concat(p).concat(d.DEVIATION_BADGE_SEPARATOR).concat(h),S=u[Mn],A=Pn||d.isMissingStr(S),R=Xn.get(c);G&&"right"===O&&A&&void 0!==R?v=R:G&&void 0!==Bn&&("right"!==O||A||Vn)&&(v-=Bn),v=Math.max(1,v);var M=G&&"right"===O&&A&&dn?d.getRhsMappedSectionNumber({section:E,proposedSections:K,leftNums:dn.leftNums,fallbackNumber:String(Jn),firstOnly:!0}):Jn,N="".concat(M,".").concat(v),T=w;if("right"===O&&G){var j,B=null===(o=E.refIndexes)||void 0===o?void 0:o[0],D=K.findIndex(function(n){return n.selfIndex===B});if(-1!==D)T=D;else-1!==(j=K.findIndex(function(n){return n.id===E.id||n.nodeId===E.nodeId||n.contentId===E.contentId}))&&(T=j)}var C=Q?Q(T):null,k=(null==u?void 0:u.evaluation_outputs)||(null==Gn?void 0:Gn.evaluation_outputs),P=null!==(l=null==k?void 0:k.output_value)&&void 0!==l?l:null,V=null!==(a=null===(r=null==k?void 0:k.metadata)||void 0===r?void 0:r.label_color)&&void 0!==a?a:Wn,W=d.generateColorPalette(V),q=C?n.__assign(n.__assign({},C),{badgeBg:W.badgeBg,badgeBorder:W.badgeBorder,badgeText:W.badgeText}):n.__assign({},W),L=(null==u?void 0:u.deviation_summary)?{deviation_summary:u.deviation_summary,deviation_title:(null==u?void 0:u.deviation_title)||(null==Gn?void 0:Gn.deviation_title),deviation_impact:(null==u?void 0:u.deviation_impact)||(null==Gn?void 0:Gn.deviation_impact),deviation_explanation:(null==u?void 0:u.deviation_explanation)||(null==Gn?void 0:Gn.deviation_explanation),evaluation_outputs:k,cognitive_decisioning:(null==u?void 0:u.cognitive_decisioning)||(null==Gn?void 0:Gn.cognitive_decisioning)}:null,z=0,H=xn||"";if(f&&H){var U=H.split(/\n{2,}/),nn=U.findIndex(function(n){return n.includes(f)});if(-1!==nn){var en=Object.entries(Ln).filter(function(n){n[0];var e=n[1][F];return e&&U[nn].includes(e)}).sort(function(n,e){return U[nn].indexOf(n[1][F])-U[nn].indexOf(e[1][F])}),tn=en.filter(function(n){n[0];var e=n[1][F];return e&&(e.includes(f)||f.includes(e))});tn.length>1&&(z=Math.max(0,tn.findIndex(function(n){return n[0]===s})))}}var un=Y(O,c);return{id:c,actionId:b,label:N,highlight:f,side:O,style:q,stackIndex:z,score:P,isConnected:null==Z?void 0:Z.has(b),showScrollLockToggle:(null==Z?void 0:Z.has(b))||on&&ln===b||!!sn&&sn===un.current,scrollSyncLocked:rn,toggleScrollSyncLocked:an,isOrphan:A,isMissingClause:g,badgeRef:un,onClick:function(n){n.stopPropagation(),$&&$(n,Tn||{id:"orphan-left",title:"",content:""},A,jn||{id:"orphan-right",title:"",content:""},b,q)},onSummaryClick:function(n){n.stopPropagation(),J(n,b,A,L)}}}).filter(Boolean),ie=q||!gn&&vn?ee:[],te=ee.map(function(n){return n.highlight}).filter(Boolean),oe=E.id&&O===(null==D?void 0:D.columnKey)?D:null,le=u.default.useRef(!1);return i.useEffect(function(){j||(le.current=!1)},[j]),e.jsxs(t.Box,n.__assign({ref:M,sx:{mb:T,width:"100%",display:"flex",flexDirection:"column",position:"relative",minWidth:0}},{children:[j&&(null==oe?void 0:oe.showAbove)&&e.jsx("div",n.__assign({style:{position:"sticky",top:0,height:"0px",cursor:"pointer"},onClick:function(){var n,e;return null===(e=null===(n=null==oe?void 0:oe.showAboveRef)||void 0===n?void 0:n.current)||void 0===e?void 0:e.scrollIntoView({behavior:"smooth",block:"center"})}},{children:e.jsx("div",n.__assign({style:n.__assign({transform:"translateY(-50%) translateX(calc(100% ".concat("left"===O?"+":"-"," 130px))"),position:"absolute",paddingTop:"20px"},"left"===O?{right:"-20px"}:{left:"-20px"})},{children:e.jsx(o.ChevronUp,{color:(null===(A=null==oe?void 0:oe.showAboveRef)||void 0===A?void 0:A.current)?window.getComputedStyle(oe.showAboveRef.current).color:void 0})}))})),e.jsxs(t.Accordion,n.__assign({disableGutters:!0,expanded:!_n&&j,onChange:function(){_n||(B(),P.current=E.id)},sx:{boxShadow:"none",border:_n?"1px dashed #E2E8F0":"1px solid #E2E8F0",bgcolor:_n?"#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.jsx(t.AccordionSummary,n.__assign({expandIcon:_n?null:e.jsx(o.ChevronDown,{size:16}),sx:{minHeight:"36px",flexShrink:0,cursor:_n?"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:cn&&e.jsx(t.Tooltip,n.__assign({title:yn,placement:"top"},{children:e.jsx(t.Typography,n.__assign({component:"div",sx:{fontSize:"12px",color:_n?"#94A3B8":"#19213D",fontWeight:_n?400:700,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0}},{children:($n=Sn,ne=bn,void 0===ne&&(ne=!1),$n?d.safeStringify($n).replace(/\\n/g,"\n").split(/(\*\*.*?\*\*)/g).map(function(i,t){return i.startsWith("**")&&i.endsWith("**")?e.jsx("strong",{children:i.slice(2,-2)},t):e.jsxs("div",n.__assign({style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"8px",width:"100%"}},{children:[e.jsx("span",n.__assign({style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},{children:i})),ne&&e.jsx("span",n.__assign({style:{display:"inline-flex",alignItems:"center",justifyContent:"center",padding:"0px 6px",borderRadius:"9999px",background:"#F3F4F6",border:"1px solid #D1D5DB",color:"#6B7280",fontSize:"9px",fontWeight:500,whiteSpace:"nowrap",flexShrink:0,lineHeight:1.4,marginRight:"4px"}},{children:"Multiple"}))]}),t)}):null)}))}))})),!_n&&e.jsxs(t.AccordionDetails,n.__assign({sx:{pt:0,pb:1.25,bgcolor:"#FFFFFF",flex:1,display:"flex",flexDirection:"column",minWidth:0}},{children:[mn&&e.jsx(l.MemoizedMarkdown,{content:xn,overlayContent:In,sxStyles:V,highlights:te,maintainRelativeOrder:G,highlightBg:qn,suppressHighlightBg:pn,deviationBadges:ie,collisionKey:un}),(E.subsections||[]).map(function(n,e){return L({section:n,keyPath:"".concat(w,"-").concat(e),depth:0,columnKey:O,parentNodeId:F,sectionOffset:Bn,rhsOrphanVisualIndexes:Xn})})]}))]})),j&&(null==oe?void 0:oe.showBelow)&&e.jsx("div",n.__assign({style:{position:"sticky",bottom:0,height:"0px",cursor:"pointer"},onClick:function(){var n,e;return null===(e=null===(n=null==oe?void 0:oe.showBelowRef)||void 0===n?void 0:n.current)||void 0===e?void 0:e.scrollIntoView({behavior:"smooth",block:"center"})}},{children:e.jsx("div",n.__assign({style:n.__assign({transform:"translateY(-50%) translateX(calc(100% ".concat("left"===O?"+":"-"," 130px))"),position:"absolute",paddingBottom:"20px"},"left"===O?{right:"-20px"}:{left:"-20px"})},{children:e.jsx(o.ChevronDown,{color:(null===(R=null==oe?void 0:oe.showBelowRef)||void 0===R?void 0:R.current)?window.getComputedStyle(oe.showBelowRef.current).color:void 0})}))}))]}),"".concat(O,"-sec-").concat(w))};
|
|
2
2
|
//# sourceMappingURL=SectionAccordion.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),i=require("react/jsx-runtime"),t=require("lucide-react"),n=require("../../../assests/svg/ButtonCognitiveIcon.js"),s=require("../CognitiveComparehelpers.js"),o=require("../CognitiveCompareConstants.js"),l=require("./ThreeDotsLoader.js"),r=require("./connectedLines.js"),a=require("@mui/material");exports.default=function(d){var c=d.svgContainerRef,u=d.svgDimensions,g=d.isResizing,v=d.overallConnector,x=d.rootDeviationStyle,p=d.lines,h=d.isSideBySide,y=d.activeSideBySideSection,b=d.isArrowVisible,f=d.maintainRelativeOrder,S=d.proposedSections,_=d.existingSections,j=d.cognitivePopup,m=d.activeBadgeId,I=d.closeCognitivePopup,B=d.setActiveBadgeId,C=d.openCognitivePopupFromState,R=d.buildSectionPopupState,A=d.connectedLines,P=d.pathRefs,D=d.isGuidelineMode;return i.jsxs("svg",e.__assign({ref:c,style:{position:"absolute",top:0,left:0,width:u.width||"100%",height:u.height||"100%",pointerEvents:"none",zIndex:10,overflow:"visible",opacity:g?0:1,transition:"opacity 0.15s ease-in-out"}},{children:[v&&i.jsx("g",{children:i.jsx("line",{x1:v.x1,y1:v.y,x2:v.x2,y2:v.y,stroke:x.badgeBorder,strokeWidth:"1.5"})}),p.map(function(r){var d,c,u,g,v,x,p,A=r.x1+.5*(r.x2-r.x1),P=(r.y1+r.y2)/2;if("Not Defined"===r.style.label&&!r.hasCognitive)return null;if(r.isSubSection?h&&y===r.subSectionKeyPath&&b:h&&y===r.sectionIdx&&b)return null;if(f)return null;var D=r.isSubSection?s.getBentArrowPath(r.x1,r.y1,r.x2,r.y2):"M ".concat(r.x1," ").concat(r.y1," L ").concat(r.x2," ").concat(r.y2),w=S[r.sectionIdx]||{title:"",content:""},E=_[null!==(d=r.targetRightIdx)&&void 0!==d?d:r.sectionIdx]||{title:"",content:""};if(r.isSubSection&&r.subSectionKeyPath){var O=r.subSectionKeyPath.includes(s.DEVIATION_BADGE_SEPARATOR)?r.subSectionKeyPath.split(s.DEVIATION_BADGE_SEPARATOR):[],T=O[2]||r.subSectionKeyPath,q=O[3]||T,L=T.split("-").map(Number),N=q.split("-").map(Number),k=null,K=null;L.length>0&&(k=S[L[0]]||null),N.length>0&&(K=_[N[0]]||null);for(var M=(null==k?void 0:k.title)||"",z=(null==K?void 0:K.title)||"",G=1;G<L.length;G+=1)(null==k?void 0:k.subsections)&&(k=k.subsections[L[G]]||null);for(G=1;G<N.length;G+=1)(null==K?void 0:K.subsections)&&(K=K.subsections[N[G]]||null);k&&(w=e.__assign(e.__assign({},k),{title:M||k.title})),K&&(E=e.__assign(e.__assign({},K),{title:z||K.title}))}var V=!(null===(c=w.cognitiveData)||void 0===c?void 0:c.isMissingRationale)||Boolean(null===(g=null===(u=w.cognitiveData)||void 0===u?void 0:u.decisioning)||void 0===g?void 0:g.length),F=(null===(p=null===(x=null===(v=w.evaluationResult)||void 0===v?void 0:v.cognitive_decisioning)||void 0===x?void 0:x.decisioning_factors)||void 0===p?void 0:p.length)||!1,W=V||F;return i.jsxs("g",{children:[i.jsx("path",{d:D,fill:"none",stroke:r.style.badgeBorder||"#E2E8F0",strokeWidth:"1.5"}),i.jsx("foreignObject",e.__assign({x:A-100,y:P-14,width:"200",height:"28",style:{pointerEvents:"auto",overflow:"visible"}},{children:i.jsx(a.Box,e.__assign({sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},{children:i.jsxs(a.Box,e.__assign({onClick:function(e){e.stopPropagation(),W&&(j.open&&m===r.id?I():(B(r.id),C(R(e.currentTarget,w,E,r.sectionIdx,!1,r.style))))},sx:{display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",bgcolor:r.style.badgeBg,color:r.style.badgeText,border:"1px solid ".concat(r.style.badgeBorder),borderRadius:"12px",px:1.5,py:.5,fontWeight:600,textAlign:"center",whiteSpace:"nowrap",cursor:W?"pointer":"default"}},{children:[r.style.badgeText===o.DEFAULT_DEVIAION_COLOR&&null==r.style.label?i.jsx(l.default,{color:r.style.badgeText}):null==r.style.label?null:"0"===String(r.style.label)?"Same":r.style.label,i.jsx(a.Box,e.__assign({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:i.jsx(n.ButtonCognitiveIcon,{})})),W&&i.jsx(t.ChevronDown,{size:11,style:{transform:j.open&&m===r.id?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))}))]},r.id)}),i.jsx(r.default,{maintainRelativeOrder:f,connectedLines:A,pathRefs:P,isGuidelineMode:D})]}))};
|
|
2
2
|
//# sourceMappingURL=SvgConnectors.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("react/jsx-runtime"),i=require("@mui/material"),n=require("./ScrollLockToggle.js"),r=require("../CompareContext.js");exports.default=function(o){var s=o.connectedLines,l=o.pathRefs,d=o.maintainRelativeOrder,a=r.useCompareContext(),c=a.scrollSyncLocked,u=a.toggleScrollSyncLocked,x=a.isGuidelineMode;return t.jsxs(t.Fragment,{children:[s.map(function(r){var o,s,a,f,g=r.pathD,h=(null===(o=r.style)||void 0===o?void 0:o.badgeBorder)||"#6366F1",p="conn-marker-".concat(r.id),y="".concat(r.id,"-bg"),F="".concat(r.id,"-stroke"),j="".concat(r.id,"-btn"),b="".concat(r.id,"-number"),m=void 0!==r.x1?r.x1+40:0,v=void 0!==r.y1?r.y1:0;return t.jsxs("g",{children:[t.jsx("defs",{children:t.jsx("clipPath",e.__assign({id:"connections-clip"},{children:t.jsx("marker",e.__assign({id:p,markerWidth:"8",markerHeight:"6",refX:"7",refY:"3",orient:"auto"},{children:t.jsx("polygon",{points:"0 0, 8 3, 0 6",fill:h})}))}))}),t.jsx("path",{ref:function(e){l.current[y]=e},d:g,fill:"none",stroke:"#FFFFFF",strokeWidth:"4",strokeOpacity:"0.7"}),t.jsx("path",{ref:function(e){l.current[F]=e},d:g,fill:"none",stroke:h,strokeWidth:"1.75",markerEnd:"url(#".concat(p,")")}),r.matchLabel&&t.jsxs("g",e.__assign({ref:function(e){l.current[b]=e},transform:"translate(".concat(r.x2-42,", ").concat(r.y2,")"),style:{pointerEvents:"none",transition:"visibility 0ms"}},{children:[t.jsx("rect",{x:"-22",y:"-8",width:"44",height:"16",rx:"4",fill:"#FFFFFF"}),t.jsx("rect",{x:"-21",y:"-7",width:"42",height:"14",rx:"3",fill:(null===(s=r.style)||void 0===s?void 0:s.badgeBg)||"#FEF08A",stroke:h,strokeWidth:"1"}),t.jsx("text",e.__assign({x:"0",y:"3.5",fontSize:"9px",fontWeight:"bold",fontFamily:'"Plus Jakarta Sans", sans-serif',fill:(null===(a=r.style)||void 0===a?void 0:a.badgeText)||h,textAnchor:"middle"},{children:r.matchLabel}))]})),d&&void 0!==r.x1&&!x&&t.jsx("foreignObject",e.__assign({ref:function(e){l.current[j]=e},x:m-12,y:v-12,width:"24",height:"24",style:{pointerEvents:"auto",overflow:"visible"}},{children:t.jsx(i.Box,e.__assign({onClick:function(e){e.stopPropagation(),u&&u(e)},sx:{display:"flex",justifyContent:"center",alignItems:"center",width:"100%",height:"100%",bgcolor:"#FFFFFF",borderRadius:"50%",border:"1px solid ".concat(h),cursor:"pointer",transition:"transform 0.2s ease","&:hover":{transform:"scale(1.05)",boxShadow:"0px 2px 4px rgba(0,0,0,0.1)"}}},{children:t.jsx(n.default,{locked:c,onToggle:u,color:(null===(f=r.style)||void 0===f?void 0:f.badgeText)||h,borderColor:"transparent",size:12})}))}))]},r.id)}),t.jsxs("g",{children:[t.jsxs("g",e.__assign({style:{transition:"visibility 0ms"}},{children:[t.jsx("path",{ref:function(e){return l.current["guideline-up-stroke"]=e},fill:"none",strokeWidth:"1.75",visibility:"hidden"}),t.jsxs("g",e.__assign({ref:function(e){return l.current["guideline-up-badge"]=e},visibility:"hidden"},{children:[t.jsx("polygon",{ref:function(e){return l.current["guideline-up-arrow"]=e},points:"-4,0 0,-6 4,0"}),t.jsx("rect",{ref:function(e){return l.current["guideline-up-badge-rect"]=e},x:"-12",y:"3",width:"24",height:"15",rx:"4",fill:"#FFFFFF",strokeWidth:"1"}),t.jsx("text",{ref:function(e){return l.current["guideline-up-text"]=e},x:"0",y:"14",fontSize:"10px",fontWeight:"bold",fontFamily:'"Plus Jakarta Sans", sans-serif',textAnchor:"middle"})]}))]})),t.jsxs("g",e.__assign({style:{transition:"visibility 0ms"}},{children:[t.jsx("path",{ref:function(e){return l.current["guideline-down-stroke"]=e},fill:"none",strokeWidth:"1.75",visibility:"hidden"}),t.jsxs("g",e.__assign({ref:function(e){return l.current["guideline-down-badge"]=e},visibility:"hidden"},{children:[t.jsx("polygon",{ref:function(e){return l.current["guideline-down-arrow"]=e},points:"-4,0 0,6 4,0"}),t.jsx("rect",{ref:function(e){return l.current["guideline-down-badge-rect"]=e},x:"-12",y:"-18",width:"24",height:"15",rx:"4",fill:"#FFFFFF",strokeWidth:"1"}),t.jsx("text",{ref:function(e){return l.current["guideline-down-text"]=e},x:"0",y:"-7",fontSize:"10px",fontWeight:"bold",fontFamily:'"Plus Jakarta Sans", sans-serif',textAnchor:"middle"})]}))]}))]})]})};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("react/jsx-runtime"),i=require("@mui/material"),n=require("./ScrollLockToggle.js"),r=require("../CompareContext.js");exports.default=function(o){var s=o.connectedLines,l=o.pathRefs,d=o.maintainRelativeOrder,a=r.useCompareContext(),c=a.scrollSyncLocked,u=a.toggleScrollSyncLocked,x=a.isGuidelineMode;return t.jsxs(t.Fragment,{children:[s.map(function(r){var o,s,a,f,g=r.pathD,h=(null===(o=r.style)||void 0===o?void 0:o.badgeBorder)||"#6366F1",p="conn-marker-".concat(r.id),y="".concat(r.id,"-bg"),F="".concat(r.id,"-stroke"),j="".concat(r.id,"-btn"),b="".concat(r.id,"-number"),m=void 0!==r.x1?r.x1+40:0,v=void 0!==r.y1?r.y1:0;return t.jsxs("g",{children:[t.jsx("defs",{children:t.jsx("clipPath",e.__assign({id:"connections-clip"},{children:t.jsx("marker",e.__assign({id:p,markerWidth:"8",markerHeight:"6",refX:"7",refY:"3",orient:"auto"},{children:t.jsx("polygon",{points:"0 0, 8 3, 0 6",fill:h})}))}))}),t.jsx("path",{ref:function(e){l.current[y]=e},d:g,fill:"none",stroke:"#FFFFFF",strokeWidth:"4",strokeOpacity:"0.7"}),t.jsx("path",{ref:function(e){l.current[F]=e},d:g,fill:"none",stroke:h,strokeWidth:"1.75",markerEnd:"url(#".concat(p,")")}),x&&r.matchLabel&&t.jsxs("g",e.__assign({ref:function(e){l.current[b]=e},transform:"translate(".concat(r.x2-42,", ").concat(r.y2,")"),style:{pointerEvents:"none",transition:"visibility 0ms"}},{children:[t.jsx("rect",{x:"-22",y:"-8",width:"44",height:"16",rx:"4",fill:"#FFFFFF"}),t.jsx("rect",{x:"-21",y:"-7",width:"42",height:"14",rx:"3",fill:(null===(s=r.style)||void 0===s?void 0:s.badgeBg)||"#FEF08A",stroke:h,strokeWidth:"1"}),t.jsx("text",e.__assign({x:"0",y:"3.5",fontSize:"9px",fontWeight:"bold",fontFamily:'"Plus Jakarta Sans", sans-serif',fill:(null===(a=r.style)||void 0===a?void 0:a.badgeText)||h,textAnchor:"middle"},{children:r.matchLabel}))]})),d&&void 0!==r.x1&&!x&&t.jsx("foreignObject",e.__assign({ref:function(e){l.current[j]=e},x:m-12,y:v-12,width:"24",height:"24",style:{pointerEvents:"auto",overflow:"visible"}},{children:t.jsx(i.Box,e.__assign({onClick:function(e){e.stopPropagation(),u&&u(e)},sx:{display:"flex",justifyContent:"center",alignItems:"center",width:"100%",height:"100%",bgcolor:"#FFFFFF",borderRadius:"50%",border:"1px solid ".concat(h),cursor:"pointer",transition:"transform 0.2s ease","&:hover":{transform:"scale(1.05)",boxShadow:"0px 2px 4px rgba(0,0,0,0.1)"}}},{children:t.jsx(n.default,{locked:c,onToggle:u,color:(null===(f=r.style)||void 0===f?void 0:f.badgeText)||h,borderColor:"transparent",size:12})}))}))]},r.id)}),t.jsxs("g",{children:[t.jsxs("g",e.__assign({style:{transition:"visibility 0ms"}},{children:[t.jsx("path",{ref:function(e){return l.current["guideline-up-stroke"]=e},fill:"none",strokeWidth:"1.75",visibility:"hidden"}),t.jsxs("g",e.__assign({ref:function(e){return l.current["guideline-up-badge"]=e},visibility:"hidden"},{children:[t.jsx("polygon",{ref:function(e){return l.current["guideline-up-arrow"]=e},points:"-4,0 0,-6 4,0"}),t.jsx("rect",{ref:function(e){return l.current["guideline-up-badge-rect"]=e},x:"-12",y:"3",width:"24",height:"15",rx:"4",fill:"#FFFFFF",strokeWidth:"1"}),t.jsx("text",{ref:function(e){return l.current["guideline-up-text"]=e},x:"0",y:"14",fontSize:"10px",fontWeight:"bold",fontFamily:'"Plus Jakarta Sans", sans-serif',textAnchor:"middle"})]}))]})),t.jsxs("g",e.__assign({style:{transition:"visibility 0ms"}},{children:[t.jsx("path",{ref:function(e){return l.current["guideline-down-stroke"]=e},fill:"none",strokeWidth:"1.75",visibility:"hidden"}),t.jsxs("g",e.__assign({ref:function(e){return l.current["guideline-down-badge"]=e},visibility:"hidden"},{children:[t.jsx("polygon",{ref:function(e){return l.current["guideline-down-arrow"]=e},points:"-4,0 0,6 4,0"}),t.jsx("rect",{ref:function(e){return l.current["guideline-down-badge-rect"]=e},x:"-12",y:"-18",width:"24",height:"15",rx:"4",fill:"#FFFFFF",strokeWidth:"1"}),t.jsx("text",{ref:function(e){return l.current["guideline-down-text"]=e},x:"0",y:"-7",fontSize:"10px",fontWeight:"bold",fontFamily:'"Plus Jakarta Sans", sans-serif',textAnchor:"middle"})]}))]}))]})]})};
|
|
2
2
|
//# sourceMappingURL=connectedLines.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as e,__spreadArray as n,__awaiter as i,__generator as t}from"tslib";import{jsx as o,jsxs as r}from"react/jsx-runtime";import{useState as l,useRef as u,useMemo as a,useEffect as c,useCallback as s}from"react";import{Box as d,Snackbar as v,Alert as f,Tooltip as p,Typography as g}from"@mui/material";import{ChevronDown as h}from"lucide-react";import{ButtonCognitiveIcon as m}from"../../assests/svg/ButtonCognitiveIcon.js";import S from"./OverlayComponent.js";import{safeStringify as x,extractDeviationScore as R,generateColorPalette as b,findKeyPathByNodeId as y,DEVIATION_BADGE_SEPARATOR as C,hasMeaningfulRedlineTags as w,scrollAndHighlightClause as B,scrollAndWait as _,waitForScrollIdle as I}from"./CognitiveComparehelpers.js";import{SHARED_MARKDOWN_STYLES as E,DEFAULT_FIELD_CONFIG as F,DEFAULT_COMPARISON_CONFIG as A}from"./CognitiveCompareConfig.js";export{SHARED_MARKDOWN_STYLES}from"./CognitiveCompareConfig.js";import{DEFAULT_DEVIAION_COLOR as T,EMPTY_SUMMARY_POPUP_STATE as D,DEFAULT_COMPONENT_HEADER_TEXT as k}from"./CognitiveCompareConstants.js";import O from"./CognitivePopup.js";import P from"./MoreFunctionsPopup.js";import j from"./LoaderComponent.js";import L from"./components/ThreeDotsLoader.js";import{useCognitiveTreeData as N}from"./hooks/useCompareData.js";import{useComparePopups as M}from"./hooks/useComparePopups.js";import{useSectionRefs as H}from"./hooks/useSectionRefs.js";import{useAccordionState as z}from"./hooks/useAccordionState.js";import{useDeviationNavigation as q}from"./hooks/useDeviationNavigation.js";import V from"./components/CompareHeader.js";import W from"./components/SubSectionAccordion.js";import G from"./components/LHSSectionRow.js";import K from"./components/RHSSectionRow.js";import Y from"./components/CognitiveSummaryPopup.js";import{CompareContextProvider as J}from"./CompareContext.js";import{useStyleHelpers as X}from"./hooks/useStyles.js";import{useResizeHandler as $}from"./hooks/useResizeHandler.js";import{useLinesCalculator as U}from"./hooks/useLinesCalculator.js";import{useSideBySide as Q}from"./hooks/useSideBySide.js";import Z from"./components/SvgConnectors.js";import ee from"./Guidelines/components/GuidelinePanel.js";var ne=function(ne){var ie,te,oe,re,le,ue,ae,ce,se,de,ve,fe,pe,ge,he,me,Se,xe,Re,be,ye,Ce,we,Be,_e,Ie,Ee,Fe,Ae,Te,De,ke,Oe,Pe,je,Le=ne.componentHeaderText,Ne=void 0===Le?k:Le,Me=ne.treeData,He=ne.comparisonConfig,ze=ne.leftColumnTitleText,qe=ne.rightColumnTitleText,Ve=ne.markdownStyles,We=ne.resetTrigger,Ge=ne.displayConfig,Ke=void 0===Ge?{isHeaderVisible:!0,isToggleVisible:!0,maintainRelativeOrder:!1,isLoading:!0,showDeviationBadges:!1,enableDeviationSchemaBackwardCompatibility:!1,displayEmailNotifier:!0,isStreamingEnabled:!1}:Ge,Ye=ne.onMaintainRelativeOrderChange,Je=ne.popupConfig,Xe=ne.deviationData,$e=void 0===Xe?{}:Xe,Ue=ne.deviationNodeIdToView,Qe=ne.resetDeviationNodeId,Ze=ne.isProposingFix,en=void 0!==Ze&&Ze,nn=ne.proposingFixNodeId,tn=ne.isRedlineFlow,on=ne.badgeStyleOverride,rn=ne.guidelinesData,ln=l(Ke.maintainRelativeOrder),un=ln[0],an=ln[1],cn=null!==(ie=null==Ke?void 0:Ke.expandLevels)&&void 0!==ie?ie:0,sn=!!(null==Ke?void 0:Ke.expandAllSections),dn=!!un||!!(null==Ke?void 0:Ke.showDeviationBadges),vn=l(!1),fn=vn[0],pn=vn[1],gn=l(null),hn=gn[0],mn=gn[1],Sn=l(null===(oe=null!==(te=null==Me?void 0:Me.newEvaluationResult)&&void 0!==te?te:null==Ke?void 0:Ke.enableDeviationSchemaBackwardCompatibility)||void 0===oe||oe)[0],xn=l(new Set),Rn=xn[0],bn=xn[1],yn=l([]),Cn=yn[0],wn=yn[1],Bn=l(!1),_n=Bn[0],In=Bn[1],En=u(null),Fn=u(null),An=u(null),Tn=u(null),Dn=u(null),kn=u(!1),On=u(null),Pn=u({}),jn=u([]),Ln=u(function(){}),Nn=u(null),Mn=u(function(){}),Hn=a(function(){return JSON.stringify($e||{})},[JSON.stringify($e)]),zn=a(function(){return $e||{}},[Hn]),qn=a(function(){return(null==Me?void 0:Me.cognitive_decisioning)||{}},[Me]),Vn=a(function(){return e(e({},E),Ve)},[Ve]),Wn=u(null),Gn=u(null),Kn=u(null),Yn=u(null),Jn=u(null),Xn=u(null),$n=u(null),Un=u(null),Qn=u(null),Zn=u(null),ei=M(Wn),ni=ei.cognitivePopup,ii=ei.setCognitivePopup,ti=ei.moreFunctions,oi=ei.setMoreFunctions,ri=ei.position,li=ei.setPosition,ui=ei.activeBadgeId,ai=ei.summaryPopup,ci=ei.setSummaryPopup,si=ei.closeSummaryPopup,di=ei.setActiveBadgeId,vi=ei.popupRef,fi=ei.handleOpenCognitiveCompare,pi=ei.openCognitivePopupFromState,gi=ei.closeCognitivePopup,hi=ei.closeMoreFunctionsPopup,mi=a(function(){var e,n,i,t,o,r,l;return{fields:null!==(e=null==He?void 0:He.fields)&&void 0!==e?e:F,thresholds:{high:null!==(i=null===(n=null==He?void 0:He.thresholds)||void 0===n?void 0:n.high)&&void 0!==i?i:A.thresholds.high,medium:null!==(o=null===(t=null==He?void 0:He.thresholds)||void 0===t?void 0:t.medium)&&void 0!==o?o:A.thresholds.medium,exact:null!==(l=null===(r=null==He?void 0:He.thresholds)||void 0===r?void 0:r.exact)&&void 0!==l?l:A.thresholds.exact}}},[He]),Si=l(null),xi=Si[0];Si[1];var Ri=null===(ue=null===(re=null==Me?void 0:Me.documents)||void 0===re?void 0:re[null===(le=null==Me?void 0:Me.input_index_map)||void 0===le?void 0:le[0]])||void 0===ue?void 0:ue.title,bi=null===(se=null===(ae=null==Me?void 0:Me.documents)||void 0===ae?void 0:ae[null===(ce=null==Me?void 0:Me.input_index_map)||void 0===ce?void 0:ce[1]])||void 0===se?void 0:se.title,yi=x(ze||Ri||"Uploaded Contract"),Ci=null===(pe=null===(fe=null===(de=null==Me?void 0:Me.documents)||void 0===de?void 0:de[null===(ve=null==Me?void 0:Me.input_index_map)||void 0===ve?void 0:ve[0]])||void 0===fe?void 0:fe.metadata)||void 0===pe?void 0:pe.file_name,wi=x(Ci),Bi=null===(Se=null===(me=null===(ge=null==Me?void 0:Me.documents)||void 0===ge?void 0:ge[null===(he=null==Me?void 0:Me.input_index_map)||void 0===he?void 0:he[1]])||void 0===me?void 0:me.metadata)||void 0===Se?void 0:Se.file_name,_i=x(Bi),Ii=x(qe||bi||"Reference Template"),Ei=N(Me,un,zn,mi,Sn,rn),Fi=Ei.isGuidelineMode,Ai=Ei.activeProposed,Ti=Ei.existingRule,Di=Ei.proposedSections,ki=Ei.existingSections,Oi=Ei.visibleFields,Pi=Ei.parentDeviationRecord,ji=Ei.deviationNumberRegistry,Li=Ei.deviationParentRegistry,Ni=Ei.parseError;c(function(){Ni&&mn("Failed to load comparison: ".concat(Ni))},[Ni]);var Mi=Di.length>0||ki.length>0,Hi=a(function(){if(!tn)return"off";var e=0,n=0,i=function(t){Array.isArray(t)&&t.forEach(function(t){var o,r=(null==t?void 0:t.content)||"";w(r)&&(e+=1,n+=String(r).length),(null===(o=null==t?void 0:t.subsections)||void 0===o?void 0:o.length)&&i(t.subsections)})};return i(Di),i(ki),"".concat(e,":").concat(n)},[tn,Di,ki]);c(function(){if(Di.length||ki.length)if(sn){var e={},n={},i=function(i,t){i.forEach(function(i,o){var r,l=un?"".concat(t,"-").concat(o):String(o);e[l]=!0;var u=function(e,i){null==e||e.forEach(function(e,t){var o,r="".concat(i,"-").concat(t);n[r]=!0,(null===(o=e.subsections)||void 0===o?void 0:o.length)&&u(e.subsections,r)})};(null===(r=i.subsections)||void 0===r?void 0:r.length)&&u(i.subsections,String(o))})};i(Di,"left"),i(ki,"right"),yt(e),wt(n)}else if(cn>0){var t={},o={},r=function(e,n,i){e.forEach(function(e,r){var l;if(i>=1){var u=un?"".concat(n,"-").concat(r):String(r);t[u]=!0}var a=function(e,n,t){t>i||null==e||e.forEach(function(e,i){var r,l="".concat(n,"-").concat(i);o[l]=!0,(null===(r=e.subsections)||void 0===r?void 0:r.length)&&a(e.subsections,l,t+1)})};(null===(l=e.subsections)||void 0===l?void 0:l.length)&&i>=2&&a(e.subsections,String(r),2)})};r(Di,"left",cn),r(ki,"right",cn),yt(t),wt(o)}},[sn,cn,Di,ki,un]);var zi=H(Oi.map(function(e){return e.key}),Math.max(Di.length,ki.length)),qi=zi.leftRefs,Vi=zi.rightRefs,Wi=zi.sectionLeftRefs,Gi=zi.sectionRightRefs,Ki=zi.lhsBadgeRefs,Yi=zi.rhsBadgeRefs,Ji=zi.sectionRightRowRefs,Xi=zi.subSectionLeftRefs,$i=zi.subSectionRightRefs,Ui=zi.sectionRowRefs,Qi=zi.getSectionRowRef,Zi=zi.getSubSectionRef,et=zi.getBadgeRef,nt=Q({isGuidelineMode:Fi,maintainRelativeOrder:un,proposedSections:Di,existingSections:ki,leftContainerRef:Un,rightContainerRef:Kn,scrollContainerRef:Wn,sectionLeftRefs:Wi,sectionRightRefs:Gi,subSectionLeftRefs:Xi,subSectionRightRefs:$i,lhsBadgeRefs:Ki,rhsBadgeRefs:Yi,sectionRowRefs:Ui,sectionRightRowRefs:Ji,rhsTopSpacerRef:Yn,rhsBottomSpacerRef:Jn,lhsTopSpacerRef:Xn,lhsBottomSpacerRef:$n,calculateLinesRef:Ln,setConnectedSections:bn,setConnectedLines:wn,cachedConnectedPositions:jn,closeMoreFunctionsPopup:hi,setErrorToast:mn,moreFunctions:ti,closeSummaryPopup:si}),it=nt.isSideBySide,tt=nt.isArrowVisible,ot=nt.setIsArrowVisible,rt=nt.isResizing,lt=nt.setIsResizing,ut=nt.isSideBySideLoading,at=nt.activeSideBySideSection,ct=nt.scrollLock,st=nt.sideBySideCacheRef,dt=nt.isSideBySideRef,vt=nt.activeSideBySideRightSectionRef,ft=nt.activeSideBySideSectionRef,pt=nt.sideBySideLineRef,gt=nt.highlightedClauseRefs,ht=nt.clearClauseHighlight,mt=nt.resetSideBySide,St=nt.activateSideBySide,xt=u(St);c(function(){xt.current=St},[St]);var Rt=z({maintainRelativeOrder:!!un,proposedSections:Di,existingSections:ki,activeSideBySideSection:at,connectedSections:Rn,resetSideBySide:mt,setConnectedSections:bn,setConnectedLines:wn,cachedConnectedPositions:jn,svgContainerRef:En,isAnimatingRef:kn,animationTimerRef:On,calculateLinesRef:Ln,sectionLeftRefs:Wi,sectionRightRefs:Gi,subSectionLeftRefs:Xi,subSectionRightRefs:$i}),bt=Rt.expandedSections,yt=Rt.setExpandedSections,Ct=Rt.expandedSubSections,wt=Rt.setExpandedSubSections,Bt=Rt.handleSubSectionToggle,_t=Rt.toggleSection,It=Rt.forceExpandCrossWiredSections,Et=function(){var e,n;if(null!=at){var i=null===(e=Wi.current[at])||void 0===e?void 0:e.current,t=null===(n=Gi.current[at])||void 0===n?void 0:n.current,o=Kn.current;if(i&&t&&o){var r=i.getBoundingClientRect(),l=t.getBoundingClientRect(),u=o.getBoundingClientRect(),a=r.top-u.top,c=l.top-u.top-a;o.scrollBy({top:c,behavior:"smooth"})}}},Ft=s(function(e){null==e||e.stopPropagation(),In(function(e){var n=!e;return n&&requestAnimationFrame(function(){Et()}),n})},[Et]);c(function(){tn&&"off"!==Hi&&"0:0"!==Hi&&(st.current=null,jn.current=[],requestAnimationFrame(function(){var e;null===(e=Ln.current)||void 0===e||e.call(Ln)}))},[tn,Hi]);var At=a(function(){var e=new Map,n=new Map,i=1;if(un)Di.forEach(function(n){!n.title&&!n.content||n.id&&e.set(n.id,i++)}),ki.forEach(function(t){if(t.id&&!(!t.title&&!t.content)){var o=Di.filter(function(e){var n;return null===(n=e.refIndexes)||void 0===n?void 0:n.includes(t.selfIndex)});if(o.length>0){var r=o.map(function(n){return e.get(n.id)}).filter(Boolean);n.set(t.id,r.join(", "))}else n.set(t.id,String(i++))}});else for(var t=Math.max(Di.length,ki.length),o=0;o<t;o++){var r=Di[o],l=ki[o];r?(e.set(r.id,i),l&&n.set(l.id,String(i)),i++):l&&n.set(l.id,String(i++))}return{leftNums:e,rightNums:n}},[Di,ki,un]),Tt=Ti.analysis,Dt=x(null===(Re=null===(xe=null==Tt?void 0:Tt.rule_difference_comparison)||void 0===xe?void 0:xe.summary)||void 0===Re?void 0:Re.overall_summary),kt=!!Dt.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),Ot=null!==(be=null==Me?void 0:Me.base_root_id)&&void 0!==be?be:"-1";null==Me||Me[Ot];var Pt=Sn?null!==(ke=null!==(Ae=$e&&(null===(Fe=null==$e?void 0:$e[Ot])||void 0===Fe?void 0:Fe.evaluation_result))&&void 0!==Ae?Ae:null===(De=null===(Te=null==Me?void 0:Me.nodes)||void 0===Te?void 0:Te[Ot])||void 0===De?void 0:De.evaluation_result)&&void 0!==ke?ke:null:null!==(Ee=null!==(we=$e&&(null===(Ce=null===(ye=null==$e?void 0:$e[Ot])||void 0===ye?void 0:ye.evaluation_result)||void 0===Ce?void 0:Ce[0]))&&void 0!==we?we:null===(Ie=null===(_e=null===(Be=null==Me?void 0:Me.nodes)||void 0===Be?void 0:Be[Ot])||void 0===_e?void 0:_e.evaluation_result)||void 0===Ie?void 0:Ie[0])&&void 0!==Ee?Ee:null,jt=R(Pt),Lt=b(null!==(je=null===(Pe=null===(Oe=null==Pt?void 0:Pt.evaluation_outputs)||void 0===Oe?void 0:Oe.metadata)||void 0===Pe?void 0:Pe.label_color)&&void 0!==je?je:T);if(on){var Nt=on(jt);Nt&&(Lt=e(e({},Lt),{badgeBg:Nt.bg,badgeText:Nt.text,badgeBorder:Nt.border}))}var Mt=u(mt);c(function(){Mt.current=mt},[mt]);var Ht=u(gi);c(function(){Ht.current=gi},[gi]);var zt=s(function(e,n,i,t,o,r){return Ko.current(e,n,i,t,o,r)},[]),qt=s(function(e,n,i,t,o){return Jo.current(e,n,i,t,o)},[]),Vt=s(function(){return Xo.current()},[]),Wt=s(function(e,n){return $o.current(e,n)},[]),Gt=s(function(e){return Uo.current(e)},[]),Kt=s(function(e){return Qo.current(e)},[]),Yt=s(function(){return Zo.current()},[]),Jt=s(function(){var e,n;ht(),null===(e=Mt.current)||void 0===e||e.call(Mt),In(!1),bn(new Set),wn([]),jn.current=[],po([]),ho(null),ci(D),null===(n=Ht.current)||void 0===n||n.call(Ht),requestAnimationFrame(function(){var e;null===(e=Ln.current)||void 0===e||e.call(Ln)})},[]),Xt=u(Jt);c(function(){Xt.current=Jt},[Jt]),c(function(){We&&Xt.current()},[We]);var $t=a(function(){return{documents:null==Me?void 0:Me.documents,input_index_map:null==Me?void 0:Me.input_index_map}},[JSON.stringify(null==Me?void 0:Me.documents),JSON.stringify(null==Me?void 0:Me.input_index_map)]),Ut=u(Me);c(function(){Ut.current=Me},[Me]);var Qt=u(qn);c(function(){Qt.current=qn},[qn]);var Zt=s(function(n,i,t,o,r,l,u){var a,c,s,d,v,f,p,g,h,m,S,R,b=x(null==i?void 0:i.id)||x(null==t?void 0:t.id)||"",y=(b?null===(a=Qt.current)||void 0===a?void 0:a[b]:null)||(null==i?void 0:i.cognitiveData)||(null==t?void 0:t.cognitiveData)||{section_id:b,decisioning:[],gap:[],relevance_score:0},w=null!==(s=null===(c=Ui.current[o])||void 0===c?void 0:c.current)&&void 0!==s?s:null,B=function(){var n,r,l=(null==i?void 0:i.evaluationResult)||(null==t?void 0:t.evaluationResult)||null,u=function(n){var i=function(e){if(!e||"object"!=typeof e)return null;var n=null==e?void 0:e.deviation_entries;if(n&&"object"==typeof n){var i=Object.keys(n).sort(function(e,n){return Number(e)-Number(n)})[0];if(i&&n[i])return n[i]}var t=Object.keys(e).filter(function(e){return/^\d+$/.test(e)}).sort(function(e,n){return Number(e)-Number(n)});if(t.length&&e[t[0]])return e[t[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 i?e(e({},n),{deviation_summary:(null==n?void 0:n.deviation_summary)||(null==i?void 0:i.deviation_summary),deviation_title:(null==n?void 0:n.deviation_title)||(null==i?void 0:i.deviation_title),deviation_impact:(null==n?void 0:n.deviation_impact)||(null==i?void 0:i.deviation_impact),deviation_explanation:(null==n?void 0:n.deviation_explanation)||(null==i?void 0:i.deviation_explanation),evaluation_outputs:(null==n?void 0:n.evaluation_outputs)||(null==i?void 0:i.evaluation_outputs),cognitive_decisioning:(null==n?void 0:n.cognitive_decisioning)||(null==i?void 0:i.cognitive_decisioning)}):n};if(!("string"==typeof o&&o.includes(C)))return u(l);var a=o.split(C)[1];if(!a)return l;var c=(null==i?void 0:i.evaluationResult)||(null==t?void 0:t.evaluationResult)||{},s=(null===(n=null==c?void 0:c.deviation_entries)||void 0===n?void 0:n[a])||(null===(r=null==c?void 0:c.deviations)||void 0===r?void 0:r[a])||null;return s?e(e(e({},c),s),{deviation_summary:(null==s?void 0:s.deviation_summary)||(null==c?void 0:c.deviation_summary),deviation_title:(null==s?void 0:s.deviation_title)||(null==c?void 0:c.deviation_title),deviation_impact:(null==s?void 0:s.deviation_impact)||(null==c?void 0:c.deviation_impact),deviation_explanation:(null==s?void 0:s.deviation_explanation)||(null==c?void 0:c.deviation_explanation),evaluation_outputs:(null==s?void 0:s.evaluation_outputs)||(null==c?void 0:c.evaluation_outputs),cognitive_decisioning:(null==s?void 0:s.cognitive_decisioning)||(null==c?void 0:c.cognitive_decisioning)}):u(l)}(),_=(null!==(f=null===(v=null===(d=null==B?void 0:B.cognitive_decisioning)||void 0===d?void 0:d.decisioning_factors)||void 0===v?void 0:v.length)&&void 0!==f?f:0)>0||(null!==(h=null===(g=null===(p=null==B?void 0:B.cognitive_decisioning)||void 0===p?void 0:p.gaps_in_decision)||void 0===g?void 0:g.length)&&void 0!==h?h:0)>0,I=null!==(m=null==Ke?void 0:Ke.isLoading)&&void 0!==m&&m,E=!0;if(Fi)if(B&&Object.keys(B).length>0){var F=Array.isArray(B)?B[0]:B,A=null===(R=null===(S=null==F?void 0:F.evaluation_outputs)||void 0===S?void 0:S.metadata)||void 0===R?void 0:R.is_orphan;!0!==A&&"true"!==A&&"Yes"!==A&&"yes"!==A||(E=!1)}else E=!1;return{isLoading:I&&!_,open:!0,sectionTitle:(null==i?void 0:i.title)?null==i?void 0:i.title:"No Counterpart",refSectionTitle:(null==t?void 0:t.title)?null==t?void 0:t.title:"No Counterpart",cognitiveData:y,anchorEl:n,sectionAnchorEl:w,badgeStyle:l||null,sectionIdx:o,docData:$t,deviationData:B,isOrphan:!!r,hasGuidelineMatches:E}},[$t,null==Ke?void 0:Ke.isLoading,Fi]),eo=s(function(e,n,i,t,o,r){var l;if(e.stopPropagation(),ti.open&&ti.sectionIdx===o)hi();else{var u=e.currentTarget,a="left";(null===(l=Kn.current)||void 0===l?void 0:l.contains(u))&&(a="right");ht(),dt.current&&mt(),bn(new Set),wn([]),jn.current=[],gi(),ai.open?Io():si(),requestAnimationFrame(function(){var e=function(){var e,n,i,t;if("string"==typeof o&&o.includes(C)){var r=o.split(C),l="".concat(r[0]).concat(C).concat(r[1]);return"right"===a?null===(e=Yi.current[l])||void 0===e?void 0:e.current:null===(n=Ki.current[l])||void 0===n?void 0:n.current}return"right"===a?null===(i=Yi.current[o])||void 0===i?void 0:i.current:null===(t=Ki.current[o])||void 0===t?void 0:t.current}()||u;oi(Zt(e,n,t,o,i,r))})}},[ti.open,ti.sectionIdx,hi,si,Zt]),no=s(function(){var e=ti.sectionIdx;ti.isOrphan,hi(),si(),null!==e&&(It(e),ht(),dt.current&&mt(),wn([]),jn.current=[],bn(function(n){return n.has(e)?new Set:new Set([e])}),setTimeout(function(){Ln.current&&Ln.current()},50))},[ti.sectionIdx,ti.isOrphan,hi,si,mt]),io=s(function(){var e=Dn.current;if(e){Dn.current=null;var n=Di.findIndex(function(n){return n.id===e}),i=ki.findIndex(function(n){return n.id===e}),t=-1===n?y(Di,e):null,o=-1===i?y(ki,e):null,r=-1!==n?n:t?Number(t.split("-")[0]):-1,l=-1!==i?i:o?Number(o.split("-")[0]):-1,u=function(e,n,i,t){var o,r,l,u;return-1!==e?null!==(r=null===(o=i.current[e])||void 0===o?void 0:o.current)&&void 0!==r?r:null:n&&null!==(u=null===(l=t.current[n])||void 0===l?void 0:l.current)&&void 0!==u?u:null},a=function(e,n,i){void 0===i&&(i=30);var t=0,o=function(){var r=e();r&&0!==r.getBoundingClientRect().height?(gt.current.add(r),B(r,n)):t++<i&&requestAnimationFrame(o)};requestAnimationFrame(o)};if(un)-1!==r&&Un.current&&a(function(){return u(n,t,Wi,Xi)},Un.current),-1!==l&&Kn.current&&a(function(){return u(i,o,Gi,$i)},Kn.current);else{var c=Wn.current;if(!c)return;a(function(){return-1!==r?u(n,t,Wi,Xi):u(i,o,Gi,$i)},c)}}},[Di,ki,un,Wi,Gi,Xi,$i,Un,Kn,Wn]),to=s(function(n){if(n){ht(),mt(),bn(new Set),wn([]),jn.current=[],si(),gi();var i=Di.findIndex(function(e){return e.id===n}),t=ki.findIndex(function(e){return e.id===n}),o=-1===i?y(Di,n):null,r=-1===t?y(ki,n):null;if(-1!==i||o||-1!==t||r){var l=-1!==i?i:o?Number(o.split("-")[0]):-1,u=-1!==t?t:r?Number(r.split("-")[0]):-1;Dn.current=n,yt(function(n){var i,t=e({},n),o=!1;-1!==l&&(t[i=un?"left-".concat(l):String(l)]||(t[i]=!0,o=!0));-1!==u&&(t[i=un?"right-".concat(u):String(u)]||(t[i]=!0,o=!0));return o?t:n}),wt(function(n){var i=e({},n),t=!1,l=function(e){for(var n=e.split("-"),o=n[0],r=1;r<n.length;r++)o+="-".concat(n[r]),i[o]||(i[o]=!0,t=!0)};return o&&l(o),r&&l(r),t?i:n}),setTimeout(function(){requestAnimationFrame(function(){Dn.current===n&&oo.current()})},50)}else console.warn('scrollToAndHighlightClause: nodeId "'.concat(n,'" not found'))}},[Di,ki,un,yt,wt,mt,si,gi]),oo=u(io);c(function(){oo.current=io},[io]);var ro=u(null);c(function(){if(xi){var e=mi.fields.find(function(e){return e.analysisKey===xi||e.key===xi});if(e){var n=qi.current[e.key]||Vi.current[e.key];(null==n?void 0:n.current)&&setTimeout(function(){return n.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[xi,mi.fields]);var lo=s(function(e){var n,i,t,o,r,l,u,a,c,s=null===(n=null==Tt?void 0:Tt.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===(t=null===(i=null==d?void 0:d.highlights)||void 0===i?void 0:i.ruleA_spans)||void 0===t?void 0:t.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===(a=d.highlights)||void 0===a?void 0:a.ruleA_spans)||[],highlightsB:(null===(c=d.highlights)||void 0===c?void 0:c.ruleB_spans)||[],hasContent:!!v}},[Tt]),uo=X({proposedSections:Di,existingSections:ki,maintainRelativeOrder:un,cognitiveMap:qn,deviationData:zn,treeData:Me,resolvedComparisonConfig:mi,badgeStyleOverride:on}),ao=uo.getSectionCompareStyle,co=uo.getSubSectionCompareStyle,so=uo.getDeviationStyleByKey,vo=U({containerRef:Fn,leftContainerRef:Un,rightContainerRef:Kn,svgContainerRef:En,pathRefs:Pn,leftHeaderRef:An,rightHeaderRef:Tn,proposedSections:Di,existingSections:ki,visibleFields:Oi,leftRefs:qi,rightRefs:Vi,sectionLeftRefs:Wi,sectionRightRefs:Gi,subSectionLeftRefs:Xi,subSectionRightRefs:$i,lhsBadgeRefs:Ki,rhsBadgeRefs:Yi,sectionRowRefs:Ui,expandedSections:bt,expandedSubSections:Ct,connectedSections:Rn,isSideBySide:it,activeSideBySideSection:at,maintainRelativeOrder:un,isGuidelineMode:Fi,cognitiveMap:qn,getSectionCompareStyle:ao,getSubSectionCompareStyle:co,getDeviationStyleByKey:so,isArrowVisible:tt,isAnimatingRef:kn,isSideBySideRef:dt,sideBySideCacheRef:st,sideBySideLineRef:pt,activeSideBySideSectionRef:ft,activeSideBySideRightSectionRef:vt,connectedLines:Cn,setConnectedLines:wn,cachedConnectedPositions:jn,calculateLinesRef:Ln,resizeTimerRef:Nn,scrollLock:ct,scrollSyncLocked:_n,handleResizeRef:Mn,activeProposed:Ai,existingRule:Ti,analysisData:Tt,pendingScrollTargetRef:Qn,pendingScrollCallbackRef:Zn,resolvedComparisonConfig:mi,getFieldData:lo}),fo=vo.lines,po=vo.setLines,go=vo.overallConnector,ho=vo.setOverallConnector,mo=vo.svgDimensions,So=vo.handleColumnScroll;c(function(){ai.anchorEl&&requestAnimationFrame(function(){requestAnimationFrame(function(){var e;null===(e=Ln.current)||void 0===e||e.call(Ln)})})},[ai.anchorEl,_n]);var xo=s(function(){ht(),In(!1),yt({}),wt({}),mt(),bn(new Set),wn([]),jn.current=[],si(),gi(),hi(),requestAnimationFrame(function(){Ln.current&&Ln.current()})},[yt,wt,mt,si,gi,hi]);c(function(){it||0!==Rn.size||In(!1)},[it,Rn]);var Ro=a(function(){return Object.values(bt).some(Boolean)||Object.values(Ct).some(Boolean)},[bt,Ct]),bo=u(null),yo=u(0),Co=u(0),wo=u(0),Bo=$({timerRef:bo,ruleComponentRef:Gn,scrollContainerRef:Wn,containerRef:Fn,maintainRelativeOrder:un,proposedSections:Di,existingSections:ki,isSideBySideRef:dt,activeSideBySideSectionRef:ft,activeSideBySideRightSectionRef:vt,sectionRowRefs:Ui,sectionRightRowRefs:Ji,sectionLeftRefs:Wi,sectionRightRefs:Gi,subSectionLeftRefs:Xi,subSectionRightRefs:$i,lhsBadgeRefs:Ki,rhsBadgeRefs:Yi,leftContainerRef:Un,rightContainerRef:Kn,calculateLinesRef:Ln,handleResizeRef:Mn,setIsResizing:lt,setIsArrowVisible:ot,sideBySideCacheRef:st,cachedConnectedPositions:jn}).handleResize;c(function(){Mn.current=Bo},[Bo,Mn]),c(function(){var e=function(e,n,i,t,o){n.current=e.getBoundingClientRect().width;var r=new ResizeObserver(function(e){null!==i.current&&cancelAnimationFrame(i.current),i.current=requestAnimationFrame(function(){var r,l,u;i.current=null;var a=e[e.length-1];if(a){var c=null!==(u=null===(l=null===(r=a.borderBoxSize)||void 0===r?void 0:r[0])||void 0===l?void 0:l.inlineSize)&&void 0!==u?u:a.contentRect.width;Math.abs(c-n.current)<1?o():(n.current=c,t())}})});return r.observe(e),r},n={current:null},i={current:null},t={current:null},o=[],r=[n,i,t];return Gn.current&&o.push(e(Gn.current,yo,n,function(){return Mn.current()},function(){})),Wn.current&&o.push(e(Wn.current,Co,i,function(){return Mn.current()},function(){return Ln.current()})),Fn.current&&o.push(e(Fn.current,wo,t,function(){return Mn.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)})}},[]),c(function(){dt.current=it},[it]),c(function(){ft.current=at},[at]);var _o=s(function(){var e,n=ti.sectionIdx,i=ti.isOrphan;if(si(),null!=n){var t="left";ti.anchorEl&&(null===(e=Kn.current)||void 0===e?void 0:e.contains(ti.anchorEl))&&(t="right"),It(n),St(n,i,{sourceSide:t})}},[St,ti.isOrphan,ti.sectionIdx,ti.anchorEl,si]),Io=s(function(){si(),mt(),bn(new Set),wn([]),jn.current=[]},[si,mt]),Eo=null!==ti.sectionIdx&&Rn.has(ti.sectionIdx),Fo=q({proposedSections:Di,existingSections:ki,parentDeviationRecord:Pi,expandedSections:bt,maintainRelativeOrder:!!un,scrollContainerRef:Wn,leftContainerRef:Un,rightContainerRef:Kn,lhsBadgeRefs:Ki,rhsBadgeRefs:Yi}),Ao=Fo.showDeviationNavigation,To=Fo.showOpenNodeRef,Do=Fo.adjustScrollForPopup,ko=s(function(e,n,i,t,o){var r,l="string"==typeof t?x(t).trim():x(null==t?void 0:t.deviation_summary).trim(),u=e.currentTarget;gi();var a="left";(null===(r=Kn.current)||void 0===r?void 0:r.contains(u))&&(a="right");var c=function(){var e,i,t,o;if("string"==typeof n&&n.includes(C)){var r=n.split(C),l="".concat(r[0]).concat(C).concat(r[1]);return"right"===a?null===(e=Yi.current[l])||void 0===e?void 0:e.current:null===(i=Ki.current[l])||void 0===i?void 0:i.current}return"right"===a?null===(t=Yi.current[n])||void 0===t?void 0:t.current:null===(o=Ki.current[n])||void 0===o?void 0:o.current};if(i)return mt(),bn(new Set),wn([]),jn.current=[],void(l&&(It(n),requestAnimationFrame(function(){var e=c()||u;e&&(e.getBoundingClientRect().top>.8*window.innerHeight&&e.scrollIntoView({behavior:"smooth",block:"center"}));ci({open:!0,anchorEl:e,summary:t,displayImpact:o})})));It(n),l?setTimeout(function(){St(n,i,{toggleIfSame:!1,sourceSide:a,onReady:function(){var e,n,i,r=c()||u;if(r){var l=r.getBoundingClientRect();if(l.top>.8*window.innerHeight||l.top<100){var a=l.top-window.innerHeight/2;un?(null===(e=Un.current)||void 0===e||e.scrollBy({top:a,behavior:"smooth"}),null===(n=Kn.current)||void 0===n||n.scrollBy({top:a,behavior:"smooth"})):null===(i=Wn.current)||void 0===i||i.scrollBy({top:a,behavior:"smooth"})}}ci({open:!0,anchorEl:r,summary:t,displayImpact:o})}})},350):setTimeout(function(){St(n,i,{toggleIfSame:!1,sourceSide:a})},350)},[St,gi,ci,mt,It]),Oo=a(function(){var e;if(!Ue)return null;var n=null===(e=null==Ue?void 0:Ue.id)||void 0===e?void 0:e.split(":")[0];for(var i in Pi){if((Pi[i]||[]).some(function(e){return e.id===n}))return i}return null},[Ue,Pi]),Po=u({id:null,triggerMs:null}),jo=u(null);c(function(){if(null==Ue?void 0:Ue.id){var o=Number(Ue.trigger),r=Po.current;if((null==r?void 0:r.id)!==Ue.id||(null==r?void 0:r.triggerMs)!==o){if(!(Ue.id.includes(":")&&/:\d+$/.test(Ue.id)))return Po.current={id:Ue.id,triggerMs:o},void to(Ue.id);var l=Ue.id.split(":"),u=l[0],a=l[1],c=null!=a?a:"0",s="".concat(Ue.id,":").concat(o);jo.current!==s&&(si(),gi(),mt(),bn(new Set),wn([]),jn.current=[],jo.current=s);var d=!1,v=0,f=null,p=null,g=!1,h=function(e,n){for(var i=function(e,t){if(!e)return null;if(n.includes(e.id)||n.includes(e.nodeId)||n.includes(e.contentId))return t;if(!Array.isArray(e.subsections))return null;for(var o=0;o<e.subsections.length;o++){var r=i(e.subsections[o],"".concat(t,"-").concat(o));if(r)return r}return null},t=0;t<e.length;t++){var o=i(e[t],String(t));if(o)return o}return null},m=function(){var r,l,a;if(!d){var s=function(){Po.current={id:Ue.id,triggerMs:o}},S=null,x=null;for(var R in Pi){var b=Pi[R].find(function(e){var n;return e.id===u||e.nodeId===u||e.contentId===u||(null===(n=e.evaluationResult)||void 0===n?void 0:n.nodeId)===u});if(b){S=R,x=b;break}}if(x&&S){var y=Array.from(new Set([u,x.id,x.nodeId,x.contentId,null===(r=x.evaluationResult)||void 0===r?void 0:r.nodeId].filter(Boolean))),w=Di.findIndex(function(e){return e.id===S}),B=ki.findIndex(function(e){return e.id===S}),E=-1===w&&-1!==B,F=h(Di,y),A=h(ki,y);if(F&&!A&&!E){var T=F.split("-"),D=Number(T[0]);if(un){var k=null===(a=null===(l=Di[D])||void 0===l?void 0:l.refIndexes)||void 0===a?void 0:a[0],O=ki.findIndex(function(e){return e.selfIndex===k});-1!==O&&(D=O)}A=n([D],T.slice(1),!0).join("-")}if(F||A){var P=F?Number(F.split("-")[0]):w,j=A?Number(A.split("-")[0]):B,L=j>=0?j:A?Number(A.split("-")[0]):-1,N=Di[P],M=ki[L],H=N&&!N.title&&!N.content,z=M&&!M.title&&!M.content,q=E||(!F&&!!A||H&&!z);if(q){if(!(un?!!Yo.current["right-".concat(j)]:!!Yo.current[String(j)])&&j>=0)return _t(j,"right"),void(f=setTimeout(m,200))}else if(!(un?!!Yo.current["left-".concat(P)]:!!Yo.current[String(P)])&&P>=0)return _t(P,"left"),void(f=setTimeout(m,200));var V=F||"",W=A||"",G=y.map(function(e){return"".concat(e).concat(C).concat(c)}),K=G[0],Y=function(){for(var e,n,i=0,t=G;i<t.length;i++){var o=t[i],r=(null===(e=Ki.current[o])||void 0===e?void 0:e.current)||null,l=(null===(n=Yi.current[o])||void 0===n?void 0:n.current)||null;if(r||l)return{refId:o,left:r,right:l}}return{refId:K,left:null,right:null}},J=function(e){return"".concat(e).concat(C).concat(V).concat(C).concat(W)};if(!g){It(J(K)),g=!0,v=0;var X=function(){var e=Y(),n=e.left,i=e.right;return q||!n&&!!i?i:n};return null==p||p(),void(f=setTimeout(function(){var e,n,i,t,o,r,l,u;d||(e=X,n=function(){d||(p=null,m())},t=0,o=null,r=null,l=performance.now(),u=function(){if(!d)if(performance.now()-l>3e3)n();else{var a=e();if(a&&0!==a.getBoundingClientRect().height){var c=a.getBoundingClientRect(),s=c.top,v=c.height,f=null!==o&&Math.abs(s-o)<.5,p=null!==r&&Math.abs(v-r)<.5;if(f&&p){if(++t>=5)return void n()}else t=0;o=s,r=v,i=requestAnimationFrame(u)}else i=requestAnimationFrame(u)}},i=requestAnimationFrame(u),p=function(){return cancelAnimationFrame(i)})},300))}var $=Y(),U=$.refId,Q=$.left,Z=$.right,ee=J(U);if(Q||Z){var ne=q||!Q&&!!Z,ie=ne?Z:Q,te=un?ne?Kn.current:Un.current:Wn.current;if(ie&&te){var oe=ie.getBoundingClientRect();if(0!==oe.height){var re=te.getBoundingClientRect(),le=oe.top-re.top+te.scrollTop-re.height/2+oe.height/2,ue=(null==F?void 0:F.includes("-"))||(null==A?void 0:A.includes("-")),ae=function(){return i(void 0,void 0,void 0,function(){var n,i,o,r,l,u,a,v,f,p;return t(this,function(t){switch(t.label){case 0:return d?[2]:(s(),n=ie instanceof Element?window.getComputedStyle(ie).color:"",[Q,Z].forEach(function(e){e&&(e.style.transition="box-shadow 300ms ease-in-out",e.style.boxShadow="0 0 10px ".concat(n))}),setTimeout(function(){[Q,Z].forEach(function(e){e&&(e.style.boxShadow="")})},2e3),i=(null===(a=null===(u=x.evaluationResult)||void 0===u?void 0:u.deviations)||void 0===a?void 0:a[c])||x,o=(null===(v=x.evaluationResult)||void 0===v?void 0:v.evaluation_outputs)||x.evaluation_outputs,!!Q&&!!Z?(l=function(e,n){return Promise.race([e,new Promise(function(e){return setTimeout(e,n)})])},un?[4,Promise.all([Un.current?l(I(Un.current),600):Promise.resolve(),Kn.current?l(I(Kn.current),600):Promise.resolve()])]:[3,2]):(r=ne?(null===(f=Yi.current[ue?U:j])||void 0===f?void 0:f.current)||Z:(null===(p=Ki.current[ue?U:P])||void 0===p?void 0:p.current)||Q,Do(r,function(){ci({open:!0,anchorEl:r,displayImpact:Ue.displayImpact,summary:e(e({},i),{evaluation_outputs:o})})},{skipScroll:!0}),null==Qe||Qe(),[2]));case 1:t.sent(),t.label=2;case 2:return xt.current(ee,!1,{toggleIfSame:!1,sourceSide:E?"right":"left",onReady:function(){var n,t,o,r;s();var l=ne?(null===(n=Yi.current[U])||void 0===n?void 0:n.current)||Z:(null===(t=Ki.current[U])||void 0===t?void 0:t.current)||Q,u=(null===(o=Ki.current[U])||void 0===o?void 0:o.current)||Q,a=(null===(r=Yi.current[U])||void 0===r?void 0:r.current)||Z;u&&(u.style.scrollMarginTop="150px",u.scrollIntoView({behavior:"smooth",block:"start"})),a&&(a.style.scrollMarginTop="150px",a.scrollIntoView({behavior:"smooth",block:"start"})),ci({open:!0,anchorEl:l,displayImpact:Ue.displayImpact,summary:e({},i)}),null==Qe||Qe()}}),[2]}})})};Math.abs(te.scrollTop-le)<=2?ae():_(te,le,ae)}else++v<30&&(f=setTimeout(m,100))}else++v<30&&(f=setTimeout(m,100))}else++v<30&&(f=setTimeout(m,100))}else++v<30&&(f=setTimeout(m,100))}else++v<30&&(f=setTimeout(m,100))}};return f=setTimeout(m,100),function(){d=!0,f&&clearTimeout(f),null==p||p()}}}},[null==Ue?void 0:Ue.id,null==Ue?void 0:Ue.trigger,null==Ue?void 0:Ue.displayImpact,Pi,Di,ki,un,ci,to]),c(function(){var n,i,t;if(ai.open){var o=ai.anchorEl;if(o&&!o.isConnected){var r=function(e){for(var n,i=0,t=Object.entries(e);i<t.length;i++){var r=t[i],l=r[0];if((null===(n=r[1].current)||void 0===n?void 0:n.textContent)===o.textContent)return l}return null},l=(null===(n=o.dataset)||void 0===n?void 0:n.deviationRefId)||r(Ki.current)||r(Yi.current);if(l){var u=(null===(i=Yi.current[l])||void 0===i?void 0:i.current)||(null===(t=Ki.current[l])||void 0===t?void 0:t.current);u&&u.isConnected&&ci(function(n){return e(e({},n),{anchorEl:u})})}}}},[ai.open,ai.anchorEl,_n,Rn,bt]);var Lo=ni.open,No=ni.sectionIdx,Mo=ni.isOrphan,Ho=ni.badgeStyle,zo=ni.anchorEl,qo=ni.sectionAnchorEl;c(function(){var n;if(Ke.isStreamingEnabled&&Lo&&null!=No&&No!==Ot){var i="string"==typeof No?No.split(C)[0]:null,t=function(e,n){var i;if(!e||!Array.isArray(e))return null;for(var o=0,r=e;o<r.length;o++){var l=r[o];if(l.id===n)return l;if(null===(i=l.subsections)||void 0===i?void 0:i.length){var u=t(l.subsections,n);if(u)return u}}return null},o=i&&"string"==typeof i?t(Di,i):null,r=i&&"string"==typeof i?t(ki,i):null,l="number"==typeof No?Di[No]||null:o||i&&((null===(n=null==Me?void 0:Me.nodes)||void 0===n?void 0:n[i])||(null==Me?void 0:Me[i]))||null,u="number"==typeof No?ki[No]||null:r,a=Zt(zo,l,u,No,Mo,Ho);ii(function(n){return n.open?x(n.cognitiveData)===x(a.cognitiveData)&&x(n.deviationData)===x(a.deviationData)&&n.sectionTitle===a.sectionTitle&&n.refSectionTitle===a.refSectionTitle?n:e(e(e({},n),a),{open:!0,anchorEl:n.anchorEl,sectionAnchorEl:n.sectionAnchorEl}):n})}},[Lo,No,Mo,Ho,zo,qo,Di,ki,Zt]);var Vo=s(function(e){var n=e.section,i=e.keyPath,t=e.depth,r=void 0===t?0:t,l=e.columnKey,u=void 0===l?"left":l,a=e.parentNodeId,c=void 0===a?"":a,s=e.sectionOffset,d=e.rhsOrphanVisualIndexes;return o(W,{section:n,keyPath:i,depth:r,columnKey:u,parentNodeId:c,sectionOffset:s,rhsOrphanVisualIndexes:d})},[]),Wo=a(function(){return Di.map(function(e,n){var i,t=!(null==e?void 0:e.title)&&!(null==e?void 0:e.content),r=!(null==e?void 0:e.refIndexes)||0===e.refIndexes.length;return t&&r&&un?null:o(G,{section:e,idx:n},null!==(i=null==e?void 0:e.id)&&void 0!==i?i:"left-row-".concat(n))})},[Di]),Go=a(function(){return ki.map(function(e,n){var i,t=!(null==e?void 0:e.title)&&!(null==e?void 0:e.content),r=!(null==e?void 0:e.refIndexes)||0===e.refIndexes.length;return t&&r&&un?null:o(K,{section:e,idx:n},null!==(i=null==e?void 0:e.id)&&void 0!==i?i:"right-row-".concat(n))})},[ki]),Ko=u(eo);c(function(){Ko.current=eo},[eo]);var Yo=u(bt);c(function(){Yo.current=bt},[bt]);var Jo=u(ko);c(function(){Jo.current=ko},[ko]);var Xo=u(Io);c(function(){Xo.current=Io},[Io]);var $o=u(_t);c(function(){$o.current=_t},[_t]);var Uo=u(Bt);c(function(){Uo.current=Bt},[Bt]);var Qo=u(Vo);c(function(){Qo.current=Vo},[Vo]);var Zo=u(mt);c(function(){Zo.current=mt},[mt]);var er=a(function(){return{isGuidelineMode:Fi,maintainRelativeOrder:!!un,showDeviationBadges:dn,isProposingFix:en,proposingFixNodeId:nn,isRedlineFlow:tn,isSideBySide:it,activeSideBySideSection:at,scrollSyncLocked:_n,toggleScrollSyncLocked:Ft,summaryPopupAnchorEl:ai.anchorEl,connectedSections:Rn,proposedSections:Di,existingSections:ki,deviationNumberRegistry:ji,deviationParentRegistry:Li,treeData:Me,displayConfig:Ke,resolvedMarkdownStyles:Vn,unifiedNumbering:At,expandedSections:bt,expandedSubSections:Ct,setExpandedSubSections:wt,getSectionCompareStyle:ao,getSubSectionCompareStyle:co,getBadgeRef:et,getSectionRowRef:Qi,getSubSectionRef:Zi,sectionLeftRefs:Wi,sectionRightRefs:Gi,sectionRowRefs:Ui,sectionRightRowRefs:Ji,subSectionLeftRefs:Xi,subSectionRightRefs:$i,lhsBadgeRefs:Ki,rhsBadgeRefs:Yi,openMoreFunctionsPopup:zt,handleOpenSummaryPopup:qt,openSummaryPopup:qt,handleCloseSummaryPopup:Vt,toggleSection:Wt,handleSubSectionToggle:Gt,renderSubSectionAccordion:Kt,resetSideBySide:Yt,setConnectedSections:bn,setConnectedLines:wn,cachedConnectedPositions:jn,showDeviationNavigation:Ao,showOpenNodeRef:To,deviationNodeIdToView:null==Ue?void 0:Ue.id,deviationTargetParentId:Oo,guidelinesData:rn}},[Fi,un,dn,en,nn,tn,it,at,_n,Ft,ai.anchorEl,Rn,Di,ki,ji,Ke,Vn,At,bt,Ct,wt,ao,co,et,Qi,Zi,Ao,To,Ue,Oo,rn]);return o(J,e({value:er},{children:r(d,e({ref:Gn,sx:{display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif',overflow:"visible",position:"relative"}},{children:[fn&&o(d,e({sx:{position:"absolute",inset:0,bgcolor:"rgba(255, 255, 255, 0.6)",backdropFilter:"blur(10px)",zIndex:9999,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"8px"}},{children:o(j,{})})),ai.open&&o(Y,{open:ai.open,anchorEl:ai.anchorEl,containerEl:ro.current,clipTopEl:An.current,scrollContainerEl:Wn.current,onClose:Io,summary:ai.summary,displayImpact:ai.displayImpact,isScrollLocked:_n}),o(P,{open:ti.open,anchorEl:ti.anchorEl,maintainRelativeOrder:!!un,sectionTitle:ti.sectionTitle,referenceSectionTitle:ti.refSectionTitle,onClose:hi,onOpenCognitiveCompare:fi,onOpenSideBySide:_o,onConnect:no,isConnected:Eo,isOrphan:!Fi&&!!ti.isOrphan,isGuidelineMode:Fi,hasGuidelineMatches:ti.hasGuidelineMatches}),ni.open&&o(O,{open:ni.open,popupRef:vi,position:ri,popupConfig:Je,onClose:function(){li(null),ii(function(n){return e(e({},n),{open:!1})}),di(null)},markdownStyles:Ve,sectionTitle:wi,referenceSectionTitle:_i,cognitiveData:ni.cognitiveData,anchorEl:ni.anchorEl,sectionAnchorEl:ni.sectionAnchorEl,scrollContainerEl:Wn.current,badgeStyle:ni.badgeStyle,docData:ni.docData,deviationData:ni.deviationData,isLoading:ni.isLoading}),o(v,e({open:!!hn,autoHideDuration:8e3,onClose:function(){return mn(null)},anchorOrigin:{vertical:"top",horizontal:"center"}},{children:o(f,e({onClose:function(){return mn(null)},severity:"error",sx:{width:"100%",whiteSpace:"pre-line"}},{children:hn}))})),o(V,{componentHeaderText:Ne,displayConfig:Ke,maintainRelativeOrder:un,onCollapseAll:xo,showCollapseAll:Ro,onToggleView:function(e){pn(!0),setTimeout(function(){an(!e),null==Ye||Ye(!e),In(!1),mt(),si(),bn(new Set),wn([]),jn.current=[],requestAnimationFrame(function(){requestAnimationFrame(function(){setTimeout(function(){pn(!1)},600)})})},50)}}),o(d,e({ref:Wn,onScroll:So,sx:{flex:1,minHeight:0,pt:1.5,pb:1,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",overflowY:un?"visible":"auto",borderTop:Dt&&kt?"none":"1.5px solid #EEF0F4"}},{children:o(d,e({sx:e({display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"},un?{flex:1}:{})},{children:r(d,e({ref:Fn,sx:e({display:"grid",gridTemplateColumns:"minmax(0, 1fr) 180px minmax(0, 1fr)",gap:"80px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0},un?{flex:1,overflow:"visible"}:{})},{children:[o(Z,{svgContainerRef:En,svgDimensions:mo,isResizing:rt,overallConnector:go,rootDeviationStyle:Lt,lines:fo,isSideBySide:it,activeSideBySideSection:at,isArrowVisible:tt,maintainRelativeOrder:un,proposedSections:Di,existingSections:ki,cognitivePopup:ni,activeBadgeId:ui,closeCognitivePopup:gi,setActiveBadgeId:di,openCognitivePopupFromState:pi,buildSectionPopupState:Zt,connectedLines:Cn,pathRefs:Pn}),r(d,e({sx:e({border:"1px solid #E7E7E9",borderRadius:"8px",bgcolor:"#FFFFFF",display:"flex",flexDirection:"column",position:"relative",zIndex:2,filter:"drop-shadow(0px 2px 4px #F2F2F2)"},un?{flex:1,overflow:"visible"}:{})},{children:[o(d,e({ref:An,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:o(p,e({title:yi,placement:"top"},{children:o(g,e({sx:{fontSize:"16px",fontWeight:500,color:"#19213D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0,textAlign:"center",display:"block"}},{children:yi}))}))})),r(d,e({ref:Un,onScroll:So,sx:e({p:"12px",display:"flex",flexDirection:"column"},un?{maxHeight:"calc(100vh - 250px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,mr:"-180px",pr:"192px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[o("div",{ref:Xn,style:{width:"100%",height:"0px",flexShrink:0}}),Mi&&Wo,o("div",{ref:$n,style:{width:"100%",height:"0px",flexShrink:0}})]}))]})),o(d,e({ref:ro,sx:{width:"180px",display:"flex",flexDirection:"column",alignItems:"center",pt:"15px",gap:0,zIndex:20,pointerEvents:"none"}},{children:o(d,e({sx:{display:"flex",justifyContent:"center",alignItems:"center",mt:0}},{children:r(d,e({onClick:function(n){n.stopPropagation(),ni.open&&ui===Ot?gi():(di(Ot),pi(Zt(n.currentTarget,{title:"",content:"",evaluationResult:Pt,cognitiveData:{section_id:"",decisioning:[],gap:[],relevance_score:0,isMissingRationale:!0}},null,Ot,!0,e(e({},Lt),{label:""}))))},sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:"5px",top:"-8px",borderRadius:"20px",bgcolor:Lt.badgeBg,color:Lt.badgeText,border:"1px solid ".concat(Lt.badgeBorder),fontSize:"12px",fontWeight:600,whiteSpace:"nowrap",position:"relative",zIndex:1,pointerEvents:"auto",cursor:"pointer"}},{children:[null!=jt?jt:o(L,{}),o(d,e({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:o(m,{})})),o(h,{size:11,style:{transform:ni.open&&ui===Ot?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))})),r(d,e({sx:e({border:"1px solid #E3E6EA",borderRadius:"8px",bgcolor:"#FFFFFF",boxShadow:"0px 1px 4px #F7F4FE",position:"relative",zIndex:2,display:"flex",flexDirection:"column",minWidth:0},un?{flex:1,overflow:"visible",minHeight:0}:{})},{children:[ut&&o(S,{sections:11}),o(d,e({ref:Tn,sx:e({p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E3E6EA",borderRadius:"8px 8px 0 0",display:"flex",alignItems:"center"},un?e({maxHeight:"calc(100vh - 250px)",overflowY:"auto",overflowX:"hidden",minHeight:0},Fi?{"&::-webkit-scrollbar":{width:"6px",display:"block"},"&::-webkit-scrollbar-track":{background:"transparent"},"&::-webkit-scrollbar-thumb":{background:"#CBD5E1",borderRadius:"10px"},"&::-webkit-scrollbar-thumb:hover":{background:"#94A3B8"},scrollbarWidth:"thin",scrollbarColor:"#CBD5E1 transparent"}:{"&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}):{})},{children:o(p,e({title:Ii,placement:"top"},{children:o(g,e({sx:{fontSize:"16px",fontWeight:500,color:"#5928ED",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0,textAlign:"center",display:"block"}},{children:Ii}))}))})),r(d,e({ref:Kn,onScroll:So,sx:e({p:Fi?"0px":"12px",display:"flex",flexDirection:"column"},un?e(e({maxHeight:"calc(100vh - 250px)"},!Fi&&{flex:1}),{overflowY:"auto",overflowX:"hidden",minHeight:0,ml:"-150px",pl:"165px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}):{})},{children:[o("div",{ref:Yn,style:{width:"100%",height:"0px",flexShrink:0}}),Fi?o(ee,{guidelinesData:rn,deviationData:$e,connectedSections:Rn,proposedSections:Di}):Mi&&Go,o("div",{ref:Jn,style:{width:"100%",height:"0px",flexShrink:0}})]}))]}))]}))}))}))]}))}))};export{ne as default};
|
|
1
|
+
import{__assign as e,__spreadArray as n,__awaiter as i,__generator as t}from"tslib";import{jsx as o,jsxs as r}from"react/jsx-runtime";import{useState as l,useRef as u,useMemo as a,useEffect as c,useCallback as s}from"react";import{Box as d,Snackbar as v,Alert as f,Tooltip as p,Typography as g}from"@mui/material";import{ChevronDown as h}from"lucide-react";import{ButtonCognitiveIcon as m}from"../../assests/svg/ButtonCognitiveIcon.js";import S from"./OverlayComponent.js";import{safeStringify as x,extractDeviationScore as R,generateColorPalette as b,findKeyPathByNodeId as y,DEVIATION_BADGE_SEPARATOR as C,hasMeaningfulRedlineTags as w,scrollAndHighlightClause as B,scrollAndWait as _,waitForScrollIdle as I}from"./CognitiveComparehelpers.js";import{SHARED_MARKDOWN_STYLES as E,DEFAULT_FIELD_CONFIG as F,DEFAULT_COMPARISON_CONFIG as A}from"./CognitiveCompareConfig.js";export{SHARED_MARKDOWN_STYLES}from"./CognitiveCompareConfig.js";import{DEFAULT_DEVIAION_COLOR as T,EMPTY_SUMMARY_POPUP_STATE as D,DEFAULT_COMPONENT_HEADER_TEXT as k}from"./CognitiveCompareConstants.js";import O from"./CognitivePopup.js";import P from"./MoreFunctionsPopup.js";import j from"./LoaderComponent.js";import L from"./components/ThreeDotsLoader.js";import{useCognitiveTreeData as N}from"./hooks/useCompareData.js";import{useComparePopups as M}from"./hooks/useComparePopups.js";import{useSectionRefs as H}from"./hooks/useSectionRefs.js";import{useAccordionState as z}from"./hooks/useAccordionState.js";import{useDeviationNavigation as q}from"./hooks/useDeviationNavigation.js";import V from"./components/CompareHeader.js";import W from"./components/SubSectionAccordion.js";import G from"./components/LHSSectionRow.js";import K from"./components/RHSSectionRow.js";import Y from"./components/CognitiveSummaryPopup.js";import{CompareContextProvider as J}from"./CompareContext.js";import{useStyleHelpers as X}from"./hooks/useStyles.js";import{useResizeHandler as $}from"./hooks/useResizeHandler.js";import{useLinesCalculator as U}from"./hooks/useLinesCalculator.js";import{useSideBySide as Q}from"./hooks/useSideBySide.js";import Z from"./components/SvgConnectors.js";import ee from"./Guidelines/components/GuidelinePanel.js";var ne=function(ne){var ie,te,oe,re,le,ue,ae,ce,se,de,ve,fe,pe,ge,he,me,Se,xe,Re,be,ye,Ce,we,Be,_e,Ie,Ee,Fe,Ae,Te,De,ke,Oe,Pe,je,Le=ne.componentHeaderText,Ne=void 0===Le?k:Le,Me=ne.treeData,He=ne.comparisonConfig,ze=ne.leftColumnTitleText,qe=ne.rightColumnTitleText,Ve=ne.markdownStyles,We=ne.resetTrigger,Ge=ne.displayConfig,Ke=void 0===Ge?{isHeaderVisible:!0,isToggleVisible:!0,maintainRelativeOrder:!1,isLoading:!0,showDeviationBadges:!1,enableDeviationSchemaBackwardCompatibility:!1,displayEmailNotifier:!0,isStreamingEnabled:!1}:Ge,Ye=ne.onMaintainRelativeOrderChange,Je=ne.popupConfig,Xe=ne.deviationData,$e=void 0===Xe?{}:Xe,Ue=ne.deviationNodeIdToView,Qe=ne.resetDeviationNodeId,Ze=ne.isProposingFix,en=void 0!==Ze&&Ze,nn=ne.proposingFixNodeId,tn=ne.isRedlineFlow,on=ne.badgeStyleOverride,rn=ne.guidelinesData,ln=l(Ke.maintainRelativeOrder),un=ln[0],an=ln[1],cn=null!==(ie=null==Ke?void 0:Ke.expandLevels)&&void 0!==ie?ie:0,sn=!!(null==Ke?void 0:Ke.expandAllSections),dn=!!un||!!(null==Ke?void 0:Ke.showDeviationBadges),vn=l(!1),fn=vn[0],pn=vn[1],gn=l(null),hn=gn[0],mn=gn[1],Sn=l(null===(oe=null!==(te=null==Me?void 0:Me.newEvaluationResult)&&void 0!==te?te:null==Ke?void 0:Ke.enableDeviationSchemaBackwardCompatibility)||void 0===oe||oe)[0],xn=l(new Set),Rn=xn[0],bn=xn[1],yn=l([]),Cn=yn[0],wn=yn[1],Bn=l(!1),_n=Bn[0],In=Bn[1],En=u(null),Fn=u(null),An=u(null),Tn=u(null),Dn=u(null),kn=u(!1),On=u(null),Pn=u({}),jn=u([]),Ln=u(function(){}),Nn=u(null),Mn=u(function(){}),Hn=a(function(){return JSON.stringify($e||{})},[JSON.stringify($e)]),zn=a(function(){return $e||{}},[Hn]),qn=a(function(){return(null==Me?void 0:Me.cognitive_decisioning)||{}},[Me]),Vn=a(function(){return e(e({},E),Ve)},[Ve]),Wn=u(null),Gn=u(null),Kn=u(null),Yn=u(null),Jn=u(null),Xn=u(null),$n=u(null),Un=u(null),Qn=u(null),Zn=u(null),ei=M(Wn),ni=ei.cognitivePopup,ii=ei.setCognitivePopup,ti=ei.moreFunctions,oi=ei.setMoreFunctions,ri=ei.position,li=ei.setPosition,ui=ei.activeBadgeId,ai=ei.summaryPopup,ci=ei.setSummaryPopup,si=ei.closeSummaryPopup,di=ei.setActiveBadgeId,vi=ei.popupRef,fi=ei.handleOpenCognitiveCompare,pi=ei.openCognitivePopupFromState,gi=ei.closeCognitivePopup,hi=ei.closeMoreFunctionsPopup,mi=a(function(){var e,n,i,t,o,r,l;return{fields:null!==(e=null==He?void 0:He.fields)&&void 0!==e?e:F,thresholds:{high:null!==(i=null===(n=null==He?void 0:He.thresholds)||void 0===n?void 0:n.high)&&void 0!==i?i:A.thresholds.high,medium:null!==(o=null===(t=null==He?void 0:He.thresholds)||void 0===t?void 0:t.medium)&&void 0!==o?o:A.thresholds.medium,exact:null!==(l=null===(r=null==He?void 0:He.thresholds)||void 0===r?void 0:r.exact)&&void 0!==l?l:A.thresholds.exact}}},[He]),Si=l(null),xi=Si[0];Si[1];var Ri=null===(ue=null===(re=null==Me?void 0:Me.documents)||void 0===re?void 0:re[null===(le=null==Me?void 0:Me.input_index_map)||void 0===le?void 0:le[0]])||void 0===ue?void 0:ue.title,bi=null===(se=null===(ae=null==Me?void 0:Me.documents)||void 0===ae?void 0:ae[null===(ce=null==Me?void 0:Me.input_index_map)||void 0===ce?void 0:ce[1]])||void 0===se?void 0:se.title,yi=x(ze||Ri||"Uploaded Contract"),Ci=null===(pe=null===(fe=null===(de=null==Me?void 0:Me.documents)||void 0===de?void 0:de[null===(ve=null==Me?void 0:Me.input_index_map)||void 0===ve?void 0:ve[0]])||void 0===fe?void 0:fe.metadata)||void 0===pe?void 0:pe.file_name,wi=x(Ci),Bi=null===(Se=null===(me=null===(ge=null==Me?void 0:Me.documents)||void 0===ge?void 0:ge[null===(he=null==Me?void 0:Me.input_index_map)||void 0===he?void 0:he[1]])||void 0===me?void 0:me.metadata)||void 0===Se?void 0:Se.file_name,_i=x(Bi),Ii=x(qe||bi||"Reference Template"),Ei=N(Me,un,zn,mi,Sn,rn),Fi=Ei.isGuidelineMode,Ai=Ei.activeProposed,Ti=Ei.existingRule,Di=Ei.proposedSections,ki=Ei.existingSections,Oi=Ei.visibleFields,Pi=Ei.parentDeviationRecord,ji=Ei.deviationNumberRegistry,Li=Ei.deviationParentRegistry,Ni=Ei.parseError;c(function(){Ni&&mn("Failed to load comparison: ".concat(Ni))},[Ni]);var Mi=Di.length>0||ki.length>0,Hi=a(function(){if(!tn)return"off";var e=0,n=0,i=function(t){Array.isArray(t)&&t.forEach(function(t){var o,r=(null==t?void 0:t.content)||"";w(r)&&(e+=1,n+=String(r).length),(null===(o=null==t?void 0:t.subsections)||void 0===o?void 0:o.length)&&i(t.subsections)})};return i(Di),i(ki),"".concat(e,":").concat(n)},[tn,Di,ki]);c(function(){if(Di.length||ki.length)if(sn){var e={},n={},i=function(i,t){i.forEach(function(i,o){var r,l=un?"".concat(t,"-").concat(o):String(o);e[l]=!0;var u=function(e,i){null==e||e.forEach(function(e,t){var o,r="".concat(i,"-").concat(t);n[r]=!0,(null===(o=e.subsections)||void 0===o?void 0:o.length)&&u(e.subsections,r)})};(null===(r=i.subsections)||void 0===r?void 0:r.length)&&u(i.subsections,String(o))})};i(Di,"left"),i(ki,"right"),yt(e),wt(n)}else if(cn>0){var t={},o={},r=function(e,n,i){e.forEach(function(e,r){var l;if(i>=1){var u=un?"".concat(n,"-").concat(r):String(r);t[u]=!0}var a=function(e,n,t){t>i||null==e||e.forEach(function(e,i){var r,l="".concat(n,"-").concat(i);o[l]=!0,(null===(r=e.subsections)||void 0===r?void 0:r.length)&&a(e.subsections,l,t+1)})};(null===(l=e.subsections)||void 0===l?void 0:l.length)&&i>=2&&a(e.subsections,String(r),2)})};r(Di,"left",cn),r(ki,"right",cn),yt(t),wt(o)}},[sn,cn,Di,ki,un]);var zi=H(Oi.map(function(e){return e.key}),Math.max(Di.length,ki.length)),qi=zi.leftRefs,Vi=zi.rightRefs,Wi=zi.sectionLeftRefs,Gi=zi.sectionRightRefs,Ki=zi.lhsBadgeRefs,Yi=zi.rhsBadgeRefs,Ji=zi.sectionRightRowRefs,Xi=zi.subSectionLeftRefs,$i=zi.subSectionRightRefs,Ui=zi.sectionRowRefs,Qi=zi.getSectionRowRef,Zi=zi.getSubSectionRef,et=zi.getBadgeRef,nt=Q({isGuidelineMode:Fi,maintainRelativeOrder:un,proposedSections:Di,existingSections:ki,leftContainerRef:Un,rightContainerRef:Kn,scrollContainerRef:Wn,sectionLeftRefs:Wi,sectionRightRefs:Gi,subSectionLeftRefs:Xi,subSectionRightRefs:$i,lhsBadgeRefs:Ki,rhsBadgeRefs:Yi,sectionRowRefs:Ui,sectionRightRowRefs:Ji,rhsTopSpacerRef:Yn,rhsBottomSpacerRef:Jn,lhsTopSpacerRef:Xn,lhsBottomSpacerRef:$n,calculateLinesRef:Ln,setConnectedSections:bn,setConnectedLines:wn,cachedConnectedPositions:jn,closeMoreFunctionsPopup:hi,setErrorToast:mn,moreFunctions:ti,closeSummaryPopup:si}),it=nt.isSideBySide,tt=nt.isArrowVisible,ot=nt.setIsArrowVisible,rt=nt.isResizing,lt=nt.setIsResizing,ut=nt.isSideBySideLoading,at=nt.activeSideBySideSection,ct=nt.scrollLock,st=nt.sideBySideCacheRef,dt=nt.isSideBySideRef,vt=nt.activeSideBySideRightSectionRef,ft=nt.activeSideBySideSectionRef,pt=nt.sideBySideLineRef,gt=nt.highlightedClauseRefs,ht=nt.clearClauseHighlight,mt=nt.resetSideBySide,St=nt.activateSideBySide,xt=u(St);c(function(){xt.current=St},[St]);var Rt=z({maintainRelativeOrder:!!un,proposedSections:Di,existingSections:ki,activeSideBySideSection:at,connectedSections:Rn,resetSideBySide:mt,setConnectedSections:bn,setConnectedLines:wn,cachedConnectedPositions:jn,svgContainerRef:En,isAnimatingRef:kn,animationTimerRef:On,calculateLinesRef:Ln,sectionLeftRefs:Wi,sectionRightRefs:Gi,subSectionLeftRefs:Xi,subSectionRightRefs:$i}),bt=Rt.expandedSections,yt=Rt.setExpandedSections,Ct=Rt.expandedSubSections,wt=Rt.setExpandedSubSections,Bt=Rt.handleSubSectionToggle,_t=Rt.toggleSection,It=Rt.forceExpandCrossWiredSections,Et=function(){var e,n;if(null!=at){var i=null===(e=Wi.current[at])||void 0===e?void 0:e.current,t=null===(n=Gi.current[at])||void 0===n?void 0:n.current,o=Kn.current;if(i&&t&&o){var r=i.getBoundingClientRect(),l=t.getBoundingClientRect(),u=o.getBoundingClientRect(),a=r.top-u.top,c=l.top-u.top-a;o.scrollBy({top:c,behavior:"smooth"})}}},Ft=s(function(e){null==e||e.stopPropagation(),In(function(e){var n=!e;return n&&requestAnimationFrame(function(){Et()}),n})},[Et]);c(function(){tn&&"off"!==Hi&&"0:0"!==Hi&&(st.current=null,jn.current=[],requestAnimationFrame(function(){var e;null===(e=Ln.current)||void 0===e||e.call(Ln)}))},[tn,Hi]);var At=a(function(){var e=new Map,n=new Map,i=1;if(un)Di.forEach(function(n){!n.title&&!n.content||n.id&&e.set(n.id,i++)}),ki.forEach(function(t){if(t.id&&!(!t.title&&!t.content)){var o=Di.filter(function(e){var n;return null===(n=e.refIndexes)||void 0===n?void 0:n.includes(t.selfIndex)});if(o.length>0){var r=o.map(function(n){return e.get(n.id)}).filter(Boolean);n.set(t.id,r.join(", "))}else n.set(t.id,String(i++))}});else for(var t=Math.max(Di.length,ki.length),o=0;o<t;o++){var r=Di[o],l=ki[o];r?(e.set(r.id,i),l&&n.set(l.id,String(i)),i++):l&&n.set(l.id,String(i++))}return{leftNums:e,rightNums:n}},[Di,ki,un]),Tt=Ti.analysis,Dt=x(null===(Re=null===(xe=null==Tt?void 0:Tt.rule_difference_comparison)||void 0===xe?void 0:xe.summary)||void 0===Re?void 0:Re.overall_summary),kt=!!Dt.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),Ot=null!==(be=null==Me?void 0:Me.base_root_id)&&void 0!==be?be:"-1";null==Me||Me[Ot];var Pt=Sn?null!==(ke=null!==(Ae=$e&&(null===(Fe=null==$e?void 0:$e[Ot])||void 0===Fe?void 0:Fe.evaluation_result))&&void 0!==Ae?Ae:null===(De=null===(Te=null==Me?void 0:Me.nodes)||void 0===Te?void 0:Te[Ot])||void 0===De?void 0:De.evaluation_result)&&void 0!==ke?ke:null:null!==(Ee=null!==(we=$e&&(null===(Ce=null===(ye=null==$e?void 0:$e[Ot])||void 0===ye?void 0:ye.evaluation_result)||void 0===Ce?void 0:Ce[0]))&&void 0!==we?we:null===(Ie=null===(_e=null===(Be=null==Me?void 0:Me.nodes)||void 0===Be?void 0:Be[Ot])||void 0===_e?void 0:_e.evaluation_result)||void 0===Ie?void 0:Ie[0])&&void 0!==Ee?Ee:null,jt=R(Pt),Lt=b(null!==(je=null===(Pe=null===(Oe=null==Pt?void 0:Pt.evaluation_outputs)||void 0===Oe?void 0:Oe.metadata)||void 0===Pe?void 0:Pe.label_color)&&void 0!==je?je:T);if(on){var Nt=on(jt);Nt&&(Lt=e(e({},Lt),{badgeBg:Nt.bg,badgeText:Nt.text,badgeBorder:Nt.border}))}var Mt=u(mt);c(function(){Mt.current=mt},[mt]);var Ht=u(gi);c(function(){Ht.current=gi},[gi]);var zt=s(function(e,n,i,t,o,r){return Ko.current(e,n,i,t,o,r)},[]),qt=s(function(e,n,i,t,o){return Jo.current(e,n,i,t,o)},[]),Vt=s(function(){return Xo.current()},[]),Wt=s(function(e,n){return $o.current(e,n)},[]),Gt=s(function(e){return Uo.current(e)},[]),Kt=s(function(e){return Qo.current(e)},[]),Yt=s(function(){return Zo.current()},[]),Jt=s(function(){var e,n;ht(),null===(e=Mt.current)||void 0===e||e.call(Mt),In(!1),bn(new Set),wn([]),jn.current=[],po([]),ho(null),ci(D),null===(n=Ht.current)||void 0===n||n.call(Ht),requestAnimationFrame(function(){var e;null===(e=Ln.current)||void 0===e||e.call(Ln)})},[]),Xt=u(Jt);c(function(){Xt.current=Jt},[Jt]),c(function(){We&&Xt.current()},[We]);var $t=a(function(){return{documents:null==Me?void 0:Me.documents,input_index_map:null==Me?void 0:Me.input_index_map}},[JSON.stringify(null==Me?void 0:Me.documents),JSON.stringify(null==Me?void 0:Me.input_index_map)]),Ut=u(Me);c(function(){Ut.current=Me},[Me]);var Qt=u(qn);c(function(){Qt.current=qn},[qn]);var Zt=s(function(n,i,t,o,r,l,u){var a,c,s,d,v,f,p,g,h,m,S,R,b=x(null==i?void 0:i.id)||x(null==t?void 0:t.id)||"",y=(b?null===(a=Qt.current)||void 0===a?void 0:a[b]:null)||(null==i?void 0:i.cognitiveData)||(null==t?void 0:t.cognitiveData)||{section_id:b,decisioning:[],gap:[],relevance_score:0},w=null!==(s=null===(c=Ui.current[o])||void 0===c?void 0:c.current)&&void 0!==s?s:null,B=function(){var n,r,l=(null==i?void 0:i.evaluationResult)||(null==t?void 0:t.evaluationResult)||null,u=function(n){var i=function(e){if(!e||"object"!=typeof e)return null;var n=null==e?void 0:e.deviation_entries;if(n&&"object"==typeof n){var i=Object.keys(n).sort(function(e,n){return Number(e)-Number(n)})[0];if(i&&n[i])return n[i]}var t=Object.keys(e).filter(function(e){return/^\d+$/.test(e)}).sort(function(e,n){return Number(e)-Number(n)});if(t.length&&e[t[0]])return e[t[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 i?e(e({},n),{deviation_summary:(null==n?void 0:n.deviation_summary)||(null==i?void 0:i.deviation_summary),deviation_title:(null==n?void 0:n.deviation_title)||(null==i?void 0:i.deviation_title),deviation_impact:(null==n?void 0:n.deviation_impact)||(null==i?void 0:i.deviation_impact),deviation_explanation:(null==n?void 0:n.deviation_explanation)||(null==i?void 0:i.deviation_explanation),evaluation_outputs:(null==n?void 0:n.evaluation_outputs)||(null==i?void 0:i.evaluation_outputs),cognitive_decisioning:(null==n?void 0:n.cognitive_decisioning)||(null==i?void 0:i.cognitive_decisioning)}):n};if(!("string"==typeof o&&o.includes(C)))return u(l);var a=o.split(C)[1];if(!a)return l;var c=(null==i?void 0:i.evaluationResult)||(null==t?void 0:t.evaluationResult)||{},s=(null===(n=null==c?void 0:c.deviation_entries)||void 0===n?void 0:n[a])||(null===(r=null==c?void 0:c.deviations)||void 0===r?void 0:r[a])||null;return s?e(e(e({},c),s),{deviation_summary:(null==s?void 0:s.deviation_summary)||(null==c?void 0:c.deviation_summary),deviation_title:(null==s?void 0:s.deviation_title)||(null==c?void 0:c.deviation_title),deviation_impact:(null==s?void 0:s.deviation_impact)||(null==c?void 0:c.deviation_impact),deviation_explanation:(null==s?void 0:s.deviation_explanation)||(null==c?void 0:c.deviation_explanation),evaluation_outputs:(null==s?void 0:s.evaluation_outputs)||(null==c?void 0:c.evaluation_outputs),cognitive_decisioning:(null==s?void 0:s.cognitive_decisioning)||(null==c?void 0:c.cognitive_decisioning)}):u(l)}(),_=(null!==(f=null===(v=null===(d=null==B?void 0:B.cognitive_decisioning)||void 0===d?void 0:d.decisioning_factors)||void 0===v?void 0:v.length)&&void 0!==f?f:0)>0||(null!==(h=null===(g=null===(p=null==B?void 0:B.cognitive_decisioning)||void 0===p?void 0:p.gaps_in_decision)||void 0===g?void 0:g.length)&&void 0!==h?h:0)>0,I=null!==(m=null==Ke?void 0:Ke.isLoading)&&void 0!==m&&m,E=!0;if(Fi)if(B&&Object.keys(B).length>0){var F=Array.isArray(B)?B[0]:B,A=null===(R=null===(S=null==F?void 0:F.evaluation_outputs)||void 0===S?void 0:S.metadata)||void 0===R?void 0:R.is_orphan;!0!==A&&"true"!==A&&"Yes"!==A&&"yes"!==A||(E=!1)}else E=!1;return{isLoading:I&&!_,open:!0,sectionTitle:(null==i?void 0:i.title)?null==i?void 0:i.title:"No Counterpart",refSectionTitle:(null==t?void 0:t.title)?null==t?void 0:t.title:"No Counterpart",cognitiveData:y,anchorEl:n,sectionAnchorEl:w,badgeStyle:l||null,sectionIdx:o,docData:$t,deviationData:B,isOrphan:!!r,hasGuidelineMatches:E}},[$t,null==Ke?void 0:Ke.isLoading,Fi]),eo=s(function(e,n,i,t,o,r){var l;if(e.stopPropagation(),ti.open&&ti.sectionIdx===o)hi();else{var u=e.currentTarget,a="left";(null===(l=Kn.current)||void 0===l?void 0:l.contains(u))&&(a="right");ht(),dt.current&&mt(),bn(new Set),wn([]),jn.current=[],gi(),ai.open?Io():si(),requestAnimationFrame(function(){var e=function(){var e,n,i,t;if("string"==typeof o&&o.includes(C)){var r=o.split(C),l="".concat(r[0]).concat(C).concat(r[1]);return"right"===a?null===(e=Yi.current[l])||void 0===e?void 0:e.current:null===(n=Ki.current[l])||void 0===n?void 0:n.current}return"right"===a?null===(i=Yi.current[o])||void 0===i?void 0:i.current:null===(t=Ki.current[o])||void 0===t?void 0:t.current}()||u;oi(Zt(e,n,t,o,i,r))})}},[ti.open,ti.sectionIdx,hi,si,Zt]),no=s(function(){var e=ti.sectionIdx;ti.isOrphan,hi(),si(),null!==e&&(It(e),ht(),dt.current&&mt(),wn([]),jn.current=[],bn(function(n){return n.has(e)?new Set:new Set([e])}),setTimeout(function(){Ln.current&&Ln.current()},50))},[ti.sectionIdx,ti.isOrphan,hi,si,mt]),io=s(function(){var e=Dn.current;if(e){Dn.current=null;var n=Di.findIndex(function(n){return n.id===e}),i=ki.findIndex(function(n){return n.id===e}),t=-1===n?y(Di,e):null,o=-1===i?y(ki,e):null,r=-1!==n?n:t?Number(t.split("-")[0]):-1,l=-1!==i?i:o?Number(o.split("-")[0]):-1,u=function(e,n,i,t){var o,r,l,u;return-1!==e?null!==(r=null===(o=i.current[e])||void 0===o?void 0:o.current)&&void 0!==r?r:null:n&&null!==(u=null===(l=t.current[n])||void 0===l?void 0:l.current)&&void 0!==u?u:null},a=function(e,n,i){void 0===i&&(i=30);var t=0,o=function(){var r=e();r&&0!==r.getBoundingClientRect().height?(gt.current.add(r),B(r,n)):t++<i&&requestAnimationFrame(o)};requestAnimationFrame(o)};if(un)-1!==r&&Un.current&&a(function(){return u(n,t,Wi,Xi)},Un.current),-1!==l&&Kn.current&&a(function(){return u(i,o,Gi,$i)},Kn.current);else{var c=Wn.current;if(!c)return;a(function(){return-1!==r?u(n,t,Wi,Xi):u(i,o,Gi,$i)},c)}}},[Di,ki,un,Wi,Gi,Xi,$i,Un,Kn,Wn]),to=s(function(n){if(n){ht(),mt(),bn(new Set),wn([]),jn.current=[],si(),gi();var i=Di.findIndex(function(e){return e.id===n}),t=ki.findIndex(function(e){return e.id===n}),o=-1===i?y(Di,n):null,r=-1===t?y(ki,n):null;if(-1!==i||o||-1!==t||r){var l=-1!==i?i:o?Number(o.split("-")[0]):-1,u=-1!==t?t:r?Number(r.split("-")[0]):-1;Dn.current=n,yt(function(n){var i,t=e({},n),o=!1;-1!==l&&(t[i=un?"left-".concat(l):String(l)]||(t[i]=!0,o=!0));-1!==u&&(t[i=un?"right-".concat(u):String(u)]||(t[i]=!0,o=!0));return o?t:n}),wt(function(n){var i=e({},n),t=!1,l=function(e){for(var n=e.split("-"),o=n[0],r=1;r<n.length;r++)o+="-".concat(n[r]),i[o]||(i[o]=!0,t=!0)};return o&&l(o),r&&l(r),t?i:n}),setTimeout(function(){requestAnimationFrame(function(){Dn.current===n&&oo.current()})},50)}else console.warn('scrollToAndHighlightClause: nodeId "'.concat(n,'" not found'))}},[Di,ki,un,yt,wt,mt,si,gi]),oo=u(io);c(function(){oo.current=io},[io]);var ro=u(null);c(function(){if(xi){var e=mi.fields.find(function(e){return e.analysisKey===xi||e.key===xi});if(e){var n=qi.current[e.key]||Vi.current[e.key];(null==n?void 0:n.current)&&setTimeout(function(){return n.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[xi,mi.fields]);var lo=s(function(e){var n,i,t,o,r,l,u,a,c,s=null===(n=null==Tt?void 0:Tt.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===(t=null===(i=null==d?void 0:d.highlights)||void 0===i?void 0:i.ruleA_spans)||void 0===t?void 0:t.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===(a=d.highlights)||void 0===a?void 0:a.ruleA_spans)||[],highlightsB:(null===(c=d.highlights)||void 0===c?void 0:c.ruleB_spans)||[],hasContent:!!v}},[Tt]),uo=X({proposedSections:Di,existingSections:ki,maintainRelativeOrder:un,cognitiveMap:qn,deviationData:zn,treeData:Me,resolvedComparisonConfig:mi,badgeStyleOverride:on}),ao=uo.getSectionCompareStyle,co=uo.getSubSectionCompareStyle,so=uo.getDeviationStyleByKey,vo=U({containerRef:Fn,leftContainerRef:Un,rightContainerRef:Kn,svgContainerRef:En,pathRefs:Pn,leftHeaderRef:An,rightHeaderRef:Tn,proposedSections:Di,existingSections:ki,visibleFields:Oi,leftRefs:qi,rightRefs:Vi,sectionLeftRefs:Wi,sectionRightRefs:Gi,subSectionLeftRefs:Xi,subSectionRightRefs:$i,lhsBadgeRefs:Ki,rhsBadgeRefs:Yi,sectionRowRefs:Ui,expandedSections:bt,expandedSubSections:Ct,connectedSections:Rn,isSideBySide:it,activeSideBySideSection:at,maintainRelativeOrder:un,isGuidelineMode:Fi,cognitiveMap:qn,getSectionCompareStyle:ao,getSubSectionCompareStyle:co,getDeviationStyleByKey:so,isArrowVisible:tt,isAnimatingRef:kn,isSideBySideRef:dt,sideBySideCacheRef:st,sideBySideLineRef:pt,activeSideBySideSectionRef:ft,activeSideBySideRightSectionRef:vt,connectedLines:Cn,setConnectedLines:wn,cachedConnectedPositions:jn,calculateLinesRef:Ln,resizeTimerRef:Nn,scrollLock:ct,scrollSyncLocked:_n,handleResizeRef:Mn,activeProposed:Ai,existingRule:Ti,analysisData:Tt,pendingScrollTargetRef:Qn,pendingScrollCallbackRef:Zn,resolvedComparisonConfig:mi,getFieldData:lo}),fo=vo.lines,po=vo.setLines,go=vo.overallConnector,ho=vo.setOverallConnector,mo=vo.svgDimensions,So=vo.handleColumnScroll;c(function(){ai.anchorEl&&requestAnimationFrame(function(){requestAnimationFrame(function(){var e;null===(e=Ln.current)||void 0===e||e.call(Ln)})})},[ai.anchorEl,_n]);var xo=s(function(){ht(),In(!1),yt({}),wt({}),mt(),bn(new Set),wn([]),jn.current=[],si(),gi(),hi(),requestAnimationFrame(function(){Ln.current&&Ln.current()})},[yt,wt,mt,si,gi,hi]);c(function(){it||0!==Rn.size||In(!1)},[it,Rn]);var Ro=a(function(){return Object.values(bt).some(Boolean)||Object.values(Ct).some(Boolean)},[bt,Ct]),bo=u(null),yo=u(0),Co=u(0),wo=u(0),Bo=$({timerRef:bo,ruleComponentRef:Gn,scrollContainerRef:Wn,containerRef:Fn,maintainRelativeOrder:un,proposedSections:Di,existingSections:ki,isSideBySideRef:dt,activeSideBySideSectionRef:ft,activeSideBySideRightSectionRef:vt,sectionRowRefs:Ui,sectionRightRowRefs:Ji,sectionLeftRefs:Wi,sectionRightRefs:Gi,subSectionLeftRefs:Xi,subSectionRightRefs:$i,lhsBadgeRefs:Ki,rhsBadgeRefs:Yi,leftContainerRef:Un,rightContainerRef:Kn,calculateLinesRef:Ln,handleResizeRef:Mn,setIsResizing:lt,setIsArrowVisible:ot,sideBySideCacheRef:st,cachedConnectedPositions:jn}).handleResize;c(function(){Mn.current=Bo},[Bo,Mn]),c(function(){var e=function(e,n,i,t,o){n.current=e.getBoundingClientRect().width;var r=new ResizeObserver(function(e){null!==i.current&&cancelAnimationFrame(i.current),i.current=requestAnimationFrame(function(){var r,l,u;i.current=null;var a=e[e.length-1];if(a){var c=null!==(u=null===(l=null===(r=a.borderBoxSize)||void 0===r?void 0:r[0])||void 0===l?void 0:l.inlineSize)&&void 0!==u?u:a.contentRect.width;Math.abs(c-n.current)<1?o():(n.current=c,t())}})});return r.observe(e),r},n={current:null},i={current:null},t={current:null},o=[],r=[n,i,t];return Gn.current&&o.push(e(Gn.current,yo,n,function(){return Mn.current()},function(){})),Wn.current&&o.push(e(Wn.current,Co,i,function(){return Mn.current()},function(){return Ln.current()})),Fn.current&&o.push(e(Fn.current,wo,t,function(){return Mn.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)})}},[]),c(function(){dt.current=it},[it]),c(function(){ft.current=at},[at]);var _o=s(function(){var e,n=ti.sectionIdx,i=ti.isOrphan;if(si(),null!=n){var t="left";ti.anchorEl&&(null===(e=Kn.current)||void 0===e?void 0:e.contains(ti.anchorEl))&&(t="right"),It(n),St(n,i,{sourceSide:t})}},[St,ti.isOrphan,ti.sectionIdx,ti.anchorEl,si]),Io=s(function(){si(),mt(),bn(new Set),wn([]),jn.current=[]},[si,mt]),Eo=null!==ti.sectionIdx&&Rn.has(ti.sectionIdx),Fo=q({proposedSections:Di,existingSections:ki,parentDeviationRecord:Pi,expandedSections:bt,maintainRelativeOrder:!!un,scrollContainerRef:Wn,leftContainerRef:Un,rightContainerRef:Kn,lhsBadgeRefs:Ki,rhsBadgeRefs:Yi}),Ao=Fo.showDeviationNavigation,To=Fo.showOpenNodeRef,Do=Fo.adjustScrollForPopup,ko=s(function(e,n,i,t,o){var r,l="string"==typeof t?x(t).trim():x(null==t?void 0:t.deviation_summary).trim(),u=e.currentTarget;gi();var a="left";(null===(r=Kn.current)||void 0===r?void 0:r.contains(u))&&(a="right");var c=function(){var e,i,t,o;if("string"==typeof n&&n.includes(C)){var r=n.split(C),l="".concat(r[0]).concat(C).concat(r[1]);return"right"===a?null===(e=Yi.current[l])||void 0===e?void 0:e.current:null===(i=Ki.current[l])||void 0===i?void 0:i.current}return"right"===a?null===(t=Yi.current[n])||void 0===t?void 0:t.current:null===(o=Ki.current[n])||void 0===o?void 0:o.current};if(i)return mt(),bn(new Set),wn([]),jn.current=[],void(l&&(It(n),requestAnimationFrame(function(){var e=c()||u;e&&(e.getBoundingClientRect().top>.8*window.innerHeight&&e.scrollIntoView({behavior:"smooth",block:"center"}));ci({open:!0,anchorEl:e,summary:t,displayImpact:o})})));It(n),l?setTimeout(function(){St(n,i,{toggleIfSame:!1,sourceSide:a,onReady:function(){var e,n,i,r=c()||u;if(r){var l=r.getBoundingClientRect();if(l.top>.8*window.innerHeight||l.top<100){var a=l.top-window.innerHeight/2;un?(null===(e=Un.current)||void 0===e||e.scrollBy({top:a,behavior:"smooth"}),null===(n=Kn.current)||void 0===n||n.scrollBy({top:a,behavior:"smooth"})):null===(i=Wn.current)||void 0===i||i.scrollBy({top:a,behavior:"smooth"})}}ci({open:!0,anchorEl:r,summary:t,displayImpact:o})}})},350):setTimeout(function(){St(n,i,{toggleIfSame:!1,sourceSide:a})},350)},[St,gi,ci,mt,It]),Oo=a(function(){var e;if(!Ue)return null;var n=null===(e=null==Ue?void 0:Ue.id)||void 0===e?void 0:e.split(":")[0];for(var i in Pi){if((Pi[i]||[]).some(function(e){return e.id===n}))return i}return null},[Ue,Pi]),Po=u({id:null,triggerMs:null}),jo=u(null);c(function(){if(null==Ue?void 0:Ue.id){var o=Number(Ue.trigger),r=Po.current;if((null==r?void 0:r.id)!==Ue.id||(null==r?void 0:r.triggerMs)!==o){if(!(Ue.id.includes(":")&&/:\d+$/.test(Ue.id)))return Po.current={id:Ue.id,triggerMs:o},void to(Ue.id);var l=Ue.id.split(":"),u=l[0],a=l[1],c=null!=a?a:"0",s="".concat(Ue.id,":").concat(o);jo.current!==s&&(si(),gi(),mt(),bn(new Set),wn([]),jn.current=[],jo.current=s);var d=!1,v=0,f=null,p=null,g=!1,h=function(e,n){for(var i=function(e,t){if(!e)return null;if(n.includes(e.id)||n.includes(e.nodeId)||n.includes(e.contentId))return t;if(!Array.isArray(e.subsections))return null;for(var o=0;o<e.subsections.length;o++){var r=i(e.subsections[o],"".concat(t,"-").concat(o));if(r)return r}return null},t=0;t<e.length;t++){var o=i(e[t],String(t));if(o)return o}return null},m=function(){var r,l,a;if(!d){var s=function(){Po.current={id:Ue.id,triggerMs:o}},S=null,x=null;for(var R in Pi){var b=Pi[R].find(function(e){var n;return e.id===u||e.nodeId===u||e.contentId===u||(null===(n=e.evaluationResult)||void 0===n?void 0:n.nodeId)===u});if(b){S=R,x=b;break}}if(x&&S){var y=Array.from(new Set([u,x.id,x.nodeId,x.contentId,null===(r=x.evaluationResult)||void 0===r?void 0:r.nodeId].filter(Boolean))),w=Di.findIndex(function(e){return e.id===S}),B=ki.findIndex(function(e){return e.id===S}),E=-1===w&&-1!==B,F=h(Di,y),A=h(ki,y);if(F&&!A&&!E){var T=F.split("-"),D=Number(T[0]);if(un){var k=null===(a=null===(l=Di[D])||void 0===l?void 0:l.refIndexes)||void 0===a?void 0:a[0],O=ki.findIndex(function(e){return e.selfIndex===k});-1!==O&&(D=O)}A=n([D],T.slice(1),!0).join("-")}if(F||A){var P=F?Number(F.split("-")[0]):w,j=A?Number(A.split("-")[0]):B,L=j>=0?j:A?Number(A.split("-")[0]):-1,N=Di[P],M=ki[L],H=N&&!N.title&&!N.content,z=M&&!M.title&&!M.content,q=E||(!F&&!!A||H&&!z);if(q){if(!(un?!!Yo.current["right-".concat(j)]:!!Yo.current[String(j)])&&j>=0)return _t(j,"right"),void(f=setTimeout(m,200))}else if(!(un?!!Yo.current["left-".concat(P)]:!!Yo.current[String(P)])&&P>=0)return _t(P,"left"),void(f=setTimeout(m,200));var V=F||"",W=A||"",G=y.map(function(e){return"".concat(e).concat(C).concat(c)}),K=G[0],Y=function(){for(var e,n,i=0,t=G;i<t.length;i++){var o=t[i],r=(null===(e=Ki.current[o])||void 0===e?void 0:e.current)||null,l=(null===(n=Yi.current[o])||void 0===n?void 0:n.current)||null;if(r||l)return{refId:o,left:r,right:l}}return{refId:K,left:null,right:null}},J=function(e){return"".concat(e).concat(C).concat(V).concat(C).concat(W)};if(!g){It(J(K)),g=!0,v=0;var X=function(){var e=Y(),n=e.left,i=e.right;return q||!n&&!!i?i:n};return null==p||p(),void(f=setTimeout(function(){var e,n,i,t,o,r,l,u;d||(e=X,n=function(){d||(p=null,m())},t=0,o=null,r=null,l=performance.now(),u=function(){if(!d)if(performance.now()-l>3e3)n();else{var a=e();if(a&&0!==a.getBoundingClientRect().height){var c=a.getBoundingClientRect(),s=c.top,v=c.height,f=null!==o&&Math.abs(s-o)<.5,p=null!==r&&Math.abs(v-r)<.5;if(f&&p){if(++t>=5)return void n()}else t=0;o=s,r=v,i=requestAnimationFrame(u)}else i=requestAnimationFrame(u)}},i=requestAnimationFrame(u),p=function(){return cancelAnimationFrame(i)})},300))}var $=Y(),U=$.refId,Q=$.left,Z=$.right,ee=J(U);if(Q||Z){var ne=q||!Q&&!!Z,ie=ne?Z:Q,te=un?ne?Kn.current:Un.current:Wn.current;if(ie&&te){var oe=ie.getBoundingClientRect();if(0!==oe.height){var re=te.getBoundingClientRect(),le=oe.top-re.top+te.scrollTop-re.height/2+oe.height/2,ue=(null==F?void 0:F.includes("-"))||(null==A?void 0:A.includes("-")),ae=function(){return i(void 0,void 0,void 0,function(){var n,i,o,r,l,u,a,v,f,p;return t(this,function(t){switch(t.label){case 0:return d?[2]:(s(),n=ie instanceof Element?window.getComputedStyle(ie).color:"",[Q,Z].forEach(function(e){e&&(e.style.transition="box-shadow 300ms ease-in-out",e.style.boxShadow="0 0 10px ".concat(n))}),setTimeout(function(){[Q,Z].forEach(function(e){e&&(e.style.boxShadow="")})},2e3),i=(null===(a=null===(u=x.evaluationResult)||void 0===u?void 0:u.deviations)||void 0===a?void 0:a[c])||x,o=(null===(v=x.evaluationResult)||void 0===v?void 0:v.evaluation_outputs)||x.evaluation_outputs,!!Q&&!!Z?(l=function(e,n){return Promise.race([e,new Promise(function(e){return setTimeout(e,n)})])},un?[4,Promise.all([Un.current?l(I(Un.current),600):Promise.resolve(),Kn.current?l(I(Kn.current),600):Promise.resolve()])]:[3,2]):(r=ne?(null===(f=Yi.current[ue?U:j])||void 0===f?void 0:f.current)||Z:(null===(p=Ki.current[ue?U:P])||void 0===p?void 0:p.current)||Q,Do(r,function(){ci({open:!0,anchorEl:r,displayImpact:Ue.displayImpact,summary:e(e({},i),{evaluation_outputs:o})})},{skipScroll:!0}),null==Qe||Qe(),[2]));case 1:t.sent(),t.label=2;case 2:return xt.current(ee,!1,{toggleIfSame:!1,sourceSide:E?"right":"left",onReady:function(){var n,t,o,r;s();var l=ne?(null===(n=Yi.current[U])||void 0===n?void 0:n.current)||Z:(null===(t=Ki.current[U])||void 0===t?void 0:t.current)||Q,u=(null===(o=Ki.current[U])||void 0===o?void 0:o.current)||Q,a=(null===(r=Yi.current[U])||void 0===r?void 0:r.current)||Z;u&&(u.style.scrollMarginTop="150px",u.scrollIntoView({behavior:"smooth",block:"start"})),a&&(a.style.scrollMarginTop="150px",a.scrollIntoView({behavior:"smooth",block:"start"})),ci({open:!0,anchorEl:l,displayImpact:Ue.displayImpact,summary:e({},i)}),null==Qe||Qe()}}),[2]}})})};Math.abs(te.scrollTop-le)<=2?ae():_(te,le,ae)}else++v<30&&(f=setTimeout(m,100))}else++v<30&&(f=setTimeout(m,100))}else++v<30&&(f=setTimeout(m,100))}else++v<30&&(f=setTimeout(m,100))}else++v<30&&(f=setTimeout(m,100))}};return f=setTimeout(m,100),function(){d=!0,f&&clearTimeout(f),null==p||p()}}}},[null==Ue?void 0:Ue.id,null==Ue?void 0:Ue.trigger,null==Ue?void 0:Ue.displayImpact,Pi,Di,ki,un,ci,to]),c(function(){var n,i,t;if(ai.open){var o=ai.anchorEl;if(o&&!o.isConnected){var r=function(e){for(var n,i=0,t=Object.entries(e);i<t.length;i++){var r=t[i],l=r[0];if((null===(n=r[1].current)||void 0===n?void 0:n.textContent)===o.textContent)return l}return null},l=(null===(n=o.dataset)||void 0===n?void 0:n.deviationRefId)||r(Ki.current)||r(Yi.current);if(l){var u=(null===(i=Yi.current[l])||void 0===i?void 0:i.current)||(null===(t=Ki.current[l])||void 0===t?void 0:t.current);u&&u.isConnected&&ci(function(n){return e(e({},n),{anchorEl:u})})}}}},[ai.open,ai.anchorEl,_n,Rn,bt]);var Lo=ni.open,No=ni.sectionIdx,Mo=ni.isOrphan,Ho=ni.badgeStyle,zo=ni.anchorEl,qo=ni.sectionAnchorEl;c(function(){var n;if(Ke.isStreamingEnabled&&Lo&&null!=No&&No!==Ot){var i="string"==typeof No?No.split(C)[0]:null,t=function(e,n){var i;if(!e||!Array.isArray(e))return null;for(var o=0,r=e;o<r.length;o++){var l=r[o];if(l.id===n)return l;if(null===(i=l.subsections)||void 0===i?void 0:i.length){var u=t(l.subsections,n);if(u)return u}}return null},o=i&&"string"==typeof i?t(Di,i):null,r=i&&"string"==typeof i?t(ki,i):null,l="number"==typeof No?Di[No]||null:o||i&&((null===(n=null==Me?void 0:Me.nodes)||void 0===n?void 0:n[i])||(null==Me?void 0:Me[i]))||null,u="number"==typeof No?ki[No]||null:r,a=Zt(zo,l,u,No,Mo,Ho);ii(function(n){return n.open?x(n.cognitiveData)===x(a.cognitiveData)&&x(n.deviationData)===x(a.deviationData)&&n.sectionTitle===a.sectionTitle&&n.refSectionTitle===a.refSectionTitle?n:e(e(e({},n),a),{open:!0,anchorEl:n.anchorEl,sectionAnchorEl:n.sectionAnchorEl}):n})}},[Lo,No,Mo,Ho,zo,qo,Di,ki,Zt]);var Vo=s(function(e){var n=e.section,i=e.keyPath,t=e.depth,r=void 0===t?0:t,l=e.columnKey,u=void 0===l?"left":l,a=e.parentNodeId,c=void 0===a?"":a,s=e.sectionOffset,d=e.rhsOrphanVisualIndexes;return o(W,{section:n,keyPath:i,depth:r,columnKey:u,parentNodeId:c,sectionOffset:s,rhsOrphanVisualIndexes:d})},[]),Wo=a(function(){return Di.map(function(e,n){var i,t=!(null==e?void 0:e.title)&&!(null==e?void 0:e.content),r=!(null==e?void 0:e.refIndexes)||0===e.refIndexes.length;return t&&r&&un?null:o(G,{section:e,idx:n},null!==(i=null==e?void 0:e.id)&&void 0!==i?i:"left-row-".concat(n))})},[Di]),Go=a(function(){return ki.map(function(e,n){var i,t=!(null==e?void 0:e.title)&&!(null==e?void 0:e.content),r=!(null==e?void 0:e.refIndexes)||0===e.refIndexes.length;return t&&r&&un?null:o(K,{section:e,idx:n},null!==(i=null==e?void 0:e.id)&&void 0!==i?i:"right-row-".concat(n))})},[ki]),Ko=u(eo);c(function(){Ko.current=eo},[eo]);var Yo=u(bt);c(function(){Yo.current=bt},[bt]);var Jo=u(ko);c(function(){Jo.current=ko},[ko]);var Xo=u(Io);c(function(){Xo.current=Io},[Io]);var $o=u(_t);c(function(){$o.current=_t},[_t]);var Uo=u(Bt);c(function(){Uo.current=Bt},[Bt]);var Qo=u(Vo);c(function(){Qo.current=Vo},[Vo]);var Zo=u(mt);c(function(){Zo.current=mt},[mt]);var er=a(function(){return{isGuidelineMode:Fi,maintainRelativeOrder:!!un,showDeviationBadges:dn,isProposingFix:en,proposingFixNodeId:nn,isRedlineFlow:tn,isSideBySide:it,activeSideBySideSection:at,scrollSyncLocked:_n,toggleScrollSyncLocked:Ft,summaryPopupAnchorEl:ai.anchorEl,connectedSections:Rn,proposedSections:Di,existingSections:ki,deviationNumberRegistry:ji,deviationParentRegistry:Li,treeData:Me,displayConfig:Ke,resolvedMarkdownStyles:Vn,unifiedNumbering:At,expandedSections:bt,expandedSubSections:Ct,setExpandedSubSections:wt,getSectionCompareStyle:ao,getSubSectionCompareStyle:co,getBadgeRef:et,getSectionRowRef:Qi,getSubSectionRef:Zi,sectionLeftRefs:Wi,sectionRightRefs:Gi,sectionRowRefs:Ui,sectionRightRowRefs:Ji,subSectionLeftRefs:Xi,subSectionRightRefs:$i,lhsBadgeRefs:Ki,rhsBadgeRefs:Yi,openMoreFunctionsPopup:zt,handleOpenSummaryPopup:qt,openSummaryPopup:qt,handleCloseSummaryPopup:Vt,toggleSection:Wt,handleSubSectionToggle:Gt,renderSubSectionAccordion:Kt,resetSideBySide:Yt,setConnectedSections:bn,setConnectedLines:wn,cachedConnectedPositions:jn,showDeviationNavigation:Ao,showOpenNodeRef:To,deviationNodeIdToView:null==Ue?void 0:Ue.id,deviationTargetParentId:Oo,guidelinesData:rn}},[Fi,un,dn,en,nn,tn,it,at,_n,Ft,ai.anchorEl,Rn,Di,ki,ji,Ke,Vn,At,bt,Ct,wt,ao,co,et,Qi,Zi,Ao,To,Ue,Oo,rn]);return o(J,e({value:er},{children:r(d,e({ref:Gn,sx:{display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif',overflow:"visible",position:"relative"}},{children:[fn&&o(d,e({sx:{position:"absolute",inset:0,bgcolor:"rgba(255, 255, 255, 0.6)",backdropFilter:"blur(10px)",zIndex:9999,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"8px"}},{children:o(j,{})})),ai.open&&o(Y,{open:ai.open,anchorEl:ai.anchorEl,containerEl:ro.current,clipTopEl:An.current,scrollContainerEl:Wn.current,onClose:Io,summary:ai.summary,displayImpact:ai.displayImpact,isScrollLocked:_n}),o(P,{open:ti.open,anchorEl:ti.anchorEl,maintainRelativeOrder:!!un,sectionTitle:ti.sectionTitle,referenceSectionTitle:ti.refSectionTitle,onClose:hi,onOpenCognitiveCompare:fi,onOpenSideBySide:_o,onConnect:no,isConnected:Eo,isOrphan:!Fi&&!!ti.isOrphan,isGuidelineMode:Fi,hasGuidelineMatches:ti.hasGuidelineMatches}),ni.open&&o(O,{open:ni.open,popupRef:vi,position:ri,popupConfig:Je,onClose:function(){li(null),ii(function(n){return e(e({},n),{open:!1})}),di(null)},markdownStyles:Ve,sectionTitle:wi,referenceSectionTitle:_i,cognitiveData:ni.cognitiveData,anchorEl:ni.anchorEl,sectionAnchorEl:ni.sectionAnchorEl,scrollContainerEl:Wn.current,badgeStyle:ni.badgeStyle,docData:ni.docData,deviationData:ni.deviationData,isLoading:ni.isLoading}),o(v,e({open:!!hn,autoHideDuration:8e3,onClose:function(){return mn(null)},anchorOrigin:{vertical:"top",horizontal:"center"}},{children:o(f,e({onClose:function(){return mn(null)},severity:"error",sx:{width:"100%",whiteSpace:"pre-line"}},{children:hn}))})),o(V,{componentHeaderText:Ne,displayConfig:Ke,maintainRelativeOrder:un,onCollapseAll:xo,showCollapseAll:Ro,onToggleView:function(e){pn(!0),setTimeout(function(){an(!e),null==Ye||Ye(!e),In(!1),mt(),si(),bn(new Set),wn([]),jn.current=[],requestAnimationFrame(function(){requestAnimationFrame(function(){setTimeout(function(){pn(!1)},600)})})},50)}}),o(d,e({ref:Wn,onScroll:So,sx:{flex:1,minHeight:0,pt:1.5,pb:1,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",overflowY:un?"visible":"auto",borderTop:Dt&&kt?"none":"1.5px solid #EEF0F4"}},{children:o(d,e({sx:e({display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"},un?{flex:1}:{})},{children:r(d,e({ref:Fn,sx:e({display:"grid",gridTemplateColumns:"minmax(0, 1fr) 180px minmax(0, 1fr)",gap:"100px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0},un?{flex:1,overflow:"visible"}:{})},{children:[o(Z,{svgContainerRef:En,svgDimensions:mo,isResizing:rt,overallConnector:go,rootDeviationStyle:Lt,lines:fo,isSideBySide:it,activeSideBySideSection:at,isArrowVisible:tt,maintainRelativeOrder:un,proposedSections:Di,existingSections:ki,cognitivePopup:ni,activeBadgeId:ui,closeCognitivePopup:gi,setActiveBadgeId:di,openCognitivePopupFromState:pi,buildSectionPopupState:Zt,connectedLines:Cn,isGuidelineMode:Fi,pathRefs:Pn}),r(d,e({sx:e({border:"1px solid #E7E7E9",borderRadius:"8px",bgcolor:"#FFFFFF",display:"flex",flexDirection:"column",position:"relative",zIndex:2,filter:"drop-shadow(0px 2px 4px #F2F2F2)"},un?{flex:1,overflow:"visible"}:{})},{children:[o(d,e({ref:An,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:o(p,e({title:yi,placement:"top"},{children:o(g,e({sx:{fontSize:"16px",fontWeight:500,color:"#19213D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0,textAlign:"center",display:"block"}},{children:yi}))}))})),r(d,e({ref:Un,onScroll:So,sx:e({p:"12px",display:"flex",flexDirection:"column"},un?{maxHeight:"calc(100vh - 250px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,mr:"-180px",pr:"192px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[o("div",{ref:Xn,style:{width:"100%",height:"0px",flexShrink:0}}),Mi&&Wo,o("div",{ref:$n,style:{width:"100%",height:"0px",flexShrink:0}})]}))]})),o(d,e({ref:ro,sx:{width:"180px",display:"flex",flexDirection:"column",alignItems:"center",pt:"15px",gap:0,zIndex:20,pointerEvents:"none"}},{children:o(d,e({sx:{display:"flex",justifyContent:"center",alignItems:"center",mt:0}},{children:r(d,e({onClick:function(n){n.stopPropagation(),ni.open&&ui===Ot?gi():(di(Ot),pi(Zt(n.currentTarget,{title:"",content:"",evaluationResult:Pt,cognitiveData:{section_id:"",decisioning:[],gap:[],relevance_score:0,isMissingRationale:!0}},null,Ot,!0,e(e({},Lt),{label:""}))))},sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:"5px",top:"-8px",borderRadius:"20px",bgcolor:Lt.badgeBg,color:Lt.badgeText,border:"1px solid ".concat(Lt.badgeBorder),fontSize:"12px",fontWeight:600,whiteSpace:"nowrap",position:"relative",zIndex:1,pointerEvents:"auto",cursor:"pointer"}},{children:[null!=jt?jt:o(L,{}),o(d,e({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:o(m,{})})),o(h,{size:11,style:{transform:ni.open&&ui===Ot?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))})),r(d,e({sx:e({border:"1px solid #E3E6EA",borderRadius:"8px",bgcolor:"#FFFFFF",boxShadow:"0px 1px 4px #F7F4FE",position:"relative",zIndex:2,display:"flex",flexDirection:"column",minWidth:0},un?{flex:1,overflow:"visible",minHeight:0}:{})},{children:[ut&&o(S,{sections:11}),o(d,e({ref:Tn,sx:e({p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E3E6EA",borderRadius:"8px 8px 0 0",display:"flex",alignItems:"center"},un?e({maxHeight:"calc(100vh - 250px)",overflowY:"auto",overflowX:"hidden",minHeight:0},Fi?{"&::-webkit-scrollbar":{width:"6px",display:"block"},"&::-webkit-scrollbar-track":{background:"transparent"},"&::-webkit-scrollbar-thumb":{background:"#CBD5E1",borderRadius:"10px"},"&::-webkit-scrollbar-thumb:hover":{background:"#94A3B8"},scrollbarWidth:"thin",scrollbarColor:"#CBD5E1 transparent"}:{"&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}):{})},{children:o(p,e({title:Ii,placement:"top"},{children:o(g,e({sx:{fontSize:"16px",fontWeight:500,color:"#5928ED",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0,textAlign:"center",display:"block"}},{children:Ii}))}))})),r(d,e({ref:Kn,onScroll:So,sx:e({p:Fi?"0px":"12px",display:"flex",flexDirection:"column"},un?e(e({maxHeight:"calc(100vh - 250px)"},!Fi&&{flex:1}),{overflowY:"auto",overflowX:"hidden",minHeight:0,ml:"-150px",pl:"165px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}):{})},{children:[o("div",{ref:Yn,style:{width:"100%",height:"0px",flexShrink:0}}),Fi?o(ee,{guidelinesData:rn,deviationData:$e,connectedSections:Rn,proposedSections:Di}):Mi&&Go,o("div",{ref:Jn,style:{width:"100%",height:"0px",flexShrink:0}})]}))]}))]}))}))}))]}))}))};export{ne as default};
|
|
2
2
|
//# sourceMappingURL=CognitiveCompare.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as n}from"tslib";import{jsxs as e,jsx as i}from"react/jsx-runtime";import o,{useEffect as t}from"react";import{Box as l,Accordion as d,AccordionSummary as r,Tooltip as u,Typography as a,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{useCompareContext as p}from"../CompareContext.js";import{hasValue as h,hasMeaningfulRedlineTags as g,stripRedlineTags as x,hasSingleMappedLhsSection as m,generateColorPalette as I,isMissingStr as y,getRhsMappedSectionNumber as b,safeStringify as S,DEVIATION_BADGE_SEPARATOR as w}from"../CognitiveComparehelpers.js";import{DEFAULT_DEVIAION_COLOR as R}from"../CognitiveCompareConstants.js";var _=function(_){var F,k,N,M,B,C,E,A,O,j,W,T,D,P,K,z=_.section,G=_.idx,L=_.columnKey,X=_.colRef,H=_.mb,V=void 0===H?1:H,Y=_.isExpanded,q=_.onToggle,J=_.navigation,Q=_.parentNodeId,U=void 0===Q?"":Q,Z=p(),$=Z.showOpenNodeRef,nn=Z.resolvedMarkdownStyles,en=Z.maintainRelativeOrder,on=Z.showDeviationBadges,tn=void 0!==on&&on,ln=Z.renderSubSectionAccordion,dn=Z.treeData,rn=Z.proposedSections,un=Z.existingSections,an=Z.deviationNumberRegistry,cn=Z.deviationParentRegistry,sn=Z.getBadgeRef,vn=Z.openSummaryPopup,fn=Z.getSectionCompareStyle,pn=Z.connectedSections,hn=Z.openMoreFunctionsPopup,gn=Z.isProposingFix,xn=Z.proposingFixNodeId,mn=Z.isRedlineFlow,In=Z.isSideBySide,yn=Z.activeSideBySideSection,bn=Z.scrollSyncLocked,Sn=Z.unifiedNumbering,wn=Z.toggleScrollSyncLocked,Rn=Z.summaryPopupAnchorEl,_n="".concat(In?"1":"0","-").concat(String(null!=yn?yn:"")),Fn=(null===(F=z.displayTitle)||void 0===F||F)&&h(z.title),kn=!(!gn||!xn||"left"!==L||z.id!==xn&&z.nodeId!==xn),Nn=g(z.content),Mn="boolean"==typeof mn?mn:Nn,Bn=Nn,Cn=Mn&&Nn,En=Cn?x(z.content):z.content,An=Cn?z.content:void 0,On=(null===(k=z.displayContent)||void 0===k||k||Nn)&&h(z.content),jn=!Fn&&!On,Wn=z.title;Fn||(Wn=On?"No Title Found":"No Matching Section Found");var Tn=z.evaluationResult;if(!Tn&&"right"===L)if(en){var Dn=null===(N=z.refIndexes)||void 0===N?void 0:N[0],Pn=rn.find(function(n){return n.selfIndex===Dn});Tn=null==Pn?void 0:Pn.evaluationResult}else Tn=null===(M=rn[G])||void 0===M?void 0:M.evaluationResult;var Kn=null===(B=null==dn?void 0:dn.input_index_map)||void 0===B?void 0:B[0],zn=null===(C=null==dn?void 0:dn.input_index_map)||void 0===C?void 0:C[1],Gn="left"===L?zn:Kn,Ln=function(n,e){var i;if(!e||!n)return null;for(var o=0,t=n;o<t.length;o++){var l=t[o];if(l.id===e||l.nodeId===e||l.contentId===e)return l;if(null===(i=l.subsections)||void 0===i?void 0:i.length){var d=Ln(l.subsections,e);if(d)return d}}return null},Xn="left"===L?z:Ln(rn,z.id),Hn="right"===L?z:Ln(un,z.id),Vn=o.useMemo(function(){if(!en)return 0;var n=1/0,e=function(n){var e=g(n)?x(n):n;return S(e||"").replace(/\\n/g,"\n")},i=function(o,t,l,d){if(o){var r=o.nodeId||o.id;if(d&&"right"===L){var u=rn.filter(function(n){var e;return null===(e=n.refIndexes)||void 0===e?void 0:e.includes(o.selfIndex)});u.length>0&&(r=u[0].nodeId||u[0].id)}var a=o.nodeId||o.id||(null==t?void 0:t.nodeId)||(null==t?void 0:t.id)||(null==l?void 0:l.nodeId)||(null==l?void 0:l.id),c=o.evaluationResult||(null==t?void 0:t.evaluationResult)||(null==l?void 0:l.evaluationResult),s=(null==c?void 0:c.deviations)||{};Object.keys(s).forEach(function(i){var d,u=null===(d=s[i])||void 0===d?void 0:d[U];if(function(n,i){if("string"!=typeof i||y(i))return!1;var o=e(null==n?void 0:n.content),t=e(i);return!!t&&o.includes(t)}("left"===L?t||o:l||o,u)){var c="".concat(r).concat(w).concat(i),v=null==an?void 0:an[c];null!=v&&v<n&&(n=v);var f="".concat(a).concat(w).concat(i),p=null==an?void 0:an[f];null!=p&&p<n&&(n=p)}});for(var v=o.subsections||[],f=(null==t?void 0:t.subsections)||[],p=(null==l?void 0:l.subsections)||[],h=Math.max(v.length,f.length,p.length),g=0;g<h;g++)i(v[g],f[g],p[g],!1)}},o="right"===L?rn.filter(function(n){var e;return null===(e=n.refIndexes)||void 0===e?void 0:e.includes(z.selfIndex)}):[];if(1===o.length){var t=o[0];(t.refIndexes||[]).map(function(n){return un.find(function(e){return e.selfIndex===n})}).filter(Boolean).forEach(function(n){i(n,t,n,!0)})}else i(z,Xn,Hn,!0);return n!==1/0?n-1:0},[z,Xn,Hn,L,U,an,en,rn,un]);if(en)if("left"===L){var Yn=null===(E=z.refIndexes)||void 0===E?void 0:E[0],qn=un.findIndex(function(n){return n.selfIndex===Yn});Hn=-1!==qn?un[qn]:Ln(un,z.id)}else{var Jn=null===(A=z.refIndexes)||void 0===A?void 0:A[0],Qn=rn.findIndex(function(n){return n.selfIndex===Jn});Xn=-1!==Qn?rn[Qn]:Ln(rn,z.id)}var Un="left"===L?!Hn:!Xn,Zn=en&&"right"===L&&m(z,rn),$n=Tn||(null==Xn?void 0:Xn.evaluationResult)||(null==Hn?void 0:Hn.evaluationResult),ne=null!==(W=null===(j=null===(O=null==$n?void 0:$n.evaluation_outputs)||void 0===O?void 0:O.metadata)||void 0===j?void 0:j.label_color)&&void 0!==W?W:R,ee=I(ne).highlightBg,ie=(null==$n?void 0:$n.deviations)||{},oe=z.nodeId||z.id;if(en&&"left"!==L){var te=rn.filter(function(n){var e;return null===(e=n.refIndexes)||void 0===e?void 0:e.includes(z.selfIndex)});te.length>0?oe=te[0].nodeId||te[0].id:(null==Xn?void 0:Xn.id)&&(oe=Xn.nodeId||Xn.id)}var le=o.useMemo(function(){var n,e=new Map;if(!en||"right"!==L)return e;var i=1,o=rn.filter(function(n){var e;return null===(e=n.refIndexes)||void 0===e?void 0:e.includes(z.selfIndex)}),t=1===o.length&&1===(null===(n=o[0].refIndexes)||void 0===n?void 0:n.length),l=function(n){return S(n||"").replace(/\\n/g,"\n")},d=function(n,e){var i=e?o[0]:Ln(rn,n.nodeId||n.id||n.contentId);return{lhsNode:i,evalResult:n.evaluationResult||(null==i?void 0:i.evaluationResult),registryNodeId:i?i.nodeId||i.id:n.nodeId||n.id}};if(t){var r=function(n,e){if(void 0===e&&(e=!1),n){var o=d(n,e),t=o.lhsNode,u=o.evalResult,a=o.registryNodeId,c=l(n.content);Object.entries((null==u?void 0:u.deviations)||{}).forEach(function(n){var e=n[0],o=n[1],d=o[U],r=l(d);if(!!t&&!y(o[Gn])&&r&&c.includes(r)){var u="".concat(a).concat(w).concat(e),s=an[u];null!=s&&(i=Math.max(i,Math.max(1,s-(Vn||0))+1))}}),(n.subsections||[]).forEach(function(n){return r(n)})}};r(z,!0)}var u=function(n,o){if(void 0===o&&(o=!1),n){var t=d(n,o),r=t.lhsNode,a=t.evalResult,c=t.registryNodeId,s=(null==a?void 0:a.deviations)||{},v=l(n.content);Object.entries(s).map(function(n){var e,i=n[0],o=n[1],t=o[U],d=!r||y(o[Gn]),u=l(t),a=u?v.indexOf(u):-1,s="".concat(c).concat(w).concat(i);return{refId:s,isRenderable:d&&!!u&&!y(t),position:a,registryIndex:null!==(e=an[s])&&void 0!==e?e:Number.MAX_SAFE_INTEGER}}).filter(function(n){return n.isRenderable}).sort(function(n,e){return(-1===n.position?Number.MAX_SAFE_INTEGER:n.position)-(-1===e.position?Number.MAX_SAFE_INTEGER:e.position)||n.registryIndex-e.registryIndex}).forEach(function(n){e.set(n.refId,i++)}),(n.subsections||[]).forEach(function(n){return u(n)})}};return u(z,!0),e},[en,L,z,rn,U,Gn,an,Vn]),de=Object.keys(ie)[0],re=de?"".concat(oe).concat(w).concat(de):null,ue=re?null==cn?void 0:cn[re]:null,ae=G+1;if(en&&Sn){var ce="left"===L?Sn.leftNums.get(null==z?void 0:z.id):Sn.rightNums.get(null==z?void 0:z.id);Un&&void 0!==ce?ae=ce:null!=ue&&ue>=0?ae=ue:void 0!==ce&&(ae=ce)}else null!=ue&&ue>=0&&(ae=ue);var se=Object.entries(ie).map(function(n){var e=n[0],i=n[1],o="".concat(oe).concat(w).concat(e);return{deviationKey:e,deviationMap:i,refId:o,currentIndex:an[o]}}).filter(function(n){return void 0!==n.currentIndex&&null!==n.currentIndex});se.sort(function(n,e){return n.currentIndex-e.currentIndex});var ve,fe,pe=se.map(function(e){var i,o,t,l,d,r,u=e.deviationKey,a=e.deviationMap,c=e.refId,s=e.currentIndex,v=a[U],f=y(v);if(f)v="";else if(!v)return null;var p=G,h=G;if(en)if("left"===L){var g=null===(i=z.refIndexes)||void 0===i?void 0:i[0],x=un.findIndex(function(n){return n.selfIndex===g});if(-1!==x)h=x;else{var m=un.findIndex(function(n){return n.id===z.id||n.nodeId===z.nodeId||n.contentId===z.contentId});h=-1!==m?m:G}}else{var S=null===(o=z.refIndexes)||void 0===o?void 0:o[0],R=rn.findIndex(function(n){return n.selfIndex===S});if(-1!==R)p=R;else p=-1!==(E=rn.findIndex(function(n){return n.id===z.id||n.nodeId===z.nodeId||n.contentId===z.contentId}))?E:G}var _="".concat(oe).concat(w).concat(u).concat(w).concat(p).concat(w).concat(h),F=a[Gn],k=Un||y(F),N=le.get(c);en&&"right"===L&&k&&void 0!==N?s=N:en&&void 0!==Vn&&("right"!==L||k||Zn)&&(s-=Vn),s=Math.max(1,s);var M=en&&"right"===L&&k&&Sn?b({section:z,proposedSections:rn,leftNums:Sn.leftNums,fallbackNumber:String(ae),firstOnly:!0}):ae,B="".concat(M,".").concat(s),C=G;if("right"===L&&en){var E,A=null===(t=z.refIndexes)||void 0===t?void 0:t[0],O=rn.findIndex(function(n){return n.selfIndex===A});if(-1!==O)C=O;else-1!==(E=rn.findIndex(function(n){return n.id===z.id||n.nodeId===z.nodeId||n.contentId===z.contentId}))&&(C=E)}var j=fn?fn(C):null,W=(null==a?void 0:a.evaluation_outputs)||(null==$n?void 0:$n.evaluation_outputs),T=null!==(l=null==W?void 0:W.output_value)&&void 0!==l?l:null,D=null!==(r=null===(d=null==W?void 0:W.metadata)||void 0===d?void 0:d.label_color)&&void 0!==r?r:ne,P=I(D),K=j?n(n({},j),{badgeBg:P.badgeBg,badgeBorder:P.badgeBorder,badgeText:P.badgeText}):n({},P),X=(null==a?void 0:a.deviation_summary)?{deviation_summary:a.deviation_summary,deviation_title:(null==a?void 0:a.deviation_title)||(null==$n?void 0:$n.deviation_title),deviation_impact:(null==a?void 0:a.deviation_impact)||(null==$n?void 0:$n.deviation_impact),deviation_explanation:(null==a?void 0:a.deviation_explanation)||(null==$n?void 0:$n.deviation_explanation),evaluation_outputs:W,cognitive_decisioning:(null==a?void 0:a.cognitive_decisioning)||(null==$n?void 0:$n.cognitive_decisioning)}:null,H=0,V=En||"";if(v&&V){var Y=V.split(/\n{2,}/),q=Y.findIndex(function(n){return n.includes(v)});if(-1!==q){var J=Object.entries(ie).filter(function(n){n[0];var e=n[1][U];return e&&Y[q].includes(e)}).sort(function(n,e){return Y[q].indexOf(n[1][U])-Y[q].indexOf(e[1][U])}),Q=J.filter(function(n){n[0];var e=n[1][U];return e&&(e.includes(v)||v.includes(e))});Q.length>1&&(H=Math.max(0,Q.findIndex(function(n){return n[0]===u})))}}var Z=sn(L,c);return{id:c,actionId:_,label:B,highlight:v,side:L,style:K,stackIndex:H,score:T,isConnected:null==pn?void 0:pn.has(_),showScrollLockToggle:(null==pn?void 0:pn.has(_))||In&&yn===_||!!Rn&&Rn===Z.current,scrollSyncLocked:bn,toggleScrollSyncLocked:wn,isOrphan:k,isMissingClause:f,badgeRef:Z,onClick:function(n){n.stopPropagation(),hn&&hn(n,Xn||{id:"orphan-left",title:"",content:""},k,Hn||{id:"orphan-right",title:"",content:""},_,K)},onSummaryClick:function(n){n.stopPropagation(),vn(n,_,k,X)}}}).filter(Boolean),he=tn||!Mn&&kn?pe:[],ge=pe.map(function(n){return n.highlight}).filter(Boolean),xe=z.id&&L===(null==J?void 0:J.columnKey)?J:null,me=o.useRef(!1);return t(function(){Y||(me.current=!1)},[Y]),e(l,n({ref:X,sx:{mb:V,width:"100%",display:"flex",flexDirection:"column",position:"relative",minWidth:0}},{children:[Y&&(null==xe?void 0:xe.showAbove)&&i("div",n({style:{position:"sticky",top:0,height:"0px",cursor:"pointer"},onClick:function(){var n,e;return null===(e=null===(n=null==xe?void 0:xe.showAboveRef)||void 0===n?void 0:n.current)||void 0===e?void 0:e.scrollIntoView({behavior:"smooth",block:"center"})}},{children:i("div",n({style:n({transform:"translateY(-50%) translateX(calc(100% ".concat("left"===L?"+":"-"," 130px))"),position:"absolute",paddingTop:"20px"},"left"===L?{right:"-20px"}:{left:"-20px"})},{children:i(s,{color:(null===(T=null==xe?void 0:xe.showAboveRef)||void 0===T?void 0:T.current)?window.getComputedStyle(xe.showAboveRef.current).color:void 0})}))})),e(d,n({disableGutters:!0,expanded:!jn&&Y,onChange:function(){jn||(q(),$.current=z.id)},sx:{boxShadow:"none",border:jn?"1px dashed #E2E8F0":"1px solid #E2E8F0",bgcolor:jn?"#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(r,n({expandIcon:jn?null:i(v,{size:16}),sx:{minHeight:"36px",flexShrink:0,cursor:jn?"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:Fn&&i(u,n({title:Wn,placement:"top"},{children:i(a,n({component:"div",sx:{fontSize:"12px",color:jn?"#94A3B8":"#19213D",fontWeight:jn?400:700,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0}},{children:(ve=Wn,fe="left"===L&&(null!==(P=null===(D=null==z?void 0:z.refContentIds)||void 0===D?void 0:D.length)&&void 0!==P?P:1)>1,void 0===fe&&(fe=!1),ve?S(ve).replace(/\\n/g,"\n").split(/(\*\*.*?\*\*)/g).map(function(o,t){return o.startsWith("**")&&o.endsWith("**")?i("strong",{children:o.slice(2,-2)},t):e("div",n({style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"8px",width:"100%"}},{children:[i("span",{children:o}),fe&&i("span",n({style:{display:"inline-flex",alignItems:"center",justifyContent:"center",padding:"0px 6px",borderRadius:"9999px",background:"#F3F4F6",border:"1px solid #D1D5DB",color:"#6B7280",fontSize:"9px",fontWeight:500,whiteSpace:"nowrap",lineHeight:1.4,marginRight:"4px"}},{children:"Multiple"}))]}),t)}):null)}))}))})),!jn&&e(c,n({sx:{pt:0,pb:1.25,bgcolor:"#FFFFFF",flex:1,display:"flex",flexDirection:"column",minWidth:0}},{children:[On&&i(f,{content:En,overlayContent:An,sxStyles:nn,highlights:ge,maintainRelativeOrder:en,highlightBg:ee,suppressHighlightBg:Bn,deviationBadges:he,collisionKey:_n}),(z.subsections||[]).map(function(n,e){return ln({section:n,keyPath:"".concat(G,"-").concat(e),depth:0,columnKey:L,parentNodeId:U,sectionOffset:Vn,rhsOrphanVisualIndexes:le})})]}))]})),Y&&(null==xe?void 0:xe.showBelow)&&i("div",n({style:{position:"sticky",bottom:0,height:"0px",cursor:"pointer"},onClick:function(){var n,e;return null===(e=null===(n=null==xe?void 0:xe.showBelowRef)||void 0===n?void 0:n.current)||void 0===e?void 0:e.scrollIntoView({behavior:"smooth",block:"center"})}},{children:i("div",n({style:n({transform:"translateY(-50%) translateX(calc(100% ".concat("left"===L?"+":"-"," 130px))"),position:"absolute",paddingBottom:"20px"},"left"===L?{right:"-20px"}:{left:"-20px"})},{children:i(v,{color:(null===(K=null==xe?void 0:xe.showBelowRef)||void 0===K?void 0:K.current)?window.getComputedStyle(xe.showBelowRef.current).color:void 0})}))}))]}),"".concat(L,"-sec-").concat(G))};export{_ as default};
|
|
1
|
+
import{__assign as n}from"tslib";import{jsxs as e,jsx as i}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{useCompareContext as p}from"../CompareContext.js";import{hasValue as h,hasMeaningfulRedlineTags as g,stripRedlineTags as x,hasSingleMappedLhsSection as m,generateColorPalette as I,isMissingStr as y,getRhsMappedSectionNumber as b,safeStringify as w,DEVIATION_BADGE_SEPARATOR as S}from"../CognitiveComparehelpers.js";import{DEFAULT_DEVIAION_COLOR as R}from"../CognitiveCompareConstants.js";var _=function(_){var F,k,N,M,B,C,E,A,O,j,W,T,D,P,K,z=_.section,G=_.idx,L=_.columnKey,X=_.colRef,H=_.mb,V=void 0===H?1:H,Y=_.isExpanded,q=_.onToggle,J=_.navigation,Q=_.parentNodeId,U=void 0===Q?"":Q,Z=p(),$=Z.showOpenNodeRef,nn=Z.resolvedMarkdownStyles,en=Z.maintainRelativeOrder,on=Z.showDeviationBadges,tn=void 0!==on&&on,ln=Z.renderSubSectionAccordion,dn=Z.treeData,rn=Z.proposedSections,an=Z.existingSections,un=Z.deviationNumberRegistry,cn=Z.deviationParentRegistry,sn=Z.getBadgeRef,vn=Z.openSummaryPopup,fn=Z.getSectionCompareStyle,pn=Z.connectedSections,hn=Z.openMoreFunctionsPopup,gn=Z.isProposingFix,xn=Z.proposingFixNodeId,mn=Z.isRedlineFlow,In=Z.isSideBySide,yn=Z.activeSideBySideSection,bn=Z.scrollSyncLocked,wn=Z.unifiedNumbering,Sn=Z.toggleScrollSyncLocked,Rn=Z.summaryPopupAnchorEl,_n="".concat(In?"1":"0","-").concat(String(null!=yn?yn:"")),Fn=(null===(F=z.displayTitle)||void 0===F||F)&&h(z.title),kn=!(!gn||!xn||"left"!==L||z.id!==xn&&z.nodeId!==xn),Nn=g(z.content),Mn="boolean"==typeof mn?mn:Nn,Bn=Nn,Cn=Mn&&Nn,En=Cn?x(z.content):z.content,An=Cn?z.content:void 0,On=(null===(k=z.displayContent)||void 0===k||k||Nn)&&h(z.content),jn=!Fn&&!On,Wn=z.title;Fn||(Wn=On?"No Title Found":"No Matching Section Found");var Tn="left"===L&&(null!==(M=null===(N=null==z?void 0:z.refContentIds)||void 0===N?void 0:N.length)&&void 0!==M?M:1)>1,Dn="left"===L&&Wn.length>29?"".concat(Wn.slice(0,29).trimEnd(),"..."):Wn,Pn=z.evaluationResult;if(!Pn&&"right"===L)if(en){var Kn=null===(B=z.refIndexes)||void 0===B?void 0:B[0],zn=rn.find(function(n){return n.selfIndex===Kn});Pn=null==zn?void 0:zn.evaluationResult}else Pn=null===(C=rn[G])||void 0===C?void 0:C.evaluationResult;var Gn=null===(E=null==dn?void 0:dn.input_index_map)||void 0===E?void 0:E[0],Ln=null===(A=null==dn?void 0:dn.input_index_map)||void 0===A?void 0:A[1],Xn="left"===L?Ln:Gn,Hn=function(n,e){var i;if(!e||!n)return null;for(var o=0,t=n;o<t.length;o++){var l=t[o];if(l.id===e||l.nodeId===e||l.contentId===e)return l;if(null===(i=l.subsections)||void 0===i?void 0:i.length){var d=Hn(l.subsections,e);if(d)return d}}return null},Vn="left"===L?z:Hn(rn,z.id),Yn="right"===L?z:Hn(an,z.id),qn=o.useMemo(function(){if(!en)return 0;var n=1/0,e=function(n){var e=g(n)?x(n):n;return w(e||"").replace(/\\n/g,"\n")},i=function(o,t,l,d){if(o){var r=o.nodeId||o.id;if(d&&"right"===L){var a=rn.filter(function(n){var e;return null===(e=n.refIndexes)||void 0===e?void 0:e.includes(o.selfIndex)});a.length>0&&(r=a[0].nodeId||a[0].id)}var u=o.nodeId||o.id||(null==t?void 0:t.nodeId)||(null==t?void 0:t.id)||(null==l?void 0:l.nodeId)||(null==l?void 0:l.id),c=o.evaluationResult||(null==t?void 0:t.evaluationResult)||(null==l?void 0:l.evaluationResult),s=(null==c?void 0:c.deviations)||{};Object.keys(s).forEach(function(i){var d,a=null===(d=s[i])||void 0===d?void 0:d[U];if(function(n,i){if("string"!=typeof i||y(i))return!1;var o=e(null==n?void 0:n.content),t=e(i);return!!t&&o.includes(t)}("left"===L?t||o:l||o,a)){var c="".concat(r).concat(S).concat(i),v=null==un?void 0:un[c];null!=v&&v<n&&(n=v);var f="".concat(u).concat(S).concat(i),p=null==un?void 0:un[f];null!=p&&p<n&&(n=p)}});for(var v=o.subsections||[],f=(null==t?void 0:t.subsections)||[],p=(null==l?void 0:l.subsections)||[],h=Math.max(v.length,f.length,p.length),g=0;g<h;g++)i(v[g],f[g],p[g],!1)}},o="right"===L?rn.filter(function(n){var e;return null===(e=n.refIndexes)||void 0===e?void 0:e.includes(z.selfIndex)}):[];if(1===o.length){var t=o[0];(t.refIndexes||[]).map(function(n){return an.find(function(e){return e.selfIndex===n})}).filter(Boolean).forEach(function(n){i(n,t,n,!0)})}else i(z,Vn,Yn,!0);return n!==1/0?n-1:0},[z,Vn,Yn,L,U,un,en,rn,an]);if(en)if("left"===L){var Jn=null===(O=z.refIndexes)||void 0===O?void 0:O[0],Qn=an.findIndex(function(n){return n.selfIndex===Jn});Yn=-1!==Qn?an[Qn]:Hn(an,z.id)}else{var Un=null===(j=z.refIndexes)||void 0===j?void 0:j[0],Zn=rn.findIndex(function(n){return n.selfIndex===Un});Vn=-1!==Zn?rn[Zn]:Hn(rn,z.id)}var $n="left"===L?!Yn:!Vn,ne=en&&"right"===L&&m(z,rn),ee=Pn||(null==Vn?void 0:Vn.evaluationResult)||(null==Yn?void 0:Yn.evaluationResult),ie=null!==(D=null===(T=null===(W=null==ee?void 0:ee.evaluation_outputs)||void 0===W?void 0:W.metadata)||void 0===T?void 0:T.label_color)&&void 0!==D?D:R,oe=I(ie).highlightBg,te=(null==ee?void 0:ee.deviations)||{},le=z.nodeId||z.id;if(en&&"left"!==L){var de=rn.filter(function(n){var e;return null===(e=n.refIndexes)||void 0===e?void 0:e.includes(z.selfIndex)});de.length>0?le=de[0].nodeId||de[0].id:(null==Vn?void 0:Vn.id)&&(le=Vn.nodeId||Vn.id)}var re=o.useMemo(function(){var n,e=new Map;if(!en||"right"!==L)return e;var i=1,o=rn.filter(function(n){var e;return null===(e=n.refIndexes)||void 0===e?void 0:e.includes(z.selfIndex)}),t=1===o.length&&1===(null===(n=o[0].refIndexes)||void 0===n?void 0:n.length),l=function(n){return w(n||"").replace(/\\n/g,"\n")},d=function(n,e){var i=e?o[0]:Hn(rn,n.nodeId||n.id||n.contentId);return{lhsNode:i,evalResult:n.evaluationResult||(null==i?void 0:i.evaluationResult),registryNodeId:i?i.nodeId||i.id:n.nodeId||n.id}};if(t){var r=function(n,e){if(void 0===e&&(e=!1),n){var o=d(n,e),t=o.lhsNode,a=o.evalResult,u=o.registryNodeId,c=l(n.content);Object.entries((null==a?void 0:a.deviations)||{}).forEach(function(n){var e=n[0],o=n[1],d=o[U],r=l(d);if(!!t&&!y(o[Xn])&&r&&c.includes(r)){var a="".concat(u).concat(S).concat(e),s=un[a];null!=s&&(i=Math.max(i,Math.max(1,s-(qn||0))+1))}}),(n.subsections||[]).forEach(function(n){return r(n)})}};r(z,!0)}var a=function(n,o){if(void 0===o&&(o=!1),n){var t=d(n,o),r=t.lhsNode,u=t.evalResult,c=t.registryNodeId,s=(null==u?void 0:u.deviations)||{},v=l(n.content);Object.entries(s).map(function(n){var e,i=n[0],o=n[1],t=o[U],d=!r||y(o[Xn]),a=l(t),u=a?v.indexOf(a):-1,s="".concat(c).concat(S).concat(i);return{refId:s,isRenderable:d&&!!a&&!y(t),position:u,registryIndex:null!==(e=un[s])&&void 0!==e?e:Number.MAX_SAFE_INTEGER}}).filter(function(n){return n.isRenderable}).sort(function(n,e){return(-1===n.position?Number.MAX_SAFE_INTEGER:n.position)-(-1===e.position?Number.MAX_SAFE_INTEGER:e.position)||n.registryIndex-e.registryIndex}).forEach(function(n){e.set(n.refId,i++)}),(n.subsections||[]).forEach(function(n){return a(n)})}};return a(z,!0),e},[en,L,z,rn,U,Xn,un,qn]),ae=Object.keys(te)[0],ue=ae?"".concat(le).concat(S).concat(ae):null,ce=ue?null==cn?void 0:cn[ue]:null,se=G+1;if(en&&wn){var ve="left"===L?wn.leftNums.get(null==z?void 0:z.id):wn.rightNums.get(null==z?void 0:z.id);$n&&void 0!==ve?se=ve:null!=ce&&ce>=0?se=ce:void 0!==ve&&(se=ve)}else null!=ce&&ce>=0&&(se=ce);var fe=Object.entries(te).map(function(n){var e=n[0],i=n[1],o="".concat(le).concat(S).concat(e);return{deviationKey:e,deviationMap:i,refId:o,currentIndex:un[o]}}).filter(function(n){return void 0!==n.currentIndex&&null!==n.currentIndex});fe.sort(function(n,e){return n.currentIndex-e.currentIndex});var pe,he,ge=fe.map(function(e){var i,o,t,l,d,r,a=e.deviationKey,u=e.deviationMap,c=e.refId,s=e.currentIndex,v=u[U],f=y(v);if(f)v="";else if(!v)return null;var p=G,h=G;if(en)if("left"===L){var g=null===(i=z.refIndexes)||void 0===i?void 0:i[0],x=an.findIndex(function(n){return n.selfIndex===g});if(-1!==x)h=x;else{var m=an.findIndex(function(n){return n.id===z.id||n.nodeId===z.nodeId||n.contentId===z.contentId});h=-1!==m?m:G}}else{var w=null===(o=z.refIndexes)||void 0===o?void 0:o[0],R=rn.findIndex(function(n){return n.selfIndex===w});if(-1!==R)p=R;else p=-1!==(E=rn.findIndex(function(n){return n.id===z.id||n.nodeId===z.nodeId||n.contentId===z.contentId}))?E:G}var _="".concat(le).concat(S).concat(a).concat(S).concat(p).concat(S).concat(h),F=u[Xn],k=$n||y(F),N=re.get(c);en&&"right"===L&&k&&void 0!==N?s=N:en&&void 0!==qn&&("right"!==L||k||ne)&&(s-=qn),s=Math.max(1,s);var M=en&&"right"===L&&k&&wn?b({section:z,proposedSections:rn,leftNums:wn.leftNums,fallbackNumber:String(se),firstOnly:!0}):se,B="".concat(M,".").concat(s),C=G;if("right"===L&&en){var E,A=null===(t=z.refIndexes)||void 0===t?void 0:t[0],O=rn.findIndex(function(n){return n.selfIndex===A});if(-1!==O)C=O;else-1!==(E=rn.findIndex(function(n){return n.id===z.id||n.nodeId===z.nodeId||n.contentId===z.contentId}))&&(C=E)}var j=fn?fn(C):null,W=(null==u?void 0:u.evaluation_outputs)||(null==ee?void 0:ee.evaluation_outputs),T=null!==(l=null==W?void 0:W.output_value)&&void 0!==l?l:null,D=null!==(r=null===(d=null==W?void 0:W.metadata)||void 0===d?void 0:d.label_color)&&void 0!==r?r:ie,P=I(D),K=j?n(n({},j),{badgeBg:P.badgeBg,badgeBorder:P.badgeBorder,badgeText:P.badgeText}):n({},P),X=(null==u?void 0:u.deviation_summary)?{deviation_summary:u.deviation_summary,deviation_title:(null==u?void 0:u.deviation_title)||(null==ee?void 0:ee.deviation_title),deviation_impact:(null==u?void 0:u.deviation_impact)||(null==ee?void 0:ee.deviation_impact),deviation_explanation:(null==u?void 0:u.deviation_explanation)||(null==ee?void 0:ee.deviation_explanation),evaluation_outputs:W,cognitive_decisioning:(null==u?void 0:u.cognitive_decisioning)||(null==ee?void 0:ee.cognitive_decisioning)}:null,H=0,V=En||"";if(v&&V){var Y=V.split(/\n{2,}/),q=Y.findIndex(function(n){return n.includes(v)});if(-1!==q){var J=Object.entries(te).filter(function(n){n[0];var e=n[1][U];return e&&Y[q].includes(e)}).sort(function(n,e){return Y[q].indexOf(n[1][U])-Y[q].indexOf(e[1][U])}),Q=J.filter(function(n){n[0];var e=n[1][U];return e&&(e.includes(v)||v.includes(e))});Q.length>1&&(H=Math.max(0,Q.findIndex(function(n){return n[0]===a})))}}var Z=sn(L,c);return{id:c,actionId:_,label:B,highlight:v,side:L,style:K,stackIndex:H,score:T,isConnected:null==pn?void 0:pn.has(_),showScrollLockToggle:(null==pn?void 0:pn.has(_))||In&&yn===_||!!Rn&&Rn===Z.current,scrollSyncLocked:bn,toggleScrollSyncLocked:Sn,isOrphan:k,isMissingClause:f,badgeRef:Z,onClick:function(n){n.stopPropagation(),hn&&hn(n,Vn||{id:"orphan-left",title:"",content:""},k,Yn||{id:"orphan-right",title:"",content:""},_,K)},onSummaryClick:function(n){n.stopPropagation(),vn(n,_,k,X)}}}).filter(Boolean),xe=tn||!Mn&&kn?ge:[],me=ge.map(function(n){return n.highlight}).filter(Boolean),Ie=z.id&&L===(null==J?void 0:J.columnKey)?J:null,ye=o.useRef(!1);return t(function(){Y||(ye.current=!1)},[Y]),e(l,n({ref:X,sx:{mb:V,width:"100%",display:"flex",flexDirection:"column",position:"relative",minWidth:0}},{children:[Y&&(null==Ie?void 0:Ie.showAbove)&&i("div",n({style:{position:"sticky",top:0,height:"0px",cursor:"pointer"},onClick:function(){var n,e;return null===(e=null===(n=null==Ie?void 0:Ie.showAboveRef)||void 0===n?void 0:n.current)||void 0===e?void 0:e.scrollIntoView({behavior:"smooth",block:"center"})}},{children:i("div",n({style:n({transform:"translateY(-50%) translateX(calc(100% ".concat("left"===L?"+":"-"," 130px))"),position:"absolute",paddingTop:"20px"},"left"===L?{right:"-20px"}:{left:"-20px"})},{children:i(s,{color:(null===(P=null==Ie?void 0:Ie.showAboveRef)||void 0===P?void 0:P.current)?window.getComputedStyle(Ie.showAboveRef.current).color:void 0})}))})),e(d,n({disableGutters:!0,expanded:!jn&&Y,onChange:function(){jn||(q(),$.current=z.id)},sx:{boxShadow:"none",border:jn?"1px dashed #E2E8F0":"1px solid #E2E8F0",bgcolor:jn?"#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(r,n({expandIcon:jn?null:i(v,{size:16}),sx:{minHeight:"36px",flexShrink:0,cursor:jn?"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:Fn&&i(a,n({title:Wn,placement:"top"},{children:i(u,n({component:"div",sx:{fontSize:"12px",color:jn?"#94A3B8":"#19213D",fontWeight:jn?400:700,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0}},{children:(pe=Dn,he=Tn,void 0===he&&(he=!1),pe?w(pe).replace(/\\n/g,"\n").split(/(\*\*.*?\*\*)/g).map(function(o,t){return o.startsWith("**")&&o.endsWith("**")?i("strong",{children:o.slice(2,-2)},t):e("div",n({style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"8px",width:"100%"}},{children:[i("span",n({style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},{children:o})),he&&i("span",n({style:{display:"inline-flex",alignItems:"center",justifyContent:"center",padding:"0px 6px",borderRadius:"9999px",background:"#F3F4F6",border:"1px solid #D1D5DB",color:"#6B7280",fontSize:"9px",fontWeight:500,whiteSpace:"nowrap",flexShrink:0,lineHeight:1.4,marginRight:"4px"}},{children:"Multiple"}))]}),t)}):null)}))}))})),!jn&&e(c,n({sx:{pt:0,pb:1.25,bgcolor:"#FFFFFF",flex:1,display:"flex",flexDirection:"column",minWidth:0}},{children:[On&&i(f,{content:En,overlayContent:An,sxStyles:nn,highlights:me,maintainRelativeOrder:en,highlightBg:oe,suppressHighlightBg:Bn,deviationBadges:xe,collisionKey:_n}),(z.subsections||[]).map(function(n,e){return ln({section:n,keyPath:"".concat(G,"-").concat(e),depth:0,columnKey:L,parentNodeId:U,sectionOffset:qn,rhsOrphanVisualIndexes:re})})]}))]})),Y&&(null==Ie?void 0:Ie.showBelow)&&i("div",n({style:{position:"sticky",bottom:0,height:"0px",cursor:"pointer"},onClick:function(){var n,e;return null===(e=null===(n=null==Ie?void 0:Ie.showBelowRef)||void 0===n?void 0:n.current)||void 0===e?void 0:e.scrollIntoView({behavior:"smooth",block:"center"})}},{children:i("div",n({style:n({transform:"translateY(-50%) translateX(calc(100% ".concat("left"===L?"+":"-"," 130px))"),position:"absolute",paddingBottom:"20px"},"left"===L?{right:"-20px"}:{left:"-20px"})},{children:i(v,{color:(null===(K=null==Ie?void 0:Ie.showBelowRef)||void 0===K?void 0:K.current)?window.getComputedStyle(Ie.showBelowRef.current).color:void 0})}))}))]}),"".concat(L,"-sec-").concat(G))};export{_ as default};
|
|
2
2
|
//# sourceMappingURL=SectionAccordion.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as e}from"tslib";import{jsxs as t,jsx as i}from"react/jsx-runtime";import{ChevronDown as n}from"lucide-react";import{ButtonCognitiveIcon as o}from"../../../assests/svg/ButtonCognitiveIcon.js";import{getBentArrowPath as l,DEVIATION_BADGE_SEPARATOR as s}from"../CognitiveComparehelpers.js";import{DEFAULT_DEVIAION_COLOR as r}from"../CognitiveCompareConstants.js";import a from"./ThreeDotsLoader.js";import d from"./connectedLines.js";import{Box as c}from"@mui/material";function u(u){var g=u.svgContainerRef,p=u.svgDimensions,v=u.isResizing,h=u.overallConnector,y=u.rootDeviationStyle,f=u.lines,m=u.isSideBySide,x=u.activeSideBySideSection,b=u.isArrowVisible,S=u.maintainRelativeOrder,C=u.proposedSections,I=u.existingSections,w=u.cognitivePopup,B=u.activeBadgeId,P=u.closeCognitivePopup,R=u.setActiveBadgeId,j=u.openCognitivePopupFromState,D=u.buildSectionPopupState,k=u.connectedLines,K=u.pathRefs;return t("svg",e({ref:g,style:{position:"absolute",top:0,left:0,width:p.width||"100%",height:p.height||"100%",pointerEvents:"none",zIndex:10,overflow:"visible",opacity:v?0:1,transition:"opacity 0.15s ease-in-out"}},{children:[h&&i("g",{children:i("line",{x1:h.x1,y1:h.y,x2:h.x2,y2:h.y,stroke:y.badgeBorder,strokeWidth:"1.5"})}),f.map(function(d){var u,g,p,v,h,y,f,k=d.x1+.5*(d.x2-d.x1),K=(d.y1+d.y2)/2;if("Not Defined"===d.style.label&&!d.hasCognitive)return null;if(d.isSubSection?m&&x===d.subSectionKeyPath&&b:m&&x===d.sectionIdx&&b)return null;if(S)return null;var L=d.isSubSection?l(d.x1,d.y1,d.x2,d.y2):"M ".concat(d.x1," ").concat(d.y1," L ").concat(d.x2," ").concat(d.y2),T=C[d.sectionIdx]||{title:"",content:""},z=I[null!==(u=d.targetRightIdx)&&void 0!==u?u:d.sectionIdx]||{title:"",content:""};if(d.isSubSection&&d.subSectionKeyPath){var E=d.subSectionKeyPath.includes(s)?d.subSectionKeyPath.split(s):[],
|
|
1
|
+
import{__assign as e}from"tslib";import{jsxs as t,jsx as i}from"react/jsx-runtime";import{ChevronDown as n}from"lucide-react";import{ButtonCognitiveIcon as o}from"../../../assests/svg/ButtonCognitiveIcon.js";import{getBentArrowPath as l,DEVIATION_BADGE_SEPARATOR as s}from"../CognitiveComparehelpers.js";import{DEFAULT_DEVIAION_COLOR as r}from"../CognitiveCompareConstants.js";import a from"./ThreeDotsLoader.js";import d from"./connectedLines.js";import{Box as c}from"@mui/material";function u(u){var g=u.svgContainerRef,p=u.svgDimensions,v=u.isResizing,h=u.overallConnector,y=u.rootDeviationStyle,f=u.lines,m=u.isSideBySide,x=u.activeSideBySideSection,b=u.isArrowVisible,S=u.maintainRelativeOrder,C=u.proposedSections,I=u.existingSections,w=u.cognitivePopup,B=u.activeBadgeId,P=u.closeCognitivePopup,R=u.setActiveBadgeId,j=u.openCognitivePopupFromState,D=u.buildSectionPopupState,k=u.connectedLines,K=u.pathRefs,L=u.isGuidelineMode;return t("svg",e({ref:g,style:{position:"absolute",top:0,left:0,width:p.width||"100%",height:p.height||"100%",pointerEvents:"none",zIndex:10,overflow:"visible",opacity:v?0:1,transition:"opacity 0.15s ease-in-out"}},{children:[h&&i("g",{children:i("line",{x1:h.x1,y1:h.y,x2:h.x2,y2:h.y,stroke:y.badgeBorder,strokeWidth:"1.5"})}),f.map(function(d){var u,g,p,v,h,y,f,k=d.x1+.5*(d.x2-d.x1),K=(d.y1+d.y2)/2;if("Not Defined"===d.style.label&&!d.hasCognitive)return null;if(d.isSubSection?m&&x===d.subSectionKeyPath&&b:m&&x===d.sectionIdx&&b)return null;if(S)return null;var L=d.isSubSection?l(d.x1,d.y1,d.x2,d.y2):"M ".concat(d.x1," ").concat(d.y1," L ").concat(d.x2," ").concat(d.y2),T=C[d.sectionIdx]||{title:"",content:""},z=I[null!==(u=d.targetRightIdx)&&void 0!==u?u:d.sectionIdx]||{title:"",content:""};if(d.isSubSection&&d.subSectionKeyPath){var E=d.subSectionKeyPath.includes(s)?d.subSectionKeyPath.split(s):[],M=E[2]||d.subSectionKeyPath,A=E[3]||M,N=M.split("-").map(Number),O=A.split("-").map(Number),W=null,F=null;N.length>0&&(W=C[N[0]]||null),O.length>0&&(F=I[O[0]]||null);for(var G=(null==W?void 0:W.title)||"",_=(null==F?void 0:F.title)||"",V=1;V<N.length;V+=1)(null==W?void 0:W.subsections)&&(W=W.subsections[N[V]]||null);for(V=1;V<O.length;V+=1)(null==F?void 0:F.subsections)&&(F=F.subsections[O[V]]||null);W&&(T=e(e({},W),{title:G||W.title})),F&&(z=e(e({},F),{title:_||F.title}))}var q=!(null===(g=T.cognitiveData)||void 0===g?void 0:g.isMissingRationale)||Boolean(null===(v=null===(p=T.cognitiveData)||void 0===p?void 0:p.decisioning)||void 0===v?void 0:v.length),H=(null===(f=null===(y=null===(h=T.evaluationResult)||void 0===h?void 0:h.cognitive_decisioning)||void 0===y?void 0:y.decisioning_factors)||void 0===f?void 0:f.length)||!1,J=q||H;return t("g",{children:[i("path",{d:L,fill:"none",stroke:d.style.badgeBorder||"#E2E8F0",strokeWidth:"1.5"}),i("foreignObject",e({x:k-100,y:K-14,width:"200",height:"28",style:{pointerEvents:"auto",overflow:"visible"}},{children:i(c,e({sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},{children:t(c,e({onClick:function(e){e.stopPropagation(),J&&(w.open&&B===d.id?P():(R(d.id),j(D(e.currentTarget,T,z,d.sectionIdx,!1,d.style))))},sx:{display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",bgcolor:d.style.badgeBg,color:d.style.badgeText,border:"1px solid ".concat(d.style.badgeBorder),borderRadius:"12px",px:1.5,py:.5,fontWeight:600,textAlign:"center",whiteSpace:"nowrap",cursor:J?"pointer":"default"}},{children:[d.style.badgeText===r&&null==d.style.label?i(a,{color:d.style.badgeText}):null==d.style.label?null:"0"===String(d.style.label)?"Same":d.style.label,i(c,e({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:i(o,{})})),J&&i(n,{size:11,style:{transform:w.open&&B===d.id?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))}))]},d.id)}),i(d,{maintainRelativeOrder:S,connectedLines:k,pathRefs:K,isGuidelineMode:L})]}))}export{u as default};
|
|
2
2
|
//# sourceMappingURL=SvgConnectors.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as e}from"tslib";import{jsxs as t,Fragment as i,jsx as r}from"react/jsx-runtime";import{Box as n}from"@mui/material";import o from"./ScrollLockToggle.js";import{useCompareContext as l}from"../CompareContext.js";var d=function(d){var c=d.connectedLines,a=d.pathRefs,s=d.maintainRelativeOrder,u=l(),f=u.scrollSyncLocked,h=u.toggleScrollSyncLocked,g=u.isGuidelineMode;return t(i,{children:[c.map(function(i){var l,d,c,u,p=i.pathD,x=(null===(l=i.style)||void 0===l?void 0:l.badgeBorder)||"#6366F1",m="conn-marker-".concat(i.id),y="".concat(i.id,"-bg"),F="".concat(i.id,"-stroke"),b="".concat(i.id,"-btn"),k="".concat(i.id,"-number"),v=void 0!==i.x1?i.x1+40:0,w=void 0!==i.y1?i.y1:0;return t("g",{children:[r("defs",{children:r("clipPath",e({id:"connections-clip"},{children:r("marker",e({id:m,markerWidth:"8",markerHeight:"6",refX:"7",refY:"3",orient:"auto"},{children:r("polygon",{points:"0 0, 8 3, 0 6",fill:x})}))}))}),r("path",{ref:function(e){a.current[y]=e},d:p,fill:"none",stroke:"#FFFFFF",strokeWidth:"4",strokeOpacity:"0.7"}),r("path",{ref:function(e){a.current[F]=e},d:p,fill:"none",stroke:x,strokeWidth:"1.75",markerEnd:"url(#".concat(m,")")}),i.matchLabel&&t("g",e({ref:function(e){a.current[k]=e},transform:"translate(".concat(i.x2-42,", ").concat(i.y2,")"),style:{pointerEvents:"none",transition:"visibility 0ms"}},{children:[r("rect",{x:"-22",y:"-8",width:"44",height:"16",rx:"4",fill:"#FFFFFF"}),r("rect",{x:"-21",y:"-7",width:"42",height:"14",rx:"3",fill:(null===(d=i.style)||void 0===d?void 0:d.badgeBg)||"#FEF08A",stroke:x,strokeWidth:"1"}),r("text",e({x:"0",y:"3.5",fontSize:"9px",fontWeight:"bold",fontFamily:'"Plus Jakarta Sans", sans-serif',fill:(null===(c=i.style)||void 0===c?void 0:c.badgeText)||x,textAnchor:"middle"},{children:i.matchLabel}))]})),s&&void 0!==i.x1&&!g&&r("foreignObject",e({ref:function(e){a.current[b]=e},x:v-12,y:w-12,width:"24",height:"24",style:{pointerEvents:"auto",overflow:"visible"}},{children:r(n,e({onClick:function(e){e.stopPropagation(),h&&h(e)},sx:{display:"flex",justifyContent:"center",alignItems:"center",width:"100%",height:"100%",bgcolor:"#FFFFFF",borderRadius:"50%",border:"1px solid ".concat(x),cursor:"pointer",transition:"transform 0.2s ease","&:hover":{transform:"scale(1.05)",boxShadow:"0px 2px 4px rgba(0,0,0,0.1)"}}},{children:r(o,{locked:f,onToggle:h,color:(null===(u=i.style)||void 0===u?void 0:u.badgeText)||x,borderColor:"transparent",size:12})}))}))]},i.id)}),t("g",{children:[t("g",e({style:{transition:"visibility 0ms"}},{children:[r("path",{ref:function(e){return a.current["guideline-up-stroke"]=e},fill:"none",strokeWidth:"1.75",visibility:"hidden"}),t("g",e({ref:function(e){return a.current["guideline-up-badge"]=e},visibility:"hidden"},{children:[r("polygon",{ref:function(e){return a.current["guideline-up-arrow"]=e},points:"-4,0 0,-6 4,0"}),r("rect",{ref:function(e){return a.current["guideline-up-badge-rect"]=e},x:"-12",y:"3",width:"24",height:"15",rx:"4",fill:"#FFFFFF",strokeWidth:"1"}),r("text",{ref:function(e){return a.current["guideline-up-text"]=e},x:"0",y:"14",fontSize:"10px",fontWeight:"bold",fontFamily:'"Plus Jakarta Sans", sans-serif',textAnchor:"middle"})]}))]})),t("g",e({style:{transition:"visibility 0ms"}},{children:[r("path",{ref:function(e){return a.current["guideline-down-stroke"]=e},fill:"none",strokeWidth:"1.75",visibility:"hidden"}),t("g",e({ref:function(e){return a.current["guideline-down-badge"]=e},visibility:"hidden"},{children:[r("polygon",{ref:function(e){return a.current["guideline-down-arrow"]=e},points:"-4,0 0,6 4,0"}),r("rect",{ref:function(e){return a.current["guideline-down-badge-rect"]=e},x:"-12",y:"-18",width:"24",height:"15",rx:"4",fill:"#FFFFFF",strokeWidth:"1"}),r("text",{ref:function(e){return a.current["guideline-down-text"]=e},x:"0",y:"-7",fontSize:"10px",fontWeight:"bold",fontFamily:'"Plus Jakarta Sans", sans-serif',textAnchor:"middle"})]}))]}))]})]})};export{d as default};
|
|
1
|
+
import{__assign as e}from"tslib";import{jsxs as t,Fragment as i,jsx as r}from"react/jsx-runtime";import{Box as n}from"@mui/material";import o from"./ScrollLockToggle.js";import{useCompareContext as l}from"../CompareContext.js";var d=function(d){var c=d.connectedLines,a=d.pathRefs,s=d.maintainRelativeOrder,u=l(),f=u.scrollSyncLocked,h=u.toggleScrollSyncLocked,g=u.isGuidelineMode;return t(i,{children:[c.map(function(i){var l,d,c,u,p=i.pathD,x=(null===(l=i.style)||void 0===l?void 0:l.badgeBorder)||"#6366F1",m="conn-marker-".concat(i.id),y="".concat(i.id,"-bg"),F="".concat(i.id,"-stroke"),b="".concat(i.id,"-btn"),k="".concat(i.id,"-number"),v=void 0!==i.x1?i.x1+40:0,w=void 0!==i.y1?i.y1:0;return t("g",{children:[r("defs",{children:r("clipPath",e({id:"connections-clip"},{children:r("marker",e({id:m,markerWidth:"8",markerHeight:"6",refX:"7",refY:"3",orient:"auto"},{children:r("polygon",{points:"0 0, 8 3, 0 6",fill:x})}))}))}),r("path",{ref:function(e){a.current[y]=e},d:p,fill:"none",stroke:"#FFFFFF",strokeWidth:"4",strokeOpacity:"0.7"}),r("path",{ref:function(e){a.current[F]=e},d:p,fill:"none",stroke:x,strokeWidth:"1.75",markerEnd:"url(#".concat(m,")")}),g&&i.matchLabel&&t("g",e({ref:function(e){a.current[k]=e},transform:"translate(".concat(i.x2-42,", ").concat(i.y2,")"),style:{pointerEvents:"none",transition:"visibility 0ms"}},{children:[r("rect",{x:"-22",y:"-8",width:"44",height:"16",rx:"4",fill:"#FFFFFF"}),r("rect",{x:"-21",y:"-7",width:"42",height:"14",rx:"3",fill:(null===(d=i.style)||void 0===d?void 0:d.badgeBg)||"#FEF08A",stroke:x,strokeWidth:"1"}),r("text",e({x:"0",y:"3.5",fontSize:"9px",fontWeight:"bold",fontFamily:'"Plus Jakarta Sans", sans-serif',fill:(null===(c=i.style)||void 0===c?void 0:c.badgeText)||x,textAnchor:"middle"},{children:i.matchLabel}))]})),s&&void 0!==i.x1&&!g&&r("foreignObject",e({ref:function(e){a.current[b]=e},x:v-12,y:w-12,width:"24",height:"24",style:{pointerEvents:"auto",overflow:"visible"}},{children:r(n,e({onClick:function(e){e.stopPropagation(),h&&h(e)},sx:{display:"flex",justifyContent:"center",alignItems:"center",width:"100%",height:"100%",bgcolor:"#FFFFFF",borderRadius:"50%",border:"1px solid ".concat(x),cursor:"pointer",transition:"transform 0.2s ease","&:hover":{transform:"scale(1.05)",boxShadow:"0px 2px 4px rgba(0,0,0,0.1)"}}},{children:r(o,{locked:f,onToggle:h,color:(null===(u=i.style)||void 0===u?void 0:u.badgeText)||x,borderColor:"transparent",size:12})}))}))]},i.id)}),t("g",{children:[t("g",e({style:{transition:"visibility 0ms"}},{children:[r("path",{ref:function(e){return a.current["guideline-up-stroke"]=e},fill:"none",strokeWidth:"1.75",visibility:"hidden"}),t("g",e({ref:function(e){return a.current["guideline-up-badge"]=e},visibility:"hidden"},{children:[r("polygon",{ref:function(e){return a.current["guideline-up-arrow"]=e},points:"-4,0 0,-6 4,0"}),r("rect",{ref:function(e){return a.current["guideline-up-badge-rect"]=e},x:"-12",y:"3",width:"24",height:"15",rx:"4",fill:"#FFFFFF",strokeWidth:"1"}),r("text",{ref:function(e){return a.current["guideline-up-text"]=e},x:"0",y:"14",fontSize:"10px",fontWeight:"bold",fontFamily:'"Plus Jakarta Sans", sans-serif',textAnchor:"middle"})]}))]})),t("g",e({style:{transition:"visibility 0ms"}},{children:[r("path",{ref:function(e){return a.current["guideline-down-stroke"]=e},fill:"none",strokeWidth:"1.75",visibility:"hidden"}),t("g",e({ref:function(e){return a.current["guideline-down-badge"]=e},visibility:"hidden"},{children:[r("polygon",{ref:function(e){return a.current["guideline-down-arrow"]=e},points:"-4,0 0,6 4,0"}),r("rect",{ref:function(e){return a.current["guideline-down-badge-rect"]=e},x:"-12",y:"-18",width:"24",height:"15",rx:"4",fill:"#FFFFFF",strokeWidth:"1"}),r("text",{ref:function(e){return a.current["guideline-down-text"]=e},x:"0",y:"-7",fontSize:"10px",fontWeight:"bold",fontFamily:'"Plus Jakarta Sans", sans-serif',textAnchor:"middle"})]}))]}))]})]})};export{d as default};
|
|
2
2
|
//# sourceMappingURL=connectedLines.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CognitiveCompare.d.ts","sourceRoot":"","sources":["../../../../../src/features/CognitiveCompare/CognitiveCompare.tsx"],"names":[],"mappings":"AA0CA,OAAO,EAEL,qBAAqB,EAOtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAGL,sBAAsB,EACvB,MAAM,0BAA0B,CAAC;AA4BlC,QAAA,MAAM,gBAAgB,+UA4BnB,qBAAqB,
|
|
1
|
+
{"version":3,"file":"CognitiveCompare.d.ts","sourceRoot":"","sources":["../../../../../src/features/CognitiveCompare/CognitiveCompare.tsx"],"names":[],"mappings":"AA0CA,OAAO,EAEL,qBAAqB,EAOtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAGL,sBAAsB,EACvB,MAAM,0BAA0B,CAAC;AA4BlC,QAAA,MAAM,gBAAgB,+UA4BnB,qBAAqB,4CAupFvB,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;AAyBjD,OAAO,EAAsB,YAAY,EAAgB,MAAM,0BAA0B,CAAC;AAC1F,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"SectionAccordion.d.ts","sourceRoot":"","sources":["../../../../../../src/features/CognitiveCompare/components/SectionAccordion.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4B,MAAM,OAAO,CAAC;AAyBjD,OAAO,EAAsB,YAAY,EAAgB,MAAM,0BAA0B,CAAC;AAC1F,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAyF3E,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;CAC7C,CAAC;AAEF,QAAA,MAAM,gBAAgB,6FAUnB,qBAAqB,4CA22BvB,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -30,7 +30,8 @@ type SvgConnectorsProps = {
|
|
|
30
30
|
buildSectionPopupState: (anchorEl: HTMLElement | null, baseSec: SectionBlock | null, refSec: SectionBlock | null, sectionIdx: number | string, isOrphan?: boolean, style?: StyleVariant | null, rootNode?: boolean) => SectionPopupState;
|
|
31
31
|
connectedLines: Record<string, any>[];
|
|
32
32
|
pathRefs: React.MutableRefObject<Record<string, SVGPathElement | null>>;
|
|
33
|
+
isGuidelineMode?: boolean;
|
|
33
34
|
};
|
|
34
|
-
export default function SvgConnectors({ svgContainerRef, svgDimensions, isResizing, overallConnector, rootDeviationStyle, lines, isSideBySide, activeSideBySideSection, isArrowVisible, maintainRelativeOrder, proposedSections, existingSections, cognitivePopup, activeBadgeId, closeCognitivePopup, setActiveBadgeId, openCognitivePopupFromState, buildSectionPopupState, connectedLines, pathRefs, }: SvgConnectorsProps): import("react/jsx-runtime").JSX.Element;
|
|
35
|
+
export default function SvgConnectors({ svgContainerRef, svgDimensions, isResizing, overallConnector, rootDeviationStyle, lines, isSideBySide, activeSideBySideSection, isArrowVisible, maintainRelativeOrder, proposedSections, existingSections, cognitivePopup, activeBadgeId, closeCognitivePopup, setActiveBadgeId, openCognitivePopupFromState, buildSectionPopupState, connectedLines, pathRefs, isGuidelineMode, }: SvgConnectorsProps): import("react/jsx-runtime").JSX.Element;
|
|
35
36
|
export {};
|
|
36
37
|
//# sourceMappingURL=SvgConnectors.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SvgConnectors.d.ts","sourceRoot":"","sources":["../../../../../../src/features/CognitiveCompare/components/SvgConnectors.tsx"],"names":[],"mappings":";AAOA,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,YAAY,EACb,MAAM,0BAA0B,CAAC;AAgBlC,KAAK,kBAAkB,GAAG;IACxB,eAAe,EAAE,KAAK,CAAC,gBAAgB,CAAC,aAAa,GAAG,IAAI,CAAC,CAAC;IAC9D,aAAa,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IACjD,UAAU,EAAE,OAAO,CAAC;IACpB,gBAAgB,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAC/D,kBAAkB,EAAE;QAAE,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC;IAC5C,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,CAAC;IAC7B,YAAY,EAAE,OAAO,CAAC;IACtB,uBAAuB,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAChD,cAAc,EAAE,OAAO,CAAC;IACxB,qBAAqB,EAAE,OAAO,GAAG,SAAS,CAAC;IAC3C,gBAAgB,EAAE,YAAY,EAAE,CAAC;IACjC,gBAAgB,EAAE,YAAY,EAAE,CAAC;IACjC,cAAc,EAAE,iBAAiB,CAAC;IAClC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,mBAAmB,EAAE,MAAM,IAAI,CAAC;IAChC,gBAAgB,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC;IACtE,2BAA2B,EAAE,CAAC,SAAS,EAAE,iBAAiB,KAAK,IAAI,CAAC;IACpE,sBAAsB,EAAE,CACtB,QAAQ,EAAE,WAAW,GAAG,IAAI,EAC5B,OAAO,EAAE,YAAY,GAAG,IAAI,EAC5B,MAAM,EAAE,YAAY,GAAG,IAAI,EAC3B,UAAU,EAAE,MAAM,GAAG,MAAM,EAC3B,QAAQ,CAAC,EAAE,OAAO,EAClB,KAAK,CAAC,EAAE,YAAY,GAAG,IAAI,EAC3B,QAAQ,CAAC,EAAE,OAAO,KACf,iBAAiB,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,CAAC;IACtC,QAAQ,EAAE,KAAK,CAAC,gBAAgB,CAAC,MAAM,CAAC,MAAM,EAAE,cAAc,GAAG,IAAI,CAAC,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"SvgConnectors.d.ts","sourceRoot":"","sources":["../../../../../../src/features/CognitiveCompare/components/SvgConnectors.tsx"],"names":[],"mappings":";AAOA,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,YAAY,EACb,MAAM,0BAA0B,CAAC;AAgBlC,KAAK,kBAAkB,GAAG;IACxB,eAAe,EAAE,KAAK,CAAC,gBAAgB,CAAC,aAAa,GAAG,IAAI,CAAC,CAAC;IAC9D,aAAa,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IACjD,UAAU,EAAE,OAAO,CAAC;IACpB,gBAAgB,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAC/D,kBAAkB,EAAE;QAAE,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC;IAC5C,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,CAAC;IAC7B,YAAY,EAAE,OAAO,CAAC;IACtB,uBAAuB,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAChD,cAAc,EAAE,OAAO,CAAC;IACxB,qBAAqB,EAAE,OAAO,GAAG,SAAS,CAAC;IAC3C,gBAAgB,EAAE,YAAY,EAAE,CAAC;IACjC,gBAAgB,EAAE,YAAY,EAAE,CAAC;IACjC,cAAc,EAAE,iBAAiB,CAAC;IAClC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,mBAAmB,EAAE,MAAM,IAAI,CAAC;IAChC,gBAAgB,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC;IACtE,2BAA2B,EAAE,CAAC,SAAS,EAAE,iBAAiB,KAAK,IAAI,CAAC;IACpE,sBAAsB,EAAE,CACtB,QAAQ,EAAE,WAAW,GAAG,IAAI,EAC5B,OAAO,EAAE,YAAY,GAAG,IAAI,EAC5B,MAAM,EAAE,YAAY,GAAG,IAAI,EAC3B,UAAU,EAAE,MAAM,GAAG,MAAM,EAC3B,QAAQ,CAAC,EAAE,OAAO,EAClB,KAAK,CAAC,EAAE,YAAY,GAAG,IAAI,EAC3B,QAAQ,CAAC,EAAE,OAAO,KACf,iBAAiB,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,CAAC;IACtC,QAAQ,EAAE,KAAK,CAAC,gBAAgB,CAAC,MAAM,CAAC,MAAM,EAAE,cAAc,GAAG,IAAI,CAAC,CAAC,CAAC;IACxE,eAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EACpC,eAAe,EACf,aAAa,EACb,UAAU,EACV,gBAAgB,EAChB,kBAAkB,EAClB,KAAK,EACL,YAAY,EACZ,uBAAuB,EACvB,cAAc,EACd,qBAAqB,EACrB,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACd,aAAa,EACb,mBAAmB,EACnB,gBAAgB,EAChB,2BAA2B,EAC3B,sBAAsB,EACtB,cAAc,EACd,QAAQ,EACR,eAAe,GAChB,EAAE,kBAAkB,2CAmNpB"}
|
|
@@ -3,6 +3,7 @@ declare const ConnectedLinesComp: ({ connectedLines, pathRefs, maintainRelativeO
|
|
|
3
3
|
connectedLines: Record<string, any>[];
|
|
4
4
|
pathRefs: React.MutableRefObject<Record<string, any>>;
|
|
5
5
|
maintainRelativeOrder?: boolean | undefined;
|
|
6
|
+
isGuidelineMode?: boolean | undefined;
|
|
6
7
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
7
8
|
export default ConnectedLinesComp;
|
|
8
9
|
//# sourceMappingURL=connectedLines.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connectedLines.d.ts","sourceRoot":"","sources":["../../../../../../src/features/CognitiveCompare/components/connectedLines.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,QAAA,MAAM,kBAAkB;oBAKN,OAAO,MAAM,EAAE,GAAG,CAAC,EAAE;cAC3B,MAAM,gBAAgB,CAAC,OAAO,MAAM,EAAE,GAAG,CAAC,CAAC
|
|
1
|
+
{"version":3,"file":"connectedLines.d.ts","sourceRoot":"","sources":["../../../../../../src/features/CognitiveCompare/components/connectedLines.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,QAAA,MAAM,kBAAkB;oBAKN,OAAO,MAAM,EAAE,GAAG,CAAC,EAAE;cAC3B,MAAM,gBAAgB,CAAC,OAAO,MAAM,EAAE,GAAG,CAAC,CAAC;;;6CAuOtD,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
export declare const useCompareLayout: (initialMaintainOrder: boolean, scrollContainerRef: React.RefObject<HTMLDivElement>, lhsBadgeRefs: any, rhsBadgeRefs: any, proposedSections: any[], existingSections: any[]) => {
|
|
2
3
|
maintainRelativeOrder: boolean;
|
|
3
4
|
setMaintainRelativeOrder: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCompareLayout.d.ts","sourceRoot":"","sources":["../../../../../../src/features/CognitiveCompare/hooks/useCompareLayout.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,gBAAgB,yBACL,OAAO,sBACT,MAAM,SAAS,CAAC,cAAc,CAAC,gBACrC,GAAG,gBACH,GAAG,oBACC,GAAG,EAAE,oBACL,GAAG,EAAE;;;;;;;;;;;;;;;;;;;;;;CAkFxB,CAAC"}
|
|
1
|
+
{"version":3,"file":"useCompareLayout.d.ts","sourceRoot":"","sources":["../../../../../../src/features/CognitiveCompare/hooks/useCompareLayout.tsx"],"names":[],"mappings":";AAGA,eAAO,MAAM,gBAAgB,yBACL,OAAO,sBACT,MAAM,SAAS,CAAC,cAAc,CAAC,gBACrC,GAAG,gBACH,GAAG,oBACC,GAAG,EAAE,oBACL,GAAG,EAAE;;;;;;;;;;;;;;;;;;;;;;CAkFxB,CAAC"}
|