@viswa-test/test-citation 0.0.235 → 0.0.236
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/features/CognitiveCompare/CognitiveCompare.js +1 -1
- package/dist/cjs/features/CognitiveCompare/CognitiveComparehelpers.js +1 -1
- package/dist/cjs/features/CognitiveCompare/components/RHSSectionRow.js +1 -1
- package/dist/cjs/features/CognitiveCompare/components/SectionAccordion.js +1 -1
- package/dist/cjs/features/CognitiveCompare/components/SubSectionAccordion.js +1 -1
- package/dist/cjs/features/CognitiveCompare/hooks/memoizedMarkdown.js +1 -1
- package/dist/cjs/features/GptWebCitation/GptWebCitationMarkdown.js +2 -0
- package/dist/cjs/features/GptWebCitation/GptWebCitationMarkdown.js.map +1 -0
- package/dist/cjs/features/RequirementAI/components/RichTextEditor/Editor/Editor.js +1 -1
- package/dist/cjs/features/RequirementAI/components/RichTextEditor/Editor/plugins/ManualNode.js +1 -1
- package/dist/cjs/features/RequirementAI/components/RichTextEditor/Editor/plugins/UpdateNode.js +1 -1
- package/dist/cjs/features/RequirementAI/components/RichTextEditor/Editor/theme/theme.css.js +1 -1
- package/dist/cjs/features/RequirementAI/components/RichTextEditor/RichTextEditor.js +1 -1
- package/dist/cjs/features/RequirementAI/components/UserStoryCard/CognitiveComponents/CognitiveComponent.js +1 -1
- package/dist/cjs/features/RequirementAI/components/UserStoryCard/Popups/DeviationSummary.js +1 -1
- package/dist/cjs/features/RequirementAI/components/UserStoryCard/Popups/EditBlockPopup.js +2 -0
- package/dist/cjs/features/RequirementAI/components/UserStoryCard/Popups/EditBlockPopup.js.map +1 -0
- package/dist/cjs/features/RequirementAI/components/UserStoryCard/Popups/ManualEditPopup.js +1 -1
- package/dist/cjs/features/RequirementAI/components/UserStoryCard/Popups/RedlineStatusCard.js +1 -1
- package/dist/cjs/features/RequirementAI/components/UserStoryCard/UserStoryCard.js +1 -1
- package/dist/cjs/features/RequirementAI/components/userstory-with-citation/UserStoryWithCitation.js +1 -1
- package/dist/cjs/features/RequirementAI/components/userstory-with-citation/UserStoryWithCitation.module.css.js +1 -1
- package/dist/cjs/features/RequirementAI/components/userstory-with-citation/components/InlineManualComponent.js +1 -1
- package/dist/cjs/features/RequirementAI/components/userstory-with-citation/components/InlineUpdatedComponent.js +1 -1
- package/dist/cjs/features/RequirementAI/components/userstory-with-citation/components/InlineUpdatedComponent.module.css.js +1 -1
- package/dist/cjs/utils/tagHelper.js +1 -1
- package/dist/features/CognitiveCompare/CognitiveCompare.js +1 -1
- package/dist/features/CognitiveCompare/CognitiveComparehelpers.js +1 -1
- package/dist/features/CognitiveCompare/components/RHSSectionRow.js +1 -1
- package/dist/features/CognitiveCompare/components/SectionAccordion.js +1 -1
- package/dist/features/CognitiveCompare/components/SubSectionAccordion.js +1 -1
- package/dist/features/CognitiveCompare/hooks/memoizedMarkdown.js +1 -1
- package/dist/features/GptWebCitation/GptWebCitationMarkdown.js +2 -0
- package/dist/features/GptWebCitation/GptWebCitationMarkdown.js.map +1 -0
- package/dist/features/RequirementAI/components/RichTextEditor/Editor/Editor.js +1 -1
- package/dist/features/RequirementAI/components/RichTextEditor/Editor/plugins/ManualNode.js +1 -1
- package/dist/features/RequirementAI/components/RichTextEditor/Editor/plugins/UpdateNode.js +1 -1
- package/dist/features/RequirementAI/components/RichTextEditor/Editor/theme/theme.css.js +1 -1
- package/dist/features/RequirementAI/components/RichTextEditor/RichTextEditor.js +1 -1
- package/dist/features/RequirementAI/components/UserStoryCard/CognitiveComponents/CognitiveComponent.js +1 -1
- package/dist/features/RequirementAI/components/UserStoryCard/Popups/DeviationSummary.js +1 -1
- package/dist/features/RequirementAI/components/UserStoryCard/Popups/EditBlockPopup.js +2 -0
- package/dist/features/RequirementAI/components/UserStoryCard/Popups/EditBlockPopup.js.map +1 -0
- package/dist/features/RequirementAI/components/UserStoryCard/Popups/ManualEditPopup.js +1 -1
- package/dist/features/RequirementAI/components/UserStoryCard/Popups/RedlineStatusCard.js +1 -1
- package/dist/features/RequirementAI/components/UserStoryCard/UserStoryCard.js +1 -1
- package/dist/features/RequirementAI/components/userstory-with-citation/UserStoryWithCitation.js +1 -1
- package/dist/features/RequirementAI/components/userstory-with-citation/UserStoryWithCitation.module.css.js +1 -1
- package/dist/features/RequirementAI/components/userstory-with-citation/components/InlineManualComponent.js +1 -1
- package/dist/features/RequirementAI/components/userstory-with-citation/components/InlineUpdatedComponent.js +1 -1
- package/dist/features/RequirementAI/components/userstory-with-citation/components/InlineUpdatedComponent.module.css.js +1 -1
- package/dist/types/src/CitationAccordionTest.d.ts +1 -0
- package/dist/types/src/CitationAccordionTest.d.ts.map +1 -0
- package/dist/types/src/DeviationSummaryTest.d.ts.map +1 -1
- package/dist/types/src/MockDeviationSummary.d.ts +1 -0
- package/dist/types/src/MockDeviationSummary.d.ts.map +1 -0
- package/dist/types/src/RedlineEditorTest.d.ts.map +1 -1
- package/dist/types/src/RequirementAiTest.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/CognitiveCompare.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/CognitiveComparehelpers.d.ts +9 -0
- package/dist/types/src/features/CognitiveCompare/CognitiveComparehelpers.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/CompareContext.d.ts +1 -0
- package/dist/types/src/features/CognitiveCompare/CompareContext.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/Guidelines/constants/guidelines.mockData.d.ts +27546 -1239
- package/dist/types/src/features/CognitiveCompare/Guidelines/constants/guidelines.mockData.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/components/RHSSectionRow.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/components/SectionAccordion.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/components/SubSectionAccordion.d.ts +1 -0
- package/dist/types/src/features/CognitiveCompare/components/SubSectionAccordion.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/hooks/useCompareLayout.d.ts +0 -1
- package/dist/types/src/features/CognitiveCompare/hooks/useCompareLayout.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/RichTextEditor/Editor/plugins/ManualNode.d.ts +2 -1
- package/dist/types/src/features/RequirementAI/components/RichTextEditor/Editor/plugins/ManualNode.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/RichTextEditor/Editor/plugins/UpdateNode.d.ts +2 -1
- package/dist/types/src/features/RequirementAI/components/RichTextEditor/Editor/plugins/UpdateNode.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/RichTextEditor/RichTextEditor.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/CognitiveComponents/CognitiveComponent.d.ts +2 -2
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/CognitiveComponents/CognitiveComponent.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/DeviationSummary.d.ts +28 -9
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/DeviationSummary.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/EditBlockPopup.d.ts +7 -0
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/EditBlockPopup.d.ts.map +1 -0
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/RedlineStatusCard.d.ts +7 -1
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/RedlineStatusCard.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/UserStoryCard.d.ts +8 -2
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/UserStoryCard.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/userstory-with-citation/UserStoryWithCitation.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/userstory-with-citation/components/InlineManualComponent.d.ts +1 -0
- package/dist/types/src/features/RequirementAI/components/userstory-with-citation/components/InlineManualComponent.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/userstory-with-citation/components/InlineUpdatedComponent.d.ts +3 -1
- package/dist/types/src/features/RequirementAI/components/userstory-with-citation/components/InlineUpdatedComponent.d.ts.map +1 -1
- package/dist/types/src/utils/tagHelper.d.ts +1 -1
- package/dist/types/src/utils/tagHelper.d.ts.map +1 -1
- package/dist/utils/tagHelper.js +1 -1
- package/package.json +5 -5
- package/dist/types/src/constants/deviationData.d.ts +0 -887
- package/dist/types/src/constants/deviationData.d.ts.map +0 -1
- package/dist/types/src/constants/treeData.d.ts +0 -732
- package/dist/types/src/constants/treeData.d.ts.map +0 -1
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/BlockedPopup.d.ts +0 -8
- package/dist/types/src/features/RequirementAI/components/UserStoryCard/Popups/BlockedPopup.d.ts.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as n}from"tslib";import{jsxs as e,jsx as i}from"react/jsx-runtime";import o,{useEffect as t}from"react";import{Box as l,Accordion as d,AccordionSummary as r,Tooltip as a,Typography as u,AccordionDetails as c}from"@mui/material";import{ChevronUp as s,ChevronDown as v}from"lucide-react";import{MemoizedMarkdown as f}from"../hooks/memoizedMarkdown.js";import{useCompareContext as p}from"../CompareContext.js";import{hasValue as h,hasMeaningfulRedlineTags as g,stripRedlineTags as x,generateColorPalette as m,isMissingStr as I,safeStringify as y,DEVIATION_BADGE_SEPARATOR as b}from"../CognitiveComparehelpers.js";import{DEFAULT_DEVIAION_COLOR as w}from"../CognitiveCompareConstants.js";var S=function(S){var R,F,_,k,B,C,M,A,O,j,W,N,D,P,E,T=S.section,K=S.idx,z=S.columnKey,L=S.colRef,H=S.mb,G=void 0===H?1:H,V=S.isExpanded,X=S.onToggle,Y=S.navigation,q=S.parentNodeId,J=void 0===q?"":q,Q=p(),U=Q.showOpenNodeRef,Z=Q.resolvedMarkdownStyles,$=Q.maintainRelativeOrder,nn=Q.showDeviationBadges,en=void 0!==nn&&nn,on=Q.renderSubSectionAccordion,tn=Q.treeData,ln=Q.proposedSections,dn=Q.existingSections,rn=Q.deviationNumberRegistry,an=Q.deviationParentRegistry,un=Q.getBadgeRef,cn=Q.openSummaryPopup,sn=Q.getSectionCompareStyle,vn=Q.connectedSections,fn=Q.openMoreFunctionsPopup,pn=Q.isProposingFix,hn=Q.proposingFixNodeId,gn=Q.isRedlineFlow,xn=Q.isSideBySide,mn=Q.activeSideBySideSection,In=Q.scrollSyncLocked,yn=Q.unifiedNumbering,bn=Q.toggleScrollSyncLocked,wn=Q.summaryPopupAnchorEl,Sn="".concat(xn?"1":"0","-").concat(String(null!=mn?mn:"")),Rn=(null===(R=T.displayTitle)||void 0===R||R)&&h(T.title),Fn=!(!pn||!hn||"left"!==z||T.id!==hn&&T.nodeId!==hn),_n=g(T.content),kn="boolean"==typeof gn?gn:_n,Bn=_n,Cn=kn&&_n,Mn=Cn?x(T.content):T.content,An=Cn?T.content:void 0,On=(null===(F=T.displayContent)||void 0===F||F||_n)&&h(T.content),jn=!Rn&&!On,Wn=T.title;Rn||(Wn=On?"No Title Found":"No Matching Section Found");var Nn=T.evaluationResult;if(!Nn&&"right"===z)if($){var Dn=null===(_=T.refIndexes)||void 0===_?void 0:_[0],Pn=ln.find(function(n){return n.selfIndex===Dn});Nn=null==Pn?void 0:Pn.evaluationResult}else Nn=null===(k=ln[K])||void 0===k?void 0:k.evaluationResult;var En=null===(B=null==tn?void 0:tn.input_index_map)||void 0===B?void 0:B[0],Tn=null===(C=null==tn?void 0:tn.input_index_map)||void 0===C?void 0:C[1],Kn="left"===z?Tn:En,zn=function(n,e){var i;if(!e||!n)return null;for(var o=0,t=n;o<t.length;o++){var l=t[o];if(l.id===e||l.nodeId===e||l.contentId===e)return l;if(null===(i=l.subsections)||void 0===i?void 0:i.length){var d=zn(l.subsections,e);if(d)return d}}return null},Ln="left"===z?T:zn(ln,T.id),Hn="right"===z?T:zn(dn,T.id),Gn=o.useMemo(function(){if(!$)return 0;var n=1/0,e=function(n){var e=g(n)?x(n):n;return y(e||"").replace(/\\n/g,"\n")},i=function(o,t,l,d){if(o){var r=o.nodeId||o.id;if(d&&"right"===z){var a=ln.filter(function(n){var e;return null===(e=n.refIndexes)||void 0===e?void 0:e.includes(o.selfIndex)});a.length>0&&(r=a[0].nodeId||a[0].id)}var u=o.nodeId||o.id||(null==t?void 0:t.nodeId)||(null==t?void 0:t.id)||(null==l?void 0:l.nodeId)||(null==l?void 0:l.id),c=o.evaluationResult||(null==t?void 0:t.evaluationResult)||(null==l?void 0:l.evaluationResult),s=(null==c?void 0:c.deviations)||{};Object.keys(s).forEach(function(i){var d,a=null===(d=s[i])||void 0===d?void 0:d[J];if(function(n,i){if("string"!=typeof i||I(i))return!1;var o=e(null==n?void 0:n.content),t=e(i);return!!t&&o.includes(t)}("left"===z?t||o:l||o,a)){var c="".concat(r).concat(b).concat(i),v=null==rn?void 0:rn[c];null!=v&&v<n&&(n=v);var f="".concat(u).concat(b).concat(i),p=null==rn?void 0:rn[f];null!=p&&p<n&&(n=p)}});for(var v=o.subsections||[],f=(null==t?void 0:t.subsections)||[],p=(null==l?void 0:l.subsections)||[],h=Math.max(v.length,f.length,p.length),g=0;g<h;g++)i(v[g],f[g],p[g],!1)}};return i(T,Ln,Hn,!0),n!==1/0?n-1:0},[T,Ln,Hn,z,J,rn,$,ln]);if($)if("left"===z){var Vn=null===(M=T.refIndexes)||void 0===M?void 0:M[0],Xn=dn.findIndex(function(n){return n.selfIndex===Vn});Hn=-1!==Xn?dn[Xn]:zn(dn,T.id)}else{var Yn=null===(A=T.refIndexes)||void 0===A?void 0:A[0],qn=ln.findIndex(function(n){return n.selfIndex===Yn});Ln=-1!==qn?ln[qn]:zn(ln,T.id)}var Jn="left"===z?!Hn:!Ln,Qn=Nn||(null==Ln?void 0:Ln.evaluationResult)||(null==Hn?void 0:Hn.evaluationResult),Un=null!==(W=null===(j=null===(O=null==Qn?void 0:Qn.evaluation_outputs)||void 0===O?void 0:O.metadata)||void 0===j?void 0:j.label_color)&&void 0!==W?W:w,Zn=m(Un).highlightBg,$n=(null==Qn?void 0:Qn.deviations)||{},ne=T.nodeId||T.id;if($&&"left"!==z){var ee=ln.filter(function(n){var e;return null===(e=n.refIndexes)||void 0===e?void 0:e.includes(T.selfIndex)});ee.length>0?ne=ee[0].nodeId||ee[0].id:(null==Ln?void 0:Ln.id)&&(ne=Ln.nodeId||Ln.id)}var ie=Object.keys($n)[0],oe=ie?"".concat(ne).concat(b).concat(ie):null,te=oe?null==an?void 0:an[oe]:null,le=K+1;if($&&yn){var de="left"===z?yn.leftNums.get(null==T?void 0:T.id):yn.rightNums.get(null==T?void 0:T.id);Jn&&void 0!==de?le=de:null!=te&&te>=0?le=te:void 0!==de&&(le=de)}else null!=te&&te>=0&&(le=te);var re=Object.entries($n).map(function(n){var e=n[0],i=n[1],o="".concat(ne).concat(b).concat(e);return{deviationKey:e,deviationMap:i,refId:o,currentIndex:rn[o]}}).filter(function(n){return void 0!==n.currentIndex&&null!==n.currentIndex});re.sort(function(n,e){return n.currentIndex-e.currentIndex});var ae,ue,ce=re.map(function(e){var i,o,t,l,d,r,a=e.deviationKey,u=e.deviationMap,c=e.refId,s=e.currentIndex;$&&void 0!==Gn&&(s-=Gn),s=Math.max(1,s);var v=u[J],f=I(v);if(f)v="";else if(!v)return null;var p=K,h=K;if($)if("left"===z){var g=null===(i=T.refIndexes)||void 0===i?void 0:i[0],x=dn.findIndex(function(n){return n.selfIndex===g});if(-1!==x)h=x;else{var y=dn.findIndex(function(n){return n.id===T.id||n.nodeId===T.nodeId||n.contentId===T.contentId});h=-1!==y?y:K}}else{var w=null===(o=T.refIndexes)||void 0===o?void 0:o[0],S=ln.findIndex(function(n){return n.selfIndex===w});if(-1!==S)p=S;else p=-1!==(C=ln.findIndex(function(n){return n.id===T.id||n.nodeId===T.nodeId||n.contentId===T.contentId}))?C:K}var R="".concat(ne).concat(b).concat(a).concat(b).concat(p).concat(b).concat(h),F=u[Kn],_=Jn||I(F),k="".concat(le,".").concat(s),B=K;if("right"===z&&$){var C,M=null===(t=T.refIndexes)||void 0===t?void 0:t[0],A=ln.findIndex(function(n){return n.selfIndex===M});if(-1!==A)B=A;else-1!==(C=ln.findIndex(function(n){return n.id===T.id||n.nodeId===T.nodeId||n.contentId===T.contentId}))&&(B=C)}var O=sn?sn(B):null,j=(null==u?void 0:u.evaluation_outputs)||(null==Qn?void 0:Qn.evaluation_outputs),W=null!==(l=null==j?void 0:j.output_value)&&void 0!==l?l:null,N=null!==(r=null===(d=null==j?void 0:j.metadata)||void 0===d?void 0:d.label_color)&&void 0!==r?r:Un,D=m(N),P=O?n(n({},O),{badgeBg:D.badgeBg,badgeBorder:D.badgeBorder,badgeText:D.badgeText}):n({},D),E=(null==u?void 0:u.deviation_summary)?{deviation_summary:u.deviation_summary,deviation_title:(null==u?void 0:u.deviation_title)||(null==Qn?void 0:Qn.deviation_title),deviation_impact:(null==u?void 0:u.deviation_impact)||(null==Qn?void 0:Qn.deviation_impact),deviation_explanation:(null==u?void 0:u.deviation_explanation)||(null==Qn?void 0:Qn.deviation_explanation),evaluation_outputs:j,cognitive_decisioning:(null==u?void 0:u.cognitive_decisioning)||(null==Qn?void 0:Qn.cognitive_decisioning)}:null,L=0,H=Mn||"";if(v&&H){var G=H.split(/\n{2,}/),V=G.findIndex(function(n){return n.includes(v)});if(-1!==V){var X=Object.entries($n).filter(function(n){n[0];var e=n[1][J];return e&&G[V].includes(e)}).sort(function(n,e){return G[V].indexOf(n[1][J])-G[V].indexOf(e[1][J])}),Y=X.filter(function(n){n[0];var e=n[1][J];return e&&(e.includes(v)||v.includes(e))});Y.length>1&&(L=Math.max(0,Y.findIndex(function(n){return n[0]===a})))}}var q=un(z,c);return{id:c,actionId:R,label:k,highlight:v,side:z,style:P,stackIndex:L,score:W,isConnected:null==vn?void 0:vn.has(R),showScrollLockToggle:(null==vn?void 0:vn.has(R))||xn&&mn===R||!!wn&&wn===q.current,scrollSyncLocked:In,toggleScrollSyncLocked:bn,isOrphan:_,isMissingClause:f,badgeRef:q,onClick:function(n){n.stopPropagation(),fn&&fn(n,Ln||{id:"orphan-left",title:"",content:""},_,Hn||{id:"orphan-right",title:"",content:""},R,P)},onSummaryClick:function(n){n.stopPropagation(),cn(n,R,_,E)}}}).filter(Boolean),se=en||!kn&&Fn?ce:[],ve=ce.map(function(n){return n.highlight}).filter(Boolean),fe=T.id&&z===(null==Y?void 0:Y.columnKey)?Y:null,pe=o.useRef(!1);return t(function(){V||(pe.current=!1)},[V]),e(l,n({ref:L,sx:{mb:G,width:"100%",display:"flex",flexDirection:"column",position:"relative",minWidth:0}},{children:[V&&(null==fe?void 0:fe.showAbove)&&i("div",n({style:{position:"sticky",top:0,height:"0px",cursor:"pointer"},onClick:function(){var n,e;return null===(e=null===(n=null==fe?void 0:fe.showAboveRef)||void 0===n?void 0:n.current)||void 0===e?void 0:e.scrollIntoView({behavior:"smooth",block:"center"})}},{children:i("div",n({style:n({transform:"translateY(-50%) translateX(calc(100% ".concat("left"===z?"+":"-"," 130px))"),position:"absolute",paddingTop:"20px"},"left"===z?{right:"-20px"}:{left:"-20px"})},{children:i(s,{color:(null===(N=null==fe?void 0:fe.showAboveRef)||void 0===N?void 0:N.current)?window.getComputedStyle(fe.showAboveRef.current).color:void 0})}))})),e(d,n({disableGutters:!0,expanded:!jn&&V,onChange:function(){jn||(X(),U.current=T.id)},sx:{boxShadow:"none",border:jn?"1px dashed #E2E8F0":"1px solid #E2E8F0",bgcolor:jn?"#FAFAFA":"#FFFFFF",borderRadius:"6px",flexGrow:1,width:"100%",display:"flex",flexDirection:"column",minWidth:0,"&:before":{display:"none"},"& .MuiAccordion-heading":{position:"sticky",top:-12,zIndex:10,background:"#fff"}}},{children:[i(r,n({expandIcon:jn?null:i(v,{size:16}),sx:{minHeight:"36px",flexShrink:0,cursor:jn?"default":"pointer","& .MuiAccordionSummary-content":{my:.5,display:"grid",alignItems:"center",minWidth:0,width:"100%"},"& .MuiAccordionSummary-expandIconWrapper":{transition:"transform 0.2s ease"},"& .MuiAccordionSummary-expandIconWrapper.Mui-expanded":{transform:"rotate(180deg)"}}},{children:Rn&&i(a,n({title:Wn,placement:"top"},{children:i(u,n({component:"div",sx:{fontSize:"12px",color:jn?"#94A3B8":"#19213D",fontWeight:jn?400:700,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0}},{children:(ae=Wn,ue="left"===z&&(null!==(P=null===(D=null==T?void 0:T.refContentIds)||void 0===D?void 0:D.length)&&void 0!==P?P:1)>1,void 0===ue&&(ue=!1),ae?y(ae).replace(/\\n/g,"\n").split(/(\*\*.*?\*\*)/g).map(function(o,t){return o.startsWith("**")&&o.endsWith("**")?i("strong",{children:o.slice(2,-2)},t):e("div",n({style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"8px",width:"100%"}},{children:[i("span",{children:o}),ue&&i("span",n({style:{display:"inline-flex",alignItems:"center",justifyContent:"center",padding:"0px 6px",borderRadius:"9999px",background:"#F3F4F6",border:"1px solid #D1D5DB",color:"#6B7280",fontSize:"9px",fontWeight:500,whiteSpace:"nowrap",lineHeight:1.4,marginRight:"4px"}},{children:"Multiple"}))]}),t)}):null)}))}))})),!jn&&e(c,n({sx:{pt:0,pb:1.25,bgcolor:"#FFFFFF",flex:1,display:"flex",flexDirection:"column",minWidth:0}},{children:[On&&i(f,{content:Mn,overlayContent:An,sxStyles:Z,highlights:ve,maintainRelativeOrder:$,highlightBg:Zn,suppressHighlightBg:Bn,deviationBadges:se,collisionKey:Sn}),(T.subsections||[]).map(function(n,e){return on({section:n,keyPath:"".concat(K,"-").concat(e),depth:0,columnKey:z,parentNodeId:J,sectionOffset:Gn})})]}))]})),V&&(null==fe?void 0:fe.showBelow)&&i("div",n({style:{position:"sticky",bottom:0,height:"0px",cursor:"pointer"},onClick:function(){var n,e;return null===(e=null===(n=null==fe?void 0:fe.showBelowRef)||void 0===n?void 0:n.current)||void 0===e?void 0:e.scrollIntoView({behavior:"smooth",block:"center"})}},{children:i("div",n({style:n({transform:"translateY(-50%) translateX(calc(100% ".concat("left"===z?"+":"-"," 130px))"),position:"absolute",paddingBottom:"20px"},"left"===z?{right:"-20px"}:{left:"-20px"})},{children:i(v,{color:(null===(E=null==fe?void 0:fe.showBelowRef)||void 0===E?void 0:E.current)?window.getComputedStyle(fe.showBelowRef.current).color:void 0})}))}))]}),"".concat(z,"-sec-").concat(K))};export{S as default};
|
|
1
|
+
import{__assign as n}from"tslib";import{jsxs as e,jsx as i}from"react/jsx-runtime";import o,{useEffect as t}from"react";import{Box as l,Accordion as d,AccordionSummary as r,Tooltip as u,Typography as a,AccordionDetails as c}from"@mui/material";import{ChevronUp as s,ChevronDown as v}from"lucide-react";import{MemoizedMarkdown as f}from"../hooks/memoizedMarkdown.js";import{useCompareContext as p}from"../CompareContext.js";import{hasValue as h,hasMeaningfulRedlineTags as g,stripRedlineTags as x,hasSingleMappedLhsSection as m,generateColorPalette as I,isMissingStr as y,getRhsMappedSectionNumber as b,safeStringify as S,DEVIATION_BADGE_SEPARATOR as w}from"../CognitiveComparehelpers.js";import{DEFAULT_DEVIAION_COLOR as R}from"../CognitiveCompareConstants.js";var _=function(_){var F,k,N,M,B,C,E,A,O,j,W,T,D,P,K,z=_.section,G=_.idx,L=_.columnKey,X=_.colRef,H=_.mb,V=void 0===H?1:H,Y=_.isExpanded,q=_.onToggle,J=_.navigation,Q=_.parentNodeId,U=void 0===Q?"":Q,Z=p(),$=Z.showOpenNodeRef,nn=Z.resolvedMarkdownStyles,en=Z.maintainRelativeOrder,on=Z.showDeviationBadges,tn=void 0!==on&&on,ln=Z.renderSubSectionAccordion,dn=Z.treeData,rn=Z.proposedSections,un=Z.existingSections,an=Z.deviationNumberRegistry,cn=Z.deviationParentRegistry,sn=Z.getBadgeRef,vn=Z.openSummaryPopup,fn=Z.getSectionCompareStyle,pn=Z.connectedSections,hn=Z.openMoreFunctionsPopup,gn=Z.isProposingFix,xn=Z.proposingFixNodeId,mn=Z.isRedlineFlow,In=Z.isSideBySide,yn=Z.activeSideBySideSection,bn=Z.scrollSyncLocked,Sn=Z.unifiedNumbering,wn=Z.toggleScrollSyncLocked,Rn=Z.summaryPopupAnchorEl,_n="".concat(In?"1":"0","-").concat(String(null!=yn?yn:"")),Fn=(null===(F=z.displayTitle)||void 0===F||F)&&h(z.title),kn=!(!gn||!xn||"left"!==L||z.id!==xn&&z.nodeId!==xn),Nn=g(z.content),Mn="boolean"==typeof mn?mn:Nn,Bn=Nn,Cn=Mn&&Nn,En=Cn?x(z.content):z.content,An=Cn?z.content:void 0,On=(null===(k=z.displayContent)||void 0===k||k||Nn)&&h(z.content),jn=!Fn&&!On,Wn=z.title;Fn||(Wn=On?"No Title Found":"No Matching Section Found");var Tn=z.evaluationResult;if(!Tn&&"right"===L)if(en){var Dn=null===(N=z.refIndexes)||void 0===N?void 0:N[0],Pn=rn.find(function(n){return n.selfIndex===Dn});Tn=null==Pn?void 0:Pn.evaluationResult}else Tn=null===(M=rn[G])||void 0===M?void 0:M.evaluationResult;var Kn=null===(B=null==dn?void 0:dn.input_index_map)||void 0===B?void 0:B[0],zn=null===(C=null==dn?void 0:dn.input_index_map)||void 0===C?void 0:C[1],Gn="left"===L?zn:Kn,Ln=function(n,e){var i;if(!e||!n)return null;for(var o=0,t=n;o<t.length;o++){var l=t[o];if(l.id===e||l.nodeId===e||l.contentId===e)return l;if(null===(i=l.subsections)||void 0===i?void 0:i.length){var d=Ln(l.subsections,e);if(d)return d}}return null},Xn="left"===L?z:Ln(rn,z.id),Hn="right"===L?z:Ln(un,z.id),Vn=o.useMemo(function(){if(!en)return 0;var n=1/0,e=function(n){var e=g(n)?x(n):n;return S(e||"").replace(/\\n/g,"\n")},i=function(o,t,l,d){if(o){var r=o.nodeId||o.id;if(d&&"right"===L){var u=rn.filter(function(n){var e;return null===(e=n.refIndexes)||void 0===e?void 0:e.includes(o.selfIndex)});u.length>0&&(r=u[0].nodeId||u[0].id)}var a=o.nodeId||o.id||(null==t?void 0:t.nodeId)||(null==t?void 0:t.id)||(null==l?void 0:l.nodeId)||(null==l?void 0:l.id),c=o.evaluationResult||(null==t?void 0:t.evaluationResult)||(null==l?void 0:l.evaluationResult),s=(null==c?void 0:c.deviations)||{};Object.keys(s).forEach(function(i){var d,u=null===(d=s[i])||void 0===d?void 0:d[U];if(function(n,i){if("string"!=typeof i||y(i))return!1;var o=e(null==n?void 0:n.content),t=e(i);return!!t&&o.includes(t)}("left"===L?t||o:l||o,u)){var c="".concat(r).concat(w).concat(i),v=null==an?void 0:an[c];null!=v&&v<n&&(n=v);var f="".concat(a).concat(w).concat(i),p=null==an?void 0:an[f];null!=p&&p<n&&(n=p)}});for(var v=o.subsections||[],f=(null==t?void 0:t.subsections)||[],p=(null==l?void 0:l.subsections)||[],h=Math.max(v.length,f.length,p.length),g=0;g<h;g++)i(v[g],f[g],p[g],!1)}},o="right"===L?rn.filter(function(n){var e;return null===(e=n.refIndexes)||void 0===e?void 0:e.includes(z.selfIndex)}):[];if(1===o.length){var t=o[0];(t.refIndexes||[]).map(function(n){return un.find(function(e){return e.selfIndex===n})}).filter(Boolean).forEach(function(n){i(n,t,n,!0)})}else i(z,Xn,Hn,!0);return n!==1/0?n-1:0},[z,Xn,Hn,L,U,an,en,rn,un]);if(en)if("left"===L){var Yn=null===(E=z.refIndexes)||void 0===E?void 0:E[0],qn=un.findIndex(function(n){return n.selfIndex===Yn});Hn=-1!==qn?un[qn]:Ln(un,z.id)}else{var Jn=null===(A=z.refIndexes)||void 0===A?void 0:A[0],Qn=rn.findIndex(function(n){return n.selfIndex===Jn});Xn=-1!==Qn?rn[Qn]:Ln(rn,z.id)}var Un="left"===L?!Hn:!Xn,Zn=en&&"right"===L&&m(z,rn),$n=Tn||(null==Xn?void 0:Xn.evaluationResult)||(null==Hn?void 0:Hn.evaluationResult),ne=null!==(W=null===(j=null===(O=null==$n?void 0:$n.evaluation_outputs)||void 0===O?void 0:O.metadata)||void 0===j?void 0:j.label_color)&&void 0!==W?W:R,ee=I(ne).highlightBg,ie=(null==$n?void 0:$n.deviations)||{},oe=z.nodeId||z.id;if(en&&"left"!==L){var te=rn.filter(function(n){var e;return null===(e=n.refIndexes)||void 0===e?void 0:e.includes(z.selfIndex)});te.length>0?oe=te[0].nodeId||te[0].id:(null==Xn?void 0:Xn.id)&&(oe=Xn.nodeId||Xn.id)}var le=o.useMemo(function(){var n,e=new Map;if(!en||"right"!==L)return e;var i=1,o=rn.filter(function(n){var e;return null===(e=n.refIndexes)||void 0===e?void 0:e.includes(z.selfIndex)}),t=1===o.length&&1===(null===(n=o[0].refIndexes)||void 0===n?void 0:n.length),l=function(n){return S(n||"").replace(/\\n/g,"\n")},d=function(n,e){var i=e?o[0]:Ln(rn,n.nodeId||n.id||n.contentId);return{lhsNode:i,evalResult:n.evaluationResult||(null==i?void 0:i.evaluationResult),registryNodeId:i?i.nodeId||i.id:n.nodeId||n.id}};if(t){var r=function(n,e){if(void 0===e&&(e=!1),n){var o=d(n,e),t=o.lhsNode,u=o.evalResult,a=o.registryNodeId,c=l(n.content);Object.entries((null==u?void 0:u.deviations)||{}).forEach(function(n){var e=n[0],o=n[1],d=o[U],r=l(d);if(!!t&&!y(o[Gn])&&r&&c.includes(r)){var u="".concat(a).concat(w).concat(e),s=an[u];null!=s&&(i=Math.max(i,Math.max(1,s-(Vn||0))+1))}}),(n.subsections||[]).forEach(function(n){return r(n)})}};r(z,!0)}var u=function(n,o){if(void 0===o&&(o=!1),n){var t=d(n,o),r=t.lhsNode,a=t.evalResult,c=t.registryNodeId,s=(null==a?void 0:a.deviations)||{},v=l(n.content);Object.entries(s).map(function(n){var e,i=n[0],o=n[1],t=o[U],d=!r||y(o[Gn]),u=l(t),a=u?v.indexOf(u):-1,s="".concat(c).concat(w).concat(i);return{refId:s,isRenderable:d&&!!u&&!y(t),position:a,registryIndex:null!==(e=an[s])&&void 0!==e?e:Number.MAX_SAFE_INTEGER}}).filter(function(n){return n.isRenderable}).sort(function(n,e){return(-1===n.position?Number.MAX_SAFE_INTEGER:n.position)-(-1===e.position?Number.MAX_SAFE_INTEGER:e.position)||n.registryIndex-e.registryIndex}).forEach(function(n){e.set(n.refId,i++)}),(n.subsections||[]).forEach(function(n){return u(n)})}};return u(z,!0),e},[en,L,z,rn,U,Gn,an,Vn]),de=Object.keys(ie)[0],re=de?"".concat(oe).concat(w).concat(de):null,ue=re?null==cn?void 0:cn[re]:null,ae=G+1;if(en&&Sn){var ce="left"===L?Sn.leftNums.get(null==z?void 0:z.id):Sn.rightNums.get(null==z?void 0:z.id);Un&&void 0!==ce?ae=ce:null!=ue&&ue>=0?ae=ue:void 0!==ce&&(ae=ce)}else null!=ue&&ue>=0&&(ae=ue);var se=Object.entries(ie).map(function(n){var e=n[0],i=n[1],o="".concat(oe).concat(w).concat(e);return{deviationKey:e,deviationMap:i,refId:o,currentIndex:an[o]}}).filter(function(n){return void 0!==n.currentIndex&&null!==n.currentIndex});se.sort(function(n,e){return n.currentIndex-e.currentIndex});var ve,fe,pe=se.map(function(e){var i,o,t,l,d,r,u=e.deviationKey,a=e.deviationMap,c=e.refId,s=e.currentIndex,v=a[U],f=y(v);if(f)v="";else if(!v)return null;var p=G,h=G;if(en)if("left"===L){var g=null===(i=z.refIndexes)||void 0===i?void 0:i[0],x=un.findIndex(function(n){return n.selfIndex===g});if(-1!==x)h=x;else{var m=un.findIndex(function(n){return n.id===z.id||n.nodeId===z.nodeId||n.contentId===z.contentId});h=-1!==m?m:G}}else{var S=null===(o=z.refIndexes)||void 0===o?void 0:o[0],R=rn.findIndex(function(n){return n.selfIndex===S});if(-1!==R)p=R;else p=-1!==(E=rn.findIndex(function(n){return n.id===z.id||n.nodeId===z.nodeId||n.contentId===z.contentId}))?E:G}var _="".concat(oe).concat(w).concat(u).concat(w).concat(p).concat(w).concat(h),F=a[Gn],k=Un||y(F),N=le.get(c);en&&"right"===L&&k&&void 0!==N?s=N:en&&void 0!==Vn&&("right"!==L||k||Zn)&&(s-=Vn),s=Math.max(1,s);var M=en&&"right"===L&&k&&Sn?b({section:z,proposedSections:rn,leftNums:Sn.leftNums,fallbackNumber:String(ae),firstOnly:!0}):ae,B="".concat(M,".").concat(s),C=G;if("right"===L&&en){var E,A=null===(t=z.refIndexes)||void 0===t?void 0:t[0],O=rn.findIndex(function(n){return n.selfIndex===A});if(-1!==O)C=O;else-1!==(E=rn.findIndex(function(n){return n.id===z.id||n.nodeId===z.nodeId||n.contentId===z.contentId}))&&(C=E)}var j=fn?fn(C):null,W=(null==a?void 0:a.evaluation_outputs)||(null==$n?void 0:$n.evaluation_outputs),T=null!==(l=null==W?void 0:W.output_value)&&void 0!==l?l:null,D=null!==(r=null===(d=null==W?void 0:W.metadata)||void 0===d?void 0:d.label_color)&&void 0!==r?r:ne,P=I(D),K=j?n(n({},j),{badgeBg:P.badgeBg,badgeBorder:P.badgeBorder,badgeText:P.badgeText}):n({},P),X=(null==a?void 0:a.deviation_summary)?{deviation_summary:a.deviation_summary,deviation_title:(null==a?void 0:a.deviation_title)||(null==$n?void 0:$n.deviation_title),deviation_impact:(null==a?void 0:a.deviation_impact)||(null==$n?void 0:$n.deviation_impact),deviation_explanation:(null==a?void 0:a.deviation_explanation)||(null==$n?void 0:$n.deviation_explanation),evaluation_outputs:W,cognitive_decisioning:(null==a?void 0:a.cognitive_decisioning)||(null==$n?void 0:$n.cognitive_decisioning)}:null,H=0,V=En||"";if(v&&V){var Y=V.split(/\n{2,}/),q=Y.findIndex(function(n){return n.includes(v)});if(-1!==q){var J=Object.entries(ie).filter(function(n){n[0];var e=n[1][U];return e&&Y[q].includes(e)}).sort(function(n,e){return Y[q].indexOf(n[1][U])-Y[q].indexOf(e[1][U])}),Q=J.filter(function(n){n[0];var e=n[1][U];return e&&(e.includes(v)||v.includes(e))});Q.length>1&&(H=Math.max(0,Q.findIndex(function(n){return n[0]===u})))}}var Z=sn(L,c);return{id:c,actionId:_,label:B,highlight:v,side:L,style:K,stackIndex:H,score:T,isConnected:null==pn?void 0:pn.has(_),showScrollLockToggle:(null==pn?void 0:pn.has(_))||In&&yn===_||!!Rn&&Rn===Z.current,scrollSyncLocked:bn,toggleScrollSyncLocked:wn,isOrphan:k,isMissingClause:f,badgeRef:Z,onClick:function(n){n.stopPropagation(),hn&&hn(n,Xn||{id:"orphan-left",title:"",content:""},k,Hn||{id:"orphan-right",title:"",content:""},_,K)},onSummaryClick:function(n){n.stopPropagation(),vn(n,_,k,X)}}}).filter(Boolean),he=tn||!Mn&&kn?pe:[],ge=pe.map(function(n){return n.highlight}).filter(Boolean),xe=z.id&&L===(null==J?void 0:J.columnKey)?J:null,me=o.useRef(!1);return t(function(){Y||(me.current=!1)},[Y]),e(l,n({ref:X,sx:{mb:V,width:"100%",display:"flex",flexDirection:"column",position:"relative",minWidth:0}},{children:[Y&&(null==xe?void 0:xe.showAbove)&&i("div",n({style:{position:"sticky",top:0,height:"0px",cursor:"pointer"},onClick:function(){var n,e;return null===(e=null===(n=null==xe?void 0:xe.showAboveRef)||void 0===n?void 0:n.current)||void 0===e?void 0:e.scrollIntoView({behavior:"smooth",block:"center"})}},{children:i("div",n({style:n({transform:"translateY(-50%) translateX(calc(100% ".concat("left"===L?"+":"-"," 130px))"),position:"absolute",paddingTop:"20px"},"left"===L?{right:"-20px"}:{left:"-20px"})},{children:i(s,{color:(null===(T=null==xe?void 0:xe.showAboveRef)||void 0===T?void 0:T.current)?window.getComputedStyle(xe.showAboveRef.current).color:void 0})}))})),e(d,n({disableGutters:!0,expanded:!jn&&Y,onChange:function(){jn||(q(),$.current=z.id)},sx:{boxShadow:"none",border:jn?"1px dashed #E2E8F0":"1px solid #E2E8F0",bgcolor:jn?"#FAFAFA":"#FFFFFF",borderRadius:"6px",flexGrow:1,width:"100%",display:"flex",flexDirection:"column",minWidth:0,"&:before":{display:"none"},"& .MuiAccordion-heading":{position:"sticky",top:-12,zIndex:10,background:"#fff"}}},{children:[i(r,n({expandIcon:jn?null:i(v,{size:16}),sx:{minHeight:"36px",flexShrink:0,cursor:jn?"default":"pointer","& .MuiAccordionSummary-content":{my:.5,display:"grid",alignItems:"center",minWidth:0,width:"100%"},"& .MuiAccordionSummary-expandIconWrapper":{transition:"transform 0.2s ease"},"& .MuiAccordionSummary-expandIconWrapper.Mui-expanded":{transform:"rotate(180deg)"}}},{children:Fn&&i(u,n({title:Wn,placement:"top"},{children:i(a,n({component:"div",sx:{fontSize:"12px",color:jn?"#94A3B8":"#19213D",fontWeight:jn?400:700,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0}},{children:(ve=Wn,fe="left"===L&&(null!==(P=null===(D=null==z?void 0:z.refContentIds)||void 0===D?void 0:D.length)&&void 0!==P?P:1)>1,void 0===fe&&(fe=!1),ve?S(ve).replace(/\\n/g,"\n").split(/(\*\*.*?\*\*)/g).map(function(o,t){return o.startsWith("**")&&o.endsWith("**")?i("strong",{children:o.slice(2,-2)},t):e("div",n({style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"8px",width:"100%"}},{children:[i("span",{children:o}),fe&&i("span",n({style:{display:"inline-flex",alignItems:"center",justifyContent:"center",padding:"0px 6px",borderRadius:"9999px",background:"#F3F4F6",border:"1px solid #D1D5DB",color:"#6B7280",fontSize:"9px",fontWeight:500,whiteSpace:"nowrap",lineHeight:1.4,marginRight:"4px"}},{children:"Multiple"}))]}),t)}):null)}))}))})),!jn&&e(c,n({sx:{pt:0,pb:1.25,bgcolor:"#FFFFFF",flex:1,display:"flex",flexDirection:"column",minWidth:0}},{children:[On&&i(f,{content:En,overlayContent:An,sxStyles:nn,highlights:ge,maintainRelativeOrder:en,highlightBg:ee,suppressHighlightBg:Bn,deviationBadges:he,collisionKey:_n}),(z.subsections||[]).map(function(n,e){return ln({section:n,keyPath:"".concat(G,"-").concat(e),depth:0,columnKey:L,parentNodeId:U,sectionOffset:Vn,rhsOrphanVisualIndexes:le})})]}))]})),Y&&(null==xe?void 0:xe.showBelow)&&i("div",n({style:{position:"sticky",bottom:0,height:"0px",cursor:"pointer"},onClick:function(){var n,e;return null===(e=null===(n=null==xe?void 0:xe.showBelowRef)||void 0===n?void 0:n.current)||void 0===e?void 0:e.scrollIntoView({behavior:"smooth",block:"center"})}},{children:i("div",n({style:n({transform:"translateY(-50%) translateX(calc(100% ".concat("left"===L?"+":"-"," 130px))"),position:"absolute",paddingBottom:"20px"},"left"===L?{right:"-20px"}:{left:"-20px"})},{children:i(v,{color:(null===(K=null==xe?void 0:xe.showBelowRef)||void 0===K?void 0:K.current)?window.getComputedStyle(xe.showBelowRef.current).color:void 0})}))}))]}),"".concat(L,"-sec-").concat(G))};export{_ as default};
|
|
2
2
|
//# sourceMappingURL=SectionAccordion.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as n}from"tslib";import{jsx as i,jsxs as e}from"react/jsx-runtime";import t,{useMemo as o}from"react";import{Box as l,Accordion as d,AccordionSummary as r,Typography as a,AccordionDetails as u}from"@mui/material";import{ChevronDown as c}from"lucide-react";import{MemoizedMarkdown as s}from"../hooks/memoizedMarkdown.js";import{useCompareContext as v}from"../CompareContext.js";import{hasValue as f,hasMeaningfulRedlineTags as p,stripRedlineTags as h,generateColorPalette as m,isMissingStr as g,DEVIATION_BADGE_SEPARATOR as x}from"../CognitiveComparehelpers.js";import{DEFAULT_DEVIAION_COLOR as y}from"../CognitiveCompareConstants.js";var S=t.memo(function(t){var I,b,_,k,C,P,w,B,F,O,R=t.section,N=t.keyPath,M=t.depth,j=void 0===M?0:M,E=t.columnKey,K=void 0===E?"left":E,W=t.parentNodeId,L=void 0===W?"":W,z=t.sectionOffset,A=v(),D=A.expandedSubSections,H=A.setExpandedSubSections,T=A.maintainRelativeOrder,G=A.showDeviationBadges,U=void 0!==G&&G,q=A.proposedSections,J=A.existingSections,Q=A.treeData,V=A.deviationNumberRegistry,X=A.deviationParentRegistry,Y=A.connectedSections,Z=A.activeSideBySideSection,$=A.isSideBySide,nn=A.scrollSyncLocked,en=A.toggleScrollSyncLocked,tn=A.summaryPopupAnchorEl,on=A.resolvedMarkdownStyles,ln=A.getSubSectionRef,dn=A.getSubSectionCompareStyle,rn=A.getBadgeRef,an=A.openMoreFunctionsPopup,un=A.openSummaryPopup,cn=A.resetSideBySide,sn=A.setConnectedSections,vn=A.setConnectedLines,fn=A.cachedConnectedPositions,pn=A.isProposingFix,hn=A.proposingFixNodeId,mn=A.isRedlineFlow,gn=A.unifiedNumbering,xn=null!=Z?Z:"",yn=(null===(I=R.displayTitle)||void 0===I||I)&&f(R.title),Sn=!(!pn||!hn||"left"!==K||R.id!==hn&&R.nodeId!==hn),In=p(R.content),bn="boolean"==typeof mn?mn:In,_n=In,kn=bn&&In,Cn=kn?h(R.content):R.content,Pn=kn?R.content:void 0,wn=(null===(b=R.displayContent)||void 0===b||b||In)&&f(R.content),Bn=!yn&&!wn,Fn=yn?R.title:wn?"No Title Found":"No Matching Section Found",On=!!D[N],Rn=ln(K,N),Nn=N.split("-").map(Number)[0],Mn=q[Nn],jn=J[Nn],En=Nn,Kn=Nn,Wn=!1,Ln=function(n,i,e){if(!n||!i)return null;if(n.id===i||n.nodeId===i||n.contentId===i)return{section:n,keyPath:e};for(var t=(n.subsections||[]).map(function(n,i){return{section:n,keyPath:"".concat(e,"-").concat(i)}}),o=function(){var n=t.shift();return(null==n?void 0:n.section)?n.section.id===i||n.section.nodeId===i||n.section.contentId===i?{value:n}:void(n.section.subsections||[]).forEach(function(i,e){t.push({section:i,keyPath:"".concat(n.keyPath,"-").concat(e)})}):"continue"};t.length>0;){var l=o();if("object"==typeof l)return l.value}return null};if(T)if("left"===K){var zn=null===(_=null==Mn?void 0:Mn.refIndexes)||void 0===_?void 0:_[0],An=J.findIndex(function(n){return n.selfIndex===zn});-1!==An?(jn=J[An],Kn=An):Wn=!0}else{var Dn=null===(k=null==jn?void 0:jn.refIndexes)||void 0===k?void 0:k[0],Hn=q.findIndex(function(n){return n.selfIndex===Dn});-1!==Hn?(Mn=q[Hn],En=Hn):Wn=!0}var Tn=function(n,i){if(!i||!n)return null;for(var e=0;e<n.length;e++){var t=Ln(n[e],i,String(e));if(t)return t}return null},Gn=null,Un=null,qn="",Jn="";if(T)"left"===K?(Gn=R,qn=N,(Qn=Ln(jn,R.nodeId||R.id,String(Kn)))||(Qn=Tn(J,R.nodeId||R.id)),Un=(null==Qn?void 0:Qn.section)||null,Jn=(null==Qn?void 0:Qn.keyPath)||""):(Un=R,Jn=N,(Vn=Ln(Mn,R.nodeId||R.id,String(En)))||(Vn=Tn(q,R.nodeId||R.id)),Gn=(null==Vn?void 0:Vn.section)||null,qn=(null==Vn?void 0:Vn.keyPath)||"");else if("left"===K){Gn=R,qn=N;var Qn=Tn(J,R.nodeId||R.id);Un=(null==Qn?void 0:Qn.section)||null,Jn=(null==Qn?void 0:Qn.keyPath)||""}else{Un=R,Jn=N;var Vn=Tn(q,R.nodeId||R.id);Gn=(null==Vn?void 0:Vn.section)||null,qn=(null==Vn?void 0:Vn.keyPath)||""}var Xn=(qn?dn(qn):null)||dn(N),Yn=null===(C=null==Q?void 0:Q.input_index_map)||void 0===C?void 0:C[0],Zn=null===(P=null==Q?void 0:Q.input_index_map)||void 0===P?void 0:P[1],$n="left"===K?Zn:Yn,ni="left"===K?!Un:!Gn,ii=R.evaluationResult||(null==Gn?void 0:Gn.evaluationResult)||(null==Un?void 0:Un.evaluationResult),ei=(null==ii?void 0:ii.deviations)||{},ti=R.nodeId||R.id||(null==Gn?void 0:Gn.nodeId)||(null==Gn?void 0:Gn.id)||(null==Un?void 0:Un.nodeId)||(null==Un?void 0:Un.id);T&&"left"!==K&&(null==Gn?void 0:Gn.id)&&(ti=Gn.nodeId||Gn.id);var oi=Object.keys(ei)[0],li=oi?"".concat(ti).concat(x).concat(oi):null,di=li?null==X?void 0:X[li]:null,ri=Nn+1;if(T&&gn){var ai="left"===K?gn.leftNums.get(null==Mn?void 0:Mn.id):gn.rightNums.get(null==jn?void 0:jn.id);Wn&&void 0!==ai?ri=ai:null!=di&&di>=0?ri=di:void 0!==ai&&(ri=ai)}else null!=di&&di>=0&&(ri=di);var ui=null!==(F=null===(B=null===(w=null==ii?void 0:ii.evaluation_outputs)||void 0===w?void 0:w.metadata)||void 0===B?void 0:B.label_color)&&void 0!==F?F:y,ci=m(ui).highlightBg,si=Object.entries(ei).map(function(n){var i=n[0],e=n[1],t="".concat(ti).concat(x).concat(i);return{deviationKey:i,deviationMap:e,refId:t,currentIndex:V[t]}}).filter(function(n){return void 0!==n.currentIndex&&null!==n.currentIndex});si.sort(function(n,i){return n.currentIndex-i.currentIndex});var vi=si.map(function(i){var e,t,o,l=i.deviationKey,d=i.deviationMap,r=i.refId,a=i.currentIndex;T&&void 0!==z&&(a-=z),a=Math.max(1,a);var u=d[L],c=g(u);if(c)u="";else if(!u)return null;var s=d[$n],v=ni||g(s),f="".concat(ri,".").concat(a),p="".concat(ti).concat(x).concat(l).concat(x).concat(qn).concat(x).concat(Jn),h=(null==d?void 0:d.evaluation_outputs)||(null==ii?void 0:ii.evaluation_outputs),y=null!==(e=null==h?void 0:h.output_value)&&void 0!==e?e:null,S=null!==(o=null===(t=null==h?void 0:h.metadata)||void 0===t?void 0:t.label_color)&&void 0!==o?o:ui,I=m(S),b=n({},I),_=(null==d?void 0:d.deviation_summary)?{deviation_summary:d.deviation_summary||(null==ii?void 0:ii.deviation_summary),deviation_title:(null==d?void 0:d.deviation_title)||(null==ii?void 0:ii.deviation_title),deviation_impact:(null==d?void 0:d.deviation_impact)||(null==ii?void 0:ii.deviation_impact),deviation_explanation:(null==d?void 0:d.deviation_explanation)||(null==ii?void 0:ii.deviation_explanation),evaluation_outputs:h,cognitive_decisioning:(null==d?void 0:d.cognitive_decisioning)||(null==ii?void 0:ii.cognitive_decisioning)}:null,k=0,C=Cn||"";if(u&&C){var P=C.split(/\n{2,}/),w=P.findIndex(function(n){return n.includes(u)});if(-1!==w){var B=Object.entries(ei).filter(function(n){n[0];var i=n[1][L];return i&&P[w].includes(i)}).sort(function(n,i){return P[w].indexOf(n[1][L])-P[w].indexOf(i[1][L])}),F=B.filter(function(n){n[0];var i=n[1][L];return i&&(i.includes(u)||u.includes(i))});F.length>1&&(k=Math.max(0,F.findIndex(function(n){return n[0]===l})))}}var O=rn(K,r);return{id:r,actionId:p,label:f,highlight:u,side:K,style:b,stackIndex:k,score:y,isConnected:Y.has(p),showScrollLockToggle:Y.has(p)||$&&Z===p||!!tn&&tn===O.current,scrollSyncLocked:nn,toggleScrollSyncLocked:en,isOrphan:v,isMissingClause:c,badgeRef:O,onClick:function(i){i.stopPropagation();var e=Gn?n(n({},Gn),{title:(null==Mn?void 0:Mn.title)||(null==Gn?void 0:Gn.title)||""}):{id:"orphan-left",title:"",content:""},t=Un?n(n({},Un),{title:(null==jn?void 0:jn.title)||(null==Un?void 0:Un.title)||""}):{id:"orphan-right",title:"",content:""};an(i,e,v,t,p,b)},onSummaryClick:function(n){n.stopPropagation(),un(n,p,v,_)}}}).filter(Boolean).sort(function(n,i){return parseFloat(n.label)-parseFloat(i.label)}),fi=o(function(){var n=new Set;return vi.filter(function(i){return!n.has(i.id)&&(n.add(i.id),!0)})},[vi]),pi=U||!bn&&Sn?fi:[],hi=fi.map(function(n){return n.highlight}).filter(Boolean),mi=vi.find(function(n){return Y.has(n.actionId)}),gi=!!mi;if(!(yn||wn||R.subsections&&0!==R.subsections.length))return null;var xi=(null===(O=null==mi?void 0:mi.style)||void 0===O?void 0:O.badgeBorder)||(null==Xn?void 0:Xn.badgeBorder),yi=gi&&xi?{borderRadius:"4px",outline:"2px solid ".concat(xi),outlineOffset:"1px"}:{};return i(l,yn?n({ref:Rn,sx:{mt:1,width:"100%",minWidth:0,position:"relative"}},{children:i(l,n({sx:n({width:"100%"},yi)},{children:e(d,n({disableGutters:!0,expanded:!Bn&&On,onChange:function(){if(!Bn){if(On){var i=String(Z||""),e=i.includes(qn)||i.includes(Jn);e||Y.forEach(function(n){(String(n).includes(qn)||String(n).includes(Jn))&&(e=!0)}),e&&(cn(),sn(new Set),vn([]),fn.current=[])}H(function(i){var e;return n(n({},i),((e={})[N]=!i[N],e))})}},sx:{mt:0,boxShadow:"none",border:Bn?"1px dashed #E2E8F0":"1px solid #EEF2F7",borderRadius:"4px !important",bgcolor:"#FFFFFF",minWidth:0,"&:before":{display:"none"}}},{children:[i(r,n({expandIcon:Bn?null:i(c,{size:14}),sx:{minHeight:"32px","& .MuiAccordionSummary-content":{my:.5,display:"grid",alignItems:"center",minWidth:0,width:"100%"}}},{children:i(a,n({component:"div",sx:{fontSize:"11px",fontWeight:600,color:Bn?"#94A3B8":"#19213D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0}},{children:Fn||"Untitled Subsection"}))})),!Bn&&e(u,n({sx:{pt:0,pb:1,minWidth:0}},{children:[wn&&i(s,{content:Cn,overlayContent:Pn,sxStyles:on,deviationBadges:pi,maintainRelativeOrder:T,highlightBg:ci,suppressHighlightBg:_n,highlights:hi,collisionKey:xn}),(R.subsections||[]).map(function(n,e){return i(S,{section:n,keyPath:"".concat(N,"-").concat(e),depth:j+1,columnKey:K,parentNodeId:L,sectionOffset:z},"".concat(N,"-").concat(e))})]}))]}))}))}):n({ref:Rn,sx:{mt:0===j?1:.75,width:"100%",minWidth:0,position:"relative"}},{children:!Bn&&e(l,n({sx:n({width:"100%"},yi)},{children:[wn&&i(s,{content:Cn,overlayContent:Pn,sxStyles:on,deviationBadges:pi,maintainRelativeOrder:T,highlightBg:ci,suppressHighlightBg:_n,highlights:hi,collisionKey:xn}),(R.subsections||[]).map(function(n,e){return i(S,{section:n,keyPath:"".concat(N,"-").concat(e),depth:j+1,columnKey:K,parentNodeId:L,sectionOffset:z},"".concat(N,"-").concat(e))})]}))}))});export{S as default};
|
|
1
|
+
import{__assign as n}from"tslib";import{jsx as i,jsxs as e}from"react/jsx-runtime";import t,{useMemo as o}from"react";import{Box as l,Accordion as d,AccordionSummary as r,Typography as a,AccordionDetails as u}from"@mui/material";import{ChevronDown as c}from"lucide-react";import{MemoizedMarkdown as s}from"../hooks/memoizedMarkdown.js";import{useCompareContext as v}from"../CompareContext.js";import{hasValue as f,hasMeaningfulRedlineTags as p,stripRedlineTags as h,hasSingleMappedLhsSection as m,generateColorPalette as g,safeStringify as x,isMissingStr as y,getRhsMappedSectionNumber as S,DEVIATION_BADGE_SEPARATOR as I}from"../CognitiveComparehelpers.js";import{DEFAULT_DEVIAION_COLOR as b}from"../CognitiveCompareConstants.js";var _=t.memo(function(t){var k,w,C,F,O,P,N,B,R,E,M=t.section,j=t.keyPath,A=t.depth,K=void 0===A?0:A,W=t.columnKey,L=void 0===W?"left":W,T=t.parentNodeId,z=void 0===T?"":T,D=t.sectionOffset,G=t.rhsOrphanVisualIndexes,H=v(),V=H.expandedSubSections,X=H.setExpandedSubSections,U=H.maintainRelativeOrder,q=H.showDeviationBadges,J=void 0!==q&&q,Q=H.proposedSections,Y=H.existingSections,Z=H.treeData,$=H.deviationNumberRegistry,nn=H.deviationParentRegistry,en=H.connectedSections,tn=H.activeSideBySideSection,on=H.isSideBySide,ln=H.scrollSyncLocked,dn=H.toggleScrollSyncLocked,rn=H.summaryPopupAnchorEl,an=H.resolvedMarkdownStyles,un=H.getSubSectionRef,cn=H.getSubSectionCompareStyle,sn=H.getBadgeRef,vn=H.openMoreFunctionsPopup,fn=H.openSummaryPopup,pn=H.resetSideBySide,hn=H.setConnectedSections,mn=H.setConnectedLines,gn=H.cachedConnectedPositions,xn=H.isProposingFix,yn=H.proposingFixNodeId,Sn=H.isRedlineFlow,In=H.unifiedNumbering,bn=null!=tn?tn:"",_n=(null===(k=M.displayTitle)||void 0===k||k)&&f(M.title),kn=!(!xn||!yn||"left"!==L||M.id!==yn&&M.nodeId!==yn),wn=p(M.content),Cn="boolean"==typeof Sn?Sn:wn,Fn=wn,On=Cn&&wn,Pn=On?h(M.content):M.content,Nn=On?M.content:void 0,Bn=(null===(w=M.displayContent)||void 0===w||w||wn)&&f(M.content),Rn=!_n&&!Bn,En=_n?M.title:Bn?"No Title Found":"No Matching Section Found",Mn=!!V[j],jn=un(L,j),An=j.split("-").map(Number)[0],Kn=Q[An],Wn=Y[An],Ln=An,Tn=An,zn=!1,Dn=function(n,i,e){if(!n||!i)return null;if(n.id===i||n.nodeId===i||n.contentId===i)return{section:n,keyPath:e};for(var t=(n.subsections||[]).map(function(n,i){return{section:n,keyPath:"".concat(e,"-").concat(i)}}),o=function(){var n=t.shift();return(null==n?void 0:n.section)?n.section.id===i||n.section.nodeId===i||n.section.contentId===i?{value:n}:void(n.section.subsections||[]).forEach(function(i,e){t.push({section:i,keyPath:"".concat(n.keyPath,"-").concat(e)})}):"continue"};t.length>0;){var l=o();if("object"==typeof l)return l.value}return null};if(U)if("left"===L){var Gn=null===(C=null==Kn?void 0:Kn.refIndexes)||void 0===C?void 0:C[0],Hn=Y.findIndex(function(n){return n.selfIndex===Gn});-1!==Hn?(Wn=Y[Hn],Tn=Hn):zn=!0}else{var Vn=null===(F=null==Wn?void 0:Wn.refIndexes)||void 0===F?void 0:F[0],Xn=Q.findIndex(function(n){return n.selfIndex===Vn});-1!==Xn?(Kn=Q[Xn],Ln=Xn):zn=!0}var Un=function(n,i){if(!i||!n)return null;for(var e=0;e<n.length;e++){var t=Dn(n[e],i,String(e));if(t)return t}return null},qn=null,Jn=null,Qn="",Yn="";if(U)"left"===L?(qn=M,Qn=j,(Zn=Dn(Wn,M.nodeId||M.id,String(Tn)))||(Zn=Un(Y,M.nodeId||M.id)),Jn=(null==Zn?void 0:Zn.section)||null,Yn=(null==Zn?void 0:Zn.keyPath)||""):(Jn=M,Yn=j,($n=Dn(Kn,M.nodeId||M.id,String(Ln)))||($n=Un(Q,M.nodeId||M.id)),qn=(null==$n?void 0:$n.section)||null,Qn=(null==$n?void 0:$n.keyPath)||"");else if("left"===L){qn=M,Qn=j;var Zn=Un(Y,M.nodeId||M.id);Jn=(null==Zn?void 0:Zn.section)||null,Yn=(null==Zn?void 0:Zn.keyPath)||""}else{Jn=M,Yn=j;var $n=Un(Q,M.nodeId||M.id);qn=(null==$n?void 0:$n.section)||null,Qn=(null==$n?void 0:$n.keyPath)||""}var ni=(Qn?cn(Qn):null)||cn(j),ii=null===(O=null==Z?void 0:Z.input_index_map)||void 0===O?void 0:O[0],ei=null===(P=null==Z?void 0:Z.input_index_map)||void 0===P?void 0:P[1],ti="left"===L?ei:ii,oi="left"===L?!Jn:!qn,li=U&&"right"===L&&m(Wn,Q),di=M.evaluationResult||(null==qn?void 0:qn.evaluationResult)||(null==Jn?void 0:Jn.evaluationResult),ri=(null==di?void 0:di.deviations)||{},ai=M.nodeId||M.id||(null==qn?void 0:qn.nodeId)||(null==qn?void 0:qn.id)||(null==Jn?void 0:Jn.nodeId)||(null==Jn?void 0:Jn.id);U&&"left"!==L&&(null==qn?void 0:qn.id)&&(ai=qn.nodeId||qn.id);var ui=Object.keys(ri)[0],ci=ui?"".concat(ai).concat(I).concat(ui):null,si=ci?null==nn?void 0:nn[ci]:null,vi=An+1;if(U&&In){var fi="left"===L?In.leftNums.get(null==Kn?void 0:Kn.id):In.rightNums.get(null==Wn?void 0:Wn.id);zn&&void 0!==fi?vi=fi:null!=si&&si>=0?vi=si:void 0!==fi&&(vi=fi)}else null!=si&&si>=0&&(vi=si);var pi=null!==(R=null===(B=null===(N=null==di?void 0:di.evaluation_outputs)||void 0===N?void 0:N.metadata)||void 0===B?void 0:B.label_color)&&void 0!==R?R:b,hi=g(pi).highlightBg,mi=Object.entries(ri).map(function(n){var i=n[0],e=n[1],t="".concat(ai).concat(I).concat(i);return{deviationKey:i,deviationMap:e,refId:t,currentIndex:$[t]}}).filter(function(n){return void 0!==n.currentIndex&&null!==n.currentIndex});mi.sort(function(n,i){return n.currentIndex-i.currentIndex});var gi=new Map;if(!G&&U&&"right"===L){var xi=x(Pn||"").replace(/\\n/g,"\n");mi.filter(function(n){var i=n.deviationMap,e=i[z];return(oi||y(i[ti]))&&!!e&&!y(e)}).map(function(i){var e=x(i.deviationMap[z]||"").replace(/\\n/g,"\n"),t=e?xi.indexOf(e):-1;return n(n({},i),{position:t})}).sort(function(n,i){return(-1===n.position?Number.MAX_SAFE_INTEGER:n.position)-(-1===i.position?Number.MAX_SAFE_INTEGER:i.position)||n.currentIndex-i.currentIndex}).forEach(function(n,i){gi.set(n.refId,i+1)})}var yi=mi.map(function(i){var e,t,o,l,d=i.deviationKey,r=i.deviationMap,a=i.refId,u=i.currentIndex,c=r[z],s=y(c);if(s)c="";else if(!c)return null;var v=r[ti],f=oi||y(v),p=null!==(e=null==G?void 0:G.get(a))&&void 0!==e?e:gi.get(a);U&&"right"===L&&f&&void 0!==p?u=p:U&&void 0!==D&&("right"!==L||f||li)&&(u-=D),u=Math.max(1,u);var h=U&&"right"===L&&f&&In?S({section:Wn,proposedSections:Q,leftNums:In.leftNums,fallbackNumber:String(vi),firstOnly:!0}):vi,m="".concat(h,".").concat(u),x="".concat(ai).concat(I).concat(d).concat(I).concat(Qn).concat(I).concat(Yn),b=(null==r?void 0:r.evaluation_outputs)||(null==di?void 0:di.evaluation_outputs),_=null!==(t=null==b?void 0:b.output_value)&&void 0!==t?t:null,k=null!==(l=null===(o=null==b?void 0:b.metadata)||void 0===o?void 0:o.label_color)&&void 0!==l?l:pi,w=g(k),C=n({},w),F=(null==r?void 0:r.deviation_summary)?{deviation_summary:r.deviation_summary||(null==di?void 0:di.deviation_summary),deviation_title:(null==r?void 0:r.deviation_title)||(null==di?void 0:di.deviation_title),deviation_impact:(null==r?void 0:r.deviation_impact)||(null==di?void 0:di.deviation_impact),deviation_explanation:(null==r?void 0:r.deviation_explanation)||(null==di?void 0:di.deviation_explanation),evaluation_outputs:b,cognitive_decisioning:(null==r?void 0:r.cognitive_decisioning)||(null==di?void 0:di.cognitive_decisioning)}:null,O=0,P=Pn||"";if(c&&P){var N=P.split(/\n{2,}/),B=N.findIndex(function(n){return n.includes(c)});if(-1!==B){var R=Object.entries(ri).filter(function(n){n[0];var i=n[1][z];return i&&N[B].includes(i)}).sort(function(n,i){return N[B].indexOf(n[1][z])-N[B].indexOf(i[1][z])}),E=R.filter(function(n){n[0];var i=n[1][z];return i&&(i.includes(c)||c.includes(i))});E.length>1&&(O=Math.max(0,E.findIndex(function(n){return n[0]===d})))}}var M=sn(L,a);return{id:a,actionId:x,label:m,highlight:c,side:L,style:C,stackIndex:O,score:_,isConnected:en.has(x),showScrollLockToggle:en.has(x)||on&&tn===x||!!rn&&rn===M.current,scrollSyncLocked:ln,toggleScrollSyncLocked:dn,isOrphan:f,isMissingClause:s,badgeRef:M,onClick:function(i){i.stopPropagation();var e=qn?n(n({},qn),{title:(null==Kn?void 0:Kn.title)||(null==qn?void 0:qn.title)||""}):{id:"orphan-left",title:"",content:""},t=Jn?n(n({},Jn),{title:(null==Wn?void 0:Wn.title)||(null==Jn?void 0:Jn.title)||""}):{id:"orphan-right",title:"",content:""};vn(i,e,f,t,x,C)},onSummaryClick:function(n){n.stopPropagation(),fn(n,x,f,F)}}}).filter(Boolean).sort(function(n,i){return parseFloat(n.label)-parseFloat(i.label)}),Si=o(function(){var n=new Set;return yi.filter(function(i){return!n.has(i.id)&&(n.add(i.id),!0)})},[yi]),Ii=J||!Cn&&kn?Si:[],bi=Si.map(function(n){return n.highlight}).filter(Boolean),_i=yi.find(function(n){return en.has(n.actionId)}),ki=!!_i;if(!(_n||Bn||M.subsections&&0!==M.subsections.length))return null;var wi=(null===(E=null==_i?void 0:_i.style)||void 0===E?void 0:E.badgeBorder)||(null==ni?void 0:ni.badgeBorder),Ci=ki&&wi?{borderRadius:"4px",outline:"2px solid ".concat(wi),outlineOffset:"1px"}:{};return i(l,_n?n({ref:jn,sx:{mt:1,width:"100%",minWidth:0,position:"relative"}},{children:i(l,n({sx:n({width:"100%"},Ci)},{children:e(d,n({disableGutters:!0,expanded:!Rn&&Mn,onChange:function(){if(!Rn){if(Mn){var i=String(tn||""),e=i.includes(Qn)||i.includes(Yn);e||en.forEach(function(n){(String(n).includes(Qn)||String(n).includes(Yn))&&(e=!0)}),e&&(pn(),hn(new Set),mn([]),gn.current=[])}X(function(i){var e;return n(n({},i),((e={})[j]=!i[j],e))})}},sx:{mt:0,boxShadow:"none",border:Rn?"1px dashed #E2E8F0":"1px solid #EEF2F7",borderRadius:"4px !important",bgcolor:"#FFFFFF",minWidth:0,"&:before":{display:"none"}}},{children:[i(r,n({expandIcon:Rn?null:i(c,{size:14}),sx:{minHeight:"32px","& .MuiAccordionSummary-content":{my:.5,display:"grid",alignItems:"center",minWidth:0,width:"100%"}}},{children:i(a,n({component:"div",sx:{fontSize:"11px",fontWeight:600,color:Rn?"#94A3B8":"#19213D",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",width:"100%",minWidth:0}},{children:En||"Untitled Subsection"}))})),!Rn&&e(u,n({sx:{pt:0,pb:1,minWidth:0}},{children:[Bn&&i(s,{content:Pn,overlayContent:Nn,sxStyles:an,deviationBadges:Ii,maintainRelativeOrder:U,highlightBg:hi,suppressHighlightBg:Fn,highlights:bi,collisionKey:bn}),(M.subsections||[]).map(function(n,e){return i(_,{section:n,keyPath:"".concat(j,"-").concat(e),depth:K+1,columnKey:L,parentNodeId:z,sectionOffset:D,rhsOrphanVisualIndexes:G},"".concat(j,"-").concat(e))})]}))]}))}))}):n({ref:jn,sx:{mt:0===K?1:.75,width:"100%",minWidth:0,position:"relative"}},{children:!Rn&&e(l,n({sx:n({width:"100%"},Ci)},{children:[Bn&&i(s,{content:Pn,overlayContent:Nn,sxStyles:an,deviationBadges:Ii,maintainRelativeOrder:U,highlightBg:hi,suppressHighlightBg:Fn,highlights:bi,collisionKey:bn}),(M.subsections||[]).map(function(n,e){return i(_,{section:n,keyPath:"".concat(j,"-").concat(e),depth:K+1,columnKey:L,parentNodeId:z,sectionOffset:D,rhsOrphanVisualIndexes:G},"".concat(j,"-").concat(e))})]}))}))});export{_ as default};
|
|
2
2
|
//# sourceMappingURL=SubSectionAccordion.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as n,__rest as e}from"tslib";import{jsx as t,jsxs as r,Fragment as i}from"react/jsx-runtime";import{Box as o,Typography as a}from"@mui/material";import l,{useRef as c,useMemo as d,useLayoutEffect as s}from"react";import{DEFAULT_DEVIAION_COLOR as u}from"../CognitiveCompareConstants.js";import{EllipsisVertical as h}from"lucide-react";import p from"react-markdown";import{mixHexColors as g,areMarkdownPropsEqual as f}from"../CognitiveComparehelpers.js";import v from"rehype-raw";import m from"remark-gfm";var b=function(n){return"function"==typeof n?n:(null==n?void 0:n.default)||n},x=[b(m)],y=[b(v)],E=l.memo(function(f){var v=f.content,m=f.overlayContent,b=f.sxStyles,E=f.deviationBadges,C=void 0===E?[]:E,S=f.highlights,k=void 0===S?[]:S;f.maintainRelativeOrder;var B=f.highlightBg,F=f.suppressHighlightBg,w=void 0!==F&&F,A=f.collisionKey,T=c(null),z=!!m,I=d(function(){return C.reduce(function(e,t){var r;return n(n({},e),((r={})[t.id]=t,r))},{})},[C]),O=c({badgeMap:I,highlightBg:B,hideHighlightBg:z,suppressHighlightBg:w});O.current={badgeMap:I,highlightBg:B,hideHighlightBg:z,suppressHighlightBg:w};var M=function(e,t){return l.Children.map(e,function(e){var r;if(!l.isValidElement(e))return e;var i=(null===(r=e.props)||void 0===r?void 0:r.children)?M(e.props.children,t):e.props.children,o=l.cloneElement(e,n(n({},e.props),{children:i}));return t(o)})},$=d(function(){return{mark:function(r){var i,o,a,l,c=r.children,d=e(r,["children"]),s=O.current,u=s.badgeMap,h=s.highlightBg,p=s.hideHighlightBg,g=s.suppressHighlightBg,f=d["data-badge-id"],v=f?u[f]:null,m=d["data-highlight-color"],b=null!==(l=null!==(o=null!=m?m:null===(i=null==v?void 0:v.style)||void 0===i?void 0:i.highlightBg)&&void 0!==o?o:null===(a=null==v?void 0:v.style)||void 0===a?void 0:a.badgeBg)&&void 0!==l?l:h,x="true"===d["data-is-suggested-deviation-fix"]||g;return t("span",n({style:n(n(n({},x?{}:{backgroundColor:b}),{borderRadius:"2px",display:"inline",boxDecorationBreak:"clone",WebkitBoxDecorationBreak:"clone",backgroundClip:"padding-box",padding:"0 1px"}),p?{color:"transparent"}:{})},{children:c}))},span:function(i){var a,l,c,d,s,p,g=i.children,f=e(i,["children"]),v=O.current.badgeMap,m=f["data-badge-id"];if(!m)return t("span",n({},f,{children:g}));var b=v[m];if(!b)return t("span",n({},f,{children:g}));var x="number"==typeof b.stackIndex?b.stackIndex:0,y="translateY(calc(-20% + ".concat(12*x,"px + var(--badge-nudge, 0px)))");return r(o,n({component:"span",sx:{position:"static",display:"inline"}},{children:[r(o,n({ref:b.badgeRef,className:"deviation-badge","data-side":b.side||"right",sx:n(n({fontStyle:"normal",position:"absolute",zIndex:30+x,display:"inline-flex",alignItems:"stretch",fontSize:"10px",bgcolor:(null===(a=b.style)||void 0===a?void 0:a.badgeBg)||"#EEF2FF",color:(null===(l=b.style)||void 0===l?void 0:l.badgeText)||u,border:"1px solid ".concat((null===(c=b.style)||void 0===c?void 0:c.badgeBorder)||"#C7D2FE"),borderRadius:"12px",fontWeight:600,whiteSpace:"nowrap",boxShadow:"0 1px 3px rgba(0,0,0,0.07)",overflow:"hidden",transition:"none"},"left"===b.side?{right:"-16px",transform:"".concat(y," translateX(calc(100% + 8px))")}:{left:"-16px",transform:"".concat(y," translateX(calc(-100% - 8px))")}),b.isConnected&&b.style&&{outline:"2px solid ".concat(b.style.badgeBorder),outlineOffset:"1px"})},{children:[r(o,n({onClick:function(n){n.stopPropagation(),b.onSummaryClick&&b.onSummaryClick(n)},sx:{display:"flex",alignItems:"center",px:1,py:.3,cursor:"pointer","&:hover":{bgcolor:"rgba(0,0,0,0.04)"}}},{children:[t(o,n({component:"span",sx:{fontSize:"10px",fontWeight:700}},{children:b.label})),("left"===b.side||b.isOrphan)&&t(o,n({component:"span",sx:{fontSize:"10px",pl:.5,ml:.5,borderLeft:"1px solid ".concat((null===(d=b.style)||void 0===d?void 0:d.badgeBorder)||"#C7D2FE")}},{children:null!=b.score&&"N/A"!==b.score&&"NA"!==b.score&&0!==b.score?"".concat(b.score):"N/A"===b.score||"NA"===b.score?"N/A":"Same"}))]})),("left"===b.side||b.isOrphan)&&t(o,n({onClick:function(n){n.stopPropagation(),b.onClick&&b.onClick(n)},sx:{display:"flex",alignItems:"center",px:.5,borderLeft:"1px solid ".concat((null===(s=b.style)||void 0===s?void 0:s.badgeBorder)||"#C7D2FE"),cursor:"pointer","&:hover":{bgcolor:"rgba(0,0,0,0.06)"}}},{children:t(h,{size:12,color:(null===(p=b.style)||void 0===p?void 0:p.badgeText)||"#3730A3"})}))]})),g]}))},table:function(e){var r=e.children;return t(o,n({component:"table",sx:{width:"100%",borderCollapse:"collapse",my:1,fontSize:"inherit"}},{children:r}))},thead:function(e){var r=e.children;return t(o,n({component:"thead"},{children:r}))},tbody:function(e){var r=e.children;return t(o,n({component:"tbody"},{children:r}))},tr:function(e){var r=e.children;return t(o,n({component:"tr",sx:{borderBottom:"1px solid #E5E7EB"}},{children:r}))},th:function(e){var r=e.children;return t(o,n({component:"th",sx:{border:"1px solid #E5E7EB",padding:"8px",textAlign:"left",fontWeight:600,backgroundColor:"#F9FAFB"}},{children:r}))},td:function(e){var r=e.children;return t(o,n({component:"td",sx:{border:"1px solid #E5E7EB",padding:"8px",verticalAlign:"top"}},{children:r}))},code:function(e){var r=e.children;return t("span",n({style:{fontFamily:"inherit",fontSize:"inherit"}},{children:r}))},pre:function(e){var r=e.children;return t("span",n({style:{fontFamily:"inherit",fontSize:"inherit",display:"block",whiteSpace:"pre-wrap"}},{children:r}))},updated:function(n){var e=n.children;return t(i,{children:e})},deleted:function(e){var r=e.children,i=M(r,function(n){return l.cloneElement(n,{"data-is-suggested-deviation-fix":"true"})});return t("span",n({style:{boxShadow:"inset 0 1px 0 #EF4444, inset 0 -1px 0 #EF4444",backgroundColor:"#FCCCCC",textDecoration:"line-through"}},{children:i}))},changed:function(e){var r=e.children,i=M(r,function(n){return l.cloneElement(n,{"data-is-suggested-deviation-fix":"true"})});return t("span",n({style:{boxShadow:"inset 0 1px 0 #2F59FF, inset 0 -1px 0 #2F59FF",backgroundColor:"#D5E8FF"}},{children:i}))},ul:function(r){var i=r.children,a=e(r,["children"]);return t(o,n({component:"ul",sx:{mt:1,mb:1,pl:3,listStyleType:"disc"}},a,{children:i}))},ol:function(r){var i=r.children,a=e(r,["children"]);return t(o,n({component:"ol",sx:{mt:1,mb:1,pl:3,listStyleType:"decimal"}},a,{children:i}))},li:function(r){var i=r.children,a=e(r,["children"]);return t(o,n({component:"li",sx:{mb:.5,display:"list-item"}},a,{children:i}))}}},[]),j=function(n){if(!n||"string"!=typeof n)return"";var e=n,t=(e=(e=(e=(e=(e=(e=(e=(e=e.replace(/((?:<\/?[a-z]+[^>]*>\s*)+)([*+\-] |\d+\. )/gi,"$2$1")).replace(/\\(['"])/g,"$1").replace(/\\n/g,"\n").replace(/\\\./g,".").replace(/\r\n/g,"\n")).replace(/^(\d+\.)(\s{2,})/gm,function(n,e,t){return"".concat(e.slice(0,-1),"\\.").concat(t)})).replace(/^(\d+\.)\s*\n+(\s+)(\S)/gm,function(n,e,t,r){return"".concat(e," ").concat(r)})).replace(/([^\n])\n(#{1,6} )/g,"$1\n\n$2")).replace(/([^\n])\n([ \t]*(?:[#*+\-] |\d+\. ))/g,"$1\n\n$2")).replace(/\n{3,}/g,"\n\n")).replace(/^[ \t]+(?![ \t]*([\*\-\+] |\d+\. ))/gm,function(n){return n.replace(/ /g," ").replace(/\t/g," ")})).split(/(\n{2,})/);return(e=t.map(function(n){return/^\n+$/.test(n)||/\|.*\|/.test(n)&&/\|[\s:|-]+\|/.test(n)||/^#{1,6} /.test(n.trimStart())?n:n.replace(/\n(?=[^\n])/g,function(e,t){var r=n.slice(t+1);return/^[ \t]*([#>|\-*+]|\d+\.)/.test(r)?"\n":" "})}).join("")).trim()},P=function(n){return n.replace(/[\.,;:]/g," ")},D=d(function(){return C.map(function(n){return{id:n.id,connected:n.isConnected,stackIndex:n.stackIndex,size:n.size}})},[C]),H=d(function(){var e=j(v||""),t=w?P(e):e,r=(C||[]).map(function(n){var e,t;return{id:null==n?void 0:n.id,highlight:j((null==n?void 0:n.highlight)||""),highlightColor:(null===(e=null==n?void 0:n.style)||void 0===e?void 0:e.highlightBg)||(null===(t=null==n?void 0:n.style)||void 0===t?void 0:t.badgeBg)||B}}).filter(function(n){return n.id&&n.highlight}),i={};r.forEach(function(n){i[n.highlight]||(i[n.highlight]=[]),i[n.highlight].push(n)});var o=function(n,e,t,r){void 0===e&&(e=""),void 0===r&&(r=[]);var i=!1,o=function(n){var o=function(n,e,t){var r,i,o;void 0===e&&(e="");var a=n.match(/^(\s*)([\s\S]*?)(\s*)$/);if(!a)return n;var l=null!==(r=a[1])&&void 0!==r?r:"",c=null!==(i=a[2])&&void 0!==i?i:"",d=null!==(o=a[3])&&void 0!==o?o:"";return c?l+function(n,e){void 0===n&&(n="");var t=e?' data-highlight-color="'.concat(e,'"'):"",r=n?' data-badge-id="'.concat(n,'"'):"";return"<mark".concat(r).concat(t,">")}(e,t)+c+"</mark>"+d:n}(n,e,t),a=o;if(!i&&r.length>0){i=!0;var l="",c="";r.forEach(function(n){l+=function(n){return'<span data-badge-id="'.concat(n,'">')}(n.id),c="</span>"+c}),a=l+o+c}return""+a};return n.split(/(\n+)/).map(function(n){return/^\n+$/.test(n)?n:n.trim()?""===n.replace(/[|:\-\s]/g,"")&&n.includes("-")?n:n.includes("|")?n.split(/(\|)/).map(function(n){return"|"!==n&&n.trim()?o(n):n}).join(""):o(n):n}).join("")},a=[];Object.entries(i).forEach(function(n){var r=n[0],i=n[1],o=e.indexOf(r),l=!1;if(-1===o&&w){var c=P(r);-1!==(o=t.indexOf(c))&&(l=!0)}if(-1!==o){for(var d=i[0].highlightColor,s=1;s<i.length;s++)d=g(d,i[s].highlightColor||"");a.push({highlight:r,start:o,end:o+r.length,badges:i,color:d,usedLooseMatch:l})}});var l=new Set(Object.keys(i));(k||[]).forEach(function(n){if(n){var r=j(n);if(r&&!l.has(r)){var i=e.indexOf(r),o=!1;if(-1===i&&w){var c=P(r);-1!==(i=t.indexOf(c))&&(o=!0)}if(-1!==i){var d=e.slice(0,i);(d.match(/</g)||[]).length===(d.match(/>/g)||[]).length&&a.push({highlight:r,start:i,end:i+r.length,badges:[],color:B||"",usedLooseMatch:o})}}}}),a.sort(function(n,e){return n.start-e.start||e.end-n.end});var c=[],d={};a.forEach(function(n,e){for(var t=n.start,r=n.end,i=0,o=c;i<o.length;i++){var a=o[i],l=a.start,s=a.end,u=t<s&&r>s&&t>=l,h=t<l&&r>l&&r<=s;if(t>=l&&r<=s){n.orphaned=!0,d[e]=a.matchIdx;break}u&&(t=s),h&&(r=l)}n.trimmedStart=t,n.trimmedEnd=r,!n.orphaned&&t<r&&c.push({start:t,end:r,matchIdx:e})});var s={};Object.entries(d).forEach(function(n){var e=n[0],t=n[1],r=Number(e);s[t]||(s[t]=[]),s[t].push(r)});var u=a.map(function(e,t){return n(n({},e),{idx:t})}).filter(function(n){return!n.orphaned}).sort(function(n,e){var t,r;return(null!==(t=e.trimmedStart)&&void 0!==t?t:e.start)-(null!==(r=n.trimmedStart)&&void 0!==r?r:n.start)});return u.forEach(function(n){var t,r,i,l,c=null!==(t=n.trimmedStart)&&void 0!==t?t:n.start,d=null!==(r=n.trimmedEnd)&&void 0!==r?r:n.end;if(!(c>=d)){var u=e.slice(c,d),h=function(n,e,t,r){if(!t.length)return n;var i=t.map(function(n){return a[n]}).sort(function(n,e){return n.start-e.start}),l="",c=0;return i.forEach(function(t){var i,a,d=Math.max(c,t.start-e),s=Math.max(d,t.end-e);if(!(d>=s)){var u=g(r,t.color||"");l+=n.slice(c,d),l+=o(n.slice(d,s),(null===(a=null===(i=t.badges)||void 0===i?void 0:i[0])||void 0===a?void 0:a.id)||"",u,t.badges||[]),c=s}}),l+=n.slice(c)}(n.usedLooseMatch||c!==n.start||d!==n.end?u:n.highlight,n.start,s[n.idx]||[],n.color),p=o(h,(null===(l=null===(i=n.badges)||void 0===i?void 0:i[0])||void 0===l?void 0:l.id)||"",n.color,n.badges||[]);e=e.slice(0,c)+p+e.slice(d)}}),e},[v,C,k,B,w]),N=d(function(){return m?j(m||""):""},[m]),R=!!m,L={"& *":{fontFamily:"inherit"},"& code, & pre, & kbd, & samp":{fontFamily:"inherit !important",fontSize:"inherit",background:"none",padding:0,border:"none",whiteSpace:"pre-wrap"},"& p, & li, & ul, & ol":{position:"static",overflow:"visible",whiteSpace:"pre-wrap"}},q=n(n(n(n({},b),L),{position:"relative",overflow:"visible",whiteSpace:"normal",gridArea:"1 / 1",zIndex:2}),R?{color:"transparent",userSelect:"none",pointerEvents:"none","& .deviation-badge":{pointerEvents:"auto"},"& table":{visibility:"hidden",margin:"0 !important"},"& th, & td":{padding:"0 !important",border:"none !important",backgroundColor:"transparent !important"},"& tr":{border:"none !important"},"& p:empty":{display:"none"}}:{}),W=n(n(n({},b),L),{position:"relative",overflow:"visible",whiteSpace:"normal",gridArea:"1 / 1",zIndex:1,pointerEvents:"auto"});return s(function(){if(T.current){var n=function(){var n=Array.from(T.current.querySelectorAll(".deviation-badge"));if(0!==n.length){n.forEach(function(n){n.style.setProperty("--badge-nudge","0px")});var e=n.filter(function(n){return"left"===n.dataset.side}),t=n.filter(function(n){return"left"!==n.dataset.side}),r=T.current.getBoundingClientRect(),i=r.bottom-4,o=r.top+4,a=function(n){if(0!==n.length){var e=n.map(function(n){var e=n.getBoundingClientRect();return{el:n,naturalTop:e.top,height:e.height,currentTop:e.top}});e.sort(function(n,e){return n.naturalTop-e.naturalTop});var t=[],r=[];e.forEach(function(n){if(0===r.length)r.push(n);else{var e=r[r.length-1],i=e.currentTop+e.height;n.naturalTop<i+8?(n.currentTop=i+8,r.push(n)):(t.push(r),r=[n])}}),r.length>0&&t.push(r),t.forEach(function(n){var e=n[n.length-1],t=e.currentTop+e.height;if(t>i){var r=t-i,a=n[0].currentTop-o,l=Math.max(0,Math.min(r,a));n.forEach(function(n){n.currentTop-=l})}}),t.flat().forEach(function(n){var e=n.currentTop-n.naturalTop;n.el.style.setProperty("--badge-nudge","".concat(e,"px"))})}};a(e),a(t)}},e=requestAnimationFrame(function(){requestAnimationFrame(function(){n()})}),t=new ResizeObserver(function(){requestAnimationFrame(n)});return t.observe(T.current),function(){t.disconnect(),cancelAnimationFrame(e)}}},[H,A,D]),r(o,n({ref:T,sx:{position:"relative",display:"grid"}},{children:[t(a,n({component:"div",sx:n(n({},q),{padding:"3px"})},{children:t(p,n({components:$,remarkPlugins:x,rehypePlugins:y},{children:H.replace(/#{3}/g,"")}))})),R&&t(a,n({component:"div",sx:W},{children:t(p,n({components:$,remarkPlugins:x,rehypePlugins:y},{children:N}))}))]}))},f);export{E as MemoizedMarkdown};
|
|
1
|
+
import{__assign as n,__rest as e}from"tslib";import{jsx as t,jsxs as r,Fragment as i}from"react/jsx-runtime";import{Box as o,Typography as a}from"@mui/material";import l,{useRef as c,useMemo as d,useLayoutEffect as s}from"react";import{DEFAULT_DEVIAION_COLOR as u}from"../CognitiveCompareConstants.js";import{EllipsisVertical as h}from"lucide-react";import p from"react-markdown";import{mixHexColors as g,areMarkdownPropsEqual as f}from"../CognitiveComparehelpers.js";import v from"rehype-raw";var m,b=[(m=v,"function"==typeof m?m:(null==m?void 0:m.default)||m)],x=l.memo(function(f){var v=f.content,m=f.overlayContent,x=f.sxStyles,y=f.deviationBadges,E=void 0===y?[]:y,C=f.highlights,S=void 0===C?[]:C;f.maintainRelativeOrder;var B=f.highlightBg,k=f.suppressHighlightBg,F=void 0!==k&&k,w=f.collisionKey,A=c(null),T=!!m,z=d(function(){return E.reduce(function(e,t){var r;return n(n({},e),((r={})[t.id]=t,r))},{})},[E]),I=c({badgeMap:z,highlightBg:B,hideHighlightBg:T,suppressHighlightBg:F});I.current={badgeMap:z,highlightBg:B,hideHighlightBg:T,suppressHighlightBg:F};var O=function(e,t){return l.Children.map(e,function(e){var r;if(!l.isValidElement(e))return e;var i=(null===(r=e.props)||void 0===r?void 0:r.children)?O(e.props.children,t):e.props.children,o=l.cloneElement(e,n(n({},e.props),{children:i}));return t(o)})},M=d(function(){return{mark:function(r){var i,o,a,l,c=r.children,d=e(r,["children"]),s=I.current,u=s.badgeMap,h=s.highlightBg,p=s.hideHighlightBg,g=s.suppressHighlightBg,f=d["data-badge-id"],v=f?u[f]:null,m=d["data-highlight-color"],b=null!==(l=null!==(o=null!=m?m:null===(i=null==v?void 0:v.style)||void 0===i?void 0:i.highlightBg)&&void 0!==o?o:null===(a=null==v?void 0:v.style)||void 0===a?void 0:a.badgeBg)&&void 0!==l?l:h,x="true"===d["data-is-suggested-deviation-fix"]||g;return t("span",n({style:n(n(n({},x?{}:{backgroundColor:b}),{borderRadius:"2px",display:"inline",boxDecorationBreak:"clone",WebkitBoxDecorationBreak:"clone",backgroundClip:"padding-box",padding:"0 1px"}),p?{color:"transparent"}:{})},{children:c}))},span:function(i){var a,l,c,d,s,p,g=i.children,f=e(i,["children"]),v=I.current.badgeMap,m=f["data-badge-id"];if(!m)return t("span",n({},f,{children:g}));var b=v[m];if(!b)return t("span",n({},f,{children:g}));var x="number"==typeof b.stackIndex?b.stackIndex:0,y="translateY(calc(-20% + ".concat(12*x,"px + var(--badge-nudge, 0px)))");return r(o,n({component:"span",sx:{position:"static",display:"inline"}},{children:[r(o,n({ref:b.badgeRef,className:"deviation-badge","data-side":b.side||"right",sx:n(n({fontStyle:"normal",position:"absolute",zIndex:30+x,display:"inline-flex",alignItems:"stretch",fontSize:"10px",bgcolor:(null===(a=b.style)||void 0===a?void 0:a.badgeBg)||"#EEF2FF",color:(null===(l=b.style)||void 0===l?void 0:l.badgeText)||u,border:"1px solid ".concat((null===(c=b.style)||void 0===c?void 0:c.badgeBorder)||"#C7D2FE"),borderRadius:"12px",fontWeight:600,whiteSpace:"nowrap",boxShadow:"0 1px 3px rgba(0,0,0,0.07)",overflow:"hidden",transition:"none"},"left"===b.side?{right:"-16px",transform:"".concat(y," translateX(calc(100% + 8px))")}:{left:"-16px",transform:"".concat(y," translateX(calc(-100% - 8px))")}),b.isConnected&&b.style&&{outline:"2px solid ".concat(b.style.badgeBorder),outlineOffset:"1px"})},{children:[r(o,n({onClick:function(n){n.stopPropagation(),b.onSummaryClick&&b.onSummaryClick(n)},sx:{display:"flex",alignItems:"center",px:1,py:.3,cursor:"pointer","&:hover":{bgcolor:"rgba(0,0,0,0.04)"}}},{children:[t(o,n({component:"span",sx:{fontSize:"10px",fontWeight:700}},{children:b.label})),("left"===b.side||b.isOrphan)&&t(o,n({component:"span",sx:{fontSize:"10px",pl:.5,ml:.5,borderLeft:"1px solid ".concat((null===(d=b.style)||void 0===d?void 0:d.badgeBorder)||"#C7D2FE")}},{children:null!=b.score&&"N/A"!==b.score&&"NA"!==b.score&&0!==b.score?"".concat(b.score):"N/A"===b.score||"NA"===b.score?"N/A":"Same"}))]})),("left"===b.side||b.isOrphan)&&t(o,n({onClick:function(n){n.stopPropagation(),b.onClick&&b.onClick(n)},sx:{display:"flex",alignItems:"center",px:.5,borderLeft:"1px solid ".concat((null===(s=b.style)||void 0===s?void 0:s.badgeBorder)||"#C7D2FE"),cursor:"pointer","&:hover":{bgcolor:"rgba(0,0,0,0.06)"}}},{children:t(h,{size:12,color:(null===(p=b.style)||void 0===p?void 0:p.badgeText)||"#3730A3"})}))]})),g]}))},table:function(e){var r=e.children;return t(o,n({component:"table",sx:{width:"100%",borderCollapse:"collapse",my:1,fontSize:"inherit"}},{children:r}))},thead:function(e){var r=e.children;return t(o,n({component:"thead"},{children:r}))},tbody:function(e){var r=e.children;return t(o,n({component:"tbody"},{children:r}))},tr:function(e){var r=e.children;return t(o,n({component:"tr",sx:{borderBottom:"1px solid #E5E7EB"}},{children:r}))},th:function(e){var r=e.children;return t(o,n({component:"th",sx:{border:"1px solid #E5E7EB",padding:"8px",textAlign:"left",fontWeight:600,backgroundColor:"#F9FAFB"}},{children:r}))},td:function(e){var r=e.children;return t(o,n({component:"td",sx:{border:"1px solid #E5E7EB",padding:"8px",verticalAlign:"top"}},{children:r}))},code:function(e){var r=e.children;return t("span",n({style:{fontFamily:"inherit",fontSize:"inherit"}},{children:r}))},pre:function(e){var r=e.children;return t("span",n({style:{fontFamily:"inherit",fontSize:"inherit",display:"block",whiteSpace:"pre-wrap"}},{children:r}))},updated:function(n){var e=n.children;return t(i,{children:e})},deleted:function(e){var r=e.children,i=O(r,function(n){return l.cloneElement(n,{"data-is-suggested-deviation-fix":"true"})});return t("span",n({style:{boxShadow:"inset 0 1px 0 #EF4444, inset 0 -1px 0 #EF4444",backgroundColor:"#FCCCCC",textDecoration:"line-through"}},{children:i}))},changed:function(e){var r=e.children,i=O(r,function(n){return l.cloneElement(n,{"data-is-suggested-deviation-fix":"true"})});return t("span",n({style:{boxShadow:"inset 0 1px 0 #2F59FF, inset 0 -1px 0 #2F59FF",backgroundColor:"#D5E8FF"}},{children:i}))},ul:function(r){var i=r.children,a=e(r,["children"]);return t(o,n({component:"ul",sx:{mt:1,mb:1,pl:3,listStyleType:"disc"}},a,{children:i}))},ol:function(r){var i=r.children,a=e(r,["children"]);return t(o,n({component:"ol",sx:{mt:1,mb:1,pl:3,listStyleType:"decimal"}},a,{children:i}))},li:function(r){var i=r.children,a=e(r,["children"]);return t(o,n({component:"li",sx:{mb:.5,display:"list-item"}},a,{children:i}))}}},[]),$=function(n){if(!n||"string"!=typeof n)return"";var e=n,t=(e=(e=(e=(e=(e=(e=(e=(e=e.replace(/((?:<\/?[a-z]+[^>]*>\s*)+)([*+\-] |\d+\. )/gi,"$2$1")).replace(/\\(['"])/g,"$1").replace(/\\n/g,"\n").replace(/\\\./g,".").replace(/\r\n/g,"\n")).replace(/^(\d+\.)(\s{2,})/gm,function(n,e,t){return"".concat(e.slice(0,-1),"\\.").concat(t)})).replace(/^(\d+\.)\s*\n+(\s+)(\S)/gm,function(n,e,t,r){return"".concat(e," ").concat(r)})).replace(/([^\n])\n(#{1,6} )/g,"$1\n\n$2")).replace(/([^\n])\n([ \t]*(?:[#*+\-] |\d+\. ))/g,"$1\n\n$2")).replace(/\n{3,}/g,"\n\n")).replace(/^[ \t]+(?![ \t]*([\*\-\+] |\d+\. ))/gm,function(n){return n.replace(/ /g," ").replace(/\t/g," ")})).split(/(\n{2,})/);return(e=t.map(function(n){return/^\n+$/.test(n)||/\|.*\|/.test(n)&&/\|[\s:|-]+\|/.test(n)||/^#{1,6} /.test(n.trimStart())?n:n.replace(/\n(?=[^\n])/g,function(e,t){var r=n.slice(t+1);return/^[ \t]*([#>|\-*+]|\d+\.)/.test(r)?"\n":" "})}).join("")).trim()},j=function(n){return n.replace(/[\.,;:]/g," ")},D=d(function(){return E.map(function(n){return{id:n.id,connected:n.isConnected,stackIndex:n.stackIndex,size:n.size}})},[E]),H=d(function(){var e=$(v||""),t=F?j(e):e,r=(E||[]).map(function(n){var e,t;return{id:null==n?void 0:n.id,highlight:$((null==n?void 0:n.highlight)||""),highlightColor:(null===(e=null==n?void 0:n.style)||void 0===e?void 0:e.highlightBg)||(null===(t=null==n?void 0:n.style)||void 0===t?void 0:t.badgeBg)||B}}).filter(function(n){return n.id&&n.highlight}),i={};r.forEach(function(n){i[n.highlight]||(i[n.highlight]=[]),i[n.highlight].push(n)});var o=function(n,e,t,r){void 0===e&&(e=""),void 0===r&&(r=[]);var i=!1,o=function(n){var o=function(n,e,t){var r,i,o;void 0===e&&(e="");var a=n.match(/^(\s*)([\s\S]*?)(\s*)$/);if(!a)return n;var l=null!==(r=a[1])&&void 0!==r?r:"",c=null!==(i=a[2])&&void 0!==i?i:"",d=null!==(o=a[3])&&void 0!==o?o:"";return c?l+function(n,e){void 0===n&&(n="");var t=e?' data-highlight-color="'.concat(e,'"'):"",r=n?' data-badge-id="'.concat(n,'"'):"";return"<mark".concat(r).concat(t,">")}(e,t)+c+"</mark>"+d:n}(n,e,t),a=o;if(!i&&r.length>0){i=!0;var l="",c="";r.forEach(function(n){l+=function(n){return'<span data-badge-id="'.concat(n,'">')}(n.id),c="</span>"+c}),a=l+o+c}return""+a};return n.split(/(\n+)/).map(function(n){return/^\n+$/.test(n)?n:n.trim()?""===n.replace(/[|:\-\s]/g,"")&&n.includes("-")?n:n.includes("|")?n.split(/(\|)/).map(function(n){return"|"!==n&&n.trim()?o(n):n}).join(""):o(n):n}).join("")},a=[];Object.entries(i).forEach(function(n){var r=n[0],i=n[1],o=e.indexOf(r),l=!1;if(-1===o&&F){var c=j(r);-1!==(o=t.indexOf(c))&&(l=!0)}if(-1!==o){for(var d=i[0].highlightColor,s=1;s<i.length;s++)d=g(d,i[s].highlightColor||"");a.push({highlight:r,start:o,end:o+r.length,badges:i,color:d,usedLooseMatch:l})}});var l=new Set(Object.keys(i));(S||[]).forEach(function(n){if(n){var r=$(n);if(r&&!l.has(r)){var i=e.indexOf(r),o=!1;if(-1===i&&F){var c=j(r);-1!==(i=t.indexOf(c))&&(o=!0)}if(-1!==i){var d=e.slice(0,i);(d.match(/</g)||[]).length===(d.match(/>/g)||[]).length&&a.push({highlight:r,start:i,end:i+r.length,badges:[],color:B||"",usedLooseMatch:o})}}}}),a.sort(function(n,e){return n.start-e.start||e.end-n.end});var c=[],d={};a.forEach(function(n,e){for(var t=n.start,r=n.end,i=0,o=c;i<o.length;i++){var a=o[i],l=a.start,s=a.end,u=t<s&&r>s&&t>=l,h=t<l&&r>l&&r<=s;if(t>=l&&r<=s){n.orphaned=!0,d[e]=a.matchIdx;break}u&&(t=s),h&&(r=l)}n.trimmedStart=t,n.trimmedEnd=r,!n.orphaned&&t<r&&c.push({start:t,end:r,matchIdx:e})});var s={};Object.entries(d).forEach(function(n){var e=n[0],t=n[1],r=Number(e);s[t]||(s[t]=[]),s[t].push(r)});var u=a.map(function(e,t){return n(n({},e),{idx:t})}).filter(function(n){return!n.orphaned}).sort(function(n,e){var t,r;return(null!==(t=e.trimmedStart)&&void 0!==t?t:e.start)-(null!==(r=n.trimmedStart)&&void 0!==r?r:n.start)});return u.forEach(function(n){var t,r,i,l,c=null!==(t=n.trimmedStart)&&void 0!==t?t:n.start,d=null!==(r=n.trimmedEnd)&&void 0!==r?r:n.end;if(!(c>=d)){var u=e.slice(c,d),h=function(n,e,t,r){if(!t.length)return n;var i=t.map(function(n){return a[n]}).sort(function(n,e){return n.start-e.start}),l="",c=0;return i.forEach(function(t){var i,a,d=Math.max(c,t.start-e),s=Math.max(d,t.end-e);if(!(d>=s)){var u=g(r,t.color||"");l+=n.slice(c,d),l+=o(n.slice(d,s),(null===(a=null===(i=t.badges)||void 0===i?void 0:i[0])||void 0===a?void 0:a.id)||"",u,t.badges||[]),c=s}}),l+=n.slice(c)}(n.usedLooseMatch||c!==n.start||d!==n.end?u:n.highlight,n.start,s[n.idx]||[],n.color),p=o(h,(null===(l=null===(i=n.badges)||void 0===i?void 0:i[0])||void 0===l?void 0:l.id)||"",n.color,n.badges||[]);e=e.slice(0,c)+p+e.slice(d)}}),e},[v,E,S,B,F]),N=d(function(){return m?$(m||""):""},[m]),R=!!m,P={"& *":{fontFamily:"inherit"},"& code, & pre, & kbd, & samp":{fontFamily:"inherit !important",fontSize:"inherit",background:"none",padding:0,border:"none",whiteSpace:"pre-wrap"},"& p, & li, & ul, & ol":{position:"static",overflow:"visible",whiteSpace:"pre-wrap"}},L=n(n(n(n({},x),P),{position:"relative",overflow:"visible",whiteSpace:"normal",gridArea:"1 / 1",zIndex:2}),R?{color:"transparent",userSelect:"none",pointerEvents:"none","& .deviation-badge":{pointerEvents:"auto"},"& table":{visibility:"hidden",margin:"0 !important"},"& th, & td":{padding:"0 !important",border:"none !important",backgroundColor:"transparent !important"},"& tr":{border:"none !important"},"& p:empty":{display:"none"}}:{}),q=n(n(n({},x),P),{position:"relative",overflow:"visible",whiteSpace:"normal",gridArea:"1 / 1",zIndex:1,pointerEvents:"auto"});return s(function(){if(A.current){var n=function(){var n=Array.from(A.current.querySelectorAll(".deviation-badge"));if(0!==n.length){n.forEach(function(n){n.style.setProperty("--badge-nudge","0px")});var e=n.filter(function(n){return"left"===n.dataset.side}),t=n.filter(function(n){return"left"!==n.dataset.side}),r=A.current.getBoundingClientRect(),i=r.bottom-4,o=r.top+4,a=function(n){if(0!==n.length){var e=n.map(function(n){var e=n.getBoundingClientRect();return{el:n,naturalTop:e.top,height:e.height,currentTop:e.top}});e.sort(function(n,e){return n.naturalTop-e.naturalTop});var t=[],r=[];e.forEach(function(n){if(0===r.length)r.push(n);else{var e=r[r.length-1],i=e.currentTop+e.height;n.naturalTop<i+8?(n.currentTop=i+8,r.push(n)):(t.push(r),r=[n])}}),r.length>0&&t.push(r),t.forEach(function(n){var e=n[n.length-1],t=e.currentTop+e.height;if(t>i){var r=t-i,a=n[0].currentTop-o,l=Math.max(0,Math.min(r,a));n.forEach(function(n){n.currentTop-=l})}}),t.flat().forEach(function(n){var e=n.currentTop-n.naturalTop;n.el.style.setProperty("--badge-nudge","".concat(e,"px"))})}};a(e),a(t)}},e=requestAnimationFrame(function(){requestAnimationFrame(function(){n()})}),t=new ResizeObserver(function(){requestAnimationFrame(n)});return t.observe(A.current),function(){t.disconnect(),cancelAnimationFrame(e)}}},[H,w,D]),r(o,n({ref:A,sx:{position:"relative",display:"grid"}},{children:[t(a,n({component:"div",sx:n(n({},L),{padding:"3px"})},{children:t(p,n({components:M,rehypePlugins:b},{children:H.replace(/#{3}/g,"")}))})),R&&t(a,n({component:"div",sx:q},{children:t(p,n({components:M,rehypePlugins:b},{children:N}))}))]}))},f);export{x as MemoizedMarkdown};
|
|
2
2
|
//# sourceMappingURL=memoizedMarkdown.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{__rest as r,__assign as n}from"tslib";import{jsx as t,Fragment as e}from"react/jsx-runtime";import{useRef as i,useMemo as c,useEffect as l}from"react";import o from"react-markdown";import a from"rehype-raw";import{sanitizeExternalUrl as h}from"./utils/citationData.utils.js";import u from"./GptWebCitation.module.css.js";var d=function(d){var f=d.content,s=d.activeHighlightIndex,v=d.onHighlightCountChange,m=i(null),g=c(function(){var r,n=f.match(/id=["']highlighted-\d+["']/g);if(null==n?void 0:n.length)return n.length;var t=f.match(/<a\b[^>]*>/gi);return null!==(r=null==t?void 0:t.length)&&void 0!==r?r:0},[f]),p=c(function(){return/id=["']highlighted-\d+["']/.test(f)},[f]);l(function(){null==v||v(g)},[g,v]),l(function(){var r;if(m.current){var n=m.current.querySelector("#highlighted-".concat(s));if(n)n.scrollIntoView({behavior:"smooth",block:"center"});else null===(r=m.current.querySelectorAll("a[href]")[s])||void 0===r||r.scrollIntoView({behavior:"smooth",block:"center"})}},[s,f]);var b=c(function(){var i=-1;return{span:function(e){e.node;var i=r(e,["node"]),c=i.id;if(null==c?void 0:c.startsWith("highlighted-")){var l=Number(c.replace("highlighted-",""))===s;return t("span",n({},i,{id:c,className:"".concat(u.highlight).concat(l?" ".concat(u.highlightActive):"")}))}return t("span",n({},i))},a:function(r){var c,l=r.children,o=r.href,a=r.title,d=r.className;if(!o)return t(e,{children:l});i+=1;var f=!p&&i===s,v=null!==(c=h(o))&&void 0!==c?c:"#";return t("a",n({href:v,title:a,target:"_blank",rel:"noreferrer",className:"".concat(u.citationLink).concat(f?" ".concat(u.citationLinkActive):"").concat(d?" ".concat(d):"")},{children:l}))},code:function(e){var i=e.children,c=r(e,["children"]);return t("code",n({},c,{children:i}))},ol:function(e){var i=e.children,c=r(e,["children"]);return t("ol",n({},c,{children:i}))},ul:function(e){var i=e.children,c=r(e,["children"]);return t("ul",n({},c,{children:i}))},li:function(e){var i=e.children,c=r(e,["children"]);return t("li",n({},c,{children:i}))},p:function(e){var i=e.children,c=r(e,["children"]);return t("p",n({},c,{children:i}))}}},[s,p,f]);return t("div",n({ref:m,className:u.markdownBody},{children:t(o,n({rehypePlugins:[a],components:b},{children:f}))}))};export{d as default};
|
|
2
|
+
//# sourceMappingURL=GptWebCitationMarkdown.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GptWebCitationMarkdown.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsxs as e,Fragment as t,jsx as o}from"react/jsx-runtime";import{useRef as r,useState as i,useEffect as
|
|
1
|
+
import{jsxs as e,Fragment as t,jsx as o}from"react/jsx-runtime";import{useRef as r,useState as i,useEffect as n}from"react";import{LexicalComposer as l}from"@lexical/react/LexicalComposer";import{HistoryPlugin as a}from"@lexical/react/LexicalHistoryPlugin";import{OnChangePlugin as s}from"@lexical/react/LexicalOnChangePlugin";import{TabIndentationPlugin as u}from"@lexical/react/LexicalTabIndentationPlugin";import{ListNode as m,ListItemNode as c}from"@lexical/list";import{ListPlugin as d}from"@lexical/react/LexicalListPlugin";import{LinkPlugin as p}from"@lexical/react/LexicalLinkPlugin";import{LinkNode as f}from"@lexical/link";import{QuoteNode as g,HeadingNode as x}from"@lexical/rich-text";import{TablePlugin as h}from"@lexical/react/LexicalTablePlugin";import{TableNode as C,TableRowNode as v,TableCellNode as y}from"@lexical/table";import{KEY_DOWN_COMMAND as S,$getSelection as b,$isRangeSelection as j,COMMAND_PRIORITY_CRITICAL as T,TextNode as E,$isTextNode as N}from"lexical";import"./components/EditorToolbar/components/ToolbarButton/ToolbarButton.css.js";import{useRequirementAI as B}from"../../RequirementAIWrapper/RequirementAIWrapper.js";import P from"./components/EditorContainer/EditorContainer.js";import L from"./components/EditorToolbar/EditorToolbar.js";import{LayoutPlugin as k}from"./plugins/LayoutPlugin.js";import I from"./theme/theme.js";import"./theme/theme.css.js";import"./Editor.css.js";import _ from"./components/Context/ContextMenu.js";import{MarkNode as H}from"@lexical/mark";import w from"./plugins/CommentPlugin/HTMLNode.js";import{DEFAULT_TOOLBAR_CONFIG as D}from"./constants/editorConfig.js";import{InitialHtml as M}from"./plugins/InitialHtml.js";import{InsertNode as R}from"./plugins/InsertNode.js";import{DeleteNode as A}from"./plugins/DeleteNode.js";import{HighlightSpanNode as F,HighlightButtonNode as W}from"./plugins/HighlightNode.js";import{useLexicalComposerContext as q}from"@lexical/react/LexicalComposerContext";import{UpdateNode as O}from"./plugins/UpdateNode.js";import{ManualNode as V}from"./plugins/ManualNode.js";import{PreservedNode as U}from"./plugins/PreservedNode.js";import{InvisibleNode as X}from"./plugins/InvisibleNode.js";function Y(e){console.log(e)}function $({onEditBlocked:e}){const[t]=q();return n(()=>{const o=e=>{let t=e;for(;t;){if(["preserved","insert","delete"].includes(t.getType()))return t;if(["update","manual"].includes(t.getType())&&t.getStatus()&&"pending"===t.getStatus())return t;t=t.getParent()}return!1};function r(e){let t=e;for(;t;){if((t instanceof O||t instanceof V)&&"pending"===t.getStatus())return t.getId();t=t.getParent()}return null}return t.registerCommand(S,t=>{const i=b();if(!j(i))return!1;const n=i.getNodes().find(e=>!!o(e));if(n)return t.preventDefault(),null==e||e(r(n)||""),!0;if(i.isCollapsed()){const n=i.anchor.getNode(),l=o(n);if(l){const o=l?r(l):"";return null==e||e(o||""),t.preventDefault(),!0}if("Backspace"===t.key){const o=n.getPreviousSibling(),l=o&&(["delete","insert","preserved"].includes(o.getType())||["update","manual"].includes(o.getType())&&o.getStatus()&&"pending"===o.getStatus())?o:null;if(0===i.anchor.offset&&l)return null==e||e(r(l)||""),t.preventDefault(),!0}else if("Delete"===t.key){const o=n.getNextSibling(),l=o&&(["delete","insert","preserved"].includes(o.getType())||["update","manual"].includes(o.getType())&&o.getStatus()&&"pending"===o.getStatus())?o:null,a=n.getTextContent().length;if(i.anchor.offset===a&&l)return null==e||e(r(l)||""),t.preventDefault(),!0}}return!1},T)},[t]),null}function z({minHeight:n,height:S,placeholder:T,onFocus:q,onBlur:z,onChange:G,onToolbarButtonClick:J,toolbarConfig:K=D,editorRef:Q,editorState:Z,initialString:ee,customToolbar:te,plugins:oe,nodes:re,dynamicHeight:ie,artifactContext:ne,commentsPanelState:le,mode:ae,doNotShowBorderInViewMode:se,onEditBlocked:ue}){var me,ce,de;const pe=r(null),fe={namespace:"MyEditor",theme:I,onError:Y,nodes:[E,m,c,f,g,x,C,v,y,H,w,R,A,O,U,V,X,F,W],editorState:Z},[ge,xe]=i(null),[he,Ce]=i(!1),{customStyles:ve}=B(),ye=e=>{var t;null===(t=Q.current)||void 0===t||t.update(()=>{const t=b();j(t)&&t.getNodes().forEach(t=>{N(t)&&t.setStyle(`color: ${e}`)})})};return document.getElementById("lexical_editor_wrapper"),e(t,{children:[(null===(me=null==ve?void 0:ve.textEditorStyles)||void 0===me?void 0:me.themeStyles)&&o("style",{children:null===(ce=null==ve?void 0:ve.textEditorStyles)||void 0===ce?void 0:ce.themeStyles}),e("div",{ref:pe,className:"w-full lexical_editor_wrapper "+(se&&"readOnly"===ae?"":"lexical_editor_wrapper_box"),id:"lexical_editor_wrapper",onContextMenu:e=>{var t;e.preventDefault(),null===(t=Q.current)||void 0===t||t.update(()=>{const t=b();j(t)&&!t.isCollapsed()?(Ce(!0),xe({x:e.clientX,y:e.clientY})):(Ce(!1),xe(null))})},style:{minHeight:n,height:S,...null===(de=null==ve?void 0:ve.textEditorStyles)||void 0===de?void 0:de.textArea},children:[e(l,{initialConfig:fe,children:[" ","edit"===ae&&o($,{onEditBlocked:ue}),"edit"===ae&&o(L,{onToolbarButtonClick:J,editorWrapperRef:pe,toolbarConfig:K,customToolbar:te,editorRef:Q}),o(P,{placeholder:T}),o(u,{}),o(a,{}),o(d,{}),o(p,{}),o(h,{}),o(k,{onFocus:q,onBlur:z,editorRef:Q}),o(s,{ignoreSelectionChange:!0,ignoreHistoryMergeTagChange:!0,onChange:(e,t,o)=>{G&&G(e,t,o)}}),ee&&o(M,{initialValue:ee.value,initialFormat:ee.type,mode:ae}),oe&&oe]}),ge&&he&&"edit"===ae&&o(_,{position:ge,options:[{label:"Change Color to Red",action:()=>ye("red")},{label:"Change Color to Blue",action:()=>ye("blue")}],onClose:()=>{xe(null)}})]})]})}export{z as default};
|
|
2
2
|
//# sourceMappingURL=Editor.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{ElementNode as t}from"lexical";class s extends t{static getType(){return"manual"}static clone(t){return new s(t.__id,t.__status,t.__key)}constructor(t=crypto.randomUUID(),s="",e){super(e),this.__id=t,this.__status=s}getId(){return this.getLatest().__id}getStatus(){return this.getLatest().__status}setStatus(t){this.getWritable().__status=t}createDOM(){const t=document.createElement("manual");return t.dataset.id=this.__id,t.className=`PlaygroundEditorTheme__manual-node-${this.__status}`,this.__status&&(t.dataset.status=this.__status),t.contentEditable="pending"===this.__status?"false":"true",t}exportDOM(){const t=document.createElement("manual");return t.id=this.__id,{element:t}}updateDOM(t,s){return t.__id!==this.__id&&(s.dataset.id=this.__id),t.__status!==this.__status&&(this.__status?s.dataset.status=this.__status:delete s.dataset.status,s.contentEditable="pending"===this.__status?"false":"true"),!1}static importDOM(){return{manual:()=>({conversion:e,priority:1})}}static importJSON(t){var e;return new s(t.id,null!==(e=t.status)&&void 0!==e?e:"")}exportJSON(){return{...super.exportJSON(),type:"manual",version:1,id:this.__id,status:this.__status}}
|
|
1
|
+
import{ElementNode as t}from"lexical";class s extends t{static getType(){return"manual"}static clone(t){return new s(t.__id,t.__status,t.__key)}constructor(t=crypto.randomUUID(),s="",e){super(e),this.__id=t,this.__status=s}getId(){return this.getLatest().__id}getStatus(){return this.getLatest().__status}setStatus(t){this.getWritable().__status=t}createDOM(){const t=document.createElement("manual");return t.dataset.id=this.__id,t.className=`PlaygroundEditorTheme__manual-node-${this.__status}`,this.__status&&(t.dataset.status=this.__status),t.contentEditable="pending"===this.__status?"false":"true",t}exportDOM(){const t=document.createElement("manual");return t.id=this.__id,t.dataset.status=this.__status,{element:t}}updateDOM(t,s){return t.__id!==this.__id&&(s.dataset.id=this.__id),t.__status!==this.__status&&(this.__status?s.dataset.status=this.__status:delete s.dataset.status,s.contentEditable="pending"===this.__status?"false":"true"),!1}static importDOM(){return{manual:()=>({conversion:e,priority:1})}}static importJSON(t){var e;return new s(t.id,null!==(e=t.status)&&void 0!==e?e:"")}exportJSON(){return{...super.exportJSON(),type:"manual",version:1,id:this.__id,status:this.__status}}canInsertTextBefore(){return"pending"!==this.__status}canInsertTextAfter(){return"pending"!==this.__status}}function e(t){var e;return{node:new s(t.id||crypto.randomUUID(),null!==(e=t.dataset.status)&&void 0!==e?e:"")}}export{s as ManualNode};
|
|
2
2
|
//# sourceMappingURL=ManualNode.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{ElementNode as t}from"lexical";class s extends t{static getType(){return"update"}static clone(t){return new s(t.__id,t.__status,t.__key)}constructor(t=crypto.randomUUID(),s="",e){super(e),this.__id=t,this.__status=s}getId(){return this.getLatest().__id}getStatus(){return this.getLatest().__status}setStatus(t){this.getWritable().__status=t}createDOM(){const t=document.createElement("upt");return t.dataset.id=this.__id,t.className=`PlaygroundEditorTheme__update-node-${this.__status}`,this.__status&&(t.dataset.status=this.__status),t.contentEditable="pending"===this.__status?"false":"true",t}exportDOM(){const t=document.createElement("upt");return t.id=this.__id,{element:t}}updateDOM(t,s){return t.__id!==this.__id&&(s.dataset.id=this.__id),t.__status!==this.__status&&(this.__status?s.dataset.status=this.__status:delete s.dataset.status,s.contentEditable="pending"===this.__status?"false":"true"),!1}static importDOM(){return{upt:()=>({conversion:e,priority:1})}}static importJSON(t){var e;return new s(t.id,null!==(e=t.status)&&void 0!==e?e:"")}exportJSON(){return{...super.exportJSON(),type:"update",version:1,id:this.__id,status:this.__status}}
|
|
1
|
+
import{ElementNode as t}from"lexical";class s extends t{static getType(){return"update"}static clone(t){return new s(t.__id,t.__status,t.__key)}constructor(t=crypto.randomUUID(),s="",e){super(e),this.__id=t,this.__status=s}getId(){return this.getLatest().__id}getStatus(){return this.getLatest().__status}setStatus(t){this.getWritable().__status=t}createDOM(){const t=document.createElement("upt");return t.dataset.id=this.__id,t.className=`PlaygroundEditorTheme__update-node-${this.__status}`,this.__status&&(t.dataset.status=this.__status),t.contentEditable="pending"===this.__status?"false":"true",t}exportDOM(){const t=document.createElement("upt");return t.id=this.__id,t.dataset.status=this.__status,{element:t}}updateDOM(t,s){return t.__id!==this.__id&&(s.dataset.id=this.__id),t.__status!==this.__status&&(this.__status?s.dataset.status=this.__status:delete s.dataset.status,s.contentEditable="pending"===this.__status?"false":"true"),!1}static importDOM(){return{upt:()=>({conversion:e,priority:1})}}static importJSON(t){var e;return new s(t.id,null!==(e=t.status)&&void 0!==e?e:"")}exportJSON(){return{...super.exportJSON(),type:"update",version:1,id:this.__id,status:this.__status}}canInsertTextBefore(){return"pending"!==this.__status}canInsertTextAfter(){return"pending"!==this.__status}}function e(t){var e;return{node:new s(t.id||crypto.randomUUID(),null!==(e=t.dataset.status)&&void 0!==e?e:"")}}export{s as UpdateNode};
|
|
2
2
|
//# sourceMappingURL=UpdateNode.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var e='.PlaygroundEditorTheme__ltr{text-align:left}.PlaygroundEditorTheme__rtl{text-align:right}.PlaygroundEditorTheme__paragraph{font-family:Inter,sans-serif;line-height:28px;margin:0 0 8px;position:relative}.PlaygroundEditorTheme__paragraph:last-child{margin-bottom:0}.PlaygroundEditorTheme__quote{border-left:4px solid #ced0d4;color:#65676b;font-size:15px;margin:0 0 10px 20px;padding-left:16px}.PlaygroundEditorTheme__h1{font-family:Inter,sans-serif;font-size:24px;margin:12px 0 4px;padding:0}.PlaygroundEditorTheme__h2{font-size:20px}.PlaygroundEditorTheme__h2,.PlaygroundEditorTheme__h3{font-family:Inter,sans-serif;margin:10px 0 0;padding:0}.PlaygroundEditorTheme__h3{font-size:18px;text-transform:uppercase}.PlaygroundEditorTheme__textBold{font-family:Inter,sans-serif;font-weight:700}.PlaygroundEditorTheme__textItalic{font-style:italic}.PlaygroundEditorTheme__textUnderline{text-decoration:underline}.PlaygroundEditorTheme__textStrikethrough{text-decoration:line-through}.PlaygroundEditorTheme__textUnderlineStrikethrough{text-decoration:underline line-through}.PlaygroundEditorTheme__textSubscript{font-size:.8em;vertical-align:sub!important}.PlaygroundEditorTheme__textSuperscript{font-size:.8em;vertical-align:super}.PlaygroundEditorTheme__textCode{background-color:#f0f2f5;font-family:Menlo,Consolas,Monaco,monospace;font-size:94%;padding:1px .25rem}.PlaygroundEditorTheme__hashtag{background-color:#5890ff26;border-bottom:1px solid #5890ff4d}.PlaygroundEditorTheme__link{color:#216fdb;text-decoration:none}.PlaygroundEditorTheme__link:hover{text-decoration:underline}.PlaygroundEditorTheme__code{background-color:#f0f2f5;display:block;font-family:Menlo,Consolas,Monaco,monospace;font-size:13px;line-height:1.53;margin:8px 0;overflow-x:auto;padding:8px 8px 8px 52px;position:relative;tab-size:2}.PlaygroundEditorTheme__code:before{background-color:#eee;border-right:1px solid #ccc;color:#777;content:attr(data-gutter);left:0;min-width:25px;padding:8px;position:absolute;text-align:right;top:0;white-space:pre-wrap}.PlaygroundEditorTheme__code:after{color:#00000080;content:attr(data-highlight-language);font-size:10px;padding:3px;position:absolute;right:3px;text-transform:uppercase;top:0}.PlaygroundEditorTheme__table{border-collapse:collapse;border-spacing:0;max-width:100%;overflow-y:scroll;table-layout:fixed;width:100%}.PlaygroundEditorTheme__tableCell{border:1px solid #000;min-width:75px;padding:6px 8px;text-align:start;vertical-align:top}.PlaygroundEditorTheme__tableCellHeader{background-color:#f2f3f5;text-align:start}.PlaygroundEditorTheme__characterLimit{background-color:#fbb!important;display:inline}.PlaygroundEditorTheme__ul{list-style-type:disc}.PlaygroundEditorTheme__ol1,.PlaygroundEditorTheme__ul{list-style-position:outside;margin:0 0 0 24px;padding:0}.PlaygroundEditorTheme__ol1{list-style-type:decimal}.PlaygroundEditorTheme__ol2{list-style-position:outside;list-style-type:upper-alpha;margin:0 0 0 24px;padding:0}.PlaygroundEditorTheme__ol3{list-style-position:outside;list-style-type:lower-alpha;margin:0 0 0 24px;padding:0}.PlaygroundEditorTheme__ol4{list-style-position:outside;list-style-type:upper-roman;margin:0 0 0 24px;padding:0}.PlaygroundEditorTheme__ol5{list-style-position:outside;list-style-type:lower-roman;margin:0 0 0 24px;padding:0}.PlaygroundEditorTheme__listItem{display:list-item;margin:8px 24px 8px 8px;padding:0 8px}.PlaygroundEditorTheme__nestedListItem{list-style-type:inherit;margin-left:16px}ol .PlaygroundEditorTheme__nestedListItem{list-style-type:none}.PlaygroundEditorTheme__listItemChecked,.PlaygroundEditorTheme__listItemUnchecked{list-style-type:none;margin-left:8px;margin-right:8px;outline:none;padding-left:24px;padding-right:24px;position:relative}.PlaygroundEditorTheme__listItemChecked{text-decoration:line-through}.PlaygroundEditorTheme__listItemChecked:before,.PlaygroundEditorTheme__listItemUnchecked:before{background-size:cover;content:"";cursor:pointer;display:block;height:16px;left:0;position:absolute;top:2px;width:16px}.PlaygroundEditorTheme__listItemChecked[dir=rtl]:before,.PlaygroundEditorTheme__listItemUnchecked[dir=rtl]:before{left:auto;right:0}.PlaygroundEditorTheme__listItemChecked:focus:before,.PlaygroundEditorTheme__listItemUnchecked:focus:before{border-radius:2px;box-shadow:0 0 0 2px #a6cdfe}.PlaygroundEditorTheme__tokenComment{color:#708090}.PlaygroundEditorTheme__tokenPunctuation{color:#999}.PlaygroundEditorTheme__tokenProperty{color:#905}.PlaygroundEditorTheme__tokenSelector{color:#690}.PlaygroundEditorTheme__tokenOperator{color:#9a6e3a}.PlaygroundEditorTheme__tokenAttr{color:#07a}.PlaygroundEditorTheme__tokenVariable{color:#e90}.PlaygroundEditorTheme__tokenFunction{color:#dd4a68}.PlaygroundEditorTheme__mark{background:#ffd40024;border-bottom:2px solid #ffd4004d;padding-bottom:2px}.PlaygroundEditorTheme__markOverlap{background:#ffd4004d;border-bottom:2px solid #ffd400b3}.PlaygroundEditorTheme__mark.selected{background:#ffd40080;border-bottom:2px solid #ffd400}.PlaygroundEditorTheme__markOverlap.selected{background:#ffd400b3;border-bottom:2px solid #ffd400b3}.PlaygroundEditorTheme__embedBlock{user-select:none}.PlaygroundEditorTheme__embedBlockFocus{outline:2px solid #3c84f4}.PlaygroundEditorTheme__highlight-button{display:none}.PlaygroundEditorTheme__insert-node{background-color:#8cbeff;text-decoration:none}.PlaygroundEditorTheme__delete-node{text-decoration:line-through;text-decoration-color:#dc2626}[class^=PlaygroundEditorTheme__update-node]>.PlaygroundEditorTheme__insert-node{background-color:#f3e8ff}.PlaygroundEditorTheme__manual-node-accepted,[class^=PlaygroundEditorTheme__manual-node]>.PlaygroundEditorTheme__insert-node{background-color:#8cbeff}.PlaygroundEditorTheme__manual-node-rejected{text-decoration:underline;text-decoration-color:red}.PlaygroundEditorTheme__update-node-accepted{background-color:#f3e8ff;-webkit-box-decoration-break:clone;box-decoration-break:clone;display:inline}';!function(){if("undefined"==typeof document)return;const o=document.createElement("style");o.type="text/css";const t=window.__CSP_NONCE__||document.querySelector('meta[name="csp-nonce"]')?.content;t&&o.setAttribute("nonce",t),o.appendChild(document.createTextNode(e));const r=document.head||document.getElementsByTagName("head")[0]||document.documentElement;r&&r.appendChild(o)}();export{e as default};
|
|
1
|
+
var e='.PlaygroundEditorTheme__ltr{text-align:left}.PlaygroundEditorTheme__rtl{text-align:right}.PlaygroundEditorTheme__paragraph{font-family:Inter,sans-serif;line-height:28px;margin:0 0 8px;position:relative}.PlaygroundEditorTheme__paragraph:last-child{margin-bottom:0}.PlaygroundEditorTheme__quote{border-left:4px solid #ced0d4;color:#65676b;font-size:15px;margin:0 0 10px 20px;padding-left:16px}.PlaygroundEditorTheme__h1{font-family:Inter,sans-serif;font-size:24px;margin:12px 0 4px;padding:0}.PlaygroundEditorTheme__h2{font-size:20px}.PlaygroundEditorTheme__h2,.PlaygroundEditorTheme__h3{font-family:Inter,sans-serif;margin:10px 0 0;padding:0}.PlaygroundEditorTheme__h3{font-size:18px;text-transform:uppercase}.PlaygroundEditorTheme__textBold{font-family:Inter,sans-serif;font-weight:700}.PlaygroundEditorTheme__textItalic{font-style:italic}.PlaygroundEditorTheme__textUnderline{text-decoration:underline}.PlaygroundEditorTheme__textStrikethrough{text-decoration:line-through}.PlaygroundEditorTheme__textUnderlineStrikethrough{text-decoration:underline line-through}.PlaygroundEditorTheme__textSubscript{font-size:.8em;vertical-align:sub!important}.PlaygroundEditorTheme__textSuperscript{font-size:.8em;vertical-align:super}.PlaygroundEditorTheme__textCode{background-color:#f0f2f5;font-family:Menlo,Consolas,Monaco,monospace;font-size:94%;padding:1px .25rem}.PlaygroundEditorTheme__hashtag{background-color:#5890ff26;border-bottom:1px solid #5890ff4d}.PlaygroundEditorTheme__link{color:#216fdb;text-decoration:none}.PlaygroundEditorTheme__link:hover{text-decoration:underline}.PlaygroundEditorTheme__code{background-color:#f0f2f5;display:block;font-family:Menlo,Consolas,Monaco,monospace;font-size:13px;line-height:1.53;margin:8px 0;overflow-x:auto;padding:8px 8px 8px 52px;position:relative;tab-size:2}.PlaygroundEditorTheme__code:before{background-color:#eee;border-right:1px solid #ccc;color:#777;content:attr(data-gutter);left:0;min-width:25px;padding:8px;position:absolute;text-align:right;top:0;white-space:pre-wrap}.PlaygroundEditorTheme__code:after{color:#00000080;content:attr(data-highlight-language);font-size:10px;padding:3px;position:absolute;right:3px;text-transform:uppercase;top:0}.PlaygroundEditorTheme__table{border-collapse:collapse;border-spacing:0;max-width:100%;overflow-y:scroll;table-layout:fixed;width:100%}.PlaygroundEditorTheme__tableCell{border:1px solid #000;min-width:75px;padding:6px 8px;text-align:start;vertical-align:top}.PlaygroundEditorTheme__tableCellHeader{background-color:#f2f3f5;text-align:start}.PlaygroundEditorTheme__characterLimit{background-color:#fbb!important;display:inline}.PlaygroundEditorTheme__ul{list-style-type:disc}.PlaygroundEditorTheme__ol1,.PlaygroundEditorTheme__ul{list-style-position:outside;margin:0 0 0 24px;padding:0}.PlaygroundEditorTheme__ol1{list-style-type:decimal}.PlaygroundEditorTheme__ol2{list-style-position:outside;list-style-type:upper-alpha;margin:0 0 0 24px;padding:0}.PlaygroundEditorTheme__ol3{list-style-position:outside;list-style-type:lower-alpha;margin:0 0 0 24px;padding:0}.PlaygroundEditorTheme__ol4{list-style-position:outside;list-style-type:upper-roman;margin:0 0 0 24px;padding:0}.PlaygroundEditorTheme__ol5{list-style-position:outside;list-style-type:lower-roman;margin:0 0 0 24px;padding:0}.PlaygroundEditorTheme__listItem{display:list-item;margin:8px 24px 8px 8px;padding:0 8px}.PlaygroundEditorTheme__nestedListItem{list-style-type:inherit;margin-left:16px}ol .PlaygroundEditorTheme__nestedListItem{list-style-type:none}.PlaygroundEditorTheme__listItemChecked,.PlaygroundEditorTheme__listItemUnchecked{list-style-type:none;margin-left:8px;margin-right:8px;outline:none;padding-left:24px;padding-right:24px;position:relative}.PlaygroundEditorTheme__listItemChecked{text-decoration:line-through}.PlaygroundEditorTheme__listItemChecked:before,.PlaygroundEditorTheme__listItemUnchecked:before{background-size:cover;content:"";cursor:pointer;display:block;height:16px;left:0;position:absolute;top:2px;width:16px}.PlaygroundEditorTheme__listItemChecked[dir=rtl]:before,.PlaygroundEditorTheme__listItemUnchecked[dir=rtl]:before{left:auto;right:0}.PlaygroundEditorTheme__listItemChecked:focus:before,.PlaygroundEditorTheme__listItemUnchecked:focus:before{border-radius:2px;box-shadow:0 0 0 2px #a6cdfe}.PlaygroundEditorTheme__tokenComment{color:#708090}.PlaygroundEditorTheme__tokenPunctuation{color:#999}.PlaygroundEditorTheme__tokenProperty{color:#905}.PlaygroundEditorTheme__tokenSelector{color:#690}.PlaygroundEditorTheme__tokenOperator{color:#9a6e3a}.PlaygroundEditorTheme__tokenAttr{color:#07a}.PlaygroundEditorTheme__tokenVariable{color:#e90}.PlaygroundEditorTheme__tokenFunction{color:#dd4a68}.PlaygroundEditorTheme__mark{background:#ffd40024;border-bottom:2px solid #ffd4004d;padding-bottom:2px}.PlaygroundEditorTheme__markOverlap{background:#ffd4004d;border-bottom:2px solid #ffd400b3}.PlaygroundEditorTheme__mark.selected{background:#ffd40080;border-bottom:2px solid #ffd400}.PlaygroundEditorTheme__markOverlap.selected{background:#ffd400b3;border-bottom:2px solid #ffd400b3}.PlaygroundEditorTheme__embedBlock{user-select:none}.PlaygroundEditorTheme__embedBlockFocus{outline:2px solid #3c84f4}.PlaygroundEditorTheme__highlight-button{display:none}.PlaygroundEditorTheme__insert-node{background-color:#8cbeff;text-decoration:none}.PlaygroundEditorTheme__delete-node{background-color:#fff;text-decoration:line-through;text-decoration-color:#dc2626}[class^=PlaygroundEditorTheme__update-node]>.PlaygroundEditorTheme__insert-node{background-color:#f3e8ff}.PlaygroundEditorTheme__manual-node-accepted,[class^=PlaygroundEditorTheme__manual-node]>.PlaygroundEditorTheme__insert-node{background-color:#8cbeff}.PlaygroundEditorTheme__manual-node-rejected{background-color:#fff;text-decoration:underline;text-decoration-color:red}.PlaygroundEditorTheme__update-node-accepted{background-color:#f3e8ff;-webkit-box-decoration-break:clone;box-decoration-break:clone;display:inline}';!function(){if("undefined"==typeof document)return;const o=document.createElement("style");o.type="text/css";const t=window.__CSP_NONCE__||document.querySelector('meta[name="csp-nonce"]')?.content;t&&o.setAttribute("nonce",t),o.appendChild(document.createTextNode(e));const r=document.head||document.getElementsByTagName("head")[0]||document.documentElement;r&&r.appendChild(o)}();export{e as default};
|
|
2
2
|
//# sourceMappingURL=theme.css.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsxs as e,jsx as t}from"react/jsx-runtime";import{forwardRef as r,useRef as n,useState as o,useEffect as a,useImperativeHandle as
|
|
1
|
+
import{jsxs as e,jsx as t}from"react/jsx-runtime";import{forwardRef as r,useRef as n,useState as o,useEffect as a,useImperativeHandle as l}from"react";import{DEFAULT_TOOLBAR_CONFIG as i}from"./Editor/constants/editorConfig.js";import c from"./Editor/Editor.js";import{useRefStore as s}from"../../store/ref.context.js";import{$generateHtmlFromNodes as u}from"@lexical/html";import d from"turndown";import{tables as h}from"turndown-plugin-gfm";import{UnsavedChangesPopup as p}from"../UnsavedChangesPopup/UnsavedChangesPopup.js";import{mergeTagAcrossParagraphs as m,unescapeTagIds as g}from"../../../../utils/tagHelper.js";const f=new d({headingStyle:"atx",codeBlockStyle:"fenced"});f.keep(["ins","del","mark"]),f.keep(e=>{var t,r;return"A"===e.nodeName&&null!==(r=null===(t=e.getAttribute("href"))||void 0===t?void 0:t.includes("ai_reasoning$"))&&void 0!==r&&r}),f.keep(e=>"SPAN"===e.nodeName&&e.hasAttribute("highlight-id")),f.addRule("md-table-passthrough",{filter:e=>"PRE"===e.nodeName&&"true"===e.getAttribute("data-md-table"),replacement:(e,t)=>t.textContent||""}),f.use(h);const E=e=>(e||"").replace(/\r\n/g,"\n").trim(),v=r(({type:r,value:d,handleUpdateState:h,onBlur:v,placeholder:A,minHeight:S,height:$,mode:y,doNotShowBorderInViewMode:w,onEditBlocked:b,onSaveUnsavedChanges:x,onDiscardUnsavedChanges:C,isSavingUnsavedChanges:N=!1},B)=>{const T=n(null),[L,q]=o({type:r,value:d}),[H,I]=o(0),[R,_]=o(!1),j=n(d),k=n(d),M=n(Boolean(d)),{contentRef:U,setContentRef:V}=s();a(()=>{q(e=>({...e,value:d})),j.current=d,k.current=d,M.current=Boolean(d),_(!1)},[d]),l(B,()=>({requestClose:()=>!("edit"===y&&E(j.current)!==E(k.current))||(_(!0),!1)}),[y]);return a(()=>{const e=()=>{U&&U.current&&I(U.current.clientHeight-60)};return e(),window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[U]),e("div",{style:{position:"relative",width:"100%",height:$,minHeight:S},children:[R&&t(p,{isSaving:N,onSave:async()=>{await(null==x?void 0:x()),j.current=k.current,_(!1)},onDiscard:()=>{k.current=j.current,null==C||C(),_(!1)}}),t(c,{minHeight:S,height:$,placeholder:A||"Enter some text...",onChange:(e,t)=>{e.read(()=>{const e=u(t,null),r=(new DOMParser).parseFromString(e,"text/html");r.querySelectorAll("span").forEach(e=>{const t=e.getAttribute("style")||"";t.includes("background-color")&&t.includes("rgb(219, 234, 254)")&&e.setAttribute("data-review","insert"),t.includes("text-decoration")&&t.includes("line-through")&&e.setAttribute("data-review","delete")}),r.querySelectorAll("strong code").forEach(e=>{const t=e.parentElement;t&&t.replaceChild(document.createTextNode(e.textContent||""),e)}),r.querySelectorAll("code strong").forEach(e=>{const t=e.parentElement;t&&t.replaceChild(document.createTextNode(e.textContent||""),e)}),r.querySelectorAll('a[href*="ai_reasoning$"]').forEach(e=>{const t=e.getAttribute("href")||"";e.setAttribute("href",t.replace(/^https?:\/\//,""))});const n=["upt","manual","ins","del","preserved"];function o(e,t){const r=e.cloneNode(!0),a=new Map;r.querySelectorAll(n.join(",")).forEach(e=>{if(e===r)return;const n=`%%NESTED${a.size}%%`;a.set(n,o(e,t)),e.replaceWith(n)});let l=t.turndown(r.innerHTML);a.forEach((e,t)=>{l=l.replace(t,e)});const i=Array.from(e.attributes).map(e=>`${e.name}="${e.value}"`).join(" "),c=e.tagName.toLowerCase();return i?`<${c} ${i}>${l}</${c}>`:`<${c}>${l}</${c}>`}r.querySelectorAll('a[href*="ai_reasoning$"]').forEach(e=>{const t=e.getAttribute("href")||"";e.setAttribute("href",t.replace(/^https?:\/\//,""))});const a=[];r.querySelectorAll("invisible").forEach((e,t)=>{a.push(e.outerHTML),e.replaceWith(r.createTextNode(`%%INVISIBLE_${t}%%`))});const l=[];["manual","upt"].forEach(e=>{r.querySelectorAll(e).forEach((e,t)=>{l.push(o(e,f)),e.replaceWith(r.createTextNode(`%%REVIEW_${l.length-1}%%`))})});const i=[];r.querySelectorAll("table").forEach((e,t)=>{i.push(e.outerHTML);const n=r.createElement("p");n.textContent=`%%TABLE_${t}%%`,e.replaceWith(n)});let c=f.turndown(r.body.innerHTML);for(let e=l.length-1;e>=0;e--)c=c.replace(`%%REVIEW\\_${e}%%`,` ${l[e]} `);a.forEach((e,t)=>{c=c.replace(new RegExp(`%%INVISIBLE\\\\*_${t}%%`,"g"),` ${e} `)}),i.forEach((e,t)=>{c=c.replace(`%%TABLE\\_${t}%%`,`\n\n${e}\n\n`)}),c=c.replace(/\*{4}([^*]+)\*{4}/g,"**$1**");["upt","manual","del","ins","preserved"].forEach(e=>{c=m(c,e)}),c=g(c,["manual","upt"]),M.current&&(j.current=c,M.current=!1),k.current=c,((e,t)=>{h(e,t)})("prompt",c)})},toolbarConfig:i,editorRef:T,mode:y,initialString:{type:L.type,value:L.value},dynamicHeight:H,onBlur:v,doNotShowBorderInViewMode:w||!1,onEditBlocked:b})]})});v.displayName="RichTextEditor";export{v as default};
|
|
2
2
|
//# sourceMappingURL=RichTextEditor.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsxs as e,jsx as i,Fragment as
|
|
1
|
+
import{jsxs as e,jsx as i,Fragment as a}from"react/jsx-runtime";import c,{memo as n,useMemo as t}from"react";import l from"../Popups/PopupDefaults.js";import r from"react-markdown";import d from"rehype-raw";import s from"./CitationComponent.module.css.js";import{ChevronUp as o}from"lucide-react";import{ReactComponent as m}from"../icons/cognitiveBrain.svg.js";import{ReactComponent as p}from"../icons/aiMagic.svg.js";import _ from"./CitationAnchor.js";import{resolveRedline as h}from"../../../../../service/redlineService.js";import{useRequirementAI as v}from"../../RequirementAIWrapper/RequirementAIWrapper.js";const u=({text:e,item:a})=>i(r,{rehypePlugins:[d],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:n})=>i(_,{href:c,children:n,metaData:{citations:a.citations,docData:a.docData}})},children:e.replace(/<br\s*\/?>/gi,"\n")});var N=n(function({item:n,title:r="Cognitive Decisioning AI",relevanceScore:d=0,showRelevanceScore:_=!0,reason:N="No reasoning provided.",impact:b="No Impact provided.",explaination:y="No explaination provided.",gap:f="None",onClose:g=()=>{},onActionTrigger:x,showResolveBtns:I=!1,sections:C,leftIcon:A,scoreIcon:k,className:R,customStyles:j={},actions:B,disableAllActions:D=!1,actionBtnDisabledStyle:H={},onBackClick:$,isImpactNeeded:T=!0,cognitiveTitle:w="Cognitive Integrity",labels:L={},redlineId:S,aiReasonId:P}){const E=t(()=>{const e=Number(d);return Number.isNaN(e)?0:Math.max(0,Math.min(100,Math.round(e)))},[d]),M=t(()=>{const e=L&&L.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]),q=L&&L.impact||"Impact",G=L&&L.explanation||"Explaination",F=L&&L.decisionFactors||"Decision Making Factors",U=L&&L.gaps||"Gaps in Decision",W=L&&L.accept||"Accept",z=L&&L.reject||"Reject",J=L&&L.backAriaLabel||"Go back",{redlineDcoumentId:K,redlineConfig:O,updateRedlineDataParent:Q}=v(),V=async e=>{var i,a;null==x||x({status:"loading",action:e,metadata:{redlineId:S,aiReasonId:P}});try{const{updated_reqai:c}=await h({documentId:K,userEmail:null==O?void 0:O.userEmail,userName:null==O?void 0:O.userName,redlineId:null!=S?S:"",action:e,baseApiUrl:null==O?void 0:O.baseApiUrl,redlineConfigId:null!==(i=null==O?void 0:O.redlineConfigId)&&void 0!==i?i:""},null!==(a=null==O?void 0:O.token)&&void 0!==a?a:"");await(null==Q?void 0:Q(c)),null==x||x({status:"success",action:e,metadata:{redlineId:S,aiReasonId:P}})}catch(i){null==x||x({status:"failed",action:e,metadata:{redlineId:S,aiReasonId:P}})}},X=B||[{id:"reject",label:z,onClick:()=>V("reject"),className:s["btn-reject"]},{id:"accept",label:W,onClick:()=>V("accept"),className:s["btn-accept"]}];return e("div",{className:`${s["cite-acc"]} ${R||""}`,style:{...l.CitationAccordionDefaults.container,...null==j?void 0:j.container},children:[$&&e("div",{className:s["cite-acc__backHeader"],children:[i("button",{type:"button",className:s["cite-acc__backBtn"],onClick:e=>{e.stopPropagation(),$&&$()},"aria-label":J,children:"‹"}),i("span",{className:s["cite-acc__backTitle"],children:w})]}),i("div",{className:s["cite-body"],children:C&&C.length>0?C.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(),g&&g()},children:i(o,{})})]}),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(u,{text:a.content,item:a.item||n||{}}):a.content})]},a.id||a.title)):e(a,{children:[T&&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:q})})}),i("button",{type:"button",onClick:e=>{e.stopPropagation(),g&&g()},children:i(o,{})})]}),i("div",{className:`${s["cite-acc__innerBody"]} text-sm text-gray-600`,children:i(u,{text:b||"",item:n||{}})})]}),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:G})})})}),i("div",{className:`${s["cite-acc__innerBody"]} text-sm text-gray-600`,children:i(u,{text:y||"",item:{}})})]}),I&&i("div",{className:s["cite-acc__btn-container"],children:X.map(e=>{const a=D||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",...H,...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:_&&e("span",{className:s["cite-acc__scoreBadge"],children:[k?"function"==typeof k?c.createElement(k):k:i(p,{}),e("span",{className:s["cite-acc__scoreText"],children:[E,"%"]})]})})]}),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:F})})})}),i("div",{className:`${s["cite-acc__innerBody"]} text-sm text-gray-600`,children:i(u,{text:N||"",item:n||{}})})]}),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:U})})})}),i("div",{className:`${s["cite-acc__innerBody"]} text-sm text-gray-600`,children:i(u,{text:M||"",item:n||{}})})]})]})})]})},(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{N as default};
|
|
2
2
|
//# sourceMappingURL=CognitiveComponent.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as e,jsxs as i,Fragment as n}from"react/jsx-runtime";import{PenLine as o,CheckCircle as t,XCircle as l,Info as r,ChevronDown as d,ChevronRight as a}from"lucide-react";import{useState as s}from"react";import{ToneToggle as c}from"./ToneToggle.js";import"../CognitiveComponents/CitationComponent.module.css.js";import{ReactComponent as p}from"../icons/cognitiveBrain.svg.js";import{ReactComponent as g}from"../icons/aiMagic.svg.js";import{Tooltip as u}from"@mui/material";import{useRequirementAI as v}from"../../RequirementAIWrapper/RequirementAIWrapper.js";import{resolveRedline as m}from"../../../../../service/redlineService.js";import{AiReasonMarkdownWrapper as y}from"../../ai-reasoning/AiReasonMarkdownWrapper.js";const h=[{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"}],x=({toneIndex:n,configs:o=h})=>{const t=Math.min(n,o.length-1),{color:l,angle:r,arcD:d}=o[t]||o[1]||o[0],a=(r-90)*Math.PI/180,s=11+9*Math.cos(a),c=13+9*Math.sin(a);return i("svg",{width:"22",height:"14",viewBox:"0 0 22 14",fill:"none",children:[e("path",{d:"M1 13 A10 10 0 0 1 21 13",stroke:"#e5e5e5",strokeWidth:"2.5",strokeLinecap:"round"}),e("path",{d:d,stroke:l,strokeWidth:"2.5",strokeLinecap:"round"}),e("line",{x1:"11",y1:"13",x2:s,y2:c,stroke:l,strokeWidth:"2",strokeLinecap:"round"})]})},f=({type:i,customStyles:n={}})=>{const o={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"},...n},t=o[i]||o.Medium;return e("div",{style:t,children:i})},S=["Lenient","Balanced","Aggressive"],b={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"},k={fontSize:11,fontWeight:500,letterSpacing:"0.08em",color:"#E24B4A",textTransform:"uppercase"},w={fontSize:15,fontWeight:500,margin:"0 0 8px",color:"#111",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},B={fontSize:13,color:"#666",lineHeight:1.6,margin:"0 0 14px",maxHeight:"100px",overflow:"auto"},T={marginBottom:14,borderTop:"0.5px solid #eee",paddingTop:12},A={fontSize:13,color:"#666",lineHeight:1.6,margin:"8px 0 0",maxHeight:"100px",overflow:"auto"},D={display:"flex",alignItems:"center",gap:6,background:"none",border:"none",cursor:"pointer",padding:0,width:"100%"},E={fontSize:11,fontWeight:500,textTransform:"uppercase",letterSpacing:"0.08em",color:"#E24B4A"},R={display:"flex",gap:8,marginBottom:18},z={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"},W={background:"none",border:"none",cursor:"pointer",fontSize:16,color:"#888",lineHeight:1,padding:0},j={borderTop:"0.5px solid #eee",padding:"14px 0px"},L={display:"flex",alignItems:"center",width:"100%",background:"none",border:"none",cursor:"pointer",padding:0,marginBottom:4},M={cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"space-between",paddingTop:"12px",borderTop:"1px solid #eee",borderBottom:"none",paddingLeft:"12px",paddingRight:"12px"},H={display:"flex",alignItems:"center",gap:"4px",minWidth:0,flex:"1 1 auto",overflow:"hidden"},_={width:"28px",height:"28px",display:"inline-flex",alignItems:"center",justifyContent:"center",flex:"0 0 28px"},F={fontSize:"13px",color:"#101828",minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},N={display:"flex",alignItems:"center",gap:"10px",flex:"0 0 auto",minWidth:0,flexWrap:"nowrap"},O={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},P={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};function q({onAssignClick:n,onOpenCognitive:o,cognitiveIconSmall:t,cognitiveTootipTitle:l,historyIconSmall:r,onHistoryClick:d,historyTootipTitle:a}){const s="20px";return i("div",{style:{...U,minWidth:"200px"},children:[i("div",{style:{padding:"8px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"flex-start",gap:"10px"},onClick:n,children:[e("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:s,height:s,flexShrink:0},children:i("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:[e("path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}),e("path",{d:"M16 3.128a4 4 0 0 1 0 7.744"}),e("path",{d:"M22 21v-2a4 4 0 0 0-3-3.87"}),e("circle",{cx:"9",cy:"7",r:"4"})]})}),e("span",{style:{fontSize:"13px",display:"flex",alignItems:"center",flex:1,textAlign:"left"},children:"Assign"})]}),o&&i("div",{style:{padding:"8px",borderTop:"1px solid #EBEBEB",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"flex-start",gap:"10px"},onClick:e=>o(e),children:[t&&e("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:s,height:s,flexShrink:0},children:t}),e("span",{style:{fontSize:"13px",display:"flex",alignItems:"center",flex:1,textAlign:"left",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:l})]}),d&&i("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&&e("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:s,height:s,flexShrink:0},children:r}),e("span",{style:{fontSize:"13px",display:"flex",alignItems:"center",flex:1,textAlign:"left",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:a})]})]})}function $({onAssignClick:n,onOpenCognitive:o,cognitiveIconSmall:t,cognitiveTootipTitle:l,historyIconSmall:r,onHistoryClick:d,historyTootipTitle:a}){const[c,p]=s(!1);return i("div",{style:{position:"relative",display:"flex"},children:[e("button",{onClick:()=>p(!c),style:{border:"none",background:"transparent",display:"flex",alignItems:"center",cursor:"pointer",fontSize:"18px",padding:0},children:i("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:[e("circle",{cx:"12",cy:"12",r:"1"}),e("circle",{cx:"12",cy:"5",r:"1"}),e("circle",{cx:"12",cy:"19",r:"1"})]})}),c&&e(q,{onAssignClick:n?()=>{p(!1),n&&n()}:void 0,onOpenCognitive:o?e=>{p(!1),o&&o(e)}:void 0,cognitiveIconSmall:t,cognitiveTootipTitle:l,historyIconSmall:r,onHistoryClick:d,historyTootipTitle:a})]})}function G({users:n,onClick:o}){const t=n.length;return i("div",{onClick:o,style:{display:"flex",padding:"2px 6px",border:"1px solid #E2E8F0",background:"#fff",cursor:"pointer",fontSize:"11px",gap:6,borderRadius:"16px",alignItems:"center"},children:[e("p",{style:{margin:"0px",display:"flex",alignItems:"center",color:"#475569",whiteSpace:"nowrap"},children:(null==n?void 0:n[0].length)>9?(null==n?void 0:n[0].slice(0,9))+"...":null==n?void 0:n[0]}),t>1&&i("p",{style:{margin:"0px",display:"flex",alignItems:"center",borderRadius:"50px",backgroundColor:"#E2E8F0",padding:"2px 6px",color:"#475569",fontWeight:500},children:["+",t-1]})]})}function V({onClose:U,aiReason:q,onActionTrigger:V,onIterate:J,initialTone:K,onRegenerate:Q,labels:X={},toneLevelsConfig:Y=S,toneColorsConfig:Z=b,dialConfigs:ee=h,actions:ie,disableAllActions:ne=!1,customStyles:oe={},severityChipStyles:te={},customIcons:le={},onOpenCognitive:re,onHistoryClick:de,historyIconSmall:ae,historyTootipTitle:se,showTone:ce=!0,cognitiveSectionStyle:pe={},cognitiveScoreBadgeStyle:ge={},cognitiveScoreTextStyle:ue={},cognitiveStyles:ve={},cognitiveClassNames:me={},cognitiveTitle:ye="Cognitive Integrity",cognitiveTootipTitle:he="Cognitive Decisioning",cognitiveLeftIcon:xe,cognitiveIconSmall:fe,showCognitiveRightArrow:Se=!0,isStreaming:be,onAssignClick:Ce,assignedUsers:Ie,onReviewUsersClick:ke,redlineId:we,aiReasonId:Be}){var Te,Ae,De,Ee,Re,ze,We,je,Le,Me,He,_e,Fe,Ne,Oe,Pe,Ue,qe,$e;let Ge=Y.findIndex(e=>e===K);-1===Ge&&(Ge=1);const[Ve,Je]=s(!0),[Ke,Qe]=s(!1),[Xe,Ye]=s(!1),[Ze,ei]=s(Ge),[ii]=s(Ge),ni=Y[Ze],oi=Z[ni]||"#BA7517",ti=Ze!==ii,li=[{id:"iterate",icon:le.iterateIcon||e(o,{size:16,color:"#64748B"}),label:X.btnIterate||"Iterate",color:"#64748B",onClick:J},{id:"accept",icon:le.acceptIcon||e(t,{size:16,color:"#10B981"}),label:X.btnAccept||"Approve",color:"#10B981",useLabel:!0},{id:"reject",icon:le.rejectIcon||e(l,{size:16,color:"#DC2626"}),label:X.btnReject||"Reject",color:"#DC2626",useLabel:!0}],{redlineDcoumentId:ri,redlineConfig:di,updateRedlineDataParent:ai}=v(),si=ie||li;return i("div",{onClick:e=>{e.stopPropagation()},style:{...C,...null===(Te=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===Te?void 0:Te.root},children:[i("div",{style:{...I,...null===(Ae=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===Ae?void 0:Ae.header,marginBottom:Xe?"16px":"12px"},children:[i("div",{style:{display:"flex",alignItems:"center",gap:10},children:[i("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e("span",{children:le.summaryIcon||e(r,{size:16,color:"#E24B4A"})}),e("span",{style:{...k,...null===(De=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===De?void 0:De.title},children:X.summaryHeader||"Summary"})]}),Ie&&Ie.length>0&&e(G,{users:Ie,onClick:e=>{e.stopPropagation(),null==ke||ke()}})]}),i("div",{style:{display:"flex",gap:12,alignItems:"center"},children:[(Ce||re)&&e($,{onAssignClick:Ce,onOpenCognitive:re,cognitiveIconSmall:fe,cognitiveTootipTitle:he,historyIconSmall:ae,onHistoryClick:de,historyTootipTitle:se}),e("button",{onClick:U,style:{...W,...null===(Ee=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===Ee?void 0:Ee.closeBtn,color:"#64748B"},children:"✕"})]})]}),e(u,{title:null===(Re=null==q?void 0:q.redlining_details)||void 0===Re?void 0:Re.redline_title,children:e("p",{style:{...w,...null===(ze=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===ze?void 0:ze.bodyText},children:null===(We=null==q?void 0:q.redlining_details)||void 0===We?void 0:We.redline_title})}),e("p",{style:{...B,...null===(je=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===je?void 0:je.summary},children:null===(Le=null==q?void 0:q.redlining_details)||void 0===Le?void 0:Le.redline_summary}),i("div",{style:{...T,...null===(Me=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===Me?void 0:Me.impactContainer},children:[i("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[i("button",{onClick:()=>Je(!Ve),style:{...D,...null===(He=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===He?void 0:He.impactToggle},children:[e("span",{style:{...E,...null===(_e=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===_e?void 0:_e.impactToggleLabel},children:X.impactHeader||"Impact"}),e("span",{style:{fontSize:12,color:"#E24B4A",transition:"transform 0.2s",display:"flex",alignItems:"center",transform:Ve?"rotate(180deg)":"rotate(0deg)"},children:e(d,{size:16,color:"#E24B4A"})})]}),e(f,{type:(null==q?void 0:q.severity)||"Medium",customStyles:te})]}),Ve&&e(n,{children:e("div",{style:{...A,...null===(Fe=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===Fe?void 0:Fe.impactText},children:e(y,{message:`${null!==(Oe=null===(Ne=null==q?void 0:q.redlining_details)||void 0===Ne?void 0:Ne.redline_impact)&&void 0!==Oe?Oe:X.fallbackImpact||"This change reduces compliance obligations and lowers contractual risk thresholds."} [View chat](chat_citation$all)`,customStyles:null===(Pe=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===Pe?void 0:Pe.impactMarkdown})})})]}),e("div",{style:{...R,...null===(Ue=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===Ue?void 0:Ue.actionContainer},children:si.map(e=>{var n,o;const t=ne||e.disabled,l=t?{cursor:"not-allowed",opacity:.5,...null===(n=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===n?void 0:n.actionBtnDisabled,...e.disabledStyle}:{};return i("button",{style:{...z,...null===(o=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===o?void 0:o.actionBtn,color:e.color,...e.style,...l},onClick:t?void 0:()=>{var i;e.useLabel?(async e=>{var i,n,o;null==V||V({status:"loading",action:e,metadata:{redlineId:we,aiReasonId:Be}});try{const{updated_reqai:t}=await m({documentId:ri,userEmail:null==di?void 0:di.userEmail,userName:null==di?void 0:di.userName,redlineId:null!==(i=null==q?void 0:q.redline_id)&&void 0!==i?i:"",action:e,baseApiUrl:null==di?void 0:di.baseApiUrl,redlineConfigId:null!==(n=null==di?void 0:di.redlineConfigId)&&void 0!==n?n:""},null!==(o=null==di?void 0:di.token)&&void 0!==o?o:"");await(null==ai?void 0:ai(t)),null==V||V({status:"success",action:e,metadata:{redlineId:we,aiReasonId:Be}})}catch(e){null==V||V({status:"failed",action:null,metadata:{redlineId:we,aiReasonId:Be}})}})(e.id.toLowerCase()):null===(i=e.onClick)||void 0===i||i.call(e)},disabled:t,children:[e.icon,e.label]},e.id)})}),ce&&i("div",{style:{...j,...null===(qe=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===qe?void 0:qe.toneContainer},children:[i("button",{onClick:()=>Qe(!Ke),style:{...L,...null===($e=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===$e?void 0:$e.toneToggleBtn},children:[i("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e(x,{toneIndex:Ze,configs:ee}),e("span",{style:{fontSize:13,fontWeight:500,color:"#111"},children:X.toneHeader||"Redline Tone"})]}),e("span",{style:{transition:"transform 0.2s",display:"flex",alignItems:"center",transform:Ke?"rotate(180deg)":"rotate(0deg)"},children:e(d,{size:16,color:"#111"})})]}),Ke&&i(n,{children:[e("p",{style:{fontSize:12,color:"#888",margin:"0 0 12px"},children:X.toneDescription||"Controls how assertively AI is redlining"}),e(c,{isDirty:ti,onToneChange:e=>{ei(e)},toneColor:oi,toneIndex:Ze,onClickRegenerate:()=>null==Q?void 0:Q(ni),toneLabels:Y,isStreaming:be,aiReason:q})]})]}),re&&i("div",{className:null==me?void 0:me.section,onClick:e=>{e.stopPropagation(),re&&re(e)},style:{...M,...null==ve?void 0:ve.section,...pe},children:[i("div",{className:null==me?void 0:me.headerLeft,style:{...H,...null==ve?void 0:ve.headerLeft},children:[e("span",{className:null==me?void 0:me.titleIcon,style:{..._,...null==ve?void 0:ve.titleIcon},children:null!=xe?xe:e(p,{})}),e("div",{className:null==me?void 0:me.cognitiveTitle,style:{...F,...null==ve?void 0:ve.cognitiveTitle},children:ye})]}),i("div",{className:null==me?void 0:me.headerRight,style:{...N,...null==ve?void 0:ve.headerRight},children:[void 0!==(null==q?void 0:q.relevance_score)&&null!==(null==q?void 0:q.relevance_score)?i("span",{className:null==me?void 0:me.scoreBadge,style:{...O,...null==ve?void 0:ve.scoreBadge,...ge},children:[e(g,{}),i("span",{className:null==me?void 0:me.scoreText,style:{...P,...null==ve?void 0:ve.scoreText,...ue},children:[Math.round(Number(q.relevance_score)),"%"]})]}):null,Se&&e("span",{style:{display:"flex",alignItems:"center"},children:e(a,{size:16,color:"#64748B"})})]})]})]})}export{q as AssignMenu,G as DisplayUsers,$ as KebabMenu,V 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";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%"},L={fontSize:11,fontWeight:500,textTransform:"uppercase",letterSpacing:"0.08em",color:"#E24B4A"},z={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:Le=[],showReviewProgress:ze=!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=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}})}},Bi=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&&ze&&Le.length>0&&i(K,{steps:Le}),!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:{...L,...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:{...z,...null===(ti=null==oe?void 0:oe.DeviationSummaryStyles)||void 0===ti?void 0:ti.actionContainer},children:Bi.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()=>{if(i.onClick){return void(!0===await i.onClick()&&i.useLabel&&await Ii(i.id.toLowerCase()))}i.useLabel&&await Ii(i.id.toLowerCase())},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};
|
|
2
2
|
//# sourceMappingURL=DeviationSummary.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{jsx as e,jsxs as t}from"react/jsx-runtime";import{Lock as i,X as n}from"lucide-react";const r={popup:{width:400,background:"#fff",borderRadius:20,padding:20,boxShadow:"0 20px 60px rgba(0,0,0,0.18), 0 8px 20px rgba(0,0,0,0.08)",display:"flex",flexDirection:"column",alignItems:"center",gap:10},content:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:12,width:"100%"},icon:{width:40,height:40,borderRadius:"50%",background:"#FEF2F2",color:"#DC2626",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},message:{margin:0,color:"#6B7280",fontFamily:"Inter",fontSize:15,lineHeight:1.6,flex:1},cross:{alignSelf:"start",cursor:"pointer"}};function o({message:o,onClose:s}){return e("div",{style:r.popup,children:t("div",{style:r.content,children:[e("div",{style:r.icon,children:e(i,{size:15,strokeWidth:2.2})}),e("p",{style:r.message,children:o}),e("div",{style:r.cross,onClick:s,children:e(n,{size:20,strokeWidth:2.2})})]})})}export{o as default};
|
|
2
|
+
//# sourceMappingURL=EditBlockPopup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EditBlockPopup.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsxs as e,jsx as i}from"react/jsx-runtime";import{UserPen as n,CheckCircle as l,XCircle as t}from"lucide-react";import{useRequirementAI as o}from"../../RequirementAIWrapper/RequirementAIWrapper.js";import{resolveRedline as d}from"../../../../../service/redlineService.js";function a({onClose:a,editorInfo:s,headerText:c,btnsConfig:u,labelText:p,onActionTrigger:v,aiReason:f=null}){var b,g;const{redlineDcoumentId:m,redlineConfig:y,updateRedlineDataParent:h}=o(),I=async e=>{var i,n,l;null==v||v({status:"loading",action:e,metadata:{redlineId:null==f?void 0:f.redline_id,aiReasonId:null==f?void 0:f.id}});try{const{updated_reqai:t}=await d({documentId:m,userEmail:null==y?void 0:y.userEmail,userName:null==y?void 0:y.userName,redlineId:null!==(i=null==f?void 0:f.redline_id)&&void 0!==i?i:"",action:e,baseApiUrl:null==y?void 0:y.baseApiUrl,redlineConfigId:null!==(n=null==y?void 0:y.redlineConfigId)&&void 0!==n?n:""},null!==(l=null==y?void 0:y.token)&&void 0!==l?l:"");await(null==h?void 0:h(t)),null==v||v({status:"success",action:e,metadata:{redlineId:null==f?void 0:f.redline_id,aiReasonId:null==f?void 0:f.id}})}catch(
|
|
1
|
+
import{jsxs as e,jsx as i}from"react/jsx-runtime";import{UserPen as n,CheckCircle as l,XCircle as t}from"lucide-react";import{useRequirementAI as o}from"../../RequirementAIWrapper/RequirementAIWrapper.js";import{resolveRedline as d}from"../../../../../service/redlineService.js";function a({onClose:a,editorInfo:s,headerText:c,btnsConfig:u,labelText:p,onActionTrigger:v,aiReason:f=null}){var b,g;const{redlineDcoumentId:m,redlineConfig:y,updateRedlineDataParent:h}=o(),I=async e=>{var i,n,l;null==v||v({status:"loading",action:e,metadata:{redlineId:null==f?void 0:f.redline_id,aiReasonId:null==f?void 0:f.id}});try{const{updated_reqai:t}=await d({documentId:m,userEmail:null==y?void 0:y.userEmail,userName:null==y?void 0:y.userName,redlineId:null!==(i=null==f?void 0:f.redline_id)&&void 0!==i?i:"",action:e,baseApiUrl:null==y?void 0:y.baseApiUrl,redlineConfigId:null!==(n=null==y?void 0:y.redlineConfigId)&&void 0!==n?n:""},null!==(l=null==y?void 0:y.token)&&void 0!==l?l:"");await(null==h?void 0:h(t)),null==v||v({status:"success",action:e,metadata:{redlineId:null==f?void 0:f.redline_id,aiReasonId:null==f?void 0:f.id}})}catch(i){null==v||v({status:"failed",action:e,metadata:{redlineId:null==f?void 0:f.redline_id,aiReasonId:null==f?void 0:f.id}})}};return e("div",{style:r.popup,children:[e("div",{style:r.header,children:[i("span",{style:r.title,children:c||"Manually Edited"}),i("button",{onClick:a,style:r.closeButton,"aria-label":"Close",children:"✕"})]}),e("div",{style:r.content,children:[e("div",{style:r.labelRow,children:[i(n,{}),i("span",{style:r.label,children:p||"Edited By"})]}),i("div",{style:r.editorInfo,children:s}),i("div",{style:r.divider}),e("div",{style:r.actions,children:[null==u?void 0:u.map(i=>e("button",{style:{...r.actionBtn,...i.style||{}},onClick:e=>i.onClick(e,{redlineId:null==f?void 0:f.redline_id,id:null==f?void 0:f.id}),children:[i.icon," ",i.text]})),!("accepted"===(null===(b=null==f?void 0:f.redlining_details)||void 0===b?void 0:b.status)||"rejected"===(null===(g=null==f?void 0:f.redlining_details)||void 0===g?void 0:g.status))&&e("div",{style:r.resolveActions,children:[e("button",{style:{...r.actionBtn,...(null==f?void 0:f.resolving)?r.actionBtnDisabled:{}},disabled:null==f?void 0:f.resolving,onClick:()=>I("accept"),children:[i(l,{size:16,color:"#10B981"})," ","Adopt"]}),e("button",{style:{...r.actionBtn,...(null==f?void 0:f.resolving)?r.actionBtnDisabled:{}},onClick:()=>I("reject"),disabled:null==f?void 0:f.resolving,children:[i(t,{size:16,color:"#DC2626"})," ","Reject"]})]})]})]})]})}const r={popup:{width:400,background:"#fff",borderRadius:12,overflow:"hidden",boxShadow:"0 10px 30px rgba(0,0,0,0.15)",fontFamily:"Inter, sans-serif"},actionBtnDisabled:{opacity:.5,cursor:"not-allowed",pointerEvents:"none"},header:{background:"#dfe7f8",display:"flex",alignItems:"center",justifyContent:"space-between",padding:"18px 14px"},title:{fontSize:14,fontWeight:600,color:"#313949"},closeButton:{border:"none",background:"transparent",cursor:"pointer",fontSize:14,color:"#616b7d"},content:{padding:"16px 22px"},labelRow:{display:"flex",alignItems:"center",gap:10,marginBottom:8},labelIcon:{fontSize:18},label:{fontSize:14,color:"#7b8495"},editorInfo:{fontSize:14,fontWeight:500,color:"#313949"},divider:{margin:"14px 0",height:1,background:"#e5e7eb"},actions:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:15},resolveActions:{display:"flex",justifyContent:"space-between",gap:15,alignItems:"center"},actionBtn:{border:"1px solid #d5dbe8",background:"#fff",borderRadius:10,padding:"8px",fontSize:14,cursor:"pointer",display:"flex",alignItems:"center",gap:10,color:"#596275"}};export{a as default};
|
|
2
2
|
//# sourceMappingURL=ManualEditPopup.js.map
|