@viswa-test/test-citation 0.0.322 → 0.0.324
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/dist/cjs/features/ChatCitation/InternalChatCitationRenderer.js +1 -1
- package/dist/cjs/features/CitationRenderer/MarkdownRenderer.module.css.js +1 -1
- package/dist/cjs/features/CodeCitation/CodeCitation.js +1 -1
- package/dist/cjs/features/CodeCitation/_components/CodeCitationPopup.js +1 -1
- package/dist/cjs/features/CodeCitation/_components/RepoAndBranchTag.js +2 -0
- package/dist/cjs/features/CodeCitation/_components/RepoAndBranchTag.js.map +1 -0
- package/dist/cjs/features/CognitiveCompare/CognitiveCompare.js +1 -1
- package/dist/cjs/features/CognitiveCompare/Guidelines/components/GuidelinePanel.js +1 -1
- package/dist/cjs/features/CognitiveCompare/Guidelines/components/WebGptPanel.js +1 -1
- package/dist/cjs/features/CognitiveCompare/Guidelines/utils/processGuidelinesMarkdown.js +1 -1
- package/dist/cjs/features/CognitiveCompare/Guidelines/utils/resolveGuidelineSelection.js +1 -1
- package/dist/cjs/features/CognitiveCompare/hooks/useCompareData.js +1 -1
- package/dist/cjs/features/CognitiveCompare/hooks/useLinesCalculator.js +1 -1
- package/dist/cjs/features/CognitiveCompare/hooks/useSideBySide.js +1 -1
- package/dist/cjs/features/PdfViewer/PdfViewer.js +1 -1
- package/dist/cjs/features/SPBAnalysisPanel/Cognitivereasoningpanel.js +1 -1
- package/dist/cjs/features/SPBAnalysisPanel/DependencyGraph.js +1 -1
- package/dist/cjs/features/SPBAnalysisPanel/Markdownrenderer.js +1 -1
- package/dist/cjs/features/SPBAnalysisPanel/Spbanalysispanel.js +1 -1
- package/dist/cjs/features/SegmentReviewComponents/BoundaryCard.js +1 -1
- package/dist/cjs/features/SegmentReviewComponents/SegmentReviewPdfWrapper.js +1 -1
- package/dist/cjs/features/SegmentReviewComponents/helper.js +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/features/ChatCitation/InternalChatCitationRenderer.js +1 -1
- package/dist/features/CitationRenderer/MarkdownRenderer.module.css.js +1 -1
- package/dist/features/CodeCitation/CodeCitation.js +1 -1
- package/dist/features/CodeCitation/_components/CodeCitationPopup.js +1 -1
- package/dist/features/CodeCitation/_components/RepoAndBranchTag.js +2 -0
- package/dist/features/CodeCitation/_components/RepoAndBranchTag.js.map +1 -0
- package/dist/features/CognitiveCompare/CognitiveCompare.js +1 -1
- package/dist/features/CognitiveCompare/Guidelines/components/GuidelinePanel.js +1 -1
- package/dist/features/CognitiveCompare/Guidelines/components/WebGptPanel.js +1 -1
- package/dist/features/CognitiveCompare/Guidelines/utils/processGuidelinesMarkdown.js +1 -1
- package/dist/features/CognitiveCompare/Guidelines/utils/resolveGuidelineSelection.js +1 -1
- package/dist/features/CognitiveCompare/hooks/useCompareData.js +1 -1
- package/dist/features/CognitiveCompare/hooks/useLinesCalculator.js +1 -1
- package/dist/features/CognitiveCompare/hooks/useSideBySide.js +1 -1
- package/dist/features/PdfViewer/PdfViewer.js +1 -1
- package/dist/features/SPBAnalysisPanel/Cognitivereasoningpanel.js +1 -1
- package/dist/features/SPBAnalysisPanel/DependencyGraph.js +1 -1
- package/dist/features/SPBAnalysisPanel/Markdownrenderer.js +1 -1
- package/dist/features/SPBAnalysisPanel/Spbanalysispanel.js +1 -1
- package/dist/features/SegmentReviewComponents/BoundaryCard.js +1 -1
- package/dist/features/SegmentReviewComponents/SegmentReviewPdfWrapper.js +1 -1
- package/dist/features/SegmentReviewComponents/helper.js +1 -1
- package/dist/index.js +1 -1
- package/dist/types/src/CodeCitationTest.d.ts.map +1 -1
- package/dist/types/src/features/ChatCitation/InternalChatCitationRenderer.d.ts.map +1 -1
- package/dist/types/src/features/CodeCitation/CodeCitation.d.ts +2 -0
- package/dist/types/src/features/CodeCitation/CodeCitation.d.ts.map +1 -1
- package/dist/types/src/features/CodeCitation/_components/CodeCitationPopup.d.ts +3 -0
- package/dist/types/src/features/CodeCitation/_components/CodeCitationPopup.d.ts.map +1 -1
- package/dist/types/src/features/CodeCitation/_components/RepoAndBranchTag.d.ts +8 -0
- package/dist/types/src/features/CodeCitation/_components/RepoAndBranchTag.d.ts.map +1 -0
- package/dist/types/src/features/CognitiveCompare/CognitiveCompare.d.ts +1 -1
- package/dist/types/src/features/CognitiveCompare/CognitiveCompare.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/CognitiveCompareTypes.d.ts +1 -1
- package/dist/types/src/features/CognitiveCompare/CognitiveCompareTypes.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/Guidelines/components/GuidelinePanel.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/Guidelines/components/WebGptPanel.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/Guidelines/constants/guidelines.mockData.d.ts +802 -14744
- package/dist/types/src/features/CognitiveCompare/Guidelines/constants/guidelines.mockData.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/Guidelines/utils/processGuidelinesMarkdown.d.ts +1 -14
- package/dist/types/src/features/CognitiveCompare/Guidelines/utils/processGuidelinesMarkdown.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/Guidelines/utils/resolveGuidelineSelection.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/hooks/useCompareData.d.ts +1 -1
- package/dist/types/src/features/CognitiveCompare/hooks/useCompareData.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/hooks/useLinesCalculator.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/hooks/useSideBySide.d.ts.map +1 -1
- package/dist/types/src/features/PdfViewer/PdfViewer.d.ts.map +1 -1
- package/dist/types/src/features/SPBAnalysisPanel/Cognitivereasoningpanel.d.ts +31 -1
- package/dist/types/src/features/SPBAnalysisPanel/Cognitivereasoningpanel.d.ts.map +1 -1
- package/dist/types/src/features/SPBAnalysisPanel/DependencyGraph.d.ts +25 -0
- package/dist/types/src/features/SPBAnalysisPanel/DependencyGraph.d.ts.map +1 -1
- package/dist/types/src/features/SPBAnalysisPanel/Markdownrenderer.d.ts +3 -1
- package/dist/types/src/features/SPBAnalysisPanel/Markdownrenderer.d.ts.map +1 -1
- package/dist/types/src/features/SPBAnalysisPanel/Spbanalysispanel.d.ts +7 -1
- package/dist/types/src/features/SPBAnalysisPanel/Spbanalysispanel.d.ts.map +1 -1
- package/dist/types/src/features/SegmentReviewComponents/BoundaryCard.d.ts +4 -2
- package/dist/types/src/features/SegmentReviewComponents/BoundaryCard.d.ts.map +1 -1
- package/dist/types/src/features/SegmentReviewComponents/SegmentReviewPdfWrapper.d.ts.map +1 -1
- package/dist/types/src/features/SegmentReviewComponents/SegmentReviewRedirectionTest.d.ts.map +1 -1
- package/dist/types/src/features/SegmentReviewComponents/helper.d.ts +25 -0
- package/dist/types/src/features/SegmentReviewComponents/helper.d.ts.map +1 -1
- package/dist/types/src/features/SegmentReviewComponents/index.d.ts +4 -7
- package/dist/types/src/features/SegmentReviewComponents/index.d.ts.map +1 -1
- package/dist/types/src/features/SegmentReviewComponents/reviewStepAdapters.d.ts +1 -0
- package/dist/types/src/features/SegmentReviewComponents/reviewStepAdapters.d.ts.map +1 -1
- package/dist/types/src/features/SegmentReviewComponents/segmentReviewEdgeCases.test.d.ts +2 -0
- package/dist/types/src/features/SegmentReviewComponents/segmentReviewEdgeCases.test.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +2 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{useState as e,useRef as n,useCallback as t,useEffect as r}from"react";import{DEVIATION_BADGE_SEPARATOR as i,resetClauseHighlight as l,smoothScrollTo as u}from"../CognitiveComparehelpers.js";
|
|
1
|
+
import{useState as e,useRef as n,useCallback as t,useEffect as r}from"react";import{DEVIATION_BADGE_SEPARATOR as i,resetClauseHighlight as l,smoothScrollTo as u}from"../CognitiveComparehelpers.js";var o=function(o){var c=o.isGuidelineMode,d=o.maintainRelativeOrder,s=o.proposedSections,v=o.existingSections,a=o.leftContainerRef,p=o.rightContainerRef,g=o.scrollContainerRef,f=o.sectionLeftRefs,h=o.sectionRightRefs,R=o.subSectionLeftRefs,S=o.subSectionRightRefs,y=o.lhsBadgeRefs,m=o.rhsBadgeRefs,B=o.sectionRowRefs,x=o.sectionRightRowRefs,C=o.rhsTopSpacerRef,T=o.rhsBottomSpacerRef,b=o.lhsTopSpacerRef,A=o.lhsBottomSpacerRef,I=o.calculateLinesRef,w=o.setConnectedSections,L=o.setConnectedLines,E=o.cachedConnectedPositions,F=o.closeMoreFunctionsPopup,N=o.setErrorToast;o.moreFunctions,o.closeSummaryPopup;var q=e(!1),H=q[0],M=q[1],P=e(!1),z=P[0],V=P[1],j=e(!1),k=j[0],G=j[1],O=e(!1),D=O[0],J=O[1],K=e(null),Q=K[0],U=K[1],W=n(!1),X=n(null),Y=n(!1),Z=n(null),$=n(null),_=n(null),ee=n(new Set),ne=function(){ee.current.forEach(function(e){l(e)}),ee.current.clear()},te=function(e,n,t){var r,l,u,o,c,d,s,v,g,C,T,b,A=null,I=null,w=null,L=null,E=null,F=null,N=function(e,n){if(!e||!n)return!0;var t=e.getBoundingClientRect(),r=n.getBoundingClientRect();return t.bottom>=r.top&&t.top<=r.bottom};if(e){var q=n.split(i),H="".concat(q[0]).concat(i).concat(q[1]);A=(null===(r=R.current[q[2]])||void 0===r?void 0:r.current)||(null===(l=f.current[Number(q[2])])||void 0===l?void 0:l.current)||null,I=(null===(u=S.current[q[3]])||void 0===u?void 0:u.current)||(null===(o=h.current[Number(q[3])])||void 0===o?void 0:o.current)||null,w=(null===(c=y.current[H])||void 0===c?void 0:c.current)||A,L=(null===(d=m.current[H])||void 0===d?void 0:d.current)||I}else{var M=Number(n),P=null!==t?Number(t):M;A=(null===(s=f.current[M])||void 0===s?void 0:s.current)||null,I=(null===(v=h.current[P])||void 0===v?void 0:v.current)||null,E=(null===(g=y.current[M])||void 0===g?void 0:g.current)||null,F=(null===(C=m.current[P])||void 0===C?void 0:C.current)||null,w=E||(null===(T=B.current[M])||void 0===T?void 0:T.current)||A,L=F||(null===(b=x.current[P])||void 0===b?void 0:b.current)||I}if(A&&(A.style.paddingTop="0px"),I&&(I.style.paddingTop="0px"),e||(E&&(E.style.marginTop="0px"),F&&(F.style.marginTop="0px")),!e&&E&&F){var z=a.current,V=p.current;if(!N(E,z)||!N(F,V))return;var j=E.getBoundingClientRect(),k=F.getBoundingClientRect(),G=j.top-k.top;if(Math.abs(G)>32)return;G>0&&(F.style.marginTop="".concat(G,"px"))}else if(w&&L&&A&&I){j=w.getBoundingClientRect(),k=L.getBoundingClientRect();(G=j.top-k.top)>0&&(I.style.paddingTop="".concat(G,"px"))}},re=t(function(){var e,n,t,r,l,u,o,c,d=Z.current,s=$.current;if(null!==d)if("string"==typeof d&&d.includes(i)){var v=d.split(i),a=(null===(e=R.current[v[2]])||void 0===e?void 0:e.current)||(null===(n=f.current[Number(v[2])])||void 0===n?void 0:n.current)||null,p=(null===(t=S.current[v[3]])||void 0===t?void 0:t.current)||(null===(r=h.current[Number(v[3])])||void 0===r?void 0:r.current)||null;a&&(a.style.paddingTop="0px"),p&&(p.style.paddingTop="0px")}else{a=(null===(l=f.current[d])||void 0===l?void 0:l.current)||null,p=(null===(u=h.current[null!=s?s:d])||void 0===u?void 0:u.current)||null;a&&(a.style.paddingTop="0px"),p&&(p.style.paddingTop="0px");var g=(null===(o=y.current[d])||void 0===o?void 0:o.current)||null,B=(null===(c=m.current[null!=s?s:d])||void 0===c?void 0:c.current)||null;g&&(g.style.marginTop="0px"),B&&(B.style.marginTop="0px")}C.current&&(C.current.style.height="0px"),T.current&&(T.current.style.height="0px"),b.current&&(b.current.style.height="0px"),A.current&&(A.current.style.height="0px")},[]);r(function(){Y.current=H},[H]),r(function(){Z.current=Q},[Q]);var ie=t(function(){ne(),M(!1),Y.current=!1,X.current=null,re(),U(null),Z.current=null,$.current=null,V(!1),J(!1)},[re]),le=t(function(e,n,t){var r,l,o=null===(r=null==t?void 0:t.toggleIfSame)||void 0===r||r,R=null==t?void 0:t.onReady,S=null!==(l=null==t?void 0:t.sourceSide)&&void 0!==l?l:"left";if(F(),null!=e)if(!n||c){ne();var q=H&&Q===e;H&&null!==Q&&re(),q&&o?ie():(w(new Set([e])),L([]),E.current=[],J(!0),W.current=!0,U(e),Z.current=e,M(!0),Y.current=!0,V(!1),C.current&&(C.current.style.height="0px"),T.current&&(T.current.style.height="0px"),b.current&&(b.current.style.height="0px"),A.current&&(A.current.style.height="0px"),requestAnimationFrame(function(){var n=function(){var n,t,r,l,o,b,A,w,L,E,F,N="string"==typeof e&&e.includes(i),q=null,H=null,M=null;if(c){if(N){var P=e.split(i),z="".concat(P[0]).concat(i).concat(P[1]);q=(null===(n=y.current[z])||void 0===n?void 0:n.current)||null}else q=(null===(t=f.current[e])||void 0===t?void 0:t.current)||(null===(r=B.current[e])||void 0===r?void 0:r.current)||null;H=document.getElementById("guideline-target-0"),M=H?e:null}else if(N){P=e.split(i),z="".concat(P[0]).concat(i).concat(P[1]);q=(null===(l=y.current[z])||void 0===l?void 0:l.current)||null,H=(null===(o=m.current[z])||void 0===o?void 0:o.current)||null,M=H?e:null}else if(q=(null===(b=f.current[e])||void 0===b?void 0:b.current)||(null===(A=B.current[e])||void 0===A?void 0:A.current)||null,d){var j=s[e],k=(null==j?void 0:j.refIndexes)||[];if(k.length>0){var G=k[0],O=v.findIndex(function(e){return e.selfIndex===G});-1!==O&&(H=(null===(E=h.current[O])||void 0===E?void 0:E.current)||(null===(F=x.current[O])||void 0===F?void 0:F.current)||null,M=O)}}else H=(null===(w=h.current[e])||void 0===w?void 0:w.current)||(null===(L=x.current[e])||void 0===L?void 0:L.current)||null,M=H?e:null;$.current=M;var D=a.current,K=p.current,Q=function(){te(N,e,M),V(!0),I.current&&I.current(),W.current=!1,"right"===S&&K?K.dispatchEvent(new Event("scroll")):D&&D.dispatchEvent(new Event("scroll")),J(!1),null==R||R()};if(!q||!D)return W.current=!1,J(!1),void(null==R||R());if(H&&K){if(!d){var U=0;U="right"===S?H?H.getBoundingClientRect().top:0:q?q.getBoundingClientRect().top:0;var X=g.current,Y=(null==X?void 0:X.getBoundingClientRect().top)||0,Z=X?X.scrollTop+U-Y-150:0;return X?void u(X,Z,200,Q):void Q()}var _=q.getBoundingClientRect().top-D.getBoundingClientRect().top+D.scrollTop,ee=H.getBoundingClientRect().top-K.getBoundingClientRect().top+K.scrollTop,ne=200;if("left"===S){var re=ee-(_-D.scrollTop);re<0&&C.current&&!c&&(C.current.style.height="".concat(Math.abs(re),"px")),requestAnimationFrame(function(){var e,n=K.scrollHeight-K.clientHeight;if(re<0)e=0;else{if(re>n){var t=re-n;return T.current&&!c&&(T.current.style.height="".concat(t+150,"px")),void requestAnimationFrame(function(){u(K,re,ne,Q)})}e=re}u(K,e,ne,Q)})}else{var ie=_-(ee-K.scrollTop);requestAnimationFrame(function(){var e,n=D.scrollHeight-D.clientHeight;if(ie<0)e=0;else{if(ie>n)return void requestAnimationFrame(function(){return u(D,n,ne,Q)});e=ie}u(D,e,ne,Q)})}}else Q()};c?setTimeout(n,100):n()}))}else N("No counterpart exists for this section.")},[Q,F,v,H,d,s,re,ie,c]);return{isSideBySide:H,setIsSideBySide:M,isArrowVisible:z,setIsArrowVisible:V,isResizing:k,setIsResizing:G,isSideBySideLoading:D,setIsSideBySideLoading:J,activeSideBySideSection:Q,setActiveSideBySideSection:U,scrollLock:W,sideBySideCacheRef:X,isSideBySideRef:Y,activeSideBySideSectionRef:Z,activeSideBySideRightSectionRef:$,sideBySideLineRef:_,highlightedClauseRefs:ee,clearClauseHighlight:ne,applyAlignmentPadding:te,resetSideBySide:ie,activateSideBySide:le}};export{o as useSideBySide};
|
|
2
2
|
//# sourceMappingURL=useSideBySide.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as e,__awaiter as t,__generator as n}from"tslib";import{jsx as i,jsxs as o,Fragment as r}from"react/jsx-runtime";import{SpecialZoomLevel as a}from"@react-pdf-viewer/core";import l from"./PdfContainer.js";import c from"./PdfToolbar.js";import{pdfStyles as u}from"./PdfStyle.js";import{PdfHighlightControls as s}from"./usePdfHighlight.js";import"@react-pdf-viewer/zoom/lib/styles/index.css";import"@react-pdf-viewer/page-navigation/lib/styles/index.css";import"@react-pdf-viewer/core/lib/styles/index.css";import"@react-pdf-viewer/search/lib/styles/index.css";import d,{useRef as g,useState as f,useMemo as h,useEffect as v}from"react";import m from"../ScannedDocCitation/ScannedDocCitation.js";var p=function(e){switch(e){case"ActualSize":return a.ActualSize;case"PageFit":return a.PageFit;case"PageWidth":return a.PageWidth;default:return null!=e?e:a.PageWidth}},y=function(y){var x,P=y.pdfUrl,T=y.highlightText,w=y.highlightPages,C=y.highlightCordinatePages,b=y.highlightColor,S=void 0===b?"yellow":b,A=y.activeHighlightColor,_=void 0===A?"#f7dc51":A,I=y.jumpToPageValue,R=void 0===I?0:I,H=y.pdfName,L=y.onClose,q=y.customStyles,N=y.customClasses,j=y.customIcons,F=y.useCoordinates,B=y.fallbackPages,D=y.activeCitationIndex,M=y.onActiveCitationChange,V=y.headerAction,W=y.isZoomEnabled,z=void 0===W||W,E=y.showHighlightsAction,k=void 0===E||E,O=y.defaultScale,U=void 0===O?a.ActualSize:O,Z=y.useRange,J=void 0!==Z&&Z,K=y.rangeOfPages,G=void 0===K?null:K,Q=y.showFullScreenAction,X=void 0===Q||Q,Y=y.segments,$=void 0===Y?[{title:"Document 2",start_page:52,end_page:52,page_count:1}]:Y,ee=y.segmentTooltipText,te=y.onCurrentPageChange,ne=y.navigationRequest,ie=y.onNavigationSettled,oe=y.disablePdfAnnotations,re=void 0!==oe&&oe,ae=y.disablePdfTextLayer,le=void 0!==ae&&ae,ce=y.renderPage,ue=y.setRenderRange,se=g(null),de=f(0),ge=de[0],fe=de[1],he=f(0),ve=he[0],me=he[1],pe=g(null),ye=g(null),xe=g(0),Pe=h(function(){return re||le?function(t){var n=le?i("div",e({"aria-hidden":"true",style:{display:"none"}},{children:t.textLayer.children})):t.textLayer.children,a=e(e({},t),{annotationLayer:e(e({},t.annotationLayer),{children:re?null:t.annotationLayer.children}),textLayer:e(e({},t.textLayer),{children:n})});return ce?ce(a):o(r,{children:[t.canvasLayer.children,n,!re&&t.annotationLayer.children]})}:ce},[re,le,ce]),Te=h(function(){if(F)return new Set(C.map(function(e){return e.pageIndex}));var e=new Set;return Object.values(w).forEach(function(t){t>0&&e.add(t-1)}),e},[C,w,F]),we=(x=T)&&0!==x.length?x.filter(function(e){return!x.some(function(t){return t!==e&&t.includes(e)})}):x,Ce=s(we,F?{}:w,se,Te,F,F?C:[],S,_),be=Ce.highlightIndex,Se=Ce.cursorIndex,Ae=Ce.setCursorIndex,_e=Ce.orderedKeys,Ie=Ce.totalHighlights,Re=Ce.getValidPosition,He=Ce.tryJump,Le=Ce.jumpToPage,qe=Ce.plugins,Ne=Ce.controls,je=Ce.hideNonTargetHighlights,Fe=Ce.deduplicateHighlights,Be=Re(Se),De=h(function(){var e=ge+1;return $.find(function(t){return e>=t.start_page&&e<=t.end_page})},[ge,$]);v(function(){void 0!==D&&D!==Se&&Ae(D)},[D]);var Me=e(e({},Ne),{goToNext:function(){Se>=Ie-1||(Ne.goToNext(),M&&M(Se+1))},goToPrevious:function(){Se<=0||(Ne.goToPrevious(),M&&M(Se-1))}}),Ve=d.useCallback(function(e,t){xe.current+=1;var n=xe.current;null!=ye.current&&window.clearTimeout(ye.current);var i=null,o=0,r=0,a=function(){var l,c;if(xe.current===n){var u=null===(l=se.current)||void 0===l?void 0:l.querySelector(".rpv-core__inner-pages")
|
|
1
|
+
import{__assign as e,__awaiter as t,__generator as n}from"tslib";import{jsx as i,jsxs as o,Fragment as r}from"react/jsx-runtime";import{SpecialZoomLevel as a}from"@react-pdf-viewer/core";import l from"./PdfContainer.js";import c from"./PdfToolbar.js";import{pdfStyles as u}from"./PdfStyle.js";import{PdfHighlightControls as s}from"./usePdfHighlight.js";import"@react-pdf-viewer/zoom/lib/styles/index.css";import"@react-pdf-viewer/page-navigation/lib/styles/index.css";import"@react-pdf-viewer/core/lib/styles/index.css";import"@react-pdf-viewer/search/lib/styles/index.css";import d,{useRef as g,useState as f,useMemo as h,useEffect as v}from"react";import m from"../ScannedDocCitation/ScannedDocCitation.js";var p=function(e){switch(e){case"ActualSize":return a.ActualSize;case"PageFit":return a.PageFit;case"PageWidth":return a.PageWidth;default:return null!=e?e:a.PageWidth}},y=function(y){var x,P=y.pdfUrl,T=y.highlightText,w=y.highlightPages,C=y.highlightCordinatePages,b=y.highlightColor,S=void 0===b?"yellow":b,A=y.activeHighlightColor,_=void 0===A?"#f7dc51":A,I=y.jumpToPageValue,R=void 0===I?0:I,H=y.pdfName,L=y.onClose,q=y.customStyles,N=y.customClasses,j=y.customIcons,F=y.useCoordinates,B=y.fallbackPages,D=y.activeCitationIndex,M=y.onActiveCitationChange,V=y.headerAction,W=y.isZoomEnabled,z=void 0===W||W,E=y.showHighlightsAction,k=void 0===E||E,O=y.defaultScale,U=void 0===O?a.ActualSize:O,Z=y.useRange,J=void 0!==Z&&Z,K=y.rangeOfPages,G=void 0===K?null:K,Q=y.showFullScreenAction,X=void 0===Q||Q,Y=y.segments,$=void 0===Y?[{title:"Document 2",start_page:52,end_page:52,page_count:1}]:Y,ee=y.segmentTooltipText,te=y.onCurrentPageChange,ne=y.navigationRequest,ie=y.onNavigationSettled,oe=y.disablePdfAnnotations,re=void 0!==oe&&oe,ae=y.disablePdfTextLayer,le=void 0!==ae&&ae,ce=y.renderPage,ue=y.setRenderRange,se=g(null),de=f(0),ge=de[0],fe=de[1],he=f(0),ve=he[0],me=he[1],pe=g(null),ye=g(null),xe=g(0),Pe=h(function(){return re||le?function(t){var n=le?i("div",e({"aria-hidden":"true",style:{display:"none"}},{children:t.textLayer.children})):t.textLayer.children,a=e(e({},t),{annotationLayer:e(e({},t.annotationLayer),{children:re?null:t.annotationLayer.children}),textLayer:e(e({},t.textLayer),{children:n})});return ce?ce(a):o(r,{children:[t.canvasLayer.children,n,!re&&t.annotationLayer.children]})}:ce},[re,le,ce]),Te=h(function(){if(F)return new Set(C.map(function(e){return e.pageIndex}));var e=new Set;return Object.values(w).forEach(function(t){t>0&&e.add(t-1)}),e},[C,w,F]),we=(x=T)&&0!==x.length?x.filter(function(e){return!x.some(function(t){return t!==e&&t.includes(e)})}):x,Ce=s(we,F?{}:w,se,Te,F,F?C:[],S,_),be=Ce.highlightIndex,Se=Ce.cursorIndex,Ae=Ce.setCursorIndex,_e=Ce.orderedKeys,Ie=Ce.totalHighlights,Re=Ce.getValidPosition,He=Ce.tryJump,Le=Ce.jumpToPage,qe=Ce.plugins,Ne=Ce.controls,je=Ce.hideNonTargetHighlights,Fe=Ce.deduplicateHighlights,Be=Re(Se),De=h(function(){var e=ge+1;return $.find(function(t){return e>=t.start_page&&e<=t.end_page})},[ge,$]);v(function(){void 0!==D&&D!==Se&&Ae(D)},[D]);var Me=e(e({},Ne),{goToNext:function(){Se>=Ie-1||(Ne.goToNext(),M&&M(Se+1))},goToPrevious:function(){Se<=0||(Ne.goToPrevious(),M&&M(Se-1))}}),Ve=d.useCallback(function(e,t){xe.current+=1;var n=xe.current;null!=ye.current&&window.clearTimeout(ye.current);var i=null,o=0,r=0,a=function(){var l,c;if(xe.current===n){var u=null===(l=se.current)||void 0===l?void 0:l.querySelector(".rpv-core__inner-pages");if(u){var s=null===(c=se.current)||void 0===c?void 0:c.querySelector('[data-testid="core__page-layer-'.concat(t-1,'"]'));if(s){r+=1,u&&(i===u.scrollTop?o+=1:(i=u.scrollTop,o=0));var d=null==u?void 0:u.getBoundingClientRect(),g=null==s?void 0:s.getBoundingClientRect(),f=Boolean(d&&g&&g.bottom>d.top&&g.top<d.bottom);if(o>=2&&f||r>=40)return ye.current=null,void(null==ie||ie({pageNumber:t,requestId:e.requestId}));ye.current=window.setTimeout(a,50)}}}};ye.current=window.setTimeout(a,50)},[ie]);if(v(function(){return function(){xe.current+=1,null!=ye.current&&window.clearTimeout(ye.current)}},[]),v(function(){var e;if(ne&&!(ve<=0)){var t=Math.min(Math.max(Math.trunc(ne.pageNumber),1),ve),n="".concat(null!==(e=ne.requestId)&&void 0!==e?e:t,":").concat(t);pe.current!==n&&(pe.current=n,fe(t-1),Le(t-1),Ve(ne,t))}},[Le,ne,ve,Ve]),!P)return i(m,{pages:B,activeCitationIndex:D,onActiveCitationChange:M,headerAction:V});return o("div",e({ref:se,className:(null==N?void 0:N.pdfViewerWrapper)||"","data-disable-pdf-annotations":re?"true":void 0,style:e(e(e({height:"100%",minHeight:0,minWidth:0,overflow:"hidden",display:"flex",flexDirection:"column"},u.pdfViewer),{display:"flex",flexDirection:"column",height:"100%",width:"100%",backgroundColor:"#FAFAFA"}),null==q?void 0:q.pdfViewer)},{children:[i(c,{highlightIndex:be,totalHighlights:Ie,controls:Me,currentPosition:Be,pdfName:H,onClose:L,pdfUrl:P,viewerRef:se,customStyles:q,customClasses:N,customIcons:j,headerAction:V,isZoomEnabled:z,showHighlightsAction:k,showFullScreenAction:X,currentSegment:De,segmentTooltipText:ee,currentPage:ge+1,totalPages:ve,onPageNavigate:function(e){var t=Math.min(Math.max(e,1),ve||e);fe(t-1),Le(t-1)}}),i(l,{defaultScale:p(U),pdfUrl:P,plugins:qe,customStyles:q,onLoad:function(e){me(e.doc.numPages);var i=!F&&!J&&R<=0;if(R>0&&!J){var o=R-1,r=_e[o],a=w[r],l=C[o];Ae(o),console.log(l,"cordinateTargetHighlight"),F&&l.pageIndex>0&&Le(l.pageIndex),a>0&&(setTimeout(function(){je(Te),Fe(a-1)},1e3),F||Le(a-1))}else if(J&&G&&2===G.length){t(void 0,void 0,void 0,function(){var e,t,i,o,r;return n(this,function(n){switch(n.label){case 0:e=G[0],t=G[1],i=e,n.label=1;case 1:return i<=t?(Le(o=i-1),[4,new Promise(function(e){return setTimeout(e,1e3)})]):[3,4];case 2:if(n.sent(),je(Te),(r=Fe(o))&&r>0)return[3,4];n.label=3;case 3:return i++,[3,1];case 4:return[2]}})})}else if(!F&&w){var c=_e.find(function(e){return w[e]>0});if(void 0!==c){var u=w[c]-1;Le(u),setTimeout(function(){je(Te),Fe(u)},1e3)}}requestAnimationFrame(function(){i&&He(),!F&&R>0&&!J&&function(){if(se.current){var e=R-1,t=_e[e],n=w[t],i=n>0?n-1:0,o={};_e.forEach(function(e,t){var n=w[e];n>0&&(o[n]||(o[n]=[]),o[n].push(t))});var r=(o[n]||[]).indexOf(e),a=0,l=function(){var e,t;if(!(++a>40)){var n=null===(e=se.current)||void 0===e?void 0:e.querySelector(".rpv-core__inner-pages");if(n){var o=null===(t=se.current)||void 0===t?void 0:t.querySelector('[data-testid="core__page-layer-'.concat(i,'"]'));if(o){var c=n.getBoundingClientRect(),u=o.getBoundingClientRect();if(u.top<c.bottom&&u.bottom>c.top){var s=o.querySelectorAll(".rpv-search__highlight")[r];if(s){var d=s.getBoundingClientRect(),g=n.scrollTop+(d.top-c.top)-n.clientHeight/2+d.height/2;n.scrollTo({top:g,behavior:"smooth"})}else setTimeout(l,100)}else setTimeout(l,100)}else setTimeout(l,100)}else setTimeout(l,100)}};setTimeout(l,500)}}()})},onPageChange:function(e){var t=e.currentPage;fe(t),null==te||te(t+1),Te.has(t)?(Fe(t),je(Te)):je(Te)},renderPage:Pe,setRenderRange:ue})]}))};export{y as default};
|
|
2
2
|
//# sourceMappingURL=PdfViewer.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as
|
|
1
|
+
import{__assign as n}from"tslib";import{jsxs as i,jsx as e}from"react/jsx-runtime";import{useState as o,useMemo as t}from"react";import{Box as l}from"@mui/system";import{Typography as r,Chip as a,IconButton as c,Accordion as d,AccordionSummary as s,AccordionDetails as u,Divider as h}from"@mui/material";import f from"@mui/icons-material/Close";import m from"@mui/icons-material/ExpandMore";import{LightbulbOutlined as v,ManageSearchOutlined as x,ChatBubbleOutlineOutlined as p}from"@mui/icons-material";import g from"@mui/icons-material/AutoAwesome";import b from"../ChatCitation/ChatCitationRenderer.js";var y=function(n){var i=document.createElement("div");return i.innerHTML=n,Array.from(i.querySelectorAll("li")).map(function(n){return n.innerHTML})},C=function(i){var o=i.style;return e(l,n({component:"svg",viewBox:"0 0 24 24",sx:n({width:14,height:14,fill:"#5928ed"},o)},{children:e("path",{d:"M12 2a7 7 0 0 0-4 12.74V17a2 2 0 0 0 2 2h4a2 2 0 0 0 2-2v-2.26A7 7 0 0 0 12 2zm-1 19h2v1h-2v-1z"})}))},_=function(_){var S,k=_.open,z=_.onClose,I=_.data,w=_.styles,A=o(null),B=A[0],R=A[1],D=t(function(){var n;return B&&I&&null!==(n=I.block_cognitive_citations.find(function(n){return String(n.citation_number)===B}))&&void 0!==n?n:null},[B,I]),T=t(function(){return(null==I?void 0:I.block_cognitive_reasoning_html)?y(I.block_cognitive_reasoning_html):[]},[null==I?void 0:I.block_cognitive_reasoning_html]),M=t(function(){return(null==I?void 0:I.block_cognitive_gap_html)?y(I.block_cognitive_gap_html):[]},[null==I?void 0:I.block_cognitive_gap_html]),W=function(o,t){for(var r,a,c,d,s,u,h,f=[],m=/<a[^>]*href="([^"]+)"[^>]*>(.*?)<\/a>/g,v=0,x=0,g=function(){var g=h[1].replace(/^.*\$/,""),y=h[2],C=B===g;h.index>v&&f.push(e("span",{children:o.substring(v,h.index)},"txt-".concat(t,"-").concat(x++))),f.push(i("span",{children:[i("span",n({onClick:function(){return R(function(n){return n===g?null:g})},style:n({color:"#2563EB",fontWeight:500,cursor:"pointer",textDecoration:"underline"},null==w?void 0:w.citationLink)},{children:[y,e(p,{sx:{fontSize:"12px",ml:.2}})]})),C&&D&&e(l,n({sx:n({maxHeight:"35vh",padding:"6px",overflow:"auto",backgroundColor:"#ffffff",mt:1},null==w?void 0:w.citationContainer)},{children:e(b,{showRootContainer:!1,modalContainerStyle:null==w?void 0:w.citationModalContainer,rootContainer:{relevanceScore:null!==(r=null==I?void 0:I.block_cognitive_confidence)&&void 0!==r?r:0,slotStyles:{container:n({border:"",paddingLeft:"-20px",color:null!==(c=null===(a=null==w?void 0:w.textContent)||void 0===a?void 0:a.color)&&void 0!==c?c:"black"},null==w?void 0:w.citationRootContainer)}},ruleBookContainer:{title:D.training_data_title||D.title||D.section_ref||"Rule Book",data:{content:(null===(d=D.data_sources)||void 0===d?void 0:d.join("\n\n"))||D.content||D.paraphrase||"",highlighted_texts:D.paraphrase?Array.isArray(D.paraphrase)?D.paraphrase:[D.paraphrase]:Array.isArray(D.highlight)?D.highlight:D.highlight?[D.highlight]:[]},slotStyles:{title:null==w?void 0:w.citationTitle,body:null==w?void 0:w.citationBody,dataContainer:null==w?void 0:w.citationDataContainer,outerContainer:n({margin:"0",color:null!==(u=null===(s=null==w?void 0:w.textContent)||void 0===s?void 0:s.color)&&void 0!==u?u:"black",minHeight:"350px"},null==w?void 0:w.citationRuleBookContainer)}},additionalData:{RuleBookDetailedViewVerticallyStacked:!0},reversePanels:!0})}))]},"anchor-".concat(t,"-").concat(g))),v=m.lastIndex};null!==(h=m.exec(o));)g();return v<o.length&&f.push(e("span",{children:o.substring(v)},"txt-end-".concat(t,"-").concat(x++))),f};return k?i(l,n({sx:n({width:"min(500px, calc(100vw - 16px))",maxWidth:"calc(100vw - 16px)",maxHeight:"80vh",borderRadius:3,display:"flex",flexDirection:"column",overflow:"hidden",border:"1px solid #e0e0e0",backgroundColor:"#fff",color:"#111827"},null==w?void 0:w.container)},{children:[i(l,n({sx:n({px:2,py:1,borderBottom:"1px solid #e0e0e0",display:"flex",justifyContent:"space-between",alignItems:"center",flexShrink:0,backgroundColor:"#e9ecfd"},null==w?void 0:w.header)},{children:[i(l,n({display:"flex",alignItems:"center",gap:1},{children:[e(C,{style:null==w?void 0:w.headerIcon}),e(r,n({fontWeight:500,sx:n({fontSize:"0.72rem"},null==w?void 0:w.headerTitleText)},{children:"Cognitive Decisioning AI"}))]})),i(l,n({display:"flex",alignItems:"center",gap:1},{children:[e(a,{icon:e(g,{sx:{fontSize:12}}),label:"AI Relevance: ".concat(null!==(S=null==I?void 0:I.block_cognitive_confidence)&&void 0!==S?S:0,"%"),size:"small",sx:n({fontWeight:500,fontSize:"0.68rem",backgroundColor:"#ffffff",color:"#000000",border:"1px solid #ac93f6",height:20,"& .MuiChip-label":{fontSize:"0.68rem",px:.75}},null==w?void 0:w.badge)}),e(c,n({size:"small",onClick:z,sx:null==w?void 0:w.closeButton},{children:e(f,{fontSize:"small"})}))]}))]})),i(l,n({sx:n({flex:1,overflowY:"auto",p:.5},null==w?void 0:w.body)},{children:[i(d,n({defaultExpanded:!0,disableGutters:!0,elevation:0,sx:null==w?void 0:w.accordion},{children:[e(s,n({expandIcon:e(m,{}),sx:null==w?void 0:w.accordionSummary},{children:i(r,n({sx:n({display:"flex",alignItems:"center",gap:.8,fontSize:"0.78rem"},null==w?void 0:w.sectionTitle),fontWeight:600},{children:[e(l,n({sx:n({width:24,height:24,borderRadius:"50%",backgroundColor:"#e9ecfd",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},null==w?void 0:w.sectionIcon)},{children:e(v,{sx:{fontSize:14,color:"#5928ed"}})})),"Decision Making Factors"]}))})),e(u,n({sx:null==w?void 0:w.accordionDetails},{children:e(l,n({sx:{padding:0,margin:0}},{children:T.length>0?T.map(function(o,t){return i(l,n({sx:n({marginBottom:"6px",display:"flex",gap:1},null==w?void 0:w.sectionItem)},{children:[i(r,n({variant:"body2",sx:n({fontWeight:500,fontSize:"0.75rem"},null==w?void 0:w.indexText)},{children:[t+1,"."]})),e(l,n({sx:{flex:1}},{children:e(r,n({variant:"body2",component:"span",sx:n({fontSize:"0.75rem"},null==w?void 0:w.textContent)},{children:W(o,t)}))}))]}),t)}):e(r,n({variant:"body2",color:"gray",sx:n({mb:.5,pl:3,fontSize:"0.72rem"},null==w?void 0:w.sectionSubtitle)},{children:"No Reasons Found"}))}))}))]})),e(h,{}),i(d,n({disableGutters:!0,elevation:0,sx:null==w?void 0:w.accordion},{children:[e(s,n({expandIcon:e(m,{}),sx:null==w?void 0:w.accordionSummary},{children:i(r,n({sx:n({display:"flex",alignItems:"center",gap:.8,fontSize:"0.78rem"},null==w?void 0:w.sectionTitle),fontWeight:600},{children:[e(l,n({sx:n({width:24,height:24,borderRadius:"50%",backgroundColor:"#e9ecfd",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},null==w?void 0:w.sectionIcon)},{children:e(x,{sx:{fontSize:14,color:"#5928ed"}})})),"Gaps in Decision"]}))})),e(u,n({sx:null==w?void 0:w.accordionDetails},{children:e(l,n({sx:{padding:0,margin:0}},{children:M.length>0?M.map(function(o,t){return i(l,n({sx:n({marginBottom:"6px",display:"flex",gap:1},null==w?void 0:w.sectionItem)},{children:[i(r,n({variant:"body2",sx:n({fontWeight:500,fontSize:"0.75rem"},null==w?void 0:w.indexText)},{children:[t+1,"."]})),e(r,{variant:"body2",component:"span",sx:n({fontSize:"0.75rem"},null==w?void 0:w.textContent),dangerouslySetInnerHTML:{__html:o}})]}),t)}):e(r,n({variant:"body2",color:"gray",sx:n({mb:.5,pl:3,fontSize:"0.72rem"},null==w?void 0:w.sectionSubtitle)},{children:"No Gaps Found"}))}))}))]}))]}))]})):null};export{_ as default};
|
|
2
2
|
//# sourceMappingURL=Cognitivereasoningpanel.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as e,__spreadArray as n}from"tslib";import{jsxs as t,Fragment as r,jsx as i}from"react/jsx-runtime";import a,{useState as o,useCallback as l,useRef as c,useMemo as d,useEffect as s}from"react";import f from"@mui/material/Dialog";import u from"@mui/icons-material/Fullscreen";import h from"@mui/icons-material/CloseFullscreen";var p=170,g=48,y=["#ede9fe","#e0f2fe","#fef3c7","#dcfce7","#ffe4e6","#f0fdf4","#fef9c3","#e0e7ff","#fce7f3","#f1f5f9"],v=["#7c3aed","#0284c7","#b45309","#16a34a","#e11d48","#15803d","#a16207","#4338ca","#db2777","#475569"],x=["⚙","◈","⟐","✦","◎","⬡","◇","⊕","✶","◉"],b=["#a78bfa","#7dd3fc","#fbbf24","#86efac","#fda4af","#6ee7b7","#fde047","#a5b4fc","#f9a8d4","#94a3b8"],m=["linear-gradient(135deg,#7c3aed,#a78bfa)","linear-gradient(135deg,#0284c7,#38bdf8)","linear-gradient(135deg,#b45309,#fbbf24)","linear-gradient(135deg,#16a34a,#86efac)","linear-gradient(135deg,#e11d48,#fda4af)","linear-gradient(135deg,#15803d,#6ee7b7)","linear-gradient(135deg,#a16207,#fde047)","linear-gradient(135deg,#4338ca,#a5b4fc)","linear-gradient(135deg,#db2777,#f9a8d4)","linear-gradient(135deg,#475569,#94a3b8)"];function w(t){var r=Array.isArray(null==t?void 0:t.clusters)?t.clusters:[],i=Array.isArray(null==t?void 0:t.nodes)?t.nodes:[],a=Array.isArray(null==t?void 0:t.edges)?t.edges:[],o=function(e,t,r){var i;void 0===e&&(e=[]),void 0===t&&(t=[]),void 0===r&&(r=[]);var a=Array.isArray(e)?e:[],o=Array.isArray(t)?t:[],l=Array.isArray(r)?r:[],c=a.length;if(0===c)return new Map;var d={};a.forEach(function(e,n){d[e.id]=n});var s={},f={};a.forEach(function(e){s[e.id]=[],f[e.id]=[]}),o.forEach(function(e){s[e.source]&&s[e.source].push(e.target),f[e.target]&&f[e.target].push(e.source)});var u={};a.forEach(function(e){u[e.id]=0});for(var h=0;h<c;h++){for(var p=!1,g=0,y=o;g<y.length;g++){var v=y[g],x=(u[v.source]||0)+1;x>(u[v.target]||0)&&x<c&&(u[v.target]=x,p=!0)}if(!p)break}var b={};l.forEach(function(e,n){b[e.id]=n});var m={};l.forEach(function(e){m[e.id]=[]}),a.forEach(function(e){var n;null===(n=m[e.cluster_id])||void 0===n||n.push(e)}),Object.values(m).forEach(function(e){return e.sort(function(e,n){return(u[e.id]||0)-(u[n.id]||0)})});for(var w=new Float64Array(c),M=new Float64Array(c),k=new Float64Array(c),S=new Float64Array(c),C=function(e){var n=null!==(i=b[e.id])&&void 0!==i?i:0;(m[e.id]||[]).forEach(function(e,t){var r=d[e.id];w[r]=520*n+280,M[r]=200*t+120})},z=0,E=l;z<E.length;z++)C(V=E[z]);for(var A=.0015,F=Math.max.apply(Math,n(n([],a.map(function(e){return u[e.id]||0}),!1),[1],!1)),I=new Float64Array(c),W=0;W<c;W++)I[W]=(u[a[W].id]||0)/F*(200*c*.6)+120;for(var R=0;R<350;R++){var D=Math.max(.015,1-R/350),Y=new Float64Array(c),_=new Float64Array(c);for(W=0;W<c;W++)for(var j=W+1;j<c;j++){var P=(Q=w[W]-w[j])*Q+(U=M[W]-M[j])*U;P<400&&(P=(Q=12*(W-j))*Q+(U=8*(W+j))*U);var B=Q/(O=Math.sqrt(P))*(q=48e4/P),L=U/O*q;Y[W]+=B,_[W]+=L,Y[j]-=B,_[j]-=L}for(var X=0,N=o;X<N.length;X++){v=N[X];var T=d[v.source],H=d[v.target];if(void 0!==T&&void 0!==H){var O,q,Q=w[H]-w[T],U=M[H]-M[T];if(!((O=Math.sqrt(Q*Q+U*U))<1))B=Q/O*(q=.004*(O-380)),L=U/O*q,Y[T]+=B,_[T]+=L,Y[H]-=B,_[H]-=L}}var G={},J={},K={};for(W=0;W<c;W++)G[V=a[W].cluster_id]=(G[V]||0)+w[W],J[V]=(J[V]||0)+M[W],K[V]=(K[V]||0)+1;for(W=0;W<c;W++){var V=a[W].cluster_id;Y[W]+=(G[V]/K[V]-w[W])*A,_[W]+=(J[V]/K[V]-M[W])*A}for(W=0;W<c;W++)_[W]+=.002*(I[W]-M[W]);for(W=0;W<c;W++)k[W]=.84*(k[W]+Y[W])*D,S[W]=.84*(S[W]+_[W])*D,w[W]+=k[W],M[W]+=S[W]}for(h=0;h<40;h++){var Z=!1;for(W=0;W<c;W++)for(j=W+1;j<c;j++){Q=w[W]-w[j],U=M[W]-M[j];var $=270-Math.abs(Q),ee=128-Math.abs(U);if($>0&&ee>0)if(Z=!0,$<ee){var ne=$/2+5;w[W]+=Q>0?ne:-ne,w[j]-=Q>0?ne:-ne}else ne=ee/2+5,M[W]+=U>0?ne:-ne,M[j]-=U>0?ne:-ne}if(!Z)break}var te=1/0,re=1/0;for(W=0;W<c;W++)te=Math.min(te,w[W]),re=Math.min(re,M[W]);var ie=new Map;for(W=0;W<c;W++)ie.set(a[W].id,{x:Math.round(w[W]-te+80),y:Math.round(M[W]-re+80)});return ie}(i,a,r),l=i.map(function(n){var t=o.get(n.id)||{x:0,y:0};return e(e({},n),{x:t.x,y:t.y})}),c={};r.forEach(function(e,n){c[e.id]=n});var d={};r.forEach(function(e){d[e.id]=[]}),l.forEach(function(e){var n;null===(n=d[e.cluster_id])||void 0===n||n.push(e)});var s=36,f=r.map(function(e){var n=d[e.id];if(!n.length)return null;var t=Math.min.apply(Math,n.map(function(e){return e.x})),r=Math.min.apply(Math,n.map(function(e){return e.y})),i=Math.max.apply(Math,n.map(function(e){return e.x+p})),a=Math.max.apply(Math,n.map(function(e){return e.y+g}));return{id:e.id,label:e.label,idx:c[e.id],x:t-s,y:r-s,width:i-t+72,height:a-r+72+22}}).filter(function(e){return null!==e});return{nodes:l.map(function(n){var t;return e(e({},n),{cluster:null!==(t=c[n.cluster_id])&&void 0!==t?t:0})}),edges:a,clusterBounds:f,canvasW:Math.max.apply(Math,l.map(function(e){return e.x+p}))+72,canvasH:Math.max.apply(Math,l.map(function(e){return e.y+g}))+72}}function M(e,n,t){var r=n[e.source],i=n[e.target];if(!r||!i)return"";var a=function(e,n){var t=e.x+85,r=e.y+24,i=n.x+85,a=n.y+24;function o(e,n,t,r){var i=t-e,a=r-n;return Math.abs(a)>.4*Math.abs(i)?a>0?{x:e,y:n+24}:{x:e,y:n-24}:i>0?{x:e+85,y:n}:{x:e-85,y:n}}return{source:o(t,r,i,a),target:o(i,a,t,r)}}(r,i),o=a.source,l=a.target,c=l.x-o.x,d=l.y-o.y,s=Math.sqrt(c*c+d*d);if(s<5)return"M ".concat(o.x," ").concat(o.y," L ").concat(l.x," ").concat(l.y);if(i.y+150<r.y&&i.y<r.y-g){var f=Math.min(r.x,i.x)-110;return"M ".concat(o.x," ").concat(o.y," C ").concat(f," ").concat(o.y,", ").concat(f," ").concat(l.y,", ").concat(l.x," ").concat(l.y)}var u=-d/s,h=c/s;if(t.some(function(n){return n.source===e.target&&n.target===e.source})){var p=e.source<e.target?1:-1,y=Math.max(.18*s,40)*p,v=(o.x+l.x)/2+u*y,x=(o.y+l.y)/2+h*y;return"M ".concat(o.x," ").concat(o.y," Q ").concat(v," ").concat(x," ").concat(l.x," ").concat(l.y)}var b=Math.min(.12*s,55),m=(o.x+l.x)/2+u*b,w=(o.y+l.y)/2+h*b;return"M ".concat(o.x," ").concat(o.y," Q ").concat(m," ").concat(w," ").concat(l.x," ").concat(l.y)}function k(n){var a,f,k=n.data,S=n.onFullscreen,C=n.isFullscreen,z=n.isDarkMode,E=void 0!==z&&z,A=c(null),F=o({x:0,y:0}),I=F[0],W=F[1],R=o(.5),D=R[0],Y=R[1],_=o(!1),j=_[0],P=_[1],B=c({x:0,y:0}),L=c({x:0,y:0}),X=o(null),N=X[0],T=X[1],H=o(null),O=H[0],q=H[1],Q=o(null),U=Q[0],G=Q[1],J=o(null),K=J[0],V=J[1],Z=d(function(){return w(k)},[k]),$=d(function(){var e={};return Z.nodes.forEach(function(n){e[n.id]=n}),e},[Z]),ee=d(function(){var e={};return k.clusters.forEach(function(n,t){e[n.id]=t}),e},[k]),ne=d(function(){return K?new Set(Z.edges.filter(function(e){return e.source===K||e.target===K}).map(function(e){return e.id})):new Set},[K,Z.edges]),te=d(function(){if(!K)return new Set;var e=new Set([K]);return Z.edges.forEach(function(n){n.source===K&&e.add(n.target),n.target===K&&e.add(n.source)}),e},[K,Z.edges]),re=d(function(){return new Date(k.last_analyzed_at).toLocaleString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0,day:"numeric",month:"short",year:"numeric"})},[k.last_analyzed_at]),ie=l(function(n){n.target.closest("[data-edge-hit]")||n.target.closest("[data-node]")||(P(!0),B.current={x:n.clientX,y:n.clientY},L.current=e({},I),n.currentTarget.style.cursor="grabbing")},[I]),ae=l(function(e){j&&W({x:L.current.x+(e.clientX-B.current.x),y:L.current.y+(e.clientY-B.current.y)})},[j]),oe=l(function(){P(!1),A.current&&(A.current.style.cursor="grab")},[]),le=l(function(e){e.preventDefault(),Y(function(n){return Math.min(2.5,Math.max(.2,n-.001*e.deltaY))})},[]);s(function(){var e=A.current;return e&&e.addEventListener("wheel",le,{passive:!1}),function(){return null==e?void 0:e.removeEventListener("wheel",le)}},[le]);var ce={width:32,height:32,border:"none",background:"transparent",borderRadius:8,cursor:"pointer",fontSize:16,color:E?"#cbd5e1":"#475569",display:"flex",alignItems:"center",justifyContent:"center",fontWeight:500};return t("div",e({style:{width:"100%",height:"100%",background:E?"#090d16":"#ffffff",fontFamily:"'Inter', -apple-system, BlinkMacSystemFont, sans-serif",position:"relative",overflow:"hidden"}},{children:[t("div",e({style:{position:"absolute",top:0,left:0,right:0,zIndex:20,borderBottom:C?E?"1px solid #1e293b":"1px solid #f1f5f9":"none",background:E?"#090d16":C?"#fff":"transparent"}},{children:[t("div",e({style:{padding:"10px 14px",display:"flex",alignItems:"center",justifyContent:"space-between"}},{children:[t("div",{children:[C&&i("h2",e({style:{margin:0,fontSize:17,fontWeight:700,color:E?"#f8fafc":"#1e293b"}},{children:"Dependency Graph"})),t("p",e({style:{margin:"2px 0 0",fontSize:12,color:"#94a3b8"}},{children:["Last analyzed: ".concat(re||""," · "),"Click a node or connection to explore details and dependencies."]}))]}),t("div",e({style:{display:"flex",gap:6,alignItems:"center"}},{children:[t("div",e({style:{display:"flex",gap:2,background:E?"#1e293b":"#fff",borderRadius:10,padding:3,boxShadow:E?"0 1px 4px rgba(0,0,0,0.4)":"0 1px 4px rgba(0,0,0,0.08)"}},{children:[i("button",e({onClick:function(){return Y(function(e){return Math.max(.2,e-.15)})},style:ce},{children:"−"})),t("button",e({onClick:function(){Y(.5),W({x:0,y:0})},style:e(e({},ce),{fontSize:11,width:52,fontWeight:600})},{children:[Math.round(100*D)||0,"%"]})),i("button",e({onClick:function(){return Y(function(e){return Math.min(2.5,e+.15)})},style:ce},{children:"+"}))]})),S&&i("div",e({style:{display:"flex",background:E?"#1e293b":"#fff",borderRadius:10,padding:3,boxShadow:E?"0 1px 4px rgba(0,0,0,0.4)":"0 1px 4px rgba(0,0,0,0.08)"}},{children:i("button",e({onClick:S,style:ce},{children:i(C?h:u,{style:{fontSize:16}})}))}))]}))]})),O&&i("div",e({style:{margin:"0 20px 14px",width:"30%",minWidth:280,borderRadius:12,overflow:"hidden",boxShadow:"0 2px 12px rgba(0,0,0,0.07)",border:"1px solid #e2e8f0",animation:"slideDown 0.2s ease-out"}},{children:function(){var n,r,a=O.node,o=null!==(n=ee[a.cluster_id])&&void 0!==n?n:0;return Z.edges.filter(function(e){return e.source===a.id}).length,Z.edges.filter(function(e){return e.target===a.id}).length,t("div",{children:[t("div",e({style:{padding:"10px 14px",background:m[o%m.length||0],color:"#fff",display:"flex",alignItems:"center",justifyContent:"space-between"}},{children:[t("div",e({style:{display:"flex",alignItems:"center",gap:10}},{children:[i("span",e({style:{width:28,height:28,borderRadius:8,background:"rgba(255,255,255,0.2)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:14}},{children:x[o%x.length||0]})),t("div",{children:[i("div",e({style:{fontSize:9,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.06em",opacity:.75}},{children:(null===(r=k.clusters[o])||void 0===r?void 0:r.label)||"Cluster Name"})),i("div",e({style:{fontSize:14,fontWeight:700,marginTop:1}},{children:a.label||"Cluster Name"}))]})]})),i("button",e({onClick:function(){q(null),V(null)},style:{background:"rgba(255,255,255,0.2)",border:"none",color:"#fff",borderRadius:6,width:24,height:24,cursor:"pointer",fontSize:14,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0}},{children:"×"}))]})),i("div",e({style:{padding:"10px 14px",fontSize:13,lineHeight:1.6,color:E?"#cbd5e1":"#475569",background:E?"#1e293b":"#fff"}},{children:a.description||"No description available..."}))]})}()}))]})),t("div",e({ref:A,onPointerDown:ie,onPointerMove:ae,onPointerUp:oe,onPointerLeave:oe,onClick:function(){T(null),q(null),V(null)},style:{width:"100%",height:"100%",cursor:j?"grabbing":"grab",position:"relative"}},{children:[i("div",e({style:{transform:"translate(".concat(I.x,"px, ").concat(I.y,"px) scale(").concat(D,")"),transformOrigin:"top left",position:"absolute",top:C?70:50,left:20,transition:j?"none":"transform 0.08s ease-out"}},{children:t("svg",e({width:Z.canvasW,height:Z.canvasH,style:{overflow:"visible"}},{children:[Z.clusterBounds.map(function(n){return t("g",{children:[i("rect",{x:n.x,y:n.y,width:n.width,height:n.height,rx:"16",fill:E?"rgba(30, 41, 59, 0.35)":"none",stroke:E?"#334155":"#e2e8f0",strokeWidth:"1.5",strokeDasharray:"8 4"}),i("text",e({x:n.x+14,y:n.y+n.height-10,fontSize:"11",fill:"#94a3b8",fontFamily:"Inter, sans-serif",fontWeight:"500"},{children:n.label||"Cluster Name"}))]},n.id)}),Z.edges.map(function(n){var a=M(n,$,Z.edges);if(!a)return null;var o=ne.has(n.id),l=(null==N?void 0:N.edge.id)===n.id,c=U===n.id,d=o||l?"#6366f1":c?"#818cf8":E?"#475569":"#cbd5e1",s=o||l?2.5:c?2:1.5;return t("g",e({style:{opacity:!!K&&!o?.1:1,transition:"opacity 0.25s"}},{children:[i("path",{"data-edge-hit":"true",d:a,fill:"none",stroke:"transparent",strokeWidth:18,style:{cursor:"pointer"},onClick:function(e){return function(e,n){e.stopPropagation();var t=A.current.getBoundingClientRect();T({edge:n,screenX:e.clientX-t.left,screenY:e.clientY-t.top}),q(null),V(null)}(e,n)},onMouseEnter:function(){return G(n.id)},onMouseLeave:function(){return G(null)}}),i("path",{d:a,fill:"none",stroke:d,strokeWidth:s,style:{transition:"stroke 0.2s, stroke-width 0.2s",pointerEvents:"none"}}),(o||l)&&t(r,{children:[i("circle",e({r:4,fill:"#6366f1"},{children:i("animateMotion",{dur:"1.8s",repeatCount:"indefinite",path:a})})),i("circle",e({r:6,fill:"#6366f1",opacity:.2},{children:i("animateMotion",{dur:"1.8s",repeatCount:"indefinite",path:a})}))]})]}),n.id)}),Z.nodes.map(function(n){var r,a=K===n.id,o=te.has(n.id),l=!!K&&!o,c=(null!==(r=ee[n.cluster_id])&&void 0!==r?r:0)%b.length,d=b[c||0];return i("g",e({"data-node":"true",onClick:function(e){return function(e,n){e.stopPropagation();var t=A.current.getBoundingClientRect();K===n.id?(V(null),q(null)):(V(n.id),q({node:n,screenX:e.clientX-t.left,screenY:e.clientY-t.top}),T(null))}(e,n)},style:{cursor:"pointer",opacity:l?.15:1,transition:"opacity 0.25s"}},{children:i("foreignObject",e({x:n.x,y:n.y,width:p,height:g},{children:t("div",e({style:{background:E?"#1e293b":"#fff",border:a?"2.5px solid ".concat(d):E?"1.5px solid #334155":"1.5px solid #e2e8f0",borderRadius:10,padding:"8px 14px",fontSize:13,fontWeight:600,color:E?"#f1f5f9":"#334155",fontFamily:"'Inter', sans-serif",display:"flex",alignItems:"center",gap:8,boxShadow:a?"0 0 0 3px ".concat(d,"33, 0 2px 8px rgba(0,0,0,0.4)"):E?"0 2px 6px rgba(0,0,0,0.3)":"0 1px 3px rgba(0,0,0,0.05)",whiteSpace:"nowrap",userSelect:"none",height:46,boxSizing:"border-box",transition:"border 0.2s, box-shadow 0.2s"}},{children:[i("span",e({style:{width:22,height:22,borderRadius:6,background:y[c],display:"flex",alignItems:"center",justifyContent:"center",fontSize:11,flexShrink:0,color:v[c]}},{children:x[c]})),i("span",e({style:{overflow:"hidden",textOverflow:"ellipsis"}},{children:n.label||"Node name"}))]}))}))}),n.id)})]}))})),N&&t("div",e({onClick:function(e){return e.stopPropagation()},style:e(e({position:"absolute"},function(e,n,t,r){if(!A.current)return{};var i=A.current.getBoundingClientRect(),a=e+14,o=n-r/2;return a+t>i.width&&(a=e-t-14),o<8&&(o=8),o+r>i.height&&(o=i.height-r-8),{left:a,top:o}}(N.screenX,N.screenY,320,180)),{width:320,background:"#fff",borderRadius:14,boxShadow:"0 8px 30px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06)",border:"1px solid #e2e8f0",zIndex:30,animation:"popIn 0.18s ease-out",overflow:"hidden"})},{children:[t("div",e({style:{padding:"12px 16px 10px",background:"linear-gradient(135deg, #6366f1, #8b5cf6)",color:"#fff"}},{children:[i("div",e({style:{fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.06em",opacity:.8}},{children:"Edge Reasoning"})),t("div",e({style:{fontSize:13,fontWeight:600,marginTop:4}},{children:[(null===(a=$[N.edge.source])||void 0===a?void 0:a.label)||"Source",i("span",e({style:{opacity:.6,margin:"0 6px"}},{children:"→"})),(null===(f=$[N.edge.target])||void 0===f?void 0:f.label)||"Target"]}))]})),i("div",e({style:{padding:"12px 16px 14px",fontSize:13,lineHeight:1.6,color:"#475569",whiteSpace:"pre-line"}},{children:N.edge.reasoning||"No Reasoning available..."})),i("button",e({onClick:function(){return T(null)},style:{position:"absolute",top:8,right:10,background:"rgba(255,255,255,0.2)",border:"none",color:"#fff",borderRadius:6,width:24,height:24,cursor:"pointer",fontSize:14,display:"flex",alignItems:"center",justifyContent:"center"}},{children:"×"}))]}))]})),i("style",{children:"\n @keyframes popIn { from { opacity:0; transform:scale(0.95) translateY(4px); } to { opacity:1; transform:scale(1) translateY(0); } }\n @keyframes slideDown { from { opacity:0; transform:translateY(-6px); } to { opacity:1; transform:translateY(0); } }\n "})]}))}var S=a.memo(function(n){var a=n.data,c=n.isDarkMode,d=void 0!==c&&c,s=n.style,u=o(!1),h=u[0],p=u[1],g=l(function(){p(!0)},[]),y=l(function(){p(!1)},[]);return t(r,{children:[i("div",e({style:e({position:"relative",width:"100%",height:"500px"},s)},{children:i(k,{data:a,onFullscreen:g,isDarkMode:d})})),i(f,e({open:h,onClose:y,maxWidth:!1,PaperProps:{style:{width:"95vw",height:"92vh",maxWidth:"none",borderRadius:12,overflow:"hidden",background:d?"#090d16":"#ffffff"}}},{children:i("div",e({style:{width:"100%",height:"100%",position:"relative"}},{children:i(k,{data:a,onFullscreen:y,isFullscreen:!0,isDarkMode:d})}))}))]})});export{S as default};
|
|
1
|
+
import{__rest as e,__assign as n,__spreadArray as r}from"tslib";import{jsxs as t,Fragment as o,jsx as i}from"react/jsx-runtime";import l,{useState as a,useCallback as d,useRef as c,useMemo as u,useEffect as s}from"react";import f from"@mui/material/Dialog";import v from"@mui/icons-material/Fullscreen";import p from"@mui/icons-material/CloseFullscreen";var h=170,g=48,y=["#ede9fe","#e0f2fe","#fef3c7","#dcfce7","#ffe4e6","#f0fdf4","#fef9c3","#e0e7ff","#fce7f3","#f1f5f9"],b=["#7c3aed","#0284c7","#b45309","#16a34a","#e11d48","#15803d","#a16207","#4338ca","#db2777","#475569"],x=["⚙","◈","⟐","✦","◎","⬡","◇","⊕","✶","◉"],m=["#a78bfa","#7dd3fc","#fbbf24","#86efac","#fda4af","#6ee7b7","#fde047","#a5b4fc","#f9a8d4","#94a3b8"],w=["linear-gradient(135deg,#7c3aed,#a78bfa)","linear-gradient(135deg,#0284c7,#38bdf8)","linear-gradient(135deg,#b45309,#fbbf24)","linear-gradient(135deg,#16a34a,#86efac)","linear-gradient(135deg,#e11d48,#fda4af)","linear-gradient(135deg,#15803d,#6ee7b7)","linear-gradient(135deg,#a16207,#fde047)","linear-gradient(135deg,#4338ca,#a5b4fc)","linear-gradient(135deg,#db2777,#f9a8d4)","linear-gradient(135deg,#475569,#94a3b8)"];function k(e){var t=Array.isArray(null==e?void 0:e.clusters)?e.clusters:[],o=Array.isArray(null==e?void 0:e.nodes)?e.nodes:[],i=Array.isArray(null==e?void 0:e.edges)?e.edges:[],l=function(e,n,t){var o;void 0===e&&(e=[]),void 0===n&&(n=[]),void 0===t&&(t=[]);var i=Array.isArray(e)?e:[],l=Array.isArray(n)?n:[],a=Array.isArray(t)?t:[],d=i.length;if(0===d)return new Map;var c={};i.forEach(function(e,n){c[e.id]=n});var u={},s={};i.forEach(function(e){u[e.id]=[],s[e.id]=[]}),l.forEach(function(e){u[e.source]&&u[e.source].push(e.target),s[e.target]&&s[e.target].push(e.source)});var f={};i.forEach(function(e){f[e.id]=0});for(var v=0;v<d;v++){for(var p=!1,h=0,g=l;h<g.length;h++){var y=g[h],b=(f[y.source]||0)+1;b>(f[y.target]||0)&&b<d&&(f[y.target]=b,p=!0)}if(!p)break}var x={};a.forEach(function(e,n){x[e.id]=n});var m={};a.forEach(function(e){m[e.id]=[]}),i.forEach(function(e){var n;null===(n=m[e.cluster_id])||void 0===n||n.push(e)}),Object.values(m).forEach(function(e){return e.sort(function(e,n){return(f[e.id]||0)-(f[n.id]||0)})});for(var w=new Float64Array(d),k=new Float64Array(d),M=new Float64Array(d),C=new Float64Array(d),S=function(e){var n=null!==(o=x[e.id])&&void 0!==o?o:0;(m[e.id]||[]).forEach(function(e,r){var t=c[e.id];w[t]=520*n+280,k[t]=200*r+120})},E=0,z=a;E<z.length;E++)S(V=z[E]);for(var P=.0015,A=Math.max.apply(Math,r(r([],i.map(function(e){return f[e.id]||0}),!1),[1],!1)),F=new Float64Array(d),I=0;I<d;I++)F[I]=(f[i[I].id]||0)/A*(200*d*.6)+120;for(var W=0;W<350;W++){var R=Math.max(.015,1-W/350),B=new Float64Array(d),D=new Float64Array(d);for(I=0;I<d;I++)for(var Y=I+1;Y<d;Y++){var _=(Q=w[I]-w[Y])*Q+(U=k[I]-k[Y])*U;_<400&&(_=(Q=12*(I-Y))*Q+(U=8*(I+Y))*U);var j=Q/(O=Math.sqrt(_))*(q=48e4/_),N=U/O*q;B[I]+=j,D[I]+=N,B[Y]-=j,D[Y]-=N}for(var L=0,X=l;L<X.length;L++){y=X[L];var H=c[y.source],T=c[y.target];if(void 0!==H&&void 0!==T){var O,q,Q=w[T]-w[H],U=k[T]-k[H];if(!((O=Math.sqrt(Q*Q+U*U))<1))j=Q/O*(q=.004*(O-380)),N=U/O*q,B[H]+=j,D[H]+=N,B[T]-=j,D[T]-=N}}var G={},J={},K={};for(I=0;I<d;I++)G[V=i[I].cluster_id]=(G[V]||0)+w[I],J[V]=(J[V]||0)+k[I],K[V]=(K[V]||0)+1;for(I=0;I<d;I++){var V=i[I].cluster_id;B[I]+=(G[V]/K[V]-w[I])*P,D[I]+=(J[V]/K[V]-k[I])*P}for(I=0;I<d;I++)D[I]+=.002*(F[I]-k[I]);for(I=0;I<d;I++)M[I]=.84*(M[I]+B[I])*R,C[I]=.84*(C[I]+D[I])*R,w[I]+=M[I],k[I]+=C[I]}for(v=0;v<40;v++){var Z=!1;for(I=0;I<d;I++)for(Y=I+1;Y<d;Y++){Q=w[I]-w[Y],U=k[I]-k[Y];var $=270-Math.abs(Q),ee=128-Math.abs(U);if($>0&&ee>0)if(Z=!0,$<ee){var ne=$/2+5;w[I]+=Q>0?ne:-ne,w[Y]-=Q>0?ne:-ne}else ne=ee/2+5,k[I]+=U>0?ne:-ne,k[Y]-=U>0?ne:-ne}if(!Z)break}var re=1/0,te=1/0;for(I=0;I<d;I++)re=Math.min(re,w[I]),te=Math.min(te,k[I]);var oe=new Map;for(I=0;I<d;I++)oe.set(i[I].id,{x:Math.round(w[I]-re+80),y:Math.round(k[I]-te+80)});return oe}(o,i,t),a=o.map(function(e){var r=l.get(e.id)||{x:0,y:0};return n(n({},e),{x:r.x,y:r.y})}),d={};t.forEach(function(e,n){d[e.id]=n});var c={};t.forEach(function(e){c[e.id]=[]}),a.forEach(function(e){var n;null===(n=c[e.cluster_id])||void 0===n||n.push(e)});var u=36,s=t.map(function(e){var n=c[e.id];if(!n.length)return null;var r=Math.min.apply(Math,n.map(function(e){return e.x})),t=Math.min.apply(Math,n.map(function(e){return e.y})),o=Math.max.apply(Math,n.map(function(e){return e.x+h})),i=Math.max.apply(Math,n.map(function(e){return e.y+g}));return{id:e.id,label:e.label,idx:d[e.id],x:r-u,y:t-u,width:o-r+72,height:i-t+72+22}}).filter(function(e){return null!==e});return{nodes:a.map(function(e){var r;return n(n({},e),{cluster:null!==(r=d[e.cluster_id])&&void 0!==r?r:0})}),edges:i,clusterBounds:s,canvasW:Math.max.apply(Math,a.map(function(e){return e.x+h}))+72,canvasH:Math.max.apply(Math,a.map(function(e){return e.y+g}))+72}}function M(e,n,r){var t=n[e.source],o=n[e.target];if(!t||!o)return"";var i=function(e,n){var r=e.x+85,t=e.y+24,o=n.x+85,i=n.y+24;function l(e,n,r,t){var o=r-e,i=t-n;return Math.abs(i)>.4*Math.abs(o)?i>0?{x:e,y:n+24}:{x:e,y:n-24}:o>0?{x:e+85,y:n}:{x:e-85,y:n}}return{source:l(r,t,o,i),target:l(o,i,r,t)}}(t,o),l=i.source,a=i.target,d=a.x-l.x,c=a.y-l.y,u=Math.sqrt(d*d+c*c);if(u<5)return"M ".concat(l.x," ").concat(l.y," L ").concat(a.x," ").concat(a.y);if(o.y+150<t.y&&o.y<t.y-g){var s=Math.min(t.x,o.x)-110;return"M ".concat(l.x," ").concat(l.y," C ").concat(s," ").concat(l.y,", ").concat(s," ").concat(a.y,", ").concat(a.x," ").concat(a.y)}var f=-c/u,v=d/u;if(r.some(function(n){return n.source===e.target&&n.target===e.source})){var p=e.source<e.target?1:-1,h=Math.max(.18*u,40)*p,y=(l.x+a.x)/2+f*h,b=(l.y+a.y)/2+v*h;return"M ".concat(l.x," ").concat(l.y," Q ").concat(y," ").concat(b," ").concat(a.x," ").concat(a.y)}var x=Math.min(.12*u,55),m=(l.x+a.x)/2+f*x,w=(l.y+a.y)/2+v*x;return"M ".concat(l.x," ").concat(l.y," Q ").concat(m," ").concat(w," ").concat(a.x," ").concat(a.y)}function C(e){var r,l,f,C=e.data,S=e.onFullscreen,E=e.isFullscreen,z=e.isDarkMode,P=void 0!==z&&z,A=e.style,F=c(null),I=a({x:0,y:0}),W=I[0],R=I[1],B=a(.5),D=B[0],Y=B[1],_=a(!1),j=_[0],N=_[1],L=c({x:0,y:0}),X=c({x:0,y:0}),H=a(null),T=H[0],O=H[1],q=a(null),Q=q[0],U=q[1],G=a(null),J=G[0],K=G[1],V=a(null),Z=V[0],$=V[1],ee=u(function(){return k(C)},[C]),ne=u(function(){var e={};return ee.nodes.forEach(function(n){e[n.id]=n}),e},[ee]),re=u(function(){var e={};return C.clusters.forEach(function(n,r){e[n.id]=r}),e},[C]),te=u(function(){return Z?new Set(ee.edges.filter(function(e){return e.source===Z||e.target===Z}).map(function(e){return e.id})):new Set},[Z,ee.edges]),oe=u(function(){if(!Z)return new Set;var e=new Set([Z]);return ee.edges.forEach(function(n){n.source===Z&&e.add(n.target),n.target===Z&&e.add(n.source)}),e},[Z,ee.edges]),ie=u(function(){return new Date(C.last_analyzed_at).toLocaleString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0,day:"numeric",month:"short",year:"numeric"})},[C.last_analyzed_at]),le=d(function(e){e.target.closest("[data-edge-hit]")||e.target.closest("[data-node]")||(N(!0),L.current={x:e.clientX,y:e.clientY},X.current=n({},W),e.currentTarget.style.cursor="grabbing")},[W]),ae=d(function(e){j&&R({x:X.current.x+(e.clientX-L.current.x),y:X.current.y+(e.clientY-L.current.y)})},[j]),de=d(function(){N(!1),F.current&&(F.current.style.cursor="grab")},[]),ce=d(function(e){e.preventDefault(),Y(function(n){return Math.min(2.5,Math.max(.2,n-.001*e.deltaY))})},[]);s(function(){var e=F.current;return e&&e.addEventListener("wheel",ce,{passive:!1}),function(){return null==e?void 0:e.removeEventListener("wheel",ce)}},[ce]);var ue=(null==A?void 0:A.backgroundColor)||(null==A?void 0:A.background)||(P?"#090d16":"#ffffff"),se=(null==A?void 0:A.color)||(P?"#f8fafc":"#1e293b"),fe=(null===(r=null==A?void 0:A.subtitle)||void 0===r?void 0:r.color)||"#94a3b8",ve=function(e,n){return"string"==typeof e?e:n},pe=n({width:32,height:32,border:"none",background:"transparent",borderRadius:8,cursor:"pointer",fontSize:16,color:P?"#cbd5e1":"#475569",display:"flex",alignItems:"center",justifyContent:"center",fontWeight:500},null==A?void 0:A.controlButton);return t("div",n({style:n({width:"100%",height:"100%",background:ue,color:se,fontFamily:"'Inter', -apple-system, BlinkMacSystemFont, sans-serif",position:"relative",overflow:"hidden"},null==A?void 0:A.root)},{children:[t("div",n({style:n({position:"absolute",top:0,left:0,right:0,zIndex:20,borderBottom:E?P?"1px solid #1e293b":"1px solid #f1f5f9":"none",background:E?ue:"transparent"},null==A?void 0:A.header)},{children:[t("div",n({style:{padding:"10px 14px",display:"flex",alignItems:"center",justifyContent:"space-between"}},{children:[t("div",{children:[E&&i("h2",n({style:n({margin:0,fontSize:17,fontWeight:700,color:se},null==A?void 0:A.title)},{children:"Dependency Graph"})),t("p",n({style:n({margin:"2px 0 0",fontSize:12,color:fe},null==A?void 0:A.subtitle)},{children:["Last analyzed: ".concat(ie||""," · "),"Click a node or connection to explore details and dependencies."]}))]}),t("div",n({style:{display:"flex",gap:6,alignItems:"center"}},{children:[t("div",n({style:n({display:"flex",gap:2,background:P?"#1e293b":"#fff",borderRadius:10,padding:3,boxShadow:P?"0 1px 4px rgba(0,0,0,0.4)":"0 1px 4px rgba(0,0,0,0.08)"},null==A?void 0:A.controls)},{children:[i("button",n({onClick:function(){return Y(function(e){return Math.max(.2,e-.15)})},style:pe},{children:"−"})),t("button",n({onClick:function(){Y(.5),R({x:0,y:0})},style:n(n({},pe),{fontSize:11,width:52,fontWeight:600})},{children:[Math.round(100*D)||0,"%"]})),i("button",n({onClick:function(){return Y(function(e){return Math.min(2.5,e+.15)})},style:pe},{children:"+"}))]})),S&&i("div",n({style:n({display:"flex",background:P?"#1e293b":"#fff",borderRadius:10,padding:3,boxShadow:P?"0 1px 4px rgba(0,0,0,0.4)":"0 1px 4px rgba(0,0,0,0.08)"},null==A?void 0:A.controls)},{children:i("button",n({onClick:S,style:pe},{children:i(E?p:v,{style:{fontSize:16}})}))}))]}))]})),Q&&i("div",n({style:n({margin:"0 20px 14px",width:"30%",minWidth:280,borderRadius:12,overflow:"hidden",boxShadow:"0 2px 12px rgba(0,0,0,0.07)",border:"1px solid #e2e8f0",animation:"slideDown 0.2s ease-out"},null==A?void 0:A.nodePopup)},{children:function(){var e,r,o=Q.node,l=null!==(e=re[o.cluster_id])&&void 0!==e?e:0;return ee.edges.filter(function(e){return e.source===o.id}).length,ee.edges.filter(function(e){return e.target===o.id}).length,t("div",{children:[t("div",n({style:n({padding:"10px 14px",background:w[l%w.length||0],color:"#fff",display:"flex",alignItems:"center",justifyContent:"space-between"},null==A?void 0:A.nodePopupHeader)},{children:[t("div",n({style:{display:"flex",alignItems:"center",gap:10}},{children:[i("span",n({style:{width:28,height:28,borderRadius:8,background:"rgba(255,255,255,0.2)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:14}},{children:x[l%x.length||0]})),t("div",{children:[i("div",n({style:{fontSize:9,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.06em",opacity:.75}},{children:(null===(r=C.clusters[l])||void 0===r?void 0:r.label)||"Cluster Name"})),i("div",n({style:{fontSize:14,fontWeight:700,marginTop:1}},{children:o.label||"Cluster Name"}))]})]})),i("button",n({onClick:function(){U(null),$(null)},style:n({background:"rgba(255,255,255,0.2)",border:"none",color:"#fff",borderRadius:6,width:24,height:24,cursor:"pointer",fontSize:14,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},null==A?void 0:A.popupCloseButton)},{children:"×"}))]})),i("div",n({style:n({padding:"10px 14px",fontSize:13,lineHeight:1.6,color:P?"#cbd5e1":"#475569",background:P?"#1e293b":"#fff"},null==A?void 0:A.nodePopupBody)},{children:o.description||"No description available..."}))]})}()}))]})),t("div",n({ref:F,onPointerDown:le,onPointerMove:ae,onPointerUp:de,onPointerLeave:de,onClick:function(){O(null),U(null),$(null)},style:{width:"100%",height:"100%",cursor:j?"grabbing":"grab",position:"relative"}},{children:[i("div",n({style:{transform:"translate(".concat(W.x,"px, ").concat(W.y,"px) scale(").concat(D,")"),transformOrigin:"top left",position:"absolute",top:E?70:50,left:20,transition:j?"none":"transform 0.08s ease-out"}},{children:t("svg",n({width:ee.canvasW,height:ee.canvasH,style:{overflow:"visible"}},{children:[ee.clusterBounds.map(function(e){var r,o,l,a,d;return t("g",{children:[i("rect",{x:e.x,y:e.y,width:e.width,height:e.height,rx:"16",fill:ve((null===(r=null==A?void 0:A.cluster)||void 0===r?void 0:r.backgroundColor)||(null===(o=null==A?void 0:A.cluster)||void 0===o?void 0:o.background),P?"rgba(30, 41, 59, 0.35)":"none"),stroke:ve((null===(l=null==A?void 0:A.cluster)||void 0===l?void 0:l.borderColor)||(null===(a=null==A?void 0:A.cluster)||void 0===a?void 0:a.border),P?"#334155":"#e2e8f0"),strokeWidth:"1.5",strokeDasharray:"8 4"}),i("text",n({x:e.x+14,y:e.y+e.height-10,fontSize:"11",fill:ve(null===(d=null==A?void 0:A.clusterLabel)||void 0===d?void 0:d.color,"#94a3b8"),fontFamily:"Inter, sans-serif",fontWeight:"500"},{children:e.label||"Cluster Name"}))]},e.id)}),ee.edges.map(function(e){var r,l,a,d,c,u,s,f,v,p=M(e,ne,ee.edges);if(!p)return null;var h=te.has(e.id),g=(null==T?void 0:T.edge.id)===e.id,y=J===e.id,b=!!Z&&!h,x=h||g?(null===(r=null==A?void 0:A.activeEdge)||void 0===r?void 0:r.color)||(null===(l=null==A?void 0:A.activeEdge)||void 0===l?void 0:l.borderColor)||"#6366f1":y?(null===(a=null==A?void 0:A.edge)||void 0===a?void 0:a.color)||"#818cf8":(null===(d=null==A?void 0:A.edge)||void 0===d?void 0:d.borderColor)||(null===(c=null==A?void 0:A.edge)||void 0===c?void 0:c.color)||(P?"#475569":"#cbd5e1"),m=h||g?2.5:y?2:1.5;return t("g",n({style:{opacity:b?.1:1,transition:"opacity 0.25s"}},{children:[i("path",{"data-edge-hit":"true",d:p,fill:"none",stroke:"transparent",strokeWidth:18,style:{cursor:"pointer"},onClick:function(n){return function(e,n){e.stopPropagation();var r=F.current.getBoundingClientRect();O({edge:n,screenX:e.clientX-r.left,screenY:e.clientY-r.top}),U(null),$(null)}(n,e)},onMouseEnter:function(){return K(e.id)},onMouseLeave:function(){return K(null)}}),i("path",{d:p,fill:"none",stroke:x,strokeWidth:m,style:{transition:"stroke 0.2s, stroke-width 0.2s",pointerEvents:"none"}}),(h||g)&&t(o,{children:[i("circle",n({r:4,fill:(null===(u=null==A?void 0:A.edgeMarker)||void 0===u?void 0:u.color)||(null===(s=null==A?void 0:A.activeEdge)||void 0===s?void 0:s.color)||"#6366f1"},{children:i("animateMotion",{dur:"1.8s",repeatCount:"indefinite",path:p})})),i("circle",n({r:6,fill:(null===(f=null==A?void 0:A.edgeMarker)||void 0===f?void 0:f.color)||(null===(v=null==A?void 0:A.activeEdge)||void 0===v?void 0:v.color)||"#6366f1",opacity:.2},{children:i("animateMotion",{dur:"1.8s",repeatCount:"indefinite",path:p})}))]})]}),e.id)}),ee.nodes.map(function(e){var r,o,l,a,d,c,u,s,f,v=Z===e.id,p=oe.has(e.id),w=!!Z&&!p,k=(null!==(r=re[e.cluster_id])&&void 0!==r?r:0)%m.length,M=m[k||0];return i("g",n({"data-node":"true",onClick:function(n){return function(e,n){e.stopPropagation();var r=F.current.getBoundingClientRect();Z===n.id?($(null),U(null)):($(n.id),U({node:n,screenX:e.clientX-r.left,screenY:e.clientY-r.top}),O(null))}(n,e)},style:{cursor:"pointer",opacity:w?.15:1,transition:"opacity 0.25s"}},{children:i("foreignObject",n({x:e.x,y:e.y,width:h,height:g},{children:t("div",n({style:n(n({background:(null===(o=null==A?void 0:A.node)||void 0===o?void 0:o.backgroundColor)||(null===(l=null==A?void 0:A.node)||void 0===l?void 0:l.background)||(P?"#1e293b":"#fff"),border:v?(null===(a=null==A?void 0:A.selectedNode)||void 0===a?void 0:a.border)||"2.5px solid ".concat((null===(d=null==A?void 0:A.selectedNode)||void 0===d?void 0:d.borderColor)||M):(null===(c=null==A?void 0:A.node)||void 0===c?void 0:c.border)||"1.5px solid ".concat((null===(u=null==A?void 0:A.node)||void 0===u?void 0:u.borderColor)||(P?"#334155":"#e2e8f0")),borderRadius:10,padding:"8px 14px",fontSize:13,fontWeight:600,color:P?"#f1f5f9":"#334155",fontFamily:"'Inter', sans-serif",display:"flex",alignItems:"center",gap:8,boxShadow:v?(null===(s=null==A?void 0:A.selectedNode)||void 0===s?void 0:s.boxShadow)||"0 0 0 3px ".concat(M,"33, 0 2px 8px rgba(0,0,0,0.4)"):(null===(f=null==A?void 0:A.node)||void 0===f?void 0:f.boxShadow)||(P?"0 2px 6px rgba(0,0,0,0.3)":"0 1px 3px rgba(0,0,0,0.05)"),whiteSpace:"nowrap",userSelect:"none",height:46,boxSizing:"border-box",transition:"border 0.2s, box-shadow 0.2s"},null==A?void 0:A.node),v?null==A?void 0:A.selectedNode:{})},{children:[i("span",n({style:n({width:22,height:22,borderRadius:6,background:y[k],display:"flex",alignItems:"center",justifyContent:"center",fontSize:11,flexShrink:0,color:b[k]},null==A?void 0:A.nodeIcon)},{children:x[k]})),i("span",n({style:{overflow:"hidden",textOverflow:"ellipsis"}},{children:e.label||"Node name"}))]}))}))}),e.id)})]}))})),T&&t("div",n({onClick:function(e){return e.stopPropagation()},style:n(n(n({position:"absolute"},function(e,n,r,t){if(!F.current)return{};var o=F.current.getBoundingClientRect(),i=e+14,l=n-t/2;return i+r>o.width&&(i=e-r-14),l<8&&(l=8),l+t>o.height&&(l=o.height-t-8),{left:i,top:l}}(T.screenX,T.screenY,320,180)),{width:320,background:P?"#1e293b":"#fff",borderRadius:14,boxShadow:"0 8px 30px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06)",border:"1px solid #e2e8f0",zIndex:30,animation:"popIn 0.18s ease-out",overflow:"hidden"}),null==A?void 0:A.edgePopup)},{children:[t("div",n({style:n({padding:"12px 16px 10px",background:"linear-gradient(135deg, #6366f1, #8b5cf6)",color:"#fff"},null==A?void 0:A.edgePopupHeader)},{children:[i("div",n({style:{fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.06em",opacity:.8}},{children:"Edge Reasoning"})),t("div",n({style:{fontSize:13,fontWeight:600,marginTop:4}},{children:[(null===(l=ne[T.edge.source])||void 0===l?void 0:l.label)||"Source",i("span",n({style:{opacity:.6,margin:"0 6px"}},{children:"→"})),(null===(f=ne[T.edge.target])||void 0===f?void 0:f.label)||"Target"]}))]})),i("div",n({style:n({padding:"12px 16px 14px",fontSize:13,lineHeight:1.6,color:P?"#cbd5e1":"#475569",whiteSpace:"pre-line"},null==A?void 0:A.edgePopupBody)},{children:T.edge.reasoning||"No Reasoning available..."})),i("button",n({onClick:function(){return O(null)},style:n({position:"absolute",top:8,right:10,background:"rgba(255,255,255,0.2)",border:"none",color:"#fff",borderRadius:6,width:24,height:24,cursor:"pointer",fontSize:14,display:"flex",alignItems:"center",justifyContent:"center"},null==A?void 0:A.popupCloseButton)},{children:"×"}))]}))]})),i("style",{children:"\n @keyframes popIn { from { opacity:0; transform:scale(0.95) translateY(4px); } to { opacity:1; transform:scale(1) translateY(0); } }\n @keyframes slideDown { from { opacity:0; transform:translateY(-6px); } to { opacity:1; transform:translateY(0); } }\n "})]}))}var S=l.memo(function(r){var l=r.data,c=r.isDarkMode,u=void 0!==c&&c,s=r.style,v=a(!1),p=v[0],h=v[1],g=s||{};g.fullscreenPaper,g.root,g.header,g.title,g.subtitle,g.controls,g.controlButton,g.nodePopup,g.edgePopup;var y=e(g,["fullscreenPaper","root","header","title","subtitle","controls","controlButton","nodePopup","edgePopup"]),b=s||{},x=d(function(){h(!0)},[]),m=d(function(){h(!1)},[]);return t(o,{children:[i("div",n({style:n({position:"relative",width:"100%",height:"500px"},y)},{children:i(C,{data:l,onFullscreen:x,isDarkMode:u,style:b})})),i(f,n({open:p,onClose:m,maxWidth:!1,PaperProps:{style:n({width:"95vw",height:"92vh",maxWidth:"none",borderRadius:12,overflow:"hidden",background:b.backgroundColor||b.background||(u?"#090d16":"#ffffff"),color:b.color||(u?"#f8fafc":"#1e293b")},b.fullscreenPaper)}},{children:i("div",n({style:{width:"100%",height:"100%",position:"relative",background:b.backgroundColor||b.background||(u?"#090d16":"#ffffff")}},{children:i(C,{data:l,onFullscreen:m,isFullscreen:!0,isDarkMode:u,style:b})}))}))]})});export{S as default};
|
|
2
2
|
//# sourceMappingURL=DependencyGraph.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__rest as e,__assign as n,__awaiter as o,__generator as r}from"tslib";import{jsxs as i,jsx as t,Fragment as a}from"react/jsx-runtime";import l,{useState as d,useMemo as c,useRef as s,useEffect as p}from"react";import u from"react-markdown";import f from"rehype-raw";import{Box as h,Tooltip as g}from"@mui/material";import{Prism as m}from"react-syntax-highlighter";import{oneLight as v}from"react-syntax-highlighter/dist/esm/styles/prism";import{Check as b,ContentCopy as y,ExpandLess as x,ExpandMore as k}from"@mui/icons-material";import S from"@mui/icons-material/ExpandMoreOutlined";import _ from"./Cognitivereasoningpanel.js";var w=function(e){var n,o,r;void 0===e&&(e="");var i=null==e?void 0:e.replace(/\\`/g,"`");return i=null==(i=null==(i=null===(r=null==(i=null===(o=null===(n=null==(i=null==i?void 0:i.replace(/```json\s*([\s\S]*?)```/g,function(e,n){return"<codebasename>".concat(n.trim(),"</codebasename>")}))?void 0:i.replace(/^```.*\n?/,""))||void 0===n?void 0:n.replace(/\n?```$/,""))||void 0===o?void 0:o.trim())?void 0:i.replace(/^```/,""))||void 0===r?void 0:r.replace(/```$/,""))?void 0:i.replace(/<\/summary>/g,"</summary>\n"))?void 0:i.replace(/<details>/g,"\n<details>")},M=function(e){var a=e.text,l=d(!1),c=l[0],s=l[1];return i("button",n({onClick:function(){return o(void 0,void 0,void 0,function(){return r(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,navigator.clipboard.writeText(a)];case 1:return e.sent(),s(!0),setTimeout(function(){return s(!1)},2e3),[3,3];case 2:return e.sent(),[3,3];case 3:return[2]}})})},"aria-label":"Copy code",style:{position:"absolute",top:8,right:8,display:"inline-flex",alignItems:"center",gap:4,padding:"3px 8px",fontSize:"0.68rem",fontWeight:500,fontFamily:"inherit",color:c?"#16a34a":"#6B7280",background:c?"#f0fdf4":"#f3f4f6",border:"1px solid ".concat(c?"#bbf7d0":"#e5e7eb"),borderRadius:6,cursor:"pointer",transition:"all 0.2s",opacity:.85},onMouseEnter:function(e){e.currentTarget.style.opacity="1"},onMouseLeave:function(e){e.currentTarget.style.opacity="0.85"}},{children:[t(c?b:y,{style:{fontSize:13}}),c?"Copied":"Copy"]}))},z=function(o){o.node;var r=e(o,["node"]),a=d(!1),c=a[0],u=a[1],f=s(null),h=l.Children.toArray(r.children),g=h.find(function(e){var n;return null===(n=null==e?void 0:e.props)||void 0===n?void 0:n["data-codebase-name"]}),m=!!g,v=m?g.props["data-codebase-name"]:"",b=h.map(function(e){var n;return"string"==typeof e?e:(null===(n=e.props)||void 0===n?void 0:n.children)||""}).join("").replace(/\*\*/g,"").trim(),y=m?"From ".concat(v," codebase"):b||"Accordion title not found";return p(function(){var e,n=null===(e=f.current)||void 0===e?void 0:e.parentElement;if(n){var o=function(){return u(n.open)};return o(),n.addEventListener("toggle",o),function(){return n.removeEventListener("toggle",o)}}},[]),i("summary",n({ref:f,style:{padding:"8px 12px",listStyleType:"none",cursor:"pointer",fontWeight:600,fontSize:"0.82rem",color:"#6932E2",display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,borderRadius:8,background:c?"#f5f3ff":"transparent",transition:"background 0.2s"}},{children:[t("span",{children:y}),t("div",n({style:{display:"flex",alignItems:"center",flexShrink:0,color:"#6932E2"}},{children:t(c?x:k,{sx:{fontSize:"1.1rem"}})}))]}))},C=function(o){var r=o.message,s=o.fontSize,p=o.extraMetaData,b=o.isDarkMode,y=void 0!==b&&b,x=o.style,k=o.sx,C=null!=s?s:"0.88rem",W=y?"#e2e8f0":"#1f2937",R=y?"#f8fafc":"#111827",E=d({open:!1,data:null,activeKey:null}),H=E[0],K=E[1],L=function(){return K({open:!1,data:null,activeKey:null})},T=c(function(){var e=function(e){var n={};return{processed:e.replace(/<!--\s*<ai_reasoning>\s*([\s\S]*?)\s*<\/ai_reasoning>\s*-->/g,function(e,o){try{var r=JSON.parse(o.trim()),i=r.id||"reasoning_".concat(Object.keys(n).length);return n[i]=r,'<aireasoning data-reasoning-key="'.concat(i,'">').concat(i,"</aireasoning>")}catch(e){return console.warn("[ai_reasoning] Failed to parse block:",e),""}}),reasoningMap:n}}(r||"");return{processedMessage:e.processed,inlineReasoningMap:e.reasoningMap}},[r]),j=T.processedMessage,B=T.inlineReasoningMap,F=c(function(){return{aireasoning:function(o){o.node;var r=e(o,["node"])["data-reasoning-key"],a=B[r];if(!a)return null;var l=H.open&&H.activeKey===r;return i("div",n({style:{margin:"6px 0"}},{children:[i("span",n({onClick:function(e){e.stopPropagation();var n=function(e){var n,o,r,i,t,a=[];return(null!==(o=null===(n=e.aiReasoningCitation)||void 0===n?void 0:n.gpt_citation)&&void 0!==o?o:[]).forEach(function(e){var n,o,r,i,t,l,d,c,s,p,u=null!==(o=null===(n=e.customMetadata)||void 0===n?void 0:n.data_sources)&&void 0!==o?o:[],f=null!==(i=null===(r=e.customMetadata)||void 0===r?void 0:r.training_data_title)&&void 0!==i?i:[],h=null!==(l=null===(t=e.customMetadata)||void 0===t?void 0:t.paraphrase)&&void 0!==l?l:[],g=null===(d=u[0])||void 0===d?void 0:d.match(/<highlight>([\s\S]*?)<\/highlight>/),m=g?g[1].trim():null!==(c=u[0])&&void 0!==c?c:"";a.push({citation_number:Number(e.citation_number),section_ref:null!==(s=f[0])&&void 0!==s?s:"",paraphrase:null!==(p=h[0])&&void 0!==p?p:"",highlight:m})}),{block_cognitive_reasoning_html:null!==(r=e.reasoning)&&void 0!==r?r:"",block_cognitive_gap_html:null!==(i=e.Gap)&&void 0!==i?i:"",block_cognitive_confidence:Number(null!==(t=e.decision_strength)&&void 0!==t?t:0),block_cognitive_citations:a}}(a);K(function(e){return e.open&&e.activeKey===r?{open:!1,data:null,activeKey:null}:{open:!0,data:n,activeKey:r}})},style:{display:"inline-flex",alignItems:"center",gap:6,cursor:"pointer",color:y?"#a78bfa":"#6932E2",fontWeight:500,fontSize:C,transition:"all 0.2s",padding:"2px 0"}},{children:[t("span",{children:r}),t("span",n({style:{display:"inline-flex",alignItems:"center",gap:2,border:y?"1px solid #334155":"1px solid #e2e8f0",borderRadius:5,padding:"4px 2px"}},{children:t(S,{sx:{fontSize:"1rem",color:y?"#94a3b8":"#475569",transform:l?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s"}})}))]})),l&&H.data&&t(h,n({component:"div",onClick:function(e){return e.stopPropagation()},sx:{display:"block",width:"fit-content",maxWidth:"100%",mt:1,mb:1,ml:0}},{children:t(_,{open:!0,onClose:L,data:H.data})}))]}))},codebasename:function(e){var o=e.children,r=("string"==typeof o[0]?o[0]:"").trim();return""!==r?i("div",n({"data-codebase-name":r,style:{position:"relative",margin:"12px 0"}},{children:[t(M,{text:String(o).replace(/\n$/,"")}),t(m,n({style:v,language:"json",PreTag:"div",customStyle:{borderRadius:8,padding:"1rem",fontSize:"0.8rem",border:y?"1px solid #334155":"1px solid #e5e7eb",margin:0,lineHeight:1.6}},{children:String(o).replace(/\n$/,"")}))]})):t(a,{})},details:function(o){o.node;var r=e(o,["node"]);return t("details",n({},r,{style:{borderRadius:8,border:y?"1px solid #334155":"1px solid #e9e5f5",backgroundColor:"transparent",margin:"8px 0",overflow:"hidden"}},{children:r.children}))},summary:z,p:function(o){o.node;var r=e(o,["node"]);return t("p",n({style:{wordWrap:"break-word",overflowWrap:"break-word",wordBreak:"break-word",whiteSpace:"normal",overflow:"hidden",display:"block",maxWidth:"100%",fontSize:C,lineHeight:1.7,margin:"4px 0",color:W}},{children:null==r?void 0:r.children}))},strong:function(o){o.node;var r=e(o,["node"]);return t("strong",n({style:{fontWeight:650,color:R}},{children:null==r?void 0:r.children}))},h1:function(o){o.node;var r=e(o,["node"]);return t("h1",n({style:{fontSize:"1.35rem",fontWeight:700,color:R,margin:"20px 0 8px",lineHeight:1.3,letterSpacing:"-0.01em"}},{children:r.children}))},h2:function(o){o.node;var r=e(o,["node"]);return t("h2",n({style:{fontSize:"1.15rem",fontWeight:650,color:R,margin:"16px 0 6px",lineHeight:1.35}},{children:r.children}))},h3:function(o){o.node;var r=e(o,["node"]);return t("h3",n({style:{fontSize:"1rem",fontWeight:600,color:R,margin:"14px 0 4px",lineHeight:1.4}},{children:r.children}))},h4:function(o){o.node;var r=e(o,["node"]);return t("h4",n({style:{fontSize:"0.92rem",fontWeight:600,color:W,margin:"12px 0 4px",lineHeight:1.4}},{children:r.children}))},ol:function(o){o.node;var r=e(o,["node"]);return t("ol",n({style:{listStyleType:"decimal",marginLeft:20,paddingLeft:4,display:"flex",flexDirection:"column",gap:2}},{children:null==r?void 0:r.children}))},ul:function(o){o.node;var r=e(o,["node"]);return t("ul",n({style:{listStyleType:"disc",marginLeft:20,paddingLeft:4,display:"flex",flexDirection:"column",gap:2}},{children:null==r?void 0:r.children}))},li:function(o){o.node;var r=e(o,["node"]);return t("li",n({style:{fontSize:C,lineHeight:1.7,color:W,paddingLeft:4}},{children:r.children}))},blockquote:function(o){o.node;var r=e(o,["node"]);return t("blockquote",n({style:{margin:"12px 0",padding:"8px 16px",borderLeft:"3px solid #8b5cf6",background:y?"#1e1b4b":"#faf5ff",borderRadius:"0 6px 6px 0",color:y?"#cbd5e1":"#4b5563",fontStyle:"italic",fontSize:C,lineHeight:1.65}},{children:r.children}))},hr:function(){return t("hr",{style:{border:"none",height:1,background:y?"linear-gradient(to right, transparent, #334155, transparent)":"linear-gradient(to right, transparent, #d1d5db, transparent)",margin:"16px 0"}})},table:function(o){o.node;var r=e(o,["node"]);return t("div",n({style:{overflowX:"auto",margin:"12px 0",borderRadius:8,border:y?"1px solid #334155":"1px solid #e5e7eb"}},{children:t("table",n({style:{width:"100%",borderCollapse:"collapse",fontSize:"0.8rem",lineHeight:1.5}},{children:r.children}))}))},thead:function(o){o.node;var r=e(o,["node"]);return t("thead",n({style:{background:y?"#1e293b":"#f9fafb",borderBottom:y?"2px solid #334155":"2px solid #e5e7eb"}},{children:r.children}))},th:function(o){o.node;var r=e(o,["node"]);return t("th",n({style:{padding:"8px 12px",textAlign:"left",fontWeight:600,fontSize:"0.76rem",color:y?"#cbd5e1":"#374151",whiteSpace:"nowrap"}},{children:r.children}))},td:function(o){o.node;var r=e(o,["node"]);return t("td",n({style:{padding:"8px 12px",borderTop:y?"1px solid #334155":"1px solid #f3f4f6",color:y?"#94a3b8":"#4b5563",fontSize:"0.8rem"}},{children:r.children}))},a:function(o){var r=o.children;o.node;var l=e(o,["children","node"]),d=l["data-cognitive-reasoning"];if(d&&(null==p?void 0:p[d]))return i(a,{children:[i("span",n({onClick:function(e){e.stopPropagation();var n=function(e){var n,o,r,i,t;if(!e)return null;var a=[];return(null!==(o=null===(n=e.aiReasoningCitation)||void 0===n?void 0:n.gpt_citation)&&void 0!==o?o:[]).forEach(function(e){var n,o,r,i,t,l,d,c,s,p,u=null!==(o=null===(n=e.customMetadata)||void 0===n?void 0:n.data_sources)&&void 0!==o?o:[],f=null!==(i=null===(r=e.customMetadata)||void 0===r?void 0:r.training_data_title)&&void 0!==i?i:[],h=null!==(l=null===(t=e.customMetadata)||void 0===t?void 0:t.paraphrase)&&void 0!==l?l:[],g=null===(d=u[0])||void 0===d?void 0:d.match(/<highlight>([\s\S]*?)<\/highlight>/),m=g?g[1].trim():null!==(c=u[0])&&void 0!==c?c:"";a.push({citation_number:Number(e.citation_number),section_ref:null!==(s=f[0])&&void 0!==s?s:"",paraphrase:null!==(p=h[0])&&void 0!==p?p:"",highlight:m})}),{block_cognitive_reasoning_html:null!==(r=e.Reasoning)&&void 0!==r?r:"",block_cognitive_gap_html:null!==(i=e.Gap)&&void 0!==i?i:"",block_cognitive_confidence:Number(null!==(t=e.Confidence_score)&&void 0!==t?t:0),block_cognitive_citations:a}}(p[d]);K(function(e){return e.open&&e.activeKey===d?{open:!1,data:null,activeKey:null}:{open:!0,data:n,activeKey:d}})},style:{color:y?"#a78bfa":"#6932E2",fontWeight:500,cursor:"pointer",transition:"all 0.2s",padding:"0 2px",position:"relative",display:"flex",alignItems:"center",gap:6,width:"fit-content"}},{children:[r||"",t("span",n({style:{cursor:"pointer",padding:"4px 2px",display:"flex",alignItems:"center",gap:2,border:y?"1px solid #334155":"1px solid #e2e8f0",borderRadius:"5px",width:"fit-content"}},{children:t(S,{sx:{fontSize:"1rem",color:y?"#94a3b8":"#475569",transition:"transform 0.2s"}})}))]})),H.open&&H.activeKey===d&&H.data&&t(h,n({component:"div",onClick:function(e){return e.stopPropagation()},sx:{display:"block",width:"fit-content",maxWidth:"100%",mt:1,mb:1,ml:0}},{children:t(_,{open:!0,onClose:L,data:H.data})}))]});var c=!1;try{c=new URL(null==l?void 0:l.href).protocol.startsWith("http")}catch(e){c=!1}return c?t("a",n({href:null==l?void 0:l.href,style:{color:y?"#a78bfa":"#6932E2",textDecoration:"none",fontWeight:500,borderBottom:y?"1px solid #7c3aed":"1px solid #c4b5fd",transition:"border-color 0.2s, color 0.2s"},target:"_blank",rel:"noopener noreferrer",onMouseEnter:function(e){e.currentTarget.style.borderBottomColor=y?"#a78bfa":"#6932E2"},onMouseLeave:function(e){e.currentTarget.style.borderBottomColor=y?"#7c3aed":"#c4b5fd"}},{children:r})):t("span",{children:r})},sup:function(o){o.node;var r=e(o,["node"]);return t(g,n({title:r.children,placement:"top",arrow:!0},{children:t(h,n({component:"span",sx:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:16,height:16,borderRadius:"50%",background:y?"#3730a3":"#ede9fe",color:y?"#c084fc":"#7c3aed",fontSize:"0.6rem",fontWeight:700,verticalAlign:"super",cursor:"pointer",userSelect:"none",lineHeight:1,transition:"all 0.2s","&:hover":{background:y?"#6d28d9":"#7c3aed",color:"#fff"}},"aria-label":"Info",role:"button"},{children:"i"}))}))},code:function(e){var o=e.children;return t("code",n({style:{fontFamily:"'JetBrains Mono', 'Fira Code', 'SF Mono', Menlo, monospace",fontSize:"0.82em",color:y?"#e9d5ff":"#9333ea",background:y?"#2e1065":"#faf5ff",padding:"1.5px 5px",borderRadius:4,border:y?"1px solid #581c87":"1px solid #f3e8ff",fontWeight:500}},{children:o}))},pre:function(e){var o=e.children,r=function(e){var n;return"string"==typeof e?e:(null===(n=null==e?void 0:e.props)||void 0===n?void 0:n.children)?(Array.isArray(e.props.children)?e.props.children:[e.props.children]).map(r).join(""):""},a=l.Children.toArray(o).map(r).join("");return i("div",n({style:{position:"relative",margin:"12px 0"}},{children:[t(M,{text:a}),t("pre",n({style:{fontFamily:"'JetBrains Mono', 'Fira Code', 'SF Mono', Menlo, monospace",fontSize:"0.8rem",lineHeight:1.6,color:W,background:y?"#0f172a":"#f9fafb",border:y?"1px solid #334155":"1px solid #e5e7eb",borderRadius:8,padding:"14px 16px",margin:0,overflowX:"auto",whiteSpace:"pre"}},{children:o}))]}))},img:function(o){o.node;var r=e(o,["node"]);return t("img",n({},r,{style:{maxWidth:"100%",height:"auto",borderRadius:8,margin:"8px 0",border:y?"1px solid #334155":"1px solid #e5e7eb"},loading:"lazy"}))}}},[r,C,p,H.activeKey,H.open,B,y,W,R]);return t(h,n({className:"pg-markdown-renderer",style:x,sx:n(n({fontSize:C,lineHeight:1.7,color:W,wordBreak:"break-word",position:"relative"},k),{"& span[style*='color'], & font[color]":y?{color:"#60a5fa !important"}:{},"& a":{color:y?"#a78bfa !important":"#6932E2 !important"},"& strong":{color:y?"#f8fafc !important":"#111827 !important"},"& h1, & h2, & h3, & h4, & h5, & h6":{color:y?"#f1f5f9 !important":"#111827 !important"}})},{children:t(u,n({components:F,rehypePlugins:[f],className:"react-markdown-renderer-with-overrides"},{children:w(j)}))}))};export{C as MarkdownRenderer,C as default};
|
|
1
|
+
import{__rest as e,__assign as n,__awaiter as o,__generator as r}from"tslib";import{jsxs as i,jsx as t,Fragment as a}from"react/jsx-runtime";import l,{useState as d,useMemo as c,useRef as s,useEffect as p}from"react";import u from"react-markdown";import f from"rehype-raw";import{Box as h,Tooltip as g}from"@mui/material";import{Prism as m}from"react-syntax-highlighter";import{oneLight as v}from"react-syntax-highlighter/dist/esm/styles/prism";import{Check as b,ContentCopy as y,ExpandLess as x,ExpandMore as k}from"@mui/icons-material";import S from"@mui/icons-material/ExpandMoreOutlined";import _ from"./Cognitivereasoningpanel.js";var w=function(e){var n,o,r;void 0===e&&(e="");var i=null==e?void 0:e.replace(/\\`/g,"`");return i=null==(i=null==(i=null===(r=null==(i=null===(o=null===(n=null==(i=null==i?void 0:i.replace(/```json\s*([\s\S]*?)```/g,function(e,n){return"<codebasename>".concat(n.trim(),"</codebasename>")}))?void 0:i.replace(/^```.*\n?/,""))||void 0===n?void 0:n.replace(/\n?```$/,""))||void 0===o?void 0:o.trim())?void 0:i.replace(/^```/,""))||void 0===r?void 0:r.replace(/```$/,""))?void 0:i.replace(/<\/summary>/g,"</summary>\n"))?void 0:i.replace(/<details>/g,"\n<details>")},M=function(e){var a=e.text,l=d(!1),c=l[0],s=l[1];return i("button",n({onClick:function(){return o(void 0,void 0,void 0,function(){return r(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,navigator.clipboard.writeText(a)];case 1:return e.sent(),s(!0),setTimeout(function(){return s(!1)},2e3),[3,3];case 2:return e.sent(),[3,3];case 3:return[2]}})})},"aria-label":"Copy code",style:{position:"absolute",top:8,right:8,display:"inline-flex",alignItems:"center",gap:4,padding:"3px 8px",fontSize:"0.68rem",fontWeight:500,fontFamily:"inherit",color:c?"#16a34a":"#6B7280",background:c?"#f0fdf4":"#f3f4f6",border:"1px solid ".concat(c?"#bbf7d0":"#e5e7eb"),borderRadius:6,cursor:"pointer",transition:"all 0.2s",opacity:.85},onMouseEnter:function(e){e.currentTarget.style.opacity="1"},onMouseLeave:function(e){e.currentTarget.style.opacity="0.85"}},{children:[t(c?b:y,{style:{fontSize:13}}),c?"Copied":"Copy"]}))},z=function(o){o.node;var r=e(o,["node"]),a=d(!1),c=a[0],u=a[1],f=s(null),h=l.Children.toArray(r.children),g=h.find(function(e){var n;return null===(n=null==e?void 0:e.props)||void 0===n?void 0:n["data-codebase-name"]}),m=!!g,v=m?g.props["data-codebase-name"]:"",b=h.map(function(e){var n;return"string"==typeof e?e:(null===(n=e.props)||void 0===n?void 0:n.children)||""}).join("").replace(/\*\*/g,"").trim(),y=m?"From ".concat(v," codebase"):b||"Accordion title not found";return p(function(){var e,n=null===(e=f.current)||void 0===e?void 0:e.parentElement;if(n){var o=function(){return u(n.open)};return o(),n.addEventListener("toggle",o),function(){return n.removeEventListener("toggle",o)}}},[]),i("summary",n({ref:f,style:{padding:"8px 12px",listStyleType:"none",cursor:"pointer",fontWeight:600,fontSize:"0.82rem",color:"#6932E2",display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,borderRadius:8,background:c?"#f5f3ff":"transparent",transition:"background 0.2s"}},{children:[t("span",{children:y}),t("div",n({style:{display:"flex",alignItems:"center",flexShrink:0,color:"#6932E2"}},{children:t(c?x:k,{sx:{fontSize:"1.1rem"}})}))]}))},C=function(o){var r=o.message,s=o.fontSize,p=o.extraMetaData,b=o.isDarkMode,y=void 0!==b&&b,x=o.cognitiveDecisioningStyles,k=o.style,C=o.sx,W=null!=s?s:"0.88rem",R=y?"#e2e8f0":"#1f2937",E=y?"#f8fafc":"#111827",H=d({open:!1,data:null,activeKey:null}),K=H[0],L=H[1],T=function(){return L({open:!1,data:null,activeKey:null})},j=c(function(){var e=function(e){var n={};return{processed:e.replace(/<!--\s*<ai_reasoning>\s*([\s\S]*?)\s*<\/ai_reasoning>\s*-->/g,function(e,o){try{var r=JSON.parse(o.trim()),i=r.id||"reasoning_".concat(Object.keys(n).length);return n[i]=r,'<aireasoning data-reasoning-key="'.concat(i,'">').concat(i,"</aireasoning>")}catch(e){return console.warn("[ai_reasoning] Failed to parse block:",e),""}}),reasoningMap:n}}(r||"");return{processedMessage:e.processed,inlineReasoningMap:e.reasoningMap}},[r]),B=j.processedMessage,F=j.inlineReasoningMap,I=c(function(){return{aireasoning:function(o){o.node;var r=e(o,["node"])["data-reasoning-key"],a=F[r];if(!a)return null;var l=K.open&&K.activeKey===r;return i("div",n({style:{margin:"6px 0"}},{children:[i("span",n({onClick:function(e){e.stopPropagation();var n=function(e){var n,o,r,i,t,a=[];return(null!==(o=null===(n=e.aiReasoningCitation)||void 0===n?void 0:n.gpt_citation)&&void 0!==o?o:[]).forEach(function(e){var n,o,r,i,t,l,d,c,s,p,u=null!==(o=null===(n=e.customMetadata)||void 0===n?void 0:n.data_sources)&&void 0!==o?o:[],f=null!==(i=null===(r=e.customMetadata)||void 0===r?void 0:r.training_data_title)&&void 0!==i?i:[],h=null!==(l=null===(t=e.customMetadata)||void 0===t?void 0:t.paraphrase)&&void 0!==l?l:[],g=null===(d=u[0])||void 0===d?void 0:d.match(/<highlight>([\s\S]*?)<\/highlight>/),m=g?g[1].trim():null!==(c=u[0])&&void 0!==c?c:"";a.push({citation_number:Number(e.citation_number),section_ref:null!==(s=f[0])&&void 0!==s?s:"",paraphrase:null!==(p=h[0])&&void 0!==p?p:"",highlight:m})}),{block_cognitive_reasoning_html:null!==(r=e.reasoning)&&void 0!==r?r:"",block_cognitive_gap_html:null!==(i=e.Gap)&&void 0!==i?i:"",block_cognitive_confidence:Number(null!==(t=e.decision_strength)&&void 0!==t?t:0),block_cognitive_citations:a}}(a);L(function(e){return e.open&&e.activeKey===r?{open:!1,data:null,activeKey:null}:{open:!0,data:n,activeKey:r}})},style:{display:"inline-flex",alignItems:"center",gap:6,cursor:"pointer",color:y?"#a78bfa":"#6932E2",fontWeight:500,fontSize:W,transition:"all 0.2s",padding:"2px 0"}},{children:[t("span",{children:r}),t("span",n({style:{display:"inline-flex",alignItems:"center",gap:2,border:y?"1px solid #334155":"1px solid #e2e8f0",borderRadius:5,padding:"4px 2px"}},{children:t(S,{sx:{fontSize:"1rem",color:y?"#94a3b8":"#475569",transform:l?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s"}})}))]})),l&&K.data&&t(h,n({component:"div",onClick:function(e){return e.stopPropagation()},sx:{display:"block",width:"fit-content",maxWidth:"100%",mt:1,mb:1,ml:0}},{children:t(_,{open:!0,onClose:T,data:K.data,styles:x})}))]}))},codebasename:function(e){var o=e.children,r=("string"==typeof o[0]?o[0]:"").trim();return""!==r?i("div",n({"data-codebase-name":r,style:{position:"relative",margin:"12px 0"}},{children:[t(M,{text:String(o).replace(/\n$/,"")}),t(m,n({style:v,language:"json",PreTag:"div",customStyle:{borderRadius:8,padding:"1rem",fontSize:"0.8rem",border:y?"1px solid #334155":"1px solid #e5e7eb",margin:0,lineHeight:1.6}},{children:String(o).replace(/\n$/,"")}))]})):t(a,{})},details:function(o){o.node;var r=e(o,["node"]);return t("details",n({},r,{style:{borderRadius:8,border:y?"1px solid #334155":"1px solid #e9e5f5",backgroundColor:"transparent",margin:"8px 0",overflow:"hidden"}},{children:r.children}))},summary:z,p:function(o){o.node;var r=e(o,["node"]);return t("p",n({style:{wordWrap:"break-word",overflowWrap:"break-word",wordBreak:"break-word",whiteSpace:"normal",overflow:"hidden",display:"block",maxWidth:"100%",fontSize:W,lineHeight:1.7,margin:"4px 0",color:R}},{children:null==r?void 0:r.children}))},strong:function(o){o.node;var r=e(o,["node"]);return t("strong",n({style:{fontWeight:650,color:E}},{children:null==r?void 0:r.children}))},h1:function(o){o.node;var r=e(o,["node"]);return t("h1",n({style:{fontSize:"1.35rem",fontWeight:700,color:E,margin:"20px 0 8px",lineHeight:1.3,letterSpacing:"-0.01em"}},{children:r.children}))},h2:function(o){o.node;var r=e(o,["node"]);return t("h2",n({style:{fontSize:"1.15rem",fontWeight:650,color:E,margin:"16px 0 6px",lineHeight:1.35}},{children:r.children}))},h3:function(o){o.node;var r=e(o,["node"]);return t("h3",n({style:{fontSize:"1rem",fontWeight:600,color:E,margin:"14px 0 4px",lineHeight:1.4}},{children:r.children}))},h4:function(o){o.node;var r=e(o,["node"]);return t("h4",n({style:{fontSize:"0.92rem",fontWeight:600,color:R,margin:"12px 0 4px",lineHeight:1.4}},{children:r.children}))},ol:function(o){o.node;var r=e(o,["node"]);return t("ol",n({style:{listStyleType:"decimal",marginLeft:20,paddingLeft:4,display:"flex",flexDirection:"column",gap:2}},{children:null==r?void 0:r.children}))},ul:function(o){o.node;var r=e(o,["node"]);return t("ul",n({style:{listStyleType:"disc",marginLeft:20,paddingLeft:4,display:"flex",flexDirection:"column",gap:2}},{children:null==r?void 0:r.children}))},li:function(o){o.node;var r=e(o,["node"]);return t("li",n({style:{fontSize:W,lineHeight:1.7,color:R,paddingLeft:4}},{children:r.children}))},blockquote:function(o){o.node;var r=e(o,["node"]);return t("blockquote",n({style:{margin:"12px 0",padding:"8px 16px",borderLeft:"3px solid #8b5cf6",background:y?"#1e1b4b":"#faf5ff",borderRadius:"0 6px 6px 0",color:y?"#cbd5e1":"#4b5563",fontStyle:"italic",fontSize:W,lineHeight:1.65}},{children:r.children}))},hr:function(){return t("hr",{style:{border:"none",height:1,background:y?"linear-gradient(to right, transparent, #334155, transparent)":"linear-gradient(to right, transparent, #d1d5db, transparent)",margin:"16px 0"}})},table:function(o){o.node;var r=e(o,["node"]);return t("div",n({style:{overflowX:"auto",margin:"12px 0",borderRadius:8,border:y?"1px solid #334155":"1px solid #e5e7eb"}},{children:t("table",n({style:{width:"100%",borderCollapse:"collapse",fontSize:"0.8rem",lineHeight:1.5}},{children:r.children}))}))},thead:function(o){o.node;var r=e(o,["node"]);return t("thead",n({style:{background:y?"#1e293b":"#f9fafb",borderBottom:y?"2px solid #334155":"2px solid #e5e7eb"}},{children:r.children}))},th:function(o){o.node;var r=e(o,["node"]);return t("th",n({style:{padding:"8px 12px",textAlign:"left",fontWeight:600,fontSize:"0.76rem",color:y?"#cbd5e1":"#374151",whiteSpace:"nowrap"}},{children:r.children}))},td:function(o){o.node;var r=e(o,["node"]);return t("td",n({style:{padding:"8px 12px",borderTop:y?"1px solid #334155":"1px solid #f3f4f6",color:y?"#94a3b8":"#4b5563",fontSize:"0.8rem"}},{children:r.children}))},a:function(o){var r=o.children;o.node;var l=e(o,["children","node"]),d=l["data-cognitive-reasoning"];if(d&&(null==p?void 0:p[d]))return i(a,{children:[i("span",n({onClick:function(e){e.stopPropagation();var n=function(e){var n,o,r,i,t;if(!e)return null;var a=[];return(null!==(o=null===(n=e.aiReasoningCitation)||void 0===n?void 0:n.gpt_citation)&&void 0!==o?o:[]).forEach(function(e){var n,o,r,i,t,l,d,c,s,p,u=null!==(o=null===(n=e.customMetadata)||void 0===n?void 0:n.data_sources)&&void 0!==o?o:[],f=null!==(i=null===(r=e.customMetadata)||void 0===r?void 0:r.training_data_title)&&void 0!==i?i:[],h=null!==(l=null===(t=e.customMetadata)||void 0===t?void 0:t.paraphrase)&&void 0!==l?l:[],g=null===(d=u[0])||void 0===d?void 0:d.match(/<highlight>([\s\S]*?)<\/highlight>/),m=g?g[1].trim():null!==(c=u[0])&&void 0!==c?c:"";a.push({citation_number:Number(e.citation_number),section_ref:null!==(s=f[0])&&void 0!==s?s:"",paraphrase:null!==(p=h[0])&&void 0!==p?p:"",highlight:m})}),{block_cognitive_reasoning_html:null!==(r=e.Reasoning)&&void 0!==r?r:"",block_cognitive_gap_html:null!==(i=e.Gap)&&void 0!==i?i:"",block_cognitive_confidence:Number(null!==(t=e.Confidence_score)&&void 0!==t?t:0),block_cognitive_citations:a}}(p[d]);L(function(e){return e.open&&e.activeKey===d?{open:!1,data:null,activeKey:null}:{open:!0,data:n,activeKey:d}})},style:{color:y?"#a78bfa":"#6932E2",fontWeight:500,cursor:"pointer",transition:"all 0.2s",padding:"0 2px",position:"relative",display:"flex",alignItems:"center",gap:6,width:"fit-content"}},{children:[r||"",t("span",n({style:{cursor:"pointer",padding:"4px 2px",display:"flex",alignItems:"center",gap:2,border:y?"1px solid #334155":"1px solid #e2e8f0",borderRadius:"5px",width:"fit-content"}},{children:t(S,{sx:{fontSize:"1rem",color:y?"#94a3b8":"#475569",transition:"transform 0.2s"}})}))]})),K.open&&K.activeKey===d&&K.data&&t(h,n({component:"div",onClick:function(e){return e.stopPropagation()},sx:{display:"block",width:"fit-content",maxWidth:"100%",mt:1,mb:1,ml:0}},{children:t(_,{open:!0,onClose:T,data:K.data,styles:x})}))]});var c=!1;try{c=new URL(null==l?void 0:l.href).protocol.startsWith("http")}catch(e){c=!1}return c?t("a",n({href:null==l?void 0:l.href,style:{color:y?"#a78bfa":"#6932E2",textDecoration:"none",fontWeight:500,borderBottom:y?"1px solid #7c3aed":"1px solid #c4b5fd",transition:"border-color 0.2s, color 0.2s"},target:"_blank",rel:"noopener noreferrer",onMouseEnter:function(e){e.currentTarget.style.borderBottomColor=y?"#a78bfa":"#6932E2"},onMouseLeave:function(e){e.currentTarget.style.borderBottomColor=y?"#7c3aed":"#c4b5fd"}},{children:r})):t("span",{children:r})},sup:function(o){o.node;var r=e(o,["node"]);return t(g,n({title:r.children,placement:"top",arrow:!0},{children:t(h,n({component:"span",sx:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:16,height:16,borderRadius:"50%",background:y?"#3730a3":"#ede9fe",color:y?"#c084fc":"#7c3aed",fontSize:"0.6rem",fontWeight:700,verticalAlign:"super",cursor:"pointer",userSelect:"none",lineHeight:1,transition:"all 0.2s","&:hover":{background:y?"#6d28d9":"#7c3aed",color:"#fff"}},"aria-label":"Info",role:"button"},{children:"i"}))}))},code:function(e){var o=e.children;return t("code",n({style:{fontFamily:"'JetBrains Mono', 'Fira Code', 'SF Mono', Menlo, monospace",fontSize:"0.82em",color:y?"#e9d5ff":"#9333ea",background:y?"#2e1065":"#faf5ff",padding:"1.5px 5px",borderRadius:4,border:y?"1px solid #581c87":"1px solid #f3e8ff",fontWeight:500}},{children:o}))},pre:function(e){var o=e.children,r=function(e){var n;return"string"==typeof e?e:(null===(n=null==e?void 0:e.props)||void 0===n?void 0:n.children)?(Array.isArray(e.props.children)?e.props.children:[e.props.children]).map(r).join(""):""},a=l.Children.toArray(o).map(r).join("");return i("div",n({style:{position:"relative",margin:"12px 0"}},{children:[t(M,{text:a}),t("pre",n({style:{fontFamily:"'JetBrains Mono', 'Fira Code', 'SF Mono', Menlo, monospace",fontSize:"0.8rem",lineHeight:1.6,color:R,background:y?"#0f172a":"#f9fafb",border:y?"1px solid #334155":"1px solid #e5e7eb",borderRadius:8,padding:"14px 16px",margin:0,overflowX:"auto",whiteSpace:"pre"}},{children:o}))]}))},img:function(o){o.node;var r=e(o,["node"]);return t("img",n({},r,{style:{maxWidth:"100%",height:"auto",borderRadius:8,margin:"8px 0",border:y?"1px solid #334155":"1px solid #e5e7eb"},loading:"lazy"}))}}},[r,W,p,K.activeKey,K.open,x,F,y,R,E]);return t(h,n({className:"pg-markdown-renderer",style:k,sx:n(n({fontSize:W,lineHeight:1.7,color:R,wordBreak:"break-word",position:"relative"},C),{"& span[style*='color'], & font[color]":y?{color:"#60a5fa !important"}:{},"& a":{color:y?"#a78bfa !important":"#6932E2 !important"},"& strong":{color:y?"#f8fafc !important":"#111827 !important"},"& h1, & h2, & h3, & h4, & h5, & h6":{color:y?"#f1f5f9 !important":"#111827 !important"}})},{children:t(u,n({components:I,rehypePlugins:[f],className:"react-markdown-renderer-with-overrides"},{children:w(B)}))}))};export{C as MarkdownRenderer,C as default};
|
|
2
2
|
//# sourceMappingURL=Markdownrenderer.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as e}from"tslib";import{jsxs as i,jsx as t,Fragment as n}from"react/jsx-runtime";import{useState as o,useEffect as r,useRef as l}from"react";import{Box as d,Typography as c,Skeleton as a,Accordion as s,AccordionSummary as h,AccordionDetails as p,Tooltip as f,IconButton as x,Switch as u,Dialog as m,Chip as g}from"@mui/material";import v from"@mui/icons-material/ExpandMore";import b from"@mui/icons-material/Fullscreen";import y from"@mui/icons-material/Close";import S from"@mui/icons-material/NearMeOutlined";import w from"@mui/icons-material/ChevronLeft";import z from"@mui/icons-material/ChevronRight";import E from"./DependencyGraph.js";import{MarkdownRenderer as D}from"./Markdownrenderer.js";import{InternalEditor as k}from"./Internaleditor.js";var B=function(n){var r=n.text,l=n.detailedSummary,a=n.extraMetaData,s=n.isDarkMode,h=void 0!==s&&s,p=n.markdownRendererStyle,f=o(!1),x=f[0],u=f[1],m=function(e,i){void 0===i&&(i=220);var t=e.replace(/<!--\s*<ai_reasoning>[\s\S]*?<\/ai_reasoning>\s*-->/g,"").replace(/<[^>]+>/g,"").replace(/\s+/g," ").trim();if(t.length<=i)return{preview:t,truncated:!1};var n=t.slice(0,i),o=n.lastIndexOf(" ");return{preview:(o>0?n.slice(0,o):n).trim(),truncated:!0}}(r),g=m.preview,v=m.truncated;return t(d,{children:i(d,x?{children:[t(D,{message:r,fontSize:"0.8rem",extraMetaData:a,isDarkMode:h,style:p}),(null==l?void 0:l.trim())&&t(D,{message:l,fontSize:"0.8rem",extraMetaData:a,isDarkMode:h,style:p}),t(c,e({component:"span",onClick:function(){return u(!1)},sx:{fontSize:"0.72rem",color:h?"#a78bfa":"#5928ed",fontWeight:600,cursor:"pointer"}},{children:"view less"}))]}:e({sx:{display:"flex",flexDirection:"column"}},{children:[i(c,e({sx:{fontSize:"0.8rem",color:h?"#cbd5e1":"#4B5563",lineHeight:1.6}},{children:[g,v&&"…"]})),(v||(null==l?void 0:l.trim()))&&t(d,e({sx:{display:"flex",justifyContent:"flex-end"}},{children:t(c,e({component:"span",onClick:function(){return u(!0)},sx:{fontSize:"0.72rem",color:h?"#a78bfa":"#5928ed",fontWeight:600,cursor:"pointer"}},{children:"...view more"}))}))]}))})},M=function(n){var a=n.text,s=n.extraMetaData,h=o(!1),p=h[0],f=h[1],x=o(!1),u=x[0],m=x[1],g=l(null);return r(function(){var e=g.current;e&&m(e.scrollWidth>e.clientWidth)},[a]),t(d,e({sx:{pl:1}},{children:i(d,p?e({sx:{fontSize:"0.68rem",color:"#9CA3AF",lineHeight:1.4}},{children:[t(D,{message:a,fontSize:"0.68rem",extraMetaData:s}),t(c,e({component:"span",onClick:function(){return f(!1)},sx:{fontSize:"0.65rem",color:"#5928ed",cursor:"pointer",fontWeight:600}},{children:"view less"}))]}):e({sx:{display:"flex",alignItems:"baseline",gap:.5}},{children:[t(c,e({ref:g,sx:{fontSize:"0.68rem",color:"#9CA3AF",lineHeight:1.4,overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",flex:1,minWidth:0}},{children:a})),u&&t(c,e({component:"span",onClick:function(){return f(!0)},sx:{fontSize:"0.65rem",color:"#5928ed",cursor:"pointer",fontWeight:600,flexShrink:0}},{children:"view more"}))]}))}))},C=function(C){var R,A=C.promptContent,F=C.promptTitle,W=C.isLoading,I=void 0!==W&&W,H=C.overviewSummary,P=C.functionalityOfSPB,T=void 0===P?[]:P,_=C.spbAdditionalInfo,L=C.extraMetaData,j=C.showCodePanel,O=void 0===j||j,G=C.showInlineApbEditor,N=void 0===G||G,X=C.showCollapseStrip,Y=void 0===X||X,q=C.showFullscreenButton,J=void 0===q||q,K=C.showFullscreenModal,Q=void 0===K||K,U=C.showThemeToggle,V=void 0===U||U,Z=C.isDarkMode,$=void 0===Z||Z,ee=C.styles,ie=C.className,te=C.style,ne=C.sx,oe=o(null),re=oe[0],le=oe[1],de=o(null),ce=de[0],ae=de[1],se=o(""),he=se[0],pe=se[1],fe=void 0!==(null==ee?void 0:ee.isDarkMode)?ee.isDarkMode:$,xe=o(fe),ue=xe[0],me=xe[1],ge=o(null),ve=ge[0],be=ge[1];r(function(){void 0!==(null==ee?void 0:ee.isDarkMode)&&me(ee.isDarkMode)},[null==ee?void 0:ee.isDarkMode]);var ye=o(!1),Se=ye[0],we=ye[1],ze=o(480),Ee=ze[0],De=ze[1],ke=l(!1),Be=l(null);r(function(){var e,i,t;T.length>0&&le((e=new Date,i=e.toLocaleTimeString("en-IN",{hour:"numeric",minute:"2-digit",second:"2-digit",hour12:!0}),t=e.toLocaleDateString("en-IN",{day:"numeric",month:"short",year:"numeric"}),"".concat(i||""," | ").concat(t||"")))},[T]),r(function(){I&&le(null)},[I]),r(function(){ve&&(pe(""),setTimeout(function(){return pe(ve.ref)},500))},[ve]);return i(d,e({className:ie,style:e(e({},null==ee?void 0:ee.root),te),sx:e({height:"100%",display:"flex",flexDirection:"column",width:"100%",minHeight:0,overflow:"hidden"},ne)},{children:[t(d,e({sx:e({px:2.5,py:1.5,borderBottom:"1px solid #e5e7eb",display:"flex",alignItems:"center",justifyContent:"space-between",bgcolor:"#fff",flexShrink:0},null==ee?void 0:ee.header)},{children:i(d,e({sx:{display:"flex",flexDirection:"column",gap:.25}},{children:[t(c,e({sx:e({fontWeight:700,fontSize:"0.9rem",color:"#111827"},null==ee?void 0:ee.headerTitle)},{children:F||"SPB Analysis"})),t(c,e({sx:e({fontSize:"0.7rem",color:"#9CA3AF"},null==ee?void 0:ee.headerSubtitle)},{children:re?"Last Analyzed at ".concat(re):""}))]}))})),i(d,e({ref:Be,sx:{display:"flex",flex:1,minHeight:0,overflow:"hidden",position:"relative"}},{children:[t(d,e({sx:e({width:O?Se&&Y?0:Ee:"100%",flexShrink:0,minHeight:0,overflow:"hidden",transition:ke.current?"none":"width 0.15s",borderRight:!O||Se&&Y?"none":"1px solid #e5e7eb"},null==ee?void 0:ee.leftPanel)},{children:i(d,e({sx:{width:"100%",height:"100%",minHeight:0,overflowY:"auto",display:"flex",flexDirection:"column",gap:1,px:1.25,py:1.25,pb:2}},{children:[i(d,e({sx:e({border:"1px solid #E5E7EB",borderRadius:"8px",bgcolor:"#F8FAFC",p:1.5},null==ee?void 0:ee.overviewSection)},{children:[t(c,e({sx:e({fontWeight:600,fontSize:"0.85rem",color:"#111827",mb:1},null==ee?void 0:ee.overviewTitle)},{children:"Overview"})),t(d,e({sx:e({bgcolor:"#fff",border:"1px solid #E5E7EB",borderRadius:"8px",p:1.5},null==ee?void 0:ee.overviewContent)},{children:(null===(R=null==H?void 0:H.overallSummary)||void 0===R?void 0:R.trim())?t(B,{text:H.overallSummary,detailedSummary:H.detailedSummary,extraMetaData:L,isDarkMode:ue,markdownRendererStyle:null==ee?void 0:ee.markdownRenderer}):i(d,e({sx:{display:"flex",flexDirection:"column",gap:.5}},{children:[t(a,{variant:"text",width:"100%",height:14}),t(a,{variant:"text",width:"90%",height:14}),t(a,{variant:"text",width:"95%",height:14})]}))}))]})),i(s,e({disableGutters:!0,elevation:0,sx:e({border:"1px solid #E5E7EB",borderRadius:"8px !important","&:before":{display:"none"},"&.Mui-expanded":{bgcolor:"#F8FAFC"},bgcolor:"#fff"},null==ee?void 0:ee.functionalitySection)},{children:[t(h,e({expandIcon:t(v,{sx:{fontSize:"1rem",color:"#6B7280"}}),sx:{px:1.5,minHeight:"unset","& .MuiAccordionSummary-content":{my:.75}}},{children:t(c,e({sx:e({fontWeight:600,fontSize:"0.85rem",color:"#111827"},null==ee?void 0:ee.functionalityTitle)},{children:"Functionality of SPB"}))})),t(p,e({sx:{px:1.5,pb:1.5,pt:0,bgcolor:"#F8FAFC",display:"flex",flexDirection:"column",gap:1}},{children:T.length>0?T.map(function(n,o){return i(s,e({disableGutters:!0,elevation:0,defaultExpanded:0===o,sx:e({bgcolor:"#fff",border:"1px solid #E5E7EB",borderRadius:"8px !important","&:before":{display:"none"},overflow:"hidden"},null==ee?void 0:ee.functionalityItem)},{children:[t(h,e({expandIcon:t(v,{sx:{fontSize:"1rem",color:"#6B7280"}}),sx:{px:1.5,minHeight:38,"& .MuiAccordionSummary-content":{my:.5}}},{children:i(c,e({sx:{fontWeight:600,fontSize:"0.8rem",color:"#111827"}},{children:[o+1,". ",n.name||n.section_name]}))})),i(p,e({sx:{px:1.5,pb:1.5,pt:0,display:"flex",flexDirection:"column",gap:.75}},{children:[t(D,{fontSize:"0.74rem",message:n.description||n.reason_for_inclusion||"",extraMetaData:L}),t(c,e({sx:{fontSize:"0.72rem",color:"#9CA3AF",fontWeight:500,mt:.25}},{children:"APB References"})),t(d,e({sx:{display:"flex",flexDirection:"column",gap:.75}},{children:n.apb_references.map(function(n,o){var r="string"==typeof n?n:n.apb_name,l=ce===r;return i(d,e({sx:{display:"flex",flexDirection:"column",gap:.15}},{children:[i(d,e({onClick:function(){return function(e){ce===e?(ae(null),pe("")):(ae(e),pe(""),setTimeout(function(){return pe(e)},50))}(r)},sx:{display:"flex",alignItems:"center",gap:.25,cursor:"pointer"}},{children:[i(c,e({sx:{fontSize:"0.78rem",color:l?"#5928ed":"#DB2877",fontWeight:500}},{children:[o+1,". ",r]})),t(S,{sx:{fontSize:"0.75rem",color:l?"#5928ed":"#DB2877"}})]})),"string"!=typeof n&&(n.description||n.context)&&t(M,{text:n.description||n.context||"",extraMetaData:L}),N&&l&&t(d,e({sx:{mt:1,height:260,border:"1px solid #e5e7eb",borderRadius:"8px",overflow:"hidden"}},{children:t(k,{content:A,selectedTag:he,isDarkMode:ue,height:"100%",fontSize:12})}))]}),o)})}))]}))]}),o)}):t(d,e({sx:{display:"flex",flexDirection:"column",gap:1}},{children:[1,2,3].map(function(n){return i(d,e({sx:{bgcolor:"#fff",border:"1px solid #E5E7EB",borderRadius:"8px",p:1.5,display:"flex",flexDirection:"column",gap:.5}},{children:[t(a,{variant:"text",width:"40%",height:16}),t(a,{variant:"text",width:"90%",height:14}),t(a,{variant:"text",width:"80%",height:14}),t(a,{variant:"text",width:"30%",height:14})]}),n)})}))}))]})),i(s,e({disableGutters:!0,elevation:0,sx:e({border:"1px solid #E5E7EB",borderRadius:"8px !important","&:before":{display:"none"},"&.Mui-expanded":{bgcolor:"#F8FAFC"},bgcolor:"#fff"},null==ee?void 0:ee.applicabilitySection)},{children:[i(h,e({expandIcon:t(v,{sx:{fontSize:"1rem",color:"#6B7280"}}),sx:{px:1.5,minHeight:"unset","& .MuiAccordionSummary-content":{my:.75,alignItems:"center",gap:1}}},{children:[t(c,e({sx:e({fontWeight:600,fontSize:"0.85rem",color:"#111827"},null==ee?void 0:ee.applicabilityTitle)},{children:"Applicability"})),t(c,e({sx:{fontSize:"0.7rem",color:"#9CA3AF"}},{children:"When to Apply this SPB / When Not Apply"}))]})),t(p,e({sx:{px:1.5,pb:1.5,pt:0,bgcolor:"#F8FAFC"}},{children:t(d,e({sx:{display:"flex",gap:1}},{children:[{label:"When to apply",content:null==_?void 0:_.when_to_apply},{label:"When NOT to apply",content:null==_?void 0:_.when_not_to_apply}].map(function(n){var o=n.label,r=n.content;return i(d,e({sx:{flex:1,bgcolor:"#fff",border:"1px solid #E5E7EB",borderRadius:"6px",p:1.25}},{children:[t(c,e({sx:{fontWeight:600,fontSize:"0.76rem",color:"#374151",mb:.75}},{children:o})),r?t(D,{fontSize:"0.8rem",message:r,isDarkMode:ue,style:null==ee?void 0:ee.markdownRenderer,extraMetaData:L}):I?i(d,e({sx:{display:"flex",flexDirection:"column",gap:.5}},{children:[t(a,{variant:"text",width:"100%",height:14}),t(a,{variant:"text",width:"80%",height:14}),t(a,{variant:"text",width:"90%",height:14})]})):t(c,e({sx:{fontSize:"0.8rem",color:"#6B7280",lineHeight:1.5}},{children:"— Not yet available"}))]}),o)})}))}))]})),i(s,e({disableGutters:!0,elevation:0,sx:e({border:"1px solid #E5E7EB",borderRadius:"8px !important","&:before":{display:"none"},"&.Mui-expanded":{bgcolor:"#F8FAFC"},bgcolor:"#fff"},null==ee?void 0:ee.specificationsSection)},{children:[i(h,e({expandIcon:t(v,{sx:{fontSize:"1rem",color:"#6B7280"}}),sx:{px:1.5,minHeight:"unset","& .MuiAccordionSummary-content":{my:.75,alignItems:"center",gap:1}}},{children:[t(c,e({sx:e({fontWeight:600,fontSize:"0.85rem",color:"#111827"},null==ee?void 0:ee.specificationsTitle)},{children:"Specifications"})),t(c,e({sx:{fontSize:"0.7rem",color:"#9CA3AF"}},{children:"Strict Rules / Input / Output"}))]})),t(p,e({sx:{px:1.5,pb:1.5,pt:0,bgcolor:"#F8FAFC",display:"flex",flexDirection:"column",gap:1}},{children:[{label:"Strict Rules",tooltip:null,content:null==_?void 0:_.constraints_and_rules},{label:"Input",tooltip:"Input specification for this SPB",content:null==_?void 0:_.input_analysis},{label:"Output",tooltip:"Output specification for this SPB",content:null==_?void 0:_.output_analysis}].map(function(o){var r=o.label,l=o.tooltip,u=o.content,m="Output"===r,g=m&&u?function(e){var i=[];return{text:e.replace(/<code>([\s\S]*?)<\/code>/g,function(e,t){return i.push(t.trim()),""}).trim(),code:i.join("\n\n")}}(u):null,b=g?g.text:u,y=g?g.code:"";return i(s,e({disableGutters:!0,elevation:0,defaultExpanded:"Strict Rules"===r,sx:{bgcolor:"#fff",border:"1px solid #E5E7EB",borderRadius:"6px !important","&:before":{display:"none"},overflow:"hidden"}},{children:[t(h,e({expandIcon:t(v,{sx:{fontSize:"1rem"}}),sx:{minHeight:34,px:1.25,"& .MuiAccordionSummary-content":{my:.4}}},{children:i(d,e({sx:{display:"flex",alignItems:"center",gap:.5}},{children:[t(c,e({sx:{fontWeight:600,fontSize:"0.76rem",color:"#374151"}},{children:r})),l&&t(f,e({title:l,placement:"top"},{children:t(d,e({component:"span",sx:{width:13,height:13,borderRadius:"50%",background:"#E5E7EB",display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:"0.58rem",color:"#6B7280",fontWeight:700,cursor:"default",flexShrink:0}},{children:"i"}))}))]}))})),t(p,e({sx:{px:1.25,pb:1.25,pt:0}},{children:u?i(n,{children:[b&&t(D,{fontSize:"0.8rem",message:b,isDarkMode:ue,style:null==ee?void 0:ee.markdownRenderer,extraMetaData:L}),m&&y&&i(d,e({sx:{width:"100%",height:"35vh",mt:1.5}},{children:[i(d,e({sx:{display:"flex",gap:.1,backgroundColor:"black",flexDirection:"row",alignItems:"center",justifyContent:"space-between",p:1,borderTopLeftRadius:"8px",borderTopRightRadius:"8px"}},{children:[t(c,e({sx:{color:"white",fontWeight:500,fontSize:"0.8rem"}},{children:"Output preview"})),t(f,e({title:"Copy Code to clipboard"},{children:t(x,e({size:"small",onClick:function(){return e=y,navigator.clipboard.writeText(e);var e}},{children:t(c,e({sx:{fontSize:"0.7rem",color:"white"}},{children:"Copy"}))}))}))]})),t(d,e({sx:{mt:-1,height:"calc(100% - 40px)",borderBottomLeftRadius:"8px",borderBottomRightRadius:"8px",overflow:"hidden"}},{children:t(k,{content:y,isDarkMode:ue,height:"100%",fontSize:10})}))]}))]}):I?i(d,e({sx:{display:"flex",flexDirection:"column",gap:.5}},{children:[t(a,{variant:"text",width:"100%",height:14}),t(a,{variant:"text",width:"90%",height:14}),t(a,{variant:"text",width:"75%",height:14})]})):t(c,e({sx:{fontSize:"0.74rem",color:"#6B7280",lineHeight:1.5}},{children:"— Not yet available"}))}))]}),r)})}))]})),i(s,e({defaultExpanded:!0,disableGutters:!0,elevation:0,sx:e({border:"1px solid #E5E7EB",borderRadius:"8px !important","&:before":{display:"none"},bgcolor:"#fff"},null==ee?void 0:ee.dependencyGraphSection)},{children:[t(h,e({expandIcon:t(v,{sx:{fontSize:"1rem",color:"#6B7280"}}),sx:{px:1.5,minHeight:"unset","& .MuiAccordionSummary-content":{my:.75},"&.Mui-expanded":{bgcolor:"#F8FAFC",borderRadius:"8px 8px 0 0"}}},{children:t(c,e({sx:e({fontWeight:600,fontSize:"0.85rem",color:"#111827"},null==ee?void 0:ee.dependencyGraphTitle)},{children:"Dependency Graph"}))})),t(p,e({sx:{px:0,pb:0,pt:0}},{children:(null==_?void 0:_.dependency_graph)?i(d,e({sx:{bgcolor:"#F8FAFC",borderRadius:"0 0 8px 8px",p:1.5,display:"flex",flexDirection:"column",gap:1.5}},{children:[t(d,e({sx:{height:500,borderRadius:"8px",overflow:"hidden"}},{children:t(E,{data:_.dependency_graph,isDarkMode:ue,style:null==ee?void 0:ee.dependencyGraph})})),t(c,e({sx:{fontSize:"0.72rem",color:"#64748B",lineHeight:1.6}},{children:"This graph visualises how Atomic Prompt Blocks (APBs) depend on, influence, or exchange information with one another within the prompt architecture."}))]})):i(d,e({sx:{bgcolor:"#fff",borderRadius:"0 0 8px 8px",p:1.5,display:"flex",flexDirection:"column",gap:1}},{children:[t(a,{variant:"rectangular",width:"100%",height:400,sx:{borderRadius:"8px"}}),t(a,{variant:"text",width:"100%",height:14}),t(a,{variant:"text",width:"80%",height:14})]}))}))]}))]}))})),O&&Y&&t(d,e({onClick:function(){return we(function(e){return!e})},sx:e({width:20,flexShrink:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",cursor:"pointer",borderRight:"1px solid #e5e7eb",borderLeft:"1px solid #e5e7eb",bgcolor:"#f9fafb",position:"relative",py:2,"&:hover":{bgcolor:"#f0f0f0"}},null==ee?void 0:ee.collapseStrip)},{children:t(c,e({sx:{fontSize:10,fontWeight:600,color:"#6b7280",writingMode:"vertical-rl",textOrientation:"mixed",transform:"rotate(180deg)",letterSpacing:"0.05em",userSelect:"none"}},{children:"SPB Details"}))})),O&&Y&&t(d,e({onClick:function(){return we(function(e){return!e})},onMouseDown:function(e){e.preventDefault(),ke.current=!0;var i=function(e){if(ke.current&&Be.current){var n=Be.current.getBoundingClientRect(),o=n.left,r=n.width,l=e.clientX-o;if(l<200)return we(!0),ke.current=!1,document.removeEventListener("mousemove",i),void document.removeEventListener("mouseup",t);l>.7*r||(we(!1),De(l))}},t=function(){ke.current=!1,document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",t)};document.addEventListener("mousemove",i),document.addEventListener("mouseup",t)},sx:e({position:"absolute",left:Se?20:Ee+20,top:"50%",transform:"translateY(-50%)",width:18,height:28,bgcolor:"#fff",border:"1px solid #e5e7eb",borderRadius:"0 6px 6px 0",display:"flex",alignItems:"center",justifyContent:"center",cursor:"col-resize",zIndex:5,boxShadow:"2px 0 4px rgba(0,0,0,0.06)","&:hover":{bgcolor:"#f9fafb"}},null==ee?void 0:ee.dragHandle)},{children:t(Se?z:w,{sx:{fontSize:12,color:"#6b7280"}})})),O&&i(d,e({sx:e({flex:1,minWidth:0,minHeight:0,display:"flex",flexDirection:"column",overflow:"hidden",p:2,gap:1.5,bgcolor:"#f8fafc"},null==ee?void 0:ee.codePanel)},{children:[i(d,e({sx:e({display:"flex",alignItems:"center",justifyContent:"space-between",flexShrink:0},null==ee?void 0:ee.codePanelHeader)},{children:[t(c,e({sx:e({fontSize:13,fontWeight:600,color:"#374151"},null==ee?void 0:ee.codePanelTitle)},{children:F||"SPB Analysis"})),i(d,e({sx:{display:"flex",alignItems:"center",gap:1.5}},{children:[V&&t(u,{checked:ue,onChange:function(e){return me(e.target.checked)},size:"small",sx:{width:36,height:20,padding:0,"& .MuiSwitch-switchBase":{padding:0,margin:"2px","&.Mui-checked":{transform:"translateX(16px)",color:"#fff","& + .MuiSwitch-track":{bgcolor:"#5928ed",opacity:1}}},"& .MuiSwitch-thumb":{width:16,height:16,bgcolor:"#fff"},"& .MuiSwitch-track":{borderRadius:10,bgcolor:"#d1d5db",opacity:1}}}),J&&Q&&t(f,e({title:"Fullscreen",placement:"top"},{children:t(x,e({size:"small",onClick:function(){return be({ref:he||"",description:""})},sx:{color:"#6b7280"}},{children:t(b,{sx:{fontSize:16}})}))}))]}))]})),t(d,e({sx:e({flex:1,minHeight:0,border:"1px solid #30363d",borderRadius:1,overflow:"hidden"},null==ee?void 0:ee.editorContainer)},{children:t(k,{content:A,selectedTag:he,isDarkMode:ue,height:"100%",fontSize:13})}))]}))]})),Q&&i(m,e({open:!!ve,onClose:function(){return be(null)},maxWidth:!1,PaperProps:{sx:e({width:"82vw",height:"80vh",maxWidth:"none",borderRadius:"12px",overflow:"hidden",display:"flex",flexDirection:"column"},null==ee?void 0:ee.fullscreenModal)}},{children:[i(d,e({sx:{px:2.5,py:1.5,borderBottom:"1px solid #E5E7EB",display:"flex",alignItems:"center",justifyContent:"space-between",flexShrink:0}},{children:[t(c,e({sx:{fontWeight:700,fontSize:"1rem",color:"#111827"}},{children:"Promptemon"})),t(x,e({size:"small",onClick:function(){return be(null)}},{children:t(y,{sx:{fontSize:"1.1rem",color:"#6B7280"}})}))]})),i(d,e({sx:{flex:1,display:"flex",overflow:"hidden",minHeight:0}},{children:[i(d,e({sx:{width:"40%",flexShrink:0,borderRight:"1px solid #E5E7EB",display:"flex",flexDirection:"column",overflow:"hidden"}},{children:[i(d,e({sx:{px:2,py:1.25,borderBottom:"1px solid #E5E7EB",display:"flex",alignItems:"center",gap:1}},{children:[t(f,e({title:"Atomic Prompt Block",placement:"top"},{children:t(g,{label:"APB",size:"small",sx:{bgcolor:"#f1f5f9",color:"#475569",fontWeight:700,fontSize:10,height:20,borderRadius:1}})})),t(c,e({sx:{fontWeight:600,fontSize:"0.9rem",color:"#111827"}},{children:null==ve?void 0:ve.ref}))]})),i(d,e({sx:{flex:1,p:2,display:"flex",flexDirection:"column",gap:1.5,overflowY:"auto"}},{children:[i(d,e({sx:{border:"1px solid #E5E7EB",borderRadius:"8px",p:1.5}},{children:[t(c,e({sx:{fontWeight:600,fontSize:"0.8rem",color:"#111827",mb:.75}},{children:"Description"})),t(c,e({sx:{fontSize:"0.73rem",color:"#6B7280",lineHeight:1.6}},{children:null==ve?void 0:ve.description}))]})),i(d,e({sx:{border:"1px solid #E5E7EB",borderRadius:"8px",p:1.25,display:"flex",alignItems:"center",gap:.5}},{children:[t(c,e({sx:{fontSize:"0.73rem",color:"#6B7280"}},{children:"Total Lines"})),t(c,e({sx:{fontSize:"0.73rem",fontWeight:700,color:"#111827"}},{children:A.split("\n").length}))]}))]}))]})),i(d,e({sx:{flex:1,minWidth:0,display:"flex",flexDirection:"column",overflow:"hidden"}},{children:[i(d,e({sx:{px:2,py:1.25,borderBottom:"1px solid #E5E7EB",display:"flex",alignItems:"center",justifyContent:"space-between"}},{children:[t(c,e({sx:{fontWeight:600,fontSize:"0.85rem",color:"#111827"}},{children:"Prompt Preview"})),t(u,{checked:ue,onChange:function(e){return me(e.target.checked)},size:"small",sx:{width:36,height:20,padding:0,"& .MuiSwitch-switchBase":{padding:0,margin:"2px","&.Mui-checked":{transform:"translateX(16px)",color:"#fff","& + .MuiSwitch-track":{bgcolor:"#5928ed",opacity:1}}},"& .MuiSwitch-thumb":{width:16,height:16,bgcolor:"#fff"},"& .MuiSwitch-track":{borderRadius:10,bgcolor:"#d1d5db",opacity:1}}})]})),t(d,e({sx:{flex:1,minHeight:0,p:1.5}},{children:t(k,{content:A,selectedTag:he,isDarkMode:ue,height:"100%",fontSize:13})}))]}))]}))]}))]}))};export{C as default};
|
|
1
|
+
import{__assign as e}from"tslib";import{jsxs as i,jsx as n,Fragment as t}from"react/jsx-runtime";import{useState as o,useEffect as r,useRef as l}from"react";import{Box as d,Typography as c,Skeleton as a,Accordion as s,AccordionSummary as h,AccordionDetails as p,Tooltip as f,IconButton as u,Switch as x,Dialog as m,Chip as g}from"@mui/material";import v from"@mui/icons-material/ExpandMore";import b from"@mui/icons-material/Fullscreen";import y from"@mui/icons-material/Close";import S from"@mui/icons-material/NearMeOutlined";import w from"@mui/icons-material/ChevronLeft";import D from"@mui/icons-material/ChevronRight";import z from"./DependencyGraph.js";import{MarkdownRenderer as E}from"./Markdownrenderer.js";import{InternalEditor as k}from"./Internaleditor.js";var B=function(t){var r=t.text,l=t.detailedSummary,a=t.extraMetaData,s=t.isDarkMode,h=void 0!==s&&s,p=t.markdownRendererStyle,f=t.cognitiveDecisioningStyles,u=o(!1),x=u[0],m=u[1],g=function(e,i){void 0===i&&(i=220);var n=e.replace(/<!--\s*<ai_reasoning>[\s\S]*?<\/ai_reasoning>\s*-->/g,"").replace(/<[^>]+>/g,"").replace(/\s+/g," ").trim();if(n.length<=i)return{preview:n,truncated:!1};var t=n.slice(0,i),o=t.lastIndexOf(" ");return{preview:(o>0?t.slice(0,o):t).trim(),truncated:!0}}(r),v=g.preview,b=g.truncated;return n(d,{children:i(d,x?{children:[n(E,{message:r,fontSize:"0.8rem",extraMetaData:a,isDarkMode:h,cognitiveDecisioningStyles:f,style:p}),(null==l?void 0:l.trim())&&n(E,{message:l,fontSize:"0.8rem",extraMetaData:a,isDarkMode:h,cognitiveDecisioningStyles:f,style:p}),n(c,e({component:"span",onClick:function(){return m(!1)},sx:{fontSize:"0.72rem",color:h?"#a78bfa":"#5928ed",fontWeight:600,cursor:"pointer"}},{children:"view less"}))]}:e({sx:{display:"flex",flexDirection:"column"}},{children:[i(c,e({sx:{fontSize:"0.8rem",color:h?"#cbd5e1":"#4B5563",lineHeight:1.6}},{children:[v,b&&"…"]})),(b||(null==l?void 0:l.trim()))&&n(d,e({sx:{display:"flex",justifyContent:"flex-end"}},{children:n(c,e({component:"span",onClick:function(){return m(!0)},sx:{fontSize:"0.72rem",color:h?"#a78bfa":"#5928ed",fontWeight:600,cursor:"pointer"}},{children:"...view more"}))}))]}))})},M=function(t){var a=t.text,s=t.extraMetaData,h=t.cognitiveDecisioningStyles,p=o(!1),f=p[0],u=p[1],x=o(!1),m=x[0],g=x[1],v=l(null);return r(function(){var e=v.current;e&&g(e.scrollWidth>e.clientWidth)},[a]),n(d,e({sx:{pl:1}},{children:i(d,f?e({sx:{fontSize:"0.68rem",color:"#9CA3AF",lineHeight:1.4}},{children:[n(E,{message:a,fontSize:"0.68rem",extraMetaData:s,cognitiveDecisioningStyles:h}),n(c,e({component:"span",onClick:function(){return u(!1)},sx:{fontSize:"0.65rem",color:"#5928ed",cursor:"pointer",fontWeight:600}},{children:"view less"}))]}):e({sx:{display:"flex",alignItems:"baseline",gap:.5}},{children:[n(c,e({ref:v,sx:{fontSize:"0.68rem",color:"#9CA3AF",lineHeight:1.4,overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",flex:1,minWidth:0}},{children:a})),m&&n(c,e({component:"span",onClick:function(){return u(!0)},sx:{fontSize:"0.65rem",color:"#5928ed",cursor:"pointer",fontWeight:600,flexShrink:0}},{children:"view more"}))]}))}))},C=function(C){var R,A=C.promptContent,F=C.promptTitle,W=C.isLoading,I=void 0!==W&&W,H=C.overviewSummary,P=C.functionalityOfSPB,T=void 0===P?[]:P,_=C.spbAdditionalInfo,L=C.lastAnalyzedAt,j=C.extraMetaData,O=C.showCodePanel,G=void 0===O||O,N=C.showInlineApbEditor,X=void 0===N||N,Y=C.disableApbNavigation,q=void 0!==Y&&Y,J=C.showCollapseStrip,K=void 0===J||J,Q=C.showFullscreenButton,U=void 0===Q||Q,V=C.showFullscreenModal,Z=void 0===V||V,$=C.showThemeToggle,ee=void 0===$||$,ie=C.isDarkMode,ne=void 0===ie||ie,te=C.styles,oe=C.className,re=C.style,le=C.sx,de=o(null),ce=de[0],ae=de[1],se=o(null),he=se[0],pe=se[1],fe=o(""),ue=fe[0],xe=fe[1],me=void 0!==(null==te?void 0:te.isDarkMode)?te.isDarkMode:ne,ge=o(me),ve=ge[0],be=ge[1],ye=o(null),Se=ye[0],we=ye[1];r(function(){void 0!==(null==te?void 0:te.isDarkMode)&&be(te.isDarkMode)},[null==te?void 0:te.isDarkMode]);var De=o(!1),ze=De[0],Ee=De[1],ke=o(480),Be=ke[0],Me=ke[1],Ce=l(!1),Re=l(null);r(function(){var e,i,n;L?ae(L):T.length>0&&ae((e=new Date,i=e.toLocaleTimeString("en-IN",{hour:"numeric",minute:"2-digit",second:"2-digit",hour12:!0}),n=e.toLocaleDateString("en-IN",{day:"numeric",month:"short",year:"numeric"}),"".concat(i||""," | ").concat(n||"")))},[T,L]),r(function(){I&&ae(null)},[I]),r(function(){Se&&(xe(""),setTimeout(function(){return xe(Se.ref)},500))},[Se]);return i(d,e({className:oe,style:e(e({},null==te?void 0:te.root),re),sx:e({height:"100%",display:"flex",flexDirection:"column",width:"100%",minHeight:0,overflow:"hidden"},le)},{children:[n(d,e({sx:e({px:2.5,py:1.5,borderBottom:"1px solid #e5e7eb",display:"flex",alignItems:"center",justifyContent:"space-between",bgcolor:"#fff",flexShrink:0},null==te?void 0:te.header)},{children:i(d,e({sx:{display:"flex",flexDirection:"column",gap:.25}},{children:[n(c,e({sx:e({fontWeight:700,fontSize:"0.9rem",color:"#111827"},null==te?void 0:te.headerTitle)},{children:F||"SPB Analysis"})),n(c,e({sx:e({fontSize:"0.7rem",color:"#9CA3AF"},null==te?void 0:te.headerSubtitle)},{children:ce?"Last Analyzed at ".concat(ce):""}))]}))})),i(d,e({ref:Re,sx:{display:"flex",flex:1,minHeight:0,overflow:"hidden",position:"relative"}},{children:[n(d,e({sx:e({width:G?ze&&K?0:Be:"100%",flexShrink:0,minHeight:0,overflow:"hidden",transition:Ce.current?"none":"width 0.15s",borderRight:!G||ze&&K?"none":"1px solid #e5e7eb"},null==te?void 0:te.leftPanel)},{children:i(d,e({sx:{width:"100%",height:"100%",minHeight:0,overflowY:"auto",display:"flex",flexDirection:"column",gap:1,px:1.25,py:1.25,pb:2}},{children:[i(d,e({sx:e({border:"1px solid #E5E7EB",borderRadius:"8px",bgcolor:"#F8FAFC",p:1.5},null==te?void 0:te.overviewSection)},{children:[n(c,e({sx:e({fontWeight:600,fontSize:"0.85rem",color:"#111827",mb:1},null==te?void 0:te.overviewTitle)},{children:"Overview"})),n(d,e({sx:e({bgcolor:"#fff",border:"1px solid #E5E7EB",borderRadius:"8px",p:1.5},null==te?void 0:te.overviewContent)},{children:(null===(R=null==H?void 0:H.overallSummary)||void 0===R?void 0:R.trim())?n(B,{text:H.overallSummary,detailedSummary:H.detailedSummary,extraMetaData:j,isDarkMode:ve,markdownRendererStyle:null==te?void 0:te.markdownRenderer,cognitiveDecisioningStyles:null==te?void 0:te.cognitiveDecisioning}):i(d,e({sx:{display:"flex",flexDirection:"column",gap:.5}},{children:[n(a,{variant:"text",width:"100%",height:14}),n(a,{variant:"text",width:"90%",height:14}),n(a,{variant:"text",width:"95%",height:14})]}))}))]})),i(s,e({disableGutters:!0,elevation:0,sx:e({border:"1px solid #E5E7EB",borderRadius:"8px !important","&:before":{display:"none"},"&.Mui-expanded":{bgcolor:"#F8FAFC"},bgcolor:"#fff"},null==te?void 0:te.functionalitySection)},{children:[n(h,e({expandIcon:n(v,{sx:{fontSize:"1rem",color:"#6B7280"}}),sx:{px:1.5,minHeight:"unset","& .MuiAccordionSummary-content":{my:.75}}},{children:n(c,e({sx:e({fontWeight:600,fontSize:"0.85rem",color:"#111827"},null==te?void 0:te.functionalityTitle)},{children:"Functionality of SPB"}))})),n(p,e({sx:{px:1.5,pb:1.5,pt:0,bgcolor:"#F8FAFC",display:"flex",flexDirection:"column",gap:1}},{children:T.length>0?T.map(function(t,o){return i(s,e({disableGutters:!0,elevation:0,defaultExpanded:0===o,sx:e({bgcolor:"#fff",border:"1px solid #E5E7EB",borderRadius:"8px !important","&:before":{display:"none"},overflow:"hidden"},null==te?void 0:te.functionalityItem)},{children:[n(h,e({expandIcon:n(v,{sx:{fontSize:"1rem",color:"#6B7280"}}),sx:{px:1.5,minHeight:38,"& .MuiAccordionSummary-content":{my:.5}}},{children:i(c,e({sx:{fontWeight:600,fontSize:"0.8rem",color:"#111827"}},{children:[o+1,". ",t.name||t.section_name]}))})),i(p,e({sx:{px:1.5,pb:1.5,pt:0,display:"flex",flexDirection:"column",gap:.75}},{children:[n(E,{fontSize:"0.74rem",message:t.description||t.reason_for_inclusion||"",extraMetaData:j,cognitiveDecisioningStyles:null==te?void 0:te.cognitiveDecisioning}),n(c,e({sx:{fontSize:"0.72rem",color:"#9CA3AF",fontWeight:500,mt:.25}},{children:"APB References"})),n(d,e({sx:{display:"flex",flexDirection:"column",gap:.75}},{children:t.apb_references.map(function(t,o){var r="string"==typeof t?t:t.apb_name,l=he===r;return i(d,e({sx:{display:"flex",flexDirection:"column",gap:.15}},{children:[i(d,e({onClick:q?void 0:function(){return function(e){he===e?(pe(null),xe("")):(pe(e),xe(""),setTimeout(function(){return xe(e)},50))}(r)},sx:{display:"flex",alignItems:"center",gap:.25,cursor:q?"default":"pointer"}},{children:[i(c,e({sx:{fontSize:"0.78rem",color:l?"#5928ed":"#DB2877",fontWeight:500}},{children:[o+1,". ",r]})),!q&&n(S,{sx:{fontSize:"0.75rem",color:l?"#5928ed":"#DB2877"}})]})),"string"!=typeof t&&(t.description||t.context)&&n(M,{text:t.description||t.context||"",extraMetaData:j,cognitiveDecisioningStyles:null==te?void 0:te.cognitiveDecisioning}),X&&l&&n(d,e({sx:{mt:1,height:260,border:"1px solid #e5e7eb",borderRadius:"8px",overflow:"hidden"}},{children:n(k,{content:A,selectedTag:ue,isDarkMode:ve,height:"100%",fontSize:12})}))]}),o)})}))]}))]}),o)}):n(d,e({sx:{display:"flex",flexDirection:"column",gap:1}},{children:[1,2,3].map(function(t){return i(d,e({sx:{bgcolor:"#fff",border:"1px solid #E5E7EB",borderRadius:"8px",p:1.5,display:"flex",flexDirection:"column",gap:.5}},{children:[n(a,{variant:"text",width:"40%",height:16}),n(a,{variant:"text",width:"90%",height:14}),n(a,{variant:"text",width:"80%",height:14}),n(a,{variant:"text",width:"30%",height:14})]}),t)})}))}))]})),i(s,e({disableGutters:!0,elevation:0,sx:e({border:"1px solid #E5E7EB",borderRadius:"8px !important","&:before":{display:"none"},"&.Mui-expanded":{bgcolor:"#F8FAFC"},bgcolor:"#fff"},null==te?void 0:te.applicabilitySection)},{children:[i(h,e({expandIcon:n(v,{sx:{fontSize:"1rem",color:"#6B7280"}}),sx:{px:1.5,minHeight:"unset","& .MuiAccordionSummary-content":{my:.75,alignItems:"center",gap:1}}},{children:[n(c,e({sx:e({fontWeight:600,fontSize:"0.85rem",color:"#111827"},null==te?void 0:te.applicabilityTitle)},{children:"Applicability"})),n(c,e({sx:{fontSize:"0.7rem",color:"#9CA3AF"}},{children:"When to Apply this SPB / When Not Apply"}))]})),n(p,e({sx:{px:1.5,pb:1.5,pt:0,bgcolor:"#F8FAFC"}},{children:n(d,e({sx:{display:"flex",gap:1}},{children:[{label:"When to apply",content:null==_?void 0:_.when_to_apply},{label:"When NOT to apply",content:null==_?void 0:_.when_not_to_apply}].map(function(t){var o=t.label,r=t.content;return i(d,e({sx:{flex:1,bgcolor:"#fff",border:"1px solid #E5E7EB",borderRadius:"6px",p:1.25}},{children:[n(c,e({sx:{fontWeight:600,fontSize:"0.76rem",color:"#374151",mb:.75}},{children:o})),r?n(E,{fontSize:"0.8rem",message:r,isDarkMode:ve,style:null==te?void 0:te.markdownRenderer,extraMetaData:j,cognitiveDecisioningStyles:null==te?void 0:te.cognitiveDecisioning}):I?i(d,e({sx:{display:"flex",flexDirection:"column",gap:.5}},{children:[n(a,{variant:"text",width:"100%",height:14}),n(a,{variant:"text",width:"80%",height:14}),n(a,{variant:"text",width:"90%",height:14})]})):n(c,e({sx:{fontSize:"0.8rem",color:"#6B7280",lineHeight:1.5}},{children:"— Not yet available"}))]}),o)})}))}))]})),i(s,e({disableGutters:!0,elevation:0,sx:e({border:"1px solid #E5E7EB",borderRadius:"8px !important","&:before":{display:"none"},"&.Mui-expanded":{bgcolor:"#F8FAFC"},bgcolor:"#fff"},null==te?void 0:te.specificationsSection)},{children:[i(h,e({expandIcon:n(v,{sx:{fontSize:"1rem",color:"#6B7280"}}),sx:{px:1.5,minHeight:"unset","& .MuiAccordionSummary-content":{my:.75,alignItems:"center",gap:1}}},{children:[n(c,e({sx:e({fontWeight:600,fontSize:"0.85rem",color:"#111827"},null==te?void 0:te.specificationsTitle)},{children:"Specifications"})),n(c,e({sx:{fontSize:"0.7rem",color:"#9CA3AF"}},{children:"Strict Rules / Input / Output"}))]})),n(p,e({sx:{px:1.5,pb:1.5,pt:0,bgcolor:"#F8FAFC",display:"flex",flexDirection:"column",gap:1}},{children:[{label:"Strict Rules",tooltip:null,content:null==_?void 0:_.constraints_and_rules},{label:"Input",tooltip:"Input specification for this SPB",content:null==_?void 0:_.input_analysis},{label:"Output",tooltip:"Output specification for this SPB",content:null==_?void 0:_.output_analysis}].map(function(o){var r=o.label,l=o.tooltip,x=o.content,m="Output"===r,g=m&&x?function(e){var i=[];return{text:e.replace(/<code>([\s\S]*?)<\/code>/g,function(e,n){return i.push(n.trim()),""}).trim(),code:i.join("\n\n")}}(x):null,b=g?g.text:x,y=g?g.code:"";return i(s,e({disableGutters:!0,elevation:0,defaultExpanded:"Strict Rules"===r,sx:{bgcolor:"#fff",border:"1px solid #E5E7EB",borderRadius:"6px !important","&:before":{display:"none"},overflow:"hidden"}},{children:[n(h,e({expandIcon:n(v,{sx:{fontSize:"1rem"}}),sx:{minHeight:34,px:1.25,"& .MuiAccordionSummary-content":{my:.4}}},{children:i(d,e({sx:{display:"flex",alignItems:"center",gap:.5}},{children:[n(c,e({sx:{fontWeight:600,fontSize:"0.76rem",color:"#374151"}},{children:r})),l&&n(f,e({title:l,placement:"top"},{children:n(d,e({component:"span",sx:{width:13,height:13,borderRadius:"50%",background:"#E5E7EB",display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:"0.58rem",color:"#6B7280",fontWeight:700,cursor:"default",flexShrink:0}},{children:"i"}))}))]}))})),n(p,e({sx:{px:1.25,pb:1.25,pt:0}},{children:x?i(t,{children:[b&&n(E,{fontSize:"0.8rem",message:b,isDarkMode:ve,style:null==te?void 0:te.markdownRenderer,extraMetaData:j,cognitiveDecisioningStyles:null==te?void 0:te.cognitiveDecisioning}),m&&y&&i(d,e({sx:{width:"100%",height:"35vh",mt:1.5}},{children:[i(d,e({sx:{display:"flex",gap:.1,backgroundColor:"black",flexDirection:"row",alignItems:"center",justifyContent:"space-between",p:1,borderTopLeftRadius:"8px",borderTopRightRadius:"8px"}},{children:[n(c,e({sx:{color:"white",fontWeight:500,fontSize:"0.8rem"}},{children:"Output preview"})),n(f,e({title:"Copy Code to clipboard"},{children:n(u,e({size:"small",onClick:function(){return e=y,navigator.clipboard.writeText(e);var e}},{children:n(c,e({sx:{fontSize:"0.7rem",color:"white"}},{children:"Copy"}))}))}))]})),n(d,e({sx:{mt:-1,height:"calc(100% - 40px)",borderBottomLeftRadius:"8px",borderBottomRightRadius:"8px",overflow:"hidden"}},{children:n(k,{content:y,isDarkMode:ve,height:"100%",fontSize:10})}))]}))]}):I?i(d,e({sx:{display:"flex",flexDirection:"column",gap:.5}},{children:[n(a,{variant:"text",width:"100%",height:14}),n(a,{variant:"text",width:"90%",height:14}),n(a,{variant:"text",width:"75%",height:14})]})):n(c,e({sx:{fontSize:"0.74rem",color:"#6B7280",lineHeight:1.5}},{children:"— Not yet available"}))}))]}),r)})}))]})),i(s,e({defaultExpanded:!0,disableGutters:!0,elevation:0,sx:e({border:"1px solid #E5E7EB",borderRadius:"8px !important","&:before":{display:"none"},bgcolor:"#fff"},null==te?void 0:te.dependencyGraphSection)},{children:[n(h,e({expandIcon:n(v,{sx:{fontSize:"1rem",color:"#6B7280"}}),sx:{px:1.5,minHeight:"unset","& .MuiAccordionSummary-content":{my:.75},"&.Mui-expanded":{bgcolor:"#F8FAFC",borderRadius:"8px 8px 0 0"}}},{children:n(c,e({sx:e({fontWeight:600,fontSize:"0.85rem",color:"#111827"},null==te?void 0:te.dependencyGraphTitle)},{children:"Dependency Graph"}))})),n(p,e({sx:{px:0,pb:0,pt:0}},{children:(null==_?void 0:_.dependency_graph)?i(d,e({sx:{bgcolor:"#F8FAFC",borderRadius:"0 0 8px 8px",p:1.5,display:"flex",flexDirection:"column",gap:1.5}},{children:[n(d,e({sx:{height:500,borderRadius:"8px",overflow:"hidden"}},{children:n(z,{data:_.dependency_graph,isDarkMode:ve,style:null==te?void 0:te.dependencyGraph})})),n(c,e({sx:{fontSize:"0.72rem",color:"#64748B",lineHeight:1.6}},{children:"This graph visualises how Atomic Prompt Blocks (APBs) depend on, influence, or exchange information with one another within the prompt architecture."}))]})):i(d,e({sx:{bgcolor:"#fff",borderRadius:"0 0 8px 8px",p:1.5,display:"flex",flexDirection:"column",gap:1}},{children:[n(a,{variant:"rectangular",width:"100%",height:400,sx:{borderRadius:"8px"}}),n(a,{variant:"text",width:"100%",height:14}),n(a,{variant:"text",width:"80%",height:14})]}))}))]}))]}))})),G&&K&&n(d,e({onClick:function(){return Ee(function(e){return!e})},sx:e({width:20,flexShrink:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",cursor:"pointer",borderRight:"1px solid #e5e7eb",borderLeft:"1px solid #e5e7eb",bgcolor:"#f9fafb",position:"relative",py:2,"&:hover":{bgcolor:"#f0f0f0"}},null==te?void 0:te.collapseStrip)},{children:n(c,e({sx:{fontSize:10,fontWeight:600,color:"#6b7280",writingMode:"vertical-rl",textOrientation:"mixed",transform:"rotate(180deg)",letterSpacing:"0.05em",userSelect:"none"}},{children:"SPB Details"}))})),G&&K&&n(d,e({onClick:function(){return Ee(function(e){return!e})},onMouseDown:function(e){e.preventDefault(),Ce.current=!0;var i=function(e){if(Ce.current&&Re.current){var t=Re.current.getBoundingClientRect(),o=t.left,r=t.width,l=e.clientX-o;if(l<200)return Ee(!0),Ce.current=!1,document.removeEventListener("mousemove",i),void document.removeEventListener("mouseup",n);l>.7*r||(Ee(!1),Me(l))}},n=function(){Ce.current=!1,document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",n)};document.addEventListener("mousemove",i),document.addEventListener("mouseup",n)},sx:e({position:"absolute",left:ze?20:Be+20,top:"50%",transform:"translateY(-50%)",width:18,height:28,bgcolor:"#fff",border:"1px solid #e5e7eb",borderRadius:"0 6px 6px 0",display:"flex",alignItems:"center",justifyContent:"center",cursor:"col-resize",zIndex:5,boxShadow:"2px 0 4px rgba(0,0,0,0.06)","&:hover":{bgcolor:"#f9fafb"}},null==te?void 0:te.dragHandle)},{children:n(ze?D:w,{sx:{fontSize:12,color:"#6b7280"}})})),G&&i(d,e({sx:e({flex:1,minWidth:0,minHeight:0,display:"flex",flexDirection:"column",overflow:"hidden",p:2,gap:1.5,bgcolor:"#f8fafc"},null==te?void 0:te.codePanel)},{children:[i(d,e({sx:e({display:"flex",alignItems:"center",justifyContent:"space-between",flexShrink:0},null==te?void 0:te.codePanelHeader)},{children:[n(c,e({sx:e({fontSize:13,fontWeight:600,color:"#374151"},null==te?void 0:te.codePanelTitle)},{children:F||"SPB Analysis"})),i(d,e({sx:{display:"flex",alignItems:"center",gap:1.5}},{children:[ee&&n(x,{checked:ve,onChange:function(e){return be(e.target.checked)},size:"small",sx:{width:36,height:20,padding:0,"& .MuiSwitch-switchBase":{padding:0,margin:"2px","&.Mui-checked":{transform:"translateX(16px)",color:"#fff","& + .MuiSwitch-track":{bgcolor:"#5928ed",opacity:1}}},"& .MuiSwitch-thumb":{width:16,height:16,bgcolor:"#fff"},"& .MuiSwitch-track":{borderRadius:10,bgcolor:"#d1d5db",opacity:1}}}),U&&Z&&n(f,e({title:"Fullscreen",placement:"top"},{children:n(u,e({size:"small",onClick:function(){return we({ref:ue||"",description:""})},sx:{color:"#6b7280"}},{children:n(b,{sx:{fontSize:16}})}))}))]}))]})),n(d,e({sx:e({flex:1,minHeight:0,border:"1px solid #30363d",borderRadius:1,overflow:"hidden"},null==te?void 0:te.editorContainer)},{children:n(k,{content:A,selectedTag:ue,isDarkMode:ve,height:"100%",fontSize:13})}))]}))]})),Z&&i(m,e({open:!!Se,onClose:function(){return we(null)},maxWidth:!1,PaperProps:{sx:e({width:"82vw",height:"80vh",maxWidth:"none",borderRadius:"12px",overflow:"hidden",display:"flex",flexDirection:"column"},null==te?void 0:te.fullscreenModal)}},{children:[i(d,e({sx:{px:2.5,py:1.5,borderBottom:"1px solid #E5E7EB",display:"flex",alignItems:"center",justifyContent:"space-between",flexShrink:0}},{children:[n(c,e({sx:{fontWeight:700,fontSize:"1rem",color:"#111827"}},{children:"Promptemon"})),n(u,e({size:"small",onClick:function(){return we(null)}},{children:n(y,{sx:{fontSize:"1.1rem",color:"#6B7280"}})}))]})),i(d,e({sx:{flex:1,display:"flex",overflow:"hidden",minHeight:0}},{children:[i(d,e({sx:{width:"40%",flexShrink:0,borderRight:"1px solid #E5E7EB",display:"flex",flexDirection:"column",overflow:"hidden"}},{children:[i(d,e({sx:{px:2,py:1.25,borderBottom:"1px solid #E5E7EB",display:"flex",alignItems:"center",gap:1}},{children:[n(f,e({title:"Atomic Prompt Block",placement:"top"},{children:n(g,{label:"APB",size:"small",sx:{bgcolor:"#f1f5f9",color:"#475569",fontWeight:700,fontSize:10,height:20,borderRadius:1}})})),n(c,e({sx:{fontWeight:600,fontSize:"0.9rem",color:"#111827"}},{children:null==Se?void 0:Se.ref}))]})),i(d,e({sx:{flex:1,p:2,display:"flex",flexDirection:"column",gap:1.5,overflowY:"auto"}},{children:[i(d,e({sx:{border:"1px solid #E5E7EB",borderRadius:"8px",p:1.5}},{children:[n(c,e({sx:{fontWeight:600,fontSize:"0.8rem",color:"#111827",mb:.75}},{children:"Description"})),n(c,e({sx:{fontSize:"0.73rem",color:"#6B7280",lineHeight:1.6}},{children:null==Se?void 0:Se.description}))]})),i(d,e({sx:{border:"1px solid #E5E7EB",borderRadius:"8px",p:1.25,display:"flex",alignItems:"center",gap:.5}},{children:[n(c,e({sx:{fontSize:"0.73rem",color:"#6B7280"}},{children:"Total Lines"})),n(c,e({sx:{fontSize:"0.73rem",fontWeight:700,color:"#111827"}},{children:A.split("\n").length}))]}))]}))]})),i(d,e({sx:{flex:1,minWidth:0,display:"flex",flexDirection:"column",overflow:"hidden"}},{children:[i(d,e({sx:{px:2,py:1.25,borderBottom:"1px solid #E5E7EB",display:"flex",alignItems:"center",justifyContent:"space-between"}},{children:[n(c,e({sx:{fontWeight:600,fontSize:"0.85rem",color:"#111827"}},{children:"Prompt Preview"})),n(x,{checked:ve,onChange:function(e){return be(e.target.checked)},size:"small",sx:{width:36,height:20,padding:0,"& .MuiSwitch-switchBase":{padding:0,margin:"2px","&.Mui-checked":{transform:"translateX(16px)",color:"#fff","& + .MuiSwitch-track":{bgcolor:"#5928ed",opacity:1}}},"& .MuiSwitch-thumb":{width:16,height:16,bgcolor:"#fff"},"& .MuiSwitch-track":{borderRadius:10,bgcolor:"#d1d5db",opacity:1}}})]})),n(d,e({sx:{flex:1,minHeight:0,p:1.5}},{children:n(k,{content:A,selectedTag:ue,isDarkMode:ve,height:"100%",fontSize:13})}))]}))]}))]}))]}))};export{C as default};
|
|
2
2
|
//# sourceMappingURL=Spbanalysispanel.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as e,__spreadArray as i}from"tslib";import{jsx as t,jsxs as n,Fragment as o}from"react/jsx-runtime";import{useMemo as r,useState as l}from"react";import d from"@mui/icons-material/ChevronRight";import a from"@mui/icons-material/Close";import c from"@mui/icons-material/ExpandMore";import s from"@mui/material/Box";import u from"@mui/material/Button";import m from"@mui/material/ButtonBase";import p from"@mui/material/Divider";import h from"@mui/material/IconButton";import g from"@mui/material/Paper";import f from"@mui/material/Radio";import x from"@mui/material/Stack";import b from"@mui/material/TextField";import C from"@mui/material/Typography";import E from"./CognitiveIcon.js";import v from"./CognitiveScoreBadge.js";import F from"../../assests/icons/InfoAlert.js";var y,S=function(e,t){return i([e],Array.isArray(t)?t:null==t?[]:[t],!0)},w="MERGE_ADJACENT";!function(e){e.KEEP="KEEP",e.SPLIT_HERE="SPLIT_HERE",e.MERGE_NEXT="MERGE_NEXT",e.MERGE_PREV="MERGE_PREV",e.MERGE_PREVIOUS="MERGE_PREVIOUS",e.SET_RANGE="SET_RANGE"}(y||(y={}));var R=function(e){return Object.values(y).includes(e)},A=function(e,i,t){return e.user_actions.flatMap(function(n){var o=e.focus_page,r=e.user_actions.find(function(e){return e===y.MERGE_PREV||e===y.MERGE_PREVIOUS||e===y.MERGE_NEXT}),l=null!=o&&null!=i&&null!=t&&o===i&&o===t,d=null!=o&&null!=i&&o===i,a=null!=o&&null!=t&&(o===t||o===t+1),c=d||a;switch(n){case y.SET_RANGE:return[];case"KEEP":return[{id:n,title:"Keep as is",description:"Keep the current document boundary unchanged."}];case"SPLIT_HERE":return[{id:n,title:"Split to a separate document",description:c?"Already at a document boundary - can't split further":o?"Start a new document at page ".concat(o,"."):"Create a new document at this boundary.",disabled:c}];case"MERGE_PREV":case"MERGE_NEXT":case"MERGE_PREVIOUS":return n!==r?[]:l?[{id:w,title:"Merge with an adjacent document",description:"Choose to merge with the previous or next document."}]:d?[{id:y.MERGE_PREVIOUS,title:"Merge with previous document",description:"Combine this document with the previous document."}]:a?[{id:y.MERGE_NEXT,title:"Merge with next document",description:"Combine this document with the next document."}]:[{id:w,title:"Merge with an adjacent document",description:"Choose to merge with the previous or next document."}]}return[]})};function M(i){var M=i.headerName,I=void 0===M?"Boundary Check":M,k=i.title,z=i.pageNo,T=i.content,W=i.cognitiveScore,_=i.config,P=i.metadata,G=i.previousSegmentTitle,N=i.nextSegmentTitle,D=i.selectedIndex,B=i.defaultSelectedIndex,H=void 0===B?null:B,j=i.defaultStartPage,O=i.defaultEndPage,V=i.onSelectionChange,U=i.onConfirm,L=i.onActionConfirm,X=i.onCognitiveClick,K=i.onAdjustManually,J=i.onClose,Y=i.confirmLabel,q=void 0===Y?"Confirm":Y,Q=i.manualPrompt,Z=void 0===Q?"Didn't find the right option?":Q,$=i.manualActionLabel,ee=void 0===$?"Adjust Manually":$,ie=i.cognitiveLabel,te=void 0===ie?"Cognitive Integrity":ie,ne=i.showAdjustManually,oe=void 0===ne||ne,re=i.showCognitiveIntegrity,le=void 0===re||re,de=i.showCloseButton,ae=void 0===de||de,ce=i.confirmDisabled,se=void 0!==ce&&ce,ue=i.width,me=void 0===ue?260:ue,pe=i.maxWidth,he=void 0===pe?260:pe,ge=i.className,fe=i.styles,xe=r(function(){return(null!=_?_:P?A(P,j,O):[]).filter(function(e){return e.id!==y.SET_RANGE})},[_,O,j,P]),be=l(H),Ce=be[0],Ee=be[1],ve=l(null==j?"":String(j)),Fe=ve[0],ye=ve[1],Se=l(null==O?"":String(O)),we=Se[0],Re=Se[1],Ae=l(!1),Me=Ae[0],Ie=Ae[1],ke=l(!1),ze=ke[0],Te=ke[1],We=l(null),_e=We[0],Pe=We[1],Ge=void 0===D?Ce:D,Ne=null==Ge?void 0:xe[Ge],De=(null==Ne?void 0:Ne.id)===w,Be=null!=G,He=null!=N,je=Number(Fe),Oe=Number(we),Ve=Fe.trim().length>0&&we.trim().length>0&&Number.isInteger(je)&&Number.isInteger(Oe)&&je>0&&Oe>0&&je<=Oe,Ue=se||!Ne||!0===Ne.disabled||De&&null==_e||!U&&!L;return t(g,e({className:ge,elevation:4,sx:S({width:me,maxWidth:he,borderTop:"4px solid",borderColor:"error.main",borderRadius:2,bgcolor:"background.paper",overflow:"hidden",boxSizing:"border-box","@media (max-width: 372px)":{width:"calc(100vw - 32px)"}},null==fe?void 0:fe.root)},{children:n(x,e({spacing:.75,sx:{p:1}},{children:[n(x,e({direction:"row",alignItems:"center",spacing:.75,sx:null==fe?void 0:fe.header},{children:[t(F,{color:"error",height:16,width:16}),t(C,e({sx:{flex:1,color:"error.main",fontSize:12,fontWeight:500,lineHeight:1.25,textTransform:"uppercase"}},{children:I})),ae&&t(h,e({size:"small",onClick:J,disabled:!J,"aria-label":"Close boundary check",sx:{p:0,"&.Mui-disabled":{color:"text.secondary"}}},{children:t(a,{sx:{fontSize:17}})}))]})),n(s,{children:[t(C,e({sx:{color:"text.primary",fontSize:14,fontWeight:500}},{children:k})),null!=z&&t(C,e({sx:{mt:.125,color:"text.secondary",fontSize:12}},{children:z})),t(p,{sx:{my:.625}}),null!=T&&t(C,e({component:"div",sx:{color:"text.secondary",fontSize:11.5,lineHeight:1.3}},{children:T}))]}),n(x,e({spacing:.625,role:"radiogroup","aria-label":"Boundary options"},{children:[xe.map(function(i,o){var r=Ge===o,l=!0===i.disabled;return n(g,e({variant:"outlined",sx:S({borderColor:r?"#1976d2":"divider",borderRadius:2,bgcolor:l?"#F8FAFC":"background.paper",overflow:"hidden"},null==fe?void 0:fe.option)},{children:[n(m,e({role:"radio","aria-checked":r,disabled:se||i.disabled,onClick:function(){return function(e,i){se||i.disabled||(void 0===D&&Ee(e),i.id!==w&&Pe(null),Me&&(Ie(!1),Te(!1)),null==V||V(e,i))}(o,i)},sx:{width:"100%",justifyContent:"flex-start",px:.75,py:.5,textAlign:"left"}},{children:[t(f,{checked:r,disabled:se||i.disabled,tabIndex:-1,size:"small",sx:{p:.25,mr:.5,"&.Mui-disabled":{color:"#CBD5E1"}}}),n(s,e({sx:{minWidth:0}},{children:[t(C,e({sx:{color:l?"#94A3B8":"text.primary",fontSize:12.5,fontWeight:500}},{children:i.title})),null!=i.description&&t(C,e({sx:{mt:.125,color:l?"#94A3B8":"text.secondary",fontSize:11}},{children:i.description}))]}))]})),r&&i.id===w&&t(x,e({direction:"row",spacing:.75,sx:S({px:.75,pb:.75},null==fe?void 0:fe.adjacentSelector)},{children:[{direction:"previous",title:null!=G?G:"No Previous document",caption:"← Merge into Previous",available:Be},{direction:"next",title:null!=N?N:"No Next document",caption:"Merge into Next →",available:He}].map(function(i){var o=_e===i.direction;return n(x,e({sx:{flex:1,minWidth:0}},{children:[t(m,e({disabled:se||!i.available,onClick:function(){return Pe(i.direction)},"aria-pressed":o,sx:{width:"100%",minWidth:0,minHeight:46,alignItems:"flex-start",justifyContent:"flex-start",p:.625,border:"1px solid",borderColor:o?"#7F56D9":"#D0D5DD",borderRadius:1.5,bgcolor:o?"#E0E7FF":"background.paper",color:o?"#7F56D9":i.available?"text.primary":"#98A2B3",textAlign:"left","&.Mui-disabled":{color:"#98A2B3",bgcolor:"#F8FAFC"}}},{children:t(C,e({sx:{color:"inherit",fontSize:11,fontWeight:500,lineHeight:1.25,overflowWrap:"anywhere"}},{children:i.title}))})),t(C,e({sx:{mt:.5,color:o?"#5925DC":"text.secondary",fontSize:9.5,lineHeight:1.2,whiteSpace:"nowrap",textAlign:"next"===i.direction?"right":"left"}},{children:i.caption}))]}),i.direction)})}))]}),i.id)}),De&&null!=_e&&n(x,e({direction:"row",alignItems:"flex-start",spacing:.625,sx:S({p:.75,border:"1px solid #FCA5A5",borderRadius:1.5,bgcolor:"#FEF2F2"},null==fe?void 0:fe.impactWarning)},{children:[t(F,{color:"error",height:14,width:14,sx:{mt:.125}}),n(C,e({sx:{color:"#DC2626",fontSize:10.5,lineHeight:1.4}},{children:["This will impact the ",_e," document. Its content and page range will change."]}))]})),t(u,e({variant:"contained",fullWidth:!0,disabled:Ue,onClick:function(){if(!Ue&&null!=Ge&&Ne){var i=De?"previous"===_e?y.MERGE_PREVIOUS:y.MERGE_NEXT:Ne.id,t=De?e(e({},Ne),{id:i}):Ne,n={selectedIndex:Ge,option:t,metadata:P};null==U||U(Ge,t,n),L&&R(i)&&L(i,n)}},sx:S({minHeight:32,mt:.25,borderRadius:2,fontSize:13,fontWeight:600,textTransform:"none",backgroundColor:"#5925DC","&:hover":{backgroundColor:"#4A1FB8"},"&.Mui-disabled":{backgroundColor:"#D9D6FE",color:"#FFFFFF"}},null==fe?void 0:fe.confirmButton)},{children:q}))]})),oe&&n(x,e({spacing:.625,sx:null==fe?void 0:fe.manualSection},{children:[n(m,e({disabled:se,onClick:function(){var e=!Me;Ie(e),Te(!1),e&&(void 0===D&&Ee(null),null==K||K())},"aria-expanded":Me,sx:{width:"100%",justifyContent:"space-between",borderRadius:1,textAlign:"left"}},{children:[n(s,{children:[t(C,e({sx:{color:"text.primary",fontSize:11}},{children:Z})),t(C,e({sx:{mt:.125,color:"text.primary",fontSize:11}},{children:ee}))]}),t(c,{sx:{color:"text.secondary",fontSize:16,transform:Me?"rotate(180deg)":"none",transition:"transform 150ms ease"}})]})),Me&&!ze&&n(s,e({sx:{pt:.5,fontFamily:'Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif'}},{children:[n(s,e({sx:{display:"grid",gridTemplateColumns:"1fr 1fr",columnGap:"8px",mb:"4px"}},{children:[t(C,e({sx:{fontSize:"10.5px",fontWeight:400,lineHeight:"14px",color:"#57697E",margin:0}},{children:"Starts"})),t(C,e({sx:{fontSize:"10.5px",fontWeight:400,lineHeight:"14px",color:"#57697E",margin:0}},{children:"Ends"}))]})),n(s,e({sx:{display:"grid",gridTemplateColumns:"1fr 1fr",columnGap:"8px",mb:"4px"}},{children:[t(b,{size:"small",type:"number",value:Fe,disabled:se,onChange:function(e){return ye(e.target.value)},inputProps:{min:1,step:1,inputMode:"numeric"},sx:{"& .MuiOutlinedInput-root":{height:"30px",backgroundColor:"#FFFFFF","& fieldset":{borderColor:"#C3CFDC",borderWidth:"1px",borderRadius:"6px"},"&:hover fieldset":{borderColor:"#C3CFDC"},"&.Mui-focused fieldset":{borderColor:"#9488F6",borderWidth:"1px"}},"& .MuiOutlinedInput-input":{fontSize:"12px",fontWeight:400,lineHeight:"1",color:"#34445A",padding:"0 10px",height:"30px"},"& input[type=number]":{MozAppearance:"textfield"},"& input[type=number]::-webkit-outer-spin-button, & input[type=number]::-webkit-inner-spin-button":{WebkitAppearance:"none",margin:0}},onWheel:function(e){return e.currentTarget.blur()}}),t(b,{size:"small",type:"number",value:we,disabled:se,error:Fe.trim().length>0&&we.trim().length>0&&je>Oe,onChange:function(e){return Re(e.target.value)},inputProps:{min:1,step:1,inputMode:"numeric"},sx:{"& .MuiOutlinedInput-root":{height:"30px",backgroundColor:"#FFFFFF","& fieldset":{borderColor:"#C3CFDC",borderWidth:"1px",borderRadius:"6px"},"&:hover fieldset":{borderColor:"#C3CFDC"},"&.Mui-focused fieldset":{borderColor:"#9488F6",borderWidth:"1px"}},"& .MuiOutlinedInput-input":{fontSize:"12px",fontWeight:400,lineHeight:"1",color:"#34445A",padding:"0 10px",height:"30px"},"& input[type=number]":{MozAppearance:"textfield"},"& input[type=number]::-webkit-outer-spin-button, & input[type=number]::-webkit-inner-spin-button":{WebkitAppearance:"none",margin:0}},onWheel:function(e){return e.currentTarget.blur()}})]})),t(s,{children:t(u,e({onClick:function(){Ve&&Te(!0)},disabled:se||!Ve,sx:{height:"30px",padding:"0 12px",display:"inline-flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box",backgroundColor:"#FFFFFF",border:"1px solid #8E80F3",borderRadius:"6px",fontFamily:'Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif',fontSize:"12px",fontWeight:600,lineHeight:"1",color:"#4A24CF",outline:"none",cursor:"pointer",textTransform:"none",transition:"all 150ms ease-in-out","&:hover":Ve?{backgroundColor:"#FAF9FF",borderColor:"#7F6FF0"}:{},"&:active":Ve?{transform:"translateY(1px)"}:{},"&.Mui-disabled":{backgroundColor:"#FFFFFF",borderColor:"#C3CFDC",color:"#A0ABBE",cursor:"not-allowed"}}},{children:"Apply"}))}),t(s,{sx:{width:"100%",height:"1px",marginTop:"8px",backgroundColor:"#EEF0F2",border:"0"}})]})),Me&&ze&&n(x,e({spacing:.75,sx:S({p:.75,borderRadius:1.5,bgcolor:"#FFF7ED"},null==fe?void 0:fe.manualConfirmation)},{children:[n(x,e({direction:"row",alignItems:"center",spacing:.5},{children:[t(F,{color:"warning",height:14,width:14}),t(C,e({sx:{color:"#EA580C",fontSize:11,fontWeight:600}},{children:"Confirm this change?"}))]})),n(C,e({sx:{color:"text.secondary",fontSize:10.5,lineHeight:1.4}},{children:["Pages ",je,"-",Oe," will become part of ",k,", including pages from other documents in this range."]})),n(x,e({direction:"row",spacing:.75},{children:[t(u,e({variant:"outlined",fullWidth:!0,onClick:function(){return Te(!1)},sx:{minHeight:28,borderRadius:1.5,fontSize:11,textTransform:"none"}},{children:"Cancel"})),t(u,e({variant:"contained",fullWidth:!0,disabled:se||!U,onClick:function(){if(Ve&&U){var e={id:y.SET_RANGE,title:ee};U(-1,e,{selectedIndex:-1,option:e,startPage:je,endPage:Oe,metadata:P})}},sx:{minHeight:28,borderRadius:1.5,bgcolor:"#EA580C",fontSize:11,textTransform:"none","&:hover":{bgcolor:"#C2410C"}}},{children:"Confirm"}))]}))]}))]})),t(x,e({spacing:.625,sx:null==fe?void 0:fe.footer},{children:le&&n(o,{children:[t(p,{}),n(m,e({onClick:X,disabled:!X,sx:{justifyContent:"space-between",borderRadius:1,textAlign:"left",cursor:X?"pointer":"not-allowed"}},{children:[n(x,e({direction:"row",alignItems:"center",spacing:1},{children:[t(E,{sx:{color:"text.secondary"}}),t(C,e({sx:{color:"text.primary",fontSize:12}},{children:te}))]})),n(x,e({direction:"row",alignItems:"center",spacing:.5},{children:[t(v,{score:W}),t(d,{sx:{color:"text.secondary"}})]}))]}))]})}))]}))}))}export{y as BoundaryReviewActionEnum,A as createBoundaryCardOptions,M as default,R as isBoundaryReviewAction};
|
|
1
|
+
import{__assign as e,__spreadArray as i}from"tslib";import{jsx as t,jsxs as n,Fragment as r}from"react/jsx-runtime";import{useMemo as o,useState as l}from"react";import d from"@mui/icons-material/ChevronRight";import a from"@mui/icons-material/Close";import c from"@mui/icons-material/ExpandMore";import s from"@mui/material/Box";import u from"@mui/material/Button";import m from"@mui/material/ButtonBase";import p from"@mui/material/Divider";import h from"@mui/material/IconButton";import g from"@mui/material/Paper";import f from"@mui/material/Radio";import x from"@mui/material/Stack";import b from"@mui/material/TextField";import C from"@mui/material/Typography";import E from"./CognitiveIcon.js";import v from"./CognitiveScoreBadge.js";import F from"../../assests/icons/InfoAlert.js";var y,S=function(e,t){return i([e],Array.isArray(t)?t:null==t?[]:[t],!0)},w="MERGE_ADJACENT";!function(e){e.KEEP="KEEP",e.SPLIT_HERE="SPLIT_HERE",e.MERGE_NEXT="MERGE_NEXT",e.MERGE_PREV="MERGE_PREV",e.MERGE_PREVIOUS="MERGE_PREVIOUS",e.SET_RANGE="SET_RANGE"}(y||(y={}));var R=function(e){return Object.values(y).includes(e)},A=function(e,t,n,r){if(!t||!e)return[];var o=t.additional_decisions,l=Array.isArray(o)?o:o?Object.values(o).flat():[],d=Array.from(new Set(i(i([],t.allowed_decisions,!0),l,!0)));return d.flatMap(function(i){var t=e.focus_page,o=d.find(function(e){return e.toLowerCase().includes("merge")}),l=null!=t&&null!=n&&null!=r&&t===n&&t===r,a=null!=t&&null!=n&&t===n,c=null!=t&&null!=r&&(t===r||t===r+1),s=a||c||!(null!=t&&(!(null!=n&&null!=r)||t>n&&t<r));switch(i){case y.SET_RANGE:return[];case"KEEP":return[{id:i,title:"Keep as is",description:"Keep the current document boundary unchanged."}];case"SPLIT_HERE":return[{id:i,title:"Split to a separate document",description:s?"A valid page inside the document is required to split it.":t?"Start a new document at page ".concat(t,"."):"Create a new document at this boundary.",disabled:s}];case"MERGE_PREV":case"MERGE_NEXT":case"MERGE_PREVIOUS":return i!==o?[]:l?[{id:w,title:"Merge with an adjacent document",description:"Choose to merge with the previous or next document."}]:a?[{id:y.MERGE_PREVIOUS,title:"Merge with previous document",description:"Combine this document with the previous document."}]:c?[{id:y.MERGE_NEXT,title:"Merge with next document",description:"Combine this document with the next document."}]:[{id:w,title:"Merge with an adjacent document",description:"Choose to merge with the previous or next document."}]}return[]})};function M(i){var M=i.headerName,I=void 0===M?"Boundary Check":M,k=i.title,z=i.pageNo,T=i.content,W=i.cognitiveScore,_=i.config,P=i.metadata,G=i.previousSegmentTitle,N=i.nextSegmentTitle,D=i.selectedIndex,B=i.defaultSelectedIndex,H=void 0===B?null:B,j=i.defaultStartPage,O=i.defaultEndPage,V=i.onSelectionChange,U=i.onConfirm,L=i.onActionConfirm,X=i.onCognitiveClick,K=i.onAdjustManually,q=i.onClose,J=i.confirmLabel,Y=void 0===J?"Confirm":J,Q=i.manualPrompt,Z=void 0===Q?"Didn't find the right option?":Q,$=i.manualActionLabel,ee=void 0===$?"Adjust Manually":$,ie=i.cognitiveLabel,te=void 0===ie?"Cognitive Integrity":ie,ne=i.showAdjustManually,re=void 0===ne||ne,oe=i.showCognitiveIntegrity,le=void 0===oe||oe,de=i.showCloseButton,ae=void 0===de||de,ce=i.confirmDisabled,se=void 0!==ce&&ce,ue=i.width,me=void 0===ue?260:ue,pe=i.maxWidth,he=void 0===pe?260:pe,ge=i.className,fe=i.styles,xe=i.reviewAction,be=o(function(){return(null!=_?_:P?A(P,xe,j,O):[]).filter(function(e){return e.id!==y.SET_RANGE})},[_,O,j,P,xe]),Ce=l(H),Ee=Ce[0],ve=Ce[1],Fe=l(null==j?"":String(j)),ye=Fe[0],Se=Fe[1],we=l(null==O?"":String(O)),Re=we[0],Ae=we[1],Me=l(!1),Ie=Me[0],ke=Me[1],ze=l(!1),Te=ze[0],We=ze[1],_e=l(null),Pe=_e[0],Ge=_e[1],Ne=void 0===D?Ee:D,De=null==Ne?void 0:be[Ne],Be=(null==De?void 0:De.id)===w,He=null!=G,je=null!=N,Oe=function(e){return!0===e.disabled||e.id===y.MERGE_PREV&&!He||e.id===y.MERGE_PREVIOUS&&!He||e.id===y.MERGE_NEXT&&!je||e.id===w&&!He&&!je},Ve=Number(ye),Ue=Number(Re),Le=ye.trim().length>0&&Re.trim().length>0&&Number.isInteger(Ve)&&Number.isInteger(Ue)&&Ve>0&&Ue>0&&Ve<=Ue,Xe=se||!De||Oe(De)||Be&&null==Pe||!U&&!L;return t(g,e({className:ge,elevation:4,sx:S({width:me,maxWidth:he,borderTop:"4px solid",borderColor:"error.main",borderRadius:2,bgcolor:"background.paper",overflow:"hidden",boxSizing:"border-box","@media (max-width: 372px)":{width:"calc(100vw - 32px)"}},null==fe?void 0:fe.root)},{children:n(x,e({spacing:.75,sx:{p:1}},{children:[n(x,e({direction:"row",alignItems:"center",spacing:.75,sx:null==fe?void 0:fe.header},{children:[t(F,{color:"error",height:16,width:16}),t(C,e({sx:{flex:1,color:"error.main",fontSize:12,fontWeight:500,lineHeight:1.25,textTransform:"uppercase"}},{children:I})),ae&&t(h,e({size:"small",onClick:q,disabled:!q,"aria-label":"Close boundary check",sx:{p:0,"&.Mui-disabled":{color:"text.secondary"}}},{children:t(a,{sx:{fontSize:17}})}))]})),n(s,{children:[t(C,e({sx:{color:"text.primary",fontSize:14,fontWeight:500}},{children:k})),null!=z&&t(C,e({sx:{mt:.125,color:"text.secondary",fontSize:12}},{children:z})),t(p,{sx:{my:.625}}),null!=T&&t(C,e({component:"div",sx:{color:"text.secondary",fontSize:11.5,lineHeight:1.3}},{children:T}))]}),n(x,e({spacing:.625,role:"radiogroup","aria-label":"Boundary options"},{children:[be.map(function(i,r){var o=Ne===r,l=Oe(i);return n(g,e({variant:"outlined",sx:S({borderColor:o?"#1976d2":"divider",borderRadius:2,bgcolor:l?"#F8FAFC":"background.paper",overflow:"hidden"},null==fe?void 0:fe.option)},{children:[n(m,e({role:"radio","aria-checked":o,disabled:se||l,onClick:function(){return function(e,i){se||Oe(i)||(void 0===D&&ve(e),i.id!==w&&Ge(null),Ie&&(ke(!1),We(!1)),null==V||V(e,i))}(r,i)},sx:{width:"100%",justifyContent:"flex-start",px:.75,py:.5,textAlign:"left"}},{children:[t(f,{checked:o,disabled:se||l,tabIndex:-1,size:"small",sx:{p:.25,mr:.5,"&.Mui-disabled":{color:"#CBD5E1"}}}),n(s,e({sx:{minWidth:0}},{children:[t(C,e({sx:{color:l?"#94A3B8":"text.primary",fontSize:12.5,fontWeight:500}},{children:i.title})),null!=i.description&&t(C,e({sx:{mt:.125,color:l?"#94A3B8":"text.secondary",fontSize:11}},{children:i.description}))]}))]})),o&&i.id===w&&t(x,e({direction:"row",spacing:.75,sx:S({px:.75,pb:.75},null==fe?void 0:fe.adjacentSelector)},{children:[{direction:"previous",title:null!=G?G:"No Previous document",caption:"← Merge into Previous",available:He},{direction:"next",title:null!=N?N:"No Next document",caption:"Merge into Next →",available:je}].map(function(i){var r=Pe===i.direction;return n(x,e({sx:{flex:1,minWidth:0}},{children:[t(m,e({disabled:se||!i.available,onClick:function(){return Ge(i.direction)},"aria-pressed":r,sx:{width:"100%",minWidth:0,minHeight:46,alignItems:"flex-start",justifyContent:"flex-start",p:.625,border:"1px solid",borderColor:r?"#7F56D9":"#D0D5DD",borderRadius:1.5,bgcolor:r?"#E0E7FF":"background.paper",color:r?"#7F56D9":i.available?"text.primary":"#98A2B3",textAlign:"left","&.Mui-disabled":{color:"#98A2B3",bgcolor:"#F8FAFC"}}},{children:t(C,e({sx:{color:"inherit",fontSize:11,fontWeight:500,lineHeight:1.25,overflowWrap:"anywhere"}},{children:i.title}))})),t(C,e({sx:{mt:.5,color:r?"#5925DC":"text.secondary",fontSize:9.5,lineHeight:1.2,whiteSpace:"nowrap",textAlign:"next"===i.direction?"right":"left"}},{children:i.caption}))]}),i.direction)})}))]}),i.id)}),Be&&null!=Pe&&n(x,e({direction:"row",alignItems:"flex-start",spacing:.625,sx:S({p:.75,border:"1px solid #FCA5A5",borderRadius:1.5,bgcolor:"#FEF2F2"},null==fe?void 0:fe.impactWarning)},{children:[t(F,{color:"error",height:14,width:14,sx:{mt:.125}}),n(C,e({sx:{color:"#DC2626",fontSize:10.5,lineHeight:1.4}},{children:["This will impact the ",Pe," document. Its content and page range will change."]}))]})),t(u,e({variant:"contained",fullWidth:!0,disabled:Xe,onClick:function(){if(!Xe&&null!=Ne&&De){var i=Be?"previous"===Pe?y.MERGE_PREVIOUS:y.MERGE_NEXT:De.id,t=Be?e(e({},De),{id:i}):De,n={selectedIndex:Ne,option:t,metadata:P};null==U||U(Ne,t,n),L&&R(i)&&L(i,n)}},sx:S({minHeight:32,mt:.25,borderRadius:2,fontSize:13,fontWeight:600,textTransform:"none",backgroundColor:"#5925DC","&:hover":{backgroundColor:"#4A1FB8"},"&.Mui-disabled":{backgroundColor:"#D9D6FE",color:"#FFFFFF"}},null==fe?void 0:fe.confirmButton)},{children:Y}))]})),re&&n(x,e({spacing:.625,sx:null==fe?void 0:fe.manualSection},{children:[n(m,e({disabled:se,onClick:function(){var e=!Ie;ke(e),We(!1),e&&(void 0===D&&ve(null),null==K||K())},"aria-expanded":Ie,sx:{width:"100%",justifyContent:"space-between",borderRadius:1,textAlign:"left"}},{children:[n(s,{children:[t(C,e({sx:{color:"text.primary",fontSize:11}},{children:Z})),t(C,e({sx:{mt:.125,color:"text.primary",fontSize:11}},{children:ee}))]}),t(c,{sx:{color:"text.secondary",fontSize:16,transform:Ie?"rotate(180deg)":"none",transition:"transform 150ms ease"}})]})),Ie&&!Te&&n(s,e({sx:{pt:.5,fontFamily:'Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif'}},{children:[n(s,e({sx:{display:"grid",gridTemplateColumns:"1fr 1fr",columnGap:"8px",mb:"4px"}},{children:[t(C,e({sx:{fontSize:"10.5px",fontWeight:400,lineHeight:"14px",color:"#57697E",margin:0}},{children:"Starts"})),t(C,e({sx:{fontSize:"10.5px",fontWeight:400,lineHeight:"14px",color:"#57697E",margin:0}},{children:"Ends"}))]})),n(s,e({sx:{display:"grid",gridTemplateColumns:"1fr 1fr",columnGap:"8px",mb:"4px"}},{children:[t(b,{size:"small",type:"number",value:ye,disabled:se,onChange:function(e){return Se(e.target.value)},inputProps:{min:1,step:1,inputMode:"numeric"},sx:{"& .MuiOutlinedInput-root":{height:"30px",backgroundColor:"#FFFFFF","& fieldset":{borderColor:"#C3CFDC",borderWidth:"1px",borderRadius:"6px"},"&:hover fieldset":{borderColor:"#C3CFDC"},"&.Mui-focused fieldset":{borderColor:"#9488F6",borderWidth:"1px"}},"& .MuiOutlinedInput-input":{fontSize:"12px",fontWeight:400,lineHeight:"1",color:"#34445A",padding:"0 10px",height:"30px"},"& input[type=number]":{MozAppearance:"textfield"},"& input[type=number]::-webkit-outer-spin-button, & input[type=number]::-webkit-inner-spin-button":{WebkitAppearance:"none",margin:0}},onWheel:function(e){return e.currentTarget.blur()}}),t(b,{size:"small",type:"number",value:Re,disabled:se,error:ye.trim().length>0&&Re.trim().length>0&&Ve>Ue,onChange:function(e){return Ae(e.target.value)},inputProps:{min:1,step:1,inputMode:"numeric"},sx:{"& .MuiOutlinedInput-root":{height:"30px",backgroundColor:"#FFFFFF","& fieldset":{borderColor:"#C3CFDC",borderWidth:"1px",borderRadius:"6px"},"&:hover fieldset":{borderColor:"#C3CFDC"},"&.Mui-focused fieldset":{borderColor:"#9488F6",borderWidth:"1px"}},"& .MuiOutlinedInput-input":{fontSize:"12px",fontWeight:400,lineHeight:"1",color:"#34445A",padding:"0 10px",height:"30px"},"& input[type=number]":{MozAppearance:"textfield"},"& input[type=number]::-webkit-outer-spin-button, & input[type=number]::-webkit-inner-spin-button":{WebkitAppearance:"none",margin:0}},onWheel:function(e){return e.currentTarget.blur()}})]})),t(s,{children:t(u,e({onClick:function(){Le&&We(!0)},disabled:se||!Le,sx:{height:"30px",padding:"0 12px",display:"inline-flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box",backgroundColor:"#FFFFFF",border:"1px solid #8E80F3",borderRadius:"6px",fontFamily:'Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif',fontSize:"12px",fontWeight:600,lineHeight:"1",color:"#4A24CF",outline:"none",cursor:"pointer",textTransform:"none",transition:"all 150ms ease-in-out","&:hover":Le?{backgroundColor:"#FAF9FF",borderColor:"#7F6FF0"}:{},"&:active":Le?{transform:"translateY(1px)"}:{},"&.Mui-disabled":{backgroundColor:"#FFFFFF",borderColor:"#C3CFDC",color:"#A0ABBE",cursor:"not-allowed"}}},{children:"Apply"}))}),t(s,{sx:{width:"100%",height:"1px",marginTop:"8px",backgroundColor:"#EEF0F2",border:"0"}})]})),Ie&&Te&&n(x,e({spacing:.75,sx:S({p:.75,borderRadius:1.5,bgcolor:"#FFF7ED"},null==fe?void 0:fe.manualConfirmation)},{children:[n(x,e({direction:"row",alignItems:"center",spacing:.5},{children:[t(F,{color:"warning",height:14,width:14}),t(C,e({sx:{color:"#EA580C",fontSize:11,fontWeight:600}},{children:"Confirm this change?"}))]})),n(C,e({sx:{color:"text.secondary",fontSize:10.5,lineHeight:1.4}},{children:["Pages ",Ve,"-",Ue," will become part of ",k,", including pages from other documents in this range."]})),n(x,e({direction:"row",spacing:.75},{children:[t(u,e({variant:"outlined",fullWidth:!0,onClick:function(){return We(!1)},sx:{minHeight:28,borderRadius:1.5,fontSize:11,textTransform:"none"}},{children:"Cancel"})),t(u,e({variant:"contained",fullWidth:!0,disabled:se||!U,onClick:function(){if(Le&&U){var e={id:y.SET_RANGE,title:ee};U(-1,e,{selectedIndex:-1,option:e,startPage:Ve,endPage:Ue,metadata:P})}},sx:{minHeight:28,borderRadius:1.5,bgcolor:"#EA580C",fontSize:11,textTransform:"none","&:hover":{bgcolor:"#C2410C"}}},{children:"Confirm"}))]}))]}))]})),t(x,e({spacing:.625,sx:null==fe?void 0:fe.footer},{children:le&&n(r,{children:[t(p,{}),n(m,e({onClick:X,disabled:!X,sx:{justifyContent:"space-between",borderRadius:1,textAlign:"left",cursor:X?"pointer":"not-allowed"}},{children:[n(x,e({direction:"row",alignItems:"center",spacing:1},{children:[t(E,{sx:{color:"text.secondary"}}),t(C,e({sx:{color:"text.primary",fontSize:12}},{children:te}))]})),n(x,e({direction:"row",alignItems:"center",spacing:.5},{children:[t(v,{score:W}),t(d,{sx:{color:"text.secondary"}})]}))]}))]})}))]}))}))}export{y as BoundaryReviewActionEnum,A as createBoundaryCardOptions,M as default,R as isBoundaryReviewAction};
|
|
2
2
|
//# sourceMappingURL=BoundaryCard.js.map
|