@sync-in/server 1.3.3 → 1.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/package.json +1 -1
  3. package/static/{chunk-TJICEVPI.js → chunk-2OSA27SE.js} +1 -1
  4. package/static/{chunk-W37K2YDS.js → chunk-2PQGH3LQ.js} +1 -1
  5. package/static/{chunk-HX6BM5E5.js → chunk-2QNFUN7G.js} +1 -1
  6. package/static/{chunk-MWMJMTGE.js → chunk-3XDVB3TW.js} +1 -1
  7. package/static/{chunk-67ENNMPZ.js → chunk-4RF354LU.js} +1 -1
  8. package/static/{chunk-4GYSKJJC.js → chunk-55WOZ7P6.js} +1 -1
  9. package/static/{chunk-6WROUPVQ.js → chunk-5SYLS7WR.js} +1 -1
  10. package/static/{chunk-3SC36MTD.js → chunk-6HV65OKG.js} +1 -1
  11. package/static/{chunk-NJVHZKGK.js → chunk-7XBZXSHI.js} +1 -1
  12. package/static/{chunk-UILGGLKW.js → chunk-AS7H5UIO.js} +1 -1
  13. package/static/{chunk-2AC4RLMK.js → chunk-BOIXDTUT.js} +1 -1
  14. package/static/{chunk-ZGLYEYWA.js → chunk-ESSY62VJ.js} +1 -1
  15. package/static/{chunk-RTHDK2Z7.js → chunk-GLAK4VQT.js} +1 -1
  16. package/static/{chunk-DZNKFVGE.js → chunk-GW5AVRYT.js} +1 -1
  17. package/static/{chunk-TECWTVNM.js → chunk-HPRC4PXX.js} +1 -1
  18. package/static/{chunk-Q2UU32ST.js → chunk-MLLPT7BU.js} +1 -1
  19. package/static/{chunk-JEF7STYA.js → chunk-MTBJHA2L.js} +1 -1
  20. package/static/{chunk-MGWQFMQF.js → chunk-Q35EEVWP.js} +1 -1
  21. package/static/{chunk-QNGY6EWB.js → chunk-Q7LN54AP.js} +1 -1
  22. package/static/{chunk-2FUMMTEK.js → chunk-QKELW3MH.js} +1 -1
  23. package/static/{chunk-QVWBPQWU.js → chunk-SOYI5P5A.js} +1 -1
  24. package/static/{chunk-WA2KMN23.js → chunk-W4LKCEBR.js} +1 -1
  25. package/static/{chunk-JOPTBE35.js → chunk-WWKXW4MM.js} +1 -1
  26. package/static/{chunk-SDYSHQI5.js → chunk-X2BMM3NY.js} +1 -1
  27. package/static/{chunk-OR75MKSH.js → chunk-X4CIBLP6.js} +1 -1
  28. package/static/{chunk-6QJL2YDQ.js → chunk-XQFA4DLU.js} +1 -1
  29. package/static/{chunk-X7LCJ4LA.js → chunk-YQGJX5R7.js} +1 -1
  30. package/static/{chunk-LHULGE6M.js → chunk-ZEZVOO4G.js} +1 -1
  31. package/static/{chunk-XCIDAKI5.js → chunk-ZJDBESQA.js} +1 -1
  32. package/static/index.html +1 -1
  33. package/static/{main-64E5RI2M.js → main-2GG5BCQL.js} +3 -3
@@ -1 +1 @@
1
- import{x as xe,z as Se}from"./chunk-JOPTBE35.js";import{a as be}from"./chunk-DZNKFVGE.js";import{h as ge}from"./chunk-2AC4RLMK.js";import{g as Ce}from"./chunk-W37K2YDS.js";import{g as fe,h as _e}from"./chunk-3SC36MTD.js";import{Da as ce,Ib as de,Kb as ue,Qb as he,Xa as pe,bb as y,v as te,w as ie,xb as me,ya as le}from"./chunk-4GYSKJJC.js";import{Cb as h,Eb as l,Ed as Z,Fd as ee,Ga as V,Gc as Q,Gf as re,Ib as $,Jb as L,Kb as W,L as j,Ma as s,Nb as I,Ob as M,Pb as d,Qa as N,Qb as g,Tb as K,Ub as H,Vb as X,Xa as R,Xb as k,Za as U,Zc as F,bb as P,bf as ne,dc as C,ec as q,ed as z,f as A,fc as x,ha as f,jb as _,jd as Y,kb as b,kf as oe,ma as S,na as v,nb as T,ob as w,of as ae,pb as p,qb as r,rb as c,sb as m,vf as se,wd as G,ya as B,yd as J,zb as E}from"./chunk-JQOMI5VI.js";import{a as O,b as D}from"./chunk-RTRJ3KFH.js";var ye=(()=>{let a=class a{constructor(){this.inputField="name",this.fullWidth=!1,this.textCenter=!1,this.disableOnBlur=!0,this.disableFocus=!1,this.disableKeyboard=!1,this.updateObject=new P(!0),this.renamingInProgress=new P(!0),this.elementRef=f(B),this.renderer=f(N),this.dangerColor="#dd4b39",this.primaryColor="#3c8dbc"}ngOnInit(){this.initStyles(),this.renamingInProgress.emit(!0),this.elementRef.nativeElement.value=this.inputObject[this.inputField],setTimeout(()=>{this.setParentDraggable("false"),this.disableFocus||(this.elementRef.nativeElement.focus(),this.elementRef.nativeElement.select())},5)}onBlur(){this.disableOnBlur&&this.disableEdit()}onEnter(){this.disableKeyboard||(this.elementRef.nativeElement.value?this.elementRef.nativeElement.value===this.inputObject[this.inputField]?(this.setCorrectForm(),this.disableEdit()):(this.setCorrectForm(),this.updateObject.next({object:this.inputObject,name:this.elementRef.nativeElement.value}),this.disableEdit()):this.setIncorrectForm())}onEscape(){this.disableKeyboard||this.disableEdit()}initStyles(){this.renderer.setStyle(this.elementRef.nativeElement,"display","inline"),this.renderer.setStyle(this.elementRef.nativeElement,"height","100%"),this.renderer.setStyle(this.elementRef.nativeElement,"min-height","20px"),this.renderer.addClass(this.elementRef.nativeElement,"form-control"),this.renderer.addClass(this.elementRef.nativeElement,"form-control-sm"),this.textCenter?(this.renderer.addClass(this.elementRef.nativeElement,"text-center"),this.renderer.setStyle(this.elementRef.nativeElement,"padding","0")):this.renderer.setStyle(this.elementRef.nativeElement,"padding","2px"),this.fullWidth?this.renderer.addClass(this.elementRef.nativeElement,"w-100"):this.renderer.addClass(this.elementRef.nativeElement,"w-75")}setIncorrectForm(){this.renderer.addClass(this.elementRef.nativeElement,"is-invalid"),this.renderer.setStyle(this.elementRef.nativeElement,"border-color",this.dangerColor)}setCorrectForm(){this.renderer.removeClass(this.elementRef.nativeElement,"is-invalid"),this.renderer.setStyle(this.elementRef.nativeElement,"border-color",this.primaryColor)}disableEdit(){this.setParentDraggable("true"),this.renamingInProgress.emit(!1),setTimeout(()=>this.inputObject.isRenamed=!1,100)}setParentDraggable(e){this.renderer.setAttribute(this.elementRef.nativeElement.parentElement,"draggable",e)}};a.\u0275fac=function(t){return new(t||a)},a.\u0275dir=U({type:a,selectors:[["","appInputEdit",""]],hostBindings:function(t,o){t&1&&h("blur",function(){return o.onBlur()})("keyup.enter",function(){return o.onEnter()})("keyup.esc",function(){return o.onEscape()})},inputs:{inputObject:"inputObject",inputField:"inputField",fullWidth:"fullWidth",textCenter:"textCenter",disableOnBlur:"disableOnBlur",disableFocus:"disableFocus",disableKeyboard:"disableKeyboard"},outputs:{updateObject:"updateObject",renamingInProgress:"renamingInProgress"}});let i=a;return i})();var Ee=["InputRename"],Fe=(i,a)=>a.alias,Pe=(i,a)=>a.key;function Te(i,a){if(i&1&&m(0,"app-user-avatar",15)(1,"div",10),i&2){let n=l().$implicit;p("user",n.owner)}}function we(i,a){if(i&1){let n=E();r(0,"input",16,0),h("updateObject",function(t){S(n);let o=l(2);return v(o.onRenameRoot(t))}),c()}if(i&2){let n=l().$implicit;p("inputObject",n)("fullWidth",!0)}}function Ie(i,a){if(i&1&&(r(0,"span"),d(1),c()),i&2){let n=l(2).$implicit;s(),g(n.externalPath)}}function Me(i,a){if(i&1&&(r(0,"span"),d(1),C(2,"pathSlice"),c()),i&2){let n=l(2).$implicit;s(),g(x(2,1,n.file.path,-2))}}function ke(i,a){if(i&1&&(r(0,"div",17)(1,"span"),d(2),c()(),r(3,"div",18),_(4,Ie,2,1,"span")(5,Me,3,4,"span"),c()),i&2){let n=l().$implicit,e=l();s(2),g(n.name),s(2),b(e.user.isAdmin&&n.externalPath?4:5)}}function Oe(i,a){if(i&1){let n=E();r(0,"button",21),C(1,"translate"),X("ngModelChange",function(t){S(n);let o=l().$implicit,u=l().$implicit;return H(u.hPerms[o.key],t)||(u.hPerms[o.key]=t),v(t)}),h("ngModelChange",function(){S(n);let t=l(2).$implicit,o=l();return v(o.onPermissionChange(t))}),m(2,"fa-icon",22),c()}if(i&2){let n=l().$implicit,e=l().$implicit,t=l();M(k("btn btn-sm btn-custom ",!e.isDir&&(n.key==="a"||n.key==="d")?"disabled":"")),K("ngModel",e.hPerms[n.key]),p("tooltip",x(1,6,t.SPACES_PERMISSIONS_TEXT[n.key].text,t.locale.language)),s(2),p("icon",t.SPACES_PERMISSIONS_TEXT[n.key].icon)}}function De(i,a){if(i&1&&(r(0,"button",23),C(1,"translate"),m(2,"fa-icon",22),c()),i&2){let n=l().$implicit,e=l().$implicit,t=l();I("active",e.hPerms[n.key]),p("tooltip",x(1,4,t.SPACES_PERMISSIONS_TEXT[n.key].text,t.locale.language)),s(2),p("icon",t.SPACES_PERMISSIONS_TEXT[n.key].icon)}}function Ae(i,a){if(i&1&&_(0,Oe,3,9,"button",19)(1,De,3,7,"button",20),i&2){let n=l().$implicit,e=l();b(!(n.owner!=null&&n.owner.id)&&e.user.isAdmin||(n.owner==null?null:n.owner.id)===e.user.id?0:1)}}function je(i,a){if(i&1){let n=E();r(0,"div",1)(1,"div",2)(2,"div",3),_(3,Te,2,1),m(4,"img",4),r(5,"div",5),_(6,we,2,2,"input",6)(7,ke,6,2),c()(),r(8,"div",7)(9,"div",8),d(10),c(),r(11,"div",8),d(12),C(13,"amTimeAgo"),c()(),r(14,"div",9),m(15,"div",10),T(16,Ae,2,1,null,null,Pe),C(18,"keyvalue"),m(19,"div",11),r(20,"button",12),C(21,"translate"),h("click",function(){let t=S(n).$implicit,o=l();return v(o.setRenamed(t))}),m(22,"fa-icon",13),c(),r(23,"button",14),C(24,"translate"),h("click",function(){let t=S(n).$implicit,o=l();return v(o.removeRoot(t))}),m(25,"fa-icon",13),c()()()()}if(i&2){let n=a.$implicit,e=l();s(3),b(e.showUsers?3:-1),s(),I("cursor-pointer",!!n.file.path),p("src",n.file.mimeUrl,V)("tooltip",n.file.path),s(2),b(n.isRenamed?6:7),s(4),g(n.alias),s(2),g(q(13,15,n.createdAt)),s(4),w(x(18,17,n.hPerms,e.originalOrderKeyValue)),s(4),M(k("btn btn-sm ",n.isRenamed?"btn-success":"btn-custom"," me-2")),p("tooltip",x(21,20,"Rename",e.locale.language)),s(2),p("icon",e.icons.faPen),s(),p("tooltip",x(24,23,"Remove",e.locale.language)),s(2),p("icon",e.icons.faTimes)}}var Re=(()=>{let a=class a{constructor(){this.showUsers=!0,this.addRootFile=null,this.locale=f(J),this.icons={faTimes:oe,faPen:ae},this.SPACES_PERMISSIONS_TEXT=ue,this.originalOrderKeyValue=pe,this.subscription=null}ngOnInit(){this.addRootFile&&(this.subscription=this.addRootFile.subscribe(e=>this.addRoot(e)))}ngOnDestroy(){this.subscription&&this.subscription.unsubscribe()}addRoot(e){let t={id:0,alias:y(e.name,"alias",this.space.roots).toLowerCase(),name:y(e.name,"name",this.space.roots),permissions:"",createdAt:new Date};e.externalPath?(t.externalPath=e.externalPath,t.owner={id:null,login:null,email:null,fullName:null},t.file={id:0,path:null,mime:null}):(t.externalPath=null,t.owner={id:this.user.id,login:this.user.login,email:this.user.email,fullName:this.user.fullName},t.file={id:e.id,path:e.path,mime:e.mime}),this.space.addRoot(t,!0)}removeRoot(e){this.space.roots=this.space.roots.filter(t=>e.alias!==t.alias)}onRenameRoot(e){let t=e.object;t.alias=y(ce(e.name,!0),"alias",this.space.roots.filter(o=>o.id!==t.id)).toLowerCase(),t.name=y(e.name.replace(le,""),"name",this.space.roots.filter(o=>o.id!==t.id))}onPermissionChange(e){e.permissions=he(e.hPerms)}setRenamed(e){e.isRenamed?(this.onRenameRoot({object:e,name:this.inputRename.nativeElement.value}),e.isRenamed=!1):e.isRenamed=!0}};a.\u0275fac=function(t){return new(t||a)},a.\u0275cmp=R({type:a,selectors:[["app-space-manage-roots"]],viewQuery:function(t,o){if(t&1&&$(Ee,5),t&2){let u;L(u=W())&&(o.inputRename=u.first)}},inputs:{space:"space",user:"user",showUsers:"showUsers",addRootFile:"addRootFile"},decls:2,vars:0,consts:[["InputRename",""],[1,"bg-theme","mb-1","p-2",2,"border-radius","4px"],[1,"d-flex","align-items-center","text-truncate","no-select","fs-xs",2,"height","32px"],[1,"d-flex","align-items-center","text-truncate","me-auto"],["draggable","false","height","30","width","30","alt","",3,"src","tooltip"],[1,"d-flex","flex-column","text-truncate","ms-2"],["appInputEdit","","type","text","required","",3,"inputObject","fullWidth"],[1,"d-flex","flex-column","fs-xxxs","text-muted","d-none","d-lg-block","ms-3"],[1,"d-flex","justify-content-end"],[1,"d-flex","no-select"],[1,"vr","mx-2"],[1,"vr","ms-1","me-2"],["type","button",3,"click","tooltip"],[3,"icon"],["type","button",1,"btn","btn-sm","btn-danger",3,"click","tooltip"],["tooltipPlacement","bottom",3,"user"],["appInputEdit","","type","text","required","",3,"updateObject","inputObject","fullWidth"],[1,"text-truncate"],[1,"d-none","d-lg-block","fs-xxxs","text-truncate"],["btnCheckbox","","type","button",3,"ngModel","tooltip","class"],["type","button",1,"btn","btn-sm","btn-custom","disabled",3,"tooltip","active"],["btnCheckbox","","type","button",3,"ngModelChange","ngModel","tooltip"],["size","lg",3,"icon"],["type","button",1,"btn","btn-sm","btn-custom","disabled",3,"tooltip"]],template:function(t,o){t&1&&T(0,je,26,26,"div",1,Fe),t&2&&w(o.space.roots)},dependencies:[_e,fe,F,be,ie,te,G,z,Y,ye,Q,Z,ge,xe],encapsulation:2});let i=a;return i})();function Be(i,a){if(i&1&&m(0,"fa-icon",3),i&2){let n=l();p("icon",n.icons.faSpinner)}}function Ve(i,a){i&1&&(r(0,"span",5),d(1,"You have no files anchored on this space"),c())}var Pt=(()=>{let a=class a{constructor(){this.layout=f(me),this.addRootFileEvent=new A,this.icons={faAnchor:se,faPlus:re,faSpinner:ne,SPACES:de.SPACES},this.submitted=!1,this.loading=!1,this.spacesService=f(Ce)}ngOnInit(){this.space?.roots.length&&(this.space.roots=[]),this.spacesService.getUserSpaceRoots(this.space.id).subscribe({next:e=>this.setSpaceRoots(e),error:e=>{this.layout.sendNotification("error","Manage my anchored files",e.error.message)}})}openSelectRootDialog(){this.layout.openDialog(Se,"xl",{initialState:{currentRoots:this.space.roots.filter(t=>t.owner.id===this.user.id)}}).content.submitEvent.pipe(j(1)).subscribe(t=>this.addRootFileEvent.next(t))}onSubmit(){this.loading=!0,this.submitted=!0,this.spacesService.updateUserSpaceRoots(this.space.id,this.space.roots.map(e=>({id:e.id,alias:e.alias,name:e.name,permissions:e.permissions,file:{id:e.file.id,path:e.file.path,mime:e.file.mime}}))).subscribe({next:e=>{this.setSpaceRoots(e),this.layout.closeDialog()},error:e=>{this.layout.sendNotification("error","Manage my anchored files",e.error.message),this.submitted=!1,this.loading=!1}})}setSpaceRoots(e){this.space.roots=[];for(let t of e)this.space.addRoot(D(O({},t),{owner:this.user}),!0);this.space.counts.roots=this.space.roots.length}};a.\u0275fac=function(t){return new(t||a)},a.\u0275cmp=R({type:a,selectors:[["app-space-user-anchors-dialog"]],inputs:{space:"space",user:"user"},decls:22,vars:11,consts:[[1,"modal-header","align-items-center"],[1,"modal-title"],[1,"me-2",3,"icon"],["animation","spin","size","sm",1,"ms-2",3,"icon"],[1,"modal-title","ms-auto"],["l10nTranslate",""],["aria-label","Close","type","button",1,"btn-close","btn-close-white","ms-2",3,"click"],[1,"modal-body"],[3,"space","user","showUsers","addRootFile"],[1,"modal-footer"],["type","button","l10nTranslate","",1,"btn","btn-sm","btn-success",3,"click"],[3,"icon"],["data-dismiss","modal","type","button","l10nTranslate","",1,"btn","btn-sm","btn-secondary","ms-auto",3,"click"],["type","button","l10nTranslate","",1,"btn","btn-sm","btn-primary",3,"click","disabled"]],template:function(t,o){t&1&&(r(0,"div",0)(1,"h4",1),m(2,"fa-icon",2),r(3,"span"),d(4),c()(),_(5,Be,1,1,"fa-icon",3),r(6,"h4",4)(7,"span",5),d(8,"Manage my anchored files"),c()(),r(9,"button",6),h("click",function(){return o.layout.closeDialog()}),c()(),r(10,"div",7),m(11,"app-space-manage-roots",8),_(12,Ve,2,0,"span",5),c(),r(13,"div",9)(14,"button",10),h("click",function(){return o.openSelectRootDialog()}),m(15,"fa-icon",11)(16,"fa-icon",11),d(17," File "),c(),r(18,"button",12),h("click",function(){return o.layout.closeDialog()}),d(19,"Cancel"),c(),r(20,"button",13),h("click",function(){return o.onSubmit()}),d(21," Confirm "),c()()),t&2&&(s(2),p("icon",o.icons.SPACES),s(2),g(o.space.name),s(),b(o.loading?5:-1),s(6),p("space",o.space)("user",o.user)("showUsers",!1)("addRootFile",o.addRootFileEvent),s(),b(o.space.roots.length?-1:12),s(3),p("icon",o.icons.faPlus),s(),p("icon",o.icons.faAnchor),s(4),p("disabled",o.submitted))},dependencies:[F,ee,Re],encapsulation:2});let i=a;return i})();export{ye as a,Re as b,Pt as c};
1
+ import{x as xe,z as Se}from"./chunk-WWKXW4MM.js";import{a as be}from"./chunk-GW5AVRYT.js";import{h as ge}from"./chunk-BOIXDTUT.js";import{g as Ce}from"./chunk-2PQGH3LQ.js";import{g as fe,h as _e}from"./chunk-6HV65OKG.js";import{Da as ce,Ib as de,Kb as ue,Qb as he,Xa as pe,bb as y,v as te,w as ie,xb as me,ya as le}from"./chunk-55WOZ7P6.js";import{Cb as h,Eb as l,Ed as Z,Fd as ee,Ga as V,Gc as Q,Gf as re,Ib as $,Jb as L,Kb as W,L as j,Ma as s,Nb as I,Ob as M,Pb as d,Qa as N,Qb as g,Tb as K,Ub as H,Vb as X,Xa as R,Xb as k,Za as U,Zc as F,bb as P,bf as ne,dc as C,ec as q,ed as z,f as A,fc as x,ha as f,jb as _,jd as Y,kb as b,kf as oe,ma as S,na as v,nb as T,ob as w,of as ae,pb as p,qb as r,rb as c,sb as m,vf as se,wd as G,ya as B,yd as J,zb as E}from"./chunk-JQOMI5VI.js";import{a as O,b as D}from"./chunk-RTRJ3KFH.js";var ye=(()=>{let a=class a{constructor(){this.inputField="name",this.fullWidth=!1,this.textCenter=!1,this.disableOnBlur=!0,this.disableFocus=!1,this.disableKeyboard=!1,this.updateObject=new P(!0),this.renamingInProgress=new P(!0),this.elementRef=f(B),this.renderer=f(N),this.dangerColor="#dd4b39",this.primaryColor="#3c8dbc"}ngOnInit(){this.initStyles(),this.renamingInProgress.emit(!0),this.elementRef.nativeElement.value=this.inputObject[this.inputField],setTimeout(()=>{this.setParentDraggable("false"),this.disableFocus||(this.elementRef.nativeElement.focus(),this.elementRef.nativeElement.select())},5)}onBlur(){this.disableOnBlur&&this.disableEdit()}onEnter(){this.disableKeyboard||(this.elementRef.nativeElement.value?this.elementRef.nativeElement.value===this.inputObject[this.inputField]?(this.setCorrectForm(),this.disableEdit()):(this.setCorrectForm(),this.updateObject.next({object:this.inputObject,name:this.elementRef.nativeElement.value}),this.disableEdit()):this.setIncorrectForm())}onEscape(){this.disableKeyboard||this.disableEdit()}initStyles(){this.renderer.setStyle(this.elementRef.nativeElement,"display","inline"),this.renderer.setStyle(this.elementRef.nativeElement,"height","100%"),this.renderer.setStyle(this.elementRef.nativeElement,"min-height","20px"),this.renderer.addClass(this.elementRef.nativeElement,"form-control"),this.renderer.addClass(this.elementRef.nativeElement,"form-control-sm"),this.textCenter?(this.renderer.addClass(this.elementRef.nativeElement,"text-center"),this.renderer.setStyle(this.elementRef.nativeElement,"padding","0")):this.renderer.setStyle(this.elementRef.nativeElement,"padding","2px"),this.fullWidth?this.renderer.addClass(this.elementRef.nativeElement,"w-100"):this.renderer.addClass(this.elementRef.nativeElement,"w-75")}setIncorrectForm(){this.renderer.addClass(this.elementRef.nativeElement,"is-invalid"),this.renderer.setStyle(this.elementRef.nativeElement,"border-color",this.dangerColor)}setCorrectForm(){this.renderer.removeClass(this.elementRef.nativeElement,"is-invalid"),this.renderer.setStyle(this.elementRef.nativeElement,"border-color",this.primaryColor)}disableEdit(){this.setParentDraggable("true"),this.renamingInProgress.emit(!1),setTimeout(()=>this.inputObject.isRenamed=!1,100)}setParentDraggable(e){this.renderer.setAttribute(this.elementRef.nativeElement.parentElement,"draggable",e)}};a.\u0275fac=function(t){return new(t||a)},a.\u0275dir=U({type:a,selectors:[["","appInputEdit",""]],hostBindings:function(t,o){t&1&&h("blur",function(){return o.onBlur()})("keyup.enter",function(){return o.onEnter()})("keyup.esc",function(){return o.onEscape()})},inputs:{inputObject:"inputObject",inputField:"inputField",fullWidth:"fullWidth",textCenter:"textCenter",disableOnBlur:"disableOnBlur",disableFocus:"disableFocus",disableKeyboard:"disableKeyboard"},outputs:{updateObject:"updateObject",renamingInProgress:"renamingInProgress"}});let i=a;return i})();var Ee=["InputRename"],Fe=(i,a)=>a.alias,Pe=(i,a)=>a.key;function Te(i,a){if(i&1&&m(0,"app-user-avatar",15)(1,"div",10),i&2){let n=l().$implicit;p("user",n.owner)}}function we(i,a){if(i&1){let n=E();r(0,"input",16,0),h("updateObject",function(t){S(n);let o=l(2);return v(o.onRenameRoot(t))}),c()}if(i&2){let n=l().$implicit;p("inputObject",n)("fullWidth",!0)}}function Ie(i,a){if(i&1&&(r(0,"span"),d(1),c()),i&2){let n=l(2).$implicit;s(),g(n.externalPath)}}function Me(i,a){if(i&1&&(r(0,"span"),d(1),C(2,"pathSlice"),c()),i&2){let n=l(2).$implicit;s(),g(x(2,1,n.file.path,-2))}}function ke(i,a){if(i&1&&(r(0,"div",17)(1,"span"),d(2),c()(),r(3,"div",18),_(4,Ie,2,1,"span")(5,Me,3,4,"span"),c()),i&2){let n=l().$implicit,e=l();s(2),g(n.name),s(2),b(e.user.isAdmin&&n.externalPath?4:5)}}function Oe(i,a){if(i&1){let n=E();r(0,"button",21),C(1,"translate"),X("ngModelChange",function(t){S(n);let o=l().$implicit,u=l().$implicit;return H(u.hPerms[o.key],t)||(u.hPerms[o.key]=t),v(t)}),h("ngModelChange",function(){S(n);let t=l(2).$implicit,o=l();return v(o.onPermissionChange(t))}),m(2,"fa-icon",22),c()}if(i&2){let n=l().$implicit,e=l().$implicit,t=l();M(k("btn btn-sm btn-custom ",!e.isDir&&(n.key==="a"||n.key==="d")?"disabled":"")),K("ngModel",e.hPerms[n.key]),p("tooltip",x(1,6,t.SPACES_PERMISSIONS_TEXT[n.key].text,t.locale.language)),s(2),p("icon",t.SPACES_PERMISSIONS_TEXT[n.key].icon)}}function De(i,a){if(i&1&&(r(0,"button",23),C(1,"translate"),m(2,"fa-icon",22),c()),i&2){let n=l().$implicit,e=l().$implicit,t=l();I("active",e.hPerms[n.key]),p("tooltip",x(1,4,t.SPACES_PERMISSIONS_TEXT[n.key].text,t.locale.language)),s(2),p("icon",t.SPACES_PERMISSIONS_TEXT[n.key].icon)}}function Ae(i,a){if(i&1&&_(0,Oe,3,9,"button",19)(1,De,3,7,"button",20),i&2){let n=l().$implicit,e=l();b(!(n.owner!=null&&n.owner.id)&&e.user.isAdmin||(n.owner==null?null:n.owner.id)===e.user.id?0:1)}}function je(i,a){if(i&1){let n=E();r(0,"div",1)(1,"div",2)(2,"div",3),_(3,Te,2,1),m(4,"img",4),r(5,"div",5),_(6,we,2,2,"input",6)(7,ke,6,2),c()(),r(8,"div",7)(9,"div",8),d(10),c(),r(11,"div",8),d(12),C(13,"amTimeAgo"),c()(),r(14,"div",9),m(15,"div",10),T(16,Ae,2,1,null,null,Pe),C(18,"keyvalue"),m(19,"div",11),r(20,"button",12),C(21,"translate"),h("click",function(){let t=S(n).$implicit,o=l();return v(o.setRenamed(t))}),m(22,"fa-icon",13),c(),r(23,"button",14),C(24,"translate"),h("click",function(){let t=S(n).$implicit,o=l();return v(o.removeRoot(t))}),m(25,"fa-icon",13),c()()()()}if(i&2){let n=a.$implicit,e=l();s(3),b(e.showUsers?3:-1),s(),I("cursor-pointer",!!n.file.path),p("src",n.file.mimeUrl,V)("tooltip",n.file.path),s(2),b(n.isRenamed?6:7),s(4),g(n.alias),s(2),g(q(13,15,n.createdAt)),s(4),w(x(18,17,n.hPerms,e.originalOrderKeyValue)),s(4),M(k("btn btn-sm ",n.isRenamed?"btn-success":"btn-custom"," me-2")),p("tooltip",x(21,20,"Rename",e.locale.language)),s(2),p("icon",e.icons.faPen),s(),p("tooltip",x(24,23,"Remove",e.locale.language)),s(2),p("icon",e.icons.faTimes)}}var Re=(()=>{let a=class a{constructor(){this.showUsers=!0,this.addRootFile=null,this.locale=f(J),this.icons={faTimes:oe,faPen:ae},this.SPACES_PERMISSIONS_TEXT=ue,this.originalOrderKeyValue=pe,this.subscription=null}ngOnInit(){this.addRootFile&&(this.subscription=this.addRootFile.subscribe(e=>this.addRoot(e)))}ngOnDestroy(){this.subscription&&this.subscription.unsubscribe()}addRoot(e){let t={id:0,alias:y(e.name,"alias",this.space.roots).toLowerCase(),name:y(e.name,"name",this.space.roots),permissions:"",createdAt:new Date};e.externalPath?(t.externalPath=e.externalPath,t.owner={id:null,login:null,email:null,fullName:null},t.file={id:0,path:null,mime:null}):(t.externalPath=null,t.owner={id:this.user.id,login:this.user.login,email:this.user.email,fullName:this.user.fullName},t.file={id:e.id,path:e.path,mime:e.mime}),this.space.addRoot(t,!0)}removeRoot(e){this.space.roots=this.space.roots.filter(t=>e.alias!==t.alias)}onRenameRoot(e){let t=e.object;t.alias=y(ce(e.name,!0),"alias",this.space.roots.filter(o=>o.id!==t.id)).toLowerCase(),t.name=y(e.name.replace(le,""),"name",this.space.roots.filter(o=>o.id!==t.id))}onPermissionChange(e){e.permissions=he(e.hPerms)}setRenamed(e){e.isRenamed?(this.onRenameRoot({object:e,name:this.inputRename.nativeElement.value}),e.isRenamed=!1):e.isRenamed=!0}};a.\u0275fac=function(t){return new(t||a)},a.\u0275cmp=R({type:a,selectors:[["app-space-manage-roots"]],viewQuery:function(t,o){if(t&1&&$(Ee,5),t&2){let u;L(u=W())&&(o.inputRename=u.first)}},inputs:{space:"space",user:"user",showUsers:"showUsers",addRootFile:"addRootFile"},decls:2,vars:0,consts:[["InputRename",""],[1,"bg-theme","mb-1","p-2",2,"border-radius","4px"],[1,"d-flex","align-items-center","text-truncate","no-select","fs-xs",2,"height","32px"],[1,"d-flex","align-items-center","text-truncate","me-auto"],["draggable","false","height","30","width","30","alt","",3,"src","tooltip"],[1,"d-flex","flex-column","text-truncate","ms-2"],["appInputEdit","","type","text","required","",3,"inputObject","fullWidth"],[1,"d-flex","flex-column","fs-xxxs","text-muted","d-none","d-lg-block","ms-3"],[1,"d-flex","justify-content-end"],[1,"d-flex","no-select"],[1,"vr","mx-2"],[1,"vr","ms-1","me-2"],["type","button",3,"click","tooltip"],[3,"icon"],["type","button",1,"btn","btn-sm","btn-danger",3,"click","tooltip"],["tooltipPlacement","bottom",3,"user"],["appInputEdit","","type","text","required","",3,"updateObject","inputObject","fullWidth"],[1,"text-truncate"],[1,"d-none","d-lg-block","fs-xxxs","text-truncate"],["btnCheckbox","","type","button",3,"ngModel","tooltip","class"],["type","button",1,"btn","btn-sm","btn-custom","disabled",3,"tooltip","active"],["btnCheckbox","","type","button",3,"ngModelChange","ngModel","tooltip"],["size","lg",3,"icon"],["type","button",1,"btn","btn-sm","btn-custom","disabled",3,"tooltip"]],template:function(t,o){t&1&&T(0,je,26,26,"div",1,Fe),t&2&&w(o.space.roots)},dependencies:[_e,fe,F,be,ie,te,G,z,Y,ye,Q,Z,ge,xe],encapsulation:2});let i=a;return i})();function Be(i,a){if(i&1&&m(0,"fa-icon",3),i&2){let n=l();p("icon",n.icons.faSpinner)}}function Ve(i,a){i&1&&(r(0,"span",5),d(1,"You have no files anchored on this space"),c())}var Pt=(()=>{let a=class a{constructor(){this.layout=f(me),this.addRootFileEvent=new A,this.icons={faAnchor:se,faPlus:re,faSpinner:ne,SPACES:de.SPACES},this.submitted=!1,this.loading=!1,this.spacesService=f(Ce)}ngOnInit(){this.space?.roots.length&&(this.space.roots=[]),this.spacesService.getUserSpaceRoots(this.space.id).subscribe({next:e=>this.setSpaceRoots(e),error:e=>{this.layout.sendNotification("error","Manage my anchored files",e.error.message)}})}openSelectRootDialog(){this.layout.openDialog(Se,"xl",{initialState:{currentRoots:this.space.roots.filter(t=>t.owner.id===this.user.id)}}).content.submitEvent.pipe(j(1)).subscribe(t=>this.addRootFileEvent.next(t))}onSubmit(){this.loading=!0,this.submitted=!0,this.spacesService.updateUserSpaceRoots(this.space.id,this.space.roots.map(e=>({id:e.id,alias:e.alias,name:e.name,permissions:e.permissions,file:{id:e.file.id,path:e.file.path,mime:e.file.mime}}))).subscribe({next:e=>{this.setSpaceRoots(e),this.layout.closeDialog()},error:e=>{this.layout.sendNotification("error","Manage my anchored files",e.error.message),this.submitted=!1,this.loading=!1}})}setSpaceRoots(e){this.space.roots=[];for(let t of e)this.space.addRoot(D(O({},t),{owner:this.user}),!0);this.space.counts.roots=this.space.roots.length}};a.\u0275fac=function(t){return new(t||a)},a.\u0275cmp=R({type:a,selectors:[["app-space-user-anchors-dialog"]],inputs:{space:"space",user:"user"},decls:22,vars:11,consts:[[1,"modal-header","align-items-center"],[1,"modal-title"],[1,"me-2",3,"icon"],["animation","spin","size","sm",1,"ms-2",3,"icon"],[1,"modal-title","ms-auto"],["l10nTranslate",""],["aria-label","Close","type","button",1,"btn-close","btn-close-white","ms-2",3,"click"],[1,"modal-body"],[3,"space","user","showUsers","addRootFile"],[1,"modal-footer"],["type","button","l10nTranslate","",1,"btn","btn-sm","btn-success",3,"click"],[3,"icon"],["data-dismiss","modal","type","button","l10nTranslate","",1,"btn","btn-sm","btn-secondary","ms-auto",3,"click"],["type","button","l10nTranslate","",1,"btn","btn-sm","btn-primary",3,"click","disabled"]],template:function(t,o){t&1&&(r(0,"div",0)(1,"h4",1),m(2,"fa-icon",2),r(3,"span"),d(4),c()(),_(5,Be,1,1,"fa-icon",3),r(6,"h4",4)(7,"span",5),d(8,"Manage my anchored files"),c()(),r(9,"button",6),h("click",function(){return o.layout.closeDialog()}),c()(),r(10,"div",7),m(11,"app-space-manage-roots",8),_(12,Ve,2,0,"span",5),c(),r(13,"div",9)(14,"button",10),h("click",function(){return o.openSelectRootDialog()}),m(15,"fa-icon",11)(16,"fa-icon",11),d(17," File "),c(),r(18,"button",12),h("click",function(){return o.layout.closeDialog()}),d(19,"Cancel"),c(),r(20,"button",13),h("click",function(){return o.onSubmit()}),d(21," Confirm "),c()()),t&2&&(s(2),p("icon",o.icons.SPACES),s(2),g(o.space.name),s(),b(o.loading?5:-1),s(6),p("space",o.space)("user",o.user)("showUsers",!1)("addRootFile",o.addRootFileEvent),s(),b(o.space.roots.length?-1:12),s(3),p("icon",o.icons.faPlus),s(),p("icon",o.icons.faAnchor),s(4),p("disabled",o.submitted))},dependencies:[F,ee,Re],encapsulation:2});let i=a;return i})();export{ye as a,Re as b,Pt as c};
@@ -1 +1 @@
1
- import{a as Se}from"./chunk-RTHDK2Z7.js";import{a as Q}from"./chunk-6QJL2YDQ.js";import"./chunk-HX6BM5E5.js";import{a as N,b as O,c as ye,d as be}from"./chunk-UILGGLKW.js";import{b as we,c as ve,d as Te,e as Le}from"./chunk-2FUMMTEK.js";import"./chunk-W37K2YDS.js";import"./chunk-Q2UU32ST.js";import"./chunk-WA2KMN23.js";import"./chunk-3SC36MTD.js";import{Hb as ge,Ja as Ce,Jb as ke,Xa as fe,kb as xe,pa as de,qa as me,ra as ue,v as X,w as Z,xb as he}from"./chunk-4GYSKJJC.js";import"./chunk-ZZ3LHYOY.js";import{b as K}from"./chunk-J6YSVODR.js";import{Cb as C,Eb as l,Ed as Y,Fd as J,Ga as D,Gc as q,Ib as L,If as se,Jb as S,Kb as V,L as U,Ma as r,Mb as F,Nb as P,Ob as M,Oe as oe,Pb as u,Qb as v,Rb as I,Sb as B,Ue as re,Uf as ce,Vf as pe,Wd as ee,Xa as W,Xb as R,Yb as H,Zc as j,Zf as _e,ab as T,ce as te,dc as k,fc as y,ha as w,ib as z,ie,jb as x,kb as h,ma as d,na as m,nb as A,ob as $,of as ae,pb as _,qb as s,rb as c,sb as f,te as ne,tf as le,yd as G,zb as b}from"./chunk-JQOMI5VI.js";import"./chunk-RTRJ3KFH.js";var Me=["MainContextMenu"],Ee=["TargetContextMenu"],Ve=(t,a)=>a.id,Fe=(t,a)=>a.key;function Ae(t,a){if(t&1&&(s(0,"span",30),u(1),c()),t&2){let e=l().$implicit,i=l(2);F("font-size",i.galleryMode.textSize,"px"),r(),I(" ",e.hTimeAccessAgo," ")}}function $e(t,a){if(t&1){let e=b();s(0,"div",21),C("click",function(){let o=d(e).$implicit,n=l(2);return m(n.onSelect(o))})("contextmenu",function(o){let n=d(e).$implicit,p=l(2);return m(p.onTargetContextMenu(o,n))})("pressup",function(o){let n=d(e).$implicit,p=l(2);return m(p.onTargetContextMenu(o,n))})("tap",function(){d(e);let o=l(2);return m(o.openLinkDialog())}),s(1,"div",22)(2,"img",23),C("error",function(){let o=d(e).$implicit;return m(o.fallBackMimeUrl())}),c(),s(3,"span",24),x(4,Ae,2,3,"span",25),c(),s(5,"span",26),f(6,"app-share-repository",27),c()(),s(7,"div",28)(8,"span",29),u(9),c()()()}if(t&2){let e=a.$implicit,i=a.$index,o=l(2);F("height",o.galleryMode.dimensions,"px")("width",o.galleryMode.dimensions,"px"),P("selected",e.id===(o.selected==null?null:o.selected.id))("disabled",!e.link.isActive),r(),z("rowIndex",i),r(),_("src",e.mimeUrl,D)("height",o.galleryMode.image)("width",o.galleryMode.image),r(2),h(e.newly?4:-1),r(2),_("share",e)("galleryMode",o.galleryMode),r(2),F("font-size",o.galleryMode.textSize,"px"),r(),v(e.name)}}function Pe(t,a){if(t&1){let e=b();s(0,"div",13)(1,"app-virtual-scroll",18),k(2,"searchFilter"),C("contextmenu",function(o){d(e);let n=l();return m(n.onContextMenu(o))}),s(3,"div",19),A(4,$e,10,18,"div",20,Ve),c()()()}if(t&2){let e=l();r(),_("childHeight",e.galleryMode.dimensions)("childWidth",e.galleryMode.dimensions)("items",y(2,5,e.shares,e.inputFilter.search()))("galleryMode",!0)("resizeOffset",110),r(3),$(e.scrollView==null?null:e.scrollView.viewPortItems)}}function Ie(t,a){if(t&1&&f(0,"fa-icon",37),t&2){let e=l(4);_("icon",e.sortTable.sortParam.asc?e.icons.faArrowDown:e.icons.faArrowUp)("fixedWidth",!1)}}function Be(t,a){if(t&1){let e=b();s(0,"th",36),C("click",function(){d(e);let o=l().$implicit,n=l(2);return m(n.sortBy(o.key))}),u(1),x(2,Ie,1,2,"fa-icon",37),c()}if(t&2){let e=l().$implicit,i=l(2);M(e.value.class),F("width",e.value.width,"%"),P("text-align-center",e.value.textCenter)("cursor-pointer",e.value.sortable),r(),I(" ",e.value.label," "),r(),h(i.sortTable.sortParam.column===e.key?2:-1)}}function Re(t,a){if(t&1&&x(0,Be,3,10,"th",35),t&2){let e=a.$implicit;h(e.value.show?0:-1)}}function De(t,a){if(t&1){let e=b();s(0,"div",40)(1,"img",43),C("error",function(){d(e);let o=l(3).$implicit;return m(o.fallBackMimeUrl())}),c(),s(2,"div",44)(3,"span",29),u(4),c(),s(5,"span",45),u(6),c()()()}if(t&2){let e=l(3).$implicit;r(),_("src",e.mimeUrl,D),r(3),v(e.name),r(2),v(e.description)}}function Ne(t,a){if(t&1&&(s(0,"span"),u(1),c()),t&2){let e=l(4).$implicit;r(),v(e.link.email||"")}}function Oe(t,a){if(t&1&&(s(0,"span",41)(1,"span"),u(2),c(),x(3,Ne,2,1,"span"),c()),t&2){let e=l(3).$implicit;r(2),v(e.link.name),r(),h(e.link.email?3:-1)}}function Qe(t,a){if(t&1&&f(0,"app-share-repository",42),t&2){let e=l(3).$implicit;_("share",e)}}function Ue(t,a){if(t&1&&(s(0,"span"),u(1),c()),t&2){let e=l(4).$implicit;M(R("badge rounded-pill ",e.link.nbAccess>=e.link.limitAccess?"bg-danger":"bg-success")),r(),B(" ",e.link.nbAccess,"/",e.link.limitAccess," ")}}function We(t,a){if(t&1&&(s(0,"span",47),u(1),c()),t&2){let e=l(4).$implicit;r(),v(e.link.nbAccess)}}function ze(t,a){if(t&1&&(s(0,"span",49),u(1),k(2,"translate"),c()),t&2){let e=l(5).$implicit,i=l(2);r(),B("",e.hTimeExpirationAgo,"\xA0",y(2,2,e.hTimeExpirationAgo===1?"day":"days",i.locale.language))}}function He(t,a){if(t&1&&(s(0,"span"),f(1,"fa-icon",37),x(2,ze,3,5,"span",49),c()),t&2){let e=l(4).$implicit,i=l(2);M(R("badge rounded-pill bg-",e.hTimeExpirationAgo>=1?"warning":"danger"," ms-1")),r(),_("icon",i.icons.faClock)("fixedWidth",!1),r(),h(e.hTimeExpirationAgo>=1?2:-1)}}function qe(t,a){if(t&1&&(s(0,"span",48),f(1,"fa-icon",6),c()),t&2){let e=l(6);r(),_("icon",e.icons.faLock)}}function Ke(t,a){if(t&1&&(x(0,Ue,2,5,"span",46)(1,We,2,1,"span",47),x(2,He,3,6,"span",46),x(3,qe,2,1,"span",48)),t&2){let e=l(3).$implicit;h(e.link.limitAccess?0:1),r(2),h(e.link.expiresAt?2:-1),r(),h(e.link.requireAuth?3:-1)}}function je(t,a){if(t&1&&f(0,"app-file-permissions",50),t&2){let e=l(4).$implicit;_("permissions",e.hPerms)}}function Ge(t,a){if(t&1&&x(0,je,1,1,"app-file-permissions",50),t&2){let e=l(3).$implicit;h(e.link.permissions?0:-1)}}function Ye(t,a){if(t&1&&u(0),t&2){let e=l(4).$implicit;I(" ",e.hTimeAccessAgo," ")}}function Je(t,a){t&1&&(s(0,"span",51),u(1,"never"),c())}function Xe(t,a){if(t&1&&x(0,Ye,1,1)(1,Je,2,0,"span",51),t&2){let e=l(3).$implicit;h(e.link.currentAccess?0:1)}}function Ze(t,a){if(t&1&&(s(0,"td"),x(1,De,7,3,"div",40)(2,Oe,4,2,"span",41)(3,Qe,1,1,"app-share-repository",42)(4,Ke,4,3)(5,Ge,1,1)(6,Xe,2,1),c()),t&2){let e,i=l().$implicit,o=l().$implicit;M(H("",i.value.class," ",i.value.newly!==void 0?"props-newly-"+o[i.value.newly]:"")),F("width",i.value.width,"%"),P("text-align-center",i.value.textCenter),r(),h((e=i.key)==="name"?1:e==="link"?2:e==="from"?3:e==="infos"?4:e==="permissions"?5:e==="accessed"?6:-1)}}function et(t,a){if(t&1&&x(0,Ze,7,9,"td",39),t&2){let e=a.$implicit;h(e.value.show?0:-1)}}function tt(t,a){if(t&1){let e=b();s(0,"tr",38),C("click",function(){let o=d(e).$implicit,n=l(2);return m(n.onSelect(o))})("contextmenu",function(o){let n=d(e).$implicit,p=l(2);return m(p.onTargetContextMenu(o,n))})("pressup",function(o){let n=d(e).$implicit,p=l(2);return m(p.onTargetContextMenu(o,n))})("tap",function(){d(e);let o=l(2);return m(o.openLinkDialog())}),A(1,et,1,1,null,null,Fe),k(3,"keyvalue"),c()}if(t&2){let e=a.$implicit,i=l(2);P("selected",e.id===(i.selected==null?null:i.selected.id))("disabled",!e.link.isActive),r(),$(y(3,4,i.tableHeaders,i.originalOrderKeyValue))}}function it(t,a){if(t&1){let e=b();s(0,"table",31)(1,"thead")(2,"tr"),A(3,Re,1,1,null,null,Fe),k(5,"keyvalue"),c()()(),s(6,"app-virtual-scroll",32),k(7,"searchFilter"),C("contextmenu",function(o){d(e);let n=l();return m(n.onContextMenu(o))}),s(8,"table",31)(9,"tbody",33),A(10,tt,4,7,"tr",34,Ve),c()()()}if(t&2){let e=l();r(3),$(y(5,2,e.tableHeaders,e.originalOrderKeyValue)),r(3),_("bufferAmount",5)("items",y(7,5,e.shares,e.inputFilter.search())),r(4),$(e.scrollView==null?null:e.scrollView.viewPortItems)}}function nt(t,a){if(t&1&&(s(0,"span",51),f(1,"fa-icon",6),u(2,"Refresh"),c()),t&2){let e=l();r(),_("icon",e.icons.faArrowRotateRight)}}function ot(t,a){if(t&1&&(s(0,"span",51),f(1,"fa-icon",6),u(2,"Go to"),c()),t&2){let e=l();r(),_("icon",e.icons.faMapMarkerAlt)}}function rt(t,a){if(t&1&&(s(0,"span",51),f(1,"fa-icon",6),u(2,"Edit link"),c()),t&2){let e=l();r(),_("icon",e.icons.faPen)}}function at(t,a){if(t&1&&(s(0,"span",51),f(1,"fa-icon",6),u(2,"Copy link"),c()),t&2){let e=l();r(),_("icon",e.icons.faClipboard)}}function lt(t,a){}function st(t,a){if(t&1&&(s(0,"span",51),f(1,"fa-icon",6),u(2,"Informations"),c()),t&2){let e=l();r(),_("icon",e.icons.faCircleInfo)}}var Dt=(()=>{let a=class a{constructor(){this.locale=w(G),this.layout=w(he),this.icons={faLink:oe,faArrowRotateRight:se,faArrowDown:ce,faArrowUp:re,faMapMarkerAlt:pe,faPen:ae,faEllipsisH:ee,faClock:ie,faLock:le,faClipboard:ne,faClipboardCheck:te,faCircleInfo:_e},this.originalOrderKeyValue=fe,this.TAB_MENU=Ce,this.loading=!1,this.linkWasCopied=!1,this.shares=[],this.selected=null,this.tableHeaders={name:{label:"Name",width:30,textCenter:!1,class:"",show:!0,sortable:!0},link:{label:"Link",width:15,textCenter:!1,class:"d-none d-sm-table-cell",show:!0,sortable:!0},from:{label:"Shared from",width:15,textCenter:!1,class:"d-none d-md-table-cell",show:!0},infos:{label:"Infos",width:15,textCenter:!0,class:"d-none d-lg-table-cell",show:!0,sortable:!0},permissions:{label:"Permissions",width:10,textCenter:!0,class:"d-none d-lg-table-cell",show:!0,sortable:!0},accessed:{label:"Accessed",width:10,textCenter:!0,class:"d-none d-lg-table-cell",newly:"newly",show:!0,sortable:!0}},this.btnSortFields={name:"Name",link:"Link",accessed:"Accessed"},this.activatedRoute=w(K),this.store=w(xe),this.linksService=w(Le),this.sharesService=w(ve),this.sortSettings={default:[{prop:"name",type:"string"}],link:[{prop:"link.name",type:"string"}],name:[{prop:"name",type:"string"}],infos:[{prop:"link.nbAccess",type:"number"}],permissions:[{prop:"link.permissions",type:"length"}],accessed:[{prop:"link.currentAccess",type:"date"}]},this.sortTable=new be(this.constructor.name,this.sortSettings),this.loadShareLinks(),this.activatedRoute.queryParams.subscribe(i=>this.focusOnSelect=i.select),this.layout.setBreadcrumbIcon(this.icons.faLink),this.layout.setBreadcrumbNav({url:`/${ke.LINKS}/${ge.SHARED_BY_LINKS}`,translating:!0,sameLink:!0})}ngOnInit(){this.galleryMode=this.btnNavigationView.currentView()}loadShareLinks(){this.loading=!0,this.onSelect(),this.linksService.shareLinksList().subscribe({next:i=>{this.sortBy(this.sortTable.sortParam.column,!1,i),this.loading=!1,this.focusOnSelect?this.focusOn(this.focusOnSelect):this.scrollView.scrollInto(-1)},error:i=>{this.shares=[],this.loading=!1,this.layout.sendNotification("error","Links",i.error.message)}})}sortBy(i,o=!0,n){this.shares=this.sortTable.sortBy(i,o,n||this.shares)}onSelect(i=null){this.selected=i,this.store.linkSelection.set(this.selected)}openLinkDialog(){this.linksService.shareLink(this.selected.id).subscribe(i=>{this.layout.openDialog(Te,"md",{initialState:{share:i}}).content.shareChange.pipe(U(1)).subscribe(n=>{let[p,g]=n;p==="update"?this.selected=Object.assign(this.selected,g):p==="delete"&&(this.onSelect(),this.sortBy(this.sortTable.sortParam.column,!1,this.shares.filter(E=>E.id!==g.id)))})})}onContextMenu(i){i.preventDefault(),i.stopPropagation(),this.layout.openContextMenu(i,this.mainContextMenu)}onTargetContextMenu(i,o){i.preventDefault(),i.type==="contextmenu"&&i.stopPropagation(),this.onSelect(o),this.layout.openContextMenu(i,this.targetContextMenu)}copyToClipboard(){this.selected&&(this.linksService.copyLinkToClipboard(this.selected.link.uuid),this.linkWasCopied=!0,this.layout.sendNotification("info","Link copied",this.selected.file.name||this.selected.name),setTimeout(()=>this.linkWasCopied=!1,3e3))}goTo(i){i=i||this.selected,this.sharesService.goTo(i).catch(console.error)}focusOn(i){let o=this.shares.find(n=>n.name===i);o&&(setTimeout(()=>this.scrollView.scrollInto(o),100),this.onSelect(o))}};a.\u0275fac=function(o){return new(o||a)},a.\u0275cmp=W({type:a,selectors:[["app-shared-links"]],viewQuery:function(o,n){if(o&1&&(L(O,5),L(N,7),L(Q,7),L(Me,7),L(Ee,7)),o&2){let p;S(p=V())&&(n.scrollView=p.first),S(p=V())&&(n.inputFilter=p.first),S(p=V())&&(n.btnNavigationView=p.first),S(p=V())&&(n.mainContextMenu=p.first),S(p=V())&&(n.targetContextMenu=p.first)}},decls:33,vars:36,consts:[["MainContextMenu",""],["TargetContextMenu",""],[1,"app-top-menu"],["container","body","type","button",1,"d-none","d-sm-block","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,"click","disabled","tooltip"],[3,"icon"],["container","body","type","button",3,"click","disabled","tooltip"],["container","body","type","button",1,"btn","btn-sm","btn-secondary",3,"click","disabled","tooltip"],[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","",3,"divider"],[3,"contextmenu","childHeight","childWidth","items","galleryMode","resizeOffset"],["tabindex","-1",1,"row","g-0"],[1,"card",3,"selected","disabled","height","width"],[1,"card",3,"click","contextmenu","pressup","tap"],[1,"card-body"],["alt","","draggable","true",3,"error","src","height","width"],[1,"label-top-right"],[1,"badge","rounded-pill","bg-warning",3,"font-size"],[1,"label-bottom-left"],[3,"share","galleryMode"],[1,"card-footer","text-center","text-truncate","p-1"],["draggable","false",1,"no-pointer-events"],[1,"badge","rounded-pill","bg-warning"],[1,"app-table"],[3,"contextmenu","bufferAmount","items"],["tabindex","-1"],[3,"selected","disabled"],["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,"d-flex","flex-column"],[3,"share"],["alt","","draggable","false","height","30","width","30",3,"error","src"],[1,"d-flex","flex-column","text-truncate"],["draggable","false",1,"no-pointer-events","text-muted","fs-xxxs"],[3,"class"],[1,"badge","rounded-pill","bg-success"],[1,"badge","rounded-pill","bg-gray-dark","ms-1"],[1,"ms-2"],["tooltipPlacement","auto",3,"permissions"],["l10nTranslate",""]],template:function(o,n){if(o&1){let p=b();s(0,"div",2)(1,"button",3),k(2,"translate"),C("click",function(){return d(p),m(n.loadShareLinks())}),f(3,"fa-icon",4),c(),s(4,"button",5),k(5,"translate"),C("click",function(){return d(p),m(n.openLinkDialog())}),f(6,"fa-icon",6),c(),s(7,"button",7),k(8,"translate"),C("click",function(){return d(p),m(n.copyToClipboard())}),f(9,"fa-icon",6),c(),s(10,"button",8),k(11,"translate"),C("click",function(){return d(p),m(n.goTo())}),f(12,"fa-icon",6),c(),s(13,"div",9)(14,"div",10),f(15,"app-input-filter",11),c(),s(16,"app-navigation-view",12),C("sortBy",function(E){return d(p),m(n.sortBy(E))})("switchView",function(E){return d(p),m(n.galleryMode=E)}),c()()(),x(17,Pe,6,8,"div",13)(18,it,12,8),s(19,"div",14)(20,"span",15),u(21),k(22,"translate"),c()(),s(23,"context-menu",null,0),T(25,nt,3,1,"ng-template",16),C("execute",function(){return d(p),m(n.loadShareLinks())}),c(),s(26,"context-menu",null,1),T(28,ot,3,1,"ng-template",16),C("execute",function(){return d(p),m(n.goTo())}),T(29,rt,3,1,"ng-template",16),C("execute",function(){return d(p),m(n.openLinkDialog())}),T(30,at,3,1,"ng-template",16),C("execute",function(){return d(p),m(n.copyToClipboard())}),T(31,lt,0,0,"ng-template",17)(32,st,3,1,"ng-template",16),C("execute",function(){return d(p),m(n.layout.showRSideBarTab(n.TAB_MENU.SELECTION))}),c()}o&2&&(r(),_("tooltip",y(2,21,"Refresh",n.locale.language)),r(2),_("icon",n.icons.faArrowRotateRight)("animation",n.loading?"spin":null),r(),_("disabled",!n.selected)("tooltip",y(5,24,"Edit link",n.locale.language)),r(2),_("icon",n.icons.faPen),r(),M(R("btn btn-sm me-1 ",n.linkWasCopied?"btn-info":"btn-secondary")),_("disabled",!n.selected)("tooltip",y(8,27,"Copy link",n.locale.language)),r(2),_("icon",n.linkWasCopied?n.icons.faClipboardCheck:n.icons.faClipboard),r(),_("disabled",!n.selected)("tooltip",y(11,30,"Go to",n.locale.language)),r(2),_("icon",n.icons.faMapMarkerAlt),r(4),_("sortParams",n.sortTable.sortParam)("sortFields",n.btnSortFields),r(),h(n.galleryMode!=null&&n.galleryMode.enabled?17:18),r(4),B("",n.shares.length," ",y(22,33,"shares",n.locale.language)),r(10),_("divider",!0))},dependencies:[ue,me,de,j,J,Q,Z,X,N,O,we,Se,q,Y,ye],encapsulation:2});let t=a;return t})();export{Dt as LinksComponent};
1
+ import{a as Se}from"./chunk-GLAK4VQT.js";import{a as Q}from"./chunk-XQFA4DLU.js";import"./chunk-2QNFUN7G.js";import{a as N,b as O,c as ye,d as be}from"./chunk-AS7H5UIO.js";import{b as we,c as ve,d as Te,e as Le}from"./chunk-QKELW3MH.js";import"./chunk-2PQGH3LQ.js";import"./chunk-MLLPT7BU.js";import"./chunk-W4LKCEBR.js";import"./chunk-6HV65OKG.js";import{Hb as ge,Ja as Ce,Jb as ke,Xa as fe,kb as xe,pa as de,qa as me,ra as ue,v as X,w as Z,xb as he}from"./chunk-55WOZ7P6.js";import"./chunk-ZZ3LHYOY.js";import{b as K}from"./chunk-J6YSVODR.js";import{Cb as C,Eb as l,Ed as Y,Fd as J,Ga as D,Gc as q,Ib as L,If as se,Jb as S,Kb as V,L as U,Ma as r,Mb as F,Nb as P,Ob as M,Oe as oe,Pb as u,Qb as v,Rb as I,Sb as B,Ue as re,Uf as ce,Vf as pe,Wd as ee,Xa as W,Xb as R,Yb as H,Zc as j,Zf as _e,ab as T,ce as te,dc as k,fc as y,ha as w,ib as z,ie,jb as x,kb as h,ma as d,na as m,nb as A,ob as $,of as ae,pb as _,qb as s,rb as c,sb as f,te as ne,tf as le,yd as G,zb as b}from"./chunk-JQOMI5VI.js";import"./chunk-RTRJ3KFH.js";var Me=["MainContextMenu"],Ee=["TargetContextMenu"],Ve=(t,a)=>a.id,Fe=(t,a)=>a.key;function Ae(t,a){if(t&1&&(s(0,"span",30),u(1),c()),t&2){let e=l().$implicit,i=l(2);F("font-size",i.galleryMode.textSize,"px"),r(),I(" ",e.hTimeAccessAgo," ")}}function $e(t,a){if(t&1){let e=b();s(0,"div",21),C("click",function(){let o=d(e).$implicit,n=l(2);return m(n.onSelect(o))})("contextmenu",function(o){let n=d(e).$implicit,p=l(2);return m(p.onTargetContextMenu(o,n))})("pressup",function(o){let n=d(e).$implicit,p=l(2);return m(p.onTargetContextMenu(o,n))})("tap",function(){d(e);let o=l(2);return m(o.openLinkDialog())}),s(1,"div",22)(2,"img",23),C("error",function(){let o=d(e).$implicit;return m(o.fallBackMimeUrl())}),c(),s(3,"span",24),x(4,Ae,2,3,"span",25),c(),s(5,"span",26),f(6,"app-share-repository",27),c()(),s(7,"div",28)(8,"span",29),u(9),c()()()}if(t&2){let e=a.$implicit,i=a.$index,o=l(2);F("height",o.galleryMode.dimensions,"px")("width",o.galleryMode.dimensions,"px"),P("selected",e.id===(o.selected==null?null:o.selected.id))("disabled",!e.link.isActive),r(),z("rowIndex",i),r(),_("src",e.mimeUrl,D)("height",o.galleryMode.image)("width",o.galleryMode.image),r(2),h(e.newly?4:-1),r(2),_("share",e)("galleryMode",o.galleryMode),r(2),F("font-size",o.galleryMode.textSize,"px"),r(),v(e.name)}}function Pe(t,a){if(t&1){let e=b();s(0,"div",13)(1,"app-virtual-scroll",18),k(2,"searchFilter"),C("contextmenu",function(o){d(e);let n=l();return m(n.onContextMenu(o))}),s(3,"div",19),A(4,$e,10,18,"div",20,Ve),c()()()}if(t&2){let e=l();r(),_("childHeight",e.galleryMode.dimensions)("childWidth",e.galleryMode.dimensions)("items",y(2,5,e.shares,e.inputFilter.search()))("galleryMode",!0)("resizeOffset",110),r(3),$(e.scrollView==null?null:e.scrollView.viewPortItems)}}function Ie(t,a){if(t&1&&f(0,"fa-icon",37),t&2){let e=l(4);_("icon",e.sortTable.sortParam.asc?e.icons.faArrowDown:e.icons.faArrowUp)("fixedWidth",!1)}}function Be(t,a){if(t&1){let e=b();s(0,"th",36),C("click",function(){d(e);let o=l().$implicit,n=l(2);return m(n.sortBy(o.key))}),u(1),x(2,Ie,1,2,"fa-icon",37),c()}if(t&2){let e=l().$implicit,i=l(2);M(e.value.class),F("width",e.value.width,"%"),P("text-align-center",e.value.textCenter)("cursor-pointer",e.value.sortable),r(),I(" ",e.value.label," "),r(),h(i.sortTable.sortParam.column===e.key?2:-1)}}function Re(t,a){if(t&1&&x(0,Be,3,10,"th",35),t&2){let e=a.$implicit;h(e.value.show?0:-1)}}function De(t,a){if(t&1){let e=b();s(0,"div",40)(1,"img",43),C("error",function(){d(e);let o=l(3).$implicit;return m(o.fallBackMimeUrl())}),c(),s(2,"div",44)(3,"span",29),u(4),c(),s(5,"span",45),u(6),c()()()}if(t&2){let e=l(3).$implicit;r(),_("src",e.mimeUrl,D),r(3),v(e.name),r(2),v(e.description)}}function Ne(t,a){if(t&1&&(s(0,"span"),u(1),c()),t&2){let e=l(4).$implicit;r(),v(e.link.email||"")}}function Oe(t,a){if(t&1&&(s(0,"span",41)(1,"span"),u(2),c(),x(3,Ne,2,1,"span"),c()),t&2){let e=l(3).$implicit;r(2),v(e.link.name),r(),h(e.link.email?3:-1)}}function Qe(t,a){if(t&1&&f(0,"app-share-repository",42),t&2){let e=l(3).$implicit;_("share",e)}}function Ue(t,a){if(t&1&&(s(0,"span"),u(1),c()),t&2){let e=l(4).$implicit;M(R("badge rounded-pill ",e.link.nbAccess>=e.link.limitAccess?"bg-danger":"bg-success")),r(),B(" ",e.link.nbAccess,"/",e.link.limitAccess," ")}}function We(t,a){if(t&1&&(s(0,"span",47),u(1),c()),t&2){let e=l(4).$implicit;r(),v(e.link.nbAccess)}}function ze(t,a){if(t&1&&(s(0,"span",49),u(1),k(2,"translate"),c()),t&2){let e=l(5).$implicit,i=l(2);r(),B("",e.hTimeExpirationAgo,"\xA0",y(2,2,e.hTimeExpirationAgo===1?"day":"days",i.locale.language))}}function He(t,a){if(t&1&&(s(0,"span"),f(1,"fa-icon",37),x(2,ze,3,5,"span",49),c()),t&2){let e=l(4).$implicit,i=l(2);M(R("badge rounded-pill bg-",e.hTimeExpirationAgo>=1?"warning":"danger"," ms-1")),r(),_("icon",i.icons.faClock)("fixedWidth",!1),r(),h(e.hTimeExpirationAgo>=1?2:-1)}}function qe(t,a){if(t&1&&(s(0,"span",48),f(1,"fa-icon",6),c()),t&2){let e=l(6);r(),_("icon",e.icons.faLock)}}function Ke(t,a){if(t&1&&(x(0,Ue,2,5,"span",46)(1,We,2,1,"span",47),x(2,He,3,6,"span",46),x(3,qe,2,1,"span",48)),t&2){let e=l(3).$implicit;h(e.link.limitAccess?0:1),r(2),h(e.link.expiresAt?2:-1),r(),h(e.link.requireAuth?3:-1)}}function je(t,a){if(t&1&&f(0,"app-file-permissions",50),t&2){let e=l(4).$implicit;_("permissions",e.hPerms)}}function Ge(t,a){if(t&1&&x(0,je,1,1,"app-file-permissions",50),t&2){let e=l(3).$implicit;h(e.link.permissions?0:-1)}}function Ye(t,a){if(t&1&&u(0),t&2){let e=l(4).$implicit;I(" ",e.hTimeAccessAgo," ")}}function Je(t,a){t&1&&(s(0,"span",51),u(1,"never"),c())}function Xe(t,a){if(t&1&&x(0,Ye,1,1)(1,Je,2,0,"span",51),t&2){let e=l(3).$implicit;h(e.link.currentAccess?0:1)}}function Ze(t,a){if(t&1&&(s(0,"td"),x(1,De,7,3,"div",40)(2,Oe,4,2,"span",41)(3,Qe,1,1,"app-share-repository",42)(4,Ke,4,3)(5,Ge,1,1)(6,Xe,2,1),c()),t&2){let e,i=l().$implicit,o=l().$implicit;M(H("",i.value.class," ",i.value.newly!==void 0?"props-newly-"+o[i.value.newly]:"")),F("width",i.value.width,"%"),P("text-align-center",i.value.textCenter),r(),h((e=i.key)==="name"?1:e==="link"?2:e==="from"?3:e==="infos"?4:e==="permissions"?5:e==="accessed"?6:-1)}}function et(t,a){if(t&1&&x(0,Ze,7,9,"td",39),t&2){let e=a.$implicit;h(e.value.show?0:-1)}}function tt(t,a){if(t&1){let e=b();s(0,"tr",38),C("click",function(){let o=d(e).$implicit,n=l(2);return m(n.onSelect(o))})("contextmenu",function(o){let n=d(e).$implicit,p=l(2);return m(p.onTargetContextMenu(o,n))})("pressup",function(o){let n=d(e).$implicit,p=l(2);return m(p.onTargetContextMenu(o,n))})("tap",function(){d(e);let o=l(2);return m(o.openLinkDialog())}),A(1,et,1,1,null,null,Fe),k(3,"keyvalue"),c()}if(t&2){let e=a.$implicit,i=l(2);P("selected",e.id===(i.selected==null?null:i.selected.id))("disabled",!e.link.isActive),r(),$(y(3,4,i.tableHeaders,i.originalOrderKeyValue))}}function it(t,a){if(t&1){let e=b();s(0,"table",31)(1,"thead")(2,"tr"),A(3,Re,1,1,null,null,Fe),k(5,"keyvalue"),c()()(),s(6,"app-virtual-scroll",32),k(7,"searchFilter"),C("contextmenu",function(o){d(e);let n=l();return m(n.onContextMenu(o))}),s(8,"table",31)(9,"tbody",33),A(10,tt,4,7,"tr",34,Ve),c()()()}if(t&2){let e=l();r(3),$(y(5,2,e.tableHeaders,e.originalOrderKeyValue)),r(3),_("bufferAmount",5)("items",y(7,5,e.shares,e.inputFilter.search())),r(4),$(e.scrollView==null?null:e.scrollView.viewPortItems)}}function nt(t,a){if(t&1&&(s(0,"span",51),f(1,"fa-icon",6),u(2,"Refresh"),c()),t&2){let e=l();r(),_("icon",e.icons.faArrowRotateRight)}}function ot(t,a){if(t&1&&(s(0,"span",51),f(1,"fa-icon",6),u(2,"Go to"),c()),t&2){let e=l();r(),_("icon",e.icons.faMapMarkerAlt)}}function rt(t,a){if(t&1&&(s(0,"span",51),f(1,"fa-icon",6),u(2,"Edit link"),c()),t&2){let e=l();r(),_("icon",e.icons.faPen)}}function at(t,a){if(t&1&&(s(0,"span",51),f(1,"fa-icon",6),u(2,"Copy link"),c()),t&2){let e=l();r(),_("icon",e.icons.faClipboard)}}function lt(t,a){}function st(t,a){if(t&1&&(s(0,"span",51),f(1,"fa-icon",6),u(2,"Informations"),c()),t&2){let e=l();r(),_("icon",e.icons.faCircleInfo)}}var Dt=(()=>{let a=class a{constructor(){this.locale=w(G),this.layout=w(he),this.icons={faLink:oe,faArrowRotateRight:se,faArrowDown:ce,faArrowUp:re,faMapMarkerAlt:pe,faPen:ae,faEllipsisH:ee,faClock:ie,faLock:le,faClipboard:ne,faClipboardCheck:te,faCircleInfo:_e},this.originalOrderKeyValue=fe,this.TAB_MENU=Ce,this.loading=!1,this.linkWasCopied=!1,this.shares=[],this.selected=null,this.tableHeaders={name:{label:"Name",width:30,textCenter:!1,class:"",show:!0,sortable:!0},link:{label:"Link",width:15,textCenter:!1,class:"d-none d-sm-table-cell",show:!0,sortable:!0},from:{label:"Shared from",width:15,textCenter:!1,class:"d-none d-md-table-cell",show:!0},infos:{label:"Infos",width:15,textCenter:!0,class:"d-none d-lg-table-cell",show:!0,sortable:!0},permissions:{label:"Permissions",width:10,textCenter:!0,class:"d-none d-lg-table-cell",show:!0,sortable:!0},accessed:{label:"Accessed",width:10,textCenter:!0,class:"d-none d-lg-table-cell",newly:"newly",show:!0,sortable:!0}},this.btnSortFields={name:"Name",link:"Link",accessed:"Accessed"},this.activatedRoute=w(K),this.store=w(xe),this.linksService=w(Le),this.sharesService=w(ve),this.sortSettings={default:[{prop:"name",type:"string"}],link:[{prop:"link.name",type:"string"}],name:[{prop:"name",type:"string"}],infos:[{prop:"link.nbAccess",type:"number"}],permissions:[{prop:"link.permissions",type:"length"}],accessed:[{prop:"link.currentAccess",type:"date"}]},this.sortTable=new be(this.constructor.name,this.sortSettings),this.loadShareLinks(),this.activatedRoute.queryParams.subscribe(i=>this.focusOnSelect=i.select),this.layout.setBreadcrumbIcon(this.icons.faLink),this.layout.setBreadcrumbNav({url:`/${ke.LINKS}/${ge.SHARED_BY_LINKS}`,translating:!0,sameLink:!0})}ngOnInit(){this.galleryMode=this.btnNavigationView.currentView()}loadShareLinks(){this.loading=!0,this.onSelect(),this.linksService.shareLinksList().subscribe({next:i=>{this.sortBy(this.sortTable.sortParam.column,!1,i),this.loading=!1,this.focusOnSelect?this.focusOn(this.focusOnSelect):this.scrollView.scrollInto(-1)},error:i=>{this.shares=[],this.loading=!1,this.layout.sendNotification("error","Links",i.error.message)}})}sortBy(i,o=!0,n){this.shares=this.sortTable.sortBy(i,o,n||this.shares)}onSelect(i=null){this.selected=i,this.store.linkSelection.set(this.selected)}openLinkDialog(){this.linksService.shareLink(this.selected.id).subscribe(i=>{this.layout.openDialog(Te,"md",{initialState:{share:i}}).content.shareChange.pipe(U(1)).subscribe(n=>{let[p,g]=n;p==="update"?this.selected=Object.assign(this.selected,g):p==="delete"&&(this.onSelect(),this.sortBy(this.sortTable.sortParam.column,!1,this.shares.filter(E=>E.id!==g.id)))})})}onContextMenu(i){i.preventDefault(),i.stopPropagation(),this.layout.openContextMenu(i,this.mainContextMenu)}onTargetContextMenu(i,o){i.preventDefault(),i.type==="contextmenu"&&i.stopPropagation(),this.onSelect(o),this.layout.openContextMenu(i,this.targetContextMenu)}copyToClipboard(){this.selected&&(this.linksService.copyLinkToClipboard(this.selected.link.uuid),this.linkWasCopied=!0,this.layout.sendNotification("info","Link copied",this.selected.file.name||this.selected.name),setTimeout(()=>this.linkWasCopied=!1,3e3))}goTo(i){i=i||this.selected,this.sharesService.goTo(i).catch(console.error)}focusOn(i){let o=this.shares.find(n=>n.name===i);o&&(setTimeout(()=>this.scrollView.scrollInto(o),100),this.onSelect(o))}};a.\u0275fac=function(o){return new(o||a)},a.\u0275cmp=W({type:a,selectors:[["app-shared-links"]],viewQuery:function(o,n){if(o&1&&(L(O,5),L(N,7),L(Q,7),L(Me,7),L(Ee,7)),o&2){let p;S(p=V())&&(n.scrollView=p.first),S(p=V())&&(n.inputFilter=p.first),S(p=V())&&(n.btnNavigationView=p.first),S(p=V())&&(n.mainContextMenu=p.first),S(p=V())&&(n.targetContextMenu=p.first)}},decls:33,vars:36,consts:[["MainContextMenu",""],["TargetContextMenu",""],[1,"app-top-menu"],["container","body","type","button",1,"d-none","d-sm-block","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,"click","disabled","tooltip"],[3,"icon"],["container","body","type","button",3,"click","disabled","tooltip"],["container","body","type","button",1,"btn","btn-sm","btn-secondary",3,"click","disabled","tooltip"],[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","",3,"divider"],[3,"contextmenu","childHeight","childWidth","items","galleryMode","resizeOffset"],["tabindex","-1",1,"row","g-0"],[1,"card",3,"selected","disabled","height","width"],[1,"card",3,"click","contextmenu","pressup","tap"],[1,"card-body"],["alt","","draggable","true",3,"error","src","height","width"],[1,"label-top-right"],[1,"badge","rounded-pill","bg-warning",3,"font-size"],[1,"label-bottom-left"],[3,"share","galleryMode"],[1,"card-footer","text-center","text-truncate","p-1"],["draggable","false",1,"no-pointer-events"],[1,"badge","rounded-pill","bg-warning"],[1,"app-table"],[3,"contextmenu","bufferAmount","items"],["tabindex","-1"],[3,"selected","disabled"],["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,"d-flex","flex-column"],[3,"share"],["alt","","draggable","false","height","30","width","30",3,"error","src"],[1,"d-flex","flex-column","text-truncate"],["draggable","false",1,"no-pointer-events","text-muted","fs-xxxs"],[3,"class"],[1,"badge","rounded-pill","bg-success"],[1,"badge","rounded-pill","bg-gray-dark","ms-1"],[1,"ms-2"],["tooltipPlacement","auto",3,"permissions"],["l10nTranslate",""]],template:function(o,n){if(o&1){let p=b();s(0,"div",2)(1,"button",3),k(2,"translate"),C("click",function(){return d(p),m(n.loadShareLinks())}),f(3,"fa-icon",4),c(),s(4,"button",5),k(5,"translate"),C("click",function(){return d(p),m(n.openLinkDialog())}),f(6,"fa-icon",6),c(),s(7,"button",7),k(8,"translate"),C("click",function(){return d(p),m(n.copyToClipboard())}),f(9,"fa-icon",6),c(),s(10,"button",8),k(11,"translate"),C("click",function(){return d(p),m(n.goTo())}),f(12,"fa-icon",6),c(),s(13,"div",9)(14,"div",10),f(15,"app-input-filter",11),c(),s(16,"app-navigation-view",12),C("sortBy",function(E){return d(p),m(n.sortBy(E))})("switchView",function(E){return d(p),m(n.galleryMode=E)}),c()()(),x(17,Pe,6,8,"div",13)(18,it,12,8),s(19,"div",14)(20,"span",15),u(21),k(22,"translate"),c()(),s(23,"context-menu",null,0),T(25,nt,3,1,"ng-template",16),C("execute",function(){return d(p),m(n.loadShareLinks())}),c(),s(26,"context-menu",null,1),T(28,ot,3,1,"ng-template",16),C("execute",function(){return d(p),m(n.goTo())}),T(29,rt,3,1,"ng-template",16),C("execute",function(){return d(p),m(n.openLinkDialog())}),T(30,at,3,1,"ng-template",16),C("execute",function(){return d(p),m(n.copyToClipboard())}),T(31,lt,0,0,"ng-template",17)(32,st,3,1,"ng-template",16),C("execute",function(){return d(p),m(n.layout.showRSideBarTab(n.TAB_MENU.SELECTION))}),c()}o&2&&(r(),_("tooltip",y(2,21,"Refresh",n.locale.language)),r(2),_("icon",n.icons.faArrowRotateRight)("animation",n.loading?"spin":null),r(),_("disabled",!n.selected)("tooltip",y(5,24,"Edit link",n.locale.language)),r(2),_("icon",n.icons.faPen),r(),M(R("btn btn-sm me-1 ",n.linkWasCopied?"btn-info":"btn-secondary")),_("disabled",!n.selected)("tooltip",y(8,27,"Copy link",n.locale.language)),r(2),_("icon",n.linkWasCopied?n.icons.faClipboardCheck:n.icons.faClipboard),r(),_("disabled",!n.selected)("tooltip",y(11,30,"Go to",n.locale.language)),r(2),_("icon",n.icons.faMapMarkerAlt),r(4),_("sortParams",n.sortTable.sortParam)("sortFields",n.btnSortFields),r(),h(n.galleryMode!=null&&n.galleryMode.enabled?17:18),r(4),B("",n.shares.length," ",y(22,33,"shares",n.locale.language)),r(10),_("divider",!0))},dependencies:[ue,me,de,j,J,Q,Z,X,N,O,we,Se,q,Y,ye],encapsulation:2});let t=a;return t})();export{Dt as LinksComponent};
@@ -1 +1 @@
1
- import{a as yt,c as bt,d as T,e as te,g as Et}from"./chunk-W37K2YDS.js";import{a as Ct,b as vt}from"./chunk-Q2UU32ST.js";import{f as kt}from"./chunk-WA2KMN23.js";import{f as St,g as gt,h as _t}from"./chunk-3SC36MTD.js";import{A as ze,Ca as he,Ea as de,Hb as fe,Ib as R,Jb as H,Kb as mt,La as st,Mb as ht,Ob as dt,Qb as ut,Rb as ft,S as ee,Xa as at,Za as lt,mb as L,pb as ct,v as Ge,va as rt,w as Ze,xb as B,y as Ye,z as Xe}from"./chunk-4GYSKJJC.js";import{d as Y}from"./chunk-J6YSVODR.js";import{$b as Le,$c as De,Cb as w,Eb as u,Ed as J,Fd as We,G as oe,Gc as Te,Jd as Qe,L as ve,Lf as ot,Ma as l,Mb as we,Nb as K,Ob as x,Oc as Z,Pb as p,Qb as $,Rb as D,Sb as xe,Tb as le,Ub as ce,Vb as pe,Xa as W,Xb as O,Zc as X,ad as Ne,bb as re,be as Je,bg as ue,ca as P,cb as Ae,cd as z,ce as et,cg as pt,dc as C,dg as N,ed as Re,f as ke,fa as ye,fc as v,fd as Pe,ga as j,gd as me,ha as S,id as f,jb as _,jd as Fe,kb as k,kd as Me,lb as Ie,ld as $e,lf as it,ma as F,na as M,nb as se,nd as Oe,ob as ae,od as Be,p as V,pa as be,pb as m,pd as He,qb as s,qd as Ue,rb as a,rd as Ve,sb as d,sd as Ke,t as Ce,te as tt,tf as nt,v as b,va as Ee,wd as qe,xd as je,yd as Q,zb as G}from"./chunk-JQOMI5VI.js";import{a as y,b as I,c as _e}from"./chunk-RTRJ3KFH.js";function Ft(o,r){if(o&1&&d(0,"fa-icon",2),o&2){let i=u();x(i.repository.class),we("min-width",i.galleryMode.dimensions/3,"px")("min-height",i.galleryMode.dimensions/3,"px")("font-size",i.galleryMode.faSize/1.8,"px"),m("icon",i.repository.icon)}}function Mt(o,r){if(o&1&&d(0,"fa-icon",5),o&2){let i=u(2);x(i.repository.class),m("icon",i.repository.icon)}}function $t(o,r){if(o&1&&(p(0),C(1,"translate")),o&2){let i=u(2);D(" ",v(1,1,i.repository.label,i.locale.language)," ")}}function Ot(o,r){if(o&1&&p(0),o&2){let i=u(2);D(" ",i.repository.label," ")}}function Bt(o,r){if(o&1&&(s(0,"div",1),_(1,Mt,1,3,"fa-icon",3),s(2,"span",4),_(3,$t,2,4)(4,Ot,1,1),a()()),o&2){let i=u();l(),k(i.showIcon?1:-1),l(2),k(i.repository.translate?3:4)}}var At=(()=>{let r=class r{constructor(){this.showIcon=!0,this.showFullPath=!1,this.locale=S(Q),this.layout=S(B),this.unknownRepository={icon:Qe,label:"",class:"circle-primary-icon",translate:!1}}ngOnInit(){this.setRepository()}ngOnChanges(){this.setRepository()}setRepository(){this.share.parent?.id||this.share.parent?.id===0?this.repository={icon:R.SHARES,label:this.share.parent.name,class:"circle-purple-icon",translate:!1}:this.share.file?.ownerId?this.repository={icon:R.PERSONAL,label:fe.PERSONAL_FILES,class:"circle-primary-icon",translate:!0}:this.share.file?.space?.alias?this.repository={icon:R.SPACES,label:`${this.share.file.space.name}`,class:"circle-primary-icon",translate:!1}:this.share.externalPath?this.repository={icon:R.EXTERNAL,label:"External",class:"circle-primary-icon",translate:!0}:this.repository=y({},this.unknownRepository),this.showFullPath&&this.setFullPath()}setFullPath(){if(!this.repository.label)return;let e=this.share.file?.path?this.share.file.path.split("/").filter(n=>n&&n!=="."):[];this.share.parent?.id&&!this.share.file?.id&&this.share.file?.path.indexOf("/")===-1?e.shift():this.share.file?.space?.alias&&this.share.file.space?.root?.alias&&(e.length?e.unshift(this.share.file.space.root.name):e.push(this.share.file.space.root.name)),this.repository.label===fe.PERSONAL_FILES&&(this.repository.label=this.layout.translateString(this.repository.label)),e.length&&(this.repository.label=`${this.repository.label}/${e.join("/")}`)}};r.\u0275fac=function(n){return new(n||r)},r.\u0275cmp=W({type:r,selectors:[["app-share-repository"]],inputs:{share:"share",galleryMode:"galleryMode",showIcon:"showIcon",showFullPath:"showFullPath"},features:[Ee],decls:2,vars:1,consts:[[3,"icon","class","min-width","min-height","font-size"],[1,"d-flex","align-items-center"],[3,"icon"],[1,"me-2",3,"icon","class"],["draggable","false",1,"no-pointer-events"],[1,"me-2",3,"icon"]],template:function(n,t){n&1&&_(0,Ft,1,9,"fa-icon",0)(1,Bt,5,2,"div",1),n&2&&k(t.galleryMode?0:1)},dependencies:[X,J],encapsulation:2});let o=r;return o})();var h={BASE:`${ee}/shares`,LIST:"list",CHILDREN:"children",LINKS:"links",LINKS_LIST:"links/list",LINKS_UUID:"links/uuid"},It=`${h.BASE}/${h.LIST}`,q=`${h.BASE}/${h.LINKS}`,wt=`${h.BASE}/${h.LINKS_LIST}`,xt=`${h.BASE}/${h.LINKS_UUID}`;var Lt=(()=>{let r=class r{constructor(){this.http=S(Z),this.router=S(Y)}getShare(e){return this.http.get(`${h.BASE}/${e}`).pipe(b(n=>new T(n)))}createShare(e){return this.http.post(h.BASE,e).pipe(b(n=>new T(n)))}updateShare(e){return this.http.put(`${h.BASE}/${e.id}`,e).pipe(b(n=>new T(n)))}deleteShare(e){return this.http.delete(`${h.BASE}/${e}`)}listShares(){return this.http.get(It)}getShareChild(e,n){return this.http.get(`${h.BASE}/${e}/${h.CHILDREN}/${n}`).pipe(b(t=>new T(t)))}updateShareChild(e,n,t){return this.http.put(`${h.BASE}/${e}/${h.CHILDREN}/${n}`,t).pipe(b(c=>new T(c)))}deleteShareChild(e,n){return this.http.delete(`${h.BASE}/${e}/${h.CHILDREN}/${n}`)}listChildShares(e){return this.http.get(`${h.BASE}/${e}/${h.CHILDREN}`)}initShareFromFile(e,n,t=!1,c=!1){let g,E=null,A=y({id:0,name:"",createdAt:new Date,modifiedAt:new Date,enabled:!0},t?{parent:{id:0,ownerId:0,alias:n.space.alias,name:n.space.name}}:{});if(n){c&&(E=n.root.id);let ge=null;(n?.root?.owner.login===e.login||!n?.space?.alias)&&(n.space=null,ge=e.id),g=new T(I(y({},A),{name:n.name,file:I(y({},n),{path:c?".":st(n.path,2),ownerId:ge})}))}else g=new T(A);return[g,E]}goTo(e){if(!e.id)return Ce(V(!1));if(e.externalPath&&!e.parent?.id)return this.router.navigate([H.SPACES_SHARES],{queryParams:{select:e.name}});if(e.parent?.id&&!e.file?.id&&e.file?.path.indexOf("/")===-1)return this.router.navigate([H.SPACES_SHARES],{queryParams:{select:e.parent.name}});{let[n,t]=bt(e);return this.router.navigate([n],{queryParams:{select:t}})}}};r.\u0275fac=function(n){return new(n||r)},r.\u0275prov=P({token:r,factory:r.\u0275fac,providedIn:"root"});let o=r;return o})();var U={BASE:`${ee}/link`,LINK:"link",VALIDATION:"validation",ACCESS:"access",AUTH:"auth"},Tt=`${U.BASE}/${U.VALIDATION}`,Se=`${U.BASE}/${U.ACCESS}`,Dt=`${U.BASE}/${U.AUTH}`;var Nt=new ye("WindowToken",typeof window<"u"&&window.document?{providedIn:"root",factory:()=>window}:{providedIn:"root",factory:()=>{}});var Rt=(()=>{class o{constructor(i,e,n){this.ngZone=i,this.document=e,this.window=n,this.copySubject=new ke,this.copyResponse$=this.copySubject.asObservable(),this.config={}}configure(i){this.config=i}copy(i){if(!this.isSupported||!i)return this.pushCopyResponse({isSuccess:!1,content:i});let e=this.copyFromContent(i);return e?this.pushCopyResponse({content:i,isSuccess:e}):this.pushCopyResponse({isSuccess:!1,content:i})}get isSupported(){return!!this.document.queryCommandSupported&&!!this.document.queryCommandSupported("copy")&&!!this.window}isTargetValid(i){if(i instanceof HTMLInputElement||i instanceof HTMLTextAreaElement){if(i.hasAttribute("disabled"))throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');return!0}throw new Error("Target should be input or textarea")}copyFromInputElement(i,e=!0){try{this.selectTarget(i);let n=this.copyText();return this.clearSelection(e?i:void 0,this.window),n&&this.isCopySuccessInIE11()}catch{return!1}}isCopySuccessInIE11(){let i=this.window.clipboardData;return!(i&&i.getData&&!i.getData("Text"))}copyFromContent(i,e=this.document.body){if(this.tempTextArea&&!e.contains(this.tempTextArea)&&this.destroy(this.tempTextArea.parentElement||void 0),!this.tempTextArea){this.tempTextArea=this.createTempTextArea(this.document,this.window);try{e.appendChild(this.tempTextArea)}catch{throw new Error("Container should be a Dom element")}}this.tempTextArea.value=i;let n=this.copyFromInputElement(this.tempTextArea,!1);return this.config.cleanUpAfterCopy&&this.destroy(this.tempTextArea.parentElement||void 0),n}destroy(i=this.document.body){this.tempTextArea&&(i.removeChild(this.tempTextArea),this.tempTextArea=void 0)}selectTarget(i){return i.select(),i.setSelectionRange(0,i.value.length),i.value.length}copyText(){return this.document.execCommand("copy")}clearSelection(i,e){i&&i.focus(),e.getSelection()?.removeAllRanges()}createTempTextArea(i,e){let n=i.documentElement.getAttribute("dir")==="rtl",t;t=i.createElement("textarea"),t.style.fontSize="12pt",t.style.border="0",t.style.padding="0",t.style.margin="0",t.style.position="absolute",t.style[n?"right":"left"]="-9999px";let c=e.pageYOffset||i.documentElement.scrollTop;return t.style.top=c+"px",t.setAttribute("readonly",""),t}pushCopyResponse(i){this.copySubject.observers.length>0&&this.ngZone.run(()=>{this.copySubject.next(i)})}pushCopyReponse(i){this.pushCopyResponse(i)}}return o.\u0275fac=function(i){return new(i||o)(j(Ae),j(be),j(Nt,8))},o.\u0275prov=P({token:o,factory:o.\u0275fac,providedIn:"root"}),o})();var Pt=(()=>{let r=class r{constructor(){this.router=S(Y),this.http=S(Z),this.layout=S(B),this.authService=S(kt),this.clipboard=S(Rt)}shareLinksList(){return this.http.get(wt).pipe(b(e=>e.map(n=>new te(n))))}shareLink(e){return this.http.get(`${q}/${e}`).pipe(b(n=>new te(n)))}shareLinkChild(e,n){return this.http.get(`${q}/${e}/${h.CHILDREN}/${n}`).pipe(b(t=>new te(t)))}linkFromSpaceOrShare(e,n,t){return this.http.get(`${q}/${e}/${t}/${n}`)}linkValidation(e){return this.http.get(`${Tt}/${e}`).pipe(b(n=>n.ok?n.link:(n.error&&(n.error===ue.UNAUTHORIZED?this.router.navigate([`${N.LINK}/${e}/${N.AUTH}`]).catch(console.error):this.router.navigate([`${N.LINK}/${e}/${n.error}`]).catch(console.error)),!1)),oe(()=>(this.authService.logout(),V(!1))))}linkAccess(e,n){n.share?.isDir||n.space?.alias?this.http.get(`${Se}/${e}`).subscribe(t=>{this.authService.initUserFromResponse(t),n.space?this.router.navigate([H.SPACES],{queryParams:{select:n.space.name}}).catch(console.error):this.router.navigate([H.SPACES_SHARES],{queryParams:{select:n.share.name}}).catch(console.error)}):lt(`${Se}/${e}`)}linkAuthentication(e,n){return this.http.post(`${Dt}/${e}`,{password:n}).pipe(b(t=>(this.authService.initUserFromResponse(t),this.router.navigate([`${N.LINK}/${e}`]).catch(console.error),!0)),oe(t=>(t.error.message===ue.UNAUTHORIZED?this.layout.sendNotification("warning","Link","Bad password"):this.router.navigate([`${N.LINK}/${e}/${t.error.message}`]).catch(console.error),V(!1))))}copyLinkToClipboard(e){this.clipboard.copyFromContent(this.genLink(e))}genUUID(){return this.http.get(xt).pipe(b(e=>e.uuid))}createLinkDialog(e){this.genUUID().subscribe(n=>{let t=this.layout.openDialog(ne,"md",{initialState:{link:{name:e.name,uuid:n,isActive:!0,nbAccess:0}}});this.subscribeToSubmitLinkModal(t,e)})}updateLinkFromSpaceOrShare(e,n,t,c){return this.http.put(`${q}/${e}/${t}/${n}`,c)}editLinkDialog(e,n,t){if(n.id===0||e?.linkSettings?.uuid){let c=this.layout.openDialog(ne,"md",{initialState:{link:e.linkSettings}});this.subscribeToSubmitLinkModal(c,n,e)}else this.linkFromSpaceOrShare(e.linkId,n.id,t).subscribe({next:c=>{let g=this.layout.openDialog(ne,"md",{initialState:{link:I(y({},c),{permissions:e.permissions})}});this.subscribeToSubmitLinkModal(g,n,e)},error:c=>this.layout.sendNotification("error","Link error",e.name||n.name,c)})}shareLinkGuestToMember(e,n,t){return new ft({id:e,linkId:n,name:t.name,description:t.email,createdAt:t.createdAt,permissions:t.permissions,type:ht.LINK,spaceRole:ct.IS_MEMBER,linkSettings:t},[L.SHARE_INSIDE,L.SHARE_OUTSIDE])}subscribeToSubmitLinkModal(e,n,t){e.content.submitEvent.pipe(ve(1)).subscribe(c=>{if(Object.keys(c).length){let g=Object.assign(e.content.link,c),E=this.shareLinkGuestToMember(g.userId||-(n.links.length+1),t?.linkId||-(n.links.length+1),g);E.linkId?n.links=[E,...n.links.filter(A=>A.linkId!==E.linkId)]:n.links=[E,...n.links]}e.content.layout.closeDialog()})}genLink(e){return`${document.location.origin}/#/${N.LINK}/${e}`}};r.\u0275fac=function(n){return new(n||r)},r.\u0275prov=P({token:r,factory:r.\u0275fac,providedIn:"root"});let o=r;return o})();var Ut=o=>({dateInputFormat:"YYYY-MM-DD",containerClass:"theme-dark-blue",returnFocusToInput:!0,minDate:o,showWeekNumbers:!1}),Vt=(o,r)=>r.key;function Kt(o,r){o&1&&(s(0,"span",4),p(1,"Edit link"),a())}function qt(o,r){o&1&&(s(0,"span",4),p(1,"New link"),a())}function jt(o,r){o&1&&d(0,"div",54)}function Wt(o,r){if(o&1){let i=G();s(0,"button",53),C(1,"translate"),pe("ngModelChange",function(n){let t=F(i).$implicit,c=u(3);return ce(c.permissions[t.key],n)||(c.permissions[t.key]=n),M(n)}),w("ngModelChange",function(){F(i);let n=u(3);return M(n.onPermissionChange())}),d(2,"fa-icon",50),a(),_(3,jt,1,0,"div",54)}if(o&2){let i=r.$implicit,e=r.$index,n=r.$count,t=u(3);le("ngModel",t.permissions[i.key]),m("tooltip",v(1,4,t.SPACES_PERMISSIONS_TEXT[i.key].text,t.locale.language)),l(2),m("icon",t.SPACES_PERMISSIONS_TEXT[i.key].icon),l(),k(e===n-1?3:-1)}}function Gt(o,r){if(o&1&&(se(0,Wt,4,7,null,null,Vt),C(2,"keyvalue")),o&2){let i=u(2);ae(v(2,0,i.permissions,i.originalOrderKeyValue))}}function Zt(o,r){if(o&1&&(s(0,"div",51),d(1,"app-share-repository",55),a()),o&2){let i=u(2);l(),m("share",i.share)("showIcon",!0)("showFullPath",!0)}}function Yt(o,r){if(o&1){let i=G();s(0,"div",44),d(1,"fa-icon",45),s(2,"div",46)(3,"span"),p(4),a(),s(5,"span",47),p(6),a()(),s(7,"div",48),_(8,Gt,3,3),s(9,"button",49),C(10,"translate"),w("click",function(){F(i);let n=u();return M(n.toggleRequireAuth())}),d(11,"fa-icon",50),a(),s(12,"button",49),C(13,"translate"),w("click",function(){F(i);let n=u();return M(n.copyToClipboard())}),d(14,"fa-icon",50),a()()(),_(15,Zt,2,3,"div",51),d(16,"hr",52)}if(o&2){let i=u();l(),m("icon",i.icons.links),l(3),$(i.linkForm.value.name||i.linkForm.value.shareName),l(2),$(i.linkForm.value.email),l(2),k(i.share&&i.permissions?8:-1),l(),x(O("btn btn-sm ",i.linkForm.value.requireAuth?"btn-success":"btn-warning")),m("tooltip",v(10,15,"Password",i.locale.language)),l(2),m("icon",i.linkForm.value.requireAuth?i.icons.faLock:i.icons.faLockOpen),l(),x(O("btn btn-sm ms-2 ",i.linkWasCopied?"btn-info":"btn-secondary")),m("tooltip",v(13,18,"Copy link",i.locale.language)),l(2),m("icon",i.linkWasCopied?i.icons.faClipboardCheck:i.icons.faClipboard),l(),k(i.share?15:-1)}}function Xt(o,r){if(o&1&&(s(0,"span"),p(1),a()),o&2){let i=u();x(O("badge rounded-pill ",(i.share?i.share.link.nbAccess:i.link.nbAccess)>=i.linkForm.value.limitAccess?"bg-danger":"bg-success")),l(),xe(" ",i.share?i.share.link.nbAccess:i.link.nbAccess,"/",i.linkForm.value.limitAccess," ")}}function zt(o,r){if(o&1&&(s(0,"span",20),p(1),a()),o&2){let i=u();l(),$(i.share?i.share.link.nbAccess:i.link.nbAccess)}}function Qt(o,r){if(o&1&&(s(0,"div",27)(1,"label",56),p(2,"Share name"),a(),d(3,"input",57),C(4,"translate"),a(),s(5,"div",27)(6,"label",58),p(7,"Share description"),a(),d(8,"input",59),C(9,"translate"),a()),o&2){let i=u();l(3),K("is-invalid",i.linkForm.controls.shareName.invalid),m("placeholder",v(4,4,"Share name",i.locale.language)),l(5),m("placeholder",v(9,7,"Share description",i.locale.language))}}function Jt(o,r){if(o&1&&(s(0,"option",30),p(1),a()),o&2){let i=r.$implicit;m("ngValue",i),l(),$(i)}}function ei(o,r){if(o&1&&(s(0,"div",37),d(1,"app-password-strength-bar",60),a()),o&2){let i=u();l(),m("passwordToCheck",i.password)}}function ti(o,r){if(o&1){let i=G();s(0,"button",61),w("click",function(){F(i);let n=u();return M(n.confirmDeletion=!0)}),p(1," Remove "),a()}if(o&2){let i=u();m("disabled",i.confirmDeletion)}}var ne=(()=>{let r=class r{constructor(){this.layout=S(B),this.parentSpaceId=null,this.isSharesRepo=!1,this.inSharesList=!1,this.submitEvent=new re,this.shareChange=new re,this.locale=S(Q),this.confirmDeletion=!1,this.submitted=!1,this.SPACES_PERMISSIONS_TEXT=mt,this.originalOrderKeyValue=at,this.icons={faEye:Je,faEyeSlash:ot,links:R.LINKS,faClipboard:tt,faClipboardCheck:et,faLock:nt,faLockOpen:it},this.languages=this.layout.getLanguages(),this.minDate=he(),this.defaultPassword=this.layout.translateString(rt),this.passwordMinLength=8,this.password="",this.linkIsExpired=!1,this.linkIsHovered=!1,this.linkWasCopied=!1,this.userService=S(St),this.sharesService=S(Lt),this.linksService=S(Pt),this.spacesService=S(Et),this.minDate.setDate(this.minDate.getDate()+1)}ngOnInit(){this.link?this.initLink():this.file?this.initFile():this.initShareLink(),this.linkForm.value.requireAuth&&(this.password=this.defaultPassword),this.linkForm.value.expiresAt&&this.isLinkIsExpired(this.share?this.share.link.expiresAt:this.link.expiresAt),this.linkForm.controls.expiresAt.valueChanges.subscribe(e=>this.isLinkIsExpired(e))}onPermissionChange(){let e=ut(this.permissions);this.linkForm.controls.permissions.setValue(e),e!==this.share.link.permissions?this.linkForm.controls.permissions.markAsDirty():this.linkForm.controls.permissions.markAsPristine()}toggleRequireAuth(){this.linkForm.controls.requireAuth.setValue(!this.linkForm.value.requireAuth),this.linkForm.controls.requireAuth.markAsDirty()}copyToClipboard(){this.linksService.copyLinkToClipboard(this.share?this.share.link.uuid:this.link.uuid),this.linkWasCopied=!0,this.layout.sendNotification("info","Link copied",this.linkForm.value.name||this.linkForm.value.shareName),setTimeout(()=>this.linkWasCopied=!1,3e3)}onCancel(){this.confirmDeletion?this.confirmDeletion=!1:this.layout.closeDialog()}onSubmit(){if(this.submitted=!0,this.confirmDeletion){(this.parentSpaceId?this.spacesService.deleteSpaceShare(this.parentSpaceId,this.share.id):this.sharesService.deleteShare(this.share.id)).subscribe({next:()=>{this.layout.sendNotification("success","Link deleted",this.share.link.name||this.share.name),this.shareChange.emit(["delete",this.share]),this.layout.closeDialog()},error:c=>{this.layout.sendNotification("error","Delete share",this.share.name,c),this.layout.closeDialog()}});return}if(this.file?.id){let n=this.share,{link:t}=n,c=_e(n,["link"]),g=I(y(y({},t),this.linkForm.value),{password:this.mustIncludePassword()?this.password:void 0});c.name=de("shareName",g),c.description=de("shareDescription",g);let E=this.linksService.shareLinkGuestToMember(-1,-1,g);this.sharesService.createShare(I(y({},c),{type:yt.LINK,links:[E]})).subscribe({next:A=>{this.shareChange.emit(["add",A]),this.layout.sendNotification("success","Link created",t.name||A.name),this.layout.closeDialog()},error:A=>{this.layout.sendNotification("error","Link error",this.share.name,A),this.layout.closeDialog()}});return}let e={};for(let t in this.linkForm.controls)this.linkForm.controls[t].dirty&&(e[t]=this.linkForm.controls[t].value);if(this.mustIncludePassword()&&(e.password=this.password),this.share?.id){Object.keys(e).length&&this.linksService.updateLinkFromSpaceOrShare(this.share.link.id,this.share.id,pt.SHARE,e).subscribe({next:t=>{this.share.name=this.linkForm.value.shareName,this.share.description=this.linkForm.value.shareDescription,this.share.link=Object.assign(this.share.link,t),this.share.updateTimes(),this.share.updatePermission(),this.shareChange.emit(["update",this.share]),this.layout.closeDialog()},error:t=>{this.layout.sendNotification("error","Link error",this.share.link.name||this.share.name,t),this.layout.closeDialog()}}),this.layout.closeDialog();return}this.submitEvent.emit(e)}initFile(){let e=this.sharesService.initShareFromFile(this.userService.user,this.file,this.isSharesRepo,this.inSharesList)[0];this.share=I(y({},e),{link:{id:-1,userId:-1,uuid:"",isActive:!0,requireAuth:!1,permissions:"",nbAccess:0,limitAccess:0}}),this.linksService.genUUID().subscribe(n=>this.share.link.uuid=n),this.initShareLink(),this.onPermissionChange()}initShareLink(){this.linkForm=new me({shareName:new f(this.share.name,z.required),shareDescription:new f(this.share.description||""),name:new f(this.share.link?.name||""),email:new f(this.share.link?.email||"",z.email),language:new f(this.share.link.language||null),limitAccess:new f(this.share.link.limitAccess||null),expiresAt:new f(this.share.link.expiresAt||null),requireAuth:new f(this.share.link.requireAuth||!1),permissions:new f(this.share.link.permissions),isActive:new f(this.share.link.isActive)}),this.permissions=dt(this.share.file.permissions,this.share.link.permissions,[L.SHARE_INSIDE,L.SHARE_OUTSIDE,...this.share.file.isDir?[]:[L.DELETE,L.ADD]])}initLink(){this.linkForm=new me({shareName:new f(""),shareDescription:new f(""),name:new f(this.link.name||""),email:new f(this.link.email||"",z.email),language:new f(this.link.language||null),limitAccess:new f(this.link.limitAccess||null),expiresAt:new f(this.link.expiresAt||null),requireAuth:new f(this.link.requireAuth||!1),permissions:new f(this.link.permissions),isActive:new f(this.link.isActive)}),this.link.id||(this.linkForm.controls.name.markAsDirty(),this.linkForm.controls.isActive.markAsDirty())}isLinkIsExpired(e){if(e==null){if(this.linkIsExpired=!1,e===null)return;this.linkForm.controls.expiresAt.setValue(null)}this.linkIsExpired=he()>=e}mustIncludePassword(){return!!this.password.length&&this.password!==this.defaultPassword}};r.\u0275fac=function(n){return new(n||r)},r.\u0275cmp=W({type:r,selectors:[["app-link-dialog"]],inputs:{share:"share",parentSpaceId:"parentSpaceId",link:"link",file:"file",isSharesRepo:"isSharesRepo",inSharesList:"inSharesList"},outputs:{submitEvent:"submitEvent",shareChange:"shareChange"},decls:73,vars:52,consts:[[1,"modal-header","align-items-center"],[1,"modal-title"],[1,"me-2",3,"icon"],[1,"modal-title","ms-auto"],["l10nTranslate",""],["aria-label","Close","type","button",1,"btn-close","btn-close-white","ms-2",3,"click"],[1,"modal-body"],["autocomplete","off",3,"formGroup"],[1,"d-flex"],[1,"d-flex","flex-column","flex-grow-1"],[1,"d-flex","align-items-center","cursor-pointer","py-2",3,"mouseover","mouseleave","focus","click"],["for","link","l10nTranslate",""],["id","link",1,"ms-auto"],[1,"d-flex","align-items-center","py-2"],["for","state","l10nTranslate","",1,"cursor-pointer","me-auto"],[1,"d-flex","align-items-center","form-check","form-switch","cursor-pointer"],["id","state","formControlName","isActive","type","checkbox","role","button",1,"form-check-input"],["for","access","l10nTranslate",""],["id","access",1,"ms-auto"],[3,"class"],[1,"badge","rounded-pill","bg-success"],[1,"d-flex","align-items-center"],["for","guestName","l10nTranslate",""],["id","guestName","formControlName","name","type","text",1,"form-control","form-control-sm","ms-auto","w-50",3,"placeholder"],[1,"d-flex","align-items-center","justify-content-between","px-0"],["for","guestEmail","l10nTranslate",""],["id","guestEmail","autocomplete","off","formControlName","email","type","email",1,"form-control","form-control-sm","ms-auto","w-50",3,"placeholder"],[1,"d-flex","align-items-center","justify-content-between"],["for","guestLanguage","l10nTranslate",""],["id","guestLanguage","formControlName","language",1,"form-control","form-select","form-select-sm","ms-auto","w-50"],[3,"ngValue"],["for","limitAccess","l10nTranslate",""],["id","limitAccess","formControlName","limitAccess","min","1","type","number",1,"form-control","form-control-sm","ms-auto","w-50",3,"placeholder"],["for","expiration","l10nTranslate",""],["id","expiration","formControlName","expiresAt","placement","left","type","text","bsDatepicker","",1,"form-control","form-control-sm","ms-auto","w-50",3,"placeholder","bsConfig"],[1,"d-flex","align-items-center","px-0"],["for","requireAuth","translate","",1,"cursor-pointer","me-auto"],[1,"d-flex","align-items-center","d-none","d-sm-flex","mx-auto"],["id","requireAuth","formControlName","requireAuth","type","checkbox","role","button",1,"form-check-input"],["placeholder","Set a password",2,"width","45%",3,"passwordChange","isRequired","disabled","passwordMinLength","password","showGenerator"],[1,"modal-footer"],["type","button","l10nTranslate","",1,"btn","btn-sm","btn-danger",3,"disabled"],["data-dismiss","modal","type","button","l10nTranslate","",1,"btn","btn-sm","btn-secondary","ms-auto",3,"click"],["type","button","l10nTranslate","",3,"click","disabled"],[1,"d-flex","flex-fill","align-items-center"],[1,"circle-primary-icon","me-2",3,"icon"],[1,"d-flex","flex-column"],[1,"fs-xxxs"],[1,"d-flex","ms-auto"],["container","body","type","button",3,"click","tooltip"],["size","lg",3,"icon"],[1,"d-flex","align-items-center","d-none","d-sm-flex","py-2"],[1,"my-2"],["btnCheckbox","","type","button",1,"btn","btn-sm","btn-custom","me-0","ms-2",3,"ngModelChange","ngModel","tooltip"],[1,"vr","mx-2"],["id","file",3,"share","showIcon","showFullPath"],["for","shareName","l10nTranslate",""],["id","shareName","formControlName","shareName","type","email",1,"form-control","form-control-sm","ms-auto","w-50",3,"placeholder"],["for","shareDescription","l10nTranslate",""],["id","shareDescription","formControlName","shareDescription","type","email",1,"form-control","form-control-sm","ms-auto","w-50",3,"placeholder"],[3,"passwordToCheck"],["type","button","l10nTranslate","",1,"btn","btn-sm","btn-danger",3,"click","disabled"]],template:function(n,t){n&1&&(s(0,"div",0)(1,"h4",1),d(2,"fa-icon",2),s(3,"span"),p(4),a()(),s(5,"h4",3),_(6,Kt,2,0,"span",4)(7,qt,2,0,"span",4),a(),s(8,"button",5),w("click",function(){return t.layout.closeDialog()}),a()(),s(9,"div",6),_(10,Yt,17,21),s(11,"form",7)(12,"div",8)(13,"div",9)(14,"div",10),w("mouseover",function(){return t.linkIsHovered=!0})("mouseleave",function(){return t.linkIsHovered=!1})("focus",function(){return t.linkIsHovered=!0})("click",function(){return t.copyToClipboard()}),s(15,"label",11),p(16,"Link"),a(),s(17,"span",12),p(18),a()(),s(19,"div",13)(20,"label",14),p(21,"Active"),a(),s(22,"div",15),d(23,"input",16),s(24,"span"),p(25),C(26,"translate"),a()()(),s(27,"div",13)(28,"label",17),p(29,"Current access count"),a(),s(30,"span",18),_(31,Xt,2,5,"span",19)(32,zt,2,1,"span",20),a()(),_(33,Qt,10,10),s(34,"div",21)(35,"label",22),p(36,"Guest name"),a(),d(37,"input",23),C(38,"translate"),a(),s(39,"div",24)(40,"label",25),p(41,"Guest email"),a(),d(42,"input",26),C(43,"translate"),a(),s(44,"div",27)(45,"label",28),p(46,"Guest language"),a(),s(47,"select",29),se(48,Jt,2,2,"option",30,Ie),a()(),s(50,"div",27)(51,"label",31),p(52,"Limit access"),a(),d(53,"input",32),C(54,"translate"),a(),s(55,"div",27)(56,"label",33),p(57,"Expiration"),a(),d(58,"input",34),C(59,"translate"),a(),s(60,"div",35)(61,"label",36),p(62,"Password"),a(),_(63,ei,2,1,"div",37),s(64,"div",15),d(65,"input",38),a(),s(66,"app-input-password",39),pe("passwordChange",function(g){return ce(t.password,g)||(t.password=g),g}),a()()()()()(),s(67,"div",40),_(68,ti,2,1,"button",41),s(69,"button",42),w("click",function(){return t.onCancel()}),p(70,"Cancel"),a(),s(71,"button",43),w("click",function(){return t.onSubmit()}),p(72),a()()),n&2&&(l(2),m("icon",t.icons.links),l(2),$(t.linkForm.value.name||t.linkForm.value.shareName),l(2),k(t.share!=null&&t.share.id||t.link!=null&&t.link.id?6:7),l(4),k(t.share||t.link?10:-1),l(),m("formGroup",t.linkForm),l(6),K("text-primary",t.linkIsHovered),l(),D(" ",t.share?t.share.link.uuid:t.link.uuid," "),l(6),x(O("badge rounded-pill ms-3 ",t.linkForm.value.isActive?"bg-primary":"bg-danger")),l(),D(" ",v(26,35,t.linkForm.value.isActive?"yes":"no",t.locale.language)," "),l(6),k(t.linkForm.value.limitAccess?31:32),l(2),k(t.share?33:-1),l(4),m("placeholder",v(38,38,"Guest name",t.locale.language)),l(5),K("is-invalid",t.linkForm.controls.email.invalid),m("placeholder",v(43,41,"Guest email",t.locale.language)),l(6),ae(t.languages),l(5),m("placeholder",v(54,44,"Unlimited",t.locale.language)),l(5),K("text-danger",t.linkIsExpired),m("placeholder",v(59,47,"Unlimited",t.locale.language))("bsConfig",Le(50,Ut,t.minDate)),l(5),k(t.linkForm.value.requireAuth&&t.password!==t.defaultPassword?63:-1),l(3),m("isRequired",t.linkForm.value.requireAuth)("disabled",!t.linkForm.value.requireAuth)("passwordMinLength",t.passwordMinLength),le("password",t.password),m("showGenerator",!0),l(2),k(t.share!=null&&t.share.id?68:-1),l(3),x(O("btn btn-sm ",t.confirmDeletion?"btn-danger":"btn-primary")),m("disabled",t.linkForm.invalid||t.linkForm.controls.requireAuth.value&&t.password.length<t.passwordMinLength||t.submitted),l(),D(" ",t.confirmDeletion?"Confirm deletion":"Confirm"," "))},dependencies:[X,We,ze,Ye,Xe,_t,gt,qe,Me,Ue,Ve,Ne,$e,De,He,Re,Pe,Ke,Fe,Ct,Ze,Ge,je,Oe,Be,At,vt,Te,J],encapsulation:2});let o=r;return o})();export{Rt as a,At as b,Lt as c,ne as d,Pt as e};
1
+ import{a as yt,c as bt,d as T,e as te,g as Et}from"./chunk-2PQGH3LQ.js";import{a as Ct,b as vt}from"./chunk-MLLPT7BU.js";import{f as kt}from"./chunk-W4LKCEBR.js";import{f as St,g as gt,h as _t}from"./chunk-6HV65OKG.js";import{A as ze,Ca as he,Ea as de,Hb as fe,Ib as R,Jb as H,Kb as mt,La as st,Mb as ht,Ob as dt,Qb as ut,Rb as ft,S as ee,Xa as at,Za as lt,mb as L,pb as ct,v as Ge,va as rt,w as Ze,xb as B,y as Ye,z as Xe}from"./chunk-55WOZ7P6.js";import{d as Y}from"./chunk-J6YSVODR.js";import{$b as Le,$c as De,Cb as w,Eb as u,Ed as J,Fd as We,G as oe,Gc as Te,Jd as Qe,L as ve,Lf as ot,Ma as l,Mb as we,Nb as K,Ob as x,Oc as Z,Pb as p,Qb as $,Rb as D,Sb as xe,Tb as le,Ub as ce,Vb as pe,Xa as W,Xb as O,Zc as X,ad as Ne,bb as re,be as Je,bg as ue,ca as P,cb as Ae,cd as z,ce as et,cg as pt,dc as C,dg as N,ed as Re,f as ke,fa as ye,fc as v,fd as Pe,ga as j,gd as me,ha as S,id as f,jb as _,jd as Fe,kb as k,kd as Me,lb as Ie,ld as $e,lf as it,ma as F,na as M,nb as se,nd as Oe,ob as ae,od as Be,p as V,pa as be,pb as m,pd as He,qb as s,qd as Ue,rb as a,rd as Ve,sb as d,sd as Ke,t as Ce,te as tt,tf as nt,v as b,va as Ee,wd as qe,xd as je,yd as Q,zb as G}from"./chunk-JQOMI5VI.js";import{a as y,b as I,c as _e}from"./chunk-RTRJ3KFH.js";function Ft(o,r){if(o&1&&d(0,"fa-icon",2),o&2){let i=u();x(i.repository.class),we("min-width",i.galleryMode.dimensions/3,"px")("min-height",i.galleryMode.dimensions/3,"px")("font-size",i.galleryMode.faSize/1.8,"px"),m("icon",i.repository.icon)}}function Mt(o,r){if(o&1&&d(0,"fa-icon",5),o&2){let i=u(2);x(i.repository.class),m("icon",i.repository.icon)}}function $t(o,r){if(o&1&&(p(0),C(1,"translate")),o&2){let i=u(2);D(" ",v(1,1,i.repository.label,i.locale.language)," ")}}function Ot(o,r){if(o&1&&p(0),o&2){let i=u(2);D(" ",i.repository.label," ")}}function Bt(o,r){if(o&1&&(s(0,"div",1),_(1,Mt,1,3,"fa-icon",3),s(2,"span",4),_(3,$t,2,4)(4,Ot,1,1),a()()),o&2){let i=u();l(),k(i.showIcon?1:-1),l(2),k(i.repository.translate?3:4)}}var At=(()=>{let r=class r{constructor(){this.showIcon=!0,this.showFullPath=!1,this.locale=S(Q),this.layout=S(B),this.unknownRepository={icon:Qe,label:"",class:"circle-primary-icon",translate:!1}}ngOnInit(){this.setRepository()}ngOnChanges(){this.setRepository()}setRepository(){this.share.parent?.id||this.share.parent?.id===0?this.repository={icon:R.SHARES,label:this.share.parent.name,class:"circle-purple-icon",translate:!1}:this.share.file?.ownerId?this.repository={icon:R.PERSONAL,label:fe.PERSONAL_FILES,class:"circle-primary-icon",translate:!0}:this.share.file?.space?.alias?this.repository={icon:R.SPACES,label:`${this.share.file.space.name}`,class:"circle-primary-icon",translate:!1}:this.share.externalPath?this.repository={icon:R.EXTERNAL,label:"External",class:"circle-primary-icon",translate:!0}:this.repository=y({},this.unknownRepository),this.showFullPath&&this.setFullPath()}setFullPath(){if(!this.repository.label)return;let e=this.share.file?.path?this.share.file.path.split("/").filter(n=>n&&n!=="."):[];this.share.parent?.id&&!this.share.file?.id&&this.share.file?.path.indexOf("/")===-1?e.shift():this.share.file?.space?.alias&&this.share.file.space?.root?.alias&&(e.length?e.unshift(this.share.file.space.root.name):e.push(this.share.file.space.root.name)),this.repository.label===fe.PERSONAL_FILES&&(this.repository.label=this.layout.translateString(this.repository.label)),e.length&&(this.repository.label=`${this.repository.label}/${e.join("/")}`)}};r.\u0275fac=function(n){return new(n||r)},r.\u0275cmp=W({type:r,selectors:[["app-share-repository"]],inputs:{share:"share",galleryMode:"galleryMode",showIcon:"showIcon",showFullPath:"showFullPath"},features:[Ee],decls:2,vars:1,consts:[[3,"icon","class","min-width","min-height","font-size"],[1,"d-flex","align-items-center"],[3,"icon"],[1,"me-2",3,"icon","class"],["draggable","false",1,"no-pointer-events"],[1,"me-2",3,"icon"]],template:function(n,t){n&1&&_(0,Ft,1,9,"fa-icon",0)(1,Bt,5,2,"div",1),n&2&&k(t.galleryMode?0:1)},dependencies:[X,J],encapsulation:2});let o=r;return o})();var h={BASE:`${ee}/shares`,LIST:"list",CHILDREN:"children",LINKS:"links",LINKS_LIST:"links/list",LINKS_UUID:"links/uuid"},It=`${h.BASE}/${h.LIST}`,q=`${h.BASE}/${h.LINKS}`,wt=`${h.BASE}/${h.LINKS_LIST}`,xt=`${h.BASE}/${h.LINKS_UUID}`;var Lt=(()=>{let r=class r{constructor(){this.http=S(Z),this.router=S(Y)}getShare(e){return this.http.get(`${h.BASE}/${e}`).pipe(b(n=>new T(n)))}createShare(e){return this.http.post(h.BASE,e).pipe(b(n=>new T(n)))}updateShare(e){return this.http.put(`${h.BASE}/${e.id}`,e).pipe(b(n=>new T(n)))}deleteShare(e){return this.http.delete(`${h.BASE}/${e}`)}listShares(){return this.http.get(It)}getShareChild(e,n){return this.http.get(`${h.BASE}/${e}/${h.CHILDREN}/${n}`).pipe(b(t=>new T(t)))}updateShareChild(e,n,t){return this.http.put(`${h.BASE}/${e}/${h.CHILDREN}/${n}`,t).pipe(b(c=>new T(c)))}deleteShareChild(e,n){return this.http.delete(`${h.BASE}/${e}/${h.CHILDREN}/${n}`)}listChildShares(e){return this.http.get(`${h.BASE}/${e}/${h.CHILDREN}`)}initShareFromFile(e,n,t=!1,c=!1){let g,E=null,A=y({id:0,name:"",createdAt:new Date,modifiedAt:new Date,enabled:!0},t?{parent:{id:0,ownerId:0,alias:n.space.alias,name:n.space.name}}:{});if(n){c&&(E=n.root.id);let ge=null;(n?.root?.owner.login===e.login||!n?.space?.alias)&&(n.space=null,ge=e.id),g=new T(I(y({},A),{name:n.name,file:I(y({},n),{path:c?".":st(n.path,2),ownerId:ge})}))}else g=new T(A);return[g,E]}goTo(e){if(!e.id)return Ce(V(!1));if(e.externalPath&&!e.parent?.id)return this.router.navigate([H.SPACES_SHARES],{queryParams:{select:e.name}});if(e.parent?.id&&!e.file?.id&&e.file?.path.indexOf("/")===-1)return this.router.navigate([H.SPACES_SHARES],{queryParams:{select:e.parent.name}});{let[n,t]=bt(e);return this.router.navigate([n],{queryParams:{select:t}})}}};r.\u0275fac=function(n){return new(n||r)},r.\u0275prov=P({token:r,factory:r.\u0275fac,providedIn:"root"});let o=r;return o})();var U={BASE:`${ee}/link`,LINK:"link",VALIDATION:"validation",ACCESS:"access",AUTH:"auth"},Tt=`${U.BASE}/${U.VALIDATION}`,Se=`${U.BASE}/${U.ACCESS}`,Dt=`${U.BASE}/${U.AUTH}`;var Nt=new ye("WindowToken",typeof window<"u"&&window.document?{providedIn:"root",factory:()=>window}:{providedIn:"root",factory:()=>{}});var Rt=(()=>{class o{constructor(i,e,n){this.ngZone=i,this.document=e,this.window=n,this.copySubject=new ke,this.copyResponse$=this.copySubject.asObservable(),this.config={}}configure(i){this.config=i}copy(i){if(!this.isSupported||!i)return this.pushCopyResponse({isSuccess:!1,content:i});let e=this.copyFromContent(i);return e?this.pushCopyResponse({content:i,isSuccess:e}):this.pushCopyResponse({isSuccess:!1,content:i})}get isSupported(){return!!this.document.queryCommandSupported&&!!this.document.queryCommandSupported("copy")&&!!this.window}isTargetValid(i){if(i instanceof HTMLInputElement||i instanceof HTMLTextAreaElement){if(i.hasAttribute("disabled"))throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');return!0}throw new Error("Target should be input or textarea")}copyFromInputElement(i,e=!0){try{this.selectTarget(i);let n=this.copyText();return this.clearSelection(e?i:void 0,this.window),n&&this.isCopySuccessInIE11()}catch{return!1}}isCopySuccessInIE11(){let i=this.window.clipboardData;return!(i&&i.getData&&!i.getData("Text"))}copyFromContent(i,e=this.document.body){if(this.tempTextArea&&!e.contains(this.tempTextArea)&&this.destroy(this.tempTextArea.parentElement||void 0),!this.tempTextArea){this.tempTextArea=this.createTempTextArea(this.document,this.window);try{e.appendChild(this.tempTextArea)}catch{throw new Error("Container should be a Dom element")}}this.tempTextArea.value=i;let n=this.copyFromInputElement(this.tempTextArea,!1);return this.config.cleanUpAfterCopy&&this.destroy(this.tempTextArea.parentElement||void 0),n}destroy(i=this.document.body){this.tempTextArea&&(i.removeChild(this.tempTextArea),this.tempTextArea=void 0)}selectTarget(i){return i.select(),i.setSelectionRange(0,i.value.length),i.value.length}copyText(){return this.document.execCommand("copy")}clearSelection(i,e){i&&i.focus(),e.getSelection()?.removeAllRanges()}createTempTextArea(i,e){let n=i.documentElement.getAttribute("dir")==="rtl",t;t=i.createElement("textarea"),t.style.fontSize="12pt",t.style.border="0",t.style.padding="0",t.style.margin="0",t.style.position="absolute",t.style[n?"right":"left"]="-9999px";let c=e.pageYOffset||i.documentElement.scrollTop;return t.style.top=c+"px",t.setAttribute("readonly",""),t}pushCopyResponse(i){this.copySubject.observers.length>0&&this.ngZone.run(()=>{this.copySubject.next(i)})}pushCopyReponse(i){this.pushCopyResponse(i)}}return o.\u0275fac=function(i){return new(i||o)(j(Ae),j(be),j(Nt,8))},o.\u0275prov=P({token:o,factory:o.\u0275fac,providedIn:"root"}),o})();var Pt=(()=>{let r=class r{constructor(){this.router=S(Y),this.http=S(Z),this.layout=S(B),this.authService=S(kt),this.clipboard=S(Rt)}shareLinksList(){return this.http.get(wt).pipe(b(e=>e.map(n=>new te(n))))}shareLink(e){return this.http.get(`${q}/${e}`).pipe(b(n=>new te(n)))}shareLinkChild(e,n){return this.http.get(`${q}/${e}/${h.CHILDREN}/${n}`).pipe(b(t=>new te(t)))}linkFromSpaceOrShare(e,n,t){return this.http.get(`${q}/${e}/${t}/${n}`)}linkValidation(e){return this.http.get(`${Tt}/${e}`).pipe(b(n=>n.ok?n.link:(n.error&&(n.error===ue.UNAUTHORIZED?this.router.navigate([`${N.LINK}/${e}/${N.AUTH}`]).catch(console.error):this.router.navigate([`${N.LINK}/${e}/${n.error}`]).catch(console.error)),!1)),oe(()=>(this.authService.logout(),V(!1))))}linkAccess(e,n){n.share?.isDir||n.space?.alias?this.http.get(`${Se}/${e}`).subscribe(t=>{this.authService.initUserFromResponse(t),n.space?this.router.navigate([H.SPACES],{queryParams:{select:n.space.name}}).catch(console.error):this.router.navigate([H.SPACES_SHARES],{queryParams:{select:n.share.name}}).catch(console.error)}):lt(`${Se}/${e}`)}linkAuthentication(e,n){return this.http.post(`${Dt}/${e}`,{password:n}).pipe(b(t=>(this.authService.initUserFromResponse(t),this.router.navigate([`${N.LINK}/${e}`]).catch(console.error),!0)),oe(t=>(t.error.message===ue.UNAUTHORIZED?this.layout.sendNotification("warning","Link","Bad password"):this.router.navigate([`${N.LINK}/${e}/${t.error.message}`]).catch(console.error),V(!1))))}copyLinkToClipboard(e){this.clipboard.copyFromContent(this.genLink(e))}genUUID(){return this.http.get(xt).pipe(b(e=>e.uuid))}createLinkDialog(e){this.genUUID().subscribe(n=>{let t=this.layout.openDialog(ne,"md",{initialState:{link:{name:e.name,uuid:n,isActive:!0,nbAccess:0}}});this.subscribeToSubmitLinkModal(t,e)})}updateLinkFromSpaceOrShare(e,n,t,c){return this.http.put(`${q}/${e}/${t}/${n}`,c)}editLinkDialog(e,n,t){if(n.id===0||e?.linkSettings?.uuid){let c=this.layout.openDialog(ne,"md",{initialState:{link:e.linkSettings}});this.subscribeToSubmitLinkModal(c,n,e)}else this.linkFromSpaceOrShare(e.linkId,n.id,t).subscribe({next:c=>{let g=this.layout.openDialog(ne,"md",{initialState:{link:I(y({},c),{permissions:e.permissions})}});this.subscribeToSubmitLinkModal(g,n,e)},error:c=>this.layout.sendNotification("error","Link error",e.name||n.name,c)})}shareLinkGuestToMember(e,n,t){return new ft({id:e,linkId:n,name:t.name,description:t.email,createdAt:t.createdAt,permissions:t.permissions,type:ht.LINK,spaceRole:ct.IS_MEMBER,linkSettings:t},[L.SHARE_INSIDE,L.SHARE_OUTSIDE])}subscribeToSubmitLinkModal(e,n,t){e.content.submitEvent.pipe(ve(1)).subscribe(c=>{if(Object.keys(c).length){let g=Object.assign(e.content.link,c),E=this.shareLinkGuestToMember(g.userId||-(n.links.length+1),t?.linkId||-(n.links.length+1),g);E.linkId?n.links=[E,...n.links.filter(A=>A.linkId!==E.linkId)]:n.links=[E,...n.links]}e.content.layout.closeDialog()})}genLink(e){return`${document.location.origin}/#/${N.LINK}/${e}`}};r.\u0275fac=function(n){return new(n||r)},r.\u0275prov=P({token:r,factory:r.\u0275fac,providedIn:"root"});let o=r;return o})();var Ut=o=>({dateInputFormat:"YYYY-MM-DD",containerClass:"theme-dark-blue",returnFocusToInput:!0,minDate:o,showWeekNumbers:!1}),Vt=(o,r)=>r.key;function Kt(o,r){o&1&&(s(0,"span",4),p(1,"Edit link"),a())}function qt(o,r){o&1&&(s(0,"span",4),p(1,"New link"),a())}function jt(o,r){o&1&&d(0,"div",54)}function Wt(o,r){if(o&1){let i=G();s(0,"button",53),C(1,"translate"),pe("ngModelChange",function(n){let t=F(i).$implicit,c=u(3);return ce(c.permissions[t.key],n)||(c.permissions[t.key]=n),M(n)}),w("ngModelChange",function(){F(i);let n=u(3);return M(n.onPermissionChange())}),d(2,"fa-icon",50),a(),_(3,jt,1,0,"div",54)}if(o&2){let i=r.$implicit,e=r.$index,n=r.$count,t=u(3);le("ngModel",t.permissions[i.key]),m("tooltip",v(1,4,t.SPACES_PERMISSIONS_TEXT[i.key].text,t.locale.language)),l(2),m("icon",t.SPACES_PERMISSIONS_TEXT[i.key].icon),l(),k(e===n-1?3:-1)}}function Gt(o,r){if(o&1&&(se(0,Wt,4,7,null,null,Vt),C(2,"keyvalue")),o&2){let i=u(2);ae(v(2,0,i.permissions,i.originalOrderKeyValue))}}function Zt(o,r){if(o&1&&(s(0,"div",51),d(1,"app-share-repository",55),a()),o&2){let i=u(2);l(),m("share",i.share)("showIcon",!0)("showFullPath",!0)}}function Yt(o,r){if(o&1){let i=G();s(0,"div",44),d(1,"fa-icon",45),s(2,"div",46)(3,"span"),p(4),a(),s(5,"span",47),p(6),a()(),s(7,"div",48),_(8,Gt,3,3),s(9,"button",49),C(10,"translate"),w("click",function(){F(i);let n=u();return M(n.toggleRequireAuth())}),d(11,"fa-icon",50),a(),s(12,"button",49),C(13,"translate"),w("click",function(){F(i);let n=u();return M(n.copyToClipboard())}),d(14,"fa-icon",50),a()()(),_(15,Zt,2,3,"div",51),d(16,"hr",52)}if(o&2){let i=u();l(),m("icon",i.icons.links),l(3),$(i.linkForm.value.name||i.linkForm.value.shareName),l(2),$(i.linkForm.value.email),l(2),k(i.share&&i.permissions?8:-1),l(),x(O("btn btn-sm ",i.linkForm.value.requireAuth?"btn-success":"btn-warning")),m("tooltip",v(10,15,"Password",i.locale.language)),l(2),m("icon",i.linkForm.value.requireAuth?i.icons.faLock:i.icons.faLockOpen),l(),x(O("btn btn-sm ms-2 ",i.linkWasCopied?"btn-info":"btn-secondary")),m("tooltip",v(13,18,"Copy link",i.locale.language)),l(2),m("icon",i.linkWasCopied?i.icons.faClipboardCheck:i.icons.faClipboard),l(),k(i.share?15:-1)}}function Xt(o,r){if(o&1&&(s(0,"span"),p(1),a()),o&2){let i=u();x(O("badge rounded-pill ",(i.share?i.share.link.nbAccess:i.link.nbAccess)>=i.linkForm.value.limitAccess?"bg-danger":"bg-success")),l(),xe(" ",i.share?i.share.link.nbAccess:i.link.nbAccess,"/",i.linkForm.value.limitAccess," ")}}function zt(o,r){if(o&1&&(s(0,"span",20),p(1),a()),o&2){let i=u();l(),$(i.share?i.share.link.nbAccess:i.link.nbAccess)}}function Qt(o,r){if(o&1&&(s(0,"div",27)(1,"label",56),p(2,"Share name"),a(),d(3,"input",57),C(4,"translate"),a(),s(5,"div",27)(6,"label",58),p(7,"Share description"),a(),d(8,"input",59),C(9,"translate"),a()),o&2){let i=u();l(3),K("is-invalid",i.linkForm.controls.shareName.invalid),m("placeholder",v(4,4,"Share name",i.locale.language)),l(5),m("placeholder",v(9,7,"Share description",i.locale.language))}}function Jt(o,r){if(o&1&&(s(0,"option",30),p(1),a()),o&2){let i=r.$implicit;m("ngValue",i),l(),$(i)}}function ei(o,r){if(o&1&&(s(0,"div",37),d(1,"app-password-strength-bar",60),a()),o&2){let i=u();l(),m("passwordToCheck",i.password)}}function ti(o,r){if(o&1){let i=G();s(0,"button",61),w("click",function(){F(i);let n=u();return M(n.confirmDeletion=!0)}),p(1," Remove "),a()}if(o&2){let i=u();m("disabled",i.confirmDeletion)}}var ne=(()=>{let r=class r{constructor(){this.layout=S(B),this.parentSpaceId=null,this.isSharesRepo=!1,this.inSharesList=!1,this.submitEvent=new re,this.shareChange=new re,this.locale=S(Q),this.confirmDeletion=!1,this.submitted=!1,this.SPACES_PERMISSIONS_TEXT=mt,this.originalOrderKeyValue=at,this.icons={faEye:Je,faEyeSlash:ot,links:R.LINKS,faClipboard:tt,faClipboardCheck:et,faLock:nt,faLockOpen:it},this.languages=this.layout.getLanguages(),this.minDate=he(),this.defaultPassword=this.layout.translateString(rt),this.passwordMinLength=8,this.password="",this.linkIsExpired=!1,this.linkIsHovered=!1,this.linkWasCopied=!1,this.userService=S(St),this.sharesService=S(Lt),this.linksService=S(Pt),this.spacesService=S(Et),this.minDate.setDate(this.minDate.getDate()+1)}ngOnInit(){this.link?this.initLink():this.file?this.initFile():this.initShareLink(),this.linkForm.value.requireAuth&&(this.password=this.defaultPassword),this.linkForm.value.expiresAt&&this.isLinkIsExpired(this.share?this.share.link.expiresAt:this.link.expiresAt),this.linkForm.controls.expiresAt.valueChanges.subscribe(e=>this.isLinkIsExpired(e))}onPermissionChange(){let e=ut(this.permissions);this.linkForm.controls.permissions.setValue(e),e!==this.share.link.permissions?this.linkForm.controls.permissions.markAsDirty():this.linkForm.controls.permissions.markAsPristine()}toggleRequireAuth(){this.linkForm.controls.requireAuth.setValue(!this.linkForm.value.requireAuth),this.linkForm.controls.requireAuth.markAsDirty()}copyToClipboard(){this.linksService.copyLinkToClipboard(this.share?this.share.link.uuid:this.link.uuid),this.linkWasCopied=!0,this.layout.sendNotification("info","Link copied",this.linkForm.value.name||this.linkForm.value.shareName),setTimeout(()=>this.linkWasCopied=!1,3e3)}onCancel(){this.confirmDeletion?this.confirmDeletion=!1:this.layout.closeDialog()}onSubmit(){if(this.submitted=!0,this.confirmDeletion){(this.parentSpaceId?this.spacesService.deleteSpaceShare(this.parentSpaceId,this.share.id):this.sharesService.deleteShare(this.share.id)).subscribe({next:()=>{this.layout.sendNotification("success","Link deleted",this.share.link.name||this.share.name),this.shareChange.emit(["delete",this.share]),this.layout.closeDialog()},error:c=>{this.layout.sendNotification("error","Delete share",this.share.name,c),this.layout.closeDialog()}});return}if(this.file?.id){let n=this.share,{link:t}=n,c=_e(n,["link"]),g=I(y(y({},t),this.linkForm.value),{password:this.mustIncludePassword()?this.password:void 0});c.name=de("shareName",g),c.description=de("shareDescription",g);let E=this.linksService.shareLinkGuestToMember(-1,-1,g);this.sharesService.createShare(I(y({},c),{type:yt.LINK,links:[E]})).subscribe({next:A=>{this.shareChange.emit(["add",A]),this.layout.sendNotification("success","Link created",t.name||A.name),this.layout.closeDialog()},error:A=>{this.layout.sendNotification("error","Link error",this.share.name,A),this.layout.closeDialog()}});return}let e={};for(let t in this.linkForm.controls)this.linkForm.controls[t].dirty&&(e[t]=this.linkForm.controls[t].value);if(this.mustIncludePassword()&&(e.password=this.password),this.share?.id){Object.keys(e).length&&this.linksService.updateLinkFromSpaceOrShare(this.share.link.id,this.share.id,pt.SHARE,e).subscribe({next:t=>{this.share.name=this.linkForm.value.shareName,this.share.description=this.linkForm.value.shareDescription,this.share.link=Object.assign(this.share.link,t),this.share.updateTimes(),this.share.updatePermission(),this.shareChange.emit(["update",this.share]),this.layout.closeDialog()},error:t=>{this.layout.sendNotification("error","Link error",this.share.link.name||this.share.name,t),this.layout.closeDialog()}}),this.layout.closeDialog();return}this.submitEvent.emit(e)}initFile(){let e=this.sharesService.initShareFromFile(this.userService.user,this.file,this.isSharesRepo,this.inSharesList)[0];this.share=I(y({},e),{link:{id:-1,userId:-1,uuid:"",isActive:!0,requireAuth:!1,permissions:"",nbAccess:0,limitAccess:0}}),this.linksService.genUUID().subscribe(n=>this.share.link.uuid=n),this.initShareLink(),this.onPermissionChange()}initShareLink(){this.linkForm=new me({shareName:new f(this.share.name,z.required),shareDescription:new f(this.share.description||""),name:new f(this.share.link?.name||""),email:new f(this.share.link?.email||"",z.email),language:new f(this.share.link.language||null),limitAccess:new f(this.share.link.limitAccess||null),expiresAt:new f(this.share.link.expiresAt||null),requireAuth:new f(this.share.link.requireAuth||!1),permissions:new f(this.share.link.permissions),isActive:new f(this.share.link.isActive)}),this.permissions=dt(this.share.file.permissions,this.share.link.permissions,[L.SHARE_INSIDE,L.SHARE_OUTSIDE,...this.share.file.isDir?[]:[L.DELETE,L.ADD]])}initLink(){this.linkForm=new me({shareName:new f(""),shareDescription:new f(""),name:new f(this.link.name||""),email:new f(this.link.email||"",z.email),language:new f(this.link.language||null),limitAccess:new f(this.link.limitAccess||null),expiresAt:new f(this.link.expiresAt||null),requireAuth:new f(this.link.requireAuth||!1),permissions:new f(this.link.permissions),isActive:new f(this.link.isActive)}),this.link.id||(this.linkForm.controls.name.markAsDirty(),this.linkForm.controls.isActive.markAsDirty())}isLinkIsExpired(e){if(e==null){if(this.linkIsExpired=!1,e===null)return;this.linkForm.controls.expiresAt.setValue(null)}this.linkIsExpired=he()>=e}mustIncludePassword(){return!!this.password.length&&this.password!==this.defaultPassword}};r.\u0275fac=function(n){return new(n||r)},r.\u0275cmp=W({type:r,selectors:[["app-link-dialog"]],inputs:{share:"share",parentSpaceId:"parentSpaceId",link:"link",file:"file",isSharesRepo:"isSharesRepo",inSharesList:"inSharesList"},outputs:{submitEvent:"submitEvent",shareChange:"shareChange"},decls:73,vars:52,consts:[[1,"modal-header","align-items-center"],[1,"modal-title"],[1,"me-2",3,"icon"],[1,"modal-title","ms-auto"],["l10nTranslate",""],["aria-label","Close","type","button",1,"btn-close","btn-close-white","ms-2",3,"click"],[1,"modal-body"],["autocomplete","off",3,"formGroup"],[1,"d-flex"],[1,"d-flex","flex-column","flex-grow-1"],[1,"d-flex","align-items-center","cursor-pointer","py-2",3,"mouseover","mouseleave","focus","click"],["for","link","l10nTranslate",""],["id","link",1,"ms-auto"],[1,"d-flex","align-items-center","py-2"],["for","state","l10nTranslate","",1,"cursor-pointer","me-auto"],[1,"d-flex","align-items-center","form-check","form-switch","cursor-pointer"],["id","state","formControlName","isActive","type","checkbox","role","button",1,"form-check-input"],["for","access","l10nTranslate",""],["id","access",1,"ms-auto"],[3,"class"],[1,"badge","rounded-pill","bg-success"],[1,"d-flex","align-items-center"],["for","guestName","l10nTranslate",""],["id","guestName","formControlName","name","type","text",1,"form-control","form-control-sm","ms-auto","w-50",3,"placeholder"],[1,"d-flex","align-items-center","justify-content-between","px-0"],["for","guestEmail","l10nTranslate",""],["id","guestEmail","autocomplete","off","formControlName","email","type","email",1,"form-control","form-control-sm","ms-auto","w-50",3,"placeholder"],[1,"d-flex","align-items-center","justify-content-between"],["for","guestLanguage","l10nTranslate",""],["id","guestLanguage","formControlName","language",1,"form-control","form-select","form-select-sm","ms-auto","w-50"],[3,"ngValue"],["for","limitAccess","l10nTranslate",""],["id","limitAccess","formControlName","limitAccess","min","1","type","number",1,"form-control","form-control-sm","ms-auto","w-50",3,"placeholder"],["for","expiration","l10nTranslate",""],["id","expiration","formControlName","expiresAt","placement","left","type","text","bsDatepicker","",1,"form-control","form-control-sm","ms-auto","w-50",3,"placeholder","bsConfig"],[1,"d-flex","align-items-center","px-0"],["for","requireAuth","translate","",1,"cursor-pointer","me-auto"],[1,"d-flex","align-items-center","d-none","d-sm-flex","mx-auto"],["id","requireAuth","formControlName","requireAuth","type","checkbox","role","button",1,"form-check-input"],["placeholder","Set a password",2,"width","45%",3,"passwordChange","isRequired","disabled","passwordMinLength","password","showGenerator"],[1,"modal-footer"],["type","button","l10nTranslate","",1,"btn","btn-sm","btn-danger",3,"disabled"],["data-dismiss","modal","type","button","l10nTranslate","",1,"btn","btn-sm","btn-secondary","ms-auto",3,"click"],["type","button","l10nTranslate","",3,"click","disabled"],[1,"d-flex","flex-fill","align-items-center"],[1,"circle-primary-icon","me-2",3,"icon"],[1,"d-flex","flex-column"],[1,"fs-xxxs"],[1,"d-flex","ms-auto"],["container","body","type","button",3,"click","tooltip"],["size","lg",3,"icon"],[1,"d-flex","align-items-center","d-none","d-sm-flex","py-2"],[1,"my-2"],["btnCheckbox","","type","button",1,"btn","btn-sm","btn-custom","me-0","ms-2",3,"ngModelChange","ngModel","tooltip"],[1,"vr","mx-2"],["id","file",3,"share","showIcon","showFullPath"],["for","shareName","l10nTranslate",""],["id","shareName","formControlName","shareName","type","email",1,"form-control","form-control-sm","ms-auto","w-50",3,"placeholder"],["for","shareDescription","l10nTranslate",""],["id","shareDescription","formControlName","shareDescription","type","email",1,"form-control","form-control-sm","ms-auto","w-50",3,"placeholder"],[3,"passwordToCheck"],["type","button","l10nTranslate","",1,"btn","btn-sm","btn-danger",3,"click","disabled"]],template:function(n,t){n&1&&(s(0,"div",0)(1,"h4",1),d(2,"fa-icon",2),s(3,"span"),p(4),a()(),s(5,"h4",3),_(6,Kt,2,0,"span",4)(7,qt,2,0,"span",4),a(),s(8,"button",5),w("click",function(){return t.layout.closeDialog()}),a()(),s(9,"div",6),_(10,Yt,17,21),s(11,"form",7)(12,"div",8)(13,"div",9)(14,"div",10),w("mouseover",function(){return t.linkIsHovered=!0})("mouseleave",function(){return t.linkIsHovered=!1})("focus",function(){return t.linkIsHovered=!0})("click",function(){return t.copyToClipboard()}),s(15,"label",11),p(16,"Link"),a(),s(17,"span",12),p(18),a()(),s(19,"div",13)(20,"label",14),p(21,"Active"),a(),s(22,"div",15),d(23,"input",16),s(24,"span"),p(25),C(26,"translate"),a()()(),s(27,"div",13)(28,"label",17),p(29,"Current access count"),a(),s(30,"span",18),_(31,Xt,2,5,"span",19)(32,zt,2,1,"span",20),a()(),_(33,Qt,10,10),s(34,"div",21)(35,"label",22),p(36,"Guest name"),a(),d(37,"input",23),C(38,"translate"),a(),s(39,"div",24)(40,"label",25),p(41,"Guest email"),a(),d(42,"input",26),C(43,"translate"),a(),s(44,"div",27)(45,"label",28),p(46,"Guest language"),a(),s(47,"select",29),se(48,Jt,2,2,"option",30,Ie),a()(),s(50,"div",27)(51,"label",31),p(52,"Limit access"),a(),d(53,"input",32),C(54,"translate"),a(),s(55,"div",27)(56,"label",33),p(57,"Expiration"),a(),d(58,"input",34),C(59,"translate"),a(),s(60,"div",35)(61,"label",36),p(62,"Password"),a(),_(63,ei,2,1,"div",37),s(64,"div",15),d(65,"input",38),a(),s(66,"app-input-password",39),pe("passwordChange",function(g){return ce(t.password,g)||(t.password=g),g}),a()()()()()(),s(67,"div",40),_(68,ti,2,1,"button",41),s(69,"button",42),w("click",function(){return t.onCancel()}),p(70,"Cancel"),a(),s(71,"button",43),w("click",function(){return t.onSubmit()}),p(72),a()()),n&2&&(l(2),m("icon",t.icons.links),l(2),$(t.linkForm.value.name||t.linkForm.value.shareName),l(2),k(t.share!=null&&t.share.id||t.link!=null&&t.link.id?6:7),l(4),k(t.share||t.link?10:-1),l(),m("formGroup",t.linkForm),l(6),K("text-primary",t.linkIsHovered),l(),D(" ",t.share?t.share.link.uuid:t.link.uuid," "),l(6),x(O("badge rounded-pill ms-3 ",t.linkForm.value.isActive?"bg-primary":"bg-danger")),l(),D(" ",v(26,35,t.linkForm.value.isActive?"yes":"no",t.locale.language)," "),l(6),k(t.linkForm.value.limitAccess?31:32),l(2),k(t.share?33:-1),l(4),m("placeholder",v(38,38,"Guest name",t.locale.language)),l(5),K("is-invalid",t.linkForm.controls.email.invalid),m("placeholder",v(43,41,"Guest email",t.locale.language)),l(6),ae(t.languages),l(5),m("placeholder",v(54,44,"Unlimited",t.locale.language)),l(5),K("text-danger",t.linkIsExpired),m("placeholder",v(59,47,"Unlimited",t.locale.language))("bsConfig",Le(50,Ut,t.minDate)),l(5),k(t.linkForm.value.requireAuth&&t.password!==t.defaultPassword?63:-1),l(3),m("isRequired",t.linkForm.value.requireAuth)("disabled",!t.linkForm.value.requireAuth)("passwordMinLength",t.passwordMinLength),le("password",t.password),m("showGenerator",!0),l(2),k(t.share!=null&&t.share.id?68:-1),l(3),x(O("btn btn-sm ",t.confirmDeletion?"btn-danger":"btn-primary")),m("disabled",t.linkForm.invalid||t.linkForm.controls.requireAuth.value&&t.password.length<t.passwordMinLength||t.submitted),l(),D(" ",t.confirmDeletion?"Confirm deletion":"Confirm"," "))},dependencies:[X,We,ze,Ye,Xe,_t,gt,qe,Me,Ue,Ve,Ne,$e,De,He,Re,Pe,Ke,Fe,Ct,Ze,Ge,je,Oe,Be,At,vt,Te,J],encapsulation:2});let o=r;return o})();export{Rt as a,At as b,Lt as c,ne as d,Pt as e};
@@ -1,4 +1,4 @@
1
- import{f as _e,g as Ce}from"./chunk-2AC4RLMK.js";import{f as ge}from"./chunk-3SC36MTD.js";import{Mb as fe,Rb as z,ua as me,xb as he}from"./chunk-4GYSKJJC.js";import{$b as Z,Cb as h,Dc as Y,Eb as c,Fa as E,Fd as ae,J as L,Jd as le,Lb as D,Ma as r,N as R,Nb as y,Ob as J,Pb as m,Qb as k,Re as pe,Tb as F,Ub as V,Vb as G,Xa as M,Xb as K,Xc as ee,Za as U,Zb as X,Zc as P,_c as te,ab as w,ac as $,ad as ie,ba as I,bb as x,bf as de,dc as A,ed as ne,fc as H,ha as O,hc as j,jb as f,jd as oe,kb as g,lb as q,ma as C,na as v,nb as B,ob as Q,of as ue,pb as d,pe as ce,qb as l,rb as a,sb as _,wd as se,xd as re,ya as W,yb as T,zb as b}from"./chunk-JQOMI5VI.js";var be=function(i){return i[i.USER=0]="USER",i[i.PERSONAL=1]="PERSONAL",i}(be||{}),ye=function(i){return i[i.VISIBLE=0]="VISIBLE",i[i.PRIVATE=1]="PRIVATE",i[i.ISOLATED=2]="ISOLATED",i}(ye||{});function ke(i,n){if(i&1&&(l(0,"span"),m(1),a()),i&2){let s=c();r(),k(s.group.name)}}function Se(i,n){i&1&&(l(0,"span",3),m(1,"New personal group"),a())}function Me(i,n){if(i&1&&_(0,"fa-icon",4),i&2){let s=c();d("icon",s.icons.faSpinner)}}function we(i,n){i&1&&(l(0,"span",3),m(1,"Edit personal group"),a())}function Pe(i,n){i&1&&(l(0,"span",3),m(1,"Edit group"),a())}function Ee(i,n){if(i&1&&(l(0,"h4",5),f(1,we,2,0,"span",3)(2,Pe,2,0,"span",3),a()),i&2){let s=c();r(),g(s.isPersonalGroup?1:2)}}var st=(()=>{let n=class n{constructor(){this.groupChange=new x,this.layout=O(he),this.icons={GROUPS:me.GROUPS,faSpinner:de,faCog:pe,faUsers:ce,faPen:ue},this.isPersonalGroup=!0,this.submitted=!1,this.loading=!1,this.userService=O(ge),this.user=this.userService.user}ngOnInit(){this.originalGroup?.id?(this.isPersonalGroup=this.originalGroup.isPersonalGroup,this.group=new z({id:this.originalGroup.id,name:this.originalGroup.name,description:this.originalGroup.description,createdAt:this.originalGroup.createdAt,modifiedAt:this.originalGroup.modifiedAt,type:this.originalGroup.type})):this.group=new z({id:0,name:"",description:"",createdAt:null,modifiedAt:null,type:fe.PGROUP})}onCancel(){this.layout.closeDialog()}onSubmit(){if(this.loading=!0,this.submitted=!0,this.group.id===0)this.userService.createPersonalGroup(this.makeDto(!0)).subscribe({next:e=>{this.loading=!1,this.groupChange.emit(["add",e]),this.layout.sendNotification("success","Group created",e.name),this.layout.closeDialog()},error:e=>this.onError(e)});else{let e=this.makeDto();if(!Object.keys(e).length){this.loading=!1,this.submitted=!1;return}this.userService.updatePersonalGroup(this.originalGroup.id,this.makeDto()).subscribe({next:t=>{this.loading=!1,this.groupChange.emit(["update",t]),this.layout.sendNotification("success","Group updated",t.name),this.layout.closeDialog()},error:t=>this.onError(t)})}}makeDto(e=!1){return{name:e?this.group.name:this.group.name!==this.originalGroup.name?this.group.name:void 0,description:e?this.group.description:this.group.description!==this.originalGroup.description?this.group.description:void 0}}onError(e){this.layout.sendNotification("error","Group error",this.group.name,e),this.submitted=!1,this.loading=!1}};n.\u0275fac=function(t){return new(t||n)},n.\u0275cmp=M({type:n,selectors:[["app-user-group-dialog"]],inputs:{originalGroup:"originalGroup"},outputs:{groupChange:"groupChange"},decls:23,vars:15,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"],[1,"d-flex","col-12","pb-3"],[1,"flex-fill","col-6","pe-4"],["for","name","l10nTranslate",""],["id","name","appAutofocus","","autocomplete","off","type","text",1,"form-control","form-control-sm",3,"ngModelChange","disabled","autoSelect","ngModel"],[1,"flex-fill","col-6","ps-4"],["for","description","l10nTranslate",""],["id","description","autocomplete","off","type","text",1,"form-control","form-control-sm",3,"ngModelChange","ngModel","disabled"],[1,"modal-footer"],["data-dismiss","modal","type","button","l10nTranslate","",1,"btn","btn-sm","btn-secondary","ms-auto",3,"click"],["type","button","l10nTranslate","",1,"btn","btn-sm","btn-primary",3,"click","disabled"]],template:function(t,o){t&1&&(l(0,"div",0)(1,"h4",1),_(2,"fa-icon",2),f(3,ke,2,1,"span")(4,Se,2,0,"span",3),f(5,Me,1,1,"fa-icon",4),a(),f(6,Ee,3,1,"h4",5),l(7,"button",6),h("click",function(){return o.layout.closeDialog()}),a()(),l(8,"div",7)(9,"div",8)(10,"div",9)(11,"label",10),m(12,"Name"),a(),l(13,"input",11),G("ngModelChange",function(u){return V(o.group.name,u)||(o.group.name=u),u}),a()(),l(14,"div",12)(15,"label",13),m(16,"Description"),a(),l(17,"input",14),G("ngModelChange",function(u){return V(o.group.description,u)||(o.group.description=u),u}),a()()()(),l(18,"div",15)(19,"button",16),h("click",function(){return o.onCancel()}),m(20,"Cancel"),a(),l(21,"button",17),h("click",function(){return o.onSubmit()}),m(22," Confirm "),a()()),t&2&&(r(2),d("icon",o.icons.GROUPS),r(),g(o.group.id?3:4),r(2),g(o.loading?5:-1),r(),g(o.group.id?6:-1),r(),J(K("btn-close btn-close-white ",o.group.id?"ms-2":"ms-auto"," ms-2")),r(6),y("is-invalid",!o.group.name),d("disabled",!o.isPersonalGroup)("autoSelect",!1),F("ngModel",o.group.name),r(4),F("ngModel",o.group.description),d("disabled",!o.isPersonalGroup),r(4),d("disabled",!o.group.name||o.submitted))},dependencies:[re,ie,ne,se,oe,P,ae,_e],encapsulation:2});let i=n;return i})();var xe=(()=>{let n=class n{onClick(e){e.stopPropagation()}ngOnInit(){setTimeout(()=>{typeof document<"u"&&document.addEventListener("click",this.offClickHandler)},0)}ngOnDestroy(){typeof document<"u"&&document.removeEventListener("click",this.offClickHandler)}};n.\u0275fac=function(t){return new(t||n)},n.\u0275dir=U({type:n,selectors:[["","offClick",""]],hostBindings:function(t,o){t&1&&h("click",function(u){return o.onClick(u)})},inputs:{offClickHandler:[0,"offClick","offClickHandler"]}});let i=n;return i})();var S=class{constructor(n){typeof n=="string"&&(this.id=this.name=n,this.description=""),typeof n=="object"&&(this.id=n.id||n.name,this.name=n.name,this.description=n.description||"")}};var Te=i=>({active:i}),De=(i,n)=>({o:i,i:n});function Fe(i,n){if(i&1){let s=b();l(0,"input",6),h("keydown",function(t){C(s);let o=c();return v(o.inputEvent(t))})("keyup",function(t){C(s);let o=c();return v(o.inputEvent(t,!0))}),a()}if(i&2){let s=c();d("disabled",s.disabled)}}function Ve(i,n){i&1&&T(0)}function Ge(i,n){if(i&1&&(l(0,"span",12),w(1,Ve,1,0,"ng-container",13),a()),i&2){let s=c(2),e=D(6);y("ui-select-allow-clear",s.allowClear&&s.active),r(),d("ngTemplateOutlet",s.customTemplateSelect||e)("ngTemplateOutletContext",Z(4,Te,s.active))}}function Ae(i,n){if(i&1&&(l(0,"span",9),m(1),a()),i&2){let s=c(2);r(),k(s.placeholder)}}function He(i,n){if(i&1){let s=b();l(0,"button",14),h("click",function(t){C(s);let o=c(2);return v(o.removeClick(o.active,t))}),a()}}function je(i,n){if(i&1){let s=b();l(0,"div",4)(1,"span",7),h("click",function(t){C(s);let o=c();return v(o.matchClick(t))}),f(2,Ge,2,6,"span",8)(3,Ae,2,1,"span",9),f(4,He,1,0,"button",10),_(5,"i",11),a()()}if(i&2){let s=c();r(2),g(s.active?2:3),r(2),g(s.allowClear&&s.active?4:-1)}}function ze(i,n){i&1&&T(0)}function Ne(i,n){if(i&1){let s=b();l(0,"li",15)(1,"div",16),h("click",function(t){let o=C(s).$implicit,p=c(2);return v(p.selectMatch(o,t))})("mouseenter",function(){let t=C(s).$implicit,o=c(2);return v(o.selectActive(t))}),w(2,ze,1,0,"ng-container",13),a()()}if(i&2){let s=n.$implicit,e=c(2),t=D(8);r(),y("active",e.isActive(s)),r(),d("ngTemplateOutlet",e.customTemplateOptions||t)("ngTemplateOutletContext",$(4,De,s,e.inputValue))}}function Le(i,n){if(i&1&&(l(0,"ul",5),B(1,Ne,3,7,"li",15,q),a()),i&2){let s=c();r(),Q(s.options)}}function Re(i,n){if(i&1&&(l(0,"div",17)(1,"span",18),_(2,"fa-icon",19),a(),l(3,"span"),m(4),a(),l(5,"div",20),m(6),a()()),i&2){let s=n.active,e=c();r(2),d("icon",e.itemIcon)("fixedWidth",!1),r(2),k(s.name),r(2),k(s.description)}}function Ie(i,n){if(i&1&&(l(0,"a",21)(1,"div",17)(2,"span",18),_(3,"fa-icon",19),a(),_(4,"span",22),A(5,"highlight"),_(6,"span",23),A(7,"highlight"),a()()),i&2){let s=n.i,e=n.o,t=c();r(3),d("icon",t.itemIcon)("fixedWidth",!1),r(),d("innerHtml",t.sanitize(H(5,4,e.name,s)),E),r(2),d("innerHtml",t.sanitize(H(7,7,e.description,s)),E)}}var bt=(()=>{let n=class n{constructor(){this.element=O(W),this.itemIcon=le,this.allowClear=!0,this.placeholder="",this.idField="id",this.nameField="name",this.descriptionField="description",this.data=new x,this.selected=new x,this.removed=new x,this.typed=new x,this.opened=new x,this.options=[],this.itemObjects=[],this.inputMode=!1,this.inputValue="",this.onChange=Function.prototype,this.onTouched=Function.prototype,this.sanitizer=O(ee),this._items=[],this._optionsOpened=!1,this._disabled=!1,this._active=null,this.clickedOutside=this.clickedOutside.bind(this)}set items(e){if(!e.length){this._items=this.itemObjects=[],this.itemObjects=[];return}this._items=e.filter(t=>{if(typeof t=="string"||typeof t=="object"&&t&&t[this.nameField]&&t[this.idField])return t}),this.itemObjects=this._items.map(t=>typeof t=="string"?new S(t):new S({id:t[this.idField],name:t[this.nameField],description:t[this.descriptionField]}))}get optionsOpened(){return this._optionsOpened}set optionsOpened(e){this._optionsOpened=e,this.opened.emit(e)}get disabled(){return this._disabled}set disabled(e){this._disabled=e,this._disabled===!0&&this.hideOptions()}get active(){return this._active}set active(e){e?this._active=typeof e=="string"?e:new S({id:e[this.idField],name:e[this.nameField],description:e[this.descriptionField]}):this._active=null}sanitize(e){return this.sanitizer.bypassSecurityTrustHtml(e)}inputEvent(e,t=!1){if(e.keyCode===9)return;if(t&&(e.keyCode===37||e.keyCode===39||e.keyCode===38||e.keyCode===40||e.keyCode===13)){e.preventDefault();return}if(!t&&e.keyCode===8){let p=this.element.nativeElement.querySelector("div.ui-select-container > input");(!p.value||p.value.length<=0)&&(this.active&&this.remove(this.active),e.preventDefault())}if(!t&&e.keyCode===27){this.hideOptions(),e.preventDefault();return}if(!t&&e.keyCode===46&&(this.active&&this.remove(this.active),e.preventDefault()),!t&&e.keyCode===37&&this._items.length>0){this.behavior.first(),e.preventDefault();return}if(!t&&e.keyCode===39&&this._items.length>0){this.behavior.last(),e.preventDefault();return}if(!t&&e.keyCode===38){this.behavior.prev(),e.preventDefault();return}if(!t&&e.keyCode===40){this.behavior.next(),e.preventDefault();return}if(!t&&e.keyCode===13){(!this.active||this.active.id!==this.activeOption.id)&&(this.selectActiveMatch(),this.behavior.next()),e.preventDefault();return}let o=e.target||e.srcElement;o?(this.inputValue=o.value,this.doEvent("typed",this.inputValue||" ")):this.open()}ngOnInit(){this.subscription=this.typed.asObservable().pipe(L(200),R()).subscribe(e=>this.doSearch(e)),this.behavior=new N(this),this.doEvent("typed"," ")}ngOnDestroy(){this.subscription.unsubscribe()}remove(e){this._disabled!==!0&&(this.active=null,this.data.next(this.active),this.doEvent("removed",e),this.inputValue="",this.doEvent("typed"," "))}doEvent(e,t){this[e]&&t&&this[e].next(t),this.onTouched(),(e==="selected"||e==="removed")&&this.onChange(this.active)}clickedOutside(){this.inputMode=!1,this.optionsOpened=!1}writeValue(e){this.active=e,this.data.emit(this.active)}registerOnChange(e){this.onChange=e}registerOnTouched(e){this.onTouched=e}matchClick(e){this._disabled!==!0&&(this.inputMode=!this.inputMode,this.inputMode===!0&&(this.focusToInput(),this.open()))}mainClick(e){if(this.inputMode===!0||this._disabled===!0)return;if(e.keyCode===46){e.preventDefault(),this.inputEvent(e);return}if(e.keyCode===8){e.preventDefault(),this.inputEvent(e,!0);return}if(e.keyCode===9||e.keyCode===13||e.keyCode===27||e.keyCode>=37&&e.keyCode<=40){e.preventDefault();return}this.inputMode=!0;let t=String.fromCharCode(96<=e.keyCode&&e.keyCode<=105?e.keyCode-48:e.keyCode).toLowerCase();this.focusToInput(t),this.open();let o=e.target||e.srcElement;o.value=t,this.inputEvent(e)}selectActive(e){this.activeOption=e}isActive(e){return this.activeOption.id===e.id}removeClick(e,t){t.stopPropagation(),this.remove(e)}focusToInput(e=""){setTimeout(()=>{let t=this.element.nativeElement.querySelector("div.ui-select-container > input");t&&(t.focus(),t.value=e)},0)}selectMatch(e,t=void 0){t&&(t.stopPropagation(),t.preventDefault()),!(this.options.length<=0)&&(this.active=e,this.data.next(this.active),this.doEvent("selected",e),this.hideOptions(),this.focusToInput(e.name),this.element.nativeElement.querySelector(".ui-select-container").focus())}doSearch(e){this.searchFunction(e).subscribe({next:t=>{this.items=t},error:t=>{console.error(t),this.items=[]},complete:()=>this.behavior.filter()})}open(){this.options=this.itemObjects,this.options.length>0&&this.behavior.first(),this.optionsOpened=!0}hideOptions(){this.inputMode=!1,this.optionsOpened=!1}selectActiveMatch(){this.selectMatch(this.activeOption)}};n.\u0275fac=function(t){return new(t||n)},n.\u0275cmp=M({type:n,selectors:[["app-select"]],inputs:{searchFunction:"searchFunction",customTemplateOptions:"customTemplateOptions",customTemplateSelect:"customTemplateSelect",itemIcon:"itemIcon",allowClear:"allowClear",placeholder:"placeholder",idField:"idField",nameField:"nameField",descriptionField:"descriptionField",disabled:"disabled",active:"active"},outputs:{data:"data",selected:"selected",removed:"removed",typed:"typed",opened:"opened"},features:[X([{provide:te,useExisting:I(()=>n),multi:!0}])],decls:9,vars:5,consts:[["DefaultSelect",""],["DefaultOptions",""],[1,"ui-select-container","dropdown","open",3,"keyup","offClick"],["autocomplete","false","tabindex","-1","type","text",1,"form-control","form-control-sm","ui-select-search",3,"disabled"],[1,"ui-select-match","form-control","form-control-sm"],["role","menu",1,"ui-select-choices","dropdown-menu"],["autocomplete","false","tabindex","-1","type","text",1,"form-control","form-control-sm","ui-select-search",3,"keydown","keyup","disabled"],["tabindex","-1",1,"ui-select-toggle","no-select",2,"outline","0",3,"click"],[1,"ui-select-match-text","w-100",3,"ui-select-allow-clear"],[1,"ui-select-placeholder"],["aria-label","close","type","button",1,"btn-close"],[1,"dropdown-toggle"],[1,"ui-select-match-text","w-100"],[4,"ngTemplateOutlet","ngTemplateOutletContext"],["aria-label","close","type","button",1,"btn-close",3,"click"],["role","menuitem"],[1,"ui-select-choices-row",3,"click","mouseenter"],[1,"d-flex","align-items-center"],[1,"ui-icon","circle-primary-icon","me-2"],[3,"icon","fixedWidth"],[1,"d-flex","ms-auto","me-4","fs-xxxs","text-muted"],["href","javascript:void(0)",1,"dropdown-item","cursor-pointer",2,"padding","3px 5px"],[3,"innerHtml"],[1,"d-flex","ms-auto","fs-xxxs","text-muted",3,"innerHtml"]],template:function(t,o){if(t&1){let p=b();l(0,"div",2),h("keyup",function(Oe){return C(p),v(o.mainClick(Oe))}),_(1,"div"),f(2,Fe,1,1,"input",3)(3,je,6,2,"div",4),f(4,Le,3,0,"ul",5),a(),w(5,Re,7,4,"ng-template",null,0,j)(7,Ie,8,10,"ng-template",null,1,j)}t&2&&(d("offClick",o.clickedOutside),r(),y("ui-disabled",o.disabled),r(),g(o.inputMode?2:3),r(2),g(o.optionsOpened&&o.options&&o.options.length>0?4:-1))},dependencies:[xe,P,Y,Ce],styles:[`.ui-select-container[_ngcontent-%COMP%]{background-color:transparent;border-radius:4px}.ui-select-container.open[_ngcontent-%COMP%] > .dropdown-menu[_ngcontent-%COMP%]{display:block}.ui-select-container.open[_ngcontent-%COMP%] > a[_ngcontent-%COMP%]{outline:none}.ui-select-container[_ngcontent-%COMP%] .ui-icon[_ngcontent-%COMP%]{min-width:26px;min-height:26px;font-size:.85rem}.ui-select-container[_ngcontent-%COMP%] .ui-disabled[_ngcontent-%COMP%]{background-color:#d4dbe8;border-radius:4px;position:absolute;width:100%;height:100%;z-index:5;opacity:.6;top:0;left:0;cursor:not-allowed}.ui-select-container[_ngcontent-%COMP%] .ui-select-search[_ngcontent-%COMP%]{line-height:26px}.ui-select-container[_ngcontent-%COMP%] .ui-select-match[_ngcontent-%COMP%]{padding-left:.3rem}.ui-select-container[_ngcontent-%COMP%] .ui-select-match[_ngcontent-%COMP%] .btn[_ngcontent-%COMP%]{text-align:start!important}.ui-select-container[_ngcontent-%COMP%] .ui-select-match[_ngcontent-%COMP%] .caret[_ngcontent-%COMP%]{position:absolute;top:45%;right:15px}.ui-select-container[_ngcontent-%COMP%] .ui-select-match[_ngcontent-%COMP%] .close[_ngcontent-%COMP%]{font-size:1.6em;line-height:.75}.ui-select-container[_ngcontent-%COMP%] .ui-select-match[_ngcontent-%COMP%] .ui-select-toggle[_ngcontent-%COMP%]{display:flex;align-items:center}.ui-select-container[_ngcontent-%COMP%] .ui-select-match[_ngcontent-%COMP%] .ui-select-toggle[_ngcontent-%COMP%] > .caret[_ngcontent-%COMP%]{position:absolute;height:10px;top:50%;right:10px;margin-top:-2px}.ui-select-container[_ngcontent-%COMP%] .ui-select-match[_ngcontent-%COMP%] .ui-select-placeholder[_ngcontent-%COMP%]{float:left;line-height:26px;color:#8c8c8c;width:100%}.ui-select-container[_ngcontent-%COMP%] .ui-select-match[_ngcontent-%COMP%] .dropdown-toggle[_ngcontent-%COMP%]{cursor:pointer}.ui-select-container[_ngcontent-%COMP%] .ui-select-match[_ngcontent-%COMP%] .dropdown-toggle[_ngcontent-%COMP%]:after{display:inline-block!important}.ui-select-container[_ngcontent-%COMP%] .ui-select-choices[_ngcontent-%COMP%]{width:100%;height:auto;max-height:200px;overflow-x:hidden;margin-top:0}.ui-select-container[_ngcontent-%COMP%] .ui-select-choices[_ngcontent-%COMP%] .ui-select-choices-row[_ngcontent-%COMP%] > a[_ngcontent-%COMP%]{display:block;padding:3px 5px;clear:both;font-weight:400;line-height:1.42857143;color:#333;white-space:nowrap}.ui-select-container[_ngcontent-%COMP%] .ui-select-choices[_ngcontent-%COMP%] .ui-select-choices-row[_ngcontent-%COMP%] .active[_ngcontent-%COMP%] > a[_ngcontent-%COMP%]{text-decoration:none;outline:0}.ui-select-container[_ngcontent-%COMP%] .ui-select-choices[_ngcontent-%COMP%] .ui-select-choices-row[_ngcontent-%COMP%] .dropdown-item[_ngcontent-%COMP%] > div[_ngcontent-%COMP%]{pointer-events:none}
1
+ import{f as _e,g as Ce}from"./chunk-BOIXDTUT.js";import{f as ge}from"./chunk-6HV65OKG.js";import{Mb as fe,Rb as z,ua as me,xb as he}from"./chunk-55WOZ7P6.js";import{$b as Z,Cb as h,Dc as Y,Eb as c,Fa as E,Fd as ae,J as L,Jd as le,Lb as D,Ma as r,N as R,Nb as y,Ob as J,Pb as m,Qb as k,Re as pe,Tb as F,Ub as V,Vb as G,Xa as M,Xb as K,Xc as ee,Za as U,Zb as X,Zc as P,_c as te,ab as w,ac as $,ad as ie,ba as I,bb as x,bf as de,dc as A,ed as ne,fc as H,ha as O,hc as j,jb as f,jd as oe,kb as g,lb as q,ma as C,na as v,nb as B,ob as Q,of as ue,pb as d,pe as ce,qb as l,rb as a,sb as _,wd as se,xd as re,ya as W,yb as T,zb as b}from"./chunk-JQOMI5VI.js";var be=function(i){return i[i.USER=0]="USER",i[i.PERSONAL=1]="PERSONAL",i}(be||{}),ye=function(i){return i[i.VISIBLE=0]="VISIBLE",i[i.PRIVATE=1]="PRIVATE",i[i.ISOLATED=2]="ISOLATED",i}(ye||{});function ke(i,n){if(i&1&&(l(0,"span"),m(1),a()),i&2){let s=c();r(),k(s.group.name)}}function Se(i,n){i&1&&(l(0,"span",3),m(1,"New personal group"),a())}function Me(i,n){if(i&1&&_(0,"fa-icon",4),i&2){let s=c();d("icon",s.icons.faSpinner)}}function we(i,n){i&1&&(l(0,"span",3),m(1,"Edit personal group"),a())}function Pe(i,n){i&1&&(l(0,"span",3),m(1,"Edit group"),a())}function Ee(i,n){if(i&1&&(l(0,"h4",5),f(1,we,2,0,"span",3)(2,Pe,2,0,"span",3),a()),i&2){let s=c();r(),g(s.isPersonalGroup?1:2)}}var st=(()=>{let n=class n{constructor(){this.groupChange=new x,this.layout=O(he),this.icons={GROUPS:me.GROUPS,faSpinner:de,faCog:pe,faUsers:ce,faPen:ue},this.isPersonalGroup=!0,this.submitted=!1,this.loading=!1,this.userService=O(ge),this.user=this.userService.user}ngOnInit(){this.originalGroup?.id?(this.isPersonalGroup=this.originalGroup.isPersonalGroup,this.group=new z({id:this.originalGroup.id,name:this.originalGroup.name,description:this.originalGroup.description,createdAt:this.originalGroup.createdAt,modifiedAt:this.originalGroup.modifiedAt,type:this.originalGroup.type})):this.group=new z({id:0,name:"",description:"",createdAt:null,modifiedAt:null,type:fe.PGROUP})}onCancel(){this.layout.closeDialog()}onSubmit(){if(this.loading=!0,this.submitted=!0,this.group.id===0)this.userService.createPersonalGroup(this.makeDto(!0)).subscribe({next:e=>{this.loading=!1,this.groupChange.emit(["add",e]),this.layout.sendNotification("success","Group created",e.name),this.layout.closeDialog()},error:e=>this.onError(e)});else{let e=this.makeDto();if(!Object.keys(e).length){this.loading=!1,this.submitted=!1;return}this.userService.updatePersonalGroup(this.originalGroup.id,this.makeDto()).subscribe({next:t=>{this.loading=!1,this.groupChange.emit(["update",t]),this.layout.sendNotification("success","Group updated",t.name),this.layout.closeDialog()},error:t=>this.onError(t)})}}makeDto(e=!1){return{name:e?this.group.name:this.group.name!==this.originalGroup.name?this.group.name:void 0,description:e?this.group.description:this.group.description!==this.originalGroup.description?this.group.description:void 0}}onError(e){this.layout.sendNotification("error","Group error",this.group.name,e),this.submitted=!1,this.loading=!1}};n.\u0275fac=function(t){return new(t||n)},n.\u0275cmp=M({type:n,selectors:[["app-user-group-dialog"]],inputs:{originalGroup:"originalGroup"},outputs:{groupChange:"groupChange"},decls:23,vars:15,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"],[1,"d-flex","col-12","pb-3"],[1,"flex-fill","col-6","pe-4"],["for","name","l10nTranslate",""],["id","name","appAutofocus","","autocomplete","off","type","text",1,"form-control","form-control-sm",3,"ngModelChange","disabled","autoSelect","ngModel"],[1,"flex-fill","col-6","ps-4"],["for","description","l10nTranslate",""],["id","description","autocomplete","off","type","text",1,"form-control","form-control-sm",3,"ngModelChange","ngModel","disabled"],[1,"modal-footer"],["data-dismiss","modal","type","button","l10nTranslate","",1,"btn","btn-sm","btn-secondary","ms-auto",3,"click"],["type","button","l10nTranslate","",1,"btn","btn-sm","btn-primary",3,"click","disabled"]],template:function(t,o){t&1&&(l(0,"div",0)(1,"h4",1),_(2,"fa-icon",2),f(3,ke,2,1,"span")(4,Se,2,0,"span",3),f(5,Me,1,1,"fa-icon",4),a(),f(6,Ee,3,1,"h4",5),l(7,"button",6),h("click",function(){return o.layout.closeDialog()}),a()(),l(8,"div",7)(9,"div",8)(10,"div",9)(11,"label",10),m(12,"Name"),a(),l(13,"input",11),G("ngModelChange",function(u){return V(o.group.name,u)||(o.group.name=u),u}),a()(),l(14,"div",12)(15,"label",13),m(16,"Description"),a(),l(17,"input",14),G("ngModelChange",function(u){return V(o.group.description,u)||(o.group.description=u),u}),a()()()(),l(18,"div",15)(19,"button",16),h("click",function(){return o.onCancel()}),m(20,"Cancel"),a(),l(21,"button",17),h("click",function(){return o.onSubmit()}),m(22," Confirm "),a()()),t&2&&(r(2),d("icon",o.icons.GROUPS),r(),g(o.group.id?3:4),r(2),g(o.loading?5:-1),r(),g(o.group.id?6:-1),r(),J(K("btn-close btn-close-white ",o.group.id?"ms-2":"ms-auto"," ms-2")),r(6),y("is-invalid",!o.group.name),d("disabled",!o.isPersonalGroup)("autoSelect",!1),F("ngModel",o.group.name),r(4),F("ngModel",o.group.description),d("disabled",!o.isPersonalGroup),r(4),d("disabled",!o.group.name||o.submitted))},dependencies:[re,ie,ne,se,oe,P,ae,_e],encapsulation:2});let i=n;return i})();var xe=(()=>{let n=class n{onClick(e){e.stopPropagation()}ngOnInit(){setTimeout(()=>{typeof document<"u"&&document.addEventListener("click",this.offClickHandler)},0)}ngOnDestroy(){typeof document<"u"&&document.removeEventListener("click",this.offClickHandler)}};n.\u0275fac=function(t){return new(t||n)},n.\u0275dir=U({type:n,selectors:[["","offClick",""]],hostBindings:function(t,o){t&1&&h("click",function(u){return o.onClick(u)})},inputs:{offClickHandler:[0,"offClick","offClickHandler"]}});let i=n;return i})();var S=class{constructor(n){typeof n=="string"&&(this.id=this.name=n,this.description=""),typeof n=="object"&&(this.id=n.id||n.name,this.name=n.name,this.description=n.description||"")}};var Te=i=>({active:i}),De=(i,n)=>({o:i,i:n});function Fe(i,n){if(i&1){let s=b();l(0,"input",6),h("keydown",function(t){C(s);let o=c();return v(o.inputEvent(t))})("keyup",function(t){C(s);let o=c();return v(o.inputEvent(t,!0))}),a()}if(i&2){let s=c();d("disabled",s.disabled)}}function Ve(i,n){i&1&&T(0)}function Ge(i,n){if(i&1&&(l(0,"span",12),w(1,Ve,1,0,"ng-container",13),a()),i&2){let s=c(2),e=D(6);y("ui-select-allow-clear",s.allowClear&&s.active),r(),d("ngTemplateOutlet",s.customTemplateSelect||e)("ngTemplateOutletContext",Z(4,Te,s.active))}}function Ae(i,n){if(i&1&&(l(0,"span",9),m(1),a()),i&2){let s=c(2);r(),k(s.placeholder)}}function He(i,n){if(i&1){let s=b();l(0,"button",14),h("click",function(t){C(s);let o=c(2);return v(o.removeClick(o.active,t))}),a()}}function je(i,n){if(i&1){let s=b();l(0,"div",4)(1,"span",7),h("click",function(t){C(s);let o=c();return v(o.matchClick(t))}),f(2,Ge,2,6,"span",8)(3,Ae,2,1,"span",9),f(4,He,1,0,"button",10),_(5,"i",11),a()()}if(i&2){let s=c();r(2),g(s.active?2:3),r(2),g(s.allowClear&&s.active?4:-1)}}function ze(i,n){i&1&&T(0)}function Ne(i,n){if(i&1){let s=b();l(0,"li",15)(1,"div",16),h("click",function(t){let o=C(s).$implicit,p=c(2);return v(p.selectMatch(o,t))})("mouseenter",function(){let t=C(s).$implicit,o=c(2);return v(o.selectActive(t))}),w(2,ze,1,0,"ng-container",13),a()()}if(i&2){let s=n.$implicit,e=c(2),t=D(8);r(),y("active",e.isActive(s)),r(),d("ngTemplateOutlet",e.customTemplateOptions||t)("ngTemplateOutletContext",$(4,De,s,e.inputValue))}}function Le(i,n){if(i&1&&(l(0,"ul",5),B(1,Ne,3,7,"li",15,q),a()),i&2){let s=c();r(),Q(s.options)}}function Re(i,n){if(i&1&&(l(0,"div",17)(1,"span",18),_(2,"fa-icon",19),a(),l(3,"span"),m(4),a(),l(5,"div",20),m(6),a()()),i&2){let s=n.active,e=c();r(2),d("icon",e.itemIcon)("fixedWidth",!1),r(2),k(s.name),r(2),k(s.description)}}function Ie(i,n){if(i&1&&(l(0,"a",21)(1,"div",17)(2,"span",18),_(3,"fa-icon",19),a(),_(4,"span",22),A(5,"highlight"),_(6,"span",23),A(7,"highlight"),a()()),i&2){let s=n.i,e=n.o,t=c();r(3),d("icon",t.itemIcon)("fixedWidth",!1),r(),d("innerHtml",t.sanitize(H(5,4,e.name,s)),E),r(2),d("innerHtml",t.sanitize(H(7,7,e.description,s)),E)}}var bt=(()=>{let n=class n{constructor(){this.element=O(W),this.itemIcon=le,this.allowClear=!0,this.placeholder="",this.idField="id",this.nameField="name",this.descriptionField="description",this.data=new x,this.selected=new x,this.removed=new x,this.typed=new x,this.opened=new x,this.options=[],this.itemObjects=[],this.inputMode=!1,this.inputValue="",this.onChange=Function.prototype,this.onTouched=Function.prototype,this.sanitizer=O(ee),this._items=[],this._optionsOpened=!1,this._disabled=!1,this._active=null,this.clickedOutside=this.clickedOutside.bind(this)}set items(e){if(!e.length){this._items=this.itemObjects=[],this.itemObjects=[];return}this._items=e.filter(t=>{if(typeof t=="string"||typeof t=="object"&&t&&t[this.nameField]&&t[this.idField])return t}),this.itemObjects=this._items.map(t=>typeof t=="string"?new S(t):new S({id:t[this.idField],name:t[this.nameField],description:t[this.descriptionField]}))}get optionsOpened(){return this._optionsOpened}set optionsOpened(e){this._optionsOpened=e,this.opened.emit(e)}get disabled(){return this._disabled}set disabled(e){this._disabled=e,this._disabled===!0&&this.hideOptions()}get active(){return this._active}set active(e){e?this._active=typeof e=="string"?e:new S({id:e[this.idField],name:e[this.nameField],description:e[this.descriptionField]}):this._active=null}sanitize(e){return this.sanitizer.bypassSecurityTrustHtml(e)}inputEvent(e,t=!1){if(e.keyCode===9)return;if(t&&(e.keyCode===37||e.keyCode===39||e.keyCode===38||e.keyCode===40||e.keyCode===13)){e.preventDefault();return}if(!t&&e.keyCode===8){let p=this.element.nativeElement.querySelector("div.ui-select-container > input");(!p.value||p.value.length<=0)&&(this.active&&this.remove(this.active),e.preventDefault())}if(!t&&e.keyCode===27){this.hideOptions(),e.preventDefault();return}if(!t&&e.keyCode===46&&(this.active&&this.remove(this.active),e.preventDefault()),!t&&e.keyCode===37&&this._items.length>0){this.behavior.first(),e.preventDefault();return}if(!t&&e.keyCode===39&&this._items.length>0){this.behavior.last(),e.preventDefault();return}if(!t&&e.keyCode===38){this.behavior.prev(),e.preventDefault();return}if(!t&&e.keyCode===40){this.behavior.next(),e.preventDefault();return}if(!t&&e.keyCode===13){(!this.active||this.active.id!==this.activeOption.id)&&(this.selectActiveMatch(),this.behavior.next()),e.preventDefault();return}let o=e.target||e.srcElement;o?(this.inputValue=o.value,this.doEvent("typed",this.inputValue||" ")):this.open()}ngOnInit(){this.subscription=this.typed.asObservable().pipe(L(200),R()).subscribe(e=>this.doSearch(e)),this.behavior=new N(this),this.doEvent("typed"," ")}ngOnDestroy(){this.subscription.unsubscribe()}remove(e){this._disabled!==!0&&(this.active=null,this.data.next(this.active),this.doEvent("removed",e),this.inputValue="",this.doEvent("typed"," "))}doEvent(e,t){this[e]&&t&&this[e].next(t),this.onTouched(),(e==="selected"||e==="removed")&&this.onChange(this.active)}clickedOutside(){this.inputMode=!1,this.optionsOpened=!1}writeValue(e){this.active=e,this.data.emit(this.active)}registerOnChange(e){this.onChange=e}registerOnTouched(e){this.onTouched=e}matchClick(e){this._disabled!==!0&&(this.inputMode=!this.inputMode,this.inputMode===!0&&(this.focusToInput(),this.open()))}mainClick(e){if(this.inputMode===!0||this._disabled===!0)return;if(e.keyCode===46){e.preventDefault(),this.inputEvent(e);return}if(e.keyCode===8){e.preventDefault(),this.inputEvent(e,!0);return}if(e.keyCode===9||e.keyCode===13||e.keyCode===27||e.keyCode>=37&&e.keyCode<=40){e.preventDefault();return}this.inputMode=!0;let t=String.fromCharCode(96<=e.keyCode&&e.keyCode<=105?e.keyCode-48:e.keyCode).toLowerCase();this.focusToInput(t),this.open();let o=e.target||e.srcElement;o.value=t,this.inputEvent(e)}selectActive(e){this.activeOption=e}isActive(e){return this.activeOption.id===e.id}removeClick(e,t){t.stopPropagation(),this.remove(e)}focusToInput(e=""){setTimeout(()=>{let t=this.element.nativeElement.querySelector("div.ui-select-container > input");t&&(t.focus(),t.value=e)},0)}selectMatch(e,t=void 0){t&&(t.stopPropagation(),t.preventDefault()),!(this.options.length<=0)&&(this.active=e,this.data.next(this.active),this.doEvent("selected",e),this.hideOptions(),this.focusToInput(e.name),this.element.nativeElement.querySelector(".ui-select-container").focus())}doSearch(e){this.searchFunction(e).subscribe({next:t=>{this.items=t},error:t=>{console.error(t),this.items=[]},complete:()=>this.behavior.filter()})}open(){this.options=this.itemObjects,this.options.length>0&&this.behavior.first(),this.optionsOpened=!0}hideOptions(){this.inputMode=!1,this.optionsOpened=!1}selectActiveMatch(){this.selectMatch(this.activeOption)}};n.\u0275fac=function(t){return new(t||n)},n.\u0275cmp=M({type:n,selectors:[["app-select"]],inputs:{searchFunction:"searchFunction",customTemplateOptions:"customTemplateOptions",customTemplateSelect:"customTemplateSelect",itemIcon:"itemIcon",allowClear:"allowClear",placeholder:"placeholder",idField:"idField",nameField:"nameField",descriptionField:"descriptionField",disabled:"disabled",active:"active"},outputs:{data:"data",selected:"selected",removed:"removed",typed:"typed",opened:"opened"},features:[X([{provide:te,useExisting:I(()=>n),multi:!0}])],decls:9,vars:5,consts:[["DefaultSelect",""],["DefaultOptions",""],[1,"ui-select-container","dropdown","open",3,"keyup","offClick"],["autocomplete","false","tabindex","-1","type","text",1,"form-control","form-control-sm","ui-select-search",3,"disabled"],[1,"ui-select-match","form-control","form-control-sm"],["role","menu",1,"ui-select-choices","dropdown-menu"],["autocomplete","false","tabindex","-1","type","text",1,"form-control","form-control-sm","ui-select-search",3,"keydown","keyup","disabled"],["tabindex","-1",1,"ui-select-toggle","no-select",2,"outline","0",3,"click"],[1,"ui-select-match-text","w-100",3,"ui-select-allow-clear"],[1,"ui-select-placeholder"],["aria-label","close","type","button",1,"btn-close"],[1,"dropdown-toggle"],[1,"ui-select-match-text","w-100"],[4,"ngTemplateOutlet","ngTemplateOutletContext"],["aria-label","close","type","button",1,"btn-close",3,"click"],["role","menuitem"],[1,"ui-select-choices-row",3,"click","mouseenter"],[1,"d-flex","align-items-center"],[1,"ui-icon","circle-primary-icon","me-2"],[3,"icon","fixedWidth"],[1,"d-flex","ms-auto","me-4","fs-xxxs","text-muted"],["href","javascript:void(0)",1,"dropdown-item","cursor-pointer",2,"padding","3px 5px"],[3,"innerHtml"],[1,"d-flex","ms-auto","fs-xxxs","text-muted",3,"innerHtml"]],template:function(t,o){if(t&1){let p=b();l(0,"div",2),h("keyup",function(Oe){return C(p),v(o.mainClick(Oe))}),_(1,"div"),f(2,Fe,1,1,"input",3)(3,je,6,2,"div",4),f(4,Le,3,0,"ul",5),a(),w(5,Re,7,4,"ng-template",null,0,j)(7,Ie,8,10,"ng-template",null,1,j)}t&2&&(d("offClick",o.clickedOutside),r(),y("ui-disabled",o.disabled),r(),g(o.inputMode?2:3),r(2),g(o.optionsOpened&&o.options&&o.options.length>0?4:-1))},dependencies:[xe,P,Y,Ce],styles:[`.ui-select-container[_ngcontent-%COMP%]{background-color:transparent;border-radius:4px}.ui-select-container.open[_ngcontent-%COMP%] > .dropdown-menu[_ngcontent-%COMP%]{display:block}.ui-select-container.open[_ngcontent-%COMP%] > a[_ngcontent-%COMP%]{outline:none}.ui-select-container[_ngcontent-%COMP%] .ui-icon[_ngcontent-%COMP%]{min-width:26px;min-height:26px;font-size:.85rem}.ui-select-container[_ngcontent-%COMP%] .ui-disabled[_ngcontent-%COMP%]{background-color:#d4dbe8;border-radius:4px;position:absolute;width:100%;height:100%;z-index:5;opacity:.6;top:0;left:0;cursor:not-allowed}.ui-select-container[_ngcontent-%COMP%] .ui-select-search[_ngcontent-%COMP%]{line-height:26px}.ui-select-container[_ngcontent-%COMP%] .ui-select-match[_ngcontent-%COMP%]{padding-left:.3rem}.ui-select-container[_ngcontent-%COMP%] .ui-select-match[_ngcontent-%COMP%] .btn[_ngcontent-%COMP%]{text-align:start!important}.ui-select-container[_ngcontent-%COMP%] .ui-select-match[_ngcontent-%COMP%] .caret[_ngcontent-%COMP%]{position:absolute;top:45%;right:15px}.ui-select-container[_ngcontent-%COMP%] .ui-select-match[_ngcontent-%COMP%] .close[_ngcontent-%COMP%]{font-size:1.6em;line-height:.75}.ui-select-container[_ngcontent-%COMP%] .ui-select-match[_ngcontent-%COMP%] .ui-select-toggle[_ngcontent-%COMP%]{display:flex;align-items:center}.ui-select-container[_ngcontent-%COMP%] .ui-select-match[_ngcontent-%COMP%] .ui-select-toggle[_ngcontent-%COMP%] > .caret[_ngcontent-%COMP%]{position:absolute;height:10px;top:50%;right:10px;margin-top:-2px}.ui-select-container[_ngcontent-%COMP%] .ui-select-match[_ngcontent-%COMP%] .ui-select-placeholder[_ngcontent-%COMP%]{float:left;line-height:26px;color:#8c8c8c;width:100%}.ui-select-container[_ngcontent-%COMP%] .ui-select-match[_ngcontent-%COMP%] .dropdown-toggle[_ngcontent-%COMP%]{cursor:pointer}.ui-select-container[_ngcontent-%COMP%] .ui-select-match[_ngcontent-%COMP%] .dropdown-toggle[_ngcontent-%COMP%]:after{display:inline-block!important}.ui-select-container[_ngcontent-%COMP%] .ui-select-choices[_ngcontent-%COMP%]{width:100%;height:auto;max-height:200px;overflow-x:hidden;margin-top:0}.ui-select-container[_ngcontent-%COMP%] .ui-select-choices[_ngcontent-%COMP%] .ui-select-choices-row[_ngcontent-%COMP%] > a[_ngcontent-%COMP%]{display:block;padding:3px 5px;clear:both;font-weight:400;line-height:1.42857143;color:#333;white-space:nowrap}.ui-select-container[_ngcontent-%COMP%] .ui-select-choices[_ngcontent-%COMP%] .ui-select-choices-row[_ngcontent-%COMP%] .active[_ngcontent-%COMP%] > a[_ngcontent-%COMP%]{text-decoration:none;outline:0}.ui-select-container[_ngcontent-%COMP%] .ui-select-choices[_ngcontent-%COMP%] .ui-select-choices-row[_ngcontent-%COMP%] .dropdown-item[_ngcontent-%COMP%] > div[_ngcontent-%COMP%]{pointer-events:none}
2
2
 
3
3
 
4
4
 
@@ -1 +1 @@
1
- import{f as P}from"./chunk-3SC36MTD.js";import{Ba as d,U as g,Va as C,X as N,cb as E,kb as H,oa as O,sa as f,wb as k,xb as F}from"./chunk-4GYSKJJC.js";import{d as T}from"./chunk-J6YSVODR.js";import{$ as I,G as h,O as m,Oc as R,Z as x,ca as A,ha as n,p as c,q as _,v as p}from"./chunk-JQOMI5VI.js";var a=function(r){return r.ACCESS="access",r.REFRESH="refresh",r.WS="ws",r.CSRF="csrf",r}(a||{});var s=function(r){return r.BASE="/api/auth",r.LOGIN="login",r.LOGOUT="logout",r.REFRESH="refresh",r.TOKEN="token",r.TOKEN_REFRESH="token/refresh",r.WS="socket.io",r}(s||{}),U=`${s.BASE}/${s.LOGIN}`,K=`${s.BASE}/${s.LOGOUT}`,l=`${s.BASE}/${s.REFRESH}`,M=`${s.BASE}/${s.TOKEN}`,W=`${s.BASE}/${s.TOKEN_REFRESH}`,b=`/${s.WS}`;var u="sync-in-csrf";var y=[a.REFRESH,a.ACCESS,a.WS,a.CSRF];var L="Client token is expired";var S={BASE:"auth",LOGIN:"login"};var fe=(()=>{let o=class o{constructor(){this.http=n(R),this.router=n(T),this.store=n(H),this.userService=n(P),this.layout=n(F),this.electron=n(k),this._refreshExpiration=parseInt(localStorage.getItem("refresh_expiration")||"0",10)||0,this._accessExpiration=parseInt(localStorage.getItem("access_expiration")||"0",10)||0}get refreshExpiration(){return this._refreshExpiration}set refreshExpiration(e){this._refreshExpiration=e!==0?e+60:e,localStorage.setItem("refresh_expiration",e.toString())}get accessExpiration(){return this._accessExpiration}set accessExpiration(e){this._accessExpiration=e!==0?e+60:e,localStorage.setItem("access_expiration",e.toString())}login(e,t){return this.http.post(U,{login:e,password:t}).pipe(p(i=>(this.accessExpiration=i.token.access_expiration,this.refreshExpiration=i.token.refresh_expiration,this.userService.initUser(i.user),{success:!0,message:null})),h(i=>(console.warn(i),c({success:!1,message:i.error.message||i.message}))))}loginElectron(){return this.electron.authenticate().pipe(x(e=>this.http.post(g,e).pipe(p(t=>(this.accessExpiration=t.token.access_expiration,this.refreshExpiration=t.token.refresh_expiration,this.userService.initUser(t.user),t?.client_token_update&&this.electron.send(E.SERVER.AUTHENTICATION_TOKEN_UPDATE,t.client_token_update),!0)),h(t=>(console.warn(t),t.error.message===L?this.electron.send(E.SERVER.AUTHENTICATION_TOKEN_EXPIRED):this.electron.send(E.SERVER.AUTHENTICATION_FAILED),c(!1))))))}logout(e=!0,t=!1){if((e||t)&&this.store.userImpersonate()){this.logoutImpersonateUser();return}this.userService.disconnectWebSocket(),this.clearCookies().pipe(m(()=>{this.accessExpiration=0,this.refreshExpiration=0,this.layout.clean(),this.store.clean(),e&&this.router.navigate([S.BASE,S.LOGIN]).catch(console.error),t&&this.layout.sendNotification("warning","Session has expired","Please sign in")})).subscribe()}logoutImpersonateUser(){this.http.post(O,null).subscribe({next:e=>{this.userService.disconnectWebSocket(),this.initUserFromResponse(e),this.router.navigate([f.BASE,f.ACCOUNT]).catch(console.error)},error:e=>{console.error(e),this.layout.sendNotification("error","Impersonate identity","logout",e)}})}initUserFromResponse(e,t=!1){e!==null&&(this.accessExpiration=e.token.access_expiration,this.refreshExpiration=e.token.refresh_expiration,this.userService.initUser(e.user,t))}isLogged(){return!this.refreshTokenHasExpired()}refreshToken(){return this.http.post(l,null).pipe(p(e=>(this.accessExpiration=e.access_expiration,this.refreshExpiration=e.refresh_expiration,console.debug("refresh token done"),!0)),h(e=>(console.debug("token has expired"),this.electron.enabled?(console.debug("login with app"),this.loginElectron()):(this.logout(!0,!0),_(()=>e)))))}checkUserAuthAndLoad(e){return this.refreshTokenHasExpired()?this.electron.enabled?this.loginElectron():(this.returnUrl=e.length>1?e:null,this.logout(),c(!1)):this.store.user.getValue()?c(!0):this.http.get(N).pipe(I(t=>this.userService.initUser(t.user)),p(()=>!0),h(t=>(t.status===401?this.logout():console.warn(t),c(!1))))}checkCSRF(e){return e.headers.has(u)?e.clone({headers:e.headers.set(u,C(u))}):e}refreshTokenHasExpired(){return this.refreshExpiration===0||d()>=this.refreshExpiration}clearCookies(){return this.http.post(K,null)}};o.\u0275fac=function(t){return new(t||o)},o.\u0275prov=A({token:o,factory:o.\u0275fac,providedIn:"root"});let r=o;return r})();export{U as a,K as b,l as c,u as d,S as e,fe as f};
1
+ import{f as P}from"./chunk-6HV65OKG.js";import{Ba as d,U as g,Va as C,X as N,cb as E,kb as H,oa as O,sa as f,wb as k,xb as F}from"./chunk-55WOZ7P6.js";import{d as T}from"./chunk-J6YSVODR.js";import{$ as I,G as h,O as m,Oc as R,Z as x,ca as A,ha as n,p as c,q as _,v as p}from"./chunk-JQOMI5VI.js";var a=function(r){return r.ACCESS="access",r.REFRESH="refresh",r.WS="ws",r.CSRF="csrf",r}(a||{});var s=function(r){return r.BASE="/api/auth",r.LOGIN="login",r.LOGOUT="logout",r.REFRESH="refresh",r.TOKEN="token",r.TOKEN_REFRESH="token/refresh",r.WS="socket.io",r}(s||{}),U=`${s.BASE}/${s.LOGIN}`,K=`${s.BASE}/${s.LOGOUT}`,l=`${s.BASE}/${s.REFRESH}`,M=`${s.BASE}/${s.TOKEN}`,W=`${s.BASE}/${s.TOKEN_REFRESH}`,b=`/${s.WS}`;var u="sync-in-csrf";var y=[a.REFRESH,a.ACCESS,a.WS,a.CSRF];var L="Client token is expired";var S={BASE:"auth",LOGIN:"login"};var fe=(()=>{let o=class o{constructor(){this.http=n(R),this.router=n(T),this.store=n(H),this.userService=n(P),this.layout=n(F),this.electron=n(k),this._refreshExpiration=parseInt(localStorage.getItem("refresh_expiration")||"0",10)||0,this._accessExpiration=parseInt(localStorage.getItem("access_expiration")||"0",10)||0}get refreshExpiration(){return this._refreshExpiration}set refreshExpiration(e){this._refreshExpiration=e!==0?e+60:e,localStorage.setItem("refresh_expiration",e.toString())}get accessExpiration(){return this._accessExpiration}set accessExpiration(e){this._accessExpiration=e!==0?e+60:e,localStorage.setItem("access_expiration",e.toString())}login(e,t){return this.http.post(U,{login:e,password:t}).pipe(p(i=>(this.accessExpiration=i.token.access_expiration,this.refreshExpiration=i.token.refresh_expiration,this.userService.initUser(i.user),{success:!0,message:null})),h(i=>(console.warn(i),c({success:!1,message:i.error.message||i.message}))))}loginElectron(){return this.electron.authenticate().pipe(x(e=>this.http.post(g,e).pipe(p(t=>(this.accessExpiration=t.token.access_expiration,this.refreshExpiration=t.token.refresh_expiration,this.userService.initUser(t.user),t?.client_token_update&&this.electron.send(E.SERVER.AUTHENTICATION_TOKEN_UPDATE,t.client_token_update),!0)),h(t=>(console.warn(t),t.error.message===L?this.electron.send(E.SERVER.AUTHENTICATION_TOKEN_EXPIRED):this.electron.send(E.SERVER.AUTHENTICATION_FAILED),c(!1))))))}logout(e=!0,t=!1){if((e||t)&&this.store.userImpersonate()){this.logoutImpersonateUser();return}this.userService.disconnectWebSocket(),this.clearCookies().pipe(m(()=>{this.accessExpiration=0,this.refreshExpiration=0,this.layout.clean(),this.store.clean(),e&&this.router.navigate([S.BASE,S.LOGIN]).catch(console.error),t&&this.layout.sendNotification("warning","Session has expired","Please sign in")})).subscribe()}logoutImpersonateUser(){this.http.post(O,null).subscribe({next:e=>{this.userService.disconnectWebSocket(),this.initUserFromResponse(e),this.router.navigate([f.BASE,f.ACCOUNT]).catch(console.error)},error:e=>{console.error(e),this.layout.sendNotification("error","Impersonate identity","logout",e)}})}initUserFromResponse(e,t=!1){e!==null&&(this.accessExpiration=e.token.access_expiration,this.refreshExpiration=e.token.refresh_expiration,this.userService.initUser(e.user,t))}isLogged(){return!this.refreshTokenHasExpired()}refreshToken(){return this.http.post(l,null).pipe(p(e=>(this.accessExpiration=e.access_expiration,this.refreshExpiration=e.refresh_expiration,console.debug("refresh token done"),!0)),h(e=>(console.debug("token has expired"),this.electron.enabled?(console.debug("login with app"),this.loginElectron()):(this.logout(!0,!0),_(()=>e)))))}checkUserAuthAndLoad(e){return this.refreshTokenHasExpired()?this.electron.enabled?this.loginElectron():(this.returnUrl=e.length>1?e:null,this.logout(),c(!1)):this.store.user.getValue()?c(!0):this.http.get(N).pipe(I(t=>this.userService.initUser(t.user)),p(()=>!0),h(t=>(t.status===401?this.logout():console.warn(t),c(!1))))}checkCSRF(e){return e.headers.has(u)?e.clone({headers:e.headers.set(u,C(u))}):e}refreshTokenHasExpired(){return this.refreshExpiration===0||d()>=this.refreshExpiration}clearCookies(){return this.http.post(K,null)}};o.\u0275fac=function(t){return new(t||o)},o.\u0275prov=A({token:o,factory:o.\u0275fac,providedIn:"root"});let r=o;return r})();export{U as a,K as b,l as c,u as d,S as e,fe as f};