@viswa-test/test-citation 0.0.88 → 0.0.89
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/CitationAnchor.js +1 -1
- package/dist/cjs/features/CognitiveCompare/CognitiveCompare.js +1 -1
- package/dist/cjs/features/CognitiveCompare/CognitiveComparehelpers.js +1 -1
- package/dist/cjs/features/CognitiveCompare/components/CognitiveSummaryPopup.js +1 -1
- package/dist/cjs/features/CognitiveCompare/components/SectionAccordion.js +1 -1
- package/dist/cjs/features/CognitiveCompare/components/SubSectionAccordion.js +1 -1
- package/dist/cjs/features/CognitiveCompare/hooks/memoizedMarkdown.js +1 -1
- package/dist/cjs/features/CognitiveCompare/hooks/useDeviationNavigation.js +1 -1
- package/dist/features/CognitiveCompare/CitationAnchor.js +1 -1
- package/dist/features/CognitiveCompare/CognitiveCompare.js +1 -1
- package/dist/features/CognitiveCompare/CognitiveComparehelpers.js +1 -1
- package/dist/features/CognitiveCompare/components/CognitiveSummaryPopup.js +1 -1
- package/dist/features/CognitiveCompare/components/SectionAccordion.js +1 -1
- package/dist/features/CognitiveCompare/components/SubSectionAccordion.js +1 -1
- package/dist/features/CognitiveCompare/hooks/memoizedMarkdown.js +1 -1
- package/dist/features/CognitiveCompare/hooks/useDeviationNavigation.js +1 -1
- package/dist/types/src/features/CognitiveCompare/CitationAnchor.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/CognitiveCompare.d.ts +1 -1
- package/dist/types/src/features/CognitiveCompare/CognitiveCompare.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/CognitiveCompareTypes.d.ts +2 -0
- package/dist/types/src/features/CognitiveCompare/CognitiveCompareTypes.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/CognitiveComparehelpers.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/components/CognitiveSummaryPopup.d.ts +1 -1
- package/dist/types/src/features/CognitiveCompare/components/CognitiveSummaryPopup.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/components/SectionAccordion.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/components/SubSectionAccordion.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/hooks/memoizedMarkdown.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/hooks/useDeviationNavigation.d.ts +2 -0
- package/dist/types/src/features/CognitiveCompare/hooks/useDeviationNavigation.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),i=require("react"),o=require("../CognitiveComparehelpers.js");exports.useDeviationNavigation=function(n){var t=n.proposedSections,r=n.existingSections,l=n.parentDeviationRecord,u=n.expandedSections,s=n.maintainRelativeOrder,d=n.scrollContainerRef,c=n.leftContainerRef,v=n.lhsBadgeRefs,f=n.rhsBadgeRefs,a=i.useState({}),R=a[0],h=a[1],w=i.useRef();return i.useEffect(function(){if(d.current){var i=s?c.current:d.current;if(i){var n=null,a=setTimeout(function(){var d=function(e,i){var o=e.getBoundingClientRect(),n=i.getBoundingClientRect();return o.bottom<n.top?"above":o.top>n.bottom?"below":"inside"};n=o.debounce(function(){h(function(n){var c=e.__assign({},n);return t.forEach(function(e,n){var t=s?!!u["left-".concat(n)]:!!u[String(n)],r=!1,f=!1,a=null,R=null,h=null,g=null;t&&(null==e?void 0:e.id)&&(l[e.id]||[]).forEach(function(n){var t="".concat(n.id).concat(o.DEVIATION_BADGE_SEPARATOR,"0"),l=v.current[t];if(null==l?void 0:l.current){var u=d(l.current,i);h||(h=l,g=u),"above"===u?(r=!0,a=l):"below"!==u||f?w.current===e.id&&(w.current=""):(f=!0,R=l)}}),e.id&&(c[e.id]={showAbove:r,showBelow:f,showAboveRef:a,showBelowRef:R,firstDeviationRef:h,firstDeviationPosition:g,columnKey:"left"})}),s||r.forEach(function(e,n){var t=!!u[String(n)],r=!1,s=!1,v=null,a=null,R=null,h=null;t&&(null==e?void 0:e.id)&&(l[e.id]||[]).forEach(function(n){var t,l,u,g,b,B=!(null===(t=n.refIndexes)||void 0===t?void 0:t.length)||void 0!==n.selfIndex&&n.selfIndex<0,A="".concat(n.id).concat(o.DEVIATION_BADGE_SEPARATOR,"0"),D=f.current[A];if((null==D?void 0:D.current)&&B&&(null==e?void 0:e.id)){var p=d(D.current,i);if(R||(R=D,h=p),"above"===p){var E=null===(u=null===(l=c[e.id])||void 0===l?void 0:l.showAboveRef)||void 0===u?void 0:u.current;(!E||E.getBoundingClientRect().top<D.current.getBoundingClientRect().top)&&(r=!0,v=D)}else if("below"!==p||s)w.current===e.id&&(w.current="");else{var m=null===(b=null===(g=c[e.id])||void 0===g?void 0:g.showBelowRef)||void 0===b?void 0:b.current;(!m||m.getBoundingClientRect().top>D.current.getBoundingClientRect().top)&&(s=!0,a=D)}}}),e.id&&t&&(r&&(c[e.id]=c[e.id]||{showAbove:!1,showAboveRef:null,showBelow:!1,showBelowRef:null,firstDeviationRef:null,firstDeviationPosition:null,columnKey:"right"},c[e.id].showAbove=r,c[e.id].showAboveRef=v,c[e.id].firstDeviationRef=R,c[e.id].firstDeviationPosition=h,c[e.id].columnKey="right"),s&&(c[e.id]=c[e.id]||{showAbove:!1,showAboveRef:null,showBelow:!1,showBelowRef:null,firstDeviationRef:null,firstDeviationPosition:null,columnKey:"right"},c[e.id].showBelow=s,c[e.id].showBelowRef=a,c[e.id].firstDeviationRef=R,c[e.id].firstDeviationPosition=h,c[e.id].columnKey="right"))}),c})},100),n(),null==i||i.addEventListener("scroll",n)},0);return function(){clearTimeout(a),n&&i.removeEventListener("scroll",n)}}}},[t,r,l,u,s,d,c,v,f]),{showDeviationNavigation:R,showOpenNodeRef:w}};
|
|
2
2
|
//# sourceMappingURL=useDeviationNavigation.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as
|
|
1
|
+
import{__assign as i}from"tslib";import{jsxs as n,jsx as e}from"react/jsx-runtime";import{ChevronUp as l,ChevronDown as o}from"lucide-react";import{useState as t}from"react";import r from"./ResizableSplitPane.js";import d from"../PdfViewer/PdfViewer.js";import{DefaultFullScreenCloseIcon as a,DefaultFullScreenIcon as u}from"../../assests/svg/PdfViewerIcons.js";var s=function(n){var l,o,t,a,u,s,c,p,g,v,h,f=n.href,m=n.metaData,x=n.citationTitle,b=n.isFullscreen,_=function(i){try{return new URL(i,window.location.origin).searchParams.get("citationNumber")}catch(i){return null}}(f);if(!_)return null;var y=(null===(l=null==m?void 0:m.citations)||void 0===l?void 0:l[_])||{},w=(null===(o=null==m?void 0:m.docData)||void 0===o?void 0:o.documents)||{},C=(null===(t=null==m?void 0:m.docData)||void 0===t?void 0:t.input_index_map)||{},P=null==C?void 0:C[0],F=null==C?void 0:C[1],S=P?w[P]:null,D=F?w[F]:null,k=P?y[P]:null,j=F?y[F]:null;if(["contract","clause"].includes(x)){var z=k?e(d,{defaultScale:"PageWidth",showFullScreenAction:!1,showHighlightsAction:!1,pdfName:S.title,pdfUrl:S.signed_url,highlightText:[null!==(a=null==k?void 0:k.highlighted_text)&&void 0!==a?a:""],highlightPages:{1:null===(u=null==k?void 0:k.custom_metadata)||void 0===u?void 0:u.pdf_start_page_number},jumpToPageValue:1,highlightCordinatePages:[],useCoordinates:!1,useRange:!0,rangeOfPages:[null===(s=null==k?void 0:k.custom_metadata)||void 0===s?void 0:s.pdf_start_page_number,null===(c=null==k?void 0:k.custom_metadata)||void 0===c?void 0:c.pdf_end_page_number]}):null,R=j?e(d,{defaultScale:"PageWidth",showFullScreenAction:!1,showHighlightsAction:!1,pdfName:D.title,pdfUrl:D.signed_url,jumpToPageValue:1,highlightText:[null!==(p=null==j?void 0:j.highlighted_text)&&void 0!==p?p:""],highlightPages:{1:null===(g=null==j?void 0:j.custom_metadata)||void 0===g?void 0:g.pdf_start_page_number},highlightCordinatePages:[],useCoordinates:!1,useRange:!0,rangeOfPages:[null===(v=null==j?void 0:j.custom_metadata)||void 0===v?void 0:v.pdf_start_page_number,null===(h=null==j?void 0:j.custom_metadata)||void 0===h?void 0:h.pdf_end_page_number]}):null;return e("div",k||j?i({style:{height:"100%",display:"flex",flexDirection:"column"}},{children:e(r,{leftComponent:z,rightComponent:R,isFullscreen:b})}):{children:"Missing PDF Citation. Please try again later"})}return e("div",{children:"No Citation Found. Please try again later"})},c=function(r){var d,c,p,g=r.href,v=r.children,h=r.metaData,f=r.chevronUpComponent,m=void 0===f?null:f,x=r.chevronDownComponent,b=void 0===x?null:x,_=r.customStyle,y=void 0===_?{}:_,w=r.defaultState,C=t(void 0!==w&&w),P=C[0],F=C[1],S=t(!1),D=S[0],k=S[1],j="string"==typeof v&&(null===(d=null==v?void 0:v.split("\n"))||void 0===d?void 0:d.length)>1?v.split("\n").join(" "):v,z="string"==typeof v?v:v[0],R=null!=m?m:function(i){var n,o;return e(l,{size:null!==(n=null==i?void 0:i.fontSize)&&void 0!==n?n:16,color:null!==(o=null==i?void 0:i.color)&&void 0!==o?o:"rgb(214, 51, 132)"})}(null!==(c=null==y?void 0:y.arrow)&&void 0!==c?c:{}),T=null!=b?b:function(i){var n,l;return e(o,{size:null!==(n=null==i?void 0:i.fontSize)&&void 0!==n?n:16,color:null!==(l=null==i?void 0:i.color)&&void 0!==l?l:"rgb(214, 51, 132)"})}(null!==(p=null==y?void 0:y.arrow)&&void 0!==p?p:{});return n("span",i({style:i({display:"inline"},y.relativeWrapper||{})},{children:[e("div",i({style:i({display:"inline",marginTop:0},y.citationButtonWrapper||{})},{children:n("button",i({type:"button",onClick:function(){return F(function(i){return!i})},style:i({display:"inline-flex",alignItems:"center",gap:"3px",fontFamily:'"Inter", sans-serif',backgroundColor:"transparent",padding:0,margin:0,fontSize:"13px",borderRadius:9999,cursor:"pointer",fontWeight:700,color:"rgb(214, 51, 132)",border:"none",textDecoration:"none",wordBreak:"break-word",whiteSpace:"normal"},y.citationButton||{})},{children:[e("span",{children:j}),e("span",i({style:{display:"flex",alignItems:"center"}},{children:P?R:T}))]}))})),P&&n("div",i({style:D?{position:"fixed",inset:0,zIndex:999999,backgroundColor:"#FAFAFA",display:"flex",flexDirection:"column"}:{boxSizing:"border-box",border:"1px solid #E4E7EC",borderRadius:"8px",overflow:"hidden",marginTop:"8px",display:"flex",flexDirection:"column",width:"100%"}},{children:[e("div",i({style:{display:"flex",justifyContent:"flex-end",padding:"6px 10px",borderBottom:"1px solid #E4E7EC",backgroundColor:"#FFFFFF",flexShrink:0}},{children:e("button",i({onClick:function(){k(function(i){return!i})},style:{background:"none",border:"none",cursor:"pointer",padding:"4px",borderRadius:"6px",color:"#475467",marginRight:"9px"}},{children:e(D?a:u,{})}))})),e("div",i({style:{flex:1,minHeight:0,height:"100%",overflow:"hidden"}},{children:e(s,{href:g,children:v,metaData:h,citationTitle:z,isFullscreen:D})}))]}))]}))};export{c as default};
|
|
2
2
|
//# sourceMappingURL=CitationAnchor.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as e,__spreadArray as n}from"tslib";import{jsxs as t,jsx as i}from"react/jsx-runtime";import{useState as o,useRef as r,useMemo as l,useEffect as c,useCallback as u}from"react";import{Box as d,Snackbar as a,Alert as s,Tooltip as v,Typography as p}from"@mui/material";import{ChevronDown as f,EllipsisVertical as g}from"lucide-react";import{ButtonCognitiveIcon as h}from"../../assests/svg/ButtonCognitiveIcon.js";import x from"./OverlayComponent.js";import{safeStringify as m,extractDeviationScore as y,generateColorPalette as b,DEVIATION_BADGE_SEPARATOR as S,hasValue as R,getBentArrowPath as C,smoothScrollTo as T}from"./CognitiveComparehelpers.js";import{SHARED_MARKDOWN_STYLES as I,DEFAULT_FIELD_CONFIG as B,DEFAULT_COMPARISON_CONFIG as w}from"./CognitiveCompareConfig.js";export{SHARED_MARKDOWN_STYLES}from"./CognitiveCompareConfig.js";import{DEFAULT_DEVIAION_COLOR as E,DEFAULT_COMPONENT_HEADER_TEXT as F}from"./CognitiveCompareConstants.js";import _ from"./CognitivePopup.js";import k from"./MoreFunctionsPopup.js";import M from"./LoaderComponent.js";import D from"./components/ThreeDotsLoader.js";import{useCognitiveTreeData as H}from"./hooks/useCompareData.js";import{useComparePopups as A}from"./hooks/useComparePopups.js";import{useSectionRefs as L}from"./hooks/useSectionRefs.js";import{useAccordionState as O}from"./hooks/useAccordionState.js";import{useDeviationNavigation as P}from"./hooks/useDeviationNavigation.js";import j from"./components/CompareHeader.js";import N from"./components/SectionAccordion.js";import z from"./components/SubSectionAccordion.js";import W from"./components/CognitiveSummaryPopup.js";var Y=function(Y){var K,V,X,q,J,U,G,Q,Z,$,ee,ne,te,ie,oe,re=Y.componentHeaderText,le=void 0===re?F:re,ce=Y.treeData,ue=Y.comparisonConfig,de=Y.leftColumnTitleText,ae=Y.rightColumnTitleText,se=Y.markdownStyles,ve=Y.displayConfig,pe=void 0===ve?{isHeaderVisible:!0,isToggleVisible:!0,maintainRelativeOrder:!1,isLoading:!0}:ve,fe=Y.popupConfig,ge=Y.deviationData,he=void 0===ge?{}:ge,xe=Y.deviationNodeIdToView,me=o(pe.maintainRelativeOrder),ye=me[0],be=me[1],Se=o(!1),Re=Se[0],Ce=Se[1],Te=o(!1),Ie=Te[0],Be=Te[1],we=o(null),Ee=we[0],Fe=we[1],_e=o(!1),ke=_e[0],Me=_e[1],De=o(!1),He=De[0],Ae=De[1],Le=o(!1),Oe=Le[0],Pe=Le[1],je=o(null),Ne=je[0],ze=je[1],We=r(!1),Ye=o(new Set),Ke=Ye[0],Ve=Ye[1],Xe=o([]),qe=Xe[0],Je=Xe[1],Ue=r(null),Ge=r(!1),Qe=r(null),Ze=r({}),$e=r([]),en=r(!1),nn=r(!1),tn=r(null),on=r(function(){}),rn=l(function(){return(null==ce?void 0:ce.cognitive_decisioning)||{}},[ce]),ln=o({width:0,height:0}),cn=ln[0],un=ln[1],dn=l(function(){return e(e({},I),se)},[se]),an=r(null),sn=r(null),vn=r(null),pn=r(null),fn=r(null),gn=r(null),hn=r(null),xn=r(null),mn=r(!1),yn=A(an),bn=yn.cognitivePopup,Sn=yn.setCognitivePopup,Rn=yn.moreFunctions,Cn=yn.setMoreFunctions,Tn=yn.position,In=yn.setPosition,Bn=yn.activeBadgeId,wn=yn.summaryPopup,En=yn.setSummaryPopup,Fn=yn.closeSummaryPopup,_n=yn.setActiveBadgeId,kn=yn.popupRef,Mn=yn.closeCognitivePopup,Dn=yn.closeMoreFunctionsPopup,Hn=l(function(){var e,n,t,i,o,r,l;return{fields:null!==(e=null==ue?void 0:ue.fields)&&void 0!==e?e:B,thresholds:{high:null!==(t=null===(n=null==ue?void 0:ue.thresholds)||void 0===n?void 0:n.high)&&void 0!==t?t:w.thresholds.high,medium:null!==(o=null===(i=null==ue?void 0:ue.thresholds)||void 0===i?void 0:i.medium)&&void 0!==o?o:w.thresholds.medium,exact:null!==(l=null===(r=null==ue?void 0:ue.thresholds)||void 0===r?void 0:r.exact)&&void 0!==l?l:w.thresholds.exact}}},[ue]),An=o(null),Ln=An[0];An[1];var On=null===(X=null===(K=null==ce?void 0:ce.documents)||void 0===K?void 0:K[null===(V=null==ce?void 0:ce.input_index_map)||void 0===V?void 0:V[0]])||void 0===X?void 0:X.title,Pn=null===(U=null===(q=null==ce?void 0:ce.documents)||void 0===q?void 0:q[null===(J=null==ce?void 0:ce.input_index_map)||void 0===J?void 0:J[1]])||void 0===U?void 0:U.title,jn=m(de||On||"Uploaded Contract"),Nn=m(ae||Pn||"Reference Template"),zn=H(ce,ye,he,Hn),Wn=zn.activeProposed,Yn=zn.existingRule,Kn=zn.proposedSections,Vn=zn.existingSections,Xn=zn.visibleFields,qn=zn.parentDeviationRecord,Jn=zn.deviationNumberRegistry,Un=zn.parseError;c(function(){Un&&Fe("Failed to load comparison: ".concat(Un))},[Un]);var Gn=Kn.length>0||Vn.length>0,Qn=L(Xn.map(function(e){return e.key}),Math.max(Kn.length,Vn.length)),Zn=Qn.leftRefs,$n=Qn.rightRefs,et=Qn.sectionLeftRefs,nt=Qn.sectionRightRefs,tt=Qn.lhsBadgeRefs,it=Qn.rhsBadgeRefs,ot=Qn.sectionRightRowRefs,rt=Qn.subSectionLeftRefs,lt=Qn.subSectionRightRefs,ct=Qn.sectionRowRefs,ut=Qn.getSectionRowRef,dt=Qn.getSubSectionRef,at=Qn.getBadgeRef,st=Yn.analysis,vt=m(null===(Q=null===(G=null==st?void 0:st.rule_difference_comparison)||void 0===G?void 0:G.summary)||void 0===Q?void 0:Q.overall_summary),pt=!!vt.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),ft=null!==(Z=null==ce?void 0:ce.base_root_id)&&void 0!==Z?Z:"-1";null==ce||ce[ft];var gt=(null===($=null==he?void 0:he[ft])||void 0===$?void 0:$.evaluation_result)||(null===(ne=null===(ee=null==ce?void 0:ce.nodes)||void 0===ee?void 0:ee[ft])||void 0===ne?void 0:ne.evaluation_result)||null,ht=y(gt),xt=b(null!==(oe=null===(ie=null===(te=null==gt?void 0:gt.evaluation_outputs)||void 0===te?void 0:te.metadata)||void 0===ie?void 0:ie.label_color)&&void 0!==oe?oe:""),mt=u(function(){var e,n,t,i;Me(!1),nn.current=!1;var o=tn.current,r=kt.current;if(null!==o)if("string"==typeof o&&o.includes(S)){var l=o.split(S);(c=null===(e=rt.current[l[2]])||void 0===e?void 0:e.current)&&(c.style.paddingTop="0px")}else{var c;(c=null===(n=et.current[o])||void 0===n?void 0:n.current)&&(c.style.paddingTop="0px")}if(null!==r)if("string"==typeof r&&r.includes(S)){l=r.split(S);(u=null===(t=lt.current[l[3]])||void 0===t?void 0:t.current)&&(u.style.paddingTop="0px")}else{var u;(u=null===(i=nt.current[r])||void 0===i?void 0:i.current)&&(u.style.paddingTop="0px")}ze(null),tn.current=null,kt.current=null,Ae(!1),Be(!1),pn.current&&(pn.current.style.height="0px"),fn.current&&(fn.current.style.height="0px"),gn.current&&(gn.current.style.height="0px"),hn.current&&(hn.current.style.height="0px")},[]),yt=O({maintainRelativeOrder:!!ye,proposedSections:Kn,existingSections:Vn,activeSideBySideSection:Ne,connectedSections:Ke,resetSideBySide:mt,setConnectedSections:Ve,setConnectedLines:Je,cachedConnectedPositions:$e,svgContainerRef:Ue,isAnimatingRef:Ge,animationTimerRef:Qe,calculateLinesRef:on,sectionLeftRefs:et,sectionRightRefs:nt,subSectionLeftRefs:rt,subSectionRightRefs:lt}),bt=yt.expandedSections,St=yt.expandedSubSections,Rt=yt.setExpandedSubSections,Ct=yt.toggleSection,Tt=u(function(e,n,t,i,o,r,l){var c,u,d,a=m(null==n?void 0:n.id)||m(null==t?void 0:t.id)||"",s=(a?rn[a]:null)||(null==n?void 0:n.cognitiveData)||(null==t?void 0:t.cognitiveData)||{section_id:a,decisioning:[],gap:[],relevance_score:0},v=null!==(u=null===(c=ct.current[i])||void 0===c?void 0:c.current)&&void 0!==u?u:null;return{isLoading:null!==(d=null==pe?void 0:pe.isLoading)&&void 0!==d&&d,open:!0,sectionTitle:(null==n?void 0:n.displayTitle)?null==n?void 0:n.title:"no title",refSectionTitle:(null==t?void 0:t.displayTitle)?null==t?void 0:t.title:"no title",cognitiveData:s,anchorEl:e,sectionAnchorEl:v,badgeStyle:r||null,sectionIdx:i,docData:{documents:null==ce?void 0:ce.documents,input_index_map:null==ce?void 0:ce.input_index_map},deviationData:(null==n?void 0:n.evaluationResult)||(null==t?void 0:t.evaluationResult)||null,isOrphan:!!o}},[rn,ce]),It=u(function(e){Dn(),In(null),Sn(e)},[Dn]),Bt=function(e,n,t,i,o,r){e.stopPropagation(),Rn.open&&Rn.sectionIdx===o?Dn():(Mn(),Cn(Tt(e.currentTarget,n,i,o,t,r)))},wt=u(function(){null!==Rn.sectionIdx&&Rn.anchorEl?It(e(e({},Rn),{open:!0})):Dn()},[Rn,Dn,It]),Et=u(function(){var e=Rn.sectionIdx,n=Rn.isOrphan;Dn(),Fn(),null!==e&&(n?Fe("No counterpart exists to connect to."):(nn.current&&mt(),Je([]),$e.current=[],Ve(function(n){return n.has(e)?new Set:new Set([e])}),setTimeout(function(){on.current&&on.current()},50)))},[Rn.sectionIdx,Rn.isOrphan,Dn,Fn,mt]),Ft=r(null),_t=r(null),kt=r(null),Mt=r(null),Dt=r(null),Ht=r(null),At=o([]),Lt=At[0],Ot=At[1];r(null);var Pt=o(null),jt=Pt[0],Nt=Pt[1];c(function(){if(Ln){var e=Hn.fields.find(function(e){return e.analysisKey===Ln||e.key===Ln});if(e){var n=Zn.current[e.key]||$n.current[e.key];(null==n?void 0:n.current)&&setTimeout(function(){return n.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[Ln,Hn.fields]);var zt=u(function(e){var n,t,i,o,r,l,c,u,d,a=null===(n=null==st?void 0:st.rule_difference_comparison)||void 0===n?void 0:n.fields;if(!a||!a[e])return{score:0,relation:"",highlightsA:[],highlightsB:[],hasContent:!1};var s=a[e],v=(null==s?void 0:s.relation)||(null===(i=null===(t=null==s?void 0:s.highlights)||void 0===t?void 0:t.ruleA_spans)||void 0===i?void 0:i.length)||(null===(r=null===(o=null==s?void 0:s.highlights)||void 0===o?void 0:o.ruleB_spans)||void 0===r?void 0:r.length)||(null==s?void 0:s.mappings)&&s.mappings.length>0;if(s.mappings){var p=s.mappings[0]||{};return{score:s.score,relation:p.relation||"",highlightsA:(null===(l=p.highlights)||void 0===l?void 0:l.ruleA_spans)||[],highlightsB:(null===(c=p.highlights)||void 0===c?void 0:c.ruleB_spans)||[],hasContent:!!v}}return{score:s.score,relation:s.relation||"",highlightsA:(null===(u=s.highlights)||void 0===u?void 0:u.ruleA_spans)||[],highlightsB:(null===(d=s.highlights)||void 0===d?void 0:d.ruleB_spans)||[],hasContent:!!v}},[st]),Wt=u(function(n,t){var i,o,r,l,c,u,d;void 0===t&&(t="left");var a=null,s=null;if("left"===t)if(a=Kn[n],ye&&a){var v=Vn.filter(function(e){var n;return null===(n=a.refIndexes)||void 0===n?void 0:n.includes(e.selfIndex)});s=v.find(function(e){return e.evaluationResult})||v[0]}else s=Vn[n];else if(s=Vn[n],ye&&s){var p=Kn.filter(function(e){var n;return null===(n=e.refIndexes)||void 0===n?void 0:n.includes(s.selfIndex)});a=p.find(function(e){return e.evaluationResult})||p[0]}else a=Kn[n];var f=(null==a?void 0:a.relation)&&"not_defined"!==a.relation,g=(null==s?void 0:s.relation)&&"not_defined"!==s.relation,h=!(!(null==a?void 0:a.cognitiveData)&&!(null==s?void 0:s.cognitiveData));if(!f&&!g&&!h)return e(e({},b(E)),{label:"Not Defined"});var x=null!==(o=null!==(i=null==a?void 0:a.evaluationResult)&&void 0!==i?i:null==s?void 0:s.evaluationResult)&&void 0!==o?o:null,m=null===(r=null==x?void 0:x.evaluation_outputs)||void 0===r?void 0:r.output_value,y=null!==(u=null===(c=null===(l=null==x?void 0:x.evaluation_outputs)||void 0===l?void 0:l.metadata)||void 0===c?void 0:c.label_color)&&void 0!==u?u:E;return e(e({},b(y)),null!=x?{label:null!==(d=m)&&void 0!==d?d:""}:{label:null})},[Kn,Vn,rn,Hn,ye]),Yt=u(function(n){for(var t,i,o,r,l,c,u,d,a,s=n.split("-").map(Number),v=Kn[s[0]],p=Vn[s[0]],f=1;f<s.length;f++)(null==v?void 0:v.subsections)&&(v=v.subsections[s[f]]),(null==p?void 0:p.subsections)&&(p=p.subsections[s[f]]);if(!v&&!p)return null;var g=(null==v?void 0:v.relation)&&"not_defined"!==v.relation,h=(null==p?void 0:p.relation)&&"not_defined"!==p.relation,x=m(null==v?void 0:v.id)||m(null==p?void 0:p.id)||"",y=!(!(null==v?void 0:v.cognitiveData)&&!(null==p?void 0:p.cognitiveData));if(!g&&!h&&!y)return e(e({},b(E)),{label:"Not Defined"});null!==(i=null!==(t=null==v?void 0:v.cognitiveRelevanceScore)&&void 0!==t?t:null==p?void 0:p.cognitiveRelevanceScore)&&void 0!==i||x&&(null===(o=rn[x])||void 0===o||o.relevance_score);var S=null!==(l=null!==(r=null==v?void 0:v.evaluationResult)&&void 0!==r?r:null==p?void 0:p.evaluationResult)&&void 0!==l?l:null,R=null===(c=null==S?void 0:S.evaluation_outputs)||void 0===c?void 0:c.output_value,C=null!==(a=null===(d=null===(u=null==S?void 0:S.evaluation_outputs)||void 0===u?void 0:u.metadata)||void 0===d?void 0:d.label_color)&&void 0!==a?a:E;return e(e({},b(C)),null!=S?{label:null!=R?R:""}:{label:null})},[Kn,Vn,rn,Hn]),Kt=u(function(){var e,n,t,i,o,r,l,c,u,d,a,s,v,p,f,g,h,x;if(!mn.current&&!Ge.current){mn.current=!0;try{if(!Ft.current)return;var m=function(e){var n=e.split("-"),t=n[0];if(!bt[t]&&!1===ye)return!1;if(ye&&!bt["left-".concat(t)]&&!bt["right-".concat(t)]&&!bt[t])return!1;for(var i=t,o=1;o<n.length-1;o++)if(i+="-".concat(n[o]),!St[i])return!1;return!0},y=Ft.current.getBoundingClientRect();un({width:y.width,height:y.height});var b=[];if(Xn.forEach(function(e){var n,t,i=e.key,o=null===(n=Zn.current[i])||void 0===n?void 0:n.current,r=null===(t=$n.current[i])||void 0===t?void 0:t.current;o&&r&&(o.style.height="auto",r.style.height="auto",o.style.minHeight="0px",r.style.minHeight="0px")}),!Ge.current){for(var T=0;T<Math.max(Kn.length,Vn.length);T++){var I=null===(e=et.current[T])||void 0===e?void 0:e.current,B=null===(n=nt.current[T])||void 0===n?void 0:n.current;I&&(I.style.height="auto",I.style.minHeight="0px"),B&&(B.style.height="auto",B.style.minHeight="0px")}ye||Object.keys(rt.current).forEach(function(e){var n,t;if(m(e)){var i=null===(n=rt.current[e])||void 0===n?void 0:n.current,o=null===(t=lt.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 w={};Xn.forEach(function(e){var n,t,i=e.key,o=null===(n=Zn.current[i])||void 0===n?void 0:n.current,r=null===(t=$n.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=o.getBoundingClientRect(),c=r.getBoundingClientRect();w[i]=Math.max(l.height,c.height)}});var E={left:{},right:{}},F={};if(!Ge.current)if(ye){if(ke&&null!==Ne)if("number"==typeof Ne){var _=Ne,k=Kn[_],M=null===(o=et.current[_])||void 0===o?void 0:o.current;M&&k&&(k.refIndexes||[]).forEach(function(e){var n,t=Vn.findIndex(function(n){return n.selfIndex===e}),i=null===(n=nt.current[t])||void 0===n?void 0:n.current;if(i&&(bt["left-".concat(_)]||bt["right-".concat(t)])){var o=Math.max(M.getBoundingClientRect().height,i.getBoundingClientRect().height);E.left[_]=Math.max(E.left[_]||0,o),E.right[t]=Math.max(E.right[t]||0,o)}})}else{var D=Ne.split(S)[2];if(D){I=null===(r=rt.current[D])||void 0===r?void 0:r.current,B=null===(l=lt.current[D])||void 0===l?void 0:l.current;if(I&&B){H=Math.max(I.getBoundingClientRect().height,B.getBoundingClientRect().height);F[D]=Math.max(F[D]||0,H)}}}}else{Object.keys(rt.current).forEach(function(e){var n,t;if(m(e)){var i=null===(n=rt.current[e])||void 0===n?void 0:n.current,o=null===(t=lt.current[e])||void 0===t?void 0:t.current;if(i&&o&&null!==i.offsetParent&&null!==o.offsetParent){var r=i.getBoundingClientRect(),l=o.getBoundingClientRect(),c=Math.max(r.height,l.height);F[e]=c,i.style.minHeight="".concat(c,"px"),o.style.minHeight="".concat(c,"px")}}});for(T=0;T<Math.min(Kn.length,Vn.length);T++){var I=null===(t=et.current[T])||void 0===t?void 0:t.current,B=null===(i=nt.current[T])||void 0===i?void 0:i.current;if(I&&B){var H=Math.max(I.getBoundingClientRect().height,B.getBoundingClientRect().height);E.left[T]=H,E.right[T]=H}}}if(Xn.forEach(function(e){var n,t,i=e.key,o=null===(n=Zn.current[i])||void 0===n?void 0:n.current,r=null===(t=$n.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=w[i];o.style.minHeight="".concat(l,"px"),r.style.minHeight="".concat(l,"px")}}),Ge.current||(Object.entries(E.left).forEach(function(e){var n,t=e[0],i=e[1],o=null===(n=et.current[Number(t)])||void 0===n?void 0:n.current;o&&(o.style.minHeight="".concat(i,"px"))}),Object.entries(E.right).forEach(function(e){var n,t=e[0],i=e[1],o=null===(n=nt.current[Number(t)])||void 0===n?void 0:n.current;o&&(o.style.minHeight="".concat(i,"px"))}),ye||Object.keys(F).forEach(function(e){var n,t,i=null===(n=rt.current[e])||void 0===n?void 0:n.current,o=null===(t=lt.current[e])||void 0===t?void 0:t.current;if(i&&o&&F[e]){var r=F[e];i.style.minHeight="".concat(r,"px"),o.style.minHeight="".concat(r,"px")}})),ye)Kn.forEach(function(e,n){var t;(null===(t=et.current[n])||void 0===t?void 0:t.current)&&(e.refIndexes||[]).forEach(function(e){var t,i,o,r,l,c,u=Vn.findIndex(function(n){return n.selfIndex===e});if(-1!==u){var d=null===(t=tt.current[n])||void 0===t?void 0:t.current,a=null===(i=it.current[u])||void 0===i?void 0:i.current;if(d&&a){var s,v,p,f=d.getBoundingClientRect(),g=a.getBoundingClientRect(),h=f.right-y.left,x=g.left-y.left,m=f.top+f.height/2-y.top,S=g.top+g.height/2-y.top;if(ke&&Ne===n){var R=null!==(r=null===(o=xn.current)||void 0===o?void 0:o.getBoundingClientRect().top)&&void 0!==r?r:0,C=R+(null!==(c=null===(l=xn.current)||void 0===l?void 0:l.clientHeight)&&void 0!==c?c:1/0),T=f.top+f.height/2;s=T,v=R,p=C,S=m=Math.max(v,Math.min(p,s))-y.top}var I=Wt(n);I&&b.push({id:"line-".concat(n,"-").concat(u),x1:h,y1:m,x2:x,y2:S,style:I,sectionIdx:n,targetRightIdx:u})}}})});else{for(T=0;T<Math.min(Kn.length,Vn.length);T++){var A=null===(c=et.current[T])||void 0===c?void 0:c.current,L=null===(u=nt.current[T])||void 0===u?void 0:u.current;if(A&&L){var O=A.getBoundingClientRect(),P=L.getBoundingClientRect(),j=Math.max(O.top,P.top)+18-y.top,N=(null===(d=Vn[T])||void 0===d?void 0:d.id)||"sec-".concat(T);(J=Wt(T))&&b.push({id:N,x1:O.right-y.left,y1:j,x2:P.left-y.left,y2:j,style:J,sectionIdx:T,hasCognitive:!!((null===(a=Kn[T])||void 0===a?void 0:a.cognitiveData)||(null===(s=Vn[T])||void 0===s?void 0:s.cognitiveData)||N&&rn[N]),isSubSection:!1})}}Object.keys(rt.current).forEach(function(e){var n,t,i,o,r,l;if(m(e)){var c=null===(n=rt.current[e])||void 0===n?void 0:n.current,u=null===(t=lt.current[e])||void 0===t?void 0:t.current;if(c&&u){for(var d=e.split("-").map(Number),a=Kn[d[0]],s=Vn[d[0]],v=1;v<d.length;v++)(null==a?void 0:a.subsections)&&(a=a.subsections[d[v]]),(null==s?void 0:s.subsections)&&(s=s.subsections[d[v]]);var p=!!a&&((null===(i=a.displayTitle)||void 0===i||i)&&R(a.title)),f=!!a&&((null===(o=a.displayContent)||void 0===o||o)&&R(a.content)),g=!!s&&((null===(r=s.displayTitle)||void 0===r||r)&&R(s.title)),h=!!s&&((null===(l=s.displayContent)||void 0===l||l)&&R(s.content));if(p&&f||g&&h){var x=c.getBoundingClientRect(),S=u.getBoundingClientRect(),C=Math.max(x.top,S.top)+16-y.top,T=Yt(e);T&&"Not Defined"!==T.label&&b.push({id:"subsec-".concat(e),x1:x.right-y.left,y1:C,x2:S.left-y.left,y2:C,style:T,sectionIdx:d[0],isSubSection:!0,subSectionKeyPath:e,hasCognitive:!(!(null==a?void 0:a.cognitiveData)&&!(null==s?void 0:s.cognitiveData))})}}}})}if(ke&&"string"==typeof Ne&&Ne.includes(S)){var z=Ne.split(S),W=z[0],Y=z[1],K=z[2],V=(z[3],"".concat(W).concat(S).concat(Y)),X=null===(v=tt.current[V])||void 0===v?void 0:v.current,q=null===(p=it.current[V])||void 0===p?void 0:p.current;if(X&&q){var J,U=X.getBoundingClientRect(),G=q.getBoundingClientRect(),Q=U.right-y.left,Z=G.left-y.left,$=U.top+U.height/2-y.top,ee=(G.top,G.height,y.top);if(ye){var ne=null!==(g=null===(f=xn.current)||void 0===f?void 0:f.getBoundingClientRect().top)&&void 0!==g?g:0,te=ne+(null!==(x=null===(h=xn.current)||void 0===h?void 0:h.clientHeight)&&void 0!==x?x:1/0);me=U.top+U.height/2,be=ne,Se=te,$=Math.max(be,Math.min(Se,me))-y.top}ee=$,(J=Yt(K))&&b.push({id:"line-subsec-".concat(V),x1:Q,y1:$,x2:Z,y2:ee,style:J,sectionIdx:Number(K.split("-")[0]),isSubSection:!0,subSectionKeyPath:Ne})}}if(Ot(b),Dt.current&&Ht.current){var ie=Dt.current.getBoundingClientRect(),oe=Ht.current.getBoundingClientRect(),re=(ie.top+ie.height/2-y.top+oe.top+oe.height/2-y.top)/2;Nt({x1:ie.right-y.left,x2:oe.left-y.left,y:re})}else Nt(null);if(Ke.size>0){var le=[],ce=xn.current,ue=vn.current;if(ce&&ue){var de=[],ae=ce.getBoundingClientRect().top,se=ue.getBoundingClientRect().top,ve=ae+ce.clientHeight,pe=se+ue.clientHeight,fe=ce.scrollTop,ge=ue.scrollTop,he=y.top,xe=function(e,n,t){return Math.max(n,Math.min(t,e))};Ke.forEach(function(e){var n,t,i,o,r;if("string"==typeof e&&e.includes(S)){var l=e.split(S),c=l[0],u=l[1],d=l[2],a=(l[3],"".concat(c).concat(S).concat(u)),s=null===(n=tt.current[a])||void 0===n?void 0:n.current,v=null===(t=it.current[a])||void 0===t?void 0:t.current;if(!s||!v)return;var p=s.getBoundingClientRect(),f=v.getBoundingClientRect(),g=Yt(d),h=(A=p.right-y.left)+.5*((L=f.left-y.left-0)-A),x=p.top+p.height/2,m=f.top+f.height/2,b=x-ae+fe,R=m-se+ge,T="conn-subsec-".concat(a);de.push({lhsScrollY:b,rhsScrollY:R,x1:A,x2:L,containerTop:he,leftIdx:e,rhsArrayIdx:e,styleColor:(null==g?void 0:g.badgeBorder)||"#6366F1",styleId:T});var I=xe(x,ae,ve),B=xe(m,se,pe),w=I-he,E=B-he,F=m>=se-4&&m<=pe+4,_="";_=(O=x>=ae-4&&x<=ve+4)&&F?C(A,w,L,E):O&&!F?"M ".concat(A,",").concat(w," L ").concat(h,",").concat(w," L ").concat(h,",").concat(E):!O&&F?"M ".concat(h,",").concat(w," L ").concat(h,",").concat(E," L ").concat(L,",").concat(E):"M ".concat(h,",").concat(w," L ").concat(h,",").concat(E),le.push({id:T,pathD:_,style:g,leftIdx:e,rhsArrayIdx:e})}else if(ye){var k=e,M=Kn[k];if(!(null===(r=null==M?void 0:M.refIndexes)||void 0===r?void 0:r.length))return;M.refIndexes.forEach(function(e){var n,t,i=Vn.findIndex(function(n){return n.selfIndex===e});if(-1!==i){var o=null===(n=tt.current[k])||void 0===n?void 0:n.current,r=null===(t=it.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=o.getBoundingClientRect(),c=r.getBoundingClientRect(),u=Wt(k),d=l.right-y.left,a=c.left-y.left-0,s=d+.5*(a-d),v=l.top+l.height/2,p=c.top+c.height/2,f=v-ae+fe,g=p-se+ge,h="conn-".concat(k,"-").concat(i);de.push({lhsScrollY:f,rhsScrollY:g,x1:d,x2:a,containerTop:he,leftIdx:k,rhsArrayIdx:i,styleColor:(null==u?void 0:u.badgeBorder)||"#6366F1",styleId:h});var x=xe(v,ae,ve),m=xe(p,se,pe),b=x-he,S=m-he,R=v>=ae-4&&v<=ve+4,T=p>=se-4&&p<=pe+4,I="";I=R&&T?C(d,b,a,S):R&&!T?"M ".concat(d,",").concat(b," L ").concat(s,",").concat(b," L ").concat(s,",").concat(S):!R&&T?"M ".concat(s,",").concat(b," L ").concat(s,",").concat(S," L ").concat(a,",").concat(S):"M ".concat(s,",").concat(b," L ").concat(s,",").concat(S),le.push({id:h,pathD:I,style:u,leftIdx:k,rhsArrayIdx:i})}}})}else{var D=e,H=D;s=null===(i=tt.current[D])||void 0===i?void 0:i.current,v=null===(o=it.current[H])||void 0===o?void 0:o.current;if(!s||!v)return;var A,L;p=s.getBoundingClientRect(),f=v.getBoundingClientRect(),g=Wt(D),h=(A=p.right-y.left)+.5*((L=f.left-y.left-0)-A),x=p.top+p.height/2,m=f.top+f.height/2,b=x-ae+fe,R=m-se+ge,T="conn-".concat(D,"-").concat(H);de.push({lhsScrollY:b,rhsScrollY:R,x1:A,x2:L,containerTop:he,leftIdx:D,rhsArrayIdx:H,styleColor:(null==g?void 0:g.badgeBorder)||"#6366F1",styleId:T});var O;I=xe(x,ae,ve),B=xe(m,se,pe),w=I-he,E=B-he,F=m>=se-4&&m<=pe+4,_="";_=(O=x>=ae-4&&x<=ve+4)&&F?C(A,w,L,E):O&&!F?"M ".concat(A,",").concat(w," L ").concat(h,",").concat(w," L ").concat(h,",").concat(E):!O&&F?"M ".concat(h,",").concat(w," L ").concat(h,",").concat(E," L ").concat(L,",").concat(E):"M ".concat(h,",").concat(w," L ").concat(h,",").concat(E),le.push({id:T,pathD:_,style:g,leftIdx:D,rhsArrayIdx:H})}}),$e.current=de}Je(le)}else Je([]),$e.current=[]}catch(e){console.error("Line render safe fail: ",e)}finally{mn.current=!1}var me,be,Se}},[Xn,Kn,Vn,rn,Hn,zt,Wt,ye,ke,Ne,Ke,bt,St]),Vt=u(function(){var e,n,t,i,o,r,l,c,u,d,a,s,v,p,f=$e.current;if(f.length&&!Ge.current){var g=null!==(n=null===(e=xn.current)||void 0===e?void 0:e.scrollTop)&&void 0!==n?n:0,h=null!==(i=null===(t=vn.current)||void 0===t?void 0:t.scrollTop)&&void 0!==i?i:0,x=null!==(r=null===(o=xn.current)||void 0===o?void 0:o.clientHeight)&&void 0!==r?r:1/0,m=null!==(c=null===(l=vn.current)||void 0===l?void 0:l.clientHeight)&&void 0!==c?c:1/0,y=null!==(d=null===(u=xn.current)||void 0===u?void 0:u.getBoundingClientRect().top)&&void 0!==d?d:0,b=null!==(s=null===(a=vn.current)||void 0===a?void 0:a.getBoundingClientRect().top)&&void 0!==s?s:0,S=y+x,R=b+m,T=null!==(p=null===(v=Ft.current)||void 0===v?void 0:v.getBoundingClientRect().top)&&void 0!==p?p:0,I=function(e,n,t){return Math.max(n,Math.min(t,e))};f.forEach(function(e){var n=e.lhsScrollY-g+y,t=e.rhsScrollY-h+b,i=Ze.current[e.styleId+"-stroke"],o=Ze.current[e.styleId+"-bg"];if(i||o){var r,l=I(n,y,S),c=I(t,b,R),u=l-T,d=c-T,a=n>=y-4&&n<=S+4,s=t>=b-4&&t<=R+4,v=e.x1+.5*(e.x2-e.x1);r=a&&s?C(e.x1,u,e.x2,d):a&&!s?"M ".concat(e.x1,",").concat(u," L ").concat(v,",").concat(u," L ").concat(v,",").concat(d):!a&&s?"M ".concat(v,",").concat(u," L ").concat(v,",").concat(d," L ").concat(e.x2,",").concat(d):"M ".concat(v,",").concat(u," L ").concat(v,",").concat(d),i&&(i.setAttribute("visibility","visible"),i.setAttribute("d",r)),o&&(o.setAttribute("visibility","visible"),o.setAttribute("d",r))}})}},[]);c(function(){on.current=Kt},[Kt]);var Xt=r(null),qt=r(null),Jt=u(function(){$e.current.length>0&&!Ge.current||(null!==Xt.current&&clearTimeout(Xt.current),Xt.current=setTimeout(function(){on.current(),Xt.current=null},50))},[]),Ut=u(function(){Pe(!0),Ae(!1),null!==qt.current&&clearTimeout(qt.current),null!==Xt.current&&(clearTimeout(Xt.current),Xt.current=null),qt.current=setTimeout(function(){var e,n,t,i,o,r,l,c;if($e.current=[],nn.current&&null!==tn.current&&null!==kt.current){var u=tn.current,d=kt.current,a=null,s=null,v=null,p=null;if("string"==typeof u&&u.includes(S)){var f=u.split(S),g="".concat(f[0]).concat(S).concat(f[1]);a=(null===(e=tt.current[g])||void 0===e?void 0:e.current)||null,s=(null===(n=it.current[g])||void 0===n?void 0:n.current)||null,v=(null===(t=rt.current[f[2]])||void 0===t?void 0:t.current)||null,p=(null===(i=lt.current[f[3]])||void 0===i?void 0:i.current)||null}else a=(null===(o=ct.current[u])||void 0===o?void 0:o.current)||null,v=(null===(r=et.current[u])||void 0===r?void 0:r.current)||null,s=(null===(l=ot.current[d])||void 0===l?void 0:l.current)||null,p=(null===(c=nt.current[d])||void 0===c?void 0:c.current)||null;if(a&&s&&v&&p){if(v.style.paddingTop="0px",p.style.paddingTop="0px",!ye){var h=a.getBoundingClientRect(),x=s.getBoundingClientRect(),m=h.top-x.top;m>0?p.style.paddingTop="".concat(m,"px"):m<0&&(v.style.paddingTop="".concat(Math.abs(m),"px"))}var y=xn.current,b=vn.current;if(y&&b){var R=a.getBoundingClientRect().top-y.getBoundingClientRect().top+y.scrollTop,C=s.getBoundingClientRect().top-b.getBoundingClientRect().top+b.scrollTop-(R-y.scrollTop);Math.abs(b.scrollTop-C)>1&&(b.scrollTop=C)}}}on.current(),nn.current&&Ae(!0),Pe(!1),qt.current=null},150)},[ye,Kn,Vn]),Gt=u(function(e){var n,t,i,o,r,l,c,u,d,a;if(!We.current){if(ye||Jt(),nn.current){var s=tn.current,v=kt.current,p=xn.current,f=vn.current;if(null!==s&&null!==v&&p&&f){var g="string"==typeof s&&s.includes(S)?null===(n=tt.current["".concat(s.split(S)[0]).concat(S).concat(s.split(S)[1])])||void 0===n?void 0:n.current:null===(t=ct.current[s])||void 0===t?void 0:t.current,h="string"==typeof v&&v.includes(S)?null===(i=it.current["".concat(v.split(S)[0]).concat(S).concat(v.split(S)[1])])||void 0===i?void 0:i.current:null===(o=ot.current[v])||void 0===o?void 0:o.current;if(g&&h){var x=g.getBoundingClientRect().top-p.getBoundingClientRect().top+p.scrollTop,m=h.getBoundingClientRect().top-f.getBoundingClientRect().top+f.scrollTop;if(e.currentTarget===p){var y=m-(x-p.scrollTop),b=f.scrollHeight-f.clientHeight,R=Math.max(0,Math.min(y,b));Math.abs(f.scrollTop-R)>1&&(f.scrollTop=R)}else if(e.currentTarget===f){var C=x-(m-f.scrollTop),T=p.scrollHeight-p.clientHeight,I=Math.max(0,Math.min(C,T));Math.abs(p.scrollTop-I)>1&&(p.scrollTop=I)}if(Mt.current){var B=void 0,w=void 0;if("string"==typeof s&&s.includes(S)){var E=s.split(S),F="".concat(E[0]).concat(S).concat(E[1]);B=null===(r=tt.current[F])||void 0===r?void 0:r.current,w=null===(l=it.current[F])||void 0===l?void 0:l.current}else B=null===(c=tt.current[s])||void 0===c?void 0:c.current,w=null===(u=it.current[v])||void 0===u?void 0:u.current;var _=null!==(a=null===(d=Ft.current)||void 0===d?void 0:d.getBoundingClientRect().top)&&void 0!==a?a:0,k=p.getBoundingClientRect().top,M=k+p.clientHeight;f.getBoundingClientRect().top;f.clientHeight;if(B&&w){var D=B.getBoundingClientRect(),H=w.getBoundingClientRect(),A=D.top+D.height/2;H.top,H.height;var L=((P=A,j=k,N=M,Math.max(j,Math.min(N,P)))-_).toString();Mt.current.setAttribute("y1",L),Mt.current.setAttribute("y2",L);var O=A>=k-4&&A<=M+4;Mt.current.setAttribute("visibility",O?"visible":"hidden")}}}}}var P,j,N;$e.current.length>0&&!en.current&&(en.current=!0,requestAnimationFrame(function(){Vt(),en.current=!1}))}},[Vt,ye,Jt]);c(function(){var e=setTimeout(Jt,250);window.addEventListener("resize",Ut);var n=null,t=null;return an.current&&(n=new ResizeObserver(Jt)).observe(an.current),Ft.current&&(t=new ResizeObserver(Jt)).observe(Ft.current),function(){clearTimeout(e),null!==Xt.current&&clearTimeout(Xt.current),null!==qt.current&&clearTimeout(qt.current),window.removeEventListener("resize",Ut),null==n||n.disconnect(),null==t||t.disconnect()}},[Wn,Yn,st,Xn,bt,St,Kn,Vn,Hn,Jt,Ut,ke,Ne,He,Ke]),c(function(){nn.current=ke},[ke]),c(function(){tn.current=Ne},[Ne]);var Qt=u(function(e,n,t){var i,o,r,l,c,u,d=null===(i=null==t?void 0:t.toggleIfSame)||void 0===i||i,a=null==t?void 0:t.onReady,s=null!==(o=null==t?void 0:t.sourceSide)&&void 0!==o?o:"left";if(Dn(),null!=e)if(n)Fe("No counterpart exists for this section.");else if(ke&&Ne===e)d?mt():null==a||a();else{if(!ye){var v=tn.current,p=kt.current;if(null!==v)if("string"==typeof v&&v.includes(S)){var f=v.split(S);(g=null===(r=rt.current[f[2]])||void 0===r?void 0:r.current)&&(g.style.paddingTop="0px")}else{var g;(g=null===(l=et.current[v])||void 0===l?void 0:l.current)&&(g.style.paddingTop="0px")}if(null!==p)if("string"==typeof p&&p.includes(S)){f=p.split(S);(h=null===(c=lt.current[f[3]])||void 0===c?void 0:c.current)&&(h.style.paddingTop="0px")}else{var h;(h=null===(u=nt.current[p])||void 0===u?void 0:u.current)&&(h.style.paddingTop="0px")}}Ve(new Set),Je([]),$e.current=[],Be(!0),We.current=!0,ze(e),tn.current=e,Me(!0),nn.current=!0,Ae(!1),pn.current&&(pn.current.style.height="0px"),fn.current&&(fn.current.style.height="0px"),gn.current&&(gn.current.style.height="0px"),hn.current&&(hn.current.style.height="0px"),requestAnimationFrame(function(){var n,t,i,o,r,l,c,u,d,v,p=null,f=null,g=null,h=null,x=null;if("string"==typeof e&&e.includes(S)){var m=e.split(S),y="".concat(m[0]).concat(S).concat(m[1]);p=(null===(n=tt.current[y])||void 0===n?void 0:n.current)||null,x=(f=(null===(t=it.current[y])||void 0===t?void 0:t.current)||null)?e:null,g=(null===(i=rt.current[m[2]])||void 0===i?void 0:i.current)||null,h=(null===(o=lt.current[m[3]])||void 0===o?void 0:o.current)||null}else if(p=(null===(r=ct.current[e])||void 0===r?void 0:r.current)||null,g=(null===(l=et.current[e])||void 0===l?void 0:l.current)||null,ye){var b=Kn[e],R=(null==b?void 0:b.refIndexes)||[];if(R.length>0){var C=R[0],I=Vn.findIndex(function(e){return e.selfIndex===C});-1!==I&&(f=(null===(d=ot.current[I])||void 0===d?void 0:d.current)||null,h=(null===(v=nt.current[I])||void 0===v?void 0:v.current)||null,x=I)}}else f=(null===(c=ot.current[e])||void 0===c?void 0:c.current)||null,h=(null===(u=nt.current[e])||void 0===u?void 0:u.current)||null,x=f?e:null;kt.current=x;var B=xn.current,w=vn.current;if(!p||!B)return We.current=!1,Be(!1),void(null==a||a());if(!f||!w)return Ae(!0),on.current(),We.current=!1,Be(!1),void(null==a||a());if(!ye){var E=p.getBoundingClientRect(),F=f.getBoundingClientRect(),_=E.top-F.top;g&&h&&(g.style.paddingTop="0px",h.style.paddingTop="0px",_>0?h.style.paddingTop="".concat(_,"px"):_<0&&(g.style.paddingTop="".concat(Math.abs(_),"px")));var k=0;k="right"===s?f?f.getBoundingClientRect().top:(null==h?void 0:h.getBoundingClientRect().top)||0:p?p.getBoundingClientRect().top:(null==g?void 0:g.getBoundingClientRect().top)||0;var M=an.current,D=M?M.scrollTop+k-150:0;return M?void T(M,D,200,function(){Ae(!0),on.current(),We.current=!1,Be(!1),null==a||a()}):(Ae(!0),on.current(),We.current=!1,Be(!1),void(null==a||a()))}var H=p.getBoundingClientRect().top-B.getBoundingClientRect().top+B.scrollTop,A=f.getBoundingClientRect().top-w.getBoundingClientRect().top+w.scrollTop,L=200;if("left"===s){var O=A-(H-B.scrollTop);O<0&&pn.current&&(pn.current.style.height="".concat(Math.abs(O),"px")),requestAnimationFrame(function(){var e,n=w.scrollHeight-w.clientHeight;if(O<0)e=0;else{if(O>n){var t=O-n;return fn.current&&(fn.current.style.height="".concat(t+150,"px")),void requestAnimationFrame(function(){T(w,O,L,function(){Ae(!0),on.current(),We.current=!1,Be(!1),null==a||a()})})}e=O}T(w,e,L,function(){Ae(!0),on.current(),We.current=!1,Be(!1),null==a||a()})})}else{var P=H-(A-w.scrollTop);P<0&&gn.current&&(gn.current.style.height="".concat(Math.abs(P),"px")),requestAnimationFrame(function(){var e,n=B.scrollHeight-B.clientHeight;if(P<0)e=0;else{if(P>n){var t=P-n;return hn.current&&(hn.current.style.height="".concat(t+150,"px")),void requestAnimationFrame(function(){T(B,P,L,function(){Ae(!0),on.current(),We.current=!1,Be(!1),null==a||a()})})}e=P}T(B,e,L,function(){Ae(!0),on.current(),We.current=!1,Be(!1),null==a||a()})})}})}},[Ne,Dn,Vn,ke,ye,Kn,mt]),Zt=u(function(e,n,t,i){var o,r="string"==typeof i?m(i).trim():m(null==i?void 0:i.deviation_summary).trim(),l=e.currentTarget;Mn();var c="left";(null===(o=vn.current)||void 0===o?void 0:o.contains(l))&&(c="right"),t?r&&En({open:!0,anchorEl:l,summary:i}):Qt(n,t,r?{toggleIfSame:!1,sourceSide:c,onReady:function(){En({open:!0,anchorEl:l,summary:i})}}:{toggleIfSame:!1,sourceSide:c})},[Qt,Mn,En]),$t=u(function(){var e,n=Rn.sectionIdx,t=Rn.isOrphan;if(Fn(),null!=n){var i="left";Rn.anchorEl&&(null===(e=vn.current)||void 0===e?void 0:e.contains(Rn.anchorEl))&&(i="right"),Qt(n,t,{sourceSide:i})}},[Qt,Rn.isOrphan,Rn.sectionIdx,Rn.anchorEl,Fn]),ei=u(function(){Fn(),mt()},[Fn,mt]),ni=null!==Rn.sectionIdx&&Ke.has(Rn.sectionIdx),ti=P({proposedSections:Kn,existingSections:Vn,parentDeviationRecord:qn,expandedSections:bt,maintainRelativeOrder:!!ye,scrollContainerRef:an,leftContainerRef:xn,lhsBadgeRefs:tt,rhsBadgeRefs:it}),ii=ti.showDeviationNavigation,oi=ti.showOpenNodeRef,ri=l(function(){if(!xe)return null;for(var e in qn){if((qn[e]||[]).some(function(e){return e.id===xe}))return e}return null},[xe,qn]),li=r(null);c(function(){if(xe&&li.current!==xe){var e=!1,t=0,i=null,o=150,r=function(e,n){for(var t=function(e,i){if(!e)return null;if(e.id===n)return i;if(!Array.isArray(e.subsections))return null;for(var o=0;o<e.subsections.length;o++){var r=t(e.subsections[o],"".concat(i,"-").concat(o));if(r)return r}return null},i=0;i<e.length;i++){var o=t(e[i],String(i));if(o)return o}return null},l=function(){var c,u,d,a;if(!e){var s=null,v=null;for(var p in qn){var f=qn[p].find(function(e){return e.id===xe});if(f){s=p,v=f;break}}if(v&&s){var g=Kn.findIndex(function(e){return e.id===s});if(!(ye?!!bt["left-".concat(g)]:!!bt[String(g)])&&g>=0)return Ct(g,"left"),t+=1,void(i=setTimeout(l,450));var h=r(Kn,v.id),x=r(Vn,v.id);if(h&&!x){var m=h.split("-"),y=Number(m[0]);if(ye){var b=null===(u=null===(c=Kn[y])||void 0===c?void 0:c.refIndexes)||void 0===u?void 0:u[0],R=Vn.findIndex(function(e){return e.selfIndex===b});-1!==R&&(y=R)}x=n([y],m.slice(1),!0).join("-")}if(h&&x){var C="".concat(v.id).concat(S,"0").concat(S).concat(h).concat(S).concat(x),I="".concat(v.id).concat(S,"0"),B=null===(d=tt.current[I])||void 0===d?void 0:d.current,w=null===(a=it.current[I])||void 0===a?void 0:a.current,E=ye?xn.current:an.current;if(B&&E){var F=B.getBoundingClientRect();if(0===F.height)return void((t+=1)<20&&(i=setTimeout(l,o)));var _=E.getBoundingClientRect(),k=F.top-_.top+E.scrollTop-_.height/2+F.height/2,M=function(){var e=window.getComputedStyle(B).color;B.style.transition="box-shadow 300ms ease-in-out",B.style.boxShadow="0 0 10px ".concat(e),w&&(w.style.transition="box-shadow 300ms ease-in-out",w.style.boxShadow="0 0 10px ".concat(e)),setTimeout(function(){B&&(B.style.boxShadow=""),w&&(w.style.boxShadow="")},2e3)},D=function(){var e,n,t,i=(null==v?void 0:v.evaluationResult)||(null===(e=null==he?void 0:he[null==v?void 0:v.id])||void 0===e?void 0:e.evaluation_result)||(null===(t=null===(n=null==ce?void 0:ce.nodes)||void 0===n?void 0:n[null==v?void 0:v.id])||void 0===t?void 0:t.evaluation_result)||null,o=(null==i?void 0:i.deviations)||{},r=Object.keys(o).sort()[0]||null,l=r?o[r]:null,c=(null==l?void 0:l.deviation_summary)||"";En({open:!0,anchorEl:B,summary:{deviation_summary:c,deviation_title:null==i?void 0:i.deviation_title,evaluation_outputs:null==i?void 0:i.evaluation_outputs}})};li.current=xe,ye?(E.scrollTo({top:k,behavior:"smooth"}),Qt(C,!1,{toggleIfSame:!1}),D(),setTimeout(function(){on.current()},0),M()):T(E,k,300,function(){e||(Qt(C,!1,{toggleIfSame:!1}),D(),setTimeout(function(){on.current()},0),M())})}else(t+=1)<20&&(i=setTimeout(l,o))}else(t+=1)<20&&(i=setTimeout(l,o))}else(t+=1)<20&&(i=setTimeout(l,o))}};return i=setTimeout(l,o),function(){e=!0,i&&clearTimeout(i)}}},[xe,qn,Kn,Vn,ye,bt,Ct,he,ce,En,Qt]);var ci=function(e){var n=e.section,t=e.keyPath,o=e.depth,r=void 0===o?0:o,l=e.columnKey,c=void 0===l?"left":l,u=e.parentNodeId;return i(z,{section:n,keyPath:t,depth:r,columnKey:c,parentNodeId:void 0===u?"":u,expandedSubSections:St,setExpandedSubSections:Rt,maintainRelativeOrder:ye||!1,proposedSections:Kn,existingSections:Vn,treeData:ce,deviationNumberRegistry:Jn,connectedSections:Ke,activeSideBySideSection:Ne,resolvedMarkdownStyles:dn,getSubSectionRef:dt,getSubSectionCompareStyle:Yt,getBadgeRef:at,openMoreFunctionsPopup:Bt,openSummaryPopup:Zt,resetSideBySide:mt,setConnectedSections:Ve,setConnectedLines:Je,cachedConnectedPositions:$e})};return t(d,e({ref:sn,sx:e(e({display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif'},ye?{}:{overflow:"visible"}),{position:"relative"})},{children:[Re&&i(d,e({sx:{position:"absolute",inset:0,bgcolor:"rgba(255, 255, 255, 0.6)",backdropFilter:"blur(10px)",zIndex:9999,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"8px"}},{children:i(M,{})})),wn.open&&i(W,{open:wn.open,anchorEl:wn.anchorEl,containerEl:_t.current,clipTopEl:Dt.current,onClose:ei,summary:wn.summary}),i(k,{open:Rn.open,anchorEl:Rn.anchorEl,sectionTitle:Rn.sectionTitle,referenceSectionTitle:Rn.refSectionTitle,onClose:Dn,onOpenCognitiveCompare:wt,onOpenSideBySide:$t,onConnect:Et,isConnected:ni,isOrphan:Rn.isOrphan}),bn.open&&i(_,{open:bn.open,popupRef:kn,position:Tn,popupConfig:fe,onClose:function(){In(null),Sn(function(n){return e(e({},n),{open:!1})}),_n(null)},markdownStyles:se,sectionTitle:bn.sectionTitle,referenceSectionTitle:bn.refSectionTitle,cognitiveData:bn.cognitiveData,anchorEl:bn.anchorEl,sectionAnchorEl:bn.sectionAnchorEl,scrollContainerEl:an.current,badgeStyle:bn.badgeStyle,docData:bn.docData,deviationData:bn.deviationData,isLoading:bn.isLoading}),i(a,e({open:!!Ee,autoHideDuration:8e3,onClose:function(){return Fe(null)},anchorOrigin:{vertical:"top",horizontal:"center"}},{children:i(s,e({onClose:function(){return Fe(null)},severity:"error",sx:{width:"100%",whiteSpace:"pre-line"}},{children:Ee}))})),i(j,{componentHeaderText:le,displayConfig:pe,maintainRelativeOrder:ye,onToggleView:function(e){Ce(!0),setTimeout(function(){be(!e),mt(),Ve(new Set),Je([]),$e.current=[],setTimeout(function(){Ce(!1)},400)},50)}}),i(d,e({ref:an,onScroll:Gt,sx:{flex:1,minHeight:0,pt:1.5,pb:1,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",overflowY:ye?"hidden":"auto",borderTop:vt&&pt?"none":"1.5px solid #EEF0F4"}},{children:i(d,e({sx:e({display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"},ye?{flex:1,minHeight:0}:{})},{children:t(d,e({ref:Ft,sx:e({display:"grid",gridTemplateColumns:"minmax(0, 1fr) 180px minmax(0, 1fr)",gap:"40px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0},ye?{flex:1,overflow:"visible"}:{})},{children:[t("svg",e({ref:Ue,style:{position:"absolute",top:0,left:0,width:cn.width||"100%",height:cn.height||"100%",pointerEvents:"none",zIndex:10,overflow:"visible",opacity:Oe?0:1,transition:"opacity 0.15s ease-in-out"}},{children:[jt&&i("g",{children:i("line",{x1:jt.x1,y1:jt.y,x2:jt.x2,y2:jt.y,stroke:xt.badgeBorder,strokeWidth:"1.5"})}),Lt.map(function(n){var o,r,l,c,u,a,s=n.x1+.5*(n.x2-n.x1),v=(n.y1+n.y2)/2;if("Not Defined"===n.style.label&&!n.hasCognitive)return null;if(n.isSubSection?ke&&Ne===n.subSectionKeyPath&&He:ke&&Ne===n.sectionIdx&&He)return t("g",e({style:{transition:"opacity 0.2s"}},{children:[i("defs",{children:i("marker",e({id:"arr-".concat(n.id),markerWidth:"7",markerHeight:"5",refX:"7",refY:"2.5",orient:"auto"},{children:i("polygon",{points:"0 0, 7 2.5, 0 5",fill:n.style.badgeBorder||"#6366F1"})}))}),i("line",{ref:Mt,x1:n.x1,y1:n.y1,x2:n.x2,y2:n.y2,stroke:n.style.badgeBorder||"#6366F1",strokeWidth:"1.5",markerEnd:"url(#arr-".concat(n.id,")")})]}),n.id);if(!ye){var p=n.isSubSection?C(n.x1,n.y1,n.x2,n.y2):"M ".concat(n.x1," ").concat(n.y1," L ").concat(n.x2," ").concat(n.y2),g=Kn[n.sectionIdx]||{title:"",content:""},x=Vn[n.sectionIdx]||{title:"",content:""};if(console.log("Base and Ref Sections for Badge:",g,x),n.isSubSection&&n.subSectionKeyPath){var m=n.subSectionKeyPath.split(S)[2].split("-").map(Number),y=Kn[m[0]],b=Vn[m[0]],R=(null==y?void 0:y.title)||"",T=(null==b?void 0:b.title)||"";console.log("Root Parent Titles:",R,T);for(var I=1;I<m.length;I++)(null==y?void 0:y.subsections)&&(y=y.subsections[m[I]]),(null==b?void 0:b.subsections)&&(b=b.subsections[m[I]]);y&&(g=e(e({},y),{title:R||y.title})),console.log("Base Section for Subsection Badge:",g),b&&(x=e(e({},b),{title:T||b.title})),console.log("Ref Section for Subsection Badge:",x)}var B=!(null===(o=g.cognitiveData)||void 0===o?void 0:o.isMissingRationale)||Boolean(null===(l=null===(r=g.cognitiveData)||void 0===r?void 0:r.decisioning)||void 0===l?void 0:l.length),w=(null===(a=null===(u=null===(c=g.evaluationResult)||void 0===c?void 0:c.cognitive_decisioning)||void 0===u?void 0:u.decisioning_factors)||void 0===a?void 0:a.length)||!1,F=B||w;return t("g",{children:[i("path",{d:p,fill:"none",stroke:n.style.badgeBorder||"#E2E8F0",strokeWidth:"1.5"}),i("foreignObject",e({x:s-100,y:v-14,width:"200",height:"28",style:{pointerEvents:"auto",overflow:"visible"}},{children:i(d,e({sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},{children:t(d,e({onClick:function(e){e.stopPropagation(),F&&(bn.open&&Bn===n.id?Mn():(_n(n.id),It(Tt(e.currentTarget,g,x,n.sectionIdx,n.style))))},sx:{display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",bgcolor:n.style.badgeBg,color:n.style.badgeText,border:"1px solid ".concat(n.style.badgeBorder),borderRadius:"12px",px:1.5,py:.5,fontWeight:600,textAlign:"center",whiteSpace:"nowrap",cursor:F?"pointer":"default"}},{children:[n.style.badgeText===E&&null==n.style.label?i(D,{color:n.style.badgeText}):0===n.style.label?"Same":n.style.label,i(d,e({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:i(h,{})})),F&&i(f,{size:11,style:{transform:bn.open&&Bn===n.id?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))}))]},n.id)}return null}),qe.map(function(n){var o,r=n.pathD,l=(null===(o=n.style)||void 0===o?void 0:o.badgeBorder)||"#6366F1",c="conn-marker-".concat(n.id),u="".concat(n.id,"-bg"),d="".concat(n.id,"-stroke");return t("g",{children:[i("defs",{children:i("clipPath",e({id:"connections-clip"},{children:i("marker",e({id:c,markerWidth:"8",markerHeight:"6",refX:"7",refY:"3",orient:"auto"},{children:i("polygon",{points:"0 0, 8 3, 0 6",fill:l})}))}))}),i("path",{ref:function(e){Ze.current[u]=e},d:r,fill:"none",stroke:"#FFFFFF",strokeWidth:"4",strokeOpacity:"0.7"}),i("path",{ref:function(e){Ze.current[d]=e},d:r,fill:"none",stroke:l,strokeWidth:"1.75",markerEnd:"url(#".concat(c,")")})]},n.id)})]})),t(d,e({sx:e({border:"1px solid #E7E7E9",borderRadius:"8px",bgcolor:"#FFFFFF",display:"flex",flexDirection:"column",position:"relative",zIndex:2,filter:"drop-shadow(0px 2px 4px #F2F2F2)"},ye?{flex:1,overflow:"visible"}:{})},{children:[i(d,e({ref:Dt,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E7E7E9",borderRadius:"8px 8px 0 0",display:"flex",alignItems:"center",minHeight:"40px",overflow:"hidden",minWidth:0}},{children:i(v,e({title:jn,placement:"top"},{children:i(p,e({sx:{fontSize:"16px",fontWeight:500,color:"#19213D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0,textAlign:"center",display:"block"}},{children:jn}))}))})),t(d,e({ref:xn,onScroll:Gt,sx:e({p:"12px",display:"flex",flexDirection:"column"},ye?{maxHeight:"calc(100vh - 150px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,mr:"-160px",pr:"172px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[i("div",{ref:gn,style:{width:"100%",height:"0px",flexShrink:0}}),Gn&&Kn.map(function(n,o){var r,l,c=!n.title&&!n.content;if(ye&&c)return null;var u=n,a=Wt(o,"left"),s=ye?!(null===(r=u.refIndexes)||void 0===r?void 0:r.length)||u.selfIndex<0:!Vn[o],v=ye?"number"==typeof u.selfIndex&&u.selfIndex>=0?u.selfIndex+1:null:o+1,p=Ke.has(o),f=y(u.evaluationResult,null==a?void 0:a.deviationLabel);return i(d,e({ref:ut(o),sx:{mb:1,width:"100%"}},{children:t(d,e({sx:{position:"relative",width:"100%"}},{children:[i(d,e({ref:et.current[o],sx:e({width:"100%",display:"flex"},p&&{borderRadius:"6px",outline:"2px solid ".concat((null==a?void 0:a.badgeBorder)||"#6366F1"),outlineOffset:"1px"})},{children:i(N,{section:n,idx:o,columnKey:"left",colRef:ut("left-accordion-".concat(o)),mb:0,treeData:ce,proposedSections:Kn,existingSections:Vn,deviationNumberRegistry:Jn,getSectionCompareStyle:Wt,getBadgeRef:at,connectedSections:Ke,openMoreFunctionsPopup:Bt,openSummaryPopup:Zt,deviationNodeIdToView:xe,deviationTargetParentId:ri,parentNodeId:(null===(l=null==ce?void 0:ce.input_index_map)||void 0===l?void 0:l[0])||"",isExpanded:ye?!!bt["left-".concat(o)]:!!bt[String(o)],onToggle:function(){bt[ye?"left-".concat(o):String(o)]&&Fn(),Ct(o,"left")},navigation:n.id?ii[n.id]:null,showOpenNodeRef:oi,resolvedMarkdownStyles:dn,maintainRelativeOrder:ye,renderSubSections:ci})})),ye&&a&&t(d,e({ref:tt.current[o],onClick:function(e){var t=ye?Vn.find(function(e){var n;return null===(n=u.refIndexes)||void 0===n?void 0:n.includes(e.selfIndex)})||{title:"",content:""}:Vn[o]||{title:"",content:""};Bt(e,n,s,t,o,a)},sx:{position:"absolute",top:"18px",right:0,transform:"translateY(-50%) translateX(calc(100% + 8px))",display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",bgcolor:a.badgeBg,color:a.badgeText,border:"1px solid ".concat(a.badgeBorder),borderRadius:"12px",px:1.2,py:.4,fontWeight:600,cursor:"pointer",whiteSpace:"nowrap",zIndex:20,boxShadow:"0 1px 3px rgba(0,0,0,0.07)"}},{children:[null!==v&&i(d,e({component:"span",sx:{fontSize:"11px",fontWeight:700,pr:.5,borderRight:"1px solid ".concat(a.badgeBorder)}},{children:v})),i(d,e({component:"span",sx:{fontSize:"11px",px:.25}},{children:!pe.isLoading||null!=u.evaluationResult&&null!=u.evaluationResult?s?"No Deviation Found":"N/A"===f||"NA"===f?"N/A":0==f||null==f?"Same":"".concat(f):i(D,{color:a.badgeText})})),i(g,{size:11,color:a.badgeText})]}))]}))}),"left-row-".concat(o))}),i("div",{ref:hn,style:{width:"100%",height:"0px",flexShrink:0}})]}))]})),i(d,e({ref:_t,sx:{width:"180px",display:"flex",flexDirection:"column",alignItems:"center",pt:"15px",gap:0,zIndex:20,pointerEvents:"none"}},{children:i(d,e({sx:{display:"flex",justifyContent:"center",alignItems:"center",mt:0}},{children:t(d,e({onClick:function(n){n.stopPropagation(),bn.open&&Bn===ft?Mn():(_n(ft),It(Tt(n.currentTarget,{title:"",content:"",evaluationResult:gt,cognitiveData:{section_id:"",decisioning:[],gap:[],relevance_score:0,isMissingRationale:!0}},null,ft,!0,e(e({},xt),{label:""}))))},sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:"5px",top:"-5px",borderRadius:"20px",bgcolor:xt.badgeBg,color:xt.badgeText,border:"1px solid ".concat(xt.badgeBorder),fontSize:"12px",fontWeight:600,whiteSpace:"nowrap",position:"relative",zIndex:1,pointerEvents:"auto",cursor:"pointer"}},{children:[null!=ht?ht:i(D,{}),i(d,e({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:i(h,{})})),i(f,{size:11,style:{transform:bn.open&&Bn===ft?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))})),t(d,e({sx:e({border:"1px solid #E3E6EA",borderRadius:"8px",bgcolor:"#FFFFFF",boxShadow:"0px 1px 4px #F7F4FE",position:"relative",zIndex:2,display:"flex",flexDirection:"column",minWidth:0},ye?{flex:1,overflow:"visible",minHeight:0}:{})},{children:[Ie&&i(x,{sections:11}),i(d,e({ref:Ht,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E3E6EA",borderRadius:"8px 8px 0 0",minHeight:"40px",display:"flex",alignItems:"center",overflowX:"hidden"}},{children:i(v,e({title:Nn,placement:"top"},{children:i(p,e({sx:{fontSize:"16px",fontWeight:500,color:"#5928ED",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0,textAlign:"center",display:"block"}},{children:Nn}))}))})),t(d,e({ref:vn,onScroll:Gt,sx:e({p:"12px",display:"flex",flexDirection:"column"},ye?{maxHeight:"calc(100vh - 150px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,ml:"-120px",pl:"140px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[i("div",{ref:pn,style:{width:"100%",height:"0px",flexShrink:0}}),Gn&&Vn.map(function(n,o){var r,l=n,c=[],u=!1,a=null,s=-1;if(ye){c=Kn.filter(function(e){var n;return(null===(n=e.refIndexes)||void 0===n?void 0:n.includes(l.selfIndex))&&e.selfIndex>=0}).map(function(e){return e.selfIndex+1}),s=Kn.findIndex(function(e){var n;return(null===(n=e.refIndexes)||void 0===n?void 0:n.includes(l.selfIndex))&&e.selfIndex>=0});var v=Kn.findIndex(function(e,n){var t;return Ke.has(n)&&(null===(t=e.refIndexes)||void 0===t?void 0:t.includes(l.selfIndex))});(u=-1!==v)&&(a=Wt(v))}else c=[o+1],(u=Ke.has(o))&&(a=Wt(o));var p=Wt(ye&&-1!==s?s:o);return i(d,e({ref:ot.current[o],sx:{mb:1,width:"100%"}},{children:t(d,e({sx:{position:"relative",width:"100%"}},{children:[i(d,e({ref:nt.current[o],sx:e({width:"100%",display:"flex"},u&&a&&{borderRadius:"6px",outline:"2px solid ".concat(a.badgeBorder),outlineOffset:"1px"})},{children:i(N,{section:n,idx:o,columnKey:"right",colRef:ut("right-accordion-".concat(o)),mb:0,parentNodeId:(null===(r=null==ce?void 0:ce.input_index_map)||void 0===r?void 0:r[1])||"",isExpanded:ye?!!bt["right-".concat(o)]:!!bt[String(o)],treeData:ce,proposedSections:Kn,existingSections:Vn,deviationNumberRegistry:Jn,getBadgeRef:at,getSectionCompareStyle:Wt,connectedSections:Ke,openMoreFunctionsPopup:Bt,openSummaryPopup:Zt,deviationNodeIdToView:xe,deviationTargetParentId:ri,onToggle:function(){bt[ye?"right-".concat(o):String(o)]&&Fn(),Ct(o,"right")},navigation:n.id?ii[n.id]:null,showOpenNodeRef:oi,resolvedMarkdownStyles:dn,maintainRelativeOrder:ye,renderSubSections:ci})})),ye&&!Ie&&p&&i(d,e({ref:it.current[o],"data-section-id":l.id,sx:{position:"absolute",top:"18px",left:0,transform:"translateY(-50%) translateX(calc(-100% - 8px))",display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:"11px",bgcolor:p.badgeBg,color:p.badgeText,border:"1px solid ".concat(p.badgeBorder),borderRadius:"10px",px:1,py:.3,fontWeight:700,whiteSpace:"nowrap",zIndex:20}},{children:c.length>0?c.join(", "):"-"}))]}))}),"right-row-".concat(o))}),i("div",{ref:fn,style:{width:"100%",height:"0px",flexShrink:0}})]}))]}))]}))}))}))]}))};export{Y as default};
|
|
1
|
+
import{__assign as e,__spreadArray as n}from"tslib";import{jsxs as t,jsx as i}from"react/jsx-runtime";import{useState as o,useRef as r,useMemo as l,useEffect as c,useCallback as u}from"react";import{Box as d,Snackbar as a,Alert as s,Tooltip as v,Typography as p}from"@mui/material";import{ChevronDown as f,EllipsisVertical as g}from"lucide-react";import{ButtonCognitiveIcon as h}from"../../assests/svg/ButtonCognitiveIcon.js";import x from"./OverlayComponent.js";import{safeStringify as m,extractDeviationScore as y,generateColorPalette as b,DEVIATION_BADGE_SEPARATOR as S,hasValue as R,getBentArrowPath as C,smoothScrollTo as I}from"./CognitiveComparehelpers.js";import{SHARED_MARKDOWN_STYLES as T,DEFAULT_FIELD_CONFIG as B,DEFAULT_COMPARISON_CONFIG as w}from"./CognitiveCompareConfig.js";export{SHARED_MARKDOWN_STYLES}from"./CognitiveCompareConfig.js";import{DEFAULT_DEVIAION_COLOR as E,DEFAULT_COMPONENT_HEADER_TEXT as F}from"./CognitiveCompareConstants.js";import _ from"./CognitivePopup.js";import M from"./MoreFunctionsPopup.js";import D from"./LoaderComponent.js";import k from"./components/ThreeDotsLoader.js";import{useCognitiveTreeData as A}from"./hooks/useCompareData.js";import{useComparePopups as H}from"./hooks/useComparePopups.js";import{useSectionRefs as N}from"./hooks/useSectionRefs.js";import{useAccordionState as L}from"./hooks/useAccordionState.js";import{useDeviationNavigation as P}from"./hooks/useDeviationNavigation.js";import O from"./components/CompareHeader.js";import j from"./components/SectionAccordion.js";import z from"./components/SubSectionAccordion.js";import W from"./components/CognitiveSummaryPopup.js";var Y=function(Y){var K,q,V,X,J,U,G,Q,Z,$,ee,ne,te,ie,oe,re=Y.componentHeaderText,le=void 0===re?F:re,ce=Y.treeData,ue=Y.comparisonConfig,de=Y.leftColumnTitleText,ae=Y.rightColumnTitleText,se=Y.markdownStyles,ve=Y.displayConfig,pe=void 0===ve?{isHeaderVisible:!0,isToggleVisible:!0,maintainRelativeOrder:!1,isLoading:!0}:ve,fe=Y.popupConfig,ge=Y.deviationData,he=void 0===ge?{}:ge,xe=Y.deviationNodeIdToView,me=Y.resetDeviationNodeId,ye=o(pe.maintainRelativeOrder),be=ye[0],Se=ye[1],Re=o(!1),Ce=Re[0],Ie=Re[1],Te=o(!1),Be=Te[0],we=Te[1],Ee=o(null),Fe=Ee[0],_e=Ee[1],Me=o(!1),De=Me[0],ke=Me[1],Ae=o(!1),He=Ae[0],Ne=Ae[1],Le=o(!1),Pe=Le[0],Oe=Le[1],je=o(null),ze=je[0],We=je[1],Ye=r(!1),Ke=o(new Set),qe=Ke[0],Ve=Ke[1],Xe=o([]),Je=Xe[0],Ue=Xe[1],Ge=r(null),Qe=r(!1),Ze=r(null),$e=r({}),en=r([]),nn=r(!1),tn=r(!1),on=r(null),rn=r(function(){}),ln=l(function(){return(null==ce?void 0:ce.cognitive_decisioning)||{}},[ce]),cn=o({width:0,height:0}),un=cn[0],dn=cn[1],an=l(function(){return e(e({},T),se)},[se]),sn=r(null),vn=r(null),pn=r(null),fn=r(null),gn=r(null),hn=r(null),xn=r(null),mn=r(null),yn=r(!1),bn=r(null),Sn=r(null),Rn=H(sn),Cn=Rn.cognitivePopup,In=Rn.setCognitivePopup,Tn=Rn.moreFunctions,Bn=Rn.setMoreFunctions,wn=Rn.position,En=Rn.setPosition,Fn=Rn.activeBadgeId,_n=Rn.summaryPopup,Mn=Rn.setSummaryPopup,Dn=Rn.closeSummaryPopup,kn=Rn.setActiveBadgeId,An=Rn.popupRef,Hn=Rn.closeCognitivePopup,Nn=Rn.closeMoreFunctionsPopup,Ln=l(function(){var e,n,t,i,o,r,l;return{fields:null!==(e=null==ue?void 0:ue.fields)&&void 0!==e?e:B,thresholds:{high:null!==(t=null===(n=null==ue?void 0:ue.thresholds)||void 0===n?void 0:n.high)&&void 0!==t?t:w.thresholds.high,medium:null!==(o=null===(i=null==ue?void 0:ue.thresholds)||void 0===i?void 0:i.medium)&&void 0!==o?o:w.thresholds.medium,exact:null!==(l=null===(r=null==ue?void 0:ue.thresholds)||void 0===r?void 0:r.exact)&&void 0!==l?l:w.thresholds.exact}}},[ue]),Pn=o(null),On=Pn[0];Pn[1];var jn=null===(V=null===(K=null==ce?void 0:ce.documents)||void 0===K?void 0:K[null===(q=null==ce?void 0:ce.input_index_map)||void 0===q?void 0:q[0]])||void 0===V?void 0:V.title,zn=null===(U=null===(X=null==ce?void 0:ce.documents)||void 0===X?void 0:X[null===(J=null==ce?void 0:ce.input_index_map)||void 0===J?void 0:J[1]])||void 0===U?void 0:U.title,Wn=m(de||jn||"Uploaded Contract"),Yn=m(ae||zn||"Reference Template"),Kn=A(ce,be,he,Ln),qn=Kn.activeProposed,Vn=Kn.existingRule,Xn=Kn.proposedSections,Jn=Kn.existingSections,Un=Kn.visibleFields,Gn=Kn.parentDeviationRecord,Qn=Kn.deviationNumberRegistry,Zn=Kn.parseError;c(function(){Zn&&_e("Failed to load comparison: ".concat(Zn))},[Zn]);var $n=Xn.length>0||Jn.length>0,et=N(Un.map(function(e){return e.key}),Math.max(Xn.length,Jn.length)),nt=et.leftRefs,tt=et.rightRefs,it=et.sectionLeftRefs,ot=et.sectionRightRefs,rt=et.lhsBadgeRefs,lt=et.rhsBadgeRefs,ct=et.sectionRightRowRefs,ut=et.subSectionLeftRefs,dt=et.subSectionRightRefs,at=et.sectionRowRefs,st=et.getSectionRowRef,vt=et.getSubSectionRef,pt=et.getBadgeRef,ft=Vn.analysis,gt=m(null===(Q=null===(G=null==ft?void 0:ft.rule_difference_comparison)||void 0===G?void 0:G.summary)||void 0===Q?void 0:Q.overall_summary),ht=!!gt.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),xt=null!==(Z=null==ce?void 0:ce.base_root_id)&&void 0!==Z?Z:"-1";null==ce||ce[xt];var mt=(null===($=null==he?void 0:he[xt])||void 0===$?void 0:$.evaluation_result)||(null===(ne=null===(ee=null==ce?void 0:ce.nodes)||void 0===ee?void 0:ee[xt])||void 0===ne?void 0:ne.evaluation_result)||null,yt=y(mt),bt=b(null!==(oe=null===(ie=null===(te=null==mt?void 0:mt.evaluation_outputs)||void 0===te?void 0:te.metadata)||void 0===ie?void 0:ie.label_color)&&void 0!==oe?oe:""),St=u(function(){var e,n,t,i,o,r;ke(!1),tn.current=!1;var l=on.current,c=At.current;if(null!==l)if("string"==typeof l&&l.includes(S)){var u=l.split(S);(d=(null===(e=ut.current[u[2]])||void 0===e?void 0:e.current)||(null===(n=it.current[Number(u[2])])||void 0===n?void 0:n.current))&&(d.style.paddingTop="0px")}else{var d;(d=null===(t=it.current[l])||void 0===t?void 0:t.current)&&(d.style.paddingTop="0px")}if(null!==c)if("string"==typeof c&&c.includes(S)){u=c.split(S);(a=(null===(i=dt.current[u[3]])||void 0===i?void 0:i.current)||(null===(o=ot.current[Number(u[3])])||void 0===o?void 0:o.current))&&(a.style.paddingTop="0px")}else{var a;(a=null===(r=ot.current[c])||void 0===r?void 0:r.current)&&(a.style.paddingTop="0px")}We(null),on.current=null,At.current=null,Ne(!1),we(!1),fn.current&&(fn.current.style.height="0px"),gn.current&&(gn.current.style.height="0px"),hn.current&&(hn.current.style.height="0px"),xn.current&&(xn.current.style.height="0px")},[]),Rt=L({maintainRelativeOrder:!!be,proposedSections:Xn,existingSections:Jn,activeSideBySideSection:ze,connectedSections:qe,resetSideBySide:St,setConnectedSections:Ve,setConnectedLines:Ue,cachedConnectedPositions:en,svgContainerRef:Ge,isAnimatingRef:Qe,animationTimerRef:Ze,calculateLinesRef:rn,sectionLeftRefs:it,sectionRightRefs:ot,subSectionLeftRefs:ut,subSectionRightRefs:dt}),Ct=Rt.expandedSections,It=Rt.expandedSubSections,Tt=Rt.setExpandedSubSections,Bt=Rt.toggleSection,wt=u(function(e,n,t,i,o,r,l){var c,u,d,a=m(null==n?void 0:n.id)||m(null==t?void 0:t.id)||"",s=(a?ln[a]:null)||(null==n?void 0:n.cognitiveData)||(null==t?void 0:t.cognitiveData)||{section_id:a,decisioning:[],gap:[],relevance_score:0},v=null!==(u=null===(c=at.current[i])||void 0===c?void 0:c.current)&&void 0!==u?u:null;return{isLoading:null!==(d=null==pe?void 0:pe.isLoading)&&void 0!==d&&d,open:!0,sectionTitle:(null==n?void 0:n.displayTitle)?null==n?void 0:n.title:"no title",refSectionTitle:(null==t?void 0:t.displayTitle)?null==t?void 0:t.title:"no title",cognitiveData:s,anchorEl:e,sectionAnchorEl:v,badgeStyle:r||null,sectionIdx:i,docData:{documents:null==ce?void 0:ce.documents,input_index_map:null==ce?void 0:ce.input_index_map},deviationData:(null==n?void 0:n.evaluationResult)||(null==t?void 0:t.evaluationResult)||null,isOrphan:!!o}},[ln,ce]),Et=u(function(e){Nn(),En(null),In(e)},[Nn]),Ft=function(e,n,t,i,o,r){var l;if(e.stopPropagation(),Tn.open&&Tn.sectionIdx===o)Nn();else{var c=e.currentTarget,u="left";(null===(l=pn.current)||void 0===l?void 0:l.contains(c))&&(u="right");tn.current&&St(),Ve(new Set),Ue([]),en.current=[],Hn(),_n.open?ii():Dn(),requestAnimationFrame(function(){var e=function(){var e,n,t,i;if("string"==typeof o&&o.includes(S)){var r=o.split(S),l="".concat(r[0]).concat(S).concat(r[1]);return"right"===u?null===(e=lt.current[l])||void 0===e?void 0:e.current:null===(n=rt.current[l])||void 0===n?void 0:n.current}return"right"===u?null===(t=lt.current[o])||void 0===t?void 0:t.current:null===(i=rt.current[o])||void 0===i?void 0:i.current}()||c;Bn(wt(e,n,i,o,t,r))})}},_t=u(function(){null!==Tn.sectionIdx&&Tn.anchorEl?Et(e(e({},Tn),{open:!0})):Nn()},[Tn,Nn,Et]),Mt=u(function(){var e=Tn.sectionIdx,n=Tn.isOrphan;Nn(),Dn(),null!==e&&(n?_e("No counterpart exists to connect to."):(tn.current&&St(),Ue([]),en.current=[],Ve(function(n){return n.has(e)?new Set:new Set([e])}),setTimeout(function(){rn.current&&rn.current()},50)))},[Tn.sectionIdx,Tn.isOrphan,Nn,Dn,St]),Dt=r(null),kt=r(null),At=r(null),Ht=r(null),Nt=r(null),Lt=r(null),Pt=o([]),Ot=Pt[0],jt=Pt[1];r(null);var zt=o(null),Wt=zt[0],Yt=zt[1];c(function(){if(On){var e=Ln.fields.find(function(e){return e.analysisKey===On||e.key===On});if(e){var n=nt.current[e.key]||tt.current[e.key];(null==n?void 0:n.current)&&setTimeout(function(){return n.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[On,Ln.fields]);var Kt=u(function(e){var n,t,i,o,r,l,c,u,d,a=null===(n=null==ft?void 0:ft.rule_difference_comparison)||void 0===n?void 0:n.fields;if(!a||!a[e])return{score:0,relation:"",highlightsA:[],highlightsB:[],hasContent:!1};var s=a[e],v=(null==s?void 0:s.relation)||(null===(i=null===(t=null==s?void 0:s.highlights)||void 0===t?void 0:t.ruleA_spans)||void 0===i?void 0:i.length)||(null===(r=null===(o=null==s?void 0:s.highlights)||void 0===o?void 0:o.ruleB_spans)||void 0===r?void 0:r.length)||(null==s?void 0:s.mappings)&&s.mappings.length>0;if(s.mappings){var p=s.mappings[0]||{};return{score:s.score,relation:p.relation||"",highlightsA:(null===(l=p.highlights)||void 0===l?void 0:l.ruleA_spans)||[],highlightsB:(null===(c=p.highlights)||void 0===c?void 0:c.ruleB_spans)||[],hasContent:!!v}}return{score:s.score,relation:s.relation||"",highlightsA:(null===(u=s.highlights)||void 0===u?void 0:u.ruleA_spans)||[],highlightsB:(null===(d=s.highlights)||void 0===d?void 0:d.ruleB_spans)||[],hasContent:!!v}},[ft]),qt=u(function(n,t){var i,o,r,l,c,u,d;void 0===t&&(t="left");var a=null,s=null;if("left"===t)if(a=Xn[n],be&&a){var v=Jn.filter(function(e){var n;return null===(n=a.refIndexes)||void 0===n?void 0:n.includes(e.selfIndex)});s=v.find(function(e){return e.evaluationResult})||v[0]}else s=Jn[n];else if(s=Jn[n],be&&s){var p=Xn.filter(function(e){var n;return null===(n=e.refIndexes)||void 0===n?void 0:n.includes(s.selfIndex)});a=p.find(function(e){return e.evaluationResult})||p[0]}else a=Xn[n];var f=(null==a?void 0:a.relation)&&"not_defined"!==a.relation,g=(null==s?void 0:s.relation)&&"not_defined"!==s.relation,h=!(!(null==a?void 0:a.cognitiveData)&&!(null==s?void 0:s.cognitiveData));if(!f&&!g&&!h)return e(e({},b(E)),{label:"Not Defined"});var x=null!==(o=null!==(i=null==a?void 0:a.evaluationResult)&&void 0!==i?i:null==s?void 0:s.evaluationResult)&&void 0!==o?o:null,m=null===(r=null==x?void 0:x.evaluation_outputs)||void 0===r?void 0:r.output_value,y=null!==(u=null===(c=null===(l=null==x?void 0:x.evaluation_outputs)||void 0===l?void 0:l.metadata)||void 0===c?void 0:c.label_color)&&void 0!==u?u:E;return e(e({},b(y)),null!=x?{label:null!==(d=m)&&void 0!==d?d:""}:{label:null})},[Xn,Jn,ln,Ln,be]),Vt=u(function(n){for(var t,i,o,r,l,c,u,d,a,s=n.split("-").map(Number),v=Xn[s[0]],p=Jn[s[0]],f=1;f<s.length;f++)(null==v?void 0:v.subsections)&&(v=v.subsections[s[f]]),(null==p?void 0:p.subsections)&&(p=p.subsections[s[f]]);if(!v&&!p)return null;var g=(null==v?void 0:v.relation)&&"not_defined"!==v.relation,h=(null==p?void 0:p.relation)&&"not_defined"!==p.relation,x=m(null==v?void 0:v.id)||m(null==p?void 0:p.id)||"",y=!(!(null==v?void 0:v.cognitiveData)&&!(null==p?void 0:p.cognitiveData));if(!g&&!h&&!y)return e(e({},b(E)),{label:"Not Defined"});null!==(i=null!==(t=null==v?void 0:v.cognitiveRelevanceScore)&&void 0!==t?t:null==p?void 0:p.cognitiveRelevanceScore)&&void 0!==i||x&&(null===(o=ln[x])||void 0===o||o.relevance_score);var S=null!==(l=null!==(r=null==v?void 0:v.evaluationResult)&&void 0!==r?r:null==p?void 0:p.evaluationResult)&&void 0!==l?l:null,R=null===(c=null==S?void 0:S.evaluation_outputs)||void 0===c?void 0:c.output_value,C=null!==(a=null===(d=null===(u=null==S?void 0:S.evaluation_outputs)||void 0===u?void 0:u.metadata)||void 0===d?void 0:d.label_color)&&void 0!==a?a:E;return e(e({},b(C)),null!=S?{label:null!=R?R:""}:{label:null})},[Xn,Jn,ln,Ln]),Xt=u(function(){var e,n,t,i,o,r,l,c,u,d,a,s,v,p,f,g,h,x,m,y,b,I;if(!yn.current&&!Qe.current){yn.current=!0;try{if(!Dt.current)return;var T=function(e){var n=e.split("-"),t=n[0];if(!Ct[t]&&!1===be)return!1;if(be&&!Ct["left-".concat(t)]&&!Ct["right-".concat(t)]&&!Ct[t])return!1;for(var i=t,o=1;o<n.length-1;o++)if(i+="-".concat(n[o]),!It[i])return!1;return!0},B=Dt.current.getBoundingClientRect();dn({width:B.width,height:B.height});var w=[];if(Un.forEach(function(e){var n,t,i=e.key,o=null===(n=nt.current[i])||void 0===n?void 0:n.current,r=null===(t=tt.current[i])||void 0===t?void 0:t.current;o&&r&&(o.style.height="auto",r.style.height="auto",o.style.minHeight="0px",r.style.minHeight="0px")}),!Qe.current){for(var E=0;E<Math.max(Xn.length,Jn.length);E++){var F=null===(e=it.current[E])||void 0===e?void 0:e.current,_=null===(n=ot.current[E])||void 0===n?void 0:n.current;F&&(F.style.height="auto",F.style.minHeight="0px"),_&&(_.style.height="auto",_.style.minHeight="0px")}be||Object.keys(ut.current).forEach(function(e){var n,t;if(T(e)){var i=null===(n=ut.current[e])||void 0===n?void 0:n.current,o=null===(t=dt.current[e])||void 0===t?void 0:t.current;i&&o&&(i.style.height="auto",o.style.height="auto",i.style.minHeight="0px",o.style.minHeight="0px")}})}var M={};Un.forEach(function(e){var n,t,i=e.key,o=null===(n=nt.current[i])||void 0===n?void 0:n.current,r=null===(t=tt.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=o.getBoundingClientRect(),c=r.getBoundingClientRect();M[i]=Math.max(l.height,c.height)}});var D={left:{},right:{}},k={};if(!Qe.current)if(be){if(De&&null!==ze)if("number"==typeof ze){var A=ze,H=Xn[A],N=null===(o=it.current[A])||void 0===o?void 0:o.current;N&&H&&(H.refIndexes||[]).forEach(function(e){var n,t=Jn.findIndex(function(n){return n.selfIndex===e}),i=null===(n=ot.current[t])||void 0===n?void 0:n.current;if(i&&(Ct["left-".concat(A)]||Ct["right-".concat(t)])){var o=Math.max(N.getBoundingClientRect().height,i.getBoundingClientRect().height);D.left[A]=Math.max(D.left[A]||0,o),D.right[t]=Math.max(D.right[t]||0,o)}})}else{var L=ze.split(S)[2];if(L){F=null===(r=ut.current[L])||void 0===r?void 0:r.current,_=null===(l=dt.current[L])||void 0===l?void 0:l.current;if(F&&_){P=Math.max(F.getBoundingClientRect().height,_.getBoundingClientRect().height);k[L]=Math.max(k[L]||0,P)}}}}else{Object.keys(ut.current).forEach(function(e){var n,t;if(T(e)){var i=null===(n=ut.current[e])||void 0===n?void 0:n.current,o=null===(t=dt.current[e])||void 0===t?void 0:t.current;if(i&&o&&null!==i.offsetParent&&null!==o.offsetParent){var r=i.getBoundingClientRect(),l=o.getBoundingClientRect(),c=Math.max(r.height,l.height);k[e]=c,i.style.minHeight="".concat(c,"px"),o.style.minHeight="".concat(c,"px")}}});for(E=0;E<Math.min(Xn.length,Jn.length);E++){var F=null===(t=it.current[E])||void 0===t?void 0:t.current,_=null===(i=ot.current[E])||void 0===i?void 0:i.current;if(F&&_){var P=Math.max(F.getBoundingClientRect().height,_.getBoundingClientRect().height);D.left[E]=P,D.right[E]=P}}}if(Un.forEach(function(e){var n,t,i=e.key,o=null===(n=nt.current[i])||void 0===n?void 0:n.current,r=null===(t=tt.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=M[i];o.style.minHeight="".concat(l,"px"),r.style.minHeight="".concat(l,"px")}}),Qe.current||(Object.entries(D.left).forEach(function(e){var n,t=e[0],i=e[1],o=null===(n=it.current[Number(t)])||void 0===n?void 0:n.current;o&&(o.style.minHeight="".concat(i,"px"))}),Object.entries(D.right).forEach(function(e){var n,t=e[0],i=e[1],o=null===(n=ot.current[Number(t)])||void 0===n?void 0:n.current;o&&(o.style.minHeight="".concat(i,"px"))}),be||Object.keys(k).forEach(function(e){var n,t,i=null===(n=ut.current[e])||void 0===n?void 0:n.current,o=null===(t=dt.current[e])||void 0===t?void 0:t.current;if(i&&o&&k[e]){var r=k[e];i.style.minHeight="".concat(r,"px"),o.style.minHeight="".concat(r,"px")}})),be)Xn.forEach(function(e,n){var t;(null===(t=it.current[n])||void 0===t?void 0:t.current)&&(e.refIndexes||[]).forEach(function(e){var t,i,o,r,l,c,u,d,a,s,v=Jn.findIndex(function(n){return n.selfIndex===e});if(-1!==v){var p=null===(t=rt.current[n])||void 0===t?void 0:t.current,f=null===(i=lt.current[v])||void 0===i?void 0:i.current;if(p&&f){var g=p.getBoundingClientRect(),h=f.getBoundingClientRect(),x=g.right-B.left,m=h.left-B.left,y=g.top+g.height/2-B.top,b=h.top+h.height/2-B.top;if(De&&ze===n){var S=null!==(r=null===(o=mn.current)||void 0===o?void 0:o.getBoundingClientRect().top)&&void 0!==r?r:0,R=null!==(c=null===(l=pn.current)||void 0===l?void 0:l.getBoundingClientRect().top)&&void 0!==c?c:0,C=S+(null!==(d=null===(u=mn.current)||void 0===u?void 0:u.clientHeight)&&void 0!==d?d:1/0),I=R+(null!==(s=null===(a=pn.current)||void 0===a?void 0:a.clientHeight)&&void 0!==s?s:1/0),T=g.top+g.height/2,E=h.top+h.height/2,F=function(e,n,t){return Math.max(n,Math.min(t,e))};y=F(T,S,C)-B.top,b=F(E,R,I)-B.top}var _=qt(n);_&&w.push({id:"line-".concat(n,"-").concat(v),x1:x,y1:y,x2:m,y2:b,style:_,sectionIdx:n,targetRightIdx:v})}}})});else{for(E=0;E<Math.min(Xn.length,Jn.length);E++){var O=null===(c=it.current[E])||void 0===c?void 0:c.current,j=null===(u=ot.current[E])||void 0===u?void 0:u.current;if(O&&j){var z=O.getBoundingClientRect(),W=j.getBoundingClientRect(),Y=Math.max(z.top,W.top)+18-B.top,K=(null===(d=Jn[E])||void 0===d?void 0:d.id)||"sec-".concat(E);(Z=qt(E))&&w.push({id:K,x1:z.right-B.left,y1:Y,x2:W.left-B.left,y2:Y,style:Z,sectionIdx:E,hasCognitive:!!((null===(a=Xn[E])||void 0===a?void 0:a.cognitiveData)||(null===(s=Jn[E])||void 0===s?void 0:s.cognitiveData)||K&&ln[K]),isSubSection:!1})}}Object.keys(ut.current).forEach(function(e){var n,t,i,o,r,l;if(T(e)){var c=null===(n=ut.current[e])||void 0===n?void 0:n.current,u=null===(t=dt.current[e])||void 0===t?void 0:t.current;if(c&&u){for(var d=e.split("-").map(Number),a=Xn[d[0]],s=Jn[d[0]],v=1;v<d.length;v++)(null==a?void 0:a.subsections)&&(a=a.subsections[d[v]]),(null==s?void 0:s.subsections)&&(s=s.subsections[d[v]]);var p=!!a&&((null===(i=a.displayTitle)||void 0===i||i)&&R(a.title)),f=!!a&&((null===(o=a.displayContent)||void 0===o||o)&&R(a.content)),g=!!s&&((null===(r=s.displayTitle)||void 0===r||r)&&R(s.title)),h=!!s&&((null===(l=s.displayContent)||void 0===l||l)&&R(s.content));if(p&&f||g&&h){var x=c.getBoundingClientRect(),m=u.getBoundingClientRect(),y=Math.max(x.top,m.top)+16-B.top,b=Vt(e);b&&"Not Defined"!==b.label&&w.push({id:"subsec-".concat(e),x1:x.right-B.left,y1:y,x2:m.left-B.left,y2:y,style:b,sectionIdx:d[0],isSubSection:!0,subSectionKeyPath:e,hasCognitive:!(!(null==a?void 0:a.cognitiveData)&&!(null==s?void 0:s.cognitiveData))})}}}})}if(De&&"string"==typeof ze&&ze.includes(S)){var q=ze.split(S),V=q[0],X=q[1],J=q[2],U=(q[3],"".concat(V).concat(S).concat(X)),G=null===(v=rt.current[U])||void 0===v?void 0:v.current,Q=null===(p=lt.current[U])||void 0===p?void 0:p.current;if(G&&Q){var Z,$=G.getBoundingClientRect(),ee=Q.getBoundingClientRect(),ne=$.right-B.left,te=ee.left-B.left,ie=$.top+$.height/2-B.top,oe=ee.top+ee.height/2-B.top;if(be){var re=null!==(g=null===(f=mn.current)||void 0===f?void 0:f.getBoundingClientRect().top)&&void 0!==g?g:0,le=null!==(x=null===(h=pn.current)||void 0===h?void 0:h.getBoundingClientRect().top)&&void 0!==x?x:0,ce=re+(null!==(y=null===(m=mn.current)||void 0===m?void 0:m.clientHeight)&&void 0!==y?y:1/0),ue=le+(null!==(I=null===(b=pn.current)||void 0===b?void 0:b.clientHeight)&&void 0!==I?I:1/0),de=function(e,n,t){return Math.max(n,Math.min(t,e))};ie=de($.top+$.height/2,re,ce)-B.top,oe=de(ee.top+ee.height/2,le,ue)-B.top}(Z=Vt(J))&&w.push({id:"line-subsec-".concat(U),x1:ne,y1:ie,x2:te,y2:oe,style:Z,sectionIdx:Number(J.split("-")[0]),isSubSection:!0,subSectionKeyPath:ze})}}if(jt(w),Nt.current&&Lt.current){var ae=Nt.current.getBoundingClientRect(),se=Lt.current.getBoundingClientRect(),ve=(ae.top+ae.height/2-B.top+se.top+se.height/2-B.top)/2;Yt({x1:ae.right-B.left,x2:se.left-B.left,y:ve})}else Yt(null);if(qe.size>0){var pe=[],fe=mn.current,ge=pn.current;if(fe&&ge){var he=[],xe=fe.getBoundingClientRect().top,me=ge.getBoundingClientRect().top,ye=xe+fe.clientHeight,Se=me+ge.clientHeight,Re=fe.scrollTop,Ce=ge.scrollTop,Ie=B.top,Te=function(e,n,t){return Math.max(n,Math.min(t,e))};qe.forEach(function(e){var n,t,i,o,r;if("string"==typeof e&&e.includes(S)){var l=e.split(S),c=l[0],u=l[1],d=l[2],a=(l[3],"".concat(c).concat(S).concat(u)),s=null===(n=rt.current[a])||void 0===n?void 0:n.current,v=null===(t=lt.current[a])||void 0===t?void 0:t.current;if(!s||!v)return;var p=s.getBoundingClientRect(),f=v.getBoundingClientRect(),g=Vt(d),h=(H=p.right-B.left)+.5*((N=f.left-B.left-0)-H),x=p.top+p.height/2,m=f.top+f.height/2,y=x-xe+Re,b=m-me+Ce,R="conn-subsec-".concat(a);he.push({lhsScrollY:y,rhsScrollY:b,x1:H,x2:N,containerTop:Ie,leftIdx:e,rhsArrayIdx:e,styleColor:(null==g?void 0:g.badgeBorder)||"#6366F1",styleId:R});var I=Te(x,xe,ye),T=Te(m,me,Se),w=I-Ie,E=T-Ie,F=m>=me-4&&m<=Se+4,_="";_=(L=x>=xe-4&&x<=ye+4)&&F?C(H,w,N,E):L&&!F?"M ".concat(H,",").concat(w," L ").concat(h,",").concat(w," L ").concat(h,",").concat(E):!L&&F?"M ".concat(h,",").concat(w," L ").concat(h,",").concat(E," L ").concat(N,",").concat(E):"M ".concat(h,",").concat(w," L ").concat(h,",").concat(E),pe.push({id:R,pathD:_,style:g,leftIdx:e,rhsArrayIdx:e})}else if(be){var M=e,D=Xn[M];if(!(null===(r=null==D?void 0:D.refIndexes)||void 0===r?void 0:r.length))return;D.refIndexes.forEach(function(e){var n,t,i=Jn.findIndex(function(n){return n.selfIndex===e});if(-1!==i){var o=null===(n=rt.current[M])||void 0===n?void 0:n.current,r=null===(t=lt.current[i])||void 0===t?void 0:t.current;if(o&&r){var l=o.getBoundingClientRect(),c=r.getBoundingClientRect(),u=qt(M),d=l.right-B.left,a=c.left-B.left-0,s=d+.5*(a-d),v=l.top+l.height/2,p=c.top+c.height/2,f=v-xe+Re,g=p-me+Ce,h="conn-".concat(M,"-").concat(i);he.push({lhsScrollY:f,rhsScrollY:g,x1:d,x2:a,containerTop:Ie,leftIdx:M,rhsArrayIdx:i,styleColor:(null==u?void 0:u.badgeBorder)||"#6366F1",styleId:h});var x=Te(v,xe,ye),m=Te(p,me,Se),y=x-Ie,b=m-Ie,S=v>=xe-4&&v<=ye+4,R=p>=me-4&&p<=Se+4,I="";I=S&&R?C(d,y,a,b):S&&!R?"M ".concat(d,",").concat(y," L ").concat(s,",").concat(y," L ").concat(s,",").concat(b):!S&&R?"M ".concat(s,",").concat(y," L ").concat(s,",").concat(b," L ").concat(a,",").concat(b):"M ".concat(s,",").concat(y," L ").concat(s,",").concat(b),pe.push({id:h,pathD:I,style:u,leftIdx:M,rhsArrayIdx:i})}}})}else{var k=e,A=k;s=null===(i=rt.current[k])||void 0===i?void 0:i.current,v=null===(o=lt.current[A])||void 0===o?void 0:o.current;if(!s||!v)return;var H,N;p=s.getBoundingClientRect(),f=v.getBoundingClientRect(),g=qt(k),h=(H=p.right-B.left)+.5*((N=f.left-B.left-0)-H),x=p.top+p.height/2,m=f.top+f.height/2,y=x-xe+Re,b=m-me+Ce,R="conn-".concat(k,"-").concat(A);he.push({lhsScrollY:y,rhsScrollY:b,x1:H,x2:N,containerTop:Ie,leftIdx:k,rhsArrayIdx:A,styleColor:(null==g?void 0:g.badgeBorder)||"#6366F1",styleId:R});var L;I=Te(x,xe,ye),T=Te(m,me,Se),w=I-Ie,E=T-Ie,F=m>=me-4&&m<=Se+4,_="";_=(L=x>=xe-4&&x<=ye+4)&&F?C(H,w,N,E):L&&!F?"M ".concat(H,",").concat(w," L ").concat(h,",").concat(w," L ").concat(h,",").concat(E):!L&&F?"M ".concat(h,",").concat(w," L ").concat(h,",").concat(E," L ").concat(N,",").concat(E):"M ".concat(h,",").concat(w," L ").concat(h,",").concat(E),pe.push({id:R,pathD:_,style:g,leftIdx:k,rhsArrayIdx:A})}}),en.current=he}Ue(pe)}else Ue([]),en.current=[]}catch(e){console.error("Line render safe fail: ",e)}finally{yn.current=!1}}},[Un,Xn,Jn,ln,Ln,Kt,qt,be,De,ze,qe,Ct,It]),Jt=u(function(){var e,n,t,i,o,r,l,c,u,d,a,s,v,p,f=en.current;if(f.length&&!Qe.current){var g=null!==(n=null===(e=mn.current)||void 0===e?void 0:e.scrollTop)&&void 0!==n?n:0,h=null!==(i=null===(t=pn.current)||void 0===t?void 0:t.scrollTop)&&void 0!==i?i:0,x=null!==(r=null===(o=mn.current)||void 0===o?void 0:o.clientHeight)&&void 0!==r?r:1/0,m=null!==(c=null===(l=pn.current)||void 0===l?void 0:l.clientHeight)&&void 0!==c?c:1/0,y=null!==(d=null===(u=mn.current)||void 0===u?void 0:u.getBoundingClientRect().top)&&void 0!==d?d:0,b=null!==(s=null===(a=pn.current)||void 0===a?void 0:a.getBoundingClientRect().top)&&void 0!==s?s:0,S=y+x,R=b+m,I=null!==(p=null===(v=Dt.current)||void 0===v?void 0:v.getBoundingClientRect().top)&&void 0!==p?p:0,T=function(e,n,t){return Math.max(n,Math.min(t,e))};f.forEach(function(e){var n=e.lhsScrollY-g+y,t=e.rhsScrollY-h+b,i=$e.current[e.styleId+"-stroke"],o=$e.current[e.styleId+"-bg"];if(i||o){var r,l=T(n,y,S),c=T(t,b,R),u=l-I,d=c-I,a=n>=y-4&&n<=S+4,s=t>=b-4&&t<=R+4,v=e.x1+.5*(e.x2-e.x1);r=a&&s?C(e.x1,u,e.x2,d):a&&!s?"M ".concat(e.x1,",").concat(u," L ").concat(v,",").concat(u," L ").concat(v,",").concat(d):!a&&s?"M ".concat(v,",").concat(u," L ").concat(v,",").concat(d," L ").concat(e.x2,",").concat(d):"M ".concat(v,",").concat(u," L ").concat(v,",").concat(d),i&&(i.setAttribute("visibility","visible"),i.setAttribute("d",r)),o&&(o.setAttribute("visibility","visible"),o.setAttribute("d",r))}})}},[]);c(function(){rn.current=Xt},[Xt]);var Ut=r(null),Gt=r(null),Qt=u(function(){en.current.length>0&&!Qe.current||(null!==Ut.current&&clearTimeout(Ut.current),Ut.current=setTimeout(function(){rn.current(),Ut.current=null},50))},[]),Zt=u(function(){Oe(!0),Ne(!1),null!==Gt.current&&clearTimeout(Gt.current),null!==Ut.current&&(clearTimeout(Ut.current),Ut.current=null),Gt.current=setTimeout(function(){var e,n,t,i,o,r,l,c,u,d;if(en.current=[],tn.current&&null!==on.current&&null!==At.current){var a=on.current,s=At.current,v=null,p=null,f=null,g=null;if("string"==typeof a&&a.includes(S)){var h=a.split(S),x="".concat(h[0]).concat(S).concat(h[1]);v=(null===(e=rt.current[x])||void 0===e?void 0:e.current)||null,p=(null===(n=lt.current[x])||void 0===n?void 0:n.current)||null,f=(null===(t=ut.current[h[2]])||void 0===t?void 0:t.current)||(null===(i=it.current[Number(h[2])])||void 0===i?void 0:i.current)||null,g=(null===(o=dt.current[h[3]])||void 0===o?void 0:o.current)||(null===(r=ot.current[Number(h[3])])||void 0===r?void 0:r.current)||null}else v=(null===(l=at.current[a])||void 0===l?void 0:l.current)||null,f=(null===(c=it.current[a])||void 0===c?void 0:c.current)||null,p=(null===(u=ct.current[s])||void 0===u?void 0:u.current)||null,g=(null===(d=ot.current[s])||void 0===d?void 0:d.current)||null;if(v&&p&&f&&g){if(f.style.paddingTop="0px",g.style.paddingTop="0px",!be){var m=v.getBoundingClientRect(),y=p.getBoundingClientRect(),b=m.top-y.top;b>0?g.style.paddingTop="".concat(b,"px"):b<0&&(f.style.paddingTop="".concat(Math.abs(b),"px"))}var R=mn.current,C=pn.current;if(R&&C){var I=v.getBoundingClientRect().top-R.getBoundingClientRect().top+R.scrollTop,T=p.getBoundingClientRect().top-C.getBoundingClientRect().top+C.scrollTop-(I-R.scrollTop);Math.abs(C.scrollTop-T)>1&&(C.scrollTop=T)}}}rn.current(),tn.current&&Ne(!0),Oe(!1),Gt.current=null},150)},[be,Xn,Jn]),$t=u(function(e){var n,t,i,o,r,l,c,u,d,a;if(null!==bn.current&&Sn.current&&Math.abs(e.currentTarget.scrollTop-bn.current)<=2){var s=Sn.current;bn.current=null,Sn.current=null,s()}if(!Ye.current){if(be||Qt(),tn.current){var v=on.current,p=At.current,f=mn.current,g=pn.current;if(null!==v&&null!==p&&f&&g){var h="string"==typeof v&&v.includes(S)?null===(n=rt.current["".concat(v.split(S)[0]).concat(S).concat(v.split(S)[1])])||void 0===n?void 0:n.current:null===(t=at.current[v])||void 0===t?void 0:t.current,x="string"==typeof p&&p.includes(S)?null===(i=lt.current["".concat(p.split(S)[0]).concat(S).concat(p.split(S)[1])])||void 0===i?void 0:i.current:null===(o=ct.current[p])||void 0===o?void 0:o.current;if(h&&x&&Ht.current){var m=void 0,y=void 0;if("string"==typeof v&&v.includes(S)){var b=v.split(S),R="".concat(b[0]).concat(S).concat(b[1]);m=null===(r=rt.current[R])||void 0===r?void 0:r.current,y=null===(l=lt.current[R])||void 0===l?void 0:l.current}else m=null===(c=rt.current[v])||void 0===c?void 0:c.current,y=null===(u=lt.current[p])||void 0===u?void 0:u.current;var C=null!==(a=null===(d=Dt.current)||void 0===d?void 0:d.getBoundingClientRect().top)&&void 0!==a?a:0,I=f.getBoundingClientRect().top,T=I+f.clientHeight;g.getBoundingClientRect().top;g.clientHeight;if(m&&y){var B=m.getBoundingClientRect(),w=y.getBoundingClientRect(),E=B.top+B.height/2;w.top,w.height;var F=((M=E,D=I,k=T,Math.max(D,Math.min(k,M)))-C).toString();Ht.current.setAttribute("y1",F),Ht.current.setAttribute("y2",F);var _=E>=I-4&&E<=T+4;Ht.current.setAttribute("visibility",_?"visible":"hidden")}}}}var M,D,k;en.current.length>0&&!nn.current&&(nn.current=!0,requestAnimationFrame(function(){Jt(),nn.current=!1}))}},[Jt,be,Qt]);c(function(){var e=setTimeout(Qt,250);window.addEventListener("resize",Zt);var n=null,t=null;return sn.current&&(n=new ResizeObserver(Qt)).observe(sn.current),Dt.current&&(t=new ResizeObserver(Qt)).observe(Dt.current),function(){clearTimeout(e),null!==Ut.current&&clearTimeout(Ut.current),null!==Gt.current&&clearTimeout(Gt.current),window.removeEventListener("resize",Zt),null==n||n.disconnect(),null==t||t.disconnect()}},[qn,Vn,ft,Un,Ct,It,Xn,Jn,Ln,Qt,Zt,De,ze,He,qe]),c(function(){tn.current=De},[De]),c(function(){on.current=ze},[ze]);var ei=u(function(e,n,t){var i,o,r=null===(i=null==t?void 0:t.toggleIfSame)||void 0===i||i,l=null==t?void 0:t.onReady,c=null!==(o=null==t?void 0:t.sourceSide)&&void 0!==o?o:"left";Nn(),null!=e&&(n?_e("No counterpart exists for this section."):De&&ze===e?r?St():null==l||l():(Ve(new Set([e])),Ue([]),en.current=[],we(!0),Ye.current=!0,We(e),on.current=e,ke(!0),tn.current=!0,Ne(!1),fn.current&&(fn.current.style.height="0px"),gn.current&&(gn.current.style.height="0px"),hn.current&&(hn.current.style.height="0px"),xn.current&&(xn.current.style.height="0px"),requestAnimationFrame(function(){var n,t,i,o,r,u="string"==typeof e&&e.includes(S),d=null,a=null,s=null;if(u){var v=e.split(S),p="".concat(v[0]).concat(S).concat(v[1]);d=(null===(n=rt.current[p])||void 0===n?void 0:n.current)||null,a=(null===(t=lt.current[p])||void 0===t?void 0:t.current)||null,s=a?e:null}else if(d=(null===(i=at.current[e])||void 0===i?void 0:i.current)||null,be){var f=Xn[e],g=(null==f?void 0:f.refIndexes)||[];if(g.length>0){var h=g[0],x=Jn.findIndex(function(e){return e.selfIndex===h});-1!==x&&(a=(null===(r=ct.current[x])||void 0===r?void 0:r.current)||null,s=x)}}else a=(null===(o=ct.current[e])||void 0===o?void 0:o.current)||null,s=a?e:null;At.current=s;var m=mn.current,y=pn.current,b=function(){!function(){var n,t,i,o,r,l,c,d,a,v,p,f,g=null,h=null,x=null,m=null;if(u){var y=e.split(S),b="".concat(y[0]).concat(S).concat(y[1]);g=(null===(n=ut.current[y[2]])||void 0===n?void 0:n.current)||(null===(t=it.current[Number(y[2])])||void 0===t?void 0:t.current)||null,h=(null===(i=dt.current[y[3]])||void 0===i?void 0:i.current)||(null===(o=ot.current[Number(y[3])])||void 0===o?void 0:o.current)||null,x=(null===(r=rt.current[b])||void 0===r?void 0:r.current)||g,m=(null===(l=lt.current[b])||void 0===l?void 0:l.current)||h}else{var R=Number(e),C=null!==s?Number(s):R;g=(null===(c=it.current[R])||void 0===c?void 0:c.current)||null,h=(null===(d=ot.current[C])||void 0===d?void 0:d.current)||null,x=(null===(a=rt.current[R])||void 0===a?void 0:a.current)||(null===(v=at.current[R])||void 0===v?void 0:v.current)||g,m=(null===(p=lt.current[C])||void 0===p?void 0:p.current)||(null===(f=ct.current[C])||void 0===f?void 0:f.current)||h}if(x&&m&&g&&h){g.style.paddingTop="0px",h.style.paddingTop="0px";var I=x.getBoundingClientRect(),T=m.getBoundingClientRect(),B=I.top-T.top;B>0?h.style.paddingTop="".concat(B,"px"):B<0&&(g.style.paddingTop="".concat(Math.abs(B),"px"))}}(),Ne(!0),rn.current&&rn.current(),Ye.current=!1,"right"===c&&y?y.dispatchEvent(new Event("scroll")):m&&m.dispatchEvent(new Event("scroll")),we(!1),null==l||l()};if(!d||!m)return Ye.current=!1,we(!1),void(null==l||l());if(a&&y){if(!be){var R=0;R="right"===c?a?a.getBoundingClientRect().top:0:d?d.getBoundingClientRect().top:0;var C=sn.current,T=(null==C?void 0:C.getBoundingClientRect().top)||0,B=C?C.scrollTop+R-T-150:0;return C?void I(C,B,200,b):void b()}var w=d.getBoundingClientRect().top-m.getBoundingClientRect().top+m.scrollTop,E=a.getBoundingClientRect().top-y.getBoundingClientRect().top+y.scrollTop,F=200;if("left"===c){var _=E-(w-m.scrollTop);_<0&&fn.current&&(fn.current.style.height="".concat(Math.abs(_),"px")),requestAnimationFrame(function(){var e,n=y.scrollHeight-y.clientHeight;if(_<0)e=0;else{if(_>n){var t=_-n;return gn.current&&(gn.current.style.height="".concat(t+150,"px")),void requestAnimationFrame(function(){I(y,_,F,b)})}e=_}I(y,e,F,b)})}else{var M=w-(E-y.scrollTop);M<0&&hn.current&&(hn.current.style.height="".concat(Math.abs(M),"px")),requestAnimationFrame(function(){var e,n=m.scrollHeight-m.clientHeight;if(M<0)e=0;else{if(M>n){var t=M-n;return xn.current&&(xn.current.style.height="".concat(t+150,"px")),void requestAnimationFrame(function(){I(m,M,F,b)})}e=M}I(m,e,F,b)})}}else b()})))},[ze,Nn,Jn,De,be,Xn,St]),ni=u(function(e,n,t,i){var o,r="string"==typeof i?m(i).trim():m(null==i?void 0:i.deviation_summary).trim(),l=e.currentTarget;Hn();var c="left";(null===(o=pn.current)||void 0===o?void 0:o.contains(l))&&(c="right");var u=function(){var e,t,i,o;if("string"==typeof n&&n.includes(S)){var r=n.split(S),l="".concat(r[0]).concat(S).concat(r[1]);return"right"===c?null===(e=lt.current[l])||void 0===e?void 0:e.current:null===(t=rt.current[l])||void 0===t?void 0:t.current}return"right"===c?null===(i=lt.current[n])||void 0===i?void 0:i.current:null===(o=rt.current[n])||void 0===o?void 0:o.current};if(t)return St(),Ve(new Set),Ue([]),en.current=[],void(r&&requestAnimationFrame(function(){var e=u()||l;Mn({open:!0,anchorEl:e,summary:i})}));ei(n,t,r?{toggleIfSame:!1,sourceSide:c,onReady:function(){var e=u()||l;Mn({open:!0,anchorEl:e,summary:i})}}:{toggleIfSame:!1,sourceSide:c})},[ei,Hn,Mn,St]),ti=u(function(){var e,n=Tn.sectionIdx,t=Tn.isOrphan;if(Dn(),null!=n){var i="left";Tn.anchorEl&&(null===(e=pn.current)||void 0===e?void 0:e.contains(Tn.anchorEl))&&(i="right"),ei(n,t,{sourceSide:i})}},[ei,Tn.isOrphan,Tn.sectionIdx,Tn.anchorEl,Dn]),ii=u(function(){Dn(),St(),Ve(new Set),Ue([]),en.current=[]},[Dn,St]),oi=null!==Tn.sectionIdx&&qe.has(Tn.sectionIdx),ri=P({proposedSections:Xn,existingSections:Jn,parentDeviationRecord:Gn,expandedSections:Ct,maintainRelativeOrder:!!be,scrollContainerRef:sn,leftContainerRef:mn,lhsBadgeRefs:rt,rhsBadgeRefs:lt}),li=ri.showDeviationNavigation,ci=ri.showOpenNodeRef,ui=l(function(){if(!xe)return null;for(var e in Gn){if((Gn[e]||[]).some(function(e){return e.id===xe}))return e}return null},[xe,Gn]),di=r(null),ai=r(null);c(function(){if(xe&&di.current!==xe){ai.current!==xe&&(Dn(),Hn(),St(),Ve(new Set),Ue([]),en.current=[],ai.current=xe);var e=!1,t=0,i=null,o=150,r=function(e,n){for(var t=function(e,i){if(!e)return null;if(e.id===n)return i;if(!Array.isArray(e.subsections))return null;for(var o=0;o<e.subsections.length;o++){var r=t(e.subsections[o],"".concat(i,"-").concat(o));if(r)return r}return null},i=0;i<e.length;i++){var o=t(e[i],String(i));if(o)return o}return null},l=function(){var c,u,d,a;if(!e){var s=null,v=null;for(var p in Gn){var f=Gn[p].find(function(e){return e.id===xe});if(f){s=p,v=f;break}}if(v&&s){var g=Xn.findIndex(function(e){return e.id===s}),h=Jn.findIndex(function(e){return e.id===s}),x=-1===g&&-1!==h;if(x){if(!(be?!!Ct["right-".concat(h)]:!!Ct[String(h)]))return Bt(h,"right"),t+=1,void(i=setTimeout(l,450))}else if(!(be?!!Ct["left-".concat(g)]:!!Ct[String(g)])&&g>=0)return Bt(g,"left"),t+=1,void(i=setTimeout(l,450));var m=r(Xn,v.id),y=r(Jn,v.id);if(m&&!y&&!x){var b=m.split("-"),R=Number(b[0]);if(be){var C=null===(u=null===(c=Xn[R])||void 0===c?void 0:c.refIndexes)||void 0===u?void 0:u[0],I=Jn.findIndex(function(e){return e.selfIndex===C});-1!==I&&(R=I)}y=n([R],b.slice(1),!0).join("-")}if(m||y){var T,B=m||"",w=y||"",E="".concat(v.id).concat(S,"0").concat(S).concat(B).concat(S).concat(w),F="".concat(v.id).concat(S,"0"),_=null===(d=rt.current[F])||void 0===d?void 0:d.current,M=null===(a=lt.current[F])||void 0===a?void 0:a.current,D=x?M:_;if(T=be?x?pn.current:mn.current:sn.current,D&&T){var k=D.getBoundingClientRect();if(0===k.height)return void((t+=1)<20&&(i=setTimeout(l,o)));var A=T.getBoundingClientRect(),H=k.top-A.top+T.scrollTop-A.height/2+k.height/2,N=function(){var n,t,i,o,r;if(!e){di.current=xe;var l=window.getComputedStyle(D).color;_&&(_.style.transition="box-shadow 300ms ease-in-out",_.style.boxShadow="0 0 10px ".concat(l)),M&&(M.style.transition="box-shadow 300ms ease-in-out",M.style.boxShadow="0 0 10px ".concat(l)),setTimeout(function(){_&&(_.style.boxShadow=""),M&&(M.style.boxShadow="")},2e3);var c=(null===(t=null===(n=v.evaluationResult)||void 0===n?void 0:n.deviations)||void 0===t?void 0:t[0])||v,u=(null===(i=v.evaluationResult)||void 0===i?void 0:i.evaluation_outputs)||v.evaluation_outputs;if(!(_&&M&&!x)){var d=x?(null===(o=lt.current[F])||void 0===o?void 0:o.current)||M:(null===(r=rt.current[F])||void 0===r?void 0:r.current)||_;return Mn({open:!0,anchorEl:d,summary:{deviation_summary:c.deviation_summary||c,evaluation_outputs:u}}),void(null==me||me())}ei(E,!1,{toggleIfSame:!1,sourceSide:"left",onReady:function(){var e,n=(null===(e=rt.current[F])||void 0===e?void 0:e.current)||_;Mn({open:!0,anchorEl:n,summary:{deviation_summary:c.deviation_summary||c,evaluation_outputs:u}})}})}};Math.abs(T.scrollTop-H)<=2?N():(bn.current=H,Sn.current=N,T.scrollTo({top:H,behavior:"smooth"}),i&&clearTimeout(i),i=setTimeout(function(){if(Sn.current){bn.current=null;var e=Sn.current;Sn.current=null,e()}},800))}else(t+=1)<20&&(i=setTimeout(l,o))}else(t+=1)<20&&(i=setTimeout(l,o))}else(t+=1)<20&&(i=setTimeout(l,o))}};return i=setTimeout(l,o),function(){e=!0,i&&clearTimeout(i)}}},[xe,Gn,Xn,Jn,be,Ct,Bt,ei,Mn]);var si=function(e){var n=e.section,t=e.keyPath,o=e.depth,r=void 0===o?0:o,l=e.columnKey,c=void 0===l?"left":l,u=e.parentNodeId;return i(z,{section:n,keyPath:t,depth:r,columnKey:c,parentNodeId:void 0===u?"":u,expandedSubSections:It,setExpandedSubSections:Tt,maintainRelativeOrder:be||!1,proposedSections:Xn,existingSections:Jn,treeData:ce,deviationNumberRegistry:Qn,connectedSections:qe,activeSideBySideSection:ze,resolvedMarkdownStyles:an,getSubSectionRef:vt,getSubSectionCompareStyle:Vt,getBadgeRef:pt,openMoreFunctionsPopup:Ft,openSummaryPopup:ni,resetSideBySide:St,setConnectedSections:Ve,setConnectedLines:Ue,cachedConnectedPositions:en})};return t(d,e({ref:vn,sx:e(e({display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif'},be?{}:{overflow:"visible"}),{position:"relative"})},{children:[Ce&&i(d,e({sx:{position:"absolute",inset:0,bgcolor:"rgba(255, 255, 255, 0.6)",backdropFilter:"blur(10px)",zIndex:9999,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"8px"}},{children:i(D,{})})),_n.open&&i(W,{open:_n.open,anchorEl:_n.anchorEl,containerEl:kt.current,clipTopEl:Nt.current,scrollContainerEl:sn.current,onClose:ii,summary:_n.summary}),i(M,{open:Tn.open,anchorEl:Tn.anchorEl,sectionTitle:Tn.sectionTitle,referenceSectionTitle:Tn.refSectionTitle,onClose:Nn,onOpenCognitiveCompare:_t,onOpenSideBySide:ti,onConnect:Mt,isConnected:oi,isOrphan:Tn.isOrphan}),Cn.open&&i(_,{open:Cn.open,popupRef:An,position:wn,popupConfig:fe,onClose:function(){En(null),In(function(n){return e(e({},n),{open:!1})}),kn(null)},markdownStyles:se,sectionTitle:Cn.sectionTitle,referenceSectionTitle:Cn.refSectionTitle,cognitiveData:Cn.cognitiveData,anchorEl:Cn.anchorEl,sectionAnchorEl:Cn.sectionAnchorEl,scrollContainerEl:sn.current,badgeStyle:Cn.badgeStyle,docData:Cn.docData,deviationData:Cn.deviationData,isLoading:Cn.isLoading}),i(a,e({open:!!Fe,autoHideDuration:8e3,onClose:function(){return _e(null)},anchorOrigin:{vertical:"top",horizontal:"center"}},{children:i(s,e({onClose:function(){return _e(null)},severity:"error",sx:{width:"100%",whiteSpace:"pre-line"}},{children:Fe}))})),i(O,{componentHeaderText:le,displayConfig:pe,maintainRelativeOrder:be,onToggleView:function(e){Ie(!0),setTimeout(function(){Se(!e),St(),Dn(),Ve(new Set),Ue([]),en.current=[],requestAnimationFrame(function(){requestAnimationFrame(function(){setTimeout(function(){Ie(!1)},600)})})},50)}}),i(d,e({ref:sn,onScroll:$t,sx:{flex:1,minHeight:0,pt:1.5,pb:1,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",overflowY:be?"hidden":"auto",borderTop:gt&&ht?"none":"1.5px solid #EEF0F4"}},{children:i(d,e({sx:e({display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"},be?{flex:1,minHeight:0}:{})},{children:t(d,e({ref:Dt,sx:e({display:"grid",gridTemplateColumns:"minmax(0, 1fr) 180px minmax(0, 1fr)",gap:"40px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0},be?{flex:1,overflow:"visible"}:{})},{children:[t("svg",e({ref:Ge,style:{position:"absolute",top:0,left:0,width:un.width||"100%",height:un.height||"100%",pointerEvents:"none",zIndex:10,overflow:"visible",opacity:Pe?0:1,transition:"opacity 0.15s ease-in-out"}},{children:[Wt&&i("g",{children:i("line",{x1:Wt.x1,y1:Wt.y,x2:Wt.x2,y2:Wt.y,stroke:bt.badgeBorder,strokeWidth:"1.5"})}),Ot.map(function(n){var o,r,l,c,u,a,s=n.x1+.5*(n.x2-n.x1),v=(n.y1+n.y2)/2;if("Not Defined"===n.style.label&&!n.hasCognitive)return null;if(n.isSubSection?De&&ze===n.subSectionKeyPath&&He:De&&ze===n.sectionIdx&&He)return null;if(!be){var p=n.isSubSection?C(n.x1,n.y1,n.x2,n.y2):"M ".concat(n.x1," ").concat(n.y1," L ").concat(n.x2," ").concat(n.y2),g=Xn[n.sectionIdx]||{title:"",content:""},x=Jn[n.sectionIdx]||{title:"",content:""};if(console.log("Base and Ref Sections for Badge:",g,x),n.isSubSection&&n.subSectionKeyPath){var m=n.subSectionKeyPath.includes(S)?n.subSectionKeyPath.split(S):[],y=m[2]||n.subSectionKeyPath,b=m[3]||y,R=y.split("-").map(Number),I=b.split("-").map(Number),T=null,B=null;R.length>0&&(T=Xn[R[0]]),I.length>0&&(B=Jn[I[0]]);var w=(null==T?void 0:T.title)||"",F=(null==B?void 0:B.title)||"";console.log("Root Parent Titles:",w,F);for(var _=1;_<R.length;_++)(null==T?void 0:T.subsections)&&(T=T.subsections[R[_]]);for(_=1;_<I.length;_++)(null==B?void 0:B.subsections)&&(B=B.subsections[I[_]]);T&&(g=e(e({},T),{title:w||T.title})),console.log("Base Section for Subsection Badge:",g),B&&(x=e(e({},B),{title:F||B.title})),console.log("Ref Section for Subsection Badge:",x)}var M=!(null===(o=g.cognitiveData)||void 0===o?void 0:o.isMissingRationale)||Boolean(null===(l=null===(r=g.cognitiveData)||void 0===r?void 0:r.decisioning)||void 0===l?void 0:l.length),D=(null===(a=null===(u=null===(c=g.evaluationResult)||void 0===c?void 0:c.cognitive_decisioning)||void 0===u?void 0:u.decisioning_factors)||void 0===a?void 0:a.length)||!1,A=M||D;return t("g",{children:[i("path",{d:p,fill:"none",stroke:n.style.badgeBorder||"#E2E8F0",strokeWidth:"1.5"}),i("foreignObject",e({x:s-100,y:v-14,width:"200",height:"28",style:{pointerEvents:"auto",overflow:"visible"}},{children:i(d,e({sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},{children:t(d,e({onClick:function(e){e.stopPropagation(),A&&(Cn.open&&Fn===n.id?Hn():(kn(n.id),Et(wt(e.currentTarget,g,x,n.sectionIdx,n.style))))},sx:{display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",bgcolor:n.style.badgeBg,color:n.style.badgeText,border:"1px solid ".concat(n.style.badgeBorder),borderRadius:"12px",px:1.5,py:.5,fontWeight:600,textAlign:"center",whiteSpace:"nowrap",cursor:A?"pointer":"default"}},{children:[n.style.badgeText===E&&null==n.style.label?i(k,{color:n.style.badgeText}):0===n.style.label?"Same":n.style.label,i(d,e({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:i(h,{})})),A&&i(f,{size:11,style:{transform:Cn.open&&Fn===n.id?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))}))]},n.id)}return null}),Je.map(function(n){var o,r=n.pathD,l=(null===(o=n.style)||void 0===o?void 0:o.badgeBorder)||"#6366F1",c="conn-marker-".concat(n.id),u="".concat(n.id,"-bg"),d="".concat(n.id,"-stroke");return t("g",{children:[i("defs",{children:i("clipPath",e({id:"connections-clip"},{children:i("marker",e({id:c,markerWidth:"8",markerHeight:"6",refX:"7",refY:"3",orient:"auto"},{children:i("polygon",{points:"0 0, 8 3, 0 6",fill:l})}))}))}),i("path",{ref:function(e){$e.current[u]=e},d:r,fill:"none",stroke:"#FFFFFF",strokeWidth:"4",strokeOpacity:"0.7"}),i("path",{ref:function(e){$e.current[d]=e},d:r,fill:"none",stroke:l,strokeWidth:"1.75",markerEnd:"url(#".concat(c,")")})]},n.id)})]})),t(d,e({sx:e({border:"1px solid #E7E7E9",borderRadius:"8px",bgcolor:"#FFFFFF",display:"flex",flexDirection:"column",position:"relative",zIndex:2,filter:"drop-shadow(0px 2px 4px #F2F2F2)"},be?{flex:1,overflow:"visible"}:{})},{children:[i(d,e({ref:Nt,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E7E7E9",borderRadius:"8px 8px 0 0",display:"flex",alignItems:"center",minHeight:"40px",overflow:"hidden",minWidth:0}},{children:i(v,e({title:Wn,placement:"top"},{children:i(p,e({sx:{fontSize:"16px",fontWeight:500,color:"#19213D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0,textAlign:"center",display:"block"}},{children:Wn}))}))})),t(d,e({ref:mn,onScroll:$t,sx:e({p:"12px",display:"flex",flexDirection:"column"},be?{maxHeight:"calc(100vh - 150px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,mr:"-160px",pr:"172px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[i("div",{ref:hn,style:{width:"100%",height:"0px",flexShrink:0}}),$n&&Xn.map(function(n,o){var r,l,c=!n.title&&!n.content;if(be&&c)return null;var u=n,a=qt(o,"left"),s=be?!(null===(r=u.refIndexes)||void 0===r?void 0:r.length)||u.selfIndex<0:!Jn[o],v=be?"number"==typeof u.selfIndex&&u.selfIndex>=0?u.selfIndex+1:null:o+1,p=qe.has(o),f=y(u.evaluationResult,null==a?void 0:a.deviationLabel);return i(d,e({ref:st(o),sx:{mb:1,width:"100%"}},{children:t(d,e({sx:{position:"relative",width:"100%"}},{children:[i(d,e({ref:it.current[o],sx:e({width:"100%",display:"flex"},p&&{borderRadius:"6px",outline:"2px solid ".concat((null==a?void 0:a.badgeBorder)||"#6366F1"),outlineOffset:"1px"})},{children:i(j,{section:n,idx:o,columnKey:"left",colRef:st("left-accordion-".concat(o)),mb:0,treeData:ce,proposedSections:Xn,existingSections:Jn,deviationNumberRegistry:Qn,getSectionCompareStyle:qt,getBadgeRef:pt,connectedSections:qe,openMoreFunctionsPopup:Ft,openSummaryPopup:ni,deviationNodeIdToView:xe,deviationTargetParentId:ui,parentNodeId:(null===(l=null==ce?void 0:ce.input_index_map)||void 0===l?void 0:l[0])||"",isExpanded:be?!!Ct["left-".concat(o)]:!!Ct[String(o)],onToggle:function(){ii(),Bt(o,"left")},navigation:n.id?li[n.id]:null,showOpenNodeRef:ci,resolvedMarkdownStyles:an,maintainRelativeOrder:be,renderSubSections:si})})),be&&a&&t(d,e({ref:rt.current[o],onClick:function(e){var t=be?Jn.find(function(e){var n;return null===(n=u.refIndexes)||void 0===n?void 0:n.includes(e.selfIndex)})||{title:"",content:""}:Jn[o]||{title:"",content:""};Ft(e,n,s,t,o,a)},sx:{position:"absolute",top:"18px",right:0,transform:"translateY(-50%) translateX(calc(100% + 8px))",display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",bgcolor:a.badgeBg,color:a.badgeText,border:"1px solid ".concat(a.badgeBorder),borderRadius:"12px",px:1.2,py:.4,fontWeight:600,cursor:"pointer",whiteSpace:"nowrap",zIndex:20,boxShadow:"0 1px 3px rgba(0,0,0,0.07)"}},{children:[null!==v&&i(d,e({component:"span",sx:{fontSize:"11px",fontWeight:700,pr:.5,borderRight:"1px solid ".concat(a.badgeBorder)}},{children:v})),i(d,e({component:"span",sx:{fontSize:"11px",px:.25}},{children:!pe.isLoading||null!=u.evaluationResult&&null!=u.evaluationResult?s?"No Deviation Found":"N/A"===f||"NA"===f?"N/A":0==f||null==f?"Same":"".concat(f):i(k,{color:a.badgeText})})),i(g,{size:11,color:a.badgeText})]}))]}))}),"left-row-".concat(o))}),i("div",{ref:xn,style:{width:"100%",height:"0px",flexShrink:0}})]}))]})),i(d,e({ref:kt,sx:{width:"180px",display:"flex",flexDirection:"column",alignItems:"center",pt:"15px",gap:0,zIndex:20,pointerEvents:"none"}},{children:i(d,e({sx:{display:"flex",justifyContent:"center",alignItems:"center",mt:0}},{children:t(d,e({onClick:function(n){n.stopPropagation(),Cn.open&&Fn===xt?Hn():(kn(xt),Et(wt(n.currentTarget,{title:"",content:"",evaluationResult:mt,cognitiveData:{section_id:"",decisioning:[],gap:[],relevance_score:0,isMissingRationale:!0}},null,xt,!0,e(e({},bt),{label:""}))))},sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:"5px",top:"-5px",borderRadius:"20px",bgcolor:bt.badgeBg,color:bt.badgeText,border:"1px solid ".concat(bt.badgeBorder),fontSize:"12px",fontWeight:600,whiteSpace:"nowrap",position:"relative",zIndex:1,pointerEvents:"auto",cursor:"pointer"}},{children:[null!=yt?yt:i(k,{}),i(d,e({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:i(h,{})})),i(f,{size:11,style:{transform:Cn.open&&Fn===xt?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))})),t(d,e({sx:e({border:"1px solid #E3E6EA",borderRadius:"8px",bgcolor:"#FFFFFF",boxShadow:"0px 1px 4px #F7F4FE",position:"relative",zIndex:2,display:"flex",flexDirection:"column",minWidth:0},be?{flex:1,overflow:"visible",minHeight:0}:{})},{children:[Be&&i(x,{sections:11}),i(d,e({ref:Lt,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E3E6EA",borderRadius:"8px 8px 0 0",minHeight:"40px",display:"flex",alignItems:"center",overflowX:"hidden"}},{children:i(v,e({title:Yn,placement:"top"},{children:i(p,e({sx:{fontSize:"16px",fontWeight:500,color:"#5928ED",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0,textAlign:"center",display:"block"}},{children:Yn}))}))})),t(d,e({ref:pn,onScroll:$t,sx:e({p:"12px",display:"flex",flexDirection:"column"},be?{maxHeight:"calc(100vh - 150px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,ml:"-120px",pl:"140px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[i("div",{ref:fn,style:{width:"100%",height:"0px",flexShrink:0}}),$n&&Jn.map(function(n,o){var r,l=n,c=[],u=!1,a=null,s=-1;if(be){c=Xn.filter(function(e){var n;return(null===(n=e.refIndexes)||void 0===n?void 0:n.includes(l.selfIndex))&&e.selfIndex>=0}).map(function(e){return e.selfIndex+1}),s=Xn.findIndex(function(e){var n;return(null===(n=e.refIndexes)||void 0===n?void 0:n.includes(l.selfIndex))&&e.selfIndex>=0});var v=Xn.findIndex(function(e,n){var t;return qe.has(n)&&(null===(t=e.refIndexes)||void 0===t?void 0:t.includes(l.selfIndex))});(u=-1!==v)&&(a=qt(v))}else c=[o+1],(u=qe.has(o))&&(a=qt(o));var p=qt(be&&-1!==s?s:o);return i(d,e({ref:ct.current[o],sx:{mb:1,width:"100%"}},{children:t(d,e({sx:{position:"relative",width:"100%"}},{children:[i(d,e({ref:ot.current[o],sx:e({width:"100%",display:"flex"},u&&a&&{borderRadius:"6px",outline:"2px solid ".concat(a.badgeBorder),outlineOffset:"1px"})},{children:i(j,{section:n,idx:o,columnKey:"right",colRef:st("right-accordion-".concat(o)),mb:0,parentNodeId:(null===(r=null==ce?void 0:ce.input_index_map)||void 0===r?void 0:r[1])||"",isExpanded:be?!!Ct["right-".concat(o)]:!!Ct[String(o)],treeData:ce,proposedSections:Xn,existingSections:Jn,deviationNumberRegistry:Qn,getBadgeRef:pt,getSectionCompareStyle:qt,connectedSections:qe,openMoreFunctionsPopup:Ft,openSummaryPopup:ni,deviationNodeIdToView:xe,deviationTargetParentId:ui,onToggle:function(){ii(),Bt(o,"right")},navigation:n.id?li[n.id]:null,showOpenNodeRef:ci,resolvedMarkdownStyles:an,maintainRelativeOrder:be,renderSubSections:si})})),be&&p&&i(d,e({ref:lt.current[o],"data-section-id":l.id,sx:{position:"absolute",top:"18px",left:0,transform:"translateY(-50%) translateX(calc(-100% - 8px))",display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:"11px",bgcolor:p.badgeBg,color:p.badgeText,border:"1px solid ".concat(p.badgeBorder),borderRadius:"10px",px:1,py:.3,fontWeight:700,whiteSpace:"nowrap",zIndex:20}},{children:c.length>0?c.join(", "):"-"}))]}))}),"right-row-".concat(o))}),i("div",{ref:gn,style:{width:"100%",height:"0px",flexShrink:0}})]}))]}))]}))}))}))]}))};export{Y as default};
|
|
2
2
|
//# sourceMappingURL=CognitiveCompare.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var n=function(t){return null==t?"":"string"==typeof t?t:Array.isArray(t)?t.map(n).join("\n\n"):"object"==typeof t?JSON.stringify(t):String(t)},t=function(n){return null!=n&&("string"==typeof n?n.trim().length>0:!Array.isArray(n)||n.length>0&&n.some(function(n){return t(n)}))},r=function(t,r,e){var i,o=e[r],a=null===(i=null==t?void 0:t.comparison_inputs)||void 0===i?void 0:i[o];return{title:n((null==a?void 0:a.title)||""),content:n((null==a?void 0:a.content)||""),attributes:(null==a?void 0:a.additional_attributes)||null,subsections:(null==a?void 0:a.subsections)||[]}},e=function(n){if(!n.mapping_rationale)return{cognitiveData:{decisioning:[],gap:[],relevance_score:0,isMissingRationale:!0,citations:[]},score:0,relation:"N/A"};var t=n.mapping_rationale,r=parseInt(t.decision_strength||"0");return{cognitiveData:{decisioning:t.decisioning_factors||[],gap:t.gaps_in_decision||[],relevance_score:r,citations:t.citations},score:0,relation:"N/A"}};function i(n){var t=function(n,t){var r=function(n){var t=function(n){return 4===n.length?"#"+n[1]+n[1]+n[2]+n[2]+n[3]+n[3]:n}(n).replace("#",""),r=parseInt(t,16);return{r:r>>16&255,g:r>>8&255,b:255&r}}(n),e=r.r,i=r.g,o=r.b;return function(n,t,r){return"#"+[n,t,r].map(function(n){return n.toString(16).padStart(2,"0")}).join("").toUpperCase()}(Math.round(e+(255-e)*t),Math.round(i+(255-i)*t),Math.round(o+(255-o)*t))};return{bg:t(n,.8),border:t(n,.5),badgeBg:t(n,.8),badgeBorder:t(n,.5),badgeText:n.toUpperCase(),highlightBg:t(n,.8)}}function o(n,t){var r;return function(){for(var e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];var o=this;clearTimeout(r),r=setTimeout(function(){return n.apply(o,e)},t)}}var a=function(n,t){if(n.content!==t.content)return!1;if(n.sxStyles!==t.sxStyles)return!1;if(n.maintainRelativeOrder!==t.maintainRelativeOrder)return!1;var
|
|
1
|
+
var n=function(t){return null==t?"":"string"==typeof t?t:Array.isArray(t)?t.map(n).join("\n\n"):"object"==typeof t?JSON.stringify(t):String(t)},t=function(n){return null!=n&&("string"==typeof n?n.trim().length>0:!Array.isArray(n)||n.length>0&&n.some(function(n){return t(n)}))},r=function(t,r,e){var i,o=e[r],a=null===(i=null==t?void 0:t.comparison_inputs)||void 0===i?void 0:i[o];return{title:n((null==a?void 0:a.title)||""),content:n((null==a?void 0:a.content)||""),attributes:(null==a?void 0:a.additional_attributes)||null,subsections:(null==a?void 0:a.subsections)||[]}},e=function(n){if(!n.mapping_rationale)return{cognitiveData:{decisioning:[],gap:[],relevance_score:0,isMissingRationale:!0,citations:[]},score:0,relation:"N/A"};var t=n.mapping_rationale,r=parseInt(t.decision_strength||"0");return{cognitiveData:{decisioning:t.decisioning_factors||[],gap:t.gaps_in_decision||[],relevance_score:r,citations:t.citations},score:0,relation:"N/A"}};function i(n){var t=function(n,t){var r=function(n){var t=function(n){return 4===n.length?"#"+n[1]+n[1]+n[2]+n[2]+n[3]+n[3]:n}(n).replace("#",""),r=parseInt(t,16);return{r:r>>16&255,g:r>>8&255,b:255&r}}(n),e=r.r,i=r.g,o=r.b;return function(n,t,r){return"#"+[n,t,r].map(function(n){return n.toString(16).padStart(2,"0")}).join("").toUpperCase()}(Math.round(e+(255-e)*t),Math.round(i+(255-i)*t),Math.round(o+(255-o)*t))};return{bg:t(n,.8),border:t(n,.5),badgeBg:t(n,.8),badgeBorder:t(n,.5),badgeText:n.toUpperCase(),highlightBg:t(n,.8)}}function o(n,t){var r;return function(){for(var e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];var o=this;clearTimeout(r),r=setTimeout(function(){return n.apply(o,e)},t)}}var a=function(n,t){var r,e,i,o,a,l;if(n.content!==t.content)return!1;if(n.sxStyles!==t.sxStyles)return!1;if(n.maintainRelativeOrder!==t.maintainRelativeOrder)return!1;if(n.highlightBg!==t.highlightBg)return!1;var u=n.highlights||[],c=t.highlights||[];if(u.length!==c.length)return!1;for(var s=0;s<u.length;s++)if(u[s]!==c[s])return!1;var v=n.deviationBadges||[],d=t.deviationBadges||[];if(v.length!==d.length)return!1;for(s=0;s<v.length;s++){if(v[s].id!==d[s].id)return!1;if(v[s].actionId!==d[s].actionId)return!1;if(v[s].label!==d[s].label)return!1;if(v[s].score!==d[s].score)return!1;if(v[s].isOrphan!==d[s].isOrphan)return!1;if(v[s].isConnected!==d[s].isConnected)return!1;if((null===(r=v[s].style)||void 0===r?void 0:r.badgeBg)!==(null===(e=d[s].style)||void 0===e?void 0:e.badgeBg))return!1;if((null===(i=v[s].style)||void 0===i?void 0:i.badgeBorder)!==(null===(o=d[s].style)||void 0===o?void 0:o.badgeBorder))return!1;if((null===(a=v[s].style)||void 0===a?void 0:a.badgeText)!==(null===(l=d[s].style)||void 0===l?void 0:l.badgeText))return!1}return!0},l="::",u=function(n){if(!n)return!0;var t=n.trim().toLowerCase();return t.includes("no equivalent")||"n/a"===t||"na"===t||"none"===t},c=function(n,t){var r,e,i,o,a,l,u;if(!n)return t;var c=null!==(l=null!==(o=null!==(e=null===(r=n.evaluation_output)||void 0===r?void 0:r.output_score)&&void 0!==e?e:null===(i=n.evaluation_outputs)||void 0===i?void 0:i.output_score)&&void 0!==o?o:null===(a=n.evaluation_outputs)||void 0===a?void 0:a.output_value)&&void 0!==l?l:n.output_score;return null!==(u=null!=c?c:t)&&void 0!==u?u:""},s=function(n,t,r,e,i){void 0===i&&(i=14);var o=n+.5*(r-n),a=e-t;if(Math.abs(a)<3)return"M ".concat(n," ").concat(t," H ").concat(r);var l=a>0?1:-1,u=Math.min(i,Math.abs(a)/2,Math.abs(o-n)/2,Math.abs(r-o)/2);return["M ".concat(n," ").concat(t),"H ".concat(o-u),"Q ".concat(o," ").concat(t," ").concat(o," ").concat(t+l*u),"V ".concat(e-l*u),"Q ".concat(o," ").concat(e," ").concat(o+u," ").concat(e),"H ".concat(r)].join(" ")},v=function(n,t,r,e,i){void 0===r&&(r=300);var o=n.style.scrollBehavior;n.style.scrollBehavior="auto";var a=n.scrollTop,l=t-a,u=null,c=function(s){null===u&&(u=s);var v,d=s-u;d<r?(n.scrollTop=(v=d,v/=r,l*(--v*v*v+1)+a),i&&i(),requestAnimationFrame(c)):(n.scrollTop=t,n.style.scrollBehavior=o,i&&i(),e&&e())};requestAnimationFrame(c)},d=function(n){var t=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return t=(t=(t=(t=t.replace(/['’‘`]/g,"['’‘`]")).replace(/["”“]/g,'["”“]')).replace(/[-—–]/g,"[-—–]")).replace(/\s+/g,"\\s+")};export{l as DEVIATION_BADGE_SEPARATOR,a as areMarkdownPropsEqual,o as debounce,d as escapeRegExp,c as extractDeviationScore,i as generateColorPalette,s as getBentArrowPath,e as getRationale,r as getSideData,t as hasValue,u as isMissingStr,n as safeStringify,v as smoothScrollTo};
|
|
2
2
|
//# sourceMappingURL=CognitiveComparehelpers.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as t}from"tslib";import{jsx as e,jsxs as n}from"react/jsx-runtime";import{Popper as o,Paper as
|
|
1
|
+
import{__assign as t}from"tslib";import{jsx as e,jsxs as n}from"react/jsx-runtime";import{Popper as o,Paper as l,Box as i,Typography as r,IconButton as a}from"@mui/material";import{Info as u,X as c}from"lucide-react";import{useRef as d,useState as m,useEffect as s}from"react";function p(p){var f,g,v,h=p.open,x=p.anchorEl,b=p.containerEl,w=p.clipTopEl,C=p.scrollContainerEl,y=p.onClose,B=p.summary;p.markdownStyles,p.isLoading;var R=d(null),E=d(null),z=m(null),S=z[0],L=z[1],W=m(null),_=W[0],F=W[1],k=m(null),A=k[0],H=k[1],I=m(0),M=I[0],T=I[1],j="string"==typeof B?{deviation_summary:B}:null!=B?B:{};j.deviation_title;var N=j.deviation_summary,O=j.evaluation_outputs,P=(null===(f=null==O?void 0:O.metadata)||void 0===f?void 0:f.label_color)||"#6366F1",q=null!==(g=null==b?void 0:b.getBoundingClientRect().width)&&void 0!==g?g:180,J=Math.max(148,q+70),V=x&&b?{top:x.getBoundingClientRect().top,bottom:x.getBoundingClientRect().bottom,left:b.getBoundingClientRect().left+b.getBoundingClientRect().width/2}:null;s(function(){if(!h||!x||!b)return L(null),F(null),void H(null);var t=function(){null!==R.current&&cancelAnimationFrame(R.current),R.current=requestAnimationFrame(function(){var t,e,n=x.getBoundingClientRect(),o=b.getBoundingClientRect(),l=null==w?void 0:w.getBoundingClientRect(),i=null==C?void 0:C.getBoundingClientRect();L({top:n.top,bottom:n.bottom,left:o.left+o.width/2}),F(null!==(t=null==l?void 0:l.bottom)&&void 0!==t?t:null),H(null!==(e=null==i?void 0:i.bottom)&&void 0!==e?e:null),E.current&&T(E.current.offsetHeight)})};t();var e=!0;return window.addEventListener("scroll",t,{passive:!0,capture:e}),window.addEventListener("resize",t),function(){null!==R.current&&cancelAnimationFrame(R.current),window.removeEventListener("scroll",t,e),window.removeEventListener("resize",t)}},[h,x,b,w,C]);var Z=null!==(v=null!=S?S:V)&&void 0!==v?v:{top:0,bottom:0,left:0},D=Z.bottom+20,G=D+M,K=null!=_?Math.max(0,_-D):0,Q=null!=A?Math.max(0,G-A):0;return B?e(o,t({open:h,disablePortal:!0,popperOptions:{strategy:"fixed"},anchorEl:{getBoundingClientRect:function(){return{width:0,height:Z.bottom-Z.top,top:Z.top,bottom:Z.bottom,left:Z.left,right:Z.left,x:Z.left,y:Z.top,toJSON:function(){}}}},placement:"bottom",modifiers:[{name:"offset",options:{offset:[0,20]}}],sx:{zIndex:20}},{children:n(l,t({ref:E,sx:t(t({p:1.5,borderRadius:"12px",width:J,maxWidth:J},(K>0||Q>0)&&{clipPath:"inset(".concat(K,"px 0 ").concat(Q-150,"px 0 round 12px)")}),{transition:"transform 80ms linear",willChange:"transform",backfaceVisibility:"hidden",transform:"translateZ(0)",boxShadow:"0px 10px 24px rgba(15, 23, 42, 0.18)",border:"1px solid ".concat(P,"26"),borderTop:"3px solid ".concat(P),overflow:"hidden",bgcolor:"#fff"})},{children:[n(i,t({sx:{display:"flex",alignItems:"center",justifyContent:"space-between",mb:.75}},{children:[n(i,t({sx:{display:"flex",alignItems:"center",gap:.75,minWidth:0}},{children:[e(u,{size:14,color:P}),e(r,t({sx:{fontSize:"11px",fontWeight:700,color:P,textTransform:"uppercase",letterSpacing:"0.4px",lineHeight:1.2}},{children:"Summary"}))]})),e(a,t({size:"small",onClick:y,sx:{p:.25,ml:.5,color:"#64748B"}},{children:e(c,{size:14})}))]})),e(r,t({sx:{fontSize:"12px",color:"#475569",lineHeight:1.5,fontWeight:400,overflowWrap:"anywhere"}},{children:N||"No summary available."}))]}))})):null}export{p as default};
|
|
2
2
|
//# sourceMappingURL=CognitiveSummaryPopup.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as e}from"tslib";import{jsxs as n,jsx as
|
|
1
|
+
import{__assign as e}from"tslib";import{jsxs as n,jsx as t}from"react/jsx-runtime";import o,{useRef as i,useEffect as l}from"react";import{Box as r,Accordion as d,AccordionSummary as a,Tooltip as u,Typography as c,AccordionDetails as s}from"@mui/material";import{ChevronUp as v,ChevronDown as f}from"lucide-react";import{MemoizedMarkdown as p}from"../hooks/memoizedMarkdown.js";import{hasValue as m,generateColorPalette as h,isMissingStr as g,safeStringify as x,escapeRegExp as b,DEVIATION_BADGE_SEPARATOR as y}from"../CognitiveComparehelpers.js";import{DEFAULT_DEVIAION_COLOR as w}from"../CognitiveCompareConstants.js";var I=function(e){var n=function(e){for(var n=(null==e?void 0:e.parentElement)||null;n;){var t=window.getComputedStyle(n).overflowY;if(("auto"===t||"scroll"===t)&&n.scrollHeight>n.clientHeight)return n;n=n.parentElement}return null}(e),t=e.getBoundingClientRect(),o=(null==n?void 0:n.getBoundingClientRect())||{top:0,bottom:window.innerHeight};return t.top>=o.top&&t.bottom<=o.bottom},R=function(R){var S,F,k,C,_,B,A,T,E,M,W,D,N,O,P,j,z=R.section,H=R.idx,K=R.columnKey,V=R.colRef,Y=R.mb,G=void 0===Y?1:Y,X=R.parentNodeId,$=void 0===X?"":X,q=R.isExpanded,J=R.onToggle,L=R.navigation,Q=R.showOpenNodeRef,U=R.resolvedMarkdownStyles,Z=R.maintainRelativeOrder,ee=R.renderSubSections,ne=R.treeData,te=R.proposedSections,oe=void 0===te?[]:te,ie=R.existingSections,le=void 0===ie?[]:ie,re=R.deviationNumberRegistry,de=void 0===re?{}:re,ae=R.getBadgeRef,ue=R.openSummaryPopup,ce=R.getSectionCompareStyle,se=R.connectedSections,ve=R.openMoreFunctionsPopup,fe=R.deviationNodeIdToView,pe=R.deviationTargetParentId,me=(null===(S=z.displayTitle)||void 0===S||S)&&m(z.title),he=(null===(F=z.displayContent)||void 0===F||F)&&m(z.content),ge=!me&&!he,xe={current:1},be=z.title;me||(be=he?"No Title Found":"No Matching Section Found");var ye=z.evaluationResult;if(!ye&&"right"===K)if(Z){var we=null===(k=z.refIndexes)||void 0===k?void 0:k[0],Ie=oe.find(function(e){return e.selfIndex===we});ye=null==Ie?void 0:Ie.evaluationResult}else ye=null===(C=oe[H])||void 0===C?void 0:C.evaluationResult;var Re=null===(_=null==ne?void 0:ne.input_index_map)||void 0===_?void 0:_[0],Se=null===(B=null==ne?void 0:ne.input_index_map)||void 0===B?void 0:B[1],Fe="left"===K?Se:Re,ke="left"===K?z:oe[H],Ce="right"===K?z:le[H];if(Z)if("left"===K){var _e=null===(A=z.refIndexes)||void 0===A?void 0:A[0],Be=le.findIndex(function(e){return e.selfIndex===_e});Ce=-1!==Be?le[Be]:void 0}else{var Ae=null===(T=z.refIndexes)||void 0===T?void 0:T[0],Te=oe.findIndex(function(e){return e.selfIndex===Ae});ke=-1!==Te?oe[Te]:void 0}var Ee="left"===K?!Ce:!ke,Me=ye||(null==ke?void 0:ke.evaluationResult)||(null==Ce?void 0:Ce.evaluationResult),We=null!==(W=null===(M=null===(E=null==Me?void 0:Me.evaluation_outputs)||void 0===E?void 0:E.metadata)||void 0===M?void 0:M.label_color)&&void 0!==W?W:w,De=h(We),Ne=De.highlightBg,Oe=null!==(N=null===(D=null==Me?void 0:Me.evaluation_outputs)||void 0===D?void 0:D.output_value)&&void 0!==N?N:null,Pe=(null==Me?void 0:Me.deviations)||{},je=H+1,ze=z.id;if("right"===K&&Z){var He=null===(O=z.refIndexes)||void 0===O?void 0:O[0];-1!==(Te=oe.findIndex(function(e){return e.selfIndex===He}))&&(je=Te+1,ze=oe[Te].id)}var Ke,Ve=i(fe),Ye=i(pe||null),Ge=[],Xe=Object.entries(Pe).map(function(n){var t,o,i,l,r,d=n[0],a=n[1],u="".concat(ze).concat(y).concat(d),c=de[u];if(!c)return null;var s=a[$],v=g(s);if(v)s="";else if(!s)return null;Ge.push(s);var f=H,p=H;if(Z)if("left"===K){var m=null===(t=z.refIndexes)||void 0===t?void 0:t[0],h=le.findIndex(function(e){return e.selfIndex===m});p=-1!==h?h:H}else{var w=null===(o=z.refIndexes)||void 0===o?void 0:o[0],I=oe.findIndex(function(e){return e.selfIndex===w});f=-1!==I?I:H}var R="".concat(ze).concat(y).concat(d).concat(y).concat(f).concat(y).concat(p),S="left"===K?null===(i=le[p])||void 0===i?void 0:i.content:null===(l=oe[f])||void 0===l?void 0:l.content,F=a[Fe],k=x(S),C=Object.keys(Pe).map(function(e){return{key:e,text:Pe[e][Fe]}}).filter(function(e){return!g(e.text)}).sort(function(e,n){return n.text.length-e.text.length}),_=new Set;C.forEach(function(e){var n=e.text.replace(/\\(['’])/g,"$1").replace(/\\n/g,"\n");if(n){var t=new RegExp(b(n));t.test(k)&&(_.add(e.key),k=k.replace(t,"__TOKEN_".concat(e.key,"__")))}});var B=!g(F)&&!_.has(d),A=Ee||g(F)||B,T="".concat(je,".").concat(c),E=H;if("right"===K&&Z){var M=null===(r=z.refIndexes)||void 0===r?void 0:r[0],W=oe.findIndex(function(e){return e.selfIndex===M});-1!==W&&(E=W)}var D=ce?ce(E):null,N=D?e(e({},D),{badgeBg:De.badgeBg,badgeBorder:De.badgeBorder,badgeText:De.badgeText}):e({},De),O=(null==a?void 0:a.deviation_summary)?{deviation_summary:a.deviation_summary,deviation_title:null==Me?void 0:Me.deviation_title,evaluation_outputs:null==Me?void 0:Me.evaluation_outputs}:null;return{id:u,actionId:R,label:T,highlight:s,side:K,style:N,score:Oe,isConnected:null==se?void 0:se.has(R),isOrphan:A,isMissingClause:v,badgeRef:ae(K,u),onClick:function(e){e.stopPropagation(),ve&&ve(e,ke||{id:"orphan-left",title:"",content:""},A,Ce||{id:"orphan-right",title:"",content:""},R,N)},onSummaryClick:function(e){e.stopPropagation(),ue(e,R,A,O)}}}).filter(Boolean),$e=z.id&&K===(null==L?void 0:L.columnKey)?L:null,qe=o.useRef(!1);return l(function(){q||(qe.current=!1)},[q]),l(function(){Ve.current=fe,Ye.current=pe||null},[fe,pe]),l(function(){var e=!!Ve.current&&!!Ye.current&&ze===Ye.current,n=!!Ve.current&&(z.subsections||[]).some(function(e){return e.id===Ve.current});if(q&&!qe.current&&!e&&!n){var t=setTimeout(function(){var e,n=null===(e=null==$e?void 0:$e.firstDeviationRef)||void 0===e?void 0:e.current,t=null==$e?void 0:$e.firstDeviationPosition;n?"inside"===t||I(n)?qe.current=!0:(qe.current=!0,n.scrollIntoView({behavior:"smooth",block:"center"})):qe.current=!0},600);return function(){return clearTimeout(t)}}},[q,ze,null==$e?void 0:$e.firstDeviationPosition,null==$e?void 0:$e.firstDeviationRef]),n(r,e({ref:V,sx:{mb:G,width:"100%",display:"flex",flexDirection:"column",position:"relative",minWidth:0}},{children:[q&&(null==$e?void 0:$e.showAbove)&&t("div",e({style:{position:"sticky",top:0,height:"0px",cursor:"pointer"},onClick:function(){var e,n;return null===(n=null===(e=null==$e?void 0:$e.showAboveRef)||void 0===e?void 0:e.current)||void 0===n?void 0:n.scrollIntoView({behavior:"smooth",block:"center"})}},{children:t("div",e({style:e({transform:"translateY(-50%) translateX(calc(100% ".concat("left"===K?"+":"-"," 130px))"),position:"absolute",paddingTop:"20px"},"left"===K?{right:"0px"}:{left:"0px"})},{children:t(v,{color:window.getComputedStyle(null===(P=null==$e?void 0:$e.showAboveRef)||void 0===P?void 0:P.current).color})}))})),n(d,e({disableGutters:!0,expanded:!ge&&q,onChange:function(){ge||(J(),Q.current=z.id)},sx:{boxShadow:"none",border:ge?"1px dashed #E2E8F0":"1px solid #E2E8F0",bgcolor:ge?"#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:[t(a,e({expandIcon:ge?null:t(f,{size:16}),sx:{minHeight:"36px",flexShrink:0,cursor:ge?"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:me&&t(u,e({title:be,placement:"top"},{children:t(c,e({component:"div",sx:{fontSize:"12px",color:ge?"#94A3B8":"#19213D",fontWeight:ge?400:700,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0}},{children:(Ke=be,Ke?x(Ke).replace(/\\n/g,"\n").split(/(\*\*.*?\*\*)/g).map(function(e,n){return e.startsWith("**")&&e.endsWith("**")?t("strong",{children:e.slice(2,-2)},n):t(o.Fragment,{children:e},n)}):null)}))}))})),!ge&&n(s,e({sx:{pt:0,pb:1.25,bgcolor:"#FFFFFF",flex:1,display:"flex",flexDirection:"column",minWidth:0}},{children:[he&&t(p,{content:z.content,sxStyles:U,highlights:Ge,maintainRelativeOrder:Z,highlightBg:Ne,deviationBadges:Xe}),(z.subsections||[]).map(function(e,n){return ee({section:e,keyPath:"".concat(H,"-").concat(n),depth:0,columnKey:K,parentNodeId:$,devCounter:xe})})]}))]})),q&&(null==$e?void 0:$e.showBelow)&&t("div",e({style:{position:"sticky",bottom:0,height:"0px",cursor:"pointer"},onClick:function(){var e,n;return null===(n=null===(e=null==$e?void 0:$e.showBelowRef)||void 0===e?void 0:e.current)||void 0===n?void 0:n.scrollIntoView({behavior:"smooth",block:"center"})}},{children:t("div",e({style:e({transform:"translateY(-50%) translateX(calc(100% ".concat("left"===K?"+":"-"," 130px))"),position:"absolute",paddingBottom:"20px"},"left"===K?{right:"0px"}:{left:"0px"})},{children:t(f,{color:window.getComputedStyle(null===(j=null==$e?void 0:$e.showBelowRef)||void 0===j?void 0:j.current).color})}))}))]}),"".concat(K,"-sec-").concat(H))};export{R as default};
|
|
2
2
|
//# sourceMappingURL=SectionAccordion.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{__assign as n}from"tslib";import{jsx as t,jsxs as i}from"react/jsx-runtime";import e,{useRef as o,useEffect as l}from"react";import{Box as r,Accordion as a,AccordionSummary as u,Typography as d,AccordionDetails as c}from"@mui/material";import{ChevronDown as s}from"lucide-react";import{MemoizedMarkdown as v}from"../hooks/memoizedMarkdown.js";import{hasValue as f,generateColorPalette as h,isMissingStr as p,DEVIATION_BADGE_SEPARATOR as m}from"../CognitiveComparehelpers.js";import{DEFAULT_DEVIAION_COLOR as g}from"../CognitiveCompareConstants.js";var b=e.memo(function(e){var x,S,y,_,k,w,C,F,P,I,R,B=e.section,O=e.keyPath,j=e.depth,E=void 0===j?0:j,W=e.columnKey,M=void 0===W?"left":W,N=e.parentNodeId,T=void 0===N?"":N,z=e.expandedSubSections,A=e.setExpandedSubSections,D=e.maintainRelativeOrder,G=e.proposedSections,H=e.existingSections,K=e.treeData,L=e.deviationNumberRegistry,U=e.connectedSections,V=e.activeSideBySideSection,q=e.resolvedMarkdownStyles,J=e.getSubSectionRef,Q=e.getSubSectionCompareStyle,X=e.getBadgeRef,Y=e.openMoreFunctionsPopup,Z=e.openSummaryPopup,$=e.resetSideBySide,nn=e.setConnectedSections,tn=e.setConnectedLines,en=e.cachedConnectedPositions,on=(null===(x=B.displayTitle)||void 0===x||x)&&f(B.title),ln=(null===(S=B.displayContent)||void 0===S||S)&&f(B.content),rn=!on&&!ln,an=on?B.title:ln?"No Title Found":"No Matching Section Found",un=!!z[O],dn=J(M,O),cn=O.split("-").map(Number),sn=cn[0],vn=G[sn],fn=H[sn],hn=O,pn=O,mn=sn,gn=sn,bn=function(n,t,i){if(!n||!t)return null;if(n.id===t)return{section:n,keyPath:i};for(var e=(n.subsections||[]).map(function(n,t){return{section:n,keyPath:"".concat(i,"-").concat(t)}}),o=function(){var n=e.shift();return(null==n?void 0:n.section)?n.section.id===t?{value:n}:void(n.section.subsections||[]).forEach(function(t,i){e.push({section:t,keyPath:"".concat(n.keyPath,"-").concat(i)})}):"continue"};e.length>0;){var l=o();if("object"==typeof l)return l.value}return null};if(D)if("left"===M){var xn=null===(y=null==vn?void 0:vn.refIndexes)||void 0===y?void 0:y[0],Sn=H.findIndex(function(n){return n.selfIndex===xn});-1!==Sn&&(fn=H[Sn],gn=Sn)}else{var yn=null===(_=null==fn?void 0:fn.refIndexes)||void 0===_?void 0:_[0];-1!==(Pn=G.findIndex(function(n){return n.selfIndex===yn}))&&(vn=G[Pn],mn=Pn)}var _n=vn,kn=fn;if(D)if("left"===M){_n=B,hn=O;var wn=bn(fn,B.id,String(gn));kn=(null==wn?void 0:wn.section)||null,pn=(null==wn?void 0:wn.keyPath)||""}else{kn=B,pn=O;var Cn=bn(vn,B.id,String(mn));_n=(null==Cn?void 0:Cn.section)||null,hn=(null==Cn?void 0:Cn.keyPath)||""}else for(var Fn=1;Fn<cn.length;Fn++)(null==_n?void 0:_n.subsections)&&(_n=_n.subsections[cn[Fn]]),(null==kn?void 0:kn.subsections)&&(kn=kn.subsections[cn[Fn]]);var Pn,In=(hn?Q(hn):null)||Q(O),Rn=null===(k=null==K?void 0:K.input_index_map)||void 0===k?void 0:k[0],Bn=null===(w=null==K?void 0:K.input_index_map)||void 0===w?void 0:w[1],On="left"===M?Bn:Rn,jn="left"===M?!kn:!_n,En=B.evaluationResult||(null==_n?void 0:_n.evaluationResult)||(null==kn?void 0:kn.evaluationResult),Wn=null!==(F=null===(C=null==En?void 0:En.evaluation_outputs)||void 0===C?void 0:C.output_value)&&void 0!==F?F:null,Mn=sn+1,Nn=B.id||(null==_n?void 0:_n.id)||(null==kn?void 0:kn.id);"right"===M&&D&&(vn&&-1!==(Pn=G.findIndex(function(n){return n.id===vn.id}))&&(Mn=Pn+1));var Tn=null!==(R=null===(I=null===(P=null==En?void 0:En.evaluation_outputs)||void 0===P?void 0:P.metadata)||void 0===I?void 0:I.label_color)&&void 0!==R?R:g,zn=h(Tn),An=zn.highlightBg,Dn=(null==En?void 0:En.deviations)||{},Gn=[],Hn=Object.entries(Dn).map(function(t){var i=t[0],e=t[1],o="".concat(Nn).concat(m).concat(i),l=L[o];if(!l)return null;var r=e[T],a=p(r);if(a)r="";else if(!r)return null;Gn.push(r);var u=e[On],d=!1;u&&(d=Object.values(Dn).map(function(n){return n[On]}).filter(Boolean).some(function(n){return n.length>u.length&&n.includes(u)}));var c=jn||p(u)||d,s="".concat(Mn,".").concat(l),v="".concat(Nn).concat(m).concat(i).concat(m).concat(hn).concat(m).concat(pn),f=n({},zn),h=(null==e?void 0:e.deviation_summary)?{deviation_summary:e.deviation_summary||(null==En?void 0:En.deviation_summary),deviation_title:null==En?void 0:En.deviation_title,evaluation_outputs:null==En?void 0:En.evaluation_outputs}:null;return{id:o,actionId:v,label:s,highlight:r,side:M,style:f,score:Wn,isConnected:U.has(v),isOrphan:c,isMissingClause:a,badgeRef:X(M,o),onClick:function(t){t.stopPropagation();var i=_n?n(n({},_n),{title:(null==vn?void 0:vn.title)||(null==_n?void 0:_n.title)||""}):{id:"orphan-left",title:"",content:""},e=kn?n(n({},kn),{title:(null==fn?void 0:fn.title)||(null==kn?void 0:kn.title)||""}):{id:"orphan-right",title:"",content:""};Y(t,i,c,e,v,f)},onSummaryClick:function(n){n.stopPropagation(),Z(n,v,c,h)}}}).filter(Boolean).sort(function(n,t){return parseFloat(n.label)-parseFloat(t.label)}),Kn=o(!1);l(function(){un||(Kn.current=!1)},[un]),l(function(){if(un&&!Kn.current){var n=setTimeout(function(){var n,t;Kn.current=!0;var i=null===(t=null===(n=Hn[0])||void 0===n?void 0:n.badgeRef)||void 0===t?void 0:t.current;i&&i.scrollIntoView({behavior:"smooth",block:"center"})},350);return function(){return clearTimeout(n)}}},[un,Hn]);var Ln=Hn.some(function(n){return U.has(n.actionId)});if(!(on||ln||B.subsections&&0!==B.subsections.length))return null;var Un=!D&&on&&ln,Vn=Ln&&In?{borderRadius:"4px",outline:"2px solid ".concat(In.badgeBorder),outlineOffset:"1px"}:{};return t(r,on?n({ref:dn,sx:{mt:1,width:"100%",minWidth:0,position:"relative"}},{children:t(r,n({sx:n({width:"100%"},Vn)},{children:i(a,n({disableGutters:!0,expanded:!rn&&un,onChange:function(){if(!rn){if(un){var t=String(V||""),i=t.includes(hn)||t.includes(pn);i||U.forEach(function(n){(String(n).includes(hn)||String(n).includes(pn))&&(i=!0)}),i&&($(),nn(new Set),tn([]),en.current=[])}A(function(t){var i;return n(n({},t),((i={})[O]=!t[O],i))})}},sx:{mt:0,boxShadow:"none",border:rn?"1px dashed #E2E8F0":"1px solid #EEF2F7",borderRadius:"4px !important",bgcolor:"#FFFFFF",minWidth:0,"&:before":{display:"none"}}},{children:[t(u,n({expandIcon:rn?null:t(s,{size:14}),sx:{minHeight:"32px","& .MuiAccordionSummary-content":{my:.5,display:"grid",alignItems:"center",minWidth:0,width:"100%"}}},{children:t(d,n({component:"div",sx:{fontSize:"11px",fontWeight:600,color:rn?"#94A3B8":"#19213D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0}},{children:an||"Untitled Subsection"}))})),!rn&&i(c,n({sx:{pt:0,pb:1,minWidth:0}},{children:[ln&&t(v,{content:B.content,sxStyles:q,deviationBadges:Un?[]:Hn,maintainRelativeOrder:D,highlightBg:An,highlights:Gn}),(B.subsections||[]).map(function(i,o){return t(b,n({},e,{section:i,keyPath:"".concat(O,"-").concat(o),depth:E+1}),"".concat(O,"-").concat(o))})]}))]}))}))}):n({ref:dn,sx:{mt:0===E?1:.75,width:"100%",minWidth:0,position:"relative"}},{children:!rn&&i(r,n({sx:n({width:"100%"},Vn)},{children:[ln&&t(v,{content:B.content,sxStyles:q,deviationBadges:Hn,maintainRelativeOrder:D,highlightBg:An,highlights:Gn}),(B.subsections||[]).map(function(i,o){return t(b,n({},e,{section:i,keyPath:"".concat(O,"-").concat(o),depth:E+1}),"".concat(O,"-").concat(o))})]}))}))});export{b as default};
|
|
2
2
|
//# sourceMappingURL=SubSectionAccordion.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as e,__rest as
|
|
1
|
+
import{__assign as e,__rest as n,__spreadArray as r}from"tslib";import{jsx as o,jsxs as t}from"react/jsx-runtime";import{Box as i,Typography as a}from"@mui/material";import l,{useMemo as c}from"react";import{DEFAULT_DEVIAION_COLOR as s}from"../CognitiveCompareConstants.js";import{EllipsisVertical as p}from"lucide-react";import d from"react-markdown";import{safeStringify as h,areMarkdownPropsEqual as f}from"../CognitiveComparehelpers.js";import g from"rehype-raw";var u=l.memo(function(l){var f=l.content,u=l.sxStyles,m=l.deviationBadges,v=void 0===m?[]:m,x=l.highlights,b=void 0===x?[]:x,y=l.maintainRelativeOrder,_=void 0===y||y,C=l.highlightBg,w=c(function(){return v.reduce(function(n,r){var o;return e(e({},n),((o={})[r.id]=r,o))},{})},[v]),E=c(function(){return{mark:function(n){var r=n.children;return o("span",e({style:{backgroundColor:C,borderRadius:"2px"}},{children:r}))},span:function(r){var a,l,c,d,h,f,g=r.children,u=n(r,["children"]),m=u["data-badge-id"];if(!m)return o("span",e({},u,{children:g}));var v=w[m];return v?t(i,e({component:"span",sx:{position:"static",display:"inline"}},{children:[t(i,e({ref:v.badgeRef,sx:e(e({fontStyle:"normal",position:"absolute",zIndex:30,display:"inline-flex",alignItems:"stretch",fontSize:"10px",bgcolor:(null===(a=v.style)||void 0===a?void 0:a.badgeBg)||"#EEF2FF",color:(null===(l=v.style)||void 0===l?void 0:l.badgeText)||s,border:"1px solid ".concat((null===(c=v.style)||void 0===c?void 0:c.badgeBorder)||"#C7D2FE"),borderRadius:"12px",fontWeight:600,whiteSpace:"nowrap",boxShadow:"0 1px 3px rgba(0,0,0,0.07)",overflow:"hidden"},"left"===v.side?{right:"-16px",transform:"translateY(-20%) translateX(calc(100% + 8px))"}:{left:"-16px",transform:"translateY(-20%) translateX(calc(-100% - 8px))"}),v.isConnected&&v.style&&{outline:"2px solid ".concat(v.style.badgeBorder),outlineOffset:"1px"})},{children:[t(i,e({onClick:function(e){e.stopPropagation(),v.onSummaryClick&&v.onSummaryClick(e)},sx:{display:"flex",alignItems:"center",px:1,py:.3,cursor:"pointer","&:hover":{bgcolor:"rgba(0,0,0,0.04)"}}},{children:[o(i,e({component:"span",sx:{fontSize:"10px",fontWeight:700}},{children:v.label})),("left"===v.side||v.isOrphan)&&o(i,e({component:"span",sx:{fontSize:"10px",pl:.5,ml:.5,borderLeft:"1px solid ".concat((null===(d=v.style)||void 0===d?void 0:d.badgeBorder)||"#C7D2FE")}},{children:null!=v.score&&"N/A"!==v.score&&"NA"!==v.score&&0!==v.score?"".concat(v.score):"N/A"===v.score||"NA"===v.score?"N/A":"Same"}))]})),("left"===v.side||v.isOrphan)&&o(i,e({onClick:function(e){e.stopPropagation(),v.onClick&&v.onClick(e)},sx:{display:"flex",alignItems:"center",px:.5,borderLeft:"1px solid ".concat((null===(h=v.style)||void 0===h?void 0:h.badgeBorder)||"#C7D2FE"),cursor:"pointer","&:hover":{bgcolor:"rgba(0,0,0,0.06)"}}},{children:o(p,{size:12,color:(null===(f=v.style)||void 0===f?void 0:f.badgeText)||"#3730A3"})}))]})),g]})):o("span",e({},u,{children:g}))}}},[w,_]),S=c(function(){var e=function(e){return e?e.replace(/\\([''])/g,"$1").replace(/\\n/g,"\n").replace(/\r\n/g,"\n").split(/(\n{2,})/).map(function(e){return e.startsWith("\n")?e:e.replace(/\n/g," ")}).join(""):""},n=function(e,n,r){void 0===n&&(n=""),void 0===r&&(r="");var o=e.startsWith("\n\n"),t=e.endsWith("\n\n");return n+e.split(/(\n{2,})/).map(function(e,n,r){if(/^\n{2,}$/.test(e))return e;if(!e.trim())return e;var i=0===n||1===n&&/^\n{2,}$/.test(r[0]),a=n===r.length-1||n===r.length-2&&/^\n{2,}$/.test(r[r.length-1]);return o&&i||t&&a?e:"<mark>".concat(e,"</mark>")}).join("").replace(/^\n{2,}/,"").replace(/\n{2,}$/,"")+r},o=e(h(f||"")),t=r([],v,!0).sort(function(e,n){var r,o;return((null===(r=n.highlight)||void 0===r?void 0:r.length)||0)-((null===(o=e.highlight)||void 0===o?void 0:o.length)||0)}),i={},a=0;t.forEach(function(r){if(r&&r.highlight){var t=e(r.highlight);if(t){var l=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),c="__DEV_TOKEN_".concat(a++,"__");i[c]=n(t,'<span data-badge-id="'.concat(r.id,'">'),"</span>"),o=o.replace(t,c);var s="__HIGHLIGHT_TOKEN_".concat(a++,"__");i[s]=n(t),o=o.replace(new RegExp(l,"g"),s)}}});var l=new Set(t.map(function(n){return e(n.highlight)}).filter(Boolean));return b.forEach(function(r){if(r){var t=e(r);if(t&&!l.has(t)){var c=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),s="__PLAIN_TOKEN_".concat(a++,"__");i[s]=n(t),o=o.replace(new RegExp(c,"g"),s)}}}),Object.keys(i).forEach(function(e){o=o.split(e).join(i[e])}),o},[f,v,b]);return o(a,e({component:"div",sx:e(e({},u),{position:"relative",overflow:"visible",whiteSpace:"pre-wrap","& p, & li, & ul, & ol":{position:"static",overflow:"visible",whiteSpace:"pre-wrap"}})},{children:o(d,e({components:E,rehypePlugins:[g]},{children:h(S).replace(/\\n/g,"\n")}))}))},f);export{u as MemoizedMarkdown};
|
|
2
2
|
//# sourceMappingURL=memoizedMarkdown.js.map
|