@viswa-test/test-citation 0.0.235 → 0.0.237

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.
Files changed (107) hide show
  1. package/dist/cjs/features/CognitiveCompare/CognitiveCompare.js +1 -1
  2. package/dist/cjs/features/CognitiveCompare/CognitiveComparehelpers.js +1 -1
  3. package/dist/cjs/features/CognitiveCompare/components/RHSSectionRow.js +1 -1
  4. package/dist/cjs/features/CognitiveCompare/components/SectionAccordion.js +1 -1
  5. package/dist/cjs/features/CognitiveCompare/components/SubSectionAccordion.js +1 -1
  6. package/dist/cjs/features/CognitiveCompare/components/SvgConnectors.js +1 -1
  7. package/dist/cjs/features/CognitiveCompare/components/connectedLines.js +1 -1
  8. package/dist/cjs/features/CognitiveCompare/hooks/memoizedMarkdown.js +1 -1
  9. package/dist/cjs/features/GptWebCitation/GptWebCitationMarkdown.js +2 -0
  10. package/dist/cjs/features/GptWebCitation/GptWebCitationMarkdown.js.map +1 -0
  11. package/dist/cjs/features/RequirementAI/components/RichTextEditor/Editor/Editor.js +1 -1
  12. package/dist/cjs/features/RequirementAI/components/RichTextEditor/Editor/plugins/ManualNode.js +1 -1
  13. package/dist/cjs/features/RequirementAI/components/RichTextEditor/Editor/plugins/UpdateNode.js +1 -1
  14. package/dist/cjs/features/RequirementAI/components/RichTextEditor/Editor/theme/theme.css.js +1 -1
  15. package/dist/cjs/features/RequirementAI/components/RichTextEditor/RichTextEditor.js +1 -1
  16. package/dist/cjs/features/RequirementAI/components/UserStoryCard/CognitiveComponents/CognitiveComponent.js +1 -1
  17. package/dist/cjs/features/RequirementAI/components/UserStoryCard/Popups/DeviationSummary.js +1 -1
  18. package/dist/cjs/features/RequirementAI/components/UserStoryCard/Popups/EditBlockPopup.js +2 -0
  19. package/dist/cjs/features/RequirementAI/components/UserStoryCard/Popups/EditBlockPopup.js.map +1 -0
  20. package/dist/cjs/features/RequirementAI/components/UserStoryCard/Popups/ManualEditPopup.js +1 -1
  21. package/dist/cjs/features/RequirementAI/components/UserStoryCard/Popups/RedlineStatusCard.js +1 -1
  22. package/dist/cjs/features/RequirementAI/components/UserStoryCard/UserStoryCard.js +1 -1
  23. package/dist/cjs/features/RequirementAI/components/userstory-with-citation/UserStoryWithCitation.js +1 -1
  24. package/dist/cjs/features/RequirementAI/components/userstory-with-citation/UserStoryWithCitation.module.css.js +1 -1
  25. package/dist/cjs/features/RequirementAI/components/userstory-with-citation/components/InlineManualComponent.js +1 -1
  26. package/dist/cjs/features/RequirementAI/components/userstory-with-citation/components/InlineUpdatedComponent.js +1 -1
  27. package/dist/cjs/features/RequirementAI/components/userstory-with-citation/components/InlineUpdatedComponent.module.css.js +1 -1
  28. package/dist/cjs/utils/tagHelper.js +1 -1
  29. package/dist/features/CognitiveCompare/CognitiveCompare.js +1 -1
  30. package/dist/features/CognitiveCompare/CognitiveComparehelpers.js +1 -1
  31. package/dist/features/CognitiveCompare/components/RHSSectionRow.js +1 -1
  32. package/dist/features/CognitiveCompare/components/SectionAccordion.js +1 -1
  33. package/dist/features/CognitiveCompare/components/SubSectionAccordion.js +1 -1
  34. package/dist/features/CognitiveCompare/components/SvgConnectors.js +1 -1
  35. package/dist/features/CognitiveCompare/components/connectedLines.js +1 -1
  36. package/dist/features/CognitiveCompare/hooks/memoizedMarkdown.js +1 -1
  37. package/dist/features/GptWebCitation/GptWebCitationMarkdown.js +2 -0
  38. package/dist/features/GptWebCitation/GptWebCitationMarkdown.js.map +1 -0
  39. package/dist/features/RequirementAI/components/RichTextEditor/Editor/Editor.js +1 -1
  40. package/dist/features/RequirementAI/components/RichTextEditor/Editor/plugins/ManualNode.js +1 -1
  41. package/dist/features/RequirementAI/components/RichTextEditor/Editor/plugins/UpdateNode.js +1 -1
  42. package/dist/features/RequirementAI/components/RichTextEditor/Editor/theme/theme.css.js +1 -1
  43. package/dist/features/RequirementAI/components/RichTextEditor/RichTextEditor.js +1 -1
  44. package/dist/features/RequirementAI/components/UserStoryCard/CognitiveComponents/CognitiveComponent.js +1 -1
  45. package/dist/features/RequirementAI/components/UserStoryCard/Popups/DeviationSummary.js +1 -1
  46. package/dist/features/RequirementAI/components/UserStoryCard/Popups/EditBlockPopup.js +2 -0
  47. package/dist/features/RequirementAI/components/UserStoryCard/Popups/EditBlockPopup.js.map +1 -0
  48. package/dist/features/RequirementAI/components/UserStoryCard/Popups/ManualEditPopup.js +1 -1
  49. package/dist/features/RequirementAI/components/UserStoryCard/Popups/RedlineStatusCard.js +1 -1
  50. package/dist/features/RequirementAI/components/UserStoryCard/UserStoryCard.js +1 -1
  51. package/dist/features/RequirementAI/components/userstory-with-citation/UserStoryWithCitation.js +1 -1
  52. package/dist/features/RequirementAI/components/userstory-with-citation/UserStoryWithCitation.module.css.js +1 -1
  53. package/dist/features/RequirementAI/components/userstory-with-citation/components/InlineManualComponent.js +1 -1
  54. package/dist/features/RequirementAI/components/userstory-with-citation/components/InlineUpdatedComponent.js +1 -1
  55. package/dist/features/RequirementAI/components/userstory-with-citation/components/InlineUpdatedComponent.module.css.js +1 -1
  56. package/dist/types/src/CitationAccordionTest.d.ts +1 -0
  57. package/dist/types/src/CitationAccordionTest.d.ts.map +1 -0
  58. package/dist/types/src/DeviationSummaryTest.d.ts.map +1 -1
  59. package/dist/types/src/MockDeviationSummary.d.ts +1 -0
  60. package/dist/types/src/MockDeviationSummary.d.ts.map +1 -0
  61. package/dist/types/src/RedlineEditorTest.d.ts.map +1 -1
  62. package/dist/types/src/RequirementAiTest.d.ts.map +1 -1
  63. package/dist/types/src/features/CognitiveCompare/CognitiveCompare.d.ts.map +1 -1
  64. package/dist/types/src/features/CognitiveCompare/CognitiveComparehelpers.d.ts +9 -0
  65. package/dist/types/src/features/CognitiveCompare/CognitiveComparehelpers.d.ts.map +1 -1
  66. package/dist/types/src/features/CognitiveCompare/CompareContext.d.ts +1 -0
  67. package/dist/types/src/features/CognitiveCompare/CompareContext.d.ts.map +1 -1
  68. package/dist/types/src/features/CognitiveCompare/Guidelines/constants/guidelines.mockData.d.ts +27546 -1239
  69. package/dist/types/src/features/CognitiveCompare/Guidelines/constants/guidelines.mockData.d.ts.map +1 -1
  70. package/dist/types/src/features/CognitiveCompare/components/RHSSectionRow.d.ts.map +1 -1
  71. package/dist/types/src/features/CognitiveCompare/components/SectionAccordion.d.ts.map +1 -1
  72. package/dist/types/src/features/CognitiveCompare/components/SubSectionAccordion.d.ts +1 -0
  73. package/dist/types/src/features/CognitiveCompare/components/SubSectionAccordion.d.ts.map +1 -1
  74. package/dist/types/src/features/CognitiveCompare/components/SvgConnectors.d.ts +2 -1
  75. package/dist/types/src/features/CognitiveCompare/components/SvgConnectors.d.ts.map +1 -1
  76. package/dist/types/src/features/CognitiveCompare/components/connectedLines.d.ts +1 -0
  77. package/dist/types/src/features/CognitiveCompare/components/connectedLines.d.ts.map +1 -1
  78. package/dist/types/src/features/RequirementAI/components/RichTextEditor/Editor/plugins/ManualNode.d.ts +2 -1
  79. package/dist/types/src/features/RequirementAI/components/RichTextEditor/Editor/plugins/ManualNode.d.ts.map +1 -1
  80. package/dist/types/src/features/RequirementAI/components/RichTextEditor/Editor/plugins/UpdateNode.d.ts +2 -1
  81. package/dist/types/src/features/RequirementAI/components/RichTextEditor/Editor/plugins/UpdateNode.d.ts.map +1 -1
  82. package/dist/types/src/features/RequirementAI/components/RichTextEditor/RichTextEditor.d.ts.map +1 -1
  83. package/dist/types/src/features/RequirementAI/components/UserStoryCard/CognitiveComponents/CognitiveComponent.d.ts +2 -2
  84. package/dist/types/src/features/RequirementAI/components/UserStoryCard/CognitiveComponents/CognitiveComponent.d.ts.map +1 -1
  85. package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/DeviationSummary.d.ts +28 -9
  86. package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/DeviationSummary.d.ts.map +1 -1
  87. package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/EditBlockPopup.d.ts +7 -0
  88. package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/EditBlockPopup.d.ts.map +1 -0
  89. package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/RedlineStatusCard.d.ts +7 -1
  90. package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/RedlineStatusCard.d.ts.map +1 -1
  91. package/dist/types/src/features/RequirementAI/components/UserStoryCard/UserStoryCard.d.ts +8 -2
  92. package/dist/types/src/features/RequirementAI/components/UserStoryCard/UserStoryCard.d.ts.map +1 -1
  93. package/dist/types/src/features/RequirementAI/components/userstory-with-citation/UserStoryWithCitation.d.ts.map +1 -1
  94. package/dist/types/src/features/RequirementAI/components/userstory-with-citation/components/InlineManualComponent.d.ts +1 -0
  95. package/dist/types/src/features/RequirementAI/components/userstory-with-citation/components/InlineManualComponent.d.ts.map +1 -1
  96. package/dist/types/src/features/RequirementAI/components/userstory-with-citation/components/InlineUpdatedComponent.d.ts +3 -1
  97. package/dist/types/src/features/RequirementAI/components/userstory-with-citation/components/InlineUpdatedComponent.d.ts.map +1 -1
  98. package/dist/types/src/utils/tagHelper.d.ts +1 -1
  99. package/dist/types/src/utils/tagHelper.d.ts.map +1 -1
  100. package/dist/utils/tagHelper.js +1 -1
  101. package/package.json +5 -5
  102. package/dist/types/src/constants/deviationData.d.ts +0 -887
  103. package/dist/types/src/constants/deviationData.d.ts.map +0 -1
  104. package/dist/types/src/constants/treeData.d.ts +0 -732
  105. package/dist/types/src/constants/treeData.d.ts.map +0 -1
  106. package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/BlockedPopup.d.ts +0 -8
  107. package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/BlockedPopup.d.ts.map +0 -1
@@ -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 a,useEffect as c,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 b,findKeyPathByNodeId as y,DEVIATION_BADGE_SEPARATOR as C,hasMeaningfulRedlineTags as w,scrollAndHighlightClause as B,scrollAndWait as _,waitForScrollIdle as E}from"./CognitiveComparehelpers.js";import{SHARED_MARKDOWN_STYLES as F,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 k}from"./CognitiveCompareConstants.js";import O from"./CognitivePopup.js";import P from"./MoreFunctionsPopup.js";import j from"./LoaderComponent.js";import L from"./components/ThreeDotsLoader.js";import{useCognitiveTreeData as N}from"./hooks/useCompareData.js";import{useComparePopups as M}from"./hooks/useComparePopups.js";import{useSectionRefs as H}from"./hooks/useSectionRefs.js";import{useAccordionState as z}from"./hooks/useAccordionState.js";import{useDeviationNavigation as q}from"./hooks/useDeviationNavigation.js";import W from"./components/CompareHeader.js";import V from"./components/SubSectionAccordion.js";import G from"./components/LHSSectionRow.js";import K from"./components/RHSSectionRow.js";import Y from"./components/CognitiveSummaryPopup.js";import{CompareContextProvider as J}from"./CompareContext.js";import{useStyleHelpers as X}from"./hooks/useStyles.js";import{useResizeHandler as $}from"./hooks/useResizeHandler.js";import{useLinesCalculator as U}from"./hooks/useLinesCalculator.js";import{useSideBySide as Q}from"./hooks/useSideBySide.js";import Z from"./components/SvgConnectors.js";import ee from"./Guidelines/components/GuidelinePanel.js";var ne=function(ne){var ie,te,oe,re,le,ue,ae,ce,se,de,ve,fe,pe,ge,he,me,Se,xe,Re,be,ye,Ce,we,Be,_e,Ee,Fe,Ie,Te,Ae,De,ke,Oe,Pe,je,Le=ne.componentHeaderText,Ne=void 0===Le?k:Le,Me=ne.treeData,He=ne.comparisonConfig,ze=ne.leftColumnTitleText,qe=ne.rightColumnTitleText,We=ne.markdownStyles,Ve=ne.resetTrigger,Ge=ne.displayConfig,Ke=void 0===Ge?{isHeaderVisible:!0,isToggleVisible:!0,maintainRelativeOrder:!1,isLoading:!0,showDeviationBadges:!1,enableDeviationSchemaBackwardCompatibility:!1,displayEmailNotifier:!0,isStreamingEnabled:!1}:Ge,Ye=ne.onMaintainRelativeOrderChange,Je=ne.popupConfig,Xe=ne.deviationData,$e=void 0===Xe?{}:Xe,Ue=ne.deviationNodeIdToView,Qe=ne.resetDeviationNodeId,Ze=ne.isProposingFix,en=void 0!==Ze&&Ze,nn=ne.proposingFixNodeId,tn=ne.isRedlineFlow,on=ne.badgeStyleOverride,rn=ne.guidelinesData,ln=l(Ke.maintainRelativeOrder),un=ln[0],an=ln[1],cn=null!==(ie=null==Ke?void 0:Ke.expandLevels)&&void 0!==ie?ie:0,sn=!!(null==Ke?void 0:Ke.expandAllSections),dn=!!un||!!(null==Ke?void 0:Ke.showDeviationBadges),vn=l(!1),fn=vn[0],pn=vn[1],gn=l(null),hn=gn[0],mn=gn[1],Sn=l(null===(oe=null!==(te=null==Me?void 0:Me.newEvaluationResult)&&void 0!==te?te:null==Ke?void 0:Ke.enableDeviationSchemaBackwardCompatibility)||void 0===oe||oe)[0],xn=l(new Set),Rn=xn[0],bn=xn[1],yn=l([]),Cn=yn[0],wn=yn[1],Bn=l(!1),_n=Bn[0],En=Bn[1],Fn=u(null),In=u(null),Tn=u(null),An=u(null),Dn=u(null),kn=u(!1),On=u(null),Pn=u({}),jn=u([]),Ln=u(function(){}),Nn=u(null),Mn=u(function(){}),Hn=a(function(){return JSON.stringify($e||{})},[JSON.stringify($e)]),zn=a(function(){return $e||{}},[Hn]),qn=a(function(){return(null==Me?void 0:Me.cognitive_decisioning)||{}},[Me]),Wn=a(function(){return e(e({},F),We)},[We]),Vn=u(null),Gn=u(null),Kn=u(null),Yn=u(null),Jn=u(null),Xn=u(null),$n=u(null),Un=u(null),Qn=u(null),Zn=u(null),ei=M(Vn),ni=ei.cognitivePopup,ii=ei.setCognitivePopup,ti=ei.moreFunctions,oi=ei.setMoreFunctions,ri=ei.position,li=ei.setPosition,ui=ei.activeBadgeId,ai=ei.summaryPopup,ci=ei.setSummaryPopup,si=ei.closeSummaryPopup,di=ei.setActiveBadgeId,vi=ei.popupRef,fi=ei.handleOpenCognitiveCompare,pi=ei.openCognitivePopupFromState,gi=ei.closeCognitivePopup,hi=ei.closeMoreFunctionsPopup,mi=a(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]),Si=l(null),xi=Si[0];Si[1];var Ri=null===(ue=null===(re=null==Me?void 0:Me.documents)||void 0===re?void 0:re[null===(le=null==Me?void 0:Me.input_index_map)||void 0===le?void 0:le[0]])||void 0===ue?void 0:ue.title,bi=null===(se=null===(ae=null==Me?void 0:Me.documents)||void 0===ae?void 0:ae[null===(ce=null==Me?void 0:Me.input_index_map)||void 0===ce?void 0:ce[1]])||void 0===se?void 0:se.title,yi=x(ze||Ri||"Uploaded Contract"),Ci=null===(pe=null===(fe=null===(de=null==Me?void 0:Me.documents)||void 0===de?void 0:de[null===(ve=null==Me?void 0:Me.input_index_map)||void 0===ve?void 0:ve[0]])||void 0===fe?void 0:fe.metadata)||void 0===pe?void 0:pe.file_name,wi=x(Ci),Bi=null===(Se=null===(me=null===(ge=null==Me?void 0:Me.documents)||void 0===ge?void 0:ge[null===(he=null==Me?void 0:Me.input_index_map)||void 0===he?void 0:he[1]])||void 0===me?void 0:me.metadata)||void 0===Se?void 0:Se.file_name,_i=x(Bi),Ei=x(qe||bi||"Reference Template"),Fi=N(Me,un,zn,mi,Sn,rn),Ii=Fi.isGuidelineMode,Ti=Fi.activeProposed,Ai=Fi.existingRule,Di=Fi.proposedSections,ki=Fi.existingSections,Oi=Fi.visibleFields,Pi=Fi.parentDeviationRecord,ji=Fi.deviationNumberRegistry,Li=Fi.deviationParentRegistry,Ni=Fi.parseError;c(function(){Ni&&mn("Failed to load comparison: ".concat(Ni))},[Ni]);var Mi=Di.length>0||ki.length>0,Hi=a(function(){if(!tn)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(Di),i(ki),"".concat(e,":").concat(n)},[tn,Di,ki]);c(function(){if(Di.length||ki.length)if(sn){var e={},n={},i=function(i,t){i.forEach(function(i,o){var r,l=un?"".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(Di,"left"),i(ki,"right"),bt(e),Ct(n)}else if(cn>0){var t={},o={},r=function(e,n,i){e.forEach(function(e,r){var l;if(i>=1){var u=un?"".concat(n,"-").concat(r):String(r);t[u]=!0}var a=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)&&a(e.subsections,l,t+1)})};(null===(l=e.subsections)||void 0===l?void 0:l.length)&&i>=2&&a(e.subsections,String(r),2)})};r(Di,"left",cn),r(ki,"right",cn),bt(t),Ct(o)}},[sn,cn,Di,ki,un]);var zi=H(Oi.map(function(e){return e.key}),Math.max(Di.length,ki.length)),qi=zi.leftRefs,Wi=zi.rightRefs,Vi=zi.sectionLeftRefs,Gi=zi.sectionRightRefs,Ki=zi.lhsBadgeRefs,Yi=zi.rhsBadgeRefs,Ji=zi.sectionRightRowRefs,Xi=zi.subSectionLeftRefs,$i=zi.subSectionRightRefs,Ui=zi.sectionRowRefs,Qi=zi.getSectionRowRef,Zi=zi.getSubSectionRef,et=zi.getBadgeRef,nt=Q({isGuidelineMode:Ii,maintainRelativeOrder:un,proposedSections:Di,existingSections:ki,leftContainerRef:Un,rightContainerRef:Kn,scrollContainerRef:Vn,sectionLeftRefs:Vi,sectionRightRefs:Gi,subSectionLeftRefs:Xi,subSectionRightRefs:$i,lhsBadgeRefs:Ki,rhsBadgeRefs:Yi,sectionRowRefs:Ui,sectionRightRowRefs:Ji,rhsTopSpacerRef:Yn,rhsBottomSpacerRef:Jn,lhsTopSpacerRef:Xn,lhsBottomSpacerRef:$n,calculateLinesRef:Ln,setConnectedSections:bn,setConnectedLines:wn,cachedConnectedPositions:jn,closeMoreFunctionsPopup:hi,setErrorToast:mn,moreFunctions:ti,closeSummaryPopup:si}),it=nt.isSideBySide,tt=nt.isArrowVisible,ot=nt.setIsArrowVisible,rt=nt.isResizing,lt=nt.setIsResizing,ut=nt.isSideBySideLoading,at=nt.activeSideBySideSection,ct=nt.scrollLock,st=nt.sideBySideCacheRef,dt=nt.isSideBySideRef,vt=nt.activeSideBySideRightSectionRef,ft=nt.activeSideBySideSectionRef,pt=nt.sideBySideLineRef,gt=nt.highlightedClauseRefs,ht=nt.clearClauseHighlight,mt=nt.resetSideBySide,St=nt.activateSideBySide,xt=z({maintainRelativeOrder:!!un,proposedSections:Di,existingSections:ki,activeSideBySideSection:at,connectedSections:Rn,resetSideBySide:mt,setConnectedSections:bn,setConnectedLines:wn,cachedConnectedPositions:jn,svgContainerRef:Fn,isAnimatingRef:kn,animationTimerRef:On,calculateLinesRef:Ln,sectionLeftRefs:Vi,sectionRightRefs:Gi,subSectionLeftRefs:Xi,subSectionRightRefs:$i}),Rt=xt.expandedSections,bt=xt.setExpandedSections,yt=xt.expandedSubSections,Ct=xt.setExpandedSubSections,wt=xt.handleSubSectionToggle,Bt=xt.toggleSection,_t=xt.forceExpandCrossWiredSections,Et=function(){var e,n;if(null!=at){var i=null===(e=Vi.current[at])||void 0===e?void 0:e.current,t=null===(n=Gi.current[at])||void 0===n?void 0:n.current,o=Kn.current;if(i&&t&&o){var r=i.getBoundingClientRect(),l=t.getBoundingClientRect(),u=o.getBoundingClientRect(),a=r.top-u.top,c=l.top-u.top-a;o.scrollBy({top:c,behavior:"smooth"})}}},Ft=s(function(e){null==e||e.stopPropagation(),En(function(e){var n=!e;return n&&requestAnimationFrame(function(){Et()}),n})},[Et]);c(function(){tn&&"off"!==Hi&&"0:0"!==Hi&&(st.current=null,jn.current=[],requestAnimationFrame(function(){var e;null===(e=Ln.current)||void 0===e||e.call(Ln)}))},[tn,Hi]);var It=a(function(){var e=new Map,n=new Map,i=1;if(un)Di.forEach(function(n){!n.title&&!n.content||n.id&&e.set(n.id,i++)}),ki.forEach(function(t){if(t.id&&!(!t.title&&!t.content)){var o=Di.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(Di.length,ki.length),o=0;o<t;o++){var r=Di[o],l=ki[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}},[Di,ki,un]),Tt=Ai.analysis,At=x(null===(Re=null===(xe=null==Tt?void 0:Tt.rule_difference_comparison)||void 0===xe?void 0:xe.summary)||void 0===Re?void 0:Re.overall_summary),Dt=!!At.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),kt=null!==(be=null==Me?void 0:Me.base_root_id)&&void 0!==be?be:"-1";null==Me||Me[kt];var Ot=Sn?null!==(ke=null!==(Te=$e&&(null===(Ie=null==$e?void 0:$e[kt])||void 0===Ie?void 0:Ie.evaluation_result))&&void 0!==Te?Te:null===(De=null===(Ae=null==Me?void 0:Me.nodes)||void 0===Ae?void 0:Ae[kt])||void 0===De?void 0:De.evaluation_result)&&void 0!==ke?ke:null:null!==(Fe=null!==(we=$e&&(null===(Ce=null===(ye=null==$e?void 0:$e[kt])||void 0===ye?void 0:ye.evaluation_result)||void 0===Ce?void 0:Ce[0]))&&void 0!==we?we:null===(Ee=null===(_e=null===(Be=null==Me?void 0:Me.nodes)||void 0===Be?void 0:Be[kt])||void 0===_e?void 0:_e.evaluation_result)||void 0===Ee?void 0:Ee[0])&&void 0!==Fe?Fe:null,Pt=R(Ot),jt=b(null!==(je=null===(Pe=null===(Oe=null==Ot?void 0:Ot.evaluation_outputs)||void 0===Oe?void 0:Oe.metadata)||void 0===Pe?void 0:Pe.label_color)&&void 0!==je?je:A);if(on){var Lt=on(Pt);Lt&&(jt=e(e({},jt),{badgeBg:Lt.bg,badgeText:Lt.text,badgeBorder:Lt.border}))}var Nt=u(mt);c(function(){Nt.current=mt},[mt]);var Mt=u(gi);c(function(){Mt.current=gi},[gi]);var Ht=s(function(e,n,i,t,o,r){return Go.current(e,n,i,t,o,r)},[]),zt=s(function(e,n,i,t,o){return Yo.current(e,n,i,t,o)},[]),qt=s(function(){return Jo.current()},[]),Wt=s(function(e,n){return Xo.current(e,n)},[]),Vt=s(function(e){return $o.current(e)},[]),Gt=s(function(e){return Uo.current(e)},[]),Kt=s(function(){return Qo.current()},[]),Yt=s(function(){var e,n;ht(),null===(e=Nt.current)||void 0===e||e.call(Nt),En(!1),bn(new Set),wn([]),jn.current=[],fo([]),go(null),ci(D),null===(n=Mt.current)||void 0===n||n.call(Mt),requestAnimationFrame(function(){var e;null===(e=Ln.current)||void 0===e||e.call(Ln)})},[]),Jt=u(Yt);c(function(){Jt.current=Yt},[Yt]),c(function(){Ve&&Jt.current()},[Ve]);var Xt=a(function(){return{documents:null==Me?void 0:Me.documents,input_index_map:null==Me?void 0:Me.input_index_map}},[JSON.stringify(null==Me?void 0:Me.documents),JSON.stringify(null==Me?void 0:Me.input_index_map)]),$t=u(Me);c(function(){$t.current=Me},[Me]);var Ut=u(qn);c(function(){Ut.current=qn},[qn]);var Qt=s(function(n,i,t,o,r,l,u){var a,c,s,d,v,f,p,g,h,m,S,R,b=x(null==i?void 0:i.id)||x(null==t?void 0:t.id)||"",y=(b?null===(a=Ut.current)||void 0===a?void 0:a[b]:null)||(null==i?void 0:i.cognitiveData)||(null==t?void 0:t.cognitiveData)||{section_id:b,decisioning:[],gap:[],relevance_score:0},w=null!==(s=null===(c=Ui.current[o])||void 0===c?void 0:c.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 a=o.split(C)[1];if(!a)return l;var c=(null==i?void 0:i.evaluationResult)||(null==t?void 0:t.evaluationResult)||{},s=(null===(n=null==c?void 0:c.deviation_entries)||void 0===n?void 0:n[a])||(null===(r=null==c?void 0:c.deviations)||void 0===r?void 0:r[a])||null;return s?e(e(e({},c),s),{deviation_summary:(null==s?void 0:s.deviation_summary)||(null==c?void 0:c.deviation_summary),deviation_title:(null==s?void 0:s.deviation_title)||(null==c?void 0:c.deviation_title),deviation_impact:(null==s?void 0:s.deviation_impact)||(null==c?void 0:c.deviation_impact),deviation_explanation:(null==s?void 0:s.deviation_explanation)||(null==c?void 0:c.deviation_explanation),evaluation_outputs:(null==s?void 0:s.evaluation_outputs)||(null==c?void 0:c.evaluation_outputs),cognitive_decisioning:(null==s?void 0:s.cognitive_decisioning)||(null==c?void 0:c.cognitive_decisioning)}):u(l)}(),_=(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,E=null!==(m=null==Ke?void 0:Ke.isLoading)&&void 0!==m&&m,F=!0;if(Ii)if(B&&Object.keys(B).length>0){var I=Array.isArray(B)?B[0]:B,T=null===(R=null===(S=null==I?void 0:I.evaluation_outputs)||void 0===S?void 0:S.metadata)||void 0===R?void 0:R.is_orphan;!0!==T&&"true"!==T&&"Yes"!==T&&"yes"!==T||(F=!1)}else F=!1;return{isLoading:E&&!_,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:y,anchorEl:n,sectionAnchorEl:w,badgeStyle:l||null,sectionIdx:o,docData:Xt,deviationData:B,isOrphan:!!r,hasGuidelineMatches:F}},[Xt,null==Ke?void 0:Ke.isLoading,Ii]),Zt=s(function(e,n,i,t,o,r){var l;if(e.stopPropagation(),ti.open&&ti.sectionIdx===o)hi();else{var u=e.currentTarget,a="left";(null===(l=Kn.current)||void 0===l?void 0:l.contains(u))&&(a="right");ht(),dt.current&&mt(),bn(new Set),wn([]),jn.current=[],gi(),ai.open?_o():si(),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"===a?null===(e=Yi.current[l])||void 0===e?void 0:e.current:null===(n=Ki.current[l])||void 0===n?void 0:n.current}return"right"===a?null===(i=Yi.current[o])||void 0===i?void 0:i.current:null===(t=Ki.current[o])||void 0===t?void 0:t.current}()||u;oi(Qt(e,n,t,o,i,r))})}},[ti.open,ti.sectionIdx,hi,si,Qt]),eo=s(function(){var e=ti.sectionIdx;ti.isOrphan,hi(),si(),null!==e&&(_t(e),ht(),dt.current&&mt(),wn([]),jn.current=[],bn(function(n){return n.has(e)?new Set:new Set([e])}),setTimeout(function(){Ln.current&&Ln.current()},50))},[ti.sectionIdx,ti.isOrphan,hi,si,mt]),no=s(function(){var e=Dn.current;if(e){Dn.current=null;var n=Di.findIndex(function(n){return n.id===e}),i=ki.findIndex(function(n){return n.id===e}),t=-1===n?y(Di,e):null,o=-1===i?y(ki,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},a=function(e,n,i){void 0===i&&(i=30);var t=0,o=function(){var r=e();r&&0!==r.getBoundingClientRect().height?(gt.current.add(r),B(r,n)):t++<i&&requestAnimationFrame(o)};requestAnimationFrame(o)};if(un)-1!==r&&Un.current&&a(function(){return u(n,t,Vi,Xi)},Un.current),-1!==l&&Kn.current&&a(function(){return u(i,o,Gi,$i)},Kn.current);else{var c=Vn.current;if(!c)return;a(function(){return-1!==r?u(n,t,Vi,Xi):u(i,o,Gi,$i)},c)}}},[Di,ki,un,Vi,Gi,Xi,$i,Un,Kn,Vn]),io=s(function(n){if(n){ht(),mt(),bn(new Set),wn([]),jn.current=[],si(),gi();var i=Di.findIndex(function(e){return e.id===n}),t=ki.findIndex(function(e){return e.id===n}),o=-1===i?y(Di,n):null,r=-1===t?y(ki,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;Dn.current=n,bt(function(n){var i,t=e({},n),o=!1;-1!==l&&(t[i=un?"left-".concat(l):String(l)]||(t[i]=!0,o=!0));-1!==u&&(t[i=un?"right-".concat(u):String(u)]||(t[i]=!0,o=!0));return o?t:n}),Ct(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(){Dn.current===n&&to.current()})},50)}else console.warn('scrollToAndHighlightClause: nodeId "'.concat(n,'" not found'))}},[Di,ki,un,bt,Ct,mt,si,gi]),to=u(no);c(function(){to.current=no},[no]);var oo=u(null);c(function(){if(xi){var e=mi.fields.find(function(e){return e.analysisKey===xi||e.key===xi});if(e){var n=qi.current[e.key]||Wi.current[e.key];(null==n?void 0:n.current)&&setTimeout(function(){return n.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[xi,mi.fields]);var ro=s(function(e){var n,i,t,o,r,l,u,a,c,s=null===(n=null==Tt?void 0:Tt.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===(a=d.highlights)||void 0===a?void 0:a.ruleA_spans)||[],highlightsB:(null===(c=d.highlights)||void 0===c?void 0:c.ruleB_spans)||[],hasContent:!!v}},[Tt]),lo=X({proposedSections:Di,existingSections:ki,maintainRelativeOrder:un,cognitiveMap:qn,deviationData:zn,treeData:Me,resolvedComparisonConfig:mi,badgeStyleOverride:on}),uo=lo.getSectionCompareStyle,ao=lo.getSubSectionCompareStyle,co=lo.getDeviationStyleByKey,so=U({containerRef:In,leftContainerRef:Un,rightContainerRef:Kn,svgContainerRef:Fn,pathRefs:Pn,leftHeaderRef:Tn,rightHeaderRef:An,proposedSections:Di,existingSections:ki,visibleFields:Oi,leftRefs:qi,rightRefs:Wi,sectionLeftRefs:Vi,sectionRightRefs:Gi,subSectionLeftRefs:Xi,subSectionRightRefs:$i,lhsBadgeRefs:Ki,rhsBadgeRefs:Yi,sectionRowRefs:Ui,expandedSections:Rt,expandedSubSections:yt,connectedSections:Rn,isSideBySide:it,activeSideBySideSection:at,maintainRelativeOrder:un,isGuidelineMode:Ii,cognitiveMap:qn,getSectionCompareStyle:uo,getSubSectionCompareStyle:ao,getDeviationStyleByKey:co,isArrowVisible:tt,isAnimatingRef:kn,isSideBySideRef:dt,sideBySideCacheRef:st,sideBySideLineRef:pt,activeSideBySideSectionRef:ft,activeSideBySideRightSectionRef:vt,connectedLines:Cn,setConnectedLines:wn,cachedConnectedPositions:jn,calculateLinesRef:Ln,resizeTimerRef:Nn,scrollLock:ct,scrollSyncLocked:_n,handleResizeRef:Mn,activeProposed:Ti,existingRule:Ai,analysisData:Tt,pendingScrollTargetRef:Qn,pendingScrollCallbackRef:Zn,resolvedComparisonConfig:mi,getFieldData:ro}),vo=so.lines,fo=so.setLines,po=so.overallConnector,go=so.setOverallConnector,ho=so.svgDimensions,mo=so.handleColumnScroll;c(function(){ai.anchorEl&&requestAnimationFrame(function(){requestAnimationFrame(function(){var e;null===(e=Ln.current)||void 0===e||e.call(Ln)})})},[ai.anchorEl,_n]);var So=s(function(){ht(),En(!1),bt({}),Ct({}),mt(),bn(new Set),wn([]),jn.current=[],si(),gi(),hi(),requestAnimationFrame(function(){Ln.current&&Ln.current()})},[bt,Ct,mt,si,gi,hi]);c(function(){it||0!==Rn.size||En(!1)},[it,Rn]);var xo=a(function(){return Object.values(Rt).some(Boolean)||Object.values(yt).some(Boolean)},[Rt,yt]),Ro=u(null),bo=u(0),yo=u(0),Co=u(0),wo=$({timerRef:Ro,ruleComponentRef:Gn,scrollContainerRef:Vn,containerRef:In,maintainRelativeOrder:un,proposedSections:Di,existingSections:ki,isSideBySideRef:dt,activeSideBySideSectionRef:ft,activeSideBySideRightSectionRef:vt,sectionRowRefs:Ui,sectionRightRowRefs:Ji,sectionLeftRefs:Vi,sectionRightRefs:Gi,subSectionLeftRefs:Xi,subSectionRightRefs:$i,lhsBadgeRefs:Ki,rhsBadgeRefs:Yi,leftContainerRef:Un,rightContainerRef:Kn,calculateLinesRef:Ln,handleResizeRef:Mn,setIsResizing:lt,setIsArrowVisible:ot,sideBySideCacheRef:st,cachedConnectedPositions:jn}).handleResize;c(function(){Mn.current=wo},[wo,Mn]),c(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 a=e[e.length-1];if(a){var c=null!==(u=null===(l=null===(r=a.borderBoxSize)||void 0===r?void 0:r[0])||void 0===l?void 0:l.inlineSize)&&void 0!==u?u:a.contentRect.width;Math.abs(c-n.current)<1?o():(n.current=c,t())}})});return r.observe(e),r},n={current:null},i={current:null},t={current:null},o=[],r=[n,i,t];return Gn.current&&o.push(e(Gn.current,bo,n,function(){return Mn.current()},function(){})),Vn.current&&o.push(e(Vn.current,yo,i,function(){return Mn.current()},function(){return Ln.current()})),In.current&&o.push(e(In.current,Co,t,function(){return Mn.current()},function(){return Ln.current()})),function(){o.forEach(function(e){return e.disconnect()}),r.forEach(function(e){null!==e.current&&(cancelAnimationFrame(e.current),e.current=null)})}},[]),c(function(){dt.current=it},[it]),c(function(){ft.current=at},[at]);var Bo=s(function(){var e,n=ti.sectionIdx,i=ti.isOrphan;if(si(),null!=n){var t="left";ti.anchorEl&&(null===(e=Kn.current)||void 0===e?void 0:e.contains(ti.anchorEl))&&(t="right"),_t(n),St(n,i,{sourceSide:t})}},[St,ti.isOrphan,ti.sectionIdx,ti.anchorEl,si]),_o=s(function(){si(),mt(),bn(new Set),wn([]),jn.current=[]},[si,mt]),Eo=null!==ti.sectionIdx&&Rn.has(ti.sectionIdx),Fo=q({proposedSections:Di,existingSections:ki,parentDeviationRecord:Pi,expandedSections:Rt,maintainRelativeOrder:!!un,scrollContainerRef:Vn,leftContainerRef:Un,rightContainerRef:Kn,lhsBadgeRefs:Ki,rhsBadgeRefs:Yi}),Io=Fo.showDeviationNavigation,To=Fo.showOpenNodeRef,Ao=Fo.adjustScrollForPopup,Do=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;gi();var a="left";(null===(r=Kn.current)||void 0===r?void 0:r.contains(u))&&(a="right");var c=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"===a?null===(e=Yi.current[l])||void 0===e?void 0:e.current:null===(i=Ki.current[l])||void 0===i?void 0:i.current}return"right"===a?null===(t=Yi.current[n])||void 0===t?void 0:t.current:null===(o=Ki.current[n])||void 0===o?void 0:o.current};if(i)return mt(),bn(new Set),wn([]),jn.current=[],void(l&&(_t(n),requestAnimationFrame(function(){var e=c()||u;e&&(e.getBoundingClientRect().top>.8*window.innerHeight&&e.scrollIntoView({behavior:"smooth",block:"center"}));ci({open:!0,anchorEl:e,summary:t,displayImpact:o})})));_t(n),l?setTimeout(function(){St(n,i,{toggleIfSame:!1,sourceSide:a,onReady:function(){var e,n,i,r=c()||u;if(r){var l=r.getBoundingClientRect();if(l.top>.8*window.innerHeight||l.top<100){var a=l.top-window.innerHeight/2;un?(null===(e=Un.current)||void 0===e||e.scrollBy({top:a,behavior:"smooth"}),null===(n=Kn.current)||void 0===n||n.scrollBy({top:a,behavior:"smooth"})):null===(i=Vn.current)||void 0===i||i.scrollBy({top:a,behavior:"smooth"})}}ci({open:!0,anchorEl:r,summary:t,displayImpact:o})}})},350):setTimeout(function(){St(n,i,{toggleIfSame:!1,sourceSide:a})},350)},[St,gi,ci,mt,_t]),ko=a(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 Pi){if((Pi[i]||[]).some(function(e){return e.id===n}))return i}return null},[Ue,Pi]),Oo=u({id:null,triggerMs:null}),Po=u(null);c(function(){if(null==Ue?void 0:Ue.id){var o=Number(Ue.trigger),r=Oo.current;if((null==r?void 0:r.triggerMs)!==o){if(!(Ue.id.includes(":")&&/:\d+$/.test(Ue.id)))return Oo.current={id:Ue.id,triggerMs:o},void io(Ue.id);var l=Ue.id.split(":"),u=l[0],a=l[1],c=null!=a?a:"0";Po.current!==Ue.id&&(si(),gi(),mt(),bn(new Set),wn([]),jn.current=[],Po.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,a,m;if(!s){var S=function(){Oo.current={id:Ue.id,triggerMs:o}},x=null,R=null;for(var b in Pi){var y=Pi[b].find(function(e){return e.id===u});if(y){x=b,R=y;break}}if(R&&x){var w=Di.findIndex(function(e){return e.id===x}),B=ki.findIndex(function(e){return e.id===x}),F=-1===w&&-1!==B,I=g(Di,R.id),T=g(ki,R.id);if(I&&!T&&!F){var A=I.split("-"),D=Number(A[0]);if(un){var k=null===(l=null===(r=Di[D])||void 0===r?void 0:r.refIndexes)||void 0===l?void 0:l[0],O=ki.findIndex(function(e){return e.selfIndex===k});-1!==O&&(D=O)}T=n([D],A.slice(1),!0).join("-")}if(I||T){var P=I?Number(I.split("-")[0]):w,j=T?Number(T.split("-")[0]):B,L=j>=0?j:T?Number(T.split("-")[0]):-1,N=Di[P],M=ki[L],H=N&&!N.title&&!N.content,z=M&&!M.title&&!M.content,q=F||(!I&&!!T||H&&!z);if(q){if(!(un?!!Ko.current["right-".concat(j)]:!!Ko.current[String(j)])&&j>=0)return Bt(j,"right"),void(v=setTimeout(h,200))}else if(!(un?!!Ko.current["left-".concat(P)]:!!Ko.current[String(P)])&&P>=0)return Bt(P,"left"),void(v=setTimeout(h,200));var W=I||"",V=T||"",G="".concat(R.id).concat(C).concat(c).concat(C).concat(W).concat(C).concat(V),K="".concat(R.id).concat(C).concat(c);if(!p){_t(G),p=!0,d=0;var Y=function(){var e,n,i=null===(e=Ki.current[K])||void 0===e?void 0:e.current,t=null===(n=Yi.current[K])||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 a=u.getBoundingClientRect(),c=a.top,d=a.height,v=null!==o&&Math.abs(c-o)<.5,f=null!==r&&Math.abs(d-r)<.5;if(v&&f){if(++t>=5)return void n()}else t=0;o=c,r=d,i=requestAnimationFrame(l)}else i=requestAnimationFrame(l)}},i=requestAnimationFrame(l),f=function(){return cancelAnimationFrame(i)})},300))}var J=null===(a=Ki.current[K])||void 0===a?void 0:a.current,X=null===(m=Yi.current[K])||void 0===m?void 0:m.current;if(J||X){var $=q||!J&&!!X,U=$?X:J,Q=un?$?Kn.current:Un.current:Vn.current;if(U&&Q){var Z=U.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,a,d,v,f;return t(this,function(t){switch(t.label){case 0:return s?[2]:(S(),n=U instanceof Element?window.getComputedStyle(U).color:"",[J,X].forEach(function(e){e&&(e.style.transition="box-shadow 300ms ease-in-out",e.style.boxShadow="0 0 10px ".concat(n))}),setTimeout(function(){[J,X].forEach(function(e){e&&(e.style.boxShadow="")})},2e3),i=(null===(a=null===(u=R.evaluationResult)||void 0===u?void 0:u.deviations)||void 0===a?void 0:a[c])||R,o=(null===(d=R.evaluationResult)||void 0===d?void 0:d.evaluation_outputs)||R.evaluation_outputs,!!J&&!!X?(l=function(e,n){return Promise.race([e,new Promise(function(e){return setTimeout(e,n)})])},un?[4,Promise.all([Un.current?l(E(Un.current),600):Promise.resolve(),Kn.current?l(E(Kn.current),600):Promise.resolve()])]:[3,2]):(r=$?(null===(v=Yi.current[ie?K:j])||void 0===v?void 0:v.current)||X:(null===(f=Ki.current[ie?K:P])||void 0===f?void 0:f.current)||J,Ao(r,function(){ci({open:!0,anchorEl:r,displayImpact:Ue.displayImpact,summary:e(e({},i),{evaluation_outputs:o})})},{skipScroll:!0}),null==Qe||Qe(),[2]));case 1:t.sent(),t.label=2;case 2:return St(G,!1,{toggleIfSame:!1,sourceSide:F?"right":"left",onReady:function(){var n,t,o,r;S();var l=$?(null===(n=Yi.current[K])||void 0===n?void 0:n.current)||X:(null===(t=Ki.current[K])||void 0===t?void 0:t.current)||J,u=(null===(o=Ki.current[K])||void 0===o?void 0:o.current)||J,a=(null===(r=Yi.current[K])||void 0===r?void 0:r.current)||X;u&&(u.style.scrollMarginTop="150px",u.scrollIntoView({behavior:"smooth",block:"start"})),a&&(a.style.scrollMarginTop="150px",a.scrollIntoView({behavior:"smooth",block:"start"})),ci({open:!0,anchorEl:l,displayImpact:Ue.displayImpact,summary:e({},i)}),null==Qe||Qe()}}),[2]}})})};Math.abs(Q.scrollTop-ne)<=2?te():_(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,Pi,Di,ki,un,Rt,St,ci,io]),c(function(){var n,i,t;if(ai.open){var o=ai.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(Ki.current)||r(Yi.current);if(l){var u=(null===(i=Yi.current[l])||void 0===i?void 0:i.current)||(null===(t=Ki.current[l])||void 0===t?void 0:t.current);u&&u.isConnected&&ci(function(n){return e(e({},n),{anchorEl:u})})}}}},[ai.open,ai.anchorEl,_n,Rn,Rt]);var jo=ni.open,Lo=ni.sectionIdx,No=ni.isOrphan,Mo=ni.badgeStyle,Ho=ni.anchorEl,zo=ni.sectionAnchorEl;c(function(){var n;if(Ke.isStreamingEnabled&&jo&&null!=Lo&&Lo!==kt){var i="string"==typeof Lo?Lo.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(Di,i):null,r=i&&"string"==typeof i?t(ki,i):null,l="number"==typeof Lo?Di[Lo]||null:o||i&&((null===(n=null==Me?void 0:Me.nodes)||void 0===n?void 0:n[i])||(null==Me?void 0:Me[i]))||null,u="number"==typeof Lo?ki[Lo]||null:r,a=Qt(Ho,l,u,Lo,No,Mo);ii(function(n){return n.open?x(n.cognitiveData)===x(a.cognitiveData)&&x(n.deviationData)===x(a.deviationData)&&n.sectionTitle===a.sectionTitle&&n.refSectionTitle===a.refSectionTitle?n:e(e(e({},n),a),{open:!0,anchorEl:n.anchorEl,sectionAnchorEl:n.sectionAnchorEl}):n})}},[jo,Lo,No,Mo,Ho,zo,Di,ki,Qt]);var qo=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,a=e.parentNodeId,c=void 0===a?"":a,s=e.sectionOffset;return o(V,{section:n,keyPath:i,depth:r,columnKey:u,parentNodeId:c,sectionOffset:s})},[]),Wo=a(function(){return Di.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&&un?null:o(G,{section:e,idx:n},null!==(i=null==e?void 0:e.id)&&void 0!==i?i:"left-row-".concat(n))})},[Di]),Vo=a(function(){return ki.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&&un?null:o(K,{section:e,idx:n},null!==(i=null==e?void 0:e.id)&&void 0!==i?i:"right-row-".concat(n))})},[ki]),Go=u(Zt);c(function(){Go.current=Zt},[Zt]);var Ko=u(Rt);c(function(){Ko.current=Rt},[Rt]);var Yo=u(Do);c(function(){Yo.current=Do},[Do]);var Jo=u(_o);c(function(){Jo.current=_o},[_o]);var Xo=u(Bt);c(function(){Xo.current=Bt},[Bt]);var $o=u(wt);c(function(){$o.current=wt},[wt]);var Uo=u(qo);c(function(){Uo.current=qo},[qo]);var Qo=u(mt);c(function(){Qo.current=mt},[mt]);var Zo=a(function(){return{isGuidelineMode:Ii,maintainRelativeOrder:!!un,showDeviationBadges:dn,isProposingFix:en,proposingFixNodeId:nn,isRedlineFlow:tn,isSideBySide:it,activeSideBySideSection:at,scrollSyncLocked:_n,toggleScrollSyncLocked:Ft,summaryPopupAnchorEl:ai.anchorEl,connectedSections:Rn,proposedSections:Di,existingSections:ki,deviationNumberRegistry:ji,deviationParentRegistry:Li,treeData:Me,displayConfig:Ke,resolvedMarkdownStyles:Wn,unifiedNumbering:It,expandedSections:Rt,expandedSubSections:yt,setExpandedSubSections:Ct,getSectionCompareStyle:uo,getSubSectionCompareStyle:ao,getBadgeRef:et,getSectionRowRef:Qi,getSubSectionRef:Zi,sectionLeftRefs:Vi,sectionRightRefs:Gi,sectionRowRefs:Ui,sectionRightRowRefs:Ji,subSectionLeftRefs:Xi,subSectionRightRefs:$i,lhsBadgeRefs:Ki,rhsBadgeRefs:Yi,openMoreFunctionsPopup:Ht,handleOpenSummaryPopup:zt,openSummaryPopup:zt,handleCloseSummaryPopup:qt,toggleSection:Wt,handleSubSectionToggle:Vt,renderSubSectionAccordion:Gt,resetSideBySide:Kt,setConnectedSections:bn,setConnectedLines:wn,cachedConnectedPositions:jn,showDeviationNavigation:Io,showOpenNodeRef:To,deviationNodeIdToView:null==Ue?void 0:Ue.id,deviationTargetParentId:ko,guidelinesData:rn}},[Ii,un,dn,en,nn,tn,it,at,_n,Ft,ai.anchorEl,Rn,Di,ki,ji,Ke,Wn,It,Rt,yt,Ct,uo,ao,et,Qi,Zi,Io,To,Ue,ko,rn]);return o(J,e({value:Zo},{children:r(d,e({ref:Gn,sx:{display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif',overflow:"visible",position:"relative"}},{children:[fn&&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(j,{})})),ai.open&&o(Y,{open:ai.open,anchorEl:ai.anchorEl,containerEl:oo.current,clipTopEl:Tn.current,scrollContainerEl:Vn.current,onClose:_o,summary:ai.summary,displayImpact:ai.displayImpact,isScrollLocked:_n}),o(P,{open:ti.open,anchorEl:ti.anchorEl,maintainRelativeOrder:!!un,sectionTitle:ti.sectionTitle,referenceSectionTitle:ti.refSectionTitle,onClose:hi,onOpenCognitiveCompare:fi,onOpenSideBySide:Bo,onConnect:eo,isConnected:Eo,isOrphan:!Ii&&!!ti.isOrphan,isGuidelineMode:Ii,hasGuidelineMatches:ti.hasGuidelineMatches}),ni.open&&o(O,{open:ni.open,popupRef:vi,position:ri,popupConfig:Je,onClose:function(){li(null),ii(function(n){return e(e({},n),{open:!1})}),di(null)},markdownStyles:We,sectionTitle:wi,referenceSectionTitle:_i,cognitiveData:ni.cognitiveData,anchorEl:ni.anchorEl,sectionAnchorEl:ni.sectionAnchorEl,scrollContainerEl:Vn.current,badgeStyle:ni.badgeStyle,docData:ni.docData,deviationData:ni.deviationData,isLoading:ni.isLoading}),o(v,e({open:!!hn,autoHideDuration:8e3,onClose:function(){return mn(null)},anchorOrigin:{vertical:"top",horizontal:"center"}},{children:o(f,e({onClose:function(){return mn(null)},severity:"error",sx:{width:"100%",whiteSpace:"pre-line"}},{children:hn}))})),o(W,{componentHeaderText:Ne,displayConfig:Ke,maintainRelativeOrder:un,onCollapseAll:So,showCollapseAll:xo,onToggleView:function(e){pn(!0),setTimeout(function(){an(!e),null==Ye||Ye(!e),En(!1),mt(),si(),bn(new Set),wn([]),jn.current=[],requestAnimationFrame(function(){requestAnimationFrame(function(){setTimeout(function(){pn(!1)},600)})})},50)}}),o(d,e({ref:Vn,onScroll:mo,sx:{flex:1,minHeight:0,pt:1.5,pb:1,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",overflowY:un?"visible":"auto",borderTop:At&&Dt?"none":"1.5px solid #EEF0F4"}},{children:o(d,e({sx:e({display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"},un?{flex:1}:{})},{children:r(d,e({ref:In,sx:e({display:"grid",gridTemplateColumns:"minmax(0, 1fr) 180px minmax(0, 1fr)",gap:"60px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0},un?{flex:1,overflow:"visible"}:{})},{children:[o(Z,{svgContainerRef:Fn,svgDimensions:ho,isResizing:rt,overallConnector:po,rootDeviationStyle:jt,lines:vo,isSideBySide:it,activeSideBySideSection:at,isArrowVisible:tt,maintainRelativeOrder:un,proposedSections:Di,existingSections:ki,cognitivePopup:ni,activeBadgeId:ui,closeCognitivePopup:gi,setActiveBadgeId:di,openCognitivePopupFromState:pi,buildSectionPopupState:Qt,connectedLines:Cn,pathRefs:Pn}),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)"},un?{flex:1,overflow:"visible"}:{})},{children:[o(d,e({ref:Tn,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:yi,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:yi}))}))})),r(d,e({ref:Un,onScroll:mo,sx:e({p:"12px",display:"flex",flexDirection:"column"},un?{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:Xn,style:{width:"100%",height:"0px",flexShrink:0}}),Mi&&Wo,o("div",{ref:$n,style:{width:"100%",height:"0px",flexShrink:0}})]}))]})),o(d,e({ref:oo,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(),ni.open&&ui===kt?gi():(di(kt),pi(Qt(n.currentTarget,{title:"",content:"",evaluationResult:Ot,cognitiveData:{section_id:"",decisioning:[],gap:[],relevance_score:0,isMissingRationale:!0}},null,kt,!0,e(e({},jt),{label:""}))))},sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:"5px",top:"-8px",borderRadius:"20px",bgcolor:jt.badgeBg,color:jt.badgeText,border:"1px solid ".concat(jt.badgeBorder),fontSize:"12px",fontWeight:600,whiteSpace:"nowrap",position:"relative",zIndex:1,pointerEvents:"auto",cursor:"pointer"}},{children:[null!=Pt?Pt:o(L,{}),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:ni.open&&ui===kt?"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},un?{flex:1,overflow:"visible",minHeight:0}:{})},{children:[ut&&o(S,{sections:11}),o(d,e({ref:An,sx:e({p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E3E6EA",borderRadius:"8px 8px 0 0",display:"flex",alignItems:"center"},un?e({maxHeight:"calc(100vh - 250px)",overflowY:"auto",overflowX:"hidden",minHeight:0},Ii?{"&::-webkit-scrollbar":{width:"6px",display:"block"},"&::-webkit-scrollbar-track":{background:"transparent"},"&::-webkit-scrollbar-thumb":{background:"#CBD5E1",borderRadius:"10px"},"&::-webkit-scrollbar-thumb:hover":{background:"#94A3B8"},scrollbarWidth:"thin",scrollbarColor:"#CBD5E1 transparent"}:{"&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}):{})},{children:o(p,e({title:Ei,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:Ei}))}))})),r(d,e({ref:Kn,onScroll:mo,sx:e({p:Ii?"0px":"12px",display:"flex",flexDirection:"column"},un?e(e({maxHeight:"calc(100vh - 250px)"},!Ii&&{flex:1}),{overflowY:"auto",overflowX:"hidden",minHeight:0,ml:"-150px",pl:"165px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}):{})},{children:[o("div",{ref:Yn,style:{width:"100%",height:"0px",flexShrink:0}}),Ii?o(ee,{guidelinesData:rn,deviationData:$e,connectedSections:Rn,proposedSections:Di}):Mi&&Vo,o("div",{ref:Jn,style:{width:"100%",height:"0px",flexShrink:0}})]}))]}))]}))}))}))]}))}))};export{ne 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 a,useEffect as c,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 b,findKeyPathByNodeId as y,DEVIATION_BADGE_SEPARATOR as C,hasMeaningfulRedlineTags as w,scrollAndHighlightClause as B,scrollAndWait as _,waitForScrollIdle as I}from"./CognitiveComparehelpers.js";import{SHARED_MARKDOWN_STYLES as E,DEFAULT_FIELD_CONFIG as F,DEFAULT_COMPARISON_CONFIG as A}from"./CognitiveCompareConfig.js";export{SHARED_MARKDOWN_STYLES}from"./CognitiveCompareConfig.js";import{DEFAULT_DEVIAION_COLOR as T,EMPTY_SUMMARY_POPUP_STATE as D,DEFAULT_COMPONENT_HEADER_TEXT as k}from"./CognitiveCompareConstants.js";import O from"./CognitivePopup.js";import P from"./MoreFunctionsPopup.js";import j from"./LoaderComponent.js";import L from"./components/ThreeDotsLoader.js";import{useCognitiveTreeData as N}from"./hooks/useCompareData.js";import{useComparePopups as M}from"./hooks/useComparePopups.js";import{useSectionRefs as H}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 G from"./components/LHSSectionRow.js";import K from"./components/RHSSectionRow.js";import Y from"./components/CognitiveSummaryPopup.js";import{CompareContextProvider as J}from"./CompareContext.js";import{useStyleHelpers as X}from"./hooks/useStyles.js";import{useResizeHandler as $}from"./hooks/useResizeHandler.js";import{useLinesCalculator as U}from"./hooks/useLinesCalculator.js";import{useSideBySide as Q}from"./hooks/useSideBySide.js";import Z from"./components/SvgConnectors.js";import ee from"./Guidelines/components/GuidelinePanel.js";var ne=function(ne){var ie,te,oe,re,le,ue,ae,ce,se,de,ve,fe,pe,ge,he,me,Se,xe,Re,be,ye,Ce,we,Be,_e,Ie,Ee,Fe,Ae,Te,De,ke,Oe,Pe,je,Le=ne.componentHeaderText,Ne=void 0===Le?k:Le,Me=ne.treeData,He=ne.comparisonConfig,ze=ne.leftColumnTitleText,qe=ne.rightColumnTitleText,Ve=ne.markdownStyles,We=ne.resetTrigger,Ge=ne.displayConfig,Ke=void 0===Ge?{isHeaderVisible:!0,isToggleVisible:!0,maintainRelativeOrder:!1,isLoading:!0,showDeviationBadges:!1,enableDeviationSchemaBackwardCompatibility:!1,displayEmailNotifier:!0,isStreamingEnabled:!1}:Ge,Ye=ne.onMaintainRelativeOrderChange,Je=ne.popupConfig,Xe=ne.deviationData,$e=void 0===Xe?{}:Xe,Ue=ne.deviationNodeIdToView,Qe=ne.resetDeviationNodeId,Ze=ne.isProposingFix,en=void 0!==Ze&&Ze,nn=ne.proposingFixNodeId,tn=ne.isRedlineFlow,on=ne.badgeStyleOverride,rn=ne.guidelinesData,ln=l(Ke.maintainRelativeOrder),un=ln[0],an=ln[1],cn=null!==(ie=null==Ke?void 0:Ke.expandLevels)&&void 0!==ie?ie:0,sn=!!(null==Ke?void 0:Ke.expandAllSections),dn=!!un||!!(null==Ke?void 0:Ke.showDeviationBadges),vn=l(!1),fn=vn[0],pn=vn[1],gn=l(null),hn=gn[0],mn=gn[1],Sn=l(null===(oe=null!==(te=null==Me?void 0:Me.newEvaluationResult)&&void 0!==te?te:null==Ke?void 0:Ke.enableDeviationSchemaBackwardCompatibility)||void 0===oe||oe)[0],xn=l(new Set),Rn=xn[0],bn=xn[1],yn=l([]),Cn=yn[0],wn=yn[1],Bn=l(!1),_n=Bn[0],In=Bn[1],En=u(null),Fn=u(null),An=u(null),Tn=u(null),Dn=u(null),kn=u(!1),On=u(null),Pn=u({}),jn=u([]),Ln=u(function(){}),Nn=u(null),Mn=u(function(){}),Hn=a(function(){return JSON.stringify($e||{})},[JSON.stringify($e)]),zn=a(function(){return $e||{}},[Hn]),qn=a(function(){return(null==Me?void 0:Me.cognitive_decisioning)||{}},[Me]),Vn=a(function(){return e(e({},E),Ve)},[Ve]),Wn=u(null),Gn=u(null),Kn=u(null),Yn=u(null),Jn=u(null),Xn=u(null),$n=u(null),Un=u(null),Qn=u(null),Zn=u(null),ei=M(Wn),ni=ei.cognitivePopup,ii=ei.setCognitivePopup,ti=ei.moreFunctions,oi=ei.setMoreFunctions,ri=ei.position,li=ei.setPosition,ui=ei.activeBadgeId,ai=ei.summaryPopup,ci=ei.setSummaryPopup,si=ei.closeSummaryPopup,di=ei.setActiveBadgeId,vi=ei.popupRef,fi=ei.handleOpenCognitiveCompare,pi=ei.openCognitivePopupFromState,gi=ei.closeCognitivePopup,hi=ei.closeMoreFunctionsPopup,mi=a(function(){var e,n,i,t,o,r,l;return{fields:null!==(e=null==He?void 0:He.fields)&&void 0!==e?e:F,thresholds:{high:null!==(i=null===(n=null==He?void 0:He.thresholds)||void 0===n?void 0:n.high)&&void 0!==i?i:A.thresholds.high,medium:null!==(o=null===(t=null==He?void 0:He.thresholds)||void 0===t?void 0:t.medium)&&void 0!==o?o:A.thresholds.medium,exact:null!==(l=null===(r=null==He?void 0:He.thresholds)||void 0===r?void 0:r.exact)&&void 0!==l?l:A.thresholds.exact}}},[He]),Si=l(null),xi=Si[0];Si[1];var Ri=null===(ue=null===(re=null==Me?void 0:Me.documents)||void 0===re?void 0:re[null===(le=null==Me?void 0:Me.input_index_map)||void 0===le?void 0:le[0]])||void 0===ue?void 0:ue.title,bi=null===(se=null===(ae=null==Me?void 0:Me.documents)||void 0===ae?void 0:ae[null===(ce=null==Me?void 0:Me.input_index_map)||void 0===ce?void 0:ce[1]])||void 0===se?void 0:se.title,yi=x(ze||Ri||"Uploaded Contract"),Ci=null===(pe=null===(fe=null===(de=null==Me?void 0:Me.documents)||void 0===de?void 0:de[null===(ve=null==Me?void 0:Me.input_index_map)||void 0===ve?void 0:ve[0]])||void 0===fe?void 0:fe.metadata)||void 0===pe?void 0:pe.file_name,wi=x(Ci),Bi=null===(Se=null===(me=null===(ge=null==Me?void 0:Me.documents)||void 0===ge?void 0:ge[null===(he=null==Me?void 0:Me.input_index_map)||void 0===he?void 0:he[1]])||void 0===me?void 0:me.metadata)||void 0===Se?void 0:Se.file_name,_i=x(Bi),Ii=x(qe||bi||"Reference Template"),Ei=N(Me,un,zn,mi,Sn,rn),Fi=Ei.isGuidelineMode,Ai=Ei.activeProposed,Ti=Ei.existingRule,Di=Ei.proposedSections,ki=Ei.existingSections,Oi=Ei.visibleFields,Pi=Ei.parentDeviationRecord,ji=Ei.deviationNumberRegistry,Li=Ei.deviationParentRegistry,Ni=Ei.parseError;c(function(){Ni&&mn("Failed to load comparison: ".concat(Ni))},[Ni]);var Mi=Di.length>0||ki.length>0,Hi=a(function(){if(!tn)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(Di),i(ki),"".concat(e,":").concat(n)},[tn,Di,ki]);c(function(){if(Di.length||ki.length)if(sn){var e={},n={},i=function(i,t){i.forEach(function(i,o){var r,l=un?"".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(Di,"left"),i(ki,"right"),yt(e),wt(n)}else if(cn>0){var t={},o={},r=function(e,n,i){e.forEach(function(e,r){var l;if(i>=1){var u=un?"".concat(n,"-").concat(r):String(r);t[u]=!0}var a=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)&&a(e.subsections,l,t+1)})};(null===(l=e.subsections)||void 0===l?void 0:l.length)&&i>=2&&a(e.subsections,String(r),2)})};r(Di,"left",cn),r(ki,"right",cn),yt(t),wt(o)}},[sn,cn,Di,ki,un]);var zi=H(Oi.map(function(e){return e.key}),Math.max(Di.length,ki.length)),qi=zi.leftRefs,Vi=zi.rightRefs,Wi=zi.sectionLeftRefs,Gi=zi.sectionRightRefs,Ki=zi.lhsBadgeRefs,Yi=zi.rhsBadgeRefs,Ji=zi.sectionRightRowRefs,Xi=zi.subSectionLeftRefs,$i=zi.subSectionRightRefs,Ui=zi.sectionRowRefs,Qi=zi.getSectionRowRef,Zi=zi.getSubSectionRef,et=zi.getBadgeRef,nt=Q({isGuidelineMode:Fi,maintainRelativeOrder:un,proposedSections:Di,existingSections:ki,leftContainerRef:Un,rightContainerRef:Kn,scrollContainerRef:Wn,sectionLeftRefs:Wi,sectionRightRefs:Gi,subSectionLeftRefs:Xi,subSectionRightRefs:$i,lhsBadgeRefs:Ki,rhsBadgeRefs:Yi,sectionRowRefs:Ui,sectionRightRowRefs:Ji,rhsTopSpacerRef:Yn,rhsBottomSpacerRef:Jn,lhsTopSpacerRef:Xn,lhsBottomSpacerRef:$n,calculateLinesRef:Ln,setConnectedSections:bn,setConnectedLines:wn,cachedConnectedPositions:jn,closeMoreFunctionsPopup:hi,setErrorToast:mn,moreFunctions:ti,closeSummaryPopup:si}),it=nt.isSideBySide,tt=nt.isArrowVisible,ot=nt.setIsArrowVisible,rt=nt.isResizing,lt=nt.setIsResizing,ut=nt.isSideBySideLoading,at=nt.activeSideBySideSection,ct=nt.scrollLock,st=nt.sideBySideCacheRef,dt=nt.isSideBySideRef,vt=nt.activeSideBySideRightSectionRef,ft=nt.activeSideBySideSectionRef,pt=nt.sideBySideLineRef,gt=nt.highlightedClauseRefs,ht=nt.clearClauseHighlight,mt=nt.resetSideBySide,St=nt.activateSideBySide,xt=u(St);c(function(){xt.current=St},[St]);var Rt=z({maintainRelativeOrder:!!un,proposedSections:Di,existingSections:ki,activeSideBySideSection:at,connectedSections:Rn,resetSideBySide:mt,setConnectedSections:bn,setConnectedLines:wn,cachedConnectedPositions:jn,svgContainerRef:En,isAnimatingRef:kn,animationTimerRef:On,calculateLinesRef:Ln,sectionLeftRefs:Wi,sectionRightRefs:Gi,subSectionLeftRefs:Xi,subSectionRightRefs:$i}),bt=Rt.expandedSections,yt=Rt.setExpandedSections,Ct=Rt.expandedSubSections,wt=Rt.setExpandedSubSections,Bt=Rt.handleSubSectionToggle,_t=Rt.toggleSection,It=Rt.forceExpandCrossWiredSections,Et=function(){var e,n;if(null!=at){var i=null===(e=Wi.current[at])||void 0===e?void 0:e.current,t=null===(n=Gi.current[at])||void 0===n?void 0:n.current,o=Kn.current;if(i&&t&&o){var r=i.getBoundingClientRect(),l=t.getBoundingClientRect(),u=o.getBoundingClientRect(),a=r.top-u.top,c=l.top-u.top-a;o.scrollBy({top:c,behavior:"smooth"})}}},Ft=s(function(e){null==e||e.stopPropagation(),In(function(e){var n=!e;return n&&requestAnimationFrame(function(){Et()}),n})},[Et]);c(function(){tn&&"off"!==Hi&&"0:0"!==Hi&&(st.current=null,jn.current=[],requestAnimationFrame(function(){var e;null===(e=Ln.current)||void 0===e||e.call(Ln)}))},[tn,Hi]);var At=a(function(){var e=new Map,n=new Map,i=1;if(un)Di.forEach(function(n){!n.title&&!n.content||n.id&&e.set(n.id,i++)}),ki.forEach(function(t){if(t.id&&!(!t.title&&!t.content)){var o=Di.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(Di.length,ki.length),o=0;o<t;o++){var r=Di[o],l=ki[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}},[Di,ki,un]),Tt=Ti.analysis,Dt=x(null===(Re=null===(xe=null==Tt?void 0:Tt.rule_difference_comparison)||void 0===xe?void 0:xe.summary)||void 0===Re?void 0:Re.overall_summary),kt=!!Dt.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),Ot=null!==(be=null==Me?void 0:Me.base_root_id)&&void 0!==be?be:"-1";null==Me||Me[Ot];var Pt=Sn?null!==(ke=null!==(Ae=$e&&(null===(Fe=null==$e?void 0:$e[Ot])||void 0===Fe?void 0:Fe.evaluation_result))&&void 0!==Ae?Ae:null===(De=null===(Te=null==Me?void 0:Me.nodes)||void 0===Te?void 0:Te[Ot])||void 0===De?void 0:De.evaluation_result)&&void 0!==ke?ke:null:null!==(Ee=null!==(we=$e&&(null===(Ce=null===(ye=null==$e?void 0:$e[Ot])||void 0===ye?void 0:ye.evaluation_result)||void 0===Ce?void 0:Ce[0]))&&void 0!==we?we:null===(Ie=null===(_e=null===(Be=null==Me?void 0:Me.nodes)||void 0===Be?void 0:Be[Ot])||void 0===_e?void 0:_e.evaluation_result)||void 0===Ie?void 0:Ie[0])&&void 0!==Ee?Ee:null,jt=R(Pt),Lt=b(null!==(je=null===(Pe=null===(Oe=null==Pt?void 0:Pt.evaluation_outputs)||void 0===Oe?void 0:Oe.metadata)||void 0===Pe?void 0:Pe.label_color)&&void 0!==je?je:T);if(on){var Nt=on(jt);Nt&&(Lt=e(e({},Lt),{badgeBg:Nt.bg,badgeText:Nt.text,badgeBorder:Nt.border}))}var Mt=u(mt);c(function(){Mt.current=mt},[mt]);var Ht=u(gi);c(function(){Ht.current=gi},[gi]);var zt=s(function(e,n,i,t,o,r){return Ko.current(e,n,i,t,o,r)},[]),qt=s(function(e,n,i,t,o){return Jo.current(e,n,i,t,o)},[]),Vt=s(function(){return Xo.current()},[]),Wt=s(function(e,n){return $o.current(e,n)},[]),Gt=s(function(e){return Uo.current(e)},[]),Kt=s(function(e){return Qo.current(e)},[]),Yt=s(function(){return Zo.current()},[]),Jt=s(function(){var e,n;ht(),null===(e=Mt.current)||void 0===e||e.call(Mt),In(!1),bn(new Set),wn([]),jn.current=[],po([]),ho(null),ci(D),null===(n=Ht.current)||void 0===n||n.call(Ht),requestAnimationFrame(function(){var e;null===(e=Ln.current)||void 0===e||e.call(Ln)})},[]),Xt=u(Jt);c(function(){Xt.current=Jt},[Jt]),c(function(){We&&Xt.current()},[We]);var $t=a(function(){return{documents:null==Me?void 0:Me.documents,input_index_map:null==Me?void 0:Me.input_index_map}},[JSON.stringify(null==Me?void 0:Me.documents),JSON.stringify(null==Me?void 0:Me.input_index_map)]),Ut=u(Me);c(function(){Ut.current=Me},[Me]);var Qt=u(qn);c(function(){Qt.current=qn},[qn]);var Zt=s(function(n,i,t,o,r,l,u){var a,c,s,d,v,f,p,g,h,m,S,R,b=x(null==i?void 0:i.id)||x(null==t?void 0:t.id)||"",y=(b?null===(a=Qt.current)||void 0===a?void 0:a[b]:null)||(null==i?void 0:i.cognitiveData)||(null==t?void 0:t.cognitiveData)||{section_id:b,decisioning:[],gap:[],relevance_score:0},w=null!==(s=null===(c=Ui.current[o])||void 0===c?void 0:c.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 a=o.split(C)[1];if(!a)return l;var c=(null==i?void 0:i.evaluationResult)||(null==t?void 0:t.evaluationResult)||{},s=(null===(n=null==c?void 0:c.deviation_entries)||void 0===n?void 0:n[a])||(null===(r=null==c?void 0:c.deviations)||void 0===r?void 0:r[a])||null;return s?e(e(e({},c),s),{deviation_summary:(null==s?void 0:s.deviation_summary)||(null==c?void 0:c.deviation_summary),deviation_title:(null==s?void 0:s.deviation_title)||(null==c?void 0:c.deviation_title),deviation_impact:(null==s?void 0:s.deviation_impact)||(null==c?void 0:c.deviation_impact),deviation_explanation:(null==s?void 0:s.deviation_explanation)||(null==c?void 0:c.deviation_explanation),evaluation_outputs:(null==s?void 0:s.evaluation_outputs)||(null==c?void 0:c.evaluation_outputs),cognitive_decisioning:(null==s?void 0:s.cognitive_decisioning)||(null==c?void 0:c.cognitive_decisioning)}):u(l)}(),_=(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,I=null!==(m=null==Ke?void 0:Ke.isLoading)&&void 0!==m&&m,E=!0;if(Fi)if(B&&Object.keys(B).length>0){var F=Array.isArray(B)?B[0]:B,A=null===(R=null===(S=null==F?void 0:F.evaluation_outputs)||void 0===S?void 0:S.metadata)||void 0===R?void 0:R.is_orphan;!0!==A&&"true"!==A&&"Yes"!==A&&"yes"!==A||(E=!1)}else E=!1;return{isLoading:I&&!_,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:y,anchorEl:n,sectionAnchorEl:w,badgeStyle:l||null,sectionIdx:o,docData:$t,deviationData:B,isOrphan:!!r,hasGuidelineMatches:E}},[$t,null==Ke?void 0:Ke.isLoading,Fi]),eo=s(function(e,n,i,t,o,r){var l;if(e.stopPropagation(),ti.open&&ti.sectionIdx===o)hi();else{var u=e.currentTarget,a="left";(null===(l=Kn.current)||void 0===l?void 0:l.contains(u))&&(a="right");ht(),dt.current&&mt(),bn(new Set),wn([]),jn.current=[],gi(),ai.open?Io():si(),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"===a?null===(e=Yi.current[l])||void 0===e?void 0:e.current:null===(n=Ki.current[l])||void 0===n?void 0:n.current}return"right"===a?null===(i=Yi.current[o])||void 0===i?void 0:i.current:null===(t=Ki.current[o])||void 0===t?void 0:t.current}()||u;oi(Zt(e,n,t,o,i,r))})}},[ti.open,ti.sectionIdx,hi,si,Zt]),no=s(function(){var e=ti.sectionIdx;ti.isOrphan,hi(),si(),null!==e&&(It(e),ht(),dt.current&&mt(),wn([]),jn.current=[],bn(function(n){return n.has(e)?new Set:new Set([e])}),setTimeout(function(){Ln.current&&Ln.current()},50))},[ti.sectionIdx,ti.isOrphan,hi,si,mt]),io=s(function(){var e=Dn.current;if(e){Dn.current=null;var n=Di.findIndex(function(n){return n.id===e}),i=ki.findIndex(function(n){return n.id===e}),t=-1===n?y(Di,e):null,o=-1===i?y(ki,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},a=function(e,n,i){void 0===i&&(i=30);var t=0,o=function(){var r=e();r&&0!==r.getBoundingClientRect().height?(gt.current.add(r),B(r,n)):t++<i&&requestAnimationFrame(o)};requestAnimationFrame(o)};if(un)-1!==r&&Un.current&&a(function(){return u(n,t,Wi,Xi)},Un.current),-1!==l&&Kn.current&&a(function(){return u(i,o,Gi,$i)},Kn.current);else{var c=Wn.current;if(!c)return;a(function(){return-1!==r?u(n,t,Wi,Xi):u(i,o,Gi,$i)},c)}}},[Di,ki,un,Wi,Gi,Xi,$i,Un,Kn,Wn]),to=s(function(n){if(n){ht(),mt(),bn(new Set),wn([]),jn.current=[],si(),gi();var i=Di.findIndex(function(e){return e.id===n}),t=ki.findIndex(function(e){return e.id===n}),o=-1===i?y(Di,n):null,r=-1===t?y(ki,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;Dn.current=n,yt(function(n){var i,t=e({},n),o=!1;-1!==l&&(t[i=un?"left-".concat(l):String(l)]||(t[i]=!0,o=!0));-1!==u&&(t[i=un?"right-".concat(u):String(u)]||(t[i]=!0,o=!0));return o?t:n}),wt(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(){Dn.current===n&&oo.current()})},50)}else console.warn('scrollToAndHighlightClause: nodeId "'.concat(n,'" not found'))}},[Di,ki,un,yt,wt,mt,si,gi]),oo=u(io);c(function(){oo.current=io},[io]);var ro=u(null);c(function(){if(xi){var e=mi.fields.find(function(e){return e.analysisKey===xi||e.key===xi});if(e){var n=qi.current[e.key]||Vi.current[e.key];(null==n?void 0:n.current)&&setTimeout(function(){return n.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[xi,mi.fields]);var lo=s(function(e){var n,i,t,o,r,l,u,a,c,s=null===(n=null==Tt?void 0:Tt.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===(a=d.highlights)||void 0===a?void 0:a.ruleA_spans)||[],highlightsB:(null===(c=d.highlights)||void 0===c?void 0:c.ruleB_spans)||[],hasContent:!!v}},[Tt]),uo=X({proposedSections:Di,existingSections:ki,maintainRelativeOrder:un,cognitiveMap:qn,deviationData:zn,treeData:Me,resolvedComparisonConfig:mi,badgeStyleOverride:on}),ao=uo.getSectionCompareStyle,co=uo.getSubSectionCompareStyle,so=uo.getDeviationStyleByKey,vo=U({containerRef:Fn,leftContainerRef:Un,rightContainerRef:Kn,svgContainerRef:En,pathRefs:Pn,leftHeaderRef:An,rightHeaderRef:Tn,proposedSections:Di,existingSections:ki,visibleFields:Oi,leftRefs:qi,rightRefs:Vi,sectionLeftRefs:Wi,sectionRightRefs:Gi,subSectionLeftRefs:Xi,subSectionRightRefs:$i,lhsBadgeRefs:Ki,rhsBadgeRefs:Yi,sectionRowRefs:Ui,expandedSections:bt,expandedSubSections:Ct,connectedSections:Rn,isSideBySide:it,activeSideBySideSection:at,maintainRelativeOrder:un,isGuidelineMode:Fi,cognitiveMap:qn,getSectionCompareStyle:ao,getSubSectionCompareStyle:co,getDeviationStyleByKey:so,isArrowVisible:tt,isAnimatingRef:kn,isSideBySideRef:dt,sideBySideCacheRef:st,sideBySideLineRef:pt,activeSideBySideSectionRef:ft,activeSideBySideRightSectionRef:vt,connectedLines:Cn,setConnectedLines:wn,cachedConnectedPositions:jn,calculateLinesRef:Ln,resizeTimerRef:Nn,scrollLock:ct,scrollSyncLocked:_n,handleResizeRef:Mn,activeProposed:Ai,existingRule:Ti,analysisData:Tt,pendingScrollTargetRef:Qn,pendingScrollCallbackRef:Zn,resolvedComparisonConfig:mi,getFieldData:lo}),fo=vo.lines,po=vo.setLines,go=vo.overallConnector,ho=vo.setOverallConnector,mo=vo.svgDimensions,So=vo.handleColumnScroll;c(function(){ai.anchorEl&&requestAnimationFrame(function(){requestAnimationFrame(function(){var e;null===(e=Ln.current)||void 0===e||e.call(Ln)})})},[ai.anchorEl,_n]);var xo=s(function(){ht(),In(!1),yt({}),wt({}),mt(),bn(new Set),wn([]),jn.current=[],si(),gi(),hi(),requestAnimationFrame(function(){Ln.current&&Ln.current()})},[yt,wt,mt,si,gi,hi]);c(function(){it||0!==Rn.size||In(!1)},[it,Rn]);var Ro=a(function(){return Object.values(bt).some(Boolean)||Object.values(Ct).some(Boolean)},[bt,Ct]),bo=u(null),yo=u(0),Co=u(0),wo=u(0),Bo=$({timerRef:bo,ruleComponentRef:Gn,scrollContainerRef:Wn,containerRef:Fn,maintainRelativeOrder:un,proposedSections:Di,existingSections:ki,isSideBySideRef:dt,activeSideBySideSectionRef:ft,activeSideBySideRightSectionRef:vt,sectionRowRefs:Ui,sectionRightRowRefs:Ji,sectionLeftRefs:Wi,sectionRightRefs:Gi,subSectionLeftRefs:Xi,subSectionRightRefs:$i,lhsBadgeRefs:Ki,rhsBadgeRefs:Yi,leftContainerRef:Un,rightContainerRef:Kn,calculateLinesRef:Ln,handleResizeRef:Mn,setIsResizing:lt,setIsArrowVisible:ot,sideBySideCacheRef:st,cachedConnectedPositions:jn}).handleResize;c(function(){Mn.current=Bo},[Bo,Mn]),c(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 a=e[e.length-1];if(a){var c=null!==(u=null===(l=null===(r=a.borderBoxSize)||void 0===r?void 0:r[0])||void 0===l?void 0:l.inlineSize)&&void 0!==u?u:a.contentRect.width;Math.abs(c-n.current)<1?o():(n.current=c,t())}})});return r.observe(e),r},n={current:null},i={current:null},t={current:null},o=[],r=[n,i,t];return Gn.current&&o.push(e(Gn.current,yo,n,function(){return Mn.current()},function(){})),Wn.current&&o.push(e(Wn.current,Co,i,function(){return Mn.current()},function(){return Ln.current()})),Fn.current&&o.push(e(Fn.current,wo,t,function(){return Mn.current()},function(){return Ln.current()})),function(){o.forEach(function(e){return e.disconnect()}),r.forEach(function(e){null!==e.current&&(cancelAnimationFrame(e.current),e.current=null)})}},[]),c(function(){dt.current=it},[it]),c(function(){ft.current=at},[at]);var _o=s(function(){var e,n=ti.sectionIdx,i=ti.isOrphan;if(si(),null!=n){var t="left";ti.anchorEl&&(null===(e=Kn.current)||void 0===e?void 0:e.contains(ti.anchorEl))&&(t="right"),It(n),St(n,i,{sourceSide:t})}},[St,ti.isOrphan,ti.sectionIdx,ti.anchorEl,si]),Io=s(function(){si(),mt(),bn(new Set),wn([]),jn.current=[]},[si,mt]),Eo=null!==ti.sectionIdx&&Rn.has(ti.sectionIdx),Fo=q({proposedSections:Di,existingSections:ki,parentDeviationRecord:Pi,expandedSections:bt,maintainRelativeOrder:!!un,scrollContainerRef:Wn,leftContainerRef:Un,rightContainerRef:Kn,lhsBadgeRefs:Ki,rhsBadgeRefs:Yi}),Ao=Fo.showDeviationNavigation,To=Fo.showOpenNodeRef,Do=Fo.adjustScrollForPopup,ko=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;gi();var a="left";(null===(r=Kn.current)||void 0===r?void 0:r.contains(u))&&(a="right");var c=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"===a?null===(e=Yi.current[l])||void 0===e?void 0:e.current:null===(i=Ki.current[l])||void 0===i?void 0:i.current}return"right"===a?null===(t=Yi.current[n])||void 0===t?void 0:t.current:null===(o=Ki.current[n])||void 0===o?void 0:o.current};if(i)return mt(),bn(new Set),wn([]),jn.current=[],void(l&&(It(n),requestAnimationFrame(function(){var e=c()||u;e&&(e.getBoundingClientRect().top>.8*window.innerHeight&&e.scrollIntoView({behavior:"smooth",block:"center"}));ci({open:!0,anchorEl:e,summary:t,displayImpact:o})})));It(n),l?setTimeout(function(){St(n,i,{toggleIfSame:!1,sourceSide:a,onReady:function(){var e,n,i,r=c()||u;if(r){var l=r.getBoundingClientRect();if(l.top>.8*window.innerHeight||l.top<100){var a=l.top-window.innerHeight/2;un?(null===(e=Un.current)||void 0===e||e.scrollBy({top:a,behavior:"smooth"}),null===(n=Kn.current)||void 0===n||n.scrollBy({top:a,behavior:"smooth"})):null===(i=Wn.current)||void 0===i||i.scrollBy({top:a,behavior:"smooth"})}}ci({open:!0,anchorEl:r,summary:t,displayImpact:o})}})},350):setTimeout(function(){St(n,i,{toggleIfSame:!1,sourceSide:a})},350)},[St,gi,ci,mt,It]),Oo=a(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 Pi){if((Pi[i]||[]).some(function(e){return e.id===n}))return i}return null},[Ue,Pi]),Po=u({id:null,triggerMs:null}),jo=u(null);c(function(){if(null==Ue?void 0:Ue.id){var o=Number(Ue.trigger),r=Po.current;if((null==r?void 0:r.id)!==Ue.id||(null==r?void 0:r.triggerMs)!==o){if(!(Ue.id.includes(":")&&/:\d+$/.test(Ue.id)))return Po.current={id:Ue.id,triggerMs:o},void to(Ue.id);var l=Ue.id.split(":"),u=l[0],a=l[1],c=null!=a?a:"0",s="".concat(Ue.id,":").concat(o);jo.current!==s&&(si(),gi(),mt(),bn(new Set),wn([]),jn.current=[],jo.current=s);var d=!1,v=0,f=null,p=null,g=!1,h=function(e,n){for(var i=function(e,t){if(!e)return null;if(n.includes(e.id)||n.includes(e.nodeId)||n.includes(e.contentId))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,a;if(!d){var s=function(){Po.current={id:Ue.id,triggerMs:o}},S=null,x=null;for(var R in Pi){var b=Pi[R].find(function(e){var n;return e.id===u||e.nodeId===u||e.contentId===u||(null===(n=e.evaluationResult)||void 0===n?void 0:n.nodeId)===u});if(b){S=R,x=b;break}}if(x&&S){var y=Array.from(new Set([u,x.id,x.nodeId,x.contentId,null===(r=x.evaluationResult)||void 0===r?void 0:r.nodeId].filter(Boolean))),w=Di.findIndex(function(e){return e.id===S}),B=ki.findIndex(function(e){return e.id===S}),E=-1===w&&-1!==B,F=h(Di,y),A=h(ki,y);if(F&&!A&&!E){var T=F.split("-"),D=Number(T[0]);if(un){var k=null===(a=null===(l=Di[D])||void 0===l?void 0:l.refIndexes)||void 0===a?void 0:a[0],O=ki.findIndex(function(e){return e.selfIndex===k});-1!==O&&(D=O)}A=n([D],T.slice(1),!0).join("-")}if(F||A){var P=F?Number(F.split("-")[0]):w,j=A?Number(A.split("-")[0]):B,L=j>=0?j:A?Number(A.split("-")[0]):-1,N=Di[P],M=ki[L],H=N&&!N.title&&!N.content,z=M&&!M.title&&!M.content,q=E||(!F&&!!A||H&&!z);if(q){if(!(un?!!Yo.current["right-".concat(j)]:!!Yo.current[String(j)])&&j>=0)return _t(j,"right"),void(f=setTimeout(m,200))}else if(!(un?!!Yo.current["left-".concat(P)]:!!Yo.current[String(P)])&&P>=0)return _t(P,"left"),void(f=setTimeout(m,200));var V=F||"",W=A||"",G=y.map(function(e){return"".concat(e).concat(C).concat(c)}),K=G[0],Y=function(){for(var e,n,i=0,t=G;i<t.length;i++){var o=t[i],r=(null===(e=Ki.current[o])||void 0===e?void 0:e.current)||null,l=(null===(n=Yi.current[o])||void 0===n?void 0:n.current)||null;if(r||l)return{refId:o,left:r,right:l}}return{refId:K,left:null,right:null}},J=function(e){return"".concat(e).concat(C).concat(V).concat(C).concat(W)};if(!g){It(J(K)),g=!0,v=0;var X=function(){var e=Y(),n=e.left,i=e.right;return q||!n&&!!i?i:n};return null==p||p(),void(f=setTimeout(function(){var e,n,i,t,o,r,l,u;d||(e=X,n=function(){d||(p=null,m())},t=0,o=null,r=null,l=performance.now(),u=function(){if(!d)if(performance.now()-l>3e3)n();else{var a=e();if(a&&0!==a.getBoundingClientRect().height){var c=a.getBoundingClientRect(),s=c.top,v=c.height,f=null!==o&&Math.abs(s-o)<.5,p=null!==r&&Math.abs(v-r)<.5;if(f&&p){if(++t>=5)return void n()}else t=0;o=s,r=v,i=requestAnimationFrame(u)}else i=requestAnimationFrame(u)}},i=requestAnimationFrame(u),p=function(){return cancelAnimationFrame(i)})},300))}var $=Y(),U=$.refId,Q=$.left,Z=$.right,ee=J(U);if(Q||Z){var ne=q||!Q&&!!Z,ie=ne?Z:Q,te=un?ne?Kn.current:Un.current:Wn.current;if(ie&&te){var oe=ie.getBoundingClientRect();if(0!==oe.height){var re=te.getBoundingClientRect(),le=oe.top-re.top+te.scrollTop-re.height/2+oe.height/2,ue=(null==F?void 0:F.includes("-"))||(null==A?void 0:A.includes("-")),ae=function(){return i(void 0,void 0,void 0,function(){var n,i,o,r,l,u,a,v,f,p;return t(this,function(t){switch(t.label){case 0:return d?[2]:(s(),n=ie instanceof Element?window.getComputedStyle(ie).color:"",[Q,Z].forEach(function(e){e&&(e.style.transition="box-shadow 300ms ease-in-out",e.style.boxShadow="0 0 10px ".concat(n))}),setTimeout(function(){[Q,Z].forEach(function(e){e&&(e.style.boxShadow="")})},2e3),i=(null===(a=null===(u=x.evaluationResult)||void 0===u?void 0:u.deviations)||void 0===a?void 0:a[c])||x,o=(null===(v=x.evaluationResult)||void 0===v?void 0:v.evaluation_outputs)||x.evaluation_outputs,!!Q&&!!Z?(l=function(e,n){return Promise.race([e,new Promise(function(e){return setTimeout(e,n)})])},un?[4,Promise.all([Un.current?l(I(Un.current),600):Promise.resolve(),Kn.current?l(I(Kn.current),600):Promise.resolve()])]:[3,2]):(r=ne?(null===(f=Yi.current[ue?U:j])||void 0===f?void 0:f.current)||Z:(null===(p=Ki.current[ue?U:P])||void 0===p?void 0:p.current)||Q,Do(r,function(){ci({open:!0,anchorEl:r,displayImpact:Ue.displayImpact,summary:e(e({},i),{evaluation_outputs:o})})},{skipScroll:!0}),null==Qe||Qe(),[2]));case 1:t.sent(),t.label=2;case 2:return xt.current(ee,!1,{toggleIfSame:!1,sourceSide:E?"right":"left",onReady:function(){var n,t,o,r;s();var l=ne?(null===(n=Yi.current[U])||void 0===n?void 0:n.current)||Z:(null===(t=Ki.current[U])||void 0===t?void 0:t.current)||Q,u=(null===(o=Ki.current[U])||void 0===o?void 0:o.current)||Q,a=(null===(r=Yi.current[U])||void 0===r?void 0:r.current)||Z;u&&(u.style.scrollMarginTop="150px",u.scrollIntoView({behavior:"smooth",block:"start"})),a&&(a.style.scrollMarginTop="150px",a.scrollIntoView({behavior:"smooth",block:"start"})),ci({open:!0,anchorEl:l,displayImpact:Ue.displayImpact,summary:e({},i)}),null==Qe||Qe()}}),[2]}})})};Math.abs(te.scrollTop-le)<=2?ae():_(te,le,ae)}else++v<30&&(f=setTimeout(m,100))}else++v<30&&(f=setTimeout(m,100))}else++v<30&&(f=setTimeout(m,100))}else++v<30&&(f=setTimeout(m,100))}else++v<30&&(f=setTimeout(m,100))}};return f=setTimeout(m,100),function(){d=!0,f&&clearTimeout(f),null==p||p()}}}},[null==Ue?void 0:Ue.id,null==Ue?void 0:Ue.trigger,null==Ue?void 0:Ue.displayImpact,Pi,Di,ki,un,ci,to]),c(function(){var n,i,t;if(ai.open){var o=ai.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(Ki.current)||r(Yi.current);if(l){var u=(null===(i=Yi.current[l])||void 0===i?void 0:i.current)||(null===(t=Ki.current[l])||void 0===t?void 0:t.current);u&&u.isConnected&&ci(function(n){return e(e({},n),{anchorEl:u})})}}}},[ai.open,ai.anchorEl,_n,Rn,bt]);var Lo=ni.open,No=ni.sectionIdx,Mo=ni.isOrphan,Ho=ni.badgeStyle,zo=ni.anchorEl,qo=ni.sectionAnchorEl;c(function(){var n;if(Ke.isStreamingEnabled&&Lo&&null!=No&&No!==Ot){var i="string"==typeof No?No.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(Di,i):null,r=i&&"string"==typeof i?t(ki,i):null,l="number"==typeof No?Di[No]||null:o||i&&((null===(n=null==Me?void 0:Me.nodes)||void 0===n?void 0:n[i])||(null==Me?void 0:Me[i]))||null,u="number"==typeof No?ki[No]||null:r,a=Zt(zo,l,u,No,Mo,Ho);ii(function(n){return n.open?x(n.cognitiveData)===x(a.cognitiveData)&&x(n.deviationData)===x(a.deviationData)&&n.sectionTitle===a.sectionTitle&&n.refSectionTitle===a.refSectionTitle?n:e(e(e({},n),a),{open:!0,anchorEl:n.anchorEl,sectionAnchorEl:n.sectionAnchorEl}):n})}},[Lo,No,Mo,Ho,zo,qo,Di,ki,Zt]);var Vo=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,a=e.parentNodeId,c=void 0===a?"":a,s=e.sectionOffset,d=e.rhsOrphanVisualIndexes;return o(W,{section:n,keyPath:i,depth:r,columnKey:u,parentNodeId:c,sectionOffset:s,rhsOrphanVisualIndexes:d})},[]),Wo=a(function(){return Di.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&&un?null:o(G,{section:e,idx:n},null!==(i=null==e?void 0:e.id)&&void 0!==i?i:"left-row-".concat(n))})},[Di]),Go=a(function(){return ki.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&&un?null:o(K,{section:e,idx:n},null!==(i=null==e?void 0:e.id)&&void 0!==i?i:"right-row-".concat(n))})},[ki]),Ko=u(eo);c(function(){Ko.current=eo},[eo]);var Yo=u(bt);c(function(){Yo.current=bt},[bt]);var Jo=u(ko);c(function(){Jo.current=ko},[ko]);var Xo=u(Io);c(function(){Xo.current=Io},[Io]);var $o=u(_t);c(function(){$o.current=_t},[_t]);var Uo=u(Bt);c(function(){Uo.current=Bt},[Bt]);var Qo=u(Vo);c(function(){Qo.current=Vo},[Vo]);var Zo=u(mt);c(function(){Zo.current=mt},[mt]);var er=a(function(){return{isGuidelineMode:Fi,maintainRelativeOrder:!!un,showDeviationBadges:dn,isProposingFix:en,proposingFixNodeId:nn,isRedlineFlow:tn,isSideBySide:it,activeSideBySideSection:at,scrollSyncLocked:_n,toggleScrollSyncLocked:Ft,summaryPopupAnchorEl:ai.anchorEl,connectedSections:Rn,proposedSections:Di,existingSections:ki,deviationNumberRegistry:ji,deviationParentRegistry:Li,treeData:Me,displayConfig:Ke,resolvedMarkdownStyles:Vn,unifiedNumbering:At,expandedSections:bt,expandedSubSections:Ct,setExpandedSubSections:wt,getSectionCompareStyle:ao,getSubSectionCompareStyle:co,getBadgeRef:et,getSectionRowRef:Qi,getSubSectionRef:Zi,sectionLeftRefs:Wi,sectionRightRefs:Gi,sectionRowRefs:Ui,sectionRightRowRefs:Ji,subSectionLeftRefs:Xi,subSectionRightRefs:$i,lhsBadgeRefs:Ki,rhsBadgeRefs:Yi,openMoreFunctionsPopup:zt,handleOpenSummaryPopup:qt,openSummaryPopup:qt,handleCloseSummaryPopup:Vt,toggleSection:Wt,handleSubSectionToggle:Gt,renderSubSectionAccordion:Kt,resetSideBySide:Yt,setConnectedSections:bn,setConnectedLines:wn,cachedConnectedPositions:jn,showDeviationNavigation:Ao,showOpenNodeRef:To,deviationNodeIdToView:null==Ue?void 0:Ue.id,deviationTargetParentId:Oo,guidelinesData:rn}},[Fi,un,dn,en,nn,tn,it,at,_n,Ft,ai.anchorEl,Rn,Di,ki,ji,Ke,Vn,At,bt,Ct,wt,ao,co,et,Qi,Zi,Ao,To,Ue,Oo,rn]);return o(J,e({value:er},{children:r(d,e({ref:Gn,sx:{display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif',overflow:"visible",position:"relative"}},{children:[fn&&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(j,{})})),ai.open&&o(Y,{open:ai.open,anchorEl:ai.anchorEl,containerEl:ro.current,clipTopEl:An.current,scrollContainerEl:Wn.current,onClose:Io,summary:ai.summary,displayImpact:ai.displayImpact,isScrollLocked:_n}),o(P,{open:ti.open,anchorEl:ti.anchorEl,maintainRelativeOrder:!!un,sectionTitle:ti.sectionTitle,referenceSectionTitle:ti.refSectionTitle,onClose:hi,onOpenCognitiveCompare:fi,onOpenSideBySide:_o,onConnect:no,isConnected:Eo,isOrphan:!Fi&&!!ti.isOrphan,isGuidelineMode:Fi,hasGuidelineMatches:ti.hasGuidelineMatches}),ni.open&&o(O,{open:ni.open,popupRef:vi,position:ri,popupConfig:Je,onClose:function(){li(null),ii(function(n){return e(e({},n),{open:!1})}),di(null)},markdownStyles:Ve,sectionTitle:wi,referenceSectionTitle:_i,cognitiveData:ni.cognitiveData,anchorEl:ni.anchorEl,sectionAnchorEl:ni.sectionAnchorEl,scrollContainerEl:Wn.current,badgeStyle:ni.badgeStyle,docData:ni.docData,deviationData:ni.deviationData,isLoading:ni.isLoading}),o(v,e({open:!!hn,autoHideDuration:8e3,onClose:function(){return mn(null)},anchorOrigin:{vertical:"top",horizontal:"center"}},{children:o(f,e({onClose:function(){return mn(null)},severity:"error",sx:{width:"100%",whiteSpace:"pre-line"}},{children:hn}))})),o(V,{componentHeaderText:Ne,displayConfig:Ke,maintainRelativeOrder:un,onCollapseAll:xo,showCollapseAll:Ro,onToggleView:function(e){pn(!0),setTimeout(function(){an(!e),null==Ye||Ye(!e),In(!1),mt(),si(),bn(new Set),wn([]),jn.current=[],requestAnimationFrame(function(){requestAnimationFrame(function(){setTimeout(function(){pn(!1)},600)})})},50)}}),o(d,e({ref:Wn,onScroll:So,sx:{flex:1,minHeight:0,pt:1.5,pb:1,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",overflowY:un?"visible":"auto",borderTop:Dt&&kt?"none":"1.5px solid #EEF0F4"}},{children:o(d,e({sx:e({display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"},un?{flex:1}:{})},{children:r(d,e({ref:Fn,sx:e({display:"grid",gridTemplateColumns:"minmax(0, 1fr) 180px minmax(0, 1fr)",gap:"80px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0},un?{flex:1,overflow:"visible"}:{})},{children:[o(Z,{svgContainerRef:En,svgDimensions:mo,isResizing:rt,overallConnector:go,rootDeviationStyle:Lt,lines:fo,isSideBySide:it,activeSideBySideSection:at,isArrowVisible:tt,maintainRelativeOrder:un,proposedSections:Di,existingSections:ki,cognitivePopup:ni,activeBadgeId:ui,closeCognitivePopup:gi,setActiveBadgeId:di,openCognitivePopupFromState:pi,buildSectionPopupState:Zt,connectedLines:Cn,isGuidelineMode:Fi,pathRefs:Pn}),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)"},un?{flex:1,overflow:"visible"}:{})},{children:[o(d,e({ref:An,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:yi,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:yi}))}))})),r(d,e({ref:Un,onScroll:So,sx:e({p:"12px",display:"flex",flexDirection:"column"},un?{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:Xn,style:{width:"100%",height:"0px",flexShrink:0}}),Mi&&Wo,o("div",{ref:$n,style:{width:"100%",height:"0px",flexShrink:0}})]}))]})),o(d,e({ref:ro,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(),ni.open&&ui===Ot?gi():(di(Ot),pi(Zt(n.currentTarget,{title:"",content:"",evaluationResult:Pt,cognitiveData:{section_id:"",decisioning:[],gap:[],relevance_score:0,isMissingRationale:!0}},null,Ot,!0,e(e({},Lt),{label:""}))))},sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:"5px",top:"-8px",borderRadius:"20px",bgcolor:Lt.badgeBg,color:Lt.badgeText,border:"1px solid ".concat(Lt.badgeBorder),fontSize:"12px",fontWeight:600,whiteSpace:"nowrap",position:"relative",zIndex:1,pointerEvents:"auto",cursor:"pointer"}},{children:[null!=jt?jt:o(L,{}),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:ni.open&&ui===Ot?"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},un?{flex:1,overflow:"visible",minHeight:0}:{})},{children:[ut&&o(S,{sections:11}),o(d,e({ref:Tn,sx:e({p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E3E6EA",borderRadius:"8px 8px 0 0",display:"flex",alignItems:"center"},un?e({maxHeight:"calc(100vh - 250px)",overflowY:"auto",overflowX:"hidden",minHeight:0},Fi?{"&::-webkit-scrollbar":{width:"6px",display:"block"},"&::-webkit-scrollbar-track":{background:"transparent"},"&::-webkit-scrollbar-thumb":{background:"#CBD5E1",borderRadius:"10px"},"&::-webkit-scrollbar-thumb:hover":{background:"#94A3B8"},scrollbarWidth:"thin",scrollbarColor:"#CBD5E1 transparent"}:{"&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}):{})},{children:o(p,e({title:Ii,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:Ii}))}))})),r(d,e({ref:Kn,onScroll:So,sx:e({p:Fi?"0px":"12px",display:"flex",flexDirection:"column"},un?e(e({maxHeight:"calc(100vh - 250px)"},!Fi&&{flex:1}),{overflowY:"auto",overflowX:"hidden",minHeight:0,ml:"-150px",pl:"165px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}):{})},{children:[o("div",{ref:Yn,style:{width:"100%",height:"0px",flexShrink:0}}),Fi?o(ee,{guidelinesData:rn,deviationData:$e,connectedSections:Rn,proposedSections:Di}):Mi&&Go,o("div",{ref:Jn,style:{width:"100%",height:"0px",flexShrink:0}})]}))]}))]}))}))}))]}))}))};export{ne as default};
2
2
  //# sourceMappingURL=CognitiveCompare.js.map
@@ -1,2 +1,2 @@
1
- import{DEFAULT_DEVIAION_COLOR as t}from"./CognitiveCompareConstants.js";var n=function(t){return null==t?"":"string"==typeof t?t:Array.isArray(t)?t.map(n).join("\n\n"):"object"==typeof t?JSON.stringify(t):String(t)},e=function(t){return null!=t&&("string"==typeof t?t.trim().length>0:!Array.isArray(t)||t.length>0&&t.some(function(t){return e(t)}))},o=function(t,n,e,o){var r;void 0===o&&(o={});var i=e[n],u=null===(r=null==t?void 0:t.comparison_inputs)||void 0===r?void 0:r[i];return u?(Array.isArray(u)?u:[u]).map(function(t,n){if("string"==typeof t){var e=o[t];return e?{contentId:t,data:e,attributes:e.additional_attributes||{}}:null}return t&&"object"==typeof t?{contentId:t.content_id||t.id||"".concat(i,"-direct-").concat(n),data:t,attributes:t.additional_attributes||{}}:null}).filter(Boolean):[]},r=function(t,e,r,i){var u,l,a;void 0===i&&(i={});var s=o(t,e,r,i),c=(null===(u=s[0])||void 0===u?void 0:u.data)||{},d=(null===(l=s[0])||void 0===l?void 0:l.attributes)||null;return{title:n((null==c?void 0:c.title)||""),content:n((null==c?void 0:c.content)||""),change_history:n((null==c?void 0:c.change_history)||""),attributes:d,subsections:(null==c?void 0:c.subsections)||[],contentId:null===(a=s[0])||void 0===a?void 0:a.contentId,allItems:s}},i=function(t){if(!t.mapping_rationale)return{cognitiveData:{decisioning:[],gap:[],relevance_score:0,isMissingRationale:!0,citations:[]},score:0,relation:"N/A"};var n=t.mapping_rationale,e=parseInt(n.decision_strength||"0");return{cognitiveData:{decisioning:n.decisioning_factors||[],gap:n.gaps_in_decision||[],relevance_score:e,citations:n.citations},score:0,relation:"N/A"}};function u(t){var n=function(t,n){var e=function(t){var n=function(t){return 4===t.length?"#"+t[1]+t[1]+t[2]+t[2]+t[3]+t[3]:t}(t).replace("#",""),e=parseInt(n,16);return{r:e>>16&255,g:e>>8&255,b:255&e}}(t),o=e.r,r=e.g,i=e.b;return function(t,n,e){return"#"+[t,n,e].map(function(t){return t.toString(16).padStart(2,"0")}).join("").toUpperCase()}(Math.round(o+(255-o)*n),Math.round(r+(255-r)*n),Math.round(i+(255-i)*n))};return{bg:n(t,.8),border:n(t,.5),badgeBg:n(t,.8),badgeBorder:n(t,.5),badgeText:t.toUpperCase(),highlightBg:n(t,.8)}}function l(t,n){var e;return function(){for(var o=[],r=0;r<arguments.length;r++)o[r]=arguments[r];var i=this;clearTimeout(e),e=setTimeout(function(){return t.apply(i,o)},n)}}var a=function(t,n){var e,o,r,i,u,l;if(t.content!==n.content)return!1;if(t.overlayContent!==n.overlayContent)return!1;if(t.sxStyles!==n.sxStyles)return!1;if(t.maintainRelativeOrder!==n.maintainRelativeOrder)return!1;if(t.highlightBg!==n.highlightBg)return!1;if(t.suppressHighlightBg!==n.suppressHighlightBg)return!1;if(t.collisionKey!==n.collisionKey)return!1;var a=t.highlights||[],s=n.highlights||[];if(a.length!==s.length)return!1;for(var c=0;c<a.length;c++)if(a[c]!==s[c])return!1;var d=t.deviationBadges||[],v=n.deviationBadges||[];if(d.length!==v.length)return!1;for(c=0;c<d.length;c++){if(d[c].id!==v[c].id)return!1;if(d[c].actionId!==v[c].actionId)return!1;if(d[c].label!==v[c].label)return!1;if(d[c].score!==v[c].score)return!1;if(d[c].isOrphan!==v[c].isOrphan)return!1;if(d[c].isConnected!==v[c].isConnected)return!1;if(d[c].showScrollLockToggle!==v[c].showScrollLockToggle)return!1;if(d[c].scrollSyncLocked!==v[c].scrollSyncLocked)return!1;if((null===(e=d[c].style)||void 0===e?void 0:e.badgeBg)!==(null===(o=v[c].style)||void 0===o?void 0:o.badgeBg))return!1;if((null===(r=d[c].style)||void 0===r?void 0:r.badgeBorder)!==(null===(i=v[c].style)||void 0===i?void 0:i.badgeBorder))return!1;if((null===(u=d[c].style)||void 0===u?void 0:u.badgeText)!==(null===(l=v[c].style)||void 0===l?void 0:l.badgeText))return!1}return!0},s="::",c=function(t){if(!t)return!0;var n=t.trim().toLowerCase();return n.includes("no equivalent")||"n/a"===n||"na"===n||"none"===n},d=function(t){var n;if("string"!=typeof t||!t)return!1;for(var e=/<(updated|deleted|changed|change)\b[^>]*>([\s\S]*?)<\/\1>/gi,o=null;null!==(o=e.exec(t));){if((null!==(n=o[2])&&void 0!==n?n:"").replace(/<[^>]*>/g,"").trim().length>0)return!0}return!1},v=function(t){return"string"==typeof t&&t?t.replace(/<\/?(updated|deleted|changed|change)\b[^>]*>/gi,""):""},f=function(t,n){var e,o,r,i,u,l,a;if(!t)return n;var s=null!==(l=null!==(i=null!==(o=null===(e=t.evaluation_output)||void 0===e?void 0:e.output_score)&&void 0!==o?o:null===(r=t.evaluation_outputs)||void 0===r?void 0:r.output_score)&&void 0!==i?i:null===(u=t.evaluation_outputs)||void 0===u?void 0:u.output_value)&&void 0!==l?l:t.output_score;return null!==(a=null!=s?s:n)&&void 0!==a?a:""},g=function(t,n,e,o,r){void 0===r&&(r=14);var i=t+.5*(e-t),u=o-n;if(Math.abs(u)<3)return"M ".concat(t," ").concat(n," H ").concat(e);var l=u>0?1:-1,a=Math.min(r,Math.abs(u)/2,Math.abs(i-t)/2,Math.abs(e-i)/2);return["M ".concat(t," ").concat(n),"H ".concat(i-a),"Q ".concat(i," ").concat(n," ").concat(i," ").concat(n+l*a),"V ".concat(o-l*a),"Q ".concat(i," ").concat(o," ").concat(i+a," ").concat(o),"H ".concat(e)].join(" ")},p=function(t,n,e,o,r){void 0===e&&(e=300);var i=t.style.scrollBehavior;t.style.scrollBehavior="auto";var u=t.scrollTop,l=n-u,a=null,s=function(c){null===a&&(a=c);var d,v=c-a;v<e?(t.scrollTop=(d=v,d/=e,l*(--d*d*d+1)+u),r&&r(),requestAnimationFrame(s)):(t.scrollTop=n,t.style.scrollBehavior=i,r&&r(),o&&o())};requestAnimationFrame(s)},h=["#B91C1C","#A16207","#1D4ED8","#000000"],b=function(t){var n=h.findIndex(function(n){return n.toLowerCase()===t.toLowerCase()});return-1===n?h.length:n},m=function(n){for(var e,o,r,i,u,l,a,s,c,d,v,f,g,p=[],h=0,m=Object.keys((null==n?void 0:n.deviations)||{}).sort(function(t,n){return Number(t)-Number(n)});h<m.length;h++){var y=m[h];(x=null===(i=null===(r=null===(o=null===(e=null==n?void 0:n.deviations)||void 0===e?void 0:e[y])||void 0===o?void 0:o.evaluation_outputs)||void 0===r?void 0:r.metadata)||void 0===i?void 0:i.label_color)&&p.push(x)}for(var _=0,T=Object.keys((null==n?void 0:n.deviation_entries)||{}).sort(function(t,n){return Number(t)-Number(n)});_<T.length;_++){y=T[_];(x=null===(s=null===(a=null===(l=null===(u=null==n?void 0:n.deviation_entries)||void 0===u?void 0:u[y])||void 0===l?void 0:l.evaluation_outputs)||void 0===a?void 0:a.metadata)||void 0===s?void 0:s.label_color)&&p.push(x)}for(var B=0,A=Object.keys(n||{}).filter(function(t){return/^\d+$/.test(t)}).sort(function(t,n){return Number(t)-Number(n)});B<A.length;B++){var x;y=A[B];(x=null===(v=null===(d=null===(c=null==n?void 0:n[y])||void 0===c?void 0:c.evaluation_outputs)||void 0===d?void 0:d.metadata)||void 0===v?void 0:v.label_color)&&p.push(x)}return 0===p.length?(null===(g=null===(f=null==n?void 0:n.evaluation_outputs)||void 0===f?void 0:f.metadata)||void 0===g?void 0:g.label_color)?n.evaluation_outputs.metadata.label_color:t:p.sort(function(t,n){return b(t)-b(n)})[0]},y=function(t){for(var n,e,o,r,i,u,l,a,s,c=0,d=Object.keys((null==t?void 0:t.deviations)||{}).sort(function(t,n){return Number(t)-Number(n)});c<d.length;c++){var v=d[c];if(b=null===(o=null===(e=null===(n=null==t?void 0:t.deviations)||void 0===n?void 0:n[v])||void 0===e?void 0:e.evaluation_outputs)||void 0===o?void 0:o.output_value)return b}for(var f=0,g=Object.keys((null==t?void 0:t.deviation_entries)||{}).sort(function(t,n){return Number(t)-Number(n)});f<g.length;f++){v=g[f];if(b=null===(u=null===(i=null===(r=null==t?void 0:t.deviation_entries)||void 0===r?void 0:r[v])||void 0===i?void 0:i.evaluation_outputs)||void 0===u?void 0:u.output_value)return b}for(var p=0,h=Object.keys(t||{}).filter(function(t){return/^\d+$/.test(t)}).sort(function(t,n){return Number(t)-Number(n)});p<h.length;p++){var b;v=h[p];if(b=null===(a=null===(l=null==t?void 0:t[v])||void 0===l?void 0:l.evaluation_outputs)||void 0===a?void 0:a.output_value)return b}return(null===(s=null==t?void 0:t.evaluation_outputs)||void 0===s?void 0:s.output_value)?t.evaluation_outputs.output_value:null},_=function(t,n){var e=function(t){var n=t.replace("#","");return[parseInt(n.substring(0,2),16),parseInt(n.substring(2,4),16),parseInt(n.substring(4,6),16)]},o=function(t){var n=Math.round(t).toString(16);return 1===n.length?"0"+n:n};try{var r=e(t),i=e(n),u=(r[0]+i[0])/2*.95,l=(r[1]+i[1])/2*.95,a=(r[2]+i[2])/2*.95;return"#".concat(o(u)).concat(o(l)).concat(o(a))}catch(t){return"#FDE68A"}},T=function(t,n,e){if(!t)return null;if(t.id===e||t.nodeId===e||t.contentId===e)return n;if(!Array.isArray(t.subsections))return null;for(var o=0;o<t.subsections.length;o++){var r=T(t.subsections[o],"".concat(n,"-").concat(o),e);if(r)return r}return null},B=function(t,n){for(var e=0;e<t.length;e++){var o=T(t[e],String(e),n);if(o)return o}return null},A=new WeakMap,x=function(t){if(t){var n=A.get(t);null!=n&&(clearTimeout(n),A.delete(t)),t.style.transition="box-shadow 300ms ease-out, outline 300ms ease-out",requestAnimationFrame(function(){t.style.outline="",t.style.boxShadow=""}),window.setTimeout(function(){t.style.transition="",t.style.borderRadius=""},300)}},C=function(t){if(t){var n=A.get(t);null!=n&&clearTimeout(n),t.style.transition="box-shadow 300ms ease-in-out, outline 300ms ease-in-out",t.style.outline="2px solid #ff9494",t.style.borderRadius="6px",t.style.boxShadow="0 0 12px 2px rgba(244, 113, 113, 0.33)";var e=window.setTimeout(function(){x(t)},3e3);A.set(t,e)}},w=function(t,n){var e=n.getBoundingClientRect(),o=t.getBoundingClientRect(),r=n.scrollTop+o.top-e.top-e.height/2+o.height/2;n.scrollTo({top:r,behavior:"smooth"});var i=function(){return C(t)};if("onscrollend"in n)n.addEventListener("scrollend",i,{once:!0});else{var u=n.scrollTop,l=function(){n.scrollTop===u?i():(u=n.scrollTop,requestAnimationFrame(l))};requestAnimationFrame(l)}},I=function(t,n,e){if(Math.abs(t.scrollTop-n)<=2)e();else{var o,r=!1,i=function(){r||(r=!0,clearTimeout(o),t.removeEventListener("scrollend",u),e())},u=function(){return i()};t.addEventListener("scrollend",u),t.scrollTo({top:n,behavior:"smooth"}),o=setTimeout(i,800)}},N=function(t,n){return void 0===n&&(n=100),new Promise(function(e){var o,r=!1,i=function(){r||(r=!0,t.removeEventListener("scroll",u),e())},u=function(){clearTimeout(o),o=setTimeout(i,n)};t.addEventListener("scroll",u),o=setTimeout(i,n)})};export{s as DEVIATION_BADGE_SEPARATOR,a as areMarkdownPropsEqual,l as debounce,f as extractDeviationScore,B as findKeyPathByNodeId,u as generateColorPalette,g as getBentArrowPath,m as getFirstDeviationColor,y as getFirstDeviationOutputValue,i as getRationale,r as getSideData,d as hasMeaningfulRedlineTags,e as hasValue,C as highlightClause,c as isMissingStr,_ as mixHexColors,T as recursivelyFindSubSectionIdxById,x as resetClauseHighlight,o as resolveComparisonInputItems,n as safeStringify,w as scrollAndHighlightClause,I as scrollAndWait,p as smoothScrollTo,v as stripRedlineTags,N as waitForScrollIdle};
1
+ import{DEFAULT_DEVIAION_COLOR as n}from"./CognitiveCompareConstants.js";var t=function(n){return null==n?"":"string"==typeof n?n:Array.isArray(n)?n.map(t).join("\n\n"):"object"==typeof n?JSON.stringify(n):String(n)},e=function(n){return null!=n&&("string"==typeof n?n.trim().length>0:!Array.isArray(n)||n.length>0&&n.some(function(n){return e(n)}))},o=function(n){for(var t=n+1,e="";t>0;)t-=1,e=String.fromCharCode(97+t%26)+e,t=Math.floor(t/26);return e},r=function(n){var t=n.section,e=n.proposedSections,r=n.leftNums,i=n.fallbackNumber,u=n.firstOnly,l=void 0!==u&&u;if(!(null==t?void 0:t.id))return i;var a=(e||[]).map(function(n){var e=Array.isArray(null==n?void 0:n.refIndexes)?n.refIndexes:[],i=e.findIndex(function(n){return n===t.selfIndex});if(-1===i)return null;var u=(null==n?void 0:n.id)?r.get(n.id):void 0;return null==u?null:e.length>1?"".concat(u).concat(o(i)):String(u)}).filter(Boolean);return 0===a.length?i:l?a[0]:a.join(", ")},i=function(n,t){return null!=(null==n?void 0:n.selfIndex)&&1===(t||[]).filter(function(t){return Array.isArray(null==t?void 0:t.refIndexes)&&t.refIndexes.includes(n.selfIndex)}).length},u=function(n,t,e,o){var r;void 0===o&&(o={});var i=e[t],u=null===(r=null==n?void 0:n.comparison_inputs)||void 0===r?void 0:r[i];return u?(Array.isArray(u)?u:[u]).map(function(n,t){if("string"==typeof n){var e=o[n];return e?{contentId:n,data:e,attributes:e.additional_attributes||{}}:null}return n&&"object"==typeof n?{contentId:n.content_id||n.id||"".concat(i,"-direct-").concat(t),data:n,attributes:n.additional_attributes||{}}:null}).filter(Boolean):[]},l=function(n,e,o,r){var i,l,a;void 0===r&&(r={});var s=u(n,e,o,r),c=(null===(i=s[0])||void 0===i?void 0:i.data)||{},d=(null===(l=s[0])||void 0===l?void 0:l.attributes)||null;return{title:t((null==c?void 0:c.title)||""),content:t((null==c?void 0:c.content)||""),change_history:t((null==c?void 0:c.change_history)||""),attributes:d,subsections:(null==c?void 0:c.subsections)||[],contentId:null===(a=s[0])||void 0===a?void 0:a.contentId,allItems:s}},a=function(n){if(!n.mapping_rationale)return{cognitiveData:{decisioning:[],gap:[],relevance_score:0,isMissingRationale:!0,citations:[]},score:0,relation:"N/A"};var t=n.mapping_rationale,e=parseInt(t.decision_strength||"0");return{cognitiveData:{decisioning:t.decisioning_factors||[],gap:t.gaps_in_decision||[],relevance_score:e,citations:t.citations},score:0,relation:"N/A"}};function s(n){var t=function(n,t){var e=function(n){var t=function(n){return 4===n.length?"#"+n[1]+n[1]+n[2]+n[2]+n[3]+n[3]:n}(n).replace("#",""),e=parseInt(t,16);return{r:e>>16&255,g:e>>8&255,b:255&e}}(n),o=e.r,r=e.g,i=e.b;return function(n,t,e){return"#"+[n,t,e].map(function(n){return n.toString(16).padStart(2,"0")}).join("").toUpperCase()}(Math.round(o+(255-o)*t),Math.round(r+(255-r)*t),Math.round(i+(255-i)*t))};return{bg:t(n,.8),border:t(n,.5),badgeBg:t(n,.8),badgeBorder:t(n,.5),badgeText:n.toUpperCase(),highlightBg:t(n,.8)}}function c(n,t){var e;return function(){for(var o=[],r=0;r<arguments.length;r++)o[r]=arguments[r];var i=this;clearTimeout(e),e=setTimeout(function(){return n.apply(i,o)},t)}}var d=function(n,t){var e,o,r,i,u,l;if(n.content!==t.content)return!1;if(n.overlayContent!==t.overlayContent)return!1;if(n.sxStyles!==t.sxStyles)return!1;if(n.maintainRelativeOrder!==t.maintainRelativeOrder)return!1;if(n.highlightBg!==t.highlightBg)return!1;if(n.suppressHighlightBg!==t.suppressHighlightBg)return!1;if(n.collisionKey!==t.collisionKey)return!1;var a=n.highlights||[],s=t.highlights||[];if(a.length!==s.length)return!1;for(var c=0;c<a.length;c++)if(a[c]!==s[c])return!1;var d=n.deviationBadges||[],v=t.deviationBadges||[];if(d.length!==v.length)return!1;for(c=0;c<d.length;c++){if(d[c].id!==v[c].id)return!1;if(d[c].actionId!==v[c].actionId)return!1;if(d[c].label!==v[c].label)return!1;if(d[c].score!==v[c].score)return!1;if(d[c].isOrphan!==v[c].isOrphan)return!1;if(d[c].isConnected!==v[c].isConnected)return!1;if(d[c].showScrollLockToggle!==v[c].showScrollLockToggle)return!1;if(d[c].scrollSyncLocked!==v[c].scrollSyncLocked)return!1;if((null===(e=d[c].style)||void 0===e?void 0:e.badgeBg)!==(null===(o=v[c].style)||void 0===o?void 0:o.badgeBg))return!1;if((null===(r=d[c].style)||void 0===r?void 0:r.badgeBorder)!==(null===(i=v[c].style)||void 0===i?void 0:i.badgeBorder))return!1;if((null===(u=d[c].style)||void 0===u?void 0:u.badgeText)!==(null===(l=v[c].style)||void 0===l?void 0:l.badgeText))return!1}return!0},v="::",f=function(n){if(!n)return!0;var t=n.trim().toLowerCase();return t.includes("no equivalent")||"n/a"===t||"na"===t||"none"===t},g=function(n){var t;if("string"!=typeof n||!n)return!1;for(var e=/<(updated|deleted|changed|change)\b[^>]*>([\s\S]*?)<\/\1>/gi,o=null;null!==(o=e.exec(n));){if((null!==(t=o[2])&&void 0!==t?t:"").replace(/<[^>]*>/g,"").trim().length>0)return!0}return!1},p=function(n){return"string"==typeof n&&n?n.replace(/<\/?(updated|deleted|changed|change)\b[^>]*>/gi,""):""},h=function(n,t){var e,o,r,i,u,l,a;if(!n)return t;var s=null!==(l=null!==(i=null!==(o=null===(e=n.evaluation_output)||void 0===e?void 0:e.output_score)&&void 0!==o?o:null===(r=n.evaluation_outputs)||void 0===r?void 0:r.output_score)&&void 0!==i?i:null===(u=n.evaluation_outputs)||void 0===u?void 0:u.output_value)&&void 0!==l?l:n.output_score;return null!==(a=null!=s?s:t)&&void 0!==a?a:""},b=function(n,t,e,o,r){void 0===r&&(r=14);var i=n+.5*(e-n),u=o-t;if(Math.abs(u)<3)return"M ".concat(n," ").concat(t," H ").concat(e);var l=u>0?1:-1,a=Math.min(r,Math.abs(u)/2,Math.abs(i-n)/2,Math.abs(e-i)/2);return["M ".concat(n," ").concat(t),"H ".concat(i-a),"Q ".concat(i," ").concat(t," ").concat(i," ").concat(t+l*a),"V ".concat(o-l*a),"Q ".concat(i," ").concat(o," ").concat(i+a," ").concat(o),"H ".concat(e)].join(" ")},m=function(n,t,e,o,r){void 0===e&&(e=300);var i=n.style.scrollBehavior;n.style.scrollBehavior="auto";var u=n.scrollTop,l=t-u,a=null,s=function(c){null===a&&(a=c);var d,v=c-a;v<e?(n.scrollTop=(d=v,d/=e,l*(--d*d*d+1)+u),r&&r(),requestAnimationFrame(s)):(n.scrollTop=t,n.style.scrollBehavior=i,r&&r(),o&&o())};requestAnimationFrame(s)},y=["#B91C1C","#A16207","#1D4ED8","#000000"],_=function(n){var t=y.findIndex(function(t){return t.toLowerCase()===n.toLowerCase()});return-1===t?y.length:t},T=function(t){for(var e,o,r,i,u,l,a,s,c,d,v,f,g,p=[],h=0,b=Object.keys((null==t?void 0:t.deviations)||{}).sort(function(n,t){return Number(n)-Number(t)});h<b.length;h++){var m=b[h];(A=null===(i=null===(r=null===(o=null===(e=null==t?void 0:t.deviations)||void 0===e?void 0:e[m])||void 0===o?void 0:o.evaluation_outputs)||void 0===r?void 0:r.metadata)||void 0===i?void 0:i.label_color)&&p.push(A)}for(var y=0,T=Object.keys((null==t?void 0:t.deviation_entries)||{}).sort(function(n,t){return Number(n)-Number(t)});y<T.length;y++){m=T[y];(A=null===(s=null===(a=null===(l=null===(u=null==t?void 0:t.deviation_entries)||void 0===u?void 0:u[m])||void 0===l?void 0:l.evaluation_outputs)||void 0===a?void 0:a.metadata)||void 0===s?void 0:s.label_color)&&p.push(A)}for(var x=0,I=Object.keys(t||{}).filter(function(n){return/^\d+$/.test(n)}).sort(function(n,t){return Number(n)-Number(t)});x<I.length;x++){var A;m=I[x];(A=null===(v=null===(d=null===(c=null==t?void 0:t[m])||void 0===c?void 0:c.evaluation_outputs)||void 0===d?void 0:d.metadata)||void 0===v?void 0:v.label_color)&&p.push(A)}return 0===p.length?(null===(g=null===(f=null==t?void 0:t.evaluation_outputs)||void 0===f?void 0:f.metadata)||void 0===g?void 0:g.label_color)?t.evaluation_outputs.metadata.label_color:n:p.sort(function(n,t){return _(n)-_(t)})[0]},x=function(n){for(var t,e,o,r,i,u,l,a,s,c=0,d=Object.keys((null==n?void 0:n.deviations)||{}).sort(function(n,t){return Number(n)-Number(t)});c<d.length;c++){var v=d[c];if(b=null===(o=null===(e=null===(t=null==n?void 0:n.deviations)||void 0===t?void 0:t[v])||void 0===e?void 0:e.evaluation_outputs)||void 0===o?void 0:o.output_value)return b}for(var f=0,g=Object.keys((null==n?void 0:n.deviation_entries)||{}).sort(function(n,t){return Number(n)-Number(t)});f<g.length;f++){v=g[f];if(b=null===(u=null===(i=null===(r=null==n?void 0:n.deviation_entries)||void 0===r?void 0:r[v])||void 0===i?void 0:i.evaluation_outputs)||void 0===u?void 0:u.output_value)return b}for(var p=0,h=Object.keys(n||{}).filter(function(n){return/^\d+$/.test(n)}).sort(function(n,t){return Number(n)-Number(t)});p<h.length;p++){var b;v=h[p];if(b=null===(a=null===(l=null==n?void 0:n[v])||void 0===l?void 0:l.evaluation_outputs)||void 0===a?void 0:a.output_value)return b}return(null===(s=null==n?void 0:n.evaluation_outputs)||void 0===s?void 0:s.output_value)?n.evaluation_outputs.output_value:null},I=function(n,t){var e=function(n){var t=n.replace("#","");return[parseInt(t.substring(0,2),16),parseInt(t.substring(2,4),16),parseInt(t.substring(4,6),16)]},o=function(n){var t=Math.round(n).toString(16);return 1===t.length?"0"+t:t};try{var r=e(n),i=e(t),u=(r[0]+i[0])/2*.95,l=(r[1]+i[1])/2*.95,a=(r[2]+i[2])/2*.95;return"#".concat(o(u)).concat(o(l)).concat(o(a))}catch(n){return"#FDE68A"}},A=function(n,t,e){if(!n)return null;if(n.id===e||n.nodeId===e||n.contentId===e)return t;if(!Array.isArray(n.subsections))return null;for(var o=0;o<n.subsections.length;o++){var r=A(n.subsections[o],"".concat(t,"-").concat(o),e);if(r)return r}return null},B=function(n,t){for(var e=0;e<n.length;e++){var o=A(n[e],String(e),t);if(o)return o}return null},C=new WeakMap,S=function(n){if(n){var t=C.get(n);null!=t&&(clearTimeout(t),C.delete(n)),n.style.transition="box-shadow 300ms ease-out, outline 300ms ease-out",requestAnimationFrame(function(){n.style.outline="",n.style.boxShadow=""}),window.setTimeout(function(){n.style.transition="",n.style.borderRadius=""},300)}},N=function(n){if(n){var t=C.get(n);null!=t&&clearTimeout(t),n.style.transition="box-shadow 300ms ease-in-out, outline 300ms ease-in-out",n.style.outline="2px solid #ff9494",n.style.borderRadius="6px",n.style.boxShadow="0 0 12px 2px rgba(244, 113, 113, 0.33)";var e=window.setTimeout(function(){S(n)},3e3);C.set(n,e)}},w=function(n,t){var e=t.getBoundingClientRect(),o=n.getBoundingClientRect(),r=t.scrollTop+o.top-e.top-e.height/2+o.height/2;t.scrollTo({top:r,behavior:"smooth"});var i=function(){return N(n)};if("onscrollend"in t)t.addEventListener("scrollend",i,{once:!0});else{var u=t.scrollTop,l=function(){t.scrollTop===u?i():(u=t.scrollTop,requestAnimationFrame(l))};requestAnimationFrame(l)}},M=function(n,t,e){if(Math.abs(n.scrollTop-t)<=2)e();else{var o,r=!1,i=function(){r||(r=!0,clearTimeout(o),n.removeEventListener("scrollend",u),e())},u=function(){return i()};n.addEventListener("scrollend",u),n.scrollTo({top:t,behavior:"smooth"}),o=setTimeout(i,800)}},j=function(n,t){return void 0===t&&(t=100),new Promise(function(e){var o,r=!1,i=function(){r||(r=!0,n.removeEventListener("scroll",u),e())},u=function(){clearTimeout(o),o=setTimeout(i,t)};n.addEventListener("scroll",u),o=setTimeout(i,t)})};export{v as DEVIATION_BADGE_SEPARATOR,d as areMarkdownPropsEqual,c as debounce,h as extractDeviationScore,B as findKeyPathByNodeId,s as generateColorPalette,o as getAlphabeticSuffix,b as getBentArrowPath,T as getFirstDeviationColor,x as getFirstDeviationOutputValue,a as getRationale,r as getRhsMappedSectionNumber,l as getSideData,g as hasMeaningfulRedlineTags,i as hasSingleMappedLhsSection,e as hasValue,N as highlightClause,f as isMissingStr,I as mixHexColors,A as recursivelyFindSubSectionIdxById,S as resetClauseHighlight,u as resolveComparisonInputItems,t as safeStringify,w as scrollAndHighlightClause,M as scrollAndWait,m as smoothScrollTo,p as stripRedlineTags,j as waitForScrollIdle};
2
2
  //# sourceMappingURL=CognitiveComparehelpers.js.map
@@ -1,2 +1,2 @@
1
- import{__assign as e}from"tslib";import{jsx as o,jsxs as n,Fragment as i}from"react/jsx-runtime";import t from"react";import{Box as r}from"@mui/material";import{EllipsisVertical as l}from"lucide-react";import a from"./SectionAccordion.js";import d from"./ThreeDotsLoader.js";import c from"./ScrollLockToggle.js";import{useCompareContext as s}from"../CompareContext.js";var p=t.memo(function(t){var p,u,g,x=t.section,v=t.idx,f=s(),m=f.maintainRelativeOrder;f.existingSections;var h=f.proposedSections,b=f.connectedSections,S=f.expandedSections,R=f.displayConfig,y=f.treeData;f.deviationNumberRegistry;var I=f.getSectionCompareStyle;f.getBadgeRef;var w=f.getSectionRowRef,B=f.sectionRightRefs,C=f.rhsBadgeRefs,k=f.openMoreFunctionsPopup,T=f.handleOpenSummaryPopup,N=f.handleCloseSummaryPopup,P=f.toggleSection;f.showDeviationBadges,f.renderSubSectionAccordion,f.isProposingFix,f.proposingFixNodeId,f.isRedlineFlow;var D=f.isSideBySide,j=f.activeSideBySideSection,z=f.scrollSyncLocked,L=f.toggleScrollSyncLocked,F=f.summaryPopupAnchorEl;f.deviationNodeIdToView,f.deviationTargetParentId;var O=f.showDeviationNavigation;f.showOpenNodeRef,f.resolvedMarkdownStyles;var A=f.unifiedNumbering,E=x,M=!1,W=null,_=-1;if(m){_=h.findIndex(function(e){var o;return(null===(o=e.refIndexes)||void 0===o?void 0:o.includes(E.selfIndex))&&e.selfIndex>=0});var K=h.findIndex(function(e,o){var n;return b.has(o)&&(null===(n=e.refIndexes)||void 0===n?void 0:n.includes(E.selfIndex))});(M=-1!==K)&&(W=I(K,"left"))}else(M=b.has(v))&&(W=I(v,"right"));var V=m&&-1!==_?I(_,"left"):I(v,"right"),X=m?-1!==_||!(null===(p=E.refIndexes)||void 0===p?void 0:p.length)&&h.some(function(e){return e.id&&e.id===E.id}):Boolean(h[v]),Y=m?E.selfIndex<0||!X:!h[v],q=A.rightNums.get(E.id),G=null===(u=C.current[v])||void 0===u?void 0:u.current,H=M||D&&(j===v||j===_)||!!F&&F===G;return o(r,e({ref:w(v),sx:{mb:1,width:"100%"}},{children:o(r,e({ref:B.current[v],sx:e({width:"100%",display:"flex"},M&&W&&{borderRadius:"6px",outline:"2px solid ".concat(W.badgeBorder),outlineOffset:"1px"})},{children:n(r,e({sx:{position:"relative",width:"100%"}},{children:[o(a,{section:x,idx:v,columnKey:"right",colRef:w("right-accordion-".concat(v)),mb:0,parentNodeId:(null===(g=null==y?void 0:y.input_index_map)||void 0===g?void 0:g[1])||"",isExpanded:m?!!S["right-".concat(v)]:!!S[String(v)],onToggle:function(){N(),P(v,"right")},navigation:x.id?O[x.id]:null}),m&&V&&o(r,e({ref:C.current[v],"data-section-id":E.id,onClick:function(e){var o,n,i;if(Y){var t=R.enableDeviationSchemaBackwardCompatibility?null!==(o=E.evaluationResult)&&void 0!==o?o:null:null!==(i=null===(n=E.evaluationResult)||void 0===n?void 0:n[0])&&void 0!==i?i:null;T(e,String(v),Y,t)}},sx:{position:"absolute",top:"18px",left:0,transform:"translateY(-50%) translateX(calc(-100% - 8px))",display:"inline-flex",alignItems:"center",justifyContent:"center",gap:Y?"4px":"0px",fontSize:"11px",bgcolor:V.badgeBg,color:V.badgeText,border:"1px solid ".concat(V.badgeBorder),borderRadius:Y?"12px":"10px",px:Y?1.2:1,py:.3,fontWeight:Y?600:700,cursor:Y?"pointer":"default",whiteSpace:"nowrap",zIndex:20,boxShadow:Y?"0 1px 3px rgba(0,0,0,0.07)":"none"}},{children:Y?n(i,{children:[n(r,e({component:"span",onClick:function(e){var o,n,i;e.stopPropagation();var t=R.enableDeviationSchemaBackwardCompatibility?null!==(o=E.evaluationResult)&&void 0!==o?o:null:null!==(i=null===(n=E.evaluationResult)||void 0===n?void 0:n[0])&&void 0!==i?i:null;T(e,String(v),Y,t)},sx:{display:"inline-flex",alignItems:"center",gap:"4px",px:.2,cursor:"pointer",borderRight:"1px solid ".concat(V.badgeBorder),"&:hover":{bgcolor:"".concat(V.badgeBorder,"22")}}},{children:[null!=q&&o(r,e({component:"span",sx:{fontSize:"11px",fontWeight:700,pr:.5,borderRight:"1px solid ".concat(V.badgeBorder)}},{children:q})),o(r,e({component:"span",sx:{fontSize:"11px",px:.25}},{children:!R.isLoading||null!=E.evaluationResult&&void 0!==E.evaluationResult?V.label?"".concat(V.label):"100% Deviation":o(d,{color:V.badgeText})}))]})),n(r,e({component:"span",onClick:function(e){e.stopPropagation();var o=m?h.find(function(e){var o;return null===(o=e.refIndexes)||void 0===o?void 0:o.includes(E.selfIndex)})||{title:"",content:""}:h[v]||{title:"",content:""};k(e,o,Y,E,v,V)},sx:{display:"inline-flex",alignItems:"center",px:.2,cursor:"pointer","&:hover":{bgcolor:"".concat(V.badgeBorder,"22")}}},{children:[o(l,{size:11,color:V.badgeText}),H&&o(c,{locked:z,onToggle:L,color:V.badgeText,borderColor:V.badgeBorder,size:11})]}))]}):o(i,{children:o(r,e({component:"span",sx:{px:.2}},{children:null!=q?q:""}))})}))]}))}))}),"right-row-".concat(v))});export{p as default};
1
+ import{__assign as e}from"tslib";import{jsx as o,jsxs as n,Fragment as i}from"react/jsx-runtime";import t from"react";import{Box as r}from"@mui/material";import{EllipsisVertical as l}from"lucide-react";import a from"./SectionAccordion.js";import d from"./ThreeDotsLoader.js";import c from"./ScrollLockToggle.js";import{getRhsMappedSectionNumber as s}from"../CognitiveComparehelpers.js";import{useCompareContext as p}from"../CompareContext.js";var u=t.memo(function(u){var g,f,x,v=u.section,m=u.idx,h=p(),b=h.maintainRelativeOrder;h.existingSections;var S=h.proposedSections,R=h.connectedSections,y=h.expandedSections,I=h.displayConfig,w=h.treeData;h.deviationNumberRegistry;var B=h.getSectionCompareStyle;h.getBadgeRef;var C=h.getSectionRowRef,k=h.sectionRightRefs,N=h.rhsBadgeRefs,T=h.openMoreFunctionsPopup,P=h.handleOpenSummaryPopup,j=h.handleCloseSummaryPopup,D=h.toggleSection;h.showDeviationBadges,h.renderSubSectionAccordion,h.isProposingFix,h.proposingFixNodeId,h.isRedlineFlow;var z=h.isSideBySide,L=h.activeSideBySideSection,F=h.scrollSyncLocked,O=h.toggleScrollSyncLocked,A=h.summaryPopupAnchorEl;h.deviationNodeIdToView,h.deviationTargetParentId;var M=h.showDeviationNavigation;h.showOpenNodeRef,h.resolvedMarkdownStyles;var E=h.unifiedNumbering,W=v,_=!1,K=null,V=-1;if(b){V=S.findIndex(function(e){var o;return(null===(o=e.refIndexes)||void 0===o?void 0:o.includes(W.selfIndex))&&e.selfIndex>=0});var X=S.findIndex(function(e,o){var n;return R.has(o)&&(null===(n=e.refIndexes)||void 0===n?void 0:n.includes(W.selfIndex))});(_=-1!==X)&&(K=B(X,"left"))}else(_=R.has(m))&&(K=B(m,"right"));var Y=b&&-1!==V?B(V,"left"):B(m,"right"),q=b?-1!==V||!(null===(g=W.refIndexes)||void 0===g?void 0:g.length)&&S.some(function(e){return e.id&&e.id===W.id}):Boolean(S[m]),G=b?W.selfIndex<0||!q:!S[m],H=t.useMemo(function(){var e=E.rightNums.get(W.id);return b&&W.id?s({section:W,proposedSections:S,leftNums:E.leftNums,fallbackNumber:e}):e},[b,S,W.id,W.selfIndex,E]),J=null===(f=N.current[m])||void 0===f?void 0:f.current,Q=_||z&&(L===m||L===V)||!!A&&A===J;return o(r,e({ref:C(m),sx:{mb:1,width:"100%"}},{children:o(r,e({ref:k.current[m],sx:e({width:"100%",display:"flex"},_&&K&&{borderRadius:"6px",outline:"2px solid ".concat(K.badgeBorder),outlineOffset:"1px"})},{children:n(r,e({sx:{position:"relative",width:"100%"}},{children:[o(a,{section:v,idx:m,columnKey:"right",colRef:C("right-accordion-".concat(m)),mb:0,parentNodeId:(null===(x=null==w?void 0:w.input_index_map)||void 0===x?void 0:x[1])||"",isExpanded:b?!!y["right-".concat(m)]:!!y[String(m)],onToggle:function(){j(),D(m,"right")},navigation:v.id?M[v.id]:null}),b&&Y&&o(r,e({ref:N.current[m],"data-section-id":W.id,onClick:function(e){var o,n,i;if(G){var t=I.enableDeviationSchemaBackwardCompatibility?null!==(o=W.evaluationResult)&&void 0!==o?o:null:null!==(i=null===(n=W.evaluationResult)||void 0===n?void 0:n[0])&&void 0!==i?i:null;P(e,String(m),G,t)}},sx:{position:"absolute",top:"18px",left:0,transform:"translateY(-50%) translateX(calc(-100% - 8px))",display:"inline-flex",alignItems:"center",justifyContent:"center",gap:G?"4px":"0px",fontSize:"11px",bgcolor:Y.badgeBg,color:Y.badgeText,border:"1px solid ".concat(Y.badgeBorder),borderRadius:G?"12px":"10px",px:G?1.2:1,py:.3,fontWeight:G?600:700,cursor:G?"pointer":"default",whiteSpace:"nowrap",zIndex:20,boxShadow:G?"0 1px 3px rgba(0,0,0,0.07)":"none"}},{children:G?n(i,{children:[n(r,e({component:"span",onClick:function(e){var o,n,i;e.stopPropagation();var t=I.enableDeviationSchemaBackwardCompatibility?null!==(o=W.evaluationResult)&&void 0!==o?o:null:null!==(i=null===(n=W.evaluationResult)||void 0===n?void 0:n[0])&&void 0!==i?i:null;P(e,String(m),G,t)},sx:{display:"inline-flex",alignItems:"center",gap:"4px",px:.2,cursor:"pointer",borderRight:"1px solid ".concat(Y.badgeBorder),"&:hover":{bgcolor:"".concat(Y.badgeBorder,"22")}}},{children:[null!=H&&o(r,e({component:"span",sx:{fontSize:"11px",fontWeight:700,pr:.5,borderRight:"1px solid ".concat(Y.badgeBorder)}},{children:H})),o(r,e({component:"span",sx:{fontSize:"11px",px:.25}},{children:!I.isLoading||null!=W.evaluationResult&&void 0!==W.evaluationResult?Y.label?"".concat(Y.label):"100% Deviation":o(d,{color:Y.badgeText})}))]})),n(r,e({component:"span",onClick:function(e){e.stopPropagation();var o=b?S.find(function(e){var o;return null===(o=e.refIndexes)||void 0===o?void 0:o.includes(W.selfIndex)})||{title:"",content:""}:S[m]||{title:"",content:""};T(e,o,G,W,m,Y)},sx:{display:"inline-flex",alignItems:"center",px:.2,cursor:"pointer","&:hover":{bgcolor:"".concat(Y.badgeBorder,"22")}}},{children:[o(l,{size:11,color:Y.badgeText}),Q&&o(c,{locked:F,onToggle:O,color:Y.badgeText,borderColor:Y.badgeBorder,size:11})]}))]}):o(i,{children:o(r,e({component:"span",sx:{px:.2}},{children:null!=H?H:""}))})}))]}))}))}),"right-row-".concat(m))});export{u as default};
2
2
  //# sourceMappingURL=RHSSectionRow.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 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 x,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 R,F,_,k,B,C,M,A,O,j,W,N,D,P,E,T=S.section,K=S.idx,z=S.columnKey,L=S.colRef,H=S.mb,G=void 0===H?1:H,V=S.isExpanded,X=S.onToggle,Y=S.navigation,q=S.parentNodeId,J=void 0===q?"":q,Q=p(),U=Q.showOpenNodeRef,Z=Q.resolvedMarkdownStyles,$=Q.maintainRelativeOrder,nn=Q.showDeviationBadges,en=void 0!==nn&&nn,on=Q.renderSubSectionAccordion,tn=Q.treeData,ln=Q.proposedSections,dn=Q.existingSections,rn=Q.deviationNumberRegistry,an=Q.deviationParentRegistry,un=Q.getBadgeRef,cn=Q.openSummaryPopup,sn=Q.getSectionCompareStyle,vn=Q.connectedSections,fn=Q.openMoreFunctionsPopup,pn=Q.isProposingFix,hn=Q.proposingFixNodeId,gn=Q.isRedlineFlow,xn=Q.isSideBySide,mn=Q.activeSideBySideSection,In=Q.scrollSyncLocked,yn=Q.unifiedNumbering,bn=Q.toggleScrollSyncLocked,wn=Q.summaryPopupAnchorEl,Sn="".concat(xn?"1":"0","-").concat(String(null!=mn?mn:"")),Rn=(null===(R=T.displayTitle)||void 0===R||R)&&h(T.title),Fn=!(!pn||!hn||"left"!==z||T.id!==hn&&T.nodeId!==hn),_n=g(T.content),kn="boolean"==typeof gn?gn:_n,Bn=_n,Cn=kn&&_n,Mn=Cn?x(T.content):T.content,An=Cn?T.content:void 0,On=(null===(F=T.displayContent)||void 0===F||F||_n)&&h(T.content),jn=!Rn&&!On,Wn=T.title;Rn||(Wn=On?"No Title Found":"No Matching Section Found");var Nn=T.evaluationResult;if(!Nn&&"right"===z)if($){var Dn=null===(_=T.refIndexes)||void 0===_?void 0:_[0],Pn=ln.find(function(n){return n.selfIndex===Dn});Nn=null==Pn?void 0:Pn.evaluationResult}else Nn=null===(k=ln[K])||void 0===k?void 0:k.evaluationResult;var En=null===(B=null==tn?void 0:tn.input_index_map)||void 0===B?void 0:B[0],Tn=null===(C=null==tn?void 0:tn.input_index_map)||void 0===C?void 0:C[1],Kn="left"===z?Tn:En,zn=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||l.nodeId===e||l.contentId===e)return l;if(null===(i=l.subsections)||void 0===i?void 0:i.length){var d=zn(l.subsections,e);if(d)return d}}return null},Ln="left"===z?T:zn(ln,T.id),Hn="right"===z?T:zn(dn,T.id),Gn=o.useMemo(function(){if(!$)return 0;var n=1/0,e=function(n){var e=g(n)?x(n):n;return y(e||"").replace(/\\n/g,"\n")},i=function(o,t,l,d){if(o){var r=o.nodeId||o.id;if(d&&"right"===z){var a=ln.filter(function(n){var e;return null===(e=n.refIndexes)||void 0===e?void 0:e.includes(o.selfIndex)});a.length>0&&(r=a[0].nodeId||a[0].id)}var u=o.nodeId||o.id||(null==t?void 0:t.nodeId)||(null==t?void 0:t.id)||(null==l?void 0:l.nodeId)||(null==l?void 0:l.id),c=o.evaluationResult||(null==t?void 0:t.evaluationResult)||(null==l?void 0:l.evaluationResult),s=(null==c?void 0:c.deviations)||{};Object.keys(s).forEach(function(i){var d,a=null===(d=s[i])||void 0===d?void 0:d[J];if(function(n,i){if("string"!=typeof i||I(i))return!1;var o=e(null==n?void 0:n.content),t=e(i);return!!t&&o.includes(t)}("left"===z?t||o:l||o,a)){var c="".concat(r).concat(b).concat(i),v=null==rn?void 0:rn[c];null!=v&&v<n&&(n=v);var f="".concat(u).concat(b).concat(i),p=null==rn?void 0:rn[f];null!=p&&p<n&&(n=p)}});for(var v=o.subsections||[],f=(null==t?void 0:t.subsections)||[],p=(null==l?void 0:l.subsections)||[],h=Math.max(v.length,f.length,p.length),g=0;g<h;g++)i(v[g],f[g],p[g],!1)}};return i(T,Ln,Hn,!0),n!==1/0?n-1:0},[T,Ln,Hn,z,J,rn,$,ln]);if($)if("left"===z){var Vn=null===(M=T.refIndexes)||void 0===M?void 0:M[0],Xn=dn.findIndex(function(n){return n.selfIndex===Vn});Hn=-1!==Xn?dn[Xn]:zn(dn,T.id)}else{var Yn=null===(A=T.refIndexes)||void 0===A?void 0:A[0],qn=ln.findIndex(function(n){return n.selfIndex===Yn});Ln=-1!==qn?ln[qn]:zn(ln,T.id)}var Jn="left"===z?!Hn:!Ln,Qn=Nn||(null==Ln?void 0:Ln.evaluationResult)||(null==Hn?void 0:Hn.evaluationResult),Un=null!==(W=null===(j=null===(O=null==Qn?void 0:Qn.evaluation_outputs)||void 0===O?void 0:O.metadata)||void 0===j?void 0:j.label_color)&&void 0!==W?W:w,Zn=m(Un).highlightBg,$n=(null==Qn?void 0:Qn.deviations)||{},ne=T.nodeId||T.id;if($&&"left"!==z){var ee=ln.filter(function(n){var e;return null===(e=n.refIndexes)||void 0===e?void 0:e.includes(T.selfIndex)});ee.length>0?ne=ee[0].nodeId||ee[0].id:(null==Ln?void 0:Ln.id)&&(ne=Ln.nodeId||Ln.id)}var ie=Object.keys($n)[0],oe=ie?"".concat(ne).concat(b).concat(ie):null,te=oe?null==an?void 0:an[oe]:null,le=K+1;if($&&yn){var de="left"===z?yn.leftNums.get(null==T?void 0:T.id):yn.rightNums.get(null==T?void 0:T.id);Jn&&void 0!==de?le=de:null!=te&&te>=0?le=te:void 0!==de&&(le=de)}else null!=te&&te>=0&&(le=te);var re=Object.entries($n).map(function(n){var e=n[0],i=n[1],o="".concat(ne).concat(b).concat(e);return{deviationKey:e,deviationMap:i,refId:o,currentIndex:rn[o]}}).filter(function(n){return void 0!==n.currentIndex&&null!==n.currentIndex});re.sort(function(n,e){return n.currentIndex-e.currentIndex});var ae,ue,ce=re.map(function(e){var i,o,t,l,d,r,a=e.deviationKey,u=e.deviationMap,c=e.refId,s=e.currentIndex;$&&void 0!==Gn&&(s-=Gn),s=Math.max(1,s);var v=u[J],f=I(v);if(f)v="";else if(!v)return null;var p=K,h=K;if($)if("left"===z){var g=null===(i=T.refIndexes)||void 0===i?void 0:i[0],x=dn.findIndex(function(n){return n.selfIndex===g});if(-1!==x)h=x;else{var y=dn.findIndex(function(n){return n.id===T.id||n.nodeId===T.nodeId||n.contentId===T.contentId});h=-1!==y?y:K}}else{var w=null===(o=T.refIndexes)||void 0===o?void 0:o[0],S=ln.findIndex(function(n){return n.selfIndex===w});if(-1!==S)p=S;else p=-1!==(C=ln.findIndex(function(n){return n.id===T.id||n.nodeId===T.nodeId||n.contentId===T.contentId}))?C:K}var R="".concat(ne).concat(b).concat(a).concat(b).concat(p).concat(b).concat(h),F=u[Kn],_=Jn||I(F),k="".concat(le,".").concat(s),B=K;if("right"===z&&$){var C,M=null===(t=T.refIndexes)||void 0===t?void 0:t[0],A=ln.findIndex(function(n){return n.selfIndex===M});if(-1!==A)B=A;else-1!==(C=ln.findIndex(function(n){return n.id===T.id||n.nodeId===T.nodeId||n.contentId===T.contentId}))&&(B=C)}var O=sn?sn(B):null,j=(null==u?void 0:u.evaluation_outputs)||(null==Qn?void 0:Qn.evaluation_outputs),W=null!==(l=null==j?void 0:j.output_value)&&void 0!==l?l:null,N=null!==(r=null===(d=null==j?void 0:j.metadata)||void 0===d?void 0:d.label_color)&&void 0!==r?r:Un,D=m(N),P=O?n(n({},O),{badgeBg:D.badgeBg,badgeBorder:D.badgeBorder,badgeText:D.badgeText}):n({},D),E=(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:j,cognitive_decisioning:(null==u?void 0:u.cognitive_decisioning)||(null==Qn?void 0:Qn.cognitive_decisioning)}:null,L=0,H=Mn||"";if(v&&H){var G=H.split(/\n{2,}/),V=G.findIndex(function(n){return n.includes(v)});if(-1!==V){var X=Object.entries($n).filter(function(n){n[0];var e=n[1][J];return e&&G[V].includes(e)}).sort(function(n,e){return G[V].indexOf(n[1][J])-G[V].indexOf(e[1][J])}),Y=X.filter(function(n){n[0];var e=n[1][J];return e&&(e.includes(v)||v.includes(e))});Y.length>1&&(L=Math.max(0,Y.findIndex(function(n){return n[0]===a})))}}var q=un(z,c);return{id:c,actionId:R,label:k,highlight:v,side:z,style:P,stackIndex:L,score:W,isConnected:null==vn?void 0:vn.has(R),showScrollLockToggle:(null==vn?void 0:vn.has(R))||xn&&mn===R||!!wn&&wn===q.current,scrollSyncLocked:In,toggleScrollSyncLocked:bn,isOrphan:_,isMissingClause:f,badgeRef:q,onClick:function(n){n.stopPropagation(),fn&&fn(n,Ln||{id:"orphan-left",title:"",content:""},_,Hn||{id:"orphan-right",title:"",content:""},R,P)},onSummaryClick:function(n){n.stopPropagation(),cn(n,R,_,E)}}}).filter(Boolean),se=en||!kn&&Fn?ce:[],ve=ce.map(function(n){return n.highlight}).filter(Boolean),fe=T.id&&z===(null==Y?void 0:Y.columnKey)?Y:null,pe=o.useRef(!1);return t(function(){V||(pe.current=!1)},[V]),e(l,n({ref:L,sx:{mb:G,width:"100%",display:"flex",flexDirection:"column",position:"relative",minWidth:0}},{children:[V&&(null==fe?void 0:fe.showAbove)&&i("div",n({style:{position:"sticky",top:0,height:"0px",cursor:"pointer"},onClick:function(){var n,e;return null===(e=null===(n=null==fe?void 0:fe.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"===z?"+":"-"," 130px))"),position:"absolute",paddingTop:"20px"},"left"===z?{right:"-20px"}:{left:"-20px"})},{children:i(s,{color:(null===(N=null==fe?void 0:fe.showAboveRef)||void 0===N?void 0:N.current)?window.getComputedStyle(fe.showAboveRef.current).color:void 0})}))})),e(d,n({disableGutters:!0,expanded:!jn&&V,onChange:function(){jn||(X(),U.current=T.id)},sx:{boxShadow:"none",border:jn?"1px dashed #E2E8F0":"1px solid #E2E8F0",bgcolor:jn?"#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:jn?null:i(v,{size:16}),sx:{minHeight:"36px",flexShrink:0,cursor:jn?"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:Rn&&i(a,n({title:Wn,placement:"top"},{children:i(u,n({component:"div",sx:{fontSize:"12px",color:jn?"#94A3B8":"#19213D",fontWeight:jn?400:700,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0}},{children:(ae=Wn,ue="left"===z&&(null!==(P=null===(D=null==T?void 0:T.refContentIds)||void 0===D?void 0:D.length)&&void 0!==P?P:1)>1,void 0===ue&&(ue=!1),ae?y(ae).replace(/\\n/g,"\n").split(/(\*\*.*?\*\*)/g).map(function(o,t){return o.startsWith("**")&&o.endsWith("**")?i("strong",{children:o.slice(2,-2)},t):e("div",n({style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"8px",width:"100%"}},{children:[i("span",{children:o}),ue&&i("span",n({style:{display:"inline-flex",alignItems:"center",justifyContent:"center",padding:"0px 6px",borderRadius:"9999px",background:"#F3F4F6",border:"1px solid #D1D5DB",color:"#6B7280",fontSize:"9px",fontWeight:500,whiteSpace:"nowrap",lineHeight:1.4,marginRight:"4px"}},{children:"Multiple"}))]}),t)}):null)}))}))})),!jn&&e(c,n({sx:{pt:0,pb:1.25,bgcolor:"#FFFFFF",flex:1,display:"flex",flexDirection:"column",minWidth:0}},{children:[On&&i(f,{content:Mn,overlayContent:An,sxStyles:Z,highlights:ve,maintainRelativeOrder:$,highlightBg:Zn,suppressHighlightBg:Bn,deviationBadges:se,collisionKey:Sn}),(T.subsections||[]).map(function(n,e){return on({section:n,keyPath:"".concat(K,"-").concat(e),depth:0,columnKey:z,parentNodeId:J,sectionOffset:Gn})})]}))]})),V&&(null==fe?void 0:fe.showBelow)&&i("div",n({style:{position:"sticky",bottom:0,height:"0px",cursor:"pointer"},onClick:function(){var n,e;return null===(e=null===(n=null==fe?void 0:fe.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"===z?"+":"-"," 130px))"),position:"absolute",paddingBottom:"20px"},"left"===z?{right:"-20px"}:{left:"-20px"})},{children:i(v,{color:(null===(E=null==fe?void 0:fe.showBelowRef)||void 0===E?void 0:E.current)?window.getComputedStyle(fe.showBelowRef.current).color:void 0})}))}))]}),"".concat(z,"-sec-").concat(K))};export{S as default};
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 u,Typography as a,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 x,hasSingleMappedLhsSection as m,generateColorPalette as I,isMissingStr as y,getRhsMappedSectionNumber as b,safeStringify as S,DEVIATION_BADGE_SEPARATOR as w}from"../CognitiveComparehelpers.js";import{DEFAULT_DEVIAION_COLOR as R}from"../CognitiveCompareConstants.js";var _=function(_){var F,k,N,M,B,C,E,A,O,j,W,T,D,P,K,z=_.section,G=_.idx,L=_.columnKey,X=_.colRef,H=_.mb,V=void 0===H?1:H,Y=_.isExpanded,q=_.onToggle,J=_.navigation,Q=_.parentNodeId,U=void 0===Q?"":Q,Z=p(),$=Z.showOpenNodeRef,nn=Z.resolvedMarkdownStyles,en=Z.maintainRelativeOrder,on=Z.showDeviationBadges,tn=void 0!==on&&on,ln=Z.renderSubSectionAccordion,dn=Z.treeData,rn=Z.proposedSections,un=Z.existingSections,an=Z.deviationNumberRegistry,cn=Z.deviationParentRegistry,sn=Z.getBadgeRef,vn=Z.openSummaryPopup,fn=Z.getSectionCompareStyle,pn=Z.connectedSections,hn=Z.openMoreFunctionsPopup,gn=Z.isProposingFix,xn=Z.proposingFixNodeId,mn=Z.isRedlineFlow,In=Z.isSideBySide,yn=Z.activeSideBySideSection,bn=Z.scrollSyncLocked,Sn=Z.unifiedNumbering,wn=Z.toggleScrollSyncLocked,Rn=Z.summaryPopupAnchorEl,_n="".concat(In?"1":"0","-").concat(String(null!=yn?yn:"")),Fn=(null===(F=z.displayTitle)||void 0===F||F)&&h(z.title),kn=!(!gn||!xn||"left"!==L||z.id!==xn&&z.nodeId!==xn),Nn=g(z.content),Mn="boolean"==typeof mn?mn:Nn,Bn=Nn,Cn=Mn&&Nn,En=Cn?x(z.content):z.content,An=Cn?z.content:void 0,On=(null===(k=z.displayContent)||void 0===k||k||Nn)&&h(z.content),jn=!Fn&&!On,Wn=z.title;Fn||(Wn=On?"No Title Found":"No Matching Section Found");var Tn=z.evaluationResult;if(!Tn&&"right"===L)if(en){var Dn=null===(N=z.refIndexes)||void 0===N?void 0:N[0],Pn=rn.find(function(n){return n.selfIndex===Dn});Tn=null==Pn?void 0:Pn.evaluationResult}else Tn=null===(M=rn[G])||void 0===M?void 0:M.evaluationResult;var Kn=null===(B=null==dn?void 0:dn.input_index_map)||void 0===B?void 0:B[0],zn=null===(C=null==dn?void 0:dn.input_index_map)||void 0===C?void 0:C[1],Gn="left"===L?zn:Kn,Ln=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||l.nodeId===e||l.contentId===e)return l;if(null===(i=l.subsections)||void 0===i?void 0:i.length){var d=Ln(l.subsections,e);if(d)return d}}return null},Xn="left"===L?z:Ln(rn,z.id),Hn="right"===L?z:Ln(un,z.id),Vn=o.useMemo(function(){if(!en)return 0;var n=1/0,e=function(n){var e=g(n)?x(n):n;return S(e||"").replace(/\\n/g,"\n")},i=function(o,t,l,d){if(o){var r=o.nodeId||o.id;if(d&&"right"===L){var u=rn.filter(function(n){var e;return null===(e=n.refIndexes)||void 0===e?void 0:e.includes(o.selfIndex)});u.length>0&&(r=u[0].nodeId||u[0].id)}var a=o.nodeId||o.id||(null==t?void 0:t.nodeId)||(null==t?void 0:t.id)||(null==l?void 0:l.nodeId)||(null==l?void 0:l.id),c=o.evaluationResult||(null==t?void 0:t.evaluationResult)||(null==l?void 0:l.evaluationResult),s=(null==c?void 0:c.deviations)||{};Object.keys(s).forEach(function(i){var d,u=null===(d=s[i])||void 0===d?void 0:d[U];if(function(n,i){if("string"!=typeof i||y(i))return!1;var o=e(null==n?void 0:n.content),t=e(i);return!!t&&o.includes(t)}("left"===L?t||o:l||o,u)){var c="".concat(r).concat(w).concat(i),v=null==an?void 0:an[c];null!=v&&v<n&&(n=v);var f="".concat(a).concat(w).concat(i),p=null==an?void 0:an[f];null!=p&&p<n&&(n=p)}});for(var v=o.subsections||[],f=(null==t?void 0:t.subsections)||[],p=(null==l?void 0:l.subsections)||[],h=Math.max(v.length,f.length,p.length),g=0;g<h;g++)i(v[g],f[g],p[g],!1)}},o="right"===L?rn.filter(function(n){var e;return null===(e=n.refIndexes)||void 0===e?void 0:e.includes(z.selfIndex)}):[];if(1===o.length){var t=o[0];(t.refIndexes||[]).map(function(n){return un.find(function(e){return e.selfIndex===n})}).filter(Boolean).forEach(function(n){i(n,t,n,!0)})}else i(z,Xn,Hn,!0);return n!==1/0?n-1:0},[z,Xn,Hn,L,U,an,en,rn,un]);if(en)if("left"===L){var Yn=null===(E=z.refIndexes)||void 0===E?void 0:E[0],qn=un.findIndex(function(n){return n.selfIndex===Yn});Hn=-1!==qn?un[qn]:Ln(un,z.id)}else{var Jn=null===(A=z.refIndexes)||void 0===A?void 0:A[0],Qn=rn.findIndex(function(n){return n.selfIndex===Jn});Xn=-1!==Qn?rn[Qn]:Ln(rn,z.id)}var Un="left"===L?!Hn:!Xn,Zn=en&&"right"===L&&m(z,rn),$n=Tn||(null==Xn?void 0:Xn.evaluationResult)||(null==Hn?void 0:Hn.evaluationResult),ne=null!==(W=null===(j=null===(O=null==$n?void 0:$n.evaluation_outputs)||void 0===O?void 0:O.metadata)||void 0===j?void 0:j.label_color)&&void 0!==W?W:R,ee=I(ne).highlightBg,ie=(null==$n?void 0:$n.deviations)||{},oe=z.nodeId||z.id;if(en&&"left"!==L){var te=rn.filter(function(n){var e;return null===(e=n.refIndexes)||void 0===e?void 0:e.includes(z.selfIndex)});te.length>0?oe=te[0].nodeId||te[0].id:(null==Xn?void 0:Xn.id)&&(oe=Xn.nodeId||Xn.id)}var le=o.useMemo(function(){var n,e=new Map;if(!en||"right"!==L)return e;var i=1,o=rn.filter(function(n){var e;return null===(e=n.refIndexes)||void 0===e?void 0:e.includes(z.selfIndex)}),t=1===o.length&&1===(null===(n=o[0].refIndexes)||void 0===n?void 0:n.length),l=function(n){return S(n||"").replace(/\\n/g,"\n")},d=function(n,e){var i=e?o[0]:Ln(rn,n.nodeId||n.id||n.contentId);return{lhsNode:i,evalResult:n.evaluationResult||(null==i?void 0:i.evaluationResult),registryNodeId:i?i.nodeId||i.id:n.nodeId||n.id}};if(t){var r=function(n,e){if(void 0===e&&(e=!1),n){var o=d(n,e),t=o.lhsNode,u=o.evalResult,a=o.registryNodeId,c=l(n.content);Object.entries((null==u?void 0:u.deviations)||{}).forEach(function(n){var e=n[0],o=n[1],d=o[U],r=l(d);if(!!t&&!y(o[Gn])&&r&&c.includes(r)){var u="".concat(a).concat(w).concat(e),s=an[u];null!=s&&(i=Math.max(i,Math.max(1,s-(Vn||0))+1))}}),(n.subsections||[]).forEach(function(n){return r(n)})}};r(z,!0)}var u=function(n,o){if(void 0===o&&(o=!1),n){var t=d(n,o),r=t.lhsNode,a=t.evalResult,c=t.registryNodeId,s=(null==a?void 0:a.deviations)||{},v=l(n.content);Object.entries(s).map(function(n){var e,i=n[0],o=n[1],t=o[U],d=!r||y(o[Gn]),u=l(t),a=u?v.indexOf(u):-1,s="".concat(c).concat(w).concat(i);return{refId:s,isRenderable:d&&!!u&&!y(t),position:a,registryIndex:null!==(e=an[s])&&void 0!==e?e:Number.MAX_SAFE_INTEGER}}).filter(function(n){return n.isRenderable}).sort(function(n,e){return(-1===n.position?Number.MAX_SAFE_INTEGER:n.position)-(-1===e.position?Number.MAX_SAFE_INTEGER:e.position)||n.registryIndex-e.registryIndex}).forEach(function(n){e.set(n.refId,i++)}),(n.subsections||[]).forEach(function(n){return u(n)})}};return u(z,!0),e},[en,L,z,rn,U,Gn,an,Vn]),de=Object.keys(ie)[0],re=de?"".concat(oe).concat(w).concat(de):null,ue=re?null==cn?void 0:cn[re]:null,ae=G+1;if(en&&Sn){var ce="left"===L?Sn.leftNums.get(null==z?void 0:z.id):Sn.rightNums.get(null==z?void 0:z.id);Un&&void 0!==ce?ae=ce:null!=ue&&ue>=0?ae=ue:void 0!==ce&&(ae=ce)}else null!=ue&&ue>=0&&(ae=ue);var se=Object.entries(ie).map(function(n){var e=n[0],i=n[1],o="".concat(oe).concat(w).concat(e);return{deviationKey:e,deviationMap:i,refId:o,currentIndex:an[o]}}).filter(function(n){return void 0!==n.currentIndex&&null!==n.currentIndex});se.sort(function(n,e){return n.currentIndex-e.currentIndex});var ve,fe,pe=se.map(function(e){var i,o,t,l,d,r,u=e.deviationKey,a=e.deviationMap,c=e.refId,s=e.currentIndex,v=a[U],f=y(v);if(f)v="";else if(!v)return null;var p=G,h=G;if(en)if("left"===L){var g=null===(i=z.refIndexes)||void 0===i?void 0:i[0],x=un.findIndex(function(n){return n.selfIndex===g});if(-1!==x)h=x;else{var m=un.findIndex(function(n){return n.id===z.id||n.nodeId===z.nodeId||n.contentId===z.contentId});h=-1!==m?m:G}}else{var S=null===(o=z.refIndexes)||void 0===o?void 0:o[0],R=rn.findIndex(function(n){return n.selfIndex===S});if(-1!==R)p=R;else p=-1!==(E=rn.findIndex(function(n){return n.id===z.id||n.nodeId===z.nodeId||n.contentId===z.contentId}))?E:G}var _="".concat(oe).concat(w).concat(u).concat(w).concat(p).concat(w).concat(h),F=a[Gn],k=Un||y(F),N=le.get(c);en&&"right"===L&&k&&void 0!==N?s=N:en&&void 0!==Vn&&("right"!==L||k||Zn)&&(s-=Vn),s=Math.max(1,s);var M=en&&"right"===L&&k&&Sn?b({section:z,proposedSections:rn,leftNums:Sn.leftNums,fallbackNumber:String(ae),firstOnly:!0}):ae,B="".concat(M,".").concat(s),C=G;if("right"===L&&en){var E,A=null===(t=z.refIndexes)||void 0===t?void 0:t[0],O=rn.findIndex(function(n){return n.selfIndex===A});if(-1!==O)C=O;else-1!==(E=rn.findIndex(function(n){return n.id===z.id||n.nodeId===z.nodeId||n.contentId===z.contentId}))&&(C=E)}var j=fn?fn(C):null,W=(null==a?void 0:a.evaluation_outputs)||(null==$n?void 0:$n.evaluation_outputs),T=null!==(l=null==W?void 0:W.output_value)&&void 0!==l?l:null,D=null!==(r=null===(d=null==W?void 0:W.metadata)||void 0===d?void 0:d.label_color)&&void 0!==r?r:ne,P=I(D),K=j?n(n({},j),{badgeBg:P.badgeBg,badgeBorder:P.badgeBorder,badgeText:P.badgeText}):n({},P),X=(null==a?void 0:a.deviation_summary)?{deviation_summary:a.deviation_summary,deviation_title:(null==a?void 0:a.deviation_title)||(null==$n?void 0:$n.deviation_title),deviation_impact:(null==a?void 0:a.deviation_impact)||(null==$n?void 0:$n.deviation_impact),deviation_explanation:(null==a?void 0:a.deviation_explanation)||(null==$n?void 0:$n.deviation_explanation),evaluation_outputs:W,cognitive_decisioning:(null==a?void 0:a.cognitive_decisioning)||(null==$n?void 0:$n.cognitive_decisioning)}:null,H=0,V=En||"";if(v&&V){var Y=V.split(/\n{2,}/),q=Y.findIndex(function(n){return n.includes(v)});if(-1!==q){var J=Object.entries(ie).filter(function(n){n[0];var e=n[1][U];return e&&Y[q].includes(e)}).sort(function(n,e){return Y[q].indexOf(n[1][U])-Y[q].indexOf(e[1][U])}),Q=J.filter(function(n){n[0];var e=n[1][U];return e&&(e.includes(v)||v.includes(e))});Q.length>1&&(H=Math.max(0,Q.findIndex(function(n){return n[0]===u})))}}var Z=sn(L,c);return{id:c,actionId:_,label:B,highlight:v,side:L,style:K,stackIndex:H,score:T,isConnected:null==pn?void 0:pn.has(_),showScrollLockToggle:(null==pn?void 0:pn.has(_))||In&&yn===_||!!Rn&&Rn===Z.current,scrollSyncLocked:bn,toggleScrollSyncLocked:wn,isOrphan:k,isMissingClause:f,badgeRef:Z,onClick:function(n){n.stopPropagation(),hn&&hn(n,Xn||{id:"orphan-left",title:"",content:""},k,Hn||{id:"orphan-right",title:"",content:""},_,K)},onSummaryClick:function(n){n.stopPropagation(),vn(n,_,k,X)}}}).filter(Boolean),he=tn||!Mn&&kn?pe:[],ge=pe.map(function(n){return n.highlight}).filter(Boolean),xe=z.id&&L===(null==J?void 0:J.columnKey)?J:null,me=o.useRef(!1);return t(function(){Y||(me.current=!1)},[Y]),e(l,n({ref:X,sx:{mb:V,width:"100%",display:"flex",flexDirection:"column",position:"relative",minWidth:0}},{children:[Y&&(null==xe?void 0:xe.showAbove)&&i("div",n({style:{position:"sticky",top:0,height:"0px",cursor:"pointer"},onClick:function(){var n,e;return null===(e=null===(n=null==xe?void 0:xe.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"===L?"+":"-"," 130px))"),position:"absolute",paddingTop:"20px"},"left"===L?{right:"-20px"}:{left:"-20px"})},{children:i(s,{color:(null===(T=null==xe?void 0:xe.showAboveRef)||void 0===T?void 0:T.current)?window.getComputedStyle(xe.showAboveRef.current).color:void 0})}))})),e(d,n({disableGutters:!0,expanded:!jn&&Y,onChange:function(){jn||(q(),$.current=z.id)},sx:{boxShadow:"none",border:jn?"1px dashed #E2E8F0":"1px solid #E2E8F0",bgcolor:jn?"#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:jn?null:i(v,{size:16}),sx:{minHeight:"36px",flexShrink:0,cursor:jn?"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:Fn&&i(u,n({title:Wn,placement:"top"},{children:i(a,n({component:"div",sx:{fontSize:"12px",color:jn?"#94A3B8":"#19213D",fontWeight:jn?400:700,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0}},{children:(ve=Wn,fe="left"===L&&(null!==(P=null===(D=null==z?void 0:z.refContentIds)||void 0===D?void 0:D.length)&&void 0!==P?P:1)>1,void 0===fe&&(fe=!1),ve?S(ve).replace(/\\n/g,"\n").split(/(\*\*.*?\*\*)/g).map(function(o,t){return o.startsWith("**")&&o.endsWith("**")?i("strong",{children:o.slice(2,-2)},t):e("div",n({style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"8px",width:"100%"}},{children:[i("span",{children:o}),fe&&i("span",n({style:{display:"inline-flex",alignItems:"center",justifyContent:"center",padding:"0px 6px",borderRadius:"9999px",background:"#F3F4F6",border:"1px solid #D1D5DB",color:"#6B7280",fontSize:"9px",fontWeight:500,whiteSpace:"nowrap",lineHeight:1.4,marginRight:"4px"}},{children:"Multiple"}))]}),t)}):null)}))}))})),!jn&&e(c,n({sx:{pt:0,pb:1.25,bgcolor:"#FFFFFF",flex:1,display:"flex",flexDirection:"column",minWidth:0}},{children:[On&&i(f,{content:En,overlayContent:An,sxStyles:nn,highlights:ge,maintainRelativeOrder:en,highlightBg:ee,suppressHighlightBg:Bn,deviationBadges:he,collisionKey:_n}),(z.subsections||[]).map(function(n,e){return ln({section:n,keyPath:"".concat(G,"-").concat(e),depth:0,columnKey:L,parentNodeId:U,sectionOffset:Vn,rhsOrphanVisualIndexes:le})})]}))]})),Y&&(null==xe?void 0:xe.showBelow)&&i("div",n({style:{position:"sticky",bottom:0,height:"0px",cursor:"pointer"},onClick:function(){var n,e;return null===(e=null===(n=null==xe?void 0:xe.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"===L?"+":"-"," 130px))"),position:"absolute",paddingBottom:"20px"},"left"===L?{right:"-20px"}:{left:"-20px"})},{children:i(v,{color:(null===(K=null==xe?void 0:xe.showBelowRef)||void 0===K?void 0:K.current)?window.getComputedStyle(xe.showBelowRef.current).color:void 0})}))}))]}),"".concat(L,"-sec-").concat(G))};export{_ 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,{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 I,b,_,k,C,P,w,B,F,O,R=t.section,N=t.keyPath,M=t.depth,j=void 0===M?0:M,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===(I=R.displayTitle)||void 0===I||I)&&f(R.title),Sn=!(!pn||!hn||"left"!==K||R.id!==hn&&R.nodeId!==hn),In=p(R.content),bn="boolean"==typeof mn?mn:In,_n=In,kn=bn&&In,Cn=kn?h(R.content):R.content,Pn=kn?R.content:void 0,wn=(null===(b=R.displayContent)||void 0===b||b||In)&&f(R.content),Bn=!yn&&!wn,Fn=yn?R.title:wn?"No Title Found":"No Matching Section Found",On=!!D[N],Rn=ln(K,N),Nn=N.split("-").map(Number)[0],Mn=q[Nn],jn=J[Nn],En=Nn,Kn=Nn,Wn=!1,Ln=function(n,i,e){if(!n||!i)return null;if(n.id===i||n.nodeId===i||n.contentId===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||n.section.nodeId===i||n.section.contentId===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===(_=null==Mn?void 0:Mn.refIndexes)||void 0===_?void 0:_[0],An=J.findIndex(function(n){return n.selfIndex===zn});-1!==An?(jn=J[An],Kn=An):Wn=!0}else{var Dn=null===(k=null==jn?void 0:jn.refIndexes)||void 0===k?void 0:k[0],Hn=q.findIndex(function(n){return n.selfIndex===Dn});-1!==Hn?(Mn=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=R,qn=N,(Qn=Ln(jn,R.nodeId||R.id,String(Kn)))||(Qn=Tn(J,R.nodeId||R.id)),Un=(null==Qn?void 0:Qn.section)||null,Jn=(null==Qn?void 0:Qn.keyPath)||""):(Un=R,Jn=N,(Vn=Ln(Mn,R.nodeId||R.id,String(En)))||(Vn=Tn(q,R.nodeId||R.id)),Gn=(null==Vn?void 0:Vn.section)||null,qn=(null==Vn?void 0:Vn.keyPath)||"");else if("left"===K){Gn=R,qn=N;var Qn=Tn(J,R.nodeId||R.id);Un=(null==Qn?void 0:Qn.section)||null,Jn=(null==Qn?void 0:Qn.keyPath)||""}else{Un=R,Jn=N;var Vn=Tn(q,R.nodeId||R.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=R.evaluationResult||(null==Gn?void 0:Gn.evaluationResult)||(null==Un?void 0:Un.evaluationResult),ei=(null==ii?void 0:ii.deviations)||{},ti=R.nodeId||R.id||(null==Gn?void 0:Gn.nodeId)||(null==Gn?void 0:Gn.id)||(null==Un?void 0:Un.nodeId)||(null==Un?void 0:Un.id);T&&"left"!==K&&(null==Gn?void 0:Gn.id)&&(ti=Gn.nodeId||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==Mn?void 0:Mn.id):gn.rightNums.get(null==jn?void 0:jn.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),a=Math.max(1,a);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,I=m(S),b=n({},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 O=rn(K,r);return{id:r,actionId:p,label:f,highlight:u,side:K,style:b,stackIndex:k,score:y,isConnected:Y.has(p),showScrollLockToggle:Y.has(p)||$&&Z===p||!!tn&&tn===O.current,scrollSyncLocked:nn,toggleScrollSyncLocked:en,isOrphan:v,isMissingClause:c,badgeRef:O,onClick:function(i){i.stopPropagation();var e=Gn?n(n({},Gn),{title:(null==Mn?void 0:Mn.title)||(null==Gn?void 0:Gn.title)||""}):{id:"orphan-left",title:"",content:""},t=Un?n(n({},Un),{title:(null==jn?void 0:jn.title)||(null==Un?void 0:Un.title)||""}):{id:"orphan-right",title:"",content:""};an(i,e,v,t,p,b)},onSummaryClick:function(n){n.stopPropagation(),un(n,p,v,_)}}}).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||!bn&&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||R.subsections&&0!==R.subsections.length))return null;var xi=(null===(O=null==mi?void 0:mi.style)||void 0===O?void 0:O.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:Rn,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&&On,onChange:function(){if(!Bn){if(On){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:_n,highlights:hi,collisionKey:xn}),(R.subsections||[]).map(function(n,e){return i(S,{section:n,keyPath:"".concat(N,"-").concat(e),depth:j+1,columnKey:K,parentNodeId:L,sectionOffset:z},"".concat(N,"-").concat(e))})]}))]}))}))}):n({ref:Rn,sx:{mt:0===j?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:_n,highlights:hi,collisionKey:xn}),(R.subsections||[]).map(function(n,e){return i(S,{section:n,keyPath:"".concat(N,"-").concat(e),depth:j+1,columnKey:K,parentNodeId:L,sectionOffset:z},"".concat(N,"-").concat(e))})]}))}))});export{S as default};
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,hasSingleMappedLhsSection as m,generateColorPalette as g,safeStringify as x,isMissingStr as y,getRhsMappedSectionNumber as S,DEVIATION_BADGE_SEPARATOR as I}from"../CognitiveComparehelpers.js";import{DEFAULT_DEVIAION_COLOR as b}from"../CognitiveCompareConstants.js";var _=t.memo(function(t){var k,w,C,F,O,P,N,B,R,E,M=t.section,j=t.keyPath,A=t.depth,K=void 0===A?0:A,W=t.columnKey,L=void 0===W?"left":W,T=t.parentNodeId,z=void 0===T?"":T,D=t.sectionOffset,G=t.rhsOrphanVisualIndexes,H=v(),V=H.expandedSubSections,X=H.setExpandedSubSections,U=H.maintainRelativeOrder,q=H.showDeviationBadges,J=void 0!==q&&q,Q=H.proposedSections,Y=H.existingSections,Z=H.treeData,$=H.deviationNumberRegistry,nn=H.deviationParentRegistry,en=H.connectedSections,tn=H.activeSideBySideSection,on=H.isSideBySide,ln=H.scrollSyncLocked,dn=H.toggleScrollSyncLocked,rn=H.summaryPopupAnchorEl,an=H.resolvedMarkdownStyles,un=H.getSubSectionRef,cn=H.getSubSectionCompareStyle,sn=H.getBadgeRef,vn=H.openMoreFunctionsPopup,fn=H.openSummaryPopup,pn=H.resetSideBySide,hn=H.setConnectedSections,mn=H.setConnectedLines,gn=H.cachedConnectedPositions,xn=H.isProposingFix,yn=H.proposingFixNodeId,Sn=H.isRedlineFlow,In=H.unifiedNumbering,bn=null!=tn?tn:"",_n=(null===(k=M.displayTitle)||void 0===k||k)&&f(M.title),kn=!(!xn||!yn||"left"!==L||M.id!==yn&&M.nodeId!==yn),wn=p(M.content),Cn="boolean"==typeof Sn?Sn:wn,Fn=wn,On=Cn&&wn,Pn=On?h(M.content):M.content,Nn=On?M.content:void 0,Bn=(null===(w=M.displayContent)||void 0===w||w||wn)&&f(M.content),Rn=!_n&&!Bn,En=_n?M.title:Bn?"No Title Found":"No Matching Section Found",Mn=!!V[j],jn=un(L,j),An=j.split("-").map(Number)[0],Kn=Q[An],Wn=Y[An],Ln=An,Tn=An,zn=!1,Dn=function(n,i,e){if(!n||!i)return null;if(n.id===i||n.nodeId===i||n.contentId===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||n.section.nodeId===i||n.section.contentId===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(U)if("left"===L){var Gn=null===(C=null==Kn?void 0:Kn.refIndexes)||void 0===C?void 0:C[0],Hn=Y.findIndex(function(n){return n.selfIndex===Gn});-1!==Hn?(Wn=Y[Hn],Tn=Hn):zn=!0}else{var Vn=null===(F=null==Wn?void 0:Wn.refIndexes)||void 0===F?void 0:F[0],Xn=Q.findIndex(function(n){return n.selfIndex===Vn});-1!==Xn?(Kn=Q[Xn],Ln=Xn):zn=!0}var Un=function(n,i){if(!i||!n)return null;for(var e=0;e<n.length;e++){var t=Dn(n[e],i,String(e));if(t)return t}return null},qn=null,Jn=null,Qn="",Yn="";if(U)"left"===L?(qn=M,Qn=j,(Zn=Dn(Wn,M.nodeId||M.id,String(Tn)))||(Zn=Un(Y,M.nodeId||M.id)),Jn=(null==Zn?void 0:Zn.section)||null,Yn=(null==Zn?void 0:Zn.keyPath)||""):(Jn=M,Yn=j,($n=Dn(Kn,M.nodeId||M.id,String(Ln)))||($n=Un(Q,M.nodeId||M.id)),qn=(null==$n?void 0:$n.section)||null,Qn=(null==$n?void 0:$n.keyPath)||"");else if("left"===L){qn=M,Qn=j;var Zn=Un(Y,M.nodeId||M.id);Jn=(null==Zn?void 0:Zn.section)||null,Yn=(null==Zn?void 0:Zn.keyPath)||""}else{Jn=M,Yn=j;var $n=Un(Q,M.nodeId||M.id);qn=(null==$n?void 0:$n.section)||null,Qn=(null==$n?void 0:$n.keyPath)||""}var ni=(Qn?cn(Qn):null)||cn(j),ii=null===(O=null==Z?void 0:Z.input_index_map)||void 0===O?void 0:O[0],ei=null===(P=null==Z?void 0:Z.input_index_map)||void 0===P?void 0:P[1],ti="left"===L?ei:ii,oi="left"===L?!Jn:!qn,li=U&&"right"===L&&m(Wn,Q),di=M.evaluationResult||(null==qn?void 0:qn.evaluationResult)||(null==Jn?void 0:Jn.evaluationResult),ri=(null==di?void 0:di.deviations)||{},ai=M.nodeId||M.id||(null==qn?void 0:qn.nodeId)||(null==qn?void 0:qn.id)||(null==Jn?void 0:Jn.nodeId)||(null==Jn?void 0:Jn.id);U&&"left"!==L&&(null==qn?void 0:qn.id)&&(ai=qn.nodeId||qn.id);var ui=Object.keys(ri)[0],ci=ui?"".concat(ai).concat(I).concat(ui):null,si=ci?null==nn?void 0:nn[ci]:null,vi=An+1;if(U&&In){var fi="left"===L?In.leftNums.get(null==Kn?void 0:Kn.id):In.rightNums.get(null==Wn?void 0:Wn.id);zn&&void 0!==fi?vi=fi:null!=si&&si>=0?vi=si:void 0!==fi&&(vi=fi)}else null!=si&&si>=0&&(vi=si);var pi=null!==(R=null===(B=null===(N=null==di?void 0:di.evaluation_outputs)||void 0===N?void 0:N.metadata)||void 0===B?void 0:B.label_color)&&void 0!==R?R:b,hi=g(pi).highlightBg,mi=Object.entries(ri).map(function(n){var i=n[0],e=n[1],t="".concat(ai).concat(I).concat(i);return{deviationKey:i,deviationMap:e,refId:t,currentIndex:$[t]}}).filter(function(n){return void 0!==n.currentIndex&&null!==n.currentIndex});mi.sort(function(n,i){return n.currentIndex-i.currentIndex});var gi=new Map;if(!G&&U&&"right"===L){var xi=x(Pn||"").replace(/\\n/g,"\n");mi.filter(function(n){var i=n.deviationMap,e=i[z];return(oi||y(i[ti]))&&!!e&&!y(e)}).map(function(i){var e=x(i.deviationMap[z]||"").replace(/\\n/g,"\n"),t=e?xi.indexOf(e):-1;return n(n({},i),{position:t})}).sort(function(n,i){return(-1===n.position?Number.MAX_SAFE_INTEGER:n.position)-(-1===i.position?Number.MAX_SAFE_INTEGER:i.position)||n.currentIndex-i.currentIndex}).forEach(function(n,i){gi.set(n.refId,i+1)})}var yi=mi.map(function(i){var e,t,o,l,d=i.deviationKey,r=i.deviationMap,a=i.refId,u=i.currentIndex,c=r[z],s=y(c);if(s)c="";else if(!c)return null;var v=r[ti],f=oi||y(v),p=null!==(e=null==G?void 0:G.get(a))&&void 0!==e?e:gi.get(a);U&&"right"===L&&f&&void 0!==p?u=p:U&&void 0!==D&&("right"!==L||f||li)&&(u-=D),u=Math.max(1,u);var h=U&&"right"===L&&f&&In?S({section:Wn,proposedSections:Q,leftNums:In.leftNums,fallbackNumber:String(vi),firstOnly:!0}):vi,m="".concat(h,".").concat(u),x="".concat(ai).concat(I).concat(d).concat(I).concat(Qn).concat(I).concat(Yn),b=(null==r?void 0:r.evaluation_outputs)||(null==di?void 0:di.evaluation_outputs),_=null!==(t=null==b?void 0:b.output_value)&&void 0!==t?t:null,k=null!==(l=null===(o=null==b?void 0:b.metadata)||void 0===o?void 0:o.label_color)&&void 0!==l?l:pi,w=g(k),C=n({},w),F=(null==r?void 0:r.deviation_summary)?{deviation_summary:r.deviation_summary||(null==di?void 0:di.deviation_summary),deviation_title:(null==r?void 0:r.deviation_title)||(null==di?void 0:di.deviation_title),deviation_impact:(null==r?void 0:r.deviation_impact)||(null==di?void 0:di.deviation_impact),deviation_explanation:(null==r?void 0:r.deviation_explanation)||(null==di?void 0:di.deviation_explanation),evaluation_outputs:b,cognitive_decisioning:(null==r?void 0:r.cognitive_decisioning)||(null==di?void 0:di.cognitive_decisioning)}:null,O=0,P=Pn||"";if(c&&P){var N=P.split(/\n{2,}/),B=N.findIndex(function(n){return n.includes(c)});if(-1!==B){var R=Object.entries(ri).filter(function(n){n[0];var i=n[1][z];return i&&N[B].includes(i)}).sort(function(n,i){return N[B].indexOf(n[1][z])-N[B].indexOf(i[1][z])}),E=R.filter(function(n){n[0];var i=n[1][z];return i&&(i.includes(c)||c.includes(i))});E.length>1&&(O=Math.max(0,E.findIndex(function(n){return n[0]===d})))}}var M=sn(L,a);return{id:a,actionId:x,label:m,highlight:c,side:L,style:C,stackIndex:O,score:_,isConnected:en.has(x),showScrollLockToggle:en.has(x)||on&&tn===x||!!rn&&rn===M.current,scrollSyncLocked:ln,toggleScrollSyncLocked:dn,isOrphan:f,isMissingClause:s,badgeRef:M,onClick:function(i){i.stopPropagation();var e=qn?n(n({},qn),{title:(null==Kn?void 0:Kn.title)||(null==qn?void 0:qn.title)||""}):{id:"orphan-left",title:"",content:""},t=Jn?n(n({},Jn),{title:(null==Wn?void 0:Wn.title)||(null==Jn?void 0:Jn.title)||""}):{id:"orphan-right",title:"",content:""};vn(i,e,f,t,x,C)},onSummaryClick:function(n){n.stopPropagation(),fn(n,x,f,F)}}}).filter(Boolean).sort(function(n,i){return parseFloat(n.label)-parseFloat(i.label)}),Si=o(function(){var n=new Set;return yi.filter(function(i){return!n.has(i.id)&&(n.add(i.id),!0)})},[yi]),Ii=J||!Cn&&kn?Si:[],bi=Si.map(function(n){return n.highlight}).filter(Boolean),_i=yi.find(function(n){return en.has(n.actionId)}),ki=!!_i;if(!(_n||Bn||M.subsections&&0!==M.subsections.length))return null;var wi=(null===(E=null==_i?void 0:_i.style)||void 0===E?void 0:E.badgeBorder)||(null==ni?void 0:ni.badgeBorder),Ci=ki&&wi?{borderRadius:"4px",outline:"2px solid ".concat(wi),outlineOffset:"1px"}:{};return i(l,_n?n({ref:jn,sx:{mt:1,width:"100%",minWidth:0,position:"relative"}},{children:i(l,n({sx:n({width:"100%"},Ci)},{children:e(d,n({disableGutters:!0,expanded:!Rn&&Mn,onChange:function(){if(!Rn){if(Mn){var i=String(tn||""),e=i.includes(Qn)||i.includes(Yn);e||en.forEach(function(n){(String(n).includes(Qn)||String(n).includes(Yn))&&(e=!0)}),e&&(pn(),hn(new Set),mn([]),gn.current=[])}X(function(i){var e;return n(n({},i),((e={})[j]=!i[j],e))})}},sx:{mt:0,boxShadow:"none",border:Rn?"1px dashed #E2E8F0":"1px solid #EEF2F7",borderRadius:"4px !important",bgcolor:"#FFFFFF",minWidth:0,"&:before":{display:"none"}}},{children:[i(r,n({expandIcon:Rn?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:Rn?"#94A3B8":"#19213D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0}},{children:En||"Untitled Subsection"}))})),!Rn&&e(u,n({sx:{pt:0,pb:1,minWidth:0}},{children:[Bn&&i(s,{content:Pn,overlayContent:Nn,sxStyles:an,deviationBadges:Ii,maintainRelativeOrder:U,highlightBg:hi,suppressHighlightBg:Fn,highlights:bi,collisionKey:bn}),(M.subsections||[]).map(function(n,e){return i(_,{section:n,keyPath:"".concat(j,"-").concat(e),depth:K+1,columnKey:L,parentNodeId:z,sectionOffset:D,rhsOrphanVisualIndexes:G},"".concat(j,"-").concat(e))})]}))]}))}))}):n({ref:jn,sx:{mt:0===K?1:.75,width:"100%",minWidth:0,position:"relative"}},{children:!Rn&&e(l,n({sx:n({width:"100%"},Ci)},{children:[Bn&&i(s,{content:Pn,overlayContent:Nn,sxStyles:an,deviationBadges:Ii,maintainRelativeOrder:U,highlightBg:hi,suppressHighlightBg:Fn,highlights:bi,collisionKey:bn}),(M.subsections||[]).map(function(n,e){return i(_,{section:n,keyPath:"".concat(j,"-").concat(e),depth:K+1,columnKey:L,parentNodeId:z,sectionOffset:D,rhsOrphanVisualIndexes:G},"".concat(j,"-").concat(e))})]}))}))});export{_ as default};
2
2
  //# sourceMappingURL=SubSectionAccordion.js.map
@@ -1,2 +1,2 @@
1
- import{__assign as e}from"tslib";import{jsxs as t,jsx as i}from"react/jsx-runtime";import{ChevronDown as n}from"lucide-react";import{ButtonCognitiveIcon as o}from"../../../assests/svg/ButtonCognitiveIcon.js";import{getBentArrowPath as l,DEVIATION_BADGE_SEPARATOR as s}from"../CognitiveComparehelpers.js";import{DEFAULT_DEVIAION_COLOR as r}from"../CognitiveCompareConstants.js";import a from"./ThreeDotsLoader.js";import d from"./connectedLines.js";import{Box as c}from"@mui/material";function u(u){var g=u.svgContainerRef,p=u.svgDimensions,v=u.isResizing,h=u.overallConnector,y=u.rootDeviationStyle,f=u.lines,m=u.isSideBySide,x=u.activeSideBySideSection,b=u.isArrowVisible,S=u.maintainRelativeOrder,C=u.proposedSections,I=u.existingSections,w=u.cognitivePopup,B=u.activeBadgeId,P=u.closeCognitivePopup,R=u.setActiveBadgeId,j=u.openCognitivePopupFromState,D=u.buildSectionPopupState,k=u.connectedLines,K=u.pathRefs;return t("svg",e({ref:g,style:{position:"absolute",top:0,left:0,width:p.width||"100%",height:p.height||"100%",pointerEvents:"none",zIndex:10,overflow:"visible",opacity:v?0:1,transition:"opacity 0.15s ease-in-out"}},{children:[h&&i("g",{children:i("line",{x1:h.x1,y1:h.y,x2:h.x2,y2:h.y,stroke:y.badgeBorder,strokeWidth:"1.5"})}),f.map(function(d){var u,g,p,v,h,y,f,k=d.x1+.5*(d.x2-d.x1),K=(d.y1+d.y2)/2;if("Not Defined"===d.style.label&&!d.hasCognitive)return null;if(d.isSubSection?m&&x===d.subSectionKeyPath&&b:m&&x===d.sectionIdx&&b)return null;if(S)return null;var L=d.isSubSection?l(d.x1,d.y1,d.x2,d.y2):"M ".concat(d.x1," ").concat(d.y1," L ").concat(d.x2," ").concat(d.y2),T=C[d.sectionIdx]||{title:"",content:""},z=I[null!==(u=d.targetRightIdx)&&void 0!==u?u:d.sectionIdx]||{title:"",content:""};if(d.isSubSection&&d.subSectionKeyPath){var E=d.subSectionKeyPath.includes(s)?d.subSectionKeyPath.split(s):[],A=E[2]||d.subSectionKeyPath,N=E[3]||A,O=A.split("-").map(Number),W=N.split("-").map(Number),F=null,M=null;O.length>0&&(F=C[O[0]]||null),W.length>0&&(M=I[W[0]]||null);for(var _=(null==F?void 0:F.title)||"",V=(null==M?void 0:M.title)||"",q=1;q<O.length;q+=1)(null==F?void 0:F.subsections)&&(F=F.subsections[O[q]]||null);for(q=1;q<W.length;q+=1)(null==M?void 0:M.subsections)&&(M=M.subsections[W[q]]||null);F&&(T=e(e({},F),{title:_||F.title})),M&&(z=e(e({},M),{title:V||M.title}))}var G=!(null===(g=T.cognitiveData)||void 0===g?void 0:g.isMissingRationale)||Boolean(null===(v=null===(p=T.cognitiveData)||void 0===p?void 0:p.decisioning)||void 0===v?void 0:v.length),H=(null===(f=null===(y=null===(h=T.evaluationResult)||void 0===h?void 0:h.cognitive_decisioning)||void 0===y?void 0:y.decisioning_factors)||void 0===f?void 0:f.length)||!1,J=G||H;return t("g",{children:[i("path",{d:L,fill:"none",stroke:d.style.badgeBorder||"#E2E8F0",strokeWidth:"1.5"}),i("foreignObject",e({x:k-100,y:K-14,width:"200",height:"28",style:{pointerEvents:"auto",overflow:"visible"}},{children:i(c,e({sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},{children:t(c,e({onClick:function(e){e.stopPropagation(),J&&(w.open&&B===d.id?P():(R(d.id),j(D(e.currentTarget,T,z,d.sectionIdx,!1,d.style))))},sx:{display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",bgcolor:d.style.badgeBg,color:d.style.badgeText,border:"1px solid ".concat(d.style.badgeBorder),borderRadius:"12px",px:1.5,py:.5,fontWeight:600,textAlign:"center",whiteSpace:"nowrap",cursor:J?"pointer":"default"}},{children:[d.style.badgeText===r&&null==d.style.label?i(a,{color:d.style.badgeText}):null==d.style.label?null:"0"===String(d.style.label)?"Same":d.style.label,i(c,e({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:i(o,{})})),J&&i(n,{size:11,style:{transform:w.open&&B===d.id?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))}))]},d.id)}),i(d,{maintainRelativeOrder:S,connectedLines:k,pathRefs:K})]}))}export{u as default};
1
+ import{__assign as e}from"tslib";import{jsxs as t,jsx as i}from"react/jsx-runtime";import{ChevronDown as n}from"lucide-react";import{ButtonCognitiveIcon as o}from"../../../assests/svg/ButtonCognitiveIcon.js";import{getBentArrowPath as l,DEVIATION_BADGE_SEPARATOR as s}from"../CognitiveComparehelpers.js";import{DEFAULT_DEVIAION_COLOR as r}from"../CognitiveCompareConstants.js";import a from"./ThreeDotsLoader.js";import d from"./connectedLines.js";import{Box as c}from"@mui/material";function u(u){var g=u.svgContainerRef,p=u.svgDimensions,v=u.isResizing,h=u.overallConnector,y=u.rootDeviationStyle,f=u.lines,m=u.isSideBySide,x=u.activeSideBySideSection,b=u.isArrowVisible,S=u.maintainRelativeOrder,C=u.proposedSections,I=u.existingSections,w=u.cognitivePopup,B=u.activeBadgeId,P=u.closeCognitivePopup,R=u.setActiveBadgeId,j=u.openCognitivePopupFromState,D=u.buildSectionPopupState,k=u.connectedLines,K=u.pathRefs,L=u.isGuidelineMode;return t("svg",e({ref:g,style:{position:"absolute",top:0,left:0,width:p.width||"100%",height:p.height||"100%",pointerEvents:"none",zIndex:10,overflow:"visible",opacity:v?0:1,transition:"opacity 0.15s ease-in-out"}},{children:[h&&i("g",{children:i("line",{x1:h.x1,y1:h.y,x2:h.x2,y2:h.y,stroke:y.badgeBorder,strokeWidth:"1.5"})}),f.map(function(d){var u,g,p,v,h,y,f,k=d.x1+.5*(d.x2-d.x1),K=(d.y1+d.y2)/2;if("Not Defined"===d.style.label&&!d.hasCognitive)return null;if(d.isSubSection?m&&x===d.subSectionKeyPath&&b:m&&x===d.sectionIdx&&b)return null;if(S)return null;var L=d.isSubSection?l(d.x1,d.y1,d.x2,d.y2):"M ".concat(d.x1," ").concat(d.y1," L ").concat(d.x2," ").concat(d.y2),T=C[d.sectionIdx]||{title:"",content:""},z=I[null!==(u=d.targetRightIdx)&&void 0!==u?u:d.sectionIdx]||{title:"",content:""};if(d.isSubSection&&d.subSectionKeyPath){var E=d.subSectionKeyPath.includes(s)?d.subSectionKeyPath.split(s):[],M=E[2]||d.subSectionKeyPath,A=E[3]||M,N=M.split("-").map(Number),O=A.split("-").map(Number),W=null,F=null;N.length>0&&(W=C[N[0]]||null),O.length>0&&(F=I[O[0]]||null);for(var G=(null==W?void 0:W.title)||"",_=(null==F?void 0:F.title)||"",V=1;V<N.length;V+=1)(null==W?void 0:W.subsections)&&(W=W.subsections[N[V]]||null);for(V=1;V<O.length;V+=1)(null==F?void 0:F.subsections)&&(F=F.subsections[O[V]]||null);W&&(T=e(e({},W),{title:G||W.title})),F&&(z=e(e({},F),{title:_||F.title}))}var q=!(null===(g=T.cognitiveData)||void 0===g?void 0:g.isMissingRationale)||Boolean(null===(v=null===(p=T.cognitiveData)||void 0===p?void 0:p.decisioning)||void 0===v?void 0:v.length),H=(null===(f=null===(y=null===(h=T.evaluationResult)||void 0===h?void 0:h.cognitive_decisioning)||void 0===y?void 0:y.decisioning_factors)||void 0===f?void 0:f.length)||!1,J=q||H;return t("g",{children:[i("path",{d:L,fill:"none",stroke:d.style.badgeBorder||"#E2E8F0",strokeWidth:"1.5"}),i("foreignObject",e({x:k-100,y:K-14,width:"200",height:"28",style:{pointerEvents:"auto",overflow:"visible"}},{children:i(c,e({sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},{children:t(c,e({onClick:function(e){e.stopPropagation(),J&&(w.open&&B===d.id?P():(R(d.id),j(D(e.currentTarget,T,z,d.sectionIdx,!1,d.style))))},sx:{display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"11px",bgcolor:d.style.badgeBg,color:d.style.badgeText,border:"1px solid ".concat(d.style.badgeBorder),borderRadius:"12px",px:1.5,py:.5,fontWeight:600,textAlign:"center",whiteSpace:"nowrap",cursor:J?"pointer":"default"}},{children:[d.style.badgeText===r&&null==d.style.label?i(a,{color:d.style.badgeText}):null==d.style.label?null:"0"===String(d.style.label)?"Same":d.style.label,i(c,e({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:i(o,{})})),J&&i(n,{size:11,style:{transform:w.open&&B===d.id?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.25s ease"}})]}))}))}))]},d.id)}),i(d,{maintainRelativeOrder:S,connectedLines:k,pathRefs:K,isGuidelineMode:L})]}))}export{u as default};
2
2
  //# sourceMappingURL=SvgConnectors.js.map
@@ -1,2 +1,2 @@
1
- import{__assign as e}from"tslib";import{jsxs as t,Fragment as i,jsx as r}from"react/jsx-runtime";import{Box as n}from"@mui/material";import o from"./ScrollLockToggle.js";import{useCompareContext as l}from"../CompareContext.js";var d=function(d){var c=d.connectedLines,a=d.pathRefs,s=d.maintainRelativeOrder,u=l(),f=u.scrollSyncLocked,h=u.toggleScrollSyncLocked,g=u.isGuidelineMode;return t(i,{children:[c.map(function(i){var l,d,c,u,p=i.pathD,x=(null===(l=i.style)||void 0===l?void 0:l.badgeBorder)||"#6366F1",m="conn-marker-".concat(i.id),y="".concat(i.id,"-bg"),F="".concat(i.id,"-stroke"),b="".concat(i.id,"-btn"),k="".concat(i.id,"-number"),v=void 0!==i.x1?i.x1+40:0,w=void 0!==i.y1?i.y1:0;return t("g",{children:[r("defs",{children:r("clipPath",e({id:"connections-clip"},{children:r("marker",e({id:m,markerWidth:"8",markerHeight:"6",refX:"7",refY:"3",orient:"auto"},{children:r("polygon",{points:"0 0, 8 3, 0 6",fill:x})}))}))}),r("path",{ref:function(e){a.current[y]=e},d:p,fill:"none",stroke:"#FFFFFF",strokeWidth:"4",strokeOpacity:"0.7"}),r("path",{ref:function(e){a.current[F]=e},d:p,fill:"none",stroke:x,strokeWidth:"1.75",markerEnd:"url(#".concat(m,")")}),i.matchLabel&&t("g",e({ref:function(e){a.current[k]=e},transform:"translate(".concat(i.x2-42,", ").concat(i.y2,")"),style:{pointerEvents:"none",transition:"visibility 0ms"}},{children:[r("rect",{x:"-22",y:"-8",width:"44",height:"16",rx:"4",fill:"#FFFFFF"}),r("rect",{x:"-21",y:"-7",width:"42",height:"14",rx:"3",fill:(null===(d=i.style)||void 0===d?void 0:d.badgeBg)||"#FEF08A",stroke:x,strokeWidth:"1"}),r("text",e({x:"0",y:"3.5",fontSize:"9px",fontWeight:"bold",fontFamily:'"Plus Jakarta Sans", sans-serif',fill:(null===(c=i.style)||void 0===c?void 0:c.badgeText)||x,textAnchor:"middle"},{children:i.matchLabel}))]})),s&&void 0!==i.x1&&!g&&r("foreignObject",e({ref:function(e){a.current[b]=e},x:v-12,y:w-12,width:"24",height:"24",style:{pointerEvents:"auto",overflow:"visible"}},{children:r(n,e({onClick:function(e){e.stopPropagation(),h&&h(e)},sx:{display:"flex",justifyContent:"center",alignItems:"center",width:"100%",height:"100%",bgcolor:"#FFFFFF",borderRadius:"50%",border:"1px solid ".concat(x),cursor:"pointer",transition:"transform 0.2s ease","&:hover":{transform:"scale(1.05)",boxShadow:"0px 2px 4px rgba(0,0,0,0.1)"}}},{children:r(o,{locked:f,onToggle:h,color:(null===(u=i.style)||void 0===u?void 0:u.badgeText)||x,borderColor:"transparent",size:12})}))}))]},i.id)}),t("g",{children:[t("g",e({style:{transition:"visibility 0ms"}},{children:[r("path",{ref:function(e){return a.current["guideline-up-stroke"]=e},fill:"none",strokeWidth:"1.75",visibility:"hidden"}),t("g",e({ref:function(e){return a.current["guideline-up-badge"]=e},visibility:"hidden"},{children:[r("polygon",{ref:function(e){return a.current["guideline-up-arrow"]=e},points:"-4,0 0,-6 4,0"}),r("rect",{ref:function(e){return a.current["guideline-up-badge-rect"]=e},x:"-12",y:"3",width:"24",height:"15",rx:"4",fill:"#FFFFFF",strokeWidth:"1"}),r("text",{ref:function(e){return a.current["guideline-up-text"]=e},x:"0",y:"14",fontSize:"10px",fontWeight:"bold",fontFamily:'"Plus Jakarta Sans", sans-serif',textAnchor:"middle"})]}))]})),t("g",e({style:{transition:"visibility 0ms"}},{children:[r("path",{ref:function(e){return a.current["guideline-down-stroke"]=e},fill:"none",strokeWidth:"1.75",visibility:"hidden"}),t("g",e({ref:function(e){return a.current["guideline-down-badge"]=e},visibility:"hidden"},{children:[r("polygon",{ref:function(e){return a.current["guideline-down-arrow"]=e},points:"-4,0 0,6 4,0"}),r("rect",{ref:function(e){return a.current["guideline-down-badge-rect"]=e},x:"-12",y:"-18",width:"24",height:"15",rx:"4",fill:"#FFFFFF",strokeWidth:"1"}),r("text",{ref:function(e){return a.current["guideline-down-text"]=e},x:"0",y:"-7",fontSize:"10px",fontWeight:"bold",fontFamily:'"Plus Jakarta Sans", sans-serif',textAnchor:"middle"})]}))]}))]})]})};export{d as default};
1
+ import{__assign as e}from"tslib";import{jsxs as t,Fragment as i,jsx as r}from"react/jsx-runtime";import{Box as n}from"@mui/material";import o from"./ScrollLockToggle.js";import{useCompareContext as l}from"../CompareContext.js";var d=function(d){var c=d.connectedLines,a=d.pathRefs,s=d.maintainRelativeOrder,u=l(),f=u.scrollSyncLocked,h=u.toggleScrollSyncLocked,g=u.isGuidelineMode;return t(i,{children:[c.map(function(i){var l,d,c,u,p=i.pathD,x=(null===(l=i.style)||void 0===l?void 0:l.badgeBorder)||"#6366F1",m="conn-marker-".concat(i.id),y="".concat(i.id,"-bg"),F="".concat(i.id,"-stroke"),b="".concat(i.id,"-btn"),k="".concat(i.id,"-number"),v=void 0!==i.x1?i.x1+40:0,w=void 0!==i.y1?i.y1:0;return t("g",{children:[r("defs",{children:r("clipPath",e({id:"connections-clip"},{children:r("marker",e({id:m,markerWidth:"8",markerHeight:"6",refX:"7",refY:"3",orient:"auto"},{children:r("polygon",{points:"0 0, 8 3, 0 6",fill:x})}))}))}),r("path",{ref:function(e){a.current[y]=e},d:p,fill:"none",stroke:"#FFFFFF",strokeWidth:"4",strokeOpacity:"0.7"}),r("path",{ref:function(e){a.current[F]=e},d:p,fill:"none",stroke:x,strokeWidth:"1.75",markerEnd:"url(#".concat(m,")")}),g&&i.matchLabel&&t("g",e({ref:function(e){a.current[k]=e},transform:"translate(".concat(i.x2-42,", ").concat(i.y2,")"),style:{pointerEvents:"none",transition:"visibility 0ms"}},{children:[r("rect",{x:"-22",y:"-8",width:"44",height:"16",rx:"4",fill:"#FFFFFF"}),r("rect",{x:"-21",y:"-7",width:"42",height:"14",rx:"3",fill:(null===(d=i.style)||void 0===d?void 0:d.badgeBg)||"#FEF08A",stroke:x,strokeWidth:"1"}),r("text",e({x:"0",y:"3.5",fontSize:"9px",fontWeight:"bold",fontFamily:'"Plus Jakarta Sans", sans-serif',fill:(null===(c=i.style)||void 0===c?void 0:c.badgeText)||x,textAnchor:"middle"},{children:i.matchLabel}))]})),s&&void 0!==i.x1&&!g&&r("foreignObject",e({ref:function(e){a.current[b]=e},x:v-12,y:w-12,width:"24",height:"24",style:{pointerEvents:"auto",overflow:"visible"}},{children:r(n,e({onClick:function(e){e.stopPropagation(),h&&h(e)},sx:{display:"flex",justifyContent:"center",alignItems:"center",width:"100%",height:"100%",bgcolor:"#FFFFFF",borderRadius:"50%",border:"1px solid ".concat(x),cursor:"pointer",transition:"transform 0.2s ease","&:hover":{transform:"scale(1.05)",boxShadow:"0px 2px 4px rgba(0,0,0,0.1)"}}},{children:r(o,{locked:f,onToggle:h,color:(null===(u=i.style)||void 0===u?void 0:u.badgeText)||x,borderColor:"transparent",size:12})}))}))]},i.id)}),t("g",{children:[t("g",e({style:{transition:"visibility 0ms"}},{children:[r("path",{ref:function(e){return a.current["guideline-up-stroke"]=e},fill:"none",strokeWidth:"1.75",visibility:"hidden"}),t("g",e({ref:function(e){return a.current["guideline-up-badge"]=e},visibility:"hidden"},{children:[r("polygon",{ref:function(e){return a.current["guideline-up-arrow"]=e},points:"-4,0 0,-6 4,0"}),r("rect",{ref:function(e){return a.current["guideline-up-badge-rect"]=e},x:"-12",y:"3",width:"24",height:"15",rx:"4",fill:"#FFFFFF",strokeWidth:"1"}),r("text",{ref:function(e){return a.current["guideline-up-text"]=e},x:"0",y:"14",fontSize:"10px",fontWeight:"bold",fontFamily:'"Plus Jakarta Sans", sans-serif',textAnchor:"middle"})]}))]})),t("g",e({style:{transition:"visibility 0ms"}},{children:[r("path",{ref:function(e){return a.current["guideline-down-stroke"]=e},fill:"none",strokeWidth:"1.75",visibility:"hidden"}),t("g",e({ref:function(e){return a.current["guideline-down-badge"]=e},visibility:"hidden"},{children:[r("polygon",{ref:function(e){return a.current["guideline-down-arrow"]=e},points:"-4,0 0,6 4,0"}),r("rect",{ref:function(e){return a.current["guideline-down-badge-rect"]=e},x:"-12",y:"-18",width:"24",height:"15",rx:"4",fill:"#FFFFFF",strokeWidth:"1"}),r("text",{ref:function(e){return a.current["guideline-down-text"]=e},x:"0",y:"-7",fontSize:"10px",fontWeight:"bold",fontFamily:'"Plus Jakarta Sans", sans-serif',textAnchor:"middle"})]}))]}))]})]})};export{d as default};
2
2
  //# sourceMappingURL=connectedLines.js.map