![]() System : Linux absol.cf 5.4.0-198-generic #218-Ubuntu SMP Fri Sep 27 20:18:53 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, Directory : /opt/mattermost/client/ |
Upload File : |
"use strict";(self.webpackChunkmattermost_webapp=self.webpackChunkmattermost_webapp||[]).push([[11],{92600:(e,t,i)=>{i.d(t,{A:()=>f});var l=i(23453),n=i(26614),s=i(68124),a=i(62688),o=i.n(a),r=i(97023),c=i.n(r),d=i(14778),m=i(85873);const h=e=>{let{fileInfo:t,fileUrl:i,canDownloadFiles:l}=e;const n=(0,d.useIntl)(),s=[];""!==t.extension&&s.push(n.formatMessage({id:"file_info_preview.type",defaultMessage:"File type "})+t.extension.toUpperCase()),t.size&&s.push(n.formatMessage({id:"file_info_preview.size",defaultMessage:"Size "})+m.O1(t.size));const a=s.join(", ");let o=null;return o=l?c().createElement("a",{className:"file-details__preview",href:i},c().createElement("span",{className:"file-details__preview-helper"}),c().createElement("img",{alt:"file preview",src:m.Xm(t)})):c().createElement("span",{className:"file-details__preview"},c().createElement("span",{className:"file-details__preview-helper"}),c().createElement("img",{alt:"file preview",src:m.Xm(t)})),c().createElement("div",{className:"file-details__container"},o,c().createElement("div",{className:"file-details"},c().createElement("div",{className:"file-details__name"},t.name),c().createElement("div",{className:"file-details__info"},a)))};h.propTypes={fileUrl:o().string.isRequired,canDownloadFiles:o().bool.isRequired};const p=c().memo(h),f=(0,l.connect)((function(e){const t=(0,n.zj)(e);return{canDownloadFiles:(0,s.En)(t)}}))(p)},90011:(e,t,i)=>{i.r(t),i.d(t,{default:()=>ce});var l=i(62688),n=i.n(l),s=(i(43813),i(17046),i(4290),i(71633)),a=i.n(s),o=i(97023),r=i.n(o),c=i(34529),d=i(14778),m=i(31655),h=i(85406);function p(e){const t=(0,d.useIntl)().formatMessage({id:"workspace_limits.archived_file.archived",defaultMessage:"This file is archived"}),i=r().createElement("span",{className:"file-details__preview file-details__preview--archived"},r().createElement(h.ArchiveOutlineIcon,{size:80,color:"rgba(var(--center-channel-color-rgb), 0.48)","data-testid":"archived-file-icon"}));return r().createElement("div",{className:"file-details__container"},i,r().createElement("div",{className:"file-details"},r().createElement("div",{className:"file-details__name"},e.fileInfo.name),r().createElement("div",{className:"file-details__info"},t)))}var f=i(23453),u=i(7380),v=i(92600),g=i(78451);function E(e,t,i){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var i=t.call(e,"string");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}class w extends r().PureComponent{constructor(e){super(e),E(this,"sourceRef",r().createRef()),E(this,"videoRef",r().createRef()),E(this,"handleFileInfoChanged",(()=>{let e=this.videoRef.current;e||(e=document.createElement("video")),this.setState({canPlay:!0})})),E(this,"handleLoadError",(()=>{this.setState({canPlay:!1})})),E(this,"stop",(()=>{if(this.videoRef.current){const e=this.videoRef.current;e.pause(),e.currentTime=0}})),this.state={canPlay:!0}}componentDidMount(){this.handleFileInfoChanged(),this.sourceRef.current&&this.sourceRef.current.addEventListener("error",this.handleLoadError,{once:!0})}componentDidUpdate(e){this.props.fileUrl!==e.fileUrl&&this.handleFileInfoChanged(),this.sourceRef.current&&this.sourceRef.current.addEventListener("error",this.handleLoadError,{once:!0})}render(){if(!this.state.canPlay)return r().createElement(v.A,{fileInfo:this.props.fileInfo,fileUrl:this.props.fileUrl});let e=g.Ay.WEB_VIDEO_WIDTH,t=g.Ay.WEB_VIDEO_HEIGHT;return this.props.isMobileView&&(e=g.Ay.MOBILE_VIDEO_WIDTH,t=g.Ay.MOBILE_VIDEO_HEIGHT),r().createElement("video",{key:this.props.fileInfo.id,ref:this.videoRef,"data-setup":"{}",controls:!0,width:e,height:t},r().createElement("source",{ref:this.sourceRef,src:this.props.fileUrl}))}}E(w,"propTypes",{fileUrl:n().string.isRequired,isMobileView:n().bool.isRequired});const b=(0,f.connect)((function(e){return{isMobileView:(0,u.w3)(e)}}))(w);var _=i(53654),I=i(75842);function y(e,t,i){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var i=t.call(e,"string");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}class C extends r().PureComponent{constructor(e){super(e),y(this,"getCode",(async()=>{if(this.state.lang&&!(this.props.fileInfo.size>g.Ay.CODE_PREVIEW_MAX_FILE_SIZE))try{const e=await fetch(this.props.fileUrl),t=await e.text();this.handleReceivedCode(t)}catch(e){this.handleReceivedError()}})),y(this,"handleReceivedCode",(async e=>{var t,i;let l=e;const n=e;"#document"===n.nodeName&&(l=(new XMLSerializer).serializeToString(n)),null===(t=(i=this.props).getContent)||void 0===t||t.call(i,l),this.setState({code:l,highlighted:await I.Zt(this.state.lang,l),loading:!1,success:!0})})),y(this,"handleReceivedError",(()=>{this.setState({loading:!1,success:!1})})),this.state={code:"",lang:"",highlighted:"",loading:!0,success:!0}}componentDidMount(){this.getCode()}static getDerivedStateFromProps(e,t){if(e.fileUrl!==t.prevFileUrl){const t=I.od(e.fileInfo.extension);return!t||e.fileInfo.size>g.Ay.CODE_PREVIEW_MAX_FILE_SIZE?{code:"",lang:"",loading:!1,success:!1,prevFileUrl:e.fileUrl}:{code:"",lang:t,loading:!0,prevFileUrl:e.fileUrl}}return null}componentDidUpdate(e){this.props.fileUrl!==e.fileUrl&&this.getCode()}static supports(e){return Boolean(I.od(e.extension))}render(){if(this.state.loading)return r().createElement("div",{className:"view-image__loading"},r().createElement(_.A,null));if(!this.state.success)return r().createElement(v.A,{fileInfo:this.props.fileInfo,fileUrl:this.props.fileUrl});const e=I.OT(this.state.lang);return r().createElement("div",{className:"post-code code-preview"},r().createElement("span",{className:"post-code__language"},"".concat(this.props.fileInfo.name," - ").concat(e)),r().createElement("div",{className:"hljs"},r().createElement("div",{className:"post-code__line-numbers"},I.bg(this.state.code)),r().createElement("code",{dangerouslySetInnerHTML:{__html:this.state.highlighted}})))}}y(C,"propTypes",{fileUrl:n().string.isRequired,className:n().string.isRequired,getContent:n().func});var R=i(7596),N=i(19513),M=i(85873),P=(i(29206),i(57406),i(55448),i(65952)),L=i(7430),F=i(18309);const x=(0,L.ml)(),k=e=>{const t=(0,f.useSelector)((t=>{var i,l;return(0,L.wz)(t,null!==(i=null===(l=e.post)||void 0===l?void 0:l.user_id)&&void 0!==i?i:"")})),i=(0,f.useSelector)((t=>{var i,l;return(0,P.s9)()(t,null!==(i=null===(l=e.post)||void 0===l?void 0:l.channel_id)&&void 0!==i?i:"")})),l=(0,f.useSelector)((t=>{var i,l;return x(t,null!==(i=null===(l=e.post)||void 0===l?void 0:l.user_id)&&void 0!==i?i:"",!0)}));let n;const s=i?r().createElement(d.FormattedMessage,{id:"file_preview_modal_info.shared_in",defaultMessage:"Shared in ~{name}",values:{name:i.display_name||i.name}}):null;return n=e.showFileName?r().createElement(r().Fragment,null,r().createElement("h5",{className:"file-preview-modal__file-name"},e.filename),r().createElement("span",{className:"file-preview-modal__file-details"},r().createElement("span",{className:"file-preview-modal__file-details-user-name"},l),r().createElement("span",{className:"file-preview-modal__channel"},s))):r().createElement(r().Fragment,null,r().createElement("h5",{className:"file-preview-modal__user-name"},l),r().createElement("span",{className:"file-preview-modal__channel"},s)),r().createElement("div",{className:"file-preview-modal__info"},e.post&&Object.keys(e.post).length>0&&r().createElement(F.A,{size:"lg",url:(0,M.RG)(e.post.user_id,null==t?void 0:t.last_picture_update),className:"file-preview-modal__avatar"}),r().createElement("div",{className:"file-preview-modal__info-details"},n))};k.propTypes={showFileName:n().bool.isRequired,filename:n().string.isRequired};const O=(0,o.memo)(k);var S=i(42474),A=i(69813),D=i(35301),q=i(17518),U=i(87131);function T(e){return Boolean(e.id)}const j=e=>{const t=(0,d.useIntl)(),i=(0,f.useSelector)((e=>{var t;return null===(t=(0,A.EL)(e))||void 0===t?void 0:t.link})),l=(0,f.useDispatch)(),[n,s]=(0,o.useState)(!1);(0,o.useEffect)((()=>{T(e.fileInfo)&&e.enablePublicLink&&l((0,S.EL)(e.fileInfo.id))}),[e.fileInfo,e.enablePublicLink]),(0,o.useEffect)((()=>{n&&setTimeout((()=>{s(!1)}),2e3)}),[n]);const a=t.formatMessage({id:"full_screen_modal.close",defaultMessage:"Close"}),c=r().createElement(U.A,{title:a,key:"publicLink"},r().createElement("button",{className:"file-preview-modal-main-actions__action-item",onClick:e.handleModalClose,"aria-label":a},r().createElement("i",{className:"icon icon-close"})));let m;m=n?t.formatMessage({id:"file_preview_modal_main_actions.public_link-copied",defaultMessage:"Public link copied"}):t.formatMessage({id:"view_image_popover.publicLink",defaultMessage:"Get a public link"});const h=r().createElement(U.A,{key:"filePreviewPublicLink",title:m},r().createElement("a",{href:"#",className:"file-preview-modal-main-actions__action-item",onClick:()=>{(0,M.lW)(null!=i?i:""),s(!0)},"aria-label":m},r().createElement("i",{className:"icon icon-link-variant"}))),p=t.formatMessage({id:"view_image_popover.download",defaultMessage:"Download"}),u=r().createElement(U.A,{key:"download",title:p},r().createElement(q.A,{href:e.fileURL,className:"file-preview-modal-main-actions__action-item",location:"file_preview_modal_main_actions",download:e.filename,"aria-label":p},r().createElement("i",{className:"icon icon-download-outline"}))),v=r().createElement(D.A,{className:"file-preview-modal-main-actions__action-item",isForText:(0,M.ti)(e.fileInfo.extension)===g.a0.TEXT,content:e.content});return r().createElement("div",{className:"file-preview-modal-main-actions__actions"},!e.showOnlyClose&&e.canCopyContent&&v,!e.showOnlyClose&&e.enablePublicLink&&e.showPublicLink&&h,!e.showOnlyClose&&e.canDownloadFiles&&u,e.showClose&&c)};j.propTypes={showOnlyClose:n().bool,showClose:n().bool,showPublicLink:n().bool,filename:n().string.isRequired,fileURL:n().string.isRequired,enablePublicLink:n().bool.isRequired,canDownloadFiles:n().bool.isRequired,canCopyContent:n().bool.isRequired,handleModalClose:n().func.isRequired,content:n().string.isRequired},j.defaultProps={showOnlyClose:!1,showClose:!0,showPublicLink:!0};const Z=(0,o.memo)(j),z=["post"],V=e=>{let{post:t}=e,i=function(e,t){if(null==e)return{};var i,l,n=function(e,t){if(null==e)return{};var i={};for(var l in e)if({}.hasOwnProperty.call(e,l)){if(t.includes(l))continue;i[l]=e[l]}return i}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(l=0;l<s.length;l++)i=s[l],t.includes(i)||{}.propertyIsEnumerable.call(e,i)&&(n[i]=e[i])}return n}(e,z);return r().createElement("div",{className:"file-preview-modal-footer"},r().createElement(O,{showFileName:!1,post:t,filename:i.filename}),r().createElement(Z,Object.assign({},i,{showClose:!1,showOnlyClose:!1})))};V.propTypes={filename:n().string.isRequired,fileURL:n().string.isRequired,showPublicLink:n().bool,enablePublicLink:n().bool.isRequired,canDownloadFiles:n().bool.isRequired,isExternalFile:n().bool.isRequired,handleModalClose:n().func.isRequired,canCopyContent:n().bool.isRequired,content:n().string.isRequired};const B=(0,o.memo)(V),H=e=>{const t=r().createElement(U.A,{key:"previewArrowLeft",title:r().createElement(d.FormattedMessage,{id:"generic.close",defaultMessage:"Close"})},r().createElement("button",{id:"previewArrowLeft",className:"file_preview_modal_main_nav__prev",onClick:e.handlePrev},r().createElement("i",{className:"icon icon-chevron-left"}))),i=r().createElement(U.A,{key:"publicLink",title:r().createElement(d.FormattedMessage,{id:"generic.next",defaultMessage:"Next"})},r().createElement("button",{id:"previewArrowRight",className:"file_preview_modal_main_nav__next",onClick:e.handleNext},r().createElement("i",{className:"icon icon-chevron-right"})));return r().createElement("div",{className:"file_preview_modal_main_nav"},t,r().createElement("span",{className:"modal-bar-file-count"},r().createElement(d.FormattedMessage,{id:"file_preview_modal_main_nav.file",defaultMessage:"{count, number} of {total, number}",values:{count:e.fileIndex+1,total:e.totalFiles}})),i)};H.propTypes={fileIndex:n().number.isRequired,totalFiles:n().number.isRequired,handlePrev:n().func.isRequired,handleNext:n().func.isRequired};const W=(0,o.memo)(H),G=["post","totalFiles","fileIndex"],X=e=>{let{post:t,totalFiles:i,fileIndex:l}=e,n=function(e,t){if(null==e)return{};var i,l,n=function(e,t){if(null==e)return{};var i={};for(var l in e)if({}.hasOwnProperty.call(e,l)){if(t.includes(l))continue;i[l]=e[l]}return i}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(l=0;l<s.length;l++)i=s[l],t.includes(i)||{}.propertyIsEnumerable.call(e,i)&&(n[i]=e[i])}return n}(e,G),s=r().createElement("div",null);i>1&&(s=r().createElement(W,{totalFiles:i,fileIndex:l,handlePrev:n.handlePrev,handleNext:n.handleNext}));const a=r().createElement(Z,Object.assign({},n,{showOnlyClose:n.isMobileView}));return r().createElement("div",{className:"file-preview-modal-header"},n.isMobileView&&a,!n.isMobileView&&r().createElement(O,{showFileName:!0,post:t,filename:n.filename}),s,!n.isMobileView&&a)};X.propTypes={isMobileView:n().bool.isRequired,fileIndex:n().number.isRequired,totalFiles:n().number.isRequired,filename:n().string.isRequired,fileURL:n().string.isRequired,showPublicLink:n().bool,enablePublicLink:n().bool.isRequired,canDownloadFiles:n().bool.isRequired,canCopyContent:n().bool.isRequired,isExternalFile:n().bool.isRequired,handlePrev:n().func.isRequired,handleNext:n().func.isRequired,handleModalClose:n().func.isRequired,content:n().string.isRequired};const K=(0,o.memo)(X);function J(e){let t,i,l,{fileInfo:n,canDownloadFiles:s}=e;return n.id?(t=(0,m.S1)(n.id),i=n.has_preview_image?(0,m.cV)(n.id):t):(t=n.link,i=n.link),s?((0,M.ti)(n.extension)===g.a0.SVG&&(l={width:n.width,height:"auto"}),r().createElement("a",{className:"image_preview",href:"#"},r().createElement("img",{className:"image_preview__image",loading:"lazy","data-testid":"imagePreview",alt:"preview url image",src:i,style:l}))):r().createElement("img",{src:i})}J.propTypes={canDownloadFiles:n().bool.isRequired};var Q,Y,$,ee=i(46177),te=i.n(ee);class ie extends r().PureComponent{render(){const e=[];let t=null;if(this.props.showZoomControls){let i,l,n;l=this.props.scale&&this.props.scale>g.tR.MIN_SCALE?r().createElement("span",{className:"modal-zoom-btn"},r().createElement("a",{onClick:this.props.handleZoomOut&&te()(this.props.handleZoomOut,300,{maxWait:300})},r().createElement("i",{className:"icon icon-minus"}))):r().createElement("span",{className:"btn-inactive"},r().createElement("i",{className:"icon icon-minus"})),e.push(r().createElement(U.A,{key:"zoomOut",title:r().createElement(d.FormattedMessage,{id:"view_image.zoom_out",defaultMessage:"Zoom Out"})},l)),i=this.props.scale&&this.props.scale>g.tR.DEFAULT_SCALE?r().createElement("span",{className:"modal-zoom-btn"},r().createElement("a",{onClick:this.props.handleZoomReset},r().createElement("i",{className:"icon icon-magnify-minus"}))):this.props.scale&&this.props.scale<g.tR.DEFAULT_SCALE?r().createElement("span",{className:"modal-zoom-btn"},r().createElement("a",{onClick:this.props.handleZoomReset},r().createElement("i",{className:"icon icon-magnify-plus"}))):r().createElement("span",{className:"btn-inactive"},r().createElement("i",{className:"icon icon-magnify-minus"})),e.push(r().createElement(U.A,{key:"zoomReset",title:r().createElement(d.FormattedMessage,{id:"view_image.zoom_reset",defaultMessage:"Reset Zoom"})},i)),n=this.props.scale&&this.props.scale<g.tR.MAX_SCALE?r().createElement("span",{className:"modal-zoom-btn"},r().createElement("a",{onClick:this.props.handleZoomIn&&te()(this.props.handleZoomIn,300,{maxWait:300})},r().createElement("i",{className:"icon icon-plus"}))):r().createElement("span",{className:"btn-inactive"},r().createElement("i",{className:"icon icon-plus"})),e.push(r().createElement(U.A,{key:"zoomIn",title:r().createElement(d.FormattedMessage,{id:"view_image.zoom_in",defaultMessage:"Zoom In"})},n)),t=r().createElement("div",{className:"modal-column"},e)}return r().createElement("div",{"data-testid":"fileCountFooter",className:"modal-button-bar file-preview-modal__zoom-bar"},t)}}Q=ie,Y="propTypes",$={scale:n().number,showZoomControls:n().bool,handleZoomIn:n().func,handleZoomOut:n().func,handleZoomReset:n().func},(Y=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var i=t.call(e,"string");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(Y))in Q?Object.defineProperty(Q,Y,{value:$,enumerable:!0,configurable:!0,writable:!0}):Q[Y]=$;const le=ie;function ne(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);t&&(l=l.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,l)}return i}function se(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?ne(Object(i),!0).forEach((function(t){ae(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):ne(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}function ae(e,t,i){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var i=t.call(e,"string");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}const oe=r().lazy((()=>Promise.all([i.e(1959),i.e(5660)]).then(i.bind(i,25660)))),re=g.Ay.KeyCodes;class ce extends r().PureComponent{constructor(e){super(e),ae(this,"handleNext",(()=>{let e=this.state.imageIndex+1;e>this.props.fileInfos.length-1&&(e=0),this.showImage(e)})),ae(this,"handlePrev",(()=>{let e=this.state.imageIndex-1;e<0&&(e=this.props.fileInfos.length-1),this.showImage(e)})),ae(this,"handleKeyPress",(e=>{N.e(e,re.RIGHT)?this.handleNext():N.e(e,re.LEFT)&&this.handlePrev()})),ae(this,"showImage",(e=>{this.setState({imageIndex:e});const t=window.innerHeight-100;this.setState({imageHeight:t}),this.state.loaded[e]||this.loadImage(e)})),ae(this,"loadImage",(e=>{const t=this.props.fileInfos[e];if(T(t)&&t.archived)this.handleImageLoaded(e);else if(M.ti(t.extension)===g.a0.IMAGE&&T(t)){let i;i=t.has_preview_image?(0,m.cV)(t.id):(0,m.w8)(t.id),M.yt(i,(()=>this.handleImageLoaded(e)),(t=>this.handleImageProgress(e,t)))}else this.handleImageLoaded(e)})),ae(this,"handleImageLoaded",(e=>{this.setState((t=>({loaded:se(se({},t.loaded),{},{[e]:!0})})))})),ae(this,"handleImageProgress",((e,t)=>{this.setState((i=>({progress:se(se({},i.progress),{},{[e]:t})})))})),ae(this,"onMouseEnterImage",(()=>{this.setState({showCloseBtn:!0})})),ae(this,"onMouseLeaveImage",(()=>{this.setState({showCloseBtn:!1})})),ae(this,"setScale",((e,t)=>{this.setState((i=>({scale:se(se({},i.scale),{},{[e]:t})})))})),ae(this,"handleZoomIn",(()=>{let e=this.state.scale[this.state.imageIndex];e=Math.min(e+g.tR.SCALE_DELTA,g.tR.MAX_SCALE),this.setScale(this.state.imageIndex,e)})),ae(this,"handleZoomOut",(()=>{let e=this.state.scale[this.state.imageIndex];e=Math.max(e-g.tR.SCALE_DELTA,g.tR.MIN_SCALE),this.setScale(this.state.imageIndex,e)})),ae(this,"handleZoomReset",(()=>{this.setScale(this.state.imageIndex,g.tR.DEFAULT_SCALE)})),ae(this,"handleModalClose",(()=>{this.setState({show:!1})})),ae(this,"getContent",(e=>{this.setState({content:e})})),ae(this,"handleBgClose",(e=>{e.currentTarget===e.target&&this.handleModalClose()})),this.state={show:!0,imageIndex:this.props.startIndex,imageHeight:"100%",loaded:M.lI(!1,this.props.fileInfos.length),prevFileInfosCount:0,progress:M.lI(0,this.props.fileInfos.length),showCloseBtn:!1,showZoomControls:!1,scale:M.lI(g.tR.DEFAULT_SCALE,this.props.fileInfos.length),content:""}}componentDidMount(){document.addEventListener("keyup",this.handleKeyPress),this.showImage(this.props.startIndex)}componentWillUnmount(){document.removeEventListener("keyup",this.handleKeyPress)}static getDerivedStateFromProps(e,t){const i={};return e.fileInfos[t.imageIndex]&&e.fileInfos[t.imageIndex].extension===g.a0.PDF?i.showZoomControls=!0:i.showZoomControls=!1,e.fileInfos.length!==t.prevFileInfosCount&&(i.loaded=M.lI(!1,e.fileInfos.length),i.progress=M.lI(0,e.fileInfos.length),i.prevFileInfosCount=e.fileInfos.length),Object.keys(i).length?i:null}render(){var e;if(this.props.fileInfos.length<1||this.props.fileInfos.length-1<this.state.imageIndex)return null;const t=this.props.fileInfos[this.state.imageIndex],i=M.ti(t.extension);let l,n,s,o,h,f=!1;T(t)?(l=!0,n=t.name,s=(0,m.w8)(t.id),o=(0,m.S1)(t.id),h=!1):(l=!1,n=t.name||t.link,s=t.link,o=t.link,h=!0);let u,E,w="a11y__modal modal-image file-preview-modal";if(T(t)&&t.archived&&(u=r().createElement(p,{fileInfo:t})),!T(t)||!t.archived)if(this.state.loaded[this.state.imageIndex])i===g.a0.IMAGE||i===g.a0.SVG?u=r().createElement(J,{fileInfo:t,canDownloadFiles:this.props.canDownloadFiles}):i===g.a0.VIDEO||i===g.a0.AUDIO?u=r().createElement(b,{fileInfo:t,fileUrl:s}):i===g.a0.PDF?(u=r().createElement("div",{className:"file-preview-modal__scrollable",onClick:this.handleBgClose},r().createElement(r().Suspense,{fallback:null},r().createElement(oe,{fileInfo:t,fileUrl:s,scale:this.state.scale[this.state.imageIndex],handleBgClose:this.handleBgClose}))),E=r().createElement(le,{scale:this.state.scale[this.state.imageIndex],showZoomControls:this.state.showZoomControls,handleZoomIn:this.handleZoomIn,handleZoomOut:this.handleZoomOut,handleZoomReset:this.handleZoomReset})):C.supports(t)?(w+=" modal-code",f=!0,u=r().createElement(C,{fileInfo:t,fileUrl:s,getContent:this.getContent,className:"file-preview-modal__code-preview"})):u=r().createElement(v.A,{fileInfo:t,fileUrl:s});else{const e=Math.floor(this.state.progress[this.state.imageIndex]);u=r().createElement(R.A,{loading:r().createElement(d.FormattedMessage,{id:"view_image.loading",defaultMessage:"Loading"}),progress:e})}if(T(t)&&!t.archived)for(const e of this.props.pluginFilePreviewComponents)if(e.override(t,this.props.post)){u=r().createElement(e.component,{fileInfo:t,post:this.props.post,onModalDismissed:this.handleModalClose});break}return r().createElement(c.Modal,{show:this.state.show,onHide:this.handleModalClose,onExited:this.props.onExited,className:"modal-image file-preview-modal",dialogClassName:w,animation:!0,backdrop:!1,role:"none",style:{paddingLeft:0},"aria-labelledby":"viewImageModalLabel"},r().createElement(c.Modal.Body,{className:"file-preview-modal__body"},r().createElement("div",{className:"modal-image__wrapper",onClick:this.handleModalClose},r().createElement("div",{className:"file-preview-modal__main-ctr",onMouseEnter:this.onMouseEnterImage,onMouseLeave:this.onMouseLeaveImage,onClick:e=>e.stopPropagation()},r().createElement(c.Modal.Title,{componentClass:"div",id:"viewImageModalLabel",className:"file-preview-modal__title"},r().createElement(K,{isMobileView:this.props.isMobileView,post:this.props.post,showPublicLink:l,fileIndex:this.state.imageIndex,totalFiles:null===(e=this.props.fileInfos)||void 0===e?void 0:e.length,filename:n,fileURL:o,fileInfo:t,enablePublicLink:this.props.enablePublicLink,canDownloadFiles:this.props.canDownloadFiles,canCopyContent:f,isExternalFile:h,handlePrev:this.handlePrev,handleNext:this.handleNext,handleModalClose:this.handleModalClose,content:this.state.content}),E),r().createElement("div",{className:a()("file-preview-modal__content",{"file-preview-modal__content-scrollable":(!T(t)||!t.archived)&&this.state.loaded[this.state.imageIndex]&&i===g.a0.PDF}),onClick:this.handleBgClose},u),this.props.isMobileView&&r().createElement(B,{post:this.props.post,showPublicLink:l,filename:n,fileURL:o,fileInfo:t,enablePublicLink:this.props.enablePublicLink,canDownloadFiles:this.props.canDownloadFiles,canCopyContent:f,isExternalFile:h,handleModalClose:this.handleModalClose,content:this.state.content})))))}}ae(ce,"propTypes",{canDownloadFiles:n().bool.isRequired,enablePublicLink:n().bool.isRequired,isMobileView:n().bool.isRequired,pluginFilePreviewComponents:n().array,onExited:n().func.isRequired,postId:n().string,startIndex:n().number}),ae(ce,"defaultProps",{fileInfos:[],startIndex:0,pluginFilePreviewComponents:[]})}}]); //# sourceMappingURL=11.88c2898b3db4047b1024.js.map