芝麻web文件管理V1.00
编辑当前文件:/home/pulsehostuk9/www/cloud.pulsehost.co.uk/static/js/1008.app.2a3047f764160c3bcf57.min.js
"use strict";(self.webpackChunkafterlogic_aurora_platform=self.webpackChunkafterlogic_aurora_platform||[]).push([[1008],{vdUg:(e,t,i)=>{var s=i("a7T2"),o=i("M4cL"),r=i("p09A"),n=i("KC/L"),l=i("REt5"),h=i("9kOp"),a=i("dfnr"),c=i("oUN1");function u(e,t,i,l,a,c,u,d,p,f,m){this.active=r.observable(!1),this.fSelectCallback=t||function(){},this.fDeleteCallback=i||function(){},this.fDblClickCallback=!h.isMobile()&&l?l:function(){},this.fEnterCallback=a||function(){},this.bResetCheckedOnClick=!!u,this.bCheckOnSelect=!!d,this.bUnselectOnCtrl=!!p,this.bDisableMultiplySelection=!!f,this.bChangeOnSelect=void 0===m||!!m,this.useKeyboardKeys=r.observable(!1),this.list=r.observableArray([]),e&&e.subscribe&&e.subscribe((function(e){this.list(e)}),this),this.multiplyLineFactor=c,this.oLast=null,this.oListScope=null,this.oScrollScope=null,this.iTimer=0,this.iFactor=1,this.KeyUp=Enums.Key.Up,this.KeyDown=Enums.Key.Down,this.KeyLeft=Enums.Key.Up,this.KeyRight=Enums.Key.Down,this.multiplyLineFactor&&(this.multiplyLineFactor.subscribe?this.multiplyLineFactor.subscribe((function(e){this.iFactor=0
"function"==typeof t.isEqual?t.isEqual(e):t===e))||this.itemSelected(null)}),this),this.listCheckedOrSelected=r.computed({read:function(){var e=this.itemSelected(),t=this.listChecked();return 0
t}),this),this.onKeydownBound=s.bind(this.onKeydown,this)}u.prototype.iTimer=0,u.prototype.bResetCheckedOnClick=!1,u.prototype.bCheckOnSelect=!1,u.prototype.bUnselectOnCtrl=!1,u.prototype.bDisableMultiplySelection=!1,u.prototype.getLastOrSelected=function(){var e=0,t=null;return s.each(this.list(),(function(i){i&&s.isFunction(i.checked)&&(i.checked()&&e++,i.selected()&&(t=i))})),0===e&&t?t:this.oLast},u.prototype.unbind=function(){this.active(!1),this.itemSelected()&&this.itemSelected().selected(!1),o(document).off("keydown",this.onKeydownBound),o(this.oListScope).off()},u.prototype.initOnApplyBindings=function(e,t,i,s,n){this.active(!0),o(document).on("keydown",this.onKeydownBound),this.oListScope=s,this.oScrollScope=n,this.sActionSelector=e,this.sSelectableSelector=t,this.sCheckboxSelector=i;var l=this,h=function(e,t,i){var s=0,o=0,r=null,n=!1,h=!1,a=[],c=!1;if(t=t||null,i&&i.shiftKey&&null!==t&&null!==e&&t!==e)for(a=l.list(),c=t.checked(),s=0,o=a.length;s
250||s>1||(e.preventDefault(),o(this).trigger("dblclick"))}})),o(this.oListScope).on("click",e,(function(e){var t=!0,i=null,s=l.getLastOrSelected(),o=r.dataFor(this);o&&e&&(e.shiftKey?(t=!1,l.bDisableMultiplySelection||(null===l.oLast&&(l.oLast=o),o.checked(!o.checked()),h(s,o,e))):(e.ctrlKey||e.metaKey)&&(t=!1,l.bDisableMultiplySelection||(l.oLast=o,!(i=l.itemSelected())||i.checked()||o.checked()||i.checked(!0),l.bUnselectOnCtrl&&o===l.itemSelected()?(o.checked(!o.selected()),l.itemSelected(null)):o.checked(!o.checked()))),t&&l.selectionFunc(o))})),o(this.oListScope).on("click",i,(function(e){var t=r.dataFor(this);t&&e&&!l.bDisableMultiplySelection&&(e.shiftKey?(null===l.oLast&&(l.oLast=t),h(l.getLastOrSelected(),t,e)):l.oLast=t),e&&e.stopPropagation&&e.stopPropagation()})),o(this.oListScope).on("dblclick",i,(function(e){e&&e.stopPropagation&&e.stopPropagation()}))},u.prototype.getResultSelection=function(e,t){var i=this,r=!1,n=!1,l=null,h=this.iFactor,a=!!this.multiplyLineFactor,c=0,u=0,d=[];if(!e&&-1
=0;c--)if(e===d[c]){0>(c-=h)&&(c+=h),l=d[c];break}return l},u.prototype.shiftClickResult=function(e,t,i){if(t){var r=!!this.multiplyLineFactor,n=!1,l=!1;-1
=s&&t<=s+i-r||(t
s+i?this.oScrollScope.scrollTop(t+r+20-i):this.oScrollScope.scrollTop(t-20),0))},e.exports=u},pokp:(e,t,i)=>{var s=i("EFhx"),o=i("U1j7");s.registerAbortRequestHandler(o.ServerModuleName,(function(e,t){return"GetFiles"===e.Method&&"GetFiles"===t.Method})),e.exports={send:function(e,t,i,r){s.send(o.ServerModuleName,e,t,i,r)},sendToWebclient:function(e,t,i,o){s.send("FilesWebclient",e,t,i,o)}}},U1j7:(e,t,i)=>{var s=i("a7T2"),o=i("KC/L");e.exports={ServerModuleName:"Files",CorporateServerModuleName:"CorporateFiles",PersonalServerModuleName:"PersonalFiles",HashModuleName:"files",CustomTabTitle:"",Storages:[],EnableUploadSizeLimit:!1,PublicFolderName:"",PublicHash:"",UploadSizeLimitMb:0,UserSpaceLimitMb:0,TenantSpaceLimitMb:0,CorporateSpaceLimitMb:0,EditFileNameWithoutExtension:!1,ShowCommonSettings:!0,ShowFilesApps:!0,BottomLeftCornerLinks:[],ShowPersonalFilesAdminSection:!1,ShowCorporateFilesAdminSection:!1,PublicLinksEnabled:!0,Sorting:{Allow:!1},init:function(e){var t=e[this.ServerModuleName],i=e[this.CorporateServerModuleName],r=e.FilesWebclient;s.isEmpty(t)||(this.CustomTabTitle=o.pString(t.CustomTabTitle,this.CustomTabTitle),this.Storages=o.pArray(t.Storages,this.Storages),this.EnableUploadSizeLimit=o.pBool(t.EnableUploadSizeLimit,this.EnableUploadSizeLimit),this.PublicFolderName=o.pString(t.PublicFolderName,this.PublicFolderName),this.PublicHash=o.pString(t.PublicHash,this.PublicHash),this.UploadSizeLimitMb=o.pNonNegativeInt(t.UploadSizeLimitMb,this.UploadSizeLimitMb),this.UserSpaceLimitMb=o.pNonNegativeInt(t.UserSpaceLimitMb,this.UserSpaceLimitMb),this.TenantSpaceLimitMb=o.pNonNegativeInt(t.TenantSpaceLimitMb,this.TenantSpaceLimitMb)),this.ShowPersonalFilesAdminSection=!0,s.isEmpty(i)||(this.ShowCorporateFilesAdminSection=!0,this.CorporateSpaceLimitMb=o.pNonNegativeInt(i.SpaceLimitMb,this.CorporateSpaceLimitMb)),s.isEmpty(r)||(this.EditFileNameWithoutExtension=o.pBool(r.EditFileNameWithoutExtension,this.EditFileNameWithoutExtension),this.ShowCommonSettings=o.pBool(r.ShowCommonSettings,this.ShowCommonSettings),this.ShowFilesApps=o.pBool(r.ShowFilesApps,this.ShowFilesApps),this.BottomLeftCornerLinks=o.pArray(r.BottomLeftCornerLinks,this.BottomLeftCornerLinks),this.PublicLinksEnabled=o.pBool(r.PublicLinksEnabled,this.PublicLinksEnabled),this.Sorting=this.getSortConfig(o.pObject(r.FilesSortBy)))},updateAdmin:function(e,t){this.EnableUploadSizeLimit=e,this.UploadSizeLimitMb=t},updateAdminPersonal:function(e){this.PersonalSpaceLimitMb=e},updateAdminCorporate:function(e){this.CorporateSpaceLimitMb=e},getSortConfig:function(e){return{Allow:o.pBool(e?.Allow),DisplayOptions:e?.DisplayOptions||[],DefaultSortBy:o.pEnum(Enums.FilesSortField[e?.DefaultSortBy],Enums.FilesSortField,Enums.FilesSortField.Filename),DefaultSortOrder:o.pEnum(Enums.SortOrder[e?.DefaultSortOrder],Enums.SortOrder,Enums.SortOrder.Desc)}}}},"p/ia":(e,t,i)=>{var s=i("a7T2"),o=i("p09A"),r=i("H20a"),n=i("KC/L"),l=i("9kOp"),h=i("17yT"),a=i("jNBr"),c=i("FyTm");function u(e){this.oParent=e,this.IS_FOLDER=!0,this.selected=o.observable(!1),this.checked=o.observable(!1),this.deleted=o.observable(!1),this.recivedAnim=o.observable(!1).extend({autoResetToFalse:500}),this.published=o.observable(!1),this.fileName=o.observable(""),this.sLastModified=0,this.iLastModified=0,this.fullPath=o.observable(""),this.path=o.observable(""),this.storageType=o.observable(Enums.FileStorageType.Personal),this.id=o.observable(""),this.sMainAction="list",this.sOwnerName="",this.sInitiator="",this.oExtendedProps={},this.sharedWithMeAccessReshare=o.observable(!1),this.sharedWithMeAccessWrite=o.observable(!1),this.sharedWithMe=o.observable(!1),this.sharedWithOthers=o.observable(!1),this.readOnly=o.computed((function(){return this.sharedWithMe()&&!this.sharedWithMeAccessWrite()}),this),this.uploadingFilesCount=o.observable(0),this.uploadedFilesCount=o.observable(0),this.progressPercent=o.computed((function(){return this.uploadingFilesCount()>0?Math.floor(this.uploadedFilesCount()/this.uploadingFilesCount()*100):0}),this),this.isIncomplete=o.computed((function(){return this.uploadingFilesCount()>0}),this),this.uploaded=o.computed((function(){return 0===this.uploadingFilesCount()}),this),this.allowDrag=o.computed((function(){return!e.bInPopup&&!this.isIncomplete()&&!l.isPublic()}),this),this.allowDrop=o.computed((function(){if(!this.oParent.bInPopup&&!this.isIncomplete()){var e=this.oParent.sharedParentFolder();if(e)return e.sharedWithMeAccessWrite();if(this.storageType()!==Enums.FileStorageType.Shared)return!this.sharedWithMe()||this.sharedWithMeAccessWrite()&&(!this.oParent.selectedHasShared()||this.oParent.needToCopyDraggedItems())}return!1}),this)}s.extendOwn(u.prototype,c),u.prototype.parse=function(e){this.published(!!e.Published),this.fileName(n.pString(e.Name)),this.fullPath(n.pString(e.FullPath)),this.path(n.pString(e.Path)),this.storageType(n.pString(e.Type)),this.id(n.pString(e.Id)),e.MainAction&&(this.sMainAction=n.pString(e.MainAction)),this.sLastModified=u.parseLastModified(e.LastModified),this.iLastModified=n.pInt(e.LastModified),this.sOwnerName=n.pString(e.Owner),this.sInitiator=n.pString(e.Initiator,this.sOwnerName),this.oExtendedProps=n.pObject(e.ExtendedProps),this.parseExtendedProps(),this.displayName=o.computed((function(){return this.storageType()!==Enums.FileStorageType.Shared||this.oParent.sharedParentFolder()?this.fileName():this.fullPath().replace(/^\//,"")}),this),this.sHeaderText=function(){return this.sharedWithMe()&&this.sInitiator?r.i18n("FILESWEBCLIENT/INFO_SHARED_BY",{OWNER:this.sInitiator}):""}.bind(this)(),l.broadcastEvent("FilesWebclient::ParseFolder::after",[this,e])},u.parseLastModified=function(e){var t=new a;return e?(t.parse(e),t.getShortDate()):""},u.prototype.getMainAction=function(){return this.sMainAction},u.prototype.increaseUploadingFiles=function(){return this.uploadingFilesCount(this.uploadingFilesCount()+1)},u.prototype.increaseUploadedFiles=function(){return this.uploadedFilesCount(this.uploadedFilesCount()+1)},u.prototype.eventDragStart=h.prototype.eventDragStart,e.exports=u},dgrw:(e,t,i)=>{var s=i("a7T2"),o=i("p09A"),r=i("o1lX");function n(){r.call(this),this.fCallback=null,this.folderName=o.observable(""),this.folderName.focus=o.observable(!1),this.folderName.error=o.observable(""),this.folderName.subscribe((function(){this.folderName.error("")}),this)}s.extendOwn(n.prototype,r.prototype),n.prototype.PopupTemplate="FilesWebclient_CreateFolderPopup",n.prototype.onOpen=function(e){this.folderName(""),this.folderName.focus(!0),this.folderName.error(""),s.isFunction(e)&&(this.fCallback=e)},n.prototype.onOKClick=function(){if(this.folderName.error(""),this.fCallback){var e=this.fCallback(this.folderName());e?this.folderName.error(""+e):setTimeout(function(){this.closePopup()}.bind(this))}else setTimeout(function(){this.closePopup()}.bind(this))},e.exports=new n},U9LU:(e,t,i)=>{var s=i("a7T2"),o=i("p09A"),r=i("REt5"),n=i("o1lX"),l=i("pokp"),h=i("CsgX");function a(){n.call(this),this.fCallback=null,this.link=o.observable(""),this.linkPrev=o.observable(""),this.linkFocus=o.observable(!1),this.checkTimeout=null,this.urlChecked=o.observable(!1),this.saveCommand=r.createCommand(this,this.executeSave,(function(){return this.urlChecked()})),this.fileItem=o.observable(null)}s.extendOwn(a.prototype,n.prototype),a.prototype.PopupTemplate="FilesWebclient_CreateLinkPopup",a.prototype.onOpen=function(e){this.link(""),this.linkFocus(!0),this.fCallback=e,this.checkTimer=setTimeout(s.bind(this.checkUrl,this),2e3)},a.prototype.checkUrl=function(){clearTimeout(this.checkTimer),this.link()!==this.linkPrev()&&(this.linkPrev(this.link()),l.send("CheckUrl",{Url:this.link()},this.onCheckUrlResponse,this)),this.checkTimer=setTimeout(s.bind(this.checkUrl,this),1e3)},a.prototype.onCheckUrlResponse=function(e,t){if(e.Result){var i=h.prepareLinkData(e.Result,this.link()),s=new h(i);this.fileItem(s),this.urlChecked(!0)}},a.prototype.executeSave=function(){s.isFunction(this.fCallback)&&(this.fCallback(this.fileItem()),this.link(""),this.linkPrev(""),this.urlChecked(!1)),clearTimeout(this.checkTimer),this.closePopup()},a.prototype.cancelPopup=function(){this.link(""),this.linkPrev(""),this.urlChecked(!1),clearTimeout(this.checkTimer),this.closePopup()},e.exports=new a},HaM1:(e,t,i)=>{var s=i("a7T2"),o=i("p09A"),r=i("o1lX");function n(){r.call(this),this.fCallback=null,this.name=o.observable(""),this.focused=o.observable(!1),this.error=o.observable(""),this.name.subscribe((function(){this.error("")}),this)}s.extendOwn(n.prototype,r.prototype),n.prototype.PopupTemplate="FilesWebclient_RenamePopup",n.prototype.onOpen=function(e,t){this.fCallback=t,this.name(e),this.focused(!0),this.error("")},n.prototype.onOKClick=function(){if(this.error(""),s.isFunction(this.fCallback)){var e=this.fCallback(this.name());e?this.error(e):setTimeout(function(){this.closePopup()}.bind(this))}else setTimeout(function(){this.closePopup()}.bind(this))},e.exports=new n},FJ45:(e,t,i)=>{var s=i("a7T2"),o=i("p09A"),r=i("H20a"),n=i("Tt1R"),l=i("/QeJ"),h=i("o1lX"),a=i("TdEd"),c=i("oUN1"),u=i("pokp"),d=i("p/ia"),p=a.run("ActivityHistory","getShowHistoryPopup");function f(){h.call(this),this.item=null,this.pub=o.observable(""),this.pubFocus=o.observable(!1),this.bAllowShowHistory=!!p}s.extendOwn(f.prototype,h.prototype),f.prototype.PopupTemplate="FilesWebclient_SharePopup",f.prototype.onOpen=function(e){this.item=e,this.pub(""),u.send("CreatePublicLink",{Type:e.storageType(),Path:e.path(),Name:e.fileName(),Size:e instanceof d?0:e.size(),IsFolder:e instanceof d},this.onCreatePublicLinkResponse,this)},f.prototype.onCreatePublicLinkResponse=function(e){e.Result?(this.pub(n.getAppPath()+e.Result),this.pubFocus(!0),this.item.published(!0)):l.showErrorByCode(e,r.i18n("FILESWEBCLIENT/ERROR_CREATE_PUBLIC_LINK"))},f.prototype.onCancelSharingClick=function(){this.item&&(u.send("DeletePublicLink",{Type:this.item.storageType(),Path:this.item.path(),Name:this.item.fileName()},(function(e){e.Result?this.closePopup():l.showErrorByCode(e,r.i18n("FILESWEBCLIENT/ERROR_DELETE_PUBLIC_LINK"))}),this),this.item.published(!1))},f.prototype.showHistory=function(){this.bAllowShowHistory&&c.showPopup(p,[r.i18n("FILESWEBCLIENT/HEADING_HISTORY_POPUP"),this.item])},e.exports=new f},LGWn:(e,t,i)=>{var s=i("a7T2"),o=i("KC/L"),r=i("U1j7"),n={};function l(e){return"p."===e.substr(0,2)}n.getFiles=function(e,t,i,s=null){var o=[r.HashModuleName];return e&&""!==e&&o.push(e),t&&""!==t&&o.push("p."+t),i&&""!==i&&o.push("s."+i),s&&s.prefix&&o.push(s.prefix+s.value),o},n.parseFiles=function(e){var t=0,i="personal",s="",r="";return o.isNonEmptyArray(e)&&(e.length>t&&!l(e[t])&&(i=o.pString(e[t]),t++),e.length>t&&l(e[t])&&(s=o.pString(e[t].substr(2)),t++),e.length>t&&"s."===e[t].substr(0,2)&&(r=o.pString(e[t].substr(2)),t++)),n.getParsedParams(i,s,r,e[t])},n.getParsedParams=function(e,t,i,r=null){var n=[],l="";return o.isNonEmptyString(t)?l=(n=s.without(t.split(/(?:\/|\$ZIP\:)/g),""))[n.length-1]:t="",{Storage:e,Path:t,PathParts:n,Name:l,Search:i,Custom:r}},e.exports=n},hkZk:(e,t,i)=>{const s=i("a7T2"),o=i("M4cL"),r=i("p09A"),n=i("H20a"),l=i("KC/L"),h=i("REt5"),a=i("/QeJ"),c=i("9kOp"),u=i("qBBW"),d=i("vdUg"),p=i("TdEd"),f=i("W66n"),m=i("skxT"),y=i("OfVV"),b=i("doeu"),S=i("oUN1"),E=i("hT1I"),g=i("XeMN"),F=i("dgrw"),C=i("U9LU"),P=i("HaM1"),L=i("FJ45"),T=i("LGWn"),I=i("pokp"),A=i("U1j7"),v=i("CsgX"),k=i("p/ia"),N=p.run("SharedFiles","getFilesSharePopup"),R=p.run("MailWebclient","getComposeMessageWithAttachments"),w=window.Enums;function D(e=!1,t=!0){b.call(this,"FilesWebclient"),this.disableRoute=!1,this.browserTitle=r.observable(n.i18n("FILESWEBCLIENT/HEADING_BROWSER_TAB")),this.bAllowSendEmails=s.isFunction(R),this.error=r.observable(!1),this.loaded=r.observable(!1),this.bPublic=c.isPublic(),this.storages=r.observableArray([]),this.folders=r.observableArray(),this.files=r.observableArray(),this.uploadingFiles=r.observableArray(),this.rootPath=r.observable(this.bPublic?A.PublicFolderName:n.i18n("FILESWEBCLIENT/LABEL_PERSONAL_STORAGE")),this.storageType=r.observable(w.FileStorageType.Personal),this.currentStorage=r.computed((function(){return this.getStorageByType(this.storageType())}),this),this.storageDroppable=r.computed((function(){return this.currentStorage()?this.currentStorage().droppable():""}),this),this.storageDisplayName=r.computed((function(){return this.currentStorage()?this.currentStorage().displayName:""}),this),this.storageType.subscribe((function(){this.bPublic?this.rootPath(A.PublicFolderName):(this.currentStorage()&&this.rootPath(this.currentStorage().displayName),this.selector.listCheckedAndSelected(!1))}),this),this.createButtonsControllers=r.observableArray([]),this.pathItems=r.observableArray(),this.currentPath=r.observable(""),this.isZipFolder=r.computed((function(){var e=this.currentPath().split("$ZIP:");return"zip"===h.getFileExtension(e[0])}),this),this.dropPath=r.observable(""),r.computed((function(){this.dropPath(this.currentPath())}),this),this.isCorporateStorage=r.computed((function(){return this.storageType()===w.FileStorageType.Corporate}),this),this.isSharedStorage=r.computed((function(){return this.storageType()===w.FileStorageType.Shared}),this),this.isEncryptedStorage=r.computed((function(){return this.storageType()===w.FileStorageType.Encrypted}),this),this.isExternalStorage=r.computed((function(){return this.currentStorage()&&this.currentStorage().isExternal}),this),this.foldersCollection=r.computed((function(){var e=this.folders();return e.sort(((e,t)=>{let i;switch(this.sortBy()){case w.FilesSortField.Filename:case w.FilesSortField.Size:i=e.fileName()===t.fileName()?0:e.fileName()
{let i;switch(this.sortBy()){case w.FilesSortField.Filename:i=e.fileName()===t.fileName()?0:e.fileName()
0&&this.allSelectedFilesReady()}),this),this.sendCommand=h.createCommand(this,this.executeSend,this.isSendAllowed),this.isRenameAllowed=r.computed((function(){var e=this.sharedParentFolder(),t=this.selector.listCheckedAndSelected(),i=1===t.length?t[0]:null;return!this.isZipFolder()&&(!e||e.sharedWithMeAccessWrite())&&this.allSelectedFilesReady()&&i}),this),this.renameCommand=h.createCommand(this,this.executeRename,this.isRenameAllowed),this.bSortEnabled=A.Sorting&&A.Sorting.Allow&&A.Sorting.DisplayOptions&&A.Sorting.DisplayOptions.length>0,this.sortBy=r.observable(A.Sorting.DefaultSortBy),this.sortOrder=r.observable(A.Sorting.DefaultSortOrder),this.aSortList=[],this.bSortEnabled&&s.each(w.FilesSortField,function(e,t){A.Sorting.DisplayOptions.indexOf(t)>=0&&this.aSortList.push({sText:n.i18n("FILESWEBCLIENT/SORT_OPTION_"+t.toUpperCase()),sSortBy:e})}.bind(this)),this.itemsToDeleteCount=r.computed((function(){var e=this.sharedParentFolder();return e&&e.sharedWithMeAccessWrite()?this.selector.listCheckedAndSelected().length:this.selectedOwnItems().length}),this),this.isDeleteAllowed=r.computed((function(){return!this.isZipFolder()&&this.itemsToDeleteCount()>0&&this.allSelectedFilesReady()}),this),this.deleteCommand=h.createCommand(this,this.executeDelete,this.isDeleteAllowed),this.needToCopyDraggedItems=r.observable(!1),this.isCurrentStorageDroppable=r.computed((function(){return!this.sharedParentFolder()||this.needToCopyDraggedItems()||this.sharedParentFolder()&&this.sharedParentFolder().sharedWithMeAccessWrite()}),this),this.isCutAllowed=r.computed((function(){var e=this.sharedParentFolder(),t=this.selector.listCheckedAndSelected();return!this.isZipFolder()&&(!e&&!this.isSharedStorage()||!!e&&e.sharedWithMeAccessWrite())&&this.allSelectedFilesReady()&&t.length>0}),this),this.isCopyAllowed=r.computed((function(){return this.allSelectedFilesReady()&&this.selector.listCheckedAndSelected().length>0}),this),this.isDragAllowed=r.computed((function(){return this.isCutAllowed()||this.needToCopyDraggedItems()&&this.isCopyAllowed()}),this),this.isShareAllowed=r.computed((function(){const e=this.selector.listCheckedAndSelected(),t=1===e.length?e[0]:null;return t&&t.oExtendedProps,!this.isZipFolder()&&t&&!t.bIsLink&&(!this.sharedParentFolder()||this.sharedParentFolder().sharedWithMeAccessReshare()||t.sharedWithMeAccessReshare())&&this.allSelectedFilesReady()&&(t.IS_FILE||!this.isEncryptedStorage())&&(!t.sharedWithMe()||t.sharedWithMeAccessReshare())}),this),this.createPublicLinkCommand=h.createCommand(this,this.createPublicLink,this.isShareAllowed),this.isCreateAllowed=r.computed((function(){var e=this.sharedParentFolder();return!this.isZipFolder()&&(e&&e.sharedWithMeAccessWrite()||!e&&!this.isSharedStorage())}),this),this.createFolderCommand=h.createCommand(this,this.executeCreateFolder,this.isCreateAllowed),this.isCreateShortcutAllowed=r.computed((function(){return this.isCreateAllowed()&&!this.isExternalStorage()&&!this.isEncryptedStorage()}),this),this.createShortcutCommand=h.createCommand(this,this.executeCreateShortcut,this.isCreateShortcutAllowed),this.uploaderButton=r.observable(null),this.uploaderArea=r.observable(null),this.bDragActive=r.observable(!1),this.isNewItemsMenuOpened=r.observable(!1),this.bDragActiveComp=r.computed((function(){return this.bDragActive()&&""===this.searchPattern()}),this),this.isDragAndDropSupported=r.observable(!1),this.isCreateAllowed.subscribe((function(){this.oJua&&this.oJua.setDragAndDropEnabledStatus(this.isCreateAllowed())}),this),this.uploadError=r.observable(!1),this.quota=r.observable(0),this.used=r.observable(0),this.quotaDesc=r.observable(""),this.quotaProc=r.observable(-1),this.bShowQuotaBarTextAsTooltip=y.ShowQuotaBarTextAsTooltip,this.aBottomLeftCornerLinks=A.BottomLeftCornerLinks,r.computed((function(){if(!y.ShowQuotaBar)return!0;var e=this.quota(),t=this.used(),i=0
0&&-1!==i&&y.QuotaWarningPerc>100-i&&m.showError(n.i18n("COREWEBCLIENT/WARNING_QUOTA_ALMOST_REACHED"),!0)}),this),this.dragover=r.observable(!1),this.loading=r.observable(!1),this.loadedFiles=r.observable(!1),this.fileListInfoText=r.computed((function(){var e="";return this.loading()?e=n.i18n("COREWEBCLIENT/INFO_LOADING"):this.loadedFiles()?0===this.collection().length&&(""!==this.searchPattern()?e=n.i18n("FILESWEBCLIENT/INFO_NOTHING_FOUND"):this.isSharedStorage()?e=n.i18n("FILESWEBCLIENT/INFO_SHARED_FOLDER_IS_EMPTY"):""!==this.currentPath()||this.bInPopup||this.bPublic?e=n.i18n("FILESWEBCLIENT/INFO_FOLDER_IS_EMPTY"):this.isDragAndDropSupported()&&(e=n.i18n("FILESWEBCLIENT/INFO_DRAGNDROP_FILES_OR_CREATE_FOLDER"))):this.error()&&(e=n.i18n("FILESWEBCLIENT/ERROR_FILES_NOT_RECEIVED")),e}),this),this.bInPopup=!!e,this.timerId=null;var i={View:this,TemplateName:"FilesWebclient_ItemsView"};this.itemsViewTemplate=r.observable(i.TemplateName),c.broadcastEvent("Files::ChangeItemsView",i),c.subscribeEvent("Files::ShowList",s.bind((function(e){this.shown()&&e.Item&&this.routeFiles(e.Item.storageType(),e.Item.fullPath())}),this)),g.opened.subscribe(s.bind((function(){this.shown()&&this.selector.useKeyboardKeys(!0)}),this)),this.PublicLinksEnabled=A.PublicLinksEnabled,this.currentFolderStatsString=r.computed((function(){let e=0,t=0,i="";return this.files().forEach((i=>{e+=i.selected()||i.checked()?i.size():0,t+=i.size()})),i=0===this.files().length&&0===this.folders().length?"":n.i18n("FILESWEBCLIENT/CURRENT_FOLDER_STATS",{SIZE_OVERAL:n.getFriendlySize(t),FILES_OVERAL:this.files().length,FOLDERS_OVERAL:this.folders().length}),i+=0===this.selectedFiles().length?"":" | "+n.i18n("FILESWEBCLIENT/CURRENT_FOLDER_STATS_SELECTED_FILES",{SIZE_SELECTED:n.getFriendlySize(e),FILES_SELECTED:this.selectedFiles().length}),i+=0===this.selectedFolders().length?"":" | "+n.i18n("FILESWEBCLIENT/CURRENT_FOLDER_STATS_SELECTED_FOLDERS",{FOLDERS_SELECTED:this.selectedFolders().length}),i}),this).extend({rateLimit:{timeout:100,method:"notifyWhenChangesStop"}}),this.addToolbarButtons=r.observableArray([]),this.storageControllers=r.observableArray(),this.controllers=r.computed((()=>[...this.addToolbarButtons(),...this.storageControllers()])),c.broadcastEvent("FilesWebclient::RegisterFilesController",((e,t)=>{this.registerController(e,t)})),c.broadcastEvent("FilesWebclient::ConstructView::after",{Name:this.ViewConstructorName,View:this})}s.extendOwn(D.prototype,b.prototype),D.prototype.ViewTemplate=c.isPublic()?"FilesWebclient_PublicFilesView":"FilesWebclient_FilesView",D.prototype.ViewConstructorName="CFilesView",D.prototype.registerCreateButtonsController=function(e){this.createButtonsControllers.push(e)},D.prototype.onBind=function(e){var t=this.$viewDom||e;this.selector.initOnApplyBindings(".items_sub_list .item",".items_sub_list .selected.item",".items_sub_list .item .custom_checkbox",o(".panel.files .items_list",t),o(".panel.files .items_list .files_scroll.scroll-inner",t)),o(".files_scroll").on("click",(e=>{const t=e.target?.className||"";(t.includes("files_scroll")||t.includes("items_list")||t.includes("items_sub_list"))&&this.selector.listCheckedAndSelected(!1)})),this.initUploader(),this.hotKeysBind()},D.prototype.hotKeysBind=function(){o(document).on("keydown",s.bind((function(e){this.shown()&&e&&e.keyCode===w.Key.s&&this.selector.useKeyboardKeys()&&!h.isTextFieldFocused()&&(e.preventDefault(),this.isSearchFocused(!0))}),this))},D.prototype.initUploader=function(){var e=this;!this.bPublic&&this.uploaderButton()&&this.uploaderArea()&&(this.oJua=new u({action:"?/Api/",name:"jua-uploader",queueSize:2,clickElement:this.uploaderButton(),hiddenElementsPosition:y.IsRTL?"right":"left",dragAndDropElement:this.uploaderArea(),disableAjaxUpload:!1,disableFolderDragAndDrop:!1,disableDragAndDrop:!1,hidden:s.extendOwn({Module:A.ServerModuleName,Method:"UploadFile",Parameters:function(t){return JSON.stringify({Type:e.storageType(),SubPath:t&&t.Folder||"",Path:e.dropPath(),Overwrite:!1})}},c.getCommonRequestParameters())}),this.oJua.on("onProgress",s.bind(this.onFileUploadProgress,this)).on("onSelect",s.bind(this.onFileUploadSelect,this)).on("onStart",s.bind(this.onFileUploadStart,this)).on("onDrop",s.bind(this.onDrop,this)).on("onEmptyFolderDrop",this.onEmptyFolderDrop.bind(this)).on("onComplete",s.bind(this.onFileUploadComplete,this)).on("onBodyDragEnter",s.bind(this.bDragActive,this,!0)).on("onBodyDragLeave",s.bind(this.bDragActive,this,!1)).on("onCancel",s.bind(this.onCancelUpload,this)).on("onDialog",s.bind((function(){setTimeout(s.bind(this.isNewItemsMenuOpened,this,!1),10)}),this,!1)),this.isDragAndDropSupported(this.oJua.isDragAndDropSupported()))},D.prototype.isFileCanBeUploaded=function(e){return A.EnableUploadSizeLimit&&e.Size/1048576>A.UploadSizeLimitMb?(S.showPopup(E,[n.i18n("FILESWEBCLIENT/ERROR_SIZE_LIMIT",{FILENAME:e.FileName,SIZE:A.UploadSizeLimitMb})]),!1):!(this.storageType()===w.FileStorageType.Personal&&l.isPositiveNumber(this.quota())&&this.quota()>0&&this.used()+e.Size>this.quota()&&(S.showPopup(E,[n.i18n("COREWEBCLIENT/ERROR_CANT_UPLOAD_FILE_QUOTA")]),1))},D.prototype.onFileUploadSelect=function(e,t){if(!this.isFileCanBeUploaded(t))return!1;if(""===this.searchPattern()){const i=e=>!!this.getFileByName(e)||!!s.find(this.getUploadingFiles(),(function(t){return t.fileName()===e})),o=this.storageType(),r=this.currentPath(),n=v.prepareUploadFileData(t,r,o,i);let l=this.getUploadFileByUid(e);return l?(l.fileName(n.Name),l.fullPath(n.FullPath)):l=new v(n,this),l.onUploadSelect(e,t,!0),this.uploadingFiles.push(l),this.onFileFromSubfolderUploadSelect(t),!0}return!1},D.prototype.onFileFromSubfolderUploadSelect=function(e){if(l.isNonEmptyString(e.Folder)){var t=s.compact(e.Folder.split("/"))[0],i=s.find(this.folders(),(function(e){return e.fileName()===t}));t&&!i&&((i=new k(this)).parse({Name:t}),this.folders.push(i)),i.increaseUploadingFiles()}},D.prototype.onFileUploadStart=function(e){var t=this.getUploadFileByUid(e);t&&t.onUploadStart()},D.prototype.onFileUploadProgress=function(e,t,i){if(""===this.searchPattern()){var s=this.getUploadFileByUid(e);s&&s.onUploadProgress(t,i)}},D.prototype.onFileUploadComplete=function(e,t,i){if(""===this.searchPattern()){var s=this.getUploadFileByUid(e),o=!1;s?(s.onUploadComplete(e,t,i),this.onFileWithSubfolderUploadComplete(s),this.deleteUploadFileByUid(e),s.uploadError()?(this.uploadError(!0),i&&i.ErrorCode===w.Errors.CanNotUploadFileQuota?(S.showPopup(E,[n.i18n("COREWEBCLIENT/ERROR_CANT_UPLOAD_FILE_QUOTA")]),o=!0):i&&i.ErrorCode===w.Errors.FileAlreadyExists?(o=!0,m.showError(n.i18n("COREWEBCLIENT/ERROR_FILE_ALREADY_EXISTS"))):i&&i.ErrorCode===w.Errors.FileNotFound?(o=!0,m.showError(n.i18n("COREWEBCLIENT/ERROR_FILE_NOT_FOUND"))):m.showError(s.statusText())):(s.path()===this.currentPath()&&s.storageType()===this.storageType()&&this.files.push(s),0===this.uploadingFiles().length&&m.showReport(n.i18n("COREWEBCLIENT/REPORT_UPLOAD_COMPLETE"))),0===this.uploadingFiles().length&&(o=!0)):o=!0,o&&this.routeFiles(this.storageType(),this.currentPath(),this.searchPattern(),!0)}},D.prototype.onFileWithSubfolderUploadComplete=function(e){if(e.sUploadSubFolder){var t=s.compact(e.sUploadSubFolder.split("/"))[0],i=s.find(this.folders(),(function(e){return e.fileName()===t}));i&&i.increaseUploadedFiles()}},D.prototype.onEmptyFolderDrop=function(e){e&&e.fullPath&&("/"===e.fullPath.charAt(0)?e.fullPath.substr(1):e.fullPath,I.send("CreateFolder",{Type:this.storageType(),Path:this.currentPath(),FolderName:e.fullPath},this.onCreateFolderResponse,this))},D.prototype.onDrop=function(e,t){if(!this.bPublic)if(t&&t.target&&""===this.searchPattern()){var i=r.dataFor(t.target);i&&i instanceof k&&this.dropPath(i.fullPath())}else m.showReport(n.i18n("FILESWEBCLIENT/INFO_CANNOT_UPLOAD_SEARCH_RESULT"))},D.prototype.filesDrop=function(e,t,i){if(!this.bPublic&&this.isDragAllowed()&&t){var s=this.selector.listCheckedAndSelected(),o=this.needToCopyDraggedItems()?"Copy":"Move";this.moveItems(o,e,s)&&h.uiDropHelperAnim(t,i)}},D.prototype.moveItems=function(e,t,i){if(this.bPublic)return!1;var o="",r="",l=!0,h=t instanceof k?t.fullPath():"",a=[],c=t?t instanceof k?t.storageType():t.type:this.storageType(),u=this.getStorageByType(c),d=this.currentStorage(),p=u.type===d.type,f=this.used(),m=this.quota();if(p||!p&&!u.isExternal&&!d.isExternal&&w.FileStorageType.Shared!==u.type){if(u.type===w.FileStorageType.Personal&&d.type!==w.FileStorageType.Personal&&!s.every(i,(function(e){if(e instanceof v){if(m>0&&f+e.size()>m)return!1;f+=e.size()}return!0})))return S.showPopup(E,[n.i18n("FILESWEBCLIENT/ERROR_CANT_MOVE_FILES_QUOTA_PLURAL",{},"",i.length)]),!1;if(s.each(i,s.bind((function(t){(""!==o&&o!==t.path()||""!==r&&r!==t.storageType())&&(l=!1),o=t.path(),r=t.storageType(),t instanceof k&&h===o+"/"+t.id()||("Move"===e&&(t instanceof v?this.deleteFileByName(t.id()):this.deleteFolderByName(t.fileName())),a.push({FromType:r,FromPath:o,Name:t.id(),IsFolder:t instanceof k}))}),this)),a.length>0)return l||(r="",o=""),I.send(e,{FromType:r,ToType:c,FromPath:o,ToPath:h,Files:a},this.onMoveResponse,this),t instanceof k&&t.recivedAnim(!0),!0}return!1},D.prototype.onMoveResponse=function(e,t){e.Result?this.storageType()===t.Parameters.ToType&&this.currentPath()===t.Parameters.ToPath?this.routeFiles(this.storageType(),this.currentPath(),this.searchPattern()):this.getQuota():(e.ErrorCode===w.Errors.CanNotUploadFileQuota?S.showPopup(E,[n.i18n("FILESWEBCLIENT/ERROR_CANT_MOVE_FILES_QUOTA_PLURAL",{},"",t.Parameters.Files.length)]):a.showErrorByCode(e,n.i18n("FILESWEBCLIENT/ERROR_FILES_MOVE_PLURAL",{},"",t.Parameters.Files.length)),this.routeFiles(this.storageType(),this.currentPath(),this.searchPattern()))},D.prototype.dragAndDropHelper=function(e,t){if(!e||!e.allowDrag())return o("
");if(e.checked(!0),this.needToCopyDraggedItems(t),!this.isDragAllowed())return o("
");var i,r=h.draggableItems(),l=this.selector.listCheckedAndSelected(),a=s.countBy(l,(function(e){return e.IS_FILE?"file":"folder"})),c=t?"+ ":"";return i=a.file?a.folder?n.i18n("FILESWEBCLIENT/LABEL_DRAG_ITEMS_PLURAL",{COUNT:c+l.length},null,l.length):n.i18n("FILESWEBCLIENT/LABEL_DRAG_FILES_PLURAL",{COUNT:c+a.file},null,a.file):n.i18n("FILESWEBCLIENT/LABEL_DRAG_FOLDERS_PLURAL",{COUNT:c+a.folder},null,a.folder),o(".count-text",r).text(i),r},D.prototype.onItemDelete=function(){this.isDeleteAllowed()&&this.executeDelete()},D.prototype.onItemSelect=function(e){c.isMobile()&&e instanceof k&&this.onItemDblClick(e)},D.prototype.onEnter=function(e){this.onItemDblClick(e)},D.prototype.onItemDblClick=function(e){if(e){var t=e.getMainAction();switch(t){case"view":e instanceof v&&(this.onSelectClickPopupBound?this.onSelectClickPopupBound():e.executeAction(t));break;case"list":e instanceof k&&e.isIncomplete()||this.routeFiles(e.storageType(),e.fullPath())}}},D.prototype.onGetFilesResponse=function(e,t){var i=e.Result,o=t.Parameters;if(this.bNotLoading=!1,(o.Type===this.storageType()||o.Hash===A.PublicHash)&&o.Path===this.currentPath())if(i){var r=[],l=[];if(s.each(i.Items,(function(e){if(e.IsFolder){var t=new k(this);t.parse(e),this.checkIfFolderUploading(t),r.push(t)}else{var i=new v(e,this);i.oExtendedProps&&i.oExtendedProps.Loading&&(i.uploadError(!0),i.statusText(n.i18n("COREWEBCLIENT/LABEL_FILE_LOADING"))),i.index(l.length),l.push(i)}}),this),s.each(this.files(),(function(e,t,i){if(e.downloading()){var o=s.findIndex(l,(function(t){return e.fileName()===t.fileName()}));-1!==o&&(i[t].index(l[o].index()),l[o]=i[t])}})),this.folders(r),this.files(l),this.newSearchPattern(o.Pattern||""),this.searchPattern(o.Pattern||""),this.loadedFiles(!0),clearTimeout(this.timerId),this.parseQuota(i.Quota),s.isArray(i.Path)&&(this.pathItems.removeAll(),s.each(i.Path.reverse(),s.bind((function(e){var t=new k(this);t.parse(e),this.pathItems.push(t)}),this))),this.loading(!1),i.Access&&this.pathItems().length>0){const e=this.pathItems().length-1,t=this.pathItems()[e];t.oExtendedProps&&t.oExtendedProps.SharedWithMeAccess||(this.pathItems()[e].updateExtendedProps({SharedWithMeAccess:i.Access}),this.pathItems.valueHasMutated())}}else e.ErrorCode!==w.Errors.NotDisplayedError&&(this.loading(!1),this.error(!0),a.showErrorByCode(e,n.i18n("FILESWEBCLIENT/ERROR_FILES_NOT_RECEIVED")))},D.prototype.checkIfFolderUploading=function(e){s.each(this.uploadingFiles(),(function(t){if(t.sUploadSubFolder){var i=s.compact(t.sUploadSubFolder.split("/"))[0];e.fileName()===i&&e.increaseUploadingFiles()}}))},D.prototype.parseQuota=function(e){e&&(this.quota(l.pInt(e.Limit)),this.used(l.pInt(e.Used)))},D.prototype.onDeleteResponse=function(e,t){e.Result?(this.expungeFileItems(),this.getQuota()):(a.showErrorByCode(e),this.routeFiles(this.storageType(),this.currentPath(),this.searchPattern()))},D.prototype.executeRename=function(){var e=s.first(this.selector.listCheckedAndSelected()),t=A.EditFileNameWithoutExtension&&e instanceof v,i=t?h.getFileNameWithoutExtension(e.fileName()):e.fileName(),o=t?h.getFileExtension(e.fileName()):"";!this.bPublic&&e&&S.showPopup(P,[i,s.bind(this.renameItem,this,o)])},D.prototype.renameItem=function(e,t){var i=""===e?t:t+"."+e,o=s.first(this.selector.listCheckedAndSelected());return h.validateFileOrFolderName(i)?(I.send("Rename",{Type:o.storageType(),Path:o.path(),Name:o.id()||o.fileName(),NewName:i,IsLink:o.bIsLink,IsFolder:!o.IS_FILE},this.onRenameResponse,this),""):o instanceof k?n.i18n("FILESWEBCLIENT/ERROR_INVALID_FOLDER_NAME"):n.i18n("FILESWEBCLIENT/ERROR_INVALID_FILE_NAME")},D.prototype.executeSort=function(e){const t=this.sortBy();this.sortBy(e),t===e?this.sortOrder(this.sortOrder()===w.SortOrder.Asc?w.SortOrder.Desc:w.SortOrder.Asc):this.sortOrder(A.Sorting.DefaultSortOrder)},D.prototype.getFileIfOnlyOneSelected=function(){var e=this.selector.listCheckedAndSelected();return 1===e.length&&e[0]instanceof v?e[0]:null},D.prototype.executeDownload=function(){var e=this.getFileIfOnlyOneSelected();e&&e.executeAction("download")},D.prototype.createPublicLink=function(){var e=s.first(this.selector.listCheckedAndSelected());!this.bPublic&&e&&S.showPopup(L,[e])},D.prototype.executeSend=function(){var e=s.map(this.selectedFiles(),(function(e){return{Storage:e.storageType(),Path:e.path(),Name:e.id()||e.fileName()}}));this.bAllowSendEmails&&e.length>0&&I.send("SaveFilesAsTempFiles",{Files:e},(function(e){e.Result&&R(e.Result)}),this)},D.prototype.onShareIconClick=function(e){e&&S.showPopup(L,[e])},D.prototype.onSecureIconClick=function(e){e&&s.isFunction(e.onSecureIconClick)&&e.onSecureIconClick(e)},D.prototype.onFileShareIconClick=function(e){N&&e&&S.showPopup(N,[e,this.expungeFileItems.bind(this)])},D.prototype.onRenameResponse=function(e,t){e.Result||a.showErrorByCode(e,n.i18n("FILESWEBCLIENT/ERROR_FILE_RENAME")),this.routeFiles(this.storageType(),this.currentPath(),this.searchPattern(),!0)},D.prototype.refresh=function(){this.routeFiles(this.storageType(),this.currentPath(),this.searchPattern(),!0)},D.prototype.executeDelete=function(){var e=this.sharedParentFolder(),t=!!e&&e.sharedWithMeAccessWrite(),i=this.selector.listCheckedAndSelected()||[],o=t?i:this.selectedOwnItems(),r=o.length;if(!this.bPublic&&r>0){var l,h=i.length!==r,a=!!s.find(o,(function(e){return!e.IS_FILE})),c=!!s.find(o,(function(e){return e.IS_FILE}));l=h?n.i18n("FILESWEBCLIENT/CONFIRM_NOT_ALL_ITEMS_OWN"):a&&c?n.i18n("FILESWEBCLIENT/CONFIRM_DELETE_ITEMS_PLURAL",{COUNT:r},null,r):a?n.i18n("FILESWEBCLIENT/CONFIRM_DELETE_FOLDERS_PLURAL",{COUNT:r},null,r):n.i18n("FILESWEBCLIENT/CONFIRM_DELETE_FILES_PLURAL",{COUNT:r},null,r),this.selector.useKeyboardKeys(!1),S.showPopup(g,[l,s.bind(this.deleteItems,this,o),"",n.i18n("COREWEBCLIENT/ACTION_DELETE")])}},D.prototype.onShow=function(){this.loaded(!0),this.bPublic||this.requestStorages(),this.selector.useKeyboardKeys(!0),this.oJua&&this.oJua.setDragAndDropEnabledStatus(!0),this.controllers().forEach((e=>{"function"==typeof e.onShow&&e.onShow()}))},D.prototype.onHide=function(){this.selector.useKeyboardKeys(!1),this.oJua&&this.oJua.setDragAndDropEnabledStatus(!1),this.controllers().forEach((e=>{"function"==typeof e.onHide&&e.onHide()}))},D.prototype.getQuota=function(){I.send("GetQuota",{Type:this.storageType()},(function(e){e.Result&&this.parseQuota(e.Result)}),this)},D.prototype.getStorageByType=function(e){return s.find(this.storages(),(function(t){return t.type===e}))},D.prototype.requestStorages=function(){I.send("GetStorages",null,this.onGetStoragesResponse,this)},D.prototype.onGetStoragesResponse=function(e,t){var i=e.Result;i&&(s.each(i,(function(e){e.Type&&!this.getStorageByType(e.Type)&&this.storages.push({isExternal:e.IsExternal,type:e.Type,displayName:e.DisplayName,hideInList:!!e.HideInList,droppable:r.computed((function(){return e.IsDroppable&&this.isCurrentStorageDroppable()}),this)})}),this),this.expungeExternalStorages(s.map(i,(function(e){return e.Type}),this))),this.currentStorage()||(this.storageType(w.FileStorageType.Personal),this.pathItems.removeAll()),this.bInPopup&&this.routeFiles(this.storageType(),this.currentPath(),this.searchPattern(),!0)},D.prototype.clearAndShowLoading=function(){this.folders([]),this.files([]),this.loading(!0)},D.prototype.currentGetFiles=function(){var e=this.pathItems().length,t={Type:this.storageType(),Path:this.currentPath(),Pattern:this.searchPattern(),PathRequired:""!==this.currentPath()&&0===e};I.send("GetFiles",t,this.onGetFilesResponse,this)},D.prototype.routeFiles=function(e,t,i,s){this.disableRoute||(this.bPublic?f.setHash(T.getFiles("",t,""))&&(this.clearAndShowLoading(),I.send("GetPublicFiles",{Hash:A.PublicHash,Path:this.currentPath()},this.onGetFilesResponse,this)):(this.bNotLoading=s,this.bInPopup?this.onUserRoute(T.getParsedParams(e,t,i)):f.setHash(T.getFiles(e,t,i))&&(this.clearAndShowLoading(),this.currentGetFiles())))},D.prototype.addPathItems=function(e,t,i){var s=new k(this);s.storageType(e),s.fileName(i),s.path(t),s.fullPath(t),this.pathItems.unshift(s)},D.prototype.onRoute=function(e){var t=T.parseFiles(e);this.bPublic?this.onPublicRoute(t):this.onUserRoute(t),this.controllers().forEach((e=>{"function"==typeof e.onRoute&&e.onRoute(t)}))},D.prototype.onUserRoute=function(e){var t=0===this.storages().length||s.find(this.storages(),(function(t){return t.type===e.Storage}))?e.Storage:this.storages().length>0?this.storages()[0].type:"",i=e.Path;this.error(!1),this.storageType(t),this.currentPath(i),this.searchPattern(l.pString(e.Search)),this.loadedFiles(!1),this.populatePathItems(e),this.bNotLoading&&(this.files().length>0||this.folders().length>0)?this.timerId=setTimeout(s.bind((function(){this.loadedFiles()||this.error()||this.clearAndShowLoading()}),this),3e3):this.clearAndShowLoading(),this.currentGetFiles()},D.prototype.populatePathItems=function(e){var t=this.currentPath(),i=e.PathParts.reverse(),o=s.find(this.folders(),(function(e){return e.fullPath()===t})),r=s.findIndex(this.pathItems(),(function(e){return e.fullPath()===t}));if(-1!==r)this.pathItems(this.pathItems().slice(0,r+1));else if(o)this.pathItems.push(o);else if("google"!==this.storageType()||""===t){this.pathItems.removeAll(),s.each(i,s.bind((function(e){var i=t.lastIndexOf(e);this.addPathItems(this.storageType(),t,e),t=t.substr(0,i)}),this));var n={Type:this.storageType(),Path:this.currentPath()};I.send("GetAccessInfoForPath",n,(function(e){e&&e.Result&&(s.each(this.pathItems(),(function(t){var i=t.fullPath();"/"===i.substr(i.length-1,1)&&(i=i.substr(0,i.length-1)),e.Result[i]&&t.updateExtendedProps({SharedWithMeAccess:e.Result[i]})})),this.pathItems.valueHasMutated())}),this)}},D.prototype.onPublicRoute=function(e){var t=e.Path,i=e.PathParts.reverse(),o="";this.currentPath(t),this.pathItems.removeAll(),s.each(i,s.bind((function(i){var s=t.lastIndexOf(i);this.addPathItems(e.Storage,t,i),t=t.substr(0,s),o=i}),this)),o!==this.rootPath()&&this.addPathItems(e.Storage,"",this.rootPath()),this.clearAndShowLoading(),I.send("GetPublicFiles",{Hash:A.PublicHash,Path:this.currentPath()},this.onGetFilesResponse,this)},D.prototype.deleteItems=function(e,t,i="Delete"){var o=this.storageType(),r=this.currentPath();if(t&&0
{this.registerController(e,"ToolbarButton")}))},D.prototype.registerController=function(e,t){let i=!1;switch(t){case"Storage":this.storageControllers.push(e),i=!0;break;case"ToolbarButton":this.addToolbarButtons.push(e),i=!0}i&&"function"==typeof e.useFilesViewData&&e.useFilesViewData(this)},D.prototype.onFileRemove=function(e,t){var i=s.bind((function(e,t){var i={Type:this.storageType(),Path:this.currentPath(),Items:[{Path:this.currentPath(),Name:t,IsFolder:!1}]};I.send("Delete",i,(function(e){e.Result||a.showErrorByCode(e),this.currentGetFiles()}),this),this.onCancelUpload(e)}),this);t.downloading()?c.broadcastEvent("CFilesView::FileDownloadCancel",{oFile:t}):!t.uploaded()&&e&&(c.broadcastEvent("CFilesView::FileUploadCancel",{sFileUploadUid:e,sFileUploadName:t.fileName(),fOnUploadCancelCallback:i})||i(e,t.fileName()))},e.exports=D}}]);