@sync-in/server
Version:
The secure, open-source platform for file storage, sharing, collaboration, and sync
2 lines (1 loc) • 32.5 kB
JavaScript
import{b as ft,c as ht}from"./chunk-KSHPKI4G.js";import{A as ut,C as Ct,z as _t}from"./chunk-7VRUZRJG.js";import{a as dt}from"./chunk-MGGT6MIJ.js";import{a as re}from"./chunk-WI7FOANP.js";import{a as lt}from"./chunk-LLWSLOSX.js";import{d as Ge}from"./chunk-6OJZWYRZ.js";import"./chunk-JXZCNFW7.js";import{a as et}from"./chunk-MCLQFZ3S.js";import{a as ct}from"./chunk-ZC5NIT55.js";import"./chunk-NE4NDO45.js";import{a as Je,b as tt,c as it,d as nt,e as ot,f as at,h as rt,i as st}from"./chunk-FNFGUIQH.js";import{a as oe,b as ae,c as Xe,d as Ze}from"./chunk-54EAZ2UD.js";import{e as mt}from"./chunk-F2J2IIJE.js";import{f as pt,g as ie}from"./chunk-MVO4WZLK.js";import"./chunk-7ZRXJONB.js";import"./chunk-JF7S3UYQ.js";import{f as te}from"./chunk-VPJ2V27B.js";import{B as Y,Gb as je,Hb as I,Ib as ne,Ja as He,O as We,Rb as Ye,Xa as Qe,kb as ze,lb as W,ob as Z,pa as Ue,qa as $e,ra as qe,v as Me,w as Ve,wb as ee}from"./chunk-4U5A2DEP.js";import"./chunk-22EANI6R.js";import{b as Se,d as xe}from"./chunk-BIUNUYZ5.js";import{$c as be,Cb as f,Eb as c,Ed as De,Ef as Le,Fd as j,Gc as ge,Gd as Pe,Gf as J,Ib as B,If as Be,Jb as N,Kb as O,L,Ma as a,Mb as F,Nb as U,Ob as R,Pb as m,Qb as E,Rb as D,Re as Fe,Sb as ue,Tb as M,Ub as V,Ue as Re,Uf as Ne,Vb as P,Xa as $,Xb as H,Yb as fe,Zc as z,Zf as Oe,_a as q,_b as Ce,ab as w,ad as ve,bb as de,bf as Ie,cg as Ke,dc as b,ec as Q,ed as ye,f as me,fc as v,gc as he,ha as y,ib as _e,jb as g,jd as we,kb as S,ma as C,na as h,nb as A,ob as k,of as G,pb as p,pe as Ae,qb as s,rb as l,sb as u,se as ke,td as Te,vf as X,wd as Ee,yd as K,zb as x}from"./chunk-HW2H3ISM.js";import{a as ce,b as pe}from"./chunk-RTRJ3KFH.js";var gt=(()=>{let r=class r{transform(n,o,i){if(typeof o>"u"||typeof o=="number"&&typeof i>"u")throw new Error("TimeAddPipe: missing required arguments");return(0,Y.default)(n).add(o,i)}};r.\u0275fac=function(o){return new(o||r)},r.\u0275pipe=q({name:"amAdd",type:r,pure:!0});let e=r;return e})();var St=(()=>{let r=class r{transform(n,o){if(!o)throw new Error("TimeDurationPipe: missing required time unit argument");return Y.default.duration({[o]:n}).humanize()}};r.\u0275fac=function(o){return new(o||r)},r.\u0275pipe=q({name:"amDuration",type:r,pure:!1});let e=r;return e})();function Tt(e,r){if(e&1&&(s(0,"span"),m(1),l()),e&2){let t=c();a(),E(t.space.name)}}function Et(e,r){e&1&&(s(0,"span",3),m(1,"Create a new space"),l())}function Dt(e,r){if(e&1&&u(0,"fa-icon",4),e&2){let t=c();p("icon",t.icons.faSpinner)}}function Mt(e,r){e&1&&(s(0,"h4",5)(1,"span",3),m(2,"Edit space"),l()())}function Vt(e,r){if(e&1&&(u(0,"fa-icon",45),s(1,"span",46),m(2,"Settings"),l()),e&2){let t=c();p("icon",t.icons.faCog)}}function Pt(e,r){if(e&1&&(s(0,"div",21)(1,"label",47),m(2,"Storage Usage"),l(),u(3,"app-storage-usage",48),l()),e&2){let t=c();a(3),p("item",t.space)}}function At(e,r){if(e&1&&(s(0,"span"),m(1),b(2,"amAdd"),b(3,"amTimeAgo"),l()),e&2){let t=c(2);a(),D("\xA0",v(3,5,he(2,1,t.space.disabledAt,t.SPACE_MAX_DISABLED_DAYS,"days"),!0))}}function kt(e,r){if(e&1&&(s(0,"span"),m(1),b(2,"amDuration"),l()),e&2){let t=c(2);a(),D("\xA0",v(2,1,t.SPACE_MAX_DISABLED_DAYS,"days"))}}function Ft(e,r){if(e&1&&(s(0,"div",27)(1,"span",3),m(2,"Space and data will be deleted in"),l(),s(3,"span",49),g(4,At,4,8,"span")(5,kt,3,4,"span"),l()()),e&2){let t=c();a(4),S(t.space.disabledAt?4:5)}}function Rt(e,r){e&1&&(s(0,"small",33),m(1,"At least one manager is required"),l())}function It(e,r){if(e&1&&(s(0,"div",56)(1,"label",57),m(2,"Deactivation date"),l(),s(3,"div",58),m(4),b(5,"amDateFormat"),l()()),e&2){let t=c(2);a(4),E(Q(5,1,t.space.disabledAt))}}function Lt(e,r){if(e&1&&(s(0,"div",34)(1,"div",50)(2,"label",51),m(3,"Creation date"),l(),s(4,"div",52),m(5),b(6,"amDateFormat"),l()(),s(7,"div",53)(8,"label",54),m(9,"Modification date"),l(),s(10,"div",55),m(11),b(12,"amDateFormat"),l()(),g(13,It,6,3,"div",56),l()),e&2){let t=c();a(5),E(Q(6,3,t.space.createdAt)),a(6),E(Q(12,5,t.space.modifiedAt)),a(2),S(t.space.disabledAt&&!t.space.enabled?13:-1)}}function Bt(e,r){if(e&1&&(u(0,"fa-icon",45),s(1,"span",59),m(2,"Files"),l(),s(3,"span"),m(4),l()),e&2){let t=c();p("icon",t.icons.faAnchor),a(4),D("(",(t.space.roots==null?null:t.space.roots.length)||0,")")}}function Nt(e,r){if(e&1&&(u(0,"fa-icon",45),s(1,"span",59),m(2,"Members"),l(),s(3,"span"),m(4),l()),e&2){let t=c();p("icon",t.icons.faUsers),a(4),D("(",t.space.members.length,")")}}function Ot(e,r){if(e&1&&(u(0,"fa-icon",45),s(1,"span",59),m(2,"Links"),l(),s(3,"span"),m(4),l()),e&2){let t=c();p("icon",t.icons.LINKS),a(4),D("(",t.space.links.length,")")}}function Wt(e,r){if(e&1){let t=x();s(0,"button",60),f("click",function(){C(t);let o=c();return h(o.confirmDeletion=!0)}),m(1," Remove "),l()}if(e&2){let t=c();p("disabled",t.confirmDeletion)}}function Ut(e,r){if(e&1){let t=x();s(0,"button",61),f("click",function(){C(t);let o=c();return h(o.openCreateLinkDialog())}),u(1,"fa-icon",45)(2,"fa-icon",45),m(3," Link "),l()}if(e&2){let t=c();a(),p("icon",t.icons.faPlus),a(),p("icon",t.icons.LINKS)}}function $t(e,r){if(e&1){let t=x();s(0,"button",63),f("click",function(){C(t);let o=c(2);return h(o.openAdminRootDialog())}),u(1,"fa-icon",45)(2,"fa-icon",45),m(3," External location "),l()}if(e&2){let t=c(2);a(),p("icon",t.icons.faPlus),a(),p("icon",t.icons.faUserShield)}}function qt(e,r){if(e&1){let t=x();s(0,"button",61),f("click",function(){C(t);let o=c();return h(o.openSelectRootDialog())}),u(1,"fa-icon",45)(2,"fa-icon",45),m(3," File "),l(),g(4,$t,4,2,"button",62)}if(e&2){let t=c();a(),p("icon",t.icons.faPlus),a(),p("icon",t.icons.faAnchor),a(2),S(t.user.isAdmin?4:-1)}}var le=(()=>{let r=class r{constructor(){this.space=new pt({id:0,name:"",createdAt:new Date,enabled:!0,storageUsage:0,storageQuota:null}),this.spaceChange=new de,this.locale=y(K),this.layout=y(ee),this.icons={SPACES:I.SPACES,LINKS:I.LINKS,faPen:G,faAnchor:X,faUserShield:ke,faPlus:J,faSpinner:Ie,faCog:Fe,faUsers:Ae},this.SPACE_MAX_DISABLED_DAYS=30,this.addRootFileEvent=new me,this.allowedLinkPermissions=[W.ADD,W.DELETE,W.MODIFY],this.editManagers=!1,this.confirmDeletion=!1,this.loading=!1,this.submitted=!1,this.userService=y(te),this.user=this.userService.user,this.spacesService=y(ie),this.linksService=y(mt)}ngOnInit(){this.space.id||this.space.managers.unshift(Ye(this.user,Z.IS_MANAGER))}searchManagers(n){let o={search:n,ignoreUserIds:[...this.space.managers.map(i=>i.id),...this.space.members.filter(i=>i.isUser).map(i=>i.id)],onlyUsers:!0};return this.userService.searchMembers(o)}searchMembers(n){let o={search:n,ignoreUserIds:[...this.space.managers.map(i=>i.id),...this.space.members.filter(i=>i.isUser).map(i=>i.id)],ignoreGroupIds:this.space.members.filter(i=>i.isGroup).map(i=>i.id)};return this.userService.searchMembers(o)}openSelectRootDialog(){this.layout.openDialog(_t,"xl",{initialState:{currentRoots:this.space.roots.filter(o=>o.owner.id===this.user.id)}}).content.submitEvent.pipe(L(1)).subscribe(o=>this.addRootFileEvent.next(o))}openAdminRootDialog(){this.layout.openDialog(ut,null,{initialState:{currentRoots:this.space.roots.filter(o=>o.externalPath)}}).content.submitEvent.pipe(L(1)).subscribe(o=>this.addRootFileEvent.next(o))}openEditLinkDialog(n){this.linksService.editLinkDialog(n,this.space,Ke.SPACE)}openCreateLinkDialog(){this.linksService.createLinkDialog(this.space)}onCancel(){this.confirmDeletion?this.confirmDeletion=!1:this.layout.closeDialog()}onSubmit(){this.loading=!0,this.submitted=!0,this.confirmDeletion?(this.space.id===0&&this.layout.closeDialog(),this.spacesService.deleteSpace(this.space.id,{deleteNow:!0}).subscribe({next:()=>{this.loading=!1,this.spaceChange.emit(["delete",this.space]),this.layout.closeDialog()},error:n=>{this.onError(),this.layout.sendNotification("error","Delete space",this.space.name,n)}})):this.space.id===0?this.spacesService.createSpace(this.space).subscribe({next:n=>{this.loading=!1,this.space=n,this.spaceChange.emit(["add",n]),this.layout.closeDialog()},error:n=>{this.onError(),this.layout.sendNotification("error","Create space",this.space.name,n)}}):this.spacesService.updateSpace(this.space).subscribe({next:n=>{this.loading=!1,n?(this.space=n,this.spaceChange.emit(["update",n])):this.spaceChange.emit(["delete",this.space]),this.layout.closeDialog()},error:n=>{this.onError(),this.layout.sendNotification("error","Edit space",this.space.name,n)}})}cantSubmit(){return this.submitted||!this.space.name||!this.space.managers.length}onError(){this.confirmDeletion=!1,this.submitted=!1,this.loading=!1}};r.\u0275fac=function(o){return new(o||r)},r.\u0275cmp=$({type:r,selectors:[["app-space-dialog"]],inputs:{space:"space"},outputs:{spaceChange:"spaceChange"},decls:62,vars:47,consts:[[1,"modal-header","align-items-center"],[1,"modal-title"],[1,"me-2",3,"icon"],["l10nTranslate",""],["animation","spin","size","sm",1,"ms-2",3,"icon"],[1,"modal-title","ms-auto"],["aria-label","Close","type","button",3,"click"],[1,"modal-body"],["type","pills",3,"justified"],[1,"my-3"],["customClass","tab-dialog form-validation",3,"selectTab"],["tabHeading",""],[1,"d-flex","col-12"],[1,"d-flex","flex-column","col-6","pe-2"],[1,"mb-3","px-0",2,"max-width","80%"],["for","name","l10nTranslate",""],["id","name","type","text","appAutofocus","","required","",3,"ngModelChange","ngModel"],["for","description","l10nTranslate",""],["id","description","type","text",1,"form-control","form-control-sm",3,"ngModelChange","ngModel"],[1,"d-flex","flex-column","align-items-start","mb-3",2,"max-width","80%"],[1,"w-100",3,"quotaChange","quota","fullWidth"],[1,"d-flex","flex-column","mb-3",2,"max-width","80%"],[1,"mb-3","px-0"],["for","switchStatus","l10nTranslate",""],[1,"d-flex","align-items-center","form-check","form-switch","cursor-pointer"],["id","switchStatus","type","checkbox","role","button",1,"form-check-input",3,"ngModelChange","ngModel"],["for","switchStatus","l10nTranslate","",1,"form-check-label","mb-0","ms-2"],[1,"text-danger","mt-2"],[1,"d-flex","flex-column","col-6"],["type","button",3,"click"],["for","editManagers","l10nTranslate","",1,"no-select-pointer"],["id","editManagers",1,"ms-1",3,"icon"],[3,"membersChange","members","searchFunction","editMode","hideInput","customPlaceholder"],["l10nTranslate","",1,"text-danger"],[1,"d-flex","d-none","d-lg-flex","mt-auto"],["customClass","tab-dialog",3,"selectTab"],[1,"col-12"],[3,"space","user","addRootFile"],[3,"membersChange","members","withPermissions","searchFunction"],[3,"membersChange","members","filterPermissions","allowedPermissions","withPermissions","editFunction","hideInput"],[1,"modal-footer"],["type","button","l10nTranslate","",1,"btn","btn-sm","btn-danger",3,"disabled"],["type","button","l10nTranslate","",1,"btn","btn-sm","btn-success"],["data-dismiss","modal","type","button","l10nTranslate","",1,"btn","btn-sm","btn-secondary","ms-auto",3,"click"],["type","button","l10nTranslate","",3,"click","disabled"],[3,"icon"],["l10nTranslate","",1,"ms-2"],["for","storage","l10nTranslate",""],["id","storage",3,"item"],[1,"fw-bold"],[1,"d-flex","flex-column","align-items-start","col-4","px-0"],["for","created","l10nTranslate",""],["id","created"],[1,"d-flex","flex-column","align-items-center","col-4","px-0"],["for","modified","l10nTranslate",""],["id","modified"],[1,"d-flex","flex-column","align-items-end","col-4","text-danger","px-0"],["for","disabled","l10nTranslate",""],["id","disabled"],["l10nTranslate","",1,"ms-2","me-1"],["type","button","l10nTranslate","",1,"btn","btn-sm","btn-danger",3,"click","disabled"],["type","button","l10nTranslate","",1,"btn","btn-sm","btn-success",3,"click"],["type","button","l10nTranslate","",1,"btn","btn-sm","btn-warning"],["type","button","l10nTranslate","",1,"btn","btn-sm","btn-warning",3,"click"]],template:function(o,i){o&1&&(s(0,"div",0)(1,"h4",1),u(2,"fa-icon",2),g(3,Tt,2,1,"span")(4,Et,2,0,"span",3),g(5,Dt,1,1,"fa-icon",4),l(),g(6,Mt,3,0,"h4",5),s(7,"button",6),f("click",function(){return i.layout.closeDialog()}),l()(),s(8,"div",7)(9,"tabset",8),u(10,"hr",9),s(11,"tab",10),f("selectTab",function(){return i.tabView=null}),w(12,Vt,3,1,"ng-template",11),s(13,"div",12)(14,"div",13)(15,"div",14)(16,"label",15),m(17," Space name "),l(),s(18,"input",16),P("ngModelChange",function(_){return V(i.space.name,_)||(i.space.name=_),_}),l()(),s(19,"div",14)(20,"label",17),m(21," Description "),l(),s(22,"input",18),P("ngModelChange",function(_){return V(i.space.description,_)||(i.space.description=_),_}),l()(),s(23,"div",19)(24,"app-storage-quota",20),P("quotaChange",function(_){return V(i.space.storageQuota,_)||(i.space.storageQuota=_),_}),l()(),g(25,Pt,4,1,"div",21),s(26,"div",22)(27,"label",23),m(28,"Space status"),l(),s(29,"div",24)(30,"input",25),P("ngModelChange",function(_){return V(i.space.enabled,_)||(i.space.enabled=_),_}),l(),s(31,"label",26),m(32),l()(),g(33,Ft,6,1,"div",27),l()(),s(34,"div",28)(35,"div",29),f("click",function(){return i.editManagers=!i.editManagers}),s(36,"label",30),m(37,"Managers"),l(),u(38,"fa-icon",31),l(),s(39,"app-user-search",32),P("membersChange",function(_){return V(i.space.managers,_)||(i.space.managers=_),_}),l(),g(40,Rt,2,0,"small",33),g(41,Lt,14,7,"div",34),l()()(),s(42,"tab",35),f("selectTab",function(){return i.tabView="roots"}),w(43,Bt,5,2,"ng-template",11),s(44,"div",36),u(45,"app-space-manage-roots",37),l()(),s(46,"tab",35),f("selectTab",function(){return i.tabView="members"}),w(47,Nt,5,2,"ng-template",11),s(48,"div",9)(49,"app-user-search",38),P("membersChange",function(_){return V(i.space.members,_)||(i.space.members=_),_}),l()()(),s(50,"tab",35),f("selectTab",function(){return i.tabView="links"}),w(51,Ot,5,2,"ng-template",11),s(52,"div",9)(53,"app-user-search",39),P("membersChange",function(_){return V(i.space.links,_)||(i.space.links=_),_}),l()()()()(),s(54,"div",40),g(55,Wt,2,1,"button",41),g(56,Ut,4,2,"button",42),g(57,qt,5,3),s(58,"button",43),f("click",function(){return i.onCancel()}),m(59,"Cancel"),l(),s(60,"button",44),f("click",function(){return i.onSubmit()}),m(61),l()()),o&2&&(a(2),p("icon",i.icons.SPACES),a(),S(i.space.id?3:4),a(2),S(i.loading?5:-1),a(),S(i.space.id?6:-1),a(),R(H("btn-close btn-close-white ",i.space.id?"ms-2":"ms-auto"," ms-2")),a(2),p("justified",!0),a(9),R(H("form-control form-control-sm ",i.space.name?"":"is-invalid")),M("ngModel",i.space.name),a(4),M("ngModel",i.space.description),a(2),M("quota",i.space.storageQuota),p("fullWidth",!0),a(),S(i.space.storageUsage?25:-1),a(5),M("ngModel",i.space.enabled),a(2),D(" ",i.space.enabled?"enabled":"disabled"," "),a(),S(i.space.enabled?-1:33),a(5),p("icon",i.icons.faPen),a(),M("members",i.space.managers),p("searchFunction",i.searchManagers.bind(i))("editMode",i.editManagers)("hideInput",!i.editManagers)("customPlaceholder","Type to search for managers to add"),a(),S(i.space.managers.length?-1:40),a(),S(i.space.id?41:-1),a(4),p("space",i.space)("user",i.user)("addRootFile",i.addRootFileEvent),a(4),M("members",i.space.members),p("withPermissions",!0)("searchFunction",i.searchMembers.bind(i)),a(4),M("members",i.space.links),p("filterPermissions",!0)("allowedPermissions",i.allowedLinkPermissions)("withPermissions",!0)("editFunction",i.openEditLinkDialog.bind(i))("hideInput",!0),a(2),S(!i.tabView&&i.space.id&&i.user.isAdmin?55:-1),a(),S(i.tabView==="links"?56:-1),a(),S(i.tabView==="roots"?57:-1),a(3),R(H("btn btn-sm ",i.confirmDeletion?"btn-danger":"btn-primary")),p("disabled",i.cantSubmit()),a(),D(" ",i.confirmDeletion?"Confirm permanent deletion of data":"Confirm"," "))},dependencies:[j,z,ot,it,tt,nt,Ee,ve,be,ye,Te,we,at,lt,st,ft,Ge,rt,gt,St,Je],encapsulation:2});let e=r;return e})();var Ht=["MainContextMenu"],Qt=["TargetContextMenu"],zt=()=>["roots","shares"],xt=(e,r)=>r.id,bt=(e,r)=>r.mid,vt=(e,r)=>r.key;function Kt(e,r){if(e&1){let t=x();s(0,"button",3),b(1,"translate"),f("click",function(){C(t);let o=c();return h(o.openSpaceDialog(!0))}),u(2,"fa-icon",7),l()}if(e&2){let t=c();p("tooltip",v(1,2,"New space",t.locale.language)),a(2),p("icon",t.icons.faPlus)}}function jt(e,r){if(e&1&&(s(0,"span",29),m(1),l()),e&2){let t=c().$implicit,n=c(2);F("font-size",n.galleryMode.textSize,"px"),a(),E(t.hTimeAgo)}}function Yt(e,r){if(e&1&&u(0,"app-user-avatar",30),e&2){let t=r.$implicit,n=c(4);p("user",t)("isMember",!0)("height",n.galleryMode.dimensions/3)("width",n.galleryMode.dimensions/3)}}function Gt(e,r){if(e&1&&(s(0,"span",26),A(1,Yt,1,4,"app-user-avatar",30,bt),l()),e&2){let t=c().$implicit;a(),k(t.managers)}}function Xt(e,r){if(e&1){let t=x();s(0,"div",21),f("click",function(){let o=C(t).$implicit,i=c(2);return h(i.onSelect(o))})("contextmenu",function(o){let i=C(t).$implicit,d=c(2);return h(d.onTargetContextMenu(o,i))})("pressup",function(o){let i=C(t).$implicit,d=c(2);return h(d.onTargetContextMenu(o,i))})("tap",function(){let o=C(t).$implicit,i=c(2);return h(i.browse(o))}),s(1,"div",22),u(2,"fa-icon",23),s(3,"span",24),g(4,jt,2,3,"span",25),l(),g(5,Gt,3,0,"span",26),l(),s(6,"div",27)(7,"span",28),m(8),l()()()}if(e&2){let t=r.$implicit,n=r.$index,o=c(2);F("height",o.galleryMode.dimensions,"px")("width",o.galleryMode.dimensions,"px"),U("disabled",!t.enabled)("selected",t.id===(o.selected==null?null:o.selected.id)),a(),_e("rowIndex",n),a(),F("min-width",o.galleryMode.image,"px")("min-height",o.galleryMode.image,"px")("font-size",o.galleryMode.faSize,"px"),p("icon",o.icons.SPACES),a(2),S(t.newly?4:-1),a(),S(t.managers.length?5:-1),a(2),F("font-size",o.galleryMode.textSize,"px"),a(),E(t.name)}}function Jt(e,r){if(e&1){let t=x();s(0,"div",12)(1,"app-virtual-scroll",18),b(2,"searchFilter"),f("contextmenu",function(o){C(t);let i=c();return h(i.onContextMenu(o))}),s(3,"div",19),A(4,Xt,9,21,"div",20,xt),l()()()}if(e&2){let t=c();a(),p("childHeight",t.galleryMode.dimensions)("childWidth",t.galleryMode.dimensions)("items",v(2,5,t.spaces,t.inputFilter.search()))("galleryMode",!0)("resizeOffset",110),a(3),k(t.scrollView==null?null:t.scrollView.viewPortItems)}}function Zt(e,r){if(e&1&&u(0,"fa-icon",37),e&2){let t=c(4);p("icon",t.sortTable.sortParam.asc?t.icons.faArrowDown:t.icons.faArrowUp)("fixedWidth",!1)}}function ei(e,r){if(e&1){let t=x();s(0,"th",36),f("click",function(){C(t);let o=c().$implicit,i=c(2);return h(i.sortBy(o.key))}),m(1),g(2,Zt,1,2,"fa-icon",37),l()}if(e&2){let t=c().$implicit,n=c(2);R(t.value.class),F("width",t.value.width,"%"),U("text-align-center",t.value.textCenter)("cursor-pointer",t.value.sortable),a(),D(" ",t.value.label," "),a(),S(n.sortTable.sortParam.column===t.key?2:-1)}}function ti(e,r){if(e&1&&g(0,ei,3,10,"th",35),e&2){let t=r.$implicit;S(t.value.show?0:-1)}}function ii(e,r){if(e&1&&(s(0,"div",40),u(1,"fa-icon",41),s(2,"div",42)(3,"span",28),m(4),l(),s(5,"span",43),m(6),l()()()),e&2){let t=c(3).$implicit,n=c(2);a(),p("icon",n.icons.SPACES)("fixedWidth",!1),a(3),E(t.name),a(2),E(t.description)}}function ni(e,r){if(e&1&&u(0,"app-user-avatar",44),e&2){let t=r.$implicit;p("user",t)("isMember",!0)}}function oi(e,r){if(e&1&&A(0,ni,1,2,"app-user-avatar",44,bt),e&2){let t=c(3).$implicit;k(t.managers)}}function ai(e,r){if(e&1&&(s(0,"span"),m(1),b(2,"joinCounts"),l()),e&2){let t=c(3).$implicit;a(),E(v(2,1,t.counts,Ce(4,zt)))}}function ri(e,r){if(e&1){let t=x();s(0,"span",47),f("click",function(){C(t);let o=c(6);return h(o.openSpaceRootsDialog())}),u(1,"fa-icon",7),m(2),l()}if(e&2){let t=c(4).$implicit,n=c(2);a(),p("icon",n.icons.faAnchor),a(),D("\xA0",t.counts.roots," ")}}function si(e,r){if(e&1){let t=x();s(0,"span",48),f("click",function(){C(t);let o=c(4).$implicit,i=c(2);return h(i.openChildShareDialog(o))}),u(1,"fa-icon",49),s(2,"span"),m(3),l()()}if(e&2){let t=c(4).$implicit,n=c(2);a(),p("icon",n.icons.SHARED),a(2),E(t.counts.shares)}}function li(e,r){if(e&1&&(g(0,ri,3,2,"span",45),g(1,si,4,2,"span",46)),e&2){let t=c(3).$implicit,n=c(2);S(t.counts!=null&&t.counts.roots?0:-1),a(),S(t.role===n.SPACE_ROLE.IS_MANAGER&&t.counts.shares?1:-1)}}function ci(e,r){if(e&1&&u(0,"app-file-permissions",50),e&2){let t=c(4).$implicit;p("permissions",t.hPerms)}}function pi(e,r){if(e&1&&g(0,ci,1,1,"app-file-permissions",50),e&2){let t=c(3).$implicit;S(t.permissions?0:-1)}}function mi(e,r){if(e&1&&m(0),e&2){let t=c(3).$implicit;D(" ",t.hTimeAgo," ")}}function di(e,r){if(e&1&&(s(0,"td"),g(1,ii,7,4,"div",40)(2,oi,2,0)(3,ai,3,5,"span")(4,li,2,2)(5,pi,1,1)(6,mi,1,1),l()),e&2){let t,n=c().$implicit,o=c().$implicit;R(fe("",n.value.class," ",n.value.newly?"prop-newly-"+o[n.value.newly]:"")),F("width",n.value.width,"%"),U("text-align-center",n.value.textCenter),a(),S((t=n.key)==="name"?1:t==="managers"?2:t==="members"?3:t==="infos"?4:t==="permissions"?5:t==="modified"?6:-1)}}function _i(e,r){if(e&1&&g(0,di,7,9,"td",39),e&2){let t=r.$implicit;S(t.value.show?0:-1)}}function ui(e,r){if(e&1){let t=x();s(0,"tr",38),f("click",function(){let o=C(t).$implicit,i=c(2);return h(i.onSelect(o))})("contextmenu",function(o){let i=C(t).$implicit,d=c(2);return h(d.onTargetContextMenu(o,i))})("pressup",function(o){let i=C(t).$implicit,d=c(2);return h(d.onTargetContextMenu(o,i))})("tap",function(){let o=C(t).$implicit,i=c(2);return h(i.browse(o))}),A(1,_i,1,1,null,null,vt),b(3,"keyvalue"),l()}if(e&2){let t=r.$implicit,n=c(2);U("disabled",!t.enabled)("selected",t.id===(n.selected==null?null:n.selected.id)),a(),k(v(3,4,n.tableHeaders,n.originalOrderKeyValue))}}function fi(e,r){if(e&1){let t=x();s(0,"table",31)(1,"thead")(2,"tr"),A(3,ti,1,1,null,null,vt),b(5,"keyvalue"),l()()(),s(6,"app-virtual-scroll",32),b(7,"searchFilter"),f("contextmenu",function(o){C(t);let i=c();return h(i.onContextMenu(o))}),s(8,"table",31)(9,"tbody",33),A(10,ui,4,7,"tr",34,xt),l()()()}if(e&2){let t=c();a(3),k(v(5,2,t.tableHeaders,t.originalOrderKeyValue)),a(3),p("bufferAmount",5)("items",v(7,5,t.spaces,t.inputFilter.search())),a(4),k(t.scrollView==null?null:t.scrollView.viewPortItems)}}function Ci(e,r){if(e&1&&(s(0,"span",51),u(1,"fa-icon",7),m(2,"New space"),l()),e&2){let t=c(2);a(),p("icon",t.icons.faPlus)}}function hi(e,r){}function gi(e,r){if(e&1){let t=x();w(0,Ci,3,1,"ng-template",15),f("execute",function(){C(t);let o=c();return h(o.openSpaceDialog(!0))}),w(1,hi,0,0,"ng-template",17)}e&2&&(a(),p("divider",!0))}function Si(e,r){if(e&1&&(s(0,"span",51),u(1,"fa-icon",7),m(2,"Refresh"),l()),e&2){let t=c();a(),p("icon",t.icons.faArrowRotateRight)}}function xi(e,r){if(e&1&&(s(0,"span",51),u(1,"fa-icon",7),m(2,"Edit space"),l()),e&2){let t=c(2);a(),p("icon",t.icons.faPen)}}function bi(e,r){if(e&1&&(s(0,"span",51),u(1,"fa-icon",7),m(2,"Edit children shares"),l()),e&2){let t=c(3);a(),p("icon",t.icons.SHARED)}}function vi(e,r){if(e&1){let t=x();w(0,bi,3,1,"ng-template",15),f("execute",function(){C(t);let o=c(2);return h(o.openChildShareDialog())})}}function yi(e,r){if(e&1){let t=x();w(0,xi,3,1,"ng-template",15),f("execute",function(){C(t);let o=c();return h(o.openSpaceDialog())}),g(1,vi,1,0,null,16)}if(e&2){let t=c();a(),S(t.selected!=null&&t.selected.counts.shares?1:-1)}}function wi(e,r){if(e&1&&(s(0,"span",51),u(1,"fa-icon",7),m(2,"Manage my anchored files"),l()),e&2){let t=c(2);a(),p("icon",t.icons.faAnchor)}}function Ti(e,r){if(e&1){let t=x();w(0,wi,3,1,"ng-template",15),f("execute",function(){C(t);let o=c();return h(o.openSpaceRootsDialog())})}}function Ei(e,r){}function Di(e,r){e&1&&w(0,Ei,0,0,"ng-template",17),e&2&&p("divider",!0)}function Mi(e,r){if(e&1&&(s(0,"span",51),u(1,"fa-icon",7),m(2,"Informations"),l()),e&2){let t=c();a(),p("icon",t.icons.faCircleInfo)}}var Kn=(()=>{let r=class r{constructor(){this.locale=y(K),this.layout=y(ee),this.SPACE_ROLE=Z,this.originalOrderKeyValue=Qe,this.TAB_MENU=He,this.icons={SPACES:I.SPACES,SHARED:I.SHARED_WITH_OTHERS,faAnchor:X,faArrowDown:Ne,faArrowUp:Re,faRotate:Pe,faArrowRotateRight:Be,faUpload:Le,faPlus:J,faPen:G,faCircleInfo:Oe},this.tableHeaders={name:{label:"Name",width:30,textCenter:!1,class:"",show:!0,sortable:!0},managers:{label:"Managers",width:10,class:"d-none d-md-table-cell",textCenter:!0,show:!0,sortable:!0},members:{label:"Members",width:20,class:"d-none d-md-table-cell",textCenter:!1,show:!0},infos:{label:"Infos",width:15,textCenter:!0,class:"d-none d-md-table-cell",show:!0},permissions:{label:"Permissions",width:10,textCenter:!0,class:"d-none d-lg-table-cell",show:!0,sortable:!0},modified:{label:"Modified",width:10,textCenter:!0,class:"d-none d-lg-table-cell",newly:"newly",show:!0,sortable:!0}},this.btnSortFields={name:"Name",managers:"Managers",permissions:"Permissions",modified:"Modified"},this.loading=!1,this.spaces=[],this.selected=null,this.canCreateSpace=!1,this.canEditSpace=!1,this.canManageRoots=!1,this.router=y(xe),this.activatedRoute=y(Se),this.spacesService=y(ie),this.store=y(ze),this.userService=y(te),this.sortSettings={default:[{prop:"name",type:"string"}],name:[{prop:"name",type:"string"}],managers:[{prop:"managers",type:"length"}],permissions:[{prop:"permissions",type:"length"}],modified:[{prop:"modified",type:"date"}]},this.sortTable=new Ze(this.constructor.name,this.sortSettings),this.loadSpaces(),this.canCreateSpace=this.userService.userHavePermission(We.SPACES_ADMIN),this.layout.setBreadcrumbIcon(I.SPACES),this.layout.setBreadcrumbNav({url:`/${ne.SPACES}/${je.SPACES}`,translating:!0,sameLink:!0}),this.activatedRoute.queryParams.subscribe(n=>this.focusOnSelect=n.select)}ngOnInit(){this.galleryMode=this.btnNavigationView.currentView()}loadSpaces(){this.loading=!0,this.onSelect(),this.spacesService.listSpaces().subscribe({next:n=>{this.sortBy(this.sortTable.sortParam.column,!1,n),this.loading=!1,this.focusOnSelect?this.focusOn(this.focusOnSelect):this.scrollView.scrollInto(-1)},error:n=>{this.spaces=[],this.loading=!1,this.layout.sendNotification("error","Spaces",n.error.message)}})}browse(n){n.enabled?this.router.navigate([ne.FILES,n.alias],{relativeTo:this.activatedRoute}).catch(console.error):this.layout.sendNotification("warning",n.name,"Space is disabled")}onSelect(n=null){n?(this.selected=n,this.canEditSpace=!!n.managers.find(o=>o.id===this.userService.user.id),this.canManageRoots=this.canEditSpace||n.havePermission(W.SHARE_INSIDE)):(this.selected=null,this.canEditSpace=!1,this.canManageRoots=!1),this.store.spaceSelection.set(this.selected)}sortBy(n,o=!0,i){this.spaces=this.sortTable.sortBy(n,o,i||this.spaces)}onContextMenu(n){n.preventDefault(),n.stopPropagation(),this.layout.openContextMenu(n,this.mainContextMenu)}onTargetContextMenu(n,o){n.preventDefault(),n.type==="contextmenu"&&n.stopPropagation(),this.onSelect(o),this.layout.openContextMenu(n,this.targetContextMenu)}openSpaceDialog(n=!1){n?this.layout.openDialog(le,"xl").content.spaceChange.pipe(L(1)).subscribe(i=>{let[d,_]=i;d==="add"&&(this.sortBy(this.sortTable.sortParam.column,!1,this.spaces.concat(_)),this.onSelect(_))}):this.selected&&this.canEditSpace&&this.spacesService.getSpace(this.selected.id).subscribe({next:o=>{this.layout.openDialog(le,"xl",{initialState:{space:o}}).content.spaceChange.pipe(L(1)).subscribe(d=>{let[_,T]=d;_==="update"?(this.selected.name=T.name,this.selected.alias=T.alias,this.selected.description=T.description,this.selected.counts=pe(ce({},T.counts),{shares:this.selected.counts.shares}),this.selected.modifiedAt=T.modifiedAt,this.selected.enabled=T.enabled,this.selected.managers=[...T.managers]):_==="delete"&&(this.onSelect(),this.sortBy(this.sortTable.sortParam.column,!1,this.spaces.filter(yt=>yt.id!==T.id)))})},error:o=>this.layout.sendNotification("error","Edit space",this.selected.name,o)})}openSpaceRootsDialog(){setTimeout(()=>{this.layout.openDialog(ht,"md",{initialState:{space:this.selected,user:this.userService.user}})},this.selected?0:100)}openChildShareDialog(n){n&&this.onSelect(n),this.layout.openDialog(Ct,null,{initialState:{space:this.selected}}).content.sharesCountEvent.subscribe(i=>this.selected.counts.shares=i)}focusOn(n){let o=this.spaces.find(i=>i.name===n);o&&(setTimeout(()=>this.scrollView.scrollInto(o),100),this.onSelect(o))}};r.\u0275fac=function(o){return new(o||r)},r.\u0275cmp=$({type:r,selectors:[["app-spaces"]],viewQuery:function(o,i){if(o&1&&(B(ae,5),B(oe,7),B(re,7),B(Ht,7),B(Qt,7)),o&2){let d;N(d=O())&&(i.scrollView=d.first),N(d=O())&&(i.inputFilter=d.first),N(d=O())&&(i.btnNavigationView=d.first),N(d=O())&&(i.mainContextMenu=d.first),N(d=O())&&(i.targetContextMenu=d.first)}},decls:34,vars:37,consts:[["MainContextMenu",""],["TargetContextMenu",""],[1,"app-top-menu"],["container","body","type","button",1,"btn","btn-sm","btn-secondary","me-1",3,"click","tooltip"],[3,"icon","animation"],["container","body","type","button",1,"btn","btn-sm","btn-secondary","me-1",3,"tooltip"],["container","body","type","button",1,"btn","btn-sm","btn-secondary","me-1",3,"click","disabled","tooltip"],[3,"icon"],[1,"ms-auto"],[1,"btn-group","btn-group-sm","me-1"],[1,"d-none","d-sm-block"],[3,"sortBy","switchView","sortParams","sortFields"],[1,"app-thumbs"],[1,"app-foot-menu"],[1,"mx-auto"],["contextMenuItem","",3,"execute"],["contextMenuItem",""],["contextMenuItem","",3,"divider"],[3,"contextmenu","childHeight","childWidth","items","galleryMode","resizeOffset"],["tabindex","-1",1,"row","g-0"],[1,"card",3,"disabled","selected","height","width"],[1,"card",3,"click","contextmenu","pressup","tap"],[1,"card-body"],[1,"circle-primary-icon",3,"icon"],[1,"label-top-right"],["l10nTranslate","",1,"badge","rounded-pill","bg-warning",3,"font-size"],[1,"label-bottom-left"],[1,"card-footer","text-center","text-truncate","p-1"],["draggable","false",1,"no-pointer-events"],["l10nTranslate","",1,"badge","rounded-pill","bg-warning"],[3,"user","isMember","height","width"],[1,"app-table"],[3,"contextmenu","bufferAmount","items"],["tabindex","-1"],[3,"disabled","selected"],["l10nTranslate","",3,"width","text-align-center","cursor-pointer","class"],["l10nTranslate","",3,"click"],[3,"icon","fixedWidth"],[3,"click","contextmenu","pressup","tap"],[3,"width","text-align-center","class"],[1,"d-flex","align-items-center"],[1,"circle-primary-icon",3,"icon","fixedWidth"],[1,"d-flex","flex-column","text-truncate"],["draggable","false",1,"no-pointer-events","text-muted","fs-xxxs"],[3,"user","isMember"],[1,"badge","rounded-pill","bg-primary","cursor-pointer","me-1"],[1,"badge","rounded-pill","bg-purple","cursor-pointer","me-1"],[1,"badge","rounded-pill","bg-primary","cursor-pointer","me-1",3,"click"],[1,"badge","rounded-pill","bg-purple","cursor-pointer","me-1",3,"click"],[1,"me-1",3,"icon"],["tooltipPlacement","auto",3,"permissions"],["l10nTranslate",""]],template:function(o,i){if(o&1){let d=x();s(0,"div",2)(1,"button",3),b(2,"translate"),f("click",function(){return C(d),h(i.loadSpaces())}),u(3,"fa-icon",4),l(),g(4,Kt,3,5,"button",5),s(5,"button",6),b(6,"translate"),f("click",function(){return C(d),h(i.openSpaceDialog())}),u(7,"fa-icon",7),l(),s(8,"button",6),b(9,"translate"),f("click",function(){return C(d),h(i.openChildShareDialog())}),u(10,"fa-icon",7),l(),s(11,"button",6),b(12,"translate"),f("click",function(){return C(d),h(i.openSpaceRootsDialog())}),u(13,"fa-icon",7),l(),s(14,"div",8)(15,"div",9),u(16,"app-input-filter",10),l(),s(17,"app-navigation-view",11),f("sortBy",function(T){return C(d),h(i.sortBy(T))})("switchView",function(T){return C(d),h(i.galleryMode=T)}),l()()(),g(18,Jt,6,8,"div",12)(19,fi,12,8),s(20,"div",13)(21,"span",14),m(22),b(23,"translate"),l()(),s(24,"context-menu",null,0),g(26,gi,2,1),w(27,Si,3,1,"ng-template",15),f("execute",function(){return C(d),h(i.loadSpaces())}),l(),s(28,"context-menu",null,1),g(30,yi,2,1),g(31,Ti,1,0,null,16),g(32,Di,1,1,null,17),w(33,Mi,3,1,"ng-template",15),f("execute",function(){return C(d),h(i.layout.showRSideBarTab(i.TAB_MENU.SELECTION))}),l()}o&2&&(a(),p("tooltip",v(2,22,"Refresh",i.locale.language)),a(2),p("icon",i.icons.faArrowRotateRight)("animation",i.loading?"spin":null),a(),S(i.canCreateSpace?4:-1),a(),p("disabled",!i.canEditSpace)("tooltip",v(6,25,"Edit space",i.locale.language)),a(2),p("icon",i.icons.faPen),a(),p("disabled",!i.canEditSpace||!(i.selected!=null&&i.selected.counts.shares))("tooltip",v(9,28,"Edit children shares",i.locale.language)),a(2),p("icon",i.icons.SHARED),a(),p("disabled",!i.canManageRoots)("tooltip",v(12,31,"Manage my anchored files",i.locale.language)),a(2),p("icon",i.icons.faAnchor),a(4),p("sortParams",i.sortTable.sortParam)("sortFields",i.btnSortFields),a(),S(i.galleryMode!=null&&i.galleryMode.enabled?18:19),a(4),ue("",i.spaces.length," ",v(23,34,"spaces",i.locale.language)),a(4),S(i.canCreateSpace?26:-1),a(4),S(i.canEditSpace?30:-1),a(),S(i.canManageRoots?31:-1),a(),S(i.canEditSpace||i.canManageRoots?32:-1))},dependencies:[j,z,et,ae,Ve,Me,qe,$e,Ue,re,oe,dt,ge,ct,De,Xe],encapsulation:2});let e=r;return e})();export{Kn as SpacesComponent};