@e-llm-studio/citation 0.0.244 → 0.0.246

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/README.md +151 -0
  2. package/dist/cjs/features/PdfViewer/PdfToolbar.js +1 -1
  3. package/dist/cjs/features/PdfViewer/PdfViewer.js +1 -1
  4. package/dist/cjs/features/PdfViewer/rotationManager.js +2 -0
  5. package/dist/cjs/features/PdfViewer/rotationManager.js.map +1 -0
  6. package/dist/cjs/features/PromptCitation/CitationDependencyGraph.js +2 -0
  7. package/dist/cjs/features/PromptCitation/CitationDependencyGraph.js.map +1 -0
  8. package/dist/cjs/features/PromptCitation/PromptCitation.js +2 -0
  9. package/dist/cjs/features/PromptCitation/PromptCitation.js.map +1 -0
  10. package/dist/cjs/features/PromptCitation/_components/CodeEditor.js +2 -0
  11. package/dist/cjs/features/PromptCitation/_components/CodeEditor.js.map +1 -0
  12. package/dist/cjs/features/PromptCitation/_components/Markdownrenderer.js +2 -0
  13. package/dist/cjs/features/PromptCitation/_components/Markdownrenderer.js.map +1 -0
  14. package/dist/cjs/features/SegmentReviewComponents/BoundaryCard.js +1 -1
  15. package/dist/cjs/features/SegmentReviewComponents/CognitiveIntegrity.js +1 -1
  16. package/dist/cjs/features/SegmentReviewComponents/PageCheck.js +1 -1
  17. package/dist/cjs/features/SegmentReviewComponents/SegmentReviewPdfWrapper.js +1 -1
  18. package/dist/cjs/features/SegmentReviewComponents/helper.js +1 -1
  19. package/dist/cjs/index.js +1 -1
  20. package/dist/features/PdfViewer/PdfToolbar.js +1 -1
  21. package/dist/features/PdfViewer/PdfViewer.js +1 -1
  22. package/dist/features/PdfViewer/rotationManager.js +2 -0
  23. package/dist/features/PdfViewer/rotationManager.js.map +1 -0
  24. package/dist/features/PromptCitation/CitationDependencyGraph.js +2 -0
  25. package/dist/features/PromptCitation/CitationDependencyGraph.js.map +1 -0
  26. package/dist/features/PromptCitation/PromptCitation.js +2 -0
  27. package/dist/features/PromptCitation/PromptCitation.js.map +1 -0
  28. package/dist/features/PromptCitation/_components/CodeEditor.js +2 -0
  29. package/dist/features/PromptCitation/_components/CodeEditor.js.map +1 -0
  30. package/dist/features/PromptCitation/_components/Markdownrenderer.js +2 -0
  31. package/dist/features/PromptCitation/_components/Markdownrenderer.js.map +1 -0
  32. package/dist/features/SegmentReviewComponents/BoundaryCard.js +1 -1
  33. package/dist/features/SegmentReviewComponents/CognitiveIntegrity.js +1 -1
  34. package/dist/features/SegmentReviewComponents/PageCheck.js +1 -1
  35. package/dist/features/SegmentReviewComponents/SegmentReviewPdfWrapper.js +1 -1
  36. package/dist/features/SegmentReviewComponents/helper.js +1 -1
  37. package/dist/index.js +1 -1
  38. package/dist/types/src/CitationDependencyGraphTest.d.ts +4 -0
  39. package/dist/types/src/CitationDependencyGraphTest.d.ts.map +1 -0
  40. package/dist/types/src/features/CognitiveCompare/hooks/useCompareLayout.d.ts +0 -1
  41. package/dist/types/src/features/CognitiveCompare/hooks/useCompareLayout.d.ts.map +1 -1
  42. package/dist/types/src/features/PdfViewer/PdfToolbar.d.ts +4 -1
  43. package/dist/types/src/features/PdfViewer/PdfToolbar.d.ts.map +1 -1
  44. package/dist/types/src/features/PdfViewer/PdfViewer.d.ts +2 -1
  45. package/dist/types/src/features/PdfViewer/PdfViewer.d.ts.map +1 -1
  46. package/dist/types/src/features/PdfViewer/coordinateTransformer.d.ts +41 -0
  47. package/dist/types/src/features/PdfViewer/coordinateTransformer.d.ts.map +1 -0
  48. package/dist/types/src/features/PdfViewer/rotationManager.d.ts +23 -0
  49. package/dist/types/src/features/PdfViewer/rotationManager.d.ts.map +1 -0
  50. package/dist/types/src/features/PromptCitation/CitationDependencyGraph.d.ts +56 -0
  51. package/dist/types/src/features/PromptCitation/CitationDependencyGraph.d.ts.map +1 -0
  52. package/dist/types/src/features/PromptCitation/PromptCitation.d.ts +326 -0
  53. package/dist/types/src/features/PromptCitation/PromptCitation.d.ts.map +1 -0
  54. package/dist/types/src/features/PromptCitation/PromptCitationTest.d.ts +4 -0
  55. package/dist/types/src/features/PromptCitation/PromptCitationTest.d.ts.map +1 -0
  56. package/dist/types/src/features/PromptCitation/_components/CodeEditor.d.ts +30 -0
  57. package/dist/types/src/features/PromptCitation/_components/CodeEditor.d.ts.map +1 -0
  58. package/dist/types/src/features/PromptCitation/_components/HighlightedCodeDetails.d.ts +16 -0
  59. package/dist/types/src/features/PromptCitation/_components/HighlightedCodeDetails.d.ts.map +1 -0
  60. package/dist/types/src/features/PromptCitation/_components/Markdownrenderer.d.ts +23 -0
  61. package/dist/types/src/features/PromptCitation/_components/Markdownrenderer.d.ts.map +1 -0
  62. package/dist/types/src/features/PromptCitation/_components/ThemeToggle.d.ts +12 -0
  63. package/dist/types/src/features/PromptCitation/_components/ThemeToggle.d.ts.map +1 -0
  64. package/dist/types/src/features/PromptCitation/_components/TooltipComponent.d.ts +8 -0
  65. package/dist/types/src/features/PromptCitation/_components/TooltipComponent.d.ts.map +1 -0
  66. package/dist/types/src/features/SegmentReviewComponents/BoundaryCard.d.ts +3 -1
  67. package/dist/types/src/features/SegmentReviewComponents/BoundaryCard.d.ts.map +1 -1
  68. package/dist/types/src/features/SegmentReviewComponents/CognitiveIntegrity.d.ts.map +1 -1
  69. package/dist/types/src/features/SegmentReviewComponents/SegmentReviewPdfWrapper.d.ts +13 -1
  70. package/dist/types/src/features/SegmentReviewComponents/SegmentReviewPdfWrapper.d.ts.map +1 -1
  71. package/dist/types/src/features/SegmentReviewComponents/helper.d.ts +5 -2
  72. package/dist/types/src/features/SegmentReviewComponents/helper.d.ts.map +1 -1
  73. package/dist/types/src/index.d.ts +4 -0
  74. package/dist/types/src/index.d.ts.map +1 -1
  75. package/package.json +11 -1
@@ -1,2 +1,2 @@
1
- import{__assign as e,__awaiter as t,__generator as n}from"tslib";import{jsx as i,jsxs as r,Fragment as o}from"react/jsx-runtime";import{SpecialZoomLevel as a}from"@react-pdf-viewer/core";import l from"./PdfContainer.js";import u from"./PdfToolbar.js";import{pdfStyles as c}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(p){var y,x=p.pdfUrl,P=p.highlightText,T=p.highlightPages,w=p.highlightCordinatePages,C=p.highlightColor,b=void 0===C?"yellow":C,S=p.activeHighlightColor,A=void 0===S?"#f7dc51":S,I=p.jumpToPageValue,_=void 0===I?0:I,q=p.pdfName,R=p.onClose,H=p.customStyles,L=p.customClasses,N=p.customIcons,j=p.useCoordinates,F=p.fallbackPages,B=p.activeCitationIndex,D=p.onActiveCitationChange,M=p.headerAction,V=p.isZoomEnabled,W=void 0===V||V,z=p.showHighlightsAction,E=void 0===z||z,k=p.defaultScale,O=void 0===k?a.ActualSize:k,U=p.useRange,Z=void 0!==U&&U,J=p.rangeOfPages,K=void 0===J?null:J,G=p.showFullScreenAction,Q=void 0===G||G,X=p.segments,Y=void 0===X?[{title:"Document 2",start_page:52,end_page:52,page_count:1}]:X,$=p.segmentTooltipText,ee=p.onCurrentPageChange,te=p.navigationRequest,ne=p.onNavigationSettled,ie=p.disablePdfAnnotations,re=void 0!==ie&&ie,oe=p.disablePdfTextLayer,ae=void 0!==oe&&oe,le=p.renderPage,ue=p.setRenderRange,ce=g(null),se=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}}(O),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||ae?function(t){var n=ae?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 le?le(a):r(o,{children:[t.canvasLayer.children,n,!re&&t.annotationLayer.children]})}:le},[re,ae,le]),Te=h(function(){if(j)return new Set(w.map(function(e){return e.pageIndex}));var e=new Set;return Object.values(T).forEach(function(t){t>0&&e.add(t-1)}),e},[w,T,j]),we=(y=P)&&0!==y.length?y.filter(function(e){return!y.some(function(t){return t!==e&&t.includes(e)})}):y,Ce=s(we,j?{}:T,ce,Te,j,j?w:[],b,A),be=Ce.highlightIndex,Se=Ce.cursorIndex,Ae=Ce.setCursorIndex,Ie=Ce.orderedKeys,_e=Ce.totalHighlights,qe=Ce.getValidPosition,Re=Ce.tryJump,He=Ce.jumpToPage,Le=Ce.plugins,Ne=Ce.controls,je=Ce.hideNonTargetHighlights,Fe=Ce.deduplicateHighlights,Be=qe(Se),De=h(function(){var e=ge+1;return Y.find(function(t){return e>=t.start_page&&e<=t.end_page})},[ge,Y]);v(function(){void 0!==B&&B!==Se&&Ae(B)},[B]);var Me=e(e({},Ne),{goToNext:function(){Se>=_e-1||(Ne.goToNext(),D&&D(Se+1))},goToPrevious:function(){Se<=0||(Ne.goToPrevious(),D&&D(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,r=0,o=0,a=function(){var l,u;if(xe.current===n){o+=1;var c=null===(l=ce.current)||void 0===l?void 0:l.querySelector(".rpv-core__inner-pages"),s=null===(u=ce.current)||void 0===u?void 0:u.querySelector('[data-testid="core__page-layer-'.concat(t-1,'"]'));if(!c||!s)return o>=40?(ye.current=null,void(null==ne||ne({pageNumber:t,requestId:e.requestId}))):void(ye.current=window.setTimeout(a,50));i===c.scrollTop?r+=1:(i=c.scrollTop,r=0);var d=c.getBoundingClientRect(),g=s.getBoundingClientRect(),f=Boolean(d&&g&&g.bottom>d.top&&g.top<d.bottom);if(r>=2&&f||o>=40)return ye.current=null,void(null==ne||ne({pageNumber:t,requestId:e.requestId}));ye.current=window.setTimeout(a,50)}};ye.current=window.setTimeout(a,50)},[ne]);if(v(function(){return function(){xe.current+=1,null!=ye.current&&window.clearTimeout(ye.current)}},[]),v(function(){var e;if(te&&!(ve<=0)){var t=Math.min(Math.max(Math.trunc(te.pageNumber),1),ve),n="".concat(null!==(e=te.requestId)&&void 0!==e?e:t,":").concat(t);pe.current!==n&&(pe.current=n,fe(t-1),He(t-1),Ve(te,t))}},[He,te,ve,Ve]),!x)return i(m,{pages:F,activeCitationIndex:B,onActiveCitationChange:D,headerAction:M});return r("div",e({ref:ce,className:(null==L?void 0:L.pdfViewerWrapper)||"","data-disable-pdf-annotations":re?"true":void 0,"data-pdf-page-fit":se===a.PageFit?"true":void 0,style:e(e(e({height:"100%",minHeight:0,minWidth:0,overflow:"hidden",display:"flex",flexDirection:"column"},c.pdfViewer),{display:"flex",flexDirection:"column",height:"100%",width:"100%",backgroundColor:"#FAFAFA"}),null==H?void 0:H.pdfViewer)},{children:[i(u,{highlightIndex:be,totalHighlights:_e,controls:Me,currentPosition:Be,pdfName:q,onClose:R,pdfUrl:x,viewerRef:ce,customStyles:H,customClasses:L,customIcons:N,headerAction:M,isZoomEnabled:W,showHighlightsAction:E,showFullScreenAction:Q,currentSegment:De,segmentTooltipText:$,currentPage:ge+1,totalPages:ve,onPageNavigate:function(e){var t=Math.min(Math.max(e,1),ve||e);fe(t-1),He(t-1)}}),i(l,{defaultScale:se,pdfUrl:x,plugins:Le,customStyles:H,onLoad:function(e){me(e.doc.numPages);var i=!j&&!Z&&_<=0;if(_>0&&!Z){var r=_-1,o=Ie[r],a=T[o],l=w[r];Ae(r),console.log(l,"cordinateTargetHighlight"),j&&l.pageIndex>0&&He(l.pageIndex),a>0&&(setTimeout(function(){je(Te),Fe(a-1)},1e3),j||He(a-1))}else if(Z&&K&&2===K.length){t(void 0,void 0,void 0,function(){var e,t,i,r,o;return n(this,function(n){switch(n.label){case 0:e=K[0],t=K[1],i=e,n.label=1;case 1:return i<=t?(He(r=i-1),[4,new Promise(function(e){return setTimeout(e,1e3)})]):[3,4];case 2:if(n.sent(),je(Te),(o=Fe(r))&&o>0)return[3,4];n.label=3;case 3:return i++,[3,1];case 4:return[2]}})})}else if(!j&&T){var u=Ie.find(function(e){return T[e]>0});if(void 0!==u){var c=T[u]-1;He(c),setTimeout(function(){je(Te),Fe(c)},1e3)}}requestAnimationFrame(function(){i&&Re(),!j&&_>0&&!Z&&function(){if(ce.current){var e=_-1,t=Ie[e],n=T[t],i=n>0?n-1:0,r={};Ie.forEach(function(e,t){var n=T[e];n>0&&(r[n]||(r[n]=[]),r[n].push(t))});var o=(r[n]||[]).indexOf(e),a=0,l=function(){var e,t;if(!(++a>40)){var n=null===(e=ce.current)||void 0===e?void 0:e.querySelector(".rpv-core__inner-pages");if(n){var r=null===(t=ce.current)||void 0===t?void 0:t.querySelector('[data-testid="core__page-layer-'.concat(i,'"]'));if(r){var u=n.getBoundingClientRect(),c=r.getBoundingClientRect();if(c.top<u.bottom&&c.bottom>u.top){var s=r.querySelectorAll(".rpv-search__highlight")[o];if(s){var d=s.getBoundingClientRect(),g=n.scrollTop+(d.top-u.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==ee||ee(t+1),Te.has(t)?(Fe(t),je(Te)):je(Te)},renderPage:Pe,setRenderRange:ue})]}))};export{p as default};
1
+ import{__assign as e,__awaiter as t,__generator as n}from"tslib";import{jsx as r,jsxs as i,Fragment as o}from"react/jsx-runtime";import{SpecialZoomLevel as a}from"@react-pdf-viewer/core";import u from"./PdfContainer.js";import l from"./PdfToolbar.js";import{pdfStyles as c}from"./PdfStyle.js";import{PdfHighlightControls as d}from"./usePdfHighlight.js";import{rotationManager as s}from"./rotationManager.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 g,{useRef as f,useState as h,useMemo as v,useEffect as m}from"react";import p from"../ScannedDocCitation/ScannedDocCitation.js";var w=function(w){var y=w.pdfUrl,P=w.highlightText,x=w.highlightPages,T=w.highlightCordinatePages,b=w.highlightColor,C=void 0===b?"yellow":b,S=w.activeHighlightColor,A=void 0===S?"#f7dc51":S,R=w.jumpToPageValue,_=void 0===R?0:R,I=w.pdfName,q=w.onClose,L=w.customStyles,H=w.customClasses,N=w.customIcons,j=w.useCoordinates,B=w.fallbackPages,F=w.activeCitationIndex,M=w.onActiveCitationChange,E=w.headerAction,D=w.isZoomEnabled,V=void 0===D||D,W=w.showHighlightsAction,z=void 0===W||W,O=w.defaultScale,U=void 0===O?a.ActualSize:O,k=w.useRange,Z=void 0!==k&&k,J=w.rangeOfPages,K=void 0===J?null:J,G=w.showFullScreenAction,Q=void 0===G||G,X=w.showRotateButton,Y=void 0!==X&&X,$=w.segments,ee=void 0===$?[{title:"Document 2",start_page:52,end_page:52,page_count:1}]:$,te=w.segmentTooltipText,ne=w.onCurrentPageChange,re=w.navigationRequest,ie=w.onNavigationSettled,oe=w.disablePdfAnnotations,ae=void 0!==oe&&oe,ue=w.disablePdfTextLayer,le=void 0!==ue&&ue,ce=w.renderPage,de=w.setRenderRange,se=f(null),ge=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}}(U),fe=h(0),he=fe[0],ve=fe[1],me=h(0),pe=me[0],we=me[1],ye=h(0),Pe=ye[0],xe=ye[1],Te=f(null),be=f(null),Ce=f(0),Se=f(null),Ae=v(function(){if(!y)return"";try{return new URL(y,window.location.origin).pathname.split("/").pop()||"default"}catch(e){return"default"}},[y]);m(function(){Ae&&s.setPdfIdentifier(Ae)},[Ae]);m(function(){return s.onRotationChange(function(e,t){e===he+1&&xe(t)})},[he]),m(function(){var e=new MutationObserver(function(){var e,t=null===(e=se.current)||void 0===e?void 0:e.querySelectorAll('[data-testid^="core__page-layer-"]'),n=new Set;null==t||t.forEach(function(e){var t,r=null===(t=e.getAttribute("data-testid"))||void 0===t?void 0:t.match(/core__page-layer-(\d+)/);if(r&&r.length>=2){var i=parseInt(r[1],10)+1;n.has(i)||(s.registerPageElement(i,e),n.add(i))}})});return se.current&&(e.observe(se.current,{childList:!0,subtree:!0,attributes:!1}),Se.current=e),function(){e.disconnect(),Se.current=null}},[]),m(function(){return function(){s.clearAll(),Se.current&&Se.current.disconnect()}},[]),m(function(){var e=he+1;xe(s.getRotation(e))},[he]);var Re,_e=v(function(){return ae||le?function(t){var n=le?r("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:ae?null:t.annotationLayer.children}),textLayer:e(e({},t.textLayer),{children:n})});return ce?ce(a):i(o,{children:[t.canvasLayer.children,n,!ae&&t.annotationLayer.children]})}:ce},[ae,le,ce]),Ie=v(function(){if(j)return new Set(T.map(function(e){return e.pageIndex}));var e=new Set;return Object.values(x).forEach(function(t){t>0&&e.add(t-1)}),e},[T,x,j]),qe=(Re=P)&&0!==Re.length?Re.filter(function(e){return!Re.some(function(t){return t!==e&&t.includes(e)})}):Re,Le=d(qe,j?{}:x,se,Ie,j,j?T:[],C,A),He=Le.highlightIndex,Ne=Le.cursorIndex,je=Le.setCursorIndex,Be=Le.orderedKeys,Fe=Le.totalHighlights,Me=Le.getValidPosition,Ee=Le.tryJump,De=Le.jumpToPage,Ve=Le.plugins,We=Le.controls,ze=Le.hideNonTargetHighlights,Oe=Le.deduplicateHighlights,Ue=Me(Ne),ke=v(function(){var e=he+1;return ee.find(function(t){return e>=t.start_page&&e<=t.end_page})},[he,ee]);m(function(){void 0!==F&&F!==Ne&&je(F)},[F]);var Ze=e(e({},We),{goToNext:function(){Ne>=Fe-1||(We.goToNext(),M&&M(Ne+1))},goToPrevious:function(){Ne<=0||(We.goToPrevious(),M&&M(Ne-1))}}),Je=g.useCallback(function(e,t){Ce.current+=1;var n=Ce.current;null!=be.current&&window.clearTimeout(be.current);var r=null,i=0,o=0,a=function(){var u,l;if(Ce.current===n){o+=1;var c=null===(u=se.current)||void 0===u?void 0:u.querySelector(".rpv-core__inner-pages"),d=null===(l=se.current)||void 0===l?void 0:l.querySelector('[data-testid="core__page-layer-'.concat(t-1,'"]'));if(!c||!d)return o>=40?(be.current=null,void(null==ie||ie({pageNumber:t,requestId:e.requestId}))):void(be.current=window.setTimeout(a,50));r===c.scrollTop?i+=1:(r=c.scrollTop,i=0);var s=c.getBoundingClientRect(),g=d.getBoundingClientRect(),f=Boolean(s&&g&&g.bottom>s.top&&g.top<s.bottom);if(i>=2&&f||o>=40)return be.current=null,void(null==ie||ie({pageNumber:t,requestId:e.requestId}));be.current=window.setTimeout(a,50)}};be.current=window.setTimeout(a,50)},[ie]);if(m(function(){return function(){Ce.current+=1,null!=be.current&&window.clearTimeout(be.current)}},[]),m(function(){var e;if(re&&!(pe<=0)){var t=Math.min(Math.max(Math.trunc(re.pageNumber),1),pe),n="".concat(null!==(e=re.requestId)&&void 0!==e?e:t,":").concat(t);Te.current!==n&&(Te.current=n,ve(t-1),De(t-1),Je(re,t))}},[De,re,pe,Je]),!y)return r(p,{pages:B,activeCitationIndex:F,onActiveCitationChange:M,headerAction:E});return i("div",e({ref:se,className:(null==H?void 0:H.pdfViewerWrapper)||"","data-disable-pdf-annotations":ae?"true":void 0,"data-pdf-page-fit":ge===a.PageFit?"true":void 0,style:e(e(e({height:"100%",minHeight:0,minWidth:0,overflow:"hidden",display:"flex",flexDirection:"column"},c.pdfViewer),{display:"flex",flexDirection:"column",height:"100%",width:"100%",backgroundColor:"#FAFAFA"}),null==L?void 0:L.pdfViewer)},{children:[r(l,{highlightIndex:He,totalHighlights:Fe,controls:Ze,currentPosition:Ue,pdfName:I,onClose:q,pdfUrl:y,viewerRef:se,customStyles:L,customClasses:H,customIcons:N,headerAction:E,isZoomEnabled:V,showHighlightsAction:z,showFullScreenAction:Q,currentSegment:ke,segmentTooltipText:te,currentPage:he+1,totalPages:pe,onPageNavigate:function(e){var t=Math.min(Math.max(e,1),pe||e);ve(t-1),De(t-1)},onRotatePage:function(){var e=he+1;s.rotatePageBy90(e),xe(s.getRotation(e))},currentPageRotation:Pe,showRotateButton:Y}),r(u,{defaultScale:ge,pdfUrl:y,plugins:Ve,customStyles:L,onLoad:function(e){we(e.doc.numPages);var r=!j&&!Z&&_<=0;if(_>0&&!Z){var i=_-1,o=Be[i],a=x[o],u=T[i];je(i),console.log(u,"cordinateTargetHighlight"),j&&u.pageIndex>0&&De(u.pageIndex),a>0&&(setTimeout(function(){ze(Ie),Oe(a-1)},1e3),j||De(a-1))}else if(Z&&K&&2===K.length){t(void 0,void 0,void 0,function(){var e,t,r,i,o;return n(this,function(n){switch(n.label){case 0:e=K[0],t=K[1],r=e,n.label=1;case 1:return r<=t?(De(i=r-1),[4,new Promise(function(e){return setTimeout(e,1e3)})]):[3,4];case 2:if(n.sent(),ze(Ie),(o=Oe(i))&&o>0)return[3,4];n.label=3;case 3:return r++,[3,1];case 4:return[2]}})})}else if(!j&&x){var l=Be.find(function(e){return x[e]>0});if(void 0!==l){var c=x[l]-1;De(c),setTimeout(function(){ze(Ie),Oe(c)},1e3)}}requestAnimationFrame(function(){r&&Ee(),!j&&_>0&&!Z&&function(){if(se.current){var e=_-1,t=Be[e],n=x[t],r=n>0?n-1:0,i={};Be.forEach(function(e,t){var n=x[e];n>0&&(i[n]||(i[n]=[]),i[n].push(t))});var o=(i[n]||[]).indexOf(e),a=0,u=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 i=null===(t=se.current)||void 0===t?void 0:t.querySelector('[data-testid="core__page-layer-'.concat(r,'"]'));if(i){var l=n.getBoundingClientRect(),c=i.getBoundingClientRect();if(c.top<l.bottom&&c.bottom>l.top){var d=i.querySelectorAll(".rpv-search__highlight")[o];if(d){var s=d.getBoundingClientRect(),g=n.scrollTop+(s.top-l.top)-n.clientHeight/2+s.height/2;n.scrollTo({top:g,behavior:"smooth"})}else setTimeout(u,100)}else setTimeout(u,100)}else setTimeout(u,100)}else setTimeout(u,100)}};setTimeout(u,500)}}()})},onPageChange:function(e){var t=e.currentPage;ve(t),null==ne||ne(t+1),Ie.has(t)?(Oe(t),ze(Ie)):ze(Ie)},renderPage:_e,setRenderRange:de})]}))};export{w as default};
2
2
  //# sourceMappingURL=PdfViewer.js.map
@@ -0,0 +1,2 @@
1
+ var t=function(){function t(){this.rotations=new WeakMap,this.pageMap=new Map,this.rotationChangeListeners=new Set,this.pdfIdentifier=""}return t.prototype.setPdfIdentifier=function(t){this.pdfIdentifier=t},t.prototype.registerPageElement=function(t,e){this.pageMap.get(t),this.pageMap.set(t,e);var o=this.getPersistedRotation(t);0!==o&&this.applyRotation(e,t,o)},t.prototype.unregisterPageElement=function(t){this.pageMap.delete(t)},t.prototype.getRotation=function(t){var e=this.pageMap.get(t);return e&&this.rotations.get(e)||0},t.prototype.rotatePageBy90=function(t){var e=this.pageMap.get(t);if(e){var o=((this.rotations.get(e)||0)+90)%360;this.applyRotation(e,t,o)}},t.prototype.setRotation=function(t,e){var o=(e%360+360)%360,i=this.pageMap.get(t);i&&this.applyRotation(i,t,o)},t.prototype.applyRotation=function(t,e,o){this.rotations.set(t,o);var i=t.closest(".rpv-core__page-layer");i&&(0===o?(i.style.transform="",i.style.transformOrigin="",i.style.transition=""):(i.style.transform="rotate(".concat(o,"deg)"),i.style.transformOrigin="center center",i.style.transition="transform 0.2s ease")),this.notifyRotationChange(e,o),this.persistRotation(e,o)},t.prototype.onRotationChange=function(t){var e=this;return this.rotationChangeListeners.add(t),function(){e.rotationChangeListeners.delete(t)}},t.prototype.notifyRotationChange=function(t,e){this.rotationChangeListeners.forEach(function(o){try{o(t,e)}catch(t){console.error("Error in rotation change listener:",t)}})},t.prototype.getPersistedRotation=function(t){if(!this.pdfIdentifier)return 0;var e="pdf-rotation-".concat(this.pdfIdentifier,"-").concat(t),o=localStorage.getItem(e);if(null===o)return 0;if(!o)return 0;var i=parseInt(o,10);return Number.isFinite(i)?i:0},t.prototype.persistRotation=function(t,e){if(this.pdfIdentifier){var o="pdf-rotation-".concat(this.pdfIdentifier,"-").concat(t);0===e?localStorage.removeItem(o):localStorage.setItem(o,e.toString())}},t.prototype.loadPersistedRotations=function(t){var e=this;this.pdfIdentifier&&t.forEach(function(t){var o=e.getPersistedRotation(t);if(0!==o){var i=e.pageMap.get(t);i&&e.applyRotation(i,t,o)}})},t.prototype.clearAll=function(){var t=this;this.pageMap.forEach(function(e,o){var i=e.closest(".rpv-core__page-layer");if(i&&(i.style.transform="",i.style.transformOrigin="",i.style.transition=""),t.pdfIdentifier){var n="pdf-rotation-".concat(t.pdfIdentifier,"-").concat(o);localStorage.removeItem(n)}}),this.pageMap.clear(),this.rotations=new WeakMap},t.prototype.resetPage=function(t){var e=this.pageMap.get(t);e&&this.applyRotation(e,t,0)},t.prototype.getRotatedPages=function(){var t=this,e=new Map;return this.pageMap.forEach(function(o,i){var n=t.rotations.get(o);void 0!==n&&0!==n&&e.set(i,n)}),e},t}(),e=new t;export{t as RotationManager,e as rotationManager};
2
+ //# sourceMappingURL=rotationManager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rotationManager.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ import{__assign as n,__spreadArray as e}from"tslib";import{jsxs as t,jsx as r,Fragment as o}from"react/jsx-runtime";import{useMemo as i,useRef as l,useState as a,useCallback as d,useEffect as c}from"react";var u=170,s=48,f=["#ede9fe","#e0f2fe","#fef3c7","#dcfce7","#ffe4e6","#f0fdf4","#fef9c3","#e0e7ff","#fce7f3","#f1f5f9"],v=["#7c3aed","#0284c7","#b45309","#16a34a","#e11d48","#15803d","#a16207","#4338ca","#db2777","#475569"],p=["⚙","◈","⟐","✦","◎","⬡","◇","⊕","✶","◉"],g=["#a78bfa","#7dd3fc","#fbbf24","#86efac","#fda4af","#6ee7b7","#fde047","#a5b4fc","#f9a8d4","#94a3b8"],h=["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)"],y=["Context & Inputs","Core Logic & Rules","Outputs & Schema"];function b(t){var r=Array.isArray(null==t?void 0:t.clusters)?t.clusters:[],o=Array.isArray(null==t?void 0:t.nodes)?t.nodes:[],i=Array.isArray(null==t?void 0:t.edges)?t.edges:[],l=function(n,t,r){var o,i=n.length;if(0===i)return new Map;var l={};n.forEach(function(n,e){l[n.id]=e});var a={};n.forEach(function(n){a[n.id]=0});for(var d=0;d<i;d++){for(var c=!1,u=0,s=t;u<s.length;u++){var f=s[u],v=(a[f.source]||0)+1;v>(a[f.target]||0)&&v<i&&(a[f.target]=v,c=!0)}if(!c)break}var p={};r.forEach(function(n,e){p[n.id]=e});var g={};r.forEach(function(n){g[n.id]=[]}),n.forEach(function(n){var e;null===(e=g[n.cluster_id])||void 0===e||e.push(n)}),Object.values(g).forEach(function(n){return n.sort(function(n,e){return(a[n.id]||0)-(a[e.id]||0)})});for(var h=new Float64Array(i),y=new Float64Array(i),b=new Float64Array(i),x=new Float64Array(i),m=function(n){var e=null!==(o=p[n.id])&&void 0!==o?o:0;(g[n.id]||[]).forEach(function(n,t){var r=l[n.id];h[r]=520*e+280,y[r]=200*t+120})},w=0,M=r;w<M.length;w++)m(U=M[w]);for(var k=.0015,S=Math.max.apply(Math,e(e([],n.map(function(n){return a[n.id]||0}),!1),[1],!1)),C=new Float64Array(i),_=0;_<i;_++)C[_]=(a[n[_].id]||0)/S*(200*i*.6)+120;for(var A=0;A<350;A++){var z=Math.max(.015,1-A/350),E=new Float64Array(i),I=new Float64Array(i);for(_=0;_<i;_++)for(var j=_+1;j<i;j++){var R=(X=h[_]-h[j])*X+(H=y[_]-y[j])*H;R<400&&(R=(X=12*(_-j))*X+(H=8*(_+j))*H);var W=X/(L=Math.sqrt(R))*(O=48e4/R),P=H/L*O;E[_]+=W,I[_]+=P,E[j]-=W,I[j]-=P}for(var B=0,Y=t;B<Y.length;B++){f=Y[B];var F=l[f.source],D=l[f.target];if(void 0!==F&&void 0!==D){var L,O,X=h[D]-h[F],H=y[D]-y[F];if(!((L=Math.sqrt(X*X+H*H))<1))W=X/L*(O=.004*(L-380)),P=H/L*O,E[F]+=W,I[F]+=P,E[D]-=W,I[D]-=P}}var N={},T={},q={};for(_=0;_<i;_++)N[U=n[_].cluster_id]=(N[U]||0)+h[_],T[U]=(T[U]||0)+y[_],q[U]=(q[U]||0)+1;for(_=0;_<i;_++){var U=n[_].cluster_id;E[_]+=(N[U]/q[U]-h[_])*k,I[_]+=(T[U]/q[U]-y[_])*k}for(_=0;_<i;_++)I[_]+=.002*(C[_]-y[_]);for(_=0;_<i;_++)b[_]=.84*(b[_]+E[_])*z,x[_]=.84*(x[_]+I[_])*z,h[_]+=b[_],y[_]+=x[_]}for(d=0;d<40;d++){var G=!1;for(_=0;_<i;_++)for(j=_+1;j<i;j++){X=h[_]-h[j],H=y[_]-y[j];var Q=270-Math.abs(X),J=128-Math.abs(H);if(Q>0&&J>0)if(G=!0,Q<J){var K=Q/2+5;h[_]+=X>0?K:-K,h[j]-=X>0?K:-K}else K=J/2+5,y[_]+=H>0?K:-K,y[j]-=H>0?K:-K}if(!G)break}var V=1/0,Z=1/0;for(_=0;_<i;_++)V=Math.min(V,h[_]),Z=Math.min(Z,y[_]);var $=new Map;for(_=0;_<i;_++)$.set(n[_].id,{x:Math.round(h[_]-V+80),y:Math.round(y[_]-Z+80)});return $}(o,i,r),a=o.map(function(e){var t=l.get(e.id)||{x:0,y:0};return n(n({},e),{x:t.x,y:t.y})}),d={};r.forEach(function(n,e){d[n.id]=e});var c={};r.forEach(function(n){c[n.id]=[]}),a.forEach(function(n){var e;null===(e=c[n.cluster_id])||void 0===e||e.push(n)});var f=36,v=r.map(function(n){var e=c[n.id];if(!e.length)return null;var t=Math.min.apply(Math,e.map(function(n){return n.x})),r=Math.min.apply(Math,e.map(function(n){return n.y})),o=Math.max.apply(Math,e.map(function(n){return n.x+u})),i=Math.max.apply(Math,e.map(function(n){return n.y+s}));return{id:n.id,label:n.label,idx:d[n.id],x:t-f,y:r-f,width:o-t+72,height:i-r+72+22}}).filter(function(n){return null!==n});return{nodes:a.map(function(e){var t;return n(n({},e),{cluster:null!==(t=d[e.cluster_id])&&void 0!==t?t:0})}),edges:i,clusterBounds:v,canvasW:Math.max.apply(Math,a.map(function(n){return n.x+u}))+72,canvasH:Math.max.apply(Math,a.map(function(n){return n.y+s}))+72}}function x(n,e,t){var r=e[n.source],o=e[n.target];if(!r||!o)return"";var i=function(n,e){var t=n.x+85,r=n.y+24,o=e.x+85,i=e.y+24;function l(n,e,t,r){var o=t-n,i=r-e;return Math.abs(i)>.4*Math.abs(o)?i>0?{x:n,y:e+24}:{x:n,y:e-24}:o>0?{x:n+85,y:e}:{x:n-85,y:e}}return{source:l(t,r,o,i),target:l(o,i,t,r)}}(r,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<r.y&&o.y<r.y-s){var f=Math.min(r.x,o.x)-110;return"M ".concat(l.x," ").concat(l.y," C ").concat(f," ").concat(l.y,", ").concat(f," ").concat(a.y,", ").concat(a.x," ").concat(a.y)}var v=-c/u,p=d/u;if(t.some(function(e){return e.source===n.target&&e.target===n.source})){var g=n.source<n.target?1:-1,h=Math.max(.18*u,40)*g;return"M ".concat(l.x," ").concat(l.y," Q ").concat((l.x+a.x)/2+v*h," ").concat((l.y+a.y)/2+p*h," ").concat(a.x," ").concat(a.y)}var y=Math.min(.12*u,55);return"M ".concat(l.x," ").concat(l.y," Q ").concat((l.x+a.x)/2+v*y," ").concat((l.y+a.y)/2+p*y," ").concat(a.x," ").concat(a.y)}var m=function(e){var m,w,M,k,S,C,_,A,z,E,I,j,R=e.data,W=e.isDarkMode,P=void 0!==W&&W,B=e.height,Y=void 0===B?500:B,F=e.width,D=void 0===F?"100%":F,L=e.styles,O=i(function(){return function(e){if(!e||"object"!=typeof e)return null;if(Array.isArray(e.nodes)&&Array.isArray(e.edges)){var t=e.nodes,r=Array.isArray(e.clusters)&&e.clusters.length>0?e.clusters:null,o=new Set(t.map(function(n){return n.cluster_id}));if(!r||o.size<=1){var i=Math.max(1,Math.min(3,Math.ceil(t.length/3)));r=Array.from({length:i},function(n,e){return{id:"cl_".concat(e+1),label:y[e]||"Group ".concat(e+1)}}),t=t.map(function(e,t){var o=t%i,l=Math.floor(t/i);return n(n({},e),{cluster_id:r[o].id,x:450*o+200,y:180*l+100})})}return{graph_id:e.graph_id||"graph",prompt_id:e.prompt_id||"",last_analyzed_at:e.last_analyzed_at||(new Date).toISOString(),clusters:r,nodes:t,edges:e.edges}}var l=Object.keys(e);if(0===l.length)return null;var a=Math.max(1,Math.min(3,Math.ceil(l.length/3))),d=Array.from({length:a},function(n,e){return{id:"cl_".concat(e+1),label:y[e]||"Group ".concat(e+1)}}),c=[],u=[];return l.forEach(function(n,t){var r=t%a,o=Math.floor(t/a),i=n.split("_").map(function(n){return n.charAt(0).toUpperCase()+n.slice(1)}).join(" "),l="node_".concat(n);c.push({id:l,label:i,cluster_id:d[r].id,x:450*r+200,y:180*o+100,description:"Section: ".concat(i)});var s=e[n];Array.isArray(s)&&s.forEach(function(e,t){var r;if(e&&"object"==typeof e){var o=e.dependent_on;if(o){var i="";"string"==typeof e.reasoning?i=e.reasoning:Array.isArray(e.reasoning)?i=e.reasoning.map(function(n){return"string"==typeof n?n:(null==n?void 0:n.text)||""}).filter(Boolean).join(" "):(null===(r=e.reasoning)||void 0===r?void 0:r.text)&&(i=String(e.reasoning.text)),u.push({id:"e_".concat(n,"_").concat(o,"_").concat(t),source:l,target:"node_".concat(o),reasoning:i||"Depends on ".concat(o),score:"number"==typeof e.Score?e.Score:"number"==typeof e.score?e.score:80,gap:e.gap||"",dependency_type:e.dependency_type||"implicit"})}}})}),0===c.length?null:{graph_id:"converted_graph",prompt_id:"",last_analyzed_at:(new Date).toISOString(),clusters:d,nodes:c,edges:u}}(R)},[R]),X=i(function(){return O?b(O):null},[O]),H=i(function(){var n={};return null==X||X.nodes.forEach(function(e){n[e.id]=e}),n},[X]),N=i(function(){var n={};return null==O||O.clusters.forEach(function(e,t){n[e.id]=t}),n},[O]),T=l(null),q=a({x:0,y:0}),U=q[0],G=q[1],Q=a(.5),J=Q[0],K=Q[1],V=a(!1),Z=V[0],$=V[1],nn=l({x:0,y:0}),en=l({x:0,y:0}),tn=a(null),rn=tn[0],on=tn[1],ln=a(null),an=ln[0],dn=ln[1],cn=a(null),un=cn[0],sn=cn[1],fn=a(null),vn=fn[0],pn=fn[1],gn=i(function(){return vn&&X?new Set(X.edges.filter(function(n){return n.source===vn||n.target===vn}).map(function(n){return n.id})):new Set},[vn,X]),hn=i(function(){if(!vn||!X)return new Set;var n=new Set([vn]);return X.edges.forEach(function(e){e.source===vn&&n.add(e.target),e.target===vn&&n.add(e.source)}),n},[vn,X]);i(function(){return O?new Date(O.last_analyzed_at).toLocaleString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0,day:"numeric",month:"short",year:"numeric"}):""},[O]);var yn=d(function(n){n.preventDefault(),K(function(e){return Math.min(2.5,Math.max(.2,e-.001*n.deltaY))})},[]);c(function(){var n=T.current;return n&&n.addEventListener("wheel",yn,{passive:!1}),function(){return null==n?void 0:n.removeEventListener("wheel",yn)}},[yn]);var bn=d(function(e){e.target.closest("[data-edge-hit]")||e.target.closest("[data-node]")||($(!0),nn.current={x:e.clientX,y:e.clientY},en.current=n({},U),e.currentTarget.style.cursor="grabbing")},[U]),xn=d(function(n){Z&&G({x:en.current.x+(n.clientX-nn.current.x),y:en.current.y+(n.clientY-nn.current.y)})},[Z]),mn=d(function(){$(!1),T.current&&(T.current.style.cursor="grab")},[]);var wn=function(n,e){return"string"==typeof n?n:e},Mn=null!==(k=null!==(w=null===(m=null==L?void 0:L.root)||void 0===m?void 0:m.backgroundColor)&&void 0!==w?w:null===(M=null==L?void 0:L.root)||void 0===M?void 0:M.background)&&void 0!==k?k:P?"#090d16":"#ffffff",kn=null!==(C=null===(S=null==L?void 0:L.root)||void 0===S?void 0:S.color)&&void 0!==C?C:P?"#f8fafc":"#1e293b",Sn=null!==(A=null===(_=null==L?void 0:L.subtitle)||void 0===_?void 0:_.color)&&void 0!==A?A:"#94a3b8",Cn=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==L?void 0:L.controlButton);return X&&O?t("div",n({style:n({width:D,height:Y,position:"relative",background:Mn,color:kn,fontFamily:"'Inter', -apple-system, BlinkMacSystemFont, sans-serif",overflow:"hidden"},null==L?void 0:L.root)},{children:[t("div",n({style:n({position:"absolute",top:0,left:0,right:0,zIndex:20,padding:"10px 14px",display:"flex",alignItems:"center",justifyContent:"space-between"},null==L?void 0:L.header)},{children:[r("p",n({style:n({margin:0,fontSize:12,color:Sn},null==L?void 0:L.subtitle)},{children:"· Click a node or connection to explore details."})),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==L?void 0:L.controls)},{children:[r("button",n({onClick:function(){return K(function(n){return Math.max(.2,n-.15)})},style:Cn},{children:"−"})),t("button",n({onClick:function(){K(.5),G({x:0,y:0})},style:n(n({},Cn),{fontSize:11,width:52,fontWeight:600})},{children:[Math.round(100*J),"%"]})),r("button",n({onClick:function(){return K(function(n){return Math.min(2.5,n+.15)})},style:Cn},{children:"+"}))]}))]})),an&&function(){var e,o,i=an.node,l=null!==(e=N[i.cluster_id])&&void 0!==e?e:0;return t("div",n({style:n({position:"absolute",top:50,left:14,zIndex:20,width:"30%",minWidth:280,borderRadius:12,overflow:"hidden",boxShadow:"0 2px 12px rgba(0,0,0,0.07)",border:"1px solid ".concat(P?"#334155":"#e2e8f0"),animation:"cdg-slideDown 0.2s ease-out"},null==L?void 0:L.nodePopup)},{children:[t("div",n({style:n({padding:"10px 14px",background:h[l%h.length],color:"#fff",display:"flex",alignItems:"center",justifyContent:"space-between"},null==L?void 0:L.nodePopupHeader)},{children:[t("div",n({style:{display:"flex",alignItems:"center",gap:10}},{children:[r("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:p[l%p.length]})),t("div",{children:[r("div",n({style:{fontSize:9,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.06em",opacity:.75}},{children:(null===(o=O.clusters[l])||void 0===o?void 0:o.label)||""})),r("div",n({style:{fontSize:14,fontWeight:700,marginTop:1}},{children:i.label}))]})]})),r("button",n({onClick:function(){dn(null),pn(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"},null==L?void 0:L.popupCloseButton)},{children:"×"}))]})),r("div",n({style:n({padding:"10px 14px",fontSize:13,lineHeight:1.6,color:P?"#cbd5e1":"#475569",background:P?"#1e293b":"#fff"},null==L?void 0:L.nodePopupBody)},{children:i.description||"No description available."}))]}))}(),t("div",n({ref:T,onPointerDown:bn,onPointerMove:xn,onPointerUp:mn,onPointerLeave:mn,onClick:function(){on(null),dn(null),pn(null)},style:{width:"100%",height:"100%",cursor:Z?"grabbing":"grab",position:"relative"}},{children:[r("div",n({style:{transform:"translate(".concat(U.x,"px,").concat(U.y,"px) scale(").concat(J,")"),transformOrigin:"top left",position:"absolute",top:50,left:20,transition:Z?"none":"transform 0.08s ease-out"}},{children:t("svg",n({width:X.canvasW,height:X.canvasH,style:{overflow:"visible"}},{children:[X.clusterBounds.map(function(e){var o,i,l,a,d,c,u;return t("g",{children:[r("rect",{x:e.x,y:e.y,width:e.width,height:e.height,rx:"16",fill:wn(null!==(i=null===(o=null==L?void 0:L.cluster)||void 0===o?void 0:o.backgroundColor)&&void 0!==i?i:null===(l=null==L?void 0:L.cluster)||void 0===l?void 0:l.background,P?"rgba(30,41,59,0.35)":"none"),stroke:wn(null!==(d=null===(a=null==L?void 0:L.cluster)||void 0===a?void 0:a.borderColor)&&void 0!==d?d:null===(c=null==L?void 0:L.cluster)||void 0===c?void 0:c.border,P?"#334155":"#e2e8f0"),strokeWidth:"1.5",strokeDasharray:"8 4"}),r("text",n({x:e.x+14,y:e.y+e.height-10,fontSize:"11",fill:wn(null===(u=null==L?void 0:L.clusterLabel)||void 0===u?void 0:u.color,"#94a3b8"),fontFamily:"Inter, sans-serif",fontWeight:"500"},{children:e.label}))]},e.id)}),X.edges.map(function(e){var i,l,a,d,c,u,s,f,v,p,g,h,y,b,m,w,M,k,S=x(e,H,X.edges);if(!S)return null;var C=gn.has(e.id),_=(null==rn?void 0:rn.edge.id)===e.id,A=un===e.id,z=!!vn&&!C,E=C||_?null!==(d=null!==(l=null===(i=null==L?void 0:L.activeEdge)||void 0===i?void 0:i.color)&&void 0!==l?l:null===(a=null==L?void 0:L.activeEdge)||void 0===a?void 0:a.borderColor)&&void 0!==d?d:"#6366f1":A?null!==(u=null===(c=null==L?void 0:L.edge)||void 0===c?void 0:c.color)&&void 0!==u?u:"#818cf8":null!==(p=null!==(f=null===(s=null==L?void 0:L.edge)||void 0===s?void 0:s.borderColor)&&void 0!==f?f:null===(v=null==L?void 0:L.edge)||void 0===v?void 0:v.color)&&void 0!==p?p:P?"#475569":"#cbd5e1",I=C||_?2.5:A?2:1.5;return t("g",n({style:{opacity:z?.1:1,transition:"opacity 0.25s"}},{children:[r("path",{"data-edge-hit":"true",d:S,fill:"none",stroke:"transparent",strokeWidth:18,style:{cursor:"pointer"},onClick:function(n){return function(n,e){n.stopPropagation();var t=T.current.getBoundingClientRect();on({edge:e,screenX:n.clientX-t.left,screenY:n.clientY-t.top}),dn(null),pn(null)}(n,e)},onMouseEnter:function(){return sn(e.id)},onMouseLeave:function(){return sn(null)}}),r("path",{d:S,fill:"none",stroke:E,strokeWidth:I,style:{transition:"stroke 0.2s, stroke-width 0.2s",pointerEvents:"none"}}),(C||_)&&t(o,{children:[r("circle",n({r:4,fill:null!==(b=null!==(h=null===(g=null==L?void 0:L.edgeMarker)||void 0===g?void 0:g.color)&&void 0!==h?h:null===(y=null==L?void 0:L.activeEdge)||void 0===y?void 0:y.color)&&void 0!==b?b:"#6366f1"},{children:r("animateMotion",{dur:"1.8s",repeatCount:"indefinite",path:S})})),r("circle",n({r:6,fill:null!==(k=null!==(w=null===(m=null==L?void 0:L.edgeMarker)||void 0===m?void 0:m.color)&&void 0!==w?w:null===(M=null==L?void 0:L.activeEdge)||void 0===M?void 0:M.color)&&void 0!==k?k:"#6366f1",opacity:.2},{children:r("animateMotion",{dur:"1.8s",repeatCount:"indefinite",path:S})}))]})]}),e.id)}),X.nodes.map(function(e){var o,i,l,a,d,c,h,y,b,x,m,w,M,k,S,C,_,A=vn===e.id,z=hn.has(e.id),E=!!vn&&!z,I=(null!==(o=N[e.cluster_id])&&void 0!==o?o:0)%g.length,j=g[I];return r("g",n({"data-node":"true",onClick:function(n){return function(n,e){n.stopPropagation();var t=T.current.getBoundingClientRect();vn===e.id?(pn(null),dn(null)):(pn(e.id),dn({node:e,screenX:n.clientX-t.left,screenY:n.clientY-t.top}),on(null))}(n,e)},style:{cursor:"pointer",opacity:E?.15:1,transition:"opacity 0.25s"}},{children:r("foreignObject",n({x:e.x,y:e.y,width:u,height:s},{children:t("div",n({style:n(n({background:null!==(d=null!==(l=null===(i=null==L?void 0:L.node)||void 0===i?void 0:i.backgroundColor)&&void 0!==l?l:null===(a=null==L?void 0:L.node)||void 0===a?void 0:a.background)&&void 0!==d?d:P?"#1e293b":"#fff",border:A?null!==(h=null===(c=null==L?void 0:L.selectedNode)||void 0===c?void 0:c.border)&&void 0!==h?h:"2.5px solid ".concat(null!==(b=null===(y=null==L?void 0:L.selectedNode)||void 0===y?void 0:y.borderColor)&&void 0!==b?b:j):null!==(m=null===(x=null==L?void 0:L.node)||void 0===x?void 0:x.border)&&void 0!==m?m:"1.5px solid ".concat(null!==(M=null===(w=null==L?void 0:L.node)||void 0===w?void 0:w.borderColor)&&void 0!==M?M: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:A?null!==(S=null===(k=null==L?void 0:L.selectedNode)||void 0===k?void 0:k.boxShadow)&&void 0!==S?S:"0 0 0 3px ".concat(j,"33, 0 2px 8px rgba(0,0,0,0.4)"):null!==(_=null===(C=null==L?void 0:L.node)||void 0===C?void 0:C.boxShadow)&&void 0!==_?_: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==L?void 0:L.node),A?null==L?void 0:L.selectedNode:{})},{children:[r("span",n({style:n({width:22,height:22,borderRadius:6,background:f[I],display:"flex",alignItems:"center",justifyContent:"center",fontSize:11,flexShrink:0,color:v[I]},null==L?void 0:L.nodeIcon)},{children:p[I]})),r("span",n({style:{overflow:"hidden",textOverflow:"ellipsis"}},{children:e.label}))]}))}))}),e.id)})]}))})),rn&&t("div",n({onClick:function(n){return n.stopPropagation()},style:n(n(n({position:"absolute"},function(n,e,t,r){if(!T.current)return{};var o=T.current.getBoundingClientRect(),i=n+14,l=e-r/2;return i+t>o.width&&(i=n-t-14),l<8&&(l=8),l+r>o.height&&(l=o.height-r-8),{left:i,top:l}}(rn.screenX,rn.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 ".concat(P?"#334155":"#e2e8f0"),zIndex:30,animation:"cdg-popIn 0.18s ease-out",overflow:"hidden"}),null==L?void 0:L.edgePopup)},{children:[t("div",n({style:n({padding:"12px 16px 10px",background:"linear-gradient(135deg,#6366f1,#8b5cf6)",color:"#fff"},null==L?void 0:L.edgePopupHeader)},{children:[r("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!==(E=null===(z=H[rn.edge.source])||void 0===z?void 0:z.label)&&void 0!==E?E:"Source",r("span",n({style:{opacity:.6,margin:"0 6px"}},{children:"→"})),null!==(j=null===(I=H[rn.edge.target])||void 0===I?void 0:I.label)&&void 0!==j?j:"Target"]}))]})),r("div",n({style:n({padding:"12px 16px 14px",fontSize:13,lineHeight:1.6,color:P?"#cbd5e1":"#475569",whiteSpace:"pre-line"},null==L?void 0:L.edgePopupBody)},{children:rn.edge.reasoning||"No reasoning available."})),r("button",n({onClick:function(){return on(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==L?void 0:L.popupCloseButton)},{children:"×"}))]}))]})),r("style",{children:"\n @keyframes cdg-popIn { from { opacity:0; transform:scale(0.95) translateY(4px); } to { opacity:1; transform:scale(1) translateY(0); } }\n @keyframes cdg-slideDown { from { opacity:0; transform:translateY(-6px); } to { opacity:1; transform:translateY(0); } }\n "})]})):null};export{m as default};
2
+ //# sourceMappingURL=CitationDependencyGraph.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CitationDependencyGraph.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ import{__assign as o}from"tslib";import{jsx as e,jsxs as n,Fragment as l}from"react/jsx-runtime";import i,{useState as t,useRef as r,useEffect as d}from"react";import a from"@mui/material/Dialog";import s from"@mui/material/DialogContent";import p from"@mui/material/IconButton";import{InfoOutlined as c,Close as u}from"@mui/icons-material";import f from"@mui/material/Accordion";import v from"@mui/material/AccordionSummary";import h from"@mui/material/AccordionDetails";import m from"@mui/icons-material/ExpandMore";import g from"./_components/CodeEditor.js";import{themeManager as y}from"../../utils/themeManager.js";import{MarkdownRenderer as x}from"./_components/Markdownrenderer.js";import b from"@mui/material/Tooltip";import k from"../SPBAnalysisPanel/DependencyGraph.js";function w(e){if(!e||"object"!=typeof e)return null;var n=["Context & Inputs","Core Logic & Rules","Outputs & Schema"];if(Array.isArray(e.nodes)&&Array.isArray(e.edges)){var l=e.nodes,i=Array.isArray(e.clusters)&&e.clusters.length>0?e.clusters:null,t=new Set(l.map(function(o){return o.cluster_id}));if(!i||t.size<=1){var r=Math.max(1,Math.min(3,Math.ceil(l.length/3)));i=Array.from({length:r},function(o,e){return{id:"cl_".concat(e+1),label:n[e]||"Group ".concat(e+1)}}),l=l.map(function(e,n){var l=n%r,d=Math.floor(n/r);return o(o({},e),{cluster_id:i[l].id,x:e.x&&t.size>1?e.x:450*l+200,y:e.y&&t.size>1?e.y:180*d+100})})}return{graph_id:e.graph_id||"spb_graph",prompt_id:e.prompt_id||"",last_analyzed_at:e.last_analyzed_at||(new Date).toISOString(),clusters:i,nodes:l,edges:e.edges}}var d=Object.keys(e);if(0===d.length)return null;var a=d.length,s=Math.max(1,Math.min(3,Math.ceil(a/3))),p=Array.from({length:s},function(o,e){return{id:"cl_".concat(e+1),label:n[e]||"Group ".concat(e+1)}}),c=[],u=[];return d.forEach(function(o,n){var l=n%s,i=Math.floor(n/s),t=p[l].id,r=450*l+200,d=180*i+100,a=o.split("_").map(function(o){return o.charAt(0).toUpperCase()+o.slice(1)}).join(" "),f="node_".concat(o);c.push({id:f,label:a,cluster_id:t,x:r,y:d,description:"Section: ".concat(a)});var v=e[o];Array.isArray(v)&&v.forEach(function(e,n){var l;if(e&&"object"==typeof e){var i=e.dependent_on;if(i){var t="node_".concat(i),r="";"string"==typeof e.reasoning?r=e.reasoning:Array.isArray(e.reasoning)?r=e.reasoning.map(function(o){return"string"==typeof o?o:(null==o?void 0:o.text)||""}).filter(Boolean).join(" "):(null===(l=e.reasoning)||void 0===l?void 0:l.text)&&(r=String(e.reasoning.text)),u.push({id:"e_".concat(o,"_").concat(i,"_").concat(n),source:f,target:t,reasoning:r||"Depends on ".concat(i),score:"number"==typeof e.Score?e.Score:"number"==typeof e.score?e.score:80,gap:e.gap||"",dependency_type:e.dependency_type||"implicit"})}}})}),0===c.length?null:{graph_id:"spb_converted_graph",prompt_id:"",last_analyzed_at:(new Date).toISOString(),clusters:p,nodes:c,edges:u}}var S=function(n){var l=n.children,i=n.style;return e("div",o({style:o({fontWeight:"700",fontSize:"0.9rem",color:"#1a1a1a",marginBottom:"0.6rem",fontFamily:"Plus Jakarta Sans, sans-serif"},i)},{children:l}))},C=function(C){var I,A,T,F,P,W,_,B,z,L,H,D,R,J,M,j,E,G,N,O,q,V,U,Y,Z,K,Q,X,$,oo,eo,no,lo,io,to,ro,ao,so,po,co,uo,fo,vo,ho,mo,go,yo,xo,bo,ko,wo,So,Co,Io,Ao,To,Fo,Po,Wo,_o,Bo,zo,Lo,Ho,Do,Ro,Jo,Mo,jo,Eo,Go,No,Oo;C.prompt_title;var qo=C.modename,Vo=C.description,Uo=C.customMetaData;C.chevronUpComponent,C.chevronDownComponent,C.editorHeight,C.editorWidth;var Yo=C.isDarkModeEnabled,Zo=void 0===Yo||Yo,Ko=C.isDarkMode,Qo=C.startLine,Xo=void 0===Qo?8:Qo,$o=C.endLine,oe=void 0===$o?12:$o,ee=C.constraints_and_rules,ne=C.input_analysis,le=C.output_analysis;C.extraMetaData;var ie=C.showEditor,te=void 0===ie||ie,re=C.alwaysFullscreen,de=void 0!==re&&re,ae=C.renderAsComponent,se=void 0!==ae&&ae,pe=C.isFpb,ce=void 0===pe||pe,ue=C.isSpb,fe=void 0!==ue&&ue,ve=C.spbFunctionality,he=C.showDependencyIcon,me=void 0!==he&&he,ge=C.onDependencyGraphOpen,ye=C.onSectionClick,xe=C.categoryFields,be=C.total_apbs,ke=C.titleText,we=C.titleIcon,Se=C.dependencyGraphIcon,Ce=C.dependencyGraphArrowIcon,Ie=C.whenToApplyIcon,Ae=C.whenToApplyExpandIcon,Te=C.whenNotToApplyIcon,Fe=C.whenNotToApplyExpandIcon,Pe=C.specificationsIcon,We=C.specificationsInfoIcon,_e=C.specificationsExpandIcon,Be=C.styles,ze=C.defaultAccordionsExpanded,Le=void 0===ze||ze,He=C.defaultWhenToApplyExpanded,De=C.defaultWhenNotToApplyExpanded,Re=C.defaultSpecificationsExpanded,Je=C.defaultSpbFunctionalityExpanded,Me=null!==(I=null!=Ko?Ko:null==Be?void 0:Be.isDarkMode)&&void 0!==I?I:Zo,je=t(!1),Ee=je[0];je[1];var Ge=t(!1),Ne=Ge[0],Oe=Ge[1],qe=t(!1),Ve=qe[0],Ue=qe[1],Ye=r(null),Ze=t(de),Ke=Ze[0],Qe=Ze[1],Xe=t(!1),$e=Xe[0],on=Xe[1],en=t({startIndex:-1,endIndex:-1}),nn=en[0],ln=en[1],tn=t({}),rn=tn[0],dn=tn[1],an=t(function(){return y.getTheme(Me)}),sn=an[0],pn=an[1];d(function(){return y.subscribe(pn)},[]);var cn=null!==(A=null!=ke?ke:null==Uo?void 0:Uo.title)&&void 0!==A?A:"Untitled Prompt",un=(null==Uo?void 0:Uo.description)||Vo,fn=null==Uo?void 0:Uo.prompt,vn=(null==Uo?void 0:Uo.modename)||qo||"";null==Uo||Uo.citation_number;var hn=fn.split("\n").length;null!=be||(null===(T=null==Uo?void 0:Uo.sections)||void 0===T||T.length);var mn={startIndex:Xo,endIndex:oe},gn=[{label:"Strict Rules",content:ee},{label:"Input",content:ne},{label:"Output",content:le}].filter(function(o){return o.content}),yn=gn.length>0,xn=null!=He?He:Le,bn=null!=De?De:Le,kn=null!=Re?Re:Le,wn=null!=Je?Je:Le,Sn=function(e,n,l){var i,t,r,d,a,s;return{tooltip:{style:o(o({backgroundColor:l,color:"#ffffff",fontFamily:"Plus Jakarta Sans, sans-serif"},null==Be?void 0:Be.tooltip),e)},arrow:{style:o(o({color:null!==(s=null!==(d=null!==(t=null!==(i=null==n?void 0:n.color)&&void 0!==i?i:null==e?void 0:e.backgroundColor)&&void 0!==t?t:null===(r=null==Be?void 0:Be.tooltipArrow)||void 0===r?void 0:r.color)&&void 0!==d?d:null===(a=null==Be?void 0:Be.tooltip)||void 0===a?void 0:a.backgroundColor)&&void 0!==s?s:l},null==Be?void 0:Be.tooltipArrow),n)}}},Cn=e("div",o({style:o(o({display:"flex",gap:"2.5rem",borderTop:"1px solid #ebebeb",marginTop:"1rem",paddingTop:"1rem",fontSize:"0.875rem",fontWeight:"600",color:sn?"#e2e8f0":"#333",fontFamily:"Plus Jakarta Sans, sans-serif"},null==Be?void 0:Be.footer),null==Be?void 0:Be.previewStats)},{children:n("span",o({style:null==Be?void 0:Be.previewStatsItem},{children:["Total Lines: ",hn]}))}));d(function(){var o=Ye.current;o&&Ue(o.scrollHeight>o.clientHeight)},[un]);var In=function(){Qe(!1)},An=e(g,{startIndex:mn.startIndex,endIndex:mn.endIndex,language:"xml",editorHeight:"100%",editorWidth:"100%",code:fn,isHighlightingEnabled:!0,isDarkModeEnabled:sn,highlightCodeStatsLine:nn,setHighlightCodeStatsLine:ln,highlightCodeStatsVariable:rn,setHighlightCodeStatsVariable:dn,isExpanded:Ee||Ke,highlightIndexes:mn}),Tn=n(l,{children:[n("div",o({style:o({width:te?"50%":"100%",padding:"2rem 2.25rem",display:"flex",flexDirection:"column",overflowY:"auto",borderRight:te?"1px solid #ebebeb":"none",boxSizing:"border-box"},null==Be?void 0:Be.leftPanel)},{children:[n("div",o({style:{marginBottom:"1.25rem",display:"flex",alignItems:"center",gap:"0.75rem",flexWrap:"nowrap"}},{children:[e(b,o({title:e("span",o({style:o(o({},null==Be?void 0:Be.tooltipContent),null==Be?void 0:Be.titleTooltipContent)},{children:cn})),placement:"top",arrow:!0,componentsProps:Sn(o({fontSize:"0.75rem",maxWidth:320,padding:"6px 10px"},null==Be?void 0:Be.titleTooltip),null==Be?void 0:Be.titleTooltipArrow,sn?"#21262d":"#1a1a1a")},{children:n("span",o({style:o({fontWeight:"700",fontSize:"1.05rem",color:sn?"#ffffff":"#1a1a1a",fontFamily:"Plus Jakarta Sans, sans-serif",lineHeight:1.4,display:"flex",alignItems:"center",gap:"6px",minWidth:0,flexShrink:1},null==Be?void 0:Be.title)},{children:[null!=we?we:n("svg",o({width:null!==(P=null===(F=null==Be?void 0:Be.titleIcon)||void 0===F?void 0:F.width)&&void 0!==P?P:16,height:null!==(_=null===(W=null==Be?void 0:Be.titleIcon)||void 0===W?void 0:W.height)&&void 0!==_?_:16,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{color:null!==(z=null===(B=null==Be?void 0:Be.titleIcon)||void 0===B?void 0:B.color)&&void 0!==z?z:sn?"#ffffff":"#1a1a1a",flexShrink:0}},{children:[e("path",{d:"M4 6C4 4.895 4.895 4 6 4H14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),e("path",{d:"M4 6V18C4 19.105 4.895 20 6 20H18C19.105 20 20 19.105 20 18V10",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),e("line",{x1:"8",y1:"10",x2:"14",y2:"10",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),e("line",{x1:"8",y1:"13",x2:"11",y2:"13",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),e("line",{x1:"13",y1:"13",x2:"16",y2:"13",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),e("line",{x1:"8",y1:"16",x2:"14",y2:"16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),e("path",{d:"M19 1 L19.9 3.6 L22.5 4.5 L19.9 5.4 L19 8 L18.1 5.4 L15.5 4.5 L18.1 3.6 Z",fill:"currentColor"})]})),e("span",o({style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},{children:cn.length>28?"".concat(cn.slice(0,28),".."):cn}))]}))})),ce&&!fe&&n("span",o({style:{display:"inline-flex",alignItems:"center",gap:"4px",background:null!==(H=null===(L=null==Be?void 0:Be.fpbBadge)||void 0===L?void 0:L.backgroundColor)&&void 0!==H?H:sn?"#e2e8f0":"#1a1a1a",borderRadius:"5px",padding:"2px 8px",fontSize:"0.72rem",fontWeight:"700",color:null!==(R=null===(D=null==Be?void 0:Be.fpbBadge)||void 0===D?void 0:D.color)&&void 0!==R?R:sn?"#0d1117":"#ffffff",letterSpacing:"0.08em",fontFamily:"Plus Jakarta Sans, sans-serif",textTransform:"uppercase",flexShrink:0}},{children:["FPB",e(b,o({title:n("span",o({style:o(o({fontSize:"0.7rem",lineHeight:1.5,fontFamily:"Plus Jakarta Sans, sans-serif",color:null!==(M=null===(J=null==Be?void 0:Be.fpbTooltip)||void 0===J?void 0:J.color)&&void 0!==M?M:"#ffffff"},null==Be?void 0:Be.tooltipContent),null==Be?void 0:Be.fpbTooltipContent)},{children:[e("strong",{children:"FPB (Functional Prompt Block):"})," A group of related prompt sections designed to perform a specific function or capability within the overall system prompt."]})),placement:"top",arrow:!0,componentsProps:Sn(o({maxWidth:280,padding:"8px 12px"},null==Be?void 0:Be.fpbTooltip),null==Be?void 0:Be.fpbTooltipArrow,"#1a1a1a")},{children:e(c,{style:{fontSize:"0.85rem",color:null!==(j=null==Be?void 0:Be.fpbInfoIconColor)&&void 0!==j?j:sn?"#1a1a1acc":"#ffffffcc",cursor:"default"}})}))]})),fe&&n("span",o({style:{display:"inline-flex",alignItems:"center",gap:"4px",background:null!==(G=null===(E=null==Be?void 0:Be.spbBadge)||void 0===E?void 0:E.backgroundColor)&&void 0!==G?G:sn?"#e2e8f0":"#1a1a1a",borderRadius:"5px",padding:"2px 8px",fontSize:"0.72rem",fontWeight:"700",color:null!==(O=null===(N=null==Be?void 0:Be.spbBadge)||void 0===N?void 0:N.color)&&void 0!==O?O:sn?"#0d1117":"#ffffff",letterSpacing:"0.08em",fontFamily:"Plus Jakarta Sans, sans-serif",textTransform:"uppercase",flexShrink:0}},{children:["SPB",e(b,o({title:n("span",o({style:o(o({fontSize:"0.7rem",lineHeight:1.5,fontFamily:"Plus Jakarta Sans, sans-serif",color:null!==(V=null===(q=null==Be?void 0:Be.spbTooltip)||void 0===q?void 0:q.color)&&void 0!==V?V:"#ffffff"},null==Be?void 0:Be.tooltipContent),null==Be?void 0:Be.spbTooltipContent)},{children:[e("strong",{children:"SPB (Shippable Prompt Block) :"})," is a complete system-level prompt that defines the overall behavior, instructions, guidelines, and context an AI system should follow when responding to users."]})),placement:"top",arrow:!0,componentsProps:Sn(o({maxWidth:280,padding:"8px 12px"},null==Be?void 0:Be.spbTooltip),null==Be?void 0:Be.spbTooltipArrow,"#1a1a1a")},{children:e(c,{style:{fontSize:"0.85rem",color:null!==(U=null==Be?void 0:Be.spbInfoIconColor)&&void 0!==U?U:sn?"#1a1a1acc":"#ffffffcc",cursor:"default"}})}))]})),vn&&e("span",o({style:{fontSize:"0.72rem",color:"#666",background:"#f0f0f0",borderRadius:"4px",padding:"1px 6px"}},{children:vn})),me&&e("div",{style:{flex:1}}),me&&e(b,o({title:e("span",o({style:o(o({fontSize:"0.7rem",fontFamily:"Plus Jakarta Sans, sans-serif"},null==Be?void 0:Be.tooltipContent),null==Be?void 0:Be.dependencyGraphTooltipContent)},{children:"Open dependency graph"})),placement:"top",arrow:!0,componentsProps:Sn(o({padding:"5px 10px"},null==Be?void 0:Be.dependencyGraphTooltip),null==Be?void 0:Be.dependencyGraphTooltipArrow,sn?"#21262d":"#1a1a1a")},{children:n("button",o({onClick:function(o){o.stopPropagation(),null==ge||ge("show dependency graph")},style:o({display:"inline-flex",alignItems:"center",gap:"5px",padding:"4px 10px 4px 8px",borderRadius:"8px",border:"1px solid ".concat(sn?"#30363d":"#d0d7de"),background:sn?"#21262d":"#f6f8fa",color:sn?"#e2e8f0":"#24292f",fontSize:"0.78rem",fontWeight:"600",fontFamily:"Plus Jakarta Sans, sans-serif",cursor:"pointer",flexShrink:0,whiteSpace:"nowrap"},null==Be?void 0:Be.dependencyGraphButton)},{children:[null!=Se?Se:n("svg",o({xmlns:"http://www.w3.org/2000/svg",width:"12px",height:"12px",viewBox:"0 0 48 48",fill:"none"},{children:[e("path",{d:"M24 33V15",stroke:null!==(Y=null==Be?void 0:Be.dependencyGraphIconStroke)&&void 0!==Y?Y:"currentColor",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"}),e("rect",{x:"10",y:"9",width:"28",height:"6",fill:null!==(Z=null==Be?void 0:Be.dependencyGraphIconFill)&&void 0!==Z?Z:"#2F88FF",stroke:null!==(K=null==Be?void 0:Be.dependencyGraphIconStroke)&&void 0!==K?K:"currentColor",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"}),e("path",{d:"M8 32L14 25H33.9743L40 32",stroke:null!==(Q=null==Be?void 0:Be.dependencyGraphIconStroke)&&void 0!==Q?Q:"currentColor",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"}),e("rect",{x:"4",y:"33",width:"8",height:"8",fill:null!==(X=null==Be?void 0:Be.dependencyGraphIconFill)&&void 0!==X?X:"#2F88FF",stroke:null!==($=null==Be?void 0:Be.dependencyGraphIconStroke)&&void 0!==$?$:"currentColor",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"}),e("rect",{x:"20",y:"33",width:"8",height:"8",fill:null!==(oo=null==Be?void 0:Be.dependencyGraphIconFill)&&void 0!==oo?oo:"#2F88FF",stroke:null!==(eo=null==Be?void 0:Be.dependencyGraphIconStroke)&&void 0!==eo?eo:"currentColor",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"}),e("rect",{x:"36",y:"33",width:"8",height:"8",fill:null!==(no=null==Be?void 0:Be.dependencyGraphIconFill)&&void 0!==no?no:"#2F88FF",stroke:null!==(lo=null==Be?void 0:Be.dependencyGraphIconStroke)&&void 0!==lo?lo:"currentColor",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"})]})),"Graph",null!=Ce?Ce:n("svg",o({width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"},{children:[e("line",{x1:"5",y1:"12",x2:"19",y2:"12"}),e("polyline",{points:"12 5 19 12 12 19"})]}))]}))}))]})),un&&n("div",o({style:{border:"1px solid ".concat(null!==(to=null===(io=null==Be?void 0:Be.descriptionCard)||void 0===io?void 0:io.borderColor)&&void 0!==to?to:"transparent"),borderRadius:null!==(ao=null===(ro=null==Be?void 0:Be.descriptionCard)||void 0===ro?void 0:ro.borderRadius)&&void 0!==ao?ao:"8px",padding:null!==(po=null===(so=null==Be?void 0:Be.descriptionCard)||void 0===so?void 0:so.padding)&&void 0!==po?po:"14px 16px",backgroundColor:null!==(uo=null===(co=null==Be?void 0:Be.descriptionCard)||void 0===co?void 0:co.backgroundColor)&&void 0!==uo?uo:"transparent",marginBottom:"1.5rem"}},{children:[e("div",o({style:o({fontWeight:"700",fontSize:"0.95rem",fontFamily:"Plus Jakarta Sans, sans-serif",marginBottom:"8px",color:sn?"#ffffff":"#111827"},null==Be?void 0:Be.descriptionHeading)},{children:"Prompt Overview"})),n("div",o({style:{position:"relative"}},{children:[e("p",o({ref:Ye,style:o({fontSize:"0.875rem",lineHeight:"1.7",margin:0,fontFamily:"Plus Jakarta Sans, sans-serif",color:sn?"#c9d1d9":"#444",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:Ne?"unset":4,overflow:Ne?"visible":"hidden"},null==Be?void 0:Be.description)},{children:un})),Ve&&!Ne&&e("button",o({onClick:function(){return Oe(!0)},style:o({position:"absolute",bottom:0,right:0,background:"linear-gradient(to right, transparent, ".concat(sn?"#0d1117":"#ffffff"," 40%)"),border:"none",paddingLeft:"2rem",paddingRight:0,cursor:"pointer",fontSize:"0.875rem",fontWeight:"600",fontFamily:"Plus Jakarta Sans, sans-serif",color:sn?"#7dd3fc":"#2563eb",lineHeight:"1.7"},null==Be?void 0:Be.descriptionMoreButton)},{children:"...more"})),Ne&&e("button",o({onClick:function(){return Oe(!1)},style:o({background:"none",border:"none",padding:"2px 0 0",cursor:"pointer",fontSize:"0.875rem",fontWeight:"600",fontFamily:"Plus Jakarta Sans, sans-serif",color:sn?"#7dd3fc":"#2563eb",display:"block"},null==Be?void 0:Be.descriptionLessButton)},{children:"less"}))]}))]})),xe&&xe.length>0&&e("div",o({style:o({display:"flex",flexWrap:"wrap",borderTop:"1px solid ".concat(sn?"#ffffff18":"#1a1a1a18"),borderBottom:"1px solid ".concat(sn?"#ffffff18":"#1a1a1a18"),marginBottom:"1.5rem"},null==Be?void 0:Be.categoryRow)},{children:xe.map(function(l,t){return n(i.Fragment,{children:[t>0&&e("div",{style:o({width:"1px",alignSelf:"stretch",background:sn?"#ffffff18":"#1a1a1a18"},null==Be?void 0:Be.categoryDivider)}),n("div",o({style:o({flex:"1 1 120px",padding:"12px 16px"},null==Be?void 0:Be.categoryItem)},{children:[e("div",o({style:o({fontSize:"0.72rem",fontWeight:"500",fontFamily:"Plus Jakarta Sans, sans-serif",color:sn?"#8b949e":"#6b7280",marginBottom:"4px"},null==Be?void 0:Be.categoryLabel)},{children:l.label})),e("div",o({style:o({fontSize:"0.875rem",fontWeight:"600",fontFamily:"Plus Jakarta Sans, sans-serif",color:sn?"#e2e8f0":"#111827"},null==Be?void 0:Be.categoryValue)},{children:l.value}))]}))]},t)})})),""!==(null==Uo?void 0:Uo.when_to_apply)&&n(f,o({defaultExpanded:xn,style:o({marginBottom:"1rem",border:"1px solid ".concat(null!==(vo=null===(fo=null==Be?void 0:Be.whenToApplyAccordion)||void 0===fo?void 0:fo.borderColor)&&void 0!==vo?vo:sn?"#ffffff18":"#1a1a1a18"),borderRadius:"28px !important",boxShadow:"none",background:"transparent"},null==Be?void 0:Be.whenToApplyAccordion)},{children:[e(v,o({expandIcon:null!=Ae?Ae:e(m,{style:{color:null!==(ho=null==Be?void 0:Be.whenAccordionChevronColor)&&void 0!==ho?ho:sn?"#e2e8f0":"#374151"}}),style:o({minHeight:"36px",padding:"0 12px",background:"transparent"},null==Be?void 0:Be.whenToApplyHeader)},{children:n("div",o({style:{display:"flex",alignItems:"center",gap:"10px"}},{children:[e("span",o({style:o({display:"inline-flex",alignItems:"center",justifyContent:"center",width:"20px",height:"20px",borderRadius:"50%",border:"1.5px solid ".concat(null!==(mo=null==Be?void 0:Be.whenToApplyIconColor)&&void 0!==mo?mo:"#4ade80"),flexShrink:0},null==Be?void 0:Be.whenToApplyIconCircle)},{children:null!=Ie?Ie:e("svg",o({xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24"},{children:e("g",o({id:"Complete"},{children:e("g",o({id:"tick"},{children:e("polyline",{fill:"none",points:"3.7 14.3 9.6 19 20.3 5",stroke:null!==(go=null==Be?void 0:Be.whenToApplyIconColor)&&void 0!==go?go:"#4ade80",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"})}))}))}))})),e("span",o({style:o({fontWeight:"600",fontSize:"0.9rem",fontFamily:"Plus Jakarta Sans, sans-serif",color:sn?"#e2e8f0":"#111827"},null==Be?void 0:Be.whenToApplyTitle)},{children:"When to apply"}))]}))})),e(h,o({style:o({padding:"12px 16px",background:null!==(xo=null===(yo=null==Be?void 0:Be.whenToApplyContent)||void 0===yo?void 0:yo.backgroundColor)&&void 0!==xo?xo:sn?"#ffffff08":"#1a1a1a06"},null==Be?void 0:Be.whenToApplyContent)},{children:e(x,{message:null==Uo?void 0:Uo.when_to_apply,style:null==Be?void 0:Be.markdownRenderer,codeStyle:null==Be?void 0:Be.markdownCode,preStyle:null==Be?void 0:Be.markdownPre,blockquoteStyle:null==Be?void 0:Be.markdownBlockquote,syntaxHighlighterTheme:null==Be?void 0:Be.syntaxHighlighterTheme,cognitiveDecisioningStyles:null==Be?void 0:Be.cognitiveDecisioning})}))]})),""!==(null==Uo?void 0:Uo.when_not_to_apply)&&n(f,o({defaultExpanded:bn,style:o({marginBottom:"1rem",border:"1px solid ".concat(null!==(ko=null===(bo=null==Be?void 0:Be.whenNotToApplyAccordion)||void 0===bo?void 0:bo.borderColor)&&void 0!==ko?ko:sn?"#ffffff18":"#1a1a1a18"),borderRadius:"8px !important",boxShadow:"none",background:"transparent"},null==Be?void 0:Be.whenNotToApplyAccordion)},{children:[e(v,o({expandIcon:null!=Fe?Fe:e(m,{style:{color:null!==(wo=null==Be?void 0:Be.whenAccordionChevronColor)&&void 0!==wo?wo:sn?"#e2e8f0":"#374151"}}),style:o({minHeight:"36px",padding:"0 12px",background:"transparent"},null==Be?void 0:Be.whenNotToApplyHeader)},{children:n("div",o({style:{display:"flex",alignItems:"center",gap:"10px"}},{children:[e("span",o({style:o({display:"inline-flex",alignItems:"center",justifyContent:"center",width:"20px",height:"20px",borderRadius:"50%",border:"1.5px solid ".concat(null!==(So=null==Be?void 0:Be.whenNotToApplyIconColor)&&void 0!==So?So:"#f87171"),flexShrink:0},null==Be?void 0:Be.whenNotToApplyIconCircle)},{children:null!=Te?Te:e("svg",o({xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none"},{children:e("path",{d:"M19 5L5 19M5.00001 5L19 19",stroke:null!==(Co=null==Be?void 0:Be.whenNotToApplyIconColor)&&void 0!==Co?Co:"#f87171",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}))})),e("span",o({style:o({fontWeight:"600",fontSize:"0.9rem",fontFamily:"Plus Jakarta Sans, sans-serif",color:sn?"#e2e8f0":"#111827"},null==Be?void 0:Be.whenNotToApplyTitle)},{children:"When not to apply"}))]}))})),e(h,o({style:o({padding:"12px 16px",background:null!==(Ao=null===(Io=null==Be?void 0:Be.whenNotToApplyContent)||void 0===Io?void 0:Io.backgroundColor)&&void 0!==Ao?Ao:sn?"#ffffff08":"#1a1a1a06"},null==Be?void 0:Be.whenNotToApplyContent)},{children:e(x,{message:null==Uo?void 0:Uo.when_not_to_apply,style:null==Be?void 0:Be.markdownRenderer,codeStyle:null==Be?void 0:Be.markdownCode,preStyle:null==Be?void 0:Be.markdownPre,blockquoteStyle:null==Be?void 0:Be.markdownBlockquote,syntaxHighlighterTheme:null==Be?void 0:Be.syntaxHighlighterTheme,cognitiveDecisioningStyles:null==Be?void 0:Be.cognitiveDecisioning})}))]})),yn&&n(f,o({defaultExpanded:kn,style:o({marginBottom:"1rem",border:"1px solid ".concat(null!==(Fo=null===(To=null==Be?void 0:Be.specificationsSection)||void 0===To?void 0:To.borderColor)&&void 0!==Fo?Fo:sn?"#ffffff18":"#1a1a1a18"),borderRadius:"8px",boxShadow:"none",background:"transparent"},null==Be?void 0:Be.specificationsSection)},{children:[e(v,o({expandIcon:null!=_e?_e:e(m,{style:{color:null!==(Po=null==Be?void 0:Be.specificationsExpandIconColor)&&void 0!==Po?Po:sn?"#e2e8f0":"#374151"}}),style:{minHeight:"36px",padding:"0 12px",background:"transparent"}},{children:n("div",o({style:{display:"flex",alignItems:"center",gap:"10px"}},{children:[e("span",o({style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:"18px",height:"18px",borderRadius:"5px",flexShrink:0}},{children:null!=Pe?Pe:n("svg",o({xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"#ffffff"},{children:[e("rect",{x:"4.5",y:"3.5",width:"15",height:"17",rx:"1.5",stroke:"#ffffff","stroke-width":"1.7"}),e("path",{d:"M8 8H16",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"}),e("path",{d:"M8 11.5H16",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"}),e("path",{d:"M8 15H13.5",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"})]}))})),e("span",o({style:o({fontWeight:"600",fontSize:"0.9rem",fontFamily:"Plus Jakarta Sans, sans-serif",color:sn?"#e2e8f0":"#111827"},null==Be?void 0:Be.specificationsTitle)},{children:"Specifications"})),e(b,o({title:n("span",o({style:o(o({fontSize:"0.7rem",lineHeight:1.5,fontFamily:"Plus Jakarta Sans, sans-serif",color:null!==(_o=null===(Wo=null==Be?void 0:Be.specificationsTooltip)||void 0===Wo?void 0:Wo.color)&&void 0!==_o?_o:"#ffffff"},null==Be?void 0:Be.tooltipContent),null==Be?void 0:Be.specificationsTooltipContent)},{children:[e("strong",{children:"Specifications:"})," Specifications are the details that define a prompt’s guidelines, expected inputs, expected outputs, and constraints or rules."]})),placement:"top",arrow:!0,componentsProps:Sn(o({maxWidth:280,padding:"8px 12px"},null==Be?void 0:Be.specificationsTooltip),null==Be?void 0:Be.specificationsTooltipArrow,"#1a1a1a")},{children:e("span",{children:null!=We?We:e(c,{style:{fontSize:"0.95rem",color:sn?"#aaaaaa":"#666666",cursor:"default"}})})}))]}))})),e(h,o({style:o({padding:"12px 16px",background:null!==(zo=null===(Bo=null==Be?void 0:Be.specificationsDetails)||void 0===Bo?void 0:Bo.backgroundColor)&&void 0!==zo?zo:sn?"#ffffff08":"#1a1a1a06",display:"flex",flexDirection:"column",gap:"12px"},null==Be?void 0:Be.specificationsDetails)},{children:gn.map(function(l){var i=l.label,t=l.content;return n("div",{children:[e("div",o({style:o({fontSize:"0.72rem",fontWeight:"700",color:"#6B7280",textTransform:"uppercase",letterSpacing:"0.06em",marginBottom:"0.3rem",fontFamily:"Plus Jakarta Sans, sans-serif"},null==Be?void 0:Be.specificationsItemLabel)},{children:i})),e(x,{message:t,fontSize:"0.83rem",style:null==Be?void 0:Be.markdownRenderer,codeStyle:null==Be?void 0:Be.markdownCode,preStyle:null==Be?void 0:Be.markdownPre,blockquoteStyle:null==Be?void 0:Be.markdownBlockquote,syntaxHighlighterTheme:null==Be?void 0:Be.syntaxHighlighterTheme,cognitiveDecisioningStyles:null==Be?void 0:Be.cognitiveDecisioning})]},i)})}))]})),(null==Uo?void 0:Uo.sections)&&Uo.sections.length>0&&n("div",o({style:{marginBottom:"1.5rem",marginTop:"0.6rem"}},{children:[n("div",o({style:{display:"flex",alignItems:"center",gap:"5px",marginBottom:"0.6rem",marginTop:"0.4rem"}},{children:[e(S,o({style:o(o({},null==Be?void 0:Be.sectionLabel),{marginBottom:0})},{children:"APB's"})),e(b,o({title:n("span",o({style:o(o({fontSize:"0.7rem",lineHeight:1.5,fontFamily:"Plus Jakarta Sans, sans-serif",color:null!==(Ro=null!==(Ho=null===(Lo=null==Be?void 0:Be.apbTooltip)||void 0===Lo?void 0:Lo.color)&&void 0!==Ho?Ho:null===(Do=null==Be?void 0:Be.fpbTooltip)||void 0===Do?void 0:Do.color)&&void 0!==Ro?Ro:"#ffffff"},null==Be?void 0:Be.tooltipContent),null==Be?void 0:Be.apbTooltipContent)},{children:[e("strong",{children:"APB (Atomic Prompt Block):"})," A self-contained prompt unit that handles one specific instruction, rule, or behavior within a Functional Prompt Block."]})),placement:"top",arrow:!0,componentsProps:Sn(o({maxWidth:280,padding:"8px 12px"},null!==(Jo=null==Be?void 0:Be.apbTooltip)&&void 0!==Jo?Jo:null==Be?void 0:Be.fpbTooltip),null!==(Mo=null==Be?void 0:Be.apbTooltipArrow)&&void 0!==Mo?Mo:null==Be?void 0:Be.fpbTooltipArrow,"#1a1a1a")},{children:e(c,{style:{fontSize:"0.95rem",color:sn?"#aaaaaa":"#666666",cursor:"default"}})}))]})),e("div",o({style:{display:"flex",flexDirection:"column",gap:"6px"}},{children:Uo.sections.map(function(l){var i,t,r,d,a,s,p,c,u,f;return n("div",o({style:{border:"1px solid ".concat(null!==(t=null===(i=null==Be?void 0:Be.sectionItem)||void 0===i?void 0:i.borderColor)&&void 0!==t?t:sn?"#ffffff22":"#1a1a1a22"),borderRadius:"8px",padding:"10px 14px"}},{children:[n("div",o({onClick:function(){return null==ye?void 0:ye(l.title)},style:{fontSize:"0.83rem",fontWeight:"600",color:null!==(d=null===(r=null==Be?void 0:Be.sectionItem)||void 0===r?void 0:r.titleColor)&&void 0!==d?d:sn?"#e2e8f0":"#111827",fontFamily:"Plus Jakarta Sans, sans-serif",cursor:ye?"pointer":"default",marginBottom:"4px",display:"inline-flex",alignItems:"center",gap:"5px"}},{children:[n("span",o({style:{fontSize:"0.68rem",fontWeight:"700",color:null!==(s=null===(a=null==Be?void 0:Be.sectionItem)||void 0===a?void 0:a.orderColor)&&void 0!==s?s:sn?"#6e7681":"#9CA3AF",fontFamily:"Plus Jakarta Sans, sans-serif",minWidth:"16px",flexShrink:0}},{children:[l.order,"."]})),e("span",o({style:{textDecoration:ye?"underline":"none",textDecorationColor:null!==(c=null===(p=null==Be?void 0:Be.sectionItem)||void 0===p?void 0:p.titleColor)&&void 0!==c?c:sn?"#e2e8f0":"#111827",textUnderlineOffset:"3px"}},{children:l.title})),ye&&n("svg",o({xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0,opacity:.5}},{children:[e("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),e("polyline",{points:"15 3 21 3 21 9"}),e("line",{x1:"10",y1:"14",x2:"21",y2:"3"})]}))]})),e("div",o({style:{fontSize:"0.76rem",color:null!==(f=null===(u=null==Be?void 0:Be.sectionItem)||void 0===u?void 0:u.descriptionColor)&&void 0!==f?f:sn?"#8b949e":"#6B7280",fontFamily:"Plus Jakarta Sans, sans-serif",lineHeight:1.55,paddingLeft:"22px"}},{children:l.description}))]}),l.order)})}))]})),ve&&n(f,o({defaultExpanded:wn,style:o({marginBottom:"1rem",marginTop:"0.6rem",border:"1px solid ".concat(null!==(Eo=null===(jo=null==Be?void 0:Be.spbSection)||void 0===jo?void 0:jo.borderColor)&&void 0!==Eo?Eo:sn?"#ffffff18":"#1a1a1a18"),borderRadius:"8px",boxShadow:"none",background:"transparent"},null==Be?void 0:Be.spbSection)},{children:[e(v,o({expandIcon:e(m,{style:{color:null!==(Go=null==Be?void 0:Be.spbChevronColor)&&void 0!==Go?Go:sn?"#e2e8f0":"#374151"}}),style:o({minHeight:"36px",padding:"0 12px",background:"transparent"},null==Be?void 0:Be.spbSectionHeader)},{children:n("div",o({style:{display:"flex",alignItems:"center",gap:"8px"}},{children:[n("span",o({style:o({fontWeight:"600",fontSize:"0.9rem",fontFamily:"Plus Jakarta Sans, sans-serif",color:sn?"#e2e8f0":"#111827"},null==Be?void 0:Be.spbSectionTitle)},{children:["SPB Functionalities (",ve.total_functionalities,")"]})),e("span",o({style:{color:sn?"#6e7681":"#9CA3AF",fontSize:"0.75rem"}},{children:"•"})),n("span",o({style:{fontSize:"0.78rem",fontWeight:"500",color:sn?"#6e7681":"#9CA3AF",fontFamily:"Plus Jakarta Sans, sans-serif"}},{children:[ve.total_apbs_identified," APBs"]}))]}))})),e(h,o({style:o({padding:"10px 12px",background:null!==(Oo=null===(No=null==Be?void 0:Be.spbSectionContent)||void 0===No?void 0:No.backgroundColor)&&void 0!==Oo?Oo:"transparent",display:"flex",flexDirection:"column",gap:"8px"},null==Be?void 0:Be.spbSectionContent)},{children:ve.functionality_analysis.map(function(l,i){var t,r,d,a,s,p,c,u,f;return n("div",o({style:o({border:"1px solid ".concat(null!==(r=null===(t=null==Be?void 0:Be.spbFunctionalityItem)||void 0===t?void 0:t.borderColor)&&void 0!==r?r:sn?"#ffffff14":"#1a1a1a14"),borderRadius:"10px",overflow:"hidden",padding:"4px",background:null!==(a=null===(d=null==Be?void 0:Be.spbFunctionalityItem)||void 0===d?void 0:d.backgroundColor)&&void 0!==a?a:sn?"#ffffff04":"#1a1a1a03"},null==Be?void 0:Be.spbFunctionalityItem)},{children:[n("div",o({style:o({padding:"12px 14px",borderRadius:"12px",background:null!==(p=null===(s=null==Be?void 0:Be.spbFunctionalityItemInner)||void 0===s?void 0:s.backgroundColor)&&void 0!==p?p:sn?"#ffffff08":"#1a1a1a07",borderBottom:"1px solid ".concat(null!==(u=null===(c=null==Be?void 0:Be.spbFunctionalityItemInner)||void 0===c?void 0:c.borderColor)&&void 0!==u?u:sn?"#ffffff10":"#1a1a1a10")},null==Be?void 0:Be.spbFunctionalityItemInner)},{children:[n("div",o({style:o({fontSize:"0.85rem",fontWeight:"700",color:sn?"#e2e8f0":"#111827",fontFamily:"Plus Jakarta Sans, sans-serif",marginBottom:"6px",lineHeight:1.4},null==Be?void 0:Be.spbFunctionalityItemName)},{children:[i+1,". ",l.name]})),e(x,{message:l.description,fontSize:"0.78rem",style:o({lineHeight:1.6,color:sn?"#8b949e":"#6B7280"},null!==(f=null==Be?void 0:Be.spbFunctionalityItemDescription)&&void 0!==f?f:{}),codeStyle:null==Be?void 0:Be.markdownCode,preStyle:null==Be?void 0:Be.markdownPre,blockquoteStyle:null==Be?void 0:Be.markdownBlockquote,syntaxHighlighterTheme:null==Be?void 0:Be.syntaxHighlighterTheme,cognitiveDecisioningStyles:null==Be?void 0:Be.cognitiveDecisioning})]})),l.apb_references&&l.apb_references.length>0&&n("div",o({style:o({display:"flex",alignItems:"center",flexWrap:"wrap",gap:"6px",padding:"8px 14px"},null==Be?void 0:Be.spbApbReferencesRow)},{children:[e("span",o({style:o({fontSize:"0.68rem",fontWeight:"500",color:sn?"#6e7681":"#9CA3AF",fontFamily:"Plus Jakarta Sans, sans-serif",flexShrink:0},null==Be?void 0:Be.spbApbReferencesLabel)},{children:"apb references:"})),l.apb_references.map(function(n,l){var i,t,r,d,a,s;return e(b,o({title:e("span",o({style:o(o({fontSize:"0.7rem",lineHeight:1.5,fontFamily:"Plus Jakarta Sans, sans-serif",color:null!==(d=null!==(t=null===(i=null==Be?void 0:Be.spbApbReferenceTooltip)||void 0===i?void 0:i.color)&&void 0!==t?t:null===(r=null==Be?void 0:Be.spbTooltip)||void 0===r?void 0:r.color)&&void 0!==d?d:"#ffffff"},null==Be?void 0:Be.tooltipContent),null==Be?void 0:Be.spbApbReferenceTooltipContent)},{children:n.context})),placement:"top",arrow:!0,componentsProps:Sn(o({maxWidth:240,padding:"6px 10px"},null!==(a=null==Be?void 0:Be.spbApbReferenceTooltip)&&void 0!==a?a:null==Be?void 0:Be.spbTooltip),null!==(s=null==Be?void 0:Be.spbApbReferenceTooltipArrow)&&void 0!==s?s:null==Be?void 0:Be.spbTooltipArrow,"#1a1a1a")},{children:e("span",o({style:o({display:"inline-flex",alignItems:"center",fontSize:"0.7rem",fontWeight:"500",fontFamily:"Plus Jakarta Sans, sans-serif",padding:"3px 10px",borderRadius:"6px",background:sn?"#ffffff0d":"#1a1a1a08",color:sn?"#c9d1d9":"#374151",cursor:"default",border:"1px solid ".concat(sn?"#ffffff18":"#1a1a1a14")},null==Be?void 0:Be.spbApbReference)},{children:e("span",o({style:o({},null==Be?void 0:Be.spbApbReferenceLabel)},{children:n.apb_name}))}))}),l)})]}))]}),i)})}))]})),!te&&n(l,{children:[e("div",{style:{flex:1}}),Cn]})]})),te&&n("div",o({style:o({width:"50%",padding:"1.75rem",display:"flex",flexDirection:"column",overflow:"hidden",boxSizing:"border-box"},null==Be?void 0:Be.rightPanel)},{children:[e("div",o({style:{fontWeight:"700",fontSize:"1rem",marginBottom:"1rem",color:"#1a1a1a",fontFamily:"Plus Jakarta Sans, sans-serif"}},{children:"Prompt Preview"})),e("div",o({style:{flex:1,border:"1px solid #e0e0e0",borderRadius:"0.875rem",overflow:"hidden",minHeight:0}},{children:An})),Cn]}))]});return n("div",o({style:null==Be?void 0:Be.root},{children:[se?e("div",o({style:o({display:"flex",width:"100%",fontFamily:"Plus Jakarta Sans, sans-serif",overflow:"hidden"},null==Be?void 0:Be.dialog)},{children:Tn})):n(a,o({open:Ke||de,onClose:In,maxWidth:"xl",fullWidth:!0,PaperProps:{style:o({borderRadius:"1rem",fontFamily:"Plus Jakarta Sans, sans-serif",height:"90vh",maxHeight:"90vh",overflow:"hidden"},null==Be?void 0:Be.dialog)}},{children:[e(p,o({onClick:In,size:"small",style:{position:"absolute",top:10,right:12,zIndex:20}},{children:e(u,{fontSize:"small"})})),e(s,o({style:{padding:0,display:"flex",height:"100%",overflow:"hidden"}},{children:Tn}))]})),$e&&(null==Uo?void 0:Uo.dependency_graph)&&n(a,o({open:$e,onClose:function(){return on(!1)},maxWidth:"xl",fullWidth:!0,PaperProps:{style:o({borderRadius:"1rem",height:"90vh",maxHeight:"90vh",overflow:"hidden"},null==Be?void 0:Be.graphDialog)}},{children:[e(p,o({onClick:function(){return on(!1)},size:"small",style:{position:"absolute",top:10,right:12,zIndex:20}},{children:e(u,{fontSize:"small"})})),e(s,o({style:{padding:"1rem",height:"100%",overflow:"hidden",boxSizing:"border-box"}},{children:e(k,{data:w(Uo.dependency_graph),isDarkMode:sn})}))]}))]}))};export{w as convertDependencyGraphData,C as default};
2
+ //# sourceMappingURL=PromptCitation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PromptCitation.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ import{__assign as e}from"tslib";import{jsx as n,jsxs as t,Fragment as i}from"react/jsx-runtime";import{useRef as r,useMemo as o,useState as a,useEffect as l,useCallback as d}from"react";import{generateClassName as u,cssPropertiesToString as s,getClassNameFromDiagnostic as c}from"../../../utils/codeCitations.utils.js";var g;!function(e){e[e.Error=0]="Error",e[e.Warning=1]="Warning",e[e.Information=2]="Information",e[e.Hint=3]="Hint"}(g||(g={}));var v=function(g){var v=g.startIndex,h=g.endIndex,f=g.language,m=g.editorHeight,p=g.editorWidth,x=g.code,I=g.isHighlightingEnabled,y=g.isDarkModeEnabled,S=g.openHighlightedCodeDetails,b=g.highlightCodeStatsLine;g.setHighlightCodeStatsLine;var C=g.highlightCodeStatsVariable;g.setHighlightCodeStatsVariable,g.setHighlightIndexes;var L=g.isExpanded,R=g.highlightIndexes,w=g.diagnostics,O=g.diagnosticStylesBySeverity,j=r(null),D=r([]);r([]);var H=r([]),k=r([]),E=o(function(){return v},[v]),M=o(function(){return h},[h]),N=a(null),V=N[0],W=N[1],z=a(null),A=z[0],F=z[1],T=a(null),q=T[0],_=T[1],B=a(void 0),J=B[0],P=B[1],G=a(null),K=G[0],Q=G[1];l(function(){Promise.all([import("@monaco-editor/react"),import("highlight.js/lib/core")]).then(function(e){var n=e[0],t=e[1];_(function(){return n.default});var i=t.default.highlightAuto(x).language;P(i)}).catch(function(){Q("Code editor dependencies not installed. Run: npm install @monaco-editor/react highlight.js")})},[x]);var U=o(function(){return O&&"object"==typeof O&&Object.entries(O).map(function(e){var n=e[0],t=e[1],i=[];return t.style&&i.push(".".concat(u(t.style,+n,!0)," {\n").concat(s(t.style),"\n}")),t.lightModeStyle&&i.push(".".concat(u(t.lightModeStyle,+n,!1)," {\n").concat(s(t.lightModeStyle),"\n}")),i.join("\n")}).join("\n")},[O]);l(function(){return function(){var e;(null===(e=j.current)||void 0===e?void 0:e._resizeObserver)&&j.current._resizeObserver.disconnect()}},[]),l(function(){if(I&&V&&j.current&&A){var e=V.start,n=V.end;if(X(j.current,e,n,b,C),-1===v&&w&&w.length>0){var t=w[0].range,i=t.lineStart,r=t.lineEnd;X(j.current,i,r,b,C)}}},[V,A,I,b,C]),l(function(){var e,n,t;if(A&&j.current&&I){var i=j.current;if(R&&(null===(e=Object.keys(R))||void 0===e?void 0:e.length)>0&&-1!==(null==R?void 0:R.startIndex)&&-1!==(null==R?void 0:R.endIndex)){var r=i.deltaDecorations(D.current,[{range:new A.Range(R.startIndex,1,R.endIndex,1),options:{isWholeLine:!0,className:"myLineHighlight"}}]);D.current=r}if(b&&(null===(n=Object.keys(b))||void 0===n?void 0:n.length)>0&&-1!==(null==b?void 0:b.startIndex)&&-1!==(null==b?void 0:b.endIndex)&&(null==b?void 0:b.name)){r=i.deltaDecorations(D.current,[{range:new A.Range(b.startIndex,1,b.endIndex,1),options:{isWholeLine:!0,className:"myLineHighlight"}}]);D.current=r}if(C&&(null===(t=Object.keys(C))||void 0===t?void 0:t.length)>0&&-1!==(null==C?void 0:C.startIndex)&&-1!==(null==C?void 0:C.endIndex)&&(null==b?void 0:b.name)){r=i.deltaDecorations(H.current,[{range:new A.Range(C.startIndex,1,C.endIndex,1),options:{isWholeLine:!0,className:"myLineHighlight"}}]);H.current=r}}},[v,h,I,A,b,JSON.stringify(C)]),l(function(){if(A&&j.current&&(null==w?void 0:w.length)&&O){var e=j.current,n=w.map(function(e){var n,t,i=c(e.severity,null==y||y,O);return{range:new A.Range(e.range.lineStart,null!==(n=e.range.columnStart)&&void 0!==n?n:1,e.range.lineEnd,null!==(t=e.range.columnEnd)&&void 0!==t?t:1),options:{className:i,isWholeLine:void 0===e.range.columnStart}}});k.current=e.deltaDecorations(k.current,n)}},[w,O,A,y]);var X=d(function(e,n,t,i,r){var o,a;if(A&&e&&I){var l=e.getModel();l&&(n=Math.max(-1,n),(t=Math.min(t,l.getLineCount()))<n&&(t=n),requestAnimationFrame(function(){e.revealRangeInCenterIfOutsideViewport(new A.Range(n,1,t,1),A.editor.ScrollType.Smooth),e.setSelection(new A.Range(n,1,t+1,1))}),i&&-1!==(null==i?void 0:i.startIndex)&&-1!==(null==i?void 0:i.endIndex)&&requestAnimationFrame(function(){e.revealRangeInCenterIfOutsideViewport(new A.Range(i.startIndex,1,i.endIndex,1),A.editor.ScrollType.Smooth),e.setSelection(new A.Range(i.startIndex,1,i.endIndex+1,1))}),0===(null===(o=Object.keys(r))||void 0===o?void 0:o.length)&&e.getContribution("editor.contrib.findController").getState().change({isRevealed:!1},!1),(null===(a=Object.keys(r))||void 0===a?void 0:a.length)>0&&(requestAnimationFrame(function(){e.revealRangeInCenterIfOutsideViewport(new A.Range(r.startIndex,1,r.endIndex,1),A.editor.ScrollType.Smooth),e.setSelection(new A.Range(r.startIndex,1,r.endIndex+1,1))}),e.trigger("keyboard","actions.find"),e.getAction("actions.find").run(),e.getContribution("editor.contrib.findController").getState().change({searchString:(null==r?void 0:r.variableName)||"",isRevealed:!0},!1)))}},[A,I,v,h,null==b?void 0:b.startIndex,null==b?void 0:b.endIndex,C]);l(function(){if(j.current&&A&&I){var e=j.current,n=e.onDidLayoutChange(function(){if(X(e,v,h,b,C),-1===v&&w&&w.length>0){var n=w[0].range,t=n.lineStart,i=n.lineEnd;X(e,t,i,b,C)}});return function(){return n.dispose()}}},[X,v,h,I,null==b?void 0:b.startIndex,null==b?void 0:b.endIndex,C,L]);var Y=d(function(e,n){X(e,E,M),j.current=e,F(n),W({start:E,end:M});var t=e.getContainerDomNode(),i=new ResizeObserver(function(){e.layout()});if(i.observe(t),j.current._resizeObserver=i,I){var r=e.getDomNode(),o=document.createElement("div");null==r||r.appendChild(o);var a=function(){var n=e.getTopForLineNumber(E)-e.getScrollTop();o.style.top="".concat(n,"px")};e.onDidScrollChange(a),a()}},[v,h,I,S]);return K?n("div",e({style:{color:"red",fontSize:"12px",padding:"8px"}},{children:K})):q?t(i,{children:[n(q,{height:m,width:p,defaultLanguage:J||f,defaultValue:x,theme:y?"vs-dark":"vs-light",onMount:Y,beforeMount:function(e){e.languages.typescript.javascriptDefaults.setDiagnosticsOptions({noSemanticValidation:!0,noSyntaxValidation:!0})},options:{minimap:{enabled:!1},overviewRulerLanes:3,fontFamily:"Plus Jakarta Sans, sans-serif",scrollBeyondLastLine:!1,readOnly:!0,smoothScrolling:!0,automaticLayout:!0,lineDecorationsWidth:10,padding:{top:20,bottom:20}}}),t("style",{children:[U,".myLineHighlight { background-color: rgba(0, 122, 204, 0.3); }"]})]}):n("div",e({style:{padding:"8px",color:"#666"}},{children:"Loading code editor..."}))};export{g as DiagnosticSeverity,v as default};
2
+ //# sourceMappingURL=CodeEditor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CodeEditor.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ import{__rest as e,__assign as n,__awaiter as r,__generator as o}from"tslib";import{jsx as i,jsxs as t,Fragment as a}from"react/jsx-runtime";import l,{useState as d,useMemo as c,useRef as s,useEffect as u}from"react";import p from"react-markdown";import f from"rehype-raw";import{Tooltip as g,Box as h}from"@mui/material";import{Prism as v}from"react-syntax-highlighter";import{oneLight as m}from"react-syntax-highlighter/dist/esm/styles/prism";import{Check as y,ContentCopy as b,ExpandLess as x,ExpandMore as _}from"@mui/icons-material";import S from"@mui/icons-material/ExpandMoreOutlined";var k=function(e){var n,r,o;void 0===e&&(e="");var i=null==e?void 0:e.replace(/\\`/g,"`");return i=null==(i=null==(i=null===(o=null==(i=null===(r=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===r?void 0:r.trim())?void 0:i.replace(/^```/,""))||void 0===o?void 0:o.replace(/```$/,""))?void 0:i.replace(/<\/summary>/g,"</summary>\n"))?void 0:i.replace(/<details>/g,"\n<details>")},w=function(e){var a=e.text,l=d(!1),c=l[0],s=l[1];return t("button",n({onClick:function(){return r(void 0,void 0,void 0,function(){return o(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:[i(c?y:b,{style:{fontSize:13}}),c?"Copied":"Copy"]}))},z=function(r){r.node;var o=e(r,["node"]),a=d(!1),c=a[0],p=a[1],f=s(null),g=l.Children.toArray(o.children),h=g.find(function(e){var n;return null===(n=null==e?void 0:e.props)||void 0===n?void 0:n["data-codebase-name"]}),v=!!h,m=v?h.props["data-codebase-name"]:"",y=g.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(),b=v?"From ".concat(m," codebase"):y||"Accordion title not found";return u(function(){var e,n=null===(e=f.current)||void 0===e?void 0:e.parentElement;if(n){var r=function(){return p(n.open)};return r(),n.addEventListener("toggle",r),function(){return n.removeEventListener("toggle",r)}}},[]),t("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:[i("span",{children:b}),i("div",n({style:{display:"flex",alignItems:"center",flexShrink:0,color:"#6932E2"}},{children:i(c?x:_,{sx:{fontSize:"1.1rem"}})}))]}))},M=function(r){var o,s=r.message,u=r.fontSize,y=r.extraMetaData,b=r.style,x=r.codeStyle,_=r.preStyle,M=r.blockquoteStyle,C=r.syntaxHighlighterTheme,R=r.cognitiveDecisioningStyles,W=null!=u?u:"0.88rem",E=null!==(o=null==b?void 0:b.color)&&void 0!==o?o:"#1f2937",H=d({open:!1,data:null,activeKey:null}),T=H[0],L=H[1],K=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,r){try{var o=JSON.parse(r.trim()),i=o.id||"reasoning_".concat(Object.keys(n).length);return n[i]=o,'<aireasoning data-reasoning-key="'.concat(i,'">').concat(i,"</aireasoning>")}catch(e){return console.warn("[ai_reasoning] Failed to parse block:",e),""}}),reasoningMap:n}}(s||"");return{processedMessage:e.processed,inlineReasoningMap:e.reasoningMap}},[s]),j=K.processedMessage,B=K.inlineReasoningMap,F=c(function(){return{aireasoning:function(r){r.node;var o=e(r,["node"])["data-reasoning-key"],a=B[o];if(!a)return null;var l=T.open&&T.activeKey===o;return i("div",n({style:{margin:"6px 0"}},{children:t("span",n({onClick:function(e){e.stopPropagation();var n=function(e){var n,r,o,i,t,a,l,d=[];return(null!==(r=null===(n=e.aiReasoningCitation)||void 0===n?void 0:n.gpt_citation)&&void 0!==r?r:[]).forEach(function(e){var n,r,o,i,t,a,l,c,s,u,p,f=null!==(r=null===(n=e.customMetadata)||void 0===n?void 0:n.data_sources)&&void 0!==r?r:[],g=null!==(i=null===(o=e.customMetadata)||void 0===o?void 0:o.training_data_title)&&void 0!==i?i:[],h=null!==(a=null===(t=e.customMetadata)||void 0===t?void 0:t.paraphrase)&&void 0!==a?a:[],v=null===(l=f[0])||void 0===l?void 0:l.match(/<highlight>([\s\S]*?)<\/highlight>/),m=v?v[1].trim():null!==(c=f[0])&&void 0!==c?c:"";d.push({citation_number:Number(e.citation_number),section_ref:null!==(s=g[0])&&void 0!==s?s:"",training_data_title:null!==(u=g[0])&&void 0!==u?u:"",paraphrase:null!==(p=h[0])&&void 0!==p?p:"",data_sources:f,highlight:m})}),{block_cognitive_reasoning_html:null!==(i=null!==(o=e.Reasoning)&&void 0!==o?o:e.reasoning)&&void 0!==i?i:"",block_cognitive_gap_html:null!==(t=e.Gap)&&void 0!==t?t:"",block_cognitive_confidence:Number(null!==(l=null!==(a=e.Confidence_score)&&void 0!==a?a:e.decision_strength)&&void 0!==l?l:0),block_cognitive_citations:d}}(a);L(function(e){return e.open&&e.activeKey===o?{open:!1,data:null,activeKey:null}:{open:!0,data:n,activeKey:o}})},style:{display:"inline-flex",alignItems:"center",gap:6,cursor:"pointer",color:"#6932E2",fontWeight:500,fontSize:W,transition:"all 0.2s",padding:"2px 0"}},{children:[i("span",{children:o}),i("span",n({style:{display:"inline-flex",alignItems:"center",gap:2,border:"1px solid #e2e8f0",borderRadius:5,padding:"4px 2px"}},{children:i(S,{sx:{fontSize:"1rem",color:"#475569",transform:l?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s"}})}))]}))}))},codebasename:function(e){var r=e.children,o=("string"==typeof r[0]?r[0]:"").trim();return""!==o?t("div",n({"data-codebase-name":o,style:{position:"relative",margin:"12px 0"}},{children:[i(w,{text:String(r).replace(/\n$/,"")}),i(v,n({style:null!=C?C:m,language:"json",PreTag:"div",customStyle:n({borderRadius:8,padding:"1rem",fontSize:"0.8rem",border:"1px solid #e5e7eb",margin:0,lineHeight:1.6},_)},{children:String(r).replace(/\n$/,"")}))]})):i(a,{})},details:function(r){r.node;var o=e(r,["node"]);return i("details",n({},o,{style:{borderRadius:8,border:"1px solid #e9e5f5",backgroundColor:"transparent",margin:"8px 0",overflow:"hidden"}},{children:o.children}))},summary:z,p:function(r){r.node;var o=e(r,["node"]);return i("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:E}},{children:null==o?void 0:o.children}))},strong:function(r){r.node;var o=e(r,["node"]);return i("strong",n({style:{fontWeight:650,color:E}},{children:null==o?void 0:o.children}))},h1:function(r){r.node;var o=e(r,["node"]);return i("h1",n({style:{fontSize:"1.35rem",fontWeight:700,color:E,margin:"20px 0 8px",lineHeight:1.3,letterSpacing:"-0.01em"}},{children:o.children}))},h2:function(r){r.node;var o=e(r,["node"]);return i("h2",n({style:{fontSize:"1.15rem",fontWeight:650,color:E,margin:"16px 0 6px",lineHeight:1.35}},{children:o.children}))},h3:function(r){r.node;var o=e(r,["node"]);return i("h3",n({style:{fontSize:"1rem",fontWeight:600,color:E,margin:"14px 0 4px",lineHeight:1.4}},{children:o.children}))},h4:function(r){r.node;var o=e(r,["node"]);return i("h4",n({style:{fontSize:"0.92rem",fontWeight:600,color:E,margin:"12px 0 4px",lineHeight:1.4}},{children:o.children}))},ol:function(r){r.node;var o=e(r,["node"]);return i("ol",n({style:{listStyleType:"decimal",marginLeft:20,paddingLeft:4,display:"flex",flexDirection:"column",gap:2}},{children:null==o?void 0:o.children}))},ul:function(r){r.node;var o=e(r,["node"]);return i("ul",n({style:{listStyleType:"disc",marginLeft:20,paddingLeft:4,display:"flex",flexDirection:"column",gap:2}},{children:null==o?void 0:o.children}))},li:function(r){r.node;var o=e(r,["node"]);return i("li",n({style:{fontSize:W,lineHeight:1.7,color:E,paddingLeft:4}},{children:o.children}))},blockquote:function(r){r.node;var o=e(r,["node"]);return i("blockquote",n({style:n({margin:"12px 0",padding:"8px 16px",borderLeft:"3px solid #8b5cf6",background:"#faf5ff",borderRadius:"0 6px 6px 0",color:E,fontStyle:"italic",fontSize:W,lineHeight:1.65},M)},{children:o.children}))},hr:function(){return i("hr",{style:{border:"none",height:1,background:"linear-gradient(to right, transparent, #d1d5db, transparent)",margin:"16px 0"}})},table:function(r){r.node;var o=e(r,["node"]);return i("div",n({style:{overflowX:"auto",margin:"12px 0",borderRadius:8,border:"1px solid #e5e7eb"}},{children:i("table",n({style:{width:"100%",borderCollapse:"collapse",fontSize:"0.8rem",lineHeight:1.5}},{children:o.children}))}))},thead:function(r){r.node;var o=e(r,["node"]);return i("thead",n({style:{background:"#f9fafb",borderBottom:"2px solid #e5e7eb"}},{children:o.children}))},th:function(r){r.node;var o=e(r,["node"]);return i("th",n({style:{padding:"8px 12px",textAlign:"left",fontWeight:600,fontSize:"0.76rem",color:E,whiteSpace:"nowrap"}},{children:o.children}))},td:function(r){r.node;var o=e(r,["node"]);return i("td",n({style:{padding:"8px 12px",borderTop:"1px solid #f3f4f6",color:E,fontSize:"0.8rem"}},{children:o.children}))},a:function(r){var o=r.children;r.node;var l=e(r,["children","node"]),d=l["data-cognitive-reasoning"];if(d&&(null==y?void 0:y[d])){var c=T.open&&T.activeKey===d;return i(a,{children:t("span",n({onClick:function(e){e.stopPropagation();var n=function(e){var n,r,o,i,t;if(!e)return null;var a=[];return(null!==(r=null===(n=e.aiReasoningCitation)||void 0===n?void 0:n.gpt_citation)&&void 0!==r?r:[]).forEach(function(e){var n,r,o,i,t,l,d,c,s,u,p,f=null!==(r=null===(n=e.customMetadata)||void 0===n?void 0:n.data_sources)&&void 0!==r?r:[],g=null!==(i=null===(o=e.customMetadata)||void 0===o?void 0:o.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:[],v=null===(d=f[0])||void 0===d?void 0:d.match(/<highlight>([\s\S]*?)<\/highlight>/),m=v?v[1].trim():null!==(c=f[0])&&void 0!==c?c:"";a.push({citation_number:Number(e.citation_number),section_ref:null!==(s=g[0])&&void 0!==s?s:"",training_data_title:null!==(u=g[0])&&void 0!==u?u:"",paraphrase:null!==(p=h[0])&&void 0!==p?p:"",data_sources:f,highlight:m})}),{block_cognitive_reasoning_html:null!==(o=e.Reasoning)&&void 0!==o?o:"",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}}(y[d]);L(function(e){return e.open&&e.activeKey===d?{open:!1,data:null,activeKey:null}:{open:!0,data:n,activeKey:d}})},style:{color:"#6932E2",fontWeight:500,cursor:"pointer",transition:"all 0.2s",padding:"0 2px",position:"relative",display:"inline-flex",alignItems:"center",gap:6}},{children:[o||"",i("span",n({style:{cursor:"pointer",padding:"4px 2px",display:"inline-flex",alignItems:"center",gap:2,border:"1px solid #e2e8f0",borderRadius:"5px"}},{children:i(S,{sx:{fontSize:"1rem",color:"#475569",transform:c?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s"}})}))]}))})}var s=!1;try{s=new URL(null==l?void 0:l.href).protocol.startsWith("http")}catch(e){s=!1}return s?i("a",n({href:null==l?void 0:l.href,style:{color:"#6932E2",textDecoration:"none",fontWeight:500,borderBottom:"1px solid #c4b5fd",transition:"border-color 0.2s, color 0.2s"},target:"_blank",rel:"noopener noreferrer",onMouseEnter:function(e){e.currentTarget.style.borderBottomColor="#6932E2"},onMouseLeave:function(e){e.currentTarget.style.borderBottomColor="#c4b5fd"}},{children:o})):i("span",{children:o})},sup:function(r){r.node;var o=e(r,["node"]);return i(g,n({title:o.children,placement:"top",arrow:!0},{children:i(h,n({component:"span",sx:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:16,height:16,borderRadius:"50%",background:"#ede9fe",color:"#7c3aed",fontSize:"0.6rem",fontWeight:700,verticalAlign:"super",cursor:"pointer",userSelect:"none",lineHeight:1,transition:"all 0.2s","&:hover":{background:"#7c3aed",color:"#fff"}},"aria-label":"Info",role:"button"},{children:"i"}))}))},code:function(e){var r=e.children;return i("code",n({style:n({fontFamily:"'JetBrains Mono', 'Fira Code', 'SF Mono', Menlo, monospace",fontSize:"0.82em",color:"#9333ea",background:"#faf5ff",padding:"1.5px 5px",borderRadius:4,border:"1px solid #f3e8ff",fontWeight:500},x)},{children:r}))},pre:function(e){var r=e.children,o=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(o).join(""):""},a=l.Children.toArray(r).map(o).join("");return t("div",n({style:{position:"relative",margin:"12px 0"}},{children:[i(w,{text:a}),i("pre",n({style:n({fontFamily:"'JetBrains Mono', 'Fira Code', 'SF Mono', Menlo, monospace",fontSize:"0.8rem",lineHeight:1.6,color:"#1f2937",background:"#f9fafb",border:"1px solid #e5e7eb",borderRadius:8,padding:"14px 16px",margin:0,overflowX:"auto",whiteSpace:"pre"},_)},{children:r}))]}))},img:function(r){r.node;var o=e(r,["node"]);return i("img",n({},o,{style:{maxWidth:"100%",height:"auto",borderRadius:8,margin:"8px 0",border:"1px solid #e5e7eb"},loading:"lazy"}))}}},[W,y,T.activeKey,T.open,B,E,x,_,M,C,R]);return i("div",n({className:"pg-markdown-renderer",style:n({fontSize:W,lineHeight:1.7,color:"#1f2937",wordBreak:"break-word",position:"relative"},b)},{children:i(p,n({components:F,rehypePlugins:[f],className:"react-markdown-renderer-with-overrides"},{children:k(j)}))}))};export{M as MarkdownRenderer,M as default};
2
+ //# sourceMappingURL=Markdownrenderer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Markdownrenderer.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,2 +1,2 @@
1
- import{__assign as e,__spreadArray as i}from"tslib";import{jsx as t,jsxs as o,Fragment as r}from"react/jsx-runtime";import{useMemo as n,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"./RevertSummaryNotice.js";import v from"./CognitiveIcon.js";import F from"./CognitiveScoreBadge.js";import S from"../../assests/icons/InfoAlert.js";var y,w=function(e,t){return i([e],Array.isArray(t)?t:null==t?[]:[t],!0)},R="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 A=function(e){return Object.values(y).includes(e)},M=function(e,t,o,r){if(!t||!e)return[];var n=t.additional_decisions,l=Array.isArray(n)?n:n?Object.values(n).flat():[],d=Array.from(new Set(i(i([],t.allowed_decisions,!0),l,!0)));return d.flatMap(function(i){var t=e.focus_page,n=d.find(function(e){return e.toLowerCase().includes("merge")}),l=null!=t&&null!=o&&null!=r&&t===o&&t===r,a=null!=t&&null!=o&&t===o,c=null!=t&&null!=r&&(t===r||t===r+1),s=a||c||!(null!=t&&(!(null!=o&&null!=r)||t>o&&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!==n?[]:l?[{id:R,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:R,title:"Merge with an adjacent document",description:"Choose to merge with the previous or next document."}]}return[]})};function I(i){var I=i.headerName,k=void 0===I?"Boundary Check":I,z=i.title,T=i.pageNo,_=i.content,P=i.revertSummary,W=i.cognitiveScore,N=i.config,G=i.metadata,D=i.previousSegmentTitle,B=i.nextSegmentTitle,j=i.selectedIndex,H=i.defaultSelectedIndex,O=void 0===H?null:H,V=i.defaultStartPage,U=i.defaultEndPage,L=i.onSelectionChange,X=i.onConfirm,K=i.onActionConfirm,$=i.onCognitiveClick,q=i.onAdjustManually,J=i.onClose,Y=i.confirmLabel,Q=void 0===Y?"Confirm":Y,Z=i.manualPrompt,ee=void 0===Z?"Didn't find the right option?":Z,ie=i.manualActionLabel,te=void 0===ie?"Adjust Manually":ie,oe=i.cognitiveLabel,re=void 0===oe?"Cognitive Integrity":oe,ne=i.showAdjustManually,le=void 0===ne||ne,de=i.showCognitiveIntegrity,ae=void 0===de||de,ce=i.showCloseButton,se=void 0===ce||ce,ue=i.confirmDisabled,me=void 0!==ue&&ue,pe=i.width,he=void 0===pe?260:pe,ge=i.maxWidth,fe=void 0===ge?260:ge,xe=i.className,be=i.styles,Ce=i.reviewAction,Ee=n(function(){return(null!=N?N:G?M(G,Ce,V,U):[]).filter(function(e){return e.id!==y.SET_RANGE})},[N,U,V,G,Ce]),ve=l(O),Fe=ve[0],Se=ve[1],ye=l(null==V?"":String(V)),we=ye[0],Re=ye[1],Ae=l(null==U?"":String(U)),Me=Ae[0],Ie=Ae[1],ke=l(!1),ze=ke[0],Te=ke[1],_e=l(!1),Pe=_e[0],We=_e[1],Ne=l(null),Ge=Ne[0],De=Ne[1],Be=void 0===j?Fe:j,je=null==Be?void 0:Ee[Be],He=(null==je?void 0:je.id)===R,Oe=null!=D,Ve=null!=B,Ue=function(e){return!0===e.disabled||e.id===y.MERGE_PREV&&!Oe||e.id===y.MERGE_PREVIOUS&&!Oe||e.id===y.MERGE_NEXT&&!Ve||e.id===R&&!Oe&&!Ve},Le=Number(we),Xe=Number(Me),Ke=we.trim().length>0&&Me.trim().length>0&&Number.isInteger(Le)&&Number.isInteger(Xe)&&Le>0&&Xe>0&&Le<=Xe,$e=me||!je||Ue(je)||He&&null==Ge||!X&&!K;return t(g,e({className:xe,elevation:4,sx:w({width:he,maxWidth:fe,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==be?void 0:be.root)},{children:o(x,e({spacing:.75,sx:{p:1}},{children:[o(x,e({direction:"row",alignItems:"center",spacing:.75,sx:null==be?void 0:be.header},{children:[t(S,{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:k})),se&&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}})}))]})),o(s,{children:[t(C,e({sx:{color:"text.primary",fontSize:14,fontWeight:500}},{children:z})),null!=T&&t(C,e({sx:{mt:.125,color:"text.secondary",fontSize:12}},{children:T})),t(p,{sx:{my:.625}}),null!=P?t(E,{children:P}):null!=_&&t(C,e({component:"div",sx:{color:"text.secondary",fontSize:11.5,lineHeight:1.3}},{children:_}))]}),o(x,e({spacing:.625,role:"radiogroup","aria-label":"Boundary options"},{children:[Ee.map(function(i,r){var n=Be===r,l=Ue(i);return o(g,e({variant:"outlined",sx:w({borderColor:n?"#1976d2":"divider",borderRadius:2,bgcolor:l?"#F8FAFC":"background.paper",overflow:"hidden"},null==be?void 0:be.option)},{children:[o(m,e({role:"radio","aria-checked":n,disabled:me||l,onClick:function(){return function(e,i){me||Ue(i)||(void 0===j&&Se(e),i.id!==R&&De(null),ze&&(Te(!1),We(!1)),null==L||L(e,i))}(r,i)},sx:{width:"100%",justifyContent:"flex-start",px:.75,py:.5,textAlign:"left"}},{children:[t(f,{checked:n,disabled:me||l,tabIndex:-1,size:"small",sx:{p:.25,mr:.5,"&.Mui-disabled":{color:"#CBD5E1"}}}),o(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}))]}))]})),n&&i.id===R&&t(x,e({direction:"row",spacing:.75,sx:w({px:.75,pb:.75},null==be?void 0:be.adjacentSelector)},{children:[{direction:"previous",title:null!=D?D:"No Previous document",caption:"← Merge into Previous",available:Oe},{direction:"next",title:null!=B?B:"No Next document",caption:"Merge into Next →",available:Ve}].map(function(i){var r=Ge===i.direction;return o(x,e({sx:{flex:1,minWidth:0}},{children:[t(m,e({disabled:me||!i.available,onClick:function(){return De(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)}),He&&null!=Ge&&o(x,e({direction:"row",alignItems:"flex-start",spacing:.625,sx:w({p:.75,border:"1px solid #FCA5A5",borderRadius:1.5,bgcolor:"#FEF2F2"},null==be?void 0:be.impactWarning)},{children:[t(S,{color:"error",height:14,width:14,sx:{mt:.125}}),o(C,e({sx:{color:"#DC2626",fontSize:10.5,lineHeight:1.4}},{children:["This will impact the ",Ge," document. Its content and page range will change."]}))]})),t(u,e({variant:"contained",fullWidth:!0,disabled:$e,onClick:function(){if(!$e&&null!=Be&&je){var i=He?"previous"===Ge?y.MERGE_PREVIOUS:y.MERGE_NEXT:je.id,t=He?e(e({},je),{id:i}):je,o={selectedIndex:Be,option:t,metadata:G};null==X||X(Be,t,o),K&&A(i)&&K(i,o)}},sx:w({minHeight:32,mt:.25,borderRadius:2,fontSize:13,fontWeight:600,textTransform:"none",backgroundColor:"#5925DC","&:hover":{backgroundColor:"#4A1FB8"},"&.Mui-disabled":{backgroundColor:"#D9D6FE",color:"#FFFFFF"}},null==be?void 0:be.confirmButton)},{children:Q}))]})),le&&o(x,e({spacing:.625,sx:null==be?void 0:be.manualSection},{children:[o(m,e({disabled:me,onClick:function(){var e=!ze;Te(e),We(!1),e&&(void 0===j&&Se(null),null==q||q())},"aria-expanded":ze,sx:{width:"100%",justifyContent:"space-between",borderRadius:1,textAlign:"left"}},{children:[t(s,{children:t(C,e({sx:{color:"text.primary",fontSize:12,fontWeight:600}},{children:ee}))}),t(c,{sx:{color:"text.secondary",fontSize:16,transform:ze?"rotate(180deg)":"none",transition:"transform 150ms ease"}})]})),ze&&!Pe&&o(s,e({sx:{pt:.5,fontFamily:'Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif'}},{children:[o(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"}))]})),o(s,e({sx:{display:"grid",gridTemplateColumns:"1fr 1fr",columnGap:"8px",mb:"4px"}},{children:[t(b,{size:"small",type:"text",value:we,disabled:me,onChange:function(e){var i=e.target.value;/^\d*$/.test(i)&&Re(i)},inputProps:{inputMode:"numeric",pattern:"[0-9]*"},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"}}}),t(b,{size:"small",type:"text",value:Me,disabled:me,error:we.trim().length>0&&Me.trim().length>0&&Le>Xe,onChange:function(e){var i=e.target.value;/^\d*$/.test(i)&&Ie(i)},inputProps:{inputMode:"numeric",pattern:"[0-9]*"},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"}}})]})),t(s,{children:t(u,e({onClick:function(){Ke&&We(!0)},disabled:me||!Ke,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":Ke?{backgroundColor:"#FAF9FF",borderColor:"#7F6FF0"}:{},"&:active":Ke?{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"}})]})),ze&&Pe&&o(x,e({spacing:.75,sx:w({p:.75,borderRadius:1.5,bgcolor:"#FFF7ED"},null==be?void 0:be.manualConfirmation)},{children:[o(x,e({direction:"row",alignItems:"center",spacing:.5},{children:[t(S,{color:"warning",height:14,width:14}),t(C,e({sx:{color:"#EA580C",fontSize:11,fontWeight:600}},{children:"Confirm this change?"}))]})),o(C,e({sx:{color:"text.secondary",fontSize:10.5,lineHeight:1.4}},{children:["Pages ",Le,"-",Xe," will become part of ",z,", including pages from other documents in this range."]})),o(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:me||!X,onClick:function(){if(Ke&&X){var e={id:y.SET_RANGE,title:te};X(-1,e,{selectedIndex:-1,option:e,startPage:Le,endPage:Xe,metadata:G})}},sx:{minHeight:28,borderRadius:1.5,bgcolor:"#EA580C",fontSize:11,textTransform:"none","&:hover":{bgcolor:"#C2410C"}}},{children:"Confirm"}))]}))]}))]})),t(x,e({spacing:.625,sx:null==be?void 0:be.footer},{children:ae&&o(r,{children:[t(p,{}),o(m,e({onClick:$,disabled:!$,sx:{justifyContent:"space-between",borderRadius:1,textAlign:"left",cursor:$?"pointer":"not-allowed"}},{children:[o(x,e({direction:"row",alignItems:"center",spacing:1},{children:[t(v,{sx:{color:"text.secondary"}}),t(C,e({sx:{color:"text.primary",fontSize:12}},{children:re}))]})),o(x,e({direction:"row",alignItems:"center",spacing:.5},{children:[t(F,{score:W}),t(d,{sx:{color:"text.secondary"}})]}))]}))]})}))]}))}))}export{y as BoundaryReviewActionEnum,M as createBoundaryCardOptions,I as default,A as isBoundaryReviewAction};
1
+ import{__assign as e,__spreadArray as i}from"tslib";import{jsx as o,jsxs as t,Fragment as r}from"react/jsx-runtime";import{useMemo as n,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 p from"@mui/material/ButtonBase";import m from"@mui/material/Divider";import h from"@mui/material/IconButton";import g from"@mui/material/Paper";import x from"@mui/material/Radio";import f from"@mui/material/Stack";import b from"@mui/material/TextField";import E from"@mui/material/Typography";import C from"./RevertSummaryNotice.js";import v from"./CognitiveIcon.js";import F from"./CognitiveScoreBadge.js";import S from"../../assests/icons/InfoAlert.js";var y,w=function(e,o){return i([e],Array.isArray(o)?o:null==o?[]:[o],!0)},R="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 M=function(e){return Object.values(y).includes(e)},A=function(e,o,t,r){if(!o||!e)return[];var n=o.additional_decisions,l=Array.isArray(n)?n:n?Object.values(n).flat():[],d=Array.from(new Set(i(i([],o.allowed_decisions,!0),l,!0)));return d.flatMap(function(i){var o=e.focus_page,n=d.find(function(e){return e.toLowerCase().includes("merge")}),l=null!=o&&null!=t&&null!=r&&o===t&&o===r,a=null!=o&&null!=t&&o===t,c=null!=o&&null!=r&&(o===r||o===r+1),s=a||c||!(null!=o&&(!(null!=t&&null!=r)||o>t&&o<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.":o?"Start a new document at page ".concat(o,"."):"Create a new document at this boundary.",disabled:s}];case"MERGE_PREV":case"MERGE_NEXT":case"MERGE_PREVIOUS":return i!==n?[]:l?[{id:R,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:R,title:"Merge with an adjacent document",description:"Choose to merge with the previous or next document."}]}return[]})};function I(i){var I=i.headerName,T=void 0===I?"Boundary Check":I,z=i.title,W=i.pageNo,k=i.content,P=i.revertSummary,_=i.cognitiveScore,N=i.config,G=i.metadata,B=i.previousSegmentTitle,D=i.nextSegmentTitle,H=i.selectedIndex,j=i.defaultSelectedIndex,O=void 0===j?null:j,V=i.defaultStartPage,L=i.defaultEndPage,U=i.onSelectionChange,X=i.onConfirm,K=i.onActionConfirm,$=i.onCognitiveClick,q=i.onAdjustManually,J=i.onClose,Y=i.confirmLabel,Q=void 0===Y?"Confirm":Y,Z=i.manualPrompt,ee=void 0===Z?"Didn't find the right option?":Z,ie=i.manualActionLabel,oe=void 0===ie?"Adjust Manually":ie,te=i.cognitiveLabel,re=void 0===te?"Cognitive Integrity":te,ne=i.showAdjustManually,le=void 0===ne||ne,de=i.showCognitiveIntegrity,ae=void 0===de||de,ce=i.showCloseButton,se=void 0===ce||ce,ue=i.confirmDisabled,pe=void 0!==ue&&ue,me=i.width,he=void 0===me?260:me,ge=i.maxWidth,xe=void 0===ge?260:ge,fe=i.className,be=i.styles,Ee=i.reviewAction,Ce=i.totalPages;console.log("LOG: Total pages",Ce);var ve=n(function(){return(null!=N?N:G?A(G,Ee,V,L):[]).filter(function(e){return e.id!==y.SET_RANGE})},[N,L,V,G,Ee]),Fe=l(O),Se=Fe[0],ye=Fe[1],we=l(null==V?"":String(V)),Re=we[0],Me=we[1],Ae=l(null==L?"":String(L)),Ie=Ae[0],Te=Ae[1],ze=l(!1),We=ze[0],ke=ze[1],Pe=l(!1),_e=Pe[0],Ne=Pe[1],Ge=l(null),Be=Ge[0],De=Ge[1],He=l(!1),je=He[0],Oe=He[1],Ve=void 0===H?Se:H,Le=null==Ve?void 0:ve[Ve],Ue=(null==Le?void 0:Le.id)===R,Xe=null!=B,Ke=null!=D,$e=function(e){return!0===e.disabled||e.id===y.MERGE_PREV&&!Xe||e.id===y.MERGE_PREVIOUS&&!Xe||e.id===y.MERGE_NEXT&&!Ke||e.id===R&&!Xe&&!Ke},qe=Number(Re),Je=Number(Ie),Ye=Re.trim().length>0&&Ie.trim().length>0&&Number.isInteger(qe)&&Number.isInteger(Je)&&qe>0&&Je>0,Qe=null!=Ce&&qe>Ce,Ze=null!=Ce&&Je>Ce,ei=Re.trim().length>0&&Ie.trim().length>0&&Number.isInteger(qe)&&Number.isInteger(Je)&&qe>Je,ii=Ye&&qe<=Je&&!Qe&&!Ze,oi=ii&&qe===V&&Je===L,ti=pe||!Le||$e(Le)||Ue&&null==Be||!X&&!K;return o(g,e({className:fe,elevation:4,sx:w({width:he,maxWidth:xe,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==be?void 0:be.root)},{children:t(f,e({spacing:.75,sx:{p:1}},{children:[t(f,e({direction:"row",alignItems:"center",spacing:.75,sx:null==be?void 0:be.header},{children:[o(S,{color:"error",height:16,width:16}),o(E,e({sx:{flex:1,color:"error.main",fontSize:12,fontWeight:500,lineHeight:1.25,textTransform:"uppercase"}},{children:T})),se&&o(h,e({size:"small",onClick:J,disabled:!J,"aria-label":"Close boundary check",sx:{p:0,"&.Mui-disabled":{color:"text.secondary"}}},{children:o(a,{sx:{fontSize:17}})}))]})),t(s,{children:[o(E,e({sx:{color:"text.primary",fontSize:14,fontWeight:500}},{children:z})),null!=W&&o(E,e({sx:{mt:.125,color:"text.secondary",fontSize:12}},{children:W})),o(m,{sx:{my:.625}}),null!=P?o(C,{children:P}):null!=k&&o(E,e({component:"div",sx:{color:"text.secondary",fontSize:11.5,lineHeight:1.3}},{children:k}))]}),t(f,e({spacing:.625,role:"radiogroup","aria-label":"Boundary options"},{children:[ve.map(function(i,r){var n=Ve===r,l=$e(i);return t(g,e({variant:"outlined",sx:w({borderColor:n?"#1976d2":"divider",borderRadius:2,bgcolor:l?"#F8FAFC":"background.paper",overflow:"hidden"},null==be?void 0:be.option)},{children:[t(p,e({role:"radio","aria-checked":n,disabled:pe||l,onClick:function(){return function(e,i){pe||$e(i)||(void 0===H&&ye(e),i.id!==R&&De(null),We&&(ke(!1),Ne(!1)),null==U||U(e,i))}(r,i)},sx:{width:"100%",justifyContent:"flex-start",px:.75,py:.5,textAlign:"left"}},{children:[o(x,{checked:n,disabled:pe||l,tabIndex:-1,size:"small",sx:{p:.25,mr:.5,"&.Mui-disabled":{color:"#CBD5E1"}}}),t(s,e({sx:{minWidth:0}},{children:[o(E,e({sx:{color:l?"#94A3B8":"text.primary",fontSize:12.5,fontWeight:500}},{children:i.title})),null!=i.description&&o(E,e({sx:{mt:.125,color:l?"#94A3B8":"text.secondary",fontSize:11}},{children:i.description}))]}))]})),n&&i.id===R&&o(f,e({direction:"row",spacing:.75,sx:w({px:.75,pb:.75},null==be?void 0:be.adjacentSelector)},{children:[{direction:"previous",title:null!=B?B:"No Previous document",caption:"← Merge into Previous",available:Xe},{direction:"next",title:null!=D?D:"No Next document",caption:"Merge into Next →",available:Ke}].map(function(i){var r=Be===i.direction;return t(f,e({sx:{flex:1,minWidth:0}},{children:[o(p,e({disabled:pe||!i.available,onClick:function(){return De(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:o(E,e({sx:{color:"inherit",fontSize:11,fontWeight:500,lineHeight:1.25,overflowWrap:"anywhere"}},{children:i.title}))})),o(E,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)}),Ue&&null!=Be&&t(f,e({direction:"row",alignItems:"flex-start",spacing:.625,sx:w({p:.75,border:"1px solid #FCA5A5",borderRadius:1.5,bgcolor:"#FEF2F2"},null==be?void 0:be.impactWarning)},{children:[o(S,{color:"error",height:14,width:14,sx:{mt:.125}}),t(E,e({sx:{color:"#DC2626",fontSize:10.5,lineHeight:1.4}},{children:["This will impact the ",Be," document. Its content and page range will change."]}))]})),o(u,e({variant:"contained",fullWidth:!0,disabled:ti,onClick:function(){if(!ti&&null!=Ve&&Le){var i=Ue?"previous"===Be?y.MERGE_PREVIOUS:y.MERGE_NEXT:Le.id,o=Ue?e(e({},Le),{id:i}):Le,t={selectedIndex:Ve,option:o,metadata:G};null==X||X(Ve,o,t),K&&M(i)&&K(i,t)}},sx:w({minHeight:32,mt:.25,borderRadius:2,fontSize:13,fontWeight:600,textTransform:"none",backgroundColor:"#5925DC","&:hover":{backgroundColor:"#4A1FB8"},"&.Mui-disabled":{backgroundColor:"#D9D6FE",color:"#FFFFFF"}},null==be?void 0:be.confirmButton)},{children:Q}))]})),le&&t(f,e({spacing:.625,sx:null==be?void 0:be.manualSection},{children:[t(p,e({disabled:pe,onClick:function(){var e=!We;ke(e),Ne(!1),e&&(void 0===H&&ye(null),null==q||q())},"aria-expanded":We,sx:{width:"100%",justifyContent:"space-between",borderRadius:1,textAlign:"left"}},{children:[o(s,{children:o(E,e({sx:{color:"text.primary",fontSize:12,fontWeight:600}},{children:ee}))}),o(c,{sx:{color:"text.secondary",fontSize:16,transform:We?"rotate(180deg)":"none",transition:"transform 150ms ease"}})]})),We&&!_e&&t(s,e({sx:{pt:.5,fontFamily:'Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif'}},{children:[t(s,e({sx:{display:"grid",gridTemplateColumns:"1fr 1fr",columnGap:"8px",mb:"4px"}},{children:[o(E,e({sx:{fontSize:"10.5px",fontWeight:400,lineHeight:"14px",color:"#57697E",margin:0}},{children:"Starts"})),o(E,e({sx:{fontSize:"10.5px",fontWeight:400,lineHeight:"14px",color:"#57697E",margin:0}},{children:"Ends"}))]})),t(s,e({sx:{display:"grid",gridTemplateColumns:"1fr 1fr",columnGap:"8px",mb:"4px"}},{children:[t(s,{children:[o(b,{size:"small",type:"text",value:Re,disabled:pe,error:Qe||ei,onChange:function(e){var i=e.target.value;/^\d*$/.test(i)&&Me(i)},inputProps:{inputMode:"numeric",pattern:"[0-9]*"},sx:{"& .MuiOutlinedInput-root":{height:"30px",backgroundColor:"#FFFFFF","& fieldset":{borderColor:Qe||ei?"#EF4444":"#C3CFDC",borderWidth:"1px",borderRadius:"6px"},"&:hover fieldset":{borderColor:Qe||ei?"#EF4444":"#C3CFDC"},"&.Mui-focused fieldset":{borderColor:Qe||ei?"#EF4444":"#9488F6",borderWidth:"1px"}},"& .MuiOutlinedInput-input":{fontSize:"12px",fontWeight:400,lineHeight:"1",color:"#34445A",padding:"0 10px",height:"30px"}}}),Qe&&t(E,e({sx:{fontSize:"10px",color:"#EF4444",marginTop:"2px",fontWeight:500}},{children:["Must be ≤ ",Ce," (total pages)"]})),ei&&!Qe&&o(E,e({sx:{fontSize:"10px",color:"#EF4444",marginTop:"2px",fontWeight:500}},{children:"Must be ≤ end page"}))]}),t(s,{children:[o(b,{size:"small",type:"text",value:Ie,disabled:pe,error:Ze||ei,onChange:function(e){var i=e.target.value;/^\d*$/.test(i)&&Te(i)},inputProps:{inputMode:"numeric",pattern:"[0-9]*"},sx:{"& .MuiOutlinedInput-root":{height:"30px",backgroundColor:"#FFFFFF","& fieldset":{borderColor:Ze||ei?"#EF4444":"#C3CFDC",borderWidth:"1px",borderRadius:"6px"},"&:hover fieldset":{borderColor:Ze||ei?"#EF4444":"#C3CFDC"},"&.Mui-focused fieldset":{borderColor:Ze||ei?"#EF4444":"#9488F6",borderWidth:"1px"}},"& .MuiOutlinedInput-input":{fontSize:"12px",fontWeight:400,lineHeight:"1",color:"#34445A",padding:"0 10px",height:"30px"}}}),Ze&&t(E,e({sx:{fontSize:"10px",color:"#EF4444",marginTop:"2px",fontWeight:500}},{children:["Must be ≤ ",Ce," (total pages)"]})),ei&&!Ze&&o(E,e({sx:{fontSize:"10px",color:"#EF4444",marginTop:"2px",fontWeight:500}},{children:"Must be ≥ start page"}))]})]})),o(s,{children:o(u,e({onClick:function(){ii&&(oi?Oe(!0):Ne(!0))},disabled:pe||!ii,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":ii?{backgroundColor:"#FAF9FF",borderColor:"#7F6FF0"}:{},"&:active":ii?{transform:"translateY(1px)"}:{},"&.Mui-disabled":{backgroundColor:"#FFFFFF",borderColor:"#C3CFDC",color:"#A0ABBE",cursor:"not-allowed"}}},{children:"Apply"}))}),oi&&je&&o(s,e({sx:{backgroundColor:"#FEF3C7",border:"1px solid #FBBF24",borderRadius:"6px",padding:"8px 10px",marginTop:"4px"}},{children:o(E,e({sx:{fontSize:"10px",color:"#B45309",fontWeight:500,lineHeight:1.4}},{children:"Please change the boundary to change the document boundary as no changes will be applied."}))})),o(s,{sx:{width:"100%",height:"1px",marginTop:"8px",backgroundColor:"#EEF0F2",border:"0"}})]})),We&&_e&&t(f,e({spacing:.75,sx:w({p:.75,borderRadius:1.5,bgcolor:"#FFF7ED"},null==be?void 0:be.manualConfirmation)},{children:[t(f,e({direction:"row",alignItems:"center",spacing:.5},{children:[o(S,{color:"warning",height:14,width:14}),o(E,e({sx:{color:"#EA580C",fontSize:11,fontWeight:600}},{children:"Confirm this change?"}))]})),t(E,e({sx:{color:"text.secondary",fontSize:10.5,lineHeight:1.4}},{children:["Pages ",qe,"-",Je," will become part of ",z,", including pages from other documents in this range."]})),t(f,e({direction:"row",spacing:.75},{children:[o(u,e({variant:"outlined",fullWidth:!0,onClick:function(){return Ne(!1)},sx:{minHeight:28,borderRadius:1.5,fontSize:11,textTransform:"none"}},{children:"Cancel"})),o(u,e({variant:"contained",fullWidth:!0,disabled:pe||!X,onClick:function(){if(ii&&X){var e={id:y.SET_RANGE,title:oe};X(-1,e,{selectedIndex:-1,option:e,startPage:qe,endPage:Je,metadata:G})}},sx:{minHeight:28,borderRadius:1.5,bgcolor:"#EA580C",fontSize:11,textTransform:"none","&:hover":{bgcolor:"#C2410C"}}},{children:"Confirm"}))]}))]}))]})),o(f,e({spacing:.625,sx:null==be?void 0:be.footer},{children:ae&&t(r,{children:[o(m,{}),t(p,e({onClick:$,disabled:!$,sx:{justifyContent:"space-between",borderRadius:1,textAlign:"left",cursor:$?"pointer":"not-allowed"}},{children:[t(f,e({direction:"row",alignItems:"center",spacing:1},{children:[o(v,{sx:{color:"text.secondary"}}),o(E,e({sx:{color:"text.primary",fontSize:12}},{children:re}))]})),t(f,e({direction:"row",alignItems:"center",spacing:.5},{children:[o(F,{score:_}),o(d,{sx:{color:"text.secondary"}})]}))]}))]})}))]}))}))}export{y as BoundaryReviewActionEnum,A as createBoundaryCardOptions,I as default,M as isBoundaryReviewAction};
2
2
  //# sourceMappingURL=BoundaryCard.js.map
@@ -1,2 +1,2 @@
1
- import{__assign as i,__spreadArray as e}from"tslib";import{jsx as n,jsxs as t}from"react/jsx-runtime";import o from"@mui/icons-material/ChevronLeft";import r from"@mui/icons-material/Close";import l from"@mui/material/Box";import a from"@mui/material/Divider";import m from"@mui/material/IconButton";import c from"@mui/material/Paper";import s from"@mui/material/Stack";import h from"@mui/material/Typography";import d from"../CitationRenderer/MarkdownRenderer.js";import g from"./CognitiveIcon.js";import u from"./CognitiveScoreBadge.js";var p=function(i,n){return e([i],Array.isArray(n)?n:null==n?[]:[n],!0)};function f(e){var f=e.reasons,x=e.reason,v=e.gap,y=e.score,H=e.headerName,b=void 0===H?"Cognitive Integrity":H,C=e.onBack,S=e.onClose,z=e.showCloseButton,w=void 0===z||z,k=e.width,W=void 0===k?260:k,B=e.maxWidth,A=void 0===B?260:B,I=e.className,R=e.styles,j=(null!=f?f:[]).filter(function(i){return"evidence"===i.type.trim().toLowerCase()}).map(function(i){return i.text.trim()}).filter(Boolean),F=(null!=f?f:[]).filter(function(i){return"gap"===i.type.trim().toLowerCase()}).map(function(i){return i.text.trim()}).filter(Boolean),D=null==x?void 0:x.trim(),E=null==v?void 0:v.trim();if(0===j.length&&D&&j.push(D),0===F.length&&E&&F.push(E),0===j.length&&0===F.length)return null;var L,M=(L=null==R?void 0:R.markdown,i(i({},L),{containerWrapper:i(i({},null==L?void 0:L.containerWrapper),{display:"block",height:"auto",minHeight:0,maxHeight:"fit-content",flex:"0 0 auto"}),mainCard:i(i({},null==L?void 0:L.mainCard),{height:"auto",minHeight:0,maxHeight:"none",flex:"0 0 auto",padding:0,border:"none",borderRadius:0,boxShadow:"none",backgroundColor:"transparent"}),scrollArea:i({height:"auto",minHeight:0,maxHeight:"none",overflowY:"visible",paddingRight:0,color:"#475467",fontSize:11.5,lineHeight:1.3},null==L?void 0:L.scrollArea),list:i({margin:"0",padding:"0 0 0 18px",fontSize:"11.5px",lineHeight:"1.3"},null==L?void 0:L.list)})),N=i(i({},M),{scrollArea:i(i({},M.scrollArea),{fontSize:"inherit",lineHeight:"inherit"}),summary:i(i({},M.summary),{display:"inline-flex",padding:0,fontSize:"inherit",lineHeight:"inherit"})});return n(c,i({className:I,elevation:4,sx:p({width:W,maxWidth:A,height:"fit-content",minHeight:0,alignSelf:"flex-start",flex:"0 0 auto",borderRadius:2,bgcolor:"background.paper",overflow:"hidden",boxSizing:"border-box","@media (max-width: 372px)":{width:"calc(100vw - 32px)"}},null==R?void 0:R.root)},{children:t(s,i({spacing:.75,sx:{p:1,height:"auto",minHeight:0}},{children:[t(s,i({direction:"row",alignItems:"center",spacing:.75,sx:null==R?void 0:R.header},{children:[C&&n(m,i({size:"small",onClick:C,"aria-label":"Return to review check",sx:{p:0,color:"#6941C6"}},{children:n(o,{sx:{fontSize:17}})})),n(g,{sx:{color:"#6941C6"}}),n(h,i({sx:{flex:1,fontSize:12,fontWeight:500,alignItems:"center",display:"flex",lineHeight:1.25,textTransform:"capitalise"}},{children:b})),n(u,{score:y}),w&&n(m,i({size:"small",onClick:S,disabled:!S,"aria-label":"Close cognitive integrity",sx:{p:0,"&.Mui-disabled":{color:"text.secondary"}}},{children:n(r,{sx:{fontSize:17}})}))]})),n(a,{sx:{m:0}}),n(l,i({sx:p({bgcolor:"#F9FAFB",px:1.5,py:1.25,height:"auto",minHeight:0,flex:"0 0 auto"},null==R?void 0:R.content)},{children:t(s,i({spacing:1.5},{children:[j.length>0&&t(l,{children:[n(h,i({sx:{mb:1,color:"#344054",fontSize:12,fontWeight:600,lineHeight:1.4}},{children:"Decision Making Factors"})),n(s,i({spacing:.75},{children:j.map(function(e,o){return t(s,i({direction:"row",alignItems:"flex-start",spacing:.75},{children:[t(h,i({component:"span",sx:{flex:"0 0 auto",minWidth:14,color:"#475467",fontSize:11.5,lineHeight:1.65}},{children:[o+1,"."]})),n(l,i({sx:{flex:1,minWidth:0,color:"#667085",fontSize:11.5,lineHeight:1.65,"& p":{m:0,color:"inherit",fontSize:"inherit",lineHeight:"inherit"}}},{children:n(d,{value:"<summary>".concat(e,"</summary>"),styles:N})}))]}),"evidence-".concat(o))})}))]}),j.length>0&&F.length>0&&n(a,{sx:{my:"2px !important",borderColor:"#E4E7EC"}}),F.length>0&&t(l,{children:[n(h,i({sx:{mb:1,color:"#344054",fontSize:12,fontWeight:600,lineHeight:1.4}},{children:"Gaps in Decision"})),n(s,i({spacing:.75},{children:F.map(function(e,o){return t(s,i({direction:"row",alignItems:"flex-start",spacing:.75},{children:[t(h,i({component:"span",sx:{flex:"0 0 auto",minWidth:14,color:"#475467",fontSize:11.5,lineHeight:1.65}},{children:[o+1,"."]})),n(l,i({sx:{flex:1,minWidth:0,color:"#667085",fontSize:11.5,lineHeight:1.65,"& p":{m:0,color:"inherit",fontSize:"inherit",lineHeight:"inherit"}}},{children:n(d,{value:"<summary>".concat(e,"</summary>"),styles:N})}))]}),"gap-".concat(o))})}))]})]}))}))]}))}))}export{f as default};
1
+ import{__assign as i,__spreadArray as e}from"tslib";import{jsx as n,jsxs as t}from"react/jsx-runtime";import o from"@mui/icons-material/ChevronLeft";import r from"@mui/icons-material/Close";import l from"@mui/material/Box";import a from"@mui/material/Divider";import m from"@mui/material/IconButton";import c from"@mui/material/Paper";import s from"@mui/material/Stack";import h from"@mui/material/Typography";import d from"../CitationRenderer/MarkdownRenderer.js";import f from"./CognitiveIcon.js";import g from"./CognitiveScoreBadge.js";var u=function(i,n){return e([i],Array.isArray(n)?n:null==n?[]:[n],!0)};function p(e){var p=e.reasons,x=e.reason,v=e.gap,y=e.score,H=e.headerName,S=void 0===H?"Cognitive Integrity":H,b=e.onBack,C=e.onClose,z=e.showCloseButton,w=void 0===z||z,k=e.width,W=void 0===k?260:k,D=e.maxWidth,B=void 0===D?260:D,A=e.className,I=e.styles,R=(null!=p?p:[]).filter(function(i){return"evidence"===i.type.trim().toLowerCase()}).map(function(i){return i.text.trim()}).filter(Boolean),j=(null!=p?p:[]).filter(function(i){return"gap"===i.type.trim().toLowerCase()}).map(function(i){return i.text.trim()}).filter(Boolean),F=null==x?void 0:x.trim(),E=null==v?void 0:v.trim();if(0===R.length&&F&&R.push(F),0===j.length&&E&&j.push(E),0===R.length&&0===j.length)return null;var L,M=(L=null==I?void 0:I.markdown,i(i({},L),{containerWrapper:i(i({},null==L?void 0:L.containerWrapper),{display:"block",height:"auto",minHeight:0,maxHeight:"fit-content",flex:"0 0 auto"}),mainCard:i(i({},null==L?void 0:L.mainCard),{height:"auto",minHeight:0,maxHeight:"none",flex:"0 0 auto",padding:0,border:"none",borderRadius:0,boxShadow:"none",backgroundColor:"transparent"}),scrollArea:i({height:"auto",minHeight:0,maxHeight:"none",overflowY:"visible",paddingRight:0,color:"#475467",fontSize:11.5,lineHeight:1.3},null==L?void 0:L.scrollArea),list:i({margin:"0",padding:"0 0 0 18px",fontSize:"11.5px",lineHeight:"1.3"},null==L?void 0:L.list)})),N=i(i({},M),{scrollArea:i(i({},M.scrollArea),{fontSize:"inherit",lineHeight:"inherit"}),summary:i(i({},M.summary),{display:"inline-flex",padding:0,fontSize:"inherit",lineHeight:"inherit"})});return n(c,i({className:A,elevation:4,sx:u({width:W,maxWidth:B,height:"fit-content",minHeight:0,alignSelf:"flex-start",flex:"0 0 auto",borderRadius:2,bgcolor:"background.paper",overflow:"hidden",boxSizing:"border-box","@media (max-width: 372px)":{width:"calc(100vw - 32px)"}},null==I?void 0:I.root)},{children:t(s,i({spacing:.75,sx:{p:1,height:"auto",minHeight:0,display:"flex",flexDirection:"column","& > *":{minHeight:0}}},{children:[t(s,i({direction:"row",alignItems:"center",spacing:.75,sx:null==I?void 0:I.header},{children:[b&&n(m,i({size:"small",onClick:b,"aria-label":"Return to review check",sx:{p:0,color:"#6941C6"}},{children:n(o,{sx:{fontSize:17}})})),n(f,{sx:{color:"#6941C6"}}),n(h,i({sx:{flex:1,fontSize:12,fontWeight:500,alignItems:"center",display:"flex",lineHeight:1.25,textTransform:"capitalise"}},{children:S})),n(g,{score:y}),w&&n(m,i({size:"small",onClick:C,disabled:!C,"aria-label":"Close cognitive integrity",sx:{p:0,"&.Mui-disabled":{color:"text.secondary"}}},{children:n(r,{sx:{fontSize:17}})}))]})),n(a,{sx:{m:0}}),n(l,i({sx:u({bgcolor:"#F9FAFB",px:1.5,py:1.25,height:"auto",minHeight:0,flex:"0 0 auto",display:"flex",flexDirection:"column"},null==I?void 0:I.content)},{children:t(s,i({spacing:1.5,sx:{display:"flex",flexDirection:"column",minHeight:0}},{children:[R.length>0&&t(l,i({sx:{minHeight:0,display:"flex",flexDirection:"column"}},{children:[n(h,i({sx:{mb:1,color:"#344054",fontSize:12,fontWeight:600,lineHeight:1.4,flexShrink:0}},{children:"Decision Making Factors"})),n(s,i({spacing:.75,sx:{minHeight:0,display:"flex",flexDirection:"column"}},{children:R.map(function(e,o){return t(s,i({direction:"row",alignItems:"flex-start",spacing:.75},{children:[t(h,i({component:"span",sx:{flex:"0 0 auto",minWidth:14,color:"#475467",fontSize:11.5,lineHeight:1.65}},{children:[o+1,"."]})),n(l,i({sx:{flex:1,minWidth:0,color:"#667085",fontSize:11.5,lineHeight:1.65,"& p":{m:0,color:"inherit",fontSize:"inherit",lineHeight:"inherit"}}},{children:n(d,{value:"<summary>".concat(e,"</summary>"),styles:N})}))]}),"evidence-".concat(o))})}))]})),R.length>0&&j.length>0&&n(a,{sx:{my:"2px !important",borderColor:"#E4E7EC"}}),j.length>0&&t(l,i({sx:{minHeight:0,display:"flex",flexDirection:"column"}},{children:[n(h,i({sx:{mb:1,color:"#344054",fontSize:12,fontWeight:600,lineHeight:1.4,flexShrink:0}},{children:"Gaps in Decision"})),n(s,i({spacing:.75,sx:{minHeight:0,display:"flex",flexDirection:"column"}},{children:j.map(function(e,o){return t(s,i({direction:"row",alignItems:"flex-start",spacing:.75},{children:[t(h,i({component:"span",sx:{flex:"0 0 auto",minWidth:14,color:"#475467",fontSize:11.5,lineHeight:1.65}},{children:[o+1,"."]})),n(l,i({sx:{flex:1,minWidth:0,color:"#667085",fontSize:11.5,lineHeight:1.65,"& p":{m:0,color:"inherit",fontSize:"inherit",lineHeight:"inherit"}}},{children:n(d,{value:"<summary>".concat(e,"</summary>"),styles:N})}))]}),"gap-".concat(o))})}))]}))]}))}))]}))}))}export{p as default};
2
2
  //# sourceMappingURL=CognitiveIntegrity.js.map
@@ -1,2 +1,2 @@
1
- import{__assign as o,__spreadArray as e}from"tslib";import{jsx as i,jsxs as r,Fragment as t}from"react/jsx-runtime";import{useCallback as n}from"react";import l from"@mui/icons-material/ChevronRight";import a from"@mui/icons-material/Close";import d from"@mui/material/Box";import c from"@mui/material/Button";import s from"@mui/material/Divider";import m from"@mui/material/IconButton";import u from"@mui/material/Paper";import p from"@mui/material/Stack";import h from"@mui/material/Typography";import f from"./CognitiveIcon.js";import g from"./CognitiveScoreBadge.js";import x from"../../assests/icons/InfoAlert.js";var b,v=function(o,i){return e([o],Array.isArray(i)?i:null==i?[]:[i],!0)};!function(o){o.YES="YES",o.NO="NO"}(b||(b={}));var C=function(o){return Object.values(b).includes(o)};function y(e){var C,y=e.headerName,F=void 0===y?"Page Type Check":y,S=e.title,w=e.pageNo,k=e.content,D=e.cognitiveScore,z=e.pageType,A=e.metadata,I=e.onActionConfirm,B=e.onCognitiveClick,N=e.onClose,T=e.showCognitiveIntegrity,W=void 0===T||T,E=e.showCloseButton,j=void 0===E||E,O=e.confirmDisabled,R=void 0!==O&&O,Y=e.disableAllActions,H=void 0!==Y&&Y,M=e.width,P=void 0===M?260:M,_=e.maxWidth,q=void 0===_?260:_,G=e.className,J=e.styles,K=null!==(C=null!=z?z:null==A?void 0:A.page_type)&&void 0!==C?C:"table",L=null!=k?k:"We're not fully confident about the type of this page. Is this page a ".concat(K,"?"),Q=H||R||!I,U=n(function(){Q||null==I||I(b.YES,{action:b.YES,pageType:K,metadata:A})},[Q,I,K,A]),V=n(function(){Q||null==I||I(b.NO,{action:b.NO,pageType:K,metadata:A})},[Q,I,K,A]);return i(u,o({className:G,elevation:0,sx:v({width:P,maxWidth:q,borderTop:"4px solid",borderColor:"error.main",borderRadius:2,bgcolor:"background.paper",boxSizing:"border-box",boxShadow:"0 8px 16px rgba(16, 24, 40, 0.2)","@media (max-width: 372px)":{width:"calc(100vw - 32px)"}},null==J?void 0:J.root)},{children:i(d,o({sx:{overflow:"hidden"}},{children:r(p,o({spacing:.75,sx:{p:1}},{children:[r(p,o({direction:"row",alignItems:"center",spacing:.75,sx:null==J?void 0:J.header},{children:[i(x,{color:"error",height:16,width:16}),i(h,o({sx:{flex:1,color:"error.main",fontSize:12,fontWeight:500,lineHeight:1.25,textTransform:"uppercase"}},{children:F})),j&&i(m,o({size:"small",onClick:N,disabled:!N,"aria-label":"Close page check",sx:{p:0,"&.Mui-disabled":{color:"text.secondary"}}},{children:i(a,{sx:{fontSize:17}})}))]})),r(d,{children:[i(h,o({sx:{color:"text.primary",fontSize:14,fontWeight:500}},{children:S})),null!=w&&i(h,o({sx:{mt:.125,color:"text.secondary",fontSize:12}},{children:w})),i(s,{sx:{my:.625}}),null!=L&&i(h,o({component:"div",sx:{color:"text.secondary",fontSize:11.5,lineHeight:1.3}},{children:L}))]}),r(p,o({direction:"row",spacing:.75},{children:[i(c,o({variant:"outlined",fullWidth:!0,disabled:Q,onClick:V,sx:v({minHeight:32,borderRadius:2,fontSize:13,fontWeight:600,textTransform:"none",borderColor:"#D0D5DD",color:"#475569",backgroundColor:"#FFFFFF","&:hover":{backgroundColor:"#F8FAFC",borderColor:"#D0D5DD"},"&.Mui-disabled":{backgroundColor:"#F3F4F6",color:"#9CA3AF",borderColor:"#E5E7EB"}},null==J?void 0:J.noButton)},{children:"No"})),i(c,o({variant:"contained",fullWidth:!0,disabled:Q,onClick:U,sx:v({minHeight:32,borderRadius:2,fontSize:13,fontWeight:600,textTransform:"none",backgroundColor:"#5925DC","&:hover":{backgroundColor:"#4A1FB8"},"&.Mui-disabled":{backgroundColor:"#D9D6FE",color:"#FFFFFF"}},null==J?void 0:J.yesButton)},{children:"Yes"}))]})),i(p,o({spacing:.625,sx:null==J?void 0:J.footer},{children:W&&r(t,{children:[i(s,{}),r(d,o({onClick:B,sx:{display:"flex",justifyContent:"space-between",alignItems:"center",borderRadius:1,cursor:B?"pointer":"not-allowed","&:hover":B?{opacity:.8}:{}}},{children:[r(p,o({direction:"row",alignItems:"center",spacing:1},{children:[i(f,{sx:{color:"text.secondary"}}),i(h,o({sx:{color:"text.primary",fontSize:12}},{children:"Cognitive Integrity"}))]})),r(p,o({direction:"row",alignItems:"center",spacing:.75},{children:[i(g,{score:D}),i(l,{sx:{color:"text.secondary",fontSize:18}})]}))]}))]})}))]}))}))}))}export{b as PageCheckActionEnum,y as default,C as isPageCheckAction};
1
+ import{__assign as o,__spreadArray as e}from"tslib";import{jsx as i,jsxs as r,Fragment as t}from"react/jsx-runtime";import{useCallback as n}from"react";import l from"@mui/icons-material/ChevronRight";import a from"@mui/icons-material/Close";import d from"@mui/material/Box";import c from"@mui/material/Button";import s from"@mui/material/Divider";import m from"@mui/material/IconButton";import u from"@mui/material/Paper";import p from"@mui/material/Stack";import h from"@mui/material/Typography";import f from"./CognitiveIcon.js";import g from"./CognitiveScoreBadge.js";import x from"../../assests/icons/InfoAlert.js";var b,v=function(o,i){return e([o],Array.isArray(i)?i:null==i?[]:[i],!0)};!function(o){o.YES="YES",o.NO="NO"}(b||(b={}));var C=function(o){return Object.values(b).includes(o)};function y(e){var C,y=e.headerName,F=void 0===y?"Page Type Check":y,S=e.title,w=e.pageNo,k=e.content,D=e.cognitiveScore,z=e.pageType,A=e.metadata,I=e.onActionConfirm,B=e.onCognitiveClick,N=e.onClose,T=e.showCognitiveIntegrity,W=void 0===T||T,E=e.showCloseButton,j=void 0===E||E,O=e.confirmDisabled,R=void 0!==O&&O,Y=e.disableAllActions,H=void 0!==Y&&Y,M=e.width,P=void 0===M?260:M,_=e.maxWidth,q=void 0===_?260:_,G=e.className,J=e.styles,K=null!==(C=null!=z?z:null==A?void 0:A.page_type)&&void 0!==C?C:"table",L=null!=k?k:"We're not fully confident about the format of this page. Is this page a ".concat(K,"?"),Q=H||R||!I,U=n(function(){Q||null==I||I(b.YES,{action:b.YES,pageType:K,metadata:A})},[Q,I,K,A]),V=n(function(){Q||null==I||I(b.NO,{action:b.NO,pageType:K,metadata:A})},[Q,I,K,A]);return i(u,o({className:G,elevation:0,sx:v({width:P,maxWidth:q,borderTop:"4px solid",borderColor:"error.main",borderRadius:2,bgcolor:"background.paper",boxSizing:"border-box",boxShadow:"0 8px 16px rgba(16, 24, 40, 0.2)","@media (max-width: 372px)":{width:"calc(100vw - 32px)"}},null==J?void 0:J.root)},{children:i(d,o({sx:{overflow:"hidden"}},{children:r(p,o({spacing:.75,sx:{p:1}},{children:[r(p,o({direction:"row",alignItems:"center",spacing:.75,sx:null==J?void 0:J.header},{children:[i(x,{color:"error",height:16,width:16}),i(h,o({sx:{flex:1,color:"error.main",fontSize:12,fontWeight:500,lineHeight:1.25,textTransform:"uppercase"}},{children:F})),j&&i(m,o({size:"small",onClick:N,disabled:!N,"aria-label":"Close page check",sx:{p:0,"&.Mui-disabled":{color:"text.secondary"}}},{children:i(a,{sx:{fontSize:17}})}))]})),r(d,{children:[i(h,o({sx:{color:"text.primary",fontSize:14,fontWeight:500}},{children:S})),null!=w&&i(h,o({sx:{mt:.125,color:"text.secondary",fontSize:12}},{children:w})),i(s,{sx:{my:.625}}),null!=L&&i(h,o({component:"div",sx:{color:"text.secondary",fontSize:11.5,lineHeight:1.3}},{children:L}))]}),r(p,o({direction:"row",spacing:.75},{children:[i(c,o({variant:"outlined",fullWidth:!0,disabled:Q,onClick:V,sx:v({minHeight:32,borderRadius:2,fontSize:13,fontWeight:600,textTransform:"none",borderColor:"#D0D5DD",color:"#475569",backgroundColor:"#FFFFFF","&:hover":{backgroundColor:"#F8FAFC",borderColor:"#D0D5DD"},"&.Mui-disabled":{backgroundColor:"#F3F4F6",color:"#9CA3AF",borderColor:"#E5E7EB"}},null==J?void 0:J.noButton)},{children:"No"})),i(c,o({variant:"contained",fullWidth:!0,disabled:Q,onClick:U,sx:v({minHeight:32,borderRadius:2,fontSize:13,fontWeight:600,textTransform:"none",backgroundColor:"#5925DC","&:hover":{backgroundColor:"#4A1FB8"},"&.Mui-disabled":{backgroundColor:"#D9D6FE",color:"#FFFFFF"}},null==J?void 0:J.yesButton)},{children:"Yes"}))]})),i(p,o({spacing:.625,sx:null==J?void 0:J.footer},{children:W&&r(t,{children:[i(s,{}),r(d,o({onClick:B,sx:{display:"flex",justifyContent:"space-between",alignItems:"center",borderRadius:1,cursor:B?"pointer":"not-allowed","&:hover":B?{opacity:.8}:{}}},{children:[r(p,o({direction:"row",alignItems:"center",spacing:1},{children:[i(f,{sx:{color:"text.secondary"}}),i(h,o({sx:{color:"text.primary",fontSize:12}},{children:"Cognitive Integrity"}))]})),r(p,o({direction:"row",alignItems:"center",spacing:.75},{children:[i(g,{score:D}),i(l,{sx:{color:"text.secondary",fontSize:18}})]}))]}))]})}))]}))}))}))}export{b as PageCheckActionEnum,y as default,C as isPageCheckAction};
2
2
  //# sourceMappingURL=PageCheck.js.map