@veltdev/sdk-staging 6.0.0-beta.5 → 6.0.0-beta.7

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 (80) hide show
  1. package/app/client/snippyly.model.d.ts +2 -3
  2. package/app/models/data/selection.model.d.ts +10 -8
  3. package/app/models/data/user-resolver.data.model.d.ts +11 -9
  4. package/app/models/data/user.data.model.d.ts +21 -18
  5. package/app/models/element/activity-element.model.d.ts +0 -1
  6. package/app/models/element/area-element.model.d.ts +0 -1
  7. package/app/models/element/arrow-element.model.d.ts +1 -2
  8. package/app/models/element/autocomplete-element.model.d.ts +0 -1
  9. package/app/models/element/comment-element.model.d.ts +103 -77
  10. package/app/models/element/contact-element.model.d.ts +1 -2
  11. package/app/models/element/crdt-element.model.d.ts +1 -1
  12. package/app/models/element/cursor-element.model.d.ts +1 -2
  13. package/app/models/element/huddle-element.model.d.ts +1 -2
  14. package/app/models/element/live-state-sync-element.model.d.ts +1 -1
  15. package/app/models/element/notification-element.model.d.ts +33 -2
  16. package/app/models/element/presence-element.model.d.ts +32 -11
  17. package/app/models/element/reaction-element.model.d.ts +1 -1
  18. package/app/models/element/recorder-element.model.d.ts +21 -2
  19. package/app/models/element/rewriter-element.model.d.ts +43 -1
  20. package/app/models/element/selection-element.model.d.ts +1 -1
  21. package/app/models/element/suggestion-element.model.d.ts +0 -1
  22. package/app/models/element/tag-element.model.d.ts +7 -8
  23. package/app/models/element/views-element.model.d.ts +1 -1
  24. package/app/utils/enums.d.ts +91 -82
  25. package/{chunk-4HTRJDUT.js → chunk-2YJ3NBTO.js} +1 -1
  26. package/{chunk-HPCGJVBV.js → chunk-3OIAZGVH.js} +1 -1
  27. package/{chunk-NREV2I2E.js → chunk-3OILJMAX.js} +1 -1
  28. package/{chunk-NVSEAZ7V.js → chunk-4QPJMZ5V.js} +1 -1
  29. package/{chunk-JWZNY6MR.js → chunk-52EPUXSU.js} +1 -1
  30. package/{chunk-I3QEZDJJ.js → chunk-57VK6E6U.js} +1 -1
  31. package/{chunk-M6OYNJUV.js → chunk-5SSUFLRQ.js} +1 -1
  32. package/{chunk-6YU4HPC3.js → chunk-5W33SILU.js} +1 -1
  33. package/{chunk-HRMFENXY.js → chunk-6TORUSYX.js} +1 -1
  34. package/{chunk-2CSNE6K3.js → chunk-AMBQ736A.js} +1 -1
  35. package/{chunk-S6BGMPB5.js → chunk-DP4GMASO.js} +1 -1
  36. package/{chunk-ZOEYUSVF.js → chunk-ENIVQSM6.js} +1 -1
  37. package/{chunk-CAH7LK67.js → chunk-EWNXINED.js} +1 -1
  38. package/{chunk-BLOVLKDQ.js → chunk-G2POMKRC.js} +1 -1
  39. package/{chunk-EJCDV3ZL.js → chunk-G56O673H.js} +1 -1
  40. package/{chunk-XQKUJSNO.js → chunk-GUGGWPZ7.js} +1 -1
  41. package/{chunk-OSPUUVRC.js → chunk-HDABOQPS.js} +1 -1
  42. package/{chunk-GG5L5Y4V.js → chunk-J3FNQGWW.js} +1 -1
  43. package/{chunk-AUXK5IGY.js → chunk-JSZMRBOR.js} +1 -1
  44. package/{chunk-GUCATQJB.js → chunk-LAUYCNER.js} +1 -1
  45. package/{chunk-4KHSKSMM.js → chunk-MJDGHV4Y.js} +1 -1
  46. package/{chunk-NM7DOIHZ.js → chunk-MX66OK5A.js} +1 -1
  47. package/{chunk-4RKIO2W6.js → chunk-NR3CZ6OR.js} +1 -1
  48. package/{chunk-A7KXFTE5.js → chunk-QDQ2XJUX.js} +1 -1
  49. package/{chunk-GY4HESRT.js → chunk-RMV5EWSF.js} +1 -1
  50. package/{chunk-TIHAG3UC.js → chunk-RQQHM7ZV.js} +1 -1
  51. package/{chunk-WEQZFWL6.js → chunk-SQTBBRA3.js} +1 -1
  52. package/{chunk-3HVKHN3C.js → chunk-TY3WZ4Q4.js} +26 -26
  53. package/{chunk-ONMQQFFH.js → chunk-W4BGGBK5.js} +1 -1
  54. package/{chunk-6YAEGDTT.js → chunk-XAJ4ABBW.js} +1 -1
  55. package/{chunk-62IPFSNC.js → chunk-XJWB3IUW.js} +1 -1
  56. package/{chunk-DEKTLMP2.js → chunk-YSZQAETY.js} +1 -1
  57. package/{chunk-ZOM7FOLY.js → chunk-ZMXXM7C4.js} +1 -1
  58. package/package.json +1 -1
  59. package/types.d.ts +22 -22
  60. package/velt-activity-log.js +1 -1
  61. package/velt-area.js +1 -1
  62. package/velt-arrow.js +1 -1
  63. package/velt-comment.js +6 -6
  64. package/velt-crdt.js +1 -1
  65. package/velt-cursor.js +1 -1
  66. package/velt-huddle.js +1 -1
  67. package/velt-live-state-sync.js +1 -1
  68. package/velt-notification.js +1 -1
  69. package/velt-presence.js +1 -1
  70. package/velt-reaction.js +1 -1
  71. package/velt-recorder.js +1 -1
  72. package/velt-rewriter.js +1 -1
  73. package/velt-selection.js +1 -1
  74. package/velt-tag.js +1 -1
  75. package/velt-user-invite.js +1 -1
  76. package/velt-user-request.js +1 -1
  77. package/velt-video-player.js +1 -1
  78. package/velt-views.js +1 -1
  79. package/velt.d.ts +1 -2
  80. package/velt.js +3 -3
package/velt-presence.js CHANGED
@@ -1 +1 @@
1
- import{a as K}from"./chunk-OSPUUVRC.js";import"./chunk-ZOEYUSVF.js";import{A,B as N,y as Vt}from"./chunk-4RKIO2W6.js";import{a as Be}from"./chunk-NM7DOIHZ.js";import{b as ve,c as Je,d as re}from"./chunk-62IPFSNC.js";import{a as Xt}from"./chunk-EJCDV3ZL.js";import{a as Yt}from"./chunk-XQKUJSNO.js";import{a as It}from"./chunk-ZOM7FOLY.js";import{D as _t,F as yt,da as f,ea as We,fa as B,ga as ze,s as Ct}from"./chunk-GG5L5Y4V.js";import{$ as ae,$e as rt,$f as Dt,Ci as Wt,Db as vt,Dd as bt,De as X,E as Y,Eb as pt,Fa as l,Fb as dt,Fc as ft,G as ot,Ga as ue,Gc as D,Gd as Le,Hd as Et,Hi as zt,I as He,Ib as te,Ii as Jt,J as Oe,Jb as ut,Kb as Fe,L as Ke,Lc as Me,M as Qe,Nb as se,Nd as Pt,Ob as Re,Pa as m,Pb as ht,Pc as St,Ph as Rt,Q as at,Qh as Mt,Qi as Gt,Ra as ct,Rf as Ot,Rh as Lt,Sf as kt,T as W,Ta as lt,Te as p,Ua as x,Ud as xt,Va as mt,W as H,Wd as Ut,X as Ze,Ya as U,_a as g,_b as $,_d as Tt,a as C,aa as st,b as F,bc as _,bg as me,ca as P,cc as b,db as gt,dc as tt,fc as k,g as oe,ha as ke,ia as De,je as E,k as Xe,kc as ce,kg as At,l as de,lb as c,lc as le,mb as T,nb as O,ni as jt,ob as M,oi as ge,pc as ne,pi as v,qa as Ae,qi as $t,r as R,ri as Bt,sb as d,se as nt,tb as u,th as wt,ua as Ne,ub as we,ui as je,v as j,vb as qe,vf as it,vi as $e,wa as I,wg as Nt,xb as et,xh as Ft,zb as s}from"./chunk-3HVKHN3C.js";var z=(()=>{let r=class r{constructor(e,t,i,a,h,y,L,Ve,Ye,xe,Ue,Te){this.analyticsService=e,this.docService=t,this.domService=i,this.authService=a,this.afAuth=h,this.iamService=y,this.databaseService=L,this.configService=Ve,this.avatarService=Ye,this.loggingService=xe,this.flockService=Ue,this.commonDbService=Te,this.db=null,this.presenceUser$=new de(new it),this.documentPaths=null,this.inactivityTime=300*1e3,this.offlineInactivityTime=600*1e3,this.presenceUsers$=new de([]),this.presenceUsersSubscription=null,this.includeSelf$=new de(!0),this.customPresenceUsers$=new de([]),this.userIdleStateDetectionSubscription=null,this.userOfflineStateDetectionSubscription=null;try{this.loggingService.log("%c[WB] Creating CLASS: PresenceService","color: blue;"),this.databaseService.getDb().pipe(Y(S=>!!S),Oe(1)).subscribe(S=>{S&&(this.db=S,this.getUser(),this.getDocumentPaths(),this.getLocation(),this.updateOnUserDbConnectionStateChange().subscribe(()=>{},w=>{this.loggingService.catch("Error in PresenceService constructor updateOnUserDbConnectionStateChange: ",w)}),this.updateOnDatabaseDisconnect().subscribe(()=>{},w=>{this.loggingService.catch("Error in PresenceService constructor updateOnDatabaseDisconnect: ",w)}),this.updateOnDocumentFocusChange(),this.updateOnAllowedFeatureListChange())},S=>{this.loggingService.catch("Error in PresenceService constructor: ",S)}),this.authService.addPreSignOutFuction("presence-signout",this.signOutUser.bind(this)),this.presenceUsers$.pipe(Qe()).subscribe(([S,w])=>{try{w?.length>=0&&this.analyticsService.updateDefaultProperties({presenceUsersCount:w?.length}),sessionStorage.getItem(p.SESSION_STORAGE.VELT_PRESENCE_MULTIPLE_USERS_ONLINE)||w?.length>1&&S.length!==w.length&&(sessionStorage.setItem(p.SESSION_STORAGE.VELT_PRESENCE_MULTIPLE_USERS_ONLINE,"true"),this.presenceActionsService?.onMultipleUsersOnline({users:w}))}catch(pn){this.loggingService.catch("Error in presenceUsers$ pairwise subscription: ",pn)}}),this.authService.getUser$().pipe(Y(S=>!!S),Oe(1)).subscribe(S=>{S?(this.detectUserIdleState(),this.detectUserOfflineState()):(this.unsubscribeUserIdleStateDetectionSubscription(),this.unsubscribeUserOfflineStateDetectionSubscription())}),this.presenceUser$.subscribe(S=>{try{S?.onlineStatus&&this.presenceActionsService?.onUserStateChange({user:JSON.parse(JSON.stringify(S)),state:S?.onlineStatus})}catch(w){this.loggingService.catch("Error in presenceUser$ subscription: ",w)}},S=>{this.loggingService.catch("Error in presenceUser$ subscribe: ",S)}),this.customPresenceUsers$.subscribe(()=>{try{let S=this.presenceUsers$.value.filter(w=>!w.localOnly);this.presenceUsers$.next(this.mergeWithCustomUsers(S))}catch(S){this.loggingService.catch("Error in customPresenceUsers$ subscription: ",S)}}),this.domService.onNetworkStatusChange$().subscribe(S=>{try{!S&&this.presenceUser$?.value?.onlineStatus&&this.presenceActionsService?.onUserStateChange({user:F(C({},JSON.parse(JSON.stringify(this.presenceUser$.value))),{onlineStatus:p.PRESENCE_STATUS_OFFLINE}),state:p.PRESENCE_STATUS_OFFLINE})}catch(w){this.loggingService.catch("Error in domService.onNetworkStatusChange$ subscription: ",w)}},S=>{this.loggingService.catch("Error in domService.onNetworkStatusChange$ subscribe: ",S)})}catch(S){this.loggingService.catch("Error in PresenceService constructor: ",S)}}setPresenceActionsService(e){try{this.presenceActionsService=e}catch(t){this.loggingService.catch("Error in setPresenceActionsService: ",t)}}detectUserIdleState(){try{this.unsubscribeUserIdleStateDetectionSubscription();let e=!1;this.userIdleStateDetectionSubscription=this.domService.onWindowPointerMove$().pipe(Ze(2e3),H(()=>{this.presenceUser$.value&&e&&(this.setCurrentPresenceUserStatus(p.PRESENCE_STATUS_ONLINE),e=!1)}),He(this.inactivityTime),H(()=>{this.setCurrentPresenceUserStatus(p.PRESENCE_STATUS_AWAY,{isUserIdle:!0}),e=!0})).subscribe()}catch(e){this.loggingService.catch("Error in detectUserIdleState: ",e)}}detectUserOfflineState(){try{this.unsubscribeUserOfflineStateDetectionSubscription();let e=!1;this.userOfflineStateDetectionSubscription=this.domService.onWindowPointerMove$().pipe(Ze(2e3),He(this.offlineInactivityTime),H(()=>{this.setCurrentPresenceUserStatus(p.PRESENCE_STATUS_OFFLINE,{isUserIdle:!0}),e=!0})).subscribe()}catch(e){this.loggingService.catch("Error in detectUserOfflineState: ",e)}}unsubscribeUserIdleStateDetectionSubscription(){try{this.userIdleStateDetectionSubscription&&(this.userIdleStateDetectionSubscription.unsubscribe(),this.userIdleStateDetectionSubscription=null)}catch(e){this.loggingService.catch("Error in unsubscribeUserIdleStateDetectionSubscription: ",e)}}unsubscribeUserOfflineStateDetectionSubscription(){try{this.userOfflineStateDetectionSubscription&&(this.userOfflineStateDetectionSubscription.unsubscribe(),this.userOfflineStateDetectionSubscription=null)}catch(e){this.loggingService.catch("Error in unsubscribeUserOfflineStateDetectionSubscription: ",e)}}getUser(){this.loggingService.log("%c[WB] Calling FUNCTION: getUser","color: green;"),this.authService.getUser$().pipe(Y(e=>!!e)).subscribe(e=>{e&&this.setPresenceUser(e)},e=>{this.loggingService.catch("Error in getUser: ",e)})}getDocumentPaths(){this.loggingService.log("%c[WB] Calling FUNCTION: getDocumentPaths","color: green;"),this.docService.getDocumentPaths$().pipe(H(e=>{this.documentPaths=e}),Qe(),H(([e,t])=>{e&&this.updateUserStatusOnDocumentChange(p.PRESENCE_STATUS_OFFLINE,e),t&&this.updateUserStatusOnDocumentChange(p.PRESENCE_STATUS_ONLINE,t)})).subscribe(()=>{},e=>{this.loggingService.catch("Error in getDocumentPaths: ",e)})}getLocation(){this.docService.getLocation$().pipe(H(e=>{this.updateUserOnLocationChange(e)})).subscribe(()=>{},e=>{this.loggingService.catch("Error in getLocation: ",e)})}getPresenceUser(){return this.loggingService.log("%c[WB] Calling FUNCTION: getPresenceUser","color: green;"),this.presenceUser$.asObservable()}getPresenceUserValue(){return this.presenceUser$.value}getOnlineUsersOnCurrentDocument(e){return this.loggingService.log("%c[WB] Calling FUNCTION: getOnlineUsersOnCurrentDocument","color: green;"),Le(this.afAuth).pipe(Y(t=>!!t),W(t=>this.isFeatureAllowed({firebaseUser:t,users:[],filteredUsers:[]})),W(t=>t.featureAllowed?this.iamService.isUserAllowed$().pipe(j(i=>(t.featureAllowed=i,t))):R(t)),W(t=>t.featureAllowed?this.authService.isPlanExpired$().pipe(j(i=>(t.featureAllowed=!i,t))):R(t)),W(t=>t.featureAllowed?R(t).pipe(W(i=>this.docService.getDocumentPaths$().pipe(j(a=>(this.documentPaths=a,i.documentPaths=a,i)))),W(i=>this.getDataFromDocumentId(e).pipe(j(a=>(i.users=a||[],C({},i))))),j(i=>(e?e?.statuses?.length?i.filteredUsers=i?.users?.filter(a=>e?.statuses?.includes(a?.onlineStatus)):i.filteredUsers=i?.users?.slice():i.filteredUsers=this.filterOnlineUsers(i.users,i.firebaseUser),i)),W(i=>this.getIncludeSelf$().pipe(j(a=>(a||(i.filteredUsers=i?.filteredUsers?.filter(h=>h?.userSnippylyId!==i.user?.userSnippylyId)),i)))),W(i=>{let a=i?.filteredUsers||[];return this.customPresenceUsers$.pipe(j(()=>this.mergeWithCustomUsers(a)))})):R([])),Ke(Ft))}isFeatureAllowed(e){return this.configService.getConfig$().pipe(Y(t=>!!t),j(t=>F(C({},e),{config:t})),W(t=>this.authService.getUser$().pipe(j(i=>F(C({},t),{user:i})))),W(t=>Dt(t.config,t.user,X.PRESENCE)?R(F(C({},t),{featureAllowed:!0})):(this.loggingService.warn("Presence feature is not allowed."),R(F(C({},t),{featureAllowed:!1})))),Ke((t,i)=>t?.featureAllowed===i?.featureAllowed))}getDataFromDocumentId(e){return this.databaseService.getDb().pipe(Y(t=>!!t),W(t=>{if(this.db=t,this.loggingService.log(this.db),this.configService?.getApiKey()&&this.documentPaths?.presence){let i=new Date(Date.now()-864e5).getTime();return this.commonDbService.dbListener({feature:"allPresence",properties:{documentId:e?.documentId??this.documentPaths?.documentId,organizationId:e?.organizationId??this.documentPaths?.organizationId,skipFirestore:!0,useQuery:!0,rtdbQuery:[xt("timestamp"),Tt(i)]}}).pipe(ot(a=>(this.loggingService.catch("Error in PresenceService getDataFromDocumentId: ",a),R(null))),j(a=>a?.data),j(a=>{let h=[];if(a){let y=Object.values(a).filter(L=>typeof L=="object");for(let L of y)h.push(L)}return h}))}else return R([])}))}filterOnlineUsers(e,t){this.loggingService.log("%c[WB] Calling FUNCTION: filterOnlineUsers","color: green;");try{let a=e.slice().filter(h=>{let y=me(h.timestamp);return h.userSnippylyId&&(h.onlineStatus===p.PRESENCE_STATUS_ONLINE||h.onlineStatus===p.PRESENCE_STATUS_AWAY)&&y<this.offlineInactivityTime});return this.presenceUsers$.next(this.mergeWithCustomUsers(a)),a}catch(i){return this.loggingService.catch("Error in filterOnlineUsers:",i),[]}}enableIncludeSelf(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: enableIncludeSelf","color: green;"),this.includeSelf$.value===!0)return;this.includeSelf$.next(!0)}catch(e){this.loggingService.catch("Error in PresenceService enableIncludeSelf: ",e)}}disableIncludeSelf(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: disableIncludeSelf","color: green;"),this.includeSelf$.value===!1)return;this.includeSelf$.next(!1)}catch(e){this.loggingService.catch("Error in PresenceService disableIncludeSelf: ",e)}}getIncludeSelf$(){return this.includeSelf$.asObservable()}getIncludeSelf(){return this.includeSelf$.value}getPresenceUserFromExternalId(e){try{if(this.presenceUsers$.value&&this.presenceUsers$.value.length>0){let t=this.presenceUsers$.value.find(i=>i.userId===e);if(t)return t}return null}catch(t){return this.loggingService.catch("Error in getNameFromSnippylyId:",t),null}}getAnonymousAvatarImage(){return this.loggingService.log("%c[WB] Calling FUNCTION: getAnonymousAvatarImage","color: green;"),this.avatarService.generateUserImage()}updateCurrentPresenceUser(e){return oe(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: updateCurrentPresenceUser","color: green;");try{if(this.documentPaths?.presence&&e&&e.userId&&this.authService.isFeatureAllowed(X.PRESENCE)){if(!e.isAnonymous){e.pageInfo=new rt,e?.onlineStatus===p.PRESENCE_STATUS_ONLINE&&(e.isTabAway=!1,e.isUserIdle=!1);let t=JSON.parse(JSON.stringify(e));this.authService.getUser()&&this.commonDbService.updateData({feature:"presence",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,userId:e.userSnippylyId,skipFirestore:!0},data:JSON.parse(JSON.stringify(F(C({},t),{timestamp:this.timestamp})))})}this.presenceUser$.next(e)}}catch(t){this.loggingService.catch("Error in updateCurrentPresenceUser:",t)}})}setCurrentPresenceUserStatus(e,t){return oe(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: setCurrentPresenceUserStatus","color: green;");try{this.loggingService.log(e);let i=this.presenceUser$.value;if(i.onlineStatus!==e){this.presenceUsersSubscription&&this.presenceUsersSubscription?.unsubscribe();let a=i.onlineStatus,h=e;this.presenceUsersSubscription=this.getPresenceUsers$().pipe(Y(y=>!!y?.length),Oe(1)).subscribe(y=>{y?.length>1&&this.analyticsService.trackEvent(E.Events.Presence.PRESENCE_USER_STATUS_CHANGED,{oldStatus:a,newStatus:h,totalUsers:y?.length,presenceSnippylyUserIds:y?.map(L=>L.userSnippylyId),presenceClientUserIds:y?.map(L=>L.userId)})})}i.onlineStatus=e,t&&(i.isTabAway=t?.isTabAway,i.isUserIdle=t?.isUserIdle),e===p.PRESENCE_STATUS_ONLINE&&(i.isTabAway=!1,i.isUserIdle=!1),e===p.PRESENCE_STATUS_OFFLINE&&this.flockService.isInSession()&&this.flockService.removeCurrentUserFromSession(),this.updateCurrentPresenceUser(i)}catch(i){this.loggingService.catch("Error in setCurrentPresenceUserStatus:",i)}})}updateUserStatusOnDocumentChange(e,t){return oe(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: updateUserStatusOnDocumentChange","color: green;");try{let i=this.presenceUser$.value;if(i.onlineStatus=e,t?.presence&&i&&i.userId&&!i.isAnonymous&&this.authService.isFeatureAllowed(X.PRESENCE)){let a=JSON.parse(JSON.stringify(i));this.commonDbService.updateData({feature:"presence",properties:{documentId:t?.documentId,organizationId:t?.organizationId,userId:i.userSnippylyId,skipFirestore:!0},data:JSON.parse(JSON.stringify(a))})}}catch(i){this.loggingService.catch("Error in updateUserStatusOnDocumentChange:",i)}})}updateUserOnLocationChange(e){return oe(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: updateUserOnLocationChange","color: green;");try{let t=this.presenceUser$.value;if(t.location=e?e.location:null,t.locationId=e?e?.locationId:null,this.documentPaths?.presence&&t&&t.userId&&!t.isAnonymous&&this.authService.isFeatureAllowed(X.PRESENCE)){let i=JSON.parse(JSON.stringify(t));this.commonDbService.updateData({feature:"presence",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,userId:t.userSnippylyId,skipFirestore:!0},data:JSON.parse(JSON.stringify(i))})}}catch(t){this.loggingService.catch("Error in updateUserOnLocationChange:",t)}})}updateOnUserDbConnectionStateChange(){this.loggingService.log("%c[WB] Calling FUNCTION: updateOnUserDbConnectionStateChange","color: green;");let e=Ut(this.db,".info/connected"),t=Pt(e).pipe(j(i=>i?p.PRESENCE_STATUS_ONLINE:p.PRESENCE_STATUS_OFFLINE));return Le(this.afAuth).pipe(at(1),W(i=>i?t:R(p.PRESENCE_STATUS_OFFLINE)),H(i=>this.setCurrentPresenceUserStatus(i)))}updateOnDocumentFocusChange(){this.loggingService.log("%c[WB] Calling FUNCTION: updateOnDocumentFocusChange","color: green;");try{document&&document.addEventListener("visibilitychange",e=>{this.authService.getUser()&&(document.visibilityState==="hidden"?(this.setCurrentPresenceUserStatus(p.PRESENCE_STATUS_AWAY,{isTabAway:!0}),this.flockService.getFlockMode()&&this.flockService.setTabFocused(!1)):(this.setCurrentPresenceUserStatus(p.PRESENCE_STATUS_ONLINE),this.flockService.getFlockMode()&&this.flockService.setTabFocused(!0)))}),window&&(window.addEventListener("focus",()=>{this.authService.getUser()&&(this.setCurrentPresenceUserStatus(p.PRESENCE_STATUS_ONLINE),this.flockService.getFlockMode()&&this.flockService.setWindowFocused(!0))}),window.addEventListener("blur",()=>{this.authService.getUser()&&(document.visibilityState!=="hidden"&&this.setCurrentPresenceUserStatus(p.PRESENCE_STATUS_AWAY,{isTabAway:!0}),this.flockService.getFlockMode()&&this.flockService.setWindowFocused(!1))}))}catch(e){this.loggingService.catch("Error in updateOnDocumentFocusChange:",e)}}updateOnAllowedFeatureListChange(){try{this.configService.getConfig$().subscribe(e=>{if(e&&e.featureAllowList?.length){let t=this.presenceUser$.value,i=!1;if(e.featureAllowList.includes(X.PRESENCE)?t?.onlineStatus!==p.PRESENCE_STATUS_ONLINE&&(t.onlineStatus=p.PRESENCE_STATUS_ONLINE,i=!0):t?.onlineStatus!==p.PRESENCE_STATUS_OFFLINE&&(t.onlineStatus=p.PRESENCE_STATUS_OFFLINE,i=!0),i&&this.authService.getUser()&&this.documentPaths?.presence&&t&&t.userId&&!t.isAnonymous){let a=JSON.parse(JSON.stringify(t));this.commonDbService.updateData({feature:"presence",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,userId:t.userSnippylyId,skipFirestore:!0},data:JSON.parse(JSON.stringify(a))})}}})}catch(e){this.loggingService.catch("Error in updateOnAllowedFeatureListChange:",e)}}updateOnDatabaseDisconnect(){return this.loggingService.log("%c[WB] Calling FUNCTION: updateOnDatabaseDisconnect","color: green;"),Le(this.afAuth).pipe(Y(e=>!!e),W(e=>this.docService.getDocumentPaths$().pipe(j(t=>e))),H(e=>oe(this,null,function*(){try{if(this.documentPaths?.presence&&e){let t=yield Et(e,!0).catch(a=>null);if(!t)return;let{user:i}=t.claims;if(!i?.isAnonymous&&this.documentPaths?.presence){this.flockService.isInSession()&&this.flockService.removeCurrentUserFromSession();let a=`${this.documentPaths.presence}/${e.uid}`;this.commonDbService.setupOnDisconnect(a,{onlineStatus:p.PRESENCE_STATUS_OFFLINE,timestamp:this.timestamp}).catch(h=>{this.loggingService.catch("Error in updateOnDatabaseDisconnect:",h)})}}}catch(t){this.loggingService.catch("Error in updateOnDatabaseDisconnect:",t)}})))}setPresenceUser(e){this.loggingService.log("%c[WB] Calling FUNCTION: setPresenceUser","color: green;");try{let t=this.presenceUser$.value;t.userId=e?.userId,t.name=e?.name,t.email=e?.email,t.photoUrl=e?.photoUrl,t.userSnippylyId=e?.userSnippylyId,t.color=e?.color,t.textColor=e?.textColor,t.initial=e?.initial,t.timestamp=this.timestamp,t.type=e?.type,t.isReadOnly=e?.isReadOnly,t.isAnonymous=e?.isAnonymous;let i=e?.name?.split(" ");if(i&&i.length>0){let a=i[0],h=i.length>1?i[i.length-1]:null,y=h?h[0]:null;a&&(t.name=`${a} ${y?y+".":""}`)}this.updateCurrentPresenceUser(t)}catch(t){this.loggingService.catch("Error in setPresenceUser:",t)}}signOutUser(e){return new Promise((t,i)=>{try{this.documentPaths?.presence&&e?this.commonDbService.getData({feature:"presence",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,userId:e.uid,skipFirestore:!0}}).then(a=>{a&&(this.flockService.isInSession()&&this.flockService.removeCurrentUserFromSession(),this.commonDbService.updateData({feature:"presence",errorCallback:h=>{i(h)},callback:()=>{t(null)},properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,userId:e.uid,skipFirestore:!0},data:JSON.parse(JSON.stringify(F(C({},a?.data??{}),{timestamp:this.timestamp,onlineStatus:p.PRESENCE_STATUS_OFFLINE})))})),t(null)}).catch(a=>{this.loggingService.catch("Error in signOutUser subscription: ",a),i(a)}):t(null)}catch(a){this.loggingService.catch("Error in signOutUser:",a),i(a)}})}setInactivityTime(e){try{this.inactivityTime=e,this.analyticsService.trackEvent(E.Events.Presence.PRESENCE_SET_CUSTOM_INACTIVITY_TIMER,{inactivityTime:this.inactivityTime}),this.detectUserIdleState()}catch(t){this.loggingService.catch("Error in setInactivityTime: ",t)}}getInactivityTime(){return this.inactivityTime}setOfflineInactivityTime(e){try{e>=this.inactivityTime?(this.offlineInactivityTime=e,this.analyticsService.trackEvent(E.Events.Presence.PRESENCE_SET_CUSTOM_OFFLINE_INACTIVITY_TIMER,{offlineInactivityTime:this.offlineInactivityTime}),this.detectUserOfflineState()):this.loggingService.catch("Error in setOfflineInactivityTime: ","offline-inactivity-time value is less than inactivity-time.")}catch(t){this.loggingService.catch("Error in setOfflineInactivityTime: ",t)}}getOfflineInactivityTime(){return this.offlineInactivityTime}getPresenceUsers$(){return this.presenceUsers$.asObservable()}getPresenceUsers(){return this.presenceUsers$.value}get timestamp(){return this.commonDbService.getServerTimestamp()}addCustomUser(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: addCustomUser","color: green;");let t=e?.user,i=e?.localOnly??!1;if(!t?.userId){this.loggingService.catch("Error in addCustomUser: ","userId is required");return}let a=this.buildCustomPresenceUser(t,i);if(!a)return;if(i){let h=this.customPresenceUsers$.value,y=h.findIndex(L=>L.userId===t.userId);if(y>=0){let L=[...h];L[y]=a,this.customPresenceUsers$.next(L)}else this.customPresenceUsers$.next([...h,a])}else this.persistCustomUserToDb(a)}catch(t){this.loggingService.catch("Error in addCustomUser: ",t)}}removeCustomUser(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: removeCustomUser","color: green;");let t=e?.user?.userId,i=e?.localOnly??!1;if(!t){this.loggingService.catch("Error in removeCustomUser: ","userId is required");return}if(i){let a=this.customPresenceUsers$.value,h=a.filter(y=>y.userId!==t);h.length!==a.length&&this.customPresenceUsers$.next(h)}else{let a=this.buildCustomPresenceUser(e.user,!1);a&&this.removeCustomUserFromDb(a)}}catch(t){this.loggingService.catch("Error in removeCustomUser: ",t)}}mergeWithCustomUsers(e){try{let t=this.customPresenceUsers$.value;if(t.length===0)return e;let i=new Set(e.map(h=>h.userId)),a=t.filter(h=>!i.has(h.userId));return[...e,...a]}catch(t){return this.loggingService.catch("Error in mergeWithCustomUsers: ",t),e}}buildCustomPresenceUser(e,t=!1){try{let i=this.configService.getApiKey(),a=new it;return a.userId=e.userId,a.name=e.name||e.userId,a.email=e.email||"",a.photoUrl=e.photoUrl||"",a.onlineStatus=e.onlineStatus||p.PRESENCE_STATUS_ONLINE,a.color=e.color||this.avatarService.generateUserColor(),a.textColor=e.textColor||"",a.type="custom",a.initial=e.initial||(a.name?a.name.charAt(0).toUpperCase():"U"),a.timestamp=Date.now(),a.isReadOnly=e.isReadOnly??!1,a.isAnonymous=e.isAnonymous??!1,a.location=e.location||null,a.locationId=e.locationId??null,a.pageInfo=e.pageInfo||new rt,a.isTabAway=!1,a.isUserIdle=!1,a.userSnippylyId=e.userSnippylyId||(i?Nt(i,e.userId):`custom_${e.userId}`),a.localOnly=t,a}catch(i){return this.loggingService.catch("Error in buildCustomPresenceUser: ",i),null}}persistCustomUserToDb(e){try{if(this.documentPaths?.presence&&e?.userId&&this.authService.isFeatureAllowed(X.PRESENCE)){let t=JSON.parse(JSON.stringify(e));delete t.localOnly,this.commonDbService.updateData({feature:"presence",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,userId:e.userSnippylyId,skipFirestore:!0},data:JSON.parse(JSON.stringify(F(C({},t),{timestamp:this.timestamp})))})}}catch(t){this.loggingService.catch("Error in persistCustomUserToDb: ",t)}}removeCustomUserFromDb(e){try{this.documentPaths?.presence&&e?.userId&&this.authService.isFeatureAllowed(X.PRESENCE)&&this.commonDbService.deleteData({feature:"presence",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,userId:e.userSnippylyId,skipFirestore:!0}})}catch(t){this.loggingService.catch("Error in removeCustomUserFromDb: ",t)}}};r.\u0275fac=function(t){return new(t||r)(P(ge),P(zt),P(je),P($e),P(bt),P(Yt),P(Wt),P($t),P(Bt),P(v),P(K),P(Gt))},r.\u0275prov=ae({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();var ie=class{constructor(){this.filteredPresenceUsers=[],this.shadowDom=!0,this.maxUsers=5,this.showTooltip=()=>{},this.closeTooltip=()=>{},this.onPresenceUserClick=()=>{}}};var V=class{constructor(){this.shadowDom=!0,this.calculateUserAwayTime=()=>{}}};var Zt=n=>({componentConfigSignal:n}),fn=(n,r)=>({condition:n,data:r}),Sn=(n,r,o,e,t)=>({template:n,context:r,componentName:"velt-presence-tooltip-avatar-wireframe",variant:o,setIfCondition:e,componentElementRef:t});function Cn(n,r){if(n&1&&(d(0),M(1,"snippyly-user-avatar",3),u()),n&2){let o=s(2).ngIf,e=s();l(),Fe("away",o.presenceUser.onlineStatus===e.constants.PRESENCE_STATUS_AWAY)("velt-presence-avatar--away",o.presenceUser.onlineStatus===e.constants.PRESENCE_STATUS_AWAY),c("user",o.presenceUser)}}function _n(n,r){if(n&1&&(d(0),g(1,Cn,2,5,"ng-container",2),u()),n&2){let o=s().ngIf,e=s();l(),c("veltDynamicTemplate",k(3,Sn,e.template,_(1,Zt,e.componentConfigSignal),o==null?null:o.variant,e.setIfCondition.bind(e),e.elementRef))}}function yn(n,r){if(n&1&&(d(0),g(1,_n,2,9,"ng-container",1),u()),n&2){let o=s();l(),c("veltIf",b(3,fn,o.conditionSignal(),_(1,Zt,o.componentConfigSignal)))}}var he=(()=>{let r=class r extends B{constructor(e,t,i){super(e,t,i),this.elementRef=e,this.dynamicDataService=t,this.loggingService=i,this.componentId="velt-presence-tooltip-avatar",this.constants=p;try{super.initializeComponentConfigSignal(new V)}catch(a){this.loggingService.catch("Error in PresenceTooltipAvatarComponent constructor: ",a)}}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in PresenceTooltipAvatarComponent ngOnInit: ",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in PresenceTooltipAvatarComponent ngOnDestroy: ",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in PresenceTooltipAvatarComponent setupA11yAttributes:",e)}}};r.\u0275fac=function(t){return new(t||r)(m(I),m(f),m(v))},r.\u0275cmp=x({type:r,selectors:[["velt-presence-tooltip-avatar-internal"]],standalone:!1,features:[$([f]),U],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],[1,"velt-presence-avatar","s-presence-avatar",3,"user"]],template:function(t,i){t&1&&g(0,yn,2,6,"ng-container",0),t&2&&c("ngIf",i.componentConfigSignal())},dependencies:[D,N,A,re],styles:["html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}body.velt-pin-dragging[_ngcontent-%COMP%] iframe[_ngcontent-%COMP%]{pointer-events:none!important}[_nghost-%COMP%]{display:flex}[_nghost-%COMP%]:empty{display:none}.velt-presence-avatar[_ngcontent-%COMP%]{position:relative;border-radius:var(--velt-border-radius-full);z-index:2;width:calc((1.5 + 0px) * var(--velt-base-rem-unit));height:calc((1.5 + 0px) * var(--velt-base-rem-unit));display:flex;align-items:center;justify-content:center}.velt-presence-avatar--away[_ngcontent-%COMP%]{filter:grayscale(.7)}snippyly-user-avatar[_ngcontent-%COMP%]{--legacy-velt-user-avatar-size: 1.5rem}"],changeDetection:0});let n=r;return n})();var en=n=>({componentConfigSignal:n}),bn=(n,r)=>({condition:n,data:r}),En=(n,r,o,e,t)=>({template:n,context:r,componentName:"velt-presence-tooltip-user-active-wireframe",variant:o,setIfCondition:e,componentElementRef:t});function Pn(n,r){n&1&&(d(0),T(1,"p"),se(2),ce(3,"translate"),O(),u()),n&2&&(l(2),Re(le(3,1,"User online")))}function xn(n,r){if(n&1&&(d(0),g(1,Pn,4,3,"ng-container",2),u()),n&2){let o=s(2).ngIf,e=s();l(),c("veltDynamicTemplate",k(3,En,e.template,_(1,en,e.componentConfigSignal),o==null?null:o.variant,e.setIfCondition.bind(e),e.elementRef))}}function Un(n,r){if(n&1&&(d(0),g(1,xn,2,9,"ng-container",0),u()),n&2){let o=s().ngIf,e=s();l(),c("ngIf",(o.presenceUser==null?null:o.presenceUser.onlineStatus)===e.constants.PRESENCE_STATUS_ONLINE)}}function Tn(n,r){if(n&1&&(d(0),g(1,Un,2,1,"ng-container",1),u()),n&2){let o=s();l(),c("veltIf",b(3,bn,o.conditionSignal(),_(1,en,o.componentConfigSignal)))}}var fe=(()=>{let r=class r extends B{constructor(e,t,i){super(e,t,i),this.elementRef=e,this.dynamicDataService=t,this.loggingService=i,this.componentId="velt-presence-tooltip-user-active",this.constants=p;try{super.initializeComponentConfigSignal(new V)}catch(a){this.loggingService.catch("Error in PresenceTooltipUserActiveComponent constructor: ",a)}}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in PresenceTooltipUserActiveComponent ngOnInit: ",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in PresenceTooltipUserActiveComponent ngOnDestroy: ",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in PresenceTooltipUserActiveComponent setupA11yAttributes:",e)}}};r.\u0275fac=function(t){return new(t||r)(m(I),m(f),m(v))},r.\u0275cmp=x({type:r,selectors:[["velt-presence-tooltip-user-active-internal"]],standalone:!1,features:[$([f]),U],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"]],template:function(t,i){t&1&&g(0,Tn,2,6,"ng-container",0),t&2&&c("ngIf",i.componentConfigSignal())},dependencies:[D,N,A,ve],styles:["html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}body.velt-pin-dragging[_ngcontent-%COMP%] iframe[_ngcontent-%COMP%]{pointer-events:none!important}[_nghost-%COMP%]:empty{display:none}p[_ngcontent-%COMP%]{margin:0;color:var(--velt-green);font-weight:400;font-size:var(--velt-font-size-xs);line-height:1}"],changeDetection:0});let n=r;return n})();var tn=n=>({componentConfigSignal:n}),kn=(n,r)=>({condition:n,data:r}),Dn=(n,r,o,e,t)=>({template:n,context:r,componentName:"velt-presence-tooltip-user-inactive-wireframe",variant:o,setIfCondition:e,componentElementRef:t});function An(n,r){if(n&1&&(d(0),T(1,"p",3),se(2),ce(3,"translate"),O(),u()),n&2){let o=s(3).ngIf;l(2),ht(" ",o.calculateUserAwayTime(o.presenceUser).toString()+" "+le(3,1,"mins ago.")," ")}}function Nn(n,r){if(n&1&&(d(0),g(1,An,4,3,"ng-container",2),u()),n&2){let o=s(2).ngIf,e=s();l(),c("veltDynamicTemplate",k(3,Dn,e.template,_(1,tn,e.componentConfigSignal),o==null?null:o.variant,e.setIfCondition.bind(e),e.elementRef))}}function wn(n,r){if(n&1&&(d(0),g(1,Nn,2,9,"ng-container",0),u()),n&2){let o=s().ngIf,e=s();l(),c("ngIf",(o.presenceUser==null?null:o.presenceUser.onlineStatus)===e.constants.PRESENCE_STATUS_AWAY)}}function Fn(n,r){if(n&1&&(d(0),g(1,wn,2,1,"ng-container",1),u()),n&2){let o=s();l(),c("veltIf",b(3,kn,o.conditionSignal(),_(1,tn,o.componentConfigSignal)))}}var Se=(()=>{let r=class r extends B{constructor(e,t,i){super(e,t,i),this.elementRef=e,this.dynamicDataService=t,this.loggingService=i,this.componentId="velt-presence-tooltip-user-inactive",this.constants=p;try{super.initializeComponentConfigSignal(new V)}catch(a){this.loggingService.catch("Error in PresenceTooltipUserInactiveComponent constructor: ",a)}}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in PresenceTooltipUserInactiveComponent ngOnInit: ",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in PresenceTooltipUserInactiveComponent ngOnDestroy: ",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in PresenceTooltipUserInactiveComponent setupA11yAttributes:",e)}}};r.\u0275fac=function(t){return new(t||r)(m(I),m(f),m(v))},r.\u0275cmp=x({type:r,selectors:[["velt-presence-tooltip-user-inactive-internal"]],standalone:!1,features:[$([f]),U],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],[1,"velt-presence-tooltip-user-inactive-text","inactive-text"]],template:function(t,i){t&1&&g(0,Fn,2,6,"ng-container",0),t&2&&c("ngIf",i.componentConfigSignal())},dependencies:[D,N,A,ve],styles:["html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}body.velt-pin-dragging[_ngcontent-%COMP%] iframe[_ngcontent-%COMP%]{pointer-events:none!important}[_nghost-%COMP%]:empty{display:none}p[_ngcontent-%COMP%]{margin:0;color:var(--velt-green);font-weight:400;font-size:var(--velt-font-size-xs);line-height:1}.velt-presence-tooltip-user-inactive-text[_ngcontent-%COMP%]{color:var(--velt-text-4)}"],changeDetection:0});let n=r;return n})();var nn=n=>({componentConfigSignal:n}),Mn=(n,r)=>({condition:n,data:r}),Ln=(n,r,o,e,t)=>({template:n,context:r,componentName:"velt-presence-tooltip-user-name-wireframe",variant:o,setIfCondition:e,componentElementRef:t});function jn(n,r){if(n&1&&(d(0),T(1,"h1"),se(2),ce(3,"translate"),O(),u()),n&2){let o=s(3).ngIf;l(2),Re(o.presenceUser!=null&&o.presenceUser.name?o.presenceUser==null?null:o.presenceUser.name:le(3,1,o.presenceUser==null?null:o.presenceUser.email))}}function $n(n,r){n&1&&M(0,"velt-skeleton-loader-internal",5)}function Bn(n,r){if(n&1&&(d(0),g(1,jn,4,3,"ng-container",4)(2,$n,1,0,"ng-template",null,0,ne),u()),n&2){let o=te(3),e=s(2).ngIf;l(),c("ngIf",(e.presenceUser==null?null:e.presenceUser.name)||(e.presenceUser==null?null:e.presenceUser.email))("ngIfElse",o)}}function Wn(n,r){if(n&1&&(d(0),g(1,Bn,4,2,"ng-container",3),u()),n&2){let o=s().ngIf,e=s();l(),c("veltDynamicTemplate",k(3,Ln,e.template,_(1,nn,e.componentConfigSignal),o==null?null:o.variant,e.setIfCondition.bind(e),e.elementRef))}}function zn(n,r){if(n&1&&(d(0),g(1,Wn,2,9,"ng-container",2),u()),n&2){let o=s();l(),c("veltIf",b(3,Mn,o.conditionSignal(),_(1,nn,o.componentConfigSignal)))}}var Ce=(()=>{let r=class r extends B{constructor(e,t,i){super(e,t,i),this.elementRef=e,this.dynamicDataService=t,this.loggingService=i,this.componentId="velt-presence-tooltip-user-name";try{super.initializeComponentConfigSignal(new V)}catch(a){this.loggingService.catch("Error in PresenceTooltipUserNameComponent constructor: ",a)}}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in PresenceTooltipUserNameComponent ngOnInit: ",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in PresenceTooltipUserNameComponent ngOnDestroy: ",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in PresenceTooltipUserNameComponent setupA11yAttributes:",e)}}};r.\u0275fac=function(t){return new(t||r)(m(I),m(f),m(v))},r.\u0275cmp=x({type:r,selectors:[["velt-presence-tooltip-user-name-internal"]],standalone:!1,features:[$([f]),U],decls:1,vars:1,consts:[["loadingTemplateRef",""],[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],[4,"ngIf","ngIfElse"],["height","16px","width","80px","borderRadius","20px"]],template:function(t,i){t&1&&g(0,zn,2,6,"ng-container",1),t&2&&c("ngIf",i.componentConfigSignal())},dependencies:[D,N,A,Je,ve],styles:["html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}body.velt-pin-dragging[_ngcontent-%COMP%] iframe[_ngcontent-%COMP%]{pointer-events:none!important}[_nghost-%COMP%]:empty{display:none}h1[_ngcontent-%COMP%]{margin:0;color:var(--velt-text-0);font-size:var(--velt-font-size-sm);line-height:calc((1rem + 0px) * var(--velt-base-rem-unit));font-weight:400}"],changeDetection:0});let n=r;return n})();var rn=n=>({componentConfigSignal:n}),Gn=(n,r)=>({condition:n,data:r}),Vn=(n,r,o,e,t)=>({template:n,context:r,componentName:"velt-presence-tooltip-status-container-wireframe",variant:o,setIfCondition:e,componentElementRef:t});function Yn(n,r){if(n&1&&(d(0),T(1,"div",3),M(2,"velt-presence-tooltip-user-name-internal",4)(3,"velt-presence-tooltip-user-active-internal",4)(4,"velt-presence-tooltip-user-inactive-internal",4),O(),u()),n&2){let o=s(3);l(2),c("componentConfigSignal",o.componentConfigSignal),l(),c("componentConfigSignal",o.componentConfigSignal),l(),c("componentConfigSignal",o.componentConfigSignal)}}function Xn(n,r){if(n&1&&(d(0),g(1,Yn,5,3,"ng-container",2),u()),n&2){let o=s().ngIf,e=s();l(),c("veltDynamicTemplate",k(3,Vn,e.template,_(1,rn,e.componentConfigSignal),o==null?null:o.variant,e.setIfCondition.bind(e),e.elementRef))}}function Hn(n,r){if(n&1&&(d(0),g(1,Xn,2,9,"ng-container",1),u()),n&2){let o=s();l(),c("veltIf",b(3,Gn,o.conditionSignal(),_(1,rn,o.componentConfigSignal)))}}var _e=(()=>{let r=class r extends B{constructor(e,t,i){super(e,t,i),this.elementRef=e,this.dynamicDataService=t,this.loggingService=i,this.componentId="velt-presence-tooltip-status-container",this.constants=p;try{super.initializeComponentConfigSignal(new V)}catch(a){this.loggingService.catch("Error in PresenceTooltipStatusContainerComponent constructor: ",a)}}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in PresenceTooltipStatusContainerComponent ngOnInit: ",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in PresenceTooltipStatusContainerComponent ngOnDestroy: ",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in PresenceTooltipStatusContainerComponent setupA11yAttributes:",e)}}};r.\u0275fac=function(t){return new(t||r)(m(I),m(f),m(v))},r.\u0275cmp=x({type:r,selectors:[["velt-presence-tooltip-status-container-internal"]],standalone:!1,features:[$([f]),U],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],[1,"velt-presence-tooltip-status-container","user-status-container"],[3,"componentConfigSignal"]],template:function(t,i){t&1&&g(0,Hn,2,6,"ng-container",0),t&2&&c("ngIf",i.componentConfigSignal())},dependencies:[D,N,A,fe,Se,Ce],styles:["html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}body.velt-pin-dragging[_ngcontent-%COMP%] iframe[_ngcontent-%COMP%]{pointer-events:none!important}[_nghost-%COMP%]:empty{display:none}.velt-presence-tooltip-status-container[_ngcontent-%COMP%]{display:flex;flex-direction:column;z-index:2;gap:var(--velt-spacing-xs)}"],changeDetection:0});let n=r;return n})();var on=(n,r)=>({componentConfigSignal:n,presenceUser:r}),qn=(n,r)=>({condition:n,data:r}),er=(n,r,o,e,t)=>({template:n,context:r,componentName:"velt-presence-tooltip-wireframe",variant:o,setIfCondition:e,componentElementRef:t});function tr(n,r){n&1&&we(0)}function nr(n,r){if(n&1&&(T(0,"velt-shadow-dom-internal"),g(1,tr,1,0,"ng-container",4),O()),n&2){s();let o=te(3);l(),c("ngTemplateOutlet",o)}}function rr(n,r){if(n&1&&(d(0),T(1,"div",8),M(2,"velt-presence-tooltip-avatar-internal",9)(3,"velt-presence-tooltip-status-container-internal",9),O(),u()),n&2){let o=s(5);l(2),c("componentConfigSignal",o.componentConfigSignal),l(),c("componentConfigSignal",o.componentConfigSignal)}}function ir(n,r){if(n&1&&(T(0,"div",6),g(1,rr,4,2,"ng-container",7),O()),n&2){let o=s(3).ngIf,e=s();l(),c("veltDynamicTemplate",k(4,er,e.template,b(1,on,e.componentConfigSignal,e.presenceUser),o==null?null:o.variant,e.setIfCondition.bind(e),e.elementRef))}}function or(n,r){if(n&1&&g(0,ir,2,10,"div",5),n&2){let o=s(2).ngIf;c("ngIf",o==null?null:o.presenceUser)}}function ar(n,r){if(n&1&&(d(0),g(1,nr,2,1,"velt-shadow-dom-internal",3)(2,or,1,1,"ng-template",null,0,ne),u()),n&2){let o=te(3),e=s().ngIf,t=s();l(),c("ngIf",e.shadowDom&&!t.template||t.template&&t.isExplicitShadowDom)("ngIfElse",o)}}function sr(n,r){if(n&1&&(d(0),g(1,ar,4,2,"ng-container",2),u()),n&2){let o=s();l(),c("veltIf",b(4,qn,o.conditionSignal(),b(1,on,o.componentConfigSignal,o.presenceUser)))}}var ye=(()=>{let r=class r extends ze{set shadowDom(e){this._shadowDom=e}get shadowDom(){return this._shadowDom}constructor(e,t,i,a,h){super(e,t,void 0,void 0,void 0,i,a),this.elementRef=e,this.themeService=t,this.dynamicDataService=i,this.loggingService=a,this.wireframeService=h,this._shadowDom=!0,this.isExplicitShadowDom=!1,this.constants=p,this.subscriptions=[],this.componentId="velt-presence-tooltip",this.componentConfigSignal=Ae({presenceUser:null,shadowDom:!0,calculateUserAwayTime:this.calculateUserAwayTime.bind(this)}),this.loggingService.log("%c[WB] Creating CLASS: PresenceTooltipComponent","color: blue;")}ngOnInit(){this.loggingService.log("%c[WB] Calling FUNCTION: ngOnInit","color: green;");try{let e=this.elementRef.nativeElement,t=e.getAttribute("shadow-dom")??e.getAttribute("shadowdom");this.isExplicitShadowDom=t!==null&&t!=="false",this.setupA11yAttributes(),this.dynamicDataService.applyConditionalClasses(this.elementRef.nativeElement,{componentConfigSignal:this.componentConfigSignal,presenceUser:this.presenceUser}),this.subscriptions.push(this.wireframeService.getWireframe$("velt-presence-tooltip-wireframe").subscribe(a=>{if(a){let h=document.createElement(a.tagName);h.innerHTML=a.innerHTML,this.template=h}}))}catch(e){this.loggingService.catch("Error in PresenceComponent oninit: ",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in PresenceComponent setupA11yAttributes:",e)}}ngOnChanges(e){try{super.ngOnChanges(e),e&&Object.keys(e).forEach(t=>{this.componentConfigSignal.update(i=>(i=F(C({},i),{[t]:e[t].currentValue}),i))})}catch(t){this.loggingService.catch("Error in PresenceTooltipComponent ngOnChanges: ",t)}}ngOnDestroy(){try{super.ngOnDestroy(),this.subscriptions.map(e=>{e.unsubscribe()}),this.subscriptions=[]}catch(e){this.loggingService.catch("Error in PresenceTooltipComponent unsubscribe: ",e)}}calculateUserAwayTime(e){try{if(e.onlineStatus===p.PRESENCE_STATUS_ONLINE)return 0;let t=me(e.timestamp);return Math.floor(t/1e3/60)}catch(t){this.loggingService.catch("Error in PresenceTooltipComponent calculateUserAwayTime: ",t)}return 0}};r.\u0275fac=function(t){return new(t||r)(m(I),m(We),m(f),m(v),m(Be))},r.\u0275cmp=x({type:r,selectors:[["velt-presence-tooltip"]],inputs:{presenceUser:"presenceUser",shadowDom:"shadowDom",variant:"variant"},standalone:!1,features:[U,Ne],decls:1,vars:1,consts:[["presenceTooltipRef",""],[4,"ngIf"],[4,"veltIf"],[4,"ngIf","ngIfElse"],[4,"ngTemplateOutlet"],["class","velt-presence-tooltip-container",4,"ngIf"],[1,"velt-presence-tooltip-container"],[4,"veltDynamicTemplate"],[1,"velt-presence-tooltip","s-tooltiptext","s-presence-tooltip"],[3,"componentConfigSignal"]],template:function(t,i){t&1&&g(0,sr,2,7,"ng-container",1),t&2&&c("ngIf",i.componentConfigSignal())},dependencies:[D,Me,N,A,he,_e],styles:["html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}body.velt-pin-dragging[_ngcontent-%COMP%] iframe[_ngcontent-%COMP%]{pointer-events:none!important}[_nghost-%COMP%]{--velt-green: var(--velt-light-mode-green);--velt-magenta: var(--velt-light-mode-magenta);--velt-amber: var(--velt-light-mode-amber);--velt-purple: var(--velt-light-mode-purple);--velt-cyan: var(--velt-light-mode-cyan);--velt-orange: var(--velt-light-mode-orange);--velt-black: var(--velt-light-mode-black);--velt-white: var(--velt-light-mode-white);--velt-gray: var(--velt-light-mode-gray);--velt-error: var(--velt-light-mode-error);--velt-error-hover: var(--velt-light-mode-error-hover);--velt-error-foreground: var(--velt-light-mode-error-foreground);--velt-error-light: var(--velt-light-mode-error-light);--velt-error-transparent: var(--velt-light-mode-error-transparent);--velt-warning: var(--velt-light-mode-warning);--velt-warning-hover: var(--velt-light-mode-warning-hover);--velt-warning-foreground: var(--velt-light-mode-warning-foreground);--velt-warning-light: var(--velt-light-mode-warning-light);--velt-warning-transparent: var(--velt-light-mode-warning-transparent);--velt-agent-accent: #4495ff;--velt-agent-accent-transparent: rgba(68, 149, 255, .2);--velt-success: var(--velt-light-mode-success);--velt-success-hover: var(--velt-light-mode-success-hover);--velt-success-foreground: var(--velt-light-mode-success-foreground);--velt-success-light: var(--velt-light-mode-success-light);--velt-success-transparent: var(--velt-light-mode-success-transparent);--velt-accent: var(--velt-light-mode-accent);--velt-accent-text: var(--velt-light-mode-accent-text);--velt-accent-hover: var(--velt-light-mode-accent-hover);--velt-accent-foreground: var(--velt-light-mode-accent-foreground);--velt-accent-light: var(--velt-light-mode-accent-light);--velt-accent-transparent: var(--velt-light-mode-accent-transparent);--velt-text-0: var(--velt-light-mode-text-0);--velt-text-1: var(--velt-light-mode-text-1);--velt-text-2: var(--velt-light-mode-text-2);--velt-text-3: var(--velt-light-mode-text-3);--velt-text-4: var(--velt-light-mode-text-4);--velt-text-5: var(--velt-light-mode-text-5);--velt-text-6: var(--velt-light-mode-text-6);--velt-text-7: var(--velt-light-mode-text-7);--velt-text-8: var(--velt-light-mode-text-8);--velt-text-9: var(--velt-light-mode-text-9);--velt-text-10: var(--velt-light-mode-text-10);--velt-text-11: var(--velt-light-mode-text-11);--velt-text-12: var(--velt-light-mode-text-12);--velt-background-0: var(--velt-light-mode-background-0);--velt-background-1: var(--velt-light-mode-background-1);--velt-background-2: var(--velt-light-mode-background-2);--velt-background-3: var(--velt-light-mode-background-3);--velt-background-4: var(--velt-light-mode-background-4);--velt-background-5: var(--velt-light-mode-background-5);--velt-background-6: var(--velt-light-mode-background-6);--velt-background-7: var(--velt-light-mode-background-7);--velt-background-8: var(--velt-light-mode-background-8);--velt-background-9: var(--velt-light-mode-background-9);--velt-background-10: var(--velt-light-mode-background-10);--velt-border-0: var(--velt-light-mode-border-0);--velt-border-1: var(--velt-light-mode-border-1);--velt-border-2: var(--velt-light-mode-border-2);--velt-border-3: var(--velt-light-mode-border-3);--velt-border-4: var(--velt-light-mode-border-4);--velt-border-5: var(--velt-light-mode-border-5);--velt-border-6: var(--velt-light-mode-border-6);--velt-border-7: var(--velt-light-mode-border-7);--velt-border-8: var(--velt-light-mode-border-8);--velt-border-9: var(--velt-light-mode-border-9);--velt-border-10: var(--velt-light-mode-border-10);--velt-background-transparent: var(--velt-light-mode-background-transparent);--velt-border-transparent: var(--velt-light-mode-border-transparent);--velt-animation-transparent: var(--velt-light-mode-animation-transparent);margin:calc((.5rem + 0px) * var(--velt-base-rem-unit))}[_nghost-%COMP%]:empty{display:none}[dark][_nghost-%COMP%]{--velt-green: var(--velt-dark-mode-green);--velt-magenta: var(--velt-dark-mode-magenta);--velt-amber: var(--velt-dark-mode-amber);--velt-purple: var(--velt-dark-mode-purple);--velt-cyan: var(--velt-dark-mode-cyan);--velt-orange: var(--velt-dark-mode-orange);--velt-black: var(--velt-dark-mode-black);--velt-white: var(--velt-dark-mode-white);--velt-gray: var(--velt-dark-mode-gray);--velt-error: var(--velt-dark-mode-error);--velt-error-hover: var(--velt-dark-mode-error-hover);--velt-error-foreground: var(--velt-dark-mode-error-foreground);--velt-error-light: var(--velt-dark-mode-error-light);--velt-error-transparent: var(--velt-dark-mode-error-transparent);--velt-warning: var(--velt-dark-mode-warning);--velt-warning-hover: var(--velt-dark-mode-warning-hover);--velt-warning-foreground: var(--velt-dark-mode-warning-foreground);--velt-warning-light: var(--velt-dark-mode-warning-light);--velt-warning-transparent: var(--velt-dark-mode-warning-transparent);--velt-agent-accent: #4495ff;--velt-agent-accent-transparent: rgba(68, 149, 255, .2);--velt-success: var(--velt-dark-mode-success);--velt-success-hover: var(--velt-dark-mode-success-hover);--velt-success-foreground: var(--velt-dark-mode-success-foreground);--velt-success-light: var(--velt-dark-mode-success-light);--velt-success-transparent: var(--velt-dark-mode-success-transparent);--velt-accent: var(--velt-dark-mode-accent);--velt-accent-text: var(--velt-dark-mode-accent-text);--velt-accent-hover: var(--velt-dark-mode-accent-hover);--velt-accent-foreground: var(--velt-dark-mode-accent-foreground);--velt-accent-light: var(--velt-dark-mode-accent-light);--velt-accent-transparent: var(--velt-dark-mode-accent-transparent);--velt-text-0: var(--velt-dark-mode-text-0);--velt-text-1: var(--velt-dark-mode-text-1);--velt-text-2: var(--velt-dark-mode-text-2);--velt-text-3: var(--velt-dark-mode-text-3);--velt-text-4: var(--velt-dark-mode-text-4);--velt-text-5: var(--velt-dark-mode-text-5);--velt-text-6: var(--velt-dark-mode-text-6);--velt-text-7: var(--velt-dark-mode-text-7);--velt-text-8: var(--velt-dark-mode-text-8);--velt-text-9: var(--velt-dark-mode-text-9);--velt-text-10: var(--velt-dark-mode-text-10);--velt-text-11: var(--velt-dark-mode-text-11);--velt-text-12: var(--velt-dark-mode-text-12);--velt-background-0: var(--velt-dark-mode-background-0);--velt-background-1: var(--velt-dark-mode-background-1);--velt-background-2: var(--velt-dark-mode-background-2);--velt-background-3: var(--velt-dark-mode-background-3);--velt-background-4: var(--velt-dark-mode-background-4);--velt-background-5: var(--velt-dark-mode-background-5);--velt-background-6: var(--velt-dark-mode-background-6);--velt-background-7: var(--velt-dark-mode-background-7);--velt-background-8: var(--velt-dark-mode-background-8);--velt-background-9: var(--velt-dark-mode-background-9);--velt-background-10: var(--velt-dark-mode-background-10);--velt-border-0: var(--velt-dark-mode-border-0);--velt-border-1: var(--velt-dark-mode-border-1);--velt-border-2: var(--velt-dark-mode-border-2);--velt-border-3: var(--velt-dark-mode-border-3);--velt-border-4: var(--velt-dark-mode-border-4);--velt-border-5: var(--velt-dark-mode-border-5);--velt-border-6: var(--velt-dark-mode-border-6);--velt-border-7: var(--velt-dark-mode-border-7);--velt-border-8: var(--velt-dark-mode-border-8);--velt-border-9: var(--velt-dark-mode-border-9);--velt-border-10: var(--velt-dark-mode-border-10);--velt-background-transparent: var(--velt-dark-mode-background-transparent);--velt-border-transparent: var(--velt-dark-mode-border-transparent);--velt-animation-transparent: var(--velt-dark-mode-animation-transparent)}.velt-presence-tooltip[_ngcontent-%COMP%]{display:flex;align-items:center;gap:calc((.5rem + 0px) * var(--velt-base-rem-unit));block-size:auto;width:max-content;background-color:var(--velt-background-0);border:1px solid var(--velt-border-5);color:var(--velt-text-0);text-align:left;padding:var(--velt-spacing-xs) var(--velt-spacing-sm);border-radius:var(--velt-border-radius-xs);font-style:normal;font-weight:400;font-size:var(--velt-font-size-xs);line-height:2em;z-index:1;transition:opacity .5s}.velt-presence-tooltip[_ngcontent-%COMP%]:after{background-color:var(--velt-background-0);border-color:var(--velt-border-5)}"],changeDetection:0});let n=r;return n})();var lr=["tooltipContent"],an=(n,r,o)=>({componentConfigSignal:n,presenceUser:r,index:o}),mr=(n,r)=>({condition:n,data:r}),gr=(n,r,o,e,t)=>({template:n,context:r,componentName:"velt-presence-avatar-list-item-wireframe",variant:o,setIfCondition:e,componentElementRef:t});function vr(n,r){if(n&1){let o=qe();d(0),T(1,"snippyly-user-avatar",6),et("click",function(){ke(o);let t=s(3).ngIf,i=s();return De(t.onPresenceUserClick(i.presenceUser))}),M(2,"div",7),O(),u()}if(n&2){let o=s(4);l(),Fe("away",o.presenceUser.onlineStatus===o.constants.PRESENCE_STATUS_AWAY)("velt-presence-avatar--away",o.presenceUser.onlineStatus===o.constants.PRESENCE_STATUS_AWAY),c("user",o.presenceUser),l(),ut("border-color",o.presenceUser.color)}}function pr(n,r){if(n&1){let o=qe();T(0,"div",4),et("pointerenter",function(t){ke(o);let i=s(2).ngIf,a=s();return i.showTooltip(t,a.presenceUser),De(t.stopPropagation())})("pointerleave",function(t){return ke(o),s(2).ngIf.closeTooltip(),De(t.stopPropagation())}),g(1,vr,3,7,"ng-container",5),O()}if(n&2){let o=s(2).ngIf,e=s();l(),c("veltDynamicTemplate",k(5,gr,e.template,tt(1,an,e.componentConfigSignal,e.presenceUser,e.index),o==null?null:o.variant,e.setIfCondition.bind(e),e.elementRef))}}function dr(n,r){if(n&1&&M(0,"velt-presence-tooltip",8),n&2){let o=r.$implicit,e=s(2).ngIf;c("presenceUser",o)("shadowDom",e.shadowDom)}}function ur(n,r){if(n&1&&(d(0),g(1,pr,2,11,"div",3)(2,dr,1,2,"ng-template",null,0,ne),u()),n&2){let o=s().ngIf,e=s();l(),c("ngIf",e.index<o.maxUsers)}}function hr(n,r){if(n&1&&(d(0),g(1,ur,4,1,"ng-container",2),u()),n&2){let o=s();l(),c("veltIf",b(5,mr,o.conditionSignal(),tt(1,an,o.componentConfigSignal,o.presenceUser,o.index)))}}var Ie=(()=>{let r=class r extends B{get itemTemplate(){return this._itemTemplate}set itemTemplate(e){try{this._itemTemplate=e,this.itemTemplate?this.template=this.domService.deepCloneElement(this.itemTemplate):this.template=null}catch{}}constructor(e,t,i,a){super(e,t,i),this.elementRef=e,this.dynamicDataService=t,this.loggingService=i,this.domService=a,this.componentId="velt-presence-avatar-list-item",this.constants=p;try{super.initializeComponentConfigSignal(new ie)}catch(h){this.loggingService.catch("Error in PresenceAvatarListItemComponent constructor: ",h)}}ngOnInit(){try{this.dynamicDataService.applyConditionalClasses(this.elementRef.nativeElement,{componentConfigSignal:this.componentConfigSignal,presenceUser:this.presenceUser,index:this.index}),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in PresenceAvatarListItemComponent ngOnInit: ",e)}}ngAfterViewInit(){try{setTimeout(()=>{this.componentConfigSignal.set(F(C({},this.componentConfigSignal()),{tooltipContent:this.tooltipContent}))},1e3)}catch(e){this.loggingService.catch("Error in PresenceAvatarListItemComponent ngAfterViewInit: ",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in PresenceAvatarListItemComponent ngOnDestroy: ",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in PresenceAvatarListItemComponent setupA11yAttributes:",e)}}};r.\u0275fac=function(t){return new(t||r)(m(I),m(f),m(v),m(je))},r.\u0275cmp=x({type:r,selectors:[["velt-presence-avatar-list-item-internal"]],viewQuery:function(t,i){if(t&1&&vt(lr,5),t&2){let a;pt(a=dt())&&(i.tooltipContent=a.first)}},inputs:{presenceUser:"presenceUser",index:"index",itemTemplate:"itemTemplate"},standalone:!1,features:[$([f]),U],decls:1,vars:1,consts:[["tooltipContent",""],[4,"ngIf"],[4,"veltIf"],["class","velt-presence-avatar-list-item velt-tooltip s-presence-avatar-container s-tooltip",3,"pointerenter","pointerleave",4,"ngIf"],[1,"velt-presence-avatar-list-item","velt-tooltip","s-presence-avatar-container","s-tooltip",3,"pointerenter","pointerleave"],[4,"veltDynamicTemplate"],[1,"velt-presence-avatar","s-presence-avatar",3,"click","user"],[1,"velt-presence-avatar-outline","avatar-outline"],[3,"presenceUser","shadowDom"]],template:function(t,i){t&1&&g(0,hr,2,8,"ng-container",1),t&2&&c("ngIf",i.componentConfigSignal())},dependencies:[D,N,A,re,ye],styles:["html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}body.velt-pin-dragging[_ngcontent-%COMP%] iframe[_ngcontent-%COMP%]{pointer-events:none!important}[_nghost-%COMP%]:empty{display:none}.velt-presence-avatar-list-item[_ngcontent-%COMP%]{height:calc((1.5 + 0px) * var(--velt-base-rem-unit));width:calc((1.5 + 0px) * var(--velt-base-rem-unit));display:flex;justify-content:center;align-items:center;cursor:pointer}.velt-presence-avatar-list-item[_ngcontent-%COMP%] .velt-presence-avatar[_ngcontent-%COMP%]{position:relative;border-radius:var(--velt-border-radius-full);z-index:2;width:calc((1.5 + 0px) * var(--velt-base-rem-unit));height:calc((1.5 + 0px) * var(--velt-base-rem-unit));display:flex;align-items:center;justify-content:center}.velt-presence-avatar--away[_ngcontent-%COMP%]{filter:grayscale(.7)}.velt-presence-avatar-outline[_ngcontent-%COMP%]{position:absolute;inset:-1px;border:1px solid transparent;border-radius:var(--velt-border-radius-full)}snippyly-user-avatar[_ngcontent-%COMP%]{--legacy-velt-user-avatar-size: 1.5rem}"],changeDetection:0});let n=r;return n})();var sn=n=>({componentConfigSignal:n}),Sr=(n,r)=>({condition:n,data:r}),Cr=(n,r,o,e,t)=>({template:n,context:r,componentName:"velt-presence-avatar-list-wireframe",variant:o,setIfCondition:e,componentElementRef:t,replaceTemplate:!1});function _r(n,r){if(n&1&&(d(0),M(1,"velt-presence-avatar-list-item-internal",4),u()),n&2){let o=r.$implicit,e=r.index,t=s(4);l(),c("presenceUser",o)("index",e)("componentConfigSignal",t.componentConfigSignal)("itemTemplate",t.itemTemplate)}}function yr(n,r){if(n&1&&(d(0),g(1,_r,2,4,"ng-container",3),u()),n&2){let o=s(2).ngIf;l(),c("ngForOf",o.filteredPresenceUsers)("ngForTrackBy",o.trackById)}}function Ir(n,r){if(n&1&&(d(0),g(1,yr,2,2,"ng-container",2),u()),n&2){let o=s().ngIf,e=s();l(),c("veltDynamicTemplate",k(3,Cr,e.template,_(1,sn,e.componentConfigSignal),o==null?null:o.variant,e.setIfCondition.bind(e),e.elementRef))}}function br(n,r){if(n&1&&(d(0),g(1,Ir,2,9,"ng-container",1),u()),n&2){let o=s();l(),c("veltIf",b(3,Sr,o.conditionSignal(),_(1,sn,o.componentConfigSignal)))}}var be=(()=>{let r=class r extends B{constructor(e,t,i){super(e,t,i),this.elementRef=e,this.dynamicDataService=t,this.loggingService=i,this.componentId="velt-presence-avatar-list",this.constants=p;try{super.initializeComponentConfigSignal(new ie)}catch(a){this.loggingService.catch("Error in PresenceAvatarListComponent constructor: ",a)}}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes();let e=this.template?.querySelector("velt-presence-avatar-list-item-wireframe");wt(e)||(this.itemTemplate=e)}catch(e){this.loggingService.catch("Error in PresenceAvatarListComponent ngOnInit: ",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in PresenceAvatarListComponent ngOnDestroy: ",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in PresenceAvatarListComponent setupA11yAttributes:",e)}}};r.\u0275fac=function(t){return new(t||r)(m(I),m(f),m(v))},r.\u0275cmp=x({type:r,selectors:[["velt-presence-avatar-list-internal"]],standalone:!1,features:[$([f]),U],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],[4,"ngFor","ngForOf","ngForTrackBy"],[3,"presenceUser","index","componentConfigSignal","itemTemplate"]],template:function(t,i){t&1&&g(0,br,2,6,"ng-container",0),t&2&&c("ngIf",i.componentConfigSignal())},dependencies:[ft,D,N,A,Ie],styles:["html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}body.velt-pin-dragging[_ngcontent-%COMP%] iframe[_ngcontent-%COMP%]{pointer-events:none!important}[_nghost-%COMP%]{position:relative;display:flex;flex-direction:row;justify-content:center;align-items:center;height:calc((1.5 + 0px) * var(--velt-base-rem-unit));min-width:calc((1.5 + 0px) * var(--velt-base-rem-unit))}[_nghost-%COMP%]:empty{display:none}velt-presence-avatar-list-item-internal[_ngcontent-%COMP%]:not(:first-child){margin-left:calc(var(--velt-spacing-xs) * -1)}"],changeDetection:0});let n=r;return n})();var cn=n=>({componentConfigSignal:n}),Pr=(n,r)=>({condition:n,data:r}),xr=(n,r,o,e,t)=>({template:n,context:r,componentName:"velt-presence-avatar-remaining-count-wireframe",variant:o,setIfCondition:e,componentElementRef:t});function Ur(n,r){if(n&1&&(d(0),T(1,"snippyly-user-avatar",3),M(2,"div",4),O(),u()),n&2){let o=s(3).ngIf;l(),c("initial","+"+(o.filteredPresenceUsers.length-o.maxUsers).toString())}}function Tr(n,r){if(n&1&&(d(0),g(1,Ur,3,1,"ng-container",2),u()),n&2){let o=s(2).ngIf,e=s();l(),c("veltDynamicTemplate",k(3,xr,e.template,_(1,cn,e.componentConfigSignal),o==null?null:o.variant,e.setIfCondition.bind(e),e.elementRef))}}function Or(n,r){if(n&1&&(d(0),g(1,Tr,2,9,"ng-container",0),u()),n&2){let o=s().ngIf;l(),c("ngIf",o.filteredPresenceUsers.length>o.maxUsers)}}function kr(n,r){if(n&1&&(d(0),g(1,Or,2,1,"ng-container",1),u()),n&2){let o=s();l(),c("veltIf",b(3,Pr,o.conditionSignal(),_(1,cn,o.componentConfigSignal)))}}var Ee=(()=>{let r=class r extends B{constructor(e,t,i){super(e,t,i),this.elementRef=e,this.dynamicDataService=t,this.loggingService=i,this.componentId="velt-presence-avatar-remaining-count";try{super.initializeComponentConfigSignal(new ie)}catch(a){this.loggingService.catch("Error in PresenceAvatarRemainingCountComponent constructor: ",a)}}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in PresenceAvatarRemainingCountComponent ngOnInit: ",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in PresenceAvatarRemainingCountComponent ngOnDestroy: ",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in PresenceAvatarRemainingCountComponent setupA11yAttributes:",e)}}};r.\u0275fac=function(t){return new(t||r)(m(I),m(f),m(v))},r.\u0275cmp=x({type:r,selectors:[["velt-presence-avatar-remaining-count-internal"]],standalone:!1,features:[$([f]),U],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],[1,"velt-presence-avatar","velt-presence-avatar-remaining-count","s-presence-avatar","more-users",3,"initial"],[1,"velt-presence-avatar-remaining-count-outline","avatar-outline"]],template:function(t,i){t&1&&g(0,kr,2,6,"ng-container",0),t&2&&c("ngIf",i.componentConfigSignal())},dependencies:[D,N,A,re],styles:["html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}body.velt-pin-dragging[_ngcontent-%COMP%] iframe[_ngcontent-%COMP%]{pointer-events:none!important}[_nghost-%COMP%]:empty{display:none}.velt-presence-avatar[_ngcontent-%COMP%]{position:relative;border-radius:var(--velt-border-radius-full);z-index:2;width:calc((1.5 + 0px) * var(--velt-base-rem-unit));height:calc((1.5 + 0px) * var(--velt-base-rem-unit));display:flex;align-items:center;justify-content:center}.velt-presence-avatar.velt-presence-avatar-remaining-count[_ngcontent-%COMP%]{box-shadow:none;color:var(--velt-text-0);margin-left:calc(var(--velt-spacing-xs) * -1);background-color:var(--legacy-velt-presence-more-users-color)}.velt-presence-avatar.velt-presence-avatar-remaining-count[_ngcontent-%COMP%] .velt-presence-avatar-remaining-count-outline[_ngcontent-%COMP%]{border-color:var(--legacy-velt-presence-more-users-color)}snippyly-user-avatar[_ngcontent-%COMP%]{--legacy-velt-user-avatar-size: 1.5rem}"],changeDetection:0});let n=r;return n})();var ln=n=>({componentConfigSignal:n}),Ar=(n,r)=>({condition:n,data:r}),Nr=(n,r,o,e,t)=>({template:n,context:r,componentName:"velt-presence-wireframe",variant:o,setIfCondition:e,componentElementRef:t});function wr(n,r){n&1&&we(0)}function Fr(n,r){if(n&1&&(T(0,"velt-shadow-dom-internal"),g(1,wr,1,0,"ng-container",4),O()),n&2){s();let o=te(3);l(),c("ngTemplateOutlet",o)}}function Rr(n,r){if(n&1&&(d(0),M(1,"velt-presence-avatar-list-internal",8)(2,"velt-presence-avatar-remaining-count-internal",8),u()),n&2){let o=s(5);l(),c("componentConfigSignal",o.componentConfigSignal),l(),c("componentConfigSignal",o.componentConfigSignal)}}function Mr(n,r){if(n&1&&(T(0,"div",6),g(1,Rr,3,2,"ng-container",7),O()),n&2){let o=s(3).ngIf,e=s();l(),c("veltDynamicTemplate",k(3,Nr,e.template,_(1,ln,e.componentConfigSignal),o==null?null:o.variant,e.setIfCondition.bind(e),e.elementRef))}}function Lr(n,r){if(n&1&&g(0,Mr,2,9,"div",5),n&2){let o=s(2).ngIf;c("ngIf",o.filteredPresenceUsers&&o.filteredPresenceUsers.length>0&&!(o.user!=null&&o.user.isAnonymous))}}function jr(n,r){if(n&1&&(d(0),g(1,Fr,2,1,"velt-shadow-dom-internal",3)(2,Lr,1,1,"ng-template",null,0,ne),u()),n&2){let o=te(3),e=s().ngIf,t=s();l(),c("ngIf",e.shadowDom&&!t.template||t.template&&t.isExplicitShadowDom)("ngIfElse",o)}}function $r(n,r){if(n&1&&(d(0),g(1,jr,4,2,"ng-container",2),u()),n&2){let o=s();l(),c("veltIf",b(3,Ar,o.conditionSignal(),_(1,ln,o.componentConfigSignal)))}}var pe=(()=>{let r=class r extends ze{get maxUsers(){return this._maxUsers}set maxUsers(e){try{isNaN(e)?this.loggingService.catch("Error in Presence set maxUsers: ","max-user value is not a number."):this._maxUsers=e}catch(t){this.loggingService.catch("Error in Presence set maxUsers: ",t)}}get inactivityTime(){return this._inactivityTime}set inactivityTime(e){try{isNaN(e)?this.loggingService.catch("Error in Presence set inactivityTime: ","inactivity-time value is not a number."):(this._inactivityTime=e,this.presenceService.setInactivityTime(this._inactivityTime))}catch(t){this.loggingService.catch("Error in Presence set inactivityTime: ",t)}}get offlineInactivityTime(){return this._offlineInactivityTime}set offlineInactivityTime(e){try{isNaN(e)?this.loggingService.catch("Error in Presence set offlineInactivityTime: ","offline-inactivity-time value is not a number."):(this._offlineInactivityTime=e,this.presenceService.setOfflineInactivityTime(this._offlineInactivityTime))}catch(t){this.loggingService.catch("Error in Presence set offlineInactivityTime: ",t)}}get flockMode(){return this._flockMode}set flockMode(e){try{let t=typeof e=="string"?JSON.parse(e):e;t?(this._flockMode=t,this.flockService.enableFlockMode(),this.flockService.setNavigateEmitter(this.onNavigate)):(this._flockMode=t,this.flockService.disableFlockMode())}catch(t){this.loggingService.catch("Error in Presence set flockMode: ",t)}}set disableFlockNavigation(e){try{let t=e;typeof e=="string"&&(t=JSON.parse(e)),this.flockService.setDisableFlockNavigation(t)}catch(t){this.loggingService.catch("Error in Presence set disableFlockNavigation: ",t)}}set defaultFlockNavigation(e){try{let t=e;typeof e=="string"&&(t=JSON.parse(e)),this.flockService.setDisableFlockNavigation(!t)}catch(t){this.loggingService.catch("Error in Presence set defaultFlockNavigation: ",t)}}get location(){return this._location}set location(e){try{if(e&&typeof e=="string"){let t=JSON.parse(e);this._location=t,this.serverLocationId=At(this.location)}}catch(t){this.loggingService.catch("Error in Presence set location: ",t)}}set self(e){try{let t=e;typeof e=="string"&&(t=JSON.parse(e)),t?this.presenceService.enableIncludeSelf():this.presenceService.disableIncludeSelf()}catch{}}set _shadowDom(e){try{let t=e;typeof e=="string"&&(t=JSON.parse(e)),this.isExplicitShadowDom=!!t,this.componentConfigSignal.update(i=>(i=F(C({},i),{shadowDom:t}),i))}catch{}}constructor(e,t,i,a,h,y,L,Ve,Ye,xe,Ue,Te){super(xe,Ue,void 0,void 0,void 0,Te,h),this.analyticsService=e,this.authService=t,this.flockService=i,this.presenceService=a,this.loggingService=h,this.wireframeService=y,this.overlay=L,this.overlayPositionBuilder=Ve,this.viewContainerRef=Ye,this.elementRef=xe,this.themeService=Ue,this.dynamicDataService=Te,this.DEFAULT_MAX_USERS=5,this._maxUsers=this.DEFAULT_MAX_USERS,this._inactivityTime=5,this._offlineInactivityTime=10,this._flockMode=!1,this.onNavigate=new ue,this.isExplicitShadowDom=!1,this.onPresenceUserClickEmitter=new ue,this.presenceUsers=[],this.subscriptions=[],this.constants=p,this.onUsersChanged=new ue,this.onPresenceUserChange=new ue,this.componentConfigSignal=Ae({filteredPresenceUsers:[],user:null,shadowDom:!0,maxUsers:5,tooltipContent:null,trackById:this.trackById.bind(this),showTooltip:this.showTooltip.bind(this),closeTooltip:this.closeTooltip.bind(this),onPresenceUserClick:this.onPresenceUserClick.bind(this)}),this.veltElement=!0,this.componentId="velt-presence",this.loggingService.log("%c[WB] Creating CLASS: PresenceComponent","color: blue;"),this.subscriptions.push(this.authService.getUser$().subscribe(S=>{this.componentConfigSignal.update(w=>(w=F(C({},w),{user:S}),w)),this.componentConfigSignal().user&&(this.setPresenceInstalledInAnalytics(),this.presenceSetCustomMaxUsersInAnalytics())},S=>{this.loggingService.catch("Error in PresenceComponent getUser$ subscription: ",S)}))}ngOnInit(){this.loggingService.log("%c[WB] Calling FUNCTION: ngOnInit","color: green;");try{this.getOnlineUsersOnCurrentDocument(),this.setupA11yAttributes(),super.ngOnInit(),this.subscriptions.push(this.wireframeService.getWireframe$("velt-presence-wireframe").subscribe(t=>{if(t){let i=document.createElement(t.tagName);i.innerHTML=t.innerHTML,this.template=i}}))}catch(e){this.loggingService.catch("Error in PresenceComponent oninit: ",e)}}ngOnChanges(e){try{this.loggingService.log("%c[WB] Calling PresenceComponent FUNCTION: ngOnChanges","color: green;"),e&&(super.ngOnChanges(e),Object.keys(e).forEach(t=>{this.componentConfigSignal.update(i=>(i=F(C({},i),{[t]:e[t].currentValue}),i))}))}catch(t){this.loggingService.catch("Error in PresenceComponent ngOnChanges: ",t)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in PresenceComponent setupA11yAttributes:",e)}}ngOnDestroy(){this.loggingService.log("%c[WB] Calling FUNCTION: ngOnDestroy","color: green;");try{this.unsubscribe(),super.ngOnDestroy(),this.closeTooltip()}catch(e){this.loggingService.catch("Error in PresenceComponent ondestroy: ",e)}}unsubscribe(){this.loggingService.log("%c[WB] Calling FUNCTION: unsubscribe","color: green;");try{this.subscriptions.map(e=>{e.unsubscribe()}),this.subscriptions=[]}catch(e){this.loggingService.catch("Error in PresenceComponent unsubscribe: ",e)}}showTooltip(e,t){try{this.closeTooltip();let i=new I(e.currentTarget),a=this.overlayPositionBuilder.flexibleConnectedTo(i).withPositions([{originX:"center",originY:"bottom",overlayX:"center",overlayY:"top"},{originX:"center",originY:"top",overlayX:"center",overlayY:"bottom"},{originX:"start",originY:"center",overlayX:"end",overlayY:"center"},{originX:"end",originY:"center",overlayX:"start",overlayY:"center"}]);this.overlayRef=this.overlay.create({positionStrategy:a}),this.overlayRef.attach(new Ct(this.componentConfigSignal().tooltipContent,this.viewContainerRef,{$implicit:t}))}catch(i){this.loggingService.catch("Error in PresenceComponent showTooltip: ",i)}}closeTooltip(){try{this.overlayRef&&this.overlayRef.dispose()}catch(e){this.loggingService.catch("Error in PresenceComponent closeTooltip: ",e)}}getOnlineUsersOnCurrentDocument(){this.loggingService.log("%c[WB] Calling FUNCTION: getOnlineUsersOnCurrentDocument","color: green;");try{this.subscriptions.push(this.presenceService.getOnlineUsersOnCurrentDocument().pipe(Y(e=>!!e)).subscribe(e=>{this.loggingService.log(e),e&&(this.presenceUsers=e),this.filterPresenceUsers()},e=>{this.loggingService.catch("Error in PresenceComponent getOnlineUsersOnCurrentDocument subscription: ",e)}))}catch(e){this.loggingService.catch("Error in PresenceComponent getOnlineUsersOnCurrentDocument: ",e)}}filterPresenceUsers(){try{let e=[];this.presenceUsers?this.locationId?e=this.presenceUsers.filter(t=>t?.location?.id===this.locationId):this.location?e=this.presenceUsers.filter(t=>t.locationId===this.serverLocationId):e=this.presenceUsers:e=[],this.componentConfigSignal.update(t=>(t=F(C({},t),{filteredPresenceUsers:e}),t)),this.onUsersChanged.emit(this.componentConfigSignal().filteredPresenceUsers),this.onPresenceUserChange.emit(this.componentConfigSignal().filteredPresenceUsers)}catch(e){this.loggingService.catch("Error in PresenceComponent filterPresenceUsers: ",e)}}calculateUserAwayTime(e){try{if(e.onlineStatus===p.PRESENCE_STATUS_ONLINE)return 0;let t=me(e.timestamp);return Math.floor(t/1e3/60)}catch(t){this.loggingService.catch("Error in PresenceComponent calculateUserAwayTime: ",t)}return 0}setPresenceInstalledInAnalytics(){try{this.analyticsService.setInstalledFeature(X.PRESENCE)}catch(e){this.loggingService.catch("Error in PresenceComponent setPresenceInstalledInAnalytics: ",e)}}presenceSetCustomMaxUsersInAnalytics(){try{this.maxUsers!=this.DEFAULT_MAX_USERS&&this.analyticsService.trackEvent(E.Events.Presence.PRESENCE_SET_CUSTOM_MAX_USERS,{maxUsers:+this.maxUsers})}catch(e){this.loggingService.catch("Error in PresenceComponent presenceSetCustomMaxUsersInAnalytics: ",e)}}onPresenceUserClick(e){try{this.analyticsService.trackEvent(E.Events.Presence.PRESENCE_USER_CLICKED,{totalUsers:this.presenceService?.getPresenceUsers()?.length,presenceSnippylyUserIds:this.presenceService?.getPresenceUsers()?.map(t=>t.userSnippylyId),presenceClientUserIds:this.presenceService?.getPresenceUsers()?.map(t=>t.userId)}),this.onPresenceUserClickEmitter.emit(e),this.componentConfigSignal().user?.userSnippylyId!==e?.userSnippylyId&&this.flockService.getFlockMode()&&this.setFlockLeader(e.userSnippylyId,e.name)}catch(t){this.loggingService.catch("Error in PresenceComponent onPresenceUserClick: ",t)}}setFlockLeader(e,t){try{this.flockService.setFlockLeader(e,t)}catch(i){this.loggingService.catch("Error in PresenceComponent setFlockLeader: ",i)}}trackById(e,t){return t?.userId}};r.\u0275fac=function(t){return new(t||r)(m(ge),m($e),m(K),m(z),m(v),m(Be),m(yt),m(_t),m(ct),m(I),m(We),m(f))},r.\u0275cmp=x({type:r,selectors:[["app-presence"]],hostVars:1,hostBindings:function(t,i){t&2&&gt("data-velt-element",i.veltElement)},inputs:{maxUsers:"maxUsers",inactivityTime:"inactivityTime",offlineInactivityTime:"offlineInactivityTime",flockMode:"flockMode",disableFlockNavigation:"disableFlockNavigation",defaultFlockNavigation:"defaultFlockNavigation",location:"location",locationId:"locationId",self:"self",_shadowDom:[0,"shadowDom","_shadowDom"],variant:"variant"},outputs:{onNavigate:"onNavigate",onPresenceUserClickEmitter:"onPresenceUserClick",onUsersChanged:"usersChanged",onPresenceUserChange:"onPresenceUserChange"},standalone:!1,features:[U,Ne],decls:1,vars:1,consts:[["presenceRef",""],[4,"ngIf"],[4,"veltIf"],[4,"ngIf","ngIfElse"],[4,"ngTemplateOutlet"],["class","velt-presence-container s-presence-container",4,"ngIf"],[1,"velt-presence-container","s-presence-container"],[4,"veltDynamicTemplate"],[3,"componentConfigSignal"]],template:function(t,i){t&1&&g(0,$r,2,6,"ng-container",1),t&2&&c("ngIf",i.componentConfigSignal())},dependencies:[D,Me,N,A,be,Ee],styles:["html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}body.velt-pin-dragging[_ngcontent-%COMP%] iframe[_ngcontent-%COMP%]{pointer-events:none!important}[_nghost-%COMP%]{--velt-green: var(--velt-light-mode-green);--velt-magenta: var(--velt-light-mode-magenta);--velt-amber: var(--velt-light-mode-amber);--velt-purple: var(--velt-light-mode-purple);--velt-cyan: var(--velt-light-mode-cyan);--velt-orange: var(--velt-light-mode-orange);--velt-black: var(--velt-light-mode-black);--velt-white: var(--velt-light-mode-white);--velt-gray: var(--velt-light-mode-gray);--velt-error: var(--velt-light-mode-error);--velt-error-hover: var(--velt-light-mode-error-hover);--velt-error-foreground: var(--velt-light-mode-error-foreground);--velt-error-light: var(--velt-light-mode-error-light);--velt-error-transparent: var(--velt-light-mode-error-transparent);--velt-warning: var(--velt-light-mode-warning);--velt-warning-hover: var(--velt-light-mode-warning-hover);--velt-warning-foreground: var(--velt-light-mode-warning-foreground);--velt-warning-light: var(--velt-light-mode-warning-light);--velt-warning-transparent: var(--velt-light-mode-warning-transparent);--velt-agent-accent: #4495ff;--velt-agent-accent-transparent: rgba(68, 149, 255, .2);--velt-success: var(--velt-light-mode-success);--velt-success-hover: var(--velt-light-mode-success-hover);--velt-success-foreground: var(--velt-light-mode-success-foreground);--velt-success-light: var(--velt-light-mode-success-light);--velt-success-transparent: var(--velt-light-mode-success-transparent);--velt-accent: var(--velt-light-mode-accent);--velt-accent-text: var(--velt-light-mode-accent-text);--velt-accent-hover: var(--velt-light-mode-accent-hover);--velt-accent-foreground: var(--velt-light-mode-accent-foreground);--velt-accent-light: var(--velt-light-mode-accent-light);--velt-accent-transparent: var(--velt-light-mode-accent-transparent);--velt-text-0: var(--velt-light-mode-text-0);--velt-text-1: var(--velt-light-mode-text-1);--velt-text-2: var(--velt-light-mode-text-2);--velt-text-3: var(--velt-light-mode-text-3);--velt-text-4: var(--velt-light-mode-text-4);--velt-text-5: var(--velt-light-mode-text-5);--velt-text-6: var(--velt-light-mode-text-6);--velt-text-7: var(--velt-light-mode-text-7);--velt-text-8: var(--velt-light-mode-text-8);--velt-text-9: var(--velt-light-mode-text-9);--velt-text-10: var(--velt-light-mode-text-10);--velt-text-11: var(--velt-light-mode-text-11);--velt-text-12: var(--velt-light-mode-text-12);--velt-background-0: var(--velt-light-mode-background-0);--velt-background-1: var(--velt-light-mode-background-1);--velt-background-2: var(--velt-light-mode-background-2);--velt-background-3: var(--velt-light-mode-background-3);--velt-background-4: var(--velt-light-mode-background-4);--velt-background-5: var(--velt-light-mode-background-5);--velt-background-6: var(--velt-light-mode-background-6);--velt-background-7: var(--velt-light-mode-background-7);--velt-background-8: var(--velt-light-mode-background-8);--velt-background-9: var(--velt-light-mode-background-9);--velt-background-10: var(--velt-light-mode-background-10);--velt-border-0: var(--velt-light-mode-border-0);--velt-border-1: var(--velt-light-mode-border-1);--velt-border-2: var(--velt-light-mode-border-2);--velt-border-3: var(--velt-light-mode-border-3);--velt-border-4: var(--velt-light-mode-border-4);--velt-border-5: var(--velt-light-mode-border-5);--velt-border-6: var(--velt-light-mode-border-6);--velt-border-7: var(--velt-light-mode-border-7);--velt-border-8: var(--velt-light-mode-border-8);--velt-border-9: var(--velt-light-mode-border-9);--velt-border-10: var(--velt-light-mode-border-10);--velt-background-transparent: var(--velt-light-mode-background-transparent);--velt-border-transparent: var(--velt-light-mode-border-transparent);--velt-animation-transparent: var(--velt-light-mode-animation-transparent)}[_nghost-%COMP%]:empty{display:none}[dark][_nghost-%COMP%]{--velt-green: var(--velt-dark-mode-green);--velt-magenta: var(--velt-dark-mode-magenta);--velt-amber: var(--velt-dark-mode-amber);--velt-purple: var(--velt-dark-mode-purple);--velt-cyan: var(--velt-dark-mode-cyan);--velt-orange: var(--velt-dark-mode-orange);--velt-black: var(--velt-dark-mode-black);--velt-white: var(--velt-dark-mode-white);--velt-gray: var(--velt-dark-mode-gray);--velt-error: var(--velt-dark-mode-error);--velt-error-hover: var(--velt-dark-mode-error-hover);--velt-error-foreground: var(--velt-dark-mode-error-foreground);--velt-error-light: var(--velt-dark-mode-error-light);--velt-error-transparent: var(--velt-dark-mode-error-transparent);--velt-warning: var(--velt-dark-mode-warning);--velt-warning-hover: var(--velt-dark-mode-warning-hover);--velt-warning-foreground: var(--velt-dark-mode-warning-foreground);--velt-warning-light: var(--velt-dark-mode-warning-light);--velt-warning-transparent: var(--velt-dark-mode-warning-transparent);--velt-agent-accent: #4495ff;--velt-agent-accent-transparent: rgba(68, 149, 255, .2);--velt-success: var(--velt-dark-mode-success);--velt-success-hover: var(--velt-dark-mode-success-hover);--velt-success-foreground: var(--velt-dark-mode-success-foreground);--velt-success-light: var(--velt-dark-mode-success-light);--velt-success-transparent: var(--velt-dark-mode-success-transparent);--velt-accent: var(--velt-dark-mode-accent);--velt-accent-text: var(--velt-dark-mode-accent-text);--velt-accent-hover: var(--velt-dark-mode-accent-hover);--velt-accent-foreground: var(--velt-dark-mode-accent-foreground);--velt-accent-light: var(--velt-dark-mode-accent-light);--velt-accent-transparent: var(--velt-dark-mode-accent-transparent);--velt-text-0: var(--velt-dark-mode-text-0);--velt-text-1: var(--velt-dark-mode-text-1);--velt-text-2: var(--velt-dark-mode-text-2);--velt-text-3: var(--velt-dark-mode-text-3);--velt-text-4: var(--velt-dark-mode-text-4);--velt-text-5: var(--velt-dark-mode-text-5);--velt-text-6: var(--velt-dark-mode-text-6);--velt-text-7: var(--velt-dark-mode-text-7);--velt-text-8: var(--velt-dark-mode-text-8);--velt-text-9: var(--velt-dark-mode-text-9);--velt-text-10: var(--velt-dark-mode-text-10);--velt-text-11: var(--velt-dark-mode-text-11);--velt-text-12: var(--velt-dark-mode-text-12);--velt-background-0: var(--velt-dark-mode-background-0);--velt-background-1: var(--velt-dark-mode-background-1);--velt-background-2: var(--velt-dark-mode-background-2);--velt-background-3: var(--velt-dark-mode-background-3);--velt-background-4: var(--velt-dark-mode-background-4);--velt-background-5: var(--velt-dark-mode-background-5);--velt-background-6: var(--velt-dark-mode-background-6);--velt-background-7: var(--velt-dark-mode-background-7);--velt-background-8: var(--velt-dark-mode-background-8);--velt-background-9: var(--velt-dark-mode-background-9);--velt-background-10: var(--velt-dark-mode-background-10);--velt-border-0: var(--velt-dark-mode-border-0);--velt-border-1: var(--velt-dark-mode-border-1);--velt-border-2: var(--velt-dark-mode-border-2);--velt-border-3: var(--velt-dark-mode-border-3);--velt-border-4: var(--velt-dark-mode-border-4);--velt-border-5: var(--velt-dark-mode-border-5);--velt-border-6: var(--velt-dark-mode-border-6);--velt-border-7: var(--velt-dark-mode-border-7);--velt-border-8: var(--velt-dark-mode-border-8);--velt-border-9: var(--velt-dark-mode-border-9);--velt-border-10: var(--velt-dark-mode-border-10);--velt-background-transparent: var(--velt-dark-mode-background-transparent);--velt-border-transparent: var(--velt-dark-mode-border-transparent);--velt-animation-transparent: var(--velt-dark-mode-animation-transparent)}[_nghost-%COMP%]{position:relative;display:inline-flex;justify-content:center;align-items:center;margin:0;padding:0;-webkit-tap-highlight-color:rgba(255,255,255,0);box-sizing:border-box;width:auto;height:calc((1.5 + 0px) * var(--velt-base-rem-unit));font-size:var(--velt-font-size-xs);line-height:1.5;background:transparent}.velt-presence-container[_ngcontent-%COMP%]{position:relative;display:flex;flex-direction:row;justify-content:center;align-items:center;height:calc((1.5 + 0px) * var(--velt-base-rem-unit));min-width:calc((1.5 + 0px) * var(--velt-base-rem-unit))}"],changeDetection:0});let n=r;return n})();var Pe=(()=>{let r=class r{constructor(e,t,i){this.analyticsService=e,this.loggingService=t,this.presenceService=i,this.actionSubjects=new Map,this.subscriptions=[];try{this.presenceService.setPresenceActionsService(this)}catch(a){this.loggingService.catch("Error in PresenceActionsService constructor: ",a)}}onMultipleUsersOnline(e){try{this.loggingService.log("%c[WB] Calling PresenceActionsService FUNCTION: onMultipleUsersOnline","color: green;"),this.triggerAction(nt.MULTIPLE_USERS_ONLINE,e),this.analyticsService.trackEvent(E.Events.Presence.MULTIPLE_USERS_ONLINE,{totalUsers:e?.users?.length,presenceSnippylyUserIds:e?.users?.map(t=>t.userSnippylyId),presenceClientUserIds:e?.users?.map(t=>t.userId)})}catch(t){this.loggingService.catch("Error in PresenceActionsService onMultipleUsersOnline: ",t)}}onUserStateChange(e){try{this.loggingService.log("%c[WB] Calling PresenceActionsService FUNCTION: onUserStateChange","color: green;"),this.triggerAction(nt.USER_STATE_CHANGE,e),this.analyticsService.trackEvent(E.Events.Presence.ON_USER_STATE_CHANGE,{userSnippylyId:e?.user?.userSnippylyId,userId:e?.user?.userId,state:e?.state})}catch(t){this.loggingService.catch("Error in PresenceActionsService onUserStateChange: ",t)}}getData(e){try{return this.loggingService.log("%c[WB] Calling PresenceActionsService FUNCTION: getData","color: green;"),this.presenceService.getOnlineUsersOnCurrentDocument(e).pipe(j(t=>({data:t})))}catch(t){return this.loggingService.catch("Error in PresenceActionsService getData: ",t),R({data:null})}}triggerAction(e,t){try{this.actionSubjects.has(e)||this.actionSubjects.set(e,new Xe),this.actionSubjects.get(e)?.next(t)}catch(i){this.loggingService.catch("Error in PresenceActionsService triggerAction: ",i)}}onAction(e){try{return this.actionSubjects.has(e)||this.actionSubjects.set(e,new Xe),this.actionSubjects.get(e)?.asObservable()}catch(t){return this.loggingService.catch("Error in PresenceActionsService onAction: ",t),R(null)}}};r.\u0275fac=function(t){return new(t||r)(P(ge),P(v),P(z))},r.\u0275prov=ae({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();var Ge=class extends Xt{constructor(r){super(r),this.getService(v).log("%c[WB] Creating CLASS: PresenceElement","color: blue;"),this.getOnlineUsersOnCurrentDocument=this._getOnlineUsersOnCurrentDocument,this.setInactivityTime=this._setInactivityTime,this.enableFlockMode=this._enableFlockMode,this.disableFlockMode=this._disableFlockMode,this.startFollowingUser=this._startFollowingUser,this.stopFollowingUser=this._stopFollowingUser,this.enableSelf=this._enableSelf,this.disableSelf=this._disableSelf,this.getData=this._getData,this.on=this._on,this.addUser=this._addUser,this.removeUser=this._removeUser}_getOnlineUsersOnCurrentDocument(){this.getService(v).log("%c[WB] Calling FUNCTION: getOnlineUsers","color: green;");try{return this.trackEvent(E.Events.Presence.GET_ONLINE_USERS_ON_CURRENT_DOCUMENT_TRIGGERED),this.getService(z).getOnlineUsersOnCurrentDocument()}catch(r){return this.getService(v).catch("Error in _getOnlineUsersOnCurrentDocument: ",r),R(null)}}_setInactivityTime(r){this.getService(v).log("%c[WB] Calling FUNCTION: _setInactivityTime","color: green;");try{this.trackEvent(E.Events.Presence.SET_INACTIVITY_TIME_TRIGGERED,{payload:{time:r}}),isNaN(r)?this.getService(v).catch("Error in setInactivityTime: ","Provided value is not a number."):this.getService(z).setInactivityTime(r)}catch(o){this.getService(v).catch("Error in setInactivityTime: ",o)}}_disableFlockMode(){try{this.trackEvent(E.Events.Presence.DISABLE_FLOCK_MODE_TRIGGERED),this.getService(K).disableFlockMode()}catch(r){this.getService(v).catch("Error in _disableFlockMode: ",r)}}_enableFlockMode(r){try{this.trackEvent(E.Events.Presence.ENABLE_FLOCK_MODE_TRIGGERED,{payload:{options:r}}),this.getService(K).enableFlockMode(r)}catch(o){this.getService(v).catch("Error in _enableFlockMode: ",o)}}_stopFollowingUser(){try{this.trackEvent(E.Events.Presence.STOP_FOLLOWING_USER_TRIGGERED),this.getService(K).stopFollowingUser()}catch(r){this.getService(v).catch("Error in _stopFollowingUser: ",r)}}_startFollowingUser(r){try{this.trackEvent(E.Events.Presence.START_FOLLOWING_USER_TRIGGERED,{payload:{externalId:r}});let o=this.getService(z).getPresenceUserFromExternalId(r);return o&&o.userSnippylyId&&o.name!==void 0?(this.getService(K).startFollowingUser(o.userSnippylyId,o.name),{success:!0,msg:"Joined flock session."}):{success:!1,msg:"User could not be found."}}catch(o){return this.getService(v).catch("Error in _startFollowingUser: ",o),{success:!1,msg:"Unknown error.",raw:o}}}_enableSelf(){try{this.trackEvent(E.Events.Presence.ENABLE_SELF_TRIGGERED),this.getService(z).enableIncludeSelf()}catch(r){this.getService(v).catch("Error in _enableSelf: ",r)}}_disableSelf(){try{this.trackEvent(E.Events.Presence.DISABLE_SELF_TRIGGERED),this.getService(z).disableIncludeSelf()}catch(r){this.getService(v).catch("Error in _disableSelf: ",r)}}_getData(r){this.getService(v).log("%c[WB] Calling FUNCTION: getData","color: green;");try{return this.trackEvent(E.Events.Presence.GET_PRESENCE_DATA_TRIGGERED,{payload:{query:r}}),r&&typeof r=="object"&&(r=C({},r),r?.documentId&&(r.documentId=Ot(r.documentId)),r?.organizationId&&(r.organizationId=kt(r.organizationId))),this.getService(Pe).getData(r)}catch(o){return this.getService(v).catch("Error in _getData: ",o),R({data:null})}}_on(r){this.getService(v).log("%c[WB] Calling FUNCTION: on","color: green;");try{return this.getService(Pe).onAction(r)}catch(o){return this.getService(v).catch("Error in _on: ",o),R(null)}}_addUser(r){this.getService(v).log("%c[WB] Calling FUNCTION: addUser","color: green;");try{if(this.trackEvent(E.Events.Presence.ADD_USER_TRIGGERED,{payload:{userId:r?.user?.userId,localOnly:r?.localOnly}}),!r?.user?.userId){this.getService(v).catch("Error in addUser: ","userId is required");return}this.getService(z).addCustomUser(r)}catch(o){this.getService(v).catch("Error in addUser: ",o)}}_removeUser(r){this.getService(v).log("%c[WB] Calling FUNCTION: removeUser","color: green;");try{if(this.trackEvent(E.Events.Presence.REMOVE_USER_TRIGGERED,{payload:{userId:r?.user?.userId,localOnly:r?.localOnly}}),!r?.user?.userId){this.getService(v).catch("Error in removeUser: ","userId is required");return}this.getService(z).removeCustomUser(r)}catch(o){this.getService(v).catch("Error in removeUser: ",o)}}};var mn=(()=>{let r=class r{};r.\u0275fac=function(t){return new(t||r)},r.\u0275mod=mt({type:r}),r.\u0275inj=st({imports:[St,re,Je]});let n=r;return n})();var gn=(()=>{let r=class r{constructor(e,t){this.loggingService=e,this.usersService=t}getUserIdsToResolveFromPresenceUsers(e){try{let t=new Set;for(let i of e)i?.userId&&t.add(i?.userId);return Array.from(t)}catch(t){return this.loggingService.catch("Error in PresenceUtilsService getUserIdsToResolveFromPresenceUsers:",t),[]}}mergePresenceUserWithUser(e){try{if(this.usersService.userDataProviderAvailable()&&e?.userId){let t=this.usersService.getUserById(e?.userId);t&&(e=C(C({},e),t))}return e}catch(t){return this.loggingService.catch("Error in PresenceUtilsService mergePresenceUserWithUser:",t),e}}formatPresenceUserData(e){try{if(this.usersService.userDataProviderAvailable()){let t=["userId","onlineStatus","userSnippylyId","color","textColor","timestamp","type","selections","documentParamsId","documentParams","locationId","location","isReadOnly","isAnonymous","pageInfo"];Object.keys(e).forEach(i=>{t.includes(i)||(e[i]=null)})}return e}catch(t){return this.loggingService.catch("Error in PresenceUtilsService formatPresenceUserData:",t),e}}};r.\u0275fac=function(t){return new(t||r)(P(v),P(Jt))},r.\u0275prov=ae({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();var Br={"velt-presence-wireframe":pe,"velt-presence-avatar-list-wireframe":be,"velt-presence-avatar-list-item-wireframe":Ie,"velt-presence-avatar-remaining-count-wireframe":Ee,"velt-presence-tooltip-wireframe":ye,"velt-presence-tooltip-avatar-wireframe":he,"velt-presence-tooltip-user-active-wireframe":fe,"velt-presence-tooltip-user-inactive-wireframe":Se,"velt-presence-tooltip-user-name-wireframe":Ce,"velt-presence-tooltip-status-container-wireframe":_e};Object.assign(Vt,Br);function Wr(n){n.get(v).log("%c[WB] Loading presence feature chunk","color: blue;");let o=n.get(jt);o.set(Rt,n.get(z)),o.set(Mt,n.get(Pe)),o.set(Lt,n.get(gn));let t=lt(mn,n).injector;return vn(t,p.TAGS.VELT_PRESENCE,pe),vn(t,p.TAGS.SNIPPYLY_PRESENCE,pe),new Ge(n)}function vn(n,r,o){if(customElements.get(r))return;let e=It(o,{injector:n});customElements.define(r,e)}export{Wr as default};
1
+ import{a as K}from"./chunk-HDABOQPS.js";import"./chunk-ENIVQSM6.js";import{A,B as N,y as Vt}from"./chunk-NR3CZ6OR.js";import{a as Be}from"./chunk-MX66OK5A.js";import{b as ve,c as Je,d as re}from"./chunk-XJWB3IUW.js";import{a as Xt}from"./chunk-G56O673H.js";import{a as Yt}from"./chunk-GUGGWPZ7.js";import{a as It}from"./chunk-ZMXXM7C4.js";import{D as _t,F as yt,da as f,ea as We,fa as B,ga as ze,s as Ct}from"./chunk-J3FNQGWW.js";import{$ as ae,$e as rt,$f as Dt,Ci as Wt,Db as vt,Dd as bt,De as X,E as Y,Eb as pt,Fa as l,Fb as dt,Fc as ft,G as ot,Ga as ue,Gc as D,Gd as Le,Hd as Et,Hi as zt,I as He,Ib as te,Ii as Jt,J as Oe,Jb as ut,Kb as Fe,L as Ke,Lc as Me,M as Qe,Nb as se,Nd as Pt,Ob as Re,Pa as m,Pb as ht,Pc as St,Ph as Rt,Q as at,Qh as Mt,Qi as Gt,Ra as ct,Rf as Ot,Rh as Lt,Sf as kt,T as W,Ta as lt,Te as p,Ua as x,Ud as xt,Va as mt,W as H,Wd as Ut,X as Ze,Ya as U,_a as g,_b as $,_d as Tt,a as C,aa as st,b as F,bc as _,bg as me,ca as P,cc as b,db as gt,dc as tt,fc as k,g as oe,ha as ke,ia as De,je as E,k as Xe,kc as ce,kg as At,l as de,lb as c,lc as le,mb as T,nb as O,ni as jt,ob as M,oi as ge,pc as ne,pi as v,qa as Ae,qi as $t,r as R,ri as Bt,sb as d,se as nt,tb as u,th as wt,ua as Ne,ub as we,ui as je,v as j,vb as qe,vf as it,vi as $e,wa as I,wg as Nt,xb as et,xh as Ft,zb as s}from"./chunk-TY3WZ4Q4.js";var z=(()=>{let r=class r{constructor(e,t,i,a,h,y,L,Ve,Ye,xe,Ue,Te){this.analyticsService=e,this.docService=t,this.domService=i,this.authService=a,this.afAuth=h,this.iamService=y,this.databaseService=L,this.configService=Ve,this.avatarService=Ye,this.loggingService=xe,this.flockService=Ue,this.commonDbService=Te,this.db=null,this.presenceUser$=new de(new it),this.documentPaths=null,this.inactivityTime=300*1e3,this.offlineInactivityTime=600*1e3,this.presenceUsers$=new de([]),this.presenceUsersSubscription=null,this.includeSelf$=new de(!0),this.customPresenceUsers$=new de([]),this.userIdleStateDetectionSubscription=null,this.userOfflineStateDetectionSubscription=null;try{this.loggingService.log("%c[WB] Creating CLASS: PresenceService","color: blue;"),this.databaseService.getDb().pipe(Y(S=>!!S),Oe(1)).subscribe(S=>{S&&(this.db=S,this.getUser(),this.getDocumentPaths(),this.getLocation(),this.updateOnUserDbConnectionStateChange().subscribe(()=>{},w=>{this.loggingService.catch("Error in PresenceService constructor updateOnUserDbConnectionStateChange: ",w)}),this.updateOnDatabaseDisconnect().subscribe(()=>{},w=>{this.loggingService.catch("Error in PresenceService constructor updateOnDatabaseDisconnect: ",w)}),this.updateOnDocumentFocusChange(),this.updateOnAllowedFeatureListChange())},S=>{this.loggingService.catch("Error in PresenceService constructor: ",S)}),this.authService.addPreSignOutFuction("presence-signout",this.signOutUser.bind(this)),this.presenceUsers$.pipe(Qe()).subscribe(([S,w])=>{try{w?.length>=0&&this.analyticsService.updateDefaultProperties({presenceUsersCount:w?.length}),sessionStorage.getItem(p.SESSION_STORAGE.VELT_PRESENCE_MULTIPLE_USERS_ONLINE)||w?.length>1&&S.length!==w.length&&(sessionStorage.setItem(p.SESSION_STORAGE.VELT_PRESENCE_MULTIPLE_USERS_ONLINE,"true"),this.presenceActionsService?.onMultipleUsersOnline({users:w}))}catch(pn){this.loggingService.catch("Error in presenceUsers$ pairwise subscription: ",pn)}}),this.authService.getUser$().pipe(Y(S=>!!S),Oe(1)).subscribe(S=>{S?(this.detectUserIdleState(),this.detectUserOfflineState()):(this.unsubscribeUserIdleStateDetectionSubscription(),this.unsubscribeUserOfflineStateDetectionSubscription())}),this.presenceUser$.subscribe(S=>{try{S?.onlineStatus&&this.presenceActionsService?.onUserStateChange({user:JSON.parse(JSON.stringify(S)),state:S?.onlineStatus})}catch(w){this.loggingService.catch("Error in presenceUser$ subscription: ",w)}},S=>{this.loggingService.catch("Error in presenceUser$ subscribe: ",S)}),this.customPresenceUsers$.subscribe(()=>{try{let S=this.presenceUsers$.value.filter(w=>!w.localOnly);this.presenceUsers$.next(this.mergeWithCustomUsers(S))}catch(S){this.loggingService.catch("Error in customPresenceUsers$ subscription: ",S)}}),this.domService.onNetworkStatusChange$().subscribe(S=>{try{!S&&this.presenceUser$?.value?.onlineStatus&&this.presenceActionsService?.onUserStateChange({user:F(C({},JSON.parse(JSON.stringify(this.presenceUser$.value))),{onlineStatus:p.PRESENCE_STATUS_OFFLINE}),state:p.PRESENCE_STATUS_OFFLINE})}catch(w){this.loggingService.catch("Error in domService.onNetworkStatusChange$ subscription: ",w)}},S=>{this.loggingService.catch("Error in domService.onNetworkStatusChange$ subscribe: ",S)})}catch(S){this.loggingService.catch("Error in PresenceService constructor: ",S)}}setPresenceActionsService(e){try{this.presenceActionsService=e}catch(t){this.loggingService.catch("Error in setPresenceActionsService: ",t)}}detectUserIdleState(){try{this.unsubscribeUserIdleStateDetectionSubscription();let e=!1;this.userIdleStateDetectionSubscription=this.domService.onWindowPointerMove$().pipe(Ze(2e3),H(()=>{this.presenceUser$.value&&e&&(this.setCurrentPresenceUserStatus(p.PRESENCE_STATUS_ONLINE),e=!1)}),He(this.inactivityTime),H(()=>{this.setCurrentPresenceUserStatus(p.PRESENCE_STATUS_AWAY,{isUserIdle:!0}),e=!0})).subscribe()}catch(e){this.loggingService.catch("Error in detectUserIdleState: ",e)}}detectUserOfflineState(){try{this.unsubscribeUserOfflineStateDetectionSubscription();let e=!1;this.userOfflineStateDetectionSubscription=this.domService.onWindowPointerMove$().pipe(Ze(2e3),He(this.offlineInactivityTime),H(()=>{this.setCurrentPresenceUserStatus(p.PRESENCE_STATUS_OFFLINE,{isUserIdle:!0}),e=!0})).subscribe()}catch(e){this.loggingService.catch("Error in detectUserOfflineState: ",e)}}unsubscribeUserIdleStateDetectionSubscription(){try{this.userIdleStateDetectionSubscription&&(this.userIdleStateDetectionSubscription.unsubscribe(),this.userIdleStateDetectionSubscription=null)}catch(e){this.loggingService.catch("Error in unsubscribeUserIdleStateDetectionSubscription: ",e)}}unsubscribeUserOfflineStateDetectionSubscription(){try{this.userOfflineStateDetectionSubscription&&(this.userOfflineStateDetectionSubscription.unsubscribe(),this.userOfflineStateDetectionSubscription=null)}catch(e){this.loggingService.catch("Error in unsubscribeUserOfflineStateDetectionSubscription: ",e)}}getUser(){this.loggingService.log("%c[WB] Calling FUNCTION: getUser","color: green;"),this.authService.getUser$().pipe(Y(e=>!!e)).subscribe(e=>{e&&this.setPresenceUser(e)},e=>{this.loggingService.catch("Error in getUser: ",e)})}getDocumentPaths(){this.loggingService.log("%c[WB] Calling FUNCTION: getDocumentPaths","color: green;"),this.docService.getDocumentPaths$().pipe(H(e=>{this.documentPaths=e}),Qe(),H(([e,t])=>{e&&this.updateUserStatusOnDocumentChange(p.PRESENCE_STATUS_OFFLINE,e),t&&this.updateUserStatusOnDocumentChange(p.PRESENCE_STATUS_ONLINE,t)})).subscribe(()=>{},e=>{this.loggingService.catch("Error in getDocumentPaths: ",e)})}getLocation(){this.docService.getLocation$().pipe(H(e=>{this.updateUserOnLocationChange(e)})).subscribe(()=>{},e=>{this.loggingService.catch("Error in getLocation: ",e)})}getPresenceUser(){return this.loggingService.log("%c[WB] Calling FUNCTION: getPresenceUser","color: green;"),this.presenceUser$.asObservable()}getPresenceUserValue(){return this.presenceUser$.value}getOnlineUsersOnCurrentDocument(e){return this.loggingService.log("%c[WB] Calling FUNCTION: getOnlineUsersOnCurrentDocument","color: green;"),Le(this.afAuth).pipe(Y(t=>!!t),W(t=>this.isFeatureAllowed({firebaseUser:t,users:[],filteredUsers:[]})),W(t=>t.featureAllowed?this.iamService.isUserAllowed$().pipe(j(i=>(t.featureAllowed=i,t))):R(t)),W(t=>t.featureAllowed?this.authService.isPlanExpired$().pipe(j(i=>(t.featureAllowed=!i,t))):R(t)),W(t=>t.featureAllowed?R(t).pipe(W(i=>this.docService.getDocumentPaths$().pipe(j(a=>(this.documentPaths=a,i.documentPaths=a,i)))),W(i=>this.getDataFromDocumentId(e).pipe(j(a=>(i.users=a||[],C({},i))))),j(i=>(e?e?.statuses?.length?i.filteredUsers=i?.users?.filter(a=>e?.statuses?.includes(a?.onlineStatus)):i.filteredUsers=i?.users?.slice():i.filteredUsers=this.filterOnlineUsers(i.users,i.firebaseUser),i)),W(i=>this.getIncludeSelf$().pipe(j(a=>(a||(i.filteredUsers=i?.filteredUsers?.filter(h=>h?.userSnippylyId!==i.user?.userSnippylyId)),i)))),W(i=>{let a=i?.filteredUsers||[];return this.customPresenceUsers$.pipe(j(()=>this.mergeWithCustomUsers(a)))})):R([])),Ke(Ft))}isFeatureAllowed(e){return this.configService.getConfig$().pipe(Y(t=>!!t),j(t=>F(C({},e),{config:t})),W(t=>this.authService.getUser$().pipe(j(i=>F(C({},t),{user:i})))),W(t=>Dt(t.config,t.user,X.PRESENCE)?R(F(C({},t),{featureAllowed:!0})):(this.loggingService.warn("Presence feature is not allowed."),R(F(C({},t),{featureAllowed:!1})))),Ke((t,i)=>t?.featureAllowed===i?.featureAllowed))}getDataFromDocumentId(e){return this.databaseService.getDb().pipe(Y(t=>!!t),W(t=>{if(this.db=t,this.loggingService.log(this.db),this.configService?.getApiKey()&&this.documentPaths?.presence){let i=new Date(Date.now()-864e5).getTime();return this.commonDbService.dbListener({feature:"allPresence",properties:{documentId:e?.documentId??this.documentPaths?.documentId,organizationId:e?.organizationId??this.documentPaths?.organizationId,skipFirestore:!0,useQuery:!0,rtdbQuery:[xt("timestamp"),Tt(i)]}}).pipe(ot(a=>(this.loggingService.catch("Error in PresenceService getDataFromDocumentId: ",a),R(null))),j(a=>a?.data),j(a=>{let h=[];if(a){let y=Object.values(a).filter(L=>typeof L=="object");for(let L of y)h.push(L)}return h}))}else return R([])}))}filterOnlineUsers(e,t){this.loggingService.log("%c[WB] Calling FUNCTION: filterOnlineUsers","color: green;");try{let a=e.slice().filter(h=>{let y=me(h.timestamp);return h.userSnippylyId&&(h.onlineStatus===p.PRESENCE_STATUS_ONLINE||h.onlineStatus===p.PRESENCE_STATUS_AWAY)&&y<this.offlineInactivityTime});return this.presenceUsers$.next(this.mergeWithCustomUsers(a)),a}catch(i){return this.loggingService.catch("Error in filterOnlineUsers:",i),[]}}enableIncludeSelf(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: enableIncludeSelf","color: green;"),this.includeSelf$.value===!0)return;this.includeSelf$.next(!0)}catch(e){this.loggingService.catch("Error in PresenceService enableIncludeSelf: ",e)}}disableIncludeSelf(){try{if(this.loggingService.log("%c[WB] Calling FUNCTION: disableIncludeSelf","color: green;"),this.includeSelf$.value===!1)return;this.includeSelf$.next(!1)}catch(e){this.loggingService.catch("Error in PresenceService disableIncludeSelf: ",e)}}getIncludeSelf$(){return this.includeSelf$.asObservable()}getIncludeSelf(){return this.includeSelf$.value}getPresenceUserFromExternalId(e){try{if(this.presenceUsers$.value&&this.presenceUsers$.value.length>0){let t=this.presenceUsers$.value.find(i=>i.userId===e);if(t)return t}return null}catch(t){return this.loggingService.catch("Error in getNameFromSnippylyId:",t),null}}getAnonymousAvatarImage(){return this.loggingService.log("%c[WB] Calling FUNCTION: getAnonymousAvatarImage","color: green;"),this.avatarService.generateUserImage()}updateCurrentPresenceUser(e){return oe(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: updateCurrentPresenceUser","color: green;");try{if(this.documentPaths?.presence&&e&&e.userId&&this.authService.isFeatureAllowed(X.PRESENCE)){if(!e.isAnonymous){e.pageInfo=new rt,e?.onlineStatus===p.PRESENCE_STATUS_ONLINE&&(e.isTabAway=!1,e.isUserIdle=!1);let t=JSON.parse(JSON.stringify(e));this.authService.getUser()&&this.commonDbService.updateData({feature:"presence",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,userId:e.userSnippylyId,skipFirestore:!0},data:JSON.parse(JSON.stringify(F(C({},t),{timestamp:this.timestamp})))})}this.presenceUser$.next(e)}}catch(t){this.loggingService.catch("Error in updateCurrentPresenceUser:",t)}})}setCurrentPresenceUserStatus(e,t){return oe(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: setCurrentPresenceUserStatus","color: green;");try{this.loggingService.log(e);let i=this.presenceUser$.value;if(i.onlineStatus!==e){this.presenceUsersSubscription&&this.presenceUsersSubscription?.unsubscribe();let a=i.onlineStatus,h=e;this.presenceUsersSubscription=this.getPresenceUsers$().pipe(Y(y=>!!y?.length),Oe(1)).subscribe(y=>{y?.length>1&&this.analyticsService.trackEvent(E.Events.Presence.PRESENCE_USER_STATUS_CHANGED,{oldStatus:a,newStatus:h,totalUsers:y?.length,presenceSnippylyUserIds:y?.map(L=>L.userSnippylyId),presenceClientUserIds:y?.map(L=>L.userId)})})}i.onlineStatus=e,t&&(i.isTabAway=t?.isTabAway,i.isUserIdle=t?.isUserIdle),e===p.PRESENCE_STATUS_ONLINE&&(i.isTabAway=!1,i.isUserIdle=!1),e===p.PRESENCE_STATUS_OFFLINE&&this.flockService.isInSession()&&this.flockService.removeCurrentUserFromSession(),this.updateCurrentPresenceUser(i)}catch(i){this.loggingService.catch("Error in setCurrentPresenceUserStatus:",i)}})}updateUserStatusOnDocumentChange(e,t){return oe(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: updateUserStatusOnDocumentChange","color: green;");try{let i=this.presenceUser$.value;if(i.onlineStatus=e,t?.presence&&i&&i.userId&&!i.isAnonymous&&this.authService.isFeatureAllowed(X.PRESENCE)){let a=JSON.parse(JSON.stringify(i));this.commonDbService.updateData({feature:"presence",properties:{documentId:t?.documentId,organizationId:t?.organizationId,userId:i.userSnippylyId,skipFirestore:!0},data:JSON.parse(JSON.stringify(a))})}}catch(i){this.loggingService.catch("Error in updateUserStatusOnDocumentChange:",i)}})}updateUserOnLocationChange(e){return oe(this,null,function*(){this.loggingService.log("%c[WB] Calling FUNCTION: updateUserOnLocationChange","color: green;");try{let t=this.presenceUser$.value;if(t.location=e?e.location:null,t.locationId=e?e?.locationId:null,this.documentPaths?.presence&&t&&t.userId&&!t.isAnonymous&&this.authService.isFeatureAllowed(X.PRESENCE)){let i=JSON.parse(JSON.stringify(t));this.commonDbService.updateData({feature:"presence",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,userId:t.userSnippylyId,skipFirestore:!0},data:JSON.parse(JSON.stringify(i))})}}catch(t){this.loggingService.catch("Error in updateUserOnLocationChange:",t)}})}updateOnUserDbConnectionStateChange(){this.loggingService.log("%c[WB] Calling FUNCTION: updateOnUserDbConnectionStateChange","color: green;");let e=Ut(this.db,".info/connected"),t=Pt(e).pipe(j(i=>i?p.PRESENCE_STATUS_ONLINE:p.PRESENCE_STATUS_OFFLINE));return Le(this.afAuth).pipe(at(1),W(i=>i?t:R(p.PRESENCE_STATUS_OFFLINE)),H(i=>this.setCurrentPresenceUserStatus(i)))}updateOnDocumentFocusChange(){this.loggingService.log("%c[WB] Calling FUNCTION: updateOnDocumentFocusChange","color: green;");try{document&&document.addEventListener("visibilitychange",e=>{this.authService.getUser()&&(document.visibilityState==="hidden"?(this.setCurrentPresenceUserStatus(p.PRESENCE_STATUS_AWAY,{isTabAway:!0}),this.flockService.getFlockMode()&&this.flockService.setTabFocused(!1)):(this.setCurrentPresenceUserStatus(p.PRESENCE_STATUS_ONLINE),this.flockService.getFlockMode()&&this.flockService.setTabFocused(!0)))}),window&&(window.addEventListener("focus",()=>{this.authService.getUser()&&(this.setCurrentPresenceUserStatus(p.PRESENCE_STATUS_ONLINE),this.flockService.getFlockMode()&&this.flockService.setWindowFocused(!0))}),window.addEventListener("blur",()=>{this.authService.getUser()&&(document.visibilityState!=="hidden"&&this.setCurrentPresenceUserStatus(p.PRESENCE_STATUS_AWAY,{isTabAway:!0}),this.flockService.getFlockMode()&&this.flockService.setWindowFocused(!1))}))}catch(e){this.loggingService.catch("Error in updateOnDocumentFocusChange:",e)}}updateOnAllowedFeatureListChange(){try{this.configService.getConfig$().subscribe(e=>{if(e&&e.featureAllowList?.length){let t=this.presenceUser$.value,i=!1;if(e.featureAllowList.includes(X.PRESENCE)?t?.onlineStatus!==p.PRESENCE_STATUS_ONLINE&&(t.onlineStatus=p.PRESENCE_STATUS_ONLINE,i=!0):t?.onlineStatus!==p.PRESENCE_STATUS_OFFLINE&&(t.onlineStatus=p.PRESENCE_STATUS_OFFLINE,i=!0),i&&this.authService.getUser()&&this.documentPaths?.presence&&t&&t.userId&&!t.isAnonymous){let a=JSON.parse(JSON.stringify(t));this.commonDbService.updateData({feature:"presence",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,userId:t.userSnippylyId,skipFirestore:!0},data:JSON.parse(JSON.stringify(a))})}}})}catch(e){this.loggingService.catch("Error in updateOnAllowedFeatureListChange:",e)}}updateOnDatabaseDisconnect(){return this.loggingService.log("%c[WB] Calling FUNCTION: updateOnDatabaseDisconnect","color: green;"),Le(this.afAuth).pipe(Y(e=>!!e),W(e=>this.docService.getDocumentPaths$().pipe(j(t=>e))),H(e=>oe(this,null,function*(){try{if(this.documentPaths?.presence&&e){let t=yield Et(e,!0).catch(a=>null);if(!t)return;let{user:i}=t.claims;if(!i?.isAnonymous&&this.documentPaths?.presence){this.flockService.isInSession()&&this.flockService.removeCurrentUserFromSession();let a=`${this.documentPaths.presence}/${e.uid}`;this.commonDbService.setupOnDisconnect(a,{onlineStatus:p.PRESENCE_STATUS_OFFLINE,timestamp:this.timestamp}).catch(h=>{this.loggingService.catch("Error in updateOnDatabaseDisconnect:",h)})}}}catch(t){this.loggingService.catch("Error in updateOnDatabaseDisconnect:",t)}})))}setPresenceUser(e){this.loggingService.log("%c[WB] Calling FUNCTION: setPresenceUser","color: green;");try{let t=this.presenceUser$.value;t.userId=e?.userId,t.name=e?.name,t.email=e?.email,t.photoUrl=e?.photoUrl,t.userSnippylyId=e?.userSnippylyId,t.color=e?.color,t.textColor=e?.textColor,t.initial=e?.initial,t.timestamp=this.timestamp,t.type=e?.type,t.isReadOnly=e?.isReadOnly,t.isAnonymous=e?.isAnonymous;let i=e?.name?.split(" ");if(i&&i.length>0){let a=i[0],h=i.length>1?i[i.length-1]:null,y=h?h[0]:null;a&&(t.name=`${a} ${y?y+".":""}`)}this.updateCurrentPresenceUser(t)}catch(t){this.loggingService.catch("Error in setPresenceUser:",t)}}signOutUser(e){return new Promise((t,i)=>{try{this.documentPaths?.presence&&e?this.commonDbService.getData({feature:"presence",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,userId:e.uid,skipFirestore:!0}}).then(a=>{a&&(this.flockService.isInSession()&&this.flockService.removeCurrentUserFromSession(),this.commonDbService.updateData({feature:"presence",errorCallback:h=>{i(h)},callback:()=>{t(null)},properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,userId:e.uid,skipFirestore:!0},data:JSON.parse(JSON.stringify(F(C({},a?.data??{}),{timestamp:this.timestamp,onlineStatus:p.PRESENCE_STATUS_OFFLINE})))})),t(null)}).catch(a=>{this.loggingService.catch("Error in signOutUser subscription: ",a),i(a)}):t(null)}catch(a){this.loggingService.catch("Error in signOutUser:",a),i(a)}})}setInactivityTime(e){try{this.inactivityTime=e,this.analyticsService.trackEvent(E.Events.Presence.PRESENCE_SET_CUSTOM_INACTIVITY_TIMER,{inactivityTime:this.inactivityTime}),this.detectUserIdleState()}catch(t){this.loggingService.catch("Error in setInactivityTime: ",t)}}getInactivityTime(){return this.inactivityTime}setOfflineInactivityTime(e){try{e>=this.inactivityTime?(this.offlineInactivityTime=e,this.analyticsService.trackEvent(E.Events.Presence.PRESENCE_SET_CUSTOM_OFFLINE_INACTIVITY_TIMER,{offlineInactivityTime:this.offlineInactivityTime}),this.detectUserOfflineState()):this.loggingService.catch("Error in setOfflineInactivityTime: ","offline-inactivity-time value is less than inactivity-time.")}catch(t){this.loggingService.catch("Error in setOfflineInactivityTime: ",t)}}getOfflineInactivityTime(){return this.offlineInactivityTime}getPresenceUsers$(){return this.presenceUsers$.asObservable()}getPresenceUsers(){return this.presenceUsers$.value}get timestamp(){return this.commonDbService.getServerTimestamp()}addCustomUser(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: addCustomUser","color: green;");let t=e?.user,i=e?.localOnly??!1;if(!t?.userId){this.loggingService.catch("Error in addCustomUser: ","userId is required");return}let a=this.buildCustomPresenceUser(t,i);if(!a)return;if(i){let h=this.customPresenceUsers$.value,y=h.findIndex(L=>L.userId===t.userId);if(y>=0){let L=[...h];L[y]=a,this.customPresenceUsers$.next(L)}else this.customPresenceUsers$.next([...h,a])}else this.persistCustomUserToDb(a)}catch(t){this.loggingService.catch("Error in addCustomUser: ",t)}}removeCustomUser(e){try{this.loggingService.log("%c[WB] Calling FUNCTION: removeCustomUser","color: green;");let t=e?.user?.userId,i=e?.localOnly??!1;if(!t){this.loggingService.catch("Error in removeCustomUser: ","userId is required");return}if(i){let a=this.customPresenceUsers$.value,h=a.filter(y=>y.userId!==t);h.length!==a.length&&this.customPresenceUsers$.next(h)}else{let a=this.buildCustomPresenceUser(e.user,!1);a&&this.removeCustomUserFromDb(a)}}catch(t){this.loggingService.catch("Error in removeCustomUser: ",t)}}mergeWithCustomUsers(e){try{let t=this.customPresenceUsers$.value;if(t.length===0)return e;let i=new Set(e.map(h=>h.userId)),a=t.filter(h=>!i.has(h.userId));return[...e,...a]}catch(t){return this.loggingService.catch("Error in mergeWithCustomUsers: ",t),e}}buildCustomPresenceUser(e,t=!1){try{let i=this.configService.getApiKey(),a=new it;return a.userId=e.userId,a.name=e.name||e.userId,a.email=e.email||"",a.photoUrl=e.photoUrl||"",a.onlineStatus=e.onlineStatus||p.PRESENCE_STATUS_ONLINE,a.color=e.color||this.avatarService.generateUserColor(),a.textColor=e.textColor||"",a.type="custom",a.initial=e.initial||(a.name?a.name.charAt(0).toUpperCase():"U"),a.timestamp=Date.now(),a.isReadOnly=e.isReadOnly??!1,a.isAnonymous=e.isAnonymous??!1,a.location=e.location||null,a.locationId=e.locationId??null,a.pageInfo=e.pageInfo||new rt,a.isTabAway=!1,a.isUserIdle=!1,a.userSnippylyId=e.userSnippylyId||(i?Nt(i,e.userId):`custom_${e.userId}`),a.localOnly=t,a}catch(i){return this.loggingService.catch("Error in buildCustomPresenceUser: ",i),null}}persistCustomUserToDb(e){try{if(this.documentPaths?.presence&&e?.userId&&this.authService.isFeatureAllowed(X.PRESENCE)){let t=JSON.parse(JSON.stringify(e));delete t.localOnly,this.commonDbService.updateData({feature:"presence",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,userId:e.userSnippylyId,skipFirestore:!0},data:JSON.parse(JSON.stringify(F(C({},t),{timestamp:this.timestamp})))})}}catch(t){this.loggingService.catch("Error in persistCustomUserToDb: ",t)}}removeCustomUserFromDb(e){try{this.documentPaths?.presence&&e?.userId&&this.authService.isFeatureAllowed(X.PRESENCE)&&this.commonDbService.deleteData({feature:"presence",properties:{documentId:this.documentPaths?.documentId,organizationId:this.documentPaths?.organizationId,userId:e.userSnippylyId,skipFirestore:!0}})}catch(t){this.loggingService.catch("Error in removeCustomUserFromDb: ",t)}}};r.\u0275fac=function(t){return new(t||r)(P(ge),P(zt),P(je),P($e),P(bt),P(Yt),P(Wt),P($t),P(Bt),P(v),P(K),P(Gt))},r.\u0275prov=ae({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();var ie=class{constructor(){this.filteredPresenceUsers=[],this.shadowDom=!0,this.maxUsers=5,this.showTooltip=()=>{},this.closeTooltip=()=>{},this.onPresenceUserClick=()=>{}}};var V=class{constructor(){this.shadowDom=!0,this.calculateUserAwayTime=()=>{}}};var Zt=n=>({componentConfigSignal:n}),fn=(n,r)=>({condition:n,data:r}),Sn=(n,r,o,e,t)=>({template:n,context:r,componentName:"velt-presence-tooltip-avatar-wireframe",variant:o,setIfCondition:e,componentElementRef:t});function Cn(n,r){if(n&1&&(d(0),M(1,"snippyly-user-avatar",3),u()),n&2){let o=s(2).ngIf,e=s();l(),Fe("away",o.presenceUser.onlineStatus===e.constants.PRESENCE_STATUS_AWAY)("velt-presence-avatar--away",o.presenceUser.onlineStatus===e.constants.PRESENCE_STATUS_AWAY),c("user",o.presenceUser)}}function _n(n,r){if(n&1&&(d(0),g(1,Cn,2,5,"ng-container",2),u()),n&2){let o=s().ngIf,e=s();l(),c("veltDynamicTemplate",k(3,Sn,e.template,_(1,Zt,e.componentConfigSignal),o==null?null:o.variant,e.setIfCondition.bind(e),e.elementRef))}}function yn(n,r){if(n&1&&(d(0),g(1,_n,2,9,"ng-container",1),u()),n&2){let o=s();l(),c("veltIf",b(3,fn,o.conditionSignal(),_(1,Zt,o.componentConfigSignal)))}}var he=(()=>{let r=class r extends B{constructor(e,t,i){super(e,t,i),this.elementRef=e,this.dynamicDataService=t,this.loggingService=i,this.componentId="velt-presence-tooltip-avatar",this.constants=p;try{super.initializeComponentConfigSignal(new V)}catch(a){this.loggingService.catch("Error in PresenceTooltipAvatarComponent constructor: ",a)}}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in PresenceTooltipAvatarComponent ngOnInit: ",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in PresenceTooltipAvatarComponent ngOnDestroy: ",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in PresenceTooltipAvatarComponent setupA11yAttributes:",e)}}};r.\u0275fac=function(t){return new(t||r)(m(I),m(f),m(v))},r.\u0275cmp=x({type:r,selectors:[["velt-presence-tooltip-avatar-internal"]],standalone:!1,features:[$([f]),U],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],[1,"velt-presence-avatar","s-presence-avatar",3,"user"]],template:function(t,i){t&1&&g(0,yn,2,6,"ng-container",0),t&2&&c("ngIf",i.componentConfigSignal())},dependencies:[D,N,A,re],styles:["html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}body.velt-pin-dragging[_ngcontent-%COMP%] iframe[_ngcontent-%COMP%]{pointer-events:none!important}[_nghost-%COMP%]{display:flex}[_nghost-%COMP%]:empty{display:none}.velt-presence-avatar[_ngcontent-%COMP%]{position:relative;border-radius:var(--velt-border-radius-full);z-index:2;width:calc((1.5 + 0px) * var(--velt-base-rem-unit));height:calc((1.5 + 0px) * var(--velt-base-rem-unit));display:flex;align-items:center;justify-content:center}.velt-presence-avatar--away[_ngcontent-%COMP%]{filter:grayscale(.7)}snippyly-user-avatar[_ngcontent-%COMP%]{--legacy-velt-user-avatar-size: 1.5rem}"],changeDetection:0});let n=r;return n})();var en=n=>({componentConfigSignal:n}),bn=(n,r)=>({condition:n,data:r}),En=(n,r,o,e,t)=>({template:n,context:r,componentName:"velt-presence-tooltip-user-active-wireframe",variant:o,setIfCondition:e,componentElementRef:t});function Pn(n,r){n&1&&(d(0),T(1,"p"),se(2),ce(3,"translate"),O(),u()),n&2&&(l(2),Re(le(3,1,"User online")))}function xn(n,r){if(n&1&&(d(0),g(1,Pn,4,3,"ng-container",2),u()),n&2){let o=s(2).ngIf,e=s();l(),c("veltDynamicTemplate",k(3,En,e.template,_(1,en,e.componentConfigSignal),o==null?null:o.variant,e.setIfCondition.bind(e),e.elementRef))}}function Un(n,r){if(n&1&&(d(0),g(1,xn,2,9,"ng-container",0),u()),n&2){let o=s().ngIf,e=s();l(),c("ngIf",(o.presenceUser==null?null:o.presenceUser.onlineStatus)===e.constants.PRESENCE_STATUS_ONLINE)}}function Tn(n,r){if(n&1&&(d(0),g(1,Un,2,1,"ng-container",1),u()),n&2){let o=s();l(),c("veltIf",b(3,bn,o.conditionSignal(),_(1,en,o.componentConfigSignal)))}}var fe=(()=>{let r=class r extends B{constructor(e,t,i){super(e,t,i),this.elementRef=e,this.dynamicDataService=t,this.loggingService=i,this.componentId="velt-presence-tooltip-user-active",this.constants=p;try{super.initializeComponentConfigSignal(new V)}catch(a){this.loggingService.catch("Error in PresenceTooltipUserActiveComponent constructor: ",a)}}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in PresenceTooltipUserActiveComponent ngOnInit: ",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in PresenceTooltipUserActiveComponent ngOnDestroy: ",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in PresenceTooltipUserActiveComponent setupA11yAttributes:",e)}}};r.\u0275fac=function(t){return new(t||r)(m(I),m(f),m(v))},r.\u0275cmp=x({type:r,selectors:[["velt-presence-tooltip-user-active-internal"]],standalone:!1,features:[$([f]),U],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"]],template:function(t,i){t&1&&g(0,Tn,2,6,"ng-container",0),t&2&&c("ngIf",i.componentConfigSignal())},dependencies:[D,N,A,ve],styles:["html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}body.velt-pin-dragging[_ngcontent-%COMP%] iframe[_ngcontent-%COMP%]{pointer-events:none!important}[_nghost-%COMP%]:empty{display:none}p[_ngcontent-%COMP%]{margin:0;color:var(--velt-green);font-weight:400;font-size:var(--velt-font-size-xs);line-height:1}"],changeDetection:0});let n=r;return n})();var tn=n=>({componentConfigSignal:n}),kn=(n,r)=>({condition:n,data:r}),Dn=(n,r,o,e,t)=>({template:n,context:r,componentName:"velt-presence-tooltip-user-inactive-wireframe",variant:o,setIfCondition:e,componentElementRef:t});function An(n,r){if(n&1&&(d(0),T(1,"p",3),se(2),ce(3,"translate"),O(),u()),n&2){let o=s(3).ngIf;l(2),ht(" ",o.calculateUserAwayTime(o.presenceUser).toString()+" "+le(3,1,"mins ago.")," ")}}function Nn(n,r){if(n&1&&(d(0),g(1,An,4,3,"ng-container",2),u()),n&2){let o=s(2).ngIf,e=s();l(),c("veltDynamicTemplate",k(3,Dn,e.template,_(1,tn,e.componentConfigSignal),o==null?null:o.variant,e.setIfCondition.bind(e),e.elementRef))}}function wn(n,r){if(n&1&&(d(0),g(1,Nn,2,9,"ng-container",0),u()),n&2){let o=s().ngIf,e=s();l(),c("ngIf",(o.presenceUser==null?null:o.presenceUser.onlineStatus)===e.constants.PRESENCE_STATUS_AWAY)}}function Fn(n,r){if(n&1&&(d(0),g(1,wn,2,1,"ng-container",1),u()),n&2){let o=s();l(),c("veltIf",b(3,kn,o.conditionSignal(),_(1,tn,o.componentConfigSignal)))}}var Se=(()=>{let r=class r extends B{constructor(e,t,i){super(e,t,i),this.elementRef=e,this.dynamicDataService=t,this.loggingService=i,this.componentId="velt-presence-tooltip-user-inactive",this.constants=p;try{super.initializeComponentConfigSignal(new V)}catch(a){this.loggingService.catch("Error in PresenceTooltipUserInactiveComponent constructor: ",a)}}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in PresenceTooltipUserInactiveComponent ngOnInit: ",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in PresenceTooltipUserInactiveComponent ngOnDestroy: ",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in PresenceTooltipUserInactiveComponent setupA11yAttributes:",e)}}};r.\u0275fac=function(t){return new(t||r)(m(I),m(f),m(v))},r.\u0275cmp=x({type:r,selectors:[["velt-presence-tooltip-user-inactive-internal"]],standalone:!1,features:[$([f]),U],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],[1,"velt-presence-tooltip-user-inactive-text","inactive-text"]],template:function(t,i){t&1&&g(0,Fn,2,6,"ng-container",0),t&2&&c("ngIf",i.componentConfigSignal())},dependencies:[D,N,A,ve],styles:["html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}body.velt-pin-dragging[_ngcontent-%COMP%] iframe[_ngcontent-%COMP%]{pointer-events:none!important}[_nghost-%COMP%]:empty{display:none}p[_ngcontent-%COMP%]{margin:0;color:var(--velt-green);font-weight:400;font-size:var(--velt-font-size-xs);line-height:1}.velt-presence-tooltip-user-inactive-text[_ngcontent-%COMP%]{color:var(--velt-text-4)}"],changeDetection:0});let n=r;return n})();var nn=n=>({componentConfigSignal:n}),Mn=(n,r)=>({condition:n,data:r}),Ln=(n,r,o,e,t)=>({template:n,context:r,componentName:"velt-presence-tooltip-user-name-wireframe",variant:o,setIfCondition:e,componentElementRef:t});function jn(n,r){if(n&1&&(d(0),T(1,"h1"),se(2),ce(3,"translate"),O(),u()),n&2){let o=s(3).ngIf;l(2),Re(o.presenceUser!=null&&o.presenceUser.name?o.presenceUser==null?null:o.presenceUser.name:le(3,1,o.presenceUser==null?null:o.presenceUser.email))}}function $n(n,r){n&1&&M(0,"velt-skeleton-loader-internal",5)}function Bn(n,r){if(n&1&&(d(0),g(1,jn,4,3,"ng-container",4)(2,$n,1,0,"ng-template",null,0,ne),u()),n&2){let o=te(3),e=s(2).ngIf;l(),c("ngIf",(e.presenceUser==null?null:e.presenceUser.name)||(e.presenceUser==null?null:e.presenceUser.email))("ngIfElse",o)}}function Wn(n,r){if(n&1&&(d(0),g(1,Bn,4,2,"ng-container",3),u()),n&2){let o=s().ngIf,e=s();l(),c("veltDynamicTemplate",k(3,Ln,e.template,_(1,nn,e.componentConfigSignal),o==null?null:o.variant,e.setIfCondition.bind(e),e.elementRef))}}function zn(n,r){if(n&1&&(d(0),g(1,Wn,2,9,"ng-container",2),u()),n&2){let o=s();l(),c("veltIf",b(3,Mn,o.conditionSignal(),_(1,nn,o.componentConfigSignal)))}}var Ce=(()=>{let r=class r extends B{constructor(e,t,i){super(e,t,i),this.elementRef=e,this.dynamicDataService=t,this.loggingService=i,this.componentId="velt-presence-tooltip-user-name";try{super.initializeComponentConfigSignal(new V)}catch(a){this.loggingService.catch("Error in PresenceTooltipUserNameComponent constructor: ",a)}}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in PresenceTooltipUserNameComponent ngOnInit: ",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in PresenceTooltipUserNameComponent ngOnDestroy: ",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in PresenceTooltipUserNameComponent setupA11yAttributes:",e)}}};r.\u0275fac=function(t){return new(t||r)(m(I),m(f),m(v))},r.\u0275cmp=x({type:r,selectors:[["velt-presence-tooltip-user-name-internal"]],standalone:!1,features:[$([f]),U],decls:1,vars:1,consts:[["loadingTemplateRef",""],[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],[4,"ngIf","ngIfElse"],["height","16px","width","80px","borderRadius","20px"]],template:function(t,i){t&1&&g(0,zn,2,6,"ng-container",1),t&2&&c("ngIf",i.componentConfigSignal())},dependencies:[D,N,A,Je,ve],styles:["html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}body.velt-pin-dragging[_ngcontent-%COMP%] iframe[_ngcontent-%COMP%]{pointer-events:none!important}[_nghost-%COMP%]:empty{display:none}h1[_ngcontent-%COMP%]{margin:0;color:var(--velt-text-0);font-size:var(--velt-font-size-sm);line-height:calc((1rem + 0px) * var(--velt-base-rem-unit));font-weight:400}"],changeDetection:0});let n=r;return n})();var rn=n=>({componentConfigSignal:n}),Gn=(n,r)=>({condition:n,data:r}),Vn=(n,r,o,e,t)=>({template:n,context:r,componentName:"velt-presence-tooltip-status-container-wireframe",variant:o,setIfCondition:e,componentElementRef:t});function Yn(n,r){if(n&1&&(d(0),T(1,"div",3),M(2,"velt-presence-tooltip-user-name-internal",4)(3,"velt-presence-tooltip-user-active-internal",4)(4,"velt-presence-tooltip-user-inactive-internal",4),O(),u()),n&2){let o=s(3);l(2),c("componentConfigSignal",o.componentConfigSignal),l(),c("componentConfigSignal",o.componentConfigSignal),l(),c("componentConfigSignal",o.componentConfigSignal)}}function Xn(n,r){if(n&1&&(d(0),g(1,Yn,5,3,"ng-container",2),u()),n&2){let o=s().ngIf,e=s();l(),c("veltDynamicTemplate",k(3,Vn,e.template,_(1,rn,e.componentConfigSignal),o==null?null:o.variant,e.setIfCondition.bind(e),e.elementRef))}}function Hn(n,r){if(n&1&&(d(0),g(1,Xn,2,9,"ng-container",1),u()),n&2){let o=s();l(),c("veltIf",b(3,Gn,o.conditionSignal(),_(1,rn,o.componentConfigSignal)))}}var _e=(()=>{let r=class r extends B{constructor(e,t,i){super(e,t,i),this.elementRef=e,this.dynamicDataService=t,this.loggingService=i,this.componentId="velt-presence-tooltip-status-container",this.constants=p;try{super.initializeComponentConfigSignal(new V)}catch(a){this.loggingService.catch("Error in PresenceTooltipStatusContainerComponent constructor: ",a)}}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in PresenceTooltipStatusContainerComponent ngOnInit: ",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in PresenceTooltipStatusContainerComponent ngOnDestroy: ",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in PresenceTooltipStatusContainerComponent setupA11yAttributes:",e)}}};r.\u0275fac=function(t){return new(t||r)(m(I),m(f),m(v))},r.\u0275cmp=x({type:r,selectors:[["velt-presence-tooltip-status-container-internal"]],standalone:!1,features:[$([f]),U],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],[1,"velt-presence-tooltip-status-container","user-status-container"],[3,"componentConfigSignal"]],template:function(t,i){t&1&&g(0,Hn,2,6,"ng-container",0),t&2&&c("ngIf",i.componentConfigSignal())},dependencies:[D,N,A,fe,Se,Ce],styles:["html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}body.velt-pin-dragging[_ngcontent-%COMP%] iframe[_ngcontent-%COMP%]{pointer-events:none!important}[_nghost-%COMP%]:empty{display:none}.velt-presence-tooltip-status-container[_ngcontent-%COMP%]{display:flex;flex-direction:column;z-index:2;gap:var(--velt-spacing-xs)}"],changeDetection:0});let n=r;return n})();var on=(n,r)=>({componentConfigSignal:n,presenceUser:r}),qn=(n,r)=>({condition:n,data:r}),er=(n,r,o,e,t)=>({template:n,context:r,componentName:"velt-presence-tooltip-wireframe",variant:o,setIfCondition:e,componentElementRef:t});function tr(n,r){n&1&&we(0)}function nr(n,r){if(n&1&&(T(0,"velt-shadow-dom-internal"),g(1,tr,1,0,"ng-container",4),O()),n&2){s();let o=te(3);l(),c("ngTemplateOutlet",o)}}function rr(n,r){if(n&1&&(d(0),T(1,"div",8),M(2,"velt-presence-tooltip-avatar-internal",9)(3,"velt-presence-tooltip-status-container-internal",9),O(),u()),n&2){let o=s(5);l(2),c("componentConfigSignal",o.componentConfigSignal),l(),c("componentConfigSignal",o.componentConfigSignal)}}function ir(n,r){if(n&1&&(T(0,"div",6),g(1,rr,4,2,"ng-container",7),O()),n&2){let o=s(3).ngIf,e=s();l(),c("veltDynamicTemplate",k(4,er,e.template,b(1,on,e.componentConfigSignal,e.presenceUser),o==null?null:o.variant,e.setIfCondition.bind(e),e.elementRef))}}function or(n,r){if(n&1&&g(0,ir,2,10,"div",5),n&2){let o=s(2).ngIf;c("ngIf",o==null?null:o.presenceUser)}}function ar(n,r){if(n&1&&(d(0),g(1,nr,2,1,"velt-shadow-dom-internal",3)(2,or,1,1,"ng-template",null,0,ne),u()),n&2){let o=te(3),e=s().ngIf,t=s();l(),c("ngIf",e.shadowDom&&!t.template||t.template&&t.isExplicitShadowDom)("ngIfElse",o)}}function sr(n,r){if(n&1&&(d(0),g(1,ar,4,2,"ng-container",2),u()),n&2){let o=s();l(),c("veltIf",b(4,qn,o.conditionSignal(),b(1,on,o.componentConfigSignal,o.presenceUser)))}}var ye=(()=>{let r=class r extends ze{set shadowDom(e){this._shadowDom=e}get shadowDom(){return this._shadowDom}constructor(e,t,i,a,h){super(e,t,void 0,void 0,void 0,i,a),this.elementRef=e,this.themeService=t,this.dynamicDataService=i,this.loggingService=a,this.wireframeService=h,this._shadowDom=!0,this.isExplicitShadowDom=!1,this.constants=p,this.subscriptions=[],this.componentId="velt-presence-tooltip",this.componentConfigSignal=Ae({presenceUser:null,shadowDom:!0,calculateUserAwayTime:this.calculateUserAwayTime.bind(this)}),this.loggingService.log("%c[WB] Creating CLASS: PresenceTooltipComponent","color: blue;")}ngOnInit(){this.loggingService.log("%c[WB] Calling FUNCTION: ngOnInit","color: green;");try{let e=this.elementRef.nativeElement,t=e.getAttribute("shadow-dom")??e.getAttribute("shadowdom");this.isExplicitShadowDom=t!==null&&t!=="false",this.setupA11yAttributes(),this.dynamicDataService.applyConditionalClasses(this.elementRef.nativeElement,{componentConfigSignal:this.componentConfigSignal,presenceUser:this.presenceUser}),this.subscriptions.push(this.wireframeService.getWireframe$("velt-presence-tooltip-wireframe").subscribe(a=>{if(a){let h=document.createElement(a.tagName);h.innerHTML=a.innerHTML,this.template=h}}))}catch(e){this.loggingService.catch("Error in PresenceComponent oninit: ",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in PresenceComponent setupA11yAttributes:",e)}}ngOnChanges(e){try{super.ngOnChanges(e),e&&Object.keys(e).forEach(t=>{this.componentConfigSignal.update(i=>(i=F(C({},i),{[t]:e[t].currentValue}),i))})}catch(t){this.loggingService.catch("Error in PresenceTooltipComponent ngOnChanges: ",t)}}ngOnDestroy(){try{super.ngOnDestroy(),this.subscriptions.map(e=>{e.unsubscribe()}),this.subscriptions=[]}catch(e){this.loggingService.catch("Error in PresenceTooltipComponent unsubscribe: ",e)}}calculateUserAwayTime(e){try{if(e.onlineStatus===p.PRESENCE_STATUS_ONLINE)return 0;let t=me(e.timestamp);return Math.floor(t/1e3/60)}catch(t){this.loggingService.catch("Error in PresenceTooltipComponent calculateUserAwayTime: ",t)}return 0}};r.\u0275fac=function(t){return new(t||r)(m(I),m(We),m(f),m(v),m(Be))},r.\u0275cmp=x({type:r,selectors:[["velt-presence-tooltip"]],inputs:{presenceUser:"presenceUser",shadowDom:"shadowDom",variant:"variant"},standalone:!1,features:[U,Ne],decls:1,vars:1,consts:[["presenceTooltipRef",""],[4,"ngIf"],[4,"veltIf"],[4,"ngIf","ngIfElse"],[4,"ngTemplateOutlet"],["class","velt-presence-tooltip-container",4,"ngIf"],[1,"velt-presence-tooltip-container"],[4,"veltDynamicTemplate"],[1,"velt-presence-tooltip","s-tooltiptext","s-presence-tooltip"],[3,"componentConfigSignal"]],template:function(t,i){t&1&&g(0,sr,2,7,"ng-container",1),t&2&&c("ngIf",i.componentConfigSignal())},dependencies:[D,Me,N,A,he,_e],styles:["html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}body.velt-pin-dragging[_ngcontent-%COMP%] iframe[_ngcontent-%COMP%]{pointer-events:none!important}[_nghost-%COMP%]{--velt-green: var(--velt-light-mode-green);--velt-magenta: var(--velt-light-mode-magenta);--velt-amber: var(--velt-light-mode-amber);--velt-purple: var(--velt-light-mode-purple);--velt-cyan: var(--velt-light-mode-cyan);--velt-orange: var(--velt-light-mode-orange);--velt-black: var(--velt-light-mode-black);--velt-white: var(--velt-light-mode-white);--velt-gray: var(--velt-light-mode-gray);--velt-error: var(--velt-light-mode-error);--velt-error-hover: var(--velt-light-mode-error-hover);--velt-error-foreground: var(--velt-light-mode-error-foreground);--velt-error-light: var(--velt-light-mode-error-light);--velt-error-transparent: var(--velt-light-mode-error-transparent);--velt-warning: var(--velt-light-mode-warning);--velt-warning-hover: var(--velt-light-mode-warning-hover);--velt-warning-foreground: var(--velt-light-mode-warning-foreground);--velt-warning-light: var(--velt-light-mode-warning-light);--velt-warning-transparent: var(--velt-light-mode-warning-transparent);--velt-agent-accent: #4495ff;--velt-agent-accent-transparent: rgba(68, 149, 255, .2);--velt-success: var(--velt-light-mode-success);--velt-success-hover: var(--velt-light-mode-success-hover);--velt-success-foreground: var(--velt-light-mode-success-foreground);--velt-success-light: var(--velt-light-mode-success-light);--velt-success-transparent: var(--velt-light-mode-success-transparent);--velt-accent: var(--velt-light-mode-accent);--velt-accent-text: var(--velt-light-mode-accent-text);--velt-accent-hover: var(--velt-light-mode-accent-hover);--velt-accent-foreground: var(--velt-light-mode-accent-foreground);--velt-accent-light: var(--velt-light-mode-accent-light);--velt-accent-transparent: var(--velt-light-mode-accent-transparent);--velt-text-0: var(--velt-light-mode-text-0);--velt-text-1: var(--velt-light-mode-text-1);--velt-text-2: var(--velt-light-mode-text-2);--velt-text-3: var(--velt-light-mode-text-3);--velt-text-4: var(--velt-light-mode-text-4);--velt-text-5: var(--velt-light-mode-text-5);--velt-text-6: var(--velt-light-mode-text-6);--velt-text-7: var(--velt-light-mode-text-7);--velt-text-8: var(--velt-light-mode-text-8);--velt-text-9: var(--velt-light-mode-text-9);--velt-text-10: var(--velt-light-mode-text-10);--velt-text-11: var(--velt-light-mode-text-11);--velt-text-12: var(--velt-light-mode-text-12);--velt-background-0: var(--velt-light-mode-background-0);--velt-background-1: var(--velt-light-mode-background-1);--velt-background-2: var(--velt-light-mode-background-2);--velt-background-3: var(--velt-light-mode-background-3);--velt-background-4: var(--velt-light-mode-background-4);--velt-background-5: var(--velt-light-mode-background-5);--velt-background-6: var(--velt-light-mode-background-6);--velt-background-7: var(--velt-light-mode-background-7);--velt-background-8: var(--velt-light-mode-background-8);--velt-background-9: var(--velt-light-mode-background-9);--velt-background-10: var(--velt-light-mode-background-10);--velt-border-0: var(--velt-light-mode-border-0);--velt-border-1: var(--velt-light-mode-border-1);--velt-border-2: var(--velt-light-mode-border-2);--velt-border-3: var(--velt-light-mode-border-3);--velt-border-4: var(--velt-light-mode-border-4);--velt-border-5: var(--velt-light-mode-border-5);--velt-border-6: var(--velt-light-mode-border-6);--velt-border-7: var(--velt-light-mode-border-7);--velt-border-8: var(--velt-light-mode-border-8);--velt-border-9: var(--velt-light-mode-border-9);--velt-border-10: var(--velt-light-mode-border-10);--velt-background-transparent: var(--velt-light-mode-background-transparent);--velt-border-transparent: var(--velt-light-mode-border-transparent);--velt-animation-transparent: var(--velt-light-mode-animation-transparent);margin:calc((.5rem + 0px) * var(--velt-base-rem-unit))}[_nghost-%COMP%]:empty{display:none}[dark][_nghost-%COMP%]{--velt-green: var(--velt-dark-mode-green);--velt-magenta: var(--velt-dark-mode-magenta);--velt-amber: var(--velt-dark-mode-amber);--velt-purple: var(--velt-dark-mode-purple);--velt-cyan: var(--velt-dark-mode-cyan);--velt-orange: var(--velt-dark-mode-orange);--velt-black: var(--velt-dark-mode-black);--velt-white: var(--velt-dark-mode-white);--velt-gray: var(--velt-dark-mode-gray);--velt-error: var(--velt-dark-mode-error);--velt-error-hover: var(--velt-dark-mode-error-hover);--velt-error-foreground: var(--velt-dark-mode-error-foreground);--velt-error-light: var(--velt-dark-mode-error-light);--velt-error-transparent: var(--velt-dark-mode-error-transparent);--velt-warning: var(--velt-dark-mode-warning);--velt-warning-hover: var(--velt-dark-mode-warning-hover);--velt-warning-foreground: var(--velt-dark-mode-warning-foreground);--velt-warning-light: var(--velt-dark-mode-warning-light);--velt-warning-transparent: var(--velt-dark-mode-warning-transparent);--velt-agent-accent: #4495ff;--velt-agent-accent-transparent: rgba(68, 149, 255, .2);--velt-success: var(--velt-dark-mode-success);--velt-success-hover: var(--velt-dark-mode-success-hover);--velt-success-foreground: var(--velt-dark-mode-success-foreground);--velt-success-light: var(--velt-dark-mode-success-light);--velt-success-transparent: var(--velt-dark-mode-success-transparent);--velt-accent: var(--velt-dark-mode-accent);--velt-accent-text: var(--velt-dark-mode-accent-text);--velt-accent-hover: var(--velt-dark-mode-accent-hover);--velt-accent-foreground: var(--velt-dark-mode-accent-foreground);--velt-accent-light: var(--velt-dark-mode-accent-light);--velt-accent-transparent: var(--velt-dark-mode-accent-transparent);--velt-text-0: var(--velt-dark-mode-text-0);--velt-text-1: var(--velt-dark-mode-text-1);--velt-text-2: var(--velt-dark-mode-text-2);--velt-text-3: var(--velt-dark-mode-text-3);--velt-text-4: var(--velt-dark-mode-text-4);--velt-text-5: var(--velt-dark-mode-text-5);--velt-text-6: var(--velt-dark-mode-text-6);--velt-text-7: var(--velt-dark-mode-text-7);--velt-text-8: var(--velt-dark-mode-text-8);--velt-text-9: var(--velt-dark-mode-text-9);--velt-text-10: var(--velt-dark-mode-text-10);--velt-text-11: var(--velt-dark-mode-text-11);--velt-text-12: var(--velt-dark-mode-text-12);--velt-background-0: var(--velt-dark-mode-background-0);--velt-background-1: var(--velt-dark-mode-background-1);--velt-background-2: var(--velt-dark-mode-background-2);--velt-background-3: var(--velt-dark-mode-background-3);--velt-background-4: var(--velt-dark-mode-background-4);--velt-background-5: var(--velt-dark-mode-background-5);--velt-background-6: var(--velt-dark-mode-background-6);--velt-background-7: var(--velt-dark-mode-background-7);--velt-background-8: var(--velt-dark-mode-background-8);--velt-background-9: var(--velt-dark-mode-background-9);--velt-background-10: var(--velt-dark-mode-background-10);--velt-border-0: var(--velt-dark-mode-border-0);--velt-border-1: var(--velt-dark-mode-border-1);--velt-border-2: var(--velt-dark-mode-border-2);--velt-border-3: var(--velt-dark-mode-border-3);--velt-border-4: var(--velt-dark-mode-border-4);--velt-border-5: var(--velt-dark-mode-border-5);--velt-border-6: var(--velt-dark-mode-border-6);--velt-border-7: var(--velt-dark-mode-border-7);--velt-border-8: var(--velt-dark-mode-border-8);--velt-border-9: var(--velt-dark-mode-border-9);--velt-border-10: var(--velt-dark-mode-border-10);--velt-background-transparent: var(--velt-dark-mode-background-transparent);--velt-border-transparent: var(--velt-dark-mode-border-transparent);--velt-animation-transparent: var(--velt-dark-mode-animation-transparent)}.velt-presence-tooltip[_ngcontent-%COMP%]{display:flex;align-items:center;gap:calc((.5rem + 0px) * var(--velt-base-rem-unit));block-size:auto;width:max-content;background-color:var(--velt-background-0);border:1px solid var(--velt-border-5);color:var(--velt-text-0);text-align:left;padding:var(--velt-spacing-xs) var(--velt-spacing-sm);border-radius:var(--velt-border-radius-xs);font-style:normal;font-weight:400;font-size:var(--velt-font-size-xs);line-height:2em;z-index:1;transition:opacity .5s}.velt-presence-tooltip[_ngcontent-%COMP%]:after{background-color:var(--velt-background-0);border-color:var(--velt-border-5)}"],changeDetection:0});let n=r;return n})();var lr=["tooltipContent"],an=(n,r,o)=>({componentConfigSignal:n,presenceUser:r,index:o}),mr=(n,r)=>({condition:n,data:r}),gr=(n,r,o,e,t)=>({template:n,context:r,componentName:"velt-presence-avatar-list-item-wireframe",variant:o,setIfCondition:e,componentElementRef:t});function vr(n,r){if(n&1){let o=qe();d(0),T(1,"snippyly-user-avatar",6),et("click",function(){ke(o);let t=s(3).ngIf,i=s();return De(t.onPresenceUserClick(i.presenceUser))}),M(2,"div",7),O(),u()}if(n&2){let o=s(4);l(),Fe("away",o.presenceUser.onlineStatus===o.constants.PRESENCE_STATUS_AWAY)("velt-presence-avatar--away",o.presenceUser.onlineStatus===o.constants.PRESENCE_STATUS_AWAY),c("user",o.presenceUser),l(),ut("border-color",o.presenceUser.color)}}function pr(n,r){if(n&1){let o=qe();T(0,"div",4),et("pointerenter",function(t){ke(o);let i=s(2).ngIf,a=s();return i.showTooltip(t,a.presenceUser),De(t.stopPropagation())})("pointerleave",function(t){return ke(o),s(2).ngIf.closeTooltip(),De(t.stopPropagation())}),g(1,vr,3,7,"ng-container",5),O()}if(n&2){let o=s(2).ngIf,e=s();l(),c("veltDynamicTemplate",k(5,gr,e.template,tt(1,an,e.componentConfigSignal,e.presenceUser,e.index),o==null?null:o.variant,e.setIfCondition.bind(e),e.elementRef))}}function dr(n,r){if(n&1&&M(0,"velt-presence-tooltip",8),n&2){let o=r.$implicit,e=s(2).ngIf;c("presenceUser",o)("shadowDom",e.shadowDom)}}function ur(n,r){if(n&1&&(d(0),g(1,pr,2,11,"div",3)(2,dr,1,2,"ng-template",null,0,ne),u()),n&2){let o=s().ngIf,e=s();l(),c("ngIf",e.index<o.maxUsers)}}function hr(n,r){if(n&1&&(d(0),g(1,ur,4,1,"ng-container",2),u()),n&2){let o=s();l(),c("veltIf",b(5,mr,o.conditionSignal(),tt(1,an,o.componentConfigSignal,o.presenceUser,o.index)))}}var Ie=(()=>{let r=class r extends B{get itemTemplate(){return this._itemTemplate}set itemTemplate(e){try{this._itemTemplate=e,this.itemTemplate?this.template=this.domService.deepCloneElement(this.itemTemplate):this.template=null}catch{}}constructor(e,t,i,a){super(e,t,i),this.elementRef=e,this.dynamicDataService=t,this.loggingService=i,this.domService=a,this.componentId="velt-presence-avatar-list-item",this.constants=p;try{super.initializeComponentConfigSignal(new ie)}catch(h){this.loggingService.catch("Error in PresenceAvatarListItemComponent constructor: ",h)}}ngOnInit(){try{this.dynamicDataService.applyConditionalClasses(this.elementRef.nativeElement,{componentConfigSignal:this.componentConfigSignal,presenceUser:this.presenceUser,index:this.index}),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in PresenceAvatarListItemComponent ngOnInit: ",e)}}ngAfterViewInit(){try{setTimeout(()=>{this.componentConfigSignal.set(F(C({},this.componentConfigSignal()),{tooltipContent:this.tooltipContent}))},1e3)}catch(e){this.loggingService.catch("Error in PresenceAvatarListItemComponent ngAfterViewInit: ",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in PresenceAvatarListItemComponent ngOnDestroy: ",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in PresenceAvatarListItemComponent setupA11yAttributes:",e)}}};r.\u0275fac=function(t){return new(t||r)(m(I),m(f),m(v),m(je))},r.\u0275cmp=x({type:r,selectors:[["velt-presence-avatar-list-item-internal"]],viewQuery:function(t,i){if(t&1&&vt(lr,5),t&2){let a;pt(a=dt())&&(i.tooltipContent=a.first)}},inputs:{presenceUser:"presenceUser",index:"index",itemTemplate:"itemTemplate"},standalone:!1,features:[$([f]),U],decls:1,vars:1,consts:[["tooltipContent",""],[4,"ngIf"],[4,"veltIf"],["class","velt-presence-avatar-list-item velt-tooltip s-presence-avatar-container s-tooltip",3,"pointerenter","pointerleave",4,"ngIf"],[1,"velt-presence-avatar-list-item","velt-tooltip","s-presence-avatar-container","s-tooltip",3,"pointerenter","pointerleave"],[4,"veltDynamicTemplate"],[1,"velt-presence-avatar","s-presence-avatar",3,"click","user"],[1,"velt-presence-avatar-outline","avatar-outline"],[3,"presenceUser","shadowDom"]],template:function(t,i){t&1&&g(0,hr,2,8,"ng-container",1),t&2&&c("ngIf",i.componentConfigSignal())},dependencies:[D,N,A,re,ye],styles:["html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}body.velt-pin-dragging[_ngcontent-%COMP%] iframe[_ngcontent-%COMP%]{pointer-events:none!important}[_nghost-%COMP%]:empty{display:none}.velt-presence-avatar-list-item[_ngcontent-%COMP%]{height:calc((1.5 + 0px) * var(--velt-base-rem-unit));width:calc((1.5 + 0px) * var(--velt-base-rem-unit));display:flex;justify-content:center;align-items:center;cursor:pointer}.velt-presence-avatar-list-item[_ngcontent-%COMP%] .velt-presence-avatar[_ngcontent-%COMP%]{position:relative;border-radius:var(--velt-border-radius-full);z-index:2;width:calc((1.5 + 0px) * var(--velt-base-rem-unit));height:calc((1.5 + 0px) * var(--velt-base-rem-unit));display:flex;align-items:center;justify-content:center}.velt-presence-avatar--away[_ngcontent-%COMP%]{filter:grayscale(.7)}.velt-presence-avatar-outline[_ngcontent-%COMP%]{position:absolute;inset:-1px;border:1px solid transparent;border-radius:var(--velt-border-radius-full)}snippyly-user-avatar[_ngcontent-%COMP%]{--legacy-velt-user-avatar-size: 1.5rem}"],changeDetection:0});let n=r;return n})();var sn=n=>({componentConfigSignal:n}),Sr=(n,r)=>({condition:n,data:r}),Cr=(n,r,o,e,t)=>({template:n,context:r,componentName:"velt-presence-avatar-list-wireframe",variant:o,setIfCondition:e,componentElementRef:t,replaceTemplate:!1});function _r(n,r){if(n&1&&(d(0),M(1,"velt-presence-avatar-list-item-internal",4),u()),n&2){let o=r.$implicit,e=r.index,t=s(4);l(),c("presenceUser",o)("index",e)("componentConfigSignal",t.componentConfigSignal)("itemTemplate",t.itemTemplate)}}function yr(n,r){if(n&1&&(d(0),g(1,_r,2,4,"ng-container",3),u()),n&2){let o=s(2).ngIf;l(),c("ngForOf",o.filteredPresenceUsers)("ngForTrackBy",o.trackById)}}function Ir(n,r){if(n&1&&(d(0),g(1,yr,2,2,"ng-container",2),u()),n&2){let o=s().ngIf,e=s();l(),c("veltDynamicTemplate",k(3,Cr,e.template,_(1,sn,e.componentConfigSignal),o==null?null:o.variant,e.setIfCondition.bind(e),e.elementRef))}}function br(n,r){if(n&1&&(d(0),g(1,Ir,2,9,"ng-container",1),u()),n&2){let o=s();l(),c("veltIf",b(3,Sr,o.conditionSignal(),_(1,sn,o.componentConfigSignal)))}}var be=(()=>{let r=class r extends B{constructor(e,t,i){super(e,t,i),this.elementRef=e,this.dynamicDataService=t,this.loggingService=i,this.componentId="velt-presence-avatar-list",this.constants=p;try{super.initializeComponentConfigSignal(new ie)}catch(a){this.loggingService.catch("Error in PresenceAvatarListComponent constructor: ",a)}}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes();let e=this.template?.querySelector("velt-presence-avatar-list-item-wireframe");wt(e)||(this.itemTemplate=e)}catch(e){this.loggingService.catch("Error in PresenceAvatarListComponent ngOnInit: ",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in PresenceAvatarListComponent ngOnDestroy: ",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in PresenceAvatarListComponent setupA11yAttributes:",e)}}};r.\u0275fac=function(t){return new(t||r)(m(I),m(f),m(v))},r.\u0275cmp=x({type:r,selectors:[["velt-presence-avatar-list-internal"]],standalone:!1,features:[$([f]),U],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],[4,"ngFor","ngForOf","ngForTrackBy"],[3,"presenceUser","index","componentConfigSignal","itemTemplate"]],template:function(t,i){t&1&&g(0,br,2,6,"ng-container",0),t&2&&c("ngIf",i.componentConfigSignal())},dependencies:[ft,D,N,A,Ie],styles:["html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}body.velt-pin-dragging[_ngcontent-%COMP%] iframe[_ngcontent-%COMP%]{pointer-events:none!important}[_nghost-%COMP%]{position:relative;display:flex;flex-direction:row;justify-content:center;align-items:center;height:calc((1.5 + 0px) * var(--velt-base-rem-unit));min-width:calc((1.5 + 0px) * var(--velt-base-rem-unit))}[_nghost-%COMP%]:empty{display:none}velt-presence-avatar-list-item-internal[_ngcontent-%COMP%]:not(:first-child){margin-left:calc(var(--velt-spacing-xs) * -1)}"],changeDetection:0});let n=r;return n})();var cn=n=>({componentConfigSignal:n}),Pr=(n,r)=>({condition:n,data:r}),xr=(n,r,o,e,t)=>({template:n,context:r,componentName:"velt-presence-avatar-remaining-count-wireframe",variant:o,setIfCondition:e,componentElementRef:t});function Ur(n,r){if(n&1&&(d(0),T(1,"snippyly-user-avatar",3),M(2,"div",4),O(),u()),n&2){let o=s(3).ngIf;l(),c("initial","+"+(o.filteredPresenceUsers.length-o.maxUsers).toString())}}function Tr(n,r){if(n&1&&(d(0),g(1,Ur,3,1,"ng-container",2),u()),n&2){let o=s(2).ngIf,e=s();l(),c("veltDynamicTemplate",k(3,xr,e.template,_(1,cn,e.componentConfigSignal),o==null?null:o.variant,e.setIfCondition.bind(e),e.elementRef))}}function Or(n,r){if(n&1&&(d(0),g(1,Tr,2,9,"ng-container",0),u()),n&2){let o=s().ngIf;l(),c("ngIf",o.filteredPresenceUsers.length>o.maxUsers)}}function kr(n,r){if(n&1&&(d(0),g(1,Or,2,1,"ng-container",1),u()),n&2){let o=s();l(),c("veltIf",b(3,Pr,o.conditionSignal(),_(1,cn,o.componentConfigSignal)))}}var Ee=(()=>{let r=class r extends B{constructor(e,t,i){super(e,t,i),this.elementRef=e,this.dynamicDataService=t,this.loggingService=i,this.componentId="velt-presence-avatar-remaining-count";try{super.initializeComponentConfigSignal(new ie)}catch(a){this.loggingService.catch("Error in PresenceAvatarRemainingCountComponent constructor: ",a)}}ngOnInit(){try{super.ngOnInit(),this.setupA11yAttributes()}catch(e){this.loggingService.catch("Error in PresenceAvatarRemainingCountComponent ngOnInit: ",e)}}ngOnDestroy(){try{super.ngOnDestroy()}catch(e){this.loggingService.catch("Error in PresenceAvatarRemainingCountComponent ngOnDestroy: ",e)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in PresenceAvatarRemainingCountComponent setupA11yAttributes:",e)}}};r.\u0275fac=function(t){return new(t||r)(m(I),m(f),m(v))},r.\u0275cmp=x({type:r,selectors:[["velt-presence-avatar-remaining-count-internal"]],standalone:!1,features:[$([f]),U],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"],[1,"velt-presence-avatar","velt-presence-avatar-remaining-count","s-presence-avatar","more-users",3,"initial"],[1,"velt-presence-avatar-remaining-count-outline","avatar-outline"]],template:function(t,i){t&1&&g(0,kr,2,6,"ng-container",0),t&2&&c("ngIf",i.componentConfigSignal())},dependencies:[D,N,A,re],styles:["html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}body.velt-pin-dragging[_ngcontent-%COMP%] iframe[_ngcontent-%COMP%]{pointer-events:none!important}[_nghost-%COMP%]:empty{display:none}.velt-presence-avatar[_ngcontent-%COMP%]{position:relative;border-radius:var(--velt-border-radius-full);z-index:2;width:calc((1.5 + 0px) * var(--velt-base-rem-unit));height:calc((1.5 + 0px) * var(--velt-base-rem-unit));display:flex;align-items:center;justify-content:center}.velt-presence-avatar.velt-presence-avatar-remaining-count[_ngcontent-%COMP%]{box-shadow:none;color:var(--velt-text-0);margin-left:calc(var(--velt-spacing-xs) * -1);background-color:var(--legacy-velt-presence-more-users-color)}.velt-presence-avatar.velt-presence-avatar-remaining-count[_ngcontent-%COMP%] .velt-presence-avatar-remaining-count-outline[_ngcontent-%COMP%]{border-color:var(--legacy-velt-presence-more-users-color)}snippyly-user-avatar[_ngcontent-%COMP%]{--legacy-velt-user-avatar-size: 1.5rem}"],changeDetection:0});let n=r;return n})();var ln=n=>({componentConfigSignal:n}),Ar=(n,r)=>({condition:n,data:r}),Nr=(n,r,o,e,t)=>({template:n,context:r,componentName:"velt-presence-wireframe",variant:o,setIfCondition:e,componentElementRef:t});function wr(n,r){n&1&&we(0)}function Fr(n,r){if(n&1&&(T(0,"velt-shadow-dom-internal"),g(1,wr,1,0,"ng-container",4),O()),n&2){s();let o=te(3);l(),c("ngTemplateOutlet",o)}}function Rr(n,r){if(n&1&&(d(0),M(1,"velt-presence-avatar-list-internal",8)(2,"velt-presence-avatar-remaining-count-internal",8),u()),n&2){let o=s(5);l(),c("componentConfigSignal",o.componentConfigSignal),l(),c("componentConfigSignal",o.componentConfigSignal)}}function Mr(n,r){if(n&1&&(T(0,"div",6),g(1,Rr,3,2,"ng-container",7),O()),n&2){let o=s(3).ngIf,e=s();l(),c("veltDynamicTemplate",k(3,Nr,e.template,_(1,ln,e.componentConfigSignal),o==null?null:o.variant,e.setIfCondition.bind(e),e.elementRef))}}function Lr(n,r){if(n&1&&g(0,Mr,2,9,"div",5),n&2){let o=s(2).ngIf;c("ngIf",o.filteredPresenceUsers&&o.filteredPresenceUsers.length>0&&!(o.user!=null&&o.user.isAnonymous))}}function jr(n,r){if(n&1&&(d(0),g(1,Fr,2,1,"velt-shadow-dom-internal",3)(2,Lr,1,1,"ng-template",null,0,ne),u()),n&2){let o=te(3),e=s().ngIf,t=s();l(),c("ngIf",e.shadowDom&&!t.template||t.template&&t.isExplicitShadowDom)("ngIfElse",o)}}function $r(n,r){if(n&1&&(d(0),g(1,jr,4,2,"ng-container",2),u()),n&2){let o=s();l(),c("veltIf",b(3,Ar,o.conditionSignal(),_(1,ln,o.componentConfigSignal)))}}var pe=(()=>{let r=class r extends ze{get maxUsers(){return this._maxUsers}set maxUsers(e){try{isNaN(e)?this.loggingService.catch("Error in Presence set maxUsers: ","max-user value is not a number."):this._maxUsers=e}catch(t){this.loggingService.catch("Error in Presence set maxUsers: ",t)}}get inactivityTime(){return this._inactivityTime}set inactivityTime(e){try{isNaN(e)?this.loggingService.catch("Error in Presence set inactivityTime: ","inactivity-time value is not a number."):(this._inactivityTime=e,this.presenceService.setInactivityTime(this._inactivityTime))}catch(t){this.loggingService.catch("Error in Presence set inactivityTime: ",t)}}get offlineInactivityTime(){return this._offlineInactivityTime}set offlineInactivityTime(e){try{isNaN(e)?this.loggingService.catch("Error in Presence set offlineInactivityTime: ","offline-inactivity-time value is not a number."):(this._offlineInactivityTime=e,this.presenceService.setOfflineInactivityTime(this._offlineInactivityTime))}catch(t){this.loggingService.catch("Error in Presence set offlineInactivityTime: ",t)}}get flockMode(){return this._flockMode}set flockMode(e){try{let t=typeof e=="string"?JSON.parse(e):e;t?(this._flockMode=t,this.flockService.enableFlockMode(),this.flockService.setNavigateEmitter(this.onNavigate)):(this._flockMode=t,this.flockService.disableFlockMode())}catch(t){this.loggingService.catch("Error in Presence set flockMode: ",t)}}set disableFlockNavigation(e){try{let t=e;typeof e=="string"&&(t=JSON.parse(e)),this.flockService.setDisableFlockNavigation(t)}catch(t){this.loggingService.catch("Error in Presence set disableFlockNavigation: ",t)}}set defaultFlockNavigation(e){try{let t=e;typeof e=="string"&&(t=JSON.parse(e)),this.flockService.setDisableFlockNavigation(!t)}catch(t){this.loggingService.catch("Error in Presence set defaultFlockNavigation: ",t)}}get location(){return this._location}set location(e){try{if(e&&typeof e=="string"){let t=JSON.parse(e);this._location=t,this.serverLocationId=At(this.location)}}catch(t){this.loggingService.catch("Error in Presence set location: ",t)}}set self(e){try{let t=e;typeof e=="string"&&(t=JSON.parse(e)),t?this.presenceService.enableIncludeSelf():this.presenceService.disableIncludeSelf()}catch{}}set _shadowDom(e){try{let t=e;typeof e=="string"&&(t=JSON.parse(e)),this.isExplicitShadowDom=!!t,this.componentConfigSignal.update(i=>(i=F(C({},i),{shadowDom:t}),i))}catch{}}constructor(e,t,i,a,h,y,L,Ve,Ye,xe,Ue,Te){super(xe,Ue,void 0,void 0,void 0,Te,h),this.analyticsService=e,this.authService=t,this.flockService=i,this.presenceService=a,this.loggingService=h,this.wireframeService=y,this.overlay=L,this.overlayPositionBuilder=Ve,this.viewContainerRef=Ye,this.elementRef=xe,this.themeService=Ue,this.dynamicDataService=Te,this.DEFAULT_MAX_USERS=5,this._maxUsers=this.DEFAULT_MAX_USERS,this._inactivityTime=5,this._offlineInactivityTime=10,this._flockMode=!1,this.onNavigate=new ue,this.isExplicitShadowDom=!1,this.onPresenceUserClickEmitter=new ue,this.presenceUsers=[],this.subscriptions=[],this.constants=p,this.onUsersChanged=new ue,this.onPresenceUserChange=new ue,this.componentConfigSignal=Ae({filteredPresenceUsers:[],user:null,shadowDom:!0,maxUsers:5,tooltipContent:null,trackById:this.trackById.bind(this),showTooltip:this.showTooltip.bind(this),closeTooltip:this.closeTooltip.bind(this),onPresenceUserClick:this.onPresenceUserClick.bind(this)}),this.veltElement=!0,this.componentId="velt-presence",this.loggingService.log("%c[WB] Creating CLASS: PresenceComponent","color: blue;"),this.subscriptions.push(this.authService.getUser$().subscribe(S=>{this.componentConfigSignal.update(w=>(w=F(C({},w),{user:S}),w)),this.componentConfigSignal().user&&(this.setPresenceInstalledInAnalytics(),this.presenceSetCustomMaxUsersInAnalytics())},S=>{this.loggingService.catch("Error in PresenceComponent getUser$ subscription: ",S)}))}ngOnInit(){this.loggingService.log("%c[WB] Calling FUNCTION: ngOnInit","color: green;");try{this.getOnlineUsersOnCurrentDocument(),this.setupA11yAttributes(),super.ngOnInit(),this.subscriptions.push(this.wireframeService.getWireframe$("velt-presence-wireframe").subscribe(t=>{if(t){let i=document.createElement(t.tagName);i.innerHTML=t.innerHTML,this.template=i}}))}catch(e){this.loggingService.catch("Error in PresenceComponent oninit: ",e)}}ngOnChanges(e){try{this.loggingService.log("%c[WB] Calling PresenceComponent FUNCTION: ngOnChanges","color: green;"),e&&(super.ngOnChanges(e),Object.keys(e).forEach(t=>{this.componentConfigSignal.update(i=>(i=F(C({},i),{[t]:e[t].currentValue}),i))}))}catch(t){this.loggingService.catch("Error in PresenceComponent ngOnChanges: ",t)}}setupA11yAttributes(){try{this.elementRef.nativeElement.setAttribute("data-testid",this.componentId+"-container")}catch(e){this.loggingService.catch("Error in PresenceComponent setupA11yAttributes:",e)}}ngOnDestroy(){this.loggingService.log("%c[WB] Calling FUNCTION: ngOnDestroy","color: green;");try{this.unsubscribe(),super.ngOnDestroy(),this.closeTooltip()}catch(e){this.loggingService.catch("Error in PresenceComponent ondestroy: ",e)}}unsubscribe(){this.loggingService.log("%c[WB] Calling FUNCTION: unsubscribe","color: green;");try{this.subscriptions.map(e=>{e.unsubscribe()}),this.subscriptions=[]}catch(e){this.loggingService.catch("Error in PresenceComponent unsubscribe: ",e)}}showTooltip(e,t){try{this.closeTooltip();let i=new I(e.currentTarget),a=this.overlayPositionBuilder.flexibleConnectedTo(i).withPositions([{originX:"center",originY:"bottom",overlayX:"center",overlayY:"top"},{originX:"center",originY:"top",overlayX:"center",overlayY:"bottom"},{originX:"start",originY:"center",overlayX:"end",overlayY:"center"},{originX:"end",originY:"center",overlayX:"start",overlayY:"center"}]);this.overlayRef=this.overlay.create({positionStrategy:a}),this.overlayRef.attach(new Ct(this.componentConfigSignal().tooltipContent,this.viewContainerRef,{$implicit:t}))}catch(i){this.loggingService.catch("Error in PresenceComponent showTooltip: ",i)}}closeTooltip(){try{this.overlayRef&&this.overlayRef.dispose()}catch(e){this.loggingService.catch("Error in PresenceComponent closeTooltip: ",e)}}getOnlineUsersOnCurrentDocument(){this.loggingService.log("%c[WB] Calling FUNCTION: getOnlineUsersOnCurrentDocument","color: green;");try{this.subscriptions.push(this.presenceService.getOnlineUsersOnCurrentDocument().pipe(Y(e=>!!e)).subscribe(e=>{this.loggingService.log(e),e&&(this.presenceUsers=e),this.filterPresenceUsers()},e=>{this.loggingService.catch("Error in PresenceComponent getOnlineUsersOnCurrentDocument subscription: ",e)}))}catch(e){this.loggingService.catch("Error in PresenceComponent getOnlineUsersOnCurrentDocument: ",e)}}filterPresenceUsers(){try{let e=[];this.presenceUsers?this.locationId?e=this.presenceUsers.filter(t=>t?.location?.id===this.locationId):this.location?e=this.presenceUsers.filter(t=>t.locationId===this.serverLocationId):e=this.presenceUsers:e=[],this.componentConfigSignal.update(t=>(t=F(C({},t),{filteredPresenceUsers:e}),t)),this.onUsersChanged.emit(this.componentConfigSignal().filteredPresenceUsers),this.onPresenceUserChange.emit(this.componentConfigSignal().filteredPresenceUsers)}catch(e){this.loggingService.catch("Error in PresenceComponent filterPresenceUsers: ",e)}}calculateUserAwayTime(e){try{if(e.onlineStatus===p.PRESENCE_STATUS_ONLINE)return 0;let t=me(e.timestamp);return Math.floor(t/1e3/60)}catch(t){this.loggingService.catch("Error in PresenceComponent calculateUserAwayTime: ",t)}return 0}setPresenceInstalledInAnalytics(){try{this.analyticsService.setInstalledFeature(X.PRESENCE)}catch(e){this.loggingService.catch("Error in PresenceComponent setPresenceInstalledInAnalytics: ",e)}}presenceSetCustomMaxUsersInAnalytics(){try{this.maxUsers!=this.DEFAULT_MAX_USERS&&this.analyticsService.trackEvent(E.Events.Presence.PRESENCE_SET_CUSTOM_MAX_USERS,{maxUsers:+this.maxUsers})}catch(e){this.loggingService.catch("Error in PresenceComponent presenceSetCustomMaxUsersInAnalytics: ",e)}}onPresenceUserClick(e){try{this.analyticsService.trackEvent(E.Events.Presence.PRESENCE_USER_CLICKED,{totalUsers:this.presenceService?.getPresenceUsers()?.length,presenceSnippylyUserIds:this.presenceService?.getPresenceUsers()?.map(t=>t.userSnippylyId),presenceClientUserIds:this.presenceService?.getPresenceUsers()?.map(t=>t.userId)}),this.onPresenceUserClickEmitter.emit(e),this.componentConfigSignal().user?.userSnippylyId!==e?.userSnippylyId&&this.flockService.getFlockMode()&&this.setFlockLeader(e.userSnippylyId,e.name)}catch(t){this.loggingService.catch("Error in PresenceComponent onPresenceUserClick: ",t)}}setFlockLeader(e,t){try{this.flockService.setFlockLeader(e,t)}catch(i){this.loggingService.catch("Error in PresenceComponent setFlockLeader: ",i)}}trackById(e,t){return t?.userId}};r.\u0275fac=function(t){return new(t||r)(m(ge),m($e),m(K),m(z),m(v),m(Be),m(yt),m(_t),m(ct),m(I),m(We),m(f))},r.\u0275cmp=x({type:r,selectors:[["app-presence"]],hostVars:1,hostBindings:function(t,i){t&2&&gt("data-velt-element",i.veltElement)},inputs:{maxUsers:"maxUsers",inactivityTime:"inactivityTime",offlineInactivityTime:"offlineInactivityTime",flockMode:"flockMode",disableFlockNavigation:"disableFlockNavigation",defaultFlockNavigation:"defaultFlockNavigation",location:"location",locationId:"locationId",self:"self",_shadowDom:[0,"shadowDom","_shadowDom"],variant:"variant"},outputs:{onNavigate:"onNavigate",onPresenceUserClickEmitter:"onPresenceUserClick",onUsersChanged:"usersChanged",onPresenceUserChange:"onPresenceUserChange"},standalone:!1,features:[U,Ne],decls:1,vars:1,consts:[["presenceRef",""],[4,"ngIf"],[4,"veltIf"],[4,"ngIf","ngIfElse"],[4,"ngTemplateOutlet"],["class","velt-presence-container s-presence-container",4,"ngIf"],[1,"velt-presence-container","s-presence-container"],[4,"veltDynamicTemplate"],[3,"componentConfigSignal"]],template:function(t,i){t&1&&g(0,$r,2,6,"ng-container",1),t&2&&c("ngIf",i.componentConfigSignal())},dependencies:[D,Me,N,A,be,Ee],styles:["html[_ngcontent-%COMP%]{--velt-base-rem-unit: 1}*[data-snippyly-element=true][_ngcontent-%COMP%], *[data-velt-element=true][_ngcontent-%COMP%]{font-family:var(--velt-default-font-family)}velt-wireframe[_ngcontent-%COMP%]{display:none!important}body.velt-pin-dragging[_ngcontent-%COMP%] iframe[_ngcontent-%COMP%]{pointer-events:none!important}[_nghost-%COMP%]{--velt-green: var(--velt-light-mode-green);--velt-magenta: var(--velt-light-mode-magenta);--velt-amber: var(--velt-light-mode-amber);--velt-purple: var(--velt-light-mode-purple);--velt-cyan: var(--velt-light-mode-cyan);--velt-orange: var(--velt-light-mode-orange);--velt-black: var(--velt-light-mode-black);--velt-white: var(--velt-light-mode-white);--velt-gray: var(--velt-light-mode-gray);--velt-error: var(--velt-light-mode-error);--velt-error-hover: var(--velt-light-mode-error-hover);--velt-error-foreground: var(--velt-light-mode-error-foreground);--velt-error-light: var(--velt-light-mode-error-light);--velt-error-transparent: var(--velt-light-mode-error-transparent);--velt-warning: var(--velt-light-mode-warning);--velt-warning-hover: var(--velt-light-mode-warning-hover);--velt-warning-foreground: var(--velt-light-mode-warning-foreground);--velt-warning-light: var(--velt-light-mode-warning-light);--velt-warning-transparent: var(--velt-light-mode-warning-transparent);--velt-agent-accent: #4495ff;--velt-agent-accent-transparent: rgba(68, 149, 255, .2);--velt-success: var(--velt-light-mode-success);--velt-success-hover: var(--velt-light-mode-success-hover);--velt-success-foreground: var(--velt-light-mode-success-foreground);--velt-success-light: var(--velt-light-mode-success-light);--velt-success-transparent: var(--velt-light-mode-success-transparent);--velt-accent: var(--velt-light-mode-accent);--velt-accent-text: var(--velt-light-mode-accent-text);--velt-accent-hover: var(--velt-light-mode-accent-hover);--velt-accent-foreground: var(--velt-light-mode-accent-foreground);--velt-accent-light: var(--velt-light-mode-accent-light);--velt-accent-transparent: var(--velt-light-mode-accent-transparent);--velt-text-0: var(--velt-light-mode-text-0);--velt-text-1: var(--velt-light-mode-text-1);--velt-text-2: var(--velt-light-mode-text-2);--velt-text-3: var(--velt-light-mode-text-3);--velt-text-4: var(--velt-light-mode-text-4);--velt-text-5: var(--velt-light-mode-text-5);--velt-text-6: var(--velt-light-mode-text-6);--velt-text-7: var(--velt-light-mode-text-7);--velt-text-8: var(--velt-light-mode-text-8);--velt-text-9: var(--velt-light-mode-text-9);--velt-text-10: var(--velt-light-mode-text-10);--velt-text-11: var(--velt-light-mode-text-11);--velt-text-12: var(--velt-light-mode-text-12);--velt-background-0: var(--velt-light-mode-background-0);--velt-background-1: var(--velt-light-mode-background-1);--velt-background-2: var(--velt-light-mode-background-2);--velt-background-3: var(--velt-light-mode-background-3);--velt-background-4: var(--velt-light-mode-background-4);--velt-background-5: var(--velt-light-mode-background-5);--velt-background-6: var(--velt-light-mode-background-6);--velt-background-7: var(--velt-light-mode-background-7);--velt-background-8: var(--velt-light-mode-background-8);--velt-background-9: var(--velt-light-mode-background-9);--velt-background-10: var(--velt-light-mode-background-10);--velt-border-0: var(--velt-light-mode-border-0);--velt-border-1: var(--velt-light-mode-border-1);--velt-border-2: var(--velt-light-mode-border-2);--velt-border-3: var(--velt-light-mode-border-3);--velt-border-4: var(--velt-light-mode-border-4);--velt-border-5: var(--velt-light-mode-border-5);--velt-border-6: var(--velt-light-mode-border-6);--velt-border-7: var(--velt-light-mode-border-7);--velt-border-8: var(--velt-light-mode-border-8);--velt-border-9: var(--velt-light-mode-border-9);--velt-border-10: var(--velt-light-mode-border-10);--velt-background-transparent: var(--velt-light-mode-background-transparent);--velt-border-transparent: var(--velt-light-mode-border-transparent);--velt-animation-transparent: var(--velt-light-mode-animation-transparent)}[_nghost-%COMP%]:empty{display:none}[dark][_nghost-%COMP%]{--velt-green: var(--velt-dark-mode-green);--velt-magenta: var(--velt-dark-mode-magenta);--velt-amber: var(--velt-dark-mode-amber);--velt-purple: var(--velt-dark-mode-purple);--velt-cyan: var(--velt-dark-mode-cyan);--velt-orange: var(--velt-dark-mode-orange);--velt-black: var(--velt-dark-mode-black);--velt-white: var(--velt-dark-mode-white);--velt-gray: var(--velt-dark-mode-gray);--velt-error: var(--velt-dark-mode-error);--velt-error-hover: var(--velt-dark-mode-error-hover);--velt-error-foreground: var(--velt-dark-mode-error-foreground);--velt-error-light: var(--velt-dark-mode-error-light);--velt-error-transparent: var(--velt-dark-mode-error-transparent);--velt-warning: var(--velt-dark-mode-warning);--velt-warning-hover: var(--velt-dark-mode-warning-hover);--velt-warning-foreground: var(--velt-dark-mode-warning-foreground);--velt-warning-light: var(--velt-dark-mode-warning-light);--velt-warning-transparent: var(--velt-dark-mode-warning-transparent);--velt-agent-accent: #4495ff;--velt-agent-accent-transparent: rgba(68, 149, 255, .2);--velt-success: var(--velt-dark-mode-success);--velt-success-hover: var(--velt-dark-mode-success-hover);--velt-success-foreground: var(--velt-dark-mode-success-foreground);--velt-success-light: var(--velt-dark-mode-success-light);--velt-success-transparent: var(--velt-dark-mode-success-transparent);--velt-accent: var(--velt-dark-mode-accent);--velt-accent-text: var(--velt-dark-mode-accent-text);--velt-accent-hover: var(--velt-dark-mode-accent-hover);--velt-accent-foreground: var(--velt-dark-mode-accent-foreground);--velt-accent-light: var(--velt-dark-mode-accent-light);--velt-accent-transparent: var(--velt-dark-mode-accent-transparent);--velt-text-0: var(--velt-dark-mode-text-0);--velt-text-1: var(--velt-dark-mode-text-1);--velt-text-2: var(--velt-dark-mode-text-2);--velt-text-3: var(--velt-dark-mode-text-3);--velt-text-4: var(--velt-dark-mode-text-4);--velt-text-5: var(--velt-dark-mode-text-5);--velt-text-6: var(--velt-dark-mode-text-6);--velt-text-7: var(--velt-dark-mode-text-7);--velt-text-8: var(--velt-dark-mode-text-8);--velt-text-9: var(--velt-dark-mode-text-9);--velt-text-10: var(--velt-dark-mode-text-10);--velt-text-11: var(--velt-dark-mode-text-11);--velt-text-12: var(--velt-dark-mode-text-12);--velt-background-0: var(--velt-dark-mode-background-0);--velt-background-1: var(--velt-dark-mode-background-1);--velt-background-2: var(--velt-dark-mode-background-2);--velt-background-3: var(--velt-dark-mode-background-3);--velt-background-4: var(--velt-dark-mode-background-4);--velt-background-5: var(--velt-dark-mode-background-5);--velt-background-6: var(--velt-dark-mode-background-6);--velt-background-7: var(--velt-dark-mode-background-7);--velt-background-8: var(--velt-dark-mode-background-8);--velt-background-9: var(--velt-dark-mode-background-9);--velt-background-10: var(--velt-dark-mode-background-10);--velt-border-0: var(--velt-dark-mode-border-0);--velt-border-1: var(--velt-dark-mode-border-1);--velt-border-2: var(--velt-dark-mode-border-2);--velt-border-3: var(--velt-dark-mode-border-3);--velt-border-4: var(--velt-dark-mode-border-4);--velt-border-5: var(--velt-dark-mode-border-5);--velt-border-6: var(--velt-dark-mode-border-6);--velt-border-7: var(--velt-dark-mode-border-7);--velt-border-8: var(--velt-dark-mode-border-8);--velt-border-9: var(--velt-dark-mode-border-9);--velt-border-10: var(--velt-dark-mode-border-10);--velt-background-transparent: var(--velt-dark-mode-background-transparent);--velt-border-transparent: var(--velt-dark-mode-border-transparent);--velt-animation-transparent: var(--velt-dark-mode-animation-transparent)}[_nghost-%COMP%]{position:relative;display:inline-flex;justify-content:center;align-items:center;margin:0;padding:0;-webkit-tap-highlight-color:rgba(255,255,255,0);box-sizing:border-box;width:auto;height:calc((1.5 + 0px) * var(--velt-base-rem-unit));font-size:var(--velt-font-size-xs);line-height:1.5;background:transparent}.velt-presence-container[_ngcontent-%COMP%]{position:relative;display:flex;flex-direction:row;justify-content:center;align-items:center;height:calc((1.5 + 0px) * var(--velt-base-rem-unit));min-width:calc((1.5 + 0px) * var(--velt-base-rem-unit))}"],changeDetection:0});let n=r;return n})();var Pe=(()=>{let r=class r{constructor(e,t,i){this.analyticsService=e,this.loggingService=t,this.presenceService=i,this.actionSubjects=new Map,this.subscriptions=[];try{this.presenceService.setPresenceActionsService(this)}catch(a){this.loggingService.catch("Error in PresenceActionsService constructor: ",a)}}onMultipleUsersOnline(e){try{this.loggingService.log("%c[WB] Calling PresenceActionsService FUNCTION: onMultipleUsersOnline","color: green;"),this.triggerAction(nt.MULTIPLE_USERS_ONLINE,e),this.analyticsService.trackEvent(E.Events.Presence.MULTIPLE_USERS_ONLINE,{totalUsers:e?.users?.length,presenceSnippylyUserIds:e?.users?.map(t=>t.userSnippylyId),presenceClientUserIds:e?.users?.map(t=>t.userId)})}catch(t){this.loggingService.catch("Error in PresenceActionsService onMultipleUsersOnline: ",t)}}onUserStateChange(e){try{this.loggingService.log("%c[WB] Calling PresenceActionsService FUNCTION: onUserStateChange","color: green;"),this.triggerAction(nt.USER_STATE_CHANGE,e),this.analyticsService.trackEvent(E.Events.Presence.ON_USER_STATE_CHANGE,{userSnippylyId:e?.user?.userSnippylyId,userId:e?.user?.userId,state:e?.state})}catch(t){this.loggingService.catch("Error in PresenceActionsService onUserStateChange: ",t)}}getData(e){try{return this.loggingService.log("%c[WB] Calling PresenceActionsService FUNCTION: getData","color: green;"),this.presenceService.getOnlineUsersOnCurrentDocument(e).pipe(j(t=>({data:t})))}catch(t){return this.loggingService.catch("Error in PresenceActionsService getData: ",t),R({data:null})}}triggerAction(e,t){try{this.actionSubjects.has(e)||this.actionSubjects.set(e,new Xe),this.actionSubjects.get(e)?.next(t)}catch(i){this.loggingService.catch("Error in PresenceActionsService triggerAction: ",i)}}onAction(e){try{return this.actionSubjects.has(e)||this.actionSubjects.set(e,new Xe),this.actionSubjects.get(e)?.asObservable()}catch(t){return this.loggingService.catch("Error in PresenceActionsService onAction: ",t),R(null)}}};r.\u0275fac=function(t){return new(t||r)(P(ge),P(v),P(z))},r.\u0275prov=ae({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();var Ge=class extends Xt{constructor(r){super(r),this.getService(v).log("%c[WB] Creating CLASS: PresenceElement","color: blue;"),this.getOnlineUsersOnCurrentDocument=this._getOnlineUsersOnCurrentDocument,this.setInactivityTime=this._setInactivityTime,this.enableFlockMode=this._enableFlockMode,this.disableFlockMode=this._disableFlockMode,this.startFollowingUser=this._startFollowingUser,this.stopFollowingUser=this._stopFollowingUser,this.enableSelf=this._enableSelf,this.disableSelf=this._disableSelf,this.getData=this._getData,this.on=this._on,this.addUser=this._addUser,this.removeUser=this._removeUser}_getOnlineUsersOnCurrentDocument(){this.getService(v).log("%c[WB] Calling FUNCTION: getOnlineUsers","color: green;");try{return this.trackEvent(E.Events.Presence.GET_ONLINE_USERS_ON_CURRENT_DOCUMENT_TRIGGERED),this.getService(z).getOnlineUsersOnCurrentDocument()}catch(r){return this.getService(v).catch("Error in _getOnlineUsersOnCurrentDocument: ",r),R(null)}}_setInactivityTime(r){this.getService(v).log("%c[WB] Calling FUNCTION: _setInactivityTime","color: green;");try{this.trackEvent(E.Events.Presence.SET_INACTIVITY_TIME_TRIGGERED,{payload:{time:r}}),isNaN(r)?this.getService(v).catch("Error in setInactivityTime: ","Provided value is not a number."):this.getService(z).setInactivityTime(r)}catch(o){this.getService(v).catch("Error in setInactivityTime: ",o)}}_disableFlockMode(){try{this.trackEvent(E.Events.Presence.DISABLE_FLOCK_MODE_TRIGGERED),this.getService(K).disableFlockMode()}catch(r){this.getService(v).catch("Error in _disableFlockMode: ",r)}}_enableFlockMode(r){try{this.trackEvent(E.Events.Presence.ENABLE_FLOCK_MODE_TRIGGERED,{payload:{options:r}}),this.getService(K).enableFlockMode(r)}catch(o){this.getService(v).catch("Error in _enableFlockMode: ",o)}}_stopFollowingUser(){try{this.trackEvent(E.Events.Presence.STOP_FOLLOWING_USER_TRIGGERED),this.getService(K).stopFollowingUser()}catch(r){this.getService(v).catch("Error in _stopFollowingUser: ",r)}}_startFollowingUser(r){try{this.trackEvent(E.Events.Presence.START_FOLLOWING_USER_TRIGGERED,{payload:{externalId:r}});let o=this.getService(z).getPresenceUserFromExternalId(r);return o&&o.userSnippylyId&&o.name!==void 0?(this.getService(K).startFollowingUser(o.userSnippylyId,o.name),{success:!0,msg:"Joined flock session."}):{success:!1,msg:"User could not be found."}}catch(o){return this.getService(v).catch("Error in _startFollowingUser: ",o),{success:!1,msg:"Unknown error.",raw:o}}}_enableSelf(){try{this.trackEvent(E.Events.Presence.ENABLE_SELF_TRIGGERED),this.getService(z).enableIncludeSelf()}catch(r){this.getService(v).catch("Error in _enableSelf: ",r)}}_disableSelf(){try{this.trackEvent(E.Events.Presence.DISABLE_SELF_TRIGGERED),this.getService(z).disableIncludeSelf()}catch(r){this.getService(v).catch("Error in _disableSelf: ",r)}}_getData(r){this.getService(v).log("%c[WB] Calling FUNCTION: getData","color: green;");try{return this.trackEvent(E.Events.Presence.GET_PRESENCE_DATA_TRIGGERED,{payload:{query:r}}),r&&typeof r=="object"&&(r=C({},r),r?.documentId&&(r.documentId=Ot(r.documentId)),r?.organizationId&&(r.organizationId=kt(r.organizationId))),this.getService(Pe).getData(r)}catch(o){return this.getService(v).catch("Error in _getData: ",o),R({data:null})}}_on(r){this.getService(v).log("%c[WB] Calling FUNCTION: on","color: green;");try{return this.getService(Pe).onAction(r)}catch(o){return this.getService(v).catch("Error in _on: ",o),R(null)}}_addUser(r){this.getService(v).log("%c[WB] Calling FUNCTION: addUser","color: green;");try{if(this.trackEvent(E.Events.Presence.ADD_USER_TRIGGERED,{payload:{userId:r?.user?.userId,localOnly:r?.localOnly}}),!r?.user?.userId){this.getService(v).catch("Error in addUser: ","userId is required");return}this.getService(z).addCustomUser(r)}catch(o){this.getService(v).catch("Error in addUser: ",o)}}_removeUser(r){this.getService(v).log("%c[WB] Calling FUNCTION: removeUser","color: green;");try{if(this.trackEvent(E.Events.Presence.REMOVE_USER_TRIGGERED,{payload:{userId:r?.user?.userId,localOnly:r?.localOnly}}),!r?.user?.userId){this.getService(v).catch("Error in removeUser: ","userId is required");return}this.getService(z).removeCustomUser(r)}catch(o){this.getService(v).catch("Error in removeUser: ",o)}}};var mn=(()=>{let r=class r{};r.\u0275fac=function(t){return new(t||r)},r.\u0275mod=mt({type:r}),r.\u0275inj=st({imports:[St,re,Je]});let n=r;return n})();var gn=(()=>{let r=class r{constructor(e,t){this.loggingService=e,this.usersService=t}getUserIdsToResolveFromPresenceUsers(e){try{let t=new Set;for(let i of e)i?.userId&&t.add(i?.userId);return Array.from(t)}catch(t){return this.loggingService.catch("Error in PresenceUtilsService getUserIdsToResolveFromPresenceUsers:",t),[]}}mergePresenceUserWithUser(e){try{if(this.usersService.userDataProviderAvailable()&&e?.userId){let t=this.usersService.getUserById(e?.userId);t&&(e=C(C({},e),t))}return e}catch(t){return this.loggingService.catch("Error in PresenceUtilsService mergePresenceUserWithUser:",t),e}}formatPresenceUserData(e){try{if(this.usersService.userDataProviderAvailable()){let t=["userId","onlineStatus","userSnippylyId","color","textColor","timestamp","type","selections","documentParamsId","documentParams","locationId","location","isReadOnly","isAnonymous","pageInfo"];Object.keys(e).forEach(i=>{t.includes(i)||(e[i]=null)})}return e}catch(t){return this.loggingService.catch("Error in PresenceUtilsService formatPresenceUserData:",t),e}}};r.\u0275fac=function(t){return new(t||r)(P(v),P(Jt))},r.\u0275prov=ae({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();var Br={"velt-presence-wireframe":pe,"velt-presence-avatar-list-wireframe":be,"velt-presence-avatar-list-item-wireframe":Ie,"velt-presence-avatar-remaining-count-wireframe":Ee,"velt-presence-tooltip-wireframe":ye,"velt-presence-tooltip-avatar-wireframe":he,"velt-presence-tooltip-user-active-wireframe":fe,"velt-presence-tooltip-user-inactive-wireframe":Se,"velt-presence-tooltip-user-name-wireframe":Ce,"velt-presence-tooltip-status-container-wireframe":_e};Object.assign(Vt,Br);function Wr(n){n.get(v).log("%c[WB] Loading presence feature chunk","color: blue;");let o=n.get(jt);o.set(Rt,n.get(z)),o.set(Mt,n.get(Pe)),o.set(Lt,n.get(gn));let t=lt(mn,n).injector;return vn(t,p.TAGS.VELT_PRESENCE,pe),vn(t,p.TAGS.SNIPPYLY_PRESENCE,pe),new Ge(n)}function vn(n,r,o){if(customElements.get(r))return;let e=It(o,{injector:n});customElements.define(r,e)}export{Wr as default};