@sync-in/server 1.3.0 → 1.3.1

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 (38) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/environment/environment.dist.yaml +1 -1
  3. package/package.json +1 -1
  4. package/server/configuration/config.loader.js +1 -1
  5. package/server/configuration/config.loader.js.map +1 -1
  6. package/server/configuration/config.validation.js +2 -0
  7. package/server/configuration/config.validation.js.map +1 -1
  8. package/static/{chunk-UV4UIX6J.js → chunk-2CQOSX2Q.js} +1 -1
  9. package/static/{chunk-7WRQICEB.js → chunk-2QEYCCHN.js} +1 -1
  10. package/static/{chunk-QFRQQ4K3.js → chunk-2SX3MVH3.js} +1 -1
  11. package/static/{chunk-GWUCWOVK.js → chunk-2XXS272C.js} +1 -1
  12. package/static/{chunk-ZVPX26RB.js → chunk-3RLZPQMJ.js} +1 -1
  13. package/static/{chunk-3V7XYPSJ.js → chunk-5JDPARJT.js} +1 -1
  14. package/static/{chunk-2EBPSJJT.js → chunk-5OIPLRAE.js} +1 -1
  15. package/static/{chunk-7PCJMNDR.js → chunk-7U66TR6P.js} +1 -1
  16. package/static/{chunk-IFJD2ISM.js → chunk-AA6ZTGRW.js} +1 -1
  17. package/static/{chunk-WTPZUBNX.js → chunk-AXITQYVN.js} +1 -1
  18. package/static/{chunk-OWGR4BYT.js → chunk-AYEOHGUD.js} +1 -1
  19. package/static/{chunk-NPLV4M2H.js → chunk-CTWOQLAR.js} +1 -1
  20. package/static/{chunk-O4CXCITB.js → chunk-EWY4ALVF.js} +1 -1
  21. package/static/{chunk-5RFOYHL3.js → chunk-FBG4NUDE.js} +1 -1
  22. package/static/{chunk-ATFX6EIO.js → chunk-GI2LXVWQ.js} +1 -1
  23. package/static/{chunk-NU3TPXFY.js → chunk-HDDBV3QQ.js} +1 -1
  24. package/static/{chunk-I644MKAO.js → chunk-HQC3W7BS.js} +1 -1
  25. package/static/{chunk-4IYQWOGR.js → chunk-LHKO5Y4A.js} +1 -1
  26. package/static/{chunk-MQZEETHL.js → chunk-NCIAR3N4.js} +1 -1
  27. package/static/{chunk-VBD7QTEP.js → chunk-R4USKWW6.js} +1 -1
  28. package/static/{chunk-XI72YZ2M.js → chunk-RGONEEJE.js} +1 -1
  29. package/static/{chunk-AKM2LQUU.js → chunk-TFBTBTPR.js} +1 -1
  30. package/static/{chunk-RUNMEQOV.js → chunk-VIL6L67B.js} +1 -1
  31. package/static/{chunk-Z6IHRUVL.js → chunk-WA3LPP4G.js} +1 -1
  32. package/static/{chunk-MEKYVWV4.js → chunk-WQPVP63E.js} +1 -1
  33. package/static/{chunk-ATLT5DK5.js → chunk-Y6IYSEKU.js} +1 -1
  34. package/static/{chunk-IUUTIYHF.js → chunk-ZS5YIDNI.js} +1 -1
  35. package/static/{chunk-VQRN7HFP.js → chunk-ZSMTUPAP.js} +1 -1
  36. package/static/{chunk-RAVRSB6R.js → chunk-ZZGFGD5E.js} +1 -1
  37. package/static/index.html +1 -1
  38. package/static/{main-ILCPT3IK.js → main-7IVUWYWM.js} +3 -3
@@ -1 +1 @@
1
- import{Sb as ae,Tb as ce,hb as he}from"./chunk-NU3TPXFY.js";import{Ad as ne,Ba as j,Bb as I,Dd as re,Df as le,Eb as H,Fb as O,Gb as J,Hb as Y,J as T,Mb as S,N as W,Nb as y,Ob as b,Qa as N,Sa as P,T as k,Wa as Q,X as V,Xa as c,Yc as X,Z as L,ab as w,ad as ee,bc as U,db as Z,dc as G,f as F,fb as $,id as te,lb as R,oa as z,p as B,pa as _,qa as M,qd as ie,rb as q,td as se,ud as oe,vb as C,wa as x,wb as p,xa as A,xb as K,za as v}from"./chunk-FPEGN42P.js";var ue=["iFilter"];function pe(o,r){if(o&1){let t=I();C(0,"span",3)(1,"fa-icon",4),H("click",function(){_(t);let i=O();return M(i.clear())}),p()()}if(o&2){let t=O();P(),R("icon",t.faTimes)}}var Re=(()=>{class o{constructor(t,e){this.locale=t,this.fb=e,this.search=j(""),this.faTimes=le,this.searchControl=this.fb.control(""),this.subscription=this.searchControl.valueChanges.pipe(T(300),W()).subscribe(i=>this.onType(i))}ngOnDestroy(){this.subscription.unsubscribe()}onKeyPress(t){(t.ctrlKey||t.metaKey)&&t.keyCode===70?(t.preventDefault(),t.stopPropagation(),this.iFilter.nativeElement.focus()):t.keyCode===27&&(t.preventDefault(),t.stopPropagation())}clear(){this.searchControl&&(this.searchControl.reset(),this.iFilter.nativeElement.value="")}onType(t){this.search.set(t)}static{this.\u0275fac=function(e){return new(e||o)(c(oe),c(ie))}}static{this.\u0275cmp=w({type:o,selectors:[["app-input-filter"]],viewQuery:function(e,i){if(e&1&&S(ue,7),e&2){let s;y(s=b())&&(i.iFilter=s.first)}},hostBindings:function(e,i){e&1&&H("keydown",function(h){return i.onKeyPress(h)},!1,N)},decls:5,vars:6,consts:[["iFilter",""],[1,"btn-group",2,"height","30px","max-width","150px"],["type","text",1,"form-control","form-control-sm",2,"padding-right","24px",3,"keyup.escape","placeholder","formControl"],[1,"cursor-pointer",2,"position","absolute","right","5px","top","3px","z-index","1001","font-size","1rem"],["role","button",3,"click","icon"]],template:function(e,i){if(e&1){let s=I();C(0,"div",1)(1,"input",2,0),U(3,"translate"),H("keyup.escape",function(){return _(s),M(i.clear())}),p(),$(4,pe,2,1,"span",3),p()}e&2&&(P(),R("placeholder",G(3,3,"Filter",i.locale.language))("formControl",i.searchControl),P(3),q(i.search()?4:-1))},dependencies:[se,X,ee,te,ne,re],encapsulation:2})}}return o})();var ge=["content"],ve=["shim"],Ce=["*"],Ae=(()=>{class o{constructor(t,e,i,s){this.element=t,this.renderer=e,this.ngZone=i,this.layout=s,this.viewPortItems=[],this.isScrollBottom=new x,this.isScrollTop=new x,this.resizeOffset=130,this.galleryMode=!1,this.selectedChat=null,this.items=[],this.childHeight=35,this.bufferAmount=0,this.subscriptions=[],this.scrollbarWidth=0,this._scrollChat=new F,this.scrollChat=this._scrollChat.asObservable().pipe(T(50)),this.startupLoop=!0,this.scrollTimer=null,this.lastScrollHeight=-1,this.lastTopPadding=-1,this.toggleLeftSidebar=this.layout.toggleLeftSideBar.pipe(V(1),L(h=>B(h).pipe(k({count:30,delay:10})))),this.tableScrollHovering=()=>{clearTimeout(this.scrollTimer),this.contentElementRef.nativeElement.classList.contains("table-disable-hover")||this.renderer.addClass(this.contentElementRef.nativeElement,"table-disable-hover"),this.scrollTimer=setTimeout(()=>{this.renderer.removeClass(this.contentElementRef.nativeElement,"table-disable-hover")},200),this.refresh()},this.refreshWithDimensions=()=>{this.resizeOffsetHeight(),this.refresh(!0)},this.refreshWithoutDimensions=()=>{this.refresh()},this.refreshChatWithoutDimensions=()=>{this.chatIsScrolledToTop()&&!this.selectedChat.allHistoryLoaded?this.element.nativeElement.scrollTo({left:0,top:this.element.nativeElement.scrollTop,behavior:"auto"}):(this.refreshWithoutDimensions(),this._scrollChat.next())},this.refreshChatWithDimensions=()=>{this.resizeOffsetHeight(),this.refresh(!0),this.selectedChat.isScrolledToBottom?this.scrollInto(-2):this._scrollChat.next()}}ngOnInit(){this.resizeOffsetHeight(!0),this.addParentEventHandlers(),this.selectedChat?(this.childHeight=1,this.subscriptions.push(this.scrollChat.subscribe(()=>this.checkScrollChat()))):this.galleryMode||this.subscriptions.push(this.toggleLeftSidebar.subscribe(()=>this.resizeTableHeader()))}ngOnDestroy(){this.eventScrollHandler&&(this.eventScrollHandler(),this.eventScrollHandler=void 0),this.subscriptions.forEach(t=>t.unsubscribe())}ngOnChanges(t){if(this.previousStart=void 0,this.previousEnd=void 0,this.galleryMode)this.startupLoop=!0;else{let e=t.items||void 0;(t.items!==void 0&&e.previousValue===void 0||e.previousValue!==void 0&&e.previousValue.length===0)&&(this.startupLoop=!0)}this.refresh(!0),this.checkChangesOnChat(t)}refresh(t=!1){this.ngZone.runOutsideAngular(()=>{(t||!this.dimensionsView)&&this.calculateDimensions(),requestAnimationFrame(()=>this.calculateItems())}),this.resizeTableHeader()}scrollInto(t){if(t===-1){this.element.nativeElement.scrollTo({left:0,top:0,behavior:"auto"});return}else if(t===-2){this.element.nativeElement.scrollTo({left:0,top:this.element.nativeElement.scrollHeight,behavior:"smooth"});return}else if(t===0){this.refresh();return}let e=(this.items||[]).indexOf(t);if(e<0||e>=(this.items||[]).length)return;let i=this.dimensionsView,s=Math.floor(e/i.itemsPerRow)*i.childHeight-i.childHeight*Math.min(e,this.bufferAmount);this.element.nativeElement.scrollTo({left:0,top:s,behavior:"smooth"}),this.refresh()}checkChangesOnChat(t){this.selectedChat&&(t.selectedChat?(this.renderer.setStyle(this.element.nativeElement,"visibility","hidden"),setTimeout(()=>{this.selectedChat.lastScrollPosition===null&&this.saveChatScrollPosition(this.element.nativeElement.scrollHeight),this.element.nativeElement.scrollTo({left:0,top:this.selectedChat.lastScrollPosition,behavior:"auto"}),this.checkScrollChat(),this.renderer.setStyle(this.element.nativeElement,"visibility","visible")},50)):this.chatIsScrolledToBottom()?this.restoreBottomScrollChat():this.chatIsScrolledToTop()&&this.restoreTopScrollChat())}checkScrollChat(){let t=this.chatIsScrolledToBottom(),e=this.chatIsScrolledToTop();e?this.saveChatScrollPosition(this.element.nativeElement.scrollHeight-this.element.nativeElement.scrollTop):t?this.saveChatScrollPosition(this.element.nativeElement.scrollHeight):this.saveChatScrollPosition(),this.ngZone.run(()=>{this.isScrollBottom.next(t),this.isScrollTop.next(e)})}saveChatScrollPosition(t=null){this.selectedChat.lastScrollPosition=t||this.element.nativeElement.scrollTop}chatIsScrolledToBottom(){return Math.ceil(this.element.nativeElement.clientHeight/10)*10===Math.ceil((this.element.nativeElement.scrollHeight-this.element.nativeElement.scrollTop)/10)*10}chatIsScrolledToTop(){return this.element.nativeElement.scrollTop<=300}restoreBottomScrollChat(){setTimeout(()=>{this.element.nativeElement.scrollTo({left:0,top:this.element.nativeElement.scrollHeight,behavior:"smooth"})},50)}restoreTopScrollChat(){setTimeout(()=>{this.element.nativeElement.scrollTop=this.element.nativeElement.scrollHeight-this.selectedChat.lastScrollPosition},50)}resizeOffsetHeight(t=!1){let e=window.innerHeight-this.resizeOffset;(t||this.element.nativeElement.offsetHeight!==e)&&this.renderer.setStyle(this.element.nativeElement,"height",`${e-1}px`)}resizeTableHeader(){!this.selectedChat&&!this.galleryMode&&this.element.nativeElement.previousElementSibling&&this.element.nativeElement.previousElementSibling.classList.contains("app-table")&&setTimeout(()=>this.renderer.setStyle(this.element.nativeElement.previousElementSibling,"width",`${this.element.nativeElement.clientWidth}px`),50)}addParentEventHandlers(){this.ngZone.runOutsideAngular(()=>{this.galleryMode?this.eventScrollHandler=this.renderer.listen(this.element.nativeElement,"scroll",this.refreshWithoutDimensions):this.selectedChat?this.eventScrollHandler=this.renderer.listen(this.element.nativeElement,"scroll",this.refreshChatWithoutDimensions):this.eventScrollHandler=this.renderer.listen(this.element.nativeElement,"scroll",this.tableScrollHovering),this.selectedChat?this.subscriptions.push(this.layout.resizeEvent.subscribe(()=>this.refreshChatWithDimensions())):this.subscriptions.push(this.layout.resizeEvent.subscribe(()=>this.refreshWithDimensions()))})}countItemsPerRow(){if(this.galleryMode){let t,e,i=this.contentElementRef.nativeElement.children;for(i[0]&&(i=i[0].children),e=0;e<i.length&&!(t!==void 0&&t!==i[e].offsetTop);e++)t=i[e].offsetTop;return e}else return 1}calculateDimensions(){let t=this.element.nativeElement,e=t.offsetWidth-t.clientWidth;this.scrollbarWidth!=e&&(this.resizeTableHeader(),this.scrollbarWidth=e);let s=(this.items||[]).length,h=t.clientWidth-this.scrollbarWidth,E=t.clientHeight,m;if(this.childWidth===void 0||this.childHeight===void 0){let D=this.contentElementRef.nativeElement;m=D.children[0]?D.children[0].getBoundingClientRect():{width:h,height:E}}let n=this.childWidth||m.width,f=this.childHeight||m.height,a=this.countItemsPerRow(),d=Math.max(1,Math.floor(h/n));this.galleryMode&&a===0?a=d:a=Math.max(1,a);let l=Math.max(1,Math.floor(E/f)),u=t.scrollTop,de=Math.max(0,u),g=f*Math.ceil(s/a);l===1&&Math.floor(de/g*s)+d>=s&&(a=d),g!==this.lastScrollHeight&&(this.renderer.setStyle(this.shimElementRef.nativeElement,"height",`${g}px`),this.lastScrollHeight=g),this.dimensionsView={itemCount:s,viewWidth:h,viewHeight:E,childWidth:n,childHeight:f,itemsPerRow:a,itemsPerCol:l,itemsPerRowByCalc:d,scrollHeight:g}}calculateItems(){let t=this.element.nativeElement,e=this.dimensionsView,i=this.items||[],s=this.galleryMode?this.bufferAmount*e.itemsPerRowByCalc:this.bufferAmount,h=t.scrollTop;h>e.scrollHeight&&(h=e.scrollHeight);let m=Math.max(0,h)/e.scrollHeight*e.itemCount/e.itemsPerRow,n=Math.min(e.itemCount,Math.ceil(m)*e.itemsPerRow+e.itemsPerRow*(e.itemsPerCol+1)),f=n,a=n%e.itemsPerRow;a&&(f=n+e.itemsPerRow-a);let d=Math.max(0,f-e.itemsPerCol*e.itemsPerRow-e.itemsPerRow),l=Math.min(d,Math.floor(m)*e.itemsPerRow),u=i==null||i.length===0?0:e.childHeight*Math.ceil(l/e.itemsPerRow)-e.childHeight*Math.min(l,this.bufferAmount);u!==this.lastTopPadding&&(this.renderer.setStyle(this.contentElementRef.nativeElement,"transform",`translateY(${u}px)`),this.renderer.setStyle(this.contentElementRef.nativeElement,"webkitTransform",`translateY(${u}px)`),this.lastTopPadding=u),l=isNaN(l)?-1:l,n=isNaN(n)?-1:n,l-=s,l=Math.max(0,l),n+=s,n=Math.min(i.length,n),l!==this.previousStart||n!==this.previousEnd?(this.ngZone.run(()=>{this.viewPortItems=i.slice(l,n>=0?n:0)}),this.previousStart=l,this.previousEnd=n,this.startupLoop===!0&&this.refresh()):this.startupLoop===!0&&(this.startupLoop=!1,this.refresh(!0))}static{this.\u0275fac=function(e){return new(e||o)(c(v),c(Q),c(A),c(ae))}}static{this.\u0275cmp=w({type:o,selectors:[["app-virtual-scroll"]],viewQuery:function(e,i){if(e&1&&(S(ge,7,v),S(ve,7,v)),e&2){let s;y(s=b())&&(i.contentElementRef=s.first),y(s=b())&&(i.shimElementRef=s.first)}},inputs:{resizeOffset:"resizeOffset",galleryMode:"galleryMode",selectedChat:"selectedChat",items:"items",childHeight:"childHeight",childWidth:"childWidth",bufferAmount:"bufferAmount"},outputs:{isScrollBottom:"isScrollBottom",isScrollTop:"isScrollTop"},features:[z],ngContentSelectors:Ce,decls:5,vars:0,consts:[["shim",""],["content",""],[1,"total-padding"],[1,"scrollable-content"]],template:function(e,i){e&1&&(J(),K(0,"div",2,0),C(2,"div",3,1),Y(4),p())},styles:["[_nghost-%COMP%]{display:block;overflow-x:hidden;overflow-y:auto;position:relative;scrollbar-width:thin}.scrollable-content[_ngcontent-%COMP%]{top:0;left:0;width:100%;position:absolute;will-change:transform}.total-padding[_ngcontent-%COMP%]{width:1px;opacity:0}"],changeDetection:0})}}return o})();var Qe=(()=>{class o{transform(t,e,i){return!t?.length||!e?t:he(e,t,i)}static{this.\u0275fac=function(e){return new(e||o)}}static{this.\u0275pipe=Z({name:"searchFilter",type:o,pure:!0})}}return o})();var fe=class{constructor(r,t){this.defaultId="default",this.keyStore=`sortBy${r}`,this.sortSettings=t,this._sortParam=this.sort}get sortParam(){return this._sortParam||this.sort}get sort(){let r=localStorage.getItem(this.keyStore);return r?JSON.parse(r):{column:this.defaultId,asc:!1}}set sort(r){this._sortParam=r,localStorage.setItem(this.keyStore,JSON.stringify(r))}sortBy(r,t=!0,e){if(!(r in this.sortSettings))return e;t&&(this.sortParam.asc?(this.sortParam.column=this.defaultId,this.sortParam.asc=!1,r=this.defaultId):this.sortParam.column===r?this.sortParam.asc=!this.sortParam.asc:(this.sortParam.column=r,this.sortParam.asc=!1),this.sort=this.sortParam);for(let i of this.sortSettings[r])ce(i.type,e,i.prop,r===this.defaultId?!1:this.sortParam.asc);return[...e]}};export{Re as a,Ae as b,Qe as c,fe as d};
1
+ import{Sb as ae,Tb as ce,hb as he}from"./chunk-HDDBV3QQ.js";import{Ad as ne,Ba as j,Bb as I,Dd as re,Df as le,Eb as H,Fb as O,Gb as J,Hb as Y,J as T,Mb as S,N as W,Nb as y,Ob as b,Qa as N,Sa as P,T as k,Wa as Q,X as V,Xa as c,Yc as X,Z as L,ab as w,ad as ee,bc as U,db as Z,dc as G,f as F,fb as $,id as te,lb as R,oa as z,p as B,pa as _,qa as M,qd as ie,rb as q,td as se,ud as oe,vb as C,wa as x,wb as p,xa as A,xb as K,za as v}from"./chunk-FPEGN42P.js";var ue=["iFilter"];function pe(o,r){if(o&1){let t=I();C(0,"span",3)(1,"fa-icon",4),H("click",function(){_(t);let i=O();return M(i.clear())}),p()()}if(o&2){let t=O();P(),R("icon",t.faTimes)}}var Re=(()=>{class o{constructor(t,e){this.locale=t,this.fb=e,this.search=j(""),this.faTimes=le,this.searchControl=this.fb.control(""),this.subscription=this.searchControl.valueChanges.pipe(T(300),W()).subscribe(i=>this.onType(i))}ngOnDestroy(){this.subscription.unsubscribe()}onKeyPress(t){(t.ctrlKey||t.metaKey)&&t.keyCode===70?(t.preventDefault(),t.stopPropagation(),this.iFilter.nativeElement.focus()):t.keyCode===27&&(t.preventDefault(),t.stopPropagation())}clear(){this.searchControl&&(this.searchControl.reset(),this.iFilter.nativeElement.value="")}onType(t){this.search.set(t)}static{this.\u0275fac=function(e){return new(e||o)(c(oe),c(ie))}}static{this.\u0275cmp=w({type:o,selectors:[["app-input-filter"]],viewQuery:function(e,i){if(e&1&&S(ue,7),e&2){let s;y(s=b())&&(i.iFilter=s.first)}},hostBindings:function(e,i){e&1&&H("keydown",function(h){return i.onKeyPress(h)},!1,N)},decls:5,vars:6,consts:[["iFilter",""],[1,"btn-group",2,"height","30px","max-width","150px"],["type","text",1,"form-control","form-control-sm",2,"padding-right","24px",3,"keyup.escape","placeholder","formControl"],[1,"cursor-pointer",2,"position","absolute","right","5px","top","3px","z-index","1001","font-size","1rem"],["role","button",3,"click","icon"]],template:function(e,i){if(e&1){let s=I();C(0,"div",1)(1,"input",2,0),U(3,"translate"),H("keyup.escape",function(){return _(s),M(i.clear())}),p(),$(4,pe,2,1,"span",3),p()}e&2&&(P(),R("placeholder",G(3,3,"Filter",i.locale.language))("formControl",i.searchControl),P(3),q(i.search()?4:-1))},dependencies:[se,X,ee,te,ne,re],encapsulation:2})}}return o})();var ge=["content"],ve=["shim"],Ce=["*"],Ae=(()=>{class o{constructor(t,e,i,s){this.element=t,this.renderer=e,this.ngZone=i,this.layout=s,this.viewPortItems=[],this.isScrollBottom=new x,this.isScrollTop=new x,this.resizeOffset=130,this.galleryMode=!1,this.selectedChat=null,this.items=[],this.childHeight=35,this.bufferAmount=0,this.subscriptions=[],this.scrollbarWidth=0,this._scrollChat=new F,this.scrollChat=this._scrollChat.asObservable().pipe(T(50)),this.startupLoop=!0,this.scrollTimer=null,this.lastScrollHeight=-1,this.lastTopPadding=-1,this.toggleLeftSidebar=this.layout.toggleLeftSideBar.pipe(V(1),L(h=>B(h).pipe(k({count:30,delay:10})))),this.tableScrollHovering=()=>{clearTimeout(this.scrollTimer),this.contentElementRef.nativeElement.classList.contains("table-disable-hover")||this.renderer.addClass(this.contentElementRef.nativeElement,"table-disable-hover"),this.scrollTimer=setTimeout(()=>{this.renderer.removeClass(this.contentElementRef.nativeElement,"table-disable-hover")},200),this.refresh()},this.refreshWithDimensions=()=>{this.resizeOffsetHeight(),this.refresh(!0)},this.refreshWithoutDimensions=()=>{this.refresh()},this.refreshChatWithoutDimensions=()=>{this.chatIsScrolledToTop()&&!this.selectedChat.allHistoryLoaded?this.element.nativeElement.scrollTo({left:0,top:this.element.nativeElement.scrollTop,behavior:"auto"}):(this.refreshWithoutDimensions(),this._scrollChat.next())},this.refreshChatWithDimensions=()=>{this.resizeOffsetHeight(),this.refresh(!0),this.selectedChat.isScrolledToBottom?this.scrollInto(-2):this._scrollChat.next()}}ngOnInit(){this.resizeOffsetHeight(!0),this.addParentEventHandlers(),this.selectedChat?(this.childHeight=1,this.subscriptions.push(this.scrollChat.subscribe(()=>this.checkScrollChat()))):this.galleryMode||this.subscriptions.push(this.toggleLeftSidebar.subscribe(()=>this.resizeTableHeader()))}ngOnDestroy(){this.eventScrollHandler&&(this.eventScrollHandler(),this.eventScrollHandler=void 0),this.subscriptions.forEach(t=>t.unsubscribe())}ngOnChanges(t){if(this.previousStart=void 0,this.previousEnd=void 0,this.galleryMode)this.startupLoop=!0;else{let e=t.items||void 0;(t.items!==void 0&&e.previousValue===void 0||e.previousValue!==void 0&&e.previousValue.length===0)&&(this.startupLoop=!0)}this.refresh(!0),this.checkChangesOnChat(t)}refresh(t=!1){this.ngZone.runOutsideAngular(()=>{(t||!this.dimensionsView)&&this.calculateDimensions(),requestAnimationFrame(()=>this.calculateItems())}),this.resizeTableHeader()}scrollInto(t){if(t===-1){this.element.nativeElement.scrollTo({left:0,top:0,behavior:"auto"});return}else if(t===-2){this.element.nativeElement.scrollTo({left:0,top:this.element.nativeElement.scrollHeight,behavior:"smooth"});return}else if(t===0){this.refresh();return}let e=(this.items||[]).indexOf(t);if(e<0||e>=(this.items||[]).length)return;let i=this.dimensionsView,s=Math.floor(e/i.itemsPerRow)*i.childHeight-i.childHeight*Math.min(e,this.bufferAmount);this.element.nativeElement.scrollTo({left:0,top:s,behavior:"smooth"}),this.refresh()}checkChangesOnChat(t){this.selectedChat&&(t.selectedChat?(this.renderer.setStyle(this.element.nativeElement,"visibility","hidden"),setTimeout(()=>{this.selectedChat.lastScrollPosition===null&&this.saveChatScrollPosition(this.element.nativeElement.scrollHeight),this.element.nativeElement.scrollTo({left:0,top:this.selectedChat.lastScrollPosition,behavior:"auto"}),this.checkScrollChat(),this.renderer.setStyle(this.element.nativeElement,"visibility","visible")},50)):this.chatIsScrolledToBottom()?this.restoreBottomScrollChat():this.chatIsScrolledToTop()&&this.restoreTopScrollChat())}checkScrollChat(){let t=this.chatIsScrolledToBottom(),e=this.chatIsScrolledToTop();e?this.saveChatScrollPosition(this.element.nativeElement.scrollHeight-this.element.nativeElement.scrollTop):t?this.saveChatScrollPosition(this.element.nativeElement.scrollHeight):this.saveChatScrollPosition(),this.ngZone.run(()=>{this.isScrollBottom.next(t),this.isScrollTop.next(e)})}saveChatScrollPosition(t=null){this.selectedChat.lastScrollPosition=t||this.element.nativeElement.scrollTop}chatIsScrolledToBottom(){return Math.ceil(this.element.nativeElement.clientHeight/10)*10===Math.ceil((this.element.nativeElement.scrollHeight-this.element.nativeElement.scrollTop)/10)*10}chatIsScrolledToTop(){return this.element.nativeElement.scrollTop<=300}restoreBottomScrollChat(){setTimeout(()=>{this.element.nativeElement.scrollTo({left:0,top:this.element.nativeElement.scrollHeight,behavior:"smooth"})},50)}restoreTopScrollChat(){setTimeout(()=>{this.element.nativeElement.scrollTop=this.element.nativeElement.scrollHeight-this.selectedChat.lastScrollPosition},50)}resizeOffsetHeight(t=!1){let e=window.innerHeight-this.resizeOffset;(t||this.element.nativeElement.offsetHeight!==e)&&this.renderer.setStyle(this.element.nativeElement,"height",`${e-1}px`)}resizeTableHeader(){!this.selectedChat&&!this.galleryMode&&this.element.nativeElement.previousElementSibling&&this.element.nativeElement.previousElementSibling.classList.contains("app-table")&&setTimeout(()=>this.renderer.setStyle(this.element.nativeElement.previousElementSibling,"width",`${this.element.nativeElement.clientWidth}px`),50)}addParentEventHandlers(){this.ngZone.runOutsideAngular(()=>{this.galleryMode?this.eventScrollHandler=this.renderer.listen(this.element.nativeElement,"scroll",this.refreshWithoutDimensions):this.selectedChat?this.eventScrollHandler=this.renderer.listen(this.element.nativeElement,"scroll",this.refreshChatWithoutDimensions):this.eventScrollHandler=this.renderer.listen(this.element.nativeElement,"scroll",this.tableScrollHovering),this.selectedChat?this.subscriptions.push(this.layout.resizeEvent.subscribe(()=>this.refreshChatWithDimensions())):this.subscriptions.push(this.layout.resizeEvent.subscribe(()=>this.refreshWithDimensions()))})}countItemsPerRow(){if(this.galleryMode){let t,e,i=this.contentElementRef.nativeElement.children;for(i[0]&&(i=i[0].children),e=0;e<i.length&&!(t!==void 0&&t!==i[e].offsetTop);e++)t=i[e].offsetTop;return e}else return 1}calculateDimensions(){let t=this.element.nativeElement,e=t.offsetWidth-t.clientWidth;this.scrollbarWidth!=e&&(this.resizeTableHeader(),this.scrollbarWidth=e);let s=(this.items||[]).length,h=t.clientWidth-this.scrollbarWidth,E=t.clientHeight,m;if(this.childWidth===void 0||this.childHeight===void 0){let D=this.contentElementRef.nativeElement;m=D.children[0]?D.children[0].getBoundingClientRect():{width:h,height:E}}let n=this.childWidth||m.width,f=this.childHeight||m.height,a=this.countItemsPerRow(),d=Math.max(1,Math.floor(h/n));this.galleryMode&&a===0?a=d:a=Math.max(1,a);let l=Math.max(1,Math.floor(E/f)),u=t.scrollTop,de=Math.max(0,u),g=f*Math.ceil(s/a);l===1&&Math.floor(de/g*s)+d>=s&&(a=d),g!==this.lastScrollHeight&&(this.renderer.setStyle(this.shimElementRef.nativeElement,"height",`${g}px`),this.lastScrollHeight=g),this.dimensionsView={itemCount:s,viewWidth:h,viewHeight:E,childWidth:n,childHeight:f,itemsPerRow:a,itemsPerCol:l,itemsPerRowByCalc:d,scrollHeight:g}}calculateItems(){let t=this.element.nativeElement,e=this.dimensionsView,i=this.items||[],s=this.galleryMode?this.bufferAmount*e.itemsPerRowByCalc:this.bufferAmount,h=t.scrollTop;h>e.scrollHeight&&(h=e.scrollHeight);let m=Math.max(0,h)/e.scrollHeight*e.itemCount/e.itemsPerRow,n=Math.min(e.itemCount,Math.ceil(m)*e.itemsPerRow+e.itemsPerRow*(e.itemsPerCol+1)),f=n,a=n%e.itemsPerRow;a&&(f=n+e.itemsPerRow-a);let d=Math.max(0,f-e.itemsPerCol*e.itemsPerRow-e.itemsPerRow),l=Math.min(d,Math.floor(m)*e.itemsPerRow),u=i==null||i.length===0?0:e.childHeight*Math.ceil(l/e.itemsPerRow)-e.childHeight*Math.min(l,this.bufferAmount);u!==this.lastTopPadding&&(this.renderer.setStyle(this.contentElementRef.nativeElement,"transform",`translateY(${u}px)`),this.renderer.setStyle(this.contentElementRef.nativeElement,"webkitTransform",`translateY(${u}px)`),this.lastTopPadding=u),l=isNaN(l)?-1:l,n=isNaN(n)?-1:n,l-=s,l=Math.max(0,l),n+=s,n=Math.min(i.length,n),l!==this.previousStart||n!==this.previousEnd?(this.ngZone.run(()=>{this.viewPortItems=i.slice(l,n>=0?n:0)}),this.previousStart=l,this.previousEnd=n,this.startupLoop===!0&&this.refresh()):this.startupLoop===!0&&(this.startupLoop=!1,this.refresh(!0))}static{this.\u0275fac=function(e){return new(e||o)(c(v),c(Q),c(A),c(ae))}}static{this.\u0275cmp=w({type:o,selectors:[["app-virtual-scroll"]],viewQuery:function(e,i){if(e&1&&(S(ge,7,v),S(ve,7,v)),e&2){let s;y(s=b())&&(i.contentElementRef=s.first),y(s=b())&&(i.shimElementRef=s.first)}},inputs:{resizeOffset:"resizeOffset",galleryMode:"galleryMode",selectedChat:"selectedChat",items:"items",childHeight:"childHeight",childWidth:"childWidth",bufferAmount:"bufferAmount"},outputs:{isScrollBottom:"isScrollBottom",isScrollTop:"isScrollTop"},features:[z],ngContentSelectors:Ce,decls:5,vars:0,consts:[["shim",""],["content",""],[1,"total-padding"],[1,"scrollable-content"]],template:function(e,i){e&1&&(J(),K(0,"div",2,0),C(2,"div",3,1),Y(4),p())},styles:["[_nghost-%COMP%]{display:block;overflow-x:hidden;overflow-y:auto;position:relative;scrollbar-width:thin}.scrollable-content[_ngcontent-%COMP%]{top:0;left:0;width:100%;position:absolute;will-change:transform}.total-padding[_ngcontent-%COMP%]{width:1px;opacity:0}"],changeDetection:0})}}return o})();var Qe=(()=>{class o{transform(t,e,i){return!t?.length||!e?t:he(e,t,i)}static{this.\u0275fac=function(e){return new(e||o)}}static{this.\u0275pipe=Z({name:"searchFilter",type:o,pure:!0})}}return o})();var fe=class{constructor(r,t){this.defaultId="default",this.keyStore=`sortBy${r}`,this.sortSettings=t,this._sortParam=this.sort}get sortParam(){return this._sortParam||this.sort}get sort(){let r=localStorage.getItem(this.keyStore);return r?JSON.parse(r):{column:this.defaultId,asc:!1}}set sort(r){this._sortParam=r,localStorage.setItem(this.keyStore,JSON.stringify(r))}sortBy(r,t=!0,e){if(!(r in this.sortSettings))return e;t&&(this.sortParam.asc?(this.sortParam.column=this.defaultId,this.sortParam.asc=!1,r=this.defaultId):this.sortParam.column===r?this.sortParam.asc=!this.sortParam.asc:(this.sortParam.column=r,this.sortParam.asc=!1),this.sort=this.sortParam);for(let i of this.sortSettings[r])ce(i.type,e,i.prop,r===this.defaultId?!1:this.sortParam.asc);return[...e]}};export{Re as a,Ae as b,Qe as c,fe as d};
@@ -1 +1 @@
1
- import{a as vt,c as yt,d as L,e as J,g as bt}from"./chunk-QFRQQ4K3.js";import{a as _t,b as kt}from"./chunk-UV4UIX6J.js";import{f as Ct}from"./chunk-ATLT5DK5.js";import{f as ft,g as St,h as gt}from"./chunk-RAVRSB6R.js";import{A as Xe,Da as he,Ea as N,Fa as O,Ga as st,Ia as at,Na as de,Pa as ue,R as Q,Sb as B,Wa as lt,gb as ct,ib as pt,ob as mt,pa as x,qb as ht,sa as rt,tb as dt,v as We,w as Ge,y as Ze,yb as ut,z as Ye}from"./chunk-NU3TPXFY.js";import{d as G}from"./chunk-UGSGMP2I.js";import{$d as Qe,$f as me,Ad as X,Bb as q,Bd as qe,Ce as et,Dd as z,Eb as w,Ec as Le,Fb as u,Fe as tt,G as ie,He as it,L as Ce,Le as nt,Mc as W,Qb as l,Rb as $,Sa as a,Sb as T,Tb as Ae,Ub as ae,Vb as le,Wb as ce,Xa as I,Xc as Te,Xd as ze,Yc as De,Zb as we,_c as Z,ab as K,ad as Ne,ag as ot,bc as _,bd as Re,bg as D,ca as R,cd as pe,dc as k,ed as f,f as _e,fa as ve,fb as S,fd as Pe,gd as Fe,ha as y,hd as Me,jd as $e,kd as Oe,lb as c,ld as Be,mb as Ie,md as He,nb as j,nd as Ue,oa as ye,ob as re,od as je,p as U,pa as P,pb as M,pe as Je,qa as F,rb as g,rc as xe,sb as Ee,sd as Ve,t as ke,tb as oe,td as Ke,ub as se,ud as Y,v,vb as o,wa as ne,wb as s,xa as be,xb as d}from"./chunk-FPEGN42P.js";import{a as C,b as A,c as ge}from"./chunk-GAL4ENT6.js";function Ft(n,p){if(n&1&&d(0,"fa-icon",2),n&2){let e=u();re(e.repository.class),Ie("min-width",e.galleryMode.dimensions/3,"px")("min-height",e.galleryMode.dimensions/3,"px")("font-size",e.galleryMode.faSize/1.8,"px"),c("icon",e.repository.icon)}}function Mt(n,p){if(n&1&&d(0,"fa-icon",5),n&2){let e=u(2);re(e.repository.class),c("icon",e.repository.icon)}}function $t(n,p){if(n&1&&(l(0),_(1,"translate")),n&2){let e=u(2);T(" ",k(1,1,e.repository.label,e.locale.language)," ")}}function Ot(n,p){if(n&1&&l(0),n&2){let e=u(2);T(" ",e.repository.label," ")}}function Bt(n,p){if(n&1&&(o(0,"div",1),S(1,Mt,1,3,"fa-icon",3),o(2,"span",4),S(3,$t,2,4)(4,Ot,1,1),s()()),n&2){let e=u();a(),g(e.showIcon?1:-1),a(2),g(e.repository.translate?3:4)}}var Et=(()=>{class n{constructor(e,i){this.locale=e,this.layout=i,this.showIcon=!0,this.showFullPath=!1,this.unknownRepository={icon:et,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:N.SHARES,label:this.share.parent.name,class:"circle-purple-icon",translate:!1}:this.share.file?.ownerId?this.repository={icon:N.PERSONAL,label:he.PERSONAL_FILES,class:"circle-primary-icon",translate:!0}:this.share.file?.space?.alias?this.repository={icon:N.SPACES,label:`${this.share.file.space.name}`,class:"circle-primary-icon",translate:!1}:this.share.externalPath?this.repository={icon:N.EXTERNAL,label:"External",class:"circle-primary-icon",translate:!0}:this.repository=C({},this.unknownRepository),this.showFullPath&&this.setFullPath()}setFullPath(){if(!this.repository.label)return;let e=this.share.file?.path?this.share.file.path.split("/").filter(i=>i&&i!=="."):[];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===he.PERSONAL_FILES&&(this.repository.label=this.layout.translateString(this.repository.label)),e.length&&(this.repository.label=`${this.repository.label}/${e.join("/")}`)}static{this.\u0275fac=function(i){return new(i||n)(I(Y),I(B))}}static{this.\u0275cmp=K({type:n,selectors:[["app-share-repository"]],inputs:{share:"share",galleryMode:"galleryMode",showIcon:"showIcon",showFullPath:"showFullPath"},features:[ye],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(i,t){i&1&&S(0,Ft,1,9,"fa-icon",0)(1,Bt,5,2,"div",1),i&2&&g(t.galleryMode?0:1)},dependencies:[X,z],encapsulation:2})}}return n})();var h={BASE:`${Q}/shares`,LIST:"list",CHILDREN:"children",LINKS:"links",LINKS_LIST:"links/list",LINKS_UUID:"links/uuid"},At=`${h.BASE}/${h.LIST}`,V=`${h.BASE}/${h.LINKS}`,wt=`${h.BASE}/${h.LINKS_LIST}`,xt=`${h.BASE}/${h.LINKS_UUID}`;var Lt=(()=>{class n{constructor(e,i){this.http=e,this.router=i}getShare(e){return this.http.get(`${h.BASE}/${e}`).pipe(v(i=>new L(i)))}createShare(e){return this.http.post(h.BASE,e).pipe(v(i=>new L(i)))}updateShare(e){return this.http.put(`${h.BASE}/${e.id}`,e).pipe(v(i=>new L(i)))}deleteShare(e){return this.http.delete(`${h.BASE}/${e}`)}listShares(){return this.http.get(At)}getShareChild(e,i){return this.http.get(`${h.BASE}/${e}/${h.CHILDREN}/${i}`).pipe(v(t=>new L(t)))}updateShareChild(e,i,t){return this.http.put(`${h.BASE}/${e}/${h.CHILDREN}/${i}`,t).pipe(v(r=>new L(r)))}deleteShareChild(e,i){return this.http.delete(`${h.BASE}/${e}/${h.CHILDREN}/${i}`)}listChildShares(e){return this.http.get(`${h.BASE}/${e}/${h.CHILDREN}`)}initShareFromFile(e,i,t=!1,r=!1){let m,b=null,E=C({id:0,name:"",createdAt:new Date,modifiedAt:new Date,enabled:!0},t?{parent:{id:0,ownerId:0,alias:i.space.alias,name:i.space.name}}:{});if(i){r&&(b=i.root.id);let Se=null;(i?.root?.owner.login===e.login||!i?.space?.alias)&&(i.space=null,Se=e.id),m=new L(A(C({},E),{name:i.name,file:A(C({},i),{path:r?".":lt(i.path,2),ownerId:Se})}))}else m=new L(E);return[m,b]}goTo(e){if(!e.id)return ke(U(!1));if(e.externalPath&&!e.parent?.id)return this.router.navigate([O.SPACES_SHARES],{queryParams:{select:e.name}});if(e.parent?.id&&!e.file?.id&&e.file?.path.indexOf("/")===-1)return this.router.navigate([O.SPACES_SHARES],{queryParams:{select:e.parent.name}});{let[i,t]=yt(e);return this.router.navigate([i],{queryParams:{select:t}})}}static{this.\u0275fac=function(i){return new(i||n)(y(W),y(G))}}static{this.\u0275prov=R({token:n,factory:n.\u0275fac,providedIn:"root"})}}return n})();var H={BASE:`${Q}/link`,LINK:"link",VALIDATION:"validation",ACCESS:"access",AUTH:"auth"},Tt=`${H.BASE}/${H.VALIDATION}`,fe=`${H.BASE}/${H.ACCESS}`,Dt=`${H.BASE}/${H.AUTH}`;var Nt=new ve("WindowToken",typeof window<"u"&&window.document?{providedIn:"root",factory:()=>window}:{providedIn:"root",factory:()=>{}});var Rt=(()=>{class n{constructor(e,i,t){this.ngZone=e,this.document=i,this.window=t,this.copySubject=new _e,this.copyResponse$=this.copySubject.asObservable(),this.config={}}configure(e){this.config=e}copy(e){if(!this.isSupported||!e)return this.pushCopyResponse({isSuccess:!1,content:e});let i=this.copyFromContent(e);return i?this.pushCopyResponse({content:e,isSuccess:i}):this.pushCopyResponse({isSuccess:!1,content:e})}get isSupported(){return!!this.document.queryCommandSupported&&!!this.document.queryCommandSupported("copy")&&!!this.window}isTargetValid(e){if(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement){if(e.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(e,i=!0){try{this.selectTarget(e);let t=this.copyText();return this.clearSelection(i?e:void 0,this.window),t&&this.isCopySuccessInIE11()}catch{return!1}}isCopySuccessInIE11(){let e=this.window.clipboardData;return!(e&&e.getData&&!e.getData("Text"))}copyFromContent(e,i=this.document.body){if(this.tempTextArea&&!i.contains(this.tempTextArea)&&this.destroy(this.tempTextArea.parentElement||void 0),!this.tempTextArea){this.tempTextArea=this.createTempTextArea(this.document,this.window);try{i.appendChild(this.tempTextArea)}catch{throw new Error("Container should be a Dom element")}}this.tempTextArea.value=e;let t=this.copyFromInputElement(this.tempTextArea,!1);return this.config.cleanUpAfterCopy&&this.destroy(this.tempTextArea.parentElement||void 0),t}destroy(e=this.document.body){this.tempTextArea&&(e.removeChild(this.tempTextArea),this.tempTextArea=void 0)}selectTarget(e){return e.select(),e.setSelectionRange(0,e.value.length),e.value.length}copyText(){return this.document.execCommand("copy")}clearSelection(e,i){e&&e.focus(),i.getSelection()?.removeAllRanges()}createTempTextArea(e,i){let t=e.documentElement.getAttribute("dir")==="rtl",r;r=e.createElement("textarea"),r.style.fontSize="12pt",r.style.border="0",r.style.padding="0",r.style.margin="0",r.style.position="absolute",r.style[t?"right":"left"]="-9999px";let m=i.pageYOffset||e.documentElement.scrollTop;return r.style.top=m+"px",r.setAttribute("readonly",""),r}pushCopyResponse(e){this.copySubject.observers.length>0&&this.ngZone.run(()=>{this.copySubject.next(e)})}pushCopyReponse(e){this.pushCopyResponse(e)}}return n.\u0275fac=function(e){return new(e||n)(y(be),y(xe),y(Nt,8))},n.\u0275prov=R({token:n,factory:n.\u0275fac,providedIn:"root"}),n})();var Pt=(()=>{class n{constructor(e,i,t,r,m){this.router=e,this.http=i,this.layout=t,this.authService=r,this.clipboard=m}shareLinksList(){return this.http.get(wt).pipe(v(e=>e.map(i=>new J(i))))}shareLink(e){return this.http.get(`${V}/${e}`).pipe(v(i=>new J(i)))}shareLinkChild(e,i){return this.http.get(`${V}/${e}/${h.CHILDREN}/${i}`).pipe(v(t=>new J(t)))}linkFromSpaceOrShare(e,i,t){return this.http.get(`${V}/${e}/${t}/${i}`)}linkValidation(e){return this.http.get(`${Tt}/${e}`).pipe(v(i=>i.ok?i.link:(i.error&&(i.error===me.UNAUTHORIZED?this.router.navigate([`${D.LINK}/${e}/${D.AUTH}`]).catch(t=>console.error(t)):this.router.navigate([`${D.LINK}/${e}/${i.error}`]).catch(t=>console.error(t))),!1)),ie(()=>(this.authService.logout(),U(!1))))}linkAccess(e,i){i.share?.isDir||i.space?.alias?this.http.get(`${fe}/${e}`).subscribe(t=>{this.authService.initUserFromResponse(t),i.space?this.router.navigate([O.SPACES],{queryParams:{select:i.space.name}}).catch(r=>console.error(r)):this.router.navigate([O.SPACES_SHARES],{queryParams:{select:i.share.name}}).catch(r=>console.error(r))}):pt(`${fe}/${e}`)}linkAuthentication(e,i){return this.http.post(`${Dt}/${e}`,{password:i}).pipe(v(t=>(this.authService.initUserFromResponse(t),this.router.navigate([`${D.LINK}/${e}`]).catch(r=>console.error(r)),!0)),ie(t=>(t.error.message===me.UNAUTHORIZED?this.layout.sendNotification("warning","Link","Bad password"):this.router.navigate([`${D.LINK}/${e}/${t.error.message}`]).catch(r=>console.error(r)),U(!1))))}copyLinkToClipboard(e){this.clipboard.copyFromContent(this.genLink(e))}genUUID(){return this.http.get(xt).pipe(v(e=>e.uuid))}createLinkDialog(e){this.genUUID().subscribe(i=>{let t=this.layout.openDialog(te,"md",{initialState:{link:{name:e.name,uuid:i,isActive:!0,nbAccess:0}}});this.subscribeToSubmitLinkModal(t,e)})}updateLinkFromSpaceOrShare(e,i,t,r){return this.http.put(`${V}/${e}/${t}/${i}`,r)}editLinkDialog(e,i,t){if(i.id===0||e?.linkSettings?.uuid){let r=this.layout.openDialog(te,"md",{initialState:{link:e.linkSettings}});this.subscribeToSubmitLinkModal(r,i,e)}else this.linkFromSpaceOrShare(e.linkId,i.id,t).subscribe({next:r=>{let m=this.layout.openDialog(te,"md",{initialState:{link:A(C({},r),{permissions:e.permissions})}});this.subscribeToSubmitLinkModal(m,i,e)},error:r=>this.layout.sendNotification("error","Link error",e.name||i.name,r)})}shareLinkGuestToMember(e,i,t){return new dt({id:e,linkId:i,name:t.name,description:t.email,createdAt:t.createdAt,permissions:t.permissions,type:at.LINK,spaceRole:rt.IS_MEMBER,linkSettings:t},[x.SHARE_INSIDE,x.SHARE_OUTSIDE])}subscribeToSubmitLinkModal(e,i,t){e.content.submitEvent.pipe(Ce(1)).subscribe(r=>{if(Object.keys(r).length){let m=Object.assign(e.content.link,r),b=this.shareLinkGuestToMember(m.userId||-(i.links.length+1),t?.linkId||-(i.links.length+1),m);b.linkId?i.links=[b,...i.links.filter(E=>E.linkId!==b.linkId)]:i.links=[b,...i.links]}e.content.layout.closeDialog()})}genLink(e){return`${document.location.origin}/#/${D.LINK}/${e}`}static{this.\u0275fac=function(i){return new(i||n)(y(G),y(W),y(B),y(Ct),y(Rt))}}static{this.\u0275prov=R({token:n,factory:n.\u0275fac,providedIn:"root"})}}return n})();var Wt=n=>({dateInputFormat:"YYYY-MM-DD",containerClass:"theme-dark-blue",returnFocusToInput:!0,minDate:n,showWeekNumbers:!1}),Gt=(n,p)=>p.key;function Zt(n,p){n&1&&(o(0,"span",4),l(1,"Edit link"),s())}function Yt(n,p){n&1&&(o(0,"span",4),l(1,"New link"),s())}function Xt(n,p){n&1&&d(0,"div",54)}function zt(n,p){if(n&1){let e=q();o(0,"button",53),_(1,"translate"),ce("ngModelChange",function(t){let r=P(e).$implicit,m=u(3);return le(m.permissions[r.key],t)||(m.permissions[r.key]=t),F(t)}),w("ngModelChange",function(){P(e);let t=u(3);return F(t.onPermissionChange())}),d(2,"fa-icon",50),s(),S(3,Xt,1,0,"div",54)}if(n&2){let e=p.$implicit,i=p.$index,t=p.$count,r=u(3);ae("ngModel",r.permissions[e.key]),c("tooltip",k(1,4,r.SPACES_PERMISSIONS_TEXT[e.key].text,r.locale.language)),a(2),c("icon",r.SPACES_PERMISSIONS_TEXT[e.key].icon),a(),g(i===t-1?3:-1)}}function Qt(n,p){if(n&1&&(oe(0,zt,4,7,null,null,Gt),_(2,"keyvalue")),n&2){let e=u(2);se(k(2,0,e.permissions,e.originalOrderKeyValue))}}function Jt(n,p){if(n&1&&(o(0,"div",51),d(1,"app-share-repository",55),s()),n&2){let e=u(2);a(),c("share",e.share)("showIcon",!0)("showFullPath",!0)}}function ei(n,p){if(n&1){let e=q();o(0,"div",44),d(1,"fa-icon",45),o(2,"div",46)(3,"span"),l(4),s(),o(5,"span",47),l(6),s()(),o(7,"div",48),S(8,Qt,3,3),o(9,"button",49),_(10,"translate"),w("click",function(){P(e);let t=u();return F(t.toggleRequireAuth())}),d(11,"fa-icon",50),s(),o(12,"button",49),_(13,"translate"),w("click",function(){P(e);let t=u();return F(t.copyToClipboard())}),d(14,"fa-icon",50),s()()(),S(15,Jt,2,3,"div",51),d(16,"hr",52)}if(n&2){let e=u();a(),c("icon",e.icons.links),a(3),$(e.linkForm.value.name||e.linkForm.value.shareName),a(2),$(e.linkForm.value.email),a(2),g(e.share&&e.permissions?8:-1),a(),M("btn btn-sm ",e.linkForm.value.requireAuth?"btn-success":"btn-warning",""),c("tooltip",k(10,15,"Password",e.locale.language)),a(2),c("icon",e.linkForm.value.requireAuth?e.icons.faLock:e.icons.faLockOpen),a(),M("btn btn-sm ms-2 ",e.linkWasCopied?"btn-info":"btn-secondary",""),c("tooltip",k(13,18,"Copy link",e.locale.language)),a(2),c("icon",e.linkWasCopied?e.icons.faClipboardCheck:e.icons.faClipboard),a(),g(e.share?15:-1)}}function ti(n,p){if(n&1&&(o(0,"span"),l(1),s()),n&2){let e=u();M("badge rounded-pill ",(e.share?e.share.link.nbAccess:e.link.nbAccess)>=e.linkForm.value.limitAccess?"bg-danger":"bg-success",""),a(),Ae(" ",e.share?e.share.link.nbAccess:e.link.nbAccess,"/",e.linkForm.value.limitAccess," ")}}function ii(n,p){if(n&1&&(o(0,"span",20),l(1),s()),n&2){let e=u();a(),$(e.share?e.share.link.nbAccess:e.link.nbAccess)}}function ni(n,p){if(n&1&&(o(0,"div",27)(1,"label",56),l(2,"Share name"),s(),d(3,"input",57),_(4,"translate"),s(),o(5,"div",27)(6,"label",58),l(7,"Share description"),s(),d(8,"input",59),_(9,"translate"),s()),n&2){let e=u();a(3),j("is-invalid",e.linkForm.controls.shareName.invalid),c("placeholder",k(4,4,"Share name",e.locale.language)),a(5),c("placeholder",k(9,7,"Share description",e.locale.language))}}function ri(n,p){if(n&1&&(o(0,"option",30),l(1),s()),n&2){let e=p.$implicit;c("ngValue",e),a(),$(e)}}function oi(n,p){if(n&1&&(o(0,"div",37),d(1,"app-password-strength-bar",60),s()),n&2){let e=u();a(),c("passwordToCheck",e.password)}}function si(n,p){if(n&1){let e=q();o(0,"button",61),w("click",function(){P(e);let t=u();return F(t.confirmDeletion=!0)}),l(1," Remove "),s()}if(n&2){let e=u();c("disabled",e.confirmDeletion)}}var te=(()=>{class n{constructor(e,i,t,r,m,b){this.locale=e,this.layout=i,this.userService=t,this.sharesService=r,this.linksService=m,this.spacesService=b,this.parentSpaceId=null,this.isSharesRepo=!1,this.inSharesList=!1,this.submitEvent=new ne,this.shareChange=new ne,this.confirmDeletion=!1,this.submitted=!1,this.SPACES_PERMISSIONS_TEXT=st,this.originalOrderKeyValue=ct,this.icons={faEye:nt,faEyeSlash:Qe,links:N.LINKS,faClipboard:Je,faClipboardCheck:it,faLock:ze,faLockOpen:tt},this.languages=this.layout.getLanguages(),this.minDate=de(),this.defaultPassword=this.layout.translateString(ut),this.passwordMinLength=8,this.password="",this.linkIsExpired=!1,this.linkIsHovered=!1,this.linkWasCopied=!1,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))}initFile(){let e=this.sharesService.initShareFromFile(this.userService.user,this.file,this.isSharesRepo,this.inSharesList)[0];this.share=A(C({},e),{link:{id:-1,userId:-1,uuid:"",isActive:!0,requireAuth:!1,permissions:"",nbAccess:0,limitAccess:0}}),this.linksService.genUUID().subscribe(i=>this.share.link.uuid=i),this.initShareLink(),this.onPermissionChange()}initShareLink(){this.linkForm=new pe({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=mt(this.share.file.permissions,this.share.link.permissions,[x.SHARE_INSIDE,x.SHARE_OUTSIDE,...this.share.file.isDir?[]:[x.DELETE,x.ADD]])}initLink(){this.linkForm=new pe({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=de()>=e}onPermissionChange(){let e=ht(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:r=>{this.layout.sendNotification("error","Delete share",this.share.name,r),this.layout.closeDialog()}});return}if(this.file?.id){let i=this.share,{link:t}=i,r=ge(i,["link"]),m=A(C(C({},t),this.linkForm.value),{password:this.mustIncludePassword()?this.password:void 0});r.name=ue("shareName",m),r.description=ue("shareDescription",m);let b=this.linksService.shareLinkGuestToMember(-1,-1,m);this.sharesService.createShare(A(C({},r),{type:vt.LINK,links:[b]})).subscribe({next:E=>{this.shareChange.emit(["add",E]),this.layout.sendNotification("success","Link created",t.name||E.name),this.layout.closeDialog()},error:E=>{this.layout.sendNotification("error","Link error",this.share.name,E),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,ot.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)}mustIncludePassword(){return!!this.password.length&&this.password!==this.defaultPassword}static{this.\u0275fac=function(i){return new(i||n)(I(Y),I(B),I(ft),I(Lt),I(Pt),I(bt))}}static{this.\u0275cmp=K({type:n,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(i,t){i&1&&(o(0,"div",0)(1,"h4",1),d(2,"fa-icon",2),o(3,"span"),l(4),s()(),o(5,"h4",3),S(6,Zt,2,0,"span",4)(7,Yt,2,0,"span",4),s(),o(8,"button",5),w("click",function(){return t.layout.closeDialog()}),s()(),o(9,"div",6),S(10,ei,17,21),o(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()}),o(15,"label",11),l(16,"Link"),s(),o(17,"span",12),l(18),s()(),o(19,"div",13)(20,"label",14),l(21,"Active"),s(),o(22,"div",15),d(23,"input",16),o(24,"span"),l(25),_(26,"translate"),s()()(),o(27,"div",13)(28,"label",17),l(29,"Current access count"),s(),o(30,"span",18),S(31,ti,2,5,"span",19)(32,ii,2,1,"span",20),s()(),S(33,ni,10,10),o(34,"div",21)(35,"label",22),l(36,"Guest name"),s(),d(37,"input",23),_(38,"translate"),s(),o(39,"div",24)(40,"label",25),l(41,"Guest email"),s(),d(42,"input",26),_(43,"translate"),s(),o(44,"div",27)(45,"label",28),l(46,"Guest language"),s(),o(47,"select",29),oe(48,ri,2,2,"option",30,Ee),s()(),o(50,"div",27)(51,"label",31),l(52,"Limit access"),s(),d(53,"input",32),_(54,"translate"),s(),o(55,"div",27)(56,"label",33),l(57,"Expiration"),s(),d(58,"input",34),_(59,"translate"),s(),o(60,"div",35)(61,"label",36),l(62,"Password"),s(),S(63,oi,2,1,"div",37),o(64,"div",15),d(65,"input",38),s(),o(66,"app-input-password",39),ce("passwordChange",function(m){return le(t.password,m)||(t.password=m),m}),s()()()()()(),o(67,"div",40),S(68,si,2,1,"button",41),o(69,"button",42),w("click",function(){return t.onCancel()}),l(70,"Cancel"),s(),o(71,"button",43),w("click",function(){return t.onSubmit()}),l(72),s()()),i&2&&(a(2),c("icon",t.icons.links),a(2),$(t.linkForm.value.name||t.linkForm.value.shareName),a(2),g(t.share!=null&&t.share.id||t.link!=null&&t.link.id?6:7),a(4),g(t.share||t.link?10:-1),a(),c("formGroup",t.linkForm),a(6),j("text-primary",t.linkIsHovered),a(),T(" ",t.share?t.share.link.uuid:t.link.uuid," "),a(6),M("badge rounded-pill ms-3 ",t.linkForm.value.isActive?"bg-primary":"bg-danger",""),a(),T(" ",k(26,35,t.linkForm.value.isActive?"yes":"no",t.locale.language)," "),a(6),g(t.linkForm.value.limitAccess?31:32),a(2),g(t.share?33:-1),a(4),c("placeholder",k(38,38,"Guest name",t.locale.language)),a(5),j("is-invalid",t.linkForm.controls.email.invalid),c("placeholder",k(43,41,"Guest email",t.locale.language)),a(6),se(t.languages),a(5),c("placeholder",k(54,44,"Unlimited",t.locale.language)),a(5),j("text-danger",t.linkIsExpired),c("placeholder",k(59,47,"Unlimited",t.locale.language))("bsConfig",we(50,Wt,t.minDate)),a(5),g(t.linkForm.value.requireAuth&&t.password!==t.defaultPassword?63:-1),a(3),c("isRequired",t.linkForm.value.requireAuth)("disabled",!t.linkForm.value.requireAuth)("passwordMinLength",t.passwordMinLength),ae("password",t.password),c("showGenerator",!0),a(2),g(t.share!=null&&t.share.id?68:-1),a(3),M("btn btn-sm ",t.confirmDeletion?"btn-danger":"btn-primary",""),c("disabled",t.linkForm.invalid||t.linkForm.controls.requireAuth.value&&t.password.length<t.passwordMinLength||t.submitted),a(),T(" ",t.confirmDeletion?"Confirm deletion":"Confirm"," "))},dependencies:[z,qe,Xe,Ze,Ye,gt,St,Ve,Fe,He,Ue,De,Me,Te,Be,Ne,Re,je,Pe,_t,Le,Ge,We,X,Ke,$e,Oe,Et,kt],encapsulation:2})}}return n})();export{Et as a,Lt as b,te as c,Rt as d,Pt as e};
1
+ import{a as vt,c as yt,d as L,e as J,g as bt}from"./chunk-2SX3MVH3.js";import{a as _t,b as kt}from"./chunk-2CQOSX2Q.js";import{f as Ct}from"./chunk-Y6IYSEKU.js";import{f as ft,g as St,h as gt}from"./chunk-ZZGFGD5E.js";import{A as Xe,Da as he,Ea as N,Fa as O,Ga as st,Ia as at,Na as de,Pa as ue,R as Q,Sb as B,Wa as lt,gb as ct,ib as pt,ob as mt,pa as x,qb as ht,sa as rt,tb as dt,v as We,w as Ge,y as Ze,yb as ut,z as Ye}from"./chunk-HDDBV3QQ.js";import{d as G}from"./chunk-UGSGMP2I.js";import{$d as Qe,$f as me,Ad as X,Bb as q,Bd as qe,Ce as et,Dd as z,Eb as w,Ec as Le,Fb as u,Fe as tt,G as ie,He as it,L as Ce,Le as nt,Mc as W,Qb as l,Rb as $,Sa as a,Sb as T,Tb as Ae,Ub as ae,Vb as le,Wb as ce,Xa as I,Xc as Te,Xd as ze,Yc as De,Zb as we,_c as Z,ab as K,ad as Ne,ag as ot,bc as _,bd as Re,bg as D,ca as R,cd as pe,dc as k,ed as f,f as _e,fa as ve,fb as S,fd as Pe,gd as Fe,ha as y,hd as Me,jd as $e,kd as Oe,lb as c,ld as Be,mb as Ie,md as He,nb as j,nd as Ue,oa as ye,ob as re,od as je,p as U,pa as P,pb as M,pe as Je,qa as F,rb as g,rc as xe,sb as Ee,sd as Ve,t as ke,tb as oe,td as Ke,ub as se,ud as Y,v,vb as o,wa as ne,wb as s,xa as be,xb as d}from"./chunk-FPEGN42P.js";import{a as C,b as A,c as ge}from"./chunk-GAL4ENT6.js";function Ft(n,p){if(n&1&&d(0,"fa-icon",2),n&2){let e=u();re(e.repository.class),Ie("min-width",e.galleryMode.dimensions/3,"px")("min-height",e.galleryMode.dimensions/3,"px")("font-size",e.galleryMode.faSize/1.8,"px"),c("icon",e.repository.icon)}}function Mt(n,p){if(n&1&&d(0,"fa-icon",5),n&2){let e=u(2);re(e.repository.class),c("icon",e.repository.icon)}}function $t(n,p){if(n&1&&(l(0),_(1,"translate")),n&2){let e=u(2);T(" ",k(1,1,e.repository.label,e.locale.language)," ")}}function Ot(n,p){if(n&1&&l(0),n&2){let e=u(2);T(" ",e.repository.label," ")}}function Bt(n,p){if(n&1&&(o(0,"div",1),S(1,Mt,1,3,"fa-icon",3),o(2,"span",4),S(3,$t,2,4)(4,Ot,1,1),s()()),n&2){let e=u();a(),g(e.showIcon?1:-1),a(2),g(e.repository.translate?3:4)}}var Et=(()=>{class n{constructor(e,i){this.locale=e,this.layout=i,this.showIcon=!0,this.showFullPath=!1,this.unknownRepository={icon:et,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:N.SHARES,label:this.share.parent.name,class:"circle-purple-icon",translate:!1}:this.share.file?.ownerId?this.repository={icon:N.PERSONAL,label:he.PERSONAL_FILES,class:"circle-primary-icon",translate:!0}:this.share.file?.space?.alias?this.repository={icon:N.SPACES,label:`${this.share.file.space.name}`,class:"circle-primary-icon",translate:!1}:this.share.externalPath?this.repository={icon:N.EXTERNAL,label:"External",class:"circle-primary-icon",translate:!0}:this.repository=C({},this.unknownRepository),this.showFullPath&&this.setFullPath()}setFullPath(){if(!this.repository.label)return;let e=this.share.file?.path?this.share.file.path.split("/").filter(i=>i&&i!=="."):[];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===he.PERSONAL_FILES&&(this.repository.label=this.layout.translateString(this.repository.label)),e.length&&(this.repository.label=`${this.repository.label}/${e.join("/")}`)}static{this.\u0275fac=function(i){return new(i||n)(I(Y),I(B))}}static{this.\u0275cmp=K({type:n,selectors:[["app-share-repository"]],inputs:{share:"share",galleryMode:"galleryMode",showIcon:"showIcon",showFullPath:"showFullPath"},features:[ye],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(i,t){i&1&&S(0,Ft,1,9,"fa-icon",0)(1,Bt,5,2,"div",1),i&2&&g(t.galleryMode?0:1)},dependencies:[X,z],encapsulation:2})}}return n})();var h={BASE:`${Q}/shares`,LIST:"list",CHILDREN:"children",LINKS:"links",LINKS_LIST:"links/list",LINKS_UUID:"links/uuid"},At=`${h.BASE}/${h.LIST}`,V=`${h.BASE}/${h.LINKS}`,wt=`${h.BASE}/${h.LINKS_LIST}`,xt=`${h.BASE}/${h.LINKS_UUID}`;var Lt=(()=>{class n{constructor(e,i){this.http=e,this.router=i}getShare(e){return this.http.get(`${h.BASE}/${e}`).pipe(v(i=>new L(i)))}createShare(e){return this.http.post(h.BASE,e).pipe(v(i=>new L(i)))}updateShare(e){return this.http.put(`${h.BASE}/${e.id}`,e).pipe(v(i=>new L(i)))}deleteShare(e){return this.http.delete(`${h.BASE}/${e}`)}listShares(){return this.http.get(At)}getShareChild(e,i){return this.http.get(`${h.BASE}/${e}/${h.CHILDREN}/${i}`).pipe(v(t=>new L(t)))}updateShareChild(e,i,t){return this.http.put(`${h.BASE}/${e}/${h.CHILDREN}/${i}`,t).pipe(v(r=>new L(r)))}deleteShareChild(e,i){return this.http.delete(`${h.BASE}/${e}/${h.CHILDREN}/${i}`)}listChildShares(e){return this.http.get(`${h.BASE}/${e}/${h.CHILDREN}`)}initShareFromFile(e,i,t=!1,r=!1){let m,b=null,E=C({id:0,name:"",createdAt:new Date,modifiedAt:new Date,enabled:!0},t?{parent:{id:0,ownerId:0,alias:i.space.alias,name:i.space.name}}:{});if(i){r&&(b=i.root.id);let Se=null;(i?.root?.owner.login===e.login||!i?.space?.alias)&&(i.space=null,Se=e.id),m=new L(A(C({},E),{name:i.name,file:A(C({},i),{path:r?".":lt(i.path,2),ownerId:Se})}))}else m=new L(E);return[m,b]}goTo(e){if(!e.id)return ke(U(!1));if(e.externalPath&&!e.parent?.id)return this.router.navigate([O.SPACES_SHARES],{queryParams:{select:e.name}});if(e.parent?.id&&!e.file?.id&&e.file?.path.indexOf("/")===-1)return this.router.navigate([O.SPACES_SHARES],{queryParams:{select:e.parent.name}});{let[i,t]=yt(e);return this.router.navigate([i],{queryParams:{select:t}})}}static{this.\u0275fac=function(i){return new(i||n)(y(W),y(G))}}static{this.\u0275prov=R({token:n,factory:n.\u0275fac,providedIn:"root"})}}return n})();var H={BASE:`${Q}/link`,LINK:"link",VALIDATION:"validation",ACCESS:"access",AUTH:"auth"},Tt=`${H.BASE}/${H.VALIDATION}`,fe=`${H.BASE}/${H.ACCESS}`,Dt=`${H.BASE}/${H.AUTH}`;var Nt=new ve("WindowToken",typeof window<"u"&&window.document?{providedIn:"root",factory:()=>window}:{providedIn:"root",factory:()=>{}});var Rt=(()=>{class n{constructor(e,i,t){this.ngZone=e,this.document=i,this.window=t,this.copySubject=new _e,this.copyResponse$=this.copySubject.asObservable(),this.config={}}configure(e){this.config=e}copy(e){if(!this.isSupported||!e)return this.pushCopyResponse({isSuccess:!1,content:e});let i=this.copyFromContent(e);return i?this.pushCopyResponse({content:e,isSuccess:i}):this.pushCopyResponse({isSuccess:!1,content:e})}get isSupported(){return!!this.document.queryCommandSupported&&!!this.document.queryCommandSupported("copy")&&!!this.window}isTargetValid(e){if(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement){if(e.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(e,i=!0){try{this.selectTarget(e);let t=this.copyText();return this.clearSelection(i?e:void 0,this.window),t&&this.isCopySuccessInIE11()}catch{return!1}}isCopySuccessInIE11(){let e=this.window.clipboardData;return!(e&&e.getData&&!e.getData("Text"))}copyFromContent(e,i=this.document.body){if(this.tempTextArea&&!i.contains(this.tempTextArea)&&this.destroy(this.tempTextArea.parentElement||void 0),!this.tempTextArea){this.tempTextArea=this.createTempTextArea(this.document,this.window);try{i.appendChild(this.tempTextArea)}catch{throw new Error("Container should be a Dom element")}}this.tempTextArea.value=e;let t=this.copyFromInputElement(this.tempTextArea,!1);return this.config.cleanUpAfterCopy&&this.destroy(this.tempTextArea.parentElement||void 0),t}destroy(e=this.document.body){this.tempTextArea&&(e.removeChild(this.tempTextArea),this.tempTextArea=void 0)}selectTarget(e){return e.select(),e.setSelectionRange(0,e.value.length),e.value.length}copyText(){return this.document.execCommand("copy")}clearSelection(e,i){e&&e.focus(),i.getSelection()?.removeAllRanges()}createTempTextArea(e,i){let t=e.documentElement.getAttribute("dir")==="rtl",r;r=e.createElement("textarea"),r.style.fontSize="12pt",r.style.border="0",r.style.padding="0",r.style.margin="0",r.style.position="absolute",r.style[t?"right":"left"]="-9999px";let m=i.pageYOffset||e.documentElement.scrollTop;return r.style.top=m+"px",r.setAttribute("readonly",""),r}pushCopyResponse(e){this.copySubject.observers.length>0&&this.ngZone.run(()=>{this.copySubject.next(e)})}pushCopyReponse(e){this.pushCopyResponse(e)}}return n.\u0275fac=function(e){return new(e||n)(y(be),y(xe),y(Nt,8))},n.\u0275prov=R({token:n,factory:n.\u0275fac,providedIn:"root"}),n})();var Pt=(()=>{class n{constructor(e,i,t,r,m){this.router=e,this.http=i,this.layout=t,this.authService=r,this.clipboard=m}shareLinksList(){return this.http.get(wt).pipe(v(e=>e.map(i=>new J(i))))}shareLink(e){return this.http.get(`${V}/${e}`).pipe(v(i=>new J(i)))}shareLinkChild(e,i){return this.http.get(`${V}/${e}/${h.CHILDREN}/${i}`).pipe(v(t=>new J(t)))}linkFromSpaceOrShare(e,i,t){return this.http.get(`${V}/${e}/${t}/${i}`)}linkValidation(e){return this.http.get(`${Tt}/${e}`).pipe(v(i=>i.ok?i.link:(i.error&&(i.error===me.UNAUTHORIZED?this.router.navigate([`${D.LINK}/${e}/${D.AUTH}`]).catch(t=>console.error(t)):this.router.navigate([`${D.LINK}/${e}/${i.error}`]).catch(t=>console.error(t))),!1)),ie(()=>(this.authService.logout(),U(!1))))}linkAccess(e,i){i.share?.isDir||i.space?.alias?this.http.get(`${fe}/${e}`).subscribe(t=>{this.authService.initUserFromResponse(t),i.space?this.router.navigate([O.SPACES],{queryParams:{select:i.space.name}}).catch(r=>console.error(r)):this.router.navigate([O.SPACES_SHARES],{queryParams:{select:i.share.name}}).catch(r=>console.error(r))}):pt(`${fe}/${e}`)}linkAuthentication(e,i){return this.http.post(`${Dt}/${e}`,{password:i}).pipe(v(t=>(this.authService.initUserFromResponse(t),this.router.navigate([`${D.LINK}/${e}`]).catch(r=>console.error(r)),!0)),ie(t=>(t.error.message===me.UNAUTHORIZED?this.layout.sendNotification("warning","Link","Bad password"):this.router.navigate([`${D.LINK}/${e}/${t.error.message}`]).catch(r=>console.error(r)),U(!1))))}copyLinkToClipboard(e){this.clipboard.copyFromContent(this.genLink(e))}genUUID(){return this.http.get(xt).pipe(v(e=>e.uuid))}createLinkDialog(e){this.genUUID().subscribe(i=>{let t=this.layout.openDialog(te,"md",{initialState:{link:{name:e.name,uuid:i,isActive:!0,nbAccess:0}}});this.subscribeToSubmitLinkModal(t,e)})}updateLinkFromSpaceOrShare(e,i,t,r){return this.http.put(`${V}/${e}/${t}/${i}`,r)}editLinkDialog(e,i,t){if(i.id===0||e?.linkSettings?.uuid){let r=this.layout.openDialog(te,"md",{initialState:{link:e.linkSettings}});this.subscribeToSubmitLinkModal(r,i,e)}else this.linkFromSpaceOrShare(e.linkId,i.id,t).subscribe({next:r=>{let m=this.layout.openDialog(te,"md",{initialState:{link:A(C({},r),{permissions:e.permissions})}});this.subscribeToSubmitLinkModal(m,i,e)},error:r=>this.layout.sendNotification("error","Link error",e.name||i.name,r)})}shareLinkGuestToMember(e,i,t){return new dt({id:e,linkId:i,name:t.name,description:t.email,createdAt:t.createdAt,permissions:t.permissions,type:at.LINK,spaceRole:rt.IS_MEMBER,linkSettings:t},[x.SHARE_INSIDE,x.SHARE_OUTSIDE])}subscribeToSubmitLinkModal(e,i,t){e.content.submitEvent.pipe(Ce(1)).subscribe(r=>{if(Object.keys(r).length){let m=Object.assign(e.content.link,r),b=this.shareLinkGuestToMember(m.userId||-(i.links.length+1),t?.linkId||-(i.links.length+1),m);b.linkId?i.links=[b,...i.links.filter(E=>E.linkId!==b.linkId)]:i.links=[b,...i.links]}e.content.layout.closeDialog()})}genLink(e){return`${document.location.origin}/#/${D.LINK}/${e}`}static{this.\u0275fac=function(i){return new(i||n)(y(G),y(W),y(B),y(Ct),y(Rt))}}static{this.\u0275prov=R({token:n,factory:n.\u0275fac,providedIn:"root"})}}return n})();var Wt=n=>({dateInputFormat:"YYYY-MM-DD",containerClass:"theme-dark-blue",returnFocusToInput:!0,minDate:n,showWeekNumbers:!1}),Gt=(n,p)=>p.key;function Zt(n,p){n&1&&(o(0,"span",4),l(1,"Edit link"),s())}function Yt(n,p){n&1&&(o(0,"span",4),l(1,"New link"),s())}function Xt(n,p){n&1&&d(0,"div",54)}function zt(n,p){if(n&1){let e=q();o(0,"button",53),_(1,"translate"),ce("ngModelChange",function(t){let r=P(e).$implicit,m=u(3);return le(m.permissions[r.key],t)||(m.permissions[r.key]=t),F(t)}),w("ngModelChange",function(){P(e);let t=u(3);return F(t.onPermissionChange())}),d(2,"fa-icon",50),s(),S(3,Xt,1,0,"div",54)}if(n&2){let e=p.$implicit,i=p.$index,t=p.$count,r=u(3);ae("ngModel",r.permissions[e.key]),c("tooltip",k(1,4,r.SPACES_PERMISSIONS_TEXT[e.key].text,r.locale.language)),a(2),c("icon",r.SPACES_PERMISSIONS_TEXT[e.key].icon),a(),g(i===t-1?3:-1)}}function Qt(n,p){if(n&1&&(oe(0,zt,4,7,null,null,Gt),_(2,"keyvalue")),n&2){let e=u(2);se(k(2,0,e.permissions,e.originalOrderKeyValue))}}function Jt(n,p){if(n&1&&(o(0,"div",51),d(1,"app-share-repository",55),s()),n&2){let e=u(2);a(),c("share",e.share)("showIcon",!0)("showFullPath",!0)}}function ei(n,p){if(n&1){let e=q();o(0,"div",44),d(1,"fa-icon",45),o(2,"div",46)(3,"span"),l(4),s(),o(5,"span",47),l(6),s()(),o(7,"div",48),S(8,Qt,3,3),o(9,"button",49),_(10,"translate"),w("click",function(){P(e);let t=u();return F(t.toggleRequireAuth())}),d(11,"fa-icon",50),s(),o(12,"button",49),_(13,"translate"),w("click",function(){P(e);let t=u();return F(t.copyToClipboard())}),d(14,"fa-icon",50),s()()(),S(15,Jt,2,3,"div",51),d(16,"hr",52)}if(n&2){let e=u();a(),c("icon",e.icons.links),a(3),$(e.linkForm.value.name||e.linkForm.value.shareName),a(2),$(e.linkForm.value.email),a(2),g(e.share&&e.permissions?8:-1),a(),M("btn btn-sm ",e.linkForm.value.requireAuth?"btn-success":"btn-warning",""),c("tooltip",k(10,15,"Password",e.locale.language)),a(2),c("icon",e.linkForm.value.requireAuth?e.icons.faLock:e.icons.faLockOpen),a(),M("btn btn-sm ms-2 ",e.linkWasCopied?"btn-info":"btn-secondary",""),c("tooltip",k(13,18,"Copy link",e.locale.language)),a(2),c("icon",e.linkWasCopied?e.icons.faClipboardCheck:e.icons.faClipboard),a(),g(e.share?15:-1)}}function ti(n,p){if(n&1&&(o(0,"span"),l(1),s()),n&2){let e=u();M("badge rounded-pill ",(e.share?e.share.link.nbAccess:e.link.nbAccess)>=e.linkForm.value.limitAccess?"bg-danger":"bg-success",""),a(),Ae(" ",e.share?e.share.link.nbAccess:e.link.nbAccess,"/",e.linkForm.value.limitAccess," ")}}function ii(n,p){if(n&1&&(o(0,"span",20),l(1),s()),n&2){let e=u();a(),$(e.share?e.share.link.nbAccess:e.link.nbAccess)}}function ni(n,p){if(n&1&&(o(0,"div",27)(1,"label",56),l(2,"Share name"),s(),d(3,"input",57),_(4,"translate"),s(),o(5,"div",27)(6,"label",58),l(7,"Share description"),s(),d(8,"input",59),_(9,"translate"),s()),n&2){let e=u();a(3),j("is-invalid",e.linkForm.controls.shareName.invalid),c("placeholder",k(4,4,"Share name",e.locale.language)),a(5),c("placeholder",k(9,7,"Share description",e.locale.language))}}function ri(n,p){if(n&1&&(o(0,"option",30),l(1),s()),n&2){let e=p.$implicit;c("ngValue",e),a(),$(e)}}function oi(n,p){if(n&1&&(o(0,"div",37),d(1,"app-password-strength-bar",60),s()),n&2){let e=u();a(),c("passwordToCheck",e.password)}}function si(n,p){if(n&1){let e=q();o(0,"button",61),w("click",function(){P(e);let t=u();return F(t.confirmDeletion=!0)}),l(1," Remove "),s()}if(n&2){let e=u();c("disabled",e.confirmDeletion)}}var te=(()=>{class n{constructor(e,i,t,r,m,b){this.locale=e,this.layout=i,this.userService=t,this.sharesService=r,this.linksService=m,this.spacesService=b,this.parentSpaceId=null,this.isSharesRepo=!1,this.inSharesList=!1,this.submitEvent=new ne,this.shareChange=new ne,this.confirmDeletion=!1,this.submitted=!1,this.SPACES_PERMISSIONS_TEXT=st,this.originalOrderKeyValue=ct,this.icons={faEye:nt,faEyeSlash:Qe,links:N.LINKS,faClipboard:Je,faClipboardCheck:it,faLock:ze,faLockOpen:tt},this.languages=this.layout.getLanguages(),this.minDate=de(),this.defaultPassword=this.layout.translateString(ut),this.passwordMinLength=8,this.password="",this.linkIsExpired=!1,this.linkIsHovered=!1,this.linkWasCopied=!1,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))}initFile(){let e=this.sharesService.initShareFromFile(this.userService.user,this.file,this.isSharesRepo,this.inSharesList)[0];this.share=A(C({},e),{link:{id:-1,userId:-1,uuid:"",isActive:!0,requireAuth:!1,permissions:"",nbAccess:0,limitAccess:0}}),this.linksService.genUUID().subscribe(i=>this.share.link.uuid=i),this.initShareLink(),this.onPermissionChange()}initShareLink(){this.linkForm=new pe({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=mt(this.share.file.permissions,this.share.link.permissions,[x.SHARE_INSIDE,x.SHARE_OUTSIDE,...this.share.file.isDir?[]:[x.DELETE,x.ADD]])}initLink(){this.linkForm=new pe({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=de()>=e}onPermissionChange(){let e=ht(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:r=>{this.layout.sendNotification("error","Delete share",this.share.name,r),this.layout.closeDialog()}});return}if(this.file?.id){let i=this.share,{link:t}=i,r=ge(i,["link"]),m=A(C(C({},t),this.linkForm.value),{password:this.mustIncludePassword()?this.password:void 0});r.name=ue("shareName",m),r.description=ue("shareDescription",m);let b=this.linksService.shareLinkGuestToMember(-1,-1,m);this.sharesService.createShare(A(C({},r),{type:vt.LINK,links:[b]})).subscribe({next:E=>{this.shareChange.emit(["add",E]),this.layout.sendNotification("success","Link created",t.name||E.name),this.layout.closeDialog()},error:E=>{this.layout.sendNotification("error","Link error",this.share.name,E),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,ot.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)}mustIncludePassword(){return!!this.password.length&&this.password!==this.defaultPassword}static{this.\u0275fac=function(i){return new(i||n)(I(Y),I(B),I(ft),I(Lt),I(Pt),I(bt))}}static{this.\u0275cmp=K({type:n,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(i,t){i&1&&(o(0,"div",0)(1,"h4",1),d(2,"fa-icon",2),o(3,"span"),l(4),s()(),o(5,"h4",3),S(6,Zt,2,0,"span",4)(7,Yt,2,0,"span",4),s(),o(8,"button",5),w("click",function(){return t.layout.closeDialog()}),s()(),o(9,"div",6),S(10,ei,17,21),o(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()}),o(15,"label",11),l(16,"Link"),s(),o(17,"span",12),l(18),s()(),o(19,"div",13)(20,"label",14),l(21,"Active"),s(),o(22,"div",15),d(23,"input",16),o(24,"span"),l(25),_(26,"translate"),s()()(),o(27,"div",13)(28,"label",17),l(29,"Current access count"),s(),o(30,"span",18),S(31,ti,2,5,"span",19)(32,ii,2,1,"span",20),s()(),S(33,ni,10,10),o(34,"div",21)(35,"label",22),l(36,"Guest name"),s(),d(37,"input",23),_(38,"translate"),s(),o(39,"div",24)(40,"label",25),l(41,"Guest email"),s(),d(42,"input",26),_(43,"translate"),s(),o(44,"div",27)(45,"label",28),l(46,"Guest language"),s(),o(47,"select",29),oe(48,ri,2,2,"option",30,Ee),s()(),o(50,"div",27)(51,"label",31),l(52,"Limit access"),s(),d(53,"input",32),_(54,"translate"),s(),o(55,"div",27)(56,"label",33),l(57,"Expiration"),s(),d(58,"input",34),_(59,"translate"),s(),o(60,"div",35)(61,"label",36),l(62,"Password"),s(),S(63,oi,2,1,"div",37),o(64,"div",15),d(65,"input",38),s(),o(66,"app-input-password",39),ce("passwordChange",function(m){return le(t.password,m)||(t.password=m),m}),s()()()()()(),o(67,"div",40),S(68,si,2,1,"button",41),o(69,"button",42),w("click",function(){return t.onCancel()}),l(70,"Cancel"),s(),o(71,"button",43),w("click",function(){return t.onSubmit()}),l(72),s()()),i&2&&(a(2),c("icon",t.icons.links),a(2),$(t.linkForm.value.name||t.linkForm.value.shareName),a(2),g(t.share!=null&&t.share.id||t.link!=null&&t.link.id?6:7),a(4),g(t.share||t.link?10:-1),a(),c("formGroup",t.linkForm),a(6),j("text-primary",t.linkIsHovered),a(),T(" ",t.share?t.share.link.uuid:t.link.uuid," "),a(6),M("badge rounded-pill ms-3 ",t.linkForm.value.isActive?"bg-primary":"bg-danger",""),a(),T(" ",k(26,35,t.linkForm.value.isActive?"yes":"no",t.locale.language)," "),a(6),g(t.linkForm.value.limitAccess?31:32),a(2),g(t.share?33:-1),a(4),c("placeholder",k(38,38,"Guest name",t.locale.language)),a(5),j("is-invalid",t.linkForm.controls.email.invalid),c("placeholder",k(43,41,"Guest email",t.locale.language)),a(6),se(t.languages),a(5),c("placeholder",k(54,44,"Unlimited",t.locale.language)),a(5),j("text-danger",t.linkIsExpired),c("placeholder",k(59,47,"Unlimited",t.locale.language))("bsConfig",we(50,Wt,t.minDate)),a(5),g(t.linkForm.value.requireAuth&&t.password!==t.defaultPassword?63:-1),a(3),c("isRequired",t.linkForm.value.requireAuth)("disabled",!t.linkForm.value.requireAuth)("passwordMinLength",t.passwordMinLength),ae("password",t.password),c("showGenerator",!0),a(2),g(t.share!=null&&t.share.id?68:-1),a(3),M("btn btn-sm ",t.confirmDeletion?"btn-danger":"btn-primary",""),c("disabled",t.linkForm.invalid||t.linkForm.controls.requireAuth.value&&t.password.length<t.passwordMinLength||t.submitted),a(),T(" ",t.confirmDeletion?"Confirm deletion":"Confirm"," "))},dependencies:[z,qe,Xe,Ze,Ye,gt,St,Ve,Fe,He,Ue,De,Me,Te,Be,Ne,Re,je,Pe,_t,Le,Ge,We,X,Ke,$e,Oe,Et,kt],encapsulation:2})}}return n})();export{Et as a,Lt as b,te as c,Rt as d,Pt as e};
@@ -1 +1 @@
1
- import{f as F}from"./chunk-RAVRSB6R.js";import{Bb as h,Ma as O,Qb as C,Rb as H,Sb as k,T,W as g,eb as d,na as N,vb as u}from"./chunk-NU3TPXFY.js";import{d as R}from"./chunk-UGSGMP2I.js";import{$ as x,G as p,Mc as A,O as _,Z as m,ca as I,ha as o,p as n,q as S,v as a}from"./chunk-FPEGN42P.js";var c=function(r){return r.ACCESS="access",r.REFRESH="refresh",r.WS="ws",r.CSRF="csrf",r}(c||{});var i=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}(i||{}),P=`${i.BASE}/${i.LOGIN}`,U=`${i.BASE}/${i.LOGOUT}`,f=`${i.BASE}/${i.REFRESH}`,v=`${i.BASE}/${i.TOKEN}`,w=`${i.BASE}/${i.TOKEN_REFRESH}`,M=`/${i.WS}`;var E="sync-in-csrf";var j=[c.REFRESH,c.ACCESS,c.WS,c.CSRF];var K="Client token is expired";var l={BASE:"auth",LOGIN:"login"};var fe=(()=>{class r{constructor(e,t,s,L,b,G){this.http=e,this.router=t,this.store=s,this.userService=L,this.layout=b,this.electron=G,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(P,{login:e,password:t}).pipe(a(s=>(this.accessExpiration=s.token.access_expiration,this.refreshExpiration=s.token.refresh_expiration,this.userService.initUser(s.user),{success:!0,message:null})),p(s=>(console.warn(s),n({success:!1,message:s.error.message||s.message}))))}loginElectron(){return this.electron.authenticate().pipe(m(e=>this.http.post(T,e).pipe(a(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(h.SERVER.AUTHENTICATION_TOKEN_UPDATE,t.client_token_update),!0)),p(t=>(console.warn(t),t.error.message===K?this.electron.send(h.SERVER.AUTHENTICATION_TOKEN_EXPIRED):this.electron.send(h.SERVER.AUTHENTICATION_FAILED),n(!1))))))}logout(e=!0,t=!1){if((e||t)&&this.store.userImpersonate()){this.logoutImpersonateUser();return}this.userService.disconnectWebSocket(),this.clearCookies().pipe(_(()=>{this.accessExpiration=0,this.refreshExpiration=0,this.layout.clean(),this.store.clean(),e&&this.router.navigate([l.BASE,l.LOGIN]).catch(s=>console.error(s)),t&&this.layout.sendNotification("warning","Session has expired","Please sign in")})).subscribe()}logoutImpersonateUser(){this.http.post(N,null).subscribe({next:e=>{this.userService.disconnectWebSocket(),this.initUserFromResponse(e),this.router.navigate([u.BASE,u.ACCOUNT]).catch(t=>console.error(t))},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(f,null).pipe(a(e=>(this.accessExpiration=e.access_expiration,this.refreshExpiration=e.refresh_expiration,console.debug("refresh token done"),!0)),p(e=>(console.debug("token has expired"),this.electron.enabled?(console.debug("login with app"),this.loginElectron()):(this.logout(!0,!0),S(()=>e)))))}checkUserAuthAndLoad(e){return this.refreshTokenHasExpired()?this.electron.enabled?this.loginElectron():(this.returnUrl=e.length>1?e:null,this.logout(),n(!1)):this.store.user.getValue()?n(!0):this.http.get(g).pipe(x(t=>this.userService.initUser(t.user)),a(()=>!0),p(t=>(t.status===401?this.logout():console.warn(t),n(!1))))}checkCSRF(e){return e.headers.has(E)?e.clone({headers:e.headers.set(E,d(E))}):e}refreshTokenHasExpired(){return this.refreshExpiration===0||O()>=this.refreshExpiration}clearCookies(){return this.http.post(U,null)}static{this.\u0275fac=function(t){return new(t||r)(o(A),o(R),o(C),o(F),o(k),o(H))}}static{this.\u0275prov=I({token:r,factory:r.\u0275fac,providedIn:"root"})}}return r})();export{P as a,U as b,f as c,E as d,l as e,fe as f};
1
+ import{f as F}from"./chunk-ZZGFGD5E.js";import{Bb as h,Ma as O,Qb as C,Rb as H,Sb as k,T,W as g,eb as d,na as N,vb as u}from"./chunk-HDDBV3QQ.js";import{d as R}from"./chunk-UGSGMP2I.js";import{$ as x,G as p,Mc as A,O as _,Z as m,ca as I,ha as o,p as n,q as S,v as a}from"./chunk-FPEGN42P.js";var c=function(r){return r.ACCESS="access",r.REFRESH="refresh",r.WS="ws",r.CSRF="csrf",r}(c||{});var i=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}(i||{}),P=`${i.BASE}/${i.LOGIN}`,U=`${i.BASE}/${i.LOGOUT}`,f=`${i.BASE}/${i.REFRESH}`,v=`${i.BASE}/${i.TOKEN}`,w=`${i.BASE}/${i.TOKEN_REFRESH}`,M=`/${i.WS}`;var E="sync-in-csrf";var j=[c.REFRESH,c.ACCESS,c.WS,c.CSRF];var K="Client token is expired";var l={BASE:"auth",LOGIN:"login"};var fe=(()=>{class r{constructor(e,t,s,L,b,G){this.http=e,this.router=t,this.store=s,this.userService=L,this.layout=b,this.electron=G,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(P,{login:e,password:t}).pipe(a(s=>(this.accessExpiration=s.token.access_expiration,this.refreshExpiration=s.token.refresh_expiration,this.userService.initUser(s.user),{success:!0,message:null})),p(s=>(console.warn(s),n({success:!1,message:s.error.message||s.message}))))}loginElectron(){return this.electron.authenticate().pipe(m(e=>this.http.post(T,e).pipe(a(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(h.SERVER.AUTHENTICATION_TOKEN_UPDATE,t.client_token_update),!0)),p(t=>(console.warn(t),t.error.message===K?this.electron.send(h.SERVER.AUTHENTICATION_TOKEN_EXPIRED):this.electron.send(h.SERVER.AUTHENTICATION_FAILED),n(!1))))))}logout(e=!0,t=!1){if((e||t)&&this.store.userImpersonate()){this.logoutImpersonateUser();return}this.userService.disconnectWebSocket(),this.clearCookies().pipe(_(()=>{this.accessExpiration=0,this.refreshExpiration=0,this.layout.clean(),this.store.clean(),e&&this.router.navigate([l.BASE,l.LOGIN]).catch(s=>console.error(s)),t&&this.layout.sendNotification("warning","Session has expired","Please sign in")})).subscribe()}logoutImpersonateUser(){this.http.post(N,null).subscribe({next:e=>{this.userService.disconnectWebSocket(),this.initUserFromResponse(e),this.router.navigate([u.BASE,u.ACCOUNT]).catch(t=>console.error(t))},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(f,null).pipe(a(e=>(this.accessExpiration=e.access_expiration,this.refreshExpiration=e.refresh_expiration,console.debug("refresh token done"),!0)),p(e=>(console.debug("token has expired"),this.electron.enabled?(console.debug("login with app"),this.loginElectron()):(this.logout(!0,!0),S(()=>e)))))}checkUserAuthAndLoad(e){return this.refreshTokenHasExpired()?this.electron.enabled?this.loginElectron():(this.returnUrl=e.length>1?e:null,this.logout(),n(!1)):this.store.user.getValue()?n(!0):this.http.get(g).pipe(x(t=>this.userService.initUser(t.user)),a(()=>!0),p(t=>(t.status===401?this.logout():console.warn(t),n(!1))))}checkCSRF(e){return e.headers.has(E)?e.clone({headers:e.headers.set(E,d(E))}):e}refreshTokenHasExpired(){return this.refreshExpiration===0||O()>=this.refreshExpiration}clearCookies(){return this.http.post(U,null)}static{this.\u0275fac=function(t){return new(t||r)(o(A),o(R),o(C),o(F),o(k),o(H))}}static{this.\u0275prov=I({token:r,factory:r.\u0275fac,providedIn:"root"})}}return r})();export{P as a,U as b,f as c,E as d,l as e,fe as f};
@@ -1 +1 @@
1
- import{e as R}from"./chunk-MEKYVWV4.js";import"./chunk-QFRQQ4K3.js";import"./chunk-UV4UIX6J.js";import"./chunk-ATLT5DK5.js";import"./chunk-RAVRSB6R.js";import"./chunk-NU3TPXFY.js";import{k as j,l as D}from"./chunk-ZZ3LHYOY.js";import{b as _,e as w}from"./chunk-UGSGMP2I.js";import{Ad as M,Bd as T,Dd as E,Eb as d,Ma as m,Qb as f,Sa as t,Ub as g,Vb as v,Wb as k,Xa as p,Yc as P,ab as h,ad as L,bc as b,dc as y,fd as C,fe as I,lb as n,le as U,sd as S,ud as A,vb as i,wb as o,xb as s}from"./chunk-FPEGN42P.js";import"./chunk-GAL4ENT6.js";var H=(()=>{class l{constructor(c,r,e){this.locale=c,this.activatedRoute=r,this.linksService=e,this.logoUrl=j,this.linkProtected=D,this.icons={faKey:I,faSignInAlt:U},this.password="",this.activatedRoute.params.subscribe(a=>this.uuid=a.uuid)}validPassword(){this.password&&this.linksService.linkAuthentication(this.uuid,this.password).subscribe(()=>this.password="")}static{this.\u0275fac=function(r){return new(r||l)(p(A),p(_),p(R))}}static{this.\u0275cmp=h({type:l,selectors:[["app-public-link-auth"]],decls:18,vars:10,consts:[[1,"link-page"],[1,"header"],["routerLink",""],["alt","","height","40",3,"src"],["alt","","height","96",1,"cursor-pointer",3,"click","src"],[1,"d-flex","mt-2","ms-auto","me-auto",2,"width","250px"],[1,"input-group"],[1,"input-group-text","bg-gray-light"],[3,"icon"],["autocomplete","off","type","password",1,"form-control","border-0",3,"ngModelChange","keyup.enter","ngModel","placeholder"],["type","button",1,"btn","btn-default","btn-custom","border-0",3,"click","disabled"],[1,"error-text","no-select"],[1,"hr"],["l10nTranslate","",1,"solve"]],template:function(r,e){r&1&&(i(0,"div",0)(1,"div",1)(2,"a",2),s(3,"img",3),o()(),i(4,"img",4),d("click",function(){return e.validPassword()}),o(),i(5,"div",5)(6,"div",6)(7,"span",7),s(8,"fa-icon",8),o(),i(9,"input",9),b(10,"translate"),k("ngModelChange",function(u){return v(e.password,u)||(e.password=u),u}),d("keyup.enter",function(){return e.validPassword()}),o(),i(11,"button",10),d("click",function(){return e.validPassword()}),s(12,"fa-icon",8),o()()(),i(13,"div",11),s(14,"span",12),i(15,"div")(16,"span",13),f(17,"This share is protected by a password"),o()()()()),r&2&&(t(3),n("src",e.logoUrl,m),t(),n("src",e.linkProtected,m),t(4),n("icon",e.icons.faKey),t(),g("ngModel",e.password),n("placeholder",y(10,7,"Password",e.locale.language)),t(2),n("disabled",!(e.password!=null&&e.password.length)),t(),n("icon",e.icons.faSignInAlt))},dependencies:[w,S,P,L,C,E,M,T],encapsulation:2})}}return l})();export{H as PublicLinkAuthComponent};
1
+ import{e as R}from"./chunk-WQPVP63E.js";import"./chunk-2SX3MVH3.js";import"./chunk-2CQOSX2Q.js";import"./chunk-Y6IYSEKU.js";import"./chunk-ZZGFGD5E.js";import"./chunk-HDDBV3QQ.js";import{k as j,l as D}from"./chunk-ZZ3LHYOY.js";import{b as _,e as w}from"./chunk-UGSGMP2I.js";import{Ad as M,Bd as T,Dd as E,Eb as d,Ma as m,Qb as f,Sa as t,Ub as g,Vb as v,Wb as k,Xa as p,Yc as P,ab as h,ad as L,bc as b,dc as y,fd as C,fe as I,lb as n,le as U,sd as S,ud as A,vb as i,wb as o,xb as s}from"./chunk-FPEGN42P.js";import"./chunk-GAL4ENT6.js";var H=(()=>{class l{constructor(c,r,e){this.locale=c,this.activatedRoute=r,this.linksService=e,this.logoUrl=j,this.linkProtected=D,this.icons={faKey:I,faSignInAlt:U},this.password="",this.activatedRoute.params.subscribe(a=>this.uuid=a.uuid)}validPassword(){this.password&&this.linksService.linkAuthentication(this.uuid,this.password).subscribe(()=>this.password="")}static{this.\u0275fac=function(r){return new(r||l)(p(A),p(_),p(R))}}static{this.\u0275cmp=h({type:l,selectors:[["app-public-link-auth"]],decls:18,vars:10,consts:[[1,"link-page"],[1,"header"],["routerLink",""],["alt","","height","40",3,"src"],["alt","","height","96",1,"cursor-pointer",3,"click","src"],[1,"d-flex","mt-2","ms-auto","me-auto",2,"width","250px"],[1,"input-group"],[1,"input-group-text","bg-gray-light"],[3,"icon"],["autocomplete","off","type","password",1,"form-control","border-0",3,"ngModelChange","keyup.enter","ngModel","placeholder"],["type","button",1,"btn","btn-default","btn-custom","border-0",3,"click","disabled"],[1,"error-text","no-select"],[1,"hr"],["l10nTranslate","",1,"solve"]],template:function(r,e){r&1&&(i(0,"div",0)(1,"div",1)(2,"a",2),s(3,"img",3),o()(),i(4,"img",4),d("click",function(){return e.validPassword()}),o(),i(5,"div",5)(6,"div",6)(7,"span",7),s(8,"fa-icon",8),o(),i(9,"input",9),b(10,"translate"),k("ngModelChange",function(u){return v(e.password,u)||(e.password=u),u}),d("keyup.enter",function(){return e.validPassword()}),o(),i(11,"button",10),d("click",function(){return e.validPassword()}),s(12,"fa-icon",8),o()()(),i(13,"div",11),s(14,"span",12),i(15,"div")(16,"span",13),f(17,"This share is protected by a password"),o()()()()),r&2&&(t(3),n("src",e.logoUrl,m),t(),n("src",e.linkProtected,m),t(4),n("icon",e.icons.faKey),t(),g("ngModel",e.password),n("placeholder",y(10,7,"Password",e.locale.language)),t(2),n("disabled",!(e.password!=null&&e.password.length)),t(),n("icon",e.icons.faSignInAlt))},dependencies:[w,S,P,L,C,E,M,T],encapsulation:2})}}return l})();export{H as PublicLinkAuthComponent};
@@ -1 +1 @@
1
- import{a as B}from"./chunk-7WRQICEB.js";import{a as fe}from"./chunk-RUNMEQOV.js";import{a as me}from"./chunk-3V7XYPSJ.js";import{a as D,b as R,c as _e,d as de}from"./chunk-Z6IHRUVL.js";import"./chunk-UV4UIX6J.js";import{f as pe}from"./chunk-RAVRSB6R.js";import{Cb as ae,Db as le,Eb as ce,N as ne,Sb as ue,gb as oe,v as W,vb as P,wb as re,xb as se}from"./chunk-NU3TPXFY.js";import{Ad as K,Bb as T,Bd as q,Bf as te,Dd as z,Eb as x,Ec as O,Fb as r,Ff as ie,L as $,Ma as N,Mb as G,Me as X,Nb as S,Ob as F,Oe as Y,Qb as m,Rb as U,Sa as a,Sb as y,Tb as L,Xa as A,ab as Q,bc as g,cc as M,dc as h,fb as f,fe as J,lb as d,mb as I,nb as E,ob as k,pa as p,pf as Z,qa as _,qb as H,rb as v,tb as w,ub as b,ud as j,vb as l,wb as c,wf as ee,xb as C}from"./chunk-FPEGN42P.js";import"./chunk-GAL4ENT6.js";var ge=["MainContextMenu"],ve=["TargetContextMenu"],Ce=(t,o)=>o.key,he=(t,o)=>o.id,ye=(t,o)=>o.mid;function we(t,o){if(t&1&&C(0,"fa-icon",18),t&2){let e=r(3);d("icon",e.sortTable.sortParam.asc?e.icons.faArrowDown:e.icons.faArrowUp)("fixedWidth",!1)}}function be(t,o){if(t&1){let e=T();l(0,"th",17),x("click",function(){p(e);let i=r().$implicit,s=r();return _(s.sortBy(i.key))}),m(1),f(2,we,1,2,"fa-icon",18),c()}if(t&2){let e=r().$implicit,n=r();k(e.value.class),I("width",e.value.width,"%"),E("text-align-center",e.value.textCenter)("cursor-pointer",e.value.sortable),a(),y(" ",e.value.label," "),a(),v(n.sortTable.sortParam.column===e.key?2:-1)}}function Te(t,o){if(t&1&&f(0,be,3,11,"th",16),t&2){let e=o.$implicit;v(e.value.show?0:-1)}}function Ge(t,o){if(t&1&&(l(0,"div",21),C(1,"img",24),l(2,"div",22)(3,"span",25),m(4),c(),l(5,"span",26),m(6),c()()()),t&2){let e=r(3).$implicit;a(),d("src",e.avatarUrl,N),a(3),y(" ",e.login," "),a(2),U(e.email)}}function Se(t,o){if(t&1&&(l(0,"div",22)(1,"span",25),m(2),c()()),t&2){let e=r(3).$implicit;a(2),U(e.fullName)}}function Fe(t,o){if(t&1&&C(0,"app-user-avatar",27),t&2){let e=o.$implicit;d("user",e)("isMember",!0)}}function Ue(t,o){if(t&1&&w(0,Fe,1,2,"app-user-avatar",27,ye),t&2){let e=r(3).$implicit;b(e.managers)}}function Ve(t,o){t&1&&m(0," too many login attempts ")}function Ae(t,o){if(t&1&&m(0),t&2){let e=r(4).$implicit;y(" ",e.userIsActiveText," ")}}function Ee(t,o){if(t&1&&(l(0,"span",28),f(1,Ve,1,0)(2,Ae,1,1),c()),t&2){let e=r(3).$implicit;k(e.isActive?"text-success":"text-danger"),a(),v(!e.isActive&&e.passwordAttempts?1:2)}}function Me(t,o){if(t&1&&(m(0),g(1,"amDateFormat")),t&2){let e=r(3).$implicit;y(" ",M(1,1,e.createdAt)," ")}}function $e(t,o){if(t&1&&(l(0,"div",22)(1,"div"),m(2),g(3,"amDateFormat"),c(),l(4,"div"),m(5),g(6,"amDateFormat"),c()()),t&2){let e=r(5).$implicit;a(2),U(M(3,2,e.currentAccess)),a(3),U(M(6,4,e.lastAccess))}}function Ie(t,o){if(t&1&&m(0),t&2){let e=r(5).$implicit;y(" ",e.hTimeAgo," ")}}function ke(t,o){if(t&1){let e=T();l(0,"div",30),x("mouseover",function(){p(e);let i=r(4).$implicit;return _(i.currentAccessHover=!0)})("focus",function(){p(e);let i=r(4).$implicit;return _(i.currentAccessHover=!0)})("mouseleave",function(){p(e);let i=r(4).$implicit;return _(i.currentAccessHover=!1)}),f(1,$e,7,6,"div",22)(2,Ie,1,1),c()}if(t&2){let e=r(4).$implicit;a(),v(e.currentAccessHover?1:2)}}function Pe(t,o){t&1&&(l(0,"span",28),m(1,"never"),c())}function De(t,o){if(t&1&&f(0,ke,3,1,"div",29)(1,Pe,2,0,"span",28),t&2){let e=r(3).$implicit;v(e.currentAccess?0:1)}}function Re(t,o){if(t&1&&(l(0,"td"),f(1,Ge,7,3,"div",21)(2,Se,3,1,"div",22)(3,Ue,2,0)(4,Ee,3,4,"span",23)(5,Me,2,3)(6,De,2,1),c()),t&2){let e,n=r().$implicit,i=r().$implicit;H("",n.value.class," ",n.value.newly?"prop-newly-"+i[n.value.newly]:"",""),I("width",n.value.width,"%"),E("text-align-center",n.value.textCenter),a(),v((e=n.key)==="login"?1:e==="fullName"?2:e==="managers"?3:e==="isActive"?4:e==="createdAt"?5:e==="currentAccess"?6:-1)}}function Be(t,o){if(t&1&&f(0,Re,7,9,"td",20),t&2){let e=o.$implicit;v(e.value.show?0:-1)}}function Ne(t,o){if(t&1){let e=T();l(0,"tr",19),x("click",function(){let i=p(e).$implicit,s=r();return _(s.onSelect(i))})("contextmenu",function(i){let s=p(e).$implicit,u=r();return _(u.onTargetContextMenu(i,s))})("pressup",function(i){let s=p(e).$implicit,u=r();return _(u.onTargetContextMenu(i,s))})("tap",function(){p(e);let i=r();return _(i.openGuestDialog())}),w(1,Be,1,1,null,null,Ce),g(3,"keyvalue"),c()}if(t&2){let e=o.$implicit,n=r();E("disabled",!e.isActive)("selected",e.id===(n.selected==null?null:n.selected.id)),a(),b(h(3,4,n.tableHeaders,n.originalOrderKeyValue))}}function Qe(t,o){if(t&1&&(l(0,"span",28),C(1,"fa-icon",6),m(2,"New guest"),c()),t&2){let e=r();a(),d("icon",e.icons.faPlus)}}function He(t,o){}function Le(t,o){if(t&1&&(l(0,"span",28),C(1,"fa-icon",6),m(2,"Refresh"),c()),t&2){let e=r();a(),d("icon",e.icons.faArrowRotateRight)}}function Oe(t,o){if(t&1&&(l(0,"span",28),C(1,"fa-icon",6),m(2,"Edit guest"),c()),t&2){let e=r();a(),d("icon",e.icons.faPen)}}var _t=(()=>{class t{constructor(e,n,i){this.locale=e,this.layout=n,this.userService=i,this.originalOrderKeyValue=oe,this.icons={faRotate:ie,faPlus:te,faPen:X,faArrowDown:Z,faArrowUp:ee,faKey:J,faArrowRotateRight:Y},this.tableHeaders={login:{label:"Login",width:30,textCenter:!1,class:"",show:!0,sortable:!0},fullName:{label:"Full name",width:15,class:"",textCenter:!1,show:!0,sortable:!0},managers:{label:"Managers",width:15,class:"d-none d-md-table-cell",textCenter:!0,show:!0,sortable:!0},isActive:{label:"Status",width:10,textCenter:!0,class:"d-none d-lg-table-cell",show:!0,sortable:!0},createdAt:{label:"Created",width:12,textCenter:!0,class:"d-none d-lg-table-cell",show:!0,sortable:!0},currentAccess:{label:"Seen",width:12,textCenter:!0,class:"d-none d-lg-table-cell",newly:"newly",show:!0,sortable:!0}},this.sortSettings={default:[{prop:"login",type:"string"}],login:[{prop:"login",type:"string"}],fullName:[{prop:"fullName",type:"string"}],managers:[{prop:"managers",type:"length"}],storage:[{prop:"storageUsage",type:"number"}],currentAccess:[{prop:"currentAccess",type:"date"}],createdAt:[{prop:"createdAt",type:"date"}],isActive:[{prop:"isActive",type:"number"}]},this.sortTable=new de(this.constructor.name,this.sortSettings),this.canCreateGuest=this.userService.userHavePermission(ne.GUESTS_ADMIN),this.loading=!1,this.selected=null,this.guests=[],this.loadGuests(),this.layout.setBreadcrumbIcon(se.GUESTS),this.layout.setBreadcrumbNav({url:`/${P.BASE}/${P.GUESTS}/${re.GUESTS}`,splicing:2,translating:!0,sameLink:!0})}loadGuests(){this.loading=!0,this.onSelect(),this.userService.listGuests().subscribe({next:e=>{this.sortBy(this.sortTable.sortParam.column,!1,e),this.scrollView.scrollInto(-1),this.loading=!1},error:e=>{this.guests=[],this.layout.sendNotification("error","Guests",e.error.message),this.loading=!1}})}onSelect(e=null){this.selected=e}onContextMenu(e){e.preventDefault(),e.stopPropagation(),this.layout.openContextMenu(e,this.mainContextMenu)}onTargetContextMenu(e,n){e.preventDefault(),e.type==="contextmenu"&&e.stopPropagation(),this.onSelect(n),this.layout.openContextMenu(e,this.targetContextMenu)}sortBy(e,n=!0,i){this.guests=this.sortTable.sortBy(e,n,i||this.guests)}openGuestDialog(e=!1){e?this.layout.openDialog(B,"md").content.guestChange.pipe($(1)).subscribe(i=>{let[s,u]=i;s==="add"&&(this.sortBy(this.sortTable.sortParam.column,!1,[...this.guests,u]),this.onSelect(u))}):this.userService.getGuest(this.selected.id).subscribe({next:n=>{this.layout.openDialog(B,"md",{initialState:{guest:n}}).content.guestChange.pipe($(1)).subscribe(s=>{let[u,V]=s;u==="update"?this.selected=Object.assign(this.selected,V):u==="delete"&&(this.onSelect(),this.sortBy(this.sortTable.sortParam.column,!1,this.guests.filter(xe=>xe.id!==V.id)))})},error:n=>this.layout.sendNotification("error","Guest error",this.selected.fullName,n)})}static{this.\u0275fac=function(n){return new(n||t)(A(j),A(ue),A(pe))}}static{this.\u0275cmp=Q({type:t,selectors:[["app-user-guests"]],viewQuery:function(n,i){if(n&1&&(G(R,5),G(D,7),G(ge,7),G(ve,7)),n&2){let s;S(s=F())&&(i.scrollView=s.first),S(s=F())&&(i.inputFilter=s.first),S(s=F())&&(i.mainContextMenu=s.first),S(s=F())&&(i.targetContextMenu=s.first)}},decls:35,vars:32,consts:[["MainContextMenu",""],["TargetContextMenu",""],[1,"app-top-menu"],["container","body","type","button",1,"btn","btn-sm","btn-secondary","me-1",3,"click","tooltip"],[3,"icon","animation"],["container","body","type","button",1,"btn","btn-sm","btn-secondary","me-1",3,"click","disabled","tooltip"],[3,"icon"],[1,"d-none","d-sm-block","ms-auto"],[1,"app-table"],[3,"contextmenu","bufferAmount","items"],["tabindex","-1"],[3,"disabled","selected"],[1,"app-foot-menu"],[1,"mx-auto"],["contextMenuItem","",3,"execute"],["contextMenuItem","",3,"divider"],["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","avatar"],[1,"d-flex","flex-column"],["l10nTranslate","",3,"class"],["alt","",1,"avatar-img",3,"src"],["draggable","false",1,"no-pointer-events"],["draggable","false",1,"no-pointer-events","text-muted","fs-xxxs"],[3,"user","isMember"],["l10nTranslate",""],[1,"d-flex","justify-content-center"],[1,"d-flex","justify-content-center",3,"mouseover","focus","mouseleave"]],template:function(n,i){if(n&1){let s=T();l(0,"div",2)(1,"button",3),g(2,"translate"),x("click",function(){return p(s),_(i.loadGuests())}),C(3,"fa-icon",4),c(),l(4,"button",5),g(5,"translate"),x("click",function(){return p(s),_(i.openGuestDialog(!0))}),C(6,"fa-icon",6),c(),l(7,"button",5),g(8,"translate"),x("click",function(){return p(s),_(i.openGuestDialog())}),C(9,"fa-icon",6),c(),C(10,"app-input-filter",7),c(),l(11,"table",8)(12,"thead")(13,"tr"),w(14,Te,1,1,null,null,Ce),g(16,"keyvalue"),c()()(),l(17,"app-virtual-scroll",9),g(18,"searchFilter"),x("contextmenu",function(V){return p(s),_(i.onContextMenu(V))}),l(19,"table",8)(20,"tbody",10),w(21,Ne,4,7,"tr",11,he),c()()(),l(23,"div",12)(24,"span",13),m(25),g(26,"translate"),c()(),l(27,"context-menu",null,0),f(29,Qe,3,1,"ng-template",14),x("execute",function(){return p(s),_(i.openGuestDialog(!0))}),f(30,He,0,0,"ng-template",15)(31,Le,3,1,"ng-template",14),x("execute",function(){return p(s),_(i.loadGuests())}),c(),l(32,"context-menu",null,1),f(34,Oe,3,1,"ng-template",14),x("execute",function(){return p(s),_(i.openGuestDialog())}),c()}n&2&&(a(),d("tooltip",h(2,14,"Refresh",i.locale.language)),a(2),d("icon",i.icons.faRotate)("animation",i.loading?"spin":null),a(),d("disabled",!i.canCreateGuest)("tooltip",h(5,17,"New guest",i.locale.language)),a(2),d("icon",i.icons.faPlus),a(),d("disabled",!i.selected)("tooltip",h(8,20,"Edit guest",i.locale.language)),a(2),d("icon",i.icons.faPen),a(5),b(h(16,23,i.tableHeaders,i.originalOrderKeyValue)),a(3),d("bufferAmount",5)("items",h(18,26,i.guests,i.inputFilter.search())),a(4),b(i.scrollView==null?null:i.scrollView.viewPortItems),a(4),L("",i.guests.length," ",h(26,29,"guests",i.locale.language),""),a(5),d("divider",!0))},dependencies:[z,K,D,W,O,q,R,_e,me,ce,le,ae,fe],encapsulation:2})}}return t})();export{_t as UserGuestsComponent};
1
+ import{a as B}from"./chunk-2QEYCCHN.js";import{a as fe}from"./chunk-VIL6L67B.js";import{a as me}from"./chunk-5JDPARJT.js";import{a as D,b as R,c as _e,d as de}from"./chunk-WA3LPP4G.js";import"./chunk-2CQOSX2Q.js";import{f as pe}from"./chunk-ZZGFGD5E.js";import{Cb as ae,Db as le,Eb as ce,N as ne,Sb as ue,gb as oe,v as W,vb as P,wb as re,xb as se}from"./chunk-HDDBV3QQ.js";import{Ad as K,Bb as T,Bd as q,Bf as te,Dd as z,Eb as x,Ec as O,Fb as r,Ff as ie,L as $,Ma as N,Mb as G,Me as X,Nb as S,Ob as F,Oe as Y,Qb as m,Rb as U,Sa as a,Sb as y,Tb as L,Xa as A,ab as Q,bc as g,cc as M,dc as h,fb as f,fe as J,lb as d,mb as I,nb as E,ob as k,pa as p,pf as Z,qa as _,qb as H,rb as v,tb as w,ub as b,ud as j,vb as l,wb as c,wf as ee,xb as C}from"./chunk-FPEGN42P.js";import"./chunk-GAL4ENT6.js";var ge=["MainContextMenu"],ve=["TargetContextMenu"],Ce=(t,o)=>o.key,he=(t,o)=>o.id,ye=(t,o)=>o.mid;function we(t,o){if(t&1&&C(0,"fa-icon",18),t&2){let e=r(3);d("icon",e.sortTable.sortParam.asc?e.icons.faArrowDown:e.icons.faArrowUp)("fixedWidth",!1)}}function be(t,o){if(t&1){let e=T();l(0,"th",17),x("click",function(){p(e);let i=r().$implicit,s=r();return _(s.sortBy(i.key))}),m(1),f(2,we,1,2,"fa-icon",18),c()}if(t&2){let e=r().$implicit,n=r();k(e.value.class),I("width",e.value.width,"%"),E("text-align-center",e.value.textCenter)("cursor-pointer",e.value.sortable),a(),y(" ",e.value.label," "),a(),v(n.sortTable.sortParam.column===e.key?2:-1)}}function Te(t,o){if(t&1&&f(0,be,3,11,"th",16),t&2){let e=o.$implicit;v(e.value.show?0:-1)}}function Ge(t,o){if(t&1&&(l(0,"div",21),C(1,"img",24),l(2,"div",22)(3,"span",25),m(4),c(),l(5,"span",26),m(6),c()()()),t&2){let e=r(3).$implicit;a(),d("src",e.avatarUrl,N),a(3),y(" ",e.login," "),a(2),U(e.email)}}function Se(t,o){if(t&1&&(l(0,"div",22)(1,"span",25),m(2),c()()),t&2){let e=r(3).$implicit;a(2),U(e.fullName)}}function Fe(t,o){if(t&1&&C(0,"app-user-avatar",27),t&2){let e=o.$implicit;d("user",e)("isMember",!0)}}function Ue(t,o){if(t&1&&w(0,Fe,1,2,"app-user-avatar",27,ye),t&2){let e=r(3).$implicit;b(e.managers)}}function Ve(t,o){t&1&&m(0," too many login attempts ")}function Ae(t,o){if(t&1&&m(0),t&2){let e=r(4).$implicit;y(" ",e.userIsActiveText," ")}}function Ee(t,o){if(t&1&&(l(0,"span",28),f(1,Ve,1,0)(2,Ae,1,1),c()),t&2){let e=r(3).$implicit;k(e.isActive?"text-success":"text-danger"),a(),v(!e.isActive&&e.passwordAttempts?1:2)}}function Me(t,o){if(t&1&&(m(0),g(1,"amDateFormat")),t&2){let e=r(3).$implicit;y(" ",M(1,1,e.createdAt)," ")}}function $e(t,o){if(t&1&&(l(0,"div",22)(1,"div"),m(2),g(3,"amDateFormat"),c(),l(4,"div"),m(5),g(6,"amDateFormat"),c()()),t&2){let e=r(5).$implicit;a(2),U(M(3,2,e.currentAccess)),a(3),U(M(6,4,e.lastAccess))}}function Ie(t,o){if(t&1&&m(0),t&2){let e=r(5).$implicit;y(" ",e.hTimeAgo," ")}}function ke(t,o){if(t&1){let e=T();l(0,"div",30),x("mouseover",function(){p(e);let i=r(4).$implicit;return _(i.currentAccessHover=!0)})("focus",function(){p(e);let i=r(4).$implicit;return _(i.currentAccessHover=!0)})("mouseleave",function(){p(e);let i=r(4).$implicit;return _(i.currentAccessHover=!1)}),f(1,$e,7,6,"div",22)(2,Ie,1,1),c()}if(t&2){let e=r(4).$implicit;a(),v(e.currentAccessHover?1:2)}}function Pe(t,o){t&1&&(l(0,"span",28),m(1,"never"),c())}function De(t,o){if(t&1&&f(0,ke,3,1,"div",29)(1,Pe,2,0,"span",28),t&2){let e=r(3).$implicit;v(e.currentAccess?0:1)}}function Re(t,o){if(t&1&&(l(0,"td"),f(1,Ge,7,3,"div",21)(2,Se,3,1,"div",22)(3,Ue,2,0)(4,Ee,3,4,"span",23)(5,Me,2,3)(6,De,2,1),c()),t&2){let e,n=r().$implicit,i=r().$implicit;H("",n.value.class," ",n.value.newly?"prop-newly-"+i[n.value.newly]:"",""),I("width",n.value.width,"%"),E("text-align-center",n.value.textCenter),a(),v((e=n.key)==="login"?1:e==="fullName"?2:e==="managers"?3:e==="isActive"?4:e==="createdAt"?5:e==="currentAccess"?6:-1)}}function Be(t,o){if(t&1&&f(0,Re,7,9,"td",20),t&2){let e=o.$implicit;v(e.value.show?0:-1)}}function Ne(t,o){if(t&1){let e=T();l(0,"tr",19),x("click",function(){let i=p(e).$implicit,s=r();return _(s.onSelect(i))})("contextmenu",function(i){let s=p(e).$implicit,u=r();return _(u.onTargetContextMenu(i,s))})("pressup",function(i){let s=p(e).$implicit,u=r();return _(u.onTargetContextMenu(i,s))})("tap",function(){p(e);let i=r();return _(i.openGuestDialog())}),w(1,Be,1,1,null,null,Ce),g(3,"keyvalue"),c()}if(t&2){let e=o.$implicit,n=r();E("disabled",!e.isActive)("selected",e.id===(n.selected==null?null:n.selected.id)),a(),b(h(3,4,n.tableHeaders,n.originalOrderKeyValue))}}function Qe(t,o){if(t&1&&(l(0,"span",28),C(1,"fa-icon",6),m(2,"New guest"),c()),t&2){let e=r();a(),d("icon",e.icons.faPlus)}}function He(t,o){}function Le(t,o){if(t&1&&(l(0,"span",28),C(1,"fa-icon",6),m(2,"Refresh"),c()),t&2){let e=r();a(),d("icon",e.icons.faArrowRotateRight)}}function Oe(t,o){if(t&1&&(l(0,"span",28),C(1,"fa-icon",6),m(2,"Edit guest"),c()),t&2){let e=r();a(),d("icon",e.icons.faPen)}}var _t=(()=>{class t{constructor(e,n,i){this.locale=e,this.layout=n,this.userService=i,this.originalOrderKeyValue=oe,this.icons={faRotate:ie,faPlus:te,faPen:X,faArrowDown:Z,faArrowUp:ee,faKey:J,faArrowRotateRight:Y},this.tableHeaders={login:{label:"Login",width:30,textCenter:!1,class:"",show:!0,sortable:!0},fullName:{label:"Full name",width:15,class:"",textCenter:!1,show:!0,sortable:!0},managers:{label:"Managers",width:15,class:"d-none d-md-table-cell",textCenter:!0,show:!0,sortable:!0},isActive:{label:"Status",width:10,textCenter:!0,class:"d-none d-lg-table-cell",show:!0,sortable:!0},createdAt:{label:"Created",width:12,textCenter:!0,class:"d-none d-lg-table-cell",show:!0,sortable:!0},currentAccess:{label:"Seen",width:12,textCenter:!0,class:"d-none d-lg-table-cell",newly:"newly",show:!0,sortable:!0}},this.sortSettings={default:[{prop:"login",type:"string"}],login:[{prop:"login",type:"string"}],fullName:[{prop:"fullName",type:"string"}],managers:[{prop:"managers",type:"length"}],storage:[{prop:"storageUsage",type:"number"}],currentAccess:[{prop:"currentAccess",type:"date"}],createdAt:[{prop:"createdAt",type:"date"}],isActive:[{prop:"isActive",type:"number"}]},this.sortTable=new de(this.constructor.name,this.sortSettings),this.canCreateGuest=this.userService.userHavePermission(ne.GUESTS_ADMIN),this.loading=!1,this.selected=null,this.guests=[],this.loadGuests(),this.layout.setBreadcrumbIcon(se.GUESTS),this.layout.setBreadcrumbNav({url:`/${P.BASE}/${P.GUESTS}/${re.GUESTS}`,splicing:2,translating:!0,sameLink:!0})}loadGuests(){this.loading=!0,this.onSelect(),this.userService.listGuests().subscribe({next:e=>{this.sortBy(this.sortTable.sortParam.column,!1,e),this.scrollView.scrollInto(-1),this.loading=!1},error:e=>{this.guests=[],this.layout.sendNotification("error","Guests",e.error.message),this.loading=!1}})}onSelect(e=null){this.selected=e}onContextMenu(e){e.preventDefault(),e.stopPropagation(),this.layout.openContextMenu(e,this.mainContextMenu)}onTargetContextMenu(e,n){e.preventDefault(),e.type==="contextmenu"&&e.stopPropagation(),this.onSelect(n),this.layout.openContextMenu(e,this.targetContextMenu)}sortBy(e,n=!0,i){this.guests=this.sortTable.sortBy(e,n,i||this.guests)}openGuestDialog(e=!1){e?this.layout.openDialog(B,"md").content.guestChange.pipe($(1)).subscribe(i=>{let[s,u]=i;s==="add"&&(this.sortBy(this.sortTable.sortParam.column,!1,[...this.guests,u]),this.onSelect(u))}):this.userService.getGuest(this.selected.id).subscribe({next:n=>{this.layout.openDialog(B,"md",{initialState:{guest:n}}).content.guestChange.pipe($(1)).subscribe(s=>{let[u,V]=s;u==="update"?this.selected=Object.assign(this.selected,V):u==="delete"&&(this.onSelect(),this.sortBy(this.sortTable.sortParam.column,!1,this.guests.filter(xe=>xe.id!==V.id)))})},error:n=>this.layout.sendNotification("error","Guest error",this.selected.fullName,n)})}static{this.\u0275fac=function(n){return new(n||t)(A(j),A(ue),A(pe))}}static{this.\u0275cmp=Q({type:t,selectors:[["app-user-guests"]],viewQuery:function(n,i){if(n&1&&(G(R,5),G(D,7),G(ge,7),G(ve,7)),n&2){let s;S(s=F())&&(i.scrollView=s.first),S(s=F())&&(i.inputFilter=s.first),S(s=F())&&(i.mainContextMenu=s.first),S(s=F())&&(i.targetContextMenu=s.first)}},decls:35,vars:32,consts:[["MainContextMenu",""],["TargetContextMenu",""],[1,"app-top-menu"],["container","body","type","button",1,"btn","btn-sm","btn-secondary","me-1",3,"click","tooltip"],[3,"icon","animation"],["container","body","type","button",1,"btn","btn-sm","btn-secondary","me-1",3,"click","disabled","tooltip"],[3,"icon"],[1,"d-none","d-sm-block","ms-auto"],[1,"app-table"],[3,"contextmenu","bufferAmount","items"],["tabindex","-1"],[3,"disabled","selected"],[1,"app-foot-menu"],[1,"mx-auto"],["contextMenuItem","",3,"execute"],["contextMenuItem","",3,"divider"],["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","avatar"],[1,"d-flex","flex-column"],["l10nTranslate","",3,"class"],["alt","",1,"avatar-img",3,"src"],["draggable","false",1,"no-pointer-events"],["draggable","false",1,"no-pointer-events","text-muted","fs-xxxs"],[3,"user","isMember"],["l10nTranslate",""],[1,"d-flex","justify-content-center"],[1,"d-flex","justify-content-center",3,"mouseover","focus","mouseleave"]],template:function(n,i){if(n&1){let s=T();l(0,"div",2)(1,"button",3),g(2,"translate"),x("click",function(){return p(s),_(i.loadGuests())}),C(3,"fa-icon",4),c(),l(4,"button",5),g(5,"translate"),x("click",function(){return p(s),_(i.openGuestDialog(!0))}),C(6,"fa-icon",6),c(),l(7,"button",5),g(8,"translate"),x("click",function(){return p(s),_(i.openGuestDialog())}),C(9,"fa-icon",6),c(),C(10,"app-input-filter",7),c(),l(11,"table",8)(12,"thead")(13,"tr"),w(14,Te,1,1,null,null,Ce),g(16,"keyvalue"),c()()(),l(17,"app-virtual-scroll",9),g(18,"searchFilter"),x("contextmenu",function(V){return p(s),_(i.onContextMenu(V))}),l(19,"table",8)(20,"tbody",10),w(21,Ne,4,7,"tr",11,he),c()()(),l(23,"div",12)(24,"span",13),m(25),g(26,"translate"),c()(),l(27,"context-menu",null,0),f(29,Qe,3,1,"ng-template",14),x("execute",function(){return p(s),_(i.openGuestDialog(!0))}),f(30,He,0,0,"ng-template",15)(31,Le,3,1,"ng-template",14),x("execute",function(){return p(s),_(i.loadGuests())}),c(),l(32,"context-menu",null,1),f(34,Oe,3,1,"ng-template",14),x("execute",function(){return p(s),_(i.openGuestDialog())}),c()}n&2&&(a(),d("tooltip",h(2,14,"Refresh",i.locale.language)),a(2),d("icon",i.icons.faRotate)("animation",i.loading?"spin":null),a(),d("disabled",!i.canCreateGuest)("tooltip",h(5,17,"New guest",i.locale.language)),a(2),d("icon",i.icons.faPlus),a(),d("disabled",!i.selected)("tooltip",h(8,20,"Edit guest",i.locale.language)),a(2),d("icon",i.icons.faPen),a(5),b(h(16,23,i.tableHeaders,i.originalOrderKeyValue)),a(3),d("bufferAmount",5)("items",h(18,26,i.guests,i.inputFilter.search())),a(4),b(i.scrollView==null?null:i.scrollView.viewPortItems),a(4),L("",i.guests.length," ",h(26,29,"guests",i.locale.language),""),a(5),d("divider",!0))},dependencies:[z,K,D,W,O,q,R,_e,me,ce,le,ae,fe],encapsulation:2})}}return t})();export{_t as UserGuestsComponent};