@viswa-test/test-citation 0.0.132 → 0.0.133
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/CompareContext.js +2 -0
- package/dist/cjs/features/CognitiveCompare/CompareContext.js.map +1 -0
- package/dist/cjs/features/CognitiveCompare/components/LHSSectionRow.js +2 -0
- package/dist/cjs/features/CognitiveCompare/components/LHSSectionRow.js.map +1 -0
- package/dist/cjs/features/CognitiveCompare/components/RHSSectionRow.js +2 -0
- package/dist/cjs/features/CognitiveCompare/components/RHSSectionRow.js.map +1 -0
- package/dist/cjs/features/CognitiveCompare/components/SectionAccordion.js +1 -1
- package/dist/cjs/features/CognitiveCompare/components/SubSectionAccordion.js +1 -1
- package/dist/cjs/features/CognitiveCompare/components/SvgConnectors.js +2 -0
- package/dist/cjs/features/CognitiveCompare/components/SvgConnectors.js.map +1 -0
- package/dist/cjs/features/CognitiveCompare/hooks/useComparePopups.js +1 -1
- package/dist/cjs/features/CognitiveCompare/hooks/useLinesCalculator.js +2 -0
- package/dist/cjs/features/CognitiveCompare/hooks/useLinesCalculator.js.map +1 -0
- package/dist/cjs/features/CognitiveCompare/hooks/useResizeHandler.js +2 -0
- package/dist/cjs/features/CognitiveCompare/hooks/useResizeHandler.js.map +1 -0
- package/dist/cjs/features/CognitiveCompare/hooks/useSideBySide.js +2 -0
- package/dist/cjs/features/CognitiveCompare/hooks/useSideBySide.js.map +1 -0
- package/dist/cjs/features/CognitiveCompare/hooks/useStyles.js +2 -0
- package/dist/cjs/features/CognitiveCompare/hooks/useStyles.js.map +1 -0
- package/dist/cjs/features/CognitiveInternalgptReasoning/CognitiveInternalgptCoreComponent.js +2 -0
- package/dist/cjs/features/CognitiveInternalgptReasoning/CognitiveInternalgptCoreComponent.js.map +1 -0
- package/dist/cjs/features/CognitiveInternalgptReasoning/CognitiveInternalgptReasoningComponent.js +1 -1
- package/dist/cjs/features/CognitiveInternalgptReasoning/CognitiveNonWebSearchReasoning.module.css.js +1 -1
- package/dist/cjs/features/IngestionStatus/IngestionStatusComponent.js +2 -0
- package/dist/cjs/features/IngestionStatus/IngestionStatusComponent.js.map +1 -0
- package/dist/cjs/features/IngestionStatus/ingestion.module.css.js +2 -0
- package/dist/cjs/features/IngestionStatus/ingestion.module.css.js.map +1 -0
- package/dist/cjs/features/IngestionStatus/useIngestionStatus.js +2 -0
- package/dist/cjs/features/IngestionStatus/useIngestionStatus.js.map +1 -0
- package/dist/cjs/features/SplitterCitations/Splitter.module.css.js +1 -1
- package/dist/cjs/features/SplitterCitations/SplitterCitationsComponent.js +1 -1
- package/dist/cjs/features/TextualGuidelines/TextualGuideLinesComponent.js +2 -0
- package/dist/cjs/features/TextualGuidelines/TextualGuideLinesComponent.js.map +1 -0
- package/dist/cjs/features/TextualGuidelines/TextualGuidelines.module.css.js +2 -0
- package/dist/cjs/features/TextualGuidelines/TextualGuidelines.module.css.js.map +1 -0
- package/dist/cjs/index.js +1 -1
- package/dist/features/CognitiveCompare/CognitiveCompare.js +1 -1
- package/dist/features/CognitiveCompare/CompareContext.js +2 -0
- package/dist/features/CognitiveCompare/CompareContext.js.map +1 -0
- package/dist/features/CognitiveCompare/components/LHSSectionRow.js +2 -0
- package/dist/features/CognitiveCompare/components/LHSSectionRow.js.map +1 -0
- package/dist/features/CognitiveCompare/components/RHSSectionRow.js +2 -0
- package/dist/features/CognitiveCompare/components/RHSSectionRow.js.map +1 -0
- package/dist/features/CognitiveCompare/components/SectionAccordion.js +1 -1
- package/dist/features/CognitiveCompare/components/SubSectionAccordion.js +1 -1
- package/dist/features/CognitiveCompare/components/SvgConnectors.js +2 -0
- package/dist/features/CognitiveCompare/components/SvgConnectors.js.map +1 -0
- package/dist/features/CognitiveCompare/hooks/useComparePopups.js +1 -1
- package/dist/features/CognitiveCompare/hooks/useLinesCalculator.js +2 -0
- package/dist/features/CognitiveCompare/hooks/useLinesCalculator.js.map +1 -0
- package/dist/features/CognitiveCompare/hooks/useResizeHandler.js +2 -0
- package/dist/features/CognitiveCompare/hooks/useResizeHandler.js.map +1 -0
- package/dist/features/CognitiveCompare/hooks/useSideBySide.js +2 -0
- package/dist/features/CognitiveCompare/hooks/useSideBySide.js.map +1 -0
- package/dist/features/CognitiveCompare/hooks/useStyles.js +2 -0
- package/dist/features/CognitiveCompare/hooks/useStyles.js.map +1 -0
- package/dist/features/CognitiveInternalgptReasoning/CognitiveInternalgptCoreComponent.js +2 -0
- package/dist/features/CognitiveInternalgptReasoning/CognitiveInternalgptCoreComponent.js.map +1 -0
- package/dist/features/CognitiveInternalgptReasoning/CognitiveInternalgptReasoningComponent.js +1 -1
- package/dist/features/CognitiveInternalgptReasoning/CognitiveNonWebSearchReasoning.module.css.js +1 -1
- package/dist/features/IngestionStatus/IngestionStatusComponent.js +2 -0
- package/dist/features/IngestionStatus/IngestionStatusComponent.js.map +1 -0
- package/dist/features/IngestionStatus/ingestion.module.css.js +2 -0
- package/dist/features/IngestionStatus/ingestion.module.css.js.map +1 -0
- package/dist/features/IngestionStatus/useIngestionStatus.js +2 -0
- package/dist/features/IngestionStatus/useIngestionStatus.js.map +1 -0
- package/dist/features/SplitterCitations/Splitter.module.css.js +1 -1
- package/dist/features/SplitterCitations/SplitterCitationsComponent.js +1 -1
- package/dist/features/TextualGuidelines/TextualGuideLinesComponent.js +2 -0
- package/dist/features/TextualGuidelines/TextualGuideLinesComponent.js.map +1 -0
- package/dist/features/TextualGuidelines/TextualGuidelines.module.css.js +2 -0
- package/dist/features/TextualGuidelines/TextualGuidelines.module.css.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/types/src/features/CognitiveCompare/CognitiveCompare.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/CognitiveCompareTypes.d.ts +1 -0
- package/dist/types/src/features/CognitiveCompare/CognitiveCompareTypes.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/CompareContext.d.ts +64 -0
- package/dist/types/src/features/CognitiveCompare/CompareContext.d.ts.map +1 -0
- package/dist/types/src/features/CognitiveCompare/components/LHSSectionRow.d.ts +9 -0
- package/dist/types/src/features/CognitiveCompare/components/LHSSectionRow.d.ts.map +1 -0
- package/dist/types/src/features/CognitiveCompare/components/RHSSectionRow.d.ts +9 -0
- package/dist/types/src/features/CognitiveCompare/components/RHSSectionRow.d.ts.map +1 -0
- package/dist/types/src/features/CognitiveCompare/components/SectionAccordion.d.ts +2 -30
- package/dist/types/src/features/CognitiveCompare/components/SectionAccordion.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/components/SubSectionAccordion.d.ts +1 -24
- package/dist/types/src/features/CognitiveCompare/components/SubSectionAccordion.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/components/SvgConnectors.d.ts +36 -0
- package/dist/types/src/features/CognitiveCompare/components/SvgConnectors.d.ts.map +1 -0
- package/dist/types/src/features/CognitiveCompare/hooks/useCompareLayout.d.ts +0 -1
- package/dist/types/src/features/CognitiveCompare/hooks/useCompareLayout.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/hooks/useComparePopups.d.ts +2 -0
- package/dist/types/src/features/CognitiveCompare/hooks/useComparePopups.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/hooks/useLinesCalculator.d.ts +27 -0
- package/dist/types/src/features/CognitiveCompare/hooks/useLinesCalculator.d.ts.map +1 -0
- package/dist/types/src/features/CognitiveCompare/hooks/useResizeHandler.d.ts +5 -0
- package/dist/types/src/features/CognitiveCompare/hooks/useResizeHandler.d.ts.map +1 -0
- package/dist/types/src/features/CognitiveCompare/hooks/useSectionRefs.d.ts +1 -2
- package/dist/types/src/features/CognitiveCompare/hooks/useSectionRefs.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/hooks/useSideBySide.d.ts +34 -0
- package/dist/types/src/features/CognitiveCompare/hooks/useSideBySide.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/hooks/useStyles.d.ts +14 -0
- package/dist/types/src/features/CognitiveCompare/hooks/useStyles.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveInternalgptReasoning/CognitiveInternalgptCoreComponent.d.ts +16 -0
- package/dist/types/src/features/CognitiveInternalgptReasoning/CognitiveInternalgptCoreComponent.d.ts.map +1 -0
- package/dist/types/src/features/CognitiveInternalgptReasoning/CognitiveInternalgptReasoningComponent.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveInternalgptReasoning/CognitiveInternalgptReasoningTest.d.ts +2 -0
- package/dist/types/src/features/CognitiveInternalgptReasoning/CognitiveInternalgptReasoningTest.d.ts.map +1 -1
- package/dist/types/src/features/IngestionStatus/IngestionStatusComponent.d.ts +26 -0
- package/dist/types/src/features/IngestionStatus/IngestionStatusComponent.d.ts.map +1 -0
- package/dist/types/src/features/IngestionStatus/IngestionStatusComponentTest.d.ts +7 -0
- package/dist/types/src/features/IngestionStatus/IngestionStatusComponentTest.d.ts.map +1 -0
- package/dist/types/src/features/IngestionStatus/useIngestionStatus.d.ts +40 -0
- package/dist/types/src/features/IngestionStatus/useIngestionStatus.d.ts.map +1 -0
- package/dist/types/src/features/SplitterCitations/SplitterCitationsComponent.d.ts +2 -0
- package/dist/types/src/features/SplitterCitations/SplitterCitationsComponent.d.ts.map +1 -1
- package/dist/types/src/features/SplitterCitations/SplitterCitationsTest.d.ts.map +1 -1
- package/dist/types/src/features/TextualGuidelines/TextualGudelinesTest.d.ts +5 -0
- package/dist/types/src/features/TextualGuidelines/TextualGudelinesTest.d.ts.map +1 -0
- package/dist/types/src/features/TextualGuidelines/TextualGuideLinesComponent.d.ts +13 -0
- package/dist/types/src/features/TextualGuidelines/TextualGuideLinesComponent.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +5 -0
- package/dist/types/src/index.d.ts.map +1 -1
- package/package.json +50 -11
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),t=require("react"),i=require("@mui/material"),o=require("lucide-react"),l=require("../../assests/svg/ButtonCognitiveIcon.js"),r=require("./OverlayComponent.js"),u=require("./CognitiveComparehelpers.js"),c=require("./CognitiveCompareConfig.js"),a=require("./CognitiveCompareConstants.js"),s=require("./CognitivePopup.js"),d=require("./MoreFunctionsPopup.js"),v=require("./LoaderComponent.js"),f=require("./components/ThreeDotsLoader.js"),g=require("./hooks/useCompareData.js"),p=require("./hooks/useComparePopups.js"),h=require("./hooks/useSectionRefs.js"),x=require("./hooks/useAccordionState.js"),m=require("./hooks/useDeviationNavigation.js"),_=require("./components/CompareHeader.js"),R=require("./components/SectionAccordion.js"),y=require("./components/SubSectionAccordion.js"),b=require("./components/CognitiveSummaryPopup.js"),S=require("./components/connectedLines.js");exports.SHARED_MARKDOWN_STYLES=c.SHARED_MARKDOWN_STYLES,exports.default=function(A){var I,E,T,B,C,D,O,w,N,j,P,F,M,k,L,V,H,q,G,z,W,K,Y,U,X,$,J=A.componentHeaderText,Q=void 0===J?a.DEFAULT_COMPONENT_HEADER_TEXT:J,Z=A.treeData,ee=A.comparisonConfig,ne=A.leftColumnTitleText,te=A.rightColumnTitleText,ie=A.markdownStyles,oe=A.resetTrigger,le=A.displayConfig,re=void 0===le?{isHeaderVisible:!0,isToggleVisible:!0,maintainRelativeOrder:!1,isLoading:!0,showDeviationBadges:!1,enableDeviationSchemaBackwardCompatibility:!1}:le,ue=A.popupConfig,ce=A.deviationData,ae=void 0===ce?{}:ce,se=A.deviationNodeIdToView,de=A.resetDeviationNodeId,ve=A.isProposingFix,fe=void 0!==ve&&ve,ge=A.proposingFixNodeId,pe=A.isRedlineFlow,he=t.useState(re.maintainRelativeOrder),xe=he[0],me=he[1],_e=!!xe||!!(null==re?void 0:re.showDeviationBadges),Re=t.useState(!1),ye=Re[0],be=Re[1],Se=t.useState(!1),Ae=Se[0],Ie=Se[1],Ee=t.useState(null),Te=Ee[0],Be=Ee[1],Ce=t.useState(!1),De=Ce[0],Oe=Ce[1],we=t.useState(null===(E=null!==(I=null==Z?void 0:Z.newEvaluationResult)&&void 0!==I?I:null==re?void 0:re.enableDeviationSchemaBackwardCompatibility)||void 0===E||E)[0],Ne=t.useState(!1),je=Ne[0],Pe=Ne[1],Fe=t.useState(!1),Me=Fe[0],ke=Fe[1],Le=t.useState(null),Ve=Le[0],He=Le[1],qe=t.useRef(!1),Ge=t.useState(new Set),ze=Ge[0],We=Ge[1],Ke=t.useState([]),Ye=Ke[0],Ue=Ke[1],Xe=t.useRef(null),$e=t.useRef(null),Je=t.useRef(null),Qe=t.useRef(new Set),Ze=t.useRef(!1),en=t.useRef(null),nn=t.useRef({}),tn=t.useRef([]),on=t.useRef(!1),ln=t.useRef(!1),rn=t.useRef(null),un=t.useRef(function(){}),cn=t.useMemo(function(){return(null==Z?void 0:Z.cognitive_decisioning)||{}},[Z]),an=t.useState({width:0,height:0}),sn=an[0],dn=an[1],vn=t.useMemo(function(){return e.__assign(e.__assign({},c.SHARED_MARKDOWN_STYLES),ie)},[ie]),fn=t.useRef(null),gn=t.useRef(null),pn=t.useRef(null),hn=t.useRef(null),xn=t.useRef(null),mn=t.useRef(null),_n=t.useRef(null),Rn=t.useRef(null),yn=t.useRef(!1),bn=t.useRef(null),Sn=t.useRef(null),An=p.useComparePopups(fn),In=An.cognitivePopup,En=An.setCognitivePopup,Tn=An.moreFunctions,Bn=An.setMoreFunctions,Cn=An.position,Dn=An.setPosition,On=An.activeBadgeId,wn=An.summaryPopup,Nn=An.setSummaryPopup,jn=An.closeSummaryPopup,Pn=An.setActiveBadgeId,Fn=An.popupRef,Mn=An.closeCognitivePopup,kn=An.closeMoreFunctionsPopup,Ln=t.useMemo(function(){var e,n,t,i,o,l,r;return{fields:null!==(e=null==ee?void 0:ee.fields)&&void 0!==e?e:c.DEFAULT_FIELD_CONFIG,thresholds:{high:null!==(t=null===(n=null==ee?void 0:ee.thresholds)||void 0===n?void 0:n.high)&&void 0!==t?t:c.DEFAULT_COMPARISON_CONFIG.thresholds.high,medium:null!==(o=null===(i=null==ee?void 0:ee.thresholds)||void 0===i?void 0:i.medium)&&void 0!==o?o:c.DEFAULT_COMPARISON_CONFIG.thresholds.medium,exact:null!==(r=null===(l=null==ee?void 0:ee.thresholds)||void 0===l?void 0:l.exact)&&void 0!==r?r:c.DEFAULT_COMPARISON_CONFIG.thresholds.exact}}},[ee]),Vn=t.useState(null),Hn=Vn[0];Vn[1];var qn=null===(C=null===(T=null==Z?void 0:Z.documents)||void 0===T?void 0:T[null===(B=null==Z?void 0:Z.input_index_map)||void 0===B?void 0:B[0]])||void 0===C?void 0:C.title,Gn=null===(w=null===(D=null==Z?void 0:Z.documents)||void 0===D?void 0:D[null===(O=null==Z?void 0:Z.input_index_map)||void 0===O?void 0:O[1]])||void 0===w?void 0:w.title,zn=u.safeStringify(ne||qn||"Uploaded Contract"),Wn=u.safeStringify(te||Gn||"Reference Template"),Kn=g.useCognitiveTreeData(Z,xe,ae,Ln,we),Yn=Kn.activeProposed,Un=Kn.existingRule,Xn=Kn.proposedSections,$n=Kn.existingSections,Jn=Kn.visibleFields,Qn=Kn.parentDeviationRecord,Zn=Kn.deviationNumberRegistry,et=Kn.parseError;t.useEffect(function(){et&&Be("Failed to load comparison: ".concat(et))},[et]);var nt=Xn.length>0||$n.length>0,tt=t.useMemo(function(){if(!pe)return"off";var e=0,n=0,t=function(i){Array.isArray(i)&&i.forEach(function(i){var o,l=(null==i?void 0:i.content)||"";u.hasMeaningfulRedlineTags(l)&&(e+=1,n+=String(l).length),(null===(o=null==i?void 0:i.subsections)||void 0===o?void 0:o.length)&&t(i.subsections)})};return t(Xn),t($n),"".concat(e,":").concat(n)},[pe,Xn,$n]);t.useEffect(function(){pe&&"off"!==tt&&"0:0"!==tt&&($e.current=null,tn.current=[],requestAnimationFrame(function(){var e;null===(e=un.current)||void 0===e||e.call(un)}))},[pe,tt]);var it=t.useMemo(function(){var e=new Map,n=new Map,t=1;if(xe)Xn.forEach(function(n){!n.title&&!n.content||n.id&&e.set(n.id,t++)}),$n.forEach(function(i){if(i.id){var o=Xn.filter(function(e){var n;return null===(n=e.refIndexes)||void 0===n?void 0:n.includes(i.selfIndex)});if(o.length>0){var l=o.map(function(n){return e.get(n.id)}).filter(Boolean);n.set(i.id,l.join(", "))}else n.set(i.id,String(t++))}});else for(var i=Math.max(Xn.length,$n.length),o=0;o<i;o++){var l=Xn[o],r=$n[o];l?(e.set(l.id,t),r&&n.set(r.id,String(t)),t++):r&&n.set(r.id,String(t++))}return{leftNums:e,rightNums:n}},[Xn,$n,xe]),ot=h.useSectionRefs(Jn.map(function(e){return e.key}),Math.max(Xn.length,$n.length)),lt=ot.leftRefs,rt=ot.rightRefs,ut=ot.sectionLeftRefs,ct=ot.sectionRightRefs,at=ot.lhsBadgeRefs,st=ot.rhsBadgeRefs,dt=ot.sectionRightRowRefs,vt=ot.subSectionLeftRefs,ft=ot.subSectionRightRefs,gt=ot.sectionRowRefs,pt=ot.getSectionRowRef,ht=ot.getSubSectionRef,xt=ot.getBadgeRef,mt=Un.analysis,_t=u.safeStringify(null===(j=null===(N=null==mt?void 0:mt.rule_difference_comparison)||void 0===N?void 0:N.summary)||void 0===j?void 0:j.overall_summary),Rt=!!_t.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),yt=null!==(P=null==Z?void 0:Z.base_root_id)&&void 0!==P?P:"-1";null==Z||Z[yt];var bt=we?null!==(Y=null!==(z=ae&&(null===(G=null==ae?void 0:ae[yt])||void 0===G?void 0:G.evaluation_result))&&void 0!==z?z:null===(K=null===(W=null==Z?void 0:Z.nodes)||void 0===W?void 0:W[yt])||void 0===K?void 0:K.evaluation_result)&&void 0!==Y?Y:null:null!==(q=null!==(k=ae&&(null===(M=null===(F=null==ae?void 0:ae[yt])||void 0===F?void 0:F.evaluation_result)||void 0===M?void 0:M[0]))&&void 0!==k?k:null===(H=null===(V=null===(L=null==Z?void 0:Z.nodes)||void 0===L?void 0:L[yt])||void 0===V?void 0:V.evaluation_result)||void 0===H?void 0:H[0])&&void 0!==q?q:null,St=u.extractDeviationScore(bt),At=u.generateColorPalette(null!==($=null===(X=null===(U=null==bt?void 0:bt.evaluation_outputs)||void 0===U?void 0:U.metadata)||void 0===X?void 0:X.label_color)&&void 0!==$?$:""),It=function(){Qe.current.forEach(function(e){u.resetClauseHighlight(e)}),Qe.current.clear()},Et=t.useCallback(function(){var e,n,t,i,o,l;It(),Oe(!1),ln.current=!1,$e.current=null;var r=rn.current,c=Wt.current;if(null!==r)if("string"==typeof r&&r.includes(u.DEVIATION_BADGE_SEPARATOR)){var a=r.split(u.DEVIATION_BADGE_SEPARATOR);(s=(null===(e=vt.current[a[2]])||void 0===e?void 0:e.current)||(null===(n=ut.current[Number(a[2])])||void 0===n?void 0:n.current))&&(s.style.paddingTop="0px")}else{var s;(s=null===(t=ut.current[r])||void 0===t?void 0:t.current)&&(s.style.paddingTop="0px")}if(null!==c)if("string"==typeof c&&c.includes(u.DEVIATION_BADGE_SEPARATOR)){a=c.split(u.DEVIATION_BADGE_SEPARATOR);(d=(null===(i=ft.current[a[3]])||void 0===i?void 0:i.current)||(null===(o=ct.current[Number(a[3])])||void 0===o?void 0:o.current))&&(d.style.paddingTop="0px")}else{var d;(d=null===(l=ct.current[c])||void 0===l?void 0:l.current)&&(d.style.paddingTop="0px")}He(null),rn.current=null,Wt.current=null,Pe(!1),Ie(!1),hn.current&&(hn.current.style.height="0px"),xn.current&&(xn.current.style.height="0px"),mn.current&&(mn.current.style.height="0px"),_n.current&&(_n.current.style.height="0px")},[]),Tt=t.useCallback(function(){It(),Et(),We(new Set),Ue([]),tn.current=[],Jt([]),ei(null),Nn(a.EMPTY_SUMMARY_POPUP_STATE),Mn(),requestAnimationFrame(function(){var e;null===(e=un.current)||void 0===e||e.call(un)})},[]),Bt=t.useRef(Tt);t.useEffect(function(){Bt.current=Tt},[Tt]),t.useEffect(function(){oe&&Bt.current()},[oe]);var Ct=x.useAccordionState({maintainRelativeOrder:!!xe,proposedSections:Xn,existingSections:$n,activeSideBySideSection:Ve,connectedSections:ze,resetSideBySide:Et,setConnectedSections:We,setConnectedLines:Ue,cachedConnectedPositions:tn,svgContainerRef:Xe,isAnimatingRef:Ze,animationTimerRef:en,calculateLinesRef:un,sectionLeftRefs:ut,sectionRightRefs:ct,subSectionLeftRefs:vt,subSectionRightRefs:ft}),Dt=Ct.expandedSections,Ot=Ct.setExpandedSections,wt=Ct.expandedSubSections,Nt=Ct.setExpandedSubSections,jt=Ct.toggleSection,Pt=t.useCallback(function(n,t,i,o,l,r,c){var a,s,d,v=u.safeStringify(null==t?void 0:t.id)||u.safeStringify(null==i?void 0:i.id)||"",f=(v?cn[v]:null)||(null==t?void 0:t.cognitiveData)||(null==i?void 0:i.cognitiveData)||{section_id:v,decisioning:[],gap:[],relevance_score:0},g=null!==(s=null===(a=gt.current[o])||void 0===a?void 0:a.current)&&void 0!==s?s:null;return{isLoading:null!==(d=null==re?void 0:re.isLoading)&&void 0!==d&&d,open:!0,sectionTitle:(null==t?void 0:t.title)?null==t?void 0:t.title:"No Counterpart",refSectionTitle:(null==i?void 0:i.title)?null==i?void 0:i.title:"No Counterpart",cognitiveData:f,anchorEl:n,sectionAnchorEl:g,badgeStyle:r||null,sectionIdx:o,docData:{documents:null==Z?void 0:Z.documents,input_index_map:null==Z?void 0:Z.input_index_map},deviationData:function(){var n,l,r=(null==t?void 0:t.evaluationResult)||(null==i?void 0:i.evaluationResult)||null,c=function(n){var t=function(e){if(!e||"object"!=typeof e)return null;var n=null==e?void 0:e.deviation_entries;if(n&&"object"==typeof n){var t=Object.keys(n).sort(function(e,n){return Number(e)-Number(n)})[0];if(t&&n[t])return n[t]}var i=Object.keys(e).filter(function(e){return/^\d+$/.test(e)}).sort(function(e,n){return Number(e)-Number(n)});if(i.length&&e[i[0]])return e[i[0]];var o=null==e?void 0:e.deviations;if(o&&"object"==typeof o){var l=Object.keys(o).sort(function(e,n){return Number(e)-Number(n)})[0];if(l&&o[l])return o[l]}return null}(n);return t?e.__assign(e.__assign({},n),{deviation_summary:(null==n?void 0:n.deviation_summary)||(null==t?void 0:t.deviation_summary),deviation_title:(null==n?void 0:n.deviation_title)||(null==t?void 0:t.deviation_title),deviation_impact:(null==n?void 0:n.deviation_impact)||(null==t?void 0:t.deviation_impact),deviation_explanation:(null==n?void 0:n.deviation_explanation)||(null==t?void 0:t.deviation_explanation),evaluation_outputs:(null==n?void 0:n.evaluation_outputs)||(null==t?void 0:t.evaluation_outputs),cognitive_decisioning:(null==n?void 0:n.cognitive_decisioning)||(null==t?void 0:t.cognitive_decisioning)}):n};if(!("string"==typeof o&&o.includes(u.DEVIATION_BADGE_SEPARATOR)))return c(r);var a=o.split(u.DEVIATION_BADGE_SEPARATOR)[1];if(!a)return r;var s=(null==t?void 0:t.evaluationResult)||(null==i?void 0:i.evaluationResult)||{},d=(null===(n=null==s?void 0:s.deviation_entries)||void 0===n?void 0:n[a])||(null===(l=null==s?void 0:s.deviations)||void 0===l?void 0:l[a])||null;return d?e.__assign(e.__assign(e.__assign({},s),d),{deviation_summary:(null==d?void 0:d.deviation_summary)||(null==s?void 0:s.deviation_summary),deviation_title:(null==d?void 0:d.deviation_title)||(null==s?void 0:s.deviation_title),deviation_impact:(null==d?void 0:d.deviation_impact)||(null==s?void 0:s.deviation_impact),deviation_explanation:(null==d?void 0:d.deviation_explanation)||(null==s?void 0:s.deviation_explanation),evaluation_outputs:(null==d?void 0:d.evaluation_outputs)||(null==s?void 0:s.evaluation_outputs),cognitive_decisioning:(null==d?void 0:d.cognitive_decisioning)||(null==s?void 0:s.cognitive_decisioning)}):c(r)}(),isOrphan:!!l}},[cn,Z]),Ft=t.useCallback(function(e){kn(),Dn(null),En(e)},[kn]),Mt=function(e,n,t,i,o,l){var r;if(e.stopPropagation(),Tn.open&&Tn.sectionIdx===o)kn();else{var c=e.currentTarget,a="left";(null===(r=pn.current)||void 0===r?void 0:r.contains(c))&&(a="right");It(),ln.current&&Et(),We(new Set),Ue([]),tn.current=[],Mn(),wn.open?Ri():jn(),requestAnimationFrame(function(){var e=function(){var e,n,t,i;if("string"==typeof o&&o.includes(u.DEVIATION_BADGE_SEPARATOR)){var l=o.split(u.DEVIATION_BADGE_SEPARATOR),r="".concat(l[0]).concat(u.DEVIATION_BADGE_SEPARATOR).concat(l[1]);return"right"===a?null===(e=st.current[r])||void 0===e?void 0:e.current:null===(n=at.current[r])||void 0===n?void 0:n.current}return"right"===a?null===(t=st.current[o])||void 0===t?void 0:t.current:null===(i=at.current[o])||void 0===i?void 0:i.current}()||c;Bn(Pt(e,n,i,o,t,l))})}},kt=t.useCallback(function(){null!==Tn.sectionIdx&&Tn.anchorEl?Ft(e.__assign(e.__assign({},Tn),{open:!0})):kn()},[Tn,kn,Ft]),Lt=t.useCallback(function(){var e=Tn.sectionIdx,n=Tn.isOrphan;kn(),jn(),null!==e&&(n?Be("No counterpart exists to connect to."):(It(),ln.current&&Et(),Ue([]),tn.current=[],We(function(n){return n.has(e)?new Set:new Set([e])}),setTimeout(function(){un.current&&un.current()},50)))},[Tn.sectionIdx,Tn.isOrphan,kn,jn,Et]),Vt=t.useCallback(function(){var e=Je.current;if(e){Je.current=null;var n=Xn.findIndex(function(n){return n.id===e}),t=$n.findIndex(function(n){return n.id===e}),i=-1===n?u.findKeyPathByNodeId(Xn,e):null,o=-1===t?u.findKeyPathByNodeId($n,e):null,l=-1!==n?n:i?Number(i.split("-")[0]):-1,r=-1!==t?t:o?Number(o.split("-")[0]):-1,c=function(e,n,t,i){var o,l,r,u;return-1!==e?null!==(l=null===(o=t.current[e])||void 0===o?void 0:o.current)&&void 0!==l?l:null:n&&null!==(u=null===(r=i.current[n])||void 0===r?void 0:r.current)&&void 0!==u?u:null},a=function(e,n,t){void 0===t&&(t=30);var i=0,o=function(){var l=e();l&&0!==l.getBoundingClientRect().height?(Qe.current.add(l),u.scrollAndHighlightClause(l,n)):i++<t&&requestAnimationFrame(o)};requestAnimationFrame(o)};if(xe)-1!==l&&Rn.current&&a(function(){return c(n,i,ut,vt)},Rn.current),-1!==r&&pn.current&&a(function(){return c(t,o,ct,ft)},pn.current);else{var s=fn.current;if(!s)return;a(function(){return-1!==l?c(n,i,ut,vt):c(t,o,ct,ft)},s)}}},[Xn,$n,xe,ut,ct,vt,ft,Rn,pn,fn]),Ht=t.useCallback(function(n){if(n){It(),Et(),We(new Set),Ue([]),tn.current=[],jn(),Mn();var t=Xn.findIndex(function(e){return e.id===n}),i=$n.findIndex(function(e){return e.id===n}),o=-1===t?u.findKeyPathByNodeId(Xn,n):null,l=-1===i?u.findKeyPathByNodeId($n,n):null;if(-1!==t||o||-1!==i||l){var r=-1!==t?t:o?Number(o.split("-")[0]):-1,c=-1!==i?i:l?Number(l.split("-")[0]):-1;Je.current=n,Ot(function(n){var t,i=e.__assign({},n),o=!1;-1!==r&&(i[t=xe?"left-".concat(r):String(r)]||(i[t]=!0,o=!0));-1!==c&&(i[t=xe?"right-".concat(c):String(c)]||(i[t]=!0,o=!0));return o?i:n}),Nt(function(n){var t=e.__assign({},n),i=!1,r=function(e){for(var n=e.split("-"),o=n[0],l=1;l<n.length;l++)o+="-".concat(n[l]),t[o]||(t[o]=!0,i=!0)};return o&&r(o),l&&r(l),i?t:n}),setTimeout(function(){requestAnimationFrame(function(){Je.current===n&&qt.current()})},50)}else console.warn('scrollToAndHighlightClause: nodeId "'.concat(n,'" not found'))}},[Xn,$n,xe,Ot,Nt,Et,jn,Mn]),qt=t.useRef(Vt);t.useEffect(function(){qt.current=Vt},[Vt]);var Gt=t.useRef(null),zt=t.useRef(null),Wt=t.useRef(null),Kt=t.useRef(null),Yt=t.useRef(null),Ut=t.useRef(null),Xt=t.useState([]),$t=Xt[0],Jt=Xt[1];t.useRef(null);var Qt=t.useState(null),Zt=Qt[0],ei=Qt[1];t.useEffect(function(){if(Hn){var e=Ln.fields.find(function(e){return e.analysisKey===Hn||e.key===Hn});if(e){var n=lt.current[e.key]||rt.current[e.key];(null==n?void 0:n.current)&&setTimeout(function(){return n.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[Hn,Ln.fields]);var ni=t.useCallback(function(e){var n,t,i,o,l,r,u,c,a,s=null===(n=null==mt?void 0:mt.rule_difference_comparison)||void 0===n?void 0:n.fields;if(!s||!s[e])return{score:0,relation:"",highlightsA:[],highlightsB:[],hasContent:!1};var d=s[e],v=(null==d?void 0:d.relation)||(null===(i=null===(t=null==d?void 0:d.highlights)||void 0===t?void 0:t.ruleA_spans)||void 0===i?void 0:i.length)||(null===(l=null===(o=null==d?void 0:d.highlights)||void 0===o?void 0:o.ruleB_spans)||void 0===l?void 0:l.length)||(null==d?void 0:d.mappings)&&d.mappings.length>0;if(d.mappings){var f=d.mappings[0]||{};return{score:d.score,relation:f.relation||"",highlightsA:(null===(r=f.highlights)||void 0===r?void 0:r.ruleA_spans)||[],highlightsB:(null===(u=f.highlights)||void 0===u?void 0:u.ruleB_spans)||[],hasContent:!!v}}return{score:d.score,relation:d.relation||"",highlightsA:(null===(c=d.highlights)||void 0===c?void 0:c.ruleA_spans)||[],highlightsB:(null===(a=d.highlights)||void 0===a?void 0:a.ruleB_spans)||[],hasContent:!!v}},[mt]),ti=t.useCallback(function(n,t){var i,o,l;void 0===t&&(t="left");var r=null,c=null;if("left"===t)if(r=Xn[n],xe&&r){var s=$n.filter(function(e){var n;return null===(n=r.refIndexes)||void 0===n?void 0:n.includes(e.selfIndex)});c=s.find(function(e){return e.evaluationResult})||s[0]}else c=$n[n];else if(c=$n[n],xe&&c){var d=Xn.filter(function(e){var n;return null===(n=e.refIndexes)||void 0===n?void 0:n.includes(c.selfIndex)});r=d.find(function(e){return e.evaluationResult})||d[0]}else r=Xn[n];var v=(null==r?void 0:r.relation)&&"not_defined"!==r.relation,f=(null==c?void 0:c.relation)&&"not_defined"!==c.relation,g=!(!(null==r?void 0:r.cognitiveData)&&!(null==c?void 0:c.cognitiveData));if(!v&&!f&&!g)return e.__assign(e.__assign({},u.generateColorPalette(a.DEFAULT_DEVIAION_COLOR)),{label:"Not Defined"});var p=null!==(o=null!==(i=null==r?void 0:r.evaluationResult)&&void 0!==i?i:null==c?void 0:c.evaluationResult)&&void 0!==o?o:null,h=u.getFirstDeviationOutputValue(p),x=u.getFirstDeviationColor(p);return null!=p?e.__assign(e.__assign({},u.generateColorPalette(x)),{label:null!==(l=h)&&void 0!==l?l:""}):e.__assign(e.__assign({},u.generateColorPalette(x)),{label:null})},[Xn,$n,cn,Ln,xe]),ii=t.useCallback(function(n){for(var t,i,o,l,r,c=n.split("-").map(Number),s=Xn[c[0]],d=$n[c[0]],v=1;v<c.length;v++)(null==s?void 0:s.subsections)&&(s=s.subsections[c[v]]),(null==d?void 0:d.subsections)&&(d=d.subsections[c[v]]);if(!s&&!d)return null;var f=(null==s?void 0:s.relation)&&"not_defined"!==s.relation,g=(null==d?void 0:d.relation)&&"not_defined"!==d.relation,p=u.safeStringify(null==s?void 0:s.id)||u.safeStringify(null==d?void 0:d.id)||"",h=!(!(null==s?void 0:s.cognitiveData)&&!(null==d?void 0:d.cognitiveData));if(!f&&!g&&!h)return e.__assign(e.__assign({},u.generateColorPalette(a.DEFAULT_DEVIAION_COLOR)),{label:"Not Defined"});null!==(i=null!==(t=null==s?void 0:s.cognitiveRelevanceScore)&&void 0!==t?t:null==d?void 0:d.cognitiveRelevanceScore)&&void 0!==i||p&&(null===(o=cn[p])||void 0===o||o.relevance_score);var x=null!==(r=null!==(l=null==s?void 0:s.evaluationResult)&&void 0!==l?l:null==d?void 0:d.evaluationResult)&&void 0!==r?r:null,m=u.getFirstDeviationOutputValue(x),_=u.getFirstDeviationColor(x);return null!=x?e.__assign(e.__assign({},u.generateColorPalette(_)),{label:null!=m?m:""}):e.__assign(e.__assign({},u.generateColorPalette(_)),{label:null})},[Xn,$n,cn,Ln]),oi=t.useCallback(function(n,t){var i,o,l,r,c,s,d,v,f,g,p,h,x,m,_,R,y;if(!n||null==t)return null;var b=null!==(d=null!==(c=null!==(o=null===(i=null==ae?void 0:ae[n])||void 0===i?void 0:i.evaluation_result)&&void 0!==o?o:null===(r=null===(l=null==Z?void 0:Z.nodes)||void 0===l?void 0:l[n])||void 0===r?void 0:r.evaluation_result)&&void 0!==c?c:null===(s=null==Z?void 0:Z[n])||void 0===s?void 0:s.evaluation_result)&&void 0!==d?d:null;if(!b||"object"!=typeof b)return null;var S=null!==(p=null!==(f=null===(v=null==b?void 0:b.deviations)||void 0===v?void 0:v[t])&&void 0!==f?f:null===(g=null==b?void 0:b.deviation_entries)||void 0===g?void 0:g[t])&&void 0!==p?p:null==b?void 0:b[t],A=null!==(y=null!==(m=null===(x=null===(h=null==S?void 0:S.evaluation_outputs)||void 0===h?void 0:h.metadata)||void 0===x?void 0:x.label_color)&&void 0!==m?m:null===(R=null===(_=null==b?void 0:b.evaluation_outputs)||void 0===_?void 0:_.metadata)||void 0===R?void 0:R.label_color)&&void 0!==y?y:a.DEFAULT_DEVIAION_COLOR;return e.__assign(e.__assign({},u.generateColorPalette(A)),{label:null})},[ae,Z]),li=t.useCallback(function(){It(),Ot({}),Nt({}),Et(),We(new Set),Ue([]),tn.current=[],jn(),Mn(),kn(),requestAnimationFrame(function(){un.current&&un.current()})},[Ot,Nt,Et,jn,Mn,kn]),ri=t.useMemo(function(){return Object.values(Dt).some(Boolean)||Object.values(wt).some(Boolean)},[Dt,wt]),ui=t.useCallback(function(){var e,n,t,i,o,l,r,c,a,s,d,v,f,g,p,h,x,m,_,R,y,b,S;if(!yn.current&&!Ze.current){yn.current=!0;try{if(!Gt.current)return;var A=function(e){var n=e.split("-"),t=n[0];if(!Dt[t]&&!1===xe)return!1;if(xe&&!Dt["left-".concat(t)]&&!Dt["right-".concat(t)]&&!Dt[t])return!1;for(var i=t,o=1;o<n.length-1;o++)if(i+="-".concat(n[o]),!wt[i])return!1;return!0},I=Gt.current.getBoundingClientRect();dn({width:I.width,height:I.height});var E=[];if(Jn.forEach(function(e){var n,t,i=e.key,o=null===(n=lt.current[i])||void 0===n?void 0:n.current,l=null===(t=rt.current[i])||void 0===t?void 0:t.current;o&&l&&(o.style.height="auto",l.style.height="auto",o.style.minHeight="0px",l.style.minHeight="0px")}),!Ze.current){for(var T=0;T<Math.max(Xn.length,$n.length);T++){var B=null===(e=ut.current[T])||void 0===e?void 0:e.current,C=null===(n=ct.current[T])||void 0===n?void 0:n.current;B&&(B.style.height="auto",B.style.minHeight="0px"),C&&(C.style.height="auto",C.style.minHeight="0px")}xe||Object.keys(vt.current).forEach(function(e){var n,t;if(A(e)){var i=null===(n=vt.current[e])||void 0===n?void 0:n.current,o=null===(t=ft.current[e])||void 0===t?void 0:t.current;i&&o&&(i.style.height="auto",o.style.height="auto",i.style.minHeight="0px",o.style.minHeight="0px")}})}var D={};Jn.forEach(function(e){var n,t,i=e.key,o=null===(n=lt.current[i])||void 0===n?void 0:n.current,l=null===(t=rt.current[i])||void 0===t?void 0:t.current;if(o&&l){var r=o.getBoundingClientRect(),u=l.getBoundingClientRect();D[i]=Math.max(r.height,u.height)}});var O={left:{},right:{}},w={};if(!Ze.current)if(xe){if(De&&null!==Ve)if("number"==typeof Ve){var N=Ve,j=Xn[N],P=null===(o=ut.current[N])||void 0===o?void 0:o.current;P&&j&&(j.refIndexes||[]).forEach(function(e){var n,t=$n.findIndex(function(n){return n.selfIndex===e}),i=null===(n=ct.current[t])||void 0===n?void 0:n.current;if(i&&(Dt["left-".concat(N)]||Dt["right-".concat(t)])){var o=Math.max(P.getBoundingClientRect().height,i.getBoundingClientRect().height);O.left[N]=Math.max(O.left[N]||0,o),O.right[t]=Math.max(O.right[t]||0,o)}})}else{var F=Ve.split(u.DEVIATION_BADGE_SEPARATOR)[2];if(F){B=null===(l=vt.current[F])||void 0===l?void 0:l.current,C=null===(r=ft.current[F])||void 0===r?void 0:r.current;if(B&&C){M=Math.max(B.getBoundingClientRect().height,C.getBoundingClientRect().height);w[F]=Math.max(w[F]||0,M)}}}}else{Object.keys(vt.current).forEach(function(e){var n,t;if(A(e)){var i=null===(n=vt.current[e])||void 0===n?void 0:n.current,o=null===(t=ft.current[e])||void 0===t?void 0:t.current;if(i&&o&&null!==i.offsetParent&&null!==o.offsetParent){var l=i.getBoundingClientRect(),r=o.getBoundingClientRect(),u=Math.max(l.height,r.height);w[e]=u,i.style.minHeight="".concat(u,"px"),o.style.minHeight="".concat(u,"px")}}});for(T=0;T<Math.min(Xn.length,$n.length);T++){var B=null===(t=ut.current[T])||void 0===t?void 0:t.current,C=null===(i=ct.current[T])||void 0===i?void 0:i.current;if(B&&C){var M=Math.max(B.getBoundingClientRect().height,C.getBoundingClientRect().height);O.left[T]=M,O.right[T]=M}}}if(Jn.forEach(function(e){var n,t,i=e.key,o=null===(n=lt.current[i])||void 0===n?void 0:n.current,l=null===(t=rt.current[i])||void 0===t?void 0:t.current;if(o&&l){var r=D[i];o.style.minHeight="".concat(r,"px"),l.style.minHeight="".concat(r,"px")}}),Ze.current||(Object.entries(O.left).forEach(function(e){var n,t=e[0],i=e[1],o=null===(n=ut.current[Number(t)])||void 0===n?void 0:n.current;o&&(o.style.minHeight="".concat(i,"px"))}),Object.entries(O.right).forEach(function(e){var n,t=e[0],i=e[1],o=null===(n=ct.current[Number(t)])||void 0===n?void 0:n.current;o&&(o.style.minHeight="".concat(i,"px"))}),xe||Object.keys(w).forEach(function(e){var n,t,i=null===(n=vt.current[e])||void 0===n?void 0:n.current,o=null===(t=ft.current[e])||void 0===t?void 0:t.current;if(i&&o&&w[e]){var l=w[e];i.style.minHeight="".concat(l,"px"),o.style.minHeight="".concat(l,"px")}})),xe)Xn.forEach(function(e,n){var t;(null===(t=ut.current[n])||void 0===t?void 0:t.current)&&(e.refIndexes||[]).forEach(function(e){var t,i,o,l,r,u,c,a,s,d,v=$n.findIndex(function(n){return n.selfIndex===e});if(-1!==v){var f=null===(t=at.current[n])||void 0===t?void 0:t.current,g=null===(i=st.current[v])||void 0===i?void 0:i.current;if(f&&g){var p=f.getBoundingClientRect(),h=g.getBoundingClientRect(),x=p.right-I.left,m=h.left-I.left,_=p.top+p.height/2-I.top,R=h.top+h.height/2-I.top;if(De&&Ve===n){var y=null!==(l=null===(o=Rn.current)||void 0===o?void 0:o.getBoundingClientRect().top)&&void 0!==l?l:0,b=null!==(u=null===(r=pn.current)||void 0===r?void 0:r.getBoundingClientRect().top)&&void 0!==u?u:0,S=y+(null!==(a=null===(c=Rn.current)||void 0===c?void 0:c.clientHeight)&&void 0!==a?a:1/0),A=b+(null!==(d=null===(s=pn.current)||void 0===s?void 0:s.clientHeight)&&void 0!==d?d:1/0),T=p.top+p.height/2,B=h.top+h.height/2,C=function(e,n,t){return Math.max(n,Math.min(t,e))};_=C(T,y,S)-I.top,R=C(B,b,A)-I.top}var D=ti(n);D&&E.push({id:"line-".concat(n,"-").concat(v),x1:x,y1:_,x2:m,y2:R,style:D,sectionIdx:n,targetRightIdx:v})}}})});else{for(T=0;T<Math.min(Xn.length,$n.length);T++){var k=null===(c=ut.current[T])||void 0===c?void 0:c.current,L=null===(a=ct.current[T])||void 0===a?void 0:a.current;if(k&&L){var V=k.getBoundingClientRect(),H=L.getBoundingClientRect(),q=Math.max(V.top,H.top)+18-I.top,G=(null===(s=$n[T])||void 0===s?void 0:s.id)||"sec-".concat(T);(J=ti(T))&&E.push({id:G,x1:V.right-I.left,y1:q,x2:H.left-I.left,y2:q,style:J,sectionIdx:T,hasCognitive:!!((null===(d=Xn[T])||void 0===d?void 0:d.cognitiveData)||(null===(v=$n[T])||void 0===v?void 0:v.cognitiveData)||G&&cn[G]),isSubSection:!1})}}Object.keys(vt.current).forEach(function(e){var n,t,i,o,l,r;if(A(e)){var c=null===(n=vt.current[e])||void 0===n?void 0:n.current,a=null===(t=ft.current[e])||void 0===t?void 0:t.current;if(c&&a){for(var s=e.split("-").map(Number),d=Xn[s[0]],v=$n[s[0]],f=1;f<s.length;f++)(null==d?void 0:d.subsections)&&(d=d.subsections[s[f]]),(null==v?void 0:v.subsections)&&(v=v.subsections[s[f]]);var g=!!d&&((null===(i=d.displayTitle)||void 0===i||i)&&u.hasValue(d.title)),p=!!d&&((null===(o=d.displayContent)||void 0===o||o)&&u.hasValue(d.content)),h=!!v&&((null===(l=v.displayTitle)||void 0===l||l)&&u.hasValue(v.title)),x=!!v&&((null===(r=v.displayContent)||void 0===r||r)&&u.hasValue(v.content));if(g&&p||h&&x){var m=c.getBoundingClientRect(),_=a.getBoundingClientRect(),R=Math.max(m.top,_.top)+16-I.top,y=ii(e);y&&"Not Defined"!==y.label&&E.push({id:"subsec-".concat(e),x1:m.right-I.left,y1:R,x2:_.left-I.left,y2:R,style:y,sectionIdx:s[0],isSubSection:!0,subSectionKeyPath:e,hasCognitive:!(!(null==d?void 0:d.cognitiveData)&&!(null==v?void 0:v.cognitiveData))})}}}})}if(De&&"string"==typeof Ve&&Ve.includes(u.DEVIATION_BADGE_SEPARATOR)){var z=Ve.split(u.DEVIATION_BADGE_SEPARATOR),W=z[0],K=z[1],Y=z[2],U=(z[3],"".concat(W).concat(u.DEVIATION_BADGE_SEPARATOR).concat(K)),X=null===(f=at.current[U])||void 0===f?void 0:f.current,$=null===(g=st.current[U])||void 0===g?void 0:g.current;if(X&&$){var J,Q=X.getBoundingClientRect(),Z=$.getBoundingClientRect(),ee=Q.right-I.left,ne=Z.left-I.left,te=Q.top+Q.height/2-I.top,ie=Z.top+Z.height/2-I.top;if(xe){var oe=null!==(h=null===(p=Rn.current)||void 0===p?void 0:p.getBoundingClientRect().top)&&void 0!==h?h:0,le=null!==(m=null===(x=pn.current)||void 0===x?void 0:x.getBoundingClientRect().top)&&void 0!==m?m:0,re=oe+(null!==(R=null===(_=Rn.current)||void 0===_?void 0:_.clientHeight)&&void 0!==R?R:1/0),ue=le+(null!==(b=null===(y=pn.current)||void 0===y?void 0:y.clientHeight)&&void 0!==b?b:1/0),ce=function(e,n,t){return Math.max(n,Math.min(t,e))};te=ce(Q.top+Q.height/2,oe,re)-I.top,ie=ce(Z.top+Z.height/2,le,ue)-I.top}(J=null!==(S=oi(W,K))&&void 0!==S?S:ii(Y))&&E.push({id:"line-subsec-".concat(U),x1:ee,y1:te,x2:ne,y2:ie,style:J,sectionIdx:Number(Y.split("-")[0]),isSubSection:!0,subSectionKeyPath:Ve})}}if(Jt(E),Yt.current&&Ut.current){var ae=Yt.current.getBoundingClientRect(),se=Ut.current.getBoundingClientRect(),de=(ae.top+ae.height/2-I.top+se.top+se.height/2-I.top)/2;ei({x1:ae.right-I.left,x2:se.left-I.left,y:de})}else ei(null);if(ze.size>0){var ve=[],fe=Rn.current,ge=pn.current;if(fe&&ge){var pe=[],he=fe.getBoundingClientRect().top,me=ge.getBoundingClientRect().top,_e=he+fe.clientHeight,Re=me+ge.clientHeight,ye=fe.scrollTop,be=ge.scrollTop,Se=I.top,Ae=function(e,n,t){return Math.max(n,Math.min(t,e))};ze.forEach(function(e){var n,t,i,o,l,r;if("string"==typeof e&&e.includes(u.DEVIATION_BADGE_SEPARATOR)){var c=e.split(u.DEVIATION_BADGE_SEPARATOR),a=c[0],s=c[1],d=c[2],v=(c[3],"".concat(a).concat(u.DEVIATION_BADGE_SEPARATOR).concat(s)),f=null===(n=at.current[v])||void 0===n?void 0:n.current,g=null===(t=st.current[v])||void 0===t?void 0:t.current;if(!f||!g)return;var p=f.getBoundingClientRect(),h=g.getBoundingClientRect(),x=null!==(i=oi(a,s))&&void 0!==i?i:ii(d),m=(P=p.right-I.left)+.5*((F=h.left-I.left-0)-P),_=p.top+p.height/2,R=h.top+h.height/2,y=_-he+ye,b=R-me+be,S="conn-subsec-".concat(v);pe.push({lhsScrollY:y,rhsScrollY:b,x1:P,x2:F,containerTop:Se,leftIdx:e,rhsArrayIdx:e,styleColor:(null==x?void 0:x.badgeBorder)||"#6366F1",styleId:S});var A=Ae(_,he,_e),E=Ae(R,me,Re),T=A-Se,B=E-Se,C=R>=me-4&&R<=Re+4,D="";D=(M=_>=he-4&&_<=_e+4)&&C?u.getBentArrowPath(P,T,F,B):M&&!C?"M ".concat(P,",").concat(T," L ").concat(m,",").concat(T," L ").concat(m,",").concat(B):!M&&C?"M ".concat(m,",").concat(T," L ").concat(m,",").concat(B," L ").concat(F,",").concat(B):"M ".concat(m,",").concat(T," L ").concat(m,",").concat(B),ve.push({id:S,pathD:D,style:x,leftIdx:e,rhsArrayIdx:e})}else if(xe){var O=e,w=Xn[O];if(!(null===(r=null==w?void 0:w.refIndexes)||void 0===r?void 0:r.length))return;w.refIndexes.forEach(function(e){var n,t,i=$n.findIndex(function(n){return n.selfIndex===e});if(-1!==i){var o=null===(n=at.current[O])||void 0===n?void 0:n.current,l=null===(t=st.current[i])||void 0===t?void 0:t.current;if(o&&l){var r=o.getBoundingClientRect(),c=l.getBoundingClientRect(),a=ti(O),s=r.right-I.left,d=c.left-I.left-0,v=s+.5*(d-s),f=r.top+r.height/2,g=c.top+c.height/2,p=f-he+ye,h=g-me+be,x="conn-".concat(O,"-").concat(i);pe.push({lhsScrollY:p,rhsScrollY:h,x1:s,x2:d,containerTop:Se,leftIdx:O,rhsArrayIdx:i,styleColor:(null==a?void 0:a.badgeBorder)||"#6366F1",styleId:x});var m=Ae(f,he,_e),_=Ae(g,me,Re),R=m-Se,y=_-Se,b=f>=he-4&&f<=_e+4,S=g>=me-4&&g<=Re+4,A="";A=b&&S?u.getBentArrowPath(s,R,d,y):b&&!S?"M ".concat(s,",").concat(R," L ").concat(v,",").concat(R," L ").concat(v,",").concat(y):!b&&S?"M ".concat(v,",").concat(R," L ").concat(v,",").concat(y," L ").concat(d,",").concat(y):"M ".concat(v,",").concat(R," L ").concat(v,",").concat(y),ve.push({id:x,pathD:A,style:a,leftIdx:O,rhsArrayIdx:i})}}})}else{var N=e,j=N;f=null===(o=at.current[N])||void 0===o?void 0:o.current,g=null===(l=st.current[j])||void 0===l?void 0:l.current;if(!f||!g)return;var P,F;p=f.getBoundingClientRect(),h=g.getBoundingClientRect(),x=ti(N),m=(P=p.right-I.left)+.5*((F=h.left-I.left-0)-P),_=p.top+p.height/2,R=h.top+h.height/2,y=_-he+ye,b=R-me+be,S="conn-".concat(N,"-").concat(j);pe.push({lhsScrollY:y,rhsScrollY:b,x1:P,x2:F,containerTop:Se,leftIdx:N,rhsArrayIdx:j,styleColor:(null==x?void 0:x.badgeBorder)||"#6366F1",styleId:S});var M;A=Ae(_,he,_e),E=Ae(R,me,Re),T=A-Se,B=E-Se,C=R>=me-4&&R<=Re+4,D="";D=(M=_>=he-4&&_<=_e+4)&&C?u.getBentArrowPath(P,T,F,B):M&&!C?"M ".concat(P,",").concat(T," L ").concat(m,",").concat(T," L ").concat(m,",").concat(B):!M&&C?"M ".concat(m,",").concat(T," L ").concat(m,",").concat(B," L ").concat(F,",").concat(B):"M ".concat(m,",").concat(T," L ").concat(m,",").concat(B),ve.push({id:S,pathD:D,style:x,leftIdx:N,rhsArrayIdx:j})}}),tn.current=pe}Ue(ve)}else Ue([]),tn.current=[]}catch(e){console.error("Line render safe fail: ",e)}finally{yn.current=!1}}},[Jn,Xn,$n,cn,Ln,ni,ti,oi,xe,De,Ve,ze,Dt,wt]),ci=t.useCallback(function(){var e,n,t,i,o,l,r,c,a,s,d,v,f,g,p=tn.current;if(p.length&&!Ze.current){var h=null!==(n=null===(e=Rn.current)||void 0===e?void 0:e.scrollTop)&&void 0!==n?n:0,x=null!==(i=null===(t=pn.current)||void 0===t?void 0:t.scrollTop)&&void 0!==i?i:0,m=null!==(l=null===(o=Rn.current)||void 0===o?void 0:o.clientHeight)&&void 0!==l?l:1/0,_=null!==(c=null===(r=pn.current)||void 0===r?void 0:r.clientHeight)&&void 0!==c?c:1/0,R=null!==(s=null===(a=Rn.current)||void 0===a?void 0:a.getBoundingClientRect().top)&&void 0!==s?s:0,y=null!==(v=null===(d=pn.current)||void 0===d?void 0:d.getBoundingClientRect().top)&&void 0!==v?v:0,b=R+m,S=y+_,A=null!==(g=null===(f=Gt.current)||void 0===f?void 0:f.getBoundingClientRect().top)&&void 0!==g?g:0,I=function(e,n,t){return Math.max(n,Math.min(t,e))};p.forEach(function(e){var n=e.lhsScrollY-h+R,t=e.rhsScrollY-x+y,i=nn.current[e.styleId+"-stroke"],o=nn.current[e.styleId+"-bg"];if(i||o){var l,r=I(n,R,b),c=I(t,y,S),a=r-A,s=c-A,d=n>=R-4&&n<=b+4,v=t>=y-4&&t<=S+4,f=e.x1+.5*(e.x2-e.x1);l=d&&v?u.getBentArrowPath(e.x1,a,e.x2,s):d&&!v?"M ".concat(e.x1,",").concat(a," L ").concat(f,",").concat(a," L ").concat(f,",").concat(s):!d&&v?"M ".concat(f,",").concat(a," L ").concat(f,",").concat(s," L ").concat(e.x2,",").concat(s):"M ".concat(f,",").concat(a," L ").concat(f,",").concat(s),i&&(i.setAttribute("visibility","visible"),i.setAttribute("d",l)),o&&(o.setAttribute("visibility","visible"),o.setAttribute("d",l))}})}},[]);t.useEffect(function(){un.current=ui},[ui]);var ai=t.useRef(null),si=t.useRef(null),di=t.useCallback(function(){tn.current.length>0&&!Ze.current||(null!==ai.current&&clearTimeout(ai.current),ai.current=setTimeout(function(){un.current(),ai.current=null},50))},[]),vi=t.useCallback(function(){ke(!0),Pe(!1),$e.current=null,null!==si.current&&clearTimeout(si.current),null!==ai.current&&(clearTimeout(ai.current),ai.current=null),si.current=setTimeout(function(){var e,n,t,i,o,l,r,c,a,s,d;try{if(tn.current=[],ln.current&&null!==rn.current&&null!==Wt.current){var v=rn.current,f=Wt.current,g="string"==typeof v&&v.includes(u.DEVIATION_BADGE_SEPARATOR),p=null,h=null,x=null,m=null;if(g){var _=v.split(u.DEVIATION_BADGE_SEPARATOR),R="".concat(_[0]).concat(u.DEVIATION_BADGE_SEPARATOR).concat(_[1]);p=(null===(e=at.current[R])||void 0===e?void 0:e.current)||null,h=(null===(n=st.current[R])||void 0===n?void 0:n.current)||null,x=(null===(t=vt.current[_[2]])||void 0===t?void 0:t.current)||(null===(i=ut.current[Number(_[2])])||void 0===i?void 0:i.current)||null,m=(null===(o=ft.current[_[3]])||void 0===o?void 0:o.current)||(null===(l=ct.current[Number(_[3])])||void 0===l?void 0:l.current)||null}else p=(null===(r=gt.current[v])||void 0===r?void 0:r.current)||null,x=(null===(c=ut.current[v])||void 0===c?void 0:c.current)||null,h=(null===(a=dt.current[f])||void 0===a?void 0:a.current)||null,m=(null===(s=ct.current[f])||void 0===s?void 0:s.current)||null;if(p&&h&&x&&m){if(x.style.paddingTop="0px",m.style.paddingTop="0px",!xe){var y=p.getBoundingClientRect(),b=h.getBoundingClientRect(),S=y.top-b.top;S>0?m.style.paddingTop="".concat(S,"px"):S<0&&(x.style.paddingTop="".concat(Math.abs(S),"px"))}var A=Rn.current,I=pn.current;if(A&&I){var E=p.getBoundingClientRect().top-A.getBoundingClientRect().top+A.scrollTop,T=h.getBoundingClientRect().top-I.getBoundingClientRect().top+I.scrollTop-(E-A.scrollTop);Math.abs(I.scrollTop-T)>1&&(I.scrollTop=T)}}}null===(d=un.current)||void 0===d||d.call(un),ln.current&&Pe(!0)}catch(e){console.error("Safely caught error during resize calculation:",e)}finally{ke(!1),si.current=null}},150)},[xe,Xn,$n]),fi=t.useCallback(function(e){if(null!==bn.current&&Sn.current&&Math.abs(e.currentTarget.scrollTop-bn.current)<=2){var n=Sn.current;bn.current=null,Sn.current=null,n()}qe.current||(xe||di(),on.current||(on.current=!0,requestAnimationFrame(function(){var e,n,t,i,o,l,r;if(ln.current){var c=Rn.current,a=pn.current;if(c&&a&&Kt.current){if(!$e.current){var s=rn.current,d=void 0;if("string"==typeof s&&s.includes(u.DEVIATION_BADGE_SEPARATOR)){var v=s.split(u.DEVIATION_BADGE_SEPARATOR),f="".concat(v[0]).concat(u.DEVIATION_BADGE_SEPARATOR).concat(v[1]);d=null===(e=at.current[f])||void 0===e?void 0:e.current}else d=null===(n=at.current[s])||void 0===n?void 0:n.current;if(d){var g=d.getBoundingClientRect();$e.current={badgeScreenY:g.top+g.height/2,initialScrollTop:c.scrollTop,leftTop:c.getBoundingClientRect().top,leftBottom:c.getBoundingClientRect().top+c.clientHeight,cTop:null!==(i=null===(t=Gt.current)||void 0===t?void 0:t.getBoundingClientRect().top)&&void 0!==i?i:0}}}if($e.current){var p=$e.current,h=c.scrollTop-p.initialScrollTop,x=p.badgeScreenY-h,m=((o=x,l=p.leftTop,r=p.leftBottom,Math.max(l,Math.min(r,o)))-p.cTop).toString(),_=x>=p.leftTop-4&&x<=p.leftBottom+4;Kt.current.setAttribute("y1",m),Kt.current.setAttribute("y2",m),Kt.current.setAttribute("visibility",_?"visible":"hidden")}}}tn.current.length>0&&ci(),on.current=!1})))},[ci,xe,di]),gi=t.useRef(0),pi=t.useRef(0),hi=t.useRef(0),xi=t.useRef(function(){});t.useRef(null),t.useEffect(function(){xi.current=vi},[vi]),t.useEffect(function(){var e=setTimeout(di,250),n=function(){return xi.current()};return window.addEventListener("resize",n),function(){clearTimeout(e),null!==ai.current&&clearTimeout(ai.current),null!==si.current&&clearTimeout(si.current),window.removeEventListener("resize",n)}},[Yn,Un,mt,Jn,Dt,wt,Xn,$n,Ln,di,De,Ve,je,ze]),t.useEffect(function(){var e=function(e,n,t,i,o){n.current=e.getBoundingClientRect().width;var l=new ResizeObserver(function(e){null!==t.current&&cancelAnimationFrame(t.current),t.current=requestAnimationFrame(function(){var l,r,u;t.current=null;var c=e[e.length-1];if(c){var a=null!==(u=null===(r=null===(l=c.borderBoxSize)||void 0===l?void 0:l[0])||void 0===r?void 0:r.inlineSize)&&void 0!==u?u:c.contentRect.width;Math.abs(a-n.current)<1?o():(n.current=a,i())}})});return l.observe(e),l},n={current:null},t={current:null},i={current:null},o=[],l=[n,t,i];return gn.current&&o.push(e(gn.current,gi,n,function(){return xi.current()},function(){})),fn.current&&o.push(e(fn.current,pi,t,function(){return xi.current()},function(){return un.current()})),Gt.current&&o.push(e(Gt.current,hi,i,function(){return xi.current()},function(){return un.current()})),function(){o.forEach(function(e){return e.disconnect()}),l.forEach(function(e){null!==e.current&&(cancelAnimationFrame(e.current),e.current=null)})}},[]),t.useEffect(function(){ln.current=De},[De]),t.useEffect(function(){rn.current=Ve},[Ve]);var mi=t.useCallback(function(e,n,t){var i,o,l=null===(i=null==t?void 0:t.toggleIfSame)||void 0===i||i,r=null==t?void 0:t.onReady,c=null!==(o=null==t?void 0:t.sourceSide)&&void 0!==o?o:"left";kn(),null!=e&&(n?Be("No counterpart exists for this section."):(It(),De&&Ve===e?l?Et():null==r||r():(We(new Set([e])),Ue([]),tn.current=[],Ie(!0),qe.current=!0,He(e),rn.current=e,Oe(!0),ln.current=!0,Pe(!1),hn.current&&(hn.current.style.height="0px"),xn.current&&(xn.current.style.height="0px"),mn.current&&(mn.current.style.height="0px"),_n.current&&(_n.current.style.height="0px"),requestAnimationFrame(function(){var n,t,i,o,l,a="string"==typeof e&&e.includes(u.DEVIATION_BADGE_SEPARATOR),s=null,d=null,v=null;if(a){var f=e.split(u.DEVIATION_BADGE_SEPARATOR),g="".concat(f[0]).concat(u.DEVIATION_BADGE_SEPARATOR).concat(f[1]);s=(null===(n=at.current[g])||void 0===n?void 0:n.current)||null,d=(null===(t=st.current[g])||void 0===t?void 0:t.current)||null,v=d?e:null}else if(s=(null===(i=gt.current[e])||void 0===i?void 0:i.current)||null,xe){var p=Xn[e],h=(null==p?void 0:p.refIndexes)||[];if(h.length>0){var x=h[0],m=$n.findIndex(function(e){return e.selfIndex===x});-1!==m&&(d=(null===(l=dt.current[m])||void 0===l?void 0:l.current)||null,v=m)}}else d=(null===(o=dt.current[e])||void 0===o?void 0:o.current)||null,v=d?e:null;Wt.current=v;var _=Rn.current,R=pn.current,y=function(){!function(){var n,t,i,o,l,r,c,s,d,f,g,p,h=null,x=null,m=null,_=null;if(a){var R=e.split(u.DEVIATION_BADGE_SEPARATOR),y="".concat(R[0]).concat(u.DEVIATION_BADGE_SEPARATOR).concat(R[1]);h=(null===(n=vt.current[R[2]])||void 0===n?void 0:n.current)||(null===(t=ut.current[Number(R[2])])||void 0===t?void 0:t.current)||null,x=(null===(i=ft.current[R[3]])||void 0===i?void 0:i.current)||(null===(o=ct.current[Number(R[3])])||void 0===o?void 0:o.current)||null,m=(null===(l=at.current[y])||void 0===l?void 0:l.current)||h,_=(null===(r=st.current[y])||void 0===r?void 0:r.current)||x}else{var b=Number(e),S=null!==v?Number(v):b;h=(null===(c=ut.current[b])||void 0===c?void 0:c.current)||null,x=(null===(s=ct.current[S])||void 0===s?void 0:s.current)||null,m=(null===(d=at.current[b])||void 0===d?void 0:d.current)||(null===(f=gt.current[b])||void 0===f?void 0:f.current)||h,_=(null===(g=st.current[S])||void 0===g?void 0:g.current)||(null===(p=dt.current[S])||void 0===p?void 0:p.current)||x}if(m&&_&&h&&x){h.style.paddingTop="0px",x.style.paddingTop="0px";var A=m.getBoundingClientRect(),I=_.getBoundingClientRect(),E=A.top-I.top;E>0?x.style.paddingTop="".concat(E,"px"):E<0&&(h.style.paddingTop="".concat(Math.abs(E),"px"))}}(),Pe(!0),un.current&&un.current(),qe.current=!1,"right"===c&&R?R.dispatchEvent(new Event("scroll")):_&&_.dispatchEvent(new Event("scroll")),Ie(!1),null==r||r()};if(!s||!_)return qe.current=!1,Ie(!1),void(null==r||r());if(d&&R){if(!xe){var b=0;b="right"===c?d?d.getBoundingClientRect().top:0:s?s.getBoundingClientRect().top:0;var S=fn.current,A=(null==S?void 0:S.getBoundingClientRect().top)||0,I=S?S.scrollTop+b-A-150:0;return S?void u.smoothScrollTo(S,I,200,y):void y()}var E=s.getBoundingClientRect().top-_.getBoundingClientRect().top+_.scrollTop,T=d.getBoundingClientRect().top-R.getBoundingClientRect().top+R.scrollTop,B=200;if("left"===c){var C=T-(E-_.scrollTop);C<0&&hn.current&&(hn.current.style.height="".concat(Math.abs(C),"px")),requestAnimationFrame(function(){var e,n=R.scrollHeight-R.clientHeight;if(C<0)e=0;else{if(C>n){var t=C-n;return xn.current&&(xn.current.style.height="".concat(t+150,"px")),void requestAnimationFrame(function(){u.smoothScrollTo(R,C,B,y)})}e=C}u.smoothScrollTo(R,e,B,y)})}else{var D=E-(T-R.scrollTop);D<0&&mn.current&&(mn.current.style.height="".concat(Math.abs(D),"px")),requestAnimationFrame(function(){var e,n=_.scrollHeight-_.clientHeight;if(D<0)e=0;else{if(D>n){var t=D-n;return _n.current&&(_n.current.style.height="".concat(t+150,"px")),void requestAnimationFrame(function(){u.smoothScrollTo(_,D,B,y)})}e=D}u.smoothScrollTo(_,e,B,y)})}}else y()}))))},[Ve,kn,$n,De,xe,Xn,Et]),_i=t.useCallback(function(){var e,n=Tn.sectionIdx,t=Tn.isOrphan;if(jn(),null!=n){var i="left";Tn.anchorEl&&(null===(e=pn.current)||void 0===e?void 0:e.contains(Tn.anchorEl))&&(i="right"),mi(n,t,{sourceSide:i})}},[mi,Tn.isOrphan,Tn.sectionIdx,Tn.anchorEl,jn]),Ri=t.useCallback(function(){jn(),Et(),We(new Set),Ue([]),tn.current=[]},[jn,Et]),yi=null!==Tn.sectionIdx&&ze.has(Tn.sectionIdx),bi=m.useDeviationNavigation({proposedSections:Xn,existingSections:$n,parentDeviationRecord:Qn,expandedSections:Dt,maintainRelativeOrder:!!xe,scrollContainerRef:fn,leftContainerRef:Rn,rightContainerRef:pn,lhsBadgeRefs:at,rhsBadgeRefs:st}),Si=bi.showDeviationNavigation,Ai=bi.showOpenNodeRef,Ii=bi.adjustScrollForPopup,Ei=t.useCallback(function(e,n,t,i,o){var l,r="string"==typeof i?u.safeStringify(i).trim():u.safeStringify(null==i?void 0:i.deviation_summary).trim(),c=e.currentTarget;Mn();var a="left";(null===(l=pn.current)||void 0===l?void 0:l.contains(c))&&(a="right");var s=function(){var e,t,i,o;if("string"==typeof n&&n.includes(u.DEVIATION_BADGE_SEPARATOR)){var l=n.split(u.DEVIATION_BADGE_SEPARATOR),r="".concat(l[0]).concat(u.DEVIATION_BADGE_SEPARATOR).concat(l[1]);return"right"===a?null===(e=st.current[r])||void 0===e?void 0:e.current:null===(t=at.current[r])||void 0===t?void 0:t.current}return"right"===a?null===(i=st.current[n])||void 0===i?void 0:i.current:null===(o=at.current[n])||void 0===o?void 0:o.current},d=function(e,n){var t=!!xe,i=t?"right"===a?pn.current:Rn.current:fn.current,o=t?"right"===a?Rn.current:pn.current:null;if(i&&e){var l=e.getBoundingClientRect(),r=i.getBoundingClientRect(),c=r.bottom-.35*r.height,s=r.top+.35*r.height;if(l.top>c||l.top<s){var d=r.top+r.height/2,v=l.top+l.height/2-d;if(t&&o){var f=i.scrollHeight-i.clientHeight,g=o.scrollHeight-o.clientHeight;if(v>0){var p=f-i.scrollTop,h=g-o.scrollTop;v=Math.max(0,Math.min(v,p,h))}else v=Math.min(0,Math.max(v,-i.scrollTop,-o.scrollTop));u.smoothScrollTo(o,o.scrollTop+v,250,function(){})}u.smoothScrollTo(i,i.scrollTop+v,250,n)}else n()}else n()};if(t)return Et(),We(new Set),Ue([]),tn.current=[],void(r&&requestAnimationFrame(function(){var e=s()||c;d(e,function(){Nn({open:!0,anchorEl:e,summary:i,displayImpact:o})})}));mi(n,t,r?{toggleIfSame:!1,sourceSide:a,onReady:function(){var e=s()||c;d(e,function(){Nn({open:!0,anchorEl:e,summary:i,displayImpact:o})})}}:{toggleIfSame:!1,sourceSide:a})},[mi,Mn,Nn,Et,xe]),Ti=t.useMemo(function(){var e;if(!se)return null;var n=null===(e=null==se?void 0:se.id)||void 0===e?void 0:e.split(":")[0];for(var t in Qn){if((Qn[t]||[]).some(function(e){return e.id===n}))return t}return null},[se,Qn]),Bi=t.useRef({id:null,triggerMs:null}),Ci=t.useRef(null);t.useEffect(function(){var n;if(null==se?void 0:se.id){var t=Number(se.trigger),i=Bi.current;if((null==i?void 0:i.triggerMs)!==t){if(!(se.id.includes(":")&&/:\d+$/.test(se.id)))return Bi.current={id:se.id,triggerMs:t},void Ht(se.id);var o=null===(n=null==se?void 0:se.id)||void 0===n?void 0:n.split(":"),l=o[0],r=o[1],c=null!=r?r:"0";Ci.current!==se.id&&(jn(),Mn(),Et(),We(new Set),Ue([]),tn.current=[],Ci.current=se.id);var a=!1,s=0,d=null,v=150,f=function(e,n){for(var t=function(e,i){if(!e)return null;if(e.id===n)return i;if(!Array.isArray(e.subsections))return null;for(var o=0;o<e.subsections.length;o++){var l=t(e.subsections[o],"".concat(i,"-").concat(o));if(l)return l}return null},i=0;i<e.length;i++){var o=t(e[i],String(i));if(o)return o}return null},g=function(){var n,i,o,r;if(!a){var p=function(){Bi.current={id:se.id,triggerMs:t}},h=null,x=null;for(var m in Qn){var _=Qn[m].find(function(e){return e.id===l});if(_){h=m,x=_;break}}if(x&&h){var R=Xn.findIndex(function(e){return e.id===h}),y=$n.findIndex(function(e){return e.id===h}),b=-1===R&&-1!==y,S=f(Xn,x.id),A=f($n,x.id);if(S&&!A&&!b){var I=S.split("-"),E=Number(I[0]);if(xe){var T=null===(i=null===(n=Xn[E])||void 0===n?void 0:n.refIndexes)||void 0===i?void 0:i[0],B=$n.findIndex(function(e){return e.selfIndex===T});-1!==B&&(E=B)}A=e.__spreadArray([E],I.slice(1),!0).join("-")}if(S||A){var C=b||!S&&!!A,D=S?Number(S.split("-")[0]):R,O=A?Number(A.split("-")[0]):y;if(C){if(!(xe?!!Dt["right-".concat(O)]:!!Dt[String(O)])&&O>=0)return jt(O,"right"),s+=1,void(d=setTimeout(g,450))}else if(!(xe?!!Dt["left-".concat(D)]:!!Dt[String(D)])&&D>=0)return jt(D,"left"),s+=1,void(d=setTimeout(g,450));var w,N=S||"",j=A||"",P="".concat(x.id).concat(u.DEVIATION_BADGE_SEPARATOR).concat(c).concat(u.DEVIATION_BADGE_SEPARATOR).concat(N).concat(u.DEVIATION_BADGE_SEPARATOR).concat(j),F="".concat(x.id).concat(u.DEVIATION_BADGE_SEPARATOR).concat(c),M=null===(o=at.current[F])||void 0===o?void 0:o.current,k=null===(r=st.current[F])||void 0===r?void 0:r.current,L=C||!M&&!!k,V=L?k:M;if(w=xe?L?pn.current:Rn.current:fn.current,V&&w){var H=V.getBoundingClientRect();if(0===H.height)return void((s+=1)<2?d=setTimeout(g,v):p());var q=w.getBoundingClientRect(),G=H.top-q.top+w.scrollTop-q.height/2+H.height/2+150,z=function(){var n,t,i,o,l;if(!a){p();var r=V instanceof Element?window.getComputedStyle(V).color:"";M&&(M.style.transition="box-shadow 300ms ease-in-out",M.style.boxShadow="0 0 10px ".concat(r)),k&&(k.style.transition="box-shadow 300ms ease-in-out",k.style.boxShadow="0 0 10px ".concat(r)),setTimeout(function(){M&&(M.style.boxShadow=""),k&&(k.style.boxShadow="")},2e3);var u=(null===(t=null===(n=x.evaluationResult)||void 0===n?void 0:n.deviations)||void 0===t?void 0:t[c])||x,s=(null===(i=x.evaluationResult)||void 0===i?void 0:i.evaluation_outputs)||x.evaluation_outputs;if(!(!!M&&!!k)){var d=L?(null===(o=st.current[F])||void 0===o?void 0:o.current)||k:(null===(l=at.current[F])||void 0===l?void 0:l.current)||M;return Ii(d,function(){Nn({open:!0,anchorEl:d,displayImpact:se.displayImpact,summary:e.__assign(e.__assign({},u),{evaluation_outputs:s})})}),void(null==de||de())}mi(P,!1,{toggleIfSame:!1,sourceSide:"left",onReady:function(){var n,t,i=L?(null===(n=st.current[F])||void 0===n?void 0:n.current)||k:(null===(t=at.current[F])||void 0===t?void 0:t.current)||M;Ii(i,function(){Nn({open:!0,anchorEl:i,displayImpact:null==se?void 0:se.displayImpact,summary:e.__assign({},u)})})}})}};Math.abs(w.scrollTop-G)<=2?z():(bn.current=G,Sn.current=z,w.scrollTo({top:G,behavior:"smooth"}),d&&clearTimeout(d),d=setTimeout(function(){if(Sn.current){bn.current=null;var e=Sn.current;Sn.current=null,e()}},800))}else(s+=1)<2?d=setTimeout(g,v):p()}else(s+=1)<2?d=setTimeout(g,v):p()}else(s+=1)<2?d=setTimeout(g,v):p()}};return d=setTimeout(g,v),function(){a=!0,d&&clearTimeout(d)}}}},[se,Qn,Xn,$n,xe,Dt,jt,mi,Nn,Ht]);var Di=function(e){var t=e.section,i=e.keyPath,o=e.depth,l=void 0===o?0:o,r=e.columnKey,u=void 0===r?"left":r,c=e.parentNodeId,a=void 0===c?"":c,s=e.sectionOffset;return n.jsx(y.default,{section:t,keyPath:i,depth:l,columnKey:u,parentNodeId:a,expandedSubSections:wt,setExpandedSubSections:Nt,maintainRelativeOrder:xe||!1,proposedSections:Xn,existingSections:$n,treeData:Z,deviationNumberRegistry:Zn,connectedSections:ze,activeSideBySideSection:Ve,resolvedMarkdownStyles:vn,getSubSectionRef:ht,getSubSectionCompareStyle:ii,getBadgeRef:xt,openMoreFunctionsPopup:Mt,openSummaryPopup:Ei,showDeviationBadges:_e,resetSideBySide:Et,setConnectedSections:We,setConnectedLines:Ue,cachedConnectedPositions:tn,isProposingFix:fe,proposingFixNodeId:ge,isRedlineFlow:pe,sectionOffset:s})};return n.jsxs(i.Box,e.__assign({ref:gn,sx:e.__assign(e.__assign({display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif'},xe?{}:{overflow:"visible"}),{position:"relative"})},{children:[ye&&n.jsx(i.Box,e.__assign({sx:{position:"absolute",inset:0,bgcolor:"rgba(255, 255, 255, 0.6)",backdropFilter:"blur(10px)",zIndex:9999,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"8px"}},{children:n.jsx(v.default,{})})),wn.open&&n.jsx(b.default,{open:wn.open,anchorEl:wn.anchorEl,containerEl:zt.current,clipTopEl:Yt.current,scrollContainerEl:fn.current,onClose:Ri,summary:wn.summary,displayImpact:wn.displayImpact}),n.jsx(d.default,{open:Tn.open,anchorEl:Tn.anchorEl,sectionTitle:Tn.sectionTitle,referenceSectionTitle:Tn.refSectionTitle,onClose:kn,onOpenCognitiveCompare:kt,onOpenSideBySide:_i,onConnect:Lt,isConnected:yi,isOrphan:Tn.isOrphan}),In.open&&n.jsx(s.default,{open:In.open,popupRef:Fn,position:Cn,popupConfig:ue,onClose:function(){Dn(null),En(function(n){return e.__assign(e.__assign({},n),{open:!1})}),Pn(null)},markdownStyles:ie,sectionTitle:In.sectionTitle,referenceSectionTitle:In.refSectionTitle,cognitiveData:In.cognitiveData,anchorEl:In.anchorEl,sectionAnchorEl:In.sectionAnchorEl,scrollContainerEl:fn.current,badgeStyle:In.badgeStyle,docData:In.docData,deviationData:In.deviationData,isLoading:In.isLoading}),n.jsx(i.Snackbar,e.__assign({open:!!Te,autoHideDuration:8e3,onClose:function(){return Be(null)},anchorOrigin:{vertical:"top",horizontal:"center"}},{children:n.jsx(i.Alert,e.__assign({onClose:function(){return Be(null)},severity:"error",sx:{width:"100%",whiteSpace:"pre-line"}},{children:Te}))})),n.jsx(_.default,{componentHeaderText:Q,displayConfig:re,maintainRelativeOrder:xe,onCollapseAll:li,showCollapseAll:ri,onToggleView:function(e){be(!0),setTimeout(function(){me(!e),Et(),jn(),We(new Set),Ue([]),tn.current=[],requestAnimationFrame(function(){requestAnimationFrame(function(){setTimeout(function(){be(!1)},600)})})},50)}}),n.jsx(i.Box,e.__assign({ref:fn,onScroll:fi,sx:{flex:1,minHeight:0,pt:1.5,pb:1,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",overflowY:xe?"hidden":"auto",borderTop:_t&&Rt?"none":"1.5px solid #EEF0F4"}},{children:n.jsx(i.Box,e.__assign({sx:e.__assign({display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"},xe?{flex:1,minHeight:0}:{})},{children:n.jsxs(i.Box,e.__assign({ref:Gt,sx:e.__assign({display:"grid",gridTemplateColumns:"minmax(0, 1fr) 180px minmax(0, 1fr)",gap:"60px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0},xe?{flex:1,overflow:"visible"}:{})},{children:[n.jsxs("svg",e.__assign({ref:Xe,style:{position:"absolute",top:0,left:0,width:sn.width||"100%",height:sn.height||"100%",pointerEvents:"none",zIndex:10,overflow:"visible",opacity:Me?0:1,transition:"opacity 0.15s ease-in-out"}},{children:[Zt&&n.jsx("g",{children:n.jsx("line",{x1:Zt.x1,y1:Zt.y,x2:Zt.x2,y2:Zt.y,stroke:At.badgeBorder,strokeWidth:"1.5"})}),$t.map(function(t){var r,c,s,d,v,g,p,h=t.x1+.5*(t.x2-t.x1),x=(t.y1+t.y2)/2;if("Not Defined"===t.style.label&&!t.hasCognitive)return null;if(t.isSubSection?De&&Ve===t.subSectionKeyPath&&je:De&&Ve===t.sectionIdx&&je)return null;if(!xe){var m=t.isSubSection?u.getBentArrowPath(t.x1,t.y1,t.x2,t.y2):"M ".concat(t.x1," ").concat(t.y1," L ").concat(t.x2," ").concat(t.y2),_=Xn[t.sectionIdx]||{title:"",content:""},R=$n[null!==(r=t.targetRightIdx)&&void 0!==r?r:t.sectionIdx]||{title:"",content:""};if(console.log("Base and Ref Sections for Badge:",_,R),t.isSubSection&&t.subSectionKeyPath){var y=t.subSectionKeyPath.includes(u.DEVIATION_BADGE_SEPARATOR)?t.subSectionKeyPath.split(u.DEVIATION_BADGE_SEPARATOR):[],b=y[2]||t.subSectionKeyPath,S=y[3]||b,A=b.split("-").map(Number),I=S.split("-").map(Number),E=null,T=null;A.length>0&&(E=Xn[A[0]]),I.length>0&&(T=$n[I[0]]);var B=(null==E?void 0:E.title)||"",C=(null==T?void 0:T.title)||"";console.log("Root Parent Titles:",B,C);for(var D=1;D<A.length;D++)(null==E?void 0:E.subsections)&&(E=E.subsections[A[D]]);for(D=1;D<I.length;D++)(null==T?void 0:T.subsections)&&(T=T.subsections[I[D]]);E&&(_=e.__assign(e.__assign({},E),{title:B||E.title})),console.log("Base Section for Subsection Badge:",_),T&&(R=e.__assign(e.__assign({},T),{title:C||T.title})),console.log("Ref Section for Subsection Badge:",R)}var O=!(null===(c=_.cognitiveData)||void 0===c?void 0:c.isMissingRationale)||Boolean(null===(d=null===(s=_.cognitiveData)||void 0===s?void 0:s.decisioning)||void 0===d?void 0:d.length),w=(null===(p=null===(g=null===(v=_.evaluationResult)||void 0===v?void 0:v.cognitive_decisioning)||void 0===g?void 0:g.decisioning_factors)||void 0===p?void 0:p.length)||!1,N=O||w;return n.jsxs("g",{children:[n.jsx("path",{d:m,fill:"none",stroke:t.style.badgeBorder||"#E2E8F0",strokeWidth:"1.5"}),n.jsx("foreignObject",e.__assign({x:h-100,y:x-14,width:"200",height:"28",style:{pointerEvents:"auto",overflow:"visible"}},{children:n.jsx(i.Box,e.__assign({sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},{children:n.jsxs(i.Box,e.__assign({onClick:function(e){e.stopPropagation(),N&&(In.open&&On===t.id?Mn():(Pn(t.id),Ft(Pt(e.currentTarget,_,R,t.sectionIdx,t.style))))},sx:{display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",bgcolor:t.style.badgeBg,color:t.style.badgeText,border:"1px solid ".concat(t.style.badgeBorder),borderRadius:"12px",px:1.5,py:.5,fontWeight:600,textAlign:"center",whiteSpace:"nowrap",cursor:N?"pointer":"default"}},{children:[t.style.badgeText===a.DEFAULT_DEVIAION_COLOR&&null==t.style.label?n.jsx(f.default,{color:t.style.badgeText}):0===t.style.label?"Same":t.style.label,n.jsx(i.Box,e.__assign({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:n.jsx(l.ButtonCognitiveIcon,{})})),N&&n.jsx(o.ChevronDown,{size:11,style:{transform:In.open&&On===t.id?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))}))]},t.id)}return null}),n.jsx(S.default,{connectedLines:Ye,pathRefs:nn})]})),n.jsxs(i.Box,e.__assign({sx:e.__assign({border:"1px solid #E7E7E9",borderRadius:"8px",bgcolor:"#FFFFFF",display:"flex",flexDirection:"column",position:"relative",zIndex:2,filter:"drop-shadow(0px 2px 4px #F2F2F2)"},xe?{flex:1,overflow:"visible"}:{})},{children:[n.jsx(i.Box,e.__assign({ref:Yt,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E7E7E9",borderRadius:"8px 8px 0 0",display:"flex",alignItems:"center",minHeight:"40px",overflow:"hidden",minWidth:0}},{children:n.jsx(i.Tooltip,e.__assign({title:zn,placement:"top"},{children:n.jsx(i.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:500,color:"#19213D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0,textAlign:"center",display:"block"}},{children:zn}))}))})),n.jsxs(i.Box,e.__assign({ref:Rn,onScroll:fi,sx:e.__assign({p:"12px",display:"flex",flexDirection:"column"},xe?{maxHeight:"calc(100vh - 150px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,mr:"-160px",pr:"172px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[n.jsx("div",{ref:mn,style:{width:"100%",height:"0px",flexShrink:0}}),nt&&Xn.map(function(t,l){var r,c,a=!t.title&&!t.content;if(xe&&a)return null;var s=t,d=ti(l,"left"),v=xe?!(null===(r=s.refIndexes)||void 0===r?void 0:r.length)||s.selfIndex<0:!$n[l],g=ze.has(l),p=u.extractDeviationScore(s.evaluationResult,null==d?void 0:d.deviationLabel),h=it.leftNums.get(s.id);return n.jsx(i.Box,e.__assign({ref:pt(l),sx:{mb:1,width:"100%"}},{children:n.jsxs(i.Box,e.__assign({sx:{position:"relative",width:"100%"}},{children:[n.jsx(i.Box,e.__assign({ref:ut.current[l],sx:e.__assign({width:"100%",display:"flex",flexDirection:"column",minWidth:0},g&&{borderRadius:"6px",outline:"2px solid ".concat((null==d?void 0:d.badgeBorder)||"#6366F1"),outlineOffset:"1px"})},{children:n.jsx(R.default,{section:t,idx:l,columnKey:"left",colRef:pt("left-accordion-".concat(l)),mb:0,treeData:Z,proposedSections:Xn,existingSections:$n,deviationNumberRegistry:Zn,getSectionCompareStyle:ti,getBadgeRef:xt,connectedSections:ze,openMoreFunctionsPopup:Mt,openSummaryPopup:Ei,deviationNodeIdToView:null==se?void 0:se.id,deviationTargetParentId:Ti,parentNodeId:(null===(c=null==Z?void 0:Z.input_index_map)||void 0===c?void 0:c[0])||"",isExpanded:xe?!!Dt["left-".concat(l)]:!!Dt[String(l)],onToggle:function(){Ri(),jt(l,"left")},navigation:t.id?Si[t.id]:null,showOpenNodeRef:Ai,resolvedMarkdownStyles:vn,maintainRelativeOrder:xe,showDeviationBadges:_e,renderSubSections:Di,isProposingFix:fe,proposingFixNodeId:ge,isRedlineFlow:pe,collisionKey:"".concat(De?"1":"0","-").concat(String(null!=Ve?Ve:""))})})),xe&&d&&n.jsxs(i.Box,e.__assign({ref:at.current[l],onClick:function(e){var n,t,i,o=re.enableDeviationSchemaBackwardCompatibility?null!==(n=s.evaluationResult)&&void 0!==n?n:null:null!==(i=null===(t=s.evaluationResult)||void 0===t?void 0:t[0])&&void 0!==i?i:null;Ei(e,String(l),v,o)},sx:{position:"absolute",top:"18px",right:0,transform:"translateY(-50%) translateX(calc(100% + 8px))",display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",bgcolor:d.badgeBg,color:d.badgeText,border:"1px solid ".concat(d.badgeBorder),borderRadius:"12px",px:1.2,py:.3,fontWeight:600,cursor:"pointer",whiteSpace:"nowrap",zIndex:20,boxShadow:"0 1px 3px rgba(0,0,0,0.07)"}},{children:[n.jsxs(i.Box,e.__assign({component:"span",onClick:function(e){var n,t,i;e.stopPropagation();var o=re.enableDeviationSchemaBackwardCompatibility?null!==(n=s.evaluationResult)&&void 0!==n?n:null:null!==(i=null===(t=s.evaluationResult)||void 0===t?void 0:t[0])&&void 0!==i?i:null;Ei(e,String(l),v,o)},sx:{display:"inline-flex",alignItems:"center",gap:"4px",px:.2,cursor:v?"default":"pointer",borderRight:"1px solid ".concat(d.badgeBorder),"&:hover":v?{}:{bgColor:"".concat(d.badgeBorder,"22")}}},{children:[null!=h&&n.jsx(i.Box,e.__assign({component:"span",sx:{fontSize:"11px",fontWeight:700,pr:.5,borderRight:"1px solid ".concat(d.badgeBorder)}},{children:h})),n.jsx(i.Box,e.__assign({component:"span",sx:{fontSize:"11px",px:.25}},{children:!re.isLoading||null!=s.evaluationResult&&null!=s.evaluationResult?"N/A"===p||"NA"===p?"N/A":0==p||null==p?"Same":"".concat(p):n.jsx(f.default,{color:d.badgeText})}))]})),n.jsx(i.Box,e.__assign({component:"span",onClick:function(e){e.stopPropagation();var n=xe?$n.find(function(e){var n;return null===(n=s.refIndexes)||void 0===n?void 0:n.includes(e.selfIndex)})||{title:"",content:""}:$n[l]||{title:"",content:""};Mt(e,t,v,n,l,d)},sx:{display:"inline-flex",alignItems:"center",px:.2,cursor:"pointer","&:hover":{bgcolor:"".concat(d.badgeBorder,"22")}}},{children:n.jsx(o.EllipsisVertical,{size:11,color:d.badgeText})}))]}))]}))}),"left-row-".concat(l))}),n.jsx("div",{ref:_n,style:{width:"100%",height:"0px",flexShrink:0}})]}))]})),n.jsx(i.Box,e.__assign({ref:zt,sx:{width:"180px",display:"flex",flexDirection:"column",alignItems:"center",pt:"15px",gap:0,zIndex:20,pointerEvents:"none"}},{children:n.jsx(i.Box,e.__assign({sx:{display:"flex",justifyContent:"center",alignItems:"center",mt:0}},{children:n.jsxs(i.Box,e.__assign({onClick:function(n){n.stopPropagation(),In.open&&On===yt?Mn():(Pn(yt),Ft(Pt(n.currentTarget,{title:"",content:"",evaluationResult:bt,cognitiveData:{section_id:"",decisioning:[],gap:[],relevance_score:0,isMissingRationale:!0}},null,yt,!0,e.__assign(e.__assign({},At),{label:""}))))},sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:"5px",top:"-8px",borderRadius:"20px",bgcolor:At.badgeBg,color:At.badgeText,border:"1px solid ".concat(At.badgeBorder),fontSize:"12px",fontWeight:600,whiteSpace:"nowrap",position:"relative",zIndex:1,pointerEvents:"auto",cursor:"pointer"}},{children:[null!=St?St:n.jsx(f.default,{}),n.jsx(i.Box,e.__assign({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:n.jsx(l.ButtonCognitiveIcon,{})})),n.jsx(o.ChevronDown,{size:11,style:{transform:In.open&&On===yt?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))})),n.jsxs(i.Box,e.__assign({sx:e.__assign({border:"1px solid #E3E6EA",borderRadius:"8px",bgcolor:"#FFFFFF",boxShadow:"0px 1px 4px #F7F4FE",position:"relative",zIndex:2,display:"flex",flexDirection:"column",minWidth:0},xe?{flex:1,overflow:"visible",minHeight:0}:{})},{children:[Ae&&n.jsx(r.default,{sections:11}),n.jsx(i.Box,e.__assign({ref:Ut,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E3E6EA",borderRadius:"8px 8px 0 0",minHeight:"40px",display:"flex",alignItems:"center",overflowX:"hidden"}},{children:n.jsx(i.Tooltip,e.__assign({title:Wn,placement:"top"},{children:n.jsx(i.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:500,color:"#5928ED",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0,textAlign:"center",display:"block"}},{children:Wn}))}))})),n.jsxs(i.Box,e.__assign({ref:pn,onScroll:fi,sx:e.__assign({p:"12px",display:"flex",flexDirection:"column"},xe?{maxHeight:"calc(100vh - 150px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,ml:"-150px",pl:"165px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[n.jsx("div",{ref:hn,style:{width:"100%",height:"0px",flexShrink:0}}),nt&&$n.map(function(t,l){var r,u,c=t,a=!1,s=null,d=-1;if(xe){d=Xn.findIndex(function(e){var n;return(null===(n=e.refIndexes)||void 0===n?void 0:n.includes(c.selfIndex))&&e.selfIndex>=0});var v=Xn.findIndex(function(e,n){var t;return ze.has(n)&&(null===(t=e.refIndexes)||void 0===t?void 0:t.includes(c.selfIndex))});(a=-1!==v)&&(s=ti(v,"left"))}else(a=ze.has(l))&&(s=ti(l,"right"));var g=xe&&-1!==d?ti(d,"left"):ti(l,"right"),p=xe?-1!==d||!(null===(r=c.refIndexes)||void 0===r?void 0:r.length)&&Xn.some(function(e){return e.id&&e.id===c.id}):Boolean(Xn[l]),h=xe?c.selfIndex<0||!p:!Xn[l],x=it.rightNums.get(c.id);return n.jsx(i.Box,e.__assign({ref:dt.current[l],sx:{mb:1,width:"100%"}},{children:n.jsxs(i.Box,e.__assign({sx:{position:"relative",width:"100%"}},{children:[n.jsx(i.Box,e.__assign({ref:ct.current[l],sx:e.__assign({width:"100%",display:"flex"},a&&s&&{borderRadius:"6px",outline:"2px solid ".concat(s.badgeBorder),outlineOffset:"1px"})},{children:n.jsx(R.default,{section:t,idx:l,columnKey:"right",colRef:pt("right-accordion-".concat(l)),mb:0,parentNodeId:(null===(u=null==Z?void 0:Z.input_index_map)||void 0===u?void 0:u[1])||"",isExpanded:xe?!!Dt["right-".concat(l)]:!!Dt[String(l)],treeData:Z,proposedSections:Xn,existingSections:$n,deviationNumberRegistry:Zn,getBadgeRef:xt,getSectionCompareStyle:ti,connectedSections:ze,openMoreFunctionsPopup:Mt,openSummaryPopup:Ei,deviationNodeIdToView:null==se?void 0:se.id,deviationTargetParentId:Ti,onToggle:function(){Ri(),jt(l,"right")},navigation:t.id?Si[t.id]:null,showOpenNodeRef:Ai,resolvedMarkdownStyles:vn,maintainRelativeOrder:xe,showDeviationBadges:_e,renderSubSections:Di,isProposingFix:fe,proposingFixNodeId:ge,isRedlineFlow:pe,collisionKey:"".concat(De?"1":"0","-").concat(String(null!=Ve?Ve:""))})})),xe&&g&&n.jsx(i.Box,e.__assign({ref:st.current[l],"data-section-id":c.id,onClick:function(e){var n,t,i;if(h){var o=re.enableDeviationSchemaBackwardCompatibility?null!==(n=c.evaluationResult)&&void 0!==n?n:null:null!==(i=null===(t=c.evaluationResult)||void 0===t?void 0:t[0])&&void 0!==i?i:null;Ei(e,String(l),h,o)}},sx:{position:"absolute",top:"18px",left:0,transform:"translateY(-50%) translateX(calc(-100% - 8px))",display:"inline-flex",alignItems:"center",justifyContent:"center",gap:h?"4px":"0px",fontSize:"11px",bgcolor:g.badgeBg,color:g.badgeText,border:"1px solid ".concat(g.badgeBorder),borderRadius:h?"12px":"10px",px:h?1.2:1,py:.3,fontWeight:h?600:700,cursor:h?"pointer":"default",whiteSpace:"nowrap",zIndex:20,boxShadow:h?"0 1px 3px rgba(0,0,0,0.07)":"none"}},{children:h?n.jsxs(n.Fragment,{children:[n.jsxs(i.Box,e.__assign({component:"span",onClick:function(e){var n,t,i;e.stopPropagation();var o=re.enableDeviationSchemaBackwardCompatibility?null!==(n=c.evaluationResult)&&void 0!==n?n:null:null!==(i=null===(t=c.evaluationResult)||void 0===t?void 0:t[0])&&void 0!==i?i:null;Ei(e,String(l),h,o)},sx:{display:"inline-flex",alignItems:"center",gap:"4px",px:.2,cursor:"pointer",borderRight:"1px solid ".concat(g.badgeBorder),"&:hover":{bgcolor:"".concat(g.badgeBorder,"22")}}},{children:[null!=x&&n.jsx(i.Box,e.__assign({component:"span",sx:{fontSize:"11px",fontWeight:700,pr:.5,borderRight:"1px solid ".concat(g.badgeBorder)}},{children:x})),n.jsx(i.Box,e.__assign({component:"span",sx:{fontSize:"11px",px:.25}},{children:!re.isLoading||null!=c.evaluationResult&&void 0!==c.evaluationResult?g.label?"".concat(g.label):"100% Deviation":n.jsx(f.default,{color:g.badgeText})}))]})),n.jsx(i.Box,e.__assign({component:"span",onClick:function(e){e.stopPropagation();var n=xe?Xn.find(function(e){var n;return null===(n=e.refIndexes)||void 0===n?void 0:n.includes(c.selfIndex)})||{title:"",content:""}:Xn[l]||{title:"",content:""};Mt(e,n,h,c,l,g)},sx:{display:"inline-flex",alignItems:"center",px:.2,cursor:"pointer","&:hover":{bgcolor:"".concat(g.badgeBorder,"22")}}},{children:n.jsx(o.EllipsisVertical,{size:11,color:g.badgeText})}))]}):null!=x?x:""}))]}))}),"right-row-".concat(l))}),n.jsx("div",{ref:xn,style:{width:"100%",height:"0px",flexShrink:0}})]}))]}))]}))}))}))]}))};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),i=require("react/jsx-runtime"),n=require("react"),t=require("@mui/material"),o=require("lucide-react"),r=require("../../assests/svg/ButtonCognitiveIcon.js"),l=require("./OverlayComponent.js"),s=require("./CognitiveComparehelpers.js"),u=require("./CognitiveCompareConfig.js"),a=require("./CognitiveCompareConstants.js"),c=require("./CognitivePopup.js"),d=require("./MoreFunctionsPopup.js"),f=require("./LoaderComponent.js"),v=require("./components/ThreeDotsLoader.js"),p=require("./hooks/useCompareData.js"),g=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"),A=require("./hooks/useStyles.js"),E=require("./hooks/useResizeHandler.js"),B=require("./hooks/useLinesCalculator.js"),T=require("./hooks/useSideBySide.js"),w=require("./components/SvgConnectors.js");exports.SHARED_MARKDOWN_STYLES=u.SHARED_MARKDOWN_STYLES,exports.default=function(I){var D,F,O,j,P,N,k,L,M,q,H,V,z,G,W,K,U,Y,X,$,J,Q,Z,ee,ie,ne,te=I.componentHeaderText,oe=void 0===te?a.DEFAULT_COMPONENT_HEADER_TEXT:te,re=I.treeData,le=I.comparisonConfig,se=I.leftColumnTitleText,ue=I.rightColumnTitleText,ae=I.markdownStyles,ce=I.resetTrigger,de=I.displayConfig,fe=void 0===de?{isHeaderVisible:!0,isToggleVisible:!0,maintainRelativeOrder:!1,isLoading:!0,showDeviationBadges:!1,enableDeviationSchemaBackwardCompatibility:!1}:de,ve=I.popupConfig,pe=I.deviationData,ge=void 0===pe?{}:pe,he=I.deviationNodeIdToView,me=I.resetDeviationNodeId,Se=I.isProposingFix,Re=void 0!==Se&&Se,xe=I.proposingFixNodeId,_e=I.isRedlineFlow,ye=n.useState(fe.maintainRelativeOrder),be=ye[0],Ce=ye[1],Ae=!!be||!!(null==fe?void 0:fe.showDeviationBadges),Ee=n.useState(!1),Be=Ee[0],Te=Ee[1],we=n.useState(null),Ie=we[0],De=we[1],Fe=n.useState(null===(F=null!==(D=null==re?void 0:re.newEvaluationResult)&&void 0!==D?D:null==fe?void 0:fe.enableDeviationSchemaBackwardCompatibility)||void 0===F||F)[0],Oe=n.useState(new Set),je=Oe[0],Pe=Oe[1],Ne=n.useState([]),ke=Ne[0],Le=Ne[1],Me=n.useRef(null),qe=n.useRef(null),He=n.useRef(null),Ve=n.useRef(null),ze=n.useRef(null),Ge=n.useRef(!1),We=n.useRef(null),Ke=n.useRef({}),Ue=n.useRef([]),Ye=n.useRef(function(){}),Xe=n.useRef(null),$e=n.useRef(function(){}),Je=n.useMemo(function(){return(null==re?void 0:re.cognitive_decisioning)||{}},[re]),Qe=n.useMemo(function(){return e.__assign(e.__assign({},u.SHARED_MARKDOWN_STYLES),ae)},[ae]),Ze=n.useRef(null),ei=n.useRef(null),ii=n.useRef(null),ni=n.useRef(null),ti=n.useRef(null),oi=n.useRef(null),ri=n.useRef(null),li=n.useRef(null),si=n.useRef(null),ui=n.useRef(null),ai=g.useComparePopups(Ze),ci=ai.cognitivePopup,di=ai.setCognitivePopup,fi=ai.moreFunctions,vi=ai.setMoreFunctions,pi=ai.position,gi=ai.setPosition,hi=ai.activeBadgeId,mi=ai.summaryPopup,Si=ai.setSummaryPopup,Ri=ai.closeSummaryPopup,xi=ai.setActiveBadgeId,_i=ai.popupRef,yi=ai.handleOpenCognitiveCompare,bi=ai.openCognitivePopupFromState,Ci=ai.closeCognitivePopup,Ai=ai.closeMoreFunctionsPopup,Ei=n.useMemo(function(){var e,i,n,t,o,r,l;return{fields:null!==(e=null==le?void 0:le.fields)&&void 0!==e?e:u.DEFAULT_FIELD_CONFIG,thresholds:{high:null!==(n=null===(i=null==le?void 0:le.thresholds)||void 0===i?void 0:i.high)&&void 0!==n?n:u.DEFAULT_COMPARISON_CONFIG.thresholds.high,medium:null!==(o=null===(t=null==le?void 0:le.thresholds)||void 0===t?void 0:t.medium)&&void 0!==o?o:u.DEFAULT_COMPARISON_CONFIG.thresholds.medium,exact:null!==(l=null===(r=null==le?void 0:le.thresholds)||void 0===r?void 0:r.exact)&&void 0!==l?l:u.DEFAULT_COMPARISON_CONFIG.thresholds.exact}}},[le]),Bi=n.useState(null),Ti=Bi[0];Bi[1];var wi=null===(P=null===(O=null==re?void 0:re.documents)||void 0===O?void 0:O[null===(j=null==re?void 0:re.input_index_map)||void 0===j?void 0:j[0]])||void 0===P?void 0:P.title,Ii=null===(L=null===(N=null==re?void 0:re.documents)||void 0===N?void 0:N[null===(k=null==re?void 0:re.input_index_map)||void 0===k?void 0:k[1]])||void 0===L?void 0:L.title,Di=s.safeStringify(se||wi||"Uploaded Contract"),Fi=s.safeStringify(ue||Ii||"Reference Template"),Oi=p.useCognitiveTreeData(re,be,ge,Ei,Fe),ji=Oi.activeProposed,Pi=Oi.existingRule,Ni=Oi.proposedSections,ki=Oi.existingSections,Li=Oi.visibleFields,Mi=Oi.parentDeviationRecord,qi=Oi.deviationNumberRegistry,Hi=Oi.parseError;n.useEffect(function(){Hi&&De("Failed to load comparison: ".concat(Hi))},[Hi]);var Vi=Ni.length>0||ki.length>0,zi=n.useMemo(function(){if(!_e)return"off";var e=0,i=0,n=function(t){Array.isArray(t)&&t.forEach(function(t){var o,r=(null==t?void 0:t.content)||"";s.hasMeaningfulRedlineTags(r)&&(e+=1,i+=String(r).length),(null===(o=null==t?void 0:t.subsections)||void 0===o?void 0:o.length)&&n(t.subsections)})};return n(Ni),n(ki),"".concat(e,":").concat(i)},[_e,Ni,ki]),Gi=h.useSectionRefs(Li.map(function(e){return e.key}),Math.max(Ni.length,ki.length)),Wi=Gi.leftRefs,Ki=Gi.rightRefs,Ui=Gi.sectionLeftRefs,Yi=Gi.sectionRightRefs,Xi=Gi.lhsBadgeRefs,$i=Gi.rhsBadgeRefs,Ji=Gi.sectionRightRowRefs,Qi=Gi.subSectionLeftRefs,Zi=Gi.subSectionRightRefs,en=Gi.sectionRowRefs,nn=Gi.getSectionRowRef,tn=Gi.getSubSectionRef,on=Gi.getBadgeRef,rn=T.useSideBySide({maintainRelativeOrder:be,proposedSections:Ni,existingSections:ki,leftContainerRef:li,rightContainerRef:ii,scrollContainerRef:Ze,sectionLeftRefs:Ui,sectionRightRefs:Yi,subSectionLeftRefs:Qi,subSectionRightRefs:Zi,lhsBadgeRefs:Xi,rhsBadgeRefs:$i,sectionRowRefs:en,sectionRightRowRefs:Ji,rhsTopSpacerRef:ni,rhsBottomSpacerRef:ti,lhsTopSpacerRef:oi,lhsBottomSpacerRef:ri,calculateLinesRef:Ye,setConnectedSections:Pe,setConnectedLines:Le,cachedConnectedPositions:Ue,closeMoreFunctionsPopup:Ai,setErrorToast:De,moreFunctions:fi,closeSummaryPopup:Ri}),ln=rn.isSideBySide,sn=rn.isArrowVisible,un=rn.setIsArrowVisible,an=rn.isResizing,cn=rn.setIsResizing,dn=rn.isSideBySideLoading,fn=rn.activeSideBySideSection,vn=rn.scrollLock,pn=rn.sideBySideCacheRef,gn=rn.isSideBySideRef,hn=rn.activeSideBySideRightSectionRef,mn=rn.activeSideBySideSectionRef,Sn=rn.sideBySideLineRef,Rn=rn.highlightedClauseRefs,xn=rn.clearClauseHighlight,_n=rn.resetSideBySide,yn=rn.activateSideBySide,bn=m.useAccordionState({maintainRelativeOrder:!!be,proposedSections:Ni,existingSections:ki,activeSideBySideSection:fn,connectedSections:je,resetSideBySide:_n,setConnectedSections:Pe,setConnectedLines:Le,cachedConnectedPositions:Ue,svgContainerRef:Me,isAnimatingRef:Ge,animationTimerRef:We,calculateLinesRef:Ye,sectionLeftRefs:Ui,sectionRightRefs:Yi,subSectionLeftRefs:Qi,subSectionRightRefs:Zi}),Cn=bn.expandedSections,An=bn.setExpandedSections,En=bn.expandedSubSections,Bn=bn.setExpandedSubSections,Tn=bn.handleSubSectionToggle,wn=bn.toggleSection;n.useEffect(function(){_e&&"off"!==zi&&"0:0"!==zi&&(pn.current=null,Ue.current=[],requestAnimationFrame(function(){var e;null===(e=Ye.current)||void 0===e||e.call(Ye)}))},[_e,zi]);var In=n.useMemo(function(){var e=new Map,i=new Map,n=1;if(be)Ni.forEach(function(i){!i.title&&!i.content||i.id&&e.set(i.id,n++)}),ki.forEach(function(t){if(t.id){var o=Ni.filter(function(e){var i;return null===(i=e.refIndexes)||void 0===i?void 0:i.includes(t.selfIndex)});if(o.length>0){var r=o.map(function(i){return e.get(i.id)}).filter(Boolean);i.set(t.id,r.join(", "))}else i.set(t.id,String(n++))}});else for(var t=Math.max(Ni.length,ki.length),o=0;o<t;o++){var r=Ni[o],l=ki[o];r?(e.set(r.id,n),l&&i.set(l.id,String(n)),n++):l&&i.set(l.id,String(n++))}return{leftNums:e,rightNums:i}},[Ni,ki,be]),Dn=Pi.analysis,Fn=s.safeStringify(null===(q=null===(M=null==Dn?void 0:Dn.rule_difference_comparison)||void 0===M?void 0:M.summary)||void 0===q?void 0:q.overall_summary),On=!!Fn.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),jn=null!==(H=null==re?void 0:re.base_root_id)&&void 0!==H?H:"-1";null==re||re[jn];var Pn=Fe?null!==(Z=null!==($=ge&&(null===(X=null==ge?void 0:ge[jn])||void 0===X?void 0:X.evaluation_result))&&void 0!==$?$:null===(Q=null===(J=null==re?void 0:re.nodes)||void 0===J?void 0:J[jn])||void 0===Q?void 0:Q.evaluation_result)&&void 0!==Z?Z:null:null!==(Y=null!==(G=ge&&(null===(z=null===(V=null==ge?void 0:ge[jn])||void 0===V?void 0:V.evaluation_result)||void 0===z?void 0:z[0]))&&void 0!==G?G:null===(U=null===(K=null===(W=null==re?void 0:re.nodes)||void 0===W?void 0:W[jn])||void 0===K?void 0:K.evaluation_result)||void 0===U?void 0:U[0])&&void 0!==Y?Y:null,Nn=s.extractDeviationScore(Pn),kn=s.generateColorPalette(null!==(ne=null===(ie=null===(ee=null==Pn?void 0:Pn.evaluation_outputs)||void 0===ee?void 0:ee.metadata)||void 0===ie?void 0:ie.label_color)&&void 0!==ne?ne:a.DEFAULT_DEVIAION_COLOR),Ln=n.useCallback(function(){xn(),_n(),Pe(new Set),Le([]),Ue.current=[],Zn([]),it(null),Si(a.EMPTY_SUMMARY_POPUP_STATE),Ci(),requestAnimationFrame(function(){var e;null===(e=Ye.current)||void 0===e||e.call(Ye)})},[]),Mn=n.useRef(Ln);n.useEffect(function(){Mn.current=Ln},[Ln]),n.useEffect(function(){ce&&Mn.current()},[ce]);var qn=n.useCallback(function(i,n,t,o,r,l,u){var a,c,d,f=s.safeStringify(null==n?void 0:n.id)||s.safeStringify(null==t?void 0:t.id)||"",v=(f?Je[f]:null)||(null==n?void 0:n.cognitiveData)||(null==t?void 0:t.cognitiveData)||{section_id:f,decisioning:[],gap:[],relevance_score:0},p=null!==(c=null===(a=en.current[o])||void 0===a?void 0:a.current)&&void 0!==c?c:null;return{isLoading:null!==(d=null==fe?void 0:fe.isLoading)&&void 0!==d&&d,open:!0,sectionTitle:(null==n?void 0:n.title)?null==n?void 0:n.title:"No Counterpart",refSectionTitle:(null==t?void 0:t.title)?null==t?void 0:t.title:"No Counterpart",cognitiveData:v,anchorEl:i,sectionAnchorEl:p,badgeStyle:l||null,sectionIdx:o,docData:{documents:null==re?void 0:re.documents,input_index_map:null==re?void 0:re.input_index_map},deviationData:function(){var i,r,l=(null==n?void 0:n.evaluationResult)||(null==t?void 0:t.evaluationResult)||null,u=function(i){var n=function(e){if(!e||"object"!=typeof e)return null;var i=null==e?void 0:e.deviation_entries;if(i&&"object"==typeof i){var n=Object.keys(i).sort(function(e,i){return Number(e)-Number(i)})[0];if(n&&i[n])return i[n]}var t=Object.keys(e).filter(function(e){return/^\d+$/.test(e)}).sort(function(e,i){return Number(e)-Number(i)});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,i){return Number(e)-Number(i)})[0];if(r&&o[r])return o[r]}return null}(i);return n?e.__assign(e.__assign({},i),{deviation_summary:(null==i?void 0:i.deviation_summary)||(null==n?void 0:n.deviation_summary),deviation_title:(null==i?void 0:i.deviation_title)||(null==n?void 0:n.deviation_title),deviation_impact:(null==i?void 0:i.deviation_impact)||(null==n?void 0:n.deviation_impact),deviation_explanation:(null==i?void 0:i.deviation_explanation)||(null==n?void 0:n.deviation_explanation),evaluation_outputs:(null==i?void 0:i.evaluation_outputs)||(null==n?void 0:n.evaluation_outputs),cognitive_decisioning:(null==i?void 0:i.cognitive_decisioning)||(null==n?void 0:n.cognitive_decisioning)}):i};if(!("string"==typeof o&&o.includes(s.DEVIATION_BADGE_SEPARATOR)))return u(l);var a=o.split(s.DEVIATION_BADGE_SEPARATOR)[1];if(!a)return l;var c=(null==n?void 0:n.evaluationResult)||(null==t?void 0:t.evaluationResult)||{},d=(null===(i=null==c?void 0:c.deviation_entries)||void 0===i?void 0:i[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)}):u(l)}(),isOrphan:!!r}},[Je,re]),Hn=n.useCallback(function(){var e=fi.sectionIdx,i=fi.isOrphan;Ai(),Ri(),null!==e&&(i?De("No counterpart exists to connect to."):(xn(),gn.current&&_n(),Le([]),Ue.current=[],Pe(function(i){return i.has(e)?new Set:new Set([e])}),setTimeout(function(){Ye.current&&Ye.current()},50)))},[fi.sectionIdx,fi.isOrphan,Ai,Ri,_n]),Vn=n.useCallback(function(){var e=ze.current;if(e){ze.current=null;var i=Ni.findIndex(function(i){return i.id===e}),n=ki.findIndex(function(i){return i.id===e}),t=-1===i?s.findKeyPathByNodeId(Ni,e):null,o=-1===n?s.findKeyPathByNodeId(ki,e):null,r=-1!==i?i:t?Number(t.split("-")[0]):-1,l=-1!==n?n:o?Number(o.split("-")[0]):-1,u=function(e,i,n,t){var o,r,l,s;return-1!==e?null!==(r=null===(o=n.current[e])||void 0===o?void 0:o.current)&&void 0!==r?r:null:i&&null!==(s=null===(l=t.current[i])||void 0===l?void 0:l.current)&&void 0!==s?s:null},a=function(e,i,n){void 0===n&&(n=30);var t=0,o=function(){var r=e();r&&0!==r.getBoundingClientRect().height?(Rn.current.add(r),s.scrollAndHighlightClause(r,i)):t++<n&&requestAnimationFrame(o)};requestAnimationFrame(o)};if(be)-1!==r&&li.current&&a(function(){return u(i,t,Ui,Qi)},li.current),-1!==l&&ii.current&&a(function(){return u(n,o,Yi,Zi)},ii.current);else{var c=Ze.current;if(!c)return;a(function(){return-1!==r?u(i,t,Ui,Qi):u(n,o,Yi,Zi)},c)}}},[Ni,ki,be,Ui,Yi,Qi,Zi,li,ii,Ze]),zn=n.useCallback(function(i){if(i){xn(),_n(),Pe(new Set),Le([]),Ue.current=[],Ri(),Ci();var n=Ni.findIndex(function(e){return e.id===i}),t=ki.findIndex(function(e){return e.id===i}),o=-1===n?s.findKeyPathByNodeId(Ni,i):null,r=-1===t?s.findKeyPathByNodeId(ki,i):null;if(-1!==n||o||-1!==t||r){var l=-1!==n?n:o?Number(o.split("-")[0]):-1,u=-1!==t?t:r?Number(r.split("-")[0]):-1;ze.current=i,An(function(i){var n,t=e.__assign({},i),o=!1;-1!==l&&(t[n=be?"left-".concat(l):String(l)]||(t[n]=!0,o=!0));-1!==u&&(t[n=be?"right-".concat(u):String(u)]||(t[n]=!0,o=!0));return o?t:i}),Bn(function(i){var n=e.__assign({},i),t=!1,l=function(e){for(var i=e.split("-"),o=i[0],r=1;r<i.length;r++)o+="-".concat(i[r]),n[o]||(n[o]=!0,t=!0)};return o&&l(o),r&&l(r),t?n:i}),setTimeout(function(){requestAnimationFrame(function(){ze.current===i&&Gn.current()})},50)}else console.warn('scrollToAndHighlightClause: nodeId "'.concat(i,'" not found'))}},[Ni,ki,be,An,Bn,_n,Ri,Ci]),Gn=n.useRef(Vn);n.useEffect(function(){Gn.current=Vn},[Vn]);var Wn=n.useRef(null);n.useEffect(function(){if(Ti){var e=Ei.fields.find(function(e){return e.analysisKey===Ti||e.key===Ti});if(e){var i=Wi.current[e.key]||Ki.current[e.key];(null==i?void 0:i.current)&&setTimeout(function(){return i.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[Ti,Ei.fields]);var Kn=n.useCallback(function(e){var i,n,t,o,r,l,s,u,a,c=null===(i=null==Dn?void 0:Dn.rule_difference_comparison)||void 0===i?void 0:i.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===(n=null==d?void 0:d.highlights)||void 0===n?void 0:n.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===(s=v.highlights)||void 0===s?void 0:s.ruleB_spans)||[],hasContent:!!f}}return{score:d.score,relation:d.relation||"",highlightsA:(null===(u=d.highlights)||void 0===u?void 0:u.ruleA_spans)||[],highlightsB:(null===(a=d.highlights)||void 0===a?void 0:a.ruleB_spans)||[],hasContent:!!f}},[Dn]),Un=A.useStyleHelpers({proposedSections:Ni,existingSections:ki,maintainRelativeOrder:be,cognitiveMap:Je,deviationData:ge,treeData:re,resolvedComparisonConfig:Ei}),Yn=Un.getSectionCompareStyle,Xn=Un.getSubSectionCompareStyle,$n=Un.getDeviationStyleByKey,Jn=B.useLinesCalculator({containerRef:qe,leftContainerRef:li,rightContainerRef:ii,svgContainerRef:Me,pathRefs:Ke,leftHeaderRef:He,rightHeaderRef:Ve,proposedSections:Ni,existingSections:ki,visibleFields:Li,leftRefs:Wi,rightRefs:Ki,sectionLeftRefs:Ui,sectionRightRefs:Yi,subSectionLeftRefs:Qi,subSectionRightRefs:Zi,lhsBadgeRefs:Xi,rhsBadgeRefs:$i,sectionRowRefs:en,expandedSections:Cn,expandedSubSections:En,connectedSections:je,isSideBySide:ln,activeSideBySideSection:fn,maintainRelativeOrder:be,cognitiveMap:Je,getSectionCompareStyle:Yn,getSubSectionCompareStyle:Xn,getDeviationStyleByKey:$n,isArrowVisible:sn,isAnimatingRef:Ge,isSideBySideRef:gn,sideBySideCacheRef:pn,sideBySideLineRef:Sn,activeSideBySideSectionRef:mn,activeSideBySideRightSectionRef:hn,connectedLines:ke,setConnectedLines:Le,cachedConnectedPositions:Ue,calculateLinesRef:Ye,resizeTimerRef:Xe,scrollLock:vn,handleResizeRef:$e,activeProposed:ji,existingRule:Pi,analysisData:Dn,pendingScrollTargetRef:si,pendingScrollCallbackRef:ui,resolvedComparisonConfig:Ei,getFieldData:Kn}),Qn=Jn.lines,Zn=Jn.setLines,et=Jn.overallConnector,it=Jn.setOverallConnector,nt=Jn.svgDimensions,tt=Jn.handleColumnScroll,ot=n.useCallback(function(){xn(),An({}),Bn({}),_n(),Pe(new Set),Le([]),Ue.current=[],Ri(),Ci(),Ai(),requestAnimationFrame(function(){Ye.current&&Ye.current()})},[An,Bn,_n,Ri,Ci,Ai]),rt=n.useMemo(function(){return Object.values(Cn).some(Boolean)||Object.values(En).some(Boolean)},[Cn,En]),lt=n.useRef(null),st=n.useRef(0),ut=n.useRef(0),at=n.useRef(0),ct=E.useResizeHandler({timerRef:lt,ruleComponentRef:ei,scrollContainerRef:Ze,containerRef:qe,maintainRelativeOrder:be,proposedSections:Ni,existingSections:ki,isSideBySideRef:gn,activeSideBySideSectionRef:mn,activeSideBySideRightSectionRef:hn,sectionRowRefs:en,sectionRightRowRefs:Ji,sectionLeftRefs:Ui,sectionRightRefs:Yi,subSectionLeftRefs:Qi,subSectionRightRefs:Zi,lhsBadgeRefs:Xi,rhsBadgeRefs:$i,leftContainerRef:li,rightContainerRef:ii,calculateLinesRef:Ye,handleResizeRef:$e,setIsResizing:cn,setIsArrowVisible:un,sideBySideCacheRef:pn,cachedConnectedPositions:Ue}).handleResize;n.useEffect(function(){$e.current=ct},[ct,$e]),n.useEffect(function(){var e=function(e,i,n,t,o){i.current=e.getBoundingClientRect().width;var r=new ResizeObserver(function(e){null!==n.current&&cancelAnimationFrame(n.current),n.current=requestAnimationFrame(function(){var r,l,s;n.current=null;var u=e[e.length-1];if(u){var a=null!==(s=null===(l=null===(r=u.borderBoxSize)||void 0===r?void 0:r[0])||void 0===l?void 0:l.inlineSize)&&void 0!==s?s:u.contentRect.width;Math.abs(a-i.current)<1?o():(i.current=a,t())}})});return r.observe(e),r},i={current:null},n={current:null},t={current:null},o=[],r=[i,n,t];return ei.current&&o.push(e(ei.current,st,i,function(){return $e.current()},function(){})),Ze.current&&o.push(e(Ze.current,ut,n,function(){return $e.current()},function(){return Ye.current()})),qe.current&&o.push(e(qe.current,at,t,function(){return $e.current()},function(){return Ye.current()})),function(){o.forEach(function(e){return e.disconnect()}),r.forEach(function(e){null!==e.current&&(cancelAnimationFrame(e.current),e.current=null)})}},[]),n.useEffect(function(){gn.current=ln},[ln]),n.useEffect(function(){mn.current=fn},[fn]);var dt=n.useCallback(function(){var e,i=fi.sectionIdx,n=fi.isOrphan;if(Ri(),null!=i){var t="left";fi.anchorEl&&(null===(e=ii.current)||void 0===e?void 0:e.contains(fi.anchorEl))&&(t="right"),yn(i,n,{sourceSide:t})}},[yn,fi.isOrphan,fi.sectionIdx,fi.anchorEl,Ri]),ft=n.useCallback(function(){Ri(),_n(),Pe(new Set),Le([]),Ue.current=[]},[Ri,_n]),vt=null!==fi.sectionIdx&&je.has(fi.sectionIdx),pt=S.useDeviationNavigation({proposedSections:Ni,existingSections:ki,parentDeviationRecord:Mi,expandedSections:Cn,maintainRelativeOrder:!!be,scrollContainerRef:Ze,leftContainerRef:li,rightContainerRef:ii,lhsBadgeRefs:Xi,rhsBadgeRefs:$i}),gt=pt.showDeviationNavigation,ht=pt.showOpenNodeRef,mt=pt.adjustScrollForPopup,St=n.useCallback(function(e,i,n,t,o){var r,l="string"==typeof t?s.safeStringify(t).trim():s.safeStringify(null==t?void 0:t.deviation_summary).trim(),u=e.currentTarget;Ci();var a="left";(null===(r=ii.current)||void 0===r?void 0:r.contains(u))&&(a="right");var c=function(){var e,n,t,o;if("string"==typeof i&&i.includes(s.DEVIATION_BADGE_SEPARATOR)){var r=i.split(s.DEVIATION_BADGE_SEPARATOR),l="".concat(r[0]).concat(s.DEVIATION_BADGE_SEPARATOR).concat(r[1]);return"right"===a?null===(e=$i.current[l])||void 0===e?void 0:e.current:null===(n=Xi.current[l])||void 0===n?void 0:n.current}return"right"===a?null===(t=$i.current[i])||void 0===t?void 0:t.current:null===(o=Xi.current[i])||void 0===o?void 0:o.current},d=function(e,i){var n=!!be,t=n?"right"===a?ii.current:li.current:Ze.current,o=n?"right"===a?li.current:ii.current:null;if(t&&e){var r=e.getBoundingClientRect(),l=t.getBoundingClientRect(),u=l.bottom-.35*l.height,c=l.top+.35*l.height;if(r.top>u||r.top<c){var d=l.top+l.height/2,f=r.top+r.height/2-d;if(n&&o){var v=t.scrollHeight-t.clientHeight,p=o.scrollHeight-o.clientHeight;if(f>0){var g=v-t.scrollTop,h=p-o.scrollTop;f=Math.max(0,Math.min(f,g,h))}else f=Math.min(0,Math.max(f,-t.scrollTop,-o.scrollTop));s.smoothScrollTo(o,o.scrollTop+f,250,function(){})}s.smoothScrollTo(t,t.scrollTop+f,250,i)}else i()}else i()};if(n)return _n(),Pe(new Set),Le([]),Ue.current=[],void(l&&requestAnimationFrame(function(){var e=c()||u;d(e,function(){Si({open:!0,anchorEl:e,summary:t,displayImpact:o})})}));yn(i,n,l?{toggleIfSame:!1,sourceSide:a,onReady:function(){var e=c()||u;d(e,function(){Si({open:!0,anchorEl:e,summary:t,displayImpact:o})})}}:{toggleIfSame:!1,sourceSide:a})},[yn,Ci,Si,_n,be]),Rt=n.useMemo(function(){var e;if(!he)return null;var i=null===(e=null==he?void 0:he.id)||void 0===e?void 0:e.split(":")[0];for(var n in Mi){if((Mi[n]||[]).some(function(e){return e.id===i}))return n}return null},[he,Mi]),xt=n.useRef({id:null,triggerMs:null}),_t=n.useRef(null);n.useEffect(function(){var i;if(null==he?void 0:he.id){var n=Number(he.trigger),t=xt.current;if((null==t?void 0:t.triggerMs)!==n){if(!(he.id.includes(":")&&/:\d+$/.test(he.id)))return xt.current={id:he.id,triggerMs:n},void zn(he.id);var o=null===(i=null==he?void 0:he.id)||void 0===i?void 0:i.split(":"),r=o[0],l=o[1],u=null!=l?l:"0";_t.current!==he.id&&(Ri(),Ci(),_n(),Pe(new Set),Le([]),Ue.current=[],_t.current=he.id);var a=!1,c=0,d=null,f=150,v=function(e,i){for(var n=function(e,t){if(!e)return null;if(e.id===i)return t;if(!Array.isArray(e.subsections))return null;for(var o=0;o<e.subsections.length;o++){var r=n(e.subsections[o],"".concat(t,"-").concat(o));if(r)return r}return null},t=0;t<e.length;t++){var o=n(e[t],String(t));if(o)return o}return null},p=function(){var i,t,o,l;if(!a){var g=function(){xt.current={id:he.id,triggerMs:n}},h=null,m=null;for(var S in Mi){var R=Mi[S].find(function(e){return e.id===r});if(R){h=S,m=R;break}}if(m&&h){var x=Ni.findIndex(function(e){return e.id===h}),_=ki.findIndex(function(e){return e.id===h}),y=-1===x&&-1!==_,b=v(Ni,m.id),C=v(ki,m.id);if(b&&!C&&!y){var A=b.split("-"),E=Number(A[0]);if(be){var B=null===(t=null===(i=Ni[E])||void 0===i?void 0:i.refIndexes)||void 0===t?void 0:t[0],T=ki.findIndex(function(e){return e.selfIndex===B});-1!==T&&(E=T)}C=e.__spreadArray([E],A.slice(1),!0).join("-")}if(b||C){var w=y||!b&&!!C,I=b?Number(b.split("-")[0]):x,D=C?Number(C.split("-")[0]):_;if(w){if(!(be?!!Cn["right-".concat(D)]:!!Cn[String(D)])&&D>=0)return wn(D,"right"),c+=1,void(d=setTimeout(p,450))}else if(!(be?!!Cn["left-".concat(I)]:!!Cn[String(I)])&&I>=0)return wn(I,"left"),c+=1,void(d=setTimeout(p,450));var F,O=b||"",j=C||"",P="".concat(m.id).concat(s.DEVIATION_BADGE_SEPARATOR).concat(u).concat(s.DEVIATION_BADGE_SEPARATOR).concat(O).concat(s.DEVIATION_BADGE_SEPARATOR).concat(j),N="".concat(m.id).concat(s.DEVIATION_BADGE_SEPARATOR).concat(u),k=null===(o=Xi.current[N])||void 0===o?void 0:o.current,L=null===(l=$i.current[N])||void 0===l?void 0:l.current,M=w||!k&&!!L,q=M?L:k;if(F=be?M?ii.current:li.current:Ze.current,q&&F){var H=q.getBoundingClientRect();if(0===H.height)return void((c+=1)<2?d=setTimeout(p,f):g());var V=F.getBoundingClientRect(),z=H.top-V.top+F.scrollTop-V.height/2+H.height/2+150,G=function(){var i,n,t,o,r;if(!a){g();var l=q instanceof Element?window.getComputedStyle(q).color:"";k&&(k.style.transition="box-shadow 300ms ease-in-out",k.style.boxShadow="0 0 10px ".concat(l)),L&&(L.style.transition="box-shadow 300ms ease-in-out",L.style.boxShadow="0 0 10px ".concat(l)),setTimeout(function(){k&&(k.style.boxShadow=""),L&&(L.style.boxShadow="")},2e3);var s=(null===(n=null===(i=m.evaluationResult)||void 0===i?void 0:i.deviations)||void 0===n?void 0:n[u])||m,c=(null===(t=m.evaluationResult)||void 0===t?void 0:t.evaluation_outputs)||m.evaluation_outputs;if(!(!!k&&!!L)){var d=M?(null===(o=$i.current[N])||void 0===o?void 0:o.current)||L:(null===(r=Xi.current[N])||void 0===r?void 0:r.current)||k;return mt(d,function(){Si({open:!0,anchorEl:d,displayImpact:he.displayImpact,summary:e.__assign(e.__assign({},s),{evaluation_outputs:c})})}),void(null==me||me())}yn(P,!1,{toggleIfSame:!1,sourceSide:"left",onReady:function(){var i,n,t=M?(null===(i=$i.current[N])||void 0===i?void 0:i.current)||L:(null===(n=Xi.current[N])||void 0===n?void 0:n.current)||k;mt(t,function(){Si({open:!0,anchorEl:t,displayImpact:null==he?void 0:he.displayImpact,summary:e.__assign({},s)})})}})}};Math.abs(F.scrollTop-z)<=2?G():(si.current=z,ui.current=G,F.scrollTo({top:z,behavior:"smooth"}),d&&clearTimeout(d),d=setTimeout(function(){if(ui.current){si.current=null;var e=ui.current;ui.current=null,e()}},800))}else(c+=1)<2?d=setTimeout(p,f):g()}else(c+=1)<2?d=setTimeout(p,f):g()}else(c+=1)<2?d=setTimeout(p,f):g()}};return d=setTimeout(p,f),function(){a=!0,d&&clearTimeout(d)}}}},[he,Mi,Ni,ki,be,Cn,wn,yn,Si,zn]);var yt={maintainRelativeOrder:!!be,showDeviationBadges:Ae,isProposingFix:Re,proposingFixNodeId:xe,isRedlineFlow:_e,isSideBySide:ln,activeSideBySideSection:fn,connectedSections:je,proposedSections:Ni,existingSections:ki,deviationNumberRegistry:qi,treeData:re,displayConfig:fe,resolvedMarkdownStyles:Qe,unifiedNumbering:In,expandedSections:Cn,expandedSubSections:En,setExpandedSubSections:Bn,getSectionCompareStyle:Yn,getSubSectionCompareStyle:Xn,getBadgeRef:on,getSectionRowRef:nn,getSubSectionRef:tn,sectionLeftRefs:Ui,sectionRightRefs:Yi,sectionRowRefs:en,sectionRightRowRefs:Ji,subSectionLeftRefs:Qi,subSectionRightRefs:Zi,lhsBadgeRefs:Xi,rhsBadgeRefs:$i,openMoreFunctionsPopup:function(e,i,n,t,o,r){var l;if(e.stopPropagation(),fi.open&&fi.sectionIdx===o)Ai();else{var u=e.currentTarget,a="left";(null===(l=ii.current)||void 0===l?void 0:l.contains(u))&&(a="right");xn(),gn.current&&_n(),Pe(new Set),Le([]),Ue.current=[],Ci(),mi.open?ft():Ri(),requestAnimationFrame(function(){var e=function(){var e,i,n,t;if("string"==typeof o&&o.includes(s.DEVIATION_BADGE_SEPARATOR)){var r=o.split(s.DEVIATION_BADGE_SEPARATOR),l="".concat(r[0]).concat(s.DEVIATION_BADGE_SEPARATOR).concat(r[1]);return"right"===a?null===(e=$i.current[l])||void 0===e?void 0:e.current:null===(i=Xi.current[l])||void 0===i?void 0:i.current}return"right"===a?null===(n=$i.current[o])||void 0===n?void 0:n.current:null===(t=Xi.current[o])||void 0===t?void 0:t.current}()||u;vi(qn(e,i,t,o,n,r))})}},handleOpenSummaryPopup:St,openSummaryPopup:St,handleCloseSummaryPopup:ft,toggleSection:wn,handleSubSectionToggle:Tn,renderSubSectionAccordion:function(e){var n=e.section,t=e.keyPath,o=e.depth,r=void 0===o?0:o,l=e.columnKey,s=void 0===l?"left":l,u=e.parentNodeId,a=void 0===u?"":u,c=e.sectionOffset;return i.jsx(x.default,{section:n,keyPath:t,depth:r,columnKey:s,parentNodeId:a,sectionOffset:c})},resetSideBySide:_n,setConnectedSections:Pe,setConnectedLines:Le,cachedConnectedPositions:Ue,showDeviationNavigation:gt,showOpenNodeRef:ht,deviationNodeIdToView:null==he?void 0:he.id,deviationTargetParentId:Rt};return i.jsx(C.CompareContextProvider,e.__assign({value:yt},{children:i.jsxs(t.Box,e.__assign({ref:ei,sx:e.__assign(e.__assign({display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif'},be?{}:{overflow:"visible"}),{position:"relative"})},{children:[Be&&i.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:i.jsx(f.default,{})})),mi.open&&i.jsx(b.default,{open:mi.open,anchorEl:mi.anchorEl,containerEl:Wn.current,clipTopEl:He.current,scrollContainerEl:Ze.current,onClose:ft,summary:mi.summary,displayImpact:mi.displayImpact}),i.jsx(d.default,{open:fi.open,anchorEl:fi.anchorEl,sectionTitle:fi.sectionTitle,referenceSectionTitle:fi.refSectionTitle,onClose:Ai,onOpenCognitiveCompare:yi,onOpenSideBySide:dt,onConnect:Hn,isConnected:vt,isOrphan:fi.isOrphan}),ci.open&&i.jsx(c.default,{open:ci.open,popupRef:_i,position:pi,popupConfig:ve,onClose:function(){gi(null),di(function(i){return e.__assign(e.__assign({},i),{open:!1})}),xi(null)},markdownStyles:ae,sectionTitle:ci.sectionTitle,referenceSectionTitle:ci.refSectionTitle,cognitiveData:ci.cognitiveData,anchorEl:ci.anchorEl,sectionAnchorEl:ci.sectionAnchorEl,scrollContainerEl:Ze.current,badgeStyle:ci.badgeStyle,docData:ci.docData,deviationData:ci.deviationData,isLoading:ci.isLoading}),i.jsx(t.Snackbar,e.__assign({open:!!Ie,autoHideDuration:8e3,onClose:function(){return De(null)},anchorOrigin:{vertical:"top",horizontal:"center"}},{children:i.jsx(t.Alert,e.__assign({onClose:function(){return De(null)},severity:"error",sx:{width:"100%",whiteSpace:"pre-line"}},{children:Ie}))})),i.jsx(R.default,{componentHeaderText:oe,displayConfig:fe,maintainRelativeOrder:be,onCollapseAll:ot,showCollapseAll:rt,onToggleView:function(e){Te(!0),setTimeout(function(){Ce(!e),_n(),Ri(),Pe(new Set),Le([]),Ue.current=[],requestAnimationFrame(function(){requestAnimationFrame(function(){setTimeout(function(){Te(!1)},600)})})},50)}}),i.jsx(t.Box,e.__assign({ref:Ze,onScroll:tt,sx:{flex:1,minHeight:0,pt:1.5,pb:1,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",overflowY:be?"hidden":"auto",borderTop:Fn&&On?"none":"1.5px solid #EEF0F4"}},{children:i.jsx(t.Box,e.__assign({sx:e.__assign({display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"},be?{flex:1,minHeight:0}:{})},{children:i.jsxs(t.Box,e.__assign({ref:qe,sx:e.__assign({display:"grid",gridTemplateColumns:"minmax(0, 1fr) 180px minmax(0, 1fr)",gap:"60px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0},be?{flex:1,overflow:"visible"}:{})},{children:[i.jsx(w.default,{svgContainerRef:Me,svgDimensions:nt,isResizing:an,overallConnector:et,rootDeviationStyle:kn,lines:Qn,isSideBySide:ln,activeSideBySideSection:fn,isArrowVisible:sn,maintainRelativeOrder:be,proposedSections:Ni,existingSections:ki,cognitivePopup:ci,activeBadgeId:hi,closeCognitivePopup:Ci,setActiveBadgeId:xi,openCognitivePopupFromState:bi,buildSectionPopupState:qn,connectedLines:ke,pathRefs:Ke}),i.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)"},be?{flex:1,overflow:"visible"}:{})},{children:[i.jsx(t.Box,e.__assign({ref:He,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E7E7E9",borderRadius:"8px 8px 0 0",display:"flex",alignItems:"center",minHeight:"40px",overflow:"hidden",minWidth:0}},{children:i.jsx(t.Tooltip,e.__assign({title:Di,placement:"top"},{children:i.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:Di}))}))})),i.jsxs(t.Box,e.__assign({ref:li,onScroll:tt,sx:e.__assign({p:"12px",display:"flex",flexDirection:"column"},be?{maxHeight:"calc(100vh - 150px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,mr:"-160px",pr:"172px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[i.jsx("div",{ref:oi,style:{width:"100%",height:"0px",flexShrink:0}}),Vi&&Ni.map(function(e,n){return i.jsx(_.default,{section:e,idx:n},"left-row-".concat(n))}),i.jsx("div",{ref:ri,style:{width:"100%",height:"0px",flexShrink:0}})]}))]})),i.jsx(t.Box,e.__assign({ref:Wn,sx:{width:"180px",display:"flex",flexDirection:"column",alignItems:"center",pt:"15px",gap:0,zIndex:20,pointerEvents:"none"}},{children:i.jsx(t.Box,e.__assign({sx:{display:"flex",justifyContent:"center",alignItems:"center",mt:0}},{children:i.jsxs(t.Box,e.__assign({onClick:function(i){i.stopPropagation(),ci.open&&hi===jn?Ci():(xi(jn),bi(qn(i.currentTarget,{title:"",content:"",evaluationResult:Pn,cognitiveData:{section_id:"",decisioning:[],gap:[],relevance_score:0,isMissingRationale:!0}},null,jn,!0,e.__assign(e.__assign({},kn),{label:""}))))},sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:"5px",top:"-8px",borderRadius:"20px",bgcolor:kn.badgeBg,color:kn.badgeText,border:"1px solid ".concat(kn.badgeBorder),fontSize:"12px",fontWeight:600,whiteSpace:"nowrap",position:"relative",zIndex:1,pointerEvents:"auto",cursor:"pointer"}},{children:[null!=Nn?Nn:i.jsx(v.default,{}),i.jsx(t.Box,e.__assign({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:i.jsx(r.ButtonCognitiveIcon,{})})),i.jsx(o.ChevronDown,{size:11,style:{transform:ci.open&&hi===jn?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))})),i.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},be?{flex:1,overflow:"visible",minHeight:0}:{})},{children:[dn&&i.jsx(l.default,{sections:11}),i.jsx(t.Box,e.__assign({ref:Ve,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E3E6EA",borderRadius:"8px 8px 0 0",minHeight:"40px",display:"flex",alignItems:"center",overflowX:"hidden"}},{children:i.jsx(t.Tooltip,e.__assign({title:Fi,placement:"top"},{children:i.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:Fi}))}))})),i.jsxs(t.Box,e.__assign({ref:ii,onScroll:tt,sx:e.__assign({p:"12px",display:"flex",flexDirection:"column"},be?{maxHeight:"calc(100vh - 150px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,ml:"-150px",pl:"165px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[i.jsx("div",{ref:ni,style:{width:"100%",height:"0px",flexShrink:0}}),Vi&&ki.map(function(e,n){return i.jsx(y.default,{section:e,idx:n},"right-row-".concat(n))}),i.jsx("div",{ref:ti,style:{width:"100%",height:"0px",flexShrink:0}})]}))]}))]}))}))}))]}))}))};
|
|
2
2
|
//# sourceMappingURL=CognitiveCompare.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),r=e.createContext(null),t=r.Provider;exports.CompareContextProvider=t,exports.useCompareContext=function(){var t=e.useContext(r);if(!t)throw new Error("useCompareContext must be used within CompareContextProvider");return t};
|
|
2
|
+
//# sourceMappingURL=CompareContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CompareContext.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),i=require("react/jsx-runtime"),o=require("react"),n=require("@mui/material"),t=require("lucide-react"),r=require("./SectionAccordion.js"),a=require("./ThreeDotsLoader.js"),l=require("../CognitiveComparehelpers.js"),s=require("../CompareContext.js");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=d(o).default.memo(function(o){var d,c,u=o.section,p=o.idx,x=s.useCompareContext(),g=x.maintainRelativeOrder,v=x.existingSections;x.proposedSections;var f=x.connectedSections,m=x.expandedSections,b=x.displayConfig,h=x.treeData;x.deviationNumberRegistry;var S=x.getSectionCompareStyle;x.getBadgeRef;var B=x.getSectionRowRef,_=x.sectionLeftRefs,R=x.lhsBadgeRefs,j=x.openMoreFunctionsPopup,y=x.handleOpenSummaryPopup,w=x.handleCloseSummaryPopup,C=x.toggleSection;x.showDeviationBadges,x.renderSubSectionAccordion,x.isProposingFix,x.proposingFixNodeId,x.isRedlineFlow,x.isSideBySide,x.activeSideBySideSection,x.deviationNodeIdToView,x.deviationTargetParentId;var I=x.showDeviationNavigation;x.showOpenNodeRef,x.resolvedMarkdownStyles;var N=x.unifiedNumbering,q=!u.title&&!u.content;if(g&&q)return null;var D=u,P=S(p,"left"),T=g?!(null===(d=D.refIndexes)||void 0===d?void 0:d.length)||D.selfIndex<0:!v[p],k=f.has(p),z=l.extractDeviationScore(D.evaluationResult,null==P?void 0:P.deviationLabel),A=N.leftNums.get(D.id);return i.jsx(n.Box,e.__assign({ref:B(p),sx:{mb:1,width:"100%"}},{children:i.jsxs(n.Box,e.__assign({sx:{position:"relative",width:"100%"}},{children:[i.jsx(n.Box,e.__assign({ref:_.current[p],sx:e.__assign({width:"100%",display:"flex",flexDirection:"column",minWidth:0},k&&{borderRadius:"6px",outline:"2px solid ".concat((null==P?void 0:P.badgeBorder)||"#6366F1"),outlineOffset:"1px"})},{children:i.jsx(r.default,{section:u,idx:p,columnKey:"left",colRef:B("left-accordion-".concat(p)),mb:0,parentNodeId:(null===(c=null==h?void 0:h.input_index_map)||void 0===c?void 0:c[0])||"",isExpanded:g?!!m["left-".concat(p)]:!!m[String(p)],onToggle:function(){w(),C(p,"left")},navigation:u.id?I[u.id]:null})})),g&&P&&i.jsxs(n.Box,e.__assign({ref:R.current[p],onClick:function(e){var i,o,n,t=b.enableDeviationSchemaBackwardCompatibility?null!==(i=D.evaluationResult)&&void 0!==i?i:null:null!==(n=null===(o=D.evaluationResult)||void 0===o?void 0:o[0])&&void 0!==n?n:null;y(e,String(p),T,t)},sx:{position:"absolute",top:"18px",right:0,transform:"translateY(-50%) translateX(calc(100% + 8px))",display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",bgcolor:P.badgeBg,color:P.badgeText,border:"1px solid ".concat(P.badgeBorder),borderRadius:"12px",px:1.2,py:.3,fontWeight:600,cursor:"pointer",whiteSpace:"nowrap",zIndex:20,boxShadow:"0 1px 3px rgba(0,0,0,0.07)"}},{children:[i.jsxs(n.Box,e.__assign({component:"span",onClick:function(e){var i,o,n;e.stopPropagation();var t=b.enableDeviationSchemaBackwardCompatibility?null!==(i=D.evaluationResult)&&void 0!==i?i:null:null!==(n=null===(o=D.evaluationResult)||void 0===o?void 0:o[0])&&void 0!==n?n:null;y(e,String(p),T,t)},sx:{display:"inline-flex",alignItems:"center",gap:"4px",px:.2,cursor:T?"default":"pointer",borderRight:"1px solid ".concat(P.badgeBorder),"&:hover":T?{}:{bgColor:"".concat(P.badgeBorder,"22")}}},{children:[null!=A&&i.jsx(n.Box,e.__assign({component:"span",sx:{fontSize:"11px",fontWeight:700,pr:.5,borderRight:"1px solid ".concat(P.badgeBorder)}},{children:A})),i.jsx(n.Box,e.__assign({component:"span",sx:{fontSize:"11px",px:.25}},{children:!b.isLoading||null!=D.evaluationResult&&void 0!==D.evaluationResult?"N/A"===z||"NA"===z?"N/A":0==z||null==z?"Same":"".concat(z):i.jsx(a.default,{color:P.badgeText})}))]})),i.jsx(n.Box,e.__assign({component:"span",onClick:function(e){e.stopPropagation();var i=g?v.find(function(e){var i;return null===(i=D.refIndexes)||void 0===i?void 0:i.includes(e.selfIndex)})||{title:"",content:""}:v[p]||{title:"",content:""};j(e,u,T,i,p,P)},sx:{display:"inline-flex",alignItems:"center",px:.2,cursor:"pointer","&:hover":{bgcolor:"".concat(P.badgeBorder,"22")}}},{children:i.jsx(t.EllipsisVertical,{size:11,color:P.badgeText})}))]}))]}))}),"left-row-".concat(p))});exports.default=c;
|
|
2
|
+
//# sourceMappingURL=LHSSectionRow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LHSSectionRow.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),i=require("react/jsx-runtime"),n=require("react"),o=require("@mui/material"),t=require("lucide-react"),r=require("./SectionAccordion.js"),a=require("./ThreeDotsLoader.js"),l=require("../CompareContext.js");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=d(n).default.memo(function(n){var d,s,c=n.section,u=n.idx,x=l.useCompareContext(),p=x.maintainRelativeOrder;x.existingSections;var g=x.proposedSections,v=x.connectedSections,f=x.expandedSections,h=x.displayConfig,b=x.treeData;x.deviationNumberRegistry;var m=x.getSectionCompareStyle;x.getBadgeRef;var S=x.getSectionRowRef,B=x.sectionRightRefs,_=x.rhsBadgeRefs,R=x.openMoreFunctionsPopup,j=x.handleOpenSummaryPopup,y=x.handleCloseSummaryPopup,I=x.toggleSection;x.showDeviationBadges,x.renderSubSectionAccordion,x.isProposingFix,x.proposingFixNodeId,x.isRedlineFlow,x.isSideBySide,x.activeSideBySideSection,x.deviationNodeIdToView,x.deviationTargetParentId;var w=x.showDeviationNavigation;x.showOpenNodeRef,x.resolvedMarkdownStyles;var C=x.unifiedNumbering,q=c,N=!1,P=null,D=-1;if(p){D=g.findIndex(function(e){var i;return(null===(i=e.refIndexes)||void 0===i?void 0:i.includes(q.selfIndex))&&e.selfIndex>=0});var T=g.findIndex(function(e,i){var n;return v.has(i)&&(null===(n=e.refIndexes)||void 0===n?void 0:n.includes(q.selfIndex))});(N=-1!==T)&&(P=m(T,"left"))}else(N=v.has(u))&&(P=m(u,"right"));var k=p&&-1!==D?m(D,"left"):m(u,"right"),z=p?-1!==D||!(null===(d=q.refIndexes)||void 0===d?void 0:d.length)&&g.some(function(e){return e.id&&e.id===q.id}):Boolean(g[u]),F=p?q.selfIndex<0||!z:!g[u],O=C.rightNums.get(q.id);return i.jsx(o.Box,e.__assign({ref:S(u),sx:{mb:1,width:"100%"}},{children:i.jsxs(o.Box,e.__assign({sx:{position:"relative",width:"100%"}},{children:[i.jsx(o.Box,e.__assign({ref:B.current[u],sx:e.__assign({width:"100%",display:"flex"},N&&P&&{borderRadius:"6px",outline:"2px solid ".concat(P.badgeBorder),outlineOffset:"1px"})},{children:i.jsx(r.default,{section:c,idx:u,columnKey:"right",colRef:S("right-accordion-".concat(u)),mb:0,parentNodeId:(null===(s=null==b?void 0:b.input_index_map)||void 0===s?void 0:s[1])||"",isExpanded:p?!!f["right-".concat(u)]:!!f[String(u)],onToggle:function(){y(),I(u,"right")},navigation:c.id?w[c.id]:null})})),p&&k&&i.jsx(o.Box,e.__assign({ref:_.current[u],"data-section-id":q.id,onClick:function(e){var i,n,o;if(F){var t=h.enableDeviationSchemaBackwardCompatibility?null!==(i=q.evaluationResult)&&void 0!==i?i:null:null!==(o=null===(n=q.evaluationResult)||void 0===n?void 0:n[0])&&void 0!==o?o:null;j(e,String(u),F,t)}},sx:{position:"absolute",top:"18px",left:0,transform:"translateY(-50%) translateX(calc(-100% - 8px))",display:"inline-flex",alignItems:"center",justifyContent:"center",gap:F?"4px":"0px",fontSize:"11px",bgcolor:k.badgeBg,color:k.badgeText,border:"1px solid ".concat(k.badgeBorder),borderRadius:F?"12px":"10px",px:F?1.2:1,py:.3,fontWeight:F?600:700,cursor:F?"pointer":"default",whiteSpace:"nowrap",zIndex:20,boxShadow:F?"0 1px 3px rgba(0,0,0,0.07)":"none"}},{children:F?i.jsxs(i.Fragment,{children:[i.jsxs(o.Box,e.__assign({component:"span",onClick:function(e){var i,n,o;e.stopPropagation();var t=h.enableDeviationSchemaBackwardCompatibility?null!==(i=q.evaluationResult)&&void 0!==i?i:null:null!==(o=null===(n=q.evaluationResult)||void 0===n?void 0:n[0])&&void 0!==o?o:null;j(e,String(u),F,t)},sx:{display:"inline-flex",alignItems:"center",gap:"4px",px:.2,cursor:"pointer",borderRight:"1px solid ".concat(k.badgeBorder),"&:hover":{bgcolor:"".concat(k.badgeBorder,"22")}}},{children:[null!=O&&i.jsx(o.Box,e.__assign({component:"span",sx:{fontSize:"11px",fontWeight:700,pr:.5,borderRight:"1px solid ".concat(k.badgeBorder)}},{children:O})),i.jsx(o.Box,e.__assign({component:"span",sx:{fontSize:"11px",px:.25}},{children:!h.isLoading||null!=q.evaluationResult&&void 0!==q.evaluationResult?k.label?"".concat(k.label):"100% Deviation":i.jsx(a.default,{color:k.badgeText})}))]})),i.jsx(o.Box,e.__assign({component:"span",onClick:function(e){e.stopPropagation();var i=p?g.find(function(e){var i;return null===(i=e.refIndexes)||void 0===i?void 0:i.includes(q.selfIndex)})||{title:"",content:""}:g[u]||{title:"",content:""};R(e,i,F,q,u,k)},sx:{display:"inline-flex",alignItems:"center",px:.2,cursor:"pointer","&:hover":{bgcolor:"".concat(k.badgeBorder,"22")}}},{children:i.jsx(t.EllipsisVertical,{size:11,color:k.badgeText})}))]}):null!=O?O:""}))]}))}),"right-row-".concat(u))});exports.default=s;
|
|
2
|
+
//# sourceMappingURL=RHSSectionRow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RHSSectionRow.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),i=require("react"),o=require("@mui/material"),t=require("lucide-react"),l=require("../hooks/memoizedMarkdown.js"),r=require("../CognitiveComparehelpers.js"),d=require("../CognitiveCompareConstants.js");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=a(i);exports.default=function(a){var s,c,v,f,p,g,x,h,m,_,I,b,y,A=a.section,w=a.idx,R=a.columnKey,S=a.colRef,E=a.mb,O=void 0===E?1:E,j=a.parentNodeId,B=void 0===j?"":j,F=a.isExpanded,T=a.onToggle,C=a.navigation,D=a.showOpenNodeRef,M=a.resolvedMarkdownStyles,k=a.maintainRelativeOrder,P=a.showDeviationBadges,N=void 0!==P&&P,V=a.renderSubSections,W=a.treeData,q=a.proposedSections,G=void 0===q?[]:q,K=a.existingSections,z=void 0===K?[]:K,H=a.deviationNumberRegistry,L=void 0===H?{}:H,U=a.getBadgeRef,X=a.openSummaryPopup,Y=a.getSectionCompareStyle,J=a.connectedSections,Q=a.openMoreFunctionsPopup;a.deviationNodeIdToView,a.deviationTargetParentId;var Z=a.isProposingFix,$=a.proposingFixNodeId,ee=a.isRedlineFlow,ne=a.collisionKey,ie=(null===(s=A.displayTitle)||void 0===s||s)&&r.hasValue(A.title),oe=!!Z&&!!$&&"left"===R&&A.id===$,te=r.hasMeaningfulRedlineTags(A.content),le="boolean"==typeof ee?ee:te,re=te,de=le&&te,ae=de?r.stripRedlineTags(A.content):A.content,ue=de?A.content:void 0,se=(null===(c=A.displayContent)||void 0===c||c)&&r.hasValue(ae),ce=!ie&&!se,ve=A.title;ie||(ve=se?"No Title Found":"No Matching Section Found");var fe=A.evaluationResult;if(!fe&&"right"===R)if(k){var pe=null===(v=A.refIndexes)||void 0===v?void 0:v[0],ge=G.find(function(e){return e.selfIndex===pe});fe=null==ge?void 0:ge.evaluationResult}else fe=null===(f=G[w])||void 0===f?void 0:f.evaluationResult;var xe=null===(p=null==W?void 0:W.input_index_map)||void 0===p?void 0:p[0],he=null===(g=null==W?void 0:W.input_index_map)||void 0===g?void 0:g[1],me="left"===R?he:xe,_e=function(e,n){return e.find(function(e){return(null==e?void 0:e.id)&&n&&e.id===n})},Ie="left"===R?A:G[w],be="right"===R?A:z[w],ye=u.default.useMemo(function(){if(!k)return 0;var e=1/0,n=function(i,o,t,l){var d;if(i){var a=i.id;if(l&&"right"===R){var u=G.filter(function(e){var n;return null===(n=e.refIndexes)||void 0===n?void 0:n.includes(i.selfIndex)});u.length>0&&(a=u[0].id)}var s=i.id||(null==o?void 0:o.id)||(null==t?void 0:t.id),c=(null===(d=i.evaluationResult)||void 0===d?void 0:d.deviations)||{};Object.keys(c).forEach(function(n){var i="".concat(a).concat(r.DEVIATION_BADGE_SEPARATOR).concat(n),o=null==L?void 0:L[i];null!=o&&o<e&&(e=o);var t="".concat(s).concat(r.DEVIATION_BADGE_SEPARATOR).concat(n),l=null==L?void 0:L[t];null!=l&&l<e&&(e=l)});for(var v=i.subsections||[],f=(null==o?void 0:o.subsections)||[],p=(null==t?void 0:t.subsections)||[],g=Math.max(v.length,f.length,p.length),x=0;x<g;x++)n(v[x],f[x],p[x],!1)}};return n(A,Ie,be,!0),e!==1/0?e-1:0},[A,Ie,be,R,L,k,G]);if(k)if("left"===R){var Ae=null===(x=A.refIndexes)||void 0===x?void 0:x[0],we=z.findIndex(function(e){return e.selfIndex===Ae});be=-1!==we?z[we]:_e(z,A.id)}else{var Re=null===(h=A.refIndexes)||void 0===h?void 0:h[0],Se=G.findIndex(function(e){return e.selfIndex===Re});Ie=-1!==Se?G[Se]:_e(G,A.id)}var Ee="left"===R?!be:!Ie,Oe=fe||(null==Ie?void 0:Ie.evaluationResult)||(null==be?void 0:be.evaluationResult),je=null!==(I=null===(_=null===(m=null==Oe?void 0:Oe.evaluation_outputs)||void 0===m?void 0:m.metadata)||void 0===_?void 0:_.label_color)&&void 0!==I?I:d.DEFAULT_DEVIAION_COLOR,Be=r.generateColorPalette(je).highlightBg,Fe=(null==Oe?void 0:Oe.deviations)||{},Te=w+1,Ce=A.id;if(k){var De=1,Me=new Map;if(G.forEach(function(e){!e.title&&!e.content||e.id&&Me.set(e.id,De++)}),"left"===R)Te=Me.get(A.id)||w+1;else{var ke=G.filter(function(e){var n;return null===(n=e.refIndexes)||void 0===n?void 0:n.includes(A.selfIndex)});if(ke.length>0)Te=Me.get(ke[0].id)||w+1,Ce=ke[0].id;else for(var Pe=De,Ne=function(e){if(!e.title&&!e.content)return"continue";var n=G.some(function(n){var i;return null===(i=n.refIndexes)||void 0===i?void 0:i.includes(e.selfIndex)});if(!n){if(e.id===A.id)return Te=Pe,"break";Pe++}},Ve=0,We=z;Ve<We.length;Ve++){if("break"===Ne(We[Ve]))break}}}var qe=Object.entries(Fe).map(function(e){var n=e[0],i=e[1],o="".concat(Ce).concat(r.DEVIATION_BADGE_SEPARATOR).concat(n);return{deviationKey:n,deviationMap:i,refId:o,currentIndex:L[o]}}).filter(function(e){return void 0!==e.currentIndex&&null!==e.currentIndex});qe.sort(function(e,n){return e.currentIndex-n.currentIndex});var Ge,Ke=qe.map(function(n){var i,o,t,l,d,a,u=n.deviationKey,s=n.deviationMap,c=n.refId,v=n.currentIndex;k&&void 0!==ye&&(v-=ye);var f=s[B],p=r.isMissingStr(f);if(p)f="";else if(!f)return null;var g=w,x=w;if(k)if("left"===R){var h=null===(i=A.refIndexes)||void 0===i?void 0:i[0],m=z.findIndex(function(e){return e.selfIndex===h});if(-1!==m)x=m;else{var _=z.findIndex(function(e){return e.id===A.id});x=-1!==_?_:w}}else{var I=null===(o=A.refIndexes)||void 0===o?void 0:o[0],b=G.findIndex(function(e){return e.selfIndex===I});if(-1!==b)g=b;else{var y=G.findIndex(function(e){return e.id===A.id});g=-1!==y?y:w}}var S="".concat(Ce).concat(r.DEVIATION_BADGE_SEPARATOR).concat(u).concat(r.DEVIATION_BADGE_SEPARATOR).concat(g).concat(r.DEVIATION_BADGE_SEPARATOR).concat(x),E=s[me],O=Ee||r.isMissingStr(E),j="".concat(Te,".").concat(v),F=w;if("right"===R&&k){var T=null===(t=A.refIndexes)||void 0===t?void 0:t[0],C=G.findIndex(function(e){return e.selfIndex===T});if(-1!==C)F=C;else{y=G.findIndex(function(e){return e.id===A.id});-1!==y&&(F=y)}}var D=Y?Y(F):null,M=(null==s?void 0:s.evaluation_outputs)||(null==Oe?void 0:Oe.evaluation_outputs),P=null!==(l=null==M?void 0:M.output_value)&&void 0!==l?l:null,N=null!==(a=null===(d=null==M?void 0:M.metadata)||void 0===d?void 0:d.label_color)&&void 0!==a?a:je,V=r.generateColorPalette(N),W=D?e.__assign(e.__assign({},D),{badgeBg:V.badgeBg,badgeBorder:V.badgeBorder,badgeText:V.badgeText}):e.__assign({},V),q=(null==s?void 0:s.deviation_summary)?{deviation_summary:s.deviation_summary,deviation_title:(null==s?void 0:s.deviation_title)||(null==Oe?void 0:Oe.deviation_title),deviation_impact:(null==s?void 0:s.deviation_impact)||(null==Oe?void 0:Oe.deviation_impact),deviation_explanation:(null==s?void 0:s.deviation_explanation)||(null==Oe?void 0:Oe.deviation_explanation),evaluation_outputs:M,cognitive_decisioning:(null==s?void 0:s.cognitive_decisioning)||(null==Oe?void 0:Oe.cognitive_decisioning)}:null,K=0,H=ae||"";if(f&&H){var L=H.split(/\n{2,}/),Z=L.findIndex(function(e){return e.includes(f)});if(-1!==Z){var $=Object.entries(Fe).filter(function(e){e[0];var n=e[1][B];return n&&L[Z].includes(n)}).sort(function(e,n){return L[Z].indexOf(e[1][B])-L[Z].indexOf(n[1][B])}),ee=$.filter(function(e){e[0];var n=e[1][B];return n&&(n.includes(f)||f.includes(n))});ee.length>1&&(K=Math.max(0,ee.findIndex(function(e){return e[0]===u})))}}return{id:c,actionId:S,label:j,highlight:f,side:R,style:W,stackIndex:K,score:P,isConnected:null==J?void 0:J.has(S),isOrphan:O,isMissingClause:p,badgeRef:U(R,c),onClick:function(e){e.stopPropagation(),Q&&Q(e,Ie||{id:"orphan-left",title:"",content:""},O,be||{id:"orphan-right",title:"",content:""},S,W)},onSummaryClick:function(e){e.stopPropagation(),X(e,S,O,q)}}}).filter(Boolean),ze=N||!le&&oe,He=ze?Ke:[],Le=ze?He.map(function(e){return e.highlight}).filter(Boolean):[],Ue=A.id&&R===(null==C?void 0:C.columnKey)?C:null,Xe=u.default.useRef(!1);return i.useEffect(function(){F||(Xe.current=!1)},[F]),n.jsxs(o.Box,e.__assign({ref:S,sx:{mb:O,width:"100%",display:"flex",flexDirection:"column",position:"relative",minWidth:0}},{children:[F&&(null==Ue?void 0:Ue.showAbove)&&n.jsx("div",e.__assign({style:{position:"sticky",top:0,height:"0px",cursor:"pointer"},onClick:function(){var e,n;return null===(n=null===(e=null==Ue?void 0:Ue.showAboveRef)||void 0===e?void 0:e.current)||void 0===n?void 0:n.scrollIntoView({behavior:"smooth",block:"center"})}},{children:n.jsx("div",e.__assign({style:e.__assign({transform:"translateY(-50%) translateX(calc(100% ".concat("left"===R?"+":"-"," 130px))"),position:"absolute",paddingTop:"20px"},"left"===R?{right:"0px"}:{left:"0px"})},{children:n.jsx(t.ChevronUp,{color:(null===(b=null==Ue?void 0:Ue.showAboveRef)||void 0===b?void 0:b.current)?window.getComputedStyle(Ue.showAboveRef.current).color:void 0})}))})),n.jsxs(o.Accordion,e.__assign({disableGutters:!0,expanded:!ce&&F,onChange:function(){ce||(T(),D.current=A.id)},sx:{boxShadow:"none",border:ce?"1px dashed #E2E8F0":"1px solid #E2E8F0",bgcolor:ce?"#FAFAFA":"#FFFFFF",borderRadius:"6px",flexGrow:1,width:"100%",display:"flex",flexDirection:"column",minWidth:0,"&:before":{display:"none"},"& .MuiAccordion-heading":{position:"sticky",top:-12,zIndex:10,background:"#fff"}}},{children:[n.jsx(o.AccordionSummary,e.__assign({expandIcon:ce?null:n.jsx(t.ChevronDown,{size:16}),sx:{minHeight:"36px",flexShrink:0,cursor:ce?"default":"pointer","& .MuiAccordionSummary-content":{my:.5,display:"grid",alignItems:"center",minWidth:0,width:"100%"},"& .MuiAccordionSummary-expandIconWrapper":{transition:"transform 0.2s ease"},"& .MuiAccordionSummary-expandIconWrapper.Mui-expanded":{transform:"rotate(180deg)"}}},{children:ie&&n.jsx(o.Tooltip,e.__assign({title:ve,placement:"top"},{children:n.jsx(o.Typography,e.__assign({component:"div",sx:{fontSize:"12px",color:ce?"#94A3B8":"#19213D",fontWeight:ce?400:700,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0}},{children:(Ge=ve,Ge?r.safeStringify(Ge).replace(/\\n/g,"\n").split(/(\*\*.*?\*\*)/g).map(function(e,i){return e.startsWith("**")&&e.endsWith("**")?n.jsx("strong",{children:e.slice(2,-2)},i):n.jsx(u.default.Fragment,{children:e},i)}):null)}))}))})),!ce&&n.jsxs(o.AccordionDetails,e.__assign({sx:{pt:0,pb:1.25,bgcolor:"#FFFFFF",flex:1,display:"flex",flexDirection:"column",minWidth:0}},{children:[se&&n.jsx(l.MemoizedMarkdown,{content:ae,overlayContent:ue,sxStyles:M,highlights:Le,maintainRelativeOrder:k,highlightBg:Be,suppressHighlightBg:re,deviationBadges:He,collisionKey:ne}),(A.subsections||[]).map(function(e,n){return V({section:e,keyPath:"".concat(w,"-").concat(n),depth:0,columnKey:R,parentNodeId:B,sectionOffset:ye})})]}))]})),F&&(null==Ue?void 0:Ue.showBelow)&&n.jsx("div",e.__assign({style:{position:"sticky",bottom:0,height:"0px",cursor:"pointer"},onClick:function(){var e,n;return null===(n=null===(e=null==Ue?void 0:Ue.showBelowRef)||void 0===e?void 0:e.current)||void 0===n?void 0:n.scrollIntoView({behavior:"smooth",block:"center"})}},{children:n.jsx("div",e.__assign({style:e.__assign({transform:"translateY(-50%) translateX(calc(100% ".concat("left"===R?"+":"-"," 130px))"),position:"absolute",paddingBottom:"20px"},"left"===R?{right:"0px"}:{left:"0px"})},{children:n.jsx(t.ChevronDown,{color:(null===(y=null==Ue?void 0:Ue.showBelowRef)||void 0===y?void 0:y.current)?window.getComputedStyle(Ue.showBelowRef.current).color:void 0})}))}))]}),"".concat(R,"-sec-").concat(w))};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),i=require("react"),o=require("@mui/material"),t=require("lucide-react"),l=require("../hooks/memoizedMarkdown.js"),r=require("../CompareContext.js"),d=require("../CognitiveComparehelpers.js"),a=require("../CognitiveCompareConstants.js");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=u(i);exports.default=function(u){var c,v,f,p,x,g,h,m,_,I,b,y,A,w=u.section,R=u.idx,S=u.columnKey,E=u.colRef,B=u.mb,C=void 0===B?1:B,O=u.isExpanded,j=u.onToggle,F=u.navigation,T=u.parentNodeId,D=void 0===T?"":T,M=r.useCompareContext(),k=M.showOpenNodeRef,P=M.resolvedMarkdownStyles,N=M.maintainRelativeOrder,V=M.showDeviationBadges,W=void 0!==V&&V,q=M.renderSubSectionAccordion,G=M.treeData,K=M.proposedSections,z=M.existingSections,H=M.deviationNumberRegistry,L=M.getBadgeRef,U=M.openSummaryPopup,X=M.getSectionCompareStyle,Y=M.connectedSections,J=M.openMoreFunctionsPopup;M.deviationNodeIdToView,M.deviationTargetParentId;var Q=M.isProposingFix,Z=M.proposingFixNodeId,$=M.isRedlineFlow,ee=M.isSideBySide,ne=M.activeSideBySideSection,ie="".concat(ee?"1":"0","-").concat(String(null!=ne?ne:"")),oe=(null===(c=w.displayTitle)||void 0===c||c)&&d.hasValue(w.title),te=!!Q&&!!Z&&"left"===S&&w.id===Z,le=d.hasMeaningfulRedlineTags(w.content),re="boolean"==typeof $?$:le,de=le,ae=re&&le,ue=ae?d.stripRedlineTags(w.content):w.content,se=ae?w.content:void 0,ce=(null===(v=w.displayContent)||void 0===v||v)&&d.hasValue(ue),ve=!oe&&!ce,fe=w.title;oe||(fe=ce?"No Title Found":"No Matching Section Found");var pe=w.evaluationResult;if(!pe&&"right"===S)if(N){var xe=null===(f=w.refIndexes)||void 0===f?void 0:f[0],ge=K.find(function(e){return e.selfIndex===xe});pe=null==ge?void 0:ge.evaluationResult}else pe=null===(p=K[R])||void 0===p?void 0:p.evaluationResult;var he=null===(x=null==G?void 0:G.input_index_map)||void 0===x?void 0:x[0],me=null===(g=null==G?void 0:G.input_index_map)||void 0===g?void 0:g[1],_e="left"===S?me:he,Ie=function(e,n){return e.find(function(e){return(null==e?void 0:e.id)&&n&&e.id===n})},be="left"===S?w:K[R],ye="right"===S?w:z[R],Ae=s.default.useMemo(function(){if(!N)return 0;var e=1/0,n=function(i,o,t,l){var r;if(i){var a=i.id;if(l&&"right"===S){var u=K.filter(function(e){var n;return null===(n=e.refIndexes)||void 0===n?void 0:n.includes(i.selfIndex)});u.length>0&&(a=u[0].id)}var s=i.id||(null==o?void 0:o.id)||(null==t?void 0:t.id),c=(null===(r=i.evaluationResult)||void 0===r?void 0:r.deviations)||{};Object.keys(c).forEach(function(n){var i="".concat(a).concat(d.DEVIATION_BADGE_SEPARATOR).concat(n),o=null==H?void 0:H[i];null!=o&&o<e&&(e=o);var t="".concat(s).concat(d.DEVIATION_BADGE_SEPARATOR).concat(n),l=null==H?void 0:H[t];null!=l&&l<e&&(e=l)});for(var v=i.subsections||[],f=(null==o?void 0:o.subsections)||[],p=(null==t?void 0:t.subsections)||[],x=Math.max(v.length,f.length,p.length),g=0;g<x;g++)n(v[g],f[g],p[g],!1)}};return n(w,be,ye,!0),e!==1/0?e-1:0},[w,be,ye,S,H,N,K]);if(N)if("left"===S){var we=null===(h=w.refIndexes)||void 0===h?void 0:h[0],Re=z.findIndex(function(e){return e.selfIndex===we});ye=-1!==Re?z[Re]:Ie(z,w.id)}else{var Se=null===(m=w.refIndexes)||void 0===m?void 0:m[0],Ee=K.findIndex(function(e){return e.selfIndex===Se});be=-1!==Ee?K[Ee]:Ie(K,w.id)}var Be="left"===S?!ye:!be,Ce=pe||(null==be?void 0:be.evaluationResult)||(null==ye?void 0:ye.evaluationResult),Oe=null!==(b=null===(I=null===(_=null==Ce?void 0:Ce.evaluation_outputs)||void 0===_?void 0:_.metadata)||void 0===I?void 0:I.label_color)&&void 0!==b?b:a.DEFAULT_DEVIAION_COLOR,je=d.generateColorPalette(Oe).highlightBg,Fe=(null==Ce?void 0:Ce.deviations)||{},Te=R+1,De=w.id;if(N){var Me=1,ke=new Map;if(K.forEach(function(e){!e.title&&!e.content||e.id&&ke.set(e.id,Me++)}),"left"===S)Te=ke.get(w.id)||R+1;else{var Pe=K.filter(function(e){var n;return null===(n=e.refIndexes)||void 0===n?void 0:n.includes(w.selfIndex)});if(Pe.length>0)Te=ke.get(Pe[0].id)||R+1,De=Pe[0].id;else for(var Ne=Me,Ve=function(e){if(!e.title&&!e.content)return"continue";var n=K.some(function(n){var i;return null===(i=n.refIndexes)||void 0===i?void 0:i.includes(e.selfIndex)});if(!n){if(e.id===w.id)return Te=Ne,"break";Ne++}},We=0,qe=z;We<qe.length;We++){if("break"===Ve(qe[We]))break}}}var Ge=Object.entries(Fe).map(function(e){var n=e[0],i=e[1],o="".concat(De).concat(d.DEVIATION_BADGE_SEPARATOR).concat(n);return{deviationKey:n,deviationMap:i,refId:o,currentIndex:H[o]}}).filter(function(e){return void 0!==e.currentIndex&&null!==e.currentIndex});Ge.sort(function(e,n){return e.currentIndex-n.currentIndex});var Ke,ze=Ge.map(function(n){var i,o,t,l,r,a,u=n.deviationKey,s=n.deviationMap,c=n.refId,v=n.currentIndex;N&&void 0!==Ae&&(v-=Ae);var f=s[D],p=d.isMissingStr(f);if(p)f="";else if(!f)return null;var x=R,g=R;if(N)if("left"===S){var h=null===(i=w.refIndexes)||void 0===i?void 0:i[0],m=z.findIndex(function(e){return e.selfIndex===h});if(-1!==m)g=m;else{var _=z.findIndex(function(e){return e.id===w.id});g=-1!==_?_:R}}else{var I=null===(o=w.refIndexes)||void 0===o?void 0:o[0],b=K.findIndex(function(e){return e.selfIndex===I});if(-1!==b)x=b;else{var y=K.findIndex(function(e){return e.id===w.id});x=-1!==y?y:R}}var A="".concat(De).concat(d.DEVIATION_BADGE_SEPARATOR).concat(u).concat(d.DEVIATION_BADGE_SEPARATOR).concat(x).concat(d.DEVIATION_BADGE_SEPARATOR).concat(g),E=s[_e],B=Be||d.isMissingStr(E),C="".concat(Te,".").concat(v),O=R;if("right"===S&&N){var j=null===(t=w.refIndexes)||void 0===t?void 0:t[0],F=K.findIndex(function(e){return e.selfIndex===j});if(-1!==F)O=F;else{y=K.findIndex(function(e){return e.id===w.id});-1!==y&&(O=y)}}var T=X?X(O):null,M=(null==s?void 0:s.evaluation_outputs)||(null==Ce?void 0:Ce.evaluation_outputs),k=null!==(l=null==M?void 0:M.output_value)&&void 0!==l?l:null,P=null!==(a=null===(r=null==M?void 0:M.metadata)||void 0===r?void 0:r.label_color)&&void 0!==a?a:Oe,V=d.generateColorPalette(P),W=T?e.__assign(e.__assign({},T),{badgeBg:V.badgeBg,badgeBorder:V.badgeBorder,badgeText:V.badgeText}):e.__assign({},V),q=(null==s?void 0:s.deviation_summary)?{deviation_summary:s.deviation_summary,deviation_title:(null==s?void 0:s.deviation_title)||(null==Ce?void 0:Ce.deviation_title),deviation_impact:(null==s?void 0:s.deviation_impact)||(null==Ce?void 0:Ce.deviation_impact),deviation_explanation:(null==s?void 0:s.deviation_explanation)||(null==Ce?void 0:Ce.deviation_explanation),evaluation_outputs:M,cognitive_decisioning:(null==s?void 0:s.cognitive_decisioning)||(null==Ce?void 0:Ce.cognitive_decisioning)}:null,G=0,H=ue||"";if(f&&H){var Q=H.split(/\n{2,}/),Z=Q.findIndex(function(e){return e.includes(f)});if(-1!==Z){var $=Object.entries(Fe).filter(function(e){e[0];var n=e[1][D];return n&&Q[Z].includes(n)}).sort(function(e,n){return Q[Z].indexOf(e[1][D])-Q[Z].indexOf(n[1][D])}),ee=$.filter(function(e){e[0];var n=e[1][D];return n&&(n.includes(f)||f.includes(n))});ee.length>1&&(G=Math.max(0,ee.findIndex(function(e){return e[0]===u})))}}return{id:c,actionId:A,label:C,highlight:f,side:S,style:W,stackIndex:G,score:k,isConnected:null==Y?void 0:Y.has(A),isOrphan:B,isMissingClause:p,badgeRef:L(S,c),onClick:function(e){e.stopPropagation(),J&&J(e,be||{id:"orphan-left",title:"",content:""},B,ye||{id:"orphan-right",title:"",content:""},A,W)},onSummaryClick:function(e){e.stopPropagation(),U(e,A,B,q)}}}).filter(Boolean),He=W||!re&&te,Le=He?ze:[],Ue=He?Le.map(function(e){return e.highlight}).filter(Boolean):[],Xe=w.id&&S===(null==F?void 0:F.columnKey)?F:null,Ye=s.default.useRef(!1);return i.useEffect(function(){O||(Ye.current=!1)},[O]),n.jsxs(o.Box,e.__assign({ref:E,sx:{mb:C,width:"100%",display:"flex",flexDirection:"column",position:"relative",minWidth:0}},{children:[O&&(null==Xe?void 0:Xe.showAbove)&&n.jsx("div",e.__assign({style:{position:"sticky",top:0,height:"0px",cursor:"pointer"},onClick:function(){var e,n;return null===(n=null===(e=null==Xe?void 0:Xe.showAboveRef)||void 0===e?void 0:e.current)||void 0===n?void 0:n.scrollIntoView({behavior:"smooth",block:"center"})}},{children:n.jsx("div",e.__assign({style:e.__assign({transform:"translateY(-50%) translateX(calc(100% ".concat("left"===S?"+":"-"," 130px))"),position:"absolute",paddingTop:"20px"},"left"===S?{right:"0px"}:{left:"0px"})},{children:n.jsx(t.ChevronUp,{color:(null===(y=null==Xe?void 0:Xe.showAboveRef)||void 0===y?void 0:y.current)?window.getComputedStyle(Xe.showAboveRef.current).color:void 0})}))})),n.jsxs(o.Accordion,e.__assign({disableGutters:!0,expanded:!ve&&O,onChange:function(){ve||(j(),k.current=w.id)},sx:{boxShadow:"none",border:ve?"1px dashed #E2E8F0":"1px solid #E2E8F0",bgcolor:ve?"#FAFAFA":"#FFFFFF",borderRadius:"6px",flexGrow:1,width:"100%",display:"flex",flexDirection:"column",minWidth:0,"&:before":{display:"none"},"& .MuiAccordion-heading":{position:"sticky",top:-12,zIndex:10,background:"#fff"}}},{children:[n.jsx(o.AccordionSummary,e.__assign({expandIcon:ve?null:n.jsx(t.ChevronDown,{size:16}),sx:{minHeight:"36px",flexShrink:0,cursor:ve?"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:oe&&n.jsx(o.Tooltip,e.__assign({title:fe,placement:"top"},{children:n.jsx(o.Typography,e.__assign({component:"div",sx:{fontSize:"12px",color:ve?"#94A3B8":"#19213D",fontWeight:ve?400:700,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0}},{children:(Ke=fe,Ke?d.safeStringify(Ke).replace(/\\n/g,"\n").split(/(\*\*.*?\*\*)/g).map(function(e,i){return e.startsWith("**")&&e.endsWith("**")?n.jsx("strong",{children:e.slice(2,-2)},i):n.jsx(s.default.Fragment,{children:e},i)}):null)}))}))})),!ve&&n.jsxs(o.AccordionDetails,e.__assign({sx:{pt:0,pb:1.25,bgcolor:"#FFFFFF",flex:1,display:"flex",flexDirection:"column",minWidth:0}},{children:[ce&&n.jsx(l.MemoizedMarkdown,{content:ue,overlayContent:se,sxStyles:P,highlights:Ue,maintainRelativeOrder:N,highlightBg:je,suppressHighlightBg:de,deviationBadges:Le,collisionKey:ie}),(w.subsections||[]).map(function(e,n){return q({section:e,keyPath:"".concat(R,"-").concat(n),depth:0,columnKey:S,parentNodeId:D,sectionOffset:Ae})})]}))]})),O&&(null==Xe?void 0:Xe.showBelow)&&n.jsx("div",e.__assign({style:{position:"sticky",bottom:0,height:"0px",cursor:"pointer"},onClick:function(){var e,n;return null===(n=null===(e=null==Xe?void 0:Xe.showBelowRef)||void 0===e?void 0:e.current)||void 0===n?void 0:n.scrollIntoView({behavior:"smooth",block:"center"})}},{children:n.jsx("div",e.__assign({style:e.__assign({transform:"translateY(-50%) translateX(calc(100% ".concat("left"===S?"+":"-"," 130px))"),position:"absolute",paddingBottom:"20px"},"left"===S?{right:"0px"}:{left:"0px"})},{children:n.jsx(t.ChevronDown,{color:(null===(A=null==Xe?void 0:Xe.showBelowRef)||void 0===A?void 0:A.current)?window.getComputedStyle(Xe.showBelowRef.current).color:void 0})}))}))]}),"".concat(S,"-sec-").concat(R))};
|
|
2
2
|
//# sourceMappingURL=SectionAccordion.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),i=require("react"),t=require("@mui/material"),o=require("lucide-react"),l=require("../hooks/memoizedMarkdown.js"),r=require("../CompareContext.js"),a=require("../CognitiveComparehelpers.js"),d=require("../CognitiveCompareConstants.js");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=s(i).default.memo(function(s){var c,v,f,p,g,h,x,_,m,b,y=s.section,S=s.keyPath,I=s.depth,R=void 0===I?0:I,C=s.columnKey,B=void 0===C?"left":C,E=s.parentNodeId,O=void 0===E?"":E,j=s.sectionOffset,A=r.useCompareContext(),P=A.expandedSubSections,k=A.setExpandedSubSections,w=A.maintainRelativeOrder,F=A.showDeviationBadges,M=void 0!==F&&F,T=A.proposedSections,D=A.existingSections,N=A.treeData,q=A.deviationNumberRegistry,V=A.connectedSections,K=A.activeSideBySideSection,W=A.resolvedMarkdownStyles,z=A.getSubSectionRef,G=A.getSubSectionCompareStyle,H=A.getBadgeRef,L=A.openMoreFunctionsPopup,U=A.openSummaryPopup,J=A.resetSideBySide,Q=A.setConnectedSections,X=A.setConnectedLines,Y=A.cachedConnectedPositions,Z=A.isProposingFix,$=A.proposingFixNodeId,ee=A.isRedlineFlow,ne=null!=K?K:"",ie=(null===(c=y.displayTitle)||void 0===c||c)&&a.hasValue(y.title),te=!!Z&&!!$&&"left"===B&&y.id===$,oe=a.hasMeaningfulRedlineTags(y.content),le="boolean"==typeof ee?ee:oe,re=oe,ae=le&&oe,de=ae?a.stripRedlineTags(y.content):y.content,se=ae?y.content:void 0,ue=(null===(v=y.displayContent)||void 0===v||v)&&a.hasValue(de),ce=!ie&&!ue,ve=ie?y.title:ue?"No Title Found":"No Matching Section Found",fe=!!P[S],pe=z(B,S),ge=S.split("-").map(Number),he=ge[0],xe=T[he],_e=D[he],me=S,be=S,ye=he,Se=he,Ie=function(e,n,i){if(!e||!n)return null;if(e.id===n)return{section:e,keyPath:i};for(var t=(e.subsections||[]).map(function(e,n){return{section:e,keyPath:"".concat(i,"-").concat(n)}}),o=function(){var e=t.shift();return(null==e?void 0:e.section)?e.section.id===n?{value:e}:void(e.section.subsections||[]).forEach(function(n,i){t.push({section:n,keyPath:"".concat(e.keyPath,"-").concat(i)})}):"continue"};t.length>0;){var l=o();if("object"==typeof l)return l.value}return null};if(w)if("left"===B){var Re=null===(f=null==xe?void 0:xe.refIndexes)||void 0===f?void 0:f[0],Ce=D.findIndex(function(e){return e.selfIndex===Re});-1!==Ce&&(_e=D[Ce],Se=Ce)}else{var Be=null===(p=null==_e?void 0:_e.refIndexes)||void 0===p?void 0:p[0],Ee=T.findIndex(function(e){return e.selfIndex===Be});-1!==Ee&&(xe=T[Ee],ye=Ee)}var Oe=xe,je=_e;if(w)if("left"===B){Oe=y,me=S;var Ae=Ie(_e,y.id,String(Se));je=(null==Ae?void 0:Ae.section)||null,be=(null==Ae?void 0:Ae.keyPath)||""}else{je=y,be=S;var Pe=Ie(xe,y.id,String(ye));Oe=(null==Pe?void 0:Pe.section)||null,me=(null==Pe?void 0:Pe.keyPath)||""}else for(var ke=1;ke<ge.length;ke++)(null==Oe?void 0:Oe.subsections)&&(Oe=Oe.subsections[ge[ke]]),(null==je?void 0:je.subsections)&&(je=je.subsections[ge[ke]]);var we=(me?G(me):null)||G(S),Fe=null===(g=null==N?void 0:N.input_index_map)||void 0===g?void 0:g[0],Me=null===(h=null==N?void 0:N.input_index_map)||void 0===h?void 0:h[1],Te="left"===B?Me:Fe,De="left"===B?!je:!Oe,Ne=y.evaluationResult||(null==Oe?void 0:Oe.evaluationResult)||(null==je?void 0:je.evaluationResult),qe=he+1,Ve=y.id||(null==Oe?void 0:Oe.id)||(null==je?void 0:je.id);if(w){var Ke=1,We=new Map;if(T.forEach(function(e){!e.title&&!e.content||e.id&&We.set(e.id,Ke++)}),"left"===B)qe=We.get(null==xe?void 0:xe.id)||he+1;else{var ze=T.filter(function(e){var n;return null===(n=e.refIndexes)||void 0===n?void 0:n.includes(null==_e?void 0:_e.selfIndex)});if(ze.length>0)qe=We.get(ze[0].id)||he+1;else for(var Ge=Ke,He=function(e){if(!e.title&&!e.content)return"continue";var n=T.some(function(n){var i;return null===(i=n.refIndexes)||void 0===i?void 0:i.includes(e.selfIndex)});if(!n){if(e.id===(null==_e?void 0:_e.id))return qe=Ge,"break";Ge++}},Le=0,Ue=D;Le<Ue.length;Le++){if("break"===He(Ue[Le]))break}}}var Je=null!==(m=null===(_=null===(x=null==Ne?void 0:Ne.evaluation_outputs)||void 0===x?void 0:x.metadata)||void 0===_?void 0:_.label_color)&&void 0!==m?m:d.DEFAULT_DEVIAION_COLOR,Qe=a.generateColorPalette(Je).highlightBg,Xe=(null==Ne?void 0:Ne.deviations)||{},Ye=Object.entries(Xe).map(function(e){var n=e[0],i=e[1],t="".concat(Ve).concat(a.DEVIATION_BADGE_SEPARATOR).concat(n);return{deviationKey:n,deviationMap:i,refId:t,currentIndex:q[t]}}).filter(function(e){return void 0!==e.currentIndex&&null!==e.currentIndex});Ye.sort(function(e,n){return e.currentIndex-n.currentIndex});var Ze=Ye.map(function(n){var i,t,o,l=n.deviationKey,r=n.deviationMap,d=n.refId,s=n.currentIndex;w&&void 0!==j&&(s-=j);var u=r[O],c=a.isMissingStr(u);if(c)u="";else if(!u)return null;var v=r[Te],f=De||a.isMissingStr(v),p="".concat(qe,".").concat(s),g="".concat(Ve).concat(a.DEVIATION_BADGE_SEPARATOR).concat(l).concat(a.DEVIATION_BADGE_SEPARATOR).concat(me).concat(a.DEVIATION_BADGE_SEPARATOR).concat(be),h=(null==r?void 0:r.evaluation_outputs)||(null==Ne?void 0:Ne.evaluation_outputs),x=null!==(i=null==h?void 0:h.output_value)&&void 0!==i?i:null,_=null!==(o=null===(t=null==h?void 0:h.metadata)||void 0===t?void 0:t.label_color)&&void 0!==o?o:Je,m=a.generateColorPalette(_),b=e.__assign({},m),y=(null==r?void 0:r.deviation_summary)?{deviation_summary:r.deviation_summary||(null==Ne?void 0:Ne.deviation_summary),deviation_title:(null==r?void 0:r.deviation_title)||(null==Ne?void 0:Ne.deviation_title),deviation_impact:(null==r?void 0:r.deviation_impact)||(null==Ne?void 0:Ne.deviation_impact),deviation_explanation:(null==r?void 0:r.deviation_explanation)||(null==Ne?void 0:Ne.deviation_explanation),evaluation_outputs:h,cognitive_decisioning:(null==r?void 0:r.cognitive_decisioning)||(null==Ne?void 0:Ne.cognitive_decisioning)}:null,S=0,I=de||"";if(u&&I){var R=I.split(/\n{2,}/),C=R.findIndex(function(e){return e.includes(u)});if(-1!==C){var E=Object.entries(Xe).filter(function(e){e[0];var n=e[1][O];return n&&R[C].includes(n)}).sort(function(e,n){return R[C].indexOf(e[1][O])-R[C].indexOf(n[1][O])}),A=E.filter(function(e){e[0];var n=e[1][O];return n&&(n.includes(u)||u.includes(n))});A.length>1&&(S=Math.max(0,A.findIndex(function(e){return e[0]===l})))}}return{id:d,actionId:g,label:p,highlight:u,side:B,style:b,stackIndex:S,score:x,isConnected:V.has(g),isOrphan:f,isMissingClause:c,badgeRef:H(B,d),onClick:function(n){n.stopPropagation();var i=Oe?e.__assign(e.__assign({},Oe),{title:(null==xe?void 0:xe.title)||(null==Oe?void 0:Oe.title)||""}):{id:"orphan-left",title:"",content:""},t=je?e.__assign(e.__assign({},je),{title:(null==_e?void 0:_e.title)||(null==je?void 0:je.title)||""}):{id:"orphan-right",title:"",content:""};L(n,i,f,t,g,b)},onSummaryClick:function(e){e.stopPropagation(),U(e,g,f,y)}}}).filter(Boolean).sort(function(e,n){return parseFloat(e.label)-parseFloat(n.label)}),$e=M||!le&&te,en=$e?Ze:[],nn=$e?en.map(function(e){return e.highlight}).filter(Boolean):[],tn=i.useRef(!1);i.useEffect(function(){fe||(tn.current=!1)},[fe]),i.useEffect(function(){if(fe&&!tn.current){var e=setTimeout(function(){var e,n;tn.current=!0;var i=null===(n=null===(e=Ze[0])||void 0===e?void 0:e.badgeRef)||void 0===n?void 0:n.current;i&&i.scrollIntoView({behavior:"smooth",block:"center"})},350);return function(){return clearTimeout(e)}}},[fe,Ze]);var on=Ze.find(function(e){return V.has(e.actionId)}),ln=!!on;if(!(ie||ue||y.subsections&&0!==y.subsections.length))return null;var rn=(null===(b=null==on?void 0:on.style)||void 0===b?void 0:b.badgeBorder)||(null==we?void 0:we.badgeBorder),an=ln&&rn?{borderRadius:"4px",outline:"2px solid ".concat(rn),outlineOffset:"1px"}:{};return ie?n.jsx(t.Box,e.__assign({ref:pe,sx:{mt:1,width:"100%",minWidth:0,position:"relative"}},{children:n.jsx(t.Box,e.__assign({sx:e.__assign({width:"100%"},an)},{children:n.jsxs(t.Accordion,e.__assign({disableGutters:!0,expanded:!ce&&fe,onChange:function(){if(!ce){if(fe){var n=String(K||""),i=n.includes(me)||n.includes(be);i||V.forEach(function(e){(String(e).includes(me)||String(e).includes(be))&&(i=!0)}),i&&(J(),Q(new Set),X([]),Y.current=[])}k(function(n){var i;return e.__assign(e.__assign({},n),((i={})[S]=!n[S],i))})}},sx:{mt:0,boxShadow:"none",border:ce?"1px dashed #E2E8F0":"1px solid #EEF2F7",borderRadius:"4px !important",bgcolor:"#FFFFFF",minWidth:0,"&:before":{display:"none"}}},{children:[n.jsx(t.AccordionSummary,e.__assign({expandIcon:ce?null:n.jsx(o.ChevronDown,{size:14}),sx:{minHeight:"32px","& .MuiAccordionSummary-content":{my:.5,display:"grid",alignItems:"center",minWidth:0,width:"100%"}}},{children:n.jsx(t.Typography,e.__assign({component:"div",sx:{fontSize:"11px",fontWeight:600,color:ce?"#94A3B8":"#19213D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0}},{children:ve||"Untitled Subsection"}))})),!ce&&n.jsxs(t.AccordionDetails,e.__assign({sx:{pt:0,pb:1,minWidth:0}},{children:[ue&&n.jsx(l.MemoizedMarkdown,{content:de,overlayContent:se,sxStyles:W,deviationBadges:en,maintainRelativeOrder:w,highlightBg:Qe,suppressHighlightBg:re,highlights:nn,collisionKey:ne}),(y.subsections||[]).map(function(e,i){return n.jsx(u,{section:e,keyPath:"".concat(S,"-").concat(i),depth:R+1,columnKey:B,parentNodeId:O},"".concat(S,"-").concat(i))})]}))]}))}))})):n.jsx(t.Box,e.__assign({ref:pe,sx:{mt:0===R?1:.75,width:"100%",minWidth:0,position:"relative"}},{children:!ce&&n.jsxs(t.Box,e.__assign({sx:e.__assign({width:"100%"},an)},{children:[ue&&n.jsx(l.MemoizedMarkdown,{content:de,overlayContent:se,sxStyles:W,deviationBadges:en,maintainRelativeOrder:w,highlightBg:Qe,suppressHighlightBg:re,highlights:nn,collisionKey:ne}),(y.subsections||[]).map(function(e,i){return n.jsx(u,{section:e,keyPath:"".concat(S,"-").concat(i),depth:R+1,columnKey:B,parentNodeId:O,sectionOffset:j},"".concat(S,"-").concat(i))})]}))}))});exports.default=u;
|
|
2
2
|
//# sourceMappingURL=SubSectionAccordion.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("react/jsx-runtime"),i=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,A=d.buildSectionPopupState,P=d.connectedLines,R=d.pathRefs;return t.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&&t.jsx("g",{children:t.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,P=r.x1+.5*(r.x2-r.x1),R=(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 z=(null==k?void 0:k.title)||"",V=(null==K?void 0:K.title)||"",F=1;F<L.length;F+=1)(null==k?void 0:k.subsections)&&(k=k.subsections[L[F]]||null);for(F=1;F<N.length;F+=1)(null==K?void 0:K.subsections)&&(K=K.subsections[N[F]]||null);k&&(w=e.__assign(e.__assign({},k),{title:z||k.title})),K&&(E=e.__assign(e.__assign({},K),{title:V||K.title}))}var M=!(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),W=(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,G=M||W;return t.jsxs("g",{children:[t.jsx("path",{d:D,fill:"none",stroke:r.style.badgeBorder||"#E2E8F0",strokeWidth:"1.5"}),t.jsx("foreignObject",e.__assign({x:P-100,y:R-14,width:"200",height:"28",style:{pointerEvents:"auto",overflow:"visible"}},{children:t.jsx(a.Box,e.__assign({sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},{children:t.jsxs(a.Box,e.__assign({onClick:function(e){e.stopPropagation(),G&&(j.open&&m===r.id?I():(B(r.id),C(A(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:G?"pointer":"default"}},{children:[r.style.badgeText===o.DEFAULT_DEVIAION_COLOR&&null==r.style.label?t.jsx(l.default,{color:r.style.badgeText}):null==r.style.label?null:"0"===String(r.style.label)?"Same":r.style.label,t.jsx(a.Box,e.__assign({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:t.jsx(n.ButtonCognitiveIcon,{})})),G&&t.jsx(i.ChevronDown,{size:11,style:{transform:j.open&&m===r.id?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))}))]},r.id)}),t.jsx(r.default,{connectedLines:P,pathRefs:R})]}))};
|
|
2
|
+
//# sourceMappingURL=SvgConnectors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SvgConnectors.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react"),t=require("../CognitiveCompareConstants.js");exports.useComparePopups=function(o){var i=n.useState(t.EMPTY_SECTION_POPUP_STATE),r=i[0],u=i[1],a=n.useState(t.EMPTY_SECTION_POPUP_STATE),c=a[0],l=a[1],s=n.useState(t.EMPTY_SUMMARY_POPUP_STATE),P=s[0],p=s[1],_=n.useCallback(function(){p(t.EMPTY_SUMMARY_POPUP_STATE)},[]),f=n.useState(null),E=f[0],v=f[1],m=n.useState(null),T=m[0],d=m[1],A=n.useRef(null),O=n.useRef(null);n.useEffect(function(){O.current=null},[r.sectionIdx,r.open]);var M=n.useCallback(function(){v(null),u(t.EMPTY_SECTION_POPUP_STATE),d(null)},[]),S=n.useCallback(function(){l(t.EMPTY_SECTION_POPUP_STATE)},[]),I=n.useCallback(function(){var e;if(r.anchorEl&&r.refSectionTitle){var n=r.anchorEl.getBoundingClientRect();if(0!==n.width||0!==n.height){var o=(null===(e=null==A?void 0:A.current)||void 0===e?void 0:e.offsetHeight)||0,i=Math.min(t.POPUP_WIDTH,window.innerWidth-2*t.VIEWPORT_MARGIN),u=window.innerHeight-n.bottom-t.POPUP_GAP-t.VIEWPORT_MARGIN,a=n.top-t.POPUP_GAP-t.VIEWPORT_MARGIN,c=u<o&&a>u;c=null!==O.current?!0===O.current&&(a>=o||a>=u):!(u>=o||u>=a),O.current=c;var l=c?a:u,s=Math.min(o||9999,l),P=c?n.top-t.POPUP_GAP-s:n.bottom+t.POPUP_GAP,p=n.left+n.width/2,_=p-i/2,f=Math.max(t.VIEWPORT_MARGIN,Math.min(_,window.innerWidth-i-t.VIEWPORT_MARGIN)),E=Math.max(t.ARROW_SIZE+4,Math.min(p-f,i-t.ARROW_SIZE-4));v({top:P,left:f,arrowLeft:E,openAbove:c,maxHeight:l})}}},[r.anchorEl,r.refSectionTitle]);n.useEffect(function(){if(r.open){window.addEventListener("resize",I);var e=requestAnimationFrame(I),n=null;return A.current&&(n=new ResizeObserver(function(){cancelAnimationFrame(e),e=requestAnimationFrame(I)})).observe(A.current),function(){cancelAnimationFrame(e),window.removeEventListener("resize",I),null==n||n.disconnect()}}},[r.open,I]),n.useEffect(function(){var e=o.current;if(e&&(c.open||r.open)){var n=function(e){S(),A.current&&A.current.contains(e.target)||(v(null),M())};return e.addEventListener("scroll",n,{capture:!0}),function(){e.removeEventListener("scroll",n,{capture:!0})}}},[o,c.open,r.open,S,M]);var R=n.useCallback(function(e){S(),v(null),u(e)},[S]),h=n.useCallback(function(){null!==c.sectionIdx&&c.anchorEl?R(e.__assign(e.__assign({},c),{open:!0})):S()},[c,S,R]);return{cognitivePopup:r,setCognitivePopup:u,moreFunctions:c,setMoreFunctions:l,summaryPopup:P,setSummaryPopup:p,closeSummaryPopup:_,position:E,setPosition:v,activeBadgeId:T,setActiveBadgeId:d,popupRef:A,closeCognitivePopup:M,closeMoreFunctionsPopup:S,recalcPosition:I,handleOpenCognitiveCompare:h,openCognitivePopupFromState:R}};
|
|
2
2
|
//# sourceMappingURL=useComparePopups.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("react"),e=require("../CognitiveComparehelpers.js");exports.useLinesCalculator=function(n){var i=n.containerRef,r=n.leftContainerRef,c=n.rightContainerRef;n.svgContainerRef;var o=n.pathRefs,l=n.leftHeaderRef,u=n.rightHeaderRef,a=n.proposedSections,d=n.existingSections,v=n.visibleFields,s=n.leftRefs,h=n.rightRefs,f=n.sectionLeftRefs,g=n.sectionRightRefs,p=n.subSectionLeftRefs,R=n.subSectionRightRefs,y=n.lhsBadgeRefs,x=n.rhsBadgeRefs;n.sectionRowRefs;var B=n.expandedSections,C=n.expandedSubSections,S=n.connectedSections,m=n.isSideBySide,A=n.activeSideBySideSection,b=n.maintainRelativeOrder,I=n.cognitiveMap,E=n.getSectionCompareStyle,T=n.getSubSectionCompareStyle,M=n.getDeviationStyleByKey,L=n.isArrowVisible,D=n.isAnimatingRef,O=n.isSideBySideRef,H=n.sideBySideCacheRef,P=n.sideBySideLineRef,_=n.activeSideBySideSectionRef;n.activeSideBySideRightSectionRef;var N=n.connectedLines,V=n.setConnectedLines,k=n.cachedConnectedPositions,w=n.calculateLinesRef,G=n.resizeTimerRef,Y=n.scrollLock,j=n.handleResizeRef,F=n.activeProposed,z=n.existingRule,q=n.analysisData,K=n.pendingScrollTargetRef,J=n.pendingScrollCallbackRef,Q=n.resolvedComparisonConfig,U=n.getFieldData,W=t.useState([]),X=W[0],Z=W[1],$=t.useState(null),tt=$[0],et=$[1],nt=t.useState([]),it=nt[0],rt=nt[1],ct=null!=N?N:it,ot=null!=V?V:rt,lt=t.useState({width:0,height:0}),ut=lt[0],at=lt[1],dt=t.useRef(!1),vt=t.useRef(!1),st=t.useRef(null),ht=t.useRef([]),ft=null!=k?k:ht,gt=t.useCallback(function(){var t,n,o,L,O,H,P,_,N,V,k,w,G,Y,j,F,z,q,K,J,Q,U,W;if(!dt.current&&!D.current){dt.current=!0;try{if(!i.current)return;var X=function(t){var e=t.split("-"),n=e[0];if(!B[n]&&!1===b)return!1;if(b&&!B["left-".concat(n)]&&!B["right-".concat(n)]&&!B[n])return!1;for(var i=n,r=1;r<e.length-1;r++)if(i+="-".concat(e[r]),!C[i])return!1;return!0},$=i.current.getBoundingClientRect();at({width:$.width,height:$.height});var tt=[];if(v.forEach(function(t){var e,n,i=t.key,r=null===(e=s.current[i])||void 0===e?void 0:e.current,c=null===(n=h.current[i])||void 0===n?void 0:n.current;r&&c&&(r.style.height="auto",c.style.height="auto",r.style.minHeight="0px",c.style.minHeight="0px")}),!D.current){for(var nt=0;nt<Math.max(a.length,d.length);nt++){var it=null===(t=f.current[nt])||void 0===t?void 0:t.current,rt=null===(n=g.current[nt])||void 0===n?void 0:n.current;it&&(it.style.height="auto",it.style.minHeight="0px"),rt&&(rt.style.height="auto",rt.style.minHeight="0px")}b||Object.keys(p.current).forEach(function(t){var e,n;if(X(t)){var i=null===(e=p.current[t])||void 0===e?void 0:e.current,r=null===(n=R.current[t])||void 0===n?void 0:n.current;i&&r&&(i.style.height="auto",r.style.height="auto",i.style.minHeight="0px",r.style.minHeight="0px")}})}var ct={};v.forEach(function(t){var e,n,i=t.key,r=null===(e=s.current[i])||void 0===e?void 0:e.current,c=null===(n=h.current[i])||void 0===n?void 0:n.current;if(r&&c){var o=r.getBoundingClientRect(),l=c.getBoundingClientRect();ct[i]=Math.max(o.height,l.height)}});var lt={left:{},right:{}},ut={};if(!D.current)if(b){if(m&&null!==A)if("number"==typeof A){var vt=A,st=a[vt],ht=null===(O=f.current[vt])||void 0===O?void 0:O.current;ht&&st&&(st.refIndexes||[]).forEach(function(t){var e,n=d.findIndex(function(e){return e.selfIndex===t}),i=null===(e=g.current[n])||void 0===e?void 0:e.current;if(i&&(B["left-".concat(vt)]||B["right-".concat(n)])){var r=Math.max(ht.getBoundingClientRect().height,i.getBoundingClientRect().height);lt.left[vt]=Math.max(lt.left[vt]||0,r),lt.right[n]=Math.max(lt.right[n]||0,r)}})}else{var gt=A.split(e.DEVIATION_BADGE_SEPARATOR)[2];if(gt){it=null===(H=p.current[gt])||void 0===H?void 0:H.current,rt=null===(P=R.current[gt])||void 0===P?void 0:P.current;if(it&&rt){pt=Math.max(it.getBoundingClientRect().height,rt.getBoundingClientRect().height);ut[gt]=Math.max(ut[gt]||0,pt)}}}}else{Object.keys(p.current).forEach(function(t){var e,n;if(X(t)){var i=null===(e=p.current[t])||void 0===e?void 0:e.current,r=null===(n=R.current[t])||void 0===n?void 0:n.current;if(i&&r&&null!==i.offsetParent&&null!==r.offsetParent){var c=i.getBoundingClientRect(),o=r.getBoundingClientRect(),l=Math.max(c.height,o.height);ut[t]=l,i.style.minHeight="".concat(l,"px"),r.style.minHeight="".concat(l,"px")}}});for(nt=0;nt<Math.min(a.length,d.length);nt++){var it=null===(o=f.current[nt])||void 0===o?void 0:o.current,rt=null===(L=g.current[nt])||void 0===L?void 0:L.current;if(it&&rt){var pt=Math.max(it.getBoundingClientRect().height,rt.getBoundingClientRect().height);lt.left[nt]=pt,lt.right[nt]=pt}}}if(v.forEach(function(t){var e,n,i=t.key,r=null===(e=s.current[i])||void 0===e?void 0:e.current,c=null===(n=h.current[i])||void 0===n?void 0:n.current;if(r&&c){var o=ct[i];r.style.minHeight="".concat(o,"px"),c.style.minHeight="".concat(o,"px")}}),D.current||(Object.entries(lt.left).forEach(function(t){var e,n=t[0],i=t[1],r=null===(e=f.current[Number(n)])||void 0===e?void 0:e.current;r&&(r.style.minHeight="".concat(i,"px"))}),Object.entries(lt.right).forEach(function(t){var e,n=t[0],i=t[1],r=null===(e=g.current[Number(n)])||void 0===e?void 0:e.current;r&&(r.style.minHeight="".concat(i,"px"))}),b||Object.keys(ut).forEach(function(t){var e,n,i=null===(e=p.current[t])||void 0===e?void 0:e.current,r=null===(n=R.current[t])||void 0===n?void 0:n.current;if(i&&r&&ut[t]){var c=ut[t];i.style.minHeight="".concat(c,"px"),r.style.minHeight="".concat(c,"px")}})),b)a.forEach(function(t,e){var n;(null===(n=f.current[e])||void 0===n?void 0:n.current)&&(t.refIndexes||[]).forEach(function(t){var n,i,o,l,u,a,v,s,h,f,g=d.findIndex(function(e){return e.selfIndex===t});if(-1!==g){var p=null===(n=y.current[e])||void 0===n?void 0:n.current,R=null===(i=x.current[g])||void 0===i?void 0:i.current;if(p&&R){var B=p.getBoundingClientRect(),C=R.getBoundingClientRect(),S=B.right-$.left,b=C.left-$.left,I=B.top+B.height/2-$.top,T=C.top+C.height/2-$.top;if(m&&A===e){var M=null!==(l=null===(o=r.current)||void 0===o?void 0:o.getBoundingClientRect().top)&&void 0!==l?l:0,L=null!==(a=null===(u=c.current)||void 0===u?void 0:u.getBoundingClientRect().top)&&void 0!==a?a:0,D=M+(null!==(s=null===(v=r.current)||void 0===v?void 0:v.clientHeight)&&void 0!==s?s:1/0),O=L+(null!==(f=null===(h=c.current)||void 0===h?void 0:h.clientHeight)&&void 0!==f?f:1/0),H=B.top+B.height/2,P=C.top+C.height/2,_=function(t,e,n){return Math.max(e,Math.min(n,t))};I=_(H,M,D)-$.top,T=_(P,L,O)-$.top}var N=E(e);N&&tt.push({id:"line-".concat(e,"-").concat(g),x1:S,y1:I,x2:b,y2:T,style:N,sectionIdx:e,targetRightIdx:g})}}})});else{for(nt=0;nt<Math.min(a.length,d.length);nt++){var Rt=null===(_=f.current[nt])||void 0===_?void 0:_.current,yt=null===(N=g.current[nt])||void 0===N?void 0:N.current;if(Rt&&yt){var xt=Rt.getBoundingClientRect(),Bt=yt.getBoundingClientRect(),Ct=Math.max(xt.top,Bt.top)+18-$.top,St=(null===(V=d[nt])||void 0===V?void 0:V.id)||"sec-".concat(nt);(Lt=E(nt))&&tt.push({id:St,x1:xt.right-$.left,y1:Ct,x2:Bt.left-$.left,y2:Ct,style:Lt,sectionIdx:nt,hasCognitive:!!((null===(k=a[nt])||void 0===k?void 0:k.cognitiveData)||(null===(w=d[nt])||void 0===w?void 0:w.cognitiveData)||St&&I[St]),isSubSection:!1})}}Object.keys(p.current).forEach(function(t){var n,i,r,c,o,l;if(X(t)){var u=null===(n=p.current[t])||void 0===n?void 0:n.current,v=null===(i=R.current[t])||void 0===i?void 0:i.current;if(u&&v){for(var s=t.split("-").map(Number),h=a[s[0]],f=d[s[0]],g=1;g<s.length;g++)(null==h?void 0:h.subsections)&&(h=h.subsections[s[g]]),(null==f?void 0:f.subsections)&&(f=f.subsections[s[g]]);var y=!!h&&((null===(r=h.displayTitle)||void 0===r||r)&&e.hasValue(h.title)),x=!!h&&((null===(c=h.displayContent)||void 0===c||c)&&e.hasValue(h.content)),B=!!f&&((null===(o=f.displayTitle)||void 0===o||o)&&e.hasValue(f.title)),C=!!f&&((null===(l=f.displayContent)||void 0===l||l)&&e.hasValue(f.content));if(y&&x||B&&C){var S=u.getBoundingClientRect(),m=v.getBoundingClientRect(),A=Math.max(S.top,m.top)+16-$.top,b=T(t);b&&"Not Defined"!==b.label&&tt.push({id:"subsec-".concat(t),x1:S.right-$.left,y1:A,x2:m.left-$.left,y2:A,style:b,sectionIdx:s[0],isSubSection:!0,subSectionKeyPath:t,hasCognitive:!(!(null==h?void 0:h.cognitiveData)&&!(null==f?void 0:f.cognitiveData))})}}}})}if(m&&"string"==typeof A&&A.includes(e.DEVIATION_BADGE_SEPARATOR)){var mt=A.split(e.DEVIATION_BADGE_SEPARATOR),At=mt[0],bt=mt[1],It=mt[2],Et=(mt[3],"".concat(At).concat(e.DEVIATION_BADGE_SEPARATOR).concat(bt)),Tt=null===(G=y.current[Et])||void 0===G?void 0:G.current,Mt=null===(Y=x.current[Et])||void 0===Y?void 0:Y.current;if(Tt&&Mt){var Lt,Dt=Tt.getBoundingClientRect(),Ot=Mt.getBoundingClientRect(),Ht=Dt.right-$.left,Pt=Ot.left-$.left,_t=Dt.top+Dt.height/2-$.top,Nt=Ot.top+Ot.height/2-$.top;if(b){var Vt=null!==(F=null===(j=r.current)||void 0===j?void 0:j.getBoundingClientRect().top)&&void 0!==F?F:0,kt=null!==(q=null===(z=c.current)||void 0===z?void 0:z.getBoundingClientRect().top)&&void 0!==q?q:0,wt=Vt+(null!==(J=null===(K=r.current)||void 0===K?void 0:K.clientHeight)&&void 0!==J?J:1/0),Gt=kt+(null!==(U=null===(Q=c.current)||void 0===Q?void 0:Q.clientHeight)&&void 0!==U?U:1/0),Yt=function(t,e,n){return Math.max(e,Math.min(n,t))};_t=Yt(Dt.top+Dt.height/2,Vt,wt)-$.top,Nt=Yt(Ot.top+Ot.height/2,kt,Gt)-$.top}(Lt=null!==(W=M(At,bt))&&void 0!==W?W:T(It))&&tt.push({id:"line-subsec-".concat(Et),x1:Ht,y1:_t,x2:Pt,y2:Nt,style:Lt,sectionIdx:Number(It.split("-")[0]),isSubSection:!0,subSectionKeyPath:A})}}if(Z(tt),l.current&&u.current){var jt=l.current.getBoundingClientRect(),Ft=u.current.getBoundingClientRect(),zt=(jt.top+jt.height/2-$.top+Ft.top+Ft.height/2-$.top)/2;et({x1:jt.right-$.left,x2:Ft.left-$.left,y:zt})}else et(null);if(S.size>0){var qt=[],Kt=r.current,Jt=c.current;if(Kt&&Jt){var Qt=[],Ut=Kt.getBoundingClientRect().top,Wt=Jt.getBoundingClientRect().top,Xt=Ut+Kt.clientHeight,Zt=Wt+Jt.clientHeight,$t=Kt.scrollTop,te=Jt.scrollTop,ee=$.top,ne=function(t,e,n){return Math.max(e,Math.min(n,t))};S.forEach(function(t){var n,i,r,c,o,l;if("string"==typeof t&&t.includes(e.DEVIATION_BADGE_SEPARATOR)){var u=t.split(e.DEVIATION_BADGE_SEPARATOR),v=u[0],s=u[1],h=u[2],f=(u[3],"".concat(v).concat(e.DEVIATION_BADGE_SEPARATOR).concat(s)),g=null===(n=y.current[f])||void 0===n?void 0:n.current,p=null===(i=x.current[f])||void 0===i?void 0:i.current;if(!g||!p)return;var R=g.getBoundingClientRect(),B=p.getBoundingClientRect(),C=null!==(r=M(v,s))&&void 0!==r?r:T(h),S=(j=R.right-$.left)+.5*((F=B.left-$.left-0)-j),m=R.top+R.height/2,A=B.top+B.height/2,I=m-Ut+$t,L=A-Wt+te,D="conn-subsec-".concat(f);Qt.push({lhsScrollY:I,rhsScrollY:L,x1:j,x2:F,containerTop:ee,leftIdx:t,rhsArrayIdx:t,styleColor:(null==C?void 0:C.badgeBorder)||"#6366F1",styleId:D});var O=ne(m,Ut,Xt),H=ne(A,Wt,Zt),P=O-ee,_=H-ee,N=A>=Wt-4&&A<=Zt+4,V="";V=(z=m>=Ut-4&&m<=Xt+4)&&N?e.getBentArrowPath(j,P,F,_):z&&!N?"M ".concat(j,",").concat(P," L ").concat(S,",").concat(P," L ").concat(S,",").concat(_):!z&&N?"M ".concat(S,",").concat(P," L ").concat(S,",").concat(_," L ").concat(F,",").concat(_):"M ".concat(S,",").concat(P," L ").concat(S,",").concat(_),qt.push({id:D,pathD:V,style:C,leftIdx:t,rhsArrayIdx:t})}else if(b){var k=t,w=a[k];if(!(null===(l=null==w?void 0:w.refIndexes)||void 0===l?void 0:l.length))return;w.refIndexes.forEach(function(t){var n,i,r=d.findIndex(function(e){return e.selfIndex===t});if(-1!==r){var c=null===(n=y.current[k])||void 0===n?void 0:n.current,o=null===(i=x.current[r])||void 0===i?void 0:i.current;if(c&&o){var l=c.getBoundingClientRect(),u=o.getBoundingClientRect(),a=E(k),v=l.right-$.left,s=u.left-$.left-0,h=v+.5*(s-v),f=l.top+l.height/2,g=u.top+u.height/2,p=f-Ut+$t,R=g-Wt+te,B="conn-".concat(k,"-").concat(r);Qt.push({lhsScrollY:p,rhsScrollY:R,x1:v,x2:s,containerTop:ee,leftIdx:k,rhsArrayIdx:r,styleColor:(null==a?void 0:a.badgeBorder)||"#6366F1",styleId:B});var C=ne(f,Ut,Xt),S=ne(g,Wt,Zt),m=C-ee,A=S-ee,b=f>=Ut-4&&f<=Xt+4,I=g>=Wt-4&&g<=Zt+4,T="";T=b&&I?e.getBentArrowPath(v,m,s,A):b&&!I?"M ".concat(v,",").concat(m," L ").concat(h,",").concat(m," L ").concat(h,",").concat(A):!b&&I?"M ".concat(h,",").concat(m," L ").concat(h,",").concat(A," L ").concat(s,",").concat(A):"M ".concat(h,",").concat(m," L ").concat(h,",").concat(A),qt.push({id:B,pathD:T,style:a,leftIdx:k,rhsArrayIdx:r})}}})}else{var G=t,Y=G;g=null===(c=y.current[G])||void 0===c?void 0:c.current,p=null===(o=x.current[Y])||void 0===o?void 0:o.current;if(!g||!p)return;var j,F;R=g.getBoundingClientRect(),B=p.getBoundingClientRect(),C=E(G),S=(j=R.right-$.left)+.5*((F=B.left-$.left-0)-j),m=R.top+R.height/2,A=B.top+B.height/2,I=m-Ut+$t,L=A-Wt+te,D="conn-".concat(G,"-").concat(Y);Qt.push({lhsScrollY:I,rhsScrollY:L,x1:j,x2:F,containerTop:ee,leftIdx:G,rhsArrayIdx:Y,styleColor:(null==C?void 0:C.badgeBorder)||"#6366F1",styleId:D});var z;O=ne(m,Ut,Xt),H=ne(A,Wt,Zt),P=O-ee,_=H-ee,N=A>=Wt-4&&A<=Zt+4,V="";V=(z=m>=Ut-4&&m<=Xt+4)&&N?e.getBentArrowPath(j,P,F,_):z&&!N?"M ".concat(j,",").concat(P," L ").concat(S,",").concat(P," L ").concat(S,",").concat(_):!z&&N?"M ".concat(S,",").concat(P," L ").concat(S,",").concat(_," L ").concat(F,",").concat(_):"M ".concat(S,",").concat(P," L ").concat(S,",").concat(_),qt.push({id:D,pathD:V,style:C,leftIdx:G,rhsArrayIdx:Y})}}),ft.current=Qt}ot(qt)}else ot([]),ft.current=[]}catch(t){console.error("Line render safe fail: ",t)}finally{dt.current=!1}}},[v,a,d,I,Q,U,E,M,b,m,A,S,B,C]),pt=t.useCallback(function(){var t,n,l,u,a,d,v,s,h,f,g,p,R,y,x=ft.current;if(x.length&&!D.current){var B=null!==(n=null===(t=r.current)||void 0===t?void 0:t.scrollTop)&&void 0!==n?n:0,C=null!==(u=null===(l=c.current)||void 0===l?void 0:l.scrollTop)&&void 0!==u?u:0,S=null!==(d=null===(a=r.current)||void 0===a?void 0:a.clientHeight)&&void 0!==d?d:1/0,m=null!==(s=null===(v=c.current)||void 0===v?void 0:v.clientHeight)&&void 0!==s?s:1/0,A=null!==(f=null===(h=r.current)||void 0===h?void 0:h.getBoundingClientRect().top)&&void 0!==f?f:0,b=null!==(p=null===(g=c.current)||void 0===g?void 0:g.getBoundingClientRect().top)&&void 0!==p?p:0,I=A+S,E=b+m,T=null!==(y=null===(R=i.current)||void 0===R?void 0:R.getBoundingClientRect().top)&&void 0!==y?y:0,M=function(t,e,n){return Math.max(e,Math.min(n,t))};x.forEach(function(t){var n=t.lhsScrollY-B+A,i=t.rhsScrollY-C+b,r=o.current[t.styleId+"-stroke"],c=o.current[t.styleId+"-bg"];if(r||c){var l,u=M(n,A,I),a=M(i,b,E),d=u-T,v=a-T,s=n>=A-4&&n<=I+4,h=i>=b-4&&i<=E+4,f=t.x1+.5*(t.x2-t.x1);l=s&&h?e.getBentArrowPath(t.x1,d,t.x2,v):s&&!h?"M ".concat(t.x1,",").concat(d," L ").concat(f,",").concat(d," L ").concat(f,",").concat(v):!s&&h?"M ".concat(f,",").concat(d," L ").concat(f,",").concat(v," L ").concat(t.x2,",").concat(v):"M ".concat(f,",").concat(d," L ").concat(f,",").concat(v),r&&(r.setAttribute("visibility","visible"),r.setAttribute("d",l)),c&&(c.setAttribute("visibility","visible"),c.setAttribute("d",l))}})}},[]),Rt=t.useCallback(function(){ft.current.length>0&&!D.current||(null!==st.current&&clearTimeout(st.current),st.current=setTimeout(function(){w.current(),st.current=null},50))},[]),yt=t.useCallback(function(t){if(null!==K.current&&J.current&&Math.abs(t.currentTarget.scrollTop-K.current)<=2){var n=J.current;K.current=null,J.current=null,n()}Y.current||(b||Rt(),vt.current||(vt.current=!0,requestAnimationFrame(function(){var t,n,o,l,u,a,d;if(O.current){var v=r.current,s=c.current;if(v&&s&&P.current){if(!H.current){var h=_.current,f=void 0;if("string"==typeof h&&h.includes(e.DEVIATION_BADGE_SEPARATOR)){var g=h.split(e.DEVIATION_BADGE_SEPARATOR),p="".concat(g[0]).concat(e.DEVIATION_BADGE_SEPARATOR).concat(g[1]);f=null===(t=y.current[p])||void 0===t?void 0:t.current}else f=null===(n=y.current[h])||void 0===n?void 0:n.current;if(f){var R=f.getBoundingClientRect();H.current={badgeScreenY:R.top+R.height/2,initialScrollTop:v.scrollTop,leftTop:v.getBoundingClientRect().top,leftBottom:v.getBoundingClientRect().top+v.clientHeight,cTop:null!==(l=null===(o=i.current)||void 0===o?void 0:o.getBoundingClientRect().top)&&void 0!==l?l:0}}}if(H.current){var x=H.current,B=v.scrollTop-x.initialScrollTop,C=x.badgeScreenY-B,S=((u=C,a=x.leftTop,d=x.leftBottom,Math.max(a,Math.min(d,u)))-x.cTop).toString(),m=C>=x.leftTop-4&&C<=x.leftBottom+4;P.current.setAttribute("y1",S),P.current.setAttribute("y2",S),P.current.setAttribute("visibility",m?"visible":"hidden")}}}ft.current.length>0&&pt(),vt.current=!1})))},[pt,b,Rt]);return t.useEffect(function(){w.current=gt},[gt]),t.useEffect(function(){var t=setTimeout(Rt,250),e=function(){return j.current()};return window.addEventListener("resize",e),function(){clearTimeout(t),null!==st.current&&clearTimeout(st.current),null!==G.current&&clearTimeout(G.current),window.removeEventListener("resize",e)}},[F,z,q,v,B,C,a,d,Q,Rt,m,A,L,S]),{lines:X,setLines:Z,overallConnector:tt,setOverallConnector:et,connectedLines:ct,setConnectedLines:ot,svgDimensions:ut,cachedConnectedPositions:ft,calculateLines:gt,calculateLinesRef:w,calculateLinesDebounced:Rt,handleColumnScroll:yt}};
|
|
2
|
+
//# sourceMappingURL=useLinesCalculator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLinesCalculator.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),n=require("../CognitiveComparehelpers.js");exports.useResizeHandler=function(r){var t=r.timerRef,u=r.ruleComponentRef,i=r.scrollContainerRef,l=r.containerRef,c=r.maintainRelativeOrder,o=r.proposedSections,s=r.existingSections,a=r.isSideBySideRef,d=r.activeSideBySideSectionRef,f=r.activeSideBySideRightSectionRef,R=r.sectionRowRefs,v=r.sectionRightRowRefs,p=r.sectionLeftRefs,g=r.sectionRightRefs,h=r.subSectionLeftRefs,S=r.subSectionRightRefs,T=r.lhsBadgeRefs,B=r.rhsBadgeRefs,A=r.leftContainerRef,C=r.rightContainerRef,m=r.calculateLinesRef,b=r.handleResizeRef,E=r.setIsResizing,y=r.setIsArrowVisible,z=r.sideBySideCacheRef,O=r.cachedConnectedPositions,x=e.useRef(0),I=e.useRef(0),_=e.useRef(0),w=e.useRef(function(){}),D=null!=b?b:w,N=e.useRef(null);e.useRef(t),e.useEffect(function(){var e=function(e,n,r,t,u){n.current=e.getBoundingClientRect().width;var i=new ResizeObserver(function(e){null!==r.current&&cancelAnimationFrame(r.current),r.current=requestAnimationFrame(function(){var i,l,c;r.current=null;var o=e[e.length-1];if(o){var s=null!==(c=null===(l=null===(i=o.borderBoxSize)||void 0===i?void 0:i[0])||void 0===l?void 0:l.inlineSize)&&void 0!==c?c:o.contentRect.width;Math.abs(s-n.current)<1?u():(n.current=s,t())}})});return i.observe(e),i},n={current:null},r={current:null},t={current:null},c=[],o=[n,r,t];return u.current&&c.push(e(u.current,x,n,function(){return D.current()},function(){})),i.current&&c.push(e(i.current,I,r,function(){return D.current()},function(){var e;return null===(e=m.current)||void 0===e?void 0:e.call(m)})),l.current&&c.push(e(l.current,_,t,function(){return D.current()},function(){var e;return null===(e=m.current)||void 0===e?void 0:e.call(m)})),function(){c.forEach(function(e){return e.disconnect()}),o.forEach(function(e){null!==e.current&&(cancelAnimationFrame(e.current),e.current=null)})}},[]);var P=e.useCallback(function(){E(!0),y(!1),z.current=null,null!==N.current&&clearTimeout(N.current),null!==t.current&&(clearTimeout(t.current),t.current=null),N.current=setTimeout(function(){var e,r,t,u,i,l,o,s,b,z,x;try{if(O.current=[],a.current&&null!==d.current&&null!==f.current){var I=d.current,_=f.current,w="string"==typeof I&&I.includes(n.DEVIATION_BADGE_SEPARATOR),D=null,P=null,M=null,V=null;if(w){var q=I.split(n.DEVIATION_BADGE_SEPARATOR),F="".concat(q[0]).concat(n.DEVIATION_BADGE_SEPARATOR).concat(q[1]);D=(null===(e=T.current[F])||void 0===e?void 0:e.current)||null,P=(null===(r=B.current[F])||void 0===r?void 0:r.current)||null,M=(null===(t=h.current[q[2]])||void 0===t?void 0:t.current)||(null===(u=p.current[Number(q[2])])||void 0===u?void 0:u.current)||null,V=(null===(i=S.current[q[3]])||void 0===i?void 0:i.current)||(null===(l=g.current[Number(q[3])])||void 0===l?void 0:l.current)||null}else D=(null===(o=R.current[I])||void 0===o?void 0:o.current)||null,M=(null===(s=p.current[I])||void 0===s?void 0:s.current)||null,P=(null===(b=v.current[_])||void 0===b?void 0:b.current)||null,V=(null===(z=g.current[_])||void 0===z?void 0:z.current)||null;if(D&&P&&M&&V){if(M.style.paddingTop="0px",V.style.paddingTop="0px",!c){var G=D.getBoundingClientRect(),L=P.getBoundingClientRect(),j=G.top-L.top;j>0?V.style.paddingTop="".concat(j,"px"):j<0&&(M.style.paddingTop="".concat(Math.abs(j),"px"))}var k=A.current,H=C.current;if(k&&H){var J=D.getBoundingClientRect().top-k.getBoundingClientRect().top+k.scrollTop,K=P.getBoundingClientRect().top-H.getBoundingClientRect().top+H.scrollTop-(J-k.scrollTop);Math.abs(H.scrollTop-K)>1&&(H.scrollTop=K)}}}null===(x=m.current)||void 0===x||x.call(m),a.current&&y(!0)}catch(e){console.error("Error in resize handler: ",e)}finally{E(!1),N.current=null}},150)},[c,o,s]);return{handleResize:P,handleResizeRef:D}};
|
|
2
|
+
//# sourceMappingURL=useResizeHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useResizeHandler.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|