@viswa-test/test-citation 0.0.56 → 0.0.58
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/features/CognitiveCompare/CognitiveCompare.js +1 -1
- package/dist/cjs/features/CognitiveCompare/CognitiveCompareConstants.js +2 -0
- package/dist/cjs/features/CognitiveCompare/CognitiveCompareConstants.js.map +1 -0
- package/dist/cjs/features/CognitiveCompare/CognitiveComparehelpers.js +1 -1
- package/dist/cjs/features/CognitiveCompare/MoreFunctionsPopup.js +1 -1
- package/dist/cjs/features/CognitiveCompare/components/CompareHeader.js +2 -0
- package/dist/cjs/features/CognitiveCompare/components/CompareHeader.js.map +1 -0
- package/dist/cjs/features/CognitiveCompare/components/SectionAccordion.js +2 -0
- package/dist/cjs/features/CognitiveCompare/components/SectionAccordion.js.map +1 -0
- package/dist/cjs/features/CognitiveCompare/components/SubSectionAccordion.js +2 -0
- package/dist/cjs/features/CognitiveCompare/components/SubSectionAccordion.js.map +1 -0
- package/dist/cjs/features/CognitiveCompare/hooks/memoizedMarkdown.js +2 -0
- package/dist/cjs/features/CognitiveCompare/hooks/memoizedMarkdown.js.map +1 -0
- package/dist/cjs/features/CognitiveCompare/hooks/useAccordionState.js +2 -0
- package/dist/cjs/features/CognitiveCompare/hooks/useAccordionState.js.map +1 -0
- package/dist/cjs/features/CognitiveCompare/hooks/useCompareData.js +2 -0
- package/dist/cjs/features/CognitiveCompare/hooks/useCompareData.js.map +1 -0
- package/dist/cjs/features/CognitiveCompare/hooks/useComparePopups.js +2 -0
- package/dist/cjs/features/CognitiveCompare/hooks/useComparePopups.js.map +1 -0
- package/dist/cjs/features/CognitiveCompare/hooks/useDeviationNavigation.js +2 -0
- package/dist/cjs/features/CognitiveCompare/hooks/useDeviationNavigation.js.map +1 -0
- package/dist/cjs/features/CognitiveCompare/hooks/useSectionRefs.js +2 -0
- package/dist/cjs/features/CognitiveCompare/hooks/useSectionRefs.js.map +1 -0
- package/dist/features/CognitiveCompare/CognitiveCompare.js +1 -1
- package/dist/features/CognitiveCompare/CognitiveCompareConstants.js +2 -0
- package/dist/features/CognitiveCompare/CognitiveCompareConstants.js.map +1 -0
- package/dist/features/CognitiveCompare/CognitiveComparehelpers.js +1 -1
- package/dist/features/CognitiveCompare/MoreFunctionsPopup.js +1 -1
- package/dist/features/CognitiveCompare/components/CompareHeader.js +2 -0
- package/dist/features/CognitiveCompare/components/CompareHeader.js.map +1 -0
- package/dist/features/CognitiveCompare/components/SectionAccordion.js +2 -0
- package/dist/features/CognitiveCompare/components/SectionAccordion.js.map +1 -0
- package/dist/features/CognitiveCompare/components/SubSectionAccordion.js +2 -0
- package/dist/features/CognitiveCompare/components/SubSectionAccordion.js.map +1 -0
- package/dist/features/CognitiveCompare/hooks/memoizedMarkdown.js +2 -0
- package/dist/features/CognitiveCompare/hooks/memoizedMarkdown.js.map +1 -0
- package/dist/features/CognitiveCompare/hooks/useAccordionState.js +2 -0
- package/dist/features/CognitiveCompare/hooks/useAccordionState.js.map +1 -0
- package/dist/features/CognitiveCompare/hooks/useCompareData.js +2 -0
- package/dist/features/CognitiveCompare/hooks/useCompareData.js.map +1 -0
- package/dist/features/CognitiveCompare/hooks/useComparePopups.js +2 -0
- package/dist/features/CognitiveCompare/hooks/useComparePopups.js.map +1 -0
- package/dist/features/CognitiveCompare/hooks/useDeviationNavigation.js +2 -0
- package/dist/features/CognitiveCompare/hooks/useDeviationNavigation.js.map +1 -0
- package/dist/features/CognitiveCompare/hooks/useSectionRefs.js +2 -0
- package/dist/features/CognitiveCompare/hooks/useSectionRefs.js.map +1 -0
- package/dist/types/src/CognitiveCompareTest.d.ts.map +1 -1
- package/dist/types/src/CommonConstants/CommonConstants.d.ts +0 -5266
- package/dist/types/src/CommonConstants/CommonConstants.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/CognitiveCompareConstants.d.ts +10 -0
- package/dist/types/src/features/CognitiveCompare/CognitiveCompareConstants.d.ts.map +1 -0
- package/dist/types/src/features/CognitiveCompare/CognitiveCompareTypes.d.ts +24 -0
- package/dist/types/src/features/CognitiveCompare/CognitiveCompareTypes.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/CognitiveComparehelpers.d.ts +8 -0
- package/dist/types/src/features/CognitiveCompare/CognitiveComparehelpers.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/components/CompareHeader.d.ts +10 -0
- package/dist/types/src/features/CognitiveCompare/components/CompareHeader.d.ts.map +1 -0
- package/dist/types/src/features/CognitiveCompare/components/SectionAccordion.d.ts +30 -0
- package/dist/types/src/features/CognitiveCompare/components/SectionAccordion.d.ts.map +1 -0
- package/dist/types/src/features/CognitiveCompare/components/SubSectionAccordion.d.ts +30 -0
- package/dist/types/src/features/CognitiveCompare/components/SubSectionAccordion.d.ts.map +1 -0
- package/dist/types/src/features/CognitiveCompare/hooks/memoizedMarkdown.d.ts +10 -0
- package/dist/types/src/features/CognitiveCompare/hooks/memoizedMarkdown.d.ts.map +1 -0
- package/dist/types/src/features/CognitiveCompare/hooks/useAccordionState.d.ts +31 -0
- package/dist/types/src/features/CognitiveCompare/hooks/useAccordionState.d.ts.map +1 -0
- package/dist/types/src/features/CognitiveCompare/hooks/useCompareData.d.ts +13 -0
- package/dist/types/src/features/CognitiveCompare/hooks/useCompareData.d.ts.map +1 -0
- package/dist/types/src/features/CognitiveCompare/hooks/useCompareLayout.d.ts +24 -0
- package/dist/types/src/features/CognitiveCompare/hooks/useCompareLayout.d.ts.map +1 -0
- package/dist/types/src/features/CognitiveCompare/hooks/useComparePopups.d.ts +17 -0
- package/dist/types/src/features/CognitiveCompare/hooks/useComparePopups.d.ts.map +1 -0
- package/dist/types/src/features/CognitiveCompare/hooks/useDeviationNavigation.d.ts +26 -0
- package/dist/types/src/features/CognitiveCompare/hooks/useDeviationNavigation.d.ts.map +1 -0
- package/dist/types/src/features/CognitiveCompare/hooks/useSectionRefs.d.ts +20 -0
- package/dist/types/src/features/CognitiveCompare/hooks/useSectionRefs.d.ts.map +1 -0
- package/package.json +2 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as e,__rest as n,__spreadArray as t}from"tslib";import{jsx as i,jsxs as o,Fragment as l}from"react/jsx-runtime";import r,{useMemo as c,useState as u,useRef as a,useEffect as d,useCallback as s}from"react";import{Box as v,Typography as f,Snackbar as p,Alert as h,FormControlLabel as g,Switch as x,Tooltip as m,Accordion as b,AccordionSummary as y,AccordionDetails as I}from"@mui/material";import{EllipsisVertical as S,ChevronDown as R}from"lucide-react";import{ButtonCognitiveIcon as w}from"../../assests/svg/ButtonCognitiveIcon.js";import _ from"./OverlayComponent.js";import C from"react-markdown";import{safeStringify as E,generateColorPalette as T,hasValue as B,getSideData as F,getRationale as M}from"./CognitiveComparehelpers.js";import{SHARED_MARKDOWN_STYLES as k,DEFAULT_FIELD_CONFIG as D,DEFAULT_COMPARISON_CONFIG as A}from"./CognitiveCompareConfig.js";export{SHARED_MARKDOWN_STYLES}from"./CognitiveCompareConfig.js";import H from"./CognitivePopup.js";import O from"./MoreFunctionsPopup.js";import L from"./LoaderComponent.js";import N from"rehype-raw";import W from"./components/ThreeDotsLoader.js";var z="::",j=function(e){if(!e)return!0;var n=e.trim().toLowerCase();return n.includes("no equivalent")||"n/a"===n||"na"===n||"none"===n},P=function(e,n){var t,i,o,l,r,c,u;if(!e)return n;var a=null!==(c=null!==(l=null!==(i=null===(t=e.evaluation_output)||void 0===t?void 0:t.output_score)&&void 0!==i?i:null===(o=e.evaluation_outputs)||void 0===o?void 0:o.output_score)&&void 0!==l?l:null===(r=e.evaluation_outputs)||void 0===r?void 0:r.output_value)&&void 0!==c?c:e.output_score;return null!==(u=null!=a?a:n)&&void 0!==u?u:""},Y=r.memo(function(t){var r=t.content,u=t.sxStyles,a=t.deviationBadges,d=void 0===a?[]:a,s=t.highlights,p=void 0===s?[]:s,h=t.maintainRelativeOrder,g=void 0===h||h,x=t.highlightBg,m=c(function(){return d.reduce(function(n,t){var i;return e(e({},n),((i={})[t.id]=t,i))},{})},[d]),b=c(function(){return{mark:function(n){var t=n.children;return i("span",e({style:{backgroundColor:x,borderRadius:"2px"}},{children:t}))},span:function(t){var r,c,u,a,d,s=t.children,f=n(t,["children"]),p=f["data-badge-id"];if(!p)return i("span",e({},f,{children:s}));var h=m[p];return h?o(v,e({component:"span",sx:{position:"static",display:"inline"}},{children:[s,i(v,e({ref:h.badgeRef,onClick:h.onClick,sx:e(e({position:"absolute",zIndex:30,display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"10px",bgcolor:(null===(r=h.style)||void 0===r?void 0:r.badgeBg)||"#EEF2FF",color:(null===(c=h.style)||void 0===c?void 0:c.badgeText)||q,border:"1px solid ".concat((null===(u=h.style)||void 0===u?void 0:u.badgeBorder)||"#C7D2FE"),borderRadius:"12px",px:1,py:.3,fontWeight:600,cursor:"pointer",whiteSpace:"nowrap",boxShadow:"0 1px 3px rgba(0,0,0,0.07)"},"left"===h.side?{right:"-16px",transform:"translateY(-20%) translateX(calc(100% + 8px))"}:{left:"-16px",transform:"translateY(-20%) translateX(calc(-100% - 8px))"}),h.isConnected&&h.style&&{outline:"2px solid ".concat(h.style.badgeBorder),outlineOffset:"1px"})},{children:o(l,{children:[i(v,e({component:"span",sx:e({fontSize:"10px",fontWeight:700},"left"===h.side?{pr:.5,borderRight:"1px solid ".concat((null===(a=h.style)||void 0===a?void 0:a.badgeBorder)||"#C7D2FE")}:{})},{children:h.label})),"left"===h.side&&o(l,{children:[i(v,e({component:"span",sx:{fontSize:"10px",px:.25}},{children:null!=h.score&&"N/A"!==h.score&&"NA"!==h.score&&0!==h.score?"".concat(h.score):"N/A"===h.score||"NA"===h.score?"N/A":"Same"})),i(S,{size:10,color:(null===(d=h.style)||void 0===d?void 0:d.badgeText)||"#3730A3"})]})]})}))]})):i("span",e({},f,{children:s}))}}},[m,g]),y=c(function(){var e=r||"",n={},t=0;return function(){var i=null==d?void 0:d[0];if(i&&i.highlight){var o=i.highlight.replace(/\\(['’])/g,"$1"),l="__DEV_TOKEN_".concat(t++,"__");n[l]='<span data-badge-id="'.concat(i.id,'"><mark>').concat(o,"</mark></span>"),e=e.replace(o,l)}}(),p.forEach(function(i){if(i){var o=i.replace(/\\(['’])/g,"$1"),l="__HL_TOKEN_".concat(t++,"__");n[l]="<mark>".concat(o,"</mark>"),e=e.split(o).join(l)}}),Object.keys(n).forEach(function(t){e=e.split(t).join(n[t])}),e},[r,d,p]);return i(f,e({component:"div",sx:e(e({},u),{position:"relative",overflow:"visible","& p, & li, & ul, & ol":{position:"static",overflow:"visible"}})},{children:i(C,e({components:b,rehypePlugins:[N]},{children:E(y).replace(/\\n/g,"\n")}))}))},function(e,n){if(e.content!==n.content)return!1;if(e.sxStyles!==n.sxStyles)return!1;if(e.maintainRelativeOrder!==n.maintainRelativeOrder)return!1;var t=e.highlights||[],i=n.highlights||[];if(t.length!==i.length)return!1;for(var o=0;o<t.length;o++)if(t[o]!==i[o])return!1;var l=e.deviationBadges||[],r=n.deviationBadges||[];if(l.length!==r.length)return!1;for(o=0;o<l.length;o++){if(l[o].id!==r[o].id)return!1;if(l[o].label!==r[o].label)return!1;if(l[o].isConnected!==r[o].isConnected)return!1}return!0}),K=function(e,n,t,i,o){void 0===o&&(o=14);var l=e+.5*(t-e),r=i-n;if(Math.abs(r)<3)return"M ".concat(e," ").concat(n," H ").concat(t);var c=r>0?1:-1,u=Math.min(o,Math.abs(r)/2,Math.abs(l-e)/2,Math.abs(t-l)/2);return["M ".concat(e," ").concat(n),"H ".concat(l-u),"Q ".concat(l," ").concat(n," ").concat(l," ").concat(n+c*u),"V ".concat(i-c*u),"Q ".concat(l," ").concat(i," ").concat(l+u," ").concat(i),"H ".concat(t)].join(" ")},V={id:"",title:""},X={isLoading:!1,open:!1,sectionTitle:"",refSectionTitle:"",cognitiveData:null,anchorEl:null,sectionAnchorEl:null,badgeStyle:null,sectionIdx:null,isOrphan:!1,docData:null,deviationData:null},q="#3730A3",U=function(e,n,t,i,o){void 0===t&&(t=300);var l=e.style.scrollBehavior;e.style.scrollBehavior="auto";var r=e.scrollTop,c=n-r,u=null,a=function(d){null===u&&(u=d);var s,v=d-u;v<t?(e.scrollTop=(s=v,s/=t,c*(--s*s*s+1)+r),o&&o(),requestAnimationFrame(a)):(e.scrollTop=n,e.style.scrollBehavior=l,o&&o(),i&&i())};requestAnimationFrame(a)},$=function(n){var l,C,N,$,G,J,Q,Z,ee,ne,te,ie,oe,le,re,ce,ue,ae=n.componentHeaderText,de=void 0===ae?"Contract Comparison":ae,se=n.treeData,ve=n.comparisonConfig,fe=n.leftColumnTitleText,pe=n.rightColumnTitleText,he=n.markdownStyles,ge=n.displayConfig,xe=void 0===ge?{isHeaderVisible:!0,isToggleVisible:!0,maintainRelativeOrder:!1,isLoading:!0}:ge,me=n.popupConfig,be=n.deviationData,ye=void 0===be?{}:be,Ie=u(xe.maintainRelativeOrder),Se=Ie[0],Re=Ie[1],we=u(!1),_e=we[0],Ce=we[1],Ee=u(!1),Te=Ee[0],Be=Ee[1],Fe=u(null),Me=Fe[0],ke=Fe[1],De=u(!1),Ae=De[0],He=De[1],Oe=u(!1),Le=Oe[0],Ne=Oe[1],We=a(!1),ze=u(null),je=ze[0],Pe=ze[1],Ye=u(new Set),Ke=Ye[0],Ve=Ye[1],Xe=u([]),qe=Xe[0],Ue=Xe[1],$e=a(null),Ge=a(!1),Je=a(null),Qe=a({}),Ze=a([]),en=a(!1),nn=a(!1),tn=a(null),on=c(function(){return(null==se?void 0:se.cognitive_decisioning)||{}},[se]),ln=u(null),rn=ln[0],cn=ln[1],un=a(null),an=u({width:0,height:0}),dn=an[0],sn=an[1],vn=c(function(){return e(e({},k),he)},[he]),fn=u({isLoading:null!==(l=null==xe?void 0:xe.isLoading)&&void 0!==l&&l,open:!1,sectionTitle:"",refSectionTitle:"",cognitiveData:null,anchorEl:null,isOrphan:!1,sectionAnchorEl:null,badgeStyle:null,sectionIdx:null,docData:null,deviationData:null}),pn=fn[0],hn=fn[1],gn=u({isLoading:null!==(C=null==xe?void 0:xe.isLoading)&&void 0!==C&&C,open:!1,sectionTitle:"",refSectionTitle:"",cognitiveData:null,anchorEl:null,isOrphan:!1,sectionAnchorEl:null,badgeStyle:null,sectionIdx:null,docData:null,deviationData:null}),xn=gn[0],mn=gn[1],bn=a(null),yn=a(null),In=a(null),Sn=a(null),Rn=a(null),wn=a(null),_n=a(null),Cn=a(null),En=a(!1),Tn=a(null);d(function(){Tn.current=null},[pn.sectionIdx,pn.open]);var Bn=s(function(){cn(null),hn(X),Pe(null)},[]),Fn=s(function(){mn(X)},[]),Mn=s(function(){var e;if(pn.anchorEl&&pn.refSectionTitle){var n=pn.anchorEl.getBoundingClientRect(),t=(null===(e=null==un?void 0:un.current)||void 0===e?void 0:e.offsetHeight)||0,i=Math.min(680,window.innerWidth-24),o=window.innerHeight-n.bottom-12-12,l=n.top-12-12,r=o<t&&l>o;null!==Tn.current?!0===Tn.current&&(r=l>=t||l>=o):r=!(o>=t||o>=l),Tn.current=r;var c=r?l:o,u=Math.min(t||9999,c),a=r?n.top-12-u:n.bottom+12,d=n.left+n.width/2,s=d-i/2,v=Math.max(12,Math.min(s,window.innerWidth-i-12)),f=Math.max(14,Math.min(d-v,i-10-4));cn({top:a,left:v,arrowLeft:f,openAbove:r,maxHeight:c})}},[pn.anchorEl,pn.refSectionTitle]);d(function(){if(pn.open){window.addEventListener("resize",Mn);var e=requestAnimationFrame(Mn),n=null;return un.current&&(n=new ResizeObserver(function(){cancelAnimationFrame(e),e=requestAnimationFrame(Mn)})).observe(un.current),function(){cancelAnimationFrame(e),window.removeEventListener("resize",Mn),n&&n.disconnect()}}},[pn.open,Mn]),d(function(){var e=bn.current;if(e&&pn.open){var n=function(e){un.current&&un.current.contains(e.target)||(cn(null),Bn())};return e.addEventListener("scroll",n,{capture:!0}),window.addEventListener("scroll",n,{capture:!0}),function(){e.removeEventListener("scroll",n,{capture:!0}),window.removeEventListener("scroll",n,{capture:!0})}}},[pn.open,Bn]),d(function(){var e=bn.current;if(e&&xn.open){var n=function(){Fn()};return e.addEventListener("scroll",n,{capture:!0}),window.addEventListener("scroll",n,{capture:!0}),function(){e.removeEventListener("scroll",n,{capture:!0}),window.removeEventListener("scroll",n,{capture:!0})}}},[xn.open,Fn]);var kn=c(function(){var e,n,t,i,o,l,r;return{fields:null!==(e=null==ve?void 0:ve.fields)&&void 0!==e?e:D,thresholds:{high:null!==(t=null===(n=null==ve?void 0:ve.thresholds)||void 0===n?void 0:n.high)&&void 0!==t?t:A.thresholds.high,medium:null!==(o=null===(i=null==ve?void 0:ve.thresholds)||void 0===i?void 0:i.medium)&&void 0!==o?o:A.thresholds.medium,exact:null!==(r=null===(l=null==ve?void 0:ve.thresholds)||void 0===l?void 0:l.exact)&&void 0!==r?r:A.thresholds.exact}}},[ve]),Dn=c(function(){if(se&&Object.keys(se).length>0)try{var n=function(n,i,o){var l,r,c,u;void 0===i&&(i=!1),void 0===o&&(o=null);var a=n.nodes||n,d=[],s=[],v=n.base_root_id,f=n.input_index_map||{0:"left",1:"right"},p=n[v]||a[v];if(!p||!1===p.display_node)return{activeProposed:{title:"No Data",sections:[]},activeVariants:[]};var h=function(t,i){var l,r,c,u=n[t]||a[t];if(!u||!1===u.display_node)return null;var d=F(u,i,f),s=!1!==(null===(l=d.attributes)||void 0===l?void 0:l.display_title),v=!1!==(null===(r=d.attributes)||void 0===r?void 0:r.display_content),p=!!d.title.trim(),g=!!d.content.trim(),x=M(u),m=(null===(c=null==o?void 0:o[t])||void 0===c?void 0:c.evaluation_result)||u.evaluation_result||null,b=[];u.next&&Object.values(u.next).forEach(function(e){var n=a[e];if(n&&!1!==n.display_node){var t=h(e,i);t&&b.push(t)}});var y=!(!p&&!g);return e(e({id:t,title:p?d.title:"",content:g?d.content:"",displayTitle:s,displayContent:v,subsections:b},y?x:{score:void 0,relation:"not_defined"}),{evaluationResult:m})};if(i){var g=function(i,l){var r,c,u,d,s,v,p,h,x,m,b,y,I,S,R,w,_,C,E,T,B;void 0===l&&(l=0);var k=[],D=[];if(!i)return{refSections:k,baseSections:D};var A={},H={},O=-1,L=-1;for(var N in i){var W=i[N],z=n[W]||a[W];if(z&&!1!==z.display_node){var j=M(z),P=(null===(r=null==o?void 0:o[W])||void 0===r?void 0:r.evaluation_result)||z.evaluation_result||null,Y=F(z,"1",f),K=F(z,"0",f),V=!1!==(null===(c=Y.attributes)||void 0===c?void 0:c.display_title)&&Y.title.trim()||!1!==(null===(u=Y.attributes)||void 0===u?void 0:u.display_content)&&Y.content.trim(),X=!1!==(null===(d=K.attributes)||void 0===d?void 0:d.display_title)&&K.title.trim()||!1!==(null===(s=K.attributes)||void 0===s?void 0:s.display_content)&&K.content.trim(),q=Number(null!==(p=null===(v=Y.attributes)||void 0===v?void 0:v.display_index)&&void 0!==p?p:O--),U=Number(null!==(x=null===(h=K.attributes)||void 0===h?void 0:h.display_index)&&void 0!==x?x:L--),$=A[q]||e(e({id:W,title:!1!==(null===(m=Y.attributes)||void 0===m?void 0:m.display_title)?Y.title:"",content:!1!==(null===(b=Y.attributes)||void 0===b?void 0:b.display_content)?Y.content:"",subsections:[]},V?j:{score:void 0,relation:"not_defined"}),{refIndexes:[],selfIndex:q,evaluationResult:P,displayContent:null===(y=Y.attributes)||void 0===y?void 0:y.display_content,displayTitle:null===(I=Y.attributes)||void 0===I?void 0:I.display_title}),G=H[U]||e(e({id:W,title:!1!==(null===(S=K.attributes)||void 0===S?void 0:S.display_title)?K.title:"",content:!1!==(null===(R=K.attributes)||void 0===R?void 0:R.display_content)?K.content:"",subsections:[]},X?j:{score:void 0,relation:"not_defined"}),{refIndexes:[],selfIndex:U,evaluationResult:P,displayContent:null===(w=K.attributes)||void 0===w?void 0:w.display_content,displayTitle:null===(_=K.attributes)||void 0===_?void 0:_.display_title});Number(q)>=0&&Number(U)>=0&&((null===(C=$.refIndexes)||void 0===C?void 0:C.includes(Number(U)))||null===(E=$.refIndexes)||void 0===E||E.push(Number(U)),(null===(T=G.refIndexes)||void 0===T?void 0:T.includes(Number(q)))||null===(B=G.refIndexes)||void 0===B||B.push(Number(q))),A[q]=$,H[U]=G;var J=g(z.next,l+1),Q=J.refSections,Z=J.baseSections;Q.length>0&&($.subsections=t(t([],$.subsections||[],!0),Q,!0)),Z.length>0&&(G.subsections=t(t([],G.subsections||[],!0),Z,!0))}}return k=Object.values(A).map(function(e){return e}),D=Object.values(H).map(function(e){return e}),k.sort(function(e,n){return e.selfIndex<0&&n.selfIndex>=0?1:e.selfIndex>=0&&n.selfIndex<0?-1:e.selfIndex-n.selfIndex}),D.sort(function(e,n){return e.selfIndex<0&&n.selfIndex>=0?1:e.selfIndex>=0&&n.selfIndex<0?-1:e.selfIndex-n.selfIndex}),{refSections:k,baseSections:D}},x=g(p.next),m=x.refSections,b=x.baseSections;s=m,d=b}else p.next&&Object.values(p.next).forEach(function(e){var t=n[e]||a[e];t&&!1!==t.display_node&&(d.push(h(e,"0")||{id:e,title:"",content:"",subsections:[]}),s.push(h(e,"1")||{id:e,title:"",content:"",subsections:[]}))});return{activeProposed:{title:(null===(r=null===(l=p.comparison_inputs)||void 0===l?void 0:l[f[0]])||void 0===r?void 0:r.title)||"Uploaded Contract",description:p.decision_scope_description||"",sections:d},activeVariants:[{id:"tree-variant-1",title:(null===(u=null===(c=p.comparison_inputs)||void 0===c?void 0:c[f[1]])||void 0===u?void 0:u.title)||"Reference Template",similarity:0,sections:s,analysis:{rule_difference_comparison:{summary:{overall_score:0,overall_summary:p.decision_scope_description||""},fields:{}}}}]}}(se,Se,ye);return e(e({},n),{parseError:null})}catch(e){return console.error("Data Transformation Error: ",e),{activeProposed:{},activeVariants:[],parseError:e instanceof Error?e.message:"Unknown Parsing Error"}}return{activeProposed:{},activeVariants:[],parseError:"Tree data is required"}},[JSON.stringify(se),Se,JSON.stringify(ye)]),An=Dn.activeProposed,Hn=Dn.activeVariants,On=Dn.parseError;d(function(){On&&ke("Failed to load comparison: ".concat(On))},[On]);var Ln=u(null),Nn=Ln[0];Ln[1];var Wn=u({}),zn=Wn[0],jn=Wn[1],Pn=u({}),Yn=Pn[0],Kn=Pn[1],Vn=(null==Hn?void 0:Hn[0])||V,Xn=null===(G=null===(N=null==se?void 0:se.documents)||void 0===N?void 0:N[null===($=null==se?void 0:se.input_index_map)||void 0===$?void 0:$[0]])||void 0===G?void 0:G.title,qn=null===(Z=null===(J=null==se?void 0:se.documents)||void 0===J?void 0:J[null===(Q=null==se?void 0:se.input_index_map)||void 0===Q?void 0:Q[1]])||void 0===Z?void 0:Z.title,Un=E(fe||Xn||"Uploaded Contract"),$n=E(pe||qn||"Reference Template"),Gn=c(function(){return(null==An?void 0:An.sections)||[]},[null==An?void 0:An.sections]),Jn=c(function(){return Vn.sections||[]},[Vn.sections]),Qn=Gn.length>0||Jn.length>0,Zn=Vn.analysis,et=E(null===(ne=null===(ee=null==Zn?void 0:Zn.rule_difference_comparison)||void 0===ee?void 0:ee.summary)||void 0===ne?void 0:ne.overall_summary),nt=!!et.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),tt=null!==(te=null==se?void 0:se.base_root_id)&&void 0!==te?te:"-1";null==se||se[tt];var it=(null===(ie=null==ye?void 0:ye[tt])||void 0===ie?void 0:ie.evaluation_result)||(null===(le=null===(oe=null==se?void 0:se.nodes)||void 0===oe?void 0:oe[tt])||void 0===le?void 0:le.evaluation_result)||null,ot=P(it),lt=T(null!==(ue=null===(ce=null===(re=null==it?void 0:it.evaluation_outputs)||void 0===re?void 0:re.metadata)||void 0===ce?void 0:ce.label_color)&&void 0!==ue?ue:""),rt=c(function(){var e,n,t={},i={},o=null===(e=null==se?void 0:se.input_index_map)||void 0===e?void 0:e[0],l=null===(n=null==se?void 0:se.input_index_map)||void 0===n?void 0:n[1],r=new Map,c=function(e){return e&&e.id?(r.has(e.id)||r.set(e.id,E(e.content||"").replace(/\\n/g,"\n")),r.get(e.id)):""},u=function(e,n,a,d,s){var v,f,p,h,g,x,m,b;e&&!s&&function(e,n,u,a){var d,s=(null===(d=null==e?void 0:e.evaluationResult)||void 0===d?void 0:d.deviations)||{};Object.keys(s).sort().forEach(function(d){var v=s[d];if(v){var f=v[o],p=v[l],h=!1,g=!1;if(!j(f)){var x=f.replace(/\\(['’])/g,"$1").replace(/\\n/g,"\n");if(n&&x){var m=c(n);m.includes(x)&&(h=!0,r.set(n.id,m.replace(x,"__TOKEN__")))}}if(!j(p)){var b=p.replace(/\\(['’])/g,"$1").replace(/\\n/g,"\n");if(u&&b){var y=c(u);y.includes(b)&&(g=!0,r.set(u.id,y.replace(b,"__TOKEN__")))}}if(h||g){var I="".concat(e.id).concat(z).concat(d);void 0===t[I]&&(void 0===i[a]&&(i[a]=1),t[I]=i[a]++)}}})}(e,n,a,d);for(var y=Math.max((null===(v=null==n?void 0:n.subsections)||void 0===v?void 0:v.length)||0,(null===(f=null==a?void 0:a.subsections)||void 0===f?void 0:f.length)||0,(null===(p=null==e?void 0:e.subsections)||void 0===p?void 0:p.length)||0),I=0;I<y;I++)u((null===(h=null==e?void 0:e.subsections)||void 0===h?void 0:h[I])||(null===(g=null==n?void 0:n.subsections)||void 0===g?void 0:g[I])||(null===(x=null==a?void 0:a.subsections)||void 0===x?void 0:x[I]),null===(m=null==n?void 0:n.subsections)||void 0===m?void 0:m[I],null===(b=null==a?void 0:a.subsections)||void 0===b?void 0:b[I],d,!1)};return Gn.forEach(function(e,n){var t,i=n+1;Se&&void 0!==e.selfIndex&&e.selfIndex>=0&&(i=e.selfIndex+1);var o=null;if(Se){var l=null===(t=e.refIndexes)||void 0===t?void 0:t[0];o=Jn.find(function(e){return e.selfIndex===l})}else o=Jn[n];u(e,e,o,i,!0)}),Jn.forEach(function(e,n){var t,i=n+1,o=!1;if(Se){var l=null===(t=e.refIndexes)||void 0===t?void 0:t[0],r=Gn.find(function(e){return e.selfIndex===l});r&&void 0!==r.selfIndex&&r.selfIndex>=0?i=r.selfIndex+1:(o=!0,void 0!==e.selfIndex&&e.selfIndex>=0&&(i=e.selfIndex+1))}else n>=Gn.length&&(o=!0);o&&u(e,null,e,i,!0)}),t},[Gn,Jn,Se,se]),ct=a({}),ut=function(e){return ct.current[e]||(ct.current[e]=r.createRef()),ct.current[e]},at=s(function(){var e,n,t,i;He(!1),nn.current=!1;var o=tn.current,l=gt.current;if(null!==o)if("string"==typeof o&&o.includes(z)){var r=o.split(z);(c=null===(e=Lt.current[r[2]])||void 0===e?void 0:e.current)&&(c.style.paddingTop="0px")}else{var c;(c=null===(n=kt.current[o])||void 0===n?void 0:n.current)&&(c.style.paddingTop="0px")}if(null!==l)if("string"==typeof l&&l.includes(z)){r=l.split(z);(u=null===(t=Nt.current[r[3]])||void 0===t?void 0:t.current)&&(u.style.paddingTop="0px")}else{var u;(u=null===(i=Dt.current[l])||void 0===i?void 0:i.current)&&(u.style.paddingTop="0px")}_t(null),tn.current=null,gt.current=null,Ne(!1),Be(!1),Sn.current&&(Sn.current.style.height="0px"),Rn.current&&(Rn.current.style.height="0px"),wn.current&&(wn.current.style.height="0px"),_n.current&&(_n.current.style.height="0px")},[]),dt=s(function(e,n,t,i,o,l,r){var c,u,a,d=E(null==n?void 0:n.id)||E(null==t?void 0:t.id)||"",s=(d?on[d]:null)||(null==n?void 0:n.cognitiveData)||(null==t?void 0:t.cognitiveData)||{section_id:d,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!==(a=null==xe?void 0:xe.isLoading)&&void 0!==a&&a,open:!0,sectionTitle:(null==n?void 0:n.displayTitle)?null==n?void 0:n.title:"no title",refSectionTitle:(null==t?void 0:t.displayTitle)?null==t?void 0:t.title:"no title",cognitiveData:s,anchorEl:e,sectionAnchorEl:v,badgeStyle:l||null,sectionIdx:i,docData:{documents:null==se?void 0:se.documents,input_index_map:null==se?void 0:se.input_index_map},deviationData:(null==n?void 0:n.evaluationResult)||(null==t?void 0:t.evaluationResult)||null,isOrphan:!!o}},[on,se]),st=s(function(e){Fn(),cn(null),hn(e)},[Fn]),vt=function(e,n,t,i,o,l){e.stopPropagation(),xn.open&&xn.sectionIdx===o?Fn():(Bn(),mn(dt(e.currentTarget,n,i,o,t,l)))},ft=s(function(){null!==xn.sectionIdx&&xn.anchorEl?st(e(e({},xn),{open:!0})):Fn()},[xn,Fn,st]),pt=s(function(){var e=xn.sectionIdx,n=xn.isOrphan;Fn(),null!==e&&(n?ke("No counterpart exists to connect to."):(nn.current&&at(),Ve(function(n){return n.has(e)?new Set:new Set([e])})))},[xn.sectionIdx,Fn,at]),ht=a(null),gt=a(null),xt=a(null),mt=a(null),bt=a(null),yt=u([]),It=yt[0],St=yt[1],Rt=u(null),wt=Rt[0],_t=Rt[1];a(null);var Ct=u(null),Et=Ct[0],Tt=Ct[1],Bt=c(function(){return kn.fields.filter(function(e){var n=e.key;return(!Qn||"description"!==n)&&(B(null==An?void 0:An[n])||B(Vn[n]))})},[An,Vn,Qn,kn.fields]),Ft=a({}),Mt=a({}),kt=a({}),Dt=a({}),At=a({}),Ht=a({}),Ot=a({}),Lt=a({}),Nt=a({});Bt.forEach(function(e){for(var n=e.key,t=0;t<Math.max(Gn.length,Jn.length);t+=1)kt.current[t]||(kt.current[t]=r.createRef()),Dt.current[t]||(Dt.current[t]=r.createRef()),At.current[t]||(At.current[t]=r.createRef()),Ht.current[t]||(Ht.current[t]=r.createRef()),Ot.current[t]||(Ot.current[t]=r.createRef());Ft.current[n]||(Ft.current[n]=r.createRef()),Mt.current[n]||(Mt.current[n]=r.createRef())});for(var Wt=0;Wt<Math.max(Gn.length,Jn.length);Wt+=1)kt.current[Wt]||(kt.current[Wt]=r.createRef()),Dt.current[Wt]||(Dt.current[Wt]=r.createRef()),At.current[Wt]||(At.current[Wt]=r.createRef()),Ht.current[Wt]||(Ht.current[Wt]=r.createRef()),Ot.current[Wt]||(Ot.current[Wt]=r.createRef());d(function(){if(Nn){var e=kn.fields.find(function(e){return e.analysisKey===Nn||e.key===Nn});if(e){var n=Ft.current[e.key]||Mt.current[e.key];(null==n?void 0:n.current)&&setTimeout(function(){return n.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[Nn,kn.fields]);var zt=s(function(e){var n,t,i,o,l,r,c,u,a,d=null===(n=null==Zn?void 0:Zn.rule_difference_comparison)||void 0===n?void 0:n.fields;if(!d||!d[e])return{score:0,relation:"",highlightsA:[],highlightsB:[],hasContent:!1};var s=d[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===(l=null===(o=null==s?void 0:s.highlights)||void 0===o?void 0:o.ruleB_spans)||void 0===l?void 0:l.length)||(null==s?void 0:s.mappings)&&s.mappings.length>0;if(s.mappings){var f=s.mappings[0]||{};return{score:s.score,relation:f.relation||"",highlightsA:(null===(r=f.highlights)||void 0===r?void 0:r.ruleA_spans)||[],highlightsB:(null===(c=f.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===(a=s.highlights)||void 0===a?void 0:a.ruleB_spans)||[],hasContent:!!v}},[Zn]),jt=s(function(n){var t,i,o,l,r,c,u,a=Gn[n],d=Jn[n],s=(null==a?void 0:a.relation)&&"not_defined"!==a.relation,v=(null==d?void 0:d.relation)&&"not_defined"!==d.relation;E(null==a?void 0:a.id)||E(null==d?void 0:d.id);var f=!(!(null==a?void 0:a.cognitiveData)&&!(null==d?void 0:d.cognitiveData));if(!s&&!v&&!f)return e(e({},T(q)),{label:"Not Defined"});var p=null!==(i=null!==(t=null==a?void 0:a.evaluationResult)&&void 0!==t?t:null==d?void 0:d.evaluationResult)&&void 0!==i?i:null,h=null===(o=null==p?void 0:p.evaluation_outputs)||void 0===o?void 0:o.output_value,g=null!==(c=null===(r=null===(l=null==p?void 0:p.evaluation_outputs)||void 0===l?void 0:l.metadata)||void 0===r?void 0:r.label_color)&&void 0!==c?c:q;return e(e({},T(g)),null!=p?{label:null!==(u=h)&&void 0!==u?u:""}:{label:null})},[Gn,Jn,on,kn,zt]),Pt=s(function(n){for(var t,i,o,l,r,c,u,a,d,s=n.split("-").map(Number),v=Gn[s[0]],f=Jn[s[0]],p=1;p<s.length;p++)(null==v?void 0:v.subsections)&&(v=v.subsections[s[p]]),(null==f?void 0:f.subsections)&&(f=f.subsections[s[p]]);if(!v&&!f)return null;var h=(null==v?void 0:v.relation)&&"not_defined"!==v.relation,g=(null==f?void 0:f.relation)&&"not_defined"!==f.relation,x=E(null==v?void 0:v.id)||E(null==f?void 0:f.id)||"",m=!(!(null==v?void 0:v.cognitiveData)&&!(null==f?void 0:f.cognitiveData));if(!h&&!g&&!m)return e(e({},T(q)),{label:"Not Defined"});null!==(i=null!==(t=null==v?void 0:v.cognitiveRelevanceScore)&&void 0!==t?t:null==f?void 0:f.cognitiveRelevanceScore)&&void 0!==i||x&&(null===(o=on[x])||void 0===o||o.relevance_score);var b=null!==(r=null!==(l=null==v?void 0:v.evaluationResult)&&void 0!==l?l:null==f?void 0:f.evaluationResult)&&void 0!==r?r:null,y=null===(c=null==b?void 0:b.evaluation_outputs)||void 0===c?void 0:c.output_value,I=null!==(d=null===(a=null===(u=null==b?void 0:b.evaluation_outputs)||void 0===u?void 0:u.metadata)||void 0===a?void 0:a.label_color)&&void 0!==d?d:q;return e(e({},T(I)),null!=b?{label:null!=y?y:""}:{label:null})},[Gn,Jn,on,kn]),Yt=s(function(){var e,n,t,i,o,l,r,c,u,a,d,s,v,f,p,h,g,x,m,b,y,I;if(!En.current&&!Ge.current){En.current=!0;try{if(!ht.current)return;var S=function(e){var n=e.split("-"),t=n[0];if(!zn[t]&&!1===Se)return!1;if(Se&&!zn["left-".concat(t)]&&!zn["right-".concat(t)]&&!zn[t])return!1;for(var i=t,o=1;o<n.length-1;o++)if(i+="-".concat(n[o]),!Yn[i])return!1;return!0},R=ht.current.getBoundingClientRect();sn({width:R.width,height:R.height});var w=[];if(Bt.forEach(function(e){var n,t,i=e.key,o=null===(n=Ft.current[i])||void 0===n?void 0:n.current,l=null===(t=Mt.current[i])||void 0===t?void 0:t.current;o&&l&&(o.style.height="auto",l.style.height="auto",o.style.minHeight="0px",l.style.minHeight="0px")}),!Ge.current){for(var _=0;_<Math.max(Gn.length,Jn.length);_++){var C=null===(e=kt.current[_])||void 0===e?void 0:e.current,E=null===(n=Dt.current[_])||void 0===n?void 0:n.current;C&&(C.style.height="auto",C.style.minHeight="0px"),E&&(E.style.height="auto",E.style.minHeight="0px")}Se||Object.keys(Lt.current).forEach(function(e){var n,t;if(S(e)){var i=null===(n=Lt.current[e])||void 0===n?void 0:n.current,o=null===(t=Nt.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 T={};Bt.forEach(function(e){var n,t,i=e.key,o=null===(n=Ft.current[i])||void 0===n?void 0:n.current,l=null===(t=Mt.current[i])||void 0===t?void 0:t.current;if(o&&l){var r=o.getBoundingClientRect(),c=l.getBoundingClientRect();T[i]=Math.max(r.height,c.height)}});var F={left:{},right:{}},M={};if(!Ge.current)if(Se){if(Ae&&null!==wt)if("number"==typeof wt){var k=wt,D=Gn[k],A=null===(o=kt.current[k])||void 0===o?void 0:o.current;A&&D&&(D.refIndexes||[]).forEach(function(e){var n,t=Jn.findIndex(function(n){return n.selfIndex===e}),i=null===(n=Dt.current[t])||void 0===n?void 0:n.current;if(i&&(zn["left-".concat(k)]||zn["right-".concat(t)])){var o=Math.max(A.getBoundingClientRect().height,i.getBoundingClientRect().height);F.left[k]=Math.max(F.left[k]||0,o),F.right[t]=Math.max(F.right[t]||0,o)}})}else{var H=wt.split(z)[2];if(H){C=null===(l=Lt.current[H])||void 0===l?void 0:l.current,E=null===(r=Nt.current[H])||void 0===r?void 0:r.current;if(C&&E){O=Math.max(C.getBoundingClientRect().height,E.getBoundingClientRect().height);M[H]=Math.max(M[H]||0,O)}}}}else{Object.keys(Lt.current).forEach(function(e){var n,t;if(S(e)){var i=null===(n=Lt.current[e])||void 0===n?void 0:n.current,o=null===(t=Nt.current[e])||void 0===t?void 0:t.current;if(i&&o&&null!==i.offsetParent&&null!==o.offsetParent){var l=i.getBoundingClientRect(),r=o.getBoundingClientRect(),c=Math.max(l.height,r.height);M[e]=c,i.style.minHeight="".concat(c,"px"),o.style.minHeight="".concat(c,"px")}}});for(_=0;_<Math.min(Gn.length,Jn.length);_++){var C=null===(t=kt.current[_])||void 0===t?void 0:t.current,E=null===(i=Dt.current[_])||void 0===i?void 0:i.current;if(C&&E){var O=Math.max(C.getBoundingClientRect().height,E.getBoundingClientRect().height);F.left[_]=O,F.right[_]=O}}}if(Bt.forEach(function(e){var n,t,i=e.key,o=null===(n=Ft.current[i])||void 0===n?void 0:n.current,l=null===(t=Mt.current[i])||void 0===t?void 0:t.current;if(o&&l){var r=T[i];o.style.minHeight="".concat(r,"px"),l.style.minHeight="".concat(r,"px")}}),Ge.current||(Object.entries(F.left).forEach(function(e){var n,t=e[0],i=e[1],o=null===(n=kt.current[Number(t)])||void 0===n?void 0:n.current;o&&(o.style.minHeight="".concat(i,"px"))}),Object.entries(F.right).forEach(function(e){var n,t=e[0],i=e[1],o=null===(n=Dt.current[Number(t)])||void 0===n?void 0:n.current;o&&(o.style.minHeight="".concat(i,"px"))}),Se||Object.keys(M).forEach(function(e){var n,t,i=null===(n=Lt.current[e])||void 0===n?void 0:n.current,o=null===(t=Nt.current[e])||void 0===t?void 0:t.current;if(i&&o&&M[e]){var l=M[e];i.style.minHeight="".concat(l,"px"),o.style.minHeight="".concat(l,"px")}})),Se)Gn.forEach(function(e,n){var t;(null===(t=kt.current[n])||void 0===t?void 0:t.current)&&(e.refIndexes||[]).forEach(function(e){var t,i,o,l,r,c,u,a,d,s,v=Jn.findIndex(function(n){return n.selfIndex===e});if(-1!==v){var f=null===(t=At.current[n])||void 0===t?void 0:t.current,p=null===(i=Ht.current[v])||void 0===i?void 0:i.current;if(f&&p){var h=f.getBoundingClientRect(),g=p.getBoundingClientRect(),x=h.right-R.left,m=g.left-R.left,b=h.top+h.height/2-R.top,y=g.top+g.height/2-R.top;if(Ae&&wt===n){var I=null!==(l=null===(o=Cn.current)||void 0===o?void 0:o.getBoundingClientRect().top)&&void 0!==l?l:0,S=null!==(c=null===(r=In.current)||void 0===r?void 0:r.getBoundingClientRect().top)&&void 0!==c?c:0,_=I+(null!==(a=null===(u=Cn.current)||void 0===u?void 0:u.clientHeight)&&void 0!==a?a:1/0),C=S+(null!==(s=null===(d=In.current)||void 0===d?void 0:d.clientHeight)&&void 0!==s?s:1/0),E=h.top+h.height/2,T=function(e,n,t){return Math.max(n,Math.min(t,e))};b=T(E,I,_)-R.top,y=T(E,S,C)-R.top}var B=jt(n);B&&w.push({id:"line-".concat(n,"-").concat(v),x1:x,y1:b,x2:m,y2:y,style:B,sectionIdx:n,targetRightIdx:v})}}})});else{for(_=0;_<Math.min(Gn.length,Jn.length);_++){var L=null===(c=kt.current[_])||void 0===c?void 0:c.current,N=null===(u=Dt.current[_])||void 0===u?void 0:u.current;if(L&&N){var W=L.getBoundingClientRect(),j=N.getBoundingClientRect(),P=Math.max(W.top,j.top)+18-R.top,Y=(null===(a=Jn[_])||void 0===a?void 0:a.id)||"sec-".concat(_);(Q=jt(_))&&w.push({id:Y,x1:W.right-R.left,y1:P,x2:j.left-R.left,y2:P,style:Q,sectionIdx:_,hasCognitive:!!((null===(d=Gn[_])||void 0===d?void 0:d.cognitiveData)||(null===(s=Jn[_])||void 0===s?void 0:s.cognitiveData)||Y&&on[Y]),isSubSection:!1})}}Object.keys(Lt.current).forEach(function(e){var n,t,i,o,l,r;if(S(e)){var c=null===(n=Lt.current[e])||void 0===n?void 0:n.current,u=null===(t=Nt.current[e])||void 0===t?void 0:t.current;if(c&&u){for(var a=e.split("-").map(Number),d=Gn[a[0]],s=Jn[a[0]],v=1;v<a.length;v++)(null==d?void 0:d.subsections)&&(d=d.subsections[a[v]]),(null==s?void 0:s.subsections)&&(s=s.subsections[a[v]]);var f=!!d&&((null===(i=d.displayTitle)||void 0===i||i)&&B(d.title)),p=!!d&&((null===(o=d.displayContent)||void 0===o||o)&&B(d.content)),h=!!s&&((null===(l=s.displayTitle)||void 0===l||l)&&B(s.title)),g=!!s&&((null===(r=s.displayContent)||void 0===r||r)&&B(s.content));if(f&&p||h&&g){var x=c.getBoundingClientRect(),m=u.getBoundingClientRect(),b=Math.max(x.top,m.top)+16-R.top,y=Pt(e);y&&"Not Defined"!==y.label&&w.push({id:"subsec-".concat(e),x1:x.right-R.left,y1:b,x2:m.left-R.left,y2:b,style:y,sectionIdx:a[0],isSubSection:!0,subSectionKeyPath:e,hasCognitive:!(!(null==d?void 0:d.cognitiveData)&&!(null==s?void 0:s.cognitiveData))})}}}})}if(Ae&&"string"==typeof wt&&wt.includes(z)){var V=wt.split(z),X=V[0],q=V[1],U=V[2],$=(V[3],"".concat(X).concat(z).concat(q)),G=null===(v=At.current[$])||void 0===v?void 0:v.current,J=null===(f=Ht.current[$])||void 0===f?void 0:f.current;if(G&&J){var Q,Z=G.getBoundingClientRect(),ee=J.getBoundingClientRect(),ne=Z.right-R.left,te=ee.left-R.left,ie=Z.top+Z.height/2-R.top,oe=ee.top+ee.height/2-R.top;if(Se){var le=null!==(h=null===(p=Cn.current)||void 0===p?void 0:p.getBoundingClientRect().top)&&void 0!==h?h:0,re=null!==(x=null===(g=In.current)||void 0===g?void 0:g.getBoundingClientRect().top)&&void 0!==x?x:0,ce=le+(null!==(b=null===(m=Cn.current)||void 0===m?void 0:m.clientHeight)&&void 0!==b?b:1/0),ue=re+(null!==(I=null===(y=In.current)||void 0===y?void 0:y.clientHeight)&&void 0!==I?I:1/0),ae=function(e,n,t){return Math.max(n,Math.min(t,e))};ie=ae(Z.top+Z.height/2,le,ce)-R.top,oe=ae(ee.top+ee.height/2,re,ue)-R.top}(Q=Pt(U))&&w.push({id:"line-subsec-".concat($),x1:ne,y1:ie,x2:te,y2:oe,style:Q,sectionIdx:Number(U.split("-")[0]),isSubSection:!0,subSectionKeyPath:wt})}}if(St(w),mt.current&&bt.current){var de=mt.current.getBoundingClientRect(),se=bt.current.getBoundingClientRect(),ve=(de.top+de.height/2-R.top+se.top+se.height/2-R.top)/2;Tt({x1:de.right-R.left,x2:se.left-R.left,y:ve})}else Tt(null);if(Ke.size>0){var fe=[],pe=Cn.current,he=In.current;if(pe&&he){var ge=[],xe=pe.getBoundingClientRect().top,me=he.getBoundingClientRect().top,be=xe+pe.clientHeight,ye=me+he.clientHeight,Ie=pe.scrollTop,Re=he.scrollTop,we=R.top,_e=function(e,n,t){return Math.max(n,Math.min(t,e))};Ke.forEach(function(e){var n,t,i,o,l;if("string"==typeof e&&e.includes(z)){var r=e.split(z),c=r[0],u=r[1],a=r[2],d=(r[3],"".concat(c).concat(z).concat(u)),s=null===(n=At.current[d])||void 0===n?void 0:n.current,v=null===(t=Ht.current[d])||void 0===t?void 0:t.current;if(!s||!v)return;var f=s.getBoundingClientRect(),p=v.getBoundingClientRect(),h=Pt(a),g=(D=f.right-R.left)+.5*((A=p.left-R.left-0)-D),x=f.top+f.height/2,m=p.top+p.height/2,b=x-xe+Ie,y=m-me+Re,I="conn-subsec-".concat(d);ge.push({lhsScrollY:b,rhsScrollY:y,x1:D,x2:A,containerTop:we,leftIdx:e,rhsArrayIdx:e,styleColor:(null==h?void 0:h.badgeBorder)||"#6366F1",styleId:I});var S=_e(x,xe,be),w=_e(m,me,ye),_=S-we,C=w-we,E=m>=me-4&&m<=ye+4,T="";T=(H=x>=xe-4&&x<=be+4)&&E?K(D,_,A,C):H&&!E?"M ".concat(D,",").concat(_," L ").concat(g,",").concat(_," L ").concat(g,",").concat(C):!H&&E?"M ".concat(g,",").concat(_," L ").concat(g,",").concat(C," L ").concat(A,",").concat(C):"M ".concat(g,",").concat(_," L ").concat(g,",").concat(C),fe.push({id:I,pathD:T,style:h,leftIdx:e,rhsArrayIdx:e})}else if(Se){var B=e,F=Gn[B];if(!(null===(l=null==F?void 0:F.refIndexes)||void 0===l?void 0:l.length))return;F.refIndexes.forEach(function(e){var n,t,i=Jn.findIndex(function(n){return n.selfIndex===e});if(-1!==i){var o=null===(n=At.current[B])||void 0===n?void 0:n.current,l=null===(t=Ht.current[i])||void 0===t?void 0:t.current;if(o&&l){var r=o.getBoundingClientRect(),c=l.getBoundingClientRect(),u=jt(B),a=r.right-R.left,d=c.left-R.left-0,s=a+.5*(d-a),v=r.top+r.height/2,f=c.top+c.height/2,p=v-xe+Ie,h=f-me+Re,g="conn-".concat(B,"-").concat(i);ge.push({lhsScrollY:p,rhsScrollY:h,x1:a,x2:d,containerTop:we,leftIdx:B,rhsArrayIdx:i,styleColor:(null==u?void 0:u.badgeBorder)||"#6366F1",styleId:g});var x=_e(v,xe,be),m=_e(f,me,ye),b=x-we,y=m-we,I=v>=xe-4&&v<=be+4,S=f>=me-4&&f<=ye+4,w="";w=I&&S?K(a,b,d,y):I&&!S?"M ".concat(a,",").concat(b," L ").concat(s,",").concat(b," L ").concat(s,",").concat(y):!I&&S?"M ".concat(s,",").concat(b," L ").concat(s,",").concat(y," L ").concat(d,",").concat(y):"M ".concat(s,",").concat(b," L ").concat(s,",").concat(y),fe.push({id:g,pathD:w,style:u,leftIdx:B,rhsArrayIdx:i})}}})}else{var M=e,k=M;s=null===(i=At.current[M])||void 0===i?void 0:i.current,v=null===(o=Ht.current[k])||void 0===o?void 0:o.current;if(!s||!v)return;var D,A;f=s.getBoundingClientRect(),p=v.getBoundingClientRect(),h=jt(M),g=(D=f.right-R.left)+.5*((A=p.left-R.left-0)-D),x=f.top+f.height/2,m=p.top+p.height/2,b=x-xe+Ie,y=m-me+Re,I="conn-".concat(M,"-").concat(k);ge.push({lhsScrollY:b,rhsScrollY:y,x1:D,x2:A,containerTop:we,leftIdx:M,rhsArrayIdx:k,styleColor:(null==h?void 0:h.badgeBorder)||"#6366F1",styleId:I});var H;S=_e(x,xe,be),w=_e(m,me,ye),_=S-we,C=w-we,E=m>=me-4&&m<=ye+4,T="";T=(H=x>=xe-4&&x<=be+4)&&E?K(D,_,A,C):H&&!E?"M ".concat(D,",").concat(_," L ").concat(g,",").concat(_," L ").concat(g,",").concat(C):!H&&E?"M ".concat(g,",").concat(_," L ").concat(g,",").concat(C," L ").concat(A,",").concat(C):"M ".concat(g,",").concat(_," L ").concat(g,",").concat(C),fe.push({id:I,pathD:T,style:h,leftIdx:M,rhsArrayIdx:k})}}),Ze.current=ge}Ue(fe)}else Ue([]),Ze.current=[]}catch(e){console.error("Line render safe fail: ",e)}finally{En.current=!1}}},[Bt,Gn,Jn,on,kn,zt,jt,Se,Ae,wt,Ke,zn,Yn]),Kt=s(function(){var e,n,t,i,o,l,r,c,u,a,d,s,v,f,p=Ze.current;if(p.length&&!Ge.current){var h=null!==(n=null===(e=Cn.current)||void 0===e?void 0:e.scrollTop)&&void 0!==n?n:0,g=null!==(i=null===(t=In.current)||void 0===t?void 0:t.scrollTop)&&void 0!==i?i:0,x=null!==(l=null===(o=Cn.current)||void 0===o?void 0:o.clientHeight)&&void 0!==l?l:1/0,m=null!==(c=null===(r=In.current)||void 0===r?void 0:r.clientHeight)&&void 0!==c?c:1/0,b=null!==(a=null===(u=Cn.current)||void 0===u?void 0:u.getBoundingClientRect().top)&&void 0!==a?a:0,y=null!==(s=null===(d=In.current)||void 0===d?void 0:d.getBoundingClientRect().top)&&void 0!==s?s:0,I=b+x,S=y+m,R=null!==(f=null===(v=ht.current)||void 0===v?void 0:v.getBoundingClientRect().top)&&void 0!==f?f:0,w=function(e,n,t){return Math.max(n,Math.min(t,e))};p.forEach(function(e){var n=e.lhsScrollY-h+b,t=e.rhsScrollY-g+y,i=Qe.current[e.styleId+"-stroke"],o=Qe.current[e.styleId+"-bg"];if(i||o){var l,r=w(n,b,I),c=w(t,y,S),u=r-R,a=c-R,d=n>=b-4&&n<=I+4,s=t>=y-4&&t<=S+4,v=e.x1+.5*(e.x2-e.x1);l=d&&s?K(e.x1,u,e.x2,a):d&&!s?"M ".concat(e.x1,",").concat(u," L ").concat(v,",").concat(u," L ").concat(v,",").concat(a):!d&&s?"M ".concat(v,",").concat(u," L ").concat(v,",").concat(a," L ").concat(e.x2,",").concat(a):"M ".concat(v,",").concat(u," L ").concat(v,",").concat(a),i&&(i.setAttribute("visibility","visible"),i.setAttribute("d",l)),o&&(o.setAttribute("visibility","visible"),o.setAttribute("d",l))}})}},[]),Vt=a(Yt);d(function(){Vt.current=Yt},[Yt]);var Xt=a(null),qt=s(function(){null!==Xt.current&&clearTimeout(Xt.current),Xt.current=setTimeout(function(){Vt.current(),Xt.current=null},50)},[]),Ut=s(function(e){var n,t,i,o,l,r,c,u,a,d;if(!We.current){if(Se||qt(),nn.current){var s=tn.current,v=gt.current,f=Cn.current,p=In.current;if(null!==s&&null!==v&&f&&p){var h="string"==typeof s&&s.includes(z)?null===(n=At.current["".concat(s.split(z)[0]).concat(z).concat(s.split(z)[1])])||void 0===n?void 0:n.current:null===(t=ct.current[s])||void 0===t?void 0:t.current,g="string"==typeof v&&v.includes(z)?null===(i=Ht.current["".concat(v.split(z)[0]).concat(z).concat(v.split(z)[1])])||void 0===i?void 0:i.current:null===(o=Ot.current[v])||void 0===o?void 0:o.current;if(h&&g){var x=h.getBoundingClientRect().top-f.getBoundingClientRect().top+f.scrollTop,m=g.getBoundingClientRect().top-p.getBoundingClientRect().top+p.scrollTop;if(e.currentTarget===f){var b=m-(x-f.scrollTop),y=p.scrollHeight-p.clientHeight,I=Math.max(0,Math.min(b,y));Math.abs(p.scrollTop-I)>1&&(p.scrollTop=I)}else if(e.currentTarget===p){var S=x-(m-p.scrollTop),R=f.scrollHeight-f.clientHeight,w=Math.max(0,Math.min(S,R));Math.abs(f.scrollTop-w)>1&&(f.scrollTop=w)}if(xt.current){var _=void 0,C=void 0;if("string"==typeof s&&s.includes(z)){var E=s.split(z),T="".concat(E[0]).concat(z).concat(E[1]);_=null===(l=At.current[T])||void 0===l?void 0:l.current,C=null===(r=Ht.current[T])||void 0===r?void 0:r.current}else _=null===(c=At.current[s])||void 0===c?void 0:c.current,C=null===(u=Ht.current[v])||void 0===u?void 0:u.current;var B=null!==(d=null===(a=ht.current)||void 0===a?void 0:a.getBoundingClientRect().top)&&void 0!==d?d:0,F=f.getBoundingClientRect().top,M=F+f.clientHeight,k=p.getBoundingClientRect().top,D=k+p.clientHeight,A=function(e,n,t){return Math.max(n,Math.min(t,e))};if(_&&C){var H=_.getBoundingClientRect(),O=C.getBoundingClientRect(),L=H.top+H.height/2,N=O.top+O.height/2,W=A(L,F,M),j=A(N,k,D);xt.current.setAttribute("y1",(W-B).toString()),xt.current.setAttribute("y2",(j-B).toString());var P=L>=F-4&&L<=M+4;xt.current.setAttribute("visibility",P?"visible":"hidden")}}}}}Ze.current.length>0&&!en.current&&(en.current=!0,requestAnimationFrame(function(){Kt(),en.current=!1}))}},[Kt,Se,qt]);d(function(){var e=setTimeout(qt,250);window.addEventListener("resize",qt);var n=null,t=null;return bn.current&&(n=new ResizeObserver(qt)).observe(bn.current),ht.current&&(t=new ResizeObserver(qt)).observe(ht.current),function(){clearTimeout(e),window.removeEventListener("resize",qt),null==n||n.disconnect(),null==t||t.disconnect()}},[An,Vn,Zn,Bt,zn,Yn,Gn,Jn,kn,qt,Ae,wt,Le,Ke]),d(function(){nn.current=Ae},[Ae]),d(function(){tn.current=wt},[wt]);var $t=s(function(){var e,n,t,i,o=xn.sectionIdx,l=xn.isOrphan;if(Fn(),null!=o)if(l)ke("No counterpart exists for this section.");else if(Ae&&wt===o)at();else{if(!Se){var r=tn.current,c=gt.current;if(null!==r)if("string"==typeof r&&r.includes(z)){var u=r.split(z);(a=null===(e=Lt.current[u[2]])||void 0===e?void 0:e.current)&&(a.style.paddingTop="0px")}else{var a;(a=null===(n=kt.current[r])||void 0===n?void 0:n.current)&&(a.style.paddingTop="0px")}if(null!==c)if("string"==typeof c&&c.includes(z)){u=c.split(z);(d=null===(t=Nt.current[u[3]])||void 0===t?void 0:t.current)&&(d.style.paddingTop="0px")}else{var d;(d=null===(i=Dt.current[c])||void 0===i?void 0:i.current)&&(d.style.paddingTop="0px")}}Ve(new Set),Ue([]),Ze.current=[],Be(!0),We.current=!0,_t(o),tn.current=o,He(!0),nn.current=!0,Ne(!1),Sn.current&&(Sn.current.style.height="0px"),Rn.current&&(Rn.current.style.height="0px"),wn.current&&(wn.current.style.height="0px"),_n.current&&(_n.current.style.height="0px"),requestAnimationFrame(function(){var e,n,t,i,l,r,c,u,a,d,s,v=null,f=null,p=null,h=null,g=null;if("string"==typeof o&&o.includes(z)){var x=o.split(z),m="".concat(x[0]).concat(z).concat(x[1]);v=(null===(e=At.current[m])||void 0===e?void 0:e.current)||null,g=(f=(null===(n=Ht.current[m])||void 0===n?void 0:n.current)||null)?o:null,p=(null===(t=Lt.current[x[2]])||void 0===t?void 0:t.current)||null,h=(null===(i=Nt.current[x[3]])||void 0===i?void 0:i.current)||null}else if(v=(null===(l=ct.current[o])||void 0===l?void 0:l.current)||null,p=(null===(r=kt.current[o])||void 0===r?void 0:r.current)||null,Se){var b=Gn[o],y=(null==b?void 0:b.refIndexes)||[];if(y.length>0){var I=y[0],S=Jn.findIndex(function(e){return e.selfIndex===I});-1!==S&&(f=(null===(a=Ot.current[S])||void 0===a?void 0:a.current)||null,h=(null===(d=Dt.current[S])||void 0===d?void 0:d.current)||null,g=S)}}else f=(null===(c=Ot.current[o])||void 0===c?void 0:c.current)||null,h=(null===(u=Dt.current[o])||void 0===u?void 0:u.current)||null,g=f?o:null;gt.current=g;var R=Cn.current,w=In.current;if(!v||!R)return We.current=!1,void Be(!1);if(!f||!w)return Ne(!0),Vt.current(),We.current=!1,void Be(!1);if(!Se){var _=v.getBoundingClientRect(),C=f.getBoundingClientRect(),E=_.top-C.top;p&&h&&(p.style.paddingTop="0px",h.style.paddingTop="0px",E>0?h.style.paddingTop="".concat(E,"px"):E<0&&(p.style.paddingTop="".concat(Math.abs(E),"px")));var T=v?v.getBoundingClientRect().top:(null==p?void 0:p.getBoundingClientRect().top)||0;return null===(s=bn.current)||void 0===s||s.scrollTo({top:bn.current.scrollTop+T-150,behavior:"smooth"}),Ne(!0),Vt.current(),We.current=!1,void Be(!1)}var B=v.getBoundingClientRect().top-R.getBoundingClientRect().top+R.scrollTop,F=f.getBoundingClientRect().top-w.getBoundingClientRect().top+w.scrollTop-(B-R.scrollTop);F<0&&Sn.current&&(Sn.current.style.height="".concat(Math.abs(F),"px"));requestAnimationFrame(function(){var e,n=w.scrollHeight-w.clientHeight;if(F<0)e=0;else{if(F>n){var t=F-n;return Rn.current&&(Rn.current.style.height="".concat(t+150,"px")),void requestAnimationFrame(function(){U(w,F,200,function(){Ne(!0),Vt.current(),We.current=!1,Be(!1)})})}e=F}U(w,e,200,function(){Ne(!0),Vt.current(),We.current=!1,Be(!1)})})})}},[Fn,xn.sectionIdx,Ae,wt,Gn,Jn,qt,at]),Gt=null!==xn.sectionIdx&&Ke.has(xn.sectionIdx),Jt=function(n){var t,l,c,u,a,d,s,p=n.section,h=n.idx,g=n.columnKey,x=n.colRef,S=n.mb,w=void 0===S?1:S,_=n.parentNodeId,C=void 0===_?"":_,F=Se?!!zn["".concat(g,"-").concat(h)]:!!zn[String(h)],M=(null===(t=p.displayTitle)||void 0===t||t)&&B(p.title),k=(null===(l=p.displayContent)||void 0===l||l)&&B(p.content),D=!M&&!k,A={current:1},H=p.title;M||(H=k?"No Title Found":"No Matching Section Found");var O,L=null!==(d=null===(a=null===(u=null===(c=p.evaluationResult)||void 0===c?void 0:c.evaluation_outputs)||void 0===u?void 0:u.metadata)||void 0===a?void 0:a.label_color)&&void 0!==d?d:q,N=T(L).highlightBg,W=[];if(null===(s=p.evaluationResult)||void 0===s?void 0:s.deviations){var z=p.evaluationResult.deviations;for(var j in z){var P=z[j][C];P&&W.push(P)}}return i(v,e({ref:x,sx:{mb:w,width:"100%",display:"flex",flexDirection:"column",position:"relative",minWidth:0}},{children:o(b,e({disableGutters:!0,expanded:!D&&F,onChange:function(){return!D&&function(n,t){var i,o;Ge.current=!0,Je.current&&clearTimeout(Je.current),$e.current&&($e.current.style.opacity="0");var l=null===(i=kt.current[n])||void 0===i?void 0:i.current,r=null===(o=Dt.current[n])||void 0===o?void 0:o.current;l&&(l.style.minHeight="0px"),r&&(r.style.minHeight="0px"),Je.current=setTimeout(function(){Ge.current=!1,Vt.current(),$e.current&&($e.current.style.opacity="1")},650),jn(function(i){var o=e({},i),l=Se?"".concat(t,"-").concat(n):String(n),r=!i[l];if(!r){var c=String(wt||""),u=wt===n||c.startsWith("".concat(n,"-")),a=!1;Ke.forEach(function(e){(e===n||String(e).startsWith("".concat(n,"-")))&&(a=!0)}),(u||a)&&(at(),Ve(new Set),Ue([]),Ze.current=[])}if(!Se)return o[String(n)]=r,o;if(o[l]=r,"left"===t)((null==(d=Gn[n])?void 0:d.refIndexes)||[]).forEach(function(e){var n=Jn.findIndex(function(n){return n.selfIndex===e});-1!==n&&(o["right-".concat(n)]=r)});else{var d,s=null==(d=Jn[n])?void 0:d.selfIndex;Gn.forEach(function(e,n){var t;(null===(t=e.refIndexes)||void 0===t?void 0:t.includes(s))&&(o["left-".concat(n)]=r)})}return o})}(h,g)},sx:{boxShadow:"none",border:D?"1px dashed #E2E8F0":"1px solid #E2E8F0",bgcolor:D?"#FAFAFA":"#FFFFFF",borderRadius:"6px",flexGrow:1,width:"100%",display:"flex",flexDirection:"column",minWidth:0,"&:before":{display:"none"}}},{children:[i(y,e({expandIcon:D?null:i(R,{size:16}),sx:{minHeight:"36px",flexShrink:0,cursor:D?"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:M&&i(m,e({title:H,placement:"top"},{children:i(f,e({component:"div",sx:{fontSize:"12px",color:D?"#94A3B8":"#19213D",fontWeight:D?400:700,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0}},{children:(O=H,O?E(O).replace(/\\n/g,"\n").split(/(\*\*.*?\*\*)/g).map(function(e,n){return e.startsWith("**")&&e.endsWith("**")?i("strong",{children:e.slice(2,-2)},n):i(r.Fragment,{children:e},n)}):null)}))}))})),!D&&o(I,e({sx:{pt:0,pb:1.25,bgcolor:"#FFFFFF",flex:1,display:"flex",flexDirection:"column",minWidth:0}},{children:[k&&i(Y,{content:p.content,sxStyles:vn,highlights:W,maintainRelativeOrder:Se,highlightBg:N}),(p.subsections||[]).map(function(e,n){return Qt({section:e,keyPath:"".concat(h,"-").concat(n),depth:0,columnKey:g,parentNodeId:C,devCounter:A})})]}))]}))}),"".concat(g,"-sec-").concat(h))},Qt=function(n){var l,c,u,a,d,s,p,h,g,x,m,S,w,_,C,E=n.section,F=n.keyPath,M=n.depth,k=void 0===M?0:M,D=n.columnKey,A=void 0===D?"left":D,H=n.parentNodeId,O=void 0===H?"":H,L=(null===(l=E.displayTitle)||void 0===l||l)&&B(E.title),N=(null===(c=E.displayContent)||void 0===c||c)&&B(E.content),W=!L&&!N,P=L?E.title:N?"No Title Found":"No Matching Section Found",K=!!Yn[F];"left"!==A||Lt.current[F]||(Lt.current[F]=r.createRef()),"right"!==A||Nt.current[F]||(Nt.current[F]=r.createRef());var V="left"===A?Lt.current[F]:Nt.current[F],X=Pt(F),U=F.split("-").map(Number),$=U[0],G=Gn[$],J=Jn[$],Q=F,Z=F;if(Se)if("left"===A){var ee=null===(u=null==G?void 0:G.refIndexes)||void 0===u?void 0:u[0],ne=Jn.findIndex(function(e){return e.selfIndex===ee});-1!==ne&&(J=Jn[ne],Z=t([ne],U.slice(1),!0).join("-"))}else{var te=null===(a=null==J?void 0:J.refIndexes)||void 0===a?void 0:a[0],ie=Gn.findIndex(function(e){return e.selfIndex===te});-1!==ie&&(G=Gn[ie],Q=t([ie],U.slice(1),!0).join("-"))}var oe,le="left"===A?G:J;oe=Se&&void 0!==(null==le?void 0:le.selfIndex)&&le.selfIndex>=0?le.selfIndex+1:$+1;for(var re=G,ce=J,ue=1;ue<U.length;ue++)(null==re?void 0:re.subsections)&&(re=re.subsections[U[ue]]),(null==ce?void 0:ce.subsections)&&(ce=ce.subsections[U[ue]]);var ae=null===(d=null==se?void 0:se.input_index_map)||void 0===d?void 0:d[0],de=null===(s=null==se?void 0:se.input_index_map)||void 0===s?void 0:s[1],ve="left"===A?de:ae,fe=Se?!(null===(p=E.refIndexes)||void 0===p?void 0:p.length)||void 0!==E.selfIndex&&E.selfIndex<0:"left"===A?!ce:!re,pe=null!==(x=null===(g=null===(h=E.evaluationResult)||void 0===h?void 0:h.evaluation_outputs)||void 0===g?void 0:g.output_value)&&void 0!==x?x:null,he=E.id,ge=null!==(_=null===(w=null===(S=null===(m=E.evaluationResult)||void 0===m?void 0:m.evaluation_outputs)||void 0===S?void 0:S.metadata)||void 0===w?void 0:w.label_color)&&void 0!==_?_:q,xe=T(ge).highlightBg,me=(null===(C=E.evaluationResult)||void 0===C?void 0:C.deviations)||{},be=Object.entries(me).map(function(n){var t=n[0],i=n[1],o="".concat(he).concat(z).concat(t),l=rt[o];if(!l)return null;var c=i[O],u=j(c);if(u)c="";else if(!c)return null;var a=i[ve],d=fe||j(a),s="".concat(oe,".").concat(l),v="".concat(he).concat(z).concat(t).concat(z).concat(Q).concat(z).concat(Z);return"left"!==A||At.current[o]||(At.current[o]=r.createRef()),"right"!==A||Ht.current[o]||(Ht.current[o]=r.createRef()),{id:o,actionId:v,label:s,highlight:c,side:A,style:X,score:pe,isConnected:Ke.has(v),isOrphan:d,isMissingClause:u,badgeRef:"left"===A?At.current[o]:Ht.current[o],onClick:function(n){n.stopPropagation();var t=e(e({},re||{title:"",content:""}),{title:(null==G?void 0:G.title)||(null==re?void 0:re.title)||""}),i=e(e({},ce||{title:"",content:""}),{title:(null==J?void 0:J.title)||(null==ce?void 0:ce.title)||""});vt(n,t,d,i,v,X)}}}).filter(Boolean),ye=be.some(function(e){return Ke.has(e.actionId)});if(!(L||N||E.subsections&&0!==E.subsections.length))return null;var Ie=function(){var e,n=[];if(null===(e=E.evaluationResult)||void 0===e?void 0:e.deviations){var t=E.evaluationResult.deviations;for(var i in t){var o=t[i][O];o&&n.push(o)}}return n}();if(!L)return i(v,e({ref:V,sx:{mt:0===k?1:.75,width:"100%",minWidth:0,position:"relative"}},{children:!W&&o(v,e({sx:e({width:"100%"},ye&&X&&{borderRadius:"4px",outline:"2px solid ".concat(X.badgeBorder),outlineOffset:"1px"})},{children:[N&&i(Y,{content:E.content,sxStyles:vn,deviationBadges:be,maintainRelativeOrder:Se,highlightBg:xe,highlights:Ie}),(E.subsections||[]).map(function(e,n){return Qt({section:e,keyPath:"".concat(F,"-").concat(n),depth:k+1,columnKey:A,parentNodeId:O})})]}))}),F);var Re=!Se&&L&&N;return i(v,e({ref:V,sx:{mt:1,width:"100%",minWidth:0,position:"relative"}},{children:i(v,e({sx:e({width:"100%"},ye&&X&&{borderRadius:"4px",outline:"2px solid ".concat(X.badgeBorder),outlineOffset:"1px"})},{children:o(b,e({disableGutters:!0,expanded:!W&&K,onChange:function(){if(!W){if(K){var n=String(wt||""),t=n.includes(Q)||n.includes(Z);t||Ke.forEach(function(e){(String(e).includes(Q)||String(e).includes(Z))&&(t=!0)}),t&&(at(),Ve(new Set),Ue([]),Ze.current=[])}Kn(function(n){var t;return e(e({},n),((t={})[F]=!n[F],t))})}},sx:{mt:0,boxShadow:"none",border:W?"1px dashed #E2E8F0":"1px solid #EEF2F7",borderRadius:"4px !important",bgcolor:"#FFFFFF",minWidth:0,"&:before":{display:"none"}}},{children:[i(y,e({expandIcon:W?null:i(R,{size:14}),sx:{minHeight:"32px","& .MuiAccordionSummary-content":{my:.5,display:"grid",alignItems:"center",minWidth:0,width:"100%"}}},{children:i(f,e({component:"div",sx:{fontSize:"11px",fontWeight:600,color:W?"#94A3B8":"#19213D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0}},{children:P||"Untitled Subsection"}))})),!W&&o(I,e({sx:{pt:0,pb:1,minWidth:0}},{children:[N&&i(Y,{content:E.content,sxStyles:vn,deviationBadges:Re?[]:be,maintainRelativeOrder:Se,highlightBg:xe,highlights:Ie}),(E.subsections||[]).map(function(e,n){return Qt({section:e,keyPath:"".concat(F,"-").concat(n),depth:k+1,columnKey:A,parentNodeId:O})})]}))]}))}))}),F)};return o(v,e({ref:yn,sx:e(e({display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif'},Se?{}:{overflow:"visible"}),{position:"relative"})},{children:[_e&&i(v,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(L,{})})),i(O,{open:xn.open,anchorEl:xn.anchorEl,sectionTitle:xn.sectionTitle,referenceSectionTitle:xn.refSectionTitle,onClose:Fn,onOpenCognitiveCompare:ft,onOpenSideBySide:$t,onConnect:pt,isConnected:Gt,isOrphan:xn.isOrphan}),pn.open&&i(H,{open:pn.open,popupRef:un,position:rn,popupConfig:me,onClose:function(){cn(null),hn(function(n){return e(e({},n),{open:!1})}),Pe(null)},markdownStyles:he,sectionTitle:pn.sectionTitle,referenceSectionTitle:pn.refSectionTitle,cognitiveData:pn.cognitiveData,anchorEl:pn.anchorEl,sectionAnchorEl:pn.sectionAnchorEl,scrollContainerEl:bn.current,badgeStyle:pn.badgeStyle,docData:pn.docData,deviationData:pn.deviationData,isLoading:pn.isLoading}),i(p,e({open:!!Me,autoHideDuration:8e3,onClose:function(){return ke(null)},anchorOrigin:{vertical:"top",horizontal:"center"}},{children:i(h,e({onClose:function(){return ke(null)},severity:"error",sx:{width:"100%",whiteSpace:"pre-line"}},{children:Me}))})),(xe.isHeaderVisible||xe.isToggleVisible)&&o(v,e({sx:{px:2,py:1,display:"flex",alignItems:"center",justifyContent:"space-between",bgcolor:"#FFFFFF",border:"1.5px solid #EEF0F4",borderTopLeftRadius:"8px",borderTopRightRadius:"8px"}},{children:[i(v,e({sx:{display:"flex",alignItems:"center",gap:1}},{children:xe.isHeaderVisible&&i(f,e({sx:{fontSize:"16px",fontWeight:600,color:"#0F172A"}},{children:de}))})),xe.isToggleVisible&&i(v,e({sx:{display:"flex",alignItems:"center"}},{children:i(g,{control:i(x,{checked:!Se,onChange:function(e){var n=e.target.checked;Ce(!0),setTimeout(function(){Re(!n),at(),Ve(new Set),Ue([]),Ze.current=[],setTimeout(function(){Ce(!1)},400)},50)},color:"primary",size:"small",sx:{width:100,height:26,padding:0,"& .MuiSwitch-switchBase":{padding:0,margin:"3px",transitionDuration:"300ms","&.Mui-checked":{transform:"translateX(75px)",color:"#fff","& + .MuiSwitch-track":{backgroundColor:"#5928ED",opacity:1,border:0,"&::before":{content:'"Side by Side"',position:"absolute",left:"13px",top:"50%",transform:"translateY(-50%)",fontSize:"9px",fontWeight:700,color:"#fff",letterSpacing:"0.3px"}}}},"& .MuiSwitch-thumb":{boxSizing:"border-box",width:20,height:20},"& .MuiSwitch-track":{borderRadius:13,backgroundColor:"#9e9e9e",opacity:1,position:"relative","&::after":{content:'"Side by Side"',position:"absolute",right:"13px",top:"50%",transform:"translateY(-50%)",fontSize:"9px",fontWeight:700,color:"#fff",letterSpacing:"0.3px",opacity:1,transition:"opacity 0.2s"}},"& .MuiSwitch-switchBase.Mui-checked + .MuiSwitch-track":{"&::after":{opacity:0}}}}),label:"",labelPlacement:"start",sx:{m:0,gap:1}})}))]})),i(v,e({ref:bn,onScroll:Ut,sx:{flex:1,minHeight:0,pt:1.5,pb:1,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",overflowY:Se?"hidden":"auto",borderTop:et&&nt?"none":"1.5px solid #EEF0F4"}},{children:i(v,e({sx:e({display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"},Se?{flex:1,minHeight:0}:{})},{children:o(v,e({ref:ht,sx:e({display:"grid",gridTemplateColumns:"minmax(0, 1fr) 180px minmax(0, 1fr)",gap:"10px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0},Se?{flex:1,overflow:"visible"}:{})},{children:[o("svg",e({ref:$e,style:{position:"absolute",top:0,left:0,width:dn.width||"100%",height:dn.height||"100%",pointerEvents:"none",zIndex:10,overflow:"visible",transition:"opacity 0.15s ease-in-out"}},{children:[Et&&!Ae&&i("g",{children:i("line",{x1:Et.x1,y1:Et.y,x2:Et.x2,y2:Et.y,stroke:lt.badgeBorder,strokeWidth:"1.5"})}),It.map(function(n){var t,l=n.x1+.5*(n.x2-n.x1),r=(n.y1+n.y2)/2;if("Not Defined"===n.style.label&&!n.hasCognitive)return null;var c=!1;if(n.isSubSection)c=Ae&&wt===n.subSectionKeyPath&&Le;else{var u=Gn[n.sectionIdx];(Se?!(null===(t=null==u?void 0:u.refIndexes)||void 0===t?void 0:t.length)||(null==u?void 0:u.selfIndex)<0:!Jn[n.sectionIdx])||(c=Ae&&wt===n.sectionIdx&&Le)}if(c)return o("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:xt,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(!Se){var a=n.isSubSection?K(n.x1,n.y1,n.x2,n.y2):"M ".concat(n.x1," ").concat(n.y1," L ").concat(n.x2," ").concat(n.y2);return o("g",{children:[i("path",{d:a,fill:"none",stroke:n.style.badgeBorder||"#E2E8F0",strokeWidth:"1.5"}),i("foreignObject",e({x:l-100,y:r-14,width:"200",height:"28",style:{pointerEvents:"auto",overflow:"visible"}},{children:i(v,e({sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},{children:o(v,e({onClick:function(t){if(t.stopPropagation(),pn.open&&je===n.id)Bn();else{var i=Gn[n.sectionIdx]||{title:"",content:""},o=Jn[n.sectionIdx]||{title:"",content:""};if(n.isSubSection&&n.subSectionKeyPath){for(var l=n.subSectionKeyPath.split(z)[2].split("-").map(Number),r=Gn[l[0]],c=Jn[l[0]],u=(null==r?void 0:r.title)||"",a=(null==c?void 0:c.title)||"",d=1;d<l.length;d++)(null==r?void 0:r.subsections)&&(r=r.subsections[l[d]]),(null==c?void 0:c.subsections)&&(c=c.subsections[l[d]]);r&&(i=e(e({},r),{title:u||r.title})),c&&(o=e(e({},c),{title:a||c.title}))}Pe(n.id),st(dt(t.currentTarget,i,o,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:"pointer"}},{children:[n.style.badgeText===q&&null==n.style.label?i(W,{color:n.style.badgeText}):0===n.style.label?"Same":n.style.label,i(v,e({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:i(w,{})})),i(R,{size:11,style:{transform:pn.open&&je===n.id?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))}))]},n.id)}return null}),qe.map(function(n){var t,l=n.pathD,r=(null===(t=n.style)||void 0===t?void 0:t.badgeBorder)||"#6366F1",c="conn-marker-".concat(n.id),u="".concat(n.id,"-bg"),a="".concat(n.id,"-stroke");return o("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:r})}))}))}),i("path",{ref:function(e){Qe.current[u]=e},d:l,fill:"none",stroke:"#FFFFFF",strokeWidth:"4",strokeOpacity:"0.7"}),i("path",{ref:function(e){Qe.current[a]=e},d:l,fill:"none",stroke:r,strokeWidth:"1.75",markerEnd:"url(#".concat(c,")")})]},n.id)})]})),o(v,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)"},Se?{flex:1,overflow:"visible"}:{})},{children:[i(v,e({ref:mt,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E7E7E9",borderRadius:"8px 8px 0 0",display:"flex",minHeight:"40px",alignItems:"center",overflowX:"hidden"}},{children:i(m,e({title:Un,placement:"top"},{children:i(f,e({sx:{fontSize:"16px",fontWeight:500,color:"#19213D",overflow:"hidden",display:"flex",alignItems:"center",justifyContent:"center",textOverflow:"ellipsis",whiteSpace:"normal",width:"100%",height:"40px"}},{children:Un}))}))})),o(v,e({ref:Cn,onScroll:Ut,sx:e({p:"12px",display:"flex",flexDirection:"column"},Se?{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:wn,style:{width:"100%",height:"0px",flexShrink:0}}),Qn&&Gn.map(function(n,t){var l,c,u=!n.title&&!n.content;if(Se&&u)return null;var a=n,d=jt(t),s=Se?!(null===(l=a.refIndexes)||void 0===l?void 0:l.length)||a.selfIndex<0:!Jn[t],f=Se?"number"==typeof a.selfIndex&&a.selfIndex>=0?a.selfIndex+1:null:t+1,p=Ke.has(t),h=P(a.evaluationResult,null==d?void 0:d.deviationLabel);return i(v,e({ref:ut(t),sx:{mb:1,width:"100%"}},{children:o(v,e({sx:{position:"relative",width:"100%"}},{children:[i(v,e({ref:kt.current[t],sx:e({width:"100%",display:"flex"},p&&{borderRadius:"6px",outline:"2px solid ".concat((null==d?void 0:d.badgeBorder)||"#6366F1"),outlineOffset:"1px"})},{children:Jt({section:n,idx:t,columnKey:"left",colRef:r.createRef(),mb:0,parentNodeId:(null===(c=null==se?void 0:se.input_index_map)||void 0===c?void 0:c[0])||""})})),Se&&d&&o(v,e({ref:At.current[t],onClick:function(e){var i=Se?Jn.find(function(e){var n;return null===(n=a.refIndexes)||void 0===n?void 0:n.includes(e.selfIndex)})||{title:"",content:""}:Jn[t]||{title:"",content:""};vt(e,n,s,i,t,d)},sx:{position:"absolute",top:"18px",right:0,transform:"translateY(-50%) translateX(calc(100% + 8px))",display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",bgcolor:d.badgeBg,color:d.badgeText,border:"1px solid ".concat(d.badgeBorder),borderRadius:"12px",px:1.2,py:.4,fontWeight:600,cursor:"pointer",whiteSpace:"nowrap",zIndex:20,boxShadow:"0 1px 3px rgba(0,0,0,0.07)"}},{children:[null!==f&&i(v,e({component:"span",sx:{fontSize:"11px",fontWeight:700,pr:.5,borderRight:"1px solid ".concat(d.badgeBorder)}},{children:f})),i(v,e({component:"span",sx:{fontSize:"11px",px:.25}},{children:!xe.isLoading||null!=a.evaluationResult&&null!=a.evaluationResult?s?"No Deviation Found":"N/A"===h||"NA"===h?"N/A":0==h||null==h?"Same":"".concat(h):i(W,{color:d.badgeText})})),i(S,{size:11,color:d.badgeText})]}))]}))}),"left-row-".concat(t))}),i("div",{ref:_n,style:{width:"100%",height:"0px",flexShrink:0}})]}))]})),i(v,e({sx:{width:"180px",display:"flex",flexDirection:"column",alignItems:"center",pt:"15px",gap:0,zIndex:20,pointerEvents:"none"}},{children:i(v,e({sx:{display:"flex",justifyContent:"center",alignItems:"center",mt:0}},{children:o(v,e({sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:"5px",borderRadius:"20px",bgcolor:lt.badgeBg,color:lt.badgeText,border:"1px solid ".concat(lt.badgeBorder),fontSize:"12px",fontWeight:600,whiteSpace:"nowrap",position:"relative",zIndex:1,pointerEvents:"auto",cursor:"pointer"}},{children:[null!=ot?ot:i(W,{}),i(v,e({component:"span",onClick:function(n){n.stopPropagation(),pn.open&&je===tt?Bn():(Pe(tt),st(dt(n.currentTarget,{title:"",content:"",evaluationResult:it,cognitiveData:{section_id:"",decisioning:[],gap:[],relevance_score:0,isMissingRationale:!0}},null,tt,!0,e(e({},lt),{label:""}))))},sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:i(w,{})})),i(R,{size:11,style:{transform:pn.open&&je===tt?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))})),o(v,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},Se?{flex:1,overflow:"visible",minHeight:0}:{})},{children:[Te&&i(_,{sections:11}),i(v,e({ref:bt,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E3E6EA",borderRadius:"8px 8px 0 0",minHeight:"40px",display:"flex",alignItems:"center",overflowX:"hidden"}},{children:i(m,e({title:$n,placement:"top"},{children:i(f,e({sx:{fontSize:"16px",fontWeight:500,color:"#5928ED",overflow:"hidden",display:"flex",justifyContent:"center",alignItems:"center",textOverflow:"ellipsis",whiteSpace:"normal",width:"100%",height:"40px"}},{children:$n}))}))})),o(v,e({ref:In,onScroll:Ut,sx:e({p:"12px",display:"flex",flexDirection:"column"},Se?{maxHeight:"calc(100vh - 150px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,ml:"-25px",pl:"45px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[i("div",{ref:Sn,style:{width:"100%",height:"0px",flexShrink:0}}),Qn&&Jn.map(function(n,t){var l,c=n,u=[],a=!1,d=null;if(Se){u=Gn.filter(function(e){var n;return(null===(n=e.refIndexes)||void 0===n?void 0:n.includes(c.selfIndex))&&e.selfIndex>=0}).map(function(e){return e.selfIndex+1});var s=Gn.findIndex(function(e,n){var t;return Ke.has(n)&&(null===(t=e.refIndexes)||void 0===t?void 0:t.includes(c.selfIndex))});(a=-1!==s)&&(d=jt(s))}else u=[t+1],(a=Ke.has(t))&&(d=jt(t));var f=jt(t);return i(v,e({ref:Ot.current[t],sx:{mb:1,width:"100%"}},{children:o(v,e({sx:{position:"relative",width:"100%"}},{children:[i(v,e({ref:Dt.current[t],sx:e({width:"100%",display:"flex"},a&&d&&{borderRadius:"6px",outline:"2px solid ".concat(d.badgeBorder),outlineOffset:"1px"})},{children:Jt({section:n,idx:t,columnKey:"right",colRef:r.createRef(),mb:0,parentNodeId:(null===(l=null==se?void 0:se.input_index_map)||void 0===l?void 0:l[1])||""})})),Se&&!Te&&f&&i(v,e({ref:Ht.current[t],sx:{position:"absolute",top:"18px",left:0,transform:"translateY(-50%) translateX(calc(-100% - 8px))",display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:"11px",bgcolor:f.badgeBg,color:f.badgeText,border:"1px solid ".concat(f.badgeBorder),borderRadius:"10px",px:1,py:.3,fontWeight:700,whiteSpace:"nowrap",zIndex:20}},{children:u.length>0?u.join(", "):"-"}))]}))}),"right-row-".concat(t))}),i("div",{ref:Rn,style:{width:"100%",height:"0px",flexShrink:0}})]}))]}))]}))}))}))]}))};export{$ as default};
|
|
1
|
+
import{__assign as e}from"tslib";import{jsxs as t,jsx as n}from"react/jsx-runtime";import{useState as i,useRef as o,useMemo as l,useEffect as r,useCallback as c}from"react";import{Box as u,Snackbar as d,Alert as a,Tooltip as s,Typography as v}from"@mui/material";import{ChevronDown as p,EllipsisVertical as h}from"lucide-react";import{ButtonCognitiveIcon as f}from"../../assests/svg/ButtonCognitiveIcon.js";import g from"./OverlayComponent.js";import{safeStringify as x,extractDeviationScore as m,generateColorPalette as y,DEVIATION_BADGE_SEPARATOR as b,hasValue as S,getBentArrowPath as R,smoothScrollTo as C}from"./CognitiveComparehelpers.js";import{SHARED_MARKDOWN_STYLES as I,DEFAULT_FIELD_CONFIG as w,DEFAULT_COMPARISON_CONFIG as B}from"./CognitiveCompareConfig.js";export{SHARED_MARKDOWN_STYLES}from"./CognitiveCompareConfig.js";import{DEFAULT_DEVIAION_COLOR as T,DEFAULT_COMPONENT_HEADER_TEXT as F}from"./CognitiveCompareConstants.js";import k from"./CognitivePopup.js";import E from"./MoreFunctionsPopup.js";import M from"./LoaderComponent.js";import _ from"./components/ThreeDotsLoader.js";import{useCognitiveTreeData as D}from"./hooks/useCompareData.js";import{useComparePopups as H}from"./hooks/useComparePopups.js";import{useSectionRefs as A}from"./hooks/useSectionRefs.js";import{useAccordionState as L}from"./hooks/useAccordionState.js";import{useDeviationNavigation as O}from"./hooks/useDeviationNavigation.js";import j from"./components/CompareHeader.js";import N from"./components/SectionAccordion.js";import P from"./components/SubSectionAccordion.js";var z=function(z){var W,Y,K,X,V,q,J,U,G,Q,Z,$,ee,te,ne,ie=z.componentHeaderText,oe=void 0===ie?F:ie,le=z.treeData,re=z.comparisonConfig,ce=z.leftColumnTitleText,ue=z.rightColumnTitleText,de=z.markdownStyles,ae=z.displayConfig,se=void 0===ae?{isHeaderVisible:!0,isToggleVisible:!0,maintainRelativeOrder:!1,isLoading:!0}:ae,ve=z.popupConfig,pe=z.deviationData,he=void 0===pe?{}:pe,fe=z.deviationNodeIdToView,ge=i(se.maintainRelativeOrder),xe=ge[0],me=ge[1],ye=i(!1),be=ye[0],Se=ye[1],Re=i(!1),Ce=Re[0],Ie=Re[1],we=i(null),Be=we[0],Te=we[1],Fe=i(!1),ke=Fe[0],Ee=Fe[1],Me=i(!1),_e=Me[0],De=Me[1],He=i(null),Ae=He[0],Le=He[1],Oe=o(!1),je=i(new Set),Ne=je[0],Pe=je[1],ze=i([]),We=ze[0],Ye=ze[1],Ke=o(null),Xe=o(!1),Ve=o(null),qe=o({}),Je=o([]),Ue=o(!1),Ge=o(!1),Qe=o(null),Ze=o(function(){}),$e=l(function(){return(null==le?void 0:le.cognitive_decisioning)||{}},[le]),et=i({width:0,height:0}),tt=et[0],nt=et[1],it=l(function(){return e(e({},I),de)},[de]),ot=o(null),lt=o(null),rt=o(null),ct=o(null),ut=o(null),dt=o(null),at=o(null),st=o(null),vt=o(!1),pt=H(ot),ht=pt.cognitivePopup,ft=pt.setCognitivePopup,gt=pt.moreFunctions,xt=pt.setMoreFunctions,mt=pt.position,yt=pt.setPosition,bt=pt.activeBadgeId,St=pt.setActiveBadgeId,Rt=pt.popupRef,Ct=pt.closeCognitivePopup,It=pt.closeMoreFunctionsPopup,wt=l(function(){var e,t,n,i,o,l,r;return{fields:null!==(e=null==re?void 0:re.fields)&&void 0!==e?e:w,thresholds:{high:null!==(n=null===(t=null==re?void 0:re.thresholds)||void 0===t?void 0:t.high)&&void 0!==n?n:B.thresholds.high,medium:null!==(o=null===(i=null==re?void 0:re.thresholds)||void 0===i?void 0:i.medium)&&void 0!==o?o:B.thresholds.medium,exact:null!==(r=null===(l=null==re?void 0:re.thresholds)||void 0===l?void 0:l.exact)&&void 0!==r?r:B.thresholds.exact}}},[re]),Bt=i(null),Tt=Bt[0];Bt[1];var Ft=null===(K=null===(W=null==le?void 0:le.documents)||void 0===W?void 0:W[null===(Y=null==le?void 0:le.input_index_map)||void 0===Y?void 0:Y[0]])||void 0===K?void 0:K.title,kt=null===(q=null===(X=null==le?void 0:le.documents)||void 0===X?void 0:X[null===(V=null==le?void 0:le.input_index_map)||void 0===V?void 0:V[1]])||void 0===q?void 0:q.title,Et=x(ce||Ft||"Uploaded Contract"),Mt=x(ue||kt||"Reference Template"),_t=D(le,xe,he,wt),Dt=_t.activeProposed,Ht=_t.existingRule,At=_t.proposedSections,Lt=_t.existingSections,Ot=_t.visibleFields,jt=_t.parentDeviationRecord,Nt=_t.deviationNumberRegistry,Pt=_t.parseError;r(function(){Pt&&Te("Failed to load comparison: ".concat(Pt))},[Pt]);var zt=At.length>0||Lt.length>0,Wt=A(Ot.map(function(e){return e.key}),Math.max(At.length,Lt.length)),Yt=Wt.leftRefs,Kt=Wt.rightRefs,Xt=Wt.sectionLeftRefs,Vt=Wt.sectionRightRefs,qt=Wt.lhsBadgeRefs,Jt=Wt.rhsBadgeRefs,Ut=Wt.sectionRightRowRefs,Gt=Wt.subSectionLeftRefs,Qt=Wt.subSectionRightRefs,Zt=Wt.sectionRowRefs,$t=Wt.getSectionRowRef,en=Wt.getSubSectionRef,tn=Wt.getBadgeRef,nn=Ht.analysis,on=x(null===(U=null===(J=null==nn?void 0:nn.rule_difference_comparison)||void 0===J?void 0:J.summary)||void 0===U?void 0:U.overall_summary),ln=!!on.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),rn=null!==(G=null==le?void 0:le.base_root_id)&&void 0!==G?G:"-1";null==le||le[rn];var cn=(null===(Q=null==he?void 0:he[rn])||void 0===Q?void 0:Q.evaluation_result)||(null===($=null===(Z=null==le?void 0:le.nodes)||void 0===Z?void 0:Z[rn])||void 0===$?void 0:$.evaluation_result)||null,un=m(cn),dn=y(null!==(ne=null===(te=null===(ee=null==cn?void 0:cn.evaluation_outputs)||void 0===ee?void 0:ee.metadata)||void 0===te?void 0:te.label_color)&&void 0!==ne?ne:""),an=c(function(){var e,t,n,i;Ee(!1),Ge.current=!1;var o=Qe.current,l=Rn.current;if(null!==o)if("string"==typeof o&&o.includes(b)){var r=o.split(b);(c=null===(e=Gt.current[r[2]])||void 0===e?void 0:e.current)&&(c.style.paddingTop="0px")}else{var c;(c=null===(t=Xt.current[o])||void 0===t?void 0:t.current)&&(c.style.paddingTop="0px")}if(null!==l)if("string"==typeof l&&l.includes(b)){r=l.split(b);(u=null===(n=Qt.current[r[3]])||void 0===n?void 0:n.current)&&(u.style.paddingTop="0px")}else{var u;(u=null===(i=Vt.current[l])||void 0===i?void 0:i.current)&&(u.style.paddingTop="0px")}Le(null),Qe.current=null,Rn.current=null,De(!1),Ie(!1),ct.current&&(ct.current.style.height="0px"),ut.current&&(ut.current.style.height="0px"),dt.current&&(dt.current.style.height="0px"),at.current&&(at.current.style.height="0px")},[]),sn=L({maintainRelativeOrder:!!xe,proposedSections:At,existingSections:Lt,activeSideBySideSection:Ae,connectedSections:Ne,resetSideBySide:an,setConnectedSections:Pe,setConnectedLines:Ye,cachedConnectedPositions:Je,svgContainerRef:Ke,isAnimatingRef:Xe,animationTimerRef:Ve,calculateLinesRef:Ze,sectionLeftRefs:Xt,sectionRightRefs:Vt,subSectionLeftRefs:Gt,subSectionRightRefs:Qt}),vn=sn.expandedSections,pn=sn.expandedSubSections,hn=sn.setExpandedSubSections,fn=sn.toggleSection,gn=c(function(e,t,n,i,o,l,r){var c,u,d,a=x(null==t?void 0:t.id)||x(null==n?void 0:n.id)||"",s=(a?$e[a]:null)||(null==t?void 0:t.cognitiveData)||(null==n?void 0:n.cognitiveData)||{section_id:a,decisioning:[],gap:[],relevance_score:0},v=null!==(u=null===(c=Zt.current[i])||void 0===c?void 0:c.current)&&void 0!==u?u:null;return{isLoading:null!==(d=null==se?void 0:se.isLoading)&&void 0!==d&&d,open:!0,sectionTitle:(null==t?void 0:t.displayTitle)?null==t?void 0:t.title:"no title",refSectionTitle:(null==n?void 0:n.displayTitle)?null==n?void 0:n.title:"no title",cognitiveData:s,anchorEl:e,sectionAnchorEl:v,badgeStyle:l||null,sectionIdx:i,docData:{documents:null==le?void 0:le.documents,input_index_map:null==le?void 0:le.input_index_map},deviationData:(null==t?void 0:t.evaluationResult)||(null==n?void 0:n.evaluationResult)||null,isOrphan:!!o}},[$e,le]),xn=c(function(e){It(),yt(null),ft(e)},[It]),mn=function(e,t,n,i,o,l){e.stopPropagation(),gt.open&>.sectionIdx===o?It():(Ct(),xt(gn(e.currentTarget,t,i,o,n,l)))},yn=c(function(){null!==gt.sectionIdx&>.anchorEl?xn(e(e({},gt),{open:!0})):It()},[gt,It,xn]),bn=c(function(){var e=gt.sectionIdx,t=gt.isOrphan;It(),null!==e&&(t?Te("No counterpart exists to connect to."):(Ge.current&&an(),Pe(function(t){return t.has(e)?new Set:new Set([e])})))},[gt.sectionIdx,It,an]),Sn=o(null),Rn=o(null),Cn=o(null),In=o(null),wn=o(null),Bn=i([]),Tn=Bn[0],Fn=Bn[1];o(null);var kn=i(null),En=kn[0],Mn=kn[1];r(function(){if(Tt){var e=wt.fields.find(function(e){return e.analysisKey===Tt||e.key===Tt});if(e){var t=Yt.current[e.key]||Kt.current[e.key];(null==t?void 0:t.current)&&setTimeout(function(){return t.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[Tt,wt.fields]);var _n=c(function(e){var t,n,i,o,l,r,c,u,d,a=null===(t=null==nn?void 0:nn.rule_difference_comparison)||void 0===t?void 0:t.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===(n=null==s?void 0:s.highlights)||void 0===n?void 0:n.ruleA_spans)||void 0===i?void 0:i.length)||(null===(l=null===(o=null==s?void 0:s.highlights)||void 0===o?void 0:o.ruleB_spans)||void 0===l?void 0:l.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===(r=p.highlights)||void 0===r?void 0:r.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}},[nn]),Dn=c(function(t){var n,i,o,l,r,c,u,d=At[t],a=Lt[t],s=(null==d?void 0:d.relation)&&"not_defined"!==d.relation,v=(null==a?void 0:a.relation)&&"not_defined"!==a.relation;x(null==d?void 0:d.id)||x(null==a?void 0:a.id);var p=!(!(null==d?void 0:d.cognitiveData)&&!(null==a?void 0:a.cognitiveData));if(!s&&!v&&!p)return e(e({},y(T)),{label:"Not Defined"});var h=null!==(i=null!==(n=null==d?void 0:d.evaluationResult)&&void 0!==n?n:null==a?void 0:a.evaluationResult)&&void 0!==i?i:null,f=null===(o=null==h?void 0:h.evaluation_outputs)||void 0===o?void 0:o.output_value,g=null!==(c=null===(r=null===(l=null==h?void 0:h.evaluation_outputs)||void 0===l?void 0:l.metadata)||void 0===r?void 0:r.label_color)&&void 0!==c?c:T;return e(e({},y(g)),null!=h?{label:null!==(u=f)&&void 0!==u?u:""}:{label:null})},[At,Lt,$e,wt,_n]),Hn=c(function(t){for(var n,i,o,l,r,c,u,d,a,s=t.split("-").map(Number),v=At[s[0]],p=Lt[s[0]],h=1;h<s.length;h++)(null==v?void 0:v.subsections)&&(v=v.subsections[s[h]]),(null==p?void 0:p.subsections)&&(p=p.subsections[s[h]]);if(!v&&!p)return null;var f=(null==v?void 0:v.relation)&&"not_defined"!==v.relation,g=(null==p?void 0:p.relation)&&"not_defined"!==p.relation,m=x(null==v?void 0:v.id)||x(null==p?void 0:p.id)||"",b=!(!(null==v?void 0:v.cognitiveData)&&!(null==p?void 0:p.cognitiveData));if(!f&&!g&&!b)return e(e({},y(T)),{label:"Not Defined"});null!==(i=null!==(n=null==v?void 0:v.cognitiveRelevanceScore)&&void 0!==n?n:null==p?void 0:p.cognitiveRelevanceScore)&&void 0!==i||m&&(null===(o=$e[m])||void 0===o||o.relevance_score);var S=null!==(r=null!==(l=null==v?void 0:v.evaluationResult)&&void 0!==l?l:null==p?void 0:p.evaluationResult)&&void 0!==r?r:null,R=null===(c=null==S?void 0:S.evaluation_outputs)||void 0===c?void 0:c.output_value,C=null!==(a=null===(d=null===(u=null==S?void 0:S.evaluation_outputs)||void 0===u?void 0:u.metadata)||void 0===d?void 0:d.label_color)&&void 0!==a?a:T;return e(e({},y(C)),null!=S?{label:null!=R?R:""}:{label:null})},[At,Lt,$e,wt]),An=c(function(){var e,t,n,i,o,l,r,c,u,d,a,s,v,p,h,f,g,x,m,y,C,I;if(!vt.current&&!Xe.current){vt.current=!0;try{if(!Sn.current)return;var w=function(e){var t=e.split("-"),n=t[0];if(!vn[n]&&!1===xe)return!1;if(xe&&!vn["left-".concat(n)]&&!vn["right-".concat(n)]&&!vn[n])return!1;for(var i=n,o=1;o<t.length-1;o++)if(i+="-".concat(t[o]),!pn[i])return!1;return!0},B=Sn.current.getBoundingClientRect();nt({width:B.width,height:B.height});var T=[];if(Ot.forEach(function(e){var t,n,i=e.key,o=null===(t=Yt.current[i])||void 0===t?void 0:t.current,l=null===(n=Kt.current[i])||void 0===n?void 0:n.current;o&&l&&(o.style.height="auto",l.style.height="auto",o.style.minHeight="0px",l.style.minHeight="0px")}),!Xe.current){for(var F=0;F<Math.max(At.length,Lt.length);F++){var k=null===(e=Xt.current[F])||void 0===e?void 0:e.current,E=null===(t=Vt.current[F])||void 0===t?void 0:t.current;k&&(k.style.height="auto",k.style.minHeight="0px"),E&&(E.style.height="auto",E.style.minHeight="0px")}xe||Object.keys(Gt.current).forEach(function(e){var t,n;if(w(e)){var i=null===(t=Gt.current[e])||void 0===t?void 0:t.current,o=null===(n=Qt.current[e])||void 0===n?void 0:n.current;i&&o&&(i.style.height="auto",o.style.height="auto",i.style.minHeight="0px",o.style.minHeight="0px")}})}var M={};Ot.forEach(function(e){var t,n,i=e.key,o=null===(t=Yt.current[i])||void 0===t?void 0:t.current,l=null===(n=Kt.current[i])||void 0===n?void 0:n.current;if(o&&l){var r=o.getBoundingClientRect(),c=l.getBoundingClientRect();M[i]=Math.max(r.height,c.height)}});var _={left:{},right:{}},D={};if(!Xe.current)if(xe){if(ke&&null!==Ae)if("number"==typeof Ae){var H=Ae,A=At[H],L=null===(o=Xt.current[H])||void 0===o?void 0:o.current;L&&A&&(A.refIndexes||[]).forEach(function(e){var t,n=Lt.findIndex(function(t){return t.selfIndex===e}),i=null===(t=Vt.current[n])||void 0===t?void 0:t.current;if(i&&(vn["left-".concat(H)]||vn["right-".concat(n)])){var o=Math.max(L.getBoundingClientRect().height,i.getBoundingClientRect().height);_.left[H]=Math.max(_.left[H]||0,o),_.right[n]=Math.max(_.right[n]||0,o)}})}else{var O=Ae.split(b)[2];if(O){k=null===(l=Gt.current[O])||void 0===l?void 0:l.current,E=null===(r=Qt.current[O])||void 0===r?void 0:r.current;if(k&&E){j=Math.max(k.getBoundingClientRect().height,E.getBoundingClientRect().height);D[O]=Math.max(D[O]||0,j)}}}}else{Object.keys(Gt.current).forEach(function(e){var t,n;if(w(e)){var i=null===(t=Gt.current[e])||void 0===t?void 0:t.current,o=null===(n=Qt.current[e])||void 0===n?void 0:n.current;if(i&&o&&null!==i.offsetParent&&null!==o.offsetParent){var l=i.getBoundingClientRect(),r=o.getBoundingClientRect(),c=Math.max(l.height,r.height);D[e]=c,i.style.minHeight="".concat(c,"px"),o.style.minHeight="".concat(c,"px")}}});for(F=0;F<Math.min(At.length,Lt.length);F++){var k=null===(n=Xt.current[F])||void 0===n?void 0:n.current,E=null===(i=Vt.current[F])||void 0===i?void 0:i.current;if(k&&E){var j=Math.max(k.getBoundingClientRect().height,E.getBoundingClientRect().height);_.left[F]=j,_.right[F]=j}}}if(Ot.forEach(function(e){var t,n,i=e.key,o=null===(t=Yt.current[i])||void 0===t?void 0:t.current,l=null===(n=Kt.current[i])||void 0===n?void 0:n.current;if(o&&l){var r=M[i];o.style.minHeight="".concat(r,"px"),l.style.minHeight="".concat(r,"px")}}),Xe.current||(Object.entries(_.left).forEach(function(e){var t,n=e[0],i=e[1],o=null===(t=Xt.current[Number(n)])||void 0===t?void 0:t.current;o&&(o.style.minHeight="".concat(i,"px"))}),Object.entries(_.right).forEach(function(e){var t,n=e[0],i=e[1],o=null===(t=Vt.current[Number(n)])||void 0===t?void 0:t.current;o&&(o.style.minHeight="".concat(i,"px"))}),xe||Object.keys(D).forEach(function(e){var t,n,i=null===(t=Gt.current[e])||void 0===t?void 0:t.current,o=null===(n=Qt.current[e])||void 0===n?void 0:n.current;if(i&&o&&D[e]){var l=D[e];i.style.minHeight="".concat(l,"px"),o.style.minHeight="".concat(l,"px")}})),xe)At.forEach(function(e,t){var n;(null===(n=Xt.current[t])||void 0===n?void 0:n.current)&&(e.refIndexes||[]).forEach(function(e){var n,i,o,l,r,c,u,d,a,s,v=Lt.findIndex(function(t){return t.selfIndex===e});if(-1!==v){var p=null===(n=qt.current[t])||void 0===n?void 0:n.current,h=null===(i=Jt.current[v])||void 0===i?void 0:i.current;if(p&&h){var f=p.getBoundingClientRect(),g=h.getBoundingClientRect(),x=f.right-B.left,m=g.left-B.left,y=f.top+f.height/2-B.top,b=g.top+g.height/2-B.top;if(ke&&Ae===t){var S=null!==(l=null===(o=st.current)||void 0===o?void 0:o.getBoundingClientRect().top)&&void 0!==l?l:0,R=null!==(c=null===(r=rt.current)||void 0===r?void 0:r.getBoundingClientRect().top)&&void 0!==c?c:0,C=S+(null!==(d=null===(u=st.current)||void 0===u?void 0:u.clientHeight)&&void 0!==d?d:1/0),I=R+(null!==(s=null===(a=rt.current)||void 0===a?void 0:a.clientHeight)&&void 0!==s?s:1/0),w=f.top+f.height/2,F=function(e,t,n){return Math.max(t,Math.min(n,e))};y=F(w,S,C)-B.top,b=F(w,R,I)-B.top}var k=Dn(t);k&&T.push({id:"line-".concat(t,"-").concat(v),x1:x,y1:y,x2:m,y2:b,style:k,sectionIdx:t,targetRightIdx:v})}}})});else{for(F=0;F<Math.min(At.length,Lt.length);F++){var N=null===(c=Xt.current[F])||void 0===c?void 0:c.current,P=null===(u=Vt.current[F])||void 0===u?void 0:u.current;if(N&&P){var z=N.getBoundingClientRect(),W=P.getBoundingClientRect(),Y=Math.max(z.top,W.top)+18-B.top,K=(null===(d=Lt[F])||void 0===d?void 0:d.id)||"sec-".concat(F);(Z=Dn(F))&&T.push({id:K,x1:z.right-B.left,y1:Y,x2:W.left-B.left,y2:Y,style:Z,sectionIdx:F,hasCognitive:!!((null===(a=At[F])||void 0===a?void 0:a.cognitiveData)||(null===(s=Lt[F])||void 0===s?void 0:s.cognitiveData)||K&&$e[K]),isSubSection:!1})}}Object.keys(Gt.current).forEach(function(e){var t,n,i,o,l,r;if(w(e)){var c=null===(t=Gt.current[e])||void 0===t?void 0:t.current,u=null===(n=Qt.current[e])||void 0===n?void 0:n.current;if(c&&u){for(var d=e.split("-").map(Number),a=At[d[0]],s=Lt[d[0]],v=1;v<d.length;v++)(null==a?void 0:a.subsections)&&(a=a.subsections[d[v]]),(null==s?void 0:s.subsections)&&(s=s.subsections[d[v]]);var p=!!a&&((null===(i=a.displayTitle)||void 0===i||i)&&S(a.title)),h=!!a&&((null===(o=a.displayContent)||void 0===o||o)&&S(a.content)),f=!!s&&((null===(l=s.displayTitle)||void 0===l||l)&&S(s.title)),g=!!s&&((null===(r=s.displayContent)||void 0===r||r)&&S(s.content));if(p&&h||f&&g){var x=c.getBoundingClientRect(),m=u.getBoundingClientRect(),y=Math.max(x.top,m.top)+16-B.top,b=Hn(e);b&&"Not Defined"!==b.label&&T.push({id:"subsec-".concat(e),x1:x.right-B.left,y1:y,x2:m.left-B.left,y2:y,style:b,sectionIdx:d[0],isSubSection:!0,subSectionKeyPath:e,hasCognitive:!(!(null==a?void 0:a.cognitiveData)&&!(null==s?void 0:s.cognitiveData))})}}}})}if(ke&&"string"==typeof Ae&&Ae.includes(b)){var X=Ae.split(b),V=X[0],q=X[1],J=X[2],U=(X[3],"".concat(V).concat(b).concat(q)),G=null===(v=qt.current[U])||void 0===v?void 0:v.current,Q=null===(p=Jt.current[U])||void 0===p?void 0:p.current;if(G&&Q){var Z,$=G.getBoundingClientRect(),ee=Q.getBoundingClientRect(),te=$.right-B.left,ne=ee.left-B.left,ie=$.top+$.height/2-B.top,oe=ee.top+ee.height/2-B.top;if(xe){var le=null!==(f=null===(h=st.current)||void 0===h?void 0:h.getBoundingClientRect().top)&&void 0!==f?f:0,re=null!==(x=null===(g=rt.current)||void 0===g?void 0:g.getBoundingClientRect().top)&&void 0!==x?x:0,ce=le+(null!==(y=null===(m=st.current)||void 0===m?void 0:m.clientHeight)&&void 0!==y?y:1/0),ue=re+(null!==(I=null===(C=rt.current)||void 0===C?void 0:C.clientHeight)&&void 0!==I?I:1/0),de=function(e,t,n){return Math.max(t,Math.min(n,e))};ie=de($.top+$.height/2,le,ce)-B.top,oe=de(ee.top+ee.height/2,re,ue)-B.top}(Z=Hn(J))&&T.push({id:"line-subsec-".concat(U),x1:te,y1:ie,x2:ne,y2:oe,style:Z,sectionIdx:Number(J.split("-")[0]),isSubSection:!0,subSectionKeyPath:Ae})}}if(Fn(T),In.current&&wn.current){var ae=In.current.getBoundingClientRect(),se=wn.current.getBoundingClientRect(),ve=(ae.top+ae.height/2-B.top+se.top+se.height/2-B.top)/2;Mn({x1:ae.right-B.left,x2:se.left-B.left,y:ve})}else Mn(null);if(Ne.size>0){var pe=[],he=st.current,fe=rt.current;if(he&&fe){var ge=[],me=he.getBoundingClientRect().top,ye=fe.getBoundingClientRect().top,be=me+he.clientHeight,Se=ye+fe.clientHeight,Re=he.scrollTop,Ce=fe.scrollTop,Ie=B.top,we=function(e,t,n){return Math.max(t,Math.min(n,e))};Ne.forEach(function(e){var t,n,i,o,l;if("string"==typeof e&&e.includes(b)){var r=e.split(b),c=r[0],u=r[1],d=r[2],a=(r[3],"".concat(c).concat(b).concat(u)),s=null===(t=qt.current[a])||void 0===t?void 0:t.current,v=null===(n=Jt.current[a])||void 0===n?void 0:n.current;if(!s||!v)return;var p=s.getBoundingClientRect(),h=v.getBoundingClientRect(),f=Hn(d),g=(A=p.right-B.left)+.5*((L=h.left-B.left-0)-A),x=p.top+p.height/2,m=h.top+h.height/2,y=x-me+Re,S=m-ye+Ce,C="conn-subsec-".concat(a);ge.push({lhsScrollY:y,rhsScrollY:S,x1:A,x2:L,containerTop:Ie,leftIdx:e,rhsArrayIdx:e,styleColor:(null==f?void 0:f.badgeBorder)||"#6366F1",styleId:C});var I=we(x,me,be),w=we(m,ye,Se),T=I-Ie,F=w-Ie,k=m>=ye-4&&m<=Se+4,E="";E=(O=x>=me-4&&x<=be+4)&&k?R(A,T,L,F):O&&!k?"M ".concat(A,",").concat(T," L ").concat(g,",").concat(T," L ").concat(g,",").concat(F):!O&&k?"M ".concat(g,",").concat(T," L ").concat(g,",").concat(F," L ").concat(L,",").concat(F):"M ".concat(g,",").concat(T," L ").concat(g,",").concat(F),pe.push({id:C,pathD:E,style:f,leftIdx:e,rhsArrayIdx:e})}else if(xe){var M=e,_=At[M];if(!(null===(l=null==_?void 0:_.refIndexes)||void 0===l?void 0:l.length))return;_.refIndexes.forEach(function(e){var t,n,i=Lt.findIndex(function(t){return t.selfIndex===e});if(-1!==i){var o=null===(t=qt.current[M])||void 0===t?void 0:t.current,l=null===(n=Jt.current[i])||void 0===n?void 0:n.current;if(o&&l){var r=o.getBoundingClientRect(),c=l.getBoundingClientRect(),u=Dn(M),d=r.right-B.left,a=c.left-B.left-0,s=d+.5*(a-d),v=r.top+r.height/2,p=c.top+c.height/2,h=v-me+Re,f=p-ye+Ce,g="conn-".concat(M,"-").concat(i);ge.push({lhsScrollY:h,rhsScrollY:f,x1:d,x2:a,containerTop:Ie,leftIdx:M,rhsArrayIdx:i,styleColor:(null==u?void 0:u.badgeBorder)||"#6366F1",styleId:g});var x=we(v,me,be),m=we(p,ye,Se),y=x-Ie,b=m-Ie,S=v>=me-4&&v<=be+4,C=p>=ye-4&&p<=Se+4,I="";I=S&&C?R(d,y,a,b):S&&!C?"M ".concat(d,",").concat(y," L ").concat(s,",").concat(y," L ").concat(s,",").concat(b):!S&&C?"M ".concat(s,",").concat(y," L ").concat(s,",").concat(b," L ").concat(a,",").concat(b):"M ".concat(s,",").concat(y," L ").concat(s,",").concat(b),pe.push({id:g,pathD:I,style:u,leftIdx:M,rhsArrayIdx:i})}}})}else{var D=e,H=D;s=null===(i=qt.current[D])||void 0===i?void 0:i.current,v=null===(o=Jt.current[H])||void 0===o?void 0:o.current;if(!s||!v)return;var A,L;p=s.getBoundingClientRect(),h=v.getBoundingClientRect(),f=Dn(D),g=(A=p.right-B.left)+.5*((L=h.left-B.left-0)-A),x=p.top+p.height/2,m=h.top+h.height/2,y=x-me+Re,S=m-ye+Ce,C="conn-".concat(D,"-").concat(H);ge.push({lhsScrollY:y,rhsScrollY:S,x1:A,x2:L,containerTop:Ie,leftIdx:D,rhsArrayIdx:H,styleColor:(null==f?void 0:f.badgeBorder)||"#6366F1",styleId:C});var O;I=we(x,me,be),w=we(m,ye,Se),T=I-Ie,F=w-Ie,k=m>=ye-4&&m<=Se+4,E="";E=(O=x>=me-4&&x<=be+4)&&k?R(A,T,L,F):O&&!k?"M ".concat(A,",").concat(T," L ").concat(g,",").concat(T," L ").concat(g,",").concat(F):!O&&k?"M ".concat(g,",").concat(T," L ").concat(g,",").concat(F," L ").concat(L,",").concat(F):"M ".concat(g,",").concat(T," L ").concat(g,",").concat(F),pe.push({id:C,pathD:E,style:f,leftIdx:D,rhsArrayIdx:H})}}),Je.current=ge}Ye(pe)}else Ye([]),Je.current=[]}catch(e){console.error("Line render safe fail: ",e)}finally{vt.current=!1}}},[Ot,At,Lt,$e,wt,_n,Dn,xe,ke,Ae,Ne,vn,pn]),Ln=c(function(){var e,t,n,i,o,l,r,c,u,d,a,s,v,p,h=Je.current;if(h.length&&!Xe.current){var f=null!==(t=null===(e=st.current)||void 0===e?void 0:e.scrollTop)&&void 0!==t?t:0,g=null!==(i=null===(n=rt.current)||void 0===n?void 0:n.scrollTop)&&void 0!==i?i:0,x=null!==(l=null===(o=st.current)||void 0===o?void 0:o.clientHeight)&&void 0!==l?l:1/0,m=null!==(c=null===(r=rt.current)||void 0===r?void 0:r.clientHeight)&&void 0!==c?c:1/0,y=null!==(d=null===(u=st.current)||void 0===u?void 0:u.getBoundingClientRect().top)&&void 0!==d?d:0,b=null!==(s=null===(a=rt.current)||void 0===a?void 0:a.getBoundingClientRect().top)&&void 0!==s?s:0,S=y+x,C=b+m,I=null!==(p=null===(v=Sn.current)||void 0===v?void 0:v.getBoundingClientRect().top)&&void 0!==p?p:0,w=function(e,t,n){return Math.max(t,Math.min(n,e))};h.forEach(function(e){var t=e.lhsScrollY-f+y,n=e.rhsScrollY-g+b,i=qe.current[e.styleId+"-stroke"],o=qe.current[e.styleId+"-bg"];if(i||o){var l,r=w(t,y,S),c=w(n,b,C),u=r-I,d=c-I,a=t>=y-4&&t<=S+4,s=n>=b-4&&n<=C+4,v=e.x1+.5*(e.x2-e.x1);l=a&&s?R(e.x1,u,e.x2,d):a&&!s?"M ".concat(e.x1,",").concat(u," L ").concat(v,",").concat(u," L ").concat(v,",").concat(d):!a&&s?"M ".concat(v,",").concat(u," L ").concat(v,",").concat(d," L ").concat(e.x2,",").concat(d):"M ".concat(v,",").concat(u," L ").concat(v,",").concat(d),i&&(i.setAttribute("visibility","visible"),i.setAttribute("d",l)),o&&(o.setAttribute("visibility","visible"),o.setAttribute("d",l))}})}},[]);r(function(){Ze.current=An},[An]);var On=o(null),jn=c(function(){null!==On.current&&clearTimeout(On.current),On.current=setTimeout(function(){Ze.current(),On.current=null},50)},[]),Nn=c(function(e){var t,n,i,o,l,r,c,u,d,a;if(!Oe.current){if(xe||jn(),Ge.current){var s=Qe.current,v=Rn.current,p=st.current,h=rt.current;if(null!==s&&null!==v&&p&&h){var f="string"==typeof s&&s.includes(b)?null===(t=qt.current["".concat(s.split(b)[0]).concat(b).concat(s.split(b)[1])])||void 0===t?void 0:t.current:null===(n=Zt.current[s])||void 0===n?void 0:n.current,g="string"==typeof v&&v.includes(b)?null===(i=Jt.current["".concat(v.split(b)[0]).concat(b).concat(v.split(b)[1])])||void 0===i?void 0:i.current:null===(o=Ut.current[v])||void 0===o?void 0:o.current;if(f&&g){var x=f.getBoundingClientRect().top-p.getBoundingClientRect().top+p.scrollTop,m=g.getBoundingClientRect().top-h.getBoundingClientRect().top+h.scrollTop;if(e.currentTarget===p){var y=m-(x-p.scrollTop),S=h.scrollHeight-h.clientHeight,R=Math.max(0,Math.min(y,S));Math.abs(h.scrollTop-R)>1&&(h.scrollTop=R)}else if(e.currentTarget===h){var C=x-(m-h.scrollTop),I=p.scrollHeight-p.clientHeight,w=Math.max(0,Math.min(C,I));Math.abs(p.scrollTop-w)>1&&(p.scrollTop=w)}if(Cn.current){var B=void 0,T=void 0;if("string"==typeof s&&s.includes(b)){var F=s.split(b),k="".concat(F[0]).concat(b).concat(F[1]);B=null===(l=qt.current[k])||void 0===l?void 0:l.current,T=null===(r=Jt.current[k])||void 0===r?void 0:r.current}else B=null===(c=qt.current[s])||void 0===c?void 0:c.current,T=null===(u=Jt.current[v])||void 0===u?void 0:u.current;var E=null!==(a=null===(d=Sn.current)||void 0===d?void 0:d.getBoundingClientRect().top)&&void 0!==a?a:0,M=p.getBoundingClientRect().top,_=M+p.clientHeight,D=h.getBoundingClientRect().top,H=D+h.clientHeight,A=function(e,t,n){return Math.max(t,Math.min(n,e))};if(B&&T){var L=B.getBoundingClientRect(),O=T.getBoundingClientRect(),j=L.top+L.height/2,N=O.top+O.height/2,P=A(j,M,_),z=A(N,D,H);Cn.current.setAttribute("y1",(P-E).toString()),Cn.current.setAttribute("y2",(z-E).toString());var W=j>=M-4&&j<=_+4;Cn.current.setAttribute("visibility",W?"visible":"hidden")}}}}}Je.current.length>0&&!Ue.current&&(Ue.current=!0,requestAnimationFrame(function(){Ln(),Ue.current=!1}))}},[Ln,xe,jn]);r(function(){var e=setTimeout(jn,250);window.addEventListener("resize",jn);var t=null,n=null;return ot.current&&(t=new ResizeObserver(jn)).observe(ot.current),Sn.current&&(n=new ResizeObserver(jn)).observe(Sn.current),function(){clearTimeout(e),window.removeEventListener("resize",jn),null==t||t.disconnect(),null==n||n.disconnect()}},[Dt,Ht,nn,Ot,vn,pn,At,Lt,wt,jn,ke,Ae,_e,Ne]),r(function(){Ge.current=ke},[ke]),r(function(){Qe.current=Ae},[Ae]);var Pn=c(function(){var e,t,n,i,o=gt.sectionIdx,l=gt.isOrphan;if(It(),null!=o)if(l)Te("No counterpart exists for this section.");else if(ke&&Ae===o)an();else{if(!xe){var r=Qe.current,c=Rn.current;if(null!==r)if("string"==typeof r&&r.includes(b)){var u=r.split(b);(d=null===(e=Gt.current[u[2]])||void 0===e?void 0:e.current)&&(d.style.paddingTop="0px")}else{var d;(d=null===(t=Xt.current[r])||void 0===t?void 0:t.current)&&(d.style.paddingTop="0px")}if(null!==c)if("string"==typeof c&&c.includes(b)){u=c.split(b);(a=null===(n=Qt.current[u[3]])||void 0===n?void 0:n.current)&&(a.style.paddingTop="0px")}else{var a;(a=null===(i=Vt.current[c])||void 0===i?void 0:i.current)&&(a.style.paddingTop="0px")}}Pe(new Set),Ye([]),Je.current=[],Ie(!0),Oe.current=!0,Le(o),Qe.current=o,Ee(!0),Ge.current=!0,De(!1),ct.current&&(ct.current.style.height="0px"),ut.current&&(ut.current.style.height="0px"),dt.current&&(dt.current.style.height="0px"),at.current&&(at.current.style.height="0px"),requestAnimationFrame(function(){var e,t,n,i,l,r,c,u,d,a,s,v=null,p=null,h=null,f=null,g=null;if("string"==typeof o&&o.includes(b)){var x=o.split(b),m="".concat(x[0]).concat(b).concat(x[1]);v=(null===(e=qt.current[m])||void 0===e?void 0:e.current)||null,g=(p=(null===(t=Jt.current[m])||void 0===t?void 0:t.current)||null)?o:null,h=(null===(n=Gt.current[x[2]])||void 0===n?void 0:n.current)||null,f=(null===(i=Qt.current[x[3]])||void 0===i?void 0:i.current)||null}else if(v=(null===(l=Zt.current[o])||void 0===l?void 0:l.current)||null,h=(null===(r=Xt.current[o])||void 0===r?void 0:r.current)||null,xe){var y=At[o],S=(null==y?void 0:y.refIndexes)||[];if(S.length>0){var R=S[0],I=Lt.findIndex(function(e){return e.selfIndex===R});-1!==I&&(p=(null===(d=Ut.current[I])||void 0===d?void 0:d.current)||null,f=(null===(a=Vt.current[I])||void 0===a?void 0:a.current)||null,g=I)}}else p=(null===(c=Ut.current[o])||void 0===c?void 0:c.current)||null,f=(null===(u=Vt.current[o])||void 0===u?void 0:u.current)||null,g=p?o:null;Rn.current=g;var w=st.current,B=rt.current;if(!v||!w)return Oe.current=!1,void Ie(!1);if(!p||!B)return De(!0),Ze.current(),Oe.current=!1,void Ie(!1);if(!xe){var T=v.getBoundingClientRect(),F=p.getBoundingClientRect(),k=T.top-F.top;h&&f&&(h.style.paddingTop="0px",f.style.paddingTop="0px",k>0?f.style.paddingTop="".concat(k,"px"):k<0&&(h.style.paddingTop="".concat(Math.abs(k),"px")));var E=v?v.getBoundingClientRect().top:(null==h?void 0:h.getBoundingClientRect().top)||0;return null===(s=ot.current)||void 0===s||s.scrollTo({top:ot.current.scrollTop+E-150,behavior:"smooth"}),De(!0),Ze.current(),Oe.current=!1,void Ie(!1)}var M=v.getBoundingClientRect().top-w.getBoundingClientRect().top+w.scrollTop,_=p.getBoundingClientRect().top-B.getBoundingClientRect().top+B.scrollTop-(M-w.scrollTop);_<0&&ct.current&&(ct.current.style.height="".concat(Math.abs(_),"px"));requestAnimationFrame(function(){var e,t=B.scrollHeight-B.clientHeight;if(_<0)e=0;else{if(_>t){var n=_-t;return ut.current&&(ut.current.style.height="".concat(n+150,"px")),void requestAnimationFrame(function(){C(B,_,200,function(){De(!0),Ze.current(),Oe.current=!1,Ie(!1)})})}e=_}C(B,e,200,function(){De(!0),Ze.current(),Oe.current=!1,Ie(!1)})})})}},[It,gt.sectionIdx,ke,Ae,At,Lt,jn,an]),zn=null!==gt.sectionIdx&&Ne.has(gt.sectionIdx),Wn=O({proposedSections:At,existingSections:Lt,parentDeviationRecord:jt,expandedSections:vn,maintainRelativeOrder:!!xe,scrollContainerRef:ot,leftContainerRef:st,lhsBadgeRefs:qt,rhsBadgeRefs:Jt}),Yn=Wn.showDeviationNavigation,Kn=Wn.showOpenNodeRef;r(function(){if(fe){var e=function(e){var t=jt[e].find(function(e){return e.id===fe});if(t){var n=At.findIndex(function(t){return t.id===e});(xe?!!vn["right-".concat(n)]:!!vn[String(n)])||fn(n,"left");var i="".concat(t.id).concat(b,"0"),o=setInterval(function(){var e,t,n=null===(e=qt.current[i])||void 0===e?void 0:e.current,l=null===(t=Jt.current[i])||void 0===t?void 0:t.current;if(n){n.scrollIntoView({behavior:"smooth",block:"center"});var r=window.getComputedStyle(n).color;n.style.transition="box-shadow 300ms ease-in-out",n.style.boxShadow="0 0 10px ".concat(r),l&&(l.style.transition="box-shadow 300ms ease-in-out",l.style.boxShadow="0 0 10px ".concat(r)),setTimeout(function(){n.style.boxShadow="",l&&(l.style.boxShadow="")},2e3),clearTimeout(o)}},600);return"break"}};for(var t in jt){if("break"===e(t))break}}},[fe]);var Xn=function(e){var t=e.section,i=e.keyPath,o=e.depth,l=void 0===o?0:o,r=e.columnKey,c=void 0===r?"left":r,u=e.parentNodeId;return n(P,{section:t,keyPath:i,depth:l,columnKey:c,parentNodeId:void 0===u?"":u,expandedSubSections:pn,setExpandedSubSections:hn,maintainRelativeOrder:xe||!1,proposedSections:At,existingSections:Lt,treeData:le,deviationNumberRegistry:Nt,connectedSections:Ne,activeSideBySideSection:Ae,resolvedMarkdownStyles:it,getSubSectionRef:en,getSubSectionCompareStyle:Hn,getBadgeRef:tn,openMoreFunctionsPopup:mn,resetSideBySide:an,setConnectedSections:Pe,setConnectedLines:Ye,cachedConnectedPositions:Je})};return t(u,e({ref:lt,sx:e(e({display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif'},xe?{}:{overflow:"visible"}),{position:"relative"})},{children:[be&&n(u,e({sx:{position:"absolute",inset:0,bgcolor:"rgba(255, 255, 255, 0.6)",backdropFilter:"blur(10px)",zIndex:9999,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"8px"}},{children:n(M,{})})),n(E,{open:gt.open,anchorEl:gt.anchorEl,sectionTitle:gt.sectionTitle,referenceSectionTitle:gt.refSectionTitle,onClose:It,onOpenCognitiveCompare:yn,onOpenSideBySide:Pn,onConnect:bn,isConnected:zn,isOrphan:gt.isOrphan}),ht.open&&n(k,{open:ht.open,popupRef:Rt,position:mt,popupConfig:ve,onClose:function(){yt(null),ft(function(t){return e(e({},t),{open:!1})}),St(null)},markdownStyles:de,sectionTitle:ht.sectionTitle,referenceSectionTitle:ht.refSectionTitle,cognitiveData:ht.cognitiveData,anchorEl:ht.anchorEl,sectionAnchorEl:ht.sectionAnchorEl,scrollContainerEl:ot.current,badgeStyle:ht.badgeStyle,docData:ht.docData,deviationData:ht.deviationData,isLoading:ht.isLoading}),n(d,e({open:!!Be,autoHideDuration:8e3,onClose:function(){return Te(null)},anchorOrigin:{vertical:"top",horizontal:"center"}},{children:n(a,e({onClose:function(){return Te(null)},severity:"error",sx:{width:"100%",whiteSpace:"pre-line"}},{children:Be}))})),n(j,{componentHeaderText:oe,displayConfig:se,maintainRelativeOrder:xe,onToggleView:function(e){Se(!0),setTimeout(function(){me(!e),an(),Pe(new Set),Ye([]),Je.current=[],setTimeout(function(){Se(!1)},400)},50)}}),n(u,e({ref:ot,onScroll:Nn,sx:{flex:1,minHeight:0,pt:1.5,pb:1,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",overflowY:xe?"hidden":"auto",borderTop:on&&ln?"none":"1.5px solid #EEF0F4"}},{children:n(u,e({sx:e({display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"},xe?{flex:1,minHeight:0}:{})},{children:t(u,e({ref:Sn,sx:e({display:"grid",gridTemplateColumns:"minmax(0, 1fr) 180px minmax(0, 1fr)",gap:"10px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0},xe?{flex:1,overflow:"visible"}:{})},{children:[t("svg",e({ref:Ke,style:{position:"absolute",top:0,left:0,width:tt.width||"100%",height:tt.height||"100%",pointerEvents:"none",zIndex:10,overflow:"visible",transition:"opacity 0.15s ease-in-out"}},{children:[En&&!ke&&n("g",{children:n("line",{x1:En.x1,y1:En.y,x2:En.x2,y2:En.y,stroke:dn.badgeBorder,strokeWidth:"1.5"})}),Tn.map(function(i){var o,l=i.x1+.5*(i.x2-i.x1),r=(i.y1+i.y2)/2;if("Not Defined"===i.style.label&&!i.hasCognitive)return null;var c=!1;if(i.isSubSection)c=ke&&Ae===i.subSectionKeyPath&&_e;else{var d=At[i.sectionIdx];(xe?!(null===(o=null==d?void 0:d.refIndexes)||void 0===o?void 0:o.length)||(null==d?void 0:d.selfIndex)<0:!Lt[i.sectionIdx])||(c=ke&&Ae===i.sectionIdx&&_e)}if(c)return t("g",e({style:{transition:"opacity 0.2s"}},{children:[n("defs",{children:n("marker",e({id:"arr-".concat(i.id),markerWidth:"7",markerHeight:"5",refX:"7",refY:"2.5",orient:"auto"},{children:n("polygon",{points:"0 0, 7 2.5, 0 5",fill:i.style.badgeBorder||"#6366F1"})}))}),n("line",{ref:Cn,x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2,stroke:i.style.badgeBorder||"#6366F1",strokeWidth:"1.5",markerEnd:"url(#arr-".concat(i.id,")")})]}),i.id);if(!xe){var a=i.isSubSection?R(i.x1,i.y1,i.x2,i.y2):"M ".concat(i.x1," ").concat(i.y1," L ").concat(i.x2," ").concat(i.y2);return t("g",{children:[n("path",{d:a,fill:"none",stroke:i.style.badgeBorder||"#E2E8F0",strokeWidth:"1.5"}),n("foreignObject",e({x:l-100,y:r-14,width:"200",height:"28",style:{pointerEvents:"auto",overflow:"visible"}},{children:n(u,e({sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},{children:t(u,e({onClick:function(t){if(t.stopPropagation(),ht.open&&bt===i.id)Ct();else{var n=At[i.sectionIdx]||{title:"",content:""},o=Lt[i.sectionIdx]||{title:"",content:""};if(i.isSubSection&&i.subSectionKeyPath){for(var l=i.subSectionKeyPath.split(b)[2].split("-").map(Number),r=At[l[0]],c=Lt[l[0]],u=(null==r?void 0:r.title)||"",d=(null==c?void 0:c.title)||"",a=1;a<l.length;a++)(null==r?void 0:r.subsections)&&(r=r.subsections[l[a]]),(null==c?void 0:c.subsections)&&(c=c.subsections[l[a]]);r&&(n=e(e({},r),{title:u||r.title})),c&&(o=e(e({},c),{title:d||c.title}))}St(i.id),xn(gn(t.currentTarget,n,o,i.sectionIdx,i.style))}},sx:{display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",bgcolor:i.style.badgeBg,color:i.style.badgeText,border:"1px solid ".concat(i.style.badgeBorder),borderRadius:"12px",px:1.5,py:.5,fontWeight:600,textAlign:"center",whiteSpace:"nowrap",cursor:"pointer"}},{children:[i.style.badgeText===T&&null==i.style.label?n(_,{color:i.style.badgeText}):0===i.style.label?"Same":i.style.label,n(u,e({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:n(f,{})})),n(p,{size:11,style:{transform:ht.open&&bt===i.id?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))}))]},i.id)}return null}),We.map(function(i){var o,l=i.pathD,r=(null===(o=i.style)||void 0===o?void 0:o.badgeBorder)||"#6366F1",c="conn-marker-".concat(i.id),u="".concat(i.id,"-bg"),d="".concat(i.id,"-stroke");return t("g",{children:[n("defs",{children:n("clipPath",e({id:"connections-clip"},{children:n("marker",e({id:c,markerWidth:"8",markerHeight:"6",refX:"7",refY:"3",orient:"auto"},{children:n("polygon",{points:"0 0, 8 3, 0 6",fill:r})}))}))}),n("path",{ref:function(e){qe.current[u]=e},d:l,fill:"none",stroke:"#FFFFFF",strokeWidth:"4",strokeOpacity:"0.7"}),n("path",{ref:function(e){qe.current[d]=e},d:l,fill:"none",stroke:r,strokeWidth:"1.75",markerEnd:"url(#".concat(c,")")})]},i.id)})]})),t(u,e({sx:e({border:"1px solid #E7E7E9",borderRadius:"8px",bgcolor:"#FFFFFF",display:"flex",flexDirection:"column",position:"relative",zIndex:2,filter:"drop-shadow(0px 2px 4px #F2F2F2)"},xe?{flex:1,overflow:"visible"}:{})},{children:[n(u,e({ref:In,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E7E7E9",borderRadius:"8px 8px 0 0",display:"flex",alignItems:"center",minHeight:"40px",overflow:"hidden",minWidth:0}},{children:n(s,e({title:Et,placement:"top"},{children:n(v,e({sx:{fontSize:"16px",fontWeight:500,color:"#19213D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0,textAlign:"left",display:"block"}},{children:Et}))}))})),t(u,e({ref:st,onScroll:Nn,sx:e({p:"12px",display:"flex",flexDirection:"column"},xe?{maxHeight:"calc(100vh - 150px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,mr:"-160px",pr:"172px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[n("div",{ref:dt,style:{width:"100%",height:"0px",flexShrink:0}}),zt&&At.map(function(i,o){var l,r,c=!i.title&&!i.content;if(xe&&c)return null;var d=i,a=Dn(o),s=xe?!(null===(l=d.refIndexes)||void 0===l?void 0:l.length)||d.selfIndex<0:!Lt[o],v=xe?"number"==typeof d.selfIndex&&d.selfIndex>=0?d.selfIndex+1:null:o+1,p=Ne.has(o),f=m(d.evaluationResult,null==a?void 0:a.deviationLabel);return n(u,e({ref:$t(o),sx:{mb:1,width:"100%"}},{children:t(u,e({sx:{position:"relative",width:"100%"}},{children:[n(u,e({ref:Xt.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:n(N,{section:i,idx:o,columnKey:"left",colRef:$t("left-accordion-".concat(o)),mb:0,parentNodeId:(null===(r=null==le?void 0:le.input_index_map)||void 0===r?void 0:r[0])||"",isExpanded:xe?!!vn["left-".concat(o)]:!!vn[String(o)],onToggle:function(){return fn(o,"left")},navigation:i.id?Yn[i.id]:null,showOpenNodeRef:Kn,resolvedMarkdownStyles:it,maintainRelativeOrder:xe,renderSubSections:Xn})})),xe&&a&&t(u,e({ref:qt.current[o],onClick:function(e){var t=xe?Lt.find(function(e){var t;return null===(t=d.refIndexes)||void 0===t?void 0:t.includes(e.selfIndex)})||{title:"",content:""}:Lt[o]||{title:"",content:""};mn(e,i,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&&n(u,e({component:"span",sx:{fontSize:"11px",fontWeight:700,pr:.5,borderRight:"1px solid ".concat(a.badgeBorder)}},{children:v})),n(u,e({component:"span",sx:{fontSize:"11px",px:.25}},{children:!se.isLoading||null!=d.evaluationResult&&null!=d.evaluationResult?s?"No Deviation Found":"N/A"===f||"NA"===f?"N/A":0==f||null==f?"Same":"".concat(f):n(_,{color:a.badgeText})})),n(h,{size:11,color:a.badgeText})]}))]}))}),"left-row-".concat(o))}),n("div",{ref:at,style:{width:"100%",height:"0px",flexShrink:0}})]}))]})),n(u,e({sx:{width:"180px",display:"flex",flexDirection:"column",alignItems:"center",pt:"15px",gap:0,zIndex:20,pointerEvents:"none"}},{children:n(u,e({sx:{display:"flex",justifyContent:"center",alignItems:"center",mt:0}},{children:t(u,e({sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:"5px",borderRadius:"20px",bgcolor:dn.badgeBg,color:dn.badgeText,border:"1px solid ".concat(dn.badgeBorder),fontSize:"12px",fontWeight:600,whiteSpace:"nowrap",position:"relative",zIndex:1,pointerEvents:"auto",cursor:"pointer"}},{children:[null!=un?un:n(_,{}),n(u,e({component:"span",onClick:function(t){t.stopPropagation(),ht.open&&bt===rn?Ct():(St(rn),xn(gn(t.currentTarget,{title:"",content:"",evaluationResult:cn,cognitiveData:{section_id:"",decisioning:[],gap:[],relevance_score:0,isMissingRationale:!0}},null,rn,!0,e(e({},dn),{label:""}))))},sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:n(f,{})})),n(p,{size:11,style:{transform:ht.open&&bt===rn?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))})),t(u,e({sx:e({border:"1px solid #E3E6EA",borderRadius:"8px",bgcolor:"#FFFFFF",boxShadow:"0px 1px 4px #F7F4FE",position:"relative",zIndex:2,display:"flex",flexDirection:"column",minWidth:0},xe?{flex:1,overflow:"visible",minHeight:0}:{})},{children:[Ce&&n(g,{sections:11}),n(u,e({ref:wn,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E3E6EA",borderRadius:"8px 8px 0 0",minHeight:"40px",display:"flex",alignItems:"center",overflowX:"hidden"}},{children:n(s,e({title:Mt,placement:"top"},{children:n(v,e({sx:{fontSize:"16px",fontWeight:500,color:"#5928ED",overflow:"hidden",display:"flex",justifyContent:"center",alignItems:"center",textOverflow:"ellipsis",whiteSpace:"normal",width:"100%",height:"40px"}},{children:Mt}))}))})),t(u,e({ref:rt,onScroll:Nn,sx:e({p:"12px",display:"flex",flexDirection:"column"},xe?{maxHeight:"calc(100vh - 150px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,ml:"-25px",pl:"45px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[n("div",{ref:ct,style:{width:"100%",height:"0px",flexShrink:0}}),zt&&Lt.map(function(i,o){var l,r=i,c=[],d=!1,a=null;if(xe){c=At.filter(function(e){var t;return(null===(t=e.refIndexes)||void 0===t?void 0:t.includes(r.selfIndex))&&e.selfIndex>=0}).map(function(e){return e.selfIndex+1});var s=At.findIndex(function(e,t){var n;return Ne.has(t)&&(null===(n=e.refIndexes)||void 0===n?void 0:n.includes(r.selfIndex))});(d=-1!==s)&&(a=Dn(s))}else c=[o+1],(d=Ne.has(o))&&(a=Dn(o));var v=Dn(o);return n(u,e({ref:Ut.current[o],sx:{mb:1,width:"100%"}},{children:t(u,e({sx:{position:"relative",width:"100%"}},{children:[n(u,e({ref:Vt.current[o],sx:e({width:"100%",display:"flex"},d&&a&&{borderRadius:"6px",outline:"2px solid ".concat(a.badgeBorder),outlineOffset:"1px"})},{children:n(N,{section:i,idx:o,columnKey:"right",colRef:$t("right-accordion-".concat(o)),mb:0,parentNodeId:(null===(l=null==le?void 0:le.input_index_map)||void 0===l?void 0:l[1])||"",isExpanded:xe?!!vn["right-".concat(o)]:!!vn[String(o)],onToggle:function(){return fn(o,"right")},navigation:i.id?Yn[i.id]:null,showOpenNodeRef:Kn,resolvedMarkdownStyles:it,maintainRelativeOrder:xe,renderSubSections:Xn})})),xe&&!Ce&&v&&n(u,e({ref:Jt.current[o],"data-section-id":r.id,sx:{position:"absolute",top:"18px",left:0,transform:"translateY(-50%) translateX(calc(-100% - 8px))",display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:"11px",bgcolor:v.badgeBg,color:v.badgeText,border:"1px solid ".concat(v.badgeBorder),borderRadius:"10px",px:1,py:.3,fontWeight:700,whiteSpace:"nowrap",zIndex:20}},{children:c.length>0?c.join(", "):"-"}))]}))}),"right-row-".concat(o))}),n("div",{ref:ut,style:{width:"100%",height:"0px",flexShrink:0}})]}))]}))]}))}))}))]}))};export{z as default};
|
|
2
2
|
//# sourceMappingURL=CognitiveCompare.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var n="#3730A3",l=12,o=680,t=12,a=10,i="Contract Comparison",e={isLoading:!1,open:!1,sectionTitle:"",refSectionTitle:"",cognitiveData:null,anchorEl:null,sectionAnchorEl:null,badgeStyle:null,sectionIdx:null,isOrphan:!1,docData:null,deviationData:null};export{a as ARROW_SIZE,i as DEFAULT_COMPONENT_HEADER_TEXT,n as DEFAULT_DEVIAION_COLOR,e as EMPTY_SECTION_POPUP_STATE,l as POPUP_GAP,o as POPUP_WIDTH,t as VIEWPORT_MARGIN};
|
|
2
|
+
//# sourceMappingURL=CognitiveCompareConstants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CognitiveCompareConstants.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -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)}))},
|
|
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,i){var o,e=i[r],a=null===(o=null==t?void 0:t.comparison_inputs)||void 0===o?void 0:o[e];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)||[]}},i=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 o(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),i=r.r,o=r.g,e=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(i+(255-i)*t),Math.round(o+(255-o)*t),Math.round(e+(255-e)*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 e(n,t){var r;return function(){for(var i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];var e=this;clearTimeout(r),r=setTimeout(function(){return n.apply(e,i)},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 r=n.highlights||[],i=t.highlights||[];if(r.length!==i.length)return!1;for(var o=0;o<r.length;o++)if(r[o]!==i[o])return!1;var e=n.deviationBadges||[],a=t.deviationBadges||[];if(e.length!==a.length)return!1;for(o=0;o<e.length;o++){if(e[o].id!==a[o].id)return!1;if(e[o].label!==a[o].label)return!1;if(e[o].isConnected!==a[o].isConnected)return!1}return!0},u="::",l=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,i,o,e,a,u,l;if(!n)return t;var c=null!==(u=null!==(e=null!==(i=null===(r=n.evaluation_output)||void 0===r?void 0:r.output_score)&&void 0!==i?i:null===(o=n.evaluation_outputs)||void 0===o?void 0:o.output_score)&&void 0!==e?e:null===(a=n.evaluation_outputs)||void 0===a?void 0:a.output_value)&&void 0!==u?u:n.output_score;return null!==(l=null!=c?c:t)&&void 0!==l?l:""},s=function(n,t,r,i,o){void 0===o&&(o=14);var e=n+.5*(r-n),a=i-t;if(Math.abs(a)<3)return"M ".concat(n," ").concat(t," H ").concat(r);var u=a>0?1:-1,l=Math.min(o,Math.abs(a)/2,Math.abs(e-n)/2,Math.abs(r-e)/2);return["M ".concat(n," ").concat(t),"H ".concat(e-l),"Q ".concat(e," ").concat(t," ").concat(e," ").concat(t+u*l),"V ".concat(i-u*l),"Q ".concat(e," ").concat(i," ").concat(e+l," ").concat(i),"H ".concat(r)].join(" ")},v=function(n,t,r,i,o){void 0===r&&(r=300);var e=n.style.scrollBehavior;n.style.scrollBehavior="auto";var a=n.scrollTop,u=t-a,l=null,c=function(s){null===l&&(l=s);var v,d=s-l;d<r?(n.scrollTop=(v=d,v/=r,u*(--v*v*v+1)+a),o&&o(),requestAnimationFrame(c)):(n.scrollTop=t,n.style.scrollBehavior=e,o&&o(),i&&i())};requestAnimationFrame(c)};export{u as DEVIATION_BADGE_SEPARATOR,a as areMarkdownPropsEqual,e as debounce,c as extractDeviationScore,o as generateColorPalette,s as getBentArrowPath,i as getRationale,r as getSideData,t as hasValue,l as isMissingStr,n as safeStringify,v as smoothScrollTo};
|
|
2
2
|
//# sourceMappingURL=CognitiveComparehelpers.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as e}from"tslib";import{jsx as i,jsxs as n,Fragment as t}from"react/jsx-runtime";import{Menu as o,Box as r,Typography as l,MenuItem as s}from"@mui/material";import{ButtonCognitiveIcon as c}from"../../assests/svg/ButtonCognitiveIcon.js";var C=function(){return i("svg",e({width:"13",height:"13",viewBox:"0 0 13 13",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:i("path",{d:"M2 6.5L5 9.5L11 3.5",stroke:"#15803D",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})}))},d=[{key:"connect",title:"Connect",icon:i("svg",e({width:"15",height:"18",viewBox:"0 0 15 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:i("path",{d:"M14.8237 3.89331C14.547 5.57188 13.0559 6.77501 11.3572 6.69242C9.65857 6.60983 8.2925 5.26384 8.18312 3.56742C4.75678 3.67456 3.54027 4.4759 3.73893 6.10536C3.81259 6.71474 4.18089 7.04063 4.85723 7.19911C5.26794 7.2951 5.7233 7.30849 6.13625 7.27054C6.17419 7.26608 6.21437 7.26385 6.25232 7.25938C6.50455 7.19911 6.76125 7.14777 7.01794 7.1076C7.77911 6.9826 8.55366 6.9201 9.29027 6.96027C11.3617 7.07188 12.7724 7.98483 12.8438 9.92233C12.913 11.7996 11.6229 13.1299 9.5425 14.0205C8.87509 14.3063 8.1675 14.5272 7.45991 14.6946C7.14071 14.7705 6.87286 14.8219 6.67419 14.8554C6.49786 16.5496 5.07821 17.842 3.37509 17.8554C1.67196 17.8688 0.229997 16.6031 0.0246403 14.9112C-0.180717 13.2192 0.917498 11.6455 2.57375 11.2527C4.23 10.8598 5.91973 11.7728 6.49562 13.3755C6.70544 13.3375 6.91303 13.2951 7.12062 13.246C7.75009 13.0987 8.37955 12.9022 8.95991 12.6522C10.538 11.9781 11.3996 11.0875 11.3595 9.9759C11.3237 8.98036 10.6095 8.52054 9.21214 8.44465C8.5983 8.41117 7.92643 8.46474 7.26348 8.57411C7.07821 8.60536 6.90857 8.63661 6.75902 8.6701C6.67196 8.68795 6.61169 8.70358 6.58491 8.71027L6.51571 8.72367C6.4666 8.73036 6.38402 8.74152 6.27687 8.75268C5.71884 8.80402 5.11393 8.78617 4.52464 8.65001C3.2925 8.36206 2.42866 7.59643 2.26794 6.2884C1.9175 3.47143 4.02241 2.16563 8.42866 2.07188C9.07821 0.500452 10.8037 -0.336602 12.4376 0.129916C14.0737 0.596434 15.1005 2.21474 14.8237 3.89331V3.89331ZM3.34161 12.6478C3.09741 12.6478 2.85562 12.6959 2.63002 12.7894C2.40442 12.8828 2.19944 13.0198 2.02678 13.1925C1.85412 13.3652 1.71717 13.5702 1.62373 13.7958C1.5303 14.0214 1.48222 14.2632 1.48223 14.5074C1.48224 14.7516 1.53036 14.9934 1.62382 15.219C1.71728 15.4446 1.85426 15.6495 2.02694 15.8222C2.19962 15.9949 2.40462 16.1318 2.63022 16.2252C2.85583 16.3187 3.09764 16.3668 3.34183 16.3667C3.83499 16.3667 4.30795 16.1708 4.65665 15.822C5.00535 15.4733 5.20123 15.0003 5.2012 14.5071C5.20117 14.014 5.00524 13.541 4.65649 13.1923C4.30775 12.8436 3.83477 12.6477 3.34161 12.6478ZM11.5224 1.49152C11.2782 1.49154 11.0364 1.53965 10.8108 1.63311C10.5852 1.72657 10.3802 1.86355 10.2076 2.03623C10.0349 2.20891 9.89797 2.41391 9.80454 2.63952C9.7111 2.86513 9.66302 3.10693 9.66303 3.35112C9.66305 3.59531 9.71116 3.83711 9.80462 4.06271C9.89808 4.28831 10.0351 4.49329 10.2077 4.66594C10.3804 4.8386 10.5854 4.97556 10.811 5.06899C11.0366 5.16243 11.2784 5.21051 11.5226 5.2105C12.0158 5.21047 12.4888 5.01453 12.8375 4.66579C13.1862 4.31704 13.382 3.84406 13.382 3.3509C13.382 2.85773 13.186 2.38478 12.8373 2.03608C12.4886 1.68738 12.0156 1.49149 11.5224 1.49152V1.49152Z",fill:"#1D2939",fillOpacity:"0.85"})}))},{key:"side-by-side",title:"Side by Side",icon:i("svg",e({width:"17",height:"17",viewBox:"0 0 17 17",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:i("path",{d:"M3.19922 8.19922H13.1992M3.19922 8.19922L4.86589 10.6992M3.19922 8.19922L4.86589 5.69922M13.1992 8.19922L11.5326 10.6992M13.1992 8.19922L11.5326 5.69922M15.6992 0.699219V15.6992M0.699219 0.699219V15.6992",stroke:"#3F4957",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})}))},{key:"cognitive-decisioning",title:"Cognitive Decisioning",icon:i(c,{})}],a=function(c){var a=c.open,h=c.anchorEl;c.sectionTitle,c.referenceSectionTitle;var p=c.onClose,g=c.onOpenCognitiveCompare,x=c.onOpenSideBySide,f=c.onConnect,m=c.isConnected,u=void 0!==m&&m,
|
|
1
|
+
import{__assign as e}from"tslib";import{jsx as i,jsxs as n,Fragment as t}from"react/jsx-runtime";import{Menu as o,Box as r,Typography as l,MenuItem as s}from"@mui/material";import{ButtonCognitiveIcon as c}from"../../assests/svg/ButtonCognitiveIcon.js";var C=function(){return i("svg",e({width:"13",height:"13",viewBox:"0 0 13 13",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:i("path",{d:"M2 6.5L5 9.5L11 3.5",stroke:"#15803D",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})}))},d=[{key:"connect",title:"Connect",icon:i("svg",e({width:"15",height:"18",viewBox:"0 0 15 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:i("path",{d:"M14.8237 3.89331C14.547 5.57188 13.0559 6.77501 11.3572 6.69242C9.65857 6.60983 8.2925 5.26384 8.18312 3.56742C4.75678 3.67456 3.54027 4.4759 3.73893 6.10536C3.81259 6.71474 4.18089 7.04063 4.85723 7.19911C5.26794 7.2951 5.7233 7.30849 6.13625 7.27054C6.17419 7.26608 6.21437 7.26385 6.25232 7.25938C6.50455 7.19911 6.76125 7.14777 7.01794 7.1076C7.77911 6.9826 8.55366 6.9201 9.29027 6.96027C11.3617 7.07188 12.7724 7.98483 12.8438 9.92233C12.913 11.7996 11.6229 13.1299 9.5425 14.0205C8.87509 14.3063 8.1675 14.5272 7.45991 14.6946C7.14071 14.7705 6.87286 14.8219 6.67419 14.8554C6.49786 16.5496 5.07821 17.842 3.37509 17.8554C1.67196 17.8688 0.229997 16.6031 0.0246403 14.9112C-0.180717 13.2192 0.917498 11.6455 2.57375 11.2527C4.23 10.8598 5.91973 11.7728 6.49562 13.3755C6.70544 13.3375 6.91303 13.2951 7.12062 13.246C7.75009 13.0987 8.37955 12.9022 8.95991 12.6522C10.538 11.9781 11.3996 11.0875 11.3595 9.9759C11.3237 8.98036 10.6095 8.52054 9.21214 8.44465C8.5983 8.41117 7.92643 8.46474 7.26348 8.57411C7.07821 8.60536 6.90857 8.63661 6.75902 8.6701C6.67196 8.68795 6.61169 8.70358 6.58491 8.71027L6.51571 8.72367C6.4666 8.73036 6.38402 8.74152 6.27687 8.75268C5.71884 8.80402 5.11393 8.78617 4.52464 8.65001C3.2925 8.36206 2.42866 7.59643 2.26794 6.2884C1.9175 3.47143 4.02241 2.16563 8.42866 2.07188C9.07821 0.500452 10.8037 -0.336602 12.4376 0.129916C14.0737 0.596434 15.1005 2.21474 14.8237 3.89331V3.89331ZM3.34161 12.6478C3.09741 12.6478 2.85562 12.6959 2.63002 12.7894C2.40442 12.8828 2.19944 13.0198 2.02678 13.1925C1.85412 13.3652 1.71717 13.5702 1.62373 13.7958C1.5303 14.0214 1.48222 14.2632 1.48223 14.5074C1.48224 14.7516 1.53036 14.9934 1.62382 15.219C1.71728 15.4446 1.85426 15.6495 2.02694 15.8222C2.19962 15.9949 2.40462 16.1318 2.63022 16.2252C2.85583 16.3187 3.09764 16.3668 3.34183 16.3667C3.83499 16.3667 4.30795 16.1708 4.65665 15.822C5.00535 15.4733 5.20123 15.0003 5.2012 14.5071C5.20117 14.014 5.00524 13.541 4.65649 13.1923C4.30775 12.8436 3.83477 12.6477 3.34161 12.6478ZM11.5224 1.49152C11.2782 1.49154 11.0364 1.53965 10.8108 1.63311C10.5852 1.72657 10.3802 1.86355 10.2076 2.03623C10.0349 2.20891 9.89797 2.41391 9.80454 2.63952C9.7111 2.86513 9.66302 3.10693 9.66303 3.35112C9.66305 3.59531 9.71116 3.83711 9.80462 4.06271C9.89808 4.28831 10.0351 4.49329 10.2077 4.66594C10.3804 4.8386 10.5854 4.97556 10.811 5.06899C11.0366 5.16243 11.2784 5.21051 11.5226 5.2105C12.0158 5.21047 12.4888 5.01453 12.8375 4.66579C13.1862 4.31704 13.382 3.84406 13.382 3.3509C13.382 2.85773 13.186 2.38478 12.8373 2.03608C12.4886 1.68738 12.0156 1.49149 11.5224 1.49152V1.49152Z",fill:"#1D2939",fillOpacity:"0.85"})}))},{key:"side-by-side",title:"Side by Side",icon:i("svg",e({width:"17",height:"17",viewBox:"0 0 17 17",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:i("path",{d:"M3.19922 8.19922H13.1992M3.19922 8.19922L4.86589 10.6992M3.19922 8.19922L4.86589 5.69922M13.1992 8.19922L11.5326 10.6992M13.1992 8.19922L11.5326 5.69922M15.6992 0.699219V15.6992M0.699219 0.699219V15.6992",stroke:"#3F4957",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})}))},{key:"cognitive-decisioning",title:"Cognitive Decisioning",icon:i(c,{})}],a=function(c){var a=c.open,h=c.anchorEl;c.sectionTitle,c.referenceSectionTitle;var p=c.onClose,g=c.onOpenCognitiveCompare,x=c.onOpenSideBySide,f=c.onConnect,m=c.isConnected,u=void 0!==m&&m,y=c.isOrphan;return i(o,e({open:a,anchorEl:h,onClose:p,disableScrollLock:!0,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},PaperProps:{sx:{ml:.75,minWidth:190,maxWidth:220,borderRadius:"12px",border:"1px solid #E4E7EC",boxShadow:"0px 12px 28px rgba(16, 24, 40, 0.12)",overflow:"hidden"}},MenuListProps:{sx:{p:.5,bgcolor:"#FFFFFF"}}},{children:d.map(function(o){var c="connect"===o.key,d=c&&u,a=y&&("connect"===o.key||"side-by-side"===o.key),h=n(t,{children:[i(r,e({sx:e(e({width:18,height:18,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,"& svg":{display:"block"}},a&&{opacity:.15}),d&&{"& svg path":{fill:"#15803D",fillOpacity:1}})},{children:o.icon})),n(r,e({sx:{minWidth:0,display:"flex",flexDirection:"column",flex:1}},{children:[i(l,e({sx:{fontSize:"12px",fontWeight:500,color:a?"#98A2B3":d?"#15803D":"#101828",lineHeight:1.2,whiteSpace:"nowrap"}},{children:c?u?"Disconnect":"Connect":o.title})),a&&i(l,e({sx:{mt:.35,fontSize:"10px",lineHeight:1.3,color:"#98A2B3",whiteSpace:"normal"}},{children:"No counterpart exists to connect to."}))]})),d&&!a&&i(r,e({sx:{display:"flex",alignItems:"center",justifyContent:"center",ml:"auto"}},{children:i(C,{})}))]});return a?i(r,e({"aria-disabled":"true",sx:{px:1.25,py:1,minHeight:22,borderRadius:"10px",display:"flex",alignItems:"flex-start",gap:1,cursor:"not-allowed",userSelect:"none"}},{children:h}),o.key):i(s,e({onClick:function(){return e=o.key,void(y&&("connect"===e||"side-by-side"===e)||("connect"!==e?"side-by-side"!==e?g():x():f()));var e},sx:{px:1.25,py:1,minHeight:40,borderRadius:"10px",display:"flex",alignItems:"center",gap:1,bgcolor:d?"#F0FDF4":"transparent","&:hover":{bgcolor:d?"#DCFCE7":"#F9FAFB"}}},{children:h}),o.key)})}))};export{a as default};
|
|
2
2
|
//# sourceMappingURL=MoreFunctionsPopup.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{__assign as e}from"tslib";import{jsxs as i,jsx as t}from"react/jsx-runtime";import{Box as o,Typography as r,FormControlLabel as n,Switch as a}from"@mui/material";var l=function(l){var s=l.componentHeaderText,c=l.displayConfig,d=l.maintainRelativeOrder,p=l.onToggleView;return c.isHeaderVisible||c.isToggleVisible?i(o,e({sx:{px:2,py:1,display:"flex",alignItems:"center",justifyContent:"space-between",bgcolor:"#FFFFFF",border:"1.5px solid #EEF0F4",borderTopLeftRadius:"8px",borderTopRightRadius:"8px"}},{children:[t(o,e({sx:{display:"flex",alignItems:"center",gap:1}},{children:c.isHeaderVisible&&t(r,e({sx:{fontSize:"16px",fontWeight:600,color:"#0F172A"}},{children:s}))})),c.isToggleVisible&&t(o,e({sx:{display:"flex",alignItems:"center"}},{children:t(n,{control:t(a,{checked:!d,onChange:function(e){return p(e.target.checked)},color:"primary",size:"small",sx:{width:100,height:26,padding:0,"& .MuiSwitch-switchBase":{padding:0,margin:"3px",transitionDuration:"300ms","&.Mui-checked":{transform:"translateX(75px)",color:"#fff","& + .MuiSwitch-track":{backgroundColor:"#5928ED",opacity:1,border:0,"&::before":{content:'"Side by Side"',position:"absolute",left:8,top:8,fontSize:10,color:"#fff",fontWeight:600}}},"& .MuiSwitch-thumb:before":{position:"absolute",width:"100%",height:"100%",left:0,top:0,display:"flex",alignItems:"center",justifyContent:"center",fontSize:10,fontWeight:700,color:"#5928ED"}},"& .MuiSwitch-thumb":{boxSizing:"border-box",width:20,height:20,boxShadow:"0px 1px 3px rgba(0,0,0,0.2)"},"& .MuiSwitch-track":{borderRadius:13,backgroundColor:"#CBD5E1",opacity:1,position:"relative","&::before":{content:'"Side By Side"',position:"absolute",right:8,top:8,left:30,fontSize:10,color:"#1E293B",fontWeight:600}}}}),label:"",sx:{m:0}})}))]})):null};export{l as default};
|
|
2
|
+
//# sourceMappingURL=CompareHeader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CompareHeader.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{__assign as o}from"tslib";import{jsxs as i,jsx as e}from"react/jsx-runtime";import n,{useEffect as t}from"react";import{Box as l,Accordion as r,AccordionSummary as d,Tooltip as a,Typography as c,AccordionDetails as s}from"@mui/material";import{ChevronUp as u,ChevronDown as p}from"lucide-react";import{MemoizedMarkdown as v}from"../hooks/memoizedMarkdown.js";import{hasValue as h,generateColorPalette as m,safeStringify as f}from"../CognitiveComparehelpers.js";import{DEFAULT_DEVIAION_COLOR as x}from"../CognitiveCompareConstants.js";var w=function(w){var g,b,y,F,k,S,R,C,A,I=w.section,W=w.idx,B=w.columnKey,M=w.colRef,E=w.mb,N=void 0===E?1:E,T=w.parentNodeId,j=void 0===T?"":T,z=w.isExpanded,D=w.onToggle,O=w.navigation,K=w.showOpenNodeRef,V=w.resolvedMarkdownStyles,G=w.maintainRelativeOrder,X=w.renderSubSections,Y=(null===(g=I.displayTitle)||void 0===g||g)&&h(I.title),_=(null===(b=I.displayContent)||void 0===b||b)&&h(I.content),H=!Y&&!_,P={current:1},q=I.title;Y||(q=_?"No Title Found":"No Matching Section Found");var J=null!==(S=null===(k=null===(F=null===(y=I.evaluationResult)||void 0===y?void 0:y.evaluation_outputs)||void 0===F?void 0:F.metadata)||void 0===k?void 0:k.label_color)&&void 0!==S?S:x,L=m(J).highlightBg,Q=[];if(null===(R=I.evaluationResult)||void 0===R?void 0:R.deviations){var U=I.evaluationResult.deviations;for(var Z in U){var $=U[Z][j];$&&Q.push($)}}var oo,io=I.id&&B===(null==O?void 0:O.columnKey)?O:null;return t(function(){z&&K.current===I.id&&(null==io?void 0:io.showBelow)&&setTimeout(function(){var o,i;K.current===I.id&&(K.current="",null===(i=null===(o=null==io?void 0:io.showBelowRef)||void 0===o?void 0:o.current)||void 0===i||i.scrollIntoView({behavior:"smooth",block:"center"}))},600)},[z,I.id,io,K]),i(l,o({ref:M,sx:{mb:N,width:"100%",display:"flex",flexDirection:"column",position:"relative",minWidth:0}},{children:[z&&(null==io?void 0:io.showAbove)&&e("div",o({style:{position:"sticky",top:0,width:"0px",height:"0px",cursor:"pointer"},onClick:function(){var o,i;return null===(i=null===(o=null==io?void 0:io.showAboveRef)||void 0===o?void 0:o.current)||void 0===i?void 0:i.scrollIntoView({behavior:"smooth",block:"center"})}},{children:e("div",o({style:{transform:"translateY(-50%) translateX(calc(100% ".concat("left"===B?"+ 550px":"- 150px","))"),position:"absolute",paddingTop:"20px"}},{children:e(u,{color:window.getComputedStyle(null===(C=null==io?void 0:io.showAboveRef)||void 0===C?void 0:C.current).color})}))})),i(r,o({disableGutters:!0,expanded:!H&&z,onChange:function(){H||(D(),K.current=I.id)},sx:{boxShadow:"none",border:H?"1px dashed #E2E8F0":"1px solid #E2E8F0",bgcolor:H?"#FAFAFA":"#FFFFFF",borderRadius:"6px",flexGrow:1,width:"100%",display:"flex",flexDirection:"column",minWidth:0,"&:before":{display:"none"},"& .MuiAccordion-heading":{position:"sticky",top:-12,zIndex:10,background:"#fff"}}},{children:[e(d,o({expandIcon:H?null:e(p,{size:16}),sx:{minHeight:"36px",flexShrink:0,cursor:H?"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:Y&&e(a,o({title:q,placement:"top"},{children:e(c,o({component:"div",sx:{fontSize:"12px",color:H?"#94A3B8":"#19213D",fontWeight:H?400:700,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0}},{children:(oo=q,oo?f(oo).replace(/\\n/g,"\n").split(/(\*\*.*?\*\*)/g).map(function(o,i){return o.startsWith("**")&&o.endsWith("**")?e("strong",{children:o.slice(2,-2)},i):e(n.Fragment,{children:o},i)}):null)}))}))})),!H&&i(s,o({sx:{pt:0,pb:1.25,bgcolor:"#FFFFFF",flex:1,display:"flex",flexDirection:"column",minWidth:0}},{children:[_&&e(v,{content:I.content,sxStyles:V,highlights:Q,maintainRelativeOrder:G,highlightBg:L}),(I.subsections||[]).map(function(o,i){return X({section:o,keyPath:"".concat(W,"-").concat(i),depth:0,columnKey:B,parentNodeId:j,devCounter:P})})]}))]})),z&&(null==io?void 0:io.showBelow)&&e("div",o({style:{position:"sticky",bottom:0,width:"0px",height:"0px",cursor:"pointer"},onClick:function(){var o,i;return null===(i=null===(o=null==io?void 0:io.showBelowRef)||void 0===o?void 0:o.current)||void 0===i?void 0:i.scrollIntoView({behavior:"smooth",block:"center"})}},{children:e("div",o({style:{transform:"translateY(-50%) translateX(calc(100% ".concat("left"===B?"+ 550px":"- 150px","))"),position:"absolute",paddingBottom:"20px"}},{children:e(p,{color:window.getComputedStyle(null===(A=null==io?void 0:io.showBelowRef)||void 0===A?void 0:A.current).color})}))}))]}),"".concat(B,"-sec-").concat(W))};export{w as default};
|
|
2
|
+
//# sourceMappingURL=SectionAccordion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SectionAccordion.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{__spreadArray as e,__assign as i}from"tslib";import{jsx as n,jsxs as t}from"react/jsx-runtime";import o,{useMemo as l}from"react";import{Box as d,Accordion as a,AccordionSummary as s,Typography as r,AccordionDetails as c}from"@mui/material";import{ChevronDown as u}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 x=o.memo(function(o){var S,b,y,I,R,w,C,F,B,_,j,k,O,W,E,M,P,N=o.section,z=o.keyPath,A=o.depth,D=void 0===A?0:A,T=o.columnKey,G=void 0===T?"left":T,H=o.parentNodeId,K=void 0===H?"":H,L=o.expandedSubSections,U=o.setExpandedSubSections,q=o.maintainRelativeOrder,J=o.proposedSections,Q=o.existingSections,V=o.treeData,X=o.deviationNumberRegistry,Y=o.connectedSections,Z=o.activeSideBySideSection,$=o.resolvedMarkdownStyles,ee=o.getSubSectionRef,ie=o.getSubSectionCompareStyle,ne=o.getBadgeRef,te=o.openMoreFunctionsPopup,oe=o.resetSideBySide,le=o.setConnectedSections,de=o.setConnectedLines,ae=o.cachedConnectedPositions,se=(null===(S=N.displayTitle)||void 0===S||S)&&f(N.title),re=(null===(b=N.displayContent)||void 0===b||b)&&f(N.content),ce=!se&&!re,ue=se?N.title:re?"No Title Found":"No Matching Section Found",ve=!!L[z],fe=ee(G,z),he=ie(z),pe=z.split("-").map(Number),me=pe[0],ge=J[me],xe=Q[me],Se=z,be=z;if(q)if("left"===G){var ye=null===(y=null==ge?void 0:ge.refIndexes)||void 0===y?void 0:y[0],Ie=Q.findIndex(function(e){return e.selfIndex===ye});-1!==Ie&&(xe=Q[Ie],be=e([Ie],pe.slice(1),!0).join("-"))}else{var Re=null===(I=null==xe?void 0:xe.refIndexes)||void 0===I?void 0:I[0],we=J.findIndex(function(e){return e.selfIndex===Re});-1!==we&&(ge=J[we],Se=e([we],pe.slice(1),!0).join("-"))}var Ce="left"===G?ge:xe;P=q&&void 0!==(null==Ce?void 0:Ce.selfIndex)&&Ce.selfIndex>=0?Ce.selfIndex+1:me+1;for(var Fe=ge,Be=xe,_e=1;_e<pe.length;_e++)(null==Fe?void 0:Fe.subsections)&&(Fe=Fe.subsections[pe[_e]]),(null==Be?void 0:Be.subsections)&&(Be=Be.subsections[pe[_e]]);var je=null===(R=null==V?void 0:V.input_index_map)||void 0===R?void 0:R[0],ke=null===(w=null==V?void 0:V.input_index_map)||void 0===w?void 0:w[1],Oe="left"===G?ke:je,We=q?!(null===(C=N.refIndexes)||void 0===C?void 0:C.length)||void 0!==N.selfIndex&&N.selfIndex<0:"left"===G?!Be:!Fe,Ee=null!==(_=null===(B=null===(F=N.evaluationResult)||void 0===F?void 0:F.evaluation_outputs)||void 0===B?void 0:B.output_value)&&void 0!==_?_:null,Me=N.id,Pe=null!==(W=null===(O=null===(k=null===(j=N.evaluationResult)||void 0===j?void 0:j.evaluation_outputs)||void 0===k?void 0:k.metadata)||void 0===O?void 0:O.label_color)&&void 0!==W?W:g,Ne=h(Pe).highlightBg,ze=(null===(E=N.evaluationResult)||void 0===E?void 0:E.deviations)||{},Ae=Object.entries(ze).map(function(e){var n=e[0],t=e[1],o="".concat(Me).concat(m).concat(n),l=X[o];if(!l)return null;var d=t[K],a=p(d);if(a)d="";else if(!d)return null;var s=t[Oe],r=We||p(s),c="".concat(P,".").concat(l),u="".concat(Me).concat(m).concat(n).concat(m).concat(Se).concat(m).concat(be);return{id:o,actionId:u,label:c,highlight:d,side:G,style:he,score:Ee,isConnected:Y.has(u),isOrphan:r,isMissingClause:a,badgeRef:ne(G,o),onClick:function(e){e.stopPropagation();var n=i(i({},Fe),{title:(null==ge?void 0:ge.title)||(null==Fe?void 0:Fe.title)||""}),t=i(i({},Be),{title:(null==xe?void 0:xe.title)||(null==Be?void 0:Be.title)||""});te(e,n,r,t,u,he)}}}).filter(Boolean),De=Ae.some(function(e){return Y.has(e.actionId)}),Te=l(function(){var e,i=[];if(null===(e=N.evaluationResult)||void 0===e?void 0:e.deviations){var n=N.evaluationResult.deviations;for(var t in n){var o=n[t][K];o&&i.push(o)}}return i},[null===(M=N.evaluationResult)||void 0===M?void 0:M.deviations,K]);if(!(se||re||N.subsections&&0!==N.subsections.length))return null;var Ge=!q&&se&&re,He=De&&he?{borderRadius:"4px",outline:"2px solid ".concat(he.badgeBorder),outlineOffset:"1px"}:{};return n(d,se?i({ref:fe,sx:{mt:1,width:"100%",minWidth:0,position:"relative"}},{children:n(d,i({sx:i({width:"100%"},He)},{children:t(a,i({disableGutters:!0,expanded:!ce&&ve,onChange:function(){if(!ce){if(ve){var e=String(Z||""),n=e.includes(Se)||e.includes(be);n||Y.forEach(function(e){(String(e).includes(Se)||String(e).includes(be))&&(n=!0)}),n&&(oe(),le(new Set),de([]),ae.current=[])}U(function(e){var n;return i(i({},e),((n={})[z]=!e[z],n))})}},sx:{mt:0,boxShadow:"none",border:ce?"1px dashed #E2E8F0":"1px solid #EEF2F7",borderRadius:"4px !important",bgcolor:"#FFFFFF",minWidth:0,"&:before":{display:"none"}}},{children:[n(s,i({expandIcon:ce?null:n(u,{size:14}),sx:{minHeight:"32px","& .MuiAccordionSummary-content":{my:.5,display:"grid",alignItems:"center",minWidth:0,width:"100%"}}},{children:n(r,i({component:"div",sx:{fontSize:"11px",fontWeight:600,color:ce?"#94A3B8":"#19213D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0}},{children:ue||"Untitled Subsection"}))})),!ce&&t(c,i({sx:{pt:0,pb:1,minWidth:0}},{children:[re&&n(v,{content:N.content,sxStyles:$,deviationBadges:Ge?[]:Ae,maintainRelativeOrder:q,highlightBg:Ne,highlights:Te}),(N.subsections||[]).map(function(e,t){return n(x,i({},o,{section:e,keyPath:"".concat(z,"-").concat(t),depth:D+1}),"".concat(z,"-").concat(t))})]}))]}))}))}):i({ref:fe,sx:{mt:0===D?1:.75,width:"100%",minWidth:0,position:"relative"}},{children:!ce&&t(d,i({sx:i({width:"100%"},He)},{children:[re&&n(v,{content:N.content,sxStyles:$,deviationBadges:Ae,maintainRelativeOrder:q,highlightBg:Ne,highlights:Te}),(N.subsections||[]).map(function(e,t){return n(x,i({},o,{section:e,keyPath:"".concat(z,"-").concat(t),depth:D+1}),"".concat(z,"-").concat(t))})]}))}))});export{x as default};
|
|
2
|
+
//# sourceMappingURL=SubSectionAccordion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SubSectionAccordion.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{__assign as e,__rest as r}from"tslib";import{jsx as o,jsxs as i,Fragment as n}from"react/jsx-runtime";import{Box as t,Typography as a}from"@mui/material";import l,{useMemo as c}from"react";import{DEFAULT_DEVIAION_COLOR as s}from"../CognitiveCompareConstants.js";import{EllipsisVertical as d}from"lucide-react";import p from"react-markdown";import{safeStringify as f,areMarkdownPropsEqual as m}from"../CognitiveComparehelpers.js";import h from"rehype-raw";var u=l.memo(function(l){var m=l.content,u=l.sxStyles,g=l.deviationBadges,v=void 0===g?[]:g,x=l.highlights,b=void 0===x?[]:x,y=l.maintainRelativeOrder,_=void 0===y||y,C=l.highlightBg,k=c(function(){return v.reduce(function(r,o){var i;return e(e({},r),((i={})[o.id]=o,i))},{})},[v]),E=c(function(){return{mark:function(r){var i=r.children;return o("span",e({style:{backgroundColor:C,borderRadius:"2px"}},{children:i}))},span:function(a){var l,c,p,f,m,h=a.children,u=r(a,["children"]),g=u["data-badge-id"];if(!g)return o("span",e({},u,{children:h}));var v=k[g];return v?i(t,e({component:"span",sx:{position:"static",display:"inline"}},{children:[h,o(t,e({ref:v.badgeRef,onClick:v.onClick,sx:e(e({position:"absolute",zIndex:30,display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"10px",bgcolor:(null===(l=v.style)||void 0===l?void 0:l.badgeBg)||"#EEF2FF",color:(null===(c=v.style)||void 0===c?void 0:c.badgeText)||s,border:"1px solid ".concat((null===(p=v.style)||void 0===p?void 0:p.badgeBorder)||"#C7D2FE"),borderRadius:"12px",px:1,py:.3,fontWeight:600,cursor:"pointer",whiteSpace:"nowrap",boxShadow:"0 1px 3px rgba(0,0,0,0.07)"},"left"===v.side?{right:"-16px",transform:"translateY(-20%) translateX(calc(100% + 8px))"}:{left:"-16px",transform:"translateY(-20%) translateX(calc(-100% - 8px))"}),v.isConnected&&v.style&&{outline:"2px solid ".concat(v.style.badgeBorder),outlineOffset:"1px"})},{children:i(n,{children:[o(t,e({component:"span",sx:e({fontSize:"10px",fontWeight:700},"left"===v.side?{pr:.5,borderRight:"1px solid ".concat((null===(f=v.style)||void 0===f?void 0:f.badgeBorder)||"#C7D2FE")}:{})},{children:v.label})),("left"===v.side||v.isOrphan)&&i(n,{children:[o(t,e({component:"span",sx:{fontSize:"10px",px:.25}},{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"})),o(d,{size:10,color:(null===(m=v.style)||void 0===m?void 0:m.badgeText)||"#3730A3"})]})]})}))]})):o("span",e({},u,{children:h}))}}},[k,_]),w=c(function(){var e=m||"",r={},o=0;return function(){var i=null==v?void 0:v[0];if(i&&i.highlight){var n=i.highlight.replace(/\\(['’])/g,"$1"),t="__DEV_TOKEN_".concat(o++,"__");r[t]='<span data-badge-id="'.concat(i.id,'"><mark>').concat(n,"</mark></span>"),e=e.replace(n,t)}}(),b.forEach(function(i){if(i){var n=i.replace(/\\(['’])/g,"$1"),t="__HL_TOKEN_".concat(o++,"__");r[t]="<mark>".concat(n,"</mark>"),e=e.split(n).join(t)}}),Object.keys(r).forEach(function(o){e=e.split(o).join(r[o])}),e},[m,v,b]);return o(a,e({component:"div",sx:e(e({},u),{position:"relative",overflow:"visible","& p, & li, & ul, & ol":{position:"static",overflow:"visible"}})},{children:o(p,e({components:E,rehypePlugins:[h]},{children:f(w).replace(/\\n/g,"\n")}))}))},m);export{u as MemoizedMarkdown};
|
|
2
|
+
//# sourceMappingURL=memoizedMarkdown.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memoizedMarkdown.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{__assign as e}from"tslib";import{useState as n}from"react";import{DEVIATION_BADGE_SEPARATOR as t}from"../CognitiveComparehelpers.js";var i=function(i){var r=i.maintainRelativeOrder,o=i.proposedSections,c=i.existingSections,u=i.activeSideBySideSection,s=i.connectedSections,d=i.resetSideBySide,l=i.setConnectedSections,f=i.setConnectedLines,a=i.cachedConnectedPositions,v=i.svgContainerRef,S=i.isAnimatingRef,p=i.animationTimerRef,g=i.calculateLinesRef,x=i.sectionLeftRefs,m=i.sectionRightRefs,h=i.subSectionLeftRefs,y=i.subSectionRightRefs,R=n({}),I=R[0],b=R[1],C=n({}),E=C[0],H=C[1],L=function(e){S.current=!0,p.current&&clearTimeout(p.current),v.current&&(v.current.style.opacity="0"),p.current=setTimeout(function(){S.current=!1,g.current(),v.current&&(v.current.style.opacity="1")},e)};return{expandedSections:I,setExpandedSections:b,expandedSubSections:E,setExpandedSubSections:H,handleSubSectionToggle:function(n){var t,i,r=null===(t=h.current[n])||void 0===t?void 0:t.current,o=null===(i=y.current[n])||void 0===i?void 0:i.current;r&&(r.style.minHeight="0px"),o&&(o.style.minHeight="0px"),L(450),H(function(t){var i;return e(e({},t),((i={})[n]=!t[n],i))})},toggleSection:function(n,i){var v,S,p=null===(v=x.current[n])||void 0===v?void 0:v.current,g=null===(S=m.current[n])||void 0===S?void 0:S.current;p&&(p.style.minHeight="0px"),g&&(g.style.minHeight="0px"),L(650);var h=r?"".concat(i,"-").concat(n):String(n);if(!!I[h]){var y=new Set([String(n)]);if(r)if("left"===i){var R=o[n];((null==R?void 0:R.refIndexes)||[]).forEach(function(e){var n=c.findIndex(function(n){return n.selfIndex===e});-1!==n&&y.add(String(n))})}else{var C=c[n];o.forEach(function(e,n){var t;(null===(t=e.refIndexes)||void 0===t?void 0:t.includes(null==C?void 0:C.selfIndex))&&y.add(String(n))})}var E=function(e){var n,i;if(null===e)return!1;var r=String(e),o=r.split("-")[0];if(y.has(o))return!0;if(r.includes(t)){var c=r.split(t),u=null===(n=c[2])||void 0===n?void 0:n.split("-")[0],s=null===(i=c[3])||void 0===i?void 0:i.split("-")[0];if(u&&y.has(u))return!0;if(s&&y.has(s))return!0}return!1},H=E(u),T=Array.from(s).some(function(e){return E(e)});(H||T)&&(d(),l(new Set),f([]),a.current=[])}b(function(t){var u=e({},t),s=!t[h];if(!r)return u[String(n)]=s,u;if(u[h]=s,"left"===i){((null==(d=o[n])?void 0:d.refIndexes)||[]).forEach(function(e){var n=c.findIndex(function(n){return n.selfIndex===e});-1!==n&&(u["right-".concat(n)]=s)})}else{var d,l=null==(d=c[n])?void 0:d.selfIndex;o.forEach(function(e,n){var t;(null===(t=e.refIndexes)||void 0===t?void 0:t.includes(l))&&(u["left-".concat(n)]=s)})}return u})}}};export{i as useAccordionState};
|
|
2
|
+
//# sourceMappingURL=useAccordionState.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAccordionState.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{__assign as e,__spreadArray as i}from"tslib";import{useMemo as t}from"react";import{getSideData as n,getRationale as o,hasValue as l,DEVIATION_BADGE_SEPARATOR as r,isMissingStr as s,safeStringify as d}from"../CognitiveComparehelpers.js";var a={id:"",title:"",similarity:0,sections:[]},u=function(u,v,c,f){var p=t(function(){var t,l,r,s;if(!u||0===Object.keys(u).length)return{activeProposed:{},activeVariants:[],parseError:"Tree data is required"};try{var d=u.nodes||u,a=[],f=[],p=u.base_root_id,b=u.input_index_map||{0:"left",1:"right"},_=u[p]||d[p];if(!_||!1===_.display_node)return{activeProposed:{title:"No Data",sections:[]},activeVariants:[],parseError:null};var x=function(i,t){var l,r,s,a=u[i]||d[i];if(!a||!1===a.display_node)return null;var v=n(a,t,b),f=!1!==(null===(l=v.attributes)||void 0===l?void 0:l.display_title),p=!1!==(null===(r=v.attributes)||void 0===r?void 0:r.display_content),_=!!v.title.trim(),y=!!v.content.trim(),m=o(a),h=(null===(s=null==c?void 0:c[i])||void 0===s?void 0:s.evaluation_result)||a.evaluation_result||null,I=[];a.next&&Object.values(a.next).forEach(function(e){var i=d[e];if(i&&!1!==i.display_node){var n=x(e,t);n&&I.push(n)}});var g=!(!_&&!y);return e(e({id:i,title:_?v.title:"",content:y?v.content:"",displayTitle:f,displayContent:p,subsections:I},g?m:{score:void 0,relation:"not_defined"}),{evaluationResult:h})};if(v){var y=function(t,l){var r,s,a,v,f,p,_,x,m,h,I,g,E,N,R,S,j,O,P,T,C;void 0===l&&(l=0);var V=[],D=[];if(!t)return{refSections:V,baseSections:D};var k={},w={},M=-1,U=-1;for(var q in t){var F=t[q],K=u[F]||d[F];if(K&&!1!==K.display_node){var $=o(K),z=(null===(r=null==c?void 0:c[F])||void 0===r?void 0:r.evaluation_result)||K.evaluation_result||null,A=n(K,"1",b),B=n(K,"0",b),G=!1!==(null===(s=A.attributes)||void 0===s?void 0:s.display_title)&&A.title.trim()||!1!==(null===(a=A.attributes)||void 0===a?void 0:a.display_content)&&A.content.trim(),H=!1!==(null===(v=B.attributes)||void 0===v?void 0:v.display_title)&&B.title.trim()||!1!==(null===(f=B.attributes)||void 0===f?void 0:f.display_content)&&B.content.trim(),J=Number(null!==(_=null===(p=A.attributes)||void 0===p?void 0:p.display_index)&&void 0!==_?_:M--),L=Number(null!==(m=null===(x=B.attributes)||void 0===x?void 0:x.display_index)&&void 0!==m?m:U--),Q=k[J]||e(e({id:F,title:!1!==(null===(h=A.attributes)||void 0===h?void 0:h.display_title)?A.title:"",content:!1!==(null===(I=A.attributes)||void 0===I?void 0:I.display_content)?A.content:"",subsections:[]},G?$:{score:void 0,relation:"not_defined"}),{refIndexes:[],selfIndex:J,evaluationResult:z,displayContent:null===(g=A.attributes)||void 0===g?void 0:g.display_content,displayTitle:null===(E=A.attributes)||void 0===E?void 0:E.display_title}),W=w[L]||e(e({id:F,title:!1!==(null===(N=B.attributes)||void 0===N?void 0:N.display_title)?B.title:"",content:!1!==(null===(R=B.attributes)||void 0===R?void 0:R.display_content)?B.content:"",subsections:[]},H?$:{score:void 0,relation:"not_defined"}),{refIndexes:[],selfIndex:L,evaluationResult:z,displayContent:null===(S=B.attributes)||void 0===S?void 0:S.display_content,displayTitle:null===(j=B.attributes)||void 0===j?void 0:j.display_title});Number(J)>=0&&Number(L)>=0&&((null===(O=Q.refIndexes)||void 0===O?void 0:O.includes(Number(L)))||null===(P=Q.refIndexes)||void 0===P||P.push(Number(L)),(null===(T=W.refIndexes)||void 0===T?void 0:T.includes(Number(J)))||null===(C=W.refIndexes)||void 0===C||C.push(Number(J))),k[J]=Q,w[L]=W;var X=y(K.next,l+1),Y=X.refSections,Z=X.baseSections;Y.length>0&&(Q.subsections=i(i([],Q.subsections||[],!0),Y,!0)),Z.length>0&&(W.subsections=i(i([],W.subsections||[],!0),Z,!0))}}V=Object.values(k),D=Object.values(w);var ee=function(e,i){return e.selfIndex<0&&i.selfIndex>=0?1:e.selfIndex>=0&&i.selfIndex<0?-1:e.selfIndex-i.selfIndex};return V.sort(ee),D.sort(ee),{refSections:V,baseSections:D}},m=y(_.next),h=m.refSections,I=m.baseSections;f=h,a=I}else _.next&&Object.values(_.next).forEach(function(e){var i=u[e]||d[e];i&&!1!==i.display_node&&(a.push(x(e,"0")||{id:e,title:"",content:"",subsections:[]}),f.push(x(e,"1")||{id:e,title:"",content:"",subsections:[]}))});return{activeProposed:{title:(null===(l=null===(t=_.comparison_inputs)||void 0===t?void 0:t[b[0]])||void 0===l?void 0:l.title)||"Uploaded Contract",description:_.decision_scope_description||"",sections:a},activeVariants:[{id:"tree-variant-1",title:(null===(s=null===(r=_.comparison_inputs)||void 0===r?void 0:r[b[1]])||void 0===s?void 0:s.title)||"Reference Template",similarity:0,sections:f,analysis:{rule_difference_comparison:{summary:{overall_score:0,overall_summary:_.decision_scope_description||""},fields:{}}}}],parseError:null}}catch(e){return console.error("Data Transformation Error: ",e),{activeProposed:{},activeVariants:[],parseError:e instanceof Error?e.message:"Unknown Parsing Error"}}},[u,v,c]),b=p.activeProposed,_=p.activeVariants,x=p.parseError,y=(null==_?void 0:_[0])||a,m=t(function(){return(null==b?void 0:b.sections)||[]},[null==b?void 0:b.sections]),h=t(function(){return y.sections||[]},[y.sections]),I=m.length>0||h.length>0,g=t(function(){return f.fields.filter(function(e){var i=e.key;return(!I||"description"!==i)&&(l(null==b?void 0:b[i])||l(y[i]))})},[b,y,I,f.fields]),E=t(function(){var e,i,t={},n={},o={},l=null===(e=null==u?void 0:u.input_index_map)||void 0===e?void 0:e[0],a=null===(i=null==u?void 0:u.input_index_map)||void 0===i?void 0:i[1],c=new Map,f=function(e,i){if(s(e)||!i)return!1;var t=e.replace(/\\(['’])/g,"$1").replace(/\\n/g,"\n");if(!t)return!1;var n=function(e){return e&&e.id?(c.has(e.id)||c.set(e.id,d(e.content||"").replace(/\\n/g,"\n")),c.get(e.id)):""}(i);return!!n.includes(t)&&(c.set(i.id,n.replace(t,"__TOKEN__")),!0)},p=function(e,i,s,d,u,v){if(e&&!u){var c=(null==v?void 0:v.id)||"";t[c]||(t[c]=[]),t[c].push(e),function(e,i,t,s){var d,u=(null===(d=null==e?void 0:e.evaluationResult)||void 0===d?void 0:d.deviations)||{};Object.keys(u).sort().forEach(function(d){var v=u[d];if(v){var c=f(v[l],i),p=f(v[a],t);if(c||p){var b="".concat(e.id).concat(r).concat(d);void 0===n[b]&&(o[s]=(o[s]||0)+1,n[b]=o[s])}}})}(e,i,s,d)}for(var b=(null==i?void 0:i.subsections)||[],_=(null==s?void 0:s.subsections)||[],x=(null==e?void 0:e.subsections)||[],y=Math.max(b.length,_.length,x.length),m=0;m<y;m++)p(x[m]||b[m]||_[m],b[m],_[m],d,!1,v)},b=new Map,_=new Map;return v&&(h.forEach(function(e){void 0!==e.selfIndex&&b.set(e.selfIndex,e)}),m.forEach(function(e){void 0!==e.selfIndex&&_.set(e.selfIndex,e)})),m.forEach(function(e,i){var t,n=e.selfIndex,o=v&&void 0!==n&&n>=0?n+1:i+1,l=null;if(v){var r=null===(t=e.refIndexes)||void 0===t?void 0:t[0];void 0!==r&&(l=b.get(r)||null)}else l=h[i]||null;p(e,e,l,o,!0,e)}),h.forEach(function(e,i){var t,n=i+1,o=!1;if(v){var l=null===(t=e.refIndexes)||void 0===t?void 0:t[0],r=void 0!==l?_.get(l):null;r&&void 0!==r.selfIndex&&r.selfIndex>=0?n=r.selfIndex+1:(o=!0,void 0!==e.selfIndex&&e.selfIndex>=0&&(n=e.selfIndex+1))}else o=i>=m.length;o&&p(e,null,e,n,!0,e)}),{parentDeviationRecord:t,registry:n}},[m,h,v,u]),N=E.parentDeviationRecord,R=E.registry;return{activeProposed:b,activeVariants:_,existingRule:y,proposedSections:m,existingSections:h,visibleFields:g,parentDeviationRecord:N,deviationNumberRegistry:R,parseError:x}};export{u as useCognitiveTreeData};
|
|
2
|
+
//# sourceMappingURL=useCompareData.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCompareData.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{useState as n,useRef as e,useEffect as t,useCallback as o}from"react";import{EMPTY_SECTION_POPUP_STATE as i,POPUP_GAP as r,VIEWPORT_MARGIN as c,ARROW_SIZE as u,POPUP_WIDTH as a}from"../CognitiveCompareConstants.js";var l=function(l){var s=n(i),p=s[0],v=s[1],f=n(i),m=f[0],d=f[1],h=n(null),w=h[0],g=h[1],M=n(null),E=M[0],F=M[1],A=e(null),C=e(null);t(function(){C.current=null},[p.sectionIdx,p.open]);var P=o(function(){g(null),v(i),F(null)},[]),b=o(function(){d(i)},[]),x=o(function(){var n;if(p.anchorEl&&p.refSectionTitle){var e=p.anchorEl.getBoundingClientRect();if(0!==e.width||0!==e.height){var t=(null===(n=null==A?void 0:A.current)||void 0===n?void 0:n.offsetHeight)||0,o=Math.min(a,window.innerWidth-2*c),i=window.innerHeight-e.bottom-r-c,l=e.top-r-c,s=i<t&&l>i;s=null!==C.current?!0===C.current&&(l>=t||l>=i):!(i>=t||i>=l),C.current=s;var v=s?l:i,f=Math.min(t||9999,v),m=s?e.top-r-f:e.bottom+r,d=e.left+e.width/2,h=d-o/2,w=Math.max(c,Math.min(h,window.innerWidth-o-c)),M=Math.max(u+4,Math.min(d-w,o-u-4));g({top:m,left:w,arrowLeft:M,openAbove:s,maxHeight:v})}}},[p.anchorEl,p.refSectionTitle]);return t(function(){if(p.open){window.addEventListener("resize",x);var n=requestAnimationFrame(x),e=null;return A.current&&(e=new ResizeObserver(function(){cancelAnimationFrame(n),n=requestAnimationFrame(x)})).observe(A.current),function(){cancelAnimationFrame(n),window.removeEventListener("resize",x),null==e||e.disconnect()}}},[p.open,x]),t(function(){var n=l.current;if(n&&(m.open||p.open)){var e=function(n){b(),A.current&&A.current.contains(n.target)||(g(null),P())};return n.addEventListener("scroll",e,{capture:!0}),function(){n.removeEventListener("scroll",e,{capture:!0})}}},[l,m.open,p.open,b,P]),{cognitivePopup:p,setCognitivePopup:v,moreFunctions:m,setMoreFunctions:d,position:w,setPosition:g,activeBadgeId:E,setActiveBadgeId:F,popupRef:A,closeCognitivePopup:P,closeMoreFunctionsPopup:b,recalcPosition:x}};export{l as useComparePopups};
|
|
2
|
+
//# sourceMappingURL=useComparePopups.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useComparePopups.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{__assign as e}from"tslib";import{useState as o,useRef as n,useEffect as t}from"react";import{debounce as i,DEVIATION_BADGE_SEPARATOR as r}from"../CognitiveComparehelpers.js";var l=function(l){var u=l.proposedSections,c=l.existingSections,d=l.parentDeviationRecord,v=l.expandedSections,f=l.maintainRelativeOrder,a=l.scrollContainerRef,s=l.leftContainerRef,h=l.lhsBadgeRefs,w=l.rhsBadgeRefs,g=o({}),R=g[0],b=g[1],m=n();return t(function(){if(a.current){var o=f?s.current:a.current;if(o){var n=null,t=setTimeout(function(){var t=function(e,o){var n=e.getBoundingClientRect(),t=o.getBoundingClientRect();return n.bottom<t.top?"above":n.top>t.bottom?"below":"inside"};n=i(function(){b(function(o){var n=e({},o);return u.forEach(function(e,o){var i=f?!!v["left-".concat(o)]:!!v[String(o)],l=!1,u=!1,c=null,s=null;i&&(null==e?void 0:e.id)&&(d[e.id]||[]).forEach(function(o){var n="".concat(o.id).concat(r,"0"),i=h.current[n];if((null==i?void 0:i.current)&&a.current){var d=t(i.current,a.current);"above"===d?(l=!0,c=i):"below"!==d||u?m.current===e.id&&(m.current=""):(u=!0,s=i)}}),e.id&&(n[e.id]={showAbove:l,showBelow:u,showAboveRef:c,showBelowRef:s,columnKey:"left"})}),f||c.forEach(function(e,o){var i=!!v[String(o)],l=!1,u=!1,c=null,f=null;i&&(null==e?void 0:e.id)&&(d[e.id]||[]).forEach(function(o){var i,d,v,s,h,g=!(null===(i=o.refIndexes)||void 0===i?void 0:i.length)||void 0!==o.selfIndex&&o.selfIndex<0,R="".concat(o.id).concat(r,"0"),b=w.current[R];if((null==b?void 0:b.current)&&a.current&&g&&(null==e?void 0:e.id)){var p=t(b.current,a.current);if("above"===p){var B=null===(v=null===(d=n[e.id])||void 0===d?void 0:d.showAboveRef)||void 0===v?void 0:v.current;(!B||B.getBoundingClientRect().top<b.current.getBoundingClientRect().top)&&(l=!0,c=b)}else if("below"!==p||u)m.current===e.id&&(m.current="");else{var C=null===(h=null===(s=n[e.id])||void 0===s?void 0:s.showBelowRef)||void 0===h?void 0:h.current;(!C||C.getBoundingClientRect().top>b.current.getBoundingClientRect().top)&&(u=!0,f=b)}}}),e.id&&i&&(l&&(n[e.id]=n[e.id]||{showAbove:!1,showAboveRef:null,showBelow:!1,showBelowRef:null,columnKey:"right"},n[e.id].showAbove=l,n[e.id].showAboveRef=c,n[e.id].columnKey="right"),u&&(n[e.id]=n[e.id]||{showAbove:!1,showAboveRef:null,showBelow:!1,showBelowRef:null,columnKey:"right"},n[e.id].showBelow=u,n[e.id].showBelowRef=f,n[e.id].columnKey="right"))}),n})},100),n(),null==o||o.addEventListener("scroll",n)},0);return function(){clearTimeout(t),n&&o.removeEventListener("scroll",n)}}}},[u,c,d,v,f,a,s,h,w]),{showDeviationNavigation:R,showOpenNodeRef:m}};export{l as useDeviationNavigation};
|
|
2
|
+
//# sourceMappingURL=useDeviationNavigation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDeviationNavigation.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import e,{useRef as t,useCallback as r}from"react";var n=function(){return e.createRef()},f=function(e,f){var c=t({}),u=t({}),o=t({}),i=t({}),R=t({}),s=t({}),a=t({}),g=t({}),h=t({}),l=t({}),v=r(function(e,t){var r="left"===e?c.current:u.current;return r[t]||(r[t]=n()),r[t]},[]),S=r(function(e,t){return e.current[t]||(e.current[t]=n()),e.current[t]},[]);e.forEach(function(e){v("left",e),v("right",e)});for(var d=0;d<f;d+=1)S(o,d),S(i,d),S(R,d),S(s,d),S(a,d);var b=r(function(e){return S(l,e)},[S]),w=r(function(e,t){var r="left"===e?g.current:h.current;return r[t]||(r[t]=n()),r[t]},[]),B=r(function(e,t){return S("left"===e?R:s,t)},[S]);return{leftRefs:c,rightRefs:u,sectionLeftRefs:o,sectionRightRefs:i,lhsBadgeRefs:R,rhsBadgeRefs:s,sectionRightRowRefs:a,subSectionLeftRefs:g,subSectionRightRefs:h,sectionRowRefs:l,getFieldRef:v,getSectionRowRef:b,getSubSectionRef:w,getBadgeRef:B}};export{f as useSectionRefs};
|
|
2
|
+
//# sourceMappingURL=useSectionRefs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSectionRefs.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CognitiveCompareTest.d.ts","sourceRoot":"","sources":["../../../src/CognitiveCompareTest.tsx"],"names":[],"mappings":"AAcA,QAAA,MAAM,oBAAoB,+
|
|
1
|
+
{"version":3,"file":"CognitiveCompareTest.d.ts","sourceRoot":"","sources":["../../../src/CognitiveCompareTest.tsx"],"names":[],"mappings":"AAcA,QAAA,MAAM,oBAAoB,+CAsBzB,CAAA;AAED,eAAe,oBAAoB,CAAC"}
|