@viswa-test/test-citation 0.0.242 → 0.0.244

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 (81) hide show
  1. package/dist/cjs/features/CognitiveCompare/CitationAnchor.js +1 -1
  2. package/dist/cjs/features/CognitiveCompare/CitationRenderer.js +1 -1
  3. package/dist/cjs/features/CognitiveCompare/CognitiveCompare.js +1 -1
  4. package/dist/cjs/features/CognitiveCompare/CognitivePopup.js +1 -1
  5. package/dist/cjs/features/RequirementAI/components/RequirementAIWrapper/RequirementAIWrapper.js +1 -1
  6. package/dist/cjs/features/RequirementAI/components/UserStoryCard/CognitiveComponents/CitationAnchor.js +1 -1
  7. package/dist/cjs/features/RequirementAI/components/UserStoryCard/CognitiveComponents/CognitiveComponent.js +1 -1
  8. package/dist/cjs/features/RequirementAI/components/UserStoryCard/Popups/DeviationSummary.js +1 -1
  9. package/dist/cjs/features/RequirementAI/components/UserStoryCard/Popups/HistoryMenu.js +1 -1
  10. package/dist/cjs/features/RequirementAI/components/UserStoryCard/Popups/ManualEditPopup.js +1 -1
  11. package/dist/cjs/features/RequirementAI/components/UserStoryCard/Popups/RedlineStatusCard.js +1 -1
  12. package/dist/cjs/features/RequirementAI/components/UserStoryCard/Popups/RedlineToast.js +2 -0
  13. package/dist/cjs/features/RequirementAI/components/UserStoryCard/Popups/RedlineToast.js.map +1 -0
  14. package/dist/cjs/features/RequirementAI/components/UserStoryCard/UserStoryCard.js +1 -1
  15. package/dist/cjs/features/RequirementAI/components/UserStoryCard/cws/CwsEvent.js +2 -0
  16. package/dist/cjs/features/RequirementAI/components/UserStoryCard/cws/CwsEvent.js.map +1 -0
  17. package/dist/cjs/features/RequirementAI/components/UserStoryCard/cws/CwsEventProvider.js +2 -0
  18. package/dist/cjs/features/RequirementAI/components/UserStoryCard/cws/CwsEventProvider.js.map +1 -0
  19. package/dist/cjs/features/RequirementAI/components/UserStoryCard/cws/SocketManager.js +2 -0
  20. package/dist/cjs/features/RequirementAI/components/UserStoryCard/cws/SocketManager.js.map +1 -0
  21. package/dist/cjs/features/RequirementAI/components/UserStoryCard/cws/useCwsEvent.js +2 -0
  22. package/dist/cjs/features/RequirementAI/components/UserStoryCard/cws/useCwsEvent.js.map +1 -0
  23. package/dist/cjs/service/redlineService.js +1 -1
  24. package/dist/features/CognitiveCompare/CitationAnchor.js +1 -1
  25. package/dist/features/CognitiveCompare/CitationRenderer.js +1 -1
  26. package/dist/features/CognitiveCompare/CognitiveCompare.js +1 -1
  27. package/dist/features/CognitiveCompare/CognitivePopup.js +1 -1
  28. package/dist/features/RequirementAI/components/RequirementAIWrapper/RequirementAIWrapper.js +1 -1
  29. package/dist/features/RequirementAI/components/UserStoryCard/CognitiveComponents/CitationAnchor.js +1 -1
  30. package/dist/features/RequirementAI/components/UserStoryCard/CognitiveComponents/CognitiveComponent.js +1 -1
  31. package/dist/features/RequirementAI/components/UserStoryCard/Popups/DeviationSummary.js +1 -1
  32. package/dist/features/RequirementAI/components/UserStoryCard/Popups/HistoryMenu.js +1 -1
  33. package/dist/features/RequirementAI/components/UserStoryCard/Popups/ManualEditPopup.js +1 -1
  34. package/dist/features/RequirementAI/components/UserStoryCard/Popups/RedlineStatusCard.js +1 -1
  35. package/dist/features/RequirementAI/components/UserStoryCard/Popups/RedlineToast.js +2 -0
  36. package/dist/features/RequirementAI/components/UserStoryCard/Popups/RedlineToast.js.map +1 -0
  37. package/dist/features/RequirementAI/components/UserStoryCard/UserStoryCard.js +1 -1
  38. package/dist/features/RequirementAI/components/UserStoryCard/cws/CwsEvent.js +2 -0
  39. package/dist/features/RequirementAI/components/UserStoryCard/cws/CwsEvent.js.map +1 -0
  40. package/dist/features/RequirementAI/components/UserStoryCard/cws/CwsEventProvider.js +2 -0
  41. package/dist/features/RequirementAI/components/UserStoryCard/cws/CwsEventProvider.js.map +1 -0
  42. package/dist/features/RequirementAI/components/UserStoryCard/cws/SocketManager.js +2 -0
  43. package/dist/features/RequirementAI/components/UserStoryCard/cws/SocketManager.js.map +1 -0
  44. package/dist/features/RequirementAI/components/UserStoryCard/cws/useCwsEvent.js +2 -0
  45. package/dist/features/RequirementAI/components/UserStoryCard/cws/useCwsEvent.js.map +1 -0
  46. package/dist/service/redlineService.js +1 -1
  47. package/dist/types/src/CognitiveCompareTest.d.ts.map +1 -1
  48. package/dist/types/src/RedlineEditorTest.d.ts.map +1 -1
  49. package/dist/types/src/features/CognitiveCompare/CitationAnchor.d.ts.map +1 -1
  50. package/dist/types/src/features/CognitiveCompare/CitationRenderer.d.ts +2 -1
  51. package/dist/types/src/features/CognitiveCompare/CitationRenderer.d.ts.map +1 -1
  52. package/dist/types/src/features/CognitiveCompare/CognitiveCompare.d.ts.map +1 -1
  53. package/dist/types/src/features/CognitiveCompare/CognitivePopup.d.ts.map +1 -1
  54. package/dist/types/src/features/CognitiveCompare/hooks/useCompareLayout.d.ts +1 -0
  55. package/dist/types/src/features/CognitiveCompare/hooks/useCompareLayout.d.ts.map +1 -1
  56. package/dist/types/src/features/RequirementAI/components/RequirementAIWrapper/RequirementAIWrapper.d.ts +10 -1
  57. package/dist/types/src/features/RequirementAI/components/RequirementAIWrapper/RequirementAIWrapper.d.ts.map +1 -1
  58. package/dist/types/src/features/RequirementAI/components/UserStoryCard/CognitiveComponents/CognitiveComponent.d.ts.map +1 -1
  59. package/dist/types/src/features/RequirementAI/components/UserStoryCard/CognitiveComponents/userstory.mock.data.d.ts +2398 -0
  60. package/dist/types/src/features/RequirementAI/components/UserStoryCard/CognitiveComponents/userstory.mock.data.d.ts.map +1 -0
  61. package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/DeviationSummary.d.ts.map +1 -1
  62. package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/HistoryMenu.d.ts.map +1 -1
  63. package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/IterateComponent.d.ts.map +1 -1
  64. package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/ManualEditPopup.d.ts.map +1 -1
  65. package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/RedlineStatusCard.d.ts.map +1 -1
  66. package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/RedlineToast.d.ts +9 -0
  67. package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/RedlineToast.d.ts.map +1 -0
  68. package/dist/types/src/features/RequirementAI/components/UserStoryCard/UserStoryCard.d.ts.map +1 -1
  69. package/dist/types/src/features/RequirementAI/components/UserStoryCard/cws/CwsEvent.d.ts +14 -0
  70. package/dist/types/src/features/RequirementAI/components/UserStoryCard/cws/CwsEvent.d.ts.map +1 -0
  71. package/dist/types/src/features/RequirementAI/components/UserStoryCard/cws/CwsEventProvider.d.ts +10 -0
  72. package/dist/types/src/features/RequirementAI/components/UserStoryCard/cws/CwsEventProvider.d.ts.map +1 -0
  73. package/dist/types/src/features/RequirementAI/components/UserStoryCard/cws/SocketManager.d.ts +30 -0
  74. package/dist/types/src/features/RequirementAI/components/UserStoryCard/cws/SocketManager.d.ts.map +1 -0
  75. package/dist/types/src/features/RequirementAI/components/UserStoryCard/cws/index.d.ts +4 -0
  76. package/dist/types/src/features/RequirementAI/components/UserStoryCard/cws/index.d.ts.map +1 -0
  77. package/dist/types/src/features/RequirementAI/components/UserStoryCard/cws/useCwsEvent.d.ts +2 -0
  78. package/dist/types/src/features/RequirementAI/components/UserStoryCard/cws/useCwsEvent.d.ts.map +1 -0
  79. package/dist/types/src/service/redlineService.d.ts +6 -0
  80. package/dist/types/src/service/redlineService.d.ts.map +1 -1
  81. package/package.json +1 -1
@@ -1,2 +1,2 @@
1
- import{__assign as t}from"tslib";import{jsx as r,jsxs as n}from"react/jsx-runtime";import{useMemo as e}from"react";import{Box as i,Typography as o}from"@mui/material";import a from"react-markdown";import c from"rehype-raw";import l from"./CitationAnchor.js";var u=function(t){try{var r="undefined"!=typeof window?window.location.origin:"http://localhost";return new URL(t,r)}catch(t){return null}},s=function(t,r){var n,e=t.match(new RegExp("\\b".concat(r,"\\s*=\\s*(['\"])(.*?)\\1"),"i"));return null!==(n=null==e?void 0:e[2])&&void 0!==n?n:""},f=function(t){return t.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")},h=function(t,r,n){if(!n)return t;var e=f(n),i=new RegExp("\\b".concat(r,"\\s*=\\s*(['\"])(.*?)\\1"),"i");return i.test(t)?t.replace(i,"".concat(r,'="').concat(e,'"')):t.replace(/<a\b/i,"<a ".concat(r,'="').concat(e,'"'))},p=function(t){if(!t||!t.includes("rulebook_citation"))return t;var r=t;return Array.from(t.matchAll(/<a\b([^>]*)>([\s\S]*?)<\/a>/gi)).forEach(function(t){var n,e=t[0],i=t[1]||"",o=s(i,"type");if("rulebook_citation"===o){var a=s(i,"reason"),c=s(i,"href"),l=u(c),p=null===(n=((null==l?void 0:l.searchParams.get("citationNumber"))||"").match(/^rb_(.+)$/))||void 0===n?void 0:n[1];if(p){var d={citation_type:(null==l?void 0:l.searchParams.get("citation_type"))||"",phrase_to_highlight:(null==l?void 0:l.searchParams.get("phrase_to_highlight"))||""};if(d.citation_type||d.phrase_to_highlight){var m=!1,v=function(t){var r=u(t);return(null==r?void 0:r.searchParams.get("citationNumber"))!==p?t:(m=!0,function(t,r){var n=u(t);if(!n)return t;Object.entries(r).forEach(function(t){var r=t[0],e=t[1];e&&n.searchParams.set(r,e)});var e="".concat(n.pathname).concat(n.search).concat(n.hash);return t.startsWith("./")?".".concat(e):!t.startsWith("/")&&e.startsWith("/")?e.slice(1):e}(t,d))};r=r.replace(/\[([^\]]+)\]\(([^)\n]+)\)/g,function(t,r,n){var e=v(n);return e===n?t:'<a type="'.concat(f(o),'" reason="').concat(f(a),'" href="').concat(f(e),'">').concat(r,"</a>")}),m||(r=r.replace(/<a\b([^>]*)>/gi,function(t,r){var n=s(r,"href"),e=v(n);if(e===n)return t;var i=t.replace(/\bhref\s*=\s*(['"])(.*?)\1/i,function(t,r){return"href=".concat(r).concat(e).concat(r)});return h(h(i,"type",o),"reason",a)})),m&&(r=r.replace(e,""))}}}}),r};function d(u){var s=u.content,f=void 0===s?"":s,h=u.title,d=void 0===h?"":h,m=u.citations,v=void 0===m?{}:m,g=u.styles,x=void 0===g?{}:g,y=u.docData,b=void 0===y?{}:y;u.open;var _=e(function(){return JSON.stringify(v||{})},[v]),w=e(function(){return v},[_]),E=e(function(){return JSON.stringify(b||{})},[b]),D=e(function(){return b},[E]),P=e(function(){return{citations:w,docData:D}},[w,D]),C=e(function(){return p(f)},[f]),R=e(function(){return{a:function(t){var n=t.href,e=void 0===n?"":n,i=t.children,o=t.type,a=t.reason;return r(l,{href:e,children:i,citationType:o,citationReason:a,metaData:P})}}},[P]);return n(i,t({sx:{borderRadius:"8px",border:"1px solid #E4E7EC",bgcolor:"#FCFCFD"}},{children:[r(i,t({sx:{px:1.5,py:.75,borderBottom:"1px solid #EAECF0"}},{children:r(o,t({sx:{fontSize:"15px",fontWeight:600,color:"#344054",lineHeight:1.25}},{children:d}))})),r(i,t({sx:{px:1.5,py:1.1,display:"flex",flexDirection:"column",gap:.95}},{children:r(i,t({sx:{display:"flex",flexDirection:"column"}},{children:r(o,t({component:"div",sx:t({},x)},{children:r(a,t({components:R,rehypePlugins:[c]},{children:C}))}))}))}))]}))}export{d as default};
1
+ import{__rest as t,__assign as r}from"tslib";import{jsx as n,jsxs as e}from"react/jsx-runtime";import{useMemo as a}from"react";import{Box as i,Typography as o}from"@mui/material";import c from"react-markdown";import l from"rehype-raw";import u from"./CitationAnchor.js";var s=function(t){try{var r="undefined"!=typeof window?window.location.origin:"http://localhost";return new URL(t,r)}catch(t){return null}},f=function(t,r){var n,e=t.match(new RegExp("\\b".concat(r,"\\s*=\\s*(['\"])(.*?)\\1"),"i"));return null!==(n=null==e?void 0:e[2])&&void 0!==n?n:""},d=function(t){return t.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")},h=function(t,r,n){if(!n)return t;var e=d(n),a=new RegExp("\\b".concat(r,"\\s*=\\s*(['\"])(.*?)\\1"),"i");return a.test(t)?t.replace(a,"".concat(r,'="').concat(e,'"')):t.replace(/<a\b/i,"<a ".concat(r,'="').concat(e,'"'))},p=function(t){if(!t||!t.includes("rulebook_citation"))return t;var r=t;return Array.from(t.matchAll(/<a\b([^>]*)>([\s\S]*?)<\/a>/gi)).forEach(function(t){var n,e=t[0],a=t[1]||"",i=f(a,"type");if("rulebook_citation"===i){var o=f(a,"reason"),c=f(a,"href"),l=s(c),u=null===(n=((null==l?void 0:l.searchParams.get("citationNumber"))||"").match(/^rb_(.+)$/))||void 0===n?void 0:n[1];if(u){var p={citation_type:(null==l?void 0:l.searchParams.get("citation_type"))||"",phrase_to_highlight:(null==l?void 0:l.searchParams.get("phrase_to_highlight"))||""};if(p.citation_type||p.phrase_to_highlight){var v=!1,m=function(t){var r=s(t);return(null==r?void 0:r.searchParams.get("citationNumber"))!==u?t:(v=!0,function(t,r){var n=s(t);if(!n)return t;Object.entries(r).forEach(function(t){var r=t[0],e=t[1];e&&n.searchParams.set(r,e)});var e="".concat(n.pathname).concat(n.search).concat(n.hash);return t.startsWith("./")?".".concat(e):!t.startsWith("/")&&e.startsWith("/")?e.slice(1):e}(t,p))};r=r.replace(/\[([^\]]+)\]\(([^)\n]+)\)/g,function(t,r,n){var e=m(n);return e===n?t:'<a type="'.concat(d(i),'" reason="').concat(d(o),'" href="').concat(d(e),'">').concat(r,"</a>")}),v||(r=r.replace(/<a\b([^>]*)>/gi,function(t,r){var n=f(r,"href"),e=m(n);if(e===n)return t;var a=t.replace(/\bhref\s*=\s*(['"])(.*?)\1/i,function(t,r){return"href=".concat(r).concat(e).concat(r)});return h(h(a,"type",i),"reason",o)})),v&&(r=r.replace(e,""))}}}}),r},v=function(t){return t?"./dual-citation?citationNumber=".concat(encodeURIComponent(t)):""};function m(s){var f=s.content,d=void 0===f?"":f,h=s.title,m=void 0===h?"":h,g=s.citations,b=void 0===g?{}:g,x=s.styles,y=void 0===x?{}:x,w=s.docData,_=void 0===w?{}:w,D=s.deviationData,E=void 0===D?null:D;s.open;var S=a(function(){return JSON.stringify(b||{})},[b]),C=a(function(){return b},[S]),P=a(function(){return JSON.stringify(_||{})},[_]),R=a(function(){return _},[P]),A=a(function(){return{citations:C,docData:R}},[C,R]),N=a(function(){var t=null==E?void 0:E.web_search_answer,r=(null==t?void 0:t.extraMetaData)||{};return Object.keys(r).reduce(function(t,r){var n=function(t,r){var n;if(!t||!r)return null;var e=null==t?void 0:t.web_search_answer,a=null===(n=null==e?void 0:e.extraMetaData)||void 0===n?void 0:n[r];return e&&a?{reasoningId:r,evaluation:t,webSearchAnswer:e,extraMetaData:a}:null}(E,r);return n&&(t[r]=n),t},{})},[E]),j=a(function(){return p(d)},[d]),k=a(function(){return{a:function(e){var a,i=e.href,o=void 0===i?"":i,c=e.children,l=e.type,s=e.reason,f=t(e,["href","children","type","reason"]),d=null==f?void 0:f["data-cognitive-reasoning"],h=!0===(a=null==f?void 0:f["dual-citation"])||"true"===a,p=h&&d?N[String(d)]:null;return n(u,{href:h?v(String(d||"")):o,children:c,citationType:h?"dual_citation":l,citationReason:s,metaData:r(r({},A),p?{webGpt:p}:{}),customStyle:p?{arrow:{color:"#6D28D9"}}:{}})}}},[A,N]);return e(i,r({sx:{borderRadius:"8px",border:"1px solid #E4E7EC",bgcolor:"#FCFCFD"}},{children:[n(i,r({sx:{px:1.5,py:.75,borderBottom:"1px solid #EAECF0"}},{children:n(o,r({sx:{fontSize:"15px",fontWeight:600,color:"#344054",lineHeight:1.25}},{children:m}))})),n(i,r({sx:{px:1.5,py:1.1,display:"flex",flexDirection:"column",gap:.95}},{children:n(i,r({sx:{display:"flex",flexDirection:"column"}},{children:n(o,r({component:"div",sx:r({},y)},{children:n(c,r({components:k,rehypePlugins:[l]},{children:j}))}))}))}))]}))}export{m as default};
2
2
  //# sourceMappingURL=CitationRenderer.js.map
@@ -1,2 +1,2 @@
1
- import{__assign as e,__spreadArray as n,__awaiter as i,__generator as t}from"tslib";import{jsx as o,jsxs as r}from"react/jsx-runtime";import{useState as l,useRef as u,useMemo as c,useEffect as a,useCallback as s}from"react";import{Box as d,Snackbar as v,Alert as f,Tooltip as p,Typography as g,Tabs as h,Tab as m}from"@mui/material";import{ChevronDown as S}from"lucide-react";import{ButtonCognitiveIcon as x}from"../../assests/svg/ButtonCognitiveIcon.js";import R from"./OverlayComponent.js";import{safeStringify as b,extractDeviationScore as y,generateColorPalette as C,findKeyPathByNodeId as w,DEVIATION_BADGE_SEPARATOR as B,hasMeaningfulRedlineTags as _,scrollAndHighlightClause as I,scrollAndWait as F,waitForScrollIdle as T}from"./CognitiveComparehelpers.js";import{SHARED_MARKDOWN_STYLES as E,DEFAULT_FIELD_CONFIG as A,DEFAULT_COMPARISON_CONFIG as k}from"./CognitiveCompareConfig.js";export{SHARED_MARKDOWN_STYLES}from"./CognitiveCompareConfig.js";import{DEFAULT_DEVIAION_COLOR as D,EMPTY_SUMMARY_POPUP_STATE as O,DEFAULT_COMPONENT_HEADER_TEXT as P}from"./CognitiveCompareConstants.js";import j from"./CognitivePopup.js";import L from"./MoreFunctionsPopup.js";import N from"./LoaderComponent.js";import M from"./components/ThreeDotsLoader.js";import{useCognitiveTreeData as H}from"./hooks/useCompareData.js";import{useComparePopups as z}from"./hooks/useComparePopups.js";import{useSectionRefs as W}from"./hooks/useSectionRefs.js";import{useAccordionState as q}from"./hooks/useAccordionState.js";import{useDeviationNavigation as G}from"./hooks/useDeviationNavigation.js";import V from"./components/CompareHeader.js";import K from"./components/SubSectionAccordion.js";import Y from"./components/LHSSectionRow.js";import J from"./components/RHSSectionRow.js";import X from"./components/CognitiveSummaryPopup.js";import{CompareContextProvider as $}from"./CompareContext.js";import{useStyleHelpers as U}from"./hooks/useStyles.js";import{useResizeHandler as Q}from"./hooks/useResizeHandler.js";import{useLinesCalculator as Z}from"./hooks/useLinesCalculator.js";import{useSideBySide as ee}from"./hooks/useSideBySide.js";import ne from"./components/SvgConnectors.js";import ie from"./Guidelines/components/GuidelinePanel.js";import te from"./Guidelines/components/WebGptPanel.js";var oe=function(oe){var re,le,ue,ce,ae,se,de,ve,fe,pe,ge,he,me,Se,xe,Re,be,ye,Ce,we,Be,_e,Ie,Fe,Te,Ee,Ae,ke,De,Oe,Pe,je,Le,Ne,Me,He=oe.componentHeaderText,ze=void 0===He?P:He,We=oe.treeData,qe=oe.comparisonConfig,Ge=oe.leftColumnTitleText,Ve=oe.rightColumnTitleText,Ke=oe.markdownStyles,Ye=oe.resetTrigger,Je=oe.displayConfig,Xe=void 0===Je?{isHeaderVisible:!0,isToggleVisible:!0,maintainRelativeOrder:!1,isLoading:!0,showDeviationBadges:!1,enableDeviationSchemaBackwardCompatibility:!1,displayEmailNotifier:!0,isStreamingEnabled:!1}:Je,$e=oe.onMaintainRelativeOrderChange,Ue=oe.popupConfig,Qe=oe.deviationData,Ze=void 0===Qe?{}:Qe,en=oe.deviationNodeIdToView,nn=oe.resetDeviationNodeId,tn=oe.isProposingFix,on=void 0!==tn&&tn,rn=oe.proposingFixNodeId,ln=oe.isRedlineFlow,un=oe.badgeStyleOverride,cn=oe.guidelinesData,an=oe.gptWebCitationConfig,sn=l(Xe.maintainRelativeOrder),dn=sn[0],vn=sn[1],fn=null!==(re=null==Xe?void 0:Xe.expandLevels)&&void 0!==re?re:0,pn=!!(null==Xe?void 0:Xe.expandAllSections),gn=!!dn||!!(null==Xe?void 0:Xe.showDeviationBadges),hn=l(!1),mn=hn[0],Sn=hn[1],xn=l(null),Rn=xn[0],bn=xn[1],yn=l(null===(ue=null!==(le=null==We?void 0:We.newEvaluationResult)&&void 0!==le?le:null==Xe?void 0:Xe.enableDeviationSchemaBackwardCompatibility)||void 0===ue||ue)[0],Cn=l(new Set),wn=Cn[0],Bn=Cn[1],_n=l([]),In=_n[0],Fn=_n[1],Tn=l(!1),En=Tn[0],An=Tn[1],kn=l(0),Dn=kn[0],On=kn[1],Pn=u(null),jn=u(null),Ln=u(null),Nn=u(null),Mn=u(null),Hn=u(!1),zn=u(null),Wn=u({}),qn=u([]),Gn=u(function(){}),Vn=u(null),Kn=u(function(){}),Yn=c(function(){return JSON.stringify(Ze||{})},[JSON.stringify(Ze)]),Jn=c(function(){return Ze||{}},[Yn]),Xn=c(function(){return(null==We?void 0:We.cognitive_decisioning)||{}},[We]),$n=c(function(){return e(e({},E),Ke)},[Ke]),Un=u(null),Qn=u(null),Zn=u(null),ei=u(null),ni=u(null),ii=u(null),ti=u(null),oi=u(null),ri=u(null),li=u(null),ui=z(Un),ci=ui.cognitivePopup,ai=ui.setCognitivePopup,si=ui.moreFunctions,di=ui.setMoreFunctions,vi=ui.position,fi=ui.setPosition,pi=ui.activeBadgeId,gi=ui.summaryPopup,hi=ui.setSummaryPopup,mi=ui.closeSummaryPopup,Si=ui.setActiveBadgeId,xi=ui.popupRef,Ri=ui.handleOpenCognitiveCompare,bi=ui.openCognitivePopupFromState,yi=ui.closeCognitivePopup,Ci=ui.closeMoreFunctionsPopup,wi=c(function(){var e,n,i,t,o,r,l;return{fields:null!==(e=null==qe?void 0:qe.fields)&&void 0!==e?e:A,thresholds:{high:null!==(i=null===(n=null==qe?void 0:qe.thresholds)||void 0===n?void 0:n.high)&&void 0!==i?i:k.thresholds.high,medium:null!==(o=null===(t=null==qe?void 0:qe.thresholds)||void 0===t?void 0:t.medium)&&void 0!==o?o:k.thresholds.medium,exact:null!==(l=null===(r=null==qe?void 0:qe.thresholds)||void 0===r?void 0:r.exact)&&void 0!==l?l:k.thresholds.exact}}},[qe]),Bi=l(null),_i=Bi[0];Bi[1];var Ii=null===(se=null===(ce=null==We?void 0:We.documents)||void 0===ce?void 0:ce[null===(ae=null==We?void 0:We.input_index_map)||void 0===ae?void 0:ae[0]])||void 0===se?void 0:se.title,Fi=null===(fe=null===(de=null==We?void 0:We.documents)||void 0===de?void 0:de[null===(ve=null==We?void 0:We.input_index_map)||void 0===ve?void 0:ve[1]])||void 0===fe?void 0:fe.title,Ti=b(Ge||Ii||"Uploaded Contract"),Ei=null===(me=null===(he=null===(pe=null==We?void 0:We.documents)||void 0===pe?void 0:pe[null===(ge=null==We?void 0:We.input_index_map)||void 0===ge?void 0:ge[0]])||void 0===he?void 0:he.metadata)||void 0===me?void 0:me.file_name,Ai=b(Ei),ki=null===(be=null===(Re=null===(Se=null==We?void 0:We.documents)||void 0===Se?void 0:Se[null===(xe=null==We?void 0:We.input_index_map)||void 0===xe?void 0:xe[1]])||void 0===Re?void 0:Re.metadata)||void 0===be?void 0:be.file_name,Di=b(ki),Oi=b(Ve||Fi||"Reference Template"),Pi=H(We,dn,Jn,wi,yn,cn),ji=Pi.isGuidelineMode,Li=Pi.activeProposed,Ni=Pi.existingRule,Mi=Pi.proposedSections,Hi=Pi.existingSections,zi=Pi.visibleFields,Wi=Pi.parentDeviationRecord,qi=Pi.deviationNumberRegistry,Gi=Pi.deviationParentRegistry,Vi=Pi.parseError;a(function(){Vi&&bn("Failed to load comparison: ".concat(Vi))},[Vi]);var Ki=Mi.length>0||Hi.length>0,Yi=c(function(){if(!ln)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)||"";_(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(Mi),i(Hi),"".concat(e,":").concat(n)},[ln,Mi,Hi]);a(function(){if(Mi.length||Hi.length)if(pn){var e={},n={},i=function(i,t){i.forEach(function(i,o){var r,l=dn?"".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(Mi,"left"),i(Hi,"right"),Tt(e),At(n)}else if(fn>0){var t={},o={},r=function(e,n,i){e.forEach(function(e,r){var l;if(i>=1){var u=dn?"".concat(n,"-").concat(r):String(r);t[u]=!0}var c=function(e,n,t){t>i||null==e||e.forEach(function(e,i){var r,l="".concat(n,"-").concat(i);o[l]=!0,(null===(r=e.subsections)||void 0===r?void 0:r.length)&&c(e.subsections,l,t+1)})};(null===(l=e.subsections)||void 0===l?void 0:l.length)&&i>=2&&c(e.subsections,String(r),2)})};r(Mi,"left",fn),r(Hi,"right",fn),Tt(t),At(o)}},[pn,fn,Mi,Hi,dn]);var Ji=W(zi.map(function(e){return e.key}),Math.max(Mi.length,Hi.length)),Xi=Ji.leftRefs,$i=Ji.rightRefs,Ui=Ji.sectionLeftRefs,Qi=Ji.sectionRightRefs,Zi=Ji.lhsBadgeRefs,et=Ji.rhsBadgeRefs,nt=Ji.sectionRightRowRefs,it=Ji.subSectionLeftRefs,tt=Ji.subSectionRightRefs,ot=Ji.sectionRowRefs,rt=Ji.getSectionRowRef,lt=Ji.getSubSectionRef,ut=Ji.getBadgeRef,ct=ee({isGuidelineMode:ji,maintainRelativeOrder:dn,proposedSections:Mi,existingSections:Hi,leftContainerRef:oi,rightContainerRef:Zn,scrollContainerRef:Un,sectionLeftRefs:Ui,sectionRightRefs:Qi,subSectionLeftRefs:it,subSectionRightRefs:tt,lhsBadgeRefs:Zi,rhsBadgeRefs:et,sectionRowRefs:ot,sectionRightRowRefs:nt,rhsTopSpacerRef:ei,rhsBottomSpacerRef:ni,lhsTopSpacerRef:ii,lhsBottomSpacerRef:ti,calculateLinesRef:Gn,setConnectedSections:Bn,setConnectedLines:Fn,cachedConnectedPositions:qn,closeMoreFunctionsPopup:Ci,setErrorToast:bn,moreFunctions:si,closeSummaryPopup:mi}),at=ct.isSideBySide,st=ct.isArrowVisible,dt=ct.setIsArrowVisible,vt=ct.isResizing,ft=ct.setIsResizing,pt=ct.isSideBySideLoading,gt=ct.activeSideBySideSection,ht=ct.scrollLock,mt=ct.sideBySideCacheRef,St=ct.isSideBySideRef,xt=ct.activeSideBySideRightSectionRef,Rt=ct.activeSideBySideSectionRef,bt=ct.sideBySideLineRef,yt=ct.highlightedClauseRefs,Ct=ct.clearClauseHighlight,wt=ct.resetSideBySide,Bt=ct.activateSideBySide,_t=u(Bt);a(function(){_t.current=Bt},[Bt]);var It=q({maintainRelativeOrder:!!dn,proposedSections:Mi,existingSections:Hi,activeSideBySideSection:gt,connectedSections:wn,resetSideBySide:wt,setConnectedSections:Bn,setConnectedLines:Fn,cachedConnectedPositions:qn,svgContainerRef:Pn,isAnimatingRef:Hn,animationTimerRef:zn,calculateLinesRef:Gn,sectionLeftRefs:Ui,sectionRightRefs:Qi,subSectionLeftRefs:it,subSectionRightRefs:tt}),Ft=It.expandedSections,Tt=It.setExpandedSections,Et=It.expandedSubSections,At=It.setExpandedSubSections,kt=It.handleSubSectionToggle,Dt=It.toggleSection,Ot=It.forceExpandCrossWiredSections,Pt=function(){var e,n;if(null!=gt){var i=null===(e=Ui.current[gt])||void 0===e?void 0:e.current,t=null===(n=Qi.current[gt])||void 0===n?void 0:n.current,o=Zn.current;if(i&&t&&o){var r=i.getBoundingClientRect(),l=t.getBoundingClientRect(),u=o.getBoundingClientRect(),c=r.top-u.top,a=l.top-u.top-c;o.scrollBy({top:a,behavior:"smooth"})}}},jt=s(function(e){null==e||e.stopPropagation(),An(function(e){var n=!e;return n&&requestAnimationFrame(function(){Pt()}),n})},[Pt]);a(function(){ln&&"off"!==Yi&&"0:0"!==Yi&&(mt.current=null,qn.current=[],requestAnimationFrame(function(){var e;null===(e=Gn.current)||void 0===e||e.call(Gn)}))},[ln,Yi]);var Lt=c(function(){var e=new Map,n=new Map,i=1;if(dn)Mi.forEach(function(n){!n.title&&!n.content||n.id&&e.set(n.id,i++)}),Hi.forEach(function(t){if(t.id&&!(!t.title&&!t.content)){var o=Mi.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(Mi.length,Hi.length),o=0;o<t;o++){var r=Mi[o],l=Hi[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}},[Mi,Hi,dn]),Nt=Ni.analysis,Mt=b(null===(Ce=null===(ye=null==Nt?void 0:Nt.rule_difference_comparison)||void 0===ye?void 0:ye.summary)||void 0===Ce?void 0:Ce.overall_summary),Ht=!!Mt.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),zt=null!==(we=null==We?void 0:We.base_root_id)&&void 0!==we?we:"-1";null==We||We[zt];var Wt=yn?null!==(je=null!==(De=Ze&&(null===(ke=null==Ze?void 0:Ze[zt])||void 0===ke?void 0:ke.evaluation_result))&&void 0!==De?De:null===(Pe=null===(Oe=null==We?void 0:We.nodes)||void 0===Oe?void 0:Oe[zt])||void 0===Pe?void 0:Pe.evaluation_result)&&void 0!==je?je:null:null!==(Ae=null!==(Ie=Ze&&(null===(_e=null===(Be=null==Ze?void 0:Ze[zt])||void 0===Be?void 0:Be.evaluation_result)||void 0===_e?void 0:_e[0]))&&void 0!==Ie?Ie:null===(Ee=null===(Te=null===(Fe=null==We?void 0:We.nodes)||void 0===Fe?void 0:Fe[zt])||void 0===Te?void 0:Te.evaluation_result)||void 0===Ee?void 0:Ee[0])&&void 0!==Ae?Ae:null,qt=y(Wt),Gt=C(null!==(Me=null===(Ne=null===(Le=null==Wt?void 0:Wt.evaluation_outputs)||void 0===Le?void 0:Le.metadata)||void 0===Ne?void 0:Ne.label_color)&&void 0!==Me?Me:D);if(un){var Vt=un(qt);Vt&&(Gt=e(e({},Gt),{badgeBg:Vt.bg,badgeText:Vt.text,badgeBorder:Vt.border}))}var Kt=u(wt);a(function(){Kt.current=wt},[wt]);var Yt=u(yi);a(function(){Yt.current=yi},[yi]);var Jt=s(function(e,n,i,t,o,r){return nr.current(e,n,i,t,o,r)},[]),Xt=s(function(e,n,i,t,o){return tr.current(e,n,i,t,o)},[]),$t=s(function(){return or.current()},[]),Ut=s(function(e,n){return rr.current(e,n)},[]),Qt=s(function(e){return lr.current(e)},[]),Zt=s(function(e){return ur.current(e)},[]),eo=s(function(){return cr.current()},[]),no=s(function(){var e,n;Ct(),null===(e=Kt.current)||void 0===e||e.call(Kt),An(!1),Bn(new Set),Fn([]),qn.current=[],bo([]),Co(null),hi(O),null===(n=Yt.current)||void 0===n||n.call(Yt),requestAnimationFrame(function(){var e;null===(e=Gn.current)||void 0===e||e.call(Gn)})},[]),io=u(no);a(function(){io.current=no},[no]),a(function(){Ye&&io.current()},[Ye]);var to=c(function(){return{documents:null==We?void 0:We.documents,input_index_map:null==We?void 0:We.input_index_map}},[JSON.stringify(null==We?void 0:We.documents),JSON.stringify(null==We?void 0:We.input_index_map)]),oo=u(We);a(function(){oo.current=We},[We]);var ro=u(Xn);a(function(){ro.current=Xn},[Xn]);var lo=s(function(n,i,t,o,r,l,u){var c,a,s,d,v,f,p,g,h,m,S,x,R=b(null==i?void 0:i.id)||b(null==t?void 0:t.id)||"",y=(R?null===(c=ro.current)||void 0===c?void 0:c[R]:null)||(null==i?void 0:i.cognitiveData)||(null==t?void 0:t.cognitiveData)||{section_id:R,decisioning:[],gap:[],relevance_score:0},C=null!==(s=null===(a=ot.current[o])||void 0===a?void 0:a.current)&&void 0!==s?s:null,w=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(B)))return u(l);var c=o.split(B)[1];if(!c)return l;var a=(null==i?void 0:i.evaluationResult)||(null==t?void 0:t.evaluationResult)||{},s=(null===(n=null==a?void 0:a.deviation_entries)||void 0===n?void 0:n[c])||(null===(r=null==a?void 0:a.deviations)||void 0===r?void 0:r[c])||null;return s?e(e(e({},a),s),{deviation_summary:(null==s?void 0:s.deviation_summary)||(null==a?void 0:a.deviation_summary),deviation_title:(null==s?void 0:s.deviation_title)||(null==a?void 0:a.deviation_title),deviation_impact:(null==s?void 0:s.deviation_impact)||(null==a?void 0:a.deviation_impact),deviation_explanation:(null==s?void 0:s.deviation_explanation)||(null==a?void 0:a.deviation_explanation),evaluation_outputs:(null==s?void 0:s.evaluation_outputs)||(null==a?void 0:a.evaluation_outputs),cognitive_decisioning:(null==s?void 0:s.cognitive_decisioning)||(null==a?void 0:a.cognitive_decisioning)}):u(l)}(),_=(null!==(f=null===(v=null===(d=null==w?void 0:w.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==w?void 0:w.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==Xe?void 0:Xe.isLoading)&&void 0!==m&&m,F=!0;if(ji)if(w&&Object.keys(w).length>0){var T=Array.isArray(w)?w[0]:w,E=null===(x=null===(S=null==T?void 0:T.evaluation_outputs)||void 0===S?void 0:S.metadata)||void 0===x?void 0:x.is_orphan;!0!==E&&"true"!==E&&"Yes"!==E&&"yes"!==E||(F=!1)}else F=!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:C,badgeStyle:l||null,sectionIdx:o,docData:to,deviationData:w,isOrphan:!!r,hasGuidelineMatches:F}},[to,null==Xe?void 0:Xe.isLoading,ji]),uo=s(function(e,n,i,t,o,r){var l;if(e.stopPropagation(),si.open&&si.sectionIdx===o)Ci();else{var u=e.currentTarget,c="left";(null===(l=Zn.current)||void 0===l?void 0:l.contains(u))&&(c="right");Ct(),St.current&&wt(),Bn(new Set),Fn([]),qn.current=[],yi(),gi.open?jo():mi(),requestAnimationFrame(function(){var e=function(){var e,n,i,t;if("string"==typeof o&&o.includes(B)){var r=o.split(B),l="".concat(r[0]).concat(B).concat(r[1]);return"right"===c?null===(e=et.current[l])||void 0===e?void 0:e.current:null===(n=Zi.current[l])||void 0===n?void 0:n.current}return"right"===c?null===(i=et.current[o])||void 0===i?void 0:i.current:null===(t=Zi.current[o])||void 0===t?void 0:t.current}()||u;di(lo(e,n,t,o,i,r))})}},[si.open,si.sectionIdx,Ci,mi,lo]),co=s(function(){var e=si.sectionIdx;si.isOrphan,Ci(),mi(),null!==e&&(Ot(e),Ct(),St.current&&wt(),Fn([]),qn.current=[],ji&&null!==e&&On(Do(e)),Bn(function(n){return n.has(e)?new Set:new Set([e])}),setTimeout(function(){Gn.current&&Gn.current()},50))},[si.sectionIdx,si.isOrphan,Ci,mi,wt]),ao=s(function(){var e=Mn.current;if(e){Mn.current=null;var n=Mi.findIndex(function(n){return n.id===e}),i=Hi.findIndex(function(n){return n.id===e}),t=-1===n?w(Mi,e):null,o=-1===i?w(Hi,e):null,r=-1!==n?n:t?Number(t.split("-")[0]):-1,l=-1!==i?i:o?Number(o.split("-")[0]):-1,u=function(e,n,i,t){var o,r,l,u;return-1!==e?null!==(r=null===(o=i.current[e])||void 0===o?void 0:o.current)&&void 0!==r?r:null:n&&null!==(u=null===(l=t.current[n])||void 0===l?void 0:l.current)&&void 0!==u?u:null},c=function(e,n,i){void 0===i&&(i=30);var t=0,o=function(){var r=e();r&&0!==r.getBoundingClientRect().height?(yt.current.add(r),I(r,n)):t++<i&&requestAnimationFrame(o)};requestAnimationFrame(o)};if(dn)-1!==r&&oi.current&&c(function(){return u(n,t,Ui,it)},oi.current),-1!==l&&Zn.current&&c(function(){return u(i,o,Qi,tt)},Zn.current);else{var a=Un.current;if(!a)return;c(function(){return-1!==r?u(n,t,Ui,it):u(i,o,Qi,tt)},a)}}},[Mi,Hi,dn,Ui,Qi,it,tt,oi,Zn,Un]),so=s(function(n){if(n){Ct(),wt(),Bn(new Set),Fn([]),qn.current=[],mi(),yi();var i=Mi.findIndex(function(e){return e.id===n}),t=Hi.findIndex(function(e){return e.id===n}),o=-1===i?w(Mi,n):null,r=-1===t?w(Hi,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;Mn.current=n,Tt(function(n){var i,t=e({},n),o=!1;-1!==l&&(t[i=dn?"left-".concat(l):String(l)]||(t[i]=!0,o=!0));-1!==u&&(t[i=dn?"right-".concat(u):String(u)]||(t[i]=!0,o=!0));return o?t:n}),At(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(){Mn.current===n&&vo.current()})},50)}else console.warn('scrollToAndHighlightClause: nodeId "'.concat(n,'" not found'))}},[Mi,Hi,dn,Tt,At,wt,mi,yi]),vo=u(ao);a(function(){vo.current=ao},[ao]);var fo=u(null);a(function(){if(_i){var e=wi.fields.find(function(e){return e.analysisKey===_i||e.key===_i});if(e){var n=Xi.current[e.key]||$i.current[e.key];(null==n?void 0:n.current)&&setTimeout(function(){return n.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[_i,wi.fields]);var po=s(function(e){var n,i,t,o,r,l,u,c,a,s=null===(n=null==Nt?void 0:Nt.rule_difference_comparison)||void 0===n?void 0:n.fields;if(!s||!s[e])return{score:0,relation:"",highlightsA:[],highlightsB:[],hasContent:!1};var d=s[e],v=(null==d?void 0:d.relation)||(null===(t=null===(i=null==d?void 0:d.highlights)||void 0===i?void 0:i.ruleA_spans)||void 0===t?void 0:t.length)||(null===(r=null===(o=null==d?void 0:d.highlights)||void 0===o?void 0:o.ruleB_spans)||void 0===r?void 0:r.length)||(null==d?void 0:d.mappings)&&d.mappings.length>0;if(d.mappings){var f=d.mappings[0]||{};return{score:d.score,relation:f.relation||"",highlightsA:(null===(l=f.highlights)||void 0===l?void 0:l.ruleA_spans)||[],highlightsB:(null===(u=f.highlights)||void 0===u?void 0:u.ruleB_spans)||[],hasContent:!!v}}return{score:d.score,relation:d.relation||"",highlightsA:(null===(c=d.highlights)||void 0===c?void 0:c.ruleA_spans)||[],highlightsB:(null===(a=d.highlights)||void 0===a?void 0:a.ruleB_spans)||[],hasContent:!!v}},[Nt]),go=U({proposedSections:Mi,existingSections:Hi,maintainRelativeOrder:dn,cognitiveMap:Xn,deviationData:Jn,treeData:We,resolvedComparisonConfig:wi,badgeStyleOverride:un}),ho=go.getSectionCompareStyle,mo=go.getSubSectionCompareStyle,So=go.getDeviationStyleByKey,xo=Z({containerRef:jn,leftContainerRef:oi,rightContainerRef:Zn,svgContainerRef:Pn,pathRefs:Wn,leftHeaderRef:Ln,rightHeaderRef:Nn,proposedSections:Mi,existingSections:Hi,visibleFields:zi,leftRefs:Xi,rightRefs:$i,sectionLeftRefs:Ui,sectionRightRefs:Qi,subSectionLeftRefs:it,subSectionRightRefs:tt,lhsBadgeRefs:Zi,rhsBadgeRefs:et,sectionRowRefs:ot,expandedSections:Ft,expandedSubSections:Et,connectedSections:wn,isSideBySide:at,activeSideBySideSection:gt,maintainRelativeOrder:dn,isGuidelineMode:ji,cognitiveMap:Xn,getSectionCompareStyle:ho,getSubSectionCompareStyle:mo,getDeviationStyleByKey:So,isArrowVisible:st,isAnimatingRef:Hn,isSideBySideRef:St,sideBySideCacheRef:mt,sideBySideLineRef:bt,activeSideBySideSectionRef:Rt,activeSideBySideRightSectionRef:xt,connectedLines:In,setConnectedLines:Fn,cachedConnectedPositions:qn,calculateLinesRef:Gn,resizeTimerRef:Vn,scrollLock:ht,scrollSyncLocked:En,handleResizeRef:Kn,activeProposed:Li,existingRule:Ni,analysisData:Nt,pendingScrollTargetRef:ri,pendingScrollCallbackRef:li,resolvedComparisonConfig:wi,getFieldData:po}),Ro=xo.lines,bo=xo.setLines,yo=xo.overallConnector,Co=xo.setOverallConnector,wo=xo.svgDimensions,Bo=xo.handleColumnScroll;a(function(){gi.anchorEl&&requestAnimationFrame(function(){requestAnimationFrame(function(){var e;null===(e=Gn.current)||void 0===e||e.call(Gn)})})},[gi.anchorEl,En]);var _o=s(function(){Ct(),An(!1),Tt({}),At({}),wt(),Bn(new Set),Fn([]),qn.current=[],mi(),yi(),Ci(),requestAnimationFrame(function(){Gn.current&&Gn.current()})},[Tt,At,wt,mi,yi,Ci]);a(function(){at||0!==wn.size||An(!1)},[at,wn]);var Io=c(function(){return Object.values(Ft).some(Boolean)||Object.values(Et).some(Boolean)},[Ft,Et]),Fo=u(null),To=u(0),Eo=u(0),Ao=u(0),ko=Q({timerRef:Fo,ruleComponentRef:Qn,scrollContainerRef:Un,containerRef:jn,maintainRelativeOrder:dn,proposedSections:Mi,existingSections:Hi,isSideBySideRef:St,activeSideBySideSectionRef:Rt,activeSideBySideRightSectionRef:xt,sectionRowRefs:ot,sectionRightRowRefs:nt,sectionLeftRefs:Ui,sectionRightRefs:Qi,subSectionLeftRefs:it,subSectionRightRefs:tt,lhsBadgeRefs:Zi,rhsBadgeRefs:et,leftContainerRef:oi,rightContainerRef:Zn,calculateLinesRef:Gn,handleResizeRef:Kn,setIsResizing:ft,setIsArrowVisible:dt,sideBySideCacheRef:mt,cachedConnectedPositions:qn}).handleResize;a(function(){Kn.current=ko},[ko,Kn]),a(function(){var e=function(e,n,i,t,o){n.current=e.getBoundingClientRect().width;var r=new ResizeObserver(function(e){null!==i.current&&cancelAnimationFrame(i.current),i.current=requestAnimationFrame(function(){var r,l,u;i.current=null;var c=e[e.length-1];if(c){var a=null!==(u=null===(l=null===(r=c.borderBoxSize)||void 0===r?void 0:r[0])||void 0===l?void 0:l.inlineSize)&&void 0!==u?u:c.contentRect.width;Math.abs(a-n.current)<1?o():(n.current=a,t())}})});return r.observe(e),r},n={current:null},i={current:null},t={current:null},o=[],r=[n,i,t];return Qn.current&&o.push(e(Qn.current,To,n,function(){return Kn.current()},function(){})),Un.current&&o.push(e(Un.current,Eo,i,function(){return Kn.current()},function(){return Gn.current()})),jn.current&&o.push(e(jn.current,Ao,t,function(){return Kn.current()},function(){return Gn.current()})),function(){o.forEach(function(e){return e.disconnect()}),r.forEach(function(e){null!==e.current&&(cancelAnimationFrame(e.current),e.current=null)})}},[]),a(function(){St.current=at},[at]),a(function(){Rt.current=gt},[gt]);var Do=s(function(e){var n,i,t,o,r,l="",u="0";if("number"==typeof e)l=(null===(n=Mi[e])||void 0===n?void 0:n.nodeId)||(null===(i=Mi[e])||void 0===i?void 0:i.id)||"";else{var c=String(e).split(B);l=c[0],u=c[1]||"0"}var a=null===(t=null==Jn?void 0:Jn[l])||void 0===t?void 0:t.evaluation_result,s=Array.isArray(a)?a[parseInt(u,10)]:null==a?void 0:a[u];return!1===(null===(r=null===(o=null==s?void 0:s.evaluation_outputs)||void 0===o?void 0:o.guideline_flag)||void 0===r?void 0:r.rulebook_used)?1:0},[Mi,Jn]),Oo=s(function(e){var n,i,t=document.querySelectorAll('[id^="guideline-target-"], [data-web-gpt-active="true"]'),o=oi.current,r=Zn.current,l="string"==typeof e&&e.includes(B)?"".concat(e.split(B)[0]).concat(B).concat(e.split(B)[1]):e,u=(null===(n=Zi.current[l])||void 0===n?void 0:n.current)||(null===(i=Zi.current[e])||void 0===i?void 0:i.current);if(t.length>0&&u&&o&&r){var c=t[0];ii.current&&(ii.current.style.height="0px"),ei.current&&(ei.current.style.height="0px"),ti.current&&(ti.current.style.height="0px"),ni.current&&(ni.current.style.height="0px"),requestAnimationFrame(function(){var e=u.getBoundingClientRect(),n=c.getBoundingClientRect(),i=o.getBoundingClientRect(),t=r.getBoundingClientRect(),l=o.scrollTop+(e.top-i.top)+e.height/2,a=r.scrollTop+(n.top-t.top)+n.height/2,s=l-i.height/2,d=Math.max(0,s),v=o.scrollHeight-o.clientHeight,f=d>v?d-v:0,p=i.top+l-d,g=t.top+a-p,h=0;g<0&&(h=Math.abs(g),g=0);var m=r.scrollHeight-r.clientHeight+h,S=g>m?g-m:0;ti.current&&(ti.current.style.height="".concat(f,"px")),ei.current&&(ei.current.style.height="".concat(h,"px")),ni.current&&(ni.current.style.height="".concat(S,"px")),requestAnimationFrame(function(){o.scrollTo({top:d,behavior:"smooth"}),r.scrollTo({top:g,behavior:"smooth"}),Gn.current&&setTimeout(function(){return Gn.current()},50)})})}},[B]),Po=s(function(){var e,n=si.sectionIdx,i=si.isOrphan;if(mi(),null!=n){var t="left";si.anchorEl&&(null===(e=Zn.current)||void 0===e?void 0:e.contains(si.anchorEl))&&(t="right"),Ot(n),ji&&(On(Do(n)),Bn(new Set([n]))),Bt(n,i,{sourceSide:t,onReady:function(){ji&&setTimeout(function(){return Oo(String(n))},150)}})}},[Bt,si.isOrphan,si.sectionIdx,si.anchorEl,mi,Ot,ji,Oo,Jn]),jo=s(function(){mi(),wt(),Bn(new Set),Fn([]),qn.current=[]},[mi,wt]),Lo=null!==si.sectionIdx&&wn.has(si.sectionIdx),No=G({proposedSections:Mi,existingSections:Hi,parentDeviationRecord:Wi,expandedSections:Ft,maintainRelativeOrder:!!dn,scrollContainerRef:Un,leftContainerRef:oi,rightContainerRef:Zn,lhsBadgeRefs:Zi,rhsBadgeRefs:et}),Mo=No.showDeviationNavigation,Ho=No.showOpenNodeRef,zo=No.adjustScrollForPopup,Wo=s(function(e,n,i,t,o){var r,l="string"==typeof t?b(t).trim():b(null==t?void 0:t.deviation_summary).trim(),u=e.currentTarget;yi();var c="left";(null===(r=Zn.current)||void 0===r?void 0:r.contains(u))&&(c="right");var a=function(){var e,i,t,o;if("string"==typeof n&&n.includes(B)){var r=n.split(B),l="".concat(r[0]).concat(B).concat(r[1]);return"right"===c?null===(e=et.current[l])||void 0===e?void 0:e.current:null===(i=Zi.current[l])||void 0===i?void 0:i.current}return"right"===c?null===(t=et.current[n])||void 0===t?void 0:t.current:null===(o=Zi.current[n])||void 0===o?void 0:o.current};if(i&&!ji)return wt(),Bn(new Set),Fn([]),qn.current=[],void(l&&(Ot(n),requestAnimationFrame(function(){var e=a()||u;e&&(e.getBoundingClientRect().top>.8*window.innerHeight&&e.scrollIntoView({behavior:"smooth",block:"center"}));hi({open:!0,anchorEl:e,summary:t,displayImpact:o})})));Ot(n),ji&&(On(Do(n)),Bn(new Set([n]))),l?setTimeout(function(){Bt(n,i,{toggleIfSame:!1,sourceSide:c,onReady:function(){var e,i,r,l=a()||u;if(ji)setTimeout(function(){return Oo(n)},150);else if(l){var c=l.getBoundingClientRect();if(c.top>.8*window.innerHeight||c.top<100){var s=c.top-window.innerHeight/2;dn?(null===(e=oi.current)||void 0===e||e.scrollBy({top:s,behavior:"smooth"}),null===(i=Zn.current)||void 0===i||i.scrollBy({top:s,behavior:"smooth"})):null===(r=Un.current)||void 0===r||r.scrollBy({top:s,behavior:"smooth"})}}hi({open:!0,anchorEl:l,summary:t,displayImpact:o})}})},350):setTimeout(function(){Bt(n,i,{toggleIfSame:!1,sourceSide:c}),ji&&setTimeout(function(){return Oo(n)},150)},350)},[Bt,yi,hi,wt,Ot,ji,dn,Oo,Jn]),qo=c(function(){var e;if(!en)return null;var n=null===(e=null==en?void 0:en.id)||void 0===e?void 0:e.split(":")[0];for(var i in Wi){if((Wi[i]||[]).some(function(e){return e.id===n}))return i}return null},[en,Wi]),Go=u({id:null,triggerMs:null}),Vo=u(null);a(function(){if(null==en?void 0:en.id){var o=Number(en.trigger),r=Go.current;if((null==r?void 0:r.id)!==en.id||(null==r?void 0:r.triggerMs)!==o){if(!(en.id.includes(":")&&/:\d+$/.test(en.id)))return Go.current={id:en.id,triggerMs:o},void so(en.id);var l=en.id.split(":"),u=l[0],c=l[1],a=null!=c?c:"0",s="".concat(en.id,":").concat(o);Vo.current!==s&&(mi(),yi(),wt(),Bn(new Set),Fn([]),qn.current=[],Vo.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,c;if(!d){var s=function(){Go.current={id:en.id,triggerMs:o}},S=null,x=null;for(var R in Wi){var b=Wi[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))),C=Mi.findIndex(function(e){return e.id===S}),w=Hi.findIndex(function(e){return e.id===S}),_=-1===C&&-1!==w,I=h(Mi,y),E=h(Hi,y);if(I&&!E&&!_){var A=I.split("-"),k=Number(A[0]);if(dn){var D=null===(c=null===(l=Mi[k])||void 0===l?void 0:l.refIndexes)||void 0===c?void 0:c[0],O=Hi.findIndex(function(e){return e.selfIndex===D});-1!==O&&(k=O)}E=n([k],A.slice(1),!0).join("-")}if(I||E){var P=I?Number(I.split("-")[0]):C,j=E?Number(E.split("-")[0]):w,L=j>=0?j:E?Number(E.split("-")[0]):-1,N=Mi[P],M=Hi[L],H=N&&!N.title&&!N.content,z=M&&!M.title&&!M.content,W=_||(!I&&!!E||H&&!z);if(W){if(!(dn?!!ir.current["right-".concat(j)]:!!ir.current[String(j)])&&j>=0)return Dt(j,"right"),void(f=setTimeout(m,200))}else if(!(dn?!!ir.current["left-".concat(P)]:!!ir.current[String(P)])&&P>=0)return Dt(P,"left"),void(f=setTimeout(m,200));var q=I||"",G=E||"",V=y.map(function(e){return"".concat(e).concat(B).concat(a)}),K=V[0],Y=function(){for(var e,n,i=0,t=V;i<t.length;i++){var o=t[i],r=(null===(e=Zi.current[o])||void 0===e?void 0:e.current)||null,l=(null===(n=et.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(B).concat(q).concat(B).concat(G)};if(!g){Ot(J(K)),g=!0,v=0;var X=function(){var e=Y(),n=e.left,i=e.right;return W||!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 c=e();if(c&&0!==c.getBoundingClientRect().height){var a=c.getBoundingClientRect(),s=a.top,v=a.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=W||!Q&&!!Z,ie=ne?Z:Q,te=dn?ne?Zn.current:oi.current:Un.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==I?void 0:I.includes("-"))||(null==E?void 0:E.includes("-")),ce=function(){return i(void 0,void 0,void 0,function(){var n,i,o,r,l,u,c,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===(c=null===(u=x.evaluationResult)||void 0===u?void 0:u.deviations)||void 0===c?void 0:c[a])||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)})])},dn?[4,Promise.all([oi.current?l(T(oi.current),600):Promise.resolve(),Zn.current?l(T(Zn.current),600):Promise.resolve()])]:[3,2]):(r=ne?(null===(f=et.current[ue?U:j])||void 0===f?void 0:f.current)||Z:(null===(p=Zi.current[ue?U:P])||void 0===p?void 0:p.current)||Q,zo(r,function(){hi({open:!0,anchorEl:r,displayImpact:en.displayImpact,summary:e(e({},i),{evaluation_outputs:o})})},{skipScroll:!0}),null==nn||nn(),[2]));case 1:t.sent(),t.label=2;case 2:return _t.current(ee,!1,{toggleIfSame:!1,sourceSide:_?"right":"left",onReady:function(){var n,t,o,r;s();var l=ne?(null===(n=et.current[U])||void 0===n?void 0:n.current)||Z:(null===(t=Zi.current[U])||void 0===t?void 0:t.current)||Q,u=(null===(o=Zi.current[U])||void 0===o?void 0:o.current)||Q,c=(null===(r=et.current[U])||void 0===r?void 0:r.current)||Z;u&&(u.style.scrollMarginTop="150px",u.scrollIntoView({behavior:"smooth",block:"start"})),c&&(c.style.scrollMarginTop="150px",c.scrollIntoView({behavior:"smooth",block:"start"})),hi({open:!0,anchorEl:l,displayImpact:en.displayImpact,summary:e({},i)}),null==nn||nn()}}),[2]}})})};Math.abs(te.scrollTop-le)<=2?ce():F(te,le,ce)}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==en?void 0:en.id,null==en?void 0:en.trigger,null==en?void 0:en.displayImpact,Wi,Mi,Hi,dn,hi,so]),a(function(){var n,i,t;if(gi.open){var o=gi.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(Zi.current)||r(et.current);if(l){var u=(null===(i=et.current[l])||void 0===i?void 0:i.current)||(null===(t=Zi.current[l])||void 0===t?void 0:t.current);u&&u.isConnected&&hi(function(n){return e(e({},n),{anchorEl:u})})}}}},[gi.open,gi.anchorEl,En,wn,Ft]);var Ko=ci.open,Yo=ci.sectionIdx,Jo=ci.isOrphan,Xo=ci.badgeStyle,$o=ci.anchorEl,Uo=ci.sectionAnchorEl;a(function(){var n;if(Xe.isStreamingEnabled&&Ko&&null!=Yo&&Yo!==zt){var i="string"==typeof Yo?Yo.split(B)[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(Mi,i):null,r=i&&"string"==typeof i?t(Hi,i):null,l="number"==typeof Yo?Mi[Yo]||null:o||i&&((null===(n=null==We?void 0:We.nodes)||void 0===n?void 0:n[i])||(null==We?void 0:We[i]))||null,u="number"==typeof Yo?Hi[Yo]||null:r,c=lo($o,l,u,Yo,Jo,Xo);ai(function(n){return n.open?b(n.cognitiveData)===b(c.cognitiveData)&&b(n.deviationData)===b(c.deviationData)&&n.sectionTitle===c.sectionTitle&&n.refSectionTitle===c.refSectionTitle?n:e(e(e({},n),c),{open:!0,anchorEl:n.anchorEl,sectionAnchorEl:n.sectionAnchorEl}):n})}},[Ko,Yo,Jo,Xo,$o,Uo,Mi,Hi,lo]);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,c=e.parentNodeId,a=void 0===c?"":c,s=e.sectionOffset,d=e.rhsOrphanVisualIndexes;return o(K,{section:n,keyPath:i,depth:r,columnKey:u,parentNodeId:a,sectionOffset:s,rhsOrphanVisualIndexes:d})},[]),Zo=c(function(){return Mi.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&&dn?null:o(Y,{section:e,idx:n},null!==(i=null==e?void 0:e.id)&&void 0!==i?i:"left-row-".concat(n))})},[Mi]),er=c(function(){return Hi.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&&dn?null:o(J,{section:e,idx:n},null!==(i=null==e?void 0:e.id)&&void 0!==i?i:"right-row-".concat(n))})},[Hi]),nr=u(uo);a(function(){nr.current=uo},[uo]);var ir=u(Ft);a(function(){ir.current=Ft},[Ft]);var tr=u(Wo);a(function(){tr.current=Wo},[Wo]);var or=u(jo);a(function(){or.current=jo},[jo]);var rr=u(Dt);a(function(){rr.current=Dt},[Dt]);var lr=u(kt);a(function(){lr.current=kt},[kt]);var ur=u(Qo);a(function(){ur.current=Qo},[Qo]);var cr=u(wt);a(function(){cr.current=wt},[wt]);var ar=c(function(){return{isGuidelineMode:ji,maintainRelativeOrder:!!dn,showDeviationBadges:gn,isProposingFix:on,proposingFixNodeId:rn,isRedlineFlow:ln,isSideBySide:at,activeSideBySideSection:gt,scrollSyncLocked:En,toggleScrollSyncLocked:jt,summaryPopupAnchorEl:gi.anchorEl,connectedSections:wn,proposedSections:Mi,existingSections:Hi,deviationNumberRegistry:qi,deviationParentRegistry:Gi,treeData:We,displayConfig:Xe,resolvedMarkdownStyles:$n,unifiedNumbering:Lt,expandedSections:Ft,expandedSubSections:Et,setExpandedSubSections:At,getSectionCompareStyle:ho,getSubSectionCompareStyle:mo,getBadgeRef:ut,getSectionRowRef:rt,getSubSectionRef:lt,sectionLeftRefs:Ui,sectionRightRefs:Qi,sectionRowRefs:ot,sectionRightRowRefs:nt,subSectionLeftRefs:it,subSectionRightRefs:tt,lhsBadgeRefs:Zi,rhsBadgeRefs:et,openMoreFunctionsPopup:Jt,handleOpenSummaryPopup:Xt,openSummaryPopup:Xt,handleCloseSummaryPopup:$t,toggleSection:Ut,handleSubSectionToggle:Qt,renderSubSectionAccordion:Zt,resetSideBySide:eo,setConnectedSections:Bn,setConnectedLines:Fn,cachedConnectedPositions:qn,showDeviationNavigation:Mo,showOpenNodeRef:Ho,deviationNodeIdToView:null==en?void 0:en.id,deviationTargetParentId:qo,guidelinesData:cn,gptWebCitationConfig:an}},[ji,dn,gn,on,rn,ln,at,gt,En,jt,gi.anchorEl,wn,Mi,Hi,qi,Xe,$n,Lt,Ft,Et,At,ho,mo,ut,rt,lt,Mo,Ho,en,qo,cn,an]);return o($,e({value:ar},{children:r(d,e({ref:Qn,sx:{display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif',overflow:"visible",position:"relative"}},{children:[mn&&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(N,{})})),gi.open&&o(X,{open:gi.open,anchorEl:gi.anchorEl,containerEl:fo.current,clipTopEl:Ln.current,scrollContainerEl:Un.current,onClose:jo,summary:gi.summary,displayImpact:gi.displayImpact,isScrollLocked:En}),o(L,{open:si.open,anchorEl:si.anchorEl,maintainRelativeOrder:!!dn,sectionTitle:si.sectionTitle,referenceSectionTitle:si.refSectionTitle,onClose:Ci,onOpenCognitiveCompare:Ri,onOpenSideBySide:Po,onConnect:co,isConnected:Lo,isOrphan:!ji&&!!si.isOrphan,isGuidelineMode:ji,hasGuidelineMatches:si.hasGuidelineMatches}),ci.open&&o(j,{open:ci.open,popupRef:xi,position:vi,popupConfig:Ue,onClose:function(){fi(null),ai(function(n){return e(e({},n),{open:!1})}),Si(null)},markdownStyles:Ke,sectionTitle:Ai,referenceSectionTitle:Di,cognitiveData:ci.cognitiveData,anchorEl:ci.anchorEl,sectionAnchorEl:ci.sectionAnchorEl,scrollContainerEl:Un.current,badgeStyle:ci.badgeStyle,docData:ci.docData,deviationData:ci.deviationData,isLoading:ci.isLoading}),o(v,e({open:!!Rn,autoHideDuration:8e3,onClose:function(){return bn(null)},anchorOrigin:{vertical:"top",horizontal:"center"}},{children:o(f,e({onClose:function(){return bn(null)},severity:"error",sx:{width:"100%",whiteSpace:"pre-line"}},{children:Rn}))})),o(V,{componentHeaderText:ze,displayConfig:Xe,maintainRelativeOrder:dn,onCollapseAll:_o,showCollapseAll:Io,onToggleView:function(e){Sn(!0),setTimeout(function(){vn(!e),null==$e||$e(!e),An(!1),wt(),mi(),Bn(new Set),Fn([]),qn.current=[],requestAnimationFrame(function(){requestAnimationFrame(function(){setTimeout(function(){Sn(!1)},600)})})},50)}}),o(d,e({ref:Un,onScroll:Bo,sx:{flex:1,minHeight:0,pt:1.5,pb:1,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",overflowY:dn?"visible":"auto",borderTop:Mt&&Ht?"none":"1.5px solid #EEF0F4"}},{children:o(d,e({sx:e({display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"},dn?{flex:1}:{})},{children:r(d,e({ref:jn,sx:e({display:"grid",gridTemplateColumns:"minmax(0, 1fr) 180px minmax(0, 1fr)",gap:"100px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0},dn?{flex:1,overflow:"visible"}:{})},{children:[o(ne,{svgContainerRef:Pn,svgDimensions:wo,isResizing:vt,overallConnector:yo,rootDeviationStyle:Gt,lines:Ro,isSideBySide:at,activeSideBySideSection:gt,isArrowVisible:st,maintainRelativeOrder:dn,proposedSections:Mi,existingSections:Hi,cognitivePopup:ci,activeBadgeId:pi,closeCognitivePopup:yi,setActiveBadgeId:Si,openCognitivePopupFromState:bi,buildSectionPopupState:lo,connectedLines:In,isGuidelineMode:ji,pathRefs:Wn}),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)"},dn?{flex:1,overflow:"visible"}:{})},{children:[o(d,e({ref:Ln,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:Ti,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:Ti}))}))})),r(d,e({ref:oi,onScroll:Bo,sx:e({p:"12px",display:"flex",flexDirection:"column"},dn?{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:ii,style:{width:"100%",height:"0px",flexShrink:0}}),Ki&&Zo,o("div",{ref:ti,style:{width:"100%",height:"0px",flexShrink:0}})]}))]})),o(d,e({ref:fo,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(),ci.open&&pi===zt?yi():(Si(zt),bi(lo(n.currentTarget,{title:"",content:"",evaluationResult:Wt,cognitiveData:{section_id:"",decisioning:[],gap:[],relevance_score:0,isMissingRationale:!0}},null,zt,!0,e(e({},Gt),{label:""}))))},sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:"5px",top:"-8px",borderRadius:"20px",bgcolor:Gt.badgeBg,color:Gt.badgeText,border:"1px solid ".concat(Gt.badgeBorder),fontSize:"12px",fontWeight:600,whiteSpace:"nowrap",position:"relative",zIndex:1,pointerEvents:"auto",cursor:"pointer"}},{children:[null!=qt?qt:o(M,{}),o(d,e({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:o(x,{})})),o(S,{size:11,style:{transform:ci.open&&pi===zt?"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},dn?{flex:1,overflow:"visible",minHeight:0}:{})},{children:[pt&&o(R,{sections:11}),o(d,e({ref:Nn,sx:e({p:"8px",bgcolor:ji?"#F1F3F5":"#F7F8FA",borderBottom:"1px solid #D7DCE2",borderRadius:"8px 8px 0 0",display:"flex",alignItems:"center"},dn?e({maxHeight:"calc(100vh - 250px)",overflowY:"auto",overflowX:"hidden",minHeight:0},ji?{"&::-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:ji?r(h,e({value:Dn,onChange:function(e,n){return On(n)},variant:"fullWidth",TabIndicatorProps:{sx:{display:"none"}},sx:{width:"100%",minHeight:"36px","& .MuiTab-root":{minHeight:"36px",px:1,py:0,borderRadius:"8px",fontSize:"14px",lineHeight:1,fontWeight:500,textTransform:"none",color:"#374151",minWidth:0,transition:"background-color 160ms ease, box-shadow 160ms ease"},"& .Mui-selected":{color:"#374151",bgcolor:"#FFFFFF"}}},{children:[o(m,{label:o(p,e({title:Oi,placement:"top"},{children:o(d,e({component:"span",sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"block",width:"100%"}},{children:"Redline Guidelines"}))}))}),o(m,{label:o(p,e({title:"Web & GPT Sources",placement:"top"},{children:o(d,e({component:"span",sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"block",width:"100%"}},{children:"Web & GPT Sources"}))}))})]})):o(p,e({title:Oi,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:Oi}))}))})),r(d,e({ref:Zn,onScroll:Bo,sx:e({p:ji?"0px":"12px",display:"flex",flexDirection:"column"},dn?e(e({maxHeight:"calc(100vh - 250px)"},!ji&&{flex:1}),{overflowY:"auto",overflowX:"hidden",minHeight:0,ml:"-150px",pl:"165px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}):{})},{children:[o("div",{ref:ei,style:{width:"100%",height:"0px",flexShrink:0}}),ji?o(0===Dn?ie:te,{guidelinesData:cn,deviationData:Ze,connectedSections:wn,proposedSections:Mi}):Ki&&er,o("div",{ref:ni,style:{width:"100%",height:"0px",flexShrink:0}})]}))]}))]}))}))}))]}))}))};export{oe as default};
1
+ import{__assign as e,__spreadArray as n,__awaiter as i,__generator as t}from"tslib";import{jsx as o,jsxs as r}from"react/jsx-runtime";import{useState as l,useRef as u,useMemo as c,useEffect as a,useCallback as s}from"react";import{Box as d,Snackbar as v,Alert as f,Tooltip as p,Typography as g,Tabs as h,Tab as m}from"@mui/material";import{ChevronDown as S}from"lucide-react";import{ButtonCognitiveIcon as x}from"../../assests/svg/ButtonCognitiveIcon.js";import R from"./OverlayComponent.js";import{safeStringify as b,extractDeviationScore as y,generateColorPalette as C,findKeyPathByNodeId as w,DEVIATION_BADGE_SEPARATOR as B,hasMeaningfulRedlineTags as _,scrollAndHighlightClause as I,scrollAndWait as F,waitForScrollIdle as T}from"./CognitiveComparehelpers.js";import{SHARED_MARKDOWN_STYLES as E,DEFAULT_FIELD_CONFIG as A,DEFAULT_COMPARISON_CONFIG as k}from"./CognitiveCompareConfig.js";export{SHARED_MARKDOWN_STYLES}from"./CognitiveCompareConfig.js";import{DEFAULT_DEVIAION_COLOR as D,EMPTY_SUMMARY_POPUP_STATE as O,DEFAULT_COMPONENT_HEADER_TEXT as P}from"./CognitiveCompareConstants.js";import j from"./CognitivePopup.js";import L from"./MoreFunctionsPopup.js";import N from"./LoaderComponent.js";import M from"./components/ThreeDotsLoader.js";import{useCognitiveTreeData as H}from"./hooks/useCompareData.js";import{useComparePopups as z}from"./hooks/useComparePopups.js";import{useSectionRefs as W}from"./hooks/useSectionRefs.js";import{useAccordionState as q}from"./hooks/useAccordionState.js";import{useDeviationNavigation as G}from"./hooks/useDeviationNavigation.js";import V from"./components/CompareHeader.js";import K from"./components/SubSectionAccordion.js";import J from"./components/LHSSectionRow.js";import Y from"./components/RHSSectionRow.js";import X from"./components/CognitiveSummaryPopup.js";import{CompareContextProvider as $}from"./CompareContext.js";import{useStyleHelpers as U}from"./hooks/useStyles.js";import{useResizeHandler as Q}from"./hooks/useResizeHandler.js";import{useLinesCalculator as Z}from"./hooks/useLinesCalculator.js";import{useSideBySide as ee}from"./hooks/useSideBySide.js";import ne from"./components/SvgConnectors.js";import ie from"./Guidelines/components/GuidelinePanel.js";import te from"./Guidelines/components/WebGptPanel.js";var oe=function(oe){var re,le,ue,ce,ae,se,de,ve,fe,pe,ge,he,me,Se,xe,Re,be,ye,Ce,we,Be,_e,Ie,Fe,Te,Ee,Ae,ke,De,Oe,Pe,je,Le,Ne,Me,He=oe.componentHeaderText,ze=void 0===He?P:He,We=oe.treeData,qe=oe.comparisonConfig,Ge=oe.leftColumnTitleText,Ve=oe.rightColumnTitleText,Ke=oe.markdownStyles,Je=oe.resetTrigger,Ye=oe.displayConfig,Xe=void 0===Ye?{isHeaderVisible:!0,isToggleVisible:!0,maintainRelativeOrder:!1,isLoading:!0,showDeviationBadges:!1,enableDeviationSchemaBackwardCompatibility:!1,displayEmailNotifier:!0,isStreamingEnabled:!1}:Ye,$e=oe.onMaintainRelativeOrderChange,Ue=oe.popupConfig,Qe=oe.deviationData,Ze=void 0===Qe?{}:Qe,en=oe.deviationNodeIdToView,nn=oe.resetDeviationNodeId,tn=oe.isProposingFix,on=void 0!==tn&&tn,rn=oe.proposingFixNodeId,ln=oe.isRedlineFlow,un=oe.badgeStyleOverride,cn=oe.guidelinesData,an=oe.gptWebCitationConfig,sn=l(Xe.maintainRelativeOrder),dn=sn[0],vn=sn[1],fn=null!==(re=null==Xe?void 0:Xe.expandLevels)&&void 0!==re?re:0,pn=!!(null==Xe?void 0:Xe.expandAllSections),gn=!!dn||!!(null==Xe?void 0:Xe.showDeviationBadges),hn=l(!1),mn=hn[0],Sn=hn[1],xn=l(null),Rn=xn[0],bn=xn[1],yn=l(null===(ue=null!==(le=null==We?void 0:We.newEvaluationResult)&&void 0!==le?le:null==Xe?void 0:Xe.enableDeviationSchemaBackwardCompatibility)||void 0===ue||ue)[0],Cn=l(new Set),wn=Cn[0],Bn=Cn[1],_n=l([]),In=_n[0],Fn=_n[1],Tn=l(!1),En=Tn[0],An=Tn[1],kn=l(0),Dn=kn[0],On=kn[1],Pn=u(null),jn=u(null),Ln=u(null),Nn=u(null),Mn=u(null),Hn=u(!1),zn=u(null),Wn=u({}),qn=u([]),Gn=u(function(){}),Vn=u(null),Kn=u(function(){}),Jn=c(function(){return JSON.stringify(Ze||{})},[JSON.stringify(Ze)]),Yn=c(function(){return Ze||{}},[Jn]),Xn=c(function(){return(null==We?void 0:We.cognitive_decisioning)||{}},[We]),$n=c(function(){return e(e({},E),Ke)},[Ke]),Un=u(null),Qn=u(null),Zn=u(null),ei=u(null),ni=u(null),ii=u(null),ti=u(null),oi=u(null),ri=u(null),li=u(null),ui=z(Un),ci=ui.cognitivePopup,ai=ui.setCognitivePopup,si=ui.moreFunctions,di=ui.setMoreFunctions,vi=ui.position,fi=ui.setPosition,pi=ui.activeBadgeId,gi=ui.summaryPopup,hi=ui.setSummaryPopup,mi=ui.closeSummaryPopup,Si=ui.setActiveBadgeId,xi=ui.popupRef,Ri=ui.handleOpenCognitiveCompare,bi=ui.openCognitivePopupFromState,yi=ui.closeCognitivePopup,Ci=ui.closeMoreFunctionsPopup,wi=c(function(){var e,n,i,t,o,r,l;return{fields:null!==(e=null==qe?void 0:qe.fields)&&void 0!==e?e:A,thresholds:{high:null!==(i=null===(n=null==qe?void 0:qe.thresholds)||void 0===n?void 0:n.high)&&void 0!==i?i:k.thresholds.high,medium:null!==(o=null===(t=null==qe?void 0:qe.thresholds)||void 0===t?void 0:t.medium)&&void 0!==o?o:k.thresholds.medium,exact:null!==(l=null===(r=null==qe?void 0:qe.thresholds)||void 0===r?void 0:r.exact)&&void 0!==l?l:k.thresholds.exact}}},[qe]),Bi=l(null),_i=Bi[0];Bi[1];var Ii=null===(se=null===(ce=null==We?void 0:We.documents)||void 0===ce?void 0:ce[null===(ae=null==We?void 0:We.input_index_map)||void 0===ae?void 0:ae[0]])||void 0===se?void 0:se.title,Fi=null===(fe=null===(de=null==We?void 0:We.documents)||void 0===de?void 0:de[null===(ve=null==We?void 0:We.input_index_map)||void 0===ve?void 0:ve[1]])||void 0===fe?void 0:fe.title,Ti=b(Ge||Ii||"Uploaded Contract"),Ei=null===(me=null===(he=null===(pe=null==We?void 0:We.documents)||void 0===pe?void 0:pe[null===(ge=null==We?void 0:We.input_index_map)||void 0===ge?void 0:ge[0]])||void 0===he?void 0:he.metadata)||void 0===me?void 0:me.file_name,Ai=b(Ei),ki=null===(be=null===(Re=null===(Se=null==We?void 0:We.documents)||void 0===Se?void 0:Se[null===(xe=null==We?void 0:We.input_index_map)||void 0===xe?void 0:xe[1]])||void 0===Re?void 0:Re.metadata)||void 0===be?void 0:be.file_name,Di=b(ki),Oi=b(Ve||Fi||"Reference Template"),Pi=H(We,dn,Yn,wi,yn,cn),ji=Pi.isGuidelineMode,Li=Pi.activeProposed,Ni=Pi.existingRule,Mi=Pi.proposedSections,Hi=Pi.existingSections,zi=Pi.visibleFields,Wi=Pi.parentDeviationRecord,qi=Pi.deviationNumberRegistry,Gi=Pi.deviationParentRegistry,Vi=Pi.parseError;a(function(){Vi&&bn("Failed to load comparison: ".concat(Vi))},[Vi]);var Ki=Mi.length>0||Hi.length>0,Ji=c(function(){if(!ln)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)||"";_(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(Mi),i(Hi),"".concat(e,":").concat(n)},[ln,Mi,Hi]);a(function(){if(Mi.length||Hi.length)if(pn){var e={},n={},i=function(i,t){i.forEach(function(i,o){var r,l=dn?"".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(Mi,"left"),i(Hi,"right"),Tt(e),At(n)}else if(fn>0){var t={},o={},r=function(e,n,i){e.forEach(function(e,r){var l;if(i>=1){var u=dn?"".concat(n,"-").concat(r):String(r);t[u]=!0}var c=function(e,n,t){t>i||null==e||e.forEach(function(e,i){var r,l="".concat(n,"-").concat(i);o[l]=!0,(null===(r=e.subsections)||void 0===r?void 0:r.length)&&c(e.subsections,l,t+1)})};(null===(l=e.subsections)||void 0===l?void 0:l.length)&&i>=2&&c(e.subsections,String(r),2)})};r(Mi,"left",fn),r(Hi,"right",fn),Tt(t),At(o)}},[pn,fn,Mi,Hi,dn]);var Yi=W(zi.map(function(e){return e.key}),Math.max(Mi.length,Hi.length)),Xi=Yi.leftRefs,$i=Yi.rightRefs,Ui=Yi.sectionLeftRefs,Qi=Yi.sectionRightRefs,Zi=Yi.lhsBadgeRefs,et=Yi.rhsBadgeRefs,nt=Yi.sectionRightRowRefs,it=Yi.subSectionLeftRefs,tt=Yi.subSectionRightRefs,ot=Yi.sectionRowRefs,rt=Yi.getSectionRowRef,lt=Yi.getSubSectionRef,ut=Yi.getBadgeRef,ct=ee({isGuidelineMode:ji,maintainRelativeOrder:dn,proposedSections:Mi,existingSections:Hi,leftContainerRef:oi,rightContainerRef:Zn,scrollContainerRef:Un,sectionLeftRefs:Ui,sectionRightRefs:Qi,subSectionLeftRefs:it,subSectionRightRefs:tt,lhsBadgeRefs:Zi,rhsBadgeRefs:et,sectionRowRefs:ot,sectionRightRowRefs:nt,rhsTopSpacerRef:ei,rhsBottomSpacerRef:ni,lhsTopSpacerRef:ii,lhsBottomSpacerRef:ti,calculateLinesRef:Gn,setConnectedSections:Bn,setConnectedLines:Fn,cachedConnectedPositions:qn,closeMoreFunctionsPopup:Ci,setErrorToast:bn,moreFunctions:si,closeSummaryPopup:mi}),at=ct.isSideBySide,st=ct.isArrowVisible,dt=ct.setIsArrowVisible,vt=ct.isResizing,ft=ct.setIsResizing,pt=ct.isSideBySideLoading,gt=ct.activeSideBySideSection,ht=ct.scrollLock,mt=ct.sideBySideCacheRef,St=ct.isSideBySideRef,xt=ct.activeSideBySideRightSectionRef,Rt=ct.activeSideBySideSectionRef,bt=ct.sideBySideLineRef,yt=ct.highlightedClauseRefs,Ct=ct.clearClauseHighlight,wt=ct.resetSideBySide,Bt=ct.activateSideBySide,_t=u(Bt);a(function(){_t.current=Bt},[Bt]);var It=q({maintainRelativeOrder:!!dn,proposedSections:Mi,existingSections:Hi,activeSideBySideSection:gt,connectedSections:wn,resetSideBySide:wt,setConnectedSections:Bn,setConnectedLines:Fn,cachedConnectedPositions:qn,svgContainerRef:Pn,isAnimatingRef:Hn,animationTimerRef:zn,calculateLinesRef:Gn,sectionLeftRefs:Ui,sectionRightRefs:Qi,subSectionLeftRefs:it,subSectionRightRefs:tt}),Ft=It.expandedSections,Tt=It.setExpandedSections,Et=It.expandedSubSections,At=It.setExpandedSubSections,kt=It.handleSubSectionToggle,Dt=It.toggleSection,Ot=It.forceExpandCrossWiredSections,Pt=function(){var e,n;if(null!=gt){var i=null===(e=Ui.current[gt])||void 0===e?void 0:e.current,t=null===(n=Qi.current[gt])||void 0===n?void 0:n.current,o=Zn.current;if(i&&t&&o){var r=i.getBoundingClientRect(),l=t.getBoundingClientRect(),u=o.getBoundingClientRect(),c=r.top-u.top,a=l.top-u.top-c;o.scrollBy({top:a,behavior:"smooth"})}}},jt=s(function(e){null==e||e.stopPropagation(),An(function(e){var n=!e;return n&&requestAnimationFrame(function(){Pt()}),n})},[Pt]);a(function(){ln&&"off"!==Ji&&"0:0"!==Ji&&(mt.current=null,qn.current=[],requestAnimationFrame(function(){var e;null===(e=Gn.current)||void 0===e||e.call(Gn)}))},[ln,Ji]);var Lt=c(function(){var e=new Map,n=new Map,i=1;if(dn)Mi.forEach(function(n){!n.title&&!n.content||n.id&&e.set(n.id,i++)}),Hi.forEach(function(t){if(t.id&&!(!t.title&&!t.content)){var o=Mi.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(Mi.length,Hi.length),o=0;o<t;o++){var r=Mi[o],l=Hi[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}},[Mi,Hi,dn]),Nt=Ni.analysis,Mt=b(null===(Ce=null===(ye=null==Nt?void 0:Nt.rule_difference_comparison)||void 0===ye?void 0:ye.summary)||void 0===Ce?void 0:Ce.overall_summary),Ht=!!Mt.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),zt=null!==(we=null==We?void 0:We.base_root_id)&&void 0!==we?we:"-1";null==We||We[zt];var Wt=yn?null!==(je=null!==(De=Ze&&(null===(ke=null==Ze?void 0:Ze[zt])||void 0===ke?void 0:ke.evaluation_result))&&void 0!==De?De:null===(Pe=null===(Oe=null==We?void 0:We.nodes)||void 0===Oe?void 0:Oe[zt])||void 0===Pe?void 0:Pe.evaluation_result)&&void 0!==je?je:null:null!==(Ae=null!==(Ie=Ze&&(null===(_e=null===(Be=null==Ze?void 0:Ze[zt])||void 0===Be?void 0:Be.evaluation_result)||void 0===_e?void 0:_e[0]))&&void 0!==Ie?Ie:null===(Ee=null===(Te=null===(Fe=null==We?void 0:We.nodes)||void 0===Fe?void 0:Fe[zt])||void 0===Te?void 0:Te.evaluation_result)||void 0===Ee?void 0:Ee[0])&&void 0!==Ae?Ae:null,qt=y(Wt),Gt=C(null!==(Me=null===(Ne=null===(Le=null==Wt?void 0:Wt.evaluation_outputs)||void 0===Le?void 0:Le.metadata)||void 0===Ne?void 0:Ne.label_color)&&void 0!==Me?Me:D);if(un){var Vt=un(qt);Vt&&(Gt=e(e({},Gt),{badgeBg:Vt.bg,badgeText:Vt.text,badgeBorder:Vt.border}))}var Kt=u(wt);a(function(){Kt.current=wt},[wt]);var Jt=u(yi);a(function(){Jt.current=yi},[yi]);var Yt=s(function(e,n,i,t,o,r){return nr.current(e,n,i,t,o,r)},[]),Xt=s(function(e,n,i,t,o){return tr.current(e,n,i,t,o)},[]),$t=s(function(){return or.current()},[]),Ut=s(function(e,n){return rr.current(e,n)},[]),Qt=s(function(e){return lr.current(e)},[]),Zt=s(function(e){return ur.current(e)},[]),eo=s(function(){return cr.current()},[]),no=s(function(){var e,n;Ct(),null===(e=Kt.current)||void 0===e||e.call(Kt),An(!1),Bn(new Set),Fn([]),qn.current=[],bo([]),Co(null),hi(O),null===(n=Jt.current)||void 0===n||n.call(Jt),requestAnimationFrame(function(){var e;null===(e=Gn.current)||void 0===e||e.call(Gn)})},[]),io=u(no);a(function(){io.current=no},[no]),a(function(){Je&&io.current()},[Je]);var to=c(function(){return{documents:null==We?void 0:We.documents,input_index_map:null==We?void 0:We.input_index_map}},[JSON.stringify(null==We?void 0:We.documents),JSON.stringify(null==We?void 0:We.input_index_map)]),oo=u(We);a(function(){oo.current=We},[We]);var ro=u(Xn);a(function(){ro.current=Xn},[Xn]);var lo=s(function(n,i,t,o,r,l,u){var c,a,s,d,v,f,p,g,h,m,S=b(null==i?void 0:i.id)||b(null==t?void 0:t.id)||"",x=(S?null===(c=ro.current)||void 0===c?void 0:c[S]:null)||(null==i?void 0:i.cognitiveData)||(null==t?void 0:t.cognitiveData)||{section_id:S,decisioning:[],gap:[],relevance_score:0},R=null!==(s=null===(a=ot.current[o])||void 0===a?void 0:a.current)&&void 0!==s?s:null,y=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(B)))return u(l);var c=o.split(B)[1];if(!c)return l;var a=(null==i?void 0:i.evaluationResult)||(null==t?void 0:t.evaluationResult)||{},s=(null===(n=null==a?void 0:a.deviation_entries)||void 0===n?void 0:n[c])||(null===(r=null==a?void 0:a.deviations)||void 0===r?void 0:r[c])||null;return s?e(e(e({},a),s),{deviation_summary:(null==s?void 0:s.deviation_summary)||(null==a?void 0:a.deviation_summary),deviation_title:(null==s?void 0:s.deviation_title)||(null==a?void 0:a.deviation_title),deviation_impact:(null==s?void 0:s.deviation_impact)||(null==a?void 0:a.deviation_impact),deviation_explanation:(null==s?void 0:s.deviation_explanation)||(null==a?void 0:a.deviation_explanation),evaluation_outputs:(null==s?void 0:s.evaluation_outputs)||(null==a?void 0:a.evaluation_outputs),cognitive_decisioning:(null==s?void 0:s.cognitive_decisioning)||(null==a?void 0:a.cognitive_decisioning)}):u(l)}(),C=(null!==(f=null===(v=null===(d=null==y?void 0:y.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==y?void 0:y.cognitive_decisioning)||void 0===p?void 0:p.gaps_in_decision)||void 0===g?void 0:g.length)&&void 0!==h?h:0)>0,w=null!==(m=null==Xe?void 0:Xe.isLoading)&&void 0!==m&&m,_=!0;if(ji){var I=null==y?void 0:y.deviation_highlights;if(I&&"object"==typeof I)_=Object.values(I).some(function(e){return Array.isArray(e)&&e.length>0});else _=!1}return{isLoading:w&&!C,open:!0,sectionTitle:(null==i?void 0:i.title)?null==i?void 0:i.title:"No Counterpart",refSectionTitle:(null==t?void 0:t.title)?null==t?void 0:t.title:"No Counterpart",cognitiveData:x,anchorEl:n,sectionAnchorEl:R,badgeStyle:l||null,sectionIdx:o,docData:to,deviationData:y,isOrphan:!!r,hasGuidelineMatches:_}},[to,null==Xe?void 0:Xe.isLoading,ji]),uo=s(function(e,n,i,t,o,r){var l;if(e.stopPropagation(),si.open&&si.sectionIdx===o)Ci();else{var u=e.currentTarget,c="left";(null===(l=Zn.current)||void 0===l?void 0:l.contains(u))&&(c="right");Ct(),St.current&&wt(),Bn(new Set),Fn([]),qn.current=[],yi(),gi.open?jo():mi(),requestAnimationFrame(function(){var e=function(){var e,n,i,t;if("string"==typeof o&&o.includes(B)){var r=o.split(B),l="".concat(r[0]).concat(B).concat(r[1]);return"right"===c?null===(e=et.current[l])||void 0===e?void 0:e.current:null===(n=Zi.current[l])||void 0===n?void 0:n.current}return"right"===c?null===(i=et.current[o])||void 0===i?void 0:i.current:null===(t=Zi.current[o])||void 0===t?void 0:t.current}()||u;di(lo(e,n,t,o,i,r))})}},[si.open,si.sectionIdx,Ci,mi,lo]),co=s(function(){var e=si.sectionIdx;si.isOrphan,Ci(),mi(),null!==e&&(Ot(e),Ct(),St.current&&wt(),Fn([]),qn.current=[],ji&&null!==e&&On(Do(e)),Bn(function(n){return n.has(e)?new Set:new Set([e])}),setTimeout(function(){Gn.current&&Gn.current()},50))},[si.sectionIdx,si.isOrphan,Ci,mi,wt]),ao=s(function(){var e=Mn.current;if(e){Mn.current=null;var n=Mi.findIndex(function(n){return n.id===e}),i=Hi.findIndex(function(n){return n.id===e}),t=-1===n?w(Mi,e):null,o=-1===i?w(Hi,e):null,r=-1!==n?n:t?Number(t.split("-")[0]):-1,l=-1!==i?i:o?Number(o.split("-")[0]):-1,u=function(e,n,i,t){var o,r,l,u;return-1!==e?null!==(r=null===(o=i.current[e])||void 0===o?void 0:o.current)&&void 0!==r?r:null:n&&null!==(u=null===(l=t.current[n])||void 0===l?void 0:l.current)&&void 0!==u?u:null},c=function(e,n,i){void 0===i&&(i=30);var t=0,o=function(){var r=e();r&&0!==r.getBoundingClientRect().height?(yt.current.add(r),I(r,n)):t++<i&&requestAnimationFrame(o)};requestAnimationFrame(o)};if(dn)-1!==r&&oi.current&&c(function(){return u(n,t,Ui,it)},oi.current),-1!==l&&Zn.current&&c(function(){return u(i,o,Qi,tt)},Zn.current);else{var a=Un.current;if(!a)return;c(function(){return-1!==r?u(n,t,Ui,it):u(i,o,Qi,tt)},a)}}},[Mi,Hi,dn,Ui,Qi,it,tt,oi,Zn,Un]),so=s(function(n){if(n){Ct(),wt(),Bn(new Set),Fn([]),qn.current=[],mi(),yi();var i=Mi.findIndex(function(e){return e.id===n}),t=Hi.findIndex(function(e){return e.id===n}),o=-1===i?w(Mi,n):null,r=-1===t?w(Hi,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;Mn.current=n,Tt(function(n){var i,t=e({},n),o=!1;-1!==l&&(t[i=dn?"left-".concat(l):String(l)]||(t[i]=!0,o=!0));-1!==u&&(t[i=dn?"right-".concat(u):String(u)]||(t[i]=!0,o=!0));return o?t:n}),At(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(){Mn.current===n&&vo.current()})},50)}else console.warn('scrollToAndHighlightClause: nodeId "'.concat(n,'" not found'))}},[Mi,Hi,dn,Tt,At,wt,mi,yi]),vo=u(ao);a(function(){vo.current=ao},[ao]);var fo=u(null);a(function(){if(_i){var e=wi.fields.find(function(e){return e.analysisKey===_i||e.key===_i});if(e){var n=Xi.current[e.key]||$i.current[e.key];(null==n?void 0:n.current)&&setTimeout(function(){return n.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}}},[_i,wi.fields]);var po=s(function(e){var n,i,t,o,r,l,u,c,a,s=null===(n=null==Nt?void 0:Nt.rule_difference_comparison)||void 0===n?void 0:n.fields;if(!s||!s[e])return{score:0,relation:"",highlightsA:[],highlightsB:[],hasContent:!1};var d=s[e],v=(null==d?void 0:d.relation)||(null===(t=null===(i=null==d?void 0:d.highlights)||void 0===i?void 0:i.ruleA_spans)||void 0===t?void 0:t.length)||(null===(r=null===(o=null==d?void 0:d.highlights)||void 0===o?void 0:o.ruleB_spans)||void 0===r?void 0:r.length)||(null==d?void 0:d.mappings)&&d.mappings.length>0;if(d.mappings){var f=d.mappings[0]||{};return{score:d.score,relation:f.relation||"",highlightsA:(null===(l=f.highlights)||void 0===l?void 0:l.ruleA_spans)||[],highlightsB:(null===(u=f.highlights)||void 0===u?void 0:u.ruleB_spans)||[],hasContent:!!v}}return{score:d.score,relation:d.relation||"",highlightsA:(null===(c=d.highlights)||void 0===c?void 0:c.ruleA_spans)||[],highlightsB:(null===(a=d.highlights)||void 0===a?void 0:a.ruleB_spans)||[],hasContent:!!v}},[Nt]),go=U({proposedSections:Mi,existingSections:Hi,maintainRelativeOrder:dn,cognitiveMap:Xn,deviationData:Yn,treeData:We,resolvedComparisonConfig:wi,badgeStyleOverride:un}),ho=go.getSectionCompareStyle,mo=go.getSubSectionCompareStyle,So=go.getDeviationStyleByKey,xo=Z({containerRef:jn,leftContainerRef:oi,rightContainerRef:Zn,svgContainerRef:Pn,pathRefs:Wn,leftHeaderRef:Ln,rightHeaderRef:Nn,proposedSections:Mi,existingSections:Hi,visibleFields:zi,leftRefs:Xi,rightRefs:$i,sectionLeftRefs:Ui,sectionRightRefs:Qi,subSectionLeftRefs:it,subSectionRightRefs:tt,lhsBadgeRefs:Zi,rhsBadgeRefs:et,sectionRowRefs:ot,expandedSections:Ft,expandedSubSections:Et,connectedSections:wn,isSideBySide:at,activeSideBySideSection:gt,maintainRelativeOrder:dn,isGuidelineMode:ji,cognitiveMap:Xn,getSectionCompareStyle:ho,getSubSectionCompareStyle:mo,getDeviationStyleByKey:So,isArrowVisible:st,isAnimatingRef:Hn,isSideBySideRef:St,sideBySideCacheRef:mt,sideBySideLineRef:bt,activeSideBySideSectionRef:Rt,activeSideBySideRightSectionRef:xt,connectedLines:In,setConnectedLines:Fn,cachedConnectedPositions:qn,calculateLinesRef:Gn,resizeTimerRef:Vn,scrollLock:ht,scrollSyncLocked:En,handleResizeRef:Kn,activeProposed:Li,existingRule:Ni,analysisData:Nt,pendingScrollTargetRef:ri,pendingScrollCallbackRef:li,resolvedComparisonConfig:wi,getFieldData:po}),Ro=xo.lines,bo=xo.setLines,yo=xo.overallConnector,Co=xo.setOverallConnector,wo=xo.svgDimensions,Bo=xo.handleColumnScroll;a(function(){gi.anchorEl&&requestAnimationFrame(function(){requestAnimationFrame(function(){var e;null===(e=Gn.current)||void 0===e||e.call(Gn)})})},[gi.anchorEl,En]);var _o=s(function(){Ct(),An(!1),Tt({}),At({}),wt(),Bn(new Set),Fn([]),qn.current=[],mi(),yi(),Ci(),requestAnimationFrame(function(){Gn.current&&Gn.current()})},[Tt,At,wt,mi,yi,Ci]);a(function(){at||0!==wn.size||An(!1)},[at,wn]);var Io=c(function(){return Object.values(Ft).some(Boolean)||Object.values(Et).some(Boolean)},[Ft,Et]),Fo=u(null),To=u(0),Eo=u(0),Ao=u(0),ko=Q({timerRef:Fo,ruleComponentRef:Qn,scrollContainerRef:Un,containerRef:jn,maintainRelativeOrder:dn,proposedSections:Mi,existingSections:Hi,isSideBySideRef:St,activeSideBySideSectionRef:Rt,activeSideBySideRightSectionRef:xt,sectionRowRefs:ot,sectionRightRowRefs:nt,sectionLeftRefs:Ui,sectionRightRefs:Qi,subSectionLeftRefs:it,subSectionRightRefs:tt,lhsBadgeRefs:Zi,rhsBadgeRefs:et,leftContainerRef:oi,rightContainerRef:Zn,calculateLinesRef:Gn,handleResizeRef:Kn,setIsResizing:ft,setIsArrowVisible:dt,sideBySideCacheRef:mt,cachedConnectedPositions:qn}).handleResize;a(function(){Kn.current=ko},[ko,Kn]),a(function(){var e=function(e,n,i,t,o){n.current=e.getBoundingClientRect().width;var r=new ResizeObserver(function(e){null!==i.current&&cancelAnimationFrame(i.current),i.current=requestAnimationFrame(function(){var r,l,u;i.current=null;var c=e[e.length-1];if(c){var a=null!==(u=null===(l=null===(r=c.borderBoxSize)||void 0===r?void 0:r[0])||void 0===l?void 0:l.inlineSize)&&void 0!==u?u:c.contentRect.width;Math.abs(a-n.current)<1?o():(n.current=a,t())}})});return r.observe(e),r},n={current:null},i={current:null},t={current:null},o=[],r=[n,i,t];return Qn.current&&o.push(e(Qn.current,To,n,function(){return Kn.current()},function(){})),Un.current&&o.push(e(Un.current,Eo,i,function(){return Kn.current()},function(){return Gn.current()})),jn.current&&o.push(e(jn.current,Ao,t,function(){return Kn.current()},function(){return Gn.current()})),function(){o.forEach(function(e){return e.disconnect()}),r.forEach(function(e){null!==e.current&&(cancelAnimationFrame(e.current),e.current=null)})}},[]),a(function(){St.current=at},[at]),a(function(){Rt.current=gt},[gt]);var Do=s(function(e){var n,i,t,o,r,l="",u="0";if("number"==typeof e)l=(null===(n=Mi[e])||void 0===n?void 0:n.nodeId)||(null===(i=Mi[e])||void 0===i?void 0:i.id)||"";else{var c=String(e).split(B);l=c[0],u=c[1]||"0"}var a=null===(t=null==Yn?void 0:Yn[l])||void 0===t?void 0:t.evaluation_result,s=Array.isArray(a)?a[parseInt(u,10)]:null==a?void 0:a[u];return!1===(null===(r=null===(o=null==s?void 0:s.evaluation_outputs)||void 0===o?void 0:o.guideline_flag)||void 0===r?void 0:r.rulebook_used)?1:0},[Mi,Yn]),Oo=s(function(e){var n,i,t=document.querySelectorAll('[id^="guideline-target-"], [data-web-gpt-active="true"]'),o=oi.current,r=Zn.current,l="string"==typeof e&&e.includes(B)?"".concat(e.split(B)[0]).concat(B).concat(e.split(B)[1]):e,u=(null===(n=Zi.current[l])||void 0===n?void 0:n.current)||(null===(i=Zi.current[e])||void 0===i?void 0:i.current);if(t.length>0&&u&&o&&r){var c=t[0];ii.current&&(ii.current.style.height="0px"),ei.current&&(ei.current.style.height="0px"),ti.current&&(ti.current.style.height="0px"),ni.current&&(ni.current.style.height="0px"),requestAnimationFrame(function(){var e=u.getBoundingClientRect(),n=c.getBoundingClientRect(),i=o.getBoundingClientRect(),t=r.getBoundingClientRect(),l=o.scrollTop+(e.top-i.top)+e.height/2,a=r.scrollTop+(n.top-t.top)+n.height/2,s=l-i.height/2,d=Math.max(0,s),v=o.scrollHeight-o.clientHeight,f=d>v?d-v:0,p=i.top+l-d,g=t.top+a-p,h=0;g<0&&(h=Math.abs(g),g=0);var m=r.scrollHeight-r.clientHeight+h,S=g>m?g-m:0;ti.current&&(ti.current.style.height="".concat(f,"px")),ei.current&&(ei.current.style.height="".concat(h,"px")),ni.current&&(ni.current.style.height="".concat(S,"px")),requestAnimationFrame(function(){o.scrollTo({top:d,behavior:"smooth"}),r.scrollTo({top:g,behavior:"smooth"}),Gn.current&&setTimeout(function(){return Gn.current()},50)})})}},[B]),Po=s(function(){var e,n=si.sectionIdx,i=si.isOrphan;if(mi(),null!=n){var t="left";si.anchorEl&&(null===(e=Zn.current)||void 0===e?void 0:e.contains(si.anchorEl))&&(t="right"),Ot(n),ji&&(On(Do(n)),Bn(new Set([n]))),Bt(n,i,{sourceSide:t,onReady:function(){ji&&setTimeout(function(){return Oo(String(n))},150)}})}},[Bt,si.isOrphan,si.sectionIdx,si.anchorEl,mi,Ot,ji,Oo,Do]),jo=s(function(){mi(),wt(),Bn(new Set),Fn([]),qn.current=[]},[mi,wt]),Lo=null!==si.sectionIdx&&wn.has(si.sectionIdx),No=G({proposedSections:Mi,existingSections:Hi,parentDeviationRecord:Wi,expandedSections:Ft,maintainRelativeOrder:!!dn,scrollContainerRef:Un,leftContainerRef:oi,rightContainerRef:Zn,lhsBadgeRefs:Zi,rhsBadgeRefs:et}),Mo=No.showDeviationNavigation,Ho=No.showOpenNodeRef,zo=No.adjustScrollForPopup,Wo=s(function(e,n,i,t,o){var r,l="string"==typeof t?b(t).trim():b(null==t?void 0:t.deviation_summary).trim(),u=e.currentTarget;yi();var c="left";(null===(r=Zn.current)||void 0===r?void 0:r.contains(u))&&(c="right");var a=function(){var e,i,t,o;if("string"==typeof n&&n.includes(B)){var r=n.split(B),l="".concat(r[0]).concat(B).concat(r[1]);return"right"===c?null===(e=et.current[l])||void 0===e?void 0:e.current:null===(i=Zi.current[l])||void 0===i?void 0:i.current}return"right"===c?null===(t=et.current[n])||void 0===t?void 0:t.current:null===(o=Zi.current[n])||void 0===o?void 0:o.current};if(i&&!ji)return wt(),Bn(new Set),Fn([]),qn.current=[],void(l&&(Ot(n),requestAnimationFrame(function(){var e=a()||u;e&&(e.getBoundingClientRect().top>.8*window.innerHeight&&e.scrollIntoView({behavior:"smooth",block:"center"}));hi({open:!0,anchorEl:e,summary:t,displayImpact:o})})));Ot(n),ji&&(On(Do(n)),Bn(new Set([n]))),l?setTimeout(function(){Bt(n,i,{toggleIfSame:!1,sourceSide:c,onReady:function(){var e,i,r,l=a()||u;if(ji)setTimeout(function(){return Oo(n)},150);else if(l){var c=l.getBoundingClientRect();if(c.top>.8*window.innerHeight||c.top<100){var s=c.top-window.innerHeight/2;dn?(null===(e=oi.current)||void 0===e||e.scrollBy({top:s,behavior:"smooth"}),null===(i=Zn.current)||void 0===i||i.scrollBy({top:s,behavior:"smooth"})):null===(r=Un.current)||void 0===r||r.scrollBy({top:s,behavior:"smooth"})}}hi({open:!0,anchorEl:l,summary:t,displayImpact:o})}})},350):setTimeout(function(){Bt(n,i,{toggleIfSame:!1,sourceSide:c}),ji&&setTimeout(function(){return Oo(n)},150)},350)},[Bt,yi,hi,wt,Ot,ji,dn,Oo,Yn]),qo=c(function(){var e;if(!en)return null;var n=null===(e=null==en?void 0:en.id)||void 0===e?void 0:e.split(":")[0];for(var i in Wi){if((Wi[i]||[]).some(function(e){return e.id===n}))return i}return null},[en,Wi]),Go=u({id:null,triggerMs:null}),Vo=u(null);a(function(){if(null==en?void 0:en.id){var o=Number(en.trigger),r=Go.current;if((null==r?void 0:r.id)!==en.id||(null==r?void 0:r.triggerMs)!==o){if(en.id.includes(":")&&/:\d+$/.test(en.id)){var l=en.id.split(":"),u=l[0],c=l[1],a=null!=c?c:"0",s="".concat(en.id,":").concat(o);Vo.current!==s&&(mi(),yi(),wt(),Bn(new Set),Fn([]),qn.current=[],Vo.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,c;if(!d){var s=function(){Go.current={id:en.id,triggerMs:o}},S=null,x=null;for(var R in Wi){var b=Wi[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))),C=Mi.findIndex(function(e){return e.id===S}),w=Hi.findIndex(function(e){return e.id===S}),_=-1===C&&-1!==w,I=h(Mi,y),E=h(Hi,y);if(I&&!E&&!_){var A=I.split("-"),k=Number(A[0]);if(dn){var D=null===(c=null===(l=Mi[k])||void 0===l?void 0:l.refIndexes)||void 0===c?void 0:c[0],O=Hi.findIndex(function(e){return e.selfIndex===D});-1!==O&&(k=O)}E=n([k],A.slice(1),!0).join("-")}if(I||E){var P=I?Number(I.split("-")[0]):C,j=E?Number(E.split("-")[0]):w,L=j>=0?j:E?Number(E.split("-")[0]):-1,N=Mi[P],M=Hi[L],H=N&&!N.title&&!N.content,z=M&&!M.title&&!M.content,W=_||(!I&&!!E||H&&!z);if(W){if(!(dn?!!ir.current["right-".concat(j)]:!!ir.current[String(j)])&&j>=0)return Dt(j,"right"),void(f=setTimeout(m,200))}else if(!(dn?!!ir.current["left-".concat(P)]:!!ir.current[String(P)])&&P>=0)return Dt(P,"left"),void(f=setTimeout(m,200));var q=I||"",G=E||"",V=y.map(function(e){return"".concat(e).concat(B).concat(a)}),K=V[0],J=function(){for(var e,n,i=0,t=V;i<t.length;i++){var o=t[i],r=(null===(e=Zi.current[o])||void 0===e?void 0:e.current)||null,l=(null===(n=et.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}},Y=function(e){return"".concat(e).concat(B).concat(q).concat(B).concat(G)};if(!g){Ot(Y(K)),g=!0,v=0;var X=function(){var e=J(),n=e.left,i=e.right;return W||!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 c=e();if(c&&0!==c.getBoundingClientRect().height){var a=c.getBoundingClientRect(),s=a.top,v=a.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 $=J(),U=$.refId,Q=$.left,Z=$.right,ee=Y(U);if(Q||Z){var ne=W||!Q&&!!Z,ie=ne?Z:Q,te=dn?ne?Zn.current:oi.current:Un.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==I?void 0:I.includes("-"))||(null==E?void 0:E.includes("-")),ce=function(){return i(void 0,void 0,void 0,function(){var n,i,o,r,l,u,c,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===(c=null===(u=x.evaluationResult)||void 0===u?void 0:u.deviations)||void 0===c?void 0:c[a])||x,o=(null===(v=x.evaluationResult)||void 0===v?void 0:v.evaluation_outputs)||x.evaluation_outputs,!!Q&&!!Z||ji?(l=function(e,n){return Promise.race([e,new Promise(function(e){return setTimeout(e,n)})])},dn?[4,Promise.all([oi.current?l(T(oi.current),600):Promise.resolve(),Zn.current?l(T(Zn.current),600):Promise.resolve()])]:[3,2]):(r=ne?(null===(f=et.current[ue?U:j])||void 0===f?void 0:f.current)||Z:(null===(p=Zi.current[ue?U:P])||void 0===p?void 0:p.current)||Q,zo(r,function(){hi({open:!0,anchorEl:r,displayImpact:en.displayImpact,summary:e(e({},i),{evaluation_outputs:o})})},{skipScroll:!0}),null==nn||nn(),[2]));case 1:t.sent(),t.label=2;case 2:return ji&&(On(Do(ee)),Bn(new Set([ee]))),_t.current(ee,!1,{toggleIfSame:!1,sourceSide:_?"right":"left",onReady:function(){var n,t,o,r;s();var l=ne?(null===(n=et.current[U])||void 0===n?void 0:n.current)||Z:(null===(t=Zi.current[U])||void 0===t?void 0:t.current)||Q;if(ji)setTimeout(function(){return Oo(ee)},150);else{var u=(null===(o=Zi.current[U])||void 0===o?void 0:o.current)||Q,c=(null===(r=et.current[U])||void 0===r?void 0:r.current)||Z;u&&(u.style.scrollMarginTop="150px",u.scrollIntoView({behavior:"smooth",block:"start"})),c&&(c.style.scrollMarginTop="150px",c.scrollIntoView({behavior:"smooth",block:"start"}))}hi({open:!0,anchorEl:l,displayImpact:en.displayImpact,summary:e({},i)}),null==nn||nn()}}),[2]}})})};Math.abs(te.scrollTop-le)<=2?ce():F(te,le,ce)}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()}}Go.current={id:en.id,triggerMs:o},so(en.id);var S=Mi.findIndex(function(e){return e.id===en.id}),x=Hi.findIndex(function(e){return e.id===en.id});-1===S&&-1===x||setTimeout(function(){var e=-1!==S?S:x,n=-1===S;ji&&On(Do(e)),Bn(new Set([e])),_t.current(e,n,{sourceSide:n?"right":"left",onReady:function(){ji&&setTimeout(function(){return Oo(String(e))},150)}})},400)}}},[null==en?void 0:en.id,null==en?void 0:en.trigger,null==en?void 0:en.displayImpact,Wi,Mi,Hi,dn,hi,so,ji,Do,Oo]),a(function(){var n,i,t;if(gi.open){var o=gi.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(Zi.current)||r(et.current);if(l){var u=(null===(i=et.current[l])||void 0===i?void 0:i.current)||(null===(t=Zi.current[l])||void 0===t?void 0:t.current);u&&u.isConnected&&hi(function(n){return e(e({},n),{anchorEl:u})})}}}},[gi.open,gi.anchorEl,En,wn,Ft]);var Ko=ci.open,Jo=ci.sectionIdx,Yo=ci.isOrphan,Xo=ci.badgeStyle,$o=ci.anchorEl,Uo=ci.sectionAnchorEl;a(function(){var n;if(Xe.isStreamingEnabled&&Ko&&null!=Jo&&Jo!==zt){var i="string"==typeof Jo?Jo.split(B)[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(Mi,i):null,r=i&&"string"==typeof i?t(Hi,i):null,l="number"==typeof Jo?Mi[Jo]||null:o||i&&((null===(n=null==We?void 0:We.nodes)||void 0===n?void 0:n[i])||(null==We?void 0:We[i]))||null,u="number"==typeof Jo?Hi[Jo]||null:r,c=lo($o,l,u,Jo,Yo,Xo);ai(function(n){return n.open?b(n.cognitiveData)===b(c.cognitiveData)&&b(n.deviationData)===b(c.deviationData)&&n.sectionTitle===c.sectionTitle&&n.refSectionTitle===c.refSectionTitle?n:e(e(e({},n),c),{open:!0,anchorEl:n.anchorEl,sectionAnchorEl:n.sectionAnchorEl}):n})}},[Ko,Jo,Yo,Xo,$o,Uo,Mi,Hi,lo]);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,c=e.parentNodeId,a=void 0===c?"":c,s=e.sectionOffset,d=e.rhsOrphanVisualIndexes;return o(K,{section:n,keyPath:i,depth:r,columnKey:u,parentNodeId:a,sectionOffset:s,rhsOrphanVisualIndexes:d})},[]),Zo=c(function(){return Mi.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&&dn?null:o(J,{section:e,idx:n},null!==(i=null==e?void 0:e.id)&&void 0!==i?i:"left-row-".concat(n))})},[Mi]),er=c(function(){return Hi.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&&dn?null:o(Y,{section:e,idx:n},null!==(i=null==e?void 0:e.id)&&void 0!==i?i:"right-row-".concat(n))})},[Hi]),nr=u(uo);a(function(){nr.current=uo},[uo]);var ir=u(Ft);a(function(){ir.current=Ft},[Ft]);var tr=u(Wo);a(function(){tr.current=Wo},[Wo]);var or=u(jo);a(function(){or.current=jo},[jo]);var rr=u(Dt);a(function(){rr.current=Dt},[Dt]);var lr=u(kt);a(function(){lr.current=kt},[kt]);var ur=u(Qo);a(function(){ur.current=Qo},[Qo]);var cr=u(wt);a(function(){cr.current=wt},[wt]);var ar=c(function(){return{isGuidelineMode:ji,maintainRelativeOrder:!!dn,showDeviationBadges:gn,isProposingFix:on,proposingFixNodeId:rn,isRedlineFlow:ln,isSideBySide:at,activeSideBySideSection:gt,scrollSyncLocked:En,toggleScrollSyncLocked:jt,summaryPopupAnchorEl:gi.anchorEl,connectedSections:wn,proposedSections:Mi,existingSections:Hi,deviationNumberRegistry:qi,deviationParentRegistry:Gi,treeData:We,displayConfig:Xe,resolvedMarkdownStyles:$n,unifiedNumbering:Lt,expandedSections:Ft,expandedSubSections:Et,setExpandedSubSections:At,getSectionCompareStyle:ho,getSubSectionCompareStyle:mo,getBadgeRef:ut,getSectionRowRef:rt,getSubSectionRef:lt,sectionLeftRefs:Ui,sectionRightRefs:Qi,sectionRowRefs:ot,sectionRightRowRefs:nt,subSectionLeftRefs:it,subSectionRightRefs:tt,lhsBadgeRefs:Zi,rhsBadgeRefs:et,openMoreFunctionsPopup:Yt,handleOpenSummaryPopup:Xt,openSummaryPopup:Xt,handleCloseSummaryPopup:$t,toggleSection:Ut,handleSubSectionToggle:Qt,renderSubSectionAccordion:Zt,resetSideBySide:eo,setConnectedSections:Bn,setConnectedLines:Fn,cachedConnectedPositions:qn,showDeviationNavigation:Mo,showOpenNodeRef:Ho,deviationNodeIdToView:null==en?void 0:en.id,deviationTargetParentId:qo,guidelinesData:cn,gptWebCitationConfig:an}},[ji,dn,gn,on,rn,ln,at,gt,En,jt,gi.anchorEl,wn,Mi,Hi,qi,Xe,$n,Lt,Ft,Et,At,ho,mo,ut,rt,lt,Mo,Ho,en,qo,cn,an]),sr=b(ci.sectionTitle||Ai||Ti),dr=b(ji?Di||Oi||ci.refSectionTitle:ci.refSectionTitle||Di||Oi);return o($,e({value:ar},{children:r(d,e({ref:Qn,sx:{display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif',overflow:"visible",position:"relative"}},{children:[mn&&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(N,{})})),gi.open&&o(X,{open:gi.open,anchorEl:gi.anchorEl,containerEl:fo.current,clipTopEl:Ln.current,scrollContainerEl:Un.current,onClose:jo,summary:gi.summary,displayImpact:gi.displayImpact,isScrollLocked:En}),o(L,{open:si.open,anchorEl:si.anchorEl,maintainRelativeOrder:!!dn,sectionTitle:si.sectionTitle,referenceSectionTitle:si.refSectionTitle,onClose:Ci,onOpenCognitiveCompare:Ri,onOpenSideBySide:Po,onConnect:co,isConnected:Lo,isOrphan:!ji&&!!si.isOrphan,isGuidelineMode:ji,hasGuidelineMatches:si.hasGuidelineMatches}),ci.open&&o(j,{open:ci.open,popupRef:xi,position:vi,popupConfig:Ue,onClose:function(){fi(null),ai(function(n){return e(e({},n),{open:!1})}),Si(null)},markdownStyles:Ke,sectionTitle:sr,referenceSectionTitle:dr,cognitiveData:ci.cognitiveData,anchorEl:ci.anchorEl,sectionAnchorEl:ci.sectionAnchorEl,scrollContainerEl:Un.current,badgeStyle:ci.badgeStyle,docData:ci.docData,deviationData:ci.deviationData,isLoading:ci.isLoading}),o(v,e({open:!!Rn,autoHideDuration:8e3,onClose:function(){return bn(null)},anchorOrigin:{vertical:"top",horizontal:"center"}},{children:o(f,e({onClose:function(){return bn(null)},severity:"error",sx:{width:"100%",whiteSpace:"pre-line"}},{children:Rn}))})),o(V,{componentHeaderText:ze,displayConfig:Xe,maintainRelativeOrder:dn,onCollapseAll:_o,showCollapseAll:Io,onToggleView:function(e){Sn(!0),setTimeout(function(){vn(!e),null==$e||$e(!e),An(!1),wt(),mi(),Bn(new Set),Fn([]),qn.current=[],requestAnimationFrame(function(){requestAnimationFrame(function(){setTimeout(function(){Sn(!1)},600)})})},50)}}),o(d,e({ref:Un,onScroll:Bo,sx:{flex:1,minHeight:0,pt:1.5,pb:1,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",overflowY:dn?"visible":"auto",borderTop:Mt&&Ht?"none":"1.5px solid #EEF0F4"}},{children:o(d,e({sx:e({display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"},dn?{flex:1}:{})},{children:r(d,e({ref:jn,sx:e({display:"grid",gridTemplateColumns:"minmax(0, 1fr) 180px minmax(0, 1fr)",gap:"100px",maxWidth:"1200px",width:"100%",position:"relative",minHeight:0},dn?{flex:1,overflow:"visible"}:{})},{children:[o(ne,{svgContainerRef:Pn,svgDimensions:wo,isResizing:vt,overallConnector:yo,rootDeviationStyle:Gt,lines:Ro,isSideBySide:at,activeSideBySideSection:gt,isArrowVisible:st,maintainRelativeOrder:dn,proposedSections:Mi,existingSections:Hi,cognitivePopup:ci,activeBadgeId:pi,closeCognitivePopup:yi,setActiveBadgeId:Si,openCognitivePopupFromState:bi,buildSectionPopupState:lo,connectedLines:In,isGuidelineMode:ji,pathRefs:Wn}),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)"},dn?{flex:1,overflow:"visible"}:{})},{children:[o(d,e({ref:Ln,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:Ti,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:Ti}))}))})),r(d,e({ref:oi,onScroll:Bo,sx:e({p:"12px",display:"flex",flexDirection:"column"},dn?{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:ii,style:{width:"100%",height:"0px",flexShrink:0}}),Ki&&Zo,o("div",{ref:ti,style:{width:"100%",height:"0px",flexShrink:0}})]}))]})),o(d,e({ref:fo,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(),ci.open&&pi===zt?yi():(Si(zt),bi(lo(n.currentTarget,{title:"",content:"",evaluationResult:Wt,cognitiveData:{section_id:"",decisioning:[],gap:[],relevance_score:0,isMissingRationale:!0}},null,zt,!0,e(e({},Gt),{label:""}))))},sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:"5px",top:"-8px",borderRadius:"20px",bgcolor:Gt.badgeBg,color:Gt.badgeText,border:"1px solid ".concat(Gt.badgeBorder),fontSize:"12px",fontWeight:600,whiteSpace:"nowrap",position:"relative",zIndex:1,pointerEvents:"auto",cursor:"pointer"}},{children:[null!=qt?qt:o(M,{}),o(d,e({component:"span",sx:{width:14,height:14,display:"flex",alignItems:"center","& svg":{width:"14px",height:"14px"}}},{children:o(x,{})})),o(S,{size:11,style:{transform:ci.open&&pi===zt?"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},dn?{flex:1,overflow:"visible",minHeight:0}:{})},{children:[pt&&o(R,{sections:11}),o(d,e({ref:Nn,sx:e({p:"8px",bgcolor:ji?"#F1F3F5":"#F7F8FA",borderBottom:"1px solid #D7DCE2",borderRadius:"8px 8px 0 0",display:"flex",alignItems:"center"},dn?e({maxHeight:"calc(100vh - 250px)",overflowY:"auto",overflowX:"hidden",minHeight:0},ji?{"&::-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:ji?r(h,e({value:Dn,onChange:function(e,n){return On(n)},variant:"fullWidth",TabIndicatorProps:{sx:{display:"none"}},sx:{width:"100%",minHeight:"36px","& .MuiTab-root":{minHeight:"36px",px:1,py:0,borderRadius:"8px",fontSize:"14px",lineHeight:1,fontWeight:500,textTransform:"none",color:"#374151",minWidth:0,transition:"background-color 160ms ease, box-shadow 160ms ease"},"& .Mui-selected":{color:"#374151",bgcolor:"#FFFFFF"}}},{children:[o(m,{label:o(p,e({title:Oi,placement:"top"},{children:o(d,e({component:"span",sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"block",width:"100%"}},{children:"Redline Guidelines"}))}))}),o(m,{label:o(p,e({title:"Web & GPT Sources",placement:"top"},{children:o(d,e({component:"span",sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"block",width:"100%"}},{children:"Web & GPT Sources"}))}))})]})):o(p,e({title:Oi,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:Oi}))}))})),r(d,e({ref:Zn,onScroll:Bo,sx:e({p:ji?"0px":"12px",display:"flex",flexDirection:"column"},dn?e(e({maxHeight:"calc(100vh - 250px)"},!ji&&{flex:1}),{overflowY:"auto",overflowX:"hidden",minHeight:0,ml:"-150px",pl:"165px","&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}):{})},{children:[o("div",{ref:ei,style:{width:"100%",height:"0px",flexShrink:0}}),ji?o(0===Dn?ie:te,{guidelinesData:cn,deviationData:Ze,connectedSections:wn,proposedSections:Mi}):Ki&&er,o("div",{ref:ni,style:{width:"100%",height:"0px",flexShrink:0}})]}))]}))]}))}))}))]}))}))};export{oe as default};
2
2
  //# sourceMappingURL=CognitiveCompare.js.map
@@ -1,2 +1,2 @@
1
- import{__assign as o}from"tslib";import{jsxs as i,Fragment as n,jsx as t}from"react/jsx-runtime";import{useMemo as e,useState as r,useEffect as l}from"react";import{Box as a,Typography as c,IconButton as s,Tooltip as d}from"@mui/material";import{X as p}from"lucide-react";import v from"react-dom";import x from"../../assests/svg/SparkleIcon.js";import{SHARED_MARKDOWN_STYLES as h,DEFAULT_POPUP_CONFIG as u}from"./CognitiveCompareConfig.js";import b from"./CitationRenderer.js";var g=10,f=function(f){var m,y,w,F,k,S,C,D,_,E,R,z,W,I,T,j,A,B,L,H,M=f.open,O=f.onClose,G=f.sectionTitle,N=f.referenceSectionTitle,P=f.cognitiveData,Y=f.relevanceScore,q=f.anchorEl,J=f.badgeStyle,K=f.popupRef,Q=f.position,U=f.markdownStyles,V=f.docData,X=f.popupConfig,Z=f.deviationData,$=void 0===Z?null:Z,oo=f.isLoading,io=o(o({},h),U),no=e(function(){var i,n;return o(o(o({},u),X),{tabs:{deviation:o(o({},u.tabs.deviation),null===(i=null==X?void 0:X.tabs)||void 0===i?void 0:i.deviation),association:o(o({},u.tabs.association),null===(n=null==X?void 0:X.tabs)||void 0===n?void 0:n.association)},sectionTitles:o(o({},u.sectionTitles),null==X?void 0:X.sectionTitles)})},[X]),to=null==P?void 0:P.isMissingRationale,eo=r(to?no.tabs.deviation.key:no.tabs.association.key),ro=eo[0],lo=eo[1];l(function(){M&&lo(to?no.tabs.deviation.key:no.tabs.association.key)},[M,to,no.tabs.deviation.key,no.tabs.association.key]);var ao=e(function(){if(!J)return{border:no.accentColor,shadow:"".concat(no.accentColor,"2E")};var o=J.badgeText;return"#9F1239"===o||"#B42318"===o?{border:"#E11D48",shadow:"rgba(225,29,72,0.15)"}:"#1D4ED8"===o?{border:"#3B82F6",shadow:"rgba(59,130,246,0.15)"}:"#A16207"===o?{border:"#F59E0B",shadow:"rgba(245,158,11,0.15)"}:{border:no.accentColor,shadow:"".concat(no.accentColor,"2E")}},[J,no.accentColor]);l(function(){if(M){var o=function(o){var i;(null===(i=K.current)||void 0===i?void 0:i.contains(o.target))||(null==q?void 0:q.contains(o.target))||O()};return document.addEventListener("mousedown",o),function(){return document.removeEventListener("mousedown",o)}}},[M,O,q,K]);var co=to?[]:[no.tabs.deviation,no.tabs.association];if(1===co.length&&co[0].key===no.tabs.deviation.key)return null;if(!M||!P)return null;var so=null!==(w=null!==(y=ro===no.tabs.deviation.key?null===(m=null==$?void 0:$.cognitive_decisioning)||void 0===m?void 0:m.decision_strength:P.relevance_score)&&void 0!==y?y:Y)&&void 0!==w?w:0,po=P.decisioning,vo=Array.isArray(po)?po:"string"==typeof po&&po.trim()?[po]:[],xo=P.gap,ho=Array.isArray(xo)?xo:"string"==typeof xo&&xo.trim()?[xo]:[],uo=Q?Q.left-150:-9999,bo=(null!==(F=null==Q?void 0:Q.arrowLeft)&&void 0!==F?F:60)+150,go=i(a,o({ref:K,sx:{position:"fixed",top:null!==(k=null==Q?void 0:Q.top)&&void 0!==k?k:-9999,left:uo,zIndex:9999,width:"".concat(1050,"px"),maxWidth:"min(".concat(1050,"px, calc(100vw - ").concat(uo>0?uo:0,"px - ").concat(12,"px))"),bgcolor:"#FFFFFF",borderRadius:"14px",border:"1.5px solid ".concat(ao.border),boxShadow:"0px 8px 32px ".concat(ao.shadow,", 0px 0px 0px 3px ").concat(ao.shadow),overflow:"visible",display:"flex",flexDirection:"column",maxHeight:(null==Q?void 0:Q.maxHeight)?"min(60vh, ".concat(Q.maxHeight,"px)"):"60vh",visibility:Q?"visible":"hidden"}},{children:[Q&&(Q.openAbove?i(n,{children:[t(a,{sx:{position:"absolute",bottom:-11,left:bo-g,width:0,height:0,borderLeft:"".concat(g,"px solid transparent"),borderRight:"".concat(g,"px solid transparent"),borderTop:"".concat(11,"px solid ").concat(ao.border),zIndex:1}}),t(a,{sx:{position:"absolute",bottom:-9,left:bo-g+1,width:0,height:0,borderLeft:"".concat(9,"px solid transparent"),borderRight:"".concat(9,"px solid transparent"),borderTop:"".concat(g,"px solid #FFFFFF"),zIndex:2}})]}):i(n,{children:[t(a,{sx:{position:"absolute",top:-11,left:bo-g,width:0,height:0,borderLeft:"".concat(g,"px solid transparent"),borderRight:"".concat(g,"px solid transparent"),borderBottom:"".concat(11,"px solid ").concat(ao.border),zIndex:1}}),t(a,{sx:{position:"absolute",top:-9,left:bo-g+1,width:0,height:0,borderLeft:"".concat(9,"px solid transparent"),borderRight:"".concat(9,"px solid transparent"),borderBottom:"".concat(g,"px solid #FFFFFF"),zIndex:2}})]})),i(a,o({sx:{px:2.5,pt:2,pb:1.5,display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:2,flexShrink:0}},{children:[i(a,o({sx:{flex:1,minWidth:0}},{children:[("no counterpart"!==G||"no counterpart"!==N)&&i(c,o({sx:{fontSize:"16px",fontWeight:600,color:"#101828",lineHeight:1.3,display:"flex",alignItems:"center",gap:1,flexWrap:"nowrap",overflow:"hidden",width:"100%"}},{children:[t(a,o({component:"span",title:G,sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:"0 1 auto",maxWidth:"calc(50% - 16px)",minWidth:0}},{children:G})),t(a,o({component:"span",sx:{color:"#667085",fontWeight:400,flexShrink:0,mx:.5}},{children:"↔"})),t(a,o({component:"span",title:N||"Reference Section",sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1,minWidth:0}},{children:N||"Reference Section"}))]})),t(a,o({sx:{mt:.75,display:"inline-flex",alignItems:"center",gap:.75}},{children:t(c,o({sx:{fontSize:"no counterpart"!==G||"no counterpart"!==N?"13px":"16px",fontWeight:400,color:"#5928ED",lineHeight:1}},{children:null===(S=Object.values(no.tabs).find(function(o){return o.key===ro}))||void 0===S?void 0:S.subtitle}))}))]})),i(a,o({sx:{display:"flex",alignItems:"center",gap:1.5,flexShrink:0}},{children:[i(a,o({sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:.5,borderRadius:"20px",bgcolor:"#FFFFFF",border:"1px solid #5928ED",fontSize:"12px",fontWeight:600,color:"#5928ED"}},{children:[t(x,{}),no.decisionStrengthLabel," ",so,"%"]})),t(s,o({onClick:O,size:"small",sx:{color:"#667085",width:24,height:24,"&:hover":{bgcolor:"transparent",color:"#101828"}}},{children:t(p,{size:22})}))]}))]})),t(a,o({sx:{display:"flex",borderBottom:"1px solid #E4E7EC",px:2.5,flexShrink:0}},{children:co.map(function(i){var n=ro===i.key,e=i.key===no.tabs.deviation.key,r=co.length>1&&e&&oo,l=t(a,o({onClick:function(){r||lo(i.key)},sx:{pb:"10px",pt:"4px",mr:3,px:2,cursor:r?"not-allowed":"pointer",opacity:r?.5:1,fontSize:"14px",fontWeight:n?600:400,color:n?no.accentColor:"#667085",backgroundColor:n?"".concat(no.accentColor,"14"):"transparent",borderBottom:n?"2px solid ".concat(no.accentColor):"2px solid transparent",transition:"all 0.15s",userSelect:"none"}},{children:i.label}),i.key);return r?t(d,o({title:"Fetching deviation data",arrow:!0,placement:"top"},{children:t("span",{children:l})}),i.key):l})})),t(a,o({sx:{flex:1,minHeight:0,overflowY:"auto",px:2.5,py:2,display:"flex",flexDirection:"column",gap:1.5,"&::-webkit-scrollbar":{width:"6px"},"&::-webkit-scrollbar-track":{background:"transparent"},"&::-webkit-scrollbar-thumb":{background:"".concat(ao.border,"55"),borderRadius:"10px"},"&::-webkit-scrollbar-thumb:hover":{background:ao.border},scrollbarWidth:"thin",scrollbarColor:"".concat(ao.border,"55 transparent")}},{children:ro===no.tabs.deviation.key?$?i(n,{children:[(null===(D=(null===(C=null==$?void 0:$.cognitive_decisioning)||void 0===C?void 0:C.decisioning_factors)||[])||void 0===D?void 0:D.length)>0&&t(b,{title:"Decision Making Factors",content:null===(E=null===(_=null==$?void 0:$.cognitive_decisioning)||void 0===_?void 0:_.decisioning_factors)||void 0===E?void 0:E.join("\n\n"),citations:null===(R=null==$?void 0:$.cognitive_decisioning)||void 0===R?void 0:R.citations,styles:io,docData:V,open:M}),(null===(W=(null===(z=null==$?void 0:$.cognitive_decisioning)||void 0===z?void 0:z.gaps_in_decision)||[])||void 0===W?void 0:W.length)>0&&t(b,{title:"Gaps in Decision",content:null===(T=null===(I=null==$?void 0:$.cognitive_decisioning)||void 0===I?void 0:I.gaps_in_decision)||void 0===T?void 0:T.join("\n\n"),citations:null===(j=null==$?void 0:$.cognitive_decisioning)||void 0===j?void 0:j.citations,styles:io,docData:V,open:M}),0===(null===(B=(null===(A=null==$?void 0:$.cognitive_decisioning)||void 0===A?void 0:A.decisioning_factors)||[])||void 0===B?void 0:B.length)&&0===(null===(H=(null===(L=null==$?void 0:$.cognitive_decisioning)||void 0===L?void 0:L.gaps_in_decision)||[])||void 0===H?void 0:H.length)&&t(a,o({sx:{p:2,bgcolor:"#F8FAFC",borderRadius:"8px",border:"1px solid #E2E8F0"}},{children:t(c,o({sx:{fontSize:"13px",color:"#64748B"}},{children:"No cognitive decisioning data available for this section."}))}))]}):t(b,{title:"Deviation Analysis",content:"Deviation analysis content will appear here. This tab shows\n structural and semantic deviations identified between the two\n sections being compared.",citations:{},styles:io,docData:V,open:M}):i(n,{children:[vo.length>0&&t(b,{title:no.sectionTitles.decisioningFactors,content:vo.join("\n\n"),citations:P.citations,styles:io,open:M,docData:V}),ho.length>0&&t(b,{title:no.sectionTitles.gaps,content:ho.join("\n\n"),citations:P.citations,styles:io,open:M,docData:V}),0===vo.length&&0===ho.length&&t(a,o({sx:{p:2,bgcolor:"#F8FAFC",borderRadius:"8px",border:"1px solid #E2E8F0"}},{children:t(c,o({sx:{fontSize:"13px",color:"#64748B"}},{children:no.emptyStateMessage}))}))]})}))]}));return v.createPortal(go,document.body)};export{f as default};
1
+ import{__assign as o}from"tslib";import{jsxs as i,Fragment as n,jsx as t}from"react/jsx-runtime";import{useMemo as e,useState as r,useEffect as a}from"react";import{Box as l,Typography as c,IconButton as s,Tooltip as d}from"@mui/material";import{X as p}from"lucide-react";import v from"react-dom";import x from"../../assests/svg/SparkleIcon.js";import{SHARED_MARKDOWN_STYLES as h,DEFAULT_POPUP_CONFIG as u}from"./CognitiveCompareConfig.js";import b from"./CitationRenderer.js";var g=10,f=function(f){var m,y,w,F,k,S,C,D,_,E,R,z,W,I,T,j,A,B,L,H,M=f.open,O=f.onClose,G=f.sectionTitle,N=f.referenceSectionTitle,P=f.cognitiveData,Y=f.relevanceScore,q=f.anchorEl,J=f.badgeStyle,K=f.popupRef,Q=f.position,U=f.markdownStyles,V=f.docData,X=f.popupConfig,Z=f.deviationData,$=void 0===Z?null:Z,oo=f.isLoading,io=o(o({},h),U),no=e(function(){var i,n;return o(o(o({},u),X),{tabs:{deviation:o(o({},u.tabs.deviation),null===(i=null==X?void 0:X.tabs)||void 0===i?void 0:i.deviation),association:o(o({},u.tabs.association),null===(n=null==X?void 0:X.tabs)||void 0===n?void 0:n.association)},sectionTitles:o(o({},u.sectionTitles),null==X?void 0:X.sectionTitles)})},[X]),to=null==P?void 0:P.isMissingRationale,eo=r(to?no.tabs.deviation.key:no.tabs.association.key),ro=eo[0],ao=eo[1];a(function(){M&&ao(to?no.tabs.deviation.key:no.tabs.association.key)},[M,to,no.tabs.deviation.key,no.tabs.association.key]);var lo=e(function(){if(!J)return{border:no.accentColor,shadow:"".concat(no.accentColor,"2E")};var o=J.badgeText;return"#9F1239"===o||"#B42318"===o?{border:"#E11D48",shadow:"rgba(225,29,72,0.15)"}:"#1D4ED8"===o?{border:"#3B82F6",shadow:"rgba(59,130,246,0.15)"}:"#A16207"===o?{border:"#F59E0B",shadow:"rgba(245,158,11,0.15)"}:{border:no.accentColor,shadow:"".concat(no.accentColor,"2E")}},[J,no.accentColor]);a(function(){if(M){var o=function(o){var i;(null===(i=K.current)||void 0===i?void 0:i.contains(o.target))||(null==q?void 0:q.contains(o.target))||O()};return document.addEventListener("mousedown",o),function(){return document.removeEventListener("mousedown",o)}}},[M,O,q,K]);var co=to?[]:[no.tabs.deviation,no.tabs.association];if(1===co.length&&co[0].key===no.tabs.deviation.key)return null;if(!M||!P)return null;var so=null!==(w=null!==(y=ro===no.tabs.deviation.key?null===(m=null==$?void 0:$.cognitive_decisioning)||void 0===m?void 0:m.decision_strength:P.relevance_score)&&void 0!==y?y:Y)&&void 0!==w?w:0,po=P.decisioning,vo=Array.isArray(po)?po:"string"==typeof po&&po.trim()?[po]:[],xo=P.gap,ho=Array.isArray(xo)?xo:"string"==typeof xo&&xo.trim()?[xo]:[],uo=Q?Q.left-150:-9999,bo=(null!==(F=null==Q?void 0:Q.arrowLeft)&&void 0!==F?F:60)+150,go=i(l,o({ref:K,sx:{position:"fixed",top:null!==(k=null==Q?void 0:Q.top)&&void 0!==k?k:-9999,left:uo,zIndex:9999,width:"".concat(1050,"px"),maxWidth:"min(".concat(1050,"px, calc(100vw - ").concat(uo>0?uo:0,"px - ").concat(12,"px))"),bgcolor:"#FFFFFF",borderRadius:"14px",border:"1.5px solid ".concat(lo.border),boxShadow:"0px 8px 32px ".concat(lo.shadow,", 0px 0px 0px 3px ").concat(lo.shadow),overflow:"visible",display:"flex",flexDirection:"column",maxHeight:(null==Q?void 0:Q.maxHeight)?"min(60vh, ".concat(Q.maxHeight,"px)"):"60vh",visibility:Q?"visible":"hidden"}},{children:[Q&&(Q.openAbove?i(n,{children:[t(l,{sx:{position:"absolute",bottom:-11,left:bo-g,width:0,height:0,borderLeft:"".concat(g,"px solid transparent"),borderRight:"".concat(g,"px solid transparent"),borderTop:"".concat(11,"px solid ").concat(lo.border),zIndex:1}}),t(l,{sx:{position:"absolute",bottom:-9,left:bo-g+1,width:0,height:0,borderLeft:"".concat(9,"px solid transparent"),borderRight:"".concat(9,"px solid transparent"),borderTop:"".concat(g,"px solid #FFFFFF"),zIndex:2}})]}):i(n,{children:[t(l,{sx:{position:"absolute",top:-11,left:bo-g,width:0,height:0,borderLeft:"".concat(g,"px solid transparent"),borderRight:"".concat(g,"px solid transparent"),borderBottom:"".concat(11,"px solid ").concat(lo.border),zIndex:1}}),t(l,{sx:{position:"absolute",top:-9,left:bo-g+1,width:0,height:0,borderLeft:"".concat(9,"px solid transparent"),borderRight:"".concat(9,"px solid transparent"),borderBottom:"".concat(g,"px solid #FFFFFF"),zIndex:2}})]})),i(l,o({sx:{px:2.5,pt:2,pb:1.5,display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:2,flexShrink:0}},{children:[i(l,o({sx:{flex:1,minWidth:0}},{children:[("no counterpart"!==G||"no counterpart"!==N)&&i(c,o({sx:{fontSize:"16px",fontWeight:600,color:"#101828",lineHeight:1.3,display:"flex",alignItems:"center",gap:1,flexWrap:"nowrap",overflow:"hidden",width:"100%"}},{children:[t(l,o({component:"span",title:G,sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:"0 1 auto",maxWidth:"calc(50% - 16px)",minWidth:0}},{children:G})),t(l,o({component:"span",sx:{color:"#667085",fontWeight:400,flexShrink:0,mx:.5}},{children:"↔"})),t(l,o({component:"span",title:N||"Reference Section",sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1,minWidth:0}},{children:N||"Reference Section"}))]})),t(l,o({sx:{mt:.75,display:"inline-flex",alignItems:"center",gap:.75}},{children:t(c,o({sx:{fontSize:"no counterpart"!==G||"no counterpart"!==N?"13px":"16px",fontWeight:400,color:"#5928ED",lineHeight:1}},{children:null===(S=Object.values(no.tabs).find(function(o){return o.key===ro}))||void 0===S?void 0:S.subtitle}))}))]})),i(l,o({sx:{display:"flex",alignItems:"center",gap:1.5,flexShrink:0}},{children:[i(l,o({sx:{display:"inline-flex",alignItems:"center",gap:"5px",px:1.5,py:.5,borderRadius:"20px",bgcolor:"#FFFFFF",border:"1px solid #5928ED",fontSize:"12px",fontWeight:600,color:"#5928ED"}},{children:[t(x,{}),no.decisionStrengthLabel," ",so,"%"]})),t(s,o({onClick:O,size:"small",sx:{color:"#667085",width:24,height:24,"&:hover":{bgcolor:"transparent",color:"#101828"}}},{children:t(p,{size:22})}))]}))]})),t(l,o({sx:{display:"flex",borderBottom:"1px solid #E4E7EC",px:2.5,flexShrink:0}},{children:co.map(function(i){var n=ro===i.key,e=i.key===no.tabs.deviation.key,r=co.length>1&&e&&oo,a=t(l,o({onClick:function(){r||ao(i.key)},sx:{pb:"10px",pt:"4px",mr:3,px:2,cursor:r?"not-allowed":"pointer",opacity:r?.5:1,fontSize:"14px",fontWeight:n?600:400,color:n?no.accentColor:"#667085",backgroundColor:n?"".concat(no.accentColor,"14"):"transparent",borderBottom:n?"2px solid ".concat(no.accentColor):"2px solid transparent",transition:"all 0.15s",userSelect:"none"}},{children:i.label}),i.key);return r?t(d,o({title:"Fetching deviation data",arrow:!0,placement:"top"},{children:t("span",{children:a})}),i.key):a})})),t(l,o({sx:{flex:1,minHeight:0,overflowY:"auto",px:2.5,py:2,display:"flex",flexDirection:"column",gap:1.5,"&::-webkit-scrollbar":{width:"6px"},"&::-webkit-scrollbar-track":{background:"transparent"},"&::-webkit-scrollbar-thumb":{background:"".concat(lo.border,"55"),borderRadius:"10px"},"&::-webkit-scrollbar-thumb:hover":{background:lo.border},scrollbarWidth:"thin",scrollbarColor:"".concat(lo.border,"55 transparent")}},{children:ro===no.tabs.deviation.key?$?i(n,{children:[(null===(D=(null===(C=null==$?void 0:$.cognitive_decisioning)||void 0===C?void 0:C.decisioning_factors)||[])||void 0===D?void 0:D.length)>0&&t(b,{title:"Decision Making Factors",content:null===(E=null===(_=null==$?void 0:$.cognitive_decisioning)||void 0===_?void 0:_.decisioning_factors)||void 0===E?void 0:E.join("\n\n"),citations:null===(R=null==$?void 0:$.cognitive_decisioning)||void 0===R?void 0:R.citations,styles:io,docData:V,deviationData:$,open:M}),(null===(W=(null===(z=null==$?void 0:$.cognitive_decisioning)||void 0===z?void 0:z.gaps_in_decision)||[])||void 0===W?void 0:W.length)>0&&t(b,{title:"Gaps in Decision",content:null===(T=null===(I=null==$?void 0:$.cognitive_decisioning)||void 0===I?void 0:I.gaps_in_decision)||void 0===T?void 0:T.join("\n\n"),citations:null===(j=null==$?void 0:$.cognitive_decisioning)||void 0===j?void 0:j.citations,styles:io,docData:V,deviationData:$,open:M}),0===(null===(B=(null===(A=null==$?void 0:$.cognitive_decisioning)||void 0===A?void 0:A.decisioning_factors)||[])||void 0===B?void 0:B.length)&&0===(null===(H=(null===(L=null==$?void 0:$.cognitive_decisioning)||void 0===L?void 0:L.gaps_in_decision)||[])||void 0===H?void 0:H.length)&&t(l,o({sx:{p:2,bgcolor:"#F8FAFC",borderRadius:"8px",border:"1px solid #E2E8F0"}},{children:t(c,o({sx:{fontSize:"13px",color:"#64748B"}},{children:"No cognitive decisioning data available for this section."}))}))]}):t(b,{title:"Deviation Analysis",content:"Deviation analysis content will appear here. This tab shows\n structural and semantic deviations identified between the two\n sections being compared.",citations:{},styles:io,docData:V,open:M}):i(n,{children:[vo.length>0&&t(b,{title:no.sectionTitles.decisioningFactors,content:vo.join("\n\n"),citations:P.citations,styles:io,open:M,docData:V}),ho.length>0&&t(b,{title:no.sectionTitles.gaps,content:ho.join("\n\n"),citations:P.citations,styles:io,open:M,docData:V}),0===vo.length&&0===ho.length&&t(l,o({sx:{p:2,bgcolor:"#F8FAFC",borderRadius:"8px",border:"1px solid #E2E8F0"}},{children:t(c,o({sx:{fontSize:"13px",color:"#64748B"}},{children:no.emptyStateMessage}))}))]})}))]}));return v.createPortal(go,document.body)};export{f as default};
2
2
  //# sourceMappingURL=CognitivePopup.js.map
@@ -1,2 +1,2 @@
1
- import{jsx as e}from"react/jsx-runtime";import{createContext as n,useState as t,useMemo as i,useCallback as o,useContext as r}from"react";import{RefProvider as s}from"../../store/ref.context.js";var a;!function(e){e.WAITING="waiting",e.IN_PROGRESS="in_progress",e.GENERATED="generated",e.FAILED="failed",e.GENERATE="generate",e.APPROVED="approved"}(a||(a={}));const c=n(null),g=({children:n,userStory:r,setUserStory:a,aiReasoning:g,setAiReasoning:u,citations:d,setCitations:l,apiCachingConfig:f,customStyles:C,customIcons:m,searchQueryList:h,searchQueryReasoningIdList:p,citationConfig:R,chatHistory:I,chatCitationConfigs:S,gptCitationConfigs:y,diffEditConfig:E,aiReasoningAccordionOpenStates:A,persistedDataFiles:v,inlineUpdateComponentConfig:D,segmentComponentConfig:x,onEditBlocked:N,inlineManualComponentConfig:P,redlineConfig:L,sectionStatusConfig:_,customSectionConfig:w,updateRedlineDataParent:F})=>{const[G,H]=t(0),[O,Q]=t(""),U=i(()=>{if(0===r.length||0===g.length)return Array(r.length).fill(0);const e=Array.from({length:r.length},()=>[]);return g.forEach(n=>{const t=Number(n.relevance_score);if(isNaN(t)||t<=0)return;const i=`ai_reasoning$${n.id}`,o=r.findIndex(e=>{var n;return e.value.includes(i)||(null===(n=e.sub_features)||void 0===n?void 0:n.some(e=>e.value.includes(i)))});-1!==o&&e[o].push(t)}),e.map(e=>0===e.length?0:Math.round(e.reduce((e,n)=>e+n,0)/e.length))},[r,g]),b=o(e=>{var n;const t=r.findIndex(n=>n.artifactId===e);return-1===t?0:null!==(n=U[t])&&void 0!==n?n:0},[r,U]);return e(c.Provider,{value:{chatHistory:I,userStory:r,setUserStory:a,aiReasoning:g,setAiReasoning:u,citations:d,setCitations:l,apiCachingConfig:f,customStyles:C,customIcons:m,searchQueryList:h,searchQueryReasoningIdList:p,citationConfig:R,getAvgScoreForStory:b,chatCitationConfigs:S,gptCitationConfigs:y,diffEditConfig:E,aiReasoningAccordionOpenStates:A,persistedDataFiles:v,currentHighlightIndex:G,setCurrentHighlightIndex:H,inlineUpdateComponentConfig:D,segmentComponentConfig:x,onEditBlocked:N,inlineManualComponentConfig:P,redlineConfig:L,redlineDcoumentId:O,setRedlineDocumentId:Q,sectionStatusConfig:_,customSectionConfig:w,updateRedlineDataParent:F},children:e(s,{children:n})})},u=()=>{const e=r(c);if(!e)throw new Error("useRequirementAI must be used within RequirementAIWrapper");return e};export{a as SectionStatus,g as default,u as useRequirementAI};
1
+ import{jsxs as e,jsx as n}from"react/jsx-runtime";import{createContext as t,useState as i,useMemo as o,useCallback as r,useContext as s}from"react";import{RefProvider as a}from"../../store/ref.context.js";import"../UserStoryCard/cws/CwsEvent.js";import l from"../UserStoryCard/cws/CwsEventProvider.js";import{Toaster as d}from"react-hot-toast";var c;!function(e){e.WAITING="waiting",e.IN_PROGRESS="in_progress",e.GENERATED="generated",e.FAILED="failed",e.GENERATE="generate",e.APPROVED="approved"}(c||(c={}));const u=t(null),g="user-story-lib",f=({children:t,userStory:s,setUserStory:c,aiReasoning:f,setAiReasoning:C,citations:m,setCitations:p,apiCachingConfig:h,customStyles:v,customIcons:I,searchQueryList:y,searchQueryReasoningIdList:R,citationConfig:S,chatHistory:E,chatCitationConfigs:A,gptCitationConfigs:w,diffEditConfig:D,aiReasoningAccordionOpenStates:b,persistedDataFiles:U,inlineUpdateComponentConfig:x,segmentComponentConfig:N,onEditBlocked:P,inlineManualComponentConfig:F,redlineConfig:L,sectionStatusConfig:T,customSectionConfig:_,updateRedlineDataParent:j,redlineCollaborativeConfig:k})=>{const[G,H]=i(0),[O,Q]=i(""),B=o(()=>{if(0===s.length||0===f.length)return Array(s.length).fill(0);const e=Array.from({length:s.length},()=>[]);return f.forEach(n=>{const t=Number(n.relevance_score);if(isNaN(t)||t<=0)return;const i=`ai_reasoning$${n.id}`,o=s.findIndex(e=>{var n;return e.value.includes(i)||(null===(n=e.sub_features)||void 0===n?void 0:n.some(e=>e.value.includes(i)))});-1!==o&&e[o].push(t)}),e.map(e=>0===e.length?0:Math.round(e.reduce((e,n)=>e+n,0)/e.length))},[s,f]),M=r(e=>{var n;const t=s.findIndex(n=>n.artifactId===e);return-1===t?0:null!==(n=B[t])&&void 0!==n?n:0},[s,B]);return e(u.Provider,{value:{chatHistory:E,userStory:s,setUserStory:c,aiReasoning:f,setAiReasoning:C,citations:m,setCitations:p,apiCachingConfig:h,customStyles:v,customIcons:I,searchQueryList:y,searchQueryReasoningIdList:R,citationConfig:S,getAvgScoreForStory:M,chatCitationConfigs:A,gptCitationConfigs:w,diffEditConfig:D,aiReasoningAccordionOpenStates:b,persistedDataFiles:U,currentHighlightIndex:G,setCurrentHighlightIndex:H,inlineUpdateComponentConfig:x,segmentComponentConfig:N,onEditBlocked:P,inlineManualComponentConfig:F,redlineConfig:L,redlineDcoumentId:O,setRedlineDocumentId:Q,sectionStatusConfig:T,customSectionConfig:_,updateRedlineDataParent:j,redlineCollaborativeConfig:k},children:[n(d,{position:"top-right",toasterId:g}),(null==k?void 0:k.initiateCollaborativeFlow)?n(l,{applicationId:null==k?void 0:k.modeId,baseUrl:null==k?void 0:k.cwsBaseUrl,authToken:null==k?void 0:k.authToken,children:n(a,{children:t})}):n(a,{children:t})]})},C=()=>{const e=s(u);if(!e)throw new Error("useRequirementAI must be used within RequirementAIWrapper");return e};export{c as SectionStatus,g as ToasterId,f as default,C as useRequirementAI};
2
2
  //# sourceMappingURL=RequirementAIWrapper.js.map
@@ -1,2 +1,2 @@
1
- import{jsxs as i,jsx as l}from"react/jsx-runtime";import{ChevronUp as n,ChevronDown as o}from"lucide-react";import{useState as e,useMemo as t}from"react";import r from"./ResizableSplitPane.js";import{DefaultFullScreenCloseIcon as d,DefaultFullScreenIcon as a}from"../icons/PdfViewerIcons.js";import{PdfViewer as u}from"@e-llm-studio/citation";const s=({href:i,metaData:n,citationTitle:o,isFullscreen:e})=>{var d,a,s,c,p,v;const h=t(()=>{var l;return null===(l=(Array.isArray(null==n?void 0:n.citations)?n.citations:[]).find(l=>`pdf_citation$${l.id}`===i))||void 0===l?void 0:l.data},[i,null==n?void 0:n.citations]);if(!h)return null;const g=(null===(d=null==n?void 0:n.docData)||void 0===d?void 0:d.documents)||{},f=(null===(a=null==n?void 0:n.docData)||void 0===a?void 0:a.input_index_map)||{},m=null==f?void 0:f[0],x=null==f?void 0:f[1],y=m?g[m]:null,b=x?g[x]:null,C=m?h[m]:null,_=x?h[x]:null;if(["Contract","clause"].includes(o)){const i=C?l(u,{pdfName:null==y?void 0:y.title,pdfUrl:null==y?void 0:y.signed_url,highlightText:[null!==(s=null==C?void 0:C.highlighted_text)&&void 0!==s?s:""],highlightPages:{1:null===(c=null==C?void 0:C.custom_metadata)||void 0===c?void 0:c.pdf_start_page_number},jumpToPageValue:1,highlightCordinatePages:[],useCoordinates:!1}):null,n=_?l(u,{pdfName:null==b?void 0:b.title,pdfUrl:null==b?void 0:b.signed_url,jumpToPageValue:1,highlightText:[null!==(p=null==_?void 0:_.highlighted_text)&&void 0!==p?p:""],highlightPages:{1:null===(v=null==_?void 0:_.custom_metadata)||void 0===v?void 0:v.pdf_start_page_number},highlightCordinatePages:[],useCoordinates:!1}):null;return l("div",C||_?{style:{height:"100%",display:"flex",flexDirection:"column"},children:l(r,{leftComponent:i,rightComponent:n,isFullscreen:e})}:{children:"Missing PDF Citation. Please try again later"})}return l("div",{children:"No Citation Found. Please try again later"})},c=({href:r,children:u,metaData:c,chevronUpComponent:p=null,chevronDownComponent:v=null,customStyle:h={},defaultState:g=!1})=>{var f,m,x;const[y,b]=e(g),[C,_]=e(!1),F="string"==typeof u&&(null===(f=null==u?void 0:u.split("\n"))||void 0===f?void 0:f.length)>1?u.split("\n").join(" "):u,D="string"==typeof u?u:u[0],P=null!=p?p:(i=>{var o,e;return l(n,{size:null!==(o=null==i?void 0:i.fontSize)&&void 0!==o?o:16,color:null!==(e=null==i?void 0:i.color)&&void 0!==e?e:"rgb(214, 51, 132)"})})(null!==(m=null==h?void 0:h.arrow)&&void 0!==m?m:{}),w=null!=v?v:(i=>{var n,e;return l(o,{size:null!==(n=null==i?void 0:i.fontSize)&&void 0!==n?n:16,color:null!==(e=null==i?void 0:i.color)&&void 0!==e?e:"rgb(214, 51, 132)"})})(null!==(x=null==h?void 0:h.arrow)&&void 0!==x?x:{}),k=t(()=>(Array.isArray(null==c?void 0:c.citations)?c.citations:[]).some(i=>`pdf_citation$${i.id}`===r),[r,null==c?void 0:c.citations]);return["contract","clause"].includes(D)&&k?i("span",{style:{display:"inline",...h.relativeWrapper||{}},children:[l("div",{style:{display:"inline",marginTop:0,...h.citationButtonWrapper||{}},children:i("button",{type:"button",onClick:()=>b(i=>!i),style:{display:"inline-flex",alignItems:"center",gap:"3px",fontFamily:'"Inter", sans-serif',backgroundColor:"transparent",padding:0,margin:0,fontSize:"13px",borderRadius:9999,cursor:"pointer",fontWeight:700,color:"rgb(214, 51, 132)",border:"none",textDecoration:"none",wordBreak:"break-word",whiteSpace:"normal",...h.citationButton||{}},children:[l("span",{children:F}),l("span",{style:{display:"flex",alignItems:"center"},children:y?P:w})]})}),y&&i("div",{style:C?{position:"fixed",inset:0,zIndex:999999,backgroundColor:"#FAFAFA",display:"flex",flexDirection:"column"}:{boxSizing:"border-box",border:"1px solid #E4E7EC",borderRadius:"8px",overflow:"hidden",marginTop:"8px",display:"flex",flexDirection:"column",width:"100%"},children:[l("div",{style:{display:"flex",justifyContent:"flex-end",padding:"6px 10px",borderBottom:"1px solid #E4E7EC",backgroundColor:"#FFFFFF",flexShrink:0},children:l("button",{onClick:()=>{_(i=>!i)},style:{background:"none",border:"none",cursor:"pointer",padding:"4px",borderRadius:"6px",color:"#475467",marginRight:"9px"},children:l(C?d:a,{})})}),l("div",{style:{flex:1,minHeight:0,height:"100%",overflow:"hidden"},children:l(s,{href:r,children:u,metaData:c,citationTitle:D,isFullscreen:C})})]})]}):null};export{c as default};
1
+ import{jsxs as i,jsx as l}from"react/jsx-runtime";import{ChevronUp as n,ChevronDown as o}from"lucide-react";import{useState as e,useMemo as t}from"react";import r from"./ResizableSplitPane.js";import{DefaultFullScreenCloseIcon as d,DefaultFullScreenIcon as a}from"../icons/PdfViewerIcons.js";import{PdfViewer as u}from"@e-llm-studio/citation";const s=({href:i,metaData:n,citationTitle:o,isFullscreen:e})=>{var d,a,s,c,p,v;const h=t(()=>{var l;return null===(l=(Array.isArray(null==n?void 0:n.citations)?n.citations:[]).find(l=>`pdf_citation$${l.id}`===i))||void 0===l?void 0:l.data},[i,null==n?void 0:n.citations]);if(!h)return null;const g=(null===(d=null==n?void 0:n.docData)||void 0===d?void 0:d.documents)||{},f=(null===(a=null==n?void 0:n.docData)||void 0===a?void 0:a.input_index_map)||{},m=null==f?void 0:f[0],x=null==f?void 0:f[1],y=m?g[m]:null,b=x?g[x]:null,C=m?h[m]:null,_=x?h[x]:null;if(["Contract","clause"].includes(o)){const i=C?l(u,{pdfName:null==y?void 0:y.title,pdfUrl:null==y?void 0:y.signed_url,highlightText:[null!==(s=null==C?void 0:C.highlighted_text)&&void 0!==s?s:""],highlightPages:{1:null===(c=null==C?void 0:C.custom_metadata)||void 0===c?void 0:c.pdf_start_page_number},jumpToPageValue:1,highlightCordinatePages:[],useCoordinates:!1}):null,n=_?l(u,{pdfName:null==b?void 0:b.title,pdfUrl:null==b?void 0:b.signed_url,jumpToPageValue:1,highlightText:[null!==(p=null==_?void 0:_.highlighted_text)&&void 0!==p?p:""],highlightPages:{1:null===(v=null==_?void 0:_.custom_metadata)||void 0===v?void 0:v.pdf_start_page_number},highlightCordinatePages:[],useCoordinates:!1}):null;return l("div",C||_?{style:{height:"100%",display:"flex",flexDirection:"column"},children:l(r,{leftComponent:i,rightComponent:n,isFullscreen:e})}:{children:"Missing PDF Citation. Please try again later"})}return l("div",{children:"No Citation Found. Please try again later"})},c=({href:r,children:u,metaData:c,chevronUpComponent:p=null,chevronDownComponent:v=null,customStyle:h={},defaultState:g=!1})=>{var f,m,x;const[y,b]=e(g),[C,_]=e(!1),F="string"==typeof u&&(null===(f=null==u?void 0:u.split("\n"))||void 0===f?void 0:f.length)>1?u.split("\n").join(" "):u,w="string"==typeof u?u:u[0],D=null!=p?p:(i=>{var o,e;return l(n,{size:null!==(o=null==i?void 0:i.fontSize)&&void 0!==o?o:16,color:null!==(e=null==i?void 0:i.color)&&void 0!==e?e:"rgb(214, 51, 132)"})})(null!==(m=null==h?void 0:h.arrow)&&void 0!==m?m:{}),P=null!=v?v:(i=>{var n,e;return l(o,{size:null!==(n=null==i?void 0:i.fontSize)&&void 0!==n?n:16,color:null!==(e=null==i?void 0:i.color)&&void 0!==e?e:"rgb(214, 51, 132)"})})(null!==(x=null==h?void 0:h.arrow)&&void 0!==x?x:{}),k=t(()=>(Array.isArray(null==c?void 0:c.citations)?c.citations:[]).some(i=>`pdf_citation$${i.id}`===r),[r,null==c?void 0:c.citations]);return["contract","clause"].includes(w.toLowerCase())&&k?i("span",{style:{display:"inline",...h.relativeWrapper||{}},children:[l("div",{style:{display:"inline",marginTop:0,...h.citationButtonWrapper||{}},children:i("button",{type:"button",onClick:()=>b(i=>!i),style:{display:"inline-flex",alignItems:"center",gap:"3px",fontFamily:'"Inter", sans-serif',backgroundColor:"transparent",padding:0,margin:0,fontSize:"13px",borderRadius:9999,cursor:"pointer",fontWeight:700,color:"rgb(214, 51, 132)",border:"none",textDecoration:"none",wordBreak:"break-word",whiteSpace:"normal",...h.citationButton||{}},children:[l("span",{children:F}),l("span",{style:{display:"flex",alignItems:"center"},children:y?D:P})]})}),y&&i("div",{style:C?{position:"fixed",inset:0,zIndex:999999,backgroundColor:"#FAFAFA",display:"flex",flexDirection:"column"}:{boxSizing:"border-box",border:"1px solid #E4E7EC",borderRadius:"8px",overflow:"hidden",marginTop:"8px",display:"flex",flexDirection:"column",width:"100%"},children:[l("div",{style:{display:"flex",justifyContent:"flex-end",padding:"6px 10px",borderBottom:"1px solid #E4E7EC",backgroundColor:"#FFFFFF",flexShrink:0},children:l("button",{onClick:()=>{_(i=>!i)},style:{background:"none",border:"none",cursor:"pointer",padding:"4px",borderRadius:"6px",color:"#475467",marginRight:"9px"},children:l(C?d:a,{})})}),l("div",{style:{flex:1,minHeight:0,height:"100%",overflow:"hidden"},children:l(s,{href:r,children:u,metaData:c,citationTitle:w,isFullscreen:C})})]})]}):null};export{c as default};
2
2
  //# sourceMappingURL=CitationAnchor.js.map
@@ -1,2 +1,2 @@
1
- import{jsxs as e,jsx as i,Fragment as c}from"react/jsx-runtime";import a,{memo as t,useMemo as n}from"react";import l from"../Popups/PopupDefaults.js";import r from"react-markdown";import o from"rehype-raw";import s from"./CitationComponent.module.css.js";import{ChevronUp as d}from"lucide-react";import{ReactComponent as m}from"../icons/cognitiveBrain.svg.js";import{ReactComponent as p}from"../icons/aiMagic.svg.js";import h from"./CitationAnchor.js";import{AiReasonMarkdownWrapper as _}from"../../ai-reasoning/AiReasonMarkdownWrapper.js";import{resolveRedline as u}from"../../../../../service/redlineService.js";import{useRequirementAI as v}from"../../RequirementAIWrapper/RequirementAIWrapper.js";const N=({text:e,item:c})=>i(r,{rehypePlugins:[o],components:{ol:({children:e})=>i("ol",{className:s["md-ol"],children:e}),ul:({children:e})=>i("ul",{className:s["md-ul"],children:e}),li:({children:e})=>i("li",{className:s["md-li"],children:e}),a:({node:e,href:a,children:t})=>i(h,{href:a,children:t,metaData:{citations:c.citations,docData:c.docData}})},children:e.replace(/<br\s*\/?>/gi,"\n")}),y=({text:e,markdownStyles:c,citationStyles:a,customIcons:t})=>i(_,{message:e.replace(/<br\s*\/?>/gi,"\n"),customStyles:c,citationStyles:a,customIcons:t});var b=t(function({item:t,title:r="Cognitive Decisioning AI",relevanceScore:o=0,showRelevanceScore:h=!0,reason:_="No reasoning provided.",impact:b="No Impact provided.",explaination:g="No explaination provided.",gap:f="None",onClose:x=()=>{},onActionTrigger:I,showResolveBtns:C=!1,sections:k,leftIcon:A,scoreIcon:S,className:R,customStyles:j={},markdownStyles:w,citationStyles:H,customIcons:B,actions:D,disableAllActions:T=!1,actionBtnDisabledStyle:$={},onBackClick:L,isImpactNeeded:P=!0,cognitiveTitle:M="Cognitive Integrity",labels:E={},chatHistory:q,openInFullscreenOnClick:F=!1,redlineId:G,aiReasonId:W}){const U=n(()=>{const e=Number(o);return Number.isNaN(e)?0:Math.max(0,Math.min(100,Math.round(e)))},[o]),O=n(()=>{const e=E&&E.noGapsText||"1. No gaps identified.";return(e=>{if(!e)return!0;const i=e.trim().toLowerCase();return"none"===i||"no gap"===i||"no gaps"===i||"n/a"===i})(f)?e:f},[f]),z=E&&E.impact||"Impact",J=E&&E.explanation||"Explaination",K=E&&E.decisionFactors||"Decision Making Factors",Q=E&&E.gaps||"Gaps in Decision",V=E&&E.accept||"Accept",X=E&&E.reject||"Reject",Y=E&&E.backAriaLabel||"Go back",{redlineDcoumentId:Z,redlineConfig:ee,updateRedlineDataParent:ie}=v(),ce=async e=>{var i,c;null==I||I({status:"loading",action:e,metadata:{redlineId:G,aiReasonId:W}});try{const{updated_reqai:a}=await u({documentId:Z,userEmail:null==ee?void 0:ee.userEmail,userName:null==ee?void 0:ee.userName,redlineId:null!=G?G:"",action:e,baseApiUrl:null==ee?void 0:ee.baseApiUrl,redlineConfigId:null!==(i=null==ee?void 0:ee.redlineConfigId)&&void 0!==i?i:""},null!==(c=null==ee?void 0:ee.token)&&void 0!==c?c:"");await(null==ie?void 0:ie(a)),null==I||I({status:"success",action:e,metadata:{redlineId:G,aiReasonId:W}})}catch(i){null==I||I({status:"failed",action:e,metadata:{redlineId:G,aiReasonId:W}})}},ae=D||[{id:"reject",label:X,onClick:()=>ce("reject"),className:s["btn-reject"]},{id:"accept",label:V,onClick:()=>ce("accept"),className:s["btn-accept"]}],te=q&&q.length>0;return e("div",{className:`${s["cite-acc"]} ${R||""}`,style:{...l.CitationAccordionDefaults.container,...null==j?void 0:j.container},children:[L&&e("div",{className:s["cite-acc__backHeader"],children:[i("button",{type:"button",className:s["cite-acc__backBtn"],onClick:e=>{e.stopPropagation(),L&&L()},"aria-label":Y,children:"‹"}),i("span",{className:s["cite-acc__backTitle"],children:M})]}),i("div",{className:s["cite-body"],children:k&&k.length>0?k.map(c=>!1===c.show?null:e("div",{className:`${s["cite-acc__explain-body"]} ${c.bodyClassName||""}`,children:[e("div",{className:s["cite-acc__innerHeader"],style:{...l.CitationAccordionDefaults.innerHeader,...null==j?void 0:j.innerHeader},children:[i("div",{className:s["cite-acc__innerHeaderLeft"],children:i("div",{children:i("div",{className:s["cite-acc__innerTitle"],children:c.title})})}),i("button",{type:"button",onClick:e=>{e.stopPropagation(),x&&x()},children:i(d,{})})]}),i("div",{className:`${s["cite-acc__innerBody"]} text-sm text-gray-600`,style:{...l.CitationAccordionDefaults.innerBody,...null==j?void 0:j.innerBody},children:"string"==typeof c.content?i(N,{text:c.content,item:c.item||t||{}}):c.content})]},c.id||c.title)):e(c,{children:[P&&e("div",{className:s["cite-acc__explain-body"],children:[e("div",{className:s["cite-acc__innerHeader"],children:[i("div",{className:s["cite-acc__innerHeaderLeft"],children:i("div",{children:i("div",{className:s["cite-acc__innerTitle"],children:z})})}),i("button",{type:"button",onClick:e=>{e.stopPropagation(),x&&x()},children:i(d,{})})]}),i("div",{className:`${s["cite-acc__innerBody"]} text-sm text-gray-600`,children:i(N,{text:b||"",item:t||{}})})]}),g&&"No explaination provided."!==g&&e(c,{children:[e("div",{className:s["cite-acc__explain-body"],children:[i("div",{className:s["cite-acc__innerHeader"],children:i("div",{className:s["cite-acc__innerHeaderLeft"],children:i("div",{children:i("div",{className:s["cite-acc__innerTitle"],children:J})})})}),i("div",{className:`${s["cite-acc__innerBody"]} text-sm text-gray-600`,children:i(N,{text:g||"",item:{}})})]}),i("div",{style:{borderTop:"1px solid #e5e7eb",margin:"12px 0"}}),C&&i("div",{className:s["cite-acc__btn-container"],children:ae.map(e=>{const c=T||e.disabled;return i("button",{className:e.className,onClick:c?void 0:e.onClick,disabled:c,style:{...e.style,...c?{opacity:.5,cursor:"not-allowed",...$,...e.disabledStyle}:{}},children:e.label},e.id)})})]}),e("div",{className:s["cite-acc__header"],children:[e("div",{className:s["cite-acc__headerLeft"],children:[i("span",{className:s["cite-acc__titleIcon"],children:A?"function"==typeof A?a.createElement(A):A:i(m,{})}),i("div",{className:s["cite-acc__title"],children:r})]}),i("div",{className:s["cite-acc__headerRight"],children:h&&e("span",{className:s["cite-acc__scoreBadge"],children:[S?"function"==typeof S?a.createElement(S):S:i(p,{}),e("span",{className:s["cite-acc__scoreText"],children:[U,"%"]})]})})]}),e("div",{className:s["cite-acc__explain-body"],children:[i("div",{className:s["cite-acc__innerHeader"],children:i("div",{className:s["cite-acc__innerHeaderLeft"],children:i("div",{children:i("div",{className:s["cite-acc__innerTitle"],children:K})})})}),i("div",{className:`${s["cite-acc__innerBody"]} text-sm text-gray-600`,children:te?i(y,{text:_||"",markdownStyles:w,citationStyles:H,customIcons:B}):i(N,{text:_||"",item:t||{}})})]}),e("div",{className:`${s["cite-acc__explain-body"]} ${s["cite-acc__explain-body_border"]}`,children:[i("div",{className:s["cite-acc__innerHeader"],children:i("div",{className:s["cite-acc__innerHeaderLeft"],children:i("div",{children:i("div",{className:s["cite-acc__innerTitle"],children:Q})})})}),i("div",{className:`${s["cite-acc__innerBody"]} text-sm text-gray-600`,children:te?i(y,{text:O||"",markdownStyles:w,citationStyles:H,customIcons:B}):i(N,{text:O||"",item:t||{}})})]})]})})]})},(e,i)=>e.disableAllActions===i.disableAllActions&&(e.redlineId===i.redlineId&&(e.aiReasonId===i.aiReasonId&&(e.relevanceScore===i.relevanceScore&&(e.reason===i.reason&&(e.impact===i.impact&&(e.explaination===i.explaination&&e.gap===i.gap)))))));export{b as default};
1
+ import{jsxs as e,jsx as i,Fragment as a}from"react/jsx-runtime";import c,{memo as t,useMemo as n}from"react";import l from"../Popups/PopupDefaults.js";import r from"react-markdown";import o from"rehype-raw";import s from"./CitationComponent.module.css.js";import{ChevronUp as d}from"lucide-react";import{ReactComponent as m}from"../icons/cognitiveBrain.svg.js";import{ReactComponent as p}from"../icons/aiMagic.svg.js";import u from"./CitationAnchor.js";import{AiReasonMarkdownWrapper as v}from"../../ai-reasoning/AiReasonMarkdownWrapper.js";import{resolveRedline as h}from"../../../../../service/redlineService.js";import{useRequirementAI as _}from"../../RequirementAIWrapper/RequirementAIWrapper.js";import N from"../cws/CwsEvent.js";const y=({text:e,item:a})=>i(r,{rehypePlugins:[o],components:{ol:({children:e})=>i("ol",{className:s["md-ol"],children:e}),ul:({children:e})=>i("ul",{className:s["md-ul"],children:e}),li:({children:e})=>i("li",{className:s["md-li"],children:e}),a:({node:e,href:c,children:t})=>i(u,{href:c,children:t,metaData:{citations:a.citations,docData:a.docData}})},children:e.replace(/<br\s*\/?>/gi,"\n")}),b=({text:e,markdownStyles:a,citationStyles:c,customIcons:t})=>i(v,{message:e.replace(/<br\s*\/?>/gi,"\n"),customStyles:a,citationStyles:c,customIcons:t});var g=t(function({item:t,title:r="Cognitive Decisioning AI",relevanceScore:o=0,showRelevanceScore:u=!0,reason:v="No reasoning provided.",impact:g="No Impact provided.",explaination:f="No explaination provided.",gap:x="None",onClose:I=()=>{},onActionTrigger:C,showResolveBtns:k=!1,sections:S,leftIcon:A,scoreIcon:w,className:R,customStyles:j={},markdownStyles:B,citationStyles:D,customIcons:H,actions:$,disableAllActions:T=!1,actionBtnDisabledStyle:L={},onBackClick:P,isImpactNeeded:E=!0,cognitiveTitle:M="Cognitive Integrity",labels:q={},chatHistory:F,openInFullscreenOnClick:G=!1,redlineId:W,aiReasonId:U}){const O=n(()=>{const e=Number(o);return Number.isNaN(e)?0:Math.max(0,Math.min(100,Math.round(e)))},[o]),z=n(()=>{const e=q&&q.noGapsText||"1. No gaps identified.";return(e=>{if(!e)return!0;const i=e.trim().toLowerCase();return"none"===i||"no gap"===i||"no gaps"===i||"n/a"===i})(x)?e:x},[x]),J=q&&q.impact||"Impact",K=q&&q.explanation||"Explaination",Q=q&&q.decisionFactors||"Decision Making Factors",V=q&&q.gaps||"Gaps in Decision",X=q&&q.accept||"Accept",Y=q&&q.reject||"Reject",Z=q&&q.backAriaLabel||"Go back",{redlineDcoumentId:ee,redlineConfig:ie,updateRedlineDataParent:ae}=_(),ce=async e=>{var i,a,c,t,n,l;null==C||C({status:"loading",action:e,metadata:{redlineId:W,aiReasonId:U}});try{const{updated_reqai:r}=await h({documentId:ee,userEmail:null==ie?void 0:ie.userEmail,userName:null==ie?void 0:ie.userName,redlineId:null!=W?W:"",action:e,baseApiUrl:null==ie?void 0:ie.baseApiUrl,redlineConfigId:null!==(i=null==ie?void 0:ie.redlineConfigId)&&void 0!==i?i:""},null!==(a=null==ie?void 0:ie.token)&&void 0!==a?a:"");await(null==ae?void 0:ae(r)),null===(c=N.emit)||void 0===c||c.call(N,`redline-edit:${ee}:${null===(l=null===(n=null===(t=null==r?void 0:r.artifactData)||void 0===t?void 0:t.userStorySnapshot)||void 0===n?void 0:n[0])||void 0===l?void 0:l.artifactId}`,{updatedBy:null==ie?void 0:ie.userName}),null==C||C({status:"success",action:e,metadata:{redlineId:W,aiReasonId:U}})}catch(i){null==C||C({status:"failed",action:e,metadata:{redlineId:W,aiReasonId:U}})}},te=$||[{id:"reject",label:Y,onClick:()=>ce("reject"),className:s["btn-reject"]},{id:"accept",label:X,onClick:()=>ce("accept"),className:s["btn-accept"]}],ne=F&&F.length>0;return e("div",{className:`${s["cite-acc"]} ${R||""}`,style:{...l.CitationAccordionDefaults.container,...null==j?void 0:j.container},children:[P&&e("div",{className:s["cite-acc__backHeader"],children:[i("button",{type:"button",className:s["cite-acc__backBtn"],onClick:e=>{e.stopPropagation(),P&&P()},"aria-label":Z,children:"‹"}),i("span",{className:s["cite-acc__backTitle"],children:M})]}),i("div",{className:s["cite-body"],children:S&&S.length>0?S.map(a=>!1===a.show?null:e("div",{className:`${s["cite-acc__explain-body"]} ${a.bodyClassName||""}`,children:[e("div",{className:s["cite-acc__innerHeader"],style:{...l.CitationAccordionDefaults.innerHeader,...null==j?void 0:j.innerHeader},children:[i("div",{className:s["cite-acc__innerHeaderLeft"],children:i("div",{children:i("div",{className:s["cite-acc__innerTitle"],children:a.title})})}),i("button",{type:"button",onClick:e=>{e.stopPropagation(),I&&I()},children:i(d,{})})]}),i("div",{className:`${s["cite-acc__innerBody"]} text-sm text-gray-600`,style:{...l.CitationAccordionDefaults.innerBody,...null==j?void 0:j.innerBody},children:"string"==typeof a.content?i(y,{text:a.content,item:a.item||t||{}}):a.content})]},a.id||a.title)):e(a,{children:[E&&e("div",{className:s["cite-acc__explain-body"],children:[e("div",{className:s["cite-acc__innerHeader"],children:[i("div",{className:s["cite-acc__innerHeaderLeft"],children:i("div",{children:i("div",{className:s["cite-acc__innerTitle"],children:J})})}),i("button",{type:"button",onClick:e=>{e.stopPropagation(),I&&I()},children:i(d,{})})]}),i("div",{className:`${s["cite-acc__innerBody"]} text-sm text-gray-600`,children:i(y,{text:g||"",item:t||{}})})]}),f&&"No explaination provided."!==f&&e(a,{children:[e("div",{className:s["cite-acc__explain-body"],children:[i("div",{className:s["cite-acc__innerHeader"],children:i("div",{className:s["cite-acc__innerHeaderLeft"],children:i("div",{children:i("div",{className:s["cite-acc__innerTitle"],children:K})})})}),i("div",{className:`${s["cite-acc__innerBody"]} text-sm text-gray-600`,children:i(y,{text:f||"",item:{}})})]}),i("div",{style:{borderTop:"1px solid #e5e7eb",margin:"12px 0"}}),k&&i("div",{className:s["cite-acc__btn-container"],children:te.map(e=>{const a=T||e.disabled;return i("button",{className:e.className,onClick:a?void 0:e.onClick,disabled:a,style:{...e.style,...a?{opacity:.5,cursor:"not-allowed",...L,...e.disabledStyle}:{}},children:e.label},e.id)})})]}),e("div",{className:s["cite-acc__header"],children:[e("div",{className:s["cite-acc__headerLeft"],children:[i("span",{className:s["cite-acc__titleIcon"],children:A?"function"==typeof A?c.createElement(A):A:i(m,{})}),i("div",{className:s["cite-acc__title"],children:r})]}),i("div",{className:s["cite-acc__headerRight"],children:u&&e("span",{className:s["cite-acc__scoreBadge"],children:[w?"function"==typeof w?c.createElement(w):w:i(p,{}),e("span",{className:s["cite-acc__scoreText"],children:[O,"%"]})]})})]}),e("div",{className:s["cite-acc__explain-body"],children:[i("div",{className:s["cite-acc__innerHeader"],children:i("div",{className:s["cite-acc__innerHeaderLeft"],children:i("div",{children:i("div",{className:s["cite-acc__innerTitle"],children:Q})})})}),i("div",{className:`${s["cite-acc__innerBody"]} text-sm text-gray-600`,children:ne?i(b,{text:v||"",markdownStyles:B,citationStyles:D,customIcons:H}):i(y,{text:v||"",item:t||{}})})]}),e("div",{className:`${s["cite-acc__explain-body"]} ${s["cite-acc__explain-body_border"]}`,children:[i("div",{className:s["cite-acc__innerHeader"],children:i("div",{className:s["cite-acc__innerHeaderLeft"],children:i("div",{children:i("div",{className:s["cite-acc__innerTitle"],children:V})})})}),i("div",{className:`${s["cite-acc__innerBody"]} text-sm text-gray-600`,children:ne?i(b,{text:z||"",markdownStyles:B,citationStyles:D,customIcons:H}):i(y,{text:z||"",item:t||{}})})]})]})})]})},(e,i)=>e.disableAllActions===i.disableAllActions&&(e.redlineId===i.redlineId&&(e.aiReasonId===i.aiReasonId&&(e.relevanceScore===i.relevanceScore&&(e.reason===i.reason&&(e.impact===i.impact&&(e.explaination===i.explaination&&e.gap===i.gap)))))));export{g as default};
2
2
  //# sourceMappingURL=CognitiveComponent.js.map
@@ -1,2 +1,2 @@
1
- import{jsxs as e,jsx as i,Fragment as t}from"react/jsx-runtime";import{PenLine as n,CheckCircle as o,XCircle as l,Info as r,ChevronDown as d,ChevronRight as a}from"lucide-react";import s,{memo as c,useState as p}from"react";import{ToneToggle as g}from"./ToneToggle.js";import"../CognitiveComponents/CitationComponent.module.css.js";import{ReactComponent as h}from"../icons/cognitiveBrain.svg.js";import{ReactComponent as u}from"../icons/aiMagic.svg.js";import{Tooltip as v}from"@mui/material";import{useRequirementAI as m}from"../../RequirementAIWrapper/RequirementAIWrapper.js";import{resolveRedline as x}from"../../../../../service/redlineService.js";import{AiReasonMarkdownWrapper as f}from"../../ai-reasoning/AiReasonMarkdownWrapper.js";const y=[{color:"#1D9E75",angle:-90,arcD:"M1 13 A10 10 0 0 1 1 13"},{color:"#BA7517",angle:0,arcD:"M1 13 A10 10 0 0 1 11 3"},{color:"#E24B4A",angle:90,arcD:"M1 13 A10 10 0 0 1 21 13"}],w=({toneIndex:t,configs:n=y})=>{const o=Math.min(t,n.length-1),{color:l,angle:r,arcD:d}=n[o]||n[1]||n[0],a=(r-90)*Math.PI/180,s=11+9*Math.cos(a),c=13+9*Math.sin(a);return e("svg",{width:"22",height:"14",viewBox:"0 0 22 14",fill:"none",children:[i("path",{d:"M1 13 A10 10 0 0 1 21 13",stroke:"#e5e5e5",strokeWidth:"2.5",strokeLinecap:"round"}),i("path",{d:d,stroke:l,strokeWidth:"2.5",strokeLinecap:"round"}),i("line",{x1:"11",y1:"13",x2:s,y2:c,stroke:l,strokeWidth:"2",strokeLinecap:"round"})]})},S=({type:e,customStyles:t={}})=>{const n={High:{padding:"3.5px 7px",borderRadius:"100px",border:"1px solid #FECACA",background:"#FEF2F2",color:"#B91C1C",fontSize:"11px",fontWeight:"500"},Medium:{padding:"3.5px 7px",borderRadius:"100px",border:"1px solid #F2E5A1",background:"#FFFBEB",color:"#B45309",fontSize:"11px",fontWeight:"500"},Low:{padding:"3.5px 7px",borderRadius:"100px",border:"1px solid #8098F9",background:"#DBEAFE",color:"#444CE7",fontSize:"11px",fontWeight:"500"},...t},o=n[e]||n.Medium;return i("div",{style:o,children:e})},b=["Lenient","Balanced","Aggressive"],k={Lenient:"#1D9E75",Balanced:"#BA7517",Aggressive:"#E24B4A"},C={width:"350px",background:"#fff",border:"1px solid #ddd",borderRadius:"8px",padding:"16px",maxHeight:"450px",overflow:"auto"},I={display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:12,position:"relative"},B={fontSize:11,fontWeight:500,letterSpacing:"0.08em",color:"#E24B4A",textTransform:"uppercase"},T={fontSize:15,fontWeight:500,margin:"0 0 8px",color:"#111",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},A={fontSize:13,color:"#666",lineHeight:1.6,margin:"0 0 14px",maxHeight:"100px",overflow:"auto"},E={marginBottom:14,borderTop:"0.5px solid #eee",paddingTop:12},R={fontSize:13,color:"#666",lineHeight:1.6,margin:"8px 0 0",maxHeight:"100px",overflow:"auto"},W={display:"flex",alignItems:"center",gap:6,background:"none",border:"none",cursor:"pointer",padding:0,width:"100%"},z={fontSize:11,fontWeight:500,textTransform:"uppercase",letterSpacing:"0.08em",color:"#E24B4A"},L={display:"flex",gap:8,marginBottom:18},j={flex:1,display:"flex",alignItems:"center",justifyContent:"center",gap:5,fontSize:12,fontWeight:500,padding:"7px 4px",borderRadius:8,border:"0.5px solid #ccc",background:"#fff",cursor:"pointer"},F={background:"none",border:"none",cursor:"pointer",fontSize:16,color:"#888",lineHeight:1,padding:0},D={borderTop:"0.5px solid #eee",padding:"14px 0px"},M={display:"flex",alignItems:"center",width:"100%",background:"none",border:"none",cursor:"pointer",padding:0,marginBottom:4},H={cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"space-between",paddingTop:"12px",borderTop:"1px solid #eee",borderBottom:"none",paddingLeft:"12px",paddingRight:"12px"},_={display:"flex",alignItems:"center",gap:"4px",minWidth:0,flex:"1 1 auto",overflow:"hidden"},O={width:"28px",height:"28px",display:"inline-flex",alignItems:"center",justifyContent:"center",flex:"0 0 28px"},N={fontSize:"13px",color:"#101828",minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},P={display:"flex",alignItems:"center",gap:"10px",flex:"0 0 auto",minWidth:0,flexWrap:"nowrap"},$={display:"flex",padding:"4px 8px",alignItems:"center",gap:"4px",borderRadius:"var(--chip-border-radius, 16px)",border:"1px solid var(--Primitive-Gray-300, #d0d5dd)",flex:"0 1 auto",minWidth:0},V={color:"var(--Primitive-Purple-600, #6938ef)",fontFamily:"Inter",fontSize:"12px",fontStyle:"normal",fontWeight:500,lineHeight:"150%"},U={padding:"4px",border:"1px solid #EBEBEB",position:"absolute",width:"100px",textAlign:"center",borderRadius:"9px",background:"#fff",boxShadow:"0 2px 8px rgba(0,0,0,0.1)",zIndex:1e3,top:"100%",right:0},q=c(function({onAssignClick:t,onOpenCognitive:n,cognitiveIconSmall:o,cognitiveTootipTitle:l,historyIconSmall:r,onHistoryClick:d,historyTootipTitle:a}){const s="20px";return e("div",{style:{...U,minWidth:"200px"},children:[e("div",{style:{padding:"8px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"flex-start",gap:"10px"},onClick:t,children:[i("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:s,height:s,flexShrink:0},children:e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[i("path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}),i("path",{d:"M16 3.128a4 4 0 0 1 0 7.744"}),i("path",{d:"M22 21v-2a4 4 0 0 0-3-3.87"}),i("circle",{cx:"9",cy:"7",r:"4"})]})}),i("span",{style:{fontSize:"13px",display:"flex",alignItems:"center",flex:1,textAlign:"left"},children:"Assign"})]}),n&&e("div",{style:{padding:"8px",borderTop:"1px solid #EBEBEB",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"flex-start",gap:"10px"},onClick:e=>n(e),children:[o&&i("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:s,height:s,flexShrink:0},children:o}),i("span",{style:{fontSize:"13px",display:"flex",alignItems:"center",flex:1,textAlign:"left",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:l})]}),d&&e("div",{style:{padding:"8px",borderTop:"1px solid #EBEBEB",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"flex-start",gap:"10px"},onClick:e=>d(e),children:[r&&i("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:s,height:s,flexShrink:0},children:r}),i("span",{style:{fontSize:"13px",display:"flex",alignItems:"center",flex:1,textAlign:"left",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:a})]})]})}),G=c(function({onAssignClick:t,onOpenCognitive:n,cognitiveIconSmall:o,cognitiveTootipTitle:l,historyIconSmall:r,onHistoryClick:d,historyTootipTitle:a}){const[s,c]=p(!1);return e("div",{style:{position:"relative",display:"flex"},children:[i("button",{onClick:()=>c(!s),style:{border:"none",background:"transparent",display:"flex",alignItems:"center",cursor:"pointer",fontSize:"18px",padding:0},children:e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"#64748B",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[i("circle",{cx:"12",cy:"12",r:"1"}),i("circle",{cx:"12",cy:"5",r:"1"}),i("circle",{cx:"12",cy:"19",r:"1"})]})}),s&&i(q,{onAssignClick:t?()=>{c(!1),t&&t()}:void 0,onOpenCognitive:n?e=>{c(!1),n&&n(e)}:void 0,cognitiveIconSmall:o,cognitiveTootipTitle:l,historyIconSmall:r,onHistoryClick:d,historyTootipTitle:a})]})}),J=c(function({users:t,onClick:n}){const o=t.length;return e("div",{onClick:n,style:{display:"flex",padding:"2px 6px",border:"1px solid #E2E8F0",background:"#fff",cursor:"pointer",fontSize:"11px",gap:6,borderRadius:"16px",alignItems:"center"},children:[i("p",{style:{margin:"0px",display:"flex",alignItems:"center",color:"#475569",whiteSpace:"nowrap"},children:(null==t?void 0:t[0].length)>9?(null==t?void 0:t[0].slice(0,9))+"...":null==t?void 0:t[0]}),o>1&&e("p",{style:{margin:"0px",display:"flex",alignItems:"center",borderRadius:"50px",backgroundColor:"#E2E8F0",padding:"2px 6px",color:"#475569",fontWeight:500},children:["+",o-1]})]})}),K=c(function({steps:t}){if(!(null==t?void 0:t.length))return null;const n=t.length>=3;return i("div",{style:{width:"100%",maxWidth:"100%",boxSizing:"border-box",marginBottom:10,overflow:"hidden"},children:i("div",{style:{width:"100%",maxWidth:"100%",boxSizing:"border-box",display:"flex",alignItems:"center",border:"1px solid #CBD5E1",borderRadius:8,padding:n?"6px 8px":"8px 10px",background:"#F8FAFC",gap:n?4:8,overflow:"hidden"},children:t.map((o,l)=>{const r=(e=>{const i=[{bg:"#FEF08A",text:"#854D0E"},{bg:"#D1FAE5",text:"#065F46"},{bg:"#E0F2FE",text:"#0369A1"},{bg:"#F3E8FF",text:"#6B21A8"}];return i[e%i.length]})(l),d=l===t.length-1;return e(s.Fragment,{children:[e("div",{title:o.label,style:{minWidth:0,flex:"1 1 0",display:"flex",alignItems:"center",justifyContent:"center",gap:n?4:6,overflow:"hidden"},children:[(a=o.status,e("svg","approved"===a?{xmlns:"http://www.w3.org/2000/svg",width:n?"14":"16",height:n?"14":"16",viewBox:"0 0 24 24",fill:"none",stroke:"#10B981",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},children:[i("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),i("polyline",{points:"22 4 12 14.01 9 11.01"})]}:"rejected"===a?{xmlns:"http://www.w3.org/2000/svg",width:n?"14":"16",height:n?"14":"16",viewBox:"0 0 24 24",fill:"none",stroke:"#EF4444",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},children:[i("circle",{cx:"12",cy:"12",r:"10"}),i("path",{d:"m15 9-6 6"}),i("path",{d:"m9 9 6 6"})]}:{xmlns:"http://www.w3.org/2000/svg",width:n?"14":"16",height:n?"14":"16",viewBox:"0 0 24 24",fill:"none",stroke:"#F59E0B",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},children:[i("path",{d:"M5 22h14"}),i("path",{d:"M5 2h14"}),i("path",{d:"M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22"}),i("path",{d:"M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2"})]})),i("span",{style:{minWidth:0,color:"#475569",fontSize:n?12:13,lineHeight:"16px",fontWeight:600,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:o.label}),o.initials&&i("span",{style:{width:n?20:22,height:n?20:22,minWidth:n?20:22,borderRadius:"50%",background:r.bg,color:r.text,display:"flex",alignItems:"center",justifyContent:"center",fontSize:n?9:10,fontWeight:700,lineHeight:1},children:o.initials})]}),!d&&e("svg",{xmlns:"http://www.w3.org/2000/svg",width:n?"14":"18",height:n?"14":"18",viewBox:"0 0 24 24",fill:"none",stroke:"#94A3B8",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",style:{flex:"0 0 auto",minWidth:n?14:18},children:[i("path",{d:"M5 12h14"}),i("path",{d:"m12 5 7 7-7 7"})]})]},o.id);var a})})})});var Q=c(function({onClose:s,aiReason:c,onActionTrigger:U,onIterate:q,initialTone:Q,onRegenerate:X,labels:Y={},toneLevelsConfig:Z=b,toneColorsConfig:ee=k,dialConfigs:ie=y,actions:te,disableAllActions:ne=!1,customStyles:oe={},severityChipStyles:le={},customIcons:re={},onOpenCognitive:de,onHistoryClick:ae,historyIconSmall:se,historyTootipTitle:ce,showTone:pe=!0,cognitiveSectionStyle:ge={},cognitiveScoreBadgeStyle:he={},cognitiveScoreTextStyle:ue={},cognitiveStyles:ve={},cognitiveClassNames:me={},cognitiveTitle:xe="Cognitive Integrity",cognitiveTootipTitle:fe="Cognitive Decisioning",cognitiveLeftIcon:ye,cognitiveIconSmall:we,showCognitiveRightArrow:Se=!0,isStreaming:be,onAssignClick:ke,assignedUsers:Ce,onReviewUsersClick:Ie,redlineId:Be,aiReasonId:Te,displayVariant:Ae="default",reviewTitle:Ee,reviewSubtitle:Re,reviewStatusIcon:We=e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",className:"lucide lucide-hourglass-icon lucide-hourglass",children:[i("path",{d:"M5 22h14"}),i("path",{d:"M5 2h14"}),i("path",{d:"M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22"}),i("path",{d:"M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2"})]}),reviewSteps:ze=[],showReviewProgress:Le=!1,showOriginalText:je=!1,originalText:Fe,originalTextHeader:De="Original text",hideSummaryText:Me=!1,hideSeverityChip:He=!1}){var _e,Oe,Ne,Pe,$e,Ve,Ue,qe,Ge,Je,Ke,Qe,Xe,Ye,Ze,ei,ii,ti,ni,oi;let li=Z.findIndex(e=>e===Q);-1===li&&(li=1);const[ri,di]=p(!0),[ai,si]=p(!1),[ci,pi]=p(!1),[gi,hi]=p(li),[ui]=p(li),[vi,mi]=p(!0),xi="review"===Ae,fi=Z[gi],yi=ee[fi]||"#BA7517",wi=gi!==ui,Si=[{id:"iterate",icon:re.iterateIcon||i(n,{size:16,color:"#64748B"}),label:Y.btnIterate||"Iterate",color:"#64748B",onClick:q},{id:"accept",icon:re.acceptIcon||i(o,{size:16,color:"#10B981"}),label:Y.btnAccept||"Approve",color:"#10B981",useLabel:!0},{id:"reject",icon:re.rejectIcon||i(l,{size:16,color:"#DC2626"}),label:Y.btnReject||"Reject",color:"#DC2626",useLabel:!0}],{redlineDcoumentId:bi,redlineConfig:ki,updateRedlineDataParent:Ci}=m(),Ii=te||Si;return e("div",{onClick:e=>{e.stopPropagation()},style:{...C,...null===(_e=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===_e?void 0:_e.root},children:[e("div",{style:{...I,...null===(Oe=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===Oe?void 0:Oe.header,marginBottom:xi?14:ci?"16px":"12px",...xi&&{backgroundColor:"#F1F5F9",padding:"12px 16px",marginTop:"-16px",marginLeft:"-16px",marginRight:"-16px",borderTopLeftRadius:"8px",borderTopRightRadius:"8px",borderBottom:"1px solid #E2E8F0"}},children:[e("div",xi?{style:{minWidth:0,flex:"1 1 auto"},children:[e("div",{style:{display:"flex",alignItems:"center",gap:8,color:"#1E293B",fontSize:16,fontWeight:600,lineHeight:1.2},children:[i("span",{style:{display:"inline-flex",alignItems:"center",color:"#64748B"},children:We||re.summaryIcon||"⏳"}),i("span",{children:Ee||"Redline In Review"})]}),i("div",{style:{marginTop:6,paddingLeft:28,color:"#475569",fontSize:13,lineHeight:1.2,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:Re||(null===(Ne=null==c?void 0:c.redlining_details)||void 0===Ne?void 0:Ne.redline_title)})]}:{style:{display:"flex",alignItems:"center",gap:10},children:[e("div",{style:{display:"flex",alignItems:"center",gap:6},children:[i("span",{children:re.summaryIcon||i(r,{size:16,color:"#E24B4A"})}),i("span",{style:{...B,...null===(Pe=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===Pe?void 0:Pe.title},children:Y.summaryHeader||"Summary"})]}),Ce&&Ce.length>0&&i(J,{users:Ce,onClick:e=>{e.stopPropagation(),null==Ie||Ie()}})]}),e("div",{style:{display:"flex",gap:12,alignItems:"center"},children:[(ke||de||ae)&&i(G,{onAssignClick:ke,onOpenCognitive:de,cognitiveIconSmall:we,cognitiveTootipTitle:fe,historyIconSmall:se,onHistoryClick:ae,historyTootipTitle:ce}),i("button",{onClick:s,style:{...F,...null===($e=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===$e?void 0:$e.closeBtn,color:"#64748B",fontSize:16},children:"✕"})]})]}),xi&&Le&&ze.length>0&&i(K,{steps:ze}),!Me&&!xi&&i(t,{children:i(v,{title:null===(Ve=null==c?void 0:c.redlining_details)||void 0===Ve?void 0:Ve.redline_title,children:i("p",{style:{...T,...null===(Ue=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===Ue?void 0:Ue.bodyText},children:null===(qe=null==c?void 0:c.redlining_details)||void 0===qe?void 0:qe.redline_title})})}),i("p",{style:{...A,...null===(Ge=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===Ge?void 0:Ge.summary},children:null===(Je=null==c?void 0:c.redlining_details)||void 0===Je?void 0:Je.redline_summary}),e("div",{style:{...E,...null===(Ke=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===Ke?void 0:Ke.impactContainer},children:[e("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e("button",{onClick:()=>di(!ri),style:{...W,...null===(Qe=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===Qe?void 0:Qe.impactToggle},children:[i("span",{style:{...z,...null===(Xe=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===Xe?void 0:Xe.impactToggleLabel},children:Y.impactHeader||"Impact"}),i("span",{style:{fontSize:12,color:"#E24B4A",transition:"transform 0.2s",display:"flex",alignItems:"center",transform:ri?"rotate(180deg)":"rotate(0deg)"},children:i(d,{size:16,color:"#E24B4A"})})]}),i(S,{type:(null==c?void 0:c.severity)||"Medium",customStyles:le})]}),ri&&i(t,{children:i("div",{style:{...R,...null===(Ye=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===Ye?void 0:Ye.impactText},children:i(f,{message:`${null!==(ei=null===(Ze=null==c?void 0:c.redlining_details)||void 0===Ze?void 0:Ze.redline_impact)&&void 0!==ei?ei:Y.fallbackImpact||"This change reduces compliance obligations and lowers contractual risk thresholds."} [View chat](chat_citation$all)`,customStyles:null===(ii=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===ii?void 0:ii.impactMarkdown})})})]}),xi&&je&&e("div",{style:{borderTop:"1px solid #E2E8F0",paddingTop:14,marginBottom:20},children:[e("button",{onClick:()=>mi(e=>!e),style:{background:"none",border:"none",padding:0,width:"100%",display:"flex",alignItems:"center",justifyContent:"space-between",cursor:"pointer",color:"#1E293B",fontSize:21,fontWeight:600},children:[i("span",{children:De}),i(d,{size:18,color:"#1E293B",style:{transform:vi?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s"}})]}),vi&&e("div",{style:{marginTop:10,border:"1px solid #CBD5E1",borderRadius:12,padding:"16px 20px",background:"#F8FAFC",color:"#475569",fontSize:20,lineHeight:1.7,fontStyle:"italic",boxShadow:"0 1px 2px rgba(15, 23, 42, 0.08)"},children:["“",Fe||"","”"]})]}),i("div",{style:{...L,...null===(ti=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===ti?void 0:ti.actionContainer},children:Ii.map(i=>{var t,n;const o=ne||i.disabled,l=o?{cursor:"not-allowed",opacity:.5,...null===(t=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===t?void 0:t.actionBtnDisabled,...i.disabledStyle}:{};return e("button",{style:{...j,...null===(n=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===n?void 0:n.actionBtn,color:i.color,...i.style,...l},onClick:o?void 0:async()=>{var e,t;if(i.useLabel)try{await(null===(e=i.onClick)||void 0===e?void 0:e.call(i))}finally{await(async e=>{var i,t,n;null==U||U({status:"loading",action:e,metadata:{redlineId:Be,aiReasonId:Te}});try{const{updated_reqai:o}=await x({documentId:bi,userEmail:null==ki?void 0:ki.userEmail,userName:null==ki?void 0:ki.userName,redlineId:null!==(i=null==c?void 0:c.redline_id)&&void 0!==i?i:"",action:e,baseApiUrl:null==ki?void 0:ki.baseApiUrl,redlineConfigId:null!==(t=null==ki?void 0:ki.redlineConfigId)&&void 0!==t?t:""},null!==(n=null==ki?void 0:ki.token)&&void 0!==n?n:"");await(null==Ci?void 0:Ci(o)),null==U||U({status:"success",action:e,metadata:{redlineId:Be,aiReasonId:Te}})}catch(i){null==U||U({status:"failed",action:e,metadata:{redlineId:Be,aiReasonId:Te}})}})(i.id.toLowerCase())}else await(null===(t=i.onClick)||void 0===t?void 0:t.call(i))},disabled:o,children:[i.icon,i.label]},i.id)})}),pe&&e("div",{style:{...D,...null===(ni=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===ni?void 0:ni.toneContainer},children:[e("button",{onClick:()=>si(!ai),style:{...M,...null===(oi=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===oi?void 0:oi.toneToggleBtn},children:[e("div",{style:{display:"flex",alignItems:"center",gap:8},children:[i(w,{toneIndex:gi,configs:ie}),i("span",{style:{fontSize:13,fontWeight:500,color:"#111"},children:Y.toneHeader||"Redline Tone"})]}),i("span",{style:{transition:"transform 0.2s",display:"flex",alignItems:"center",transform:ai?"rotate(180deg)":"rotate(0deg)"},children:i(d,{size:16,color:"#111"})})]}),ai&&e(t,{children:[i("p",{style:{fontSize:12,color:"#888",margin:"0 0 12px"},children:Y.toneDescription||"Controls how assertively AI is redlining"}),i(g,{isDirty:wi,onToneChange:e=>{hi(e)},toneColor:yi,toneIndex:gi,onClickRegenerate:()=>null==X?void 0:X(fi),toneLabels:Z,isStreaming:be,aiReason:c})]})]}),de&&e("div",{className:null==me?void 0:me.section,onClick:e=>{e.stopPropagation(),de&&de(e)},style:{...H,...null==ve?void 0:ve.section,...ge},children:[e("div",{className:null==me?void 0:me.headerLeft,style:{..._,...null==ve?void 0:ve.headerLeft},children:[i("span",{className:null==me?void 0:me.titleIcon,style:{...O,...null==ve?void 0:ve.titleIcon},children:null!=ye?ye:i(h,{})}),i("div",{className:null==me?void 0:me.cognitiveTitle,style:{...N,...null==ve?void 0:ve.cognitiveTitle},children:xe})]}),e("div",{className:null==me?void 0:me.headerRight,style:{...P,...null==ve?void 0:ve.headerRight},children:[void 0!==(null==c?void 0:c.relevance_score)&&null!==(null==c?void 0:c.relevance_score)?e("span",{className:null==me?void 0:me.scoreBadge,style:{...$,...null==ve?void 0:ve.scoreBadge,...he},children:[i(u,{}),e("span",{className:null==me?void 0:me.scoreText,style:{...V,...null==ve?void 0:ve.scoreText,...ue},children:[Math.round(Number(c.relevance_score)),"%"]})]}):null,Se&&i("span",{style:{display:"flex",alignItems:"center"},children:i(a,{size:16,color:"#64748B"})})]})]})]})},(e,i)=>{var t,n,o,l;if(e.displayVariant!==i.displayVariant)return!1;if(e.reviewTitle!==i.reviewTitle)return!1;if(e.reviewSubtitle!==i.reviewSubtitle)return!1;if(e.showReviewProgress!==i.showReviewProgress)return!1;if(e.showOriginalText!==i.showOriginalText)return!1;if(e.originalText!==i.originalText)return!1;if(e.hideSummaryText!==i.hideSummaryText)return!1;if(e.hideSeverityChip!==i.hideSeverityChip)return!1;if((null!==(n=null===(t=e.reviewSteps)||void 0===t?void 0:t.length)&&void 0!==n?n:0)!==(null!==(l=null===(o=i.reviewSteps)||void 0===o?void 0:o.length)&&void 0!==l?l:0))return!1;if(e.reviewSteps&&i.reviewSteps){if(e.reviewSteps.map(e=>`${e.id}:${e.label}:${e.initials}:${e.status}`).join("|")!==i.reviewSteps.map(e=>`${e.id}:${e.label}:${e.initials}:${e.status}`).join("|"))return!1}return!0});export{q as AssignMenu,J as DisplayUsers,G as KebabMenu,Q as default};
1
+ import{jsxs as e,jsx as i,Fragment as t}from"react/jsx-runtime";import{PenLine as n,CheckCircle as o,XCircle as l,Info as r,ChevronDown as d,ChevronRight as a}from"lucide-react";import s,{memo as c,useState as p}from"react";import{ToneToggle as g}from"./ToneToggle.js";import"../CognitiveComponents/CitationComponent.module.css.js";import{ReactComponent as h}from"../icons/cognitiveBrain.svg.js";import{ReactComponent as u}from"../icons/aiMagic.svg.js";import{Tooltip as v}from"@mui/material";import{useRequirementAI as m}from"../../RequirementAIWrapper/RequirementAIWrapper.js";import{resolveRedline as x}from"../../../../../service/redlineService.js";import{AiReasonMarkdownWrapper as f}from"../../ai-reasoning/AiReasonMarkdownWrapper.js";import y from"../cws/CwsEvent.js";const w=[{color:"#1D9E75",angle:-90,arcD:"M1 13 A10 10 0 0 1 1 13"},{color:"#BA7517",angle:0,arcD:"M1 13 A10 10 0 0 1 11 3"},{color:"#E24B4A",angle:90,arcD:"M1 13 A10 10 0 0 1 21 13"}],S=({toneIndex:t,configs:n=w})=>{const o=Math.min(t,n.length-1),{color:l,angle:r,arcD:d}=n[o]||n[1]||n[0],a=(r-90)*Math.PI/180,s=11+9*Math.cos(a),c=13+9*Math.sin(a);return e("svg",{width:"22",height:"14",viewBox:"0 0 22 14",fill:"none",children:[i("path",{d:"M1 13 A10 10 0 0 1 21 13",stroke:"#e5e5e5",strokeWidth:"2.5",strokeLinecap:"round"}),i("path",{d:d,stroke:l,strokeWidth:"2.5",strokeLinecap:"round"}),i("line",{x1:"11",y1:"13",x2:s,y2:c,stroke:l,strokeWidth:"2",strokeLinecap:"round"})]})},b=({type:e,customStyles:t={}})=>{const n={High:{padding:"3.5px 7px",borderRadius:"100px",border:"1px solid #FECACA",background:"#FEF2F2",color:"#B91C1C",fontSize:"11px",fontWeight:"500"},Medium:{padding:"3.5px 7px",borderRadius:"100px",border:"1px solid #F2E5A1",background:"#FFFBEB",color:"#B45309",fontSize:"11px",fontWeight:"500"},Low:{padding:"3.5px 7px",borderRadius:"100px",border:"1px solid #8098F9",background:"#DBEAFE",color:"#444CE7",fontSize:"11px",fontWeight:"500"},...t},o=n[e]||n.Medium;return i("div",{style:o,children:e})},k=["Lenient","Balanced","Aggressive"],C={Lenient:"#1D9E75",Balanced:"#BA7517",Aggressive:"#E24B4A"},I={width:"350px",background:"#fff",border:"1px solid #ddd",borderRadius:"8px",padding:"16px",maxHeight:"450px",overflow:"auto"},B={display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:12,position:"relative"},T={fontSize:11,fontWeight:500,letterSpacing:"0.08em",color:"#E24B4A",textTransform:"uppercase"},A={fontSize:15,fontWeight:500,margin:"0 0 8px",color:"#111",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},E={fontSize:13,color:"#666",lineHeight:1.6,margin:"0 0 14px",maxHeight:"100px",overflow:"auto"},R={marginBottom:14,borderTop:"0.5px solid #eee",paddingTop:12},W={fontSize:13,color:"#666",lineHeight:1.6,margin:"8px 0 0",maxHeight:"100px",overflow:"auto"},z={display:"flex",alignItems:"center",gap:6,background:"none",border:"none",cursor:"pointer",padding:0,width:"100%"},j={fontSize:11,fontWeight:500,textTransform:"uppercase",letterSpacing:"0.08em",color:"#E24B4A"},L={display:"flex",gap:8,marginBottom:18},D={flex:1,display:"flex",alignItems:"center",justifyContent:"center",gap:5,fontSize:12,fontWeight:500,padding:"7px 4px",borderRadius:8,border:"0.5px solid #ccc",background:"#fff",cursor:"pointer"},F={background:"none",border:"none",cursor:"pointer",fontSize:16,color:"#888",lineHeight:1,padding:0},M={borderTop:"0.5px solid #eee",padding:"14px 0px"},H={display:"flex",alignItems:"center",width:"100%",background:"none",border:"none",cursor:"pointer",padding:0,marginBottom:4},_={cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"space-between",paddingTop:"12px",borderTop:"1px solid #eee",borderBottom:"none",paddingLeft:"12px",paddingRight:"12px"},O={display:"flex",alignItems:"center",gap:"4px",minWidth:0,flex:"1 1 auto",overflow:"hidden"},N={width:"28px",height:"28px",display:"inline-flex",alignItems:"center",justifyContent:"center",flex:"0 0 28px"},$={fontSize:"13px",color:"#101828",minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},P={display:"flex",alignItems:"center",gap:"10px",flex:"0 0 auto",minWidth:0,flexWrap:"nowrap"},V={display:"flex",padding:"4px 8px",alignItems:"center",gap:"4px",borderRadius:"var(--chip-border-radius, 16px)",border:"1px solid var(--Primitive-Gray-300, #d0d5dd)",flex:"0 1 auto",minWidth:0},U={color:"var(--Primitive-Purple-600, #6938ef)",fontFamily:"Inter",fontSize:"12px",fontStyle:"normal",fontWeight:500,lineHeight:"150%"},q={padding:"4px",border:"1px solid #EBEBEB",position:"absolute",width:"100px",textAlign:"center",borderRadius:"9px",background:"#fff",boxShadow:"0 2px 8px rgba(0,0,0,0.1)",zIndex:1e3,top:"100%",right:0},G=c(function({onAssignClick:t,onOpenCognitive:n,cognitiveIconSmall:o,cognitiveTootipTitle:l,historyIconSmall:r,onHistoryClick:d,historyTootipTitle:a}){const s="20px";return e("div",{style:{...q,minWidth:"200px"},children:[e("div",{style:{padding:"8px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"flex-start",gap:"10px"},onClick:t,children:[i("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:s,height:s,flexShrink:0},children:e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[i("path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}),i("path",{d:"M16 3.128a4 4 0 0 1 0 7.744"}),i("path",{d:"M22 21v-2a4 4 0 0 0-3-3.87"}),i("circle",{cx:"9",cy:"7",r:"4"})]})}),i("span",{style:{fontSize:"13px",display:"flex",alignItems:"center",flex:1,textAlign:"left"},children:"Assign"})]}),n&&e("div",{style:{padding:"8px",borderTop:"1px solid #EBEBEB",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"flex-start",gap:"10px"},onClick:e=>n(e),children:[o&&i("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:s,height:s,flexShrink:0},children:o}),i("span",{style:{fontSize:"13px",display:"flex",alignItems:"center",flex:1,textAlign:"left",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:l})]}),d&&e("div",{style:{padding:"8px",borderTop:"1px solid #EBEBEB",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"flex-start",gap:"10px"},onClick:e=>d(e),children:[r&&i("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:s,height:s,flexShrink:0},children:r}),i("span",{style:{fontSize:"13px",display:"flex",alignItems:"center",flex:1,textAlign:"left",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:a})]})]})}),J=c(function({onAssignClick:t,onOpenCognitive:n,cognitiveIconSmall:o,cognitiveTootipTitle:l,historyIconSmall:r,onHistoryClick:d,historyTootipTitle:a}){const[s,c]=p(!1);return e("div",{style:{position:"relative",display:"flex"},children:[i("button",{onClick:()=>c(!s),style:{border:"none",background:"transparent",display:"flex",alignItems:"center",cursor:"pointer",fontSize:"18px",padding:0},children:e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"#64748B",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[i("circle",{cx:"12",cy:"12",r:"1"}),i("circle",{cx:"12",cy:"5",r:"1"}),i("circle",{cx:"12",cy:"19",r:"1"})]})}),s&&i(G,{onAssignClick:t?()=>{c(!1),t&&t()}:void 0,onOpenCognitive:n?e=>{c(!1),n&&n(e)}:void 0,cognitiveIconSmall:o,cognitiveTootipTitle:l,historyIconSmall:r,onHistoryClick:d,historyTootipTitle:a})]})}),K=c(function({users:t,onClick:n}){const o=t.length;return e("div",{onClick:n,style:{display:"flex",padding:"2px 6px",border:"1px solid #E2E8F0",background:"#fff",cursor:"pointer",fontSize:"11px",gap:6,borderRadius:"16px",alignItems:"center"},children:[i("p",{style:{margin:"0px",display:"flex",alignItems:"center",color:"#475569",whiteSpace:"nowrap"},children:(null==t?void 0:t[0].length)>9?(null==t?void 0:t[0].slice(0,9))+"...":null==t?void 0:t[0]}),o>1&&e("p",{style:{margin:"0px",display:"flex",alignItems:"center",borderRadius:"50px",backgroundColor:"#E2E8F0",padding:"2px 6px",color:"#475569",fontWeight:500},children:["+",o-1]})]})}),Q=c(function({steps:t}){if(!(null==t?void 0:t.length))return null;const n=t.length>=3;return i("div",{style:{width:"100%",maxWidth:"100%",boxSizing:"border-box",marginBottom:10,overflow:"hidden"},children:i("div",{style:{width:"100%",maxWidth:"100%",boxSizing:"border-box",display:"flex",alignItems:"center",border:"1px solid #CBD5E1",borderRadius:8,padding:n?"6px 8px":"8px 10px",background:"#F8FAFC",gap:n?4:8,overflow:"hidden"},children:t.map((o,l)=>{const r=(e=>{const i=[{bg:"#FEF08A",text:"#854D0E"},{bg:"#D1FAE5",text:"#065F46"},{bg:"#E0F2FE",text:"#0369A1"},{bg:"#F3E8FF",text:"#6B21A8"}];return i[e%i.length]})(l),d=l===t.length-1;return e(s.Fragment,{children:[e("div",{title:o.label,style:{minWidth:0,flex:"1 1 0",display:"flex",alignItems:"center",justifyContent:"center",gap:n?4:6,overflow:"hidden"},children:[(a=o.status,e("svg","approved"===a?{xmlns:"http://www.w3.org/2000/svg",width:n?"14":"16",height:n?"14":"16",viewBox:"0 0 24 24",fill:"none",stroke:"#10B981",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},children:[i("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),i("polyline",{points:"22 4 12 14.01 9 11.01"})]}:"rejected"===a?{xmlns:"http://www.w3.org/2000/svg",width:n?"14":"16",height:n?"14":"16",viewBox:"0 0 24 24",fill:"none",stroke:"#EF4444",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},children:[i("circle",{cx:"12",cy:"12",r:"10"}),i("path",{d:"m15 9-6 6"}),i("path",{d:"m9 9 6 6"})]}:{xmlns:"http://www.w3.org/2000/svg",width:n?"14":"16",height:n?"14":"16",viewBox:"0 0 24 24",fill:"none",stroke:"#F59E0B",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},children:[i("path",{d:"M5 22h14"}),i("path",{d:"M5 2h14"}),i("path",{d:"M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22"}),i("path",{d:"M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2"})]})),i("span",{style:{minWidth:0,color:"#475569",fontSize:n?12:13,lineHeight:"16px",fontWeight:600,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:o.label}),o.initials&&i("span",{style:{width:n?20:22,height:n?20:22,minWidth:n?20:22,borderRadius:"50%",background:r.bg,color:r.text,display:"flex",alignItems:"center",justifyContent:"center",fontSize:n?9:10,fontWeight:700,lineHeight:1},children:o.initials})]}),!d&&e("svg",{xmlns:"http://www.w3.org/2000/svg",width:n?"14":"18",height:n?"14":"18",viewBox:"0 0 24 24",fill:"none",stroke:"#94A3B8",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",style:{flex:"0 0 auto",minWidth:n?14:18},children:[i("path",{d:"M5 12h14"}),i("path",{d:"m12 5 7 7-7 7"})]})]},o.id);var a})})})});var X=c(function({onClose:s,aiReason:c,onActionTrigger:q,onIterate:G,initialTone:X,onRegenerate:Y,labels:Z={},toneLevelsConfig:ee=k,toneColorsConfig:ie=C,dialConfigs:te=w,actions:ne,disableAllActions:oe=!1,customStyles:le={},severityChipStyles:re={},customIcons:de={},onOpenCognitive:ae,onHistoryClick:se,historyIconSmall:ce,historyTootipTitle:pe,showTone:ge=!0,cognitiveSectionStyle:he={},cognitiveScoreBadgeStyle:ue={},cognitiveScoreTextStyle:ve={},cognitiveStyles:me={},cognitiveClassNames:xe={},cognitiveTitle:fe="Cognitive Integrity",cognitiveTootipTitle:ye="Cognitive Decisioning",cognitiveLeftIcon:we,cognitiveIconSmall:Se,showCognitiveRightArrow:be=!0,isStreaming:ke,onAssignClick:Ce,assignedUsers:Ie,onReviewUsersClick:Be,redlineId:Te,aiReasonId:Ae,displayVariant:Ee="default",reviewTitle:Re,reviewSubtitle:We,reviewStatusIcon:ze=e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",className:"lucide lucide-hourglass-icon lucide-hourglass",children:[i("path",{d:"M5 22h14"}),i("path",{d:"M5 2h14"}),i("path",{d:"M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22"}),i("path",{d:"M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2"})]}),reviewSteps:je=[],showReviewProgress:Le=!1,showOriginalText:De=!1,originalText:Fe,originalTextHeader:Me="Original text",hideSummaryText:He=!1,hideSeverityChip:_e=!1}){var Oe,Ne,$e,Pe,Ve,Ue,qe,Ge,Je,Ke,Qe,Xe,Ye,Ze,ei,ii,ti,ni,oi,li;let ri=ee.findIndex(e=>e===X);-1===ri&&(ri=1);const[di,ai]=p(!0),[si,ci]=p(!1),[pi,gi]=p(!1),[hi,ui]=p(ri),[vi]=p(ri),[mi,xi]=p(!0),fi="review"===Ee,yi=ee[hi],wi=ie[yi]||"#BA7517",Si=hi!==vi,bi=[{id:"iterate",icon:de.iterateIcon||i(n,{size:16,color:"#64748B"}),label:Z.btnIterate||"Iterate",color:"#64748B",onClick:G},{id:"accept",icon:de.acceptIcon||i(o,{size:16,color:"#10B981"}),label:Z.btnAccept||"Approve",color:"#10B981",useLabel:!0},{id:"reject",icon:de.rejectIcon||i(l,{size:16,color:"#DC2626"}),label:Z.btnReject||"Reject",color:"#DC2626",useLabel:!0}],{redlineDcoumentId:ki,redlineConfig:Ci,updateRedlineDataParent:Ii}=m(),Bi=ne||bi;return e("div",{onClick:e=>{e.stopPropagation()},style:{...I,...null===(Oe=null==le?void 0:le.DeviationSummaryStyles)||void 0===Oe?void 0:Oe.root},children:[e("div",{style:{...B,...null===(Ne=null==le?void 0:le.DeviationSummaryStyles)||void 0===Ne?void 0:Ne.header,marginBottom:fi?14:pi?"16px":"12px",...fi&&{backgroundColor:"#F1F5F9",padding:"12px 16px",marginTop:"-16px",marginLeft:"-16px",marginRight:"-16px",borderTopLeftRadius:"8px",borderTopRightRadius:"8px",borderBottom:"1px solid #E2E8F0"}},children:[e("div",fi?{style:{minWidth:0,flex:"1 1 auto"},children:[e("div",{style:{display:"flex",alignItems:"center",gap:8,color:"#1E293B",fontSize:16,fontWeight:600,lineHeight:1.2},children:[i("span",{style:{display:"inline-flex",alignItems:"center",color:"#64748B"},children:ze||de.summaryIcon||"⏳"}),i("span",{children:Re||"Redline In Review"})]}),i("div",{style:{marginTop:6,paddingLeft:28,color:"#475569",fontSize:13,lineHeight:1.2,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:We||(null===($e=null==c?void 0:c.redlining_details)||void 0===$e?void 0:$e.redline_title)})]}:{style:{display:"flex",alignItems:"center",gap:10},children:[e("div",{style:{display:"flex",alignItems:"center",gap:6},children:[i("span",{children:de.summaryIcon||i(r,{size:16,color:"#E24B4A"})}),i("span",{style:{...T,...null===(Pe=null==le?void 0:le.DeviationSummaryStyles)||void 0===Pe?void 0:Pe.title},children:Z.summaryHeader||"Summary"})]}),Ie&&Ie.length>0&&i(K,{users:Ie,onClick:e=>{e.stopPropagation(),null==Be||Be()}})]}),e("div",{style:{display:"flex",gap:12,alignItems:"center"},children:[(Ce||ae||se)&&i(J,{onAssignClick:Ce,onOpenCognitive:ae,cognitiveIconSmall:Se,cognitiveTootipTitle:ye,historyIconSmall:ce,onHistoryClick:se,historyTootipTitle:pe}),i("button",{onClick:s,style:{...F,...null===(Ve=null==le?void 0:le.DeviationSummaryStyles)||void 0===Ve?void 0:Ve.closeBtn,color:"#64748B",fontSize:16},children:"✕"})]})]}),fi&&Le&&je.length>0&&i(Q,{steps:je}),!He&&!fi&&i(t,{children:i(v,{title:null===(Ue=null==c?void 0:c.redlining_details)||void 0===Ue?void 0:Ue.redline_title,children:i("p",{style:{...A,...null===(qe=null==le?void 0:le.DeviationSummaryStyles)||void 0===qe?void 0:qe.bodyText},children:null===(Ge=null==c?void 0:c.redlining_details)||void 0===Ge?void 0:Ge.redline_title})})}),i("p",{style:{...E,...null===(Je=null==le?void 0:le.DeviationSummaryStyles)||void 0===Je?void 0:Je.summary},children:null===(Ke=null==c?void 0:c.redlining_details)||void 0===Ke?void 0:Ke.redline_summary}),e("div",{style:{...R,...null===(Qe=null==le?void 0:le.DeviationSummaryStyles)||void 0===Qe?void 0:Qe.impactContainer},children:[e("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e("button",{onClick:()=>ai(!di),style:{...z,...null===(Xe=null==le?void 0:le.DeviationSummaryStyles)||void 0===Xe?void 0:Xe.impactToggle},children:[i("span",{style:{...j,...null===(Ye=null==le?void 0:le.DeviationSummaryStyles)||void 0===Ye?void 0:Ye.impactToggleLabel},children:Z.impactHeader||"Impact"}),i("span",{style:{fontSize:12,color:"#E24B4A",transition:"transform 0.2s",display:"flex",alignItems:"center",transform:di?"rotate(180deg)":"rotate(0deg)"},children:i(d,{size:16,color:"#E24B4A"})})]}),i(b,{type:(null==c?void 0:c.severity)||"Medium",customStyles:re})]}),di&&i(t,{children:i("div",{style:{...W,...null===(Ze=null==le?void 0:le.DeviationSummaryStyles)||void 0===Ze?void 0:Ze.impactText},children:i(f,{message:`${null!==(ii=null===(ei=null==c?void 0:c.redlining_details)||void 0===ei?void 0:ei.redline_impact)&&void 0!==ii?ii:Z.fallbackImpact||"This change reduces compliance obligations and lowers contractual risk thresholds."} [View chat](chat_citation$all)`,customStyles:null===(ti=null==le?void 0:le.DeviationSummaryStyles)||void 0===ti?void 0:ti.impactMarkdown})})})]}),fi&&De&&e("div",{style:{borderTop:"1px solid #E2E8F0",paddingTop:14,marginBottom:20},children:[e("button",{onClick:()=>xi(e=>!e),style:{background:"none",border:"none",padding:0,width:"100%",display:"flex",alignItems:"center",justifyContent:"space-between",cursor:"pointer",color:"#1E293B",fontSize:21,fontWeight:600},children:[i("span",{children:Me}),i(d,{size:18,color:"#1E293B",style:{transform:mi?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s"}})]}),mi&&e("div",{style:{marginTop:10,border:"1px solid #CBD5E1",borderRadius:12,padding:"16px 20px",background:"#F8FAFC",color:"#475569",fontSize:20,lineHeight:1.7,fontStyle:"italic",boxShadow:"0 1px 2px rgba(15, 23, 42, 0.08)"},children:["“",Fe||"","”"]})]}),i("div",{style:{...L,...null===(ni=null==le?void 0:le.DeviationSummaryStyles)||void 0===ni?void 0:ni.actionContainer},children:Bi.map(i=>{var t,n;const o=oe||i.disabled,l=o?{cursor:"not-allowed",opacity:.5,...null===(t=null==le?void 0:le.DeviationSummaryStyles)||void 0===t?void 0:t.actionBtnDisabled,...i.disabledStyle}:{};return e("button",{style:{...D,...null===(n=null==le?void 0:le.DeviationSummaryStyles)||void 0===n?void 0:n.actionBtn,color:i.color,...i.style,...l},onClick:o?void 0:async()=>{var e,t;if(i.useLabel)try{await(null===(e=i.onClick)||void 0===e?void 0:e.call(i))}finally{await(async e=>{var i,t,n,o,l,r;null==q||q({status:"loading",action:e,metadata:{redlineId:Te,aiReasonId:Ae}});try{const{updated_reqai:d}=await x({documentId:ki,userEmail:null==Ci?void 0:Ci.userEmail,userName:null==Ci?void 0:Ci.userName,redlineId:null!==(i=null==c?void 0:c.redline_id)&&void 0!==i?i:"",action:e,baseApiUrl:null==Ci?void 0:Ci.baseApiUrl,redlineConfigId:null!==(t=null==Ci?void 0:Ci.redlineConfigId)&&void 0!==t?t:""},null!==(n=null==Ci?void 0:Ci.token)&&void 0!==n?n:"");await(null==Ii?void 0:Ii(d)),y.emit(`redline-edit:${ki}:${null===(r=null===(l=null===(o=null==d?void 0:d.artifactData)||void 0===o?void 0:o.userStorySnapshot)||void 0===l?void 0:l[0])||void 0===r?void 0:r.artifactId}`,{updatedBy:null==Ci?void 0:Ci.userName}),null==q||q({status:"success",action:e,metadata:{redlineId:Te,aiReasonId:Ae}})}catch(i){null==q||q({status:"failed",action:e,metadata:{redlineId:Te,aiReasonId:Ae}})}})(i.id.toLowerCase())}else await(null===(t=i.onClick)||void 0===t?void 0:t.call(i))},disabled:o,children:[i.icon,i.label]},i.id)})}),ge&&e("div",{style:{...M,...null===(oi=null==le?void 0:le.DeviationSummaryStyles)||void 0===oi?void 0:oi.toneContainer},children:[e("button",{onClick:()=>ci(!si),style:{...H,...null===(li=null==le?void 0:le.DeviationSummaryStyles)||void 0===li?void 0:li.toneToggleBtn},children:[e("div",{style:{display:"flex",alignItems:"center",gap:8},children:[i(S,{toneIndex:hi,configs:te}),i("span",{style:{fontSize:13,fontWeight:500,color:"#111"},children:Z.toneHeader||"Redline Tone"})]}),i("span",{style:{transition:"transform 0.2s",display:"flex",alignItems:"center",transform:si?"rotate(180deg)":"rotate(0deg)"},children:i(d,{size:16,color:"#111"})})]}),si&&e(t,{children:[i("p",{style:{fontSize:12,color:"#888",margin:"0 0 12px"},children:Z.toneDescription||"Controls how assertively AI is redlining"}),i(g,{isDirty:Si,onToneChange:e=>{ui(e)},toneColor:wi,toneIndex:hi,onClickRegenerate:()=>null==Y?void 0:Y(yi),toneLabels:ee,isStreaming:ke,aiReason:c})]})]}),ae&&e("div",{className:null==xe?void 0:xe.section,onClick:e=>{e.stopPropagation(),ae&&ae(e)},style:{..._,...null==me?void 0:me.section,...he},children:[e("div",{className:null==xe?void 0:xe.headerLeft,style:{...O,...null==me?void 0:me.headerLeft},children:[i("span",{className:null==xe?void 0:xe.titleIcon,style:{...N,...null==me?void 0:me.titleIcon},children:null!=we?we:i(h,{})}),i("div",{className:null==xe?void 0:xe.cognitiveTitle,style:{...$,...null==me?void 0:me.cognitiveTitle},children:fe})]}),e("div",{className:null==xe?void 0:xe.headerRight,style:{...P,...null==me?void 0:me.headerRight},children:[void 0!==(null==c?void 0:c.relevance_score)&&null!==(null==c?void 0:c.relevance_score)?e("span",{className:null==xe?void 0:xe.scoreBadge,style:{...V,...null==me?void 0:me.scoreBadge,...ue},children:[i(u,{}),e("span",{className:null==xe?void 0:xe.scoreText,style:{...U,...null==me?void 0:me.scoreText,...ve},children:[Math.round(Number(c.relevance_score)),"%"]})]}):null,be&&i("span",{style:{display:"flex",alignItems:"center"},children:i(a,{size:16,color:"#64748B"})})]})]})]})},(e,i)=>{var t,n,o,l;if(e.displayVariant!==i.displayVariant)return!1;if(e.reviewTitle!==i.reviewTitle)return!1;if(e.reviewSubtitle!==i.reviewSubtitle)return!1;if(e.showReviewProgress!==i.showReviewProgress)return!1;if(e.showOriginalText!==i.showOriginalText)return!1;if(e.originalText!==i.originalText)return!1;if(e.hideSummaryText!==i.hideSummaryText)return!1;if(e.hideSeverityChip!==i.hideSeverityChip)return!1;if((null!==(n=null===(t=e.reviewSteps)||void 0===t?void 0:t.length)&&void 0!==n?n:0)!==(null!==(l=null===(o=i.reviewSteps)||void 0===o?void 0:o.length)&&void 0!==l?l:0))return!1;if(e.reviewSteps&&i.reviewSteps){if(e.reviewSteps.map(e=>`${e.id}:${e.label}:${e.initials}:${e.status}`).join("|")!==i.reviewSteps.map(e=>`${e.id}:${e.label}:${e.initials}:${e.status}`).join("|"))return!1}return!0});export{G as AssignMenu,K as DisplayUsers,J as KebabMenu,X as default};
2
2
  //# sourceMappingURL=DeviationSummary.js.map