@viswa-test/test-citation 0.0.225 → 0.0.227
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/README.md +270 -0
- package/dist/assests/svg/NeuralNetworkIcon.js +2 -0
- package/dist/assests/svg/NeuralNetworkIcon.js.map +1 -0
- package/dist/cjs/assests/svg/NeuralNetworkIcon.js +2 -0
- package/dist/cjs/assests/svg/NeuralNetworkIcon.js.map +1 -0
- package/dist/cjs/features/CognitiveCompare/CognitiveCompare.js +1 -1
- package/dist/cjs/features/CognitiveCompare/components/SectionAccordion.js +1 -1
- package/dist/cjs/features/CognitiveCompare/components/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/cjs/features/CognitiveCompare/hooks/useStyles.js +1 -1
- package/dist/cjs/features/GptWebCitation/GptWebCitation.js +2 -0
- package/dist/cjs/features/GptWebCitation/GptWebCitation.js.map +1 -0
- package/dist/cjs/features/GptWebCitation/GptWebCitation.module.css.js +2 -0
- package/dist/cjs/features/GptWebCitation/GptWebCitation.module.css.js.map +1 -0
- package/dist/cjs/features/GptWebCitation/GptWebCitationImageCitation.js +2 -0
- package/dist/cjs/features/GptWebCitation/GptWebCitationImageCitation.js.map +1 -0
- package/dist/cjs/features/GptWebCitation/GptWebCitationImageFullScreenView.js +2 -0
- package/dist/cjs/features/GptWebCitation/GptWebCitationImageFullScreenView.js.map +1 -0
- package/dist/cjs/features/GptWebCitation/GptWebCitationMarkdown.js +2 -0
- package/dist/cjs/features/GptWebCitation/GptWebCitationMarkdown.js.map +1 -0
- package/dist/cjs/features/GptWebCitation/GptWebCitationSkeleton.js +2 -0
- package/dist/cjs/features/GptWebCitation/GptWebCitationSkeleton.js.map +1 -0
- package/dist/cjs/features/GptWebCitation/utils/citationData.utils.js +2 -0
- package/dist/cjs/features/GptWebCitation/utils/citationData.utils.js.map +1 -0
- package/dist/cjs/features/RequirementAI/components/UserStoryCard/AttachedContext.js +1 -1
- package/dist/cjs/features/RequirementAI/components/UserStoryCard/AttachedContext.module.css.js +1 -1
- package/dist/cjs/features/RequirementAI/components/UserStoryCard/Popups/DeviationSummary.js +1 -1
- package/dist/cjs/features/RequirementAI/components/UserStoryCard/UserStoryCard.js +1 -1
- package/dist/cjs/features/RequirementAI/components/UserStoryCard/UserStoryCard.module.css.js +1 -1
- package/dist/cjs/features/RequirementAI/components/ai-reasoning/AiReasoningCitation.js +1 -1
- package/dist/cjs/features/RequirementAI/components/ai-reasoning/AiReasoningCitationContent.js +1 -1
- package/dist/cjs/features/RequirementAI/components/ai-reasoning/ScannedCitationRenderer.js +1 -1
- package/dist/cjs/features/RequirementAI/components/segment/Segment.js +1 -1
- package/dist/cjs/features/RequirementAI/components/segment/segment-common.css.js +1 -1
- package/dist/cjs/features/RequirementAI/components/segment/segment.module.css.js +1 -1
- package/dist/cjs/features/RequirementAI/components/userstory-with-citation/UserStoryWithCitation.js +1 -1
- package/dist/cjs/features/RequirementAI/components/userstory-with-citation/UserStoryWithCitation.module.css.js +1 -1
- package/dist/cjs/features/RequirementAiCitations/WebCitation/WebCitationWithImageContent.js +1 -1
- package/dist/cjs/features/RequirementAiCitations/WebCitation/WebCitationWithImageContent.module.css.js +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/features/CognitiveCompare/CognitiveCompare.js +1 -1
- package/dist/features/CognitiveCompare/components/SectionAccordion.js +1 -1
- package/dist/features/CognitiveCompare/components/SubSectionAccordion.js +1 -1
- package/dist/features/CognitiveCompare/hooks/memoizedMarkdown.js +1 -1
- package/dist/features/CognitiveCompare/hooks/useCompareData.js +1 -1
- package/dist/features/CognitiveCompare/hooks/useStyles.js +1 -1
- package/dist/features/GptWebCitation/GptWebCitation.js +2 -0
- package/dist/features/GptWebCitation/GptWebCitation.js.map +1 -0
- package/dist/features/GptWebCitation/GptWebCitation.module.css.js +2 -0
- package/dist/features/GptWebCitation/GptWebCitation.module.css.js.map +1 -0
- package/dist/features/GptWebCitation/GptWebCitationImageCitation.js +2 -0
- package/dist/features/GptWebCitation/GptWebCitationImageCitation.js.map +1 -0
- package/dist/features/GptWebCitation/GptWebCitationImageFullScreenView.js +2 -0
- package/dist/features/GptWebCitation/GptWebCitationImageFullScreenView.js.map +1 -0
- package/dist/features/GptWebCitation/GptWebCitationMarkdown.js +2 -0
- package/dist/features/GptWebCitation/GptWebCitationMarkdown.js.map +1 -0
- package/dist/features/GptWebCitation/GptWebCitationSkeleton.js +2 -0
- package/dist/features/GptWebCitation/GptWebCitationSkeleton.js.map +1 -0
- package/dist/features/GptWebCitation/utils/citationData.utils.js +2 -0
- package/dist/features/GptWebCitation/utils/citationData.utils.js.map +1 -0
- package/dist/features/RequirementAI/components/UserStoryCard/AttachedContext.js +1 -1
- package/dist/features/RequirementAI/components/UserStoryCard/AttachedContext.module.css.js +1 -1
- package/dist/features/RequirementAI/components/UserStoryCard/Popups/DeviationSummary.js +1 -1
- package/dist/features/RequirementAI/components/UserStoryCard/UserStoryCard.js +1 -1
- package/dist/features/RequirementAI/components/UserStoryCard/UserStoryCard.module.css.js +1 -1
- package/dist/features/RequirementAI/components/ai-reasoning/AiReasoningCitation.js +1 -1
- package/dist/features/RequirementAI/components/ai-reasoning/AiReasoningCitationContent.js +1 -1
- package/dist/features/RequirementAI/components/ai-reasoning/ScannedCitationRenderer.js +1 -1
- package/dist/features/RequirementAI/components/segment/Segment.js +1 -1
- package/dist/features/RequirementAI/components/segment/segment-common.css.js +1 -1
- package/dist/features/RequirementAI/components/segment/segment.module.css.js +1 -1
- package/dist/features/RequirementAI/components/userstory-with-citation/UserStoryWithCitation.js +1 -1
- package/dist/features/RequirementAI/components/userstory-with-citation/UserStoryWithCitation.module.css.js +1 -1
- package/dist/features/RequirementAiCitations/WebCitation/WebCitationWithImageContent.js +1 -1
- package/dist/features/RequirementAiCitations/WebCitation/WebCitationWithImageContent.module.css.js +1 -1
- package/dist/index.js +1 -1
- package/dist/types/src/CognitiveCompareTest.d.ts.map +1 -1
- package/dist/types/src/CommonConstants/CommonConstants.d.ts +0 -10476
- package/dist/types/src/CommonConstants/CommonConstants.d.ts.map +1 -1
- package/dist/types/src/DeviationSummaryTest.d.ts +2 -0
- package/dist/types/src/DeviationSummaryTest.d.ts.map +1 -0
- package/dist/types/src/assests/svg/NeuralNetworkIcon.d.ts +9 -0
- package/dist/types/src/assests/svg/NeuralNetworkIcon.d.ts.map +1 -0
- 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 +6 -0
- package/dist/types/src/features/CognitiveCompare/CognitiveCompareTypes.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/CompareContext.d.ts +1 -1
- package/dist/types/src/features/CognitiveCompare/CompareContext.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.map +1 -1
- package/dist/types/src/features/CognitiveCompare/hooks/useCompareLayout.d.ts +0 -1
- package/dist/types/src/features/CognitiveCompare/hooks/useCompareLayout.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/hooks/useStyles.d.ts +3 -2
- package/dist/types/src/features/CognitiveCompare/hooks/useStyles.d.ts.map +1 -1
- package/dist/types/src/features/GptWebCitation/GptWebCitation.d.ts +5 -0
- package/dist/types/src/features/GptWebCitation/GptWebCitation.d.ts.map +1 -0
- package/dist/types/src/features/GptWebCitation/GptWebCitationImageCitation.d.ts +8 -0
- package/dist/types/src/features/GptWebCitation/GptWebCitationImageCitation.d.ts.map +1 -0
- package/dist/types/src/features/GptWebCitation/GptWebCitationImageFullScreenView.d.ts +8 -0
- package/dist/types/src/features/GptWebCitation/GptWebCitationImageFullScreenView.d.ts.map +1 -0
- package/dist/types/src/features/GptWebCitation/GptWebCitationMarkdown.d.ts +9 -0
- package/dist/types/src/features/GptWebCitation/GptWebCitationMarkdown.d.ts.map +1 -0
- package/dist/types/src/features/GptWebCitation/GptWebCitationSkeleton.d.ts +3 -0
- package/dist/types/src/features/GptWebCitation/GptWebCitationSkeleton.d.ts.map +1 -0
- package/dist/types/src/features/GptWebCitation/GptWebCitationTest.d.ts +4 -0
- package/dist/types/src/features/GptWebCitation/GptWebCitationTest.d.ts.map +1 -0
- package/dist/types/src/features/GptWebCitation/WebCitationSampleResponse.d.ts +4 -0
- package/dist/types/src/features/GptWebCitation/WebCitationSampleResponse.d.ts.map +1 -0
- package/dist/types/src/features/GptWebCitation/types.d.ts +112 -0
- package/dist/types/src/features/GptWebCitation/types.d.ts.map +1 -0
- package/dist/types/src/features/GptWebCitation/utils/citationData.utils.d.ts +8 -0
- package/dist/types/src/features/GptWebCitation/utils/citationData.utils.d.ts.map +1 -0
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/AttachedContext.d.ts +1 -3
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/AttachedContext.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/DeviationSummary.d.ts +6 -1
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/DeviationSummary.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/UserStoryCard.d.ts +13 -3
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/UserStoryCard.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/ai-reasoning/AiReasoningCitationContent.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/ai-reasoning/ScannedCitationRenderer.d.ts +1 -1
- package/dist/types/src/features/RequirementAI/components/ai-reasoning/ScannedCitationRenderer.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/segment/Segment.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/userstory-with-citation/UserStoryWithCitation.d.ts +3 -1
- package/dist/types/src/features/RequirementAI/components/userstory-with-citation/UserStoryWithCitation.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +3 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/package.json +7 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as e,__spreadArray as n,__awaiter as i,__generator as t}from"tslib";import{jsx as o,jsxs as r}from"react/jsx-runtime";import{useState as l,useRef as u,useMemo as c,useEffect as a,useCallback as s}from"react";import{Box as d,Snackbar as v,Alert as f,Tooltip as p,Typography as g}from"@mui/material";import{ChevronDown as m}from"lucide-react";import{ButtonCognitiveIcon as h}from"../../assests/svg/ButtonCognitiveIcon.js";import S from"./OverlayComponent.js";import{safeStringify as R,extractDeviationScore as x,generateColorPalette as y,findKeyPathByNodeId as b,DEVIATION_BADGE_SEPARATOR as C,hasMeaningfulRedlineTags as w,scrollAndHighlightClause as _,scrollAndWait as B,waitForScrollIdle as F}from"./CognitiveComparehelpers.js";import{SHARED_MARKDOWN_STYLES as E,DEFAULT_FIELD_CONFIG as I,DEFAULT_COMPARISON_CONFIG as T}from"./CognitiveCompareConfig.js";export{SHARED_MARKDOWN_STYLES}from"./CognitiveCompareConfig.js";import{DEFAULT_DEVIAION_COLOR as A,EMPTY_SUMMARY_POPUP_STATE as D,DEFAULT_COMPONENT_HEADER_TEXT as P}from"./CognitiveCompareConstants.js";import k from"./CognitivePopup.js";import O from"./MoreFunctionsPopup.js";import L from"./LoaderComponent.js";import j from"./components/ThreeDotsLoader.js";import{useCognitiveTreeData as N}from"./hooks/useCompareData.js";import{useComparePopups as H}from"./hooks/useComparePopups.js";import{useSectionRefs as z}from"./hooks/useSectionRefs.js";import{useAccordionState as M}from"./hooks/useAccordionState.js";import{useDeviationNavigation as q}from"./hooks/useDeviationNavigation.js";import V from"./components/CompareHeader.js";import W from"./components/SubSectionAccordion.js";import K from"./components/LHSSectionRow.js";import J from"./components/RHSSectionRow.js";import Y from"./components/CognitiveSummaryPopup.js";import{CompareContextProvider as X}from"./CompareContext.js";import{useStyleHelpers as $}from"./hooks/useStyles.js";import{useResizeHandler as U}from"./hooks/useResizeHandler.js";import{useLinesCalculator as G}from"./hooks/useLinesCalculator.js";import{useSideBySide as Q}from"./hooks/useSideBySide.js";import Z from"./components/SvgConnectors.js";var ee=function(ee){var ne,ie,te,oe,re,le,ue,ce,ae,se,de,ve,fe,pe,ge,me,he,Se,Re,xe,ye,be,Ce,we,_e,Be,Fe,Ee,Ie,Te,Ae,De,Pe,ke,Oe,Le=ee.componentHeaderText,je=void 0===Le?P:Le,Ne=ee.treeData,He=ee.comparisonConfig,ze=ee.leftColumnTitleText,Me=ee.rightColumnTitleText,qe=ee.markdownStyles,Ve=ee.resetTrigger,We=ee.displayConfig,Ke=void 0===We?{isHeaderVisible:!0,isToggleVisible:!0,maintainRelativeOrder:!1,isLoading:!0,showDeviationBadges:!1,enableDeviationSchemaBackwardCompatibility:!1,displayEmailNotifier:!0}:We,Je=ee.onMaintainRelativeOrderChange,Ye=ee.popupConfig,Xe=ee.deviationData,$e=void 0===Xe?{}:Xe,Ue=ee.deviationNodeIdToView,Ge=ee.resetDeviationNodeId,Qe=ee.isProposingFix,Ze=void 0!==Qe&&Qe,en=ee.proposingFixNodeId,nn=ee.isRedlineFlow,tn=l(Ke.maintainRelativeOrder),on=tn[0],rn=tn[1],ln=null!==(ne=null==Ke?void 0:Ke.expandLevels)&&void 0!==ne?ne:0,un=!!(null==Ke?void 0:Ke.expandAllSections),cn=!!on||!!(null==Ke?void 0:Ke.showDeviationBadges),an=l(!1),sn=an[0],dn=an[1],vn=l(null),fn=vn[0],pn=vn[1],gn=l(null===(te=null!==(ie=null==Ne?void 0:Ne.newEvaluationResult)&&void 0!==ie?ie:null==Ke?void 0:Ke.enableDeviationSchemaBackwardCompatibility)||void 0===te||te)[0],mn=l(new Set),hn=mn[0],Sn=mn[1],Rn=l([]),xn=Rn[0],yn=Rn[1],bn=l(!1),Cn=bn[0],wn=bn[1],_n=u(null),Bn=u(null),Fn=u(null),En=u(null),In=u(null),Tn=u(!1),An=u(null),Dn=u({}),Pn=u([]),kn=u(function(){}),On=u(null),Ln=u(function(){}),jn=c(function(){return JSON.stringify($e||{})},[JSON.stringify($e)]),Nn=c(function(){return $e||{}},[jn]),Hn=c(function(){return(null==Ne?void 0:Ne.cognitive_decisioning)||{}},[Ne]),zn=c(function(){return e(e({},E),qe)},[qe]),Mn=u(null),qn=u(null),Vn=u(null),Wn=u(null),Kn=u(null),Jn=u(null),Yn=u(null),Xn=u(null),$n=u(null),Un=u(null),Gn=H(Mn),Qn=Gn.cognitivePopup,Zn=Gn.setCognitivePopup,ei=Gn.moreFunctions,ni=Gn.setMoreFunctions,ii=Gn.position,ti=Gn.setPosition,oi=Gn.activeBadgeId,ri=Gn.summaryPopup,li=Gn.setSummaryPopup,ui=Gn.closeSummaryPopup,ci=Gn.setActiveBadgeId,ai=Gn.popupRef,si=Gn.handleOpenCognitiveCompare,di=Gn.openCognitivePopupFromState,vi=Gn.closeCognitivePopup,fi=Gn.closeMoreFunctionsPopup,pi=c(function(){var e,n,i,t,o,r,l;return{fields:null!==(e=null==He?void 0:He.fields)&&void 0!==e?e:I,thresholds:{high:null!==(i=null===(n=null==He?void 0:He.thresholds)||void 0===n?void 0:n.high)&&void 0!==i?i:T.thresholds.high,medium:null!==(o=null===(t=null==He?void 0:He.thresholds)||void 0===t?void 0:t.medium)&&void 0!==o?o:T.thresholds.medium,exact:null!==(l=null===(r=null==He?void 0:He.thresholds)||void 0===r?void 0:r.exact)&&void 0!==l?l:T.thresholds.exact}}},[He]),gi=l(null),mi=gi[0];gi[1];var hi=null===(le=null===(oe=null==Ne?void 0:Ne.documents)||void 0===oe?void 0:oe[null===(re=null==Ne?void 0:Ne.input_index_map)||void 0===re?void 0:re[0]])||void 0===le?void 0:le.title,Si=null===(ae=null===(ue=null==Ne?void 0:Ne.documents)||void 0===ue?void 0:ue[null===(ce=null==Ne?void 0:Ne.input_index_map)||void 0===ce?void 0:ce[1]])||void 0===ae?void 0:ae.title,Ri=R(ze||hi||"Uploaded Contract"),xi=null===(fe=null===(ve=null===(se=null==Ne?void 0:Ne.documents)||void 0===se?void 0:se[null===(de=null==Ne?void 0:Ne.input_index_map)||void 0===de?void 0:de[0]])||void 0===ve?void 0:ve.metadata)||void 0===fe?void 0:fe.file_name,yi=R(xi),bi=null===(he=null===(me=null===(pe=null==Ne?void 0:Ne.documents)||void 0===pe?void 0:pe[null===(ge=null==Ne?void 0:Ne.input_index_map)||void 0===ge?void 0:ge[1]])||void 0===me?void 0:me.metadata)||void 0===he?void 0:he.file_name,Ci=R(bi),wi=R(Me||Si||"Reference Template"),_i=N(Ne,on,Nn,pi,gn),Bi=_i.activeProposed,Fi=_i.existingRule,Ei=_i.proposedSections,Ii=_i.existingSections,Ti=_i.visibleFields,Ai=_i.parentDeviationRecord,Di=_i.deviationNumberRegistry,Pi=_i.deviationParentRegistry,ki=_i.parseError;a(function(){ki&&pn("Failed to load comparison: ".concat(ki))},[ki]);var Oi=Ei.length>0||Ii.length>0,Li=c(function(){if(!nn)return"off";var e=0,n=0,i=function(t){Array.isArray(t)&&t.forEach(function(t){var o,r=(null==t?void 0:t.content)||"";w(r)&&(e+=1,n+=String(r).length),(null===(o=null==t?void 0:t.subsections)||void 0===o?void 0:o.length)&&i(t.subsections)})};return i(Ei),i(Ii),"".concat(e,":").concat(n)},[nn,Ei,Ii]);a(function(){if(Ei.length||Ii.length)if(un){var e={},n={},i=function(i,t){i.forEach(function(i,o){var r,l=on?"".concat(t,"-").concat(o):String(o);e[l]=!0;var u=function(e,i){null==e||e.forEach(function(e,t){var o,r="".concat(i,"-").concat(t);n[r]=!0,(null===(o=e.subsections)||void 0===o?void 0:o.length)&&u(e.subsections,r)})};(null===(r=i.subsections)||void 0===r?void 0:r.length)&&u(i.subsections,String(o))})};i(Ei,"left"),i(Ii,"right"),ht(e),Rt(n)}else if(ln>0){var t={},o={},r=function(e,n,i){e.forEach(function(e,r){var l;if(i>=1){var u=on?"".concat(n,"-").concat(r):String(r);t[u]=!0}var c=function(e,n,t){t>i||null==e||e.forEach(function(e,i){var r,l="".concat(n,"-").concat(i);o[l]=!0,(null===(r=e.subsections)||void 0===r?void 0:r.length)&&c(e.subsections,l,t+1)})};(null===(l=e.subsections)||void 0===l?void 0:l.length)&&i>=2&&c(e.subsections,String(r),2)})};r(Ei,"left",ln),r(Ii,"right",ln),ht(t),Rt(o)}},[un,ln,Ei,Ii,on]);var ji=z(Ti.map(function(e){return e.key}),Math.max(Ei.length,Ii.length)),Ni=ji.leftRefs,Hi=ji.rightRefs,zi=ji.sectionLeftRefs,Mi=ji.sectionRightRefs,qi=ji.lhsBadgeRefs,Vi=ji.rhsBadgeRefs,Wi=ji.sectionRightRowRefs,Ki=ji.subSectionLeftRefs,Ji=ji.subSectionRightRefs,Yi=ji.sectionRowRefs,Xi=ji.getSectionRowRef,$i=ji.getSubSectionRef,Ui=ji.getBadgeRef,Gi=Q({maintainRelativeOrder:on,proposedSections:Ei,existingSections:Ii,leftContainerRef:Xn,rightContainerRef:Vn,scrollContainerRef:Mn,sectionLeftRefs:zi,sectionRightRefs:Mi,subSectionLeftRefs:Ki,subSectionRightRefs:Ji,lhsBadgeRefs:qi,rhsBadgeRefs:Vi,sectionRowRefs:Yi,sectionRightRowRefs:Wi,rhsTopSpacerRef:Wn,rhsBottomSpacerRef:Kn,lhsTopSpacerRef:Jn,lhsBottomSpacerRef:Yn,calculateLinesRef:kn,setConnectedSections:Sn,setConnectedLines:yn,cachedConnectedPositions:Pn,closeMoreFunctionsPopup:fi,setErrorToast:pn,moreFunctions:ei,closeSummaryPopup:ui}),Qi=Gi.isSideBySide,Zi=Gi.isArrowVisible,et=Gi.setIsArrowVisible,nt=Gi.isResizing,it=Gi.setIsResizing,tt=Gi.isSideBySideLoading,ot=Gi.activeSideBySideSection,rt=Gi.scrollLock,lt=Gi.sideBySideCacheRef,ut=Gi.isSideBySideRef,ct=Gi.activeSideBySideRightSectionRef,at=Gi.activeSideBySideSectionRef,st=Gi.sideBySideLineRef,dt=Gi.highlightedClauseRefs,vt=Gi.clearClauseHighlight,ft=Gi.resetSideBySide,pt=Gi.activateSideBySide,gt=M({maintainRelativeOrder:!!on,proposedSections:Ei,existingSections:Ii,activeSideBySideSection:ot,connectedSections:hn,resetSideBySide:ft,setConnectedSections:Sn,setConnectedLines:yn,cachedConnectedPositions:Pn,svgContainerRef:_n,isAnimatingRef:Tn,animationTimerRef:An,calculateLinesRef:kn,sectionLeftRefs:zi,sectionRightRefs:Mi,subSectionLeftRefs:Ki,subSectionRightRefs:Ji}),mt=gt.expandedSections,ht=gt.setExpandedSections,St=gt.expandedSubSections,Rt=gt.setExpandedSubSections,xt=gt.handleSubSectionToggle,yt=gt.toggleSection,bt=gt.forceExpandCrossWiredSections,Ct=function(){var e,n;if(null!=ot){var i=null===(e=zi.current[ot])||void 0===e?void 0:e.current,t=null===(n=Mi.current[ot])||void 0===n?void 0:n.current,o=Vn.current;if(i&&t&&o){var r=i.getBoundingClientRect(),l=t.getBoundingClientRect(),u=o.getBoundingClientRect(),c=r.top-u.top,a=l.top-u.top-c;o.scrollBy({top:a,behavior:"smooth"})}}},wt=s(function(e){null==e||e.stopPropagation(),wn(function(e){var n=!e;return n&&requestAnimationFrame(function(){Ct()}),n})},[Ct]);a(function(){nn&&"off"!==Li&&"0:0"!==Li&&(lt.current=null,Pn.current=[],requestAnimationFrame(function(){var e;null===(e=kn.current)||void 0===e||e.call(kn)}))},[nn,Li]);var _t=c(function(){var e=new Map,n=new Map,i=1;if(on)Ei.forEach(function(n){!n.title&&!n.content||n.id&&e.set(n.id,i++)}),Ii.forEach(function(t){if(t.id&&!(!t.title&&!t.content)){var o=Ei.filter(function(e){var n;return null===(n=e.refIndexes)||void 0===n?void 0:n.includes(t.selfIndex)});if(o.length>0){var r=o.map(function(n){return e.get(n.id)}).filter(Boolean);n.set(t.id,r.join(", "))}else n.set(t.id,String(i++))}});else for(var t=Math.max(Ei.length,Ii.length),o=0;o<t;o++){var r=Ei[o],l=Ii[o];r?(e.set(r.id,i),l&&n.set(l.id,String(i)),i++):l&&n.set(l.id,String(i++))}return{leftNums:e,rightNums:n}},[Ei,Ii,on]),Bt=Fi.analysis,Ft=R(null===(Re=null===(Se=null==Bt?void 0:Bt.rule_difference_comparison)||void 0===Se?void 0:Se.summary)||void 0===Re?void 0:Re.overall_summary),Et=!!Ft.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),It=null!==(xe=null==Ne?void 0:Ne.base_root_id)&&void 0!==xe?xe:"-1";null==Ne||Ne[It];var Tt=gn?null!==(De=null!==(Ie=$e&&(null===(Ee=null==$e?void 0:$e[It])||void 0===Ee?void 0:Ee.evaluation_result))&&void 0!==Ie?Ie:null===(Ae=null===(Te=null==Ne?void 0:Ne.nodes)||void 0===Te?void 0:Te[It])||void 0===Ae?void 0:Ae.evaluation_result)&&void 0!==De?De:null:null!==(Fe=null!==(Ce=$e&&(null===(be=null===(ye=null==$e?void 0:$e[It])||void 0===ye?void 0:ye.evaluation_result)||void 0===be?void 0:be[0]))&&void 0!==Ce?Ce:null===(Be=null===(_e=null===(we=null==Ne?void 0:Ne.nodes)||void 0===we?void 0:we[It])||void 0===_e?void 0:_e.evaluation_result)||void 0===Be?void 0:Be[0])&&void 0!==Fe?Fe:null,At=x(Tt),Dt=y(null!==(Oe=null===(ke=null===(Pe=null==Tt?void 0:Tt.evaluation_outputs)||void 0===Pe?void 0:Pe.metadata)||void 0===ke?void 0:ke.label_color)&&void 0!==Oe?Oe:A),Pt=u(ft);a(function(){Pt.current=ft},[ft]);var kt=u(vi);a(function(){kt.current=vi},[vi]);var Ot=s(function(e,n,i,t,o,r){return zo.current(e,n,i,t,o,r)},[]),Lt=s(function(e,n,i,t,o){return qo.current(e,n,i,t,o)},[]),jt=s(function(){return Vo.current()},[]),Nt=s(function(e,n){return Wo.current(e,n)},[]),Ht=s(function(e){return Ko.current(e)},[]),zt=s(function(e){return Jo.current(e)},[]),Mt=s(function(){return Yo.current()},[]),qt=s(function(){var e,n;vt(),null===(e=Pt.current)||void 0===e||e.call(Pt),wn(!1),Sn(new Set),yn([]),Pn.current=[],uo([]),ao(null),li(D),null===(n=kt.current)||void 0===n||n.call(kt),requestAnimationFrame(function(){var e;null===(e=kn.current)||void 0===e||e.call(kn)})},[]),Vt=u(qt);a(function(){Vt.current=qt},[qt]),a(function(){Ve&&Vt.current()},[Ve]);var Wt=c(function(){return{documents:null==Ne?void 0:Ne.documents,input_index_map:null==Ne?void 0:Ne.input_index_map}},[JSON.stringify(null==Ne?void 0:Ne.documents),JSON.stringify(null==Ne?void 0:Ne.input_index_map)]),Kt=u(Ne);a(function(){Kt.current=Ne},[Ne]);var Jt=u(Hn);a(function(){Jt.current=Hn},[Hn]);var Yt=s(function(n,i,t,o,r,l,u){var c,a,s,d,v,f,p,g,m,h,S=R(null==i?void 0:i.id)||R(null==t?void 0:t.id)||"",x=(S?null===(c=Jt.current)||void 0===c?void 0:c[S]:null)||(null==i?void 0:i.cognitiveData)||(null==t?void 0:t.cognitiveData)||{section_id:S,decisioning:[],gap:[],relevance_score:0},y=null!==(s=null===(a=Yi.current[o])||void 0===a?void 0:a.current)&&void 0!==s?s:null,b=function(){var n,r,l=(null==i?void 0:i.evaluationResult)||(null==t?void 0:t.evaluationResult)||null,u=function(n){var i=function(e){if(!e||"object"!=typeof e)return null;var n=null==e?void 0:e.deviation_entries;if(n&&"object"==typeof n){var i=Object.keys(n).sort(function(e,n){return Number(e)-Number(n)})[0];if(i&&n[i])return n[i]}var t=Object.keys(e).filter(function(e){return/^\d+$/.test(e)}).sort(function(e,n){return Number(e)-Number(n)});if(t.length&&e[t[0]])return e[t[0]];var o=null==e?void 0:e.deviations;if(o&&"object"==typeof o){var r=Object.keys(o).sort(function(e,n){return Number(e)-Number(n)})[0];if(r&&o[r])return o[r]}return null}(n);return i?e(e({},n),{deviation_summary:(null==n?void 0:n.deviation_summary)||(null==i?void 0:i.deviation_summary),deviation_title:(null==n?void 0:n.deviation_title)||(null==i?void 0:i.deviation_title),deviation_impact:(null==n?void 0:n.deviation_impact)||(null==i?void 0:i.deviation_impact),deviation_explanation:(null==n?void 0:n.deviation_explanation)||(null==i?void 0:i.deviation_explanation),evaluation_outputs:(null==n?void 0:n.evaluation_outputs)||(null==i?void 0:i.evaluation_outputs),cognitive_decisioning:(null==n?void 0:n.cognitive_decisioning)||(null==i?void 0:i.cognitive_decisioning)}):n};if(!("string"==typeof o&&o.includes(C)))return u(l);var c=o.split(C)[1];if(!c)return l;var a=(null==i?void 0:i.evaluationResult)||(null==t?void 0:t.evaluationResult)||{},s=(null===(n=null==a?void 0:a.deviation_entries)||void 0===n?void 0:n[c])||(null===(r=null==a?void 0:a.deviations)||void 0===r?void 0:r[c])||null;return s?e(e(e({},a),s),{deviation_summary:(null==s?void 0:s.deviation_summary)||(null==a?void 0:a.deviation_summary),deviation_title:(null==s?void 0:s.deviation_title)||(null==a?void 0:a.deviation_title),deviation_impact:(null==s?void 0:s.deviation_impact)||(null==a?void 0:a.deviation_impact),deviation_explanation:(null==s?void 0:s.deviation_explanation)||(null==a?void 0:a.deviation_explanation),evaluation_outputs:(null==s?void 0:s.evaluation_outputs)||(null==a?void 0:a.evaluation_outputs),cognitive_decisioning:(null==s?void 0:s.cognitive_decisioning)||(null==a?void 0:a.cognitive_decisioning)}):u(l)}(),w=(null!==(f=null===(v=null===(d=null==b?void 0:b.cognitive_decisioning)||void 0===d?void 0:d.decisioning_factors)||void 0===v?void 0:v.length)&&void 0!==f?f:0)>0||(null!==(m=null===(g=null===(p=null==b?void 0:b.cognitive_decisioning)||void 0===p?void 0:p.gaps_in_decision)||void 0===g?void 0:g.length)&&void 0!==m?m:0)>0;return{isLoading:null!==(h=null==Ke?void 0:Ke.isLoading)&&void 0!==h&&h&&!w,open:!0,sectionTitle:(null==i?void 0:i.title)?null==i?void 0:i.title:"No Counterpart",refSectionTitle:(null==t?void 0:t.title)?null==t?void 0:t.title:"No Counterpart",cognitiveData:x,anchorEl:n,sectionAnchorEl:y,badgeStyle:l||null,sectionIdx:o,docData:Wt,deviationData:b,isOrphan:!!r}},[Wt,null==Ke?void 0:Ke.isLoading]),Xt=s(function(e,n,i,t,o,r){var l;if(e.stopPropagation(),ei.open&&ei.sectionIdx===o)fi();else{var u=e.currentTarget,c="left";(null===(l=Vn.current)||void 0===l?void 0:l.contains(u))&&(c="right");vt(),ut.current&&ft(),Sn(new Set),yn([]),Pn.current=[],vi(),ri.open?yo():ui(),requestAnimationFrame(function(){var e=function(){var e,n,i,t;if("string"==typeof o&&o.includes(C)){var r=o.split(C),l="".concat(r[0]).concat(C).concat(r[1]);return"right"===c?null===(e=Vi.current[l])||void 0===e?void 0:e.current:null===(n=qi.current[l])||void 0===n?void 0:n.current}return"right"===c?null===(i=Vi.current[o])||void 0===i?void 0:i.current:null===(t=qi.current[o])||void 0===t?void 0:t.current}()||u;ni(Yt(e,n,t,o,i,r))})}},[ei.open,ei.sectionIdx,fi,ui,Yt]),$t=s(function(){var e=ei.sectionIdx;ei.isOrphan,fi(),ui(),null!==e&&(bt(e),vt(),ut.current&&ft(),yn([]),Pn.current=[],Sn(function(n){return n.has(e)?new Set:new Set([e])}),setTimeout(function(){kn.current&&kn.current()},50))},[ei.sectionIdx,ei.isOrphan,fi,ui,ft]),Ut=s(function(){var e=In.current;if(e){In.current=null;var n=Ei.findIndex(function(n){return n.id===e}),i=Ii.findIndex(function(n){return n.id===e}),t=-1===n?b(Ei,e):null,o=-1===i?b(Ii,e):null,r=-1!==n?n:t?Number(t.split("-")[0]):-1,l=-1!==i?i:o?Number(o.split("-")[0]):-1,u=function(e,n,i,t){var o,r,l,u;return-1!==e?null!==(r=null===(o=i.current[e])||void 0===o?void 0:o.current)&&void 0!==r?r:null:n&&null!==(u=null===(l=t.current[n])||void 0===l?void 0:l.current)&&void 0!==u?u:null},c=function(e,n,i){void 0===i&&(i=30);var t=0,o=function(){var r=e();r&&0!==r.getBoundingClientRect().height?(dt.current.add(r),_(r,n)):t++<i&&requestAnimationFrame(o)};requestAnimationFrame(o)};if(on)-1!==r&&Xn.current&&c(function(){return u(n,t,zi,Ki)},Xn.current),-1!==l&&Vn.current&&c(function(){return u(i,o,Mi,Ji)},Vn.current);else{var a=Mn.current;if(!a)return;c(function(){return-1!==r?u(n,t,zi,Ki):u(i,o,Mi,Ji)},a)}}},[Ei,Ii,on,zi,Mi,Ki,Ji,Xn,Vn,Mn]),Gt=s(function(n){if(n){vt(),ft(),Sn(new Set),yn([]),Pn.current=[],ui(),vi();var i=Ei.findIndex(function(e){return e.id===n}),t=Ii.findIndex(function(e){return e.id===n}),o=-1===i?b(Ei,n):null,r=-1===t?b(Ii,n):null;if(-1!==i||o||-1!==t||r){var l=-1!==i?i:o?Number(o.split("-")[0]):-1,u=-1!==t?t:r?Number(r.split("-")[0]):-1;In.current=n,ht(function(n){var i,t=e({},n),o=!1;-1!==l&&(t[i=on?"left-".concat(l):String(l)]||(t[i]=!0,o=!0));-1!==u&&(t[i=on?"right-".concat(u):String(u)]||(t[i]=!0,o=!0));return o?t:n}),Rt(function(n){var i=e({},n),t=!1,l=function(e){for(var n=e.split("-"),o=n[0],r=1;r<n.length;r++)o+="-".concat(n[r]),i[o]||(i[o]=!0,t=!0)};return o&&l(o),r&&l(r),t?i:n}),setTimeout(function(){requestAnimationFrame(function(){In.current===n&&Qt.current()})},50)}else console.warn('scrollToAndHighlightClause: nodeId "'.concat(n,'" not found'))}},[Ei,Ii,on,ht,Rt,ft,ui,vi]),Qt=u(Ut);a(function(){Qt.current=Ut},[Ut]);var Zt=u(null);a(function(){if(mi){var e=pi.fields.find(function(e){return e.analysisKey===mi||e.key===mi});if(e){var n=Ni.current[e.key]||Hi.current[e.key];(null==n?void 0:n.current)&&setTimeout(function(){return n.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[mi,pi.fields]);var eo=s(function(e){var n,i,t,o,r,l,u,c,a,s=null===(n=null==Bt?void 0:Bt.rule_difference_comparison)||void 0===n?void 0:n.fields;if(!s||!s[e])return{score:0,relation:"",highlightsA:[],highlightsB:[],hasContent:!1};var d=s[e],v=(null==d?void 0:d.relation)||(null===(t=null===(i=null==d?void 0:d.highlights)||void 0===i?void 0:i.ruleA_spans)||void 0===t?void 0:t.length)||(null===(r=null===(o=null==d?void 0:d.highlights)||void 0===o?void 0:o.ruleB_spans)||void 0===r?void 0:r.length)||(null==d?void 0:d.mappings)&&d.mappings.length>0;if(d.mappings){var f=d.mappings[0]||{};return{score:d.score,relation:f.relation||"",highlightsA:(null===(l=f.highlights)||void 0===l?void 0:l.ruleA_spans)||[],highlightsB:(null===(u=f.highlights)||void 0===u?void 0:u.ruleB_spans)||[],hasContent:!!v}}return{score:d.score,relation:d.relation||"",highlightsA:(null===(c=d.highlights)||void 0===c?void 0:c.ruleA_spans)||[],highlightsB:(null===(a=d.highlights)||void 0===a?void 0:a.ruleB_spans)||[],hasContent:!!v}},[Bt]),no=$({proposedSections:Ei,existingSections:Ii,maintainRelativeOrder:on,cognitiveMap:Hn,deviationData:Nn,treeData:Ne,resolvedComparisonConfig:pi}),io=no.getSectionCompareStyle,to=no.getSubSectionCompareStyle,oo=no.getDeviationStyleByKey,ro=G({containerRef:Bn,leftContainerRef:Xn,rightContainerRef:Vn,svgContainerRef:_n,pathRefs:Dn,leftHeaderRef:Fn,rightHeaderRef:En,proposedSections:Ei,existingSections:Ii,visibleFields:Ti,leftRefs:Ni,rightRefs:Hi,sectionLeftRefs:zi,sectionRightRefs:Mi,subSectionLeftRefs:Ki,subSectionRightRefs:Ji,lhsBadgeRefs:qi,rhsBadgeRefs:Vi,sectionRowRefs:Yi,expandedSections:mt,expandedSubSections:St,connectedSections:hn,isSideBySide:Qi,activeSideBySideSection:ot,maintainRelativeOrder:on,cognitiveMap:Hn,getSectionCompareStyle:io,getSubSectionCompareStyle:to,getDeviationStyleByKey:oo,isArrowVisible:Zi,isAnimatingRef:Tn,isSideBySideRef:ut,sideBySideCacheRef:lt,sideBySideLineRef:st,activeSideBySideSectionRef:at,activeSideBySideRightSectionRef:ct,connectedLines:xn,setConnectedLines:yn,cachedConnectedPositions:Pn,calculateLinesRef:kn,resizeTimerRef:On,scrollLock:rt,scrollSyncLocked:Cn,handleResizeRef:Ln,activeProposed:Bi,existingRule:Fi,analysisData:Bt,pendingScrollTargetRef:$n,pendingScrollCallbackRef:Un,resolvedComparisonConfig:pi,getFieldData:eo}),lo=ro.lines,uo=ro.setLines,co=ro.overallConnector,ao=ro.setOverallConnector,so=ro.svgDimensions,vo=ro.handleColumnScroll;a(function(){ri.anchorEl&&requestAnimationFrame(function(){requestAnimationFrame(function(){var e;null===(e=kn.current)||void 0===e||e.call(kn)})})},[ri.anchorEl,Cn]);var fo=s(function(){vt(),wn(!1),ht({}),Rt({}),ft(),Sn(new Set),yn([]),Pn.current=[],ui(),vi(),fi(),requestAnimationFrame(function(){kn.current&&kn.current()})},[ht,Rt,ft,ui,vi,fi]);a(function(){Qi||0!==hn.size||wn(!1)},[Qi,hn]);var po=c(function(){return Object.values(mt).some(Boolean)||Object.values(St).some(Boolean)},[mt,St]),go=u(null),mo=u(0),ho=u(0),So=u(0),Ro=U({timerRef:go,ruleComponentRef:qn,scrollContainerRef:Mn,containerRef:Bn,maintainRelativeOrder:on,proposedSections:Ei,existingSections:Ii,isSideBySideRef:ut,activeSideBySideSectionRef:at,activeSideBySideRightSectionRef:ct,sectionRowRefs:Yi,sectionRightRowRefs:Wi,sectionLeftRefs:zi,sectionRightRefs:Mi,subSectionLeftRefs:Ki,subSectionRightRefs:Ji,lhsBadgeRefs:qi,rhsBadgeRefs:Vi,leftContainerRef:Xn,rightContainerRef:Vn,calculateLinesRef:kn,handleResizeRef:Ln,setIsResizing:it,setIsArrowVisible:et,sideBySideCacheRef:lt,cachedConnectedPositions:Pn}).handleResize;a(function(){Ln.current=Ro},[Ro,Ln]),a(function(){var e=function(e,n,i,t,o){n.current=e.getBoundingClientRect().width;var r=new ResizeObserver(function(e){null!==i.current&&cancelAnimationFrame(i.current),i.current=requestAnimationFrame(function(){var r,l,u;i.current=null;var c=e[e.length-1];if(c){var a=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(a-n.current)<1?o():(n.current=a,t())}})});return r.observe(e),r},n={current:null},i={current:null},t={current:null},o=[],r=[n,i,t];return qn.current&&o.push(e(qn.current,mo,n,function(){return Ln.current()},function(){})),Mn.current&&o.push(e(Mn.current,ho,i,function(){return Ln.current()},function(){return kn.current()})),Bn.current&&o.push(e(Bn.current,So,t,function(){return Ln.current()},function(){return kn.current()})),function(){o.forEach(function(e){return e.disconnect()}),r.forEach(function(e){null!==e.current&&(cancelAnimationFrame(e.current),e.current=null)})}},[]),a(function(){ut.current=Qi},[Qi]),a(function(){at.current=ot},[ot]);var xo=s(function(){var e,n=ei.sectionIdx,i=ei.isOrphan;if(ui(),null!=n){var t="left";ei.anchorEl&&(null===(e=Vn.current)||void 0===e?void 0:e.contains(ei.anchorEl))&&(t="right"),bt(n),pt(n,i,{sourceSide:t})}},[pt,ei.isOrphan,ei.sectionIdx,ei.anchorEl,ui]),yo=s(function(){ui(),ft(),Sn(new Set),yn([]),Pn.current=[]},[ui,ft]),bo=null!==ei.sectionIdx&&hn.has(ei.sectionIdx),Co=q({proposedSections:Ei,existingSections:Ii,parentDeviationRecord:Ai,expandedSections:mt,maintainRelativeOrder:!!on,scrollContainerRef:Mn,leftContainerRef:Xn,rightContainerRef:Vn,lhsBadgeRefs:qi,rhsBadgeRefs:Vi}),wo=Co.showDeviationNavigation,_o=Co.showOpenNodeRef,Bo=Co.adjustScrollForPopup,Fo=s(function(e,n,i,t,o){var r,l="string"==typeof t?R(t).trim():R(null==t?void 0:t.deviation_summary).trim(),u=e.currentTarget;vi();var c="left";(null===(r=Vn.current)||void 0===r?void 0:r.contains(u))&&(c="right");var a=function(){var e,i,t,o;if("string"==typeof n&&n.includes(C)){var r=n.split(C),l="".concat(r[0]).concat(C).concat(r[1]);return"right"===c?null===(e=Vi.current[l])||void 0===e?void 0:e.current:null===(i=qi.current[l])||void 0===i?void 0:i.current}return"right"===c?null===(t=Vi.current[n])||void 0===t?void 0:t.current:null===(o=qi.current[n])||void 0===o?void 0:o.current};if(i)return ft(),Sn(new Set),yn([]),Pn.current=[],void(l&&(bt(n),requestAnimationFrame(function(){var e=a()||u;e&&(e.getBoundingClientRect().top>.8*window.innerHeight&&e.scrollIntoView({behavior:"smooth",block:"center"}));li({open:!0,anchorEl:e,summary:t,displayImpact:o})})));bt(n),l?setTimeout(function(){pt(n,i,{toggleIfSame:!1,sourceSide:c,onReady:function(){var e,n,i,r=a()||u;if(r){var l=r.getBoundingClientRect();if(l.top>.8*window.innerHeight||l.top<100){var c=l.top-window.innerHeight/2;on?(null===(e=Xn.current)||void 0===e||e.scrollBy({top:c,behavior:"smooth"}),null===(n=Vn.current)||void 0===n||n.scrollBy({top:c,behavior:"smooth"})):null===(i=Mn.current)||void 0===i||i.scrollBy({top:c,behavior:"smooth"})}}li({open:!0,anchorEl:r,summary:t,displayImpact:o})}})},350):setTimeout(function(){pt(n,i,{toggleIfSame:!1,sourceSide:c})},350)},[pt,vi,li,ft,bt]),Eo=c(function(){var e;if(!Ue)return null;var n=null===(e=null==Ue?void 0:Ue.id)||void 0===e?void 0:e.split(":")[0];for(var i in Ai){if((Ai[i]||[]).some(function(e){return e.id===n}))return i}return null},[Ue,Ai]),Io=u({id:null,triggerMs:null}),To=u(null);a(function(){if(null==Ue?void 0:Ue.id){var o=Number(Ue.trigger),r=Io.current;if((null==r?void 0:r.triggerMs)!==o){if(!(Ue.id.includes(":")&&/:\d+$/.test(Ue.id)))return Io.current={id:Ue.id,triggerMs:o},void Gt(Ue.id);var l=Ue.id.split(":"),u=l[0],c=l[1],a=null!=c?c:"0";To.current!==Ue.id&&(ui(),vi(),ft(),Sn(new Set),yn([]),Pn.current=[],To.current=Ue.id);var s=!1,d=0,v=null,f=null,p=!1,g=function(e,n){for(var i=function(e,t){if(!e)return null;if(e.id===n)return t;if(!Array.isArray(e.subsections))return null;for(var o=0;o<e.subsections.length;o++){var r=i(e.subsections[o],"".concat(t,"-").concat(o));if(r)return r}return null},t=0;t<e.length;t++){var o=i(e[t],String(t));if(o)return o}return null},m=function(){var r,l,c,h;if(!s){var S=function(){Io.current={id:Ue.id,triggerMs:o}},R=null,x=null;for(var y in Ai){var b=Ai[y].find(function(e){return e.id===u});if(b){R=y,x=b;break}}if(x&&R){var w=Ei.findIndex(function(e){return e.id===R}),_=Ii.findIndex(function(e){return e.id===R}),E=-1===w&&-1!==_,I=g(Ei,x.id),T=g(Ii,x.id);if(I&&!T&&!E){var A=I.split("-"),D=Number(A[0]);if(on){var P=null===(l=null===(r=Ei[D])||void 0===r?void 0:r.refIndexes)||void 0===l?void 0:l[0],k=Ii.findIndex(function(e){return e.selfIndex===P});-1!==k&&(D=k)}T=n([D],A.slice(1),!0).join("-")}if(I||T){var O=I?Number(I.split("-")[0]):w,L=T?Number(T.split("-")[0]):_,j=L>=0?L:T?Number(T.split("-")[0]):-1,N=Ei[O],H=Ii[j],z=N&&!N.title&&!N.content,M=H&&!H.title&&!H.content,q=E||(!I&&!!T||z&&!M);if(q){if(!(on?!!Mo.current["right-".concat(L)]:!!Mo.current[String(L)])&&L>=0)return yt(L,"right"),void(v=setTimeout(m,200))}else if(!(on?!!Mo.current["left-".concat(O)]:!!Mo.current[String(O)])&&O>=0)return yt(O,"left"),void(v=setTimeout(m,200));var V=I||"",W=T||"",K="".concat(x.id).concat(C).concat(a).concat(C).concat(V).concat(C).concat(W),J="".concat(x.id).concat(C).concat(a);if(!p){bt(K),p=!0,d=0;var Y=function(){var e,n,i=null===(e=qi.current[J])||void 0===e?void 0:e.current,t=null===(n=Vi.current[J])||void 0===n?void 0:n.current;return q||!i&&!!t?t:i};return null==f||f(),void(v=setTimeout(function(){var e,n,i,t,o,r,l;s||(e=Y,n=function(){s||(f=null,m())},t=0,o=null,r=null,l=function(){if(!s){var u=e();if(u&&0!==u.getBoundingClientRect().height){var c=u.getBoundingClientRect(),a=c.top,d=c.height,v=null!==o&&Math.abs(a-o)<.5,f=null!==r&&Math.abs(d-r)<.5;if(v&&f){if(++t>=5)return void n()}else t=0;o=a,r=d,i=requestAnimationFrame(l)}else i=requestAnimationFrame(l)}},i=requestAnimationFrame(l),f=function(){return cancelAnimationFrame(i)})},300))}var X=null===(c=qi.current[J])||void 0===c?void 0:c.current,$=null===(h=Vi.current[J])||void 0===h?void 0:h.current;if(X||$){var U=q||!X&&!!$,G=U?$:X,Q=on?U?Vn.current:Xn.current:Mn.current;if(G&&Q){var Z=G.getBoundingClientRect();if(0!==Z.height){var ee=Q.getBoundingClientRect(),ne=Z.top-ee.top+Q.scrollTop-ee.height/2+Z.height/2,ie=(null==I?void 0:I.includes("-"))||(null==T?void 0:T.includes("-")),te=function(){return i(void 0,void 0,void 0,function(){var n,i,o,r,l,u,c,d,v,f;return t(this,function(t){switch(t.label){case 0:return s?[2]:(S(),n=G instanceof Element?window.getComputedStyle(G).color:"",[X,$].forEach(function(e){e&&(e.style.transition="box-shadow 300ms ease-in-out",e.style.boxShadow="0 0 10px ".concat(n))}),setTimeout(function(){[X,$].forEach(function(e){e&&(e.style.boxShadow="")})},2e3),i=(null===(c=null===(u=x.evaluationResult)||void 0===u?void 0:u.deviations)||void 0===c?void 0:c[a])||x,o=(null===(d=x.evaluationResult)||void 0===d?void 0:d.evaluation_outputs)||x.evaluation_outputs,!!X&&!!$?(l=function(e,n){return Promise.race([e,new Promise(function(e){return setTimeout(e,n)})])},on?[4,Promise.all([Xn.current?l(F(Xn.current),600):Promise.resolve(),Vn.current?l(F(Vn.current),600):Promise.resolve()])]:[3,2]):(r=U?(null===(v=Vi.current[ie?J:L])||void 0===v?void 0:v.current)||$:(null===(f=qi.current[ie?J:O])||void 0===f?void 0:f.current)||X,Bo(r,function(){li({open:!0,anchorEl:r,displayImpact:Ue.displayImpact,summary:e(e({},i),{evaluation_outputs:o})})},{skipScroll:!0}),null==Ge||Ge(),[2]));case 1:t.sent(),t.label=2;case 2:return pt(K,!1,{toggleIfSame:!1,sourceSide:E?"right":"left",onReady:function(){var n,t;S();var o=U?(null===(n=Vi.current[J])||void 0===n?void 0:n.current)||$:(null===(t=qi.current[J])||void 0===t?void 0:t.current)||X;o&&o.scrollIntoView({behavior:"smooth",block:"center"}),li({open:!0,anchorEl:o,displayImpact:Ue.displayImpact,summary:e({},i)}),null==Ge||Ge()}}),[2]}})})};Math.abs(Q.scrollTop-ne)<=2?te():B(Q,ne,te)}else++d<2?v=setTimeout(m,100):S()}else++d<2?v=setTimeout(m,100):S()}else++d<2?v=setTimeout(m,100):S()}else++d<2?v=setTimeout(m,100):S()}else++d<2?v=setTimeout(m,100):S()}};return v=setTimeout(m,100),function(){s=!0,v&&clearTimeout(v),null==f||f()}}}},[Ue,Ai,Ei,Ii,on,mt,pt,li,Gt]),a(function(){var n,i,t;if(ri.open){var o=ri.anchorEl;if(o&&!o.isConnected){var r=function(e){for(var n,i=0,t=Object.entries(e);i<t.length;i++){var r=t[i],l=r[0];if((null===(n=r[1].current)||void 0===n?void 0:n.textContent)===o.textContent)return l}return null},l=(null===(n=o.dataset)||void 0===n?void 0:n.deviationRefId)||r(qi.current)||r(Vi.current);if(l){var u=(null===(i=Vi.current[l])||void 0===i?void 0:i.current)||(null===(t=qi.current[l])||void 0===t?void 0:t.current);u&&u.isConnected&&li(function(n){return e(e({},n),{anchorEl:u})})}}}},[ri.open,ri.anchorEl,Cn,hn,mt]);var Ao=Qn.open,Do=Qn.sectionIdx,Po=Qn.isOrphan,ko=Qn.badgeStyle,Oo=Qn.anchorEl,Lo=Qn.sectionAnchorEl;a(function(){var n;if(Ao&&null!=Do&&Do!==It){var i="string"==typeof Do?Do.split(C)[0]:null,t=function(e,n){var i;if(!e||!Array.isArray(e))return null;for(var o=0,r=e;o<r.length;o++){var l=r[o];if(l.id===n)return l;if(null===(i=l.subsections)||void 0===i?void 0:i.length){var u=t(l.subsections,n);if(u)return u}}return null},o=i&&"string"==typeof i?t(Ei,i):null,r=i&&"string"==typeof i?t(Ii,i):null,l="number"==typeof Do?Ei[Do]||null:o||i&&((null===(n=null==Ne?void 0:Ne.nodes)||void 0===n?void 0:n[i])||(null==Ne?void 0:Ne[i]))||null,u="number"==typeof Do?Ii[Do]||null:r,c=Yt(Oo,l,u,Do,Po,ko);Zn(function(n){return n.open?R(n.cognitiveData)===R(c.cognitiveData)&&R(n.deviationData)===R(c.deviationData)&&n.sectionTitle===c.sectionTitle&&n.refSectionTitle===c.refSectionTitle?n:e(e(e({},n),c),{open:!0,anchorEl:n.anchorEl,sectionAnchorEl:n.sectionAnchorEl}):n})}},[Ao,Do,Po,ko,Oo,Lo,Ei,Ii,Yt]);var jo=s(function(e){var n=e.section,i=e.keyPath,t=e.depth,r=void 0===t?0:t,l=e.columnKey,u=void 0===l?"left":l,c=e.parentNodeId,a=void 0===c?"":c,s=e.sectionOffset;return o(W,{section:n,keyPath:i,depth:r,columnKey:u,parentNodeId:a,sectionOffset:s})},[]),No=c(function(){return Ei.map(function(e,n){var i,t=!(null==e?void 0:e.title)&&!(null==e?void 0:e.content),r=!(null==e?void 0:e.refIndexes)||0===e.refIndexes.length;return t&&r&&on?null:o(K,{section:e,idx:n},null!==(i=null==e?void 0:e.id)&&void 0!==i?i:"left-row-".concat(n))})},[Ei]),Ho=c(function(){return Ii.map(function(e,n){var i,t=!(null==e?void 0:e.title)&&!(null==e?void 0:e.content),r=!(null==e?void 0:e.refIndexes)||0===e.refIndexes.length;return t&&r&&on?null:o(J,{section:e,idx:n},null!==(i=null==e?void 0:e.id)&&void 0!==i?i:"right-row-".concat(n))})},[Ii]),zo=u(Xt);a(function(){zo.current=Xt},[Xt]);var Mo=u(mt);a(function(){Mo.current=mt},[mt]);var qo=u(Fo);a(function(){qo.current=Fo},[Fo]);var Vo=u(yo);a(function(){Vo.current=yo},[yo]);var Wo=u(yt);a(function(){Wo.current=yt},[yt]);var Ko=u(xt);a(function(){Ko.current=xt},[xt]);var Jo=u(jo);a(function(){Jo.current=jo},[jo]);var Yo=u(ft);a(function(){Yo.current=ft},[ft]);var Xo=c(function(){return{maintainRelativeOrder:!!on,showDeviationBadges:cn,isProposingFix:Ze,proposingFixNodeId:en,isRedlineFlow:nn,isSideBySide:Qi,activeSideBySideSection:ot,scrollSyncLocked:Cn,toggleScrollSyncLocked:wt,summaryPopupAnchorEl:ri.anchorEl,connectedSections:hn,proposedSections:Ei,existingSections:Ii,deviationNumberRegistry:Di,deviationParentRegistry:Pi,treeData:Ne,displayConfig:Ke,resolvedMarkdownStyles:zn,unifiedNumbering:_t,expandedSections:mt,expandedSubSections:St,setExpandedSubSections:Rt,getSectionCompareStyle:io,getSubSectionCompareStyle:to,getBadgeRef:Ui,getSectionRowRef:Xi,getSubSectionRef:$i,sectionLeftRefs:zi,sectionRightRefs:Mi,sectionRowRefs:Yi,sectionRightRowRefs:Wi,subSectionLeftRefs:Ki,subSectionRightRefs:Ji,lhsBadgeRefs:qi,rhsBadgeRefs:Vi,openMoreFunctionsPopup:Ot,handleOpenSummaryPopup:Lt,openSummaryPopup:Lt,handleCloseSummaryPopup:jt,toggleSection:Nt,handleSubSectionToggle:Ht,renderSubSectionAccordion:zt,resetSideBySide:Mt,setConnectedSections:Sn,setConnectedLines:yn,cachedConnectedPositions:Pn,showDeviationNavigation:wo,showOpenNodeRef:_o,deviationNodeIdToView:null==Ue?void 0:Ue.id,deviationTargetParentId:Eo}},[on,cn,Ze,en,nn,Qi,ot,Cn,wt,ri.anchorEl,hn,Ei,Ii,Di,Ke,zn,_t,mt,St,Rt,io,to,Ui,Xi,$i,wo,_o,Ue,Eo]);return o(X,e({value:Xo},{children:r(d,e({ref:qn,sx:{display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif',overflow:"visible",position:"relative"}},{children:[sn&&o(d,e({sx:{position:"absolute",inset:0,bgcolor:"rgba(255, 255, 255, 0.6)",backdropFilter:"blur(10px)",zIndex:9999,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"8px"}},{children:o(L,{})})),ri.open&&o(Y,{open:ri.open,anchorEl:ri.anchorEl,containerEl:Zt.current,clipTopEl:Fn.current,scrollContainerEl:Mn.current,onClose:yo,summary:ri.summary,displayImpact:ri.displayImpact,isScrollLocked:Cn}),o(O,{open:ei.open,anchorEl:ei.anchorEl,maintainRelativeOrder:!!on,sectionTitle:ei.sectionTitle,referenceSectionTitle:ei.refSectionTitle,onClose:fi,onOpenCognitiveCompare:si,onOpenSideBySide:xo,onConnect:$t,isConnected:bo,isOrphan:ei.isOrphan}),Qn.open&&o(k,{open:Qn.open,popupRef:ai,position:ii,popupConfig:Ye,onClose:function(){ti(null),Zn(function(n){return e(e({},n),{open:!1})}),ci(null)},markdownStyles:qe,sectionTitle:yi,referenceSectionTitle:Ci,cognitiveData:Qn.cognitiveData,anchorEl:Qn.anchorEl,sectionAnchorEl:Qn.sectionAnchorEl,scrollContainerEl:Mn.current,badgeStyle:Qn.badgeStyle,docData:Qn.docData,deviationData:Qn.deviationData,isLoading:Qn.isLoading}),o(v,e({open:!!fn,autoHideDuration:8e3,onClose:function(){return pn(null)},anchorOrigin:{vertical:"top",horizontal:"center"}},{children:o(f,e({onClose:function(){return pn(null)},severity:"error",sx:{width:"100%",whiteSpace:"pre-line"}},{children:fn}))})),o(V,{componentHeaderText:je,displayConfig:Ke,maintainRelativeOrder:on,onCollapseAll:fo,showCollapseAll:po,onToggleView:function(e){dn(!0),setTimeout(function(){rn(!e),null==Je||Je(!e),wn(!1),ft(),ui(),Sn(new Set),yn([]),Pn.current=[],requestAnimationFrame(function(){requestAnimationFrame(function(){setTimeout(function(){dn(!1)},600)})})},50)}}),o(d,e({ref:Mn,onScroll:vo,sx:{flex:1,minHeight:0,pt:1.5,pb:1,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",overflowY:on?"visible":"auto",borderTop:Ft&&Et?"none":"1.5px solid #EEF0F4"}},{children:o(d,e({sx:e({display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"},on?{flex:1}:{})},{children:r(d,e({ref:Bn,sx:e({display:"grid",gridTemplateColumns:"minmax(0, 1fr) 180px minmax(0, 1fr)",gap:"60px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0},on?{flex:1,overflow:"visible"}:{})},{children:[o(Z,{svgContainerRef:_n,svgDimensions:so,isResizing:nt,overallConnector:co,rootDeviationStyle:Dt,lines:lo,isSideBySide:Qi,activeSideBySideSection:ot,isArrowVisible:Zi,maintainRelativeOrder:on,proposedSections:Ei,existingSections:Ii,cognitivePopup:Qn,activeBadgeId:oi,closeCognitivePopup:vi,setActiveBadgeId:ci,openCognitivePopupFromState:di,buildSectionPopupState:Yt,connectedLines:xn,pathRefs:Dn}),r(d,e({sx:e({border:"1px solid #E7E7E9",borderRadius:"8px",bgcolor:"#FFFFFF",display:"flex",flexDirection:"column",position:"relative",zIndex:2,filter:"drop-shadow(0px 2px 4px #F2F2F2)"},on?{flex:1,overflow:"visible"}:{})},{children:[o(d,e({ref:Fn,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E7E7E9",borderRadius:"8px 8px 0 0",display:"flex",alignItems:"center",minHeight:"40px",overflow:"hidden",minWidth:0}},{children:o(p,e({title:Ri,placement:"top"},{children:o(g,e({sx:{fontSize:"16px",fontWeight:500,color:"#19213D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0,textAlign:"center",display:"block"}},{children:Ri}))}))})),r(d,e({ref:Xn,onScroll:vo,sx:e({p:"12px",display:"flex",flexDirection:"column"},on?{maxHeight:"calc(100vh - 250px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,mr:"-180px",pr:"192px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[o("div",{ref:Jn,style:{width:"100%",height:"0px",flexShrink:0}}),Oi&&No,o("div",{ref:Yn,style:{width:"100%",height:"0px",flexShrink:0}})]}))]})),o(d,e({ref:Zt,sx:{width:"180px",display:"flex",flexDirection:"column",alignItems:"center",pt:"15px",gap:0,zIndex:20,pointerEvents:"none"}},{children:o(d,e({sx:{display:"flex",justifyContent:"center",alignItems:"center",mt:0}},{children:r(d,e({onClick:function(n){n.stopPropagation(),Qn.open&&oi===It?vi():(ci(It),di(Yt(n.currentTarget,{title:"",content:"",evaluationResult:Tt,cognitiveData:{section_id:"",decisioning:[],gap:[],relevance_score:0,isMissingRationale:!0}},null,It,!0,e(e({},Dt),{label:""}))))},sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:"5px",top:"-8px",borderRadius:"20px",bgcolor:Dt.badgeBg,color:Dt.badgeText,border:"1px solid ".concat(Dt.badgeBorder),fontSize:"12px",fontWeight:600,whiteSpace:"nowrap",position:"relative",zIndex:1,pointerEvents:"auto",cursor:"pointer"}},{children:[null!=At?At:o(j,{}),o(d,e({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:o(h,{})})),o(m,{size:11,style:{transform:Qn.open&&oi===It?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))})),r(d,e({sx:e({border:"1px solid #E3E6EA",borderRadius:"8px",bgcolor:"#FFFFFF",boxShadow:"0px 1px 4px #F7F4FE",position:"relative",zIndex:2,display:"flex",flexDirection:"column",minWidth:0},on?{flex:1,overflow:"visible",minHeight:0}:{})},{children:[tt&&o(S,{sections:11}),o(d,e({ref:En,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E3E6EA",borderRadius:"8px 8px 0 0",minHeight:"40px",display:"flex",alignItems:"center",overflowX:"hidden"}},{children:o(p,e({title:wi,placement:"top"},{children:o(g,e({sx:{fontSize:"16px",fontWeight:500,color:"#5928ED",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0,textAlign:"center",display:"block"}},{children:wi}))}))})),r(d,e({ref:Vn,onScroll:vo,sx:e({p:"12px",display:"flex",flexDirection:"column"},on?{maxHeight:"calc(100vh - 250px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,ml:"-150px",pl:"165px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[o("div",{ref:Wn,style:{width:"100%",height:"0px",flexShrink:0}}),Oi&&Ho,o("div",{ref:Kn,style:{width:"100%",height:"0px",flexShrink:0}})]}))]}))]}))}))}))]}))}))};export{ee as default};
|
|
1
|
+
import{__assign as e,__spreadArray as n,__awaiter as i,__generator as t}from"tslib";import{jsx as o,jsxs as r}from"react/jsx-runtime";import{useState as l,useRef as u,useMemo as c,useEffect as a,useCallback as s}from"react";import{Box as d,Snackbar as v,Alert as f,Tooltip as p,Typography as g}from"@mui/material";import{ChevronDown as h}from"lucide-react";import{ButtonCognitiveIcon as m}from"../../assests/svg/ButtonCognitiveIcon.js";import S from"./OverlayComponent.js";import{safeStringify as x,extractDeviationScore as R,generateColorPalette as y,findKeyPathByNodeId as b,DEVIATION_BADGE_SEPARATOR as C,hasMeaningfulRedlineTags as w,scrollAndHighlightClause as _,scrollAndWait as B,waitForScrollIdle as F}from"./CognitiveComparehelpers.js";import{SHARED_MARKDOWN_STYLES as E,DEFAULT_FIELD_CONFIG as I,DEFAULT_COMPARISON_CONFIG as T}from"./CognitiveCompareConfig.js";export{SHARED_MARKDOWN_STYLES}from"./CognitiveCompareConfig.js";import{DEFAULT_DEVIAION_COLOR as A,EMPTY_SUMMARY_POPUP_STATE as D,DEFAULT_COMPONENT_HEADER_TEXT as O}from"./CognitiveCompareConstants.js";import P from"./CognitivePopup.js";import k from"./MoreFunctionsPopup.js";import L from"./LoaderComponent.js";import j from"./components/ThreeDotsLoader.js";import{useCognitiveTreeData as N}from"./hooks/useCompareData.js";import{useComparePopups as H}from"./hooks/useComparePopups.js";import{useSectionRefs as M}from"./hooks/useSectionRefs.js";import{useAccordionState as z}from"./hooks/useAccordionState.js";import{useDeviationNavigation as q}from"./hooks/useDeviationNavigation.js";import V from"./components/CompareHeader.js";import W from"./components/SubSectionAccordion.js";import K from"./components/LHSSectionRow.js";import J from"./components/RHSSectionRow.js";import Y from"./components/CognitiveSummaryPopup.js";import{CompareContextProvider as X}from"./CompareContext.js";import{useStyleHelpers as $}from"./hooks/useStyles.js";import{useResizeHandler as U}from"./hooks/useResizeHandler.js";import{useLinesCalculator as G}from"./hooks/useLinesCalculator.js";import{useSideBySide as Q}from"./hooks/useSideBySide.js";import Z from"./components/SvgConnectors.js";var ee=function(ee){var ne,ie,te,oe,re,le,ue,ce,ae,se,de,ve,fe,pe,ge,he,me,Se,xe,Re,ye,be,Ce,we,_e,Be,Fe,Ee,Ie,Te,Ae,De,Oe,Pe,ke,Le=ee.componentHeaderText,je=void 0===Le?O:Le,Ne=ee.treeData,He=ee.comparisonConfig,Me=ee.leftColumnTitleText,ze=ee.rightColumnTitleText,qe=ee.markdownStyles,Ve=ee.resetTrigger,We=ee.displayConfig,Ke=void 0===We?{isHeaderVisible:!0,isToggleVisible:!0,maintainRelativeOrder:!1,isLoading:!0,showDeviationBadges:!1,enableDeviationSchemaBackwardCompatibility:!1,displayEmailNotifier:!0}:We,Je=ee.onMaintainRelativeOrderChange,Ye=ee.popupConfig,Xe=ee.deviationData,$e=void 0===Xe?{}:Xe,Ue=ee.deviationNodeIdToView,Ge=ee.resetDeviationNodeId,Qe=ee.isProposingFix,Ze=void 0!==Qe&&Qe,en=ee.proposingFixNodeId,nn=ee.isRedlineFlow,tn=ee.badgeStyleOverride,on=l(Ke.maintainRelativeOrder),rn=on[0],ln=on[1],un=null!==(ne=null==Ke?void 0:Ke.expandLevels)&&void 0!==ne?ne:0,cn=!!(null==Ke?void 0:Ke.expandAllSections),an=!!rn||!!(null==Ke?void 0:Ke.showDeviationBadges),sn=l(!1),dn=sn[0],vn=sn[1],fn=l(null),pn=fn[0],gn=fn[1],hn=l(null===(te=null!==(ie=null==Ne?void 0:Ne.newEvaluationResult)&&void 0!==ie?ie:null==Ke?void 0:Ke.enableDeviationSchemaBackwardCompatibility)||void 0===te||te)[0],mn=l(new Set),Sn=mn[0],xn=mn[1],Rn=l([]),yn=Rn[0],bn=Rn[1],Cn=l(!1),wn=Cn[0],_n=Cn[1],Bn=u(null),Fn=u(null),En=u(null),In=u(null),Tn=u(null),An=u(!1),Dn=u(null),On=u({}),Pn=u([]),kn=u(function(){}),Ln=u(null),jn=u(function(){}),Nn=c(function(){return JSON.stringify($e||{})},[JSON.stringify($e)]),Hn=c(function(){return $e||{}},[Nn]),Mn=c(function(){return(null==Ne?void 0:Ne.cognitive_decisioning)||{}},[Ne]),zn=c(function(){return e(e({},E),qe)},[qe]),qn=u(null),Vn=u(null),Wn=u(null),Kn=u(null),Jn=u(null),Yn=u(null),Xn=u(null),$n=u(null),Un=u(null),Gn=u(null),Qn=H(qn),Zn=Qn.cognitivePopup,ei=Qn.setCognitivePopup,ni=Qn.moreFunctions,ii=Qn.setMoreFunctions,ti=Qn.position,oi=Qn.setPosition,ri=Qn.activeBadgeId,li=Qn.summaryPopup,ui=Qn.setSummaryPopup,ci=Qn.closeSummaryPopup,ai=Qn.setActiveBadgeId,si=Qn.popupRef,di=Qn.handleOpenCognitiveCompare,vi=Qn.openCognitivePopupFromState,fi=Qn.closeCognitivePopup,pi=Qn.closeMoreFunctionsPopup,gi=c(function(){var e,n,i,t,o,r,l;return{fields:null!==(e=null==He?void 0:He.fields)&&void 0!==e?e:I,thresholds:{high:null!==(i=null===(n=null==He?void 0:He.thresholds)||void 0===n?void 0:n.high)&&void 0!==i?i:T.thresholds.high,medium:null!==(o=null===(t=null==He?void 0:He.thresholds)||void 0===t?void 0:t.medium)&&void 0!==o?o:T.thresholds.medium,exact:null!==(l=null===(r=null==He?void 0:He.thresholds)||void 0===r?void 0:r.exact)&&void 0!==l?l:T.thresholds.exact}}},[He]),hi=l(null),mi=hi[0];hi[1];var Si=null===(le=null===(oe=null==Ne?void 0:Ne.documents)||void 0===oe?void 0:oe[null===(re=null==Ne?void 0:Ne.input_index_map)||void 0===re?void 0:re[0]])||void 0===le?void 0:le.title,xi=null===(ae=null===(ue=null==Ne?void 0:Ne.documents)||void 0===ue?void 0:ue[null===(ce=null==Ne?void 0:Ne.input_index_map)||void 0===ce?void 0:ce[1]])||void 0===ae?void 0:ae.title,Ri=x(Me||Si||"Uploaded Contract"),yi=null===(fe=null===(ve=null===(se=null==Ne?void 0:Ne.documents)||void 0===se?void 0:se[null===(de=null==Ne?void 0:Ne.input_index_map)||void 0===de?void 0:de[0]])||void 0===ve?void 0:ve.metadata)||void 0===fe?void 0:fe.file_name,bi=x(yi),Ci=null===(me=null===(he=null===(pe=null==Ne?void 0:Ne.documents)||void 0===pe?void 0:pe[null===(ge=null==Ne?void 0:Ne.input_index_map)||void 0===ge?void 0:ge[1]])||void 0===he?void 0:he.metadata)||void 0===me?void 0:me.file_name,wi=x(Ci),_i=x(ze||xi||"Reference Template"),Bi=N(Ne,rn,Hn,gi,hn),Fi=Bi.activeProposed,Ei=Bi.existingRule,Ii=Bi.proposedSections,Ti=Bi.existingSections,Ai=Bi.visibleFields,Di=Bi.parentDeviationRecord,Oi=Bi.deviationNumberRegistry,Pi=Bi.deviationParentRegistry,ki=Bi.parseError;a(function(){ki&&gn("Failed to load comparison: ".concat(ki))},[ki]);var Li=Ii.length>0||Ti.length>0,ji=c(function(){if(!nn)return"off";var e=0,n=0,i=function(t){Array.isArray(t)&&t.forEach(function(t){var o,r=(null==t?void 0:t.content)||"";w(r)&&(e+=1,n+=String(r).length),(null===(o=null==t?void 0:t.subsections)||void 0===o?void 0:o.length)&&i(t.subsections)})};return i(Ii),i(Ti),"".concat(e,":").concat(n)},[nn,Ii,Ti]);a(function(){if(Ii.length||Ti.length)if(cn){var e={},n={},i=function(i,t){i.forEach(function(i,o){var r,l=rn?"".concat(t,"-").concat(o):String(o);e[l]=!0;var u=function(e,i){null==e||e.forEach(function(e,t){var o,r="".concat(i,"-").concat(t);n[r]=!0,(null===(o=e.subsections)||void 0===o?void 0:o.length)&&u(e.subsections,r)})};(null===(r=i.subsections)||void 0===r?void 0:r.length)&&u(i.subsections,String(o))})};i(Ii,"left"),i(Ti,"right"),St(e),Rt(n)}else if(un>0){var t={},o={},r=function(e,n,i){e.forEach(function(e,r){var l;if(i>=1){var u=rn?"".concat(n,"-").concat(r):String(r);t[u]=!0}var c=function(e,n,t){t>i||null==e||e.forEach(function(e,i){var r,l="".concat(n,"-").concat(i);o[l]=!0,(null===(r=e.subsections)||void 0===r?void 0:r.length)&&c(e.subsections,l,t+1)})};(null===(l=e.subsections)||void 0===l?void 0:l.length)&&i>=2&&c(e.subsections,String(r),2)})};r(Ii,"left",un),r(Ti,"right",un),St(t),Rt(o)}},[cn,un,Ii,Ti,rn]);var Ni=M(Ai.map(function(e){return e.key}),Math.max(Ii.length,Ti.length)),Hi=Ni.leftRefs,Mi=Ni.rightRefs,zi=Ni.sectionLeftRefs,qi=Ni.sectionRightRefs,Vi=Ni.lhsBadgeRefs,Wi=Ni.rhsBadgeRefs,Ki=Ni.sectionRightRowRefs,Ji=Ni.subSectionLeftRefs,Yi=Ni.subSectionRightRefs,Xi=Ni.sectionRowRefs,$i=Ni.getSectionRowRef,Ui=Ni.getSubSectionRef,Gi=Ni.getBadgeRef,Qi=Q({maintainRelativeOrder:rn,proposedSections:Ii,existingSections:Ti,leftContainerRef:$n,rightContainerRef:Wn,scrollContainerRef:qn,sectionLeftRefs:zi,sectionRightRefs:qi,subSectionLeftRefs:Ji,subSectionRightRefs:Yi,lhsBadgeRefs:Vi,rhsBadgeRefs:Wi,sectionRowRefs:Xi,sectionRightRowRefs:Ki,rhsTopSpacerRef:Kn,rhsBottomSpacerRef:Jn,lhsTopSpacerRef:Yn,lhsBottomSpacerRef:Xn,calculateLinesRef:kn,setConnectedSections:xn,setConnectedLines:bn,cachedConnectedPositions:Pn,closeMoreFunctionsPopup:pi,setErrorToast:gn,moreFunctions:ni,closeSummaryPopup:ci}),Zi=Qi.isSideBySide,et=Qi.isArrowVisible,nt=Qi.setIsArrowVisible,it=Qi.isResizing,tt=Qi.setIsResizing,ot=Qi.isSideBySideLoading,rt=Qi.activeSideBySideSection,lt=Qi.scrollLock,ut=Qi.sideBySideCacheRef,ct=Qi.isSideBySideRef,at=Qi.activeSideBySideRightSectionRef,st=Qi.activeSideBySideSectionRef,dt=Qi.sideBySideLineRef,vt=Qi.highlightedClauseRefs,ft=Qi.clearClauseHighlight,pt=Qi.resetSideBySide,gt=Qi.activateSideBySide,ht=z({maintainRelativeOrder:!!rn,proposedSections:Ii,existingSections:Ti,activeSideBySideSection:rt,connectedSections:Sn,resetSideBySide:pt,setConnectedSections:xn,setConnectedLines:bn,cachedConnectedPositions:Pn,svgContainerRef:Bn,isAnimatingRef:An,animationTimerRef:Dn,calculateLinesRef:kn,sectionLeftRefs:zi,sectionRightRefs:qi,subSectionLeftRefs:Ji,subSectionRightRefs:Yi}),mt=ht.expandedSections,St=ht.setExpandedSections,xt=ht.expandedSubSections,Rt=ht.setExpandedSubSections,yt=ht.handleSubSectionToggle,bt=ht.toggleSection,Ct=ht.forceExpandCrossWiredSections,wt=function(){var e,n;if(null!=rt){var i=null===(e=zi.current[rt])||void 0===e?void 0:e.current,t=null===(n=qi.current[rt])||void 0===n?void 0:n.current,o=Wn.current;if(i&&t&&o){var r=i.getBoundingClientRect(),l=t.getBoundingClientRect(),u=o.getBoundingClientRect(),c=r.top-u.top,a=l.top-u.top-c;o.scrollBy({top:a,behavior:"smooth"})}}},_t=s(function(e){null==e||e.stopPropagation(),_n(function(e){var n=!e;return n&&requestAnimationFrame(function(){wt()}),n})},[wt]);a(function(){nn&&"off"!==ji&&"0:0"!==ji&&(ut.current=null,Pn.current=[],requestAnimationFrame(function(){var e;null===(e=kn.current)||void 0===e||e.call(kn)}))},[nn,ji]);var Bt=c(function(){var e=new Map,n=new Map,i=1;if(rn)Ii.forEach(function(n){!n.title&&!n.content||n.id&&e.set(n.id,i++)}),Ti.forEach(function(t){if(t.id&&!(!t.title&&!t.content)){var o=Ii.filter(function(e){var n;return null===(n=e.refIndexes)||void 0===n?void 0:n.includes(t.selfIndex)});if(o.length>0){var r=o.map(function(n){return e.get(n.id)}).filter(Boolean);n.set(t.id,r.join(", "))}else n.set(t.id,String(i++))}});else for(var t=Math.max(Ii.length,Ti.length),o=0;o<t;o++){var r=Ii[o],l=Ti[o];r?(e.set(r.id,i),l&&n.set(l.id,String(i)),i++):l&&n.set(l.id,String(i++))}return{leftNums:e,rightNums:n}},[Ii,Ti,rn]),Ft=Ei.analysis,Et=x(null===(xe=null===(Se=null==Ft?void 0:Ft.rule_difference_comparison)||void 0===Se?void 0:Se.summary)||void 0===xe?void 0:xe.overall_summary),It=!!Et.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),Tt=null!==(Re=null==Ne?void 0:Ne.base_root_id)&&void 0!==Re?Re:"-1";null==Ne||Ne[Tt];var At=hn?null!==(De=null!==(Ie=$e&&(null===(Ee=null==$e?void 0:$e[Tt])||void 0===Ee?void 0:Ee.evaluation_result))&&void 0!==Ie?Ie:null===(Ae=null===(Te=null==Ne?void 0:Ne.nodes)||void 0===Te?void 0:Te[Tt])||void 0===Ae?void 0:Ae.evaluation_result)&&void 0!==De?De:null:null!==(Fe=null!==(Ce=$e&&(null===(be=null===(ye=null==$e?void 0:$e[Tt])||void 0===ye?void 0:ye.evaluation_result)||void 0===be?void 0:be[0]))&&void 0!==Ce?Ce:null===(Be=null===(_e=null===(we=null==Ne?void 0:Ne.nodes)||void 0===we?void 0:we[Tt])||void 0===_e?void 0:_e.evaluation_result)||void 0===Be?void 0:Be[0])&&void 0!==Fe?Fe:null,Dt=R(At),Ot=y(null!==(ke=null===(Pe=null===(Oe=null==At?void 0:At.evaluation_outputs)||void 0===Oe?void 0:Oe.metadata)||void 0===Pe?void 0:Pe.label_color)&&void 0!==ke?ke:A);if(tn){var Pt=tn(Dt);Pt&&(Ot=e(e({},Ot),{badgeBg:Pt.bg,badgeText:Pt.text,badgeBorder:Pt.border}))}var kt=u(pt);a(function(){kt.current=pt},[pt]);var Lt=u(fi);a(function(){Lt.current=fi},[fi]);var jt=s(function(e,n,i,t,o,r){return qo.current(e,n,i,t,o,r)},[]),Nt=s(function(e,n,i,t,o){return Wo.current(e,n,i,t,o)},[]),Ht=s(function(){return Ko.current()},[]),Mt=s(function(e,n){return Jo.current(e,n)},[]),zt=s(function(e){return Yo.current(e)},[]),qt=s(function(e){return Xo.current(e)},[]),Vt=s(function(){return $o.current()},[]),Wt=s(function(){var e,n;ft(),null===(e=kt.current)||void 0===e||e.call(kt),_n(!1),xn(new Set),bn([]),Pn.current=[],ao([]),vo(null),ui(D),null===(n=Lt.current)||void 0===n||n.call(Lt),requestAnimationFrame(function(){var e;null===(e=kn.current)||void 0===e||e.call(kn)})},[]),Kt=u(Wt);a(function(){Kt.current=Wt},[Wt]),a(function(){Ve&&Kt.current()},[Ve]);var Jt=c(function(){return{documents:null==Ne?void 0:Ne.documents,input_index_map:null==Ne?void 0:Ne.input_index_map}},[JSON.stringify(null==Ne?void 0:Ne.documents),JSON.stringify(null==Ne?void 0:Ne.input_index_map)]),Yt=u(Ne);a(function(){Yt.current=Ne},[Ne]);var Xt=u(Mn);a(function(){Xt.current=Mn},[Mn]);var $t=s(function(n,i,t,o,r,l,u){var c,a,s,d,v,f,p,g,h,m,S=x(null==i?void 0:i.id)||x(null==t?void 0:t.id)||"",R=(S?null===(c=Xt.current)||void 0===c?void 0:c[S]:null)||(null==i?void 0:i.cognitiveData)||(null==t?void 0:t.cognitiveData)||{section_id:S,decisioning:[],gap:[],relevance_score:0},y=null!==(s=null===(a=Xi.current[o])||void 0===a?void 0:a.current)&&void 0!==s?s:null,b=function(){var n,r,l=(null==i?void 0:i.evaluationResult)||(null==t?void 0:t.evaluationResult)||null,u=function(n){var i=function(e){if(!e||"object"!=typeof e)return null;var n=null==e?void 0:e.deviation_entries;if(n&&"object"==typeof n){var i=Object.keys(n).sort(function(e,n){return Number(e)-Number(n)})[0];if(i&&n[i])return n[i]}var t=Object.keys(e).filter(function(e){return/^\d+$/.test(e)}).sort(function(e,n){return Number(e)-Number(n)});if(t.length&&e[t[0]])return e[t[0]];var o=null==e?void 0:e.deviations;if(o&&"object"==typeof o){var r=Object.keys(o).sort(function(e,n){return Number(e)-Number(n)})[0];if(r&&o[r])return o[r]}return null}(n);return i?e(e({},n),{deviation_summary:(null==n?void 0:n.deviation_summary)||(null==i?void 0:i.deviation_summary),deviation_title:(null==n?void 0:n.deviation_title)||(null==i?void 0:i.deviation_title),deviation_impact:(null==n?void 0:n.deviation_impact)||(null==i?void 0:i.deviation_impact),deviation_explanation:(null==n?void 0:n.deviation_explanation)||(null==i?void 0:i.deviation_explanation),evaluation_outputs:(null==n?void 0:n.evaluation_outputs)||(null==i?void 0:i.evaluation_outputs),cognitive_decisioning:(null==n?void 0:n.cognitive_decisioning)||(null==i?void 0:i.cognitive_decisioning)}):n};if(!("string"==typeof o&&o.includes(C)))return u(l);var c=o.split(C)[1];if(!c)return l;var a=(null==i?void 0:i.evaluationResult)||(null==t?void 0:t.evaluationResult)||{},s=(null===(n=null==a?void 0:a.deviation_entries)||void 0===n?void 0:n[c])||(null===(r=null==a?void 0:a.deviations)||void 0===r?void 0:r[c])||null;return s?e(e(e({},a),s),{deviation_summary:(null==s?void 0:s.deviation_summary)||(null==a?void 0:a.deviation_summary),deviation_title:(null==s?void 0:s.deviation_title)||(null==a?void 0:a.deviation_title),deviation_impact:(null==s?void 0:s.deviation_impact)||(null==a?void 0:a.deviation_impact),deviation_explanation:(null==s?void 0:s.deviation_explanation)||(null==a?void 0:a.deviation_explanation),evaluation_outputs:(null==s?void 0:s.evaluation_outputs)||(null==a?void 0:a.evaluation_outputs),cognitive_decisioning:(null==s?void 0:s.cognitive_decisioning)||(null==a?void 0:a.cognitive_decisioning)}):u(l)}(),w=(null!==(f=null===(v=null===(d=null==b?void 0:b.cognitive_decisioning)||void 0===d?void 0:d.decisioning_factors)||void 0===v?void 0:v.length)&&void 0!==f?f:0)>0||(null!==(h=null===(g=null===(p=null==b?void 0:b.cognitive_decisioning)||void 0===p?void 0:p.gaps_in_decision)||void 0===g?void 0:g.length)&&void 0!==h?h:0)>0;return{isLoading:null!==(m=null==Ke?void 0:Ke.isLoading)&&void 0!==m&&m&&!w,open:!0,sectionTitle:(null==i?void 0:i.title)?null==i?void 0:i.title:"No Counterpart",refSectionTitle:(null==t?void 0:t.title)?null==t?void 0:t.title:"No Counterpart",cognitiveData:R,anchorEl:n,sectionAnchorEl:y,badgeStyle:l||null,sectionIdx:o,docData:Jt,deviationData:b,isOrphan:!!r}},[Jt,null==Ke?void 0:Ke.isLoading]),Ut=s(function(e,n,i,t,o,r){var l;if(e.stopPropagation(),ni.open&&ni.sectionIdx===o)pi();else{var u=e.currentTarget,c="left";(null===(l=Wn.current)||void 0===l?void 0:l.contains(u))&&(c="right");ft(),ct.current&&pt(),xn(new Set),bn([]),Pn.current=[],fi(),li.open?Co():ci(),requestAnimationFrame(function(){var e=function(){var e,n,i,t;if("string"==typeof o&&o.includes(C)){var r=o.split(C),l="".concat(r[0]).concat(C).concat(r[1]);return"right"===c?null===(e=Wi.current[l])||void 0===e?void 0:e.current:null===(n=Vi.current[l])||void 0===n?void 0:n.current}return"right"===c?null===(i=Wi.current[o])||void 0===i?void 0:i.current:null===(t=Vi.current[o])||void 0===t?void 0:t.current}()||u;ii($t(e,n,t,o,i,r))})}},[ni.open,ni.sectionIdx,pi,ci,$t]),Gt=s(function(){var e=ni.sectionIdx;ni.isOrphan,pi(),ci(),null!==e&&(Ct(e),ft(),ct.current&&pt(),bn([]),Pn.current=[],xn(function(n){return n.has(e)?new Set:new Set([e])}),setTimeout(function(){kn.current&&kn.current()},50))},[ni.sectionIdx,ni.isOrphan,pi,ci,pt]),Qt=s(function(){var e=Tn.current;if(e){Tn.current=null;var n=Ii.findIndex(function(n){return n.id===e}),i=Ti.findIndex(function(n){return n.id===e}),t=-1===n?b(Ii,e):null,o=-1===i?b(Ti,e):null,r=-1!==n?n:t?Number(t.split("-")[0]):-1,l=-1!==i?i:o?Number(o.split("-")[0]):-1,u=function(e,n,i,t){var o,r,l,u;return-1!==e?null!==(r=null===(o=i.current[e])||void 0===o?void 0:o.current)&&void 0!==r?r:null:n&&null!==(u=null===(l=t.current[n])||void 0===l?void 0:l.current)&&void 0!==u?u:null},c=function(e,n,i){void 0===i&&(i=30);var t=0,o=function(){var r=e();r&&0!==r.getBoundingClientRect().height?(vt.current.add(r),_(r,n)):t++<i&&requestAnimationFrame(o)};requestAnimationFrame(o)};if(rn)-1!==r&&$n.current&&c(function(){return u(n,t,zi,Ji)},$n.current),-1!==l&&Wn.current&&c(function(){return u(i,o,qi,Yi)},Wn.current);else{var a=qn.current;if(!a)return;c(function(){return-1!==r?u(n,t,zi,Ji):u(i,o,qi,Yi)},a)}}},[Ii,Ti,rn,zi,qi,Ji,Yi,$n,Wn,qn]),Zt=s(function(n){if(n){ft(),pt(),xn(new Set),bn([]),Pn.current=[],ci(),fi();var i=Ii.findIndex(function(e){return e.id===n}),t=Ti.findIndex(function(e){return e.id===n}),o=-1===i?b(Ii,n):null,r=-1===t?b(Ti,n):null;if(-1!==i||o||-1!==t||r){var l=-1!==i?i:o?Number(o.split("-")[0]):-1,u=-1!==t?t:r?Number(r.split("-")[0]):-1;Tn.current=n,St(function(n){var i,t=e({},n),o=!1;-1!==l&&(t[i=rn?"left-".concat(l):String(l)]||(t[i]=!0,o=!0));-1!==u&&(t[i=rn?"right-".concat(u):String(u)]||(t[i]=!0,o=!0));return o?t:n}),Rt(function(n){var i=e({},n),t=!1,l=function(e){for(var n=e.split("-"),o=n[0],r=1;r<n.length;r++)o+="-".concat(n[r]),i[o]||(i[o]=!0,t=!0)};return o&&l(o),r&&l(r),t?i:n}),setTimeout(function(){requestAnimationFrame(function(){Tn.current===n&&eo.current()})},50)}else console.warn('scrollToAndHighlightClause: nodeId "'.concat(n,'" not found'))}},[Ii,Ti,rn,St,Rt,pt,ci,fi]),eo=u(Qt);a(function(){eo.current=Qt},[Qt]);var no=u(null);a(function(){if(mi){var e=gi.fields.find(function(e){return e.analysisKey===mi||e.key===mi});if(e){var n=Hi.current[e.key]||Mi.current[e.key];(null==n?void 0:n.current)&&setTimeout(function(){return n.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[mi,gi.fields]);var io=s(function(e){var n,i,t,o,r,l,u,c,a,s=null===(n=null==Ft?void 0:Ft.rule_difference_comparison)||void 0===n?void 0:n.fields;if(!s||!s[e])return{score:0,relation:"",highlightsA:[],highlightsB:[],hasContent:!1};var d=s[e],v=(null==d?void 0:d.relation)||(null===(t=null===(i=null==d?void 0:d.highlights)||void 0===i?void 0:i.ruleA_spans)||void 0===t?void 0:t.length)||(null===(r=null===(o=null==d?void 0:d.highlights)||void 0===o?void 0:o.ruleB_spans)||void 0===r?void 0:r.length)||(null==d?void 0:d.mappings)&&d.mappings.length>0;if(d.mappings){var f=d.mappings[0]||{};return{score:d.score,relation:f.relation||"",highlightsA:(null===(l=f.highlights)||void 0===l?void 0:l.ruleA_spans)||[],highlightsB:(null===(u=f.highlights)||void 0===u?void 0:u.ruleB_spans)||[],hasContent:!!v}}return{score:d.score,relation:d.relation||"",highlightsA:(null===(c=d.highlights)||void 0===c?void 0:c.ruleA_spans)||[],highlightsB:(null===(a=d.highlights)||void 0===a?void 0:a.ruleB_spans)||[],hasContent:!!v}},[Ft]),to=$({proposedSections:Ii,existingSections:Ti,maintainRelativeOrder:rn,cognitiveMap:Mn,deviationData:Hn,treeData:Ne,resolvedComparisonConfig:gi,badgeStyleOverride:tn}),oo=to.getSectionCompareStyle,ro=to.getSubSectionCompareStyle,lo=to.getDeviationStyleByKey,uo=G({containerRef:Fn,leftContainerRef:$n,rightContainerRef:Wn,svgContainerRef:Bn,pathRefs:On,leftHeaderRef:En,rightHeaderRef:In,proposedSections:Ii,existingSections:Ti,visibleFields:Ai,leftRefs:Hi,rightRefs:Mi,sectionLeftRefs:zi,sectionRightRefs:qi,subSectionLeftRefs:Ji,subSectionRightRefs:Yi,lhsBadgeRefs:Vi,rhsBadgeRefs:Wi,sectionRowRefs:Xi,expandedSections:mt,expandedSubSections:xt,connectedSections:Sn,isSideBySide:Zi,activeSideBySideSection:rt,maintainRelativeOrder:rn,cognitiveMap:Mn,getSectionCompareStyle:oo,getSubSectionCompareStyle:ro,getDeviationStyleByKey:lo,isArrowVisible:et,isAnimatingRef:An,isSideBySideRef:ct,sideBySideCacheRef:ut,sideBySideLineRef:dt,activeSideBySideSectionRef:st,activeSideBySideRightSectionRef:at,connectedLines:yn,setConnectedLines:bn,cachedConnectedPositions:Pn,calculateLinesRef:kn,resizeTimerRef:Ln,scrollLock:lt,scrollSyncLocked:wn,handleResizeRef:jn,activeProposed:Fi,existingRule:Ei,analysisData:Ft,pendingScrollTargetRef:Un,pendingScrollCallbackRef:Gn,resolvedComparisonConfig:gi,getFieldData:io}),co=uo.lines,ao=uo.setLines,so=uo.overallConnector,vo=uo.setOverallConnector,fo=uo.svgDimensions,po=uo.handleColumnScroll;a(function(){li.anchorEl&&requestAnimationFrame(function(){requestAnimationFrame(function(){var e;null===(e=kn.current)||void 0===e||e.call(kn)})})},[li.anchorEl,wn]);var go=s(function(){ft(),_n(!1),St({}),Rt({}),pt(),xn(new Set),bn([]),Pn.current=[],ci(),fi(),pi(),requestAnimationFrame(function(){kn.current&&kn.current()})},[St,Rt,pt,ci,fi,pi]);a(function(){Zi||0!==Sn.size||_n(!1)},[Zi,Sn]);var ho=c(function(){return Object.values(mt).some(Boolean)||Object.values(xt).some(Boolean)},[mt,xt]),mo=u(null),So=u(0),xo=u(0),Ro=u(0),yo=U({timerRef:mo,ruleComponentRef:Vn,scrollContainerRef:qn,containerRef:Fn,maintainRelativeOrder:rn,proposedSections:Ii,existingSections:Ti,isSideBySideRef:ct,activeSideBySideSectionRef:st,activeSideBySideRightSectionRef:at,sectionRowRefs:Xi,sectionRightRowRefs:Ki,sectionLeftRefs:zi,sectionRightRefs:qi,subSectionLeftRefs:Ji,subSectionRightRefs:Yi,lhsBadgeRefs:Vi,rhsBadgeRefs:Wi,leftContainerRef:$n,rightContainerRef:Wn,calculateLinesRef:kn,handleResizeRef:jn,setIsResizing:tt,setIsArrowVisible:nt,sideBySideCacheRef:ut,cachedConnectedPositions:Pn}).handleResize;a(function(){jn.current=yo},[yo,jn]),a(function(){var e=function(e,n,i,t,o){n.current=e.getBoundingClientRect().width;var r=new ResizeObserver(function(e){null!==i.current&&cancelAnimationFrame(i.current),i.current=requestAnimationFrame(function(){var r,l,u;i.current=null;var c=e[e.length-1];if(c){var a=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(a-n.current)<1?o():(n.current=a,t())}})});return r.observe(e),r},n={current:null},i={current:null},t={current:null},o=[],r=[n,i,t];return Vn.current&&o.push(e(Vn.current,So,n,function(){return jn.current()},function(){})),qn.current&&o.push(e(qn.current,xo,i,function(){return jn.current()},function(){return kn.current()})),Fn.current&&o.push(e(Fn.current,Ro,t,function(){return jn.current()},function(){return kn.current()})),function(){o.forEach(function(e){return e.disconnect()}),r.forEach(function(e){null!==e.current&&(cancelAnimationFrame(e.current),e.current=null)})}},[]),a(function(){ct.current=Zi},[Zi]),a(function(){st.current=rt},[rt]);var bo=s(function(){var e,n=ni.sectionIdx,i=ni.isOrphan;if(ci(),null!=n){var t="left";ni.anchorEl&&(null===(e=Wn.current)||void 0===e?void 0:e.contains(ni.anchorEl))&&(t="right"),Ct(n),gt(n,i,{sourceSide:t})}},[gt,ni.isOrphan,ni.sectionIdx,ni.anchorEl,ci]),Co=s(function(){ci(),pt(),xn(new Set),bn([]),Pn.current=[]},[ci,pt]),wo=null!==ni.sectionIdx&&Sn.has(ni.sectionIdx),_o=q({proposedSections:Ii,existingSections:Ti,parentDeviationRecord:Di,expandedSections:mt,maintainRelativeOrder:!!rn,scrollContainerRef:qn,leftContainerRef:$n,rightContainerRef:Wn,lhsBadgeRefs:Vi,rhsBadgeRefs:Wi}),Bo=_o.showDeviationNavigation,Fo=_o.showOpenNodeRef,Eo=_o.adjustScrollForPopup,Io=s(function(e,n,i,t,o){var r,l="string"==typeof t?x(t).trim():x(null==t?void 0:t.deviation_summary).trim(),u=e.currentTarget;fi();var c="left";(null===(r=Wn.current)||void 0===r?void 0:r.contains(u))&&(c="right");var a=function(){var e,i,t,o;if("string"==typeof n&&n.includes(C)){var r=n.split(C),l="".concat(r[0]).concat(C).concat(r[1]);return"right"===c?null===(e=Wi.current[l])||void 0===e?void 0:e.current:null===(i=Vi.current[l])||void 0===i?void 0:i.current}return"right"===c?null===(t=Wi.current[n])||void 0===t?void 0:t.current:null===(o=Vi.current[n])||void 0===o?void 0:o.current};if(i)return pt(),xn(new Set),bn([]),Pn.current=[],void(l&&(Ct(n),requestAnimationFrame(function(){var e=a()||u;e&&(e.getBoundingClientRect().top>.8*window.innerHeight&&e.scrollIntoView({behavior:"smooth",block:"center"}));ui({open:!0,anchorEl:e,summary:t,displayImpact:o})})));Ct(n),l?setTimeout(function(){gt(n,i,{toggleIfSame:!1,sourceSide:c,onReady:function(){var e,n,i,r=a()||u;if(r){var l=r.getBoundingClientRect();if(l.top>.8*window.innerHeight||l.top<100){var c=l.top-window.innerHeight/2;rn?(null===(e=$n.current)||void 0===e||e.scrollBy({top:c,behavior:"smooth"}),null===(n=Wn.current)||void 0===n||n.scrollBy({top:c,behavior:"smooth"})):null===(i=qn.current)||void 0===i||i.scrollBy({top:c,behavior:"smooth"})}}ui({open:!0,anchorEl:r,summary:t,displayImpact:o})}})},350):setTimeout(function(){gt(n,i,{toggleIfSame:!1,sourceSide:c})},350)},[gt,fi,ui,pt,Ct]),To=c(function(){var e;if(!Ue)return null;var n=null===(e=null==Ue?void 0:Ue.id)||void 0===e?void 0:e.split(":")[0];for(var i in Di){if((Di[i]||[]).some(function(e){return e.id===n}))return i}return null},[Ue,Di]),Ao=u({id:null,triggerMs:null}),Do=u(null);a(function(){if(null==Ue?void 0:Ue.id){var o=Number(Ue.trigger),r=Ao.current;if((null==r?void 0:r.triggerMs)!==o){if(!(Ue.id.includes(":")&&/:\d+$/.test(Ue.id)))return Ao.current={id:Ue.id,triggerMs:o},void Zt(Ue.id);var l=Ue.id.split(":"),u=l[0],c=l[1],a=null!=c?c:"0";Do.current!==Ue.id&&(ci(),fi(),pt(),xn(new Set),bn([]),Pn.current=[],Do.current=Ue.id);var s=!1,d=0,v=null,f=null,p=!1,g=function(e,n){for(var i=function(e,t){if(!e)return null;if(e.id===n)return t;if(!Array.isArray(e.subsections))return null;for(var o=0;o<e.subsections.length;o++){var r=i(e.subsections[o],"".concat(t,"-").concat(o));if(r)return r}return null},t=0;t<e.length;t++){var o=i(e[t],String(t));if(o)return o}return null},h=function(){var r,l,c,m;if(!s){var S=function(){Ao.current={id:Ue.id,triggerMs:o}},x=null,R=null;for(var y in Di){var b=Di[y].find(function(e){return e.id===u});if(b){x=y,R=b;break}}if(R&&x){var w=Ii.findIndex(function(e){return e.id===x}),_=Ti.findIndex(function(e){return e.id===x}),E=-1===w&&-1!==_,I=g(Ii,R.id),T=g(Ti,R.id);if(I&&!T&&!E){var A=I.split("-"),D=Number(A[0]);if(rn){var O=null===(l=null===(r=Ii[D])||void 0===r?void 0:r.refIndexes)||void 0===l?void 0:l[0],P=Ti.findIndex(function(e){return e.selfIndex===O});-1!==P&&(D=P)}T=n([D],A.slice(1),!0).join("-")}if(I||T){var k=I?Number(I.split("-")[0]):w,L=T?Number(T.split("-")[0]):_,j=L>=0?L:T?Number(T.split("-")[0]):-1,N=Ii[k],H=Ti[j],M=N&&!N.title&&!N.content,z=H&&!H.title&&!H.content,q=E||(!I&&!!T||M&&!z);if(q){if(!(rn?!!Vo.current["right-".concat(L)]:!!Vo.current[String(L)])&&L>=0)return bt(L,"right"),void(v=setTimeout(h,200))}else if(!(rn?!!Vo.current["left-".concat(k)]:!!Vo.current[String(k)])&&k>=0)return bt(k,"left"),void(v=setTimeout(h,200));var V=I||"",W=T||"",K="".concat(R.id).concat(C).concat(a).concat(C).concat(V).concat(C).concat(W),J="".concat(R.id).concat(C).concat(a);if(!p){Ct(K),p=!0,d=0;var Y=function(){var e,n,i=null===(e=Vi.current[J])||void 0===e?void 0:e.current,t=null===(n=Wi.current[J])||void 0===n?void 0:n.current;return q||!i&&!!t?t:i};return null==f||f(),void(v=setTimeout(function(){var e,n,i,t,o,r,l;s||(e=Y,n=function(){s||(f=null,h())},t=0,o=null,r=null,l=function(){if(!s){var u=e();if(u&&0!==u.getBoundingClientRect().height){var c=u.getBoundingClientRect(),a=c.top,d=c.height,v=null!==o&&Math.abs(a-o)<.5,f=null!==r&&Math.abs(d-r)<.5;if(v&&f){if(++t>=5)return void n()}else t=0;o=a,r=d,i=requestAnimationFrame(l)}else i=requestAnimationFrame(l)}},i=requestAnimationFrame(l),f=function(){return cancelAnimationFrame(i)})},300))}var X=null===(c=Vi.current[J])||void 0===c?void 0:c.current,$=null===(m=Wi.current[J])||void 0===m?void 0:m.current;if(X||$){var U=q||!X&&!!$,G=U?$:X,Q=rn?U?Wn.current:$n.current:qn.current;if(G&&Q){var Z=G.getBoundingClientRect();if(0!==Z.height){var ee=Q.getBoundingClientRect(),ne=Z.top-ee.top+Q.scrollTop-ee.height/2+Z.height/2,ie=(null==I?void 0:I.includes("-"))||(null==T?void 0:T.includes("-")),te=function(){return i(void 0,void 0,void 0,function(){var n,i,o,r,l,u,c,d,v,f;return t(this,function(t){switch(t.label){case 0:return s?[2]:(S(),n=G instanceof Element?window.getComputedStyle(G).color:"",[X,$].forEach(function(e){e&&(e.style.transition="box-shadow 300ms ease-in-out",e.style.boxShadow="0 0 10px ".concat(n))}),setTimeout(function(){[X,$].forEach(function(e){e&&(e.style.boxShadow="")})},2e3),i=(null===(c=null===(u=R.evaluationResult)||void 0===u?void 0:u.deviations)||void 0===c?void 0:c[a])||R,o=(null===(d=R.evaluationResult)||void 0===d?void 0:d.evaluation_outputs)||R.evaluation_outputs,!!X&&!!$?(l=function(e,n){return Promise.race([e,new Promise(function(e){return setTimeout(e,n)})])},rn?[4,Promise.all([$n.current?l(F($n.current),600):Promise.resolve(),Wn.current?l(F(Wn.current),600):Promise.resolve()])]:[3,2]):(r=U?(null===(v=Wi.current[ie?J:L])||void 0===v?void 0:v.current)||$:(null===(f=Vi.current[ie?J:k])||void 0===f?void 0:f.current)||X,Eo(r,function(){ui({open:!0,anchorEl:r,displayImpact:Ue.displayImpact,summary:e(e({},i),{evaluation_outputs:o})})},{skipScroll:!0}),null==Ge||Ge(),[2]));case 1:t.sent(),t.label=2;case 2:return gt(K,!1,{toggleIfSame:!1,sourceSide:E?"right":"left",onReady:function(){var n,t,o,r;S();var l=U?(null===(n=Wi.current[J])||void 0===n?void 0:n.current)||$:(null===(t=Vi.current[J])||void 0===t?void 0:t.current)||X,u=(null===(o=Vi.current[J])||void 0===o?void 0:o.current)||X,c=(null===(r=Wi.current[J])||void 0===r?void 0:r.current)||$;u&&(u.style.scrollMarginTop="150px",u.scrollIntoView({behavior:"smooth",block:"start"})),c&&(c.style.scrollMarginTop="150px",c.scrollIntoView({behavior:"smooth",block:"start"})),ui({open:!0,anchorEl:l,displayImpact:Ue.displayImpact,summary:e({},i)}),null==Ge||Ge()}}),[2]}})})};Math.abs(Q.scrollTop-ne)<=2?te():B(Q,ne,te)}else++d<2?v=setTimeout(h,100):S()}else++d<2?v=setTimeout(h,100):S()}else++d<2?v=setTimeout(h,100):S()}else++d<2?v=setTimeout(h,100):S()}else++d<2?v=setTimeout(h,100):S()}};return v=setTimeout(h,100),function(){s=!0,v&&clearTimeout(v),null==f||f()}}}},[Ue,Di,Ii,Ti,rn,mt,gt,ui,Zt]),a(function(){var n,i,t;if(li.open){var o=li.anchorEl;if(o&&!o.isConnected){var r=function(e){for(var n,i=0,t=Object.entries(e);i<t.length;i++){var r=t[i],l=r[0];if((null===(n=r[1].current)||void 0===n?void 0:n.textContent)===o.textContent)return l}return null},l=(null===(n=o.dataset)||void 0===n?void 0:n.deviationRefId)||r(Vi.current)||r(Wi.current);if(l){var u=(null===(i=Wi.current[l])||void 0===i?void 0:i.current)||(null===(t=Vi.current[l])||void 0===t?void 0:t.current);u&&u.isConnected&&ui(function(n){return e(e({},n),{anchorEl:u})})}}}},[li.open,li.anchorEl,wn,Sn,mt]);var Oo=Zn.open,Po=Zn.sectionIdx,ko=Zn.isOrphan,Lo=Zn.badgeStyle,jo=Zn.anchorEl,No=Zn.sectionAnchorEl;a(function(){var n;if(Oo&&null!=Po&&Po!==Tt){var i="string"==typeof Po?Po.split(C)[0]:null,t=function(e,n){var i;if(!e||!Array.isArray(e))return null;for(var o=0,r=e;o<r.length;o++){var l=r[o];if(l.id===n)return l;if(null===(i=l.subsections)||void 0===i?void 0:i.length){var u=t(l.subsections,n);if(u)return u}}return null},o=i&&"string"==typeof i?t(Ii,i):null,r=i&&"string"==typeof i?t(Ti,i):null,l="number"==typeof Po?Ii[Po]||null:o||i&&((null===(n=null==Ne?void 0:Ne.nodes)||void 0===n?void 0:n[i])||(null==Ne?void 0:Ne[i]))||null,u="number"==typeof Po?Ti[Po]||null:r,c=$t(jo,l,u,Po,ko,Lo);ei(function(n){return n.open?x(n.cognitiveData)===x(c.cognitiveData)&&x(n.deviationData)===x(c.deviationData)&&n.sectionTitle===c.sectionTitle&&n.refSectionTitle===c.refSectionTitle?n:e(e(e({},n),c),{open:!0,anchorEl:n.anchorEl,sectionAnchorEl:n.sectionAnchorEl}):n})}},[Oo,Po,ko,Lo,jo,No,Ii,Ti,$t]);var Ho=s(function(e){var n=e.section,i=e.keyPath,t=e.depth,r=void 0===t?0:t,l=e.columnKey,u=void 0===l?"left":l,c=e.parentNodeId,a=void 0===c?"":c,s=e.sectionOffset;return o(W,{section:n,keyPath:i,depth:r,columnKey:u,parentNodeId:a,sectionOffset:s})},[]),Mo=c(function(){return Ii.map(function(e,n){var i,t=!(null==e?void 0:e.title)&&!(null==e?void 0:e.content),r=!(null==e?void 0:e.refIndexes)||0===e.refIndexes.length;return t&&r&&rn?null:o(K,{section:e,idx:n},null!==(i=null==e?void 0:e.id)&&void 0!==i?i:"left-row-".concat(n))})},[Ii]),zo=c(function(){return Ti.map(function(e,n){var i,t=!(null==e?void 0:e.title)&&!(null==e?void 0:e.content),r=!(null==e?void 0:e.refIndexes)||0===e.refIndexes.length;return t&&r&&rn?null:o(J,{section:e,idx:n},null!==(i=null==e?void 0:e.id)&&void 0!==i?i:"right-row-".concat(n))})},[Ti]),qo=u(Ut);a(function(){qo.current=Ut},[Ut]);var Vo=u(mt);a(function(){Vo.current=mt},[mt]);var Wo=u(Io);a(function(){Wo.current=Io},[Io]);var Ko=u(Co);a(function(){Ko.current=Co},[Co]);var Jo=u(bt);a(function(){Jo.current=bt},[bt]);var Yo=u(yt);a(function(){Yo.current=yt},[yt]);var Xo=u(Ho);a(function(){Xo.current=Ho},[Ho]);var $o=u(pt);a(function(){$o.current=pt},[pt]);var Uo=c(function(){return{maintainRelativeOrder:!!rn,showDeviationBadges:an,isProposingFix:Ze,proposingFixNodeId:en,isRedlineFlow:nn,isSideBySide:Zi,activeSideBySideSection:rt,scrollSyncLocked:wn,toggleScrollSyncLocked:_t,summaryPopupAnchorEl:li.anchorEl,connectedSections:Sn,proposedSections:Ii,existingSections:Ti,deviationNumberRegistry:Oi,deviationParentRegistry:Pi,treeData:Ne,displayConfig:Ke,resolvedMarkdownStyles:zn,unifiedNumbering:Bt,expandedSections:mt,expandedSubSections:xt,setExpandedSubSections:Rt,getSectionCompareStyle:oo,getSubSectionCompareStyle:ro,getBadgeRef:Gi,getSectionRowRef:$i,getSubSectionRef:Ui,sectionLeftRefs:zi,sectionRightRefs:qi,sectionRowRefs:Xi,sectionRightRowRefs:Ki,subSectionLeftRefs:Ji,subSectionRightRefs:Yi,lhsBadgeRefs:Vi,rhsBadgeRefs:Wi,openMoreFunctionsPopup:jt,handleOpenSummaryPopup:Nt,openSummaryPopup:Nt,handleCloseSummaryPopup:Ht,toggleSection:Mt,handleSubSectionToggle:zt,renderSubSectionAccordion:qt,resetSideBySide:Vt,setConnectedSections:xn,setConnectedLines:bn,cachedConnectedPositions:Pn,showDeviationNavigation:Bo,showOpenNodeRef:Fo,deviationNodeIdToView:null==Ue?void 0:Ue.id,deviationTargetParentId:To}},[rn,an,Ze,en,nn,Zi,rt,wn,_t,li.anchorEl,Sn,Ii,Ti,Oi,Ke,zn,Bt,mt,xt,Rt,oo,ro,Gi,$i,Ui,Bo,Fo,Ue,To]);return o(X,e({value:Uo},{children:r(d,e({ref:Vn,sx:{display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif',overflow:"visible",position:"relative"}},{children:[dn&&o(d,e({sx:{position:"absolute",inset:0,bgcolor:"rgba(255, 255, 255, 0.6)",backdropFilter:"blur(10px)",zIndex:9999,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"8px"}},{children:o(L,{})})),li.open&&o(Y,{open:li.open,anchorEl:li.anchorEl,containerEl:no.current,clipTopEl:En.current,scrollContainerEl:qn.current,onClose:Co,summary:li.summary,displayImpact:li.displayImpact,isScrollLocked:wn}),o(k,{open:ni.open,anchorEl:ni.anchorEl,maintainRelativeOrder:!!rn,sectionTitle:ni.sectionTitle,referenceSectionTitle:ni.refSectionTitle,onClose:pi,onOpenCognitiveCompare:di,onOpenSideBySide:bo,onConnect:Gt,isConnected:wo,isOrphan:ni.isOrphan}),Zn.open&&o(P,{open:Zn.open,popupRef:si,position:ti,popupConfig:Ye,onClose:function(){oi(null),ei(function(n){return e(e({},n),{open:!1})}),ai(null)},markdownStyles:qe,sectionTitle:bi,referenceSectionTitle:wi,cognitiveData:Zn.cognitiveData,anchorEl:Zn.anchorEl,sectionAnchorEl:Zn.sectionAnchorEl,scrollContainerEl:qn.current,badgeStyle:Zn.badgeStyle,docData:Zn.docData,deviationData:Zn.deviationData,isLoading:Zn.isLoading}),o(v,e({open:!!pn,autoHideDuration:8e3,onClose:function(){return gn(null)},anchorOrigin:{vertical:"top",horizontal:"center"}},{children:o(f,e({onClose:function(){return gn(null)},severity:"error",sx:{width:"100%",whiteSpace:"pre-line"}},{children:pn}))})),o(V,{componentHeaderText:je,displayConfig:Ke,maintainRelativeOrder:rn,onCollapseAll:go,showCollapseAll:ho,onToggleView:function(e){vn(!0),setTimeout(function(){ln(!e),null==Je||Je(!e),_n(!1),pt(),ci(),xn(new Set),bn([]),Pn.current=[],requestAnimationFrame(function(){requestAnimationFrame(function(){setTimeout(function(){vn(!1)},600)})})},50)}}),o(d,e({ref:qn,onScroll:po,sx:{flex:1,minHeight:0,pt:1.5,pb:1,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",overflowY:rn?"visible":"auto",borderTop:Et&&It?"none":"1.5px solid #EEF0F4"}},{children:o(d,e({sx:e({display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"},rn?{flex:1}:{})},{children:r(d,e({ref:Fn,sx:e({display:"grid",gridTemplateColumns:"minmax(0, 1fr) 180px minmax(0, 1fr)",gap:"60px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0},rn?{flex:1,overflow:"visible"}:{})},{children:[o(Z,{svgContainerRef:Bn,svgDimensions:fo,isResizing:it,overallConnector:so,rootDeviationStyle:Ot,lines:co,isSideBySide:Zi,activeSideBySideSection:rt,isArrowVisible:et,maintainRelativeOrder:rn,proposedSections:Ii,existingSections:Ti,cognitivePopup:Zn,activeBadgeId:ri,closeCognitivePopup:fi,setActiveBadgeId:ai,openCognitivePopupFromState:vi,buildSectionPopupState:$t,connectedLines:yn,pathRefs:On}),r(d,e({sx:e({border:"1px solid #E7E7E9",borderRadius:"8px",bgcolor:"#FFFFFF",display:"flex",flexDirection:"column",position:"relative",zIndex:2,filter:"drop-shadow(0px 2px 4px #F2F2F2)"},rn?{flex:1,overflow:"visible"}:{})},{children:[o(d,e({ref:En,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E7E7E9",borderRadius:"8px 8px 0 0",display:"flex",alignItems:"center",minHeight:"40px",overflow:"hidden",minWidth:0}},{children:o(p,e({title:Ri,placement:"top"},{children:o(g,e({sx:{fontSize:"16px",fontWeight:500,color:"#19213D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0,textAlign:"center",display:"block"}},{children:Ri}))}))})),r(d,e({ref:$n,onScroll:po,sx:e({p:"12px",display:"flex",flexDirection:"column"},rn?{maxHeight:"calc(100vh - 250px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,mr:"-180px",pr:"192px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[o("div",{ref:Yn,style:{width:"100%",height:"0px",flexShrink:0}}),Li&&Mo,o("div",{ref:Xn,style:{width:"100%",height:"0px",flexShrink:0}})]}))]})),o(d,e({ref:no,sx:{width:"180px",display:"flex",flexDirection:"column",alignItems:"center",pt:"15px",gap:0,zIndex:20,pointerEvents:"none"}},{children:o(d,e({sx:{display:"flex",justifyContent:"center",alignItems:"center",mt:0}},{children:r(d,e({onClick:function(n){n.stopPropagation(),Zn.open&&ri===Tt?fi():(ai(Tt),vi($t(n.currentTarget,{title:"",content:"",evaluationResult:At,cognitiveData:{section_id:"",decisioning:[],gap:[],relevance_score:0,isMissingRationale:!0}},null,Tt,!0,e(e({},Ot),{label:""}))))},sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:"5px",top:"-8px",borderRadius:"20px",bgcolor:Ot.badgeBg,color:Ot.badgeText,border:"1px solid ".concat(Ot.badgeBorder),fontSize:"12px",fontWeight:600,whiteSpace:"nowrap",position:"relative",zIndex:1,pointerEvents:"auto",cursor:"pointer"}},{children:[null!=Dt?Dt:o(j,{}),o(d,e({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:o(m,{})})),o(h,{size:11,style:{transform:Zn.open&&ri===Tt?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))})),r(d,e({sx:e({border:"1px solid #E3E6EA",borderRadius:"8px",bgcolor:"#FFFFFF",boxShadow:"0px 1px 4px #F7F4FE",position:"relative",zIndex:2,display:"flex",flexDirection:"column",minWidth:0},rn?{flex:1,overflow:"visible",minHeight:0}:{})},{children:[ot&&o(S,{sections:11}),o(d,e({ref:In,sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E3E6EA",borderRadius:"8px 8px 0 0",minHeight:"40px",display:"flex",alignItems:"center",overflowX:"hidden"}},{children:o(p,e({title:_i,placement:"top"},{children:o(g,e({sx:{fontSize:"16px",fontWeight:500,color:"#5928ED",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0,textAlign:"center",display:"block"}},{children:_i}))}))})),r(d,e({ref:Wn,onScroll:po,sx:e({p:"12px",display:"flex",flexDirection:"column"},rn?{maxHeight:"calc(100vh - 250px)",flex:1,overflowY:"auto",overflowX:"hidden",minHeight:0,ml:"-150px",pl:"165px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}:{})},{children:[o("div",{ref:Kn,style:{width:"100%",height:"0px",flexShrink:0}}),Li&&zo,o("div",{ref:Jn,style:{width:"100%",height:"0px",flexShrink:0}})]}))]}))]}))}))}))]}))}))};export{ee as default};
|
|
2
2
|
//# sourceMappingURL=CognitiveCompare.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as n}from"tslib";import{jsxs as e,jsx as i}from"react/jsx-runtime";import o,{useEffect as t}from"react";import{Box as l,Accordion as d,AccordionSummary as r,Tooltip as a,Typography as c,AccordionDetails as u}from"@mui/material";import{ChevronUp as s,ChevronDown as v}from"lucide-react";import{MemoizedMarkdown as f}from"../hooks/memoizedMarkdown.js";import{useCompareContext as p}from"../CompareContext.js";import{hasValue as x,hasMeaningfulRedlineTags as h,stripRedlineTags as g,generateColorPalette as m,isMissingStr as I,safeStringify as y,DEVIATION_BADGE_SEPARATOR as b}from"../CognitiveComparehelpers.js";import{DEFAULT_DEVIAION_COLOR as w}from"../CognitiveCompareConstants.js";var S=function(S){var _,F,k,R,B,C,M,A,O,W,j,P,E,N=S.section,T=S.idx,D=S.columnKey,K=S.colRef,L=S.mb,z=void 0===L?1:L,G=S.isExpanded,H=S.onToggle,V=S.navigation,X=S.parentNodeId,Y=void 0===X?"":X,q=p(),J=q.showOpenNodeRef,Q=q.resolvedMarkdownStyles,U=q.maintainRelativeOrder,Z=q.showDeviationBadges,$=void 0!==Z&&Z,nn=q.renderSubSectionAccordion,en=q.treeData,on=q.proposedSections,tn=q.existingSections,ln=q.deviationNumberRegistry,dn=q.deviationParentRegistry,rn=q.getBadgeRef,an=q.openSummaryPopup,cn=q.getSectionCompareStyle,un=q.connectedSections,sn=q.openMoreFunctionsPopup,vn=q.isProposingFix,fn=q.proposingFixNodeId,pn=q.isRedlineFlow,xn=q.isSideBySide,hn=q.activeSideBySideSection,gn=q.scrollSyncLocked,mn=q.toggleScrollSyncLocked,In=q.summaryPopupAnchorEl,yn="".concat(xn?"1":"0","-").concat(String(null!=hn?hn:"")),bn=(null===(_=N.displayTitle)||void 0===_||_)&&x(N.title),wn=!!vn&&!!fn&&"left"===D&&N.id===fn,Sn=h(N.content),_n="boolean"==typeof pn?pn:Sn,Fn=Sn,kn=_n&&Sn,Rn=kn?g(N.content):N.content,Bn=kn?N.content:void 0,Cn=(null===(F=N.displayContent)||void 0===F||F||Sn)&&x(N.content),Mn=!bn&&!Cn,An=N.title;bn||(An=Cn?"No Title Found":"No Matching Section Found");var On=N.evaluationResult;if(!On&&"right"===D)if(U){var Wn=null===(k=N.refIndexes)||void 0===k?void 0:k[0],jn=on.find(function(n){return n.selfIndex===Wn});On=null==jn?void 0:jn.evaluationResult}else On=null===(R=on[T])||void 0===R?void 0:R.evaluationResult;var Pn=null===(B=null==en?void 0:en.input_index_map)||void 0===B?void 0:B[0],En=null===(C=null==en?void 0:en.input_index_map)||void 0===C?void 0:C[1],Nn="left"===D?En:Pn,Tn=function(n,e){var i;if(!e||!n)return null;for(var o=0,t=n;o<t.length;o++){var l=t[o];if(l.id===e)return l;if(null===(i=l.subsections)||void 0===i?void 0:i.length){var d=Tn(l.subsections,e);if(d)return d}}return null},Dn="left"===D?N:Tn(on,N.id),Kn="right"===D?N:Tn(tn,N.id),Ln=o.useMemo(function(){if(!U)return 0;var n=1/0,e=function(i,o,t,l){var d;if(i){var r=i.id;if(l&&"right"===D){var a=on.filter(function(n){var e;return null===(e=n.refIndexes)||void 0===e?void 0:e.includes(i.selfIndex)});a.length>0&&(r=a[0].id)}var c=i.id||(null==o?void 0:o.id)||(null==t?void 0:t.id),u=(null===(d=i.evaluationResult)||void 0===d?void 0:d.deviations)||{};Object.keys(u).forEach(function(e){var i="".concat(r).concat(b).concat(e),o=null==ln?void 0:ln[i];null!=o&&o<n&&(n=o);var t="".concat(c).concat(b).concat(e),l=null==ln?void 0:ln[t];null!=l&&l<n&&(n=l)});for(var s=i.subsections||[],v=(null==o?void 0:o.subsections)||[],f=(null==t?void 0:t.subsections)||[],p=Math.max(s.length,v.length,f.length),x=0;x<p;x++)e(s[x],v[x],f[x],!1)}};return e(N,Dn,Kn,!0),n!==1/0?n-1:0},[N,Dn,Kn,D,ln,U,on]);if(U)if("left"===D){var zn=null===(M=N.refIndexes)||void 0===M?void 0:M[0],Gn=tn.findIndex(function(n){return n.selfIndex===zn});Kn=-1!==Gn?tn[Gn]:Tn(tn,N.id)}else{var Hn=null===(A=N.refIndexes)||void 0===A?void 0:A[0],Vn=on.findIndex(function(n){return n.selfIndex===Hn});Dn=-1!==Vn?on[Vn]:Tn(on,N.id)}var Xn="left"===D?!Kn:!Dn,Yn=On||(null==Dn?void 0:Dn.evaluationResult)||(null==Kn?void 0:Kn.evaluationResult),qn=null!==(j=null===(W=null===(O=null==Yn?void 0:Yn.evaluation_outputs)||void 0===O?void 0:O.metadata)||void 0===W?void 0:W.label_color)&&void 0!==j?j:w,Jn=m(qn).highlightBg,Qn=(null==Yn?void 0:Yn.deviations)||{},Un=N.id;if(U&&"left"!==D){var Zn=on.filter(function(n){var e;return null===(e=n.refIndexes)||void 0===e?void 0:e.includes(N.selfIndex)});Zn.length>0?Un=Zn[0].id:(null==Dn?void 0:Dn.id)&&(Un=Dn.id)}var $n=Object.keys(Qn)[0],ne=$n?"".concat(Un).concat(b).concat($n):null,ee=ne?null==dn?void 0:dn[ne]:null,ie=null!=ee?ee:T+1;if(null==ee&&U)if("left"===D)ie=void 0!==N.selfIndex&&N.selfIndex>=0?N.selfIndex+1:T+1;else{Zn=on.filter(function(n){var e;return null===(e=n.refIndexes)||void 0===e?void 0:e.includes(N.selfIndex)});ie=Zn.length>0?void 0!==Zn[0].selfIndex&&Zn[0].selfIndex>=0?Zn[0].selfIndex+1:T+1:void 0!==N.selfIndex&&N.selfIndex>=0?N.selfIndex+1:T+1}var oe=Object.entries(Qn).map(function(n){var e=n[0],i=n[1],o="".concat(Un).concat(b).concat(e);return{deviationKey:e,deviationMap:i,refId:o,currentIndex:ln[o]}}).filter(function(n){return void 0!==n.currentIndex&&null!==n.currentIndex});oe.sort(function(n,e){return n.currentIndex-e.currentIndex});var te,le=oe.map(function(e){var i,o,t,l,d,r,a=e.deviationKey,c=e.deviationMap,u=e.refId,s=e.currentIndex;U&&void 0!==Ln&&(s-=Ln);var v=c[Y],f=I(v);if(f)v="";else if(!v)return null;var p=T,x=T;if(U)if("left"===D){var h=null===(i=N.refIndexes)||void 0===i?void 0:i[0],g=tn.findIndex(function(n){return n.selfIndex===h});if(-1!==g)x=g;else{var y=tn.findIndex(function(n){return n.id===N.id});x=-1!==y?y:T}}else{var w=null===(o=N.refIndexes)||void 0===o?void 0:o[0],S=on.findIndex(function(n){return n.selfIndex===w});if(-1!==S)p=S;else p=-1!==(C=on.findIndex(function(n){return n.id===N.id}))?C:T}var _="".concat(Un).concat(b).concat(a).concat(b).concat(p).concat(b).concat(x),F=c[Nn],k=Xn||I(F),R="".concat(ie,".").concat(s),B=T;if("right"===D&&U){var C,M=null===(t=N.refIndexes)||void 0===t?void 0:t[0],A=on.findIndex(function(n){return n.selfIndex===M});if(-1!==A)B=A;else-1!==(C=on.findIndex(function(n){return n.id===N.id}))&&(B=C)}var O=cn?cn(B):null,W=(null==c?void 0:c.evaluation_outputs)||(null==Yn?void 0:Yn.evaluation_outputs),j=null!==(l=null==W?void 0:W.output_value)&&void 0!==l?l:null,P=null!==(r=null===(d=null==W?void 0:W.metadata)||void 0===d?void 0:d.label_color)&&void 0!==r?r:qn,E=m(P),K=O?n(n({},O),{badgeBg:E.badgeBg,badgeBorder:E.badgeBorder,badgeText:E.badgeText}):n({},E),L=(null==c?void 0:c.deviation_summary)?{deviation_summary:c.deviation_summary,deviation_title:(null==c?void 0:c.deviation_title)||(null==Yn?void 0:Yn.deviation_title),deviation_impact:(null==c?void 0:c.deviation_impact)||(null==Yn?void 0:Yn.deviation_impact),deviation_explanation:(null==c?void 0:c.deviation_explanation)||(null==Yn?void 0:Yn.deviation_explanation),evaluation_outputs:W,cognitive_decisioning:(null==c?void 0:c.cognitive_decisioning)||(null==Yn?void 0:Yn.cognitive_decisioning)}:null,z=0,G=Rn||"";if(v&&G){var H=G.split(/\n{2,}/),V=H.findIndex(function(n){return n.includes(v)});if(-1!==V){var X=Object.entries(Qn).filter(function(n){n[0];var e=n[1][Y];return e&&H[V].includes(e)}).sort(function(n,e){return H[V].indexOf(n[1][Y])-H[V].indexOf(e[1][Y])}),q=X.filter(function(n){n[0];var e=n[1][Y];return e&&(e.includes(v)||v.includes(e))});q.length>1&&(z=Math.max(0,q.findIndex(function(n){return n[0]===a})))}}var J=rn(D,u);return{id:u,actionId:_,label:R,highlight:v,side:D,style:K,stackIndex:z,score:j,isConnected:null==un?void 0:un.has(_),showScrollLockToggle:(null==un?void 0:un.has(_))||xn&&hn===_||!!In&&In===J.current,scrollSyncLocked:gn,toggleScrollSyncLocked:mn,isOrphan:k,isMissingClause:f,badgeRef:J,onClick:function(n){n.stopPropagation(),sn&&sn(n,Dn||{id:"orphan-left",title:"",content:""},k,Kn||{id:"orphan-right",title:"",content:""},_,K)},onSummaryClick:function(n){n.stopPropagation(),an(n,_,k,L)}}}).filter(Boolean),de=$||!_n&&wn?le:[],re=le.map(function(n){return n.highlight}).filter(Boolean),ae=N.id&&D===(null==V?void 0:V.columnKey)?V:null,ce=o.useRef(!1);return t(function(){G||(ce.current=!1)},[G]),e(l,n({ref:K,sx:{mb:z,width:"100%",display:"flex",flexDirection:"column",position:"relative",minWidth:0}},{children:[G&&(null==ae?void 0:ae.showAbove)&&i("div",n({style:{position:"sticky",top:0,height:"0px",cursor:"pointer"},onClick:function(){var n,e;return null===(e=null===(n=null==ae?void 0:ae.showAboveRef)||void 0===n?void 0:n.current)||void 0===e?void 0:e.scrollIntoView({behavior:"smooth",block:"center"})}},{children:i("div",n({style:n({transform:"translateY(-50%) translateX(calc(100% ".concat("left"===D?"+":"-"," 130px))"),position:"absolute",paddingTop:"20px"},"left"===D?{right:"-20px"}:{left:"-20px"})},{children:i(s,{color:(null===(P=null==ae?void 0:ae.showAboveRef)||void 0===P?void 0:P.current)?window.getComputedStyle(ae.showAboveRef.current).color:void 0})}))})),e(d,n({disableGutters:!0,expanded:!Mn&&G,onChange:function(){Mn||(H(),J.current=N.id)},sx:{boxShadow:"none",border:Mn?"1px dashed #E2E8F0":"1px solid #E2E8F0",bgcolor:Mn?"#FAFAFA":"#FFFFFF",borderRadius:"6px",flexGrow:1,width:"100%",display:"flex",flexDirection:"column",minWidth:0,"&:before":{display:"none"},"& .MuiAccordion-heading":{position:"sticky",top:-12,zIndex:10,background:"#fff"}}},{children:[i(r,n({expandIcon:Mn?null:i(v,{size:16}),sx:{minHeight:"36px",flexShrink:0,cursor:Mn?"default":"pointer","& .MuiAccordionSummary-content":{my:.5,display:"grid",alignItems:"center",minWidth:0,width:"100%"},"& .MuiAccordionSummary-expandIconWrapper":{transition:"transform 0.2s ease"},"& .MuiAccordionSummary-expandIconWrapper.Mui-expanded":{transform:"rotate(180deg)"}}},{children:bn&&i(a,n({title:An,placement:"top"},{children:i(c,n({component:"div",sx:{fontSize:"12px",color:Mn?"#94A3B8":"#19213D",fontWeight:Mn?400:700,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0}},{children:(te=An,te?y(te).replace(/\\n/g,"\n").split(/(\*\*.*?\*\*)/g).map(function(n,e){return n.startsWith("**")&&n.endsWith("**")?i("strong",{children:n.slice(2,-2)},e):i(o.Fragment,{children:n},e)}):null)}))}))})),!Mn&&e(u,n({sx:{pt:0,pb:1.25,bgcolor:"#FFFFFF",flex:1,display:"flex",flexDirection:"column",minWidth:0}},{children:[Cn&&i(f,{content:Rn,overlayContent:Bn,sxStyles:Q,highlights:re,maintainRelativeOrder:U,highlightBg:Jn,suppressHighlightBg:Fn,deviationBadges:de,collisionKey:yn}),(N.subsections||[]).map(function(n,e){return nn({section:n,keyPath:"".concat(T,"-").concat(e),depth:0,columnKey:D,parentNodeId:Y,sectionOffset:Ln})})]}))]})),G&&(null==ae?void 0:ae.showBelow)&&i("div",n({style:{position:"sticky",bottom:0,height:"0px",cursor:"pointer"},onClick:function(){var n,e;return null===(e=null===(n=null==ae?void 0:ae.showBelowRef)||void 0===n?void 0:n.current)||void 0===e?void 0:e.scrollIntoView({behavior:"smooth",block:"center"})}},{children:i("div",n({style:n({transform:"translateY(-50%) translateX(calc(100% ".concat("left"===D?"+":"-"," 130px))"),position:"absolute",paddingBottom:"20px"},"left"===D?{right:"-20px"}:{left:"-20px"})},{children:i(v,{color:(null===(E=null==ae?void 0:ae.showBelowRef)||void 0===E?void 0:E.current)?window.getComputedStyle(ae.showBelowRef.current).color:void 0})}))}))]}),"".concat(D,"-sec-").concat(T))};export{S as default};
|
|
1
|
+
import{__assign as n}from"tslib";import{jsxs as i,jsx as e}from"react/jsx-runtime";import o,{useEffect as t}from"react";import{Box as l,Accordion as r,AccordionSummary as d,Tooltip as a,Typography as u,AccordionDetails as c}from"@mui/material";import{ChevronUp as s,ChevronDown as v}from"lucide-react";import{MemoizedMarkdown as f}from"../hooks/memoizedMarkdown.js";import{useCompareContext as p}from"../CompareContext.js";import{hasValue as h,hasMeaningfulRedlineTags as g,stripRedlineTags as m,generateColorPalette as x,isMissingStr as y,safeStringify as b,DEVIATION_BADGE_SEPARATOR as I}from"../CognitiveComparehelpers.js";import{DEFAULT_DEVIAION_COLOR as w}from"../CognitiveCompareConstants.js";var S=function(S){var _,F,k,R,B,C,M,A,O,N,W,j,P,E=S.section,T=S.idx,D=S.columnKey,K=S.colRef,L=S.mb,z=void 0===L?1:L,G=S.isExpanded,H=S.onToggle,V=S.navigation,X=S.parentNodeId,Y=void 0===X?"":X,q=p(),J=q.showOpenNodeRef,Q=q.resolvedMarkdownStyles,U=q.maintainRelativeOrder,Z=q.showDeviationBadges,$=void 0!==Z&&Z,nn=q.renderSubSectionAccordion,en=q.treeData,on=q.proposedSections,tn=q.existingSections,ln=q.deviationNumberRegistry,rn=q.deviationParentRegistry,dn=q.getBadgeRef,an=q.openSummaryPopup,un=q.getSectionCompareStyle,cn=q.connectedSections,sn=q.openMoreFunctionsPopup,vn=q.isProposingFix,fn=q.proposingFixNodeId,pn=q.isRedlineFlow,hn=q.isSideBySide,gn=q.activeSideBySideSection,mn=q.scrollSyncLocked,xn=q.unifiedNumbering,yn=q.toggleScrollSyncLocked,bn=q.summaryPopupAnchorEl,In="".concat(hn?"1":"0","-").concat(String(null!=gn?gn:"")),wn=(null===(_=E.displayTitle)||void 0===_||_)&&h(E.title),Sn=!!vn&&!!fn&&"left"===D&&E.id===fn,_n=g(E.content),Fn="boolean"==typeof pn?pn:_n,kn=_n,Rn=Fn&&_n,Bn=Rn?m(E.content):E.content,Cn=Rn?E.content:void 0,Mn=(null===(F=E.displayContent)||void 0===F||F||_n)&&h(E.content),An=!wn&&!Mn,On=E.title;wn||(On=Mn?"No Title Found":"No Matching Section Found");var Nn=E.evaluationResult;if(!Nn&&"right"===D)if(U){var Wn=null===(k=E.refIndexes)||void 0===k?void 0:k[0],jn=on.find(function(n){return n.selfIndex===Wn});Nn=null==jn?void 0:jn.evaluationResult}else Nn=null===(R=on[T])||void 0===R?void 0:R.evaluationResult;var Pn=null===(B=null==en?void 0:en.input_index_map)||void 0===B?void 0:B[0],En=null===(C=null==en?void 0:en.input_index_map)||void 0===C?void 0:C[1],Tn="left"===D?En:Pn,Dn=function(n,i){var e;if(!i||!n)return null;for(var o=0,t=n;o<t.length;o++){var l=t[o];if(l.id===i)return l;if(null===(e=l.subsections)||void 0===e?void 0:e.length){var r=Dn(l.subsections,i);if(r)return r}}return null},Kn="left"===D?E:Dn(on,E.id),Ln="right"===D?E:Dn(tn,E.id),zn=o.useMemo(function(){if(!U)return 0;var n=1/0,i=function(e,o,t,l){var r;if(e){var d=e.id;if(l&&"right"===D){var a=on.filter(function(n){var i;return null===(i=n.refIndexes)||void 0===i?void 0:i.includes(e.selfIndex)});a.length>0&&(d=a[0].id)}var u=e.id||(null==o?void 0:o.id)||(null==t?void 0:t.id),c=(null===(r=e.evaluationResult)||void 0===r?void 0:r.deviations)||{};Object.keys(c).forEach(function(i){var e="".concat(d).concat(I).concat(i),o=null==ln?void 0:ln[e];null!=o&&o<n&&(n=o);var t="".concat(u).concat(I).concat(i),l=null==ln?void 0:ln[t];null!=l&&l<n&&(n=l)});for(var s=e.subsections||[],v=(null==o?void 0:o.subsections)||[],f=(null==t?void 0:t.subsections)||[],p=Math.max(s.length,v.length,f.length),h=0;h<p;h++)i(s[h],v[h],f[h],!1)}};return i(E,Kn,Ln,!0),n!==1/0?n-1:0},[E,Kn,Ln,D,ln,U,on]);if(U)if("left"===D){var Gn=null===(M=E.refIndexes)||void 0===M?void 0:M[0],Hn=tn.findIndex(function(n){return n.selfIndex===Gn});Ln=-1!==Hn?tn[Hn]:Dn(tn,E.id)}else{var Vn=null===(A=E.refIndexes)||void 0===A?void 0:A[0],Xn=on.findIndex(function(n){return n.selfIndex===Vn});Kn=-1!==Xn?on[Xn]:Dn(on,E.id)}var Yn="left"===D?!Ln:!Kn,qn=Nn||(null==Kn?void 0:Kn.evaluationResult)||(null==Ln?void 0:Ln.evaluationResult),Jn=null!==(W=null===(N=null===(O=null==qn?void 0:qn.evaluation_outputs)||void 0===O?void 0:O.metadata)||void 0===N?void 0:N.label_color)&&void 0!==W?W:w,Qn=x(Jn).highlightBg,Un=(null==qn?void 0:qn.deviations)||{},Zn=E.id;if(U&&"left"!==D){var $n=on.filter(function(n){var i;return null===(i=n.refIndexes)||void 0===i?void 0:i.includes(E.selfIndex)});$n.length>0?Zn=$n[0].id:(null==Kn?void 0:Kn.id)&&(Zn=Kn.id)}var ni=Object.keys(Un)[0],ii=ni?"".concat(Zn).concat(I).concat(ni):null,ei=ii?null==rn?void 0:rn[ii]:null,oi=T+1;if(U&&xn){var ti="left"===D?xn.leftNums.get(null==E?void 0:E.id):xn.rightNums.get(null==E?void 0:E.id);Yn&&void 0!==ti?oi=ti:null!=ei&&ei>=0?oi=ei:void 0!==ti&&(oi=ti)}else null!=ei&&ei>=0&&(oi=ei);var li=Object.entries(Un).map(function(n){var i=n[0],e=n[1],o="".concat(Zn).concat(I).concat(i);return{deviationKey:i,deviationMap:e,refId:o,currentIndex:ln[o]}}).filter(function(n){return void 0!==n.currentIndex&&null!==n.currentIndex});li.sort(function(n,i){return n.currentIndex-i.currentIndex});var ri,di=li.map(function(i){var e,o,t,l,r,d,a=i.deviationKey,u=i.deviationMap,c=i.refId,s=i.currentIndex;U&&void 0!==zn&&(s-=zn);var v=u[Y],f=y(v);if(f)v="";else if(!v)return null;var p=T,h=T;if(U)if("left"===D){var g=null===(e=E.refIndexes)||void 0===e?void 0:e[0],m=tn.findIndex(function(n){return n.selfIndex===g});if(-1!==m)h=m;else{var b=tn.findIndex(function(n){return n.id===E.id});h=-1!==b?b:T}}else{var w=null===(o=E.refIndexes)||void 0===o?void 0:o[0],S=on.findIndex(function(n){return n.selfIndex===w});if(-1!==S)p=S;else p=-1!==(C=on.findIndex(function(n){return n.id===E.id}))?C:T}var _="".concat(Zn).concat(I).concat(a).concat(I).concat(p).concat(I).concat(h),F=u[Tn],k=Yn||y(F),R="".concat(oi,".").concat(s),B=T;if("right"===D&&U){var C,M=null===(t=E.refIndexes)||void 0===t?void 0:t[0],A=on.findIndex(function(n){return n.selfIndex===M});if(-1!==A)B=A;else-1!==(C=on.findIndex(function(n){return n.id===E.id}))&&(B=C)}var O=un?un(B):null,N=(null==u?void 0:u.evaluation_outputs)||(null==qn?void 0:qn.evaluation_outputs),W=null!==(l=null==N?void 0:N.output_value)&&void 0!==l?l:null,j=null!==(d=null===(r=null==N?void 0:N.metadata)||void 0===r?void 0:r.label_color)&&void 0!==d?d:Jn,P=x(j),K=O?n(n({},O),{badgeBg:P.badgeBg,badgeBorder:P.badgeBorder,badgeText:P.badgeText}):n({},P),L=(null==u?void 0:u.deviation_summary)?{deviation_summary:u.deviation_summary,deviation_title:(null==u?void 0:u.deviation_title)||(null==qn?void 0:qn.deviation_title),deviation_impact:(null==u?void 0:u.deviation_impact)||(null==qn?void 0:qn.deviation_impact),deviation_explanation:(null==u?void 0:u.deviation_explanation)||(null==qn?void 0:qn.deviation_explanation),evaluation_outputs:N,cognitive_decisioning:(null==u?void 0:u.cognitive_decisioning)||(null==qn?void 0:qn.cognitive_decisioning)}:null,z=0,G=Bn||"";if(v&&G){var H=G.split(/\n{2,}/),V=H.findIndex(function(n){return n.includes(v)});if(-1!==V){var X=Object.entries(Un).filter(function(n){n[0];var i=n[1][Y];return i&&H[V].includes(i)}).sort(function(n,i){return H[V].indexOf(n[1][Y])-H[V].indexOf(i[1][Y])}),q=X.filter(function(n){n[0];var i=n[1][Y];return i&&(i.includes(v)||v.includes(i))});q.length>1&&(z=Math.max(0,q.findIndex(function(n){return n[0]===a})))}}var J=dn(D,c);return{id:c,actionId:_,label:R,highlight:v,side:D,style:K,stackIndex:z,score:W,isConnected:null==cn?void 0:cn.has(_),showScrollLockToggle:(null==cn?void 0:cn.has(_))||hn&&gn===_||!!bn&&bn===J.current,scrollSyncLocked:mn,toggleScrollSyncLocked:yn,isOrphan:k,isMissingClause:f,badgeRef:J,onClick:function(n){n.stopPropagation(),sn&&sn(n,Kn||{id:"orphan-left",title:"",content:""},k,Ln||{id:"orphan-right",title:"",content:""},_,K)},onSummaryClick:function(n){n.stopPropagation(),an(n,_,k,L)}}}).filter(Boolean),ai=$||!Fn&&Sn?di:[],ui=di.map(function(n){return n.highlight}).filter(Boolean),ci=E.id&&D===(null==V?void 0:V.columnKey)?V:null,si=o.useRef(!1);return t(function(){G||(si.current=!1)},[G]),i(l,n({ref:K,sx:{mb:z,width:"100%",display:"flex",flexDirection:"column",position:"relative",minWidth:0}},{children:[G&&(null==ci?void 0:ci.showAbove)&&e("div",n({style:{position:"sticky",top:0,height:"0px",cursor:"pointer"},onClick:function(){var n,i;return null===(i=null===(n=null==ci?void 0:ci.showAboveRef)||void 0===n?void 0:n.current)||void 0===i?void 0:i.scrollIntoView({behavior:"smooth",block:"center"})}},{children:e("div",n({style:n({transform:"translateY(-50%) translateX(calc(100% ".concat("left"===D?"+":"-"," 130px))"),position:"absolute",paddingTop:"20px"},"left"===D?{right:"-20px"}:{left:"-20px"})},{children:e(s,{color:(null===(j=null==ci?void 0:ci.showAboveRef)||void 0===j?void 0:j.current)?window.getComputedStyle(ci.showAboveRef.current).color:void 0})}))})),i(r,n({disableGutters:!0,expanded:!An&&G,onChange:function(){An||(H(),J.current=E.id)},sx:{boxShadow:"none",border:An?"1px dashed #E2E8F0":"1px solid #E2E8F0",bgcolor:An?"#FAFAFA":"#FFFFFF",borderRadius:"6px",flexGrow:1,width:"100%",display:"flex",flexDirection:"column",minWidth:0,"&:before":{display:"none"},"& .MuiAccordion-heading":{position:"sticky",top:-12,zIndex:10,background:"#fff"}}},{children:[e(d,n({expandIcon:An?null:e(v,{size:16}),sx:{minHeight:"36px",flexShrink:0,cursor:An?"default":"pointer","& .MuiAccordionSummary-content":{my:.5,display:"grid",alignItems:"center",minWidth:0,width:"100%"},"& .MuiAccordionSummary-expandIconWrapper":{transition:"transform 0.2s ease"},"& .MuiAccordionSummary-expandIconWrapper.Mui-expanded":{transform:"rotate(180deg)"}}},{children:wn&&e(a,n({title:On,placement:"top"},{children:e(u,n({component:"div",sx:{fontSize:"12px",color:An?"#94A3B8":"#19213D",fontWeight:An?400:700,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0}},{children:(ri=On,ri?b(ri).replace(/\\n/g,"\n").split(/(\*\*.*?\*\*)/g).map(function(n,i){return n.startsWith("**")&&n.endsWith("**")?e("strong",{children:n.slice(2,-2)},i):e(o.Fragment,{children:n},i)}):null)}))}))})),!An&&i(c,n({sx:{pt:0,pb:1.25,bgcolor:"#FFFFFF",flex:1,display:"flex",flexDirection:"column",minWidth:0}},{children:[Mn&&e(f,{content:Bn,overlayContent:Cn,sxStyles:Q,highlights:ui,maintainRelativeOrder:U,highlightBg:Qn,suppressHighlightBg:kn,deviationBadges:ai,collisionKey:In}),(E.subsections||[]).map(function(n,i){return nn({section:n,keyPath:"".concat(T,"-").concat(i),depth:0,columnKey:D,parentNodeId:Y,sectionOffset:zn})})]}))]})),G&&(null==ci?void 0:ci.showBelow)&&e("div",n({style:{position:"sticky",bottom:0,height:"0px",cursor:"pointer"},onClick:function(){var n,i;return null===(i=null===(n=null==ci?void 0:ci.showBelowRef)||void 0===n?void 0:n.current)||void 0===i?void 0:i.scrollIntoView({behavior:"smooth",block:"center"})}},{children:e("div",n({style:n({transform:"translateY(-50%) translateX(calc(100% ".concat("left"===D?"+":"-"," 130px))"),position:"absolute",paddingBottom:"20px"},"left"===D?{right:"-20px"}:{left:"-20px"})},{children:e(v,{color:(null===(P=null==ci?void 0:ci.showBelowRef)||void 0===P?void 0:P.current)?window.getComputedStyle(ci.showBelowRef.current).color:void 0})}))}))]}),"".concat(D,"-sec-").concat(T))};export{S as default};
|
|
2
2
|
//# sourceMappingURL=SectionAccordion.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as n}from"tslib";import{jsx as i,jsxs as e}from"react/jsx-runtime";import t from"react";import{Box as
|
|
1
|
+
import{__assign as n}from"tslib";import{jsx as i,jsxs as e}from"react/jsx-runtime";import t,{useMemo as o}from"react";import{Box as l,Accordion as d,AccordionSummary as r,Typography as a,AccordionDetails as u}from"@mui/material";import{ChevronDown as c}from"lucide-react";import{MemoizedMarkdown as s}from"../hooks/memoizedMarkdown.js";import{useCompareContext as v}from"../CompareContext.js";import{hasValue as f,hasMeaningfulRedlineTags as p,stripRedlineTags as h,generateColorPalette as m,isMissingStr as g,DEVIATION_BADGE_SEPARATOR as x}from"../CognitiveComparehelpers.js";import{DEFAULT_DEVIAION_COLOR as y}from"../CognitiveCompareConstants.js";var S=t.memo(function(t){var b,_,I,k,C,P,w,B,F,R,O=t.section,N=t.keyPath,j=t.depth,M=void 0===j?0:j,E=t.columnKey,K=void 0===E?"left":E,W=t.parentNodeId,L=void 0===W?"":W,z=t.sectionOffset,A=v(),D=A.expandedSubSections,H=A.setExpandedSubSections,T=A.maintainRelativeOrder,G=A.showDeviationBadges,U=void 0!==G&&G,q=A.proposedSections,J=A.existingSections,Q=A.treeData,V=A.deviationNumberRegistry,X=A.deviationParentRegistry,Y=A.connectedSections,Z=A.activeSideBySideSection,$=A.isSideBySide,nn=A.scrollSyncLocked,en=A.toggleScrollSyncLocked,tn=A.summaryPopupAnchorEl,on=A.resolvedMarkdownStyles,ln=A.getSubSectionRef,dn=A.getSubSectionCompareStyle,rn=A.getBadgeRef,an=A.openMoreFunctionsPopup,un=A.openSummaryPopup,cn=A.resetSideBySide,sn=A.setConnectedSections,vn=A.setConnectedLines,fn=A.cachedConnectedPositions,pn=A.isProposingFix,hn=A.proposingFixNodeId,mn=A.isRedlineFlow,gn=A.unifiedNumbering,xn=null!=Z?Z:"",yn=(null===(b=O.displayTitle)||void 0===b||b)&&f(O.title),Sn=!!pn&&!!hn&&"left"===K&&O.id===hn,bn=p(O.content),_n="boolean"==typeof mn?mn:bn,In=bn,kn=_n&&bn,Cn=kn?h(O.content):O.content,Pn=kn?O.content:void 0,wn=(null===(_=O.displayContent)||void 0===_||_||bn)&&f(O.content),Bn=!yn&&!wn,Fn=yn?O.title:wn?"No Title Found":"No Matching Section Found",Rn=!!D[N],On=ln(K,N),Nn=N.split("-").map(Number)[0],jn=q[Nn],Mn=J[Nn],En=Nn,Kn=Nn,Wn=!1,Ln=function(n,i,e){if(!n||!i)return null;if(n.id===i)return{section:n,keyPath:e};for(var t=(n.subsections||[]).map(function(n,i){return{section:n,keyPath:"".concat(e,"-").concat(i)}}),o=function(){var n=t.shift();return(null==n?void 0:n.section)?n.section.id===i?{value:n}:void(n.section.subsections||[]).forEach(function(i,e){t.push({section:i,keyPath:"".concat(n.keyPath,"-").concat(e)})}):"continue"};t.length>0;){var l=o();if("object"==typeof l)return l.value}return null};if(T)if("left"===K){var zn=null===(I=null==jn?void 0:jn.refIndexes)||void 0===I?void 0:I[0],An=J.findIndex(function(n){return n.selfIndex===zn});-1!==An?(Mn=J[An],Kn=An):Wn=!0}else{var Dn=null===(k=null==Mn?void 0:Mn.refIndexes)||void 0===k?void 0:k[0],Hn=q.findIndex(function(n){return n.selfIndex===Dn});-1!==Hn?(jn=q[Hn],En=Hn):Wn=!0}var Tn=function(n,i){if(!i||!n)return null;for(var e=0;e<n.length;e++){var t=Ln(n[e],i,String(e));if(t)return t}return null},Gn=null,Un=null,qn="",Jn="";if(T)"left"===K?(Gn=O,qn=N,(Qn=Ln(Mn,O.id,String(Kn)))||(Qn=Tn(J,O.id)),Un=(null==Qn?void 0:Qn.section)||null,Jn=(null==Qn?void 0:Qn.keyPath)||""):(Un=O,Jn=N,(Vn=Ln(jn,O.id,String(En)))||(Vn=Tn(q,O.id)),Gn=(null==Vn?void 0:Vn.section)||null,qn=(null==Vn?void 0:Vn.keyPath)||"");else if("left"===K){Gn=O,qn=N;var Qn=Tn(J,O.id);Un=(null==Qn?void 0:Qn.section)||null,Jn=(null==Qn?void 0:Qn.keyPath)||""}else{Un=O,Jn=N;var Vn=Tn(q,O.id);Gn=(null==Vn?void 0:Vn.section)||null,qn=(null==Vn?void 0:Vn.keyPath)||""}var Xn=(qn?dn(qn):null)||dn(N),Yn=null===(C=null==Q?void 0:Q.input_index_map)||void 0===C?void 0:C[0],Zn=null===(P=null==Q?void 0:Q.input_index_map)||void 0===P?void 0:P[1],$n="left"===K?Zn:Yn,ni="left"===K?!Un:!Gn,ii=O.evaluationResult||(null==Gn?void 0:Gn.evaluationResult)||(null==Un?void 0:Un.evaluationResult),ei=(null==ii?void 0:ii.deviations)||{},ti=O.id||(null==Gn?void 0:Gn.id)||(null==Un?void 0:Un.id);T&&"left"!==K&&(null==Gn?void 0:Gn.id)&&(ti=Gn.id);var oi=Object.keys(ei)[0],li=oi?"".concat(ti).concat(x).concat(oi):null,di=li?null==X?void 0:X[li]:null,ri=Nn+1;if(T&&gn){var ai="left"===K?gn.leftNums.get(null==jn?void 0:jn.id):gn.rightNums.get(null==Mn?void 0:Mn.id);Wn&&void 0!==ai?ri=ai:null!=di&&di>=0?ri=di:void 0!==ai&&(ri=ai)}else null!=di&&di>=0&&(ri=di);var ui=null!==(F=null===(B=null===(w=null==ii?void 0:ii.evaluation_outputs)||void 0===w?void 0:w.metadata)||void 0===B?void 0:B.label_color)&&void 0!==F?F:y,ci=m(ui).highlightBg,si=Object.entries(ei).map(function(n){var i=n[0],e=n[1],t="".concat(ti).concat(x).concat(i);return{deviationKey:i,deviationMap:e,refId:t,currentIndex:V[t]}}).filter(function(n){return void 0!==n.currentIndex&&null!==n.currentIndex});si.sort(function(n,i){return n.currentIndex-i.currentIndex});var vi=si.map(function(i){var e,t,o,l=i.deviationKey,d=i.deviationMap,r=i.refId,a=i.currentIndex;T&&void 0!==z&&(a-=z);var u=d[L],c=g(u);if(c)u="";else if(!u)return null;var s=d[$n],v=ni||g(s),f="".concat(ri,".").concat(a),p="".concat(ti).concat(x).concat(l).concat(x).concat(qn).concat(x).concat(Jn),h=(null==d?void 0:d.evaluation_outputs)||(null==ii?void 0:ii.evaluation_outputs),y=null!==(e=null==h?void 0:h.output_value)&&void 0!==e?e:null,S=null!==(o=null===(t=null==h?void 0:h.metadata)||void 0===t?void 0:t.label_color)&&void 0!==o?o:ui,b=m(S),_=n({},b),I=(null==d?void 0:d.deviation_summary)?{deviation_summary:d.deviation_summary||(null==ii?void 0:ii.deviation_summary),deviation_title:(null==d?void 0:d.deviation_title)||(null==ii?void 0:ii.deviation_title),deviation_impact:(null==d?void 0:d.deviation_impact)||(null==ii?void 0:ii.deviation_impact),deviation_explanation:(null==d?void 0:d.deviation_explanation)||(null==ii?void 0:ii.deviation_explanation),evaluation_outputs:h,cognitive_decisioning:(null==d?void 0:d.cognitive_decisioning)||(null==ii?void 0:ii.cognitive_decisioning)}:null,k=0,C=Cn||"";if(u&&C){var P=C.split(/\n{2,}/),w=P.findIndex(function(n){return n.includes(u)});if(-1!==w){var B=Object.entries(ei).filter(function(n){n[0];var i=n[1][L];return i&&P[w].includes(i)}).sort(function(n,i){return P[w].indexOf(n[1][L])-P[w].indexOf(i[1][L])}),F=B.filter(function(n){n[0];var i=n[1][L];return i&&(i.includes(u)||u.includes(i))});F.length>1&&(k=Math.max(0,F.findIndex(function(n){return n[0]===l})))}}var R=rn(K,r);return{id:r,actionId:p,label:f,highlight:u,side:K,style:_,stackIndex:k,score:y,isConnected:Y.has(p),showScrollLockToggle:Y.has(p)||$&&Z===p||!!tn&&tn===R.current,scrollSyncLocked:nn,toggleScrollSyncLocked:en,isOrphan:v,isMissingClause:c,badgeRef:R,onClick:function(i){i.stopPropagation();var e=Gn?n(n({},Gn),{title:(null==jn?void 0:jn.title)||(null==Gn?void 0:Gn.title)||""}):{id:"orphan-left",title:"",content:""},t=Un?n(n({},Un),{title:(null==Mn?void 0:Mn.title)||(null==Un?void 0:Un.title)||""}):{id:"orphan-right",title:"",content:""};an(i,e,v,t,p,_)},onSummaryClick:function(n){n.stopPropagation(),un(n,p,v,I)}}}).filter(Boolean).sort(function(n,i){return parseFloat(n.label)-parseFloat(i.label)}),fi=o(function(){var n=new Set;return vi.filter(function(i){return!n.has(i.id)&&(n.add(i.id),!0)})},[vi]),pi=U||!_n&&Sn?fi:[],hi=fi.map(function(n){return n.highlight}).filter(Boolean),mi=vi.find(function(n){return Y.has(n.actionId)}),gi=!!mi;if(!(yn||wn||O.subsections&&0!==O.subsections.length))return null;var xi=(null===(R=null==mi?void 0:mi.style)||void 0===R?void 0:R.badgeBorder)||(null==Xn?void 0:Xn.badgeBorder),yi=gi&&xi?{borderRadius:"4px",outline:"2px solid ".concat(xi),outlineOffset:"1px"}:{};return i(l,yn?n({ref:On,sx:{mt:1,width:"100%",minWidth:0,position:"relative"}},{children:i(l,n({sx:n({width:"100%"},yi)},{children:e(d,n({disableGutters:!0,expanded:!Bn&&Rn,onChange:function(){if(!Bn){if(Rn){var i=String(Z||""),e=i.includes(qn)||i.includes(Jn);e||Y.forEach(function(n){(String(n).includes(qn)||String(n).includes(Jn))&&(e=!0)}),e&&(cn(),sn(new Set),vn([]),fn.current=[])}H(function(i){var e;return n(n({},i),((e={})[N]=!i[N],e))})}},sx:{mt:0,boxShadow:"none",border:Bn?"1px dashed #E2E8F0":"1px solid #EEF2F7",borderRadius:"4px !important",bgcolor:"#FFFFFF",minWidth:0,"&:before":{display:"none"}}},{children:[i(r,n({expandIcon:Bn?null:i(c,{size:14}),sx:{minHeight:"32px","& .MuiAccordionSummary-content":{my:.5,display:"grid",alignItems:"center",minWidth:0,width:"100%"}}},{children:i(a,n({component:"div",sx:{fontSize:"11px",fontWeight:600,color:Bn?"#94A3B8":"#19213D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0}},{children:Fn||"Untitled Subsection"}))})),!Bn&&e(u,n({sx:{pt:0,pb:1,minWidth:0}},{children:[wn&&i(s,{content:Cn,overlayContent:Pn,sxStyles:on,deviationBadges:pi,maintainRelativeOrder:T,highlightBg:ci,suppressHighlightBg:In,highlights:hi,collisionKey:xn}),(O.subsections||[]).map(function(n,e){return i(S,{section:n,keyPath:"".concat(N,"-").concat(e),depth:M+1,columnKey:K,parentNodeId:L},"".concat(N,"-").concat(e))})]}))]}))}))}):n({ref:On,sx:{mt:0===M?1:.75,width:"100%",minWidth:0,position:"relative"}},{children:!Bn&&e(l,n({sx:n({width:"100%"},yi)},{children:[wn&&i(s,{content:Cn,overlayContent:Pn,sxStyles:on,deviationBadges:pi,maintainRelativeOrder:T,highlightBg:ci,suppressHighlightBg:In,highlights:hi,collisionKey:xn}),(O.subsections||[]).map(function(n,e){return i(S,{section:n,keyPath:"".concat(N,"-").concat(e),depth:M+1,columnKey:K,parentNodeId:L,sectionOffset:z},"".concat(N,"-").concat(e))})]}))}))});export{S as default};
|
|
2
2
|
//# sourceMappingURL=SubSectionAccordion.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as n,__rest as e}from"tslib";import{jsx as t,jsxs as r,Fragment as i}from"react/jsx-runtime";import{Box as o,Typography as a}from"@mui/material";import l,{useRef as c,useMemo as d,useLayoutEffect as s}from"react";import{DEFAULT_DEVIAION_COLOR as u}from"../CognitiveCompareConstants.js";import{EllipsisVertical as h}from"lucide-react";import p from"react-markdown";import{mixHexColors as g,areMarkdownPropsEqual as f}from"../CognitiveComparehelpers.js";import v from"rehype-raw";import m from"remark-gfm";var x=function(n){return"function"==typeof n?n:(null==n?void 0:n.default)||n},b=[x(m)],y=[x(v)],E=l.memo(function(f){var v=f.content,m=f.overlayContent,x=f.sxStyles,E=f.deviationBadges,C=void 0===E?[]:E,B=f.highlights,k=void 0===B?[]:B;f.maintainRelativeOrder;var S=f.highlightBg,F=f.suppressHighlightBg,w=void 0!==F&&F,A=f.collisionKey,z=c(null),T=!!m,I=d(function(){return C.reduce(function(e,t){var r;return n(n({},e),((r={})[t.id]=t,r))},{})},[C]),O=c({badgeMap:I,highlightBg:S,hideHighlightBg:T,suppressHighlightBg:w});O.current={badgeMap:I,highlightBg:S,hideHighlightBg:T,suppressHighlightBg:w};var M=function(e,t){return l.Children.map(e,function(e){var r;if(!l.isValidElement(e))return e;var i=(null===(r=e.props)||void 0===r?void 0:r.children)?M(e.props.children,t):e.props.children,o=l.cloneElement(e,n(n({},e.props),{children:i}));return t(o)})},j=d(function(){return{mark:function(r){var i,o,a,l,c=r.children,d=e(r,["children"]),s=O.current,u=s.badgeMap,h=s.highlightBg,p=s.hideHighlightBg,g=s.suppressHighlightBg,f=d["data-badge-id"],v=f?u[f]:null,m=d["data-highlight-color"],x=null!==(l=null!==(o=null!=m?m:null===(i=null==v?void 0:v.style)||void 0===i?void 0:i.highlightBg)&&void 0!==o?o:null===(a=null==v?void 0:v.style)||void 0===a?void 0:a.badgeBg)&&void 0!==l?l:h,b="true"===d["data-is-suggested-deviation-fix"]||g;return t("span",n({style:n(n(n({},b?{}:{backgroundColor:x}),{borderRadius:"2px",display:"inline",boxDecorationBreak:"clone",WebkitBoxDecorationBreak:"clone",backgroundClip:"padding-box",padding:"0 1px"}),p?{color:"transparent"}:{})},{children:c}))},span:function(i){var a,l,c,d,s,p,g=i.children,f=e(i,["children"]),v=O.current.badgeMap,m=f["data-badge-id"];if(!m)return t("span",n({},f,{children:g}));var x=v[m];if(!x)return t("span",n({},f,{children:g}));var b="number"==typeof x.stackIndex?x.stackIndex:0,y="translateY(calc(-20% + ".concat(12*b,"px + var(--badge-nudge, 0px)))");return r(o,n({component:"span",sx:{position:"static",display:"inline"}},{children:[r(o,n({ref:x.badgeRef,className:"deviation-badge","data-side":x.side||"right",sx:n(n({fontStyle:"normal",position:"absolute",zIndex:30+b,display:"inline-flex",alignItems:"stretch",fontSize:"10px",bgcolor:(null===(a=x.style)||void 0===a?void 0:a.badgeBg)||"#EEF2FF",color:(null===(l=x.style)||void 0===l?void 0:l.badgeText)||u,border:"1px solid ".concat((null===(c=x.style)||void 0===c?void 0:c.badgeBorder)||"#C7D2FE"),borderRadius:"12px",fontWeight:600,whiteSpace:"nowrap",boxShadow:"0 1px 3px rgba(0,0,0,0.07)",overflow:"hidden",transition:"none"},"left"===x.side?{right:"-16px",transform:"".concat(y," translateX(calc(100% + 8px))")}:{left:"-16px",transform:"".concat(y," translateX(calc(-100% - 8px))")}),x.isConnected&&x.style&&{outline:"2px solid ".concat(x.style.badgeBorder),outlineOffset:"1px"})},{children:[r(o,n({onClick:function(n){n.stopPropagation(),x.onSummaryClick&&x.onSummaryClick(n)},sx:{display:"flex",alignItems:"center",px:1,py:.3,cursor:"pointer","&:hover":{bgcolor:"rgba(0,0,0,0.04)"}}},{children:[t(o,n({component:"span",sx:{fontSize:"10px",fontWeight:700}},{children:x.label})),("left"===x.side||x.isOrphan)&&t(o,n({component:"span",sx:{fontSize:"10px",pl:.5,ml:.5,borderLeft:"1px solid ".concat((null===(d=x.style)||void 0===d?void 0:d.badgeBorder)||"#C7D2FE")}},{children:null!=x.score&&"N/A"!==x.score&&"NA"!==x.score&&0!==x.score?"".concat(x.score):"N/A"===x.score||"NA"===x.score?"N/A":"Same"}))]})),("left"===x.side||x.isOrphan)&&t(o,n({onClick:function(n){n.stopPropagation(),x.onClick&&x.onClick(n)},sx:{display:"flex",alignItems:"center",px:.5,borderLeft:"1px solid ".concat((null===(s=x.style)||void 0===s?void 0:s.badgeBorder)||"#C7D2FE"),cursor:"pointer","&:hover":{bgcolor:"rgba(0,0,0,0.06)"}}},{children:t(h,{size:12,color:(null===(p=x.style)||void 0===p?void 0:p.badgeText)||"#3730A3"})}))]})),g]}))},table:function(e){var r=e.children;return t(o,n({component:"table",sx:{width:"100%",borderCollapse:"collapse",my:1,fontSize:"inherit"}},{children:r}))},thead:function(e){var r=e.children;return t(o,n({component:"thead"},{children:r}))},tbody:function(e){var r=e.children;return t(o,n({component:"tbody"},{children:r}))},tr:function(e){var r=e.children;return t(o,n({component:"tr",sx:{borderBottom:"1px solid #E5E7EB"}},{children:r}))},th:function(e){var r=e.children;return t(o,n({component:"th",sx:{border:"1px solid #E5E7EB",padding:"8px",textAlign:"left",fontWeight:600,backgroundColor:"#F9FAFB"}},{children:r}))},td:function(e){var r=e.children;return t(o,n({component:"td",sx:{border:"1px solid #E5E7EB",padding:"8px",verticalAlign:"top"}},{children:r}))},code:function(e){var r=e.children;return t("span",n({style:{fontFamily:"inherit",fontSize:"inherit"}},{children:r}))},pre:function(e){var r=e.children;return t("span",n({style:{fontFamily:"inherit",fontSize:"inherit",display:"block",whiteSpace:"pre-wrap"}},{children:r}))},updated:function(n){var e=n.children;return t(i,{children:e})},deleted:function(e){var r=e.children,i=M(r,function(n){return l.cloneElement(n,{"data-is-suggested-deviation-fix":"true"})});return t("span",n({style:{boxShadow:"inset 0 1px 0 #EF4444, inset 0 -1px 0 #EF4444",backgroundColor:"#FCCCCC",textDecoration:"line-through"}},{children:i}))},changed:function(e){var r=e.children,i=M(r,function(n){return l.cloneElement(n,{"data-is-suggested-deviation-fix":"true"})});return t("span",n({style:{boxShadow:"inset 0 1px 0 #2F59FF, inset 0 -1px 0 #2F59FF",backgroundColor:"#D5E8FF"}},{children:i}))}}},[]),P=function(n){if(!n||"string"!=typeof n)return"";var e=n.replace(/\\(['"])/g,"$1").replace(/\\n/g,"\n").replace(/\\\./g,".").replace(/\r\n/g,"\n"),t=(e=(e=(e=e.replace(/^(\d+\.)(\s{2,})/gm,function(n,e,t){return"".concat(e.slice(0,-1),"\\.").concat(t)})).replace(/^(\d+\.)\s*\n+(\s+)(\S)/gm,function(n,e,t,r){return"".concat(e," ").concat(r)})).replace(/([^\n])\n(#{1,6} )/g,"$1\n\n$2")).split(/(\n{2,})/);return e=t.map(function(n){return/^\n+$/.test(n)||/\|.*\|/.test(n)&&/\|[\s:|-]+\|/.test(n)||/^#{1,6} /.test(n.trimStart())?n:n.replace(/\n(?=[^\n])/g,function(e,t){var r,i=null!==(r=n[t+1])&&void 0!==r?r:"";return/^[#>|\-*+]/.test(i)||/^\d+\./.test(n.slice(t+1))?"\n":" "})}).join(""),e=e.replace(/^[ \t]+/gm,function(n){return n.replace(/ /g," ").replace(/\t/g," ")})},D=function(n){return n.replace(/[\.,;:]/g," ")},H=d(function(){return C.map(function(n){return{id:n.id,connected:n.isConnected,stackIndex:n.stackIndex,size:n.size}})},[C]),N=d(function(){var e=P(v||""),t=w?D(e):e,r=(C||[]).map(function(n){var e,t;return{id:null==n?void 0:n.id,highlight:P((null==n?void 0:n.highlight)||""),highlightColor:(null===(e=null==n?void 0:n.style)||void 0===e?void 0:e.highlightBg)||(null===(t=null==n?void 0:n.style)||void 0===t?void 0:t.badgeBg)||S}}).filter(function(n){return n.id&&n.highlight}),i={};r.forEach(function(n){i[n.highlight]||(i[n.highlight]=[]),i[n.highlight].push(n)});var o=function(n,e,t,r){void 0===e&&(e=""),void 0===r&&(r=[]);var i=!1,o=function(n){var o=function(n,e,t){var r,i,o;void 0===e&&(e="");var a=n.match(/^(\s*)([\s\S]*?)(\s*)$/);if(!a)return n;var l=null!==(r=a[1])&&void 0!==r?r:"",c=null!==(i=a[2])&&void 0!==i?i:"",d=null!==(o=a[3])&&void 0!==o?o:"";return c?l+function(n,e){void 0===n&&(n="");var t=e?' data-highlight-color="'.concat(e,'"'):"",r=n?' data-badge-id="'.concat(n,'"'):"";return"<mark".concat(r).concat(t,">")}(e,t)+c+"</mark>"+d:n}(n,e,t),a=o;if(!i&&r.length>0){i=!0;var l="",c="";r.forEach(function(n){l+=function(n){return'<span data-badge-id="'.concat(n,'">')}(n.id),c="</span>"+c}),a=l+o+c}return""+a};return n.split(/(\n+)/).map(function(n){return/^\n+$/.test(n)?n:n.trim()?""===n.replace(/[|:\-\s]/g,"")&&n.includes("-")?n:n.includes("|")?n.split(/(\|)/).map(function(n){return"|"!==n&&n.trim()?o(n):n}).join(""):o(n):n}).join("")},a=[];Object.entries(i).forEach(function(n){var r=n[0],i=n[1],o=e.indexOf(r),l=!1;if(-1===o&&w){var c=D(r);-1!==(o=t.indexOf(c))&&(l=!0)}if(-1!==o){for(var d=i[0].highlightColor,s=1;s<i.length;s++)d=g(d,i[s].highlightColor||"");a.push({highlight:r,start:o,end:o+r.length,badges:i,color:d,usedLooseMatch:l})}});var l=new Set(Object.keys(i));(k||[]).forEach(function(n){if(n){var r=P(n);if(r&&!l.has(r)){var i=e.indexOf(r),o=!1;if(-1===i&&w){var c=D(r);-1!==(i=t.indexOf(c))&&(o=!0)}if(-1!==i){var d=e.slice(0,i);(d.match(/</g)||[]).length===(d.match(/>/g)||[]).length&&a.push({highlight:r,start:i,end:i+r.length,badges:[],color:S||"",usedLooseMatch:o})}}}}),a.sort(function(n,e){return n.start-e.start||e.end-n.end});var c=[],d={};a.forEach(function(n,e){for(var t=n.start,r=n.end,i=0,o=c;i<o.length;i++){var a=o[i],l=a.start,s=a.end,u=t<s&&r>s&&t>=l,h=t<l&&r>l&&r<=s;if(t>=l&&r<=s){n.orphaned=!0,d[e]=a.matchIdx;break}u&&(t=s),h&&(r=l)}n.trimmedStart=t,n.trimmedEnd=r,!n.orphaned&&t<r&&c.push({start:t,end:r,matchIdx:e})});var s={};Object.entries(d).forEach(function(n){var e=n[0],t=n[1],r=Number(e);s[t]||(s[t]=[]),s[t].push(r)});var u=a.map(function(e,t){return n(n({},e),{idx:t})}).filter(function(n){return!n.orphaned}).sort(function(n,e){var t,r;return(null!==(t=e.trimmedStart)&&void 0!==t?t:e.start)-(null!==(r=n.trimmedStart)&&void 0!==r?r:n.start)});return u.forEach(function(n){var t,r,i,l,c=null!==(t=n.trimmedStart)&&void 0!==t?t:n.start,d=null!==(r=n.trimmedEnd)&&void 0!==r?r:n.end;if(!(c>=d)){var u=e.slice(c,d),h=function(n,e,t,r){if(!t.length)return n;var i=t.map(function(n){return a[n]}).sort(function(n,e){return n.start-e.start}),l="",c=0;return i.forEach(function(t){var i,a,d=Math.max(c,t.start-e),s=Math.max(d,t.end-e);if(!(d>=s)){var u=g(r,t.color||"");l+=n.slice(c,d),l+=o(n.slice(d,s),(null===(a=null===(i=t.badges)||void 0===i?void 0:i[0])||void 0===a?void 0:a.id)||"",u,t.badges||[]),c=s}}),l+=n.slice(c)}(n.usedLooseMatch||c!==n.start||d!==n.end?u:n.highlight,n.start,s[n.idx]||[],n.color),p=o(h,(null===(l=null===(i=n.badges)||void 0===i?void 0:i[0])||void 0===l?void 0:l.id)||"",n.color,n.badges||[]);e=e.slice(0,c)+p+e.slice(d)}}),e},[v,C,k,S,w]),R=d(function(){return m?P(m||""):""},[m]),$=!!m,L={"& *":{fontFamily:"inherit"},"& code, & pre, & kbd, & samp":{fontFamily:"inherit !important",fontSize:"inherit",background:"none",padding:0,border:"none",whiteSpace:"pre-wrap"},"& p, & li, & ul, & ol":{position:"static",overflow:"visible",whiteSpace:"pre-wrap"}},q=n(n(n(n({},x),L),{position:"relative",overflow:"visible",whiteSpace:"normal",gridArea:"1 / 1",zIndex:2}),$?{color:"transparent"}:{}),W=n(n(n({},x),L),{position:"relative",overflow:"visible",whiteSpace:"pre-wrap",gridArea:"1 / 1",zIndex:1,pointerEvents:"none"});return s(function(){if(z.current){var n=function(){var n=Array.from(z.current.querySelectorAll(".deviation-badge"));if(0!==n.length){n.forEach(function(n){n.style.setProperty("--badge-nudge","0px")});var e=n.filter(function(n){return"left"===n.dataset.side}),t=n.filter(function(n){return"left"!==n.dataset.side}),r=z.current.getBoundingClientRect(),i=r.bottom-4,o=r.top+4,a=function(n){if(0!==n.length){var e=n.map(function(n){var e=n.getBoundingClientRect();return{el:n,naturalTop:e.top,height:e.height,currentTop:e.top}});e.sort(function(n,e){return n.naturalTop-e.naturalTop});var t=[],r=[];e.forEach(function(n){if(0===r.length)r.push(n);else{var e=r[r.length-1],i=e.currentTop+e.height;n.naturalTop<i+8?(n.currentTop=i+8,r.push(n)):(t.push(r),r=[n])}}),r.length>0&&t.push(r),t.forEach(function(n){var e=n[n.length-1],t=e.currentTop+e.height;if(t>i){var r=t-i,a=n[0].currentTop-o,l=Math.max(0,Math.min(r,a));n.forEach(function(n){n.currentTop-=l})}}),t.flat().forEach(function(n){var e=n.currentTop-n.naturalTop;n.el.style.setProperty("--badge-nudge","".concat(e,"px"))})}};a(e),a(t)}},e=requestAnimationFrame(function(){requestAnimationFrame(function(){n()})}),t=new ResizeObserver(function(){requestAnimationFrame(n)});return t.observe(z.current),function(){t.disconnect(),cancelAnimationFrame(e)}}},[N,A,H]),r(o,n({ref:z,sx:{position:"relative",display:"grid"}},{children:[t(a,n({component:"div",sx:n(n({},q),{padding:"3px"})},{children:t(p,n({components:j,remarkPlugins:b,rehypePlugins:y},{children:N.replace(/#{3}/g,"")}))})),$&&t(a,n({component:"div",sx:W},{children:t(p,n({components:j,remarkPlugins:b,rehypePlugins:y},{children:R}))}))]}))},f);export{E as MemoizedMarkdown};
|
|
1
|
+
import{__assign as n,__rest as e}from"tslib";import{jsx as t,jsxs as r,Fragment as i}from"react/jsx-runtime";import{Box as o,Typography as a}from"@mui/material";import l,{useRef as c,useMemo as d,useLayoutEffect as s}from"react";import{DEFAULT_DEVIAION_COLOR as u}from"../CognitiveCompareConstants.js";import{EllipsisVertical as h}from"lucide-react";import p from"react-markdown";import{mixHexColors as g,areMarkdownPropsEqual as f}from"../CognitiveComparehelpers.js";import v from"rehype-raw";import m from"remark-gfm";var b=function(n){return"function"==typeof n?n:(null==n?void 0:n.default)||n},x=[b(m)],y=[b(v)],E=l.memo(function(f){var v=f.content,m=f.overlayContent,b=f.sxStyles,E=f.deviationBadges,C=void 0===E?[]:E,S=f.highlights,k=void 0===S?[]:S;f.maintainRelativeOrder;var B=f.highlightBg,F=f.suppressHighlightBg,w=void 0!==F&&F,A=f.collisionKey,T=c(null),z=!!m,I=d(function(){return C.reduce(function(e,t){var r;return n(n({},e),((r={})[t.id]=t,r))},{})},[C]),O=c({badgeMap:I,highlightBg:B,hideHighlightBg:z,suppressHighlightBg:w});O.current={badgeMap:I,highlightBg:B,hideHighlightBg:z,suppressHighlightBg:w};var M=function(e,t){return l.Children.map(e,function(e){var r;if(!l.isValidElement(e))return e;var i=(null===(r=e.props)||void 0===r?void 0:r.children)?M(e.props.children,t):e.props.children,o=l.cloneElement(e,n(n({},e.props),{children:i}));return t(o)})},$=d(function(){return{mark:function(r){var i,o,a,l,c=r.children,d=e(r,["children"]),s=O.current,u=s.badgeMap,h=s.highlightBg,p=s.hideHighlightBg,g=s.suppressHighlightBg,f=d["data-badge-id"],v=f?u[f]:null,m=d["data-highlight-color"],b=null!==(l=null!==(o=null!=m?m:null===(i=null==v?void 0:v.style)||void 0===i?void 0:i.highlightBg)&&void 0!==o?o:null===(a=null==v?void 0:v.style)||void 0===a?void 0:a.badgeBg)&&void 0!==l?l:h,x="true"===d["data-is-suggested-deviation-fix"]||g;return t("span",n({style:n(n(n({},x?{}:{backgroundColor:b}),{borderRadius:"2px",display:"inline",boxDecorationBreak:"clone",WebkitBoxDecorationBreak:"clone",backgroundClip:"padding-box",padding:"0 1px"}),p?{color:"transparent"}:{})},{children:c}))},span:function(i){var a,l,c,d,s,p,g=i.children,f=e(i,["children"]),v=O.current.badgeMap,m=f["data-badge-id"];if(!m)return t("span",n({},f,{children:g}));var b=v[m];if(!b)return t("span",n({},f,{children:g}));var x="number"==typeof b.stackIndex?b.stackIndex:0,y="translateY(calc(-20% + ".concat(12*x,"px + var(--badge-nudge, 0px)))");return r(o,n({component:"span",sx:{position:"static",display:"inline"}},{children:[r(o,n({ref:b.badgeRef,className:"deviation-badge","data-side":b.side||"right",sx:n(n({fontStyle:"normal",position:"absolute",zIndex:30+x,display:"inline-flex",alignItems:"stretch",fontSize:"10px",bgcolor:(null===(a=b.style)||void 0===a?void 0:a.badgeBg)||"#EEF2FF",color:(null===(l=b.style)||void 0===l?void 0:l.badgeText)||u,border:"1px solid ".concat((null===(c=b.style)||void 0===c?void 0:c.badgeBorder)||"#C7D2FE"),borderRadius:"12px",fontWeight:600,whiteSpace:"nowrap",boxShadow:"0 1px 3px rgba(0,0,0,0.07)",overflow:"hidden",transition:"none"},"left"===b.side?{right:"-16px",transform:"".concat(y," translateX(calc(100% + 8px))")}:{left:"-16px",transform:"".concat(y," translateX(calc(-100% - 8px))")}),b.isConnected&&b.style&&{outline:"2px solid ".concat(b.style.badgeBorder),outlineOffset:"1px"})},{children:[r(o,n({onClick:function(n){n.stopPropagation(),b.onSummaryClick&&b.onSummaryClick(n)},sx:{display:"flex",alignItems:"center",px:1,py:.3,cursor:"pointer","&:hover":{bgcolor:"rgba(0,0,0,0.04)"}}},{children:[t(o,n({component:"span",sx:{fontSize:"10px",fontWeight:700}},{children:b.label})),("left"===b.side||b.isOrphan)&&t(o,n({component:"span",sx:{fontSize:"10px",pl:.5,ml:.5,borderLeft:"1px solid ".concat((null===(d=b.style)||void 0===d?void 0:d.badgeBorder)||"#C7D2FE")}},{children:null!=b.score&&"N/A"!==b.score&&"NA"!==b.score&&0!==b.score?"".concat(b.score):"N/A"===b.score||"NA"===b.score?"N/A":"Same"}))]})),("left"===b.side||b.isOrphan)&&t(o,n({onClick:function(n){n.stopPropagation(),b.onClick&&b.onClick(n)},sx:{display:"flex",alignItems:"center",px:.5,borderLeft:"1px solid ".concat((null===(s=b.style)||void 0===s?void 0:s.badgeBorder)||"#C7D2FE"),cursor:"pointer","&:hover":{bgcolor:"rgba(0,0,0,0.06)"}}},{children:t(h,{size:12,color:(null===(p=b.style)||void 0===p?void 0:p.badgeText)||"#3730A3"})}))]})),g]}))},table:function(e){var r=e.children;return t(o,n({component:"table",sx:{width:"100%",borderCollapse:"collapse",my:1,fontSize:"inherit"}},{children:r}))},thead:function(e){var r=e.children;return t(o,n({component:"thead"},{children:r}))},tbody:function(e){var r=e.children;return t(o,n({component:"tbody"},{children:r}))},tr:function(e){var r=e.children;return t(o,n({component:"tr",sx:{borderBottom:"1px solid #E5E7EB"}},{children:r}))},th:function(e){var r=e.children;return t(o,n({component:"th",sx:{border:"1px solid #E5E7EB",padding:"8px",textAlign:"left",fontWeight:600,backgroundColor:"#F9FAFB"}},{children:r}))},td:function(e){var r=e.children;return t(o,n({component:"td",sx:{border:"1px solid #E5E7EB",padding:"8px",verticalAlign:"top"}},{children:r}))},code:function(e){var r=e.children;return t("span",n({style:{fontFamily:"inherit",fontSize:"inherit"}},{children:r}))},pre:function(e){var r=e.children;return t("span",n({style:{fontFamily:"inherit",fontSize:"inherit",display:"block",whiteSpace:"pre-wrap"}},{children:r}))},updated:function(n){var e=n.children;return t(i,{children:e})},deleted:function(e){var r=e.children,i=M(r,function(n){return l.cloneElement(n,{"data-is-suggested-deviation-fix":"true"})});return t("span",n({style:{boxShadow:"inset 0 1px 0 #EF4444, inset 0 -1px 0 #EF4444",backgroundColor:"#FCCCCC",textDecoration:"line-through"}},{children:i}))},changed:function(e){var r=e.children,i=M(r,function(n){return l.cloneElement(n,{"data-is-suggested-deviation-fix":"true"})});return t("span",n({style:{boxShadow:"inset 0 1px 0 #2F59FF, inset 0 -1px 0 #2F59FF",backgroundColor:"#D5E8FF"}},{children:i}))},ul:function(r){var i=r.children,a=e(r,["children"]);return t(o,n({component:"ul",sx:{mt:1,mb:1,pl:3,listStyleType:"disc"}},a,{children:i}))},ol:function(r){var i=r.children,a=e(r,["children"]);return t(o,n({component:"ol",sx:{mt:1,mb:1,pl:3,listStyleType:"decimal"}},a,{children:i}))},li:function(r){var i=r.children,a=e(r,["children"]);return t(o,n({component:"li",sx:{mb:.5,display:"list-item"}},a,{children:i}))}}},[]),j=function(n){if(!n||"string"!=typeof n)return"";var e=n,t=(e=(e=(e=(e=(e=(e=(e=(e=e.replace(/((?:<\/?[a-z]+[^>]*>\s*)+)([*+\-] |\d+\. )/gi,"$2$1")).replace(/\\(['"])/g,"$1").replace(/\\n/g,"\n").replace(/\\\./g,".").replace(/\r\n/g,"\n")).replace(/^(\d+\.)(\s{2,})/gm,function(n,e,t){return"".concat(e.slice(0,-1),"\\.").concat(t)})).replace(/^(\d+\.)\s*\n+(\s+)(\S)/gm,function(n,e,t,r){return"".concat(e," ").concat(r)})).replace(/([^\n])\n(#{1,6} )/g,"$1\n\n$2")).replace(/([^\n])\n([ \t]*(?:[#*+\-] |\d+\. ))/g,"$1\n\n$2")).replace(/\n{3,}/g,"\n\n")).replace(/^[ \t]+(?![ \t]*([\*\-\+] |\d+\. ))/gm,function(n){return n.replace(/ /g," ").replace(/\t/g," ")})).split(/(\n{2,})/);return(e=t.map(function(n){return/^\n+$/.test(n)||/\|.*\|/.test(n)&&/\|[\s:|-]+\|/.test(n)||/^#{1,6} /.test(n.trimStart())?n:n.replace(/\n(?=[^\n])/g,function(e,t){var r=n.slice(t+1);return/^[ \t]*([#>|\-*+]|\d+\.)/.test(r)?"\n":" "})}).join("")).trim()},P=function(n){return n.replace(/[\.,;:]/g," ")},D=d(function(){return C.map(function(n){return{id:n.id,connected:n.isConnected,stackIndex:n.stackIndex,size:n.size}})},[C]),H=d(function(){var e=j(v||""),t=w?P(e):e,r=(C||[]).map(function(n){var e,t;return{id:null==n?void 0:n.id,highlight:j((null==n?void 0:n.highlight)||""),highlightColor:(null===(e=null==n?void 0:n.style)||void 0===e?void 0:e.highlightBg)||(null===(t=null==n?void 0:n.style)||void 0===t?void 0:t.badgeBg)||B}}).filter(function(n){return n.id&&n.highlight}),i={};r.forEach(function(n){i[n.highlight]||(i[n.highlight]=[]),i[n.highlight].push(n)});var o=function(n,e,t,r){void 0===e&&(e=""),void 0===r&&(r=[]);var i=!1,o=function(n){var o=function(n,e,t){var r,i,o;void 0===e&&(e="");var a=n.match(/^(\s*)([\s\S]*?)(\s*)$/);if(!a)return n;var l=null!==(r=a[1])&&void 0!==r?r:"",c=null!==(i=a[2])&&void 0!==i?i:"",d=null!==(o=a[3])&&void 0!==o?o:"";return c?l+function(n,e){void 0===n&&(n="");var t=e?' data-highlight-color="'.concat(e,'"'):"",r=n?' data-badge-id="'.concat(n,'"'):"";return"<mark".concat(r).concat(t,">")}(e,t)+c+"</mark>"+d:n}(n,e,t),a=o;if(!i&&r.length>0){i=!0;var l="",c="";r.forEach(function(n){l+=function(n){return'<span data-badge-id="'.concat(n,'">')}(n.id),c="</span>"+c}),a=l+o+c}return""+a};return n.split(/(\n+)/).map(function(n){return/^\n+$/.test(n)?n:n.trim()?""===n.replace(/[|:\-\s]/g,"")&&n.includes("-")?n:n.includes("|")?n.split(/(\|)/).map(function(n){return"|"!==n&&n.trim()?o(n):n}).join(""):o(n):n}).join("")},a=[];Object.entries(i).forEach(function(n){var r=n[0],i=n[1],o=e.indexOf(r),l=!1;if(-1===o&&w){var c=P(r);-1!==(o=t.indexOf(c))&&(l=!0)}if(-1!==o){for(var d=i[0].highlightColor,s=1;s<i.length;s++)d=g(d,i[s].highlightColor||"");a.push({highlight:r,start:o,end:o+r.length,badges:i,color:d,usedLooseMatch:l})}});var l=new Set(Object.keys(i));(k||[]).forEach(function(n){if(n){var r=j(n);if(r&&!l.has(r)){var i=e.indexOf(r),o=!1;if(-1===i&&w){var c=P(r);-1!==(i=t.indexOf(c))&&(o=!0)}if(-1!==i){var d=e.slice(0,i);(d.match(/</g)||[]).length===(d.match(/>/g)||[]).length&&a.push({highlight:r,start:i,end:i+r.length,badges:[],color:B||"",usedLooseMatch:o})}}}}),a.sort(function(n,e){return n.start-e.start||e.end-n.end});var c=[],d={};a.forEach(function(n,e){for(var t=n.start,r=n.end,i=0,o=c;i<o.length;i++){var a=o[i],l=a.start,s=a.end,u=t<s&&r>s&&t>=l,h=t<l&&r>l&&r<=s;if(t>=l&&r<=s){n.orphaned=!0,d[e]=a.matchIdx;break}u&&(t=s),h&&(r=l)}n.trimmedStart=t,n.trimmedEnd=r,!n.orphaned&&t<r&&c.push({start:t,end:r,matchIdx:e})});var s={};Object.entries(d).forEach(function(n){var e=n[0],t=n[1],r=Number(e);s[t]||(s[t]=[]),s[t].push(r)});var u=a.map(function(e,t){return n(n({},e),{idx:t})}).filter(function(n){return!n.orphaned}).sort(function(n,e){var t,r;return(null!==(t=e.trimmedStart)&&void 0!==t?t:e.start)-(null!==(r=n.trimmedStart)&&void 0!==r?r:n.start)});return u.forEach(function(n){var t,r,i,l,c=null!==(t=n.trimmedStart)&&void 0!==t?t:n.start,d=null!==(r=n.trimmedEnd)&&void 0!==r?r:n.end;if(!(c>=d)){var u=e.slice(c,d),h=function(n,e,t,r){if(!t.length)return n;var i=t.map(function(n){return a[n]}).sort(function(n,e){return n.start-e.start}),l="",c=0;return i.forEach(function(t){var i,a,d=Math.max(c,t.start-e),s=Math.max(d,t.end-e);if(!(d>=s)){var u=g(r,t.color||"");l+=n.slice(c,d),l+=o(n.slice(d,s),(null===(a=null===(i=t.badges)||void 0===i?void 0:i[0])||void 0===a?void 0:a.id)||"",u,t.badges||[]),c=s}}),l+=n.slice(c)}(n.usedLooseMatch||c!==n.start||d!==n.end?u:n.highlight,n.start,s[n.idx]||[],n.color),p=o(h,(null===(l=null===(i=n.badges)||void 0===i?void 0:i[0])||void 0===l?void 0:l.id)||"",n.color,n.badges||[]);e=e.slice(0,c)+p+e.slice(d)}}),e},[v,C,k,B,w]),N=d(function(){return m?j(m||""):""},[m]),R=!!m,L={"& *":{fontFamily:"inherit"},"& code, & pre, & kbd, & samp":{fontFamily:"inherit !important",fontSize:"inherit",background:"none",padding:0,border:"none",whiteSpace:"pre-wrap"},"& p, & li, & ul, & ol":{position:"static",overflow:"visible",whiteSpace:"pre-wrap"}},q=n(n(n(n({},b),L),{position:"relative",overflow:"visible",whiteSpace:"normal",gridArea:"1 / 1",zIndex:2}),R?{color:"transparent",userSelect:"none",pointerEvents:"none","& .deviation-badge":{pointerEvents:"auto"},"& table":{visibility:"hidden",margin:"0 !important"},"& th, & td":{padding:"0 !important",border:"none !important",backgroundColor:"transparent !important"},"& tr":{border:"none !important"},"& p:empty":{display:"none"}}:{}),W=n(n(n({},b),L),{position:"relative",overflow:"visible",whiteSpace:"normal",gridArea:"1 / 1",zIndex:1,pointerEvents:"auto"});return s(function(){if(T.current){var n=function(){var n=Array.from(T.current.querySelectorAll(".deviation-badge"));if(0!==n.length){n.forEach(function(n){n.style.setProperty("--badge-nudge","0px")});var e=n.filter(function(n){return"left"===n.dataset.side}),t=n.filter(function(n){return"left"!==n.dataset.side}),r=T.current.getBoundingClientRect(),i=r.bottom-4,o=r.top+4,a=function(n){if(0!==n.length){var e=n.map(function(n){var e=n.getBoundingClientRect();return{el:n,naturalTop:e.top,height:e.height,currentTop:e.top}});e.sort(function(n,e){return n.naturalTop-e.naturalTop});var t=[],r=[];e.forEach(function(n){if(0===r.length)r.push(n);else{var e=r[r.length-1],i=e.currentTop+e.height;n.naturalTop<i+8?(n.currentTop=i+8,r.push(n)):(t.push(r),r=[n])}}),r.length>0&&t.push(r),t.forEach(function(n){var e=n[n.length-1],t=e.currentTop+e.height;if(t>i){var r=t-i,a=n[0].currentTop-o,l=Math.max(0,Math.min(r,a));n.forEach(function(n){n.currentTop-=l})}}),t.flat().forEach(function(n){var e=n.currentTop-n.naturalTop;n.el.style.setProperty("--badge-nudge","".concat(e,"px"))})}};a(e),a(t)}},e=requestAnimationFrame(function(){requestAnimationFrame(function(){n()})}),t=new ResizeObserver(function(){requestAnimationFrame(n)});return t.observe(T.current),function(){t.disconnect(),cancelAnimationFrame(e)}}},[H,A,D]),r(o,n({ref:T,sx:{position:"relative",display:"grid"}},{children:[t(a,n({component:"div",sx:n(n({},q),{padding:"3px"})},{children:t(p,n({components:$,remarkPlugins:x,rehypePlugins:y},{children:H.replace(/#{3}/g,"")}))})),R&&t(a,n({component:"div",sx:W},{children:t(p,n({components:$,remarkPlugins:x,rehypePlugins:y},{children:N}))}))]}))},f);export{E as MemoizedMarkdown};
|
|
2
2
|
//# sourceMappingURL=memoizedMarkdown.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as i,__spreadArray as t}from"tslib";import{useMemo as n}from"react";import{getSideData as e,safeStringify as o,getRationale as l,hasValue as r,isMissingStr as s,DEVIATION_BADGE_SEPARATOR as d}from"../CognitiveComparehelpers.js";var a={id:"",title:"",similarity:0,sections:[]},u=function(u,v,c,f,p){void 0===p&&(p=!0);var _="string"==typeof c?c:JSON.stringify(c||{}),b=n(function(){var n,r,s,d;if(!u||0===Object.keys(u).length)return{activeProposed:{},activeVariants:[],parseError:"Tree data is required"};var a=JSON.parse(_);try{var c=u.nodes||u,f=[],b=[],m=u.base_root_id,h=u.input_index_map||{0:"left",1:"right"},y=u[m]||c[m];if(!y||!1===y.display_node)return{activeProposed:{title:"No Data",sections:[]},activeVariants:[],parseError:null};var g=function(t,n,e){if(!t||"object"!=typeof t)return t||null;if(t.deviations)return t;if(p)return t;var o=Object.keys(t).filter(function(i){return/^\d+$/.test(i)});if(!o.length)return t;var l=o.sort(function(i,t){return Number(i)-Number(t)}),r={},s={},d=null;return l.forEach(function(i){var o,l,a,u,v,c=t[i];if(c&&"object"==typeof c){d||(d=c);var f=!(null==c?void 0:c.status)||"pending"===c.status,p=f&&((null===(l=null==c?void 0:c.deviation_highlights)||void 0===l?void 0:l[n])||(null===(a=null==c?void 0:c.deviation_highlights)||void 0===a?void 0:a[h[0]]))||[],_=f&&((null===(u=null==c?void 0:c.deviation_highlights)||void 0===u?void 0:u[e])||(null===(v=null==c?void 0:c.deviation_highlights)||void 0===v?void 0:v[h[1]]))||[];r[i]=((o={})[h[0]]=p[0]||"",o[h[1]]=_[0]||"",o.deviation_summary=(null==c?void 0:c.deviation_summary)||"",o.deviation_title=null==c?void 0:c.deviation_title,o.deviation_impact=null==c?void 0:c.deviation_impact,o.deviation_explanation=null==c?void 0:c.deviation_explanation,o.evaluation_outputs=null==c?void 0:c.evaluation_outputs,o.cognitive_decisioning=null==c?void 0:c.cognitive_decisioning,o.deviation_highlights=null==c?void 0:c.deviation_highlights,o),s[i]=c}}),i(i({},t),{deviation_title:(null==d?void 0:d.deviation_title)||(null==t?void 0:t.deviation_title),deviation_impact:(null==d?void 0:d.deviation_impact)||(null==t?void 0:t.deviation_impact),deviation_summary:(null==d?void 0:d.deviation_summary)||(null==t?void 0:t.deviation_summary),deviation_explanation:(null==d?void 0:d.deviation_explanation)||(null==t?void 0:t.deviation_explanation),evaluation_outputs:(null==d?void 0:d.evaluation_outputs)||(null==t?void 0:t.evaluation_outputs),cognitive_decisioning:(null==d?void 0:d.cognitive_decisioning)||(null==t?void 0:t.cognitive_decisioning),deviations:r,deviation_entries:s})},x=function(i){var t=new Map,n=function(i){i.forEach(function(i){var e;i.id&&t.set(i.id,i),(null===(e=i.subsections)||void 0===e?void 0:e.length)&&n(i.subsections)})};n(i);var e=function(i,n){for(var o,l=[],r=function(i){var r=i.ref_parent_section_node_id;if(r&&t.has(r)&&r!==(null==n?void 0:n.id)){var s=t.get(r);s.subsections||(s.subsections=[]),s.subsections.some(function(t){return t.id===i.id})||s.subsections.push(i)}else(null===(o=i.subsections)||void 0===o?void 0:o.length)&&(i.subsections=e(i.subsections,i)),l.push(i)},s=0,d=i;s<d.length;s++){r(d[s])}return l},o=e(i),l=function(i){i.forEach(function(i){i.subsections&&i.subsections.length>0&&(i.subsections.sort(function(i,t){return i.selfIndex<0&&t.selfIndex>=0?1:i.selfIndex>=0&&t.selfIndex<0?-1:(i.selfIndex||0)-(t.selfIndex||0)}),l(i.subsections))})};return l(o),o},I=function(t,n){var r,s,d,v,f,p=u[t]||c[t];if(!p||!1===p.display_node)return null;var _=p.comparison_inputs?Object.keys(p.comparison_inputs):[],b=h[0],m=h[1];_.length>0&&(b=_.includes(h[0])?h[0]:_[0],m=_.includes(h[1])?h[1]:_.length>1?_[1]:_[0]);var y=e(p,n,h),x=!1!==(null===(r=y.attributes)||void 0===r?void 0:r.display_title),N=!1!==(null===(s=y.attributes)||void 0===s?void 0:s.display_content),E=!!o(y.title).trim(),O=!!o(y.content).trim(),j=l(p),S=(null===(d=null==a?void 0:a[t])||void 0===d?void 0:d.evaluation_result)||p.evaluation_result||null,R=g(S,b,m),P=[];p.next&&Object.values(p.next).forEach(function(i){var t=c[i];if(t&&!1!==t.display_node){var e=I(i,n);e&&P.push(e)}});var k=!(!E&&!O);return i(i({id:t,title:E?y.title:"",content:O?y.content:"",change_history:O?y.change_history:"",displayTitle:x,displayContent:N,subsections:P},k?j:{score:void 0,relation:"not_defined"}),{evaluationResult:R,selfIndex:void 0!==(null===(v=y.attributes)||void 0===v?void 0:v.display_index)?Number(y.attributes.display_index):-1,ref_parent_section_node_id:null===(f=y.attributes)||void 0===f?void 0:f.ref_parent_section_node_id})};if(v){var N=function(n,o){var r,s,d,v,f,p,_,b,m,y,x,I,E,O,j,S,R,P,k,K,C,T,V,D,w,J,U,q,F,M,W,$;void 0===o&&(o=0);var z=[],A=[];if(!n)return{refSections:z,baseSections:A};var B={},G={},H=-1,L=-1;for(var Q in n){var X=n[Q],Y=u[X]||c[X];if(Y&&!1!==Y.display_node){var Z=Y.comparison_inputs?Object.keys(Y.comparison_inputs):[],ii=h[0],ti=h[1];Z.length>0&&(ii=Z.includes(h[0])?h[0]:Z[0],ti=Z.includes(h[1])?h[1]:Z.length>1?Z[1]:Z[0]);var ni=l(Y),ei=(null===(r=null==a?void 0:a[X])||void 0===r?void 0:r.evaluation_result)||Y.evaluation_result||null,oi=g(ei,ii,ti),li=e(Y,"1",h),ri=e(Y,"0",h),si=!1!==(null===(s=li.attributes)||void 0===s?void 0:s.display_title)&&((null===(v=null===(d=li.title)||void 0===d?void 0:d.trim)||void 0===v?void 0:v.call(d))||"")||!1!==(null===(f=li.attributes)||void 0===f?void 0:f.display_content)&&((null===(_=null===(p=li.content)||void 0===p?void 0:p.trim)||void 0===_?void 0:_.call(p))||""),di=!1!==(null===(b=ri.attributes)||void 0===b?void 0:b.display_title)&&((null===(y=null===(m=ri.title)||void 0===m?void 0:m.trim)||void 0===y?void 0:y.call(m))||"")||!1!==(null===(x=ri.attributes)||void 0===x?void 0:x.display_content)&&((null===(E=null===(I=ri.content)||void 0===I?void 0:I.trim)||void 0===E?void 0:E.call(I))||""),ai=Number(null!==(j=null===(O=li.attributes)||void 0===O?void 0:O.display_index)&&void 0!==j?j:H--),ui=Number(null!==(R=null===(S=ri.attributes)||void 0===S?void 0:S.display_index)&&void 0!==R?R:L--),vi=0===o?String(ai):"".concat(ai,"_").concat(X),ci=0===o?String(ui):"".concat(ui,"_").concat(X),fi=B[vi]||i(i({id:X,title:!1!==(null===(P=li.attributes)||void 0===P?void 0:P.display_title)?li.title:"",content:!1!==(null===(k=li.attributes)||void 0===k?void 0:k.display_content)?li.content:"",change_history:!1!==(null===(K=li.attributes)||void 0===K?void 0:K.display_content)?li.change_history:"",subsections:[]},si?ni:{score:void 0,relation:"not_defined"}),{refIndexes:[],selfIndex:ai,evaluationResult:oi,displayContent:null===(C=li.attributes)||void 0===C?void 0:C.display_content,displayTitle:null===(T=li.attributes)||void 0===T?void 0:T.display_title,ref_parent_section_node_id:null===(V=li.attributes)||void 0===V?void 0:V.ref_parent_section_node_id}),pi=G[ci]||i(i({id:X,title:!1!==(null===(D=ri.attributes)||void 0===D?void 0:D.display_title)?ri.title:"",content:!1!==(null===(w=ri.attributes)||void 0===w?void 0:w.display_content)?ri.content:"",change_history:!1!==(null===(J=ri.attributes)||void 0===J?void 0:J.display_content)?ri.change_history:"",subsections:[]},di?ni:{score:void 0,relation:"not_defined"}),{refIndexes:[],selfIndex:ui,evaluationResult:oi,displayContent:null===(U=ri.attributes)||void 0===U?void 0:U.display_content,displayTitle:null===(q=ri.attributes)||void 0===q?void 0:q.display_title});Number(ai)>=0&&Number(ui)>=0&&((null===(F=fi.refIndexes)||void 0===F?void 0:F.includes(Number(ui)))||null===(M=fi.refIndexes)||void 0===M||M.push(Number(ui)),(null===(W=pi.refIndexes)||void 0===W?void 0:W.includes(Number(ai)))||null===($=pi.refIndexes)||void 0===$||$.push(Number(ai))),B[vi]=fi,G[ci]=pi;var _i=N(Y.next,o+1),bi=_i.refSections,mi=_i.baseSections;bi.length>0&&(fi.subsections=t(t([],fi.subsections||[],!0),bi,!0)),mi.length>0&&(pi.subsections=t(t([],pi.subsections||[],!0),mi,!0))}}z=Object.values(B),A=Object.values(G);var hi=function(i,t){return i.selfIndex<0&&t.selfIndex>=0?1:i.selfIndex>=0&&t.selfIndex<0?-1:i.selfIndex-t.selfIndex};return z.sort(hi),A.sort(hi),{refSections:z,baseSections:A}},E=N(y.next),O=E.refSections,j=E.baseSections;b=x(O),f=j}else y.next&&Object.values(y.next).forEach(function(i){var t=u[i]||c[i];t&&!1!==t.display_node&&(f.push(I(i,"0")||{id:i,title:"",content:"",subsections:[]}),b.push(I(i,"1")||{id:i,title:"",content:"",subsections:[]}))}),b=x(b);return{activeProposed:{title:(null===(r=null===(n=y.comparison_inputs)||void 0===n?void 0:n[h[0]])||void 0===r?void 0:r.title)||"Uploaded Contract",description:y.decision_scope_description||"",sections:f},activeVariants:[{id:"tree-variant-1",title:(null===(d=null===(s=y.comparison_inputs)||void 0===s?void 0:s[h[1]])||void 0===d?void 0:d.title)||"Reference Template",similarity:0,sections:b,analysis:{rule_difference_comparison:{summary:{overall_score:0,overall_summary:y.decision_scope_description||""},fields:{}}}}],parseError:null}}catch(i){return console.error("Data Transformation Error: ",i),{activeProposed:{},activeVariants:[],parseError:i instanceof Error?i.message:"Unknown Parsing Error"}}},[u,v,_,p]),m=b.activeProposed,h=b.activeVariants,y=b.parseError,g=(null==h?void 0:h[0])||a,x=n(function(){return(null==m?void 0:m.sections)||[]},[null==m?void 0:m.sections]),I=n(function(){return g.sections||[]},[g.sections]),N=x.length>0||I.length>0,E=n(function(){return f.fields.filter(function(i){var t=i.key;return(!N||"description"!==t)&&(r(null==m?void 0:m[t])||r(g[t]))})},[m,g,N,f.fields]),O=n(function(){var i,t,n={},e={},o={},l=0,r=null===(i=null==u?void 0:u.input_index_map)||void 0===i?void 0:i[0],a=null===(t=null==u?void 0:u.input_index_map)||void 0===t?void 0:t[1],c=function(i,t){if(!v){var n="left"===t?x.indexOf(i):I.indexOf(i);return{rootKey:"".concat(t,":").concat(n),parentNum:n+1}}if("left"===t){var e=i.selfIndex,o=void 0!==e&&e>=0?e+1:-1;return{rootKey:"left-root:".concat(i.id),parentNum:o}}var l=i.selfIndex,r=x.find(function(i){var t;return null===(t=i.refIndexes)||void 0===t?void 0:t.includes(l)});if(r){var s=r.selfIndex,d=void 0!==s&&s>=0?s+1:-1;return{rootKey:"left-root:".concat(r.id),parentNum:d}}var a=void 0!==l&&l>=0?l+1:-1;return{rootKey:"right-orphan-root:".concat(i.id),parentNum:a}},f=function(i,t){if(i&&t)return i.find(function(i){return i.id===t.id})||void 0},p=function(i,t,u,v,c,_,b){if(i&&function(i,t,n){var l,u=(null===(l=null==i?void 0:i.evaluationResult)||void 0===l?void 0:l.deviations)||{};Object.keys(u).sort().forEach(function(l){var v=u[l];if(v){var c=!s(v[r]),f=!s(v[a]);if(c||f){var p="".concat(i.id).concat(d).concat(l);void 0===e[p]&&(void 0===o[t]&&(o[t]=1),e[p]={index:o[t]++,rootKey:t,parentNum:n})}}})}(i,v,c),i&&!_){var m=(null==b?void 0:b.id)||"fallback_parent_".concat(l++);n[m]||(n[m]=[]),n[m].push(i)}((null==i?void 0:i.subsections)||(null==t?void 0:t.subsections)||(null==u?void 0:u.subsections)||[]).forEach(function(n){var e=f(null==t?void 0:t.subsections,n),o=f(null==u?void 0:u.subsections,n);p(n,e,o,v,c,!1,i||b)})};x.forEach(function(i){var t,n=c(i,"left"),e=n.rootKey,o=n.parentNum,l=null;if(v){var r=null===(t=i.refIndexes)||void 0===t?void 0:t[0];l=I.find(function(i){return i.selfIndex===r})}else l=I[x.indexOf(i)];p(i,i,l,e,o,!0,i)}),I.forEach(function(i){var t=c(i,"right"),n=t.rootKey,e=t.parentNum;n.startsWith("right-orphan-root:")&&p(i,null,i,n,e,!0,i)});var _=Object.fromEntries(Object.entries(e).map(function(i){return[i[0],i[1].index]})),b=Object.fromEntries(Object.entries(e).map(function(i){return[i[0],i[1].parentNum]}));return{parentDeviationRecord:n,registry:_,deviationParentRegistry:b}},[x,I,v,u]),j=O.parentDeviationRecord,S=O.registry,R=O.deviationParentRegistry;return{activeProposed:m,activeVariants:h,existingRule:g,proposedSections:x,existingSections:I,visibleFields:E,parentDeviationRecord:j,deviationNumberRegistry:S,deviationParentRegistry:R,parseError:y}};export{u as useCognitiveTreeData};
|
|
1
|
+
import{__assign as i,__spreadArray as t}from"tslib";import{useMemo as n}from"react";import{getSideData as e,safeStringify as o,getRationale as l,hasValue as r,isMissingStr as s,DEVIATION_BADGE_SEPARATOR as d}from"../CognitiveComparehelpers.js";var a={id:"",title:"",similarity:0,sections:[]},u=function(u,v,c,f,p){void 0===p&&(p=!0);var _="string"==typeof c?c:JSON.stringify(c||{}),b=n(function(){var n,r,s,d;if(!u||0===Object.keys(u).length)return{activeProposed:{},activeVariants:[],parseError:"Tree data is required"};var a=JSON.parse(_);try{var c=u.nodes||u,f=[],b=[],m=u.base_root_id,h=u.input_index_map||{0:"left",1:"right"},y=u[m]||c[m];if(!y||!1===y.display_node)return{activeProposed:{title:"No Data",sections:[]},activeVariants:[],parseError:null};var g=function(t,n,e){if(!t||"object"!=typeof t)return t||null;if(t.deviations)return t;if(p)return t;var o=Object.keys(t).filter(function(i){return/^\d+$/.test(i)});if(!o.length)return t;var l=o.sort(function(i,t){return Number(i)-Number(t)}),r={},s={},d=null;return l.forEach(function(i){var o,l,a,u,v,c=t[i];if(c&&"object"==typeof c){d||(d=c);var f=!(null==c?void 0:c.status)||"pending"===c.status,p=f&&((null===(l=null==c?void 0:c.deviation_highlights)||void 0===l?void 0:l[n])||(null===(a=null==c?void 0:c.deviation_highlights)||void 0===a?void 0:a[h[0]]))||[],_=f&&((null===(u=null==c?void 0:c.deviation_highlights)||void 0===u?void 0:u[e])||(null===(v=null==c?void 0:c.deviation_highlights)||void 0===v?void 0:v[h[1]]))||[];r[i]=((o={})[h[0]]=p[0]||"",o[h[1]]=_[0]||"",o.deviation_summary=(null==c?void 0:c.deviation_summary)||"",o.deviation_title=null==c?void 0:c.deviation_title,o.deviation_impact=null==c?void 0:c.deviation_impact,o.deviation_explanation=null==c?void 0:c.deviation_explanation,o.evaluation_outputs=null==c?void 0:c.evaluation_outputs,o.cognitive_decisioning=null==c?void 0:c.cognitive_decisioning,o.deviation_highlights=null==c?void 0:c.deviation_highlights,o),s[i]=c}}),i(i({},t),{deviation_title:(null==d?void 0:d.deviation_title)||(null==t?void 0:t.deviation_title),deviation_impact:(null==d?void 0:d.deviation_impact)||(null==t?void 0:t.deviation_impact),deviation_summary:(null==d?void 0:d.deviation_summary)||(null==t?void 0:t.deviation_summary),deviation_explanation:(null==d?void 0:d.deviation_explanation)||(null==t?void 0:t.deviation_explanation),evaluation_outputs:(null==d?void 0:d.evaluation_outputs)||(null==t?void 0:t.evaluation_outputs),cognitive_decisioning:(null==d?void 0:d.cognitive_decisioning)||(null==t?void 0:t.cognitive_decisioning),deviations:r,deviation_entries:s})},x=function(i){var t=new Map,n=function(i){i.forEach(function(i){var e;i.id&&t.set(i.id,i),(null===(e=i.subsections)||void 0===e?void 0:e.length)&&n(i.subsections)})};n(i);var e=function(i,n){for(var o,l=[],r=function(i){var r=i.ref_parent_section_node_id;if(r&&t.has(r)&&r!==(null==n?void 0:n.id)){var s=t.get(r);s.subsections||(s.subsections=[]),s.subsections.some(function(t){return t.id===i.id})||s.subsections.push(i)}else(null===(o=i.subsections)||void 0===o?void 0:o.length)&&(i.subsections=e(i.subsections,i)),l.push(i)},s=0,d=i;s<d.length;s++){r(d[s])}return l},o=e(i),l=function(i){i.forEach(function(i){i.subsections&&i.subsections.length>0&&(i.subsections.sort(function(i,t){return i.selfIndex<0&&t.selfIndex>=0?1:i.selfIndex>=0&&t.selfIndex<0?-1:(i.selfIndex||0)-(t.selfIndex||0)}),l(i.subsections))})};return l(o),o},I=function(t,n){var r,s,d,v,f,p=u[t]||c[t];if(!p||!1===p.display_node)return null;var _=p.comparison_inputs?Object.keys(p.comparison_inputs):[],b=h[0],m=h[1];_.length>0&&(b=_.includes(h[0])?h[0]:_[0],m=_.includes(h[1])?h[1]:_.length>1?_[1]:_[0]);var y=e(p,n,h),x=!1!==(null===(r=y.attributes)||void 0===r?void 0:r.display_title),N=!1!==(null===(s=y.attributes)||void 0===s?void 0:s.display_content),O=!!o(y.title).trim(),E=!!o(y.content).trim(),j=l(p),S=(null===(d=null==a?void 0:a[t])||void 0===d?void 0:d.evaluation_result)||p.evaluation_result||null,R=g(S,b,m),P=[];p.next&&Object.values(p.next).forEach(function(i){var t=c[i];if(t&&!1!==t.display_node){var e=I(i,n);e&&P.push(e)}});var k=!(!O&&!E);return i(i({id:t,title:O?y.title:"",content:E?y.content:"",change_history:E?y.change_history:"",displayTitle:x,displayContent:N,subsections:P},k?j:{score:void 0,relation:"not_defined"}),{evaluationResult:R,selfIndex:void 0!==(null===(v=y.attributes)||void 0===v?void 0:v.display_index)?Number(y.attributes.display_index):-1,ref_parent_section_node_id:null===(f=y.attributes)||void 0===f?void 0:f.ref_parent_section_node_id})};if(v){var N=function(n,o){var r,s,d,v,f,p,_,b,m,y,x,I,O,E,j,S,R,P,k,K,C,T,V,D,w,J,U,q,F,M,W,$;void 0===o&&(o=0);var z=[],A=[];if(!n)return{refSections:z,baseSections:A};var B={},G={},H=-1,L=-1;for(var Q in n){var X=n[Q],Y=u[X]||c[X];if(Y&&!1!==Y.display_node){var Z=Y.comparison_inputs?Object.keys(Y.comparison_inputs):[],ii=h[0],ti=h[1];Z.length>0&&(ii=Z.includes(h[0])?h[0]:Z[0],ti=Z.includes(h[1])?h[1]:Z.length>1?Z[1]:Z[0]);var ni=l(Y),ei=(null===(r=null==a?void 0:a[X])||void 0===r?void 0:r.evaluation_result)||Y.evaluation_result||null,oi=g(ei,ii,ti),li=e(Y,"1",h),ri=e(Y,"0",h),si=!1!==(null===(s=li.attributes)||void 0===s?void 0:s.display_title)&&((null===(v=null===(d=li.title)||void 0===d?void 0:d.trim)||void 0===v?void 0:v.call(d))||"")||!1!==(null===(f=li.attributes)||void 0===f?void 0:f.display_content)&&((null===(_=null===(p=li.content)||void 0===p?void 0:p.trim)||void 0===_?void 0:_.call(p))||""),di=!1!==(null===(b=ri.attributes)||void 0===b?void 0:b.display_title)&&((null===(y=null===(m=ri.title)||void 0===m?void 0:m.trim)||void 0===y?void 0:y.call(m))||"")||!1!==(null===(x=ri.attributes)||void 0===x?void 0:x.display_content)&&((null===(O=null===(I=ri.content)||void 0===I?void 0:I.trim)||void 0===O?void 0:O.call(I))||""),ai=Number(null!==(j=null===(E=li.attributes)||void 0===E?void 0:E.display_index)&&void 0!==j?j:H--),ui=Number(null!==(R=null===(S=ri.attributes)||void 0===S?void 0:S.display_index)&&void 0!==R?R:L--),vi=0===o?String(ai):"".concat(ai,"_").concat(X),ci=0===o?String(ui):"".concat(ui,"_").concat(X),fi=B[vi]||i(i({id:X,title:!1!==(null===(P=li.attributes)||void 0===P?void 0:P.display_title)?li.title:"",content:!1!==(null===(k=li.attributes)||void 0===k?void 0:k.display_content)?li.content:"",change_history:!1!==(null===(K=li.attributes)||void 0===K?void 0:K.display_content)?li.change_history:"",subsections:[]},si?ni:{score:void 0,relation:"not_defined"}),{refIndexes:[],selfIndex:ai,evaluationResult:oi,displayContent:null===(C=li.attributes)||void 0===C?void 0:C.display_content,displayTitle:null===(T=li.attributes)||void 0===T?void 0:T.display_title,ref_parent_section_node_id:null===(V=li.attributes)||void 0===V?void 0:V.ref_parent_section_node_id}),pi=G[ci]||i(i({id:X,title:!1!==(null===(D=ri.attributes)||void 0===D?void 0:D.display_title)?ri.title:"",content:!1!==(null===(w=ri.attributes)||void 0===w?void 0:w.display_content)?ri.content:"",change_history:!1!==(null===(J=ri.attributes)||void 0===J?void 0:J.display_content)?ri.change_history:"",subsections:[]},di?ni:{score:void 0,relation:"not_defined"}),{refIndexes:[],selfIndex:ui,evaluationResult:oi,displayContent:null===(U=ri.attributes)||void 0===U?void 0:U.display_content,displayTitle:null===(q=ri.attributes)||void 0===q?void 0:q.display_title});Number(ai)>=0&&Number(ui)>=0&&((null===(F=fi.refIndexes)||void 0===F?void 0:F.includes(Number(ui)))||null===(M=fi.refIndexes)||void 0===M||M.push(Number(ui)),(null===(W=pi.refIndexes)||void 0===W?void 0:W.includes(Number(ai)))||null===($=pi.refIndexes)||void 0===$||$.push(Number(ai))),B[vi]=fi,G[ci]=pi;var _i=N(Y.next,o+1),bi=_i.refSections,mi=_i.baseSections;bi.length>0&&(fi.subsections=t(t([],fi.subsections||[],!0),bi,!0)),mi.length>0&&(pi.subsections=t(t([],pi.subsections||[],!0),mi,!0))}}z=Object.values(B),A=Object.values(G);var hi=function(i,t){return i.selfIndex<0&&t.selfIndex>=0?1:i.selfIndex>=0&&t.selfIndex<0?-1:i.selfIndex-t.selfIndex};return z.sort(hi),A.sort(hi),{refSections:z,baseSections:A}},O=N(y.next),E=O.refSections,j=O.baseSections;b=x(E),f=j}else y.next&&Object.values(y.next).forEach(function(i){var t=u[i]||c[i];t&&!1!==t.display_node&&(f.push(I(i,"0")||{id:i,title:"",content:"",subsections:[]}),b.push(I(i,"1")||{id:i,title:"",content:"",subsections:[]}))}),b=x(b);return{activeProposed:{title:(null===(r=null===(n=y.comparison_inputs)||void 0===n?void 0:n[h[0]])||void 0===r?void 0:r.title)||"Uploaded Contract",description:y.decision_scope_description||"",sections:f},activeVariants:[{id:"tree-variant-1",title:(null===(d=null===(s=y.comparison_inputs)||void 0===s?void 0:s[h[1]])||void 0===d?void 0:d.title)||"Reference Template",similarity:0,sections:b,analysis:{rule_difference_comparison:{summary:{overall_score:0,overall_summary:y.decision_scope_description||""},fields:{}}}}],parseError:null}}catch(i){return console.error("Data Transformation Error: ",i),{activeProposed:{},activeVariants:[],parseError:i instanceof Error?i.message:"Unknown Parsing Error"}}},[u,v,_,p]),m=b.activeProposed,h=b.activeVariants,y=b.parseError,g=(null==h?void 0:h[0])||a,x=n(function(){return(null==m?void 0:m.sections)||[]},[null==m?void 0:m.sections]),I=n(function(){return g.sections||[]},[g.sections]),N=x.length>0||I.length>0,O=n(function(){return f.fields.filter(function(i){var t=i.key;return(!N||"description"!==t)&&(r(null==m?void 0:m[t])||r(g[t]))})},[m,g,N,f.fields]),E=n(function(){var i,t,n={},e={},o={},l=0,r=null===(i=null==u?void 0:u.input_index_map)||void 0===i?void 0:i[0],a=null===(t=null==u?void 0:u.input_index_map)||void 0===t?void 0:t[1],c=function(i,t){if(!v){var n="left"===t?x.indexOf(i):I.indexOf(i);return{rootKey:"".concat(t,":").concat(n),parentNum:n+1}}if("left"===t){var e=i.selfIndex,o=void 0!==e&&e>=0?e+1:x.indexOf(i)+1;return{rootKey:"left-root:".concat(i.id),parentNum:o}}var l=i.selfIndex,r=x.find(function(i){var t;return null===(t=i.refIndexes)||void 0===t?void 0:t.includes(l)});if(r){var s=r.selfIndex,d=void 0!==s&&s>=0?s+1:x.indexOf(r)+1;return{rootKey:"left-root:".concat(r.id),parentNum:d}}var a=void 0!==l&&l>=0?l+1:I.indexOf(i)+1;return{rootKey:"right-orphan-root:".concat(i.id),parentNum:a}},f=function(i,t){if(i&&t)return i.find(function(i){return i.id===t.id})||void 0},p=function(i,t,u,v,c,_,b){if(t&&function(i,t,n){var l,u=(null===(l=null==i?void 0:i.evaluationResult)||void 0===l?void 0:l.deviations)||{};Object.keys(u).sort().forEach(function(l){var v=u[l];if(v){var c=!s(v[r]),f=!s(v[a]);if(c||f){var p="".concat(i.id).concat(d).concat(l);void 0===e[p]&&(void 0===o[t]&&(o[t]=1),e[p]={index:o[t]++,rootKey:t,parentNum:n})}}})}(t,v,c),t&&!_){var m=(null==b?void 0:b.id)||"fallback_parent_".concat(l++);n[m]||(n[m]=[]),n[m].push(t)}((null==t?void 0:t.subsections)||(null==i?void 0:i.subsections)||(null==u?void 0:u.subsections)||[]).forEach(function(n){var e=f(null==i?void 0:i.subsections,n),o=f(null==u?void 0:u.subsections,n);p(n,e,o,v,c,!1,t||b)})};x.forEach(function(i){var t,n=c(i,"left"),e=n.rootKey,o=n.parentNum,l=null;if(v){var r=null===(t=i.refIndexes)||void 0===t?void 0:t[0];l=I.find(function(i){return i.selfIndex===r})}else l=I[x.indexOf(i)];p(i,i,l,e,o,!0,i)}),I.forEach(function(i){var t=c(i,"right"),n=t.rootKey,e=t.parentNum;n.startsWith("right-orphan-root:")&&p(i,null,i,n,e,!0,i)});var _=Object.fromEntries(Object.entries(e).map(function(i){return[i[0],i[1].index]})),b=Object.fromEntries(Object.entries(e).map(function(i){return[i[0],i[1].parentNum]}));return{parentDeviationRecord:n,registry:_,deviationParentRegistry:b}},[x,I,v,u]),j=E.parentDeviationRecord,S=E.registry,R=E.deviationParentRegistry;return{activeProposed:m,activeVariants:h,existingRule:g,proposedSections:x,existingSections:I,visibleFields:O,parentDeviationRecord:j,deviationNumberRegistry:S,deviationParentRegistry:R,parseError:y}};export{u as useCognitiveTreeData};
|
|
2
2
|
//# sourceMappingURL=useCompareData.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as l}from"tslib";import{useCallback as
|
|
1
|
+
import{__assign as l}from"tslib";import{useCallback as e}from"react";import{generateColorPalette as n,getFirstDeviationOutputValue as i,getFirstDeviationColor as o,safeStringify as t}from"../CognitiveComparehelpers.js";import{DEFAULT_DEVIAION_COLOR as u}from"../CognitiveCompareConstants.js";var d=function(d){var v=d.proposedSections,a=d.existingSections,r=d.maintainRelativeOrder,s=d.cognitiveMap,f=d.deviationData,b=d.treeData,g=d.resolvedComparisonConfig,c=d.badgeStyleOverride,p=e(function(e,t){var d,s,f;void 0===t&&(t="left");var b=null,g=null;if("left"===t)if(b=v[e],r&&b){var p=a.filter(function(l){var e;return null===(e=b.refIndexes)||void 0===e?void 0:e.includes(l.selfIndex)});g=p.find(function(l){return l.evaluationResult})||p[0]}else g=a[e];else if(g=a[e],r&&g){var m=v.filter(function(l){var e;return null===(e=l.refIndexes)||void 0===e?void 0:e.includes(g.selfIndex)});b=m.find(function(l){return l.evaluationResult})||m[0]}else b=v[e];var x=(null==b?void 0:b.relation)&&"not_defined"!==b.relation,_=(null==g?void 0:g.relation)&&"not_defined"!==g.relation,B=!(!(null==b?void 0:b.cognitiveData)&&!(null==g?void 0:g.cognitiveData)),C="left"===t?!(null==b?void 0:b.title)&&!(null==b?void 0:b.content):!(null==g?void 0:g.title)&&!(null==g?void 0:g.content);if(!x&&!_&&!B){var S=C?null:"Not Defined",D=n(u);if(c)(y=c(S))&&(D=l(l({},D),{badgeBg:y.bg,badgeText:y.text,badgeBorder:y.border}));return l(l({},D),{label:S})}var y,R=null!==(s=null!==(d=null==b?void 0:b.evaluationResult)&&void 0!==d?d:null==g?void 0:g.evaluationResult)&&void 0!==s?s:null,I=i(R),T=o(R),j=n(T);c&&((y=c(I))&&(j=l(l({},j),{badgeBg:y.bg,badgeText:y.text,badgeBorder:y.border})));return l(l({},j),null!=R?{label:null!==(f=I)&&void 0!==f?f:""}:{label:null})},[v,a,s,g,r,c]),m=e(function(e){for(var d,r,s=e.split("-").map(Number),f=v[s[0]],b=a[s[0]],g=1;g<s.length;g++)(null==f?void 0:f.subsections)&&(f=f.subsections[s[g]]),(null==b?void 0:b.subsections)&&(b=b.subsections[s[g]]);if(!f&&!b)return null;var p=(null==f?void 0:f.relation)&&"not_defined"!==f.relation,m=(null==b?void 0:b.relation)&&"not_defined"!==b.relation;t(null==f?void 0:f.id)||t(null==b?void 0:b.id);var x=!(!(null==f?void 0:f.cognitiveData)&&!(null==b?void 0:b.cognitiveData));if(!p&&!m&&!x){var _=n(u);if(c)(B=c(null))&&(_=l(l({},_),{badgeBg:B.bg,badgeText:B.text,badgeBorder:B.border}));return l(l({},_),{label:null})}var B,C=null!==(r=null!==(d=null==f?void 0:f.evaluationResult)&&void 0!==d?d:null==b?void 0:b.evaluationResult)&&void 0!==r?r:null,S=i(C),D=o(C),y=n(D);c&&((B=c(S))&&(y=l(l({},y),{badgeBg:B.bg,badgeText:B.text,badgeBorder:B.border})));return l(l({},y),null!=C?{label:null!=S?S:""}:{label:null})},[v,a,s,g,c]),x=e(function(e,o){var t,d,v,a,r,s,g,c,p,m,x,_,B,C,S,D,y,R,I,T,j;if(!e||null==o)return null;var h=null!==(r=null!==(d=null===(t=null==f?void 0:f[e])||void 0===t?void 0:t.evaluation_result)&&void 0!==d?d:null===(a=null===(v=null==b?void 0:b.nodes)||void 0===v?void 0:v[e])||void 0===a?void 0:a.evaluation_result)&&void 0!==r?r:null;if(!h||"object"!=typeof h)return null;var N=null!==(m=null!==(p=null!==(g=null===(s=null==h?void 0:h.deviations)||void 0===s?void 0:s[o])&&void 0!==g?g:null===(c=null==h?void 0:h.deviation_entries)||void 0===c?void 0:c[o])&&void 0!==p?p:null==h?void 0:h[o])&&void 0!==m?m:null,O=null!==(T=null!==(y=null!==(S=null!==(B=null===(_=null===(x=null==N?void 0:N.evaluation_outputs)||void 0===x?void 0:x.metadata)||void 0===_?void 0:_.label_color)&&void 0!==B?B:null===(C=null==N?void 0:N.evaluation_outputs)||void 0===C?void 0:C.label_color)&&void 0!==S?S:null===(D=null==N?void 0:N.metadata)||void 0===D?void 0:D.label_color)&&void 0!==y?y:null===(I=null===(R=null==h?void 0:h.evaluation_outputs)||void 0===R?void 0:R.metadata)||void 0===I?void 0:I.label_color)&&void 0!==T?T:u,K=null!==(j=i(N))&&void 0!==j?j:i(h);return l(l({},n(O)),{label:K})},[f,b]);return{getSectionCompareStyle:p,getSubSectionCompareStyle:m,getDeviationStyleByKey:x}};export{d as useStyleHelpers};
|
|
2
2
|
//# sourceMappingURL=useStyles.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{__assign as t}from"tslib";import{jsx as i,jsxs as n,Fragment as e}from"react/jsx-runtime";import{useMemo as o,useState as l,useEffect as a,useCallback as r}from"react";import{ChevronUp as c,ChevronDown as d,Sparkles as s,Globe as u}from"lucide-react";import v from"../CognitiveInternalgptReasoning/CognitiveInternalgptCoreComponent.js";import p from"./GptWebCitationImageCitation.js";import m from"./GptWebCitationMarkdown.js";import g from"./GptWebCitationSkeleton.js";import{mapCitationDataToDisplay as b,getWebCitationImageUrl as C}from"./utils/citationData.utils.js";import h from"./GptWebCitation.module.css.js";import w from"../../assests/svg/NeuralNetworkIcon.js";var f=function(o){var l=o.variant,a=o.disabled,r=o.onClick,c=o.title,d=o.style;return i("button",t({type:"button",className:h.webCitationButton,onClick:r,disabled:a,title:c,style:d},{children:n(e,"gpt"===l?{children:[i(w,{className:h.webCitationButtonIcon}),"View GPT Citation"]}:{children:[i(u,{size:24,className:h.webCitationButtonIcon}),"View Web Citation"]})}))},N=function(){return i(g,{})},y=function(e){var u,g,w,y=e.gptCitation,W=e.isWebCitation,B=void 0!==W&&W,F=e.webCitationData,x=e.topic,I=e.sourceLabel,k=e.relevanceScore,T=e.learnedFrom,j=e.onGenerateWebCitation,z=e.isWebCitationLoading,A=void 0!==z&&z,G=e.showWebCitation,M=e.onToggleCitationView,S=e.showExpandImageButton,H=void 0===S||S,L=e.showGptMaximizeButton,D=e.styles,P=o(function(){return function(i){var n,e,o,l,a,r,c,d,s;return{container:null==i?void 0:i.container,gptWrapper:t(t({},null===(n=null==i?void 0:i.gptCitation)||void 0===n?void 0:n.wrapper),null==i?void 0:i.gptCitationWrapper),gptFooterAction:t(t({},null===(e=null==i?void 0:i.gptCitation)||void 0===e?void 0:e.footerAction),null==i?void 0:i.footerAction),gptToggleButton:t(t({},null===(o=null==i?void 0:i.gptCitation)||void 0===o?void 0:o.toggleButton),null==i?void 0:i.webCitationButton),webPanel:t(t({},null==i?void 0:i.container),null===(l=null==i?void 0:i.webCitation)||void 0===l?void 0:l.panel),webHeader:null===(a=null==i?void 0:i.webCitation)||void 0===a?void 0:a.header,webContent:null===(r=null==i?void 0:i.webCitation)||void 0===r?void 0:r.content,webFooter:null===(c=null==i?void 0:i.webCitation)||void 0===c?void 0:c.footer,webToggleButton:t(t({},null===(d=null==i?void 0:i.webCitation)||void 0===d?void 0:d.toggleButton),null==i?void 0:i.webCitationButton),webLearnedFrom:null===(s=null==i?void 0:i.webCitation)||void 0===s?void 0:s.learnedFrom}}(D)},[D]),V=o(function(){return t(t(t({},y),{disableMaximize:void 0!==L?!L:y.disableMaximize}),B?{DocumentTitle:void 0,previewCallback:void 0}:{})},[y,L,B]),E=l(!1),U=E[0],R=E[1],q=l(0),J=q[0],K=q[1],O=l(0),Q=O[0],X=O[1],Y=null!=G?G:U,Z=void 0!==G,$=o(function(){return F?b(F):null},[F]),_=null!==(u=null!=x?x:null==$?void 0:$.topic)&&void 0!==u?u:"Web Citation",tt=null!==(g=null!=k?k:null==$?void 0:$.relevanceScore)&&void 0!==g?g:0,it=null!=T?T:null==$?void 0:$.learnedFrom,nt=null!==(w=null==$?void 0:$.content)&&void 0!==w?w:"",et=null==$?void 0:$.citationUrl,ot=C(F),lt=!!ot,at=!!nt,rt=lt||at,ct=A&&!lt;a(function(){K(0)},[nt,_,null==F?void 0:F.citationId]);var dt=r(function(){M?M():Z||R(!1)},[M,Z]),st=r(function(){M?M():Z||R(!0),rt||A||null==j||j()},[M,Z,rt,A,j]),ut=r(function(){K(function(t){return Math.min(t+1,Math.max(Q-1,0))})},[Q]),vt=r(function(){K(function(t){return Math.max(t-1,0)})},[]),pt=null!=I?I:"Source: Web Citation > ".concat(_),mt=function(e){var o=!!V.DocumentTitle,l=o?"".concat(h.gptCitationWrapper," ").concat(h.gptCitationWrapperWithSource):h.gptCitationWrapper;return n("div",t({className:l,style:P.gptWrapper},{children:[i(v,t({},V,{splitterCustomStyle:!0})),e&&i("div",t(o?{className:h.gptCitationFooterAction,style:P.gptFooterAction}:{className:h.gptCitationToggleFooter,style:P.gptFooterAction},{children:e}))]}))};return B?Y?n("div",t({className:h.panel,style:P.webPanel},{children:[n("div",t({className:h.panelHeader,style:P.webHeader},{children:[i("span",t({className:h.panelSource},{children:pt})),n("div",t({className:h.panelHeaderActions},{children:[at&&!ct&&Q>0&&n("div",t({className:h.pagination},{children:[i("button",t({type:"button",onClick:vt,disabled:0===J,className:h.paginationButton,"aria-label":"Previous highlight"},{children:i(c,{size:14})})),n("span",t({className:h.paginationLabel},{children:[J+1," / ",Q]})),i("button",t({type:"button",onClick:ut,disabled:J>=Q-1,className:h.paginationButton,"aria-label":"Next highlight"},{children:i(d,{size:14})}))]})),tt>0&&n("div",t({className:h.confidenceBadge,title:"Decision strength"},{children:[i(s,{size:14}),tt,"%"]}))]}))]})),i("div",t({className:"".concat(h.panelContent).concat(ct||lt?" ".concat(h.panelContentExpanded):""),style:P.webContent},{children:ct?i(N,{}):lt&&ot?i(p,{citationImage:ot,citationUrl:et,showExpandImageButton:H}):at?i(m,{content:nt,activeHighlightIndex:J,onHighlightCountChange:X}):i(N,{})})),n("div",t({className:h.panelFooter,style:P.webFooter},{children:[i(f,{variant:"gpt",disabled:ct,onClick:dt,style:P.webToggleButton}),it&&n("span",t({className:h.learnedFrom,style:P.webLearnedFrom},{children:["Learned From ",it]}))]}))]})):i("div",t({className:h.overlay,style:P.container},{children:mt(i(f,{variant:"web",disabled:A,onClick:st,title:"View web-based citation for this source.",style:P.gptToggleButton}))})):i("div",t({className:h.overlay,style:P.container},{children:mt()}))};export{y as default};
|
|
2
|
+
//# sourceMappingURL=GptWebCitation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GptWebCitation.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var e={overlay:"GptWebCitation-module_overlay__OY5pa",gptCitationWrapper:"GptWebCitation-module_gptCitationWrapper__EN7nk",gptCitationToggleFooter:"GptWebCitation-module_gptCitationToggleFooter__ncfLT",gptCitationFooterAction:"GptWebCitation-module_gptCitationFooterAction__WWpAY",gptCitationWrapperWithSource:"GptWebCitation-module_gptCitationWrapperWithSource__1-ynq",panel:"GptWebCitation-module_panel__ek9Lq",panelHeader:"GptWebCitation-module_panelHeader__afwge",panelSource:"GptWebCitation-module_panelSource__oFl-c",panelHeaderActions:"GptWebCitation-module_panelHeaderActions__sGrhi",pagination:"GptWebCitation-module_pagination__VQvbY",paginationButton:"GptWebCitation-module_paginationButton__fzJyQ",paginationLabel:"GptWebCitation-module_paginationLabel__S7t1W",confidenceBadge:"GptWebCitation-module_confidenceBadge__4BBTf",panelContent:"GptWebCitation-module_panelContent__vg-mG",panelContentExpanded:"GptWebCitation-module_panelContentExpanded__3aGjq",markdownBody:"GptWebCitation-module_markdownBody__5kdwH",highlight:"GptWebCitation-module_highlight__Xr1wl",highlightActive:"GptWebCitation-module_highlightActive__iFuz5",citationLink:"GptWebCitation-module_citationLink__kH9JC",citationLinkActive:"GptWebCitation-module_citationLinkActive__SShYx",panelFooter:"GptWebCitation-module_panelFooter__wm98C",webCitationButton:"GptWebCitation-module_webCitationButton__blI--",webCitationButtonIcon:"GptWebCitation-module_webCitationButtonIcon__r9lPc",learnedFrom:"GptWebCitation-module_learnedFrom__DMyLS",imageCitationWrapper:"GptWebCitation-module_imageCitationWrapper__iQUSw",imageCitationCenter:"GptWebCitation-module_imageCitationCenter__DMlqn",imageCitationViewport:"GptWebCitation-module_imageCitationViewport__xcotr",imageCitationScrollContainer:"GptWebCitation-module_imageCitationScrollContainer__bAQNk",citationImage:"GptWebCitation-module_citationImage__7rWdT",citationImagePreload:"GptWebCitation-module_citationImagePreload__L7ibJ",expandImageButton:"GptWebCitation-module_expandImageButton__598k6",fullScreenOverlay:"GptWebCitation-module_fullScreenOverlay__Z5U8h",fullScreenContent:"GptWebCitation-module_fullScreenContent__xIXZR",fullScreenCloseButton:"GptWebCitation-module_fullScreenCloseButton__lnaT1",fullScreenImageWrapper:"GptWebCitation-module_fullScreenImageWrapper__ADPGU",fullScreenImage:"GptWebCitation-module_fullScreenImage__jLVAQ",visitLinkRow:"GptWebCitation-module_visitLinkRow__H8ai5",visitLinkHint:"GptWebCitation-module_visitLinkHint__FAwob",visitLink:"GptWebCitation-module_visitLink__1BDo8",skeleton:"GptWebCitation-module_skeleton__1q51h",skeletonText:"GptWebCitation-module_skeletonText__E6XgN",skeletonShimmer:"GptWebCitation-module_skeletonShimmer__yqWJh",shimmer:"GptWebCitation-module_shimmer__-ZbQA"};!function(){if("undefined"==typeof document)return;const e=document.createElement("style");e.type="text/css";const t=window.__CSP_NONCE__||document.querySelector('meta[name="csp-nonce"]')?.content;t&&e.setAttribute("nonce",t),e.appendChild(document.createTextNode(".GptWebCitation-module_overlay__OY5pa{display:flex;flex-direction:column;font-family:Plus Jakarta Sans,-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif;width:100%}.GptWebCitation-module_gptCitationWrapper__EN7nk{background-color:#fff;border:solid #e5e7eb;border-radius:8px;border-width:1px 1px 2px;box-shadow:0 1px 2px #0000000d;box-sizing:border-box;display:flex;flex-direction:column;overflow:hidden;position:relative;width:100%}.GptWebCitation-module_gptCitationToggleFooter__ncfLT{align-items:center;background-color:#f2f4f7;border-top:1px solid #e5e7eb;display:flex;flex-shrink:0;padding:1rem 1.5rem}.GptWebCitation-module_gptCitationFooterAction__WWpAY{align-items:center;bottom:0;box-sizing:border-box;display:flex;height:3rem;left:1.5rem;padding:0;pointer-events:none;position:absolute;z-index:2}.GptWebCitation-module_gptCitationFooterAction__WWpAY>*{pointer-events:auto}.GptWebCitation-module_gptCitationWrapperWithSource__1-ynq [class*=modalFooterSource]{justify-content:flex-end!important;padding-left:13rem}.GptWebCitation-module_panel__ek9Lq{background-color:#fff;border:1px solid #e5e7eb;border-radius:8px;box-shadow:0 1px 2px #0000000d;color:#1f2937;display:flex;flex-direction:column;font-family:Plus Jakarta Sans,-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif;width:100%}.GptWebCitation-module_panelHeader__afwge{align-items:center;background-color:#f9fafb;border-bottom:1px solid #e5e7eb;display:flex;font-size:13px;gap:8px;justify-content:space-between;padding:8px 16px}.GptWebCitation-module_panelSource__oFl-c{color:#374151;flex:1;font-weight:600;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.GptWebCitation-module_panelHeaderActions__sGrhi{align-items:center;display:flex;flex-shrink:0;gap:8px}.GptWebCitation-module_pagination__VQvbY{align-items:center;background-color:#fff;border:1px solid #d1d5db;border-radius:6px;display:flex;gap:2px;padding:2px 4px}.GptWebCitation-module_paginationButton__fzJyQ{align-items:center;background:#0000;border:none;border-radius:4px;color:#6b7280;cursor:pointer;display:flex;justify-content:center;padding:2px}.GptWebCitation-module_paginationButton__fzJyQ:hover:not(:disabled){background-color:#f3f4f6}.GptWebCitation-module_paginationButton__fzJyQ:disabled{cursor:not-allowed;opacity:.4}.GptWebCitation-module_paginationLabel__S7t1W{color:#6b7280;font-size:12px;min-width:36px;padding:0 4px;text-align:center}.GptWebCitation-module_confidenceBadge__4BBTf{align-items:center;background-color:#ecfdf5;border:1px solid #10b981;border-radius:9999px;color:#059669;display:inline-flex;font-size:13px;font-weight:500;gap:4px;padding:4px 10px}.GptWebCitation-module_panelContent__vg-mG{max-height:192px;overflow-y:auto;padding:8px 12px 12px}.GptWebCitation-module_panelContentExpanded__3aGjq{display:flex;flex-direction:column;max-height:none;min-height:384px;overflow:hidden}.GptWebCitation-module_markdownBody__5kdwH{color:#374151;font-size:14px;line-height:1.6}.GptWebCitation-module_markdownBody__5kdwH ol{list-style-type:lower-alpha;margin:0;padding-left:1.25rem}.GptWebCitation-module_markdownBody__5kdwH li{margin-bottom:8px}.GptWebCitation-module_markdownBody__5kdwH code{background-color:#f3f4f6;border-radius:4px;color:#1f2937;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;font-size:13px;padding:1px 6px}.GptWebCitation-module_highlight__Xr1wl{background-color:#fef08a;border-radius:2px;color:#1f2937;padding:0 2px}.GptWebCitation-module_highlightActive__iFuz5{background-color:#fde047;border:1px solid #eab308;box-shadow:0 1px 2px #0000001a}.GptWebCitation-module_citationLink__kH9JC{color:#2563eb;font-weight:500;text-decoration:none}.GptWebCitation-module_citationLink__kH9JC:hover{text-decoration:underline}.GptWebCitation-module_citationLinkActive__SShYx{background-color:#fef08a;border:1px solid #eab308;border-radius:2px;color:#1f2937;padding:0 2px}.GptWebCitation-module_panelFooter__wm98C{align-items:center;background-color:#f9fafb;border-top:1px solid #e5e7eb;display:flex;font-size:13px;justify-content:space-between;padding:8px 16px}.GptWebCitation-module_webCitationButton__blI--{align-items:center;background-color:#f9fafb;border:1px solid #e5e7eb;border-radius:8px;color:#2563eb;cursor:pointer;display:inline-flex;font-size:14px;font-weight:700;gap:8px;justify-content:center;line-height:1.25;min-width:180px;padding:6px 16px;transition:background-color .15s ease;white-space:nowrap}.GptWebCitation-module_webCitationButton__blI--:hover:not(:disabled){background-color:#f3f4f6}.GptWebCitation-module_webCitationButton__blI--:disabled{cursor:not-allowed;opacity:.75}.GptWebCitation-module_webCitationButtonIcon__r9lPc{color:#2563eb;flex-shrink:0}.GptWebCitation-module_learnedFrom__DMyLS{color:#6b7280;font-size:13px}.GptWebCitation-module_imageCitationWrapper__iQUSw{box-sizing:border-box;display:flex;flex:1;flex-direction:column;gap:12px;min-height:0;padding:8px 4px;width:100%}.GptWebCitation-module_imageCitationCenter__DMlqn{display:flex;flex:1;justify-content:center;min-height:0;position:relative;width:100%}.GptWebCitation-module_imageCitationViewport__xcotr{height:100%;max-width:100%;min-height:0;position:relative;width:100%}.GptWebCitation-module_imageCitationScrollContainer__bAQNk{background-color:#f9fafb;border:1px solid #e5e7eb;border-radius:12px;height:100%;max-height:100%;overflow-x:hidden;overflow-y:auto;overscroll-behavior:contain;scrollbar-color:#cbd5e1 #0000;scrollbar-width:thin;width:100%}.GptWebCitation-module_imageCitationScrollContainer__bAQNk::-webkit-scrollbar{width:8px}.GptWebCitation-module_imageCitationScrollContainer__bAQNk::-webkit-scrollbar-thumb{background-color:#cbd5e1;border-radius:9999px}.GptWebCitation-module_imageCitationScrollContainer__bAQNk::-webkit-scrollbar-track{background-color:initial}.GptWebCitation-module_citationImage__7rWdT{background-color:#f9fafb;border:none;border-radius:0;display:block;height:auto;max-width:100%;object-fit:unset;width:100%}.GptWebCitation-module_citationImagePreload__L7ibJ{height:0;opacity:0;pointer-events:none;position:absolute;visibility:hidden;width:0}.GptWebCitation-module_expandImageButton__598k6{align-items:center;background-color:#374151eb;border:none;border-radius:6px;bottom:12px;box-shadow:0 2px 6px #0003;color:#fff;cursor:pointer;display:inline-flex;height:32px;justify-content:center;padding:0;position:absolute;right:12px;transition:background-color .15s ease;width:32px;z-index:2}.GptWebCitation-module_expandImageButton__598k6:hover{background-color:#1f2937}.GptWebCitation-module_expandImageButton__598k6 svg{flex-shrink:0}.GptWebCitation-module_fullScreenOverlay__Z5U8h{align-items:center;backdrop-filter:blur(4px);background-color:#0009;display:flex;inset:0;justify-content:center;overflow:hidden;overscroll-behavior:contain;padding:16px;position:fixed;z-index:1100}.GptWebCitation-module_fullScreenContent__xIXZR{background-color:#fff;border:1px solid #e5e7eb;border-radius:16px;box-shadow:0 25px 50px -12px #00000040;max-height:90vh;max-width:95vw;overflow:hidden;position:relative}.GptWebCitation-module_fullScreenCloseButton__lnaT1{align-items:center;background-color:#374151eb;border:none;border-radius:6px;box-shadow:0 2px 6px #0003;color:#fff;cursor:pointer;display:inline-flex;height:32px;justify-content:center;padding:0;position:absolute;right:16px;top:16px;transition:background-color .15s ease;width:32px;z-index:1}.GptWebCitation-module_fullScreenCloseButton__lnaT1:hover{background-color:#1f2937}.GptWebCitation-module_fullScreenImageWrapper__ADPGU{align-items:flex-start;display:flex;justify-content:center;max-height:80vh;overflow-x:hidden;overflow-y:auto;overscroll-behavior:contain;padding:8px;scrollbar-color:#cbd5e1 #0000;scrollbar-width:thin;width:100%}.GptWebCitation-module_fullScreenImage__jLVAQ{border-radius:12px;height:auto;max-width:100%;object-fit:unset;width:100%}.GptWebCitation-module_visitLinkRow__H8ai5{align-items:center;display:flex;flex-shrink:0;gap:12px;justify-content:flex-start;padding:4px 8px 0;width:100%}.GptWebCitation-module_visitLinkHint__FAwob{color:#6b7280;font-size:13px;line-height:1.4}.GptWebCitation-module_visitLink__1BDo8{align-items:center;background-color:#2563eb1f;border-radius:6px;color:#2563eb;display:inline-flex;flex-shrink:0;font-size:13px;font-weight:600;gap:6px;padding:6px 12px;text-decoration:none;white-space:nowrap}.GptWebCitation-module_visitLink__1BDo8:hover{background-color:#2563eb2e;text-decoration:none}.GptWebCitation-module_skeleton__1q51h{align-items:center;background-color:#f3f4f6;border-radius:12px;display:flex;justify-content:center;min-height:384px;overflow:hidden;padding:24px;position:relative;width:100%}.GptWebCitation-module_skeletonText__E6XgN{color:#6b7280;font-size:14px;line-height:1.5;max-width:320px;position:relative;text-align:center;z-index:1}.GptWebCitation-module_skeletonShimmer__yqWJh{animation:GptWebCitation-module_shimmer__-ZbQA 1.5s linear infinite;background:linear-gradient(90deg,#0000,#fff9,#0000);inset:0;position:absolute}@keyframes GptWebCitation-module_shimmer__-ZbQA{0%{transform:translateX(-100%)}to{transform:translateX(100%)}}"));const o=document.head||document.getElementsByTagName("head")[0]||document.documentElement;o&&o.appendChild(e)}();export{e as default};
|
|
2
|
+
//# sourceMappingURL=GptWebCitation.module.css.js.map
|