@veltdev/sdk-staging 6.0.13 → 6.0.14-beta.2
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.
- package/app/models/element/activity-element.model.d.ts +9 -0
- package/app/models/element/autocomplete-element.model.d.ts +10 -0
- package/app/models/element/comment-element.model.d.ts +72 -0
- package/app/models/element/notification-element.model.d.ts +17 -0
- package/app/utils/constants.d.ts +1 -0
- package/{chunk-DZYVUUMS.js → chunk-2HGCWC7B.js} +1 -1
- package/chunk-2KTYC2AG.js +1 -0
- package/{chunk-5XJDGVGO.js → chunk-3AL5S762.js} +1 -1
- package/{chunk-TE4S24VF.js → chunk-45X5JRZ6.js} +1 -1
- package/chunk-6NWFM6PC.js +1 -0
- package/{chunk-IKXUU4LK.js → chunk-77FADRSO.js} +1 -1
- package/chunk-7TFVNMHJ.js +2 -0
- package/{chunk-NFQ33NZA.js → chunk-C5JOX4MX.js} +1 -1
- package/{chunk-XXU7YXMF.js → chunk-DFEL6HM7.js} +1 -1
- package/{chunk-Q2XHYKCH.js → chunk-DZYXTTOX.js} +1 -1
- package/{chunk-GHWFNVK2.js → chunk-FZSZ6AV3.js} +1 -1
- package/{chunk-MUMFBRNH.js → chunk-GULBDPIM.js} +1 -1
- package/{chunk-EMCGVIKG.js → chunk-HRCWTVRH.js} +1 -1
- package/chunk-I63T4QWP.js +6 -0
- package/{chunk-ZUQTUSHK.js → chunk-IMH5OESK.js} +1 -1
- package/chunk-IQ22I2I3.js +1 -0
- package/{chunk-NYRQTKJA.js → chunk-KNQJBBQA.js} +1 -1
- package/chunk-KQPNTB77.js +1 -0
- package/chunk-KWLMOL5X.js +193 -0
- package/chunk-L4QMAEKA.js +1 -0
- package/chunk-MRY4A7N6.js +1 -0
- package/{chunk-4VEJIKFU.js → chunk-NMPXJFDX.js} +1 -1
- package/chunk-O3FUWWWQ.js +1 -0
- package/{chunk-LOLURD74.js → chunk-PWTBCAPJ.js} +1 -1
- package/{chunk-V32SISMC.js → chunk-QFOWEUDB.js} +1 -1
- package/{chunk-4BAHMWIE.js → chunk-TQNLXTQA.js} +1 -1
- package/{chunk-STNBRDN3.js → chunk-UI2CRSTN.js} +1 -1
- package/{chunk-YTVKKNRL.js → chunk-UVKIGEOH.js} +1 -1
- package/{chunk-4YEJYNMX.js → chunk-VJLHHQ2Z.js} +1 -1
- package/chunk-VW5ND7U4.js +93 -0
- package/{chunk-2LJHR77K.js → chunk-WMDZMDJS.js} +1 -1
- package/{chunk-SYWOQU23.js → chunk-YFBAHLK6.js} +26 -26
- package/chunk-YO4HNOAN.js +1 -0
- package/{chunk-IQIWMWKJ.js → chunk-ZHXLO4CC.js} +1 -1
- package/package.json +1 -1
- package/velt-activity-log.js +1 -1
- package/velt-area.js +1 -1
- package/velt-arrow.js +2 -2
- package/velt-comment.js +7 -7
- package/velt-crdt.js +1 -1
- package/velt-cursor.js +2 -2
- package/velt-huddle.js +2 -2
- package/velt-live-state-sync.js +2 -2
- package/velt-notification.js +1 -1
- package/velt-portable.js +1 -1
- package/velt-presence.js +1 -1
- package/velt-reaction.js +1 -1
- package/velt-recorder.js +1 -1
- package/velt-rewriter.js +2 -2
- package/velt-selection.js +1 -1
- package/velt-tag.js +1 -1
- package/velt-user-invite.js +2 -2
- package/velt-user-request.js +1 -1
- package/velt-video-player.js +1 -1
- package/velt-views.js +2 -2
- package/velt.js +6 -6
- package/chunk-6YGRELTV.js +0 -2
- package/chunk-7TNGPXR5.js +0 -1
- package/chunk-A4HLP4VU.js +0 -1
- package/chunk-A6I23DJF.js +0 -1
- package/chunk-DAUJEOMM.js +0 -193
- package/chunk-IEOSSENF.js +0 -1
- package/chunk-KJN6PDWN.js +0 -93
- package/chunk-KKKGHIG4.js +0 -1
- package/chunk-RSCWN2VG.js +0 -1
- package/chunk-SZUD6M7J.js +0 -6
- package/chunk-TG2UOHTU.js +0 -1
- package/chunk-UY5BYX47.js +0 -1
package/velt-presence.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as K}from"./chunk-IKXUU4LK.js";import"./chunk-2LJHR77K.js";import{B as A,C as N,z as Qt}from"./chunk-TG2UOHTU.js";import{a as Je}from"./chunk-IEOSSENF.js";import{b as ve,c as Ye,d as re}from"./chunk-MUMFBRNH.js";import{a as Zt}from"./chunk-5XJDGVGO.js";import{a as Tt}from"./chunk-A6I23DJF.js";import{D as xt,F as Ut,da as f,ea as Ge,fa as $,ga as Ve,s as Pt}from"./chunk-SZUD6M7J.js";import{a as qt}from"./chunk-DZYVUUMS.js";import{e as Xt,l as Ht,t as Kt}from"./chunk-KKKGHIG4.js";import{$f as Nt,Af as st,Bb as s,Cg as Ft,D as mt,E as Y,Fb as St,G as gt,Gb as Ct,Gd as Ot,Ha as l,Hb as _t,Hc as bt,He as v,Ia as fe,Ic as D,J as Ze,K as Ne,Kb as te,Lb as yt,M as qe,Mb as je,Nc as Be,O as et,Od as kt,Og as Rt,Pb as se,Pd as Dt,Qb as $e,Qh as Mt,Ra as m,Rb as It,Rc as Et,Ri as Wt,S as vt,Se as at,Si as ge,Ta as dt,Ti as p,Uh as Lt,Ui as zt,V as B,Va as ut,Wa as x,Xa as ht,Y as H,Z as tt,Zf as At,_a as U,a as C,ab as g,ac as j,b as F,ba as ae,ca as pt,dc as _,ea as I,ec as E,fb as ft,fc as it,g as oe,ge as ot,hc as k,i as lt,ja as we,ji as P,jj as Jt,k as Qe,ka as Fe,l as he,mc as ce,mj as Gt,nb as c,nc as le,nj as ct,ob as T,pb as O,qb as R,qg as wt,r as w,rc as ne,re as X,ri as jt,rj as Vt,sa as Re,sg as me,si as $t,ti as Bt,tj as Yt,ub as d,v as L,vb as u,wa as Me,wb as Le,wj as We,x as Ae,xb as nt,xj as ze,ya as b,zb as rt}from"./chunk-SYWOQU23.js";var W=(()=>{let r=class r{constructor(e,t,i,a,h,y,M,He,Ke,Te,Oe,ke,de,ue){this.analyticsService=e,this.docService=t,this.domService=i,this.authService=a,this.afAuth=h,this.iamService=y,this.databaseService=M,this.configService=He,this.avatarService=Ke,this.loggingService=Te,this.flockService=Oe,this.commonDbService=ke,this.realtimeAdapter=de,this.adapterSelectorService=ue,this.db=null,this.presenceUser$=new he(new st),this.documentPaths=null,this.inactivityTime=300*1e3,this.offlineInactivityTime=600*1e3,this.presenceUsers$=new he([]),this.presenceUsersSubscription=null,this.includeSelf$=new he(!0),this.customPresenceUsers$=new he([]),this.userIdleStateDetectionSubscription=null,this.userOfflineStateDetectionSubscription=null,this.presenceRuntimeInitialized=!1;try{this.loggingService.log("%c[WB] Creating CLASS: PresenceService","color: blue;"),this.databaseService.getDb().pipe(Y(S=>!!S),Ne(1)).subscribe(S=>{S&&(this.db=S,this.initializePresenceRuntime())},S=>{this.loggingService.catch("Error in PresenceService constructor: ",S)});let De=ct(()=>{this.adapterSelectorService?.isPortableBackendActive()&&(this.initializePresenceRuntime(),De())});this.adapterSelectorService?.isPortableBackendActive()&&(this.initializePresenceRuntime(),De()),this.authService.addPreSignOutFuction("presence-signout",this.signOutUser.bind(this)),this.presenceUsers$.pipe(et()).subscribe(([S,V])=>{try{V?.length>=0&&this.analyticsService.updateDefaultProperties({presenceUsersCount:V?.length}),sessionStorage.getItem(v.SESSION_STORAGE.VELT_PRESENCE_MULTIPLE_USERS_ONLINE)||V?.length>1&&S.length!==V.length&&(sessionStorage.setItem(v.SESSION_STORAGE.VELT_PRESENCE_MULTIPLE_USERS_ONLINE,"true"),this.presenceActionsService?.onMultipleUsersOnline({users:V}))}catch(Sn){this.loggingService.catch("Error in presenceUsers$ pairwise subscription: ",Sn)}}),this.authService.getUser$().pipe(Y(S=>!!S),Ne(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(V){this.loggingService.catch("Error in presenceUser$ subscription: ",V)}},S=>{this.loggingService.catch("Error in presenceUser$ subscribe: ",S)}),this.customPresenceUsers$.subscribe(()=>{try{let S=this.presenceUsers$.value.filter(V=>!V.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:v.PRESENCE_STATUS_OFFLINE}),state:v.PRESENCE_STATUS_OFFLINE})}catch(V){this.loggingService.catch("Error in domService.onNetworkStatusChange$ subscription: ",V)}},S=>{this.loggingService.catch("Error in domService.onNetworkStatusChange$ subscribe: ",S)})}catch(De){this.loggingService.catch("Error in PresenceService constructor: ",De)}}initializePresenceRuntime(){try{if(this.presenceRuntimeInitialized)return;this.presenceRuntimeInitialized=!0,this.getUser(),this.getDocumentPaths(),this.getLocation(),this.updateOnUserDbConnectionStateChange().subscribe(()=>{},e=>{this.loggingService.catch("Error in PresenceService constructor updateOnUserDbConnectionStateChange: ",e)}),this.updateOnDatabaseDisconnect().subscribe(()=>{},e=>{this.loggingService.catch("Error in PresenceService constructor updateOnDatabaseDisconnect: ",e)}),this.updateOnDocumentFocusChange(),this.updateOnAllowedFeatureListChange()}catch(e){this.loggingService.catch("Error in initializePresenceRuntime: ",e)}}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(tt(2e3),H(()=>{this.presenceUser$.value&&e&&(this.setCurrentPresenceUserStatus(v.PRESENCE_STATUS_ONLINE),e=!1)}),Ze(this.inactivityTime),H(()=>{this.setCurrentPresenceUserStatus(v.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(tt(2e3),Ze(this.offlineInactivityTime),H(()=>{this.setCurrentPresenceUserStatus(v.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}),et(),H(([e,t])=>{e&&this.updateUserStatusOnDocumentChange(v.PRESENCE_STATUS_OFFLINE,e),t&&this.updateUserStatusOnDocumentChange(v.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;"),this.authService.getAuthState$().pipe(Y(t=>!!t),B(t=>this.isFeatureAllowed({firebaseUser:t,users:[],filteredUsers:[]})),B(t=>t.featureAllowed?this.iamService.isUserAllowed$().pipe(L(i=>(t.featureAllowed=i,t))):w(t)),B(t=>t.featureAllowed?this.authService.isPlanExpired$().pipe(L(i=>(t.featureAllowed=!i,t))):w(t)),B(t=>t.featureAllowed?w(t).pipe(B(i=>this.docService.getDocumentPaths$().pipe(L(a=>(this.documentPaths=a,i.documentPaths=a,i)))),B(i=>this.getDataFromDocumentId(e).pipe(L(a=>(i.users=a||[],C({},i))))),L(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)),B(i=>this.getIncludeSelf$().pipe(L(a=>(a||(i.filteredUsers=i?.filteredUsers?.filter(h=>h?.userSnippylyId!==i.user?.userSnippylyId)),i)))),B(i=>{let a=i?.filteredUsers||[];return this.customPresenceUsers$.pipe(L(()=>this.mergeWithCustomUsers(a)))})):w([])),qe(Lt))}isFeatureAllowed(e){return this.configService.getConfig$().pipe(Y(t=>!!t),L(t=>F(C({},e),{config:t})),B(t=>this.authService.getUser$().pipe(L(i=>F(C({},t),{user:i})))),B(t=>wt(t.config,t.user,X.PRESENCE)?w(F(C({},t),{featureAllowed:!0})):(this.loggingService.warn("Presence feature is not allowed."),w(F(C({},t),{featureAllowed:!1})))),qe((t,i)=>t?.featureAllowed===i?.featureAllowed))}getDataFromDocumentId(e){return Ae(()=>{if(this.adapterSelectorService?.isPortableBackendActive())return w(null);let t=new lt(i=>ct(()=>{this.adapterSelectorService?.isPortableBackendActive()&&i.next(null)}));return mt(this.databaseService.getDb().pipe(Y(i=>!!i)),t)}).pipe(B(t=>{if(t&&(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:[kt("timestamp"),Dt(i)]}}).pipe(gt(a=>(this.loggingService.catch("Error in PresenceService getDataFromDocumentId: ",a),w(null))),L(a=>a?.data),L(a=>{let h=[];if(a){let y=Object.values(a).filter(M=>typeof M=="object");for(let M of y)h.push(M)}return h}))}else return w([])}))}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===v.PRESENCE_STATUS_ONLINE||h.onlineStatus===v.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 at,e?.onlineStatus===v.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),Ne(1)).subscribe(y=>{y?.length>1&&this.analyticsService.trackEvent(P.Events.Presence.PRESENCE_USER_STATUS_CHANGED,{oldStatus:a,newStatus:h,totalUsers:y?.length,presenceSnippylyUserIds:y?.map(M=>M.userSnippylyId),presenceClientUserIds:y?.map(M=>M.userId)})})}i.onlineStatus=e,t&&(i.isTabAway=t?.isTabAway,i.isUserIdle=t?.isUserIdle),e===v.PRESENCE_STATUS_ONLINE&&(i.isTabAway=!1,i.isUserIdle=!1),e===v.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=Ae(()=>this.adapterSelectorService?.isPortableBackendActive()?w(v.PRESENCE_STATUS_ONLINE):this.realtimeAdapter.rtdbObjectVal$("presence",this.realtimeAdapter.rtdbRef(this.db,".info/connected")).pipe(L(t=>t?v.PRESENCE_STATUS_ONLINE:v.PRESENCE_STATUS_OFFLINE)));return Ae(()=>{let t=this.adapterSelectorService?.isPortableBackendActive()?0:1;return this.authService.getAuthState$().pipe(vt(t))}).pipe(B(t=>t?e:w(v.PRESENCE_STATUS_OFFLINE)),H(t=>this.setCurrentPresenceUserStatus(t)))}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(v.PRESENCE_STATUS_AWAY,{isTabAway:!0}),this.flockService.getFlockMode()&&this.flockService.setTabFocused(!1)):(this.setCurrentPresenceUserStatus(v.PRESENCE_STATUS_ONLINE),this.flockService.getFlockMode()&&this.flockService.setTabFocused(!0)))}),window&&(window.addEventListener("focus",()=>{this.authService.getUser()&&(this.setCurrentPresenceUserStatus(v.PRESENCE_STATUS_ONLINE),this.flockService.getFlockMode()&&this.flockService.setWindowFocused(!0))}),window.addEventListener("blur",()=>{this.authService.getUser()&&(document.visibilityState!=="hidden"&&this.setCurrentPresenceUserStatus(v.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!==v.PRESENCE_STATUS_ONLINE&&(t.onlineStatus=v.PRESENCE_STATUS_ONLINE,i=!0):t?.onlineStatus!==v.PRESENCE_STATUS_OFFLINE&&(t.onlineStatus=v.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;"),this.authService.getAuthState$().pipe(Y(e=>!!e),B(e=>this.docService.getDocumentPaths$().pipe(L(t=>e))),H(e=>oe(this,null,function*(){try{if(this.documentPaths?.presence&&e){let t;if(this.adapterSelectorService?.isPortableBackendActive())t=!!this.authService.getUser()?.isAnonymous;else{let i=yield this.authService.getIdTokenResultForUser(e,!0).catch(h=>null);if(!i)return;let{user:a}=i.claims;t=!!a?.isAnonymous}if(!t&&this.documentPaths?.presence){this.flockService.isInSession()&&this.flockService.removeCurrentUserFromSession();let i=`${this.documentPaths.presence}/${e.uid}`;this.commonDbService.setupOnDisconnect(i,{onlineStatus:v.PRESENCE_STATUS_OFFLINE,timestamp:this.timestamp},"presence").catch(a=>{this.loggingService.catch("Error in updateOnDatabaseDisconnect:",a)})}}}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:v.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(P.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(P.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(M=>M.userId===t.userId);if(y>=0){let M=[...h];M[y]=a,this.customPresenceUsers$.next(M)}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 st;return a.userId=e.userId,a.name=e.name||e.userId,a.email=e.email||"",a.photoUrl=e.photoUrl||"",a.onlineStatus=e.onlineStatus||v.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 at,a.isTabAway=!1,a.isUserIdle=!1,a.userSnippylyId=e.userSnippylyId||(i?Rt(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)(I(ge),I(Xt),I(We),I(ze),I(Ot),I(Zt),I(Jt),I(zt),I(Yt),I(p),I(K),I(Kt),I(Gt),I(Vt))},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 G=class{constructor(){this.shadowDom=!0,this.calculateUserAwayTime=()=>{}}};var rn=n=>({componentConfigSignal:n}),In=(n,r)=>({condition:n,data:r}),bn=(n,r,o,e,t)=>({template:n,context:r,componentName:"velt-presence-tooltip-avatar-wireframe",variant:o,setIfCondition:e,componentElementRef:t});function En(n,r){if(n&1&&(d(0),R(1,"snippyly-user-avatar",3),u()),n&2){let o=s(2).ngIf,e=s();l(),je("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 Pn(n,r){if(n&1&&(d(0),g(1,En,2,5,"ng-container",2),u()),n&2){let o=s().ngIf,e=s();l(),c("veltDynamicTemplate",k(3,bn,e.template,_(1,rn,e.componentConfigSignal),o==null?null:o.variant,e.setIfCondition.bind(e),e.elementRef))}}function xn(n,r){if(n&1&&(d(0),g(1,Pn,2,9,"ng-container",1),u()),n&2){let o=s();l(),c("veltIf",E(3,In,o.conditionSignal(),_(1,rn,o.componentConfigSignal)))}}var Se=(()=>{let r=class r extends ${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=v;try{super.initializeComponentConfigSignal(new G)}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(b),m(f),m(p))},r.\u0275cmp=x({type:r,selectors:[["velt-presence-tooltip-avatar-internal"]],standalone:!1,features:[j([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,xn,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 an=n=>({componentConfigSignal:n}),Tn=(n,r)=>({condition:n,data:r}),On=(n,r,o,e,t)=>({template:n,context:r,componentName:"velt-presence-tooltip-user-active-wireframe",variant:o,setIfCondition:e,componentElementRef:t});function kn(n,r){n&1&&(d(0),T(1,"p"),se(2),ce(3,"translate"),O(),u()),n&2&&(l(2),$e(le(3,1,"User online")))}function Dn(n,r){if(n&1&&(d(0),g(1,kn,4,3,"ng-container",2),u()),n&2){let o=s(2).ngIf,e=s();l(),c("veltDynamicTemplate",k(3,On,e.template,_(1,an,e.componentConfigSignal),o==null?null:o.variant,e.setIfCondition.bind(e),e.elementRef))}}function An(n,r){if(n&1&&(d(0),g(1,Dn,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 Nn(n,r){if(n&1&&(d(0),g(1,An,2,1,"ng-container",1),u()),n&2){let o=s();l(),c("veltIf",E(3,Tn,o.conditionSignal(),_(1,an,o.componentConfigSignal)))}}var Ce=(()=>{let r=class r extends ${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=v;try{super.initializeComponentConfigSignal(new G)}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(b),m(f),m(p))},r.\u0275cmp=x({type:r,selectors:[["velt-presence-tooltip-user-active-internal"]],standalone:!1,features:[j([f]),U],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"]],template:function(t,i){t&1&&g(0,Nn,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 sn=n=>({componentConfigSignal:n}),Fn=(n,r)=>({condition:n,data:r}),Rn=(n,r,o,e,t)=>({template:n,context:r,componentName:"velt-presence-tooltip-user-inactive-wireframe",variant:o,setIfCondition:e,componentElementRef:t});function Mn(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),It(" ",o.calculateUserAwayTime(o.presenceUser).toString()+" "+le(3,1,"mins ago.")," ")}}function Ln(n,r){if(n&1&&(d(0),g(1,Mn,4,3,"ng-container",2),u()),n&2){let o=s(2).ngIf,e=s();l(),c("veltDynamicTemplate",k(3,Rn,e.template,_(1,sn,e.componentConfigSignal),o==null?null:o.variant,e.setIfCondition.bind(e),e.elementRef))}}function jn(n,r){if(n&1&&(d(0),g(1,Ln,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 $n(n,r){if(n&1&&(d(0),g(1,jn,2,1,"ng-container",1),u()),n&2){let o=s();l(),c("veltIf",E(3,Fn,o.conditionSignal(),_(1,sn,o.componentConfigSignal)))}}var _e=(()=>{let r=class r extends ${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=v;try{super.initializeComponentConfigSignal(new G)}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(b),m(f),m(p))},r.\u0275cmp=x({type:r,selectors:[["velt-presence-tooltip-user-inactive-internal"]],standalone:!1,features:[j([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,$n,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 cn=n=>({componentConfigSignal:n}),Wn=(n,r)=>({condition:n,data:r}),zn=(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),$e(o.presenceUser!=null&&o.presenceUser.name?o.presenceUser==null?null:o.presenceUser.name:le(3,1,o.presenceUser==null?null:o.presenceUser.email))}}function Gn(n,r){n&1&&R(0,"velt-skeleton-loader-internal",5)}function Vn(n,r){if(n&1&&(d(0),g(1,Jn,4,3,"ng-container",4)(2,Gn,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 Yn(n,r){if(n&1&&(d(0),g(1,Vn,4,2,"ng-container",3),u()),n&2){let o=s().ngIf,e=s();l(),c("veltDynamicTemplate",k(3,zn,e.template,_(1,cn,e.componentConfigSignal),o==null?null:o.variant,e.setIfCondition.bind(e),e.elementRef))}}function Xn(n,r){if(n&1&&(d(0),g(1,Yn,2,9,"ng-container",2),u()),n&2){let o=s();l(),c("veltIf",E(3,Wn,o.conditionSignal(),_(1,cn,o.componentConfigSignal)))}}var ye=(()=>{let r=class r extends ${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 G)}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(b),m(f),m(p))},r.\u0275cmp=x({type:r,selectors:[["velt-presence-tooltip-user-name-internal"]],standalone:!1,features:[j([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,Xn,2,6,"ng-container",1),t&2&&c("ngIf",i.componentConfigSignal())},dependencies:[D,N,A,Ye,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 ln=n=>({componentConfigSignal:n}),Kn=(n,r)=>({condition:n,data:r}),Qn=(n,r,o,e,t)=>({template:n,context:r,componentName:"velt-presence-tooltip-status-container-wireframe",variant:o,setIfCondition:e,componentElementRef:t});function Zn(n,r){if(n&1&&(d(0),T(1,"div",3),R(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 qn(n,r){if(n&1&&(d(0),g(1,Zn,5,3,"ng-container",2),u()),n&2){let o=s().ngIf,e=s();l(),c("veltDynamicTemplate",k(3,Qn,e.template,_(1,ln,e.componentConfigSignal),o==null?null:o.variant,e.setIfCondition.bind(e),e.elementRef))}}function er(n,r){if(n&1&&(d(0),g(1,qn,2,9,"ng-container",1),u()),n&2){let o=s();l(),c("veltIf",E(3,Kn,o.conditionSignal(),_(1,ln,o.componentConfigSignal)))}}var Ie=(()=>{let r=class r extends ${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=v;try{super.initializeComponentConfigSignal(new G)}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(b),m(f),m(p))},r.\u0275cmp=x({type:r,selectors:[["velt-presence-tooltip-status-container-internal"]],standalone:!1,features:[j([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,er,2,6,"ng-container",0),t&2&&c("ngIf",i.componentConfigSignal())},dependencies:[D,N,A,Ce,_e,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-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 mn=(n,r)=>({componentConfigSignal:n,presenceUser:r}),ir=(n,r)=>({condition:n,data:r}),or=(n,r,o,e,t)=>({template:n,context:r,componentName:"velt-presence-tooltip-wireframe",variant:o,setIfCondition:e,componentElementRef:t});function ar(n,r){n&1&&Le(0)}function sr(n,r){if(n&1&&(T(0,"velt-shadow-dom-internal"),g(1,ar,1,0,"ng-container",4),O()),n&2){s();let o=te(3);l(),c("ngTemplateOutlet",o)}}function cr(n,r){if(n&1&&(d(0),T(1,"div",8),R(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 lr(n,r){if(n&1&&(T(0,"div",6),g(1,cr,4,2,"ng-container",7),O()),n&2){let o=s(3).ngIf,e=s();l(),c("veltDynamicTemplate",k(4,or,e.template,E(1,mn,e.componentConfigSignal,e.presenceUser),o==null?null:o.variant,e.setIfCondition.bind(e),e.elementRef))}}function mr(n,r){if(n&1&&g(0,lr,2,10,"div",5),n&2){let o=s(2).ngIf;c("ngIf",o==null?null:o.presenceUser)}}function gr(n,r){if(n&1&&(d(0),g(1,sr,2,1,"velt-shadow-dom-internal",3)(2,mr,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 vr(n,r){if(n&1&&(d(0),g(1,gr,4,2,"ng-container",2),u()),n&2){let o=s();l(),c("veltIf",E(4,ir,o.conditionSignal(),E(1,mn,o.componentConfigSignal,o.presenceUser)))}}var be=(()=>{let r=class r extends Ve{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=v,this.subscriptions=[],this.componentId="velt-presence-tooltip",this.componentConfigSignal=Re({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===v.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(b),m(Ge),m(f),m(p),m(Je))},r.\u0275cmp=x({type:r,selectors:[["velt-presence-tooltip"]],inputs:{presenceUser:"presenceUser",shadowDom:"shadowDom",variant:"variant"},standalone:!1,features:[U,Me],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,vr,2,7,"ng-container",1),t&2&&c("ngIf",i.componentConfigSignal())},dependencies:[D,Be,N,A,Se,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%]{--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 dr=["tooltipContent"],gn=(n,r,o)=>({componentConfigSignal:n,presenceUser:r,index:o}),ur=(n,r)=>({condition:n,data:r}),hr=(n,r,o,e,t)=>({template:n,context:r,componentName:"velt-presence-avatar-list-item-wireframe",variant:o,setIfCondition:e,componentElementRef:t});function fr(n,r){if(n&1){let o=nt();d(0),T(1,"snippyly-user-avatar",6),rt("click",function(){we(o);let t=s(3).ngIf,i=s();return Fe(t.onPresenceUserClick(i.presenceUser))}),R(2,"div",7),O(),u()}if(n&2){let o=s(4);l(),je("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(),yt("border-color",o.presenceUser.color)}}function Sr(n,r){if(n&1){let o=nt();T(0,"div",4),rt("pointerenter",function(t){we(o);let i=s(2).ngIf,a=s();return i.showTooltip(t,a.presenceUser),Fe(t.stopPropagation())})("pointerleave",function(t){return we(o),s(2).ngIf.closeTooltip(),Fe(t.stopPropagation())}),g(1,fr,3,7,"ng-container",5),O()}if(n&2){let o=s(2).ngIf,e=s();l(),c("veltDynamicTemplate",k(5,hr,e.template,it(1,gn,e.componentConfigSignal,e.presenceUser,e.index),o==null?null:o.variant,e.setIfCondition.bind(e),e.elementRef))}}function Cr(n,r){if(n&1&&R(0,"velt-presence-tooltip",8),n&2){let o=r.$implicit,e=s(2).ngIf;c("presenceUser",o)("shadowDom",e.shadowDom)}}function _r(n,r){if(n&1&&(d(0),g(1,Sr,2,11,"div",3)(2,Cr,1,2,"ng-template",null,0,ne),u()),n&2){let o=s().ngIf,e=s();l(),c("ngIf",e.index<o.maxUsers)}}function yr(n,r){if(n&1&&(d(0),g(1,_r,4,1,"ng-container",2),u()),n&2){let o=s();l(),c("veltIf",E(5,ur,o.conditionSignal(),it(1,gn,o.componentConfigSignal,o.presenceUser,o.index)))}}var Ee=(()=>{let r=class r extends ${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=v;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(b),m(f),m(p),m(We))},r.\u0275cmp=x({type:r,selectors:[["velt-presence-avatar-list-item-internal"]],viewQuery:function(t,i){if(t&1&&St(dr,5),t&2){let a;Ct(a=_t())&&(i.tooltipContent=a.first)}},inputs:{presenceUser:"presenceUser",index:"index",itemTemplate:"itemTemplate"},standalone:!1,features:[j([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,yr,2,8,"ng-container",1),t&2&&c("ngIf",i.componentConfigSignal())},dependencies:[D,N,A,re,be],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 vn=n=>({componentConfigSignal:n}),br=(n,r)=>({condition:n,data:r}),Er=(n,r,o,e,t)=>({template:n,context:r,componentName:"velt-presence-avatar-list-wireframe",variant:o,setIfCondition:e,componentElementRef:t,replaceTemplate:!1});function Pr(n,r){if(n&1&&(d(0),R(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 xr(n,r){if(n&1&&(d(0),g(1,Pr,2,4,"ng-container",3),u()),n&2){let o=s(2).ngIf;l(),c("ngForOf",o.filteredPresenceUsers)("ngForTrackBy",o.trackById)}}function Ur(n,r){if(n&1&&(d(0),g(1,xr,2,2,"ng-container",2),u()),n&2){let o=s().ngIf,e=s();l(),c("veltDynamicTemplate",k(3,Er,e.template,_(1,vn,e.componentConfigSignal),o==null?null:o.variant,e.setIfCondition.bind(e),e.elementRef))}}function Tr(n,r){if(n&1&&(d(0),g(1,Ur,2,9,"ng-container",1),u()),n&2){let o=s();l(),c("veltIf",E(3,br,o.conditionSignal(),_(1,vn,o.componentConfigSignal)))}}var Pe=(()=>{let r=class r extends ${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=v;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");Mt(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(b),m(f),m(p))},r.\u0275cmp=x({type:r,selectors:[["velt-presence-avatar-list-internal"]],standalone:!1,features:[j([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,Tr,2,6,"ng-container",0),t&2&&c("ngIf",i.componentConfigSignal())},dependencies:[bt,D,N,A,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%]{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 pn=n=>({componentConfigSignal:n}),kr=(n,r)=>({condition:n,data:r}),Dr=(n,r,o,e,t)=>({template:n,context:r,componentName:"velt-presence-avatar-remaining-count-wireframe",variant:o,setIfCondition:e,componentElementRef:t});function Ar(n,r){if(n&1&&(d(0),T(1,"snippyly-user-avatar",3),R(2,"div",4),O(),u()),n&2){let o=s(3).ngIf;l(),c("initial","+"+(o.filteredPresenceUsers.length-o.maxUsers).toString())}}function Nr(n,r){if(n&1&&(d(0),g(1,Ar,3,1,"ng-container",2),u()),n&2){let o=s(2).ngIf,e=s();l(),c("veltDynamicTemplate",k(3,Dr,e.template,_(1,pn,e.componentConfigSignal),o==null?null:o.variant,e.setIfCondition.bind(e),e.elementRef))}}function wr(n,r){if(n&1&&(d(0),g(1,Nr,2,9,"ng-container",0),u()),n&2){let o=s().ngIf;l(),c("ngIf",o.filteredPresenceUsers.length>o.maxUsers)}}function Fr(n,r){if(n&1&&(d(0),g(1,wr,2,1,"ng-container",1),u()),n&2){let o=s();l(),c("veltIf",E(3,kr,o.conditionSignal(),_(1,pn,o.componentConfigSignal)))}}var xe=(()=>{let r=class r extends ${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(b),m(f),m(p))},r.\u0275cmp=x({type:r,selectors:[["velt-presence-avatar-remaining-count-internal"]],standalone:!1,features:[j([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,Fr,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 dn=n=>({componentConfigSignal:n}),Mr=(n,r)=>({condition:n,data:r}),Lr=(n,r,o,e,t)=>({template:n,context:r,componentName:"velt-presence-wireframe",variant:o,setIfCondition:e,componentElementRef:t});function jr(n,r){n&1&&Le(0)}function $r(n,r){if(n&1&&(T(0,"velt-shadow-dom-internal"),g(1,jr,1,0,"ng-container",4),O()),n&2){s();let o=te(3);l(),c("ngTemplateOutlet",o)}}function Br(n,r){if(n&1&&(d(0),R(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 Wr(n,r){if(n&1&&(T(0,"div",6),g(1,Br,3,2,"ng-container",7),O()),n&2){let o=s(3).ngIf,e=s();l(),c("veltDynamicTemplate",k(3,Lr,e.template,_(1,dn,e.componentConfigSignal),o==null?null:o.variant,e.setIfCondition.bind(e),e.elementRef))}}function zr(n,r){if(n&1&&g(0,Wr,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,$r,2,1,"velt-shadow-dom-internal",3)(2,zr,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 Gr(n,r){if(n&1&&(d(0),g(1,Jr,4,2,"ng-container",2),u()),n&2){let o=s();l(),c("veltIf",E(3,Mr,o.conditionSignal(),_(1,dn,o.componentConfigSignal)))}}var pe=(()=>{let r=class r extends Ve{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=Ft(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,M,He,Ke,Te,Oe,ke){super(Te,Oe,void 0,void 0,void 0,ke,h),this.analyticsService=e,this.authService=t,this.flockService=i,this.presenceService=a,this.loggingService=h,this.wireframeService=y,this.overlay=M,this.overlayPositionBuilder=He,this.viewContainerRef=Ke,this.elementRef=Te,this.themeService=Oe,this.dynamicDataService=ke,this.DEFAULT_MAX_USERS=5,this._maxUsers=this.DEFAULT_MAX_USERS,this._inactivityTime=5,this._offlineInactivityTime=10,this._flockMode=!1,this.onNavigate=new fe,this.isExplicitShadowDom=!1,this.onPresenceUserClickEmitter=new fe,this.presenceUsers=[],this.subscriptions=[],this.constants=v,this.onUsersChanged=new fe,this.onPresenceUserChange=new fe,this.componentConfigSignal=Re({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(de=>{this.componentConfigSignal.update(ue=>(ue=F(C({},ue),{user:de}),ue)),this.componentConfigSignal().user&&(this.setPresenceInstalledInAnalytics(),this.presenceSetCustomMaxUsersInAnalytics())},de=>{this.loggingService.catch("Error in PresenceComponent getUser$ subscription: ",de)}))}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 b(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 Pt(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===v.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(P.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(P.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(ze),m(K),m(W),m(p),m(Je),m(Ut),m(xt),m(dt),m(b),m(Ge),m(f))},r.\u0275cmp=x({type:r,selectors:[["app-presence"]],hostVars:1,hostBindings:function(t,i){t&2&&ft("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,Me],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,Gr,2,6,"ng-container",1),t&2&&c("ngIf",i.componentConfigSignal())},dependencies:[D,Be,N,A,Pe,xe],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 Ue=(()=>{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(ot.MULTIPLE_USERS_ONLINE,e),this.analyticsService.trackEvent(P.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(ot.USER_STATE_CHANGE,e),this.analyticsService.trackEvent(P.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(L(t=>({data:t})))}catch(t){return this.loggingService.catch("Error in PresenceActionsService getData: ",t),w({data:null})}}triggerAction(e,t){try{this.actionSubjects.has(e)||this.actionSubjects.set(e,new Qe),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 Qe),this.actionSubjects.get(e)?.asObservable()}catch(t){return this.loggingService.catch("Error in PresenceActionsService onAction: ",t),w(null)}}};r.\u0275fac=function(t){return new(t||r)(I(ge),I(p),I(W))},r.\u0275prov=ae({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();var Xe=class extends qt{constructor(r){super(r),this.getService(p).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(p).log("%c[WB] Calling FUNCTION: getOnlineUsers","color: green;");try{return this.trackEvent(P.Events.Presence.GET_ONLINE_USERS_ON_CURRENT_DOCUMENT_TRIGGERED),this.getService(W).getOnlineUsersOnCurrentDocument()}catch(r){return this.getService(p).catch("Error in _getOnlineUsersOnCurrentDocument: ",r),w(null)}}_setInactivityTime(r){this.getService(p).log("%c[WB] Calling FUNCTION: _setInactivityTime","color: green;");try{this.trackEvent(P.Events.Presence.SET_INACTIVITY_TIME_TRIGGERED,{payload:{time:r}}),isNaN(r)?this.getService(p).catch("Error in setInactivityTime: ","Provided value is not a number."):this.getService(W).setInactivityTime(r)}catch(o){this.getService(p).catch("Error in setInactivityTime: ",o)}}_disableFlockMode(){try{this.trackEvent(P.Events.Presence.DISABLE_FLOCK_MODE_TRIGGERED),this.getService(K).disableFlockMode()}catch(r){this.getService(p).catch("Error in _disableFlockMode: ",r)}}_enableFlockMode(r){try{this.trackEvent(P.Events.Presence.ENABLE_FLOCK_MODE_TRIGGERED,{payload:{options:r}}),this.getService(K).enableFlockMode(r)}catch(o){this.getService(p).catch("Error in _enableFlockMode: ",o)}}_stopFollowingUser(){try{this.trackEvent(P.Events.Presence.STOP_FOLLOWING_USER_TRIGGERED),this.getService(K).stopFollowingUser()}catch(r){this.getService(p).catch("Error in _stopFollowingUser: ",r)}}_startFollowingUser(r){try{this.trackEvent(P.Events.Presence.START_FOLLOWING_USER_TRIGGERED,{payload:{externalId:r}});let o=this.getService(W).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(p).catch("Error in _startFollowingUser: ",o),{success:!1,msg:"Unknown error.",raw:o}}}_enableSelf(){try{this.trackEvent(P.Events.Presence.ENABLE_SELF_TRIGGERED),this.getService(W).enableIncludeSelf()}catch(r){this.getService(p).catch("Error in _enableSelf: ",r)}}_disableSelf(){try{this.trackEvent(P.Events.Presence.DISABLE_SELF_TRIGGERED),this.getService(W).disableIncludeSelf()}catch(r){this.getService(p).catch("Error in _disableSelf: ",r)}}_getData(r){this.getService(p).log("%c[WB] Calling FUNCTION: getData","color: green;");try{return this.trackEvent(P.Events.Presence.GET_PRESENCE_DATA_TRIGGERED,{payload:{query:r}}),r&&typeof r=="object"&&(r=C({},r),r?.documentId&&(r.documentId=At(r.documentId)),r?.organizationId&&(r.organizationId=Nt(r.organizationId))),this.getService(Ue).getData(r)}catch(o){return this.getService(p).catch("Error in _getData: ",o),w({data:null})}}_on(r){this.getService(p).log("%c[WB] Calling FUNCTION: on","color: green;");try{return this.getService(Ue).onAction(r)}catch(o){return this.getService(p).catch("Error in _on: ",o),w(null)}}_addUser(r){this.getService(p).log("%c[WB] Calling FUNCTION: addUser","color: green;");try{if(this.trackEvent(P.Events.Presence.ADD_USER_TRIGGERED,{payload:{userId:r?.user?.userId,localOnly:r?.localOnly}}),!r?.user?.userId){this.getService(p).catch("Error in addUser: ","userId is required");return}this.getService(W).addCustomUser(r)}catch(o){this.getService(p).catch("Error in addUser: ",o)}}_removeUser(r){this.getService(p).log("%c[WB] Calling FUNCTION: removeUser","color: green;");try{if(this.trackEvent(P.Events.Presence.REMOVE_USER_TRIGGERED,{payload:{userId:r?.user?.userId,localOnly:r?.localOnly}}),!r?.user?.userId){this.getService(p).catch("Error in removeUser: ","userId is required");return}this.getService(W).removeCustomUser(r)}catch(o){this.getService(p).catch("Error in removeUser: ",o)}}};var un=(()=>{let r=class r{};r.\u0275fac=function(t){return new(t||r)},r.\u0275mod=ht({type:r}),r.\u0275inj=pt({imports:[Et,re,Ye]});let n=r;return n})();var hn=(()=>{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)(I(p),I(Ht))},r.\u0275prov=ae({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();var Vr={"velt-presence-wireframe":pe,"velt-presence-avatar-list-wireframe":Pe,"velt-presence-avatar-list-item-wireframe":Ee,"velt-presence-avatar-remaining-count-wireframe":xe,"velt-presence-tooltip-wireframe":be,"velt-presence-tooltip-avatar-wireframe":Se,"velt-presence-tooltip-user-active-wireframe":Ce,"velt-presence-tooltip-user-inactive-wireframe":_e,"velt-presence-tooltip-user-name-wireframe":ye,"velt-presence-tooltip-status-container-wireframe":Ie};Object.assign(Qt,Vr);function Yr(n){n.get(p).log("%c[WB] Loading presence feature chunk","color: blue;");let o=n.get(Wt);o.set(jt,n.get(W)),o.set($t,n.get(Ue)),o.set(Bt,n.get(hn));let t=ut(un,n).injector;return fn(t,v.TAGS.VELT_PRESENCE,pe),fn(t,v.TAGS.SNIPPYLY_PRESENCE,pe),new Xe(n)}function fn(n,r,o){if(customElements.get(r))return;let e=Tt(o,{injector:n});customElements.define(r,e)}export{Yr as default};
|
|
1
|
+
import{a as K}from"./chunk-77FADRSO.js";import"./chunk-WMDZMDJS.js";import{D as Qt,F as A,G as N}from"./chunk-O3FUWWWQ.js";import{a as Je}from"./chunk-YO4HNOAN.js";import{b as ve,c as Ye,d as re}from"./chunk-GULBDPIM.js";import{a as Zt}from"./chunk-3AL5S762.js";import{a as Tt}from"./chunk-L4QMAEKA.js";import{D as xt,F as Ut,Ga as f,Ha as Ge,Ia as $,Ja as Ve,s as Pt}from"./chunk-I63T4QWP.js";import{a as qt}from"./chunk-2HGCWC7B.js";import{e as Xt,l as Ht,t as Kt}from"./chunk-MRY4A7N6.js";import{$f as Nt,Af as st,Bb as s,Cg as Ft,D as mt,E as Y,Fb as St,G as gt,Gb as Ct,Gd as Ot,Ha as l,Hb as _t,Hc as bt,He as v,Ia as fe,Ic as D,J as Ze,K as Ne,Kb as te,Lb as yt,M as qe,Mb as je,Nc as Be,O as et,Od as kt,Og as Rt,Pb as se,Pd as Dt,Qb as $e,Qh as Mt,Ra as m,Rb as It,Rc as Et,Ri as Wt,S as vt,Se as at,Si as ge,Ta as dt,Ti as p,Uh as Lt,Ui as zt,V as B,Va as ut,Wa as x,Xa as ht,Y as H,Z as tt,Zf as At,_a as U,a as C,ab as g,ac as j,b as F,ba as ae,ca as pt,dc as _,ea as I,ec as E,fb as ft,fc as it,g as oe,ge as ot,hc as k,i as lt,ja as we,ji as P,jj as Jt,k as Qe,ka as Fe,l as he,mc as ce,mj as Gt,nb as c,nc as le,nj as ct,ob as T,pb as O,qb as R,qg as wt,r as w,rc as ne,re as X,ri as jt,rj as Vt,sa as Re,sg as me,si as $t,ti as Bt,tj as Yt,ub as d,v as L,vb as u,wa as Me,wb as Le,wj as We,x as Ae,xb as nt,xj as ze,ya as b,zb as rt}from"./chunk-YFBAHLK6.js";var W=(()=>{let r=class r{constructor(e,t,i,a,h,y,M,He,Ke,Te,Oe,ke,de,ue){this.analyticsService=e,this.docService=t,this.domService=i,this.authService=a,this.afAuth=h,this.iamService=y,this.databaseService=M,this.configService=He,this.avatarService=Ke,this.loggingService=Te,this.flockService=Oe,this.commonDbService=ke,this.realtimeAdapter=de,this.adapterSelectorService=ue,this.db=null,this.presenceUser$=new he(new st),this.documentPaths=null,this.inactivityTime=300*1e3,this.offlineInactivityTime=600*1e3,this.presenceUsers$=new he([]),this.presenceUsersSubscription=null,this.includeSelf$=new he(!0),this.customPresenceUsers$=new he([]),this.userIdleStateDetectionSubscription=null,this.userOfflineStateDetectionSubscription=null,this.presenceRuntimeInitialized=!1;try{this.loggingService.log("%c[WB] Creating CLASS: PresenceService","color: blue;"),this.databaseService.getDb().pipe(Y(S=>!!S),Ne(1)).subscribe(S=>{S&&(this.db=S,this.initializePresenceRuntime())},S=>{this.loggingService.catch("Error in PresenceService constructor: ",S)});let De=ct(()=>{this.adapterSelectorService?.isPortableBackendActive()&&(this.initializePresenceRuntime(),De())});this.adapterSelectorService?.isPortableBackendActive()&&(this.initializePresenceRuntime(),De()),this.authService.addPreSignOutFuction("presence-signout",this.signOutUser.bind(this)),this.presenceUsers$.pipe(et()).subscribe(([S,V])=>{try{V?.length>=0&&this.analyticsService.updateDefaultProperties({presenceUsersCount:V?.length}),sessionStorage.getItem(v.SESSION_STORAGE.VELT_PRESENCE_MULTIPLE_USERS_ONLINE)||V?.length>1&&S.length!==V.length&&(sessionStorage.setItem(v.SESSION_STORAGE.VELT_PRESENCE_MULTIPLE_USERS_ONLINE,"true"),this.presenceActionsService?.onMultipleUsersOnline({users:V}))}catch(Sn){this.loggingService.catch("Error in presenceUsers$ pairwise subscription: ",Sn)}}),this.authService.getUser$().pipe(Y(S=>!!S),Ne(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(V){this.loggingService.catch("Error in presenceUser$ subscription: ",V)}},S=>{this.loggingService.catch("Error in presenceUser$ subscribe: ",S)}),this.customPresenceUsers$.subscribe(()=>{try{let S=this.presenceUsers$.value.filter(V=>!V.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:v.PRESENCE_STATUS_OFFLINE}),state:v.PRESENCE_STATUS_OFFLINE})}catch(V){this.loggingService.catch("Error in domService.onNetworkStatusChange$ subscription: ",V)}},S=>{this.loggingService.catch("Error in domService.onNetworkStatusChange$ subscribe: ",S)})}catch(De){this.loggingService.catch("Error in PresenceService constructor: ",De)}}initializePresenceRuntime(){try{if(this.presenceRuntimeInitialized)return;this.presenceRuntimeInitialized=!0,this.getUser(),this.getDocumentPaths(),this.getLocation(),this.updateOnUserDbConnectionStateChange().subscribe(()=>{},e=>{this.loggingService.catch("Error in PresenceService constructor updateOnUserDbConnectionStateChange: ",e)}),this.updateOnDatabaseDisconnect().subscribe(()=>{},e=>{this.loggingService.catch("Error in PresenceService constructor updateOnDatabaseDisconnect: ",e)}),this.updateOnDocumentFocusChange(),this.updateOnAllowedFeatureListChange()}catch(e){this.loggingService.catch("Error in initializePresenceRuntime: ",e)}}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(tt(2e3),H(()=>{this.presenceUser$.value&&e&&(this.setCurrentPresenceUserStatus(v.PRESENCE_STATUS_ONLINE),e=!1)}),Ze(this.inactivityTime),H(()=>{this.setCurrentPresenceUserStatus(v.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(tt(2e3),Ze(this.offlineInactivityTime),H(()=>{this.setCurrentPresenceUserStatus(v.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}),et(),H(([e,t])=>{e&&this.updateUserStatusOnDocumentChange(v.PRESENCE_STATUS_OFFLINE,e),t&&this.updateUserStatusOnDocumentChange(v.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;"),this.authService.getAuthState$().pipe(Y(t=>!!t),B(t=>this.isFeatureAllowed({firebaseUser:t,users:[],filteredUsers:[]})),B(t=>t.featureAllowed?this.iamService.isUserAllowed$().pipe(L(i=>(t.featureAllowed=i,t))):w(t)),B(t=>t.featureAllowed?this.authService.isPlanExpired$().pipe(L(i=>(t.featureAllowed=!i,t))):w(t)),B(t=>t.featureAllowed?w(t).pipe(B(i=>this.docService.getDocumentPaths$().pipe(L(a=>(this.documentPaths=a,i.documentPaths=a,i)))),B(i=>this.getDataFromDocumentId(e).pipe(L(a=>(i.users=a||[],C({},i))))),L(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)),B(i=>this.getIncludeSelf$().pipe(L(a=>(a||(i.filteredUsers=i?.filteredUsers?.filter(h=>h?.userSnippylyId!==i.user?.userSnippylyId)),i)))),B(i=>{let a=i?.filteredUsers||[];return this.customPresenceUsers$.pipe(L(()=>this.mergeWithCustomUsers(a)))})):w([])),qe(Lt))}isFeatureAllowed(e){return this.configService.getConfig$().pipe(Y(t=>!!t),L(t=>F(C({},e),{config:t})),B(t=>this.authService.getUser$().pipe(L(i=>F(C({},t),{user:i})))),B(t=>wt(t.config,t.user,X.PRESENCE)?w(F(C({},t),{featureAllowed:!0})):(this.loggingService.warn("Presence feature is not allowed."),w(F(C({},t),{featureAllowed:!1})))),qe((t,i)=>t?.featureAllowed===i?.featureAllowed))}getDataFromDocumentId(e){return Ae(()=>{if(this.adapterSelectorService?.isPortableBackendActive())return w(null);let t=new lt(i=>ct(()=>{this.adapterSelectorService?.isPortableBackendActive()&&i.next(null)}));return mt(this.databaseService.getDb().pipe(Y(i=>!!i)),t)}).pipe(B(t=>{if(t&&(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:[kt("timestamp"),Dt(i)]}}).pipe(gt(a=>(this.loggingService.catch("Error in PresenceService getDataFromDocumentId: ",a),w(null))),L(a=>a?.data),L(a=>{let h=[];if(a){let y=Object.values(a).filter(M=>typeof M=="object");for(let M of y)h.push(M)}return h}))}else return w([])}))}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===v.PRESENCE_STATUS_ONLINE||h.onlineStatus===v.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 at,e?.onlineStatus===v.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),Ne(1)).subscribe(y=>{y?.length>1&&this.analyticsService.trackEvent(P.Events.Presence.PRESENCE_USER_STATUS_CHANGED,{oldStatus:a,newStatus:h,totalUsers:y?.length,presenceSnippylyUserIds:y?.map(M=>M.userSnippylyId),presenceClientUserIds:y?.map(M=>M.userId)})})}i.onlineStatus=e,t&&(i.isTabAway=t?.isTabAway,i.isUserIdle=t?.isUserIdle),e===v.PRESENCE_STATUS_ONLINE&&(i.isTabAway=!1,i.isUserIdle=!1),e===v.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=Ae(()=>this.adapterSelectorService?.isPortableBackendActive()?w(v.PRESENCE_STATUS_ONLINE):this.realtimeAdapter.rtdbObjectVal$("presence",this.realtimeAdapter.rtdbRef(this.db,".info/connected")).pipe(L(t=>t?v.PRESENCE_STATUS_ONLINE:v.PRESENCE_STATUS_OFFLINE)));return Ae(()=>{let t=this.adapterSelectorService?.isPortableBackendActive()?0:1;return this.authService.getAuthState$().pipe(vt(t))}).pipe(B(t=>t?e:w(v.PRESENCE_STATUS_OFFLINE)),H(t=>this.setCurrentPresenceUserStatus(t)))}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(v.PRESENCE_STATUS_AWAY,{isTabAway:!0}),this.flockService.getFlockMode()&&this.flockService.setTabFocused(!1)):(this.setCurrentPresenceUserStatus(v.PRESENCE_STATUS_ONLINE),this.flockService.getFlockMode()&&this.flockService.setTabFocused(!0)))}),window&&(window.addEventListener("focus",()=>{this.authService.getUser()&&(this.setCurrentPresenceUserStatus(v.PRESENCE_STATUS_ONLINE),this.flockService.getFlockMode()&&this.flockService.setWindowFocused(!0))}),window.addEventListener("blur",()=>{this.authService.getUser()&&(document.visibilityState!=="hidden"&&this.setCurrentPresenceUserStatus(v.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!==v.PRESENCE_STATUS_ONLINE&&(t.onlineStatus=v.PRESENCE_STATUS_ONLINE,i=!0):t?.onlineStatus!==v.PRESENCE_STATUS_OFFLINE&&(t.onlineStatus=v.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;"),this.authService.getAuthState$().pipe(Y(e=>!!e),B(e=>this.docService.getDocumentPaths$().pipe(L(t=>e))),H(e=>oe(this,null,function*(){try{if(this.documentPaths?.presence&&e){let t;if(this.adapterSelectorService?.isPortableBackendActive())t=!!this.authService.getUser()?.isAnonymous;else{let i=yield this.authService.getIdTokenResultForUser(e,!0).catch(h=>null);if(!i)return;let{user:a}=i.claims;t=!!a?.isAnonymous}if(!t&&this.documentPaths?.presence){this.flockService.isInSession()&&this.flockService.removeCurrentUserFromSession();let i=`${this.documentPaths.presence}/${e.uid}`;this.commonDbService.setupOnDisconnect(i,{onlineStatus:v.PRESENCE_STATUS_OFFLINE,timestamp:this.timestamp},"presence").catch(a=>{this.loggingService.catch("Error in updateOnDatabaseDisconnect:",a)})}}}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:v.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(P.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(P.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(M=>M.userId===t.userId);if(y>=0){let M=[...h];M[y]=a,this.customPresenceUsers$.next(M)}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 st;return a.userId=e.userId,a.name=e.name||e.userId,a.email=e.email||"",a.photoUrl=e.photoUrl||"",a.onlineStatus=e.onlineStatus||v.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 at,a.isTabAway=!1,a.isUserIdle=!1,a.userSnippylyId=e.userSnippylyId||(i?Rt(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)(I(ge),I(Xt),I(We),I(ze),I(Ot),I(Zt),I(Jt),I(zt),I(Yt),I(p),I(K),I(Kt),I(Gt),I(Vt))},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 G=class{constructor(){this.shadowDom=!0,this.calculateUserAwayTime=()=>{}}};var rn=n=>({componentConfigSignal:n}),In=(n,r)=>({condition:n,data:r}),bn=(n,r,o,e,t)=>({template:n,context:r,componentName:"velt-presence-tooltip-avatar-wireframe",variant:o,setIfCondition:e,componentElementRef:t});function En(n,r){if(n&1&&(d(0),R(1,"snippyly-user-avatar",3),u()),n&2){let o=s(2).ngIf,e=s();l(),je("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 Pn(n,r){if(n&1&&(d(0),g(1,En,2,5,"ng-container",2),u()),n&2){let o=s().ngIf,e=s();l(),c("veltDynamicTemplate",k(3,bn,e.template,_(1,rn,e.componentConfigSignal),o==null?null:o.variant,e.setIfCondition.bind(e),e.elementRef))}}function xn(n,r){if(n&1&&(d(0),g(1,Pn,2,9,"ng-container",1),u()),n&2){let o=s();l(),c("veltIf",E(3,In,o.conditionSignal(),_(1,rn,o.componentConfigSignal)))}}var Se=(()=>{let r=class r extends ${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=v;try{super.initializeComponentConfigSignal(new G)}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(b),m(f),m(p))},r.\u0275cmp=x({type:r,selectors:[["velt-presence-tooltip-avatar-internal"]],standalone:!1,features:[j([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,xn,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 an=n=>({componentConfigSignal:n}),Tn=(n,r)=>({condition:n,data:r}),On=(n,r,o,e,t)=>({template:n,context:r,componentName:"velt-presence-tooltip-user-active-wireframe",variant:o,setIfCondition:e,componentElementRef:t});function kn(n,r){n&1&&(d(0),T(1,"p"),se(2),ce(3,"translate"),O(),u()),n&2&&(l(2),$e(le(3,1,"User online")))}function Dn(n,r){if(n&1&&(d(0),g(1,kn,4,3,"ng-container",2),u()),n&2){let o=s(2).ngIf,e=s();l(),c("veltDynamicTemplate",k(3,On,e.template,_(1,an,e.componentConfigSignal),o==null?null:o.variant,e.setIfCondition.bind(e),e.elementRef))}}function An(n,r){if(n&1&&(d(0),g(1,Dn,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 Nn(n,r){if(n&1&&(d(0),g(1,An,2,1,"ng-container",1),u()),n&2){let o=s();l(),c("veltIf",E(3,Tn,o.conditionSignal(),_(1,an,o.componentConfigSignal)))}}var Ce=(()=>{let r=class r extends ${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=v;try{super.initializeComponentConfigSignal(new G)}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(b),m(f),m(p))},r.\u0275cmp=x({type:r,selectors:[["velt-presence-tooltip-user-active-internal"]],standalone:!1,features:[j([f]),U],decls:1,vars:1,consts:[[4,"ngIf"],[4,"veltIf"],[4,"veltDynamicTemplate"]],template:function(t,i){t&1&&g(0,Nn,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 sn=n=>({componentConfigSignal:n}),Fn=(n,r)=>({condition:n,data:r}),Rn=(n,r,o,e,t)=>({template:n,context:r,componentName:"velt-presence-tooltip-user-inactive-wireframe",variant:o,setIfCondition:e,componentElementRef:t});function Mn(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),It(" ",o.calculateUserAwayTime(o.presenceUser).toString()+" "+le(3,1,"mins ago.")," ")}}function Ln(n,r){if(n&1&&(d(0),g(1,Mn,4,3,"ng-container",2),u()),n&2){let o=s(2).ngIf,e=s();l(),c("veltDynamicTemplate",k(3,Rn,e.template,_(1,sn,e.componentConfigSignal),o==null?null:o.variant,e.setIfCondition.bind(e),e.elementRef))}}function jn(n,r){if(n&1&&(d(0),g(1,Ln,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 $n(n,r){if(n&1&&(d(0),g(1,jn,2,1,"ng-container",1),u()),n&2){let o=s();l(),c("veltIf",E(3,Fn,o.conditionSignal(),_(1,sn,o.componentConfigSignal)))}}var _e=(()=>{let r=class r extends ${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=v;try{super.initializeComponentConfigSignal(new G)}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(b),m(f),m(p))},r.\u0275cmp=x({type:r,selectors:[["velt-presence-tooltip-user-inactive-internal"]],standalone:!1,features:[j([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,$n,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 cn=n=>({componentConfigSignal:n}),Wn=(n,r)=>({condition:n,data:r}),zn=(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),$e(o.presenceUser!=null&&o.presenceUser.name?o.presenceUser==null?null:o.presenceUser.name:le(3,1,o.presenceUser==null?null:o.presenceUser.email))}}function Gn(n,r){n&1&&R(0,"velt-skeleton-loader-internal",5)}function Vn(n,r){if(n&1&&(d(0),g(1,Jn,4,3,"ng-container",4)(2,Gn,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 Yn(n,r){if(n&1&&(d(0),g(1,Vn,4,2,"ng-container",3),u()),n&2){let o=s().ngIf,e=s();l(),c("veltDynamicTemplate",k(3,zn,e.template,_(1,cn,e.componentConfigSignal),o==null?null:o.variant,e.setIfCondition.bind(e),e.elementRef))}}function Xn(n,r){if(n&1&&(d(0),g(1,Yn,2,9,"ng-container",2),u()),n&2){let o=s();l(),c("veltIf",E(3,Wn,o.conditionSignal(),_(1,cn,o.componentConfigSignal)))}}var ye=(()=>{let r=class r extends ${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 G)}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(b),m(f),m(p))},r.\u0275cmp=x({type:r,selectors:[["velt-presence-tooltip-user-name-internal"]],standalone:!1,features:[j([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,Xn,2,6,"ng-container",1),t&2&&c("ngIf",i.componentConfigSignal())},dependencies:[D,N,A,Ye,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 ln=n=>({componentConfigSignal:n}),Kn=(n,r)=>({condition:n,data:r}),Qn=(n,r,o,e,t)=>({template:n,context:r,componentName:"velt-presence-tooltip-status-container-wireframe",variant:o,setIfCondition:e,componentElementRef:t});function Zn(n,r){if(n&1&&(d(0),T(1,"div",3),R(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 qn(n,r){if(n&1&&(d(0),g(1,Zn,5,3,"ng-container",2),u()),n&2){let o=s().ngIf,e=s();l(),c("veltDynamicTemplate",k(3,Qn,e.template,_(1,ln,e.componentConfigSignal),o==null?null:o.variant,e.setIfCondition.bind(e),e.elementRef))}}function er(n,r){if(n&1&&(d(0),g(1,qn,2,9,"ng-container",1),u()),n&2){let o=s();l(),c("veltIf",E(3,Kn,o.conditionSignal(),_(1,ln,o.componentConfigSignal)))}}var Ie=(()=>{let r=class r extends ${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=v;try{super.initializeComponentConfigSignal(new G)}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(b),m(f),m(p))},r.\u0275cmp=x({type:r,selectors:[["velt-presence-tooltip-status-container-internal"]],standalone:!1,features:[j([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,er,2,6,"ng-container",0),t&2&&c("ngIf",i.componentConfigSignal())},dependencies:[D,N,A,Ce,_e,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-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 mn=(n,r)=>({componentConfigSignal:n,presenceUser:r}),ir=(n,r)=>({condition:n,data:r}),or=(n,r,o,e,t)=>({template:n,context:r,componentName:"velt-presence-tooltip-wireframe",variant:o,setIfCondition:e,componentElementRef:t});function ar(n,r){n&1&&Le(0)}function sr(n,r){if(n&1&&(T(0,"velt-shadow-dom-internal"),g(1,ar,1,0,"ng-container",4),O()),n&2){s();let o=te(3);l(),c("ngTemplateOutlet",o)}}function cr(n,r){if(n&1&&(d(0),T(1,"div",8),R(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 lr(n,r){if(n&1&&(T(0,"div",6),g(1,cr,4,2,"ng-container",7),O()),n&2){let o=s(3).ngIf,e=s();l(),c("veltDynamicTemplate",k(4,or,e.template,E(1,mn,e.componentConfigSignal,e.presenceUser),o==null?null:o.variant,e.setIfCondition.bind(e),e.elementRef))}}function mr(n,r){if(n&1&&g(0,lr,2,10,"div",5),n&2){let o=s(2).ngIf;c("ngIf",o==null?null:o.presenceUser)}}function gr(n,r){if(n&1&&(d(0),g(1,sr,2,1,"velt-shadow-dom-internal",3)(2,mr,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 vr(n,r){if(n&1&&(d(0),g(1,gr,4,2,"ng-container",2),u()),n&2){let o=s();l(),c("veltIf",E(4,ir,o.conditionSignal(),E(1,mn,o.componentConfigSignal,o.presenceUser)))}}var be=(()=>{let r=class r extends Ve{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=v,this.subscriptions=[],this.componentId="velt-presence-tooltip",this.componentConfigSignal=Re({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===v.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(b),m(Ge),m(f),m(p),m(Je))},r.\u0275cmp=x({type:r,selectors:[["velt-presence-tooltip"]],inputs:{presenceUser:"presenceUser",shadowDom:"shadowDom",variant:"variant"},standalone:!1,features:[U,Me],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,vr,2,7,"ng-container",1),t&2&&c("ngIf",i.componentConfigSignal())},dependencies:[D,Be,N,A,Se,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%]{--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 dr=["tooltipContent"],gn=(n,r,o)=>({componentConfigSignal:n,presenceUser:r,index:o}),ur=(n,r)=>({condition:n,data:r}),hr=(n,r,o,e,t)=>({template:n,context:r,componentName:"velt-presence-avatar-list-item-wireframe",variant:o,setIfCondition:e,componentElementRef:t});function fr(n,r){if(n&1){let o=nt();d(0),T(1,"snippyly-user-avatar",6),rt("click",function(){we(o);let t=s(3).ngIf,i=s();return Fe(t.onPresenceUserClick(i.presenceUser))}),R(2,"div",7),O(),u()}if(n&2){let o=s(4);l(),je("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(),yt("border-color",o.presenceUser.color)}}function Sr(n,r){if(n&1){let o=nt();T(0,"div",4),rt("pointerenter",function(t){we(o);let i=s(2).ngIf,a=s();return i.showTooltip(t,a.presenceUser),Fe(t.stopPropagation())})("pointerleave",function(t){return we(o),s(2).ngIf.closeTooltip(),Fe(t.stopPropagation())}),g(1,fr,3,7,"ng-container",5),O()}if(n&2){let o=s(2).ngIf,e=s();l(),c("veltDynamicTemplate",k(5,hr,e.template,it(1,gn,e.componentConfigSignal,e.presenceUser,e.index),o==null?null:o.variant,e.setIfCondition.bind(e),e.elementRef))}}function Cr(n,r){if(n&1&&R(0,"velt-presence-tooltip",8),n&2){let o=r.$implicit,e=s(2).ngIf;c("presenceUser",o)("shadowDom",e.shadowDom)}}function _r(n,r){if(n&1&&(d(0),g(1,Sr,2,11,"div",3)(2,Cr,1,2,"ng-template",null,0,ne),u()),n&2){let o=s().ngIf,e=s();l(),c("ngIf",e.index<o.maxUsers)}}function yr(n,r){if(n&1&&(d(0),g(1,_r,4,1,"ng-container",2),u()),n&2){let o=s();l(),c("veltIf",E(5,ur,o.conditionSignal(),it(1,gn,o.componentConfigSignal,o.presenceUser,o.index)))}}var Ee=(()=>{let r=class r extends ${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=v;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(b),m(f),m(p),m(We))},r.\u0275cmp=x({type:r,selectors:[["velt-presence-avatar-list-item-internal"]],viewQuery:function(t,i){if(t&1&&St(dr,5),t&2){let a;Ct(a=_t())&&(i.tooltipContent=a.first)}},inputs:{presenceUser:"presenceUser",index:"index",itemTemplate:"itemTemplate"},standalone:!1,features:[j([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,yr,2,8,"ng-container",1),t&2&&c("ngIf",i.componentConfigSignal())},dependencies:[D,N,A,re,be],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 vn=n=>({componentConfigSignal:n}),br=(n,r)=>({condition:n,data:r}),Er=(n,r,o,e,t)=>({template:n,context:r,componentName:"velt-presence-avatar-list-wireframe",variant:o,setIfCondition:e,componentElementRef:t,replaceTemplate:!1});function Pr(n,r){if(n&1&&(d(0),R(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 xr(n,r){if(n&1&&(d(0),g(1,Pr,2,4,"ng-container",3),u()),n&2){let o=s(2).ngIf;l(),c("ngForOf",o.filteredPresenceUsers)("ngForTrackBy",o.trackById)}}function Ur(n,r){if(n&1&&(d(0),g(1,xr,2,2,"ng-container",2),u()),n&2){let o=s().ngIf,e=s();l(),c("veltDynamicTemplate",k(3,Er,e.template,_(1,vn,e.componentConfigSignal),o==null?null:o.variant,e.setIfCondition.bind(e),e.elementRef))}}function Tr(n,r){if(n&1&&(d(0),g(1,Ur,2,9,"ng-container",1),u()),n&2){let o=s();l(),c("veltIf",E(3,br,o.conditionSignal(),_(1,vn,o.componentConfigSignal)))}}var Pe=(()=>{let r=class r extends ${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=v;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");Mt(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(b),m(f),m(p))},r.\u0275cmp=x({type:r,selectors:[["velt-presence-avatar-list-internal"]],standalone:!1,features:[j([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,Tr,2,6,"ng-container",0),t&2&&c("ngIf",i.componentConfigSignal())},dependencies:[bt,D,N,A,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%]{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 pn=n=>({componentConfigSignal:n}),kr=(n,r)=>({condition:n,data:r}),Dr=(n,r,o,e,t)=>({template:n,context:r,componentName:"velt-presence-avatar-remaining-count-wireframe",variant:o,setIfCondition:e,componentElementRef:t});function Ar(n,r){if(n&1&&(d(0),T(1,"snippyly-user-avatar",3),R(2,"div",4),O(),u()),n&2){let o=s(3).ngIf;l(),c("initial","+"+(o.filteredPresenceUsers.length-o.maxUsers).toString())}}function Nr(n,r){if(n&1&&(d(0),g(1,Ar,3,1,"ng-container",2),u()),n&2){let o=s(2).ngIf,e=s();l(),c("veltDynamicTemplate",k(3,Dr,e.template,_(1,pn,e.componentConfigSignal),o==null?null:o.variant,e.setIfCondition.bind(e),e.elementRef))}}function wr(n,r){if(n&1&&(d(0),g(1,Nr,2,9,"ng-container",0),u()),n&2){let o=s().ngIf;l(),c("ngIf",o.filteredPresenceUsers.length>o.maxUsers)}}function Fr(n,r){if(n&1&&(d(0),g(1,wr,2,1,"ng-container",1),u()),n&2){let o=s();l(),c("veltIf",E(3,kr,o.conditionSignal(),_(1,pn,o.componentConfigSignal)))}}var xe=(()=>{let r=class r extends ${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(b),m(f),m(p))},r.\u0275cmp=x({type:r,selectors:[["velt-presence-avatar-remaining-count-internal"]],standalone:!1,features:[j([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,Fr,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 dn=n=>({componentConfigSignal:n}),Mr=(n,r)=>({condition:n,data:r}),Lr=(n,r,o,e,t)=>({template:n,context:r,componentName:"velt-presence-wireframe",variant:o,setIfCondition:e,componentElementRef:t});function jr(n,r){n&1&&Le(0)}function $r(n,r){if(n&1&&(T(0,"velt-shadow-dom-internal"),g(1,jr,1,0,"ng-container",4),O()),n&2){s();let o=te(3);l(),c("ngTemplateOutlet",o)}}function Br(n,r){if(n&1&&(d(0),R(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 Wr(n,r){if(n&1&&(T(0,"div",6),g(1,Br,3,2,"ng-container",7),O()),n&2){let o=s(3).ngIf,e=s();l(),c("veltDynamicTemplate",k(3,Lr,e.template,_(1,dn,e.componentConfigSignal),o==null?null:o.variant,e.setIfCondition.bind(e),e.elementRef))}}function zr(n,r){if(n&1&&g(0,Wr,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,$r,2,1,"velt-shadow-dom-internal",3)(2,zr,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 Gr(n,r){if(n&1&&(d(0),g(1,Jr,4,2,"ng-container",2),u()),n&2){let o=s();l(),c("veltIf",E(3,Mr,o.conditionSignal(),_(1,dn,o.componentConfigSignal)))}}var pe=(()=>{let r=class r extends Ve{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=Ft(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,M,He,Ke,Te,Oe,ke){super(Te,Oe,void 0,void 0,void 0,ke,h),this.analyticsService=e,this.authService=t,this.flockService=i,this.presenceService=a,this.loggingService=h,this.wireframeService=y,this.overlay=M,this.overlayPositionBuilder=He,this.viewContainerRef=Ke,this.elementRef=Te,this.themeService=Oe,this.dynamicDataService=ke,this.DEFAULT_MAX_USERS=5,this._maxUsers=this.DEFAULT_MAX_USERS,this._inactivityTime=5,this._offlineInactivityTime=10,this._flockMode=!1,this.onNavigate=new fe,this.isExplicitShadowDom=!1,this.onPresenceUserClickEmitter=new fe,this.presenceUsers=[],this.subscriptions=[],this.constants=v,this.onUsersChanged=new fe,this.onPresenceUserChange=new fe,this.componentConfigSignal=Re({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(de=>{this.componentConfigSignal.update(ue=>(ue=F(C({},ue),{user:de}),ue)),this.componentConfigSignal().user&&(this.setPresenceInstalledInAnalytics(),this.presenceSetCustomMaxUsersInAnalytics())},de=>{this.loggingService.catch("Error in PresenceComponent getUser$ subscription: ",de)}))}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 b(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 Pt(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===v.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(P.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(P.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(ze),m(K),m(W),m(p),m(Je),m(Ut),m(xt),m(dt),m(b),m(Ge),m(f))},r.\u0275cmp=x({type:r,selectors:[["app-presence"]],hostVars:1,hostBindings:function(t,i){t&2&&ft("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,Me],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,Gr,2,6,"ng-container",1),t&2&&c("ngIf",i.componentConfigSignal())},dependencies:[D,Be,N,A,Pe,xe],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 Ue=(()=>{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(ot.MULTIPLE_USERS_ONLINE,e),this.analyticsService.trackEvent(P.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(ot.USER_STATE_CHANGE,e),this.analyticsService.trackEvent(P.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(L(t=>({data:t})))}catch(t){return this.loggingService.catch("Error in PresenceActionsService getData: ",t),w({data:null})}}triggerAction(e,t){try{this.actionSubjects.has(e)||this.actionSubjects.set(e,new Qe),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 Qe),this.actionSubjects.get(e)?.asObservable()}catch(t){return this.loggingService.catch("Error in PresenceActionsService onAction: ",t),w(null)}}};r.\u0275fac=function(t){return new(t||r)(I(ge),I(p),I(W))},r.\u0275prov=ae({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();var Xe=class extends qt{constructor(r){super(r),this.getService(p).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(p).log("%c[WB] Calling FUNCTION: getOnlineUsers","color: green;");try{return this.trackEvent(P.Events.Presence.GET_ONLINE_USERS_ON_CURRENT_DOCUMENT_TRIGGERED),this.getService(W).getOnlineUsersOnCurrentDocument()}catch(r){return this.getService(p).catch("Error in _getOnlineUsersOnCurrentDocument: ",r),w(null)}}_setInactivityTime(r){this.getService(p).log("%c[WB] Calling FUNCTION: _setInactivityTime","color: green;");try{this.trackEvent(P.Events.Presence.SET_INACTIVITY_TIME_TRIGGERED,{payload:{time:r}}),isNaN(r)?this.getService(p).catch("Error in setInactivityTime: ","Provided value is not a number."):this.getService(W).setInactivityTime(r)}catch(o){this.getService(p).catch("Error in setInactivityTime: ",o)}}_disableFlockMode(){try{this.trackEvent(P.Events.Presence.DISABLE_FLOCK_MODE_TRIGGERED),this.getService(K).disableFlockMode()}catch(r){this.getService(p).catch("Error in _disableFlockMode: ",r)}}_enableFlockMode(r){try{this.trackEvent(P.Events.Presence.ENABLE_FLOCK_MODE_TRIGGERED,{payload:{options:r}}),this.getService(K).enableFlockMode(r)}catch(o){this.getService(p).catch("Error in _enableFlockMode: ",o)}}_stopFollowingUser(){try{this.trackEvent(P.Events.Presence.STOP_FOLLOWING_USER_TRIGGERED),this.getService(K).stopFollowingUser()}catch(r){this.getService(p).catch("Error in _stopFollowingUser: ",r)}}_startFollowingUser(r){try{this.trackEvent(P.Events.Presence.START_FOLLOWING_USER_TRIGGERED,{payload:{externalId:r}});let o=this.getService(W).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(p).catch("Error in _startFollowingUser: ",o),{success:!1,msg:"Unknown error.",raw:o}}}_enableSelf(){try{this.trackEvent(P.Events.Presence.ENABLE_SELF_TRIGGERED),this.getService(W).enableIncludeSelf()}catch(r){this.getService(p).catch("Error in _enableSelf: ",r)}}_disableSelf(){try{this.trackEvent(P.Events.Presence.DISABLE_SELF_TRIGGERED),this.getService(W).disableIncludeSelf()}catch(r){this.getService(p).catch("Error in _disableSelf: ",r)}}_getData(r){this.getService(p).log("%c[WB] Calling FUNCTION: getData","color: green;");try{return this.trackEvent(P.Events.Presence.GET_PRESENCE_DATA_TRIGGERED,{payload:{query:r}}),r&&typeof r=="object"&&(r=C({},r),r?.documentId&&(r.documentId=At(r.documentId)),r?.organizationId&&(r.organizationId=Nt(r.organizationId))),this.getService(Ue).getData(r)}catch(o){return this.getService(p).catch("Error in _getData: ",o),w({data:null})}}_on(r){this.getService(p).log("%c[WB] Calling FUNCTION: on","color: green;");try{return this.getService(Ue).onAction(r)}catch(o){return this.getService(p).catch("Error in _on: ",o),w(null)}}_addUser(r){this.getService(p).log("%c[WB] Calling FUNCTION: addUser","color: green;");try{if(this.trackEvent(P.Events.Presence.ADD_USER_TRIGGERED,{payload:{userId:r?.user?.userId,localOnly:r?.localOnly}}),!r?.user?.userId){this.getService(p).catch("Error in addUser: ","userId is required");return}this.getService(W).addCustomUser(r)}catch(o){this.getService(p).catch("Error in addUser: ",o)}}_removeUser(r){this.getService(p).log("%c[WB] Calling FUNCTION: removeUser","color: green;");try{if(this.trackEvent(P.Events.Presence.REMOVE_USER_TRIGGERED,{payload:{userId:r?.user?.userId,localOnly:r?.localOnly}}),!r?.user?.userId){this.getService(p).catch("Error in removeUser: ","userId is required");return}this.getService(W).removeCustomUser(r)}catch(o){this.getService(p).catch("Error in removeUser: ",o)}}};var un=(()=>{let r=class r{};r.\u0275fac=function(t){return new(t||r)},r.\u0275mod=ht({type:r}),r.\u0275inj=pt({imports:[Et,re,Ye]});let n=r;return n})();var hn=(()=>{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)(I(p),I(Ht))},r.\u0275prov=ae({token:r,factory:r.\u0275fac,providedIn:"root"});let n=r;return n})();var Vr={"velt-presence-wireframe":pe,"velt-presence-avatar-list-wireframe":Pe,"velt-presence-avatar-list-item-wireframe":Ee,"velt-presence-avatar-remaining-count-wireframe":xe,"velt-presence-tooltip-wireframe":be,"velt-presence-tooltip-avatar-wireframe":Se,"velt-presence-tooltip-user-active-wireframe":Ce,"velt-presence-tooltip-user-inactive-wireframe":_e,"velt-presence-tooltip-user-name-wireframe":ye,"velt-presence-tooltip-status-container-wireframe":Ie};Object.assign(Qt,Vr);function Yr(n){n.get(p).log("%c[WB] Loading presence feature chunk","color: blue;");let o=n.get(Wt);o.set(jt,n.get(W)),o.set($t,n.get(Ue)),o.set(Bt,n.get(hn));let t=ut(un,n).injector;return fn(t,v.TAGS.VELT_PRESENCE,pe),fn(t,v.TAGS.SNIPPYLY_PRESENCE,pe),new Xe(n)}function fn(n,r,o){if(customElements.get(r))return;let e=Tt(o,n);customElements.define(r,e)}export{Yr as default};
|