@viswa-test/test-citation 0.0.369 → 0.0.371
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/features/CognitiveCompare/CitationAnchor.js +1 -1
- package/dist/cjs/features/CognitiveCompare/CognitiveCompare.js +1 -1
- package/dist/cjs/features/CognitiveCompare/CognitiveComparehelpers.js +1 -1
- package/dist/cjs/features/CognitiveCompare/CognitivePopup.js +1 -1
- package/dist/cjs/features/CognitiveCompare/Guidelines/components/GuidelinePanel.js +1 -1
- package/dist/cjs/features/CognitiveCompare/Guidelines/components/WebGptPanel.js +1 -1
- package/dist/cjs/features/CognitiveCompare/Guidelines/utils/hasGptCitationObjects.js +2 -0
- package/dist/cjs/features/CognitiveCompare/Guidelines/utils/hasGptCitationObjects.js.map +1 -0
- package/dist/cjs/features/CognitiveCompare/Guidelines/utils/processGuidelinesMarkdown.js +1 -1
- package/dist/cjs/features/CognitiveCompare/components/SectionAccordion.js +1 -1
- package/dist/cjs/features/CognitiveCompare/components/SubSectionAccordion.js +1 -1
- package/dist/cjs/features/CognitiveCompare/hooks/memoizedMarkdown.js +1 -1
- package/dist/cjs/features/CognitiveCompare/hooks/useCompareData.js +1 -1
- package/dist/cjs/features/CognitiveCompare/hooks/useLinesCalculator.js +1 -1
- package/dist/cjs/features/CognitiveCompare/hooks/useSideBySide.js +1 -1
- package/dist/cjs/features/CognitiveInternalgptReasoning/CognitiveInternalgptCoreComponent.js +1 -1
- package/dist/cjs/features/GptWebCitation/GptWebCitation.js +1 -1
- package/dist/cjs/features/GptWebCitation/GptWebCitationImageCitation.js +1 -1
- package/dist/cjs/features/GptWebCitation/utils/fixedHeight.utils.js +1 -1
- package/dist/cjs/features/PdfViewer/PdfContainer.js +1 -1
- package/dist/cjs/features/PdfViewer/PdfStyle.js +1 -1
- package/dist/cjs/features/PdfViewer/PdfToolbar.js +1 -1
- package/dist/cjs/features/PdfViewer/PdfViewer.js +1 -1
- package/dist/cjs/features/SegmentReviewComponents/SegmentReviewPdfWrapper.js +1 -1
- package/dist/cjs/features/SegmentReviewComponents/helper.js +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/features/CognitiveCompare/CitationAnchor.js +1 -1
- package/dist/features/CognitiveCompare/CognitiveCompare.js +1 -1
- package/dist/features/CognitiveCompare/CognitiveComparehelpers.js +1 -1
- package/dist/features/CognitiveCompare/CognitivePopup.js +1 -1
- package/dist/features/CognitiveCompare/Guidelines/components/GuidelinePanel.js +1 -1
- package/dist/features/CognitiveCompare/Guidelines/components/WebGptPanel.js +1 -1
- package/dist/features/CognitiveCompare/Guidelines/utils/hasGptCitationObjects.js +2 -0
- package/dist/features/CognitiveCompare/Guidelines/utils/hasGptCitationObjects.js.map +1 -0
- package/dist/features/CognitiveCompare/Guidelines/utils/processGuidelinesMarkdown.js +1 -1
- package/dist/features/CognitiveCompare/components/SectionAccordion.js +1 -1
- package/dist/features/CognitiveCompare/components/SubSectionAccordion.js +1 -1
- package/dist/features/CognitiveCompare/hooks/memoizedMarkdown.js +1 -1
- package/dist/features/CognitiveCompare/hooks/useCompareData.js +1 -1
- package/dist/features/CognitiveCompare/hooks/useLinesCalculator.js +1 -1
- package/dist/features/CognitiveCompare/hooks/useSideBySide.js +1 -1
- package/dist/features/CognitiveInternalgptReasoning/CognitiveInternalgptCoreComponent.js +1 -1
- package/dist/features/GptWebCitation/GptWebCitation.js +1 -1
- package/dist/features/GptWebCitation/GptWebCitationImageCitation.js +1 -1
- package/dist/features/GptWebCitation/utils/fixedHeight.utils.js +1 -1
- package/dist/features/PdfViewer/PdfContainer.js +1 -1
- package/dist/features/PdfViewer/PdfStyle.js +1 -1
- package/dist/features/PdfViewer/PdfToolbar.js +1 -1
- package/dist/features/PdfViewer/PdfViewer.js +1 -1
- package/dist/features/SegmentReviewComponents/SegmentReviewPdfWrapper.js +1 -1
- package/dist/features/SegmentReviewComponents/helper.js +1 -1
- package/dist/index.js +1 -1
- package/dist/types/src/features/CognitiveCompare/CitationAnchor.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/CognitiveCompare.d.ts +1 -1
- package/dist/types/src/features/CognitiveCompare/CognitiveCompare.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/CognitiveCompareTypes.d.ts +1 -1
- package/dist/types/src/features/CognitiveCompare/CognitiveCompareTypes.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/CognitiveComparehelpers.d.ts +12 -0
- package/dist/types/src/features/CognitiveCompare/CognitiveComparehelpers.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/Guidelines/components/GuidelinePanel.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/Guidelines/components/WebGptPanel.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/Guidelines/utils/hasGptCitationObjects.d.ts +3 -0
- package/dist/types/src/features/CognitiveCompare/Guidelines/utils/hasGptCitationObjects.d.ts.map +1 -0
- package/dist/types/src/features/CognitiveCompare/Guidelines/utils/processGuidelinesMarkdown.d.ts +14 -1
- package/dist/types/src/features/CognitiveCompare/Guidelines/utils/processGuidelinesMarkdown.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/components/SectionAccordion.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/components/SubSectionAccordion.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/hooks/memoizedMarkdown.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/hooks/useCompareData.d.ts +1 -1
- package/dist/types/src/features/CognitiveCompare/hooks/useCompareData.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/hooks/useLinesCalculator.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/hooks/useSideBySide.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveInternalgptReasoning/CognitiveInternalgptCoreComponent.d.ts +1 -0
- package/dist/types/src/features/CognitiveInternalgptReasoning/CognitiveInternalgptCoreComponent.d.ts.map +1 -1
- package/dist/types/src/features/GptWebCitation/GptWebCitation.d.ts.map +1 -1
- package/dist/types/src/features/GptWebCitation/GptWebCitationImageCitation.d.ts +2 -1
- package/dist/types/src/features/GptWebCitation/GptWebCitationImageCitation.d.ts.map +1 -1
- package/dist/types/src/features/GptWebCitation/types.d.ts +11 -0
- package/dist/types/src/features/GptWebCitation/types.d.ts.map +1 -1
- package/dist/types/src/features/GptWebCitation/utils/fixedHeight.utils.d.ts +2 -0
- package/dist/types/src/features/GptWebCitation/utils/fixedHeight.utils.d.ts.map +1 -1
- package/dist/types/src/features/PdfViewer/PdfContainer.d.ts +2 -4
- package/dist/types/src/features/PdfViewer/PdfContainer.d.ts.map +1 -1
- package/dist/types/src/features/PdfViewer/PdfStyle.d.ts.map +1 -1
- package/dist/types/src/features/PdfViewer/PdfToolbar.d.ts.map +1 -1
- package/dist/types/src/features/PdfViewer/PdfViewer.d.ts +2 -18
- package/dist/types/src/features/PdfViewer/PdfViewer.d.ts.map +1 -1
- package/dist/types/src/features/SegmentReviewComponents/SegmentReviewPdfWrapper.d.ts +20 -1
- package/dist/types/src/features/SegmentReviewComponents/SegmentReviewPdfWrapper.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +0 -4
- package/dist/types/src/index.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),i=require("react/jsx-runtime"),t=require("react"),n=require("lucide-react"),o=require("../CognitiveInternalgptReasoning/CognitiveInternalgptCoreComponent.js"),l=require("./GptWebCitationImageCitation.js"),a=require("./GptWebCitationSkeleton.js"),s=require("./types.js"),r=require("./utils/citationData.utils.js"),u=require("./utils/styleOverrides.utils.js"),d=require("./utils/fixedHeight.utils.js"),g=require("./GptWebCitation.module.css.js"),c=require("../../assests/svg/NeuralNetworkIcon.js"),v=function(t){var o=t.variant,l=t.disabled,a=t.onClick,s=t.title,r=t.style;return i.jsx("button",e.__assign({type:"button",className:g.default.webCitationButton,onClick:a,disabled:l,title:s,style:r},{children:"gpt"===o?i.jsxs(i.Fragment,{children:[i.jsx(c.default,{className:g.default.webCitationButtonIcon}),"View GPT Citation"]}):i.jsxs(i.Fragment,{children:[i.jsx(n.Globe,{size:24,className:g.default.webCitationButtonIcon}),"View Web Citation"]})}))};exports.default=function(c){var p,C,b,
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),i=require("react/jsx-runtime"),t=require("react"),n=require("lucide-react"),o=require("../CognitiveInternalgptReasoning/CognitiveInternalgptCoreComponent.js"),l=require("./GptWebCitationImageCitation.js"),a=require("./GptWebCitationSkeleton.js"),s=require("./types.js"),r=require("./utils/citationData.utils.js"),u=require("./utils/styleOverrides.utils.js"),d=require("./utils/fixedHeight.utils.js"),g=require("./GptWebCitation.module.css.js"),c=require("../../assests/svg/NeuralNetworkIcon.js"),v=function(t){var o=t.variant,l=t.disabled,a=t.onClick,s=t.title,r=t.style;return i.jsx("button",e.__assign({type:"button",className:g.default.webCitationButton,onClick:a,disabled:l,title:s,style:r},{children:"gpt"===o?i.jsxs(i.Fragment,{children:[i.jsx(c.default,{className:g.default.webCitationButtonIcon}),"View GPT Citation"]}):i.jsxs(i.Fragment,{children:[i.jsx(n.Globe,{size:24,className:g.default.webCitationButtonIcon}),"View Web Citation"]})}))};exports.default=function(c){var p,_,C,b,w=c.gptCitation,f=c.defaultCitationUrl,m=c.citationType,x=c.webCitationData,h=c.topic,y=c.sourceLabel,k=c.relevanceScore,j=c.learnedFrom,F=c.webCitationStatus,S=c.onGenerateWebCitation,H=c.showWebCitation,I=c.onToggleCitationView,B=c.showExpandImageButton,L=void 0===B||B,W=c.onFullscreenChange,T=c.showGptMaximizeButton,N=c.iconsConfig,V=c.isFixedHeight,M=void 0!==V&&V,q=c.useParentHeight,E=void 0!==q&&q,G=c.styles,P=t.useMemo(function(){return function(i){var t,n,o,l,a,s,r,d,g,c,v;return{container:null==i?void 0:i.container,gptWrapper:e.__assign(e.__assign({},null===(t=null==i?void 0:i.gptCitation)||void 0===t?void 0:t.wrapper),null==i?void 0:i.gptCitationWrapper),gptFooterAction:e.__assign(e.__assign({},null===(n=null==i?void 0:i.gptCitation)||void 0===n?void 0:n.footerAction),null==i?void 0:i.footerAction),gptToggleButton:e.__assign(e.__assign({},null===(o=null==i?void 0:i.gptCitation)||void 0===o?void 0:o.toggleButton),null==i?void 0:i.webCitationButton),webPanel:e.__assign(e.__assign({},null==i?void 0:i.container),null===(l=null==i?void 0:i.webCitation)||void 0===l?void 0:l.panel),webHeader:null===(a=null==i?void 0:i.webCitation)||void 0===a?void 0:a.header,webContent:null===(s=null==i?void 0:i.webCitation)||void 0===s?void 0:s.content,webFooter:null===(r=null==i?void 0:i.webCitation)||void 0===r?void 0:r.footer,webToggleButton:e.__assign(e.__assign({},null===(d=null==i?void 0:i.webCitation)||void 0===d?void 0:d.toggleButton),null==i?void 0:i.webCitationButton),webLearnedFrom:null===(g=null==i?void 0:i.webCitation)||void 0===g?void 0:g.learnedFrom,webImage:null===(c=null==i?void 0:i.webCitation)||void 0===c?void 0:c.image,webSkeleton:null===(v=null==i?void 0:i.webCitation)||void 0===v?void 0:v.skeleton,webImageVisitLink:u.resolveWebCitationVisitLinkStyles(null==i?void 0:i.webCitation,"image"),webSkeletonVisitLink:u.resolveWebCitationVisitLinkStyles(null==i?void 0:i.webCitation,"skeleton")}}(G)},[G]),z=s.allowsGptCitationView(m),U=s.allowsWebCitationView(m),A=s.showsCitationViewToggle(m),D=M||E,O=t.useMemo(function(){return M?d.resolveFixedHeightLayout(w.bodyHeight,A):null},[M,w.bodyHeight,A]),R=t.useMemo(function(){return O?d.getFixedPanelStyle(O.panelHeight):void 0},[O]),J=t.useMemo(function(){return E?d.getParentHeightPanelStyle():void 0},[E]),K=null!=J?J:R,Q=t.useMemo(function(){var e,i;return{MaximizeIcon:null!==(e=null==N?void 0:N.MaximizeIcon)&&void 0!==e?e:null===(i=w.iconsConfig)||void 0===i?void 0:i.MaximizeIcon,ExternalLinkIcon:null==N?void 0:N.ExternalLinkIcon}},[N,null===(p=w.iconsConfig)||void 0===p?void 0:p.MaximizeIcon]),X=t.useMemo(function(){var i=E?{bodyHeight:d.getParentHeightGptBodyHeight(A)}:M&&O?{bodyHeight:O.gptBodyHeight}:{};return e.__assign(e.__assign(e.__assign(e.__assign({},w),i),{disableMaximize:void 0!==T?!T:w.disableMaximize}),A||m===s.CitationType.WEB?{DocumentTitle:void 0,previewCallback:void 0}:{})},[w,T,A,m,E,M,O]),Y=t.useState(m!==s.CitationType.GPT),Z=Y[0],$=Y[1],ee=m!==s.CitationType.GPT&&(m===s.CitationType.WEB||(null!=H?H:Z)),ie=void 0!==H,te=t.useMemo(function(){return x?r.mapCitationDataToDisplay(x):null},[x]),ne=null!==(_=null!=h?h:null==te?void 0:te.topic)&&void 0!==_?_:"Web Citation",oe=null!==(C=null!=k?k:null==te?void 0:te.relevanceScore)&&void 0!==C?C:0,le=null!=j?j:null==te?void 0:te.learnedFrom,ae=r.resolveSkeletonVisitUrl(null==te?void 0:te.highlightedUrl,null!==(b=null==te?void 0:te.citationUrl)&&void 0!==b?b:f),se=r.getWebCitationImageUrl(x),re=t.useMemo(function(){return function(e,i,t){return t?"success":e||(i?"error":"pending")}(F,x,se)},[F,x,se]),ue=t.useCallback(function(){I?I():ie||$(!1)},[I,ie]),de=t.useCallback(function(){I?I():ie||$(!0),se||"success"===re||null==S||S()},[I,ie,se,re,S]),ge=null!=y?y:"Source: Web Citation > ".concat(ne),ce=function(t){var n=!!X.DocumentTitle,l=[g.default.gptCitationWrapper,n?g.default.gptCitationWrapperWithSource:"",D?g.default.gptCitationWrapperFixedHeight:""].filter(Boolean).join(" ");return i.jsxs("div",e.__assign({className:l,style:e.__assign(e.__assign({},P.gptWrapper),K)},{children:[i.jsx(o.default,e.__assign({},X,{splitterCustomStyle:!0,onFullscreenChange:W})),t&&(n?i.jsx("div",e.__assign({className:g.default.gptCitationFooterAction,style:P.gptFooterAction},{children:t})):i.jsx("div",e.__assign({className:[g.default.gptCitationToggleFooter,D?g.default.gptCitationToggleFooterFixedHeight:""].filter(Boolean).join(" "),style:P.gptFooterAction},{children:t})))]}))};return z&&!ee?i.jsx("div",e.__assign({className:g.default.overlay,style:e.__assign(e.__assign({},P.container),J)},{children:ce(A?i.jsx(v,{variant:"web",onClick:de,title:"View web-based citation for this source.",style:P.gptToggleButton}):void 0)})):U?i.jsxs("div",e.__assign({className:[g.default.panel,D?g.default.gptCitationWrapperFixedHeight:""].filter(Boolean).join(" "),style:e.__assign(e.__assign({},P.webPanel),K)},{children:[i.jsxs("div",e.__assign({className:g.default.panelHeader,style:P.webHeader},{children:[i.jsx("span",e.__assign({className:g.default.panelSource},{children:ge})),i.jsx("div",e.__assign({className:g.default.panelHeaderActions},{children:oe>0&&i.jsxs("div",e.__assign({className:g.default.confidenceBadge,title:"Decision strength"},{children:[i.jsx(n.Sparkles,{size:14}),oe,"%"]}))}))]})),i.jsx("div",e.__assign({className:[g.default.panelContent,g.default.panelContentExpanded,D?g.default.panelContentFixedHeight:""].filter(Boolean).join(" "),style:e.__assign(e.__assign({},P.webContent),D?d.getFixedWebContentStyle():void 0)},{children:"pending"===re?i.jsx(a.default,{status:"pending",citationUrl:ae,ExternalLinkIcon:Q.ExternalLinkIcon,styles:P.webSkeleton,visitLinkStyles:P.webSkeletonVisitLink,isFixedHeight:D}):"success"===re&&se?i.jsx(l.default,{citationImage:se,citationUrl:ae,showExpandImageButton:L,iconsConfig:Q,styles:P.webImage,visitLinkStyles:P.webImageVisitLink,skeletonStyles:P.webSkeleton,skeletonVisitLinkStyles:P.webSkeletonVisitLink,isFixedHeight:D,onFullscreenChange:W}):i.jsx(a.default,{status:"error",citationUrl:ae,ExternalLinkIcon:Q.ExternalLinkIcon,styles:P.webSkeleton,visitLinkStyles:P.webSkeletonVisitLink,isFixedHeight:D})})),i.jsxs("div",e.__assign({className:g.default.panelFooter,style:P.webFooter},{children:[A?i.jsx(v,{variant:"gpt",onClick:ue,style:P.webToggleButton}):null,le&&i.jsxs("span",e.__assign({className:g.default.learnedFrom,style:P.webLearnedFrom},{children:["Learned From ",le]}))]}))]})):i.jsx("div",e.__assign({className:g.default.overlay,style:e.__assign(e.__assign({},P.container),J)},{children:ce()}))};
|
|
2
2
|
//# sourceMappingURL=GptWebCitation.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),i=require("react/jsx-runtime"),t=require("react"),n=require("lucide-react"),l=require("./GptWebCitationImageFullScreenView.js"),a=require("./GptWebCitationSkeleton.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),i=require("react/jsx-runtime"),t=require("react"),n=require("lucide-react"),l=require("./GptWebCitationImageFullScreenView.js"),a=require("./GptWebCitationSkeleton.js"),r=require("./utils/citationData.utils.js"),s=require("./GptWebCitation.module.css.js");exports.default=function(o){var u,d,c=o.citationImage,f=o.citationUrl,g=o.skeletonVisitUrl,v=o.showExpandImageButton,x=void 0===v||v,m=o.iconsConfig,p=o.styles,j=o.visitLinkStyles,C=o.skeletonStyles,h=o.skeletonVisitLinkStyles,k=o.isFixedHeight,_=void 0!==k&&k,y=o.onFullscreenChange,b=null!==(u=null==m?void 0:m.MaximizeIcon)&&void 0!==u?u:n.Maximize2,w=null!==(d=null==m?void 0:m.ExternalLinkIcon)&&void 0!==d?d:n.ExternalLink,I=t.useState(!1),L=I[0],S=I[1],E=t.useState("loading"),N=E[0],q=E[1],B=t.useRef(!1);t.useEffect(function(){var e=!0;B.current&&(B.current=!1,null==y||y(!1)),q("loading"),S(!1);var i=new Image;return i.onload=function(){e&&q("loaded")},i.onerror=function(){e&&q("error")},i.src=c,function(){e=!1,i.onload=null,i.onerror=null}},[c,y]),t.useEffect(function(){return function(){B.current&&(B.current=!1,null==y||y(!1))}},[y]);var F="loaded"===N,H=r.sanitizeExternalUrl(f);return i.jsxs("div",e.__assign({className:[s.default.imageCitationWrapper,_?s.default.imageCitationWrapperFixedHeight:""].filter(Boolean).join(" "),style:null==p?void 0:p.wrapper},{children:[i.jsx("div",e.__assign({className:[s.default.imageCitationCenter,_?s.default.imageCitationCenterFixedHeight:""].filter(Boolean).join(" "),style:null==p?void 0:p.center},{children:F?i.jsxs("div",e.__assign({className:[s.default.imageCitationViewport,_?s.default.imageCitationViewportFixedHeight:""].filter(Boolean).join(" "),style:null==p?void 0:p.viewport},{children:[i.jsx("div",e.__assign({className:[s.default.imageCitationScrollContainer,_?s.default.imageCitationScrollContainerFixedHeight:""].filter(Boolean).join(" "),style:null==p?void 0:p.scrollContainer},{children:i.jsx("img",{src:c,alt:"Web citation snapshot",className:[s.default.citationImage,_?s.default.citationImageContained:""].filter(Boolean).join(" "),style:null==p?void 0:p.image})})),x&&i.jsx("button",e.__assign({type:"button",onClick:function(e){e.stopPropagation(),B.current=!0,null==y||y(!0),S(!0)},className:s.default.expandImageButton,style:null==p?void 0:p.expandButton,"aria-label":"View citation image in full screen",title:"Expand image"},{children:i.jsx(b,{size:16,strokeWidth:2})}))]})):i.jsx(a.default,{status:"error"===N?"error":"pending",citationUrl:null!=g?g:f,ExternalLinkIcon:null==m?void 0:m.ExternalLinkIcon,styles:C,visitLinkStyles:h,isFixedHeight:_})})),H&&F&&i.jsxs("div",e.__assign({className:s.default.visitLinkRow,style:null==j?void 0:j.row},{children:[i.jsx("span",e.__assign({className:s.default.visitLinkHint,style:null==j?void 0:j.hint},{children:"Open link in new tab to read in detail"})),i.jsxs("a",e.__assign({href:H,target:"_blank",rel:"noreferrer",className:s.default.visitLink,style:null==j?void 0:j.link},{children:["Visit Link",i.jsx(w,{size:16})]}))]})),L&&F&&i.jsx(l.default,{src:c,onClose:function(){B.current=!1,null==y||y(!1),S(!1)},styles:null==p?void 0:p.fullScreen})]}))};
|
|
2
2
|
//# sourceMappingURL=GptWebCitationImageCitation.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e="520px",t="3.25rem";exports.getFixedPanelStyle=function(e){return{height:e,minHeight:e,maxHeight:e,width:"100%",display:"flex",flexDirection:"column",overflow:"hidden",boxSizing:"border-box"}},exports.getFixedWebContentStyle=function(){return{flex:1,minHeight:0,maxHeight:"none",overflow:"hidden",display:"flex",flexDirection:"column"}},exports.resolveFixedHeightLayout=function(n
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e="520px",t="3.25rem";exports.getFixedPanelStyle=function(e){return{height:e,minHeight:e,maxHeight:e,width:"100%",display:"flex",flexDirection:"column",overflow:"hidden",boxSizing:"border-box"}},exports.getFixedWebContentStyle=function(){return{flex:1,minHeight:0,maxHeight:"none",overflow:"hidden",display:"flex",flexDirection:"column"}},exports.getParentHeightGptBodyHeight=function(e){return void 0===e&&(e=!0),e?"calc(100% - ".concat(t,")"):"100%"},exports.getParentHeightPanelStyle=function(){return{height:"100%",minHeight:0,width:"100%",display:"flex",flexDirection:"column",overflow:"hidden",boxSizing:"border-box"}},exports.resolveFixedHeightLayout=function(i,n){if(void 0===n&&(n=!0),!n){var o=null!=i?i:e;return{contentHeight:o,gptBodyHeight:o,panelHeight:o}}if(i)return{contentHeight:i,gptBodyHeight:i,panelHeight:"calc(".concat(i," + ").concat(t,")")};var r="calc(".concat(e," - ").concat(t,")");return{contentHeight:r,gptBodyHeight:r,panelHeight:e}};
|
|
2
2
|
//# sourceMappingURL=fixedHeight.utils.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),r=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),r=require("react/jsx-runtime"),s=require("@react-pdf-viewer/core"),i=require("./PdfStyle.js"),n="https://unpkg.com/pdfjs-dist@3.11.174/build/pdf.worker.min.js";exports.default=function(t){var l=t.pdfUrl,o=t.plugins,a=t.onLoad,d=t.customStyles,u=t.onPageChange,p=t.defaultScale;return r.jsx("div",e.__assign({style:e.__assign(e.__assign({},i.pdfStyles.pdfConatiner),null==d?void 0:d.pdfContainer)},{children:r.jsx(s.Worker,e.__assign({workerUrl:n},{children:r.jsx(s.Viewer,{fileUrl:l,defaultScale:p,plugins:o,onDocumentLoad:a,onPageChange:u})}))}))},exports.pdfWorker=n;
|
|
2
2
|
//# sourceMappingURL=PdfContainer.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.pdfStyles={pdfViewer:{borderRadius:"12px",padding:"16px",width:"100%",height:"100%",minWidth:0,boxSizing:"border-box",overflow:"hidden"},card:{border:"2px solid #E5E7EB",backgroundColor:"#FFFFFF",borderRadius:"12px",width:"100%",minWidth:0,boxSizing:"border-box",overflow:"hidden"},header:{display:"flex",
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.pdfStyles={pdfViewer:{borderRadius:"12px",padding:"16px",width:"100%",height:"100%",minWidth:0,boxSizing:"border-box",overflow:"hidden"},card:{border:"2px solid #E5E7EB",backgroundColor:"#FFFFFF",borderRadius:"12px",width:"100%",minWidth:0,boxSizing:"border-box",overflow:"hidden"},header:{display:"flex",justifyContent:"space-between",alignItems:"center",position:"relative",width:"100%",minWidth:0,boxSizing:"border-box"},title:{fontSize:"14px",fontWeight:600,color:"#60A3F8",fontFamily:'Roboto, "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif'},toolbar:{display:"flex",alignItems:"center",gap:"8px",position:"relative"},button:{border:"1px solid #DFE5EC",borderRadius:"6px",padding:"4px 8px",fontSize:"12px",cursor:"pointer",backgroundColor:"#FFFFFF"},buttonDisabled:{opacity:.4,cursor:"not-allowed"},counter:{fontSize:"13px",color:"#64748B",margin:"0 6px"},viewerWrapper:{height:"30rem",overflow:"auto",display:"flex",justifyContent:"center",alignItems:"center",border:"1px solid #DEE4EB",borderRadius:"8px"},emptyState:{fontSize:"14px",color:"#EF4444"},pdfConatiner:{height:"100%",overflow:"auto",display:"flex",justifyContent:"center",alignItems:"center"}};
|
|
2
2
|
//# sourceMappingURL=PdfStyle.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),i=require("react"),t=require("./PdfStyle.js"),s=require("../../assests/svg/PdfViewerIcons.js"),o=require("@mui/material"),r=require("lucide-react");function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=l(i);exports.default=function(i){i.highlightIndex;var l=i.totalHighlights,d=i.controls,c=i.currentPosition,p=i.pdfName,g=i.onClose,x=i.pdfUrl,u=i.viewerRef,h=i.customStyles,f=i.customClasses,_=i.customIcons,v=i.headerAction,y=i.isZoomEnabled,m=void 0===y||y,j=i.showHighlightsAction,b=void 0===j||j,w=i.showFullScreenAction,S=void 0===w||w,k=i.currentSegment,I=i.segmentTooltipText,F=void 0===I?"Details of current segment":I,C=i.currentPage,D=i.totalPages,W=i.onPageNavigate,E=d.ZoomInButton,B=d.ZoomOutButton,P=d.ZoomPopover,T=d.goToPrevious,z=d.goToNext,A=a.default.useState(String(C)),L=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"},t.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",minWidth:0}},{children:[n.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:"12px",flex:1,minWidth:0,overflow:"hidden"}},{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(o.Tooltip,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:b?"16px":"2px",color:"#4B5563",flexShrink:0,whiteSpace:"nowrap",minWidth:"fit-content"}},{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:L,onChange:function(e){var n=e.target.value.replace(/\D/g,"");q(n)},onBlur:function(){var e=Number(L);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)}))]})),m&&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&&b&&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:T,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(o.Tooltip,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(o.Tooltip,e.__assign({title:F,arrow:!0,placement:"top"},{children:n.jsx(r.Info,{size:16,color:"#4F46E5",strokeWidth:2,style:{flexShrink:0}})})),n.jsxs("span",e.__assign({style:{overflow:"hidden",textOverflow:"ellipsis"}},{children:["Viewing ",k.title," • Pages ",R(k.start_page),"-",R(k.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"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("react/jsx-runtime"),i=require("@react-pdf-viewer/core"),o=require("./PdfContainer.js"),n=require("./PdfToolbar.js"),r=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 s=require("react"),l=require("../ScannedDocCitation/ScannedDocCitation.js"),u=function(e){switch(e){case"ActualSize":return i.SpecialZoomLevel.ActualSize;case"PageFit":return i.SpecialZoomLevel.PageFit;case"PageWidth":return i.SpecialZoomLevel.PageWidth;default:return null!=e?e:i.SpecialZoomLevel.PageWidth}};exports.default=function(c){var d,g=c.pdfUrl,f=c.highlightText,h=c.highlightPages,v=c.highlightCordinatePages,p=c.highlightColor,m=void 0===p?"yellow":p,x=c.activeHighlightColor,S=void 0===x?"#f7dc51":x,_=c.jumpToPageValue,P=void 0===_?0:_,T=c.pdfName,C=c.onClose,w=c.customStyles,y=c.customClasses,b=c.customIcons,A=c.useCoordinates,q=c.fallbackPages,j=c.activeCitationIndex,H=c.onActiveCitationChange,I=c.headerAction,F=c.isZoomEnabled,Z=void 0===F||F,L=c.showHighlightsAction,N=void 0===L||L,z=c.defaultScale,R=void 0===z?i.SpecialZoomLevel.ActualSize:z,D=c.useRange,E=void 0!==D&&D,M=c.rangeOfPages,V=void 0===M?null:M,W=c.showFullScreenAction,O=void 0===W||W,B=c.segments,U=void 0===B?[{title:"Document 2",start_page:52,end_page:52,page_count:1}]:B,k=c.segmentTooltipText,J=s.useRef(null),K=s.useState(0),G=K[0],Q=K[1],X=s.useState(0),Y=X[0],$=X[1],ee=s.useMemo(function(){if(A)return new Set(v.map(function(e){return e.pageIndex}));var e=new Set;return Object.values(h).forEach(function(t){t>0&&e.add(t-1)}),e},[v,h,A]),te=(d=f)&&0!==d.length?d.filter(function(e){return!d.some(function(t){return t!==e&&t.includes(e)})}):d,ie=a.PdfHighlightControls(te,A?{}:h,J,ee,A,A?v:[],m,S),oe=ie.highlightIndex,ne=ie.cursorIndex,re=ie.setCursorIndex,ae=ie.orderedKeys,se=ie.totalHighlights,le=ie.getValidPosition,ue=ie.tryJump,ce=ie.jumpToPage,de=ie.zoomTo,ge=ie.plugins,fe=ie.controls,he=ie.hideNonTargetHighlights,ve=ie.deduplicateHighlights,pe=le(ne),me=s.useMemo(function(){var e=G+1;return U.find(function(t){return e>=t.start_page&&e<=t.end_page})},[G,U]);s.useEffect(function(){void 0!==j&&j!==ne&&re(j)},[j]);var xe=e.__assign(e.__assign({},fe),{goToNext:function(){ne>=se-1||(fe.goToNext(),H&&H(ne+1))},goToPrevious:function(){ne<=0||(fe.goToPrevious(),H&&H(ne-1))}});if(!g)return t.jsx(l.default,{pages:q,activeCitationIndex:j,onActiveCitationChange:H,headerAction:I});return t.jsxs("div",e.__assign({ref:J,className:(null==y?void 0:y.pdfViewerWrapper)||"",style:e.__assign(e.__assign(e.__assign({height:"100%",minHeight:0,minWidth:0,overflow:"hidden",display:"flex",flexDirection:"column"},r.pdfStyles.pdfViewer),{display:"flex",flexDirection:"column",height:"100%",width:"100%",backgroundColor:"#FAFAFA"}),null==w?void 0:w.pdfViewer)},{children:[t.jsx(n.default,{highlightIndex:oe,totalHighlights:se,controls:xe,currentPosition:pe,pdfName:T,onClose:C,pdfUrl:g,viewerRef:J,customStyles:w,customClasses:y,customIcons:b,headerAction:I,isZoomEnabled:Z,showHighlightsAction:N,showFullScreenAction:O,currentSegment:me,segmentTooltipText:k,currentPage:G+1,totalPages:Y,onPageNavigate:function(e){var t=Math.min(Math.max(e,1),Y||e);Q(t-1),ce(t-1)}}),t.jsx(o.default,{defaultScale:u(R),pdfUrl:g,plugins:ge,customStyles:w,onLoad:function(t){$(t.doc.numPages);var o=!A&&!E&&P<=0;if(de(i.SpecialZoomLevel.ActualSize),P>0&&!E){var n=P-1,r=ae[n],a=h[r],s=v[n];re(n),console.log(s,"cordinateTargetHighlight"),A&&s.pageIndex>0&&ce(s.pageIndex),a>0&&(setTimeout(function(){he(ee),ve(a-1)},1e3),A||ce(a-1))}else if(E&&V&&2===V.length){e.__awaiter(void 0,void 0,void 0,function(){var t,i,o,n,r;return e.__generator(this,function(e){switch(e.label){case 0:t=V[0],i=V[1],o=t,e.label=1;case 1:return o<=i?(ce(n=o-1),[4,new Promise(function(e){return setTimeout(e,1e3)})]):[3,4];case 2:if(e.sent(),he(ee),(r=ve(n))&&r>0)return[3,4];e.label=3;case 3:return o++,[3,1];case 4:return[2]}})})}else if(!A&&h){var l=ae.find(function(e){return h[e]>0});if(void 0!==l){var u=h[l]-1;ce(u),setTimeout(function(){he(ee),ve(u)},1e3)}}requestAnimationFrame(function(){o&&ue(),!A&&P>0&&!E&&function(){if(J.current){var e=P-1,t=ae[e],i=h[t],o=i>0?i-1:0,n={};ae.forEach(function(e,t){var i=h[e];i>0&&(n[i]||(n[i]=[]),n[i].push(t))});var r=(n[i]||[]).indexOf(e),a=0,s=function(){var e,t;if(!(++a>40)){var i=null===(e=J.current)||void 0===e?void 0:e.querySelector(".rpv-core__inner-pages");if(i){var n=null===(t=J.current)||void 0===t?void 0:t.querySelector('[data-testid="core__page-layer-'.concat(o,'"]'));if(n){var l=i.getBoundingClientRect(),u=n.getBoundingClientRect();if(u.top<l.bottom&&u.bottom>l.top){var c=n.querySelectorAll(".rpv-search__highlight")[r];if(c){var d=c.getBoundingClientRect(),g=i.scrollTop+(d.top-l.top)-i.clientHeight/2+d.height/2;i.scrollTo({top:g,behavior:"smooth"})}else setTimeout(s,100)}else setTimeout(s,100)}else setTimeout(s,100)}else setTimeout(s,100)}};setTimeout(s,500)}}()})},onPageChange:function(e){var t=e.currentPage;Q(t),ee.has(t)?(ve(t),he(ee)):he(ee)}})]}))};
|
|
2
2
|
//# sourceMappingURL=PdfViewer.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,n,t=require("tslib"),i=require("react/jsx-runtime"),r=require("react"),o=require("@react-pdf-viewer/core"),a=require("../PdfViewer/PdfViewer.js"),l=require("./BoundaryCard.js"),u=require("./CardWrapper.js"),s=require("./CognitiveIntegrity.js"),d=require("./LabelCheck.js"),g=require("./PageCheck.js"),c=require("./reviewStepAdapters.js"),v=require("lucide-react"),p=require("@mui/material"),m=require("./ReviewedCard.js"),f=require("./ReviewedBoundaryActions.js"),h=require("./RevertCard.js"),_=require("./RevertSuccessCard.js"),w=require("./helper.js"),y=require("./ChartBreakoutCircle.js"),b=260;exports.SegmentPdfSpecialZoomLevel=void 0,(n=exports.SegmentPdfSpecialZoomLevel||(exports.SegmentPdfSpecialZoomLevel={})).ActualSize="ActualSize",n.PageFit="PageFit",n.PageWidth="PageWidth";var x=((e={})[exports.SegmentPdfSpecialZoomLevel.ActualSize]=o.SpecialZoomLevel.ActualSize,e[exports.SegmentPdfSpecialZoomLevel.PageFit]=o.SpecialZoomLevel.PageFit,e[exports.SegmentPdfSpecialZoomLevel.PageWidth]=o.SpecialZoomLevel.PageWidth,e),S=function(e){return{reviewId:e.id,segment:e.segment,pageNumber:e.pageNumber}};exports.default=function(e){var n,R,E,C,k,P,A,M,j,I,B,N,L,F,T,q,W,K,z,G,D,O,V,H,U,Z,X,Y,J,Q,$,ee,ne,te,ie=this,re=e.pdfUrl,oe=e.pdfName,ae=e.segments,le=e.styles,ue=e.pdfViewerProps,se=e.specialZoomLevel,de=e.showBadges,ge=void 0===de||de,ce=e.sortByConfidence,ve=void 0===ce?"low":ce,pe=e.filterByConfidence,me=void 0===pe?"all":pe,fe=e.showBadgeNavigation,he=void 0===fe||fe,_e=e.autoSelectReviewOnPageChange,we=void 0!==_e&&_e,ye=e.autoAdvanceAfterConfirm,be=void 0===ye||ye,xe=e.badgePreloadPages,Se=void 0===xe?8:xe,Re=e.badgeOffsetTop,Ee=void 0===Re?20:Re,Ce=e.badgeOffsetRight,ke=void 0===Ce?68:Ce,Pe=e.badgeOffsetLeft,Ae=void 0===Pe?0:Pe,Me=e.initialReviewId,je=e.manualPrompt,Ie=e.heightBuffer,Be=e.onBoundaryAction,Ne=e.onLabelAction,Le=e.onPageAction,Fe=e.onPageTypeRevert,Te=e.onRevert,qe=e.onActiveReviewChange,We=e.onCurrentPageChange,Ke=e.onActionError,ze=e.disableAllActions,Ge=void 0!==ze&&ze,De=e.disablePdfAnnotations,Oe=void 0!==De&&De,Ve=e.disablePdfTextLayer,He=void 0===Ve||Ve,Ue=e.disableTitleCheckUntilBoundaryCheckCompleted,Ze=void 0!==Ue&&Ue,Xe=e.onAdjustManually,Ye=e.onCognitiveClick,Je=e.className,Qe=e.style,$e=e.viewerStyle,en=e.railStyle,nn=e.redirectionData,tn=r.useMemo(function(){return c.extractSegmentReviewData(ae)},[ae]),rn=tn.boundaryReviews,on=tn.labelReviews,an=tn.pageReviews,ln=r.useState(function(){return new Map}),un=ln[0],sn=ln[1],dn=r.useMemo(function(){var e=new Map,n=1;return ae.forEach(function(t,i){var r=c.getSegmentReviewKey(t,i);e.has(r)||(e.set(r,n),n+=1)}),e},[ae]),gn=r.useMemo(function(){return new Set(on.map(function(e){return c.getSegmentReviewKey(e.segment)}))},[on]),cn=r.useMemo(function(){return w.getPendingMergeImpactedSegmentKeys(ae)},[ae]);r.useEffect(function(){sn(function(e){var n=!1,t=new Map(e);return e.forEach(function(e,i){var r=ae.find(function(e){return c.getSegmentReviewKey(e)===i});r&&!w.hasPolledStructuralAction(r,e)||(t.delete(i),n=!0)}),n?t:e})},[ae]);var vn=r.useMemo(function(){return w.getOptimisticMergeImpactedSegmentKeys(ae,un)},[un,ae]),pn=r.useRef(null),mn=r.useMemo(function(){return t.__spreadArray(t.__spreadArray(t.__spreadArray([],rn.filter(function(e){return!cn.has(c.getSegmentReviewKey(e.segment))&&!vn.has(c.getSegmentReviewKey(e.segment))&&!w.shouldHideStructuralBoundaryReview(e.review_step,e.segment,gn.has(c.getSegmentReviewKey(e.segment)),un.get(c.getSegmentReviewKey(e.segment)))}).map(function(e){var n;return t.__assign(t.__assign({},e),{kind:"boundary",pageNumber:null!==(n=e.metadata.focus_page)&&void 0!==n?n:e.segment.start_page})}),!0),on.filter(function(e){return!cn.has(c.getSegmentReviewKey(e.segment))&&!vn.has(c.getSegmentReviewKey(e.segment))}).map(function(e){return t.__assign(t.__assign({},e),{kind:"label",pageNumber:e.segment.start_page})}),!0),an.filter(function(e){return!cn.has(c.getSegmentReviewKey(e.segment))&&!vn.has(c.getSegmentReviewKey(e.segment))}).map(function(e){var n;return t.__assign(t.__assign({},e),{kind:"page",pageNumber:null!==(n=e.metadata.page_num)&&void 0!==n?n:e.segment.start_page})}),!0).sort(function(e,n){var t,i,r=null!==(t=dn.get(c.getSegmentReviewKey(e.segment)))&&void 0!==t?t:Number.MAX_SAFE_INTEGER,o=null!==(i=dn.get(c.getSegmentReviewKey(n.segment)))&&void 0!==i?i:Number.MAX_SAFE_INTEGER;return e.pageNumber-n.pageNumber||r-o||e.reviewStepIndex-n.reviewStepIndex||e.id.localeCompare(n.id)})},[rn,on,an,vn,un,cn,dn,gn]),fn=r.useMemo(function(){return ae.map(function(e){var n,i;return t.__assign(t.__assign({},e),{title:(null===(n=e.label)||void 0===n?void 0:n.trim())||e.title,page_count:null!==(i=e.page_count)&&void 0!==i?i:e.end_page-e.start_page+1})})},[ae]),hn=r.useState(1),_n=hn[0],wn=hn[1],yn=r.useState(null!=Me?Me:null),bn=yn[0],xn=yn[1],Sn=r.useState(null!=Me?Me:null),Rn=Sn[0],En=Sn[1],Cn=r.useState(!1),kn=Cn[0],Pn=Cn[1],An=r.useState(null),Mn=An[0],jn=An[1],In=r.useState(null),Bn=In[0],Nn=In[1],Ln=r.useState(function(){return new Set}),Fn=Ln[0],Tn=Ln[1],qn=r.useState(null),Wn=qn[0],Kn=qn[1],zn=r.useState(null),Gn=zn[0],Dn=zn[1],On=r.useState(8),Vn=On[0],Hn=On[1],Un=r.useState(null),Zn=Un[0],Xn=Un[1],Yn=r.useState(!1),Jn=Yn[0],Qn=Yn[1],$n=r.useRef(0),et=r.useRef(null),nt=r.useRef(null),tt=r.useRef(new Map),it=r.useRef(null),rt=r.useRef(null),ot=r.useState(b),at=ot[0],lt=ot[1],ut=null!==(R=null===(n=null==le?void 0:le.aside)||void 0===n?void 0:n.width)&&void 0!==R?R:"40%",st="min(".concat("number"==typeof ut?"".concat(ut,"px"):ut,", ").concat(b,"px, 100%)");r.useEffect(function(){Tn(function(e){if(0===e.size)return e;var n=new Set(e),t=!1;return mn.forEach(function(e){var i;null!=(null===(i=e.review_step.review)||void 0===i?void 0:i.action)&&n.has(e.id)&&(n.delete(e.id),t=!0)}),t?n:e})},[mn]),r.useEffect(function(){var e=pn.current;if(e&&ge){var n=function(){var n=e.getBoundingClientRect().width;n>0&<(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()}}},[ge]);var dt=r.useMemo(function(){var e=new Set;return mn.forEach(function(n){var t;null!=(null===(t=n.review_step.review)||void 0===t?void 0:t.action)&&e.add(n.id)}),e},[mn]),gt=r.useMemo(function(){var e;return null!==(e=mn.find(function(e){return e.id===bn}))&&void 0!==e?e:null},[bn,mn]),ct=r.useMemo(function(){return!(!Ze||"label"!==(null==gt?void 0:gt.kind))&&rn.some(function(e){if(c.getSegmentReviewKey(e.segment)!==c.getSegmentReviewKey(gt.segment)||dt.has(e.id))return!1;var n=w.getResolvedScore(e.review_step.score,e.review_step.confidence);return null==n||n<85})},[gt,rn,Ze,dt]),vt=null==gt?-1:ae.findIndex(function(e){return c.getSegmentReviewKey(e)===c.getSegmentReviewKey(gt.segment)}),pt=vt>0?ae[vt-1]:void 0,mt=vt>=0?ae[vt+1]:void 0,ft=(null===(E=null==pt?void 0:pt.label)||void 0===E?void 0:E.trim())||(null==pt?void 0:pt.title),ht=(null===(C=null==mt?void 0:mt.label)||void 0===C?void 0:C.trim())||(null==mt?void 0:mt.title),_t=w.getConfidenceColors(null==gt?void 0:gt.review_step.score,null==gt?void 0:gt.review_step.confidence,null===(k=null==gt?void 0:gt.segment.confidence)||void 0===k?void 0:k.awaiting_llm),wt=(null===(P=null==gt?void 0:gt.review_step.reasons)||void 0===P?void 0:P.length)?gt.review_step.reasons:null!==(M=null===(A=null==gt?void 0:gt.segment.confidence)||void 0===A?void 0:A.reasons)&&void 0!==M?M:[],yt=Boolean(wt.some(function(e){return e.text.trim()&&["evidence","gap"].includes(e.type.trim().toLowerCase())})||(null===(j=null==gt?void 0:gt.review_step.reason)||void 0===j?void 0:j.trim())||(null===(I=null==gt?void 0:gt.review_step.gap)||void 0===I?void 0:I.trim())),bt=null==gt?null:"boundary"===gt.kind?w.getBoundaryReviewActionBadgeLabel(gt.review_step,gt.segment,un.get(null!==(B=gt.segment.stable_key)&&void 0!==B?B:"")):w.getTitleReviewActionBadgeLabel(gt.review_step,gt.segment,un.get(null!==(N=gt.segment.stable_key)&&void 0!==N?N:"")),xt="label"===(null==gt?void 0:gt.kind)?[bt,gt.review_step.human_action_enum,null===(L=gt.review_step.review)||void 0===L?void 0:L.action,null===(F=gt.review_step.human_resolution)||void 0===F?void 0:F.action]:[],St="label"===(null==gt?void 0:gt.kind)&&xt.some(function(e){var n,t=null!==(n=null==e?void 0:e.trim().toUpperCase())&&void 0!==n?n:"";return t.includes("MERGE")||t.includes("SPLIT")}),Rt=null!=gt&&mn.some(function(e){return"boundary"===e.kind&&c.getSegmentReviewKey(e.segment)===c.getSegmentReviewKey(gt.segment)}),Et=St&&!Rt,Ct=("boundary"===(null==gt?void 0:gt.kind)||Et)&&null!=gt?function(){var e,n,i,r,o,a;if("boundary"===gt.kind)return gt;var l=rn.find(function(e){return c.getSegmentReviewKey(e.segment)===c.getSegmentReviewKey(gt.segment)});return l?t.__assign(t.__assign({},l),{kind:"boundary",pageNumber:null!==(e=l.metadata.focus_page)&&void 0!==e?e:l.segment.start_page}):t.__assign(t.__assign({},gt),{kind:"boundary",pageNumber:null!==(i=null===(n=gt.segment.review_action)||void 0===n?void 0:n.focus_page)&&void 0!==i?i:gt.segment.start_page,metadata:{focus_page:null!==(o=null===(r=gt.segment.review_action)||void 0===r?void 0:r.focus_page)&&void 0!==o?o:null,boundary_margin:null!==(a=gt.segment.boundary_margin)&&void 0!==a?a:null,user_actions:[]}})}():void 0,kt=null==gt?"":(null===(T=gt.segment.label)||void 0===T?void 0:T.trim())||gt.segment.title,Pt=null==gt?void 0:gt.review_step.revert,At=null==gt?void 0:gt.segment.revert,Mt=function(e){return null==e?void 0:e.trim().toLowerCase()},jt=null==gt||null===(W=t.__spreadArray([],null!==(q=gt.segment.review_steps)&&void 0!==q?q:[],!0).reverse().find(function(e){var n,t,i=null===(n=e.type)||void 0===n?void 0:n.trim().toLowerCase();return("page_boundary"===i||"page boundary review"===i)&&"boundary"===Mt(null===(t=e.revert)||void 0===t?void 0:t.type)}))||void 0===W?void 0:W.revert,It=null!==(K=null!=Pt?Pt:null==gt?void 0:gt.segment.revert)&&void 0!==K?K:jt,Bt=null==It?void 0:It.decision.trim().toUpperCase(),Nt=null!=bt?bt:(null==Bt?void 0:Bt.includes("SPLIT"))?"Split":(null==Bt?void 0:Bt.includes("MERGE"))?"Merged":null,Lt="label"===(null==gt?void 0:gt.kind)&&"SET_RANGE"===(null===(z=null==jt?void 0:jt.decision)||void 0===z?void 0:z.trim().toUpperCase())&&jt.current_segment_ids.length!==jt.previous_state.length,Ft="Merged"===bt||"Split"===bt||Lt,Tt=null==gt?void 0:Ft?"boundary"===Mt(null==jt?void 0:jt.type)?jt:"boundary"===Mt(null==At?void 0:At.type)?At:"boundary"===Mt(null==Pt?void 0:Pt.type)?Pt:void 0:"label"===gt.kind?"label"===Mt(null==Pt?void 0:Pt.type)?Pt:void 0:"boundary"===gt.kind?"boundary"===Mt(null==Pt?void 0:Pt.type)?Pt:"boundary"===Mt(null==jt?void 0:jt.type)?jt:"boundary"===Mt(null==At?void 0:At.type)?At:void 0:void 0,qt=Ft&&(null==Tt?void 0:Tt.operation_id)?ae.flatMap(function(e){var n;return null!==(n=e.review_steps)&&void 0!==n?n:[]}).find(function(e){var n,t,i,r,o,a,l,u=null===(n=e.type)||void 0===n?void 0:n.trim().toLowerCase();return("page_boundary"===u||"page boundary review"===u)&&((null!==(o=null!==(i=null===(t=e.human_resolution)||void 0===t?void 0:t.operation_id)&&void 0!==i?i:null===(r=e.revert)||void 0===r?void 0:r.operation_id)&&void 0!==o?o:e.operation_id)===Tt.operation_id&&Boolean(null===(l=null===(a=e.human_resolution)||void 0===a?void 0:a.change_summary)||void 0===l?void 0:l.trim()))}):void 0,Wt=(null===(G=null==Tt?void 0:Tt.summary)||void 0===G?void 0:G.trim())||null,Kt=Ft?(null===(O=null===(D=null==qt?void 0:qt.human_resolution)||void 0===D?void 0:D.change_summary)||void 0===O?void 0:O.trim())||(null===(V=null==Tt?void 0:Tt.summary)||void 0===V?void 0:V.trim())||"":(null===(Z=null===(U=null===(H=null==gt?void 0:gt.review_step)||void 0===H?void 0:H.human_resolution)||void 0===U?void 0:U.change_summary)||void 0===Z?void 0:Z.trim())||(null===(Y=null===(X=null==gt?void 0:gt.review_step)||void 0===X?void 0:X.summary)||void 0===Y?void 0:Y.trim())||"",zt=null==gt?null:Tt?{currentSegment:{title:kt,startPage:gt.segment.start_page,endPage:gt.segment.end_page},previousSegments:Tt.previous_state.map(function(e){var n,t;return{title:(null===(n=e.label)||void 0===n?void 0:n.trim())||(null===(t=e.title)||void 0===t?void 0:t.trim())||"Untitled document",startPage:e.start_page,endPage:e.end_page}})}:"Split"===Nt?{currentSegment:{title:kt,startPage:gt.segment.start_page,endPage:gt.segment.end_page},previousSegments:[{title:"Advice of Award",startPage:1,endPage:25},{title:kt,startPage:gt.segment.start_page,endPage:gt.segment.end_page}]}:"Merged"===Nt?{currentSegment:{title:kt,startPage:gt.segment.start_page,endPage:gt.segment.end_page},previousSegments:[{title:"Advice of Award",startPage:1,endPage:25},{title:"Request for proposal (RFP)",startPage:26,endPage:76}]}:{currentSegment:{title:kt,startPage:gt.segment.start_page,endPage:gt.segment.end_page},previousSegments:[]},Gt="page"===(null==gt?void 0:gt.kind)&&null!==(J=gt.metadata.classification_id)&&void 0!==J?J:null,Dt="page"===(null==gt?void 0:gt.kind)?Boolean(Fe&&Gt):Boolean((null==Tt?void 0:Tt.operation_id)&&(null==Tt?void 0:Tt.type)&&!1!==(null==Tt?void 0:Tt.revertable));Boolean(zt&&Dt&&("page"!==(null==gt?void 0:gt.kind)||Gt));var Ot=r.useCallback(function(e,n){$n.current+=1,et.current={requestId:$n.current,pageNumber:e,reviewId:n},Nn({pageNumber:e,requestId:$n.current})},[]),Vt=r.useCallback(function(e){var n;!0!==(null===(n=e.segment.confidence)||void 0===n?void 0:n.awaiting_llm)&&(Dn(null),Xn(null),xn(e.id),En(e.id),Pn(!1),jn(null),Ot(e.pageNumber,e.id),null==qe||qe(e.id,e.segment))},[qe,Ot]);r.useEffect(function(){if(Zn){var e=requestAnimationFrame(function(){return Qn(!0)}),n=window.setTimeout(function(){Qn(!1)},3500),t=window.setTimeout(function(){Xn(null)},4e3);return function(){cancelAnimationFrame(e),window.clearTimeout(n),window.clearTimeout(t)}}},[Zn]),r.useEffect(function(){var e,n,t,i;if(nn){if("pageGroup"===nn.type){var r=null!==(e=nn.pages)&&void 0!==e?e:[],o=null!==(n=nn.pageIndex)&&void 0!==n?n:0,a=r[o];if(null==a)return;return Ht(),Dn({pages:r,index:o,label:null!==(t=nn.groupLabel)&&void 0!==t?t:""}),$n.current+=1,void Nn({pageNumber:a,requestId:$n.current})}if(Dn(null),nn.reviewId){var l=mn.find(function(e){return e.id===nn.reviewId&&(!nn.type||e.kind===nn.type)});if(l)return void Vt(l)}if(nn.classificationId){var u=mn.find(function(e){return!("page"!==e.kind||e.metadata.classification_id!==nn.classificationId||nn.segmentId&&e.segment.segment_id!==nn.segmentId||nn.type&&e.kind!==nn.type)});if(u)return void Vt(u)}if(nn.pageNumber&&nn.type){var s=Number(nn.pageNumber);if(Number.isInteger(s)&&!(s<1)){var d=null===(i=nn.pageType)||void 0===i?void 0:i.trim().toLowerCase(),g=mn.find(function(e){var n="page"===e.kind?e.pageNumber:e.segment.start_page,t="page"!==e.kind||!d||e.metadata.page_type===d;return(!nn.segmentId||e.segment.segment_id===nn.segmentId)&&n===s&&e.kind===nn.type&&t});g?Vt(g):"page"===nn.type&&(Ht(),$n.current+=1,Nn({pageNumber:s,requestId:$n.current}))}}}},[nn,Vt,mn]);var Ht=r.useCallback(function(){et.current=null,Pn(!1),xn(null),jn(null),null==qe||qe(null,null)},[qe]),Ut=r.useCallback(function(e){var n;Qn(!1),Xn(null);var t=null!==(n=mn.find(function(n){return!dt.has(n.id)&&"boundary"===n.kind&&n.segment.start_page===e.startPage&&n.segment.end_page===e.endPage}))&&void 0!==n?n:mn.find(function(n){return!dt.has(n.id)&&n.segment.start_page<=e.startPage&&n.segment.end_page>=e.startPage});t?Vt(t):(Ht(),$n.current+=1,Nn({pageNumber:e.startPage,requestId:$n.current}))},[Ht,dt,mn,Vt]),Zt=r.useCallback(function(e){var n;if(be){var t=mn.findIndex(function(n){return n.id===e}),i=new Set(mn.map(function(e){return e.id})),r=null!==(n=mn.find(function(n,r){return r>t&&n.id!==e&&i.has(n.id)}))&&void 0!==n?n:mn.find(function(n){return n.id!==e});r?requestAnimationFrame(function(){return Vt(r)}):Ht()}else Ht()},[be,Ht,mn,Vt,mn]),Xt=r.useCallback(function(e,n,i){return t.__awaiter(ie,void 0,void 0,function(){var r,o,a,u,s,d,g,v,p;return t.__generator(this,function(t){switch(t.label){case 0:if(Ge)return[2];if("boundary"===e.kind&&!Be)return[2];if("label"===e.kind&&!Ne)return[2];if("page"===e.kind&&!Le)return[2];r=S(e),a=i,u=(o=n)===l.BoundaryReviewActionEnum.SET_RANGE?function(){var n=a.startPage,t=a.endPage;if(null==n||null==t)return null;var i=n<e.segment.start_page||t>e.segment.end_page,r=n>e.segment.start_page||t<e.segment.end_page;return i&&!r?n<e.segment.start_page?l.BoundaryReviewActionEnum.MERGE_PREV:l.BoundaryReviewActionEnum.MERGE_NEXT:r?l.BoundaryReviewActionEnum.SPLIT_HERE:null}():o,s="boundary"===e.kind&&null!=Be&&be&&(u===l.BoundaryReviewActionEnum.SPLIT_HERE||u===l.BoundaryReviewActionEnum.MERGE_NEXT||u===l.BoundaryReviewActionEnum.MERGE_PREV||u===l.BoundaryReviewActionEnum.MERGE_PREVIOUS),d=s?ae.findIndex(function(n){return c.getSegmentReviewKey(n)===c.getSegmentReviewKey(e.segment)}):-1,s&&d>=0&&u&&(nt.current={action:u,originalSegmentIndex:d,segmentSignature:JSON.stringify(ae.map(function(e,n){var t;return{key:c.getSegmentReviewKey(e,n),startPage:e.start_page,endPage:e.end_page,version:null!==(t=e.version)&&void 0!==t?t:null}})),ready:!1}),Kn(e.id),t.label=1;case 1:return t.trys.push([1,8,9,10]),"boundary"!==e.kind?[3,3]:[4,null==Be?void 0:Be(n,i,r)];case 2:return t.sent(),[3,7];case 3:return"label"!==e.kind?[3,5]:[4,null==Ne?void 0:Ne(n,i,r)];case 4:return t.sent(),[3,7];case 5:return"page"!==e.kind?[3,7]:[4,null==Le?void 0:Le(n,i,r)];case 6:t.sent(),t.label=7;case 7:return Tn(function(n){var t=new Set(n);return t.add(e.id),t}),g="boundary"===e.kind&&(u===l.BoundaryReviewActionEnum.MERGE_NEXT||u===l.BoundaryReviewActionEnum.MERGE_PREV||u===l.BoundaryReviewActionEnum.MERGE_PREVIOUS),("boundary"===e.kind&&u===l.BoundaryReviewActionEnum.SPLIT_HERE||g)&&u&&sn(function(n){var t=new Map(n);return t.set(c.getSegmentReviewKey(e.segment),u),t}),nt.current?(nt.current.ready=!0,g&&(v=mn.find(function(n){return"label"===n.kind&&c.getSegmentReviewKey(n.segment)===c.getSegmentReviewKey(e.segment)}))&&requestAnimationFrame(function(){return Vt(v)})):Zt(e.id),[3,10];case 8:return p=t.sent(),s&&(nt.current=null),null==Ke||Ke(p,r),[3,10];case 9:return Kn(null),[7];case 10:return[2]}})})},[be,Ge,Ke,Be,Ne,Le,Fe,mn,ae,Vt,Zt]);r.useEffect(function(){var e=nt.current;if(null==e?void 0:e.ready){var n=JSON.stringify(ae.map(function(e,n){var t;return{key:c.getSegmentReviewKey(e,n),startPage:e.start_page,endPage:e.end_page,version:null!==(t=e.version)&&void 0!==t?t:null}}));if(n!==e.segmentSignature){var t=e.action===l.BoundaryReviewActionEnum.SPLIT_HERE?e.originalSegmentIndex+1:e.action===l.BoundaryReviewActionEnum.MERGE_PREV||e.action===l.BoundaryReviewActionEnum.MERGE_PREVIOUS?Math.max(0,e.originalSegmentIndex-1):e.originalSegmentIndex,i=new Map(ae.map(function(e,n){return[c.getSegmentReviewKey(e,n),n]})),r=mn.find(function(e){var n,r=i.get(c.getSegmentReviewKey(e.segment));return null!=r&&r>=t&&!w.isReviewStepResolved(e.review_step,e.segment)&&(!Fn.has(e.id)||!w.isReviewStepResolutionCurrent(e.review_step,e.segment))&&!0!==(null===(n=e.segment.confidence)||void 0===n?void 0:n.awaiting_llm)});if(!r)return nt.current=null,void Ht();requestAnimationFrame(function(){nt.current=null,Vt(r)})}}},[Ht,Fn,mn,ae,Vt]),r.useEffect(function(){nt.current||bn&&!mn.some(function(e){return e.id===bn})&&Ht()},[bn,Ht,mn]),r.useEffect(function(){if(we&&!nt.current){var e=mn.find(function(e){return e.pageNumber===_n});e&&e.id!==bn&&Vt(e)}},[bn,we,_n,Vt,mn]),r.useEffect(function(){nt.current||bn&&!mn.some(function(e){var n;return e.id===bn&&!0!==(null===(n=e.segment.confidence)||void 0===n?void 0:n.awaiting_llm)})&&Ht()},[bn,Ht,mn]);var Yt=r.useMemo(function(){var e=mn.filter(function(e){var n;return!0!==(null===(n=e.segment.confidence)||void 0===n?void 0:n.awaiting_llm)});if("all"===me)return e;var n=["low","medium","high"].filter(function(e){return e!==ve}),i=t.__spreadArray([ve],n,!0),r=new Map(i.map(function(e,n){return[e,n]}));return e.map(function(e,n){return{item:e,index:n}}).sort(function(e,n){var t,o,a,l,u=null===(t=e.item.review_step.confidence)||void 0===t?void 0:t.trim().toLowerCase(),s=null===(o=n.item.review_step.confidence)||void 0===o?void 0:o.trim().toLowerCase();return(null==u?i.length:null!==(a=r.get(u))&&void 0!==a?a:i.length)-(null==s?i.length:null!==(l=r.get(s))&&void 0!==l?l:i.length)||e.index-n.index}).map(function(e){return e.item})},[me,ve,mn]),Jt=Yt.findIndex(function(e){return e.id===Rn}),Qt=r.useState(null),$t=Qt[0],ei=Qt[1],ni=r.useRef(!1),ti=r.useCallback(function(e){var n=Yt[e];n&&Vt(n)},[Yt,Vt]),ii=r.useCallback(function(e){if(!(!Gn||e<0||e>=Gn.pages.length)){var n=Gn.pages[e];null!=n&&(Ht(),Dn(function(n){return null==n?n:t.__assign(t.__assign({},n),{index:e})}),$n.current+=1,Nn({pageNumber:n,requestId:$n.current}))}},[Gn,Ht]);r.useEffect(function(){Rn&&!Yt.some(function(e){return e.id===Rn})&&En(null)},[Yt,Rn]),r.useEffect(function(){ni.current=!1,ei(Jt>=0?String(Jt+1):null)},[Jt,Yt.length]),r.useEffect(function(){if(ni.current&&null!=$t){var e=window.setTimeout(function(){var e=Number($t.trim()),n=e-1;Number.isInteger(e)&&n>=0&&n<Yt.length&&(ni.current=!1,ti(n))},300);return function(){return window.clearTimeout(e)}}},[ti,$t,Yt.length]);var ri=r.useMemo(function(){var e=new Map;mn.forEach(function(n){var t,i=null!==(t=e.get(c.getSegmentReviewKey(n.segment)))&&void 0!==t?t:[];i.push(n),e.set(c.getSegmentReviewKey(n.segment),i)});var n=new Map;return e.forEach(function(e,t){var i,r=null!==(i=dn.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},[mn,dn]),oi=r.useMemo(function(){var e=new Map;mn.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},[mn]),ai=r.useCallback(function(e){return{startPage:Math.max(0,e.startPage-Se),endPage:Math.min(e.numPages-1,e.endPage+Se)}},[Se]),li=r.useCallback(function(){var e,n=it.current,t=rt.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();if(mn.forEach(function(e){var n,r=tt.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(),u=null!==(n=oi.get(e.id))&&void 0!==n?n:0,s=l.top+Ee+40*u,d=s+(r.offsetHeight||32),g=s>=o.top&&d<=o.bottom;r.style.top="".concat(s-i.top,"px"),r.style.visibility=g?"visible":"hidden"}else r.style.visibility="hidden"}}),Gn){var a=Gn.pages[Gn.index],l=null==a?null:t.querySelector('[data-testid="core__page-layer-'.concat(a-1,'"]'));if(l){var u=l.getBoundingClientRect().top+Ee-i.top;Hn(function(e){return Math.abs(e-u)<1?e:u})}}if(bn&&null==et.current){var s=tt.current.get(bn);s&&"hidden"!==s.style.visibility&&jn(function(e){return e===s?e:s})}}},[Gn,bn,Ee,oi,mn]),ui=r.useCallback(function(e){var n=et.current;n&&n.requestId===e.requestId&&n.pageNumber===e.pageNumber&&(et.current=null,li(),requestAnimationFrame(function(){if(null==et.current){var e=tt.current.get(n.reviewId);e&&"hidden"!==e.style.visibility&&jn(e)}}))},[li]);return r.useEffect(function(){var e=rt.current;if(e&&ge){var n=null,t=function(){null==n&&(n=requestAnimationFrame(function(){n=null,li()}))};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()}}},[ge,li]),i.jsxs("div",t.__assign({ref:it,className:Je,style:t.__assign(t.__assign({},Qe),{display:"block",position:"relative",width:"100%",height:"100%",minWidth:0,overflowX:"auto",overflowY:"hidden"})},{children:[i.jsxs("div",t.__assign({className:"segment-review-wrapper__container",style:{display:"flex",alignItems:"stretch",gap:0,width:"100%",minWidth:700,height:"100%"}},{children:[i.jsx("div",t.__assign({ref:rt,style:t.__assign(t.__assign({},$e),{flex:"1 1 auto",width:ge?"auto":"100%",minWidth:0,height:"100%",boxSizing:"border-box"})},{children:i.jsx(a.default,t.__assign({highlightText:[],highlightPages:{},highlightCordinatePages:[],useCoordinates:!1},ue,{defaultScale:void 0===se?null!==(Q=null==ue?void 0:ue.defaultScale)&&void 0!==Q?Q:o.SpecialZoomLevel.PageFit:x[se],disablePdfAnnotations:Oe,disablePdfTextLayer:He,pdfUrl:re,pdfName:oe,segments:fn,navigationRequest:Bn,onNavigationSettled:ui,setRenderRange:ai,onCurrentPageChange:function(e){wn(e),null==et.current&>&>.pageNumber!==e&&Ht(),null==We||We(e)}}))})),ge&&i.jsxs("aside",t.__assign({"aria-label":"Page review badges",ref:pn,style:t.__assign(t.__assign({},en),{position:"relative",width:st,maxWidth:b,flex:"0 1 ".concat(st),minHeight:0,overflow:"hidden",boxSizing:"border-box"})},{children:[Gn&&i.jsxs("span",t.__assign({style:{position:"absolute",top:Vn,right:ke||"auto",left:Ae||"auto",zIndex:2,display:"inline-flex",alignItems:"center",justifyContent:"center",gap:4,minHeight:25,padding:"2px 8px",border:"1px solid #E2E8F0",borderRadius:16,backgroundColor:"#F8FAFC",boxSizing:"border-box",boxShadow:"0 1px 2px rgba(16, 24, 40, 0.08)",font:"inherit"}},{children:[i.jsxs(p.Typography,t.__assign({fontFamily:"Inter",sx:{fontSize:11,fontWeight:500,color:"#475569",whiteSpace:"nowrap"}},{children:[Gn.label||"Pages"," Pg: ",Gn.index+1,Gn.pages.length>1?" / ".concat(Gn.pages.length):""]})),Gn.pages.length>1&&["previous","next"].map(function(e){var n="previous"===e,r=Gn.index+(n?-1:1),o=r<0||r>=Gn.pages.length;return i.jsx("button",t.__assign({type:"button","aria-label":"".concat(n?"Previous":"Next"," page in ").concat(Gn.label||"page group"),disabled:o,onClick:function(){return ii(r)},style:{display:"grid",placeItems:"center",width:14,height:20,padding:0,border:0,background:"transparent",color:o?"#CBD5E1":"#475569",cursor:o?"default":"pointer"}},{children:i.jsx("svg",t.__assign({width:"10",height:"7",viewBox:"0 0 10 7",fill:"none","aria-hidden":"true"},{children:i.jsx("path",{d:n?"M1 6L5 2L9 6":"M1 1L5 5L9 1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}))}),e)})]})),he&&Yt.length>0&&!Gn&&i.jsxs("nav",t.__assign({"aria-label":"Review badge navigation",style:{position:"absolute",top:8,right:ke||"auto",left:Ae||"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:[i.jsx("input",{type:"text",inputMode:"numeric",pattern:"[0-9]*",value:null!=$t?$t:"-","aria-label":"Review badge number",onChange:function(e){ni.current=!0,ei(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"}}),i.jsxs("span",t.__assign({"aria-label":"".concat(Yt.length," reviews"),style:{flex:1,color:"#4F46E5",fontSize:14,whiteSpace:"nowrap",textAlign:"center"}},{children:["of ",Yt.length]})),["previous","next"].map(function(e){var n="previous"===e,r=Jt+(n?-1:1),o=r<0||r>=Yt.length;return i.jsx("button",t.__assign({type:"button","aria-label":"".concat(n?"Previous":"Next"," review badge"),disabled:o,onClick:function(){return ti(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:i.jsx("svg",t.__assign({width:"12",height:"8",viewBox:"0 0 12 8",fill:"none"},{children:i.jsx("path",{d:n?"M1 7L6 2L11 7":"M1 1L6 6L11 1",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})}))}),e)})]})),!Gn&&mn.map(function(e){var n,r,o=bn===e.id,a=null!==(n=ri.get(e.id))&&void 0!==n?n:"1A",l=e.review_step.score,u=e.review_step.confidence,s=w.formatScore(l,u),d="boundary"===e.kind?w.getBoundaryReviewActionBadgeLabel(e.review_step,e.segment,un.get(c.getSegmentReviewKey(e.segment))):"label"===e.kind?w.getTitleReviewActionBadgeLabel(e.review_step,e.segment,un.get(c.getSegmentReviewKey(e.segment))):null,g=null!=d?d:"N/A"===s?s:"".concat(s,"%"),m=!0===(null===(r=e.segment.confidence)||void 0===r?void 0:r.awaiting_llm),f=w.getConfidenceColors(l,u,m),h=dt.has(e.id),_=m;return i.jsx(p.Tooltip,t.__assign({title:m?"data is being processed":"",arrow:!0},{children:i.jsx("span",t.__assign({ref:function(n){n?tt.current.set(e.id,n):tt.current.delete(e.id)},style:{position:"absolute",top:0,left:10,visibility:"hidden",display:"inline-flex",cursor:_?"not-allowed":"pointer"}},{children:i.jsx("button",t.__assign({disabled:_,type:"button","aria-pressed":o,"aria-label":m?"".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 Vt(e)},style:{cursor:"inherit",display:"flex",alignItems:"center",justifyContent:"space-around",gap:4,width:d?h&&!m?115:90:h&&!m?105:80,minHeight:25,padding:"2px 5px",border:"1px solid ".concat(h&&!m?"#E2E8F0":f.border),borderRadius:16,backgroundColor:h&&!m?"#F8FAFC":f.background,color:h&&!m?"#475569":f.text,font:"inherit",alignContent:"center",boxShadow:"0 1px 2px rgba(16, 24, 40, 0.08)"}},{children:h&&!m?i.jsxs(p.Typography,t.__assign({fontFamily:"Inter",sx:{display:"flex",gap:1,alignItems:"center",flexDirection:"row"}},{children:[i.jsx("span",t.__assign({style:{fontSize:11,fontWeight:500}},{children:a})),i.jsxs("span",t.__assign({style:{display:"flex",alignItems:"center"}},{children:[i.jsx("svg",t.__assign({width:"2",height:"14",viewBox:"0 0 1 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:i.jsx("path",{d:"M0.399902 0V14",stroke:"#CBD5E1",strokeWidth:"0.8"})})),i.jsx("span",t.__assign({style:{fontSize:11,fontWeight:500,marginLeft:"7px",display:"flex",alignItems:"center"}},{children:g}))]})),i.jsxs("span",t.__assign({style:{fontSize:11,fontWeight:500,display:"flex",alignItems:"center"}},{children:[i.jsx("svg",t.__assign({width:"2",height:"14",viewBox:"0 0 1 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:i.jsx("path",{d:"M0.399902 0V14",stroke:"#CBD5E1",strokeWidth:"0.8"})})),i.jsx("span",t.__assign({style:{display:"flex",marginLeft:"7px",alignItems:"center"}},{children:i.jsx(v.CircleCheck,{height:14,width:14,strokeWidth:2,color:"#16A34A"})}))]}))]})):i.jsxs(p.Typography,t.__assign({fontFamily:"Inter",sx:{display:"flex",gap:1,alignItems:"center",flexDirection:"row"}},{children:[i.jsx("span",t.__assign({style:{fontSize:11,fontWeight:500}},{children:a})),i.jsxs("span",t.__assign({style:{display:"flex",alignItems:"center"}},{children:[i.jsx("svg",t.__assign({width:"2",height:"14",viewBox:"0 0 1 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:i.jsx("path",{d:"M0.399902 0V14",stroke:f.divider,strokeWidth:"0.8"})})),i.jsx("span",t.__assign({style:{fontSize:11,fontWeight:500,marginLeft:"7px",display:"flex",alignItems:"center"}},{children:g}))]}))]}))}))}))}),e.id)})]}))]})),gt&&Mn&&i.jsxs(u.default,t.__assign({anchorElement:Mn,placement:"bottom-start",offset:{top:8},width:Math.min(at,b),maxWidth:b,heightBuffer:null!=Ie?Ie:25},{children:[kn&&i.jsx(s.default,{width:"100%",maxWidth:"100%",score:gt.review_step.score,reasons:wt,reason:gt.review_step.reason,gap:gt.review_step.gap,onBack:function(){return Pn(!1)},onClose:Ht}),i.jsx("div",t.__assign({style:{display:kn?"none":"block"}},{children:dt.has(gt.id)?i.jsx(m.default,{width:"100%",maxWidth:"100%",headerName:"page"===gt.kind?"Page format approved":"Split"===bt?"Split approved":"Merged"===bt?"Merge approved":"User approved",headerIcon:"page"===gt.kind?i.jsx(v.Check,{size:18,strokeWidth:2}):"Merged"===bt?i.jsx(v.GitMerge,{size:18,strokeWidth:2}):"Split"===bt?i.jsx(y.default,{width:18,height:18}):i.jsx(v.CircleCheck,{size:18,strokeWidth:2}),title:kt,pageNo:"Page ".concat(gt.segment.start_page,"-").concat(gt.segment.end_page),summary:zt?i.jsx(h.default,{icon:i.jsx(v.CircleCheck,{size:14,strokeWidth:2}),title:kt,pageRange:"Page ".concat(gt.segment.start_page,"-").concat(gt.segment.end_page),description:null!=Kt?Kt:null,revertData:zt,confirmDisabled:"page"===gt.kind?!Dt:null==Te||!Dt,showDocumentHeader:!1,onRevert:function(){if("page"===gt.kind){if(!Fe||!Gt){var e=new Error("SegmentReviewPdfWrapper requires onPageTypeRevert and a classification id to revert a page-type decision.");return null==Ke||Ke(e,S(gt)),Promise.reject(e)}return Fe({classification_id:Gt,human_verdict:"No"},S(gt))}if(!Te)throw new Error("SegmentReviewPdfWrapper requires onRevert to handle a revert confirmation.");if(!Tt)throw new Error("There is no valid revert operation for this review.");var n=Ft?"boundary":"label"===gt.kind?"label":"boundary"===gt.kind?"boundary":null,t=Mt(Tt.type);if(n&&t!==n)throw new Error("Cannot use ".concat(null!=t?t:"unknown"," revert metadata for this review. Expected ").concat(n,"."));return Te(Tt,S(gt))},onRevertError:function(e){null==Ke||Ke(e,S(gt))},onRevertComplete:function(e){var n,t,i,r,o,a;Tn(function(){return new Set}),"page"!==gt.kind&&sn(function(){return new Map}),gt.id;var l=null!==(n=zt.previousSegments[0])&&void 0!==n?n:zt.currentSegment,u=null==Mn?void 0:Mn.getBoundingClientRect(),s=null===(t=rt.current)||void 0===t?void 0:t.getBoundingClientRect(),d=Math.min(b,Math.max(220,at)),g=null!==(i=null==u?void 0:u.left)&&void 0!==i?i:(null!==(r=null==s?void 0:s.right)&&void 0!==r?r:window.innerWidth-d-8)+8,c=Math.max(8,Math.min(g,window.innerWidth-d-8)),v=null==(null==u?void 0:u.bottom)?Math.max(8,null!==(o=null==s?void 0:s.top)&&void 0!==o?o:8):u.bottom+8;Tn(function(){return new Set}),"page"!==gt.kind&&(nt.current=null),Qn(!1),Xn({title:"Split"===bt?"Split reverted":"Merged"===bt?"Merge reverted":"Approval reverted",description:(null===(a=null==e?void 0:e.message)||void 0===a?void 0:a.trim())||("Split"===bt?"Pages ".concat(gt.segment.start_page,"-").concat(gt.segment.end_page," are now part of “Advice of Award” again. Review the boundary and title to confirm the document."):"Merged"===bt?"The documents have been separated again. Review their boundaries and titles to confirm them.":"“".concat(kt,"” is pending review again. Review the boundary and title to confirm the document.")),segment:l,position:{top:v,left:c,width:d}}),Ht()}},gt.id):void 0,additionalActions:Ct?i.jsx(f.default,{metadata:Ct.metadata,reviewAction:null!==($=gt.segment.review_action)&&void 0!==$?$:void 0,startPage:gt.segment.start_page,endPage:gt.segment.end_page,title:kt,previousSegmentTitle:ft,nextSegmentTitle:ht,disabled:Ge||!Be||Wn===gt.id,onConfirm:function(e,n){Xt(Ct,e,n)}}):void 0,cognitiveScore:gt.review_step.score,styles:{root:{borderColor:"#16A34A"},header:{"& > .MuiSvgIcon-root, & .MuiTypography-root":{color:"#16A34A"}}},onCognitiveClick:yt?function(){Pn(!0),null==Ye||Ye(S(gt))}:void 0,onClose:Ht}):"boundary"===gt.kind?i.jsx(l.default,{width:"100%",maxWidth:"100%",title:gt.segment.label||gt.segment.title,pageNo:"Page ".concat(gt.pageNumber),content:null!==(ee=gt.review_step.question)&&void 0!==ee?ee:null,revertSummary:Wt,cognitiveScore:gt.review_step.score,metadata:gt.metadata,reviewAction:null!==(ne=gt.segment.review_action)&&void 0!==ne?ne:void 0,previousSegmentTitle:ft,nextSegmentTitle:ht,manualPrompt:null!=je?je:"Set a custom boundary",defaultStartPage:gt.segment.start_page,defaultEndPage:gt.segment.end_page,styles:{root:{borderColor:_t.cardBorder},header:{"& > .MuiSvgIcon-root, & .MuiTypography-root":{color:_t.text}}},confirmDisabled:Ge||!Be||Wn===gt.id,onConfirm:function(e,n,t){t&&l.isBoundaryReviewAction(n.id)&&Xt(gt,n.id,t)},onAdjustManually:function(){return null==Xe?void 0:Xe(S(gt))},onCognitiveClick:yt?function(){Pn(!0),null==Ye||Ye(S(gt))}:void 0,onClose:Ht},gt.id):"label"===gt.kind?i.jsx(d.default,{width:"100%",maxWidth:"100%",title:gt.metadata.current_label||gt.segment.label||gt.segment.title,pageNo:"Pages ".concat(gt.segment.start_page,"-").concat(gt.segment.end_page),content:null!==(te=gt.review_step.question)&&void 0!==te?te:null,revertSummary:Wt,cognitiveScore:gt.review_step.score,metadata:gt.metadata,styles:{root:{borderColor:_t.cardBorder},header:{"& > .MuiSvgIcon-root, & .MuiTypography-root":{color:_t.text}}},confirmDisabled:Ge||!Ne||Wn===gt.id,confirmationBlocked:ct,confirmationWarning:ct?"Please confirm the boundary before confirming the title.":void 0,onActionConfirm:function(e,n){Xt(gt,e,n)},onAdjustManually:function(){return null==Xe?void 0:Xe(S(gt))},onCognitiveClick:yt?function(){Pn(!0),null==Ye||Ye(S(gt))}:void 0,onClose:Ht},gt.id):i.jsx(g.default,{width:"100%",maxWidth:"100%",title:gt.segment.label||gt.segment.title,pageNo:"Page ".concat(gt.pageNumber),content:gt.review_step.reason,cognitiveScore:gt.review_step.score,pageType:gt.metadata.page_type,metadata:gt.metadata,styles:{root:{borderColor:_t.cardBorder},header:{"& > .MuiSvgIcon-root, & .MuiTypography-root":{color:_t.text}}},confirmDisabled:Ge||!Le||Wn===gt.id,onActionConfirm:function(e,n){Xt(gt,e,n)},onCognitiveClick:yt?function(){Pn(!0),null==Ye||Ye(S(gt))}:void 0,onClose:Ht},gt.id)}))]})),Zn&&i.jsx(p.Portal,{children:i.jsx(p.Box,t.__assign({"aria-live":"polite",sx:{position:"fixed",top:Zn.position.top,left:Zn.position.left,zIndex:1600,width:Zn.position.width,maxWidth:"calc(100vw - 16px)",opacity:Jn?1:0,transform:Jn?"translateY(0)":"translateY(-6px)",transition:"opacity 500ms ease, transform 500ms ease",filter:"drop-shadow(0 12px 24px rgba(15, 23, 42, 0.18))",pointerEvents:Jn?"auto":"none"}},{children:i.jsx(_.default,{title:Zn.title,description:Zn.description,onReview:function(){return Ut(Zn.segment)}})}))})]}))};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,n,t=require("tslib"),i=require("react/jsx-runtime"),r=require("react"),o=require("@react-pdf-viewer/core"),a=require("../PdfViewer/PdfViewer.js"),l=require("./BoundaryCard.js"),u=require("./CardWrapper.js"),d=require("./CognitiveIntegrity.js"),s=require("./LabelCheck.js"),g=require("./PageCheck.js"),c=require("./reviewStepAdapters.js"),v=require("lucide-react"),m=require("@mui/material"),p=require("./ReviewedCard.js"),f=require("./ReviewedBoundaryActions.js"),_=require("./RevertCard.js"),w=require("./RevertSuccessCard.js"),h=require("./helper.js"),y=require("./ChartBreakoutCircle.js"),b=260;exports.SegmentPdfSpecialZoomLevel=void 0,(n=exports.SegmentPdfSpecialZoomLevel||(exports.SegmentPdfSpecialZoomLevel={})).ActualSize="ActualSize",n.PageFit="PageFit",n.PageWidth="PageWidth";var x=((e={})[exports.SegmentPdfSpecialZoomLevel.ActualSize]=o.SpecialZoomLevel.ActualSize,e[exports.SegmentPdfSpecialZoomLevel.PageFit]=o.SpecialZoomLevel.PageFit,e[exports.SegmentPdfSpecialZoomLevel.PageWidth]=o.SpecialZoomLevel.PageWidth,e),S=function(e){return{reviewId:e.id,segment:e.segment,pageNumber:e.pageNumber}};exports.default=function(e){var n,R,E,C,P,k,A,M,I,j,B,N,L,F,T,q,K,W,z,G,O,D,V,H,U,Z,X,Y,J,Q,$,ee,ne,te,ie=this,re=e.pdfUrl,oe=e.pdfName,ae=e.segments,le=e.styles,ue=e.pdfViewerProps,de=e.specialZoomLevel,se=e.showBadges,ge=void 0===se||se,ce=e.sortByConfidence,ve=void 0===ce?"low":ce,me=e.filterByConfidence,pe=void 0===me?"all":me,fe=e.showBadgeNavigation,_e=void 0===fe||fe,we=e.autoSelectReviewOnPageChange,he=void 0!==we&&we,ye=e.autoAdvanceAfterConfirm,be=void 0===ye||ye,xe=e.badgePreloadPages,Se=void 0===xe?8:xe,Re=e.badgeOffsetTop,Ee=void 0===Re?20:Re,Ce=e.badgeOffsetRight,Pe=void 0===Ce?68:Ce,ke=e.badgeOffsetLeft,Ae=void 0===ke?0:ke,Me=e.initialReviewId,Ie=e.manualPrompt,je=e.heightBuffer,Be=e.onBoundaryAction,Ne=e.onLabelAction,Le=e.onPageAction,Fe=e.onPageTypeRevert,Te=e.onRevert,qe=e.onActiveReviewChange,Ke=e.onCurrentPageChange,We=e.onActionError,ze=e.disableAllActions,Ge=void 0!==ze&&ze,Oe=e.disablePdfAnnotations,De=void 0!==Oe&&Oe,Ve=e.disablePdfTextLayer,He=void 0===Ve||Ve,Ue=e.disableTitleCheckUntilBoundaryCheckCompleted,Ze=void 0!==Ue&&Ue,Xe=e.onAdjustManually,Ye=e.onCognitiveClick,Je=e.className,Qe=e.style,$e=e.viewerStyle,en=e.railStyle,nn=e.redirectionData,tn=e.onBadgeSelected,rn=r.useMemo(function(){return c.extractSegmentReviewData(ae)},[ae]),on=rn.boundaryReviews,an=rn.labelReviews,ln=rn.pageReviews,un=r.useState(function(){return new Map}),dn=un[0],sn=un[1],gn=r.useMemo(function(){var e=new Map,n=1;return ae.forEach(function(t,i){var r=c.getSegmentReviewKey(t,i);e.has(r)||(e.set(r,n),n+=1)}),e},[ae]),cn=r.useMemo(function(){return new Set(an.map(function(e){return c.getSegmentReviewKey(e.segment)}))},[an]),vn=r.useMemo(function(){return h.getPendingMergeImpactedSegmentKeys(ae)},[ae]);r.useEffect(function(){sn(function(e){var n=!1,t=new Map(e);return e.forEach(function(e,i){var r=ae.find(function(e){return c.getSegmentReviewKey(e)===i});r&&!h.hasPolledStructuralAction(r,e)||(t.delete(i),n=!0)}),n?t:e})},[ae]);var mn=r.useMemo(function(){return h.getOptimisticMergeImpactedSegmentKeys(ae,dn)},[dn,ae]),pn=r.useRef(null),fn=r.useMemo(function(){return t.__spreadArray(t.__spreadArray(t.__spreadArray([],on.filter(function(e){return!vn.has(c.getSegmentReviewKey(e.segment))&&!mn.has(c.getSegmentReviewKey(e.segment))&&!h.shouldHideStructuralBoundaryReview(e.review_step,e.segment,cn.has(c.getSegmentReviewKey(e.segment)),dn.get(c.getSegmentReviewKey(e.segment)))}).map(function(e){var n;return t.__assign(t.__assign({},e),{kind:"boundary",pageNumber:null!==(n=e.metadata.focus_page)&&void 0!==n?n:e.segment.start_page})}),!0),an.filter(function(e){return!vn.has(c.getSegmentReviewKey(e.segment))&&!mn.has(c.getSegmentReviewKey(e.segment))}).map(function(e){return t.__assign(t.__assign({},e),{kind:"label",pageNumber:e.segment.start_page})}),!0),ln.filter(function(e){return!vn.has(c.getSegmentReviewKey(e.segment))&&!mn.has(c.getSegmentReviewKey(e.segment))}).map(function(e){var n;return t.__assign(t.__assign({},e),{kind:"page",pageNumber:null!==(n=e.metadata.page_num)&&void 0!==n?n:e.segment.start_page})}),!0).sort(function(e,n){var t,i,r=null!==(t=gn.get(c.getSegmentReviewKey(e.segment)))&&void 0!==t?t:Number.MAX_SAFE_INTEGER,o=null!==(i=gn.get(c.getSegmentReviewKey(n.segment)))&&void 0!==i?i:Number.MAX_SAFE_INTEGER;return e.pageNumber-n.pageNumber||r-o||e.reviewStepIndex-n.reviewStepIndex||e.id.localeCompare(n.id)})},[on,an,ln,mn,dn,vn,gn,cn]),_n=r.useMemo(function(){return ae.map(function(e){var n,i;return t.__assign(t.__assign({},e),{title:(null===(n=e.label)||void 0===n?void 0:n.trim())||e.title,page_count:null!==(i=e.page_count)&&void 0!==i?i:e.end_page-e.start_page+1})})},[ae]),wn=r.useState(1),hn=wn[0],yn=wn[1],bn=r.useState(null!=Me?Me:null),xn=bn[0],Sn=bn[1],Rn=r.useState(null!=Me?Me:null),En=Rn[0],Cn=Rn[1],Pn=r.useState(!1),kn=Pn[0],An=Pn[1],Mn=r.useState(null),In=Mn[0],jn=Mn[1],Bn=r.useState(null),Nn=Bn[0],Ln=Bn[1],Fn=r.useState(function(){return new Set}),Tn=Fn[0],qn=Fn[1],Kn=r.useState(null),Wn=Kn[0],zn=Kn[1],Gn=r.useState(null),On=Gn[0],Dn=Gn[1],Vn=r.useState(null),Hn=Vn[0],Un=Vn[1],Zn=r.useState(!1),Xn=Zn[0],Yn=Zn[1],Jn=r.useRef(0),Qn=r.useRef(null),$n=r.useRef(null),et=r.useRef(new Map),nt=r.useRef(null),tt=r.useRef(null),it=r.useRef(null),rt=r.useState(b),ot=rt[0],at=rt[1],lt=null!==(R=null===(n=null==le?void 0:le.aside)||void 0===n?void 0:n.width)&&void 0!==R?R:"40%",ut="min(".concat("number"==typeof lt?"".concat(lt,"px"):lt,", ").concat(b,"px, 100%)");r.useEffect(function(){qn(function(e){if(0===e.size)return e;var n=new Set(e),t=!1;return fn.forEach(function(e){var i;null!=(null===(i=e.review_step.review)||void 0===i?void 0:i.action)&&n.has(e.id)&&(n.delete(e.id),t=!0)}),t?n:e})},[fn]),r.useEffect(function(){var e=pn.current;if(e&&ge){var n=function(){var n=e.getBoundingClientRect().width;n>0&&at(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()}}},[ge]);var dt=r.useMemo(function(){var e=new Set;return fn.forEach(function(n){var t;null!=(null===(t=n.review_step.review)||void 0===t?void 0:t.action)&&e.add(n.id)}),e},[fn]),st=r.useMemo(function(){var e;return null!==(e=fn.find(function(e){return e.id===xn}))&&void 0!==e?e:null},[xn,fn]),gt=r.useMemo(function(){return!(!Ze||"label"!==(null==st?void 0:st.kind))&&on.some(function(e){if(c.getSegmentReviewKey(e.segment)!==c.getSegmentReviewKey(st.segment)||dt.has(e.id))return!1;var n=h.getResolvedScore(e.review_step.score,e.review_step.confidence);return null==n||n<85})},[st,on,Ze,dt]),ct=null==st?-1:ae.findIndex(function(e){return c.getSegmentReviewKey(e)===c.getSegmentReviewKey(st.segment)}),vt=ct>0?ae[ct-1]:void 0,mt=ct>=0?ae[ct+1]:void 0,pt=(null===(E=null==vt?void 0:vt.label)||void 0===E?void 0:E.trim())||(null==vt?void 0:vt.title),ft=(null===(C=null==mt?void 0:mt.label)||void 0===C?void 0:C.trim())||(null==mt?void 0:mt.title),_t=h.getConfidenceColors(null==st?void 0:st.review_step.score,null==st?void 0:st.review_step.confidence,null===(P=null==st?void 0:st.segment.confidence)||void 0===P?void 0:P.awaiting_llm),wt=(null===(k=null==st?void 0:st.review_step.reasons)||void 0===k?void 0:k.length)?st.review_step.reasons:null!==(M=null===(A=null==st?void 0:st.segment.confidence)||void 0===A?void 0:A.reasons)&&void 0!==M?M:[],ht=Boolean(wt.some(function(e){return e.text.trim()&&["evidence","gap"].includes(e.type.trim().toLowerCase())})||(null===(I=null==st?void 0:st.review_step.reason)||void 0===I?void 0:I.trim())||(null===(j=null==st?void 0:st.review_step.gap)||void 0===j?void 0:j.trim())),yt=null==st?null:"boundary"===st.kind?h.getBoundaryReviewActionBadgeLabel(st.review_step,st.segment,dn.get(null!==(B=st.segment.stable_key)&&void 0!==B?B:"")):h.getTitleReviewActionBadgeLabel(st.review_step,st.segment,dn.get(null!==(N=st.segment.stable_key)&&void 0!==N?N:"")),bt="label"===(null==st?void 0:st.kind)?[yt,st.review_step.human_action_enum,null===(L=st.review_step.review)||void 0===L?void 0:L.action,null===(F=st.review_step.human_resolution)||void 0===F?void 0:F.action]:[],xt="label"===(null==st?void 0:st.kind)&&bt.some(function(e){var n,t=null!==(n=null==e?void 0:e.trim().toUpperCase())&&void 0!==n?n:"";return t.includes("MERGE")||t.includes("SPLIT")}),St=null!=st&&fn.some(function(e){return"boundary"===e.kind&&c.getSegmentReviewKey(e.segment)===c.getSegmentReviewKey(st.segment)}),Rt=xt&&!St,Et=("boundary"===(null==st?void 0:st.kind)||Rt)&&null!=st?function(){var e,n,i,r,o,a;if("boundary"===st.kind)return st;var l=on.find(function(e){return c.getSegmentReviewKey(e.segment)===c.getSegmentReviewKey(st.segment)});return l?t.__assign(t.__assign({},l),{kind:"boundary",pageNumber:null!==(e=l.metadata.focus_page)&&void 0!==e?e:l.segment.start_page}):t.__assign(t.__assign({},st),{kind:"boundary",pageNumber:null!==(i=null===(n=st.segment.review_action)||void 0===n?void 0:n.focus_page)&&void 0!==i?i:st.segment.start_page,metadata:{focus_page:null!==(o=null===(r=st.segment.review_action)||void 0===r?void 0:r.focus_page)&&void 0!==o?o:null,boundary_margin:null!==(a=st.segment.boundary_margin)&&void 0!==a?a:null,user_actions:[]}})}():void 0,Ct=null==st?"":(null===(T=st.segment.label)||void 0===T?void 0:T.trim())||st.segment.title,Pt=null==st?void 0:st.review_step.revert,kt=null==st?void 0:st.segment.revert,At=function(e){return null==e?void 0:e.trim().toLowerCase()},Mt=null==st||null===(K=t.__spreadArray([],null!==(q=st.segment.review_steps)&&void 0!==q?q:[],!0).reverse().find(function(e){var n,t,i=null===(n=e.type)||void 0===n?void 0:n.trim().toLowerCase();return("page_boundary"===i||"page boundary review"===i)&&"boundary"===At(null===(t=e.revert)||void 0===t?void 0:t.type)}))||void 0===K?void 0:K.revert,It=null!==(W=null!=Pt?Pt:null==st?void 0:st.segment.revert)&&void 0!==W?W:Mt,jt=null==It?void 0:It.decision.trim().toUpperCase(),Bt=null!=yt?yt:(null==jt?void 0:jt.includes("SPLIT"))?"Split":(null==jt?void 0:jt.includes("MERGE"))?"Merged":null,Nt="label"===(null==st?void 0:st.kind)&&"SET_RANGE"===(null===(z=null==Mt?void 0:Mt.decision)||void 0===z?void 0:z.trim().toUpperCase())&&Mt.current_segment_ids.length!==Mt.previous_state.length,Lt="Merged"===yt||"Split"===yt||Nt,Ft=null==st?void 0:Lt?"boundary"===At(null==Mt?void 0:Mt.type)?Mt:"boundary"===At(null==kt?void 0:kt.type)?kt:"boundary"===At(null==Pt?void 0:Pt.type)?Pt:void 0:"label"===st.kind?"label"===At(null==Pt?void 0:Pt.type)?Pt:void 0:"boundary"===st.kind?"boundary"===At(null==Pt?void 0:Pt.type)?Pt:"boundary"===At(null==Mt?void 0:Mt.type)?Mt:"boundary"===At(null==kt?void 0:kt.type)?kt:void 0:void 0,Tt=Lt&&(null==Ft?void 0:Ft.operation_id)?ae.flatMap(function(e){var n;return null!==(n=e.review_steps)&&void 0!==n?n:[]}).find(function(e){var n,t,i,r,o,a,l,u=null===(n=e.type)||void 0===n?void 0:n.trim().toLowerCase();return("page_boundary"===u||"page boundary review"===u)&&((null!==(o=null!==(i=null===(t=e.human_resolution)||void 0===t?void 0:t.operation_id)&&void 0!==i?i:null===(r=e.revert)||void 0===r?void 0:r.operation_id)&&void 0!==o?o:e.operation_id)===Ft.operation_id&&Boolean(null===(l=null===(a=e.human_resolution)||void 0===a?void 0:a.change_summary)||void 0===l?void 0:l.trim()))}):void 0,qt=(null===(G=null==Ft?void 0:Ft.summary)||void 0===G?void 0:G.trim())||null,Kt=Lt?(null===(D=null===(O=null==Tt?void 0:Tt.human_resolution)||void 0===O?void 0:O.change_summary)||void 0===D?void 0:D.trim())||(null===(V=null==Ft?void 0:Ft.summary)||void 0===V?void 0:V.trim())||"":(null===(Z=null===(U=null===(H=null==st?void 0:st.review_step)||void 0===H?void 0:H.human_resolution)||void 0===U?void 0:U.change_summary)||void 0===Z?void 0:Z.trim())||(null===(Y=null===(X=null==st?void 0:st.review_step)||void 0===X?void 0:X.summary)||void 0===Y?void 0:Y.trim())||"",Wt=null==st?null:Ft?{currentSegment:{title:Ct,startPage:st.segment.start_page,endPage:st.segment.end_page},previousSegments:Ft.previous_state.map(function(e){var n,t;return{title:(null===(n=e.label)||void 0===n?void 0:n.trim())||(null===(t=e.title)||void 0===t?void 0:t.trim())||"Untitled document",startPage:e.start_page,endPage:e.end_page}})}:"Split"===Bt?{currentSegment:{title:Ct,startPage:st.segment.start_page,endPage:st.segment.end_page},previousSegments:[{title:"Advice of Award",startPage:1,endPage:25},{title:Ct,startPage:st.segment.start_page,endPage:st.segment.end_page}]}:"Merged"===Bt?{currentSegment:{title:Ct,startPage:st.segment.start_page,endPage:st.segment.end_page},previousSegments:[{title:"Advice of Award",startPage:1,endPage:25},{title:"Request for proposal (RFP)",startPage:26,endPage:76}]}:{currentSegment:{title:Ct,startPage:st.segment.start_page,endPage:st.segment.end_page},previousSegments:[]},zt="page"===(null==st?void 0:st.kind)&&null!==(J=st.metadata.classification_id)&&void 0!==J?J:null,Gt="page"===(null==st?void 0:st.kind)?Boolean(Fe&&zt):Boolean((null==Ft?void 0:Ft.operation_id)&&(null==Ft?void 0:Ft.type)&&!1!==(null==Ft?void 0:Ft.revertable));Boolean(Wt&&Gt&&("page"!==(null==st?void 0:st.kind)||zt));var Ot=r.useCallback(function(e,n){Jn.current+=1,Qn.current={requestId:Jn.current,pageNumber:e,reviewId:n},Ln({pageNumber:e,requestId:Jn.current})},[]),Dt=r.useCallback(function(e){var n,t;!0!==(null===(n=e.segment.confidence)||void 0===n?void 0:n.awaiting_llm)&&(null==tn||tn({reviewId:e.id,segment_id:null!==(t=e.segment.segment_id)&&void 0!==t?t:null,reviewStepIndex:e.reviewStepIndex,kind:e.kind,pageNumber:e.pageNumber,metadata:e.metadata}),Dn(null),Un(null),Sn(e.id),Cn(e.id),An(!1),jn(null),Ot(e.pageNumber,e.id),null==qe||qe(e.id,e.segment))},[qe,tn,Ot]);r.useEffect(function(){if(Hn){var e=requestAnimationFrame(function(){return Yn(!0)}),n=window.setTimeout(function(){Yn(!1)},3500),t=window.setTimeout(function(){Un(null)},4e3);return function(){cancelAnimationFrame(e),window.clearTimeout(n),window.clearTimeout(t)}}},[Hn]),r.useEffect(function(){var e,n,t,i;if(nn){if("pageGroup"===nn.type){var r=null!==(e=nn.pages)&&void 0!==e?e:[],o=null!==(n=nn.pageIndex)&&void 0!==n?n:0,a=r[o];if(null==a)return;return Vt(),Dn({pages:r,index:o,label:null!==(t=nn.groupLabel)&&void 0!==t?t:""}),Jn.current+=1,void Ln({pageNumber:a,requestId:Jn.current})}if(Dn(null),nn.reviewId){var l=fn.find(function(e){return e.id===nn.reviewId&&(!nn.type||e.kind===nn.type)});if(l)return void Dt(l)}if(nn.classificationId){var u=fn.find(function(e){return!("page"!==e.kind||e.metadata.classification_id!==nn.classificationId||nn.segmentId&&e.segment.segment_id!==nn.segmentId||nn.type&&e.kind!==nn.type)});if(u)return void Dt(u)}if(nn.pageNumber&&nn.type){var d=Number(nn.pageNumber);if(Number.isInteger(d)&&!(d<1)){var s=null===(i=nn.pageType)||void 0===i?void 0:i.trim().toLowerCase(),g=fn.find(function(e){var n="page"===e.kind?e.pageNumber:e.segment.start_page,t="page"!==e.kind||!s||e.metadata.page_type===s;return(!nn.segmentId||e.segment.segment_id===nn.segmentId)&&n===d&&e.kind===nn.type&&t});g?Dt(g):"page"===nn.type&&(Vt(),Jn.current+=1,Ln({pageNumber:d,requestId:Jn.current}))}}}},[nn,Dt,fn]);var Vt=r.useCallback(function(){Qn.current=null,An(!1),Sn(null),jn(null),null==qe||qe(null,null)},[qe]),Ht=r.useCallback(function(e){var n;Yn(!1),Un(null);var t=null!==(n=fn.find(function(n){return!dt.has(n.id)&&"boundary"===n.kind&&n.segment.start_page===e.startPage&&n.segment.end_page===e.endPage}))&&void 0!==n?n:fn.find(function(n){return!dt.has(n.id)&&n.segment.start_page<=e.startPage&&n.segment.end_page>=e.startPage});t?Dt(t):(Vt(),Jn.current+=1,Ln({pageNumber:e.startPage,requestId:Jn.current}))},[Vt,dt,fn,Dt]),Ut=r.useCallback(function(e){var n;if(be){var t=fn.findIndex(function(n){return n.id===e}),i=new Set(fn.map(function(e){return e.id})),r=null!==(n=fn.find(function(n,r){return r>t&&n.id!==e&&i.has(n.id)}))&&void 0!==n?n:fn.find(function(n){return n.id!==e});r?requestAnimationFrame(function(){return Dt(r)}):Vt()}else Vt()},[be,Vt,fn,Dt,fn]),Zt=r.useCallback(function(e,n,i){return t.__awaiter(ie,void 0,void 0,function(){var r,o,a,u,d,s,g,v,m;return t.__generator(this,function(t){switch(t.label){case 0:if(Ge)return[2];if("boundary"===e.kind&&!Be)return[2];if("label"===e.kind&&!Ne)return[2];if("page"===e.kind&&!Le)return[2];r=S(e),a=i,u=(o=n)===l.BoundaryReviewActionEnum.SET_RANGE?function(){var n=a.startPage,t=a.endPage;if(null==n||null==t)return null;var i=n<e.segment.start_page||t>e.segment.end_page,r=n>e.segment.start_page||t<e.segment.end_page;return i&&!r?n<e.segment.start_page?l.BoundaryReviewActionEnum.MERGE_PREV:l.BoundaryReviewActionEnum.MERGE_NEXT:r?l.BoundaryReviewActionEnum.SPLIT_HERE:null}():o,d="boundary"===e.kind&&null!=Be&&be&&(u===l.BoundaryReviewActionEnum.SPLIT_HERE||u===l.BoundaryReviewActionEnum.MERGE_NEXT||u===l.BoundaryReviewActionEnum.MERGE_PREV||u===l.BoundaryReviewActionEnum.MERGE_PREVIOUS),s=d?ae.findIndex(function(n){return c.getSegmentReviewKey(n)===c.getSegmentReviewKey(e.segment)}):-1,d&&s>=0&&u&&($n.current={action:u,originalSegmentIndex:s,segmentSignature:JSON.stringify(ae.map(function(e,n){var t;return{key:c.getSegmentReviewKey(e,n),startPage:e.start_page,endPage:e.end_page,version:null!==(t=e.version)&&void 0!==t?t:null}})),ready:!1}),zn(e.id),t.label=1;case 1:return t.trys.push([1,8,9,10]),"boundary"!==e.kind?[3,3]:[4,null==Be?void 0:Be(n,i,r)];case 2:return t.sent(),[3,7];case 3:return"label"!==e.kind?[3,5]:[4,null==Ne?void 0:Ne(n,i,r)];case 4:return t.sent(),[3,7];case 5:return"page"!==e.kind?[3,7]:[4,null==Le?void 0:Le(n,i,r)];case 6:t.sent(),t.label=7;case 7:return qn(function(n){var t=new Set(n);return t.add(e.id),t}),g="boundary"===e.kind&&(u===l.BoundaryReviewActionEnum.MERGE_NEXT||u===l.BoundaryReviewActionEnum.MERGE_PREV||u===l.BoundaryReviewActionEnum.MERGE_PREVIOUS),("boundary"===e.kind&&u===l.BoundaryReviewActionEnum.SPLIT_HERE||g)&&u&&sn(function(n){var t=new Map(n);return t.set(c.getSegmentReviewKey(e.segment),u),t}),$n.current?($n.current.ready=!0,g&&(v=fn.find(function(n){return"label"===n.kind&&c.getSegmentReviewKey(n.segment)===c.getSegmentReviewKey(e.segment)}))&&requestAnimationFrame(function(){return Dt(v)})):Ut(e.id),[3,10];case 8:return m=t.sent(),d&&($n.current=null),null==We||We(m,r),[3,10];case 9:return zn(null),[7];case 10:return[2]}})})},[be,Ge,We,Be,Ne,Le,Fe,fn,ae,Dt,Ut]);r.useEffect(function(){var e=$n.current;if(null==e?void 0:e.ready){var n=JSON.stringify(ae.map(function(e,n){var t;return{key:c.getSegmentReviewKey(e,n),startPage:e.start_page,endPage:e.end_page,version:null!==(t=e.version)&&void 0!==t?t:null}}));if(n!==e.segmentSignature){var t=e.action===l.BoundaryReviewActionEnum.SPLIT_HERE?e.originalSegmentIndex+1:e.action===l.BoundaryReviewActionEnum.MERGE_PREV||e.action===l.BoundaryReviewActionEnum.MERGE_PREVIOUS?Math.max(0,e.originalSegmentIndex-1):e.originalSegmentIndex,i=new Map(ae.map(function(e,n){return[c.getSegmentReviewKey(e,n),n]})),r=fn.find(function(e){var n,r=i.get(c.getSegmentReviewKey(e.segment));return null!=r&&r>=t&&!h.isReviewStepResolved(e.review_step,e.segment)&&(!Tn.has(e.id)||!h.isReviewStepResolutionCurrent(e.review_step,e.segment))&&!0!==(null===(n=e.segment.confidence)||void 0===n?void 0:n.awaiting_llm)});if(!r)return $n.current=null,void Vt();requestAnimationFrame(function(){$n.current=null,Dt(r)})}}},[Vt,Tn,fn,ae,Dt]),r.useEffect(function(){$n.current||xn&&!fn.some(function(e){return e.id===xn})&&Vt()},[xn,Vt,fn]),r.useEffect(function(){if(he&&!$n.current){var e=fn.find(function(e){return e.pageNumber===hn});e&&e.id!==xn&&Dt(e)}},[xn,he,hn,Dt,fn]),r.useEffect(function(){$n.current||xn&&!fn.some(function(e){var n;return e.id===xn&&!0!==(null===(n=e.segment.confidence)||void 0===n?void 0:n.awaiting_llm)})&&Vt()},[xn,Vt,fn]);var Xt=r.useMemo(function(){var e=fn.filter(function(e){var n;return!0!==(null===(n=e.segment.confidence)||void 0===n?void 0:n.awaiting_llm)});if("all"===pe)return e;var n=["low","medium","high"].filter(function(e){return e!==ve}),i=t.__spreadArray([ve],n,!0),r=new Map(i.map(function(e,n){return[e,n]}));return e.map(function(e,n){return{item:e,index:n}}).sort(function(e,n){var t,o,a,l,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!==(a=r.get(u))&&void 0!==a?a:i.length)-(null==d?i.length:null!==(l=r.get(d))&&void 0!==l?l:i.length)||e.index-n.index}).map(function(e){return e.item})},[pe,ve,fn]),Yt=Xt.findIndex(function(e){return e.id===En}),Jt=r.useState(null),Qt=Jt[0],$t=Jt[1],ei=r.useRef(!1),ni=r.useCallback(function(e){var n=Xt[e];n&&Dt(n)},[Xt,Dt]);r.useCallback(function(e){if(!(!On||e<0||e>=On.pages.length)){var n=On.pages[e];null!=n&&(Vt(),Dn(function(n){return null==n?n:t.__assign(t.__assign({},n),{index:e})}),Jn.current+=1,Ln({pageNumber:n,requestId:Jn.current}))}},[On,Vt]),r.useEffect(function(){En&&!Xt.some(function(e){return e.id===En})&&Cn(null)},[Xt,En]),r.useEffect(function(){ei.current=!1,$t(Yt>=0?String(Yt+1):null)},[Yt,Xt.length]),r.useEffect(function(){if(ei.current&&null!=Qt){var e=window.setTimeout(function(){var e=Number(Qt.trim()),n=e-1;Number.isInteger(e)&&n>=0&&n<Xt.length&&(ei.current=!1,ni(n))},300);return function(){return window.clearTimeout(e)}}},[ni,Qt,Xt.length]);var ti=r.useMemo(function(){var e=new Map;fn.forEach(function(n){var t,i=null!==(t=e.get(c.getSegmentReviewKey(n.segment)))&&void 0!==t?t:[];i.push(n),e.set(c.getSegmentReviewKey(n.segment),i)});var n=new Map;return e.forEach(function(e,t){var i,r=null!==(i=gn.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},[fn,gn]),ii=r.useMemo(function(){var e=new Map;fn.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},[fn]),ri=r.useCallback(function(e){return{startPage:Math.max(0,e.startPage-Se),endPage:Math.min(e.numPages-1,e.endPage+Se)}},[Se]),oi=r.useCallback(function(){var e,n=tt.current,t=it.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();fn.forEach(function(e){var n,r=et.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(),u=null!==(n=ii.get(e.id))&&void 0!==n?n:0,d=l.top+Ee+40*u,s=d+(r.offsetHeight||32),g=d>=o.top&&s<=o.bottom;r.style.top="".concat(d-i.top,"px"),r.style.visibility=g?"visible":"hidden"}else r.style.visibility="hidden"}});var a=nt.current;if(a){var l=null==On?void 0:On.pages[On.index],u=null==l?null:t.querySelector('[data-testid="core__page-layer-'.concat(l-1,'"]'));if(On&&u){var d=u.getBoundingClientRect().top+Ee,s=d+(a.offsetHeight||25),g=d>=o.top&&s<=o.bottom;a.style.top="".concat(d-i.top,"px"),a.style.visibility=g?"visible":"hidden"}else a.style.visibility="hidden"}if(xn&&null==Qn.current){var c=et.current.get(xn);c&&"hidden"!==c.style.visibility&&jn(function(e){return e===c?e:c})}}},[On,xn,Ee,ii,fn]),ai=r.useCallback(function(e){var n=Qn.current;n&&n.requestId===e.requestId&&n.pageNumber===e.pageNumber&&(Qn.current=null,oi(),requestAnimationFrame(function(){if(null==Qn.current){var e=et.current.get(n.reviewId);e&&"hidden"!==e.style.visibility&&jn(e)}}))},[oi]);return r.useEffect(function(){var e=it.current;if(e&&ge){var n=null,t=function(){null==n&&(n=requestAnimationFrame(function(){n=null,oi()}))};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()}}},[ge,oi]),i.jsxs("div",t.__assign({ref:tt,className:Je,style:t.__assign(t.__assign({},Qe),{display:"block",position:"relative",width:"100%",height:"100%",minWidth:0,overflowX:"auto",overflowY:"hidden"})},{children:[i.jsxs("div",t.__assign({className:"segment-review-wrapper__container",style:{display:"flex",alignItems:"stretch",gap:0,width:"100%",minWidth:700,height:"100%"}},{children:[i.jsx("div",t.__assign({ref:it,style:t.__assign(t.__assign({},$e),{flex:"1 1 auto",width:ge?"auto":"100%",minWidth:0,height:"100%",boxSizing:"border-box"})},{children:i.jsx(a.default,t.__assign({highlightText:[],highlightPages:{},highlightCordinatePages:[],useCoordinates:!1},ue,{defaultScale:void 0===de?null!==(Q=null==ue?void 0:ue.defaultScale)&&void 0!==Q?Q:o.SpecialZoomLevel.PageFit:x[de],disablePdfAnnotations:De,disablePdfTextLayer:He,pdfUrl:re,pdfName:oe,segments:_n,navigationRequest:Nn,onNavigationSettled:ai,setRenderRange:ri,onCurrentPageChange:function(e){yn(e),null==Qn.current&&st&&st.pageNumber!==e&&Vt(),null==Ke||Ke(e)}}))})),ge&&i.jsxs("aside",t.__assign({"aria-label":"Page review badges",ref:pn,style:t.__assign(t.__assign({},en),{position:"relative",width:ut,maxWidth:b,flex:"0 1 ".concat(ut),minHeight:0,overflow:"hidden",boxSizing:"border-box"})},{children:[On&&i.jsx("span",t.__assign({ref:nt,style:{position:"absolute",top:0,left:10,visibility:"hidden",zIndex:2,display:"inline-flex",alignItems:"center",justifyContent:"center",gap:4,minHeight:25,padding:"2px 8px",border:"1px solid #E2E8F0",borderRadius:16,backgroundColor:"#F8FAFC",boxSizing:"border-box",boxShadow:"0 1px 2px rgba(16, 24, 40, 0.08)",font:"inherit"}},{children:i.jsxs(m.Typography,t.__assign({fontFamily:"Inter",sx:{fontSize:11,fontWeight:500,color:"#475569",whiteSpace:"nowrap"}},{children:[On.label||"Pages"," Pg: ",On.index+1]}))})),_e&&Xt.length>0&&!On&&i.jsxs("nav",t.__assign({"aria-label":"Review badge navigation",style:{position:"absolute",top:8,right:Pe||"auto",left:Ae||"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:[i.jsx("input",{type:"text",inputMode:"numeric",pattern:"[0-9]*",value:null!=Qt?Qt:"-","aria-label":"Review badge number",onChange:function(e){ei.current=!0,$t(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"}}),i.jsxs("span",t.__assign({"aria-label":"".concat(Xt.length," reviews"),style:{flex:1,color:"#4F46E5",fontSize:14,whiteSpace:"nowrap",textAlign:"center"}},{children:["of ",Xt.length]})),["previous","next"].map(function(e){var n="previous"===e,r=Yt+(n?-1:1),o=r<0||r>=Xt.length;return i.jsx("button",t.__assign({type:"button","aria-label":"".concat(n?"Previous":"Next"," review badge"),disabled:o,onClick:function(){return ni(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:i.jsx("svg",t.__assign({width:"12",height:"8",viewBox:"0 0 12 8",fill:"none"},{children:i.jsx("path",{d:n?"M1 7L6 2L11 7":"M1 1L6 6L11 1",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})}))}),e)})]})),!On&&fn.map(function(e){var n,r,o=xn===e.id,a=null!==(n=ti.get(e.id))&&void 0!==n?n:"1A",l=e.review_step.score,u=e.review_step.confidence,d=h.formatScore(l,u),s="boundary"===e.kind?h.getBoundaryReviewActionBadgeLabel(e.review_step,e.segment,dn.get(c.getSegmentReviewKey(e.segment))):"label"===e.kind?h.getTitleReviewActionBadgeLabel(e.review_step,e.segment,dn.get(c.getSegmentReviewKey(e.segment))):null,g=null!=s?s:"N/A"===d?d:"".concat(d,"%"),p=!0===(null===(r=e.segment.confidence)||void 0===r?void 0:r.awaiting_llm),f=h.getConfidenceColors(l,u,p),_=dt.has(e.id),w=p;return i.jsx(m.Tooltip,t.__assign({title:p?"data is being processed":"",arrow:!0},{children:i.jsx("span",t.__assign({ref:function(n){n?et.current.set(e.id,n):et.current.delete(e.id)},style:{position:"absolute",top:0,left:10,visibility:"hidden",display:"inline-flex",cursor:w?"not-allowed":"pointer"}},{children:i.jsx("button",t.__assign({disabled:w,type:"button","aria-pressed":o,"aria-label":p?"".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 Dt(e)},style:{cursor:"inherit",display:"flex",alignItems:"center",justifyContent:"space-around",gap:4,width:s?_&&!p?115:90:_&&!p?105:80,minHeight:25,padding:"2px 5px",border:"1px solid ".concat(_&&!p?"#E2E8F0":f.border),borderRadius:16,backgroundColor:_&&!p?"#F8FAFC":f.background,color:_&&!p?"#475569":f.text,font:"inherit",alignContent:"center",boxShadow:"0 1px 2px rgba(16, 24, 40, 0.08)"}},{children:_&&!p?i.jsxs(m.Typography,t.__assign({fontFamily:"Inter",sx:{display:"flex",gap:1,alignItems:"center",flexDirection:"row"}},{children:[i.jsx("span",t.__assign({style:{fontSize:11,fontWeight:500}},{children:a})),i.jsxs("span",t.__assign({style:{display:"flex",alignItems:"center"}},{children:[i.jsx("svg",t.__assign({width:"2",height:"14",viewBox:"0 0 1 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:i.jsx("path",{d:"M0.399902 0V14",stroke:"#CBD5E1",strokeWidth:"0.8"})})),i.jsx("span",t.__assign({style:{fontSize:11,fontWeight:500,marginLeft:"7px",display:"flex",alignItems:"center"}},{children:g}))]})),i.jsxs("span",t.__assign({style:{fontSize:11,fontWeight:500,display:"flex",alignItems:"center"}},{children:[i.jsx("svg",t.__assign({width:"2",height:"14",viewBox:"0 0 1 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:i.jsx("path",{d:"M0.399902 0V14",stroke:"#CBD5E1",strokeWidth:"0.8"})})),i.jsx("span",t.__assign({style:{display:"flex",marginLeft:"7px",alignItems:"center"}},{children:i.jsx(v.CircleCheck,{height:14,width:14,strokeWidth:2,color:"#16A34A"})}))]}))]})):i.jsxs(m.Typography,t.__assign({fontFamily:"Inter",sx:{display:"flex",gap:1,alignItems:"center",flexDirection:"row"}},{children:[i.jsx("span",t.__assign({style:{fontSize:11,fontWeight:500}},{children:a})),i.jsxs("span",t.__assign({style:{display:"flex",alignItems:"center"}},{children:[i.jsx("svg",t.__assign({width:"2",height:"14",viewBox:"0 0 1 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:i.jsx("path",{d:"M0.399902 0V14",stroke:f.divider,strokeWidth:"0.8"})})),i.jsx("span",t.__assign({style:{fontSize:11,fontWeight:500,marginLeft:"7px",display:"flex",alignItems:"center"}},{children:g}))]}))]}))}))}))}),e.id)})]}))]})),st&&In&&i.jsxs(u.default,t.__assign({anchorElement:In,placement:"bottom-start",offset:{top:8},width:Math.min(ot,b),maxWidth:b,heightBuffer:null!=je?je:25},{children:[kn&&i.jsx(d.default,{width:"100%",maxWidth:"100%",score:st.review_step.score,reasons:wt,reason:st.review_step.reason,gap:st.review_step.gap,onBack:function(){return An(!1)},onClose:Vt}),i.jsx("div",t.__assign({style:{display:kn?"none":"block"}},{children:dt.has(st.id)?i.jsx(p.default,{width:"100%",maxWidth:"100%",headerName:"page"===st.kind?"Page format approved":"Split"===yt?"Split approved":"Merged"===yt?"Merge approved":"User approved",headerIcon:"page"===st.kind?i.jsx(v.Check,{size:18,strokeWidth:2}):"Merged"===yt?i.jsx(v.GitMerge,{size:18,strokeWidth:2}):"Split"===yt?i.jsx(y.default,{width:18,height:18}):i.jsx(v.CircleCheck,{size:18,strokeWidth:2}),title:Ct,pageNo:"Page ".concat(st.segment.start_page,"-").concat(st.segment.end_page),summary:Wt?i.jsx(_.default,{icon:i.jsx(v.CircleCheck,{size:14,strokeWidth:2}),title:Ct,pageRange:"Page ".concat(st.segment.start_page,"-").concat(st.segment.end_page),description:null!=Kt?Kt:null,revertData:Wt,confirmDisabled:"page"===st.kind?!Gt:null==Te||!Gt,showDocumentHeader:!1,onRevert:function(){if("page"===st.kind){if(!Fe||!zt){var e=new Error("SegmentReviewPdfWrapper requires onPageTypeRevert and a classification id to revert a page-type decision.");return null==We||We(e,S(st)),Promise.reject(e)}return Fe({classification_id:zt,human_verdict:"No"},S(st))}if(!Te)throw new Error("SegmentReviewPdfWrapper requires onRevert to handle a revert confirmation.");if(!Ft)throw new Error("There is no valid revert operation for this review.");var n=Lt?"boundary":"label"===st.kind?"label":"boundary"===st.kind?"boundary":null,t=At(Ft.type);if(n&&t!==n)throw new Error("Cannot use ".concat(null!=t?t:"unknown"," revert metadata for this review. Expected ").concat(n,"."));return Te(Ft,S(st))},onRevertError:function(e){null==We||We(e,S(st))},onRevertComplete:function(e){var n,t,i,r,o,a;qn(function(){return new Set}),"page"!==st.kind&&sn(function(){return new Map}),st.id;var l=null!==(n=Wt.previousSegments[0])&&void 0!==n?n:Wt.currentSegment,u=null==In?void 0:In.getBoundingClientRect(),d=null===(t=it.current)||void 0===t?void 0:t.getBoundingClientRect(),s=Math.min(b,Math.max(220,ot)),g=null!==(i=null==u?void 0:u.left)&&void 0!==i?i:(null!==(r=null==d?void 0:d.right)&&void 0!==r?r:window.innerWidth-s-8)+8,c=Math.max(8,Math.min(g,window.innerWidth-s-8)),v=null==(null==u?void 0:u.bottom)?Math.max(8,null!==(o=null==d?void 0:d.top)&&void 0!==o?o:8):u.bottom+8;qn(function(){return new Set}),"page"!==st.kind&&($n.current=null),Yn(!1),Un({title:"Split"===yt?"Split reverted":"Merged"===yt?"Merge reverted":"Approval reverted",description:(null===(a=null==e?void 0:e.message)||void 0===a?void 0:a.trim())||("Split"===yt?"Pages ".concat(st.segment.start_page,"-").concat(st.segment.end_page," are now part of “Advice of Award” again. Review the boundary and title to confirm the document."):"Merged"===yt?"The documents have been separated again. Review their boundaries and titles to confirm them.":"“".concat(Ct,"” is pending review again. Review the boundary and title to confirm the document.")),segment:l,position:{top:v,left:c,width:s}}),Vt()}},st.id):void 0,additionalActions:Et?i.jsx(f.default,{metadata:Et.metadata,reviewAction:null!==($=st.segment.review_action)&&void 0!==$?$:void 0,startPage:st.segment.start_page,endPage:st.segment.end_page,title:Ct,previousSegmentTitle:pt,nextSegmentTitle:ft,disabled:Ge||!Be||Wn===st.id,onConfirm:function(e,n){Zt(Et,e,n)}}):void 0,cognitiveScore:st.review_step.score,styles:{root:{borderColor:"#16A34A"},header:{"& > .MuiSvgIcon-root, & .MuiTypography-root":{color:"#16A34A"}}},onCognitiveClick:ht?function(){An(!0),null==Ye||Ye(S(st))}:void 0,onClose:Vt}):"boundary"===st.kind?i.jsx(l.default,{width:"100%",maxWidth:"100%",title:st.segment.label||st.segment.title,pageNo:"Page ".concat(st.pageNumber),content:null!==(ee=st.review_step.question)&&void 0!==ee?ee:null,revertSummary:qt,cognitiveScore:st.review_step.score,metadata:st.metadata,reviewAction:null!==(ne=st.segment.review_action)&&void 0!==ne?ne:void 0,previousSegmentTitle:pt,nextSegmentTitle:ft,manualPrompt:null!=Ie?Ie:"Set a custom boundary",defaultStartPage:st.segment.start_page,defaultEndPage:st.segment.end_page,styles:{root:{borderColor:_t.cardBorder},header:{"& > .MuiSvgIcon-root, & .MuiTypography-root":{color:_t.text}}},confirmDisabled:Ge||!Be||Wn===st.id,onConfirm:function(e,n,t){t&&l.isBoundaryReviewAction(n.id)&&Zt(st,n.id,t)},onAdjustManually:function(){return null==Xe?void 0:Xe(S(st))},onCognitiveClick:ht?function(){An(!0),null==Ye||Ye(S(st))}:void 0,onClose:Vt},st.id):"label"===st.kind?i.jsx(s.default,{width:"100%",maxWidth:"100%",title:st.metadata.current_label||st.segment.label||st.segment.title,pageNo:"Pages ".concat(st.segment.start_page,"-").concat(st.segment.end_page),content:null!==(te=st.review_step.question)&&void 0!==te?te:null,revertSummary:qt,cognitiveScore:st.review_step.score,metadata:st.metadata,styles:{root:{borderColor:_t.cardBorder},header:{"& > .MuiSvgIcon-root, & .MuiTypography-root":{color:_t.text}}},confirmDisabled:Ge||!Ne||Wn===st.id,confirmationBlocked:gt,confirmationWarning:gt?"Please confirm the boundary before confirming the title.":void 0,onActionConfirm:function(e,n){Zt(st,e,n)},onAdjustManually:function(){return null==Xe?void 0:Xe(S(st))},onCognitiveClick:ht?function(){An(!0),null==Ye||Ye(S(st))}:void 0,onClose:Vt},st.id):i.jsx(g.default,{width:"100%",maxWidth:"100%",title:st.segment.label||st.segment.title,pageNo:"Page ".concat(st.pageNumber),content:st.review_step.reason,cognitiveScore:st.review_step.score,pageType:st.metadata.page_type,metadata:st.metadata,styles:{root:{borderColor:_t.cardBorder},header:{"& > .MuiSvgIcon-root, & .MuiTypography-root":{color:_t.text}}},confirmDisabled:Ge||!Le||Wn===st.id,onActionConfirm:function(e,n){Zt(st,e,n)},onCognitiveClick:ht?function(){An(!0),null==Ye||Ye(S(st))}:void 0,onClose:Vt},st.id)}))]})),Hn&&i.jsx(m.Portal,{children:i.jsx(m.Box,t.__assign({"aria-live":"polite",sx:{position:"fixed",top:Hn.position.top,left:Hn.position.left,zIndex:1600,width:Hn.position.width,maxWidth:"calc(100vw - 16px)",opacity:Xn?1:0,transform:Xn?"translateY(0)":"translateY(-6px)",transition:"opacity 500ms ease, transform 500ms ease",filter:"drop-shadow(0 12px 24px rgba(15, 23, 42, 0.18))",pointerEvents:Xn?"auto":"none"}},{children:i.jsx(w.default,{title:Hn.title,description:Hn.description,onReview:function(){return Ht(Hn.segment)}})}))})]}))};
|
|
2
2
|
//# sourceMappingURL=SegmentReviewPdfWrapper.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),r=require("./reviewStepAdapters.js"),n=function(e){if(null==e)return null;if("number"==typeof e)return Number.isFinite(e)?e:null;var r=e.trim();if(!r)return null;var n=Number.parseFloat(r);return Number.isFinite(n)?n:null},t=function(e){switch(null==e?void 0:e.trim().toLowerCase()){case"low":return 40;case"medium":return 70;case"high":return 95;default:return null}},i=function(e,r){var i;return null!==(i=n(e))&&void 0!==i?i:t(r)},u=function(e){switch(null==e?void 0:e.trim().toUpperCase()){case"SPLIT":case"SPLIT_HERE":return"Split";case"MERGE":case"MERGE_NEXT":case"MERGE_PREV":case"MERGE_PREVIOUS":return"Merged";default:return null}},l=function(e){var r,n,t,i;if(![e.human_action_enum,null===(r=e.human_resolution)||void 0===r?void 0:r.action,null===(n=e.review)||void 0===n?void 0:n.action].some(function(e){return"SET_RANGE"===(null==e?void 0:e.trim().toUpperCase())}))return null;var u=null===(t=e.human_resolution)||void 0===t?void 0:t.before,l=null===(i=e.human_resolution)||void 0===i?void 0:i.after;if(null==(null==u?void 0:u.start_page)||null==u.end_page||null==(null==l?void 0:l.start_page)||null==l.end_page)return null;var o=l.start_page<u.start_page||l.end_page>u.end_page,a=l.start_page>u.start_page||l.end_page<u.end_page;if(o&&!a)return"Merged";if(a&&!o)return"Split";var d=u.end_page-u.start_page+1,v=l.end_page-l.start_page+1;return v>d?"Merged":v<d?"Split":null},o=function(e){switch(null==e?void 0:e.trim().toUpperCase()){case"SPLIT":case"SPLIT_HERE":return"SPLIT_HERE";case"MERGE_NEXT":return"MERGE_NEXT";case"MERGE_PREV":case"MERGE_PREVIOUS":return"MERGE_PREV";case"SET_RANGE":return"SET_RANGE";default:return null}},a=function(e){var r=e.type.trim().toLowerCase();return"page_boundary"===
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),r=require("./reviewStepAdapters.js"),n=function(e){if(null==e)return null;if("number"==typeof e)return Number.isFinite(e)?e:null;var r=e.trim();if(!r)return null;var n=Number.parseFloat(r);return Number.isFinite(n)?n:null},t=function(e){switch(null==e?void 0:e.trim().toLowerCase()){case"low":return 40;case"medium":return 70;case"high":return 95;default:return null}},i=function(e,r){var i;return null!==(i=n(e))&&void 0!==i?i:t(r)},u=function(e){switch(null==e?void 0:e.trim().toUpperCase()){case"SPLIT":case"SPLIT_HERE":return"Split";case"MERGE":case"MERGE_NEXT":case"MERGE_PREV":case"MERGE_PREVIOUS":return"Merged";default:return null}},l=function(e){var r,n,t,i;if(![e.human_action_enum,null===(r=e.human_resolution)||void 0===r?void 0:r.action,null===(n=e.review)||void 0===n?void 0:n.action].some(function(e){return"SET_RANGE"===(null==e?void 0:e.trim().toUpperCase())}))return null;var u=null===(t=e.human_resolution)||void 0===t?void 0:t.before,l=null===(i=e.human_resolution)||void 0===i?void 0:i.after;if(null==(null==u?void 0:u.start_page)||null==u.end_page||null==(null==l?void 0:l.start_page)||null==l.end_page)return null;var o=l.start_page<u.start_page||l.end_page>u.end_page,a=l.start_page>u.start_page||l.end_page<u.end_page;if(o&&!a)return"Merged";if(a&&!o)return"Split";var d=u.end_page-u.start_page+1,v=l.end_page-l.start_page+1;return v>d?"Merged":v<d?"Split":null},o=function(e){switch(null==e?void 0:e.trim().toUpperCase()){case"SPLIT":case"SPLIT_HERE":return"SPLIT_HERE";case"MERGE_NEXT":return"MERGE_NEXT";case"MERGE_PREV":case"MERGE_PREVIOUS":return"MERGE_PREV";case"SET_RANGE":return"SET_RANGE";default:return null}},a=function(e){var r,n=null===(r=e.type)||void 0===r?void 0:r.trim().toLowerCase();return"page_boundary"===n||"page boundary review"===n},d=function(r){var n,t,i,l=(null!==(n=r.review_steps)&&void 0!==n?n:[]).filter(a);return null!==(i=null!==(t=e.__spreadArray([],l,!0).reverse().find(function(e){return null!=u(e.human_action_enum)}))&&void 0!==t?t:e.__spreadArray([],l,!0).reverse().find(_))&&void 0!==i?i:l[l.length-1]},v=function(e){var r,n,t,i,o;return null!==(i=null!==(n=null!==(r=l(e))&&void 0!==r?r:u(e.human_action_enum))&&void 0!==n?n:u(null===(t=e.human_resolution)||void 0===t?void 0:t.action))&&void 0!==i?i:u(null===(o=e.review)||void 0===o?void 0:o.action)},s=function(e,r){var n,t=e.type.trim().toLowerCase();if(!("label"===t||"label review"===t))return!0;var i=null===(n=e.human_resolution)||void 0===n?void 0:n.segment_version,u=r.version;return null==i||null==u||i===u},_=function(e){var r,n,t,i;return null!=u(e.human_action_enum)||null!=u(null===(r=e.human_resolution)||void 0===r?void 0:r.action)||null!=u(null===(n=e.review)||void 0===n?void 0:n.action)||!0===(null===(i=null===(t=e.metadata)||void 0===t?void 0:t.performed_actions)||void 0===i?void 0:i.some(function(e){return null!=u(e.action)}))},c=function(r){var n,t,i,a,v,s,_=d(r);if(!_)return null;var c=o(null===(n=_.human_resolution)||void 0===n?void 0:n.action),p=null===(t=_.human_resolution)||void 0===t?void 0:t.after,g=(null==p?void 0:p.start_page)===r.start_page&&(null==p?void 0:p.end_page)===r.end_page,f=l(_);if(f)return g?f:null;if("SPLIT_HERE"===c)return g?null:"Split";if("MERGE_NEXT"===c||"MERGE_PREV"===c)return g?"Merged":null;var m=function(e,r){var n,t,i,u=e.revert,l=r.revert,o="boundary"===(null===(n=null==u?void 0:u.type)||void 0===n?void 0:n.trim().toLowerCase())?u:"boundary"===(null===(t=null==l?void 0:l.type)||void 0===t?void 0:t.trim().toLowerCase())?l:null;if(!o)return null;var a=null===(i=o.decision)||void 0===i?void 0:i.trim().toUpperCase();if(null==a?void 0:a.includes("SPLIT"))return"Split";if(null==a?void 0:a.includes("MERGE"))return"Merged";if("SET_RANGE"===a){if(o.current_segment_ids.length>o.previous_state.length)return"Split";if(o.current_segment_ids.length<o.previous_state.length)return"Merged"}return null}(_,r);if(m)return m;var E=u(_.human_action_enum);if(E)return E;var R=u(null===(i=_.review)||void 0===i?void 0:i.action);if(R)return R;var h=e.__spreadArray([],null!==(a=r.human_action_log)&&void 0!==a?a:[],!0).filter(function(e){return null!=u(e.action)}).sort(function(e,r){var n,t;return r.human_revision-e.human_revision||(null===(n=r.performed_at)||void 0===n?void 0:n.localeCompare(null!==(t=e.performed_at)&&void 0!==t?t:""))})[0];if(!h)return null;var S=u(h.action),w=(null===(v=h.after)||void 0===v?void 0:v.start_page)===r.start_page&&(null===(s=h.after)||void 0===s?void 0:s.end_page)===r.end_page;return"Split"===S?w?null:S:w?S:null},p=function(e,r){var n,t,i,l,a,v,s=o(r),_=d(e),p=null!==(i=null!==(n=o(null==_?void 0:_.human_action_enum))&&void 0!==n?n:o(null===(t=null==_?void 0:_.human_resolution)||void 0===t?void 0:t.action))&&void 0!==i?i:o(null===(l=null==_?void 0:_.review)||void 0===l?void 0:l.action),g=u(r),f=null===(a=null==_?void 0:_.human_resolution)||void 0===a?void 0:a.after,m="SPLIT_HERE"===s&&null!=(null===(v=null==_?void 0:_.human_resolution)||void 0===v?void 0:v.action)&&(null==f?void 0:f.start_page)===e.start_page&&(null==f?void 0:f.end_page)===e.end_page;return null!=s&&p===s&&null!=g&&(m||c(e)===g)};exports.formatScore=function(e,r){var n=i(e,r);return null==n?"N/A":Number.isInteger(n)?String(n):n.toFixed(2).replace(/\.?0+$/,"")},exports.getBoundaryReviewActionBadgeLabel=function(e,r,n){var t,i;return null!==(i=null!==(t=u(n))&&void 0!==t?t:v(e))&&void 0!==i?i:c(r)},exports.getConfidenceColors=function(e,r,t){var i={border:"#E5E7EB",cardBorder:"#374151",background:"#F9FAFB",text:"#374151",divider:"#D1D5DB"};if(t)return i;var u={border:"#FECACA",cardBorder:"#B91C1C",background:"#FEF2F2",text:"#B91C1C",divider:"#FCA5A5"},l={border:"#d9cda2",cardBorder:"#997800",background:"#fff1bf",text:"#997800",divider:"#e6b400"},o={border:"#16A34A",cardBorder:"#4F9E6C",background:"#F0FDF4",text:"#4F9E6C",divider:"#00A43C"};switch(function(e){var r=null==e?void 0:e.trim().toLowerCase();return"low"===r||"medium"===r||"high"===r?r:null}(r)){case"low":return u;case"medium":return l;case"high":return o}var a=n(e);return null!=a&&a<=40?u:null!=a&&a<=70?l:null!=a?o:i},exports.getFallbackScore=t,exports.getHumanActionBadgeLabel=u,exports.getNumericScore=n,exports.getOptimisticMergeImpactedSegmentKeys=function(n,t){var i=e.__spreadArray([],n,!0).sort(function(e,r){return e.start_page-r.start_page||e.end_page-r.end_page}),u=new Set;return t.forEach(function(e,n){var t=i.findIndex(function(e){return r.getSegmentReviewKey(e)===n});if(!(t<0)){var l=i[t];if(!p(l,e)){var a=o(e),d=i["MERGE_PREV"===a?t-1:"MERGE_NEXT"===a?t+1:-1];d&&u.add(r.getSegmentReviewKey(d))}}}),u},exports.getPendingMergeImpactedSegmentKeys=function(n){var t=e.__spreadArray([],n,!0).sort(function(e,r){return e.start_page-r.start_page||e.end_page-r.end_page}),i=new Set;return t.forEach(function(e,n){var u,l=(null!==(u=e.review_steps)&&void 0!==u?u:[]).find(function(r){var n,t,i;if(!a(r))return!1;var u=o(r.human_action_enum),l=o(null===(n=r.human_resolution)||void 0===n?void 0:n.action),d=null===(t=r.human_resolution)||void 0===t?void 0:t.before,v=null===(i=r.human_resolution)||void 0===i?void 0:i.after,s=null!=(null==d?void 0:d.start_page)&&null!=d.end_page&&null!=(null==v?void 0:v.start_page)&&null!=v.end_page&&(d.start_page!==v.start_page||d.end_page!==v.end_page),_=(null==v?void 0:v.start_page)===e.start_page&&(null==v?void 0:v.end_page)===e.end_page;return("MERGE_NEXT"===u||"MERGE_PREV"===u)&&!(l===u&&s&&_)});if(l){var d=o(l.human_action_enum),v=t["MERGE_PREV"===d?n-1:n+1];v&&i.add(r.getSegmentReviewKey(v))}}),i},exports.getResolvedScore=i,exports.getReviewStepActionBadgeLabel=v,exports.getStructuralResultBadgeLabel=c,exports.getTitleReviewActionBadgeLabel=function(e,r,n){var t=u(n);if(t)return t;var i=v(e);return i||c(r)},exports.hasPolledStructuralAction=p,exports.hasStructuralBoundaryAction=_,exports.isReviewStepResolutionCurrent=s,exports.isReviewStepResolved=function(e,r){var n,t,i;if(!s(e,r))return!1;if(null!=(null===(n=e.review)||void 0===n?void 0:n.action))return!0;var u=null===(i=null===(t=e.human_resolution)||void 0===t?void 0:t.state)||void 0===i?void 0:i.trim().toLowerCase();return"resolved_by_human"===u||"approved"===u||"confirmed"===u},exports.shouldHideStructuralBoundaryReview=function(e,r,n,t){var i=u(t);if("Merged"===i)return n;if("Split"===i)return!0;if(function(e,r){var n,t,i;if("affected"!==(null===(n=r.sensitivity)||void 0===n?void 0:n.trim().toLowerCase()))return!1;var u=null!==(t=e.revert)&&void 0!==t?t:r.revert;if(!u)return!1;var l=null===(i=u.decision)||void 0===i?void 0:i.trim().toUpperCase();return u.current_segment_ids.length>u.previous_state.length&&("SET_RANGE"===l||"SPLIT"===l||"SPLIT_HERE"===l)}(e,r))return!0;var l=v(e);if("Split"===l)return!0;var o=c(r);return"Split"===o||"Merged"===l&&("Merged"!==o||n)};
|
|
2
2
|
//# sourceMappingURL=helper.js.map
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./features/CodeCitation/CodeCitation.js"),t=require("./features/ProjectAccordion/ProjectAccordion.js"),i=require("./features/BookCitation/BookCitation.js"),r=require("./features/Bookemon/Bookemon.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./features/CodeCitation/CodeCitation.js"),t=require("./features/ProjectAccordion/ProjectAccordion.js"),i=require("./features/BookCitation/BookCitation.js"),r=require("./features/Bookemon/Bookemon.js"),o=require("./features/PdfEditorCitation/PdfEditorCitation.js"),n=require("./features/CitationRenderer/CitationRenderer.js"),a=require("./features/CitationRenderer/MarkdownRenderer.js"),s=require("./features/CodeCitation/_components/CodeEditor.js"),u=require("./features/PaginatedTable/PaginatedTable.js"),C=require("./features/CognitiveInternalgptReasoning/CognitiveInternalgptReasoningComponent.js"),p=require("./features/ChatCitation/ChatCitationRenderer.js"),l=require("./features/CognitiveDecisioning/CognitiveDecisioningWrapper.js"),d=require("./features/PdfViewer/PdfViewer.js"),f=require("./features/CognitiveDecisioning/FaqCitation/FaqCitation.js"),x=require("./features/RequirementAiCitations/ImageCitation/ImageCitationContent.js"),g=require("./features/RequirementAiCitations/VideoCitation/VideoCitationContent.js"),m=require("./features/RequirementAiCitations/FileCitation/FileCitationContent.js"),c=require("./features/RequirementAiCitations/WebCitation/WebCitationWithImageContent.js"),q=require("./features/MarkdownWithImageCitation/MarkdownWithImageCitation.js"),j=require("./features/RequirementAiCitations/AiReasoning/AiReasoningCitation.js"),R=require("./features/TableCitation/TableCitationContent.js"),S=require("./features/CitationViewer/CitationsViewer.js"),w=require("./features/ExcelCitation/ExcelCitations.js"),I=require("./features/ScannedDocCitation/ScannedDocCitation.js"),P=require("./features/ChatDrawer/ChatDrawer.js"),T=require("./features/ChatDrawer/constants/ChatDrawer.js"),D=require("./features/SplitterCitations/SplitterCitationsComponent.js"),b=require("./features/DualCitation/SourceBQDataCompnent.js"),A=require("./features/CognitiveCompare/CognitiveCompare.js"),E=require("./features/CognitiveInternalgptReasoning/CognitiveInternalgptCoreComponent.js"),V=require("./features/TextualGuidelines/TextualGuideLinesComponent.js"),W=require("./features/RulebookCitations/RuleBookCitationWrapper.js"),h=require("./features/IngestionStatus/IngestionStatusComponent.js"),B=require("./features/ManageRemainders/ManageReminders.js"),k=require("./features/PromptemonBlockViewer/PromptemonBlockViewer.js"),v=require("./features/PromptemonViewer/PromptemonViewer.js"),F=require("./features/SPBAnalysisPanel/Spbanalysispanel.js"),G=require("./features/GptWebCitation/GptWebCitation.js"),U=require("./hooks/useOnDemandCitationFetch.js"),_=require("./features/InstantLearningCitation/InstantLearningCitationComponent.js"),M=require("./features/BPACitationRenderer/BPACitationRenderer.js"),y=require("./features/GptWebCitation/utils/citationData.utils.js"),L=require("./features/GptWebCitation/types.js");exports.CodeCitation=e.default,exports.ProjectAccordian=t.default,exports.BookCitation=i.default,exports.Bookemon=r.default,exports.PdfCitation=o.PdfEditorCitation,exports.CitationRenderer=n.default,exports.MarkdownRenderer=a.default,Object.defineProperty(exports,"DiagnosticSeverity",{enumerable:!0,get:function(){return s.DiagnosticSeverity}}),exports.PaginatedTable=u.default,exports.InternalgptReasoningComponent=C.default,exports.NonWebReasoningComponent=C.default,exports.ChatCitation=p.default,exports.CognitiveDecisioningCard=l.default,exports.PdfViewer=d.default,exports.FaqCitation=f.default,exports.ImageCitationContent=x.default,exports.VideoCitationContent=g.default,exports.FileCitationContent=m.default,exports.WebCitationWithImageContent=c.default,exports.MarkdownWithImageCitation=q.default,exports.AiReasoningCitation=j.default,exports.TableCitationContent=R.default,exports.CitationsViewer=S.default,exports.ExcelCitation=w.default,exports.ScannedDocCitation=I.default,exports.ChatDrawer=P.default,exports.FILE_INGESTION_STATUS=T.FILE_INGESTION_STATUS,exports.SUMMARY_EXPAND_HEIGHT_NUDGE=T.SUMMARY_EXPAND_HEIGHT_NUDGE,exports.TRUNCATE_THRESHOLD=T.TRUNCATE_THRESHOLD,exports.SplitterCitationsComponent=D.default,exports.SourcesBQCitation=b.SourcesBQCitation,exports.findSourceCitation=b.findSourceCitation,exports.parseSourcesBQHref=b.parseSourcesBQHref,exports.CognitiveCompare=A.default,exports.CognitiveInternalgptCoreComponent=E.default,exports.TextualGuideLinesComponent=V.default,exports.RuleBookCitationWrapper=W.default,exports.IngestionStatusChip=h.IngestionStatusChip,exports.IngestionStatusComponent=h.IngestionStatusComponent,exports.ManageReminders=B.ManageReminders,exports.PromptemonBlockViewer=k.default,exports.PromptemonViewer=v.default,exports.SPBAnalysisPanel=F.default,exports.GptWebCitation=G.default,exports.useOnDemandCitationFetch=U.useOnDemandCitationFetch,exports.InstantLearningCitationWrapper=_.default,exports.BPACitationRenderer=M.default,exports.extractLearnedFromUrl=y.extractLearnedFromUrl,exports.extractRelevanceScoreFromContent=y.extractRelevanceScoreFromContent,exports.extractTopicFromContent=y.extractTopicFromContent,exports.getWebCitationImageUrl=y.getWebCitationImageUrl,exports.mapCitationDataToDisplay=y.mapCitationDataToDisplay,exports.resolveSkeletonVisitUrl=y.resolveSkeletonVisitUrl,exports.sanitizeExternalUrl=y.sanitizeExternalUrl,Object.defineProperty(exports,"CitationType",{enumerable:!0,get:function(){return L.CitationType}}),exports.allowsGptCitationView=L.allowsGptCitationView,exports.allowsWebCitationView=L.allowsWebCitationView,exports.showsCitationViewToggle=L.showsCitationViewToggle;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as i,__awaiter as n,__generator as t}from"tslib";import{jsxs as o,jsx as e,Fragment as l}from"react/jsx-runtime";import{Globe as r,ChevronUp as a,ChevronDown as d,Maximize2 as u,X as c,ExternalLink as s}from"lucide-react";import{useState as v,useEffect as p,useMemo as m,useRef as h}from"react";import g from"./ResizableSplitPane.js";import f from"../PdfViewer/PdfViewer.js";import{DefaultFullScreenCloseIcon as b,DefaultFullScreenIcon as x}from"../../assests/svg/PdfViewerIcons.js";import _ from"react-markdown";import y from"rehype-raw";import{Dialog as w,Box as C}from"@mui/material";import{SHARED_MARKDOWN_STYLES as F}from"./CognitiveCompareConfig.js";import"react-dom";import{useCompareContext as D}from"./CompareContext.js";import{processGuidelinesMarkdown as P}from"./Guidelines/utils/processGuidelinesMarkdown.js";import T from"../GptWebCitation/GptWebCitation.js";import{CitationType as S}from"../GptWebCitation/types.js";import"./MoreFunctionsPopup.js";import"./components/SubSectionAccordion.js";import"./components/LHSSectionRow.js";import"./components/RHSSectionRow.js";var k=function(i){var n,t,o;return(null===(o=null===(t=null===(n=(null==i?void 0:i.extraMetaData)||i)||void 0===n?void 0:n.aiReasoningCitation)||void 0===t?void 0:t.gpt_citation)||void 0===o?void 0:o[0])||null},N="https://dev-proposals-ai.techo.camp/utility/ca-workflow-composer-agent/get_citation",j="sai.siddhartha@techolution.com",I="672e32f7a0e8fe2e8e50bcba",R="TNV Sai Siddhartha",G="90vh",U="calc(".concat(G," - 120px)"),E=function(){var i;return"function"==typeof(null===(i=globalThis.crypto)||void 0===i?void 0:i.randomUUID)?globalThis.crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(i){var n=Math.floor(16*Math.random());return("x"===i?n:n%4+8).toString(16)})},M=function(i,n){var t=function(i){var n;return(null==i?void 0:i.payloadCitationId)||(null===(n=null==i?void 0:i.extraMetaData)||void 0===n?void 0:n.payloadCitationId)||""}(i)||n||E();return function(i,n){i&&"object"==typeof i&&(i.payloadCitationId=n,i.extraMetaData&&"object"==typeof i.extraMetaData&&(i.extraMetaData.payloadCitationId=n))}(i,t),t},A=function(o){var l,r=o.metaData,g=o.isFullscreen,f=void 0!==g&&g,b=D().gptWebCitationConfig,x=m(function(){return function(i){return{endpoint:(null==i?void 0:i.endpoint)||N,userEmail:(null==i?void 0:i.userEmail)||j,userId:(null==i?void 0:i.userId)||I,userName:(null==i?void 0:i.userName)||R,headers:null==i?void 0:i.headers}}(b)},[b]),_=null==r?void 0:r.webGpt,y=h(null);y.current||(y.current=E());var w=m(function(){return function(i,n,t){var o,e,l=k(i),r=(null==l?void 0:l.customMetaData)||{},a=(null==r?void 0:r.value)||{},d=(null==i?void 0:i.webSearchAnswer)||{},u=(null==i?void 0:i.extraMetaData)||i||{};return{userEmail:(null==i?void 0:i.userEmail)||(null==d?void 0:d.userEmail)||(null==n?void 0:n.userEmail)||"",userId:(null==i?void 0:i.userId)||(null==d?void 0:d.userId)||(null==n?void 0:n.userId)||"",userName:(null==i?void 0:i.userName)||(null==d?void 0:d.userName)||(null==n?void 0:n.userName)||"",citationId:M(i,t),citationUrl:(null==a?void 0:a.citationUrl)||(null==d?void 0:d.citationUrl)||"",content:(null==u?void 0:u.Reasoning)||(null==d?void 0:d.enhanced_content)||"",citationType:(null==a?void 0:a.citationType)||"web",citatioNumber:null!==(e=null!==(o=null==r?void 0:r.citation_number)&&void 0!==o?o:null==l?void 0:l.citation_number)&&void 0!==e?e:Number((null==i?void 0:i.reasoningId)||0)}}(_,x,y.current||void 0)},[_,x]),C=m(function(){return k(_)},[_]),F=(null===(l=null==C?void 0:C.customMetaData)||void 0===l?void 0:l.value)||{},P=(null==_?void 0:_.extraMetaData)||_||{},G=v(),A=G[0],H=G[1],W=v("pending"),z=W[0],O=W[1],V=v(!0),B=V[0],L=V[1];p(function(){var o=!0;return n(void 0,void 0,void 0,function(){var n,e,l,r;return t(this,function(t){switch(t.label){case 0:if(!x.endpoint||!(null==w?void 0:w.citationUrl)||!(null==w?void 0:w.content))return O("error"),[2];O("pending"),t.label=1;case 1:return t.trys.push([1,4,,5]),[4,fetch(x.endpoint,{method:"POST",headers:i({"actor-id":w.userEmail,Accept:"application/json, text/plain, */*","Content-Type":"application/json"},x.headers||{}),body:JSON.stringify(w)})];case 2:if(!(n=t.sent()).ok)throw new Error("Failed to fetch GPT web citation (".concat(n.status,")"));return[4,n.json()];case 3:return e=t.sent(),l=(null==e?void 0:e.responseData)||(null==e?void 0:e.result)||(null==e?void 0:e.data)||e,o?(H(l),O("success"),[3,5]):[2];case 4:return r=t.sent(),o?(console.error("Failed to load GPT web citation",r),O("error"),[3,5]):[2];case 5:return[2]}})}),function(){o=!1}},[w,x]);var J=m(function(){return{item:{confidence_score:Number((null==P?void 0:P.Confidence_score)||0),text:(null==F?void 0:F.paraphrase)||"Web citation reasoning",dataSource:(null==F?void 0:F.text)||(null==P?void 0:P.Reasoning)||"",paraphrase:(null==F?void 0:F.paraphrase)||""},headerTitle:"GPT Web Citation",index:Number((null==w?void 0:w.citatioNumber)||1)-1,iconsConfig:{ChevronDownIcon:d,ChevronUpIcon:a,MaximizeIcon:u,CloseIcon:c}}},[F,null==w?void 0:w.citatioNumber,P]),$=m(function(){return i(i({},J),f?{bodyHeight:U}:{})},[J,f]);return e(T,{gptCitation:$,defaultCitationUrl:(null==w?void 0:w.citationUrl)||"",citationType:S.GPT_WEB,webCitationData:A,webCitationStatus:z,showWebCitation:B,onToggleCitationView:function(){return L(function(i){return!i})},iconsConfig:{MaximizeIcon:u,ExternalLinkIcon:s},isFixedHeight:!0})},H=function(n){var t,o,r,a,d,u,c,s=n.href,v=n.metaData,p=n.citationTitle,h=n.citationType,b=n.citationReason,x=n.isFullscreen,w=D().guidelinesData,T=function(i){try{var n=function(i){var n=i.match(/^(?:pdf_citation|deviation_summary)\$(\d+)/);if(n)try{var t=i.indexOf("?"),o=t>=0?i.slice(t):"";return{citationNumber:n[1],parsedUrl:new URL(o||"./",window.location.origin)}}catch(i){return{citationNumber:n[1],parsedUrl:null}}try{var e=new URL(i,window.location.origin);return{citationNumber:e.searchParams.get("citationNumber")||e.searchParams.get("citation_number"),parsedUrl:e}}catch(i){return{citationNumber:null,parsedUrl:null}}}(i),t=n.citationNumber,o=n.parsedUrl;return{citationNumber:t,phraseToHighlight:(null==o?void 0:o.searchParams.get("phrase_to_highlight"))||null,citationTypeFromHref:(null==o?void 0:o.searchParams.get("citation_type"))||null}}catch(i){return{citationNumber:null,phraseToHighlight:null,citationTypeFromHref:null}}}(s),S=T.citationNumber,k=T.phraseToHighlight,N=T.citationTypeFromHref,j=h||N||void 0,I="il_rulebook_citation"===j?"rulebook_citation":j,R=S&&(null===(t=null==v?void 0:v.citations)||void 0===t?void 0:t[S])||{},G=(null===(o=null==v?void 0:v.docData)||void 0===o?void 0:o.documents)||{},U=(null===(r=null==v?void 0:v.docData)||void 0===r?void 0:r.input_index_map)||{},E=Object.keys((null==v?void 0:v.citations)||{}).length>0||Object.keys((null==v?void 0:v.docData)||{}).length>0,M=null==U?void 0:U[0],H=null==U?void 0:U[1],W=M?G[M]:null,z=H?G[H]:null,O=M?R[M]:null,V=H?R[H]:null,B=m(function(){var i,n,t,o;return O&&W?e(f,{defaultScale:"PageWidth",showFullScreenAction:!1,showHighlightsAction:!1,pdfName:null==W?void 0:W.title,pdfUrl:null==W?void 0:W.signed_url,highlightText:[null!==(i=null==O?void 0:O.highlighted_text)&&void 0!==i?i:""],highlightPages:{1:null===(n=null==O?void 0:O.custom_metadata)||void 0===n?void 0:n.pdf_start_page_number},jumpToPageValue:1,highlightCordinatePages:[],useCoordinates:!1,useRange:!0,rangeOfPages:[null===(t=null==O?void 0:O.custom_metadata)||void 0===t?void 0:t.pdf_start_page_number,null===(o=null==O?void 0:O.custom_metadata)||void 0===o?void 0:o.pdf_end_page_number]}):null},[null==W?void 0:W.title,null==W?void 0:W.signed_url,null==O?void 0:O.highlighted_text,null===(a=null==O?void 0:O.custom_metadata)||void 0===a?void 0:a.pdf_start_page_number,null===(d=null==O?void 0:O.custom_metadata)||void 0===d?void 0:d.pdf_end_page_number]),L=m(function(){var i,n,t,o;return V&&z?e(f,{defaultScale:"PageWidth",showFullScreenAction:!1,showHighlightsAction:!1,pdfName:null==z?void 0:z.title,pdfUrl:null==z?void 0:z.signed_url,jumpToPageValue:1,highlightText:[null!==(i=null==V?void 0:V.highlighted_text)&&void 0!==i?i:""],highlightPages:{1:null===(n=null==V?void 0:V.custom_metadata)||void 0===n?void 0:n.pdf_start_page_number},highlightCordinatePages:[],useCoordinates:!1,useRange:!0,rangeOfPages:[null===(t=null==V?void 0:V.custom_metadata)||void 0===t?void 0:t.pdf_start_page_number,null===(o=null==V?void 0:V.custom_metadata)||void 0===o?void 0:o.pdf_end_page_number]}):null},[null==z?void 0:z.title,null==z?void 0:z.signed_url,null==V?void 0:V.highlighted_text,null===(u=null==V?void 0:V.custom_metadata)||void 0===u?void 0:u.pdf_start_page_number,null===(c=null==V?void 0:V.custom_metadata)||void 0===c?void 0:c.pdf_end_page_number]),J="dual_citation"===I,$=J&&!!(null==v?void 0:v.webGpt),q=m(function(){if(!B)return null;var n=$?e(A,{metaData:v,isFullscreen:x}):"rulebook_citation"===I?e(l,{children:e(C,i({sx:i(i({padding:"0px 20px",backgroundColor:"#FFFFFF",borderRadius:"8px"},F),{overflow:"auto"})},{children:e(_,i({rehypePlugins:[y]},{children:P({guidelinesData:w,targetHighlights:[k],labelColor:"#FEF08A"})}))}))}):L;return n?e(g,{leftComponent:B,rightComponent:n,isFullscreen:x}):B},[B,L,I,$,v,x,w,k]);return(null==v?void 0:v.webGpt)&&!E?e(A,{metaData:v,isFullscreen:x}):S?"rulebook_citation"===I?e("div",O?i({style:{height:"100%",display:"flex",flexDirection:"column"}},{children:q}):i({style:{padding:"12px",fontSize:"13px",color:"#344054",lineHeight:1.5}},{children:b||"Rulebook citation selected."})):J?O||V?e("div",i({style:{height:"100%",display:"flex",flexDirection:"column"}},{children:q})):(null==v?void 0:v.webGpt)?e(A,{metaData:v,isFullscreen:x}):e("div",{children:"Missing PDF Citation. Please try again later"}):["contract","clause"].includes(p)?e("div",O||V?i({style:{height:"100%",display:"flex",flexDirection:"column"}},{children:q}):{children:"Missing PDF Citation. Please try again later"}):e("div",{children:"No Citation Found. Please try again later"}):null},W=function(n){var t,l,u,c,s,m,h,g=n.href,f=n.children,_=n.citationType,y=n.citationReason,C=n.metaData,F=n.chevronUpComponent,D=void 0===F?null:F,P=n.chevronDownComponent,T=void 0===P?null:P,S=n.customStyle,k=void 0===S?{}:S,N=n.defaultState,j=void 0!==N&&N,I=n.onFullscreenChange,R=v(j),U=R[0],E=R[1],M=v(!1),A=M[0],W=M[1],z="string"==typeof f&&(null===(t=null==f?void 0:f.split("\n"))||void 0===t?void 0:t.length)>1?f.split("\n").join(" "):f;p(function(){if(null==I||I(A),A)return function(){null==I||I(!1)}},[A,I]);var O="string"==typeof f?f:f[0],V=null!=D?D:function(i){var n,t;return e(a,{size:null!==(n=null==i?void 0:i.fontSize)&&void 0!==n?n:16,color:null!==(t=null==i?void 0:i.color)&&void 0!==t?t:"rgb(214, 51, 132)"})}(null!==(l=null==k?void 0:k.arrow)&&void 0!==l?l:{}),B=null!=T?T:function(i){var n,t;return e(d,{size:null!==(n=null==i?void 0:i.fontSize)&&void 0!==n?n:16,color:null!==(t=null==i?void 0:i.color)&&void 0!==t?t:"rgb(214, 51, 132)"})}(null!==(u=null==k?void 0:k.arrow)&&void 0!==u?u:{}),L=o("div",i({style:{boxSizing:"border-box",border:A?"none":"1px solid #E4E7EC",borderRadius:A?0:"8px",overflow:"hidden",marginTop:A?0:"8px",display:"flex",flexDirection:"column",width:"100%",height:A?"100%":void 0,backgroundColor:"#FAFAFA"}},{children:[e("div",i({style:{display:"flex",justifyContent:"flex-end",padding:"6px 10px",borderBottom:"1px solid #E4E7EC",backgroundColor:"#FFFFFF",flexShrink:0}},{children:e("button",i({onClick:function(){W(function(i){return!i})},style:{background:"none",border:"none",cursor:"pointer",padding:"4px",borderRadius:"6px",color:"#475467",marginRight:"9px"}},{children:e(A?b:x,{})}))})),e("div",i({style:{flex:1,minHeight:0,height:"100%",overflow:"hidden"}},{children:e(H,{href:g,children:f,metaData:C,citationTitle:O,citationType:_,citationReason:y,isFullscreen:A})}))]}));return o("span",i({style:i({display:"inline"},k.relativeWrapper||{})},{children:[e("div",i({style:i({display:"inline",marginTop:0},k.citationButtonWrapper||{})},{children:o("button",i({type:"button",onClick:function(){return E(function(i){return!i})},style:i({display:(null==C?void 0:C.webGpt)?"inline":"inline-flex",alignItems:(null==C?void 0:C.webGpt)?void 0:"center",gap:(null==C?void 0:C.webGpt)?void 0:"3px",fontFamily:'"Inter", sans-serif',backgroundColor:"transparent",padding:0,margin:0,fontSize:"13px",borderRadius:9999,cursor:"pointer",fontWeight:(null==C?void 0:C.webGpt)?600:700,color:(null==C?void 0:C.webGpt)?"#6D28D9":"rgb(214, 51, 132)",border:"none",textDecoration:"none",wordBreak:"break-word",whiteSpace:"normal"},k.citationButton||{})},{children:[(null==C?void 0:C.webGpt)&&e(r,{size:null!==(s=null===(c=k.arrow)||void 0===c?void 0:c.fontSize)&&void 0!==s?s:"1em",color:null!==(h=null===(m=k.arrow)||void 0===m?void 0:m.color)&&void 0!==h?h:"#6D28D9",style:{display:"inline-block",width:"1em",height:"1em",marginRight:"3px",verticalAlign:"-0.125em",flexShrink:0}}),e("span",{children:z}),e("span",i({style:{display:"inline-flex",alignItems:"center",marginLeft:(null==C?void 0:C.webGpt)?"3px":void 0,verticalAlign:(null==C?void 0:C.webGpt)?"-0.125em":void 0}},{children:U?V:B}))]}))})),U&&(A?e(w,i({open:A,onClose:function(){return W(!1)},maxWidth:!1,BackdropProps:{sx:{backgroundColor:"rgba(0, 0, 0, 0.6)",backdropFilter:"blur(4px)"}},PaperProps:{sx:{backgroundColor:"#FAFAFA",borderRadius:"16px",height:G,m:0,maxHeight:G,maxWidth:"95vw",overflow:"hidden",width:"95vw"}}},{children:L})):L)]}))};export{W as default};
|
|
1
|
+
import{__assign as i,__awaiter as n,__generator as e}from"tslib";import{jsxs as o,jsx as t,Fragment as l}from"react/jsx-runtime";import{Globe as r,ChevronUp as a,ChevronDown as u,Maximize2 as d,X as c,ExternalLink as s}from"lucide-react";import{useState as v,useEffect as p,useMemo as m,useRef as h}from"react";import g from"./ResizableSplitPane.js";import f from"../PdfViewer/PdfViewer.js";import{DefaultFullScreenCloseIcon as b,DefaultFullScreenIcon as x}from"../../assests/svg/PdfViewerIcons.js";import _ from"react-markdown";import y from"rehype-raw";import{Dialog as w,Box as C}from"@mui/material";import"./utils/normalizeRedlineMarkdown.js";import{SHARED_MARKDOWN_STYLES as F}from"./CognitiveCompareConfig.js";import"react-dom";import{useCompareContext as D}from"./CompareContext.js";import{processGuidelinesMarkdown as P}from"./Guidelines/utils/processGuidelinesMarkdown.js";import T from"../GptWebCitation/GptWebCitation.js";import{CitationType as S}from"../GptWebCitation/types.js";import"./MoreFunctionsPopup.js";import"./components/SubSectionAccordion.js";import"./components/LHSSectionRow.js";import"./components/RHSSectionRow.js";var k=function(i){var n,e,o;return(null===(o=null===(e=null===(n=(null==i?void 0:i.extraMetaData)||i)||void 0===n?void 0:n.aiReasoningCitation)||void 0===e?void 0:e.gpt_citation)||void 0===o?void 0:o[0])||null},N="https://dev-proposals-ai.techo.camp/utility/ca-workflow-composer-agent/get_citation",j="sai.siddhartha@techolution.com",I="672e32f7a0e8fe2e8e50bcba",R="TNV Sai Siddhartha",G="90vh",U="calc(".concat(G," - 120px)"),M=function(){var i;return"function"==typeof(null===(i=globalThis.crypto)||void 0===i?void 0:i.randomUUID)?globalThis.crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(i){var n=Math.floor(16*Math.random());return("x"===i?n:n%4+8).toString(16)})},E=function(i,n){var e=function(i){var n;return(null==i?void 0:i.payloadCitationId)||(null===(n=null==i?void 0:i.extraMetaData)||void 0===n?void 0:n.payloadCitationId)||""}(i)||n||M();return function(i,n){i&&"object"==typeof i&&(i.payloadCitationId=n,i.extraMetaData&&"object"==typeof i.extraMetaData&&(i.extraMetaData.payloadCitationId=n))}(i,e),e},A=function(o){var l,r=o.metaData,g=o.isFullscreen,f=void 0!==g&&g,b=o.onFullscreenChange,x=D().gptWebCitationConfig,_=m(function(){return function(i){return{endpoint:(null==i?void 0:i.endpoint)||N,userEmail:(null==i?void 0:i.userEmail)||j,userId:(null==i?void 0:i.userId)||I,userName:(null==i?void 0:i.userName)||R,headers:null==i?void 0:i.headers}}(x)},[x]),y=null==r?void 0:r.webGpt,w=h(null);w.current||(w.current=M());var C=m(function(){return function(i,n,e){var o,t,l=k(i),r=(null==l?void 0:l.customMetaData)||{},a=(null==r?void 0:r.value)||{},u=(null==i?void 0:i.webSearchAnswer)||{},d=(null==i?void 0:i.extraMetaData)||i||{};return{userEmail:(null==i?void 0:i.userEmail)||(null==u?void 0:u.userEmail)||(null==n?void 0:n.userEmail)||"",userId:(null==i?void 0:i.userId)||(null==u?void 0:u.userId)||(null==n?void 0:n.userId)||"",userName:(null==i?void 0:i.userName)||(null==u?void 0:u.userName)||(null==n?void 0:n.userName)||"",citationId:E(i,e),citationUrl:(null==a?void 0:a.citationUrl)||(null==u?void 0:u.citationUrl)||"",content:(null==d?void 0:d.Reasoning)||(null==u?void 0:u.enhanced_content)||"",citationType:(null==a?void 0:a.citationType)||"web",citatioNumber:null!==(t=null!==(o=null==r?void 0:r.citation_number)&&void 0!==o?o:null==l?void 0:l.citation_number)&&void 0!==t?t:Number((null==i?void 0:i.reasoningId)||0)}}(y,_,w.current||void 0)},[y,_]),F=m(function(){return k(y)},[y]),P=(null===(l=null==F?void 0:F.customMetaData)||void 0===l?void 0:l.value)||{},G=(null==y?void 0:y.extraMetaData)||y||{},A=v(),H=A[0],W=A[1],z=v("pending"),B=z[0],O=z[1],V=v(!0),L=V[0],J=V[1];p(function(){var o=!0;return n(void 0,void 0,void 0,function(){var n,t,l,r;return e(this,function(e){switch(e.label){case 0:if(!_.endpoint||!(null==C?void 0:C.citationUrl)||!(null==C?void 0:C.content))return O("error"),[2];O("pending"),e.label=1;case 1:return e.trys.push([1,4,,5]),[4,fetch(_.endpoint,{method:"POST",headers:i({"actor-id":C.userEmail,Accept:"application/json, text/plain, */*","Content-Type":"application/json"},_.headers||{}),body:JSON.stringify(C)})];case 2:if(!(n=e.sent()).ok)throw new Error("Failed to fetch GPT web citation (".concat(n.status,")"));return[4,n.json()];case 3:return t=e.sent(),l=(null==t?void 0:t.responseData)||(null==t?void 0:t.result)||(null==t?void 0:t.data)||t,o?(W(l),O("success"),[3,5]):[2];case 4:return r=e.sent(),o?(console.error("Failed to load GPT web citation",r),O("error"),[3,5]):[2];case 5:return[2]}})}),function(){o=!1}},[C,_]);var Y=m(function(){return{item:{confidence_score:Number((null==G?void 0:G.Confidence_score)||0),text:(null==P?void 0:P.paraphrase)||"Web citation reasoning",dataSource:(null==P?void 0:P.text)||(null==G?void 0:G.Reasoning)||"",paraphrase:(null==P?void 0:P.paraphrase)||""},headerTitle:"GPT Web Citation",index:Number((null==C?void 0:C.citatioNumber)||1)-1,iconsConfig:{ChevronDownIcon:u,ChevronUpIcon:a,MaximizeIcon:d,CloseIcon:c}}},[P,null==C?void 0:C.citatioNumber,G]),$=m(function(){return i(i({},Y),f?{bodyHeight:U}:{})},[Y,f]);return t("div",i({style:{overflowY:"auto"}},{children:t(T,{gptCitation:$,defaultCitationUrl:(null==C?void 0:C.citationUrl)||"",citationType:S.GPT_WEB,webCitationData:H,webCitationStatus:B,showWebCitation:L,onToggleCitationView:function(){return J(function(i){return!i})},iconsConfig:{MaximizeIcon:d,ExternalLinkIcon:s},showGptMaximizeButton:!1,useParentHeight:!0,onFullscreenChange:b})}))},H=function(n){var e,o,r,a,u,d,c,s=n.href,v=n.metaData,p=n.citationTitle,h=n.citationType,b=n.citationReason,x=n.isFullscreen,w=n.onFullscreenChange,T=D().guidelinesData,S=function(i){try{var n=function(i){var n=i.match(/^(?:pdf_citation|deviation_summary)\$(\d+)/);if(n)try{var e=i.indexOf("?"),o=e>=0?i.slice(e):"";return{citationNumber:n[1],parsedUrl:new URL(o||"./",window.location.origin)}}catch(i){return{citationNumber:n[1],parsedUrl:null}}try{var t=new URL(i,window.location.origin);return{citationNumber:t.searchParams.get("citationNumber")||t.searchParams.get("citation_number"),parsedUrl:t}}catch(i){return{citationNumber:null,parsedUrl:null}}}(i),e=n.citationNumber,o=n.parsedUrl;return{citationNumber:e,phraseToHighlight:(null==o?void 0:o.searchParams.get("phrase_to_highlight"))||null,citationTypeFromHref:(null==o?void 0:o.searchParams.get("citation_type"))||null}}catch(i){return{citationNumber:null,phraseToHighlight:null,citationTypeFromHref:null}}}(s),k=S.citationNumber,N=S.phraseToHighlight,j=S.citationTypeFromHref,I=h||j||void 0,R="il_rulebook_citation"===I?"rulebook_citation":I,G=k&&(null===(e=null==v?void 0:v.citations)||void 0===e?void 0:e[k])||{},U=(null===(o=null==v?void 0:v.docData)||void 0===o?void 0:o.documents)||{},M=(null===(r=null==v?void 0:v.docData)||void 0===r?void 0:r.input_index_map)||{},E=Object.keys((null==v?void 0:v.citations)||{}).length>0||Object.keys((null==v?void 0:v.docData)||{}).length>0,H=null==M?void 0:M[0],W=null==M?void 0:M[1],z=H?U[H]:null,B=W?U[W]:null,O=H?G[H]:null,V=W?G[W]:null,L=m(function(){var i,n,e,o;return O&&z?t(f,{defaultScale:"PageWidth",showFullScreenAction:!1,showHighlightsAction:!1,pdfName:null==z?void 0:z.title,pdfUrl:null==z?void 0:z.signed_url,highlightText:[null!==(i=null==O?void 0:O.highlighted_text)&&void 0!==i?i:""],highlightPages:{1:null===(n=null==O?void 0:O.custom_metadata)||void 0===n?void 0:n.pdf_start_page_number},jumpToPageValue:1,highlightCordinatePages:[],useCoordinates:!1,useRange:!0,rangeOfPages:[null===(e=null==O?void 0:O.custom_metadata)||void 0===e?void 0:e.pdf_start_page_number,null===(o=null==O?void 0:O.custom_metadata)||void 0===o?void 0:o.pdf_end_page_number]}):null},[null==z?void 0:z.title,null==z?void 0:z.signed_url,null==O?void 0:O.highlighted_text,null===(a=null==O?void 0:O.custom_metadata)||void 0===a?void 0:a.pdf_start_page_number,null===(u=null==O?void 0:O.custom_metadata)||void 0===u?void 0:u.pdf_end_page_number]),J=m(function(){var i,n,e,o;return V&&B?t(f,{defaultScale:"PageWidth",showFullScreenAction:!1,showHighlightsAction:!1,pdfName:null==B?void 0:B.title,pdfUrl:null==B?void 0:B.signed_url,jumpToPageValue:1,highlightText:[null!==(i=null==V?void 0:V.highlighted_text)&&void 0!==i?i:""],highlightPages:{1:null===(n=null==V?void 0:V.custom_metadata)||void 0===n?void 0:n.pdf_start_page_number},highlightCordinatePages:[],useCoordinates:!1,useRange:!0,rangeOfPages:[null===(e=null==V?void 0:V.custom_metadata)||void 0===e?void 0:e.pdf_start_page_number,null===(o=null==V?void 0:V.custom_metadata)||void 0===o?void 0:o.pdf_end_page_number]}):null},[null==B?void 0:B.title,null==B?void 0:B.signed_url,null==V?void 0:V.highlighted_text,null===(d=null==V?void 0:V.custom_metadata)||void 0===d?void 0:d.pdf_start_page_number,null===(c=null==V?void 0:V.custom_metadata)||void 0===c?void 0:c.pdf_end_page_number]),Y="dual_citation"===R,$=Y&&!!(null==v?void 0:v.webGpt),q=m(function(){var n=$?t(A,{metaData:v,isFullscreen:x,onFullscreenChange:w}):"rulebook_citation"===R?t(l,{children:t(C,i({sx:i(i({padding:"0px 20px",backgroundColor:"#FFFFFF",borderRadius:"8px"},F),{overflow:"auto"})},{children:t(_,i({rehypePlugins:[y]},{children:P({guidelinesData:T,targetHighlights:[N],labelColor:"#FEF08A"})}))}))}):J;return t(g,{leftComponent:L,rightComponent:n,isFullscreen:x})},[L,J,R,$,v,x,T,N,w]);return(null==v?void 0:v.webGpt)&&!E?t(A,{metaData:v,isFullscreen:x,onFullscreenChange:w}):k?"rulebook_citation"===R?t("div",O?i({style:{height:"100%",display:"flex",flexDirection:"column"}},{children:q}):i({style:{padding:"12px",fontSize:"13px",color:"#344054",lineHeight:1.5}},{children:b||"Rulebook citation selected."})):Y?O||V?t("div",i({style:{height:"100%",display:"flex",flexDirection:"column"}},{children:q})):(null==v?void 0:v.webGpt)?t(A,{metaData:v,isFullscreen:x,onFullscreenChange:w}):t("div",{children:"Missing PDF Citation. Please try again later"}):["contract","clause"].includes(p)?t("div",O||V?i({style:{height:"100%",display:"flex",flexDirection:"column"}},{children:q}):{children:"Missing PDF Citation. Please try again later"}):t("div",{children:"No Citation Found. Please try again later"}):null},W=function(n){var e,l,d,c,s,m,h,g=n.href,f=n.children,_=n.citationType,y=n.citationReason,C=n.metaData,F=n.chevronUpComponent,D=void 0===F?null:F,P=n.chevronDownComponent,T=void 0===P?null:P,S=n.customStyle,k=void 0===S?{}:S,N=n.defaultState,j=void 0!==N&&N,I=n.onFullscreenChange,R=v(j),U=R[0],M=R[1],E=v(!1),A=E[0],W=E[1],z="string"==typeof f&&(null===(e=null==f?void 0:f.split("\n"))||void 0===e?void 0:e.length)>1?f.split("\n").join(" "):f;p(function(){if(null==I||I(A),A)return function(){null==I||I(!1)}},[A,I]);var B="string"==typeof f?f:f[0],O=null!=D?D:function(i){var n,e;return t(a,{size:null!==(n=null==i?void 0:i.fontSize)&&void 0!==n?n:16,color:null!==(e=null==i?void 0:i.color)&&void 0!==e?e:"rgb(214, 51, 132)"})}(null!==(l=null==k?void 0:k.arrow)&&void 0!==l?l:{}),V=null!=T?T:function(i){var n,e;return t(u,{size:null!==(n=null==i?void 0:i.fontSize)&&void 0!==n?n:16,color:null!==(e=null==i?void 0:i.color)&&void 0!==e?e:"rgb(214, 51, 132)"})}(null!==(d=null==k?void 0:k.arrow)&&void 0!==d?d:{}),L=o("div",i({style:{boxSizing:"border-box",border:A?"none":"1px solid #E4E7EC",borderRadius:A?0:"8px",overflow:"hidden",marginTop:A?0:"8px",display:"flex",flexDirection:"column",width:"100%",height:A?"100%":void 0,backgroundColor:"#FAFAFA"}},{children:[t("div",i({style:{display:"flex",justifyContent:"flex-end",padding:"6px 10px",borderBottom:"1px solid #E4E7EC",backgroundColor:"#FFFFFF",flexShrink:0}},{children:t("button",i({onClick:function(){W(function(i){var n=!i;return null==I||I(n),n})},style:{background:"none",border:"none",cursor:"pointer",padding:"4px",borderRadius:"6px",color:"#475467",marginRight:"9px"}},{children:t(A?b:x,{})}))})),t("div",i({style:{flex:1,minHeight:0,height:"100%",overflow:"hidden"}},{children:t(H,{href:g,children:f,metaData:C,citationTitle:B,citationType:_,citationReason:y,isFullscreen:A,onFullscreenChange:I})}))]}));return o("span",i({style:i({display:"inline"},k.relativeWrapper||{})},{children:[t("div",i({style:i({display:"inline",marginTop:0},k.citationButtonWrapper||{})},{children:o("button",i({type:"button",onClick:function(){return M(function(i){return!i})},style:i({display:(null==C?void 0:C.webGpt)?"inline":"inline-flex",alignItems:(null==C?void 0:C.webGpt)?void 0:"center",gap:(null==C?void 0:C.webGpt)?void 0:"3px",fontFamily:'"Inter", sans-serif',backgroundColor:"transparent",padding:0,margin:0,fontSize:"13px",borderRadius:9999,cursor:"pointer",fontWeight:(null==C?void 0:C.webGpt)?600:700,color:(null==C?void 0:C.webGpt)?"#6D28D9":"rgb(214, 51, 132)",border:"none",textDecoration:"none",wordBreak:"break-word",whiteSpace:"normal"},k.citationButton||{})},{children:[(null==C?void 0:C.webGpt)&&t(r,{size:null!==(s=null===(c=k.arrow)||void 0===c?void 0:c.fontSize)&&void 0!==s?s:"1em",color:null!==(h=null===(m=k.arrow)||void 0===m?void 0:m.color)&&void 0!==h?h:"#6D28D9",style:{display:"inline-block",width:"1em",height:"1em",marginRight:"3px",verticalAlign:"-0.125em",flexShrink:0}}),t("span",{children:z}),t("span",i({style:{display:"inline-flex",alignItems:"center",marginLeft:(null==C?void 0:C.webGpt)?"3px":void 0,verticalAlign:(null==C?void 0:C.webGpt)?"-0.125em":void 0}},{children:U?O:V}))]}))})),U&&(A?t(w,i({open:A,onClose:function(){W(!1),null==I||I(!1)},maxWidth:!1,BackdropProps:{sx:{backgroundColor:"rgba(0, 0, 0, 0.6)",backdropFilter:"blur(4px)"}},PaperProps:{sx:{backgroundColor:"#FAFAFA",borderRadius:"16px",height:G,m:0,maxHeight:G,maxWidth:"95vw",overflow:"hidden",width:"95vw"}}},{children:L})):L)]}))};export{W as default};
|
|
2
2
|
//# sourceMappingURL=CitationAnchor.js.map
|