@viswa-test/test-citation 0.0.316 → 0.0.317

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.
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),t=require("react"),i=require("./PdfStyle.js"),s=require("../../assests/svg/PdfViewerIcons.js"),l=require("@mui/material/Tooltip"),r=require("lucide-react");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=o(t),d=o(l);exports.default=function(t){t.highlightIndex;var l=t.totalHighlights,o=t.controls,c=t.currentPosition,p=t.pdfName,g=t.onClose,x=t.pdfUrl,u=t.viewerRef,h=t.customStyles,f=t.customClasses,_=t.customIcons,v=t.headerAction,m=t.isZoomEnabled,j=void 0===m||m,y=t.showHighlightsAction,w=void 0===y||y,b=t.showFullScreenAction,S=void 0===b||b,k=t.currentSegment,I=t.segmentTooltipText,F=void 0===I?"Details of current segment":I,C=t.currentPage,D=t.totalPages,W=t.onPageNavigate,E=o.ZoomInButton,B=o.ZoomOutButton,P=o.ZoomPopover,L=o.goToPrevious,z=o.goToNext,A=a.default.useState(String(C)),T=A[0],q=A[1];a.default.useEffect(function(){q(String(C))},[C]);var N={padding:"4px",borderRadius:"6px",background:"transparent",border:"none",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s ease",flexShrink:0},R=function(e){return String(e).padStart(2,"0")};return n.jsxs("div",e.__assign({style:e.__assign(e.__assign(e.__assign({marginBottom:"12px",background:"#FAFAFA",borderBottom:"1px solid #F3F4F6",borderTopLeftRadius:"12px",borderTopRightRadius:"12px"},i.pdfStyles.header),null==h?void 0:h.header),{display:"flex",flexDirection:"column",alignItems:"stretch",gap:"12px"})},{children:[n.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",justifyContent:"space-between",flexWrap:"wrap",columnGap:"16px",rowGap:"12px",minWidth:0}},{children:[n.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:"12px",flex:"1 1 180px",minWidth:0}},{children:[n.jsx("div",e.__assign({style:e.__assign(e.__assign(e.__assign({},{borderRadius:"21px",border:"6px solid #E8F3FF",background:"#D5E8FF",display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",boxSizing:"content-box"}),null==h?void 0:h.pdfIconWrapper),{flexShrink:0})},{children:(null==_?void 0:_.pdfIcon)||n.jsx(s.DefaultPdfIcon,{})})),n.jsx(d.default,e.__assign({title:p||"",arrow:!0,placement:"top"},{children:n.jsx("div",e.__assign({style:{flex:1,minWidth:0,overflow:"hidden"}},{children:n.jsx("span",e.__assign({style:e.__assign({display:"block",width:"100%",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",fontWeight:500,cursor:"default"},null==h?void 0:h.pdfName),className:null==f?void 0:f.pdfName},{children:p}))}))}))]})),n.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:w?"16px":"2px",color:"#4B5563",flex:"0 1 auto",marginLeft:"auto",whiteSpace:"nowrap",minWidth:0,maxWidth:"100%",overflowX:"auto",overflowY:"hidden",scrollbarWidth:"thin"}},{children:[D>0&&n.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:"4px",color:"#475467",flexShrink:0,whiteSpace:"nowrap"}},{children:[n.jsx("input",{"aria-label":"Current page",inputMode:"numeric",pattern:"[0-9]*",value:T,onChange:function(e){var n=e.target.value.replace(/\D/g,"");q(n)},onBlur:function(){var e=Number(T);if(!Number.isInteger(e)||e<1)q(String(C));else{var n=D?Math.min(e,D):e;W(n),q(String(n))}},onKeyDown:function(e){"Enter"===e.key&&e.currentTarget.blur(),"Escape"===e.key&&(q(String(C)),e.currentTarget.blur())},style:{width:"40px",height:"28px",border:"1px solid #E5E7EB",borderRadius:"4px",background:"#FFFFFF",color:"#111827",fontSize:"14px",fontWeight:500,textAlign:"center",outline:"none",boxSizing:"border-box"}}),n.jsx("span",e.__assign({style:{fontSize:"14px",fontWeight:500,color:"#111827"}},{children:"/"})),n.jsx("span",e.__assign({style:{fontSize:"14px",fontWeight:500,color:"#111827"}},{children:String(D)}))]})),j&&n.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:"4px"}},{children:[n.jsx(B,{}),n.jsx("div",e.__assign({style:{fontSize:"14px",fontWeight:500,width:"56px",textAlign:"center"}},{children:n.jsx(P,{})})),n.jsx(E,{})]})),!!l&&w&&n.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:"4px"}},{children:[n.jsxs("span",e.__assign({style:{fontSize:"14px",color:"#475467",fontWeight:500,lineHeight:1}},{children:[c," of ",l]})),n.jsx("button",e.__assign({style:{background:"none",border:"none",cursor:c<=1?"not-allowed":"pointer",padding:"2px 4px",color:c<=1?"#D0D5DD":"#475467",display:"flex",alignItems:"center",justifyContent:"center",lineHeight:1,height:"20px",width:"20px"},onClick:L,disabled:c<=1},{children:n.jsx("svg",e.__assign({width:"12",height:"12",viewBox:"0 0 12 12",fill:"none"},{children:n.jsx("path",{d:"M2 8L6 4L10 8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}))})),n.jsx("button",e.__assign({style:{background:"none",border:"none",cursor:c===l?"not-allowed":"pointer",padding:"2px 4px",color:c===l?"#D0D5DD":"#475467",display:"flex",alignItems:"center",justifyContent:"center",lineHeight:1,height:"20px",width:"20px"},onClick:z,disabled:c===l},{children:n.jsx("svg",e.__assign({width:"12",height:"12",viewBox:"0 0 12 12",fill:"none"},{children:n.jsx("path",{d:"M2 4L6 8L10 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}))}))]})),n.jsx("div",{style:{width:"1px",height:"20px",background:"#D1D5DB",margin:"0 4px",flexShrink:0}}),n.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:"8px",flexShrink:0,whiteSpace:"nowrap"}},{children:[!1!==S&&((null==v?void 0:v.icon)&&(null==v?void 0:v.onClick)?n.jsx(d.default,e.__assign({title:(null==v?void 0:v.tooltip)||"",arrow:!0,placement:"top"},{children:n.jsx("div",e.__assign({onClick:v.onClick,style:e.__assign({display:"flex",alignItems:"center",cursor:"pointer"},N)},{children:v.icon}))})):n.jsx("button",e.__assign({onClick:function(){var e=null==u?void 0:u.current;e&&(document.fullscreenElement?document.exitFullscreen():e.requestFullscreen().catch(function(e){console.error("Error attempting to enable fullscreen: ".concat(e.message))}))},style:N,title:"Full Screen"},{children:(null==_?void 0:_.fullScreenIcon)||n.jsx(s.DefaultFullScreenIcon,{})}))),x&&n.jsx("a",e.__assign({href:x,target:"_blank",rel:"noopener noreferrer",style:N,title:"Open in new tab"},{children:(null==_?void 0:_.downloadIcon)||n.jsx(s.DefaultDownloadIcon,{})})),g&&n.jsx("button",e.__assign({onClick:g,style:N,title:"Close"},{children:(null==_?void 0:_.closeIcon)||n.jsx(s.DefaultCloseIcon,{})}))]}))]}))]})),k&&n.jsxs("div",e.__assign({style:{background:"#EEF2FF",border:"1px solid #A5B4FC",borderRadius:"8px",color:"#4F46E5",display:"flex",alignItems:"center",gap:"12px",minWidth:0,padding:"10px 16px",fontSize:"12px",fontWeight:500,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"}},{children:[n.jsx(d.default,e.__assign({title:F,arrow:!0,placement:"top"},{children:n.jsx(r.Info,{size:16,color:"#4F46E5",strokeWidth:2,style:{flexShrink:0}})})),n.jsx("span",e.__assign({style:{overflow:"hidden",textOverflow:"ellipsis"}},{children:n.jsx(d.default,e.__assign({title:k.title,arrow:!0,placement:"top"},{children:n.jsxs("span",{children:["Viewing ",k.title," • Pages ",R(k.start_page),"-",R(k.end_page)]})}))}))]}))]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),t=require("react"),i=require("./PdfStyle.js"),s=require("../../assests/svg/PdfViewerIcons.js"),l=require("@mui/material/Tooltip"),o=require("lucide-react");function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=r(t),d=r(l);exports.default=function(t){t.highlightIndex;var l=t.totalHighlights,r=t.controls,c=t.currentPosition,p=t.pdfName,g=t.onClose,x=t.pdfUrl,u=t.viewerRef,h=t.customStyles,f=t.customClasses,_=t.customIcons,v=t.headerAction,m=t.isZoomEnabled,j=void 0===m||m,y=t.showHighlightsAction,w=void 0===y||y,b=t.showFullScreenAction,k=void 0===b||b,S=t.currentSegment,I=t.segmentTooltipText,F=void 0===I?"Details of current segment":I,C=t.currentPage,D=t.totalPages,W=t.onPageNavigate,E=r.ZoomInButton,B=r.ZoomOutButton,P=r.ZoomPopover,L=r.goToPrevious,z=r.goToNext,A=a.default.useState(String(C)),T=A[0],q=A[1];a.default.useEffect(function(){q(String(C))},[C]);var N={padding:"4px",borderRadius:"6px",background:"transparent",border:"none",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s ease",flexShrink:0};return n.jsxs("div",e.__assign({style:e.__assign(e.__assign(e.__assign({marginBottom:"12px",background:"#FAFAFA",borderBottom:"1px solid #F3F4F6",borderTopLeftRadius:"12px",borderTopRightRadius:"12px"},i.pdfStyles.header),null==h?void 0:h.header),{display:"flex",flexDirection:"column",alignItems:"stretch",gap:"12px"})},{children:[n.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",justifyContent:"space-between",flexWrap:"wrap",columnGap:"16px",rowGap:"12px",minWidth:0}},{children:[n.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:"12px",flex:"1 1 180px",minWidth:0}},{children:[n.jsx("div",e.__assign({style:e.__assign(e.__assign(e.__assign({},{borderRadius:"21px",border:"6px solid #E8F3FF",background:"#D5E8FF",display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",boxSizing:"content-box"}),null==h?void 0:h.pdfIconWrapper),{flexShrink:0})},{children:(null==_?void 0:_.pdfIcon)||n.jsx(s.DefaultPdfIcon,{})})),n.jsx(d.default,e.__assign({title:p||"",arrow:!0,placement:"top"},{children:n.jsx("div",e.__assign({style:{flex:1,minWidth:0,overflow:"hidden"}},{children:n.jsx("span",e.__assign({style:e.__assign({display:"block",width:"100%",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",fontWeight:500,cursor:"default"},null==h?void 0:h.pdfName),className:null==f?void 0:f.pdfName},{children:p}))}))}))]})),n.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:w?"16px":"2px",color:"#4B5563",flex:"0 1 auto",marginLeft:"auto",whiteSpace:"nowrap",minWidth:0,maxWidth:"100%",overflowX:"auto",overflowY:"hidden",scrollbarWidth:"thin"}},{children:[D>0&&n.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:"4px",color:"#475467",flexShrink:0,whiteSpace:"nowrap"}},{children:[n.jsx("input",{"aria-label":"Current page",inputMode:"numeric",pattern:"[0-9]*",value:T,onChange:function(e){var n=e.target.value.replace(/\D/g,"");q(n)},onBlur:function(){var e=Number(T);if(!Number.isInteger(e)||e<1)q(String(C));else{var n=D?Math.min(e,D):e;W(n),q(String(n))}},onKeyDown:function(e){"Enter"===e.key&&e.currentTarget.blur(),"Escape"===e.key&&(q(String(C)),e.currentTarget.blur())},style:{width:"40px",height:"28px",border:"1px solid #E5E7EB",borderRadius:"4px",background:"#FFFFFF",color:"#111827",fontSize:"14px",fontWeight:500,textAlign:"center",outline:"none",boxSizing:"border-box"}}),n.jsx("span",e.__assign({style:{fontSize:"14px",fontWeight:500,color:"#111827"}},{children:"/"})),n.jsx("span",e.__assign({style:{fontSize:"14px",fontWeight:500,color:"#111827"}},{children:String(D)}))]})),j&&n.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:"4px"}},{children:[n.jsx(B,{}),n.jsx("div",e.__assign({style:{fontSize:"14px",fontWeight:500,width:"56px",textAlign:"center"}},{children:n.jsx(P,{})})),n.jsx(E,{})]})),!!l&&w&&n.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:"4px"}},{children:[n.jsxs("span",e.__assign({style:{fontSize:"14px",color:"#475467",fontWeight:500,lineHeight:1}},{children:[c," of ",l]})),n.jsx("button",e.__assign({style:{background:"none",border:"none",cursor:c<=1?"not-allowed":"pointer",padding:"2px 4px",color:c<=1?"#D0D5DD":"#475467",display:"flex",alignItems:"center",justifyContent:"center",lineHeight:1,height:"20px",width:"20px"},onClick:L,disabled:c<=1},{children:n.jsx("svg",e.__assign({width:"12",height:"12",viewBox:"0 0 12 12",fill:"none"},{children:n.jsx("path",{d:"M2 8L6 4L10 8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}))})),n.jsx("button",e.__assign({style:{background:"none",border:"none",cursor:c===l?"not-allowed":"pointer",padding:"2px 4px",color:c===l?"#D0D5DD":"#475467",display:"flex",alignItems:"center",justifyContent:"center",lineHeight:1,height:"20px",width:"20px"},onClick:z,disabled:c===l},{children:n.jsx("svg",e.__assign({width:"12",height:"12",viewBox:"0 0 12 12",fill:"none"},{children:n.jsx("path",{d:"M2 4L6 8L10 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}))}))]})),n.jsx("div",{style:{width:"1px",height:"20px",background:"#D1D5DB",margin:"0 4px",flexShrink:0}}),n.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:"8px",flexShrink:0,whiteSpace:"nowrap"}},{children:[!1!==k&&((null==v?void 0:v.icon)&&(null==v?void 0:v.onClick)?n.jsx(d.default,e.__assign({title:(null==v?void 0:v.tooltip)||"",arrow:!0,placement:"top"},{children:n.jsx("div",e.__assign({onClick:v.onClick,style:e.__assign({display:"flex",alignItems:"center",cursor:"pointer"},N)},{children:v.icon}))})):n.jsx("button",e.__assign({onClick:function(){var e=null==u?void 0:u.current;e&&(document.fullscreenElement?document.exitFullscreen():e.requestFullscreen().catch(function(e){console.error("Error attempting to enable fullscreen: ".concat(e.message))}))},style:N,title:"Full Screen"},{children:(null==_?void 0:_.fullScreenIcon)||n.jsx(s.DefaultFullScreenIcon,{})}))),x&&n.jsx("a",e.__assign({href:x,target:"_blank",rel:"noopener noreferrer",style:N,title:"Open in new tab"},{children:(null==_?void 0:_.downloadIcon)||n.jsx(s.DefaultDownloadIcon,{})})),g&&n.jsx("button",e.__assign({onClick:g,style:N,title:"Close"},{children:(null==_?void 0:_.closeIcon)||n.jsx(s.DefaultCloseIcon,{})}))]}))]}))]})),S&&n.jsxs("div",e.__assign({style:{background:"#EEF2FF",border:"1px solid #A5B4FC",borderRadius:"8px",color:"#4F46E5",display:"flex",alignItems:"center",gap:"12px",minWidth:0,padding:"10px 16px",fontSize:"12px",fontWeight:500,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"}},{children:[n.jsx(d.default,e.__assign({title:F,arrow:!0,placement:"top"},{children:n.jsx(o.Info,{size:16,color:"#4F46E5",strokeWidth:2,style:{flexShrink:0}})})),n.jsx("span",e.__assign({style:{overflow:"hidden",textOverflow:"ellipsis"}},{children:n.jsx(d.default,e.__assign({title:S.title,arrow:!0,placement:"top"},{children:n.jsxs("span",{children:["Viewing ",S.title," • Pages ",S.start_page,"-",S.end_page]})}))}))]}))]}))};
2
2
  //# sourceMappingURL=PdfToolbar.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("react/jsx-runtime"),n=require("@react-pdf-viewer/core"),i=require("./PdfContainer.js"),r=require("./PdfToolbar.js"),o=require("./PdfStyle.js"),a=require("./usePdfHighlight.js");require("@react-pdf-viewer/zoom/lib/styles/index.css"),require("@react-pdf-viewer/page-navigation/lib/styles/index.css"),require("@react-pdf-viewer/core/lib/styles/index.css"),require("@react-pdf-viewer/search/lib/styles/index.css");var u=require("react"),l=require("../ScannedDocCitation/ScannedDocCitation.js");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=s(u),d=function(e){switch(e){case"ActualSize":return n.SpecialZoomLevel.ActualSize;case"PageFit":return n.SpecialZoomLevel.PageFit;case"PageWidth":return n.SpecialZoomLevel.PageWidth;default:return null!=e?e:n.SpecialZoomLevel.PageWidth}};exports.default=function(s){var g,f=s.pdfUrl,v=s.highlightText,h=s.highlightPages,p=s.highlightCordinatePages,m=s.highlightColor,_=void 0===m?"yellow":m,x=s.activeHighlightColor,P=void 0===x?"#f7dc51":x,w=s.jumpToPageValue,S=void 0===w?0:w,T=s.pdfName,C=s.onClose,y=s.customStyles,b=s.customClasses,q=s.customIcons,A=s.useCoordinates,j=s.fallbackPages,R=s.activeCitationIndex,I=s.onActiveCitationChange,H=s.headerAction,L=s.isZoomEnabled,N=void 0===L||L,F=s.showHighlightsAction,M=void 0===F||F,E=s.defaultScale,Z=void 0===E?n.SpecialZoomLevel.ActualSize:E,B=s.useRange,D=void 0!==B&&B,V=s.rangeOfPages,W=void 0===V?null:V,z=s.showFullScreenAction,O=void 0===z||z,k=s.segments,U=void 0===k?[{title:"Document 2",start_page:52,end_page:52,page_count:1}]:k,J=s.segmentTooltipText,K=s.onCurrentPageChange,G=s.navigationRequest,Q=s.onNavigationSettled,X=s.disablePdfAnnotations,Y=void 0!==X&&X,$=s.renderPage,ee=s.setRenderRange,te=u.useRef(null),ne=u.useState(0),ie=ne[0],re=ne[1],oe=u.useState(0),ae=oe[0],ue=oe[1],le=u.useRef(null),se=u.useRef(null),ce=u.useRef(0),de=u.useMemo(function(){return Y?function(n){var i=e.__assign(e.__assign({},n),{annotationLayer:e.__assign(e.__assign({},n.annotationLayer),{children:null})});return $?$(i):t.jsxs(t.Fragment,{children:[n.canvasLayer.children,n.textLayer.children]})}:$},[Y,$]),ge=u.useMemo(function(){if(A)return new Set(p.map(function(e){return e.pageIndex}));var e=new Set;return Object.values(h).forEach(function(t){t>0&&e.add(t-1)}),e},[p,h,A]),fe=(g=v)&&0!==g.length?g.filter(function(e){return!g.some(function(t){return t!==e&&t.includes(e)})}):g,ve=a.PdfHighlightControls(fe,A?{}:h,te,ge,A,A?p:[],_,P),he=ve.highlightIndex,pe=ve.cursorIndex,me=ve.setCursorIndex,_e=ve.orderedKeys,xe=ve.totalHighlights,Pe=ve.getValidPosition,we=ve.tryJump,Se=ve.jumpToPage,Te=ve.plugins,Ce=ve.controls,ye=ve.hideNonTargetHighlights,be=ve.deduplicateHighlights,qe=Pe(pe),Ae=u.useMemo(function(){var e=ie+1;return U.find(function(t){return e>=t.start_page&&e<=t.end_page})},[ie,U]);u.useEffect(function(){void 0!==R&&R!==pe&&me(R)},[R]);var je=e.__assign(e.__assign({},Ce),{goToNext:function(){pe>=xe-1||(Ce.goToNext(),I&&I(pe+1))},goToPrevious:function(){pe<=0||(Ce.goToPrevious(),I&&I(pe-1))}}),Re=c.default.useCallback(function(e,t){ce.current+=1;var n=ce.current;null!=se.current&&window.clearTimeout(se.current);var i=null,r=0,o=0,a=function(){var u,l;if(ce.current===n){var s=null===(u=te.current)||void 0===u?void 0:u.querySelector(".rpv-core__inner-pages"),c=null===(l=te.current)||void 0===l?void 0:l.querySelector('[data-testid="core__page-layer-'.concat(t-1,'"]'));o+=1,s&&(i===s.scrollTop?r+=1:(i=s.scrollTop,r=0));var d=null==s?void 0:s.getBoundingClientRect(),g=null==c?void 0:c.getBoundingClientRect(),f=Boolean(d&&g&&g.bottom>d.top&&g.top<d.bottom);if(r>=2&&f||o>=40)return se.current=null,void(null==Q||Q({pageNumber:t,requestId:e.requestId}));se.current=window.setTimeout(a,50)}};se.current=window.setTimeout(a,50)},[Q]);if(u.useEffect(function(){return function(){ce.current+=1,null!=se.current&&window.clearTimeout(se.current)}},[]),u.useEffect(function(){var e;if(G&&!(ae<=0)){var t=Math.min(Math.max(Math.trunc(G.pageNumber),1),ae),n="".concat(null!==(e=G.requestId)&&void 0!==e?e:t,":").concat(t);le.current!==n&&(le.current=n,re(t-1),Se(t-1),Re(G,t))}},[Se,G,ae,Re]),!f)return t.jsx(l.default,{pages:j,activeCitationIndex:R,onActiveCitationChange:I,headerAction:H});return t.jsxs("div",e.__assign({ref:te,className:(null==b?void 0:b.pdfViewerWrapper)||"",style:e.__assign(e.__assign(e.__assign({height:"100%",minHeight:0,minWidth:0,overflow:"hidden",display:"flex",flexDirection:"column"},o.pdfStyles.pdfViewer),{display:"flex",flexDirection:"column",height:"100%",width:"100%",backgroundColor:"#FAFAFA"}),null==y?void 0:y.pdfViewer)},{children:[t.jsx(r.default,{highlightIndex:he,totalHighlights:xe,controls:je,currentPosition:qe,pdfName:T,onClose:C,pdfUrl:f,viewerRef:te,customStyles:y,customClasses:b,customIcons:q,headerAction:H,isZoomEnabled:N,showHighlightsAction:M,showFullScreenAction:O,currentSegment:Ae,segmentTooltipText:J,currentPage:ie+1,totalPages:ae,onPageNavigate:function(e){var t=Math.min(Math.max(e,1),ae||e);re(t-1),Se(t-1)}}),t.jsx(i.default,{defaultScale:d(Z),pdfUrl:f,plugins:Te,customStyles:y,onLoad:function(t){ue(t.doc.numPages);var n=!A&&!D&&S<=0;if(S>0&&!D){var i=S-1,r=_e[i],o=h[r],a=p[i];me(i),console.log(a,"cordinateTargetHighlight"),A&&a.pageIndex>0&&Se(a.pageIndex),o>0&&(setTimeout(function(){ye(ge),be(o-1)},1e3),A||Se(o-1))}else if(D&&W&&2===W.length){e.__awaiter(void 0,void 0,void 0,function(){var t,n,i,r,o;return e.__generator(this,function(e){switch(e.label){case 0:t=W[0],n=W[1],i=t,e.label=1;case 1:return i<=n?(Se(r=i-1),[4,new Promise(function(e){return setTimeout(e,1e3)})]):[3,4];case 2:if(e.sent(),ye(ge),(o=be(r))&&o>0)return[3,4];e.label=3;case 3:return i++,[3,1];case 4:return[2]}})})}else if(!A&&h){var u=_e.find(function(e){return h[e]>0});if(void 0!==u){var l=h[u]-1;Se(l),setTimeout(function(){ye(ge),be(l)},1e3)}}requestAnimationFrame(function(){n&&we(),!A&&S>0&&!D&&function(){if(te.current){var e=S-1,t=_e[e],n=h[t],i=n>0?n-1:0,r={};_e.forEach(function(e,t){var n=h[e];n>0&&(r[n]||(r[n]=[]),r[n].push(t))});var o=(r[n]||[]).indexOf(e),a=0,u=function(){var e,t;if(!(++a>40)){var n=null===(e=te.current)||void 0===e?void 0:e.querySelector(".rpv-core__inner-pages");if(n){var r=null===(t=te.current)||void 0===t?void 0:t.querySelector('[data-testid="core__page-layer-'.concat(i,'"]'));if(r){var l=n.getBoundingClientRect(),s=r.getBoundingClientRect();if(s.top<l.bottom&&s.bottom>l.top){var c=r.querySelectorAll(".rpv-search__highlight")[o];if(c){var d=c.getBoundingClientRect(),g=n.scrollTop+(d.top-l.top)-n.clientHeight/2+d.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;re(t),null==K||K(t+1),ge.has(t)?(be(t),ye(ge)):ye(ge)},renderPage:de,setRenderRange:ee})]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("react/jsx-runtime"),n=require("@react-pdf-viewer/core"),i=require("./PdfContainer.js"),r=require("./PdfToolbar.js"),o=require("./PdfStyle.js"),a=require("./usePdfHighlight.js");require("@react-pdf-viewer/zoom/lib/styles/index.css"),require("@react-pdf-viewer/page-navigation/lib/styles/index.css"),require("@react-pdf-viewer/core/lib/styles/index.css"),require("@react-pdf-viewer/search/lib/styles/index.css");var u=require("react"),l=require("../ScannedDocCitation/ScannedDocCitation.js");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=s(u),d=function(e){switch(e){case"ActualSize":return n.SpecialZoomLevel.ActualSize;case"PageFit":return n.SpecialZoomLevel.PageFit;case"PageWidth":return n.SpecialZoomLevel.PageWidth;default:return null!=e?e:n.SpecialZoomLevel.PageWidth}};function g(e){var t=e.canvasLayerRendered,n=e.markRendered,i=e.pageIndex;return u.useEffect(function(){t&&n(i)},[t,n,i]),null}exports.default=function(s){var f,v=s.pdfUrl,h=s.highlightText,p=s.highlightPages,m=s.highlightCordinatePages,_=s.highlightColor,x=void 0===_?"yellow":_,y=s.activeHighlightColor,P=void 0===y?"#f7dc51":y,T=s.jumpToPageValue,w=void 0===T?0:T,S=s.pdfName,C=s.onClose,b=s.customStyles,q=s.customClasses,R=s.customIcons,L=s.useCoordinates,j=s.fallbackPages,A=s.activeCitationIndex,I=s.onActiveCitationChange,H=s.headerAction,F=s.isZoomEnabled,N=void 0===F||F,M=s.showHighlightsAction,E=void 0===M||M,Z=s.defaultScale,k=void 0===Z?n.SpecialZoomLevel.ActualSize:Z,B=s.useRange,D=void 0!==B&&B,V=s.rangeOfPages,W=void 0===V?null:V,z=s.showFullScreenAction,O=void 0===z||z,U=s.segments,J=void 0===U?[{title:"Document 2",start_page:52,end_page:52,page_count:1}]:U,K=s.segmentTooltipText,G=s.onCurrentPageChange,Q=s.navigationRequest,X=s.onNavigationSettled,Y=s.disablePdfAnnotations,$=void 0!==Y&&Y,ee=s.disablePdfTextLayer,te=void 0!==ee&&ee,ne=s.renderPage,ie=s.setRenderRange,re=u.useRef(null),oe=u.useState(0),ae=oe[0],ue=oe[1],le=u.useState(0),se=le[0],ce=le[1],de=u.useRef(null),ge=u.useRef(null),fe=u.useRef(0),ve=u.useMemo(function(){return $||te?function(n){var i=e.__assign(e.__assign({},n),{annotationLayer:e.__assign(e.__assign({},n.annotationLayer),{children:$?null:n.annotationLayer.children}),textLayer:e.__assign(e.__assign({},n.textLayer),{children:te?null:n.textLayer.children})}),r=ne?ne(i):t.jsxs(t.Fragment,{children:[n.canvasLayer.children,!te&&n.textLayer.children,!$&&n.annotationLayer.children]});return t.jsxs(t.Fragment,{children:[r,te&&t.jsx(g,{canvasLayerRendered:n.canvasLayerRendered,markRendered:n.markRendered,pageIndex:n.pageIndex})]})}:ne},[$,te,ne]),he=u.useMemo(function(){if(L)return new Set(m.map(function(e){return e.pageIndex}));var e=new Set;return Object.values(p).forEach(function(t){t>0&&e.add(t-1)}),e},[m,p,L]),pe=(f=h)&&0!==f.length?f.filter(function(e){return!f.some(function(t){return t!==e&&t.includes(e)})}):f,me=a.PdfHighlightControls(pe,L?{}:p,re,he,L,L?m:[],x,P),_e=me.highlightIndex,xe=me.cursorIndex,ye=me.setCursorIndex,Pe=me.orderedKeys,Te=me.totalHighlights,we=me.getValidPosition,Se=me.tryJump,Ce=me.jumpToPage,be=me.plugins,qe=me.controls,Re=me.hideNonTargetHighlights,Le=me.deduplicateHighlights,je=we(xe),Ae=u.useMemo(function(){var e=ae+1;return J.find(function(t){return e>=t.start_page&&e<=t.end_page})},[ae,J]);u.useEffect(function(){void 0!==A&&A!==xe&&ye(A)},[A]);var Ie=e.__assign(e.__assign({},qe),{goToNext:function(){xe>=Te-1||(qe.goToNext(),I&&I(xe+1))},goToPrevious:function(){xe<=0||(qe.goToPrevious(),I&&I(xe-1))}}),He=c.default.useCallback(function(e,t){fe.current+=1;var n=fe.current;null!=ge.current&&window.clearTimeout(ge.current);var i=null,r=0,o=0,a=function(){var u,l;if(fe.current===n){var s=null===(u=re.current)||void 0===u?void 0:u.querySelector(".rpv-core__inner-pages"),c=null===(l=re.current)||void 0===l?void 0:l.querySelector('[data-testid="core__page-layer-'.concat(t-1,'"]'));o+=1,s&&(i===s.scrollTop?r+=1:(i=s.scrollTop,r=0));var d=null==s?void 0:s.getBoundingClientRect(),g=null==c?void 0:c.getBoundingClientRect(),f=Boolean(d&&g&&g.bottom>d.top&&g.top<d.bottom);if(r>=2&&f||o>=40)return ge.current=null,void(null==X||X({pageNumber:t,requestId:e.requestId}));ge.current=window.setTimeout(a,50)}};ge.current=window.setTimeout(a,50)},[X]);if(u.useEffect(function(){return function(){fe.current+=1,null!=ge.current&&window.clearTimeout(ge.current)}},[]),u.useEffect(function(){var e;if(Q&&!(se<=0)){var t=Math.min(Math.max(Math.trunc(Q.pageNumber),1),se),n="".concat(null!==(e=Q.requestId)&&void 0!==e?e:t,":").concat(t);de.current!==n&&(de.current=n,ue(t-1),Ce(t-1),He(Q,t))}},[Ce,Q,se,He]),!v)return t.jsx(l.default,{pages:j,activeCitationIndex:A,onActiveCitationChange:I,headerAction:H});return t.jsxs("div",e.__assign({ref:re,className:(null==q?void 0:q.pdfViewerWrapper)||"","data-disable-pdf-annotations":$?"true":void 0,style:e.__assign(e.__assign(e.__assign({height:"100%",minHeight:0,minWidth:0,overflow:"hidden",display:"flex",flexDirection:"column"},o.pdfStyles.pdfViewer),{display:"flex",flexDirection:"column",height:"100%",width:"100%",backgroundColor:"#FAFAFA"}),null==b?void 0:b.pdfViewer)},{children:[t.jsx(r.default,{highlightIndex:_e,totalHighlights:Te,controls:Ie,currentPosition:je,pdfName:S,onClose:C,pdfUrl:v,viewerRef:re,customStyles:b,customClasses:q,customIcons:R,headerAction:H,isZoomEnabled:N,showHighlightsAction:E,showFullScreenAction:O,currentSegment:Ae,segmentTooltipText:K,currentPage:ae+1,totalPages:se,onPageNavigate:function(e){var t=Math.min(Math.max(e,1),se||e);ue(t-1),Ce(t-1)}}),t.jsx(i.default,{defaultScale:d(k),pdfUrl:v,plugins:be,customStyles:b,onLoad:function(t){ce(t.doc.numPages);var n=!L&&!D&&w<=0;if(w>0&&!D){var i=w-1,r=Pe[i],o=p[r],a=m[i];ye(i),console.log(a,"cordinateTargetHighlight"),L&&a.pageIndex>0&&Ce(a.pageIndex),o>0&&(setTimeout(function(){Re(he),Le(o-1)},1e3),L||Ce(o-1))}else if(D&&W&&2===W.length){e.__awaiter(void 0,void 0,void 0,function(){var t,n,i,r,o;return e.__generator(this,function(e){switch(e.label){case 0:t=W[0],n=W[1],i=t,e.label=1;case 1:return i<=n?(Ce(r=i-1),[4,new Promise(function(e){return setTimeout(e,1e3)})]):[3,4];case 2:if(e.sent(),Re(he),(o=Le(r))&&o>0)return[3,4];e.label=3;case 3:return i++,[3,1];case 4:return[2]}})})}else if(!L&&p){var u=Pe.find(function(e){return p[e]>0});if(void 0!==u){var l=p[u]-1;Ce(l),setTimeout(function(){Re(he),Le(l)},1e3)}}requestAnimationFrame(function(){n&&Se(),!L&&w>0&&!D&&function(){if(re.current){var e=w-1,t=Pe[e],n=p[t],i=n>0?n-1:0,r={};Pe.forEach(function(e,t){var n=p[e];n>0&&(r[n]||(r[n]=[]),r[n].push(t))});var o=(r[n]||[]).indexOf(e),a=0,u=function(){var e,t;if(!(++a>40)){var n=null===(e=re.current)||void 0===e?void 0:e.querySelector(".rpv-core__inner-pages");if(n){var r=null===(t=re.current)||void 0===t?void 0:t.querySelector('[data-testid="core__page-layer-'.concat(i,'"]'));if(r){var l=n.getBoundingClientRect(),s=r.getBoundingClientRect();if(s.top<l.bottom&&s.bottom>l.top){var c=r.querySelectorAll(".rpv-search__highlight")[o];if(c){var d=c.getBoundingClientRect(),g=n.scrollTop+(d.top-l.top)-n.clientHeight/2+d.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;ue(t),null==G||G(t+1),he.has(t)?(Le(t),Re(he)):Re(he)},renderPage:ve,setRenderRange:ie})]}))};
2
2
  //# sourceMappingURL=PdfViewer.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),t=require("react"),i=require("@react-pdf-viewer/core"),r=require("../PdfViewer/PdfViewer.js"),o=require("./BoundaryCard.js"),a=require("./CardWrapper.js"),l=require("./CognitiveIntegrity.js"),s=require("./LabelCheck.js"),u=require("./reviewStepAdapters.js"),d=require("lucide-react"),c=require("@mui/material"),g=require("./helper.js"),f=260,v=function(e){return{reviewId:e.id,segment:e.segment,pageNumber:e.pageNumber}};exports.default=function(p){var m,h,_,b,w,x,y,C,S,k,E=this,j=p.pdfUrl,R=p.pdfName,I=p.segments,N=p.styles,M=p.pdfViewerProps,A=p.showBadges,F=void 0===A||A,B=p.sortByConfidence,P=void 0===B?"low":B,q=p.filterByConfidence,L=void 0===q?"all":q,W=p.showBadgeNavigation,z=void 0===W||W,T=p.autoSelectReviewOnPageChange,O=void 0!==T&&T,D=p.autoAdvanceAfterConfirm,V=void 0===D||D,G=p.badgePreloadPages,H=void 0===G?8:G,U=p.badgeOffsetTop,X=void 0===U?20:U,J=p.badgeOffsetRight,Y=void 0===J?68:J,Z=p.badgeOffsetLeft,K=void 0===Z?0:Z,Q=p.initialReviewId,$=p.onBoundaryAction,ee=p.onLabelAction,ne=p.onActiveReviewChange,te=p.onCurrentPageChange,ie=p.onActionError,re=p.disableAllActions,oe=void 0!==re&&re,ae=p.disablePdfAnnotations,le=void 0!==ae&&ae,se=p.disableTitleCheckUntilBoundaryCheckCompleted,ue=void 0!==se&&se,de=p.onAdjustManually,ce=p.onCognitiveClick,ge=p.className,fe=p.style,ve=p.viewerStyle,pe=p.railStyle,me=p.redirectionData,he=t.useMemo(function(){return u.extractSegmentReviewData(I)},[I]),_e=he.boundaryReviews,be=he.labelReviews,we=t.useMemo(function(){return new Map(I.map(function(e,n){return[e.stable_key,n+1]}))},[I]),xe=t.useRef(null),ye=t.useMemo(function(){return e.__spreadArray(e.__spreadArray([],_e.map(function(n){var t;return e.__assign(e.__assign({},n),{kind:"boundary",pageNumber:null!==(t=n.metadata.focus_page)&&void 0!==t?t:n.segment.start_page})}),!0),be.map(function(n){return e.__assign(e.__assign({},n),{kind:"label",pageNumber:n.segment.start_page})}),!0).sort(function(e,n){var t,i,r=null!==(t=we.get(e.segment.stable_key))&&void 0!==t?t:Number.MAX_SAFE_INTEGER,o=null!==(i=we.get(n.segment.stable_key))&&void 0!==i?i:Number.MAX_SAFE_INTEGER;return e.pageNumber-n.pageNumber||r-o||e.reviewStepIndex-n.reviewStepIndex||e.id.localeCompare(n.id)})},[_e,be,we]),Ce=t.useMemo(function(){return I.map(function(n){var t;return e.__assign(e.__assign({},n),{title:(null===(t=n.label)||void 0===t?void 0:t.trim())||n.title})})},[I]),Se=t.useState(1),ke=Se[0],Ee=Se[1],je=t.useState(null!=Q?Q:null),Re=je[0],Ie=je[1],Ne=t.useState(null!=Q?Q:null),Me=Ne[0],Ae=Ne[1],Fe=t.useState(!1),Be=Fe[0],Pe=Fe[1],qe=t.useState(null),Le=qe[0],We=qe[1],ze=t.useState(null),Te=ze[0],Oe=ze[1],De=t.useState(function(){return new Set}),Ve=De[0],Ge=De[1],He=t.useState(null),Ue=He[0],Xe=He[1],Je=t.useRef(0),Ye=t.useRef(null),Ze=t.useRef(null),Ke=t.useRef(new Map),Qe=t.useRef(null),$e=t.useRef(null),en=t.useState(f),nn=en[0],tn=en[1],rn=null!==(h=null===(m=null==N?void 0:N.aside)||void 0===m?void 0:m.width)&&void 0!==h?h:"40%",on="min(".concat("number"==typeof rn?"".concat(rn,"px"):rn,", ").concat(f,"px, 100%)");t.useEffect(function(){var e=xe.current;if(e&&F){var n=function(){var n=e.getBoundingClientRect().width;n>0&&tn(n)};n();var t="undefined"==typeof ResizeObserver?null:new ResizeObserver(n);return null==t||t.observe(e),function(){return null==t?void 0:t.disconnect()}}},[F]);var an=t.useMemo(function(){var e=new Set(Ve);return ye.forEach(function(n){null!=n.review_step.review&&e.add(n.id)}),e},[Ve,ye]),ln=t.useMemo(function(){var e;return null!==(e=ye.find(function(e){return e.id===Re}))&&void 0!==e?e:null},[Re,ye]),sn=t.useMemo(function(){return!(!ue||"label"!==(null==ln?void 0:ln.kind))&&_e.some(function(e){return e.segment.stable_key===ln.segment.stable_key&&!an.has(e.id)})},[ln,_e,ue,an]),un=null==ln?-1:I.findIndex(function(e){return e.stable_key===ln.segment.stable_key}),dn=un>0?I[un-1]:void 0,cn=un>=0?I[un+1]:void 0,gn=(null===(_=null==dn?void 0:dn.label)||void 0===_?void 0:_.trim())||(null==dn?void 0:dn.title),fn=(null===(b=null==cn?void 0:cn.label)||void 0===b?void 0:b.trim())||(null==cn?void 0:cn.title),vn=g.getConfidenceColors(null==ln?void 0:ln.review_step.score,null==ln?void 0:ln.review_step.confidence,null===(w=null==ln?void 0:ln.segment.confidence)||void 0===w?void 0:w.awaiting_llm),pn=(null===(x=null==ln?void 0:ln.review_step.reasons)||void 0===x?void 0:x.length)?ln.review_step.reasons:null!==(C=null===(y=null==ln?void 0:ln.segment.confidence)||void 0===y?void 0:y.reasons)&&void 0!==C?C:[],mn=Boolean(pn.some(function(e){return e.text.trim()&&["evidence","gap"].includes(e.type.trim().toLowerCase())})||(null===(S=null==ln?void 0:ln.review_step.reason)||void 0===S?void 0:S.trim())||(null===(k=null==ln?void 0:ln.review_step.gap)||void 0===k?void 0:k.trim())),hn=t.useCallback(function(e,n){Je.current+=1,Ye.current={requestId:Je.current,pageNumber:e,reviewId:n},Oe({pageNumber:e,requestId:Je.current})},[]),_n=t.useCallback(function(e){var n;!0!==(null===(n=e.segment.confidence)||void 0===n?void 0:n.awaiting_llm)&&(Ie(e.id),Ae(e.id),Pe(!1),We(null),hn(e.pageNumber,e.id),null==ne||ne(e.id,e.segment))},[ne,hn]);t.useEffect(function(){if((null==me?void 0:me.pageNumber)&&me.type){var e=Number(me.pageNumber);if(Number.isInteger(e)&&!(e<1)){var n=ye.find(function(n){return n.segment.start_page===e&&n.kind===me.type});n&&_n(n)}}},[me,_n,ye]);var bn=t.useCallback(function(){Ye.current=null,Pe(!1),Ie(null),We(null),null==ne||ne(null,null)},[ne]),wn=t.useCallback(function(e){var n;if(V){var t=ye.findIndex(function(n){return n.id===e}),i=new Set(ye.map(function(e){return e.id})),r=null!==(n=ye.find(function(n,r){return r>t&&n.id!==e&&i.has(n.id)}))&&void 0!==n?n:ye.find(function(n){return n.id!==e});r?requestAnimationFrame(function(){return _n(r)}):bn()}else bn()},[V,bn,ye,_n,ye]),xn=t.useCallback(function(n,t,i){return e.__awaiter(E,void 0,void 0,function(){var r,a,l,s,u;return e.__generator(this,function(e){switch(e.label){case 0:if(oe)return[2];r=v(n),a=t,l="boundary"===n.kind&&null!=$&&V&&(a===o.BoundaryReviewActionEnum.SPLIT_HERE||a===o.BoundaryReviewActionEnum.MERGE_NEXT||a===o.BoundaryReviewActionEnum.MERGE_PREVIOUS),s=l?I.findIndex(function(e){return e.stable_key===n.segment.stable_key}):-1,l&&s>=0&&(Ze.current={action:a,originalSegmentIndex:s,segmentSignature:JSON.stringify(I.map(function(e){return e.stable_key})),ready:!1}),Xe(n.id),e.label=1;case 1:return e.trys.push([1,6,7,8]),"boundary"!==n.kind?[3,3]:[4,null==$?void 0:$(t,i,r)];case 2:return e.sent(),[3,5];case 3:return[4,null==ee?void 0:ee(t,i,r)];case 4:e.sent(),e.label=5;case 5:return Ge(function(e){var t=new Set(e);return t.add(n.id),t}),Ze.current?Ze.current.ready=!0:wn(n.id),[3,8];case 6:return u=e.sent(),l&&(Ze.current=null),null==ie||ie(u,r),[3,8];case 7:return Xe(null),[7];case 8:return[2]}})})},[V,oe,ie,$,ee,I,wn]);t.useEffect(function(){var e=Ze.current;if((null==e?void 0:e.ready)&&JSON.stringify(I.map(function(e){return e.stable_key}))!==e.segmentSignature){var n=e.action===o.BoundaryReviewActionEnum.MERGE_PREVIOUS?e.originalSegmentIndex:e.originalSegmentIndex+1,t=new Map(I.map(function(e,n){return[e.stable_key,n]})),i=ye.find(function(e){var i,r=t.get(e.segment.stable_key);return null!=r&&r>=n&&null==e.review_step.review&&!Ve.has(e.id)&&!0!==(null===(i=e.segment.confidence)||void 0===i?void 0:i.awaiting_llm)});if(!i)return Ze.current=null,void bn();requestAnimationFrame(function(){Ze.current=null,_n(i)})}},[bn,Ve,ye,I,_n]),t.useEffect(function(){Ze.current||Re&&!ye.some(function(e){return e.id===Re})&&bn()},[Re,bn,ye]),t.useEffect(function(){if(O&&!Ze.current){var e=ye.find(function(e){return e.pageNumber===ke});e&&e.id!==Re&&_n(e)}},[Re,O,ke,_n,ye]),t.useEffect(function(){Ze.current||Re&&!ye.some(function(e){var n;return e.id===Re&&!0!==(null===(n=e.segment.confidence)||void 0===n?void 0:n.awaiting_llm)})&&bn()},[Re,bn,ye]);var yn=t.useMemo(function(){var n=ye.filter(function(e){var n;return!0!==(null===(n=e.segment.confidence)||void 0===n?void 0:n.awaiting_llm)});if("all"===L)return n;var t=["low","medium","high"].filter(function(e){return e!==P}),i=e.__spreadArray([P],t,!0),r=new Map(i.map(function(e,n){return[e,n]}));return n.map(function(e,n){return{item:e,index:n}}).sort(function(e,n){var t,o,a,l,s=null===(t=e.item.review_step.confidence)||void 0===t?void 0:t.trim().toLowerCase(),u=null===(o=n.item.review_step.confidence)||void 0===o?void 0:o.trim().toLowerCase();return(null==s?i.length:null!==(a=r.get(s))&&void 0!==a?a:i.length)-(null==u?i.length:null!==(l=r.get(u))&&void 0!==l?l:i.length)||e.index-n.index}).map(function(e){return e.item})},[L,P,ye]),Cn=yn.findIndex(function(e){return e.id===Me}),Sn=t.useState(null),kn=Sn[0],En=Sn[1],jn=t.useRef(!1),Rn=t.useCallback(function(e){var n=yn[e];n&&_n(n)},[yn,_n]);t.useEffect(function(){Me&&!yn.some(function(e){return e.id===Me})&&Ae(null)},[yn,Me]),t.useEffect(function(){jn.current=!1,En(Cn>=0?String(Cn+1):null)},[Cn,yn.length]),t.useEffect(function(){if(jn.current&&null!=kn){var e=window.setTimeout(function(){var e=Number(kn.trim()),n=e-1;Number.isInteger(e)&&n>=0&&n<yn.length&&(jn.current=!1,Rn(n))},300);return function(){return window.clearTimeout(e)}}},[Rn,kn,yn.length]);var In=t.useMemo(function(){var e=new Map;ye.forEach(function(n){var t,i=null!==(t=e.get(n.segment.stable_key))&&void 0!==t?t:[];i.push(n),e.set(n.segment.stable_key,i)});var n=new Map;return e.forEach(function(e,t){var i,r=null!==(i=we.get(t))&&void 0!==i?i:1;e.sort(function(e,n){return e.reviewStepIndex-n.reviewStepIndex}).forEach(function(e,t){n.set(e.id,"".concat(r).concat(function(e){for(var n=e+1,t="";n>0;)n-=1,t=String.fromCharCode(65+n%26)+t,n=Math.floor(n/26);return t}(t)))})}),n},[ye,we]),Nn=t.useMemo(function(){var e=new Map;ye.forEach(function(n){var t,i=null!==(t=e.get(n.pageNumber))&&void 0!==t?t:[];i.push(n),e.set(n.pageNumber,i)});var n=new Map;return e.forEach(function(e){e.forEach(function(e,t){return n.set(e.id,t)})}),n},[ye]),Mn=t.useCallback(function(e){return{startPage:Math.max(0,e.startPage-H),endPage:Math.min(e.numPages-1,e.endPage+H)}},[H]),An=t.useCallback(function(){var e,n=Qe.current,t=$e.current;if(n&&t){var i=n.getBoundingClientRect(),r=t.querySelector(".rpv-core__inner-pages"),o=null!==(e=null==r?void 0:r.getBoundingClientRect())&&void 0!==e?e:t.getBoundingClientRect();ye.forEach(function(e){var n,r=Ke.current.get(e.id);if(r){var a=t.querySelector('[data-testid="core__page-layer-'.concat(e.pageNumber-1,'"]'));if(a){var l=a.getBoundingClientRect(),s=null!==(n=Nn.get(e.id))&&void 0!==n?n:0,u=l.top+X+40*s,d=u+(r.offsetHeight||32),c=u>=o.top&&d<=o.bottom;r.style.top="".concat(u-i.top,"px"),r.style.visibility=c?"visible":"hidden"}else r.style.visibility="hidden"}})}},[X,Nn,ye]),Fn=t.useCallback(function(e){var n=Ye.current;n&&n.requestId===e.requestId&&n.pageNumber===e.pageNumber&&(Ye.current=null,An(),requestAnimationFrame(function(){if(null==Ye.current){var e=Ke.current.get(n.reviewId);e&&"hidden"!==e.style.visibility&&We(e)}}))},[An]);return t.useEffect(function(){var e=$e.current;if(e&&F){var n=null,t=function(){null==n&&(n=requestAnimationFrame(function(){n=null,An()}))};e.addEventListener("scroll",t,!0),window.addEventListener("resize",t);var i=new MutationObserver(t);i.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style"]});var r="undefined"==typeof ResizeObserver?null:new ResizeObserver(t);return null==r||r.observe(e),t(),function(){null!=n&&cancelAnimationFrame(n),e.removeEventListener("scroll",t,!0),window.removeEventListener("resize",t),i.disconnect(),null==r||r.disconnect()}}},[F,An]),n.jsxs("div",e.__assign({ref:Qe,className:ge,style:e.__assign(e.__assign({},fe),{display:"block",position:"relative",width:"100%",height:"100%",minWidth:0,overflowX:"auto",overflowY:"hidden"})},{children:[n.jsxs("div",e.__assign({className:"segment-review-wrapper__container",style:{display:"flex",alignItems:"stretch",gap:0,width:"100%",minWidth:700,height:"100%"}},{children:[n.jsx("div",e.__assign({ref:$e,style:e.__assign(e.__assign({},ve),{flex:"1 1 auto",width:F?"auto":"100%",minWidth:0,height:"100%",boxSizing:"border-box"})},{children:n.jsx(r.default,e.__assign({defaultScale:i.SpecialZoomLevel.PageFit,highlightText:[],highlightPages:{},highlightCordinatePages:[],useCoordinates:!1},M,{disablePdfAnnotations:le,pdfUrl:j,pdfName:R,segments:Ce,navigationRequest:Te,onNavigationSettled:Fn,setRenderRange:Mn,onCurrentPageChange:function(e){Ee(e),null==Ye.current&&ln&&ln.pageNumber!==e&&bn(),null==te||te(e)}}))})),F&&n.jsxs("aside",e.__assign({"aria-label":"Page review badges",ref:xe,style:e.__assign(e.__assign({},pe),{position:"relative",width:on,maxWidth:f,flex:"0 1 ".concat(on),minHeight:0,overflow:"hidden",boxSizing:"border-box"})},{children:[z&&yn.length>0&&n.jsxs("nav",e.__assign({"aria-label":"Review badge navigation",style:{position:"absolute",top:8,right:Y||"auto",left:K||"auto",zIndex:2,display:"flex",alignItems:"center",gap:7,width:128,minHeight:40,padding:"4px 6px",border:"1px solid #CBD5E1",borderRadius:6,backgroundColor:"#FFFFFF",boxSizing:"border-box",boxShadow:"0 1px 2px rgba(16, 24, 40, 0.06)",font:"inherit"}},{children:[n.jsx("input",{type:"text",inputMode:"numeric",pattern:"[0-9]*",value:null!=kn?kn:"-","aria-label":"Review badge number",onChange:function(e){jn.current=!0,En(e.target.value)},style:{width:30,height:28,padding:0,border:"1px solid #A5B4FC",borderRadius:3,color:"#4F46E5",backgroundColor:"#FFFFFF",textAlign:"center",font:"inherit",fontSize:15,outline:"none"}}),n.jsxs("span",e.__assign({"aria-label":"".concat(yn.length," reviews"),style:{flex:1,color:"#4F46E5",fontSize:14,whiteSpace:"nowrap",textAlign:"center"}},{children:["of ",yn.length]})),["previous","next"].map(function(t){var i="previous"===t,r=Cn+(i?-1:1),o=r<0||r>=yn.length;return n.jsx("button",e.__assign({type:"button","aria-label":"".concat(i?"Previous":"Next"," review badge"),disabled:o,onClick:function(){return Rn(r)},style:{display:"grid",placeItems:"center",width:17,height:28,padding:0,border:0,background:"transparent",color:o?"#C7D2FE":"#4F46E5",cursor:o?"default":"pointer"}},{children:n.jsx("svg",e.__assign({width:"12",height:"8",viewBox:"0 0 12 8",fill:"none"},{children:n.jsx("path",{d:i?"M1 7L6 2L11 7":"M1 1L6 6L11 1",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})}))}),t)})]})),ye.map(function(t){var i,r,o=Re===t.id,a=null!==(i=In.get(t.id))&&void 0!==i?i:"1A",l=t.review_step.score,s=t.review_step.confidence,u=g.formatScore(l,s),f=!0===(null===(r=t.segment.confidence)||void 0===r?void 0:r.awaiting_llm),v=g.getConfidenceColors(l,s,f),p=t.review_step.review&&null!==t.review_step.review.action,m=Boolean(p)||f;return n.jsx(c.Tooltip,e.__assign({title:f?"data is being processed":"",arrow:!0},{children:n.jsx("span",e.__assign({ref:function(e){e?Ke.current.set(t.id,e):Ke.current.delete(t.id)},style:{position:"absolute",top:0,left:10,visibility:"hidden",display:"inline-flex",cursor:m?"not-allowed":"pointer"}},{children:n.jsx("button",e.__assign({disabled:m,type:"button","aria-pressed":o,"aria-label":f?"".concat(t.review_step.type," · Page ").concat(t.pageNumber," · Data is being processed"):"".concat(t.review_step.type," · Page ").concat(t.pageNumber),onClick:function(){return _n(t)},style:{cursor:"inherit",display:"flex",alignItems:"center",justifyContent:"space-around",gap:4,width:p&&!f?105:80,minHeight:25,padding:"2px 5px",border:"1px solid ".concat(p&&!f?"#E2E8F0":v.border),borderRadius:16,backgroundColor:p&&!f?"#F8FAFC":v.background,color:p&&!f?"#475569":v.text,font:"inherit",alignContent:"center",boxShadow:"0 1px 2px rgba(16, 24, 40, 0.08)"}},{children:p&&!f?n.jsxs(c.Typography,e.__assign({fontFamily:"Inter",sx:{display:"flex",gap:1,alignItems:"center",flexDirection:"row"}},{children:[n.jsx("span",e.__assign({style:{fontSize:11,fontWeight:500}},{children:a})),n.jsxs("span",e.__assign({style:{display:"flex",alignItems:"center"}},{children:[n.jsx("svg",e.__assign({width:"2",height:"14",viewBox:"0 0 1 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:n.jsx("path",{d:"M0.399902 0V14",stroke:"#CBD5E1",strokeWidth:"0.8"})})),n.jsx("span",e.__assign({style:{fontSize:11,fontWeight:500,marginLeft:"7px",display:"flex",alignItems:"center"}},{children:"N/A"===u?u:"".concat(u,"%")}))]})),n.jsxs("span",e.__assign({style:{fontSize:11,fontWeight:500,display:"flex",alignItems:"center"}},{children:[n.jsx("svg",e.__assign({width:"2",height:"14",viewBox:"0 0 1 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:n.jsx("path",{d:"M0.399902 0V14",stroke:"#CBD5E1",strokeWidth:"0.8"})})),n.jsx("span",e.__assign({style:{display:"flex",marginLeft:"7px",alignItems:"center"}},{children:n.jsx(d.CircleCheck,{height:14,width:14,strokeWidth:2,color:"#16A34A"})}))]}))]})):n.jsxs(c.Typography,e.__assign({fontFamily:"Inter",sx:{display:"flex",gap:1,alignItems:"center",flexDirection:"row"}},{children:[n.jsx("span",e.__assign({style:{fontSize:11,fontWeight:500}},{children:a})),n.jsxs("span",e.__assign({style:{display:"flex",alignItems:"center"}},{children:[n.jsx("svg",e.__assign({width:"2",height:"14",viewBox:"0 0 1 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:n.jsx("path",{d:"M0.399902 0V14",stroke:v.divider,strokeWidth:"0.8"})})),n.jsx("span",e.__assign({style:{fontSize:11,fontWeight:500,marginLeft:"7px",display:"flex",alignItems:"center"}},{children:"N/A"===u?u:"".concat(u,"%")}))]}))]}))}))}))}),t.id)})]}))]})),ln&&Le&&n.jsxs(a.default,e.__assign({anchorElement:Le,placement:"bottom-start",offset:{top:8},width:Math.min(nn,f),maxWidth:f},{children:[Be&&n.jsx(l.default,{width:"100%",maxWidth:"100%",score:ln.review_step.score,reasons:pn,reason:ln.review_step.reason,gap:ln.review_step.gap,onBack:function(){return Pe(!1)},onClose:bn}),n.jsx("div",e.__assign({style:{display:Be?"none":"block"}},{children:ln.review_step.review&&ln.review_step.human_resolution?n.jsx(n.Fragment,{}):"boundary"===ln.kind?n.jsx(o.default,{width:"100%",maxWidth:"100%",title:ln.segment.label||ln.segment.title,pageNo:"Page ".concat(ln.pageNumber),content:ln.review_step.reason,cognitiveScore:ln.review_step.score,metadata:ln.metadata,previousSegmentTitle:gn,nextSegmentTitle:fn,defaultStartPage:ln.segment.start_page,defaultEndPage:ln.segment.end_page,styles:{root:{borderColor:vn.cardBorder},header:{"& > .MuiSvgIcon-root, & .MuiTypography-root":{color:vn.text}}},confirmDisabled:oe||Ue===ln.id,onConfirm:function(e,n,t){t&&o.isBoundaryReviewAction(n.id)&&xn(ln,n.id,t)},onAdjustManually:function(){return null==de?void 0:de(v(ln))},onCognitiveClick:mn?function(){Pe(!0),null==ce||ce(v(ln))}:void 0,onClose:bn},ln.id):n.jsx(s.default,{width:"100%",maxWidth:"100%",title:ln.metadata.current_label||ln.segment.label||ln.segment.title,pageNo:"Pages ".concat(ln.segment.start_page,"-").concat(ln.segment.end_page),content:ln.review_step.reason,cognitiveScore:ln.review_step.score,metadata:ln.metadata,styles:{root:{borderColor:vn.cardBorder},header:{"& > .MuiSvgIcon-root, & .MuiTypography-root":{color:vn.text}}},confirmDisabled:oe||Ue===ln.id,confirmationBlocked:sn,confirmationWarning:sn?"Please confirm the boundary before confirming the title.":void 0,onActionConfirm:function(e,n){xn(ln,e,n)},onAdjustManually:function(){return null==de?void 0:de(v(ln))},onCognitiveClick:mn?function(){Pe(!0),null==ce||ce(v(ln))}:void 0,onClose:bn},ln.id)}))]}))]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),t=require("react"),i=require("@react-pdf-viewer/core"),r=require("../PdfViewer/PdfViewer.js"),o=require("./BoundaryCard.js"),a=require("./CardWrapper.js"),l=require("./CognitiveIntegrity.js"),s=require("./LabelCheck.js"),u=require("./reviewStepAdapters.js"),d=require("lucide-react"),c=require("@mui/material"),g=require("./helper.js"),f=260,v=function(e){return{reviewId:e.id,segment:e.segment,pageNumber:e.pageNumber}};exports.default=function(p){var m,h,_,b,w,x,y,C,S,k,E=this,j=p.pdfUrl,R=p.pdfName,I=p.segments,N=p.styles,M=p.pdfViewerProps,A=p.showBadges,F=void 0===A||A,P=p.sortByConfidence,B=void 0===P?"low":P,q=p.filterByConfidence,L=void 0===q?"all":q,W=p.showBadgeNavigation,T=void 0===W||W,z=p.autoSelectReviewOnPageChange,O=void 0!==z&&z,D=p.autoAdvanceAfterConfirm,V=void 0===D||D,G=p.badgePreloadPages,H=void 0===G?8:G,U=p.badgeOffsetTop,X=void 0===U?20:U,J=p.badgeOffsetRight,Y=void 0===J?68:J,Z=p.badgeOffsetLeft,K=void 0===Z?0:Z,Q=p.initialReviewId,$=p.onBoundaryAction,ee=p.onLabelAction,ne=p.onActiveReviewChange,te=p.onCurrentPageChange,ie=p.onActionError,re=p.disableAllActions,oe=void 0!==re&&re,ae=p.disablePdfAnnotations,le=void 0!==ae&&ae,se=p.disablePdfTextLayer,ue=void 0===se||se,de=p.disableTitleCheckUntilBoundaryCheckCompleted,ce=void 0!==de&&de,ge=p.onAdjustManually,fe=p.onCognitiveClick,ve=p.className,pe=p.style,me=p.viewerStyle,he=p.railStyle,_e=p.redirectionData,be=t.useMemo(function(){return u.extractSegmentReviewData(I)},[I]),we=be.boundaryReviews,xe=be.labelReviews,ye=t.useMemo(function(){return new Map(I.map(function(e,n){return[e.stable_key,n+1]}))},[I]),Ce=t.useRef(null),Se=t.useMemo(function(){return e.__spreadArray(e.__spreadArray([],we.map(function(n){var t;return e.__assign(e.__assign({},n),{kind:"boundary",pageNumber:null!==(t=n.metadata.focus_page)&&void 0!==t?t:n.segment.start_page})}),!0),xe.map(function(n){return e.__assign(e.__assign({},n),{kind:"label",pageNumber:n.segment.start_page})}),!0).sort(function(e,n){var t,i,r=null!==(t=ye.get(e.segment.stable_key))&&void 0!==t?t:Number.MAX_SAFE_INTEGER,o=null!==(i=ye.get(n.segment.stable_key))&&void 0!==i?i:Number.MAX_SAFE_INTEGER;return e.pageNumber-n.pageNumber||r-o||e.reviewStepIndex-n.reviewStepIndex||e.id.localeCompare(n.id)})},[we,xe,ye]),ke=t.useMemo(function(){return I.map(function(n){var t;return e.__assign(e.__assign({},n),{title:(null===(t=n.label)||void 0===t?void 0:t.trim())||n.title})})},[I]),Ee=t.useState(1),je=Ee[0],Re=Ee[1],Ie=t.useState(null!=Q?Q:null),Ne=Ie[0],Me=Ie[1],Ae=t.useState(null!=Q?Q:null),Fe=Ae[0],Pe=Ae[1],Be=t.useState(!1),qe=Be[0],Le=Be[1],We=t.useState(null),Te=We[0],ze=We[1],Oe=t.useState(null),De=Oe[0],Ve=Oe[1],Ge=t.useState(function(){return new Set}),He=Ge[0],Ue=Ge[1],Xe=t.useState(null),Je=Xe[0],Ye=Xe[1],Ze=t.useRef(0),Ke=t.useRef(null),Qe=t.useRef(null),$e=t.useRef(new Map),en=t.useRef(null),nn=t.useRef(null),tn=t.useState(f),rn=tn[0],on=tn[1],an=null!==(h=null===(m=null==N?void 0:N.aside)||void 0===m?void 0:m.width)&&void 0!==h?h:"40%",ln="min(".concat("number"==typeof an?"".concat(an,"px"):an,", ").concat(f,"px, 100%)");t.useEffect(function(){var e=Ce.current;if(e&&F){var n=function(){var n=e.getBoundingClientRect().width;n>0&&on(n)};n();var t="undefined"==typeof ResizeObserver?null:new ResizeObserver(n);return null==t||t.observe(e),function(){return null==t?void 0:t.disconnect()}}},[F]);var sn=t.useMemo(function(){var e=new Set(He);return Se.forEach(function(n){null!=n.review_step.review&&e.add(n.id)}),e},[He,Se]),un=t.useMemo(function(){var e;return null!==(e=Se.find(function(e){return e.id===Ne}))&&void 0!==e?e:null},[Ne,Se]),dn=t.useMemo(function(){return!(!ce||"label"!==(null==un?void 0:un.kind))&&we.some(function(e){return e.segment.stable_key===un.segment.stable_key&&!sn.has(e.id)})},[un,we,ce,sn]),cn=null==un?-1:I.findIndex(function(e){return e.stable_key===un.segment.stable_key}),gn=cn>0?I[cn-1]:void 0,fn=cn>=0?I[cn+1]:void 0,vn=(null===(_=null==gn?void 0:gn.label)||void 0===_?void 0:_.trim())||(null==gn?void 0:gn.title),pn=(null===(b=null==fn?void 0:fn.label)||void 0===b?void 0:b.trim())||(null==fn?void 0:fn.title),mn=g.getConfidenceColors(null==un?void 0:un.review_step.score,null==un?void 0:un.review_step.confidence,null===(w=null==un?void 0:un.segment.confidence)||void 0===w?void 0:w.awaiting_llm),hn=(null===(x=null==un?void 0:un.review_step.reasons)||void 0===x?void 0:x.length)?un.review_step.reasons:null!==(C=null===(y=null==un?void 0:un.segment.confidence)||void 0===y?void 0:y.reasons)&&void 0!==C?C:[],_n=Boolean(hn.some(function(e){return e.text.trim()&&["evidence","gap"].includes(e.type.trim().toLowerCase())})||(null===(S=null==un?void 0:un.review_step.reason)||void 0===S?void 0:S.trim())||(null===(k=null==un?void 0:un.review_step.gap)||void 0===k?void 0:k.trim())),bn=t.useCallback(function(e,n){Ze.current+=1,Ke.current={requestId:Ze.current,pageNumber:e,reviewId:n},Ve({pageNumber:e,requestId:Ze.current})},[]),wn=t.useCallback(function(e){var n;!0!==(null===(n=e.segment.confidence)||void 0===n?void 0:n.awaiting_llm)&&(Me(e.id),Pe(e.id),Le(!1),ze(null),bn(e.pageNumber,e.id),null==ne||ne(e.id,e.segment))},[ne,bn]);t.useEffect(function(){if((null==_e?void 0:_e.pageNumber)&&_e.type){var e=Number(_e.pageNumber);if(Number.isInteger(e)&&!(e<1)){var n=Se.find(function(n){return n.segment.start_page===e&&n.kind===_e.type});n&&wn(n)}}},[_e,wn,Se]);var xn=t.useCallback(function(){Ke.current=null,Le(!1),Me(null),ze(null),null==ne||ne(null,null)},[ne]),yn=t.useCallback(function(e){var n;if(V){var t=Se.findIndex(function(n){return n.id===e}),i=new Set(Se.map(function(e){return e.id})),r=null!==(n=Se.find(function(n,r){return r>t&&n.id!==e&&i.has(n.id)}))&&void 0!==n?n:Se.find(function(n){return n.id!==e});r?requestAnimationFrame(function(){return wn(r)}):xn()}else xn()},[V,xn,Se,wn,Se]),Cn=t.useCallback(function(n,t,i){return e.__awaiter(E,void 0,void 0,function(){var r,a,l,s,u;return e.__generator(this,function(e){switch(e.label){case 0:if(oe)return[2];r=v(n),a=t,l="boundary"===n.kind&&null!=$&&V&&(a===o.BoundaryReviewActionEnum.SPLIT_HERE||a===o.BoundaryReviewActionEnum.MERGE_NEXT||a===o.BoundaryReviewActionEnum.MERGE_PREVIOUS),s=l?I.findIndex(function(e){return e.stable_key===n.segment.stable_key}):-1,l&&s>=0&&(Qe.current={action:a,originalSegmentIndex:s,segmentSignature:JSON.stringify(I.map(function(e){return e.stable_key})),ready:!1}),Ye(n.id),e.label=1;case 1:return e.trys.push([1,6,7,8]),"boundary"!==n.kind?[3,3]:[4,null==$?void 0:$(t,i,r)];case 2:return e.sent(),[3,5];case 3:return[4,null==ee?void 0:ee(t,i,r)];case 4:e.sent(),e.label=5;case 5:return Ue(function(e){var t=new Set(e);return t.add(n.id),t}),Qe.current?Qe.current.ready=!0:yn(n.id),[3,8];case 6:return u=e.sent(),l&&(Qe.current=null),null==ie||ie(u,r),[3,8];case 7:return Ye(null),[7];case 8:return[2]}})})},[V,oe,ie,$,ee,I,yn]);t.useEffect(function(){var e=Qe.current;if((null==e?void 0:e.ready)&&JSON.stringify(I.map(function(e){return e.stable_key}))!==e.segmentSignature){var n=e.action===o.BoundaryReviewActionEnum.MERGE_PREVIOUS?e.originalSegmentIndex:e.originalSegmentIndex+1,t=new Map(I.map(function(e,n){return[e.stable_key,n]})),i=Se.find(function(e){var i,r=t.get(e.segment.stable_key);return null!=r&&r>=n&&null==e.review_step.review&&!He.has(e.id)&&!0!==(null===(i=e.segment.confidence)||void 0===i?void 0:i.awaiting_llm)});if(!i)return Qe.current=null,void xn();requestAnimationFrame(function(){Qe.current=null,wn(i)})}},[xn,He,Se,I,wn]),t.useEffect(function(){Qe.current||Ne&&!Se.some(function(e){return e.id===Ne})&&xn()},[Ne,xn,Se]),t.useEffect(function(){if(O&&!Qe.current){var e=Se.find(function(e){return e.pageNumber===je});e&&e.id!==Ne&&wn(e)}},[Ne,O,je,wn,Se]),t.useEffect(function(){Qe.current||Ne&&!Se.some(function(e){var n;return e.id===Ne&&!0!==(null===(n=e.segment.confidence)||void 0===n?void 0:n.awaiting_llm)})&&xn()},[Ne,xn,Se]);var Sn=t.useMemo(function(){var n=Se.filter(function(e){var n;return!0!==(null===(n=e.segment.confidence)||void 0===n?void 0:n.awaiting_llm)});if("all"===L)return n;var t=["low","medium","high"].filter(function(e){return e!==B}),i=e.__spreadArray([B],t,!0),r=new Map(i.map(function(e,n){return[e,n]}));return n.map(function(e,n){return{item:e,index:n}}).sort(function(e,n){var t,o,a,l,s=null===(t=e.item.review_step.confidence)||void 0===t?void 0:t.trim().toLowerCase(),u=null===(o=n.item.review_step.confidence)||void 0===o?void 0:o.trim().toLowerCase();return(null==s?i.length:null!==(a=r.get(s))&&void 0!==a?a:i.length)-(null==u?i.length:null!==(l=r.get(u))&&void 0!==l?l:i.length)||e.index-n.index}).map(function(e){return e.item})},[L,B,Se]),kn=Sn.findIndex(function(e){return e.id===Fe}),En=t.useState(null),jn=En[0],Rn=En[1],In=t.useRef(!1),Nn=t.useCallback(function(e){var n=Sn[e];n&&wn(n)},[Sn,wn]);t.useEffect(function(){Fe&&!Sn.some(function(e){return e.id===Fe})&&Pe(null)},[Sn,Fe]),t.useEffect(function(){In.current=!1,Rn(kn>=0?String(kn+1):null)},[kn,Sn.length]),t.useEffect(function(){if(In.current&&null!=jn){var e=window.setTimeout(function(){var e=Number(jn.trim()),n=e-1;Number.isInteger(e)&&n>=0&&n<Sn.length&&(In.current=!1,Nn(n))},300);return function(){return window.clearTimeout(e)}}},[Nn,jn,Sn.length]);var Mn=t.useMemo(function(){var e=new Map;Se.forEach(function(n){var t,i=null!==(t=e.get(n.segment.stable_key))&&void 0!==t?t:[];i.push(n),e.set(n.segment.stable_key,i)});var n=new Map;return e.forEach(function(e,t){var i,r=null!==(i=ye.get(t))&&void 0!==i?i:1;e.sort(function(e,n){return e.reviewStepIndex-n.reviewStepIndex}).forEach(function(e,t){n.set(e.id,"".concat(r).concat(function(e){for(var n=e+1,t="";n>0;)n-=1,t=String.fromCharCode(65+n%26)+t,n=Math.floor(n/26);return t}(t)))})}),n},[Se,ye]),An=t.useMemo(function(){var e=new Map;Se.forEach(function(n){var t,i=null!==(t=e.get(n.pageNumber))&&void 0!==t?t:[];i.push(n),e.set(n.pageNumber,i)});var n=new Map;return e.forEach(function(e){e.forEach(function(e,t){return n.set(e.id,t)})}),n},[Se]),Fn=t.useCallback(function(e){return{startPage:Math.max(0,e.startPage-H),endPage:Math.min(e.numPages-1,e.endPage+H)}},[H]),Pn=t.useCallback(function(){var e,n=en.current,t=nn.current;if(n&&t){var i=n.getBoundingClientRect(),r=t.querySelector(".rpv-core__inner-pages"),o=null!==(e=null==r?void 0:r.getBoundingClientRect())&&void 0!==e?e:t.getBoundingClientRect();Se.forEach(function(e){var n,r=$e.current.get(e.id);if(r){var a=t.querySelector('[data-testid="core__page-layer-'.concat(e.pageNumber-1,'"]'));if(a){var l=a.getBoundingClientRect(),s=null!==(n=An.get(e.id))&&void 0!==n?n:0,u=l.top+X+40*s,d=u+(r.offsetHeight||32),c=u>=o.top&&d<=o.bottom;r.style.top="".concat(u-i.top,"px"),r.style.visibility=c?"visible":"hidden"}else r.style.visibility="hidden"}})}},[X,An,Se]),Bn=t.useCallback(function(e){var n=Ke.current;n&&n.requestId===e.requestId&&n.pageNumber===e.pageNumber&&(Ke.current=null,Pn(),requestAnimationFrame(function(){if(null==Ke.current){var e=$e.current.get(n.reviewId);e&&"hidden"!==e.style.visibility&&ze(e)}}))},[Pn]);return t.useEffect(function(){var e=nn.current;if(e&&F){var n=null,t=function(){null==n&&(n=requestAnimationFrame(function(){n=null,Pn()}))};e.addEventListener("scroll",t,!0),window.addEventListener("resize",t);var i=new MutationObserver(t);i.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style"]});var r="undefined"==typeof ResizeObserver?null:new ResizeObserver(t);return null==r||r.observe(e),t(),function(){null!=n&&cancelAnimationFrame(n),e.removeEventListener("scroll",t,!0),window.removeEventListener("resize",t),i.disconnect(),null==r||r.disconnect()}}},[F,Pn]),n.jsxs("div",e.__assign({ref:en,className:ve,style:e.__assign(e.__assign({},pe),{display:"block",position:"relative",width:"100%",height:"100%",minWidth:0,overflowX:"auto",overflowY:"hidden"})},{children:[n.jsxs("div",e.__assign({className:"segment-review-wrapper__container",style:{display:"flex",alignItems:"stretch",gap:0,width:"100%",minWidth:700,height:"100%"}},{children:[n.jsx("div",e.__assign({ref:nn,style:e.__assign(e.__assign({},me),{flex:"1 1 auto",width:F?"auto":"100%",minWidth:0,height:"100%",boxSizing:"border-box"})},{children:n.jsx(r.default,e.__assign({defaultScale:i.SpecialZoomLevel.PageFit,highlightText:[],highlightPages:{},highlightCordinatePages:[],useCoordinates:!1},M,{disablePdfAnnotations:le,disablePdfTextLayer:ue,pdfUrl:j,pdfName:R,segments:ke,navigationRequest:De,onNavigationSettled:Bn,setRenderRange:Fn,onCurrentPageChange:function(e){Re(e),null==Ke.current&&un&&un.pageNumber!==e&&xn(),null==te||te(e)}}))})),F&&n.jsxs("aside",e.__assign({"aria-label":"Page review badges",ref:Ce,style:e.__assign(e.__assign({},he),{position:"relative",width:ln,maxWidth:f,flex:"0 1 ".concat(ln),minHeight:0,overflow:"hidden",boxSizing:"border-box"})},{children:[T&&Sn.length>0&&n.jsxs("nav",e.__assign({"aria-label":"Review badge navigation",style:{position:"absolute",top:8,right:Y||"auto",left:K||"auto",zIndex:2,display:"flex",alignItems:"center",gap:7,width:128,minHeight:40,padding:"4px 6px",border:"1px solid #CBD5E1",borderRadius:6,backgroundColor:"#FFFFFF",boxSizing:"border-box",boxShadow:"0 1px 2px rgba(16, 24, 40, 0.06)",font:"inherit"}},{children:[n.jsx("input",{type:"text",inputMode:"numeric",pattern:"[0-9]*",value:null!=jn?jn:"-","aria-label":"Review badge number",onChange:function(e){In.current=!0,Rn(e.target.value)},style:{width:30,height:28,padding:0,border:"1px solid #A5B4FC",borderRadius:3,color:"#4F46E5",backgroundColor:"#FFFFFF",textAlign:"center",font:"inherit",fontSize:15,outline:"none"}}),n.jsxs("span",e.__assign({"aria-label":"".concat(Sn.length," reviews"),style:{flex:1,color:"#4F46E5",fontSize:14,whiteSpace:"nowrap",textAlign:"center"}},{children:["of ",Sn.length]})),["previous","next"].map(function(t){var i="previous"===t,r=kn+(i?-1:1),o=r<0||r>=Sn.length;return n.jsx("button",e.__assign({type:"button","aria-label":"".concat(i?"Previous":"Next"," review badge"),disabled:o,onClick:function(){return Nn(r)},style:{display:"grid",placeItems:"center",width:17,height:28,padding:0,border:0,background:"transparent",color:o?"#C7D2FE":"#4F46E5",cursor:o?"default":"pointer"}},{children:n.jsx("svg",e.__assign({width:"12",height:"8",viewBox:"0 0 12 8",fill:"none"},{children:n.jsx("path",{d:i?"M1 7L6 2L11 7":"M1 1L6 6L11 1",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})}))}),t)})]})),Se.map(function(t){var i,r,o=Ne===t.id,a=null!==(i=Mn.get(t.id))&&void 0!==i?i:"1A",l=t.review_step.score,s=t.review_step.confidence,u=g.formatScore(l,s),f=!0===(null===(r=t.segment.confidence)||void 0===r?void 0:r.awaiting_llm),v=g.getConfidenceColors(l,s,f),p=t.review_step.review&&null!==t.review_step.review.action,m=Boolean(p)||f;return n.jsx(c.Tooltip,e.__assign({title:f?"data is being processed":"",arrow:!0},{children:n.jsx("span",e.__assign({ref:function(e){e?$e.current.set(t.id,e):$e.current.delete(t.id)},style:{position:"absolute",top:0,left:10,visibility:"hidden",display:"inline-flex",cursor:m?"not-allowed":"pointer"}},{children:n.jsx("button",e.__assign({disabled:m,type:"button","aria-pressed":o,"aria-label":f?"".concat(t.review_step.type," · Page ").concat(t.pageNumber," · Data is being processed"):"".concat(t.review_step.type," · Page ").concat(t.pageNumber),onClick:function(){return wn(t)},style:{cursor:"inherit",display:"flex",alignItems:"center",justifyContent:"space-around",gap:4,width:p&&!f?105:80,minHeight:25,padding:"2px 5px",border:"1px solid ".concat(p&&!f?"#E2E8F0":v.border),borderRadius:16,backgroundColor:p&&!f?"#F8FAFC":v.background,color:p&&!f?"#475569":v.text,font:"inherit",alignContent:"center",boxShadow:"0 1px 2px rgba(16, 24, 40, 0.08)"}},{children:p&&!f?n.jsxs(c.Typography,e.__assign({fontFamily:"Inter",sx:{display:"flex",gap:1,alignItems:"center",flexDirection:"row"}},{children:[n.jsx("span",e.__assign({style:{fontSize:11,fontWeight:500}},{children:a})),n.jsxs("span",e.__assign({style:{display:"flex",alignItems:"center"}},{children:[n.jsx("svg",e.__assign({width:"2",height:"14",viewBox:"0 0 1 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:n.jsx("path",{d:"M0.399902 0V14",stroke:"#CBD5E1",strokeWidth:"0.8"})})),n.jsx("span",e.__assign({style:{fontSize:11,fontWeight:500,marginLeft:"7px",display:"flex",alignItems:"center"}},{children:"N/A"===u?u:"".concat(u,"%")}))]})),n.jsxs("span",e.__assign({style:{fontSize:11,fontWeight:500,display:"flex",alignItems:"center"}},{children:[n.jsx("svg",e.__assign({width:"2",height:"14",viewBox:"0 0 1 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:n.jsx("path",{d:"M0.399902 0V14",stroke:"#CBD5E1",strokeWidth:"0.8"})})),n.jsx("span",e.__assign({style:{display:"flex",marginLeft:"7px",alignItems:"center"}},{children:n.jsx(d.CircleCheck,{height:14,width:14,strokeWidth:2,color:"#16A34A"})}))]}))]})):n.jsxs(c.Typography,e.__assign({fontFamily:"Inter",sx:{display:"flex",gap:1,alignItems:"center",flexDirection:"row"}},{children:[n.jsx("span",e.__assign({style:{fontSize:11,fontWeight:500}},{children:a})),n.jsxs("span",e.__assign({style:{display:"flex",alignItems:"center"}},{children:[n.jsx("svg",e.__assign({width:"2",height:"14",viewBox:"0 0 1 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:n.jsx("path",{d:"M0.399902 0V14",stroke:v.divider,strokeWidth:"0.8"})})),n.jsx("span",e.__assign({style:{fontSize:11,fontWeight:500,marginLeft:"7px",display:"flex",alignItems:"center"}},{children:"N/A"===u?u:"".concat(u,"%")}))]}))]}))}))}))}),t.id)})]}))]})),un&&Te&&n.jsxs(a.default,e.__assign({anchorElement:Te,placement:"bottom-start",offset:{top:8},width:Math.min(rn,f),maxWidth:f},{children:[qe&&n.jsx(l.default,{width:"100%",maxWidth:"100%",score:un.review_step.score,reasons:hn,reason:un.review_step.reason,gap:un.review_step.gap,onBack:function(){return Le(!1)},onClose:xn}),n.jsx("div",e.__assign({style:{display:qe?"none":"block"}},{children:un.review_step.review&&un.review_step.human_resolution?n.jsx(n.Fragment,{}):"boundary"===un.kind?n.jsx(o.default,{width:"100%",maxWidth:"100%",title:un.segment.label||un.segment.title,pageNo:"Page ".concat(un.pageNumber),content:un.review_step.reason,cognitiveScore:un.review_step.score,metadata:un.metadata,previousSegmentTitle:vn,nextSegmentTitle:pn,defaultStartPage:un.segment.start_page,defaultEndPage:un.segment.end_page,styles:{root:{borderColor:mn.cardBorder},header:{"& > .MuiSvgIcon-root, & .MuiTypography-root":{color:mn.text}}},confirmDisabled:oe||Je===un.id,onConfirm:function(e,n,t){t&&o.isBoundaryReviewAction(n.id)&&Cn(un,n.id,t)},onAdjustManually:function(){return null==ge?void 0:ge(v(un))},onCognitiveClick:_n?function(){Le(!0),null==fe||fe(v(un))}:void 0,onClose:xn},un.id):n.jsx(s.default,{width:"100%",maxWidth:"100%",title:un.metadata.current_label||un.segment.label||un.segment.title,pageNo:"Pages ".concat(un.segment.start_page,"-").concat(un.segment.end_page),content:un.review_step.reason,cognitiveScore:un.review_step.score,metadata:un.metadata,styles:{root:{borderColor:mn.cardBorder},header:{"& > .MuiSvgIcon-root, & .MuiTypography-root":{color:mn.text}}},confirmDisabled:oe||Je===un.id,confirmationBlocked:dn,confirmationWarning:dn?"Please confirm the boundary before confirming the title.":void 0,onActionConfirm:function(e,n){Cn(un,e,n)},onAdjustManually:function(){return null==ge?void 0:ge(v(un))},onCognitiveClick:_n?function(){Le(!0),null==fe||fe(v(un))}:void 0,onClose:xn},un.id)}))]}))]}))};
2
2
  //# sourceMappingURL=SegmentReviewPdfWrapper.js.map
@@ -1,2 +1,2 @@
1
- import{__assign as e}from"tslib";import{jsxs as t,jsx as n}from"react/jsx-runtime";import i from"react";import{pdfStyles as o}from"./PdfStyle.js";import{DefaultPdfIcon as r,DefaultFullScreenIcon as l,DefaultDownloadIcon as d,DefaultCloseIcon as a}from"../../assests/svg/PdfViewerIcons.js";import s from"@mui/material/Tooltip";import{Info as c}from"lucide-react";var p=function(p){p.highlightIndex;var h=p.totalHighlights,u=p.controls,g=p.currentPosition,f=p.pdfName,x=p.onClose,m=p.pdfUrl,v=p.viewerRef,y=p.customStyles,w=p.customClasses,b=p.customIcons,k=p.headerAction,S=p.isZoomEnabled,F=void 0===S||S,I=p.showHighlightsAction,C=void 0===I||I,W=p.showFullScreenAction,D=void 0===W||W,E=p.currentSegment,B=p.segmentTooltipText,j=void 0===B?"Details of current segment":B,L=p.currentPage,z=p.totalPages,A=p.onPageNavigate,P=u.ZoomInButton,T=u.ZoomOutButton,N=u.ZoomPopover,R=u.goToPrevious,H=u.goToNext,O=i.useState(String(L)),M=O[0],Z=O[1];i.useEffect(function(){Z(String(L))},[L]);var _={padding:"4px",borderRadius:"6px",background:"transparent",border:"none",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s ease",flexShrink:0},G=function(e){return String(e).padStart(2,"0")};return t("div",e({style:e(e(e({marginBottom:"12px",background:"#FAFAFA",borderBottom:"1px solid #F3F4F6",borderTopLeftRadius:"12px",borderTopRightRadius:"12px"},o.header),null==y?void 0:y.header),{display:"flex",flexDirection:"column",alignItems:"stretch",gap:"12px"})},{children:[t("div",e({style:{display:"flex",alignItems:"center",justifyContent:"space-between",flexWrap:"wrap",columnGap:"16px",rowGap:"12px",minWidth:0}},{children:[t("div",e({style:{display:"flex",alignItems:"center",gap:"12px",flex:"1 1 180px",minWidth:0}},{children:[n("div",e({style:e(e(e({},{borderRadius:"21px",border:"6px solid #E8F3FF",background:"#D5E8FF",display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",boxSizing:"content-box"}),null==y?void 0:y.pdfIconWrapper),{flexShrink:0})},{children:(null==b?void 0:b.pdfIcon)||n(r,{})})),n(s,e({title:f||"",arrow:!0,placement:"top"},{children:n("div",e({style:{flex:1,minWidth:0,overflow:"hidden"}},{children:n("span",e({style:e({display:"block",width:"100%",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",fontWeight:500,cursor:"default"},null==y?void 0:y.pdfName),className:null==w?void 0:w.pdfName},{children:f}))}))}))]})),t("div",e({style:{display:"flex",alignItems:"center",gap:C?"16px":"2px",color:"#4B5563",flex:"0 1 auto",marginLeft:"auto",whiteSpace:"nowrap",minWidth:0,maxWidth:"100%",overflowX:"auto",overflowY:"hidden",scrollbarWidth:"thin"}},{children:[z>0&&t("div",e({style:{display:"flex",alignItems:"center",gap:"4px",color:"#475467",flexShrink:0,whiteSpace:"nowrap"}},{children:[n("input",{"aria-label":"Current page",inputMode:"numeric",pattern:"[0-9]*",value:M,onChange:function(e){var t=e.target.value.replace(/\D/g,"");Z(t)},onBlur:function(){var e=Number(M);if(!Number.isInteger(e)||e<1)Z(String(L));else{var t=z?Math.min(e,z):e;A(t),Z(String(t))}},onKeyDown:function(e){"Enter"===e.key&&e.currentTarget.blur(),"Escape"===e.key&&(Z(String(L)),e.currentTarget.blur())},style:{width:"40px",height:"28px",border:"1px solid #E5E7EB",borderRadius:"4px",background:"#FFFFFF",color:"#111827",fontSize:"14px",fontWeight:500,textAlign:"center",outline:"none",boxSizing:"border-box"}}),n("span",e({style:{fontSize:"14px",fontWeight:500,color:"#111827"}},{children:"/"})),n("span",e({style:{fontSize:"14px",fontWeight:500,color:"#111827"}},{children:String(z)}))]})),F&&t("div",e({style:{display:"flex",alignItems:"center",gap:"4px"}},{children:[n(T,{}),n("div",e({style:{fontSize:"14px",fontWeight:500,width:"56px",textAlign:"center"}},{children:n(N,{})})),n(P,{})]})),!!h&&C&&t("div",e({style:{display:"flex",alignItems:"center",gap:"4px"}},{children:[t("span",e({style:{fontSize:"14px",color:"#475467",fontWeight:500,lineHeight:1}},{children:[g," of ",h]})),n("button",e({style:{background:"none",border:"none",cursor:g<=1?"not-allowed":"pointer",padding:"2px 4px",color:g<=1?"#D0D5DD":"#475467",display:"flex",alignItems:"center",justifyContent:"center",lineHeight:1,height:"20px",width:"20px"},onClick:R,disabled:g<=1},{children:n("svg",e({width:"12",height:"12",viewBox:"0 0 12 12",fill:"none"},{children:n("path",{d:"M2 8L6 4L10 8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}))})),n("button",e({style:{background:"none",border:"none",cursor:g===h?"not-allowed":"pointer",padding:"2px 4px",color:g===h?"#D0D5DD":"#475467",display:"flex",alignItems:"center",justifyContent:"center",lineHeight:1,height:"20px",width:"20px"},onClick:H,disabled:g===h},{children:n("svg",e({width:"12",height:"12",viewBox:"0 0 12 12",fill:"none"},{children:n("path",{d:"M2 4L6 8L10 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}))}))]})),n("div",{style:{width:"1px",height:"20px",background:"#D1D5DB",margin:"0 4px",flexShrink:0}}),t("div",e({style:{display:"flex",alignItems:"center",gap:"8px",flexShrink:0,whiteSpace:"nowrap"}},{children:[!1!==D&&((null==k?void 0:k.icon)&&(null==k?void 0:k.onClick)?n(s,e({title:(null==k?void 0:k.tooltip)||"",arrow:!0,placement:"top"},{children:n("div",e({onClick:k.onClick,style:e({display:"flex",alignItems:"center",cursor:"pointer"},_)},{children:k.icon}))})):n("button",e({onClick:function(){var e=null==v?void 0:v.current;e&&(document.fullscreenElement?document.exitFullscreen():e.requestFullscreen().catch(function(e){console.error("Error attempting to enable fullscreen: ".concat(e.message))}))},style:_,title:"Full Screen"},{children:(null==b?void 0:b.fullScreenIcon)||n(l,{})}))),m&&n("a",e({href:m,target:"_blank",rel:"noopener noreferrer",style:_,title:"Open in new tab"},{children:(null==b?void 0:b.downloadIcon)||n(d,{})})),x&&n("button",e({onClick:x,style:_,title:"Close"},{children:(null==b?void 0:b.closeIcon)||n(a,{})}))]}))]}))]})),E&&t("div",e({style:{background:"#EEF2FF",border:"1px solid #A5B4FC",borderRadius:"8px",color:"#4F46E5",display:"flex",alignItems:"center",gap:"12px",minWidth:0,padding:"10px 16px",fontSize:"12px",fontWeight:500,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"}},{children:[n(s,e({title:j,arrow:!0,placement:"top"},{children:n(c,{size:16,color:"#4F46E5",strokeWidth:2,style:{flexShrink:0}})})),n("span",e({style:{overflow:"hidden",textOverflow:"ellipsis"}},{children:n(s,e({title:E.title,arrow:!0,placement:"top"},{children:t("span",{children:["Viewing ",E.title," • Pages ",G(E.start_page),"-",G(E.end_page)]})}))}))]}))]}))};export{p as default};
1
+ import{__assign as e}from"tslib";import{jsxs as t,jsx as n}from"react/jsx-runtime";import i from"react";import{pdfStyles as o}from"./PdfStyle.js";import{DefaultPdfIcon as r,DefaultFullScreenIcon as l,DefaultDownloadIcon as d,DefaultCloseIcon as a}from"../../assests/svg/PdfViewerIcons.js";import s from"@mui/material/Tooltip";import{Info as c}from"lucide-react";var p=function(p){p.highlightIndex;var h=p.totalHighlights,u=p.controls,g=p.currentPosition,f=p.pdfName,x=p.onClose,m=p.pdfUrl,v=p.viewerRef,y=p.customStyles,w=p.customClasses,b=p.customIcons,k=p.headerAction,S=p.isZoomEnabled,F=void 0===S||S,I=p.showHighlightsAction,C=void 0===I||I,W=p.showFullScreenAction,D=void 0===W||W,E=p.currentSegment,B=p.segmentTooltipText,j=void 0===B?"Details of current segment":B,L=p.currentPage,z=p.totalPages,A=p.onPageNavigate,P=u.ZoomInButton,T=u.ZoomOutButton,N=u.ZoomPopover,R=u.goToPrevious,H=u.goToNext,O=i.useState(String(L)),M=O[0],Z=O[1];i.useEffect(function(){Z(String(L))},[L]);var _={padding:"4px",borderRadius:"6px",background:"transparent",border:"none",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s ease",flexShrink:0};return t("div",e({style:e(e(e({marginBottom:"12px",background:"#FAFAFA",borderBottom:"1px solid #F3F4F6",borderTopLeftRadius:"12px",borderTopRightRadius:"12px"},o.header),null==y?void 0:y.header),{display:"flex",flexDirection:"column",alignItems:"stretch",gap:"12px"})},{children:[t("div",e({style:{display:"flex",alignItems:"center",justifyContent:"space-between",flexWrap:"wrap",columnGap:"16px",rowGap:"12px",minWidth:0}},{children:[t("div",e({style:{display:"flex",alignItems:"center",gap:"12px",flex:"1 1 180px",minWidth:0}},{children:[n("div",e({style:e(e(e({},{borderRadius:"21px",border:"6px solid #E8F3FF",background:"#D5E8FF",display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",boxSizing:"content-box"}),null==y?void 0:y.pdfIconWrapper),{flexShrink:0})},{children:(null==b?void 0:b.pdfIcon)||n(r,{})})),n(s,e({title:f||"",arrow:!0,placement:"top"},{children:n("div",e({style:{flex:1,minWidth:0,overflow:"hidden"}},{children:n("span",e({style:e({display:"block",width:"100%",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",fontWeight:500,cursor:"default"},null==y?void 0:y.pdfName),className:null==w?void 0:w.pdfName},{children:f}))}))}))]})),t("div",e({style:{display:"flex",alignItems:"center",gap:C?"16px":"2px",color:"#4B5563",flex:"0 1 auto",marginLeft:"auto",whiteSpace:"nowrap",minWidth:0,maxWidth:"100%",overflowX:"auto",overflowY:"hidden",scrollbarWidth:"thin"}},{children:[z>0&&t("div",e({style:{display:"flex",alignItems:"center",gap:"4px",color:"#475467",flexShrink:0,whiteSpace:"nowrap"}},{children:[n("input",{"aria-label":"Current page",inputMode:"numeric",pattern:"[0-9]*",value:M,onChange:function(e){var t=e.target.value.replace(/\D/g,"");Z(t)},onBlur:function(){var e=Number(M);if(!Number.isInteger(e)||e<1)Z(String(L));else{var t=z?Math.min(e,z):e;A(t),Z(String(t))}},onKeyDown:function(e){"Enter"===e.key&&e.currentTarget.blur(),"Escape"===e.key&&(Z(String(L)),e.currentTarget.blur())},style:{width:"40px",height:"28px",border:"1px solid #E5E7EB",borderRadius:"4px",background:"#FFFFFF",color:"#111827",fontSize:"14px",fontWeight:500,textAlign:"center",outline:"none",boxSizing:"border-box"}}),n("span",e({style:{fontSize:"14px",fontWeight:500,color:"#111827"}},{children:"/"})),n("span",e({style:{fontSize:"14px",fontWeight:500,color:"#111827"}},{children:String(z)}))]})),F&&t("div",e({style:{display:"flex",alignItems:"center",gap:"4px"}},{children:[n(T,{}),n("div",e({style:{fontSize:"14px",fontWeight:500,width:"56px",textAlign:"center"}},{children:n(N,{})})),n(P,{})]})),!!h&&C&&t("div",e({style:{display:"flex",alignItems:"center",gap:"4px"}},{children:[t("span",e({style:{fontSize:"14px",color:"#475467",fontWeight:500,lineHeight:1}},{children:[g," of ",h]})),n("button",e({style:{background:"none",border:"none",cursor:g<=1?"not-allowed":"pointer",padding:"2px 4px",color:g<=1?"#D0D5DD":"#475467",display:"flex",alignItems:"center",justifyContent:"center",lineHeight:1,height:"20px",width:"20px"},onClick:R,disabled:g<=1},{children:n("svg",e({width:"12",height:"12",viewBox:"0 0 12 12",fill:"none"},{children:n("path",{d:"M2 8L6 4L10 8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}))})),n("button",e({style:{background:"none",border:"none",cursor:g===h?"not-allowed":"pointer",padding:"2px 4px",color:g===h?"#D0D5DD":"#475467",display:"flex",alignItems:"center",justifyContent:"center",lineHeight:1,height:"20px",width:"20px"},onClick:H,disabled:g===h},{children:n("svg",e({width:"12",height:"12",viewBox:"0 0 12 12",fill:"none"},{children:n("path",{d:"M2 4L6 8L10 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}))}))]})),n("div",{style:{width:"1px",height:"20px",background:"#D1D5DB",margin:"0 4px",flexShrink:0}}),t("div",e({style:{display:"flex",alignItems:"center",gap:"8px",flexShrink:0,whiteSpace:"nowrap"}},{children:[!1!==D&&((null==k?void 0:k.icon)&&(null==k?void 0:k.onClick)?n(s,e({title:(null==k?void 0:k.tooltip)||"",arrow:!0,placement:"top"},{children:n("div",e({onClick:k.onClick,style:e({display:"flex",alignItems:"center",cursor:"pointer"},_)},{children:k.icon}))})):n("button",e({onClick:function(){var e=null==v?void 0:v.current;e&&(document.fullscreenElement?document.exitFullscreen():e.requestFullscreen().catch(function(e){console.error("Error attempting to enable fullscreen: ".concat(e.message))}))},style:_,title:"Full Screen"},{children:(null==b?void 0:b.fullScreenIcon)||n(l,{})}))),m&&n("a",e({href:m,target:"_blank",rel:"noopener noreferrer",style:_,title:"Open in new tab"},{children:(null==b?void 0:b.downloadIcon)||n(d,{})})),x&&n("button",e({onClick:x,style:_,title:"Close"},{children:(null==b?void 0:b.closeIcon)||n(a,{})}))]}))]}))]})),E&&t("div",e({style:{background:"#EEF2FF",border:"1px solid #A5B4FC",borderRadius:"8px",color:"#4F46E5",display:"flex",alignItems:"center",gap:"12px",minWidth:0,padding:"10px 16px",fontSize:"12px",fontWeight:500,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"}},{children:[n(s,e({title:j,arrow:!0,placement:"top"},{children:n(c,{size:16,color:"#4F46E5",strokeWidth:2,style:{flexShrink:0}})})),n("span",e({style:{overflow:"hidden",textOverflow:"ellipsis"}},{children:n(s,e({title:E.title,arrow:!0,placement:"top"},{children:t("span",{children:["Viewing ",E.title," • Pages ",E.start_page,"-",E.end_page]})}))}))]}))]}))};export{p as default};
2
2
  //# sourceMappingURL=PdfToolbar.js.map
@@ -1,2 +1,2 @@
1
- import{__assign as e,__awaiter as t,__generator as n}from"tslib";import{jsxs as i,Fragment as o,jsx as r}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(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}},P=function(P){var T,w=P.pdfUrl,x=P.highlightText,C=P.highlightPages,y=P.highlightCordinatePages,b=P.highlightColor,S=void 0===b?"yellow":b,A=P.activeHighlightColor,_=void 0===A?"#f7dc51":A,I=P.jumpToPageValue,R=void 0===I?0:I,H=P.pdfName,q=P.onClose,N=P.customStyles,j=P.customClasses,F=P.customIcons,B=P.useCoordinates,D=P.fallbackPages,L=P.activeCitationIndex,M=P.onActiveCitationChange,V=P.headerAction,W=P.isZoomEnabled,z=void 0===W||W,E=P.showHighlightsAction,k=void 0===E||E,O=P.defaultScale,U=void 0===O?a.ActualSize:O,Z=P.useRange,J=void 0!==Z&&Z,K=P.rangeOfPages,G=void 0===K?null:K,Q=P.showFullScreenAction,X=void 0===Q||Q,Y=P.segments,$=void 0===Y?[{title:"Document 2",start_page:52,end_page:52,page_count:1}]:Y,ee=P.segmentTooltipText,te=P.onCurrentPageChange,ne=P.navigationRequest,ie=P.onNavigationSettled,oe=P.disablePdfAnnotations,re=void 0!==oe&&oe,ae=P.renderPage,le=P.setRenderRange,ue=g(null),ce=f(0),se=ce[0],de=ce[1],ge=f(0),fe=ge[0],he=ge[1],ve=g(null),me=g(null),pe=g(0),Pe=h(function(){return re?function(t){var n=e(e({},t),{annotationLayer:e(e({},t.annotationLayer),{children:null})});return ae?ae(n):i(o,{children:[t.canvasLayer.children,t.textLayer.children]})}:ae},[re,ae]),Te=h(function(){if(B)return new Set(y.map(function(e){return e.pageIndex}));var e=new Set;return Object.values(C).forEach(function(t){t>0&&e.add(t-1)}),e},[y,C,B]),we=(T=x)&&0!==T.length?T.filter(function(e){return!T.some(function(t){return t!==e&&t.includes(e)})}):T,xe=s(we,B?{}:C,ue,Te,B,B?y:[],S,_),Ce=xe.highlightIndex,ye=xe.cursorIndex,be=xe.setCursorIndex,Se=xe.orderedKeys,Ae=xe.totalHighlights,_e=xe.getValidPosition,Ie=xe.tryJump,Re=xe.jumpToPage,He=xe.plugins,qe=xe.controls,Ne=xe.hideNonTargetHighlights,je=xe.deduplicateHighlights,Fe=_e(ye),Be=h(function(){var e=se+1;return $.find(function(t){return e>=t.start_page&&e<=t.end_page})},[se,$]);v(function(){void 0!==L&&L!==ye&&be(L)},[L]);var De=e(e({},qe),{goToNext:function(){ye>=Ae-1||(qe.goToNext(),M&&M(ye+1))},goToPrevious:function(){ye<=0||(qe.goToPrevious(),M&&M(ye-1))}}),Le=d.useCallback(function(e,t){pe.current+=1;var n=pe.current;null!=me.current&&window.clearTimeout(me.current);var i=null,o=0,r=0,a=function(){var l,u;if(pe.current===n){var c=null===(l=ue.current)||void 0===l?void 0:l.querySelector(".rpv-core__inner-pages"),s=null===(u=ue.current)||void 0===u?void 0:u.querySelector('[data-testid="core__page-layer-'.concat(t-1,'"]'));r+=1,c&&(i===c.scrollTop?o+=1:(i=c.scrollTop,o=0));var d=null==c?void 0:c.getBoundingClientRect(),g=null==s?void 0:s.getBoundingClientRect(),f=Boolean(d&&g&&g.bottom>d.top&&g.top<d.bottom);if(o>=2&&f||r>=40)return me.current=null,void(null==ie||ie({pageNumber:t,requestId:e.requestId}));me.current=window.setTimeout(a,50)}};me.current=window.setTimeout(a,50)},[ie]);if(v(function(){return function(){pe.current+=1,null!=me.current&&window.clearTimeout(me.current)}},[]),v(function(){var e;if(ne&&!(fe<=0)){var t=Math.min(Math.max(Math.trunc(ne.pageNumber),1),fe),n="".concat(null!==(e=ne.requestId)&&void 0!==e?e:t,":").concat(t);ve.current!==n&&(ve.current=n,de(t-1),Re(t-1),Le(ne,t))}},[Re,ne,fe,Le]),!w)return r(m,{pages:D,activeCitationIndex:L,onActiveCitationChange:M,headerAction:V});return i("div",e({ref:ue,className:(null==j?void 0:j.pdfViewerWrapper)||"",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==N?void 0:N.pdfViewer)},{children:[r(u,{highlightIndex:Ce,totalHighlights:Ae,controls:De,currentPosition:Fe,pdfName:H,onClose:q,pdfUrl:w,viewerRef:ue,customStyles:N,customClasses:j,customIcons:F,headerAction:V,isZoomEnabled:z,showHighlightsAction:k,showFullScreenAction:X,currentSegment:Be,segmentTooltipText:ee,currentPage:se+1,totalPages:fe,onPageNavigate:function(e){var t=Math.min(Math.max(e,1),fe||e);de(t-1),Re(t-1)}}),r(l,{defaultScale:p(U),pdfUrl:w,plugins:He,customStyles:N,onLoad:function(e){he(e.doc.numPages);var i=!B&&!J&&R<=0;if(R>0&&!J){var o=R-1,r=Se[o],a=C[r],l=y[o];be(o),console.log(l,"cordinateTargetHighlight"),B&&l.pageIndex>0&&Re(l.pageIndex),a>0&&(setTimeout(function(){Ne(Te),je(a-1)},1e3),B||Re(a-1))}else if(J&&G&&2===G.length){t(void 0,void 0,void 0,function(){var e,t,i,o,r;return n(this,function(n){switch(n.label){case 0:e=G[0],t=G[1],i=e,n.label=1;case 1:return i<=t?(Re(o=i-1),[4,new Promise(function(e){return setTimeout(e,1e3)})]):[3,4];case 2:if(n.sent(),Ne(Te),(r=je(o))&&r>0)return[3,4];n.label=3;case 3:return i++,[3,1];case 4:return[2]}})})}else if(!B&&C){var u=Se.find(function(e){return C[e]>0});if(void 0!==u){var c=C[u]-1;Re(c),setTimeout(function(){Ne(Te),je(c)},1e3)}}requestAnimationFrame(function(){i&&Ie(),!B&&R>0&&!J&&function(){if(ue.current){var e=R-1,t=Se[e],n=C[t],i=n>0?n-1:0,o={};Se.forEach(function(e,t){var n=C[e];n>0&&(o[n]||(o[n]=[]),o[n].push(t))});var r=(o[n]||[]).indexOf(e),a=0,l=function(){var e,t;if(!(++a>40)){var n=null===(e=ue.current)||void 0===e?void 0:e.querySelector(".rpv-core__inner-pages");if(n){var o=null===(t=ue.current)||void 0===t?void 0:t.querySelector('[data-testid="core__page-layer-'.concat(i,'"]'));if(o){var u=n.getBoundingClientRect(),c=o.getBoundingClientRect();if(c.top<u.bottom&&c.bottom>u.top){var s=o.querySelectorAll(".rpv-search__highlight")[r];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;de(t),null==te||te(t+1),Te.has(t)?(je(t),Ne(Te)):Ne(Te)},renderPage:Pe,setRenderRange:le})]}))};export{P as default};
1
+ import{__assign as e,__awaiter as t,__generator as n}from"tslib";import{jsxs as r,Fragment as i,jsx as o}from"react/jsx-runtime";import{SpecialZoomLevel as a}from"@react-pdf-viewer/core";import l from"./PdfContainer.js";import c from"./PdfToolbar.js";import{pdfStyles as u}from"./PdfStyle.js";import{PdfHighlightControls as d}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 s,{useRef as g,useState as f,useMemo as h,useEffect as v}from"react";import m from"../ScannedDocCitation/ScannedDocCitation.js";var p=function(e){switch(e){case"ActualSize":return a.ActualSize;case"PageFit":return a.PageFit;case"PageWidth":return a.PageWidth;default:return null!=e?e:a.PageWidth}};function x(e){var t=e.canvasLayerRendered,n=e.markRendered,r=e.pageIndex;return v(function(){t&&n(r)},[t,n,r]),null}var y=function(y){var P,T=y.pdfUrl,w=y.highlightText,C=y.highlightPages,b=y.highlightCordinatePages,S=y.highlightColor,A=void 0===S?"yellow":S,R=y.activeHighlightColor,I=void 0===R?"#f7dc51":R,_=y.jumpToPageValue,L=void 0===_?0:_,H=y.pdfName,q=y.onClose,N=y.customStyles,j=y.customClasses,F=y.customIcons,k=y.useCoordinates,B=y.fallbackPages,D=y.activeCitationIndex,M=y.onActiveCitationChange,V=y.headerAction,W=y.isZoomEnabled,z=void 0===W||W,E=y.showHighlightsAction,O=void 0===E||E,U=y.defaultScale,Z=void 0===U?a.ActualSize:U,J=y.useRange,K=void 0!==J&&J,G=y.rangeOfPages,Q=void 0===G?null:G,X=y.showFullScreenAction,Y=void 0===X||X,$=y.segments,ee=void 0===$?[{title:"Document 2",start_page:52,end_page:52,page_count:1}]:$,te=y.segmentTooltipText,ne=y.onCurrentPageChange,re=y.navigationRequest,ie=y.onNavigationSettled,oe=y.disablePdfAnnotations,ae=void 0!==oe&&oe,le=y.disablePdfTextLayer,ce=void 0!==le&&le,ue=y.renderPage,de=y.setRenderRange,se=g(null),ge=f(0),fe=ge[0],he=ge[1],ve=f(0),me=ve[0],pe=ve[1],xe=g(null),ye=g(null),Pe=g(0),Te=h(function(){return ae||ce?function(t){var n=e(e({},t),{annotationLayer:e(e({},t.annotationLayer),{children:ae?null:t.annotationLayer.children}),textLayer:e(e({},t.textLayer),{children:ce?null:t.textLayer.children})}),a=ue?ue(n):r(i,{children:[t.canvasLayer.children,!ce&&t.textLayer.children,!ae&&t.annotationLayer.children]});return r(i,{children:[a,ce&&o(x,{canvasLayerRendered:t.canvasLayerRendered,markRendered:t.markRendered,pageIndex:t.pageIndex})]})}:ue},[ae,ce,ue]),we=h(function(){if(k)return new Set(b.map(function(e){return e.pageIndex}));var e=new Set;return Object.values(C).forEach(function(t){t>0&&e.add(t-1)}),e},[b,C,k]),Ce=(P=w)&&0!==P.length?P.filter(function(e){return!P.some(function(t){return t!==e&&t.includes(e)})}):P,be=d(Ce,k?{}:C,se,we,k,k?b:[],A,I),Se=be.highlightIndex,Ae=be.cursorIndex,Re=be.setCursorIndex,Ie=be.orderedKeys,_e=be.totalHighlights,Le=be.getValidPosition,He=be.tryJump,qe=be.jumpToPage,Ne=be.plugins,je=be.controls,Fe=be.hideNonTargetHighlights,ke=be.deduplicateHighlights,Be=Le(Ae),De=h(function(){var e=fe+1;return ee.find(function(t){return e>=t.start_page&&e<=t.end_page})},[fe,ee]);v(function(){void 0!==D&&D!==Ae&&Re(D)},[D]);var Me=e(e({},je),{goToNext:function(){Ae>=_e-1||(je.goToNext(),M&&M(Ae+1))},goToPrevious:function(){Ae<=0||(je.goToPrevious(),M&&M(Ae-1))}}),Ve=s.useCallback(function(e,t){Pe.current+=1;var n=Pe.current;null!=ye.current&&window.clearTimeout(ye.current);var r=null,i=0,o=0,a=function(){var l,c;if(Pe.current===n){var u=null===(l=se.current)||void 0===l?void 0:l.querySelector(".rpv-core__inner-pages"),d=null===(c=se.current)||void 0===c?void 0:c.querySelector('[data-testid="core__page-layer-'.concat(t-1,'"]'));o+=1,u&&(r===u.scrollTop?i+=1:(r=u.scrollTop,i=0));var s=null==u?void 0:u.getBoundingClientRect(),g=null==d?void 0:d.getBoundingClientRect(),f=Boolean(s&&g&&g.bottom>s.top&&g.top<s.bottom);if(i>=2&&f||o>=40)return ye.current=null,void(null==ie||ie({pageNumber:t,requestId:e.requestId}));ye.current=window.setTimeout(a,50)}};ye.current=window.setTimeout(a,50)},[ie]);if(v(function(){return function(){Pe.current+=1,null!=ye.current&&window.clearTimeout(ye.current)}},[]),v(function(){var e;if(re&&!(me<=0)){var t=Math.min(Math.max(Math.trunc(re.pageNumber),1),me),n="".concat(null!==(e=re.requestId)&&void 0!==e?e:t,":").concat(t);xe.current!==n&&(xe.current=n,he(t-1),qe(t-1),Ve(re,t))}},[qe,re,me,Ve]),!T)return o(m,{pages:B,activeCitationIndex:D,onActiveCitationChange:M,headerAction:V});return r("div",e({ref:se,className:(null==j?void 0:j.pdfViewerWrapper)||"","data-disable-pdf-annotations":ae?"true":void 0,style:e(e(e({height:"100%",minHeight:0,minWidth:0,overflow:"hidden",display:"flex",flexDirection:"column"},u.pdfViewer),{display:"flex",flexDirection:"column",height:"100%",width:"100%",backgroundColor:"#FAFAFA"}),null==N?void 0:N.pdfViewer)},{children:[o(c,{highlightIndex:Se,totalHighlights:_e,controls:Me,currentPosition:Be,pdfName:H,onClose:q,pdfUrl:T,viewerRef:se,customStyles:N,customClasses:j,customIcons:F,headerAction:V,isZoomEnabled:z,showHighlightsAction:O,showFullScreenAction:Y,currentSegment:De,segmentTooltipText:te,currentPage:fe+1,totalPages:me,onPageNavigate:function(e){var t=Math.min(Math.max(e,1),me||e);he(t-1),qe(t-1)}}),o(l,{defaultScale:p(Z),pdfUrl:T,plugins:Ne,customStyles:N,onLoad:function(e){pe(e.doc.numPages);var r=!k&&!K&&L<=0;if(L>0&&!K){var i=L-1,o=Ie[i],a=C[o],l=b[i];Re(i),console.log(l,"cordinateTargetHighlight"),k&&l.pageIndex>0&&qe(l.pageIndex),a>0&&(setTimeout(function(){Fe(we),ke(a-1)},1e3),k||qe(a-1))}else if(K&&Q&&2===Q.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=Q[0],t=Q[1],r=e,n.label=1;case 1:return r<=t?(qe(i=r-1),[4,new Promise(function(e){return setTimeout(e,1e3)})]):[3,4];case 2:if(n.sent(),Fe(we),(o=ke(i))&&o>0)return[3,4];n.label=3;case 3:return r++,[3,1];case 4:return[2]}})})}else if(!k&&C){var c=Ie.find(function(e){return C[e]>0});if(void 0!==c){var u=C[c]-1;qe(u),setTimeout(function(){Fe(we),ke(u)},1e3)}}requestAnimationFrame(function(){r&&He(),!k&&L>0&&!K&&function(){if(se.current){var e=L-1,t=Ie[e],n=C[t],r=n>0?n-1:0,i={};Ie.forEach(function(e,t){var n=C[e];n>0&&(i[n]||(i[n]=[]),i[n].push(t))});var o=(i[n]||[]).indexOf(e),a=0,l=function(){var e,t;if(!(++a>40)){var n=null===(e=se.current)||void 0===e?void 0:e.querySelector(".rpv-core__inner-pages");if(n){var i=null===(t=se.current)||void 0===t?void 0:t.querySelector('[data-testid="core__page-layer-'.concat(r,'"]'));if(i){var c=n.getBoundingClientRect(),u=i.getBoundingClientRect();if(u.top<c.bottom&&u.bottom>c.top){var d=i.querySelectorAll(".rpv-search__highlight")[o];if(d){var s=d.getBoundingClientRect(),g=n.scrollTop+(s.top-c.top)-n.clientHeight/2+s.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;he(t),null==ne||ne(t+1),we.has(t)?(ke(t),Fe(we)):Fe(we)},renderPage:Te,setRenderRange:de})]}))};export{y as default};
2
2
  //# sourceMappingURL=PdfViewer.js.map
@@ -1,2 +1,2 @@
1
- import{__spreadArray as e,__assign as n,__awaiter as t,__generator as i}from"tslib";import{jsxs as r,jsx as o,Fragment as l}from"react/jsx-runtime";import{useMemo as a,useRef as u,useState as d,useEffect as s,useCallback as c}from"react";import{SpecialZoomLevel as f}from"@react-pdf-viewer/core";import v from"../PdfViewer/PdfViewer.js";import g,{BoundaryReviewActionEnum as p,isBoundaryReviewAction as m}from"./BoundaryCard.js";import h from"./CardWrapper.js";import b from"./CognitiveIntegrity.js";import w from"./LabelCheck.js";import{extractSegmentReviewData as y}from"./reviewStepAdapters.js";import{CircleCheck as x}from"lucide-react";import{Tooltip as _,Typography as C}from"@mui/material";import{getConfidenceColors as k,formatScore as S}from"./helper.js";var N=260,I=function(e){return{reviewId:e.id,segment:e.segment,pageNumber:e.pageNumber}};function E(E){var A,F,M,R,P,B,L,W,z,j,O=this,T=E.pdfUrl,q=E.pdfName,D=E.segments,V=E.styles,G=E.pdfViewerProps,H=E.showBadges,U=void 0===H||H,X=E.sortByConfidence,J=void 0===X?"low":X,Y=E.filterByConfidence,K=void 0===Y?"all":Y,Q=E.showBadgeNavigation,Z=void 0===Q||Q,$=E.autoSelectReviewOnPageChange,ee=void 0!==$&&$,ne=E.autoAdvanceAfterConfirm,te=void 0===ne||ne,ie=E.badgePreloadPages,re=void 0===ie?8:ie,oe=E.badgeOffsetTop,le=void 0===oe?20:oe,ae=E.badgeOffsetRight,ue=void 0===ae?68:ae,de=E.badgeOffsetLeft,se=void 0===de?0:de,ce=E.initialReviewId,fe=E.onBoundaryAction,ve=E.onLabelAction,ge=E.onActiveReviewChange,pe=E.onCurrentPageChange,me=E.onActionError,he=E.disableAllActions,be=void 0!==he&&he,we=E.disablePdfAnnotations,ye=void 0!==we&&we,xe=E.disableTitleCheckUntilBoundaryCheckCompleted,_e=void 0!==xe&&xe,Ce=E.onAdjustManually,ke=E.onCognitiveClick,Se=E.className,Ne=E.style,Ie=E.viewerStyle,Ee=E.railStyle,Ae=E.redirectionData,Fe=a(function(){return y(D)},[D]),Me=Fe.boundaryReviews,Re=Fe.labelReviews,Pe=a(function(){return new Map(D.map(function(e,n){return[e.stable_key,n+1]}))},[D]),Be=u(null),Le=a(function(){return e(e([],Me.map(function(e){var t;return n(n({},e),{kind:"boundary",pageNumber:null!==(t=e.metadata.focus_page)&&void 0!==t?t:e.segment.start_page})}),!0),Re.map(function(e){return n(n({},e),{kind:"label",pageNumber:e.segment.start_page})}),!0).sort(function(e,n){var t,i,r=null!==(t=Pe.get(e.segment.stable_key))&&void 0!==t?t:Number.MAX_SAFE_INTEGER,o=null!==(i=Pe.get(n.segment.stable_key))&&void 0!==i?i:Number.MAX_SAFE_INTEGER;return e.pageNumber-n.pageNumber||r-o||e.reviewStepIndex-n.reviewStepIndex||e.id.localeCompare(n.id)})},[Me,Re,Pe]),We=a(function(){return D.map(function(e){var t;return n(n({},e),{title:(null===(t=e.label)||void 0===t?void 0:t.trim())||e.title})})},[D]),ze=d(1),je=ze[0],Oe=ze[1],Te=d(null!=ce?ce:null),qe=Te[0],De=Te[1],Ve=d(null!=ce?ce:null),Ge=Ve[0],He=Ve[1],Ue=d(!1),Xe=Ue[0],Je=Ue[1],Ye=d(null),Ke=Ye[0],Qe=Ye[1],Ze=d(null),$e=Ze[0],en=Ze[1],nn=d(function(){return new Set}),tn=nn[0],rn=nn[1],on=d(null),ln=on[0],an=on[1],un=u(0),dn=u(null),sn=u(null),cn=u(new Map),fn=u(null),vn=u(null),gn=d(N),pn=gn[0],mn=gn[1],hn=null!==(F=null===(A=null==V?void 0:V.aside)||void 0===A?void 0:A.width)&&void 0!==F?F:"40%",bn="min(".concat("number"==typeof hn?"".concat(hn,"px"):hn,", ").concat(N,"px, 100%)");s(function(){var e=Be.current;if(e&&U){var n=function(){var n=e.getBoundingClientRect().width;n>0&&mn(n)};n();var t="undefined"==typeof ResizeObserver?null:new ResizeObserver(n);return null==t||t.observe(e),function(){return null==t?void 0:t.disconnect()}}},[U]);var wn=a(function(){var e=new Set(tn);return Le.forEach(function(n){null!=n.review_step.review&&e.add(n.id)}),e},[tn,Le]),yn=a(function(){var e;return null!==(e=Le.find(function(e){return e.id===qe}))&&void 0!==e?e:null},[qe,Le]),xn=a(function(){return!(!_e||"label"!==(null==yn?void 0:yn.kind))&&Me.some(function(e){return e.segment.stable_key===yn.segment.stable_key&&!wn.has(e.id)})},[yn,Me,_e,wn]),_n=null==yn?-1:D.findIndex(function(e){return e.stable_key===yn.segment.stable_key}),Cn=_n>0?D[_n-1]:void 0,kn=_n>=0?D[_n+1]:void 0,Sn=(null===(M=null==Cn?void 0:Cn.label)||void 0===M?void 0:M.trim())||(null==Cn?void 0:Cn.title),Nn=(null===(R=null==kn?void 0:kn.label)||void 0===R?void 0:R.trim())||(null==kn?void 0:kn.title),In=k(null==yn?void 0:yn.review_step.score,null==yn?void 0:yn.review_step.confidence,null===(P=null==yn?void 0:yn.segment.confidence)||void 0===P?void 0:P.awaiting_llm),En=(null===(B=null==yn?void 0:yn.review_step.reasons)||void 0===B?void 0:B.length)?yn.review_step.reasons:null!==(W=null===(L=null==yn?void 0:yn.segment.confidence)||void 0===L?void 0:L.reasons)&&void 0!==W?W:[],An=Boolean(En.some(function(e){return e.text.trim()&&["evidence","gap"].includes(e.type.trim().toLowerCase())})||(null===(z=null==yn?void 0:yn.review_step.reason)||void 0===z?void 0:z.trim())||(null===(j=null==yn?void 0:yn.review_step.gap)||void 0===j?void 0:j.trim())),Fn=c(function(e,n){un.current+=1,dn.current={requestId:un.current,pageNumber:e,reviewId:n},en({pageNumber:e,requestId:un.current})},[]),Mn=c(function(e){var n;!0!==(null===(n=e.segment.confidence)||void 0===n?void 0:n.awaiting_llm)&&(De(e.id),He(e.id),Je(!1),Qe(null),Fn(e.pageNumber,e.id),null==ge||ge(e.id,e.segment))},[ge,Fn]);s(function(){if((null==Ae?void 0:Ae.pageNumber)&&Ae.type){var e=Number(Ae.pageNumber);if(Number.isInteger(e)&&!(e<1)){var n=Le.find(function(n){return n.segment.start_page===e&&n.kind===Ae.type});n&&Mn(n)}}},[Ae,Mn,Le]);var Rn=c(function(){dn.current=null,Je(!1),De(null),Qe(null),null==ge||ge(null,null)},[ge]),Pn=c(function(e){var n;if(te){var t=Le.findIndex(function(n){return n.id===e}),i=new Set(Le.map(function(e){return e.id})),r=null!==(n=Le.find(function(n,r){return r>t&&n.id!==e&&i.has(n.id)}))&&void 0!==n?n:Le.find(function(n){return n.id!==e});r?requestAnimationFrame(function(){return Mn(r)}):Rn()}else Rn()},[te,Rn,Le,Mn,Le]),Bn=c(function(e,n,r){return t(O,void 0,void 0,function(){var t,o,l,a,u;return i(this,function(i){switch(i.label){case 0:if(be)return[2];t=I(e),o=n,l="boundary"===e.kind&&null!=fe&&te&&(o===p.SPLIT_HERE||o===p.MERGE_NEXT||o===p.MERGE_PREVIOUS),a=l?D.findIndex(function(n){return n.stable_key===e.segment.stable_key}):-1,l&&a>=0&&(sn.current={action:o,originalSegmentIndex:a,segmentSignature:JSON.stringify(D.map(function(e){return e.stable_key})),ready:!1}),an(e.id),i.label=1;case 1:return i.trys.push([1,6,7,8]),"boundary"!==e.kind?[3,3]:[4,null==fe?void 0:fe(n,r,t)];case 2:return i.sent(),[3,5];case 3:return[4,null==ve?void 0:ve(n,r,t)];case 4:i.sent(),i.label=5;case 5:return rn(function(n){var t=new Set(n);return t.add(e.id),t}),sn.current?sn.current.ready=!0:Pn(e.id),[3,8];case 6:return u=i.sent(),l&&(sn.current=null),null==me||me(u,t),[3,8];case 7:return an(null),[7];case 8:return[2]}})})},[te,be,me,fe,ve,D,Pn]);s(function(){var e=sn.current;if((null==e?void 0:e.ready)&&JSON.stringify(D.map(function(e){return e.stable_key}))!==e.segmentSignature){var n=e.action===p.MERGE_PREVIOUS?e.originalSegmentIndex:e.originalSegmentIndex+1,t=new Map(D.map(function(e,n){return[e.stable_key,n]})),i=Le.find(function(e){var i,r=t.get(e.segment.stable_key);return null!=r&&r>=n&&null==e.review_step.review&&!tn.has(e.id)&&!0!==(null===(i=e.segment.confidence)||void 0===i?void 0:i.awaiting_llm)});if(!i)return sn.current=null,void Rn();requestAnimationFrame(function(){sn.current=null,Mn(i)})}},[Rn,tn,Le,D,Mn]),s(function(){sn.current||qe&&!Le.some(function(e){return e.id===qe})&&Rn()},[qe,Rn,Le]),s(function(){if(ee&&!sn.current){var e=Le.find(function(e){return e.pageNumber===je});e&&e.id!==qe&&Mn(e)}},[qe,ee,je,Mn,Le]),s(function(){sn.current||qe&&!Le.some(function(e){var n;return e.id===qe&&!0!==(null===(n=e.segment.confidence)||void 0===n?void 0:n.awaiting_llm)})&&Rn()},[qe,Rn,Le]);var Ln=a(function(){var n=Le.filter(function(e){var n;return!0!==(null===(n=e.segment.confidence)||void 0===n?void 0:n.awaiting_llm)});if("all"===K)return n;var t=["low","medium","high"].filter(function(e){return e!==J}),i=e([J],t,!0),r=new Map(i.map(function(e,n){return[e,n]}));return n.map(function(e,n){return{item:e,index:n}}).sort(function(e,n){var t,o,l,a,u=null===(t=e.item.review_step.confidence)||void 0===t?void 0:t.trim().toLowerCase(),d=null===(o=n.item.review_step.confidence)||void 0===o?void 0:o.trim().toLowerCase();return(null==u?i.length:null!==(l=r.get(u))&&void 0!==l?l:i.length)-(null==d?i.length:null!==(a=r.get(d))&&void 0!==a?a:i.length)||e.index-n.index}).map(function(e){return e.item})},[K,J,Le]),Wn=Ln.findIndex(function(e){return e.id===Ge}),zn=d(null),jn=zn[0],On=zn[1],Tn=u(!1),qn=c(function(e){var n=Ln[e];n&&Mn(n)},[Ln,Mn]);s(function(){Ge&&!Ln.some(function(e){return e.id===Ge})&&He(null)},[Ln,Ge]),s(function(){Tn.current=!1,On(Wn>=0?String(Wn+1):null)},[Wn,Ln.length]),s(function(){if(Tn.current&&null!=jn){var e=window.setTimeout(function(){var e=Number(jn.trim()),n=e-1;Number.isInteger(e)&&n>=0&&n<Ln.length&&(Tn.current=!1,qn(n))},300);return function(){return window.clearTimeout(e)}}},[qn,jn,Ln.length]);var Dn=a(function(){var e=new Map;Le.forEach(function(n){var t,i=null!==(t=e.get(n.segment.stable_key))&&void 0!==t?t:[];i.push(n),e.set(n.segment.stable_key,i)});var n=new Map;return e.forEach(function(e,t){var i,r=null!==(i=Pe.get(t))&&void 0!==i?i:1;e.sort(function(e,n){return e.reviewStepIndex-n.reviewStepIndex}).forEach(function(e,t){n.set(e.id,"".concat(r).concat(function(e){for(var n=e+1,t="";n>0;)n-=1,t=String.fromCharCode(65+n%26)+t,n=Math.floor(n/26);return t}(t)))})}),n},[Le,Pe]),Vn=a(function(){var e=new Map;Le.forEach(function(n){var t,i=null!==(t=e.get(n.pageNumber))&&void 0!==t?t:[];i.push(n),e.set(n.pageNumber,i)});var n=new Map;return e.forEach(function(e){e.forEach(function(e,t){return n.set(e.id,t)})}),n},[Le]),Gn=c(function(e){return{startPage:Math.max(0,e.startPage-re),endPage:Math.min(e.numPages-1,e.endPage+re)}},[re]),Hn=c(function(){var e,n=fn.current,t=vn.current;if(n&&t){var i=n.getBoundingClientRect(),r=t.querySelector(".rpv-core__inner-pages"),o=null!==(e=null==r?void 0:r.getBoundingClientRect())&&void 0!==e?e:t.getBoundingClientRect();Le.forEach(function(e){var n,r=cn.current.get(e.id);if(r){var l=t.querySelector('[data-testid="core__page-layer-'.concat(e.pageNumber-1,'"]'));if(l){var a=l.getBoundingClientRect(),u=null!==(n=Vn.get(e.id))&&void 0!==n?n:0,d=a.top+le+40*u,s=d+(r.offsetHeight||32),c=d>=o.top&&s<=o.bottom;r.style.top="".concat(d-i.top,"px"),r.style.visibility=c?"visible":"hidden"}else r.style.visibility="hidden"}})}},[le,Vn,Le]),Un=c(function(e){var n=dn.current;n&&n.requestId===e.requestId&&n.pageNumber===e.pageNumber&&(dn.current=null,Hn(),requestAnimationFrame(function(){if(null==dn.current){var e=cn.current.get(n.reviewId);e&&"hidden"!==e.style.visibility&&Qe(e)}}))},[Hn]);return s(function(){var e=vn.current;if(e&&U){var n=null,t=function(){null==n&&(n=requestAnimationFrame(function(){n=null,Hn()}))};e.addEventListener("scroll",t,!0),window.addEventListener("resize",t);var i=new MutationObserver(t);i.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style"]});var r="undefined"==typeof ResizeObserver?null:new ResizeObserver(t);return null==r||r.observe(e),t(),function(){null!=n&&cancelAnimationFrame(n),e.removeEventListener("scroll",t,!0),window.removeEventListener("resize",t),i.disconnect(),null==r||r.disconnect()}}},[U,Hn]),r("div",n({ref:fn,className:Se,style:n(n({},Ne),{display:"block",position:"relative",width:"100%",height:"100%",minWidth:0,overflowX:"auto",overflowY:"hidden"})},{children:[r("div",n({className:"segment-review-wrapper__container",style:{display:"flex",alignItems:"stretch",gap:0,width:"100%",minWidth:700,height:"100%"}},{children:[o("div",n({ref:vn,style:n(n({},Ie),{flex:"1 1 auto",width:U?"auto":"100%",minWidth:0,height:"100%",boxSizing:"border-box"})},{children:o(v,n({defaultScale:f.PageFit,highlightText:[],highlightPages:{},highlightCordinatePages:[],useCoordinates:!1},G,{disablePdfAnnotations:ye,pdfUrl:T,pdfName:q,segments:We,navigationRequest:$e,onNavigationSettled:Un,setRenderRange:Gn,onCurrentPageChange:function(e){Oe(e),null==dn.current&&yn&&yn.pageNumber!==e&&Rn(),null==pe||pe(e)}}))})),U&&r("aside",n({"aria-label":"Page review badges",ref:Be,style:n(n({},Ee),{position:"relative",width:bn,maxWidth:N,flex:"0 1 ".concat(bn),minHeight:0,overflow:"hidden",boxSizing:"border-box"})},{children:[Z&&Ln.length>0&&r("nav",n({"aria-label":"Review badge navigation",style:{position:"absolute",top:8,right:ue||"auto",left:se||"auto",zIndex:2,display:"flex",alignItems:"center",gap:7,width:128,minHeight:40,padding:"4px 6px",border:"1px solid #CBD5E1",borderRadius:6,backgroundColor:"#FFFFFF",boxSizing:"border-box",boxShadow:"0 1px 2px rgba(16, 24, 40, 0.06)",font:"inherit"}},{children:[o("input",{type:"text",inputMode:"numeric",pattern:"[0-9]*",value:null!=jn?jn:"-","aria-label":"Review badge number",onChange:function(e){Tn.current=!0,On(e.target.value)},style:{width:30,height:28,padding:0,border:"1px solid #A5B4FC",borderRadius:3,color:"#4F46E5",backgroundColor:"#FFFFFF",textAlign:"center",font:"inherit",fontSize:15,outline:"none"}}),r("span",n({"aria-label":"".concat(Ln.length," reviews"),style:{flex:1,color:"#4F46E5",fontSize:14,whiteSpace:"nowrap",textAlign:"center"}},{children:["of ",Ln.length]})),["previous","next"].map(function(e){var t="previous"===e,i=Wn+(t?-1:1),r=i<0||i>=Ln.length;return o("button",n({type:"button","aria-label":"".concat(t?"Previous":"Next"," review badge"),disabled:r,onClick:function(){return qn(i)},style:{display:"grid",placeItems:"center",width:17,height:28,padding:0,border:0,background:"transparent",color:r?"#C7D2FE":"#4F46E5",cursor:r?"default":"pointer"}},{children:o("svg",n({width:"12",height:"8",viewBox:"0 0 12 8",fill:"none"},{children:o("path",{d:t?"M1 7L6 2L11 7":"M1 1L6 6L11 1",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})}))}),e)})]})),Le.map(function(e){var t,i,l=qe===e.id,a=null!==(t=Dn.get(e.id))&&void 0!==t?t:"1A",u=e.review_step.score,d=e.review_step.confidence,s=S(u,d),c=!0===(null===(i=e.segment.confidence)||void 0===i?void 0:i.awaiting_llm),f=k(u,d,c),v=e.review_step.review&&null!==e.review_step.review.action,g=Boolean(v)||c;return o(_,n({title:c?"data is being processed":"",arrow:!0},{children:o("span",n({ref:function(n){n?cn.current.set(e.id,n):cn.current.delete(e.id)},style:{position:"absolute",top:0,left:10,visibility:"hidden",display:"inline-flex",cursor:g?"not-allowed":"pointer"}},{children:o("button",n({disabled:g,type:"button","aria-pressed":l,"aria-label":c?"".concat(e.review_step.type," · Page ").concat(e.pageNumber," · Data is being processed"):"".concat(e.review_step.type," · Page ").concat(e.pageNumber),onClick:function(){return Mn(e)},style:{cursor:"inherit",display:"flex",alignItems:"center",justifyContent:"space-around",gap:4,width:v&&!c?105:80,minHeight:25,padding:"2px 5px",border:"1px solid ".concat(v&&!c?"#E2E8F0":f.border),borderRadius:16,backgroundColor:v&&!c?"#F8FAFC":f.background,color:v&&!c?"#475569":f.text,font:"inherit",alignContent:"center",boxShadow:"0 1px 2px rgba(16, 24, 40, 0.08)"}},{children:r(C,n({fontFamily:"Inter",sx:{display:"flex",gap:1,alignItems:"center",flexDirection:"row"}},v&&!c?{children:[o("span",n({style:{fontSize:11,fontWeight:500}},{children:a})),r("span",n({style:{display:"flex",alignItems:"center"}},{children:[o("svg",n({width:"2",height:"14",viewBox:"0 0 1 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:o("path",{d:"M0.399902 0V14",stroke:"#CBD5E1",strokeWidth:"0.8"})})),o("span",n({style:{fontSize:11,fontWeight:500,marginLeft:"7px",display:"flex",alignItems:"center"}},{children:"N/A"===s?s:"".concat(s,"%")}))]})),r("span",n({style:{fontSize:11,fontWeight:500,display:"flex",alignItems:"center"}},{children:[o("svg",n({width:"2",height:"14",viewBox:"0 0 1 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:o("path",{d:"M0.399902 0V14",stroke:"#CBD5E1",strokeWidth:"0.8"})})),o("span",n({style:{display:"flex",marginLeft:"7px",alignItems:"center"}},{children:o(x,{height:14,width:14,strokeWidth:2,color:"#16A34A"})}))]}))]}:{children:[o("span",n({style:{fontSize:11,fontWeight:500}},{children:a})),r("span",n({style:{display:"flex",alignItems:"center"}},{children:[o("svg",n({width:"2",height:"14",viewBox:"0 0 1 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:o("path",{d:"M0.399902 0V14",stroke:f.divider,strokeWidth:"0.8"})})),o("span",n({style:{fontSize:11,fontWeight:500,marginLeft:"7px",display:"flex",alignItems:"center"}},{children:"N/A"===s?s:"".concat(s,"%")}))]}))]}))}))}))}),e.id)})]}))]})),yn&&Ke&&r(h,n({anchorElement:Ke,placement:"bottom-start",offset:{top:8},width:Math.min(pn,N),maxWidth:N},{children:[Xe&&o(b,{width:"100%",maxWidth:"100%",score:yn.review_step.score,reasons:En,reason:yn.review_step.reason,gap:yn.review_step.gap,onBack:function(){return Je(!1)},onClose:Rn}),o("div",n({style:{display:Xe?"none":"block"}},{children:yn.review_step.review&&yn.review_step.human_resolution?o(l,{}):"boundary"===yn.kind?o(g,{width:"100%",maxWidth:"100%",title:yn.segment.label||yn.segment.title,pageNo:"Page ".concat(yn.pageNumber),content:yn.review_step.reason,cognitiveScore:yn.review_step.score,metadata:yn.metadata,previousSegmentTitle:Sn,nextSegmentTitle:Nn,defaultStartPage:yn.segment.start_page,defaultEndPage:yn.segment.end_page,styles:{root:{borderColor:In.cardBorder},header:{"& > .MuiSvgIcon-root, & .MuiTypography-root":{color:In.text}}},confirmDisabled:be||ln===yn.id,onConfirm:function(e,n,t){t&&m(n.id)&&Bn(yn,n.id,t)},onAdjustManually:function(){return null==Ce?void 0:Ce(I(yn))},onCognitiveClick:An?function(){Je(!0),null==ke||ke(I(yn))}:void 0,onClose:Rn},yn.id):o(w,{width:"100%",maxWidth:"100%",title:yn.metadata.current_label||yn.segment.label||yn.segment.title,pageNo:"Pages ".concat(yn.segment.start_page,"-").concat(yn.segment.end_page),content:yn.review_step.reason,cognitiveScore:yn.review_step.score,metadata:yn.metadata,styles:{root:{borderColor:In.cardBorder},header:{"& > .MuiSvgIcon-root, & .MuiTypography-root":{color:In.text}}},confirmDisabled:be||ln===yn.id,confirmationBlocked:xn,confirmationWarning:xn?"Please confirm the boundary before confirming the title.":void 0,onActionConfirm:function(e,n){Bn(yn,e,n)},onAdjustManually:function(){return null==Ce?void 0:Ce(I(yn))},onCognitiveClick:An?function(){Je(!0),null==ke||ke(I(yn))}:void 0,onClose:Rn},yn.id)}))]}))]}))}export{E as default};
1
+ import{__spreadArray as e,__assign as n,__awaiter as t,__generator as i}from"tslib";import{jsxs as r,jsx as o,Fragment as l}from"react/jsx-runtime";import{useMemo as a,useRef as u,useState as d,useEffect as s,useCallback as c}from"react";import{SpecialZoomLevel as f}from"@react-pdf-viewer/core";import v from"../PdfViewer/PdfViewer.js";import g,{BoundaryReviewActionEnum as p,isBoundaryReviewAction as m}from"./BoundaryCard.js";import h from"./CardWrapper.js";import b from"./CognitiveIntegrity.js";import w from"./LabelCheck.js";import{extractSegmentReviewData as y}from"./reviewStepAdapters.js";import{CircleCheck as x}from"lucide-react";import{Tooltip as _,Typography as C}from"@mui/material";import{getConfidenceColors as k,formatScore as S}from"./helper.js";var N=260,I=function(e){return{reviewId:e.id,segment:e.segment,pageNumber:e.pageNumber}};function E(E){var A,P,F,M,R,B,L,W,z,T,j=this,O=E.pdfUrl,q=E.pdfName,D=E.segments,V=E.styles,G=E.pdfViewerProps,H=E.showBadges,U=void 0===H||H,X=E.sortByConfidence,J=void 0===X?"low":X,Y=E.filterByConfidence,K=void 0===Y?"all":Y,Q=E.showBadgeNavigation,Z=void 0===Q||Q,$=E.autoSelectReviewOnPageChange,ee=void 0!==$&&$,ne=E.autoAdvanceAfterConfirm,te=void 0===ne||ne,ie=E.badgePreloadPages,re=void 0===ie?8:ie,oe=E.badgeOffsetTop,le=void 0===oe?20:oe,ae=E.badgeOffsetRight,ue=void 0===ae?68:ae,de=E.badgeOffsetLeft,se=void 0===de?0:de,ce=E.initialReviewId,fe=E.onBoundaryAction,ve=E.onLabelAction,ge=E.onActiveReviewChange,pe=E.onCurrentPageChange,me=E.onActionError,he=E.disableAllActions,be=void 0!==he&&he,we=E.disablePdfAnnotations,ye=void 0!==we&&we,xe=E.disablePdfTextLayer,_e=void 0===xe||xe,Ce=E.disableTitleCheckUntilBoundaryCheckCompleted,ke=void 0!==Ce&&Ce,Se=E.onAdjustManually,Ne=E.onCognitiveClick,Ie=E.className,Ee=E.style,Ae=E.viewerStyle,Pe=E.railStyle,Fe=E.redirectionData,Me=a(function(){return y(D)},[D]),Re=Me.boundaryReviews,Be=Me.labelReviews,Le=a(function(){return new Map(D.map(function(e,n){return[e.stable_key,n+1]}))},[D]),We=u(null),ze=a(function(){return e(e([],Re.map(function(e){var t;return n(n({},e),{kind:"boundary",pageNumber:null!==(t=e.metadata.focus_page)&&void 0!==t?t:e.segment.start_page})}),!0),Be.map(function(e){return n(n({},e),{kind:"label",pageNumber:e.segment.start_page})}),!0).sort(function(e,n){var t,i,r=null!==(t=Le.get(e.segment.stable_key))&&void 0!==t?t:Number.MAX_SAFE_INTEGER,o=null!==(i=Le.get(n.segment.stable_key))&&void 0!==i?i:Number.MAX_SAFE_INTEGER;return e.pageNumber-n.pageNumber||r-o||e.reviewStepIndex-n.reviewStepIndex||e.id.localeCompare(n.id)})},[Re,Be,Le]),Te=a(function(){return D.map(function(e){var t;return n(n({},e),{title:(null===(t=e.label)||void 0===t?void 0:t.trim())||e.title})})},[D]),je=d(1),Oe=je[0],qe=je[1],De=d(null!=ce?ce:null),Ve=De[0],Ge=De[1],He=d(null!=ce?ce:null),Ue=He[0],Xe=He[1],Je=d(!1),Ye=Je[0],Ke=Je[1],Qe=d(null),Ze=Qe[0],$e=Qe[1],en=d(null),nn=en[0],tn=en[1],rn=d(function(){return new Set}),on=rn[0],ln=rn[1],an=d(null),un=an[0],dn=an[1],sn=u(0),cn=u(null),fn=u(null),vn=u(new Map),gn=u(null),pn=u(null),mn=d(N),hn=mn[0],bn=mn[1],wn=null!==(P=null===(A=null==V?void 0:V.aside)||void 0===A?void 0:A.width)&&void 0!==P?P:"40%",yn="min(".concat("number"==typeof wn?"".concat(wn,"px"):wn,", ").concat(N,"px, 100%)");s(function(){var e=We.current;if(e&&U){var n=function(){var n=e.getBoundingClientRect().width;n>0&&bn(n)};n();var t="undefined"==typeof ResizeObserver?null:new ResizeObserver(n);return null==t||t.observe(e),function(){return null==t?void 0:t.disconnect()}}},[U]);var xn=a(function(){var e=new Set(on);return ze.forEach(function(n){null!=n.review_step.review&&e.add(n.id)}),e},[on,ze]),_n=a(function(){var e;return null!==(e=ze.find(function(e){return e.id===Ve}))&&void 0!==e?e:null},[Ve,ze]),Cn=a(function(){return!(!ke||"label"!==(null==_n?void 0:_n.kind))&&Re.some(function(e){return e.segment.stable_key===_n.segment.stable_key&&!xn.has(e.id)})},[_n,Re,ke,xn]),kn=null==_n?-1:D.findIndex(function(e){return e.stable_key===_n.segment.stable_key}),Sn=kn>0?D[kn-1]:void 0,Nn=kn>=0?D[kn+1]:void 0,In=(null===(F=null==Sn?void 0:Sn.label)||void 0===F?void 0:F.trim())||(null==Sn?void 0:Sn.title),En=(null===(M=null==Nn?void 0:Nn.label)||void 0===M?void 0:M.trim())||(null==Nn?void 0:Nn.title),An=k(null==_n?void 0:_n.review_step.score,null==_n?void 0:_n.review_step.confidence,null===(R=null==_n?void 0:_n.segment.confidence)||void 0===R?void 0:R.awaiting_llm),Pn=(null===(B=null==_n?void 0:_n.review_step.reasons)||void 0===B?void 0:B.length)?_n.review_step.reasons:null!==(W=null===(L=null==_n?void 0:_n.segment.confidence)||void 0===L?void 0:L.reasons)&&void 0!==W?W:[],Fn=Boolean(Pn.some(function(e){return e.text.trim()&&["evidence","gap"].includes(e.type.trim().toLowerCase())})||(null===(z=null==_n?void 0:_n.review_step.reason)||void 0===z?void 0:z.trim())||(null===(T=null==_n?void 0:_n.review_step.gap)||void 0===T?void 0:T.trim())),Mn=c(function(e,n){sn.current+=1,cn.current={requestId:sn.current,pageNumber:e,reviewId:n},tn({pageNumber:e,requestId:sn.current})},[]),Rn=c(function(e){var n;!0!==(null===(n=e.segment.confidence)||void 0===n?void 0:n.awaiting_llm)&&(Ge(e.id),Xe(e.id),Ke(!1),$e(null),Mn(e.pageNumber,e.id),null==ge||ge(e.id,e.segment))},[ge,Mn]);s(function(){if((null==Fe?void 0:Fe.pageNumber)&&Fe.type){var e=Number(Fe.pageNumber);if(Number.isInteger(e)&&!(e<1)){var n=ze.find(function(n){return n.segment.start_page===e&&n.kind===Fe.type});n&&Rn(n)}}},[Fe,Rn,ze]);var Bn=c(function(){cn.current=null,Ke(!1),Ge(null),$e(null),null==ge||ge(null,null)},[ge]),Ln=c(function(e){var n;if(te){var t=ze.findIndex(function(n){return n.id===e}),i=new Set(ze.map(function(e){return e.id})),r=null!==(n=ze.find(function(n,r){return r>t&&n.id!==e&&i.has(n.id)}))&&void 0!==n?n:ze.find(function(n){return n.id!==e});r?requestAnimationFrame(function(){return Rn(r)}):Bn()}else Bn()},[te,Bn,ze,Rn,ze]),Wn=c(function(e,n,r){return t(j,void 0,void 0,function(){var t,o,l,a,u;return i(this,function(i){switch(i.label){case 0:if(be)return[2];t=I(e),o=n,l="boundary"===e.kind&&null!=fe&&te&&(o===p.SPLIT_HERE||o===p.MERGE_NEXT||o===p.MERGE_PREVIOUS),a=l?D.findIndex(function(n){return n.stable_key===e.segment.stable_key}):-1,l&&a>=0&&(fn.current={action:o,originalSegmentIndex:a,segmentSignature:JSON.stringify(D.map(function(e){return e.stable_key})),ready:!1}),dn(e.id),i.label=1;case 1:return i.trys.push([1,6,7,8]),"boundary"!==e.kind?[3,3]:[4,null==fe?void 0:fe(n,r,t)];case 2:return i.sent(),[3,5];case 3:return[4,null==ve?void 0:ve(n,r,t)];case 4:i.sent(),i.label=5;case 5:return ln(function(n){var t=new Set(n);return t.add(e.id),t}),fn.current?fn.current.ready=!0:Ln(e.id),[3,8];case 6:return u=i.sent(),l&&(fn.current=null),null==me||me(u,t),[3,8];case 7:return dn(null),[7];case 8:return[2]}})})},[te,be,me,fe,ve,D,Ln]);s(function(){var e=fn.current;if((null==e?void 0:e.ready)&&JSON.stringify(D.map(function(e){return e.stable_key}))!==e.segmentSignature){var n=e.action===p.MERGE_PREVIOUS?e.originalSegmentIndex:e.originalSegmentIndex+1,t=new Map(D.map(function(e,n){return[e.stable_key,n]})),i=ze.find(function(e){var i,r=t.get(e.segment.stable_key);return null!=r&&r>=n&&null==e.review_step.review&&!on.has(e.id)&&!0!==(null===(i=e.segment.confidence)||void 0===i?void 0:i.awaiting_llm)});if(!i)return fn.current=null,void Bn();requestAnimationFrame(function(){fn.current=null,Rn(i)})}},[Bn,on,ze,D,Rn]),s(function(){fn.current||Ve&&!ze.some(function(e){return e.id===Ve})&&Bn()},[Ve,Bn,ze]),s(function(){if(ee&&!fn.current){var e=ze.find(function(e){return e.pageNumber===Oe});e&&e.id!==Ve&&Rn(e)}},[Ve,ee,Oe,Rn,ze]),s(function(){fn.current||Ve&&!ze.some(function(e){var n;return e.id===Ve&&!0!==(null===(n=e.segment.confidence)||void 0===n?void 0:n.awaiting_llm)})&&Bn()},[Ve,Bn,ze]);var zn=a(function(){var n=ze.filter(function(e){var n;return!0!==(null===(n=e.segment.confidence)||void 0===n?void 0:n.awaiting_llm)});if("all"===K)return n;var t=["low","medium","high"].filter(function(e){return e!==J}),i=e([J],t,!0),r=new Map(i.map(function(e,n){return[e,n]}));return n.map(function(e,n){return{item:e,index:n}}).sort(function(e,n){var t,o,l,a,u=null===(t=e.item.review_step.confidence)||void 0===t?void 0:t.trim().toLowerCase(),d=null===(o=n.item.review_step.confidence)||void 0===o?void 0:o.trim().toLowerCase();return(null==u?i.length:null!==(l=r.get(u))&&void 0!==l?l:i.length)-(null==d?i.length:null!==(a=r.get(d))&&void 0!==a?a:i.length)||e.index-n.index}).map(function(e){return e.item})},[K,J,ze]),Tn=zn.findIndex(function(e){return e.id===Ue}),jn=d(null),On=jn[0],qn=jn[1],Dn=u(!1),Vn=c(function(e){var n=zn[e];n&&Rn(n)},[zn,Rn]);s(function(){Ue&&!zn.some(function(e){return e.id===Ue})&&Xe(null)},[zn,Ue]),s(function(){Dn.current=!1,qn(Tn>=0?String(Tn+1):null)},[Tn,zn.length]),s(function(){if(Dn.current&&null!=On){var e=window.setTimeout(function(){var e=Number(On.trim()),n=e-1;Number.isInteger(e)&&n>=0&&n<zn.length&&(Dn.current=!1,Vn(n))},300);return function(){return window.clearTimeout(e)}}},[Vn,On,zn.length]);var Gn=a(function(){var e=new Map;ze.forEach(function(n){var t,i=null!==(t=e.get(n.segment.stable_key))&&void 0!==t?t:[];i.push(n),e.set(n.segment.stable_key,i)});var n=new Map;return e.forEach(function(e,t){var i,r=null!==(i=Le.get(t))&&void 0!==i?i:1;e.sort(function(e,n){return e.reviewStepIndex-n.reviewStepIndex}).forEach(function(e,t){n.set(e.id,"".concat(r).concat(function(e){for(var n=e+1,t="";n>0;)n-=1,t=String.fromCharCode(65+n%26)+t,n=Math.floor(n/26);return t}(t)))})}),n},[ze,Le]),Hn=a(function(){var e=new Map;ze.forEach(function(n){var t,i=null!==(t=e.get(n.pageNumber))&&void 0!==t?t:[];i.push(n),e.set(n.pageNumber,i)});var n=new Map;return e.forEach(function(e){e.forEach(function(e,t){return n.set(e.id,t)})}),n},[ze]),Un=c(function(e){return{startPage:Math.max(0,e.startPage-re),endPage:Math.min(e.numPages-1,e.endPage+re)}},[re]),Xn=c(function(){var e,n=gn.current,t=pn.current;if(n&&t){var i=n.getBoundingClientRect(),r=t.querySelector(".rpv-core__inner-pages"),o=null!==(e=null==r?void 0:r.getBoundingClientRect())&&void 0!==e?e:t.getBoundingClientRect();ze.forEach(function(e){var n,r=vn.current.get(e.id);if(r){var l=t.querySelector('[data-testid="core__page-layer-'.concat(e.pageNumber-1,'"]'));if(l){var a=l.getBoundingClientRect(),u=null!==(n=Hn.get(e.id))&&void 0!==n?n:0,d=a.top+le+40*u,s=d+(r.offsetHeight||32),c=d>=o.top&&s<=o.bottom;r.style.top="".concat(d-i.top,"px"),r.style.visibility=c?"visible":"hidden"}else r.style.visibility="hidden"}})}},[le,Hn,ze]),Jn=c(function(e){var n=cn.current;n&&n.requestId===e.requestId&&n.pageNumber===e.pageNumber&&(cn.current=null,Xn(),requestAnimationFrame(function(){if(null==cn.current){var e=vn.current.get(n.reviewId);e&&"hidden"!==e.style.visibility&&$e(e)}}))},[Xn]);return s(function(){var e=pn.current;if(e&&U){var n=null,t=function(){null==n&&(n=requestAnimationFrame(function(){n=null,Xn()}))};e.addEventListener("scroll",t,!0),window.addEventListener("resize",t);var i=new MutationObserver(t);i.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style"]});var r="undefined"==typeof ResizeObserver?null:new ResizeObserver(t);return null==r||r.observe(e),t(),function(){null!=n&&cancelAnimationFrame(n),e.removeEventListener("scroll",t,!0),window.removeEventListener("resize",t),i.disconnect(),null==r||r.disconnect()}}},[U,Xn]),r("div",n({ref:gn,className:Ie,style:n(n({},Ee),{display:"block",position:"relative",width:"100%",height:"100%",minWidth:0,overflowX:"auto",overflowY:"hidden"})},{children:[r("div",n({className:"segment-review-wrapper__container",style:{display:"flex",alignItems:"stretch",gap:0,width:"100%",minWidth:700,height:"100%"}},{children:[o("div",n({ref:pn,style:n(n({},Ae),{flex:"1 1 auto",width:U?"auto":"100%",minWidth:0,height:"100%",boxSizing:"border-box"})},{children:o(v,n({defaultScale:f.PageFit,highlightText:[],highlightPages:{},highlightCordinatePages:[],useCoordinates:!1},G,{disablePdfAnnotations:ye,disablePdfTextLayer:_e,pdfUrl:O,pdfName:q,segments:Te,navigationRequest:nn,onNavigationSettled:Jn,setRenderRange:Un,onCurrentPageChange:function(e){qe(e),null==cn.current&&_n&&_n.pageNumber!==e&&Bn(),null==pe||pe(e)}}))})),U&&r("aside",n({"aria-label":"Page review badges",ref:We,style:n(n({},Pe),{position:"relative",width:yn,maxWidth:N,flex:"0 1 ".concat(yn),minHeight:0,overflow:"hidden",boxSizing:"border-box"})},{children:[Z&&zn.length>0&&r("nav",n({"aria-label":"Review badge navigation",style:{position:"absolute",top:8,right:ue||"auto",left:se||"auto",zIndex:2,display:"flex",alignItems:"center",gap:7,width:128,minHeight:40,padding:"4px 6px",border:"1px solid #CBD5E1",borderRadius:6,backgroundColor:"#FFFFFF",boxSizing:"border-box",boxShadow:"0 1px 2px rgba(16, 24, 40, 0.06)",font:"inherit"}},{children:[o("input",{type:"text",inputMode:"numeric",pattern:"[0-9]*",value:null!=On?On:"-","aria-label":"Review badge number",onChange:function(e){Dn.current=!0,qn(e.target.value)},style:{width:30,height:28,padding:0,border:"1px solid #A5B4FC",borderRadius:3,color:"#4F46E5",backgroundColor:"#FFFFFF",textAlign:"center",font:"inherit",fontSize:15,outline:"none"}}),r("span",n({"aria-label":"".concat(zn.length," reviews"),style:{flex:1,color:"#4F46E5",fontSize:14,whiteSpace:"nowrap",textAlign:"center"}},{children:["of ",zn.length]})),["previous","next"].map(function(e){var t="previous"===e,i=Tn+(t?-1:1),r=i<0||i>=zn.length;return o("button",n({type:"button","aria-label":"".concat(t?"Previous":"Next"," review badge"),disabled:r,onClick:function(){return Vn(i)},style:{display:"grid",placeItems:"center",width:17,height:28,padding:0,border:0,background:"transparent",color:r?"#C7D2FE":"#4F46E5",cursor:r?"default":"pointer"}},{children:o("svg",n({width:"12",height:"8",viewBox:"0 0 12 8",fill:"none"},{children:o("path",{d:t?"M1 7L6 2L11 7":"M1 1L6 6L11 1",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})}))}),e)})]})),ze.map(function(e){var t,i,l=Ve===e.id,a=null!==(t=Gn.get(e.id))&&void 0!==t?t:"1A",u=e.review_step.score,d=e.review_step.confidence,s=S(u,d),c=!0===(null===(i=e.segment.confidence)||void 0===i?void 0:i.awaiting_llm),f=k(u,d,c),v=e.review_step.review&&null!==e.review_step.review.action,g=Boolean(v)||c;return o(_,n({title:c?"data is being processed":"",arrow:!0},{children:o("span",n({ref:function(n){n?vn.current.set(e.id,n):vn.current.delete(e.id)},style:{position:"absolute",top:0,left:10,visibility:"hidden",display:"inline-flex",cursor:g?"not-allowed":"pointer"}},{children:o("button",n({disabled:g,type:"button","aria-pressed":l,"aria-label":c?"".concat(e.review_step.type," · Page ").concat(e.pageNumber," · Data is being processed"):"".concat(e.review_step.type," · Page ").concat(e.pageNumber),onClick:function(){return Rn(e)},style:{cursor:"inherit",display:"flex",alignItems:"center",justifyContent:"space-around",gap:4,width:v&&!c?105:80,minHeight:25,padding:"2px 5px",border:"1px solid ".concat(v&&!c?"#E2E8F0":f.border),borderRadius:16,backgroundColor:v&&!c?"#F8FAFC":f.background,color:v&&!c?"#475569":f.text,font:"inherit",alignContent:"center",boxShadow:"0 1px 2px rgba(16, 24, 40, 0.08)"}},{children:r(C,n({fontFamily:"Inter",sx:{display:"flex",gap:1,alignItems:"center",flexDirection:"row"}},v&&!c?{children:[o("span",n({style:{fontSize:11,fontWeight:500}},{children:a})),r("span",n({style:{display:"flex",alignItems:"center"}},{children:[o("svg",n({width:"2",height:"14",viewBox:"0 0 1 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:o("path",{d:"M0.399902 0V14",stroke:"#CBD5E1",strokeWidth:"0.8"})})),o("span",n({style:{fontSize:11,fontWeight:500,marginLeft:"7px",display:"flex",alignItems:"center"}},{children:"N/A"===s?s:"".concat(s,"%")}))]})),r("span",n({style:{fontSize:11,fontWeight:500,display:"flex",alignItems:"center"}},{children:[o("svg",n({width:"2",height:"14",viewBox:"0 0 1 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:o("path",{d:"M0.399902 0V14",stroke:"#CBD5E1",strokeWidth:"0.8"})})),o("span",n({style:{display:"flex",marginLeft:"7px",alignItems:"center"}},{children:o(x,{height:14,width:14,strokeWidth:2,color:"#16A34A"})}))]}))]}:{children:[o("span",n({style:{fontSize:11,fontWeight:500}},{children:a})),r("span",n({style:{display:"flex",alignItems:"center"}},{children:[o("svg",n({width:"2",height:"14",viewBox:"0 0 1 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:o("path",{d:"M0.399902 0V14",stroke:f.divider,strokeWidth:"0.8"})})),o("span",n({style:{fontSize:11,fontWeight:500,marginLeft:"7px",display:"flex",alignItems:"center"}},{children:"N/A"===s?s:"".concat(s,"%")}))]}))]}))}))}))}),e.id)})]}))]})),_n&&Ze&&r(h,n({anchorElement:Ze,placement:"bottom-start",offset:{top:8},width:Math.min(hn,N),maxWidth:N},{children:[Ye&&o(b,{width:"100%",maxWidth:"100%",score:_n.review_step.score,reasons:Pn,reason:_n.review_step.reason,gap:_n.review_step.gap,onBack:function(){return Ke(!1)},onClose:Bn}),o("div",n({style:{display:Ye?"none":"block"}},{children:_n.review_step.review&&_n.review_step.human_resolution?o(l,{}):"boundary"===_n.kind?o(g,{width:"100%",maxWidth:"100%",title:_n.segment.label||_n.segment.title,pageNo:"Page ".concat(_n.pageNumber),content:_n.review_step.reason,cognitiveScore:_n.review_step.score,metadata:_n.metadata,previousSegmentTitle:In,nextSegmentTitle:En,defaultStartPage:_n.segment.start_page,defaultEndPage:_n.segment.end_page,styles:{root:{borderColor:An.cardBorder},header:{"& > .MuiSvgIcon-root, & .MuiTypography-root":{color:An.text}}},confirmDisabled:be||un===_n.id,onConfirm:function(e,n,t){t&&m(n.id)&&Wn(_n,n.id,t)},onAdjustManually:function(){return null==Se?void 0:Se(I(_n))},onCognitiveClick:Fn?function(){Ke(!0),null==Ne||Ne(I(_n))}:void 0,onClose:Bn},_n.id):o(w,{width:"100%",maxWidth:"100%",title:_n.metadata.current_label||_n.segment.label||_n.segment.title,pageNo:"Pages ".concat(_n.segment.start_page,"-").concat(_n.segment.end_page),content:_n.review_step.reason,cognitiveScore:_n.review_step.score,metadata:_n.metadata,styles:{root:{borderColor:An.cardBorder},header:{"& > .MuiSvgIcon-root, & .MuiTypography-root":{color:An.text}}},confirmDisabled:be||un===_n.id,confirmationBlocked:Cn,confirmationWarning:Cn?"Please confirm the boundary before confirming the title.":void 0,onActionConfirm:function(e,n){Wn(_n,e,n)},onAdjustManually:function(){return null==Se?void 0:Se(I(_n))},onCognitiveClick:Fn?function(){Ke(!0),null==Ne||Ne(I(_n))}:void 0,onClose:Bn},_n.id)}))]}))]}))}export{E as default};
2
2
  //# sourceMappingURL=SegmentReviewPdfWrapper.js.map
@@ -75,12 +75,12 @@ export interface PdfViewerProps {
75
75
  onCurrentPageChange?: (pageNumber: number) => void;
76
76
  navigationRequest?: PdfNavigationRequest | null;
77
77
  onNavigationSettled?: (event: PdfNavigationSettledEvent) => void;
78
+ disablePdfAnnotations?: boolean;
78
79
  /**
79
- * Hide the PDF's native annotation layer, including comments/popups,
80
- * annotation highlights, and clickable links. Viewer search highlights are
81
- * not affected.
80
+ * Do not mount PDF.js's transparent text-selection layer. This prevents
81
+ * rotated text layers from contributing incorrect scrollable overflow.
82
82
  */
83
- disablePdfAnnotations?: boolean;
83
+ disablePdfTextLayer?: boolean;
84
84
  renderPage?: RenderPage;
85
85
  setRenderRange?: SetRenderRange;
86
86
  }
@@ -92,6 +92,6 @@ export type HighlightArea = {
92
92
  height: number;
93
93
  pageNumber?: number;
94
94
  };
95
- declare const PdfViewer: ({ pdfUrl, highlightText, highlightPages, highlightCordinatePages, highlightColor, activeHighlightColor, jumpToPageValue, pdfName, onClose, customStyles, customClasses, customIcons, useCoordinates, fallbackPages, activeCitationIndex, onActiveCitationChange, headerAction, isZoomEnabled, showHighlightsAction, defaultScale, useRange, rangeOfPages, showFullScreenAction, segments, segmentTooltipText, onCurrentPageChange, navigationRequest, onNavigationSettled, disablePdfAnnotations, renderPage, setRenderRange, }: PdfViewerProps) => import("react/jsx-runtime").JSX.Element;
95
+ declare const PdfViewer: ({ pdfUrl, highlightText, highlightPages, highlightCordinatePages, highlightColor, activeHighlightColor, jumpToPageValue, pdfName, onClose, customStyles, customClasses, customIcons, useCoordinates, fallbackPages, activeCitationIndex, onActiveCitationChange, headerAction, isZoomEnabled, showHighlightsAction, defaultScale, useRange, rangeOfPages, showFullScreenAction, segments, segmentTooltipText, onCurrentPageChange, navigationRequest, onNavigationSettled, disablePdfAnnotations, disablePdfTextLayer, renderPage, setRenderRange, }: PdfViewerProps) => import("react/jsx-runtime").JSX.Element;
96
96
  export default PdfViewer;
97
97
  //# sourceMappingURL=PdfViewer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"PdfViewer.d.ts","sourceRoot":"","sources":["../../../../../src/features/PdfViewer/PdfViewer.tsx"],"names":[],"mappings":"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"}
1
+ {"version":3,"file":"PdfViewer.d.ts","sourceRoot":"","sources":["../../../../../src/features/PdfViewer/PdfViewer.tsx"],"names":[],"mappings":"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"}
@@ -56,12 +56,14 @@ export interface SegmentReviewPdfWrapperProps {
56
56
  styles?: Record<string, React.CSSProperties>;
57
57
  disableAllActions?: boolean;
58
58
  disablePdfAnnotations?: boolean;
59
+ /** Disable the transparent PDF text layer that can overflow rotated pages. */
60
+ disablePdfTextLayer?: boolean;
59
61
  disableTitleCheckUntilBoundaryCheckCompleted?: boolean;
60
62
  }
61
63
  /**
62
64
  * Orchestrates the PDF, review badges, page navigation, active card and actions.
63
65
  * It consumes backend-shaped segments directly; cards never parse the raw payload.
64
66
  */
65
- export default function SegmentReviewPdfWrapper({ pdfUrl, pdfName, segments, styles, pdfViewerProps, showBadges, sortByConfidence, filterByConfidence, showBadgeNavigation, autoSelectReviewOnPageChange, autoAdvanceAfterConfirm, badgePreloadPages, badgeOffsetTop, badgeOffsetRight, badgeOffsetLeft, initialReviewId, onBoundaryAction, onLabelAction, onActiveReviewChange, onCurrentPageChange, onActionError, disableAllActions, disablePdfAnnotations, disableTitleCheckUntilBoundaryCheckCompleted, onAdjustManually, onCognitiveClick, className, style, viewerStyle, railStyle, redirectionData, }: SegmentReviewPdfWrapperProps): import("react/jsx-runtime").JSX.Element;
67
+ export default function SegmentReviewPdfWrapper({ pdfUrl, pdfName, segments, styles, pdfViewerProps, showBadges, sortByConfidence, filterByConfidence, showBadgeNavigation, autoSelectReviewOnPageChange, autoAdvanceAfterConfirm, badgePreloadPages, badgeOffsetTop, badgeOffsetRight, badgeOffsetLeft, initialReviewId, onBoundaryAction, onLabelAction, onActiveReviewChange, onCurrentPageChange, onActionError, disableAllActions, disablePdfAnnotations, disablePdfTextLayer, disableTitleCheckUntilBoundaryCheckCompleted, onAdjustManually, onCognitiveClick, className, style, viewerStyle, railStyle, redirectionData, }: SegmentReviewPdfWrapperProps): import("react/jsx-runtime").JSX.Element;
66
68
  export {};
67
69
  //# sourceMappingURL=SegmentReviewPdfWrapper.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SegmentReviewPdfWrapper.d.ts","sourceRoot":"","sources":["../../../../../src/features/SegmentReviewComponents/SegmentReviewPdfWrapper.tsx"],"names":[],"mappings":"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"}
1
+ {"version":3,"file":"SegmentReviewPdfWrapper.d.ts","sourceRoot":"","sources":["../../../../../src/features/SegmentReviewComponents/SegmentReviewPdfWrapper.tsx"],"names":[],"mappings":"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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@viswa-test/test-citation",
3
- "version": "0.0.316",
3
+ "version": "0.0.317",
4
4
  "author": "Viswa Koduru",
5
5
  "description": "",
6
6
  "license": "MIT",