"use strict";(self.webpackChunk_mlflow_mlflow=self.webpackChunk_mlflow_mlflow||[]).push([[4369],{4369:function(e,t,a){a.r(t),a.d(t,{default:function(){return P}});var r=a(46709),n=a(47941),s=a(27472),o=a(73337),i=a(27299),d=a(27757),l=a(65765),c=a(11522),h=a(77153),u=a(38975),g=a(71055),p=a(36961);var f=a(73408);n.GlobalWorkerOptions.workerSrc=new URL(a(75387),a.b).toString();class m extends r.Component{constructor(...e){super(...e),this.state={loading:!0,error:void 0,pdfData:void 0,currentPage:1,numPages:1},this.onDocumentLoadSuccess=({numPages:e})=>{this.setState({numPages:e})},this.onDocumentLoadError=e=>{c.A.logErrorAndNotifyUser(new h.s(e))},this.onPageChange=(e,t)=>{this.setState({currentPage:e})},this.renderPdf=()=>(0,f.Y)(r.Fragment,{children:(0,f.FD)("div",{className:"mlflow-pdf-viewer",children:[(0,f.Y)("div",{className:"mlflow-paginator",children:(0,f.Y)(i.Pagination,{simple:!0,currentPageIndex:this.state.currentPage,numTotal:this.state.numPages,pageSize:1,onChange:this.onPageChange,dangerouslySetAntdProps:{simple:!0}})}),(0,f.Y)("div",{className:"mlflow-document",children:(0,f.Y)(s.A,{file:this.state.pdfData,onLoadSuccess:this.onDocumentLoadSuccess,onLoadError:this.onDocumentLoadError,loading:(0,f.Y)(d.S,{}),children:(0,f.Y)(o.A,{pageNumber:this.state.currentPage,loading:(0,f.Y)(d.S,{}),renderTextLayer:!1,renderAnnotationLayer:!1})})})]})})}fetchPdf(){var e,t;const{path:a,runUuid:r,isLoggedModelsMode:n,loggedModelId:s,experimentId:o,entityTags:i}=this.props;null===(e=(t=this.props).getArtifact)||void 0===e||e.call(t,{path:a,runUuid:r,isLoggedModelsMode:n,loggedModelId:s,experimentId:o,entityTags:i},l.xC).then((e=>{this.setState({pdfData:{data:e},loading:!1})})).catch((e=>{this.setState({error:e,loading:!1})}))}componentDidMount(){this.fetchPdf()}resetPDFState(){this.setState({pdfData:void 0,loading:!0,currentPage:1,numPages:1})}componentDidUpdate(e){this.props.path===e.path&&this.props.runUuid===e.runUuid||(this.resetPDFState(),this.fetchPdf())}render(){return this.state.loading?(0,f.Y)(u.$,{className:"artifact-pdf-view-loading"}):this.state.error?(0,f.Y)(g.F,{className:"artifact-pdf-view-error"}):(0,f.Y)("div",{className:"mlflow-pdf-outer-container",children:this.renderPdf()})}}m.defaultProps={getArtifact:p.F};var P=m}}]);