text: "use strict";var e=require("@babel/runtime/helpers/typeof"),t=require("@babel/runtime/helpers/classCallCheck"),a=require("@babel/runtime/helpers/createClass"),n=require("@babel/runtime/helpers/assertThisInitialized"),l=require("@babel/runtime/helpers/inherits"),s=require("@babel/runtime/helpers/possibleConstructorReturn"),r=require("@babel/runtime/helpers/getPrototypeOf"),i=require("react"),o=require("prop-types"),u=require("@babel/runtime/helpers/asyncToGenerator"),d=require("@babel/runtime/helpers/slicedToArray"),c=require("@babel/runtime/regenerator"),f=require("pdfjs-dist"),m=require("pdfjs-dist/build/pdf.worker.entry");function h(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var p=h(e),g=h(t),b=h(a),v=h(n),R=h(l),x=h(s),E=h(r),y=h(i),k=h(o),w=h(u),C=h(d),N=h(c),S=h(m),P=function(e){var t=e.message;return y.default.createElement("div",{className:"columns has-text-danger mt-2 is-mobile"},y.default.createElement("div",{className:"column is-4 has-text-right p-2"},y.default.createElement("span",{className:"icon"},y.default.createElement("i",{className:"material-icons"},"error_outline"))),y.default.createElement("div",{className:"column is-8 has-text-left p-2"},y.default.createElement("small",null,t)))};function q(e){var t=i.useRef();return i.useEffect((function(){t.current=e})),t.current}P.propTypes={message:k.default.string.isRequired},f.GlobalWorkerOptions.workerSrc=S.default;var Z=function(e){var t=e.document,a=e.withCredentials,n=e.password,l=e.pageNum,s=e.scale,r=e.rotation,o=e.pageCount,u=e.changePage,d=e.showThumbnail,c=e.protectContent,m=e.watermark,h=e.alert,p=e.canvasCss,g=i.useState(null),b=C.default(g,2),v=b[0],R=b[1],x=i.useState(null),E=C.default(x,2),k=E[0],S=E[1],Z=i.useState(null),A=C.default(Z,2),T=A[0],B=A[1],O=i.useState({status:!1,message:""}),I=C.default(O,2),_=I[0],z=I[1],L=i.useRef(null),j=i.useRef(null),D=i.useRef(null),F=i.useState([]),M=C.default(F,2),W=M[0],H=M[1],V=q(t),G=q(n),J=h||P,U=function(){var e=w.default(N.default.mark((function e(){var l,s,r;return N.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(l=null,s=null,e.prev=2,JSON.stringify(V)===JSON.stringify(t)&&G.base64===n.url){e.next=15;break}return r={withCredentials:a,password:n},null==t.url?r.data=atob(t.base64):r.url=t.url,e.next=8,f.getDocument(r).promise;case 8:return l=e.sent,e.next=11,K(l);case 11:s=e.sent,Q(s),R(l),S(s);case 15:return e.next=17,X(l);case 17:o(l.numPages),e.next=25;break;case 20:e.prev=20,e.t0=e.catch(2),console.warn("Error while opening the document !\n",e.t0),o(-1),z({status:!0,message:"Error while opening the document !"});case 25:case"end":return e.stop()}}),e,null,[[2,20]])})));return function(){return e.apply(this,arguments)}}(),X=function(){var e=w.default(N.default.mark((function e(){var t,a,n,i,u,d,c,f,h,p,g,b,R,x,E,y,k=arguments;return N.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return null==(t=k.length>0&&void 0!==k[0]?k[0]:null)&&(t=v),e.prev=2,e.next=5,t.getPage(l);case 5:return a=e.sent,n=a.getViewport({scale:s,rotation:r}),(i=L.current).height=n.height,i.width=n.width,(u=i.getContext("2d")).clearRect(0,0,i.width,i.height),u.beginPath(),d={canvasContext:u,viewport:n},c=a.render(d),null!=T&&T._internalRenderTask.cancel(),e.prev=16,e.next=19,c.promise;case 19:0!==Object.entries(m).length&&(f=m.text,h=m.diagonal,p=m.opacity,g=m.font,b=m.size,R=m.color,u.globalAlpha=p,u.font="".concat(b*s,"px ").concat(""!==g?g:"Comic Sans MS"),u.fillStyle=R,x=u.measureText(f),E=x.width,y=b*s,u.translate(n.width/2,n.height/2),h&&u.rotate(-.785),u.fillText(f,-E/2,y/2)),e.next=27;break;case 22:e.prev=22,e.t0=e.catch(16),console.warn("Error occured while rendering !\n",e.t0),o(-1),z({status:!0,message:"Error occured while rendering !"});case 27:B(c),e.next=35;break;case 30:e.prev=30,e.t1=e.catch(2),console.warn("Error while reading the pages !\n",e.t1),o(-1),z({status:!0,message:"Error while reading the pages !"});case 35:case"end":return e.stop()}}),e,null,[[2,30],[16,22]])})));return function(){return e.apply(this,arguments)}}(),K=function(){var e=w.default(N.default.mark((function e(t){var a,n,l,s,r,i,o,u,c,f,h,p,g,b,v,R,x,E,y;return N.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=[],0===Object.entries(d).length){e.next=27;break}n=.1,l=0,1<=d.scale&&d.scale<=5&&(n=d.scale/10),-90!==d.rotationAngle&&90!==d.rotationAngle||(l=d.rotationAngle),s=1;case 7:if(!(s<=t.numPages)){e.next=27;break}return e.next=10,t.getPage(s);case 10:return r=e.sent,i=r.getViewport({scale:n,rotation:l}),(o=j.current).height=i.height,o.width=i.width,(u=o.getContext("2d")).clearRect(0,0,o.width,o.height),u.beginPath(),c={canvasContext:u,viewport:i},f=r.render(c),e.next=22,f.promise;case 22:0!==Object.entries(m).length&&(h=m.text,p=m.diagonal,g=m.opacity,b=m.font,v=m.size,R=m.color,u.globalAlpha=g,u.font="".concat(v*n,"px ").concat(""!==b?b:"Comic Sans MS"),u.fillStyle=R,x=u.measureText(h),E=x.width,y=v*n,u.translate(i.width/2,i.height/2),p&&u.rotate(-.785),u.fillText(h,-E/2,y/2)),a.push({image:o.toDataURL("image/png"),height:i.height,width:i.width});case 24:s++,e.next=7;break;case 27:return e.abrupt("return",a);case 28:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),Q=function(e){if(0!==Object.entries(d).length&&null!==e){for(var t=[],a=function(a){var n=e[a-1].image,s="",r={height:e[a-1].height,width:e[a-1].width,display:"flex",cursor:"pointer"};d.thumbCss&&d.selectedThumbCss?s=l===a?d.selectedThumbCss:d.thumbCss:l===a?(r.margin="10px 20px",r.border="5px solid rgba(58, 58, 64, 1)",r.boxShadow="rgba(0, 0, 0, 0.6) 0 4px 8px 0, rgba(0, 0, 0, 0.58) 0 6px 20px 0"):(r.margin="15px 25px",r.boxShadow="rgba(0, 0, 0, 0.6) 0px 2px 2px 0px"),t.push(y.default.createElement("img",{style:r,className:s,onClick:function(){return u(a)},ref:l===a?D:null,key:a,alt:"thumbnail of page ".concat(a),src:n}))},n=1;n<=e.length;n++)a(n);t.push(y.default.createElement("div",{key:0,style:{padding:"0px 10px"}})),H(t)}};if(i.useEffect((function(){U()}),[t,n,l,s,r]),i.useEffect((function(){Q(k),null!==D.current&&0!==Object.entries(d).length&&D.current.scrollIntoView({behavior:"smooth",block:"nearest",inline:"center"})}),[l]),0!==Object.entries(d).length){var Y={backgroundColor:d.backgroundColor?d.backgroundColor:"#EAE6DA",display:"flex",flexDirection:"row",overflowX:"auto"};return d.onTop?y.default.createElement(y.default.Fragment,null,y.default.createElement("div",{className:p||"",style:p?{}:{height:"1000px",overflow:"auto"}},y.default.createElement("div",{style:_.status?{display:"block"}:{display:"none"}},y.default.createElement(J,{message:_.message})),y.default.createElement("div",{style:Y},W),y.default.createElement("canvas",{style:_.status?{display:"none"}:null,onContextMenu:function(e){return c?e.preventDefault():null},ref:L,width:"undefined"!=typeof window&&window.innerWidth,height:"undefined"!=typeof window&&window.innerHeight})),y.default.createElement("canvas",{ref:j,style:{display:"none"}})):y.default.createElement(y.default.Fragment,null,y.default.createElement("div",{className:p||"",style:p?{}:{height:"1000px",overflow:"auto"}},y.default.createElement("div",{style:_.status?{display:"block"}:{display:"none"}},y.default.createElement(J,{message:_.message})),y.default.createElement("canvas",{style:_.status?{display:"none"}:null,onContextMenu:function(e){return c?e.preventDefault():null},ref:L,width:"undefined"!=typeof window&&window.innerWidth,height:"undefined"!=typeof window&&window.innerHeight})),y.default.createElement("div",{style:Y},W),y.default.createElement("canvas",{ref:j,style:{display:"none"}}))}return y.default.createElement("div",null,y.default.createElement("div",{className:p||"",style:p?{}:{height:"1000px",overflow:"auto"}},y.default.createElement("div",{style:_.status?{display:"block"}:{display:"none"}},y.default.createElement(J,{message:_.message})),y.default.createElement("canvas",{style:_.status?{display:"none"}:null,onContextMenu:function(e){return c?e.preventDefault():null},ref:L,width:"undefined"!=typeof window&&window.innerWidth,height:"undefined"!=typeof window&&window.innerHeight})))};Z.propTypes={document:k.default.any.isRequired,withCredentials:k.default.bool,password:k.default.string,pageNum:k.default.number.isRequired,scale:k.default.number.isRequired,rotation:k.default.number.isRequired,changePage:k.default.func,pageCount:k.default.func,showThumbnail:k.default.shape({scale:k.default.number,rotationAngle:k.default.number,onTop:k.default.bool,backgroundColor:k.default.string,thumbCss:k.default.string,selectedThumbCss:k.default.string}),protectContent:k.default.bool,watermark:k.default.shape({text:k.default.string,diagonal:k.default.bool,opacity:k.default.string,size:k.default.string,color:k.default.string}),canvasCss:k.default.string},Z.defaultProps={changePage:function(){},pageCount:function(){},showThumbnail:{},protectContent:!1,watermark:{},canvasCss:""};var A=function(e){var t=e.css,a=e.page,n=e.pages,l=e.handleNextClick,s=t||"button is-black my-0 mx-3";return a===n?y.default.createElement("button",{className:s,disabled:!0},y.default.createElement("span",{className:"icon is-small"},y.default.createElement("i",{className:"material-icons"},"keyboard_arrow_right"))):y.default.createElement("button",{className:s,onClick:l},y.default.createElement("span",{className:"icon is-small"},y.default.createElement("i",{className:"material-icons"},"keyboard_arrow_right")))};A.propTypes={css:k.default.string,page:k.default.number.isRequired,pages:k.default.number.isRequired,handleNextClick:k.default.func.isRequired};var T=function(e){var t=e.css,a=e.page,n=e.pages,l=t||"is-size-7 has-text-centered my-0 mx-3";return y.default.createElement("span",{className:l},"Page ".concat(a," / ").concat(n))};T.propTypes={css:k.default.string,page:k.default.number.isRequired,pages:k.default.number.isRequired};var B=function(e){var t=e.css,a=e.page,n=e.handlePrevClick,l=t||"button is-black my-0 mx-3";return 1===a?y.default.createElement("button",{className:l,disabled:!0},y.default.createElement("span",{className:"icon is-small"},y.default.createElement("i",{className:"material-icons"},"keyboard_arrow_left"))):y.default.createElement("button",{className:l,onClick:n},y.default.createElement("span",{className:"icon is-small"},y.default.createElement("i",{className:"material-icons"},"keyboard_arrow_left")))};B.propTypes={css:k.default.string,page:k.default.number.isRequired,handlePrevClick:k.default.func.isRequired};var O=function(e){var t=e.css,a=e.scale,n=e.defaultScale,l=e.maxScale,s=e.handleZoomIn,r=t||"button is-black my-0 mx-3",i=l;return n>l&&(i=n),a.toFixed(2)===i.toFixed(2)?y.default.createElement("button",{className:r,disabled:!0},y.default.createElement("span",{className:"icon is-small"},y.default.createElement("i",{className:"material-icons"},"zoom_in"))):y.default.createElement("button",{className:r,onClick:s},y.default.createElement("span",{className:"icon is-small"},y.default.createElement("i",{className:"material-icons"},"zoom_in")))};O.propTypes={css:k.default.string,scale:k.default.number.isRequired,defaultScale:k.default.number.isRequired,maxScale:k.default.number.isRequired,handleZoomIn:k.default.func.isRequired};var I=function(e){var t=e.css,a=e.scale,n=e.defaultScale,l=e.minScale,s=e.handleZoomOut,r=t||"button is-black my-0 mx-3",i=l;return n<l&&(i=n),a.toFixed(2)===i.toFixed(2)?y.default.createElement("button",{className:r,disabled:!0},y.default.createElement("span",{className:"icon is-small"},y.default.createElement("i",{className:"material-icons"},"zoom_out"))):y.default.createElement("button",{className:r,onClick:s},y.default.createElement("span",{className:"icon is-small"},y.default.createElement("i",{className:"material-icons"},"zoom_out")))};I.propTypes={css:k.default.string,scale:k.default.number.isRequired,defaultScale:k.default.number.isRequired,minScale:k.default.number.isRequired,handleZoomOut:k.default.func.isRequired};var _=function(e){var t=e.css,a=e.scale,n=e.defaultScale,l=e.handleResetZoom,s=t||"button is-black my-0 mx-3";return a.toFixed(2)===n.toFixed(2)?y.default.createElement("button",{className:s,disabled:!0},y.default.createElement("span",{className:"icon is-small"},y.default.createElement("i",{className:"material-icons"},"refresh"))):y.default.createElement("button",{className:s,onClick:l},y.default.createElement("span",{className:"icon is-small"},y.default.createElement("i",{className:"material-icons"},"refresh")))};_.propTypes={css:k.default.string,scale:k.default.number.isRequired,defaultScale:k.default.number.isRequired,handleResetZoom:k.default.func.isRequired};var z=function(e){var t=e.css,a=e.rotationAngle,n=e.handleRotateLeft,l=t||"button is-black my-0 mx-3";return-90===a?y.default.createElement("button",{className:l,disabled:!0},y.default.createElement("span",{className:"icon is-small"},y.default.createElement("i",{className:"material-icons"},"rotate_left"))):y.default.createElement("button",{className:l,onClick:n},y.default.createElement("span",{className:"icon is-small"},y.default.createElement("i",{className:"material-icons"},"rotate_left")))};z.propTypes={css:k.default.string,rotationAngle:k.default.number.isRequired,handleRotateLeft:k.default.func.isRequired};var L=function(e){var t=e.css,a=e.rotationAngle,n=e.handleResetRotation,l=t||"button is-black my-0 mx-3";return 0===a?y.default.createElement("button",{className:l,disabled:!0},y.default.createElement("span",{className:"icon is-small"},y.default.createElement("i",{className:"material-icons"},"refresh"))):y.default.createElement("button",{className:l,onClick:n},y.default.createElement("span",{className:"icon is-small"},y.default.createElement("i",{className:"material-icons"},"refresh")))};L.propTypes={css:k.default.string,rotationAngle:k.default.number.isRequired,handleResetRotation:k.default.func.isRequired};var j=function(e){var t=e.css,a=e.rotationAngle,n=e.handleRotateRight,l=t||"button is-black my-0 mx-3";return 90===a?y.default.createElement("button",{className:l,disabled:!0},y.default.createElement("span",{className:"icon is-small"},y.default.createElement("i",{className:"material-icons"},"rotate_right"))):y.default.createElement("button",{className:l,onClick:n},y.default.createElement("span",{className:"icon is-small"},y.default.createElement("i",{className:"material-icons"},"rotate_right")))};j.propTypes={css:k.default.string,rotationAngle:k.default.number.isRequired,handleRotateRight:k.default.func.isRequired};var D=function(e){var t=e.page,a=e.pages,n=e.scale,l=e.defaultScale,s=e.maxScale,r=e.minScale,i=e.rotationAngle,o=e.hideZoom,u=e.hideRotation,d=e.css,c=e.handlePrevClick,f=e.handleNextClick,m=e.handleZoomIn,h=e.handleResetZoom,p=e.handleZoomOut,g=e.handleRotateLeft,b=e.handleResetRotation,v=e.handleRotateRight;return y.default.createElement("div",{className:"columns is-gapless ".concat(d.navbarWrapper||"box is-mobile has-text-white has-background-black py-4")},o?y.default.createElement("div",{className:"column is-4"}):y.default.createElement("div",{className:"column is-flex is-flex-direction-row is-4 buttons are-small has-addons"},y.default.createElement(I,{scale:n,minScale:r,defaultScale:l,css:d.zoomOutBtn,handleZoomOut:p}),y.default.createElement(_,{scale:n,defaultScale:l,css:d.resetZoomBtn,handleResetZoom:h}),y.default.createElement(O,{scale:n,maxScale:s,defaultScale:l,css:d.zoomInBtn,handleZoomIn:m})),y.default.createElement("div",{className:"column is-flex is-flex-direction-row is-4 buttons are-small has-addons is-centered"},y.default.createElement(B,{css:d.previousPageBtn,page:t,pages:a,handlePrevClick:c}),y.default.createElement(T,{css:d.pageIndicator,page:t,pages:a}),y.default.createElement(A,{css:d.nextPageBtn,page:t,pages:a,handleNextClick:f})),u?y.default.createElement("div",{className:"column is-4"}):y.default.createElement("div",{className:"column is-flex is-flex-direction-row is-4 buttons are-small has-addons is-right"},y.default.createElement(z,{css:d.rotateLeftBtn,rotationAngle:i,handleRotateLeft:g}),y.default.createElement(L,{css:d.resetRotationBtn,rotationAngle:i,handleResetRotation:b}),y.default.createElement(j,{css:d.rotateRightBtn,rotationAngle:i,handleRotateRight:v})))};D.propTypes={page:k.default.number.isRequired,pages:k.default.number.isRequired,scale:k.default.number,defaultScale:k.default.number,maxScale:k.default.number,minScale:k.default.number,rotationAngle:k.default.number,hideZoom:k.default.bool,hideRotation:k.default.bool,css:k.default.shape({navbarWrapper:k.default.string,pages:k.default.string,pageIndicator:k.default.string,previousPageBtn:k.default.string,nextPageBtn:k.default.string,zoomOutBtn:k.default.string,resetZoomBtn:k.default.string,zoomInBtn:k.default.string,rotateLeftBtn:k.default.string,resetRotationBtn:k.default.string,rotateRightBtn:k.default.string}),elements:k.default.shape({previousPageBtn:k.default.any,nextPageBtn:k.default.any,pages:k.default.any}),handlePrevClick:k.default.func.isRequired,handleNextClick:k.default.func.isRequired,handleZoomIn:k.default.func.isRequired,handleResetZoom:k.default.func.isRequired,handleZoomOut:k.default.func.isRequired,handleRotateLeft:k.default.func.isRequired,handleResetRotation:k.default.func.isRequired,handleRotateRight:k.default.func.isRequired},D.defaultProps={css:{},elements:{}};var F={display:"inline-block",verticalAlign:"text-bottom",backgroundColor:"currentColor",borderRadius:"50%",width:"0.5rem",height:"0.5rem"},M=function(){return y.default.createElement("div",{className:"m-4 is-flex is-flex-direction-row is-justify-content-center is-align-content-center"},y.default.createElement("p",{className:"is-size-3 is-marginless"},"Loading"),y.default.createElement("div",{className:"p-3"},y.default.createElement("div",{style:F})),y.default.createElement("div",{className:"p-3"},y.default.createElement("div",{style:F})),y.default.createElement("div",{className:"p-3"},y.default.createElement("div",{style:F})))};function W(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var a,n=E.default(e);if(t){var l=E.default(this).constructor;a=Reflect.construct(n,arguments,l)}else a=n.apply(this,arguments);return x.default(this,a)}}var H=function(e){R.default(a,e);var t=W(a);function a(e){var n;return g.default(this,a),(n=t.call(this,e)).state={page:n.props.page,prevPropPage:n.props.page,scale:n.props.scale,prevPropScale:n.props.scale,rotationAngle:n.props.rotationAngle,prevPropRotationAngle:n.props.rotationAngle,pages:0,defaultScale:n.props.scale,isReady:!1},n.getPageCount=n.getPageCount.bind(v.default(n)),n.handleThumbnailClick=n.handleThumbnailClick.bind(v.default(n)),n.handlePrevClick=n.handlePrevClick.bind(v.default(n)),n.handleNextClick=n.handleNextClick.bind(v.default(n)),n.handleZoomIn=n.handleZoomIn.bind(v.default(n)),n.handleResetZoom=n.handleResetZoom.bind(v.default(n)),n.handleZoomOut=n.handleZoomOut.bind(v.default(n)),n.handleRotateLeft=n.handleRotateLeft.bind(v.default(n)),n.handleResetRotation=n.handleResetRotation.bind(v.default(n)),n.handleRotateRight=n.handleRotateRight.bind(v.default(n)),n}return b.default(a,[{key:"getPageCount",value:function(e){this.state.pages!==e&&(this.setState({pages:e,isReady:!0}),this.props.getMaxPageCount&&this.props.getMaxPageCount(e))}},{key:"handleThumbnailClick",value:function(e){this.state.page!==e&&this.setState({page:e})}},{key:"handlePrevClick",value:function(){1!==this.state.page&&(this.setState((function(e){return{page:e.page-1}})),this.props.onPrevBtnClick&&this.props.onPrevBtnClick(this.state.page-1))}},{key:"handleNextClick",value:function(){this.state.page!==this.pages&&(this.setState((function(e){return{page:e.page+1}})),this.props.onNextBtnClick&&this.props.onNextBtnClick(this.state.page+1))}},{key:"handleZoomIn",value:function(){var e=this.props.maxScale;this.state.defaultScale>this.props.maxScale&&(e=this.state.defaultScale),this.state.scale<e&&this.setState((function(e,t){return{scale:e.scale+t.scaleStep}})),this.props.onZoom&&this.props.onZoom(this.state.scale+this.props.scaleStep)}},{key:"handleResetZoom",value:function(){this.setState((function(e){return{scale:e.defaultScale}})),this.props.onZoom&&this.props.onZoom(this.state.defaultScale)}},{key:"handleZoomOut",value:function(){var e=this.props.minScale;this.state.defaultScale<this.props.minScale&&(e=this.state.defaultScale),this.state.scale>e&&this.setState((function(e,t){return{scale:e.scale-t.scaleStep}})),this.props.onZoom&&this.props.onZoom(this.state.scale-this.props.scaleStep)}},{key:"handleRotateLeft",value:function(){-90!==this.state.rotationAngle&&this.setState({rotationAngle:-90}),this.props.onRotation&&this.props.onRotation(-90)}},{key:"handleResetRotation",value:function(){0!==this.state.rotationAngle&&this.setState({rotationAngle:0}),this.props.onRotation&&this.props.onRotation(0)}},{key:"handleRotateRight",value:function(){90!==this.state.rotationAngle&&this.setState({rotationAngle:90}),this.props.onRotation&&this.props.onRotation(90)}},{key:"render",value:function(){var e=this,t=this.props,a=t.document,n=t.withCredentials,l=t.password,s=t.loader,r=t.maxScale,i=t.minScale,o=t.externalInput,u=t.hideNavbar,d=t.hideZoom,c=t.hideRotation,f=t.navbarOnTop,m=t.navigation,h=t.css,g=t.canvasCss,b=t.onDocumentClick,v=t.showThumbnail,R=t.protectContent,x=t.watermark,E=t.alert,k=this.state,w=k.page,C=k.pages,N=k.scale,S=k.defaultScale,P=k.rotationAngle,q=m,A=y.default.createElement(Z,{document:a,withCredentials:n,password:l,pageNum:w,scale:N,rotation:P,changePage:function(t){return e.handleThumbnailClick(t)},pageCount:function(t){return e.getPageCount(t)},showThumbnail:v,protectContent:R,watermark:x,alert:E,canvasCss:g}),T=null,B=u;return o&&(B=!0),!B&&C>0&&(T=m&&"object"!==p.default(m)?y.default.createElement(q,{page:w,pages:C,scale:N,defaultScale:S,maxScale:r,minScale:i,rotationAngle:P,hideZoom:d,hideRotation:c,handleNextClick:this.handleNextClick,handlePrevClick:this.handlePrevClick,handleZoomIn:this.handleZoomIn,handleResetZoom:this.handleResetZoom,handleZoomOut:this.handleZoomOut,handleRotateLeft:this.handleRotateLeft,handleResetRotation:this.handleResetRotation,handleRotateRight:this.handleRotateRight}):y.default.createElement(D,{page:w,pages:C,scale:N,defaultScale:S,maxScale:r,minScale:i,rotationAngle:P,hideZoom:d,hideRotation:c,css:m?m.css:void 0,handleNextClick:this.handleNextClick,handlePrevClick:this.handlePrevClick,handleZoomIn:this.handleZoomIn,handleResetZoom:this.handleResetZoom,handleZoomOut:this.handleZoomOut,handleRotateLeft:this.handleRotateLeft,handleResetRotation:this.handleResetRotation,handleRotateRight:this.handleRotateRight})),y.default.createElement("div",{className:h||"container text-center"},y.default.createElement("div",{style:{display:this.state.isReady?"none":"block"}},y.default.createElement("div",{className:g||"",style:g?{}:{height:"1000px",overflow:"auto"}},s||y.default.createElement(M,null))),y.default.createElement("div",{style:{display:this.state.isReady?"block":"none"}},f?y.default.createElement("div",null,y.default.createElement("div",null,T),y.default.createElement("div",{onClick:b},A)):y.default.createElement("div",null,y.default.createElement("div",{onClick:b},A),y.default.createElement("div",null,T))))}}],[{key:"getDerivedStateFromProps",value:function(e,t){return e.externalInput?e.page!==t.prevPropPage&&1<=e.page&&e.page<=t.pages?{page:e.page,prevPropPage:e.page}:e.scale!==t.prevPropScale&&e.minScale<=e.scale&&e.scale<=e.maxScale?{scale:e.scale,prevPropScale:e.scale}:e.rotationAngle===t.prevPropRotationAngle||90!==e.rotationAngle&&0!==e.rotationAngle&&-90!==e.rotationAngle?null:{rotationAngle:e.rotationAngle,prevPropRotationAngle:e.rotationAngle}:null}}]),a}(y.default.Component);H.propTypes={document:k.default.shape({url:k.default.string,base64:k.default.string}).isRequired,withCredentials:k.default.bool,password:k.default.string,loader:k.default.node,externalInput:k.default.bool,page:k.default.number,scale:k.default.number,scaleStep:k.default.number,maxScale:k.default.number,minScale:k.default.number,css:k.default.string,canvasCss:k.default.string,rotationAngle:k.default.number,onDocumentClick:k.default.func,onPrevBtnClick:k.default.func,onNextBtnClick:k.default.func,onZoom:k.default.func,onRotation:k.default.func,getMaxPageCount:k.default.func,hideNavbar:k.default.bool,navbarOnTop:k.default.bool,hideZoom:k.default.bool,hideRotation:k.default.bool,showThumbnail:k.default.shape({scale:k.default.number,rotationAngle:k.default.number,onTop:k.default.bool,backgroundColor:k.default.string,thumbCss:k.default.string,selectedThumbCss:k.default.string}),protectContent:k.default.bool,watermark:k.default.shape({text:k.default.string,diagonal:k.default.bool,opacity:k.default.string,font:k.default.string,size:k.default.string,color:k.default.string}),alert:k.default.any,navigation:k.default.oneOfType([k.default.shape({css:k.default.shape({navbarWrapper:k.default.string,zoomOutBtn:k.default.string,resetZoomBtn:k.default.string,zoomInBtn:k.default.string,previousPageBtn:k.default.string,pageIndicator:k.default.string,nextPageBtn:k.default.string,rotateLeftBtn:k.default.string,resetRotationBtn:k.default.string,rotateRightBtn:k.default.string})}),k.default.any])},H.defaultProps={page:1,withCredentials:!1,password:"",scale:1,scaleStep:1,maxScale:3,minScale:1,rotationAngle:0,externalInput:!1,hideNavbar:!1,hideZoom:!1,hideRotation:!1,navbarOnTop:!1,canvasCss:""},module.exports=H;
  