mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-20 10:58:33 +00:00
1 line
48 KiB
JavaScript
1 line
48 KiB
JavaScript
"use strict";(self.webpackChunkseahub_frontend=self.webpackChunkseahub_frontend||[]).push([[7866],{88002:function(e,t,a){a.d(t,{A:function(){return m}});var s=a(23029),i=a(92901),n=a(39874),o=a(85501),r=a(9950),l=a(58195),d=a(14113),c=a(99308),p=a(40326),h=a(44414),u=function(e){function t(){return(0,s.A)(this,t),(0,n.A)(this,t,arguments)}return(0,o.A)(t,e),(0,i.A)(t,[{key:"render",value:function(){var e=this.props,t=e.type,a=e.asyncOperationProgress,s=e.asyncOperatedFilesLength,i="move"===t?(0,p.AP)("Move {num} items"):(0,p.AP)("Copy {num} items");i=i.replace("{num}",s);var n={width:a+"%",lineHeight:"40px",textAlign:"left"};return(0,h.jsxs)(l.A,{isOpen:!0,toggle:this.props.toggleDialog,className:"copy-move-dirent-progress-dialog",children:[(0,h.jsx)(d.A,{toggle:this.props.toggleDialog,children:i}),(0,h.jsx)(c.A,{children:(0,h.jsx)("div",{className:"progress",children:(0,h.jsx)("div",{className:"progress-bar pl-2",role:"progressbar",style:n,"aria-valuenow":a,"aria-valuemin":"0","aria-valuemax":"100",children:a+"%"})})})]})}}])}(r.Component),m=u},2949:function(e,t,a){a.d(t,{Tb:function(){return s},XU:function(){return n},Ys:function(){return o},nj:function(){return i}});var s="list",i="grid",n="detail",o="metadata"},39143:function(e,t,a){a.d(t,{A:function(){return F}});var s=a(23029),i=a(92901),n=a(39874),o=a(85501),r=a(9950),l=a(40866),d=a(58195),c=a(14113),p=a(99308),h=a(85907),u=a(18849),m=a(4159),g=a.n(m),f=a(40326),x=a(97011),v=a(65604),b=a(4086),A=a(44414),j=function(e){function t(e){var a;return(0,s.A)(this,t),(a=(0,n.A)(this,t,[e])).onFileTagChanged=function(e){var t=e.parent_path,s={name:e.filename},i="/"===t?t+e.filename:t+"/"+e.filename;a.props.onFileTagChanged(s,i)},a.onDeleteTaggedFile=function(e){var t=a.props.repoID,s=e.file_tag_id;x.e.deleteFileTag(t,s).then((function(t){a.getTaggedFiles(),a.props.updateUsedRepoTags(),a.props.onFileTagChanged&&!e.file_deleted&&a.onFileTagChanged(e)})).catch((function(e){var t=v.Aq.getErrorMsg(e);b.A.danger(t)}))},a.getTaggedFiles=function(){var e=a.props,t=e.repoID,s=e.currentTag,i=e.shareLinkToken;(i?x.e.getShareLinkTaggedFiles(i,s.id):x.e.listTaggedFiles(t,s.id)).then((function(e){var t=[];void 0!==e.data.tagged_files&&e.data.tagged_files.forEach((function(e){var a=e;t.push(a)})),a.setState({taggedFileList:t})})).catch((function(e){var t=v.Aq.getErrorMsg(e);b.A.danger(t)}))},a.state={taggedFileList:[]},a}return(0,o.A)(t,e),(0,i.A)(t,[{key:"componentDidMount",value:function(){this.getTaggedFiles()}},{key:"render",value:function(){var e=this,t=this.state.taggedFileList;return(0,A.jsxs)(d.A,{isOpen:!0,style:{maxWidth:"678px"},children:[(0,A.jsx)(c.A,{toggle:this.props.onClose,children:(0,f.AP)("Tagged Files")}),(0,A.jsx)(p.A,{className:"dialog-list-container",children:(0,A.jsxs)("table",{children:[(0,A.jsx)("thead",{children:(0,A.jsxs)("tr",{children:[(0,A.jsx)("th",{width:"50%",className:"ellipsis",children:(0,f.AP)("Name")}),(0,A.jsx)("th",{width:"20%",children:(0,f.AP)("Size")}),(0,A.jsx)("th",{width:"22%",children:(0,f.AP)("Last Update")}),(0,A.jsx)("th",{width:"8%"})]})}),(0,A.jsx)("tbody",{children:t.map((function(t,a){return(0,A.jsx)(S,{repoID:e.props.repoID,taggedFile:t,onDeleteTaggedFile:e.onDeleteTaggedFile,shareLinkToken:e.props.shareLinkToken,enableFileDownload:e.props.enableFileDownload},a)}))})]})}),(0,A.jsx)(h.A,{children:(0,A.jsx)(u.A,{color:"secondary",onClick:this.props.toggleCancel,children:(0,f.AP)("Close")})})]})}}])}(r.Component),S=function(e){function t(e){var a;return(0,s.A)(this,t),(a=(0,n.A)(this,t,[e])).onMouseEnter=function(){a.setState({active:!0})},a.onMouseLeave=function(){a.setState({active:!1})},a.deleteFile=function(e){e.preventDefault(),a.props.onDeleteTaggedFile(a.props.taggedFile)},a.state={active:!1},a}return(0,o.A)(t,e),(0,i.A)(t,[{key:"render",value:function(){var e=this.props,t=e.taggedFile,a=e.shareLinkToken,s=e.enableFileDownload,i=t.parent_path?v.Aq.joinPath(t.parent_path,t.filename):"",n=a?f.Yc+"d/"+a+"/files/?p="+v.Aq.encodePath(i):f.Yc+"lib/"+this.props.repoID+"/file"+v.Aq.encodePath(i);return(0,A.jsxs)("tr",{onMouseEnter:this.onMouseEnter,onMouseLeave:this.onMouseLeave,onFocus:this.onMouseEnter,children:[t.file_deleted?(0,A.jsx)(r.Fragment,{children:(0,A.jsxs)("td",{colSpan:"3",className:"name",children:[t.filename," ",(0,A.jsx)("span",{style:{color:"red"},children:(0,f.AP)("deleted")})]})}):(0,A.jsxs)(r.Fragment,{children:[(0,A.jsx)("td",{children:(0,A.jsx)("a",{href:n,target:"_blank",className:"d-inline-block w-100 ellipsis",title:t.filename,rel:"noreferrer",children:t.filename})}),(0,A.jsx)("td",{children:v.Aq.bytesToSize(t.size)}),(0,A.jsx)("td",{children:g().unix(t.mtime).fromNow()})]}),(0,A.jsxs)("td",{children:[!a&&(0,A.jsx)("a",{href:"#",role:"button","aria-label":(0,f.AP)("Delete"),title:(0,f.AP)("Delete"),className:"action-icon sf2-icon-x3".concat(this.state.active?"":" invisible"),onClick:this.deleteFile}),a&&s&&(0,A.jsx)("a",{className:"action-icon sf2-icon-download".concat(this.state.active?"":" invisible"),href:"".concat(n,"&dl=1"),title:(0,f.AP)("Download"),"aria-label":(0,f.AP)("Download")})]})]})}}])}(r.Component),F=function(e){function t(e){var a;return(0,s.A)(this,t),(a=(0,n.A)(this,t,[e])).onListTaggedFiles=function(e){a.setState({currentTag:e,isListTaggedFileShow:!a.state.isListTaggedFileShow})},a.onCloseDialog=function(){a.setState({isListTaggedFileShow:!1})},a.state={currentTag:null,isListTaggedFileShow:!1},a}return(0,o.A)(t,e),(0,i.A)(t,[{key:"render",value:function(){var e=this,t=this.props,a=t.repoID,s=t.usedRepoTags,i=t.className;return(0,A.jsxs)("div",{className:"repo-info-bar ".concat(i||""),children:[s.length>0&&(0,A.jsx)("ul",{className:"used-tag-list",children:s.map((function(t){return(0,A.jsxs)("li",{className:"used-tag-item",children:[(0,A.jsx)("span",{className:"used-tag",style:{backgroundColor:t.color}}),(0,A.jsx)("span",{className:"used-tag-name",title:t.name,children:t.name}),(0,A.jsx)("button",{type:"button",className:"used-tag-files border-0 bg-transparent",onClick:e.onListTaggedFiles.bind(e,t),children:t.fileCount>1?t.fileCount+" files":t.fileCount+" file"})]},t.id)}))}),this.state.isListTaggedFileShow&&(0,A.jsx)(l.A,{children:(0,A.jsx)(j,{repoID:a,currentTag:this.state.currentTag,onClose:this.onCloseDialog,toggleCancel:this.onListTaggedFiles,updateUsedRepoTags:this.props.updateUsedRepoTags,onFileTagChanged:this.props.onFileTagChanged,shareLinkToken:this.props.shareLinkToken,enableFileDownload:this.props.enableFileDownload})})]})}}])}(r.Component)},25531:function(e,t,a){var s=a(92901),i=a(23029),n=(0,s.A)((function e(t){(0,i.A)(this,e),this.id=t.repo_tag_id,this.fileCount=t.files_count||0,this.name=t.tag_name,this.color=t.tag_color}));t.A=n},23088:function(e,t,a){var s=a(90675),i=a(10467),n=a(23029),o=a(92901),r=a(39874),l=a(85501),d=a(9950),c=a(72517),p=a.n(c),h=a(17119),u=a(18849),m=a(19260),g=a(6030),f=a(68879),x=a(78297),v=a(4159),b=a.n(v),A=a(37609),j=a.n(A),S=a(51925),F=a(40326),k=a(65604),w=a(97011),C=a(81446),P=a(4086),y=a(40866),I=a(16670),D=a(60472),N=a(60436),U=a(68238),_=a.n(U),M=a(44414),L="uploading",O="error",T="isSaving",z="uploaded",q=function(e){function t(e){var a;return(0,n.A)(this,t),(a=(0,r.A)(this,t,[e])).onUploadCancel=function(e){e.preventDefault(),a.props.onUploadCancel(a.props.resumableFile)},a.onUploadRetry=function(e){e.preventDefault(),a.props.onUploadRetry(a.props.resumableFile)},a.formatFileSize=function(e){return"number"!==typeof e?"":e>=1e9?(e/1e9).toFixed(1)+" G":e>=1e6?(e/1e6).toFixed(1)+" M":e>=1e3?(e/1e3).toFixed(1)+" K":e.toFixed(1)+" B"},a.state={uploadState:L},a}return(0,l.A)(t,e),(0,o.A)(t,[{key:"UNSAFE_componentWillReceiveProps",value:function(e){var t=e.resumableFile,a=L;t.error?a=O:(0!==t.remainingTime||t.isSaved||(a=T),t.isSaved&&(a=z)),this.setState({uploadState:a})}},{key:"render",value:function(){var e=this.props.resumableFile,t=Math.round(100*e.progress()),a=e.error;return(0,M.jsxs)("tr",{className:"file-upload-item",children:[(0,M.jsx)("td",{className:"upload-name",children:(0,M.jsx)("div",{className:"ellipsis",children:e.newFileName})}),(0,M.jsx)("td",{children:(0,M.jsx)("span",{className:"file-size",children:this.formatFileSize(e.size)})}),(0,M.jsxs)("td",{className:"upload-progress",children:[(this.state.uploadState===L||this.state.uploadState===T)&&(0,M.jsxs)(d.Fragment,{children:[e.size>=1e8&&(0,M.jsxs)(d.Fragment,{children:[e.isUploading()&&(0,M.jsxs)("div",{className:"progress-container",children:[(0,M.jsx)("div",{className:"progress",children:(0,M.jsx)("div",{className:"progress-bar",role:"progressbar",style:{width:"".concat(t,"%")},"aria-valuenow":t,"aria-valuemin":"0","aria-valuemax":"100"})}),-1===e.remainingTime&&(0,M.jsx)("div",{className:"progress-text",children:(0,F.AP)("Preparing to upload...")}),e.remainingTime>0&&(0,M.jsxs)("div",{className:"progress-text",children:[(0,F.AP)("Remaining")," ",k.Aq.formatTime(e.remainingTime)]}),0===e.remainingTime&&(0,M.jsx)("div",{className:"progress-text",children:(0,F.AP)("Saving...")})]}),!e.isUploading()&&(0,M.jsx)("div",{className:"progress-container d-flex align-items-center",children:(0,M.jsx)("div",{className:"progress",children:(0,M.jsx)("div",{className:"progress-bar",role:"progressbar",style:{width:"".concat(t,"%")},"aria-valuenow":t,"aria-valuemin":"0","aria-valuemax":"100"})})})]}),e.size<1e8&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)("div",{className:"progress-container d-flex align-items-center",children:(0,M.jsx)("div",{className:"progress",children:(0,M.jsx)("div",{className:"progress-bar",role:"progressbar",style:{width:"".concat(t,"%")},"aria-valuenow":t,"aria-valuemin":"0","aria-valuemax":"100"})})}),this.state.uploadState===L&&(0,M.jsxs)(M.Fragment,{children:[0==t&&(0,M.jsx)("p",{className:"progress-text mb-0",children:(0,F.AP)("Waiting...")}),t>0&&(0,M.jsx)("p",{className:"progress-text mb-0",children:"".concat((0,F.AP)("Uploading...")," ").concat(t,"%")})]}),this.state.uploadState===T&&(0,M.jsx)("p",{className:"progress-text mb-0",children:(0,F.AP)("Saving...")})]})]}),this.state.uploadState===z&&(0,M.jsxs)("div",{className:"d-flex align-items-center",children:[(0,M.jsx)("span",{className:"upload-success-icon sf2-icon-tick mr-2"}),(0,M.jsx)("span",{className:"upload-success-msg",children:(0,F.AP)("Uploaded")})]}),this.state.uploadState===O&&(0,M.jsxs)("div",{className:"d-flex align-items-center",children:[(0,M.jsx)("span",{className:"upload-failure-icon sf3-font sf3-font-info mr-2"}),(0,M.jsx)("span",{className:"upload-failure-msg",dangerouslySetInnerHTML:{__html:a}})]})]}),(0,M.jsx)("td",{className:"upload-operation",children:(0,M.jsxs)(d.Fragment,{children:[this.state.uploadState===L&&(0,M.jsx)("a",{href:"#",onClick:this.onUploadCancel,role:"button",children:(0,F.AP)("Cancel")}),this.state.uploadState===O&&(0,M.jsx)("a",{href:"#",onClick:this.onUploadRetry,role:"button",children:(0,F.AP)("Retry")})]})})]})}}])}(d.Component),R=function(e){function t(){return(0,n.A)(this,t),(0,r.A)(this,t,arguments)}return(0,l.A)(t,e),(0,o.A)(t,[{key:"render",value:function(){var e=this.props.file;return(0,M.jsxs)("tr",{className:"file-upload-item",children:[(0,M.jsx)("td",{className:"upload-name",children:(0,M.jsx)("div",{className:"ellipsis",title:e.name,children:e.name})}),(0,M.jsx)("td",{children:k.Aq.bytesToSize(e.size)}),(0,M.jsx)("td",{children:(0,M.jsxs)("div",{className:"d-flex align-items-center",children:[(0,M.jsx)("span",{className:"upload-failure-icon sf3-font sf3-font-info mr-2"}),(0,M.jsx)("span",{className:"upload-failure-msg",children:(0,F.AP)("File too large")})]})}),(0,M.jsx)("td",{})]})}}])}(d.Component),E=R,B=function(e){function t(e){var a;return(0,n.A)(this,t),(a=(0,r.A)(this,t,[e])).onCancelAllUploading=function(){a.props.onCancelAllUploading()},a.onMinimizeUpload=function(e){e.nativeEvent.stopImmediatePropagation(),a.setState({isMinimized:!a.state.isMinimized})},a.onCloseUpload=function(e){e.nativeEvent.stopImmediatePropagation(),a.props.onCloseUploadDialog()},a.state={isMinimized:!1},a}return(0,l.A)(t,e),(0,o.A)(t,[{key:"render",value:function(){var e,t=this,a=this.props,s=a.totalProgress,i=a.retryFileList,n=a.uploadBitrate,o=a.uploadFileList,r=a.forbidUploadFileList,l=a.isUploading,d=(0,F.AP)("{uploaded_files_num}/{all_files_num} Files").replace("{uploaded_files_num}",o.filter((function(e){return e.isSaved})).length).replace("{all_files_num}",o.length);if(!l){var c=o.filter((function(e){return e.error})).length+r.length;c>0&&(e=(0,F.AP)("{failed_files_num} file(s) failed to upload").replace("{failed_files_num}",c))}return(0,M.jsxs)("div",{className:"uploader-list-view mw-100",style:{height:this.state.isMinimized?document.querySelector(".uploader-list-header").offsetHeight:"20rem"},children:[(0,M.jsxs)("div",{className:"uploader-list-header flex-shrink-0",children:[(0,M.jsx)("div",{children:l?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)("span",{children:(0,F.AP)("File Uploading...")}),(0,M.jsx)("span",{className:"ml-2",children:"".concat(s,"% (").concat(k.Aq.formatBitRate(n),")")}),(0,M.jsx)("div",{className:"progress",children:(0,M.jsx)("div",{className:"progress-bar",role:"progressbar",style:{width:"".concat(s,"%")},"aria-valuenow":s,"aria-valuemin":"0","aria-valuemax":"100"})})]}):(0,M.jsx)(M.Fragment,{children:e?(0,M.jsx)("p",{className:"m-0 error",children:e}):(0,M.jsx)("p",{className:"m-0",children:(0,F.AP)("All files uploaded")})})}),(0,M.jsxs)("div",{className:"upload-dialog-op-container",children:[(0,M.jsx)("span",{className:"sf2-icon-minus upload-dialog-op",onClick:this.onMinimizeUpload}),!l&&(0,M.jsx)("span",{className:"sf2-icon-x1 upload-dialog-op",onClick:this.onCloseUpload})]})]}),(0,M.jsxs)("div",{className:"uploader-list-content",children:[(0,M.jsxs)("div",{className:"d-flex justify-content-between align-items-center border-bottom uploader-content-bar",children:[o.length>0&&(0,M.jsx)("span",{children:d}),(0,M.jsxs)("div",{className:"ml-auto",children:[(0,M.jsx)("button",{className:"btn btn-lg border-0 background-transparent px-0",onClick:this.props.onUploadRetryAll,disabled:0==i.length,children:(0,F.AP)("Retry All")}),(0,M.jsx)("button",{className:"btn btn-lg border-0 background-transparent px-0 ml-3",onClick:this.props.onCancelAllUploading,disabled:!l,children:(0,F.AP)("Cancel All")})]})]}),(0,M.jsxs)("table",{className:"table-thead-hidden",children:[(0,M.jsx)("thead",{children:(0,M.jsxs)("tr",{children:[(0,M.jsx)("th",{width:"40%",children:(0,F.AP)("name")}),(0,M.jsx)("th",{width:"15%",children:(0,F.AP)("size")}),(0,M.jsx)("th",{width:"30%",children:(0,F.AP)("progress")}),(0,M.jsx)("th",{width:"15%",children:(0,F.AP)("state")})]})}),(0,M.jsxs)("tbody",{children:[this.props.forbidUploadFileList.map((function(e,t){return(0,M.jsx)(E,{file:e},t)})),this.props.uploadFileList.map((function(e,a){return(0,M.jsx)(q,{resumableFile:e,onUploadCancel:t.props.onUploadCancel,onUploadRetry:t.props.onUploadRetry},a)}))]})]})]})]})}}])}(d.Component),Y=(a(89183),function(e){function t(e){var a;return(0,n.A)(this,t),(a=(0,r.A)(this,t,[e])).componentWillUnmount=function(){window.onbeforeunload=null,!0===a.props.dragAndDrop&&a.resumable.disableDropOnDocument()},a.onbeforeunload=function(){if(window.uploader&&window.uploader.isUploadProgressDialogShow&&100!==window.uploader.totalProgress)return""},a.bindCallbackHandler=function(){var e=a.props,t=e.minFileSizeErrorCallback,s=e.fileTypeErrorCallback;a.maxFilesErrorCallback&&(a.resumable.opts.maxFilesErrorCallback=a.maxFilesErrorCallback),t&&(a.resumable.opts.minFileSizeErrorCallback=a.props.minFileSizeErrorCallback),a.maxFileSizeErrorCallback&&(a.resumable.opts.maxFileSizeErrorCallback=a.maxFileSizeErrorCallback),s&&(a.resumable.opts.fileTypeErrorCallback=a.props.fileTypeErrorCallback)},a.bindEventHandler=function(){a.resumable.on("chunkingComplete",a.onChunkingComplete.bind(a)),a.resumable.on("fileAdded",a.onFileAdded.bind(a)),a.resumable.on("filesAddedComplete",a.filesAddedComplete.bind(a)),a.resumable.on("fileProgress",a.onFileProgress.bind(a)),a.resumable.on("fileSuccess",a.onFileUploadSuccess.bind(a)),a.resumable.on("progress",a.onProgress.bind(a)),a.resumable.on("complete",a.onComplete.bind(a)),a.resumable.on("pause",a.onPause.bind(a)),a.resumable.on("fileRetry",a.onFileRetry.bind(a)),a.resumable.on("fileError",a.onFileError.bind(a)),a.resumable.on("error",a.onError.bind(a)),a.resumable.on("beforeCancel",a.onBeforeCancel.bind(a)),a.resumable.on("cancel",a.onCancel.bind(a)),a.resumable.on("dragstart",a.onDragStart.bind(a))},a.maxFilesErrorCallback=function(e,t){var a=F.YX,s=(0,F.AP)("Please upload no more than {maxFiles} files at a time.");s=s.replace("{maxFiles}",a),P.A.danger(s)},a.maxFileSizeErrorCallback=function(e){var t=a.state.forbidUploadFileList;t.push(e),a.setState({forbidUploadFileList:t})},a.onChunkingComplete=function(e){var t="/"===a.props.path?"/":a.props.path+"/",s=e.fileName,i=e.relativePath,n=s===i;if(e.formData={},n)e.formData={parent_dir:t};else{var o=i.slice(0,i.lastIndexOf("/")+1);e.formData={parent_dir:t,relative_path:o}}},a.onFileAdded=function(e,t){if(e.fileName===e.relativePath&&1===t.length){a.setUploadFileList(a.resumable.files);var s=a.props,i=s.token,n=s.relativePath;w.e.sharedLinkGetFileUploadUrl(i,n).then((function(t){a.resumable.opts.target=t.data.upload_link+"?ret-json=1",a.resumableUpload(e)})).catch((function(e){var t=k.Aq.getErrorMsg(e);P.A.danger(t)}))}else if(a.setUploadFileList(a.resumable.files),!a.isUploadLinkLoaded){a.isUploadLinkLoaded=!0;var o=a.props,r=o.token,l=o.relativePath;w.e.sharedLinkGetFileUploadUrl(r,l).then((function(e){a.resumable.opts.target=e.data.upload_link+"?ret-json=1",a.resumable.upload()})).catch((function(e){var t=k.Aq.getErrorMsg(e);P.A.danger(t)}))}},a.resumableUpload=function(e){var t=a.props,s=t.repoID,i=t.path;w.e.getFileUploadedBytes(s,i,e.fileName).then((function(t){var s=t.data.uploadedBytes,i=1024*parseInt(F.QV)*1024||1048576,n=Math.floor(s/i);e.markChunksCompleted(n),a.resumable.upload()})).catch((function(e){var t=k.Aq.getErrorMsg(e);P.A.danger(t)}))},a.filesAddedComplete=function(e,t){a.state.forbidUploadFileList.length>0&&0===t.length&&a.setState({isUploadProgressDialogShow:!0,totalProgress:100})},a.setUploadFileList=function(){var e=a.resumable.files;a.setState({uploadFileList:e,isUploadProgressDialogShow:!0}),k.Aq.registerGlobalVariable("uploader","isUploadProgressDialogShow",!0)},a.onFileProgress=function(e){var t=a.getBitrate(),s=a.state.uploadFileList.map((function(a){if(a.uniqueIdentifier===e.uniqueIdentifier&&t){var s=8*(a.size-a.size*a.progress()),i=Math.floor(s/t);a.remainingTime=i}return a}));a.setState({uploadBitrate:t,uploadFileList:s})},a.getBitrate=function(){var e=0,t=0,s=(new Date).getTime();if(a.resumable.files.forEach((function(t){e+=t.progress()*t.size})),a.timestamp){var i=s-a.timestamp;if(i<a.bitrateInterval)return a.state.uploadBitrate;(e<a.loaded||0===a.loaded)&&(a.loaded=e),t=(e-a.loaded)*(1e3/i)*8}return a.timestamp=s,a.loaded=e,t},a.onProgress=function(){var e=Math.round(100*a.resumable.progress());a.setState({totalProgress:e}),k.Aq.registerGlobalVariable("uploader","totalProgress",e)},a.onFileUploadSuccess=function(e,t){var s=e.formData,i=(new Date).getTime()/1e3;t=s.replace?t:JSON.parse(t)[0],s.relative_path;var n={id:t.id,type:"file",name:t.name,size:t.size,mtime:i};a.props.onFileUploadSuccess(n);var o=a.state.uploadFileList.map((function(a){return a.uniqueIdentifier===e.uniqueIdentifier&&(a.newFileName=t.name,a.isSaved=!0),a}));a.setState({uploadFileList:o})},a.onFileError=function(e,t){var s="";if(t){var i=t.replace(/\n/g,"");i=JSON.parse(i),"File locked by others."===(s=i.error)&&(s=(0,F.AP)("File is locked by others.")),"Internal error."===s&&(s=(0,F.AP)("Internal Server Error"))}else s=(0,F.AP)("Network error");var n=a.state.uploadFileList.map((function(t){return t.uniqueIdentifier===e.uniqueIdentifier&&(a.state.retryFileList.push(t),t.error=s),t}));a.loaded=0,a.setState({retryFileList:a.state.retryFileList,uploadFileList:n})},a.onComplete=function(){a.notifiedFolders=[],a.isUploadLinkLoaded=!1},a.onPause=function(){},a.onError=function(e){a.isUploadLinkLoaded=!1,k.Aq.registerGlobalVariable("uploader","totalProgress",100)},a.onFileRetry=function(){},a.onBeforeCancel=function(){},a.onCancel=function(){},a.setHeaders=function(e,t){var a=t.offset,s=t.getOpt("chunkSize"),i=0===e.size?1:e.size,n=0!==a?a*s:0,o=Math.min(i,(a+1)*s)-1;return i-t.endByte<s&&!t.getOpt("forceChunkSize")&&(o=i),{Accept:"application/json; text/javascript, */*; q=0.01","Content-Disposition":'attachment; filename="'+encodeURI(e.fileName)+'"',"Content-Range":"bytes "+n+"-"+o+"/"+i}},a.setQuery=function(e){return e.formData},a.generateUniqueIdentifier=function(e){var t=e.webkitRelativePath||e.relativePath||e.fileName||e.name;return p()(t+new Date)+t},a.onClick=function(e){e.nativeEvent.stopImmediatePropagation(),e.stopPropagation()},a.onFileUpload=function(){a.uploadInput.current.removeAttribute("webkitdirectory"),a.uploadInput.current.click()},a.onFolderUpload=function(){a.uploadInput.current.setAttribute("webkitdirectory","webkitdirectory"),a.uploadInput.current.click()},a.onDragStart=function(){a.uploadInput.current.setAttribute("webkitdirectory","webkitdirectory")},a.onCloseUploadDialog=function(){a.loaded=0,a.resumable.files=[],a.isUploadLinkLoaded=!1,a.setState({isUploadProgressDialogShow:!1,uploadFileList:[],forbidUploadFileList:[]}),k.Aq.registerGlobalVariable("uploader","isUploadProgressDialogShow",!1)},a.onUploadCancel=function(e){var t=a.state.uploadFileList.filter((function(t){return t.uniqueIdentifier!==e.uniqueIdentifier||(t.cancel(),!1)}));a.resumable.isUploading()||(a.setState({totalProgress:100}),a.loaded=0),a.setState({uploadFileList:t})},a.onCancelAllUploading=function(){var e=a.state.uploadFileList.filter((function(e){return!Math.round(1!==e.progress())||(e.cancel(),!1)}));a.loaded=0,a.setState({totalProgress:100,uploadFileList:e}),a.isUploadLinkLoaded=!1},a.onUploadRetry=function(e){var t=a.props,s=t.token,i=t.relativePath;w.e.sharedLinkGetFileUploadUrl(s,i).then((function(t){a.resumable.opts.target=t.data.upload_link+"?ret-json=1";var s=a.state.retryFileList.filter((function(t){return t.uniqueIdentifier!==e.uniqueIdentifier})),i=a.state.uploadFileList.map((function(t){return t.uniqueIdentifier===e.uniqueIdentifier&&(t.error=null,a.retryUploadFile(t)),t}));a.setState({retryFileList:s,uploadFileList:i})})).catch((function(e){var t=k.Aq.getErrorMsg(e);P.A.danger(t)}))},a.onUploadRetryAll=function(){var e=a.props,t=e.token,s=e.relativePath;w.e.sharedLinkGetFileUploadUrl(t,s).then((function(e){a.resumable.opts.target=e.data.upload_link+"?ret-json=1",a.state.retryFileList.forEach((function(e){e.error=!1,a.retryUploadFile(e)}));var t=a.state.uploadFileList.slice(0);a.setState({retryFileList:[],uploadFileList:t})})).catch((function(e){var t=k.Aq.getErrorMsg(e);P.A.danger(t)}))},a.retryUploadFile=function(e){var t=a.props,s=t.repoID,i=t.path,n=e.fileName;if(!(e.fileName===e.relativePath)){var o=e.formData.relative_path;n=("/"===i?i+o:i+"/"+o)+n}e.bootstrap();var r=!1;e.resumableObj.on("chunkingComplete",(function(){r||w.e.getFileUploadedBytes(s,i,n).then((function(t){var a=t.data.uploadedBytes,s=1024*parseInt(F.QV)*1024||1048576,i=Math.floor(a/s);e.markChunksCompleted(i),e.resumableObj.upload()})).catch((function(e){var t=k.Aq.getErrorMsg(e);P.A.danger(t)})),r=!0}))},a.uploadFile=function(){var e=a.resumable.files[a.resumable.files.length-1],t=a.props,s=t.token,i=t.relativePath;w.e.sharedLinkGetFileUploadUrl(s,i).then((function(t){a.resumable.opts.target=t.data.upload_link+"?ret-json=1",a.setState({isUploadRemindDialogShow:!1,isUploadProgressDialogShow:!0,uploadFileList:[].concat((0,N.A)(a.state.uploadFileList),[e])},(function(){a.resumable.upload()})),k.Aq.registerGlobalVariable("uploader","isUploadProgressDialogShow",!0)})).catch((function(e){var t=k.Aq.getErrorMsg(e);P.A.danger(t)}))},a.cancelFileUpload=function(){a.resumable.files.pop(),a.setState({isUploadRemindDialogShow:!1})},a.state={retryFileList:[],uploadFileList:[],forbidUploadFileList:[],totalProgress:0,isUploadProgressDialogShow:!1,isUploadRemindDialogShow:!1,currentResumableFile:null,uploadBitrate:0},a.uploadInput=d.createRef(),a.notifiedFolders=[],a.timestamp=null,a.loaded=0,a.bitrateInterval=500,window.onbeforeunload=a.onbeforeunload,a.isUploadLinkLoaded=!1,a}return(0,l.A)(t,e),(0,o.A)(t,[{key:"componentDidMount",value:function(){this.resumable=new(_())({target:"",query:this.setQuery||{},fileType:this.props.filetypes,maxFiles:F.YX||void 0,maxFileSize:1e3*F.hn*1e3||void 0,testMethod:this.props.testMethod||"post",testChunks:this.props.testChunks||!1,headers:this.setHeaders||{},withCredentials:this.props.withCredentials||!1,chunkSize:1024*parseInt(F.QV)*1024||1048576,simultaneousUploads:this.props.simultaneousUploads||1,fileParameterName:this.props.fileParameterName,generateUniqueIdentifier:this.generateUniqueIdentifier,forceChunkSize:!0,maxChunkRetries:3,minFileSize:0}),this.resumable.assignBrowse(this.uploadInput.current,!0),!0===this.props.dragAndDrop&&this.resumable.enableDropOnDocument(),this.bindCallbackHandler(),this.bindEventHandler()}},{key:"render",value:function(){return(0,M.jsxs)(d.Fragment,{children:[(0,M.jsx)("div",{className:"file-uploader-container",children:(0,M.jsx)("div",{className:"file-uploader",children:(0,M.jsx)("input",{className:"upload-input",type:"file",ref:this.uploadInput,onClick:this.onClick,"aria-label":(0,F.AP)("Upload")})})}),this.state.isUploadProgressDialogShow&&(0,M.jsx)(B,{retryFileList:this.state.retryFileList,uploadFileList:this.state.uploadFileList,forbidUploadFileList:this.state.forbidUploadFileList,totalProgress:this.state.totalProgress,uploadBitrate:this.state.uploadBitrate,onCloseUploadDialog:this.onCloseUploadDialog,onCancelAllUploading:this.onCancelAllUploading,onUploadCancel:this.onUploadCancel,onUploadRetry:this.onUploadRetry,onUploadRetryAll:this.onUploadRetryAll,isUploading:this.resumable.isUploading()})]})}}])}(d.Component)),G=Y,Z=a(58195),V=a(14113),H=a(99308),Q=a(76115),X=a(85907),W=a(22695),$=function(e){function t(e){var a;return(0,n.A)(this,t),(a=(0,r.A)(this,t,[e])).onSaveSharedFile=function(){a.props.handleSaveSharedDir(a.state.repo.repo_id,a.state.selectedPath)},a.onDirentItemClick=function(e,t,s){"dir"===s.type?a.setState({repo:e,selectedPath:t}):a.setState({repo:null,selectedPath:""})},a.onRepoItemClick=function(e){a.setState({repo:e,selectedPath:"/"})},a.state={repo:null,selectedPath:"",errMessage:""},a}return(0,l.A)(t,e),(0,o.A)(t,[{key:"render",value:function(){return(0,M.jsxs)(Z.A,{isOpen:!0,className:"sf-save-file",toggle:this.props.toggleCancel,children:[(0,M.jsx)(V.A,{toggle:this.props.toggleCancel,children:(0,F.AP)("Save to:")}),(0,M.jsxs)(H.A,{children:[(0,M.jsx)(W.A,{isShowFile:!1,onDirentItemClick:this.onDirentItemClick,onRepoItemClick:this.onRepoItemClick,mode:"only_all_repos"}),this.state.errMessage&&(0,M.jsx)(Q.A,{color:"danger",children:this.state.errMessage})]}),(0,M.jsxs)(X.A,{children:[(0,M.jsx)(u.A,{color:"secondary",onClick:this.props.toggleCancel,children:(0,F.AP)("Cancel")}),this.state.selectedPath?(0,M.jsx)(u.A,{color:"primary",onClick:this.onSaveSharedFile,children:(0,F.AP)("Submit")}):(0,M.jsx)(u.A,{color:"primary",disabled:!0,children:(0,F.AP)("Submit")})]})]})}}])}(d.Component),J=a(88002),K=a(39143),ee=a(25531),te=a(2949);a(47100);b().locale(window.app.config.lang),b().extend(j());var ae=window.app.pageOptions.name,se=window.shared.pageOptions,ie=se.token,ne=se.dirName,oe=se.dirPath,re=se.sharedBy,le=se.repoID,de=se.relativePath,ce=se.mode,pe=se.thumbnailSize,he=se.zipped,ue=se.trafficOverLimit,me=se.canDownload,ge=se.noQuota,fe=se.canUpload,xe=se.enableVideoThumbnail,ve=se.enablePDFThumbnail,be=!ue&&me,Ae=function(e){function t(e){var a;return(0,n.A)(this,t),(a=(0,r.A)(this,t,[e])).sortItems=function(e,t){a.setState({sortBy:e,sortOrder:t,items:k.Aq.sortDirentsInSharedDir(a.state.items,e,t)})},a.getThumbnails=function(){var e=a.state.items.filter((function(e){return!e.is_dir&&(k.Aq.imageCheck(e.file_name)||xe&&k.Aq.videoCheck(e.file_name)||ve&&k.Aq.pdfCheck(e.file_name))&&!e.encoded_thumbnail_src}));if(0!=e.length){var t=e.length,s=a,i=function(a){var n=e[a];w.e.getShareLinkThumbnail(ie,n.file_path,pe).then((function(e){n.encoded_thumbnail_src=e.data.encoded_thumbnail_src})).catch((function(e){})).then((function(){a<t-1?i(++a):s.setState({items:s.state.items})}))};i(0)}},a.renderPath=function(){return(0,M.jsxs)(d.Fragment,{children:[he.map((function(e,t){return t!=he.length-1?(0,M.jsxs)(d.Fragment,{children:[(0,M.jsx)("a",{href:"?p=".concat(encodeURIComponent(e.path),"&mode=").concat(ce),className:"mx-1 ellipsis",title:e.name,children:e.name}),(0,M.jsx)("span",{children:" / "})]},t):null})),(0,M.jsx)("span",{className:"ml-1 ellipsis",title:he[he.length-1].name,children:he[he.length-1].name})]})},a.zipDownloadFolder=function(e){F.B$?w.e.getShareLinkZipTask(ie,e).then((function(e){var t=e.data.zip_token;location.href="".concat(F.IX,"zip/").concat(t)})).catch((function(e){var t=k.Aq.getErrorMsg(e);a.setState({isLoading:!1,errorMsg:t})})):a.setState({isZipDialogOpen:!0,zipFolderPath:e})},a.zipDownloadSelectedItems=function(){if(F.B$){var e=a.state.items.filter((function(e){return e.isSelected})).map((function(e){return e.file_name||e.folder_name}));w.e.getShareLinkDirentsZipTask(ie,de,e).then((function(e){var t=e.data.zip_token;location.href="".concat(F.IX,"zip/").concat(t)})).catch((function(e){var t=k.Aq.getErrorMsg(e);a.setState({isLoading:!1,errorMsg:t})}))}else a.setState({isZipDialogOpen:!0,zipFolderPath:de,selectedItems:a.state.items.filter((function(e){return e.isSelected})).map((function(e){return e.file_name||e.folder_name}))})},a.saveSelectedItems=function(){a.setState({isSaveSharedDirDialogShow:!0,itemsForSave:a.state.items.filter((function(e){return e.isSelected})).map((function(e){return e.file_name||e.folder_name}))})},a.saveAllItems=function(){a.setState({isSaveSharedDirDialogShow:!0,itemsForSave:a.state.items.map((function(e){return e.file_name||e.folder_name}))})},a.toggleSaveSharedDirCancel=function(){a.setState({isSaveSharedDirDialogShow:!1,itemsForSave:[]})},a.handleSaveSharedDir=function(e,t){var s=a.state.itemsForSave;w.e.saveSharedDir(e,t,ie,de,s).then((function(e){a.setState({isSaveSharedDirDialogShow:!1,itemsForSave:[],isCopyMoveProgressDialogShow:!0,asyncCopyMoveTaskId:e.data.task_id,asyncOperatedFilesLength:s.length},(function(){a.getAsyncCopyMoveProgress()}))})).catch((function(e){var t=k.Aq.getErrorMsg(e);a.setState({errMessage:t})}))},a.onProgressDialogToggle=function(){if(100!==a.state.asyncOperationProgress){var e=a.state.asyncCopyMoveTaskId;w.e.cancelCopyMoveOperation(e)}a.setState({asyncOperationProgress:0,isCopyMoveProgressDialogShow:!1})},a.closeZipDialog=function(){a.setState({isZipDialogOpen:!1,zipFolderPath:"",selectedItems:[]})},a.prepareImageItem=function(e){var t,a=e.file_name,s="gif"==a.substr(a.lastIndexOf(".")+1).toLowerCase(),i="".concat(F.Yc,"d/").concat(ie,"/files/?p=").concat(encodeURIComponent(e.file_path));return t=s?"".concat(i,"&raw=1"):"".concat(F.Yc,"thumbnail/").concat(ie,"/").concat(F.oC).concat(k.Aq.encodePath(e.file_path)),{name:a,url:i,thumbnail:"".concat(F.Yc,"thumbnail/").concat(ie,"/").concat(F.oC).concat(k.Aq.encodePath(e.file_path)),src:t,downloadURL:i+"&dl=1"}},a.showImagePopup=function(e){var t=a.state.items.filter((function(e){return!e.is_dir&&k.Aq.imageCheck(e.file_name)})),s=t.map((function(e){return a.prepareImageItem(e)}));a.setState({isImagePopupOpen:!0,imageItems:s,imageIndex:t.indexOf(e)})},a.closeImagePopup=function(){a.setState({isImagePopupOpen:!1})},a.moveToPrevImage=function(){var e=a.state.imageItems.length;a.setState((function(t){return{imageIndex:(t.imageIndex+e-1)%e}}))},a.moveToNextImage=function(){var e=a.state.imageItems.length;a.setState((function(t){return{imageIndex:(t.imageIndex+1)%e}}))},a.toggleAllSelected=function(){a.setState((function(e){return{isAllItemsSelected:!e.isAllItemsSelected,items:a.state.items.map((function(t){return t.isSelected=!e.isAllItemsSelected,t}))}}))},a.toggleItemSelected=function(e,t){a.setState({items:a.state.items.map((function(a){return a===e&&(a.isSelected=t),a}))},(function(){a.setState({isAllItemsSelected:!a.state.items.some((function(e){return!e.isSelected}))})}))},a.onUploadFile=function(e){e.nativeEvent.stopImmediatePropagation(),a.uploader.onFileUpload()},a.onFileUploadSuccess=function(e){var t=e.name,s=e.size,i={isSelected:!1,file_name:t,file_path:k.Aq.joinPath(de,t),is_dir:!1,last_modified:b()().format(),size:s},n=a.state.items.filter((function(e){return e.is_dir})),o=Array.from(a.state.items);o.splice(n.length,0,i),a.setState({items:o}),w.e.shareLinksUploadDone(ie,k.Aq.joinPath(oe,t))},a.getShareLinkRepoTags=function(){w.e.getShareLinkRepoTags(ie).then((function(e){var t=[];e.data.repo_tags.forEach((function(e){var a=new ee.A(e);a.fileCount>0&&t.push(a)})),a.setState({usedRepoTags:t}),k.Aq.isDesktop()&&0!=t.length&&"/"==de&&a.setState({isRepoInfoBarShow:!0})})).catch((function(e){var t=k.Aq.getErrorMsg(e);P.A.danger(t)}))},a.state={isLoading:!0,errorMsg:"",items:[],isAllItemsSelected:!1,selectedItems:[],sortBy:"name",sortOrder:"asc",isZipDialogOpen:!1,zipFolderPath:"",usedRepoTags:[],isRepoInfoBarShow:!1,isSaveSharedDirDialogShow:!1,itemsForSave:[],asyncCopyMoveTaskId:"",asyncOperationProgress:0,asyncOperatedFilesLength:0,isCopyMoveProgressDialogShow:!1,isImagePopupOpen:!1,imageItems:[],imageIndex:0},a}return(0,l.A)(t,e),(0,o.A)(t,[{key:"componentDidMount",value:function(){var e=this;ue&&P.A.danger((0,F.AP)("File download is disabled: the share link traffic of owner is used up."),{duration:3}),w.e.listSharedDir(ie,de,pe).then((function(t){var a=t.data.dirent_list.map((function(e){return e.isSelected=!1,e}));e.setState({isLoading:!1,errorMsg:"",items:k.Aq.sortDirentsInSharedDir(a,e.state.sortBy,e.state.sortOrder)}),e.getThumbnails()})).catch((function(t){var a=k.Aq.getErrorMsg(t);e.setState({isLoading:!1,errorMsg:a})})),this.getShareLinkRepoTags()}},{key:"getAsyncCopyMoveProgress",value:function(){var e=(0,i.A)((0,s.A)().mark((function e(){var t,a,i,n,o,r;return(0,s.A)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=this.state.asyncCopyMoveTaskId,e.prev=1,e.next=4,w.e.queryAsyncOperationProgress(t);case 4:if(a=e.sent,!(i=a.data).failed){e.next=11;break}return n=(0,F.AP)("Failed to copy files to another library."),P.A.danger(n),this.setState({asyncOperationProgress:0,isCopyMoveProgressDialogShow:!1}),e.abrupt("return");case 11:if(!i.successful){e.next=16;break}return this.setState({asyncOperationProgress:0,isCopyMoveProgressDialogShow:!1}),o=(0,F.AP)("Successfully copied files to another library."),P.A.success(o),e.abrupt("return");case 16:r=i.total?parseInt((i.done/i.total*100).toFixed(2)):0,this.getAsyncCopyMoveProgress(),this.setState({asyncOperationProgress:r}),e.next=24;break;case 21:e.prev=21,e.t0=e.catch(1),this.setState({asyncOperationProgress:0,isCopyMoveProgressDialogShow:!1});case 24:case"end":return e.stop()}}),e,this,[[1,21]])})));return function(){return e.apply(this,arguments)}}()},{key:"render",value:function(){var e=this,t=k.Aq.isDesktop(),a="btn btn-secondary btn-icon sf-view-mode-btn";return(0,M.jsxs)(d.Fragment,{children:[(0,M.jsxs)("div",{className:"h-100 d-flex flex-column",children:[(0,M.jsxs)("div",{className:"top-header d-flex justify-content-between",children:[(0,M.jsx)("a",{href:F.Yc,children:(0,M.jsx)("img",{src:F.SG+F.VI,height:F.hM,width:F.gA,title:F.q0,alt:"logo"})}),ae&&(0,M.jsx)(S.A,{})]}),(0,M.jsx)("div",{className:"o-auto",children:(0,M.jsxs)("div",{className:"shared-dir-view-main",children:[(0,M.jsx)("h2",{className:"h3 text-truncate",title:ne,children:ne}),(0,M.jsxs)("p",{children:[(0,F.AP)("Shared by: "),re]}),(0,M.jsxs)("div",{className:"d-flex justify-content-between align-items-center op-bar",children:[(0,M.jsxs)("p",{className:"m-0 mr-4 ellipsis d-flex align-items-center",children:[(0,F.AP)("Current path: "),this.renderPath()]}),(0,M.jsxs)("div",{className:"flex-none",children:[t&&(0,M.jsxs)("div",{className:"view-mode btn-group",children:[(0,M.jsx)("a",{href:"?p=".concat(encodeURIComponent(de),"&mode=list"),className:"".concat(a," sf2-icon-list-view ").concat(ce==te.Tb?"current-mode":""),title:(0,F.AP)("List"),"aria-label":(0,F.AP)("List")}),(0,M.jsx)("a",{href:"?p=".concat(encodeURIComponent(de),"&mode=grid"),className:"".concat(a," sf2-icon-grid-view ").concat(ce==te.nj?"current-mode":""),title:(0,F.AP)("Grid"),"aria-label":(0,F.AP)("Grid")})]}),fe&&(0,M.jsx)(u.A,{disabled:ge,title:ge?(0,F.AP)("The owner of this library has run out of space."):"",onClick:this.onUploadFile,className:"ml-2 shared-dir-op-btn shared-dir-upload-btn",children:(0,F.AP)("Upload")}),be&&(0,M.jsx)(d.Fragment,{children:this.state.items.some((function(e){return e.isSelected}))?(0,M.jsxs)(d.Fragment,{children:[(0,M.jsx)(u.A,{color:"success",onClick:this.zipDownloadSelectedItems,className:"ml-2 shared-dir-op-btn",children:(0,F.AP)("ZIP Selected Items")}),me&&ae&&ae!==re&&(0,M.jsx)(u.A,{color:"success",onClick:this.saveSelectedItems,className:"ml-2 shared-dir-op-btn",children:(0,F.AP)("Save Selected Items")})]}):(0,M.jsxs)(d.Fragment,{children:[(0,M.jsx)(u.A,{color:"success",onClick:this.zipDownloadFolder.bind(this,de),className:"ml-2 shared-dir-op-btn",children:(0,F.AP)("ZIP")}),me&&ae&&ae!==re&&(0,M.jsx)(u.A,{color:"success",onClick:this.saveAllItems,className:"ml-2 shared-dir-op-btn",children:(0,F.AP)("Save")})]})})]})]}),!ge&&fe&&(0,M.jsx)(G,{ref:function(t){return e.uploader=t},dragAndDrop:!1,token:ie,path:"/"===oe?oe:oe.replace(/\/+$/,""),relativePath:"/"===de?de:de.replace(/\/+$/,""),repoID:le,onFileUploadSuccess:this.onFileUploadSuccess}),this.state.isRepoInfoBarShow&&(0,M.jsx)(K.A,{repoID:le,currentPath:"/",usedRepoTags:this.state.usedRepoTags,shareLinkToken:ie,enableFileDownload:be,className:"mx-0"}),(0,M.jsx)(je,{isDesktop:t,isLoading:this.state.isLoading,errorMsg:this.state.errorMsg,items:this.state.items,sortBy:this.state.sortBy,sortOrder:this.state.sortOrder,sortItems:this.sortItems,isAllItemsSelected:this.state.isAllItemsSelected,toggleAllSelected:this.toggleAllSelected,toggleItemSelected:this.toggleItemSelected,zipDownloadFolder:this.zipDownloadFolder,showImagePopup:this.showImagePopup})]})})]}),this.state.isZipDialogOpen&&(0,M.jsx)(y.A,{children:(0,M.jsx)(I.A,{token:ie,path:this.state.zipFolderPath,target:this.state.selectedItems,toggleDialog:this.closeZipDialog})}),this.state.isSaveSharedDirDialogShow&&(0,M.jsx)($,{sharedToken:ie,parentDir:de,items:this.state.itemsForSave,toggleCancel:this.toggleSaveSharedDirCancel,handleSaveSharedDir:this.handleSaveSharedDir}),this.state.isCopyMoveProgressDialogShow&&(0,M.jsx)(J.A,{type:"copy",asyncOperatedFilesLength:this.state.asyncOperatedFilesLength,asyncOperationProgress:this.state.asyncOperationProgress,toggleDialog:this.onProgressDialogToggle}),this.state.isImagePopupOpen&&(0,M.jsx)(y.A,{children:(0,M.jsx)(D.A,{imageItems:this.state.imageItems,imageIndex:this.state.imageIndex,closeImagePopup:this.closeImagePopup,moveToPrevImage:this.moveToPrevImage,moveToNextImage:this.moveToNextImage,enableRotate:!1})})]})}}])}(d.Component),je=function(e){function t(e){var a;return(0,n.A)(this,t),(a=(0,r.A)(this,t,[e])).sortByName=function(e){e.preventDefault();var t="asc"==a.props.sortOrder?"desc":"asc";a.props.sortItems("name",t)},a.sortByTime=function(e){e.preventDefault();var t="asc"==a.props.sortOrder?"desc":"asc";a.props.sortItems("time",t)},a.sortBySize=function(e){e.preventDefault();var t="asc"==a.props.sortOrder?"desc":"asc";a.props.sortItems("size",t)},a}return(0,l.A)(t,e),(0,o.A)(t,[{key:"render",value:function(){var e=this,t=this.props,a=t.isDesktop,s=t.isLoading,i=t.errorMsg,n=t.items,o=t.sortBy,r=t.sortOrder,l=t.isAllItemsSelected;if(s)return(0,M.jsx)(C.A,{});if(i)return(0,M.jsx)("p",{className:"error mt-6 text-center",children:i});var d=(0,M.jsx)("tbody",{children:n.map((function(t,s){return(0,M.jsx)(Se,{isDesktop:a,item:t,zipDownloadFolder:e.props.zipDownloadFolder,showImagePopup:e.props.showImagePopup,toggleItemSelected:e.props.toggleItemSelected},s)}))});if(!a)return(0,M.jsxs)("table",{className:"table-hover table-thead-hidden",children:[(0,M.jsx)("thead",{children:(0,M.jsxs)("tr",{children:[(0,M.jsx)("th",{width:"12%"}),(0,M.jsx)("th",{width:"80%"}),(0,M.jsx)("th",{width:"8%"})]})}),d]});var c=(0,M.jsx)("span",{className:"sf3-font ".concat("asc"==r?"sf3-font-down rotate-180 d-inline-block":"sf3-font-down")});return ce==te.Tb?(0,M.jsxs)("table",{className:"table-hover",children:[(0,M.jsx)("thead",{children:(0,M.jsxs)("tr",{children:[be&&(0,M.jsx)("th",{width:"3%",className:"text-center",children:(0,M.jsx)("input",{type:"checkbox",checked:l,onChange:this.props.toggleAllSelected})}),(0,M.jsx)("th",{width:"5%"}),(0,M.jsx)("th",{width:be?"50%":"53%",children:(0,M.jsxs)("a",{className:"d-block table-sort-op",href:"#",onClick:this.sortByName,children:[(0,F.AP)("Name")," ","name"==o&&c]})}),(0,M.jsx)("th",{width:"8%"}),(0,M.jsx)("th",{width:"14%",children:(0,M.jsxs)("a",{className:"d-block table-sort-op",href:"#",onClick:this.sortBySize,children:[(0,F.AP)("Size")," ","size"==o&&c]})}),(0,M.jsx)("th",{width:"13%",children:(0,M.jsxs)("a",{className:"d-block table-sort-op",href:"#",onClick:this.sortByTime,children:[(0,F.AP)("Last Update")," ","time"==o&&c]})}),(0,M.jsx)("th",{width:"7%"})]})}),d]}):(0,M.jsx)("ul",{className:"grid-view",children:n.map((function(t,a){return(0,M.jsx)(Fe,{item:t,zipDownloadFolder:e.props.zipDownloadFolder,showImagePopup:e.props.showImagePopup},a)}))})}}])}(d.Component),Se=function(e){function t(e){var a;return(0,n.A)(this,t),(a=(0,r.A)(this,t,[e])).toggleOpMenu=function(){a.setState({isOpMenuOpen:!a.state.isOpMenuOpen})},a.handleMouseOver=function(){a.setState({isIconShown:!0})},a.handleMouseOut=function(){a.setState({isIconShown:!1})},a.zipDownloadFolder=function(e){e.preventDefault(),a.props.zipDownloadFolder.bind(a,a.props.item.folder_path)()},a.handleFileClick=function(e){var t=a.props.item;k.Aq.imageCheck(t.file_name)&&(e.preventDefault(),a.props.showImagePopup(t))},a.toggleItemSelected=function(e){a.props.toggleItemSelected(a.props.item,e.target.checked)},a.state={isIconShown:!1,isOpMenuOpen:!1},a}return(0,l.A)(t,e),(0,o.A)(t,[{key:"render",value:function(){var e=this.props,t=e.item,a=e.isDesktop,s=this.state.isIconShown,i="",n="";if(t.file_tags&&t.file_tags.length>0&&(i=p()(t.file_name).slice(0,7),n=t.file_tags.map((function(e){return e.tag_name})).join(" ")),t.is_dir)return a?(0,M.jsxs)("tr",{onMouseOver:this.handleMouseOver,onMouseOut:this.handleMouseOut,onFocus:this.handleMouseOver,children:[be&&(0,M.jsx)("td",{className:"text-center",children:(0,M.jsx)("input",{type:"checkbox",checked:t.isSelected,onChange:this.toggleItemSelected})}),(0,M.jsx)("td",{className:"text-center",children:(0,M.jsx)("img",{src:k.Aq.getFolderIconUrl(),alt:"",width:"24"})}),(0,M.jsx)("td",{children:(0,M.jsx)("a",{href:"?p=".concat(encodeURIComponent(t.folder_path.substr(0,t.folder_path.length-1)),"&mode=").concat(ce),children:t.folder_name})}),(0,M.jsx)("td",{}),(0,M.jsx)("td",{}),(0,M.jsx)("td",{title:b()(t.last_modified).format("dddd, MMMM D, YYYY h:mm:ss A"),children:b()(t.last_modified).fromNow()}),(0,M.jsx)("td",{children:be&&(0,M.jsx)("a",{role:"button",className:"action-icon sf2-icon-download".concat(s?"":" invisible"),href:"#",onClick:this.zipDownloadFolder,title:(0,F.AP)("Download"),"aria-label":(0,F.AP)("Download")})})]}):(0,M.jsxs)("tr",{children:[(0,M.jsx)("td",{className:"text-center",children:(0,M.jsx)("img",{src:k.Aq.getFolderIconUrl(),alt:"",width:"24"})}),(0,M.jsxs)("td",{children:[(0,M.jsx)("a",{href:"?p=".concat(encodeURIComponent(t.folder_path.substr(0,t.folder_path.length-1)),"&mode=").concat(ce),children:t.folder_name}),(0,M.jsx)("br",{}),(0,M.jsx)("span",{className:"item-meta-info",children:b()(t.last_modified).fromNow()})]}),(0,M.jsx)("td",{children:be&&(0,M.jsxs)(m.A,{isOpen:this.state.isOpMenuOpen,toggle:this.toggleOpMenu,children:[(0,M.jsx)(g.A,{tag:"i",className:"sf-dropdown-toggle sf3-font sf3-font-more-vertical ml-0",title:(0,F.AP)("More operations"),"aria-label":(0,F.AP)("More operations"),"data-toggle":"dropdown","aria-expanded":this.state.isOpMenuOpen}),(0,M.jsxs)("div",{className:this.state.isOpMenuOpen?"":"d-none",onClick:this.toggleOpMenu,children:[(0,M.jsx)("div",{className:"mobile-operation-menu-bg-layer"}),(0,M.jsx)("div",{className:"mobile-operation-menu",children:(0,M.jsx)(f.A,{className:"mobile-menu-item",onClick:this.zipDownloadFolder,children:(0,F.AP)("Download")})})]})]})})]});var o="".concat(F.Yc,"d/").concat(ie,"/files/?p=").concat(encodeURIComponent(t.file_path)),r=t.encoded_thumbnail_src?"".concat(F.Yc).concat(t.encoded_thumbnail_src):"";return a?(0,M.jsxs)("tr",{onMouseOver:this.handleMouseOver,onMouseOut:this.handleMouseOut,onFocus:this.handleMouseOver,children:[be&&(0,M.jsx)("td",{className:"text-center",children:(0,M.jsx)("input",{type:"checkbox",checked:t.isSelected,onChange:this.toggleItemSelected})}),(0,M.jsx)("td",{className:"text-center",children:r?(0,M.jsx)("img",{className:"thumbnail",src:r,alt:""}):(0,M.jsx)("img",{src:k.Aq.getFileIconUrl(t.file_name),alt:"",width:"24"})}),(0,M.jsx)("td",{children:(0,M.jsx)("a",{href:o,onClick:this.handleFileClick,children:t.file_name})}),(0,M.jsx)("td",{className:"tag-list-title",children:t.file_tags&&t.file_tags.length>0&&(0,M.jsxs)(d.Fragment,{children:[(0,M.jsx)("div",{id:"tag-list-title-".concat(i),className:"dirent-item tag-list tag-list-stacked",children:t.file_tags.map((function(e,a){var s=t.file_tags.length;return(0,M.jsx)("span",{className:"file-tag",style:{zIndex:s-a,backgroundColor:e.tag_color}},e.file_tag_id)}))}),(0,M.jsx)(x.A,{target:"tag-list-title-".concat(i),placement:"bottom",children:n})]})}),(0,M.jsx)("td",{children:k.Aq.bytesToSize(t.size)}),(0,M.jsx)("td",{title:b()(t.last_modified).format("dddd, MMMM D, YYYY h:mm:ss A"),children:b()(t.last_modified).fromNow()}),(0,M.jsx)("td",{children:be&&(0,M.jsx)("a",{className:"action-icon sf2-icon-download".concat(s?"":" invisible"),href:"".concat(o,"&dl=1"),title:(0,F.AP)("Download"),"aria-label":(0,F.AP)("Download")})})]}):(0,M.jsxs)("tr",{children:[(0,M.jsx)("td",{className:"text-center",children:r?(0,M.jsx)("img",{className:"thumbnail",src:r,alt:""}):(0,M.jsx)("img",{src:k.Aq.getFileIconUrl(t.file_name),alt:"",width:"24"})}),(0,M.jsxs)("td",{children:[(0,M.jsx)("a",{href:o,onClick:this.handleFileClick,children:t.file_name}),(0,M.jsx)("br",{}),(0,M.jsx)("span",{className:"item-meta-info",children:k.Aq.bytesToSize(t.size)}),(0,M.jsx)("span",{className:"item-meta-info",children:b()(t.last_modified).fromNow()})]}),(0,M.jsx)("td",{children:be&&(0,M.jsxs)(m.A,{isOpen:this.state.isOpMenuOpen,toggle:this.toggleOpMenu,children:[(0,M.jsx)(g.A,{tag:"i",className:"sf-dropdown-toggle sf3-font sf3-font-more-vertical ml-0",title:(0,F.AP)("More operations"),"aria-label":(0,F.AP)("More operations"),"data-toggle":"dropdown","aria-expanded":this.state.isOpMenuOpen}),(0,M.jsxs)("div",{className:this.state.isOpMenuOpen?"":"d-none",onClick:this.toggleOpMenu,children:[(0,M.jsx)("div",{className:"mobile-operation-menu-bg-layer"}),(0,M.jsx)("div",{className:"mobile-operation-menu",children:(0,M.jsx)(f.A,{className:"mobile-menu-item",tag:"a",href:"".concat(o,"&dl=1"),children:(0,F.AP)("Download")})})]})]})})]})}}])}(d.Component),Fe=function(e){function t(e){var a;return(0,n.A)(this,t),(a=(0,r.A)(this,t,[e])).handleMouseOver=function(){a.setState({isIconShown:!0})},a.handleMouseOut=function(){a.setState({isIconShown:!1})},a.zipDownloadFolder=function(e){e.preventDefault(),a.props.zipDownloadFolder.bind(a,a.props.item.folder_path)()},a.handleFileClick=function(e){var t=a.props.item;k.Aq.imageCheck(t.file_name)&&(e.preventDefault(),a.props.showImagePopup(t))},a.state={isIconShown:!1},a}return(0,l.A)(t,e),(0,o.A)(t,[{key:"render",value:function(){var e=this.props.item,t=this.state.isIconShown;if(e.is_dir){var a="?p=".concat(encodeURIComponent(e.folder_path.substr(0,e.folder_path.length-1)),"&mode=").concat(ce);return(0,M.jsxs)("li",{className:"grid-item",onMouseOver:this.handleMouseOver,onMouseOut:this.handleMouseOut,onFocus:this.handleMouseOver,children:[(0,M.jsx)("a",{href:a,className:"grid-file-img-link d-block",children:(0,M.jsx)("img",{src:k.Aq.getFolderIconUrl(!1,192),alt:"",width:"96",height:"96"})}),(0,M.jsx)("a",{href:a,className:"grid-file-name grid-file-name-link",children:e.folder_name}),be&&(0,M.jsx)("a",{role:"button",className:"action-icon sf2-icon-download".concat(t?"":" invisible"),href:"#",onClick:this.zipDownloadFolder,title:(0,F.AP)("Download"),"aria-label":(0,F.AP)("Download")})]})}var s="".concat(F.Yc,"d/").concat(ie,"/files/?p=").concat(encodeURIComponent(e.file_path)),i=e.encoded_thumbnail_src?"".concat(F.Yc).concat(e.encoded_thumbnail_src):"";return(0,M.jsxs)("li",{className:"grid-item",onMouseOver:this.handleMouseOver,onMouseOut:this.handleMouseOut,onFocus:this.handleMouseOver,children:[(0,M.jsx)("a",{href:s,className:"grid-file-img-link d-block",onClick:this.handleFileClick,children:i?(0,M.jsx)("img",{className:"thumbnail",src:i,alt:""}):(0,M.jsx)("img",{src:k.Aq.getFileIconUrl(e.file_name),alt:"",width:"96",height:"96"})}),(0,M.jsx)("a",{href:s,className:"grid-file-name grid-file-name-link",onClick:this.handleFileClick,children:e.file_name}),be&&(0,M.jsx)("a",{className:"action-icon sf2-icon-download".concat(t?"":" invisible"),href:"".concat(s,"&dl=1"),title:(0,F.AP)("Download"),"aria-label":(0,F.AP)("Download")})]})}}])}(d.Component);h.render((0,M.jsx)(Ae,{}),document.getElementById("wrapper"))},47100:function(){}},function(e){e.O(0,[4223],(function(){return t=23088,e(e.s=t);var t}));e.O()}]); |