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